@cline/cli-darwin-x64 3.0.38 → 3.0.39-nightly.1783772671

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 (99) hide show
  1. package/bin/cline +0 -0
  2. package/cline-hub/webview/assets/Chat-BDmC6MlQ.js +201 -0
  3. package/cline-hub/webview/assets/{abnfDiagram-VRR7QNED-C5rCTOhv.js → abnfDiagram-VRR7QNED-Bnj4QJTn.js} +1 -1
  4. package/cline-hub/webview/assets/{architectureDiagram-ZJ3FMSHR-B-IyfiZR.js → architectureDiagram-ZJ3FMSHR-C7E4F6FP.js} +1 -1
  5. package/cline-hub/webview/assets/{badge-Bzt6S3c1.js → badge-DLmAsOmN.js} +1 -1
  6. package/cline-hub/webview/assets/{blockDiagram-677ZJIJ3-B-BR0eRd.js → blockDiagram-677ZJIJ3-2BmIt81d.js} +2 -2
  7. package/cline-hub/webview/assets/{c4Diagram-LMCZKHZV-nm2HPWma.js → c4Diagram-LMCZKHZV-BLqZyTQG.js} +1 -1
  8. package/cline-hub/webview/assets/channel-lcB16PBt.js +1 -0
  9. package/cline-hub/webview/assets/{chunk-32BRIVSS-hNjl59yJ.js → chunk-32BRIVSS-DvgtUMjH.js} +1 -1
  10. package/cline-hub/webview/assets/{chunk-52WLFC77-BuWVK9iY.js → chunk-52WLFC77-Bc3oUjd3.js} +1 -1
  11. package/cline-hub/webview/assets/{chunk-BO2N2NFS-Dc8TVhBR.js → chunk-BO2N2NFS-DGgewybA.js} +32 -32
  12. package/cline-hub/webview/assets/{chunk-C7G6YPKG-DNqG58q0.js → chunk-C7G6YPKG-B8eWs7WC.js} +1 -1
  13. package/cline-hub/webview/assets/{chunk-EX3LRPZG-e5_iLYaU.js → chunk-EX3LRPZG-D1GtIwqs.js} +1 -1
  14. package/cline-hub/webview/assets/{chunk-FWX5IMBZ-CYhSzu5d.js → chunk-FWX5IMBZ-pb5aM7v8.js} +2 -2
  15. package/cline-hub/webview/assets/{chunk-HOUHSVGY-7-np6tLe.js → chunk-HOUHSVGY-DZv73_1N.js} +1 -1
  16. package/cline-hub/webview/assets/{chunk-ICXQ74PX-tBj7_Af3.js → chunk-ICXQ74PX-BLkwAJRS.js} +2 -2
  17. package/cline-hub/webview/assets/{chunk-MOJQB5TN-yHpPpNVl.js → chunk-MOJQB5TN-BDIrf06r.js} +1 -1
  18. package/cline-hub/webview/assets/{chunk-OGEWGWER-BWr7Kxep.js → chunk-OGEWGWER-DC6ZHIaO.js} +1 -1
  19. package/cline-hub/webview/assets/{chunk-PUDLZKDR-8aZ1kjkY.js → chunk-PUDLZKDR-B3QvWDCN.js} +1 -1
  20. package/cline-hub/webview/assets/{chunk-Q4XR5HBZ-DLm93PI-.js → chunk-Q4XR5HBZ-BrcuBWmp.js} +1 -1
  21. package/cline-hub/webview/assets/{chunk-V7JOEXUC-ClSqKe24.js → chunk-V7JOEXUC-ORex7Wci.js} +1 -1
  22. package/cline-hub/webview/assets/{chunk-VAUOI2AC-CsrCo4-F.js → chunk-VAUOI2AC-9UwoaXaF.js} +1 -1
  23. package/cline-hub/webview/assets/{chunk-VR4S4FIN-s6lsgHY6.js → chunk-VR4S4FIN-CxpxBT1R.js} +1 -1
  24. package/cline-hub/webview/assets/{chunk-WYO6CB5R-i6G7y6Wv.js → chunk-WYO6CB5R-s6qbtyS5.js} +3 -3
  25. package/cline-hub/webview/assets/{chunk-ZGVPDNZ5-C9VvO5W0.js → chunk-ZGVPDNZ5-CJkTHIbj.js} +1 -1
  26. package/cline-hub/webview/assets/classDiagram-OUVF2IWQ-cNXfBUZQ.js +1 -0
  27. package/cline-hub/webview/assets/classDiagram-v2-EOCWNBFH-cNXfBUZQ.js +1 -0
  28. package/cline-hub/webview/assets/{cose-bilkent-JH36ORCC-MT4lvgSK.js → cose-bilkent-JH36ORCC-o75EFMYq.js} +1 -1
  29. package/cline-hub/webview/assets/{cynefinDiagram-TSTJHNR4-Dn-OLu7p.js → cynefinDiagram-TSTJHNR4-Bxj5jfDv.js} +1 -1
  30. package/cline-hub/webview/assets/{dagre-VKFMJZFB-eCj9UyqP.js → dagre-VKFMJZFB-8O7vc2EM.js} +2 -2
  31. package/cline-hub/webview/assets/{desktop-client-D5160ONr.js → desktop-client-BKJwuQxH.js} +1 -1
  32. package/cline-hub/webview/assets/{diagram-FQU43EPY-DRPKgSnd.js → diagram-FQU43EPY-3nNW41L5.js} +1 -1
  33. package/cline-hub/webview/assets/{diagram-G47NLZAW-0GD8Q1tc.js → diagram-G47NLZAW-PoM_buCM.js} +1 -1
  34. package/cline-hub/webview/assets/{diagram-NH7WQ7WH-BEnNVzix.js → diagram-NH7WQ7WH-ulhavK3B.js} +1 -1
  35. package/cline-hub/webview/assets/{diagram-OA4YK3LP-V6MJ_f3q.js → diagram-OA4YK3LP-q-oLT4Q4.js} +1 -1
  36. package/cline-hub/webview/assets/{diagram-WEI45ONY-CzW1JD7r.js → diagram-WEI45ONY-DxbP_qr6.js} +1 -1
  37. package/cline-hub/webview/assets/{ebnfDiagram-CCIWWBDH-CFwKmlRg.js → ebnfDiagram-CCIWWBDH-DOMIwyXA.js} +1 -1
  38. package/cline-hub/webview/assets/{erDiagram-Q63AITRT-CgAPlUXh.js → erDiagram-Q63AITRT-4IazwZPI.js} +1 -1
  39. package/cline-hub/webview/assets/extensions-view-XjJ_AYhg.js +1 -0
  40. package/cline-hub/webview/assets/flowDiagram-23GEKE2U-hdDBVE6S.js +1 -0
  41. package/cline-hub/webview/assets/{ganttDiagram-NO4QXBWP-DM0XEDYK.js → ganttDiagram-NO4QXBWP-CUoaBp7f.js} +1 -1
  42. package/cline-hub/webview/assets/{gitGraphDiagram-IHSO6WYX-CNM8anLk.js → gitGraphDiagram-IHSO6WYX-o8p04hK8.js} +2 -2
  43. package/cline-hub/webview/assets/{highlighted-body-OFNGDK62-DPiwQPvA.js → highlighted-body-OFNGDK62-C7gtB-Ji.js} +1 -1
  44. package/cline-hub/webview/assets/{index-BRXDRu6K.js → index-DGmyn1v-.js} +3 -3
  45. package/cline-hub/webview/assets/{infoDiagram-FWYZ7A6U-CHt0koLa.js → infoDiagram-FWYZ7A6U-CkjroFJc.js} +1 -1
  46. package/cline-hub/webview/assets/{ishikawaDiagram-FXEZZL3T-zkyeJR-l.js → ishikawaDiagram-FXEZZL3T-OLGuTzHp.js} +1 -1
  47. package/cline-hub/webview/assets/{journeyDiagram-5HDEW3XC-DDcjgcyH.js → journeyDiagram-5HDEW3XC-CKpZM-zW.js} +2 -2
  48. package/cline-hub/webview/assets/{kanban-definition-HUTT4EX6-BYP4PPrE.js → kanban-definition-HUTT4EX6-DR-Yk3T8.js} +1 -1
  49. package/cline-hub/webview/assets/label-CutRt30b.js +1 -0
  50. package/cline-hub/webview/assets/{line-BTy_dUbW.js → line-iHvrbOzL.js} +1 -1
  51. package/cline-hub/webview/assets/mermaid-GHXKKRXX-CMmEDVDX.js +1 -0
  52. package/cline-hub/webview/assets/{mermaid-layout-Djp6vQyU.js → mermaid-layout-B3I8pqwA.js} +1 -1
  53. package/cline-hub/webview/assets/{mermaid-markup-BZ6zsKDb.js → mermaid-markup-DxHYj2el.js} +1 -1
  54. package/cline-hub/webview/assets/{mermaid-parser-CZPlgix_.js → mermaid-parser-B5nDuK1i.js} +2 -2
  55. package/cline-hub/webview/assets/{mermaid-parser-QWTbqGyA.js → mermaid-parser-B9zpCB84.js} +1 -1
  56. package/cline-hub/webview/assets/mermaid-parser-BBCGbbKs.js +1 -0
  57. package/cline-hub/webview/assets/{mermaid-parser-DNzq6p3w.js → mermaid-parser-BfrZ3jm6.js} +3 -3
  58. package/cline-hub/webview/assets/{mermaid-parser-Cp5YPQ7g.js → mermaid-parser-CTYjzP1x.js} +1 -1
  59. package/cline-hub/webview/assets/{mermaid-parser-DyUJWOTu.js → mermaid-parser-CY_uQclF.js} +1 -1
  60. package/cline-hub/webview/assets/mermaid-parser-CZjLeXFT.js +1 -0
  61. package/cline-hub/webview/assets/{mermaid-parser-DyeriwkP.js → mermaid-parser-Cvf3sTYp.js} +1 -1
  62. package/cline-hub/webview/assets/mermaid-parser-CyY34pyG.js +1 -0
  63. package/cline-hub/webview/assets/{mermaid.core-DPoJ8TcZ.js → mermaid.core-B1yAI6DJ.js} +4 -4
  64. package/cline-hub/webview/assets/{mindmap-definition-LN4V7U3C-CHWTvxxK.js → mindmap-definition-LN4V7U3C-BUPLTHRx.js} +1 -1
  65. package/cline-hub/webview/assets/{pegDiagram-2B236MQR-CXg1egGc.js → pegDiagram-2B236MQR-CqCUMPkJ.js} +1 -1
  66. package/cline-hub/webview/assets/{pieDiagram-ENE6RG2P-DaCuXnM0.js → pieDiagram-ENE6RG2P-C1AZq6_4.js} +1 -1
  67. package/cline-hub/webview/assets/{quadrantDiagram-ABIIQ3AL-nzS6VzgH.js → quadrantDiagram-ABIIQ3AL-CQ6-Nh1S.js} +1 -1
  68. package/cline-hub/webview/assets/{railroadDiagram-RFXS5EU6-CqNrv-_I.js → railroadDiagram-RFXS5EU6-CihPS5zZ.js} +1 -1
  69. package/cline-hub/webview/assets/{requirementDiagram-TGXJPOKE-OOZcRg4n.js → requirementDiagram-TGXJPOKE-DqSnTPUm.js} +1 -1
  70. package/cline-hub/webview/assets/{sankeyDiagram-HTMAVEWB-HscxOZtZ.js → sankeyDiagram-HTMAVEWB-BPrP9qMr.js} +1 -1
  71. package/cline-hub/webview/assets/{sequenceDiagram-DBY2YBRQ-R_qy17y4.js → sequenceDiagram-DBY2YBRQ-vNDq7H85.js} +1 -1
  72. package/cline-hub/webview/assets/settings-view-0hTCA1ER.js +1 -0
  73. package/cline-hub/webview/assets/{stateDiagram-2N3HPSRC-ClswSyZL.js → stateDiagram-2N3HPSRC-BhZeX4AV.js} +1 -1
  74. package/cline-hub/webview/assets/stateDiagram-v2-6OUMAXLB-DSblVTf_.js +1 -0
  75. package/cline-hub/webview/assets/{swimlanes-5IMT3BWC-BkuqVu2j.js → swimlanes-5IMT3BWC-CBgarXiN.js} +1 -1
  76. package/cline-hub/webview/assets/swimlanesDiagram-G3AALYLV-BLE3IPK-.js +8 -0
  77. package/cline-hub/webview/assets/switch-DQs_IHZT.js +1 -0
  78. package/cline-hub/webview/assets/{timeline-definition-FHXFAJF6-BjpuN3pN.js → timeline-definition-FHXFAJF6-CCjLKk-6.js} +1 -1
  79. package/cline-hub/webview/assets/{vennDiagram-L72KCM5P-8F1dmIqI.js → vennDiagram-L72KCM5P-CTW_BgiG.js} +1 -1
  80. package/cline-hub/webview/assets/{vscode-BO5mAFne.js → vscode-CAVw_AZi.js} +1 -1
  81. package/cline-hub/webview/assets/{wardleyDiagram-EHGQE667-7YrnPd_H.js → wardleyDiagram-EHGQE667-BeIO74o9.js} +1 -1
  82. package/cline-hub/webview/assets/{xychartDiagram-FW5EYKEG-Cja295cp.js → xychartDiagram-FW5EYKEG-QjSpx4am.js} +1 -1
  83. package/cline-hub/webview/index.html +2 -2
  84. package/package.json +1 -1
  85. package/cline-hub/webview/assets/Chat-Cpzgs4Zf.js +0 -201
  86. package/cline-hub/webview/assets/channel-8doMLUjk.js +0 -1
  87. package/cline-hub/webview/assets/classDiagram-OUVF2IWQ-tjZJwVeV.js +0 -1
  88. package/cline-hub/webview/assets/classDiagram-v2-EOCWNBFH-tjZJwVeV.js +0 -1
  89. package/cline-hub/webview/assets/extensions-view-BQAXMxuI.js +0 -1
  90. package/cline-hub/webview/assets/flowDiagram-23GEKE2U-Dzdx6GmQ.js +0 -1
  91. package/cline-hub/webview/assets/label-CW5deNNM.js +0 -1
  92. package/cline-hub/webview/assets/mermaid-GHXKKRXX-Am84rhzj.js +0 -1
  93. package/cline-hub/webview/assets/mermaid-parser-2rg6EBvL.js +0 -1
  94. package/cline-hub/webview/assets/mermaid-parser-BSNQtRf6.js +0 -1
  95. package/cline-hub/webview/assets/mermaid-parser-i85Vjfgu.js +0 -1
  96. package/cline-hub/webview/assets/settings-view-D6J1Z1IG.js +0 -1
  97. package/cline-hub/webview/assets/stateDiagram-v2-6OUMAXLB-DFYi3Fwm.js +0 -1
  98. package/cline-hub/webview/assets/swimlanesDiagram-G3AALYLV-CxnljicL.js +0 -8
  99. package/cline-hub/webview/assets/switch-DI9z38Ya.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-Cz8bXOH0.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-WYO6CB5R-i6G7y6Wv.js";import{t as x}from"./dist-BH9bKIvu.js";import{g as S,p as C}from"./chunk-ICXQ74PX-tBj7_Af3.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-32BRIVSS-hNjl59yJ.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,t as M}from"./chunk-ZIRB5QZD-C6fEPe3t.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1));break}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-Cz8bXOH0.js";import{A as r,F as i,G as a,H as o,K as s,O as c,U as l,a as u,b as d,c as f,i as p,r as m,s as h,v as g,w as _,x as v,y,z as b}from"./chunk-WYO6CB5R-s6qbtyS5.js";import{t as x}from"./dist-BH9bKIvu.js";import{g as S,p as C}from"./chunk-ICXQ74PX-BLkwAJRS.js";import{a as w,c as T,i as E,n as D,r as O,s as k}from"./chunk-32BRIVSS-DvgtUMjH.js";import{t as A}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{n as j,t as M}from"./chunk-ZIRB5QZD-C6fEPe3t.js";var N=x(),P=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,12],l=[1,14],u=[1,15],d=[1,17],f=[1,18],p=[1,19],m=[1,25],h=[1,26],g=[1,27],_=[1,28],v=[1,29],y=[1,30],b=[1,31],x=[1,32],S=[1,33],C=[1,34],w=[1,35],T=[1,36],E=[1,37],D=[1,38],O=[1,39],k=[1,40],A=[1,42],j=[1,43],M=[1,44],N=[1,45],P=[1,46],F=[1,47],I=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],ee=[1,74],L=[1,80],R=[1,81],te=[1,82],ne=[1,83],z=[1,84],B=[1,85],V=[1,86],re=[1,87],H=[1,88],U=[1,89],W=[1,90],ie=[1,91],ae=[1,92],oe=[1,93],G=[1,94],se=[1,95],K=[1,96],ce=[1,97],le=[1,98],ue=[1,99],de=[1,100],fe=[1,101],pe=[1,102],me=[1,103],he=[1,104],ge=[1,105],_e=[2,78],ve=[4,5,17,51,53,54],ye=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],be=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],xe=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Se=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Ce=[5,52],q=[70,71,72,73],J=[1,151],we={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NEWLINE`,6:`SD`,10:`INVALID`,14:`create`,15:`box`,16:`restOfLine`,17:`end`,19:`autonumber`,20:`NUM`,21:`off`,22:`activate`,24:`deactivate`,30:`title`,31:`legacy_title`,32:`acc_title`,33:`acc_title_value`,34:`acc_descr`,35:`acc_descr_value`,36:`acc_descr_multiline_value`,37:`loop`,38:`rect`,39:`opt`,40:`alt`,42:`par`,44:`par_over`,45:`critical`,47:`break`,48:`option`,49:`and`,50:`else`,51:`participant`,52:`AS`,53:`participant_actor`,54:`destroy`,56:`note`,59:`over`,61:`links`,62:`link`,63:`properties`,64:`details`,66:`,`,67:`left_of`,68:`right_of`,70:`+`,71:`-`,72:`()`,73:`ACTOR`,75:`CONFIG_START`,76:`CONFIG_CONTENT`,77:`CONFIG_END`,78:`SOLID_OPEN_ARROW`,79:`DOTTED_OPEN_ARROW`,80:`SOLID_ARROW`,81:`SOLID_ARROW_TOP`,82:`SOLID_ARROW_BOTTOM`,83:`STICK_ARROW_TOP`,84:`STICK_ARROW_BOTTOM`,85:`SOLID_ARROW_TOP_DOTTED`,86:`SOLID_ARROW_BOTTOM_DOTTED`,87:`STICK_ARROW_TOP_DOTTED`,88:`STICK_ARROW_BOTTOM_DOTTED`,89:`SOLID_ARROW_TOP_REVERSE`,90:`SOLID_ARROW_BOTTOM_REVERSE`,91:`STICK_ARROW_TOP_REVERSE`,92:`STICK_ARROW_BOTTOM_REVERSE`,93:`SOLID_ARROW_TOP_REVERSE_DOTTED`,94:`SOLID_ARROW_BOTTOM_REVERSE_DOTTED`,95:`STICK_ARROW_TOP_REVERSE_DOTTED`,96:`STICK_ARROW_BOTTOM_REVERSE_DOTTED`,97:`BIDIRECTIONAL_SOLID_ARROW`,98:`DOTTED_ARROW`,99:`BIDIRECTIONAL_DOTTED_ARROW`,100:`SOLID_CROSS`,101:`DOTTED_CROSS`,102:`SOLID_POINT`,103:`DOTTED_POINT`,104:`TXT`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.apply(a[s]),a[s];case 4:case 10:this.$=[];break;case 5:case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:case 7:case 12:case 13:this.$=a[s];break;case 8:case 9:case 14:this.$=[];break;case 16:a[s].type=`createParticipant`,this.$=a[s];break;case 17:a[s-1].unshift({type:`boxStart`,boxData:r.parseBoxData(a[s-2])}),a[s-1].push({type:`boxEnd`,boxText:a[s-2]}),this.$=a[s-1];break;case 19:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:`sequenceIndex`,sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:`sequenceIndex`,sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 22:this.$={type:`sequenceIndex`,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 23:this.$={type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor};break;case 24:this.$={type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1].actor};break;case 30:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 31:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 32:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 33:case 34:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:a[s-1].unshift({type:`loopStart`,loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:`loopEnd`,loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:`rectStart`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:`rectEnd`,color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:`optStart`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:`optEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:`altStart`,altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:`altEnd`,signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 40:a[s-1].unshift({type:`parStart`,parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_OVER_START}),a[s-1].push({type:`parEnd`,signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 41:a[s-1].unshift({type:`criticalStart`,criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:`criticalEnd`,signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 42:a[s-1].unshift({type:`breakStart`,breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:`breakEnd`,optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 44:this.$=a[s-3].concat([{type:`option`,optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 46:this.$=a[s-3].concat([{type:`and`,parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 48:this.$=a[s-3].concat([{type:`else`,altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 49:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 50:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 51:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 52:case 57:a[s-1].draw=`actor`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 53:a[s-1].type=`destroyParticipant`,this.$=a[s-1];break;case 54:a[s-3].draw=`participant`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 55:a[s-1].draw=`participant`,a[s-1].type=`addParticipant`,this.$=a[s-1];break;case 56:a[s-3].draw=`actor`,a[s-3].type=`addParticipant`,a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 58:this.$=[a[s-1],{type:`addNote`,placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 59:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:`addNote`,placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 60:this.$=[a[s-1],{type:`addLinks`,actor:a[s-1].actor,text:a[s]}];break;case 61:this.$=[a[s-1],{type:`addALink`,actor:a[s-1].actor,text:a[s]}];break;case 62:this.$=[a[s-1],{type:`addProperties`,actor:a[s-1].actor,text:a[s]}];break;case 63:this.$=[a[s-1],{type:`addDetails`,actor:a[s-1].actor,text:a[s]}];break;case 66:this.$=[a[s-2],a[s]];break;case 67:this.$=a[s];break;case 68:this.$=r.PLACEMENT.LEFTOF;break;case 69:this.$=r.PLACEMENT.RIGHTOF;break;case 70:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0},{type:`activeStart`,signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1].actor}];break;case 71:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:`activeEnd`,signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4].actor}];break;case 72:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor}];break;case 73:this.$=[a[s-4],a[s-1],{type:`addMessage`,from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s],activate:!1,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-4].actor}];break;case 74:this.$=[a[s-5],a[s-1],{type:`addMessage`,from:a[s-5].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s],activate:!0,centralConnection:r.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:`centralConnection`,signalType:r.LINETYPE.CENTRAL_CONNECTION,actor:a[s-1].actor},{type:`centralConnectionReverse`,signalType:r.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:a[s-5].actor}];break;case 75:this.$=[a[s-3],a[s-1],{type:`addMessage`,from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 76:this.$={type:`addParticipant`,actor:a[s-1],config:a[s]};break;case 77:this.$=a[s-1].trim();break;case 78:this.$={type:`addParticipant`,actor:a[s]};break;case 79:this.$=r.LINETYPE.SOLID_OPEN;break;case 80:this.$=r.LINETYPE.DOTTED_OPEN;break;case 81:this.$=r.LINETYPE.SOLID;break;case 82:this.$=r.LINETYPE.SOLID_TOP;break;case 83:this.$=r.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=r.LINETYPE.STICK_TOP;break;case 85:this.$=r.LINETYPE.STICK_BOTTOM;break;case 86:this.$=r.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=r.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=r.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=r.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=r.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=r.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=r.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=r.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=r.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=r.LINETYPE.DOTTED;break;case 100:this.$=r.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=r.LINETYPE.SOLID_CROSS;break;case 102:this.$=r.LINETYPE.DOTTED_CROSS;break;case 103:this.$=r.LINETYPE.SOLID_POINT;break;case 104:this.$=r.LINETYPE.DOTTED_POINT;break;case 105:this.$=r.parseMessage(a[s].trim().substring(1));break}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},t([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,5]),{9:48,13:13,14:l,15:u,18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,15]),{13:49,51:D,53:O,54:k},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:F},{23:56,73:F},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},t(I,[2,30]),t(I,[2,31]),{33:[1,62]},{35:[1,63]},t(I,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:ee},{23:75,55:76,73:ee},{23:77,73:F},{69:78,72:[1,79],78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:F},{23:111,73:F},{23:112,73:F},{23:113,73:F},t([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],_e),t(I,[2,6]),t(I,[2,16]),t(ve,[2,10],{11:114}),t(I,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},t(I,[2,22]),{5:[1,118]},{5:[1,119]},t(I,[2,25]),t(I,[2,26]),t(I,[2,27]),t(I,[2,28]),t(I,[2,29]),t(I,[2,32]),t(I,[2,33]),t(ye,a,{7:120}),t(ye,a,{7:121}),t(ye,a,{7:122}),t(be,a,{41:123,7:124}),t(xe,a,{43:125,7:126}),t(xe,a,{7:126,43:127}),t(Se,a,{46:128,7:129}),t(ye,a,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},t(Ce,_e,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:F},{69:146,78:L,79:R,80:te,81:ne,82:z,83:B,84:V,85:re,86:H,87:U,88:W,89:ie,90:ae,91:oe,92:G,93:se,94:K,95:ce,96:le,97:ue,98:de,99:fe,100:pe,101:me,102:he,103:ge},t(q,[2,79]),t(q,[2,80]),t(q,[2,81]),t(q,[2,82]),t(q,[2,83]),t(q,[2,84]),t(q,[2,85]),t(q,[2,86]),t(q,[2,87]),t(q,[2,88]),t(q,[2,89]),t(q,[2,90]),t(q,[2,91]),t(q,[2,92]),t(q,[2,93]),t(q,[2,94]),t(q,[2,95]),t(q,[2,96]),t(q,[2,97]),t(q,[2,98]),t(q,[2,99]),t(q,[2,100]),t(q,[2,101]),t(q,[2,102]),t(q,[2,103]),t(q,[2,104]),{23:147,73:F},{23:149,60:148,73:F},{73:[2,68]},{73:[2,69]},{58:150,104:J},{58:152,104:J},{58:153,104:J},{58:154,104:J},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:D,53:O,54:k},{5:[1,160]},t(I,[2,20]),t(I,[2,21]),t(I,[2,23]),t(I,[2,24]),{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,161],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,162],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,163],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,164]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,47],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,50:[1,165],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,166]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,45],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,49:[1,167],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{17:[1,168]},{17:[1,169]},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[2,43],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,48:[1,170],51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{4:o,5:s,8:8,9:10,10:c,13:13,14:l,15:u,17:[1,171],18:16,19:d,22:f,23:41,24:p,25:20,26:21,27:22,28:23,29:24,30:m,31:h,32:g,34:_,36:v,37:y,38:b,39:x,40:S,42:C,44:w,45:T,47:E,51:D,53:O,54:k,56:A,61:j,62:M,63:N,64:P,73:F},{16:[1,172]},t(I,[2,50]),{16:[1,173]},t(I,[2,55]),t(Ce,[2,76]),{76:[1,174]},{16:[1,175]},t(I,[2,52]),{16:[1,176]},t(I,[2,57]),t(I,[2,53]),{23:177,73:F},{23:178,73:F},{23:179,73:F},{58:180,104:J},{23:181,72:[1,182],73:F},{58:183,104:J},{58:184,104:J},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},t(I,[2,17]),t(ve,[2,11]),{13:186,51:D,53:O,54:k},t(ve,[2,13]),t(ve,[2,14]),t(I,[2,19]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(I,[2,38]),{16:[1,187]},t(I,[2,39]),{16:[1,188]},t(I,[2,40]),t(I,[2,41]),{16:[1,189]},t(I,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:J},{58:196,104:J},{58:197,104:J},{5:[2,75]},{58:198,104:J},{23:199,73:F},{5:[2,58]},{5:[2,59]},{23:200,73:F},t(ve,[2,12]),t(be,a,{7:124,41:201}),t(xe,a,{7:126,43:202}),t(Se,a,{7:129,46:203}),t(I,[2,49]),t(I,[2,54]),t(Ce,[2,77]),t(I,[2,51]),t(I,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:J},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;typeof g.yy.parseError==`function`?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};we.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{i as t,r as n}from"./bundle-mjs-D3mlU5Wg.js";import{t as r}from"./react-dom-Cmec2Q1Q.js";import{$ as i,A as a,B as o,Bt as s,D as c,E as l,F as u,Ht as d,I as f,K as p,L as m,Mt as h,O as g,P as _,Q as v,R as y,Rt as b,S as x,T as S,U as C,V as w,Vt as T,W as E,X as D,Y as O,Z as k,_ as A,c as j,ct as M,d as N,dt as P,et as F,f as I,ft as ee,g as L,h as te,k as ne,l as re,lt as ie,m as ae,p as oe,st as se,u as ce,v as R,w as le,x as ue,xt as de,y as z}from"./vscode-CAVw_AZi.js";import{A as fe,C as pe,D as me,E as he,F as B,I as ge,M as V,N as _e,O as ve,P as H,S as ye,T as U,_ as be,a as xe,b as Se,c as Ce,d as we,f as Te,g as Ee,h as De,i as Oe,j as ke,k as Ae,l as je,n as Me,p as Ne,r as Pe,s as Fe,t as W,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./label-CutRt30b.js";import{a as Ve,i as He,n as Ue,r as We,t as G}from"./desktop-client-BKJwuQxH.js";import{a as Ge,i as Ke,n as qe,r as Je,t as Ye}from"./switch-DQs_IHZT.js";import{$ as Xe,B as Ze,C as Qe,Ct as $e,G as et,Mt as tt,Nt as nt,O as rt,Pt as it,Q as at,S as ot,Tt as st,W as ct,X as lt,Z as ut,_ as dt,a as ft,at as pt,b as mt,bt as K,c as ht,ct as gt,d as _t,dt as vt,et as yt,f as bt,ft as xt,g as q,gt as St,h as Ct,ht as J,i as wt,it as Tt,kt as Et,m as Dt,mt as Y,n as Ot,nt as kt,o as At,ot as jt,pt as Mt,r as Nt,rt as Pt,s as Ft,t as X,tt as It,u as Lt,v as Rt,vt as zt,w as Bt,wt as Vt,x as Ht,xt as Ut,y as Wt,yt as Gt,z as Kt}from"./index-DGmyn1v-.js";var qt=S(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Jt=S(`building`,[[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M12 6h.01`,key:`1vi96p`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M16 6h.01`,key:`1x0f13`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M8 6h.01`,key:`1dz90k`}],[`path`,{d:`M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`,key:`cabbwy`}],[`rect`,{x:`4`,y:`2`,width:`16`,height:`20`,rx:`2`,key:`1uxh74`}]]),Yt=S(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Xt=S(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Zt=S(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Qt=S(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),$t=S(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),en=S(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),tn=S(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),nn=S(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),rn=S(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),an=S(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),on=S(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),sn=S(`receipt`,[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]),Z=e(t(),1),cn=Z.createContext({disabled:!1});function ln(){return Z.useContext(cn)}var un=Z.createContext(void 0);function dn(e=!0){let t=Z.useContext(un);if(t===void 0&&!e)throw Error(s(3));return t}var Q=n();function fn(e){let t=e instanceof Error?e.message:String(e);return t.includes(`unsupported desktop command: cline_account`)?Error(`The desktop sidecar is running an older build that does not support account commands. Restart the sidecar or reload the app, then try again.`):e instanceof Error?e:Error(t)}function pn(e){let t=e.toLowerCase();return t.includes(`no cline account auth token found`)||t.includes(`requires re-authentication`)||t.includes(`auth token`)||t.includes(`unauthorized`)}async function mn(){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchMe`})}async function hn(){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchBalance`})}async function gn(){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchUserOrganizations`})}async function _n(e){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchOrganizationBalance`,organizationId:e})}async function vn(){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchUsageTransactions`})}async function yn(e,t){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchOrganizationUsageTransactions`,organizationId:e,...t?.trim()?{memberId:t.trim()}:{}})}async function bn(){return await G.invoke(`cline_account`,{action:`clineAccount`,operation:`fetchPaymentTransactions`})}function xn(){let[e,t]=(0,Z.useState)(`overview`),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)([]),[p,m]=(0,Z.useState)(!0),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useRef)(0),[E,D]=(0,Z.useState)([]),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(null),[M,N]=(0,Z.useState)(!1),P=d.find(e=>e.active)??null,F=(0,Z.useCallback)(()=>{a(null),s(null),u(null),f([]),v([]),w(!1),S(null),D([]),N(!1),j(null)},[]),I=(0,Z.useCallback)(async()=>{m(!0),g(null);try{let[e,t,n]=await Promise.all([mn(),hn(),gn()]),r=n.find(e=>e.active)??null,i=r?await _n(r.organizationId):null;a(e),s(t),u(i),f(n)}catch(e){F();let t=fn(e).message;g(t)}finally{m(!1)}},[F]);(0,Z.useEffect)(()=>{I()},[I]);let ee=async()=>{r(`sign-in`),g(null);try{await G.invoke(`run_provider_oauth_login`,{provider:`cline`}),await I(),t(`overview`)}catch(e){let t=fn(e).message;g(t),F()}finally{r(null)}},L=async()=>{r(`sign-out`);try{await G.invoke(`save_provider_settings`,{provider:`cline`,api_key:``,settings:{auth:{accessToken:``,refreshToken:``,accountId:``}}}),F(),t(`overview`),g(`No Cline account auth token found`)}catch(e){let t=fn(e).message;g(t)}finally{r(null)}},te=(0,Z.useCallback)(async()=>{let e=T.current;b(!0),S(null);try{let t=P?await yn(P.organizationId,P.memberId):await vn();if(T.current!==e)return;v(t),w(!0)}catch(t){if(T.current!==e)return;let n=fn(t).message;S(n)}finally{T.current===e&&b(!1)}},[P]);(0,Z.useEffect)(()=>{T.current+=1,v([]),w(!1),S(null)},[P?.organizationId]),(0,Z.useEffect)(()=>{e===`usage`&&!C&&te()},[e,C,te]);let ne=(0,Z.useCallback)(async()=>{k(!0),j(null);try{let e=await bn();D(e),N(!0)}catch(e){let t=fn(e).message;j(t)}finally{k(!1)}},[]);(0,Z.useEffect)(()=>{e===`billing`&&!M&&ne()},[e,M,ne]);let re=e=>new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`}),ie=e=>new Date(e).toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`}),ae=(e,t=2)=>new Intl.NumberFormat(`en-US`,{minimumFractionDigits:t,maximumFractionDigits:t}).format(e/1e6),oe=P?c?.balance??o?.balance??null:o?.balance??null,se=[`overview`,`usage`,`billing`],ce=(e,t)=>(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-12 text-center`,children:[(0,Q.jsx)(Xt,{className:`h-8 w-8 text-destructive`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-md`,children:e}),(0,Q.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 rounded-lg border border-border px-3.5 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(He,{className:`h-4 w-4`}),`Retry`]})]}),R=()=>(0,Q.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-6`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col items-center gap-4 py-8 text-center`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,Q.jsx)(ct,{className:`h-6 w-6`})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`Sign in to Cline`}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Connect your Cline account to review credits, usage, billing, and organization details from Cline Hub.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Q.jsxs)(z,{disabled:n!==null,onClick:()=>void ee(),type:`button`,children:[n===`sign-in`?(0,Q.jsx)(Ge,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(nn,{className:`h-4 w-4`}),n===`sign-in`?`Signing in`:`Sign in`]}),(0,Q.jsxs)(`a`,{className:`inline-flex h-9 items-center gap-2 rounded-lg border border-border px-3.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,href:`https://app.cline.bot`,rel:`noopener noreferrer`,target:`_blank`,children:[`Create account`,(0,Q.jsx)(Ve,{className:`h-4 w-4`})]})]})]})}),le=()=>(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,Q.jsx)(Ge,{className:`h-6 w-6 animate-spin text-muted-foreground`})});return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ft,{description:`Review account, usage, billing, and organization details.`,title:`Account`}),(0,Q.jsx)(`div`,{className:`mb-6 flex items-center gap-0 border-b border-border`,children:se.map(n=>{let r=!i&&n!==`overview`;return(0,Q.jsxs)(`button`,{disabled:r,type:`button`,onClick:()=>t(n),className:l(`relative px-4 py-2.5 text-sm font-medium capitalize transition-colors`,e===n?`text-foreground`:`text-muted-foreground hover:text-foreground`,r&&`cursor-not-allowed opacity-45 hover:text-muted-foreground`),children:[n,e===n&&(0,Q.jsx)(`span`,{className:`absolute inset-x-0 -bottom-px h-0.5 bg-foreground`})]},n)})}),e===`overview`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[p&&le(),h&&(pn(h)?R():ce(h,I)),!p&&!h&&i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`rounded-lg border border-border p-5`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex h-16 w-16 shrink-0 items-center justify-center rounded-full bg-primary/20 text-2xl font-bold text-primary`,children:i.displayName?.charAt(0)??i.email?.charAt(0)??`?`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:i.displayName||i.email}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:i.email}),(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Member since `,re(i.createdAt)]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/dashboard`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:[`Open dashboard`,(0,Q.jsx)(Ve,{className:`h-3.5 w-3.5`})]}),(0,Q.jsxs)(z,{className:`h-8 rounded-md px-2.5 text-xs`,disabled:n!==null,onClick:()=>void L(),type:`button`,variant:`outline`,children:[n===`sign-out`?(0,Q.jsx)(Ge,{className:`h-3.5 w-3.5 animate-spin`}):(0,Q.jsx)(rn,{className:`h-3.5 w-3.5`}),n===`sign-out`?`Signing out`:`Sign out`]})]})]})}),oe!==null&&(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Qt,{className:`h-5 w-5 text-primary`}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:P?`${P.name} Balance`:`Credits Balance`})]}),(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/dashboard/organization?tab=credits&redirect=true`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(V,{className:`h-3.5 w-3.5`}),`Credit`]})]}),(0,Q.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,Q.jsxs)(`span`,{className:`text-3xl font-bold text-foreground`,children:[`$`,ae(oe)]})}),P&&o&&(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Personal account: `,ae(o.balance),` `,`credits`]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(Jt,{className:`h-5 w-5 text-muted-foreground`}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Organizations`})]}),(0,Q.jsxs)(`a`,{href:`https://app.cline.bot/onboarding?step=1`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:[(0,Q.jsx)(V,{className:`h-3.5 w-3.5`}),`Create`]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No organizations yet.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-4 py-3 transition-colors hover:bg-accent/20`,children:[(0,Q.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-secondary text-sm font-bold text-foreground`,children:e.name.charAt(0)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e.name}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground capitalize`,children:e.roles.join(`, `)})]}),e.active&&(0,Q.jsx)(`span`,{className:`rounded-full bg-primary/20 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]},e.organizationId))})]})]})]}),e===`usage`&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-6 text-sm text-muted-foreground`,children:P?`Recent API usage and token consumption for ${P.name}.`:`Recent API usage and token consumption across all providers.`}),y&&le(),x&&ce(x,te),!y&&!x&&C&&(_.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No usage transactions yet.`}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto_auto] gap-4 border-b border-border bg-secondary/50 px-4 py-2.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Model`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Credits`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Time`})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:_.map(e=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-3 text-sm transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground truncate`,children:e.aiModelName}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.aiInferenceProviderName})]}),(0,Q.jsx)(`div`,{className:`text-right text-muted-foreground`,children:e.totalTokens.toLocaleString()}),(0,Q.jsx)(`div`,{className:`text-right text-foreground font-medium`,children:ae(e.creditsUsed)}),(0,Q.jsxs)(`div`,{className:`text-right text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:re(e.createdAt)}),(0,Q.jsx)(`p`,{children:ie(e.createdAt)})]})]},e.id))})]}))]}),e===`billing`&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-6 text-sm text-muted-foreground`,children:`Payment history and credit purchases.`}),O&&le(),A&&ce(A,ne),!O&&!A&&M&&(E.length===0?(0,Q.jsx)(`p`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No payment transactions yet.`}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto] gap-4 border-b border-border bg-secondary/50 px-4 py-2.5 text-xs font-medium text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Date`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,Q.jsx)(`span`,{className:`text-right`,children:`Credits`})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:E.map(e=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_auto] gap-4 px-4 py-3 text-sm transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(sn,{className:`h-4 w-4 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:`text-foreground`,children:re(e.paidAt)})]}),(0,Q.jsxs)(`div`,{className:`text-right text-foreground font-medium`,children:[`$`,(e.amountCents/100).toFixed(2)]}),(0,Q.jsxs)(`div`,{className:`text-right text-primary font-medium`,children:[`+`,ae(e.credits)]})]},`${e.paidAt}-${e.amountCents}-${e.credits}`))})]}))]})]})}var Sn=[`streaming`,`tools`,`reasoning`,`vision`,`prompt-cache`];function Cn({onBack:e,onSave:t,existingProviderIds:n}){let[r,i]=(0,Z.useState)({providerId:``,name:``,models:[],defaultModel:``,apiKey:``,baseUrl:``,modelsSourceUrl:``,headers:{},timeoutMs:``,capabilities:[`streaming`,`tools`]}),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),g=(0,Z.useMemo)(()=>r.providerId.trim().toLowerCase().replace(/\s+/g,`-`),[r.providerId]),_=n.includes(g),v=r.models.length>0,y=r.modelsSourceUrl.trim().length>0,b=g.length>0&&r.name.trim().length>0&&r.baseUrl.trim().length>0&&(v||y)&&!_,x=e=>{if((e.key===`Enter`||e.key===`,`)&&a.trim()){e.preventDefault();let t=a.trim().replace(/,/g,``);t&&!r.models.includes(t)&&i(e=>({...e,models:[...e.models,t],defaultModel:e.defaultModel||t})),o(``)}else e.key===`Backspace`&&!a&&r.models.length>0&&i(e=>({...e,models:e.models.slice(0,-1)}))},S=e=>{i(t=>{let n=t.models.filter(t=>t!==e);return{...t,models:n,defaultModel:t.defaultModel===e?n[0]??``:t.defaultModel}})},C=e=>{i(t=>({...t,capabilities:t.capabilities.includes(e)?t.capabilities.filter(t=>t!==e):[...t.capabilities,e]}))},w=()=>{i(e=>({...e,headers:{...e.headers,"":``}}))},T=(e,t,n)=>{let a=Object.entries(r.headers),o={};a.forEach(([e,r],i)=>{o[i===n?t:e]=r}),e!==t&&delete o[e],i(e=>({...e,headers:o}))},E=(e,t)=>{i(n=>({...n,headers:{...n.headers,[e]:t}}))},D=e=>{let t={...r.headers};delete t[e],i(e=>({...e,headers:t}))},O=async()=>{if(!(!b||f)){p(!0),h(null);try{await t({providerId:g,name:r.name.trim(),baseUrl:r.baseUrl.trim(),apiKey:r.apiKey.trim()||void 0,headers:Object.fromEntries(Object.entries(r.headers).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0)),timeoutMs:r.timeoutMs.trim().length>0?Number.parseInt(r.timeoutMs.trim(),10):void 0,models:r.models,defaultModelId:r.defaultModel||r.models[0],modelsSourceUrl:r.modelsSourceUrl.trim()||void 0,capabilities:r.capabilities.length>0?r.capabilities:void 0})}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}};return(0,Q.jsxs)(At,{contentClassName:`max-w-4xl`,children:[(0,Q.jsx)(Ft,{description:`Add an OpenAI-compatible provider and choose its available models.`,title:`Add Provider`,actions:(0,Q.jsxs)(z,{onClick:e,variant:`secondary`,className:`rounded-md p-1.5 transition-colors`,"aria-label":`Back to providers`,children:[(0,Q.jsx)(qt,{className:`h-4 w-4`}),`Providers`]})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(`h3`,{className:`mb-4 text-sm font-semibold text-foreground`,children:`OpenAI-Compatible Provider`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Provider ID`}),(0,Q.jsx)(`input`,{type:`text`,value:r.providerId,onChange:e=>i(t=>({...t,providerId:e.target.value})),placeholder:`my-provider`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Lowercase ID used in provider registry.`}),_?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-destructive`,children:`This provider ID already exists.`}):null]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Provider Name`}),(0,Q.jsx)(`input`,{type:`text`,value:r.name,onChange:e=>i(t=>({...t,name:e.target.value})),placeholder:`My Provider`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]})]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Base URL`}),(0,Q.jsx)(`input`,{type:`url`,value:r.baseUrl,onChange:e=>i(t=>({...t,baseUrl:e.target.value})),placeholder:`https://api.example.com/v1`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Model Source URL (Optional)`}),(0,Q.jsx)(`input`,{type:`url`,value:r.modelsSourceUrl,onChange:e=>i(t=>({...t,modelsSourceUrl:e.target.value})),placeholder:`https://api.example.com/v1/models`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:"Supported JSON: OpenAI `/models` shape with a `data` array, or a direct model array."})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Models`}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 flex-wrap content-start gap-1.5 rounded-lg border border-border bg-input px-3 py-2 focus-within:ring-1 focus-within:ring-ring`,children:[r.models.map(e=>(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-1 text-xs font-medium text-primary`,children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e}),(0,Q.jsx)(z,{onClick:()=>S(e),className:`text-primary/60 hover:text-primary transition-colors`,"aria-label":`Remove ${e}`,children:(0,Q.jsx)(ke,{className:`h-3 w-3`})})]},e)),(0,Q.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),onKeyDown:x,placeholder:r.models.length===0?`Type model ID and press Enter`:``,className:`min-w-35 flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none`})]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Add at least one model or set a Model Source URL.`})]}),r.models.length>1?(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Default Model`}),(0,Q.jsx)(`select`,{value:r.defaultModel,onChange:e=>i(t=>({...t,defaultModel:e.target.value})),className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring`,children:r.models.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}):null,(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`API Key (Optional)`}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{type:s?`text`:`password`,value:r.apiKey,onChange:e=>i(t=>({...t,apiKey:e.target.value})),placeholder:`sk-...`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 pr-20 font-mono text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsxs)(`div`,{className:`absolute right-2 top-1/2 flex -translate-y-1/2 items-center gap-1`,children:[(0,Q.jsx)(z,{onClick:()=>c(!s),variant:`ghost`,className:`rounded-md p-1 transition-colors`,"aria-label":s?`Hide API key`:`Show API key`,children:s?(0,Q.jsx)($t,{className:`h-4 w-4`}):(0,Q.jsx)(en,{className:`h-4 w-4`})}),(0,Q.jsx)(z,{onClick:()=>navigator.clipboard.writeText(r.apiKey),variant:`ghost`,className:`rounded-md p-1 transition-colors`,"aria-label":`Copy API key`,children:(0,Q.jsx)(H,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border p-5`,children:[(0,Q.jsx)(W,{className:`mb-3 block text-xs font-medium text-muted-foreground`,children:`Capabilities`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Sn.map(e=>(0,Q.jsx)(z,{onClick:()=>C(e),className:l(`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all`,r.capabilities.includes(e)?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-card text-muted-foreground hover:border-muted-foreground/50 hover:text-foreground`),children:e.replace(/-/g,` `)},e))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border overflow-hidden`,children:[(0,Q.jsxs)(z,{onClick:()=>d(!u),className:`flex w-full items-center justify-between px-5 py-4 text-sm font-medium transition-colors text-foreground/40`,variant:`ghost`,children:[`Advanced Settings`,(0,Q.jsx)(ge,{className:l(`h-4 w-4 text-muted-foreground transition-transform`,u&&`rotate-180`)})]}),u?(0,Q.jsxs)(`div`,{className:`border-t border-border px-5 py-5 flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Timeout (ms)`}),(0,Q.jsx)(`input`,{type:`number`,value:r.timeoutMs,onChange:e=>i(t=>({...t,timeoutMs:e.target.value})),placeholder:`30000`,className:`w-full rounded-lg border border-border bg-input px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{className:`mb-2 block text-xs font-medium text-muted-foreground`,children:`Custom Headers`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Object.entries(r.headers).map(([e,t],n)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,value:e,onChange:t=>T(e,t.target.value,n),placeholder:`Header name`,className:`flex-1 rounded-lg border border-border bg-input px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(`input`,{type:`text`,value:t,onChange:t=>E(e,t.target.value),placeholder:`Value`,className:`flex-1 rounded-lg border border-border bg-input px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 outline-none focus:ring-1 focus:ring-ring`}),(0,Q.jsx)(z,{onClick:()=>D(e),className:`rounded-md p-2 text-muted-foreground hover:text-destructive transition-colors`,"aria-label":`Remove header`,children:(0,Q.jsx)(le,{className:`h-4 w-4`})})]},e)),(0,Q.jsxs)(z,{onClick:w,className:`flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors w-fit`,children:[(0,Q.jsx)(V,{className:`h-3 w-3`}),`Add Header`]})]})]})]}):null]}),m?(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:m}):null,(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-3 pt-2`,children:[(0,Q.jsx)(z,{onClick:e,className:`rounded-lg border border-border px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,children:`Cancel`}),(0,Q.jsx)(z,{onClick:()=>void O(),disabled:!b||f,className:l(`rounded-lg px-4 py-2 text-sm font-medium transition-colors`,b&&!f?`bg-primary text-primary-foreground hover:bg-primary/90`:`bg-muted text-muted-foreground cursor-not-allowed`),children:f?`Saving...`:`Add Provider`})]})]})]})}function wn(e,t){return t.find(t=>t.id===e.type)?.name??e.type}function Tn(e){return e.botUsername?`@${e.botUsername}`:e.userName?e.userName:e.applicationId?e.applicationId:`pid ${e.pid}`}function En(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Dn(e){let t=e.label.toLowerCase(),n=`flag`in e?e.flag.toLowerCase():e.key.toLowerCase();return t.includes(`token`)||t.includes(`secret`)||t.includes(`key`)||n.includes(`token`)||n.includes(`secret`)||n.includes(`key`)}function On(e){return e.label.toLowerCase().includes(`json`)||e.flag.includes(`credentials`)}function kn(e,t){let n=e.includeWhen;if(!n)return!0;let r=t[n.flag]??``;return!(n.equals!==void 0&&r!==n.equals||n.notEquals!==void 0&&r===n.notEquals)}function An(e){let t={};for(let n of e?.fields??[])n.initialValue&&(t[n.flag]=n.initialValue);return t}function jn(e){let t=e[0];return{channelId:t?.id??``,values:An(t),securityEnabled:!1,securityValues:{}}}function Mn(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(null),[c,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)({channelId:``,values:{},securityEnabled:!1,securityValues:{}}),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),y=(0,Z.useMemo)(()=>e.find(e=>e.id===p.channelId),[e,p.channelId]),b=(0,Z.useMemo)(()=>{let e={...An(y),...p.values};return(y?.fields??[]).filter(t=>kn(t,e))},[y,p.values]),x=(0,Z.useCallback)(e=>{t(e.available),r(e.active),m(t=>t.channelId?t:jn(e.available))},[]),S=(0,Z.useCallback)(async()=>{a(!0),u(null);try{let e=await G.invoke(`list_connector_channels`);x(e)}catch(e){let t=e instanceof Error?e.message:String(e);u(t)}finally{a(!1)}},[x]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{S()},0);return()=>window.clearTimeout(e)},[S]);let C=()=>{m(jn(e)),g(null),f(!0)},w=(e,t)=>{m(n=>({...n,values:{...n.values,[e]:t}}))},T=(e,t)=>{m(n=>({...n,securityValues:{...n.securityValues,[e]:t}}))},E=async()=>{if(!y){g(`Choose a channel`);return}for(let e of y.fields)if(b.includes(e)&&e.required&&!p.values[e.flag]?.trim()){g(`${e.label} is required`);return}if(p.securityEnabled&&y.security){for(let e of y.security.fields)if(!p.securityValues[e.key]?.trim()){g(e.requiredMessage);return}}s(y.id),g(null),u(null);try{let e=await G.invoke(`start_connector_channel`,{channel:y.id,values:p.values,security:{enabled:p.securityEnabled,values:p.securityValues}});x(e),f(!1)}catch(e){let t=e instanceof Error?e.message:String(e);g(t)}finally{s(null)}},D=async e=>{s(e.type),u(null);try{let t=await G.invoke(`stop_connector_channel`,{channel:e.type});x(t),v(null)}catch(e){let t=e instanceof Error?e.message:String(e);u(t)}finally{s(null)}};return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ft,{description:`${n.length} connected. Start and manage connector channels for Cline Hub.`,title:`Channels`,meta:(0,Q.jsx)(wt,{children:`cline connect`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{disabled:i,onClick:()=>void S(),size:`sm`,type:`button`,variant:`outline`,children:(0,Q.jsx)(He,{className:l(`size-4`,i&&`animate-spin`)})}),(0,Q.jsxs)(z,{disabled:e.length===0,onClick:C,size:`sm`,type:`button`,children:[(0,Q.jsx)(V,{className:`size-4`}),`Add Channel`]})]})}),c?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:c}):null,i?(0,Q.jsx)(ft,{children:`Loading channels...`}):n.length===0?(0,Q.jsx)(ft,{children:`No channels connected.`}):(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-lg border bg-card`,children:(0,Q.jsx)(`div`,{className:`grid gap-2 p-2.5`,children:n.map(t=>(0,Q.jsxs)(`div`,{className:`grid gap-3 border bg-[color-mix(in_oklch,var(--background)_70%,var(--card))] p-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(B,{className:`size-2 fill-emerald-300 text-emerald-300`}),(0,Q.jsx)(`p`,{className:`truncate text-[13px] font-semibold leading-tight`,children:wn(t,e)}),(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-muted-foreground`,children:Tn(t)})]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:[`pid=`,t.pid]}),(0,Q.jsx)(`span`,{className:`max-w-full break-all rounded-md border bg-background px-1.5 py-0.5`,title:t.hubUrl,children:t.hubUrl}),t.baseUrl?(0,Q.jsx)(`span`,{className:`max-w-full break-all rounded-md border bg-background px-1.5 py-0.5`,title:t.baseUrl,children:t.baseUrl}):null,(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:En(t.startedAt)}),t.connectionMode?(0,Q.jsx)(`span`,{className:`rounded-md border bg-background px-1.5 py-0.5`,children:t.connectionMode}):null]})]}),(0,Q.jsxs)(z,{disabled:o===t.type,onClick:()=>v(t),size:`sm`,type:`button`,variant:`outline`,children:[(0,Q.jsx)(le,{className:`size-4`}),`Remove...`]})]},t.id))})}),(0,Q.jsx)(Ce,{open:d,onOpenChange:f,children:(0,Q.jsxs)(je,{className:`max-h-[86vh] overflow-y-auto sm:max-w-xl`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ne,{children:`Add Channel`}),(0,Q.jsx)(Ie,{children:`Start a connector channel for Cline Hub.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{children:`Channel`}),(0,Q.jsxs)(De,{onValueChange:t=>{t&&m({channelId:t,values:An(e.find(e=>e.id===t)),securityEnabled:!1,securityValues:{}})},value:p.channelId,children:[(0,Q.jsx)(Le,{children:(0,Q.jsx)(Be,{placeholder:`Select channel`})}),(0,Q.jsx)(Ee,{children:e.map(e=>(0,Q.jsx)(be,{value:e.id,children:e.name},e.id))})]})]}),b.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(W,{children:[e.label,e.required?(0,Q.jsx)(`span`,{className:`text-destructive`,children:` *`}):null]}),e.options?(0,Q.jsxs)(De,{onValueChange:t=>{t&&w(e.flag,t)},value:p.values[e.flag]??e.initialValue??``,children:[(0,Q.jsx)(Le,{children:(0,Q.jsx)(Be,{placeholder:e.placeholder})}),(0,Q.jsx)(Ee,{children:e.options.map(e=>(0,Q.jsx)(be,{value:e.value,children:e.label},e.value))})]}):On(e)?(0,Q.jsx)(Fe,{onChange:t=>w(e.flag,t.target.value),placeholder:e.placeholder,rows:5,value:p.values[e.flag]??``}):(0,Q.jsx)(j,{onChange:t=>w(e.flag,t.target.value),placeholder:e.placeholder,type:Dn(e)?`password`:`text`,value:p.values[e.flag]??``})]},e.flag)),y?.security?(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(W,{className:`text-sm`,children:`Restrict access`}),(0,Q.jsx)(Ye,{checked:p.securityEnabled,onCheckedChange:e=>m(t=>({...t,securityEnabled:e}))})]}),p.securityEnabled?y.security.fields.map(e=>(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{children:e.label}),(0,Q.jsx)(j,{onChange:t=>T(e.key,t.target.value),placeholder:e.placeholder,type:Dn(e)?`password`:`text`,value:p.securityValues[e.key]??``})]},e.key)):null]}):null,h?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:h}):null]}),(0,Q.jsxs)(we,{children:[(0,Q.jsx)(z,{disabled:o!==null,onClick:()=>f(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,Q.jsx)(z,{disabled:o!==null||!y,onClick:()=>void E(),type:`button`,children:o?`Starting...`:`Add Channel`})]})]})}),(0,Q.jsx)(q,{open:_!==null,onOpenChange:e=>{e||v(null)},children:(0,Q.jsxs)(Wt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(Qe,{children:`Remove Channel`}),(0,Q.jsxs)(mt,{children:[`Confirm that you want to stop the active`,` `,_?wn(_,e):`channel`,` `,`channel for `,_?Tn(_):``,`.`]})]}),(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(Rt,{disabled:o!==null,children:`Cancel`}),(0,Q.jsx)(dt,{disabled:o!==null||!_,onClick:()=>{_&&D(_)},variant:`destructive`,children:`Remove`})]})]})})]})}function Nn(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Pn(e){let t=Nn(e);if(t.length===0)return;let n={};for(let e of t){let t=e.indexOf(`=`);if(t<=0)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function Fn(e){return e?Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`, `):``}function In(e){return e?Object.keys(e).map(e=>`${e}=[REDACTED]`).join(`, `):``}function Ln(e){return!e||Object.keys(e).length===0?[{id:crypto.randomUUID(),key:``,value:``}]:Object.entries(e).map(([e,t])=>({id:crypto.randomUUID(),key:e,value:t}))}function Rn(e){return{name:e?.name??``,previousName:e?.name??``,transportType:e?.transportType??`stdio`,command:e?.command??``,argsText:e?.args?.join(`, `)??``,cwd:e?.cwd??``,envEntries:Ln(e?.env),url:e?.url??``,headersText:Fn(e?.headers),disabled:e?.disabled??!1,metadataText:e?.metadata===void 0?``:JSON.stringify(e.metadata,null,2)}}function zn(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!0),[c,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`create`),[y,b]=(0,Z.useState)(()=>Rn()),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),T=(0,Z.useCallback)(e=>{t(e.servers),r(e.settingsPath),a(e.hasSettingsFile)},[]),E=(0,Z.useCallback)(async()=>{s(!0),f(null);try{let e=await G.invoke(`list_mcp_servers`);T(e)}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{s(!1)}},[T]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{E()},0);return()=>window.clearTimeout(e)},[E]);let D=async(e,t)=>{m(e.name),f(null);try{let n=await G.invoke(`set_mcp_server_disabled`,{name:e.name,disabled:t});T(n)}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{m(null)}},O=async e=>{m(e.previousName??e.name),f(null);try{let t=await G.invoke(`upsert_mcp_server`,{input:e});T(t)}catch(e){let t=e instanceof Error?e.message:String(e);throw f(t),e}finally{m(null)}},k=async e=>{m(e),f(null);try{let t=await G.invoke(`delete_mcp_server`,{name:e});T(t)}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{m(null)}},A=(0,Z.useCallback)(e=>{let t=e.name.trim();if(!t)throw Error(`Server name is required.`);let n=e.envEntries.reduce((e,t)=>{let n=t.key.trim();return n&&(e[n]=t.value),e},{}),r=e.metadataText.trim(),i=r.length>0?JSON.parse(r):void 0;if(e.transportType===`stdio`){let r=e.command.trim();if(!r)throw Error(`Command is required for stdio transport.`);let a=Nn(e.argsText);return{name:t,previousName:e.previousName.trim()||void 0,transportType:e.transportType,command:r,args:a.length>0?a:void 0,cwd:e.cwd.trim()||void 0,env:Object.keys(n).length>0?n:void 0,disabled:e.disabled,metadata:i}}let a=e.url.trim();if(!a)throw Error(`URL is required for sse and streamableHttp transport.`);return{name:t,previousName:e.previousName.trim()||void 0,transportType:e.transportType,url:a,headers:Pn(e.headersText),disabled:e.disabled,metadata:i}},[]),M=()=>{v(`create`),b(Rn()),S(null),g(!0)},N=e=>{v(`edit`),b(Rn(e)),S(null),g(!0)},P=async()=>{S(null);try{let e=A(y);await O(e),g(!1)}catch(e){S(e instanceof Error?e.message:String(e))}},F=async()=>{u(!0),f(null);try{let e=await G.invoke(`open_mcp_settings_file`);e.trim().length>0&&(r(e),a(!0))}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{u(!1)}},I=(0,Z.useMemo)(()=>[...e].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase())),[e]),ee=(e,t,n)=>{b(r=>({...r,envEntries:r.envEntries.map(r=>r.id===e?{...r,[t]:n}:r)}))},L=()=>{b(e=>({...e,envEntries:[...e.envEntries,{id:crypto.randomUUID(),key:``,value:``}]}))},te=e=>{b(t=>({...t,envEntries:t.envEntries.length===1?[{id:crypto.randomUUID(),key:``,value:``}]:t.envEntries.filter(t=>t.id!==e)}))};return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ft,{description:i?`Editing this list updates cline_mcp_settings.json.`:`No MCP settings file found yet. Add a server to create it.`,title:`MCP Servers`,meta:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(wt,{children:`cline config mcp`}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border bg-background px-2 py-0.5 text-xs text-muted-foreground`,children:`From settings file`})]}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void E(),disabled:o,children:(0,Q.jsx)(He,{className:l(`h-4 w-4`,o&&`animate-spin`)})}),(0,Q.jsxs)(z,{size:`sm`,onClick:M,children:[(0,Q.jsx)(V,{className:`h-4 w-4`}),`Add MCP Server`]})]})}),(0,Q.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`MCP settings path:`}),(0,Q.jsx)(z,{variant:`link`,className:`h-auto p-0 font-mono text-xs`,onClick:()=>void F(),disabled:c,children:n||`Open settings file`})]}),d&&(0,Q.jsx)(`div`,{className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:d}),o?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-5 py-4 text-sm text-muted-foreground`,children:`Loading MCP servers...`}):I.length===0?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-5 py-4 text-sm text-muted-foreground`,children:`No MCP servers configured.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:I.map(e=>{let t=p===e.name;return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4 transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(B,{className:l(`h-2.5 w-2.5 shrink-0`,e.disabled?`fill-muted-foreground/40 text-muted-foreground/40`:`fill-primary text-primary`)}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.transportType}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit ${e.name}`,onClick:()=>N(e),disabled:t,children:(0,Q.jsx)(Kt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,onClick:()=>w(e),disabled:t,children:(0,Q.jsx)(le,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(Ye,{checked:!e.disabled,onCheckedChange:t=>D(e,!t),disabled:t,"aria-label":`Enable ${e.name}`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 ml-5.5 flex flex-col gap-1 text-xs text-muted-foreground`,children:[e.command&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Command:`}),` `,e.command]}),e.args&&e.args.length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Args:`}),` `,e.args.join(`, `)]}),e.cwd&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`CWD:`}),` `,e.cwd]}),e.url&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`URL:`}),` `,e.url]}),e.env&&Object.keys(e.env).length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Env:`}),` `,In(e.env)]}),e.headers&&Object.keys(e.headers).length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Headers:`}),` `,Fn(e.headers)]})]})]},e.name)})}),(0,Q.jsx)(Ce,{open:h,onOpenChange:e=>{g(e),e||S(null)},children:(0,Q.jsxs)(je,{className:`max-h-[90vh] overflow-y-auto sm:max-w-2xl`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ne,{children:_===`edit`?`Edit MCP Server`:`Add MCP Server`}),(0,Q.jsxs)(Ie,{children:[`Update the MCP server stored in`,` `,(0,Q.jsx)(`code`,{className:`font-mono`,children:n||`cline_mcp_settings.json`}),`.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-name`,children:`Server name`}),(0,Q.jsx)(j,{id:`mcp-name`,value:y.name,onChange:e=>b(t=>({...t,name:e.target.value})),placeholder:`github`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{children:`Transport type`}),(0,Q.jsxs)(De,{value:y.transportType,onValueChange:e=>b(t=>({...t,transportType:e})),children:[(0,Q.jsx)(Le,{className:`w-full`,children:(0,Q.jsx)(Be,{placeholder:`Select transport`})}),(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(be,{value:`stdio`,children:`stdio`}),(0,Q.jsx)(be,{value:`sse`,children:`sse`}),(0,Q.jsx)(be,{value:`streamableHttp`,children:`streamableHttp`})]})]})]}),y.transportType===`stdio`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-command`,children:`Command`}),(0,Q.jsx)(j,{id:`mcp-command`,value:y.command,onChange:e=>b(t=>({...t,command:e.target.value})),placeholder:`npx`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-args`,children:`Args`}),(0,Q.jsx)(Fe,{id:`mcp-args`,value:y.argsText,onChange:e=>b(t=>({...t,argsText:e.target.value})),placeholder:`-y, @modelcontextprotocol/server-github`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-cwd`,children:`Working directory`}),(0,Q.jsx)(j,{id:`mcp-cwd`,value:y.cwd,onChange:e=>b(t=>({...t,cwd:e.target.value})),placeholder:`/path/to/project`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(W,{children:`Environment variables`}),(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:L,children:(0,Q.jsx)(V,{className:`h-3.5 w-3.5`})})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:y.envEntries.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(z,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:()=>te(e.id),"aria-label":`Remove env var ${e.key||`row`}`,children:(0,Q.jsx)(an,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(j,{value:e.key,onChange:t=>ee(e.id,`key`,t.target.value),placeholder:`KEY`}),(0,Q.jsx)(j,{type:`password`,value:e.value,onChange:t=>ee(e.id,`value`,t.target.value),placeholder:`VALUE`})]},e.id))})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-url`,children:`Server URL`}),(0,Q.jsx)(j,{id:`mcp-url`,value:y.url,onChange:e=>b(t=>({...t,url:e.target.value})),placeholder:`https://example.com/mcp`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-headers`,children:`Headers`}),(0,Q.jsx)(Fe,{id:`mcp-headers`,value:y.headersText,onChange:e=>b(t=>({...t,headersText:e.target.value})),placeholder:`Authorization=Bearer token`})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(W,{htmlFor:`mcp-metadata`,children:`Metadata JSON`}),(0,Q.jsx)(Fe,{id:`mcp-metadata`,value:y.metadataText,onChange:e=>b(t=>({...t,metadataText:e.target.value})),placeholder:`{"key":"value"}`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Enabled`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Disable the server without removing it from settings.`})]}),(0,Q.jsx)(Ye,{checked:!y.disabled,onCheckedChange:e=>b(t=>({...t,disabled:!e})),"aria-label":`Enable MCP server`})]}),x?(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:x}):null]}),(0,Q.jsxs)(we,{children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>g(!1),disabled:p!==null,children:`Cancel`}),(0,Q.jsx)(z,{onClick:()=>void P(),disabled:p!==null,children:p===null?_===`edit`?`Save changes`:`Add server`:`Saving...`})]})]})}),(0,Q.jsx)(q,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,Q.jsxs)(Wt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(Qe,{children:`Delete MCP Server`}),(0,Q.jsx)(mt,{children:C?`Delete MCP server "${C.name}" from settings?`:`Delete this MCP server from settings?`})]}),(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(Rt,{disabled:p!==null,children:`Cancel`}),(0,Q.jsx)(dt,{disabled:p!==null||!C,onClick:()=>{C&&(k(C.name),w(null))},children:`Delete`})]})]})})]})}function Bn(e){let t={...e.configValues??{}};e.apiKey!==void 0&&t.apiKey===void 0&&(t.apiKey=e.apiKey),e.baseUrl!==void 0&&t.baseUrl===void 0&&(t.baseUrl=e.baseUrl);for(let n of e.configFields??[])t[n.path]===void 0&&n.defaultValue!==void 0&&(t[n.path]=n.defaultValue);return t}function Vn(e){return e==null?``:String(e)}function Hn(e,t){if(e.type===`boolean`)return!!t;if(typeof t==`boolean`)return t;if(e.type===`select`){let n=e.options?.find(e=>String(e.value)===t);if(n)return n.value}let n=t.trim();if(n.length===0)return null;if(e.type===`number`){let e=Number(n);return Number.isFinite(e)?e:null}return n}function Un({providers:e,onToggle:t,onConfigure:n,onAddProvider:r,selectedProviderId:i,variant:a=`page`}){let[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(``),d=e.filter(e=>e.enabled).length,f=c.trim().toLowerCase(),p=f?e.filter(e=>e.name.toLowerCase().includes(f)):e,m=a===`panel`;return(0,Q.jsx)(ht,{className:`h-full`,children:(0,Q.jsxs)(`div`,{className:l(`py-10 max-[720px]:px-4 max-[720px]:py-5`,m?`px-8`:`px-18 max-[1200px]:px-8`),children:[(0,Q.jsxs)(`div`,{className:l(`mb-8 flex items-start justify-between gap-6 max-[860px]:flex-col max-[860px]:items-stretch`,m?`max-w-none`:`max-w-[42rem]`),children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:l(`truncate font-semibold leading-[1.15] tracking-normal text-foreground`,m?`text-[24px]`:`text-[32px]`),children:`Model Providers`}),(0,Q.jsxs)(`p`,{className:`mt-3 text-[15px] leading-6 text-muted-foreground`,children:[`Configure model providers and choose which ones are available.`,` `,e.length,` available · `,d,` `,`enabled`]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 max-[860px]:justify-start`,children:[(0,Q.jsx)(z,{"aria-label":`Search providers`,className:`size-8 rounded-md`,onClick:()=>s(e=>!e),size:`icon-sm`,type:`button`,variant:o?`default`:`secondary`,children:(0,Q.jsx)(Je,{className:`size-4`})}),(0,Q.jsxs)(z,{className:`h-8 rounded-md bg-foreground px-3 text-sm text-background hover:bg-foreground/90`,onClick:r,type:`button`,children:[(0,Q.jsx)(Zt,{className:`size-4`}),`Add provider`]})]})]}),o?(0,Q.jsx)(`div`,{className:l(`mb-4`,m?`max-w-none`:`max-w-[42rem]`),children:(0,Q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded border bg-background px-3`,children:[(0,Q.jsx)(Je,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(j,{"aria-label":`Search model providers`,autoFocus:!0,className:`h-7 border-0 bg-transparent px-0 text-sm`,onChange:e=>u(e.target.value),placeholder:`Search providers`,value:c})]})}):null,(0,Q.jsxs)(`div`,{className:l(`overflow-hidden`,m?`max-w-none`:`max-w-[42rem]`),children:[p.length===0?(0,Q.jsxs)(`div`,{className:`border-b px-2 py-6 text-[15px] text-muted-foreground`,children:[`No providers match "`,c.trim(),`".`]}):null,p.map(e=>(0,Q.jsxs)(`div`,{className:l(`flex min-h-11 items-center gap-4 border-b px-2 py-2 transition-colors hover:bg-accent/30`,i===e.id&&`bg-accent/45`),children:[(0,Q.jsxs)(`button`,{className:`flex min-w-0 flex-1 items-center gap-3 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>n(e.id),type:`button`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[17px] font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`p`,{className:`shrink-0 text-[15px] text-muted-foreground`,children:e.models===null?`Models load on demand`:`${e.models} model${e.models===1?``:`s`}`})]}),(0,Q.jsx)(Ye,{"aria-label":`Toggle ${e.name}`,checked:e.enabled,onCheckedChange:()=>t(e.id)}),(0,Q.jsx)(`button`,{"aria-label":`Configure ${e.name}`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>n(e.id),type:`button`,children:(0,Q.jsx)(Yt,{className:`size-4`})})]},e.id))]})]})})}function Wn({provider:e,onBack:t,onUpdate:n,onLoadModels:r,modelsLoading:i=!1,modelsError:a,onOAuthLogin:o,oauthLoginPending:s=!1,variant:c=`page`}){let[u,d]=(0,Z.useState)({}),[f,p]=(0,Z.useState)(()=>Bn(e)),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(void 0),y=e.configFields??[],b=Vn(f.apiKey),x=e.modelList??[],S=m?.providerId===e.id?m.value:``,C=g?.providerId===e.id?g.modelId:null,w=S.trim().toLowerCase(),T=w?x.filter(e=>e.name.toLowerCase().includes(w)||e.id.toLowerCase().includes(w)):x,E=c===`panel`;(0,Z.useEffect)(()=>()=>{v.current!==void 0&&window.clearTimeout(v.current)},[]);let D=(e,t)=>{let r=Hn(e,t),i={...f,[e.path]:r};p(i);let a={configValues:{[e.path]:r}};e.path===`apiKey`&&(a.apiKey=Vn(r)),e.path===`baseUrl`&&(a.baseUrl=Vn(r)),n(a)},O=t=>{typeof navigator>`u`||!navigator.clipboard?.writeText||navigator.clipboard.writeText(t).then(()=>{_({modelId:t,providerId:e.id}),v.current!==void 0&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>_(null),1600)})};return(0,Q.jsx)(ht,{className:`h-full`,children:(0,Q.jsxs)(`div`,{className:l(`py-10 max-[720px]:px-4 max-[720px]:py-5`,E?`px-6`:`px-18 max-[1200px]:px-8`),children:[(0,Q.jsxs)(`div`,{className:`mb-8 flex items-center gap-3`,children:[(0,Q.jsx)(z,{"aria-label":E?`Close provider details`:`Back to providers`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,onClick:t,variant:`ghost`,children:E?(0,Q.jsx)(ke,{className:`h-4 w-4`}):(0,Q.jsx)(qt,{className:`h-4 w-4`})}),(0,Q.jsx)(`h1`,{className:l(`truncate font-semibold leading-[1.15] tracking-normal text-foreground`,E?`text-[24px]`:`text-[32px]`),children:e.name})]}),y.length>0?(0,Q.jsx)(`section`,{className:l(`mb-8`,E?`max-w-none`:`max-w-[86rem]`),children:(0,Q.jsx)(`div`,{className:`flex flex-col`,children:y.map(e=>{let t=f[e.path],n=Vn(t),r=e.type===`password`||e.secret,i=u[e.path]??!1;return(0,Q.jsxs)(`div`,{className:`grid min-h-18 grid-cols-[minmax(12rem,0.55fr)_minmax(16rem,0.45fr)] items-center gap-6 border-b py-4 max-[900px]:grid-cols-1 max-[900px]:gap-3`,children:[(0,Q.jsxs)(`header`,{children:[(0,Q.jsx)(`h3`,{className:`text-[17px] font-semibold text-foreground`,children:e.label}),e.description?(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] leading-relaxed text-muted-foreground`,children:e.description}):null]}),e.type===`boolean`?(0,Q.jsxs)(`div`,{className:`flex items-center justify-end`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.label}),(0,Q.jsx)(Ye,{checked:!!t,onCheckedChange:t=>D(e,t)})]}):e.type===`select`?(0,Q.jsxs)(`select`,{className:`h-9 w-full rounded border border-border bg-background px-3 text-sm text-foreground outline-none focus:ring-1 focus:ring-ring`,onChange:t=>D(e,t.target.value),value:n,children:[(0,Q.jsx)(`option`,{value:``,children:`Not set`}),e.options?.map(e=>(0,Q.jsx)(`option`,{value:String(e.value),children:e.label},String(e.value)))]}):(0,Q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 rounded border border-border bg-background px-3`,children:[e.type===`url`?(0,Q.jsx)(Ze,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):null,(0,Q.jsx)(j,{className:`h-7 flex-1 border-0 bg-transparent px-0 text-sm text-foreground outline-none placeholder:text-muted-foreground`,onBlur:()=>D(e,n),onChange:t=>p(n=>({...n,[e.path]:t.target.value})),placeholder:e.placeholder,spellCheck:!1,type:r&&!i?`password`:e.type===`number`?`number`:e.type===`url`?`url`:`text`,value:n}),r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{"aria-label":i?`Hide secret`:`Show secret`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>d(t=>({...t,[e.path]:!i})),variant:`ghost`,children:i?(0,Q.jsx)($t,{className:`h-4 w-4`}):(0,Q.jsx)(en,{className:`h-4 w-4`})}),(0,Q.jsx)(z,{"aria-label":`Copy ${e.label}`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,onClick:()=>navigator.clipboard.writeText(n),variant:`ghost`,children:(0,Q.jsx)(H,{className:`h-4 w-4`})})]}):null]})]},e.path)})})}):null,!b&&!e.oauthAccessTokenPresent&&o?(0,Q.jsx)(`div`,{className:`mb-8`,children:(0,Q.jsxs)(z,{className:`inline-flex items-center gap-2 w-full`,disabled:s,onClick:o,variant:`default`,children:[s?(0,Q.jsx)(Ge,{className:`h-4 w-4 animate-spin`}):null,(0,Q.jsx)(`span`,{children:`Login via Browser`})]})}):null,e.oauthAccessTokenPresent?(0,Q.jsx)(`p`,{className:`mb-8 text-xs text-muted-foreground`,children:`OAuth is connected. Manual credentials remain available when this provider supports them.`}):null,(0,Q.jsxs)(`section`,{className:l(`overflow-hidden rounded-lg border`,E?`max-w-none`:`max-w-[46rem]`),children:[(0,Q.jsxs)(`div`,{className:`flex h-12 items-center justify-between bg-muted/40 px-4`,children:[(0,Q.jsx)(`h2`,{className:`text-[17px] font-medium text-muted-foreground`,children:`Models`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(Je,{className:`size-4 text-muted-foreground`}),(0,Q.jsx)(z,{"aria-label":`Refresh models`,className:`rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-foreground transition-colors`,disabled:i,onClick:r,variant:`ghost`,children:(0,Q.jsx)(He,{className:l(`size-3`,i&&`animate-spin`)})})]})]}),a?(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-destructive`,children:a})}):x.length>0?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`mx-4 mt-4 flex items-center gap-2 rounded border border-border bg-background px-3 py-2`,children:[(0,Q.jsx)(Je,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Q.jsx)(j,{"aria-label":`Search models`,className:`h-7 flex-1 border-0 text-sm text-foreground placeholder:text-muted-foreground`,onChange:t=>h({providerId:e.id,value:t.target.value}),placeholder:`Search models by name or ID`,spellCheck:!1,value:S})]}),T.length>0?(0,Q.jsx)(`div`,{className:`max-h-125 overflow-y-scroll border-t`,children:T.map(e=>(0,Q.jsxs)(`div`,{className:`group flex min-h-16 items-center gap-3 border-b px-4 py-3 transition-colors hover:bg-accent/30`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 font-mono`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 text-sm text-foreground`,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.supportsAttachments&&(0,Q.jsx)(`div`,{title:`File Support`,children:(0,Q.jsx)(tn,{className:`h-3.5 w-3.5 text-muted-foreground`})}),e.supportsVision&&(0,Q.jsx)(`div`,{title:`Image Support`,children:(0,Q.jsx)(_e,{className:`h-3.5 w-3.5 text-muted-foreground`})})]}),(0,Q.jsxs)(`button`,{"aria-label":`Copy model ID ${e.id}`,className:`mt-1 flex max-w-full items-center gap-1.5 px-1 text-left text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>O(e.id),title:`Copy model ID`,type:`button`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.id}),(0,Q.jsx)(H,{className:`size-3 shrink-0`}),C===e.id?(0,Q.jsx)(`span`,{className:`shrink-0 text-foreground`,children:`Copied`}):null]})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,Q.jsx)(z,{"aria-label":`Favorite ${e.name}`,className:`rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors`,variant:`ghost`,children:(0,Q.jsx)(We,{className:`h-3.5 w-3.5`})})})]},e.id))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No models match "`,S.trim(),`".`]})})]}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-border px-4 py-8 text-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i?`Loading models...`:`No models available. Click refresh to load models.`})})]})]})})}function Gn(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var Kn=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.indeterminate=`data-indeterminate`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({});function qn(e){return Z.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[Kn.checked]:``}:{[Kn.unchecked]:``}},...A}),[e.indeterminate])}var Jn=Z.createContext(void 0);function Yn(){let e=Z.useContext(Jn);if(e===void 0)throw Error(s(14));return e}var Xn=`data-parent`,Zn=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":s,disabled:c=!1,form:l,id:f,indeterminate:p=!1,inputRef:m,name:h,onCheckedChange:v,parent:b=!1,readOnly:S=!1,render:C,required:w=!1,uncheckedValue:E,value:D,nativeButton:O=!1,style:k,...A}=e,{clearErrors:j}=I(),{disabled:P,name:ee,setDirty:L,setFilled:ae,setFocused:oe,setTouched:se,state:ce,validationMode:le,validityData:z,validation:fe}=te(),pe=ln(),{labelId:me,controlId:he,registerControlId:B,getDescriptionProps:ge}=N(),V=dn(),_e=V?.parent,ve=_e&&V.allValues,H=P||pe.disabled||V?.disabled||c,ye=ee??h,U=D??ye,be=g(),xe=g(),Se=he;ve?Se=b?xe:`${_e.id}-${U}`:f&&(Se=f);let Ce={};ve&&(b?Ce=V.parent.getParentProps():U&&(Ce=V.parent.getChildProps(U)));let{checked:we=n,indeterminate:Te=p,onCheckedChange:Ee,...De}=Ce,Oe=V?.value,ke=V?.setValue,Ae=V?.defaultValue,je=Z.useRef(null),Me=d(()=>Symbol(`checkbox-control`)),Ne=Z.useRef(!1),{getButtonProps:Pe,buttonRef:Fe}=x({disabled:H,native:O}),W=V?.validation??fe,[Ie,Le]=R({controlled:U&&Oe&&!b?Oe.includes(U):we,default:U&&Ae&&!b?Ae.includes(U):i,name:`Checkbox`,state:`checked`}),Re=ve?!!we:Ie,ze=ve&&Te||p;T(()=>{B!==ie&&(Ne.current=!0,B(Me.current,Se))},[Se,B,Me]),Z.useEffect(()=>{let e=Me.current;return()=>{!Ne.current||B===ie||(Ne.current=!1,B(e,void 0))}},[B,Me]),re(je,be,Ie,void 0,!V&&!H,h);let Be=Z.useRef(null),Ve=y(m,Be,W.inputRef,W.registerInput),He=qe(s,me,Be,!O,Se??void 0);T(()=>{Be.current&&(Be.current.indeterminate=ze,Ie&&ae(!0))},[Ie,ze,ae]),ue(Ie,()=>{V||(j(ye),ae(Ie),L(Ie!==z.initialValue),W.change(Ie))});let Ue=a({checked:Ie,disabled:H,form:l,name:b?void 0:ye,id:O?void 0:Se??void 0,required:w,ref:Ve,style:ye?u:_,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(S){e.preventDefault();return}let t=e.currentTarget.checked,n=o(F,e.nativeEvent);if(v?.(t,n),!n.isCanceled&&(Ee?.(t,n),!n.isCanceled&&(Le(t),U&&Oe&&ke&&!b&&!ve))){let e=t?[...Oe,U]:Oe.filter(e=>e!==U);ke(e,n)}},onFocus(){je.current?.focus()}},D===void 0?M:{value:(V?Ie&&D:D)||``},ge,e=>W.getValidationProps(H,e));Z.useEffect(()=>{if(!_e||!U)return;let e=_e.disabledStatesRef.current;return e.set(U,H),()=>{e.delete(U)}},[_e,H,U]);let We=Z.useMemo(()=>({...ce,checked:Re,disabled:H,readOnly:S,required:w,indeterminate:ze}),[ce,Re,H,S,w,ze]),G=qn(We),Ge=ne(`span`,e,{state:We,ref:[Fe,je,t,V?.registerControlRef],props:[{id:O?Se??void 0:be,role:`checkbox`,"aria-checked":ze?`mixed`:Re,"aria-readonly":S||void 0,"aria-required":w||void 0,"aria-labelledby":He,[Xn]:b?``:void 0,onFocus(){H||oe(!0)},onBlur(){let e=Be.current;e&&(se(!0),oe(!1),le===`onBlur`&&W.commit(V?Oe:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Be.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),de(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||Gn(t)?.click()})},onClick(e){if(S||H)return;e.preventDefault();let t=Be.current;t&&t.dispatchEvent(new(de(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},A,De,Pe,ge,e=>W.getValidationProps(H,e)],stateAttributesMapping:G});return(0,Q.jsxs)(Jn.Provider,{value:We,children:[Ge,!Ie&&!V&&ye&&!b&&E!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:ye,value:E,disabled:H}),(0,Q.jsx)(`input`,{...Ue,suppressHydrationWarning:!0})]})}),Qn=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Yn(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=xt(c),f=Z.useRef(null),p={...s,transitionStatus:u};gt({open:c,ref:f,onComplete(){c||d(!1)}});let m={...qn(s),...vt,...A},h=a||l,g=ne(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function $n({className:e,...t}){return(0,Q.jsx)(Zn,{"data-slot":`checkbox`,className:l(`peer relative flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,e),...t,children:(0,Q.jsx)(Qn,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,Q.jsx)(et,{})})})}function er(e,t,n,r,i,a,o,s,c,l=2){let u=Vt(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return st(n.current,u)?void 0:u}var tr=Z.createContext(void 0),nr=Z.createContext(void 0),rr=Z.createContext(void 0),ir=Z.createContext(!1),ar=Z.createContext(``);function or(){let e=Z.useContext(tr);if(!e)throw Error(s(22));return e}function sr(){let e=Z.useContext(nr);if(!e)throw Error(s(23));return e}function cr(){let e=Z.useContext(rr);if(!e)throw Error(s(24));return e}function lr(){return Z.useContext(ar)}function ur(){return Z.useContext(ir)}var $={id:J(e=>e.id),labelId:J(e=>e.labelId),items:J(e=>e.items),selectedValue:J(e=>e.selectedValue),hasSelectionChips:J(e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0}),hasSelectedValue:J(e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0}),hasNullItemLabel:J((e,t)=>t?ye(e.items):!1),open:J(e=>e.open),mounted:J(e=>e.mounted),forceMounted:J(e=>e.forceMounted),inline:J(e=>e.inline),activeIndex:J(e=>e.activeIndex),selectedIndex:J(e=>e.selectedIndex),isActive:J((e,t)=>e.activeIndex===t),isSelected:J((e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>he(t,e,n)):he(t,r,n)}),transitionStatus:J(e=>e.transitionStatus),popupProps:J(e=>e.popupProps),inputProps:J(e=>e.inputProps),triggerProps:J(e=>e.triggerProps),itemProps:J(e=>e.itemProps),positionerElement:J(e=>e.positionerElement),listElement:J(e=>e.listElement),popupId:J(e=>e.popupId),triggerElement:J(e=>e.triggerElement),inputElement:J(e=>e.inputElement),inputGroupElement:J(e=>e.inputGroupElement),popupSide:J(e=>e.popupSide),openMethod:J(e=>e.openMethod),inputInsidePopup:J(e=>e.inputInsidePopup),inputOwnsFormValue:J(e=>e.inputOwnsFormValue),selectionMode:J(e=>e.selectionMode),name:J(e=>e.name),form:J(e=>e.form),disabled:J(e=>e.disabled),readOnly:J(e=>e.readOnly),required:J(e=>e.required),grid:J(e=>e.grid),virtualized:J(e=>e.virtualized),itemToStringLabel:J(e=>e.itemToStringLabel),isItemEqualToValue:J(e=>e.isItemEqualToValue),modal:J(e=>e.modal),autoHighlight:J(e=>e.autoHighlight),submitOnItemClick:J(e=>e.submitOnItemClick)};function dr(e){return e==null?void 0:`${e}-popup`}function fr(e,t){return(n,r)=>{if(n==null)return!1;let i=Re(n,t);return e.contains(i,r)}}function pr(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;let a=Re(r,t),o=n==null?``:Re(n,t);return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(a,i)}}function mr(e){return Array.isArray(e)?e.map(e=>mr(e)).join(`,`):e==null?``:String(e)}var hr=new Map;function gr(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${mr(e.locale)}|${JSON.stringify(t)}`,r=hr.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=Re(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Re(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Re(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return hr.set(n,a),a}var _r=gr,vr=Symbol(`none`),yr={value:vr,index:-1};function br(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:l,inputValue:f,open:p,defaultOpen:h=!1,selectionMode:g=`none`,onItemHighlighted:b,name:x,form:S,disabled:C=!1,readOnly:E=!1,required:O=!1,inputRef:A,grid:j=!1,items:N,filteredItems:L,filter:ne,openOnInputClick:ae=!0,autoHighlight:oe=!1,keepHighlight:le=!1,highlightItemOnHover:de=!0,loopFocus:z=!0,itemToStringLabel:B,itemToStringValue:ge,isItemEqualToValue:V=me,virtualized:_e=!1,inline:H=!1,fillInputOnItemPress:ye=!0,modal:be=!1,limit:xe=-1,autoComplete:Se=`list`,formAutoComplete:Ce,locale:we,submitOnItemClick:Te=!1}=e,{clearErrors:Ee}=I(),{setDirty:De,validityData:Oe,setFilled:ke,name:je,disabled:Me,setTouched:Ne,setFocused:Pe,validationMode:Fe,validation:W}=te(),Ie=c(),Le=ce({id:t}),Be=_r({locale:we}),[Ve,He]=Z.useState(!1),[Ue,We]=Z.useState(null),G=Z.useRef([]),Ge=Z.useRef([]),Ke=Z.useRef(null),qe=Z.useRef(null),Je=Z.useRef(null),Ye=Z.useRef(null),Xe=Z.useRef(null),Ze=Z.useRef(!0),Qe=Z.useRef(!1),$e=Z.useRef(null),et=Z.useRef(null),tt=Z.useRef(null),nt=Z.useRef(yr),rt=Z.useRef(null),it=Z.useRef([]),at=Z.useRef([]),ot=Me||C,st=je??x,ct=g===`multiple`,lt=g===`single`,ut=f!==void 0||l!==void 0,dt=N!==void 0,ft=L!==void 0,mt;mt=oe===`always`?`always`:oe?`input-change`:!1;let[K,ht]=R({controlled:i,default:ct?r??se:r,name:`Combobox`,state:`selectedValue`}),_t=Z.useMemo(()=>ne===null?()=>!0:ne===void 0?lt&&!Ve?pr(Be,B,K):fr(Be,B):ne,[ne,lt,K,Ve,Be,B]),vt=d(()=>ut?l??``:lt?Re(K,B):``).current,[yt,bt]=R({controlled:f,default:vt,name:`Combobox`,state:`inputValue`}),[q,Ct]=R({controlled:p,default:h,name:`Combobox`,state:`open`}),J=pe(N),wt=Ue??(yt===``?``:String(yt).trim()),Dt=lt?Re(K,B):``,Ot=lt&&!Ve&&wt!==``&&Dt!==``&&Dt.length===wt.length&&Be.contains(Dt,wt),kt=Ot?``:wt,At=dt&&ft&&Ot,Nt=Z.useMemo(()=>N?J?N.flatMap(e=>e.items):N:se,[N,J]),Pt=Z.useMemo(()=>{if(L&&!At)return L;if(!N)return se;if(J){let e=N,t=[],n=0;for(let r of e){if(xe>-1&&n>=xe)break;let e=kt===``?r.items:r.items.filter(e=>_t(e,kt,B));if(e.length===0)continue;let i=xe>-1?xe-n:1/0,a=e.slice(0,i);if(a.length>0){let e={...r,items:a};t.push(e),n+=a.length}}return t}if(kt===``)return xe>-1?Nt.slice(0,xe):Nt;let e=[];for(let t of Nt){if(xe>-1&&e.length>=xe)break;_t(t,kt,B)&&e.push(t)}return e},[L,At,N,J,kt,xe,_t,B,Nt]),Ft=Z.useMemo(()=>J?Pt.flatMap(e=>e.items):Pt,[Pt,J]),X=d(()=>new Mt({id:Le,labelId:void 0,selectedValue:K,open:q,filter:_t,query:wt,items:N,selectionMode:g,listRef:G,labelsRef:Ge,popupRef:Ke,emptyRef:Xe,inputRef:qe,startDismissRef:Je,endDismissRef:Ye,keyboardActiveRef:Ze,chipsContainerRef:$e,clearRef:et,valuesRef:it,allValuesRef:at,selectionEventRef:tt,name:st,form:S,disabled:ot,readOnly:E,required:O,grid:j,isGrouped:J,virtualized:_e,openOnInputClick:ae,itemToStringLabel:B,isItemEqualToValue:V,modal:be,autoHighlight:mt,submitOnItemClick:Te,hasInputValue:ut,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:H,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},itemProps:M,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:g===`none`,onOpenChangeComplete:n||ie,setOpen:ie,setInputValue:ie,setSelectedValue:ie,setIndices:ie,onItemHighlighted:ie,handleSelection:ie,forceMount:ie,requestSubmit:ie})).current,It=g===`none`?yt:K,Lt=Z.useMemo(()=>g===`none`?It:Array.isArray(K)?K.map(e=>U(e,ge)):U(K,ge),[It,ge,g,K]),Rt=m(b),Vt=m(n),Ht=Y(X,$.activeIndex),Ut=Y(X,$.selectedIndex),Wt=Y(X,$.positionerElement),Kt=Y(X,$.listElement),qt=Y(X,$.triggerElement),Jt=Y(X,$.inputElement),Yt=Y(X,$.inputGroupElement),Xt=Y(X,$.inline),Zt=Y(X,$.inputInsidePopup),Qt=Y(X,$.inputOwnsFormValue),$t=Et(qt),{mounted:en,setMounted:tn,transitionStatus:nn}=xt(q),{openMethod:rn,triggerProps:an}=Bt(q),on=m(()=>Lt);re(Zt?$t:qe,Le,It,on,!ot,x);let sn=m(()=>{N?Ge.current=Ft.map(e=>Re(e,B)):X.set(`forceMounted`,!0)}),cn=Z.useRef(K);T(()=>{K!==cn.current&&sn()},[sn,K]);let ln=m(e=>{X.update(e);let t=e.type||`none`;if(e.activeIndex!==void 0)if(e.activeIndex===null)nt.current!==yr&&(nt.current=yr,Rt(void 0,w(t,void 0,{index:-1})));else{let n=it.current[e.activeIndex];nt.current={value:n,index:e.activeIndex},Rt(n,w(t,void 0,{index:e.activeIndex}))}}),un=m((t,n)=>{if(Qe.current=n.reason===D,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&He(!0),rt.current={hasQuery:e},e&&mt&&X.state.activeIndex==null&&X.set(`activeIndex`,0)}}bt(t)}}),dn=m((t,n)=>{if(q!==t&&(n.reason===`escape-key`&&dt&&Ft.length===0&&!X.state.emptyRef.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&ct&&Zt&&!Xt&&Ue!==null&&(He(!1),We(null),yt!==``&&un(``,o(D,n.event))),!t&&Ve&&(lt?(Xt||We(wt),wt===``&&He(!1)):ct&&(Xt||We(wt),Zt&&ln({activeIndex:null}),(!Zt||Xt)&&un(``,o(D,n.event)))),Ct(t),!t&&Zt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(Ne(!0),Pe(!1),Fe===`onBlur`)))){let e=g===`none`?yt:K;W.commit(e)}}),fn=m((e,t)=>{s?.(e,t),!t.isCanceled&&(ht(e),(g===`none`&&Ke.current&&ye||lt&&!X.state.inputInsidePopup)&&un(Re(e,B),o(t.reason,t.event)),lt&&e!=null&&t.reason!==`input-change`&&Ve&&!Xt&&We(wt))}),pn=m((e,t)=>{let n=t;if(n===void 0){if(Ht===null)return;n=it.current[Ht]}let r=ee(e),i=tt.current??e;tt.current=null;let a=o(v,i),s=r?.closest(`a`)?.getAttribute(`href`);if(s){s.startsWith(`#`)&&dn(!1,a);return}if(ct){let e=Array.isArray(K)?K:[],t=fe(e,n,X.state.isItemEqualToValue)?Ae(e,n,X.state.isItemEqualToValue):[...e,n];if(fn(t,a),a.isCanceled||!(qe.current&&qe.current.value.trim()!==``))return;X.state.inputInsidePopup?un(``,o(D,a.event)):dn(!1,a)}else{if(fn(n,a),a.isCanceled)return;dn(!1,a)}}),mn=m(()=>{if(!X.state.submitOnItemClick)return;let e=W.inputRef.current?.form??X.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),hn=m(()=>{if(tn(!1),Vt?.(!1),He(!1),We(null),ln(g===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),ct&&qe.current&&qe.current.value!==``&&!Qe.current&&un(``,o(D)),lt)if(X.state.inputInsidePopup)qe.current&&qe.current.value!==``&&un(``,o(D));else{let e=Re(K,B);qe.current&&qe.current.value!==e&&un(e,o(e===``?D:F))}}),gn=Z.useMemo(()=>Xt&&Wt?{current:Wt.closest(`[role="dialog"]`)}:Ke,[Xt,Wt]);gt({enabled:!e.actionsRef,open:q,ref:gn,onComplete(){q||hn()}}),Z.useImperativeHandle(e.actionsRef,()=>({unmount:hn}),[hn]),T(function(){if(q||g===`none`)return;let e=N?Nt:at.current;if(ct){let t=Array.isArray(K)?K:[],n=t[t.length-1],r=ve(e,n,V);ln({selectedIndex:r===-1?null:r})}else{let t=ve(e,K,V);ln({selectedIndex:t===-1?null:t})}},[q,K,N,g,Nt,ct,V,ln]),T(()=>{N&&(it.current=Ft,G.current.length=Ft.length)},[N,Ft]),T(()=>{let e=rt.current;if(e&&(e.hasQuery?mt&&X.set(`activeIndex`,0):mt===`always`&&X.set(`activeIndex`,0),rt.current=null),!q&&!Xt)return;let t=dt||ft?Ft:it.current,n=X.state.activeIndex;if(n==null){if(mt===`always`&&t.length>0){X.set(`activeIndex`,0);return}nt.current!==yr&&(nt.current=yr,X.state.onItemHighlighted(void 0,w(F,void 0,{index:-1})));return}if(n>=t.length){nt.current!==yr&&(nt.current=yr,X.state.onItemHighlighted(void 0,w(F,void 0,{index:-1}))),X.set(`activeIndex`,null);return}let r=t[n],i=nt.current.value,a=i!==vr&&he(r,i,X.state.isItemEqualToValue);(nt.current.index!==n||!a)&&(nt.current={value:r,index:n},X.state.onItemHighlighted(r,w(F,void 0,{index:n})))},[Ht,mt,ft,dt,Ft,Xt,q,X]),T(()=>{if(g===`none`){ke(String(yt)!==``);return}ke(ct?Array.isArray(K)&&K.length>0:K!=null)},[ke,g,yt,K,ct]),Z.useEffect(()=>{dt&&mt&&Ft.length===0&&ln({activeIndex:null})},[dt,mt,Ft.length,ln]);function _n(e){let t=Oe.initialValue;return Array.isArray(e)&&Array.isArray(t)?!ze(e,t,(e,t)=>he(e,t,V)):e!==t}ue(wt,()=>{!q||wt===``||wt===String(vt)||He(!0)}),ue(K,()=>{if(g!==`none`&&(Ee(st),De(_n(K)),W.change(K),lt&&!ut&&!Zt)){let e=Re(K,B);yt!==e&&un(e,o(F))}}),ue(yt,()=>{g===`none`&&(Ee(st),De(yt!==Oe.initialValue),W.change(yt))}),ue(N,()=>{if(!lt||ut||Zt||Ve)return;let e=Re(K,B);yt!==e&&un(e,o(F))});let vn=pt({open:Xt?!0:q,onOpenChange:dn,elements:{reference:Zt?qt:Jt,floating:Wt}}),yn,bn;Xt||(yn=j?`grid`:`listbox`,bn=q?`true`:`false`);let xn=Z.useMemo(()=>{let e=Jt?.tagName===`INPUT`,t=Jt==null||e,n=t||q,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=bn,r[`aria-haspopup`]=yn,r[`aria-controls`]=q?Kt?.id:void 0,r[`aria-autocomplete`]=Se),{reference:r,floating:{role:`presentation`}}},[Jt,q,bn,yn,Kt?.id,Se]),Sn=Gt(vn,{enabled:!E&&!ot&&ae,event:`mousedown-only`,toggle:!1,touchOpenDelay:Zt?0:100,reason:k}),Cn=zt(vn,{enabled:!E&&!ot&&!Xt,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:Xt?!0:void 0,outsidePress(e){let t=ee(e);return!P(qt,t)&&!P(et.current,t)&&!P($e.current,t)&&!P(Yt,t)}}),wn=Tt(vn,{enabled:!E&&!ot,id:Le,listRef:G,activeIndex:Ht,selectedIndex:Ut,virtual:!0,loopFocus:z,allowEscape:z&&!mt,focusItemOnOpen:Ve||g===`none`&&!mt?!1:`auto`,focusItemOnHover:de,resetOnPointerLeave:!le,orientation:j?`horizontal`:void 0,rtl:Ie===`rtl`,disabledIndices:se,grid:j?er:void 0,onNavigate(e,t){!t&&!q||nn===`ending`||ln(t?{activeIndex:e,type:Ze.current?`keyboard`:`pointer`}:{activeIndex:e})}}),Tn=Z.useMemo(()=>a(wn.reference,{onKeyDown(e){j&&X.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Cn.reference,Sn.reference,xn.reference),[wn.reference,Cn.reference,Sn.reference,xn.reference,j,X]),En=Z.useMemo(()=>a(jt,wn.floating,Cn.floating,xn.floating),[wn.floating,Cn.floating,xn.floating]),Dn=Z.useMemo(()=>{let e=wn.item;return e?{...e,onFocus:void 0}:M},[wn.item]);St(()=>{X.update({inline:H,popupProps:En,inputProps:Tn,triggerProps:an,itemProps:Dn,setOpen:dn,setInputValue:un,setSelectedValue:fn,setIndices:ln,onItemHighlighted:Rt,handleSelection:pn,forceMount:sn,requestSubmit:mn})}),T(()=>{X.update({id:Le,selectedValue:K,open:q,mounted:en,transitionStatus:nn,items:N,inline:H,popupProps:En,inputProps:Tn,triggerProps:an,openMethod:rn,itemProps:Dn,selectionMode:g,name:st,form:S,disabled:ot,readOnly:E,required:O,grid:j,isGrouped:J,virtualized:_e,onOpenChangeComplete:Vt,openOnInputClick:ae,itemToStringLabel:B,modal:be,autoHighlight:mt,isItemEqualToValue:V,submitOnItemClick:Te,hasInputValue:ut,requestSubmit:mn,inputOwnsFormValue:g===`none`&&(H||!X.state.inputInsidePopup)})},[X,Le,K,q,en,nn,N,En,Tn,Dn,rn,an,g,st,ot,E,O,W,j,J,_e,Vt,ae,B,be,V,Te,ut,H,mn,mt,S]);let On=y(A,W.inputRef),kn=Z.useMemo(()=>({query:wt,hasItems:dt,filteredItems:Pt,flatFilteredItems:Ft}),[wt,dt,Pt,Ft]),An=Z.useMemo(()=>Array.isArray(It)?``:U(It,ge),[It,ge]),jn=ct&&Array.isArray(K)&&K.length>0,Mn=ct||g===`none`&&Qt?void 0:st,Nn=Z.useMemo(()=>!ct||!Array.isArray(K)||!st?null:K.map(e=>{let t=U(e,ge);return(0,Q.jsx)(`input`,{type:`hidden`,form:S,name:st,value:t,disabled:ot},t)}),[ct,K,S,st,ge,ot]),Pn=(0,Q.jsxs)(Z.Fragment,{children:[e.children,(0,Q.jsx)(`input`,{...W.getValidationProps(ot,{onFocus(){if(Zt){qt?.focus();return}(qe.current||qt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||ot||E)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=o(F,e.nativeEvent),i=()=>it.current.findIndex(e=>U(e,ge).toLowerCase()===n||Re(e,B).toLowerCase()===n);function a(){if(ct)return;if(g===`none`){un(t,r);return}let e=i();e===-1&&(e=it.current.findIndex((e,t)=>{let r=Ge.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:it.current[e];a!=null&&fn?.(a,r)}lt&&(sn(),N&&i()===-1&&X.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:Le&&Mn==null?`${Le}-hidden-input`:void 0,form:S,name:Mn,autoComplete:Ce,disabled:ot,required:O&&!jn,readOnly:E,value:An,ref:On,style:Mn?u:_,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Nn]});return(0,Q.jsx)(tr.Provider,{value:X,children:(0,Q.jsx)(nr.Provider,{value:vn,children:(0,Q.jsx)(ir.Provider,{value:dt,children:(0,Q.jsx)(rr.Provider,{value:kn,children:(0,Q.jsx)(ar.Provider,{value:yt,children:Pn})})})})})}var xr={...It,...A,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Sr=2,Cr=Z.forwardRef(function(e,t){let{render:n,className:r,nativeButton:a=!0,disabled:s=!1,id:c,style:l,...u}=e,{state:d,disabled:p,setTouched:h,setFocused:g,validationMode:_,validation:v}=te(),{labelId:y}=N(),S=or(),{filteredItems:C}=cr(),w=Y(S,$.selectionMode),T=Y(S,$.disabled),E=Y(S,$.readOnly),D=Y(S,$.required),O=Y(S,$.mounted),k=Y(S,$.popupSide),A=Y(S,$.positionerElement),j=Y(S,$.listElement),M=Y(S,$.popupId),F=Y(S,$.triggerProps),I=Y(S,$.triggerElement),L=Y(S,$.inputInsidePopup),re=Y(S,$.id),ie=Y(S,$.labelId),ae=Y(S,$.open),oe=Y(S,$.selectedValue),se=Y(S,$.activeIndex),R=Y(S,$.selectedIndex),le=Y(S,$.hasSelectedValue),ue=sr(),de=lr(),z=b(),fe=p||T||s,pe=C.length===0,me=O&&A?k:null;ce({id:L?c:void 0});let he=L?c??re:c,B=Se(y,ie),ge;ae&&L?ge=M??dr(re):ae&&(ge=j?.id);let V=Z.useRef(``);function _e(e){V.current=e.pointerType}let ve=ue.useState(`domReferenceElement`);Z.useEffect(()=>{L&&I&&I!==ve&&ue.set(`domReferenceElement`,I)},[I,ve,ue,L]);let{reference:H}=Pt(ue,{enabled:!ae&&!E&&!T&&w===`single`,listRef:S.state.labelsRef,activeIndex:se,selectedIndex:R,onMatch(e){let t=S.state.valuesRef.current[e];t!==void 0&&S.state.setSelectedValue(t,o(`none`))}}),{reference:ye}=Gt(ue,{enabled:!E&&!T,event:`mousedown`}),{buttonRef:U,getButtonProps:be}=x({native:a,disabled:fe}),xe={...d,open:ae,disabled:fe,popupSide:me,listEmpty:pe,placeholder:w===`none`?!1:!le};return ne(`button`,e,{ref:[t,U,m(e=>{S.set(`triggerElement`,e)})],state:xe,props:[F,ye,H,{id:he,tabIndex:L?0:-1,role:L?`combobox`:void 0,"aria-expanded":ae?`true`:`false`,"aria-haspopup":L?`dialog`:`listbox`,"aria-controls":ge,"aria-required":L&&D||void 0,"aria-labelledby":B,onPointerDown:_e,onPointerEnter:_e,onFocus(){g(!0),!(fe||E)&&z.start(0,S.state.forceMount)},onBlur(e){if(!P(A,e.relatedTarget)&&(h(!0),g(!1),_===`onBlur`)){let e=w===`none`?de:oe;v.commit(e)}},onMouseDown(e){if(fe||E||(L||ue.set(`domReferenceElement`,e.currentTarget),S.state.forceMount(),V.current!==`touch`&&(S.state.inputRef.current?.focus(),L||e.preventDefault()),ae))return;let t=f(e.currentTarget);function n(e){if(!I)return;let t=ee(e),n=S.state.positionerElement,r=S.state.listElement;if(P(I,t)||P(n,t)||P(r,t)||t===I)return;let i=Lt(I),a=e.clientX>=i.left-Sr&&e.clientX<=i.right+Sr,s=e.clientY>=i.top-Sr&&e.clientY<=i.bottom+Sr;a&&s||S.state.setOpen(!1,o(`cancel-open`,e))}L&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){fe||E||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(tt(e),S.state.setOpen(!0,o(i,e.nativeEvent)),S.state.inputRef.current?.focus())}},v?v.getValidationProps(fe,u):u,be],stateAttributesMapping:xr})}),wr=Z.createContext(void 0);function Tr(){return Z.useContext(wr)}var Er=Z.createContext(void 0);function Dr(e){let t=Z.useContext(Er);if(t===void 0&&!e)throw Error(s(21));return t}var Or=Z.forwardRef(function(e,t){let n=or(),{buttonRef:r,getButtonProps:i}=x({native:!1}),a=y(t,r);function s(e){n.state.setOpen(!1,o(E,e.nativeEvent,e.currentTarget))}return(0,Q.jsx)(`span`,{ref:a,...i({onClick:s}),"aria-label":`Dismiss`,tabIndex:void 0,style:u})}),kr=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:s,...l}=e,{state:u,disabled:d,setTouched:f,setFocused:_,validationMode:v,validation:y}=te(),{labelId:b}=N(),x=Tr(),S=!!Dr(!0),C=or(),{filteredItems:w}=cr(),T=lr(),E=c(),k=Y(C,$.required),A=Y(C,$.disabled),j=Y(C,$.readOnly),M=Y(C,$.name),P=Y(C,$.form),I=Y(C,$.selectionMode),ee=Y(C,$.autoHighlight),re=Y(C,$.inputProps),ie=Y(C,$.triggerProps),se=Y(C,$.open),ce=Y(C,$.mounted),R=Y(C,$.selectedValue),le=Y(C,$.popupSide),ue=Y(C,$.positionerElement),de=Y(C,$.id),z=Y(C,$.inline),fe=Y(C,$.modal),pe=!!ee,me=ce&&ue?le:null,he=d||A||i,B=w.length===0,ge=S||z,V=!ge||fe,_e=g(a??(ge?void 0:de)),ve=Se(b,void 0),H=S?L:u,[ye,U]=Z.useState(null),be=Z.useRef(!1),xe=Z.useRef(null),Ce=Z.useRef(!1),we=I===`none`&&!S,Te=m(e=>{let t=S||C.state.inline;t&&!C.state.hasInputValue&&C.state.setInputValue(``,o(F)),C.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:we})}),Ee=S||!y?l:y.getValidationProps(he,l),De={...H,open:se,disabled:he,readOnly:j,popupSide:me,listEmpty:B};function Oe(e){if(!x)return;let t,{highlightedChipIndex:n}=x,r=x.chipsRef.current.length,i=E===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(n!==void 0){if(e.key===a)e.preventDefault(),t=n>0?n-1:void 0;else if(e.key===o)e.preventDefault(),t=n<r-1?n+1:void 0;else if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let r=n>=R.length-1?R.length-2:n;t=r>=0?r:void 0,C.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`})}return t}return e.key===a&&(e.currentTarget.selectionStart??0)===0&&R.length>0?(e.preventDefault(),t=r>0?r-1:void 0):e.key===`Backspace`&&e.currentTarget.value===``&&R.length>0&&(C.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`}),e.preventDefault()),t}let ke=ne(`input`,e,{state:De,ref:[t,C.state.inputRef,Te],props:[re,ie,{type:`text`,value:e.value??ye??T,"aria-readonly":j||void 0,"aria-required":k||void 0,"aria-labelledby":ve,disabled:he,readOnly:j,required:I===`none`?k:void 0,form:P,...we&&M&&{name:M},id:_e,onFocus(){if(_(!0),!z||!Ce.current)return;Ce.current=!1;let e=xe.current;e==null||!Object.hasOwn(C.state.valuesRef.current,e)||C.state.setIndices({activeIndex:e})},onBlur(){f(!0),_(!1);let e=C.state.activeIndex;if(z&&e!==null&&ee!==`always`&&(xe.current=e,Ce.current=!0,C.state.setIndices({activeIndex:null})),v===`onBlur`){let e=I===`none`?T:R;y.commit(e)}},onCompositionStart(e){nt||(be.current=!0,U(e.currentTarget.value))},onCompositionEnd(e){be.current=!1;let t=e.currentTarget.value;U(null),C.state.setInputValue(t,o(O,e.nativeEvent))},onChange(e){let t=e.nativeEvent.inputType,n=!t||t===`insertReplacementText`,r=be.current||!n;if(be.current){let t=e.currentTarget.value;U(t),t===``&&!C.state.openOnInputClick&&!C.state.inputInsidePopup&&C.state.setOpen(!1,o(D,e.nativeEvent));let n=t.trim(),i=pe&&n!==``;!j&&!he&&n&&r&&(C.state.setOpen(!0,o(O,e.nativeEvent)),pe||C.state.setIndices({activeIndex:null,selectedIndex:null,type:C.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&C.state.activeIndex!==null&&!i&&C.state.setIndices({activeIndex:null,selectedIndex:null,type:C.state.keyboardActiveRef.current?`keyboard`:`pointer`});return}let i=o(O,e.nativeEvent);if(C.state.setInputValue(e.currentTarget.value,i),i.isCanceled)return;let a=e.currentTarget.value===``,s=o(D,e.nativeEvent);a&&!C.state.inputInsidePopup&&(I===`single`&&C.state.setSelectedValue(null,s),C.state.openOnInputClick||C.state.setOpen(!1,s));let c=e.currentTarget.value.trim();!j&&!he&&c&&r&&(C.state.setOpen(!0,o(O,e.nativeEvent)),pe||C.state.setIndices({activeIndex:null,selectedIndex:null,type:C.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&C.state.activeIndex!==null&&!pe&&C.state.setIndices({activeIndex:null,selectedIndex:null,type:C.state.keyboardActiveRef.current?`keyboard`:`pointer`})},onKeyDown(e){if(he||j||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;C.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=E===`rtl`;if(e.key===`Home`){tt(e);let n=h&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){tt(e);let i=h&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ce&&e.key===`Escape`){let t=I===`multiple`&&Array.isArray(R)?R.length===0:R===null,n=o(p,e.nativeEvent),r=I===`multiple`?[]:null;C.state.setInputValue(``,n),C.state.setSelectedValue(r,n),!t&&!C.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(x&&e.key===`Backspace`&&t.value===``&&x.highlightedChipIndex===void 0&&Array.isArray(R)&&R.length>0){let t=x.chipsRef.current.length,n=t>0?t-1:R.length-1,r=R.filter((e,t)=>t!==n);C.state.setIndices({activeIndex:null,selectedIndex:null,type:C.state.keyboardActiveRef.current?`keyboard`:`pointer`}),C.state.setSelectedValue(r,o(F,e.nativeEvent));return}let i=x?.highlightedChipIndex!==void 0,a=Oe(e);if(x?.setHighlightedChipIndex(a),a===void 0?i&&C.state.inputRef.current?.focus():x?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&se){let t=C.state.activeIndex,n=e.nativeEvent;if(t===null){if(z)return;C.state.setOpen(!1,o(F,n));return}tt(e);let r=C.state.listRef.current[t];r&&(C.state.selectionEventRef.current=n,r.click(),C.state.selectionEventRef.current=null)}},onPointerMove(){C.state.keyboardActiveRef.current=!1},onPointerDown(){C.state.keyboardActiveRef.current=!1}},Ee],stateAttributesMapping:xr}),Ae=S?(0,Q.jsx)(ae.Provider,{value:oe,children:ke}):ke;return(0,Q.jsxs)(Z.Fragment,{children:[se&&V&&(0,Q.jsx)(Or,{ref:C.state.startDismissRef}),Ae]})}),Ar={...vt,...kt},jr=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:s=!1,style:c,...l}=e,{disabled:u}=te(),d=or(),f=Y(d,$.selectionMode),p=Y(d,$.disabled),m=Y(d,$.readOnly),h=Y(d,$.open),g=Y(d,$.selectedValue),_=Y(d,$.hasSelectionChips),v=lr(),y=!1;y=f===`none`?v!==``:f===`single`?g!=null:_;let b=u||p||i,{buttonRef:S,getButtonProps:w}=x({native:a,disabled:b}),{mounted:T,transitionStatus:E,setMounted:D}=xt(y),O={disabled:b,visible:y,open:h,transitionStatus:E};gt({open:y,ref:d.state.clearRef,onComplete(){y||D(!1)}});let k=ne(`button`,e,{state:O,ref:[t,S,d.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||m)return;let t=d.state.keyboardActiveRef;d.state.setInputValue(``,o(C,e.nativeEvent)),f===`none`?d.state.setIndices({activeIndex:null,type:t.current?`keyboard`:`pointer`}):(d.state.setSelectedValue(Array.isArray(g)?[]:null,o(C,e.nativeEvent)),d.state.setIndices({activeIndex:null,selectedIndex:null,type:t.current?`keyboard`:`pointer`})),d.state.inputRef.current?.focus()}},l,w],stateAttributesMapping:Ar});return s||T?k:null}),Mr=Z.createContext(null);function Nr(){return Z.useContext(Mr)}function Pr(e){let{children:t}=e,{filteredItems:n}=cr(),r=Nr(),i=r?r.items:n;return i?(0,Q.jsx)(Z.Fragment,{children:i.map(t)}):null}var Fr=Z.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=or(),l=sr(),u=!!Dr(!0),{filteredItems:d,hasItems:f}=cr(),p=Y(c,$.selectionMode),h=Y(c,$.grid),g=Y(c,$.popupProps),_=Y(c,$.virtualized),v=Y(c,$.forceMounted),y=p===`multiple`,b=d.length===0,x=m(e=>{c.set(`positionerElement`,e)}),S=m(e=>{c.set(`listElement`,e)}),C=Z.useMemo(()=>typeof o==`function`?n||=(0,Q.jsx)(Pr,{children:o}):o,[o]),w={empty:b},T=l.useState(`floatingId`),E=ne(`div`,e,{state:w,ref:[t,S,u?null:x],props:[g,{children:C,tabIndex:-1,id:T,role:h?`grid`:`listbox`,"aria-multiselectable":y?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;tt(e);let n=e.nativeEvent,r=c.state.listRef.current[t];r&&(c.state.selectionEventRef.current=n,r.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(_)return E;let D=f&&!v?void 0:c.state.labelsRef;return(0,Q.jsx)(bt,{elementsRef:c.state.listRef,labelsRef:D,children:E})}),Ir=`⁠`;function Lr(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function Rr(){let e=b(),t=Z.useRef(null);return Z.useEffect(()=>{if(it)return;let n=t.current;if(n==null)return;let r=Lr(n);if(r==null)return;let i=r.nodeValue??``,a=`${i}${Ir}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var zr=Z.createContext(void 0);function Br(){let e=Z.useContext(zr);if(e===void 0)throw Error(s(20));return e}var Vr=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=or(),a=Y(i,$.mounted),o=Y(i,$.forceMounted);return a||n||o?(0,Q.jsx)(zr.Provider,{value:n,children:(0,Q.jsx)(Ut,{ref:t,...r})}):null}),Hr=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=$e,style:_,...v}=e,y=or(),{filteredItems:b}=cr(),x=sr(),S=Br(),C=Y(y,$.modal),w=Y(y,$.open),E=Y(y,$.mounted),D=Y(y,$.openMethod),O=Y(y,$.positionerElement),k=Y(y,$.triggerElement),A=Y(y,$.inputElement),j=Y(y,$.inputGroupElement),M=Y(y,$.inputInsidePopup),N=Y(y,$.transitionStatus),P=b.length===0,F=Xe({anchor:i??(M?k:j??A),floatingRootContext:x,positionMethod:a,mounted:E,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:h,keepMounted:S,collisionAvoidance:g,lazyFlip:!0});_t(w&&C,D===`touch`,O,k);let I={open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden,empty:P};T(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=m(e=>{y.set(`positionerElement`,e)}),L=ut(e,I,{styles:F.positionerStyles,transitionStatus:N,props:v,refs:[t,ee],hidden:!E,inert:!w});return(0,Q.jsxs)(Er.Provider,{value:F,children:[E&&C&&(0,Q.jsx)(rt,{inert:lt(!w),cutout:j??A??k}),L]})}),Ur={...yt,...vt},Wr=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=or(),l=Dr(),u=sr(),{filteredItems:d}=cr(),f=Y(c,$.mounted),p=Y(c,$.open),m=Y(c,$.openMethod),h=Y(c,$.transitionStatus),g=Y(c,$.inputInsidePopup),_=Y(c,$.inputElement),v=Y(c,$.modal),y=Y(c,$.id),b=d.length===0,x=s.id??(g?dr(y):void 0);T(()=>(c.set(`popupId`,c.state.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),gt({open:p,ref:c.state.popupRef,onComplete(){p&&c.state.onOpenChangeComplete(!0)}});let S=ne(`div`,e,{state:{open:p,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[{id:x,role:g?`dialog`:`presentation`,tabIndex:-1,onFocus(e){let t=ee(e.nativeEvent);m!==`touch`&&(P(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},at(h),s],stateAttributesMapping:Ur}),C=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let E=!g||v;return(0,Q.jsx)(K,{context:u,disabled:!f,modal:E,openInteractionType:m,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,Q.jsxs)(Z.Fragment,{children:[S,E&&(0,Q.jsx)(Or,{ref:c.state.endDismissRef})]})})}),Gr=Z.createContext(void 0);function Kr(){let e=Z.useContext(Gr);if(!e)throw Error(s(19));return e}var qr=Z.createContext(!1);function Jr(){return Z.useContext(qr)}var Yr=e(r(),1);function Xr(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Z.useRef(!1),m=Z.useRef(null),h=Ct({index:l,textRef:m,indexGuessBehavior:Dt.GuessFromOrder}),g=or(),_=Jr(),v=ur(),y=Y(g,$.open),b=Y(g,$.selectionMode),S=Y(g,$.readOnly),C=Y(g,$.isItemEqualToValue),w=b!==`none`,E=l??(r?i??-1:h.index),D=h.index!==-1,O=Y(g,$.id),k=Y(g,$.isActive,E),A=Y(g,$.isSelected,c),j=Y(g,$.itemProps),M=Z.useRef(null),N=O!=null&&D?`${O}-${E}`:void 0,P=A&&w;T(()=>{if(!(D&&(r||l!=null)))return;let e=g.state.listRef.current;return e[E]=M.current,()=>{delete e[E]}},[D,r,E,l,g]),T(()=>{if(!D||v)return;let e=g.state.valuesRef.current;return e[E]=c,b!==`none`&&g.state.allValuesRef.current.push(c),()=>{delete e[E]}},[D,v,E,c,g,b]),T(()=>{if(!y){p.current=!1;return}if(!D||v)return;let e=g.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;he(c,t,C)&&g.set(`selectedIndex`,E)},[D,v,y,g,E,c,C]);let{getButtonProps:F,buttonRef:I}=x({disabled:u,focusableWhenDisabled:!0,native:d,composite:!0}),ee={disabled:u,selected:P,highlighted:k};function L(e){function t(){g.state.handleSelection(e,c)}g.state.submitOnItemClick?(Yr.flushSync(t),g.state.requestSubmit()):t()}let te={id:N,role:_?`gridcell`:`option`,"aria-selected":w?P:void 0,tabIndex:void 0,onPointerDownCapture(e){p.current=!0,e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){u||S||L(e.nativeEvent)},onMouseUp(e){let t=p.current;p.current=!1,!(u||S||e.button!==0||t||!k)&&L(e.nativeEvent)}},re=ne(`div`,t,{ref:[I,n,h.ref,M],state:ee,props:[j,te,f,F]}),ie=Z.useMemo(()=>({selected:P,textRef:m}),[P,m]);return(0,Q.jsx)(Gr.Provider,{value:ie,children:re})}function Zr(e){let{componentProps:t,forwardedRef:n}=e,r=Y(or(),$.isItemEqualToValue),{flatFilteredItems:i}=cr();return(0,Q.jsx)(Xr,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:ve(i,t.value??null,r)})}var Qr=Z.memo(Z.forwardRef(function(e,t){let n=Y(or(),$.virtualized);return n&&e.index==null?(0,Q.jsx)(Zr,{componentProps:e,forwardedRef:t}):(0,Q.jsx)(Xr,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),$r=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=cr(),c=or(),l=Rr(),u=s.length===0?a:null;return ne(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function ei(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,Q.jsx)(br,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var ti=Z.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=Kr();return n||r?(0,Q.jsx)(ni,{...e,ref:t}):null}),ni=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Kr(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=xt(s),d=ne(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:vt});return gt({open:s,ref:c,onComplete(){s||u(!1)}}),d})),ri=ei;function ii({className:e,children:t,...n}){return(0,Q.jsxs)(Cr,{"data-slot":`combobox-trigger`,className:l(`cursor-pointer data-disabled:cursor-not-allowed [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Q.jsx)(ge,{className:`pointer-events-none size-4 text-muted-foreground`})]})}function ai({className:e,...t}){return(0,Q.jsx)(jr,{"data-slot":`combobox-clear`,render:(0,Q.jsx)(Oe,{variant:`ghost`,size:`icon-xs`}),className:l(e),...t,children:(0,Q.jsx)(ke,{className:`pointer-events-none`})})}function oi({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return(0,Q.jsxs)(Me,{className:l(`w-auto`,e),children:[(0,Q.jsx)(kr,{render:(0,Q.jsx)(xe,{disabled:n}),...a}),(0,Q.jsxs)(Pe,{align:`inline-end`,children:[r&&(0,Q.jsx)(Oe,{size:`icon-xs`,variant:`ghost`,render:(0,Q.jsx)(ii,{}),"data-slot":`input-group-button`,className:`group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent`,disabled:n}),i&&(0,Q.jsx)(ai,{disabled:n})]}),t]})}function si({className:e,side:t=`bottom`,sideOffset:n=6,align:r=`start`,alignOffset:i=0,anchor:a,...o}){return(0,Q.jsx)(Vr,{children:(0,Q.jsx)(Hr,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:`isolate z-50`,children:(0,Q.jsx)(Wr,{"data-slot":`combobox-content`,"data-chips":!!a,className:l(`group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o})})})}function ci({className:e,...t}){return(0,Q.jsx)(Fr,{"data-slot":`combobox-list`,className:l(`no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0`,e),...t})}function li({className:e,children:t,...n}){return(0,Q.jsxs)(Qr,{"data-slot":`combobox-item`,className:l(`relative flex w-full cursor-pointer items-center gap-2 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,Q.jsx)(ti,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,Q.jsx)(et,{className:`pointer-events-none`})})]})}function ui({className:e,...t}){return(0,Q.jsx)($r,{"data-slot":`combobox-empty`,className:l(`hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex`,e),...t})}var di=`cline.code.model-selection.v1`;function fi(e){return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(([e,t])=>typeof e==`string`&&typeof t==`string`&&t.trim().length>0))}function pi(e){let t={lastProvider:``,lastModelByProvider:{}};if(!e)return t;try{let n=JSON.parse(e);if(!n||typeof n!=`object`||Array.isArray(n))return t;let r=n;return`lastProvider`in r||`lastModelByProvider`in r?{lastProvider:typeof r.lastProvider==`string`?r.lastProvider.trim():``,lastModelByProvider:fi(r.lastModelByProvider)}:{lastProvider:``,lastModelByProvider:fi(n)}}catch{return t}}function mi(){return typeof window>`u`?{lastProvider:``,lastModelByProvider:{}}:pi(window.localStorage.getItem(di))}var hi={openai:`openai-native`,google:`gemini`};function gi(e){let t=e.trim();return t?hi[t]??t:``}function _i(e){return(e??[]).map(e=>e.id)}function vi(e){return(e??[]).filter(e=>e.supportsReasoning).map(e=>e.id)}function yi(e){return{providers:e,enabledProviderIds:e.filter(e=>e.enabled).map(e=>e.id),providerModels:Object.fromEntries(e.map(e=>[e.id,_i(e.modelList)])),providerReasoningModels:Object.fromEntries(e.map(e=>[e.id,vi(e.modelList)]))}}async function bi(){return yi((await G.invoke(`list_provider_catalog`)).providers??[])}async function xi(e){return(await G.invoke(`list_provider_models`,{provider:e})).models??[]}var Si=3e4,Ci=null;async function wi(){let e=await G.invoke(`list_routine_schedules`);return{schedules:e.schedules??[],activeExecutions:e.activeExecutions??[],upcomingRuns:e.upcomingRuns??[],lastExecutions:e.lastExecutions??[]}}var Ti={cline:[`anthropic/claude-sonnet-4.6`],anthropic:[`claude-sonnet-4-6`],"openai-native":[`gpt-5.3-codex`],openrouter:[`anthropic/claude-sonnet-4.6`],gemini:[`gemini-2.5-pro`]},Ei=[{label:`Mon`,value:`MON`},{label:`Tue`,value:`TUE`},{label:`Wed`,value:`WED`},{label:`Thu`,value:`THU`},{label:`Fri`,value:`FRI`},{label:`Sat`,value:`SAT`},{label:`Sun`,value:`SUN`}];function Di(e){if(e==null)return`-`;if(typeof e==`number`){if(!Number.isFinite(e))return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:t.toLocaleString()}let t=e.trim();if(t.length===0)return`-`;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function Oi(e){let t=e.modelSelection?.providerId?.trim()||e.provider?.trim(),n=e.modelSelection?.modelId?.trim()||e.model?.trim();return t&&n?`${t}/${n}`:n||t||`-`}function ki(e){return{provider:e.modelSelection?.providerId?.trim()||e.provider?.trim()||`cline`,model:e.modelSelection?.modelId?.trim()||e.model?.trim()||`openai/gpt-5.3-codex`}}function Ai(e){if(!e)return`-`;let t=e.status?.trim()||`unknown`,n=Di(e.endedAt??e.startedAt??e.triggeredAt);return n===`-`?t:`${t} at ${n}`}function ji(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<=0))return n}function Mi(e){let t=e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0);return t.length>0?t:void 0}function Ni(e){let t=new Set(e);return Ei.map(e=>e.value).filter(e=>t.has(e))}function Pi(e,t,n){let r=Ni(e);if(r.length===0)return``;let i=Number.parseInt(t,10),a=Number.parseInt(n,10),o=Number.isFinite(i)?Math.min(Math.max(i,0),23):9,s=Number.isFinite(a)?Math.min(Math.max(a,0),59):0;return r.length===Ei.length?`${s} ${o} * * *`:`${s} ${o} * * ${r.join(`,`)}`}function Fi(e){let t=e?.trim().toUpperCase();if(!t||t===`*`)return Ei.map(e=>e.value);let n=new Set;for(let e of t.split(`,`)){let t=e.trim();if(!t)continue;let r=/^([A-Z]{3})-([A-Z]{3})$/.exec(t);if(r){let e=Ei.findIndex(e=>e.value===r[1]),t=Ei.findIndex(e=>e.value===r[2]);if(e>=0&&t>=e)for(let r=e;r<=t;r+=1)n.add(Ei[r].value);continue}Ei.some(e=>e.value===t)&&n.add(t)}return Ni([...n])}function Ii(e){let t=e.trim().split(/\s+/),n=Number.parseInt(t[0]??``,10),r=Number.parseInt(t[1]??``,10),i=Fi(t[4]);return{scheduleHour:Number.isInteger(r)&&r>=0&&r<=23?String(r):`9`,scheduleMinute:Number.isInteger(n)&&n>=0&&n<=59?String(n):`0`,scheduleDays:i.length>0?i:[`MON`,`TUE`,`WED`,`THU`,`FRI`]}}function Li(){let[e,t]=(0,Z.useState)(()=>Ci?.schedules??[]),[n,r]=(0,Z.useState)(()=>Ci?.activeExecutions??[]),[i,a]=(0,Z.useState)(()=>Ci?.upcomingRuns??[]),[o,s]=(0,Z.useState)(()=>Ci?.lastExecutions??[]),[c,u]=(0,Z.useState)(()=>!Ci),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(Ti),[D,O]=(0,Z.useState)(()=>Object.keys(Ti)),[k]=(0,Z.useState)(()=>mi()),A=gi(k.lastProvider),[M,N]=(0,Z.useState)({name:``,scheduleHour:`9`,scheduleMinute:`0`,scheduleDays:[`MON`,`TUE`,`WED`,`THU`,`FRI`],prompt:`Review PRs opened yesterday and summarize issues.`,provider:`cline`,model:`openai/gpt-5.3-codex`,mode:`act`,workspaceRoot:``,cwd:``,systemPrompt:``,maxIterations:``,timeoutSeconds:``,maxParallel:`1`,tags:``,enabled:!0}),P=(0,Z.useMemo)(()=>{if(D.length===0)return T;let e={};for(let t of D)e[t]=T[t]??[];return e},[D,T]),F=(0,Z.useMemo)(()=>Object.keys(P),[P]),I=(0,Z.useMemo)(()=>P[M.provider]??[],[M.provider,P]),ee=(0,Z.useMemo)(()=>Pi(M.scheduleDays,M.scheduleHour,M.scheduleMinute),[M.scheduleDays,M.scheduleHour,M.scheduleMinute]);(0,Z.useEffect)(()=>{let e=!1;async function t(){try{let t=await bi();if(e)return;E(t.providerModels),O(e=>{let n=new Set(t.enabledProviderIds),r=gi(M.provider);r&&n.add(r);for(let r of e)r in t.providerModels&&n.add(r);return Array.from(n)})}catch{}}return t(),()=>{e=!0}},[M.provider]),(0,Z.useEffect)(()=>{let e=gi(M.provider);if(!e||(T[e]??[]).length>0)return;let t=!1;async function n(){try{let n=await xi(e);if(t||n.length===0)return;E(t=>({...t,[e]:n.map(e=>e.id)})),O(t=>t.includes(e)?t:[...t,e])}catch{}}return n(),()=>{t=!0}},[M.provider,T]),(0,Z.useEffect)(()=>{if(F.length===0)return;let e=null,t=gi(M.provider);if(F.includes(t)){let n=P[t]??[];if(n.length===0||n.includes(M.model))return;let r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider];e={provider:t,model:r&&n.includes(r)?r:n[0]}}else{let t=A&&F.includes(A)?A:F[0],n=P[t]??[],r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider];e={provider:t,model:r&&n.includes(r)?r:n[0]??``}}let n=window.setTimeout(()=>{N(t=>({...t,...e}))},0);return()=>window.clearTimeout(n)},[F,M.model,M.provider,k.lastModelByProvider,k.lastProvider,A,P]);let L=(0,Z.useCallback)(async e=>{let n=Date.now();if(!e?.force&&Ci&&n-Ci.fetchedAt<Si){t(Ci.schedules),r(Ci.activeExecutions),a(Ci.upcomingRuns),s(Ci.lastExecutions),f(null),u(!1);return}e?.showLoading!==!1&&u(!0),f(null);try{let e=await wi(),i=e.schedules,o=e.activeExecutions,c=e.upcomingRuns,l=e.lastExecutions;t(i),r(o),a(c),s(l),Ci={schedules:i,activeExecutions:o,upcomingRuns:c,lastExecutions:l,fetchedAt:n}}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{u(!1)}},[]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{L()},0);return()=>window.clearTimeout(e)},[L]);let te=async(e,t)=>{m(e.scheduleId),f(null);try{t?await G.invoke(`resume_routine_schedule`,{schedule_id:e.scheduleId}):await G.invoke(`pause_routine_schedule`,{schedule_id:e.scheduleId}),await L({force:!0,showLoading:!1})}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{m(null)}},ne=async e=>{m(e),f(null);try{await G.invoke(`trigger_routine_schedule`,{schedule_id:e}),await L({force:!0,showLoading:!1}),window.setTimeout(()=>{L({force:!0,showLoading:!1})},1e3)}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{m(null)}},re=async e=>{m(e),f(null);try{await G.invoke(`delete_routine_schedule`,{schedule_id:e}),g(null),await L({force:!0,showLoading:!1})}catch(e){let t=e instanceof Error?e.message:String(e);f(t)}finally{m(null)}},ie=async()=>{b(null),f(null),w(null);let e={workspaceRoot:``,cwd:``};try{e=await G.invoke(`get_process_context`)}catch{}let t=A&&F.includes(A)?A:F[0]??`cline`,n=P[t]??[],r=k.lastModelByProvider[t]??k.lastModelByProvider[k.lastProvider],i=r&&n.includes(r)?r:n[0]??M.model;N({name:``,scheduleHour:`9`,scheduleMinute:`0`,scheduleDays:[`MON`,`TUE`,`WED`,`THU`,`FRI`],prompt:`Review PRs opened yesterday and summarize issues.`,provider:t,model:i,mode:`act`,workspaceRoot:e.workspaceRoot||e.cwd,cwd:e.cwd||``,systemPrompt:``,maxIterations:``,timeoutSeconds:``,maxParallel:`1`,tags:``,enabled:!0}),v(!0)},ae=e=>{let{provider:t,model:n}=ki(e),r=Ii(e.cronPattern);b(e),f(null),w(null),O(e=>e.includes(t)?e:[...e,t]),E(e=>e[t]?.includes(n)?e:{...e,[t]:[...e[t]??[],n]}),N({name:e.name,...r,prompt:e.prompt,provider:t,model:n,mode:e.mode===`plan`?`plan`:`act`,workspaceRoot:e.workspaceRoot??``,cwd:e.cwd??``,systemPrompt:e.systemPrompt??``,maxIterations:typeof e.maxIterations==`number`?String(e.maxIterations):``,timeoutSeconds:typeof e.timeoutSeconds==`number`?String(e.timeoutSeconds):``,maxParallel:typeof e.maxParallel==`number`?String(e.maxParallel):`1`,tags:e.tags?.join(`,`)??``,enabled:e.enabled}),v(!0)},oe=async()=>{let e=M.name.trim();if(!e){w(`Routine name is required.`);return}let t=Pi(M.scheduleDays,M.scheduleHour,M.scheduleMinute);if(!t){w(`Select at least one day and a valid time.`);return}let n=M.prompt.trim();if(!n){w(`Prompt is required.`);return}let r=M.workspaceRoot.trim();if(!r){w(`Workspace root is required.`);return}w(null),S(!0);try{let i=gi(M.provider)||F[0]||`cline`,a=M.model.trim()||(P[i]??[])[0]||`openai/gpt-5.3-codex`,o=ji(M.maxIterations),s=ji(M.timeoutSeconds),c=ji(M.maxParallel)??1,l=Mi(M.tags),u=y?`update_routine_schedule`:`create_routine_schedule`;await G.invoke(u,{...y?{schedule_id:y.scheduleId}:void 0,name:e,cron_pattern:t,prompt:n,provider:i,model:a,mode:M.mode,workspace_root:r,cwd:M.cwd.trim()||void 0,system_prompt:y?M.systemPrompt.trim()||null:M.systemPrompt.trim()||void 0,max_iterations:y?o??null:o,timeout_seconds:y?s??null:s,max_parallel:c,enabled:M.enabled,tags:l??[]}),await L({force:!0,showLoading:!1}),v(!1),b(null)}catch(e){let t=e instanceof Error?e.message:String(e);w(t)}finally{S(!1)}},se=(0,Z.useMemo)(()=>{let e=new Map;for(let t of n)t.scheduleId&&(e.has(t.scheduleId)||e.set(t.scheduleId,t));return e},[n]),ce=(0,Z.useMemo)(()=>{let e=new Map;for(let t of o)t.scheduleId&&(e.has(t.scheduleId)||e.set(t.scheduleId,t));return e},[o]),R=(0,Z.useMemo)(()=>[...e].sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase())),[e]);return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ft,{description:`Scheduled jobs are run through the hub.`,title:`Schedules`,meta:(0,Q.jsx)(wt,{children:`cline schedule`}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void L(),disabled:c,children:(0,Q.jsx)(He,{className:l(`h-4 w-4`,c&&`animate-spin`)})}),(0,Q.jsxs)(z,{size:`sm`,onClick:()=>void ie(),children:[(0,Q.jsx)(V,{className:`h-4 w-4`}),`New Schedule`]})]})}),d&&(0,Q.jsx)(`div`,{className:`mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:d}),c?(0,Q.jsx)(ft,{children:`Loading schedules...`}):R.length===0?(0,Q.jsx)(ft,{children:`No schedules found. Create a schedule to run routines on a recurring basis.`}):(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:R.map(e=>{let t=p===e.scheduleId,n=se.get(e.scheduleId),r=ce.get(e.scheduleId),a=i.find(t=>t.scheduleId===e.scheduleId);return(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border px-5 py-4 transition-colors hover:bg-accent/20`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(B,{className:l(`h-2.5 w-2.5 shrink-0`,e.enabled?`fill-primary text-primary`:`fill-muted-foreground/40 text-muted-foreground/40`)}),(0,Q.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:e.name}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.mode}),(0,Q.jsx)(`span`,{className:`rounded-md border border-border px-2 py-0.5 text-xs text-muted-foreground`,children:e.cronPattern}),(0,Q.jsx)(`div`,{className:`flex-1`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`View ${e.name}`,onClick:()=>{window.alert(JSON.stringify(e,null,2))},children:(0,Q.jsx)(en,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit ${e.name}`,onClick:()=>ae(e),disabled:t,children:(0,Q.jsx)(Kt,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run ${e.name} now`,onClick:()=>void ne(e.scheduleId),disabled:t,children:(0,Q.jsx)(Ue,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":e.enabled?`Pause ${e.name}`:`Resume ${e.name}`,onClick:()=>void te(e,!e.enabled),disabled:t,children:e.enabled?(0,Q.jsx)(on,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(Ke,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(z,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,onClick:()=>g(e),disabled:t,children:(0,Q.jsx)(le,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(Ye,{checked:e.enabled,onCheckedChange:t=>void te(e,t),disabled:t,"aria-label":`Enable ${e.name}`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 ml-5.5 flex flex-col gap-1 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`ID:`}),` `,e.scheduleId]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Prompt:`}),` `,e.prompt]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Model:`}),` `,Oi(e)]}),e.workspaceRoot&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Workspace:`}),` `,e.workspaceRoot]}),e.cwd&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`CWD:`}),` `,e.cwd]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last run:`}),` `,Di(e.lastRunAt)]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last result:`}),` `,Ai(r)]}),r?.sessionId&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last session:`}),` `,r.sessionId]}),r?.errorMessage&&(0,Q.jsxs)(`p`,{className:`text-destructive`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Last error:`}),` `,r.errorMessage]}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Next run:`}),` `,Di(e.nextRunAt||a?.nextRunAt)]}),n&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Active:`}),` `,n.executionId,` since`,` `,Di(n.startedAt)]}),e.tags&&e.tags.length>0&&(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground/70`,children:`Tags:`}),` `,e.tags.join(`, `)]})]})]},e.scheduleId)})}),(0,Q.jsx)(q,{open:!!h,onOpenChange:e=>{e||g(null)},children:(0,Q.jsxs)(Wt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(Qe,{children:`Delete Routine`}),(0,Q.jsxs)(mt,{children:[`This will delete "`,h?.name??`this routine`,`" and remove future scheduled runs.`]})]}),(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(Rt,{disabled:h?p===h.scheduleId:!1,children:`Cancel`}),(0,Q.jsx)(dt,{disabled:!h||p===h.scheduleId,onClick:()=>{h&&re(h.scheduleId)},variant:`destructive`,children:`Delete`})]})]})}),(0,Q.jsx)(Ce,{open:_,onOpenChange:e=>{v(e),e||(w(null),b(null))},children:(0,Q.jsxs)(je,{className:`max-h-[90vh] overflow-y-auto sm:max-w-2xl`,children:[(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ne,{children:y?`Edit Routine`:`Create Routine`}),(0,Q.jsx)(Ie,{children:y?`Update this scheduler routine.`:`Create a scheduler routine.`})]}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{htmlFor:`routine-name`,children:`Name`}),(0,Q.jsx)(j,{id:`routine-name`,value:M.name,onChange:e=>N(t=>({...t,name:e.target.value})),placeholder:`Daily code review`})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2 space-y-3`,children:[(0,Q.jsx)(W,{children:`Schedule`}),(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 rounded-md border border-border p-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-hour`,children:`Hour`}),(0,Q.jsxs)(De,{value:M.scheduleHour,onValueChange:e=>N(t=>({...t,scheduleHour:e??t.scheduleHour})),children:[(0,Q.jsx)(Le,{className:`w-full`,id:`routine-hour`,children:(0,Q.jsx)(Be,{placeholder:`Hour`})}),(0,Q.jsx)(Ee,{children:Array.from({length:24},(e,t)=>t).map(e=>(0,Q.jsx)(be,{value:`${e}`,children:e.toString().padStart(2,`0`)},`hour-${e}`))})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-minute`,children:`Minute`}),(0,Q.jsxs)(De,{value:M.scheduleMinute,onValueChange:e=>N(t=>({...t,scheduleMinute:e??t.scheduleMinute})),children:[(0,Q.jsx)(Le,{className:`w-full`,id:`routine-minute`,children:(0,Q.jsx)(Be,{placeholder:`Minute`})}),(0,Q.jsx)(Ee,{children:Array.from({length:60},(e,t)=>t).map(e=>(0,Q.jsx)(be,{value:`${e}`,children:e.toString().padStart(2,`0`)},`minute-${e}`))})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{children:`Days of week`}),(0,Q.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:Ei.map(e=>{let t=`routine-day-${e.value.toLowerCase()}`;return(0,Q.jsxs)(W,{className:`flex items-center gap-2 rounded-md border border-border px-2 py-1.5 text-sm`,htmlFor:t,children:[(0,Q.jsx)($n,{checked:M.scheduleDays.includes(e.value),id:t,onCheckedChange:t=>N(n=>{let r=new Set(n.scheduleDays);return t===!0?r.add(e.value):r.delete(e.value),{...n,scheduleDays:Ni([...r])}})}),e.label]},e.value)})})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2 rounded-md border border-border bg-muted/30 px-2 py-1.5 text-xs text-muted-foreground`,children:[`Cron:`,` `,(0,Q.jsx)(`span`,{className:`font-mono text-foreground`,children:ee||`Select one or more days`})]})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{htmlFor:`routine-prompt`,children:`Prompt`}),(0,Q.jsx)(Fe,{id:`routine-prompt`,value:M.prompt,onChange:e=>N(t=>({...t,prompt:e.target.value})),rows:4})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{children:`Provider`}),(0,Q.jsxs)(ri,{items:F,onValueChange:e=>{if(!e)return;let t=P[e]??[],n=k.lastModelByProvider[e],r=n&&t.includes(n)?n:t[0]??``;N(t=>({...t,provider:e,model:r}))},value:M.provider,children:[(0,Q.jsx)(oi,{className:`h-9 w-full`,readOnly:!0,showClear:!1,showTrigger:!0}),(0,Q.jsxs)(si,{children:[(0,Q.jsx)(ui,{children:`No providers found.`}),(0,Q.jsx)(ci,{children:e=>(0,Q.jsx)(li,{value:e,children:e},e)})]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{children:`Model`}),(0,Q.jsxs)(ri,{items:I,onValueChange:e=>{e&&N(t=>({...t,model:e}))},value:M.model,children:[(0,Q.jsx)(oi,{className:`h-9 w-full`,readOnly:!0,showClear:!1,showTrigger:!0}),(0,Q.jsxs)(si,{children:[(0,Q.jsx)(ui,{children:`No models found.`}),(0,Q.jsx)(ci,{children:e=>(0,Q.jsx)(li,{value:e,children:e},e)})]})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{children:`Mode`}),(0,Q.jsxs)(De,{value:M.mode,onValueChange:e=>N(t=>({...t,mode:e===`plan`?`plan`:`act`})),children:[(0,Q.jsx)(Le,{className:`w-full`,children:(0,Q.jsx)(Be,{placeholder:`Select mode`})}),(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(be,{value:`act`,children:`act`}),(0,Q.jsx)(be,{value:`plan`,children:`plan`})]})]})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{htmlFor:`routine-workspace`,children:`Workspace root`}),(0,Q.jsx)(j,{id:`routine-workspace`,value:M.workspaceRoot,onChange:e=>N(t=>({...t,workspaceRoot:e.target.value}))})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{htmlFor:`routine-cwd`,children:`CWD (optional)`}),(0,Q.jsx)(j,{id:`routine-cwd`,value:M.cwd,onChange:e=>N(t=>({...t,cwd:e.target.value}))})]}),(0,Q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Q.jsx)(W,{htmlFor:`routine-system-prompt`,children:`System prompt (optional)`}),(0,Q.jsx)(Fe,{id:`routine-system-prompt`,value:M.systemPrompt,onChange:e=>N(t=>({...t,systemPrompt:e.target.value})),rows:3})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-max-iterations`,children:`Max iterations (optional)`}),(0,Q.jsx)(j,{id:`routine-max-iterations`,value:M.maxIterations,onChange:e=>N(t=>({...t,maxIterations:e.target.value})),placeholder:`50`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-timeout`,children:`Timeout seconds (optional)`}),(0,Q.jsx)(j,{id:`routine-timeout`,value:M.timeoutSeconds,onChange:e=>N(t=>({...t,timeoutSeconds:e.target.value})),placeholder:`3600`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-max-parallel`,children:`Max parallel`}),(0,Q.jsx)(j,{id:`routine-max-parallel`,value:M.maxParallel,onChange:e=>N(t=>({...t,maxParallel:e.target.value})),placeholder:`1`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(W,{htmlFor:`routine-tags`,children:`Tags (comma-separated, optional)`}),(0,Q.jsx)(j,{id:`routine-tags`,value:M.tags,onChange:e=>N(t=>({...t,tags:e.target.value})),placeholder:`automation,review`})]})]}),C&&(0,Q.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:C}),(0,Q.jsxs)(we,{children:[(0,Q.jsx)(z,{variant:`outline`,onClick:()=>v(!1),disabled:x,children:`Cancel`}),(0,Q.jsx)(z,{onClick:()=>void oe(),disabled:x,children:x?y?`Saving...`:`Creating...`:y?`Save Changes`:`Create Schedule`})]})]})})]})}function Ri(e,t,n){let r=t.split(`.`).filter(Boolean);if(r.length===0)return;let i=e;for(let e of r.slice(0,-1)){let t=i[e];(!t||typeof t!=`object`||Array.isArray(t))&&(i[e]={}),i=i[e]}let a=r.at(-1);a&&(i[a]=n)}function zi(e){let t={};for(let[n,r]of Object.entries(e))Ri(t,n,r);return t}var Bi=[`General`,`Providers`,`MCP`,`Channels`,`Schedules`,`Account`],Vi=6e4,Hi=null;function Ui({chrome:e=`full`,initialSection:t=`General`,onClose:n,onNavigateSection:r}){let[i,a]=(0,Z.useState)(t),[o,s]=(0,Z.useState)(!0),[c,u]=(0,Z.useState)(()=>Hi?.providers??[]),[d,f]=(0,Z.useState)(()=>!Hi),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)({}),[_,v]=(0,Z.useState)({}),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(!1),T=(0,Z.useCallback)(e=>{u(t=>{let n=typeof e==`function`?e(t):e;return Hi={providers:n,fetchedAt:Date.now()},n})},[]),E=(0,Z.useCallback)(async()=>{if(Hi&&Date.now()-Hi.fetchedAt<Vi){u(Hi.providers),f(!1),m(null);return}f(!0),m(null);try{let e=await G.invoke(`list_provider_catalog`);T(e.providers)}catch(e){let t=e instanceof Error?e.message:String(e);m(t),u([])}finally{f(!1)}},[T]);(0,Z.useEffect)(()=>{if(i!==`Providers`)return;let e=window.setTimeout(()=>{E()},0);return()=>window.clearTimeout(e)},[i,E]);let D=(0,Z.useCallback)(async(e,t)=>{try{await G.invoke(`save_provider_settings`,{provider:e,enabled:t.enabled,api_key:t.apiKey,base_url:t.baseUrl,settings:t.configValues?zi(t.configValues):void 0})}catch(t){let n=t instanceof Error?t.message:String(t);window.alert(`Failed to save provider settings for ${e}: ${n}`)}},[]),O=(0,Z.useCallback)(e=>{T(t=>t.map(t=>{if(t.id!==e)return t;let n=!t.enabled;return D(e,{enabled:n}),{...t,enabled:n}}))},[D,T]),k=(0,Z.useCallback)((e,t)=>{T(n=>n.map(n=>n.id===e?{...n,...t,configValues:t.configValues?{...n.configValues??{},...t.configValues}:n.configValues}:n)),D(e,{apiKey:t.apiKey,baseUrl:t.baseUrl,configValues:t.configValues})},[D,T]),A=(0,Z.useCallback)(async e=>{g(t=>({...t,[e]:!0})),v(t=>({...t,[e]:null}));try{let t=await G.invoke(`list_provider_models`,{provider:e});T(n=>n.map(n=>n.id===e?{...n,modelList:t.models,models:t.models.length}:n))}catch(t){let n=t instanceof Error?t.message:String(t);v(t=>({...t,[e]:n}))}finally{g(t=>({...t,[e]:!1}))}},[T]),j=c.filter(e=>e.enabled),M=x?c.find(e=>e.id===x)??null:null,N=e=>e.capabilities?.includes(`oauth`)??!1,P=async e=>{b(e);try{let t=await G.invoke(`run_provider_oauth_login`,{provider:e});T(n=>n.map(n=>n.id===e?{...n,enabled:!0,oauthAccessTokenPresent:t.accessToken.trim().length>0}:n)),S(e)}catch(t){let n=t instanceof Error?t.message:String(t);window.alert(`Failed to sign in to ${e}: ${n}`)}finally{b(null)}},F=e=>{a(`Providers`),r?.(`Providers`),S(e)};(0,Z.useEffect)(()=>{if(!x)return;let e=c.find(e=>e.id===x);if(!e||(e.modelList?.length??0)>0)return;let t=window.setTimeout(()=>{A(x)},0);return()=>window.clearTimeout(t)},[A,c,x]);let I=()=>{r?.(`Providers`),S(null),w(!1)},ee=(0,Z.useCallback)(async e=>{await G.invoke(`add_provider`,{provider_id:e.providerId,name:e.name,base_url:e.baseUrl,api_key:e.apiKey,headers:e.headers,timeout_ms:e.timeoutMs,models:e.models,default_model_id:e.defaultModelId,models_source_url:e.modelsSourceUrl,capabilities:e.capabilities}),await E(),w(!1),S(e.providerId)},[E]),L=()=>{r?.(`Providers`),S(null),w(!0)},te=e=>{a(e),r?.(e),S(null),w(!1)},ne=C?(0,Q.jsx)(Cn,{existingProviderIds:c.map(e=>e.id),onBack:I,onSave:ee}):d?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading providers...`})}):p?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`p`,{className:`max-w-xl px-4 text-center text-sm text-destructive`,children:[`Failed to load providers: `,p]})}):M?(0,Q.jsxs)(`div`,{className:`grid h-full grid-cols-[minmax(24rem,0.95fr)_minmax(28rem,1.05fr)] overflow-hidden max-[1100px]:grid-cols-1 max-[1100px]:grid-rows-[minmax(24rem,0.9fr)_minmax(26rem,1fr)]`,children:[(0,Q.jsx)(Un,{onAddProvider:L,onConfigure:F,onToggle:O,providers:c,selectedProviderId:M.id,variant:`panel`}),(0,Q.jsx)(`aside`,{className:`min-h-0 overflow-hidden border-l bg-background max-[1100px]:border-l-0 max-[1100px]:border-t`,children:(0,Q.jsx)(Wn,{modelsError:_[M.id]??null,modelsLoading:h[M.id]??!1,oauthLoginPending:y===M.id,onBack:I,onLoadModels:()=>void A(M.id),onOAuthLogin:N(M)?()=>void P(M.id):void 0,onUpdate:e=>k(M.id,e),provider:M,variant:`panel`})})]}):(0,Q.jsx)(Un,{onAddProvider:L,onConfigure:F,onToggle:O,providers:c}),re=i===`Providers`?ne:i===`MCP`?(0,Q.jsx)(zn,{}):i===`Channels`?(0,Q.jsx)(Mn,{}):i===`Schedules`?(0,Q.jsx)(Li,{}):i===`Account`?(0,Q.jsx)(xn,{}):i===`General`?(0,Q.jsx)(Wi,{}):(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[i,` settings coming soon.`]})});return e===`content`?(0,Q.jsx)(`div`,{className:`h-full overflow-hidden bg-background`,children:re}):(0,Q.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden bg-background`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border px-6 py-3`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Settings`}),(0,Q.jsx)(z,{"aria-label":`Close settings`,className:`justify-start`,onClick:n,variant:`ghost`,children:(0,Q.jsx)(ke,{className:`size-3`})})]}),(0,Q.jsxs)(`div`,{className:`flex flex-1 overflow-hidden`,children:[(0,Q.jsx)(`nav`,{className:`w-56 shrink-0 border-r border-border`,children:(0,Q.jsx)(ht,{className:`h-full`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5 p-3`,children:Bi.map(e=>e===`Providers`?(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(z,{className:l(`flex w-full items-center justify-between rounded-md px-3 py-2 text-sm transition-colors`,i===`Providers`?`bg-accent text-accent-foreground font-medium`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>{te(`Providers`),s(e=>!e)},variant:`ghost`,children:[(0,Q.jsx)(`span`,{children:`Providers`}),o?(0,Q.jsx)(ge,{className:`size-3`}):(0,Q.jsx)(Yt,{className:`size-3`})]}),o&&(0,Q.jsx)(`div`,{className:`ml-3 mt-0.5 flex flex-col gap-0.5 border-l border-border pl-2`,children:j.map(e=>(0,Q.jsx)(z,{className:l(`justify-start`,x===e.id?`bg-accent/80 text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/30`),disabled:y===e.id,onClick:()=>F(e.id),variant:`ghost`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]},e):(0,Q.jsx)(z,{className:l(`justify-start`,i===e&&!x?`bg-accent text-accent-foreground font-medium`:`text-muted-foreground hover:bg-accent/50 hover:text-foreground`),onClick:()=>{te(e)},variant:`ghost`,children:e},e))})})}),(0,Q.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:re})]})]})}function Wi(){let[e,t]=(0,Z.useState)(()=>typeof window>`u`?`light`:X()??Ot()),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!0),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(!0),[f,p]=(0,Z.useState)(!0),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=(0,Z.useCallback)(async()=>{a(!0),l(null),p(!0),_(null);try{let e=await G.invoke(`get_global_settings`);r(e.telemetryOptOut),d(e.autoUpdateEnabled)}catch(e){let t=e instanceof Error?e.message:String(e);l(t),_(t)}finally{a(!1),p(!1)}},[]);(0,Z.useEffect)(()=>{let e=window.setTimeout(()=>{v()},0);return()=>window.clearTimeout(e)},[v]);let y=async e=>{let t=n;r(e),s(!0),l(null);try{let t=await G.invoke(`set_telemetry_opt_out`,{telemetry_opt_out:e});r(t.telemetryOptOut)}catch(e){let n=e instanceof Error?e.message:String(e);r(t),l(n)}finally{s(!1)}},b=async e=>{let t=u;d(e),h(!0),_(null);try{let t=await G.invoke(`set_auto_update_enabled`,{auto_update_enabled:e});d(t.autoUpdateEnabled)}catch(e){let n=e instanceof Error?e.message:String(e);d(t),_(n)}finally{h(!1)}};return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ft,{description:`Manage Hub preferences for this browser and CLI environment.`,title:`Settings`}),(0,Q.jsxs)(`section`,{className:`max-w-[86rem]`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Dark mode`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Keep the Hub interface in dark mode on this browser.`})]}),(0,Q.jsx)(Ye,{"aria-label":`Dark mode`,checked:e===`dark`,onCheckedChange:e=>{t(Nt(e?`dark`:`light`)),window.dispatchEvent(new Event(`cline-hub-theme-change`))}})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Auto update`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Automatically install CLI updates on startup.`}),g?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-destructive`,children:[`Failed to update auto update setting: `,g]}):null]}),(0,Q.jsx)(Ye,{"aria-label":`Auto update`,checked:u,disabled:f||m,onCheckedChange:e=>void b(e)})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-20 items-center justify-between gap-5 border-b max-[720px]:flex-col max-[720px]:items-stretch max-[720px]:py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-[17px] font-semibold text-foreground`,children:`Telemetry`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[15px] text-muted-foreground`,children:`Enable error and usage report to help us improve Cline.`}),c?(0,Q.jsxs)(`p`,{className:`mt-2 text-xs text-destructive`,children:[`Failed to update telemetry setting: `,c]}):null]}),(0,Q.jsx)(Ye,{"aria-label":`Telemetry`,checked:!n,disabled:i||o,onCheckedChange:e=>void y(!e)})]})]})]})}export{Ui as SettingsView};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-Cz8bXOH0.js";import{O as r,c as i,s as a,x as o}from"./chunk-WYO6CB5R-i6G7y6Wv.js";import{et as s,g as c}from"./chunk-ICXQ74PX-tBj7_Af3.js";import{t as l}from"./line-BTy_dUbW.js";import"./chunk-HOUHSVGY-7-np6tLe.js";import"./chunk-Q4XR5HBZ-DLm93PI-.js";import{i as u,t as d}from"./mermaid-layout-OD00zOyc.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-BWr7Kxep.js";import"./chunk-32BRIVSS-hNjl59yJ.js";import"./chunk-XXDRQBXY-DlK_iNGL.js";import"./chunk-VR4S4FIN-s6lsgHY6.js";import"./chunk-C7G6YPKG-DNqG58q0.js";import"./chunk-ZGVPDNZ5-C9VvO5W0.js";import"./chunk-52WLFC77-BuWVK9iY.js";import"./chunk-FWX5IMBZ-CYhSzu5d.js";import{i as f,n as p,t as m}from"./chunk-EX3LRPZG-e5_iLYaU.js";var h=e(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit).attr(`cy`,o().state.padding+o().state.sizeUnit),`drawStartState`),g=e(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,o().state.textHeight).attr(`class`,`divider`).attr(`x2`,o().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=e((e,t)=>{let n=e.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+2*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,r.width+2*o().state.padding).attr(`height`,r.height+2*o().state.padding).attr(`rx`,o().state.radius),n},`drawSimpleState`),v=e((t,n)=>{let r=e(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*o().state.padding).text(t);n||r.attr(`dy`,o().state.textHeight)},`addTspan`),i=t.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+1.3*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,s=t.append(`text`).attr(`x`,o().state.padding).attr(`y`,a+o().state.padding*.4+o().state.dividerMargin+o().state.textHeight).attr(`class`,`state-description`),c=!0,l=!0;n.descriptions.forEach(function(e){c||(r(s,e,l),l=!1),c=!1});let u=t.append(`line`).attr(`x1`,o().state.padding).attr(`y1`,o().state.padding+a+o().state.dividerMargin/2).attr(`y2`,o().state.padding+a+o().state.dividerMargin/2).attr(`class`,`descr-divider`),d=s.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*o().state.padding),t.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,f+2*o().state.padding).attr(`height`,d.height+a+2*o().state.padding).attr(`rx`,o().state.radius),t},`drawDescrState`),y=e((e,t,n)=>{let r=o().state.padding,i=2*o().state.padding,a=e.node().getBBox(),s=a.width,c=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,o().state.titleShift).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,s);d===s&&(d+=i);let f,p=e.node().getBBox();t.doc,f=c-r,u>s&&(f=(s-d)/2+r),Math.abs(c-p.x)<r&&u>s&&(f=c-(u-s)/2);let m=1-o().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+o().state.textHeight+o().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=s&&l.attr(`x`,c+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,o().state.textHeight*3).attr(`rx`,o().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*o().state.textHeight).attr(`rx`,o().state.radius),e},`addTitleAndBox`),b=e(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,o().state.sizeUnit+o().state.miniPadding).attr(`cx`,o().state.padding+o().state.sizeUnit+o().state.miniPadding).attr(`cy`,o().state.padding+o().state.sizeUnit+o().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit+2).attr(`cy`,o().state.padding+o().state.sizeUnit+2)),`drawEndState`),x=e((e,t)=>{let n=o().state.forkWidth,r=o().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,o().state.padding).attr(`y`,o().state.padding)},`drawForkJoinState`),S=e((e,t,n,r)=>{let i=0,s=r.append(`text`);s.style(`text-anchor`,`start`),s.attr(`class`,`noteText`);let c=e.replace(/\r\n/g,`<br/>`);c=c.replace(/\n/g,`<br/>`);let l=c.split(a.lineBreakRegex),u=1.25*o().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=s.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+o().state.noteMargin),e.attr(`y`,n+i+1.25*o().state.noteMargin)}}return{textWidth:s.node().getBBox().width,textHeight:i}},`_drawLongText`),C=e((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,o().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*o().state.noteMargin),n.attr(`width`,r+o().state.noteMargin*2),n},`drawNote`),w=e(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*o().state.padding,r.height=a.height+2*o().state.padding,r},`drawState`),T=0,E=e(function(n,i,u){let d=e(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);i.points=i.points.filter(e=>!Number.isNaN(e.y));let f=i.points,p=l().x(function(e){return e.x}).y(function(e){return e.y}).curve(s),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(o().state.arrowMarkerAbsolute&&(g=r(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:r,y:s}=c.calcLabelPosition(i.points),l=a.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=l.length;n++){let i=e.append(`text`).attr(`text-anchor`,`middle`).text(l[n]).attr(`x`,r).attr(`y`,s+d),a=i.node().getBBox();p=Math.max(p,a.width),m=Math.min(m,a.x),t.info(a.x,r,s+d),d===0&&(d=i.node().getBBox().height,t.info(`Title height`,d,s)),f.push(i)}let h=d*l.length;if(l.length>1){let e=(l.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,s+n*d-e)),h=d*l.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,r-p/2-o().state.padding/2).attr(`y`,s-h/2-o().state.padding/2-3.5).attr(`width`,p+o().state.padding).attr(`height`,h+o().state.padding),t.info(g)}T++},`drawEdge`),D,O={},k=e(function(){},`setConf`),A=e(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=e(function(e,r,a,s){D=o().state;let c=o().securityLevel,l;c===`sandbox`&&(l=n(`#i`+r));let u=n(c===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=c===`sandbox`?l.nodes()[0].contentDocument:document;t.debug(`Rendering diagram `+e);let f=u.select(`[id='${r}']`);A(f),N(s.db.getRootDoc(),f.append(`g`).attr(`id`,r+`-root`),void 0,!1,u,d,s);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2;i(f,g,h*1.75,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=e(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=e((e,n,r,i,o,s,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}r?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let t=m[e];r&&(t.parentId=r);let a;if(t.doc){let e=n.append(`g`).attr(`id`,t.id).attr(`class`,`stateGroup`);a=N(t.doc,e,t.id,!i,o,s,c);{e=y(e,t,i);let n=e.node().getBBox();a.width=n.width,a.height=n.height+D.padding/2,O[t.id]={y:D.compositTitleSize}}}else a=w(n,t,l);if(t.note){let e=w(n,{descriptions:[],id:t.id+`-note`,note:t.note,type:`note`},l);t.note.position===`left of`?(l.setNode(a.id+`-note`,e),l.setNode(a.id,a)):(l.setNode(a.id,a),l.setNode(a.id+`-note`,e)),l.setParent(a.id,a.id+`-group`),l.setParent(a.id+`-note`,a.id+`-group`)}else l.setNode(a.id,a)}t.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,t.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*a.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),t.debug(`Graph after layout`,l.nodes());let v=n.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(t.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),o.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),o.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),s.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):t.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(t.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(n,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:r||`root`,label:r||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,t.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-Cz8bXOH0.js";import{O as r,c as i,s as a,x as o}from"./chunk-WYO6CB5R-s6qbtyS5.js";import{et as s,g as c}from"./chunk-ICXQ74PX-BLkwAJRS.js";import{t as l}from"./line-iHvrbOzL.js";import"./chunk-HOUHSVGY-DZv73_1N.js";import"./chunk-Q4XR5HBZ-BrcuBWmp.js";import{i as u,t as d}from"./mermaid-layout-OD00zOyc.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-DC6ZHIaO.js";import"./chunk-32BRIVSS-DvgtUMjH.js";import"./chunk-XXDRQBXY-DlK_iNGL.js";import"./chunk-VR4S4FIN-CxpxBT1R.js";import"./chunk-C7G6YPKG-B8eWs7WC.js";import"./chunk-ZGVPDNZ5-CJkTHIbj.js";import"./chunk-52WLFC77-Bc3oUjd3.js";import"./chunk-FWX5IMBZ-pb5aM7v8.js";import{i as f,n as p,t as m}from"./chunk-EX3LRPZG-D1GtIwqs.js";var h=e(e=>e.append(`circle`).attr(`class`,`start-state`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit).attr(`cy`,o().state.padding+o().state.sizeUnit),`drawStartState`),g=e(e=>e.append(`line`).style(`stroke`,`grey`).style(`stroke-dasharray`,`3`).attr(`x1`,o().state.textHeight).attr(`class`,`divider`).attr(`x2`,o().state.textHeight*2).attr(`y1`,0).attr(`y2`,0),`drawDivider`),_=e((e,t)=>{let n=e.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+2*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),r=n.node().getBBox();return e.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,r.width+2*o().state.padding).attr(`height`,r.height+2*o().state.padding).attr(`rx`,o().state.radius),n},`drawSimpleState`),v=e((t,n)=>{let r=e(function(e,t,n){let r=e.append(`tspan`).attr(`x`,2*o().state.padding).text(t);n||r.attr(`dy`,o().state.textHeight)},`addTspan`),i=t.append(`text`).attr(`x`,2*o().state.padding).attr(`y`,o().state.textHeight+1.3*o().state.padding).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(n.descriptions[0]).node().getBBox(),a=i.height,s=t.append(`text`).attr(`x`,o().state.padding).attr(`y`,a+o().state.padding*.4+o().state.dividerMargin+o().state.textHeight).attr(`class`,`state-description`),c=!0,l=!0;n.descriptions.forEach(function(e){c||(r(s,e,l),l=!1),c=!1});let u=t.append(`line`).attr(`x1`,o().state.padding).attr(`y1`,o().state.padding+a+o().state.dividerMargin/2).attr(`y2`,o().state.padding+a+o().state.dividerMargin/2).attr(`class`,`descr-divider`),d=s.node().getBBox(),f=Math.max(d.width,i.width);return u.attr(`x2`,f+3*o().state.padding),t.insert(`rect`,`:first-child`).attr(`x`,o().state.padding).attr(`y`,o().state.padding).attr(`width`,f+2*o().state.padding).attr(`height`,d.height+a+2*o().state.padding).attr(`rx`,o().state.radius),t},`drawDescrState`),y=e((e,t,n)=>{let r=o().state.padding,i=2*o().state.padding,a=e.node().getBBox(),s=a.width,c=a.x,l=e.append(`text`).attr(`x`,0).attr(`y`,o().state.titleShift).attr(`font-size`,o().state.fontSize).attr(`class`,`state-title`).text(t.id),u=l.node().getBBox().width+i,d=Math.max(u,s);d===s&&(d+=i);let f,p=e.node().getBBox();t.doc,f=c-r,u>s&&(f=(s-d)/2+r),Math.abs(c-p.x)<r&&u>s&&(f=c-(u-s)/2);let m=1-o().state.textHeight;return e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,m).attr(`class`,n?`alt-composit`:`composit`).attr(`width`,d).attr(`height`,p.height+o().state.textHeight+o().state.titleShift+1).attr(`rx`,`0`),l.attr(`x`,f+r),u<=s&&l.attr(`x`,c+(d-i)/2-u/2+r),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,o().state.textHeight*3).attr(`rx`,o().state.radius),e.insert(`rect`,`:first-child`).attr(`x`,f).attr(`y`,o().state.titleShift-o().state.textHeight-o().state.padding).attr(`width`,d).attr(`height`,p.height+3+2*o().state.textHeight).attr(`rx`,o().state.radius),e},`addTitleAndBox`),b=e(e=>(e.append(`circle`).attr(`class`,`end-state-outer`).attr(`r`,o().state.sizeUnit+o().state.miniPadding).attr(`cx`,o().state.padding+o().state.sizeUnit+o().state.miniPadding).attr(`cy`,o().state.padding+o().state.sizeUnit+o().state.miniPadding),e.append(`circle`).attr(`class`,`end-state-inner`).attr(`r`,o().state.sizeUnit).attr(`cx`,o().state.padding+o().state.sizeUnit+2).attr(`cy`,o().state.padding+o().state.sizeUnit+2)),`drawEndState`),x=e((e,t)=>{let n=o().state.forkWidth,r=o().state.forkHeight;if(t.parentId){let e=n;n=r,r=e}return e.append(`rect`).style(`stroke`,`black`).style(`fill`,`black`).attr(`width`,n).attr(`height`,r).attr(`x`,o().state.padding).attr(`y`,o().state.padding)},`drawForkJoinState`),S=e((e,t,n,r)=>{let i=0,s=r.append(`text`);s.style(`text-anchor`,`start`),s.attr(`class`,`noteText`);let c=e.replace(/\r\n/g,`<br/>`);c=c.replace(/\n/g,`<br/>`);let l=c.split(a.lineBreakRegex),u=1.25*o().state.noteMargin;for(let e of l){let r=e.trim();if(r.length>0){let e=s.append(`tspan`);if(e.text(r),u===0){let t=e.node().getBBox();u+=t.height}i+=u,e.attr(`x`,t+o().state.noteMargin),e.attr(`y`,n+i+1.25*o().state.noteMargin)}}return{textWidth:s.node().getBBox().width,textHeight:i}},`_drawLongText`),C=e((e,t)=>{t.attr(`class`,`state-note`);let n=t.append(`rect`).attr(`x`,0).attr(`y`,o().state.padding),{textWidth:r,textHeight:i}=S(e,0,0,t.append(`g`));return n.attr(`height`,i+2*o().state.noteMargin),n.attr(`width`,r+o().state.noteMargin*2),n},`drawNote`),w=e(function(e,t){let n=t.id,r={id:n,label:t.id,width:0,height:0},i=e.append(`g`).attr(`id`,n).attr(`class`,`stateGroup`);t.type===`start`&&h(i),t.type===`end`&&b(i),(t.type===`fork`||t.type===`join`)&&x(i,t),t.type===`note`&&C(t.note.text,i),t.type===`divider`&&g(i),t.type==="default"&&t.descriptions.length===0&&_(i,t),t.type==="default"&&t.descriptions.length>0&&v(i,t);let a=i.node().getBBox();return r.width=a.width+2*o().state.padding,r.height=a.height+2*o().state.padding,r},`drawState`),T=0,E=e(function(n,i,u){let d=e(function(e){switch(e){case m.relationType.AGGREGATION:return`aggregation`;case m.relationType.EXTENSION:return`extension`;case m.relationType.COMPOSITION:return`composition`;case m.relationType.DEPENDENCY:return`dependency`}},`getRelationType`);i.points=i.points.filter(e=>!Number.isNaN(e.y));let f=i.points,p=l().x(function(e){return e.x}).y(function(e){return e.y}).curve(s),h=n.append(`path`).attr(`d`,p(f)).attr(`id`,`edge`+T).attr(`class`,`transition`),g=``;if(o().state.arrowMarkerAbsolute&&(g=r(!0)),h.attr(`marker-end`,`url(`+g+`#`+d(m.relationType.DEPENDENCY)+`End)`),u.title!==void 0){let e=n.append(`g`).attr(`class`,`stateLabel`),{x:r,y:s}=c.calcLabelPosition(i.points),l=a.getRows(u.title),d=0,f=[],p=0,m=0;for(let n=0;n<=l.length;n++){let i=e.append(`text`).attr(`text-anchor`,`middle`).text(l[n]).attr(`x`,r).attr(`y`,s+d),a=i.node().getBBox();p=Math.max(p,a.width),m=Math.min(m,a.x),t.info(a.x,r,s+d),d===0&&(d=i.node().getBBox().height,t.info(`Title height`,d,s)),f.push(i)}let h=d*l.length;if(l.length>1){let e=(l.length-1)*d*.5;f.forEach((t,n)=>t.attr(`y`,s+n*d-e)),h=d*l.length}let g=e.node().getBBox();e.insert(`rect`,`:first-child`).attr(`class`,`box`).attr(`x`,r-p/2-o().state.padding/2).attr(`y`,s-h/2-o().state.padding/2-3.5).attr(`width`,p+o().state.padding).attr(`height`,h+o().state.padding),t.info(g)}T++},`drawEdge`),D,O={},k=e(function(){},`setConf`),A=e(function(e){e.append(`defs`).append(`marker`).attr(`id`,`dependencyEnd`).attr(`refX`,19).attr(`refY`,7).attr(`markerWidth`,20).attr(`markerHeight`,28).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 19,7 L9,13 L14,7 L9,1 Z`)},`insertMarkers`),j=e(function(e,r,a,s){D=o().state;let c=o().securityLevel,l;c===`sandbox`&&(l=n(`#i`+r));let u=n(c===`sandbox`?l.nodes()[0].contentDocument.body:`body`),d=c===`sandbox`?l.nodes()[0].contentDocument:document;t.debug(`Rendering diagram `+e);let f=u.select(`[id='${r}']`);A(f),N(s.db.getRootDoc(),f.append(`g`).attr(`id`,r+`-root`),void 0,!1,u,d,s);let p=D.padding,m=f.node().getBBox(),h=m.width+p*2,g=m.height+p*2;i(f,g,h*1.75,D.useMaxWidth),f.attr(`viewBox`,`${m.x-D.padding} ${m.y-D.padding} `+h+` `+g)},`draw`),M=e(e=>e?e.length*D.fontSizeFactor:1,`getLabelWidth`),N=e((e,n,r,i,o,s,c)=>{let l=new u({compound:!0,multigraph:!0}),f,p=!0;for(f=0;f<e.length;f++)if(e[f].stmt===`relation`){p=!1;break}r?l.setGraph({rankdir:`LR`,multigraph:!0,compound:!0,ranker:`tight-tree`,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,isMultiGraph:!0}):l.setGraph({rankdir:`TB`,multigraph:!0,compound:!0,ranksep:p?1:D.edgeLengthFactor,nodeSep:p?1:50,ranker:`tight-tree`,isMultiGraph:!0}),l.setDefaultEdgeLabel(function(){return{}});let m=c.db.getStates(),h=c.db.getRelations(),g=Object.keys(m);for(let e of g){let t=m[e];r&&(t.parentId=r);let a;if(t.doc){let e=n.append(`g`).attr(`id`,t.id).attr(`class`,`stateGroup`);a=N(t.doc,e,t.id,!i,o,s,c);{e=y(e,t,i);let n=e.node().getBBox();a.width=n.width,a.height=n.height+D.padding/2,O[t.id]={y:D.compositTitleSize}}}else a=w(n,t,l);if(t.note){let e=w(n,{descriptions:[],id:t.id+`-note`,note:t.note,type:`note`},l);t.note.position===`left of`?(l.setNode(a.id+`-note`,e),l.setNode(a.id,a)):(l.setNode(a.id,a),l.setNode(a.id+`-note`,e)),l.setParent(a.id,a.id+`-group`),l.setParent(a.id+`-note`,a.id+`-group`)}else l.setNode(a.id,a)}t.debug(`Count=`,l.nodeCount(),l);let _=0;h.forEach(function(e){_++,t.debug(`Setting edge`,e),l.setEdge(e.id1,e.id2,{relation:e,width:M(e.title),height:D.labelHeight*a.getRows(e.title).length,labelpos:`c`},`id`+_)}),d(l),t.debug(`Graph after layout`,l.nodes());let v=n.node();l.nodes().forEach(function(e){e!==void 0&&l.node(e)!==void 0?(t.warn(`Node `+e+`: `+JSON.stringify(l.node(e))),o.select(`#`+v.id+` #`+e).attr(`transform`,`translate(`+(l.node(e).x-l.node(e).width/2)+`,`+(l.node(e).y+(O[e]?O[e].y:0)-l.node(e).height/2)+` )`),o.select(`#`+v.id+` #`+e).attr(`data-x-shift`,l.node(e).x-l.node(e).width/2),s.querySelectorAll(`#`+v.id+` #`+e+` .divider`).forEach(e=>{let t=e.parentElement,n=0,r=0;t&&(t.parentElement&&(n=t.parentElement.getBBox().width),r=parseInt(t.getAttribute(`data-x-shift`),10),Number.isNaN(r)&&(r=0)),e.setAttribute(`x1`,0-r+8),e.setAttribute(`x2`,n-r-8)})):t.debug(`No Node `+e+`: `+JSON.stringify(l.node(e)))});let b=v.getBBox();l.edges().forEach(function(e){e!==void 0&&l.edge(e)!==void 0&&(t.debug(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(l.edge(e))),E(n,l.edge(e),l.edge(e).relation))}),b=v.getBBox();let x={id:r||`root`,label:r||`root`,width:0,height:0};return x.width=b.width+2*D.padding,x.height=b.height+2*D.padding,t.debug(`Doc rendered`,x,l),x},`renderDoc`),P={parser:p,get db(){return new m(1)},renderer:{setConf:k,draw:j},styles:f,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{P as diagram};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-Cz8bXOH0.js";import"./chunk-WYO6CB5R-s6qbtyS5.js";import"./chunk-ICXQ74PX-BLkwAJRS.js";import"./chunk-HOUHSVGY-DZv73_1N.js";import"./chunk-Q4XR5HBZ-BrcuBWmp.js";import"./chunk-7BUUIJ7U-Bb538aSH.js";import"./chunk-OGEWGWER-DC6ZHIaO.js";import"./chunk-32BRIVSS-DvgtUMjH.js";import"./chunk-XXDRQBXY-DlK_iNGL.js";import"./chunk-VR4S4FIN-CxpxBT1R.js";import"./chunk-C7G6YPKG-B8eWs7WC.js";import"./chunk-ZGVPDNZ5-CJkTHIbj.js";import"./chunk-52WLFC77-Bc3oUjd3.js";import"./chunk-FWX5IMBZ-pb5aM7v8.js";import{i as t,n,r,t as i}from"./chunk-EX3LRPZG-D1GtIwqs.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};