@openartifactsai/cli 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/SKILL.md +7 -2
  2. package/package.json +1 -1
  3. package/vendor/CHANGELOG.md +1082 -0
  4. package/vendor/artifact-types/page/SKILL.md +3 -1
  5. package/vendor/artifact-types/page/artifact-type/reference/capabilities.d.ts +0 -1
  6. package/vendor/artifact-types/page/artifact-type/reference/capabilities.md +1 -1
  7. package/vendor/frame-host/client/comments.js +20 -19
  8. package/vendor/frame-host/client/page.js +1352 -0
  9. package/vendor/frame-host/client/review.js +279 -0
  10. package/vendor/frame-host/client/runtime.js +8 -6
  11. package/vendor/frame-host/client/sample.js +1 -1
  12. package/vendor/frame-host/client/shell.css +1 -0
  13. package/vendor/frame-host/client/shell.js +206 -6
  14. package/vendor/frame-host/client/translate.js +375 -0
  15. package/vendor/frame-host/frame-host.mjs +91 -30
  16. package/vendor/home/assets/{browser-models-DWkPVHmp.js → browser-models-Ceon9UIN.js} +4 -4
  17. package/vendor/home/assets/library-RBaguEV9.js +397 -0
  18. package/vendor/home/assets/main-BKHYngAm.js +2 -0
  19. package/vendor/home/assets/main-Cw3mY0u9.css +1 -0
  20. package/vendor/home/assets/node.browser-BFrmG6rb.js +1 -0
  21. package/vendor/home/assets/node.browser-CPQVYRMD.js +1 -0
  22. package/vendor/home/assets/react-DQymU5Da.js +47 -0
  23. package/vendor/home/index.html +3 -3
  24. package/vendor/home/library/index.html +2 -2
  25. package/vendor/open-artifacts.mjs +2516 -1072
  26. package/vendor/runtime.json +1 -1
  27. package/vendor/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  28. package/vendor/shell/assets/index-BhxD6amu.js +53 -0
  29. package/vendor/shell/assets/index-Cw3mY0u9.css +1 -0
  30. package/vendor/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  31. package/vendor/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  32. package/vendor/shell/index.html +2 -2
  33. package/vendor/type-server/cli.mjs +87 -26
  34. package/vendor/type-server/editors/data/assets/{index-CX_sn7ZZ.js → index-B0E35R1E.js} +5 -4
  35. package/vendor/type-server/editors/data/index.html +1 -1
  36. package/vendor/type-server/editors/design/assets/{index-BpNUmTVD.js → index-BOc3kd6N.js} +78 -77
  37. package/vendor/type-server/editors/design/index.html +1 -1
  38. package/vendor/type-server/editors/design-system/assets/{index-CP6AEO1P.js → index-B7MtPrtk.js} +5 -4
  39. package/vendor/type-server/editors/design-system/index.html +1 -1
  40. package/vendor/type-server/editors/docs/assets/{abnfDiagram-WEYOIA3C-Do25i7oS.js → abnfDiagram-WEYOIA3C-DcfGbMC9.js} +1 -1
  41. package/vendor/type-server/editors/docs/assets/{architectureDiagram-ZHVYKT53-BLlpboc2.js → architectureDiagram-ZHVYKT53-CfcGFZjM.js} +1 -1
  42. package/vendor/type-server/editors/docs/assets/{blockDiagram-RJAE7QA3-D0rO5p7M.js → blockDiagram-RJAE7QA3-C5s3aXD2.js} +1 -1
  43. package/vendor/type-server/editors/docs/assets/{c4Diagram-XDPPPE54-OoTiysJI.js → c4Diagram-XDPPPE54-BJgchX97.js} +1 -1
  44. package/vendor/type-server/editors/docs/assets/channel-B2TtMfsN.js +1 -0
  45. package/vendor/type-server/editors/docs/assets/{chunk-2E7WHVMD-yBl5BEaI.js → chunk-2E7WHVMD-BgQ4xapY.js} +1 -1
  46. package/vendor/type-server/editors/docs/assets/{chunk-2Q5K7J3B-DHKM5gd6.js → chunk-2Q5K7J3B-B1ktgQTo.js} +1 -1
  47. package/vendor/type-server/editors/docs/assets/{chunk-4EMNKR2T-B-f8WPM6.js → chunk-4EMNKR2T-Co-2oGfa.js} +1 -1
  48. package/vendor/type-server/editors/docs/assets/{chunk-55XCU76K-n8RDJr36.js → chunk-55XCU76K-BqpDaZgl.js} +1 -1
  49. package/vendor/type-server/editors/docs/assets/{chunk-5VM5RSS4-DzLzcqXE.js → chunk-5VM5RSS4-BJPvauTV.js} +1 -1
  50. package/vendor/type-server/editors/docs/assets/{chunk-JWPE2WC7-BLXkUVcK.js → chunk-JWPE2WC7-NCBAl-SW.js} +1 -1
  51. package/vendor/type-server/editors/docs/assets/{chunk-VQ5W62QI-DAGNVD29.js → chunk-VQ5W62QI-DPzloG3R.js} +1 -1
  52. package/vendor/type-server/editors/docs/assets/{chunk-XXDRQBXY-fgVyAbWV.js → chunk-XXDRQBXY-D08KAfXl.js} +1 -1
  53. package/vendor/type-server/editors/docs/assets/{chunk-ZCHMQSOR-D90xHR9n.js → chunk-ZCHMQSOR-CLWESu07.js} +2 -2
  54. package/vendor/type-server/editors/docs/assets/{classDiagram-v2-4MYWR3UA-uk1mPogR.js → classDiagram-v2-4MYWR3UA-BSPsabsn.js} +1 -1
  55. package/vendor/type-server/editors/docs/assets/{core-BMv5rGOd.js → core-Cqu2ilBr.js} +1 -1
  56. package/vendor/type-server/editors/docs/assets/{cose-bilkent-JH36ORCC-BJdqW8l3.js → cose-bilkent-JH36ORCC-D6at9M78.js} +1 -1
  57. package/vendor/type-server/editors/docs/assets/{cynefin-EF2NZ3EQ-BCce_ZhK.js → cynefin-EF2NZ3EQ-BTylb97F.js} +1 -1
  58. package/vendor/type-server/editors/docs/assets/{cynefinDiagram-WF24UDRP-DxD-4yjR.js → cynefinDiagram-WF24UDRP-Din3pKvL.js} +1 -1
  59. package/vendor/type-server/editors/docs/assets/{dagre-NK4GIZVX-B3VAS51Y.js → dagre-NK4GIZVX-5qfRwQnt.js} +1 -1
  60. package/vendor/type-server/editors/docs/assets/{diagram-CBK3MWTC-B0kHeUdr.js → diagram-CBK3MWTC-BnrAjIhJ.js} +1 -1
  61. package/vendor/type-server/editors/docs/assets/{diagram-I5XIIV2D-BCRvsLAu.js → diagram-I5XIIV2D-CH_xkoKv.js} +1 -1
  62. package/vendor/type-server/editors/docs/assets/{diagram-ODIL2UCW-DFOTsSuA.js → diagram-ODIL2UCW-D5dns2KC.js} +1 -1
  63. package/vendor/type-server/editors/docs/assets/{diagram-PFBEJUXE-_DT3jk0i.js → diagram-PFBEJUXE-D-3cnWXB.js} +1 -1
  64. package/vendor/type-server/editors/docs/assets/{diagram-RJA3I4VV-UFrdnTgs.js → diagram-RJA3I4VV-DImejfKM.js} +1 -1
  65. package/vendor/type-server/editors/docs/assets/{diagram-TYUNFSNR-DrbWyZOX.js → diagram-TYUNFSNR-DscxSG0M.js} +1 -1
  66. package/vendor/type-server/editors/docs/assets/{ebnfDiagram-V4P3TTPT-M-DCWgZM.js → ebnfDiagram-V4P3TTPT-C4wwb0NC.js} +1 -1
  67. package/vendor/type-server/editors/docs/assets/{elk-QONTBCTQ-l6XmbRQj.js → elk-QONTBCTQ-O05tgWzI.js} +1 -1
  68. package/vendor/type-server/editors/docs/assets/{erDiagram-KYQIGQAA-CHqbnmEE.js → erDiagram-KYQIGQAA-D171V8gY.js} +1 -1
  69. package/vendor/type-server/editors/docs/assets/{flowDiagram-IUGLLWBU-BzkFyGCL.js → flowDiagram-IUGLLWBU-DcvtJsgJ.js} +1 -1
  70. package/vendor/type-server/editors/docs/assets/{ganttDiagram-R7GPNTJY-BcNaSXNv.js → ganttDiagram-R7GPNTJY-DcuQ9a5m.js} +1 -1
  71. package/vendor/type-server/editors/docs/assets/{gitGraphDiagram-PDYL7XHY-JaNdSZbv.js → gitGraphDiagram-PDYL7XHY-iQoh6Yen.js} +1 -1
  72. package/vendor/type-server/editors/docs/assets/{index-BMNUnwXE.js → index-BNk_Jpgl.js} +49 -48
  73. package/vendor/type-server/editors/docs/assets/{infoDiagram-MVDRKAX5-Cl2Q_Ylf.js → infoDiagram-MVDRKAX5-DECkmgI6.js} +1 -1
  74. package/vendor/type-server/editors/docs/assets/{ishikawaDiagram-HPEHV2GE-umirqIpN.js → ishikawaDiagram-HPEHV2GE-CK0mATvD.js} +1 -1
  75. package/vendor/type-server/editors/docs/assets/{journeyDiagram-BOSHW7O7-HMtvkXvq.js → journeyDiagram-BOSHW7O7-Dz1u7rfA.js} +1 -1
  76. package/vendor/type-server/editors/docs/assets/{kanban-definition-FNSA4HC5-CYouTBUM.js → kanban-definition-FNSA4HC5-B1-0Mp0R.js} +1 -1
  77. package/vendor/type-server/editors/docs/assets/{mermaid.core-BEcbgpI8.js → mermaid.core-DhXbeevr.js} +4 -4
  78. package/vendor/type-server/editors/docs/assets/{mindmap-definition-6OY57UG3-BnwugHtV.js → mindmap-definition-6OY57UG3-Czy5C8sa.js} +1 -1
  79. package/vendor/type-server/editors/docs/assets/{pegDiagram-ECIUJNBX-DqT6jxo7.js → pegDiagram-ECIUJNBX-C97juwaO.js} +1 -1
  80. package/vendor/type-server/editors/docs/assets/{pieDiagram-GNMPY74T-CBKjnr1W.js → pieDiagram-GNMPY74T-rrh7flvh.js} +1 -1
  81. package/vendor/type-server/editors/docs/assets/{quadrantDiagram-D57K4MC3-CdTG11Ff.js → quadrantDiagram-D57K4MC3-D3xBy1ZX.js} +1 -1
  82. package/vendor/type-server/editors/docs/assets/{railroadDiagram-Y72NRBL7-BZgG8r2y.js → railroadDiagram-Y72NRBL7-B3r2jnFu.js} +1 -1
  83. package/vendor/type-server/editors/docs/assets/{requirementDiagram-EQYSW5RA-CutdnAmY.js → requirementDiagram-EQYSW5RA-BQ47C1Ra.js} +1 -1
  84. package/vendor/type-server/editors/docs/assets/{sankeyDiagram-SY24JHO5-DBaoPDhR.js → sankeyDiagram-SY24JHO5-CzPG7mjJ.js} +1 -1
  85. package/vendor/type-server/editors/docs/assets/{sequenceDiagram-BLEHNHQU-B6YZp-Wu.js → sequenceDiagram-BLEHNHQU-Bg7XKU4E.js} +1 -1
  86. package/vendor/type-server/editors/docs/assets/{sizeCapture-INFHLROL-xATlK6Zl.js → sizeCapture-INFHLROL-CKrHufer.js} +1 -1
  87. package/vendor/type-server/editors/docs/assets/{stateDiagram-v2-A6IESKWZ-C7BND5vv.js → stateDiagram-v2-A6IESKWZ-CW9zsuBs.js} +1 -1
  88. package/vendor/type-server/editors/docs/assets/{swimlanes-B3ENRKFQ-WYLzM6hb.js → swimlanes-B3ENRKFQ-ucM-4idg.js} +1 -1
  89. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-DuNOy5jj.js +8 -0
  90. package/vendor/type-server/editors/docs/assets/{timeline-definition-JXYKGLGB-BXC0F4xE.js → timeline-definition-JXYKGLGB-D__Vd4zC.js} +1 -1
  91. package/vendor/type-server/editors/docs/assets/{usecaseDiagram-WPOLBNNX-Cx58jkEj.js → usecaseDiagram-WPOLBNNX-MvJGETnL.js} +1 -1
  92. package/vendor/type-server/editors/docs/assets/{vennDiagram-Q3Y3IDCW-DhdwpApW.js → vennDiagram-Q3Y3IDCW-DqUtQLGR.js} +1 -1
  93. package/vendor/type-server/editors/docs/assets/{wardleyDiagram-IVAIDKWA-CBdbPWVr.js → wardleyDiagram-IVAIDKWA-usWt7-Hk.js} +1 -1
  94. package/vendor/type-server/editors/docs/assets/{xychartDiagram-4URNHDU4-Cb0tcPqs.js → xychartDiagram-4URNHDU4-D2RJz2yB.js} +1 -1
  95. package/vendor/type-server/editors/docs/index.html +1 -1
  96. package/vendor/type-server/editors/motion/assets/{gif-jobs-Bq4rwLBV.js → gif-jobs-Bn-j8izW.js} +1 -1
  97. package/vendor/type-server/editors/motion/assets/{index-BDOqtmcc.js → index-C6NXgLix.js} +7 -6
  98. package/vendor/type-server/editors/motion/assets/{src-8SKXU1IY.js → src-C0eDPv3h.js} +1 -1
  99. package/vendor/type-server/editors/motion/index.html +1 -1
  100. package/vendor/type-server/editors/sheets/assets/{index-BY38EAff.js → index-BzbNSKJF.js} +7 -6
  101. package/vendor/type-server/editors/sheets/assets/{workbook-worker-CRtLrZhP.js → workbook-worker-3zEBX9ep.js} +3 -2
  102. package/vendor/type-server/editors/sheets/index.html +1 -1
  103. package/vendor/type-server/editors/slides/assets/{index-B51oMclO.js → index-BfTA-zoQ.js} +7 -6
  104. package/vendor/type-server/editors/slides/assets/{src-CdsEFSuC.js → src-DPkvzCL6.js} +1 -1
  105. package/vendor/type-server/editors/slides/index.html +1 -1
  106. package/vendor/type-server/editors/whiteboard/assets/{drawing-look-worker-Dd2iYbXC.js → drawing-look-worker-CYqIJdVf.js} +4 -3
  107. package/vendor/type-server/editors/whiteboard/assets/{gif-jobs-DmIqT6gk.js → gif-jobs-CPyG3MAt.js} +1 -1
  108. package/vendor/type-server/editors/whiteboard/assets/{index-B3oRKavi.js → index-BBgN0Gcr.js} +2 -2
  109. package/vendor/type-server/editors/whiteboard/assets/{index-CTf9pd4S.js → index-BKFgBbwk.js} +8 -7
  110. package/vendor/type-server/editors/whiteboard/index.html +1 -1
  111. package/vendor/type-server/shell/assets/{browser-models-BzwWAVuE.js → browser-models-CiXqE7b9.js} +4 -4
  112. package/vendor/type-server/shell/assets/index-BhxD6amu.js +53 -0
  113. package/vendor/type-server/shell/assets/index-Cw3mY0u9.css +1 -0
  114. package/vendor/type-server/shell/assets/{node.browser-BgqLTfql.js → node.browser-ByUkO9oN.js} +1 -1
  115. package/vendor/type-server/shell/assets/{node.browser-BvryIsl7.js → node.browser-CSEwiusG.js} +1 -1
  116. package/vendor/type-server/shell/index.html +2 -2
  117. package/vendor/home/assets/RuntimeUpdate-BwvJ9sYp.js +0 -43
  118. package/vendor/home/assets/library-CyeaNaQo.js +0 -226
  119. package/vendor/home/assets/main-DUyobyFI.js +0 -5
  120. package/vendor/home/assets/main-DXpv3z2x.css +0 -1
  121. package/vendor/home/assets/node.browser-Cy4GM7Yl.js +0 -1
  122. package/vendor/home/assets/node.browser-nUfHL25Z.js +0 -1
  123. package/vendor/shell/assets/index-BIHLxOO6.js +0 -52
  124. package/vendor/shell/assets/index-DXpv3z2x.css +0 -1
  125. package/vendor/type-server/editors/docs/assets/channel-Cgat34ii.js +0 -1
  126. package/vendor/type-server/editors/docs/assets/swimlanesDiagram-AYQRV4AK-Bwh1tnzE.js +0 -8
  127. package/vendor/type-server/shell/assets/index-BIHLxOO6.js +0 -52
  128. package/vendor/type-server/shell/assets/index-DXpv3z2x.css +0 -1
@@ -0,0 +1,397 @@
1
+ import{al as Ra,am as za,an as Ua,ao as $a,s as _a,ap as Ha,aq as Ba,j as e,r as h,ar as Xt,D as Ka,as as Wa,at as qa,au as Va,av as Ga,a5 as Ya,a6 as Za,a7 as Ja,a8 as Qa,a9 as Lt,aa as Xa,aj as eo,I as to,a0 as At,a1 as ao,a2 as Ot,W as ea,J as oo,K as no,L as ta,M as so,O as ro,P as io,Q as lo,T as co,U as po,V as uo,X as ho,Y as go,_ as xo,a3 as mo,a4 as fo,ab as bo,ac as yo,ad as vo,ae as jo,af as wo,ag as Pt,ah as ko,ai as No,aw as So,H as dt,B as Co,ax as To,f as Eo,e as Re,p as aa,g as Mo,i as Lo,ay as Ao,az as V,aA as Oo,v as Po,aB as Do,w as pt,ak as Fo,l as Io,k as Ro,o as zo}from"./react-DQymU5Da.js";const oa={...Ra,panel:"Open Artifacts",title:"Open Artifacts","time.locale":"zh-CN",search:"搜索作品","tab.label":"首页","tab.artifacts":"作品","search.clear":"清除搜索","type.slides":"幻灯片","type.design":"设计","type.design-system":"设计系统","type.data":"数据","type.docs":"文档","type.motion":"动画","type.whiteboard":"白板","type.sheets":"表格","create.heading":"新建","create.new":"新建","create.session":"新会话","view.list":"列表视图","view.grid":"网格视图","filter.button":"排序和筛选","filter.sort":"排序方式","filter.type":"类型","filter.project":"项目","filter.noProject":"不属于项目","filter.date":"打开时间","filter.sharing":"共享","filter.pinned":"已固定","filter.any":"不限","filter.some":"{count} 项","filter.clear":"清除筛选","sort.opened":"最近打开","sort.updated":"最近修改","sort.created":"创建时间","sort.name":"名称","date.any":"不限","date.today":"今天","date.yesterday":"昨天","date.week":"最近 7 天","date.month":"最近 30 天","sharing.any":"不限","sharing.shared":"已共享","sharing.private":"未共享","card.opened":"{time}打开","card.justNow":"刚刚打开","card.opening":"正在打开…","card.shared":"已在局域网共享","card.webShared":"已分享到网上","action.more":"更多操作","action.pin":"固定","action.unpin":"取消固定","action.rename":"重命名","action.copy":"复制链接","action.share":"分享…","action.delete":"删除","rename.title":"重命名作品","rename.save":"保存","dialog.cancel":"取消","dialog.close":"关闭","changelog.title":"更新日志","changelog.new":"Open Artifacts {version} 更新了这些","changelog.all":"更新日志","changelog.gotIt":"知道了","changelog.more":"展开其余 {count} 条","changelog.version":"Open Artifacts {version}","changelog.installed":"当前版本","changelog.available":"可更新","changelog.none":"还没有更新日志。","changelog.releases":"在 GitHub 上查看","changelog.section.added":"新增","changelog.section.changed":"改进","changelog.section.fixed":"修复","changelog.section.removed":"移除","delete.title":"删除“{title}”?","delete.moves":"这会移除这个作品,它的文件夹移到 Open Artifacts 的回收站,可以在提示里撤销。","delete.confirm":"删除","delete.webShared":"它已分享到网上,删除不会停止分享:{url} 仍然可以打开。要停止,先在它的分享面板里点“停止分享”,或者去 {manage}。","toast.copied":"链接已复制到剪贴板。","toast.copyRemote":"作品的链接只在运行 Open Artifacts 的电脑上能打开,这里打开的那个是你本人的入口,不能给别人。要分享,在作品页面里点“分享”。","toast.deleted":"已删除“{title}”。","toast.removed":"已从作品里移除“{title}”,文件夹还在原处。","toast.undo":"撤销","toast.close":"关闭","empty.title":"还没有作品","empty.body":"本机任意 Agent 用 Artifact 工具做出来的东西都会出现在这里。点上面的入口开始做一个。","empty.noMatches":"没有符合条件的作品","load.error":"读取作品列表失败:{message}","load.retry":"重试","open.typeMissing":"没有安装「{type}」类型,打不开这个作品。","open.failed":"打不开:{message}","open.noSession":"原来的对话已不在,作品在新窗口里打开了。","open.blocked":"浏览器拦下了新窗口:允许这个网站弹出窗口后再试。","action.failed":"没有做成:{message}","importLink.entry":"从链接导入","importLink.title":"从链接导入","importLink.body":"粘贴别人分享到网上的作品链接(分享页“复制一份”给的链接,或分享页本身的地址),或 claude.ai 上分享的设计画布链接。副本会放进你的 Open Artifacts 文件夹,并在这里打开。","importLink.input":"链接","importLink.placeholder":"https://openartifacts.net/a/…","importLink.invalid":"这不是分享到网上的作品链接,也不是 claude.ai 上的设计画布链接。","importLink.copy":"复制一份","importLink.copying":"正在复制…","importLink.done":"已复制一份“{title}”","importLink.doneNotes":"已复制一份“{title}”,但有些内容没带过来:","importLink.doneNotesToast":"已复制一份“{title}”。有些内容没带过来:{notes}","importLink.open":"打开","importLink.notFound":"这个链接上没有分享的作品:可能已经停止分享,或者链接有误。","importLink.claudeNotFound":"这个 claude.ai 链接上没有公开分享的内容:可能作者只分享给了指定的人、已经删除,或者链接有误。","importLink.unsupported":"claude.ai 上只能复制设计画布,这个是别的类型的作品。Claude 文档要换个办法:在 claude.ai 上从它的导出菜单把标签页导出为 Word 或 Markdown,再导入到这里的文档。","importLink.removed":"分享服务已经下架了这个作品。","importLink.notAllowed":"作者没有允许别人复制它。","importLink.checksum":"有文件没有完整下载下来,请再试一次。","importLink.tooLarge":"它太大了,没法复制到这里。","importLink.typeMissing":"这里没有安装它的作品类型,装好后再试。","importLink.failed":"没能复制:{message}","tile.beta":"Beta","peek.by":"来自 Open Artifacts","peek.start":"从提示词开始","about.docs":"团队一起读、评论、直接修改的文档,Agent 负责让它保持最新。","about.slides":"能直接演示的幻灯片,可以套用设计系统换风格,也能导出成 PowerPoint。","about.sheets":"带公式和格式的表格,你和 Agent 一起填。","about.design":"界面、流程和图形,作为画板排在同一张画布上,也可以动手改。","about.design-system":"颜色、字体、组件和素材,幻灯片和设计都照着它来做。","about.data":"用你的数据做的图表、数字和表格,每一项都标明出处。","about.whiteboard":"方框、箭头和便利贴,你和 Agent 都能在上面画。","about.motion":"一段在页面里直接播放的短动画,可以导出成 MP4、GIF 或网页。"},ut=t=>Object.prototype.hasOwnProperty.call(oa,t),na={...za,panel:"Open Artifacts",title:"Open Artifacts","time.locale":"en",search:"Search artifacts","tab.label":"Home","tab.artifacts":"Artifacts","search.clear":"Clear search","type.slides":"Slides","type.design":"Design","type.design-system":"Design system","type.data":"Data","type.docs":"Docs","type.motion":"Motion","type.whiteboard":"Whiteboard","type.sheets":"Sheets","create.heading":"Make something new","create.new":"New","create.session":"New session","view.list":"List view","view.grid":"Grid view","filter.button":"Sort and filter","filter.sort":"Sort by","filter.type":"Type","filter.project":"Project","filter.noProject":"No project","filter.date":"Date opened","filter.sharing":"Sharing","filter.pinned":"Pinned","filter.any":"Any","filter.some":"{count} selected","filter.clear":"Clear filters","sort.opened":"Last opened","sort.updated":"Last edited","sort.created":"Date created","sort.name":"Name","date.any":"Any time","date.today":"Today","date.yesterday":"Yesterday","date.week":"Past 7 days","date.month":"Past 30 days","sharing.any":"Any","sharing.shared":"Shared","sharing.private":"Not shared","card.opened":"Opened {time}","card.justNow":"Opened just now","card.opening":"Opening…","card.shared":"Shared on the local network","card.webShared":"Shared on the web","action.more":"More actions","action.pin":"Pin","action.unpin":"Unpin","action.rename":"Rename","action.copy":"Copy link","action.share":"Share…","action.delete":"Delete","rename.title":"Rename artifact","rename.save":"Save","dialog.cancel":"Cancel","dialog.close":"Close","changelog.title":"Changelog","changelog.new":"What's new in Open Artifacts {version}","changelog.all":"Changelog","changelog.gotIt":"Got it","changelog.more":"Show {count} more","changelog.version":"Open Artifacts {version}","changelog.installed":"Installed","changelog.available":"Available","changelog.none":"No release notes yet.","changelog.releases":"View on GitHub","changelog.section.added":"Added","changelog.section.changed":"Changed","changelog.section.fixed":"Fixed","changelog.section.removed":"Removed","delete.title":"Delete {title}?","delete.moves":"This removes the artifact and moves its folder to Open Artifacts' trash. You can undo it from the notice.","delete.confirm":"Delete","delete.webShared":"It is shared to the web, and deleting it does not stop that: {url} keeps working. To stop it, use Stop sharing in its Share panel first, or go to {manage}.","toast.copied":"Link copied to clipboard.","toast.copyRemote":"An artifact's link opens only on the computer that runs Open Artifacts, and the one opened here is your own way in, not for others. To share it, use Share on its page.","toast.deleted":"Deleted “{title}”.","toast.removed":"Took “{title}” off your artifacts. Its folder stays where it is.","toast.undo":"Undo","toast.close":"Close","empty.title":"No artifacts yet","empty.body":"What an agent on this computer makes with the Artifact tool shows up here. Start one with a tile above.","empty.noMatches":"No artifacts match","load.error":"Could not read the artifacts: {message}","load.retry":"Try again","open.typeMissing":"The {type} type is not installed, so this artifact cannot open.","open.failed":"Could not open it: {message}","open.noSession":"The conversation is gone, so the artifact opened in a new window.","open.blocked":"The browser blocked the new window: allow pop-ups for this site and try again.","action.failed":"That did not work: {message}","importLink.entry":"Import from link","importLink.title":"Import from a link","importLink.body":"Paste the link of an artifact someone shared to the web (the link its page's Make a copy gives, or the page's own address), or the link of a design canvas shared on claude.ai. A copy goes into your Open Artifacts folder and opens here.","importLink.input":"Link","importLink.placeholder":"https://openartifacts.net/a/…","importLink.invalid":"This is not the link of an artifact shared to the web, or of a design canvas on claude.ai.","importLink.copy":"Make a copy","importLink.copying":"Copying…","importLink.done":"Made a copy of “{title}”","importLink.doneNotes":"Made a copy of “{title}”, but not everything came over:","importLink.doneNotesToast":"Made a copy of “{title}”. Not everything came over: {notes}","importLink.open":"Open","importLink.notFound":"Nothing is shared at this link: sharing stopped, or the link is wrong.","importLink.claudeNotFound":"Nothing is shared publicly at this claude.ai link: its owner shares it only with people they chose, it is gone, or the link is wrong.","importLink.unsupported":"Only design canvases can be copied from claude.ai, and this is another kind of artifact. A Claude doc comes over another way: on claude.ai, export its tabs as Word or Markdown from its Export menu, then import the files into a doc here.","importLink.removed":"The share service took this artifact down.","importLink.notAllowed":"Its owner does not allow copies of it.","importLink.checksum":"A file did not arrive intact. Try again.","importLink.tooLarge":"It is too large to copy here.","importLink.typeMissing":"Its type is not installed here. Install it, then try again.","importLink.failed":"Could not make the copy: {message}","tile.beta":"Beta","peek.by":"By Open Artifacts","peek.start":"Start with a prompt","about.docs":"A document your team reads, comments on and edits in place while the agent keeps it current.","about.slides":"A deck you can present, restyle with a design system and export to PowerPoint.","about.sheets":"A grid with formulas and formatting that you and the agent fill in together.","about.design":"Screens, flows and graphics laid out as artboards on one canvas you can edit by hand.","about.design-system":"Colors, type, components and assets that your decks and designs are built from.","about.data":"Charts, numbers and tables from your data, each marked with its source.","about.whiteboard":"Boxes, arrows and sticky notes you and the agent both draw on.","about.motion":"A short animated film that plays in place and exports as MP4, GIF or HTML."};function sa(t,a={}){return t.replace(/\{(\w+)\}/g,(o,n)=>a[n]??o)}const Dt=(t,a)=>sa(na[t]??t,a);function Uo(t){return typeof t!="function"?Dt:(a,o)=>{const n=t(a,o);return typeof n=="string"&&n!==a?sa(n,o):Dt(a,o)}}const $o="https://claude.ai",Je="frame.claudeusercontent.com",_o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Ho=/^[A-Za-z0-9_-]{6,64}$/,Bo=t=>t.protocol==="http:"&&$a(t.hostname);function Ko(t){let a;try{a=new URL(String(t).trim())}catch{return null}if(a.username||a.password)return null;if(a.protocol==="https:"&&a.hostname.endsWith(`.${Je}`)){const r=a.hostname.slice(0,-(Je.length+1));return!_o.test(r)||a.port?null:{pageUrl:`${$o}/artifact/${r}`,frame:`https://${r}.${Je}`}}if(!(a.protocol==="https:"&&a.hostname==="claude.ai"&&!a.port)&&!Bo(a))return null;const n=/^\/(code\/)?artifact\/([^/]+)\/?$/.exec(a.pathname),s=n?.[2];return!s||!Ho.test(s)?null:{pageUrl:`${a.origin}/${n[1]??""}artifact/${s}`,frame:null}}function ra(t){return Ua(t)?"share":Ko(t)?"claude":null}const X=t=>typeof t=="string",Wo=["unreachable","timeout","signed_out","unsupported","refused","error"],qo=["project","user","extra","installed","builtin"];function Vo(t,a,o){if(!X(t))return null;const n=Ba(t);if(!n||n.id!==o)return null;try{return new URL(a).origin===n.origin?t:null}catch{return null}}function Go(t){if(!t||typeof t!="object")return null;const a=t;return X(a.id)?{id:a.id,version:X(a.version)?a.version:null,scope:qo.includes(a.scope)?a.scope:"user",...X(a.sha256)?{sha256:a.sha256}:{},...X(a.installedFrom)?{installedFrom:a.installedFrom}:{}}:null}function Yo(t){if(!t||typeof t!="object")return null;const a=t;if(!X(a.remote)||!X(a.host))return null;const o=[];for(const r of Array.isArray(a.types)?a.types:[]){const i=_a(r);if(!i||i.unpublished)continue;const c=r,u=Vo(c.page,a.host,i.id);if(!u)continue;const g=Ha.includes(c.standing)?c.standing:"new";o.push({...i,page:u,standing:g,local:Go(c.local)})}const n=X(a.error)&&a.error?a.error:null,s=n?Wo.includes(a.code)?a.code:"error":null;return{remote:a.remote,host:a.host,types:n?[]:o,error:n,code:s}}function Zo(t){const a=t&&typeof t=="object"?t:{};return{sites:(Array.isArray(a.sites)?a.sites:[]).map(Yo).filter(n=>!!n),notice:X(a.notice)?a.notice:""}}function Jo(t){switch(t.standing){case"installed":case"published-here":return{action:"none",label:t.standing};case"update":return t.local?.installedFrom===t.page?{action:"update",open:{update:t.local.id}}:{action:"update",open:{url:t.page,...t.local?{as:t.local.id}:{},auto:!0}};case"clash":return{action:"install-as",open:{url:t.page,auto:!1}};default:return{action:"install",open:{url:t.page,auto:!0}}}}const Qo={},Xo={getSnapshot:()=>Qo,subscribe:()=>()=>{}},en={updates:[],phase:"idle",to:"",restart:!1,failure:null,dismissed:""},tn={getSnapshot:()=>en,subscribe:()=>()=>{},start(){},later(){},close(){},reopen(){},t:t=>t},ia=h.createContext(null);function an({env:t,children:a}){return e.jsx(ia.Provider,{value:t,children:a})}function W(){const t=h.useContext(ia);if(t===null)throw new Error("usePageEnv needs an EnvProvider");return t}function on(){const{sessions:t}=W(),a=h.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return h.useCallback(o=>a.byId?.[o]?.title?.trim()??"",[a])}function me(){const t=W().updates??tn;return{...h.useSyncExternalStore(t.subscribe,t.getSnapshot),offer:t}}const ze=Object.freeze({sort:"opened",types:[],projects:[],date:"any",sharing:"any",pinned:!1}),nn=["opened","updated","created","name"],sn=Ka;function nt(t){return t.types.length>0||t.projects.length>0||t.date!=="any"||t.sharing!=="any"||t.pinned}const rn=Wa;function ln(t,a,o){if(a==="name")return[...t].sort((s,r)=>s.title.localeCompare(r.title,o));const n=a==="updated"?"updatedAt":a==="created"?"createdAt":"openedAt";return[...t].sort((s,r)=>s[n]<r[n]?1:s[n]>r[n]?-1:0)}function cn(t,{filters:a,query:o,now:n,locale:s,sessionTitle:r}){const i=o.trim().toLowerCase(),c=t.filter(u=>{if(a.types.length>0&&!a.types.includes(u.type)||a.projects.length>0&&!a.projects.includes(u.project??Xt)||a.pinned&&!u.pinned||a.sharing!=="any"&&u.shared!==(a.sharing==="shared")||!rn(u.openedAt,a.date,n))return!1;if(!i)return!0;const g=u.sessionId&&r?r(u.sessionId):"";return u.title.toLowerCase().includes(i)||g.toLowerCase().includes(i)||u.root.toLowerCase().includes(i)||(u.project??"").toLowerCase().includes(i)});return ln(c,a.sort,s)}function dn(t){const a=new Map;for(const o of t)a.set(o.type,(a.get(o.type)??0)+1);return a}function ee(t,a){const o=r=>{const[i="",c]=r.split("+")[0].split(/-(.*)/s);return{numbers:i.split(".").map(u=>Number.parseInt(u,10)||0),pre:c}},n=o(t),s=o(a);for(let r=0;r<3;r++){const i=(n.numbers[r]??0)-(s.numbers[r]??0);if(i!==0)return i>0}return n.pre===void 0||s.pre===void 0?n.pre===void 0&&s.pre!==void 0:n.pre.localeCompare(s.pre,"en",{numeric:!0})>0}const $e=t=>t.reduce((a,o)=>a===""||ee(o.latest,a)?o.latest:a,"");class pn extends Error{code;constructor(a,o){super(a),this.name="RouteError",this.code=o||void 0}}function un(t){const a=t?.code;return typeof a=="string"?a:""}const hn=2048;function Se(t){const a=typeof t=="string"?t.trim():"";return!a||a.length>hn||/\s/.test(a)?null:ra(a)!==null?a:null}function Ft(t){return!t.includes("Files")&&(t.includes("text/uri-list")||t.includes("text/plain"))}function gn(t){const a=(t("text/uri-list")||"").split(/\r?\n/).map(o=>o.trim()).find(o=>o!==""&&!o.startsWith("#"));return Se(a)??Se(t("text/plain"))}function Qe(t){if(t===null||typeof t!="object")return!1;const a=t;return a.isContentEditable===!0?!0:typeof a.closest=="function"&&a.closest(xn)!=null}const xn='input, textarea, select, [contenteditable]:not([contenteditable="false"])',It={invalid_argument:"importLink.invalid",not_found:"importLink.notFound",removed:"importLink.removed",copy_not_allowed:"importLink.notAllowed",checksum_mismatch:"importLink.checksum",too_large:"importLink.tooLarge",type_missing:"importLink.typeMissing"},Rt={not_found:"importLink.claudeNotFound",unsupported:"importLink.unsupported"};function mn(t,a,o){const n=un(t);if(o!==void 0&&Object.hasOwn(Rt,n)&&ra(o)==="claude")return a(Rt[n]);if(Object.hasOwn(It,n))return a(It[n]);const s=t instanceof Error?t.message:String(t);return a("importLink.failed",{message:s})}const st=["docs","slides","sheets","design","design-system","data","whiteboard","motion"],la=t=>st.includes(t);function zt(t){const a=[...new Set(t)],o=n=>la(n)?st.indexOf(n):st.length+a.indexOf(n);return a.sort((n,s)=>o(n)-o(s))}const fn={docs:{wash:"#cce3fd",ink:"#1757ac",tint:"#3f8ef0"},slides:{wash:"#f7d9ca",ink:"#903710",tint:"#e8703a"},sheets:{wash:"#caecc8",ink:"#016c0f",tint:"#3d9e3a"},design:{wash:"#e4deff",ink:"#5437b8",tint:"#7a5cf0"},"design-system":{wash:"#fbe6bd",ink:"#865400",tint:"#c79a1b"},data:{wash:"#fbd4d4",ink:"#a42528",tint:"#e5484d"},whiteboard:{wash:"#fbd6e5",ink:"#902552",tint:"#d6409f"},motion:{wash:"#bfeee5",ink:"#006458",tint:"#14a38b"}},bn={page:{wash:"#d6e4ee",ink:"#2c5672",tint:"#4f86ad"}},yn={wash:"#ececec",ink:"#555555",tint:"#8a8a8a"},fe=t=>{const a=la(t)?fn[t]:bn[t]??yn;return{"--oa-tint":a.tint,"--oa-wash":a.wash,"--oa-ink":a.ink}},vn=["whiteboard","data","sheets","motion"],Ee=t=>({display:"block",width:t,height:t,flex:"none"});function jn({size:t=16}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:Ee(t),children:[e.jsx("path",{d:"M15 9V6a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v6a3 3 0 0 0 3 3h3"}),e.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"3"}),e.jsx("circle",{cx:"15",cy:"15",r:"2",fill:"currentColor",stroke:"none"})]})}function Me({type:t,size:a=18}){const o={stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"},n=(()=>{switch(t){case"docs":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 2.25h5.6c.4 0 .78.16 1.06.44l3.65 3.65c.28.28.44.66.44 1.06v7.85A2.75 2.75 0 0 1 14 18H6a2.75 2.75 0 0 1-2.75-2.75V5A2.75 2.75 0 0 1 6 2.25Z",...o}),e.jsx("path",{d:"M12 2.4v2.85a2 2 0 0 0 2 2h2.6",...o})]});case"slides":return e.jsx(e.Fragment,{children:e.jsx("path",{d:"M1.25 2.75h17.5M2.75 2.75v8.75A2.25 2.25 0 0 0 5 13.75h10a2.25 2.25 0 0 0 2.25-2.25V2.75M10 13.75l-3 4M10 13.75l3 4",...o})});case"sheets":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2.25",y:"2.25",width:"15.5",height:"15.5",rx:"3",...o}),e.jsx("path",{d:"M2.25 7.5h15.5M2.25 12.5h15.5M7 2.25v15.5",...o})]});case"design":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M10 2.25c-4.75 0-8.5 3.3-8.5 7.6 0 4.5 3.55 8.150 8.2 8.15 3.1 0 5.55-1.25 5.55-3.4 0-1.25-1.15-1.75-1.15-2.8 0-1.2 1.050-1.6 2.25-2.2 1.3-.65 2.15-1.5 2.15-3C18.5 3.95 14.6 2.25 10 2.25Z",...o}),e.jsx("circle",{cx:"8",cy:"6.6",r:"1.35",fill:"currentColor"}),e.jsx("circle",{cx:"12.4",cy:"6.9",r:"1.35",fill:"currentColor"}),e.jsx("circle",{cx:"5.2",cy:"10.3",r:"1.35",fill:"currentColor"})]});case"design-system":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2.25",y:"2.25",width:"6.75",height:"6.75",rx:"1.75",...o}),e.jsx("circle",{cx:"14.4",cy:"5.6",r:"3.4",...o}),e.jsx("circle",{cx:"5.6",cy:"14.4",r:"3.4",...o}),e.jsx("rect",{x:"11",y:"11",width:"6.75",height:"6.75",rx:"1.75",...o})]});case"data":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M1.75 16.25V11.5c0-.97.78-1.75 1.75-1.750H7V4c0-.97.78-1.75 1.75-1.75h2c.97 0 1.75.78 1.75 1.75v2.25h3.75c.97 0 1.75.78 1.75 1.75v8.25c0 .97-.78 1.75-1.75 1.75H3.5c-.97 0-1.75-.78-1.75-1.75Z",...o}),e.jsx("path",{d:"M7 9.75V18M12.5 6.25V18",...o})]});case"whiteboard":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M11.52 8.25A5 5 0 1 0 8.25 11.52",...o}),e.jsx("rect",{x:"8.25",y:"8.25",width:"10",height:"10",rx:"2.25",...o})]});case"motion":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M3.75 6.6h2M1.5 10H5M3.75 13.4h2",...o}),e.jsx("circle",{cx:"13.75",cy:"10",r:"4.75",...o})]});case"page":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2.25",y:"3.25",width:"15.5",height:"13.5",rx:"2.75",...o}),e.jsx("path",{d:"M2.25 7.25h15.5",...o}),e.jsx("circle",{cx:"5",cy:"5.25",r:".8",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"7.4",cy:"5.25",r:".8",fill:"currentColor",stroke:"none"}),e.jsx("path",{d:"m8 10.25-2 1.75 2 1.75M12 10.25l2 1.75-2 1.75",...o})]});default:return e.jsx("rect",{x:"3",y:"3",width:"14",height:"14",rx:"2",...o})}})();return e.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",style:Ee(a),children:n})}function wn({type:t}){const a=`oa-chalk-${t.replace(/[^\w-]/g,"_")}`,o={fill:"none",stroke:"currentColor",strokeWidth:7,strokeLinecap:"round",strokeLinejoin:"round"},n=(()=>{switch(t){case"docs":return e.jsx("path",{d:"M12 28c5 14 10 27 15 38 7-10 14-21 20-31 4 9 8 19 11 28M84 74c9-10 18-20 27-30 4 11 7 23 11 34 6-8 12-15 20-23",...o});case"slides":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"-14",y:"45",width:"107",height:"72",rx:"11",...o}),e.jsx("rect",{x:"4",y:"66",width:"116",height:"52",rx:"11",...o}),e.jsx("path",{d:"M17 86h55",...o})]});case"sheets":return e.jsx("path",{d:"M9 -6v94M51 -6v94M90 -6v94M-6 23h122M-6 57h122",...o});case"design":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"15",y:"18",width:"106",height:"64",...o}),[[15,18],[121,18],[15,82],[121,82]].map(([s,r])=>e.jsx("rect",{x:s-7,y:r-7,width:"14",height:"14",rx:"2",...o},`${s},${r}`))]});case"design-system":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"20",cy:"22",r:"13",...o}),e.jsx("rect",{x:"98",y:"6",width:"32",height:"26",rx:"6",...o}),e.jsx("rect",{x:"8",y:"66",width:"34",height:"28",rx:"6",...o}),e.jsx("circle",{cx:"118",cy:"76",r:"15",...o})]});case"data":return e.jsx("path",{d:"M38 94v20M70 81v33M101 67v47M132 48v66",...o,strokeWidth:11});case"whiteboard":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"-12",y:"60",width:"46",height:"31",rx:"7",...o}),e.jsx("path",{d:"M36 81c22-3 42-12 62-36 8-10 16-19 25-25M104 25l20-6 2 26",...o})]});case"motion":return e.jsx("path",{d:"M19 44c13-4 26-5 38-4 14 1 23 13 34 15 16 3 33-5 49-4M19 68c13 1 26 3 38 5 16 3 26 13 42 14 15 1 28-6 41-7",...o});default:return e.jsx("path",{d:"M18 30h50M18 52h80M18 74h36",...o})}})();return e.jsxs("svg",{className:"oa-tile-doodle",viewBox:"0 0 140 100",preserveAspectRatio:"xMidYMid slice","aria-hidden":"true",children:[e.jsxs("filter",{id:a,x:"-10%",y:"-10%",width:"120%",height:"120%",children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:"0.9",numOctaves:2,seed:3,result:"noise"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"noise",scale:3,xChannelSelector:"R",yChannelSelector:"G",result:"rough"}),e.jsx("feColorMatrix",{in:"noise",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.4 -0.7",result:"grain"}),e.jsx("feComposite",{in:"rough",in2:"grain",operator:"in"})]}),e.jsx("g",{filter:`url(#${a})`,children:n})]})}function M({d:t,size:a=16,fill:o}){return e.jsx("svg",{viewBox:"0 0 16 16",fill:o?"currentColor":"none",stroke:o?void 0:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:Ee(a),children:typeof t=="string"?e.jsx("path",{d:t}):t})}const S={search:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"7",cy:"7",r:"4.5"}),e.jsx("path",{d:"m10.5 10.5 3 3"})]}),clear:"m4.5 4.5 7 7m0-7-7 7",filter:"M2.5 4.5h11M4.5 8h7M6.5 11.5h3",list:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M5.75 4h7.75M5.75 8h7.75M5.75 12h7.75"}),e.jsx("path",{d:"M2.5 4h.01M2.5 8h.01M2.5 12h.01",strokeWidth:"1.8"})]}),grid:e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2.5",y:"2.5",width:"4.5",height:"4.5",rx:"1"}),e.jsx("rect",{x:"9",y:"2.5",width:"4.5",height:"4.5",rx:"1"}),e.jsx("rect",{x:"2.5",y:"9",width:"4.5",height:"4.5",rx:"1"}),e.jsx("rect",{x:"9",y:"9",width:"4.5",height:"4.5",rx:"1"})]}),plus:"M8 3v10M3 8h10",chat:"M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8.2L5.4 13.8a.3.3 0 0 1-.5-.23V11.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1Z",pin:"M9.75 2.25 13.75 6.25M10.75 3.25 7 6.25 4.5 6.5 9.5 11.5 9.75 9 12.75 5.25M7 9l-4 4",more:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"3.5",cy:"8",r:".6",fill:"currentColor"}),e.jsx("circle",{cx:"8",cy:"8",r:".6",fill:"currentColor"}),e.jsx("circle",{cx:"12.5",cy:"8",r:".6",fill:"currentColor"})]}),rename:"M10.5 3 13 5.5 5.5 13 2.5 13.5 3 10.5 10.5 3Z",link:"M6.75 9.25a2.5 2.5 0 0 0 3.54 0l2.25-2.25a2.5 2.5 0 0 0-3.54-3.54L8.250 4.2M9.25 6.75a2.5 2.5 0 0 0-3.54 0L3.46 9a2.5 2.5 0 0 0 3.54 3.54l.75-.75",share:"M8 2.5v7.5M5 5.25 8 2.5l3 2.75M3.5 8.5v4a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1v-4",importLink:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M5.6 10.4a2.1 2.1 0 0 0 2.97 0l1.9-1.9a2.1 2.1 0 0 0-2.97-2.97l-.65.65M8 8a2.1 2.1 0 0 0-2.97 0l-1.9 1.9a2.1 2.1 0 0 0 2.97 2.97l.65-.65"}),e.jsx("path",{d:"M12.5 1.75v4.5M10.75 4.5l1.75 1.75 1.75-1.75"})]}),trash:"M2.75 4.25h10.5M6.25 4.25V3a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 .75.75v1.25M4 4.25l.6 8.6a1 1 0 0 0 1 .9h4.8a1 1 0 0 0 1-.9l.6-8.6M6.75 7v4M9.25 7v4",info:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"8",cy:"8",r:"6"}),e.jsx("path",{d:"M8 7.5v3.25M8 5.25h.01"})]}),chevron:"m6 3.5 4.5 4.5L6 12.5",tick:"m3 8.5 3.25 3.25L13 4.75",globe:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"8",cy:"8",r:"5.75"}),e.jsx("path",{d:"M2.25 8h11.5M8 2.25c1.6 1.6 2.4 3.5 2.4 5.75S9.6 12.15 8 13.75C6.4 12.15 5.6 10.25 5.6 8S6.4 3.85 8 2.25Z"})]}),people:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"6",cy:"5.5",r:"2.25"}),e.jsx("path",{d:"M2 13c0-2.2 1.8-3.75 4-3.75S10 10.8 10 13M10.5 3.5a2.25 2.25 0 0 1 0 4M12 9.5c1.3.45 2.25 1.75 2.25 3.5"})]}),gear:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12.72 6.69 14.33 7.04 14.33 8.96 12.72 9.31 12.26 10.42 13.16 11.79 11.79 13.16 10.42 12.26 9.31 12.72 8.96 14.33 7.04 14.33 6.69 12.72 5.58 12.26 4.21 13.16 2.84 11.79 3.74 10.42 3.28 9.31 1.67 8.96 1.67 7.04 3.28 6.69 3.74 5.58 2.84 4.21 4.21 2.84 5.58 3.74 6.69 3.28 7.04 1.67 8.96 1.67 9.31 3.28 10.42 3.74 11.79 2.84 13.16 4.21 12.26 5.58Z"}),e.jsx("circle",{cx:"8",cy:"8",r:"2"})]}),model:"M7 2.5 8.25 5.75 11.5 7 8.25 8.25 7 11.5 5.75 8.25 2.5 7 5.75 5.75 7 2.5ZM12.25 10v3.5M10.5 11.75H14",shield:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M8 1.75 13.25 3.75V7.5c0 3.1-2.2 5.6-5.25 6.75C4.95 13.1 2.75 10.6 2.75 7.5V3.75L8 1.75Z"}),e.jsx("path",{d:"m5.75 7.75 1.5 1.5 3-3"})]}),usage:"M2.5 13.5h11M4.5 11V8.5M8 11V4M11.5 11V6.5",types:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M8 1.75 13.75 4.9v6.2L8 14.25 2.25 11.1V4.9L8 1.75Z"}),e.jsx("path",{d:"M2.25 4.9 8 8.05l5.75-3.15M8 8.05v6.2"})]}),refresh:"M13.25 8a5.25 5.25 0 1 1-1.54-3.71M13.25 2.5v3h-3",download:"M8 2.5v7.5M5 7.25l3 3 3-3M3 13.25h10",key:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"5.25",cy:"10.75",r:"2.75"}),e.jsx("path",{d:"m7.2 8.8 6.05-6.05M10.75 5.25l1.75 1.75M12.25 3.75 14 5.5"})]}),external:"M9.5 2.5h4v4M13.5 2.5l-6 6M12 9.5v3a1 1 0 0 1-1 1H3.5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h3"};function kn({type:t,title:a}){const o=e.jsx("div",{className:"oa-paper-title",children:a});switch(t){case"slides":return e.jsxs("div",{className:"oa-slide",children:[o,e.jsx("div",{className:"oa-line"})]});case"motion":return e.jsxs("div",{className:"oa-film",children:[e.jsx("div",{className:"oa-film-title",children:a}),e.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",style:Ee(22),children:e.jsx("path",{d:"M7 5.5v9l7.5-4.5L7 5.5Z",fill:"currentColor"})}),e.jsx("div",{className:"oa-film-bar"})]});case"whiteboard":return e.jsxs("div",{className:"oa-paper",children:[o,e.jsxs("svg",{className:"oa-flow",viewBox:"0 0 120 36","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"3",width:"30",height:"15",rx:"3"}),e.jsx("rect",{x:"45",y:"3",width:"30",height:"15",rx:"3"}),e.jsx("rect",{x:"89",y:"19",width:"30",height:"15",rx:"3"}),e.jsx("path",{d:"M31 10.5h14M75 10.5h12a3 3 0 0 1 3 3v5.5"})]})]});case"sheets":return e.jsxs("div",{className:"oa-paper",children:[o,e.jsxs("svg",{className:"oa-cells",viewBox:"0 0 120 48","aria-hidden":"true",children:[e.jsx("rect",{className:"oa-cells-head",x:".5",y:".5",width:"119",height:"9.5"}),e.jsx("rect",{className:"oa-cells-pick",x:"40",y:"19.5",width:"40",height:"9.5"}),e.jsx("path",{d:"M.5 .5h119v47H.5ZM.5 10h119M.5 19.5h119M.5 29h119M.5 38.5h119M40 .5v47M80 .5v47"})]})]});case"design":return e.jsxs("div",{className:"oa-paper",children:[o,e.jsxs("div",{className:"oa-boards",children:[e.jsx("div",{className:"oa-board"}),e.jsx("div",{className:"oa-board"})]})]});case"design-system":return e.jsxs("div",{className:"oa-paper",children:[o,e.jsxs("div",{className:"oa-swatches",children:[e.jsx("span",{className:"oa-swatch"}),e.jsx("span",{className:"oa-swatch"}),e.jsx("span",{className:"oa-swatch"}),e.jsx("span",{className:"oa-swatch"})]}),e.jsx("div",{className:"oa-specimen",children:"Aa"})]});case"data":return e.jsxs("div",{className:"oa-paper",children:[o,e.jsxs("div",{className:"oa-kpis",children:[e.jsx("span",{className:"oa-kpi"}),e.jsx("span",{className:"oa-kpi"}),e.jsx("span",{className:"oa-kpi"})]}),e.jsx("div",{className:"oa-bars",children:[45,70,55,90,65,80].map((n,s)=>e.jsx("span",{className:"oa-bar",style:{height:`${n}%`}},s))})]});default:return e.jsxs("div",{className:"oa-paper",children:[o,[92,100,84,96,70].map((n,s)=>e.jsx("div",{className:"oa-line",style:{width:`${n}%`}},s))]})}}const ca="open-artifacts.view";function Nn(t,a,o){try{const n=new URL(t);return n.searchParams.set(a,o),n.href}catch{return t}}function Sn(t){try{return t?.getItem(ca)==="list"?"list":"grid"}catch{return"grid"}}function Cn({api:t,host:a,t:o,eventDelayMs:n=300}){let s=0,r=null;const i=new Set;let c=null,u=!1,g="";return qa()((l,p)=>{const y=(d,f)=>l({artifacts:p().artifacts.map(N=>N.id===d?{...N,...f}:N)}),j=d=>p().showToast(o("action.failed",{message:d.message}),"error"),b=d=>d.openable?!0:(p().showToast(o("open.typeMissing",{type:d.typeTitle||d.type}),"error"),!1),m=()=>{const d=a.capture;if(u||c===null||d===void 0)return;const f=c.signal;u=!0,(async()=>{try{for(;;){if(f.aborted||!a.visible())return;const N=p().artifacts.find(w=>!w.picked&&w.thumbnail!==w.updatedAt&&w.openable&&!i.has(`${w.id}\0${w.updatedAt}`));if(N===void 0)return;i.add(`${N.id}\0${N.updatedAt}`);try{const w=await t.preview(N.id);if(typeof w!="string")throw new Error("no address");const E=await d(w,N.type,f),v=await t.saveThumbnail(N.id,N.updatedAt,E);y(N.id,{thumbnail:v??N.updatedAt})}catch(w){f.aborted||console.warn(`Open Artifacts page: no thumbnail for ${N.root}:`,w)}}}finally{u=!1}})()};return{status:"loading",artifacts:[],types:[],error:"",opening:null,toast:null,filters:ze,query:"",layout:Sn(a.storage),menuFor:null,dialog:null,importDialog:null,importing:!1,live:!1,searchFocus:0,settings:null,changes:0,reload(){return r||(p().artifacts.length===0&&l({status:"loading"}),r=(async()=>{try{const{artifacts:d,types:f}=await t.list();l({status:"ready",artifacts:d,types:f,error:""}),m()}catch(d){l({status:"error",error:d.message})}})().finally(()=>{r=null}),r)},setFilters:d=>l({filters:{...p().filters,...d}}),clearFilters:()=>l({filters:{...ze,sort:p().filters.sort}}),setQuery:d=>l({query:d}),focusSearch:()=>l({searchFocus:p().searchFocus+1}),setLayout(d){l({layout:d});try{a.storage?.setItem(ca,d)}catch{}},setMenuFor:d=>l({menuFor:d}),openDialog:d=>l({dialog:d,menuFor:null}),closeDialog:()=>l({dialog:null}),showToast:(d,f="info",N)=>l({toast:{id:++s,message:d,kind:f,...N?{undo:N}:{}}}),dismissToast:()=>l({toast:null}),async open(d,f){if(p().opening!==null||!b(d))return;const N=a.away(),w=N?a.pendingWindow():null;if(N&&w===null)return p().showToast(o("open.blocked"),"error");l({opening:d.id,toast:null});try{const E=await t.open(d.id),v=f?{...E,url:Nn(E.url,"panel",f)}:E,{sessionGone:C}=await a.show({...v,sessionId:v.sessionId||d.sessionId},w);l({opening:null}),C&&(v.sessionId||d.sessionId)&&p().showToast(o("open.noSession")),p().reload()}catch(E){w?.close(),l({opening:null}),p().showToast(o("open.failed",{message:E.message}),"error")}},share:d=>p().open(d,"share"),create(d){if(a.canCreate()){if(d===void 0)return a.create();a.create({id:d,title:p().types.find(f=>f.id===d)?.title||d})}},async pin(d,f){if(b(d)){y(d.id,{pinned:f});try{await t.update(d.id,{pinned:f})}catch(N){y(d.id,{pinned:d.pinned}),j(N)}}},async rename(d,f){const N=f.trim();if(!(!N||N===d.title||!b(d))){y(d.id,{title:N});try{const w=await t.update(d.id,{title:N});w&&typeof w.id=="string"&&w.id&&y(d.id,w)}catch(w){y(d.id,{title:d.title}),j(w)}}},async copyLink(d){if(b(d)){if(a.away())return p().showToast(o("toast.copyRemote"));try{await a.copy(d.viewUrl),p().showToast(o("toast.copied"))}catch(f){j(f)}}},async remove(d){try{const{trash:f,path:N}=await t.remove(d.id);l({artifacts:p().artifacts.filter(w=>w.id!==d.id),dialog:null}),p().showToast(o(N?"toast.removed":"toast.deleted",{title:d.title}),"info",f)}catch(f){j(f)}},async undo(d){l({toast:null});try{await t.restore(d),await p().reload()}catch(f){j(f)}},watchEvents(){let d;const f=t.events(()=>{l({changes:p().changes+1,...p().live?{}:{live:!0}}),clearTimeout(d),d=setTimeout(()=>{p().reload()},n)},()=>l({live:!1}));return()=>{clearTimeout(d),f?.(),l({live:!1})}},openSettings:d=>l({settings:d??"",menuFor:null,dialog:null,importDialog:null}),closeSettings:()=>l({settings:null}),openImport(d){typeof t.importLink=="function"&&l({importDialog:{link:p().importing?g:d??"",error:""},menuFor:null,dialog:null})},setImportLink(d){p().importDialog!==null&&l({importDialog:{link:d,error:""}})},closeImport:()=>l({importDialog:null}),async importLink(){const d=Se(p().importDialog?.link);if(p().importing||d===null||typeof t.importLink!="function"||p().importDialog?.done)return;g=d,l({importing:!0,importDialog:{...p().importDialog,error:""}});let f;try{f=await t.importLink(d)}catch(C){const R=mn(C,o,d),k=p().importDialog;l({importing:!1,...k!==null?{importDialog:{...k,error:R}}:{}}),k===null&&p().showToast(R,"error");return}const{notes:N=[],...w}=f,E=p().importDialog;if(N.length&&E!==null){l({importing:!1,importDialog:{link:E.link,error:"",done:{artifact:w,notes:N}}}),await p().reload();return}l({importing:!1,importDialog:null}),await p().reload();const v=p().artifacts.find(C=>C.id===w.id)??w;await p().open(v),p().toast===null&&p().showToast(N.length?o("importLink.doneNotesToast",{title:v.title,notes:N.join(" ")}):o("importLink.done",{title:v.title}))},async openImported(){const d=p().importDialog?.done;d!==void 0&&(l({importDialog:null}),await p().open(p().artifacts.find(f=>f.id===d.artifact.id)??d.artifact))},watchThumbnails(){const d=new AbortController;return c=d,m(),()=>{d.abort(new Error("the page closed")),c===d&&(c=null)}}}})}const da=h.createContext(null);function Tn({store:t,children:a}){return h.createElement(da.Provider,{value:t},a)}function O(t){const a=h.useContext(da);if(a===null)throw new Error("usePage needs a StoreProvider");return Va(a,t)}function En(t,a,o){return t.filter(n=>!ee(n.version,o)&&(a===""||ee(n.version,a))).sort((n,s)=>ee(n.version,s.version)?-1:ee(s.version,n.version)?1:0)}const Mn=/`([^`]+)`|\*\*([^*]+)\*\*|\[([^\]]+)\]\(([^)\s]+)\)/g;function Ln(t){const a=[];let o=0;for(const n of t.matchAll(Mn))n.index>o&&a.push({kind:"text",text:t.slice(o,n.index)}),n[1]!==void 0?a.push({kind:"code",text:n[1]}):n[2]!==void 0?a.push({kind:"strong",text:n[2]}):/^https?:\/\//i.test(n[4])?a.push({kind:"link",text:n[3],href:n[4]}):a.push({kind:"text",text:n[3]}),o=n.index+n[0].length;return o<t.length&&a.push({kind:"text",text:t.slice(o)}),a}const pa="open-artifacts.changelog.seen";function An(){try{return localStorage.getItem(pa)}catch{return null}}let oe={version:"",releases:[],upcoming:[],upcomingFor:"",seen:An(),open:!1};const rt=new Set;function pe(t){oe={...oe,...t};for(const a of[...rt])a()}const On=t=>(rt.add(t),()=>{rt.delete(t)}),Pn=()=>oe;async function Xe(t){const a=await t(!1);if(a===null)return;const o=oe.upcoming.filter(n=>ee(n.version,a.version));pe({version:a.version,releases:a.releases,upcoming:o})}async function ua(t,a){if(t===""||t===oe.upcomingFor)return;pe({upcomingFor:t});const o=await a(!0);if(o===null||oe.upcomingFor!==t){oe.upcomingFor===t&&pe({upcomingFor:""});return}pe({version:o.version,releases:o.releases,upcoming:o.upcoming})}function Dn({version:t,releases:a,seen:o}){return t===""||o===t?[]:o===null?a.filter(n=>n.version===t):ee(o,t)?[]:En(a,o,t)}function Fn(){const{version:t}=oe;if(t!==""){try{localStorage.setItem(pa,t)}catch{}pe({seen:t})}}const Le=()=>pe({open:!0}),ha=()=>pe({open:!1}),be=()=>h.useSyncExternalStore(On,Pn);function Ut({text:t}){return e.jsx(e.Fragment,{children:Ln(t).map((a,o)=>a.kind==="code"?e.jsx("code",{children:a.text},o):a.kind==="strong"?e.jsx("strong",{children:a.text},o):a.kind==="link"?e.jsx("a",{href:a.href,target:"_blank",rel:"noopener noreferrer",children:a.text},o):e.jsx("span",{children:a.text},o))})}const In=(t,a)=>{const o=`changelog.section.${a.toLowerCase()}`;return ut(o)?t(o):a},et=4;function ht({releases:t,headings:a,fold:o=!1,tag:n}){const{t:s}=W(),[r,i]=h.useState(!o),c=t.reduce((g,l)=>g+l.sections.reduce((p,y)=>p+y.items.length,0),0);let u=r?1/0:et;return e.jsxs("div",{className:"oa-notes",children:[t.map(g=>u<=0?null:e.jsxs("article",{className:"oa-release","data-version":g.version,children:[a&&e.jsxs("h3",{className:"oa-release-head",children:[e.jsx("span",{className:"oa-release-version",children:g.version}),g.date&&e.jsx("span",{className:"oa-release-date",children:g.date}),n?.(g)]}),g.summary.map((l,p)=>e.jsx("p",{className:"oa-release-summary",children:e.jsx(Ut,{text:l})},p)),g.sections.map(l=>{if(u<=0||l.items.length===0)return null;const p=l.items.slice(0,u);return u-=p.length,e.jsxs("section",{className:"oa-release-section",children:[e.jsx("h4",{children:In(s,l.title)}),e.jsx("ul",{children:p.map((y,j)=>e.jsx("li",{children:e.jsx(Ut,{text:y})},j))})]},l.title)})]},g.version)),!r&&c>et&&e.jsx("button",{type:"button",className:"oau-show",onClick:()=>i(!0),children:s("changelog.more",{count:String(c-et)})})]})}function Rn(){const{phase:t}=me(),{changelog:a}=W();h.useEffect(()=>{a&&Xe(a)},[a]),h.useEffect(()=>{if(t!=="done"||!a)return;Xe(a);const o=setTimeout(()=>{Xe(a)},5e3);return()=>clearTimeout(o)},[t,a])}function zn(){const{t}=W();Rn();const a=be(),o=Dn(a);return o.length===0?null:e.jsxs("section",{className:"oau-panel oa-news",role:"status","aria-label":t("changelog.new",{version:a.version}),"data-testid":"open-artifacts-whats-new",children:[e.jsxs("div",{className:"oau-head",children:[e.jsx("div",{className:"oau-head-text",children:e.jsx("div",{className:"oau-title",children:t("changelog.new",{version:a.version})})}),e.jsxs("div",{className:"oau-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:Le,children:t("changelog.all")}),e.jsx("button",{type:"button",className:"oa-btn","data-primary":"true",onClick:Fn,children:t("changelog.gotIt")})]})]}),e.jsx(ht,{releases:o,headings:o.length>1,fold:!0})]})}function Un(){const{t,changelog:a}=W(),o=$e(me().updates),{upcoming:n}=be();return h.useEffect(()=>{a&&ua(o,a)},[o,a]),n.length===0?null:e.jsxs("div",{className:"oa-news-upcoming",children:[e.jsx(ht,{releases:n,headings:n.length>1,fold:!0}),e.jsx("button",{type:"button",className:"oau-show",onClick:Le,children:t("changelog.all")})]})}function $n(){const{t}=W(),{version:a}=be(),{updates:o,offer:n}=me();if(a==="")return null;const s=$e(o),r=s!==""&&ee(s,a),i=r?`${t("changelog.version",{version:a})} · ${n.t("available",{version:s})}`:t("changelog.version",{version:a});return e.jsxs("button",{type:"button",className:"oa-version",title:`${i} · ${t("changelog.title")}`,"aria-label":i,"data-update":r,onClick:Le,"data-testid":"open-artifacts-version",children:["v",a,r&&e.jsx("span",{className:"oa-version-dot","aria-hidden":"true"})]})}function _n(){const{t}=W(),{version:a}=be();return a===""?null:e.jsxs("footer",{className:"oa-foot",children:[e.jsx("span",{children:t("changelog.version",{version:a})}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("button",{type:"button",className:"oau-show",onClick:Le,"data-testid":"open-artifacts-changelog",children:t("changelog.title")})]})}function Hn(){const{t,changelog:a}=W(),{version:o,releases:n,upcoming:s}=be(),r=$e(me().updates);h.useEffect(()=>{a&&ua(r,a)},[r,a]);const i=c=>c.version===o?e.jsx("span",{className:"oau-tag","data-tone":"neutral",children:t("changelog.installed")}):s.includes(c)?e.jsx("span",{className:"oau-tag",children:t("changelog.available")}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"oa-dialog-head",children:e.jsx("h2",{children:t("changelog.title")})}),e.jsx("div",{className:"oa-changelog",children:s.length+n.length===0?e.jsx("p",{children:t("changelog.none")}):e.jsx(ht,{releases:[...s,...n],headings:!0,tag:i})}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("a",{className:"oa-btn oa-btn-link",href:"https://github.com/openartifactsai/open-artifacts/releases",target:"_blank",rel:"noopener noreferrer",children:t("changelog.releases")}),e.jsx("button",{type:"button",className:"oa-btn","data-primary":"true",autoFocus:!0,onClick:ha,children:t("dialog.close")})]})]})}function he({primary:t,onClick:a,children:o,label:n,disabled:s}){return e.jsx("button",{type:"button",className:"oa-btn",...t?{"data-primary":"true"}:{},...n?{"aria-label":n}:{},disabled:s,onClick:a,children:o})}function Bn(){const{phase:t,updates:a,to:o,restart:n,failure:s,dismissed:r,offer:i}=me(),{t:c,start:u,later:g,close:l,reopen:p}=i,y=$e(a);if(t==="idle"&&y==="")return null;if(t==="idle"&&y===r)return e.jsxs("div",{className:"oau-line","data-testid":"open-artifacts-update-line",children:[e.jsx("span",{children:c("available",{version:y})}),e.jsx("button",{type:"button",className:"oau-show",onClick:p,children:c("show")})]});let j,b=null,m=null;return t==="running"?j=c("busy"):t==="done"?(j=c("done",{version:o}),b=c(n?"done.restart":"done.session"),m=e.jsxs(e.Fragment,{children:[e.jsx(he,{onClick:l,children:c("close")}),n&&i.restart&&e.jsx(he,{primary:!0,onClick:()=>i.restart?.(),children:c("restart")})]})):t==="failed"&&s?(j=c("failed"),b=`${s.message} ${c(s.left==="unknown"?"failed.unknown":"failed.kept")}`,m=e.jsxs(e.Fragment,{children:[e.jsx(he,{onClick:l,children:c("close")}),a.length>0&&e.jsx(he,{primary:!0,onClick:u,children:c("retry")})]})):(j=c("available",{version:y}),b=c("current",{version:a[0]?.version??""}),m=e.jsxs(e.Fragment,{children:[e.jsx(he,{onClick:g,children:c("later")}),e.jsx(he,{primary:!0,onClick:u,label:c("update.one",{version:y}),children:c("update")})]})),e.jsxs("section",{className:"oau-panel",role:t==="failed"?"alert":"status","data-testid":"open-artifacts-update","data-phase":t,children:[e.jsxs("div",{className:"oau-head",children:[e.jsxs("div",{className:"oau-head-text",children:[e.jsx("div",{className:"oau-title",children:j}),b!==null&&e.jsx("div",{className:"oau-text",children:b})]}),m!==null&&e.jsx("div",{className:"oau-actions",children:m})]}),t==="idle"&&e.jsx(Un,{})]})}function Z({title:t,action:a,children:o,className:n,...s}){return e.jsxs("section",{className:n?`oa-set-group ${n}`:"oa-set-group",...s,children:[(t||a)&&e.jsxs("div",{className:"oa-set-group-head",children:[t&&e.jsx("h3",{children:t}),a&&e.jsx("div",{className:"oa-set-group-action",children:a})]}),e.jsx("div",{className:"oa-set-card",children:o})]})}function D({label:t,hint:a,detail:o,labelFor:n,labelId:s,children:r,className:i,...c}){return e.jsxs("div",{className:i?`oa-set-row ${i}`:"oa-set-row",...c,children:[(t||a||o)&&e.jsxs("div",{className:"oa-set-row-text",children:[t&&(n?e.jsx("label",{className:"oa-set-label",htmlFor:n,id:s,children:t}):e.jsx("span",{className:"oa-set-label",id:s,children:t})),a&&e.jsx("span",{className:"oa-set-hint",children:a}),o]}),r!=null&&r!==!1&&e.jsx("div",{className:"oa-set-row-control",children:r})]})}function ga({checked:t,onChange:a,className:o,...n}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,className:o?`oa-set-switch ${o}`:"oa-set-switch",onClick:()=>a(!t),...n,children:e.jsx("span",{"aria-hidden":"true"})})}function it({value:t,options:a,onChange:o,disabled:n,className:s,...r}){return e.jsx("div",{role:"radiogroup",className:s?`oa-set-segmented ${s}`:"oa-set-segmented",...r,children:a.map(i=>e.jsx("button",{type:"button",role:"radio","aria-checked":i.value===t,"data-value":i.value,disabled:n||i.disabled,onClick:()=>i.value!==t&&o(i.value),children:i.label},i.value))})}function Ce({options:t,onChange:a,children:o,className:n,...s}){return e.jsxs("select",{className:n?`oa-set-select ${n}`:"oa-set-select",onChange:r=>a(r.target.value),...s,children:[t?.map(r=>e.jsx("option",{value:r.value,disabled:r.disabled,children:typeof r.label=="string"?r.label:String(r.value)},r.value)),o]})}function A({variant:t="default",className:a,type:o="button",...n}){return e.jsx("button",{type:o,className:a?`oa-set-btn ${a}`:"oa-set-btn","data-variant":t,...n})}function L({tone:t="info",className:a,children:o,...n}){return e.jsx("p",{className:a?`oa-set-note ${a}`:"oa-set-note","data-tone":t,...t==="danger"?{role:"alert"}:{},...n,children:o})}const _=t=>t instanceof Error?t.message:String(t);function I(){const{settings:t,t:a}=W();if(!t)throw new Error("the settings view needs PageEnv.settings");return{api:t,t:a,lang:a("time.locale")}}function ne(t,a,o=""){const{api:n}=I(),s=O(y=>y.changes),[r,i]=h.useState({data:null,error:"",loading:!0}),[c,u]=h.useState(0),g=h.useRef(0),l=h.useRef(a);l.current=a,h.useEffect(()=>{const y=++g.current;i(j=>({...j,loading:!0})),n.call(t,l.current).then(j=>y===g.current&&i({data:j,error:"",loading:!1}),j=>y===g.current&&i(b=>({...b,error:_(j),loading:!1})))},[n,t,o,s,c]);const p=h.useCallback(()=>u(y=>y+1),[]);return{...r,again:p}}function Ae({t}){return e.jsxs("p",{className:"oa-set-loading",role:"status",children:[e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),t("loading")]})}function xa(t,a,o,n=Date.now()){const s=t?Date.parse(t):NaN;if(!Number.isFinite(s))return"";const r=Math.max(0,(n-s)/1e3);if(r<60)return o("whenJustNow");let i;try{i=new Intl.RelativeTimeFormat(a,{numeric:"auto"})}catch{i=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}return r<3600?i.format(-Math.round(r/60),"minute"):r<86400?i.format(-Math.round(r/3600),"hour"):r<86400*30?i.format(-Math.round(r/86400),"day"):new Date(s).toLocaleDateString(a)}function Q({tone:t="neutral",children:a,title:o}){return e.jsx("span",{className:"oa-set-tag","data-tone":t,title:o,children:a})}function $t(t,a,o){const n=URL.createObjectURL(new Blob([t],{type:o})),s=document.createElement("a");s.href=n,s.download=a,document.body.append(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function _t({text:t,t:a,testId:o}){const[n,s]=h.useState(!1);return h.useEffect(()=>{if(!n)return;const r=setTimeout(()=>s(!1),1500);return()=>clearTimeout(r)},[n]),e.jsxs("div",{className:"oa-set-copy","data-testid":o,children:[e.jsx("code",{children:t}),e.jsx("button",{type:"button",className:"oa-set-btn","data-variant":"quiet",onClick:()=>{navigator.clipboard?.writeText(t).then(()=>s(!0),()=>{})},children:a(n?"copied":"copy")})]})}function Kn(){const{updates:t,phase:a,to:o,restart:n,failure:s,offer:r}=me();return!t.length&&a==="idle"?null:e.jsxs(Z,{title:r.t("update"),"data-testid":"settings-update-offer",children:[t.map(i=>e.jsx(D,{label:r.t("available",{version:i.latest}),hint:r.t("current",{version:i.version}),children:e.jsxs(A,{variant:"primary",disabled:a==="running",onClick:()=>r.start(),children:[a==="running"&&e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),a==="running"?r.t("busy"):r.t("update")]})},i.name)),a==="done"&&e.jsx(D,{detail:e.jsxs(L,{tone:"success",role:"status",children:[r.t("done",{version:o})," ",r.t(n?"done.restart":"done.session")]}),children:n&&r.restart&&e.jsx(A,{variant:"primary",onClick:()=>r.restart?.(),children:r.t("restart")})}),a==="failed"&&s&&e.jsx(D,{detail:e.jsxs(L,{tone:"danger",children:[r.t("failed"),": ",s.message," ",r.t(s.left==="unknown"?"failed.unknown":"failed.kept")]}),children:e.jsx(A,{onClick:()=>r.start(),children:r.t("retry")})})]})}function Wn(t,a){const o=t.policy.update,n=t.check?.available??"";return t.pending?{tone:"info",text:a("versionPending",{version:t.pending})}:n&&o!=="off"&&o!=="bundled"?{tone:"info",text:a("updateAvailable",{version:n})}:o==="off"?{tone:"info",text:a("versionPolicyOff")}:o==="bundled"?{tone:"info",text:a("versionPolicyBundled")}:t.check?.error?{tone:"danger",text:t.check.error}:t.check?{tone:"success",text:a("versionUpToDate")}:null}function qn(){const{api:t,t:a,lang:o}=I(),{changelog:n}=W(),s=ne("runtime.status"),[r,i]=h.useState(null),[c,u]=h.useState(!1),[g,l]=h.useState("");h.useEffect(()=>i(null),[s.data]);const p=r??s.data,y=p?.policy.update,j=async()=>{u(!0),l("");try{i(await t.call("runtime.check",{body:{}})),s.again()}catch(m){l(_(m))}u(!1)},b=p?Wn(p,a):null;return e.jsxs("div",{className:"oa-set-stack",children:[e.jsx(Kn,{}),e.jsxs(Z,{title:a("versionHeading"),"data-testid":"runtime-version",children:[p?e.jsx(D,{label:e.jsxs(e.Fragment,{children:[a("versionRunning")," ",e.jsxs("code",{className:"oa-set-code",children:["v",p.running??"—"]})]}),detail:e.jsxs(e.Fragment,{children:[b&&e.jsx(L,{tone:b.tone,"data-runtime-standing":"",children:b.text}),p.check?.at&&e.jsx("span",{className:"oa-set-hint",children:a("versionChecked",{when:xa(p.check.at,o,a)})}),g&&e.jsx(L,{tone:"danger",children:g})]}),children:e.jsxs(A,{disabled:c||y==="off"||y==="bundled","data-runtime-check":"",onClick:()=>{j()},children:[c?e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}):e.jsx(M,{d:S.refresh,size:12}),a(c?"versionChecking":"versionCheck")]})}):s.error?e.jsx(D,{detail:e.jsx(L,{tone:"danger",children:s.error})}):e.jsx(D,{detail:e.jsx(Ae,{t:a})}),n&&e.jsx(D,{label:a("changelog.all"),children:e.jsx(A,{onClick:Le,children:a("aboutShowChangelog")})})]})]})}function Vn({models:t,grants:a,titles:o,reload:n}){const{api:s,t:r}=I(),[i,c]=h.useState(""),[u,g]=h.useState(!1),l=Ya(a.grants),p=Za(a.grants,o),y=Ja(t),j=Qa(t,r,{broad:!0}),b=async d=>{if(!(!d||u)){g(!0),c("");try{await s.call("grants.revoke",{body:d}),n()}catch(f){c(r("usageCouldNotChange",{error:_(f)}))}g(!1)}},m=l.on?r("modelsAlwaysOn",{source:Lt(l.provider,t)}):y?r("modelsAlwaysOff"):`${r("modelsAlwaysOff")} ${r("modelsAlwaysNeedsSource")}`;return e.jsxs(e.Fragment,{children:[e.jsxs(Z,{title:r("modelsPermissions"),children:[e.jsx(D,{"data-always-allow":l.on?"on":"off",label:r("modelsAlwaysAllow"),labelId:"oa-set-always-label",hint:m,children:e.jsx(ga,{checked:l.on,disabled:u||!l.on&&!y,"aria-labelledby":"oa-set-always-label",onChange:d=>{b(eo(d,y))}})}),l.on&&j.length>1&&e.jsx(D,{label:r("modelsAlwaysSource"),labelFor:"oa-set-always-source",children:e.jsxs(Ce,{id:"oa-set-always-source",value:j.some(d=>d.value===l.provider)?l.provider:"",disabled:u,onChange:d=>d&&void b({scope:"all",provider:d}),children:[!j.some(d=>d.value===l.provider)&&e.jsx("option",{value:"",disabled:!0}),j.map(d=>e.jsx("option",{value:d.value,disabled:d.disabled,children:d.label},d.value))]})}),i&&e.jsx(D,{detail:e.jsx(L,{tone:"danger",children:i})})]}),e.jsx(Z,{title:r("modelsTypeAllowances"),children:p.length?p.map(d=>e.jsx(D,{"data-type-allowance":d.typeId,label:r("modelsTypeAllowed",{type:d.title}),hint:Lt(d.provider,t),children:e.jsx(A,{variant:"danger",disabled:u,onClick:()=>{b({scope:"type",typeId:d.typeId})},children:r("modelsRemove")})},d.typeId)):e.jsx(D,{hint:r("modelsNoTypeAllowances")})})]})}const Ht=t=>({perArtifactPerHour:String(t.limits.perArtifactPerHour),maxOutputTokens:String(t.limits.maxOutputTokens)});function Gn({models:t,reload:a}){const{api:o,t:n}=I(),s=Ht(t),[r,i]=h.useState(s),[c,u]=h.useState("idle"),[g,l]=h.useState("");h.useEffect(()=>i(Ht(t)),[t.limits.perArtifactPerHour,t.limits.maxOutputTokens]);const p=Xa(r),y="problem"in p?p.problem:null,j=r.perArtifactPerHour!==s.perArtifactPerHour||r.maxOutputTokens!==s.maxOutputTokens,b=async()=>{if("request"in p){u("saving"),l("");try{await o.call("models.set",{body:p.request}),u("saved"),a()}catch(d){u("idle"),l(n("usageCouldNotChange",{error:_(d)}))}}},m=(d,f,N,w)=>{const E=y===d,v=`oa-set-limit-${d}`;return e.jsx(D,{label:f,labelFor:v,hint:E?void 0:N,detail:E&&e.jsx(L,{tone:"danger",children:n(d==="perArtifactPerHour"?"modelsPerHourBad":"modelsMaxOutputBad")}),children:e.jsx("input",{id:v,type:"number",inputMode:"numeric",min:w,step:1,"data-limit":d,className:"oa-set-input oa-set-number",value:r[d],"aria-invalid":E||void 0,onChange:C=>{u("idle"),i({...r,[d]:C.target.value})},onKeyDown:C=>{C.key==="Enter"&&j&&!y&&b()}})})};return e.jsxs(Z,{title:n("modelsLimits"),action:e.jsxs(e.Fragment,{children:[c==="saved"&&e.jsx(L,{tone:"success",role:"status",children:n("modelsSaved")}),e.jsx(A,{variant:"primary",disabled:!j||!!y||c==="saving",onClick:()=>{b()},children:n("modelsSaveLimits")})]}),children:[m("perArtifactPerHour",n("modelsPerHour"),n("modelsPerHourHint"),0),m("maxOutputTokens",n("modelsMaxOutput"),null,1),g&&e.jsx(D,{detail:e.jsx(L,{tone:"danger",children:g})})]})}function Yn(){const{t}=I(),a=ne("models.list"),o=ne("grants.list"),n=ne("types"),s=h.useMemo(()=>new Map((n.data?.types??[]).map(c=>[c.id,Ga(c.title,c.id)])),[n.data]),r=()=>{a.again(),o.again()},i=a.error||o.error;return!a.data||!o.data?i?e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:i})}):e.jsx(Ae,{t}):e.jsxs("div",{className:"oa-set-stack",children:[i&&e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:i})}),e.jsx(Vn,{models:a.data,grants:o.data,titles:s,reload:r}),e.jsx(Gn,{models:a.data,reload:r})]})}function se({label:t,onClose:a,children:o,wide:n=!1,testId:s}){return e.jsx("div",{className:"oa-scrim",onPointerDown:r=>{r.target===r.currentTarget&&a()},onKeyDown:r=>{r.key==="Escape"&&(r.stopPropagation(),a())},children:e.jsx("div",{className:"oa-dialog",role:"dialog","aria-modal":"true","aria-label":t,"data-testid":s,...n?{"data-wide":"true"}:{},children:o})})}const Zn=200;function ma({value:t,onChange:a,label:o,models:n,defaultLabel:s,loading:r,error:i,onRefresh:c,name:u}){const[g,l]=h.useState(!1),p=h.useRef(null),y=t?n.find(b=>b.id===t):void 0,j=t?y?.label??t:s??"";return h.useEffect(()=>{if(!g)return;const b=m=>{p.current?.contains(m.target)||l(!1)};return document.addEventListener("pointerdown",b,!0),()=>document.removeEventListener("pointerdown",b,!0)},[g]),e.jsxs("div",{className:"oa-set-picker",ref:p,children:[e.jsxs("button",{type:"button",className:"oa-set-picker-field","aria-label":`${o}: ${j}`,"aria-expanded":g,"data-model-picker":u,"data-value":t,onClick:()=>l(b=>!b),children:[e.jsx("span",{className:"oa-set-picker-text","data-empty":!t,children:j}),y?.label&&e.jsx("span",{className:"oa-set-picker-id",children:t}),e.jsx("span",{className:"oa-set-picker-chev","aria-hidden":"true",children:e.jsx(M,{d:S.chevron,size:12})})]}),g&&e.jsx(Jn,{label:o,value:t,models:n,defaultLabel:s,loading:r,error:i,onRefresh:c,onClose:()=>l(!1),onPick:b=>{a(b),l(!1)}})]})}function Jn({label:t,value:a,models:o,defaultLabel:n,loading:s,error:r,onRefresh:i,onClose:c,onPick:u}){const{t:g,lang:l}=I(),p=h.useId(),[y,j]=h.useState(""),b=h.useRef(null),m=h.useRef(null),d=h.useMemo(()=>to(o,y,{allowDefault:n!==void 0}).slice(0,Zn),[o,y,n]),f=k=>k.kind==="default"?"":k.id,N=d.findIndex(k=>f(k)===a),[w,E]=h.useState(Math.max(0,N));h.useEffect(()=>b.current?.focus(),[]);const v=h.useRef(!1);h.useEffect(()=>{v.current&&E(0),v.current=!0},[d]),h.useEffect(()=>{m.current?.querySelector(`[data-index="${w}"]`)?.scrollIntoView?.({block:"nearest"})},[w]);const C=k=>{if(k.nativeEvent.isComposing||k.keyCode===229)return;const H={ArrowDown:1,ArrowUp:-1,PageDown:8,PageUp:-8}[k.key];if(H!==void 0)k.preventDefault(),d.length&&E(B=>Math.min(d.length-1,Math.max(0,B+H)));else if(k.key==="Enter"){k.preventDefault();const B=d[w];B&&u(f(B))}else k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),c())},R=k=>`${p}-opt-${k}`;return e.jsxs("div",{className:"oa-set-picker-pop","aria-label":t,"data-model-picker-list":"",children:[e.jsxs("div",{className:"oa-set-picker-search",children:[e.jsx(M,{d:S.search,size:13}),e.jsx("input",{ref:b,role:"combobox","aria-expanded":"true","aria-controls":`${p}-list`,"aria-autocomplete":"list","aria-activedescendant":d[w]?R(w):void 0,"aria-label":g("pickerSearch"),placeholder:g("pickerSearch"),spellCheck:!1,autoComplete:"off",value:y,onChange:k=>j(k.target.value),onKeyDown:C})]}),e.jsxs("div",{className:"oa-set-picker-status",children:[e.jsx("span",{role:"status",children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),g("pickerLoading")]}):r?e.jsx("span",{"data-tone":"warning",children:g("pickerListFailed",{error:r})}):o.length?g("pickerCount",{count:new Intl.NumberFormat(l).format(o.length)}):null}),i&&e.jsx("button",{type:"button",className:"oa-set-icon-btn","aria-label":g("pickerRefresh"),title:g("pickerRefresh"),disabled:s,"data-model-picker-refresh":"",onClick:()=>{i(),b.current?.focus()},children:e.jsx(M,{d:S.refresh,size:12})})]}),e.jsxs("div",{ref:m,id:`${p}-list`,role:"listbox","aria-label":g("pickerSearch"),className:"oa-set-picker-list",children:[d.map((k,F)=>e.jsxs("div",{id:R(F),role:"option","aria-selected":F===w,"aria-checked":F===N,"data-index":F,"data-active":F===w,"data-model-option":f(k),className:"oa-set-picker-row",onPointerMove:()=>F!==w&&E(F),onClick:()=>u(f(k)),children:[e.jsx("span",{className:"oa-set-picker-tick",children:F===N&&e.jsx(M,{d:S.tick,size:12})}),k.kind==="default"?e.jsx("span",{className:"oa-set-picker-name","data-muted":"true",children:n}):k.kind==="typed"?e.jsx("span",{className:"oa-set-picker-name",children:g("pickerUseTyped",{model:k.id})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"oa-set-picker-name",children:k.label??k.id}),k.label&&e.jsx("span",{className:"oa-set-picker-id",children:k.id})]})]},k.key)),!d.length&&e.jsx("div",{className:"oa-set-picker-none",children:g("pickerNoMatch")})]})]})}const Qn=[{tier:"default",label:"sourceModelDefault"},{tier:"quick",label:"sourceModelQuick"},{tier:"complex",label:"sourceModelComplex"}];function Bt(t){return t.startsWith("harness:")?t.slice(8):t}function Xn(t,a){const{api:o}=I(),[n,s]=h.useState({models:[],loading:a,error:""}),r=i=>{let c=!0;return s(u=>({...u,loading:!0,error:""})),o.call("models.catalog",{query:i?{provider:t,refresh:"1"}:{provider:t}}).then(u=>c&&s({models:Array.isArray(u.models)?u.models:[],loading:!1,error:u.error??""}),u=>c&&s(g=>({...g,loading:!1,error:_(u)}))),()=>{c=!1}};return h.useEffect(()=>a?r(!1):void 0,[t,a]),{...n,refresh:()=>{r(!0)}}}function es({harness:t,onSaved:a,onCancel:o}){const{api:n,t:s}=I(),r=t.cli,[i,c]=h.useState(()=>At(r.choice)),[u,g]=h.useState(!1),[l,p]=h.useState(""),y=Xn(t.provider,r.model&&r.lists),j=h.useMemo(()=>ao(y.models,r.known),[y.models,r.known]),b=Object.keys(Ot(At(r.choice))).length>0,m=async(w=Ot(i))=>{if(!u){g(!0),p("");try{await n.call("models.set",{body:{harness:{name:Bt(t.provider),choice:w}}}),g(!1),a()}catch(E){g(!1),p(s("usageCouldNotChange",{error:_(E)}))}}},d=w=>{const E=r.defaults[w];return E?s("harnessAppDefaultNamed",{model:E}):s(w==="default"?"harnessAppDefaultOption":"sourceModelSameAsDefault")},f=t.way==="adapter"?s("harnessWayAdapter"):s("harnessWayMcp"),N=s("harnessChoiceTitle",{app:t.title});return e.jsxs("form",{className:"oa-set-form","data-harness-choice":Bt(t.provider),"aria-label":N,noValidate:!0,onSubmit:w=>{w.preventDefault(),m()},children:[e.jsx("div",{className:"oa-set-form-title",children:N}),!r.applies&&e.jsx(L,{"data-harness-not-applied":"",children:s("harnessNotApplied",{app:t.title,way:f})}),r.model&&e.jsxs("div",{className:"oa-set-well",children:[Qn.map(({tier:w,label:E})=>e.jsxs("div",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label","aria-hidden":"true",children:s(E)}),e.jsx(ma,{name:w,label:s(E),value:i[w],models:j,defaultLabel:d(w),loading:y.loading,error:y.error,...r.lists?{onRefresh:y.refresh}:{},onChange:v=>c(C=>({...C,[w]:v}))})]},w)),e.jsx("span",{className:"oa-set-hint",children:s("harnessModelsHint")})]}),r.efforts.length>0&&e.jsxs("div",{className:"oa-set-field","data-harness-effort":i.effort,children:[e.jsx("span",{className:"oa-set-field-label","aria-hidden":"true",children:s("sourceEffort")}),e.jsx(Ce,{"aria-label":s("sourceEffort"),value:i.effort,options:[{value:"",label:s("harnessAppDefaultOption")},...r.efforts.map(w=>({value:w,label:s(ea[w])}))],onChange:w=>c(E=>({...E,effort:w}))}),e.jsx("span",{className:"oa-set-hint",children:s("effortHint")})]}),l&&e.jsx(L,{tone:"danger",children:l}),e.jsxs("div",{className:"oa-set-form-actions",children:[b&&e.jsx(A,{variant:"quiet",className:"oa-set-push",disabled:u,"data-harness-reset":"",onClick:()=>{m({})},children:s("harnessReset")}),e.jsx(A,{disabled:u,onClick:o,children:s("dialog.cancel")}),e.jsx(A,{type:"submit",variant:"primary",disabled:u,"data-harness-save":"",children:s("sourceSave")})]})]})}const Kt="${OPENAI_API_KEY}";function ge({id:t,label:a,hint:o,children:n}){return e.jsxs("div",{className:"oa-set-field",children:[e.jsx("label",{htmlFor:t,className:"oa-set-field-label",children:a}),n,o&&e.jsx("span",{id:`${t}-hint`,className:"oa-set-hint",children:o})]})}function Wt({taken:t,onSaved:a,onCancel:o,initial:n=null}){const{api:s,t:r}=I(),[i,c]=h.useState(()=>n?oo(n):no()),u=n?ta(n):"",g=!!u&&!!n&&!so(i,n),l=g?"":u,p=n?r("sourceFormEditTitle",{source:n.label||n.name}):r("sourceFormTitle"),[y,j]=h.useState(null),[b,m]=h.useState(null),[d,f]=h.useState(null),[N,w]=h.useState(!1),[E,v]=h.useState(""),C={kind:h.useId(),name:h.useId(),endpoint:h.useId(),key:h.useId(),default:h.useId(),quick:h.useId(),complex:h.useId(),effort:h.useId()},R=ro(i.baseUrl)||i.baseUrl,k=g?r("sourceKeyReenter",{host:R}):l?r("sourceKeyKeepHint",{key:l,example:Kt}):r("sourceKeyHint",{example:Kt}),F=io(i,t,n),H=T=>{c(z=>({...z,...T})),v("")},B=(T,z)=>c(K=>({...K,models:{...K.models,[T]:z}})),ye=T=>{H(T),j(null),f(null)},Oe=async T=>{if(b)return;m(T),f(null);let z;try{z=await s.call("models.test",{body:ho(i,n)})}catch(Y){z={ok:!1,message:r("sourceCouldNotReach",{error:_(Y)})}}m(null);const K=Array.isArray(z.models)?z.models.filter(Y=>typeof Y=="string"):[];if(T==="fetch"){K.length?(j(K),f({ok:!0,message:r("sourceModelsFound",{count:String(K.length)})})):f(z.ok?{ok:!0,message:r("sourceNoModelList")}:{ok:!1,message:z.message});return}K.length&&!y&&j(K),f({ok:z.ok,message:z.message||(z.ok?r("sourceTestOk"):`HTTP ${z.status??"?"}`)})},He=async()=>{if(w(!0),!(b||F)){m("save"),v("");try{await xo({modelsList:()=>s.call("models.list"),modelsSet:T=>s.call("models.set",{body:T})},i,t,n),c(T=>({...T,apiKey:""})),m(null),a()}catch(T){m(null),v(r("sourceCouldNotSave",{error:_(T)}))}}},q=(T,z,K)=>{const Y=i.models[T],ie=y?go(y,Y):null;return e.jsx(ge,{id:C[T],label:z,children:ie&&ie.length?e.jsx(ma,{name:T,label:z,value:Y,models:ie.map(le=>({id:le})),...K?{}:{defaultLabel:r("sourceModelSameAsDefault")},onChange:le=>B(T,le)}):e.jsx("input",{id:C[T],className:"oa-set-input",value:Y,required:K,spellCheck:!1,autoComplete:"off",placeholder:K?void 0:r("sourceModelSameAsDefault"),onChange:le=>B(T,le.target.value)})})},re=N?F:null;return e.jsxs("form",{className:"oa-set-form","data-model-source-form":"","aria-label":p,"data-editing":n?n.name:void 0,noValidate:!0,onSubmit:T=>{T.preventDefault(),He()},children:[e.jsx("div",{className:"oa-set-form-title",children:p}),e.jsx(ge,{id:C.kind,label:r("sourceKind"),children:e.jsx(Ce,{id:C.kind,value:i.kind,options:co.map(T=>({value:T,label:r(po[T])})),onChange:T=>ye(lo(i,T))})}),e.jsx(ge,{id:C.name,label:r("sourceName"),children:e.jsx("input",{id:C.name,className:"oa-set-input",value:i.name,maxLength:80,spellCheck:!1,autoComplete:"off",placeholder:r("sourceNamePlaceholder"),onChange:T=>H({name:T.target.value})})}),e.jsx(ge,{id:C.endpoint,label:r("sourceEndpoint"),hint:r("sourceEndpointHint"),children:e.jsx("input",{id:C.endpoint,className:"oa-set-input","aria-describedby":`${C.endpoint}-hint`,value:i.baseUrl,inputMode:"url",spellCheck:!1,autoComplete:"off",onChange:T=>ye({baseUrl:T.target.value})})}),e.jsx(ge,{id:C.key,label:r("sourceKey"),hint:k,children:e.jsx("input",{id:C.key,className:"oa-set-input","aria-describedby":`${C.key}-hint`,value:i.apiKey,placeholder:l||void 0,type:"password",spellCheck:!1,autoComplete:"off","data-1p-ignore":"","data-lpignore":"true",onChange:T=>ye({apiKey:T.target.value})})}),e.jsxs("div",{className:"oa-set-form-head",children:[e.jsx("span",{className:"oa-set-field-label",children:r("sourceModels")}),e.jsxs(A,{disabled:!!b,onClick:()=>{Oe("fetch")},children:[b==="fetch"&&e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),r(b==="fetch"?"sourceFetching":"sourceFetchModels")]})]}),e.jsxs("div",{className:"oa-set-well",children:[q("default",r("sourceModelDefault"),!0),q("quick",r("sourceModelQuick"),!1),q("complex",r("sourceModelComplex"),!1),e.jsx("span",{className:"oa-set-hint",children:r("sourceModelsHint")})]}),e.jsx("div",{"data-source-effort":i.effort??"",children:e.jsx(ge,{id:C.effort,label:r("sourceEffort"),hint:r("effortHint"),children:e.jsx(Ce,{id:C.effort,value:i.effort??"",options:[{value:"",label:r("sourceEffortDefault")},...uo.map(T=>({value:T,label:r(ea[T])}))],onChange:T=>H({effort:T})})})}),d&&e.jsx(L,{tone:d.ok?"success":"danger",...d.ok?{role:"status"}:{},children:d.message}),(re||E)&&e.jsx(L,{tone:"danger",children:E||(re?r(re):"")}),e.jsxs("div",{className:"oa-set-form-actions",children:[e.jsxs(A,{className:"oa-set-push",disabled:!!b,onClick:()=>{Oe("test")},children:[b==="test"&&e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),r(b==="test"?"sourceTesting":"sourceTest")]}),e.jsx(A,{disabled:b==="save",onClick:o,children:r("dialog.cancel")}),e.jsx(A,{type:"submit",variant:"primary",disabled:!!b,children:r(b==="save"?"sourceSaving":"sourceSave")})]})]})}function ts({source:t,isDefault:a,onChanged:o,onEdit:n,onRemove:s}){const{api:r,t:i}=I(),[c,u]=h.useState(!1),[g,l]=h.useState(null),[p,y]=h.useState(""),j=ta(t),b=async()=>{u(!0),l(null),y("");try{l(await r.call("models.test",{body:{name:t.name}}))}catch(f){y(_(f))}u(!1)},m=async()=>{try{await r.call("models.set",{body:{name:t.name,makeDefault:!0}}),o()}catch(f){y(i("usageCouldNotChange",{error:_(f)}))}},d=t.keyEnv&&!t.keyEnv.set?t.keyEnv.name:"";return e.jsxs(D,{"data-model-source":t.name,label:e.jsxs(e.Fragment,{children:[t.label||t.name,t.host&&e.jsxs("span",{className:"oa-set-muted",children:[" ",t.host]}),a&&e.jsx(Q,{tone:"accent",children:i("modelsDefault")})]}),hint:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"oa-set-inline",children:[e.jsx(M,{d:S.key,size:12}),d?e.jsx("span",{"data-tone":"warning",children:i("modelsKeyEnvUnset",{name:d})}):j||i("modelsNoKey")]}),e.jsx("span",{className:"oa-set-wrap",children:i("modelsTierModels",{default:t.models.default,quick:t.models.quick||t.models.default,complex:t.models.complex||t.models.default})})]}),detail:e.jsxs(e.Fragment,{children:[g&&e.jsx(L,{tone:g.ok?"success":"danger",...g.ok?{role:"status"}:{},children:g.ok?`${i("sourceTestOk")} ${g.message}`:g.message}),p&&e.jsx(L,{tone:"danger",children:p})]}),children:[!a&&e.jsx(A,{variant:"quiet",onClick:()=>{m()},children:i("modelsMakeDefault")}),e.jsx(A,{variant:"quiet","data-model-source-edit":"",onClick:n,children:i("modelsEdit")}),e.jsxs(A,{variant:"quiet",disabled:c,onClick:()=>{b()},children:[c&&e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),i(c?"sourceTesting":"modelsTest")]}),e.jsx(A,{variant:"danger","data-model-source-remove":"",onClick:s,children:i("modelsRemove")})]})}function as({models:t,reload:a}){const{api:o,t:n}=I(),[s,r]=h.useState(!1),[i,c]=h.useState(null),[u,g]=h.useState(null),[l,p]=h.useState(""),y=t.providers.map(d=>d.name),j=d=>o.call("models.set",{body:d}).then(a,f=>p(n("usageCouldNotChange",{error:_(f)}))),b=async d=>{try{await o.call("models.remove",{body:{name:d.name}}),a()}catch(f){p(n("usageCouldNotChange",{error:_(f)}))}},m=t.default&&t.providers.some(d=>d.name===t.default)?t.default:"";return e.jsxs(Z,{title:n("modelsSources"),action:!s&&e.jsxs(A,{"data-testid":"models-add-source",onClick:()=>{c(null),r(!0)},children:[e.jsx(M,{d:S.plus,size:12}),n("modelsAddSource")]}),children:[t.providers.map(d=>i===d.name?e.jsx("div",{className:"oa-set-row","data-model-source":d.name,children:e.jsx(Wt,{initial:d,taken:y,onSaved:()=>{c(null),a()},onCancel:()=>c(null)})},d.name):e.jsx(ts,{source:d,isDefault:t.default===d.name,onChanged:a,onEdit:()=>{r(!1),c(d.name)},onRemove:()=>g(d)},d.name)),(t.harnesses??[]).map(d=>e.jsx(os,{harness:d,editing:i===d.provider,onEdit:()=>{r(!1),c(d.provider)},onDone:f=>{c(null),f&&a()}},d.provider)),!t.providers.length&&!t.harnesses?.length&&!s&&e.jsx(D,{hint:n("modelsNoSources")}),s&&e.jsx("div",{className:"oa-set-row",children:e.jsx(Wt,{taken:y,onSaved:()=>{r(!1),a()},onCancel:()=>r(!1)})}),t.providers.length>0&&e.jsx(D,{label:n("modelsDefaultSource"),labelFor:"oa-set-default-source",hint:n("modelsDefaultHint"),children:e.jsxs(Ce,{id:"oa-set-default-source",value:m,onChange:d=>d&&void j({name:d,makeDefault:!0}),children:[!m&&e.jsx("option",{value:"",disabled:!0,children:n("modelsNone")}),t.providers.map(d=>e.jsx("option",{value:d.name,children:d.label||d.name},d.name))]})}),l&&e.jsx(D,{detail:e.jsx(L,{tone:"danger",children:l})}),u&&e.jsxs(se,{label:n("modelsRemoveConfirm",{source:u.label||u.name}),onClose:()=>g(null),children:[e.jsx("h2",{children:n("modelsRemoveConfirm",{source:u.label||u.name})}),e.jsx("p",{children:n("modelsRemoveBody")}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:()=>g(null),children:n("dialog.cancel")}),e.jsx("button",{type:"button",className:"oa-btn","data-danger":"true",onClick:()=>{b(u),g(null)},children:n("modelsRemove")})]})]})]})}function os({harness:t,editing:a,onEdit:o,onDone:n}){const{t:s}=I(),r=t.available?"":t.reason||s("grantUnavailable"),[i,...c]=mo(t,s);return e.jsx(D,{"data-model-source":t.provider,"data-unavailable":t.available?void 0:"","aria-disabled":t.available?void 0:!0,label:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:t.available?void 0:"oa-set-muted",children:t.title}),e.jsxs("span",{className:"oa-set-muted",children:[" ",[s("modelsAgentApp"),i].join(" · ")]})]}),hint:c.length?c.map((u,g)=>e.jsxs("span",{...u===r?{"data-tone":"warning"}:{},children:[g>0?" · ":"",u]},u)):void 0,detail:e.jsxs(e.Fragment,{children:[t.cli&&e.jsx("span",{className:"oa-set-hint","data-harness-summary":"","data-applies":t.cli.applies,children:fo(t.cli,s)}),t.cli&&a&&e.jsx(es,{harness:t,onSaved:()=>n(!0),onCancel:()=>n(!1)})]}),children:t.cli&&!a&&e.jsx(A,{variant:"quiet","data-harness-change":"",onClick:o,children:s("harnessChange")})})}function ns(){const{t}=I(),a=ne("models.list");return a.data?e.jsxs("div",{"data-testid":"model-settings",className:"oa-set-stack",children:[a.error&&e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:a.error})}),e.jsx(as,{models:a.data,reload:a.again})]}):a.error?e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:a.error})}):e.jsx(Ae,{t})}const ss={private:"siteTypePrivate",link:"siteTypeLink",site:"siteTypeSite"};function rs(){const{api:t}=I(),[a,o]=h.useState({sites:null,error:"",loading:null}),n=h.useRef(0),s=h.useCallback(r=>{const i=++n.current;o(c=>({...c,loading:r??"*"})),t.call("types.sites",r?{query:{remote:r}}:{}).then(c=>{if(i!==n.current)return;const u=Zo(c);o(g=>{if(r&&g.sites){const l=u.sites.find(p=>p.remote===r);return{sites:{...g.sites,sites:g.sites.sites.map(p=>p.remote===r&&l?l:p)},error:"",loading:null}}return{sites:u,error:"",loading:null}})},c=>{if(i!==n.current)return;const u=_(c);o(g=>{const l=p=>!r||p.remote===r?{...p,types:[],error:u,code:"error"}:p;return g.sites?.sites.length?{sites:{...g.sites,sites:g.sites.sites.map(l)},error:"",loading:null}:{sites:null,error:u,loading:null}})})},[t]);return h.useEffect(()=>s(),[s]),{...a,load:s}}function is({type:t,onInstall:a}){const{t:o,lang:n}=I(),s=Jo(t);return e.jsx(D,{"data-connected-site-type":t.id,"data-standing":t.standing,label:e.jsxs(e.Fragment,{children:[t.name,e.jsxs("span",{className:"oa-set-muted",children:[" ",t.id]}),e.jsxs(Q,{children:["v",t.version]}),e.jsx(Q,{children:o(ss[t.visibility])})]}),hint:t.description||void 0,detail:e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"site-type-publisher",className:"oa-set-hint oa-set-faint",children:o("siteTypeBy",{name:t.publisher.name??o("siteTypeUnnamedPublisher"),when:xa(t.updatedAt,n,o)})}),t.standing==="update"&&t.local&&e.jsx("span",{className:"oa-set-hint",children:o("siteTypeUpdateNote",{local:t.local.version??"?",id:t.local.id,version:t.version})}),t.standing==="clash"&&t.local&&e.jsx(L,{tone:"warning",children:o("siteTypeClashNote",{id:t.local.id})}),e.jsxs("a",{href:t.page,target:"_blank",rel:"noopener noreferrer","data-testid":"site-type-page",className:"oa-set-ext",children:[e.jsx(M,{d:S.external,size:12}),o("siteTypeOpenPage")]})]}),children:s.action==="install"?e.jsx(A,{variant:"primary","data-testid":"site-type-install",onClick:()=>a(s.open),children:o("siteTypeInstallHere")}):s.action==="update"?e.jsx(A,{"data-testid":"site-type-update",onClick:()=>a(s.open),children:o("siteTypeUpdateHere",{version:t.version})}):s.action==="install-as"?e.jsx(A,{"data-testid":"site-type-install-as",onClick:()=>a(s.open),children:o("siteTypeInstallAsOther")}):e.jsx("span",{"data-testid":"site-type-label",className:"oa-set-muted",children:t.standing==="published-here"?o("siteTypePublishedHere"):t.local&&t.local.id!==t.id?o("siteTypeInstalledAs",{id:t.local.id}):o("siteTypeInstalledHere")})})}const ls=t=>{try{return new URL(t).host}catch{return t}};function cs({site:t,busy:a,onRetry:o,onInstall:n}){const{t:s}=I();return e.jsx(Z,{"data-connected-site":t.remote,title:s("connectedSiteTitle",{name:t.remote,host:ls(t.host)}),children:t.error?e.jsx(D,{detail:e.jsx(L,{tone:"danger","data-testid":"connected-site-error",children:t.error}),children:e.jsx(A,{disabled:a,"data-testid":"connected-site-retry",onClick:o,children:s(a?"loading":"connectedSiteRetry")})}):e.jsxs(e.Fragment,{children:[e.jsx(D,{hint:`${s("connectedSiteNote")} ${s("packageThirdParty")}`}),t.types.length?t.types.map(r=>e.jsx(is,{type:r,onInstall:n},r.uid)):e.jsx(D,{hint:s("connectedSiteEmpty")})]})})}function ds({sites:t,onInstall:a}){const{t:o}=I();return t.error?e.jsxs("div",{"data-connected-sites":"",className:"oa-set-inline",children:[e.jsx(L,{tone:"danger",children:o("connectedSitesFailed",{error:t.error})}),e.jsx(A,{disabled:t.loading!==null,onClick:()=>t.load(),children:o("connectedSiteRetry")})]}):t.sites?t.sites.sites.length?e.jsx("div",{"data-connected-sites":"",className:"oa-set-stack",children:t.sites.sites.map(n=>e.jsx(cs,{site:n,busy:t.loading==="*"||t.loading===n.remote,onRetry:()=>t.load(n.remote),onInstall:a},n.remote))}):e.jsx(L,{"data-connected-sites":"none",className:"oa-set-faint",children:o("connectedSitesNone")}):e.jsx(L,{"data-connected-sites":"loading",className:"oa-set-faint",children:o("connectedSitesLoading")})}async function ps(t){const a=new Uint8Array(await t.arrayBuffer());let o="";for(let n=0;n<a.length;n+=32768)o+=String.fromCharCode(...a.subarray(n,n+32768));return btoa(o)}function ae({label:t,children:a,testId:o}){return e.jsxs("div",{className:"oa-set-fact",children:[e.jsx("span",{children:t}),e.jsx("span",{"data-testid":o,children:a})]})}function us({preview:t,t:a}){return e.jsxs("div",{"data-testid":"type-preview",className:"oa-set-preview",children:[e.jsxs("p",{className:"oa-set-preview-name",children:[t.name," ",t.version]}),t.description&&e.jsx("p",{className:"oa-set-hint",children:t.description}),e.jsx(ae,{label:a("packageId"),children:t.id}),e.jsx(ae,{label:a("packageSource"),testId:"type-preview-source",children:t.source}),t.site&&e.jsxs(e.Fragment,{children:[e.jsx(ae,{label:a("packagePublisher"),testId:"type-preview-publisher",children:a("packagePublisherText",{name:t.site.publisher??a("siteTypeUnnamedPublisher"),site:t.site.origin})}),e.jsx(ae,{label:a("packageSite"),testId:"type-preview-site",children:t.site.remote?a("packageSiteRemote",{site:t.site.origin,remote:t.site.remote}):a("packageSitePublic",{site:t.site.origin})})]}),e.jsx(ae,{label:"sha256",children:e.jsx("code",{children:t.sha256})}),e.jsx(ae,{label:a("packageCapabilities"),testId:"type-preview-capabilities",children:t.capabilities.length?t.capabilities.join(", "):a("noCapabilities")}),e.jsx(ae,{label:a("packageNetwork"),testId:"type-preview-network",children:t.network.length?t.network.join(", "):a("noNetwork")}),t.replaces&&e.jsx(ae,{label:a("packageReplaces"),children:a("packageReplacesText",{version:t.replaces.version,source:t.replaces.source})}),t.warnings.map(o=>e.jsx(L,{tone:"warning",children:o},o)),e.jsx("p",{className:"oa-set-hint",children:t.skill?a("packageSkill",{path:t.skill.path,chars:String(t.skill.chars),lines:String(t.skill.lines)}):a("packageNoSkill")}),t.skill&&e.jsx("pre",{"data-testid":"type-preview-skill",className:"oa-set-pre",children:t.skill.text}),e.jsx("p",{className:"oa-set-hint",children:a("packageThirdParty")})]})}function hs({opened:t,onClose:a,onDone:o}){const{api:n,t:s}=I(),r="update"in t?t.update:void 0,i="url"in t?t.url:void 0,c="url"in t?t.as:void 0,u="url"in t&&t.auto,[g,l]=h.useState(i??""),[p,y]=h.useState(c??""),[j,b]=h.useState(""),[m,d]=h.useState(!1),[f,N]=h.useState(null),w=h.useRef(null),E=async(k,F=p)=>{d(!0),b("");try{const H=F.trim()?{as:F.trim()}:{};let B;if("update"in k)B={id:k.update};else if("url"in k){if(!k.url.trim())throw new Error(s("needPackage"));B={url:k.url.trim(),...H}}else B={name:k.file.name,data:await ps(k.file),...H};N(await n.call("update"in k?"types.update":"types.preview",{body:B}))}catch(H){b(s("couldNotReadPackage",{error:_(H)}))}d(!1)};h.useEffect(()=>{r?E({update:r}):i&&u&&E({url:i},c??"")},[]);const v=async()=>{if(!(!f||m)){d(!0),b("");try{r?await n.call("types.update",{body:{id:r,sha256:f.sha256}}):await n.call("types.install",{body:{sha256:f.sha256,...p.trim()?{as:p.trim()}:{}}}),o(s(r?"typeUpdated":"typeInstalled",{type:f.name,version:f.version}))}catch(k){d(!1),b(s("couldNotInstall",{error:_(k)}))}}},C=k=>{k.preventDefault(),m||E({url:g})},R=r?s("updateTypeTitle",{id:r}):s("installType");return e.jsxs(se,{label:R,onClose:a,wide:!0,testId:"install-type-dialog",children:[e.jsx("h2",{children:R}),(f||!r)&&e.jsx("p",{children:s(f?"installTypeCheck":"installTypeDescription")}),f?e.jsxs(e.Fragment,{children:[e.jsx(us,{preview:f,t:s}),j&&e.jsx(L,{tone:"danger",children:j}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:a,children:s("dialog.cancel")}),e.jsx("button",{type:"button",className:"oa-btn","data-primary":"true","data-testid":"type-install-confirm",disabled:m,onClick:()=>{v()},children:r?s("updateType"):s("installTypeAs",{id:f.id})})]})]}):r?e.jsxs(e.Fragment,{children:[m&&e.jsxs("p",{className:"oa-set-loading",role:"status",children:[e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),s("loading")]}),j&&e.jsx(L,{tone:"danger",children:j}),e.jsx("div",{className:"oa-dialog-actions",children:e.jsx("button",{type:"button",className:"oa-btn",onClick:a,children:s("dialog.close")})})]}):e.jsxs("form",{onSubmit:C,"data-testid":"install-type-form",className:"oa-set-dialog-form",children:[e.jsxs("div",{children:[e.jsxs(A,{disabled:m,"data-testid":"install-type-file",onClick:()=>w.current?.click(),children:[e.jsx(M,{d:S.download,size:12}),s("chooseTypePackage")]}),e.jsx("input",{ref:w,type:"file",accept:".oatype,application/zip",hidden:!0,"data-testid":"install-type-file-input",onChange:k=>{const F=k.target.files?.[0];k.target.value="",F&&!m&&E({file:F})}})]}),e.jsxs("label",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:s("typePackageUrl")}),e.jsxs("span",{className:"oa-set-inline-field",children:[e.jsx("input",{className:"oa-set-input",name:"url",value:g,placeholder:"https://…/my-type-1.0.0.oatype",spellCheck:!1,onChange:k=>l(k.target.value)}),e.jsx(A,{type:"submit",disabled:m||!g.trim(),children:s("readPackage")})]})]}),i&&!u&&e.jsx(L,{tone:"warning","data-testid":"install-type-clash",children:s("siteTypeClashHint")}),e.jsxs("label",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:s("installAs")}),e.jsx("input",{className:"oa-set-input",name:"as",value:p,maxLength:64,spellCheck:!1,onChange:k=>y(k.target.value.toLowerCase())}),e.jsx("span",{className:"oa-set-hint",children:s("installAsHint")})]}),m&&e.jsxs("p",{className:"oa-set-loading",role:"status",children:[e.jsx("span",{className:"oa-spinner","aria-hidden":"true"}),s("loading")]}),j&&e.jsx(L,{tone:"danger",children:j}),e.jsx("div",{className:"oa-dialog-actions",children:e.jsx("button",{type:"button",className:"oa-btn",onClick:a,children:s("dialog.cancel")})})]})]})}function gs({made:t,onDone:a,t:o}){const n=t.check.warnings.length;return e.jsxs("div",{"data-testid":"type-made",className:"oa-set-dialog-form",children:[e.jsx("p",{className:"oa-set-preview-name",children:o("typeMade",{id:t.id})}),e.jsx("span",{className:"oa-set-hint",children:o("typeMadeAt")}),e.jsx(_t,{text:t.dir,t:o,testId:"type-made-dir"}),e.jsx("span",{className:"oa-set-hint",children:o("typeMadePrompt")}),e.jsx(_t,{text:t.prompt,t:o,testId:"type-made-prompt"}),n>0&&e.jsx(L,{tone:"warning",children:o("typeCheckWarnings",{count:String(n)})}),e.jsx("div",{className:"oa-dialog-actions",children:e.jsx("button",{type:"button",className:"oa-btn","data-primary":"true","data-testid":"type-made-done",onClick:a,children:o("done")})})]})}function xs({onClose:t,onMade:a}){const{api:o,t:n}=I(),[s,r]=h.useState(""),[i,c]=h.useState(""),[u,g]=h.useState("page"),[l,p]=h.useState("user"),[y,j]=h.useState(""),[b,m]=h.useState(""),[d,f]=h.useState(!1),[N,w]=h.useState(null),E=async v=>{if(v.preventDefault(),d)return;const C=y.trim();if(!s.trim())return m(n("needTypeId"));if(l==="project"&&!C.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(C))return m(n("needProjectFolder"));f(!0),m("");const R={id:s.trim(),template:u,scope:l,...i.trim()?{name:i.trim()}:{},...l==="project"?{project:C}:{}};try{w(await o.call("types.new",{body:R})),a()}catch(k){m(n("couldNotMakeType",{error:_(k)}))}f(!1)};return e.jsxs(se,{label:n("newType"),onClose:t,testId:"new-type-dialog",children:[e.jsx("h2",{children:n("newType")}),N?e.jsx(gs,{made:N,onDone:t,t:n}):e.jsxs("form",{onSubmit:v=>{E(v)},"data-testid":"new-type-form",className:"oa-set-dialog-form",children:[e.jsx("p",{children:n("newTypeDescription")}),e.jsxs("label",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:n("typeId")}),e.jsx("input",{className:"oa-set-input",autoFocus:!0,required:!0,name:"id",value:s,maxLength:64,spellCheck:!1,onChange:v=>r(v.target.value.toLowerCase())}),e.jsx("span",{className:"oa-set-hint",children:n("typeIdHint")})]}),e.jsxs("label",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:n("typeName")}),e.jsx("input",{className:"oa-set-input",name:"name",value:i,maxLength:80,onChange:v=>c(v.target.value)})]}),e.jsxs("div",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:n("typeTemplate")}),e.jsx(it,{"aria-label":n("typeTemplate"),value:u,onChange:g,options:[{value:"page",label:n("templatePage")},{value:"data",label:n("templateData")}]}),e.jsx("span",{className:"oa-set-hint",children:n(u==="page"?"templatePageHint":"templateDataHint")})]}),e.jsxs("div",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:n("typeScope")}),e.jsx(it,{"aria-label":n("typeScope"),value:l,onChange:p,options:[{value:"user",label:n("scopeUser")},{value:"project",label:n("scopeProject")}]}),e.jsx("span",{className:"oa-set-hint",children:n(l==="user"?"scopeUserHint":"scopeProjectHint")})]}),l==="project"&&e.jsxs("label",{className:"oa-set-field",children:[e.jsx("span",{className:"oa-set-field-label",children:n("projectFolder")}),e.jsx("input",{className:"oa-set-input",name:"project",value:y,placeholder:n("projectFolderHint"),onChange:v=>j(v.target.value)})]}),b&&e.jsx(L,{tone:"danger",children:b}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:t,children:n("dialog.cancel")}),e.jsx("button",{type:"submit",className:"oa-btn","data-primary":"true",disabled:d||!s.trim(),children:n("create")})]})]})]})}function ms({type:t}){return e.jsx("span",{className:"oa-set-type-icon",style:t.source==="builtin"?fe(t.id):void 0,"data-builtin":t.source==="builtin",children:t.source==="builtin"?e.jsx(Me,{type:t.id,size:16}):e.jsx(M,{d:S.types,size:16})})}function fs({type:t,creatable:a,onToggle:o,onCreate:n,onUpdate:s,onUninstall:r}){const{t:i}=I(),c=t.source==="installed"?"sourceInstalled":t.source==="builtin"?"sourceBuiltin":"sourceLocal";return e.jsx(D,{"data-type-id":t.id,"data-type-scope":t.scope,className:"oa-set-type",label:e.jsxs(e.Fragment,{children:[e.jsx(ms,{type:t}),e.jsxs("span",{className:"oa-set-type-name",children:[t.title,e.jsxs("span",{className:"oa-set-muted",children:[" ",t.id]})]})]}),detail:e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"oa-set-tags",children:[e.jsx(Q,{children:i(c)}),(t.source==="local"||!t.source)&&e.jsx(Q,{children:t.scope}),e.jsx(Q,{children:t.runtime}),t.version&&e.jsxs(Q,{children:["v",t.version]}),!t.enabled&&e.jsx(Q,{tone:"warning",children:i("disabled")}),t.shadowedBy&&e.jsx(Q,{tone:"warning",children:i("shadowedBy",{root:t.shadowedBy})})]}),t.description&&e.jsx("span",{className:"oa-set-hint oa-set-clamp",children:t.description}),t.capabilities?.length?e.jsx("span",{"data-testid":"type-capabilities",className:"oa-set-hint",children:i("typeCapabilities",{list:t.capabilities.join(", ")})}):null,t.source==="installed"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-testid":"type-network",className:"oa-set-hint",children:t.network?.length?i("typeNetwork",{list:t.network.join(", ")}):i("noNetwork")}),t.installedFrom&&e.jsx("span",{className:"oa-set-hint oa-set-faint oa-set-wrap",children:i("installedFrom",{source:t.installedFrom})})]}),t.problems.length>0&&e.jsx(L,{tone:"warning",children:t.problems.join(" ")}),(a||t.source==="installed")&&e.jsxs("span",{className:"oa-set-actions",children:[a&&e.jsxs(A,{onClick:n,children:[e.jsx(M,{d:S.plus,size:12}),i("newOf",{type:t.title})]}),t.source==="installed"&&e.jsxs(e.Fragment,{children:[e.jsxs(A,{"data-testid":"type-update",onClick:s,children:[e.jsx(M,{d:S.refresh,size:12}),i("updateType")]}),e.jsxs(A,{variant:"danger","data-testid":"type-uninstall",onClick:r,children:[e.jsx(M,{d:S.trash,size:12}),i("uninstallType")]})]})]})]}),children:e.jsx(ga,{checked:t.enabled,"aria-label":i(t.enabled?"turnTypeOff":"turnTypeOn",{type:t.title}),onChange:o})})}function bs({canCreate:t}){const{api:a,t:o}=I(),n=ne("types"),s=rs(),r=O(v=>v.types),i=O(v=>v.create),[c,u]=h.useState(null),[g,l]=h.useState(!1),[p,y]=h.useState(null),[j,b]=h.useState(null),m=async(v,C,R,k)=>{b(null);try{await a.call(v,{body:C}),n.again(),k&&b({tone:"success",text:k})}catch(F){b({tone:"danger",text:o(R,{error:_(F)})})}},d=v=>e.jsx(fs,{type:v,creatable:t&&v.enabled&&r.some(C=>C.id===v.id),onToggle:C=>{m(C?"types.enable":"types.disable",{id:v.id},"couldNotToggleType")},onCreate:()=>i(v.id),onUpdate:()=>u({update:v.id}),onUninstall:()=>y(v)},`${v.root}:${v.id}`),f=v=>{b(null),u(v)};if(!n.data)return n.error?e.jsx(L,{tone:"danger",children:o("couldNotLoad",{error:n.error})}):e.jsx(Ae,{t:o});const N=n.data,w=N.roots.map(v=>`${v.dir} (${v.scope})`).join(", "),E=N.roots.find(v=>v.scope==="user")?.dir;return e.jsxs("div",{className:"oa-set-stack",children:[n.error&&e.jsx(L,{tone:"danger",children:o("couldNotLoad",{error:n.error})}),j&&e.jsx(L,{tone:j.tone,...j.tone==="success"?{role:"status"}:{},children:j.text}),e.jsxs(Z,{title:o("typesHere"),action:e.jsxs(e.Fragment,{children:[e.jsxs(A,{"data-testid":"install-type",onClick:()=>f({}),children:[e.jsx(M,{d:S.download,size:12}),o("installType")]}),e.jsxs(A,{"data-testid":"new-type",onClick:()=>l(!0),children:[e.jsx(M,{d:S.plus,size:12}),o("newType")]})]}),children:[e.jsx(D,{hint:E?o("typesExplain",{user:E}):o("typesExplainNoUser"),detail:w&&e.jsx("span",{className:"oa-set-hint oa-set-faint oa-set-wrap",children:o("typeRoots",{roots:w})})}),N.types.length?N.types.map(d):e.jsx(D,{hint:o("noTypes")})]}),(N.projects??[]).map(v=>e.jsxs(Z,{"data-project":v.dir,title:e.jsx("span",{className:"oa-set-wrap",children:o("projectTypes",{dir:v.dir})}),action:e.jsxs(A,{variant:v.trusted?"default":"primary",onClick:()=>{m("types.trust",{dir:v.dir,trusted:!v.trusted},"couldNotTrust")},children:[!v.trusted&&e.jsx(M,{d:S.shield,size:12}),o(v.trusted?"untrustProject":"trustProject")]}),children:[!v.trusted&&e.jsx(D,{detail:e.jsx(L,{tone:"warning",children:o("projectUntrusted")})}),v.types.map(d)]},v.dir)),e.jsx(ds,{sites:s,onInstall:f}),c&&e.jsx(hs,{opened:c,onClose:()=>u(null),onDone:v=>{u(null),b({tone:"success",text:v}),n.again(),s.sites&&s.load()}}),g&&e.jsx(xs,{onClose:()=>l(!1),onMade:n.again}),p&&e.jsxs(se,{label:o("uninstallType"),onClose:()=>y(null),children:[e.jsx("h2",{children:o("uninstallType")}),e.jsx("p",{children:o("uninstallConfirm",{type:p.title})}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:()=>y(null),children:o("dialog.cancel")}),e.jsx("button",{type:"button",className:"oa-btn","data-danger":"true","data-testid":"type-uninstall-confirm",onClick:()=>{const v=p;y(null),m("types.uninstall",{id:v.id},"couldNotUninstall",o("typeUninstalled",{type:v.title}))},children:o("uninstallType")})]})]})]})}const ys=[["today","usagePeriodToday"],["month","usagePeriodMonth"],["total","usagePeriodTotal"]];function tt({totals:t}){const{t:a,lang:o}=I();if(!t.calls)return e.jsx("span",{className:"oa-set-faint",children:"—"});const n=jo(t,a,o);return e.jsxs("span",{className:"oa-set-cell",children:[e.jsx("span",{children:a("modelsCellCalls",{count:wo(t.calls,o)})}),e.jsx("span",{className:n?"oa-set-muted":"oa-set-faint",children:n??a("usageNotReported")})]})}function vs(){const{t}=I(),a=ne("usage.summary"),o=ne("models.list"),n=O(l=>l.artifacts),s=O(l=>l.open),[r,i]=h.useState({...bo}),c=h.useMemo(()=>new Map(n.map(l=>[l.id,l.title])),[n]),u=h.useMemo(()=>yo(vo(a.data?.artifacts??[],c,o.data),r),[a.data,c,o.data,r]);if(!a.data)return a.error?e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:a.error})}):e.jsx(Ae,{t});const g=l=>{const p=new Date;l==="json"?$t(ko(u,p.toISOString()),Pt("json",p),"application/json"):$t(No(u),Pt("csv",p),"text/csv")};return e.jsxs("div",{className:"oa-set-stack",children:[a.error&&e.jsx(L,{tone:"danger",children:t("modelsCouldNotLoad",{error:a.error})}),e.jsx(Z,{id:"models-usage",title:t("settingsUsageByArtifact"),action:u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(it,{"aria-label":t("modelsSortBy"),value:r.by,options:[{value:"tokens",label:t("modelsSortTokens")},{value:"calls",label:t("modelsSortCalls")}],onChange:l=>i({...r,by:l})}),e.jsxs(A,{"data-testid":"usage-export-json",onClick:()=>g("json"),children:[e.jsx(M,{d:S.download,size:12}),t("modelsExportJson")]}),e.jsxs(A,{"data-testid":"usage-export-csv",onClick:()=>g("csv"),children:[e.jsx(M,{d:S.download,size:12}),t("modelsExportCsv")]})]}),children:u.length?e.jsx("div",{className:"oa-set-table-wrap",children:e.jsxs("table",{"data-usage-table":"",className:"oa-set-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:t("modelsColArtifact")}),e.jsx("th",{children:t("usageSource")}),ys.map(([l,p])=>e.jsx("th",{"aria-sort":r.period===l?"descending":void 0,children:e.jsxs("button",{type:"button",className:"oa-set-sort","data-on":r.period===l,onClick:()=>i({...r,period:l}),children:[t(p),r.period===l&&e.jsx(M,{d:"M8 3.5v9M4.5 9 8 12.5 11.5 9",size:12})]})},l))]})}),e.jsx("tbody",{children:u.map(l=>{const p=n.find(y=>y.id===l.artifactId);return e.jsxs("tr",{"data-usage-row":l.artifactId,children:[e.jsx("td",{className:"oa-set-table-title",children:p?e.jsx("button",{type:"button",className:"oa-set-link",title:l.title,onClick:()=>{s(p)},children:l.title}):e.jsx("span",{className:"oa-set-muted",title:l.artifactId,children:l.title||t("modelsDeletedArtifact")})}),e.jsx("td",{className:"oa-set-muted",children:l.source||"—"}),e.jsx("td",{children:e.jsx(tt,{totals:l.today})}),e.jsx("td",{children:e.jsx(tt,{totals:l.month})}),e.jsx("td",{children:e.jsx(tt,{totals:l.total})})]},l.artifactId)})})]})}):e.jsx(D,{hint:t("modelsNoUsage")})})]})}const js=Object.freeze(["models","access","usage","types","about"]),ws={models:{label:"modelsHeading",description:"settingsModelsSub",icon:S.model},access:{label:"settingsAccess",description:"settingsAccessSub",icon:S.shield},usage:{label:"modelsUsage",description:"settingsUsageSub",icon:S.usage},types:{label:"settingsTypes",description:"settingsTypesSub",icon:S.types},about:{label:"settingsAbout",description:"settingsAboutSub",icon:S.info}},ks=720;function Ns(t,a,o){if(typeof t!="string")return{id:t.id,label:t.label,icon:t.icon??e.jsx(M,{d:S.gear,size:16}),description:t.description??"",render:t.render};const n=ws[t];if(!n)return null;const s=()=>{switch(t){case"models":return e.jsx(ns,{});case"access":return e.jsx(Yn,{});case"usage":return e.jsx(vs,{});case"types":return e.jsx(bs,{canCreate:o});case"about":return e.jsx(qn,{})}};return{id:t,label:a(n.label),icon:e.jsx(M,{d:n.icon,size:16}),description:a(n.description),render:s}}class Ss extends h.Component{state={error:""};static getDerivedStateFromError(a){return{error:a instanceof Error?a.message:String(a)}}componentDidCatch(a,o){console.error("Open Artifacts settings:",a,o.componentStack)}render(){return this.state.error?e.jsx(L,{tone:"danger",children:this.props.t("settingsSectionFailed",{error:this.state.error})}):this.props.children}}function Cs({sections:t=js,canCreate:a}){const{t:o}=W(),n=O(l=>l.settings),s=O(l=>l.openSettings),r=t.map(l=>Ns(l,o,a)).filter(l=>l!==null),i=r.find(l=>l.id===n)??r[0],c=h.useRef(null),[u,g]=h.useState(!1);return h.useLayoutEffect(()=>{const l=c.current?.closest(".oa-page")??c.current;if(!l)return;const p=()=>g(l.getBoundingClientRect().width<ks);if(p(),typeof ResizeObserver>"u")return;const y=new ResizeObserver(p);return y.observe(l),()=>y.disconnect()},[]),h.useEffect(()=>{i&&n!==i.id&&s(i.id)},[i?.id,n,s]),h.useEffect(()=>{if(!u||!i)return;c.current?.querySelector(`.oa-set-nav-item[data-section="${CSS.escape(i.id)}"]`)?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[u,i?.id]),e.jsx("div",{ref:c,className:"oa-set","data-testid":"settings-view","data-section":i?.id,"data-narrow":u,children:e.jsxs("div",{className:"oa-set-layout",children:[e.jsx("nav",{className:"oa-set-nav","aria-label":o("settings"),children:r.map(l=>e.jsxs("button",{type:"button",className:"oa-set-nav-item","data-section":l.id,"aria-current":l.id===i?.id?"page":void 0,onClick:()=>l.id!==i?.id&&s(l.id),children:[l.icon,e.jsx("span",{children:l.label})]},l.id))}),i&&e.jsxs("section",{className:"oa-set-main","aria-labelledby":"oa-set-section-title","data-settings-section":i.id,children:[e.jsxs("header",{className:"oa-set-section-head",children:[e.jsx("h2",{id:"oa-set-section-title",children:i.label}),i.description&&e.jsx("p",{children:i.description})]}),e.jsx(Ss,{t:o,children:i.render()},i.id)]})]})})}const Ts=[["minute",60],["hour",3600],["day",86400],["week",604800],["month",2629800],["year",31557600]];function fa(t,a,o){const n=Date.parse(t);if(!Number.isFinite(n))return"";const s=Math.round((n-a)/1e3);if(s>-60)return o("card.justNow");let r="minute",i=60;for(const[u,g]of Ts)-s>=g&&([r,i]=[u,g]);let c;try{c=new Intl.RelativeTimeFormat(o("time.locale"),{numeric:"auto"})}catch{c=new Intl.RelativeTimeFormat("en",{numeric:"auto"})}return o("card.opened",{time:c.format(Math.round(s/i),r)})}function Es(t=6e4){const[a,o]=h.useState(()=>Date.now());return h.useEffect(()=>{const n=setInterval(()=>o(Date.now()),t);return()=>clearInterval(n)},[t]),a}function _e(t,a,o){const n=`type.${a}`;return ut(n)?t(n):o||a}function Ms(t,a,o){const n=`about.${a}`;return ut(n)?t(n):o||""}function Ls({artifact:t}){const{api:a}=W(),o=t.thumbnail===null?null:a.thumbnailUrl(t.id,t.thumbnail),[n,s]=h.useState(null),r=o!==null&&n!==o;return e.jsx("span",{className:"oa-preview","data-stack":r&&t.type==="docs",children:r?e.jsx("span",{className:"oa-sheet",children:e.jsx("img",{src:o,alt:"",draggable:!1,onError:()=>s(o)})}):e.jsx(kn,{type:t.type,title:t.title})})}const gt="[role^=menuitem]";function ba(t,a){if(t.key==="Escape"){t.preventDefault(),t.stopPropagation(),a();return}if(t.key!=="ArrowDown"&&t.key!=="ArrowUp")return;t.preventDefault(),t.stopPropagation();const o=[...t.currentTarget.querySelectorAll(gt)].filter(s=>s.closest("[role=menu]")===t.currentTarget),n=o.indexOf(document.activeElement);o[(n+(t.key==="ArrowDown"?1:o.length-1))%o.length]?.focus()}function xt({anchor:t,label:a,onClose:o,onKey:n,children:s}){const r=h.useRef(null),[i,c]=h.useState({visibility:"hidden"});h.useLayoutEffect(()=>{const g=t.getBoundingClientRect(),l=r.current?.offsetHeight??0,p=r.current?.offsetWidth??0,y=Math.max(8,window.innerWidth-g.right),j=g.bottom+6+l<=window.innerHeight-8;c({right:window.innerWidth-y-p<8?window.innerWidth-p-8:y,...j?{top:g.bottom+6}:{bottom:Math.max(8,window.innerHeight-g.top+6)}})},[t]);const u=i.visibility!=="hidden";return h.useEffect(()=>{u&&r.current?.querySelector(gt)?.focus({preventScroll:!0})},[u]),h.useEffect(()=>{const g=p=>{const y=p.target;!r.current?.contains(y)&&!t.contains(y)&&o()},l=()=>o();return document.addEventListener("pointerdown",g,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("pointerdown",g,!0),window.removeEventListener("resize",l)}},[t,o]),e.jsx("div",{ref:r,className:"oa-menu",role:"menu","aria-label":a,style:i,onKeyDown:g=>{if(n&&!g.metaKey&&!g.ctrlKey&&!g.altKey&&n(g.key.toLowerCase())){g.preventDefault();return}ba(g,()=>{o(),t.focus()})},children:s})}function at({label:t,on:a,count:o,onPick:n}){return e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitemradio","aria-checked":a,onClick:n,children:[e.jsx("span",{className:"oa-menu-label",children:t}),o!==void 0&&e.jsx("span",{className:"oa-menu-count",children:o}),a&&e.jsx("span",{className:"oa-tick",children:e.jsx(M,{d:S.tick})})]})}function ke({id:t,label:a,value:o,open:n,setOpen:s,children:r}){const i=n===t,c=h.useRef(null),[u,g]=h.useState(!1);return h.useLayoutEffect(()=>{i&&c.current&&g(c.current.getBoundingClientRect().right+(u?c.current.offsetWidth:0)>window.innerWidth-8)},[i]),e.jsxs("div",{className:"oa-menu-row",onMouseEnter:()=>s(t),children:[e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem","aria-haspopup":"menu","aria-expanded":i,onClick:()=>s(i?null:t),onKeyDown:l=>{(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s(t),requestAnimationFrame(()=>c.current?.querySelector(gt)?.focus()))},children:[e.jsx("span",{className:"oa-menu-label",children:a}),e.jsx("span",{className:"oa-menu-value",children:o}),e.jsx("span",{className:"oa-menu-chev",children:e.jsx(M,{d:S.chevron,size:12})})]}),i&&e.jsx("div",{ref:c,className:"oa-submenu",role:"menu","aria-label":a,"data-flip":u,onKeyDown:l=>{if(l.key==="ArrowLeft"||l.key==="Escape"){l.preventDefault(),l.stopPropagation(),s(null),l.currentTarget.previousElementSibling?.focus();return}ba(l,()=>s(null))},children:r})]})}function As({anchor:t,filters:a,setFilters:o,types:n,counts:s,projects:r,t:i,onClose:c}){const[u,g]=h.useState(null),l=m=>_e(i,m,n.find(d=>d.id===m)?.title),p=a.types.length===0?i("filter.any"):a.types.length===1?l(a.types[0]):i("filter.some",{count:String(a.types.length)}),y=m=>m.project===Xt?i("filter.noProject"):m.label,j=r.find(m=>m.project===a.projects[0]),b=a.projects.length===0?i("filter.any"):a.projects.length===1?j?y(j):dt(a.projects[0]):i("filter.some",{count:String(a.projects.length)});return e.jsxs(xt,{anchor:t,label:i("filter.button"),onClose:c,children:[e.jsx(ke,{id:"sort",label:i("filter.sort"),value:i(`sort.${a.sort}`),open:u,setOpen:g,children:nn.map(m=>e.jsx(at,{label:i(`sort.${m}`),on:a.sort===m,onPick:()=>o({...a,sort:m})},m))}),e.jsx("div",{className:"oa-menu-rule",role:"separator"}),e.jsx(ke,{id:"type",label:i("filter.type"),value:p,open:u,setOpen:g,children:n.map(({id:m})=>{const d=a.types.includes(m);return e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitemcheckbox","aria-checked":d,onClick:()=>o({...a,types:d?a.types.filter(f=>f!==m):[...a.types,m]}),children:[e.jsx("span",{className:"oa-check","data-on":d,children:e.jsx(M,{d:S.tick,size:12})}),e.jsx("span",{className:"oa-menu-label",children:l(m)}),e.jsx("span",{className:"oa-menu-count",children:s.get(m)??0})]},m)})}),r.length>0&&e.jsx(ke,{id:"project",label:i("filter.project"),value:b,open:u,setOpen:g,children:r.map(m=>{const d=a.projects.includes(m.project);return e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitemcheckbox","aria-checked":d,title:m.project||void 0,"data-project":m.project,onClick:()=>o({...a,projects:d?a.projects.filter(f=>f!==m.project):[...a.projects,m.project]}),children:[e.jsx("span",{className:"oa-check","data-on":d,children:e.jsx(M,{d:S.tick,size:12})}),e.jsx("span",{className:"oa-menu-label",children:y(m)}),e.jsx("span",{className:"oa-menu-count",children:m.count})]},m.project||"none")})}),e.jsx(ke,{id:"date",label:i("filter.date"),value:i(`date.${a.date}`),open:u,setOpen:g,children:sn.map(m=>e.jsx(at,{label:i(`date.${m}`),on:a.date===m,onPick:()=>o({...a,date:m})},m))}),e.jsx(ke,{id:"sharing",label:i("filter.sharing"),value:i(`sharing.${a.sharing}`),open:u,setOpen:g,children:Co.map(m=>e.jsx(at,{label:i(`sharing.${m}`),on:a.sharing===m,onPick:()=>o({...a,sharing:m})},m))}),e.jsx("div",{className:"oa-menu-rule",role:"separator"}),e.jsxs("div",{onMouseEnter:()=>g(null),children:[e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitemcheckbox","aria-checked":a.pinned,onClick:()=>o({...a,pinned:!a.pinned}),children:[e.jsx("span",{className:"oa-menu-label",children:i("filter.pinned")}),a.pinned&&e.jsx("span",{className:"oa-tick",children:e.jsx(M,{d:S.tick})})]}),nt(a)&&e.jsx("button",{type:"button",className:"oa-menu-item",role:"menuitem",onClick:()=>o({...ze,sort:a.sort}),children:e.jsx("span",{className:"oa-menu-label",children:i("filter.clear")})})]})]})}function Os({anchor:t,artifact:a,t:o,onClose:n,act:s,extra:r=[],onExtra:i}){const c=(u,g,l,p)=>e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem","aria-keyshortcuts":p,onClick:()=>s(u),children:[e.jsx(M,{d:g}),e.jsx("span",{className:"oa-menu-label",children:l}),e.jsx("kbd",{className:"oa-menu-key",children:p})]});return e.jsxs(xt,{anchor:t,label:o("action.more"),onClose:n,onKey:u=>{const g={p:"pin",r:"rename",c:"copy",s:"share"}[u];return g===void 0?!1:(s(g),!0)},children:[c("pin",S.pin,o(a.pinned?"action.unpin":"action.pin"),"P"),c("rename",S.rename,o("action.rename"),"R"),c("copy",S.link,o("action.copy"),"C"),c("share",S.share,o("action.share"),"S"),r.map(u=>e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem","data-action":u.id,onClick:()=>i?.(u),children:[e.jsx(M,{d:u.icon??""}),e.jsx("span",{className:"oa-menu-label",children:u.label})]},u.id)),e.jsx("div",{className:"oa-menu-rule",role:"separator"}),e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem","data-danger":"true",onClick:()=>s("delete"),children:[e.jsx(M,{d:S.trash}),e.jsx("span",{className:"oa-menu-label",children:o("action.delete")})]})]})}function Ps({anchor:t,tiles:a,canCreate:o,session:n,t:s,onClose:r,create:i}){return e.jsxs(xt,{anchor:t,label:s("create.new"),onClose:r,children:[n&&e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem",disabled:!o,onClick:()=>i(),children:[e.jsx(M,{d:S.chat}),e.jsx("span",{className:"oa-menu-label",children:s("create.session")})]}),n&&a.length>0&&e.jsx("div",{className:"oa-menu-rule",role:"separator"}),a.map(c=>e.jsxs("button",{type:"button",className:"oa-menu-item",role:"menuitem","data-type":c.id,onClick:()=>i(c.id),style:fe(c.id),children:[e.jsx("span",{className:"oa-menu-glyph",children:e.jsx(Me,{type:c.id,size:16})}),e.jsx("span",{className:"oa-menu-label",children:_e(s,c.id,c.title)})]},c.id))]})}function Ds({artifact:t,t:a,onClose:o,onSave:n}){const[s,r]=h.useState(t.title),i=h.useRef(null);h.useEffect(()=>{i.current?.focus(),i.current?.select()},[]);const c=s.trim(),u=c!==""&&c!==t.title;return e.jsx(se,{label:a("rename.title"),onClose:o,children:e.jsxs("form",{onSubmit:g=>{g.preventDefault(),u&&n(c)},children:[e.jsx("h2",{children:a("rename.title")}),e.jsx("input",{ref:i,value:s,"aria-label":a("rename.title"),maxLength:200,onChange:g=>r(g.target.value)}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:o,children:a("dialog.cancel")}),e.jsx("button",{type:"submit",className:"oa-btn","data-primary":"true",disabled:!u,children:a("rename.save")})]})]})})}function Fs({artifact:t,t:a,onClose:o,onDelete:n}){const s=h.useRef(null);h.useEffect(()=>s.current?.focus(),[]);const r=a("delete.title",{title:t.title});return e.jsxs(se,{label:r,onClose:o,children:[e.jsx("h2",{children:r}),e.jsx("p",{children:a("delete.moves")}),t.webShare&&e.jsx("p",{"data-webshare":"",children:a("delete.webShared",{url:t.webShare.url,manage:t.webShare.manage})}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:o,children:a("dialog.cancel")}),e.jsx("button",{ref:s,type:"button",className:"oa-btn","data-danger":"true",onClick:n,children:a("delete.confirm")})]})]})}function Is({t}){const a=O(b=>b.importDialog),o=O(b=>b.importing),n=O(b=>b.setImportLink),s=O(b=>b.closeImport),r=O(b=>b.importLink),i=O(b=>b.openImported),c=h.useRef(null),u=h.useRef(null),g=h.useRef(null),l=a?.done??null;if(h.useEffect(()=>{l!==null?g.current?.focus():o?c.current?.focus():u.current?.focus()},[o,l]),a===null)return null;const p=a.link.trim(),y=Se(p)!==null,j=p!==""&&!y&&l===null;return e.jsx(se,{label:t("importLink.title"),onClose:s,testId:"import-link-dialog",children:e.jsxs("form",{ref:c,className:"oa-import",tabIndex:-1,noValidate:!0,onSubmit:b=>{b.preventDefault(),l!==null?i():y&&!o&&r()},children:[e.jsx("h2",{children:t("importLink.title")}),e.jsx("p",{className:"oa-import-text",children:t("importLink.body")}),e.jsx("input",{ref:u,type:"url",value:a.link,"aria-label":t("importLink.input"),placeholder:t("importLink.placeholder"),autoComplete:"off",spellCheck:!1,disabled:o||l!==null,...j?{"aria-invalid":!0,"aria-describedby":"oa-import-hint"}:{},onChange:b=>n(b.target.value)}),j&&e.jsx("p",{id:"oa-import-hint",className:"oa-import-note",children:t("importLink.invalid")}),a.error&&e.jsx("p",{className:"oa-import-note",role:"alert","data-kind":"error",children:a.error}),l!==null&&e.jsxs("p",{className:"oa-import-note",role:"status","data-kind":"notes",children:[t("importLink.doneNotes",{title:l.artifact.title}),l.notes.map((b,m)=>e.jsxs(h.Fragment,{children:[" ",e.jsx("span",{className:"oa-import-left",children:b})]},m))]}),e.jsxs("div",{className:"oa-dialog-actions",children:[e.jsx("button",{type:"button",className:"oa-btn",onClick:s,children:t(l!==null?"dialog.close":"dialog.cancel")}),e.jsx("button",{ref:g,type:"submit",className:"oa-btn","data-primary":"true",disabled:l===null&&(!y||o),children:t(l!==null?"importLink.open":o?"importLink.copying":"importLink.copy")})]})]})})}function Rs(t,a){return t===null?!1:a===document.body||a===document.documentElement||a===document||a instanceof Node&&t.contains(a)}const ot=()=>document.querySelector('[aria-modal="true"]')!==null;function zs(){const{t}=W(),a=O(s=>s.toast),o=O(s=>s.dismissToast),n=O(s=>s.undo);return h.useEffect(()=>{if(a===null)return;const s=setTimeout(o,a.undo||a.kind==="error"?1e4:4e3);return()=>clearTimeout(s)},[a,o]),a===null?null:e.jsxs("div",{className:"oa-toast",role:a.kind==="error"?"alert":"status","data-kind":a.kind,children:[e.jsx(M,{d:S.info}),e.jsx("span",{className:"oa-toast-text",children:a.message}),a.undo&&e.jsx("button",{type:"button",className:"oa-toast-undo",onClick:()=>{n(a.undo)},children:t("toast.undo")}),e.jsx("button",{type:"button",className:"oa-toast-close","aria-label":t("toast.close"),onClick:o,children:e.jsx(M,{d:S.clear,size:14})})]},a.id)}const ya=(t,a)=>[t.root,t.project&&!t.root.startsWith(t.project)?t.project:"",a].filter(Boolean).join(`
2
+ `);function va({artifact:t,t:a,onPin:o}){const n=a(t.pinned?"action.unpin":"action.pin");return e.jsx("button",{type:"button",className:"oa-act","data-on":t.pinned,"aria-pressed":t.pinned,"aria-label":n,title:n,onClick:()=>o(t),children:t.pinned?e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",style:Ee(16),children:e.jsx("path",{d:"M9.75 2.25 13.75 6.25M10.75 3.25 7 6.25 4.5 6.5 9.5 11.5 9.75 9 12.75 5.25M7 9l-4 4",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})}):e.jsx(M,{d:S.pin})})}function ja({artifact:t,t:a,menuOpen:o,onMenu:n,extra:s}){return e.jsx("button",{type:"button",className:`oa-act ${s??""}`,"aria-label":a("action.more"),title:a("action.more"),"aria-haspopup":"menu","aria-expanded":o,onClick:r=>n(t,r.currentTarget),children:e.jsx(M,{d:S.more})})}function Us({artifact:t,opening:a,conversation:o,now:n,t:s,onOpen:r,onPin:i,menuOpen:c,onMenu:u}){const g=a===t.id;return e.jsxs("li",{className:"oa-item","data-menu":c,style:fe(t.type),children:[e.jsxs("button",{type:"button",className:"oa-card",disabled:a!==null,"aria-busy":g,title:ya(t,o),onClick:()=>r(t),"data-type":t.type,children:[e.jsxs("span",{className:"oa-preview-wrap",style:{display:"block",position:"relative",width:"100%"},children:[e.jsx(Ls,{artifact:t}),g&&e.jsxs("span",{className:"oa-busy",children:[e.jsx("span",{className:"oa-spinner"}),s("card.opening")]})]}),e.jsxs("span",{className:"oa-info",children:[e.jsx("span",{className:"oa-glyph",children:e.jsx(Me,{type:t.type})}),e.jsxs("span",{className:"oa-text",children:[e.jsx("span",{className:"oa-name",children:t.title}),e.jsxs("span",{className:"oa-meta",children:[t.project?e.jsxs("span",{className:"oa-project","data-project":t.project,children:[dt(t.project)," · "]}):null,fa(t.openedAt,n,s)]})]})]})]}),e.jsxs("div",{className:"oa-actions",children:[e.jsx(ja,{artifact:t,t:s,menuOpen:c,onMenu:u}),e.jsx(va,{artifact:t,t:s,onPin:i})]})]})}function $s({artifact:t,opening:a,conversation:o,now:n,t:s,onOpen:r,onPin:i,menuOpen:c,onMenu:u}){const g=a===t.id;return e.jsxs("li",{className:"oa-item","data-menu":c,style:fe(t.type),children:[e.jsxs("button",{type:"button",className:"oa-row",disabled:a!==null,"aria-busy":g,title:ya(t,o),onClick:()=>r(t),"data-type":t.type,children:[e.jsx("span",{className:"oa-glyph",children:g?e.jsx("span",{className:"oa-spinner"}):e.jsx(Me,{type:t.type})}),e.jsx("span",{className:"oa-name",children:t.title}),e.jsx("span",{className:"oa-meta",children:g?s("card.opening"):e.jsxs(e.Fragment,{children:[t.project?e.jsxs("span",{className:"oa-project","data-project":t.project,children:[dt(t.project)," · "]}):null,fa(t.openedAt,n,s)]})})]}),e.jsxs("div",{className:"oa-row-tools",children:[t.shared&&e.jsx("span",{className:"oa-shared",title:s("card.shared"),"aria-label":s("card.shared"),children:e.jsx(M,{d:S.people})}),t.webShare&&e.jsx("span",{className:"oa-shared","data-webshare":"",title:`${s("card.webShared")}: ${t.webShare.url}`,"aria-label":s("card.webShared"),children:e.jsx(M,{d:S.globe})}),e.jsx(va,{artifact:t,t:s,onPin:i}),e.jsx(ja,{artifact:t,t:s,menuOpen:c,onMenu:u,extra:"oa-act-more"})]})]})}const _s=350,Hs=160,wa="oa-peek-about";function Bs({tile:t,anchor:a,t:o,onAct:n,onEnter:s,onLeave:r,onClose:i}){const c=h.useRef(null),[u,g]=h.useState({visibility:"hidden"});h.useLayoutEffect(()=>{const p=a.getBoundingClientRect(),y=c.current?.offsetWidth??0,j=c.current?.offsetHeight??0,b=p.bottom+8;g({left:Math.max(8,Math.min(p.left,window.innerWidth-y-8)),top:b+j<=window.innerHeight-8?b:Math.max(8,p.top-8-j)})},[a]),h.useEffect(()=>{const p=()=>i();return window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[i]);const l=_e(o,t.id,t.title);return e.jsxs("div",{ref:c,className:"oa-peek",role:"group","aria-label":l,"data-testid":"open-artifacts-peek","data-type":t.id,style:{...fe(t.id),...u},onPointerEnter:s,onPointerLeave:r,onKeyDown:p=>{p.key==="Escape"&&(i(),a.focus())},children:[e.jsx("div",{className:"oa-peek-title",children:l}),e.jsx("div",{className:"oa-peek-by",children:o("peek.by")}),e.jsx("p",{className:"oa-peek-about",id:wa,children:Ms(o,t.id,t.description)}),e.jsx("button",{type:"button",className:"oa-peek-act",onClick:n,children:o("peek.start")})]})}function Ks(t,a){const o=new Set(a.flatMap(s=>s.types)),n=t.filter(s=>!o.has(s.id));return a.map((s,r)=>({group:s,tiles:[...s.types.map(i=>t.find(c=>c.id===i)).filter(i=>i!==void 0),...r===a.length-1?n:[]]})).filter(s=>s.tiles.length>0)}function Ws({canCreate:t,theme:a,platform:o,searchButton:n=!0,createButton:s=!0,createSession:r=!0,importButton:i=!0,tileGroups:c,headingTools:u,cardActions:g,settingsSections:l}){const{t:p,api:y,settings:j}=W(),b=typeof y.importLink=="function",m=on(),d=O(x=>x.status),f=O(x=>x.artifacts),N=O(x=>x.types),w=O(x=>x.error),E=O(x=>x.opening),v=O(x=>x.filters),C=O(x=>x.query),R=O(x=>x.layout),k=O(x=>x.dialog),F=O(x=>x.importDialog),H=O(x=>x.openImport),B=O(x=>x.searchFocus),ye=O(x=>x.settings),Oe=O(x=>x.openSettings),He=O(x=>x.closeSettings),q=ye!==null&&j!==void 0,re=h.useRef(null);h.useLayoutEffect(()=>{re.current&&(re.current.scrollTop=0)},[q]);const{reload:T,watchEvents:z,watchThumbnails:K,setFilters:Y,setQuery:ie,setLayout:le,openDialog:Ma,closeDialog:Pe,open:La,create:yt,pin:vt,rename:Aa,copyLink:Oa,share:Pa,remove:Da}=O(x=>x),[ce,Be]=h.useState(null),de=h.useRef(void 0),De=h.useRef(!1),[Ke,Fe]=h.useState(!1),[G,J]=h.useState(null),ve=h.useRef(null),jt=h.useRef(null),We=Es(),wt=be().open,Ie=b&&!q&&k===null&&F===null&&!wt;h.useEffect(()=>{T();const x=()=>{document.visibilityState==="visible"&&T()};return document.addEventListener("visibilitychange",x),()=>document.removeEventListener("visibilitychange",x)},[T]),h.useEffect(()=>z(),[z]),h.useEffect(()=>K(),[K]),h.useEffect(()=>{if(!Ie)return;const x=P=>{if(P.defaultPrevented||Qe(P.target)||!Rs(jt.current,P.target)||ot())return;const U=Se(P.clipboardData?.getData("text/plain"));U!==null&&(P.preventDefault(),J(null),H(U))};return document.addEventListener("paste",x),()=>document.removeEventListener("paste",x)},[Ie,H]),h.useEffect(()=>{Ke&&ve.current?.focus()},[Ke]),h.useEffect(()=>{B!==0&&(Fe(!0),ve.current?.focus(),ve.current?.select())},[B]);const qe=h.useMemo(()=>dn(f),[f]),Fa=h.useMemo(()=>So(f,p("time.locale")),[f,p]),je=h.useMemo(()=>zt(N.map(x=>x.id)).map(x=>N.find(P=>P.id===x)),[N]),Ia=h.useMemo(()=>zt([...N.map(x=>x.id),...qe.keys()]).map(x=>({id:x,title:N.find(P=>P.id===x)?.title||f.find(P=>P.type===x)?.typeTitle||x})),[N,qe,f]),we=h.useMemo(()=>()=>{clearTimeout(de.current),De.current=!1,Be(null)},[]);h.useEffect(()=>()=>clearTimeout(de.current),[]),h.useEffect(()=>{q&&(J(null),we())},[q,we]);const kt=(x,P,U=!1)=>{clearTimeout(de.current),de.current=setTimeout(()=>Be({id:x,anchor:P}),U||ce!==null?0:_s)},Ve=()=>{clearTimeout(de.current),de.current=setTimeout(()=>Be(null),Hs)},Nt=x=>{we(),yt(x)},Ge=h.useMemo(()=>cn(f,{filters:v,query:C,now:We,locale:p("time.locale"),sessionTitle:m}),[f,v,C,We,p,m]),Ye=h.useMemo(()=>()=>J(null),[]),te=G?.kind==="actions"?f.find(x=>x.id===G.id):void 0,ue=k?f.find(x=>x.id===k.id):void 0,Ze=ce===null?void 0:je.find(x=>x.id===ce.id),St=x=>({artifact:x,opening:E,conversation:m(x.sessionId),now:We,t:p,onOpen:P=>{La(P)},onPin:P=>{vt(P,!P.pinned)},menuOpen:G?.kind==="actions"&&G.id===x.id,onMenu:(P,U)=>J(Mt=>Mt?.kind==="actions"&&Mt.id===P.id?null:{kind:"actions",anchor:U,id:P.id})}),Ct=x=>{const P=ce?.id===x.id;return e.jsx("li",{onPointerEnter:U=>U.pointerType!=="touch"&&kt(x.id,U.currentTarget.firstElementChild),onPointerLeave:Ve,children:e.jsxs("button",{type:"button",className:"oa-tile","data-type":x.id,...P?{"data-peek":"true","aria-describedby":wa}:{},style:fe(x.id),onClick:()=>Nt(x.id),onFocus:U=>{U.currentTarget.matches(":focus-visible")&&kt(x.id,U.currentTarget,!0)},onBlur:()=>{De.current||Ve()},onKeyDown:U=>{U.key==="Escape"&&ce!==null&&we()},children:[e.jsxs("span",{className:"oa-tile-art",children:[e.jsx(wn,{type:x.id}),e.jsx(Me,{type:x.id,size:42}),vn.includes(x.id)&&e.jsx("span",{className:"oa-tile-beta",children:p("tile.beta")})]}),e.jsx("span",{className:"oa-tile-label",children:_e(p,x.id,x.title)})]})},x.id)},Tt=(x,P)=>J(U=>U?.kind===x?null:{kind:x,anchor:P}),Et=e.jsxs("div",{className:"oa-tools",children:[u,!q&&e.jsxs(e.Fragment,{children:[Ke||C?e.jsxs("label",{className:"oa-search",children:[e.jsx(M,{d:S.search,size:14}),e.jsx("input",{ref:ve,type:"search",value:C,placeholder:p("search"),"aria-label":p("search"),onChange:x=>ie(x.target.value),onBlur:()=>{C||Fe(!1)},onKeyDown:x=>{x.nativeEvent.isComposing||x.keyCode===229||x.key==="Escape"&&(ie(""),Fe(!1))}}),C&&e.jsx("button",{type:"button","aria-label":p("search.clear"),onClick:()=>{ie(""),ve.current?.focus()},children:e.jsx(M,{d:S.clear,size:12})})]}):n?e.jsx("button",{type:"button",className:"oa-tool","aria-label":p("search"),title:p("search"),onClick:()=>Fe(!0),children:e.jsx(M,{d:S.search,size:18})}):null,e.jsx("button",{type:"button",className:"oa-tool","aria-label":p("filter.button"),title:p("filter.button"),"aria-haspopup":"menu","aria-expanded":G?.kind==="filter","data-active":nt(v),onClick:x=>Tt("filter",x.currentTarget),children:e.jsx(M,{d:S.filter,size:18})}),e.jsx("button",{type:"button",className:"oa-tool","aria-label":p(R==="grid"?"view.list":"view.grid"),title:p(R==="grid"?"view.list":"view.grid"),onClick:()=>le(R==="grid"?"list":"grid"),children:e.jsx(M,{d:R==="grid"?S.list:S.grid,size:18})}),b&&i&&e.jsx("button",{type:"button",className:"oa-tool","aria-label":p("importLink.entry"),title:p("importLink.entry"),"aria-haspopup":"dialog","data-testid":"import-link",onClick:()=>H(),children:e.jsx(M,{d:S.importLink,size:18})}),t&&s&&e.jsx("button",{type:"button",className:"oa-tool","aria-label":p("create.new"),title:p("create.new"),"aria-haspopup":"menu","aria-expanded":G?.kind==="create",onClick:x=>Tt("create",x.currentTarget),children:e.jsx(M,{d:S.plus,size:18})})]})]});return e.jsxs("section",{ref:jt,className:"oa-page","aria-label":p("title"),"data-testid":"open-artifacts-page","data-theme":a,"data-platform":o,onDragOver:x=>{!Ie||!Ft([...x.dataTransfer.types])||Qe(x.target)||ot()||(x.preventDefault(),x.dataTransfer.dropEffect="copy")},onDrop:x=>{if(!Ie||!Ft([...x.dataTransfer.types])||Qe(x.target)||ot())return;const P=gn(U=>x.dataTransfer.getData(U));P!==null&&(x.preventDefault(),J(null),H(P))},children:[e.jsx("div",{className:"oa-scroll",ref:re,children:e.jsxs("div",{className:"oa-content",children:[e.jsxs("div",{className:"oa-heading","data-tabs":j!==void 0,children:[e.jsxs("div",{className:"oa-title",children:[e.jsx("h1",{children:p("title")}),e.jsx($n,{})]}),j===void 0&&Et]}),j!==void 0&&e.jsxs("div",{className:"oa-tabbar",children:[e.jsxs("nav",{className:"oa-tabs","aria-label":p("tab.label"),children:[e.jsx("button",{type:"button",className:"oa-tab","data-testid":"tab-artifacts","aria-current":q?void 0:"page",onClick:()=>q&&He(),children:p("tab.artifacts")}),e.jsx("button",{type:"button",className:"oa-tab","data-testid":"tab-settings","aria-current":q?"page":void 0,onClick:()=>!q&&Oe(),children:p("settings")})]}),Et]}),q?e.jsx(Cs,{sections:l,canCreate:t}):e.jsxs(e.Fragment,{children:[e.jsx(Bn,{}),e.jsx(zn,{}),t&&je.length>0&&e.jsxs(e.Fragment,{children:[c===void 0?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"oa-section-title",children:p("create.heading")}),e.jsx("ul",{className:"oa-tiles",children:je.map(Ct)})]}):e.jsx("div",{className:"oa-tile-groups",children:Ks(je,c).map(({group:x,tiles:P})=>e.jsxs("section",{className:"oa-tile-group","data-group":x.id,"aria-label":x.title,children:[e.jsx("h2",{className:"oa-section-title",children:x.title}),e.jsx("ul",{className:"oa-tiles",children:P.map(Ct)})]},x.id))}),ce!==null&&Ze!==void 0&&G===null&&e.jsx(Bs,{tile:Ze,anchor:ce.anchor,t:p,onAct:()=>Nt(Ze.id),onEnter:()=>{De.current=!0,clearTimeout(de.current)},onLeave:()=>{De.current=!1,Ve()},onClose:we})]}),d==="loading"&&f.length===0?e.jsx("ul",{className:"oa-grid oa-skeleton","aria-hidden":"true",children:[0,1,2].map(x=>e.jsx("li",{className:"oa-item",children:e.jsxs("div",{className:"oa-card",children:[e.jsx("div",{className:"oa-preview"}),e.jsx("div",{className:"oa-line"})]})},x))}):d==="error"&&f.length===0?e.jsxs("div",{className:"oa-empty",role:"alert",children:[e.jsx("p",{children:p("load.error",{message:w})}),e.jsx("button",{type:"button",className:"oa-retry",onClick:()=>{T()},children:p("load.retry")})]}):f.length===0?e.jsxs("div",{className:"oa-empty",children:[e.jsx(jn,{size:28}),e.jsx("h2",{children:p("empty.title")}),e.jsx("p",{children:p("empty.body")})]}):Ge.length===0?e.jsxs("div",{className:"oa-empty",children:[e.jsx("p",{children:p("empty.noMatches")}),nt(v)&&e.jsx("button",{type:"button",className:"oa-retry",onClick:()=>Y({...ze,sort:v.sort}),children:p("filter.clear")})]}):R==="grid"?e.jsx("ul",{className:"oa-grid",children:Ge.map(x=>e.jsx(Us,{...St(x)},x.id))}):e.jsx("ul",{className:"oa-list",children:Ge.map(x=>e.jsx($s,{...St(x)},x.id))}),e.jsx(_n,{})]})]})}),G?.kind==="filter"&&e.jsx(As,{anchor:G.anchor,filters:v,setFilters:x=>Y(x),types:Ia,counts:qe,projects:Fa,t:p,onClose:Ye}),G?.kind==="create"&&e.jsx(Ps,{anchor:G.anchor,tiles:je,canCreate:t,session:r,t:p,onClose:Ye,create:x=>{J(null),yt(x)}}),G?.kind==="actions"&&te&&e.jsx(Os,{anchor:G.anchor,artifact:te,t:p,onClose:Ye,extra:g,onExtra:x=>{J(null),x.run(te)},act:x=>{J(null),x==="pin"?vt(te,!te.pinned):x==="copy"?Oa(te):x==="share"?Pa(te):Ma({kind:x,id:te.id})}}),k?.kind==="rename"&&ue&&e.jsx(Ds,{artifact:ue,t:p,onClose:Pe,onSave:x=>{Pe(),Aa(ue,x)}}),k?.kind==="delete"&&ue&&e.jsx(Fs,{artifact:ue,t:p,onClose:Pe,onDelete:()=>{Pe(),Da(ue)}}),b&&F!==null&&e.jsx(Is,{t:p}),wt&&e.jsx(se,{label:p("changelog.title"),onClose:ha,wide:!0,children:e.jsx(Hn,{})}),e.jsx(zs,{})]})}const qs=`
3
+ .oa-page{position:relative;width:100%;min-width:0;height:100%;min-height:0;color:var(--oa-page-text-primary);background:var(--oa-page-bg);font-size:14px;line-height:1.6;display:flex;flex-direction:column;overflow:hidden}
4
+ .oa-scroll{flex:1;min-height:0;overflow:auto;scrollbar-gutter:stable}
5
+ .oa-content{max-width:1120px;margin:0 auto;padding:0 clamp(24px,4vw,48px) 56px}
6
+ .oa-heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 16px;padding-top:28px;margin-bottom:24px}
7
+ :where(.oa-page)[data-platform=darwin] .oa-heading{padding-top:calc(28px + var(--oa-page-top-clearance,0px))}
8
+ .oa-heading h1{margin:0;font-size:28px;font-weight:600;line-height:36px;letter-spacing:-.01em}
9
+ .oa-heading[data-tabs=true]{margin-bottom:12px}
10
+ .oa-tabbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-bottom:24px}
11
+ .oa-tabs{display:flex;align-items:center;gap:24px;min-width:0}
12
+ .oa-tab{position:relative;padding:5px 0 9px;border:0;background:none;color:var(--oa-page-text-secondary);font:inherit;font-size:15px;line-height:22px;white-space:nowrap;cursor:pointer}
13
+ .oa-tab:hover,.oa-tab[aria-current=page]{color:var(--oa-page-text-primary)}
14
+ .oa-tab[aria-current=page]::after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;border-radius:1px;background:currentColor}
15
+ .oa-tab:focus-visible{outline:2px solid var(--oa-page-accent);outline-offset:2px;border-radius:4px}
16
+ .oa-title{display:flex;align-items:center;gap:8px;min-width:0}
17
+ .oa-version{position:relative;flex:none;display:inline-flex;align-items:center;height:20px;padding:0 7px;border:0;border-radius:10px;background:var(--oa-page-hover-bg);color:var(--oa-page-text-tertiary);font:inherit;font-size:12px;line-height:20px;font-variant-numeric:tabular-nums;cursor:pointer}
18
+ .oa-version:hover{color:var(--oa-page-text-secondary)}
19
+ .oa-version:focus-visible{outline:2px solid var(--oa-page-accent);outline-offset:2px}
20
+ .oa-version-dot{position:absolute;top:-1px;right:-1px;width:7px;height:7px;border-radius:50%;background:var(--oa-page-accent);box-shadow:0 0 0 2px var(--oa-page-bg,transparent)}
21
+ .oa-tools{display:flex;align-items:center;gap:4px;margin-left:auto}
22
+ .oa-tool{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:8px;background:none;color:var(--oa-page-text-secondary);cursor:pointer}
23
+ .oa-tool:hover,.oa-tool[aria-expanded=true]{background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary)}
24
+ .oa-tool[data-active=true]::after{content:"";position:absolute;top:6px;right:6px;width:6px;height:6px;border-radius:50%;background:var(--oa-page-accent)}
25
+ .oa-search{display:flex;align-items:center;gap:6px;width:min(240px,50vw);height:32px;padding:0 8px 0 10px;border:.5px solid var(--oa-page-border);border-radius:8px;color:var(--oa-page-text-tertiary)}
26
+ .oa-search:focus-within{border-color:var(--oa-page-accent)}
27
+ .oa-search input{flex:1;min-width:0;height:100%;border:0;padding:0;background:none;color:var(--oa-page-text-primary);font:inherit;font-size:13px;outline:none}
28
+ .oa-search input::placeholder{color:var(--oa-page-text-caption)}
29
+ .oa-search input::-webkit-search-cancel-button{display:none}
30
+ .oa-search button{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin-right:-4px;padding:0;border:0;border-radius:6px;background:none;color:inherit;cursor:pointer}
31
+ .oa-search button:hover{background:var(--oa-page-hover-bg)}
32
+ .oa-section-title{margin:0 0 12px;font-size:13px;font-weight:400;line-height:20px;color:var(--oa-page-text-tertiary)}
33
+ .oa-tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:14px 10px;margin:0 0 36px;padding:0;list-style:none}
34
+ .oa-tile-groups{display:flex;flex-wrap:wrap;gap:20px 28px;margin:0 0 36px}
35
+ .oa-tile-group{display:flex;flex-direction:column;min-width:0}
36
+ .oa-tile-group .oa-section-title{margin-bottom:10px}
37
+ .oa-tile-group .oa-tiles{display:flex;flex-wrap:wrap;gap:10px;margin:0}
38
+ .oa-tile-group .oa-tiles>li{width:112px}
39
+ .oa-tile{display:flex;flex-direction:column;gap:8px;width:100%;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
40
+ .oa-tile-art{position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:10/7;border-radius:14px;overflow:hidden;background:var(--oa-wash);color:var(--oa-ink);transition:transform .2s cubic-bezier(.2,.7,.3,1),background-color .15s}
41
+ .oa-tile:hover .oa-tile-art,.oa-tile[data-peek=true] .oa-tile-art{transform:scale(1.03)}
42
+ .oa-tile:focus-visible{outline:none}
43
+ .oa-tile:focus-visible .oa-tile-art{outline:var(--oa-page-focus-ring-width,2px) solid var(--oa-page-focus-ring-color,var(--oa-page-accent));outline-offset:2px}
44
+ .oa-tile-art>svg{position:relative}
45
+ .oa-tile-art>.oa-tile-doodle{position:absolute;inset:0;width:100%;height:100%;opacity:.14;pointer-events:none}
46
+ .oa-tile-beta{position:absolute;top:6px;left:6px;padding:0 6px;border-radius:999px;background:#fff;box-shadow:0 0 0 .5px var(--oa-page-border-floating,rgba(0,0,0,.16));color:var(--oa-page-text-secondary);font-size:11px;line-height:16px}
47
+ .oa-tile-label{display:flex;flex-direction:column;padding-left:2px;font-size:14px;line-height:20px}
48
+ .oa-tile-state{display:inline-flex;align-items:center;gap:5px;color:var(--oa-page-text-tertiary);font-size:12px;line-height:16px}
49
+ .oa-tile-state[data-state=failed]{color:var(--oa-page-danger)}
50
+ .oa-tile-state .oa-spinner{width:9px;height:9px;border-width:1.2px}
51
+ .oa-tile[data-missing=true] .oa-tile-art{background:color-mix(in srgb,var(--oa-wash) 45%,var(--oa-page-bg));color:color-mix(in srgb,var(--oa-ink) 55%,var(--oa-page-bg));box-shadow:inset 0 0 0 .5px color-mix(in srgb,var(--oa-ink) 22%,transparent)}
52
+ .oa-tile[data-missing=true]:hover .oa-tile-art,.oa-tile[data-missing=true][data-peek=true] .oa-tile-art{background:color-mix(in srgb,var(--oa-wash) 65%,var(--oa-page-bg))}
53
+ .oa-tile[data-missing=true] .oa-tile-doodle{opacity:.08}
54
+ .oa-tile[data-missing=true] .oa-tile-label{color:var(--oa-page-text-secondary)}
55
+ :where(.oa-page)[data-theme=dark] .oa-tile-art{background:color-mix(in srgb,var(--oa-ink) 36%,var(--oa-page-bg));color:var(--oa-wash)}
56
+ :where(.oa-page)[data-theme=dark] .oa-tile[data-missing=true] .oa-tile-art{background:color-mix(in srgb,var(--oa-ink) 16%,var(--oa-page-bg));color:color-mix(in srgb,var(--oa-wash) 55%,var(--oa-page-bg));box-shadow:inset 0 0 0 .5px color-mix(in srgb,var(--oa-wash) 18%,transparent)}
57
+ :where(.oa-page)[data-theme=dark] .oa-tile[data-missing=true]:hover .oa-tile-art,:where(.oa-page)[data-theme=dark] .oa-tile[data-missing=true][data-peek=true] .oa-tile-art{background:color-mix(in srgb,var(--oa-ink) 24%,var(--oa-page-bg))}
58
+ :where(.oa-page)[data-theme=dark] .oa-tile-art>.oa-tile-doodle{opacity:.12}
59
+ :where(.oa-page)[data-theme=dark] .oa-tile-beta{background:var(--oa-page-bg)}
60
+ .oa-peek{position:fixed;z-index:900;width:288px;max-width:calc(100vw - 16px);box-sizing:border-box;padding:16px;border:.5px solid var(--oa-page-border-floating,rgba(0,0,0,.16));border-radius:16px;background:var(--oa-page-bg);box-shadow:0 12px 32px -10px rgba(0,0,0,.22);color:var(--oa-page-text-primary);animation:oa-peek-in .14s ease-out}
61
+ .oa-peek-title{font-size:17px;line-height:24px}
62
+ .oa-peek-by{margin-top:2px;font-size:14px;line-height:20px;color:var(--oa-page-text-secondary)}
63
+ .oa-peek-about{margin:6px 0 0;font-size:14px;line-height:20px;color:var(--oa-page-text-secondary)}
64
+ .oa-peek-act{margin-top:14px;height:32px;padding:0 10px;border:0;border-radius:8px;background:color-mix(in srgb,var(--oa-page-text-primary) 6%,var(--oa-page-bg));color:var(--oa-page-text-primary);font:inherit;font-size:14px;cursor:pointer}
65
+ .oa-peek-act:hover{background:color-mix(in srgb,var(--oa-page-text-primary) 10%,var(--oa-page-bg))}
66
+ .oa-peek-act:focus-visible{outline:var(--oa-page-focus-ring-width,2px) solid var(--oa-page-focus-ring-color,var(--oa-page-accent));outline-offset:2px}
67
+ @keyframes oa-peek-in{from{opacity:0;transform:translateY(-4px)}}
68
+ .oa-dialog-head{display:flex;align-items:center;gap:12px;margin-bottom:12px}
69
+ .oa-dialog-head h2{margin:0}
70
+ .oa-dialog .oa-glyph{width:40px;height:40px}
71
+ .oa-dialog p+p{margin-top:8px}
72
+ .oa-dialog p[data-kind=error]{color:var(--oa-page-danger)}
73
+ .oa-dialog-status{display:flex;align-items:center;gap:8px}
74
+ .oa-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:20px;margin:0;padding:0;list-style:none}
75
+ .oa-item{position:relative;min-width:0}
76
+ .oa-card{display:flex;flex-direction:column;width:100%;padding:0;border:.5px solid var(--oa-page-border);border-radius:14px;overflow:hidden;background:var(--oa-page-bg);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background-color .15s}
77
+ .oa-item:hover .oa-card{background:var(--oa-page-hover-bg)}
78
+ .oa-card:disabled{cursor:progress}
79
+ .oa-card:focus-visible,.oa-row:focus-visible{outline:var(--oa-page-focus-ring-width,2px) solid var(--oa-page-focus-ring-color,var(--oa-page-accent));outline-offset:2px}
80
+ .oa-preview{position:relative;display:block;width:100%;aspect-ratio:2/1;overflow:hidden;background:color-mix(in srgb,var(--oa-tint) 16%,var(--oa-page-bg))}
81
+ .oa-sheet{position:absolute;left:12%;right:12%;top:13%;bottom:-8px;border-radius:8px 8px 0 0;overflow:hidden;background:var(--oa-page-bg);box-shadow:0 0 0 .5px var(--oa-page-border),0 6px 18px -8px rgba(0,0,0,.28);transition:transform .2s}
82
+ .oa-item:hover .oa-sheet{transform:translateY(-3px)}
83
+ .oa-sheet img{display:block;width:100%;height:100%;object-fit:cover;object-position:top center;user-select:none}
84
+ .oa-preview[data-stack=true] .oa-sheet{left:20%;right:20%}
85
+ .oa-preview[data-stack=true]::before{content:"";position:absolute;left:21%;right:19%;top:10%;bottom:-8px;border-radius:8px 8px 0 0;background:var(--oa-page-bg);box-shadow:0 0 0 .5px var(--oa-page-border);transform:rotate(1.6deg);transform-origin:bottom center}
86
+ .oa-paper{position:absolute;left:14%;right:14%;top:13%;bottom:-8px;border-radius:8px 8px 0 0;background:var(--oa-page-bg);box-shadow:0 0 0 .5px var(--oa-page-border),0 6px 18px -8px rgba(0,0,0,.25);padding:6% 7% 0;display:flex;flex-direction:column;gap:6px;overflow:hidden;transition:transform .2s}
87
+ .oa-item:hover .oa-paper{transform:translateY(-3px)}
88
+ .oa-paper-title{font-size:11px;line-height:1.35;font-weight:600;color:var(--oa-page-text-primary);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
89
+ .oa-line{height:5px;border-radius:3px;background:var(--oa-page-border)}
90
+ .oa-slide{position:absolute;left:14%;right:14%;top:13%;aspect-ratio:16/9;border-radius:6px;background:var(--oa-page-bg);box-shadow:0 0 0 .5px var(--oa-page-border),0 6px 18px -8px rgba(0,0,0,.25);display:flex;flex-direction:column;justify-content:center;gap:6px;padding:0 9%;transition:transform .2s}
91
+ .oa-item:hover .oa-slide{transform:translateY(-3px)}
92
+ .oa-slide .oa-paper-title{font-size:12px}
93
+ .oa-slide .oa-line{width:40%;background:var(--oa-tint);opacity:.55}
94
+ .oa-boards{display:flex;gap:6px;flex:1;margin-top:2px}
95
+ .oa-board{flex:1;border-radius:3px;background:color-mix(in srgb,var(--oa-tint) 18%,var(--oa-page-bg));box-shadow:0 0 0 .5px var(--oa-page-border)}
96
+ .oa-board:nth-child(2){flex:.7;margin-top:10%}
97
+ .oa-flow{display:block;width:100%;height:auto;margin-top:4px}
98
+ .oa-flow rect{fill:color-mix(in srgb,var(--oa-tint) 18%,var(--oa-page-bg));stroke:var(--oa-page-border);stroke-width:.5}
99
+ .oa-flow path{fill:none;stroke:var(--oa-tint);stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round}
100
+ .oa-cells{display:block;width:100%;height:auto;margin-top:4px}
101
+ .oa-cells path{fill:none;stroke:var(--oa-page-border);stroke-width:.75}
102
+ .oa-cells-head{fill:color-mix(in srgb,var(--oa-tint) 18%,var(--oa-page-bg))}
103
+ .oa-cells-pick{fill:none;stroke:var(--oa-tint);stroke-width:1.5}
104
+ .oa-swatches{display:flex;gap:4px}
105
+ .oa-swatch{width:16px;height:16px;border-radius:50%;background:var(--oa-tint)}
106
+ .oa-swatch:nth-child(2){opacity:.7}.oa-swatch:nth-child(3){opacity:.45}.oa-swatch:nth-child(4){opacity:.25}
107
+ .oa-specimen{font-size:20px;line-height:1;font-weight:600;color:var(--oa-page-text-secondary)}
108
+ .oa-kpis{display:flex;gap:5px}
109
+ .oa-kpi{flex:1;height:16px;border-radius:3px;box-shadow:0 0 0 .5px var(--oa-page-border)}
110
+ .oa-bars{display:flex;align-items:flex-end;gap:5px;height:34%;margin-top:2px}
111
+ .oa-bar{flex:1;border-radius:2px 2px 0 0;background:var(--oa-tint);opacity:.7}
112
+ .oa-film{position:absolute;left:14%;right:14%;top:13%;aspect-ratio:16/9;border-radius:6px;background:#1d1d1f;box-shadow:0 6px 18px -8px rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;transition:transform .2s;color:#fff}
113
+ .oa-item:hover .oa-film{transform:translateY(-3px)}
114
+ .oa-film-bar{position:absolute;left:8%;right:8%;bottom:10%;height:3px;border-radius:2px;background:rgba(255,255,255,.25)}
115
+ .oa-film-bar::after{content:"";position:absolute;left:0;top:0;bottom:0;width:38%;border-radius:2px;background:var(--oa-tint)}
116
+ .oa-film-title{position:absolute;left:8%;right:8%;top:10%;font-size:10px;font-weight:600;color:rgba(255,255,255,.85);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
117
+ .oa-busy{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:8px;background:color-mix(in srgb,var(--oa-page-bg) 70%,transparent);color:var(--oa-page-text-secondary);font-size:13px}
118
+ .oa-spinner{width:14px;height:14px;border-radius:50%;border:1.5px solid currentColor;border-right-color:transparent;animation:oa-spin .8s linear infinite}
119
+ @keyframes oa-spin{to{transform:rotate(360deg)}}
120
+ .oa-info{display:flex;align-items:center;gap:12px;min-width:0;padding:12px 14px}
121
+ .oa-glyph{flex:none;display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:9px;background:var(--oa-wash);color:var(--oa-ink)}
122
+ :where(.oa-page)[data-theme=dark] .oa-glyph{background:color-mix(in srgb,var(--oa-ink) 36%,var(--oa-page-bg));color:var(--oa-wash)}
123
+ .oa-menu-glyph{display:flex;color:var(--oa-ink)}
124
+ :where(.oa-page)[data-theme=dark] .oa-menu-glyph{color:var(--oa-wash)}
125
+ .oa-text{display:flex;flex-direction:column;min-width:0;flex:1}
126
+ .oa-name{font-weight:500;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
127
+ .oa-meta{color:var(--oa-page-text-tertiary);font-size:12px;line-height:18px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
128
+ .oa-actions{position:absolute;top:10px;right:10px;display:flex;align-items:center;gap:6px}
129
+ .oa-act{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:.5px solid var(--oa-page-border);border-radius:8px;background:var(--oa-page-bg);color:var(--oa-page-text-secondary);cursor:pointer;opacity:0;transition:opacity .12s}
130
+ .oa-act:hover{color:var(--oa-page-text-primary);background:color-mix(in srgb,var(--oa-page-text-primary) 6%,var(--oa-page-bg))}
131
+ .oa-item:hover .oa-act,.oa-item:focus-within .oa-act,.oa-act[aria-expanded=true],.oa-act[data-on=true]{opacity:1}
132
+ .oa-act[data-on=true]{color:var(--oa-page-text-primary)}
133
+ .oa-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}
134
+ .oa-list .oa-item{display:flex;align-items:center;border-radius:10px;padding-right:8px}
135
+ .oa-list .oa-item:hover,.oa-list .oa-item[data-menu=true]{background:var(--oa-page-hover-bg)}
136
+ .oa-row{display:flex;align-items:center;gap:12px;flex:1;min-width:0;padding:8px 10px;border:0;border-radius:10px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
137
+ .oa-row:disabled{cursor:progress}
138
+ .oa-row .oa-name{flex:1;min-width:0}
139
+ .oa-row .oa-meta{flex:none;max-width:45%;margin-left:16px}
140
+ .oa-row-tools{flex:none;display:flex;align-items:center;gap:2px;margin-left:4px;color:var(--oa-page-text-tertiary)}
141
+ .oa-shared{display:inline-flex;align-items:center;margin-right:6px;color:var(--oa-page-text-tertiary)}
142
+ .oa-list .oa-act{width:28px;height:28px;border:0;background:none}
143
+ .oa-list .oa-act:hover{background:color-mix(in srgb,var(--oa-page-text-primary) 8%,transparent)}
144
+ .oa-list .oa-act-more{opacity:1}
145
+ @media (max-width:560px){.oa-row .oa-meta{display:none}}
146
+ .oa-menu{position:fixed;z-index:1000;min-width:200px;padding:6px;border:.5px solid var(--oa-page-border);border-radius:12px;background:var(--oa-page-bg);box-shadow:0 8px 28px -6px rgba(0,0,0,.28);font-size:14px}
147
+ .oa-menu-item{display:flex;align-items:center;gap:10px;width:100%;min-height:34px;padding:5px 10px;border:0;border-radius:8px;background:none;color:var(--oa-page-text-primary);font:inherit;text-align:left;white-space:nowrap;cursor:pointer}
148
+ .oa-menu-item:hover,.oa-menu-item:focus-visible,.oa-menu-item[aria-expanded=true]{background:var(--oa-page-hover-bg);outline:none}
149
+ .oa-menu-item[data-danger=true]{color:var(--oa-page-danger)}
150
+ .oa-menu-item svg{flex:none}
151
+ .oa-menu-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}
152
+ .oa-menu-value{margin-left:16px;color:var(--oa-page-text-tertiary)}
153
+ .oa-menu-count{margin-left:16px;color:var(--oa-page-text-tertiary);font-variant-numeric:tabular-nums}
154
+ .oa-menu-key{margin-left:20px;color:var(--oa-page-text-tertiary);font:inherit;font-size:12px}
155
+ .oa-menu-rule{height:.5px;margin:6px 4px;background:var(--oa-page-border)}
156
+ .oa-menu-chev{margin-left:6px;color:var(--oa-page-text-tertiary)}
157
+ .oa-menu-row{position:relative}
158
+ .oa-submenu{position:absolute;left:calc(100% + 12px);top:-6px;z-index:1001;min-width:190px;padding:6px;border:.5px solid var(--oa-page-border);border-radius:12px;background:var(--oa-page-bg);box-shadow:0 8px 28px -6px rgba(0,0,0,.28)}
159
+ .oa-submenu[data-flip=true]{left:auto;right:calc(100% + 12px)}
160
+ .oa-check{flex:none;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border:1px solid var(--oa-page-border-strong);border-radius:5px;color:transparent}
161
+ .oa-check[data-on=true]{border-color:var(--oa-page-accent);background:var(--oa-page-accent);color:#fff}
162
+ .oa-tick{flex:none;margin-left:16px;color:var(--oa-page-accent)}
163
+ .oa-scrim{position:fixed;inset:0;z-index:1100;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.36)}
164
+ .oa-dialog{width:min(420px,100%);padding:20px;border-radius:16px;background:var(--oa-page-bg);box-shadow:0 18px 48px -12px rgba(0,0,0,.4)}
165
+ .oa-dialog h2{margin:0 0 12px;font-size:16px;font-weight:600;line-height:24px;overflow-wrap:anywhere}
166
+ .oa-dialog p{margin:0;color:var(--oa-page-text-secondary);font-size:14px;line-height:1.55;overflow-wrap:anywhere}
167
+ .oa-dialog input{box-sizing:border-box;width:100%;height:38px;padding:0 12px;border:1px solid var(--oa-page-border);border-radius:10px;background:none;color:var(--oa-page-text-primary);font:inherit;outline:none}
168
+ .oa-dialog input:focus{border-color:var(--oa-page-accent)}
169
+ .oa-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
170
+ .oa-import:focus{outline:none}
171
+ .oa-dialog .oa-import-text{margin-bottom:14px}
172
+ .oa-dialog .oa-import-note{margin-top:8px;font-size:13px;line-height:18px}
173
+ .oa-dialog .oa-import-left{display:block;margin-top:4px}
174
+ .oa-dialog input:disabled{color:var(--oa-page-text-tertiary)}
175
+ .oa-btn{height:34px;padding:0 14px;border:0;border-radius:9px;background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary);font:inherit;font-weight:500;cursor:pointer}
176
+ .oa-btn:hover{background:color-mix(in srgb,var(--oa-page-text-primary) 12%,var(--oa-page-bg))}
177
+ .oa-btn:disabled{color:var(--oa-page-text-caption);cursor:default;background:var(--oa-page-hover-bg)}
178
+ .oa-btn[data-primary=true]{background:var(--oa-page-accent);color:#fff}
179
+ .oa-btn[data-primary=true]:hover:not(:disabled){filter:brightness(1.08)}
180
+ .oa-btn[data-primary=true]:disabled{background:var(--oa-page-hover-bg);color:var(--oa-page-text-caption)}
181
+ .oa-btn[data-danger=true]{border:1px solid var(--oa-page-danger);background:color-mix(in srgb,var(--oa-page-danger) 10%,var(--oa-page-bg));color:var(--oa-page-danger)}
182
+ .oa-btn[data-danger=true]:hover{background:color-mix(in srgb,var(--oa-page-danger) 18%,var(--oa-page-bg))}
183
+ .oa-toast{position:absolute;left:50%;bottom:24px;z-index:900;display:flex;align-items:center;gap:10px;max-width:min(560px,calc(100% - 32px));padding:9px 10px 9px 14px;border:.5px solid var(--oa-page-border);border-radius:12px;background:var(--oa-page-bg);box-shadow:0 8px 28px -6px rgba(0,0,0,.28);transform:translateX(-50%);font-size:14px}
184
+ .oa-toast[data-kind=error]{color:var(--oa-page-danger)}
185
+ .oa-toast svg{flex:none}
186
+ .oa-toast-text{min-width:0;overflow-wrap:anywhere}
187
+ .oa-toast-undo{flex:none;padding:2px 8px;border:0;border-radius:6px;background:none;color:var(--oa-page-accent);font:inherit;font-weight:500;cursor:pointer}
188
+ .oa-toast-undo:hover{background:var(--oa-page-hover-bg)}
189
+ .oa-toast-close{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:var(--oa-page-text-tertiary);cursor:pointer}
190
+ .oa-toast-close:hover{background:var(--oa-page-hover-bg)}
191
+ .oa-empty{display:flex;flex-direction:column;align-items:center;gap:8px;padding:56px 20px;text-align:center;color:var(--oa-page-text-tertiary)}
192
+ .oa-empty svg{color:var(--oa-page-text-caption);margin-bottom:4px}
193
+ .oa-empty h2{margin:0;font-size:14px;font-weight:500;color:var(--oa-page-text-secondary)}
194
+ .oa-empty p{margin:0;max-width:420px;font-size:13px;line-height:1.6}
195
+ .oa-retry{margin-top:8px;height:30px;padding:0 12px;border:.5px solid var(--oa-page-border);border-radius:15px;background:none;color:var(--oa-page-text-primary);font:inherit;font-size:13px;cursor:pointer}
196
+ .oa-retry:hover{background:var(--oa-page-hover-bg)}
197
+ .oa-skeleton .oa-card{cursor:default}
198
+ .oa-skeleton .oa-preview{background:var(--oa-page-skeleton-bg,var(--oa-page-hover-bg))}
199
+ .oa-skeleton .oa-line{width:60%;height:10px;margin:18px 14px}
200
+ @media (prefers-reduced-motion:reduce){.oa-sheet,.oa-paper,.oa-slide,.oa-film,.oa-act,.oa-tile-art,.oa-card{transition:none}.oa-tile:hover .oa-tile-art,.oa-tile[data-peek=true] .oa-tile-art{transform:none}.oa-peek{animation:none}.oa-spinner{animation-duration:2s}}
201
+ .oa-news .oau-head{margin-bottom:8px}
202
+ .oa-notes{display:flex;flex-direction:column;gap:12px;align-items:flex-start}
203
+ .oa-release{align-self:stretch;min-width:0}
204
+ .oa-release-head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0 0 4px;font-size:14px;font-weight:600;line-height:22px;color:var(--oa-page-text-primary)}
205
+ .oa-release-date{font-weight:400;color:var(--oa-page-text-tertiary);font-size:12px}
206
+ .oa-release-summary{margin:0 0 6px;color:var(--oa-page-text-primary);font-size:13px;line-height:20px;overflow-wrap:anywhere}
207
+ .oa-release-section{margin-top:6px}
208
+ .oa-release-section h4{margin:0 0 2px;font-size:12px;font-weight:500;line-height:18px;color:var(--oa-page-text-tertiary)}
209
+ .oa-release-section ul{margin:0;padding-left:18px;color:var(--oa-page-text-secondary);font-size:13px;line-height:20px}
210
+ .oa-release-section li{overflow-wrap:anywhere}
211
+ .oa-release-section li+li{margin-top:2px}
212
+ .oa-release code{padding:0 4px;border-radius:4px;background:color-mix(in srgb,var(--oa-page-text-primary) 8%,transparent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
213
+ .oa-release strong{font-weight:600;color:var(--oa-page-text-primary)}
214
+ .oa-release a{color:var(--oa-page-accent)}
215
+ .oa-news-upcoming{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:10px;padding-top:10px;border-top:.5px solid var(--oa-page-border)}
216
+ .oa-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 8px;margin-top:40px;color:var(--oa-page-text-tertiary);font-size:12px;line-height:18px}
217
+ .oa-dialog[data-wide=true]{width:min(640px,100%);display:flex;flex-direction:column;max-height:min(720px,calc(100vh - 48px))}
218
+ .oa-changelog{flex:1;min-height:0;overflow:auto;margin:0 -20px;padding:0 20px}
219
+ .oa-changelog .oa-release+.oa-release{padding-top:12px;border-top:.5px solid var(--oa-page-border)}
220
+ .oa-btn-link{display:inline-flex;align-items:center;text-decoration:none;margin-right:auto}
221
+ .oa-page{--oa-set-success:var(--oa-page-success,#1f8a4c);--oa-set-warning:var(--oa-page-warning,#b26b00)}
222
+ :where(.oa-page)[data-theme=dark]{--oa-set-success:var(--oa-page-success,#4cc38a);--oa-set-warning:var(--oa-page-warning,#e0a43c)}
223
+ :where(.oa-page)[data-theme=dark] .oa-set{color-scheme:dark}
224
+ .oa-set-layout{display:flex;align-items:flex-start;gap:32px}
225
+ .oa-set-nav{position:sticky;top:16px;flex:none;display:flex;flex-direction:column;gap:2px;width:200px}
226
+ :where(.oa-page)[data-platform=darwin] .oa-set-nav{top:calc(16px + var(--oa-page-top-clearance,0px))}
227
+ .oa-set-nav-item{display:flex;align-items:center;gap:10px;width:100%;height:32px;padding:0 10px;border:0;border-radius:8px;background:none;color:var(--oa-page-text-secondary);font:inherit;font-size:14px;line-height:20px;text-align:left;white-space:nowrap;cursor:pointer}
228
+ .oa-set-nav-item svg{flex:none}
229
+ .oa-set-nav-item span{min-width:0;overflow:hidden;text-overflow:ellipsis}
230
+ .oa-set-nav-item:hover{background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary)}
231
+ .oa-set-nav-item[aria-current=page]{background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary);font-weight:500}
232
+ .oa-set[data-narrow=true] .oa-set-layout{flex-direction:column;align-items:stretch;gap:20px}
233
+ .oa-set[data-narrow=true] .oa-set-nav{position:static;flex-direction:row;gap:6px;width:auto;margin:0 -4px;padding:0 4px 2px;overflow-x:auto;scrollbar-width:none}
234
+ .oa-set[data-narrow=true] .oa-set-nav::-webkit-scrollbar{display:none}
235
+ .oa-set[data-narrow=true] .oa-set-nav-item{flex:none;width:auto;height:30px;padding:0 12px;border:.5px solid var(--oa-page-border);border-radius:15px;gap:6px}
236
+ .oa-set[data-narrow=true] .oa-set-nav-item[aria-current=page]{border-color:transparent}
237
+ .oa-set-main{flex:1;min-width:0;max-width:720px}
238
+ .oa-set-section-head{margin:0 0 20px}
239
+ .oa-set-section-head h2{margin:0;font-size:16px;font-weight:500;line-height:24px}
240
+ .oa-set-section-head p{margin:2px 0 0;color:var(--oa-page-text-tertiary);font-size:13px;line-height:20px}
241
+ .oa-set-stack{display:flex;flex-direction:column;gap:24px;min-width:0}
242
+ .oa-set-stack>.oa-set-note{font-size:13px;line-height:20px}
243
+ .oa-set-group{min-width:0}
244
+ .oa-set-group-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 12px;min-height:28px;margin:0 0 8px}
245
+ .oa-set-group-head h3{margin:0;min-width:0;color:var(--oa-page-text-tertiary);font-size:13px;font-weight:400;line-height:20px;overflow-wrap:anywhere}
246
+ .oa-set-group-action{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-left:auto}
247
+ .oa-set-group-action .oa-set-segmented button{height:24px;padding:0 10px;font-size:12px}
248
+ .oa-set-card{border:.5px solid var(--oa-page-border);border-radius:12px;background:var(--oa-page-bg)}
249
+ .oa-set-card>*+*{border-top:.5px solid var(--oa-page-border)}
250
+ .oa-set-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;min-width:0;padding:12px 16px}
251
+ .oa-set-row-text{flex:1 1 220px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
252
+ .oa-set-row-control{flex:none;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:6px;max-width:100%;margin-left:auto}
253
+ .oa-set-label{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 8px;max-width:100%;color:var(--oa-page-text-primary);font-size:14px;line-height:20px;overflow-wrap:anywhere}
254
+ .oa-set-hint{display:block;max-width:100%;color:var(--oa-page-text-tertiary);font-size:12px;line-height:18px;overflow-wrap:anywhere}
255
+ .oa-set-hint .oa-set-inline{margin-right:12px}
256
+ .oa-set-hint [data-tone=warning],.oa-set-picker-status [data-tone=warning]{color:var(--oa-set-warning)}
257
+ .oa-set-muted{color:var(--oa-page-text-tertiary);font-weight:400}
258
+ .oa-set-faint{color:var(--oa-page-text-caption)}
259
+ .oa-set-inline{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;vertical-align:middle}
260
+ .oa-set-wrap{overflow-wrap:anywhere;word-break:break-word}
261
+ .oa-set-clamp{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
262
+ .oa-set-code,.oa-set-copy code,.oa-set-pre,.oa-set-picker-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
263
+ .oa-set-code{padding:0 5px;border-radius:4px;background:var(--oa-page-hover-bg);font-size:12px}
264
+ .oa-set-loading{display:flex;align-items:center;gap:8px;margin:0;color:var(--oa-page-text-tertiary);font-size:13px;line-height:20px}
265
+ .oa-set-note{margin:0;max-width:100%;color:var(--oa-page-text-tertiary);font-size:12px;line-height:18px;overflow-wrap:anywhere}
266
+ .oa-set-note[data-tone=success]{color:var(--oa-set-success)}
267
+ .oa-set-note[data-tone=warning]{color:var(--oa-set-warning)}
268
+ .oa-set-note[data-tone=danger]{color:var(--oa-page-danger)}
269
+ .oa-set-tags{display:flex;flex-wrap:wrap;gap:4px}
270
+ .oa-set-tag{display:inline-flex;align-items:center;max-width:100%;height:20px;padding:0 7px;border-radius:10px;background:var(--oa-page-hover-bg);color:var(--oa-page-text-secondary);font-size:12px;font-weight:400;line-height:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
271
+ .oa-set-tag[data-tone=accent]{background:color-mix(in srgb,var(--oa-page-accent) 12%,transparent);color:var(--oa-page-accent)}
272
+ .oa-set-tag[data-tone=warning]{background:color-mix(in srgb,var(--oa-set-warning) 14%,transparent);color:var(--oa-set-warning)}
273
+ .oa-set-btn{display:inline-flex;flex:none;align-items:center;justify-content:center;gap:6px;height:28px;padding:0 10px;border:.5px solid var(--oa-page-border-strong);border-radius:8px;background:transparent;color:var(--oa-page-text-primary);font:inherit;font-size:13px;line-height:20px;white-space:nowrap;cursor:pointer}
274
+ .oa-set-btn svg{flex:none}
275
+ .oa-set-btn .oa-spinner{width:11px;height:11px;border-width:1.3px}
276
+ .oa-set-btn:hover:not(:disabled){background:var(--oa-page-hover-bg)}
277
+ .oa-set-btn:disabled{color:var(--oa-page-text-caption);cursor:default}
278
+ .oa-set-btn[data-variant=primary]{border-color:transparent;background:var(--oa-page-accent);color:#fff}
279
+ .oa-set-btn[data-variant=primary]:hover:not(:disabled){background:var(--oa-page-accent);filter:brightness(1.08)}
280
+ .oa-set-btn[data-variant=primary]:disabled{background:var(--oa-page-hover-bg);color:var(--oa-page-text-caption)}
281
+ .oa-set-btn[data-variant=quiet]{border-color:transparent;color:var(--oa-page-text-secondary)}
282
+ .oa-set-btn[data-variant=quiet]:hover:not(:disabled){color:var(--oa-page-text-primary)}
283
+ .oa-set-btn[data-variant=danger]{color:var(--oa-page-danger)}
284
+ .oa-set-btn[data-variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--oa-page-danger) 10%,transparent)}
285
+ .oa-set-btn[data-variant=quiet]:disabled,.oa-set-btn[data-variant=danger]:disabled{color:var(--oa-page-text-caption)}
286
+ .oa-set-icon-btn{display:inline-flex;flex:none;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:none;color:var(--oa-page-text-tertiary);cursor:pointer}
287
+ .oa-set-icon-btn:hover:not(:disabled){background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary)}
288
+ .oa-set-icon-btn:disabled{opacity:.5;cursor:default}
289
+ .oa-set-switch{position:relative;flex:none;width:32px;height:18px;padding:0;border:0;border-radius:9px;background:var(--oa-page-border-strong);cursor:pointer;transition:background-color .15s}
290
+ .oa-set-switch>span{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .15s}
291
+ .oa-set-switch[aria-checked=true]{background:var(--oa-page-accent)}
292
+ .oa-set-switch[aria-checked=true]>span{transform:translateX(14px)}
293
+ .oa-set-switch:disabled{opacity:.5;cursor:default}
294
+ .oa-set-segmented{display:inline-flex;flex:none;max-width:100%;padding:2px;border-radius:9px;background:var(--oa-page-hover-bg);overflow-x:auto}
295
+ .oa-set-segmented button{flex:none;height:28px;padding:0 14px;border:0;border-radius:7px;background:transparent;color:var(--oa-page-text-secondary);font:inherit;font-size:13px;line-height:20px;white-space:nowrap;cursor:pointer}
296
+ .oa-set-segmented button:hover:not(:disabled){color:var(--oa-page-text-primary)}
297
+ .oa-set-segmented button[aria-checked=true]{background:var(--oa-page-bg);color:var(--oa-page-text-primary);box-shadow:0 0 0 .5px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.1)}
298
+ :where(.oa-page)[data-theme=dark] .oa-set-segmented button[aria-checked=true]{background:color-mix(in srgb,var(--oa-page-text-primary) 16%,var(--oa-page-bg))}
299
+ .oa-set-segmented button:disabled{opacity:.55;cursor:default}
300
+ .oa-set-input,.oa-set-select{box-sizing:border-box;min-width:0;height:32px;padding:0 10px;border:.5px solid var(--oa-page-border-strong);border-radius:8px;background-color:var(--oa-page-bg);color:var(--oa-page-text-primary);font:inherit;font-size:13px;line-height:20px;outline:none}
301
+ .oa-set-input{width:100%}
302
+ .oa-set-input::placeholder{color:var(--oa-page-text-caption)}
303
+ .oa-set-select{max-width:100%;padding-right:28px;appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--oa-page-text-tertiary) 50%),linear-gradient(135deg,var(--oa-page-text-tertiary) 50%,transparent 50%);background-position:calc(100% - 15px) 55%,calc(100% - 11px) 55%;background-size:4px 4px;background-repeat:no-repeat;text-overflow:ellipsis;cursor:pointer}
304
+ .oa-set-select:disabled{color:var(--oa-page-text-caption);cursor:default}
305
+ .oa-set-input:focus,.oa-set-select:focus,.oa-set-picker-field[aria-expanded=true]{border-color:var(--oa-page-accent);box-shadow:0 0 0 .5px var(--oa-page-accent)}
306
+ .oa-set-input[aria-invalid=true]{border-color:var(--oa-page-danger);box-shadow:0 0 0 .5px var(--oa-page-danger)}
307
+ .oa-set-number{width:120px;text-align:right;font-variant-numeric:tabular-nums}
308
+ :is(.oa-set-btn,.oa-set-icon-btn,.oa-set-switch,.oa-set-nav-item,.oa-set-segmented button,.oa-set-sort,.oa-set-link,.oa-set-ext,.oa-set-picker-field):focus-visible{outline:var(--oa-page-focus-ring-width,2px) solid var(--oa-page-focus-ring-color,var(--oa-page-accent));outline-offset:2px}
309
+ .oa-set-form{flex:1 1 100%;align-self:stretch;display:flex;flex-direction:column;gap:12px;min-width:0}
310
+ .oa-set-form-title{font-size:14px;font-weight:500;line-height:20px}
311
+ .oa-set-form-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px}
312
+ .oa-set-form-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px}
313
+ .oa-set-push{margin-right:auto}
314
+ .oa-set-well{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:10px;background:var(--oa-page-hover-bg)}
315
+ .oa-set-field{display:flex;flex-direction:column;gap:6px;min-width:0}
316
+ .oa-set-field>.oa-set-segmented{align-self:flex-start}
317
+ .oa-set-field-label{color:var(--oa-page-text-secondary);font-size:13px;font-weight:500;line-height:18px}
318
+ .oa-set-inline-field{display:flex;align-items:center;gap:8px}
319
+ .oa-set-inline-field .oa-set-input{flex:1}
320
+ .oa-set-picker{position:relative;min-width:0}
321
+ .oa-set-picker-field{display:flex;align-items:center;gap:8px;box-sizing:border-box;width:100%;height:32px;padding:0 10px;border:.5px solid var(--oa-page-border-strong);border-radius:8px;background:var(--oa-page-bg);color:var(--oa-page-text-primary);font:inherit;font-size:13px;line-height:20px;text-align:left;cursor:pointer}
322
+ .oa-set-picker-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
323
+ .oa-set-picker-text[data-empty=true]{color:var(--oa-page-text-caption)}
324
+ .oa-set-picker-id{flex:none;max-width:45%;overflow:hidden;color:var(--oa-page-text-tertiary);font-size:11px;text-overflow:ellipsis;white-space:nowrap}
325
+ .oa-set-picker-chev{flex:none;display:inline-flex;color:var(--oa-page-text-tertiary)}
326
+ .oa-set-picker-pop{position:absolute;z-index:50;top:calc(100% + 4px);left:0;right:0;min-width:240px;display:flex;flex-direction:column;overflow:hidden;border:.5px solid var(--oa-page-border-floating,var(--oa-page-border));border-radius:10px;background:var(--oa-page-bg);box-shadow:0 8px 28px -6px rgba(0,0,0,.28)}
327
+ .oa-set-picker-search{display:flex;align-items:center;gap:6px;height:34px;padding:0 10px;border-bottom:.5px solid var(--oa-page-border);color:var(--oa-page-text-tertiary)}
328
+ .oa-set-picker-search input{flex:1;min-width:0;height:100%;padding:0;border:0;background:none;color:var(--oa-page-text-primary);font:inherit;font-size:13px;outline:none}
329
+ .oa-set-picker-search input::placeholder{color:var(--oa-page-text-caption)}
330
+ .oa-set-picker-status{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:26px;padding:2px 6px 2px 10px;color:var(--oa-page-text-tertiary);font-size:12px;line-height:18px}
331
+ .oa-set-picker-status [role=status]{display:inline-flex;align-items:center;gap:6px;min-width:0;overflow-wrap:anywhere}
332
+ .oa-set-picker-status .oa-spinner{width:10px;height:10px;border-width:1.2px}
333
+ .oa-set-picker-list{max-height:240px;overflow:auto;padding:4px}
334
+ .oa-set-picker-row{display:flex;align-items:center;gap:8px;min-height:30px;padding:4px 8px;border-radius:6px;font-size:13px;line-height:18px;cursor:pointer}
335
+ .oa-set-picker-row[data-active=true]{background:var(--oa-page-hover-bg)}
336
+ .oa-set-picker-tick{flex:none;display:inline-flex;width:12px;color:var(--oa-page-accent)}
337
+ .oa-set-picker-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
338
+ .oa-set-picker-name[data-muted=true]{color:var(--oa-page-text-tertiary)}
339
+ .oa-set-picker-none{padding:10px;color:var(--oa-page-text-tertiary);font-size:13px;text-align:center}
340
+ .oa-set-copy{display:flex;align-items:flex-start;gap:8px;padding:4px 4px 4px 12px;border-radius:8px;background:var(--oa-page-hover-bg)}
341
+ .oa-set-copy code{flex:1;min-width:0;padding:5px 0;font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere}
342
+ .oa-set-card>.oa-set-table-wrap{border-radius:12px}
343
+ .oa-set-table-wrap{overflow-x:auto}
344
+ .oa-set-table{width:100%;border-collapse:collapse;font-size:13px;line-height:18px}
345
+ .oa-set-table th{padding:10px 12px;border-bottom:.5px solid var(--oa-page-border);color:var(--oa-page-text-tertiary);font-size:12px;font-weight:400;text-align:left;white-space:nowrap}
346
+ .oa-set-table td{padding:10px 12px;vertical-align:top}
347
+ .oa-set-table tbody tr+tr td{border-top:.5px solid var(--oa-page-border)}
348
+ .oa-set-table :is(th,td):first-child{padding-left:16px}
349
+ .oa-set-table :is(th,td):last-child{padding-right:16px}
350
+ .oa-set-table :is(th,td):nth-child(n+3){text-align:right}
351
+ .oa-set-table-title>*{display:block;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
352
+ .oa-set-sort{display:inline-flex;align-items:center;gap:4px;padding:0;border:0;background:none;color:inherit;font:inherit;cursor:pointer}
353
+ .oa-set-sort:hover,.oa-set-sort[data-on=true]{color:var(--oa-page-text-primary)}
354
+ .oa-set-link{padding:0;border:0;background:none;color:var(--oa-page-text-primary);font:inherit;text-align:left;cursor:pointer}
355
+ .oa-set-link:hover{color:var(--oa-page-accent);text-decoration:underline}
356
+ .oa-set-cell{display:inline-flex;flex-direction:column;align-items:flex-end;font-variant-numeric:tabular-nums;white-space:nowrap}
357
+ .oa-set-type{align-items:flex-start}
358
+ .oa-set-type .oa-set-row-control{padding-top:1px}
359
+ .oa-set-type-icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:6px;background:var(--oa-page-hover-bg);color:var(--oa-page-text-secondary)}
360
+ .oa-set-type-icon[data-builtin=true]{background:var(--oa-wash);color:var(--oa-ink)}
361
+ :where(.oa-page)[data-theme=dark] .oa-set-type-icon[data-builtin=true]{background:color-mix(in srgb,var(--oa-ink) 36%,var(--oa-page-bg));color:var(--oa-wash)}
362
+ .oa-set-type-name{min-width:0;overflow-wrap:anywhere}
363
+ .oa-set-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
364
+ .oa-set-ext{display:inline-flex;align-items:center;gap:4px;color:var(--oa-page-accent);font-size:12px;line-height:18px;text-decoration:none}
365
+ .oa-set-ext:hover{text-decoration:underline}
366
+ .oa-set-dialog-form{display:flex;flex-direction:column;gap:14px;margin-top:16px}
367
+ .oa-set-dialog-form .oa-dialog-actions{margin-top:6px}
368
+ .oa-set-preview{flex:1 1 auto;display:flex;flex-direction:column;gap:8px;min-height:0;margin:16px -20px 0;padding:0 20px;overflow:auto}
369
+ .oa-set-fact{display:grid;grid-template-columns:120px minmax(0,1fr);gap:12px;font-size:13px;line-height:20px}
370
+ .oa-set-fact>span:first-child{color:var(--oa-page-text-tertiary)}
371
+ .oa-set-fact>span:last-child{overflow-wrap:anywhere}
372
+ .oa-set-pre{max-height:240px;margin:0;padding:10px 12px;overflow:auto;border-radius:8px;background:var(--oa-page-hover-bg);font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere}
373
+ .oa-dialog .oa-set-preview-name{color:var(--oa-page-text-primary);font-weight:600}
374
+ .oa-dialog .oa-set-hint,.oa-dialog .oa-set-note{margin:0;font-size:12px;line-height:18px}
375
+ .oa-dialog .oa-set-hint,.oa-dialog .oa-set-note[data-tone=info]{color:var(--oa-page-text-tertiary)}
376
+ .oa-dialog .oa-set-loading{color:var(--oa-page-text-tertiary);font-size:13px}
377
+ .oa-dialog .oa-set-input{height:32px;padding:0 10px;border:.5px solid var(--oa-page-border-strong);border-radius:8px;background-color:var(--oa-page-bg)}
378
+ .oa-dialog .oa-set-input:focus{border-color:var(--oa-page-accent)}
379
+ @media (prefers-reduced-motion:reduce){.oa-set-switch,.oa-set-switch>span{transition:none}}
380
+ `,Vs=`
381
+ .oau-panel{margin:0 0 24px;padding:14px 16px;border-radius:12px;background:var(--oa-page-hover-bg);color:var(--oa-page-text-primary);font-size:13px;line-height:20px}
382
+ .oau-head{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px 16px}
383
+ .oau-head-text{flex:1;min-width:200px}
384
+ .oau-title{font-weight:500;overflow-wrap:anywhere}
385
+ .oau-text{color:var(--oa-page-text-secondary);overflow-wrap:anywhere}
386
+ .oau-actions{flex:none;display:flex;gap:8px}
387
+ .oau-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0 0 20px;color:var(--oa-page-text-secondary);font-size:13px;line-height:20px}
388
+ .oau-show{padding:0;border:0;background:none;color:var(--oa-page-accent);font:inherit;cursor:pointer}
389
+ .oau-show:hover{text-decoration:underline}
390
+ .oau-tag{display:inline-flex;align-items:center;padding:0 8px;border-radius:9px;font-size:12px;line-height:20px;background:color-mix(in srgb,var(--oa-page-accent) 12%,transparent);color:var(--oa-page-accent)}
391
+ .oau-tag[data-tone="neutral"]{background:var(--oa-page-hover-bg);color:var(--oa-page-text-secondary)}
392
+ `;function Gs(t,a){if(typeof document>"u"||!a)return()=>{};if(document.querySelector(`style[data-plugin-css="${t}"]`))return()=>{};const o=document.createElement("style");return o.dataset.pluginCss=t,o.textContent=a,document.head.appendChild(o),()=>o.remove()}function ka(t){if(!t)return null;if(!/^[a-z][a-z0-9+.-]*:\/\//i.test(t)&&!t.startsWith("/"))return t;try{return new URL(t,"http://localhost").searchParams.get("v")??t}catch{return t}}function mt(t,a){const o=t.createdAt??"",n=t.owner??null;return{id:t.id??"",root:t.root??"",project:t.project??"",type:t.type??"",typeTitle:t.typeTitle??t.type??"",sessionId:n?.harness===a&&typeof n.session=="string"?n.session:"",ownerStatus:n?n.live===!1?"offline":n.status??null:null,title:t.title??"",openedAt:t.openedAt??o,createdAt:o,updatedAt:t.contentAt??t.updatedAt??o,pinned:!!t.pinned,shared:!!t.shared,webShare:t.webShare?.url?{url:t.webShare.url,manage:To(t.webShare.endpoint)}:null,thumbnail:ka(t.thumbnail),...t.thumbnailPicked?{picked:!0}:{},openable:!t.typeMissing,viewUrl:t.view_url??""}}function Ys(t,a){const o=mt(t,a),n=Array.isArray(t.notes)?t.notes.filter(s=>typeof s=="string"&&s!==""):[];return n.length?{...o,notes:n}:o}function Zs(t){return t.filter(a=>typeof a.id=="string"&&a.enabled!==!1&&a.runnable!==!1&&!a.shadowedBy&&!a.problems?.length).map(a=>({id:a.id,title:a.title||a.id,description:a.description??""}))}function Js(t,a,o){return{artifacts:(t.artifacts??[]).map(n=>mt(n,o)),types:Zs(a.types??[])}}function Qs(t,a){return{url:t.view_url??a.viewUrl,sessionId:a.sessionId,title:a.title}}function Xs(t,a){return{trash:t.deleted??a,path:t.folderKept??""}}const Na=Object.freeze({"models.list":"GET","models.catalog":"GET","models.set":"POST","models.remove":"POST","models.test":"POST","grants.list":"GET","grants.revoke":"POST","usage.summary":"GET","runtime.status":"GET","runtime.check":"POST","runtime.update":"POST",types:"GET","types.sites":"GET","types.new":"POST","types.enable":"POST","types.disable":"POST","types.trust":"POST","types.preview":"POST","types.install":"POST","types.uninstall":"POST","types.update":"POST"});function er(t){return typeof t=="string"&&Object.prototype.hasOwnProperty.call(Na,t)?t:null}const ft="open-artifacts.update.dismissed";function tr(){try{return localStorage.getItem(ft)??""}catch{return""}}const $=Eo()(()=>({status:null,checking:!1,phase:"idle",to:"",pending:!1,error:"",dismissed:tr()}));async function ar(){try{const t=await Re.runtimeStatus();$.setState({status:t});const a=t.policy.update;!t.check&&a!=="off"&&a!=="bundled"&&or()}catch{}}async function or(){if(!$.getState().checking){$.setState({checking:!0});try{const t=await Re.runtimeCheck(),a=t.check?.available??"",o=$.getState().dismissed;$.setState({status:t,checking:!1,...a&&a!==o?{dismissed:""}:{}})}catch(t){$.setState({checking:!1,error:aa(t)})}}}async function nr(){const{status:t,phase:a}=$.getState();if(a==="running")return;const o=t?.check?.available??void 0;$.setState({phase:"running",error:""});try{const n=await Re.runtimeUpdate(o),s=await Re.runtimeStatus().catch(()=>$.getState().status);$.setState({status:s,phase:"done",to:n.installed??o??s?.running??"",pending:n.pending,error:""})}catch(n){$.setState({phase:"failed",error:aa(n)})}}function sr(){const t=$.getState().status?.check?.available??"";if(t){try{localStorage.setItem(ft,t)}catch{}$.setState({dismissed:t})}}function rr(){try{localStorage.removeItem(ft)}catch{}$.setState({dismissed:""})}function ir(){$.setState({phase:"idle",error:""})}const Ne=(t,a)=>`/api/open-artifacts.${t}${a?`?${new URLSearchParams(a)}`:""}`;async function Ue(t,a,o){const n=await t(Ne(a,o?.query),{cache:"no-store",...o?.body!==void 0?{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(o.body)}:{}}),s=await n.json().catch(()=>({}));if(!n.ok)throw new pn(typeof s.message=="string"&&s.message?s.message:`HTTP ${n.status}`,typeof s.code=="string"?s.code:void 0);return s}function lr(t=(...o)=>fetch(...o),a=()=>null){const o=(c,u)=>Ue(t,c,u?{query:u}:void 0),n=(c,u)=>Ue(t,c,{body:u}),s=()=>a()?.harness??"",r=c=>mt(c,s()),i=async c=>r(await o(V.artifact,{id:c}));return{async list(){const[c,u]=await Promise.all([o(V.artifacts),o(V.types)]);return Js({artifacts:Po(c.artifacts??[],a()?.library)},u,s())},async open(c){const u=await n(V.open,{id:c,host:!1});return Qs(u,await i(c))},preview:async c=>(await n(V.preview,{id:c})).page_url??null,update:async(c,u)=>r(await n(V.update,{id:c,...u})),remove:async c=>Xs(await n(V.delete,{id:c}),c),restore:async c=>r(await n(V.restore,{id:c})),importLink:async c=>Ys(await n(V.import,{url:c}),s()),async saveThumbnail(c,u,g){const l=await t(Ne(V.thumbnail,{id:c,v:u}),{method:"POST",headers:{"content-type":"image/jpeg"},body:g}),p=await l.json().catch(()=>({}));return l.ok?ka(p.thumbnail)??u:null},thumbnailUrl:(c,u)=>Ne(V.thumbnail,{id:c,v:u}),events(c,u){if(typeof EventSource>"u")return null;const g=new EventSource(Ne(V.events));return g.onmessage=()=>c(),g.onerror=()=>u(),()=>g.close()}}}function cr(t=(...a)=>fetch(...a)){return{call(a,o){return er(a)?Ue(t,a,{...o?.query?{query:o.query}:{},...Na[a]==="POST"?{body:o?.body??{}}:{}}):Promise.reject(new Error(`not a settings route: ${String(a)}`))}}}function dr(t=(...a)=>fetch(...a)){return async a=>{try{const o=await t(Ne(V.runtimeChangelog,a?{upcoming:"1"}:void 0),{cache:"no-store"});if(!o.ok)return null;const n=await o.json();return typeof n.version=="string"&&Array.isArray(n.releases)?{version:n.version,releases:n.releases,upcoming:Array.isArray(n.upcoming)?n.upcoming:[]}:null}catch{return null}}}function qt(t,a){const o=t.app();o?.caps.artifacts?t.toApp({openArtifacts:"open_artifact",url:`open-artifacts://artifact/${a.id}`,id:a.id,title:a.title,type:a.type},o.origin):t.navigate(Do(a.id))}function pr(t){const a=t.fetcher??((...o)=>fetch(...o));return{canCreate:()=>!0,create(o){if(!o)return;const n=Oo(o.id)==="blank";Ue(a,V.create,{body:{type:o.id,title:t.untitled(o.title),...n?{blank:!0}:{}}}).then(s=>{typeof s.id=="string"&&qt(t,{id:s.id,title:s.title||o.title,type:s.typeTitle||o.title})},s=>t.failed(s instanceof Error?s.message:String(s)))},away:()=>!1,pendingWindow:()=>null,async show(o){const n=t.app();o.sessionId&&n?.caps.sessions&&t.toApp({openArtifacts:"open_session",session:o.sessionId,harness:n.harness},n.origin);const s=/\/a\/([^/?#]+)/.exec(o.url)?.[1];if(s){const r=decodeURIComponent(s);qt(t,{id:r,title:o.title,type:t.typeOf(r)})}else t.navigate(o.url);return{sessionGone:!1}},copy:o=>t.copy(o),visible:()=>t.visible(),storage:t.storage}}function ur(t,a){const o=Mo(t);if(!Lo(o)||o.openArtifacts!=="host_hello")return null;const n=Ao(o);return!n||n.openArtifacts!=="host_hello"?null:{origin:a,caps:n.caps,harness:n.harness??"",library:n.library??null,theme:n.theme?.scheme??null}}const hr={updates:[],phase:"idle",to:"",restart:!1,failure:null,dismissed:""};function gr(t){const{status:a}=t,o=a?.check?.available??"",n=a?.running??"",s=a?.policy.update;return{updates:!!o&&s!=="off"&&s!=="bundled"&&(!n||ee(o,n))?[{name:"Open Artifacts",version:n,latest:o}]:[],phase:t.phase,to:t.to,restart:t.pending,failure:t.phase==="failed"?{plugin:"Open Artifacts",message:t.error,left:"kept"}:null,dismissed:t.dismissed}}const xr={available:"updateAvailable",current:"updateCurrent",update:"updateNow","update.one":"updateNow",later:"updateLater",busy:"updateBusy",done:"updateDone","done.session":"updateDoneCurrent","done.restart":"updateDonePending",failed:"updateFailed","failed.kept":"updateFailedKept","failed.unknown":"updateFailedKept",retry:"updateRetry",close:"updateClose",show:"updateShow",restart:"updateClose"};function mr(t){let a=null,o=hr;return{getSnapshot(){const n=t.get();if(n!==a){a=n;const s=gr(n);o=JSON.stringify(s)===JSON.stringify(o)?o:s}return o},subscribe:t.subscribe,start:t.start,later:t.later,close:t.close,reopen:t.reopen,t:(n,s)=>t.words(xr[n],s)}}function Vt(t){const a=t.replace(/^#/,"");if(a==="models")return"models";if(a==="settings"||a==="settings/")return"";if(!a.startsWith("settings/"))return null;try{return decodeURIComponent(a.slice(9))}catch{return""}}const fr=t=>t===null?"":t?`#settings/${encodeURIComponent(t)}`:"#settings";function br(t,a){let o=!1;const n=()=>{if(o)return;const c=t.getState().settings,u=a.hash()==="#"?"":a.hash(),g=Vt(u);if(c===null){if(g===null)return;a.pushed()?(o=!0,a.back()):a.replace("");return}const l=fr(c);l!==u&&(g===null?a.push(l):a.replace(l))},s=()=>{const c=Vt(a.hash()),{settings:u,openSettings:g,closeSettings:l}=t.getState();c===null?u!==null&&l():c!==u&&g(c||void 0)},r=t.subscribe((c,u)=>{c.settings!==u.settings&&n()}),i=a.listen(()=>{o?(o=!1,n()):s()});return s(),()=>{r(),i()}}const Gt="openArtifactsSettings";function yr(t){const a=o=>`${t.location.pathname}${t.location.search}${o}`;return{hash:()=>t.location.hash,pushed:()=>t.history.state?.[Gt]===!0,push:o=>t.history.pushState({[Gt]:!0},"",a(o)),replace:o=>t.history.replaceState(t.history.state,"",a(o)),back:()=>t.history.back(),listen:o=>(t.addEventListener("popstate",o),t.addEventListener("hashchange",o),()=>{t.removeEventListener("popstate",o),t.removeEventListener("hashchange",o)})}}const vr=Object.freeze({"--oa-page-text-primary":["#1a1a1a","#ececea"],"--oa-page-text-secondary":["#4a4a4a","#b8b8b4"],"--oa-page-text-tertiary":["#5c5c5c","#8f8f8a"],"--oa-page-text-caption":["#8a8a8a","#6b6b67"],"--oa-page-bg":["#ffffff","#1c1c1e"],"--oa-page-hover-bg":["#f1f1f1","#2a2a2c"],"--oa-page-accent":["#2f5fe0","#5b84f0"],"--oa-page-danger":["#d1373b","#f06a6e"],"--oa-page-success":["#1f8a4c","#4cc38a"],"--oa-page-warning":["#b26b00","#e0a43c"],"--oa-page-border-strong":["#cfcfcf","#4a4a4c"],"--oa-page-border":["#e2e2e2","#333335"],"--oa-page-border-floating":["rgba(0,0,0,.14)","rgba(255,255,255,.14)"],"--oa-page-skeleton-bg":["#f1f1f1","#2a2a2c"],"--oa-page-focus-ring-width":["2px","2px"],"--oa-page-focus-ring-color":["#2f5fe0","#5b84f0"],"--oa-page-top-clearance":["0px","0px"]}),Yt=t=>Object.entries(vr).map(([a,o])=>`${a}:${o[t]}`).join(";"),jr=`
393
+ :root{color-scheme:light;${Yt(0)}}
394
+ :root[data-theme=dark]{color-scheme:dark;${Yt(1)}}
395
+ html,body,#root{height:100%;margin:0}
396
+ body{background:var(--oa-page-bg);color:var(--oa-page-text-primary);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif;-webkit-font-smoothing:antialiased}
397
+ `,bt=Io==="zh-CN",wr=bt?oa:na,Sa=Uo((t,a)=>{const o=wr[t];return o===void 0?t:o.replace(/\{(\w+)\}/g,(n,s)=>a?.[s]??n)});document.documentElement.lang=bt?"zh-CN":"en";let xe=null;const lt=new Set,Zt=t=>JSON.stringify([t?.harness??"",t?.library??null]),Jt=t=>{const a=Zt(xe);xe=t;for(const o of lt)o();Zt(t)!==a&&Te.getState().reload()};let Ca=null;try{Ca=typeof localStorage>"u"?null:localStorage}catch{}async function kr(t){try{await navigator.clipboard.writeText(t)}catch{const a=document.createElement("textarea");a.value=t,a.style.cssText="position:fixed;opacity:0",document.body.append(a),a.select();const o=document.execCommand("copy");if(a.remove(),!o)throw new Error("the clipboard refused it")}}const Ta=lr(void 0,()=>xe),Nr=cr(),Te=Cn({api:Ta,t:Sa,host:pr({app:()=>xe,toApp:(t,a)=>window.parent.postMessage(pt(t),a),navigate:t=>location.assign(t),failed:t=>Te.getState().showToast(t,"error"),copy:kr,visible:()=>document.visibilityState==="visible",storage:Ca,untitled:t=>{const a=t.replace(/\s*[((].*[))]\s*$/,"")||t;return bt?`未命名${a}`:`Untitled ${a}`},typeOf:t=>Te.getState().artifacts.find(a=>a.id===t)?.typeTitle??""})}),Sr=mr({get:()=>$.getState(),subscribe:t=>$.subscribe(t),start:()=>{nr()},later:sr,close:ir,reopen:rr,words:(t,a)=>zo(t,a)}),Ea=window.parent!==window,Cr=Ro();window.addEventListener("message",t=>{if(!Ea||t.source!==window.parent)return;const a=ur(t.data,t.origin);a&&Cr().then(({hosts:o,latest:n})=>{if(n){if(o?.length&&!o.includes(t.origin)){xe?.origin===t.origin&&Jt(null);return}Jt(a),window.parent.postMessage(pt({openArtifacts:"home_ready"}),t.origin)}})});Ea&&window.parent.postMessage(pt({openArtifacts:"home_hello"}),"*");const ct=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;function Tr(t){return lt.add(t),ct?.addEventListener("change",t),()=>{lt.delete(t),ct?.removeEventListener("change",t)}}const Qt=()=>xe?.theme??(ct?.matches?"dark":"light");function Er(){const t=h.useSyncExternalStore(Tr,Qt,Qt),a=$(r=>r.status?.running??null),o=h.useRef(null),n=h.useRef(0);a!==null&&o.current!==a&&(o.current!==null&&(n.current+=1),o.current=a);const s=h.useMemo(()=>({t:Sa,api:Ta,sessions:Xo,updates:Sr,changelog:dr(),settings:Nr}),[n.current]);return document.documentElement.dataset.theme=t,e.jsx(an,{env:s,children:e.jsx(Tn,{store:Te,children:e.jsx(Ws,{canCreate:!0,theme:t,createSession:!1})})})}br(Te,yr(window));Gs("open-artifacts-library/page.css",jr+qs+Vs);ar();Fo.createRoot(document.getElementById("root")).render(e.jsx(h.StrictMode,{children:e.jsx(Er,{})}));