tarsk 0.5.71 → 0.5.73

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 (172) hide show
  1. package/dist/index.js +156990 -153745
  2. package/dist/public/assets/Combination-lwI_j-mU.js +41 -0
  3. package/dist/public/assets/account-view-DKQdyGPK.js +1 -0
  4. package/dist/public/assets/alert-dialog-Cb1PEgra.js +7 -0
  5. package/dist/public/assets/api-BMo_Lz8f.js +2 -0
  6. package/dist/public/assets/async-error-boundary-J8P6NVvc.js +1 -0
  7. package/dist/public/assets/async-loading-fallback-B_JNgWJR.js +1 -0
  8. package/dist/public/assets/browser-overlay-block-CiDtkfup.js +1 -0
  9. package/dist/public/assets/browser-tab-D_GXZ93G.js +12 -0
  10. package/dist/public/assets/button-DeNw35VZ.js +1 -0
  11. package/dist/public/assets/card-B4eI0NI-.js +1 -0
  12. package/dist/public/assets/chat-dock-context-BXoAs38w.js +1 -0
  13. package/dist/public/assets/chunk-QFMPRPBF-COsSkB7x.js +3 -0
  14. package/dist/public/assets/commit-dialog-DDLaQVzY.js +1 -0
  15. package/dist/public/assets/commit-error-dialog-Cp0Aic7I.js +1 -0
  16. package/dist/public/assets/commit-method-fields-CD3PTIox.js +1 -0
  17. package/dist/public/assets/context-menu-Dx5Jy21w.js +1 -0
  18. package/dist/public/assets/conversation-history-view-JymxZFJ2.js +1 -0
  19. package/dist/public/assets/create-project-dialog-qbwqSqGU.js +6 -0
  20. package/dist/public/assets/create-project-workspace-BcIx6FNf.js +1 -0
  21. package/dist/public/assets/create-repo-dialog-DcvSMy3g.js +1 -0
  22. package/dist/public/assets/delete-confirm-dialog-C9NASyh6.js +1 -0
  23. package/dist/public/assets/dialog-Do98zzAW.js +1 -0
  24. package/dist/public/assets/diff-view-ePD0sdsW.js +4 -0
  25. package/dist/public/assets/dist-BWuYHVi8.js +2 -0
  26. package/dist/public/assets/dist-BZvmHCxP.js +5 -0
  27. package/dist/public/assets/dist-CSssbxDI.js +1 -0
  28. package/dist/public/assets/dist-CWnEmdyL.js +1 -0
  29. package/dist/public/assets/dist-CWq9XRXF.js +1 -0
  30. package/dist/public/assets/dist-CjhvxqFU.js +1 -0
  31. package/dist/public/assets/dist-DIjomljy.js +1 -0
  32. package/dist/public/assets/dist-DiMgghKn.js +1 -0
  33. package/dist/public/assets/dist-DjKXDRW7.js +1 -0
  34. package/dist/public/assets/dist-OixawqbU.js +1 -0
  35. package/dist/public/assets/dist-mdooLpmq.js +1 -0
  36. package/dist/public/assets/explorer-tab-context-BxUVwWQQ.js +1 -0
  37. package/dist/public/assets/explorer-tab-view-D6hsKrXY.js +2 -0
  38. package/dist/public/assets/explorer-tree-BG8ShRwn.js +1 -0
  39. package/dist/public/assets/explorer-view-BZcNnLd9.js +75 -0
  40. package/dist/public/assets/git-history-dialog-DWhJ1-ba.js +1 -0
  41. package/dist/public/assets/index-DhOeeft5.css +1 -0
  42. package/dist/public/assets/index-DjaVbFDB.js +3386 -0
  43. package/dist/public/assets/main-tab-context-Byl1LybL.js +1 -0
  44. package/dist/public/assets/markdown-renderer-qLede1zH.js +8 -0
  45. package/dist/public/assets/mcp-server-card-zm-ss-7h.js +1 -0
  46. package/dist/public/assets/merged-pr-dialog-Due9WdB4.js +1 -0
  47. package/dist/public/assets/model-list-controls-D86_87E4.js +1 -0
  48. package/dist/public/assets/{monaco-D1hpqXQ0.js → monaco-lJcjGRXq.js} +189 -199
  49. package/dist/public/assets/monaco-setup-DU2h1v3K.js +11 -0
  50. package/dist/public/assets/onboarding-dialog-DlqbPvG0.js +1 -0
  51. package/dist/public/assets/pending-changes-Bn-0ak1d.js +1 -0
  52. package/dist/public/assets/project-env-vars-view-N1Io1Pau.js +1 -0
  53. package/dist/public/assets/project-model-aliases-view-B4FEze4g.js +1 -0
  54. package/dist/public/assets/project-settings-view-BalZ6Fe1.js +1 -0
  55. package/dist/public/assets/project-tools-view-OnCN0jKz.js +1 -0
  56. package/dist/public/assets/providers-list-view-DXvcxXDM.js +1 -0
  57. package/dist/public/assets/pull-request-dialog-BeeTNIN_.js +1 -0
  58. package/dist/public/assets/pull-with-changes-dialog-B9y2_lt_.js +1 -0
  59. package/dist/public/assets/push-before-pr-dialog-D3pMFe9A.js +1 -0
  60. package/dist/public/assets/query-keys-5QPW6Dv-.js +1 -0
  61. package/dist/public/assets/radio-group-CU59hGiA.js +1 -0
  62. package/dist/public/assets/react-vendor-Ee0-5T4I.js +9 -0
  63. package/dist/public/assets/scroll-area-nbNFO91g.js +1 -0
  64. package/dist/public/assets/settings-general-view-CAYlYs3J.js +1 -0
  65. package/dist/public/assets/settings-instructions-view-GjQivhLy.js +1 -0
  66. package/dist/public/assets/settings-list-DU82HNPX.js +1 -0
  67. package/dist/public/assets/settings-logs-view-DnQ_4O9b.js +5 -0
  68. package/dist/public/assets/settings-mcp-servers-view-C6OZHR3K.js +5 -0
  69. package/dist/public/assets/settings-models-view-CTjnBd74.js +1 -0
  70. package/dist/public/assets/settings-rules-view-DiTC-cBE.js +8 -0
  71. package/dist/public/assets/settings-skills-view-DHoSorOw.js +3 -0
  72. package/dist/public/assets/settings-slack-view-CiuJZ-9i.js +1 -0
  73. package/dist/public/assets/settings-slash-commands-view-CnXff39A.js +1 -0
  74. package/dist/public/assets/settings-statistics-view-D8SvAGE_.js +1 -0
  75. package/dist/public/assets/settings-storage-view-CUsa7Lwv.js +1 -0
  76. package/dist/public/assets/settings-subagents-view-B4HugfzU.js +2 -0
  77. package/dist/public/assets/settings-system-prompt-view-DNQKxcFg.js +1 -0
  78. package/dist/public/assets/settings-view-DoZmXguf.js +2 -0
  79. package/dist/public/assets/skeleton-DvLd14RU.js +1 -0
  80. package/dist/public/assets/sorting-DqwxPMRN.js +1 -0
  81. package/dist/public/assets/store-BaMSfYoJ.js +9 -0
  82. package/dist/public/assets/switch-pIBaqatj.js +1 -0
  83. package/dist/public/assets/table-B3fLagUj.js +1 -0
  84. package/dist/public/assets/tasks-view-BaMd8ZM0.js +2 -0
  85. package/dist/public/assets/{terminal-panel-CiCkzKHm.js → terminal-panel-BjD6z-3y.js} +3 -3
  86. package/dist/public/assets/toggle-group-5tREtjoW.js +1 -0
  87. package/dist/public/assets/tooltip-B6ziVyTv.js +1 -0
  88. package/dist/public/assets/{use-active-dock-panel-instance-BAHb-cSH.js → use-active-dock-panel-instance-BSch6-Fx.js} +1 -1
  89. package/dist/public/assets/use-browser-overlay-block-DyprQSIG.js +1 -0
  90. package/dist/public/assets/use-deferred-search-Dgxosq55.js +1 -0
  91. package/dist/public/assets/use-installed-ai-files-E4BAFIPG.js +1 -0
  92. package/dist/public/assets/use-open-chat-dock-panel-Cr1bQYOH.js +1 -0
  93. package/dist/public/assets/use-settings-page-loading-BTySlInF.js +1 -0
  94. package/dist/public/assets/use-suspense-resource-Dkz6ddFN.js +1 -0
  95. package/dist/public/assets/use-toast-xpb5jNtN.js +1 -0
  96. package/dist/public/assets/useInfiniteQuery-DUeUxDcu.js +1 -0
  97. package/dist/public/assets/utils-CT-Dw22R.js +1 -0
  98. package/dist/public/assets/{web-CkSlG6TA.js → web-BKpP7kYB.js} +1 -1
  99. package/dist/public/assets/{web-2RomPZ8n.js → web-CtDn8Ggo.js} +1 -1
  100. package/dist/public/assets/{web-DGsiH272.js → web-DaiDQ9WA.js} +1 -1
  101. package/dist/public/assets/{web-BRo_4CM5.js → web-W5CC9Cq4.js} +1 -1
  102. package/dist/public/index.html +37 -19
  103. package/dist/recommended-models.txt +2 -2
  104. package/package.json +4 -4
  105. package/dist/public/assets/account-view-P4Y5-Gf7.js +0 -1
  106. package/dist/public/assets/alert-dialog-CQsuxtcP.js +0 -1
  107. package/dist/public/assets/async-error-boundary-DajcyqVg.js +0 -1
  108. package/dist/public/assets/browser-tab-DLvnuyhT.js +0 -12
  109. package/dist/public/assets/card-BDQUHsPD.js +0 -1
  110. package/dist/public/assets/chat-dock-context-CUdrQKFm.js +0 -1
  111. package/dist/public/assets/commit-dialog-C98fYJ1d.js +0 -1
  112. package/dist/public/assets/commit-error-dialog-DjFWRUYh.js +0 -1
  113. package/dist/public/assets/commit-method-fields-CPKi4MLF.js +0 -1
  114. package/dist/public/assets/context-menu-D4UmleM5.js +0 -1
  115. package/dist/public/assets/conversation-history-view-CFq844ge.js +0 -1
  116. package/dist/public/assets/create-project-dialog-Du4yuSgt.js +0 -6
  117. package/dist/public/assets/create-project-workspace-Cw58bBNY.js +0 -1
  118. package/dist/public/assets/create-repo-dialog-DaCI6QrX.js +0 -1
  119. package/dist/public/assets/delete-confirm-dialog-V9X76h-2.js +0 -1
  120. package/dist/public/assets/diff-view-CzWiyJDW.js +0 -4
  121. package/dist/public/assets/explorer-tab-context-BdjTEbFh.js +0 -1
  122. package/dist/public/assets/explorer-tab-view-BbukFEig.js +0 -2
  123. package/dist/public/assets/explorer-tree-CKwkrTpU.js +0 -1
  124. package/dist/public/assets/explorer-view-DxvRAs1j.js +0 -75
  125. package/dist/public/assets/git-history-dialog-BIl7cN5L.js +0 -1
  126. package/dist/public/assets/index-BH6Ht-w_.js +0 -3356
  127. package/dist/public/assets/index-DpGlIV5v.css +0 -1
  128. package/dist/public/assets/interactive-BrHVRHmQ.js +0 -21
  129. package/dist/public/assets/main-tab-context-zQSuRQQG.js +0 -1
  130. package/dist/public/assets/markdown-renderer-BcGbfUdk.js +0 -8
  131. package/dist/public/assets/mcp-server-card-D8gWLGuB.js +0 -1
  132. package/dist/public/assets/merged-pr-dialog-BcMvxAAS.js +0 -1
  133. package/dist/public/assets/model-list-controls-8f6YNzoF.js +0 -1
  134. package/dist/public/assets/monaco-setup-B_kQVsDW.js +0 -1
  135. package/dist/public/assets/onboarding-CQV3cOCc.js +0 -46
  136. package/dist/public/assets/project-env-vars-view-DHLrARmp.js +0 -1
  137. package/dist/public/assets/project-model-aliases-view-NaGeOnLB.js +0 -1
  138. package/dist/public/assets/project-settings-view-DYx0Ejz_.js +0 -1
  139. package/dist/public/assets/project-tools-view-Dwh-9yLK.js +0 -1
  140. package/dist/public/assets/providers-list-view-BgHPRsyZ.js +0 -1
  141. package/dist/public/assets/pull-request-dialog-jiDTjl9S.js +0 -1
  142. package/dist/public/assets/pull-with-changes-dialog-tz5BKYLX.js +0 -1
  143. package/dist/public/assets/push-before-pr-dialog-CsCEcu3D.js +0 -1
  144. package/dist/public/assets/query-keys-CbACxUOr.js +0 -1
  145. package/dist/public/assets/react-vendor-CVjuv5OI.js +0 -22
  146. package/dist/public/assets/settings-general-view-DFuR-GEd.js +0 -1
  147. package/dist/public/assets/settings-instructions-view-DyHQ7P84.js +0 -1
  148. package/dist/public/assets/settings-list-CqAk8BOe.js +0 -1
  149. package/dist/public/assets/settings-logs-view-NuI1wC43.js +0 -5
  150. package/dist/public/assets/settings-mcp-servers-view-CzbsCA0X.js +0 -5
  151. package/dist/public/assets/settings-models-view-DC-v64Ua.js +0 -1
  152. package/dist/public/assets/settings-rules-view-F1cdLdbY.js +0 -8
  153. package/dist/public/assets/settings-skills-view-Ba8LIeWY.js +0 -3
  154. package/dist/public/assets/settings-slack-view-DQUSFcUo.js +0 -1
  155. package/dist/public/assets/settings-slash-commands-view-BRBxLk4J.js +0 -1
  156. package/dist/public/assets/settings-statistics-view-4uiJ9rwT.js +0 -1
  157. package/dist/public/assets/settings-storage-view-CuAI5fWL.js +0 -1
  158. package/dist/public/assets/settings-subagents-view-pSxxHmFV.js +0 -2
  159. package/dist/public/assets/settings-system-prompt-view-CrFpAHz1.js +0 -1
  160. package/dist/public/assets/settings-view-_YIXCuoG.js +0 -2
  161. package/dist/public/assets/skeleton-CJSNEi3C.js +0 -1
  162. package/dist/public/assets/store-fffs6-y9.js +0 -8
  163. package/dist/public/assets/table-Cb2C1rQy.js +0 -1
  164. package/dist/public/assets/tasks-view-f5xX4AVx.js +0 -2
  165. package/dist/public/assets/ui-components-DioWsrht.js +0 -1
  166. package/dist/public/assets/use-deferred-search-0sV7mSzX.js +0 -1
  167. package/dist/public/assets/use-installed-ai-files-D7Y1gZYc.js +0 -1
  168. package/dist/public/assets/use-open-chat-dock-panel-zpT9rr8C.js +0 -1
  169. package/dist/public/assets/use-settings-page-loading-BU2CDnfE.js +0 -1
  170. package/dist/public/assets/use-suspense-resource-BxOFFoEK.js +0 -1
  171. package/dist/public/assets/use-toast-hxHsVv6a.js +0 -1
  172. package/dist/public/assets/utils-SsF94Pkg.js +0 -1
@@ -0,0 +1,11 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t}from"./react-vendor-Ee0-5T4I.js";import{a as n,i as r,n as i,o as a,r as o,t as s}from"./monaco-lJcjGRXq.js";function c(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function l(e){if(Array.isArray(e))return e}function u(e,t,n){return(t=y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function f(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?p(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t){if(e==null)return{};var n,r,i=g(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function _(e,t){return l(e)||d(e,t)||b(e,t)||f()}function v(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function y(e){var t=v(e,`string`);return typeof t==`symbol`?t:t+``}function b(e,t){if(e){if(typeof e==`string`)return c(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?S(Object(n),!0).forEach(function(t){x(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function T(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function E(e){return{}.toString.call(e).includes(`Object`)}function D(e){return!Object.keys(e).length}function O(e){return typeof e==`function`}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function A(e,t){return E(t)||F(`changeType`),Object.keys(t).some(function(t){return!k(e,t)})&&F(`changeField`),t}function j(e){O(e)||F(`selectorType`)}function M(e){O(e)||E(e)||F(`handlerType`),E(e)&&Object.values(e).some(function(e){return!O(e)})&&F(`handlersType`)}function N(e){e||F(`initialIsRequired`),E(e)||F(`initialType`),D(e)&&F(`initialContent`)}function P(e,t){throw Error(e[t]||e.default)}var F=T(P)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),I={changes:A,selector:j,handler:M,initial:N};function ee(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};I.initial(e),I.handler(t);var n={current:e},r=T(re)(n,t),i=T(ne)(n),a=T(I.changes)(e),o=T(te)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return I.selector(e),e(n.current)}function c(e){w(r,i,a,o)(e)}return[s,c]}function te(e,t){return O(t)?t(e.current):t}function ne(e,t){return e.current=C(C({},e.current),t),t}function re(e,t,n){return O(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var ie={create:ee},ae={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function oe(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function se(e){return{}.toString.call(e).includes(`Object`)}function ce(e){return e||R(`configIsRequired`),se(e)||R(`configType`),e.urls?(le(),{paths:{vs:e.urls.monacoBase}}):e}function le(){console.warn(L.deprecation)}function ue(e,t){throw Error(e[t]||e.default)}var L={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
+ You are using deprecated way of configuration.
4
+
5
+ Instead of using
6
+ monaco.config({ urls: { monacoBase: '...' } })
7
+ use
8
+ monaco.config({ paths: { vs: '...' } })
9
+
10
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
+ `},R=oe(ue)(L),de={config:ce},fe=function(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}};function z(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],z(e[n],t[n]))}),m(m({},e),t)}var pe={type:`cancelation`,msg:`operation is manually canceled`};function B(e){var t=!1,n=new Promise(function(n,r){e.then(function(e){return t?r(pe):n(e)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var me=[`monaco`],V=_(ie.create({config:ae,isInitialized:!1,resolve:null,reject:null,monaco:null}),2),H=V[0],U=V[1];function he(e){var t=de.config(e),n=t.monaco,r=h(t,me);U(function(e){return{config:z(e.config,r),monaco:n}})}function ge(){var e=H(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(U({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),B(G);if(window.monaco&&window.monaco.editor)return W(window.monaco),e.resolve(window.monaco),B(G);fe(_e,ye)(be)}return B(G)}function _e(e){return document.body.appendChild(e)}function ve(e){var t=document.createElement(`script`);return e&&(t.src=e),t}function ye(e){var t=H(function(e){return{config:e.config,reject:e.reject}}),n=ve(`${t.config.paths.vs}/loader.js`);return n.onload=function(){return e()},n.onerror=t.reject,n}function be(){var e=H(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t([`vs/editor/editor.main`],function(t){var n=t.m||t;W(n),e.resolve(n)},function(t){e.reject(t)})}function W(e){H().monaco||U({monaco:e})}function xe(){return H(function(e){return e.monaco})}var G=new Promise(function(e,t){return U({resolve:e,reject:t})}),K={config:he,init:ge,__getMonacoInstance:xe},q=e(t(),1),J={wrapper:{display:`flex`,position:`relative`,textAlign:`initial`},fullWidth:{width:`100%`},hide:{display:`none`}},Se={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}};function Ce({children:e}){return q.createElement(`div`,{style:Se.container},e)}var we=Ce;function Te({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:a,wrapperProps:o}){return q.createElement(`section`,{style:{...J.wrapper,width:e,height:t},...o},!n&&q.createElement(we,null,r),q.createElement(`div`,{ref:i,style:{...J.fullWidth,...!n&&J.hide},className:a}))}var Ee=(0,q.memo)(Te);function De(e){(0,q.useEffect)(e,[])}var Oe=De;function ke(e,t,n=!0){let r=(0,q.useRef)(!0);(0,q.useEffect)(r.current||!n?()=>{r.current=!1}:e,t)}var Y=ke;function X(){}function Z(e,t,n,r){return Ae(e,r)||je(e,t,n,r)}function Ae(e,t){return e.editor.getModel(Q(e,t))}function je(e,t,n,r){return e.editor.createModel(t,n,r?Q(e,r):void 0)}function Q(e,t){return e.Uri.parse(t)}function Me({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:c=!1,theme:l=`light`,loading:u=`Loading...`,options:d={},height:f=`100%`,width:p=`100%`,className:m,wrapperProps:h={},beforeMount:g=X,onMount:_=X}){let[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!0),S=(0,q.useRef)(null),C=(0,q.useRef)(null),w=(0,q.useRef)(null),T=(0,q.useRef)(_),E=(0,q.useRef)(g),D=(0,q.useRef)(!1);Oe(()=>{let e=K.init();return e.then(e=>(C.current=e)&&x(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>S.current?A():e.cancel()}),Y(()=>{if(S.current&&C.current){let t=S.current.getOriginalEditor(),i=Z(C.current,e||``,r||n||`text`,a||``);i!==t.getModel()&&t.setModel(i)}},[a],v),Y(()=>{if(S.current&&C.current){let e=S.current.getModifiedEditor(),r=Z(C.current,t||``,i||n||`text`,o||``);r!==e.getModel()&&e.setModel(r)}},[o],v),Y(()=>{let e=S.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||``):t!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:t||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[t],v),Y(()=>{S.current?.getModel()?.original.setValue(e||``)},[e],v),Y(()=>{let{original:e,modified:t}=S.current.getModel();C.current.editor.setModelLanguage(e,r||n||`text`),C.current.editor.setModelLanguage(t,i||n||`text`)},[n,r,i],v),Y(()=>{C.current?.editor.setTheme(l)},[l],v),Y(()=>{S.current?.updateOptions(d)},[d],v);let O=(0,q.useCallback)(()=>{if(!C.current)return;E.current(C.current);let s=Z(C.current,e||``,r||n||`text`,a||``),c=Z(C.current,t||``,i||n||`text`,o||``);S.current?.setModel({original:s,modified:c})},[n,t,i,e,r,a,o]),k=(0,q.useCallback)(()=>{!D.current&&w.current&&(S.current=C.current.editor.createDiffEditor(w.current,{automaticLayout:!0,...d}),O(),C.current?.editor.setTheme(l),y(!0),D.current=!0)},[d,l,O]);(0,q.useEffect)(()=>{v&&T.current(S.current,C.current)},[v]),(0,q.useEffect)(()=>{!b&&!v&&k()},[b,v,k]);function A(){let e=S.current?.getModel();s||e?.original?.dispose(),c||e?.modified?.dispose(),S.current?.dispose()}return q.createElement(Ee,{width:p,height:f,isEditorReady:v,loading:u,_ref:w,className:m,wrapperProps:h})}var Ne=(0,q.memo)(Me);function Pe(e){let t=(0,q.useRef)();return(0,q.useEffect)(()=>{t.current=e},[e]),t.current}var Fe=Pe,$=new Map;function Ie({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:a,theme:o=`light`,line:s,loading:c=`Loading...`,options:l={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p=`100%`,height:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=X,onMount:v=X,onChange:y,onValidate:b=X}){let[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(!0),T=(0,q.useRef)(null),E=(0,q.useRef)(null),D=(0,q.useRef)(null),O=(0,q.useRef)(v),k=(0,q.useRef)(_),A=(0,q.useRef)(),j=(0,q.useRef)(r),M=Fe(a),N=(0,q.useRef)(!1),P=(0,q.useRef)(!1);Oe(()=>{let e=K.init();return e.then(e=>(T.current=e)&&w(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>E.current?I():e.cancel()}),Y(()=>{let o=Z(T.current,e||r||``,t||i||``,a||n||``);o!==E.current?.getModel()&&(d&&$.set(M,E.current?.saveViewState()),E.current?.setModel(o),d&&E.current?.restoreViewState($.get(a)))},[a],x),Y(()=>{E.current?.updateOptions(l)},[l],x),Y(()=>{!E.current||r===void 0||(E.current.getOption(T.current.editor.EditorOption.readOnly)?E.current.setValue(r):r!==E.current.getValue()&&(P.current=!0,E.current.executeEdits(``,[{range:E.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),E.current.pushUndoStop(),P.current=!1))},[r],x),Y(()=>{let e=E.current?.getModel();e&&i&&T.current?.editor.setModelLanguage(e,i)},[i],x),Y(()=>{s!==void 0&&E.current?.revealLine(s)},[s],x),Y(()=>{T.current?.editor.setTheme(o)},[o],x);let F=(0,q.useCallback)(()=>{if(!(!D.current||!T.current)&&!N.current){k.current(T.current);let c=a||n,f=Z(T.current,r||e||``,t||i||``,c||``);E.current=T.current?.editor.create(D.current,{model:f,automaticLayout:!0,...l},u),d&&E.current.restoreViewState($.get(c)),T.current.editor.setTheme(o),s!==void 0&&E.current.revealLine(s),S(!0),N.current=!0}},[e,t,n,r,i,a,l,u,d,o,s]);(0,q.useEffect)(()=>{x&&O.current(E.current,T.current)},[x]),(0,q.useEffect)(()=>{!C&&!x&&F()},[C,x,F]),j.current=r,(0,q.useEffect)(()=>{x&&y&&(A.current?.dispose(),A.current=E.current?.onDidChangeModelContent(e=>{P.current||y(E.current.getValue(),e)}))},[x,y]),(0,q.useEffect)(()=>{if(x){let e=T.current.editor.onDidChangeMarkers(e=>{let t=E.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=T.current.editor.getModelMarkers({resource:t});b?.(e)}});return()=>{e?.dispose()}}return()=>{}},[x,b]);function I(){A.current?.dispose(),f?d&&$.set(a,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return q.createElement(Ee,{width:p,height:m,isEditorReady:x,loading:c,_ref:D,className:h,wrapperProps:g})}var Le=(0,q.memo)(Ie);function Re(e){return e===`json`?new i:e===`css`||e===`scss`||e===`less`?new r:e===`html`||e===`handlebars`||e===`razor`?new o:e===`typescript`||e===`javascript`?new s:new n}globalThis.MonacoEnvironment={getWorker(e,t){return Re(t)}},K.config({monaco:a});export{Ne as n,Le as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{G as i,S as a,ot as o}from"./dist-BWuYHVi8.js";import{An as s,Bn as c,Et as l,Ln as u,Tn as d,dn as f,gn as p,q as m}from"./dist-DIjomljy.js";import{n as h,t as g}from"./utils-CT-Dw22R.js";import{t as _}from"./button-DeNw35VZ.js";import{G as v,V as y,h as b,jt as x,kt as S,s as C,vn as w,yn as T}from"./api-BMo_Lz8f.js";import{i as E,n as D,r as O,t as k}from"./tooltip-B6ziVyTv.js";import{n as A}from"./scroll-area-nbNFO91g.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-Do98zzAW.js";import{Ct as L,Ft as R,On as z,Pn as B,Pt as V,St as H,Tt as U,o as W,pn as G,wt as K,xt as ee,yt as q}from"./index-DjaVbFDB.js";import{n as J,t as Y}from"./toggle-group-5tREtjoW.js";import{t as te}from"./sorting-DqwxPMRN.js";import{t as ne}from"./pending-changes-Bn-0ak1d.js";function re(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function ie(e){return[G(e.id),e.name,re(e.name)]}function ae(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return ie(e).some(e=>n.has(e.toLowerCase()))}function oe(e,t){return e.filter(e=>ae(e,t)).map(e=>e.id)}var X=t(),Z=e(n(),1),Q=r(),se=a(`app.model-selector.ui`),ce=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`;function le({provider:e,onModelsChange:t,isLoading:n,disabled:r,displayMode:i=`grid`,autoSelectRecommended:a=!1}){let[s,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(new Set),[_,y]=(0,Z.useState)(new Set),[b,S]=(0,Z.useState)(new Map),[C,w]=(0,Z.useState)(!1),[T,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`alphabetical`);(0,Z.useEffect)(()=>{N()},[e]);let N=async()=>{w(!0),A(``),M(`alphabetical`);try{let t=await v(e);u(t.models);let n=new Set(t.enabledModelIds);f(n);let r=new Map,i=new Set;if(a)try{let{models:e}=await x();i=new Set(oe(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){se.error(`Failed to load recommended models:`,e)}y(i),S(r),P(n,r,t.models)}catch(t){se.error(`Failed to load models for ${e}:`,t),u([]),f(new Set),y(new Set)}finally{w(!1)}},P=(e,n,r=s)=>{let i=new Set(e);r.forEach(e=>{n.has(e.id)&&(n.get(e.id)?i.add(e.id):i.delete(e.id))}),t?.(i)},F=e=>{S(t=>{let n=ne(t,e,d);return P(d,n),n})},I=e=>{S(t=>{let n=new Map(t);return s.forEach(t=>{let r=d.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),P(d,n),n})},L=e=>G(e.id);function z(e,t=b){let n=t.has(e),r=t.get(e);return n?!!r:d.has(e)}let B=te({models:s,query:T,sortBy:j,getDisplayName:L,getPriority:e=>+!z(e.id)}),V=j===`alphabetical`?`alphabetical`:`price`;function H(e){if(e===`alphabetical`){M(`alphabetical`);return}e===`price`&&M(`price-low`)}function U(){j!==`alphabetical`&&M(e=>e===`price-low`?`price-high`:`price-low`)}return C||n?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):s.length===0?(0,Q.jsx)(`div`,{className:`text-center py-8`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`No models available for this provider.`})}):i===`compact`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:g(`flex items-center justify-between gap-3`,r&&`opacity-25`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(W,{id:`select-all-models`,disabled:r,checked:s.every(e=>z(e.id)),onCheckedChange:e=>I(e===!0)}),(0,Q.jsx)(`label`,{htmlFor:`select-all-models`,className:g(o.body,`cursor-pointer`),children:`Select all models`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[(0,Q.jsx)(m,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,Q.jsx)(R,{placeholder:`Search models...`,value:T,onChange:e=>A(e.target.value),disabled:r,className:`pl-8 h-9`})]}),(0,Q.jsxs)(Y,{type:`single`,value:V,onValueChange:H,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,Q.jsx)(J,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:r,className:ce,children:(0,Q.jsx)(c,{className:`h-4 w-4`})}),(0,Q.jsx)(J,{value:`price`,"aria-label":`Sort by price`,disabled:r,className:ce,onClick:U,children:(0,Q.jsx)(p,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 overflow-hidden rounded-md border border-table-border`,children:B.length===0?(0,Q.jsx)(`div`,{className:`text-center py-4`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:T?`No models match your search.`:`No models available.`})}):B.map(e=>{let t=z(e.id),n=e.pricing,i=t&&_.has(e.id);return(0,Q.jsxs)(k,{children:[(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:g(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default`,r&&`opacity-25`),children:[(0,Q.jsx)(W,{id:e.id,disabled:r,checked:t??!1,onCheckedChange:()=>F(e.id),className:`mt-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:e.id,className:g(o.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[L(e),i&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,Q.jsx)(`span`,{className:g(o.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${h(n.prompt??0)} in | ${h(n.completion??0)} out`})]})]})}),e.description&&(0,Q.jsx)(D,{side:`top`,className:`max-w-xs`,children:(0,Q.jsx)(`p`,{className:o.body,children:e.description})})]},e.id)})})})]}):null}var $=a(`app.onboarding-dialog.ui`);function ue(e){let t=(0,X.c)(26),{currentStep:n}=e,r=e=>e===`provider-selection`&&n===`provider-selection`||n===`model-selection`,i=e=>n===e,a=i(`git-check`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,s;t[0]===a?s=t[1]:(s=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,a),t[0]=a,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`div`,{className:s,children:`1`}),t[2]=s,t[3]=c);let l=r(`provider-selection`)?`bg-primary`:`bg-muted`,u;t[4]===l?u=t[5]:(u=g(`h-0.5 flex-1`,l),t[4]=l,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,Q.jsx)(`div`,{className:u}),t[6]=u,t[7]=d);let f=i(`provider-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,p;t[8]===f?p=t[9]:(p=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,f),t[8]=f,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`div`,{className:p,children:`2`}),t[10]=p,t[11]=m);let h=r(`model-selection`)?`bg-primary`:`bg-muted`,_;t[12]===h?_=t[13]:(_=g(`h-0.5 flex-1`,h),t[12]=h,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,Q.jsx)(`div`,{className:_}),t[14]=_,t[15]=v);let y=i(`model-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,b;t[16]===y?b=t[17]:(b=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,y),t[16]=y,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`div`,{className:b,children:`3`}),t[18]=b,t[19]=x);let S;return t[20]!==v||t[21]!==x||t[22]!==c||t[23]!==d||t[24]!==m?(S=(0,Q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[c,d,m,v,x]}),t[20]=v,t[21]=x,t[22]=c,t[23]=d,t[24]=m,t[25]=S):S=t[25],S}function de(e){let t=(0,X.c)(3),{currentStep:n}=e;if(n===`provider-selection`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select an AI Provider`}),(0,Q.jsx)(M,{children:`Choose your preferred AI provider and enter your API key.`})]}),t[0]=e):e=t[0],e}if(n===`model-selection`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select Models`}),(0,Q.jsx)(M,{children:`Choose which models you want to use with this provider.`})]}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Let's get started`}),(0,Q.jsx)(M,{children:`First, we need to check that Git is installed on your system.`})]}),t[2]=r):r=t[2],r}function fe(e){let t=(0,X.c)(7),{gitLoading:n,gitInstalled:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(z,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,Q.jsx)(s,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:g(o.label,`text-green-900`),children:`Git is installed`}),(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}),t[1]=e):e=t[1],e}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(d,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),t[2]=i):i=t[2];let a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`p`,{className:o.label,children:`Git is not installed`}),c=(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),t[3]=a,t[4]=c):(a=t[3],c=t[4]);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(o.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),t[5]=u):u=t[5];let p;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(z,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[i,(0,Q.jsxs)(`div`,{className:`flex-1`,children:[a,c,(0,Q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:u,children:[`Download Git `,(0,Q.jsx)(f,{className:`h-3 w-3`})]})]})]}),t[6]=p):p=t[6],p}function pe(e){let t=(0,X.c)(16),{selectedProvider:n,onProviderChange:r,apiKey:a,onApiKeyChange:s,validatingKey:c,providerEnvValues:l,onProviderEnvChange:u,keyError:d}=e,f;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==n||t[4]!==c?(f=(0,Q.jsx)(q,{selectedProvider:n,onProviderChange:r,showApiKeyInput:!0,apiKey:a,onApiKeyChange:s,variant:`dropdown`,isLoading:c}),t[0]=a,t[1]=s,t[2]=r,t[3]=n,t[4]=c,t[5]=f):f=t[5];let p;t[6]!==u||t[7]!==l||t[8]!==n?(p=n&&L(n).map(e=>(0,Q.jsx)(B,{label:(0,Q.jsx)(V,{htmlFor:e,children:H(e)}),control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{id:e,value:l[e]??``,onChange:t=>u(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:i(n.slug)&&e===`LOCAL_API_URL`?n.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),n.slug===`azure`&&e===K(n)||i(n.slug)&&e===`LOCAL_API_URL`?(0,Q.jsx)(`p`,{className:g(o.bodyMuted,`mt-2 break-all`),children:U(n,l)||n.api}):null]}),align:`start`},e)),t[6]=u,t[7]=l,t[8]=n,t[9]=p):p=t[9];let m;t[10]===d?m=t[11]:(m=d&&(0,Q.jsx)(z,{variant:`error`,className:`mb-0`,children:d}),t[10]=d,t[11]=m);let h;return t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[f,p,m]}),t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function me(e){let t=(0,X.c)(4),{providerSlug:n,modelsLoading:r,onModelsChange:i}=e,a;return t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(le,{provider:n,isLoading:r,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:i})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3],a}function he(e){let t=(0,X.c)(32),{currentStep:n,savingOnboarding:r,gitLoading:i,validatingKey:a,apiKey:o,hasProvider:c,onSkip:d,onBack:f,onContinue:p,onValidate:m,onFinish:h}=e,g;t[0]!==n||t[1]!==d||t[2]!==r?(g=n===`provider-selection`&&(0,Q.jsx)(_,{variant:`ghost`,onClick:d,disabled:r,children:`Skip for now`}),t[0]=n,t[1]=d,t[2]=r,t[3]=g):g=t[3];let v;t[4]===g?v=t[5]:(v=(0,Q.jsx)(`div`,{children:g}),t[4]=g,t[5]=v);let y;t[6]!==n||t[7]!==f||t[8]!==r?(y=n!==`git-check`&&(0,Q.jsx)(_,{variant:`outline`,onClick:f,disabled:r,children:`Back`}),t[6]=n,t[7]=f,t[8]=r,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==i||t[12]!==p?(b=n===`git-check`&&(0,Q.jsxs)(_,{onClick:p,disabled:i,className:`gap-2`,children:[`Continue `,(0,Q.jsx)(u,{className:`h-4 w-4`})]}),t[10]=n,t[11]=i,t[12]=p,t[13]=b):b=t[13];let x;t[14]!==o||t[15]!==n||t[16]!==c||t[17]!==m||t[18]!==a?(x=n===`provider-selection`&&(0,Q.jsx)(_,{onClick:m,disabled:a||!o.trim()||!c,className:`gap-2`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Next `,(0,Q.jsx)(u,{className:`h-4 w-4`})]})}),t[14]=o,t[15]=n,t[16]=c,t[17]=m,t[18]=a,t[19]=x):x=t[19];let S;t[20]!==n||t[21]!==h||t[22]!==r?(S=n===`model-selection`&&(0,Q.jsx)(_,{onClick:h,disabled:r,className:`gap-2`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Finish `,(0,Q.jsx)(s,{className:`h-4 w-4`})]})}),t[20]=n,t[21]=h,t[22]=r,t[23]=S):S=t[23];let C;t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[y,b,x,S]}),t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,Q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,Q.jsxs)(j,{className:`flex items-center justify-between`,children:[v,C]})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w}function ge({open:e,onOpenChange:t,onComplete:n}){let[r,i]=(0,Z.useState)(`git-check`),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)({}),[_,x]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(new Set),[j,M]=(0,Z.useState)(!1),[F,R]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&r===`git-check`&&z()},[e,r]),(0,Z.useEffect)(()=>{e&&r===`provider-selection`&&l.length===0&&B()},[e,r,l.length]),(0,Z.useEffect)(()=>{e&&r===`model-selection`&&d&&V()},[e,r,d]);let z=async()=>{c(!0);try{let e=await C();o(e.gitInstalled),e.gitInstalled&&i(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),o(!1)}finally{c(!1)}},B=async()=>{try{let e=await S();if(u(e),e.length>0&&!d){let t=ee(e);t&&(f(t),m(t.apiKey??``),g(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},V=async()=>{if(d){M(!0);try{await v(d.name),k(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{M(!1)}}},U=async()=>{if(!d||!p.trim()){D(`Please enter an API key`);return}let e=L(d),t=e.find(e=>!h[e]?.trim());if(t){D(`Please enter ${H(t)}`);return}x(!0),D(``);try{e.length>0&&await w(Object.fromEntries(e.map(e=>[e,h[e].trim()]))),await T(d.slug,p),i(`model-selection`)}catch(e){D(e instanceof Error?e.message:`Failed to validate API key`)}finally{x(!1)}},W=async()=>{if(d){R(!0);try{for(let e of O)await y(d.slug,e);await b(),n?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{R(!1)}}},G=async()=>{R(!0);try{await b(),n?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{R(!1)}},K=e=>{f(e),m(e.apiKey??``),g(e.envValues??{}),D(``)},q=(e,t)=>{g(n=>({...n,[e]:t}))},J=()=>{i(`provider-selection`)};function Y(){r===`provider-selection`?i(`git-check`):r===`model-selection`&&i(`provider-selection`)}return(0,Q.jsx)(I,{open:e,onOpenChange:t,children:(0,Q.jsxs)(P,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,Q.jsx)(ue,{currentStep:r}),(0,Q.jsx)(N,{children:(0,Q.jsx)(de,{currentStep:r})})]}),(0,Q.jsx)(A,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`px-6 py-4`,children:[r===`git-check`&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(fe,{gitLoading:s,gitInstalled:a})}),r===`provider-selection`&&(0,Q.jsx)(pe,{selectedProvider:d,onProviderChange:K,apiKey:p,onApiKeyChange:m,validatingKey:_,providerEnvValues:h,onProviderEnvChange:q,keyError:E}),r===`model-selection`&&d&&(0,Q.jsx)(me,{providerSlug:d.slug,modelsLoading:j,onModelsChange:k})]})}),(0,Q.jsx)(he,{currentStep:r,savingOnboarding:F,gitLoading:s,validatingKey:_,apiKey:p,hasProvider:!!d,onSkip:()=>void G(),onBack:Y,onContinue:J,onValidate:()=>void U(),onFinish:()=>void W()})]})})}export{ge as OnboardingDialog,ge as default};
@@ -0,0 +1 @@
1
+ function e(e,t,n){let r=new Map(e),i=n.has(t),a=r.has(t),o=r.get(t),s=!(a?o:i);return s===i?r.delete(t):r.set(t,s),r}export{e as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{L as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,ln as c,un as l,y as u}from"./dist-DIjomljy.js";import{t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./button-DeNw35VZ.js";import{Ln as p,xt as m}from"./api-BMo_Lz8f.js";import{t as h}from"./use-toast-xpb5jNtN.js";import{Bn as g,Ft as _,In as v,Ln as y,Nn as b,kn as x}from"./index-DjaVbFDB.js";import{t as S}from"./use-settings-page-loading-BTySlInF.js";var C=t(),w=e(n(),1),T=r();function E(e){let t=(0,C.c)(20),{entry:n,index:r,loading:i,onValueChange:o}=e,s=a(n.name),[u,p]=(0,w.useState)(!1),m=n.value.length>0||n.hasExistingValue,h=n.hasExistingValue&&!n.value?`••••••••`:`value`;(0,w.useEffect)(()=>{s||p(!1)},[s]);let g=_,v=s&&!u?`password`:`text`,y=n.value,b;t[0]!==r||t[1]!==o?(b=e=>o(r,e.target.value),t[0]=r,t[1]=o,t[2]=b):b=t[2];let x=d(`font-mono`,s&&`pr-10`),S;t[3]!==g||t[4]!==n.value||t[5]!==i||t[6]!==h||t[7]!==v||t[8]!==b||t[9]!==x?(S=(0,T.jsx)(g,{type:v,placeholder:h,value:y,onChange:b,className:x,disabled:i}),t[3]=g,t[4]=n.value,t[5]=i,t[6]=h,t[7]=v,t[8]=b,t[9]=x,t[10]=S):S=t[10];let E;t[11]!==m||t[12]!==s||t[13]!==i||t[14]!==p||t[15]!==u?(E=s?(0,T.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 h-8 w-8 -translate-y-1/2 p-0`,onClick:()=>p(D),disabled:i||!m,children:u?(0,T.jsx)(l,{className:`h-4 w-4 text-muted-foreground`}):(0,T.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})}):null,t[11]=m,t[12]=s,t[13]=i,t[14]=p,t[15]=u,t[16]=E):E=t[16];let O;return t[17]!==S||t[18]!==E?(O=(0,T.jsxs)(`div`,{className:`relative flex-1`,children:[S,E]}),t[17]=S,t[18]=E,t[19]=O):O=t[19],O}function D(e){return!e}function O({projectId:e}){let t=i(),[n,r]=(0,w.useState)([]),[a,c]=(0,w.useState)([]),[l,d]=(0,w.useState)(!0),[C,D]=(0,w.useState)(!1),O=(0,w.useCallback)(async()=>{if(!e){d(!1);return}d(!0);try{let t=(await m(e)).vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0}));r(t),c(t)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load environment variables`,variant:`destructive`})}finally{d(!1)}},[e]);(0,w.useLayoutEffect)(()=>{e&&d(!0)},[e]),(0,w.useEffect)(()=>{O()},[O]);let k=S(e,[l]);function A(){r(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function j(e,t){r(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function M(e,t){r(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function N(e){r(t=>t.filter((t,n)=>n!==e))}function P(){if(n.length!==a.length)return!0;for(let e=0;e<n.length;e+=1){let t=n[e],r=a[e];if(!r||t.name!==r.name||t.value!==r.value||t.hasExistingValue!==r.hasExistingValue)return!0}return!1}async function F(){if(!(!e||!P())){D(!0);try{let r=n.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),i=r.find((e,t)=>r.findIndex(t=>t.name===e.name)!==t);if(i)throw Error(`Duplicate environment variable name: ${i.name}`);let a=r.find(e=>!e.hasExistingValue&&!e.value.trim());if(a)throw Error(`Value is required for environment variable: ${a.name}`);await p(e,r.map(e=>({name:e.name,value:e.value.trim()||void 0}))),c(n.map(e=>({...e,value:``}))),await O(),t(`/`)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to save environment variables`,variant:`destructive`})}finally{D(!1)}}}return e?(0,T.jsx)(b,{loading:k,children:(0,T.jsxs)(g,{className:`shrink-0`,children:[(0,T.jsx)(x,{title:`Environment Variables`,description:`Encrypted in Tarsk and injected for bash commands and MCP tools.`,action:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,onClick:A,disabled:l,children:`Add variable`}),(0,T.jsx)(f,{onClick:()=>void F(),disabled:C||l,children:C?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})]}),sticky:!1}),(0,T.jsx)(y,{className:`max-w-none pt-6`,children:n.length===0?(0,T.jsx)(`p`,{className:o.caption,children:`No environment variables configured`}):(0,T.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(_,{placeholder:`API_KEY`,value:e.name,onChange:e=>j(t,e.target.value),className:`w-[35%] font-mono`,disabled:l}),(0,T.jsx)(E,{entry:e,index:t,loading:l,onValueChange:M}),(0,T.jsx)(f,{variant:`ghost`,size:`icon`,onClick:()=>N(t),className:`h-9 w-9 shrink-0`,disabled:l||C,children:(0,T.jsx)(u,{className:`h-3.5 w-3.5`})})]},t))})})]})}):(0,T.jsx)(v,{title:`No project selected`,children:`Please select a project from the sidebar to manage environment variables.`})}export{O as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Bt as a,It as o,Jt as s,Kt as c,Lt as l,Rt as u,ot as d,qt as f,zt as p}from"./dist-BWuYHVi8.js";import{Et as m}from"./dist-DIjomljy.js";import{t as h}from"./utils-CT-Dw22R.js";import{t as g}from"./button-DeNw35VZ.js";import{tt as _,yt as v,zn as y}from"./api-BMo_Lz8f.js";import{t as b}from"./use-toast-xpb5jNtN.js";import{At as x,Bn as S,Dn as C,Fn as w,In as T,Ln as E,Mt as D,Nn as O,Nt as k,Ot as A,jt as j,kn as M,kt as N,pn as P}from"./index-DjaVbFDB.js";import{t as F}from"./use-settings-page-loading-BTySlInF.js";var I=e(n(),1),L=t(),R=r(),z=`__unspecified__`,B=`__default__`;function V(e){let t=(0,L.c)(20),{value:n,onChange:r,enabledModels:i,disabled:c}=e,d=c===void 0?!1:c,m;if(t[0]!==i){m=new Map;for(let e of i){let t=e.provider??`other`,n=m.get(t);n?n.push(e):m.set(t,[e])}t[0]=i,t[1]=m}else m=t[1];let h=m,g;t[2]!==r||t[3]!==n?(g=function(e,t){let i={...n};if(t===z){delete i[e],r(i);return}let a=p(t);a&&(i[e]=a,r(i))},t[2]=r,t[3]=n,t[4]=g):g=t[4];let _=g,v;t[5]===i?v=t[6]:(v=function(e){if(!e)return;let t=e.provider.toLowerCase();return i.find(n=>n.id===e.model&&(n.provider??`other`).toLowerCase()===t)},t[5]=i,t[6]=v);let y=v,b;t[7]!==r||t[8]!==n?(b=function(e,t){let i=n[e];if(!i)return;let a={...i};if(t===B)delete a.reasoningEffort;else if(s(t))a.reasoningEffort=t;else return;r({...n,[e]:a})},t[7]=r,t[8]=n,t[9]=b):b=t[9];let S=b,T;t[10]!==d||t[11]!==i||t[12]!==y||t[13]!==_||t[14]!==S||t[15]!==h||t[16]!==n?(T=u.map(e=>{let t=n[e],r=t?a(t):z,s=y(t)?.supportedReasoningEfforts??[];return(0,R.jsx)(C,{title:l[e],description:o[e],children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(A,{value:r,onValueChange:t=>_(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Unspecified`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:z,children:`Unspecified`}),i.length>0&&(0,R.jsx)(j,{}),[...h.entries()].map(U)]})]}),t&&s.length>0&&(0,R.jsxs)(A,{value:t.reasoningEffort??B,onValueChange:t=>S(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}-reasoning`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Model default`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:B,children:`Model default`}),(0,R.jsx)(x,{value:`off`,children:f(`off`)}),s.map(H)]})]})]})},e)}),t[10]=d,t[11]=i,t[12]=y,t[13]=_,t[14]=S,t[15]=h,t[16]=n,t[17]=T):T=t[17];let E;return t[18]===T?E=t[19]:(E=(0,R.jsx)(w,{id:`model-aliases`,children:T}),t[18]=T,t[19]=E),E}function H(e){return(0,R.jsx)(x,{value:e,children:f(e)},e)}function U(e){let[t,n]=e;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:h(d.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:t}),n.map(e=>{let n=a({provider:e.provider??t,model:e.id});return(0,R.jsx)(x,{value:n,children:P(e.id)},n)})]},t)}function W(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?P(e.id).localeCompare(P(t.id)):n})}function G({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,I.useState)({}),[o,s]=(0,I.useState)({}),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(!0),[p,h]=(0,I.useState)(!1),x=(0,I.useCallback)(async()=>{if(!e){f(!1);return}f(!0);try{let[t,n]=await Promise.all([v(e),_().catch(()=>({}))]),r=t.modelAliases??{};u(W(Object.values(n).flat())),a(r),s(r)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to load model aliases`,variant:`destructive`})}finally{f(!1)}},[e]);(0,I.useLayoutEffect)(()=>{e&&f(!0)},[e]),(0,I.useEffect)(()=>{x()},[x]);let C=F(e,[d]);function w(){return JSON.stringify(r)!==JSON.stringify(o)}async function D(){if(!(!e||!w())){h(!0);try{let i=Object.keys(r).length>0?r:void 0;if(i){let e=await _();c(i,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await y(e,{modelAliases:i??null}),s(r),t&&await t(),await x(),n(`/`)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to save model aliases`,variant:`destructive`})}finally{h(!1)}}}return e?(0,R.jsx)(O,{loading:C,children:(0,R.jsxs)(S,{className:`shrink-0`,children:[(0,R.jsx)(M,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md. Set Cheap to enable Orchestrate mode.`,action:(0,R.jsx)(g,{onClick:()=>void D(),disabled:p||d,children:p?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,R.jsx)(E,{className:`max-w-none pt-6`,children:(0,R.jsx)(V,{value:r,onChange:a,enabledModels:l,disabled:d||p})})]})}):(0,R.jsx)(T,{title:`No project selected`,children:`Please select a project from the sidebar to configure model aliases.`})}export{G as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,Gt as c}from"./dist-DIjomljy.js";import{t as l}from"./utils-CT-Dw22R.js";import{t as u}from"./button-DeNw35VZ.js";import{Bn as d,In as f,Lr as p,yt as m,zn as h}from"./api-BMo_Lz8f.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{An as ee,Bn as te,Dn as _,Fn as ne,Ft as re,In as ie,Ln as ae,Nn as oe,Pt as se,Y as ce,i as le,kn as ue,s as v,vt as de}from"./index-DjaVbFDB.js";import{i as fe}from"./commit-method-fields-CD3PTIox.js";import{a as pe,n as y,r as me,t as b}from"./context-menu-Dx5Jy21w.js";import{t as he}from"./use-settings-page-loading-BTySlInF.js";var x=t(),S=e(n(),1),C=r();function ge(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The selected file is not a readable image.`)),r.src=e})}async function _e(e,t){if(!e){t.setLoading(!1);return}t.setLoading(!0);try{let n=await m(e);t.setProjectPath(n.projectPath??null),t.setName(n.name??``),t.setValue(n.setupScript??``),t.setValidationScript(n.validationScript??``),t.setRunCmd(n.runCommand??``),t.setCommitMethod(n.commitMethod??a.PullRequest),t.setAllowAllCommands(n.allowAllCommands!==!1),t.setAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setProjectIcon(n.projectIcon??null),t.setOriginalName(n.name??``),t.setOriginalAllowAllCommands(n.allowAllCommands!==!1),t.setOriginalAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setOriginalUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setOriginalProjectIcon(n.projectIcon??null)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{t.setLoading(!1)}}async function w(e,t){try{let n=await ge(e),r=document.createElement(`canvas`);r.width=256,r.height=256;let i=r.getContext(`2d`);if(!i)throw Error(`Could not prepare image conversion`);i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`;let a=Math.max(256/n.naturalWidth,256/n.naturalHeight),o=n.naturalWidth*a,s=n.naturalHeight*a;i.drawImage(n,(256-o)/2,(256-s)/2,o,s),t(r.toDataURL(`image/png`))}catch(e){g({title:`Could not use image`,description:e instanceof Error?e.message:`The selected file could not be read.`,variant:`destructive`})}}async function ve(e,t){let n=e.target.files?.[0];if(e.target.value=``,!n)return;let r=URL.createObjectURL(n);try{await w(r,t)}finally{URL.revokeObjectURL(r)}}async function ye(e,t,n){n(!0);try{let n=await f(e);n.runCommand?(t(n.runCommand),g({title:`Success`,description:`Suggested: ${n.runCommand}`})):g({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{n(!1)}}async function T(e,t,n){t!==n&&await d(e,t)}async function be(e,t,n,r,i){await h(e,{setupScript:t.trim()||null,validationScript:n.trim()||null,runCommand:r.trim()||null,commitMethod:i})}async function xe(e,t,n,r,i){(t!==r||JSON.stringify(n)!==JSON.stringify(i))&&await h(e,{allowAllCommands:t,allowedCommandPatterns:n})}async function Se(e,t,n){t!==n&&await h(e,{useBuiltInBrowser:t})}async function E(e,t,n){t!==n&&await h(e,{projectIcon:t})}async function Ce(e,t,n,r,i,a){n.setSaving(!0);try{await T(e,t.name,t.originalName),await be(e,t.value,t.validationScript,t.runCmd,t.commitMethod),await xe(e,t.allowAllCommands,t.allowedCommandPatterns,t.originalAllowAllCommands,t.originalAllowedCommandPatterns),await Se(e,t.useBuiltInBrowser,t.originalUseBuiltInBrowser),await E(e,t.projectIcon,t.originalProjectIcon),n.setOriginalName(t.name),n.setOriginalAllowAllCommands(t.allowAllCommands),n.setOriginalAllowedCommandPatterns(t.allowedCommandPatterns),n.setOriginalUseBuiltInBrowser(t.useBuiltInBrowser),n.setOriginalProjectIcon(t.projectIcon),r&&await r(),await a(),i(`/`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{n.setSaving(!1)}}function we(e){let t=(0,x.c)(10),{allowAllCommands:n,patterns:r,disabled:i,onRemove:a}=e;if(n||r.length===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,C.jsx)(se,{children:`Allowed command patterns`}),t[0]=s):s=t[0];let c;if(t[1]!==i||t[2]!==a||t[3]!==r){let e;t[5]!==i||t[6]!==a?(e=e=>(0,C.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,C.jsx)(`code`,{className:l(o.mono,o.bodyMuted),children:e}),(0,C.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(e),children:`Remove`})]},e),t[5]=i,t[6]=a,t[7]=e):e=t[7],c=r.map(e),t[1]=i,t[2]=a,t[3]=r,t[4]=c}else c=t[4];let d;return t[8]===c?d=t[9]:(d=(0,C.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[s,(0,C.jsx)(`ul`,{className:`space-y-1`,children:c})]}),t[8]=c,t[9]=d),d}function Te(e){let t=(0,x.c)(21),{projectIcon:n,disabled:r,inputRef:i,onFileChange:a,onButtonClick:o,onRemove:s}=e,l;t[0]!==r||t[1]!==i||t[2]!==a?(l=(0,C.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`sr-only`,onChange:a,disabled:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=l):l=t[3];let u=n?`Change project icon`:`Choose project icon`,d;t[4]===n?d=t[5]:(d=n?(0,C.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`}):(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`,strokeWidth:1.5}),t[4]=n,t[5]=d);let f;t[6]!==r||t[7]!==o||t[8]!==u||t[9]!==d?(f=(0,C.jsx)(pe,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/40 outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:o,disabled:r,"aria-label":u,children:d})}),t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==r||t[12]!==s||t[13]!==n?(p=n&&(0,C.jsx)(y,{children:(0,C.jsx)(me,{disabled:r,onSelect:s,children:`Remove`})}),t[11]=r,t[12]=s,t[13]=n,t[14]=p):p=t[14];let m;t[15]!==f||t[16]!==p?(m=(0,C.jsxs)(b,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==l||t[19]!==m?(h=(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,m]}),t[18]=l,t[19]=m,t[20]=h):h=t[20],h}function Ee(e){let t=(0,x.c)(6),{saving:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`,t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,C.jsx)(u,{onClick:i,disabled:r,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function De(e,t,n){let r=(0,x.c)(13),i;r[0]===e?i=r[1]:(i=function(t){return w(t,e)},r[0]=e,r[1]=i);let a=i,o,s;r[2]===a?(o=r[3],s=r[4]):(o=()=>{if(!p())return;let e=function(e){let t=e.detail.dataUrl;a(t)};return window.addEventListener(`tarsk:project-icon-selected`,e),()=>{window.removeEventListener(`tarsk:project-icon-selected`,e)}},s=[a],r[2]=a,r[3]=o,r[4]=s),(0,S.useEffect)(o,s);let c;r[5]===e?c=r[6]:(c=function(t){return ve(t,e)},r[5]=e,r[6]=c);let l=c,u;r[7]!==n||r[8]!==t?(u=function(){p()&&t?v(t):n.current?.click()},r[7]=n,r[8]=t,r[9]=u):u=r[9];let d=u,f;return r[10]!==d||r[11]!==l?(f={handleProjectIconChange:l,handleProjectIconButtonClick:d},r[10]=d,r[11]=l,r[12]=f):f=r[12],f}function Oe(e){let t=(0,x.c)(117),{projectId:n,onProjectUpdated:r}=e,c=i(),d=le(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,se]=(0,S.useState)(``),[v,pe]=(0,S.useState)(a.PullRequest),[y,me]=(0,S.useState)(``),[b,ge]=(0,S.useState)(!1),[w,ve]=(0,S.useState)(!1),[T,be]=(0,S.useState)(!0),[xe,Se]=(0,S.useState)(``),[E,Oe]=(0,S.useState)(!0),D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[0]=D):D=t[0];let[O,ke]=(0,S.useState)(D),[Ae,je]=(0,S.useState)(!0),Me;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[1]=Me):Me=t[1];let[Ne,Pe]=(0,S.useState)(Me),[k,Fe]=(0,S.useState)(!0),[Ie,Le]=(0,S.useState)(!0),[A,Re]=(0,S.useState)(null),[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(null),Ue=(0,S.useRef)(null),We;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(We={setProjectPath:He,setName:p,setValue:h,setRunCmd:se,setCommitMethod:pe,setValidationScript:me,setAllowAllCommands:Oe,setAllowedCommandPatterns:ke,setUseBuiltInBrowser:Fe,setProjectIcon:Re,setOriginalName:Se,setOriginalAllowAllCommands:je,setOriginalAllowedCommandPatterns:Pe,setOriginalUseBuiltInBrowser:Le,setOriginalProjectIcon:Be,setLoading:be,setSaving:ge},t[2]=We):We=t[2];let Ge=We,Ke;t[3]===n?Ke=t[4]:(Ke=()=>_e(n,Ge),t[3]=n,t[4]=Ke);let j=Ke,qe,M;t[5]===n?(qe=t[6],M=t[7]):(qe=()=>{n&&be(!0)},M=[n],t[5]=n,t[6]=qe,t[7]=M),(0,S.useLayoutEffect)(qe,M);let Je,Ye;t[8]===j?(Je=t[9],Ye=t[10]):(Je=()=>{j()},Ye=[j],t[8]=j,t[9]=Je,t[10]=Ye),(0,S.useEffect)(Je,Ye);let Xe;t[11]===T?Xe=t[12]:(Xe=[T],t[11]=T,t[12]=Xe);let Ze=he(n,Xe),Qe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=function(e){pe(e)},t[13]=Qe):Qe=t[13];let $e=Qe,{handleProjectIconChange:et,handleProjectIconButtonClick:tt}=De(Re,Ve,Ue),nt;t[14]===n?nt=t[15]:(nt=async()=>{n&&await ye(n,se,ve)},t[14]=n,t[15]=nt);let rt=nt,it;t[16]!==E||t[17]!==O||t[18]!==v||t[19]!==j||t[20]!==f||t[21]!==c||t[22]!==r||t[23]!==Ae||t[24]!==Ne||t[25]!==xe||t[26]!==ze||t[27]!==Ie||t[28]!==A||t[29]!==n||t[30]!==g||t[31]!==k||t[32]!==y||t[33]!==m?(it=async()=>{n&&await Ce(n,{name:f,value:m,runCmd:g,commitMethod:v,validationScript:y,allowAllCommands:E,allowedCommandPatterns:O,useBuiltInBrowser:k,projectIcon:A,originalName:xe,originalAllowAllCommands:Ae,originalAllowedCommandPatterns:Ne,originalUseBuiltInBrowser:Ie,originalProjectIcon:ze},Ge,r,c,j)},t[16]=E,t[17]=O,t[18]=v,t[19]=j,t[20]=f,t[21]=c,t[22]=r,t[23]=Ae,t[24]=Ne,t[25]=xe,t[26]=ze,t[27]=Ie,t[28]=A,t[29]=n,t[30]=g,t[31]=k,t[32]=y,t[33]=m,t[34]=it):it=t[34];let at=it,N=T||b,ot=T||w;if(!n){let e;return t[35]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,C.jsx)(ie,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`}),t[35]=e):e=t[35],e}let P;t[36]!==N||t[37]!==at||t[38]!==b?(P=(0,C.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,C.jsx)(Ee,{saving:b,disabled:N,onClick:at}),sticky:!1}),t[36]=N,t[37]=at,t[38]=b,t[39]=P):P=t[39];let st;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>p(e.target.value),t[40]=st):st=t[40];let F;t[41]!==T||t[42]!==f?(F=(0,C.jsx)(_,{title:`Project Name`,children:(0,C.jsx)(re,{id:`projectName`,value:f,onChange:st,placeholder:`Enter project name`,disabled:T})}),t[41]=T,t[42]=f,t[43]=F):F=t[43];let ct;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>h(e.target.value),t[44]=ct):ct=t[44];let I;t[45]!==T||t[46]!==m?(I=(0,C.jsx)(_,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,C.jsx)(ce,{id:`setupScript`,value:m,onChange:ct,placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[45]=T,t[46]=m,t[47]=I):I=t[47];let lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(lt=e=>me(e.target.value),t[48]=lt):lt=t[48];let L;t[49]!==T||t[50]!==y?(L=(0,C.jsx)(_,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,C.jsx)(ce,{id:`validationScript`,value:y,onChange:lt,placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[49]=T,t[50]=y,t[51]=L):L=t[51];let ut;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>se(e.target.value),t[52]=ut):ut=t[52];let R;t[53]!==T||t[54]!==g?(R=(0,C.jsx)(re,{id:`runCommand`,value:g,onChange:ut,placeholder:`e.g. npm run dev`,className:`font-mono pr-28`,disabled:T}),t[53]=T,t[54]=g,t[55]=R):R=t[55];let z;t[56]===w?z=t[57]:(z=w?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):`Suggest`,t[56]=w,t[57]=z);let B;t[58]!==rt||t[59]!==ot||t[60]!==z?(B=(0,C.jsx)(u,{variant:`ghost`,size:`sm`,className:`absolute right-1 top-1 h-8`,onClick:rt,disabled:ot,children:z}),t[58]=rt,t[59]=ot,t[60]=z,t[61]=B):B=t[61];let V;t[62]!==R||t[63]!==B?(V=(0,C.jsx)(_,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,children:(0,C.jsxs)(`div`,{className:`relative`,children:[R,B]})}),t[62]=R,t[63]=B,t[64]=V):V=t[64];let dt=v===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,H;t[65]!==v||t[66]!==T?(H=(0,C.jsx)(fe,{commitMethod:v,onCommitMethodChange:$e,disabled:T}),t[65]=v,t[66]=T,t[67]=H):H=t[67];let U;t[68]!==dt||t[69]!==H?(U=(0,C.jsx)(_,{title:`Commit Method`,description:dt,controlLayout:`row-end`,action:H}),t[68]=dt,t[69]=H,t[70]=U):U=t[70];let ft=!E,pt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>Oe(!e),t[71]=pt):pt=t[71];let W;t[72]!==T||t[73]!==ft?(W=(0,C.jsx)(de,{value:ft,onChange:pt,disabled:T,ariaLabel:`Confirm Commands`}),t[72]=T,t[73]=ft,t[74]=W):W=t[74];let G;t[75]!==E||t[76]!==O||t[77]!==N?(G=!E&&O.length>0&&(0,C.jsx)(we,{allowAllCommands:E,patterns:O,disabled:N,onRemove:e=>ke(t=>t.filter(t=>t!==e))}),t[75]=E,t[76]=O,t[77]=N,t[78]=G):G=t[78];let K;t[79]!==W||t[80]!==G?(K=(0,C.jsx)(_,{title:`Confirm Commands`,description:`When enabled, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,controlLayout:`row-end`,action:W,children:G}),t[79]=W,t[80]=G,t[81]=K):K=t[81];let q;t[82]!==N||t[83]!==k?(q=(0,C.jsx)(_,{title:`Built-in Browser`,description:`When enabled, Tarsk shows the Browser tab and opens detected dev URLs in the app. When disabled, the tab is hidden and URLs open in your system browser.`,controlLayout:`row-end`,action:(0,C.jsx)(de,{value:k,onChange:Fe,disabled:N,ariaLabel:`Built-in Browser`})}),t[82]=N,t[83]=k,t[84]=q):q=t[84];let mt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>Re(null),t[85]=mt):mt=t[85];let J;t[86]!==N||t[87]!==tt||t[88]!==et||t[89]!==A?(J=(0,C.jsx)(_,{title:`Project Icon`,description:`Choose an image to use for this project on the Projects page. It will be center-cropped to a 256×256 PNG.`,controlLayout:`row-end`,action:(0,C.jsx)(Te,{projectIcon:A,disabled:N,inputRef:Ue,onFileChange:et,onButtonClick:tt,onRemove:mt})}),t[86]=N,t[87]=tt,t[88]=et,t[89]=A,t[90]=J):J=t[90];let Y;t[91]!==F||t[92]!==I||t[93]!==L||t[94]!==V||t[95]!==U||t[96]!==K||t[97]!==q||t[98]!==J?(Y=(0,C.jsx)(ae,{className:`max-w-none pt-6`,children:(0,C.jsxs)(ne,{children:[F,I,L,V,U,K,q,J]})}),t[91]=F,t[92]=I,t[93]=L,t[94]=V,t[95]=U,t[96]=K,t[97]=q,t[98]=J,t[99]=Y):Y=t[99];let X;t[100]!==P||t[101]!==Y?(X=(0,C.jsxs)(te,{className:`shrink-0`,children:[P,Y]}),t[100]=P,t[101]=Y,t[102]=X):X=t[102];let ht;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,C.jsx)(ee,{title:`Delete Project`}),t[103]=ht):ht=t[103];let gt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,C.jsx)(`div`,{className:`min-w-0`,children:(0,C.jsx)(`p`,{className:l(o.bodyMuted),children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`})}),t[104]=gt):gt=t[104];let Z;t[105]!==f||t[106]!==n||t[107]!==d?(Z=()=>{n&&d({id:n,name:f})},t[105]=f,t[106]=n,t[107]=d,t[108]=Z):Z=t[108];let Q;t[109]!==N||t[110]!==Z?(Q=(0,C.jsxs)(te,{className:`shrink-0 rounded-none border-t border-table-border pt-6 mt-8`,children:[ht,(0,C.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[gt,(0,C.jsx)(u,{type:`button`,variant:`destructive`,disabled:N,onClick:Z,children:`Delete Project`})]})]}),t[109]=N,t[110]=Z,t[111]=Q):Q=t[111];let $;return t[112]!==Ze||t[113]!==n||t[114]!==X||t[115]!==Q?($=(0,C.jsxs)(oe,{loading:Ze,children:[X,Q]},n),t[112]=Ze,t[113]=n,t[114]=X,t[115]=Q,t[116]=$):$=t[116],$}export{Oe as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{X as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{yt as u,zn as d}from"./api-BMo_Lz8f.js";import{t as f}from"./use-toast-xpb5jNtN.js";import{Bn as p,Dn as m,In as h,Ln as g,Nn as _,kn as v,vt as y}from"./index-DjaVbFDB.js";import{t as b}from"./use-settings-page-loading-BTySlInF.js";var x=e(n(),1),S=t(),C=r(),w=a(),T=Math.ceil(w.length/2),E=[w.slice(0,T),w.slice(T)];function D(e){let t=(0,S.c)(14),{tool:n,enabled:r,disabled:i,onToggle:a}=e,s;t[0]!==a||t[1]!==n.name?(s=e=>a(n.name,e),t[0]=a,t[1]=n.name,t[2]=s):s=t[2];let l;t[3]!==i||t[4]!==r||t[5]!==s||t[6]!==n.displayName?(l=(0,C.jsx)(y,{value:r,onChange:s,disabled:i,ariaLabel:n.displayName}),t[3]=i,t[4]=r,t[5]=s,t[6]=n.displayName,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(o.body,`truncate`),t[8]=u):u=t[8];let d;t[9]===n.displayName?d=t[10]:(d=(0,C.jsx)(`span`,{className:u,children:n.displayName}),t[9]=n.displayName,t[10]=d);let f;return t[11]!==l||t[12]!==d?(f=(0,C.jsxs)(`div`,{className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)] items-center gap-3 px-3 py-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function O(e){let t=(0,S.c)(13),{tools:n,disabledTools:r,disabled:i,forceEnabledTools:a,onToggle:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==o?(e=e=>(0,C.jsx)(D,{tool:e,enabled:!r.includes(e.name),disabled:i||a.has(e.name),onToggle:o},e.name),t[6]=i,t[7]=r,t[8]=a,t[9]=o,t[10]=e):e=t[10],s=n.map(e),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=n,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,C.jsx)(`div`,{className:`divide-y divide-table-border`,children:s}),t[11]=s,t[12]=c),c}function k(e){let t=(0,S.c)(23),{disabledTools:n,onChange:r,disabled:i,forceEnabledTools:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=new Set((a??[]).map(A)),t[0]=a,t[1]=s);let c=s,l;t[2]!==n||t[3]!==c||t[4]!==r?(l=function(e,t){let i=e.toLowerCase();if(!(c.has(i)&&!t)){if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())}},t[2]=n,t[3]=c,t[4]=r,t[5]=l):l=t[5];let u=l,d;t[6]!==o||t[7]!==n||t[8]!==c||t[9]!==u?(d=w.map(e=>(0,C.jsx)(D,{tool:e,enabled:!n.includes(e.name),disabled:o||c.has(e.name),onToggle:u},e.name)),t[6]=o,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,C.jsx)(`div`,{className:`divide-y divide-table-border @md/settings-page:hidden`,children:d}),t[11]=d,t[12]=f);let p;t[13]!==o||t[14]!==n||t[15]!==c||t[16]!==u?(p=E.map((e,t)=>(0,C.jsx)(O,{tools:e,disabledTools:n,disabled:o,forceEnabledTools:c,onToggle:u},t)),t[13]=o,t[14]=n,t[15]=c,t[16]=u,t[17]=p):p=t[17];let m;t[18]===p?m=t[19]:(m=(0,C.jsx)(`div`,{className:`hidden @md/settings-page:grid @md/settings-page:grid-cols-2 divide-x divide-table-border`,children:p}),t[18]=p,t[19]=m);let h;return t[20]!==f||t[21]!==m?(h=(0,C.jsxs)(C.Fragment,{children:[f,m]}),t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function A(e){return e.toLowerCase()}function j({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,x.useState)([]),[o,c]=(0,x.useState)([]),[S,w]=(0,x.useState)(!1),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(!0),[A,j]=(0,x.useState)(!1),M=(0,x.useCallback)(async()=>{if(!e){O(!1);return}O(!0);try{let t=await u(e),n=t.disabledTools??[],r=t.smartJsEnabled===!0;a(n),c(n),w(r),E(r)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to load tools settings`,variant:`destructive`})}finally{O(!1)}},[e]);(0,x.useLayoutEffect)(()=>{e&&O(!0)},[e]),(0,x.useEffect)(()=>{M()},[M]);let N=b(e,[D]);function P(){return JSON.stringify([...r].sort())!==JSON.stringify([...o].sort())}function F(){return P()||S!==T}async function I(){if(!(!e||!F())){j(!0);try{let i={};P()&&(i.disabledTools=r.length>0?r:null),S!==T&&(i.smartJsEnabled=S),await d(e,i),c(r),E(S),t&&await t(),await M(),n(`/`)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to save tools settings`,variant:`destructive`})}finally{j(!1)}}}function L(e){w(e),e&&a(e=>e.filter(e=>e!==`run_js`))}return e?(0,C.jsx)(_,{loading:N,children:(0,C.jsxs)(p,{className:`shrink-0`,children:[(0,C.jsx)(v,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,action:(0,C.jsx)(l,{onClick:()=>void I(),disabled:A||D,children:A?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,C.jsxs)(g,{className:`max-w-none pt-6`,children:[(0,C.jsx)(m,{title:`Smart JS`,description:`When enabled, the agent orchestrates tools by writing JavaScript for Run JS (except Ask, Write, and Subagent). Other tools stay available through callTool inside the worker.`,controlLayout:`row-end`,action:(0,C.jsx)(y,{value:S,onChange:L,disabled:D||A,ariaLabel:`Smart JS`})}),(0,C.jsx)(`div`,{className:`mt-8`,children:(0,C.jsx)(k,{disabledTools:r,onChange:a,disabled:D||A,forceEnabledTools:S?[`run_js`]:void 0})})]})]})}):(0,C.jsx)(h,{title:`No project selected`,children:`Please select a project from the sidebar to configure tools.`})}export{j as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{c as i,s as a}from"./chunk-QFMPRPBF-COsSkB7x.js";import{G as o,S as s,at as c,ot as l}from"./dist-BWuYHVi8.js";import{Q as u,n as d}from"./store-BaMSfYoJ.js";import{$ as f,Et as p,Mt as m,On as h,ln as g,q as _,un as v,y}from"./dist-DIjomljy.js";import{n as b,o as x,t as S}from"./utils-CT-Dw22R.js";import{t as C}from"./button-DeNw35VZ.js";import{B as ee,Et as te,G as w,L as T,R as E,V as ne,W as re,an as ie,kt as ae,tt as D,vn as oe,yn as se}from"./api-BMo_Lz8f.js";import{i as ce,n as O,r as k,t as A}from"./tooltip-B6ziVyTv.js";import{n as le}from"./async-loading-fallback-B_JNgWJR.js";import{t as j}from"./suspense-resource-DnYnmTbs.js";import{t as M}from"./use-suspense-resource-Dkz6ddFN.js";import{Bn as ue,Ct as N,Et as P,Fn as F,Ft as I,I as de,In as fe,L as pe,Ln as L,On as R,Pn as z,R as B,St as me,bt as V,kn as H,o as he,pn as ge,z as U}from"./index-DjaVbFDB.js";import{t as W}from"./async-error-boundary-J8P6NVvc.js";import{t as G}from"./sorting-DqwxPMRN.js";import{t as _e}from"./pending-changes-Bn-0ak1d.js";import{o as K}from"./settings-list-DU82HNPX.js";import{t as q}from"./use-deferred-search-Dgxosq55.js";import{n as J,r as Y,t as X}from"./model-list-controls-D86_87E4.js";var Z=t(),Q=e(n(),1),$=r(),ve=x(S(l.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function ye(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=S(ve({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,$.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var be=s(`app.use-provider-details.hook`);function xe(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function Se({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:n}){let r=d(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(new Set),[C,D]=(0,Q.useState)(new Map),{query:ce,setQuery:O,deferredQuery:k}=q(),[A,le]=(0,Q.useState)(`alphabetical`),[j,M]=(0,Q.useState)(`all`),[ue,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(``),[I,de]=(0,Q.useState)(``),[fe,pe]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`coding`),[z,B]=(0,Q.useState)([]),[V,H]=(0,Q.useState)(new Set),[he,U]=(0,Q.useState)(new Set),[W,K]=(0,Q.useState)(new Map),[J,Y]=(0,Q.useState)({}),X=e=>ge(e.id);(0,Q.useEffect)(()=>{(async()=>{if(g(``),n&&(t&&n.slug===t||e&&n.name===e)){a(n),pe(n.apiKey??``),c(n.apiKey??``),Y(n.envValues??{}),ye(n.slug),Z(n.slug);return}try{let n=xe(await ae(),e,t);a(n),pe(n?.apiKey??``),c(n?.apiKey??``),Y(n?.envValues??{}),n&&(ye(n.slug),Z(n.slug))}catch(e){g(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,n]);let Z=async e=>{m(null);try{let t=await te(e);t.status===`success`&&m(t.balance)}catch(t){be.error(`Failed to load balance for ${e}:`,t)}};function $(){v([]),B([]),b(new Set),S(new Set),H(new Set),U(new Set),D(new Map),K(new Map)}function ve(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ye=async e=>{f(!0),de(``),O(``),le(`alphabetical`),M(`all`),R(`coding`);try{let[t,n]=await Promise.all([w(e),re(e)]);v(t.models),B(n.models);let r=new Set(t.enabledModelIds);b(r),S(r);let i=new Set(n.enabledModelIds);H(i),U(i),D(new Map),K(new Map)}catch(t){be.error(`Failed to load models for ${e}:`,t),$(),de(ve(t))}finally{f(!1)}};async function Se(e){f(!0),de(``);try{await ie(e),await ye(e),r({type:u.ConfigUpdated})}catch(t){be.error(`Failed to refresh models for ${e}:`,t),$(),de(ve(t)),f(!1)}}let Ce=(e,t)=>{i?.name===e&&(c(t),Te(t))},we=(e,t)=>{Y(n=>({...n,[e]:t})),i&&(async()=>{try{await oe({[e]:t}),r({type:u.ConfigUpdated}),F(`${me(e)} saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save provider settings`);return}o(i.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Se(i.slug)})()},Te=async e=>{if(!(!i||e===fe))try{await se(i.slug,e),r({type:u.ConfigUpdated}),pe(e),F(`API key saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save API key`)}},Ee=(e,t)=>{t===`image`?K(t=>{let n=new Map(t),r=V.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),De(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):D(t=>{let n=_e(t,e,y);return De(e,(n.has(e)?n.get(e):y.has(e))??!1,`coding`),n})},De=async(e,t,n=`coding`)=>{if(i)try{n===`image`?(t?(await ee(i.slug,e),H(t=>new Set([...t,e]))):(await T(i.slug,e),H(t=>{let n=new Set(t);return n.delete(e),n})),K(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ne(i.slug,e),b(t=>new Set([...t,e]))):(await E(i.slug,e),b(t=>{let n=new Set(t);return n.delete(e),n})),D(t=>{let n=new Map(t);return n.delete(e),n})),r({type:u.ConfigUpdated}),F(`Model preferences saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save model changes`)}};async function Oe(e,t=`coding`){let n=t===`image`?z:_,r=t===`image`?V:y;(t===`image`?K:D)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await De(i.id,e,t)}let ke=s!==void 0&&s.trim().length>0;return{selectedProvider:i,error:h,balance:p,displayApiKey:s,showApiKey:ue,setShowApiKey:N,providerEnvValues:J,modelsLoading:l,modelsError:I,saveStatus:P,modelTab:L,setModelTab:R,modelSearchQuery:ce,setModelSearchQuery:O,modelSortBy:A,setModelSortBy:le,modelFilter:j,setModelFilter:M,availableModels:_,enabledModelIds:y,pendingChanges:C,filteredAndSortedModels:(0,Q.useMemo)(()=>G({models:_,query:k,sortBy:A,getDisplayName:X,freeOnly:j===`free`,groupByProvider:!0,getPriority:e=>+!x.has(e.id)}),[_,k,j,x,A,X]),availableImageModels:z,enabledImageModelIds:V,pendingImageChanges:W,filteredAndSortedImageModels:(0,Q.useMemo)(()=>G({models:z,query:k,sortBy:A===`coding-index`||A===`intelligence-by-price`?`alphabetical`:A,getDisplayName:X,freeOnly:j===`free`,groupByProvider:!0,getPriority:e=>+!he.has(e.id)}),[z,k,j,he,A,X]),hasApiKey:ke,getModelDisplayName:X,handleUpdateKeyLocal:Ce,handleUpdateProviderEnv:we,refreshLocalProviderModels:Se,handleToggleModel:Ee,handleToggleAllModels:Oe}}function Ce(e){let t=(0,Z.c)(7),{provider:n,onBack:r}=e;if(!r&&!n.url)return null;let i;t[0]===n.url?i=t[1]:(i=n.url?(0,$.jsx)(V,{url:n.url,className:S(l.compact,`p-3`)}):null,t[0]=n.url,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,$.jsxs)(C,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:r,children:[(0,$.jsx)(y,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close provider details`})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,Z.c)(6),{balance:n}=e;if(n===null)return null;let r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=S(l.compact,`inline-flex shrink-0 items-center gap-1.5 font-medium`),i=(0,$.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===n?a=t[3]:(a=b(n),t[2]=n,t[3]=a);let o;return t[4]===a?o=t[5]:(o=(0,$.jsxs)(`span`,{className:r,children:[i,`$`,a,` balance`]}),t[4]=a,t[5]=o),o}function Te(e){let t=(0,Z.c)(8),{title:n,tooltip:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=S(l.label,`cursor-help`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(`span`,{className:i,children:n})}),t[1]=n,t[2]=a);let o;t[3]===r?o=t[4]:(o=(0,$.jsx)(O,{children:r}),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsx)(k,{children:(0,$.jsxs)(A,{children:[a,o]})}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Ee(e){let t=(0,Z.c)(10),{provider:n,displayApiKey:r,showApiKey:i,onToggleShowApiKey:a,onUpdateKey:s,providerEnvValues:c,onUpdateEnv:l,modelsLoading:u,onRefreshModels:d}=e,h;return t[0]!==r||t[1]!==u||t[2]!==d||t[3]!==a||t[4]!==l||t[5]!==s||t[6]!==n||t[7]!==c||t[8]!==i?(h=(0,$.jsx)($.Fragment,{children:n.authType===`APIKey`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(F,{children:[(0,$.jsx)(z,{label:(0,$.jsx)(Te,{title:`API Key`,tooltip:`Your API key is stored locally and never shared.`}),control:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(m,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(I,{type:i?`text`:`password`,placeholder:n.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:r,onChange:e=>{s(n.name,e.target.value)}}),(0,$.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:a,disabled:!r,children:i?(0,$.jsx)(v,{className:`h-4 w-4 text-muted-foreground`}):(0,$.jsx)(g,{className:`h-4 w-4 text-muted-foreground`})})]})}),N(n).map(e=>(0,$.jsx)(z,{label:(0,$.jsx)(Te,{title:me(e),tooltip:e}),control:o(n.slug)&&e===`LOCAL_API_URL`?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(I,{id:e,value:c[e]??``,onChange:t=>l(e,t.target.value),placeholder:n.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,$.jsx)(k,{children:(0,$.jsxs)(A,{children:[(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{d(n.slug)},disabled:u,children:u?(0,$.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})})}),(0,$.jsx)(O,{children:`Refresh models`})]})})]}):(0,$.jsx)(I,{id:e,value:c[e]??``,onChange:t=>l(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})},e))]})}):(0,$.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,$.jsx)(R,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,$.jsxs)(C,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]})}),t[0]=r,t[1]=u,t[2]=d,t[3]=a,t[4]=l,t[5]=s,t[6]=n,t[7]=c,t[8]=i,t[9]=h):h=t[9],h}function De(e){let t=(0,Z.c)(22),{tab:n,model:r,displayName:i,willBeEnabled:a,hasApiKey:o,showStarRating:s,onToggle:c}=e,u=r.pricing,d=n===`image`?`image-${r.id}`:r.id,f=r.id,p=!o&&`opacity-25`,m;t[0]===p?m=t[1]:(m=S(`flex cursor-default items-center space-x-3 p-3 transition-colors hover:bg-muted/30`,p),t[0]=p,t[1]=m);let h=!o,g=a??!1,_;t[2]!==r.id||t[3]!==c?(_=()=>c(r.id),t[2]=r.id,t[3]=c,t[4]=_):_=t[4];let v;t[5]!==d||t[6]!==h||t[7]!==g||t[8]!==_?(v=(0,$.jsx)(he,{id:d,disabled:h,checked:g,onCheckedChange:_,className:`mt-0`}),t[5]=d,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]!==d||t[11]!==i||t[12]!==r.coding_index||t[13]!==u||t[14]!==s||t[15]!==n?(y=n===`coding`?(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:S(l.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[s&&(0,$.jsx)(Y,{codingIndex:r.coding_index,modelName:i}),u&&(0,$.jsx)(`span`,{className:S(l.caption,`whitespace-nowrap`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${b(u.prompt??0)} in | $${b(u.completion??0)} out`})]})]}):(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:S(l.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),u&&(0,$.jsx)(`span`,{className:S(l.caption,`whitespace-nowrap flex-shrink-0`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${b(u.prompt??0)} in | $${b(u.completion??0)} out`})]}),t[10]=d,t[11]=i,t[12]=r.coding_index,t[13]=u,t[14]=s,t[15]=n,t[16]=y):y=t[16];let x;return t[17]!==r.id||t[18]!==m||t[19]!==v||t[20]!==y?(x=(0,$.jsxs)(`div`,{className:m,children:[v,y]},f),t[17]=r.id,t[18]=m,t[19]=v,t[20]=y,t[21]=x):x=t[21],x}function Oe(e){let t=(0,Z.c)(13),{tab:n,models:r,filteredModels:i,modelsLoading:a,modelsError:o,hasApiKey:s,enabledModelIds:u,pendingChanges:d,modelSortBy:f,getModelDisplayName:m,onToggleModel:h}=e,g=n===`coding`,_=g?o?`No models loaded.`:`No models available for this provider.`:`No image models available for this provider.`,v;return t[0]!==_||t[1]!==u||t[2]!==i||t[3]!==m||t[4]!==s||t[5]!==g||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==h||t[10]!==d||t[11]!==n?(v=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:a?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(p,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):r.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:l.bodyMuted,children:_})}):(0,$.jsx)(k,{children:(0,$.jsx)(`div`,{className:S(`grid grid-cols-1 gap-0`,c.tableWrapper),children:i.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:l.bodyMuted,children:`No models matching your filters.`})}):i.map(e=>{let t=u.has(e.id),r=d.has(e.id),i=d.get(e.id),a=(r?i:t)??!1;return(0,$.jsx)(De,{tab:n,model:e,displayName:m(e),willBeEnabled:a,hasApiKey:s,showStarRating:g&&(f===`coding-index`||f===`intelligence-by-price`),onToggle:e=>h(e,n)},e.id)})})})}),t[0]=_,t[1]=u,t[2]=i,t[3]=m,t[4]=s,t[5]=g,t[6]=f,t[7]=r,t[8]=a,t[9]=h,t[10]=d,t[11]=n,t[12]=v):v=t[12],v}function ke(e){let t=(0,Z.c)(22),{tab:n,showImageTab:r,modelsLoading:i,models:a,hasApiKey:o,enabledModelIds:s,pendingChanges:c,modelSearchQuery:l,onModelSearchQueryChange:u,modelSortBy:d,onModelSortByChange:f,onToggleAllModels:p}=e,m=n===`coding`,h=m?`select-all-models`:`select-all-image-models`,g=!i&&a.length>0,v=g&&!o&&`opacity-25`,y;t[0]===v?y=t[1]:(y=S(`flex flex-col gap-2 md:flex-row md:items-center`,v),t[0]=v,t[1]=y);let b;t[2]===r?b=t[3]:(b=r?(0,$.jsxs)(B,{className:`w-fit shrink-0 self-start`,children:[(0,$.jsx)(U,{value:`coding`,children:`Coding`}),(0,$.jsx)(U,{value:`image`,children:`Image`})]}):null,t[2]=r,t[3]=b);let x;t[4]!==s||t[5]!==o||t[6]!==m||t[7]!==l||t[8]!==d||t[9]!==a||t[10]!==u||t[11]!==f||t[12]!==p||t[13]!==c||t[14]!==h||t[15]!==g||t[16]!==n?(x=g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,$.jsx)(_,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,$.jsx)(I,{placeholder:`Search`,className:`pl-10 h-8`,value:l,onChange:e=>u(e.target.value),disabled:!o})]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 self-end md:ml-auto md:self-auto`,children:[(0,$.jsx)(X,{id:h,disabled:!o,checked:a.every(e=>{let t=c.has(e.id),n=c.get(e.id);return t?n:s.has(e.id)}),onChange:e=>{p(e,n)}}),(0,$.jsx)(J,{sortBy:d,showCodingIndex:m,showIntelligenceByPrice:m,onSortByChange:f})]})]}):null,t[4]=s,t[5]=o,t[6]=m,t[7]=l,t[8]=d,t[9]=a,t[10]=u,t[11]=f,t[12]=p,t[13]=c,t[14]=h,t[15]=g,t[16]=n,t[17]=x):x=t[17];let C;return t[18]!==y||t[19]!==b||t[20]!==x?(C=(0,$.jsxs)(`div`,{className:y,children:[b,x]}),t[18]=y,t[19]=b,t[20]=x,t[21]=C):C=t[21],C}function Ae(e){let t=(0,Z.c)(10),{title:n,description:r,action:i,tableHeader:a,children:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n?(s=(0,$.jsx)(H,{title:n,description:r,action:i,sticky:!1,tableHeader:a}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`div`,{className:`px-6 pb-6`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(ue,{className:`shrink-0`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function je(e){let t=(0,Z.c)(111),{selectedProviderName:n,selectedProviderSlug:r,providerData:i,onBack:a,className:o}=e,s=n===void 0?null:n,c=r===void 0?null:r,l;t[0]!==i||t[1]!==s||t[2]!==c?(l={selectedProviderName:s,selectedProviderSlug:c,providerData:i},t[0]=i,t[1]=s,t[2]=c,t[3]=l):l=t[3];let{selectedProvider:u,error:d,balance:f,displayApiKey:p,showApiKey:m,setShowApiKey:g,providerEnvValues:_,modelsLoading:v,modelsError:y,saveStatus:b,modelTab:x,setModelTab:ee,modelSearchQuery:te,setModelSearchQuery:w,modelSortBy:T,setModelSortBy:E,availableModels:ne,enabledModelIds:re,pendingChanges:ie,filteredAndSortedModels:ae,availableImageModels:D,enabledImageModelIds:oe,pendingImageChanges:se,filteredAndSortedImageModels:ce,hasApiKey:O,getModelDisplayName:k,handleUpdateKeyLocal:A,handleUpdateProviderEnv:le,refreshLocalProviderModels:j,handleToggleModel:M,handleToggleAllModels:ue}=Se(l);if(d){let e;t[4]===o?e=t[5]:(e=S(`flex h-full min-h-0 flex-col items-center justify-center gap-4 p-6`,o),t[4]=o,t[5]=e);let n;t[6]===d?n=t[7]:(n=(0,$.jsx)(R,{variant:`error`,className:`mb-0`,children:d}),t[6]=d,t[7]=n);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(C,{variant:`outline`,size:`sm`,onClick:Me,children:`Retry`}),t[8]=r):r=t[8];let i;return t[9]!==e||t[10]!==n?(i=(0,$.jsxs)(`div`,{className:e,children:[n,r]}),t[9]=e,t[10]=n,t[11]=i):i=t[11],i}if(!u){let e;t[12]===o?e=t[13]:(e=S(`flex h-full min-h-0 items-center justify-center`,o),t[12]=o,t[13]=e);let n=s||c?`Provider not found`:`Select a Provider`,r;t[14]===a?r=t[15]:(r=a?(0,$.jsxs)(C,{variant:`outline`,size:`sm`,onClick:a,children:[(0,$.jsx)(h,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,t[14]=a,t[15]=r);let i=a?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`,l;t[16]!==n||t[17]!==r||t[18]!==i?(l=(0,$.jsx)(fe,{title:n,action:r,children:i}),t[16]=n,t[17]=r,t[18]=i,t[19]=l):l=t[19];let u;return t[20]!==e||t[21]!==l?(u=(0,$.jsx)(`div`,{className:e,children:l}),t[20]=e,t[21]=l,t[22]=u):u=t[22],u}let N;t[23]===o?N=t[24]:(N=S(`h-full min-h-0`,o),t[23]=o,t[24]=N);let P;t[25]!==a||t[26]!==u?(P=(0,$.jsx)(Ce,{provider:u,onBack:a}),t[25]=a,t[26]=u,t[27]=P):P=t[27];let F;t[28]!==g||t[29]!==m?(F=()=>g(!m),t[28]=g,t[29]=m,t[30]=F):F=t[30];let I;t[31]!==p||t[32]!==A||t[33]!==le||t[34]!==v||t[35]!==_||t[36]!==j||t[37]!==u||t[38]!==m||t[39]!==F?(I=(0,$.jsx)(`div`,{className:`pt-6`,children:(0,$.jsx)(Ee,{provider:u,displayApiKey:p,showApiKey:m,onToggleShowApiKey:F,onUpdateKey:A,providerEnvValues:_,onUpdateEnv:le,modelsLoading:v,onRefreshModels:j})}),t[31]=p,t[32]=A,t[33]=le,t[34]=v,t[35]=_,t[36]=j,t[37]=u,t[38]=m,t[39]=F,t[40]=I):I=t[40];let L;t[41]!==u.name||t[42]!==P||t[43]!==I?(L=(0,$.jsx)(Ae,{title:u.name,description:`Configure API keys and connection settings for this provider.`,action:P,children:I}),t[41]=u.name,t[42]=P,t[43]=I,t[44]=L):L=t[44];let z;t[45]!==w||t[46]!==E||t[47]!==ee?(z=e=>{ee(e),w(``),E(`alphabetical`)},t[45]=w,t[46]=E,t[47]=ee,t[48]=z):z=t[48];let B;t[49]===f?B=t[50]:(B=(0,$.jsx)(we,{balance:f}),t[49]=f,t[50]=B);let me;t[51]===u.name?me=t[52]:(me=u.name.toLowerCase(),t[51]=u.name,t[52]=me);let V=me===`openrouter`,H=x===`coding`?ne:D,he=x===`coding`?re:oe,ge=x===`coding`?ie:se,U;t[53]!==ue||t[54]!==O||t[55]!==te||t[56]!==T||t[57]!==x||t[58]!==v||t[59]!==w||t[60]!==E||t[61]!==V||t[62]!==H||t[63]!==he||t[64]!==ge?(U=(0,$.jsx)(ke,{tab:x,showImageTab:V,modelsLoading:v,models:H,hasApiKey:O,enabledModelIds:he,pendingChanges:ge,modelSearchQuery:te,onModelSearchQueryChange:w,modelSortBy:T,onModelSortByChange:E,onToggleAllModels:ue}),t[53]=ue,t[54]=O,t[55]=te,t[56]=T,t[57]=x,t[58]=v,t[59]=w,t[60]=E,t[61]=V,t[62]=H,t[63]=he,t[64]=ge,t[65]=U):U=t[65];let W;t[66]===y?W=t[67]:(W=y?(0,$.jsx)(R,{variant:`error`,className:`mb-4`,children:y}):null,t[66]=y,t[67]=W);let G;t[68]!==ne||t[69]!==re||t[70]!==ae||t[71]!==k||t[72]!==M||t[73]!==O||t[74]!==T||t[75]!==y||t[76]!==v||t[77]!==ie||t[78]!==u?(G=(0,$.jsx)(pe,{value:`coding`,children:(0,$.jsx)(Oe,{tab:`coding`,provider:u,models:ne,filteredModels:ae,modelsLoading:v,modelsError:y,hasApiKey:O,enabledModelIds:re,pendingChanges:ie,modelSortBy:T,getModelDisplayName:k,onToggleModel:M})}),t[68]=ne,t[69]=re,t[70]=ae,t[71]=k,t[72]=M,t[73]=O,t[74]=T,t[75]=y,t[76]=v,t[77]=ie,t[78]=u,t[79]=G):G=t[79];let _e;t[80]!==D||t[81]!==oe||t[82]!==ce||t[83]!==k||t[84]!==M||t[85]!==O||t[86]!==T||t[87]!==y||t[88]!==v||t[89]!==se||t[90]!==u?(_e=(0,$.jsx)(pe,{value:`image`,children:(0,$.jsx)(Oe,{tab:`image`,provider:u,models:D,filteredModels:ce,modelsLoading:v,modelsError:y,hasApiKey:O,enabledModelIds:oe,pendingChanges:se,modelSortBy:T,getModelDisplayName:k,onToggleModel:M})}),t[80]=D,t[81]=oe,t[82]=ce,t[83]=k,t[84]=M,t[85]=O,t[86]=T,t[87]=y,t[88]=v,t[89]=se,t[90]=u,t[91]=_e):_e=t[91];let K;t[92]===b?K=t[93]:(K=b?(0,$.jsx)(R,{variant:b.includes(`error`)||b.includes(`Failed`)?`error`:`success`,className:`mt-4`,children:b}):null,t[92]=b,t[93]=K);let q;t[94]!==B||t[95]!==U||t[96]!==W||t[97]!==G||t[98]!==_e||t[99]!==K?(q=(0,$.jsxs)(Ae,{title:`Models`,description:`Enable coding and image models for this provider.`,action:B,tableHeader:U,children:[W,G,_e,K]}),t[94]=B,t[95]=U,t[96]=W,t[97]=G,t[98]=_e,t[99]=K,t[100]=q):q=t[100];let J;t[101]!==x||t[102]!==q||t[103]!==z?(J=(0,$.jsx)(de,{value:x,onValueChange:z,children:q}),t[101]=x,t[102]=q,t[103]=z,t[104]=J):J=t[104];let Y;t[105]!==J||t[106]!==L?(Y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[L,J]})}),t[105]=J,t[106]=L,t[107]=Y):Y=t[107];let X;return t[108]!==Y||t[109]!==N?(X=(0,$.jsx)(`div`,{className:N,children:Y}),t[108]=Y,t[109]=N,t[110]=X):X=t[110],X}function Me(){return window.location.reload()}function Ne(e){return`providers:list:${e}`}async function Pe(){let[e,t]=await Promise.all([ae(),D().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}var Fe=`grid min-h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 hover:bg-muted/30 cursor-pointer`,Ie=`[&>*+*]:border-t [&>*+*]:border-table-border`;function Le(e){let t=(0,Z.c)(9),{title:n,description:r,action:i,children:a}=e,o;t[0]!==i||t[1]!==r||t[2]!==n?(o=(0,$.jsx)(H,{title:n,description:r,action:i,sticky:!1}),t[0]=i,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,$.jsx)(L,{className:`pt-6`,children:a}),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,$.jsxs)(ue,{className:`shrink-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Re(e){let t=(0,Z.c)(33),{loadVersion:n,onProviderClick:r}=e,{query:i,setQuery:a,deferredQuery:o}=q(),s;t[0]===n?s=t[1]:(s=Ne(n),t[0]=n,t[1]=s);let{providers:c,enabledModelCounts:u}=M(s,Pe),d;if(t[2]!==o||t[3]!==u||t[4]!==c){let e;t[6]===o?e=t[7]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=o,t[7]=e);let n;t[8]===u?n=t[9]:(n=(e,t)=>{let n=(u[e.slug]??0)>0,r=(u[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=u,t[9]=n),d=c.filter(Ve).filter(e).sort(n),t[2]=o,t[3]=u,t[4]=c,t[5]=d}else d=t[5];let f=d,p;if(t[10]!==o||t[11]!==c){let e;t[13]===o?e=t[14]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=o,t[14]=e),p=c.filter(Be).filter(e).sort(ze),t[10]=o,t[11]=c,t[12]=p}else p=t[12];let m=p,h;t[15]!==i||t[16]!==a?(h=(0,$.jsx)(K,{placeholder:`Search`,value:i,onChange:a,className:`mb-0 w-64`}),t[15]=i,t[16]=a,t[17]=h):h=t[17];let g;t[18]!==f||t[19]!==u||t[20]!==r||t[21]!==i?(g=f.length===0?(0,$.jsx)(`p`,{className:S(l.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,$.jsx)(`div`,{className:Ie,children:f.map(e=>(0,$.jsx)(Je,{provider:e,modelCount:u[e.slug]??0,onClick:r},e.name))}),t[18]=f,t[19]=u,t[20]=r,t[21]=i,t[22]=g):g=t[22];let _;t[23]!==h||t[24]!==g?(_=(0,$.jsx)(Le,{title:`Connected Providers`,description:`Providers you've connected with an API key or environment variable.`,action:h,children:g}),t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]!==m||t[27]!==r||t[28]!==i?(v=(0,$.jsx)(Le,{title:`Available Providers`,description:`Connect additional providers by adding your API key.`,children:m.length===0?(0,$.jsx)(`p`,{className:S(l.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,$.jsx)(`div`,{className:Ie,children:m.map(e=>(0,$.jsx)(Ye,{provider:e,onClick:r},e.name))})}),t[26]=m,t[27]=r,t[28]=i,t[29]=v):v=t[29];let y;return t[30]!==_||t[31]!==v?(y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[_,v]})}),t[30]=_,t[31]=v,t[32]=y):y=t[32],y}function ze(e,t){return e.name.localeCompare(t.name)}function Be(e){return!e.apiKey}function Ve(e){return e.apiKey}function He(){let e=(0,Z.c)(21),t=a(),{providerSlug:n}=i(),[r,o]=(0,Q.useState)(0),s=(0,Q.useRef)(n),c,l;e[0]!==r||e[1]!==n?(c=()=>{s.current&&!n&&(j(Ne(r)),o(Ke)),s.current=n},l=[n,r],e[0]=r,e[1]=n,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===t?u=e[5]:(u=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=u);let d=u,f;e[6]!==r||e[7]!==t?(f=()=>{t(`/settings/providers`),j(Ne(r)),o(Ge)},e[6]=r,e[7]=t,e[8]=f):f=e[8];let p=f,m;e[9]===r?m=e[10]:(m=function(){j(Ne(r)),o(We)},e[9]=r,e[10]=m);let h=m;if(n){let t=decodeURIComponent(n),r;return e[11]!==p||e[12]!==t?(r=(0,$.jsx)(je,{selectedProviderSlug:t,onBack:p}),e[11]=p,e[12]=t,e[13]=r):r=e[13],r}let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(le,{label:`Loading providers...`,size:`lg`}),e[14]=g):g=e[14];let _;e[15]!==d||e[16]!==r?(_=(0,$.jsx)(Q.Suspense,{fallback:g,children:(0,$.jsx)(Re,{loadVersion:r,onProviderClick:d},r)}),e[15]=d,e[16]=r,e[17]=_):_=e[17];let v;return e[18]!==h||e[19]!==_?(v=(0,$.jsx)(`div`,{className:`h-full min-h-0`,children:(0,$.jsx)(W,{fallbackTitle:`Failed to load providers`,onRetry:h,renderFallback:Ue,children:_})}),e[18]=h,e[19]=_,e[20]=v):v=e[20],v}function Ue(e,t){return(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(ue,{className:`shrink-0`,children:[(0,$.jsx)(H,{title:`Providers`,description:`Manage your AI provider connections and API keys.`,sticky:!1}),(0,$.jsx)(`div`,{className:`flex items-center justify-center px-6 pb-6 pt-6`,children:(0,$.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,$.jsx)(R,{variant:`error`,className:`mb-4`,children:e.message}),(0,$.jsx)(C,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function We(e){return e+1}function Ge(e){return e+1}function Ke(e){return e+1}function qe(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}function Je(e){let t=(0,Z.c)(25),{provider:n,modelCount:r,onClick:i}=e,a;t[0]!==i||t[1]!==n?(a=function(){i(n)},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===o?s=t[4]:(s=e=>qe(e,o),t[3]=o,t[4]=s);let c;t[5]===n?c=t[6]:(c=(0,$.jsx)(P,{provider:n}),t[5]=n,t[6]=c);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=S(l.label,`truncate leading-normal`),t[7]=u):u=t[7];let d;t[8]===n.name?d=t[9]:(d=(0,$.jsx)(`span`,{className:u,children:n.name}),t[8]=n.name,t[9]=d);let f;t[10]!==c||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,d]}),t[10]=c,t[11]=d,t[12]=f):f=t[12];let p;t[13]===n.isEnv?p=t[14]:(p=n.isEnv?(0,$.jsx)(ye,{variant:`secondary`,className:S(l.compact,`px-2 py-0.5`),children:`Environment`}):(0,$.jsx)(ye,{variant:`secondary`,className:S(l.compact,`px-2 py-0.5`),children:`API Key`}),t[13]=n.isEnv,t[14]=p);let m;t[15]===r?m=t[16]:(m=r>0&&(0,$.jsxs)(ye,{variant:`default`,className:S(l.compact,`px-2 py-0.5`),children:[r,` `,r===1?`Model`:`Models`]}),t[15]=r,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==o||t[21]!==s||t[22]!==f||t[23]!==h?(g=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:o,onKeyDown:s,children:[f,h]}),t[20]=o,t[21]=s,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function Ye(e){let t=(0,Z.c)(18),{provider:n,onClick:r}=e,i;t[0]!==r||t[1]!==n?(i=function(){r(n)},t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a?o=t[4]:(o=e=>qe(e,a),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=(0,$.jsx)(P,{provider:n}),t[5]=n,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=S(l.label,`truncate leading-normal`),t[7]=c):c=t[7];let u;t[8]===n.name?u=t[9]:(u=(0,$.jsx)(`span`,{className:c,children:n.name}),t[8]=n.name,t[9]=u);let d;t[10]!==s||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{className:S(l.compact,`shrink-0 text-muted-foreground`),children:`Configure`}),t[13]=f):f=t[13];let p;return t[14]!==a||t[15]!==o||t[16]!==d?(p=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:a,onKeyDown:o,children:[d,f]}),t[14]=a,t[15]=o,t[16]=d,t[17]=p):p=t[17],p}export{He as ProvidersListView,He as default};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as ee}from"./dist-BWuYHVi8.js";import{I as te}from"./dist-DIjomljy.js";import{t as n}from"./button-DeNw35VZ.js";import{i as r,n as i,r as a,t as o}from"./tooltip-B6ziVyTv.js";import{a as s,i as ne,o as re,r as ie,s as c,t as l}from"./dialog-Do98zzAW.js";import{Ft as u,Pt as d,Y as f,un as p,vt as ae}from"./index-DjaVbFDB.js";var oe=e(),m=t();function h(e){let t=(0,oe.c)(58),{open:h,onOpenChange:g,prTitle:_,onPrTitleChange:v,prDescription:y,onPrDescriptionChange:b,isGeneratingPRInfo:x,isLoading:S,onGeneratePRInfo:C,onCreatePR:w,currentBranch:T,createWorkspaceAfterPR:E,onCreateWorkspaceAfterPRChange:D}=e,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,m.jsx)(c,{children:`Create Pull Request`}),t[0]=O):O=t[0];let k;t[1]===T?k=t[2]:(k=(0,m.jsxs)(re,{children:[O,(0,m.jsxs)(ne,{children:[`Create a pull request for branch `,T]})]}),t[1]=T,t[2]=k);let A;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,m.jsx)(d,{htmlFor:`pr-title`,children:`Title`}),t[3]=A):A=t[3];let j=T||`Enter PR title...`,M;t[4]===v?M=t[5]:(M=e=>v(e.target.value),t[4]=v,t[5]=M);let N;t[6]!==x||t[7]!==_||t[8]!==j||t[9]!==M?(N=(0,m.jsxs)(`div`,{className:`grid gap-2`,children:[A,(0,m.jsx)(u,{id:`pr-title`,placeholder:j,value:_,onChange:M,disabled:x})]}),t[6]=x,t[7]=_,t[8]=j,t[9]=M,t[10]=N):N=t[10];let P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,m.jsx)(d,{htmlFor:`pr-description`,children:`Description`}),t[11]=P):P=t[11];let F;t[12]===b?F=t[13]:(F=e=>b(e.target.value),t[12]=b,t[13]=F);let I;t[14]!==x||t[15]!==y||t[16]!==F?(I=(0,m.jsx)(f,{id:`pr-description`,placeholder:`Enter PR description...`,value:y,onChange:F,disabled:x,className:`pr-10 h-full min-h-[14rem] resize-none`}),t[14]=x,t[15]=y,t[16]=F,t[17]=I):I=t[17];let L=x||S,R;t[18]===x?R=t[19]:(R=x?(0,m.jsx)(p,{}):(0,m.jsx)(te,{className:`h-3.5 w-3.5`}),t[18]=x,t[19]=R);let z;t[20]!==C||t[21]!==L||t[22]!==R?(z=(0,m.jsx)(r,{asChild:!0,children:(0,m.jsx)(n,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:C,disabled:L,children:R})}),t[20]=C,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B=x?`Generating PR description...`:`Generate PR title and description with AI`,V;t[24]===B?V=t[25]:(V=(0,m.jsx)(i,{children:B}),t[24]=B,t[25]=V);let H;t[26]!==z||t[27]!==V?(H=(0,m.jsx)(a,{children:(0,m.jsxs)(o,{children:[z,V]})}),t[26]=z,t[27]=V,t[28]=H):H=t[28];let U;t[29]!==H||t[30]!==I?(U=(0,m.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[P,(0,m.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[I,H]})]}),t[29]=H,t[30]=I,t[31]=U):U=t[31];let W;t[32]!==U||t[33]!==N?(W=(0,m.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[N,U]}),t[32]=U,t[33]=N,t[34]=W):W=t[34];let G;t[35]!==E||t[36]!==D?(G=(0,m.jsx)(ae,{value:E,onChange:D,ariaLabel:`Also create new workspace`}),t[35]=E,t[36]=D,t[37]=G):G=t[37];let K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,m.jsx)(d,{className:ee.labelNormal,children:`Also create new workspace`}),t[38]=K):K=t[38];let q;t[39]===G?q=t[40]:(q=(0,m.jsxs)(`div`,{className:`mr-auto flex items-center gap-3`,children:[G,K]}),t[39]=G,t[40]=q);let J=S||x,Y;t[41]===S?Y=t[42]:(Y=S?(0,m.jsxs)(m.Fragment,{children:[`Create PR`,(0,m.jsx)(p,{size:`sm`})]}):`Create PR`,t[41]=S,t[42]=Y);let X;t[43]!==w||t[44]!==J||t[45]!==Y?(X=(0,m.jsx)(n,{className:`ml-auto`,onClick:w,disabled:J,children:Y}),t[43]=w,t[44]=J,t[45]=Y,t[46]=X):X=t[46];let Z;t[47]!==q||t[48]!==X?(Z=(0,m.jsxs)(s,{className:`w-full items-center gap-4`,children:[q,X]}),t[47]=q,t[48]=X,t[49]=Z):Z=t[49];let Q;t[50]!==W||t[51]!==k||t[52]!==Z?(Q=(0,m.jsxs)(ie,{className:`flex max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:h-[min(36rem,85dvh)]`,children:[k,W,Z]}),t[50]=W,t[51]=k,t[52]=Z,t[53]=Q):Q=t[53];let $;return t[54]!==g||t[55]!==h||t[56]!==Q?($=(0,m.jsx)(l,{open:h,onOpenChange:g,children:Q}),t[54]=g,t[55]=h,t[56]=Q,t[57]=$):$=t[57],$}export{h as PullRequestDialog};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{E as r,Ut as i,pt as a}from"./dist-DIjomljy.js";import{t as o}from"./button-DeNw35VZ.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dialog-Do98zzAW.js";import{On as p}from"./index-DjaVbFDB.js";var m=e(),h=t();function g(e){let t=(0,m.c)(27),{open:g,onOpenChange:_,onCommitFirst:v,onStashAndPull:y,onCancel:b,isLoading:x}=e,S=x===void 0?!1:x,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,h.jsxs)(l,{children:[(0,h.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,h.jsx)(r,{className:`h-5 w-5 text-amber-500`}),`Uncommitted Changes Detected`]}),(0,h.jsx)(c,{children:`You have uncommitted changes. You need to handle them before pulling from the remote branch.`})]}),t[0]=C):C=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,h.jsx)(`div`,{className:n.bodyMuted,children:`Choose how you want to proceed:`}),t[1]=w):w=t[1];let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,h.jsx)(i,{className:`h-4 w-4 mr-2`}),t[2]=T):T=t[2];let E;t[3]!==S||t[4]!==v?(E=(0,h.jsxs)(o,{onClick:v,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[T,`Commit changes first, then pull`]}),t[3]=S,t[4]=v,t[5]=E):E=t[5];let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsx)(a,{className:`h-4 w-4 mr-2`}),t[6]=D):D=t[6];let O;t[7]!==S||t[8]!==y?(O=(0,h.jsxs)(o,{onClick:y,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[D,`Stash changes → Pull → Restore changes`]}),t[7]=S,t[8]=y,t[9]=O):O=t[9];let k;t[10]!==E||t[11]!==O?(k=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[E,O]}),t[10]=E,t[11]=O,t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,h.jsx)(`strong`,{children:`Commit first:`}),t[13]=A):A=t[13];let j;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsxs)(p,{variant:`hint`,className:`mt-4 mb-0`,children:[A,` Safe option, preserves changes in your commit history.`,(0,h.jsx)(`br`,{}),(0,h.jsx)(`strong`,{children:`Stash and pull:`}),` Temporary option, changes will be restored after pulling.`]}),t[14]=j):j=t[14];let M;t[15]===k?M=t[16]:(M=(0,h.jsx)(`div`,{className:`py-4`,children:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[w,k,j]})}),t[15]=k,t[16]=M);let N;t[17]!==S||t[18]!==b?(N=(0,h.jsx)(s,{children:(0,h.jsx)(o,{variant:`ghost`,onClick:b,disabled:S,children:`Cancel`})}),t[17]=S,t[18]=b,t[19]=N):N=t[19];let P;t[20]!==M||t[21]!==N?(P=(0,h.jsxs)(u,{className:`sm:max-w-[425px]`,children:[C,M,N]}),t[20]=M,t[21]=N,t[22]=P):P=t[22];let F;return t[23]!==_||t[24]!==g||t[25]!==P?(F=(0,h.jsx)(f,{open:g,onOpenChange:_,children:P}),t[23]=_,t[24]=g,t[25]=P,t[26]=F):F=t[26],F}export{g as PullWithChangesDialog};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{t as n}from"./button-DeNw35VZ.js";import{a as r,i,o as a,r as o,s,t as c}from"./dialog-Do98zzAW.js";var l=e(),u=t();function d(e){let t=(0,l.c)(15),{open:d,onOpenChange:f,isLoading:p,onPushAndCreatePR:m,onCancel:h}=e,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,u.jsxs)(a,{children:[(0,u.jsx)(s,{children:`Push Branch First`}),(0,u.jsx)(i,{children:`Your branch needs to be pushed to the remote before creating a pull request. Would you like to push it now?`})]}),t[0]=g):g=t[0];let _;t[1]!==p||t[2]!==h?(_=(0,u.jsx)(n,{variant:`outline`,onClick:h,disabled:p,children:`Cancel`}),t[1]=p,t[2]=h,t[3]=_):_=t[3];let v=p?`Pushing...`:`Push & Create PR`,y;t[4]!==p||t[5]!==m||t[6]!==v?(y=(0,u.jsx)(n,{onClick:m,disabled:p,children:v}),t[4]=p,t[5]=m,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==_||t[9]!==y?(b=(0,u.jsxs)(o,{children:[g,(0,u.jsxs)(r,{children:[_,y]})]}),t[8]=_,t[9]=y,t[10]=b):b=t[10];let x;return t[11]!==f||t[12]!==d||t[13]!==b?(x=(0,u.jsx)(c,{open:d,onOpenChange:f,children:b}),t[11]=f,t[12]=d,t[13]=b,t[14]=x):x=t[14],x}export{d as PushBeforePRDialog};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i=new class extends r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!T(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!T(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function T(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{o.setTimeout(t,e)})}function E(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function te(e){return e}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var D=Symbol();function O(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===D?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var M=s;function ae(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=M,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=ae(),P=new class extends r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function oe(e){return Math.min(1e3*2**e,3e4)}function F(e){return(e??`online`)===`online`?P.isOnline():!0}var I=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function L(e){let t=!1,n=0,r,a=j(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new I(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||P.isOnline())&&e.canRun(),d=()=>F(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(A.isServer()?0:3),a=e.retryDelay??oe,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ee(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var R=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}};function se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=O(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?re:ne;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?B:z,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:z(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function B(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ce(e,t){return t?z(e,t)!=null:!1}function le(e,t){return!t||!e.getPreviousPageParam?!1:B(e,t)!=null}var ue=class extends R{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=U(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=U(this.options);e.data!==void 0&&(this.setState(H(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=E(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===D||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>p(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!f(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=O(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=L({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof I&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof I){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...V(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...H(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function V(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function H(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function U(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var de=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),G(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return K(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return K(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof m(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&q(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&G(e,t),o=i&&q(e,n,t,r);(a||o)&&(l={...l,...V(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=E(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=E(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:J(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=j())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!S(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function W(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&m(t.retryOnMount,e)===!1)}function G(e,t){return W(e,t)||e.state.data!==void 0&&K(e,t,t.refetchOnMount)}function K(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&J(e,t)}return!1}function q(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&J(e,n)}function J(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function fe(e,t){return!S(e.getCurrentResult(),t)}var Y=e(t(),1),pe=n(),X=Y.createContext(void 0),Z=e=>{let t=Y.useContext(X);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},me=({client:e,children:t})=>(Y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,pe.jsx)(X.Provider,{value:e,children:t})),Q=Y.createContext(!1),he=()=>Y.useContext(Q);Q.Provider;function ge(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _e=Y.createContext(ge()),ve=()=>Y.useContext(_e),ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},be=e=>{Y.useEffect(()=>{e.clearReset()},[e])},xe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Se=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ce=(e,t)=>e.isLoading&&e.isFetching&&!t,we=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Te(e,t,n){let r=he(),i=ve(),a=Z(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Se(o),ye(o,i,s),be(i);let u=!a.getQueryCache().get(o.queryHash),[d]=Y.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(Y.useSyncExternalStore(Y.useCallback(e=>{let t=p?d.subscribe(N.batchCalls(e)):l;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),Y.useEffect(()=>{d.setOptions(o)},[o,d]),we(o,f))throw $(o,d,i);if(xe({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!A.isServer()&&Ce(f,r)&&(u?$(o,d,i):s?.promise)?.catch(l).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}var Ee={onboarding:{status:()=>[`onboarding`,`status`]},app:{update:()=>[`app`,`update`]},models:{enabled:e=>[`models`,`enabled`,e],enabledImage:e=>[`models`,`enabled-image`,e]},userTasks:e=>[`user-tasks`,e],threads:{files:e=>[`threads`,`files`,e]},conversations:{recent:()=>[`conversations`,`recent`]}};export{i as C,D as S,g as _,de as a,y as b,le as c,P as d,N as f,te as g,_ as h,Z as i,R as l,v as m,Te as n,ue as o,u as p,me as r,ce as s,Ee as t,L as u,h as v,r as w,p as x,l as y};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{g as i,h as a,n as o,t as s,u as c,xn as l}from"./dist-DIjomljy.js";import{c as u,t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./dist-mdooLpmq.js";import{t as p}from"./dist-OixawqbU.js";import{n as m,r as h,t as g}from"./dist-CWnEmdyL.js";import{t as _}from"./dist-CSssbxDI.js";var v=t(),y=e(n(),1),b=r(),x=`Radio`,[S,C]=a(x),[w,T]=S(x),E=y.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:a=!1,required:o,disabled:s,value:l=`on`,onCheck:d,form:f,...p}=e,[m,h]=y.useState(null),g=u(t,e=>h(e)),_=y.useRef(!1),v=m?f||!!m.closest(`form`):!0;return(0,b.jsxs)(w,{scope:n,checked:a,disabled:s,children:[(0,b.jsx)(c.button,{type:`button`,role:`radio`,"aria-checked":a,"data-state":j(a),"data-disabled":s?``:void 0,disabled:s,value:l,...p,ref:g,onClick:i(e.onClick,e=>{a||d?.(),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&(0,b.jsx)(A,{control:m,bubbles:!_.current,name:r,value:l,checked:a,required:o,disabled:s,form:f,style:{transform:`translateX(-100%)`}})]})});E.displayName=x;var D=`RadioIndicator`,O=y.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=T(D,n);return(0,b.jsx)(o,{present:r||a.checked,children:(0,b.jsx)(c.span,{"data-state":j(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});O.displayName=D;var k=`RadioBubbleInput`,A=y.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=y.useRef(null),s=u(o,a),l=_(n),d=f(t);return y.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(l!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[l,n,r]),(0,b.jsx)(c.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...d,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});A.displayName=k;function j(e){return e?`checked`:`unchecked`}var M=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],N=`RadioGroup`,[P,F]=a(N,[h,C]),I=h(),L=C(),[R,z]=P(N),B=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:l=!1,orientation:u,dir:d,loop:f=!0,onValueChange:h,...g}=e,_=I(n),v=p(d),[y,x]=s({prop:a,defaultProp:i??null,onChange:h,caller:N});return(0,b.jsx)(R,{scope:n,name:r,required:o,disabled:l,value:y,onValueChange:x,children:(0,b.jsx)(m,{asChild:!0,..._,orientation:u,dir:v,loop:f,children:(0,b.jsx)(c.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":u,"data-disabled":l?``:void 0,dir:v,...g,ref:t})})})});B.displayName=N;var V=`RadioGroupItem`,H=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...a}=e,o=z(V,n),s=o.disabled||r,c=I(n),l=L(n),d=y.useRef(null),f=u(t,d),p=o.value===a.value,m=y.useRef(!1);return y.useEffect(()=>{let e=e=>{M.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,b.jsx)(g,{asChild:!0,...c,focusable:!s,active:p,children:(0,b.jsx)(E,{disabled:s,required:o.required,checked:p,...l,...a,name:o.name,ref:f,onCheck:()=>o.onValueChange(a.value),onKeyDown:i(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:i(a.onFocus,()=>{m.current&&d.current?.click()})})})});H.displayName=V;var U=`RadioGroupIndicator`,W=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,b.jsx)(O,{...L(n),...r,ref:t})});W.displayName=U;var G=B,K=H,q=W,J=y.forwardRef((e,t)=>{let n=(0,v.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`grid gap-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,b.jsx)(G,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=G.displayName;var Y=y.forwardRef((e,t)=>{let n=(0,v.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`aspect-square h-4 w-4 rounded-full border border-brand text-brand ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,b.jsx)(q,{className:`flex items-center justify-center`,children:(0,b.jsx)(l,{className:`h-2.5 w-2.5 fill-current text-current`})}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,b.jsx)(K,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Y.displayName=K.displayName;export{Y as n,J as t};