From 825d082003be1c0c1804f5b020159467b28c3323 Mon Sep 17 00:00:00 2001 From: Dorian Date: Sun, 8 Mar 2026 01:48:23 +0000 Subject: [PATCH] feat: add Ollama (local AI) integration for AIUI - Create Ollama provider plugin in AIUI (ollama-provider.ts) - Register Ollama alongside Claude in plugin system - Auto-detect installed models via /api/tags endpoint - Add Ollama proxy in mock backend (forwards to localhost:11434) - Add nginx proxy rules for /aiui/api/ollama/ (both HTTP and HTTPS) - Rebuild AIUI dist with Ollama provider included - Qwen 2.5 Coder 3B installed on dev server via Ollama Co-Authored-By: Claude Opus 4.6 --- ...age-DSb_6ger.js => BrowsePage-Au6xU1sq.js} | 2 +- ...tPage-DJ91DuFU.js => ChatPage-DTwFPy-s.js} | 6 +- ...e_type_script_setup_true_lang-DK0BUVLp.js} | 107 +++++++++--------- ....js => ConversationViewerPage-DWC47yHz.js} | 2 +- ...ail-BGcj4-yI.js => FilmDetail-B2H0Z1e1.js} | 2 +- ...e_type_script_setup_true_lang-BOBGVwtd.js} | 2 +- demo/aiui/assets/FilmGrid-Bxr1_fiQ.js | 1 + demo/aiui/assets/FilmGrid-CiiZxqHh.js | 1 - ...e_type_script_setup_true_lang-Cv6-zNyf.js} | 2 +- ...Page-WpEfI4F6.js => GuidePage-B_OyAhui.js} | 2 +- ...ail-BqYwtWIR.js => SongDetail-YK-Le0Qq.js} | 2 +- ...e_type_script_setup_true_lang-BGRNHJco.js} | 2 +- demo/aiui/assets/SongGrid-BN4Zarxz.js | 1 + demo/aiui/assets/SongGrid-R6zmbmn9.js | 1 - ...e_type_script_setup_true_lang-BOXkLn09.js} | 2 +- ...ode-uZHjueqh.js => ThreadNode-DaJ9aByD.js} | 2 +- ...D7-OiknV.js => WidgetDemoPage-Iclrl_KC.js} | 2 +- demo/aiui/assets/_basePickBy-CfV4NeNh.js | 1 - demo/aiui/assets/_basePickBy-DwJ1pklu.js | 1 + ...Uniq-QbfmlGUb.js => _baseUniq-Bk6YzBdk.js} | 2 +- .../{arc-Dpf0rwWj.js => arc-DDmIlb_Y.js} | 2 +- ... architectureDiagram-VXUJARFQ-DmRrQAYq.js} | 2 +- ...b.js => blockDiagram-VD42YOAC-Bn0u4W1G.js} | 2 +- ...p4O2.js => c4Diagram-YG6GDRKO-C-brKlkJ.js} | 2 +- demo/aiui/assets/channel-DmBfoHPu.js | 1 + demo/aiui/assets/channel-DrGX6hPm.js | 1 - .../{chat-DURlEZti.js => chat-Dx-Dx0vd.js} | 2 +- ...sMg-yi__.js => chunk-4BX2VUAB-C5nXGAHj.js} | 2 +- ...bmTd1fRc.js => chunk-55IACEB6-BkuxEf4w.js} | 2 +- ...Dd-gdJ2K.js => chunk-B4BG7PRW-BQav9PdJ.js} | 2 +- ...DqVtG1l0.js => chunk-DI55MBZ5-BH9hZRf0.js} | 2 +- ...lBKdz6Yh.js => chunk-FMBD7UC4-BW8Xs0oO.js} | 2 +- ...BqFe712_.js => chunk-QN33PNHL-__41nI0P.js} | 2 +- ...Bgqnzg5H.js => chunk-QZHKN3VN-DitCa0ck.js} | 2 +- ...CmhkYzx2.js => chunk-TZMSLE5B-C0gW3zRh.js} | 2 +- .../assets/classDiagram-2ON5EDUG-CKu6zgYo.js | 1 + .../assets/classDiagram-2ON5EDUG-D8ELH-6E.js | 1 - .../classDiagram-v2-WZHVMYZB-CKu6zgYo.js | 1 + .../classDiagram-v2-WZHVMYZB-D8ELH-6E.js | 1 - demo/aiui/assets/clone-Bhltwx1j.js | 1 - demo/aiui/assets/clone-DL4hXkhl.js | 1 + ...o.js => cose-bilkent-S5V4N54A-6ucfRUG4.js} | 2 +- ...Dxf2RdrI.js => dagre-6UL2VRFP-Ci6pJcPb.js} | 2 +- ...MZR0RN.js => diagram-PSM6KHXK-pv0hhM2l.js} | 2 +- ...BiUUiO.js => diagram-QEK2KX5R-DWcBhw56.js} | 2 +- ...PkWzKU.js => diagram-S2PKOQOG-DfTOlz3T.js} | 2 +- ...By5l.js => erDiagram-Q2GNP2WA-Br6HCsXp.js} | 2 +- demo/aiui/assets/film-renderer-CYpVwNyR.js | 2 + demo/aiui/assets/film-renderer-Cq_2td8O.js | 2 - ...nx.js => flowDiagram-NV44I4VS-BvN4KeD9.js} | 2 +- ...R.js => ganttDiagram-JELNMOA3-q91xyu3J.js} | 2 +- ...s => gitGraphDiagram-V2S2FVAM-C2LeaeGP.js} | 2 +- .../{graph-BEKdikt2.js => graph-C_AQVES1.js} | 2 +- .../{index-iNX5cLRF.js => index-BD9qoze1.js} | 16 +-- ...7D.js => infoDiagram-HS3SLOUP-D93ErRbW.js} | 2 +- ...js => journeyDiagram-XKPGCS4Q-CJKi1fxm.js} | 2 +- ...=> kanban-definition-3W4ZIXB7-3dSnDyOU.js} | 2 +- ...{layout-DhL2Cqsp.js => layout-B8BsJCKz.js} | 2 +- ...{linear-D4bfzEbI.js => linear-C8gXlzKZ.js} | 2 +- ...e-_VcdMFBU.js => mermaid.core-CJYA4M6R.js} | 10 +- ...> mindmap-definition-VGOIOE7T-CiQvifpn.js} | 2 +- demo/aiui/assets/ollama-provider-Ck1Tq0Ld.js | 2 + ...PGW.js => pieDiagram-ADFJNKIX-Dpk_NNhH.js} | 2 +- ...s => quadrantDiagram-AYHSOK5B-YXz0Sctj.js} | 2 +- ...> requirementDiagram-UZGBJVZJ-rvSNaNad.js} | 2 +- ....js => sankeyDiagram-TZEHDZUN-BvbSnReE.js} | 2 +- ...s => sequenceDiagram-WL72ISMW-vl_Vi7FC.js} | 2 +- demo/aiui/assets/song-renderer-Dfxndu0u.js | 2 + demo/aiui/assets/song-renderer-LEAE0oP0.js | 2 - ...I.js => stateDiagram-FKZM4ZOC-0gnLENSy.js} | 2 +- .../stateDiagram-v2-4FDKWEC3-BKfrE6D0.js | 1 - .../stateDiagram-v2-4FDKWEC3-DU4WuvUX.js | 1 + ... timeline-definition-IT6M3QCI-YZ3E6G6Y.js} | 2 +- ...uihRg0.js => treemap-GDKQZRPO-BONrJn_M.js} | 2 +- ...yMy70s.js => useContentImages-6RAIPaCD.js} | 2 +- ...Nostr-DMx0ZF7J.js => useNostr-BqBiQvAw.js} | 2 +- ...js => xychartDiagram-PRI3JC2R-BPRLFZFO.js} | 2 +- demo/aiui/index.html | 2 +- demo/aiui/sw.js | 2 +- image-recipe/configs/nginx-archipelago.conf | 28 +++++ neode-ui/docker/nginx-demo.conf | 12 ++ neode-ui/mock-backend.js | 68 +++++++++++ 82 files changed, 246 insertions(+), 135 deletions(-) rename demo/aiui/assets/{BrowsePage-DSb_6ger.js => BrowsePage-Au6xU1sq.js} (99%) rename demo/aiui/assets/{ChatPage-DJ91DuFU.js => ChatPage-DTwFPy-s.js} (99%) rename demo/aiui/assets/{ChatWindow.vue_vue_type_script_setup_true_lang-D6Di9NNl.js => ChatWindow.vue_vue_type_script_setup_true_lang-DK0BUVLp.js} (69%) rename demo/aiui/assets/{ConversationViewerPage-CmOz-8ZY.js => ConversationViewerPage-DWC47yHz.js} (96%) rename demo/aiui/assets/{FilmDetail-BGcj4-yI.js => FilmDetail-B2H0Z1e1.js} (51%) rename demo/aiui/assets/{FilmDetail.vue_vue_type_script_setup_true_lang-C2prgMoU.js => FilmDetail.vue_vue_type_script_setup_true_lang-BOBGVwtd.js} (97%) create mode 100644 demo/aiui/assets/FilmGrid-Bxr1_fiQ.js delete mode 100644 demo/aiui/assets/FilmGrid-CiiZxqHh.js rename demo/aiui/assets/{FilmGrid.vue_vue_type_script_setup_true_lang-BCGlNgEL.js => FilmGrid.vue_vue_type_script_setup_true_lang-Cv6-zNyf.js} (97%) rename demo/aiui/assets/{GuidePage-WpEfI4F6.js => GuidePage-B_OyAhui.js} (98%) rename demo/aiui/assets/{SongDetail-BqYwtWIR.js => SongDetail-YK-Le0Qq.js} (51%) rename demo/aiui/assets/{SongDetail.vue_vue_type_script_setup_true_lang-BbGQlf9S.js => SongDetail.vue_vue_type_script_setup_true_lang-BGRNHJco.js} (98%) create mode 100644 demo/aiui/assets/SongGrid-BN4Zarxz.js delete mode 100644 demo/aiui/assets/SongGrid-R6zmbmn9.js rename demo/aiui/assets/{SongGrid.vue_vue_type_script_setup_true_lang-Cpvl53RE.js => SongGrid.vue_vue_type_script_setup_true_lang-BOXkLn09.js} (97%) rename demo/aiui/assets/{ThreadNode-uZHjueqh.js => ThreadNode-DaJ9aByD.js} (95%) rename demo/aiui/assets/{WidgetDemoPage-D7-OiknV.js => WidgetDemoPage-Iclrl_KC.js} (97%) delete mode 100644 demo/aiui/assets/_basePickBy-CfV4NeNh.js create mode 100644 demo/aiui/assets/_basePickBy-DwJ1pklu.js rename demo/aiui/assets/{_baseUniq-QbfmlGUb.js => _baseUniq-Bk6YzBdk.js} (68%) rename demo/aiui/assets/{arc-Dpf0rwWj.js => arc-DDmIlb_Y.js} (98%) rename demo/aiui/assets/{architectureDiagram-VXUJARFQ-eRMb8q7Q.js => architectureDiagram-VXUJARFQ-DmRrQAYq.js} (99%) rename demo/aiui/assets/{blockDiagram-VD42YOAC-BFM_WKNb.js => blockDiagram-VD42YOAC-Bn0u4W1G.js} (99%) rename demo/aiui/assets/{c4Diagram-YG6GDRKO-Cuzep4O2.js => c4Diagram-YG6GDRKO-C-brKlkJ.js} (99%) create mode 100644 demo/aiui/assets/channel-DmBfoHPu.js delete mode 100644 demo/aiui/assets/channel-DrGX6hPm.js rename demo/aiui/assets/{chat-DURlEZti.js => chat-Dx-Dx0vd.js} (99%) rename demo/aiui/assets/{chunk-4BX2VUAB-sMg-yi__.js => chunk-4BX2VUAB-C5nXGAHj.js} (71%) rename demo/aiui/assets/{chunk-55IACEB6-bmTd1fRc.js => chunk-55IACEB6-BkuxEf4w.js} (72%) rename demo/aiui/assets/{chunk-B4BG7PRW-Dd-gdJ2K.js => chunk-B4BG7PRW-BQav9PdJ.js} (99%) rename demo/aiui/assets/{chunk-DI55MBZ5-DqVtG1l0.js => chunk-DI55MBZ5-BH9hZRf0.js} (99%) rename demo/aiui/assets/{chunk-FMBD7UC4-lBKdz6Yh.js => chunk-FMBD7UC4-BW8Xs0oO.js} (83%) rename demo/aiui/assets/{chunk-QN33PNHL-BqFe712_.js => chunk-QN33PNHL-__41nI0P.js} (87%) rename demo/aiui/assets/{chunk-QZHKN3VN-Bgqnzg5H.js => chunk-QZHKN3VN-DitCa0ck.js} (66%) rename demo/aiui/assets/{chunk-TZMSLE5B-CmhkYzx2.js => chunk-TZMSLE5B-C0gW3zRh.js} (95%) create mode 100644 demo/aiui/assets/classDiagram-2ON5EDUG-CKu6zgYo.js delete mode 100644 demo/aiui/assets/classDiagram-2ON5EDUG-D8ELH-6E.js create mode 100644 demo/aiui/assets/classDiagram-v2-WZHVMYZB-CKu6zgYo.js delete mode 100644 demo/aiui/assets/classDiagram-v2-WZHVMYZB-D8ELH-6E.js delete mode 100644 demo/aiui/assets/clone-Bhltwx1j.js create mode 100644 demo/aiui/assets/clone-DL4hXkhl.js rename demo/aiui/assets/{cose-bilkent-S5V4N54A-C44QSHWo.js => cose-bilkent-S5V4N54A-6ucfRUG4.js} (99%) rename demo/aiui/assets/{dagre-6UL2VRFP-Dxf2RdrI.js => dagre-6UL2VRFP-Ci6pJcPb.js} (97%) rename demo/aiui/assets/{diagram-PSM6KHXK-BiMZR0RN.js => diagram-PSM6KHXK-pv0hhM2l.js} (97%) rename demo/aiui/assets/{diagram-QEK2KX5R-BQBiUUiO.js => diagram-QEK2KX5R-DWcBhw56.js} (94%) rename demo/aiui/assets/{diagram-S2PKOQOG-DqPkWzKU.js => diagram-S2PKOQOG-DfTOlz3T.js} (92%) rename demo/aiui/assets/{erDiagram-Q2GNP2WA-CgrqBy5l.js => erDiagram-Q2GNP2WA-Br6HCsXp.js} (98%) create mode 100644 demo/aiui/assets/film-renderer-CYpVwNyR.js delete mode 100644 demo/aiui/assets/film-renderer-Cq_2td8O.js rename demo/aiui/assets/{flowDiagram-NV44I4VS-w-CkuMnx.js => flowDiagram-NV44I4VS-BvN4KeD9.js} (99%) rename demo/aiui/assets/{ganttDiagram-JELNMOA3-C-oJgEGR.js => ganttDiagram-JELNMOA3-q91xyu3J.js} (99%) rename demo/aiui/assets/{gitGraphDiagram-V2S2FVAM-B_QrAuku.js => gitGraphDiagram-V2S2FVAM-C2LeaeGP.js} (98%) rename demo/aiui/assets/{graph-BEKdikt2.js => graph-C_AQVES1.js} (97%) rename demo/aiui/assets/{index-iNX5cLRF.js => index-BD9qoze1.js} (89%) rename demo/aiui/assets/{infoDiagram-HS3SLOUP-B_dvws7D.js => infoDiagram-HS3SLOUP-D93ErRbW.js} (62%) rename demo/aiui/assets/{journeyDiagram-XKPGCS4Q-B9qXxPVY.js => journeyDiagram-XKPGCS4Q-CJKi1fxm.js} (98%) rename demo/aiui/assets/{kanban-definition-3W4ZIXB7-B72Y2SDu.js => kanban-definition-3W4ZIXB7-3dSnDyOU.js} (99%) rename demo/aiui/assets/{layout-DhL2Cqsp.js => layout-B8BsJCKz.js} (86%) rename demo/aiui/assets/{linear-D4bfzEbI.js => linear-C8gXlzKZ.js} (64%) rename demo/aiui/assets/{mermaid.core-_VcdMFBU.js => mermaid.core-CJYA4M6R.js} (99%) rename demo/aiui/assets/{mindmap-definition-VGOIOE7T-8KG9_8uc.js => mindmap-definition-VGOIOE7T-CiQvifpn.js} (99%) create mode 100644 demo/aiui/assets/ollama-provider-Ck1Tq0Ld.js rename demo/aiui/assets/{pieDiagram-ADFJNKIX-D-NTrPGW.js => pieDiagram-ADFJNKIX-Dpk_NNhH.js} (92%) rename demo/aiui/assets/{quadrantDiagram-AYHSOK5B-D3sJ_hI5.js => quadrantDiagram-AYHSOK5B-YXz0Sctj.js} (99%) rename demo/aiui/assets/{requirementDiagram-UZGBJVZJ-Ck037yFx.js => requirementDiagram-UZGBJVZJ-rvSNaNad.js} (99%) rename demo/aiui/assets/{sankeyDiagram-TZEHDZUN-CAwxXQrA.js => sankeyDiagram-TZEHDZUN-BvbSnReE.js} (99%) rename demo/aiui/assets/{sequenceDiagram-WL72ISMW-Cr4_tpXX.js => sequenceDiagram-WL72ISMW-vl_Vi7FC.js} (99%) create mode 100644 demo/aiui/assets/song-renderer-Dfxndu0u.js delete mode 100644 demo/aiui/assets/song-renderer-LEAE0oP0.js rename demo/aiui/assets/{stateDiagram-FKZM4ZOC-UksGMieI.js => stateDiagram-FKZM4ZOC-0gnLENSy.js} (96%) delete mode 100644 demo/aiui/assets/stateDiagram-v2-4FDKWEC3-BKfrE6D0.js create mode 100644 demo/aiui/assets/stateDiagram-v2-4FDKWEC3-DU4WuvUX.js rename demo/aiui/assets/{timeline-definition-IT6M3QCI-_j2Tetve.js => timeline-definition-IT6M3QCI-YZ3E6G6Y.js} (99%) rename demo/aiui/assets/{treemap-GDKQZRPO-DuuihRg0.js => treemap-GDKQZRPO-BONrJn_M.js} (99%) rename demo/aiui/assets/{useContentImages-8oyMy70s.js => useContentImages-6RAIPaCD.js} (90%) rename demo/aiui/assets/{useNostr-DMx0ZF7J.js => useNostr-BqBiQvAw.js} (98%) rename demo/aiui/assets/{xychartDiagram-PRI3JC2R-D9_pNjKg.js => xychartDiagram-PRI3JC2R-BPRLFZFO.js} (99%) diff --git a/demo/aiui/assets/BrowsePage-DSb_6ger.js b/demo/aiui/assets/BrowsePage-Au6xU1sq.js similarity index 99% rename from demo/aiui/assets/BrowsePage-DSb_6ger.js rename to demo/aiui/assets/BrowsePage-Au6xU1sq.js index a4822333..d34e3d03 100644 --- a/demo/aiui/assets/BrowsePage-DSb_6ger.js +++ b/demo/aiui/assets/BrowsePage-Au6xU1sq.js @@ -1,2 +1,2 @@ -import{a as M,c as o,F as b,g as E,b as s,e,n as F,t as p,L as g,i as y,r as w,P as B,k as D,K as L,o as T,M as H,Q as z,V as S,W as j}from"./index-iNX5cLRF.js";const V={class:"space-y-0.5"},A=["onClick"],O={key:1,class:"w-3 shrink-0"},I=["d"],R={class:"text-sm truncate"},N={key:0,class:"pl-4 ml-[18px] border-l border-white/5"},W="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",U="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z",G="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4",K="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z",X="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z",q=M({__name:"FileTree",props:{items:{}},emits:["selectFile"],setup(m,{emit:_}){const h=w(new Set),v=_;function n(l){if(l.isDirectory){const a=new Set(h.value);a.has(l.path)?a.delete(l.path):a.add(l.path),h.value=a}else v("selectFile",l)}const r=new Set(["ts","tsx","js","jsx","vue","svelte","py","rs","go","java","c","cpp","h","hpp","rb","php","swift","kt","cs","css","scss","less","html","xml","yaml","yml","toml","json","sh","bash","zsh","sql","md","mdx"]),c=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif"]);function x(l){return l.split(".").pop()?.toLowerCase()??""}function k(l){if(l.isDirectory)return"text-yellow-500/70";const a=x(l.name);return r.has(a)?"text-blue-400/70":c.has(a)?"text-green-400/70":"text-white/40"}function $(l){if(l.isDirectory)return h.value.has(l.path)?U:W;const a=x(l.name);return r.has(a)?G:c.has(a)?K:X}return(l,a)=>{const C=B("FileTree",!0);return s(),o("div",V,[(s(!0),o(b,null,E(m.items,u=>(s(),o("div",{key:u.path},[e("button",{class:F(["w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors min-h-[32px]",u.isDirectory?"hover:bg-white/5 text-white/70 hover:text-white/80":"hover:bg-white/8 text-white/60 hover:text-white/80"]),onClick:i=>n(u)},[u.isDirectory?(s(),o("svg",{key:0,class:F(["w-3 h-3 text-white/30 shrink-0 transition-transform duration-150",{"rotate-90":h.value.has(u.path)}]),fill:"currentColor",viewBox:"0 0 20 20"},[...a[1]||(a[1]=[e("path",{"fill-rule":"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z","clip-rule":"evenodd"},null,-1)])],2)):(s(),o("span",O)),(s(),o("svg",{class:F(["w-4 h-4 shrink-0",k(u)]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:$(u)},null,8,I)],2)),e("span",R,p(u.name),1)],10,A),u.isDirectory&&u.children?.length&&h.value.has(u.path)?(s(),o("div",N,[g(C,{items:u.children,onSelectFile:a[0]||(a[0]=i=>l.$emit("selectFile",i))},null,8,["items"])])):y("",!0)]))),128))])}}}),Q={class:"h-full flex flex-col"},J={class:"flex items-center justify-between px-4 py-3 border-b border-white/5 shrink-0"},Y={class:"min-w-0 flex-1"},Z={class:"text-sm font-medium text-white/80 truncate"},ee={class:"text-xs text-white/30 truncate mt-0.5"},te={class:"flex items-center gap-2 shrink-0 ml-3"},se={class:"text-xs text-white/25 font-mono"},oe={class:"flex-1 overflow-auto"},ne={class:"text-xs font-mono leading-relaxed w-full"},le={class:"text-white/20 text-right pr-4 pl-4 py-0 select-none align-top whitespace-nowrap sticky left-0 bg-[#0a0a0a]"},ae={class:"text-white/70 pr-4 py-0 whitespace-pre"},P=M({__name:"FilePreview",props:{file:{}},emits:["close"],setup(m){const _=m,h=D(()=>_.file.content.split(` +import{a as M,c as o,F as b,g as E,b as s,e,n as F,t as p,L as g,i as y,r as w,P as B,k as D,K as L,o as T,M as H,Q as z,V as S,W as j}from"./index-BD9qoze1.js";const V={class:"space-y-0.5"},A=["onClick"],O={key:1,class:"w-3 shrink-0"},I=["d"],R={class:"text-sm truncate"},N={key:0,class:"pl-4 ml-[18px] border-l border-white/5"},W="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z",U="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z",G="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4",K="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z",X="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z",q=M({__name:"FileTree",props:{items:{}},emits:["selectFile"],setup(m,{emit:_}){const h=w(new Set),v=_;function n(l){if(l.isDirectory){const a=new Set(h.value);a.has(l.path)?a.delete(l.path):a.add(l.path),h.value=a}else v("selectFile",l)}const r=new Set(["ts","tsx","js","jsx","vue","svelte","py","rs","go","java","c","cpp","h","hpp","rb","php","swift","kt","cs","css","scss","less","html","xml","yaml","yml","toml","json","sh","bash","zsh","sql","md","mdx"]),c=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp","avif"]);function x(l){return l.split(".").pop()?.toLowerCase()??""}function k(l){if(l.isDirectory)return"text-yellow-500/70";const a=x(l.name);return r.has(a)?"text-blue-400/70":c.has(a)?"text-green-400/70":"text-white/40"}function $(l){if(l.isDirectory)return h.value.has(l.path)?U:W;const a=x(l.name);return r.has(a)?G:c.has(a)?K:X}return(l,a)=>{const C=B("FileTree",!0);return s(),o("div",V,[(s(!0),o(b,null,E(m.items,u=>(s(),o("div",{key:u.path},[e("button",{class:F(["w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors min-h-[32px]",u.isDirectory?"hover:bg-white/5 text-white/70 hover:text-white/80":"hover:bg-white/8 text-white/60 hover:text-white/80"]),onClick:i=>n(u)},[u.isDirectory?(s(),o("svg",{key:0,class:F(["w-3 h-3 text-white/30 shrink-0 transition-transform duration-150",{"rotate-90":h.value.has(u.path)}]),fill:"currentColor",viewBox:"0 0 20 20"},[...a[1]||(a[1]=[e("path",{"fill-rule":"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z","clip-rule":"evenodd"},null,-1)])],2)):(s(),o("span",O)),(s(),o("svg",{class:F(["w-4 h-4 shrink-0",k(u)]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:$(u)},null,8,I)],2)),e("span",R,p(u.name),1)],10,A),u.isDirectory&&u.children?.length&&h.value.has(u.path)?(s(),o("div",N,[g(C,{items:u.children,onSelectFile:a[0]||(a[0]=i=>l.$emit("selectFile",i))},null,8,["items"])])):y("",!0)]))),128))])}}}),Q={class:"h-full flex flex-col"},J={class:"flex items-center justify-between px-4 py-3 border-b border-white/5 shrink-0"},Y={class:"min-w-0 flex-1"},Z={class:"text-sm font-medium text-white/80 truncate"},ee={class:"text-xs text-white/30 truncate mt-0.5"},te={class:"flex items-center gap-2 shrink-0 ml-3"},se={class:"text-xs text-white/25 font-mono"},oe={class:"flex-1 overflow-auto"},ne={class:"text-xs font-mono leading-relaxed w-full"},le={class:"text-white/20 text-right pr-4 pl-4 py-0 select-none align-top whitespace-nowrap sticky left-0 bg-[#0a0a0a]"},ae={class:"text-white/70 pr-4 py-0 whitespace-pre"},P=M({__name:"FilePreview",props:{file:{}},emits:["close"],setup(m){const _=m,h=D(()=>_.file.content.split(` `));function v(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}return(n,r)=>(s(),o("div",Q,[e("div",J,[e("div",Y,[e("p",Z,p(m.file.name),1),e("p",ee,p(m.file.path),1)]),e("div",te,[e("span",se,p(v(m.file.size)),1),e("button",{class:"min-w-[32px] min-h-[32px] flex items-center justify-center rounded-md text-white/40 hover:text-white/70 hover:bg-white/10 transition-colors","aria-label":"Close preview",onClick:r[0]||(r[0]=c=>n.$emit("close"))},[...r[1]||(r[1]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])]),e("div",oe,[e("table",ne,[e("tbody",null,[(s(!0),o(b,null,E(h.value,(c,x)=>(s(),o("tr",{key:x,class:"hover:bg-white/3"},[e("td",le,p(x+1),1),e("td",ae,p(c),1)]))),128))])])])]))}}),ie={class:"h-full flex flex-col bg-[#0a0a0a]"},re={class:"glass shrink-0 px-4 py-3 flex items-center gap-3 border-b border-white/5"},ce={class:"px-4 py-2 flex items-center gap-1 text-xs text-white/40 shrink-0"},ue={class:"text-white/60 min-h-[28px] px-1 flex items-center"},he={class:"flex-1 overflow-hidden flex"},de={class:"flex-1 overflow-y-auto px-2 py-2"},pe={key:0,class:"flex items-center justify-center h-32"},ve={key:1,class:"flex items-center justify-center h-32"},fe={class:"text-sm text-red-400/70"},xe={key:2,class:"space-y-1"},we=["onClick"],me={class:"min-w-0 flex-1"},_e={class:"text-sm text-white/80 truncate group-hover:text-white/90"},ke={class:"text-xs text-white/25 truncate"},ge={key:0,class:"w-[400px] xl:w-[500px] border-l border-white/5 overflow-y-auto shrink-0"},ye={key:0,class:"fixed inset-0 z-50 bg-[#0a0a0a] overflow-y-auto"},Ce=M({__name:"BrowsePage",setup(m){const _=w([]),h=w([]),v=w(!0),n=w(""),r=w(null),c=w(null),x=w(window.innerWidth),k=D(()=>x.value<1024);async function $(){v.value=!0,n.value="";try{const i=await j("/api/fs/list");if(!i.ok)throw new Error(`Failed to load: ${i.status}`);const t=await i.json();_.value=t.projects??[]}catch(i){n.value=i instanceof Error?i.message:"Failed to load projects"}finally{v.value=!1}}async function l(i){r.value=i,c.value=null,v.value=!0,n.value="";try{const t=await j(`/api/fs/tree?path=${encodeURIComponent(i.path)}`);if(!t.ok)throw new Error(`Failed to load: ${t.status}`);const d=await t.json();h.value=d.files??[]}catch(t){n.value=t instanceof Error?t.message:"Failed to load files"}finally{v.value=!1}}function a(){r.value=null,c.value=null,h.value=[]}async function C(i){if(!r.value)return;const t=r.value.path+"/"+i.path;try{const d=await j(`/api/fs/read?path=${encodeURIComponent(t)}`);if(!d.ok){if(d.status===413){n.value="File too large to preview (max 1MB)";return}throw new Error(`Failed to read: ${d.status}`)}const f=await d.json();c.value={name:i.name,path:i.path,content:f.content,size:f.size}}catch(d){n.value=d instanceof Error?d.message:"Failed to read file"}}function u(){x.value=window.innerWidth}return L(()=>{$(),window.addEventListener("resize",u)}),T(()=>{window.removeEventListener("resize",u)}),(i,t)=>{const d=B("router-link");return s(),o("div",ie,[e("header",re,[g(d,{to:"/",class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded-lg text-white/60 hover:text-white/80 hover:bg-white/10 transition-colors","aria-label":"Back to chat"},{default:H(()=>[...t[2]||(t[2]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1}),t[3]||(t[3]=e("h1",{class:"text-white/90 text-base font-medium truncate"},"Files",-1))]),e("nav",ce,[e("button",{class:"hover:text-white/70 transition-colors min-h-[28px] px-1",onClick:a}," Projects "),r.value?(s(),o(b,{key:0},[t[4]||(t[4]=e("span",{class:"text-white/20"},"/",-1)),e("span",ue,p(r.value.name),1)],64)):y("",!0)]),e("main",he,[e("div",de,[v.value?(s(),o("div",pe,[...t[5]||(t[5]=[e("span",{class:"text-sm text-white/50"},"Loading...",-1)])])):n.value?(s(),o("div",ve,[e("span",fe,p(n.value),1)])):r.value?(s(),z(q,{key:3,items:h.value,onSelectFile:C},null,8,["items"])):(s(),o("div",xe,[(s(!0),o(b,null,E(_.value,f=>(s(),o("button",{key:f.path,class:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left hover:bg-white/5 transition-colors group",onClick:be=>l(f)},[t[6]||(t[6]=e("svg",{class:"w-5 h-5 text-white/30 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})],-1)),e("div",me,[e("p",_e,p(f.name),1),e("p",ke,p(f.language),1)])],8,we))),128))]))]),c.value&&!k.value?(s(),o("aside",ge,[g(P,{file:c.value,onClose:t[0]||(t[0]=f=>c.value=null)},null,8,["file"])])):y("",!0)]),(s(),z(S,{to:"body"},[c.value&&k.value?(s(),o("div",ye,[g(P,{file:c.value,onClose:t[1]||(t[1]=f=>c.value=null)},null,8,["file"])])):y("",!0)]))])}}});export{Ce as default}; diff --git a/demo/aiui/assets/ChatPage-DJ91DuFU.js b/demo/aiui/assets/ChatPage-DTwFPy-s.js similarity index 99% rename from demo/aiui/assets/ChatPage-DJ91DuFU.js rename to demo/aiui/assets/ChatPage-DTwFPy-s.js index d5794fbd..30f05a24 100644 --- a/demo/aiui/assets/ChatPage-DJ91DuFU.js +++ b/demo/aiui/assets/ChatPage-DTwFPy-s.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useNostr-DMx0ZF7J.js","assets/index-iNX5cLRF.js","assets/index-BNvE9-tw.css","assets/ThreadNode-uZHjueqh.js"])))=>i.map(i=>d[i]); -import{a as G,Z as qt,$ as rt,p as Ne,b as s,c as n,e,h as q,u as t,n as i,t as u,f as ie,w as W,v as J,F as I,g as P,i as f,j as Z,r as S,k as B,a0 as Gt,a1 as ct,N as ne,a2 as dt,a3 as ut,a4 as ht,a5 as xt,U as De,a6 as Ot,a7 as Ht,a8 as Wt,P as Kt,z as xe,Q as U,K as le,a9 as ae,aa as ye,_ as pt,A as ce,B as Pe,d as Yt,ab as Qt,L as se,ac as Jt,ad as Zt,ae as Xt,S as es,q as ts,af as ss,o as ns,M as ue,ag as Le,ah as ls}from"./index-iNX5cLRF.js";import{u as os}from"./chat-DURlEZti.js";import{u as $e,a as pe,e as He,d as gt,M as as,b as is,s as rs,c as cs,f as fe,_ as tt}from"./ChatWindow.vue_vue_type_script_setup_true_lang-D6Di9NNl.js";import{_ as ds}from"./FilmGrid.vue_vue_type_script_setup_true_lang-BCGlNgEL.js";import{u as Ae}from"./useContentImages-8oyMy70s.js";import{_ as us}from"./SongGrid.vue_vue_type_script_setup_true_lang-Cpvl53RE.js";import{useNostr as Ie}from"./useNostr-DMx0ZF7J.js";import{u as bt,_ as hs}from"./FilmDetail.vue_vue_type_script_setup_true_lang-C2prgMoU.js";import{_ as xs}from"./SongDetail.vue_vue_type_script_setup_true_lang-BbGQlf9S.js";const ps={class:"h-full flex flex-col"},gs={class:"flex items-center justify-between gap-2"},bs={class:"flex items-center gap-2 shrink-0"},vs={key:0,class:"flex flex-wrap gap-1.5"},fs=["onClick"],ms={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},ws={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},ys=["aria-label","onClick"],ks={class:"cover-card flex-1 min-h-0 relative"},$s={key:0,class:"absolute inset-0 animate-shimmer"},_s=["src","alt","onError"],Cs=["src","alt"],js={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Ss={class:"absolute bottom-0 left-0 right-0 p-2"},Ms={class:"text-xs font-semibold text-white/90 leading-tight truncate"},Ts={class:"text-xs text-white/40 truncate mt-0.5"},Ds={key:4,class:"absolute top-1.5 left-1.5"},Is={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-medium"},Bs={key:5,class:"absolute top-1.5 right-1.5"},Ls={class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},Ps={key:0,class:"flex items-center justify-center py-12"},Ns=G({__name:"BookGrid",props:{books:{},title:{default:"Recommended Books"}},emits:["selectBook"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"books"),id:d=>d.id,existingUrl:d=>d.coverUrl,fetch:d=>rt(d.title,d.author),fallback:d=>qt(d.title,d.author)}),_=B(()=>{const d=new Map;for(const o of c.books)for(const r of o.genres??[])d.set(r,(d.get(r)??0)+1);return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.books;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.title.toLowerCase().includes(o)||r.author.toLowerCase().includes(o)||(r.genres??[]).some(h=>h.toLowerCase().includes(o)))}return g.value&&(d=d.filter(o=>(o.genres??[]).includes(g.value))),d});return(d,o)=>(s(),n("div",ps,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",gs,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",bs,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" books ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search books...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),_.value.length>0?(s(),n("div",vs,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,fs))),128))])):f("",!0)],4),e("div",ms,[e("div",ws,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":`${r.title} by ${r.author}`,onClick:h=>d.$emit("selectBook",r)},[e("div",ks,[e("div",{class:i(["aspect-[2/3] relative w-full overflow-hidden rounded-[10px]",t(v)(r)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(r)?(s(),n("div",$s)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:`${r.title} by ${r.author}`,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,_s)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.title,class:"w-full h-full object-cover"},null,8,Cs)),t(v)(r)?(s(),n("div",js)):f("",!0),e("div",Ss,[e("p",Ms,u(r.title),1),e("p",Ts,u(r.author),1)]),r.rating?(s(),n("div",Ds,[e("span",Is," ★ "+u(r.rating.toFixed(1)),1)])):f("",!0),r.year?(s(),n("div",Bs,[e("span",Ls,u(r.year),1)])):f("",!0)],2)])],8,ys))),128))]),b.value.length===0?(s(),n("div",Ps,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No books match your search ",2)])):f("",!0)])]))}}),As={class:"h-full flex flex-col"},zs={class:"flex items-center justify-between gap-2"},Es={class:"flex items-center gap-2 shrink-0"},Fs={key:0,class:"flex flex-wrap gap-1.5"},Rs=["onClick"],Vs={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Us={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},qs=["aria-label","onClick"],Gs={class:"cover-card flex-1 min-h-0 relative"},Os={key:0,class:"absolute inset-0 animate-shimmer"},Hs=["src","alt","onError"],Ws=["src","alt"],Ks={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Ys={class:"absolute bottom-0 left-0 right-0 p-2"},Qs={class:"text-xs font-semibold text-white/90 leading-tight truncate"},Js={class:"text-xs text-white/40 truncate mt-0.5"},Zs={key:4,class:"absolute top-1.5 left-1.5"},Xs={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-medium"},en={key:5,class:"absolute top-1.5 right-1.5"},tn={class:"absolute top-1.5 right-1.5 flex gap-0.5 flex-wrap justify-end max-w-[60%]"},sn={key:0,class:"flex items-center justify-center py-12"},nn=G({__name:"TVSeriesGrid",props:{series:{},title:{default:"Recommended TV Series"}},emits:["selectSeries"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"series"),id:o=>o.id,existingUrl:o=>o.posterUrl||o.backdropUrl,fetch:o=>ct(o.title,o.year).then(r=>r.posterUrl),fallback:o=>Gt(o.title,o.year)});function _(o){return o.year?o.endYear&&o.endYear!==o.year?`${o.year}–${o.endYear}`:o.status==="ongoing"?`${o.year}–`:String(o.year):""}const b=B(()=>{const o=new Map;for(const r of c.series)for(const h of r.genres??[])o.set(h,(o.get(h)??0)+1);return[...o.entries()].sort((r,h)=>h[1]-r[1]).slice(0,8).map(([r])=>r)}),d=B(()=>{let o=c.series;if(w.value){const r=w.value.toLowerCase();o=o.filter(h=>h.title.toLowerCase().includes(r)||(h.creator??"").toLowerCase().includes(r)||(h.network??"").toLowerCase().includes(r)||(h.genres??[]).some(M=>M.toLowerCase().includes(r)))}return g.value&&(o=o.filter(r=>(r.genres??[]).includes(g.value))),o});return(o,r)=>(s(),n("div",As,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",zs,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Es,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(d.value.length)+" series ",3),ie(o.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":r[0]||(r[0]=h=>w.value=h),type:"text",placeholder:"Search TV series...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),b.value.length>0?(s(),n("div",Fs,[(s(!0),n(I,null,P(b.value,h=>(s(),n("button",{key:h,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===h?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:M=>g.value=g.value===h?null:h},u(h),11,Rs))),128))])):f("",!0)],4),e("div",Vs,[e("div",Us,[(s(!0),n(I,null,P(d.value,h=>(s(),n("button",{key:h.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":h.title,onClick:M=>o.$emit("selectSeries",h)},[e("div",Gs,[e("div",{class:i(["aspect-[2/3] relative w-full overflow-hidden rounded-[10px]",t(v)(h)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(h)?(s(),n("div",Os)):f("",!0),t(v)(h)?(s(),n("img",{key:1,src:t(v)(h),alt:`${h.title} — TV Series`,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:M=>t(m)(h)},null,40,Hs)):t($)(h)?f("",!0):(s(),n("img",{key:2,src:t(x)(h),alt:h.title,class:"w-full h-full object-cover"},null,8,Ws)),t(v)(h)?(s(),n("div",Ks)):f("",!0),e("div",Ys,[e("p",Qs,u(h.title),1),e("p",Js,[ne(u(_(h)),1),h.seasons?(s(),n(I,{key:0},[ne(" · "+u(h.seasons)+"S",1)],64)):f("",!0)])]),h.rating?(s(),n("div",Zs,[e("span",Xs," ★ "+u(h.rating.toFixed(1)),1)])):f("",!0),h.status==="ongoing"?(s(),n("div",en,[...r[1]||(r[1]=[e("span",{class:"text-xs px-1 py-0.5 rounded bg-emerald-500/80 text-white backdrop-blur-sm"}," ongoing ",-1)])])):f("",!0),e("div",tn,[(s(!0),n(I,null,P((h.sources??[]).slice(0,2),M=>(s(),n("span",{key:M.type,class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},u(M.type),1))),128))])],2)])],8,qs))),128))]),d.value.length===0?(s(),n("div",sn,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No TV series match your search ",2)])):f("",!0)])]))}}),ln={class:"h-full flex flex-col"},on={class:"flex items-center justify-between gap-2"},an={class:"flex items-center gap-2 shrink-0"},rn={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},cn={class:"columns-2 sm:columns-3 gap-3 space-y-3"},dn=["aria-label","onClick"],un=["src","alt","onError"],hn={key:2,class:"absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-black/70 via-black/30 to-transparent"},xn={key:0,class:"text-xs font-medium text-white/90 truncate"},pn={key:1,class:"text-xs text-white/50 truncate"},gn={key:0,class:"flex items-center justify-center py-12"},bn=G({__name:"ImageGrid",props:{images:{},title:{default:"Images"}},emits:["selectImage"],setup(a){const{isDark:c}=Z(),l=S(new Set);function w(g){l.value.add(g.id),l.value=new Set(l.value)}return(g,v)=>(s(),n("div",ln,[e("div",{class:"p-4 space-y-3",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",on,[e("h3",{class:i(["text-sm font-bold",t(c)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",an,[e("span",{class:i(["text-xs font-mono",t(c)?"text-white/30":"text-gray-400"])},u(a.images.length)+" images ",3),ie(g.$slots,"header-actions")])])],4),e("div",rn,[e("div",cn,[(s(!0),n(I,null,P(a.images,x=>(s(),n("button",{key:x.id,class:i(["group w-full break-inside-avoid text-left rounded-xl overflow-hidden transition-all duration-200 hover:brightness-110 relative",t(c)?"bg-white/5":"bg-black/3"]),"aria-label":x.alt||x.title||"Image",onClick:m=>g.$emit("selectImage",x)},[l.value.has(x.id)?(s(),n("div",{key:1,class:i(["w-full aspect-[4/3] flex items-center justify-center",t(c)?"bg-white/5":"bg-black/5"])},[(s(),n("svg",{class:i(["w-8 h-8",t(c)?"text-white/15":"text-gray-300"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...v[0]||(v[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},null,-1)])],2))],2)):(s(),n("img",{key:0,src:x.url,alt:x.alt||x.title||"Image",class:"w-full block transition-transform duration-300 group-hover:scale-[1.03]",loading:"lazy",onError:m=>w(x)},null,40,un)),x.title||x.source?(s(),n("div",hn,[x.title?(s(),n("p",xn,u(x.title),1)):f("",!0),x.source?(s(),n("p",pn,u(x.source),1)):f("",!0)])):f("",!0)],10,dn))),128))]),a.images.length===0?(s(),n("div",gn,[e("p",{class:i(["text-sm",t(c)?"text-white/30":"text-gray-400"])}," No images found ",2)])):f("",!0)])]))}}),vn={class:"h-full flex flex-col"},fn={class:"p-4 space-y-3"},mn={class:"flex items-center justify-between"},wn={class:"shrink-0 flex items-center gap-2"},yn={key:0,class:"flex flex-wrap gap-1.5"},kn=["onClick"],$n={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pb-16"},_n={class:"grid grid-cols-2 sm:grid-cols-3 gap-3"},Cn=["aria-label","onClick"],jn={class:"aspect-[4/3] relative w-full overflow-hidden rounded-t-[10px]"},Sn={key:0,class:"absolute inset-0 animate-shimmer"},Mn=["src","alt","onError"],Tn=["src","alt"],Dn={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},In={class:"absolute bottom-0 left-0 right-0 p-2"},Bn={class:"text-xs font-semibold text-white/90 truncate"},Ln={class:"text-xs text-white/40 truncate mt-0.5"},Pn={key:4,class:"absolute top-1.5 right-1.5"},Nn={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-semibold"},An={key:5,class:"absolute top-1.5 left-1.5"},zn={class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},En={key:0,class:"flex items-center justify-center py-12"},Fn=G({__name:"PlaceGrid",props:{places:{},title:{default:"Places"}},emits:["selectPlace"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"places"),id:d=>d.id,existingUrl:d=>d.photoUrl,fetch:d=>ut(d.name,d.city),fallback:d=>dt(d.name,d.cuisine||d.category)}),_=B(()=>{const d=new Map;for(const o of c.places){const r=o.cuisine||o.category;r&&d.set(r,(d.get(r)??0)+1)}return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.places;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.name.toLowerCase().includes(o)||r.cuisine?.toLowerCase().includes(o)||r.category?.toLowerCase().includes(o)||r.city?.toLowerCase().includes(o)||r.address?.toLowerCase().includes(o))}return g.value&&(d=d.filter(o=>o.cuisine===g.value||o.category===g.value)),d});return(d,o)=>(s(),n("div",vn,[e("div",fn,[e("div",mn,[e("h3",{class:i(["text-base font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title||"Places"),3),e("div",wn,[e("span",{class:i(["text-xs",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" places ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search places...",class:i(["w-full text-base px-3 py-2 rounded-lg outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder-white/25 focus:bg-white/8":"bg-black/5 text-gray-800 placeholder-gray-400 focus:bg-black/8"])},null,2),[[J,w.value]]),_.value.length>1?(s(),n("div",yn,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md font-medium transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"bg-white/5 text-white/40 hover:text-white/70":"bg-black/5 text-gray-500 hover:text-gray-800"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,kn))),128))])):f("",!0)]),e("div",$n,[e("div",_n,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":r.name,onClick:h=>d.$emit("selectPlace",r)},[e("div",jn,[t($)(r)?(s(),n("div",Sn)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:r.name,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,Mn)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.name,class:"w-full h-full object-cover"},null,8,Tn)),t(v)(r)?(s(),n("div",Dn)):f("",!0),e("div",In,[e("p",Bn,u(r.name),1),e("p",Ln,u(r.cuisine||r.category),1)]),r.rating?(s(),n("div",Pn,[e("span",Nn," ★ "+u(r.rating.toFixed(1)),1)])):f("",!0),r.priceLevel?(s(),n("div",An,[e("span",zn,u("$".repeat(r.priceLevel)),1)])):f("",!0)])],8,Cn))),128))]),b.value.length===0?(s(),n("div",En,[e("p",{class:i(["text-xs",t(l)?"text-white/30":"text-gray-400"])}," No places match your search ",2)])):f("",!0)])]))}}),Rn={class:"h-full flex flex-col"},Vn={class:"flex items-center justify-between gap-2"},Un={class:"flex items-center gap-2 shrink-0"},qn={key:0,class:"flex flex-wrap gap-1.5"},Gn=["onClick"],On={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Hn={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},Wn=["aria-label","onClick"],Kn={class:"cover-card flex-1 min-h-0 relative"},Yn={key:0,class:"absolute inset-0 animate-shimmer"},Qn=["src","alt","onError"],Jn=["src","alt"],Zn={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Xn={class:"absolute bottom-0 left-0 right-0 p-2"},el={class:"text-xs font-semibold text-white/90 leading-tight truncate"},tl={class:"text-xs text-white/40 truncate mt-0.5"},sl={class:"absolute top-1.5 right-1.5 flex gap-0.5 flex-wrap justify-end max-w-[60%]"},nl={key:0,class:"flex items-center justify-center py-12"},ll=G({__name:"PodcastGrid",props:{podcasts:{},title:{default:"Recommended Podcasts"}},emits:["selectPodcast"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"podcasts"),id:d=>d.id,existingUrl:d=>d.coverUrl,fetch:d=>xt(d.title,d.host),fallback:d=>ht(d.title,d.host)}),_=B(()=>{const d=new Map;for(const o of c.podcasts)for(const r of o.genres??[])d.set(r,(d.get(r)??0)+1);return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.podcasts;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.title.toLowerCase().includes(o)||(r.host??"").toLowerCase().includes(o)||(r.genres??[]).some(h=>h.toLowerCase().includes(o)))}return g.value&&(d=d.filter(o=>(o.genres??[]).includes(g.value))),d});return(d,o)=>(s(),n("div",Rn,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Vn,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Un,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" podcasts ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search podcasts...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),_.value.length>0?(s(),n("div",qn,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,Gn))),128))])):f("",!0)],4),e("div",On,[e("div",Hn,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":r.title,onClick:h=>d.$emit("selectPodcast",r)},[e("div",Kn,[e("div",{class:i(["aspect-square relative w-full overflow-hidden rounded-[10px]",t(v)(r)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(r)?(s(),n("div",Yn)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:r.title,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,Qn)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.title,class:"w-full h-full object-cover"},null,8,Jn)),t(v)(r)?(s(),n("div",Zn)):f("",!0),e("div",Xn,[e("p",el,u(r.title),1),e("p",tl,u(r.host||"Podcast"),1)]),e("div",sl,[(s(!0),n(I,null,P(r.sources.slice(0,2),h=>(s(),n("span",{key:h.type,class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},u(h.type),1))),128))])],2)])],8,Wn))),128))]),b.value.length===0?(s(),n("div",nl,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No podcasts match your search ",2)])):f("",!0)])]))}}),ol={class:"shrink-0"},al={class:"flex-1 overflow-y-auto custom-scrollbar"},il={key:0,class:"relative overflow-hidden",style:{minHeight:"180px"}},rl={class:"absolute inset-0"},cl=["src"],dl={class:"relative z-10 flex flex-col justify-end h-full px-5 pb-5 pt-12",style:{"min-height":"180px"}},ul={class:"px-3 pt-2 pb-8"},hl={key:0,"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 2a10 10 0 100 20 10 10 0 000-20zm0 0v2m0 16v2m10-10h-2M4 12H2m15.07-5.07l-1.41 1.41M8.34 15.66l-1.41 1.41m0-11.14l1.41 1.41m7.32 7.32l1.41 1.41"},xl={key:1,"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"},pl={key:2,"stroke-linecap":"round","stroke-linejoin":"round",d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"},gl={key:3,"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 6h16M4 12h16M4 18h7"},bl=["onClick"],vl=["onClick"],fl={key:1,class:"flex items-center justify-center py-16 px-4"},ml=G({__name:"MagazineGrid",props:{sections:{},heroImageUrl:{default:null},title:{default:"Brief"},query:{default:""}},setup(a){const c=a,{isDark:l}=Z(),{openMagazineSectionDetail:w}=$e(),g=["compass","bookmark","lightning","lines"];function v(b){return b.replace(/\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/g,"").replace(/\uFE0F/g,"").replace(new RegExp("(?:^|(?<=\\s))[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]+\\s*","gu"),"").replace(/---+/g,"").replace(/^#+\s*/gm,"").replace(/\*\*/g,"").replace(/\*([^*\n]+)\*/g,"$1").replace(/\|/g,", ").replace(/,\s*,+/g,",").replace(/^\s*[-•]\s+/gm,"").replace(/\n+/g," ").replace(/(^|\s),\s*/g,"$1").trim()}function x(b,d){const o=v(b);return o.length<=d?o:o.slice(0,d).replace(/\s+\S*$/,"")+" ..."}const m=B(()=>{const b=[],d=c.sections;if(!d.length)return b;let o=0;for(const j of c.query||"brief")o=(o<<5)-o+j.charCodeAt(0)|0;let r="",h=0,M=!1;return d.forEach((j,L)=>{if(L===0&&!j.group){b.push({type:"wide",title:j.title,text:x(j.content,200),label:"The Lead",author:j.author,section:j});return}const D=j.group||"";if(D&&D!==r&&(M&&(b.push({type:"dark",title:"",text:""}),M=!1),b.push({type:"banner",title:"",text:"",icon:g[h%g.length],label:D}),h++,r=D),D){const C=M?"dark":"half",k=v(j.content),p=v(j.title),y=k.toLowerCase().startsWith(p.toLowerCase().slice(0,30));b.push({type:C,title:y?"":j.title,text:x(j.content,y?160:100),section:j}),M=!M}else M&&(b.push({type:"dark",title:"",text:""}),M=!1),b.push({type:"wide",title:j.title,text:x(j.content,180),author:j.author,section:j})}),M&&b.push({type:"dark",title:"",text:""}),b});function $(b){const d=c.sections.indexOf(b);w(b,d>=0?d:0)}const _=B(()=>{const b=(c.query??"").trim();return b?b.length>100?b.slice(0,97)+"...":b:c.title});return(b,d)=>(s(),n("div",{class:i(["magazine h-full flex flex-col",t(l)?"magazine-dark":"magazine-light"])},[e("header",{class:i(["shrink-0 px-5 py-4 flex items-center justify-between border-b",t(l)?"border-white/10":"border-black/10"])},[e("h1",{class:i(["font-serif text-xl font-bold tracking-tight",t(l)?"text-white":"text-black"])}," AI Brief ",2),e("div",ol,[ie(b.$slots,"header-actions",{},void 0,!0)])],2),e("div",al,[_.value?(s(),n("div",il,[e("div",rl,[a.heroImageUrl?(s(),n("img",{key:0,src:a.heroImageUrl,alt:"",class:"w-full h-full object-cover",style:{filter:"saturate(0.3) contrast(1.1)"}},null,8,cl)):(s(),n("div",{key:1,class:i(["w-full h-full",t(l)?"bg-gradient-to-br from-white/[0.04] via-white/[0.02] to-transparent":"bg-gradient-to-br from-black/[0.06] via-black/[0.03] to-transparent"])},null,2))]),e("div",{class:i(["absolute inset-0",t(l)?"bg-gradient-to-t from-[#0a0a0a] via-[#0a0a0a]/80 to-[#0a0a0a]/60":"bg-gradient-to-t from-[#faf9f6] via-[#faf9f6]/85 to-[#faf9f6]/65"])},null,2),e("div",dl,[e("p",{class:i(["text-xs uppercase tracking-[0.3em] font-medium mb-2",t(l)?"text-white/40":"text-black/40"])}," In response to ",2),e("p",{class:i(["font-serif text-2xl italic leading-tight",t(l)?"text-white/70":"text-black/60"])},u(_.value),3)])])):f("",!0),e("div",ul,[e("div",{class:i(["grid grid-cols-2 gap-px",t(l)?"bg-white/12":"bg-black/10"])},[(s(!0),n(I,null,P(m.value,(o,r)=>(s(),n(I,{key:r},[o.type==="banner"?(s(),n("div",{key:0,class:i(["col-span-2 flex flex-col items-center justify-center py-8 px-5",t(l)?"bg-[#0a0a0a]":"bg-[#faf9f6]"])},[(s(),n("svg",{class:i(["w-5 h-5 mb-2.5",t(l)?"text-white/20":"text-black/15"]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[o.icon==="compass"?(s(),n("path",hl)):o.icon==="bookmark"?(s(),n("path",xl)):o.icon==="lightning"?(s(),n("path",pl)):(s(),n("path",gl))],2)),e("p",{class:i(["text-xs uppercase tracking-[0.3em] font-semibold text-center",t(l)?"text-white/30":"text-black/30"])},u(o.label),3)],2)):o.type==="wide"?(s(),n("button",{key:1,class:i(["col-span-2 text-left px-5 py-5 transition-colors cursor-pointer",t(l)?"bg-[#0a0a0a] hover:bg-white/[0.03]":"bg-[#faf9f6] hover:bg-black/[0.02]"]),onClick:h=>o.section&&$(o.section)},[o.label?(s(),n("p",{key:0,class:i(["text-xs uppercase tracking-[0.3em] font-semibold mb-2",t(l)?"text-white/30":"text-black/35"])},u(o.label),3)):f("",!0),e("h2",{class:i(["font-serif text-lg font-bold leading-snug mb-2",t(l)?"text-white/95":"text-black/90"])},u(o.title),3),o.author?(s(),n("p",{key:1,class:i(["text-xs mb-2",t(l)?"text-white/40":"text-black/40"])}," By "+u(o.author),3)):f("",!0),e("p",{class:i(["font-serif text-sm leading-relaxed",t(l)?"text-white/70":"text-black/60"])},u(o.text),3)],10,bl)):(s(),n("button",{key:2,class:i(["text-left px-4 py-4 transition-colors flex flex-col cursor-pointer",[t(l)?"bg-[#0a0a0a] hover:bg-white/[0.03]":"bg-[#faf9f6] hover:bg-black/[0.02]",o.type==="dark"?t(l)?"bg-white/[0.04]":"bg-black/[0.04]":""]]),onClick:h=>o.section&&$(o.section)},[o.label?(s(),n("p",{key:0,class:i(["text-xs uppercase tracking-[0.25em] font-semibold mb-1.5",t(l)?"text-white/25":"text-black/30"])},u(o.label),3)):f("",!0),o.title?(s(),n("h3",{key:1,class:i(["font-serif text-sm font-bold leading-snug mb-1",t(l)?"text-white/90":"text-black/85"])},u(o.title),3)):f("",!0),e("p",{class:i(["font-serif text-xs leading-relaxed flex-1",[t(l)?"text-white/55":"text-black/50",o.title?"":"italic"]])},u(o.text),3)],10,vl))],64))),128))],2)]),a.sections.length===0?(s(),n("div",fl,[e("p",{class:i(["text-sm",t(l)?"text-white/40":"text-gray-400"])}," No sections to display ",2)])):f("",!0)])],2))}}),st=De(ml,[["__scopeId","data-v-02741b8c"]]),wl={class:"h-full flex flex-col"},yl={class:"flex items-center justify-between gap-2"},kl={class:"flex items-center gap-2 shrink-0"},$l=["placeholder"],_l={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Cl={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},jl=["aria-label","onClick"],Sl={class:"cover-card flex-1 min-h-0 relative"},Ml={class:"aspect-[4/3] flex flex-col w-full overflow-hidden rounded-[10px]"},Tl={class:"flex-1 min-h-0 relative"},Dl=["src","alt","onError"],Il={key:2,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent pointer-events-none"},Bl={key:0,class:"flex items-center justify-center py-12"},nt=G({__name:"NewsGrid",props:{articles:{},title:{default:"News & Articles"},query:{default:""},variant:{default:"news"}},setup(a){const c=a,{isDark:l}=Z(),{openArticleDetail:w,openWebsiteDetail:g}=$e(),v=S(""),x=S(new Set);function m(h){return!h||typeof h!="string"?!1:/^https?:\/\//i.test(h.trim())}function $(h){x.value=new Set([...x.value,h])}function _(h){try{return new URL(h).hostname.replace(/^www\./,"")}catch{return h}}function b(h){return c.variant==="websites"?Ot(h.title,_(h.url)):Ht(h.title,_(h.url))}function d(h){c.variant==="websites"?g(h):w(h)}function o(h,M){if(!M.trim())return 0;const L=M.toLowerCase().split(/\s+/).filter(y=>y.length>1);if(L.length===0)return 0;const D=h.title.toLowerCase(),C=(h.content??"").toLowerCase(),k=h.url.toLowerCase();let p=0;for(const y of L)D.includes(y)&&(p+=3),C.includes(y)&&(p+=2),k.includes(y)&&(p+=1);return p}const r=B(()=>{let h=c.articles;if(v.value.trim()){const M=v.value.toLowerCase();h=h.filter(j=>j.title.toLowerCase().includes(M)||(j.content??"").toLowerCase().includes(M)||j.url.toLowerCase().includes(M))}return c.query.trim()?[...h].sort((M,j)=>o(j,c.query)-o(M,c.query)):h});return(h,M)=>(s(),n("div",wl,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",yl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",kl,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(r.value.length)+" "+u(a.variant==="websites"?"websites":"articles"),3),ie(h.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":M[0]||(M[0]=j=>v.value=j),type:"text",placeholder:a.variant==="websites"?"Search websites...":"Search articles...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,10,$l),[[J,v.value]])],4),e("div",_l,[e("div",Cl,[(s(!0),n(I,null,P(r.value,(j,L)=>(s(),n("button",{key:L,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":j.title,onClick:D=>d(j)},[e("div",Sl,[e("div",Ml,[e("div",Tl,[m(j.imgSrc)&&!x.value.has(j.url)?(s(),n("img",{key:0,src:j.imgSrc,alt:j.title,class:"absolute inset-0 w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:D=>$(j.url)},null,40,Dl)):(s(),n("div",{key:1,class:"absolute inset-0 bg-cover bg-center",style:q({backgroundImage:`url(${b(j)})`})},null,4)),m(j.imgSrc)&&!x.value.has(j.url)?(s(),n("div",Il)):f("",!0)]),e("div",{class:i(["shrink-0 p-2 backdrop-blur-md rounded-b-[10px]",[t(l)?"bg-black shadow-[inset_0_1px_0_rgba(255,255,255,0.12)]":"bg-white shadow-[inset_0_1px_0_rgba(0,0,0,0.06)]"]])},[e("p",{class:i(["text-xs font-semibold leading-tight line-clamp-2",t(l)?"text-white/95":"text-gray-900"])},u(j.title),3),j.content?(s(),n("p",{key:0,class:i(["text-xs line-clamp-1 mt-0.5",t(l)?"text-white/70":"text-gray-600"])},u(j.content),3)):f("",!0),e("p",{class:i(["text-xs truncate mt-0.5",t(l)?"text-white/50":"text-gray-500"])},u(_(j.url)),3)],2)])])],8,jl))),128))]),r.value.length===0?(s(),n("div",Bl,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])},u(a.variant==="websites"?"No websites match your search":"No articles match your search"),3)])):f("",!0)])]))}}),Ll={class:"h-full flex flex-col"},Pl={class:"flex items-center justify-between gap-2"},Nl={class:"flex items-center gap-2 shrink-0"},Al={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},zl={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},El=["aria-label","onClick"],Fl={class:"aspect-[3/1] relative w-full overflow-hidden"},Rl=["src","alt"],Vl={class:"p-3"},Ul={class:"flex items-center gap-3 mt-2 flex-wrap"},ql={key:0,class:"flex items-center justify-center py-12"},Gl=G({__name:"RecipeGrid",props:{recipes:{},title:{default:"Recipes"}},emits:["selectRecipe"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=B(()=>{if(!w.value.trim())return c.recipes;const v=w.value.toLowerCase();return c.recipes.filter(x=>x.title.toLowerCase().includes(v)||x.ingredients.some(m=>m.toLowerCase().includes(v)))});return(v,x)=>(s(),n("div",Ll,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Pl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Nl,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(g.value.length)+" recipes ",3),ie(v.$slots,"header-actions")])]),a.recipes.length>3?W((s(),n("input",{key:0,"onUpdate:modelValue":x[0]||(x[0]=m=>w.value=m),type:"text",placeholder:"Search recipes...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2)),[[J,w.value]]):f("",!0)],4),e("div",Al,[e("div",zl,[(s(!0),n(I,null,P(g.value,(m,$)=>(s(),n("button",{key:$,class:i(["group flex flex-col items-stretch text-left w-full rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105",t(l)?"bg-white/[0.04] border border-white/8 hover:bg-white/[0.07]":"bg-black/[0.02] border border-black/5 hover:bg-black/[0.05]"]),"aria-label":m.title,onClick:_=>v.$emit("selectRecipe",m)},[e("div",Fl,[e("img",{src:t(Wt)(m.title,m.time),alt:m.title,class:"w-full h-full object-cover"},null,8,Rl)]),e("div",Vl,[e("p",{class:i(["text-sm font-semibold leading-tight line-clamp-2",t(l)?"text-white/90":"text-gray-900"])},u(m.title),3),e("div",Ul,[m.time?(s(),n("span",{key:0,class:i(["flex items-center gap-1 text-xs",t(l)?"text-white/40":"text-gray-500"])},[x[1]||(x[1]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),ne(" "+u(m.time),1)],2)):f("",!0),m.servings?(s(),n("span",{key:1,class:i(["flex items-center gap-1 text-xs",t(l)?"text-white/40":"text-gray-500"])},[x[2]||(x[2]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),ne(" "+u(m.servings),1)],2)):f("",!0),m.calories?(s(),n("span",{key:2,class:i(["text-xs",t(l)?"text-white/40":"text-gray-500"])},u(m.calories)+" cal ",3)):f("",!0)]),m.ingredients.length>0?(s(),n("p",{key:0,class:i(["text-xs mt-2 line-clamp-1",t(l)?"text-white/25":"text-gray-400"])},u(m.ingredients.slice(0,4).join(" · ")),3)):f("",!0)])],10,El))),128))]),g.value.length===0?(s(),n("div",ql,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No recipes match your search ",2)])):f("",!0)])]))}}),Ol={class:"h-full flex flex-col"},Hl={class:"flex items-center justify-between gap-2"},Wl={class:"flex flex-wrap gap-1.5"},Kl=["onClick"],Yl={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Ql={class:"space-y-2"},Jl=["aria-label","onClick"],Zl={class:"text-white/90"},Xl={class:"flex-1 min-w-0"},eo={class:"flex items-center gap-2"},to={class:"flex gap-1 mt-1.5"},so={key:0,class:"flex items-center justify-center py-12"},no=G({__name:"AppsGrid",props:{apps:{},title:{default:"Recommended Apps"}},emits:["selectApp"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),v=[{value:"nostr-client",label:"Nostr"},{value:"lightning-wallet",label:"Lightning"},{value:"bitcoin-wallet",label:"Bitcoin"},{value:"privacy",label:"Privacy"},{value:"node",label:"Nodes"},{value:"dev-tool",label:"Dev"}];function x(b){return v.find(d=>d.value===b)?.label??b}function m(b){return{ios:"iOS",android:"Android",web:"Web",desktop:"Desktop",cli:"CLI",nodeos:"Node"}[b]??b}function $(b){let d=0;for(let r=0;r{let b=c.apps;if(w.value){const d=w.value.toLowerCase();b=b.filter(o=>o.name.toLowerCase().includes(d)||o.description.toLowerCase().includes(d)||o.keywords.some(r=>r.toLowerCase().includes(d)))}return g.value&&(b=b.filter(d=>d.category===g.value)),b});return(b,d)=>(s(),n("div",Ol,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Hl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(_.value.length)+" apps ",3)]),W(e("input",{"onUpdate:modelValue":d[0]||(d[0]=o=>w.value=o),type:"text",placeholder:"Search apps...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),e("div",Wl,[(s(),n(I,null,P(v,o=>e("button",{key:o.value,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===o.value?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:r=>g.value=g.value===o.value?null:o.value},u(o.label),11,Kl)),64))])],4),e("div",Yl,[e("div",Ql,[(s(!0),n(I,null,P(_.value,o=>(s(),n("button",{key:o.id,class:i(["w-full text-left p-3 rounded-xl transition-all duration-200 flex items-start gap-3",t(l)?"bg-white/5 hover:bg-white/10":"bg-black/3 hover:bg-black/5"]),"aria-label":o.name,onClick:r=>b.$emit("selectApp",o)},[e("div",{class:"w-10 h-10 rounded-xl flex items-center justify-center text-lg font-bold shrink-0",style:q({background:$(o.id)})},[e("span",Zl,u(o.name.charAt(0)),1)],4),e("div",Xl,[e("div",eo,[e("p",{class:i(["text-xs font-semibold truncate",t(l)?"text-white/90":"text-gray-900"])},u(o.name),3),e("span",{class:i(["text-xs px-1.5 py-0.5 rounded font-medium shrink-0",t(l)?"bg-white/10 text-white/50":"bg-black/5 text-gray-500"])},u(x(o.category)),3)]),e("p",{class:i(["text-xs mt-0.5 line-clamp-2",t(l)?"text-white/50":"text-gray-500"])},u(o.description),3),e("div",to,[(s(!0),n(I,null,P(o.platforms,r=>(s(),n("span",{key:r,class:i(["text-xs px-1 py-0.5 rounded",t(l)?"bg-white/5 text-white/30":"bg-black/3 text-gray-400"])},u(m(r)),3))),128))])])],10,Jl))),128))]),_.value.length===0?(s(),n("div",so,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No apps match your search ",2)])):f("",!0)])]))}}),lo={class:"group/node"},oo={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},ao={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},io={class:"truncate flex-1"},ro={key:0,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},co={key:0,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},uo={key:0},ho=G({__name:"FileTreeNode",props:{entry:{},activeFile:{},depth:{}},emits:["select","toggle-context"],setup(a,{emit:c}){const l=a,{isFileSelected:w}=pe(),g=c,{isDark:v}=Z(),x=S(l.depth<1),m=B(()=>!l.entry.isDirectory&&l.activeFile===l.entry.path),$=B(()=>!l.entry.isDirectory&&w(l.entry.path)),_=B(()=>l.entry.isDirectory&&w(l.entry.path));function b(){l.entry.isDirectory?x.value=!x.value:g("select",l.entry.path)}function d(){g("toggle-context",l.entry.path)}function o(){g("toggle-context",l.entry.path)}return(r,h)=>{const M=Kt("FileTreeNode",!0);return s(),n("div",lo,[e("div",{class:i(["w-full flex items-center gap-1.5 py-1 px-2 rounded-lg text-xs transition-colors cursor-pointer",[m.value?t(v)?"bg-white/10 text-white/90":"bg-black/8 text-gray-900":t(v)?"text-white/60 hover:bg-white/[0.04] hover:text-white/80":"text-gray-600 hover:bg-black/[0.03] hover:text-gray-800"]]),style:q({paddingLeft:`${a.depth*12+8}px`}),onClick:b},[a.entry.isDirectory?(s(),n("svg",{key:0,class:i(["w-3 h-3 shrink-0 transition-transform duration-150",x.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...h[2]||(h[2]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2)):f("",!0),(s(),n("svg",{class:i(["w-3.5 h-3.5 shrink-0",a.entry.isDirectory?"text-accent/70":t(v)?"text-white/30":"text-gray-400"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[a.entry.isDirectory?(s(),n("path",oo)):(s(),n("path",ao))],2)),e("span",io,u(a.entry.name),1),a.entry.isDirectory?f("",!0):(s(),n("button",{key:1,class:i(["shrink-0 w-4 h-4 rounded-full border flex items-center justify-center transition-all ml-auto",[$.value?"bg-accent border-accent text-white":t(v)?"border-white/20 opacity-0 group-hover/node:opacity-100 hover:border-white/40":"border-black/15 opacity-0 group-hover/node:opacity-100 hover:border-black/30"]]),"aria-label":"Toggle file for chat context",onClick:xe(d,["stop"])},[$.value?(s(),n("svg",ro,[...h[3]||(h[3]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],2)),a.entry.isDirectory?(s(),n("button",{key:2,class:i(["shrink-0 w-4 h-4 rounded-full border flex items-center justify-center transition-all ml-auto",[_.value?"bg-accent border-accent text-white":t(v)?"border-white/20 opacity-0 group-hover/node:opacity-100 hover:border-white/40":"border-black/15 opacity-0 group-hover/node:opacity-100 hover:border-black/30"]]),"aria-label":"Add folder to chat context",onClick:xe(o,["stop"])},[_.value?(s(),n("svg",co,[...h[4]||(h[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],2)):f("",!0)],6),a.entry.isDirectory&&x.value&&a.entry.children?(s(),n("div",uo,[(s(!0),n(I,null,P(a.entry.children,j=>(s(),U(M,{key:j.path,entry:j,"active-file":a.activeFile,depth:a.depth+1,onSelect:h[0]||(h[0]=L=>r.$emit("select",L)),onToggleContext:h[1]||(h[1]=L=>r.$emit("toggle-context",L))},null,8,["entry","active-file","depth"]))),128))])):f("",!0)])}}}),xo={class:"flex flex-col h-full"},po={class:"flex items-center gap-1 min-w-0 flex-1"},go={class:"flex items-center gap-2 shrink-0"},bo={key:0,class:"flex-1 overflow-y-auto custom-scrollbar p-3"},vo={class:"mb-3 flex gap-2"},fo={class:"flex justify-end gap-2"},mo=["disabled"],wo={class:"grid grid-cols-2 gap-2"},yo=["onClick"],ko={key:1,class:"flex-1 overflow-y-auto custom-scrollbar p-2"},$o={key:0,class:"flex items-center justify-center py-12"},_o=G({__name:"ProjectGrid",props:{isWideDesktop:{type:Boolean},isMobile:{type:Boolean}},setup(a){const{isDark:c}=Z(),{projectList:l,activeProject:w,fileTree:g,activeFile:v,codeMode:x,selectedFiles:m,selectProject:$,openFile:_,createProject:b,clearActiveFile:d,toggleFileSelection:o,isFileSelected:r,loadProjects:h}=pe();le(()=>{l.value.length===0&&h()});const M=S(""),j=S(!1),L=S(""),D=S(null),C=B(()=>w.value?"filetree":"projects"),k=B(()=>C.value==="projects"?"Projects":w.value?.name??"Projects"),p=B(()=>{const F=M.value.toLowerCase();return F?l.value.filter(O=>O.name.toLowerCase().includes(F)||(O.language??"").toLowerCase().includes(F)):l.value});function y(F){$(F)}function A(){const{activeProject:F,fileTree:O}=pe();F.value=null,O.value=[],d()}function V(F){_(F)}function E(F){o(F)}function Q(){j.value=!0,L.value="",ye(()=>D.value?.focus())}function H(){j.value=!1,L.value=""}function K(){const F=L.value.trim();F&&(b(F),j.value=!1,L.value="")}return(F,O)=>(s(),n("div",xo,[e("div",{class:"shrink-0 px-4 py-3 flex items-center justify-between gap-2",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",po,[C.value!=="projects"?(s(),n("button",{key:0,class:i(["text-xs shrink-0 transition-colors",t(c)?"text-white/40 hover:text-white/70 hover:underline":"text-gray-400 hover:text-gray-700 hover:underline"]),onClick:A}," Projects ",2)):f("",!0),C.value!=="projects"?(s(),n("span",{key:1,class:i(["text-xs shrink-0",t(c)?"text-white/20":"text-gray-300"])},"/",2)):f("",!0),e("span",{class:i(["text-sm font-semibold truncate",t(c)?"text-white/90":"text-gray-900"])},u(k.value),3)]),e("div",go,[C.value==="projects"?(s(),n("p",{key:0,class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(t(l).length)+" repos ",3)):C.value==="filetree"?(s(),n("p",{key:1,class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(t(w)?.language),3)):f("",!0),ie(F.$slots,"header-actions")])],4),C.value==="projects"?(s(),n("div",bo,[e("div",vo,[W(e("input",{"onUpdate:modelValue":O[0]||(O[0]=X=>M.value=X),type:"text",placeholder:"Search projects...",class:i(["flex-1 min-w-0 px-3 py-2 rounded-lg text-base bg-transparent outline-none",t(c)?"text-white/80 placeholder:text-white/20 border border-white/10 focus:border-white/25":"text-gray-800 placeholder:text-gray-400 border border-black/10 focus:border-black/20"])},null,2),[[J,M.value]]),e("button",{class:i(["shrink-0 px-3 py-2 rounded-lg text-xs font-medium transition-colors flex items-center gap-1.5",t(c)?"bg-accent/20 text-accent hover:bg-accent/30":"bg-accent/10 text-accent hover:bg-accent/20"]),onClick:Q},[...O[2]||(O[2]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),ne(" New ",-1)])],2)]),j.value?(s(),n("div",{key:0,class:i(["mb-3 p-3 rounded-xl",t(c)?"bg-white/[0.05] border border-white/10":"bg-black/[0.03] border border-black/8"])},[e("p",{class:i(["text-xs font-medium mb-2",t(c)?"text-white/70":"text-gray-700"])}," New Project ",2),W(e("input",{ref_key:"newProjectInputRef",ref:D,"onUpdate:modelValue":O[1]||(O[1]=X=>L.value=X),type:"text",placeholder:"Project name...",class:i(["w-full px-3 py-2 rounded-lg text-base bg-transparent outline-none mb-2",t(c)?"text-white/80 placeholder:text-white/20 border border-white/10 focus:border-white/25":"text-gray-800 placeholder:text-gray-400 border border-black/10 focus:border-black/20"]),onKeydown:[ae(K,["enter"]),ae(H,["escape"])]},null,34),[[J,L.value]]),e("div",fo,[e("button",{class:i(["text-xs px-2.5 py-1 rounded-lg transition-colors",t(c)?"text-white/40 hover:text-white/70":"text-gray-500 hover:text-gray-800"]),onClick:H}," Cancel ",2),e("button",{class:i(["text-xs px-2.5 py-1 rounded-lg font-medium transition-colors",t(c)?"bg-accent/20 text-accent hover:bg-accent/30":"bg-accent/10 text-accent hover:bg-accent/20"]),disabled:!L.value.trim(),onClick:K}," Create ",10,mo)])],2)):f("",!0),e("div",wo,[(s(!0),n(I,null,P(p.value,X=>(s(),n("button",{key:X.path,class:i(["text-left p-3 rounded-xl transition-all duration-150",t(c)?"bg-white/[0.03] hover:bg-white/[0.07] border border-white/5":"bg-black/[0.02] hover:bg-black/[0.05] border border-black/5"]),onClick:ge=>y(X)},[e("div",{class:i(["w-8 h-8 rounded-lg flex items-center justify-center mb-2",t(c)?"bg-white/5":"bg-black/5"])},[(s(),n("svg",{class:i(["w-4 h-4",X.isGit?"text-accent":t(c)?"text-white/40":"text-gray-400"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...O[3]||(O[3]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},null,-1)])],2))],2),e("p",{class:i(["text-xs font-medium truncate",t(c)?"text-white/80":"text-gray-800"])},u(X.name),3),e("p",{class:i(["text-xs mt-0.5 truncate",t(c)?"text-white/25":"text-gray-400"])},u(X.language),3)],10,yo))),128))])])):C.value==="filetree"?(s(),n("div",ko,[(s(!0),n(I,null,P(t(g),X=>(s(),U(ho,{key:X.path,entry:X,"active-file":t(v),depth:0,onSelect:V,onToggleContext:E},null,8,["entry","active-file"]))),128)),t(g).length===0?(s(),n("div",$o,[e("p",{class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])}," Loading file tree... ",2)])):f("",!0)])):f("",!0)]))}}),Co={class:"flex flex-col h-full"},jo={class:"shrink-0 px-4 py-2 flex gap-1.5 overflow-x-auto scrollbar-hide"},So=["onClick"],Mo={class:"flex-1 overflow-y-auto px-4 py-3"},To={class:"grid grid-cols-2 gap-2"},Do=["onClick"],Io=["onClick"],Bo={key:0,class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Lo={key:2,class:"h-8 flex items-end gap-0.5 mb-2"},Po={key:3,class:"h-8 flex items-center mb-2"},No={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"},Ao={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"},zo={key:2,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},Eo={key:3,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"},Fo=G({__name:"DesignSystemGrid",setup(a){const{isDark:c}=Z(),{openDesignSystemItem:l}=$e(),{codeMode:w,toggleDesignToken:g,isDesignTokenSelected:v}=pe(),x=S("all"),m=[{id:"all",label:"All"},{id:"colors",label:"Colors"},{id:"typography",label:"Typography"},{id:"spacing",label:"Spacing"},{id:"atoms",label:"Atoms"},{id:"molecules",label:"Molecules"},{id:"organisms",label:"Organisms"}],$=[{id:"color-bg",name:"Background",category:"colors",preview:"inline",description:"Primary app background",code:`background-color: #0a0a0a; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useNostr-BqBiQvAw.js","assets/index-BD9qoze1.js","assets/index-BNvE9-tw.css","assets/ThreadNode-DaJ9aByD.js"])))=>i.map(i=>d[i]); +import{a as G,Z as qt,$ as rt,p as Ne,b as s,c as n,e,h as q,u as t,n as i,t as u,f as ie,w as W,v as J,F as I,g as P,i as f,j as Z,r as S,k as B,a0 as Gt,a1 as ct,N as ne,a2 as dt,a3 as ut,a4 as ht,a5 as xt,U as De,a6 as Ot,a7 as Ht,a8 as Wt,P as Kt,z as xe,Q as U,K as le,a9 as ae,aa as ye,_ as pt,A as ce,B as Pe,d as Yt,ab as Qt,L as se,ac as Jt,ad as Zt,ae as Xt,S as es,q as ts,af as ss,o as ns,M as ue,ag as Le,ah as ls}from"./index-BD9qoze1.js";import{u as os}from"./chat-Dx-Dx0vd.js";import{u as $e,a as pe,e as He,d as gt,M as as,b as is,s as rs,c as cs,f as fe,_ as tt}from"./ChatWindow.vue_vue_type_script_setup_true_lang-DK0BUVLp.js";import{_ as ds}from"./FilmGrid.vue_vue_type_script_setup_true_lang-Cv6-zNyf.js";import{u as Ae}from"./useContentImages-6RAIPaCD.js";import{_ as us}from"./SongGrid.vue_vue_type_script_setup_true_lang-BOXkLn09.js";import{useNostr as Ie}from"./useNostr-BqBiQvAw.js";import{u as bt,_ as hs}from"./FilmDetail.vue_vue_type_script_setup_true_lang-BOBGVwtd.js";import{_ as xs}from"./SongDetail.vue_vue_type_script_setup_true_lang-BGRNHJco.js";const ps={class:"h-full flex flex-col"},gs={class:"flex items-center justify-between gap-2"},bs={class:"flex items-center gap-2 shrink-0"},vs={key:0,class:"flex flex-wrap gap-1.5"},fs=["onClick"],ms={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},ws={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},ys=["aria-label","onClick"],ks={class:"cover-card flex-1 min-h-0 relative"},$s={key:0,class:"absolute inset-0 animate-shimmer"},_s=["src","alt","onError"],Cs=["src","alt"],js={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Ss={class:"absolute bottom-0 left-0 right-0 p-2"},Ms={class:"text-xs font-semibold text-white/90 leading-tight truncate"},Ts={class:"text-xs text-white/40 truncate mt-0.5"},Ds={key:4,class:"absolute top-1.5 left-1.5"},Is={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-medium"},Bs={key:5,class:"absolute top-1.5 right-1.5"},Ls={class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},Ps={key:0,class:"flex items-center justify-center py-12"},Ns=G({__name:"BookGrid",props:{books:{},title:{default:"Recommended Books"}},emits:["selectBook"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"books"),id:d=>d.id,existingUrl:d=>d.coverUrl,fetch:d=>rt(d.title,d.author),fallback:d=>qt(d.title,d.author)}),_=B(()=>{const d=new Map;for(const o of c.books)for(const r of o.genres??[])d.set(r,(d.get(r)??0)+1);return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.books;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.title.toLowerCase().includes(o)||r.author.toLowerCase().includes(o)||(r.genres??[]).some(h=>h.toLowerCase().includes(o)))}return g.value&&(d=d.filter(o=>(o.genres??[]).includes(g.value))),d});return(d,o)=>(s(),n("div",ps,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",gs,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",bs,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" books ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search books...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),_.value.length>0?(s(),n("div",vs,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,fs))),128))])):f("",!0)],4),e("div",ms,[e("div",ws,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":`${r.title} by ${r.author}`,onClick:h=>d.$emit("selectBook",r)},[e("div",ks,[e("div",{class:i(["aspect-[2/3] relative w-full overflow-hidden rounded-[10px]",t(v)(r)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(r)?(s(),n("div",$s)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:`${r.title} by ${r.author}`,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,_s)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.title,class:"w-full h-full object-cover"},null,8,Cs)),t(v)(r)?(s(),n("div",js)):f("",!0),e("div",Ss,[e("p",Ms,u(r.title),1),e("p",Ts,u(r.author),1)]),r.rating?(s(),n("div",Ds,[e("span",Is," ★ "+u(r.rating.toFixed(1)),1)])):f("",!0),r.year?(s(),n("div",Bs,[e("span",Ls,u(r.year),1)])):f("",!0)],2)])],8,ys))),128))]),b.value.length===0?(s(),n("div",Ps,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No books match your search ",2)])):f("",!0)])]))}}),As={class:"h-full flex flex-col"},zs={class:"flex items-center justify-between gap-2"},Es={class:"flex items-center gap-2 shrink-0"},Fs={key:0,class:"flex flex-wrap gap-1.5"},Rs=["onClick"],Vs={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Us={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},qs=["aria-label","onClick"],Gs={class:"cover-card flex-1 min-h-0 relative"},Os={key:0,class:"absolute inset-0 animate-shimmer"},Hs=["src","alt","onError"],Ws=["src","alt"],Ks={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Ys={class:"absolute bottom-0 left-0 right-0 p-2"},Qs={class:"text-xs font-semibold text-white/90 leading-tight truncate"},Js={class:"text-xs text-white/40 truncate mt-0.5"},Zs={key:4,class:"absolute top-1.5 left-1.5"},Xs={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-medium"},en={key:5,class:"absolute top-1.5 right-1.5"},tn={class:"absolute top-1.5 right-1.5 flex gap-0.5 flex-wrap justify-end max-w-[60%]"},sn={key:0,class:"flex items-center justify-center py-12"},nn=G({__name:"TVSeriesGrid",props:{series:{},title:{default:"Recommended TV Series"}},emits:["selectSeries"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"series"),id:o=>o.id,existingUrl:o=>o.posterUrl||o.backdropUrl,fetch:o=>ct(o.title,o.year).then(r=>r.posterUrl),fallback:o=>Gt(o.title,o.year)});function _(o){return o.year?o.endYear&&o.endYear!==o.year?`${o.year}–${o.endYear}`:o.status==="ongoing"?`${o.year}–`:String(o.year):""}const b=B(()=>{const o=new Map;for(const r of c.series)for(const h of r.genres??[])o.set(h,(o.get(h)??0)+1);return[...o.entries()].sort((r,h)=>h[1]-r[1]).slice(0,8).map(([r])=>r)}),d=B(()=>{let o=c.series;if(w.value){const r=w.value.toLowerCase();o=o.filter(h=>h.title.toLowerCase().includes(r)||(h.creator??"").toLowerCase().includes(r)||(h.network??"").toLowerCase().includes(r)||(h.genres??[]).some(M=>M.toLowerCase().includes(r)))}return g.value&&(o=o.filter(r=>(r.genres??[]).includes(g.value))),o});return(o,r)=>(s(),n("div",As,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",zs,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Es,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(d.value.length)+" series ",3),ie(o.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":r[0]||(r[0]=h=>w.value=h),type:"text",placeholder:"Search TV series...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),b.value.length>0?(s(),n("div",Fs,[(s(!0),n(I,null,P(b.value,h=>(s(),n("button",{key:h,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===h?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:M=>g.value=g.value===h?null:h},u(h),11,Rs))),128))])):f("",!0)],4),e("div",Vs,[e("div",Us,[(s(!0),n(I,null,P(d.value,h=>(s(),n("button",{key:h.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":h.title,onClick:M=>o.$emit("selectSeries",h)},[e("div",Gs,[e("div",{class:i(["aspect-[2/3] relative w-full overflow-hidden rounded-[10px]",t(v)(h)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(h)?(s(),n("div",Os)):f("",!0),t(v)(h)?(s(),n("img",{key:1,src:t(v)(h),alt:`${h.title} — TV Series`,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:M=>t(m)(h)},null,40,Hs)):t($)(h)?f("",!0):(s(),n("img",{key:2,src:t(x)(h),alt:h.title,class:"w-full h-full object-cover"},null,8,Ws)),t(v)(h)?(s(),n("div",Ks)):f("",!0),e("div",Ys,[e("p",Qs,u(h.title),1),e("p",Js,[ne(u(_(h)),1),h.seasons?(s(),n(I,{key:0},[ne(" · "+u(h.seasons)+"S",1)],64)):f("",!0)])]),h.rating?(s(),n("div",Zs,[e("span",Xs," ★ "+u(h.rating.toFixed(1)),1)])):f("",!0),h.status==="ongoing"?(s(),n("div",en,[...r[1]||(r[1]=[e("span",{class:"text-xs px-1 py-0.5 rounded bg-emerald-500/80 text-white backdrop-blur-sm"}," ongoing ",-1)])])):f("",!0),e("div",tn,[(s(!0),n(I,null,P((h.sources??[]).slice(0,2),M=>(s(),n("span",{key:M.type,class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},u(M.type),1))),128))])],2)])],8,qs))),128))]),d.value.length===0?(s(),n("div",sn,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No TV series match your search ",2)])):f("",!0)])]))}}),ln={class:"h-full flex flex-col"},on={class:"flex items-center justify-between gap-2"},an={class:"flex items-center gap-2 shrink-0"},rn={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},cn={class:"columns-2 sm:columns-3 gap-3 space-y-3"},dn=["aria-label","onClick"],un=["src","alt","onError"],hn={key:2,class:"absolute bottom-0 left-0 right-0 p-2 bg-gradient-to-t from-black/70 via-black/30 to-transparent"},xn={key:0,class:"text-xs font-medium text-white/90 truncate"},pn={key:1,class:"text-xs text-white/50 truncate"},gn={key:0,class:"flex items-center justify-center py-12"},bn=G({__name:"ImageGrid",props:{images:{},title:{default:"Images"}},emits:["selectImage"],setup(a){const{isDark:c}=Z(),l=S(new Set);function w(g){l.value.add(g.id),l.value=new Set(l.value)}return(g,v)=>(s(),n("div",ln,[e("div",{class:"p-4 space-y-3",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",on,[e("h3",{class:i(["text-sm font-bold",t(c)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",an,[e("span",{class:i(["text-xs font-mono",t(c)?"text-white/30":"text-gray-400"])},u(a.images.length)+" images ",3),ie(g.$slots,"header-actions")])])],4),e("div",rn,[e("div",cn,[(s(!0),n(I,null,P(a.images,x=>(s(),n("button",{key:x.id,class:i(["group w-full break-inside-avoid text-left rounded-xl overflow-hidden transition-all duration-200 hover:brightness-110 relative",t(c)?"bg-white/5":"bg-black/3"]),"aria-label":x.alt||x.title||"Image",onClick:m=>g.$emit("selectImage",x)},[l.value.has(x.id)?(s(),n("div",{key:1,class:i(["w-full aspect-[4/3] flex items-center justify-center",t(c)?"bg-white/5":"bg-black/5"])},[(s(),n("svg",{class:i(["w-8 h-8",t(c)?"text-white/15":"text-gray-300"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...v[0]||(v[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},null,-1)])],2))],2)):(s(),n("img",{key:0,src:x.url,alt:x.alt||x.title||"Image",class:"w-full block transition-transform duration-300 group-hover:scale-[1.03]",loading:"lazy",onError:m=>w(x)},null,40,un)),x.title||x.source?(s(),n("div",hn,[x.title?(s(),n("p",xn,u(x.title),1)):f("",!0),x.source?(s(),n("p",pn,u(x.source),1)):f("",!0)])):f("",!0)],10,dn))),128))]),a.images.length===0?(s(),n("div",gn,[e("p",{class:i(["text-sm",t(c)?"text-white/30":"text-gray-400"])}," No images found ",2)])):f("",!0)])]))}}),vn={class:"h-full flex flex-col"},fn={class:"p-4 space-y-3"},mn={class:"flex items-center justify-between"},wn={class:"shrink-0 flex items-center gap-2"},yn={key:0,class:"flex flex-wrap gap-1.5"},kn=["onClick"],$n={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pb-16"},_n={class:"grid grid-cols-2 sm:grid-cols-3 gap-3"},Cn=["aria-label","onClick"],jn={class:"aspect-[4/3] relative w-full overflow-hidden rounded-t-[10px]"},Sn={key:0,class:"absolute inset-0 animate-shimmer"},Mn=["src","alt","onError"],Tn=["src","alt"],Dn={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},In={class:"absolute bottom-0 left-0 right-0 p-2"},Bn={class:"text-xs font-semibold text-white/90 truncate"},Ln={class:"text-xs text-white/40 truncate mt-0.5"},Pn={key:4,class:"absolute top-1.5 right-1.5"},Nn={class:"text-xs px-1.5 py-0.5 rounded bg-black/60 text-amber-400 backdrop-blur-sm font-semibold"},An={key:5,class:"absolute top-1.5 left-1.5"},zn={class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},En={key:0,class:"flex items-center justify-center py-12"},Fn=G({__name:"PlaceGrid",props:{places:{},title:{default:"Places"}},emits:["selectPlace"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"places"),id:d=>d.id,existingUrl:d=>d.photoUrl,fetch:d=>ut(d.name,d.city),fallback:d=>dt(d.name,d.cuisine||d.category)}),_=B(()=>{const d=new Map;for(const o of c.places){const r=o.cuisine||o.category;r&&d.set(r,(d.get(r)??0)+1)}return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.places;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.name.toLowerCase().includes(o)||r.cuisine?.toLowerCase().includes(o)||r.category?.toLowerCase().includes(o)||r.city?.toLowerCase().includes(o)||r.address?.toLowerCase().includes(o))}return g.value&&(d=d.filter(o=>o.cuisine===g.value||o.category===g.value)),d});return(d,o)=>(s(),n("div",vn,[e("div",fn,[e("div",mn,[e("h3",{class:i(["text-base font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title||"Places"),3),e("div",wn,[e("span",{class:i(["text-xs",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" places ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search places...",class:i(["w-full text-base px-3 py-2 rounded-lg outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder-white/25 focus:bg-white/8":"bg-black/5 text-gray-800 placeholder-gray-400 focus:bg-black/8"])},null,2),[[J,w.value]]),_.value.length>1?(s(),n("div",yn,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md font-medium transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"bg-white/5 text-white/40 hover:text-white/70":"bg-black/5 text-gray-500 hover:text-gray-800"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,kn))),128))])):f("",!0)]),e("div",$n,[e("div",_n,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":r.name,onClick:h=>d.$emit("selectPlace",r)},[e("div",jn,[t($)(r)?(s(),n("div",Sn)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:r.name,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,Mn)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.name,class:"w-full h-full object-cover"},null,8,Tn)),t(v)(r)?(s(),n("div",Dn)):f("",!0),e("div",In,[e("p",Bn,u(r.name),1),e("p",Ln,u(r.cuisine||r.category),1)]),r.rating?(s(),n("div",Pn,[e("span",Nn," ★ "+u(r.rating.toFixed(1)),1)])):f("",!0),r.priceLevel?(s(),n("div",An,[e("span",zn,u("$".repeat(r.priceLevel)),1)])):f("",!0)])],8,Cn))),128))]),b.value.length===0?(s(),n("div",En,[e("p",{class:i(["text-xs",t(l)?"text-white/30":"text-gray-400"])}," No places match your search ",2)])):f("",!0)])]))}}),Rn={class:"h-full flex flex-col"},Vn={class:"flex items-center justify-between gap-2"},Un={class:"flex items-center gap-2 shrink-0"},qn={key:0,class:"flex flex-wrap gap-1.5"},Gn=["onClick"],On={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Hn={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},Wn=["aria-label","onClick"],Kn={class:"cover-card flex-1 min-h-0 relative"},Yn={key:0,class:"absolute inset-0 animate-shimmer"},Qn=["src","alt","onError"],Jn=["src","alt"],Zn={key:3,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none"},Xn={class:"absolute bottom-0 left-0 right-0 p-2"},el={class:"text-xs font-semibold text-white/90 leading-tight truncate"},tl={class:"text-xs text-white/40 truncate mt-0.5"},sl={class:"absolute top-1.5 right-1.5 flex gap-0.5 flex-wrap justify-end max-w-[60%]"},nl={key:0,class:"flex items-center justify-center py-12"},ll=G({__name:"PodcastGrid",props:{podcasts:{},title:{default:"Recommended Podcasts"}},emits:["selectPodcast"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),{coverSrc:v,fallbackSrc:x,onError:m,isLoading:$}=Ae({items:Ne(c,"podcasts"),id:d=>d.id,existingUrl:d=>d.coverUrl,fetch:d=>xt(d.title,d.host),fallback:d=>ht(d.title,d.host)}),_=B(()=>{const d=new Map;for(const o of c.podcasts)for(const r of o.genres??[])d.set(r,(d.get(r)??0)+1);return[...d.entries()].sort((o,r)=>r[1]-o[1]).slice(0,8).map(([o])=>o)}),b=B(()=>{let d=c.podcasts;if(w.value){const o=w.value.toLowerCase();d=d.filter(r=>r.title.toLowerCase().includes(o)||(r.host??"").toLowerCase().includes(o)||(r.genres??[]).some(h=>h.toLowerCase().includes(o)))}return g.value&&(d=d.filter(o=>(o.genres??[]).includes(g.value))),d});return(d,o)=>(s(),n("div",Rn,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Vn,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Un,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(b.value.length)+" podcasts ",3),ie(d.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":o[0]||(o[0]=r=>w.value=r),type:"text",placeholder:"Search podcasts...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),_.value.length>0?(s(),n("div",qn,[(s(!0),n(I,null,P(_.value,r=>(s(),n("button",{key:r,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===r?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:h=>g.value=g.value===r?null:r},u(r),11,Gn))),128))])):f("",!0)],4),e("div",On,[e("div",Hn,[(s(!0),n(I,null,P(b.value,r=>(s(),n("button",{key:r.id,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":r.title,onClick:h=>d.$emit("selectPodcast",r)},[e("div",Kn,[e("div",{class:i(["aspect-square relative w-full overflow-hidden rounded-[10px]",t(v)(r)?"":t(l)?"bg-white/[0.06]":"bg-black/[0.04]"])},[t($)(r)?(s(),n("div",Yn)):f("",!0),t(v)(r)?(s(),n("img",{key:1,src:t(v)(r),alt:r.title,class:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:h=>t(m)(r)},null,40,Qn)):t($)(r)?f("",!0):(s(),n("img",{key:2,src:t(x)(r),alt:r.title,class:"w-full h-full object-cover"},null,8,Jn)),t(v)(r)?(s(),n("div",Zn)):f("",!0),e("div",Xn,[e("p",el,u(r.title),1),e("p",tl,u(r.host||"Podcast"),1)]),e("div",sl,[(s(!0),n(I,null,P(r.sources.slice(0,2),h=>(s(),n("span",{key:h.type,class:"text-xs px-1 py-0.5 rounded bg-black/60 text-white/70 backdrop-blur-sm"},u(h.type),1))),128))])],2)])],8,Wn))),128))]),b.value.length===0?(s(),n("div",nl,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No podcasts match your search ",2)])):f("",!0)])]))}}),ol={class:"shrink-0"},al={class:"flex-1 overflow-y-auto custom-scrollbar"},il={key:0,class:"relative overflow-hidden",style:{minHeight:"180px"}},rl={class:"absolute inset-0"},cl=["src"],dl={class:"relative z-10 flex flex-col justify-end h-full px-5 pb-5 pt-12",style:{"min-height":"180px"}},ul={class:"px-3 pt-2 pb-8"},hl={key:0,"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 2a10 10 0 100 20 10 10 0 000-20zm0 0v2m0 16v2m10-10h-2M4 12H2m15.07-5.07l-1.41 1.41M8.34 15.66l-1.41 1.41m0-11.14l1.41 1.41m7.32 7.32l1.41 1.41"},xl={key:1,"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"},pl={key:2,"stroke-linecap":"round","stroke-linejoin":"round",d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"},gl={key:3,"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 6h16M4 12h16M4 18h7"},bl=["onClick"],vl=["onClick"],fl={key:1,class:"flex items-center justify-center py-16 px-4"},ml=G({__name:"MagazineGrid",props:{sections:{},heroImageUrl:{default:null},title:{default:"Brief"},query:{default:""}},setup(a){const c=a,{isDark:l}=Z(),{openMagazineSectionDetail:w}=$e(),g=["compass","bookmark","lightning","lines"];function v(b){return b.replace(/\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/https?:\/\/\S+/g,"").replace(/\uFE0F/g,"").replace(new RegExp("(?:^|(?<=\\s))[\\p{Emoji_Presentation}\\p{Extended_Pictographic}]+\\s*","gu"),"").replace(/---+/g,"").replace(/^#+\s*/gm,"").replace(/\*\*/g,"").replace(/\*([^*\n]+)\*/g,"$1").replace(/\|/g,", ").replace(/,\s*,+/g,",").replace(/^\s*[-•]\s+/gm,"").replace(/\n+/g," ").replace(/(^|\s),\s*/g,"$1").trim()}function x(b,d){const o=v(b);return o.length<=d?o:o.slice(0,d).replace(/\s+\S*$/,"")+" ..."}const m=B(()=>{const b=[],d=c.sections;if(!d.length)return b;let o=0;for(const j of c.query||"brief")o=(o<<5)-o+j.charCodeAt(0)|0;let r="",h=0,M=!1;return d.forEach((j,L)=>{if(L===0&&!j.group){b.push({type:"wide",title:j.title,text:x(j.content,200),label:"The Lead",author:j.author,section:j});return}const D=j.group||"";if(D&&D!==r&&(M&&(b.push({type:"dark",title:"",text:""}),M=!1),b.push({type:"banner",title:"",text:"",icon:g[h%g.length],label:D}),h++,r=D),D){const C=M?"dark":"half",k=v(j.content),p=v(j.title),y=k.toLowerCase().startsWith(p.toLowerCase().slice(0,30));b.push({type:C,title:y?"":j.title,text:x(j.content,y?160:100),section:j}),M=!M}else M&&(b.push({type:"dark",title:"",text:""}),M=!1),b.push({type:"wide",title:j.title,text:x(j.content,180),author:j.author,section:j})}),M&&b.push({type:"dark",title:"",text:""}),b});function $(b){const d=c.sections.indexOf(b);w(b,d>=0?d:0)}const _=B(()=>{const b=(c.query??"").trim();return b?b.length>100?b.slice(0,97)+"...":b:c.title});return(b,d)=>(s(),n("div",{class:i(["magazine h-full flex flex-col",t(l)?"magazine-dark":"magazine-light"])},[e("header",{class:i(["shrink-0 px-5 py-4 flex items-center justify-between border-b",t(l)?"border-white/10":"border-black/10"])},[e("h1",{class:i(["font-serif text-xl font-bold tracking-tight",t(l)?"text-white":"text-black"])}," AI Brief ",2),e("div",ol,[ie(b.$slots,"header-actions",{},void 0,!0)])],2),e("div",al,[_.value?(s(),n("div",il,[e("div",rl,[a.heroImageUrl?(s(),n("img",{key:0,src:a.heroImageUrl,alt:"",class:"w-full h-full object-cover",style:{filter:"saturate(0.3) contrast(1.1)"}},null,8,cl)):(s(),n("div",{key:1,class:i(["w-full h-full",t(l)?"bg-gradient-to-br from-white/[0.04] via-white/[0.02] to-transparent":"bg-gradient-to-br from-black/[0.06] via-black/[0.03] to-transparent"])},null,2))]),e("div",{class:i(["absolute inset-0",t(l)?"bg-gradient-to-t from-[#0a0a0a] via-[#0a0a0a]/80 to-[#0a0a0a]/60":"bg-gradient-to-t from-[#faf9f6] via-[#faf9f6]/85 to-[#faf9f6]/65"])},null,2),e("div",dl,[e("p",{class:i(["text-xs uppercase tracking-[0.3em] font-medium mb-2",t(l)?"text-white/40":"text-black/40"])}," In response to ",2),e("p",{class:i(["font-serif text-2xl italic leading-tight",t(l)?"text-white/70":"text-black/60"])},u(_.value),3)])])):f("",!0),e("div",ul,[e("div",{class:i(["grid grid-cols-2 gap-px",t(l)?"bg-white/12":"bg-black/10"])},[(s(!0),n(I,null,P(m.value,(o,r)=>(s(),n(I,{key:r},[o.type==="banner"?(s(),n("div",{key:0,class:i(["col-span-2 flex flex-col items-center justify-center py-8 px-5",t(l)?"bg-[#0a0a0a]":"bg-[#faf9f6]"])},[(s(),n("svg",{class:i(["w-5 h-5 mb-2.5",t(l)?"text-white/20":"text-black/15"]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[o.icon==="compass"?(s(),n("path",hl)):o.icon==="bookmark"?(s(),n("path",xl)):o.icon==="lightning"?(s(),n("path",pl)):(s(),n("path",gl))],2)),e("p",{class:i(["text-xs uppercase tracking-[0.3em] font-semibold text-center",t(l)?"text-white/30":"text-black/30"])},u(o.label),3)],2)):o.type==="wide"?(s(),n("button",{key:1,class:i(["col-span-2 text-left px-5 py-5 transition-colors cursor-pointer",t(l)?"bg-[#0a0a0a] hover:bg-white/[0.03]":"bg-[#faf9f6] hover:bg-black/[0.02]"]),onClick:h=>o.section&&$(o.section)},[o.label?(s(),n("p",{key:0,class:i(["text-xs uppercase tracking-[0.3em] font-semibold mb-2",t(l)?"text-white/30":"text-black/35"])},u(o.label),3)):f("",!0),e("h2",{class:i(["font-serif text-lg font-bold leading-snug mb-2",t(l)?"text-white/95":"text-black/90"])},u(o.title),3),o.author?(s(),n("p",{key:1,class:i(["text-xs mb-2",t(l)?"text-white/40":"text-black/40"])}," By "+u(o.author),3)):f("",!0),e("p",{class:i(["font-serif text-sm leading-relaxed",t(l)?"text-white/70":"text-black/60"])},u(o.text),3)],10,bl)):(s(),n("button",{key:2,class:i(["text-left px-4 py-4 transition-colors flex flex-col cursor-pointer",[t(l)?"bg-[#0a0a0a] hover:bg-white/[0.03]":"bg-[#faf9f6] hover:bg-black/[0.02]",o.type==="dark"?t(l)?"bg-white/[0.04]":"bg-black/[0.04]":""]]),onClick:h=>o.section&&$(o.section)},[o.label?(s(),n("p",{key:0,class:i(["text-xs uppercase tracking-[0.25em] font-semibold mb-1.5",t(l)?"text-white/25":"text-black/30"])},u(o.label),3)):f("",!0),o.title?(s(),n("h3",{key:1,class:i(["font-serif text-sm font-bold leading-snug mb-1",t(l)?"text-white/90":"text-black/85"])},u(o.title),3)):f("",!0),e("p",{class:i(["font-serif text-xs leading-relaxed flex-1",[t(l)?"text-white/55":"text-black/50",o.title?"":"italic"]])},u(o.text),3)],10,vl))],64))),128))],2)]),a.sections.length===0?(s(),n("div",fl,[e("p",{class:i(["text-sm",t(l)?"text-white/40":"text-gray-400"])}," No sections to display ",2)])):f("",!0)])],2))}}),st=De(ml,[["__scopeId","data-v-02741b8c"]]),wl={class:"h-full flex flex-col"},yl={class:"flex items-center justify-between gap-2"},kl={class:"flex items-center gap-2 shrink-0"},$l=["placeholder"],_l={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Cl={class:"grid grid-cols-2 sm:grid-cols-3 gap-4"},jl=["aria-label","onClick"],Sl={class:"cover-card flex-1 min-h-0 relative"},Ml={class:"aspect-[4/3] flex flex-col w-full overflow-hidden rounded-[10px]"},Tl={class:"flex-1 min-h-0 relative"},Dl=["src","alt","onError"],Il={key:2,class:"absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent pointer-events-none"},Bl={key:0,class:"flex items-center justify-center py-12"},nt=G({__name:"NewsGrid",props:{articles:{},title:{default:"News & Articles"},query:{default:""},variant:{default:"news"}},setup(a){const c=a,{isDark:l}=Z(),{openArticleDetail:w,openWebsiteDetail:g}=$e(),v=S(""),x=S(new Set);function m(h){return!h||typeof h!="string"?!1:/^https?:\/\//i.test(h.trim())}function $(h){x.value=new Set([...x.value,h])}function _(h){try{return new URL(h).hostname.replace(/^www\./,"")}catch{return h}}function b(h){return c.variant==="websites"?Ot(h.title,_(h.url)):Ht(h.title,_(h.url))}function d(h){c.variant==="websites"?g(h):w(h)}function o(h,M){if(!M.trim())return 0;const L=M.toLowerCase().split(/\s+/).filter(y=>y.length>1);if(L.length===0)return 0;const D=h.title.toLowerCase(),C=(h.content??"").toLowerCase(),k=h.url.toLowerCase();let p=0;for(const y of L)D.includes(y)&&(p+=3),C.includes(y)&&(p+=2),k.includes(y)&&(p+=1);return p}const r=B(()=>{let h=c.articles;if(v.value.trim()){const M=v.value.toLowerCase();h=h.filter(j=>j.title.toLowerCase().includes(M)||(j.content??"").toLowerCase().includes(M)||j.url.toLowerCase().includes(M))}return c.query.trim()?[...h].sort((M,j)=>o(j,c.query)-o(M,c.query)):h});return(h,M)=>(s(),n("div",wl,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",yl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",kl,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(r.value.length)+" "+u(a.variant==="websites"?"websites":"articles"),3),ie(h.$slots,"header-actions")])]),W(e("input",{"onUpdate:modelValue":M[0]||(M[0]=j=>v.value=j),type:"text",placeholder:a.variant==="websites"?"Search websites...":"Search articles...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,10,$l),[[J,v.value]])],4),e("div",_l,[e("div",Cl,[(s(!0),n(I,null,P(r.value,(j,L)=>(s(),n("button",{key:L,class:"group flex flex-col items-stretch text-left w-full path-glass-bubble rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105","aria-label":j.title,onClick:D=>d(j)},[e("div",Sl,[e("div",Ml,[e("div",Tl,[m(j.imgSrc)&&!x.value.has(j.url)?(s(),n("img",{key:0,src:j.imgSrc,alt:j.title,class:"absolute inset-0 w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",onError:D=>$(j.url)},null,40,Dl)):(s(),n("div",{key:1,class:"absolute inset-0 bg-cover bg-center",style:q({backgroundImage:`url(${b(j)})`})},null,4)),m(j.imgSrc)&&!x.value.has(j.url)?(s(),n("div",Il)):f("",!0)]),e("div",{class:i(["shrink-0 p-2 backdrop-blur-md rounded-b-[10px]",[t(l)?"bg-black shadow-[inset_0_1px_0_rgba(255,255,255,0.12)]":"bg-white shadow-[inset_0_1px_0_rgba(0,0,0,0.06)]"]])},[e("p",{class:i(["text-xs font-semibold leading-tight line-clamp-2",t(l)?"text-white/95":"text-gray-900"])},u(j.title),3),j.content?(s(),n("p",{key:0,class:i(["text-xs line-clamp-1 mt-0.5",t(l)?"text-white/70":"text-gray-600"])},u(j.content),3)):f("",!0),e("p",{class:i(["text-xs truncate mt-0.5",t(l)?"text-white/50":"text-gray-500"])},u(_(j.url)),3)],2)])])],8,jl))),128))]),r.value.length===0?(s(),n("div",Bl,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])},u(a.variant==="websites"?"No websites match your search":"No articles match your search"),3)])):f("",!0)])]))}}),Ll={class:"h-full flex flex-col"},Pl={class:"flex items-center justify-between gap-2"},Nl={class:"flex items-center gap-2 shrink-0"},Al={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},zl={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},El=["aria-label","onClick"],Fl={class:"aspect-[3/1] relative w-full overflow-hidden"},Rl=["src","alt"],Vl={class:"p-3"},Ul={class:"flex items-center gap-3 mt-2 flex-wrap"},ql={key:0,class:"flex items-center justify-center py-12"},Gl=G({__name:"RecipeGrid",props:{recipes:{},title:{default:"Recipes"}},emits:["selectRecipe"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=B(()=>{if(!w.value.trim())return c.recipes;const v=w.value.toLowerCase();return c.recipes.filter(x=>x.title.toLowerCase().includes(v)||x.ingredients.some(m=>m.toLowerCase().includes(v)))});return(v,x)=>(s(),n("div",Ll,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Pl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("div",Nl,[e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(g.value.length)+" recipes ",3),ie(v.$slots,"header-actions")])]),a.recipes.length>3?W((s(),n("input",{key:0,"onUpdate:modelValue":x[0]||(x[0]=m=>w.value=m),type:"text",placeholder:"Search recipes...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2)),[[J,w.value]]):f("",!0)],4),e("div",Al,[e("div",zl,[(s(!0),n(I,null,P(g.value,(m,$)=>(s(),n("button",{key:$,class:i(["group flex flex-col items-stretch text-left w-full rounded-2xl overflow-hidden transition-all duration-200 hover:brightness-105",t(l)?"bg-white/[0.04] border border-white/8 hover:bg-white/[0.07]":"bg-black/[0.02] border border-black/5 hover:bg-black/[0.05]"]),"aria-label":m.title,onClick:_=>v.$emit("selectRecipe",m)},[e("div",Fl,[e("img",{src:t(Wt)(m.title,m.time),alt:m.title,class:"w-full h-full object-cover"},null,8,Rl)]),e("div",Vl,[e("p",{class:i(["text-sm font-semibold leading-tight line-clamp-2",t(l)?"text-white/90":"text-gray-900"])},u(m.title),3),e("div",Ul,[m.time?(s(),n("span",{key:0,class:i(["flex items-center gap-1 text-xs",t(l)?"text-white/40":"text-gray-500"])},[x[1]||(x[1]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),ne(" "+u(m.time),1)],2)):f("",!0),m.servings?(s(),n("span",{key:1,class:i(["flex items-center gap-1 text-xs",t(l)?"text-white/40":"text-gray-500"])},[x[2]||(x[2]=e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),ne(" "+u(m.servings),1)],2)):f("",!0),m.calories?(s(),n("span",{key:2,class:i(["text-xs",t(l)?"text-white/40":"text-gray-500"])},u(m.calories)+" cal ",3)):f("",!0)]),m.ingredients.length>0?(s(),n("p",{key:0,class:i(["text-xs mt-2 line-clamp-1",t(l)?"text-white/25":"text-gray-400"])},u(m.ingredients.slice(0,4).join(" · ")),3)):f("",!0)])],10,El))),128))]),g.value.length===0?(s(),n("div",ql,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No recipes match your search ",2)])):f("",!0)])]))}}),Ol={class:"h-full flex flex-col"},Hl={class:"flex items-center justify-between gap-2"},Wl={class:"flex flex-wrap gap-1.5"},Kl=["onClick"],Yl={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-4 pb-16"},Ql={class:"space-y-2"},Jl=["aria-label","onClick"],Zl={class:"text-white/90"},Xl={class:"flex-1 min-w-0"},eo={class:"flex items-center gap-2"},to={class:"flex gap-1 mt-1.5"},so={key:0,class:"flex items-center justify-center py-12"},no=G({__name:"AppsGrid",props:{apps:{},title:{default:"Recommended Apps"}},emits:["selectApp"],setup(a){const c=a,{isDark:l}=Z(),w=S(""),g=S(null),v=[{value:"nostr-client",label:"Nostr"},{value:"lightning-wallet",label:"Lightning"},{value:"bitcoin-wallet",label:"Bitcoin"},{value:"privacy",label:"Privacy"},{value:"node",label:"Nodes"},{value:"dev-tool",label:"Dev"}];function x(b){return v.find(d=>d.value===b)?.label??b}function m(b){return{ios:"iOS",android:"Android",web:"Web",desktop:"Desktop",cli:"CLI",nodeos:"Node"}[b]??b}function $(b){let d=0;for(let r=0;r{let b=c.apps;if(w.value){const d=w.value.toLowerCase();b=b.filter(o=>o.name.toLowerCase().includes(d)||o.description.toLowerCase().includes(d)||o.keywords.some(r=>r.toLowerCase().includes(d)))}return g.value&&(b=b.filter(d=>d.category===g.value)),b});return(b,d)=>(s(),n("div",Ol,[e("div",{class:"p-4 space-y-3",style:q(t(l)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",Hl,[e("h3",{class:i(["text-sm font-bold",t(l)?"text-white/90":"text-gray-900"])},u(a.title),3),e("span",{class:i(["text-xs font-mono",t(l)?"text-white/30":"text-gray-400"])},u(_.value.length)+" apps ",3)]),W(e("input",{"onUpdate:modelValue":d[0]||(d[0]=o=>w.value=o),type:"text",placeholder:"Search apps...",class:i(["w-full px-3 py-2 rounded-lg text-base outline-none transition-colors",t(l)?"bg-white/5 text-white/80 placeholder:text-white/25 focus:bg-white/10":"bg-black/3 text-gray-800 placeholder:text-gray-400 focus:bg-black/5"])},null,2),[[J,w.value]]),e("div",Wl,[(s(),n(I,null,P(v,o=>e("button",{key:o.value,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",g.value===o.value?"nav-tab-active":t(l)?"text-white/40 hover:text-white/70 hover:bg-white/5":"text-gray-500 hover:text-gray-800 hover:bg-black/5"]),onClick:r=>g.value=g.value===o.value?null:o.value},u(o.label),11,Kl)),64))])],4),e("div",Yl,[e("div",Ql,[(s(!0),n(I,null,P(_.value,o=>(s(),n("button",{key:o.id,class:i(["w-full text-left p-3 rounded-xl transition-all duration-200 flex items-start gap-3",t(l)?"bg-white/5 hover:bg-white/10":"bg-black/3 hover:bg-black/5"]),"aria-label":o.name,onClick:r=>b.$emit("selectApp",o)},[e("div",{class:"w-10 h-10 rounded-xl flex items-center justify-center text-lg font-bold shrink-0",style:q({background:$(o.id)})},[e("span",Zl,u(o.name.charAt(0)),1)],4),e("div",Xl,[e("div",eo,[e("p",{class:i(["text-xs font-semibold truncate",t(l)?"text-white/90":"text-gray-900"])},u(o.name),3),e("span",{class:i(["text-xs px-1.5 py-0.5 rounded font-medium shrink-0",t(l)?"bg-white/10 text-white/50":"bg-black/5 text-gray-500"])},u(x(o.category)),3)]),e("p",{class:i(["text-xs mt-0.5 line-clamp-2",t(l)?"text-white/50":"text-gray-500"])},u(o.description),3),e("div",to,[(s(!0),n(I,null,P(o.platforms,r=>(s(),n("span",{key:r,class:i(["text-xs px-1 py-0.5 rounded",t(l)?"bg-white/5 text-white/30":"bg-black/3 text-gray-400"])},u(m(r)),3))),128))])])],10,Jl))),128))]),_.value.length===0?(s(),n("div",so,[e("p",{class:i(["text-sm",t(l)?"text-white/30":"text-gray-400"])}," No apps match your search ",2)])):f("",!0)])]))}}),lo={class:"group/node"},oo={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},ao={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"},io={class:"truncate flex-1"},ro={key:0,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},co={key:0,class:"w-2.5 h-2.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},uo={key:0},ho=G({__name:"FileTreeNode",props:{entry:{},activeFile:{},depth:{}},emits:["select","toggle-context"],setup(a,{emit:c}){const l=a,{isFileSelected:w}=pe(),g=c,{isDark:v}=Z(),x=S(l.depth<1),m=B(()=>!l.entry.isDirectory&&l.activeFile===l.entry.path),$=B(()=>!l.entry.isDirectory&&w(l.entry.path)),_=B(()=>l.entry.isDirectory&&w(l.entry.path));function b(){l.entry.isDirectory?x.value=!x.value:g("select",l.entry.path)}function d(){g("toggle-context",l.entry.path)}function o(){g("toggle-context",l.entry.path)}return(r,h)=>{const M=Kt("FileTreeNode",!0);return s(),n("div",lo,[e("div",{class:i(["w-full flex items-center gap-1.5 py-1 px-2 rounded-lg text-xs transition-colors cursor-pointer",[m.value?t(v)?"bg-white/10 text-white/90":"bg-black/8 text-gray-900":t(v)?"text-white/60 hover:bg-white/[0.04] hover:text-white/80":"text-gray-600 hover:bg-black/[0.03] hover:text-gray-800"]]),style:q({paddingLeft:`${a.depth*12+8}px`}),onClick:b},[a.entry.isDirectory?(s(),n("svg",{key:0,class:i(["w-3 h-3 shrink-0 transition-transform duration-150",x.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...h[2]||(h[2]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2)):f("",!0),(s(),n("svg",{class:i(["w-3.5 h-3.5 shrink-0",a.entry.isDirectory?"text-accent/70":t(v)?"text-white/30":"text-gray-400"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[a.entry.isDirectory?(s(),n("path",oo)):(s(),n("path",ao))],2)),e("span",io,u(a.entry.name),1),a.entry.isDirectory?f("",!0):(s(),n("button",{key:1,class:i(["shrink-0 w-4 h-4 rounded-full border flex items-center justify-center transition-all ml-auto",[$.value?"bg-accent border-accent text-white":t(v)?"border-white/20 opacity-0 group-hover/node:opacity-100 hover:border-white/40":"border-black/15 opacity-0 group-hover/node:opacity-100 hover:border-black/30"]]),"aria-label":"Toggle file for chat context",onClick:xe(d,["stop"])},[$.value?(s(),n("svg",ro,[...h[3]||(h[3]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],2)),a.entry.isDirectory?(s(),n("button",{key:2,class:i(["shrink-0 w-4 h-4 rounded-full border flex items-center justify-center transition-all ml-auto",[_.value?"bg-accent border-accent text-white":t(v)?"border-white/20 opacity-0 group-hover/node:opacity-100 hover:border-white/40":"border-black/15 opacity-0 group-hover/node:opacity-100 hover:border-black/30"]]),"aria-label":"Add folder to chat context",onClick:xe(o,["stop"])},[_.value?(s(),n("svg",co,[...h[4]||(h[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],2)):f("",!0)],6),a.entry.isDirectory&&x.value&&a.entry.children?(s(),n("div",uo,[(s(!0),n(I,null,P(a.entry.children,j=>(s(),U(M,{key:j.path,entry:j,"active-file":a.activeFile,depth:a.depth+1,onSelect:h[0]||(h[0]=L=>r.$emit("select",L)),onToggleContext:h[1]||(h[1]=L=>r.$emit("toggle-context",L))},null,8,["entry","active-file","depth"]))),128))])):f("",!0)])}}}),xo={class:"flex flex-col h-full"},po={class:"flex items-center gap-1 min-w-0 flex-1"},go={class:"flex items-center gap-2 shrink-0"},bo={key:0,class:"flex-1 overflow-y-auto custom-scrollbar p-3"},vo={class:"mb-3 flex gap-2"},fo={class:"flex justify-end gap-2"},mo=["disabled"],wo={class:"grid grid-cols-2 gap-2"},yo=["onClick"],ko={key:1,class:"flex-1 overflow-y-auto custom-scrollbar p-2"},$o={key:0,class:"flex items-center justify-center py-12"},_o=G({__name:"ProjectGrid",props:{isWideDesktop:{type:Boolean},isMobile:{type:Boolean}},setup(a){const{isDark:c}=Z(),{projectList:l,activeProject:w,fileTree:g,activeFile:v,codeMode:x,selectedFiles:m,selectProject:$,openFile:_,createProject:b,clearActiveFile:d,toggleFileSelection:o,isFileSelected:r,loadProjects:h}=pe();le(()=>{l.value.length===0&&h()});const M=S(""),j=S(!1),L=S(""),D=S(null),C=B(()=>w.value?"filetree":"projects"),k=B(()=>C.value==="projects"?"Projects":w.value?.name??"Projects"),p=B(()=>{const F=M.value.toLowerCase();return F?l.value.filter(O=>O.name.toLowerCase().includes(F)||(O.language??"").toLowerCase().includes(F)):l.value});function y(F){$(F)}function A(){const{activeProject:F,fileTree:O}=pe();F.value=null,O.value=[],d()}function V(F){_(F)}function E(F){o(F)}function Q(){j.value=!0,L.value="",ye(()=>D.value?.focus())}function H(){j.value=!1,L.value=""}function K(){const F=L.value.trim();F&&(b(F),j.value=!1,L.value="")}return(F,O)=>(s(),n("div",xo,[e("div",{class:"shrink-0 px-4 py-3 flex items-center justify-between gap-2",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("div",po,[C.value!=="projects"?(s(),n("button",{key:0,class:i(["text-xs shrink-0 transition-colors",t(c)?"text-white/40 hover:text-white/70 hover:underline":"text-gray-400 hover:text-gray-700 hover:underline"]),onClick:A}," Projects ",2)):f("",!0),C.value!=="projects"?(s(),n("span",{key:1,class:i(["text-xs shrink-0",t(c)?"text-white/20":"text-gray-300"])},"/",2)):f("",!0),e("span",{class:i(["text-sm font-semibold truncate",t(c)?"text-white/90":"text-gray-900"])},u(k.value),3)]),e("div",go,[C.value==="projects"?(s(),n("p",{key:0,class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(t(l).length)+" repos ",3)):C.value==="filetree"?(s(),n("p",{key:1,class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(t(w)?.language),3)):f("",!0),ie(F.$slots,"header-actions")])],4),C.value==="projects"?(s(),n("div",bo,[e("div",vo,[W(e("input",{"onUpdate:modelValue":O[0]||(O[0]=X=>M.value=X),type:"text",placeholder:"Search projects...",class:i(["flex-1 min-w-0 px-3 py-2 rounded-lg text-base bg-transparent outline-none",t(c)?"text-white/80 placeholder:text-white/20 border border-white/10 focus:border-white/25":"text-gray-800 placeholder:text-gray-400 border border-black/10 focus:border-black/20"])},null,2),[[J,M.value]]),e("button",{class:i(["shrink-0 px-3 py-2 rounded-lg text-xs font-medium transition-colors flex items-center gap-1.5",t(c)?"bg-accent/20 text-accent hover:bg-accent/30":"bg-accent/10 text-accent hover:bg-accent/20"]),onClick:Q},[...O[2]||(O[2]=[e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),ne(" New ",-1)])],2)]),j.value?(s(),n("div",{key:0,class:i(["mb-3 p-3 rounded-xl",t(c)?"bg-white/[0.05] border border-white/10":"bg-black/[0.03] border border-black/8"])},[e("p",{class:i(["text-xs font-medium mb-2",t(c)?"text-white/70":"text-gray-700"])}," New Project ",2),W(e("input",{ref_key:"newProjectInputRef",ref:D,"onUpdate:modelValue":O[1]||(O[1]=X=>L.value=X),type:"text",placeholder:"Project name...",class:i(["w-full px-3 py-2 rounded-lg text-base bg-transparent outline-none mb-2",t(c)?"text-white/80 placeholder:text-white/20 border border-white/10 focus:border-white/25":"text-gray-800 placeholder:text-gray-400 border border-black/10 focus:border-black/20"]),onKeydown:[ae(K,["enter"]),ae(H,["escape"])]},null,34),[[J,L.value]]),e("div",fo,[e("button",{class:i(["text-xs px-2.5 py-1 rounded-lg transition-colors",t(c)?"text-white/40 hover:text-white/70":"text-gray-500 hover:text-gray-800"]),onClick:H}," Cancel ",2),e("button",{class:i(["text-xs px-2.5 py-1 rounded-lg font-medium transition-colors",t(c)?"bg-accent/20 text-accent hover:bg-accent/30":"bg-accent/10 text-accent hover:bg-accent/20"]),disabled:!L.value.trim(),onClick:K}," Create ",10,mo)])],2)):f("",!0),e("div",wo,[(s(!0),n(I,null,P(p.value,X=>(s(),n("button",{key:X.path,class:i(["text-left p-3 rounded-xl transition-all duration-150",t(c)?"bg-white/[0.03] hover:bg-white/[0.07] border border-white/5":"bg-black/[0.02] hover:bg-black/[0.05] border border-black/5"]),onClick:ge=>y(X)},[e("div",{class:i(["w-8 h-8 rounded-lg flex items-center justify-center mb-2",t(c)?"bg-white/5":"bg-black/5"])},[(s(),n("svg",{class:i(["w-4 h-4",X.isGit?"text-accent":t(c)?"text-white/40":"text-gray-400"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...O[3]||(O[3]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"},null,-1)])],2))],2),e("p",{class:i(["text-xs font-medium truncate",t(c)?"text-white/80":"text-gray-800"])},u(X.name),3),e("p",{class:i(["text-xs mt-0.5 truncate",t(c)?"text-white/25":"text-gray-400"])},u(X.language),3)],10,yo))),128))])])):C.value==="filetree"?(s(),n("div",ko,[(s(!0),n(I,null,P(t(g),X=>(s(),U(ho,{key:X.path,entry:X,"active-file":t(v),depth:0,onSelect:V,onToggleContext:E},null,8,["entry","active-file"]))),128)),t(g).length===0?(s(),n("div",$o,[e("p",{class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])}," Loading file tree... ",2)])):f("",!0)])):f("",!0)]))}}),Co={class:"flex flex-col h-full"},jo={class:"shrink-0 px-4 py-2 flex gap-1.5 overflow-x-auto scrollbar-hide"},So=["onClick"],Mo={class:"flex-1 overflow-y-auto px-4 py-3"},To={class:"grid grid-cols-2 gap-2"},Do=["onClick"],Io=["onClick"],Bo={key:0,class:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Lo={key:2,class:"h-8 flex items-end gap-0.5 mb-2"},Po={key:3,class:"h-8 flex items-center mb-2"},No={key:0,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"},Ao={key:1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"},zo={key:2,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"},Eo={key:3,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"},Fo=G({__name:"DesignSystemGrid",setup(a){const{isDark:c}=Z(),{openDesignSystemItem:l}=$e(),{codeMode:w,toggleDesignToken:g,isDesignTokenSelected:v}=pe(),x=S("all"),m=[{id:"all",label:"All"},{id:"colors",label:"Colors"},{id:"typography",label:"Typography"},{id:"spacing",label:"Spacing"},{id:"atoms",label:"Atoms"},{id:"molecules",label:"Molecules"},{id:"organisms",label:"Organisms"}],$=[{id:"color-bg",name:"Background",category:"colors",preview:"inline",description:"Primary app background",code:`background-color: #0a0a0a; /* Tailwind: bg-[#0a0a0a] */`,usedIn:"ChatPage, all panels, base layout"},{id:"color-accent",name:"Accent / Bitcoin",category:"colors",preview:"inline",description:"Primary action color, Bitcoin orange",code:`color: #F7931A; /* Tailwind: text-accent */`,usedIn:"Gradient buttons, active tabs, zap counts, CTA elements"},{id:"color-primary",name:"Primary",category:"colors",preview:"inline",description:"Primary neutral tone",code:`color: #606060; /* Tailwind: text-primary */`,usedIn:"Secondary text, borders, muted elements"},{id:"color-surface",name:"Glass Surface",category:"colors",preview:"inline",description:"Glass morphism panel background",code:`background: rgba(0, 0, 0, 0.35); @@ -238,7 +238,7 @@ rounded-full /* pill buttons */`,usedIn:"Badges (md), buttons (lg), cards (xl), opacity: 1; transform: scale(1); } -}`,usedIn:"Modal entries, tooltip appearances, popovers"}],_=B(()=>x.value==="all"?$:$.filter(o=>o.category===x.value));function b(o){l(o)}function d(o){const r=/(?:background-color|color|background):\s*([^;]+)/i.exec(o);if(!r)return"#333";const h=r[1].trim();return h.startsWith("#")||h.startsWith("rgb")||h.startsWith("hsl")?h:"#333"}return(o,r)=>(s(),n("div",Co,[e("div",{class:"shrink-0 px-4 py-3 flex items-center justify-between gap-2",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("span",{class:i(["text-sm font-semibold",t(c)?"text-white/90":"text-gray-900"])}," Design System ",2),e("p",{class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(_.value.length)+" items ",3)],4),e("div",jo,[(s(),n(I,null,P(m,h=>e("button",{key:h.id,class:i(["text-xs px-2.5 py-1 rounded-md font-medium whitespace-nowrap transition-colors",x.value===h.id?"bg-accent/20 text-accent":t(c)?"bg-white/5 text-white/50 hover:bg-white/10":"bg-black/5 text-gray-500 hover:bg-black/10"]),onClick:M=>x.value=h.id},u(h.label),11,So)),64))]),e("div",Mo,[e("div",To,[(s(!0),n(I,null,P(_.value,h=>(s(),n("button",{key:h.id,class:i(["text-left p-3 rounded-xl transition-all duration-150 group relative",[t(w)&&t(v)(h.id)?"ring-2 ring-accent/50 bg-accent/10 cursor-pointer":t(c)?"bg-white/[0.03] hover:bg-white/[0.07] cursor-pointer":"bg-black/[0.02] hover:bg-black/[0.05] cursor-pointer"]]),onClick:M=>b(h)},[t(w)?(s(),n("div",{key:0,class:i(["absolute top-2 right-2 min-w-[44px] min-h-[44px] rounded-full flex items-center justify-center z-10 cursor-pointer transition-colors",t(v)(h.id)?"bg-accent":t(c)?"bg-white/10 hover:bg-white/20":"bg-black/10 hover:bg-black/20"]),onClick:xe(M=>t(g)(h.id),["stop"])},[t(v)(h.id)?(s(),n("svg",Bo,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],10,Io)):f("",!0),h.category==="colors"&&h.preview==="inline"?(s(),n("div",{key:1,class:i(["h-8 rounded-md mb-2 border",t(c)?"border-white/10":"border-black/10"]),style:q({background:d(h.code)})},null,6)):h.category==="spacing"&&h.preview==="inline"?(s(),n("div",Lo,[...r[1]||(r[1]=[e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"30%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"50%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"70%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"100%"}},null,-1)])])):(s(),n("div",Po,[(s(),n("svg",{class:i(["w-5 h-5 transition-colors",t(c)?"text-white/20 group-hover:text-white/40":"text-black/15 group-hover:text-black/30"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[h.category==="atoms"?(s(),n("path",No)):h.category==="molecules"?(s(),n("path",Ao)):h.category==="organisms"?(s(),n("path",zo)):(s(),n("path",Eo))],2))])),e("h3",{class:i(["text-xs font-semibold leading-tight mb-0.5",t(c)?"text-white/80":"text-gray-800"])},u(h.name),3),e("p",{class:i(["text-xs leading-snug line-clamp-2",t(c)?"text-white/40":"text-gray-400"])},u(h.description),3)],10,Do))),128))])])]))}}),we=S(null),lt=S(!1),Re=S(!1),he=S(null);function me(){const a=B(()=>{if(!we.value)return null;try{return He(we.value)}catch{return null}}),c=B(()=>!!we.value),l=B(()=>a.value?a.value.slice(0,12)+"..."+a.value.slice(-8):null);function w(){lt.value=typeof window<"u"&&!!window.nostr}async function g(){if(he.value=null,!window.nostr){he.value="No Nostr extension detected. Install nos2x, Alby, or another NIP-07 extension.";return}Re.value=!0;try{const m=await window.nostr.getPublicKey();we.value=m}catch(m){he.value=m instanceof Error?m.message:"Failed to get public key"}finally{Re.value=!1}}async function v(m){if(he.value=null,!window.nostr)return he.value="No Nostr extension detected",null;try{return await window.nostr.signEvent(m)}catch($){return he.value=$ instanceof Error?$.message:"Failed to sign event",null}}function x(){we.value=null,he.value=null}return le(()=>{w(),setTimeout(w,500)}),{pubkey:we,npub:a,isAvailable:lt,isLoggedIn:c,isLoading:Re,error:he,truncatedNpub:l,login:g,logout:x,signEvent:v,checkAvailability:w}}const Ro="aiui-nostr-dms",Vo=1,ke="messages",je=S([]),Se=S(null),Ve=S(!1);let Me=null;function vt(){return Me||(Me=new Promise((a,c)=>{const l=indexedDB.open(Ro,Vo);l.onupgradeneeded=()=>{const w=l.result;if(!w.objectStoreNames.contains(ke)){const g=w.createObjectStore(ke,{keyPath:"id"});g.createIndex("contact","contactPubkey",{unique:!1}),g.createIndex("created_at","created_at",{unique:!1})}},l.onsuccess=()=>a(l.result),l.onerror=()=>{Me=null,c(l.error)}}),Me)}function Uo(a){return a.length<=12?a:a.slice(0,8)+"..."+a.slice(-4)}async function ot(a,c){const l=await vt(),w=a.fromPubkey===c?a.toPubkey:a.fromPubkey,g={...a,contactPubkey:w};return new Promise((v,x)=>{const m=l.transaction(ke,"readwrite");m.objectStore(ke).put(g),m.oncomplete=()=>v(),m.onerror=()=>x(m.error)})}async function Ue(){const a=await vt();return new Promise((c,l)=>{const g=a.transaction(ke,"readonly").objectStore(ke).getAll();g.onsuccess=()=>c(g.result),g.onerror=()=>l(g.error)})}function qe(a){const c=new Map;for(const w of a){const g=c.get(w.contactPubkey)??[];g.push(w),c.set(w.contactPubkey,g)}const l=[];for(const[w,g]of c)g.sort((v,x)=>v.created_at-x.created_at),l.push({contactPubkey:w,contactName:Uo(w),messages:g,lastMessage:g[g.length-1]??null,unread:0});return l.sort((w,g)=>(g.lastMessage?.created_at??0)-(w.lastMessage?.created_at??0)),l}function qo(){const{pubkey:a,isLoggedIn:c}=me(),l=B(()=>Se.value?je.value.find($=>$.contactPubkey===Se.value)??null:null);async function w(){if(c.value){Ve.value=!0;try{const $=await Ue();je.value=qe($)}catch{}finally{Ve.value=!1}}}async function g($,_){if(!window.nostr?.nip04||!a.value)return!1;try{const b=await window.nostr.nip04.encrypt($,_),d={kind:4,created_at:Math.floor(Date.now()/1e3),tags:[["p",$]],content:b},o=await window.nostr.signEvent(d);if(!o)return!1;const r={id:o.id,fromPubkey:a.value,toPubkey:$,content:_,created_at:o.created_at,decrypted:!0};await ot(r,a.value);const{publishEvent:h}=await pt(()=>import("./useNostr-DMx0ZF7J.js"),__vite__mapDeps([0,1,2])).then(j=>j.useNostr());await h(o);const M=await Ue();return je.value=qe(M),!0}catch{return!1}}async function v($,_,b,d){if(!(!window.nostr?.nip04||!a.value))try{const o=await window.nostr.nip04.decrypt(_,b),r={id:$,fromPubkey:_,toPubkey:a.value,content:o,created_at:d,decrypted:!0};await ot(r,a.value);const h=await Ue();je.value=qe(h)}catch{}}function x($){Se.value=$}function m(){Se.value=null}return{threads:je,activeThread:l,activeContact:Se,isLoading:Ve,loadDMs:w,sendDM:g,receiveDM:v,selectContact:x,clearActiveContact:m}}const Go={class:"h-full flex flex-col"},Oo={class:"flex items-center gap-2 px-4 py-3 border-b border-white/[0.08]"},Ho={class:"flex-1 min-w-0"},Wo={class:"text-xs font-semibold text-white/80 truncate"},Ko={class:"text-xs text-white/30 font-mono truncate"},Yo={class:"text-xs leading-relaxed break-words"},Qo={class:"text-xs mt-1 text-white/25 tabular-nums"},Jo={class:"px-4 py-3 border-t border-white/[0.08]"},Zo={class:"flex gap-2"},Xo=["disabled"],ea={class:"p-4 border-b border-white/[0.08]"},ta={class:"flex items-center justify-between gap-2 mb-3"},sa={key:0,class:"space-y-2 mb-3"},na=["disabled"],la={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-1"},oa={key:0,class:"flex items-center justify-center py-12"},aa={key:1,class:"flex items-center justify-center py-12"},ia={key:2,class:"flex items-center justify-center py-12"},ra=["onClick"],ca={class:"flex items-start gap-2.5"},da={class:"w-8 h-8 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-accent/20 text-accent"},ua={class:"flex-1 min-w-0"},ha={class:"flex items-center gap-1.5"},xa={class:"text-xs font-semibold truncate text-white/80"},pa={key:0,class:"text-xs ml-auto shrink-0 text-white/20"},ga={key:0,class:"text-xs mt-1 text-white/40 truncate"},ba=G({__name:"NostrDMs",setup(a){const{threads:c,activeThread:l,activeContact:w,isLoading:g,loadDMs:v,sendDM:x,selectContact:m,clearActiveContact:$}=qo(),{pubkey:_,isLoggedIn:b}=me(),d=S(""),o=S(!1),r=S(null),h=S(!1),M=S("");function j(k){const p=new Date(k*1e3),A=Math.floor((new Date().getTime()-p.getTime())/864e5);return A===0?p.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):A<7?p.toLocaleDateString("en",{weekday:"short"}):p.toLocaleDateString("en",{month:"short",day:"numeric"})}async function L(){if(!d.value.trim()||o.value||!w.value)return;o.value=!0,await x(w.value,d.value.trim())&&(d.value="",await ye(),D()),o.value=!1}function D(){r.value&&(r.value.scrollTop=r.value.scrollHeight)}function C(){let k=M.value.trim();if(k.startsWith("npub"))try{k=gt(k)}catch{return}k.length===64&&(m(k),h.value=!1,M.value="")}return ce(w,async()=>{await ye(),D()}),le(()=>{v()}),(k,p)=>(s(),n("div",Go,[t(l)?(s(),n(I,{key:0},[e("div",Oo,[e("button",{class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded-lg text-white/60 hover:text-white/80 hover:bg-white/10 transition-colors",onClick:p[0]||(p[0]=(...y)=>t($)&&t($)(...y))},[...p[4]||(p[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),e("div",Ho,[e("p",Wo,u(t(l).contactName),1),e("p",Ko,u(t(l).contactPubkey),1)])]),e("div",{ref_key:"messagesRef",ref:r,class:"flex-1 overflow-y-auto custom-scrollbar px-4 py-3 space-y-2"},[(s(!0),n(I,null,P(t(l).messages,y=>(s(),n("div",{key:y.id,class:i(["flex",y.fromPubkey===t(_)?"justify-end":"justify-start"])},[e("div",{class:i(["max-w-[80%] rounded-xl px-3 py-2",y.fromPubkey===t(_)?"bg-accent/15 text-white/80":"bg-white/5 text-white/70"])},[e("p",Yo,u(y.content),1),e("p",Qo,u(j(y.created_at)),1)],2)],2))),128))],512),e("div",Jo,[e("div",Zo,[W(e("input",{"onUpdate:modelValue":p[1]||(p[1]=y=>d.value=y),type:"text",placeholder:"Type a message...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",onKeydown:ae(L,["enter"])},null,544),[[J,d.value]]),e("button",{class:"px-3 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!d.value.trim()||o.value,onClick:L}," Send ",8,Xo)])])],64)):(s(),n(I,{key:1},[e("div",ea,[e("div",ta,[p[5]||(p[5]=e("h3",{class:"text-sm font-bold text-white/90"},"Messages",-1)),e("button",{class:"text-xs px-2.5 py-1 rounded bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors",onClick:p[2]||(p[2]=y=>h.value=!h.value)},u(h.value?"Cancel":"New"),1)]),h.value?(s(),n("div",sa,[W(e("input",{"onUpdate:modelValue":p[3]||(p[3]=y=>M.value=y),type:"text",placeholder:"Recipient hex pubkey or npub...",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono"},null,512),[[J,M.value]]),e("button",{class:"text-xs px-2.5 py-1 rounded bg-white/5 text-white/60 hover:bg-white/10 transition-colors disabled:opacity-30",disabled:!M.value.trim(),onClick:C}," Start conversation ",8,na)])):f("",!0)]),e("div",la,[t(b)?t(g)?(s(),n("div",aa,[...p[7]||(p[7]=[e("p",{class:"text-xs text-white/30"},"Loading messages...",-1)])])):t(c).length===0?(s(),n("div",ia,[...p[8]||(p[8]=[e("p",{class:"text-xs text-white/30"},"No messages yet",-1)])])):f("",!0):(s(),n("div",oa,[...p[6]||(p[6]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to use DMs",-1)])])),(s(!0),n(I,null,P(t(c),y=>(s(),n("button",{key:y.contactPubkey,class:"w-full text-left p-3 rounded-xl transition-all duration-150 bg-white/[0.03] hover:bg-white/[0.07] border border-white/5",onClick:A=>t(m)(y.contactPubkey)},[e("div",ca,[e("div",da,u(y.contactName.charAt(0).toUpperCase()),1),e("div",ua,[e("div",ha,[e("span",xa,u(y.contactName),1),y.lastMessage?(s(),n("span",pa,u(j(y.lastMessage.created_at)),1)):f("",!0)]),y.lastMessage?(s(),n("p",ga,u(y.lastMessage.content),1)):f("",!0)])])],8,ra))),128))])],64))]))}}),va={class:"h-full flex flex-col"},fa={class:"p-4 border-b border-white/[0.08]"},ma={class:"flex gap-2"},wa=["disabled"],ya={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},ka={class:"flex items-center gap-2"},$a={class:"text-xs font-mono text-white/70 truncate flex-1"},_a={class:"flex items-center gap-2 flex-wrap"},Ca=["onClick"],ja=["onClick"],Sa=["disabled","onClick"],Ma=["onClick"],Ta={key:0,class:"mt-4 pt-4 border-t border-white/5"},Da=["disabled"],Ia={key:0,class:"text-xs mt-1 text-white/30"},Ba=G({__name:"NostrRelayManager",setup(a){const{relayStates:c,addRelay:l,removeRelay:w,toggleRelayRead:g,toggleRelayWrite:v,testRelay:x,importNIP65Relays:m,fetchNote:$}=Ie(),{isLoggedIn:_,pubkey:b}=me(),d=S(""),o=S(null),r=Pe({}),h=S(!1),M=S("");function j(){let C=d.value.trim();C&&(!C.startsWith("wss://")&&!C.startsWith("ws://")&&(C="wss://"+C),l(C),d.value="")}async function L(C){o.value=C;const k=await x(C);r[C]=k,o.value=null}async function D(){if(!b.value)return;h.value=!0,M.value="Fetching relay list...";const C=await $(b.value,5e3);C?(m({id:C.id,pubkey:C.pubkey,kind:10002,content:C.content,created_at:C.created_at,tags:C.tags,sig:""}),M.value="Imported relays from NIP-65"):M.value="No NIP-65 relay list found",h.value=!1}return(C,k)=>(s(),n("div",va,[e("div",fa,[k[1]||(k[1]=e("h3",{class:"text-sm font-bold text-white/90 mb-3"},"Relay Management",-1)),e("div",ma,[W(e("input",{"onUpdate:modelValue":k[0]||(k[0]=p=>d.value=p),type:"text",placeholder:"wss://relay.example.com",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",onKeydown:ae(j,["enter"])},null,544),[[J,d.value]]),e("button",{class:"px-4 min-h-[44px] rounded-lg text-sm bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!d.value.trim(),onClick:j}," Add ",8,wa)])]),e("div",ya,[(s(!0),n(I,null,P(t(c),p=>(s(),n("div",{key:p.url,class:"rounded-xl bg-white/[0.03] border border-white/5 p-3 space-y-2"},[e("div",ka,[e("span",{class:i(["w-2 h-2 rounded-full shrink-0",p.connected?"bg-emerald-500":"bg-red-400/60"])},null,2),e("span",$a,u(p.url),1),p.latencyMs!==null?(s(),n("span",{key:0,class:i(["text-xs tabular-nums shrink-0",p.latencyMs<200?"text-emerald-400/60":p.latencyMs<500?"text-yellow-400/60":"text-red-400/60"])},u(p.latencyMs)+"ms ",3)):f("",!0),e("span",{class:i(["text-xs shrink-0",p.connected?"text-emerald-400/60":"text-red-400/60"])},u(p.connected?"Connected":"Disconnected"),3)]),e("div",_a,[e("button",{class:i(["text-sm px-3 min-h-[44px] rounded-lg transition-colors",p.read?"bg-accent/15 text-accent/80":"bg-white/5 text-white/30 hover:text-white/50"]),onClick:y=>t(g)(p.url)}," Read ",10,Ca),e("button",{class:i(["text-sm px-3 min-h-[44px] rounded-lg transition-colors",p.write?"bg-accent/15 text-accent/80":"bg-white/5 text-white/30 hover:text-white/50"]),onClick:y=>t(v)(p.url)}," Write ",10,ja),k[2]||(k[2]=e("div",{class:"flex-1"},null,-1)),e("button",{class:"text-sm px-3 min-h-[44px] rounded-lg bg-white/5 text-white/30 hover:text-white/50 transition-colors",disabled:o.value===p.url,onClick:y=>L(p.url)},u(o.value===p.url?"Testing...":"Test"),9,Sa),e("button",{class:"text-sm px-3 min-h-[44px] rounded-lg bg-white/5 text-red-400/50 hover:text-red-400/80 hover:bg-red-400/10 transition-colors",onClick:y=>t(w)(p.url)}," Remove ",8,Ma)]),r[p.url]!==void 0?(s(),n("p",{key:0,class:i(["text-xs",r[p.url]!==null?"text-emerald-400/60":"text-red-400/60"])},u(r[p.url]!==null?`Reachable (${r[p.url]}ms)`:"Unreachable"),3)):f("",!0)]))),128)),t(_)?(s(),n("div",Ta,[e("button",{class:"w-full text-left px-3 min-h-[44px] rounded-lg text-sm bg-white/5 text-white/40 hover:text-white/60 hover:bg-white/10 transition-colors",disabled:h.value,onClick:D},u(h.value?"Importing...":"Import relays from NIP-65 (kind:10002)"),9,Da),M.value?(s(),n("p",Ia,u(M.value),1)):f("",!0)])):f("",!0)])]))}}),La={class:"h-full flex flex-col"},Pa={key:0,class:"flex-1 flex items-center justify-center"},Na={key:1,class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-4"},Aa={class:"rounded-xl overflow-hidden border border-white/5"},za={class:"px-4 pb-4 -mt-8"},Ea={key:0,class:"text-lg font-bold text-accent"},Fa={class:"text-sm font-bold text-white/90 mt-2"},Ra={key:0,class:"text-xs text-purple-400/60"},Va={key:1,class:"text-xs text-white/50 mt-1 line-clamp-2"},Ua={class:"space-y-3"},qa=["disabled"],Ga=G({__name:"NostrProfileEditor",setup(a){const{isLoggedIn:c,signEvent:l,pubkey:w}=me(),{publishEvent:g,fetchNote:v}=Ie(),x=Pe({name:"",display_name:"",about:"",picture:"",banner:"",website:"",nip05:"",lud16:""}),m=S(!1),$=S(""),_=S(!1);async function b(){if(!w.value)return;const o=await v(w.value,5e3);if(o&&o.kind===0)try{const r=JSON.parse(o.content);Object.assign(x,r)}catch{}}async function d(){if(!c.value)return;m.value=!0,$.value="";const o={};for(const[L,D]of Object.entries(x))D&&(o[L]=D);const r={kind:0,created_at:Math.floor(Date.now()/1e3),tags:[],content:JSON.stringify(o)},h=await l(r);if(!h){m.value=!1,$.value="Signing failed",_.value=!1;return}const M=await g(h),j=M.filter(L=>L.success).length;m.value=!1,j>0?($.value=`Published to ${j}/${M.length} relays`,_.value=!0):($.value="Failed to publish to any relay",_.value=!1)}return le(()=>{b()}),(o,r)=>(s(),n("div",La,[r[17]||(r[17]=e("div",{class:"p-4 border-b border-white/[0.08]"},[e("h3",{class:"text-sm font-bold text-white/90"},"Nostr Profile")],-1)),t(c)?(s(),n("div",Na,[e("div",Aa,[e("div",{class:i(["h-24 bg-cover bg-center",x.banner?"":"bg-gradient-to-r from-accent/20 to-purple-500/20"]),style:q(x.banner?{backgroundImage:`url(${x.banner})`}:{})},null,6),e("div",za,[e("div",{class:i(["w-16 h-16 rounded-full border-2 border-black bg-cover bg-center flex items-center justify-center",x.picture?"":"bg-accent/20"]),style:q(x.picture?{backgroundImage:`url(${x.picture})`}:{})},[x.picture?f("",!0):(s(),n("span",Ea,u((x.display_name||x.name||"?").charAt(0).toUpperCase()),1))],6),e("p",Fa,u(x.display_name||x.name||"Anonymous"),1),x.nip05?(s(),n("p",Ra,u(x.nip05),1)):f("",!0),x.about?(s(),n("p",Va,u(x.about),1)):f("",!0)])]),e("div",Ua,[e("div",null,[r[9]||(r[9]=e("label",{class:"text-xs text-white/30 block mb-1"},"Display Name",-1)),W(e("input",{"onUpdate:modelValue":r[0]||(r[0]=h=>x.display_name=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"Your display name"},null,512),[[J,x.display_name]])]),e("div",null,[r[10]||(r[10]=e("label",{class:"text-xs text-white/30 block mb-1"},"Username",-1)),W(e("input",{"onUpdate:modelValue":r[1]||(r[1]=h=>x.name=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"username"},null,512),[[J,x.name]])]),e("div",null,[r[11]||(r[11]=e("label",{class:"text-xs text-white/30 block mb-1"},"Bio",-1)),W(e("textarea",{"onUpdate:modelValue":r[2]||(r[2]=h=>x.about=h),class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors resize-none min-h-[60px]",placeholder:"Tell the world about yourself"},null,512),[[J,x.about]])]),e("div",null,[r[12]||(r[12]=e("label",{class:"text-xs text-white/30 block mb-1"},"Avatar URL",-1)),W(e("input",{"onUpdate:modelValue":r[3]||(r[3]=h=>x.picture=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com/avatar.jpg"},null,512),[[J,x.picture]])]),e("div",null,[r[13]||(r[13]=e("label",{class:"text-xs text-white/30 block mb-1"},"Banner URL",-1)),W(e("input",{"onUpdate:modelValue":r[4]||(r[4]=h=>x.banner=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com/banner.jpg"},null,512),[[J,x.banner]])]),e("div",null,[r[14]||(r[14]=e("label",{class:"text-xs text-white/30 block mb-1"},"Website",-1)),W(e("input",{"onUpdate:modelValue":r[5]||(r[5]=h=>x.website=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com"},null,512),[[J,x.website]])]),e("div",null,[r[15]||(r[15]=e("label",{class:"text-xs text-white/30 block mb-1"},"NIP-05 Address",-1)),W(e("input",{"onUpdate:modelValue":r[6]||(r[6]=h=>x.nip05=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"you@example.com"},null,512),[[J,x.nip05]])]),e("div",null,[r[16]||(r[16]=e("label",{class:"text-xs text-white/30 block mb-1"},"Lightning Address",-1)),W(e("input",{"onUpdate:modelValue":r[7]||(r[7]=h=>x.lud16=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"you@getalby.com"},null,512),[[J,x.lud16]])]),e("button",{class:"w-full min-h-[44px] rounded-lg text-sm font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:m.value,onClick:d},u(m.value?"Publishing...":"Publish Profile (kind:0)"),9,qa),$.value?(s(),n("div",{key:0,class:i(["text-xs text-center",_.value?"text-emerald-400/60":"text-red-400/60"])},u($.value),3)):f("",!0)])])):(s(),n("div",Pa,[...r[8]||(r[8]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to edit your profile",-1)])]))]))}}),Oa={class:"relative glass-card w-[320px] max-w-[90vw] p-5 space-y-4 animate-scale-in"},Ha={class:"flex items-center justify-between"},Wa={class:"text-xs text-white/40 truncate font-mono"},Ka={class:"flex gap-1.5 flex-wrap"},Ya=["onClick"],Qa=["disabled"],Ja={key:0,class:"space-y-2"},Za={class:"flex justify-center"},Xa={class:"flex gap-1"},ei=["value"],ti=["href"],si={key:1,class:"text-xs text-red-400/60 text-center"},ni=G({__name:"ZapDialog",props:{isOpen:{type:Boolean},targetName:{},lightningAddress:{}},emits:["close"],setup(a,{emit:c}){const l=a,w=c,g=S(null),v=S(null),x=[21,100,500,1e3,5e3,1e4],m=S(21),$=S(""),_=S(""),b=S(!1),d=S(""),o=S(!1),r=S(null);function h(k){return k>=1e3?`${(k/1e3).toFixed(k%1e3===0?0:1)}k`:String(k)}function M(){w("close"),_.value="",d.value="",$.value=""}async function j(){if(!(!l.lightningAddress||!m.value)){b.value=!0,d.value="",_.value="";try{const[k,p]=l.lightningAddress.split("@");if(!k||!p)throw new Error("Invalid Lightning address");const y=await fetch(`https://${p}/.well-known/lnurlp/${k}`);if(!y.ok)throw new Error("Failed to fetch LNURL");const A=await y.json();if(A.status==="ERROR")throw new Error(A.reason||"LNURL error");const V=m.value*1e3;if(V<(A.minSendable??0))throw new Error(`Minimum: ${Math.ceil((A.minSendable??0)/1e3)} sats`);if(V>(A.maxSendable??1/0))throw new Error(`Maximum: ${Math.floor((A.maxSendable??0)/1e3)} sats`);let E=A.callback;const Q=E.includes("?")?"&":"?";E+=`${Q}amount=${V}`,$.value&&(E+=`&comment=${encodeURIComponent($.value)}`);const H=await fetch(E);if(!H.ok)throw new Error("Failed to get invoice");const K=await H.json();if(K.status==="ERROR")throw new Error(K.reason||"Invoice error");_.value=K.pr,await ye(),L(K.pr)}catch(k){d.value=k instanceof Error?k.message:"Zap failed"}finally{b.value=!1}}}function L(k){const p=r.value;if(!p)return;const y=p.getContext("2d");if(!y)return;y.fillStyle="#1a1a1a",y.fillRect(0,0,200,200),y.fillStyle="#F7931A",y.font="10px monospace",y.textAlign="center";const A=[];for(let E=0;E{y.fillText(E,100,V+Q*12)})}function D(){navigator.clipboard.writeText(_.value),o.value=!0,setTimeout(()=>{o.value=!1},2e3)}function C(k){const p=g.value;if(!p)return;const y=p.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(y.length===0)return;const A=y[0],V=y[y.length-1];k.shiftKey&&document.activeElement===A?(k.preventDefault(),V.focus()):!k.shiftKey&&document.activeElement===V&&(k.preventDefault(),A.focus())}return ce(()=>l.isOpen,async k=>{k?(await ye(),v.value?.focus()):(_.value="",d.value="")}),(k,p)=>a.isOpen?(s(),n("div",{key:0,ref_key:"dialogRef",ref:g,role:"dialog","aria-modal":"true","aria-label":"Send zap",class:"fixed inset-0 z-50 flex items-center justify-center",onClick:xe(M,["self"]),onKeydown:[ae(M,["escape"]),ae(C,["tab"])]},[e("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:M}),e("div",Oa,[e("div",Ha,[p[3]||(p[3]=e("h3",{class:"text-sm font-bold text-white/90"},"Zap",-1)),e("button",{ref_key:"closeButtonRef",ref:v,class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded text-white/40 hover:text-white/70 transition-colors","aria-label":"Close",onClick:M},[...p[2]||(p[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],512)]),e("p",Wa,u(a.targetName),1),e("div",Ka,[(s(),n(I,null,P(x,y=>e("button",{key:y,class:i(["text-xs px-2.5 py-1.5 rounded-lg transition-colors",m.value===y?"bg-accent/20 text-accent border border-accent/30":"bg-white/5 text-white/50 hover:bg-white/10"]),onClick:A=>m.value=y},u(h(y)),11,Ya)),64))]),e("div",null,[p[4]||(p[4]=e("label",{class:"text-xs text-white/30 block mb-1"},"Amount (sats)",-1)),W(e("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>m.value=y),type:"number",min:"1",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors tabular-nums",placeholder:"21"},null,512),[[J,m.value,void 0,{number:!0}]])]),e("div",null,[p[5]||(p[5]=e("label",{class:"text-xs text-white/30 block mb-1"},"Message (optional)",-1)),W(e("input",{"onUpdate:modelValue":p[1]||(p[1]=y=>$.value=y),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"Great post!"},null,512),[[J,$.value]])]),e("button",{class:"w-full py-2.5 rounded-lg text-xs font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!m.value||m.value<1||b.value,onClick:j},u(b.value?"Generating invoice...":`Zap ${h(m.value)} sats`),9,Qa),_.value?(s(),n("div",Ja,[p[6]||(p[6]=e("p",{class:"text-xs text-white/30 text-center"},"Scan or tap to pay",-1)),e("div",Za,[e("canvas",{ref_key:"qrCanvas",ref:r,class:"rounded-lg",width:"200",height:"200"},null,512)]),e("div",Xa,[e("input",{value:_.value,readonly:"",class:"flex-1 px-2 py-1.5 rounded text-base bg-white/5 text-white/40 font-mono truncate outline-none"},null,8,ei),e("button",{class:"px-2 py-1.5 rounded text-xs bg-white/5 text-white/40 hover:text-white/60 transition-colors",onClick:D},u(o.value?"Copied":"Copy"),1)]),e("a",{href:"lightning:"+_.value,class:"block w-full py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," Open in wallet ",8,ti)])):f("",!0),d.value?(s(),n("p",si,u(d.value),1)):f("",!0)])],544)):f("",!0)}}),li={class:"h-full flex flex-col"},oi={class:"flex items-center gap-2 px-4 py-3 border-b border-white/[0.08]"},ai={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},ii={key:0,class:"flex items-center justify-center py-12"},ri={key:1,class:"rounded-xl bg-white/[0.05] border border-white/10 p-3"},ci={class:"flex items-center gap-1.5 mb-1"},di={class:"w-6 h-6 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-purple-500/20 text-purple-400"},ui={class:"text-xs font-semibold text-white/80"},hi={class:"text-xs ml-auto text-white/20"},xi={class:"text-xs text-white/70 leading-relaxed whitespace-pre-wrap"},pi={key:2,class:"space-y-1"},gi={class:"text-xs text-white/30 font-medium mt-3 mb-1"},bi={key:3,class:"flex items-center justify-center py-12"},vi={key:0,class:"px-4 py-3 border-t border-white/[0.08]"},fi={key:0,class:"text-xs text-white/30 mb-1"},mi={class:"flex gap-2"},wi=["disabled"],yi=G({__name:"NostrThread",props:{noteId:{}},emits:["back"],setup(a){const c=Yt(()=>pt(()=>import("./ThreadNode-uZHjueqh.js"),__vite__mapDeps([3,1,2]))),l=a,{fetchNote:w,publishEvent:g}=Ie(),{isLoggedIn:v,signEvent:x,pubkey:m}=me(),$=S(null),_=S([]),b=S(!0),d=S(null),o=S("");function r(k){const p=new Date(k*1e3);return p.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})+" "+p.toLocaleDateString("en",{month:"short",day:"numeric"})}function h(k){return k.length<=12?k:k.slice(0,8)+"..."+k.slice(-4)}async function M(){b.value=!0;const k=await w(l.noteId);if(!k){b.value=!1;return}$.value=k;const p=await j(l.noteId);_.value=L(p,l.noteId),b.value=!1}async function j(k){return new Promise(p=>{const y=[],A="thread-"+Math.random().toString(36).slice(2,8);let V=!1;const E=setTimeout(()=>{V||(V=!0,p(y))},8e3),Q="wss://relay.nostr.band";try{const H=new WebSocket(Q);H.onopen=()=>{H.send(JSON.stringify(["REQ",A,{kinds:[1],"#e":[k],limit:100}]))},H.onmessage=K=>{try{const F=JSON.parse(K.data);if(Array.isArray(F)&&F[0]==="EVENT"&&F[1]===A&&F[2]){const O=F[2];y.find(X=>X.id===O.id)||y.push({id:O.id,pubkey:O.pubkey,authorName:h(O.pubkey),kind:O.kind,content:O.content,created_at:O.created_at,tags:O.tags??[]})}Array.isArray(F)&&F[0]==="EOSE"&&F[1]===A&&(clearTimeout(E),H.close(),V||(V=!0,p(y)))}catch{}},H.onerror=()=>{clearTimeout(E),V||(V=!0,p(y))},H.onclose=()=>{V||(V=!0,p(y))}}catch{clearTimeout(E),p(y)}})}function L(k,p,y=5){const A=new Map;for(const E of k){let Q=p;const H=E.tags.filter(F=>F[0]==="e");if(H.length>0){const F=H.find(O=>O[3]==="reply");Q=F?F[1]:H[H.length-1][1]}const K=A.get(Q)??[];K.push(E),A.set(Q,K)}function V(E,Q){const H=A.get(E)??[];return H.sort((K,F)=>K.created_at-F.created_at),H.map(K=>({note:K,children:Q{M()}),(k,p)=>(s(),n("div",li,[e("div",oi,[e("button",{class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded-lg text-white/60 hover:text-white/80 hover:bg-white/10 transition-colors",onClick:p[0]||(p[0]=y=>k.$emit("back"))},[...p[3]||(p[3]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),p[4]||(p[4]=e("h3",{class:"text-sm font-bold text-white/90"},"Thread",-1))]),e("div",ai,[b.value?(s(),n("div",ii,[...p[5]||(p[5]=[e("p",{class:"text-xs text-white/30"},"Loading thread...",-1)])])):f("",!0),$.value?(s(),n("div",ri,[e("div",ci,[e("div",di,u($.value.authorName?.charAt(0)?.toUpperCase()??"?"),1),e("span",ui,u($.value.authorName??"anon"),1),e("span",hi,u(r($.value.created_at)),1)]),e("p",xi,u($.value.content),1)])):f("",!0),_.value.length>0?(s(),n("div",pi,[e("p",gi,u(_.value.length)+" replies",1),(s(!0),n(I,null,P(_.value,y=>(s(),U(t(c),{key:y.note.id,node:y,depth:0,onReply:D},null,8,["node"]))),128))])):f("",!0),!b.value&&!$.value?(s(),n("div",bi,[...p[6]||(p[6]=[e("p",{class:"text-xs text-white/30"},"Thread not found",-1)])])):f("",!0)]),$.value&&t(v)?(s(),n("div",vi,[d.value?(s(),n("p",fi,[ne(" Replying to "+u(d.value.authorName??"anon")+" ",1),e("button",{class:"text-accent/60 ml-1",onClick:p[1]||(p[1]=y=>d.value=null)},"cancel")])):f("",!0),e("div",mi,[W(e("input",{"onUpdate:modelValue":p[2]||(p[2]=y=>o.value=y),type:"text",placeholder:"Reply...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",onKeydown:ae(C,["enter"])},null,544),[[J,o.value]]),e("button",{class:"px-3 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!o.value.trim(),onClick:C}," Reply ",8,wi)])])):f("",!0)]))}}),ki={class:"h-full flex flex-col"},$i={class:"p-4 border-b border-white/[0.08]"},_i={class:"flex gap-1.5 flex-wrap"},Ci=["onClick"],ji={key:0,class:"flex-1 flex items-center justify-center"},Si={key:1,class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},Mi={key:0,class:"flex items-center justify-center py-12"},Ti={class:"flex gap-2 mb-3"},Di=["placeholder"],Ii=["disabled"],Bi={class:"w-6 h-6 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-purple-500/20 text-purple-400"},Li={class:"flex-1 min-w-0"},Pi={class:"text-xs text-white/60 font-mono truncate"},Ni={key:0,class:"text-xs text-white/30"},Ai=["onClick"],zi={key:1,class:"flex items-center justify-center py-12"},Ei=["disabled"],Fi=G({__name:"NostrLists",setup(a){const{isLoggedIn:c,signEvent:l,pubkey:w}=me(),{publishEvent:g}=Ie(),v=[{kind:3,label:"Follows"},{kind:1e4,label:"Mute"},{kind:10001,label:"Pin"},{kind:10003,label:"Bookmarks"}],x=S(3),m=S([]),$=S(!1),_=S(!1),b=S(""),d=S(!1),o=S(""),r=S(!1);function h(k){return k.length<=16?k:k.slice(0,8)+"..."+k.slice(-8)}function M(k){return k.filter(p=>p[0]==="p"||p[0]==="e"||p[0]==="t").map(p=>{let y=h(p[1]);if(p[0]==="p")try{y=He(p[1])}catch{}return{tag:p[0],value:p[1],displayValue:y,relay:p[2]||void 0,petname:p[3]||void 0}})}async function j(k){if(w.value){$.value=!0,_.value=!1,m.value=[];try{const p=new WebSocket("wss://relay.nostr.band"),y="list-"+Math.random().toString(36).slice(2,8),A=setTimeout(()=>{p.close(),$.value=!1},8e3);p.onopen=()=>{p.send(JSON.stringify(["REQ",y,{kinds:[k],authors:[w.value],limit:1}]))},p.onmessage=V=>{try{const E=JSON.parse(V.data);if(Array.isArray(E)&&E[0]==="EVENT"&&E[1]===y&&E[2]){const Q=E[2];m.value=M(Q.tags)}Array.isArray(E)&&E[0]==="EOSE"&&(clearTimeout(A),p.close(),$.value=!1)}catch{}},p.onerror=()=>{clearTimeout(A),$.value=!1}}catch{$.value=!1}}}function L(){let k=b.value.trim();if(!k)return;let p=k;const y=x.value===3||x.value===1e4?"p":"e";if(k.startsWith("npub"))try{p=gt(k)}catch{return}if(m.value.find(V=>V.value===p))return;let A=h(p);if(y==="p")try{A=He(p)}catch{}m.value.push({tag:y,value:p,displayValue:A}),_.value=!0,b.value=""}function D(k){m.value=m.value.filter(p=>p.value!==k.value),_.value=!0}async function C(){if(!w.value)return;d.value=!0,o.value="";const k=m.value.map(E=>{const Q=[E.tag,E.value];return E.relay&&Q.push(E.relay),E.petname&&Q.push(E.petname),Q}),p={kind:x.value,created_at:Math.floor(Date.now()/1e3),tags:k,content:""},y=await l(p);if(!y){d.value=!1,o.value="Signing failed",r.value=!1;return}const A=await g(y),V=A.filter(E=>E.success).length;d.value=!1,_.value=!1,V>0?(o.value=`Published to ${V}/${A.length} relays`,r.value=!0):(o.value="Failed to publish",r.value=!1)}return le(()=>{j(x.value)}),(k,p)=>(s(),n("div",ki,[e("div",$i,[p[1]||(p[1]=e("h3",{class:"text-sm font-bold text-white/90 mb-3"},"Nostr Lists",-1)),e("div",_i,[(s(),n(I,null,P(v,y=>e("button",{key:y.kind,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",x.value===y.kind?"nav-tab-active":"text-white/40 hover:text-white/70 hover:bg-white/5"]),onClick:A=>{x.value=y.kind,j(y.kind)}},u(y.label),11,Ci)),64))])]),t(c)?(s(),n("div",Si,[$.value?(s(),n("div",Mi,[...p[3]||(p[3]=[e("p",{class:"text-xs text-white/30"},"Loading list...",-1)])])):f("",!0),e("div",Ti,[W(e("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>b.value=y),type:"text",placeholder:x.value===3?"Add npub or hex pubkey...":"Add item (hex id or npub)...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",onKeydown:ae(L,["enter"])},null,40,Di),[[J,b.value]]),e("button",{class:"px-2.5 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!b.value.trim(),onClick:L}," Add ",8,Ii)]),(s(!0),n(I,null,P(m.value,y=>(s(),n("div",{key:y.value,class:"flex items-center gap-2 p-2.5 rounded-xl bg-white/[0.03] border border-white/5"},[e("div",Bi,u(y.tag==="p"?"P":y.tag==="e"?"E":y.tag==="t"?"#":"?"),1),e("div",Li,[e("p",Pi,u(y.displayValue),1),y.petname?(s(),n("p",Ni,u(y.petname),1)):f("",!0)]),e("button",{class:"text-xs px-2 py-1 rounded bg-white/5 text-red-400/50 hover:text-red-400/80 hover:bg-red-400/10 transition-colors shrink-0",onClick:A=>D(y)}," Remove ",8,Ai)]))),128)),!$.value&&m.value.length===0?(s(),n("div",zi,[...p[4]||(p[4]=[e("p",{class:"text-xs text-white/30"},"List is empty",-1)])])):f("",!0),_.value?(s(),n("button",{key:2,class:"w-full py-2.5 rounded-lg text-xs font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30 mt-4",disabled:d.value,onClick:C},u(d.value?"Publishing...":"Publish updated list"),9,Ei)):f("",!0),o.value?(s(),n("p",{key:3,class:i(["text-xs text-center",r.value?"text-emerald-400/60":"text-red-400/60"])},u(o.value),3)):f("",!0)])):(s(),n("div",ji,[...p[2]||(p[2]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to manage lists",-1)])]))]))}}),Ri={class:"article-reader h-full flex"},Vi={key:0,class:"hidden lg:flex flex-col w-56 shrink-0 border-r border-white/5 overflow-y-auto scrollbar-hide py-4 px-3"},Ui=["onClick"],qi={class:"sticky top-0 z-10 flex items-center gap-2 px-4 py-2 bg-black/60 backdrop-blur-md border-b border-white/5"},Gi={class:"flex-1 text-xs text-white/40 truncate"},Oi=["disabled"],Hi=["disabled"],Wi={key:0,class:"lg:hidden bg-black/40 backdrop-blur-md border-b border-white/5 px-4 py-2 space-y-0.5 animate-fade-up-fast"},Ki=["onClick"],Yi={key:0,class:"text-xl font-bold text-white/96 mb-4"},Qi=["innerHTML"],Ji=G({__name:"ArticleReader",props:{content:{},title:{}},emits:["back"],setup(a){const c=a,l=[13,15,17,19,21],w=localStorage.getItem("aiui-article-font-size"),g=S(w?parseInt(w,10):1);ce(g,D=>{localStorage.setItem("aiui-article-font-size",String(D))});const v=S(!1),x=new as({html:!1,linkify:!0,breaks:!0});x.renderer.rules.heading_open=(D,C,k,p,y)=>{const A=D[C],V=parseInt(A.tag.slice(1),10);if(V===2||V===3){const H=(D[C+1]?.children?.reduce((K,F)=>K+(F.content||""),"")||"").toLowerCase().replace(/[^\w]+/g,"-").replace(/(^-|-$)/g,"");A.attrSet("id",H)}return y.renderToken(D,C,k)};const m=x.renderer.rules.link_open||function(D,C,k,p,y){return y.renderToken(D,C,k)};x.renderer.rules.link_open=function(D,C,k,p,y){return D[C].attrSet("target","_blank"),D[C].attrSet("rel","noopener noreferrer"),m(D,C,k,p,y)};const $=B(()=>x.render(c.content)),_=B(()=>{const D=[],C=/^(#{2,3})\s+(.+)$/gm;let k;for(;(k=C.exec(c.content))!==null;){const p=k[2].trim(),y=p.toLowerCase().replace(/[^\w]+/g,"-").replace(/(^-|-$)/g,"");D.push({text:p,id:y,level:k[1].length})}return D}),b=B(()=>{const D=c.content.split(/\s+/).length;return Math.max(1,Math.ceil(D/200))}),d=S(null),o=S(null),r=S(0);let h=null;function M(){if(!d.value)return;h?.disconnect(),h=new IntersectionObserver(C=>{for(const k of C)if(k.isIntersecting){const p=k.target.id,y=_.value.findIndex(A=>A.id===p);y>=0&&(r.value=y)}},{root:d.value,rootMargin:"-20% 0px -60% 0px",threshold:0}),o.value?.querySelectorAll("h2[id], h3[id]")?.forEach(C=>h.observe(C))}le(()=>{setTimeout(M,100)}),ce(()=>c.content,()=>{setTimeout(M,100)}),Qt(()=>{h?.disconnect()});function j(D){o.value?.querySelector(`#${CSS.escape(D)}`)?.scrollIntoView({behavior:"smooth",block:"start"})}function L(){const D=window.open("","_blank");D&&(D.document.write(` +}`,usedIn:"Modal entries, tooltip appearances, popovers"}],_=B(()=>x.value==="all"?$:$.filter(o=>o.category===x.value));function b(o){l(o)}function d(o){const r=/(?:background-color|color|background):\s*([^;]+)/i.exec(o);if(!r)return"#333";const h=r[1].trim();return h.startsWith("#")||h.startsWith("rgb")||h.startsWith("hsl")?h:"#333"}return(o,r)=>(s(),n("div",Co,[e("div",{class:"shrink-0 px-4 py-3 flex items-center justify-between gap-2",style:q(t(c)?"border-bottom: 1px solid rgba(255, 255, 255, 0.08)":"border-bottom: 1px solid rgba(0, 0, 0, 0.06)")},[e("span",{class:i(["text-sm font-semibold",t(c)?"text-white/90":"text-gray-900"])}," Design System ",2),e("p",{class:i(["text-xs",t(c)?"text-white/30":"text-gray-400"])},u(_.value.length)+" items ",3)],4),e("div",jo,[(s(),n(I,null,P(m,h=>e("button",{key:h.id,class:i(["text-xs px-2.5 py-1 rounded-md font-medium whitespace-nowrap transition-colors",x.value===h.id?"bg-accent/20 text-accent":t(c)?"bg-white/5 text-white/50 hover:bg-white/10":"bg-black/5 text-gray-500 hover:bg-black/10"]),onClick:M=>x.value=h.id},u(h.label),11,So)),64))]),e("div",Mo,[e("div",To,[(s(!0),n(I,null,P(_.value,h=>(s(),n("button",{key:h.id,class:i(["text-left p-3 rounded-xl transition-all duration-150 group relative",[t(w)&&t(v)(h.id)?"ring-2 ring-accent/50 bg-accent/10 cursor-pointer":t(c)?"bg-white/[0.03] hover:bg-white/[0.07] cursor-pointer":"bg-black/[0.02] hover:bg-black/[0.05] cursor-pointer"]]),onClick:M=>b(h)},[t(w)?(s(),n("div",{key:0,class:i(["absolute top-2 right-2 min-w-[44px] min-h-[44px] rounded-full flex items-center justify-center z-10 cursor-pointer transition-colors",t(v)(h.id)?"bg-accent":t(c)?"bg-white/10 hover:bg-white/20":"bg-black/10 hover:bg-black/20"]),onClick:xe(M=>t(g)(h.id),["stop"])},[t(v)(h.id)?(s(),n("svg",Bo,[...r[0]||(r[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"3",d:"M5 13l4 4L19 7"},null,-1)])])):f("",!0)],10,Io)):f("",!0),h.category==="colors"&&h.preview==="inline"?(s(),n("div",{key:1,class:i(["h-8 rounded-md mb-2 border",t(c)?"border-white/10":"border-black/10"]),style:q({background:d(h.code)})},null,6)):h.category==="spacing"&&h.preview==="inline"?(s(),n("div",Lo,[...r[1]||(r[1]=[e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"30%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"50%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"70%"}},null,-1),e("div",{class:"bg-accent/40 rounded-sm",style:{width:"4px",height:"100%"}},null,-1)])])):(s(),n("div",Po,[(s(),n("svg",{class:i(["w-5 h-5 transition-colors",t(c)?"text-white/20 group-hover:text-white/40":"text-black/15 group-hover:text-black/30"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[h.category==="atoms"?(s(),n("path",No)):h.category==="molecules"?(s(),n("path",Ao)):h.category==="organisms"?(s(),n("path",zo)):(s(),n("path",Eo))],2))])),e("h3",{class:i(["text-xs font-semibold leading-tight mb-0.5",t(c)?"text-white/80":"text-gray-800"])},u(h.name),3),e("p",{class:i(["text-xs leading-snug line-clamp-2",t(c)?"text-white/40":"text-gray-400"])},u(h.description),3)],10,Do))),128))])])]))}}),we=S(null),lt=S(!1),Re=S(!1),he=S(null);function me(){const a=B(()=>{if(!we.value)return null;try{return He(we.value)}catch{return null}}),c=B(()=>!!we.value),l=B(()=>a.value?a.value.slice(0,12)+"..."+a.value.slice(-8):null);function w(){lt.value=typeof window<"u"&&!!window.nostr}async function g(){if(he.value=null,!window.nostr){he.value="No Nostr extension detected. Install nos2x, Alby, or another NIP-07 extension.";return}Re.value=!0;try{const m=await window.nostr.getPublicKey();we.value=m}catch(m){he.value=m instanceof Error?m.message:"Failed to get public key"}finally{Re.value=!1}}async function v(m){if(he.value=null,!window.nostr)return he.value="No Nostr extension detected",null;try{return await window.nostr.signEvent(m)}catch($){return he.value=$ instanceof Error?$.message:"Failed to sign event",null}}function x(){we.value=null,he.value=null}return le(()=>{w(),setTimeout(w,500)}),{pubkey:we,npub:a,isAvailable:lt,isLoggedIn:c,isLoading:Re,error:he,truncatedNpub:l,login:g,logout:x,signEvent:v,checkAvailability:w}}const Ro="aiui-nostr-dms",Vo=1,ke="messages",je=S([]),Se=S(null),Ve=S(!1);let Me=null;function vt(){return Me||(Me=new Promise((a,c)=>{const l=indexedDB.open(Ro,Vo);l.onupgradeneeded=()=>{const w=l.result;if(!w.objectStoreNames.contains(ke)){const g=w.createObjectStore(ke,{keyPath:"id"});g.createIndex("contact","contactPubkey",{unique:!1}),g.createIndex("created_at","created_at",{unique:!1})}},l.onsuccess=()=>a(l.result),l.onerror=()=>{Me=null,c(l.error)}}),Me)}function Uo(a){return a.length<=12?a:a.slice(0,8)+"..."+a.slice(-4)}async function ot(a,c){const l=await vt(),w=a.fromPubkey===c?a.toPubkey:a.fromPubkey,g={...a,contactPubkey:w};return new Promise((v,x)=>{const m=l.transaction(ke,"readwrite");m.objectStore(ke).put(g),m.oncomplete=()=>v(),m.onerror=()=>x(m.error)})}async function Ue(){const a=await vt();return new Promise((c,l)=>{const g=a.transaction(ke,"readonly").objectStore(ke).getAll();g.onsuccess=()=>c(g.result),g.onerror=()=>l(g.error)})}function qe(a){const c=new Map;for(const w of a){const g=c.get(w.contactPubkey)??[];g.push(w),c.set(w.contactPubkey,g)}const l=[];for(const[w,g]of c)g.sort((v,x)=>v.created_at-x.created_at),l.push({contactPubkey:w,contactName:Uo(w),messages:g,lastMessage:g[g.length-1]??null,unread:0});return l.sort((w,g)=>(g.lastMessage?.created_at??0)-(w.lastMessage?.created_at??0)),l}function qo(){const{pubkey:a,isLoggedIn:c}=me(),l=B(()=>Se.value?je.value.find($=>$.contactPubkey===Se.value)??null:null);async function w(){if(c.value){Ve.value=!0;try{const $=await Ue();je.value=qe($)}catch{}finally{Ve.value=!1}}}async function g($,_){if(!window.nostr?.nip04||!a.value)return!1;try{const b=await window.nostr.nip04.encrypt($,_),d={kind:4,created_at:Math.floor(Date.now()/1e3),tags:[["p",$]],content:b},o=await window.nostr.signEvent(d);if(!o)return!1;const r={id:o.id,fromPubkey:a.value,toPubkey:$,content:_,created_at:o.created_at,decrypted:!0};await ot(r,a.value);const{publishEvent:h}=await pt(()=>import("./useNostr-BqBiQvAw.js"),__vite__mapDeps([0,1,2])).then(j=>j.useNostr());await h(o);const M=await Ue();return je.value=qe(M),!0}catch{return!1}}async function v($,_,b,d){if(!(!window.nostr?.nip04||!a.value))try{const o=await window.nostr.nip04.decrypt(_,b),r={id:$,fromPubkey:_,toPubkey:a.value,content:o,created_at:d,decrypted:!0};await ot(r,a.value);const h=await Ue();je.value=qe(h)}catch{}}function x($){Se.value=$}function m(){Se.value=null}return{threads:je,activeThread:l,activeContact:Se,isLoading:Ve,loadDMs:w,sendDM:g,receiveDM:v,selectContact:x,clearActiveContact:m}}const Go={class:"h-full flex flex-col"},Oo={class:"flex items-center gap-2 px-4 py-3 border-b border-white/[0.08]"},Ho={class:"flex-1 min-w-0"},Wo={class:"text-xs font-semibold text-white/80 truncate"},Ko={class:"text-xs text-white/30 font-mono truncate"},Yo={class:"text-xs leading-relaxed break-words"},Qo={class:"text-xs mt-1 text-white/25 tabular-nums"},Jo={class:"px-4 py-3 border-t border-white/[0.08]"},Zo={class:"flex gap-2"},Xo=["disabled"],ea={class:"p-4 border-b border-white/[0.08]"},ta={class:"flex items-center justify-between gap-2 mb-3"},sa={key:0,class:"space-y-2 mb-3"},na=["disabled"],la={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-1"},oa={key:0,class:"flex items-center justify-center py-12"},aa={key:1,class:"flex items-center justify-center py-12"},ia={key:2,class:"flex items-center justify-center py-12"},ra=["onClick"],ca={class:"flex items-start gap-2.5"},da={class:"w-8 h-8 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-accent/20 text-accent"},ua={class:"flex-1 min-w-0"},ha={class:"flex items-center gap-1.5"},xa={class:"text-xs font-semibold truncate text-white/80"},pa={key:0,class:"text-xs ml-auto shrink-0 text-white/20"},ga={key:0,class:"text-xs mt-1 text-white/40 truncate"},ba=G({__name:"NostrDMs",setup(a){const{threads:c,activeThread:l,activeContact:w,isLoading:g,loadDMs:v,sendDM:x,selectContact:m,clearActiveContact:$}=qo(),{pubkey:_,isLoggedIn:b}=me(),d=S(""),o=S(!1),r=S(null),h=S(!1),M=S("");function j(k){const p=new Date(k*1e3),A=Math.floor((new Date().getTime()-p.getTime())/864e5);return A===0?p.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"}):A<7?p.toLocaleDateString("en",{weekday:"short"}):p.toLocaleDateString("en",{month:"short",day:"numeric"})}async function L(){if(!d.value.trim()||o.value||!w.value)return;o.value=!0,await x(w.value,d.value.trim())&&(d.value="",await ye(),D()),o.value=!1}function D(){r.value&&(r.value.scrollTop=r.value.scrollHeight)}function C(){let k=M.value.trim();if(k.startsWith("npub"))try{k=gt(k)}catch{return}k.length===64&&(m(k),h.value=!1,M.value="")}return ce(w,async()=>{await ye(),D()}),le(()=>{v()}),(k,p)=>(s(),n("div",Go,[t(l)?(s(),n(I,{key:0},[e("div",Oo,[e("button",{class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded-lg text-white/60 hover:text-white/80 hover:bg-white/10 transition-colors",onClick:p[0]||(p[0]=(...y)=>t($)&&t($)(...y))},[...p[4]||(p[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),e("div",Ho,[e("p",Wo,u(t(l).contactName),1),e("p",Ko,u(t(l).contactPubkey),1)])]),e("div",{ref_key:"messagesRef",ref:r,class:"flex-1 overflow-y-auto custom-scrollbar px-4 py-3 space-y-2"},[(s(!0),n(I,null,P(t(l).messages,y=>(s(),n("div",{key:y.id,class:i(["flex",y.fromPubkey===t(_)?"justify-end":"justify-start"])},[e("div",{class:i(["max-w-[80%] rounded-xl px-3 py-2",y.fromPubkey===t(_)?"bg-accent/15 text-white/80":"bg-white/5 text-white/70"])},[e("p",Yo,u(y.content),1),e("p",Qo,u(j(y.created_at)),1)],2)],2))),128))],512),e("div",Jo,[e("div",Zo,[W(e("input",{"onUpdate:modelValue":p[1]||(p[1]=y=>d.value=y),type:"text",placeholder:"Type a message...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",onKeydown:ae(L,["enter"])},null,544),[[J,d.value]]),e("button",{class:"px-3 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!d.value.trim()||o.value,onClick:L}," Send ",8,Xo)])])],64)):(s(),n(I,{key:1},[e("div",ea,[e("div",ta,[p[5]||(p[5]=e("h3",{class:"text-sm font-bold text-white/90"},"Messages",-1)),e("button",{class:"text-xs px-2.5 py-1 rounded bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors",onClick:p[2]||(p[2]=y=>h.value=!h.value)},u(h.value?"Cancel":"New"),1)]),h.value?(s(),n("div",sa,[W(e("input",{"onUpdate:modelValue":p[3]||(p[3]=y=>M.value=y),type:"text",placeholder:"Recipient hex pubkey or npub...",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono"},null,512),[[J,M.value]]),e("button",{class:"text-xs px-2.5 py-1 rounded bg-white/5 text-white/60 hover:bg-white/10 transition-colors disabled:opacity-30",disabled:!M.value.trim(),onClick:C}," Start conversation ",8,na)])):f("",!0)]),e("div",la,[t(b)?t(g)?(s(),n("div",aa,[...p[7]||(p[7]=[e("p",{class:"text-xs text-white/30"},"Loading messages...",-1)])])):t(c).length===0?(s(),n("div",ia,[...p[8]||(p[8]=[e("p",{class:"text-xs text-white/30"},"No messages yet",-1)])])):f("",!0):(s(),n("div",oa,[...p[6]||(p[6]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to use DMs",-1)])])),(s(!0),n(I,null,P(t(c),y=>(s(),n("button",{key:y.contactPubkey,class:"w-full text-left p-3 rounded-xl transition-all duration-150 bg-white/[0.03] hover:bg-white/[0.07] border border-white/5",onClick:A=>t(m)(y.contactPubkey)},[e("div",ca,[e("div",da,u(y.contactName.charAt(0).toUpperCase()),1),e("div",ua,[e("div",ha,[e("span",xa,u(y.contactName),1),y.lastMessage?(s(),n("span",pa,u(j(y.lastMessage.created_at)),1)):f("",!0)]),y.lastMessage?(s(),n("p",ga,u(y.lastMessage.content),1)):f("",!0)])])],8,ra))),128))])],64))]))}}),va={class:"h-full flex flex-col"},fa={class:"p-4 border-b border-white/[0.08]"},ma={class:"flex gap-2"},wa=["disabled"],ya={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},ka={class:"flex items-center gap-2"},$a={class:"text-xs font-mono text-white/70 truncate flex-1"},_a={class:"flex items-center gap-2 flex-wrap"},Ca=["onClick"],ja=["onClick"],Sa=["disabled","onClick"],Ma=["onClick"],Ta={key:0,class:"mt-4 pt-4 border-t border-white/5"},Da=["disabled"],Ia={key:0,class:"text-xs mt-1 text-white/30"},Ba=G({__name:"NostrRelayManager",setup(a){const{relayStates:c,addRelay:l,removeRelay:w,toggleRelayRead:g,toggleRelayWrite:v,testRelay:x,importNIP65Relays:m,fetchNote:$}=Ie(),{isLoggedIn:_,pubkey:b}=me(),d=S(""),o=S(null),r=Pe({}),h=S(!1),M=S("");function j(){let C=d.value.trim();C&&(!C.startsWith("wss://")&&!C.startsWith("ws://")&&(C="wss://"+C),l(C),d.value="")}async function L(C){o.value=C;const k=await x(C);r[C]=k,o.value=null}async function D(){if(!b.value)return;h.value=!0,M.value="Fetching relay list...";const C=await $(b.value,5e3);C?(m({id:C.id,pubkey:C.pubkey,kind:10002,content:C.content,created_at:C.created_at,tags:C.tags,sig:""}),M.value="Imported relays from NIP-65"):M.value="No NIP-65 relay list found",h.value=!1}return(C,k)=>(s(),n("div",va,[e("div",fa,[k[1]||(k[1]=e("h3",{class:"text-sm font-bold text-white/90 mb-3"},"Relay Management",-1)),e("div",ma,[W(e("input",{"onUpdate:modelValue":k[0]||(k[0]=p=>d.value=p),type:"text",placeholder:"wss://relay.example.com",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",onKeydown:ae(j,["enter"])},null,544),[[J,d.value]]),e("button",{class:"px-4 min-h-[44px] rounded-lg text-sm bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!d.value.trim(),onClick:j}," Add ",8,wa)])]),e("div",ya,[(s(!0),n(I,null,P(t(c),p=>(s(),n("div",{key:p.url,class:"rounded-xl bg-white/[0.03] border border-white/5 p-3 space-y-2"},[e("div",ka,[e("span",{class:i(["w-2 h-2 rounded-full shrink-0",p.connected?"bg-emerald-500":"bg-red-400/60"])},null,2),e("span",$a,u(p.url),1),p.latencyMs!==null?(s(),n("span",{key:0,class:i(["text-xs tabular-nums shrink-0",p.latencyMs<200?"text-emerald-400/60":p.latencyMs<500?"text-yellow-400/60":"text-red-400/60"])},u(p.latencyMs)+"ms ",3)):f("",!0),e("span",{class:i(["text-xs shrink-0",p.connected?"text-emerald-400/60":"text-red-400/60"])},u(p.connected?"Connected":"Disconnected"),3)]),e("div",_a,[e("button",{class:i(["text-sm px-3 min-h-[44px] rounded-lg transition-colors",p.read?"bg-accent/15 text-accent/80":"bg-white/5 text-white/30 hover:text-white/50"]),onClick:y=>t(g)(p.url)}," Read ",10,Ca),e("button",{class:i(["text-sm px-3 min-h-[44px] rounded-lg transition-colors",p.write?"bg-accent/15 text-accent/80":"bg-white/5 text-white/30 hover:text-white/50"]),onClick:y=>t(v)(p.url)}," Write ",10,ja),k[2]||(k[2]=e("div",{class:"flex-1"},null,-1)),e("button",{class:"text-sm px-3 min-h-[44px] rounded-lg bg-white/5 text-white/30 hover:text-white/50 transition-colors",disabled:o.value===p.url,onClick:y=>L(p.url)},u(o.value===p.url?"Testing...":"Test"),9,Sa),e("button",{class:"text-sm px-3 min-h-[44px] rounded-lg bg-white/5 text-red-400/50 hover:text-red-400/80 hover:bg-red-400/10 transition-colors",onClick:y=>t(w)(p.url)}," Remove ",8,Ma)]),r[p.url]!==void 0?(s(),n("p",{key:0,class:i(["text-xs",r[p.url]!==null?"text-emerald-400/60":"text-red-400/60"])},u(r[p.url]!==null?`Reachable (${r[p.url]}ms)`:"Unreachable"),3)):f("",!0)]))),128)),t(_)?(s(),n("div",Ta,[e("button",{class:"w-full text-left px-3 min-h-[44px] rounded-lg text-sm bg-white/5 text-white/40 hover:text-white/60 hover:bg-white/10 transition-colors",disabled:h.value,onClick:D},u(h.value?"Importing...":"Import relays from NIP-65 (kind:10002)"),9,Da),M.value?(s(),n("p",Ia,u(M.value),1)):f("",!0)])):f("",!0)])]))}}),La={class:"h-full flex flex-col"},Pa={key:0,class:"flex-1 flex items-center justify-center"},Na={key:1,class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-4"},Aa={class:"rounded-xl overflow-hidden border border-white/5"},za={class:"px-4 pb-4 -mt-8"},Ea={key:0,class:"text-lg font-bold text-accent"},Fa={class:"text-sm font-bold text-white/90 mt-2"},Ra={key:0,class:"text-xs text-purple-400/60"},Va={key:1,class:"text-xs text-white/50 mt-1 line-clamp-2"},Ua={class:"space-y-3"},qa=["disabled"],Ga=G({__name:"NostrProfileEditor",setup(a){const{isLoggedIn:c,signEvent:l,pubkey:w}=me(),{publishEvent:g,fetchNote:v}=Ie(),x=Pe({name:"",display_name:"",about:"",picture:"",banner:"",website:"",nip05:"",lud16:""}),m=S(!1),$=S(""),_=S(!1);async function b(){if(!w.value)return;const o=await v(w.value,5e3);if(o&&o.kind===0)try{const r=JSON.parse(o.content);Object.assign(x,r)}catch{}}async function d(){if(!c.value)return;m.value=!0,$.value="";const o={};for(const[L,D]of Object.entries(x))D&&(o[L]=D);const r={kind:0,created_at:Math.floor(Date.now()/1e3),tags:[],content:JSON.stringify(o)},h=await l(r);if(!h){m.value=!1,$.value="Signing failed",_.value=!1;return}const M=await g(h),j=M.filter(L=>L.success).length;m.value=!1,j>0?($.value=`Published to ${j}/${M.length} relays`,_.value=!0):($.value="Failed to publish to any relay",_.value=!1)}return le(()=>{b()}),(o,r)=>(s(),n("div",La,[r[17]||(r[17]=e("div",{class:"p-4 border-b border-white/[0.08]"},[e("h3",{class:"text-sm font-bold text-white/90"},"Nostr Profile")],-1)),t(c)?(s(),n("div",Na,[e("div",Aa,[e("div",{class:i(["h-24 bg-cover bg-center",x.banner?"":"bg-gradient-to-r from-accent/20 to-purple-500/20"]),style:q(x.banner?{backgroundImage:`url(${x.banner})`}:{})},null,6),e("div",za,[e("div",{class:i(["w-16 h-16 rounded-full border-2 border-black bg-cover bg-center flex items-center justify-center",x.picture?"":"bg-accent/20"]),style:q(x.picture?{backgroundImage:`url(${x.picture})`}:{})},[x.picture?f("",!0):(s(),n("span",Ea,u((x.display_name||x.name||"?").charAt(0).toUpperCase()),1))],6),e("p",Fa,u(x.display_name||x.name||"Anonymous"),1),x.nip05?(s(),n("p",Ra,u(x.nip05),1)):f("",!0),x.about?(s(),n("p",Va,u(x.about),1)):f("",!0)])]),e("div",Ua,[e("div",null,[r[9]||(r[9]=e("label",{class:"text-xs text-white/30 block mb-1"},"Display Name",-1)),W(e("input",{"onUpdate:modelValue":r[0]||(r[0]=h=>x.display_name=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"Your display name"},null,512),[[J,x.display_name]])]),e("div",null,[r[10]||(r[10]=e("label",{class:"text-xs text-white/30 block mb-1"},"Username",-1)),W(e("input",{"onUpdate:modelValue":r[1]||(r[1]=h=>x.name=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"username"},null,512),[[J,x.name]])]),e("div",null,[r[11]||(r[11]=e("label",{class:"text-xs text-white/30 block mb-1"},"Bio",-1)),W(e("textarea",{"onUpdate:modelValue":r[2]||(r[2]=h=>x.about=h),class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors resize-none min-h-[60px]",placeholder:"Tell the world about yourself"},null,512),[[J,x.about]])]),e("div",null,[r[12]||(r[12]=e("label",{class:"text-xs text-white/30 block mb-1"},"Avatar URL",-1)),W(e("input",{"onUpdate:modelValue":r[3]||(r[3]=h=>x.picture=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com/avatar.jpg"},null,512),[[J,x.picture]])]),e("div",null,[r[13]||(r[13]=e("label",{class:"text-xs text-white/30 block mb-1"},"Banner URL",-1)),W(e("input",{"onUpdate:modelValue":r[4]||(r[4]=h=>x.banner=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com/banner.jpg"},null,512),[[J,x.banner]])]),e("div",null,[r[14]||(r[14]=e("label",{class:"text-xs text-white/30 block mb-1"},"Website",-1)),W(e("input",{"onUpdate:modelValue":r[5]||(r[5]=h=>x.website=h),type:"url",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"https://example.com"},null,512),[[J,x.website]])]),e("div",null,[r[15]||(r[15]=e("label",{class:"text-xs text-white/30 block mb-1"},"NIP-05 Address",-1)),W(e("input",{"onUpdate:modelValue":r[6]||(r[6]=h=>x.nip05=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"you@example.com"},null,512),[[J,x.nip05]])]),e("div",null,[r[16]||(r[16]=e("label",{class:"text-xs text-white/30 block mb-1"},"Lightning Address",-1)),W(e("input",{"onUpdate:modelValue":r[7]||(r[7]=h=>x.lud16=h),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",placeholder:"you@getalby.com"},null,512),[[J,x.lud16]])]),e("button",{class:"w-full min-h-[44px] rounded-lg text-sm font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:m.value,onClick:d},u(m.value?"Publishing...":"Publish Profile (kind:0)"),9,qa),$.value?(s(),n("div",{key:0,class:i(["text-xs text-center",_.value?"text-emerald-400/60":"text-red-400/60"])},u($.value),3)):f("",!0)])])):(s(),n("div",Pa,[...r[8]||(r[8]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to edit your profile",-1)])]))]))}}),Oa={class:"relative glass-card w-[320px] max-w-[90vw] p-5 space-y-4 animate-scale-in"},Ha={class:"flex items-center justify-between"},Wa={class:"text-xs text-white/40 truncate font-mono"},Ka={class:"flex gap-1.5 flex-wrap"},Ya=["onClick"],Qa=["disabled"],Ja={key:0,class:"space-y-2"},Za={class:"flex justify-center"},Xa={class:"flex gap-1"},ei=["value"],ti=["href"],si={key:1,class:"text-xs text-red-400/60 text-center"},ni=G({__name:"ZapDialog",props:{isOpen:{type:Boolean},targetName:{},lightningAddress:{}},emits:["close"],setup(a,{emit:c}){const l=a,w=c,g=S(null),v=S(null),x=[21,100,500,1e3,5e3,1e4],m=S(21),$=S(""),_=S(""),b=S(!1),d=S(""),o=S(!1),r=S(null);function h(k){return k>=1e3?`${(k/1e3).toFixed(k%1e3===0?0:1)}k`:String(k)}function M(){w("close"),_.value="",d.value="",$.value=""}async function j(){if(!(!l.lightningAddress||!m.value)){b.value=!0,d.value="",_.value="";try{const[k,p]=l.lightningAddress.split("@");if(!k||!p)throw new Error("Invalid Lightning address");const y=await fetch(`https://${p}/.well-known/lnurlp/${k}`);if(!y.ok)throw new Error("Failed to fetch LNURL");const A=await y.json();if(A.status==="ERROR")throw new Error(A.reason||"LNURL error");const V=m.value*1e3;if(V<(A.minSendable??0))throw new Error(`Minimum: ${Math.ceil((A.minSendable??0)/1e3)} sats`);if(V>(A.maxSendable??1/0))throw new Error(`Maximum: ${Math.floor((A.maxSendable??0)/1e3)} sats`);let E=A.callback;const Q=E.includes("?")?"&":"?";E+=`${Q}amount=${V}`,$.value&&(E+=`&comment=${encodeURIComponent($.value)}`);const H=await fetch(E);if(!H.ok)throw new Error("Failed to get invoice");const K=await H.json();if(K.status==="ERROR")throw new Error(K.reason||"Invoice error");_.value=K.pr,await ye(),L(K.pr)}catch(k){d.value=k instanceof Error?k.message:"Zap failed"}finally{b.value=!1}}}function L(k){const p=r.value;if(!p)return;const y=p.getContext("2d");if(!y)return;y.fillStyle="#1a1a1a",y.fillRect(0,0,200,200),y.fillStyle="#F7931A",y.font="10px monospace",y.textAlign="center";const A=[];for(let E=0;E{y.fillText(E,100,V+Q*12)})}function D(){navigator.clipboard.writeText(_.value),o.value=!0,setTimeout(()=>{o.value=!1},2e3)}function C(k){const p=g.value;if(!p)return;const y=p.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(y.length===0)return;const A=y[0],V=y[y.length-1];k.shiftKey&&document.activeElement===A?(k.preventDefault(),V.focus()):!k.shiftKey&&document.activeElement===V&&(k.preventDefault(),A.focus())}return ce(()=>l.isOpen,async k=>{k?(await ye(),v.value?.focus()):(_.value="",d.value="")}),(k,p)=>a.isOpen?(s(),n("div",{key:0,ref_key:"dialogRef",ref:g,role:"dialog","aria-modal":"true","aria-label":"Send zap",class:"fixed inset-0 z-50 flex items-center justify-center",onClick:xe(M,["self"]),onKeydown:[ae(M,["escape"]),ae(C,["tab"])]},[e("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:M}),e("div",Oa,[e("div",Ha,[p[3]||(p[3]=e("h3",{class:"text-sm font-bold text-white/90"},"Zap",-1)),e("button",{ref_key:"closeButtonRef",ref:v,class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded text-white/40 hover:text-white/70 transition-colors","aria-label":"Close",onClick:M},[...p[2]||(p[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],512)]),e("p",Wa,u(a.targetName),1),e("div",Ka,[(s(),n(I,null,P(x,y=>e("button",{key:y,class:i(["text-xs px-2.5 py-1.5 rounded-lg transition-colors",m.value===y?"bg-accent/20 text-accent border border-accent/30":"bg-white/5 text-white/50 hover:bg-white/10"]),onClick:A=>m.value=y},u(h(y)),11,Ya)),64))]),e("div",null,[p[4]||(p[4]=e("label",{class:"text-xs text-white/30 block mb-1"},"Amount (sats)",-1)),W(e("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>m.value=y),type:"number",min:"1",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors tabular-nums",placeholder:"21"},null,512),[[J,m.value,void 0,{number:!0}]])]),e("div",null,[p[5]||(p[5]=e("label",{class:"text-xs text-white/30 block mb-1"},"Message (optional)",-1)),W(e("input",{"onUpdate:modelValue":p[1]||(p[1]=y=>$.value=y),type:"text",class:"w-full px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",placeholder:"Great post!"},null,512),[[J,$.value]])]),e("button",{class:"w-full py-2.5 rounded-lg text-xs font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!m.value||m.value<1||b.value,onClick:j},u(b.value?"Generating invoice...":`Zap ${h(m.value)} sats`),9,Qa),_.value?(s(),n("div",Ja,[p[6]||(p[6]=e("p",{class:"text-xs text-white/30 text-center"},"Scan or tap to pay",-1)),e("div",Za,[e("canvas",{ref_key:"qrCanvas",ref:r,class:"rounded-lg",width:"200",height:"200"},null,512)]),e("div",Xa,[e("input",{value:_.value,readonly:"",class:"flex-1 px-2 py-1.5 rounded text-base bg-white/5 text-white/40 font-mono truncate outline-none"},null,8,ei),e("button",{class:"px-2 py-1.5 rounded text-xs bg-white/5 text-white/40 hover:text-white/60 transition-colors",onClick:D},u(o.value?"Copied":"Copy"),1)]),e("a",{href:"lightning:"+_.value,class:"block w-full py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," Open in wallet ",8,ti)])):f("",!0),d.value?(s(),n("p",si,u(d.value),1)):f("",!0)])],544)):f("",!0)}}),li={class:"h-full flex flex-col"},oi={class:"flex items-center gap-2 px-4 py-3 border-b border-white/[0.08]"},ai={class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},ii={key:0,class:"flex items-center justify-center py-12"},ri={key:1,class:"rounded-xl bg-white/[0.05] border border-white/10 p-3"},ci={class:"flex items-center gap-1.5 mb-1"},di={class:"w-6 h-6 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-purple-500/20 text-purple-400"},ui={class:"text-xs font-semibold text-white/80"},hi={class:"text-xs ml-auto text-white/20"},xi={class:"text-xs text-white/70 leading-relaxed whitespace-pre-wrap"},pi={key:2,class:"space-y-1"},gi={class:"text-xs text-white/30 font-medium mt-3 mb-1"},bi={key:3,class:"flex items-center justify-center py-12"},vi={key:0,class:"px-4 py-3 border-t border-white/[0.08]"},fi={key:0,class:"text-xs text-white/30 mb-1"},mi={class:"flex gap-2"},wi=["disabled"],yi=G({__name:"NostrThread",props:{noteId:{}},emits:["back"],setup(a){const c=Yt(()=>pt(()=>import("./ThreadNode-DaJ9aByD.js"),__vite__mapDeps([3,1,2]))),l=a,{fetchNote:w,publishEvent:g}=Ie(),{isLoggedIn:v,signEvent:x,pubkey:m}=me(),$=S(null),_=S([]),b=S(!0),d=S(null),o=S("");function r(k){const p=new Date(k*1e3);return p.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit"})+" "+p.toLocaleDateString("en",{month:"short",day:"numeric"})}function h(k){return k.length<=12?k:k.slice(0,8)+"..."+k.slice(-4)}async function M(){b.value=!0;const k=await w(l.noteId);if(!k){b.value=!1;return}$.value=k;const p=await j(l.noteId);_.value=L(p,l.noteId),b.value=!1}async function j(k){return new Promise(p=>{const y=[],A="thread-"+Math.random().toString(36).slice(2,8);let V=!1;const E=setTimeout(()=>{V||(V=!0,p(y))},8e3),Q="wss://relay.nostr.band";try{const H=new WebSocket(Q);H.onopen=()=>{H.send(JSON.stringify(["REQ",A,{kinds:[1],"#e":[k],limit:100}]))},H.onmessage=K=>{try{const F=JSON.parse(K.data);if(Array.isArray(F)&&F[0]==="EVENT"&&F[1]===A&&F[2]){const O=F[2];y.find(X=>X.id===O.id)||y.push({id:O.id,pubkey:O.pubkey,authorName:h(O.pubkey),kind:O.kind,content:O.content,created_at:O.created_at,tags:O.tags??[]})}Array.isArray(F)&&F[0]==="EOSE"&&F[1]===A&&(clearTimeout(E),H.close(),V||(V=!0,p(y)))}catch{}},H.onerror=()=>{clearTimeout(E),V||(V=!0,p(y))},H.onclose=()=>{V||(V=!0,p(y))}}catch{clearTimeout(E),p(y)}})}function L(k,p,y=5){const A=new Map;for(const E of k){let Q=p;const H=E.tags.filter(F=>F[0]==="e");if(H.length>0){const F=H.find(O=>O[3]==="reply");Q=F?F[1]:H[H.length-1][1]}const K=A.get(Q)??[];K.push(E),A.set(Q,K)}function V(E,Q){const H=A.get(E)??[];return H.sort((K,F)=>K.created_at-F.created_at),H.map(K=>({note:K,children:Q{M()}),(k,p)=>(s(),n("div",li,[e("div",oi,[e("button",{class:"min-w-[44px] min-h-[44px] flex items-center justify-center rounded-lg text-white/60 hover:text-white/80 hover:bg-white/10 transition-colors",onClick:p[0]||(p[0]=y=>k.$emit("back"))},[...p[3]||(p[3]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),p[4]||(p[4]=e("h3",{class:"text-sm font-bold text-white/90"},"Thread",-1))]),e("div",ai,[b.value?(s(),n("div",ii,[...p[5]||(p[5]=[e("p",{class:"text-xs text-white/30"},"Loading thread...",-1)])])):f("",!0),$.value?(s(),n("div",ri,[e("div",ci,[e("div",di,u($.value.authorName?.charAt(0)?.toUpperCase()??"?"),1),e("span",ui,u($.value.authorName??"anon"),1),e("span",hi,u(r($.value.created_at)),1)]),e("p",xi,u($.value.content),1)])):f("",!0),_.value.length>0?(s(),n("div",pi,[e("p",gi,u(_.value.length)+" replies",1),(s(!0),n(I,null,P(_.value,y=>(s(),U(t(c),{key:y.note.id,node:y,depth:0,onReply:D},null,8,["node"]))),128))])):f("",!0),!b.value&&!$.value?(s(),n("div",bi,[...p[6]||(p[6]=[e("p",{class:"text-xs text-white/30"},"Thread not found",-1)])])):f("",!0)]),$.value&&t(v)?(s(),n("div",vi,[d.value?(s(),n("p",fi,[ne(" Replying to "+u(d.value.authorName??"anon")+" ",1),e("button",{class:"text-accent/60 ml-1",onClick:p[1]||(p[1]=y=>d.value=null)},"cancel")])):f("",!0),e("div",mi,[W(e("input",{"onUpdate:modelValue":p[2]||(p[2]=y=>o.value=y),type:"text",placeholder:"Reply...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors",onKeydown:ae(C,["enter"])},null,544),[[J,o.value]]),e("button",{class:"px-3 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!o.value.trim(),onClick:C}," Reply ",8,wi)])])):f("",!0)]))}}),ki={class:"h-full flex flex-col"},$i={class:"p-4 border-b border-white/[0.08]"},_i={class:"flex gap-1.5 flex-wrap"},Ci=["onClick"],ji={key:0,class:"flex-1 flex items-center justify-center"},Si={key:1,class:"flex-1 overflow-y-auto custom-scrollbar px-4 pt-3 pb-16 space-y-2"},Mi={key:0,class:"flex items-center justify-center py-12"},Ti={class:"flex gap-2 mb-3"},Di=["placeholder"],Ii=["disabled"],Bi={class:"w-6 h-6 rounded-full shrink-0 flex items-center justify-center text-xs font-bold bg-purple-500/20 text-purple-400"},Li={class:"flex-1 min-w-0"},Pi={class:"text-xs text-white/60 font-mono truncate"},Ni={key:0,class:"text-xs text-white/30"},Ai=["onClick"],zi={key:1,class:"flex items-center justify-center py-12"},Ei=["disabled"],Fi=G({__name:"NostrLists",setup(a){const{isLoggedIn:c,signEvent:l,pubkey:w}=me(),{publishEvent:g}=Ie(),v=[{kind:3,label:"Follows"},{kind:1e4,label:"Mute"},{kind:10001,label:"Pin"},{kind:10003,label:"Bookmarks"}],x=S(3),m=S([]),$=S(!1),_=S(!1),b=S(""),d=S(!1),o=S(""),r=S(!1);function h(k){return k.length<=16?k:k.slice(0,8)+"..."+k.slice(-8)}function M(k){return k.filter(p=>p[0]==="p"||p[0]==="e"||p[0]==="t").map(p=>{let y=h(p[1]);if(p[0]==="p")try{y=He(p[1])}catch{}return{tag:p[0],value:p[1],displayValue:y,relay:p[2]||void 0,petname:p[3]||void 0}})}async function j(k){if(w.value){$.value=!0,_.value=!1,m.value=[];try{const p=new WebSocket("wss://relay.nostr.band"),y="list-"+Math.random().toString(36).slice(2,8),A=setTimeout(()=>{p.close(),$.value=!1},8e3);p.onopen=()=>{p.send(JSON.stringify(["REQ",y,{kinds:[k],authors:[w.value],limit:1}]))},p.onmessage=V=>{try{const E=JSON.parse(V.data);if(Array.isArray(E)&&E[0]==="EVENT"&&E[1]===y&&E[2]){const Q=E[2];m.value=M(Q.tags)}Array.isArray(E)&&E[0]==="EOSE"&&(clearTimeout(A),p.close(),$.value=!1)}catch{}},p.onerror=()=>{clearTimeout(A),$.value=!1}}catch{$.value=!1}}}function L(){let k=b.value.trim();if(!k)return;let p=k;const y=x.value===3||x.value===1e4?"p":"e";if(k.startsWith("npub"))try{p=gt(k)}catch{return}if(m.value.find(V=>V.value===p))return;let A=h(p);if(y==="p")try{A=He(p)}catch{}m.value.push({tag:y,value:p,displayValue:A}),_.value=!0,b.value=""}function D(k){m.value=m.value.filter(p=>p.value!==k.value),_.value=!0}async function C(){if(!w.value)return;d.value=!0,o.value="";const k=m.value.map(E=>{const Q=[E.tag,E.value];return E.relay&&Q.push(E.relay),E.petname&&Q.push(E.petname),Q}),p={kind:x.value,created_at:Math.floor(Date.now()/1e3),tags:k,content:""},y=await l(p);if(!y){d.value=!1,o.value="Signing failed",r.value=!1;return}const A=await g(y),V=A.filter(E=>E.success).length;d.value=!1,_.value=!1,V>0?(o.value=`Published to ${V}/${A.length} relays`,r.value=!0):(o.value="Failed to publish",r.value=!1)}return le(()=>{j(x.value)}),(k,p)=>(s(),n("div",ki,[e("div",$i,[p[1]||(p[1]=e("h3",{class:"text-sm font-bold text-white/90 mb-3"},"Nostr Lists",-1)),e("div",_i,[(s(),n(I,null,P(v,y=>e("button",{key:y.kind,class:i(["text-xs px-2 py-1 rounded-md transition-all duration-150",x.value===y.kind?"nav-tab-active":"text-white/40 hover:text-white/70 hover:bg-white/5"]),onClick:A=>{x.value=y.kind,j(y.kind)}},u(y.label),11,Ci)),64))])]),t(c)?(s(),n("div",Si,[$.value?(s(),n("div",Mi,[...p[3]||(p[3]=[e("p",{class:"text-xs text-white/30"},"Loading list...",-1)])])):f("",!0),e("div",Ti,[W(e("input",{"onUpdate:modelValue":p[0]||(p[0]=y=>b.value=y),type:"text",placeholder:x.value===3?"Add npub or hex pubkey...":"Add item (hex id or npub)...",class:"flex-1 px-3 py-2 rounded-lg text-base bg-white/5 text-white/80 placeholder:text-white/25 outline-none focus:bg-white/10 transition-colors font-mono",onKeydown:ae(L,["enter"])},null,40,Di),[[J,b.value]]),e("button",{class:"px-2.5 py-2 rounded-lg text-xs bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30",disabled:!b.value.trim(),onClick:L}," Add ",8,Ii)]),(s(!0),n(I,null,P(m.value,y=>(s(),n("div",{key:y.value,class:"flex items-center gap-2 p-2.5 rounded-xl bg-white/[0.03] border border-white/5"},[e("div",Bi,u(y.tag==="p"?"P":y.tag==="e"?"E":y.tag==="t"?"#":"?"),1),e("div",Li,[e("p",Pi,u(y.displayValue),1),y.petname?(s(),n("p",Ni,u(y.petname),1)):f("",!0)]),e("button",{class:"text-xs px-2 py-1 rounded bg-white/5 text-red-400/50 hover:text-red-400/80 hover:bg-red-400/10 transition-colors shrink-0",onClick:A=>D(y)}," Remove ",8,Ai)]))),128)),!$.value&&m.value.length===0?(s(),n("div",zi,[...p[4]||(p[4]=[e("p",{class:"text-xs text-white/30"},"List is empty",-1)])])):f("",!0),_.value?(s(),n("button",{key:2,class:"w-full py-2.5 rounded-lg text-xs font-medium bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors disabled:opacity-30 mt-4",disabled:d.value,onClick:C},u(d.value?"Publishing...":"Publish updated list"),9,Ei)):f("",!0),o.value?(s(),n("p",{key:3,class:i(["text-xs text-center",r.value?"text-emerald-400/60":"text-red-400/60"])},u(o.value),3)):f("",!0)])):(s(),n("div",ji,[...p[2]||(p[2]=[e("p",{class:"text-xs text-white/30"},"Sign in with Nostr to manage lists",-1)])]))]))}}),Ri={class:"article-reader h-full flex"},Vi={key:0,class:"hidden lg:flex flex-col w-56 shrink-0 border-r border-white/5 overflow-y-auto scrollbar-hide py-4 px-3"},Ui=["onClick"],qi={class:"sticky top-0 z-10 flex items-center gap-2 px-4 py-2 bg-black/60 backdrop-blur-md border-b border-white/5"},Gi={class:"flex-1 text-xs text-white/40 truncate"},Oi=["disabled"],Hi=["disabled"],Wi={key:0,class:"lg:hidden bg-black/40 backdrop-blur-md border-b border-white/5 px-4 py-2 space-y-0.5 animate-fade-up-fast"},Ki=["onClick"],Yi={key:0,class:"text-xl font-bold text-white/96 mb-4"},Qi=["innerHTML"],Ji=G({__name:"ArticleReader",props:{content:{},title:{}},emits:["back"],setup(a){const c=a,l=[13,15,17,19,21],w=localStorage.getItem("aiui-article-font-size"),g=S(w?parseInt(w,10):1);ce(g,D=>{localStorage.setItem("aiui-article-font-size",String(D))});const v=S(!1),x=new as({html:!1,linkify:!0,breaks:!0});x.renderer.rules.heading_open=(D,C,k,p,y)=>{const A=D[C],V=parseInt(A.tag.slice(1),10);if(V===2||V===3){const H=(D[C+1]?.children?.reduce((K,F)=>K+(F.content||""),"")||"").toLowerCase().replace(/[^\w]+/g,"-").replace(/(^-|-$)/g,"");A.attrSet("id",H)}return y.renderToken(D,C,k)};const m=x.renderer.rules.link_open||function(D,C,k,p,y){return y.renderToken(D,C,k)};x.renderer.rules.link_open=function(D,C,k,p,y){return D[C].attrSet("target","_blank"),D[C].attrSet("rel","noopener noreferrer"),m(D,C,k,p,y)};const $=B(()=>x.render(c.content)),_=B(()=>{const D=[],C=/^(#{2,3})\s+(.+)$/gm;let k;for(;(k=C.exec(c.content))!==null;){const p=k[2].trim(),y=p.toLowerCase().replace(/[^\w]+/g,"-").replace(/(^-|-$)/g,"");D.push({text:p,id:y,level:k[1].length})}return D}),b=B(()=>{const D=c.content.split(/\s+/).length;return Math.max(1,Math.ceil(D/200))}),d=S(null),o=S(null),r=S(0);let h=null;function M(){if(!d.value)return;h?.disconnect(),h=new IntersectionObserver(C=>{for(const k of C)if(k.isIntersecting){const p=k.target.id,y=_.value.findIndex(A=>A.id===p);y>=0&&(r.value=y)}},{root:d.value,rootMargin:"-20% 0px -60% 0px",threshold:0}),o.value?.querySelectorAll("h2[id], h3[id]")?.forEach(C=>h.observe(C))}le(()=>{setTimeout(M,100)}),ce(()=>c.content,()=>{setTimeout(M,100)}),Qt(()=>{h?.disconnect()});function j(D){o.value?.querySelector(`#${CSS.escape(D)}`)?.scrollIntoView({behavior:"smooth",block:"start"})}function L(){const D=window.open("","_blank");D&&(D.document.write(` ${c.title||"Article"} "+x+""+h+"":f==="javascript"||f==="js"?""+x+""+b+h+g+"":f==="css"?"
CSS Preview
':""}function a(){n.value=[],s.value=!1,requestAnimationFrame(()=>{s.value=!0})}function l(){n.value=[]}function d(f){f.data?.type==="code-runner-console"&&n.value.push({type:f.data.level==="error"?"error":"log",text:f.data.text})}return Pe(()=>{window.addEventListener("message",d)}),bo(()=>{window.removeEventListener("message",d)}),(f,h)=>(p(),m("div",qp,[c("div",Hp,[c("span",Wp,_(e.language),1),h[0]||(h[0]=c("div",{class:"flex-1"},null,-1)),c("button",{class:"text-xs px-2.5 py-1 rounded bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors",onClick:a}," Run "),n.value.length>0?(p(),m("button",{key:0,class:"text-xs px-2 py-1 rounded bg-white/5 text-white/40 hover:text-white/60 hover:bg-white/10 transition-colors",onClick:l}," Clear ")):D("",!0)]),c("pre",Vp,[c("code",null,_(e.code),1)]),s.value?(p(),m("iframe",{key:0,ref_key:"iframeRef",ref:o,srcdoc:r.value,sandbox:"allow-scripts",class:F(["w-full border-t border-white/5",u.value?"h-48":"h-0 invisible"]),title:"Code output"},null,10,Gp)):D("",!0),n.value.length>0?(p(),m("div",Kp,[h[1]||(h[1]=c("p",{class:"text-xs text-white/20 uppercase tracking-wider mb-1"},"Console",-1)),(p(!0),m(q,null,J(n.value,(b,g)=>(p(),m("div",{key:g,class:F(["text-xs font-mono leading-relaxed",b.type==="error"?"text-red-400/80":"text-white/60"])},_(b.text),3))),128))])):D("",!0)]))}}),Jp={class:"rounded-xl bg-white/5 border border-white/10 p-3 space-y-2"},Yp={class:"flex items-center gap-2"},Xp={class:"text-xs px-1.5 py-0.5 rounded bg-white/5 text-white/30"},Qp={class:"text-xs font-mono text-white/70 break-all leading-relaxed select-all"},e1={class:"flex justify-center py-2"},t1={class:"flex gap-2"},n1=["href"],s1=te({__name:"BitcoinAddressCard",props:{address:{}},setup(e){const t=e,n=k(null),s=k(!1),o=A(()=>{const a=t.address;return a.startsWith("bc1q")?"SegWit (bech32)":a.startsWith("bc1p")?"Taproot (bech32m)":a.startsWith("1")?"Legacy (P2PKH)":a.startsWith("3")?"Nested SegWit (P2SH)":a.startsWith("tb1")||a.startsWith("2")||a.startsWith("m")||a.startsWith("n")?"Testnet":"Unknown"}),u=A(()=>`https://mempool.space/address/${t.address}`);function r(){navigator.clipboard.writeText(t.address),s.value=!0,setTimeout(()=>{s.value=!1},2e3)}function i(){const a=n.value;if(!a)return;const l=a.getContext("2d");if(!l)return;l.fillStyle="#1a1a1a",l.fillRect(0,0,160,160),l.fillStyle="#F7931A",l.font="8px monospace",l.textAlign="center";const d=`bitcoin:${t.address}`,f=[];for(let b=0;b{l.fillText(b,80,h+g*10)})}return Pe(()=>{i()}),(a,l)=>(p(),m("div",Jp,[c("div",Yp,[l[0]||(l[0]=c("span",{class:"text-xs text-accent/60 uppercase tracking-wider font-bold"},"Bitcoin Address",-1)),c("span",Xp,_(o.value),1)]),c("p",Qp,_(e.address),1),c("div",e1,[c("canvas",{ref_key:"qrCanvas",ref:n,class:"rounded-lg",width:"160",height:"160"},null,512)]),c("div",t1,[c("button",{class:"flex-1 py-2 rounded-lg text-xs bg-white/5 text-white/50 hover:text-white/70 hover:bg-white/10 transition-colors",onClick:r},_(s.value?"Copied!":"Copy Address"),1),c("a",{href:u.value,target:"_blank",rel:"noopener noreferrer",class:"flex-1 py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," View on Mempool ",8,n1)])]))}}),o1={class:"rounded-xl bg-white/5 border border-white/10 p-3 space-y-2"},u1={class:"flex items-center gap-2"},r1={key:0,class:"text-xs px-1.5 py-0.5 rounded bg-red-400/15 text-red-400/80"},i1={key:0,class:"flex items-center gap-2"},a1={class:"text-lg font-bold text-accent tabular-nums"},l1={key:1,class:"text-xs text-white/50"},c1={key:2,class:"flex items-center gap-1.5"},d1={class:"text-xs font-mono text-white/30 break-all line-clamp-2 select-all"},f1={class:"flex gap-2"},p1=["href"],h1=te({__name:"Bolt11InvoiceCard",props:{invoice:{}},setup(e){const t=e,n=k(!1),s=k(Math.floor(Date.now()/1e3));let o=null;const u=A(()=>{const g=t.invoice.toLowerCase().match(/^lnbc(\d+)([munp]?)1/);if(!g)return null;const x=parseInt(g[1]);switch(g[2]){case"m":return x*1e5;case"u":return x*100;case"n":return Math.round(x*.1);case"p":return Math.round(x*1e-4);default:return x*1e8}}),r=A(()=>null),i=A(()=>null),a=A(()=>i.value?s.value>i.value:!1),l=A(()=>i.value?i.value-s.value<300:!1),d=A(()=>{if(!i.value)return null;const b=i.value-s.value;if(b<=0)return"Expired";const g=Math.floor(b/60);return g<60?`Expires in ${g}m`:`Expires in ${Math.floor(g/60)}h ${g%60}m`});function f(b){return b.toLocaleString()}function h(){navigator.clipboard.writeText(t.invoice),n.value=!0,setTimeout(()=>{n.value=!1},2e3)}return Pe(()=>{o=setInterval(()=>{s.value=Math.floor(Date.now()/1e3)},1e3)}),bo(()=>{o&&clearInterval(o)}),(b,g)=>(p(),m("div",o1,[c("div",u1,[g[0]||(g[0]=c("span",{class:"text-xs text-accent/60 uppercase tracking-wider font-bold"},"Lightning Invoice",-1)),a.value?(p(),m("span",r1," Expired ")):D("",!0)]),u.value?(p(),m("div",i1,[c("span",a1,_(f(u.value)),1),g[1]||(g[1]=c("span",{class:"text-xs text-white/30"},"sats",-1))])):D("",!0),r.value?(p(),m("p",l1,_(r.value),1)):D("",!0),d.value?(p(),m("div",c1,[c("span",{class:F(["text-xs tabular-nums",a.value||l.value?"text-red-400/60":"text-white/30"])},_(d.value),3)])):D("",!0),c("p",d1,_(e.invoice),1),c("div",f1,[c("button",{class:"flex-1 py-2 rounded-lg text-xs bg-white/5 text-white/50 hover:text-white/70 hover:bg-white/10 transition-colors",onClick:h},_(n.value?"Copied!":"Copy"),1),c("a",{href:"lightning:"+e.invoice,class:"flex-1 py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," Pay with wallet ",8,p1)])]))}}),m1={class:"rounded-xl bg-white/5 border border-white/10 p-3 space-y-2"},g1={class:"text-xs font-mono text-white/50 break-all line-clamp-2 select-all"},b1={class:"flex justify-center py-2"},x1={class:"flex gap-2"},v1=["href"],y1=te({__name:"Bolt12OfferCard",props:{offer:{}},setup(e){const t=e,n=k(null),s=k(!1);function o(){navigator.clipboard.writeText(t.offer),s.value=!0,setTimeout(()=>{s.value=!1},2e3)}function u(){const r=n.value;if(!r)return;const i=r.getContext("2d");if(!i)return;i.fillStyle="#1a1a1a",i.fillRect(0,0,140,140),i.fillStyle="#F7931A",i.font="7px monospace",i.textAlign="center";const a=[];for(let d=0;d{i.fillText(d,70,l+f*9)})}return Pe(()=>{u()}),(r,i)=>(p(),m("div",m1,[i[0]||(i[0]=c("div",{class:"flex items-center gap-2"},[c("span",{class:"text-xs text-accent/60 uppercase tracking-wider font-bold"},"BOLT12 Offer")],-1)),c("p",g1,_(e.offer),1),c("div",b1,[c("canvas",{ref_key:"qrCanvas",ref:n,class:"rounded-lg",width:"140",height:"140"},null,512)]),c("div",x1,[c("button",{class:"flex-1 py-2 rounded-lg text-xs bg-white/5 text-white/50 hover:text-white/70 hover:bg-white/10 transition-colors",onClick:o},_(s.value?"Copied!":"Copy Offer"),1),c("a",{href:"lightning:"+e.offer,class:"flex-1 py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," Pay with wallet ",8,v1)])]))}}),w1={class:"rounded-xl bg-white/5 border border-white/10 p-3 space-y-2"},k1={class:"flex items-center gap-2"},C1={class:"text-xs font-mono text-white/40 break-all select-all"},_1={key:0,class:"grid grid-cols-2 gap-2 text-xs"},A1={class:"text-white/60 tabular-nums"},D1={class:"text-white/60 tabular-nums"},S1={class:"text-white/60 tabular-nums"},E1={class:"text-white/60 tabular-nums"},$1={key:1,class:"py-2"},F1={key:2,class:"py-2"},M1={class:"text-xs text-red-400/60"},T1=["href"],I1=te({__name:"MempoolTxCard",props:{txid:{}},setup(e){const t=e,n=k(null),s=k(!0),o=k("");async function u(){s.value=!0,o.value="";try{const r=await fetch(`https://mempool.space/api/tx/${t.txid}`);if(!r.ok)throw new Error("Transaction not found");const i=await r.json(),a=!!i.status?.confirmed;let l=0;if(a&&i.status?.block_height){const d=await fetch("https://mempool.space/api/blocks/tip/height");d.ok&&(l=parseInt(await d.text())-i.status.block_height+1)}n.value={fee:i.fee??0,feeRate:i.weight?Math.round(i.fee/i.weight*4):0,size:i.weight?Math.round(i.weight/4):i.size??0,confirmed:a,confirmations:l,blockHeight:i.status?.block_height??null}}catch(r){o.value=r instanceof Error?r.message:"Failed to load transaction"}finally{s.value=!1}}return Pe(()=>{u()}),(r,i)=>(p(),m("div",w1,[c("div",k1,[i[0]||(i[0]=c("span",{class:"text-xs text-accent/60 uppercase tracking-wider font-bold"},"Transaction",-1)),n.value?(p(),m("span",{key:0,class:F(["text-xs px-1.5 py-0.5 rounded",n.value.confirmed?"bg-emerald-400/15 text-emerald-400/80":"bg-yellow-400/15 text-yellow-400/80"])},_(n.value.confirmed?`${n.value.confirmations} confirmations`:"Unconfirmed"),3)):D("",!0)]),c("p",C1,_(e.txid),1),n.value?(p(),m("div",_1,[c("div",null,[i[1]||(i[1]=c("p",{class:"text-white/25"},"Fee",-1)),c("p",A1,_(n.value.fee.toLocaleString())+" sats",1)]),c("div",null,[i[2]||(i[2]=c("p",{class:"text-white/25"},"Fee Rate",-1)),c("p",D1,_(n.value.feeRate)+" sat/vB",1)]),c("div",null,[i[3]||(i[3]=c("p",{class:"text-white/25"},"Size",-1)),c("p",S1,_(n.value.size)+" vB",1)]),c("div",null,[i[4]||(i[4]=c("p",{class:"text-white/25"},"Block",-1)),c("p",E1,_(n.value.blockHeight??"Pending"),1)])])):s.value?(p(),m("div",$1,[...i[5]||(i[5]=[c("p",{class:"text-xs text-white/30"},"Loading transaction...",-1)])])):o.value?(p(),m("div",F1,[c("p",M1,_(o.value),1)])):D("",!0),c("a",{href:`https://mempool.space/tx/${e.txid}`,target:"_blank",rel:"noopener noreferrer",class:"block w-full py-2 rounded-lg text-xs text-center bg-accent/15 text-accent/80 hover:bg-accent/25 transition-colors"}," View on Mempool.space ",8,T1)]))}}),P1=/\b(bc1q[a-z0-9]{38,62})\b/gi,L1=/\b(bc1p[a-z0-9]{38,62})\b/gi,z1=/\b(1[13456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25,34})\b/g,R1=/\b(3[13456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25,34})\b/g,B1=/\b(tb1[a-z0-9]{38,62})\b/gi,j1=/\b(lnbc[a-z0-9]+)\b/gi,N1=/\b(lno1[a-z0-9]+)\b/gi,U1=/\b([a-f0-9]{64})\b/gi;function O1(e){const t=[],n=new Set;for(const s of e.matchAll(P1))n.has(s[1].toLowerCase())||(n.add(s[1].toLowerCase()),t.push({address:s[1],type:"bech32"}));for(const s of e.matchAll(L1))n.has(s[1].toLowerCase())||(n.add(s[1].toLowerCase()),t.push({address:s[1],type:"bech32m"}));for(const s of e.matchAll(z1))n.has(s[1])||(n.add(s[1]),t.push({address:s[1],type:"p2pkh"}));for(const s of e.matchAll(R1))n.has(s[1])||(n.add(s[1]),t.push({address:s[1],type:"p2sh"}));for(const s of e.matchAll(B1))n.has(s[1].toLowerCase())||(n.add(s[1].toLowerCase()),t.push({address:s[1],type:"testnet"}));return t}function q1(e){const t=[],n=new Set;for(const s of e.matchAll(j1)){const o=s[1].toLowerCase();n.has(o)||(n.add(o),t.push({invoice:s[1]}))}return t}function H1(e){const t=[],n=new Set;for(const s of e.matchAll(N1)){const o=s[1].toLowerCase();n.has(o)||(n.add(o),t.push({offer:s[1]}))}return t}function W1(e){const t=[],n=new Set;for(const s of e.matchAll(U1))n.has(s[1])||(n.add(s[1]),t.push({txid:s[1]}));return t}const Yu=/^(\|[^\n]+\|)\n(\|[\s:|-]+\|)\n((?:\|[^\n]+\|\n?)+)/gm;function V1(e){const t=[];let n;const s=new RegExp(Yu.source,Yu.flags);for(;(n=s.exec(e))!==null;){const o=n[1],u=n[3],r=Xu(o),i=u.trim().split(` -`).map(Xu).filter(a=>a.length>0);r.length>0&&i.length>0&&t.push({headers:r,rows:i,raw:n[0]})}return t}function Xu(e){return e.replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}const G1=new Set(["html","javascript","js","css"]),Qu=/```(html|javascript|js|css)\n([\s\S]*?)```/gi;function K1(e){const t=[];let n;const s=new RegExp(Qu.source,Qu.flags);for(;(n=s.exec(e))!==null;){const o=n[1].toLowerCase(),u=n[2].trim();G1.has(o)&&u.length>0&&t.push({language:o,code:u})}return t}const Z1={class:"relative max-w-[85%] md:max-w-[75%]"},J1={class:"flex items-center gap-2 px-1 py-0.5 rounded-lg bg-black/60 backdrop-blur-md border border-white/10 shadow-lg"},Y1={key:3,class:"w-px h-4 bg-white/10 mx-0.5"},X1=["onKeydown"],Q1={key:0,class:"flex gap-2 flex-wrap mb-2"},eh=["src","alt"],th=["innerHTML"],nh={key:2,class:"text-sm leading-relaxed whitespace-pre-wrap break-words text-white/90"},sh={key:21,class:"flex items-center gap-2 mt-1.5"},oh={class:"text-xs select-none text-white/30"},uh={key:0,class:"text-xs text-white/25 select-none"},rh=["title"],ih={key:2,class:"text-xs select-none"},ah=te({__name:"ChatMessage",props:{message:{},index:{},triggeringQuery:{default:""}},emits:["edit","regenerate","branch","reply","feedback"],setup(e,{emit:t}){const n=e,s=t;function o(N){const $=n.message.feedback===N?void 0:N;s("feedback",n.message.id,$)}const u=k(!1),r=k(""),i=k(null);function a(){r.value=n.message.content,u.value=!0,Fe(()=>{i.value?.focus(),i.value&&(i.value.style.height="auto",i.value.style.height=i.value.scrollHeight+"px")})}function l(){u.value=!1,r.value=""}function d(){const N=r.value.trim();N&&(s("edit",n.message.id,N),u.value=!1,r.value="")}const{getContextualInlineContent:f,stripContentTags:h,stripMarkdownLinks:b,updatePanelFromText:g,panelOpen:x,availableTabs:E,setActiveTab:C,openFilmDetail:y,openBookDetail:v,openTVSeriesDetail:w,openPlaceDetail:M,openSongDetail:P,openPodcastDetail:U,openArticleDetail:oe,openWebsiteDetail:j,openLongFormArticle:B,openMapView:X,closeFilmDetail:Q,closeBookDetail:K,closeTVSeriesDetail:I,closePlaceDetail:Y,closeSongDetail:he,closePodcastDetail:be}=is(),Ge=yo(),ee=A(()=>n.message.role==="user"),Ae=A(()=>ee.value?{films:[],books:[],tvSeries:[],images:[],places:[],songs:[],podcasts:[],newsLinks:[],websitesLinks:[],magazineSections:[]}:f(n.message.content,n.triggeringQuery,n.message.webResults??[])),lt=A(()=>ee.value?"path-glass-bubble-user rounded-br-md rounded-2xl":"path-glass-bubble rounded-bl-md rounded-2xl"),O=A(()=>Ae.value.films),W=A(()=>Ae.value.books??[]),ae=A(()=>Ae.value.tvSeries??[]),xe=A(()=>Ae.value.images??[]),T=A(()=>Ae.value.places??[]),Z=A(()=>Ae.value.songs),me=A(()=>Ae.value.podcasts),ye=A(()=>Ae.value.newsLinks??[]),we=A(()=>Ae.value.websitesLinks??[]),Ee=A(()=>Ae.value.magazineSections??[]),Be=/nostr:(note1[a-z0-9]{58}|npub1[a-z0-9]{58}|nevent1[a-z0-9]+|nprofile1[a-z0-9]+)/g,z=A(()=>{if(ee.value)return[];const N=n.message.content.match(Be);return N?[...new Set(N)]:[]}),L=A(()=>ee.value?[]:Rf(n.message.content)),se=A(()=>ee.value?[]:io(n.message.content)),le=A(()=>ee.value?[]:V1(n.message.content)),ne=A(()=>ee.value?[]:Ga(n.message.content)),ve=A(()=>ee.value?[]:K1(n.message.content)),$e=A(()=>ee.value?[]:O1(n.message.content)),$t=A(()=>ee.value?[]:q1(n.message.content)),kt=A(()=>ee.value?[]:H1(n.message.content)),Ct=A(()=>ee.value?[]:W1(n.message.content)),ct=A(()=>!ee.value&&n.triggeringQuery.trim().toLowerCase()==="/code"),_t=A(()=>!ee.value&&(ct.value||O.value.length>0||W.value.length>0||ae.value.length>0||xe.value.length>0||Z.value.length>0||me.value.length>0||ye.value.length>0||we.value.length>0||Ee.value.length>0)),dt=new Re({html:!1,linkify:!0,breaks:!0}),ft=dt.renderer.rules.link_open||function(N,$,R,ue,ot){return ot.renderToken(N,$,R)};dt.renderer.rules.link_open=function(N,$,R,ue,ot){return N[$].attrSet("target","_blank"),N[$].attrSet("rel","noopener noreferrer"),ft(N,$,R,ue,ot)};const Ke=A(()=>{if(ee.value)return n.message.content;let N=h(n.message.content);if((ye.value.length>0||we.value.length>0)&&(N=b(N)),z.value.length>0&&(N=N.replace(Be,"").replace(/\n{3,}/g,` +`+h,g=new Blob([b],{type:"text/csv"}),x=URL.createObjectURL(g),E=document.createElement("a");E.href=x,E.download="table.csv",E.click(),URL.revokeObjectURL(x)}function c(f){return f.includes(",")||f.includes('"')||f.includes(` +`)?`"${f.replace(/"/g,'""')}"`:f}return(f,h)=>(p(),m("div",Cp,[d("div",_p,[De(d("input",{"onUpdate:modelValue":h[0]||(h[0]=b=>n.value=b),type:"text",class:"flex-1 bg-white/5 border border-white/10 rounded px-2 py-1 text-base text-white/80 outline-none focus:border-accent/40 placeholder:text-white/25",placeholder:"Filter rows..."},null,512),[[Me,n.value]]),d("button",{class:"text-xs px-2 py-1 rounded bg-white/5 border border-white/10 text-white/50 hover:text-white/80 hover:bg-white/10 transition-colors",title:"Export CSV",onClick:l}," CSV ")]),d("div",Ap,[d("table",Dp,[d("thead",null,[d("tr",Sp,[(p(!0),m(q,null,Z(e.headers,(b,g)=>(p(),m("th",{key:g,class:"px-3 py-2 text-left text-white/50 font-medium cursor-pointer hover:text-white/70 select-none whitespace-nowrap",onClick:x=>u(g)},[d("span",$p,[ce(_(b)+" ",1),s.value===g?(p(),m("span",Fp,_(o.value==="asc"?"↑":"↓"),1)):D("",!0)])],8,Ep))),128))])]),d("tbody",null,[(p(!0),m(q,null,Z(a.value,(b,g)=>(p(),m("tr",{key:g,class:"border-b border-white/5 hover:bg-white/5 transition-colors"},[(p(!0),m(q,null,Z(b,(x,E)=>(p(),m("td",{key:E,class:"px-3 py-1.5 text-white/70 whitespace-nowrap"},_(x),1))),128))]))),128))])])]),r.value.length===0?(p(),m("div",Mp," No matching rows ")):D("",!0),r.value.length>0?(p(),m("div",Tp,[ce(_(r.value.length)+" row"+_(r.value.length===1?"":"s")+" ",1),n.value?(p(),m("span",Ip," (filtered from "+_(e.rows.length)+")",1)):D("",!0)])):D("",!0)]))}}),Lp={class:"timeline-renderer my-4"},zp={class:"relative"},Bp={class:"text-xs text-white/40 tabular-nums pt-1"},Rp={class:"ml-10 md:ml-0 md:w-[calc(50%-2rem)] shrink-0"},jp={class:"rounded-lg bg-white/5 border border-white/10 px-3 py-2"},Np={class:"text-xs text-white/30 md:hidden tabular-nums"},Up={class:"text-xs font-medium text-white/90"},Op={key:0,class:"text-xs text-white/40 mt-0.5"},qp={key:1,class:"text-xs text-white/50 mt-1 line-clamp-2"},Hp=te({__name:"TimelineRenderer",props:{events:{}},setup(e){function t(n){if(!n)return"";const s=new Date(n);return isNaN(s.getTime())?n:s.toLocaleDateString("en",{year:"numeric",month:"short",day:"numeric"})}return(n,s)=>(p(),m("div",Lp,[d("div",zp,[s[1]||(s[1]=d("div",{class:"absolute left-4 md:left-1/2 top-0 bottom-0 w-px bg-white/10 md:-translate-x-px"},null,-1)),(p(!0),m(q,null,Z(e.events,(o,u)=>(p(),m("div",{key:u,class:F(["relative flex items-start gap-4 mb-6 animate-fade-up-fast",u%2===0?"md:flex-row":"md:flex-row-reverse"]),style:Se({animationDelay:`${u*80}ms`})},[s[0]||(s[0]=d("div",{class:"absolute left-4 md:left-1/2 w-3 h-3 rounded-full bg-accent border-2 border-black z-10 md:-translate-x-1.5",style:{top:"6px"}},null,-1)),d("div",{class:F(["hidden md:block w-[calc(50%-2rem)] text-right shrink-0",u%2===0?"":"order-last text-left"])},[d("p",Bp,_(t(o.date)),1)],2),d("div",Rp,[d("div",jp,[d("p",Np,_(t(o.date)),1),d("h4",Up,_(o.title),1),o.location?(p(),m("p",Op,_(o.location),1)):D("",!0),o.description?(p(),m("p",qp,_(o.description),1)):D("",!0)])])],6))),128))])]))}}),Wp={class:"code-runner rounded-xl bg-white/5 border border-white/10 overflow-hidden"},Vp={class:"flex items-center gap-2 px-3 py-2 border-b border-white/5"},Gp={class:"text-xs text-white/30 uppercase tracking-wider"},Kp={class:"px-3 py-2 text-xs text-white/70 overflow-x-auto max-h-48 bg-black/20"},Jp=["srcdoc"],Zp={key:1,class:"border-t border-white/5 bg-black/30 px-3 py-2 max-h-32 overflow-y-auto"},Yp=te({__name:"CodeRunner",props:{code:{},language:{}},setup(e){const t=e,n=k([]),s=k(!1),o=k(null),u=A(()=>t.language==="html"),r=A(()=>i(t.language,t.code));function i(f,h){const b=" + diff --git a/demo/aiui/sw.js b/demo/aiui/sw.js index 9c376f13..e4525b82 100644 --- a/demo/aiui/sw.js +++ b/demo/aiui/sw.js @@ -1 +1 @@ -if(!self.define){let s,e={};const i=(i,l)=>(i=new URL(i+".js",l).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(l,r)=>{const n=s||("document"in self?document.currentScript.src:"")||location.href;if(e[n])return;let a={};const u=s=>i(s,n),t={module:{uri:n},exports:a,require:u};e[n]=Promise.all(l.map(s=>t[s]||u(s))).then(s=>(r(...s),a))}}define(["./workbox-3c177d20"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"c492f944af160ee2e9a237c509dd270a"},{url:"index.html",revision:"3843167fa4772380fa5a05f6e5fe0a58"},{url:"icon.svg",revision:"dba94027bbb3b869c0ebf9b6beee1953"},{url:"favicon.svg",revision:"72e74ad8f660d9400c34fa69912b94a3"},{url:"images/loading-poster.svg",revision:"97c56238c72450e4953e1d7db2f6e8e6"},{url:"assets/xychartDiagram-PRI3JC2R-D9_pNjKg.js",revision:null},{url:"assets/wikipedia-BNDKhpH7.js",revision:null},{url:"assets/useNostr-DMx0ZF7J.js",revision:null},{url:"assets/useContentImages-8oyMy70s.js",revision:null},{url:"assets/treemap-GDKQZRPO-DuuihRg0.js",revision:null},{url:"assets/timeline-definition-IT6M3QCI-_j2Tetve.js",revision:null},{url:"assets/stateDiagram-v2-4FDKWEC3-BKfrE6D0.js",revision:null},{url:"assets/stateDiagram-FKZM4ZOC-UksGMieI.js",revision:null},{url:"assets/song-renderer-LEAE0oP0.js",revision:null},{url:"assets/sequenceDiagram-WL72ISMW-Cr4_tpXX.js",revision:null},{url:"assets/seedPrompts-CLWaUv28.js",revision:null},{url:"assets/sankeyDiagram-TZEHDZUN-CAwxXQrA.js",revision:null},{url:"assets/requirementDiagram-UZGBJVZJ-Ck037yFx.js",revision:null},{url:"assets/quadrantDiagram-AYHSOK5B-D3sJ_hI5.js",revision:null},{url:"assets/pieDiagram-ADFJNKIX-D-NTrPGW.js",revision:null},{url:"assets/ordinal-Cboi1Yqb.js",revision:null},{url:"assets/openlibrary-B8IPeH2e.js",revision:null},{url:"assets/nodeDemoPrompts-DjnuaxJP.js",revision:null},{url:"assets/mindmap-definition-VGOIOE7T-8KG9_8uc.js",revision:null},{url:"assets/mermaid.core-_VcdMFBU.js",revision:null},{url:"assets/linear-D4bfzEbI.js",revision:null},{url:"assets/layout-DhL2Cqsp.js",revision:null},{url:"assets/katex.min-CASE1JAf.css",revision:null},{url:"assets/katex-DGN8GczM.js",revision:null},{url:"assets/kanban-definition-3W4ZIXB7-B72Y2SDu.js",revision:null},{url:"assets/journeyDiagram-XKPGCS4Q-B9qXxPVY.js",revision:null},{url:"assets/init-Gi6I4Gst.js",revision:null},{url:"assets/infoDiagram-HS3SLOUP-B_dvws7D.js",revision:null},{url:"assets/index-iNX5cLRF.js",revision:null},{url:"assets/index-BNvE9-tw.css",revision:null},{url:"assets/guideConversation-BYC5cBFP.js",revision:null},{url:"assets/graph-BEKdikt2.js",revision:null},{url:"assets/gitGraphDiagram-V2S2FVAM-B_QrAuku.js",revision:null},{url:"assets/ganttDiagram-JELNMOA3-C-oJgEGR.js",revision:null},{url:"assets/freeFilms-B9DmMKj5.js",revision:null},{url:"assets/flowDiagram-NV44I4VS-w-CkuMnx.js",revision:null},{url:"assets/film-renderer-Cq_2td8O.js",revision:null},{url:"assets/erDiagram-Q2GNP2WA-CgrqBy5l.js",revision:null},{url:"assets/diagram-S2PKOQOG-DqPkWzKU.js",revision:null},{url:"assets/diagram-QEK2KX5R-BQBiUUiO.js",revision:null},{url:"assets/diagram-PSM6KHXK-BiMZR0RN.js",revision:null},{url:"assets/defaultLocale-DX6XiGOO.js",revision:null},{url:"assets/dagre-6UL2VRFP-Dxf2RdrI.js",revision:null},{url:"assets/cytoscape.esm-5J0xJHOV.js",revision:null},{url:"assets/cose-bilkent-S5V4N54A-C44QSHWo.js",revision:null},{url:"assets/clone-Bhltwx1j.js",revision:null},{url:"assets/claude-provider-DbzPoW6j.js",revision:null},{url:"assets/classDiagram-v2-WZHVMYZB-D8ELH-6E.js",revision:null},{url:"assets/classDiagram-2ON5EDUG-D8ELH-6E.js",revision:null},{url:"assets/chunk-TZMSLE5B-CmhkYzx2.js",revision:null},{url:"assets/chunk-QZHKN3VN-Bgqnzg5H.js",revision:null},{url:"assets/chunk-QN33PNHL-BqFe712_.js",revision:null},{url:"assets/chunk-FMBD7UC4-lBKdz6Yh.js",revision:null},{url:"assets/chunk-DI55MBZ5-DqVtG1l0.js",revision:null},{url:"assets/chunk-B4BG7PRW-Dd-gdJ2K.js",revision:null},{url:"assets/chunk-55IACEB6-bmTd1fRc.js",revision:null},{url:"assets/chunk-4BX2VUAB-sMg-yi__.js",revision:null},{url:"assets/chat-DURlEZti.js",revision:null},{url:"assets/channel-DrGX6hPm.js",revision:null},{url:"assets/c4Diagram-YG6GDRKO-Cuzep4O2.js",revision:null},{url:"assets/blockDiagram-VD42YOAC-BFM_WKNb.js",revision:null},{url:"assets/architectureDiagram-VXUJARFQ-eRMb8q7Q.js",revision:null},{url:"assets/arc-Dpf0rwWj.js",revision:null},{url:"assets/_baseUniq-QbfmlGUb.js",revision:null},{url:"assets/_basePickBy-CfV4NeNh.js",revision:null},{url:"assets/WidgetDemoPage-D7-OiknV.js",revision:null},{url:"assets/WidgetDemoPage-BSWX2CxO.css",revision:null},{url:"assets/ThreadNode-uZHjueqh.js",revision:null},{url:"assets/SongGrid.vue_vue_type_script_setup_true_lang-Cpvl53RE.js",revision:null},{url:"assets/SongGrid-R6zmbmn9.js",revision:null},{url:"assets/SongDetail.vue_vue_type_script_setup_true_lang-BbGQlf9S.js",revision:null},{url:"assets/SongDetail-BqYwtWIR.js",revision:null},{url:"assets/GuidePage-WpEfI4F6.js",revision:null},{url:"assets/GuidePage-BvYaLEzG.css",revision:null},{url:"assets/FilmGrid.vue_vue_type_script_setup_true_lang-BCGlNgEL.js",revision:null},{url:"assets/FilmGrid-CiiZxqHh.js",revision:null},{url:"assets/FilmDetail.vue_vue_type_script_setup_true_lang-C2prgMoU.js",revision:null},{url:"assets/FilmDetail-BGcj4-yI.js",revision:null},{url:"assets/ConversationViewerPage-CmOz-8ZY.js",revision:null},{url:"assets/ChatWindow.vue_vue_type_script_setup_true_lang-D6Di9NNl.js",revision:null},{url:"assets/ChatWindow-CwFp9jEi.css",revision:null},{url:"assets/ChatPage-DJ91DuFU.js",revision:null},{url:"assets/ChatPage-CA2cZZjS.css",revision:null},{url:"assets/BrowsePage-DSb_6ger.js",revision:null},{url:"assets/icons/microphone.svg",revision:null},{url:"apple-touch-icon-180x180.png",revision:"7c24333289dd2af70268ed3018b06188"},{url:"favicon.svg",revision:"72e74ad8f660d9400c34fa69912b94a3"},{url:"icon.svg",revision:"dba94027bbb3b869c0ebf9b6beee1953"},{url:"pwa-192x192.png",revision:"b808488f273b70ad731254043774b56f"},{url:"pwa-512x512.png",revision:"93c28a922e11a852a2ff9c277dc60037"},{url:"manifest.webmanifest",revision:"28fc12e11969e378feb1aaa569dafb80"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html"))),s.registerRoute(/^https:\/\/api\.anthropic\.com\/.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/^https:\/\/openrouter\.ai\/.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/web-search\?.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/rss-articles\?.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/tmdb\/.*/i,new s.StaleWhileRevalidate({cacheName:"tmdb-cache",plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:86400})]}),"GET"),s.registerRoute(/^https:\/\/image\.tmdb\.org\/.*/i,new s.CacheFirst({cacheName:"tmdb-images",plugins:[new s.ExpirationPlugin({maxEntries:500,maxAgeSeconds:604800})]}),"GET"),s.registerRoute(/^https:\/\/upload\.wikimedia\.org\/.*/i,new s.CacheFirst({cacheName:"wiki-images",plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:604800})]}),"GET"),s.registerRoute(/^https:\/\/d12wklypp119aj\.cloudfront\.net\/image\/.*/i,new s.CacheFirst({cacheName:"wavlake-images",plugins:[new s.ExpirationPlugin({maxEntries:300,maxAgeSeconds:604800})]}),"GET")}); +if(!self.define){let s,e={};const i=(i,l)=>(i=new URL(i+".js",l).href,e[i]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=i,s.onload=e,document.head.appendChild(s)}else s=i,importScripts(i),e()}).then(()=>{let s=e[i];if(!s)throw new Error(`Module ${i} didn’t register its module`);return s}));self.define=(l,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let a={};const u=s=>i(s,r),t={module:{uri:r},exports:a,require:u};e[r]=Promise.all(l.map(s=>t[s]||u(s))).then(s=>(n(...s),a))}}define(["./workbox-3c177d20"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"c492f944af160ee2e9a237c509dd270a"},{url:"index.html",revision:"e355f3654b53e70c3ac3efd0ca7b9604"},{url:"icon.svg",revision:"dba94027bbb3b869c0ebf9b6beee1953"},{url:"favicon.svg",revision:"72e74ad8f660d9400c34fa69912b94a3"},{url:"images/loading-poster.svg",revision:"97c56238c72450e4953e1d7db2f6e8e6"},{url:"assets/xychartDiagram-PRI3JC2R-BPRLFZFO.js",revision:null},{url:"assets/wikipedia-BNDKhpH7.js",revision:null},{url:"assets/useNostr-BqBiQvAw.js",revision:null},{url:"assets/useContentImages-6RAIPaCD.js",revision:null},{url:"assets/treemap-GDKQZRPO-BONrJn_M.js",revision:null},{url:"assets/timeline-definition-IT6M3QCI-YZ3E6G6Y.js",revision:null},{url:"assets/stateDiagram-v2-4FDKWEC3-DU4WuvUX.js",revision:null},{url:"assets/stateDiagram-FKZM4ZOC-0gnLENSy.js",revision:null},{url:"assets/song-renderer-Dfxndu0u.js",revision:null},{url:"assets/sequenceDiagram-WL72ISMW-vl_Vi7FC.js",revision:null},{url:"assets/seedPrompts-CLWaUv28.js",revision:null},{url:"assets/sankeyDiagram-TZEHDZUN-BvbSnReE.js",revision:null},{url:"assets/requirementDiagram-UZGBJVZJ-rvSNaNad.js",revision:null},{url:"assets/quadrantDiagram-AYHSOK5B-YXz0Sctj.js",revision:null},{url:"assets/pieDiagram-ADFJNKIX-Dpk_NNhH.js",revision:null},{url:"assets/ordinal-Cboi1Yqb.js",revision:null},{url:"assets/openlibrary-B8IPeH2e.js",revision:null},{url:"assets/ollama-provider-Ck1Tq0Ld.js",revision:null},{url:"assets/nodeDemoPrompts-DjnuaxJP.js",revision:null},{url:"assets/mindmap-definition-VGOIOE7T-CiQvifpn.js",revision:null},{url:"assets/mermaid.core-CJYA4M6R.js",revision:null},{url:"assets/linear-C8gXlzKZ.js",revision:null},{url:"assets/layout-B8BsJCKz.js",revision:null},{url:"assets/katex.min-CASE1JAf.css",revision:null},{url:"assets/katex-DGN8GczM.js",revision:null},{url:"assets/kanban-definition-3W4ZIXB7-3dSnDyOU.js",revision:null},{url:"assets/journeyDiagram-XKPGCS4Q-CJKi1fxm.js",revision:null},{url:"assets/init-Gi6I4Gst.js",revision:null},{url:"assets/infoDiagram-HS3SLOUP-D93ErRbW.js",revision:null},{url:"assets/index-BNvE9-tw.css",revision:null},{url:"assets/index-BD9qoze1.js",revision:null},{url:"assets/guideConversation-BYC5cBFP.js",revision:null},{url:"assets/graph-C_AQVES1.js",revision:null},{url:"assets/gitGraphDiagram-V2S2FVAM-C2LeaeGP.js",revision:null},{url:"assets/ganttDiagram-JELNMOA3-q91xyu3J.js",revision:null},{url:"assets/freeFilms-B9DmMKj5.js",revision:null},{url:"assets/flowDiagram-NV44I4VS-BvN4KeD9.js",revision:null},{url:"assets/film-renderer-CYpVwNyR.js",revision:null},{url:"assets/erDiagram-Q2GNP2WA-Br6HCsXp.js",revision:null},{url:"assets/diagram-S2PKOQOG-DfTOlz3T.js",revision:null},{url:"assets/diagram-QEK2KX5R-DWcBhw56.js",revision:null},{url:"assets/diagram-PSM6KHXK-pv0hhM2l.js",revision:null},{url:"assets/defaultLocale-DX6XiGOO.js",revision:null},{url:"assets/dagre-6UL2VRFP-Ci6pJcPb.js",revision:null},{url:"assets/cytoscape.esm-5J0xJHOV.js",revision:null},{url:"assets/cose-bilkent-S5V4N54A-6ucfRUG4.js",revision:null},{url:"assets/clone-DL4hXkhl.js",revision:null},{url:"assets/claude-provider-DbzPoW6j.js",revision:null},{url:"assets/classDiagram-v2-WZHVMYZB-CKu6zgYo.js",revision:null},{url:"assets/classDiagram-2ON5EDUG-CKu6zgYo.js",revision:null},{url:"assets/chunk-TZMSLE5B-C0gW3zRh.js",revision:null},{url:"assets/chunk-QZHKN3VN-DitCa0ck.js",revision:null},{url:"assets/chunk-QN33PNHL-__41nI0P.js",revision:null},{url:"assets/chunk-FMBD7UC4-BW8Xs0oO.js",revision:null},{url:"assets/chunk-DI55MBZ5-BH9hZRf0.js",revision:null},{url:"assets/chunk-B4BG7PRW-BQav9PdJ.js",revision:null},{url:"assets/chunk-55IACEB6-BkuxEf4w.js",revision:null},{url:"assets/chunk-4BX2VUAB-C5nXGAHj.js",revision:null},{url:"assets/chat-Dx-Dx0vd.js",revision:null},{url:"assets/channel-DmBfoHPu.js",revision:null},{url:"assets/c4Diagram-YG6GDRKO-C-brKlkJ.js",revision:null},{url:"assets/blockDiagram-VD42YOAC-Bn0u4W1G.js",revision:null},{url:"assets/architectureDiagram-VXUJARFQ-DmRrQAYq.js",revision:null},{url:"assets/arc-DDmIlb_Y.js",revision:null},{url:"assets/_baseUniq-Bk6YzBdk.js",revision:null},{url:"assets/_basePickBy-DwJ1pklu.js",revision:null},{url:"assets/WidgetDemoPage-Iclrl_KC.js",revision:null},{url:"assets/WidgetDemoPage-BSWX2CxO.css",revision:null},{url:"assets/ThreadNode-DaJ9aByD.js",revision:null},{url:"assets/SongGrid.vue_vue_type_script_setup_true_lang-BOXkLn09.js",revision:null},{url:"assets/SongGrid-BN4Zarxz.js",revision:null},{url:"assets/SongDetail.vue_vue_type_script_setup_true_lang-BGRNHJco.js",revision:null},{url:"assets/SongDetail-YK-Le0Qq.js",revision:null},{url:"assets/GuidePage-BvYaLEzG.css",revision:null},{url:"assets/GuidePage-B_OyAhui.js",revision:null},{url:"assets/FilmGrid.vue_vue_type_script_setup_true_lang-Cv6-zNyf.js",revision:null},{url:"assets/FilmGrid-Bxr1_fiQ.js",revision:null},{url:"assets/FilmDetail.vue_vue_type_script_setup_true_lang-BOBGVwtd.js",revision:null},{url:"assets/FilmDetail-B2H0Z1e1.js",revision:null},{url:"assets/ConversationViewerPage-DWC47yHz.js",revision:null},{url:"assets/ChatWindow.vue_vue_type_script_setup_true_lang-DK0BUVLp.js",revision:null},{url:"assets/ChatWindow-CwFp9jEi.css",revision:null},{url:"assets/ChatPage-DTwFPy-s.js",revision:null},{url:"assets/ChatPage-CA2cZZjS.css",revision:null},{url:"assets/BrowsePage-Au6xU1sq.js",revision:null},{url:"assets/icons/microphone.svg",revision:null},{url:"apple-touch-icon-180x180.png",revision:"7c24333289dd2af70268ed3018b06188"},{url:"favicon.svg",revision:"72e74ad8f660d9400c34fa69912b94a3"},{url:"icon.svg",revision:"dba94027bbb3b869c0ebf9b6beee1953"},{url:"pwa-192x192.png",revision:"b808488f273b70ad731254043774b56f"},{url:"pwa-512x512.png",revision:"93c28a922e11a852a2ff9c277dc60037"},{url:"manifest.webmanifest",revision:"28fc12e11969e378feb1aaa569dafb80"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("index.html"))),s.registerRoute(/^https:\/\/api\.anthropic\.com\/.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/^https:\/\/openrouter\.ai\/.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/web-search\?.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/rss-articles\?.*/i,new s.NetworkOnly,"GET"),s.registerRoute(/\/api\/tmdb\/.*/i,new s.StaleWhileRevalidate({cacheName:"tmdb-cache",plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:86400})]}),"GET"),s.registerRoute(/^https:\/\/image\.tmdb\.org\/.*/i,new s.CacheFirst({cacheName:"tmdb-images",plugins:[new s.ExpirationPlugin({maxEntries:500,maxAgeSeconds:604800})]}),"GET"),s.registerRoute(/^https:\/\/upload\.wikimedia\.org\/.*/i,new s.CacheFirst({cacheName:"wiki-images",plugins:[new s.ExpirationPlugin({maxEntries:200,maxAgeSeconds:604800})]}),"GET"),s.registerRoute(/^https:\/\/d12wklypp119aj\.cloudfront\.net\/image\/.*/i,new s.CacheFirst({cacheName:"wavlake-images",plugins:[new s.ExpirationPlugin({maxEntries:300,maxAgeSeconds:604800})]}),"GET")}); diff --git a/image-recipe/configs/nginx-archipelago.conf b/image-recipe/configs/nginx-archipelago.conf index 4375fb2a..f430603a 100644 --- a/image-recipe/configs/nginx-archipelago.conf +++ b/image-recipe/configs/nginx-archipelago.conf @@ -52,6 +52,21 @@ server { proxy_send_timeout 120s; } + # AIUI Ollama (local AI) proxy — localhost:11434 + location /aiui/api/ollama/ { + if ($cookie_session = "") { + return 401 '{"error":"Unauthorized"}'; + } + proxy_pass http://127.0.0.1:11434/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 300s; + proxy_set_header Connection ""; + } + # AIUI web search proxy — SearXNG on port 8888 location /aiui/api/web-search { proxy_pass http://127.0.0.1:8888/search; @@ -403,6 +418,19 @@ server { proxy_read_timeout 300s; proxy_send_timeout 120s; } + location /aiui/api/ollama/ { + if ($cookie_session = "") { + return 401 '{"error":"Unauthorized"}'; + } + proxy_pass http://127.0.0.1:11434/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 300s; + proxy_set_header Connection ""; + } location /aiui/api/openrouter/ { if ($cookie_session = "") { return 401 '{"error":"Unauthorized"}'; diff --git a/neode-ui/docker/nginx-demo.conf b/neode-ui/docker/nginx-demo.conf index 68d26294..8266efff 100644 --- a/neode-ui/docker/nginx-demo.conf +++ b/neode-ui/docker/nginx-demo.conf @@ -86,6 +86,18 @@ http { proxy_set_header X-Real-IP $remote_addr; } + # Proxy Ollama (local AI) requests to backend + location /aiui/api/ollama/ { + proxy_pass http://neode-backend:5959; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 300s; + proxy_set_header Connection ""; + } + # Proxy Claude API requests to backend (which handles API key + streaming) location /aiui/api/claude/ { proxy_pass http://neode-backend:5959; diff --git a/neode-ui/mock-backend.js b/neode-ui/mock-backend.js index 8be75444..31b2a0ef 100755 --- a/neode-ui/mock-backend.js +++ b/neode-ui/mock-backend.js @@ -1087,6 +1087,74 @@ app.post('/aiui/api/claude/*', (req, res) => { proxyReq.end() }) +// Ollama (local AI) proxy — forwards to localhost:11434 +app.all('/aiui/api/ollama/*', (req, res) => { + const ollamaPath = '/' + req.params[0] + const bodyStr = JSON.stringify(req.body) + + const options = { + hostname: '127.0.0.1', + port: 11434, + path: ollamaPath, + method: req.method, + headers: { + 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(bodyStr), + }, + } + + const proxyReq = http.request(options, (proxyRes) => { + res.writeHead(proxyRes.statusCode, proxyRes.headers) + proxyRes.pipe(res) + }) + + proxyReq.on('error', (err) => { + const msg = err.message || err.code || 'Ollama not available' + console.error('[Ollama Proxy] Error:', msg) + if (!res.headersSent) { + res.status(502).json({ error: msg }) + } + }) + + if (req.method !== 'GET' && req.method !== 'HEAD') { + proxyReq.write(bodyStr) + } + proxyReq.end() +}) + +// ============================================================================= +// Ollama Local AI Proxy (forwards to Ollama on localhost:11434) +// ============================================================================= +app.all('/api/ollama/*', (req, res) => { + const ollamaPath = '/' + req.params[0] + const isPost = req.method === 'POST' + const bodyStr = isPost ? JSON.stringify(req.body) : null + + const options = { + hostname: '127.0.0.1', + port: 11434, + path: ollamaPath, + method: req.method, + headers: { 'Content-Type': 'application/json' }, + } + + const proxyReq = http.request(options, (proxyRes) => { + res.writeHead(proxyRes.statusCode, proxyRes.headers) + proxyRes.pipe(res) + }) + + proxyReq.on('error', (err) => { + const msg = err.message || err.code || 'Ollama not available' + console.error('[Ollama Proxy] Error:', msg) + if (!res.headersSent) { + res.status(502).json({ error: msg }) + } + }) + + if (bodyStr) proxyReq.write(bodyStr) + proxyReq.end() +}) + // Web search stub (no search engine configured in demo) app.get('/api/web-search', (req, res) => { res.json({ results: [] })