@bendyline/gezel-service 1.1.1 → 1.1.2
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/NOTICE.md +3 -3
- package/dist/bin/gezeld.js +8471 -5311
- package/dist/handboek-content/technical/building-connected-apps-with-gezel-app-sdk.md +78 -0
- package/dist/handboek-content/whats-new/{1.26250.md → 1.26251.md} +5 -5
- package/dist/index-store/static-index-worker.js +160 -51
- package/dist/index.d.ts +416 -71
- package/dist/index.js +8465 -5305
- package/dist/memory/embed-worker.js +132 -4
- package/dist/memory/image-embed-worker.js +14 -5
- package/dist/providers/mlx/python/cache_persist.py +52 -8
- package/dist/providers/mlx/python/gezel_mlx_server.py +44 -1
- package/dist/providers/mlx/python/qwen4_ple.py +159 -0
- package/dist/providers/mlx/python/spec_decode.py +73 -31
- package/dist/providers/mlx/python/tool_call_stream.py +10 -2
- package/dist/providers/mlx/python/tool_grammar.py +16 -0
- package/dist/ui/assets/{AmbientDashboardCard-DcVHxEdC.js → AmbientDashboardCard-_xnAQGnk.js} +1 -1
- package/dist/ui/assets/{AudioEngineSettings-BFM2S1mm.js → AudioEngineSettings-CgXgbX0i.js} +1 -1
- package/dist/ui/assets/{BenchmarksView-84-YeULA.js → BenchmarksView-BlExZpYA.js} +1 -1
- package/dist/ui/assets/CatalogBrowser-DYXUZQ_t.js +1 -0
- package/dist/ui/assets/{ChannelsSettings-7NAVUk4k.js → ChannelsSettings-EH27HcqZ.js} +1 -1
- package/dist/ui/assets/ChatTimelineView-Dn1TNyVn.js +7 -0
- package/dist/ui/assets/{ConnectedAppsPanel-CIgF4Q3R.js → ConnectedAppsPanel-BROry-Y0.js} +1 -1
- package/dist/ui/assets/CraftbookEditor-B2RNJnFf.js +1 -0
- package/dist/ui/assets/{CraftbookScriptEditorView-Ck5tzj3Y.js → CraftbookScriptEditorView-B-vySmHP.js} +1 -1
- package/dist/ui/assets/{CraftbookTabContent-BWg7FhK_.js → CraftbookTabContent-BW_2KC89.js} +1 -1
- package/dist/ui/assets/{CraftbookToolsetSetup-EuFOiUzR.js → CraftbookToolsetSetup-J7rEa835.js} +1 -1
- package/dist/ui/assets/{CraftbooksView-BIzQ1VVn.js → CraftbooksView-BjBUWPGF.js} +1 -1
- package/dist/ui/assets/DiffpackReviewView-CD4qJmgT.js +1 -0
- package/dist/ui/assets/DocumentDetail-SYozruTJ.js +1 -0
- package/dist/ui/assets/DocumentsView-DE7eL49Z.js +1 -0
- package/dist/ui/assets/{Ds4Settings-9soZCSeO.js → Ds4Settings-DGzc7JcD.js} +1 -1
- package/dist/ui/assets/{EmbeddedChat-Cce7nxXT.js → EmbeddedChat-D92TaJQ8.js} +1 -1
- package/dist/ui/assets/{FaceRecognitionCard-BVZyOwB8.js → FaceRecognitionCard-CB1Dt9X4.js} +1 -1
- package/dist/ui/assets/FileMapView-kVBG22FU.js +1 -0
- package/dist/ui/assets/FoldersSettings-BWFQU5B4.js +1 -0
- package/dist/ui/assets/GezelDetail-Br4v42Nv.js +1 -0
- package/dist/ui/assets/{GezelJsonEditor-DXXt165-.js → GezelJsonEditor-B9XEiW5Y.js} +1 -1
- package/dist/ui/assets/GezellenView-DheEBAy4.js +1 -0
- package/dist/ui/assets/{GildeUpdatesCard-CtY8mUTA.js → GildeUpdatesCard-BeIYv09f.js} +1 -1
- package/dist/ui/assets/{GithubSignInChip-DT3l6E0Q.js → GithubSignInChip-eEGCe9ar.js} +1 -1
- package/dist/ui/assets/{HandboekMediaProvider-ByJ4NAzz.js → HandboekMediaProvider-D0zcbbpf.js} +1 -1
- package/dist/ui/assets/HandboekView-p0BZT1rH.js +1 -0
- package/dist/ui/assets/{HistoryView-CkinzFEC.js → HistoryView-CKWcWW-Y.js} +1 -1
- package/dist/ui/assets/{HomeView-DNBrQnwy.js → HomeView-b_TT5oV3.js} +1 -1
- package/dist/ui/assets/{ImageEngineSettings-BfM9HSd_.js → ImageEngineSettings-CJfk4OJ4.js} +1 -1
- package/dist/ui/assets/{ImageRecognitionSettings-CaSQu5Br.js → ImageRecognitionSettings-DzbvZk5S.js} +1 -1
- package/dist/ui/assets/{IncompleteDownloads-C36lTCMG.js → IncompleteDownloads-C8_XyP8O.js} +1 -1
- package/dist/ui/assets/{KnowledgeCatalogsCard-CK9bqdf6.js → KnowledgeCatalogsCard-CHopG_j-.js} +1 -1
- package/dist/ui/assets/KnowledgeView-CXNKZUJq.js +1 -0
- package/dist/ui/assets/{LlamaCppSettings-CdNMHBbp.js → LlamaCppSettings-ohcM7kes.js} +1 -1
- package/dist/ui/assets/{MarkdownField-Dugmfr_e.js → MarkdownField-BX0qsaFq.js} +1 -1
- package/dist/ui/assets/{MemoriesTree-CgFqUNEr.js → MemoriesTree-BPj5Rod8.js} +1 -1
- package/dist/ui/assets/{MicrophoneSettings-DzDe9y1q.js → MicrophoneSettings-CWjeYnfI.js} +1 -1
- package/dist/ui/assets/MlxSettings-Dq6dRpcl.js +1 -0
- package/dist/ui/assets/{ModelPicker-BVkJhNAH.js → ModelPicker-0Ue-eEKj.js} +1 -1
- package/dist/ui/assets/NewPathDialog-BhAZm9dp.js +1 -0
- package/dist/ui/assets/{NewScriptDialog-TEAd0KLl.js → NewScriptDialog-DuryIe50.js} +1 -1
- package/dist/ui/assets/NewTaskDialog-BX24flMY.js +2 -0
- package/dist/ui/assets/{OllamaSettings-CPy2vxyZ.js → OllamaSettings-Boj8Nd1G.js} +1 -1
- package/dist/ui/assets/ProjectChat-Dhw_M5bq.js +5 -0
- package/dist/ui/assets/ProjectConnectionsTab-BwpMQNrg.js +1 -0
- package/dist/ui/assets/{ProjectGitStatusBar-BgHZ2ijN.js → ProjectGitStatusBar-BORGYx5l.js} +1 -1
- package/dist/ui/assets/{ProjectGithubView-BV2uTNU0.js → ProjectGithubView-CTP1BOMv.js} +1 -1
- package/dist/ui/assets/{ProjectMailTab-DLtJdXSL.js → ProjectMailTab-qFmAeV3M.js} +1 -1
- package/dist/ui/assets/{ProjectOverviewView-ZMs9nL5N.js → ProjectOverviewView-Cq1FsoaT.js} +1 -1
- package/dist/ui/assets/{ProjectTimeline-CTPcn4Kc.js → ProjectTimeline-Cqae2Z92.js} +1 -1
- package/dist/ui/assets/ProjectsView-D0uJjUB-.js +7 -0
- package/dist/ui/assets/{RecommendedBadge-iUoisQBi.js → RecommendedBadge-CN1jEmSn.js} +1 -1
- package/dist/ui/assets/{RemoteServersPanel-CTVJ0IRh.js → RemoteServersPanel-CMakvCCM.js} +1 -1
- package/dist/ui/assets/{ScriptEditorTabs-CCDFZjdC.js → ScriptEditorTabs-st6dJePd.js} +2 -2
- package/dist/ui/assets/{ScriptEditorView-CergLqKj.js → ScriptEditorView-BkySh57_.js} +2 -2
- package/dist/ui/assets/{ScriptsView-v7ckdhDi.js → ScriptsView-7uPKwjDB.js} +1 -1
- package/dist/ui/assets/{SecurityComplianceSettings-Bd0-66Gs.js → SecurityComplianceSettings-Tsv_pXfy.js} +1 -1
- package/dist/ui/assets/SessionSwitcher-D0fSeeHO.js +1 -0
- package/dist/ui/assets/SettingsView-cli_z8ZW.js +3 -0
- package/dist/ui/assets/{SquisqIntegration-C5l_OPvD.js → SquisqIntegration-BTZ1kBlg.js} +1 -1
- package/dist/ui/assets/{StorageCleanupDialog-3kv9-2mT.js → StorageCleanupDialog-CDBjl8JQ.js} +1 -1
- package/dist/ui/assets/{StorageUsageCard-7sWTrZFa.js → StorageUsageCard-DXY1j0dZ.js} +1 -1
- package/dist/ui/assets/TaskTabContent-C0P681SL.js +1 -0
- package/dist/ui/assets/TasksView-Ddwz10ri.js +1 -0
- package/dist/ui/assets/{TerminalCodeEditor-ChmdzmCz.js → TerminalCodeEditor-BkNQ6QoQ.js} +2 -2
- package/dist/ui/assets/ToolsetsEditor-KVigemfL.js +8 -0
- package/dist/ui/assets/{TransformToolbarButton-gzIxUBH7.js → TransformToolbarButton-8wfJR1bO.js} +2 -2
- package/dist/ui/assets/{UnrecognizedModels-0hptopv6.js → UnrecognizedModels-BzdU1clO.js} +1 -1
- package/dist/ui/assets/{VideoEngineSettings-BdNzCEdR.js → VideoEngineSettings-f79ff57u.js} +1 -1
- package/dist/ui/assets/{WorkspaceIndexPane-DnsOO916.js → WorkspaceIndexPane-fu5V6o1W.js} +1 -1
- package/dist/ui/assets/{api-C0I7spBl.js → api-CmrgM5Rf.js} +1 -1
- package/dist/ui/assets/chat-thread-memory-8MCtb17Q.js +1 -0
- package/dist/ui/assets/{chunk-6ECMNUIP-BvCy0HUI.js → chunk-6ECMNUIP-D5AA6ozp.js} +1 -1
- package/dist/ui/assets/{chunk-A6N6IN3I-ofeM4l8g.js → chunk-A6N6IN3I-BpxihS5H.js} +1 -1
- package/dist/ui/assets/{chunk-ATWVNF7D-CYuW1Yc6.js → chunk-ATWVNF7D-CKIWh7bN.js} +1 -1
- package/dist/ui/assets/{chunk-UBFT2CDQ-FexGDigd.js → chunk-CW24CH7I-BD0FIooX.js} +1 -1
- package/dist/ui/assets/{chunk-DXYWKZ52-zxe8pjH4.js → chunk-DXYWKZ52-DMKPZnpo.js} +1 -1
- package/dist/ui/assets/chunk-IIQYS2YH-BtDJt4Xr.js +1 -0
- package/dist/ui/assets/{chunk-KGWT454C-v5-l6U5m.js → chunk-KGWT454C-DsQOBuLg.js} +1 -1
- package/dist/ui/assets/{chunk-Q77KNJIN-BLuPdsQF.js → chunk-Q77KNJIN-BdWizq9s.js} +1 -1
- package/dist/ui/assets/{chunk-USU6HTKB-B_p-YcDp.js → chunk-USU6HTKB-DyGZplh4.js} +1 -1
- package/dist/ui/assets/{chunk-UXEANVBI-Bt0kX-0Z.js → chunk-UXEANVBI-BUBXvqyE.js} +1 -1
- package/dist/ui/assets/{chunk-O7JILDEF-CqcO1qaI.js → chunk-X7BNDUNI-D14WIvlD.js} +2 -2
- package/dist/ui/assets/{chunk-AE3IUKMM-mZjzzO8Z.js → chunk-ZSU5DJLX-CrjQf-vs.js} +1 -1
- package/dist/ui/assets/{container-BI8hxN1N.js → container-iFj1r6Hk.js} +1 -1
- package/dist/ui/assets/csv-Di411Mv-.js +1 -0
- package/dist/ui/assets/data-Q05qqAp4.js +1 -0
- package/dist/ui/assets/{dist-APSIK7H3.js → dist-1FNFiksd.js} +3 -3
- package/dist/ui/assets/dist-BMZhqfv7.js +2 -0
- package/dist/ui/assets/dist-CE5CbmDb.js +225 -0
- package/dist/ui/assets/doc-BHcGsJZd.js +587 -0
- package/dist/ui/assets/{document-import-DPK4r8Am.js → document-import-B2Ya6sbf.js} +1 -1
- package/dist/ui/assets/{docx-DRLuCTaC.js → docx-B8Pwz5Ih.js} +1 -1
- package/dist/ui/assets/{epub-a0p2Xb1b.js → epub-BQ4g8Q9j.js} +1 -1
- package/dist/ui/assets/{export-options-BqYFyzWx.js → export-options-Dylv69b3.js} +1 -1
- package/dist/ui/assets/file-browser-BLOPfnS0.js +5 -0
- package/dist/ui/assets/{html-BbQNmJ5X.js → html-BnA7qFwq.js} +1 -1
- package/dist/ui/assets/icons-CyM7Cg4E.js +1 -0
- package/dist/ui/assets/index-DW6qHqhU.css +1 -0
- package/dist/ui/assets/index-DivKnJyx.js +36 -0
- package/dist/ui/assets/{mail-link-CWfsP5Aq.js → mail-link-NtlcX5OE.js} +1 -1
- package/dist/ui/assets/{markdown-ryKA_OmY.js → markdown-CLKH_zzl.js} +1 -1
- package/dist/ui/assets/markdown-baseline-0dqv9qbV.js +1 -0
- package/dist/ui/assets/materialize-G4WC5UG3-xq2dcwS8.js +1 -0
- package/dist/ui/assets/{monaco-base-C0VTMpv-.js → monaco-base-BSvdAweA.js} +1 -1
- package/dist/ui/assets/{monaco-setup-CX8q88c5.js → monaco-setup-CT7LZ0o_.js} +1 -1
- package/dist/ui/assets/{new-project-meta-ZmDPGYzC.js → new-project-meta-5Y9Blozr.js} +1 -1
- package/dist/ui/assets/outside-in-Msmhxf_U.js +3 -0
- package/dist/ui/assets/{pdf-BHrygJa5.js → pdf-C4BhW3zg.js} +1 -1
- package/dist/ui/assets/{pending-drafts-27ujtQxX.js → pending-drafts-BD227X9H.js} +1 -1
- package/dist/ui/assets/{poppetje-CfaAvFkE.js → poppetje-DvCJO36y.js} +3 -3
- package/dist/ui/assets/{pptx-nDW64jAN.js → pptx-B6uaM2s7.js} +3 -3
- package/dist/ui/assets/{run-export-86KzLZ7R.js → run-export-TscWwR6y.js} +2 -2
- package/dist/ui/assets/{standalone-source-7QdiNsDW.js → standalone-source-Cw9SF7Zk.js} +1 -1
- package/dist/ui/assets/storage-Cmhlwx70.js +1 -0
- package/dist/ui/assets/styles-BjDaWeMA.css +1 -0
- package/dist/ui/assets/styles-CqO-rmOt.js +554 -0
- package/dist/ui/assets/{terminal-monaco-setup-Bar-sYKd.js → terminal-monaco-setup-me523-j-.js} +1 -1
- package/dist/ui/assets/{transform-CmAXy0Ck.js → transform-DxJCwK68.js} +1 -1
- package/dist/ui/assets/{use-local-model-manager-D1yiurrC.js → use-local-model-manager-8wvk-I-y.js} +1 -1
- package/dist/ui/assets/{useCompactLayout-BDtPQcDh.js → useCompactLayout-cm4E9Vja.js} +0 -0
- package/dist/ui/assets/{useCopilotAvailability-BHOfHrfT.js → useCopilotAvailability-D9hglSH_.js} +1 -1
- package/dist/ui/assets/{useDiffpacks-B0kYhlWQ.js → useDiffpacks-1BN2XJWg.js} +1 -1
- package/dist/ui/assets/{useGitSync-DOt-ODiw.js → useGitSync-7m9YA7h5.js} +1 -1
- package/dist/ui/assets/{useShowWorkInProgressFeatures-BtpredG7.js → useShowWorkInProgressFeatures-D6QOaTUT.js} +1 -1
- package/dist/ui/assets/{useTotalRamBytes-B8NFM27w.js → useTotalRamBytes-Durk383U.js} +1 -1
- package/dist/ui/assets/{xlsx-B_pu1ZvY.js → xlsx-BbHA9bxA.js} +1 -1
- package/dist/ui/index.html +15 -15
- package/package.json +12 -11
- package/dist/ui/assets/CatalogBrowser-7_jHy5Q3.js +0 -1
- package/dist/ui/assets/ChatTimelineView-Cg_kLK_U.js +0 -7
- package/dist/ui/assets/CraftbookEditor-BKAIsnXv.js +0 -1
- package/dist/ui/assets/DiffpackReviewView-B2a3zgE-.js +0 -1
- package/dist/ui/assets/DocumentDetail-GCYhwQqV.js +0 -1
- package/dist/ui/assets/DocumentsView-Cm3RaQ5N.js +0 -1
- package/dist/ui/assets/FileMapView-BKJovLcL.js +0 -1
- package/dist/ui/assets/FoldersSettings-CuJd2JdE.js +0 -1
- package/dist/ui/assets/GezelDetail-D_KIPDhQ.js +0 -1
- package/dist/ui/assets/GezellenView-BOOW1QQU.js +0 -1
- package/dist/ui/assets/HandboekView-gRzJcIbJ.js +0 -1
- package/dist/ui/assets/KnowledgeView-DJ3cJVHA.js +0 -1
- package/dist/ui/assets/MlxSettings-45mBFHbA.js +0 -1
- package/dist/ui/assets/NewTaskDialog-CIXVunZn.js +0 -2
- package/dist/ui/assets/ProjectChat-BiJRweob.js +0 -5
- package/dist/ui/assets/ProjectConnectionsTab-CQgaIzuv.js +0 -1
- package/dist/ui/assets/ProjectsView-BUdR76n6.js +0 -7
- package/dist/ui/assets/SessionSwitcher-BgZqyiRn.js +0 -1
- package/dist/ui/assets/SettingsView-DLhOYiR5.js +0 -3
- package/dist/ui/assets/TaskTabContent-CG2KmfwV.js +0 -1
- package/dist/ui/assets/TasksView-Dy5Ue4zS.js +0 -1
- package/dist/ui/assets/ToolsetsEditor-J9XxQ5Ms.js +0 -8
- package/dist/ui/assets/chat-thread-memory-CI2-giEq.js +0 -1
- package/dist/ui/assets/chunk-IIQYS2YH-DEkyBlHg.js +0 -1
- package/dist/ui/assets/csv-B0D9jJG2.js +0 -1
- package/dist/ui/assets/data-BIL84EaT.js +0 -1
- package/dist/ui/assets/dist-CJqyWK6E.js +0 -2
- package/dist/ui/assets/dist-DOqbRmFj.js +0 -225
- package/dist/ui/assets/doc-C2Ph2FWI.js +0 -584
- package/dist/ui/assets/document-companion-aDThLOwl.js +0 -1
- package/dist/ui/assets/file-browser-DVyWN0LD.js +0 -5
- package/dist/ui/assets/icons-DWaUNQbT.js +0 -1
- package/dist/ui/assets/index-DDu8nyO6.js +0 -34
- package/dist/ui/assets/index-DEDUSiCx.css +0 -1
- package/dist/ui/assets/markdown-baseline-9B52XlX2.js +0 -1
- package/dist/ui/assets/materialize-G4WC5UG3-BlZQe-88.js +0 -1
- package/dist/ui/assets/outside-in-BmIIeMid.js +0 -3
- package/dist/ui/assets/storage-B-vhjyV2.js +0 -1
- package/dist/ui/assets/styles-BvkZd-EV.js +0 -550
- package/dist/ui/assets/styles-IQ4adxWr.css +0 -1
|
@@ -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{At as r,Tn as i,W as a,Yt as o,_ as s,at as c,b as l,d as u,g as d,i as f,m as p,mt as m,n as h,t as g,v as _}from"./dist-CE5CbmDb.js";import{t as v}from"./dist-BMZhqfv7.js";import{t as y}from"./api-CmrgM5Rf.js";import{i as b,n as x,r as S}from"./Tabs-jE0Z5Tzd.js";import{G as C,H as w,J as T,K as E,W as D,Y as O,d as k,l as A,m as j,p as M,q as N,s as P}from"./primitives-CWrGZpPI.js";import{n as F,t as I}from"./poppetje-DvCJO36y.js";import{t as L}from"./ConfirmDialog-Dt1ed4Fh.js";import{a as R,o as ee,t as z}from"./model-inventory-ykSm_IT5.js";import{t as te}from"./styles-CqO-rmOt.js";import{Ct as ne,O as re,Wt as B,et as V,j as H,wt as ie,y as ae,zt as U}from"./index-DivKnJyx.js";import{i as oe,t as se}from"./ChatTimelineView-Dn1TNyVn.js";import{t as ce}from"./SessionSwitcher-D0fSeeHO.js";import{t as le}from"./ProjectTimeline-Cqae2Z92.js";import{c as ue,l as de,n as fe,o as pe,r as me,s as he}from"./chat-thread-memory-8MCtb17Q.js";import{t as ge}from"./ToolsetsEditor-KVigemfL.js";import{t as _e}from"./MemoriesTree-BPj5Rod8.js";import{t as ve}from"./markdown-baseline-0dqv9qbV.js";import{t as ye}from"./TransformToolbarButton-8wfJR1bO.js";import{t as be}from"./ds4-availability-TaGRbP_O.js";import{a as xe,t as Se}from"./ModelPicker-0Ue-eEKj.js";var W=e(t(),1),G=n();function Ce({gezel:e,onUpdated:t}){let n=e.fixedFunction,r=n?.defaults?JSON.stringify(n.defaults,null,2):``,[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1);(0,W.useEffect)(()=>{a(r),p(!1),s(null),l(null)},[e.id]);let m=(0,W.useCallback)(async()=>{s(null),l(null);let n=null;if(i.trim())try{let e=JSON.parse(i);if(e===null||Array.isArray(e)||typeof e!=`object`)throw Error(`defaults must be a JSON object`);n=e}catch(e){s(`Invalid JSON: ${e.message}`);return}d(!0);try{t(await y.updateGezelFixedFunctionDefaults(e.id,{defaults:n&&Object.keys(n).length>0?n:null})),p(!1),l(`Saved`)}catch(e){s(`Save failed: ${e.message}`)}finally{d(!1)}},[i,e.id,t]);return n?(0,G.jsxs)(`div`,{className:`ff-about-panel`,children:[(0,G.jsxs)(`div`,{className:`ff-about-summary`,children:[(0,G.jsxs)(`div`,{className:`ff-about-row`,children:[(0,G.jsx)(`span`,{className:`ff-label`,children:`Forwards to`}),(0,G.jsx)(`code`,{className:`ff-tool-name`,children:n.tool}),(0,G.jsx)(`span`,{className:`muted small`,children:`— no LLM is invoked`})]}),(0,G.jsxs)(`div`,{className:`ff-about-row`,children:[(0,G.jsx)(`span`,{className:`ff-label`,children:`Argument`}),(0,G.jsxs)(`span`,{children:[`Your message text is passed as `,(0,G.jsx)(`code`,{children:n.promptKey}),`.`]})]}),e.description&&(0,G.jsx)(`p`,{className:`muted`,children:e.description})]}),(0,G.jsxs)(`div`,{className:`ff-defaults`,children:[(0,G.jsx)(`label`,{className:`ff-defaults-label`,htmlFor:`ff-defaults-${e.id}`,children:`Default arguments`}),(0,G.jsxs)(`p`,{className:`muted small ff-defaults-help`,children:[`Merged into every call as JSON. Your message text on `,(0,G.jsx)(`code`,{children:n.promptKey}),` always wins over a collision here. Common keys for `,(0,G.jsx)(`code`,{children:n.tool}),`: `,(0,G.jsx)(`code`,{children:`width`}),`,`,` `,(0,G.jsx)(`code`,{children:`height`}),`, `,(0,G.jsx)(`code`,{children:`steps`}),`, `,(0,G.jsx)(`code`,{children:`model`}),`, `,(0,G.jsx)(`code`,{children:`negativePrompt`}),`. Leave empty to forward only the prompt.`]}),(0,G.jsx)(`textarea`,{id:`ff-defaults-${e.id}`,className:`ff-defaults-textarea`,value:i,spellCheck:!1,rows:10,placeholder:`{\\n "width": 1024,\\n "height": 1024\\n}`,onChange:e=>{a(e.target.value),p(!0),l(null)},disabled:u}),(0,G.jsxs)(`div`,{className:`ff-defaults-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`primary`,onClick:()=>void m(),disabled:u||!f,children:u?`Saving…`:`Save defaults`}),c&&(0,G.jsx)(`span`,{className:`muted small`,children:c}),o&&(0,G.jsx)(`span`,{className:`error small`,children:o})]})]})]}):null}function we({gezelId:e,activeSessionId:t,onFocusSession:n,onToolActivity:r,onArtifactReference:i,onArtifactSeen:a,onWorkspaceReference:o,onWorkspaceSeen:s,onOpenReference:c,onTaskReference:l,emptyPlaceholder:u}){let d=(0,W.useCallback)(t=>y.listGezelTimeline(e,t),[e]),f=(0,W.useCallback)(()=>y.gezelEventsUrl(e),[e]),p=(0,W.useMemo)(()=>({gezelId:e}),[e]);return(0,G.jsx)(se,{scopeKey:`gezel:${e}`,activeSessionId:t,onFocusSession:n,onToolActivity:r,onArtifactReference:i,onArtifactSeen:a,onWorkspaceReference:o,onWorkspaceSeen:s,onOpenReference:c,...l?{onTaskReference:l}:{},emptyPlaceholder:u,loadTimeline:d,streamUrl:f,inflightScope:p})}var K=`__ALL__`,Te=`gezel:chat:last-project:`;function Ee(e){try{return window.localStorage.getItem(`${Te}${e}`)??void 0}catch{return}}function De({projects:e,intentProjectId:t,lastProjectId:n,workingProjectIds:r}){if(t)return e.find(e=>e.projectId===t)?.projectId??t;if(n&&r?.has(n))return n;let i=e.find(e=>r?.has(e.projectId));return i?i.projectId:n===K||e.some(e=>e.projectId===n)?n:e[0]?.projectId}function Oe(e,t){return e.find(e=>t?.has(e.projectId))?.projectId}function ke({gezel:e,engineLabel:t,workingProjectIds:n,activeTurnsReady:r=!0}){let[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),f=(0,W.useRef)(0),p=(0,W.useCallback)((e,t)=>{f.current+=1,d({sessionId:e,requestKey:f.current,...t===void 0?{}:{messageIndex:t}})},[]),m=(0,W.useRef)(n),h=(0,W.useRef)(r),g=(0,W.useRef)(!1),_=(0,W.useRef)(!1);return m.current=n,h.current=r,(0,W.useEffect)(()=>{let t=!1;a(null),s(``),g.current=!1,_.current=!1;let n=V(e.id);return n&&(g.current=!0,_.current=!0,l(n.sessionId),p(n.sessionId,n.messageIndex)),y.listProjectsForGezel(e.id).then(r=>{if(t)return;a(r.projects);let i=De({projects:r.projects,intentProjectId:n?.projectId,lastProjectId:Ee(e.id),workingProjectIds:h.current?m.current:void 0});i&&s(i)}).catch(()=>{t||a([])}),()=>{t=!0}},[e.id,p]),(0,W.useEffect)(()=>{if(!r||i===null||!o||g.current||_.current||(g.current=!0,n?.has(o)))return;let e=Oe(i,n);e&&s(e)},[r,i,o,n]),(0,W.useEffect)(()=>{if(o)try{window.localStorage.setItem(`${Te}${e.id}`,o)}catch{}},[e.id,o]),(0,W.useEffect)(()=>{let t=t=>{let n=t.detail;!n||n.gezelId!==e.id||(g.current=!0,_.current=!0,n.projectId&&s(n.projectId),l(n.sessionId),p(n.sessionId,n.messageIndex))};return window.addEventListener(`gezel:open-session`,t),()=>window.removeEventListener(`gezel:open-session`,t)},[e.id,p]),(0,W.useEffect)(()=>{let t=t=>{if(t.detail?.gezelId!==e.id||i===null)return;let r=Oe(i,n);r&&(g.current=!0,_.current=!1,s(r))};return window.addEventListener(`gezel:prefer-working-project`,t),()=>window.removeEventListener(`gezel:prefer-working-project`,t)},[e.id,i,n]),(0,W.useEffect)(()=>{o&&o!=="default"&&o!==K&&window.dispatchEvent(new CustomEvent(`gezel:open-tab`,{detail:{kind:`project`,id:o,activate:!1}}))},[o]),i===null?(0,G.jsx)(`p`,{className:`muted small`,children:`Loading projects…`}):i.length===0?(0,G.jsx)(`p`,{className:`muted small`,children:`No projects available yet — create one from the Projects tab.`}):(0,G.jsxs)(`div`,{className:`gezel-chat-tab`,children:[(0,G.jsxs)(`div`,{className:`gezel-chat-project-row`,children:[(0,G.jsx)(`span`,{className:`muted small`,children:`Project:`}),(0,G.jsxs)(k,{value:o,onValueChange:e=>{_.current=!0,g.current=!0,s(e)},children:[(0,G.jsx)(M,{className:`gezel-chat-project-select`,children:(0,G.jsx)(j,{})}),(0,G.jsxs)(P,{children:[(0,G.jsx)(A,{value:K,children:`All projects`}),i.map(e=>(0,G.jsx)(A,{value:e.projectId,children:Ae(e)},e.projectId))]})]})]}),o===K?(0,G.jsx)(Me,{gezel:e},`${e.id}:__ALL__`):o&&(0,G.jsx)(je,{gezel:e,engineLabel:t,project:i.find(e=>e.projectId===o)??{projectId:o,projectName:o,precedence:`session`},focusSessionId:c||void 0,sessionFocusRequest:u??void 0},`${e.id}:${o}`)]})}function Ae(e){switch(e.precedence){case`voorman`:return`${e.projectName} — voorman`;case`assignment`:return`${e.projectName} — assigned`;case`session`:return`${e.projectName}`;case`fallback`:return`${e.projectName} (default)`}}function je({gezel:e,engineLabel:t,project:n,focusSessionId:r,sessionFocusRequest:i}){let s=a(e,H()),c=me(e.id,n.projectId),[l,u]=(0,W.useState)(()=>r??pe(c)?.sessionId??``),[d,f]=(0,W.useState)(``),[p,m]=(0,W.useState)(0),[h,g]=(0,W.useState)(0),[_,v]=(0,W.useState)(null);(0,W.useEffect)(()=>{r&&u(r)},[r]),(0,W.useEffect)(()=>{he(c,{sessionId:l})},[c,l]);let y=(0,W.useMemo)(()=>{let t=o(e.gender);return`Talk to ${s} about what ${t.subject} ${t.presentBe} working on in this project.`},[s,e.gender]),b=(0,W.useMemo)(()=>ue({role:n.precedence===`voorman`?`voorman`:`other`,gezelName:s,gezelGender:e.gender,projectName:n.projectName,fixedFunctionTool:e.fixedFunction?.tool}),[n.precedence,n.projectName,s,e.gender,e.fixedFunction?.tool]);return(0,G.jsx)(de,{projectId:n.projectId,skillsProjectId:n.projectId==="default"?void 0:n.projectId,chatKey:`${n.projectId}:${e.id}`,children:({onToolActivity:r,onArtifactReference:a,onArtifactSeen:o,onWorkspaceReference:s,onWorkspaceSeen:c,recentReferences:x,onOpenReference:S,onTaskReference:C})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(le,{projectId:n.projectId,gezelId:e.id,activeSessionId:l||void 0,onFocusSession:(t,n)=>{n===e.id&&u(t)},onToolActivity:r,onArtifactReference:a,onArtifactSeen:o,onWorkspaceReference:s,onWorkspaceSeen:c,onOpenReference:S,onTaskReference:C,emptyPlaceholder:y,sessionFocusRequest:i}),_?(0,G.jsx)(Ne,{source:_,children:(0,G.jsx)(ce,{gezelId:e.id,projectId:n.projectId,sessionId:l||void 0,onSessionIdChange:e=>u(e??``),onActiveSessionChange:e=>v(e?.source??null),onFreshThread:()=>g(e=>e+1),refreshKey:p,engineLabel:t})}):(0,G.jsx)(oe,{gezelId:e.id,gezelName:e.name,gezelRoleBasedName:e.roleBasedName,gezelRole:e.role,gezelIcon:e.icon??null,gezelPoppetje:e.poppetje,gezelIconOverride:e.iconOverride,projectId:n.projectId,sessionId:l||void 0,focusRequestKey:h,onSessionCreated:e=>{u(e),m(e=>e+1)},onToolActivity:r,recentReferences:x,onOpenReference:S,placeholder:b,draftScope:`gezel`,draftId:d||void 0,onDraftIdChange:e=>f(e??``),belowAddressLine:(0,G.jsx)(ce,{gezelId:e.id,projectId:n.projectId,sessionId:l||void 0,onSessionIdChange:e=>u(e??``),onActiveSessionChange:e=>v(e?.source??null),onFreshThread:()=>g(e=>e+1),refreshKey:p,engineLabel:t,activeDraftId:d||void 0,onDraftSelect:e=>f(e??``),draftScope:`gezel`})})]})})}function Me({gezel:e}){let t=a(e,H()),n=fe(e.id),[r,i]=(0,W.useState)(()=>{let e=pe(n);return!e?.sessionId||!e.projectId?null:{sessionId:e.sessionId,projectId:e.projectId}});(0,W.useEffect)(()=>{he(n,{sessionId:r?.sessionId??``,projectId:r?.projectId??``})},[n,r?.sessionId,r?.projectId]);let o=(0,W.useMemo)(()=>`No chats with ${t} yet — start one below.`,[t]),s=(0,W.useMemo)(()=>ue({role:`other`,gezelName:t,gezelGender:e.gender,projectName:r?void 0:`default`,fixedFunctionTool:e.fixedFunction?.tool}),[t,e.gender,r,e.fixedFunction?.tool]),c=r?.projectId??`default`;return(0,G.jsx)(de,{projectId:c,skillsProjectId:c==="default"?void 0:c,chatKey:`all:${e.id}`,children:({onToolActivity:t,onArtifactReference:n,onArtifactSeen:a,onWorkspaceReference:l,onWorkspaceSeen:u,recentReferences:d,onOpenReference:f,onTaskReference:p})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(we,{gezelId:e.id,activeSessionId:r?.sessionId,onFocusSession:(e,t,n)=>{i({sessionId:e,projectId:n}),y.getChatSession(e).then(t=>{i(r=>r?.sessionId===e?{sessionId:e,projectId:n,...t.source?{source:t.source}:{}}:r)}).catch(()=>{})},onToolActivity:t,onArtifactReference:n,onArtifactSeen:a,onWorkspaceReference:l,onWorkspaceSeen:u,onOpenReference:f,onTaskReference:p,emptyPlaceholder:o}),r?.source?(0,G.jsx)(Ne,{source:r.source}):(0,G.jsx)(oe,{gezelId:e.id,gezelName:e.name,gezelRoleBasedName:e.roleBasedName,gezelRole:e.role,gezelIcon:e.icon??null,gezelPoppetje:e.poppetje,gezelIconOverride:e.iconOverride,projectId:c,sessionId:r?.sessionId,onSessionCreated:e=>i({sessionId:e,projectId:c}),onToolActivity:t,recentReferences:d,onOpenReference:f,placeholder:s,draftScope:`gezel-all`})]})})}function Ne({source:e,children:t}){return(0,G.jsxs)(`div`,{className:`external-conversation-panel`,"aria-live":`polite`,children:[t,(0,G.jsxs)(`div`,{className:`external-conversation-notice`,children:[(0,G.jsxs)(`span`,{className:`external-conversation-label`,children:[`From `,e.appName,` · read-only`]}),(0,G.jsxs)(`span`,{children:[`This conversation updates live here. Replies and tool controls stay in `,e.appName,`.`]})]})]})}function Pe({gezelRole:e,gezelTemplateId:t,onApply:n}){let[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)([]),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null);(0,W.useEffect)(()=>{r&&(c(!0),f(null),y.listCatalogItems(`gezel-template`).then(e=>o(e.items)).catch(e=>f(e.message)).finally(()=>c(!1)))},[r]);let p=(0,W.useMemo)(()=>{let n=a.filter(e=>e.manifest.kind===`gezel-template`),r=e?.toLowerCase().trim(),i=t?n.find(e=>e.manifest.id===t)?.manifest.id:void 0,o=i??(r?n.find(e=>e.manifest.role.toLowerCase().trim()===r)?.manifest.id:void 0);return n.map(e=>({item:e,isSuggested:e.manifest.id===o,isOriginal:e.manifest.id===i})).sort((e,t)=>e.isSuggested===t.isSuggested?e.item.manifest.name.localeCompare(t.item.manifest.name):e.isSuggested?-1:1)},[a,e,t]),m=(0,W.useCallback)(async e=>{u(e),f(null);try{let t=(await y.getCatalogItem(`gezel-template`,e)).about??``;if(!t.trim()){f(`This template has no about.md content.`);return}await n(e,t),i(!1)}catch(e){f(e.message)}finally{u(null)}},[n]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,className:`ai-btn`,onClick:()=>i(!0),title:`Replace this gezel's about.md with a gilde template`,"aria-label":`Use a template`,children:`📇`}),(0,G.jsx)(T,{open:r,onOpenChange:e=>{e||(i(!1),f(null))},children:(0,G.jsxs)(N,{children:[(0,G.jsx)(E,{}),(0,G.jsxs)(D,{className:`gz-dialog-wide`,children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsx)(`h3`,{children:`Apply a template`})}),(0,G.jsxs)(C,{className:`muted small`,children:[`Replace this gezel's `,(0,G.jsx)(`code`,{children:`about.md`}),` with a template from the gilde. Current content is overwritten — you can edit back to undo.`]}),s&&(0,G.jsx)(`p`,{className:`muted`,children:`Loading templates…`}),!s&&p.length===0&&(0,G.jsx)(`p`,{className:`muted`,children:`No gilde templates available.`}),!s&&p.length>0&&(0,G.jsx)(`ul`,{className:`gezel-template-list`,children:p.map(({item:e,isSuggested:t,isOriginal:n})=>{let r=e.manifest,i=l===r.id;return(0,G.jsxs)(`li`,{className:t?`suggested`:void 0,children:[(0,G.jsxs)(`div`,{className:`gezel-template-head`,children:[(0,G.jsx)(`strong`,{children:r.name}),(0,G.jsx)(`span`,{className:`muted small`,children:r.role}),t&&(0,G.jsx)(`span`,{className:`gezel-template-badge`,children:n?`Original`:`Matches role`})]}),r.description&&(0,G.jsx)(`p`,{className:`muted small`,children:r.description}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>void m(r.id),disabled:l!==null,children:i?`Applying…`:t?`Reset to this`:`Use this`})]},r.id)})}),d&&(0,G.jsx)(`p`,{className:`gz-dialog-error`,children:d}),(0,G.jsx)(w,{children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(!1),disabled:l!==null,children:`Cancel`})})]})]})})]})}function Fe({gezel:e,inherited:t,effectiveProvider:n,onUpdated:r}){let i=(0,W.useCallback)(async t=>{r(await y.updateGezelSettings(e.id,{tuning:t}))},[e.id,r]);return(0,G.jsxs)(`div`,{className:`gezel-tuning-editor`,children:[(0,G.jsx)(Ie,{gezel:e,availableProfiles:Object.keys(t?.profiles??{}),onUpdated:r}),(0,G.jsx)(xe,{provider:n,override:e.parsed?.frontmatter?.tuning,...t?{inherited:t}:{},...e.parsed?.frontmatter?.tuningProfile?{tuningProfileId:e.parsed.frontmatter.tuningProfile}:{},onSave:i,scopeLabel:e.name??`this gezel`})]})}function Ie({gezel:e,availableProfiles:t,onUpdated:n}){let r=e.parsed?.frontmatter?.tuningProfile??``,[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(null),c=(0,W.useMemo)(()=>t.map(e=>{let t=m(e)?f[e]:null;return{id:e,label:t?.label??e,description:t?.description}}),[t]),l=(0,W.useCallback)(async t=>{a(!0),s(null);try{let r=t===``?null:t;n(await y.updateGezelSettings(e.id,{tuningProfile:r}))}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}},[e.id,n]);return c.length===0&&!r?null:(0,G.jsxs)(`div`,{className:`voice-picker`,style:{marginBottom:`0.75rem`},children:[(0,G.jsxs)(`label`,{htmlFor:`voice-${e.id}`,className:`small`,style:{display:`block`,marginBottom:`0.25rem`},children:[(0,G.jsx)(`strong`,{children:`Voice`}),` `,(0,G.jsx)(`span`,{className:`muted`,children:`— preset the model applies for this gezel. Your manual tuning below overrides individual fields.`})]}),(0,G.jsxs)(`select`,{id:`voice-${e.id}`,value:r,onChange:e=>void l(e.target.value),disabled:i,children:[(0,G.jsx)(`option`,{value:``,children:`(automatic — use template / model default)`}),c.map(e=>(0,G.jsx)(`option`,{value:e.id,title:e.description,children:e.label},e.id))]}),o&&(0,G.jsx)(`div`,{className:`small error`,style:{marginTop:`0.25rem`},children:o})]})}function q({level:e,pending:t=!1,overlay:n=!1}){if(e<2&&!t)return null;let r=t?`Level ${e} — a level-up is waiting in the Growth tab`:`Level ${e}`;return(0,G.jsxs)(`span`,{className:`level-badge${n?` level-badge--overlay`:``}`,title:r,"aria-label":r,children:[`Lv `,e,t&&(0,G.jsx)(`span`,{className:`level-badge-dot`,"aria-hidden":`true`})]})}function Le(e,t,n){if(n<=t)return 100;let r=(e-t)/(n-t)*100;return Math.max(0,Math.min(100,Math.round(r)))}function J(e){let[t,n,r]=e.split(`-`).map(e=>Number.parseInt(e,10));return!t||!n||!r?e:new Date(Date.UTC(t,n-1,r)).toLocaleDateString(void 0,{month:`short`,day:`numeric`,timeZone:`UTC`})}var Re={fact:`Fact`,decision:`Decision`,pref:`Preference`,status:`Status`};function ze(e){return[{label:`Memories`,value:e.memoryXp,hint:`Distinct deduplicated memories — preferences and decisions weigh most.`},{label:`Lessons`,value:e.lessonsXp,hint:`Times the distilled lessons file was refined.`},{label:`Task work`,value:e.taskXp,hint:`Completed task steps and finished tasks.`},{label:`Consults`,value:e.consultXp,hint:`Delivered gezel-to-gezel consultations (daily-capped).`}]}function Be(e,t){return`gezel-growth-celebrated:${e}:${t}`}function Ve(e){switch(e.kind){case`trait`:return`Adopt this trait`;case`tuning`:if(e.action.type===`profile`){let t=e.action.profile;return`Switch to ${m(t)?f[t].label:t}`}return e.action.delta>0?`Run a little warmer`:`Run a little cooler`;case`cosmetic`:{let t=c(e.cosmeticId);return t?`Unlock ${t.label.toLowerCase()}`:`Mark the milestone`}}}function Y(e){if(e instanceof v){let t=e.details;if(typeof t==`object`&&t?.error)return t.error;if(typeof t==`string`&&t)return t}return e instanceof Error?e.message:String(e)}function He(e){return e instanceof v&&e.status===409&&Y(e).includes(`no pending level-up`)}function Ue(e,t){let[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(!1),f=(0,W.useCallback)(async()=>{try{r(await y.getGezelGrowth(e)),a(null)}catch(e){a(Y(e))}},[e]);(0,W.useEffect)(()=>{f()},[f]),(0,W.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.gezelId||n.gezelId===e)&&f()};return window.addEventListener(`gezel:growth-updated`,t),()=>window.removeEventListener(`gezel:growth-updated`,t)},[e,f]);let p=(0,W.useCallback)(async()=>{try{let t=await y.getGezel(e);window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:t}))}catch{}t?.()},[e,t]),m=(0,W.useCallback)(async(e,t,n)=>{l(e??`*`),s(null);try{r(await t()),n&&await p()}catch(e){He(e)?s(`This level-up was already resolved in another window.`):s(Y(e)),await f()}finally{l(null)}},[p,f]),h=(0,W.useCallback)(t=>m(t,()=>y.acceptGrowthProposal(e,t),!0),[e,m]),g=(0,W.useCallback)(t=>m(t,()=>y.declineGrowthLevelUp(e,t),!1),[e,m]),_=(0,W.useCallback)(()=>m(null,()=>y.declineGrowthLevelUp(e),!1),[e,m]),v=(0,W.useCallback)(t=>m(null,()=>y.retireGrowthTrait(e,t),!0),[e,m]),b=(0,W.useCallback)(async()=>{d(!0),s(null);try{r(await y.refreshGezelGrowth(e)),a(null)}catch(e){s(Y(e))}finally{d(!1)}},[e]);return{growth:n,error:i,notice:o,clearNotice:(0,W.useCallback)(()=>s(null),[]),busyId:c,refreshing:u,refresh:b,accept:h,decline:g,skipLevel:_,retireTrait:v}}function We({gezel:e,onUpdated:t}){let n=Ue(e.id,t),[r,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[l,u]=(0,W.useState)(null),[d,p]=(0,W.useState)(!1),h=n.growth?.state.pendingLevelUp?.toLevel;if((0,W.useEffect)(()=>{if(h===void 0)return;let t=Be(e.id,h);try{if(window.localStorage.getItem(t))return;window.localStorage.setItem(t,`1`)}catch{}p(!0);let n=setTimeout(()=>p(!1),1600);return()=>clearTimeout(n)},[e.id,h]),n.error)return(0,G.jsx)(`section`,{className:`growth-panel`,"data-testid":`growth-panel`,children:(0,G.jsxs)(`p`,{className:`error`,children:[`Couldn't load growth: `,n.error]})});if(!n.growth)return(0,G.jsx)(`section`,{className:`growth-panel`,"data-testid":`growth-panel`,children:(0,G.jsx)(`p`,{className:`placeholder`,children:`Loading growth…`})});let{state:g,nextLevelXp:_,activeTraits:v,driftedTraitIds:y}=n.growth,b=g.pendingLevelUp,x=i(g.level),S=Le(g.xp,x,_),C=g.level===1&&!b&&v.length===0&&g.xp===0;return(0,G.jsxs)(`section`,{className:`growth-panel`,"data-testid":`growth-panel`,children:[n.notice&&(0,G.jsxs)(`output`,{className:`growth-notice`,children:[(0,G.jsx)(`span`,{children:n.notice}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:n.clearNotice,children:`Dismiss`})]}),b&&r&&(0,G.jsxs)(`div`,{className:`growth-deferred-reminder`,children:[(0,G.jsxs)(`span`,{children:[e.name,` reached level `,b.toLevel,` — growth choices are waiting.`]}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>a(!1),children:`Show choices`})]}),b&&!r&&(0,G.jsx)(Ge,{gezel:e,growth:n,onDefer:()=>a(!0),onSkip:()=>s(!0)}),(0,G.jsxs)(`header`,{className:`growth-header`,children:[(0,G.jsxs)(`span`,{className:`level-badge-anchor${d?` growth-celebrate`:``}`,children:[(0,G.jsx)(B,{svg:e.icon??null,poppetje:d&&e.poppetje?{...e.poppetje,expression:`wider`}:e.poppetje,iconOverride:e.iconOverride,name:e.name,size:96}),(0,G.jsx)(q,{level:g.level,pending:!!b,overlay:!0})]}),(0,G.jsxs)(`div`,{className:`growth-header-text`,children:[(0,G.jsxs)(`h4`,{children:[e.name,` · Level `,g.level]}),(0,G.jsx)(`div`,{className:`growth-xp-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":S,"aria-label":`${g.xp} XP — ${_} needed for level ${g.level+1}`,tabIndex:-1,children:(0,G.jsx)(`div`,{className:`growth-xp-fill`,style:{width:`${S}%`}})}),(0,G.jsxs)(`span`,{className:`muted small`,children:[g.xp,` XP · `,Math.max(0,_-g.xp),` to level `,g.level+1]})]}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn growth-refresh`,disabled:n.refreshing,title:`Recompute XP from memories, lessons, and task work now`,onClick:()=>void n.refresh(),children:n.refreshing?`Checking…`:`Check growth now`})]}),C?(0,G.jsxs)(`div`,{className:`growth-empty`,children:[(0,G.jsxs)(`p`,{children:[`Growth here is earned, not simulated — every point comes from real work. As `,e.name,` `,`accumulates distinct memories, distills lessons, and completes tasks, XP adds up; at each level you'll choose how they grow.`]}),(0,G.jsx)(`div`,{className:`growth-trait-ghost`,"aria-hidden":`true`,children:`Trait slot · unlocks at Level 2`})]}):(0,G.jsx)(`div`,{className:`growth-counters`,children:ze(g.signals).map(e=>(0,G.jsxs)(`div`,{className:`growth-counter`,title:e.hint,children:[(0,G.jsx)(`span`,{className:`growth-counter-value`,children:e.value}),(0,G.jsx)(`span`,{className:`growth-counter-label`,children:e.label})]},e.label))}),y.length>0&&(0,G.jsxs)(`p`,{className:`growth-drift-warning`,children:[y.length===1?`One adopted trait is`:`Some adopted traits are`,` no longer in `,e.name,`'s frontmatter — likely lost to a manual gezel.md edit. Re-adopt from a future level-up, or edit the frontmatter directly.`]}),v.length>0&&(0,G.jsxs)(`div`,{className:`growth-traits`,children:[(0,G.jsx)(`h5`,{children:`Traits`}),v.map(e=>{let t=g.adoptedTraits.find(t=>t.traitId===e.id&&!t.removedAt);return(0,G.jsxs)(`details`,{className:`growth-trait`,children:[(0,G.jsxs)(`summary`,{children:[(0,G.jsx)(`span`,{className:`growth-trait-text`,children:e.text}),(0,G.jsxs)(`span`,{className:`muted small`,children:[` `,`· adopted `,J(e.adoptedAt.slice(0,10))]})]}),t&&t.evidence.length>0&&(0,G.jsx)(`div`,{className:`growth-trait-evidence`,children:t.evidence.map(e=>(0,G.jsxs)(`blockquote`,{children:[`“`,e.excerpt,`”`,(0,G.jsxs)(`footer`,{children:[(0,G.jsx)(`span`,{className:`growth-day-chip`,children:J(e.day)}),(0,G.jsx)(`span`,{className:`growth-kind-chip`,children:Re[e.kind]??e.kind})]})]},`${e.day}-${e.excerpt.slice(0,24)}`))}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn growth-retire`,disabled:n.busyId!==null,onClick:()=>u(e),children:`Retire this trait`})]},e.id)})]}),e.tuningProfile&&m(e.tuningProfile)&&(0,G.jsxs)(`div`,{className:`growth-tuning`,children:[(0,G.jsx)(`h5`,{children:`Tuning`}),(0,G.jsx)(`span`,{className:`growth-tuning-chip`,children:f[e.tuningProfile].label})]}),g.unlockedCosmetics.length>0&&(0,G.jsxs)(`div`,{className:`growth-cosmetics`,children:[(0,G.jsx)(`h5`,{children:`Unlocked`}),(0,G.jsx)(`div`,{className:`growth-cosmetics-row`,children:g.unlockedCosmetics.map(e=>{let t=c(e.id);return(0,G.jsx)(`span`,{className:`growth-cosmetic-chip`,children:t?t.label:e.id.replace(/^level-(\d+)$/,`Level $1 milestone`)},e.id)})})]}),(0,G.jsx)(L,{open:o,title:`Skip level ${b?.toLevel??g.level+1}?`,message:`The level still advances — it was earned — but these trait offers won't come back. The evidence stays in memory for future level-ups.`,confirmLabel:`Skip this level`,onConfirm:async()=>{await n.skipLevel(),s(!1)},onCancel:()=>s(!1)}),(0,G.jsx)(L,{open:l!==null,title:`Retire this trait?`,message:l?(0,G.jsxs)(G.Fragment,{children:[`“`,l.text,`” will stop shaping `,e.name,`'s behavior. The adoption record and its evidence stay on the character sheet.`]}):void 0,confirmLabel:`Retire`,danger:!0,onConfirm:async()=>{l&&await n.retireTrait(l.id),u(null)},onCancel:()=>u(null)})]})}function Ge({gezel:e,growth:t,onDefer:n,onSkip:r}){let i=t.growth.state.pendingLevelUp;return i?(0,G.jsxs)(`div`,{className:`growth-levelup`,children:[(0,G.jsxs)(`h4`,{children:[e.name,` reached level `,i.toLevel,`.`]}),(0,G.jsx)(`p`,{className:`muted`,children:`Pick one way to grow — or skip; the evidence isn't going anywhere.`}),(0,G.jsx)(`div`,{className:`growth-proposals`,children:i.proposals.map(n=>(0,G.jsx)(Ke,{proposal:n,gezel:e,busy:t.busyId!==null,declinable:i.proposals.length>1,onAccept:()=>void t.accept(n.id),onDecline:()=>void t.decline(n.id)},n.id))}),(0,G.jsxs)(`div`,{className:`growth-levelup-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:n,children:`Decide later`}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:r,children:`Skip this level`})]})]}):null}function Ke({proposal:e,gezel:t,busy:n,declinable:r,onAccept:i,onDecline:a}){return(0,G.jsxs)(`div`,{className:`growth-proposal-card`,"data-kind":e.kind,children:[(0,G.jsx)(`span`,{className:`growth-proposal-kind`,children:qe[e.kind]}),(0,G.jsx)(`h5`,{children:e.title}),e.kind===`trait`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`growth-proposal-trait-text`,children:[`“`,e.traitText,`”`]}),(0,G.jsx)(`div`,{className:`growth-trait-evidence`,children:e.evidence.map(e=>(0,G.jsxs)(`blockquote`,{children:[`“`,e.excerpt,`”`,(0,G.jsxs)(`footer`,{children:[(0,G.jsx)(`span`,{className:`growth-day-chip`,children:J(e.day)}),(0,G.jsx)(`span`,{className:`growth-kind-chip`,children:Re[e.kind]??e.kind})]})]},`${e.day}-${e.excerpt.slice(0,24)}`))})]}),e.kind===`tuning`&&(0,G.jsx)(`p`,{className:`muted small`,children:e.description}),e.kind===`cosmetic`&&(0,G.jsx)(Je,{poppetje:t.poppetje??null,cosmeticId:e.cosmeticId}),(0,G.jsxs)(`div`,{className:`growth-proposal-actions`,children:[(0,G.jsx)(`button`,{type:`button`,className:`primary`,disabled:n,onClick:i,children:Ve(e)}),r&&(0,G.jsx)(`button`,{type:`button`,disabled:n,onClick:a,children:`Not this one`})]})]})}var qe={trait:`Trait`,tuning:`Tuning`,cosmetic:`Cosmetic`};function Je({poppetje:e,cosmeticId:t}){let n=c(t);return!n||!e?n?(0,G.jsx)(`p`,{className:`muted small`,children:n.label}):null:(0,G.jsxs)(`div`,{className:`growth-cosmetic-tryon`,children:[(0,G.jsx)(`div`,{className:`growth-cosmetic-figure`,children:(0,G.jsx)(I,{poppetje:{...e,[n.slot]:n.option},variant:`headshot`,size:56})}),(0,G.jsx)(`span`,{className:`muted small`,children:n.label})]})}var X=`__INHERIT__`;function Ye(e,t){return e?`${e}:${t??``}`:X}function Xe(e){if(e===X)return{kind:`inherit`};let t=e.indexOf(`:`);return t<0?{kind:`inherit`}:{kind:`override`,provider:e.slice(0,t),model:e.slice(t+1)||void 0}}function Ze(){let e=window.__GEZEL__?.platform;if(e)return U(e);let t=typeof navigator>`u`?``:navigator.userAgent??``;return/Mac/i.test(t)?U(`darwin`):/Win/i.test(t)?U(`win32`):/Linux/i.test(t)?U(`linux`):U()}function Qe(e){switch(e){case`copilot`:return`GitHub Copilot`;case`openai`:return`OpenAI`;case`anthropic`:return`Anthropic`;case`anthropic-cli`:return`Claude CLI`;case`codex-cli`:return`Codex CLI`;case`ollama`:return`Ollama`;case`mlx`:case`llama-cpp`:return Ze();case`ds4`:return`DwarfStar (ds4)`;default:return e}}function $e({provider:e,model:t,onChange:n,globalProvider:r,disabled:i}){let[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!0),[l,u]=(0,W.useState)(0),d=(0,W.useRef)(null),f=(0,W.useRef)(!1);f.current=r===`copilot`||e===`copilot`,(0,W.useEffect)(()=>{let e=e=>{let t=R(e);t&&(d.current=t,u(e=>e+1))};return window.addEventListener(z,e),()=>window.removeEventListener(z,e)},[]),(0,W.useEffect)(()=>{let e=!1;return c(!0),(async()=>{let t=null,n=null,r=null;try{[t,n,r]=await Promise.all([y.getConfig(),y.getCopilotStatus().catch(()=>null),y.getMemoryProfile().catch(()=>null)])}catch{e||(o([]),c(!1));return}let i=[];(n?.available!==!1||f.current)&&i.push(`copilot`),t.hasOpenaiApiKey&&i.push(`openai`),t.hasAnthropicApiKey&&i.push(`anthropic`),t.anthropicCliStatus?.installed&&i.push(`anthropic-cli`),t.codexCliStatus?.installed&&i.push(`codex-cli`),i.push(`ollama`);let a=typeof navigator>`u`?``:navigator.userAgent;/Mac/i.test(a)&&i.push(`mlx`),i.push(`llama-cpp`),be({externalBaseUrl:t.ds4BaseUrl,totalRamBytes:r?.totalRamBytes}).status!==`unavailable`&&i.push(`ds4`);let s=await Promise.all(i.map(async e=>{try{let t=(e===`llama-cpp`||e===`mlx`||e===`ds4`)&&(d.current===e&&l>0||ee(e)>0),n=await y.listProviderModels(e,t?{refresh:!0}:void 0);return n.models.length===0?null:{provider:e,label:Qe(e),models:n.models}}catch{return null}}));if(e)return;let u=s.filter(e=>e!==null),p=[`mlx`,`llama-cpp`,`ds4`,`ollama`,`copilot`,`openai`,`anthropic`,`anthropic-cli`,`codex-cli`];u.sort((e,t)=>p.indexOf(e.provider)-p.indexOf(t.provider)),o(u),c(!1)})(),()=>{e=!0}},[l]);let p=(0,W.useMemo)(()=>Ye(e,t),[e,t]),m=(0,W.useMemo)(()=>`Inherit default (${Qe(r)})`,[r]);return s?(0,G.jsx)(`span`,{className:`muted small`,children:`loading providers…`}):!a||a.length===0?(0,G.jsxs)(`span`,{className:`muted small`,children:[`No providers configured —`,` `,(0,G.jsx)(`button`,{type:`button`,className:`provider-model-select-link`,onClick:()=>{ie(`defaults`),window.dispatchEvent(new CustomEvent(`gezel:navigate`,{detail:{view:`settings`,section:`defaults`}}))},children:`set one up`})]}):(0,G.jsxs)(k,{value:p,onValueChange:e=>{let t=Xe(e);t.kind===`inherit`?n(null,void 0):n(t.provider,t.model)},disabled:i,children:[(0,G.jsx)(M,{children:(0,G.jsx)(j,{})}),(0,G.jsxs)(P,{children:[(0,G.jsx)(A,{value:X,children:m}),a.map(e=>e.models.map(t=>(0,G.jsxs)(A,{value:`${e.provider}:${t.id}`,children:[e.label,` — `,t.name,t.supportsReasoning?` · reasoning`:``]},`${e.provider}:${t.id}`)))]})]})}function et(e){switch(e){case`generate_video`:return{kind:`Video`,list:()=>y.listInstalledVideoModels()};case`generate_image`:return{kind:`Image`,list:()=>y.listInstalledImageModels()};default:return null}}function tt(e){let t=e?.tool,n=typeof e?.defaults?.model==`string`?e.defaults.model:void 0,[r,i]=(0,W.useState)(null);return(0,W.useEffect)(()=>{if(!t){i(null);return}let e=et(t);if(!e){i(null);return}if(i(n?`${e.kind} · ${n}`:`${e.kind} generator`),n)return;let r=!1;return e.list().then(t=>{if(r)return;let n=t.defaultModel??t.models[0]?.id,a=t.models.find(e=>e.id===n)?.name??n;i(a?`${e.kind} · ${a}`:`${e.kind} generator`)}).catch(()=>{}),()=>{r=!0}},[t,n]),r}function Z(e){window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:e}))}function nt({gezelId:e,onDeleted:t,workingProjectIds:n,activeTurnsReady:r}){let i=ne(),a=H(),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(``),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),[v,C]=(0,W.useState)(0),[w,T]=(0,W.useState)(`chat`),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(``),[A,j]=(0,W.useState)(!1),M=o?.fixedFunction!==void 0,N=M&&(w===`toolsets`||w===`memories`)?`chat`:w,P=tt(o?.fixedFunction),F=(0,W.useRef)(null),I=(0,W.useCallback)(t=>y.updateGezelAbout(e,{source:t}),[e]),L=re({resourceKey:`gezel:${e}:about`,initialValue:``,save:I,onLatestSaved:t=>{let n=F.current;if(!n||n.id!==e)return;let r={...n,about:t.about};F.current=r,s(r),Z(r)}});(0,W.useEffect)(()=>{let t=!1;return s(null),l(null),d(``),(async()=>{try{let n=await y.getGezel(e);if(t)return;let r={...n,about:L.hydrate(ve(n.about))};F.current=r,s(r)}catch(e){t||l(e.message)}})(),()=>{t=!0}},[e,L.hydrate]),(0,W.useEffect)(()=>{M&&w!==N&&T(N)},[N,w,M]);let R=(0,W.useCallback)(e=>{F.current=e,s(e),Z(e)},[]),ee=(0,W.useCallback)(e=>{d(``),L.update(e)},[L.update]),z=(0,W.useCallback)(()=>{o&&(k(o.name),j(!0))},[o]),V=(0,W.useCallback)(async()=>{if(!o||!O.trim()||O.trim()===o.name){j(!1);return}try{await L.flush();let e=await y.renameGezel(o.id,{name:O.trim()});F.current=e,L.adopt(e.about),s(e),Z(e)}catch(e){d(`rename failed: ${e.message}`)}j(!1)},[o,O,L.flush,L.adopt]),ie=(0,W.useCallback)(e=>{e.key===`Enter`&&V(),e.key===`Escape`&&j(!1)},[V]);return c?(0,G.jsx)(`div`,{className:`placeholder`,children:(0,G.jsxs)(`p`,{children:[`Couldn't open this gezel: `,c]})}):o?(0,G.jsxs)(`section`,{className:`gezel-detail${N===`chat`?` gezel-detail-chat`:``}`,"data-testid":`gezel-detail`,children:[(0,G.jsxs)(`header`,{className:`detail-header`,children:[(0,G.jsxs)(`span`,{className:`level-badge-anchor`,children:[(0,G.jsx)(B,{svg:o.icon??null,poppetje:o.poppetje,iconOverride:o.iconOverride,name:o.name,size:80,pulsing:f&&!o.icon&&!o.poppetje,onClick:()=>D(!0),title:o.iconOverride&&o.icon?`Click to iterate on this icon`:`Click to manage appearance`}),o.growth&&(0,G.jsx)(q,{level:o.growth.level,pending:!!o.growth.pending,overlay:!0})]}),(0,G.jsxs)(`div`,{className:`detail-header-text`,children:[A?(0,G.jsx)(`input`,{className:`rename-input`,value:O,onChange:e=>k(e.target.value),onBlur:()=>void V(),onKeyDown:ie}):(0,G.jsx)(`h3`,{className:`gezel-name-editable`,onClick:z,onKeyDown:e=>{e.key===`Enter`&&z()},title:`Click to rename`,children:o.name}),o.role&&(0,G.jsx)(`span`,{className:`gezel-role`,children:o.role}),o.fixedFunction?(0,G.jsxs)(`div`,{className:`provider-override`,children:[(0,G.jsxs)(`span`,{className:`gezel-role muted small ff-header-tag`,title:`Fixed-function gezel`,children:[`Fixed-function · forwards to `,(0,G.jsx)(`code`,{children:o.fixedFunction.tool})]}),P&&(0,G.jsx)(`span`,{className:`gezel-role muted small ff-header-tag`,title:`Generation model used by this gezel`,children:P})]}):(0,G.jsx)(mt,{gezel:o,onUpdated:R})]}),(0,G.jsx)(`output`,{className:`status`,"aria-live":`polite`,children:L.phase===`error`?(0,G.jsxs)(G.Fragment,{children:[`save failed: `,L.error?.message??`unknown error`,` `,(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>void L.retry().catch(()=>{}),children:`Retry`})]}):u||(L.phase===`dirty`?`unsaved changes`:L.phase===`saving`?`saving…`:L.phase===`saved`?`saved`:null)}),(0,G.jsx)(ae,{gezel:o,onDeleted:t,boringMode:a})]}),(0,G.jsx)(pt,{open:E,gezel:o,isGenerating:f,onClose:()=>D(!1),onUpdated:R,setGenerating:p}),(0,G.jsx)(`div`,{className:`entity-tabs-row`,children:(0,G.jsx)(S,{value:N,onValueChange:e=>T(e),children:(0,G.jsxs)(x,{children:[(0,G.jsx)(b,{value:`chat`,children:`Chat`}),(0,G.jsx)(b,{value:`about`,children:`About`}),(0,G.jsx)(b,{value:`appearance`,children:`Appearance`}),(0,G.jsxs)(b,{value:`growth`,children:[`Growth`,o.growth?.pending&&(0,G.jsx)(`span`,{className:`growth-tab-dot`,title:`A level-up is waiting for your choice`,"aria-label":`Level-up pending`})]}),!M&&(0,G.jsx)(b,{value:`toolsets`,children:`Toolsets`}),!M&&(0,G.jsx)(b,{value:`memories`,children:`Memories`})]})})}),N===`appearance`&&(0,G.jsx)(rt,{gezel:o,onUpdated:R}),N===`growth`&&(0,G.jsx)(We,{gezel:o,onUpdated:()=>{(async()=>{try{let e=await y.getGezel(o.id);F.current=e,s(e)}catch{}})()}}),!M&&N===`toolsets`&&(0,G.jsx)(ge,{scope:{kind:`gezel`,gezelId:o.id},subject:o.name}),N===`about`&&o.fixedFunction&&(0,G.jsx)(Ce,{gezel:o,onUpdated:R}),N===`about`&&!o.fixedFunction&&(0,G.jsxs)(`div`,{className:`editor-wrap`,children:[m&&(0,G.jsxs)(`div`,{className:`about-generating-banner`,children:[`Drafting `,(0,G.jsx)(`code`,{children:`about.md`}),` from the role…`]}),(0,G.jsx)(te,{initialMarkdown:o.about,onChange:ee,height:`calc(100vh - 220px)`,colorScheme:i,showPlayTab:!1,fullWidth:!0,readOnly:m||g,toolbarSlotAfterActions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ye,{context:`about`}),(0,G.jsx)(Pe,{...o.role?{gezelRole:o.role}:{},...o.templateId?{gezelTemplateId:o.templateId}:{},onApply:async(e,t)=>{_(!0);try{if(!await L.saveNow(t))return;C(e=>e+1),d(`applied template`)}catch(e){d(`template apply failed: ${e.message}`)}finally{_(!1)}}}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,disabled:m||!o.role,title:o.role?`Re-draft about.md from the role`:`Set a role first to enable about generation`,onClick:async()=>{if(o.role){h(!0);try{await L.flush();let e=await y.generateGezelAbout(o.id,{role:o.role});L.adopt(e.about),F.current=e,C(e=>e+1),R(e)}catch(e){d(`about generation failed: ${e.message}`)}finally{h(!1)}}},children:m?`Drafting…`:`Draft from role`})]})},`${o.id}:${v}`)]}),N===`chat`&&(0,G.jsx)(ke,{gezel:o,engineLabel:P,workingProjectIds:n,activeTurnsReady:r}),!M&&N===`memories`&&(0,G.jsx)(_e,{gezelId:o.id,gezelName:o.name})]}):(0,G.jsx)(`p`,{className:`placeholder`,children:`Loading gezel…`})}function rt({gezel:e,onUpdated:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),f=e.poppetje,p=async()=>{d(null),r(!0);try{let n=await y.rerollGezelPoppetje(e.id,{});t({...await y.getGezel(e.id),poppetje:n.poppetje})}catch(e){d(e.message)}finally{r(!1)}},m=async n=>{d(null),a(!0);try{t(await y.updateGezelSettings(e.id,{iconOverride:n?!0:null}))}catch(e){d(e.message)}finally{a(!1)}},h=async n=>{d(null),s(!0);try{t(await y.updateGezelSettings(e.id,{font:n||null}))}catch(e){d(e.message)}finally{s(!1)}};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`gezel-appearance`,"aria-label":`Appearance`,children:[(0,G.jsx)(`div`,{className:`gezel-appearance-hero`,"aria-label":`${e.name} portrait`,children:f?(0,G.jsx)(I,{poppetje:f,variant:`full`,size:160,grainStyle:`wavy`}):(0,G.jsx)(`span`,{className:`muted small`,children:`Generating…`})}),(0,G.jsxs)(`div`,{className:`gezel-appearance-actions`,children:[(0,G.jsxs)(`strong`,{children:[e.name,`'s appearance`]}),(0,G.jsxs)(`div`,{className:`gezel-appearance-buttons`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:p,disabled:n||!f,children:n?`Rerolling…`:`Reroll appearance`}),(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>l(!0),disabled:!f,title:`Choose hair, bangs, part, and worn items`,children:`Accessories & hair…`})]}),(0,G.jsx)(`span`,{className:`muted small`,children:`Reroll redraws everything (body, face, hair). Accessories & hair lets you style this figure.`}),e.icon&&(0,G.jsxs)(`label`,{className:`gezel-appearance-toggle`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:!!e.iconOverride,disabled:i,onChange:e=>void m(e.target.checked)}),`Show abstract icon instead of the poppetje`]}),u&&(0,G.jsx)(`p`,{className:`error small`,children:u})]}),(0,G.jsx)(ft,{open:c,gezel:e,onClose:()=>l(!1),onUpdated:t})]}),(0,G.jsxs)(`section`,{className:`gezel-font-section`,"aria-label":`Chat font`,children:[(0,G.jsx)(`strong`,{children:`Chat font`}),(0,G.jsx)(vt,{value:e.font,onChange:e=>void h(e),disabled:o}),(0,G.jsxs)(`span`,{className:`muted small`,children:[`The typeface used for `,e.name,`'s chat bubbles. Inherits the app default unless overridden.`]})]})]})}var it={halo:`Curly`,short:`Short`,bob:`Bob`,medium:`Medium`,long:`Long`,"extra-long":`Extra long`,bun:`Bun`,braids:`Braids`,shaved:`Shaved`,bald:`Bald`},at={none:`None`,straight:`Straight`,"side-swept":`Side-swept`,curtain:`Curtain`,short:`Short`},ot={none:`None`,center:`Center`,left:`Left`,right:`Right`};function Q({label:e,slot:t,poppetje:n,options:r,labels:i,disabled:a,onChange:o}){return(0,G.jsxs)(`div`,{className:`accessory-section`,children:[(0,G.jsx)(`h4`,{className:`accessory-section-title`,children:e}),(0,G.jsx)(`div`,{className:`accessory-tiles`,role:`radiogroup`,"aria-label":e,children:r.map(e=>{let r=e??`none`,s=(n[t]??`none`)===r,c={...n,hat:null,accessory:null,[t]:e};return(0,G.jsxs)(`label`,{className:`accessory-tile hair-choice${s?` selected`:``}`,"data-disabled":a,children:[(0,G.jsx)(`input`,{type:`radio`,name:`${n.key}-${t}`,value:r,checked:s,disabled:a,onChange:()=>o(e)}),(0,G.jsx)(`span`,{className:`accessory-tile-art`,"aria-hidden":`true`,children:(0,G.jsx)(I,{poppetje:c,variant:`icon`,size:52,grainStyle:`none`})}),(0,G.jsx)(`span`,{className:`accessory-tile-label`,children:i[r]})]},r)})})]})}var st={cap:`Cap`,beanie:`Beanie`,kerchief:`Kerchief`,straw:`Straw hat`,newsboy:`Newsboy cap`,hood:`Hoodie`},ct={scarf:`Scarf`,apron:`Apron`,collar:`Collar`,turtleneck:`Turtleneck`},lt={glasses:`Glasses`,sunglasses:`Sunglasses`,cateye:`Cat-eye glasses`,readers:`Reading glasses`,monocle:`Monocle`,eyepatch:`Eye patch`,earrings:`Earrings`,"earring-left":`Left earring`,"earring-right":`Right earring`,flower:`Flower`,hairclip:`Hair clip`,headband:`Headband`,bowtie:`Bow tie`,necklace:`Necklace`,brooch:`Brooch`,facemask:`Face mask`,goggles:`Goggles`,"safety-glasses":`Safety glasses`,"pince-nez":`Pince-nez`,headphones:`Headphones`,"hearing-aid":`Hearing aid`,"nose-ring":`Nose ring`,"hoop-earrings":`Hoop earrings`,"drop-earrings":`Drop earrings`,"pearl-earrings":`Pearl earrings`,bandage:`Bandage`,feather:`Feather`,pencil:`Pencil`,ribbon:`Ribbon`,necktie:`Necktie`,cravat:`Cravat`,"bolo-tie":`Bolo tie`,lanyard:`Lanyard`,medal:`Medal`,"pocket-square":`Pocket square`,"tool-pendant":`Tool pendant`};function ut({slot:e,option:t,label:n,selected:r,disabled:i,lockText:a,onSelect:o}){let s=a?.match(/\d+/)?.[0];return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":r,className:`accessory-tile${r?` selected`:``}${a?` locked`:``}`,disabled:i,onClick:o,title:a?`${n} — ${a}`:n,children:[(0,G.jsx)(`span`,{className:`accessory-tile-art`,children:e&&t?(0,G.jsx)(F,{slot:e,option:t,size:52}):(0,G.jsxs)(`svg`,{width:28,height:28,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,G.jsx)(`circle`,{cx:12,cy:12,r:9,fill:`none`,stroke:`currentColor`,strokeWidth:1.6}),(0,G.jsx)(`line`,{x1:6,y1:18,x2:18,y2:6,stroke:`currentColor`,strokeWidth:1.6})]})}),(0,G.jsx)(`span`,{className:`accessory-tile-label`,children:n}),s&&(0,G.jsxs)(`span`,{className:`accessory-tile-lock`,"aria-hidden":`true`,children:[`Lv `,s]})]})}function $({slot:e,label:t,value:n,options:r,labels:i,locked:a,onChange:o,disabled:s}){return(0,G.jsxs)(`div`,{className:`accessory-section`,children:[(0,G.jsx)(`h4`,{className:`accessory-section-title`,children:t}),(0,G.jsxs)(`div`,{className:`accessory-tiles`,role:`radiogroup`,"aria-label":t,children:[(0,G.jsx)(ut,{label:`None`,selected:n===null,disabled:s,onSelect:()=>o(null)}),r.map(t=>{let r=a?.[t];return(0,G.jsx)(ut,{slot:e,option:t,label:i[t],selected:n===t,disabled:s||!!r,lockText:r,onSelect:()=>o(t)},t)})]})]})}function dt(e,t,n){let r={};for(let i of d)i.slot===e&&(i.level<=t||n!==i.option&&(r[i.option]=`unlocks at level ${i.level}`));return r}function ft({open:e,gezel:t,onClose:n,onUpdated:r}){let[i,a]=(0,W.useState)(!1),[o,c]=(0,W.useState)(null),d=t.poppetje,f=t.growth?.level??1,p=async e=>{if(d){c(null),a(!0);try{let n={...d,...e},i=await y.setGezelPoppetje(t.id,{poppetje:n});r({...t,poppetje:i.poppetje})}catch(e){c(e.message)}finally{a(!1)}}};return(0,G.jsx)(T,{open:e,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(N,{children:[(0,G.jsx)(E,{}),(0,G.jsxs)(D,{className:`accessories-dialog`,children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsxs)(`h3`,{children:[t.name,`'s accessories & hair`]})}),(0,G.jsx)(C,{className:`muted small`,children:`Choose a hairstyle and worn items. Changes save automatically.`}),(0,G.jsxs)(`div`,{className:`accessories-body`,children:[(0,G.jsx)(`div`,{className:`accessories-preview`,"aria-label":`${t.name} preview`,children:d?(0,G.jsx)(I,{poppetje:d,variant:`full`,size:150,grainStyle:`wavy`}):(0,G.jsx)(`span`,{className:`muted small`,children:`Generating…`})}),(0,G.jsxs)(`div`,{className:`accessories-controls`,children:[d&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Q,{label:`Hair style`,slot:`hairShape`,poppetje:d,options:_,labels:it,disabled:i,onChange:e=>void p({hairShape:e})}),(0,G.jsx)(Q,{label:`Bangs`,slot:`bangs`,poppetje:d,options:[null,...h],labels:at,disabled:i||d.hairShape===`bald`||d.hairShape===`shaved`,onChange:e=>void p({bangs:e})}),(0,G.jsx)(Q,{label:`Hair part`,slot:`hairPart`,poppetje:d,options:s,labels:ot,disabled:i||d.hairShape===`bald`||d.hairShape===`shaved`,onChange:e=>void p({hairPart:e})}),(0,G.jsx)(`p`,{className:`muted small`,children:`Left and right match the preview. Hats cover the hairstyle.`})]}),(0,G.jsx)($,{slot:`hat`,label:`Hat`,value:d?.hat??null,options:l,labels:st,locked:dt(`hat`,f,d?.hat??null),onChange:e=>void p({hat:e}),disabled:i||!d}),(0,G.jsx)($,{slot:`dress`,label:`Garment`,value:d?.dress??null,options:u,labels:ct,locked:dt(`dress`,f,d?.dress??null),onChange:e=>void p({dress:e}),disabled:i||!d}),(0,G.jsx)($,{slot:`accessory`,label:`Accessory`,value:d?.accessory??null,options:g,labels:lt,locked:dt(`accessory`,f,d?.accessory??null),onChange:e=>void p({accessory:e}),disabled:i||!d})]})]}),o&&(0,G.jsx)(`p`,{className:`gz-dialog-error`,children:o}),(0,G.jsx)(w,{children:(0,G.jsx)(`button`,{type:`button`,className:`primary`,onClick:n,children:`Done`})})]})]})})}function pt({open:e,gezel:t,isGenerating:n,onClose:r,onUpdated:i,setGenerating:a}){let[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)([]),[u,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),m=(0,W.useCallback)(async()=>{try{let e=await y.listGezelIconHistory(t.id);l(e.history)}catch(e){p(e.message)}},[t.id]);(0,W.useEffect)(()=>{u&&m()},[u,m]);let h=async()=>{p(null),a(!0);try{i(await y.generateGezelIcon(t.id,o.trim()?{instruction:o.trim()}:{})),s(``),u&&await m()}catch(e){p(e.message)}finally{a(!1)}},g=async e=>{p(null);try{i(await y.revertGezelIcon(t.id,{timestamp:e})),await m()}catch(e){p(e.message)}};return(0,G.jsx)(T,{open:e,onOpenChange:e=>{e||r()},children:(0,G.jsxs)(N,{children:[(0,G.jsx)(E,{}),(0,G.jsxs)(D,{className:`iterate-dialog`,children:[(0,G.jsx)(O,{asChild:!0,children:(0,G.jsxs)(`h3`,{children:[`Iterate on `,t.name,`'s icon`]})}),(0,G.jsx)(`div`,{className:`iterate-preview`,children:(0,G.jsx)(B,{svg:t.icon??null,poppetje:t.poppetje,iconOverride:t.iconOverride,name:t.name,size:120,pulsing:n})}),(0,G.jsxs)(`label`,{children:[`What should change?`,(0,G.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:`e.g. make the colors warmer, try a cat shape, more geometric`,rows:3})]}),f&&(0,G.jsx)(`p`,{className:`error`,children:f}),(0,G.jsxs)(w,{children:[(0,G.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(e=>!e),children:u?`Hide history`:`Show history`}),(0,G.jsx)(`span`,{style:{flex:1}}),(0,G.jsx)(`button`,{type:`button`,onClick:r,children:`Close`}),(0,G.jsx)(`button`,{type:`button`,className:`primary`,onClick:h,disabled:n,children:n?`Generating…`:`Regenerate`})]}),u&&(0,G.jsxs)(`div`,{className:`icon-history-row`,children:[c.length===0&&(0,G.jsx)(`p`,{className:`muted`,children:`No previous variants yet.`}),c.map(e=>(0,G.jsx)(`button`,{type:`button`,className:`icon-history-item`,onClick:()=>void g(e.timestamp),title:`Revert to ${e.timestamp}`,children:(0,G.jsx)(B,{svg:e.svg,iconOverride:!0,name:t.name,size:56})},e.timestamp))]})]})]})})}function mt({gezel:e,onUpdated:t}){let[n,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`copilot`);(0,W.useEffect)(()=>{y.getConfig().then(e=>o(e.provider)).catch(()=>{})},[]);let s=(0,W.useCallback)(async(n,r)=>{let a=(e.provider??null)!==(n??null);i(!0);try{t(await y.updateGezelSettings(e.id,{provider:n??null,model:r??null,...a||!r?{reasoningEffort:null}:{}}))}finally{i(!1)}},[e.id,e.provider,t]),c=(0,W.useCallback)(async n=>{i(!0);try{t(await y.updateGezelSettings(e.id,{reasoningEffort:n??null}))}finally{i(!1)}},[e.id,t]),l=(0,W.useCallback)(async n=>{i(!0);try{t(await y.updateGezelSettings(e.id,{sandboxCopilot:n==="default"?null:n===`on`}))}finally{i(!1)}},[e.id,t]),u=(0,W.useCallback)(async n=>{i(!0);try{t(await y.updateGezelSettings(e.id,{codexPermissionMode:n===`inherit`?null:n}))}finally{i(!1)}},[e.id,t]),d=(0,W.useCallback)(async n=>{i(!0);try{t(await y.updateGezelSettings(e.id,{retrieval:n===`inherit`?null:{...e.retrieval,mode:n}}))}finally{i(!1)}},[e.id,e.retrieval,t]),f=e.provider??a,p=e.sandboxCopilot===void 0?`default`:e.sandboxCopilot?`on`:`off`,m=e.codexPermissionMode?r(e.codexPermissionMode):`inherit`,h=e.retrieval?.mode??`inherit`;return(0,G.jsxs)(`div`,{className:`provider-override`,children:[(0,G.jsx)(`span`,{className:`muted small`,children:`Model:`}),(0,G.jsx)($e,{provider:e.provider??null,model:e.model,onChange:(e,t)=>void s(e,t),globalProvider:a,disabled:n}),(0,G.jsx)(Se,{provider:f,model:e.model,value:e.reasoningEffort,onChange:e=>void c(e)}),(0,G.jsx)(`span`,{className:`muted small`,style:{marginLeft:`0.75rem`},title:`How much relevant indexed project knowledge is added to each substantive turn. Search remains available in Off mode.`,children:`Context:`}),[`inherit`,`off`,`lean`,`balanced`,`deep`].map(e=>(0,G.jsx)(`button`,{type:`button`,className:`provider-chip${h===e?` provider-chip-active`:``}`,onClick:()=>void d(e),disabled:n,children:e===`inherit`?`Inherit`:e===`off`?`Off`:e[0].toUpperCase()+e.slice(1)},e)),f===`copilot`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`muted small`,style:{marginLeft:`0.75rem`},title:`Deny the Copilot CLI's built-in tools (bash, web_fetch, file edit, grep) and force this gezel through our MCP tools.`,children:`Sandbox:`}),[`default`,`on`,`off`].map(e=>(0,G.jsx)(`button`,{type:`button`,className:`provider-chip${p===e?` provider-chip-active`:``}`,onClick:()=>void l(e),disabled:n,children:e==="default"?`Inherit`:e===`on`?`On`:`Off`},e))]}),f===`codex-cli`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`muted small`,style:{marginLeft:`0.75rem`},title:`Override this gezel's Codex execution posture. A project-level choice still takes precedence.`,children:`Access:`}),[`inherit`,`plan`,`edit`,`reviewed`,`full`].map(e=>(0,G.jsx)(`button`,{type:`button`,className:`provider-chip${m===e?` provider-chip-active`:``}`,onClick:()=>void u(e),disabled:n,children:e===`inherit`?`Inherit`:e===`plan`?`Plan`:e===`edit`?`Edit`:e===`reviewed`?`Reviewed`:`Full`},e))]}),e.model&&(0,G.jsx)(ht,{gezel:e,effectiveProvider:f,onUpdated:t})]})}function ht({gezel:e,effectiveProvider:t,onUpdated:n}){let[r,i]=(0,W.useState)(void 0),a=(0,W.useCallback)(async()=>{if(!(r!==void 0||!e.model))try{let[t,n]=await Promise.all([y.getCatalogItem(`chat-model`,e.model).catch(()=>null),y.getConfig().catch(()=>null)]),r=t&&t.manifest.kind===`chat-model`?t.manifest.tuning:void 0,a=n?.modelTuning?.[e.model],o=gt(r,a);o&&i(o)}catch{}},[r,e.model]);return(0,G.jsxs)(`details`,{className:`gezel-tuning-disclosure`,style:{flexBasis:`100%`,marginTop:`0.5rem`},onToggle:e=>{e.target.open&&a()},children:[(0,G.jsx)(`summary`,{className:`muted small`,style:{cursor:`pointer`},children:`Advanced tuning`}),(0,G.jsx)(`div`,{style:{marginTop:`0.5rem`},children:(0,G.jsx)(Fe,{gezel:e,...r?{inherited:r}:{},effectiveProvider:t,onUpdated:n})})]})}function gt(e,t){if(!(!e&&!t))return e?t?_t(e,t):e:t}function _t(e,t){let n={...e};for(let[e,r]of Object.entries(t)){if(r===void 0)continue;let t=n[e];t&&typeof t==`object`&&!Array.isArray(t)&&r&&typeof r==`object`&&!Array.isArray(r)?n[e]=_t(t,r):n[e]=r}return n}function vt({value:e,onChange:t,disabled:n}){let r=`__default`,i=e&&e.length>0?e:r,a=i===r?`Inherit default`:p.find(e=>e.id===i)?.label??`Inherit default`,o=p.find(e=>e.id===i)?.family;return(0,G.jsxs)(k,{value:i,onValueChange:e=>t(e===r?``:e),disabled:n,children:[(0,G.jsx)(M,{className:`gezel-font-picker`,title:`Font used for this gezel's chat bubbles`,style:o?{fontFamily:o}:void 0,"aria-label":`Chat bubble font`,children:(0,G.jsx)(j,{children:a})}),(0,G.jsxs)(P,{children:[(0,G.jsx)(A,{value:r,children:`Inherit default`}),p.map(e=>(0,G.jsx)(A,{value:e.id,style:{fontFamily:e.family},children:e.label},e.id))]})]})}export{nt as GezelDetail,q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import"./chunk-4VOD55SX-BFSSw0c8.js";import{k as r}from"./chunk-GAZKTT4R-w1SNypWQ.js";import"./schemas-BvLZUsGm.js";import{t as i}from"./chunk-TT6ENR6T-BOA-qiwP.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./chunk-DQRELU4S--U9FIVtY.js";import{L as p,R as m,a as h,d as g,i as _,l as v,m as y,n as b,o as x,r as S,s as ee,t as C}from"./dist-APSIK7H3.js";var w=e(t(),1),T=n(),E=(0,w.createContext)(null);function D(e){let{rootSchema:t,rootData:n,onRootChange:r,density:i,validate:a,onValidate:s,children:c}=e,l=(0,w.useMemo)(()=>a?a(n,t):[],[a,n,t]),u=(0,w.useMemo)(()=>{let e=new Map;for(let t of l){let n=e.get(t.path)??[];n.push(t),e.set(t.path,n)}return e},[l]);(0,w.useEffect)(()=>{s&&s(l)},[l,s]);let d=(0,w.useMemo)(()=>(e,t)=>{let i=o(n,e,t);r(i)},[n,r]),f=(0,w.useMemo)(()=>({rootSchema:t,rootData:n,setAtPath:d,density:i,errors:u}),[t,n,d,i,u]);return(0,T.jsx)(E.Provider,{value:f,children:c})}function O(){let e=(0,w.useContext)(E);if(!e)throw Error(`useJsonEditor must be used inside <JsonEditor>`);return e}function k(e){let{value:t,onChange:n,readOnly:r=!1,placeholder:i,className:a}=e,o=(0,w.useRef)(!1),s=(0,w.useRef)(t),c=y({editable:!r,extensions:[v.configure({codeBlock:{HTMLAttributes:{class:`squisq-code-block`}}}),ee.configure({resizable:!1}),x,h,_,S,b.configure({nested:!0}),C.configure({placeholder:i??``})],content:p(t),onUpdate:({editor:e})=>{if(o.current)return;let t=m(e.getHTML());s.current=t,n(t)},editorProps:{attributes:{class:`squisq-jf-richtext-prose`}}});return(0,w.useEffect)(()=>{if(c&&t!==s.current){o.current=!0;try{c.commands.setContent(p(t),!1),s.current=t}finally{o.current=!1}}},[c,t]),(0,w.useEffect)(()=>{c&&c.setEditable(!r)},[c,r]),(0,T.jsx)(g,{editor:c,className:`squisq-jf-richtext`+(a?` ${a}`:``)})}function A(e){return{id:e.controlId,"aria-labelledby":e.labelledBy,"aria-describedby":e.describedBy,"aria-invalid":e.invalid||void 0}}function j(e){return e==null?``:String(e)}function M(e){if(e==null||e===``)return``;let t=Number(e);return Number.isFinite(t)?t:``}function te(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O();return(0,T.jsx)(`input`,{...A(e),type:`text`,className:`squisq-jf-input`,value:j(t),placeholder:n.squisq?.placeholder,disabled:i,onChange:e=>a(r,e.target.value)})}function N(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=(0,w.useRef)(null);return(0,w.useEffect)(()=>{let e=o.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+2}px`)},[t]),(0,T.jsx)(`textarea`,{...A(e),ref:o,className:`squisq-jf-textarea`,value:j(t),placeholder:n.squisq?.placeholder,disabled:i,onChange:e=>a(r,e.target.value)})}function P({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O();return(0,T.jsx)(k,{value:j(e),placeholder:t.squisq?.placeholder,readOnly:r,onChange:e=>i(n,e)})}function F(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.type===`integer`,s=n.squisq?.step??n.multipleOf??(o?1:.1),c=M(t),l=e=>{let t=n.minimum??n.exclusiveMinimum,i=n.maximum??n.exclusiveMaximum,s=e;typeof t==`number`&&(s=Math.max(t,s)),typeof i==`number`&&(s=Math.min(i,s)),a(r,o?Math.round(s):s)};return(0,T.jsxs)(`span`,{className:`squisq-jf-stepper`,children:[(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-stepper__btn`,disabled:i,onClick:()=>l((typeof c==`number`?c:0)-s),"aria-label":`Decrease`,children:`−`}),(0,T.jsx)(`input`,{...A(e),className:`squisq-jf-stepper__input`,type:`number`,value:c===``?``:c,step:s,disabled:i,onChange:e=>{if(e.target.value===``){a(r,void 0);return}let t=Number(e.target.value);Number.isFinite(t)&&l(t)}}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-stepper__btn`,disabled:i,onClick:()=>l((typeof c==`number`?c:0)+s),"aria-label":`Increase`,children:`+`})]})}function I(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.minimum??n.exclusiveMinimum??0,s=n.maximum??n.exclusiveMaximum??100,c=n.squisq?.step??n.multipleOf??(n.type,1),l=M(t),u=typeof l==`number`?l:o;return(0,T.jsxs)(`span`,{className:`squisq-jf-slider-row`,children:[(0,T.jsx)(`input`,{...A(e),type:`range`,className:`squisq-jf-slider`,min:o,max:s,step:c,value:u,disabled:i,onChange:e=>a(r,Number(e.target.value))}),(0,T.jsx)(`span`,{className:`squisq-jf-slider-readout`,children:u})]})}function L(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=!!t;return(0,T.jsxs)(`button`,{...A(e),type:`button`,className:`squisq-jf-toggle${o?` squisq-jf-toggle--on`:``}`,disabled:i,onClick:()=>a(r,!o),"aria-pressed":o,children:[(0,T.jsx)(`span`,{className:`squisq-jf-toggle__track`,children:(0,T.jsx)(`span`,{className:`squisq-jf-toggle__thumb`})}),(0,T.jsx)(`span`,{className:`squisq-jf-toggle__label`,children:o?n.squisq?.label?`${n.squisq.label}: On`:`On`:n.squisq?.label?`${n.squisq.label}: Off`:`Off`})]})}function R(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=(0,w.useId)(),s=e.controlId??o;return(0,T.jsxs)(`label`,{htmlFor:s,className:`squisq-jf-toggle`,children:[(0,T.jsx)(`input`,{"aria-labelledby":e.labelledBy,"aria-describedby":e.describedBy,"aria-invalid":e.invalid||void 0,id:s,type:`checkbox`,checked:!!t,disabled:i,onChange:e=>a(r,e.target.checked)}),n.squisq?.label??n.title??``]})}function z(e){let t=e.squisq?.enumLabels;return(e.enum??[]).map(e=>({value:e,label:t&&typeof e==`string`?t[e]??String(e):String(e)}))}function B(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n);return(0,T.jsx)(`span`,{...A(e),className:`squisq-jf-segmented`,role:`group`,children:o.map((e,n)=>{let o=t===e.value;return(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-segmented__btn${o?` squisq-jf-segmented__btn--active`:``}`,disabled:i,onClick:()=>a(r,e.value),"aria-pressed":o,children:e.label},n)})})}function V(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n),s=(0,w.useId)();return(0,T.jsx)(`div`,{...A(e),className:`squisq-jf-radio`,role:`radiogroup`,children:o.map((e,n)=>{let o=t===e.value;return(0,T.jsxs)(`label`,{className:`squisq-jf-radio__option`,children:[(0,T.jsx)(`input`,{type:`radio`,name:s,checked:o,disabled:i,onChange:()=>a(r,e.value)}),e.label]},n)})})}function H(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n);return(0,T.jsx)(`select`,{...A(e),className:`squisq-jf-select`,value:j(t),disabled:i,onChange:e=>{let t=e.target.value,n=o.find(e=>String(e.value)===t);a(r,n?n.value:t)},children:o.map((e,t)=>(0,T.jsx)(`option`,{value:String(e.value),children:e.label},t))})}function U(e){let{value:t,pointer:n,disabled:r}=e,{setAtPath:i}=O(),a=typeof t==`string`&&/^#[0-9a-f]{6}$/i.test(t)?t:`#000000`;return(0,T.jsxs)(`span`,{className:`squisq-jf-color`,children:[(0,T.jsx)(`input`,{...A(e),type:`color`,className:`squisq-jf-color__input`,value:a,disabled:r,onChange:e=>i(n,e.target.value)}),(0,T.jsx)(`input`,{type:`text`,className:`squisq-jf-input squisq-jf-color__hex`,value:j(t),disabled:r,onChange:e=>i(n,e.target.value)})]})}function W(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.format,s=o===`time`?`time`:o===`date`?`date`:`datetime-local`,c=s===`datetime-local`&&typeof t==`string`&&t.includes(`T`)?t.replace(/Z$|:\d{2}\.\d+Z?$/,``).slice(0,16):j(t);return(0,T.jsx)(`input`,{...A(e),type:s,className:`squisq-jf-input`,value:c,disabled:i,onChange:e=>a(r,e.target.value)})}function G(e){let{value:t,schema:n,pointer:r,disabled:i,suppressTitle:a}=e,o=a?void 0:n.squisq?.label??n.title,s=n.squisq?.help??n.description,c=(t&&typeof t==`object`?t:{})??{},l=Object.entries(n.properties??{});return(0,T.jsxs)(`section`,{className:`squisq-jf-group`,children:[o?(0,T.jsx)(`h3`,{className:`squisq-jf-group__title`,children:o}):null,s?(0,T.jsx)(`p`,{className:`squisq-jf-group__help`,children:s}):null,l.map(([e,t])=>(0,T.jsx)($,{value:c[e],schema:t,pointer:f(r,e),parentDisabled:i},e))]})}function K({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O(),a=Array.isArray(e)?e:[],o=(Array.isArray(t.items)?t.items[0]:t.items)??{type:`string`},s=o.squisq?.enumLabels,c=o.enum,[l,u]=(0,w.useState)(``),d=e=>{let t=a.slice();t.splice(e,1),i(n,t)},f=e=>{if(e===``)return;let t=q(e,o);i(n,[...a,t]),u(``)};return(0,T.jsxs)(`div`,{className:`squisq-jf-chip-bin`,children:[a.map((e,t)=>{let n=s&&typeof e==`string`?s[e]??String(e):String(e);return(0,T.jsxs)(`span`,{className:`squisq-jf-chip`,children:[n,(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-chip__remove`,disabled:r,onClick:()=>d(t),"aria-label":`Remove ${n}`,children:`×`})]},t)}),!r&&c&&c.length>0?(0,T.jsxs)(`select`,{className:`squisq-jf-select`,value:``,onChange:e=>f(e.target.value),style:{width:`auto`},children:[(0,T.jsx)(`option`,{value:``,disabled:!0,children:t.squisq?.addLabel??`+ Add`}),c.filter(e=>!a.includes(e)).map((e,t)=>(0,T.jsx)(`option`,{value:String(e),children:s&&typeof e==`string`?s[e]??String(e):String(e)},t))]}):r?null:(0,T.jsx)(`input`,{type:`text`,className:`squisq-jf-chip-bin__add-input`,placeholder:t.squisq?.addLabel??`+ Add`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{(e.key===`Enter`||e.key===`,`)&&(e.preventDefault(),f(l.trim()))},onBlur:()=>f(l.trim())})]})}function q(e,t){switch(t.type){case`integer`:return parseInt(e,10);case`number`:return Number(e);case`boolean`:return e===`true`||e===`1`;default:return e}}function J({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O(),a=Array.isArray(e)?e:[],o=(Array.isArray(t.items)?t.items[0]:t.items)??{type:`object`},s=o.squisq?.itemLabel,c=t.squisq?.addLabel??`+ Add`,l=e=>i(n,e),u=()=>l([...a,X(o)]),d=e=>{let t=a.slice();t.splice(e,1),l(t)},f=(e,t)=>{let n=e+t;if(n<0||n>=a.length)return;let r=a.slice();[r[e],r[n]]=[r[n],r[e]],l(r)};return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`squisq-jf-card-stack`,children:a.map((e,i)=>(0,T.jsxs)(`div`,{className:`squisq-jf-card`,children:[(0,T.jsxs)(`div`,{className:`squisq-jf-card__header`,children:[(0,T.jsx)(`h4`,{className:`squisq-jf-card__title`,children:Y(s,e,i)}),r?null:(0,T.jsxs)(`span`,{className:`squisq-jf-card__actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn`,onClick:()=>f(i,-1),disabled:i===0,"aria-label":`Move up`,title:`Move up`,children:`↑`}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn`,onClick:()=>f(i,1),disabled:i===a.length-1,"aria-label":`Move down`,title:`Move down`,children:`↓`}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn squisq-jf-icon-btn--danger`,onClick:()=>d(i),"aria-label":t.squisq?.removeLabel??`Remove`,title:t.squisq?.removeLabel??`Remove`,children:`×`})]})]}),(0,T.jsx)($,{value:e,schema:o,pointer:`${n}/${i}`,parentDisabled:r,suppressTopGroupTitle:!0})]},i))}),r?null:(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-add-btn`,onClick:u,style:{marginTop:8},children:c})]})}function Y(e,t,n){if(!e)return`Item ${n+1}`;if(typeof e==`string`)return e;if(t&&typeof t==`object`){let n=t[e.fromField];if(typeof n==`string`&&n!==``)return n;if(typeof n==`number`)return String(n)}return`Item ${n+1}`}function X(e){if(e.default!==void 0)return e.default;switch(Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type){case`object`:{let t={};for(let[n,r]of Object.entries(e.properties??{}))t[n]=X(r);return t}case`array`:return[];case`string`:return``;case`number`:case`integer`:return e.minimum??0;case`boolean`:return!1;default:return}}function Z(e){let{value:t,schema:n,pointer:r,disabled:i}=e,a=(0,w.useId)().replace(/:/g,``),o=n.oneOf??n.anyOf??[],[s,c]=(0,w.useState)(Q(o,t));(0,w.useEffect)(()=>{c(Q(o,t))},[t]);let l=o[s];if(!l)return null;let u=e=>{let t=(e+o.length)%o.length;c(t),requestAnimationFrame(()=>document.getElementById(`${a}-tab-${t}`)?.focus())};return(0,T.jsxs)(`div`,{...A(e),children:[(0,T.jsx)(`div`,{className:`squisq-jf-tabs__strip`,role:`tablist`,children:o.map((e,t)=>(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-tabs__tab${t===s?` squisq-jf-tabs__tab--active`:``}`,disabled:i,onClick:()=>c(t),onKeyDown:e=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),u(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),u(t-1)):e.key===`Home`?(e.preventDefault(),u(0)):e.key===`End`&&(e.preventDefault(),u(o.length-1))},role:`tab`,id:`${a}-tab-${t}`,"aria-selected":t===s,"aria-controls":`${a}-panel`,tabIndex:t===s?0:-1,children:e.squisq?.label??e.title??`Option ${t+1}`},t))}),(0,T.jsx)(`div`,{id:`${a}-panel`,role:`tabpanel`,"aria-labelledby":`${a}-tab-${s}`,children:(0,T.jsx)($,{value:t,schema:l,pointer:r,parentDisabled:i})})]})}function Q(e,t){for(let n=0;n<e.length;n++)if(ne(e[n],t))return n;return 0}function ne(e,t){let n=e.type,r=Array.isArray(n)?n.find(e=>e!==`null`):n;if(!r)return!0;switch(r){case`string`:return typeof t==`string`;case`number`:case`integer`:return typeof t==`number`;case`boolean`:return typeof t==`boolean`;case`null`:return t===null;case`array`:return Array.isArray(t);case`object`:return typeof t==`object`&&!!t&&!Array.isArray(t);default:return!1}}var re={text:te,multiline:N,richtext:P,color:U,date:W,time:W,datetime:W,slider:I,stepper:F,segmented:B,radio:V,combobox:H,toggle:L,checkbox:R,card:G,group:G,"card-stack":J,"chip-bin":K,tabs:Z};function ie(e,t){return e===`group`||e===`card`||e===`tabs`||e===`card-stack`||e===`richtext`||e===`chip-bin`&&c(t)===`object`}function $(e){let t=(0,w.useId)().replace(/:/g,``),{rootSchema:n,rootData:r,errors:i}=O(),o=d(e.schema,n)??e.schema;if(a(o.squisq?.hidden,r))return null;let c=(e.parentDisabled??!1)||a(o.squisq?.disabled,r),l=s(o),u=re[l],f=o.squisq?.label??o.title,p=o.squisq?.help??o.description,m=i.get(e.pointer)??[],h=`squisq-json-control-${t}`,g=f?`${h}-label`:void 0,_=p?`${h}-help`:void 0,v=m.length>0?`${h}-error`:void 0,y=[_,v].filter(Boolean).join(` `)||void 0,b=(0,T.jsx)(u,{value:e.value,schema:o,pointer:e.pointer,disabled:c,controlId:h,labelledBy:g,describedBy:y,invalid:m.length>0,suppressTitle:e.suppressTopGroupTitle});return ie(l,o)?b:(0,T.jsxs)(`div`,{className:`squisq-jf-field${c?` squisq-jf-field--disabled`:``}`,children:[f?(0,T.jsx)(`label`,{id:g,htmlFor:h,className:`squisq-jf-field__label`,children:f}):null,b,p?(0,T.jsx)(`p`,{id:_,className:`squisq-jf-field__help`,children:p}):null,m.length>0?(0,T.jsx)(`p`,{id:v,className:`squisq-jf-field__error`,role:`alert`,children:m[0].message}):null]})}function ae(e,t){let n=i(t===`auto`),r=t===`auto`?n:t??void 0;return(0,w.useMemo)(()=>({style:u(e,r,{prefix:`--squisq-jsonform`}),theme:l(e,r)}),[e,r])}function oe(e){let{schema:t,value:n,onChange:r,theme:i,surface:a,density:o=`comfortable`,validate:s,onValidate:c,className:l}=e,{style:u}=ae(i,a),d=r??(()=>{});return(0,T.jsx)(`div`,{className:`squisq-jsonform`+(o===`compact`?` squisq-jsonform--compact`:``)+(l?` ${l}`:``),style:u,children:(0,T.jsx)(D,{rootSchema:t,rootData:n,onRootChange:d,density:o,validate:s,onValidate:c,children:(0,T.jsx)($,{value:n,schema:t,pointer:``,parentDisabled:!r})})})}var se=r(`gezellig`);function ce({className:e,...t}){let n=[`gezel-json-editor`,e].filter(Boolean).join(` `);return(0,T.jsx)(oe,{...t,className:n,theme:se})}export{ce as t};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import"./chunk-4VOD55SX-BFSSw0c8.js";import{k as r}from"./chunk-GAZKTT4R-w1SNypWQ.js";import"./schemas-BvLZUsGm.js";import{t as i}from"./chunk-TT6ENR6T-BOA-qiwP.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./chunk-DQRELU4S--U9FIVtY.js";import{L as p,R as m,a as h,d as g,i as _,l as v,m as y,n as b,o as x,r as S,s as ee,t as C}from"./dist-1FNFiksd.js";var w=e(t(),1),T=n(),E=(0,w.createContext)(null);function D(e){let{rootSchema:t,rootData:n,onRootChange:r,density:i,validate:a,onValidate:s,children:c}=e,l=(0,w.useMemo)(()=>a?a(n,t):[],[a,n,t]),u=(0,w.useMemo)(()=>{let e=new Map;for(let t of l){let n=e.get(t.path)??[];n.push(t),e.set(t.path,n)}return e},[l]);(0,w.useEffect)(()=>{s&&s(l)},[l,s]);let d=(0,w.useMemo)(()=>(e,t)=>{let i=o(n,e,t);r(i)},[n,r]),f=(0,w.useMemo)(()=>({rootSchema:t,rootData:n,setAtPath:d,density:i,errors:u}),[t,n,d,i,u]);return(0,T.jsx)(E.Provider,{value:f,children:c})}function O(){let e=(0,w.useContext)(E);if(!e)throw Error(`useJsonEditor must be used inside <JsonEditor>`);return e}function k(e){let{value:t,onChange:n,readOnly:r=!1,placeholder:i,className:a}=e,o=(0,w.useRef)(!1),s=(0,w.useRef)(t),c=y({editable:!r,extensions:[v.configure({codeBlock:{HTMLAttributes:{class:`squisq-code-block`}}}),ee.configure({resizable:!1}),x,h,_,S,b.configure({nested:!0}),C.configure({placeholder:i??``})],content:p(t),onUpdate:({editor:e})=>{if(o.current)return;let t=m(e.getHTML());s.current=t,n(t)},editorProps:{attributes:{class:`squisq-jf-richtext-prose`}}});return(0,w.useEffect)(()=>{if(c&&t!==s.current){o.current=!0;try{c.commands.setContent(p(t),!1),s.current=t}finally{o.current=!1}}},[c,t]),(0,w.useEffect)(()=>{c&&c.setEditable(!r)},[c,r]),(0,T.jsx)(g,{editor:c,className:`squisq-jf-richtext`+(a?` ${a}`:``)})}function A(e){return{id:e.controlId,"aria-labelledby":e.labelledBy,"aria-describedby":e.describedBy,"aria-invalid":e.invalid||void 0}}function j(e){return e==null?``:String(e)}function M(e){if(e==null||e===``)return``;let t=Number(e);return Number.isFinite(t)?t:``}function te(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O();return(0,T.jsx)(`input`,{...A(e),type:`text`,className:`squisq-jf-input`,value:j(t),placeholder:n.squisq?.placeholder,disabled:i,onChange:e=>a(r,e.target.value)})}function N(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=(0,w.useRef)(null);return(0,w.useEffect)(()=>{let e=o.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+2}px`)},[t]),(0,T.jsx)(`textarea`,{...A(e),ref:o,className:`squisq-jf-textarea`,value:j(t),placeholder:n.squisq?.placeholder,disabled:i,onChange:e=>a(r,e.target.value)})}function P({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O();return(0,T.jsx)(k,{value:j(e),placeholder:t.squisq?.placeholder,readOnly:r,onChange:e=>i(n,e)})}function F(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.type===`integer`,s=n.squisq?.step??n.multipleOf??(o?1:.1),c=M(t),l=e=>{let t=n.minimum??n.exclusiveMinimum,i=n.maximum??n.exclusiveMaximum,s=e;typeof t==`number`&&(s=Math.max(t,s)),typeof i==`number`&&(s=Math.min(i,s)),a(r,o?Math.round(s):s)};return(0,T.jsxs)(`span`,{className:`squisq-jf-stepper`,children:[(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-stepper__btn`,disabled:i,onClick:()=>l((typeof c==`number`?c:0)-s),"aria-label":`Decrease`,children:`−`}),(0,T.jsx)(`input`,{...A(e),className:`squisq-jf-stepper__input`,type:`number`,value:c===``?``:c,step:s,disabled:i,onChange:e=>{if(e.target.value===``){a(r,void 0);return}let t=Number(e.target.value);Number.isFinite(t)&&l(t)}}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-stepper__btn`,disabled:i,onClick:()=>l((typeof c==`number`?c:0)+s),"aria-label":`Increase`,children:`+`})]})}function I(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.minimum??n.exclusiveMinimum??0,s=n.maximum??n.exclusiveMaximum??100,c=n.squisq?.step??n.multipleOf??(n.type,1),l=M(t),u=typeof l==`number`?l:o;return(0,T.jsxs)(`span`,{className:`squisq-jf-slider-row`,children:[(0,T.jsx)(`input`,{...A(e),type:`range`,className:`squisq-jf-slider`,min:o,max:s,step:c,value:u,disabled:i,onChange:e=>a(r,Number(e.target.value))}),(0,T.jsx)(`span`,{className:`squisq-jf-slider-readout`,children:u})]})}function L(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=!!t;return(0,T.jsxs)(`button`,{...A(e),type:`button`,className:`squisq-jf-toggle${o?` squisq-jf-toggle--on`:``}`,disabled:i,onClick:()=>a(r,!o),"aria-pressed":o,children:[(0,T.jsx)(`span`,{className:`squisq-jf-toggle__track`,children:(0,T.jsx)(`span`,{className:`squisq-jf-toggle__thumb`})}),(0,T.jsx)(`span`,{className:`squisq-jf-toggle__label`,children:o?n.squisq?.label?`${n.squisq.label}: On`:`On`:n.squisq?.label?`${n.squisq.label}: Off`:`Off`})]})}function R(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=(0,w.useId)(),s=e.controlId??o;return(0,T.jsxs)(`label`,{htmlFor:s,className:`squisq-jf-toggle`,children:[(0,T.jsx)(`input`,{"aria-labelledby":e.labelledBy,"aria-describedby":e.describedBy,"aria-invalid":e.invalid||void 0,id:s,type:`checkbox`,checked:!!t,disabled:i,onChange:e=>a(r,e.target.checked)}),n.squisq?.label??n.title??``]})}function z(e){let t=e.squisq?.enumLabels;return(e.enum??[]).map(e=>({value:e,label:t&&typeof e==`string`?t[e]??String(e):String(e)}))}function B(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n);return(0,T.jsx)(`span`,{...A(e),className:`squisq-jf-segmented`,role:`group`,children:o.map((e,n)=>{let o=t===e.value;return(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-segmented__btn${o?` squisq-jf-segmented__btn--active`:``}`,disabled:i,onClick:()=>a(r,e.value),"aria-pressed":o,children:e.label},n)})})}function V(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n),s=(0,w.useId)();return(0,T.jsx)(`div`,{...A(e),className:`squisq-jf-radio`,role:`radiogroup`,children:o.map((e,n)=>{let o=t===e.value;return(0,T.jsxs)(`label`,{className:`squisq-jf-radio__option`,children:[(0,T.jsx)(`input`,{type:`radio`,name:s,checked:o,disabled:i,onChange:()=>a(r,e.value)}),e.label]},n)})})}function H(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=z(n);return(0,T.jsx)(`select`,{...A(e),className:`squisq-jf-select`,value:j(t),disabled:i,onChange:e=>{let t=e.target.value,n=o.find(e=>String(e.value)===t);a(r,n?n.value:t)},children:o.map((e,t)=>(0,T.jsx)(`option`,{value:String(e.value),children:e.label},t))})}function U(e){let{value:t,pointer:n,disabled:r}=e,{setAtPath:i}=O(),a=typeof t==`string`&&/^#[0-9a-f]{6}$/i.test(t)?t:`#000000`;return(0,T.jsxs)(`span`,{className:`squisq-jf-color`,children:[(0,T.jsx)(`input`,{...A(e),type:`color`,className:`squisq-jf-color__input`,value:a,disabled:r,onChange:e=>i(n,e.target.value)}),(0,T.jsx)(`input`,{type:`text`,className:`squisq-jf-input squisq-jf-color__hex`,value:j(t),disabled:r,onChange:e=>i(n,e.target.value)})]})}function W(e){let{value:t,schema:n,pointer:r,disabled:i}=e,{setAtPath:a}=O(),o=n.format,s=o===`time`?`time`:o===`date`?`date`:`datetime-local`,c=s===`datetime-local`&&typeof t==`string`&&t.includes(`T`)?t.replace(/Z$|:\d{2}\.\d+Z?$/,``).slice(0,16):j(t);return(0,T.jsx)(`input`,{...A(e),type:s,className:`squisq-jf-input`,value:c,disabled:i,onChange:e=>a(r,e.target.value)})}function G(e){let{value:t,schema:n,pointer:r,disabled:i,suppressTitle:a}=e,o=a?void 0:n.squisq?.label??n.title,s=n.squisq?.help??n.description,c=(t&&typeof t==`object`?t:{})??{},l=Object.entries(n.properties??{});return(0,T.jsxs)(`section`,{className:`squisq-jf-group`,children:[o?(0,T.jsx)(`h3`,{className:`squisq-jf-group__title`,children:o}):null,s?(0,T.jsx)(`p`,{className:`squisq-jf-group__help`,children:s}):null,l.map(([e,t])=>(0,T.jsx)($,{value:c[e],schema:t,pointer:f(r,e),parentDisabled:i},e))]})}function K({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O(),a=Array.isArray(e)?e:[],o=(Array.isArray(t.items)?t.items[0]:t.items)??{type:`string`},s=o.squisq?.enumLabels,c=o.enum,[l,u]=(0,w.useState)(``),d=e=>{let t=a.slice();t.splice(e,1),i(n,t)},f=e=>{if(e===``)return;let t=q(e,o);i(n,[...a,t]),u(``)};return(0,T.jsxs)(`div`,{className:`squisq-jf-chip-bin`,children:[a.map((e,t)=>{let n=s&&typeof e==`string`?s[e]??String(e):String(e);return(0,T.jsxs)(`span`,{className:`squisq-jf-chip`,children:[n,(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-chip__remove`,disabled:r,onClick:()=>d(t),"aria-label":`Remove ${n}`,children:`×`})]},t)}),!r&&c&&c.length>0?(0,T.jsxs)(`select`,{className:`squisq-jf-select`,value:``,onChange:e=>f(e.target.value),style:{width:`auto`},children:[(0,T.jsx)(`option`,{value:``,disabled:!0,children:t.squisq?.addLabel??`+ Add`}),c.filter(e=>!a.includes(e)).map((e,t)=>(0,T.jsx)(`option`,{value:String(e),children:s&&typeof e==`string`?s[e]??String(e):String(e)},t))]}):r?null:(0,T.jsx)(`input`,{type:`text`,className:`squisq-jf-chip-bin__add-input`,placeholder:t.squisq?.addLabel??`+ Add`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{(e.key===`Enter`||e.key===`,`)&&(e.preventDefault(),f(l.trim()))},onBlur:()=>f(l.trim())})]})}function q(e,t){switch(t.type){case`integer`:return parseInt(e,10);case`number`:return Number(e);case`boolean`:return e===`true`||e===`1`;default:return e}}function J({value:e,schema:t,pointer:n,disabled:r}){let{setAtPath:i}=O(),a=Array.isArray(e)?e:[],o=(Array.isArray(t.items)?t.items[0]:t.items)??{type:`object`},s=o.squisq?.itemLabel,c=t.squisq?.addLabel??`+ Add`,l=e=>i(n,e),u=()=>l([...a,X(o)]),d=e=>{let t=a.slice();t.splice(e,1),l(t)},f=(e,t)=>{let n=e+t;if(n<0||n>=a.length)return;let r=a.slice();[r[e],r[n]]=[r[n],r[e]],l(r)};return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`squisq-jf-card-stack`,children:a.map((e,i)=>(0,T.jsxs)(`div`,{className:`squisq-jf-card`,children:[(0,T.jsxs)(`div`,{className:`squisq-jf-card__header`,children:[(0,T.jsx)(`h4`,{className:`squisq-jf-card__title`,children:Y(s,e,i)}),r?null:(0,T.jsxs)(`span`,{className:`squisq-jf-card__actions`,children:[(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn`,onClick:()=>f(i,-1),disabled:i===0,"aria-label":`Move up`,title:`Move up`,children:`↑`}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn`,onClick:()=>f(i,1),disabled:i===a.length-1,"aria-label":`Move down`,title:`Move down`,children:`↓`}),(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-icon-btn squisq-jf-icon-btn--danger`,onClick:()=>d(i),"aria-label":t.squisq?.removeLabel??`Remove`,title:t.squisq?.removeLabel??`Remove`,children:`×`})]})]}),(0,T.jsx)($,{value:e,schema:o,pointer:`${n}/${i}`,parentDisabled:r,suppressTopGroupTitle:!0})]},i))}),r?null:(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-add-btn`,onClick:u,style:{marginTop:8},children:c})]})}function Y(e,t,n){if(!e)return`Item ${n+1}`;if(typeof e==`string`)return e;if(t&&typeof t==`object`){let n=t[e.fromField];if(typeof n==`string`&&n!==``)return n;if(typeof n==`number`)return String(n)}return`Item ${n+1}`}function X(e){if(e.default!==void 0)return e.default;switch(Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type){case`object`:{let t={};for(let[n,r]of Object.entries(e.properties??{}))t[n]=X(r);return t}case`array`:return[];case`string`:return``;case`number`:case`integer`:return e.minimum??0;case`boolean`:return!1;default:return}}function Z(e){let{value:t,schema:n,pointer:r,disabled:i}=e,a=(0,w.useId)().replace(/:/g,``),o=n.oneOf??n.anyOf??[],[s,c]=(0,w.useState)(Q(o,t));(0,w.useEffect)(()=>{c(Q(o,t))},[t]);let l=o[s];if(!l)return null;let u=e=>{let t=(e+o.length)%o.length;c(t),requestAnimationFrame(()=>document.getElementById(`${a}-tab-${t}`)?.focus())};return(0,T.jsxs)(`div`,{...A(e),children:[(0,T.jsx)(`div`,{className:`squisq-jf-tabs__strip`,role:`tablist`,children:o.map((e,t)=>(0,T.jsx)(`button`,{type:`button`,className:`squisq-jf-tabs__tab${t===s?` squisq-jf-tabs__tab--active`:``}`,disabled:i,onClick:()=>c(t),onKeyDown:e=>{e.key===`ArrowRight`||e.key===`ArrowDown`?(e.preventDefault(),u(t+1)):e.key===`ArrowLeft`||e.key===`ArrowUp`?(e.preventDefault(),u(t-1)):e.key===`Home`?(e.preventDefault(),u(0)):e.key===`End`&&(e.preventDefault(),u(o.length-1))},role:`tab`,id:`${a}-tab-${t}`,"aria-selected":t===s,"aria-controls":`${a}-panel`,tabIndex:t===s?0:-1,children:e.squisq?.label??e.title??`Option ${t+1}`},t))}),(0,T.jsx)(`div`,{id:`${a}-panel`,role:`tabpanel`,"aria-labelledby":`${a}-tab-${s}`,children:(0,T.jsx)($,{value:t,schema:l,pointer:r,parentDisabled:i})})]})}function Q(e,t){for(let n=0;n<e.length;n++)if(ne(e[n],t))return n;return 0}function ne(e,t){let n=e.type,r=Array.isArray(n)?n.find(e=>e!==`null`):n;if(!r)return!0;switch(r){case`string`:return typeof t==`string`;case`number`:case`integer`:return typeof t==`number`;case`boolean`:return typeof t==`boolean`;case`null`:return t===null;case`array`:return Array.isArray(t);case`object`:return typeof t==`object`&&!!t&&!Array.isArray(t);default:return!1}}var re={text:te,multiline:N,richtext:P,color:U,date:W,time:W,datetime:W,slider:I,stepper:F,segmented:B,radio:V,combobox:H,toggle:L,checkbox:R,card:G,group:G,"card-stack":J,"chip-bin":K,tabs:Z};function ie(e,t){return e===`group`||e===`card`||e===`tabs`||e===`card-stack`||e===`richtext`||e===`chip-bin`&&c(t)===`object`}function $(e){let t=(0,w.useId)().replace(/:/g,``),{rootSchema:n,rootData:r,errors:i}=O(),o=d(e.schema,n)??e.schema;if(a(o.squisq?.hidden,r))return null;let c=(e.parentDisabled??!1)||a(o.squisq?.disabled,r),l=s(o),u=re[l],f=o.squisq?.label??o.title,p=o.squisq?.help??o.description,m=i.get(e.pointer)??[],h=`squisq-json-control-${t}`,g=f?`${h}-label`:void 0,_=p?`${h}-help`:void 0,v=m.length>0?`${h}-error`:void 0,y=[_,v].filter(Boolean).join(` `)||void 0,b=(0,T.jsx)(u,{value:e.value,schema:o,pointer:e.pointer,disabled:c,controlId:h,labelledBy:g,describedBy:y,invalid:m.length>0,suppressTitle:e.suppressTopGroupTitle});return ie(l,o)?b:(0,T.jsxs)(`div`,{className:`squisq-jf-field${c?` squisq-jf-field--disabled`:``}`,children:[f?(0,T.jsx)(`label`,{id:g,htmlFor:h,className:`squisq-jf-field__label`,children:f}):null,b,p?(0,T.jsx)(`p`,{id:_,className:`squisq-jf-field__help`,children:p}):null,m.length>0?(0,T.jsx)(`p`,{id:v,className:`squisq-jf-field__error`,role:`alert`,children:m[0].message}):null]})}function ae(e,t){let n=i(t===`auto`),r=t===`auto`?n:t??void 0;return(0,w.useMemo)(()=>({style:u(e,r,{prefix:`--squisq-jsonform`}),theme:l(e,r)}),[e,r])}function oe(e){let{schema:t,value:n,onChange:r,theme:i,surface:a,density:o=`comfortable`,validate:s,onValidate:c,className:l}=e,{style:u}=ae(i,a),d=r??(()=>{});return(0,T.jsx)(`div`,{className:`squisq-jsonform`+(o===`compact`?` squisq-jsonform--compact`:``)+(l?` ${l}`:``),style:u,children:(0,T.jsx)(D,{rootSchema:t,rootData:n,onRootChange:d,density:o,validate:s,onValidate:c,children:(0,T.jsx)($,{value:n,schema:t,pointer:``,parentDisabled:!r})})})}var se=r(`gezellig`);function ce({className:e,...t}){let n=[`gezel-json-editor`,e].filter(Boolean).join(` `);return(0,T.jsx)(oe,{...t,className:n,theme:se})}export{ce as t};
|
|
@@ -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{Vt as r,Xt as i}from"./dist-CE5CbmDb.js";import{t as a}from"./api-CmrgM5Rf.js";import{i as o,n as s,r as c,t as l}from"./Tabs-jE0Z5Tzd.js";import{G as u,H as d,J as f,K as p,W as m,Y as h,q as g}from"./primitives-CWrGZpPI.js";import{Wt as _,a as v,y}from"./index-DivKnJyx.js";import{t as b}from"./CatalogBrowser-DYXUZQ_t.js";import{GezelDetail as x,t as S}from"./GezelDetail-Br4v42Nv.js";var C=e(t(),1),w=n();function T({activeProjectsByGezel:e,activeTurnsReady:t}){let[n,r]=(0,C.useState)([]),[i,o]=(0,C.useState)(void 0),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(void 0),[d,f]=(0,C.useState)(!1),[p,m]=(0,C.useState)(null),[h,g]=(0,C.useState)(new Set),b=(0,C.useCallback)(async()=>{try{let{gezels:e}=await a.listGezels();r(e)}catch(e){m(e.message)}},[]),T=(0,C.useCallback)(async()=>{try{let e=await a.getConfig();o(e.meesterGezelId),c(e.roleBasedNameOnlyMode??!1)}catch{}},[]);(0,C.useEffect)(()=>{b(),T()},[b,T]),(0,C.useEffect)(()=>{let e=e=>{let t=e.detail;typeof t?.roleBasedNameOnlyMode==`boolean`&&c(t.roleBasedNameOnlyMode)};return window.addEventListener(`gezel:config-updated`,e),()=>window.removeEventListener(`gezel:config-updated`,e)},[]),(0,C.useEffect)(()=>{if(n.length===0){u(void 0);return}u(e=>e&&n.some(t=>t.id===e)?e:n[0].id)},[n]),(0,C.useEffect)(()=>{let e=()=>void b(),t=e=>{let t=e.detail?.gezelId;t&&(r(e=>e.filter(e=>e.id!==t)),u(e=>e===t?void 0:e),g(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})),b(),T()};return window.addEventListener(`gezel:gezel-updated`,e),window.addEventListener(`gezel:growth-updated`,e),window.addEventListener(`gezel:gezel-deleted`,t),()=>{window.removeEventListener(`gezel:gezel-updated`,e),window.removeEventListener(`gezel:growth-updated`,e),window.removeEventListener(`gezel:gezel-deleted`,t)}},[b,T]),(0,C.useEffect)(()=>{v(`gezel`)&&f(!0);let e=()=>{v(`gezel`),f(!0)};return window.addEventListener(`gezel:new-gezel`,e),()=>window.removeEventListener(`gezel:new-gezel`,e)},[]);let D=(0,C.useCallback)((e,t)=>{g(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),O=(0,C.useCallback)(e=>{u(e)},[]),k=(0,C.useCallback)(t=>{O(t),(e?.get(t)?.size??0)>0&&window.dispatchEvent(new CustomEvent(`gezel:prefer-working-project`,{detail:{gezelId:t}}))},[e,O]),A=(0,C.useCallback)((e,t)=>{D(e.id,!0),(async()=>{try{let n=await a.generateGezelIcon(e.id,t?{instruction:t}:{});window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:n}))}catch{}finally{D(e.id,!1)}})(),e.role&&(async()=>{try{let t=await a.generateGezelAbout(e.id,{role:e.role});window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:t}))}catch{}})()},[D]);return(0,w.jsxs)(`div`,{className:`two-col gezellen-view`,"data-testid":`gezels-view`,children:[(0,w.jsx)(E,{open:d,onClose:()=>f(!1),onCreate:(0,C.useCallback)(async(e,t,n,r)=>{let i=await a.createGezel({name:e,gender:n,...t?{role:t}:{}});f(!1),await b(),O(i.id),window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:i})),A(i,r)},[b,O,A]),onTemplateCreated:async e=>{f(!1),await b(),O(e.id),window.dispatchEvent(new CustomEvent(`gezel:gezel-updated`,{detail:e}))}}),(0,w.jsxs)(`aside`,{className:`side gezels-side`,children:[(0,w.jsx)(`div`,{className:`area-toolbar`,children:(0,w.jsx)(`button`,{type:`button`,className:`area-toolbar-btn`,onClick:()=>f(!0),children:`+ New Gezel`})}),(0,w.jsx)(`ul`,{className:`gezel-list`,children:n.map(t=>{let n=h.has(t.id),r=t.id===l,a=(e?.get(t.id)?.size??0)>0;return(0,w.jsxs)(`li`,{className:`gezel-row-shell${r?` active`:``}`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`gezel-row${r?` active`:``}`,onClick:()=>k(t.id),children:[(0,w.jsx)(_,{svg:t.icon??null,poppetje:t.poppetje,iconOverride:t.iconOverride,name:t.name,size:36,pulsing:n&&!t.icon&&!t.poppetje}),(0,w.jsxs)(`span`,{className:`gezel-row-text`,children:[(0,w.jsxs)(`span`,{className:`gezel-row-name`,children:[t.name,t.growth&&(0,w.jsx)(S,{level:t.growth.level,pending:!!t.growth.pending}),t.storageScope===`machine-shared`&&(0,w.jsx)(`span`,{className:`machine-shared-badge`,title:`Shared with accounts on this machine; chats and memories stay private`,children:`Shared`}),t.id===i&&(0,w.jsx)(`span`,{className:`meester-badge`,title:`Current Meester — change in Settings`,"aria-label":`Current Meester`,children:`⭐`}),t.fixedFunction&&(0,w.jsx)(`span`,{className:`ff-row-badge`,title:`Fixed-function gezel — forwards messages to ${t.fixedFunction.tool} (no LLM)`,"aria-label":`Fixed-function gezel`,children:`⚡`})]}),(t.id===i||t.role)&&(0,w.jsx)(`span`,{className:`gezel-row-role`,children:t.id===i?t.role&&t.role!==`Meester`?`Meester · ${t.role}`:`Meester`:t.role})]})]}),a&&(0,w.jsxs)(`button`,{type:`button`,className:`project-row-thinking gezel-row-thinking`,onClick:()=>k(t.id),title:`${t.name} is working — open`,"aria-label":`${t.name} is working. Open gezel.`,children:[(0,w.jsx)(`span`,{className:`project-row-thinking-dot`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`project-row-thinking-dot`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`project-row-thinking-dot`,"aria-hidden":`true`})]}),(0,w.jsx)(y,{gezel:t,compact:!0,boringMode:s})]},t.id)})}),p&&(0,w.jsx)(`p`,{className:`error`,children:p})]}),(0,w.jsx)(`section`,{children:l?(0,w.jsx)(x,{gezelId:l,workingProjectIds:e?.get(l),activeTurnsReady:t},l):(0,w.jsx)(`p`,{className:`placeholder`,children:`No gezellen yet — create one to get started.`})})]})}function E({open:e,onClose:t,onCreate:n,onTemplateCreated:r}){let[i,a]=(0,C.useState)(`scratch`),[u,d]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{e&&a(`scratch`)},[e]),(0,w.jsx)(f,{open:e,onOpenChange:e=>{!e&&!u&&t()},children:(0,w.jsxs)(g,{children:[(0,w.jsx)(p,{}),(0,w.jsxs)(m,{className:`new-gezel-dialog`,children:[(0,w.jsx)(h,{asChild:!0,children:(0,w.jsx)(`h3`,{style:{margin:0},children:`New Gezel`})}),(0,w.jsxs)(c,{value:i,onValueChange:e=>a(e),children:[(0,w.jsxs)(s,{children:[(0,w.jsx)(o,{value:`scratch`,children:`From scratch`}),(0,w.jsx)(o,{value:`template`,children:`From template`})]}),(0,w.jsx)(l,{value:`scratch`,children:(0,w.jsx)(D,{onCancel:t,onCreate:n})}),(0,w.jsx)(l,{value:`template`,children:(0,w.jsx)(O,{busy:u,setBusy:d,onCancel:t,onCreated:r})})]})]})]})})}function D({onCancel:e,onCreate:t}){let[{name:n,gender:a},o]=(0,C.useState)(r),[s,c]=(0,C.useState)(``),[l,u]=(0,C.useState)(``);return(0,w.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),n.trim()&&t(n.trim(),s.trim(),a,l.trim())},className:`new-gezel-form`,children:[(0,w.jsxs)(`label`,{children:[`Name`,(0,w.jsxs)(`div`,{className:`name-row`,children:[(0,w.jsx)(`input`,{value:n,onChange:e=>o(t=>({...t,name:e.target.value})),placeholder:`e.g. Ada`}),(0,w.jsx)(`button`,{type:`button`,className:`dice-btn`,onClick:()=>o(r()),title:`Pick a random name`,"aria-label":`Pick a random name`,children:`🎲`})]})]}),(0,w.jsxs)(`label`,{className:`new-gezel-gender-field`,children:[`Gender`,(0,w.jsxs)(`select`,{value:a,onChange:e=>o(t=>({...t,gender:e.target.value})),children:[(0,w.jsxs)(`option`,{value:`male`,children:[`male (`,i(`male`),`)`]}),(0,w.jsxs)(`option`,{value:`female`,children:[`female (`,i(`female`),`)`]}),(0,w.jsxs)(`option`,{value:`non-binary`,children:[`non-binary (`,i(`non-binary`),`)`]})]})]}),(0,w.jsxs)(`label`,{children:[`Role`,(0,w.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`e.g. Developer, Marketing`})]}),(0,w.jsxs)(`label`,{children:[`Describe the icon `,(0,w.jsx)(`span`,{className:`muted`,children:`(optional)`}),(0,w.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g. a playful owl wearing glasses, warm colors`,rows:3})]}),(0,w.jsxs)(d,{children:[(0,w.jsx)(`button`,{type:`button`,onClick:e,children:`Cancel`}),(0,w.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!n.trim(),children:`Create`})]})]})}function O({busy:e,setBusy:t,onCancel:n,onCreated:r}){let[i,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(``),[l,f]=(0,C.useState)(null),p=async()=>{if(!(!i||!s.trim())){t(!0),f(null);try{r(await a.createGezelFromTemplate(i.id,{name:s.trim()}))}catch(e){f(e.message)}finally{t(!1)}}};return(0,w.jsxs)(`div`,{className:`new-gezel-template-tab`,children:[(0,w.jsx)(u,{className:`muted small`,style:{margin:`0 0 0.5rem 0`},children:`Pick a role to start from. The template's about.md becomes the new gezel's prompt — you can edit it after.`}),l&&(0,w.jsx)(`p`,{className:`error`,children:l}),(0,w.jsx)(b,{kind:`gezel-template`,emptyMessage:`No gezel templates available.`,action:t=>{if(t.manifest.kind!==`gezel-template`)return null;let n=t.manifest,r=i?.id===n.id,a=Array.isArray(n.nameSuggestions)?n.nameSuggestions:[],s=k(n.frontmatter);return(0,w.jsxs)(`div`,{className:`template-action-stack`,children:[s&&(0,w.jsx)(`span`,{className:`gz-badge gz-badge-passthrough`,title:`No LLM — passes your message straight to the configured tool`,children:`No LLM — passthrough`}),(0,w.jsx)(`button`,{type:`button`,disabled:e,className:r?`primary`:``,onClick:()=>{if(o({id:n.id,defaultName:n.name,nameSuggestions:a,isFixedFunction:s}),a.length>0){let e=Math.floor(Math.random()*a.length);c(a[e]??n.name)}else c(n.name)},children:r?`✓ Selected`:`Use this template`})]})}}),i&&(0,w.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),p()},className:`new-gezel-template-form`,children:[(0,w.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`center`},children:[(0,w.jsxs)(`span`,{className:`muted small`,style:{flexShrink:0},children:[`Name your `,i.defaultName.toLowerCase(),`:`]}),(0,w.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),disabled:e,style:{flex:1}})]}),i.nameSuggestions.length>0&&(0,w.jsxs)(`div`,{className:`name-suggestions`,children:[(0,w.jsx)(`span`,{className:`muted small`,children:`Suggestions:`}),i.nameSuggestions.map(t=>(0,w.jsx)(`button`,{type:`button`,className:t===s?`name-chip name-chip-active`:`name-chip`,onClick:()=>c(t),disabled:e,children:t},t))]}),(0,w.jsxs)(d,{children:[(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:e,children:`Cancel`}),(0,w.jsx)(`button`,{type:`submit`,className:`primary`,disabled:e||!s.trim(),children:e?`Creating…`:`Create`})]})]}),!i&&(0,w.jsx)(d,{children:(0,w.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`})})]})}function k(e){return!!(e&&typeof e==`object`&&`fixedFunction`in e&&e.fixedFunction)}export{T as GezellenView};
|
|
@@ -1 +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"./api-
|
|
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"./api-CmrgM5Rf.js";import{n as i,t as a}from"./relative-time-B2kBaekd.js";var o=e(t(),1),s=n();function c(e){return e.mode===`overridden`?`Content source: developer override (GEZEL_GILDE_DATA_DIR)`:e.mode===`live`&&e.activeVersion?`Content: ${e.activeVersion} (app shipped with ${e.bundledVersion})`:`Content: ${e.bundledVersion} (bundled with the app)`}function l(e){let t=i(e.at);switch(e.outcome){case`up-to-date`:return`checked ${t} — up to date`;case`updated`:return`updated to ${e.version??`?`} ${t}`;case`incompatible`:return`checked ${t} — ${e.version??`a newer version`} needs an app update first`;case`error`:return`check failed ${t} — ${e.message??`unknown error`}`;case`blocked`:return`not checked (${e.message??`blocked`})`}}function u(){let[e,t]=(0,o.useState)(!1),[n,i]=(0,o.useState)(null),[u,d]=(0,o.useState)(null),f=(0,o.useRef)(null),p=(0,o.useCallback)(async()=>{try{let e=await r.getGildeUpdateStatus();return i(e),t(e.enabled),e}catch{return null}},[]),m=(0,o.useCallback)(()=>{if(f.current!==null)return;let e=60,t=async()=>{f.current=null;let n=await p();--e,n?.updateInProgress&&e>0&&(f.current=window.setTimeout(()=>void t(),2e3))};f.current=window.setTimeout(()=>void t(),2e3)},[p]);(0,o.useEffect)(()=>(p(),()=>{f.current!==null&&window.clearTimeout(f.current)}),[p]);let h=(0,o.useCallback)(async n=>{let i=e;t(n),d(null);try{await r.updateConfig({gildeUpdates:{enabled:n}}),n?m():p()}catch(e){t(i),d(e instanceof Error?e.message:String(e))}},[e,m,p]),g=(0,o.useCallback)(async()=>{d(null);try{await r.checkGildeUpdates(),i(e=>e&&{...e,updateInProgress:!0}),m()}catch(e){d(e instanceof Error?e.message:String(e))}},[m]),_=n?.mode===`overridden`||n?.updateInProgress===!0;return(0,s.jsxs)(`section`,{style:{marginBottom:`2rem`},children:[(0,s.jsx)(`h3`,{children:`Catalog content`}),(0,s.jsx)(`p`,{className:`muted`,style:{marginTop:0},children:`Craftbooks, model recommendations, and role templates ship with the app and can also update between releases. When on, Gezel checks about once a day for newer content, verifies it, and applies it. Nothing about you or this install is sent. Turning it off returns to the content that shipped with the app.`}),(0,s.jsxs)(`label`,{className:`debug-toggle`,children:[(0,s.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>void h(e.target.checked)}),(0,s.jsx)(`span`,{children:`Keep catalog content up to date automatically`})]}),(0,s.jsxs)(`div`,{className:`new-row`,style:{marginTop:`0.75rem`,alignItems:`flex-start`,flexDirection:`column`,gap:`0.5rem`},children:[(0,s.jsxs)(`span`,{className:`muted small`,title:n?.lastCheck?a(n.lastCheck.at):void 0,children:[n?c(n):`loading…`,n?.updateInProgress?` · checking…`:n?.lastCheck?` · ${l(n.lastCheck)}`:``]}),e&&(0,s.jsx)(`button`,{type:`button`,onClick:()=>void g(),disabled:_,children:`Check now`})]}),u&&(0,s.jsx)(`p`,{className:`error small`,children:u})]})}export{u as GildeUpdatesCard};
|
|
@@ -1 +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"./api-
|
|
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"./api-CmrgM5Rf.js";import{H as i,J as a,K as o,W as s,Y as c,q as l}from"./primitives-CWrGZpPI.js";var u=e(t(),1),d=n();function f({onClose:e,onSignedIn:t}){let[n,f]=(0,u.useState)({kind:`starting`}),[m,h]=(0,u.useState)(!1),g=(0,u.useRef)({cancelled:!1});(0,u.useEffect)(()=>{let e=g.current;return(async()=>{try{let n=await r.startGitHubLogin();if(e.cancelled)return;f({kind:`awaiting`,start:n,status:`Waiting for you to authorize on GitHub…`});let i=n.interval,a=Date.now()+n.expiresIn*1e3;for(;!e.cancelled;){if(await p(i*1e3),e.cancelled)return;if(Date.now()>a){f({kind:`expired`});return}let o;try{o=await r.pollGitHubLogin(n.deviceCode)}catch(e){let t=e instanceof Error?e.message:String(e);f({kind:`error`,message:t});return}if(e.cancelled)return;if(o.status===`success`){t(o.identity);return}if(o.status===`expired`){f({kind:`expired`});return}if(o.status===`denied`){f({kind:`denied`,...o.error?{message:o.error}:{}});return}if(o.status===`not_configured`){f({kind:`error`,message:o.error});return}o.status===`slow_down`&&(i+=5)}}catch(t){if(e.cancelled)return;let n=t instanceof Error?t.message:String(t);f({kind:`error`,message:n})}})(),()=>{e.cancelled=!0}},[t]);let _=(0,u.useCallback)(async()=>{if(n.kind===`awaiting`)try{await navigator.clipboard.writeText(n.start.userCode),h(!0),setTimeout(()=>h(!1),1500)}catch{}},[n]),v=(0,u.useCallback)(()=>{n.kind===`awaiting`&&window.open(n.start.verificationUri,`_blank`,`noopener,noreferrer`)},[n]);return(0,d.jsx)(a,{open:!0,onOpenChange:t=>!t&&e(),children:(0,d.jsxs)(l,{children:[(0,d.jsx)(o,{}),(0,d.jsxs)(s,{children:[(0,d.jsx)(c,{asChild:!0,children:(0,d.jsx)(`h3`,{children:`Sign in to GitHub`})}),n.kind===`starting`&&(0,d.jsx)(`p`,{className:`muted`,children:`Starting sign-in…`}),n.kind===`awaiting`&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`p`,{className:`muted small`,children:`Open GitHub, paste the code below, and authorize Gezel. We'll detect when you're signed in and close this dialog automatically.`}),(0,d.jsxs)(`div`,{className:`gz-github-device-code`,children:[(0,d.jsx)(`code`,{children:n.start.userCode}),(0,d.jsx)(`button`,{type:`button`,onClick:()=>void _(),children:m?`Copied`:`Copy`})]}),(0,d.jsxs)(`div`,{className:`gz-github-device-actions`,children:[(0,d.jsx)(`button`,{type:`button`,className:`primary`,onClick:v,children:`Open GitHub`}),(0,d.jsx)(`span`,{className:`muted small`,children:n.status})]})]}),n.kind===`expired`&&(0,d.jsx)(`p`,{className:`error small`,children:`Sign-in code expired. Close and try again.`}),n.kind===`denied`&&(0,d.jsxs)(`p`,{className:`error small`,children:[`Sign-in was denied`,n.message?`: ${n.message}`:``,`.`]}),n.kind===`error`&&(0,d.jsx)(`p`,{className:`error small`,children:n.message}),(0,d.jsx)(i,{children:(0,d.jsx)(`button`,{type:`button`,onClick:e,children:n.kind===`awaiting`?`Cancel`:`Close`})})]})]})})}function p(e){return new Promise(t=>setTimeout(t,e))}function m({onChange:e,compact:t=!1}){let[n,i]=(0,u.useState)({kind:`loading`}),[a,o]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),l=(0,u.useCallback)(async()=>{try{let t=await r.getGitHubIdentity();if(t.signedIn){let n={login:t.login,...t.name?{name:t.name}:{},...t.avatarUrl?{avatarUrl:t.avatarUrl}:{}};i({kind:`signed-in`,identity:n}),e?.(n)}else i({kind:`signed-out`}),e?.(null)}catch(t){let n=t instanceof Error?t.message:String(t);i({kind:`error`,message:n}),e?.(null)}},[e]);(0,u.useEffect)(()=>{l()},[l]);let p=(0,u.useCallback)(t=>{i({kind:`signed-in`,identity:t}),e?.(t),o(!1)},[e]),m=(0,u.useCallback)(async()=>{c(!1);try{await r.gitHubLogout()}finally{i({kind:`signed-out`}),e?.(null)}},[e]),h=`gz-github-chip${t?` compact`:``}`;if(n.kind===`loading`)return(0,d.jsx)(`span`,{className:`${h} muted`,children:`…`});if(n.kind===`error`)return(0,d.jsx)(`button`,{type:`button`,className:`${h} signed-out`,title:n.message,onClick:()=>void l(),children:`retry`});if(n.kind===`signed-out`)return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,className:`${h} signed-out`,onClick:()=>o(!0),title:`Sign in to GitHub`,children:`Sign in`}),a&&(0,d.jsx)(f,{onClose:()=>o(!1),onSignedIn:p})]});let{identity:g}=n;return(0,d.jsxs)(`span`,{className:`${h} signed-in`,children:[(0,d.jsxs)(`button`,{type:`button`,className:`gz-github-chip-id`,onClick:()=>c(e=>!e),title:g.name??g.login,children:[g.avatarUrl?(0,d.jsx)(`img`,{src:g.avatarUrl,alt:``,className:`gz-github-chip-avatar`}):null,(0,d.jsxs)(`span`,{children:[`@`,g.login]})]}),s&&(0,d.jsx)(`span`,{className:`gz-github-chip-menu`,role:`menu`,children:(0,d.jsx)(`button`,{type:`button`,onClick:()=>void m(),children:`Sign out`})})]})}export{m as t};
|
package/dist/ui/assets/{HandboekMediaProvider-ByJ4NAzz.js → HandboekMediaProvider-D0zcbbpf.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./react-dom-OL4w_gzs.js";import{t as i}from"./poppetje-CfaAvFkE.js";var a=t((e=>{var t=n(),i=r();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var o=Symbol.for(`react.transitional.element`),s=Symbol.for(`react.portal`),c=Symbol.for(`react.fragment`),l=Symbol.for(`react.strict_mode`),u=Symbol.for(`react.profiler`),d=Symbol.for(`react.consumer`),f=Symbol.for(`react.context`),p=Symbol.for(`react.forward_ref`),m=Symbol.for(`react.suspense`),h=Symbol.for(`react.suspense_list`),g=Symbol.for(`react.memo`),_=Symbol.for(`react.lazy`),v=Symbol.for(`react.scope`),y=Symbol.for(`react.activity`),b=Symbol.for(`react.legacy_hidden`),x=Symbol.for(`react.memo_cache_sentinel`),S=Symbol.for(`react.view_transition`),C=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=C&&e[C]||e[`@@iterator`],typeof e==`function`?e:null)}var w=Array.isArray;function T(e,t){var n=e.length&3,r=e.length-n,i=t;for(t=0;t<r;){var a=e.charCodeAt(t)&255|(e.charCodeAt(++t)&255)<<8|(e.charCodeAt(++t)&255)<<16|(e.charCodeAt(++t)&255)<<24;++t,a=3432918353*(a&65535)+((3432918353*(a>>>16)&65535)<<16)&4294967295,a=a<<15|a>>>17,a=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)&4294967295,i^=a,i=i<<13|i>>>19,i=5*(i&65535)+((5*(i>>>16)&65535)<<16)&4294967295,i=(i&65535)+27492+(((i>>>16)+58964&65535)<<16)}switch(a=0,n){case 3:a^=(e.charCodeAt(t+2)&255)<<16;case 2:a^=(e.charCodeAt(t+1)&255)<<8;case 1:a^=e.charCodeAt(t)&255,a=3432918353*(a&65535)+((3432918353*(a>>>16)&65535)<<16)&4294967295,a=a<<15|a>>>17,i^=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)&4294967295}return i^=e.length,i^=i>>>16,i=2246822507*(i&65535)+((2246822507*(i>>>16)&65535)<<16)&4294967295,i^=i>>>13,i=3266489909*(i&65535)+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^i>>>16)>>>0}var E=Object.assign,D=Object.prototype.hasOwnProperty,O=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),k={},A={};function te(e){return D.call(A,e)?!0:D.call(k,e)?!1:O.test(e)?A[e]=!0:(k[e]=!0,!1)}var j=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `)),M=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),N=/["'&<>]/;function P(e){if(typeof e==`boolean`||typeof e==`number`||typeof e==`bigint`)return``+e;e=``+e;var t=N.exec(e);if(t){var n=``,r,i=0;for(r=t.index;r<e.length;r++){switch(e.charCodeAt(r)){case 34:t=`"`;break;case 38:t=`&`;break;case 39:t=`'`;break;case 60:t=`<`;break;case 62:t=`>`;break;default:continue}i!==r&&(n+=e.slice(i,r)),i=r+1,n+=t}e=i===r?n:n+e.slice(i,r)}return e}var ne=/([A-Z])/g,re=/^ms-/,F=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function I(e){return F.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}var ie=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},R=ae.d;ae.d={f:R.f,r:R.r,D:it,C:at,L:ot,m:st,X:lt,S:ct,M:ut};var oe=[],se=null,ce=/(<\/|<)(s)(cript)/gi;function le(e,t,n,r){return``+t+(n===`s`?`\\u0073`:`\\u0053`)+r}function ue(e,t,n,r,i){return{idPrefix:e===void 0?``:e,nextFormID:0,streamingFormat:0,bootstrapScriptContent:n,bootstrapScripts:r,bootstrapModules:i,instructions:0,hasBody:!1,hasHtml:!1,unknownResources:{},dnsResources:{},connectResources:{default:{},anonymous:{},credentials:{}},imageResources:{},styleResources:{},scriptResources:{},moduleUnknownResources:{},moduleScriptResources:{}}}function z(e,t,n,r){return{insertionMode:e,selectedValue:t,tagScope:n,viewTransition:r}}function de(e,t,n){var r=e.tagScope&-25;switch(t){case`noscript`:return z(2,null,r|1,null);case`select`:return z(2,n.value==null?n.defaultValue:n.value,r,null);case`svg`:return z(4,null,r,null);case`picture`:return z(2,null,r|2,null);case`math`:return z(5,null,r,null);case`foreignObject`:return z(2,null,r,null);case`table`:return z(6,null,r,null);case`thead`:case`tbody`:case`tfoot`:return z(7,null,r,null);case`colgroup`:return z(9,null,r,null);case`tr`:return z(8,null,r,null);case`head`:if(2>e.insertionMode)return z(3,null,r,null);break;case`html`:if(e.insertionMode===0)return z(1,null,r,null)}return 6<=e.insertionMode||2>e.insertionMode?z(2,null,r,null):e.tagScope===r?e:z(e.insertionMode,e.selectedValue,r,null)}function B(e){return e===null?null:{update:e.update,enter:`none`,exit:`none`,share:e.update,name:e.autoName,autoName:e.autoName,nameIdx:0}}function fe(e,t){return t.tagScope&32&&(e.instructions|=128),z(t.insertionMode,t.selectedValue,t.tagScope|12,B(t.viewTransition))}function pe(e,t){e=B(t.viewTransition);var n=t.tagScope|16;return e!==null&&e.share!==`none`&&(n|=64),z(t.insertionMode,t.selectedValue,n,e)}var me=new Map;function he(e,t){if(typeof t!=`object`)throw Error(a(62));var n=!0,r;for(r in t)if(D.call(t,r)){var i=t[r];if(i!=null&&typeof i!=`boolean`&&i!==``){if(r.indexOf(`--`)===0){var o=P(r);i=P((``+i).trim())}else o=me.get(r),o===void 0&&(o=P(r.replace(ne,`-$1`).toLowerCase().replace(re,`-ms-`)),me.set(r,o)),i=typeof i==`number`?i===0||j.has(r)?``+i:i+`px`:P((``+i).trim());n?(n=!1,e.push(` style="`,o,`:`,i)):e.push(`;`,o,`:`,i)}}n||e.push(`"`)}function ge(e,t,n){n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`=""`)}function _e(e,t,n){typeof n!=`function`&&typeof n!=`symbol`&&typeof n!=`boolean`&&e.push(` `,t,`="`,P(n),`"`)}var ve=P(`javascript:throw new Error('React form unexpectedly submitted.')`);function ye(e,t){this.push(`<input type="hidden"`),be(e),_e(this,`name`,t),_e(this,`value`,e),this.push(`/>`)}function be(e){if(typeof e!=`string`)throw Error(a(480))}function xe(e,t){if(typeof t.$$FORM_ACTION==`function`){var n=e.nextFormID++;e=e.idPrefix+n;try{var r=t.$$FORM_ACTION(e);return r&&r.data?.forEach(be),r}catch(e){if(typeof e==`object`&&e&&typeof e.then==`function`)throw e}}return null}function Se(e,t,n,r,i,a,o,s){var c=null;if(typeof r==`function`){var l=xe(t,r);l===null?(e.push(` `,`formAction`,`="`,ve,`"`),o=a=i=r=s=null,Te(t,n)):(s=l.name,r=l.action||``,i=l.encType,a=l.method,o=l.target,c=l.data)}return s!=null&&V(e,`name`,s),r!=null&&V(e,`formAction`,r),i!=null&&V(e,`formEncType`,i),a!=null&&V(e,`formMethod`,a),o!=null&&V(e,`formTarget`,o),c}function V(e,t,n){switch(t){case`className`:_e(e,`class`,n);break;case`tabIndex`:_e(e,`tabindex`,n);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:_e(e,t,n);break;case`style`:he(e,n);break;case`src`:case`href`:if(n===``)break;case`action`:case`formAction`:if(n==null||typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,t,`="`,P(n),`"`);break;case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`ref`:break;case`autoFocus`:case`multiple`:case`muted`:ge(e,t.toLowerCase(),n);break;case`xlinkHref`:if(typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,`xlink:href`,`="`,P(n),`"`);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`=""`);break;case`capture`:case`download`:!0===n?e.push(` `,t,`=""`):!1!==n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`cols`:case`rows`:case`size`:case`span`:typeof n!=`function`&&typeof n!=`symbol`&&!isNaN(n)&&1<=n&&e.push(` `,t,`="`,P(n),`"`);break;case`rowSpan`:case`start`:typeof n==`function`||typeof n==`symbol`||isNaN(n)||e.push(` `,t,`="`,P(n),`"`);break;case`xlinkActuate`:_e(e,`xlink:actuate`,n);break;case`xlinkArcrole`:_e(e,`xlink:arcrole`,n);break;case`xlinkRole`:_e(e,`xlink:role`,n);break;case`xlinkShow`:_e(e,`xlink:show`,n);break;case`xlinkTitle`:_e(e,`xlink:title`,n);break;case`xlinkType`:_e(e,`xlink:type`,n);break;case`xmlBase`:_e(e,`xml:base`,n);break;case`xmlLang`:_e(e,`xml:lang`,n);break;case`xmlSpace`:_e(e,`xml:space`,n);break;default:if((!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`)&&(t=M.get(t)||t,te(t))){switch(typeof n){case`function`:case`symbol`:return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`)return}e.push(` `,t,`="`,P(n),`"`)}}}function Ce(e,t,n){if(t!=null){if(n!=null)throw Error(a(60));if(typeof t!=`object`||!(`__html`in t))throw Error(a(61));t=t.__html,t!=null&&e.push(``+t)}}function we(e){var n=``;return t.Children.forEach(e,function(e){e!=null&&(n+=e)}),n}function Te(e,t){if(!(e.instructions&16)){e.instructions|=16;var n=t.preamble,r=t.bootstrapChunks;(n.htmlChunks||n.headChunks)&&r.length===0?(r.push(t.startInlineScript),nt(r,e),r.push(`>`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,`<\/script>`)):r.unshift(t.startInlineScript,`>`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,`<\/script>`)}}function Ee(e,t){for(var n in e.push(H(`link`)),t)if(D.call(t,n)){var r=t[n];if(r!=null)switch(n){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,`link`));default:V(e,n,r)}}return e.push(`/>`),null}var De=/(<\/|<)(s)(tyle)/gi;function Oe(e,t,n,r){return``+t+(n===`s`?`\\73 `:`\\53 `)+r}function ke(e,t,n){for(var r in e.push(H(n)),t)if(D.call(t,r)){var i=t[r];if(i!=null)switch(r){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,n));default:V(e,r,i)}}return e.push(`/>`),null}function Ae(e,t){e.push(H(`title`));var n=null,r=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),t=Array.isArray(n)?2>n.length?n[0]:null:n,typeof t!=`function`&&typeof t!=`symbol`&&t!=null&&e.push(P(``+t)),Ce(e,r,n),e.push(Le(`title`)),null}function je(e,t){e.push(H(`script`));var n=null,r=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),typeof n==`string`&&e.push((``+n).replace(ce,le)),e.push(Le(`script`)),null}function Me(e,t,n){e.push(H(n));var r=n=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),n}function Ne(e,t,n){e.push(H(n));var r=n=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),typeof n==`string`?(e.push(P(n)),null):n}var Pe=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Fe=new Map;function H(e){var t=Fe.get(e);if(t===void 0){if(!Pe.test(e))throw Error(a(65,e));t=`<`+e,Fe.set(e,t)}return t}function U(e,t,n,r,i,o,s,c,l){switch(t){case`div`:case`span`:case`svg`:case`path`:break;case`a`:e.push(H(`a`));var u=null,d=null,f;for(f in n)if(D.call(n,f)){var p=n[f];if(p!=null)switch(f){case`children`:u=p;break;case`dangerouslySetInnerHTML`:d=p;break;case`href`:p===``?_e(e,`href`,``):V(e,f,p);break;default:V(e,f,p)}}if(e.push(`>`),Ce(e,d,u),typeof u==`string`){e.push(P(u));var m=null}else m=u;return m;case`g`:case`p`:case`li`:break;case`select`:e.push(H(`select`));var h=null,g=null,_;for(_ in n)if(D.call(n,_)){var v=n[_];if(v!=null)switch(_){case`children`:h=v;break;case`dangerouslySetInnerHTML`:g=v;break;case`defaultValue`:case`value`:break;default:V(e,_,v)}}return e.push(`>`),Ce(e,g,h),h;case`option`:var y=c.selectedValue;e.push(H(`option`));var b=null,x=null,S=null,C=null,ee;for(ee in n)if(D.call(n,ee)){var T=n[ee];if(T!=null)switch(ee){case`children`:b=T;break;case`selected`:S=T;break;case`dangerouslySetInnerHTML`:C=T;break;case`value`:x=T;default:V(e,ee,T)}}if(y!=null){var O=x===null?we(b):``+x;if(w(y)){for(var k=0;k<y.length;k++)if(``+y[k]===O){e.push(` selected=""`);break}}else``+y===O&&e.push(` selected=""`)}else S&&e.push(` selected=""`);return e.push(`>`),Ce(e,C,b),b;case`textarea`:e.push(H(`textarea`));var A=null,j=null,M=null,N;for(N in n)if(D.call(n,N)){var ne=n[N];if(ne!=null)switch(N){case`children`:M=ne;break;case`value`:A=ne;break;case`defaultValue`:j=ne;break;case`dangerouslySetInnerHTML`:throw Error(a(91));default:V(e,N,ne)}}if(A===null&&j!==null&&(A=j),e.push(`>`),M!=null){if(A!=null)throw Error(a(92));if(w(M)){if(1<M.length)throw Error(a(93));A=``+M[0]}A=``+M}return typeof A==`string`&&A[0]===`
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./react-dom-OL4w_gzs.js";import{t as i}from"./poppetje-DvCJO36y.js";var a=t((e=>{var t=n(),i=r();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var o=Symbol.for(`react.transitional.element`),s=Symbol.for(`react.portal`),c=Symbol.for(`react.fragment`),l=Symbol.for(`react.strict_mode`),u=Symbol.for(`react.profiler`),d=Symbol.for(`react.consumer`),f=Symbol.for(`react.context`),p=Symbol.for(`react.forward_ref`),m=Symbol.for(`react.suspense`),h=Symbol.for(`react.suspense_list`),g=Symbol.for(`react.memo`),_=Symbol.for(`react.lazy`),v=Symbol.for(`react.scope`),y=Symbol.for(`react.activity`),b=Symbol.for(`react.legacy_hidden`),x=Symbol.for(`react.memo_cache_sentinel`),S=Symbol.for(`react.view_transition`),C=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=C&&e[C]||e[`@@iterator`],typeof e==`function`?e:null)}var w=Array.isArray;function T(e,t){var n=e.length&3,r=e.length-n,i=t;for(t=0;t<r;){var a=e.charCodeAt(t)&255|(e.charCodeAt(++t)&255)<<8|(e.charCodeAt(++t)&255)<<16|(e.charCodeAt(++t)&255)<<24;++t,a=3432918353*(a&65535)+((3432918353*(a>>>16)&65535)<<16)&4294967295,a=a<<15|a>>>17,a=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)&4294967295,i^=a,i=i<<13|i>>>19,i=5*(i&65535)+((5*(i>>>16)&65535)<<16)&4294967295,i=(i&65535)+27492+(((i>>>16)+58964&65535)<<16)}switch(a=0,n){case 3:a^=(e.charCodeAt(t+2)&255)<<16;case 2:a^=(e.charCodeAt(t+1)&255)<<8;case 1:a^=e.charCodeAt(t)&255,a=3432918353*(a&65535)+((3432918353*(a>>>16)&65535)<<16)&4294967295,a=a<<15|a>>>17,i^=461845907*(a&65535)+((461845907*(a>>>16)&65535)<<16)&4294967295}return i^=e.length,i^=i>>>16,i=2246822507*(i&65535)+((2246822507*(i>>>16)&65535)<<16)&4294967295,i^=i>>>13,i=3266489909*(i&65535)+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^i>>>16)>>>0}var E=Object.assign,D=Object.prototype.hasOwnProperty,O=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),k={},A={};function te(e){return D.call(A,e)?!0:D.call(k,e)?!1:O.test(e)?A[e]=!0:(k[e]=!0,!1)}var j=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `)),M=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),N=/["'&<>]/;function P(e){if(typeof e==`boolean`||typeof e==`number`||typeof e==`bigint`)return``+e;e=``+e;var t=N.exec(e);if(t){var n=``,r,i=0;for(r=t.index;r<e.length;r++){switch(e.charCodeAt(r)){case 34:t=`"`;break;case 38:t=`&`;break;case 39:t=`'`;break;case 60:t=`<`;break;case 62:t=`>`;break;default:continue}i!==r&&(n+=e.slice(i,r)),i=r+1,n+=t}e=i===r?n:n+e.slice(i,r)}return e}var ne=/([A-Z])/g,re=/^ms-/,F=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function I(e){return F.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}var ie=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},R=ae.d;ae.d={f:R.f,r:R.r,D:it,C:at,L:ot,m:st,X:lt,S:ct,M:ut};var oe=[],se=null,ce=/(<\/|<)(s)(cript)/gi;function le(e,t,n,r){return``+t+(n===`s`?`\\u0073`:`\\u0053`)+r}function ue(e,t,n,r,i){return{idPrefix:e===void 0?``:e,nextFormID:0,streamingFormat:0,bootstrapScriptContent:n,bootstrapScripts:r,bootstrapModules:i,instructions:0,hasBody:!1,hasHtml:!1,unknownResources:{},dnsResources:{},connectResources:{default:{},anonymous:{},credentials:{}},imageResources:{},styleResources:{},scriptResources:{},moduleUnknownResources:{},moduleScriptResources:{}}}function z(e,t,n,r){return{insertionMode:e,selectedValue:t,tagScope:n,viewTransition:r}}function de(e,t,n){var r=e.tagScope&-25;switch(t){case`noscript`:return z(2,null,r|1,null);case`select`:return z(2,n.value==null?n.defaultValue:n.value,r,null);case`svg`:return z(4,null,r,null);case`picture`:return z(2,null,r|2,null);case`math`:return z(5,null,r,null);case`foreignObject`:return z(2,null,r,null);case`table`:return z(6,null,r,null);case`thead`:case`tbody`:case`tfoot`:return z(7,null,r,null);case`colgroup`:return z(9,null,r,null);case`tr`:return z(8,null,r,null);case`head`:if(2>e.insertionMode)return z(3,null,r,null);break;case`html`:if(e.insertionMode===0)return z(1,null,r,null)}return 6<=e.insertionMode||2>e.insertionMode?z(2,null,r,null):e.tagScope===r?e:z(e.insertionMode,e.selectedValue,r,null)}function B(e){return e===null?null:{update:e.update,enter:`none`,exit:`none`,share:e.update,name:e.autoName,autoName:e.autoName,nameIdx:0}}function fe(e,t){return t.tagScope&32&&(e.instructions|=128),z(t.insertionMode,t.selectedValue,t.tagScope|12,B(t.viewTransition))}function pe(e,t){e=B(t.viewTransition);var n=t.tagScope|16;return e!==null&&e.share!==`none`&&(n|=64),z(t.insertionMode,t.selectedValue,n,e)}var me=new Map;function he(e,t){if(typeof t!=`object`)throw Error(a(62));var n=!0,r;for(r in t)if(D.call(t,r)){var i=t[r];if(i!=null&&typeof i!=`boolean`&&i!==``){if(r.indexOf(`--`)===0){var o=P(r);i=P((``+i).trim())}else o=me.get(r),o===void 0&&(o=P(r.replace(ne,`-$1`).toLowerCase().replace(re,`-ms-`)),me.set(r,o)),i=typeof i==`number`?i===0||j.has(r)?``+i:i+`px`:P((``+i).trim());n?(n=!1,e.push(` style="`,o,`:`,i)):e.push(`;`,o,`:`,i)}}n||e.push(`"`)}function ge(e,t,n){n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`=""`)}function _e(e,t,n){typeof n!=`function`&&typeof n!=`symbol`&&typeof n!=`boolean`&&e.push(` `,t,`="`,P(n),`"`)}var ve=P(`javascript:throw new Error('React form unexpectedly submitted.')`);function ye(e,t){this.push(`<input type="hidden"`),be(e),_e(this,`name`,t),_e(this,`value`,e),this.push(`/>`)}function be(e){if(typeof e!=`string`)throw Error(a(480))}function xe(e,t){if(typeof t.$$FORM_ACTION==`function`){var n=e.nextFormID++;e=e.idPrefix+n;try{var r=t.$$FORM_ACTION(e);return r&&r.data?.forEach(be),r}catch(e){if(typeof e==`object`&&e&&typeof e.then==`function`)throw e}}return null}function Se(e,t,n,r,i,a,o,s){var c=null;if(typeof r==`function`){var l=xe(t,r);l===null?(e.push(` `,`formAction`,`="`,ve,`"`),o=a=i=r=s=null,Te(t,n)):(s=l.name,r=l.action||``,i=l.encType,a=l.method,o=l.target,c=l.data)}return s!=null&&V(e,`name`,s),r!=null&&V(e,`formAction`,r),i!=null&&V(e,`formEncType`,i),a!=null&&V(e,`formMethod`,a),o!=null&&V(e,`formTarget`,o),c}function V(e,t,n){switch(t){case`className`:_e(e,`class`,n);break;case`tabIndex`:_e(e,`tabindex`,n);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:_e(e,t,n);break;case`style`:he(e,n);break;case`src`:case`href`:if(n===``)break;case`action`:case`formAction`:if(n==null||typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,t,`="`,P(n),`"`);break;case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`ref`:break;case`autoFocus`:case`multiple`:case`muted`:ge(e,t.toLowerCase(),n);break;case`xlinkHref`:if(typeof n==`function`||typeof n==`symbol`||typeof n==`boolean`)break;n=I(``+n),e.push(` `,`xlink:href`,`="`,P(n),`"`);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`=""`);break;case`capture`:case`download`:!0===n?e.push(` `,t,`=""`):!1!==n&&typeof n!=`function`&&typeof n!=`symbol`&&e.push(` `,t,`="`,P(n),`"`);break;case`cols`:case`rows`:case`size`:case`span`:typeof n!=`function`&&typeof n!=`symbol`&&!isNaN(n)&&1<=n&&e.push(` `,t,`="`,P(n),`"`);break;case`rowSpan`:case`start`:typeof n==`function`||typeof n==`symbol`||isNaN(n)||e.push(` `,t,`="`,P(n),`"`);break;case`xlinkActuate`:_e(e,`xlink:actuate`,n);break;case`xlinkArcrole`:_e(e,`xlink:arcrole`,n);break;case`xlinkRole`:_e(e,`xlink:role`,n);break;case`xlinkShow`:_e(e,`xlink:show`,n);break;case`xlinkTitle`:_e(e,`xlink:title`,n);break;case`xlinkType`:_e(e,`xlink:type`,n);break;case`xmlBase`:_e(e,`xml:base`,n);break;case`xmlLang`:_e(e,`xml:lang`,n);break;case`xmlSpace`:_e(e,`xml:space`,n);break;default:if((!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`)&&(t=M.get(t)||t,te(t))){switch(typeof n){case`function`:case`symbol`:return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`)return}e.push(` `,t,`="`,P(n),`"`)}}}function Ce(e,t,n){if(t!=null){if(n!=null)throw Error(a(60));if(typeof t!=`object`||!(`__html`in t))throw Error(a(61));t=t.__html,t!=null&&e.push(``+t)}}function we(e){var n=``;return t.Children.forEach(e,function(e){e!=null&&(n+=e)}),n}function Te(e,t){if(!(e.instructions&16)){e.instructions|=16;var n=t.preamble,r=t.bootstrapChunks;(n.htmlChunks||n.headChunks)&&r.length===0?(r.push(t.startInlineScript),nt(r,e),r.push(`>`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,`<\/script>`)):r.unshift(t.startInlineScript,`>`,`addEventListener("submit",function(a){if(!a.defaultPrevented){var c=a.target,d=a.submitter,e=c.action,b=d;if(d){var f=d.getAttribute("formAction");null!=f&&(e=f,b=null)}"javascript:throw new Error('React form unexpectedly submitted.')"===e&&(a.preventDefault(),b?(a=document.createElement("input"),a.name=b.name,a.value=b.value,b.parentNode.insertBefore(a,b),b=new FormData(c),a.parentNode.removeChild(a)):b=new FormData(c),a=c.ownerDocument||c,(a.$$reactFormReplay=a.$$reactFormReplay||[]).push(c,d,b))}});`,`<\/script>`)}}function Ee(e,t){for(var n in e.push(H(`link`)),t)if(D.call(t,n)){var r=t[n];if(r!=null)switch(n){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,`link`));default:V(e,n,r)}}return e.push(`/>`),null}var De=/(<\/|<)(s)(tyle)/gi;function Oe(e,t,n,r){return``+t+(n===`s`?`\\73 `:`\\53 `)+r}function ke(e,t,n){for(var r in e.push(H(n)),t)if(D.call(t,r)){var i=t[r];if(i!=null)switch(r){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,n));default:V(e,r,i)}}return e.push(`/>`),null}function Ae(e,t){e.push(H(`title`));var n=null,r=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),t=Array.isArray(n)?2>n.length?n[0]:null:n,typeof t!=`function`&&typeof t!=`symbol`&&t!=null&&e.push(P(``+t)),Ce(e,r,n),e.push(Le(`title`)),null}function je(e,t){e.push(H(`script`));var n=null,r=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),typeof n==`string`&&e.push((``+n).replace(ce,le)),e.push(Le(`script`)),null}function Me(e,t,n){e.push(H(n));var r=n=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),n}function Ne(e,t,n){e.push(H(n));var r=n=null,i;for(i in t)if(D.call(t,i)){var a=t[i];if(a!=null)switch(i){case`children`:n=a;break;case`dangerouslySetInnerHTML`:r=a;break;default:V(e,i,a)}}return e.push(`>`),Ce(e,r,n),typeof n==`string`?(e.push(P(n)),null):n}var Pe=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Fe=new Map;function H(e){var t=Fe.get(e);if(t===void 0){if(!Pe.test(e))throw Error(a(65,e));t=`<`+e,Fe.set(e,t)}return t}function U(e,t,n,r,i,o,s,c,l){switch(t){case`div`:case`span`:case`svg`:case`path`:break;case`a`:e.push(H(`a`));var u=null,d=null,f;for(f in n)if(D.call(n,f)){var p=n[f];if(p!=null)switch(f){case`children`:u=p;break;case`dangerouslySetInnerHTML`:d=p;break;case`href`:p===``?_e(e,`href`,``):V(e,f,p);break;default:V(e,f,p)}}if(e.push(`>`),Ce(e,d,u),typeof u==`string`){e.push(P(u));var m=null}else m=u;return m;case`g`:case`p`:case`li`:break;case`select`:e.push(H(`select`));var h=null,g=null,_;for(_ in n)if(D.call(n,_)){var v=n[_];if(v!=null)switch(_){case`children`:h=v;break;case`dangerouslySetInnerHTML`:g=v;break;case`defaultValue`:case`value`:break;default:V(e,_,v)}}return e.push(`>`),Ce(e,g,h),h;case`option`:var y=c.selectedValue;e.push(H(`option`));var b=null,x=null,S=null,C=null,ee;for(ee in n)if(D.call(n,ee)){var T=n[ee];if(T!=null)switch(ee){case`children`:b=T;break;case`selected`:S=T;break;case`dangerouslySetInnerHTML`:C=T;break;case`value`:x=T;default:V(e,ee,T)}}if(y!=null){var O=x===null?we(b):``+x;if(w(y)){for(var k=0;k<y.length;k++)if(``+y[k]===O){e.push(` selected=""`);break}}else``+y===O&&e.push(` selected=""`)}else S&&e.push(` selected=""`);return e.push(`>`),Ce(e,C,b),b;case`textarea`:e.push(H(`textarea`));var A=null,j=null,M=null,N;for(N in n)if(D.call(n,N)){var ne=n[N];if(ne!=null)switch(N){case`children`:M=ne;break;case`value`:A=ne;break;case`defaultValue`:j=ne;break;case`dangerouslySetInnerHTML`:throw Error(a(91));default:V(e,N,ne)}}if(A===null&&j!==null&&(A=j),e.push(`>`),M!=null){if(A!=null)throw Error(a(92));if(w(M)){if(1<M.length)throw Error(a(93));A=``+M[0]}A=``+M}return typeof A==`string`&&A[0]===`
|
|
2
2
|
`&&e.push(`
|
|
3
3
|
`),A!==null&&e.push(P(``+A)),null;case`input`:e.push(H(`input`));var re=null,F=null,ie=null,ae=null,L=null,R=null,se=null,ce=null,le=null,ue;for(ue in n)if(D.call(n,ue)){var z=n[ue];if(z!=null)switch(ue){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(399,`input`));case`name`:re=z;break;case`formAction`:F=z;break;case`formEncType`:ie=z;break;case`formMethod`:ae=z;break;case`formTarget`:L=z;break;case`defaultChecked`:le=z;break;case`defaultValue`:se=z;break;case`checked`:ce=z;break;case`value`:R=z;break;default:V(e,ue,z)}}var de=Se(e,r,i,F,ie,ae,L,re);return ce===null?le!==null&&ge(e,`checked`,le):ge(e,`checked`,ce),R===null?se!==null&&V(e,`value`,se):V(e,`value`,R),e.push(`/>`),de?.forEach(ye,e),null;case`button`:e.push(H(`button`));var B=null,fe=null,pe=null,me=null,be=null,Pe=null,Fe=null,U;for(U in n)if(D.call(n,U)){var Ie=n[U];if(Ie!=null)switch(U){case`children`:B=Ie;break;case`dangerouslySetInnerHTML`:fe=Ie;break;case`name`:pe=Ie;break;case`formAction`:me=Ie;break;case`formEncType`:be=Ie;break;case`formMethod`:Pe=Ie;break;case`formTarget`:Fe=Ie;break;default:V(e,U,Ie)}}var Re=Se(e,r,i,me,be,Pe,Fe,pe);if(e.push(`>`),Re?.forEach(ye,e),Ce(e,fe,B),typeof B==`string`){e.push(P(B));var ze=null}else ze=B;return ze;case`form`:e.push(H(`form`));var Be=null,Ve=null,He=null,Ue=null,We=null,Ge=null,Ke;for(Ke in n)if(D.call(n,Ke)){var qe=n[Ke];if(qe!=null)switch(Ke){case`children`:Be=qe;break;case`dangerouslySetInnerHTML`:Ve=qe;break;case`action`:He=qe;break;case`encType`:Ue=qe;break;case`method`:We=qe;break;case`target`:Ge=qe;break;default:V(e,Ke,qe)}}var Je=null,Ye=null;if(typeof He==`function`){var W=xe(r,He);W===null?(e.push(` `,`action`,`="`,ve,`"`),Ge=We=Ue=He=null,Te(r,i)):(He=W.action||``,Ue=W.encType,We=W.method,Ge=W.target,Je=W.data,Ye=W.name)}if(He!=null&&V(e,`action`,He),Ue!=null&&V(e,`encType`,Ue),We!=null&&V(e,`method`,We),Ge!=null&&V(e,`target`,Ge),e.push(`>`),Ye!==null&&(e.push(`<input type="hidden"`),_e(e,`name`,Ye),e.push(`/>`),Je?.forEach(ye,e)),Ce(e,Ve,Be),typeof Be==`string`){e.push(P(Be));var Xe=null}else Xe=Be;return Xe;case`menuitem`:for(var Ze in e.push(H(`menuitem`)),n)if(D.call(n,Ze)){var G=n[Ze];if(G!=null)switch(Ze){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(400));default:V(e,Ze,G)}}return e.push(`>`),null;case`object`:e.push(H(`object`));var Qe=null,$e=null,et;for(et in n)if(D.call(n,et)){var tt=n[et];if(tt!=null)switch(et){case`children`:Qe=tt;break;case`dangerouslySetInnerHTML`:$e=tt;break;case`data`:var nt=I(``+tt);if(nt===``)break;e.push(` `,`data`,`="`,P(nt),`"`);break;default:V(e,et,tt)}}if(e.push(`>`),Ce(e,$e,Qe),typeof Qe==`string`){e.push(P(Qe));var rt=null}else rt=Qe;return rt;case`title`:var K=c.tagScope&1,q=c.tagScope&4;if(c.insertionMode===4||K||n.itemProp!=null)var it=Ae(e,n);else q?it=null:(Ae(i.hoistableChunks,n),it=void 0);return it;case`link`:var at=c.tagScope&1,ot=c.tagScope&4,st=n.rel,ct=n.href,lt=n.precedence;if(c.insertionMode===4||at||n.itemProp!=null||typeof st!=`string`||typeof ct!=`string`||ct===``){Ee(e,n);var ut=null}else if(n.rel===`stylesheet`)if(typeof lt!=`string`||n.disabled!=null||n.onLoad||n.onError)ut=Ee(e,n);else{var pt=i.styles.get(lt),mt=r.styleResources.hasOwnProperty(ct)?r.styleResources[ct]:void 0;if(mt!==null){r.styleResources[ct]=null,pt||(pt={precedence:P(lt),rules:[],hrefs:[],sheets:new Map},i.styles.set(lt,pt));var ht={state:0,props:E({},n,{"data-precedence":n.precedence,precedence:null})};if(mt){mt.length===2&&dt(ht.props,mt);var gt=i.preloads.stylesheets.get(ct);gt&&0<gt.length?gt.length=0:ht.state=1}pt.sheets.set(ct,ht),s&&s.stylesheets.add(ht)}else if(pt){var _t=pt.sheets.get(ct);_t&&s&&s.stylesheets.add(_t)}l&&e.push(`<!-- -->`),ut=null}else n.onLoad||n.onError?ut=Ee(e,n):(l&&e.push(`<!-- -->`),ut=ot?null:Ee(i.hoistableChunks,n));return ut;case`script`:var vt=c.tagScope&1,yt=n.async;if(typeof n.src!=`string`||!n.src||!yt||typeof yt==`function`||typeof yt==`symbol`||n.onLoad||n.onError||c.insertionMode===4||vt||n.itemProp!=null)var bt=je(e,n);else{var xt=n.src;if(n.type===`module`)var St=r.moduleScriptResources,Ct=i.preloads.moduleScripts;else St=r.scriptResources,Ct=i.preloads.scripts;var wt=St.hasOwnProperty(xt)?St[xt]:void 0;if(wt!==null){St[xt]=null;var Tt=n;if(wt){wt.length===2&&(Tt=E({},n),dt(Tt,wt));var Et=Ct.get(xt);Et&&(Et.length=0)}var Dt=[];i.scripts.add(Dt),je(Dt,Tt)}l&&e.push(`<!-- -->`),bt=null}return bt;case`style`:var Ot=c.tagScope&1,kt=n.precedence,At=n.href,jt=n.nonce;if(c.insertionMode===4||Ot||n.itemProp!=null||typeof kt!=`string`||typeof At!=`string`||At===``){e.push(H(`style`));var Mt=null,Nt=null,Pt;for(Pt in n)if(D.call(n,Pt)){var Ft=n[Pt];if(Ft!=null)switch(Pt){case`children`:Mt=Ft;break;case`dangerouslySetInnerHTML`:Nt=Ft;break;default:V(e,Pt,Ft)}}e.push(`>`);var It=Array.isArray(Mt)?2>Mt.length?Mt[0]:null:Mt;typeof It!=`function`&&typeof It!=`symbol`&&It!=null&&e.push((``+It).replace(De,Oe)),Ce(e,Nt,Mt),e.push(Le(`style`));var Lt=null}else{var Rt=i.styles.get(kt);if((r.styleResources.hasOwnProperty(At)?r.styleResources[At]:void 0)!==null){r.styleResources[At]=null,Rt||(Rt={precedence:P(kt),rules:[],hrefs:[],sheets:new Map},i.styles.set(kt,Rt));var zt=i.nonce.style;if(!zt||zt===jt){Rt.hrefs.push(P(At));var Bt=Rt.rules,J=null,Vt=null,Ht;for(Ht in n)if(D.call(n,Ht)){var Ut=n[Ht];if(Ut!=null)switch(Ht){case`children`:J=Ut;break;case`dangerouslySetInnerHTML`:Vt=Ut}}var Wt=Array.isArray(J)?2>J.length?J[0]:null:J;typeof Wt!=`function`&&typeof Wt!=`symbol`&&Wt!=null&&Bt.push((``+Wt).replace(De,Oe)),Ce(Bt,Vt,J)}}Rt&&s&&s.styles.add(Rt),l&&e.push(`<!-- -->`),Lt=void 0}return Lt;case`meta`:var Gt=c.tagScope&1,Kt=c.tagScope&4;if(c.insertionMode===4||Gt||n.itemProp!=null)var qt=ke(e,n,`meta`);else l&&e.push(`<!-- -->`),qt=Kt?null:typeof n.charSet==`string`?ke(i.charsetChunks,n,`meta`):n.name===`viewport`?ke(i.viewportChunks,n,`meta`):ke(i.hoistableChunks,n,`meta`);return qt;case`listing`:case`pre`:e.push(H(t));var Jt=null,Yt=null,Xt;for(Xt in n)if(D.call(n,Xt)){var Zt=n[Xt];if(Zt!=null)switch(Xt){case`children`:Jt=Zt;break;case`dangerouslySetInnerHTML`:Yt=Zt;break;default:V(e,Xt,Zt)}}if(e.push(`>`),Yt!=null){if(Jt!=null)throw Error(a(60));if(typeof Yt!=`object`||!(`__html`in Yt))throw Error(a(61));var Y=Yt.__html;Y!=null&&(typeof Y==`string`&&0<Y.length&&Y[0]===`
|
|
4
4
|
`?e.push(`
|
|
@@ -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"./api-CmrgM5Rf.js";import{ft as i}from"./doc-BHcGsJZd.js";import{n as a}from"./chunk-GAZKTT4R-w1SNypWQ.js";import{n as o}from"./chunk-CW24CH7I-BD0FIooX.js";import"./markdown-CLKH_zzl.js";import"./schemas-BvLZUsGm.js";import{Y as s,z as c}from"./chunk-6ECMNUIP-D5AA6ozp.js";import{n as l}from"./chunk-KGWT454C-DsQOBuLg.js";import{B as u,Ct as d,V as f,b as p,nt as m}from"./index-DivKnJyx.js";import{n as h,t as g}from"./HandboekMediaProvider-D0zcbbpf.js";var _=e(t(),1),v=n(),y=`gezel:handboek:article`;function b(){let[e,t]=(0,_.useState)(null),[n,b]=(0,_.useState)(()=>{try{return window.localStorage.getItem(y)}catch{return null}}),[C,ee]=(0,_.useState)(null),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(`doc`),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,V]=(0,_.useState)(()=>new Set),[H,U]=(0,_.useState)(``),W=(0,_.useMemo)(()=>{let t=H.trim().toLowerCase();return!t||!e?[]:e.areas.flatMap(e=>e.entries).filter(e=>e.title.toLowerCase().includes(t)||(e.summary??``).toLowerCase().includes(t))},[e,H]),G=d()===`light`?u:void 0;(0,_.useEffect)(()=>{let e=!0;return r.getAudioEngineStatus().then(t=>e&&j(t.tts.status===`ok`)).catch(()=>e&&j(!1)),()=>{e=!1}},[]),(0,_.useEffect)(()=>{let e=!0,n=m();return n&&b(n.articleId),r.getHandboekToc().then(n=>{e&&(t(n),b(e=>{let t=new Set(n.areas.flatMap(e=>e.entries.map(e=>e.id)));return e&&t.has(e)?e:n.areas[0]?.entries[0]?.id??null}))}).catch(t=>e&&T(String(t))),()=>{e=!1}},[]),(0,_.useEffect)(()=>{let e=e=>{let t=e.detail;t?.articleId&&b(t.articleId)};return window.addEventListener(`gezel:open-handboek-article`,e),()=>window.removeEventListener(`gezel:open-handboek-article`,e)},[]),(0,_.useEffect)(()=>{if(!n)return;try{window.localStorage.setItem(y,n)}catch{}let e=!0;return D(!0),T(null),r.getHandboekArticle(n).then(t=>{e&&(ee(t),k(`doc`),N(!1),F(e=>{for(let t of e?.urls??[])URL.revokeObjectURL(t);return null}))}).catch(t=>e&&T(String(t))).finally(()=>e&&D(!1)),()=>{e=!1}},[n]),(0,_.useEffect)(()=>{if(!e||!n)return;let t=e.areas.find(e=>e.entries.some(e=>e.id===n)),r=t?.entries.find(e=>e.id===n);if(!(!t||!r)&&(z(e=>{if(!e.has(t.area))return e;let n=new Set(e);return n.delete(t.area),n}),r.subcategory)){let e=S(t.area,r.subcategory.id);V(t=>t.has(e)?t:new Set(t).add(e))}},[e,n]);let K=(0,_.useMemo)(()=>C?g(C.figures):null,[C]),q=(0,_.useRef)(K);(0,_.useEffect)(()=>(q.current=K,()=>q.current?.dispose?.()),[K]);let J=(0,_.useMemo)(()=>{if(!C)return null;try{return i(o(h(C.markdown)),{articleId:C.id,defaultDuration:C.defaultDuration??6})}catch{return null}},[C]),Y=(0,_.useMemo)(()=>{if(!J||J.audio.segments.length>0)return J;let e=a(J);return e<=0?J:{...J,audio:{segments:[{src:``,name:`synthetic`,duration:e,startTime:0}]}}},[J]),X=(0,_.useCallback)(()=>{if(M){N(!1);return}if(P&&P.articleId===C?.id){N(!0);return}!C||I||(L(!0),(async()=>{let e=await r.getHandboekNarration(C.id),t=await Promise.all(e.segments.map(e=>r.fetchHandboekNarrationAudio(e.hash)));return{articleId:C.id,urls:t.map(e=>URL.createObjectURL(e)),durationsMs:e.segments.map(e=>e.durationMs)}})().then(e=>{F(e),N(!0)}).catch(e=>T(`Narration unavailable: ${String(e)}`)).finally(()=>L(!1)))},[M,P,C,I]),Z=(0,_.useMemo)(()=>{if(!J||!M||!P||P.articleId!==C?.id||P.urls.length!==J.blocks.length)return null;let e=0,t=P.urls.map((t,n)=>{let r=P.durationsMs[n]/1e3,i={src:t,name:J.blocks[n].id,duration:r,startTime:e};return e+=r,i});return{...J,audio:{segments:t},blocks:J.blocks.map((e,t)=>({...e,audioSegment:t}))}},[J,M,P,C]),Q=(0,_.useMemo)(()=>{let t=new Set,n=new Map;for(let r of e?.areas??[])for(let e of r.entries){t.add(e.id);let r=e.id.split(`/`).pop();r&&!n.has(r)&&n.set(r,e.id)}return{ids:t,byStem:n}},[e]),te=e=>{let t=e.target.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(!n||/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return;e.preventDefault(),e.stopPropagation();let r=n.split(/[?#]/)[0].replace(/\.md$/,``).replace(/^(\.\.?\/)+/,``),i=(Q.ids.has(r)?r:void 0)??Q.byStem.get(r.split(`/`).pop()??``);i&&b(i)},ne=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},re=e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},$=(e,t=!1)=>(0,v.jsx)(`ul`,{className:t?`handboek-toc-subcategory-entries`:void 0,children:e.map(e=>(0,v.jsx)(`li`,{children:(0,v.jsx)(`button`,{type:`button`,className:e.id===n?`handboek-toc-entry handboek-toc-entry-active`:`handboek-toc-entry`,"aria-current":e.id===n?`page`:void 0,title:e.summary,onClick:()=>b(e.id),children:e.title})},e.id))});return(0,v.jsxs)(`div`,{className:`handboek-view`,"data-testid":`handboek-view`,children:[(0,v.jsxs)(`nav`,{className:`handboek-toc`,"aria-label":`Handboek contents`,children:[(0,v.jsxs)(`div`,{className:`handboek-toc-brand`,children:[(0,v.jsx)(p,{area:`handboek`,size:16}),(0,v.jsx)(`span`,{children:`Handboek`})]}),(0,v.jsx)(`input`,{type:`search`,className:`handboek-toc-filter`,placeholder:`Find an article…`,"aria-label":`Filter Handboek articles`,value:H,onChange:e=>U(e.target.value)}),!e&&!w&&(0,v.jsx)(`div`,{className:`handboek-toc-loading`,children:`Loading contents…`}),H.trim()?(0,v.jsx)(`section`,{className:`handboek-toc-area`,children:W.length>0?$(W):(0,v.jsx)(`div`,{className:`handboek-toc-loading`,children:`No articles match.`})}):null,!H.trim()&&e?.areas.map(e=>{let t=R.has(e.area),n=`handboek-area-${e.area}`,{ungrouped:r,subcategories:i}=x(e);return(0,v.jsxs)(`section`,{className:`handboek-toc-area`,children:[(0,v.jsx)(`h3`,{className:`handboek-toc-area-title`,children:(0,v.jsxs)(`button`,{type:`button`,className:`handboek-toc-disclosure handboek-toc-area-toggle`,"aria-expanded":!t,"aria-controls":n,onClick:()=>ne(e.area),children:[(0,v.jsx)(`span`,{className:`handboek-toc-caret`,"aria-hidden":`true`,children:`›`}),(0,v.jsx)(`span`,{children:e.title})]})}),!t&&(0,v.jsxs)(`div`,{id:n,className:`handboek-toc-area-contents`,children:[r.length>0&&$(r),i.map(t=>{let n=S(e.area,t.id),r=B.has(n),i=`handboek-subcategory-${e.area}-${t.id}`;return(0,v.jsxs)(`section`,{className:`handboek-toc-subcategory`,children:[(0,v.jsx)(`h4`,{className:`handboek-toc-subcategory-title`,children:(0,v.jsxs)(`button`,{type:`button`,className:`handboek-toc-disclosure handboek-toc-subcategory-toggle`,"aria-expanded":r,"aria-controls":i,onClick:()=>re(n),children:[(0,v.jsx)(`span`,{className:`handboek-toc-caret`,"aria-hidden":`true`,children:`›`}),(0,v.jsx)(`span`,{children:t.title})]})}),r&&(0,v.jsx)(`div`,{id:i,children:$(t.entries,!0)})]},t.id)})]})]},e.area)})]}),(0,v.jsxs)(`div`,{className:`handboek-pane`,children:[(0,v.jsxs)(`header`,{className:`handboek-pane-header`,children:[(0,v.jsxs)(`div`,{className:`handboek-pane-titles`,children:[(0,v.jsx)(`h2`,{children:C?.title??`Handboek`}),C?.summary&&(0,v.jsx)(`p`,{className:`handboek-pane-summary`,children:C.summary})]}),(0,v.jsxs)(`div`,{className:`handboek-header-controls`,children:[O===`video`&&A&&(0,v.jsx)(`button`,{type:`button`,className:M?`gz-key gz-key-active handboek-listen-key`:`gz-key handboek-listen-key`,"aria-pressed":M,disabled:I,onClick:X,title:`Narrate this article with the on-device voice`,children:I?`Preparing voice…`:`Listen`}),(0,v.jsxs)(`div`,{className:`gz-tray handboek-mode-tray`,role:`radiogroup`,"aria-label":`View as`,children:[(0,v.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":O===`doc`,className:O===`doc`?`gz-key gz-key-active`:`gz-key`,onClick:()=>k(`doc`),children:`Document`}),(0,v.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":O===`video`,className:O===`video`?`gz-key gz-key-active`:`gz-key`,onClick:()=>k(`video`),children:`Video`})]})]})]}),w&&(0,v.jsx)(`div`,{className:`handboek-error`,children:w}),E&&!C&&(0,v.jsx)(`div`,{className:`handboek-loading`,children:`Loading article…`}),J&&K&&(0,v.jsx)(s.Provider,{value:K,children:O===`doc`?(0,v.jsx)(`div`,{className:`handboek-doc`,"data-testid":`handboek-doc`,onClickCapture:te,children:(0,v.jsx)(c,{doc:J,className:`gezel-article-view`,theme:f,surface:G,imageDisplayMode:`inline`,showCover:!1})}):(0,v.jsx)(`div`,{className:`handboek-player`,"data-testid":`handboek-player`,children:(0,v.jsx)(l,{doc:Z??Y??J,theme:f,surface:G,displayMode:`video`,audioMode:Z?`media`:`synthetic`,captionsEnabled:!0,captionStyle:`social`,autoPlay:!0,showControls:!0,showScrubber:!0},Z?`narrated`:`synthetic`)})})]})]})}function x(e){let t=[],n=new Map;for(let r of e.entries){if(!r.subcategory){t.push(r);continue}let e=n.get(r.subcategory.id);e?e.entries.push(r):n.set(r.subcategory.id,{...r.subcategory,entries:[r]})}return{ungrouped:t,subcategories:[...n.values()].sort((e,t)=>e.order-t.order||e.title.localeCompare(t.title))}}function S(e,t){return`${e}:${t}`}export{b as HandboekView};
|
|
@@ -1 +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"./api-C0I7spBl.js";import{d as i,l as a,m as o,p as s,s as c}from"./primitives-CWrGZpPI.js";import{n as l,t as u}from"./relative-time-B2kBaekd.js";import{G as d,H as f,W as p}from"./index-DDu8nyO6.js";var m=e(t(),1),h=n(),g=[{value:``,label:`All kinds`},{value:`session`,label:`Chat threads`},{value:`gezel.created`,label:`Gezel created`},{value:`gezel.deleted`,label:`Gezel removed`},{value:`gezel.renamed`,label:`Gezel renamed`},{value:`gezel.settings.updated`,label:`Gezel settings updated`},{value:`icon.generated`,label:`Icon generated`},{value:`icon.reverted`,label:`Icon reverted`},{value:`project.created`,label:`Project created`},{value:`project.updated`,label:`Project updated`},{value:`project.about.updated`,label:`Project about updated`},{value:`project.mission.updated`,label:`Project mission updated`},{value:`project.voorman.changed`,label:`Project voorman changed`},{value:`document.created`,label:`Document created`},{value:`document.updated`,label:`Document edited`},{value:`document.renamed`,label:`Document renamed`},{value:`document.deleted`,label:`Document deleted`},{value:`tool.called`,label:`Tool called`},{value:`meester.changed`,label:`Meester changed`},{value:`klerk.changed`,label:`Klerk changed`},{value:`boekwachter.changed`,label:`Boekwachter changed`},{value:`keurmeester.changed`,label:`Keurmeester changed`},{value:`knowledge.catalog.installed`,label:`Knowledge catalog installed`},{value:`knowledge.catalog.updated`,label:`Knowledge catalog updated`},{value:`knowledge.catalog.removed`,label:`Knowledge catalog removed`},{value:`gilde.updated`,label:`Catalog content updated`},{value:`task.created`,label:`Task created`},{value:`task.updated`,label:`Task updated`},{value:`task.about.updated`,label:`Task description updated`},{value:`task.status.changed`,label:`Task status changed`},{value:`task.assignee.changed`,label:`Task reassigned`},{value:`task.step.added`,label:`Task step added`},{value:`task.step.activated`,label:`Task step activated`},{value:`task.step.completed`,label:`Task step completed`},{value:`task.tick`,label:`Task cron tick`},{value:`task.canceled`,label:`Task canceled`},{value:`v1.chat.completion`,label:`App chat (connected apps)`},{value:`debug.bridge.failed`,label:`Debug: MCP bridge failed to start`}],_=`gezel:history-list-fraction:v1`,v=.2,y=.7,b=.36;function x(e){return Number.isFinite(e)?Math.max(v,Math.min(y,e)):b}function S(){if(typeof window>`u`)return b;try{let e=window.localStorage.getItem(_);return e?x(Number.parseFloat(e)):b}catch{return b}}function C({projectId:e}={}){let[t,n]=(0,m.useState)([]),[f,b]=(0,m.useState)(null),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)([]),[D,O]=(0,m.useState)([]),[A,j]=(0,m.useState)(``),[M,N]=(0,m.useState)(e??``);(0,m.useEffect)(()=>{e!==void 0&&N(e)},[e]);let[P,F]=(0,m.useState)(``),[I,L]=(0,m.useState)(``),[R,z]=(0,m.useState)(null),[B,V]=(0,m.useState)([]),H=(0,m.useMemo)(()=>{let e=new Map;for(let t of T)e.set(t.id,t.name);return t=>t?e.get(t)??t:``},[T]),U=(0,m.useMemo)(()=>{let e=new Map;for(let t of D)e.set(t.id,t.name);return t=>t?e.get(t)??t:``},[D]),W=(0,m.useCallback)(async()=>{w(!0),b(null);try{let e={limit:200};M&&(e.projectId=M),A&&(e.gezelId=A),P&&P!==`session`&&(e.kind=P),I.trim()&&(e.q=I.trim());let t=I.trim()?r.searchSessions({q:I.trim(),...M?{project:M}:{},...A?{gezel:A}:{},maxResults:10}).then(e=>e?.engine!==`unavailable`&&Array.isArray(e?.results)?e.results:[]).catch(()=>[]):Promise.resolve([]),i=await r.listHistory(e);V(await t);let a=P===`session`?i.entries.filter(e=>e.entryType===`session`):i.entries;n(a),z(e=>{let t=e=>e.entryType===`event`?e.id:`session:${e.id}`;if(e&&a.some(n=>t(n)===e))return e;let n=a[0];return n?t(n):null})}catch(e){b(e.message)}finally{w(!1)}},[M,A,P,I]);(0,m.useEffect)(()=>{r.listGezels().then(e=>E(e.gezels)).catch(()=>{}),r.listProjects().then(e=>O(e.projects)).catch(()=>{})},[]),(0,m.useEffect)(()=>{W()},[W]);let G=(0,m.useRef)(null),[K,Y]=(0,m.useState)(()=>S()),X=(0,m.useRef)(null),Z=(0,m.useCallback)(e=>{let t=x(e);Y(t);try{window.localStorage.setItem(_,t.toFixed(4))}catch{}},[]),Q=(0,m.useCallback)(e=>{e.preventDefault(),X.current={startX:e.clientX,startFraction:K,width:G.current?.clientWidth??1},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let t=e=>{let t=X.current;!t||t.width<=0||Z(t.startFraction+(e.clientX-t.startX)/t.width)},n=()=>{X.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)},[K,Z]),$=(0,m.useCallback)(e=>{let t=e.shiftKey?.08:.02;e.key===`ArrowRight`?(e.preventDefault(),Z(K+t)):e.key===`ArrowLeft`?(e.preventDefault(),Z(K-t)):e.key===`Home`?(e.preventDefault(),Z(v)):e.key===`End`&&(e.preventDefault(),Z(y))},[K,Z]);return(0,h.jsxs)(`div`,{className:`history-view`,"data-testid":`history-view`,children:[(0,h.jsxs)(`header`,{className:`history-header`,children:[(0,h.jsx)(`h2`,{children:`History`}),(0,h.jsxs)(`div`,{className:`history-filters`,children:[e===void 0&&(0,h.jsxs)(i,{value:M||`__ALL__`,onValueChange:e=>N(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`All projects`}),D.map(e=>(0,h.jsx)(a,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(i,{value:A||`__ALL__`,onValueChange:e=>j(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`All gezels`}),T.map(e=>(0,h.jsxs)(a,{value:e.id,children:[e.name,e.role?` — ${e.role}`:``]},e.id))]})]}),(0,h.jsxs)(i,{value:P||`__ALL__`,onValueChange:e=>F(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsx)(c,{children:g.map(e=>(0,h.jsx)(a,{value:e.value||`__ALL__`,children:e.label},e.value||`__ALL__`))})]}),(0,h.jsx)(`input`,{placeholder:`Search…`,value:I,onChange:e=>L(e.target.value),style:{flex:1}}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void W(),children:`Refresh`})]})]}),f&&(0,h.jsx)(`p`,{className:`error`,children:f}),C&&t.length===0&&(0,h.jsx)(`p`,{className:`muted`,children:`Loading…`}),!C&&t.length===0&&!f&&(0,h.jsx)(`p`,{className:`muted`,children:`No entries yet. Create a gezel, edit a project, or have a chat — events will show up here.`}),(0,h.jsxs)(`div`,{className:`history-split`,ref:G,style:{"--history-list-width":`${(K*100).toFixed(2)}%`},children:[(0,h.jsxs)(`ul`,{className:`history-list`,children:[B.length>0&&(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsx)(`span`,{className:`history-transcript-header muted`,children:`Said in chats`})}),B.map(e=>(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsxs)(`button`,{type:`button`,className:`history-row`,onClick:()=>{let t={gezelId:e.gezelId,sessionId:e.sessionId,...e.projectId?{projectId:e.projectId}:{},messageIndex:e.messageStart};d([{kind:`open-session`,intent:t},p({kind:`gezel`,id:e.gezelId}),{kind:`event`,type:`gezel:open-session`,detail:t}])},children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsxs)(`span`,{className:`history-summary`,children:[H(e.gezelId)||e.gezelId,` · `,e.title||`Untitled session`]}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.lastActivityAt,title:u(e.lastActivityAt),children:l(e.lastActivityAt)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,children:`Transcript`}),U(e.projectId)&&(0,h.jsx)(`span`,{className:`history-chip`,children:U(e.projectId)}),(0,h.jsx)(`span`,{className:`history-stat`,children:e.snippet})]})]})},`transcript:${e.sessionId}:${e.messageStart}`)),t.map(e=>{let t=e.entryType===`event`?e.id:`session:${e.id}`;return(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsx)(`button`,{type:`button`,className:`history-row${R===t?` history-row-selected`:``}`,onClick:()=>z(t),children:e.entryType===`session`?(0,h.jsx)(J,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId)}):(0,h.jsx)(q,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId)})})},t)})]}),(0,h.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize history list`,tabIndex:0,className:`chat-rail-grip history-split-grip`,onMouseDown:Q,onKeyDown:$}),(0,h.jsx)(`section`,{className:`history-detail`,children:(()=>{let e=t.find(e=>(e.entryType===`event`?e.id:`session:${e.id}`)===R);return e?(0,h.jsx)(k,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId),resolveGezel:H,resolveProject:U}):(0,h.jsx)(`p`,{className:`placeholder`,children:`Click a history entry on the left to view its details.`})})()})]})]})}var w={actionId:`Action`,appId:`App`,archived:`Status`,at:`When`,bookCatalogId:`Craftbook`,bytes:`Size`,capabilityFloor:`Capability floor`,caseId:`Case`,changed:`Changed fields`,craftbookId:`Craftbook`,createdAt:`Started`,credentialName:`Credential`,durationMs:`Duration`,fieldIds:`Fields`,fromPath:`From`,fromSteps:`Steps before`,gezel:`Gezel`,gezelId:`Gezel`,id:`Reference`,inputTokens:`Input tokens`,lastActivityAt:`Last activity`,messageCount:`Messages`,newName:`New name`,oldName:`Previous name`,outputTokens:`Output tokens`,previous:`Before`,previousStatus:`Previous status`,previousUrl:`Previous URL`,previousVersion:`Previous version`,project:`Project`,projectId:`Project`,questionId:`Question`,ref:`Task`,reportPath:`Report`,runId:`Run`,sessionId:`Chat thread`,stepId:`Step`,taskRef:`Task`,toPath:`To`,toSteps:`Steps after`,trialId:`Trial`},T={anthropic:`Anthropic`,"anthropic-cli":`Claude CLI`,"codex-cli":`Codex CLI`,copilot:`GitHub Copilot`,ds4:`DwarfStar`,"llama-cpp":`llama.cpp`,mlx:`MLX`,ollama:`Ollama`,openai:`OpenAI`,remote:`Remote device`},E=/(?:^|\.)(action|decision|failureClass|kind|outcome|phase|provider|runMode|source|state|status|storageScope|surface|tier|trigger|via)$/i,D=/(?:^|\.)(command|credentialName|id|key|model|path|ref|script|tool|url)$/i,O=/(?:^at$|At$|Date$|timestamp$)/i;function k({entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i}){return e.entryType===`session`?(0,h.jsx)(j,{entry:e,gezelName:t,projectName:n}):(0,h.jsx)(A,{entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i})}function A({entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i}){let a=e.details,o=typeof a?.diff==`string`?a.diff:void 0,s=typeof a?.addedLines==`number`?a.addedLines:void 0,c=typeof a?.removedLines==`number`?a.removedLines:void 0,u=a?Object.fromEntries(Object.entries(a).filter(([e,t])=>t!==void 0&&![`diff`,`addedLines`,`removedLines`].includes(e))):void 0,d=u&&Object.keys(u).length>0,p={resolveGezel:r,resolveProject:i};return(0,h.jsxs)(`article`,{className:`history-detail-document`,children:[(0,h.jsxs)(`header`,{className:`history-detail-header`,children:[(0,h.jsx)(`p`,{className:`history-detail-eyebrow`,title:e.kind,children:K(e.kind)}),(0,h.jsx)(`h3`,{children:e.summary}),(0,h.jsxs)(`time`,{dateTime:e.at,className:`history-detail-time`,children:[H(e.at),` `,(0,h.jsxs)(`span`,{children:[`· `,l(e.at,{style:`long`})]})]})]}),(n||t)&&(0,h.jsx)(M,{heading:`Context`,children:(0,h.jsx)(P,{fields:{...n?{project:n}:{},...t?{gezel:t}:{}},context:p})}),d&&(0,h.jsx)(M,{heading:`Details`,children:(0,h.jsx)(P,{fields:u,context:p})}),o&&(0,h.jsx)(M,{heading:`Changes`,children:(0,h.jsx)(f,{diff:o,...s===void 0?{}:{addedLines:s},...c===void 0?{}:{removedLines:c}})}),(0,h.jsx)(N,{id:e.id})]})}function j({entry:e,gezelName:t,projectName:n}){return(0,h.jsxs)(`article`,{className:`history-detail-document`,children:[(0,h.jsxs)(`header`,{className:`history-detail-header`,children:[(0,h.jsx)(`p`,{className:`history-detail-eyebrow`,children:`Chat thread`}),(0,h.jsx)(`h3`,{children:e.title}),(0,h.jsxs)(`p`,{className:`history-detail-subtitle`,children:[t||e.gezelId,n?` in ${n}`:``]})]}),(0,h.jsx)(M,{heading:`Conversation`,children:(0,h.jsx)(P,{fields:{gezel:t||e.gezelId,project:n||e.projectId,messageCount:e.messageCount,durationMs:e.durationMs,archived:e.archived===!0?`Archived`:`Active`}})}),(0,h.jsx)(M,{heading:`Timing`,children:(0,h.jsx)(P,{fields:{createdAt:e.createdAt,lastActivityAt:e.lastActivityAt}})}),(0,h.jsx)(M,{heading:`Model`,children:(0,h.jsx)(P,{fields:{provider:e.providerName,...e.model?{model:e.model}:{}}})}),(0,h.jsx)(N,{id:e.id})]})}function M({heading:e,children:t}){return(0,h.jsxs)(`section`,{className:`history-detail-section`,children:[(0,h.jsx)(`h4`,{children:e}),t]})}function N({id:e}){return(0,h.jsxs)(`footer`,{className:`history-detail-reference`,children:[(0,h.jsx)(`span`,{children:`Record reference`}),(0,h.jsx)(`code`,{children:e})]})}function P({fields:e,context:t={},path:n=``}){let r=Object.entries(e).filter(([,e])=>e!==void 0);return r.length===0?(0,h.jsx)(`p`,{className:`muted`,children:`No additional details were recorded.`}):(0,h.jsx)(`dl`,{className:`history-detail-fields`,children:r.map(([e,r])=>{let i=n?`${n}.${e}`:e;return(0,h.jsxs)(`div`,{className:`history-detail-field`,children:[(0,h.jsx)(`dt`,{children:I(e)}),(0,h.jsx)(`dd`,{children:(0,h.jsx)(F,{field:e,fieldPath:i,value:r,context:t})})]},i)})})}function F({field:e,fieldPath:t,value:n,context:r}){if(n===null)return(0,h.jsx)(`span`,{className:`history-detail-empty`,children:`Not set`});if(typeof n==`boolean`)return(0,h.jsx)(`span`,{children:n?`Yes`:`No`});if(typeof n==`number`)return e.toLowerCase().endsWith(`ms`)?(0,h.jsx)(`span`,{children:U(n)}):e.toLowerCase().endsWith(`bytes`)||e===`bytes`?(0,h.jsx)(`span`,{children:W(n)}):(0,h.jsx)(`span`,{children:n.toLocaleString()});if(typeof n==`string`){if(O.test(e)&&V(n))return(0,h.jsx)(`time`,{dateTime:n,children:H(n)});let i=L(t,R(e,n,r));return D.test(t)?(0,h.jsx)(`code`,{className:`history-detail-code`,children:i}):(0,h.jsx)(`span`,{className:`history-detail-text`,children:i})}return Array.isArray(n)?n.length===0?(0,h.jsx)(`span`,{className:`history-detail-empty`,children:`None`}):(0,h.jsx)(`ul`,{className:`history-detail-list`,children:n.map((n,i)=>(0,h.jsx)(`li`,{children:B(n)?(0,h.jsx)(P,{fields:n,context:r,path:`${t}.${i}`}):(0,h.jsx)(F,{field:e,fieldPath:t,value:n,context:r})},`${t}:${i}`))}):B(n)?(0,h.jsx)(`div`,{className:`history-detail-nested`,children:(0,h.jsx)(P,{fields:n,context:r,path:t})}):(0,h.jsx)(`span`,{className:`history-detail-text`,children:String(n)})}function I(e){let t=w[e];if(t)return t;let n=e.replace(/[._-]+/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase().replace(/\bid\b/g,`ID`).replace(/\burl\b/g,`URL`).replace(/\bapi\b/g,`API`).trim();return n.charAt(0).toUpperCase()+n.slice(1)}function L(e,t){return(e.split(`.`).at(-1)??e).toLowerCase().includes(`provider`)?T[t]??t:E.test(e)?z(t):t}function R(e,t,n){return e===`gezelId`?n.resolveGezel?.(t)||t:(e===`projectId`||e===`targetProjectId`)&&n.resolveProject?.(t)||t}function z(e){let t=e.replace(/[._-]+/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function B(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function V(e){return!Number.isNaN(new Date(e).getTime())}function H(e){return V(e)?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):e}function U(e){if(!Number.isFinite(e)||e<0)return`${e} ms`;if(e<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60,o=[];return n&&o.push(`${n} ${n===1?`day`:`days`}`),r&&o.push(`${r} ${r===1?`hour`:`hours`}`),i&&o.push(`${i} ${i===1?`minute`:`minutes`}`),a&&o.length<2&&o.push(`${a} ${a===1?`second`:`seconds`}`),o.slice(0,2).join(` `)}function W(e){if(!Number.isFinite(e)||e<0)return`${e} bytes`;if(e<1024)return`${e.toLocaleString()} ${e===1?`byte`:`bytes`}`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=t[0];for(let e=1;e<t.length&&n>=1024;e+=1)n/=1024,r=t[e];return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(n)} ${r}`}var G={"gezel.created":`Gezel created`,"gezel.renamed":`Gezel renamed`,"gezel.settings.updated":`Gezel settings`,"project.created":`Project created`,"project.updated":`Project updated`,"project.about.updated":`Project brief`,"project.mission.updated":`Mission updated`,"project.voorman.changed":`Voorman changed`,"project.gezel.joined":`Joined project`,"icon.generated":`Icon generated`,"icon.reverted":`Icon reverted`,"poppetje.generated":`Portrait carved`,"document.created":`Document created`,"document.updated":`Document edited`,"document.renamed":`Document renamed`,"document.deleted":`Document deleted`,"craftbook.created":`Craftbook created`,"task.created":`Task created`,"tool.called":`Tool call`,"meester.changed":`Meester changed`,"klerk.changed":`Klerk changed`,"boekwachter.changed":`Boekwachter changed`,"keurmeester.changed":`Keurmeester changed`,"gilde.updated":`Catalog content updated`,"knowledge.catalog.installed":`Knowledge catalog installed`,"knowledge.catalog.updated":`Knowledge catalog updated`,"knowledge.catalog.enabled":`Knowledge catalog enabled`,"knowledge.catalog.disabled":`Knowledge catalog disabled`,"knowledge.catalog.removed":`Knowledge catalog removed`,"knowledge.catalog.install_failed":`Knowledge catalog install failed`,"v1.chat.completion":`App chat`};function K(e){let t=G[e];if(t)return t;let n=e.split(`.`).join(` `);return n.charAt(0).toUpperCase()+n.slice(1)}function q({entry:e,gezelName:t,projectName:n}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsx)(`span`,{className:`history-summary`,children:e.summary}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.at,title:u(e.at),children:l(e.at)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,title:e.kind,children:K(e.kind)}),n&&(0,h.jsx)(`span`,{className:`history-chip`,children:n}),t&&(0,h.jsx)(`span`,{className:`history-chip`,children:t})]})]})}function J({entry:e,gezelName:t,projectName:n}){let r=Math.max(1,Math.round(e.durationMs/6e4)),i=e.durationMs<6e4?`<1m`:`${r}m`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsxs)(`span`,{className:`history-summary`,children:[t||e.gezelId,` · `,e.title]}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.lastActivityAt,title:u(e.lastActivityAt),children:l(e.lastActivityAt)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,children:`Thread`}),n&&(0,h.jsx)(`span`,{className:`history-chip`,children:n}),(0,h.jsxs)(`span`,{className:`history-stat`,children:[e.messageCount,` msgs, `,i]})]})]})}export{C as HistoryView};
|
|
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"./api-CmrgM5Rf.js";import{d as i,l as a,m as o,p as s,s as c}from"./primitives-CWrGZpPI.js";import{n as l,t as u}from"./relative-time-B2kBaekd.js";import{$ as d,Q as f,X as p}from"./index-DivKnJyx.js";var m=e(t(),1),h=n(),g=[{value:``,label:`All kinds`},{value:`session`,label:`Chat threads`},{value:`gezel.created`,label:`Gezel created`},{value:`gezel.deleted`,label:`Gezel removed`},{value:`gezel.renamed`,label:`Gezel renamed`},{value:`gezel.settings.updated`,label:`Gezel settings updated`},{value:`icon.generated`,label:`Icon generated`},{value:`icon.reverted`,label:`Icon reverted`},{value:`project.created`,label:`Project created`},{value:`project.updated`,label:`Project updated`},{value:`project.about.updated`,label:`Project about updated`},{value:`project.mission.updated`,label:`Project mission updated`},{value:`project.voorman.changed`,label:`Project voorman changed`},{value:`document.created`,label:`Document created`},{value:`document.updated`,label:`Document edited`},{value:`document.renamed`,label:`Document renamed`},{value:`document.deleted`,label:`Document deleted`},{value:`tool.called`,label:`Tool called`},{value:`meester.changed`,label:`Meester changed`},{value:`klerk.changed`,label:`Klerk changed`},{value:`boekwachter.changed`,label:`Boekwachter changed`},{value:`keurmeester.changed`,label:`Keurmeester changed`},{value:`knowledge.catalog.installed`,label:`Knowledge catalog installed`},{value:`knowledge.catalog.updated`,label:`Knowledge catalog updated`},{value:`knowledge.catalog.removed`,label:`Knowledge catalog removed`},{value:`gilde.updated`,label:`Catalog content updated`},{value:`task.created`,label:`Task created`},{value:`task.updated`,label:`Task updated`},{value:`task.about.updated`,label:`Task description updated`},{value:`task.status.changed`,label:`Task status changed`},{value:`task.assignee.changed`,label:`Task reassigned`},{value:`task.step.added`,label:`Task step added`},{value:`task.step.activated`,label:`Task step activated`},{value:`task.step.completed`,label:`Task step completed`},{value:`task.tick`,label:`Task cron tick`},{value:`task.canceled`,label:`Task canceled`},{value:`v1.chat.completion`,label:`App chat (connected apps)`},{value:`debug.bridge.failed`,label:`Debug: MCP bridge failed to start`}],_=`gezel:history-list-fraction:v1`,v=.2,y=.7,b=.36;function x(e){return Number.isFinite(e)?Math.max(v,Math.min(y,e)):b}function S(){if(typeof window>`u`)return b;try{let e=window.localStorage.getItem(_);return e?x(Number.parseFloat(e)):b}catch{return b}}function C({projectId:e}={}){let[t,n]=(0,m.useState)([]),[p,b]=(0,m.useState)(null),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)([]),[D,O]=(0,m.useState)([]),[A,j]=(0,m.useState)(``),[M,N]=(0,m.useState)(e??``);(0,m.useEffect)(()=>{e!==void 0&&N(e)},[e]);let[P,F]=(0,m.useState)(``),[I,L]=(0,m.useState)(``),[R,z]=(0,m.useState)(null),[B,V]=(0,m.useState)([]),H=(0,m.useMemo)(()=>{let e=new Map;for(let t of T)e.set(t.id,t.name);return t=>t?e.get(t)??t:``},[T]),U=(0,m.useMemo)(()=>{let e=new Map;for(let t of D)e.set(t.id,t.name);return t=>t?e.get(t)??t:``},[D]),W=(0,m.useCallback)(async()=>{w(!0),b(null);try{let e={limit:200};M&&(e.projectId=M),A&&(e.gezelId=A),P&&P!==`session`&&(e.kind=P),I.trim()&&(e.q=I.trim());let t=I.trim()?r.searchSessions({q:I.trim(),...M?{project:M}:{},...A?{gezel:A}:{},maxResults:10}).then(e=>e?.engine!==`unavailable`&&Array.isArray(e?.results)?e.results:[]).catch(()=>[]):Promise.resolve([]),i=await r.listHistory(e);V(await t);let a=P===`session`?i.entries.filter(e=>e.entryType===`session`):i.entries;n(a),z(e=>{let t=e=>e.entryType===`event`?e.id:`session:${e.id}`;if(e&&a.some(n=>t(n)===e))return e;let n=a[0];return n?t(n):null})}catch(e){b(e.message)}finally{w(!1)}},[M,A,P,I]);(0,m.useEffect)(()=>{r.listGezels().then(e=>E(e.gezels)).catch(()=>{}),r.listProjects().then(e=>O(e.projects)).catch(()=>{})},[]),(0,m.useEffect)(()=>{W()},[W]);let G=(0,m.useRef)(null),[K,Y]=(0,m.useState)(()=>S()),X=(0,m.useRef)(null),Z=(0,m.useCallback)(e=>{let t=x(e);Y(t);try{window.localStorage.setItem(_,t.toFixed(4))}catch{}},[]),Q=(0,m.useCallback)(e=>{e.preventDefault(),X.current={startX:e.clientX,startFraction:K,width:G.current?.clientWidth??1},document.body.classList.add(`chat-rail-resizing`),document.body.style.cursor=`col-resize`;let t=e=>{let t=X.current;!t||t.width<=0||Z(t.startFraction+(e.clientX-t.startX)/t.width)},n=()=>{X.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)},[K,Z]),$=(0,m.useCallback)(e=>{let t=e.shiftKey?.08:.02;e.key===`ArrowRight`?(e.preventDefault(),Z(K+t)):e.key===`ArrowLeft`?(e.preventDefault(),Z(K-t)):e.key===`Home`?(e.preventDefault(),Z(v)):e.key===`End`&&(e.preventDefault(),Z(y))},[K,Z]);return(0,h.jsxs)(`div`,{className:`history-view`,"data-testid":`history-view`,children:[(0,h.jsxs)(`header`,{className:`history-header`,children:[(0,h.jsx)(`h2`,{children:`History`}),(0,h.jsxs)(`div`,{className:`history-filters`,children:[e===void 0&&(0,h.jsxs)(i,{value:M||`__ALL__`,onValueChange:e=>N(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`All projects`}),D.map(e=>(0,h.jsx)(a,{value:e.id,children:e.name},e.id))]})]}),(0,h.jsxs)(i,{value:A||`__ALL__`,onValueChange:e=>j(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsxs)(c,{children:[(0,h.jsx)(a,{value:`__ALL__`,children:`All gezels`}),T.map(e=>(0,h.jsxs)(a,{value:e.id,children:[e.name,e.role?` — ${e.role}`:``]},e.id))]})]}),(0,h.jsxs)(i,{value:P||`__ALL__`,onValueChange:e=>F(e===`__ALL__`?``:e),children:[(0,h.jsx)(s,{children:(0,h.jsx)(o,{})}),(0,h.jsx)(c,{children:g.map(e=>(0,h.jsx)(a,{value:e.value||`__ALL__`,children:e.label},e.value||`__ALL__`))})]}),(0,h.jsx)(`input`,{placeholder:`Search…`,value:I,onChange:e=>L(e.target.value),style:{flex:1}}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void W(),children:`Refresh`})]})]}),p&&(0,h.jsx)(`p`,{className:`error`,children:p}),C&&t.length===0&&(0,h.jsx)(`p`,{className:`muted`,children:`Loading…`}),!C&&t.length===0&&!p&&(0,h.jsx)(`p`,{className:`muted`,children:`No entries yet. Create a gezel, edit a project, or have a chat — events will show up here.`}),(0,h.jsxs)(`div`,{className:`history-split`,ref:G,style:{"--history-list-width":`${(K*100).toFixed(2)}%`},children:[(0,h.jsxs)(`ul`,{className:`history-list`,children:[B.length>0&&(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsx)(`span`,{className:`history-transcript-header muted`,children:`Said in chats`})}),B.map(e=>(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsxs)(`button`,{type:`button`,className:`history-row`,onClick:()=>{let t={gezelId:e.gezelId,sessionId:e.sessionId,...e.projectId?{projectId:e.projectId}:{},messageIndex:e.messageStart};d([{kind:`open-session`,intent:t},f({kind:`gezel`,id:e.gezelId}),{kind:`event`,type:`gezel:open-session`,detail:t}])},children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsxs)(`span`,{className:`history-summary`,children:[H(e.gezelId)||e.gezelId,` · `,e.title||`Untitled session`]}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.lastActivityAt,title:u(e.lastActivityAt),children:l(e.lastActivityAt)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,children:`Transcript`}),U(e.projectId)&&(0,h.jsx)(`span`,{className:`history-chip`,children:U(e.projectId)}),(0,h.jsx)(`span`,{className:`history-stat`,children:e.snippet})]})]})},`transcript:${e.sessionId}:${e.messageStart}`)),t.map(e=>{let t=e.entryType===`event`?e.id:`session:${e.id}`;return(0,h.jsx)(`li`,{className:`history-item`,children:(0,h.jsx)(`button`,{type:`button`,className:`history-row${R===t?` history-row-selected`:``}`,onClick:()=>z(t),children:e.entryType===`session`?(0,h.jsx)(J,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId)}):(0,h.jsx)(q,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId)})})},t)})]}),(0,h.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize history list`,tabIndex:0,className:`chat-rail-grip history-split-grip`,onMouseDown:Q,onKeyDown:$}),(0,h.jsx)(`section`,{className:`history-detail`,children:(()=>{let e=t.find(e=>(e.entryType===`event`?e.id:`session:${e.id}`)===R);return e?(0,h.jsx)(k,{entry:e,gezelName:H(e.gezelId),projectName:U(e.projectId),resolveGezel:H,resolveProject:U}):(0,h.jsx)(`p`,{className:`placeholder`,children:`Click a history entry on the left to view its details.`})})()})]})]})}var w={actionId:`Action`,appId:`App`,archived:`Status`,at:`When`,bookCatalogId:`Craftbook`,bytes:`Size`,capabilityFloor:`Capability floor`,caseId:`Case`,changed:`Changed fields`,craftbookId:`Craftbook`,createdAt:`Started`,credentialName:`Credential`,durationMs:`Duration`,fieldIds:`Fields`,fromPath:`From`,fromSteps:`Steps before`,gezel:`Gezel`,gezelId:`Gezel`,id:`Reference`,inputTokens:`Input tokens`,lastActivityAt:`Last activity`,messageCount:`Messages`,newName:`New name`,oldName:`Previous name`,outputTokens:`Output tokens`,previous:`Before`,previousStatus:`Previous status`,previousUrl:`Previous URL`,previousVersion:`Previous version`,project:`Project`,projectId:`Project`,questionId:`Question`,ref:`Task`,reportPath:`Report`,runId:`Run`,sessionId:`Chat thread`,stepId:`Step`,taskRef:`Task`,toPath:`To`,toSteps:`Steps after`,trialId:`Trial`},T={anthropic:`Anthropic`,"anthropic-cli":`Claude CLI`,"codex-cli":`Codex CLI`,copilot:`GitHub Copilot`,ds4:`DwarfStar`,"llama-cpp":`llama.cpp`,mlx:`MLX`,ollama:`Ollama`,openai:`OpenAI`,remote:`Remote device`},E=/(?:^|\.)(action|decision|failureClass|kind|outcome|phase|provider|runMode|source|state|status|storageScope|surface|tier|trigger|via)$/i,D=/(?:^|\.)(command|credentialName|id|key|model|path|ref|script|tool|url)$/i,O=/(?:^at$|At$|Date$|timestamp$)/i;function k({entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i}){return e.entryType===`session`?(0,h.jsx)(j,{entry:e,gezelName:t,projectName:n}):(0,h.jsx)(A,{entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i})}function A({entry:e,gezelName:t,projectName:n,resolveGezel:r,resolveProject:i}){let a=e.details,o=typeof a?.diff==`string`?a.diff:void 0,s=typeof a?.addedLines==`number`?a.addedLines:void 0,c=typeof a?.removedLines==`number`?a.removedLines:void 0,u=a?Object.fromEntries(Object.entries(a).filter(([e,t])=>t!==void 0&&![`diff`,`addedLines`,`removedLines`].includes(e))):void 0,d=u&&Object.keys(u).length>0,f={resolveGezel:r,resolveProject:i};return(0,h.jsxs)(`article`,{className:`history-detail-document`,children:[(0,h.jsxs)(`header`,{className:`history-detail-header`,children:[(0,h.jsx)(`p`,{className:`history-detail-eyebrow`,title:e.kind,children:K(e.kind)}),(0,h.jsx)(`h3`,{children:e.summary}),(0,h.jsxs)(`time`,{dateTime:e.at,className:`history-detail-time`,children:[H(e.at),` `,(0,h.jsxs)(`span`,{children:[`· `,l(e.at,{style:`long`})]})]})]}),(n||t)&&(0,h.jsx)(M,{heading:`Context`,children:(0,h.jsx)(P,{fields:{...n?{project:n}:{},...t?{gezel:t}:{}},context:f})}),d&&(0,h.jsx)(M,{heading:`Details`,children:(0,h.jsx)(P,{fields:u,context:f})}),o&&(0,h.jsx)(M,{heading:`Changes`,children:(0,h.jsx)(p,{diff:o,...s===void 0?{}:{addedLines:s},...c===void 0?{}:{removedLines:c}})}),(0,h.jsx)(N,{id:e.id})]})}function j({entry:e,gezelName:t,projectName:n}){return(0,h.jsxs)(`article`,{className:`history-detail-document`,children:[(0,h.jsxs)(`header`,{className:`history-detail-header`,children:[(0,h.jsx)(`p`,{className:`history-detail-eyebrow`,children:`Chat thread`}),(0,h.jsx)(`h3`,{children:e.title}),(0,h.jsxs)(`p`,{className:`history-detail-subtitle`,children:[t||e.gezelId,n?` in ${n}`:``]})]}),(0,h.jsx)(M,{heading:`Conversation`,children:(0,h.jsx)(P,{fields:{gezel:t||e.gezelId,project:n||e.projectId,messageCount:e.messageCount,durationMs:e.durationMs,archived:e.archived===!0?`Archived`:`Active`}})}),(0,h.jsx)(M,{heading:`Timing`,children:(0,h.jsx)(P,{fields:{createdAt:e.createdAt,lastActivityAt:e.lastActivityAt}})}),(0,h.jsx)(M,{heading:`Model`,children:(0,h.jsx)(P,{fields:{provider:e.providerName,...e.model?{model:e.model}:{}}})}),(0,h.jsx)(N,{id:e.id})]})}function M({heading:e,children:t}){return(0,h.jsxs)(`section`,{className:`history-detail-section`,children:[(0,h.jsx)(`h4`,{children:e}),t]})}function N({id:e}){return(0,h.jsxs)(`footer`,{className:`history-detail-reference`,children:[(0,h.jsx)(`span`,{children:`Record reference`}),(0,h.jsx)(`code`,{children:e})]})}function P({fields:e,context:t={},path:n=``}){let r=Object.entries(e).filter(([,e])=>e!==void 0);return r.length===0?(0,h.jsx)(`p`,{className:`muted`,children:`No additional details were recorded.`}):(0,h.jsx)(`dl`,{className:`history-detail-fields`,children:r.map(([e,r])=>{let i=n?`${n}.${e}`:e;return(0,h.jsxs)(`div`,{className:`history-detail-field`,children:[(0,h.jsx)(`dt`,{children:I(e)}),(0,h.jsx)(`dd`,{children:(0,h.jsx)(F,{field:e,fieldPath:i,value:r,context:t})})]},i)})})}function F({field:e,fieldPath:t,value:n,context:r}){if(n===null)return(0,h.jsx)(`span`,{className:`history-detail-empty`,children:`Not set`});if(typeof n==`boolean`)return(0,h.jsx)(`span`,{children:n?`Yes`:`No`});if(typeof n==`number`)return e.toLowerCase().endsWith(`ms`)?(0,h.jsx)(`span`,{children:U(n)}):e.toLowerCase().endsWith(`bytes`)||e===`bytes`?(0,h.jsx)(`span`,{children:W(n)}):(0,h.jsx)(`span`,{children:n.toLocaleString()});if(typeof n==`string`){if(O.test(e)&&V(n))return(0,h.jsx)(`time`,{dateTime:n,children:H(n)});let i=L(t,R(e,n,r));return D.test(t)?(0,h.jsx)(`code`,{className:`history-detail-code`,children:i}):(0,h.jsx)(`span`,{className:`history-detail-text`,children:i})}return Array.isArray(n)?n.length===0?(0,h.jsx)(`span`,{className:`history-detail-empty`,children:`None`}):(0,h.jsx)(`ul`,{className:`history-detail-list`,children:n.map((n,i)=>(0,h.jsx)(`li`,{children:B(n)?(0,h.jsx)(P,{fields:n,context:r,path:`${t}.${i}`}):(0,h.jsx)(F,{field:e,fieldPath:t,value:n,context:r})},`${t}:${i}`))}):B(n)?(0,h.jsx)(`div`,{className:`history-detail-nested`,children:(0,h.jsx)(P,{fields:n,context:r,path:t})}):(0,h.jsx)(`span`,{className:`history-detail-text`,children:String(n)})}function I(e){let t=w[e];if(t)return t;let n=e.replace(/[._-]+/g,` `).replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase().replace(/\bid\b/g,`ID`).replace(/\burl\b/g,`URL`).replace(/\bapi\b/g,`API`).trim();return n.charAt(0).toUpperCase()+n.slice(1)}function L(e,t){return(e.split(`.`).at(-1)??e).toLowerCase().includes(`provider`)?T[t]??t:E.test(e)?z(t):t}function R(e,t,n){return e===`gezelId`?n.resolveGezel?.(t)||t:(e===`projectId`||e===`targetProjectId`)&&n.resolveProject?.(t)||t}function z(e){let t=e.replace(/[._-]+/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function B(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function V(e){return!Number.isNaN(new Date(e).getTime())}function H(e){return V(e)?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):e}function U(e){if(!Number.isFinite(e)||e<0)return`${e} ms`;if(e<1e3)return`${Math.round(e)} ms`;let t=Math.round(e/1e3),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60,o=[];return n&&o.push(`${n} ${n===1?`day`:`days`}`),r&&o.push(`${r} ${r===1?`hour`:`hours`}`),i&&o.push(`${i} ${i===1?`minute`:`minutes`}`),a&&o.length<2&&o.push(`${a} ${a===1?`second`:`seconds`}`),o.slice(0,2).join(` `)}function W(e){if(!Number.isFinite(e)||e<0)return`${e} bytes`;if(e<1024)return`${e.toLocaleString()} ${e===1?`byte`:`bytes`}`;let t=[`KB`,`MB`,`GB`,`TB`],n=e/1024,r=t[0];for(let e=1;e<t.length&&n>=1024;e+=1)n/=1024,r=t[e];return`${new Intl.NumberFormat(void 0,{maximumFractionDigits:1}).format(n)} ${r}`}var G={"gezel.created":`Gezel created`,"gezel.renamed":`Gezel renamed`,"gezel.settings.updated":`Gezel settings`,"project.created":`Project created`,"project.updated":`Project updated`,"project.about.updated":`Project brief`,"project.mission.updated":`Mission updated`,"project.voorman.changed":`Voorman changed`,"project.gezel.joined":`Joined project`,"icon.generated":`Icon generated`,"icon.reverted":`Icon reverted`,"poppetje.generated":`Portrait carved`,"document.created":`Document created`,"document.updated":`Document edited`,"document.renamed":`Document renamed`,"document.deleted":`Document deleted`,"craftbook.created":`Craftbook created`,"task.created":`Task created`,"tool.called":`Tool call`,"meester.changed":`Meester changed`,"klerk.changed":`Klerk changed`,"boekwachter.changed":`Boekwachter changed`,"keurmeester.changed":`Keurmeester changed`,"gilde.updated":`Catalog content updated`,"knowledge.catalog.installed":`Knowledge catalog installed`,"knowledge.catalog.updated":`Knowledge catalog updated`,"knowledge.catalog.enabled":`Knowledge catalog enabled`,"knowledge.catalog.disabled":`Knowledge catalog disabled`,"knowledge.catalog.removed":`Knowledge catalog removed`,"knowledge.catalog.install_failed":`Knowledge catalog install failed`,"v1.chat.completion":`App chat`};function K(e){let t=G[e];if(t)return t;let n=e.split(`.`).join(` `);return n.charAt(0).toUpperCase()+n.slice(1)}function q({entry:e,gezelName:t,projectName:n}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsx)(`span`,{className:`history-summary`,children:e.summary}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.at,title:u(e.at),children:l(e.at)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,title:e.kind,children:K(e.kind)}),n&&(0,h.jsx)(`span`,{className:`history-chip`,children:n}),t&&(0,h.jsx)(`span`,{className:`history-chip`,children:t})]})]})}function J({entry:e,gezelName:t,projectName:n}){let r=Math.max(1,Math.round(e.durationMs/6e4)),i=e.durationMs<6e4?`<1m`:`${r}m`;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`span`,{className:`history-line`,children:[(0,h.jsxs)(`span`,{className:`history-summary`,children:[t||e.gezelId,` · `,e.title]}),(0,h.jsx)(`time`,{className:`history-time`,dateTime:e.lastActivityAt,title:u(e.lastActivityAt),children:l(e.lastActivityAt)})]}),(0,h.jsxs)(`span`,{className:`history-meta`,children:[(0,h.jsx)(`span`,{className:`history-kind`,children:`Thread`}),n&&(0,h.jsx)(`span`,{className:`history-chip`,children:n}),(0,h.jsxs)(`span`,{className:`history-stat`,children:[e.messageCount,` msgs, `,i]})]})]})}export{C as HistoryView};
|