@ai-development-environment/server 0.0.35 → 0.0.36

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 (161) hide show
  1. package/package.json +1 -1
  2. package/standalone/.next/BUILD_ID +1 -1
  3. package/standalone/.next/build-manifest.json +3 -3
  4. package/standalone/.next/prerender-manifest.json +3 -3
  5. package/standalone/.next/server/app/[locale]/actions/page_client-reference-manifest.js +1 -1
  6. package/standalone/.next/server/app/[locale]/agents/[id]/page_client-reference-manifest.js +1 -1
  7. package/standalone/.next/server/app/[locale]/agents/page_client-reference-manifest.js +1 -1
  8. package/standalone/.next/server/app/[locale]/analytics-events/page_client-reference-manifest.js +1 -1
  9. package/standalone/.next/server/app/[locale]/build-data/page_client-reference-manifest.js +1 -1
  10. package/standalone/.next/server/app/[locale]/builds/[buildId]/coverage/page_client-reference-manifest.js +1 -1
  11. package/standalone/.next/server/app/[locale]/builds/[buildId]/page_client-reference-manifest.js +1 -1
  12. package/standalone/.next/server/app/[locale]/builds/page_client-reference-manifest.js +1 -1
  13. package/standalone/.next/server/app/[locale]/codebases/[codebaseId]/page_client-reference-manifest.js +1 -1
  14. package/standalone/.next/server/app/[locale]/codebases/page_client-reference-manifest.js +1 -1
  15. package/standalone/.next/server/app/[locale]/codebases/repositories/[repositoryId]/page_client-reference-manifest.js +1 -1
  16. package/standalone/.next/server/app/[locale]/comments/page_client-reference-manifest.js +1 -1
  17. package/standalone/.next/server/app/[locale]/console-logs/page_client-reference-manifest.js +1 -1
  18. package/standalone/.next/server/app/[locale]/devices/[id]/page_client-reference-manifest.js +1 -1
  19. package/standalone/.next/server/app/[locale]/devices/enroll/page_client-reference-manifest.js +1 -1
  20. package/standalone/.next/server/app/[locale]/devices/page_client-reference-manifest.js +1 -1
  21. package/standalone/.next/server/app/[locale]/jira/cache/page_client-reference-manifest.js +1 -1
  22. package/standalone/.next/server/app/[locale]/jira/cache/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  23. package/standalone/.next/server/app/[locale]/jira/tickets/[issueKey]/page_client-reference-manifest.js +1 -1
  24. package/standalone/.next/server/app/[locale]/jira/tickets/page_client-reference-manifest.js +1 -1
  25. package/standalone/.next/server/app/[locale]/jobs/[jobId]/page_client-reference-manifest.js +1 -1
  26. package/standalone/.next/server/app/[locale]/page_client-reference-manifest.js +1 -1
  27. package/standalone/.next/server/app/[locale]/provisioning-profiles/[profileId]/page_client-reference-manifest.js +1 -1
  28. package/standalone/.next/server/app/[locale]/provisioning-profiles/page_client-reference-manifest.js +1 -1
  29. package/standalone/.next/server/app/[locale]/pull-requests/[owner]/[repository]/[number]/page_client-reference-manifest.js +1 -1
  30. package/standalone/.next/server/app/[locale]/pull-requests/page_client-reference-manifest.js +1 -1
  31. package/standalone/.next/server/app/[locale]/push-notifications/page_client-reference-manifest.js +1 -1
  32. package/standalone/.next/server/app/[locale]/settings/page_client-reference-manifest.js +1 -1
  33. package/standalone/.next/server/app/[locale]/skills/[skillId]/page_client-reference-manifest.js +1 -1
  34. package/standalone/.next/server/app/[locale]/skills/groups/[groupId]/page_client-reference-manifest.js +1 -1
  35. package/standalone/.next/server/app/[locale]/skills/groups/page_client-reference-manifest.js +1 -1
  36. package/standalone/.next/server/app/[locale]/skills/page_client-reference-manifest.js +1 -1
  37. package/standalone/.next/server/app/[locale]/skills/sync/[runId]/page_client-reference-manifest.js +1 -1
  38. package/standalone/.next/server/app/[locale]/tools/page_client-reference-manifest.js +1 -1
  39. package/standalone/.next/server/app/[locale]/unified-events/page_client-reference-manifest.js +1 -1
  40. package/standalone/.next/server/app/[locale]/usage/page_client-reference-manifest.js +1 -1
  41. package/standalone/.next/server/app/[locale]/worktrees/[worktreeId]/page_client-reference-manifest.js +1 -1
  42. package/standalone/.next/server/app/[locale]/worktrees/page_client-reference-manifest.js +1 -1
  43. package/standalone/.next/server/app/_global-error.html +1 -1
  44. package/standalone/.next/server/app/_global-error.rsc +1 -1
  45. package/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  46. package/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  47. package/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  48. package/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  49. package/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  50. package/standalone/.next/server/app/_not-found.html +1 -1
  51. package/standalone/.next/server/app/_not-found.rsc +1 -1
  52. package/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  53. package/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  54. package/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  55. package/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  56. package/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  57. package/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  58. package/standalone/.next/server/chunks/ssr/[root-of-the-server]__0v12ijp._.js +1 -1
  59. package/standalone/.next/server/chunks/ssr/_012q7w6._.js +1 -1
  60. package/standalone/.next/server/chunks/ssr/_07qmjrj._.js +1 -1
  61. package/standalone/.next/server/chunks/ssr/_0dquba3._.js +1 -1
  62. package/standalone/.next/server/chunks/ssr/_0t2jwg3._.js +1 -1
  63. package/standalone/.next/server/chunks/ssr/_1bzibio._.js +1 -1
  64. package/standalone/.next/server/chunks/ssr/_1h1k5ja._.js +1 -1
  65. package/standalone/.next/server/chunks/ssr/_1kle1nm._.js +1 -1
  66. package/standalone/.next/server/chunks/ssr/_1m50niy._.js +1 -1
  67. package/standalone/.next/server/chunks/ssr/_1pja493._.js +1 -1
  68. package/standalone/.next/server/chunks/ssr/_1y98hs-._.js +1 -1
  69. package/standalone/.next/server/chunks/ssr/_1z02bsk._.js +1 -1
  70. package/standalone/.next/server/chunks/ssr/src_components_agents_agent-detail_tsx_0lfa4ui._.js +2 -2
  71. package/standalone/.next/server/chunks/ssr/src_components_build-data_build-data-page_tsx_1t2rrh0._.js +2 -2
  72. package/standalone/.next/server/chunks/ssr/src_components_builds_build-detail-page_tsx_0q1lvps._.js +1 -1
  73. package/standalone/.next/server/chunks/ssr/src_components_builds_coverage-report-page_tsx_1nhwba1._.js +1 -1
  74. package/standalone/.next/server/chunks/ssr/src_components_devices_device-detail-page_tsx_1mut_l4._.js +1 -1
  75. package/standalone/.next/server/chunks/ssr/src_components_devices_devices-page_tsx_1y45lv2._.js +1 -1
  76. package/standalone/.next/server/chunks/ssr/src_components_github_pull-request-detail-page_tsx_1etlamp._.js +1 -1
  77. package/standalone/.next/server/chunks/ssr/src_components_jira_cache-page_tsx_1znt1yl._.js +1 -1
  78. package/standalone/.next/server/chunks/ssr/src_components_jira_ticket-detail-page_tsx_0vmf8nk._.js +2 -2
  79. package/standalone/.next/server/chunks/ssr/src_components_jira_tickets-page_tsx_0_ocldp._.js +1 -1
  80. package/standalone/.next/server/chunks/ssr/src_components_push-notifications_push-notifications-page_tsx_1c_b-t4._.js +1 -1
  81. package/standalone/.next/server/chunks/ssr/src_components_signing-assets_provisioning-profiles-page_tsx_1zr20o7._.js +1 -1
  82. package/standalone/.next/server/chunks/ssr/src_components_skills_skill-sync-page_tsx_15sidhb._.js +1 -1
  83. package/standalone/.next/server/chunks/ssr/src_components_skills_skills-page_tsx_0o1nlbg._.js +1 -1
  84. package/standalone/.next/server/chunks/ssr/src_components_worktrees_worktree-detail-page_tsx_1oexgu_._.js +1 -1
  85. package/standalone/.next/server/middleware-build-manifest.js +3 -3
  86. package/standalone/.next/server/pages/404.html +1 -1
  87. package/standalone/.next/server/pages/500.html +1 -1
  88. package/standalone/.next/server/server-reference-manifest.js +1 -1
  89. package/standalone/.next/server/server-reference-manifest.json +1 -1
  90. package/standalone/.next/static/chunks/{0rrwapb85e3vs.js → 0a8bo5bqge171.js} +1 -1
  91. package/standalone/.next/static/chunks/0bx-vj8k3jlsz.js +35 -0
  92. package/standalone/.next/static/chunks/{1z2n-kfxw0xxf.js → 0s_vkk_t0i4mg.js} +1 -1
  93. package/standalone/.next/static/chunks/12msdp4rhv6ti.js +7 -0
  94. package/standalone/.next/static/chunks/{1rvz2z_cov6ug.js → 15rske_fphtgw.js} +2 -2
  95. package/standalone/.next/static/chunks/19l74y4_uc81t.js +33 -0
  96. package/standalone/.next/static/chunks/{0elijgx6pfo7w.js → 1a5_4cpwnx9uu.js} +1 -1
  97. package/standalone/.next/static/chunks/1a9j-qydwrg8m.js +7 -0
  98. package/standalone/.next/static/chunks/1e-vykrs41myl.js +41 -0
  99. package/standalone/.next/static/chunks/1jwc4nasae27c.js +1 -0
  100. package/standalone/.next/static/chunks/1llwo8aslhpdp.js +1 -0
  101. package/standalone/.next/static/chunks/{2-k0gnjfr6ayw.js → 1nkkb5gu3-rhf.js} +1 -1
  102. package/standalone/.next/static/chunks/1oh9kzyxfy5ih.js +1 -0
  103. package/standalone/.next/static/chunks/1q87ulu5dp43f.js +1 -0
  104. package/standalone/.next/static/chunks/{2i8eu37_ggvr8.js → 1smbfkd1cb015.js} +10 -10
  105. package/standalone/.next/static/chunks/1ynnv9u7cfr4c.js +1 -0
  106. package/standalone/.next/static/chunks/1yx2no0f8qqs5.js +7 -0
  107. package/standalone/.next/static/chunks/{3kswwcsm5y95r.js → 1zw6r-idmbfgl.js} +1 -1
  108. package/standalone/.next/static/chunks/224rpxiffot1u.js +9 -0
  109. package/standalone/.next/static/chunks/24tqnzr1nzhom.js +1 -0
  110. package/standalone/.next/static/chunks/292r4qzwbnzg7.js +45 -0
  111. package/standalone/.next/static/chunks/{3zmi_6t6n2zhl.js → 29bdsmo8ketwt.js} +2 -2
  112. package/standalone/.next/static/chunks/{08n97leuqvfec.js → 29pirjk9q8gfx.js} +1 -1
  113. package/standalone/.next/static/chunks/{0gduhhe5i5fyj.js → 2bdfoatg4qo7w.js} +1 -1
  114. package/standalone/.next/static/chunks/{1mdi8gmbt3v4y.js → 2mzx47_wqfqf6.js} +1 -1
  115. package/standalone/.next/static/chunks/2rplo_7t3zrb9.js +1 -0
  116. package/standalone/.next/static/chunks/{0txd8z6bbq8sd.js → 2rv5r0dwu0nv6.js} +1 -1
  117. package/standalone/.next/static/chunks/2u51t_6-1w566.js +1 -0
  118. package/standalone/.next/static/chunks/{3fdxq7wzqx26o.js → 2xgehciyxxmdl.js} +1 -1
  119. package/standalone/.next/static/chunks/34pq01spesbci.js +1 -0
  120. package/standalone/.next/static/chunks/34pqiakzvfxgg.js +1 -0
  121. package/standalone/.next/static/chunks/{3g004cn7om3tw.js → 35hg231a8ig1t.js} +1 -1
  122. package/standalone/.next/static/chunks/36r84wnfwt4kn.css +1 -0
  123. package/standalone/.next/static/chunks/{11x96hq8bk827.js → 37dd1jthysw7j.js} +1 -1
  124. package/standalone/.next/static/chunks/{2cohukhgw3x39.js → 384f6qhpff4pn.js} +3 -3
  125. package/standalone/.next/static/chunks/3_xim7hqyyfr0.js +1 -0
  126. package/standalone/.next/static/chunks/3eumqpi7f1fek.js +30 -0
  127. package/standalone/.next/static/chunks/{1209uyjs06prv.js → 3hq055db_1oe4.js} +1 -1
  128. package/standalone/.next/static/chunks/3ns362pjxzs4s.js +3 -0
  129. package/standalone/.next/static/chunks/3ojl4tmmy52v4.js +29 -0
  130. package/standalone/.next/static/chunks/3sxc882-vifa-.js +10 -0
  131. package/standalone/.next/static/chunks/40k5mbsz_tzvi.js +1 -0
  132. package/standalone/.next/static/chunks/43pkxbd7uiq6-.js +33 -0
  133. package/standalone/.next/static/chunks/00vmfj3b0p_9v.js +0 -1
  134. package/standalone/.next/static/chunks/05qk7dn22ctyw.js +0 -33
  135. package/standalone/.next/static/chunks/08b5rziqjcmmv.js +0 -9
  136. package/standalone/.next/static/chunks/0hcrlyp4czqm4.js +0 -33
  137. package/standalone/.next/static/chunks/0kkylz4dfb-6-.css +0 -1
  138. package/standalone/.next/static/chunks/0ouxq2tjuuo5p.js +0 -1
  139. package/standalone/.next/static/chunks/0qslkhjg4g4wo.js +0 -1
  140. package/standalone/.next/static/chunks/0sgv58x3pi1lt.js +0 -1
  141. package/standalone/.next/static/chunks/1-uwntvgs-8hy.js +0 -7
  142. package/standalone/.next/static/chunks/175wjcrz57-r8.js +0 -3
  143. package/standalone/.next/static/chunks/1aymjnttvjkz8.js +0 -35
  144. package/standalone/.next/static/chunks/1p0jamt--jvn2.js +0 -1
  145. package/standalone/.next/static/chunks/1wm2l6ainzpua.js +0 -30
  146. package/standalone/.next/static/chunks/2aaudeflwvhrw.js +0 -1
  147. package/standalone/.next/static/chunks/2jj9hlwqhy5pr.js +0 -41
  148. package/standalone/.next/static/chunks/2ldet81o6fvx9.js +0 -7
  149. package/standalone/.next/static/chunks/2nnls3_0a15ot.js +0 -1
  150. package/standalone/.next/static/chunks/32ynps2o_ve-q.js +0 -10
  151. package/standalone/.next/static/chunks/3812zpxehpne1.js +0 -1
  152. package/standalone/.next/static/chunks/398-3q0cwr6rj.js +0 -29
  153. package/standalone/.next/static/chunks/3f0s63l_3ts3k.js +0 -1
  154. package/standalone/.next/static/chunks/3ognjxt-gne6-.js +0 -1
  155. package/standalone/.next/static/chunks/3q82abj2-3h1-.js +0 -1
  156. package/standalone/.next/static/chunks/3zux6x75u6-5-.js +0 -1
  157. package/standalone/.next/static/chunks/4260c5fq33ytz.js +0 -7
  158. package/standalone/.next/static/chunks/448r-ornlfrsf.js +0 -45
  159. /package/standalone/.next/static/{7EXYkB15Ckf6ytAAy22z6 → _yJljIblhKpKw6X4lPPg3}/_buildManifest.js +0 -0
  160. /package/standalone/.next/static/{7EXYkB15Ckf6ytAAy22z6 → _yJljIblhKpKw6X4lPPg3}/_clientMiddlewareManifest.js +0 -0
  161. /package/standalone/.next/static/{7EXYkB15Ckf6ytAAy22z6 → _yJljIblhKpKw6X4lPPg3}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
1
  module.exports=[775524,a=>{"use strict";var b=a.i(187924),c=a.i(390702),d=a.i(589027),e=a.i(141146),f=a.i(37470),g=a.i(164831);let h=(0,g.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var i=a.i(590629),j=a.i(403512),k=a.i(519783),l=a.i(639466);let m=(0,g.default)("table-2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);var n=a.i(980180),o=a.i(415925),p=a.i(50944),q=a.i(572131),r=a.i(844873),s=a.i(674215),t=a.i(785668),u=a.i(124348),v=a.i(786304),w=a.i(699570),x=a.i(591119),y=a.i(315055),z=a.i(814574),A=a.i(335732),B=a.i(46524),C=a.i(866718),D=a.i(779711),E=a.i(870430),F=a.i(580701),G=a.i(668684),H=a.i(206015),I=a.i(875083),J=a.i(429246),K=a.i(460280);let L="id projectId name kind value boardId position",M=`id jiraId key name avatarUrl position ticketAssignmentFilter hideCompletedTickets completedStatusIds branchNamingScript sources { ${L} }`,N=`source { ${L} } tickets { id key summary statusId status statusCategory issueType priority assignee assigneeAccountId assigneeAvatarUrl projectKey updatedAt } statusOrder cache { source stale fetchedAt } truncated warnings`,O={highest:"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300",high:"border-orange-500/30 bg-orange-500/10 text-orange-700 dark:text-orange-300",medium:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",low:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",lowest:"border-slate-500/30 bg-slate-500/10 text-slate-700 dark:text-slate-300"};function P(a){let b=new URLSearchParams(window.location.search);for(let[c,d]of Object.entries(a))d?b.set(c,d):b.delete(c);let c=b.toString();window.history.pushState(null,"",`${window.location.pathname}${c?`?${c}`:""}`)}function Q(a){return O[a.trim().toLowerCase()]}function R({statuses:a,value:c,onChange:e,label:f,placeholder:g,disabled:h}){let i=new Set(c);return(0,b.jsxs)(A.DropdownMenu,{children:[(0,b.jsx)(A.DropdownMenuTrigger,{asChild:!0,children:(0,b.jsxs)(w.Button,{"aria-label":f,className:"w-full justify-between font-normal",disabled:h,type:"button",variant:"outline",children:[(0,b.jsx)("span",{className:"truncate",children:c.length>0?`${c.length} ${f}`:g}),(0,b.jsx)(d.ChevronDown,{className:"shrink-0"})]})}),(0,b.jsx)(A.DropdownMenuContent,{align:"start",className:"z-60 max-h-64",children:a.map(a=>(0,b.jsxs)(A.DropdownMenuCheckboxItem,{checked:i.has(a.id),onCheckedChange:b=>e(b?[...i,a.id]:c.filter(b=>b!==a.id)),onSelect:a=>a.preventDefault(),children:[(0,b.jsx)("span",{className:"truncate",children:a.name}),(0,b.jsx)("span",{className:"ml-auto mr-5 pl-2 text-xs text-muted-foreground",children:a.category})]},a.id))})]})}function S({open:a,setOpen:c,projects:d,selectedProjectId:e,onProjectsChanged:f}){let g=(0,o.useTranslations)("jiraTickets"),h=(0,o.useTranslations)("common"),[k,l]=(0,q.useState)([]),[m,p]=(0,q.useState)(""),[s,t]=(0,q.useState)(null),[v,x]=(0,q.useState)(""),[A,B]=(0,q.useState)("JQL"),[G,H]=(0,q.useState)(""),[I,L]=(0,q.useState)(null),[N,O]=(0,q.useState)([]),[Q,T]=(0,q.useState)(!1),[U,V]=(0,q.useState)("ALL"),[W,X]=(0,q.useState)(!1),[Y,Z]=(0,q.useState)([]),[$,_]=(0,q.useState)(""),[aa,ab]=(0,q.useState)(!1),[ac,ad]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(!a)return;let b=window.setTimeout(async()=>{try{let a=await (0,K.controlPlaneRequest)("query { jiraAvailableProjects { jiraId key name avatarUrl } }");l(a.jiraAvailableProjects)}catch(a){ad(a instanceof Error?a.message:String(a))}},0);return()=>window.clearTimeout(b)},[a]);let ae=d.find(a=>a.id===s)??d.find(a=>a.id===e)??d[0]??null,af=k.filter(a=>!d.some(b=>b.jiraId===a.jiraId));(0,q.useEffect)(()=>{if(!a||!ae)return;let b=!1,c=window.setTimeout(async()=>{V(ae.ticketAssignmentFilter),X(ae.hideCompletedTickets),Z(ae.completedStatusIds),_(ae.branchNamingScript??""),T(!0);try{let a=await (0,K.controlPlaneRequest)("query JiraProjectStatuses($projectId: ID!) { jiraProjectStatuses(projectId: $projectId) { id name category } }",{projectId:ae.id});if(b)return;O(a.jiraProjectStatuses),ad(null)}catch(a){if(b)return;ad(a instanceof Error?a.message:String(a)),O([])}finally{b||T(!1)}},0);return()=>{b=!0,window.clearTimeout(c)}},[a,ae]);let ag=async()=>{if(m){ab(!0);try{let a=await (0,K.controlPlaneRequest)(`mutation AddJiraProject($jiraId: ID!) { addJiraProject(jiraId: $jiraId) { ${M} } }`,{jiraId:m});f(a.addJiraProject);let b=a.addJiraProject.find(a=>a.jiraId===m);b&&t(b.id),p(""),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}}},ah=async a=>{ab(!0);try{let b=await (0,K.controlPlaneRequest)(`mutation RemoveJiraProject($projectId: ID!) { removeJiraProject(projectId: $projectId) { ${M} } }`,{projectId:a});f(b.removeJiraProject),a===ae?.id&&t(b.removeJiraProject[0]?.id??null),P({project:b.removeJiraProject[0]?.id??null,source:b.removeJiraProject[0]?.sources[0]?.id??null,issue:null}),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}},ai=async a=>{if(a.preventDefault(),ae){ab(!0);try{let a=I?`mutation UpdateJiraSource($input: UpdateJiraSourceInput!) { updateJiraSource(input: $input) { ${M} } }`:`mutation CreateJiraSource($input: CreateJiraSourceInput!) { createJiraSource(input: $input) { ${M} } }`,b=I?{id:I.id,name:v,kind:A,value:G}:{projectId:ae.id,name:v,kind:A,value:G},c=await (0,K.controlPlaneRequest)(a,{input:b});f(I?c.updateJiraSource:c.createJiraSource),x(""),H(""),B("JQL"),L(null),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}}},aj=async a=>{ab(!0);try{let b=await (0,K.controlPlaneRequest)(`mutation DeleteJiraSource($id: ID!) { deleteJiraSource(id: $id) { ${M} } }`,{id:a});f(b.deleteJiraSource);let c=b.deleteJiraSource.find(a=>a.id===ae?.id);P({source:c?.sources[0]?.id??null,issue:null}),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}},ak=async()=>{if(ae){ab(!0);try{let a={projectId:ae.id,ticketAssignmentFilter:U,hideCompletedTickets:W,completedStatusIds:Y},b=await (0,K.controlPlaneRequest)(`mutation UpdateJiraProjectDisplaySettings($input: UpdateJiraProjectDisplaySettingsInput!) { updateJiraProjectDisplaySettings(input: $input) { ${M} } }`,{input:a});f(b.updateJiraProjectDisplaySettings),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}}},al=async()=>{if(ae){ab(!0);try{let a=await (0,K.controlPlaneRequest)(`mutation UpdateJiraProjectBranchNaming($projectId: ID!, $branchNamingScript: String!) {
2
2
  updateJiraProjectBranchNaming(projectId: $projectId, branchNamingScript: $branchNamingScript) { ${M} }
3
- }`,{projectId:ae.id,branchNamingScript:$});f(a.updateJiraProjectBranchNaming),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}}};return(0,b.jsx)(z.Dialog,{onOpenChange:a=>{a||t(null),c(a)},open:a,children:(0,b.jsxs)(z.DialogContent,{className:"overflow-x-hidden sm:max-w-4xl",children:[(0,b.jsxs)(z.DialogHeader,{children:[(0,b.jsx)(z.DialogTitle,{children:g("manageTitle")}),(0,b.jsx)(z.DialogDescription,{children:g("manageDescription")})]}),ac&&(0,b.jsx)(u.Alert,{variant:"destructive",children:(0,b.jsx)(u.AlertDescription,{children:ac})}),(0,b.jsxs)("div",{className:"grid min-w-0 gap-6 md:grid-cols-2",children:[(0,b.jsxs)("section",{className:"min-w-0 space-y-3",children:[(0,b.jsx)("h3",{className:"font-medium",children:g("projects")}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(F.Select,{onValueChange:p,value:m,children:[(0,b.jsx)(F.SelectTrigger,{"aria-label":g("availableProjects"),className:"w-full",children:(0,b.jsx)(F.SelectValue,{placeholder:g("selectProject")})}),(0,b.jsx)(F.SelectContent,{className:"z-60",children:af.map(a=>(0,b.jsxs)(F.SelectItem,{value:a.jiraId,children:[a.key," · ",a.name]},a.jiraId))})]}),(0,b.jsxs)(w.Button,{disabled:!m||aa,onClick:()=>void ag(),size:"icon",children:[(0,b.jsx)(j.Plus,{}),(0,b.jsx)("span",{className:"sr-only",children:g("addProject")})]})]}),(0,b.jsx)("div",{className:"space-y-2",children:d.map(a=>(0,b.jsxs)(D.Item,{className:`min-w-0 gap-2 p-1 ${a.id===ae?.id?"border-primary bg-primary/5":""}`,variant:"outline",children:[(0,b.jsxs)(w.Button,{"aria-pressed":a.id===ae?.id,className:"h-auto min-w-0 flex-1 flex-col items-start p-2 text-left whitespace-normal",onClick:()=>{t(a.id),L(null),x(""),H(""),B("JQL")},type:"button",variant:"ghost",children:[(0,b.jsxs)("p",{className:"truncate text-sm font-medium",children:[a.key," · ",a.name]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g("sourceCount",{count:a.sources.length})})]}),(0,b.jsx)(r.ConfirmationDialog,{actionLabel:g("removeProject"),cancelLabel:h("cancel"),description:h("cannotBeUndone"),onConfirm:()=>ah(a.id),title:g("confirmRemoveProject"),trigger:(0,b.jsxs)(w.Button,{disabled:aa,size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(n.Trash2,{}),(0,b.jsx)("span",{className:"sr-only",children:g("removeProject")})]})})]},a.id))})]}),(0,b.jsxs)("section",{className:"min-w-0 space-y-3",children:[(0,b.jsx)("h3",{className:"font-medium",children:g("sourcesFor",{project:ae?.key??"—"})}),ae?.sources.map(a=>(0,b.jsxs)(D.Item,{className:"min-w-0 items-start gap-2 overflow-hidden",variant:"outline",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium",children:a.name}),(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground",children:[(0,b.jsxs)("span",{className:"shrink-0",children:[a.kind," ·"]}),(0,b.jsx)("span",{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [direction:rtl] md:[direction:ltr]",children:(0,b.jsx)("bdi",{children:a.value})})]})]}),(0,b.jsxs)("div",{className:"flex shrink-0",children:[(0,b.jsxs)(w.Button,{onClick:()=>{L(a),x(a.name),B(a.kind),H(a.value)},size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(i.Pencil,{}),(0,b.jsx)("span",{className:"sr-only",children:g("editSource")})]}),(0,b.jsx)(r.ConfirmationDialog,{actionLabel:g("deleteSource"),cancelLabel:h("cancel"),description:h("cannotBeUndone"),onConfirm:()=>aj(a.id),title:g("confirmDeleteSource"),trigger:(0,b.jsxs)(w.Button,{disabled:aa,size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(n.Trash2,{}),(0,b.jsx)("span",{className:"sr-only",children:g("deleteSource")})]})})]})]},a.id)),ae&&(0,b.jsxs)("form",{className:"min-w-0 space-y-3 rounded-lg border p-3",onSubmit:a=>void ai(a),children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-name",children:g("sourceName")}),(0,b.jsx)(C.Input,{id:"source-name",maxLength:100,onChange:a=>x(a.target.value),required:!0,value:v})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-kind",children:g("sourceType")}),(0,b.jsxs)(F.Select,{onValueChange:a=>B(a),value:A,children:[(0,b.jsx)(F.SelectTrigger,{className:"w-full",id:"source-kind",children:(0,b.jsx)(F.SelectValue,{})}),(0,b.jsxs)(F.SelectContent,{className:"z-60",children:[(0,b.jsx)(F.SelectItem,{value:"JQL",children:"JQL"}),(0,b.jsx)(F.SelectItem,{value:"BOARD",children:g("boardUrl")})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-value",children:"JQL"===A?"JQL":g("boardUrl")}),(0,b.jsx)(J.Textarea,{id:"source-value",onChange:a=>H(a.target.value),required:!0,value:G})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[I&&(0,b.jsx)(w.Button,{onClick:()=>{L(null),x(""),H("")},type:"button",variant:"ghost",children:g("cancel")}),(0,b.jsx)(w.Button,{disabled:aa,type:"submit",children:I?g("saveSource"):g("addSource")})]})]}),ae&&(0,b.jsxs)("section",{className:"min-w-0 space-y-3 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h4",{className:"text-sm font-medium",children:g("displaySettings")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:g("displaySettingsDescription")})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"ticket-assignment-filter",children:g("ticketsToShow")}),(0,b.jsxs)(F.Select,{onValueChange:a=>V(a),value:U,children:[(0,b.jsx)(F.SelectTrigger,{className:"w-full",id:"ticket-assignment-filter",children:(0,b.jsx)(F.SelectValue,{})}),(0,b.jsxs)(F.SelectContent,{className:"z-60",children:[(0,b.jsx)(F.SelectItem,{value:"ALL",children:g("allTickets")}),(0,b.jsx)(F.SelectItem,{value:"UNASSIGNED_OR_SELF",children:g("unassignedOrSelfAssigned")}),(0,b.jsx)(F.SelectItem,{value:"SELF_IN_PROGRESS",children:g("selfAssignedInProgress")})]})]})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,b.jsx)(y.Checkbox,{checked:W,className:"mt-0.5",id:"hide-completed-tickets",onCheckedChange:a=>X(!0===a)}),(0,b.jsx)(E.Label,{className:"block leading-normal",htmlFor:"hide-completed-tickets",children:(0,b.jsxs)("span",{children:[(0,b.jsx)("span",{className:"block font-medium",children:g("hideCompletedTickets")}),(0,b.jsx)("span",{className:"block text-xs text-muted-foreground",children:g("hideCompletedTicketsDescription")})]})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"mb-1 text-xs font-medium",children:g("completedStatuses")}),(0,b.jsx)(R,{disabled:!W||Q,label:g("completedStatuses"),onChange:Z,placeholder:Q?g("loadingStatuses"):g("selectCompletedStatuses"),statuses:N,value:Y})]}),(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsx)(w.Button,{disabled:aa,onClick:()=>void ak(),type:"button",children:g("saveDisplaySettings")})})]}),ae&&(0,b.jsxs)("section",{className:"min-w-0 space-y-3 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h4",{className:"text-sm font-medium",children:g("branchNaming")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:g("branchNamingDescription")})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"jira-branch-naming-script",children:g("branchNamingFunction")}),(0,b.jsx)(J.Textarea,{className:"min-h-48 font-mono text-xs",id:"jira-branch-naming-script",onChange:a=>_(a.target.value),spellCheck:!1,value:$}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:g("branchNamingFunctionHelp")})]}),(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsx)(w.Button,{disabled:aa||!$.trim(),onClick:()=>void al(),type:"button",children:g("saveBranchNaming")})})]})]})]}),(0,b.jsx)(z.DialogFooter,{children:(0,b.jsx)(w.Button,{onClick:()=>c(!1),variant:"outline",children:g("done")})})]})})}a.s(["JiraTicketsPage",0,function(){let a=(0,o.useTranslations)("jiraTickets"),g=(0,p.useSearchParams)(),[i,n]=(0,q.useState)([]),[r,y]=(0,q.useState)(null),[z,A]=(0,q.useState)(!0),[C,D]=(0,q.useState)(!1),[E,F]=(0,q.useState)(null),[J,L]=(0,q.useState)(!1),[O,R]=(0,q.useState)("table"),[T,U]=(0,q.useState)(()=>new Set),V=g.get("project"),W=g.get("source"),X=g.get("issue"),Y=i.find(a=>a.id===V)??i[0]??null,Z=Y?.sources.find(a=>a.id===W)??Y?.sources[0]??null,$=(0,q.useRef)(0),_=r?.source.id===Z?.id?r:null,aa=(0,q.useCallback)(async()=>{try{let a=await (0,K.controlPlaneRequest)(`query JiraProjects { jiraProjects { ${M} } }`);n(a.jiraProjects),F(null)}catch(a){F(a instanceof Error?a.message:String(a))}finally{A(!1)}},[]);(0,q.useEffect)(()=>{let a=window.setTimeout(()=>void aa(),0);return()=>window.clearTimeout(a)},[aa]),(0,q.useEffect)(()=>{if(!Y)return;let a={};V!==Y.id&&(a.project=Y.id),Z&&W!==Z.id&&(a.source=Z.id),Object.keys(a).length>0&&P(a)},[V,W,Y,Z]);let ab=(0,q.useCallback)(async(a,b=!1)=>{let c=++$.current;D(!0),y(b=>b?.source.id===a?b:null);try{let d=b?`mutation RefreshJiraSource($sourceId: ID!) { refreshJiraSource(sourceId: $sourceId) { ${N} } }`:`query JiraTicketBoard($sourceId: ID!) { jiraTicketBoard(sourceId: $sourceId) { ${N} } }`,e=await (0,K.controlPlaneRequest)(d,{sourceId:a});if(c!==$.current)return;y(b?e.refreshJiraSource:e.jiraTicketBoard),F(null)}catch(a){if(c!==$.current)return;F(a instanceof Error?a.message:String(a)),y(null)}finally{c===$.current&&D(!1)}},[]),ac=(0,q.useCallback)(()=>{Z&&ab(Z.id)},[ab,Z]);(0,q.useEffect)(()=>{if(!Z){$.current+=1;let a=window.setTimeout(()=>{y(null),D(!1)},0);return()=>window.clearTimeout(a)}let a=window.setTimeout(()=>void ab(Z.id),0);return()=>{window.clearTimeout(a),$.current+=1}},[ab,Z]);let ad=(0,q.useMemo)(()=>{let a=new Map;for(let b of _?.statusOrder??[])a.set(b,[]);for(let b of _?.tickets??[]){let c=a.get(b.status)??[];c.push(b),a.set(b.status,c)}return[...a.entries()]},[_]),ae=a=>{U(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1600px] flex-col gap-5",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:a("title")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(w.Button,{onClick:()=>R(a=>"table"===a?"board":"table"),variant:"outline",children:["table"===O?(0,b.jsx)(f.Columns3,{}):(0,b.jsx)(m,{}),"table"===O?a("showBoardLayout"):a("showTableLayout")]}),(0,b.jsxs)(w.Button,{disabled:!Z||C,onClick:()=>Z&&void ab(Z.id,!0),variant:"outline",children:[(0,b.jsx)(k.RefreshCw,{className:C?"animate-spin":void 0}),a("refresh")]}),(0,b.jsxs)(w.Button,{onClick:()=>L(!0),children:[(0,b.jsx)(l.Settings2,{}),a("manage")]})]})]}),E&&(0,b.jsx)(u.Alert,{variant:"destructive",children:(0,b.jsx)(u.AlertDescription,{children:E})}),z?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(G.Spinner,{}),a("loading")]}):0===i.length?(0,b.jsxs)(B.Empty,{className:"border py-10",children:[(0,b.jsxs)(B.EmptyHeader,{children:[(0,b.jsx)(B.EmptyMedia,{variant:"icon",children:(0,b.jsx)(h,{})}),(0,b.jsx)(B.EmptyTitle,{children:a("emptyProjects")}),(0,b.jsx)(B.EmptyDescription,{children:a("emptyProjectsDescription")})]}),(0,b.jsxs)(w.Button,{className:"mt-4",onClick:()=>L(!0),children:[(0,b.jsx)(j.Plus,{}),a("addProject")]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"overflow-x-auto pb-1",children:(0,b.jsx)(I.Tabs,{value:Y?.id,onValueChange:a=>{let b=i.find(b=>b.id===a);P({project:a,source:b?.sources[0]?.id??null,issue:null})},children:(0,b.jsx)(I.TabsList,{"aria-label":a("projectTabs"),children:i.map(a=>(0,b.jsx)(I.TabsTrigger,{value:a.id,children:a.key},a.id))})})}),Y&&Y.sources.length>1?(0,b.jsx)("div",{className:"overflow-x-auto border-b pb-3",children:(0,b.jsx)(I.Tabs,{value:Z?.id,onValueChange:a=>P({source:a,issue:null}),children:(0,b.jsx)(I.TabsList,{"aria-label":a("sourceTabs"),variant:"line",children:Y.sources.map(a=>(0,b.jsx)(I.TabsTrigger,{value:a.id,children:a.name},a.id))})})}):Y?.sources.length===0?(0,b.jsxs)(B.Empty,{className:"border py-8",children:[(0,b.jsxs)(B.EmptyHeader,{children:[(0,b.jsx)(B.EmptyTitle,{children:a("emptySources")}),(0,b.jsx)(B.EmptyDescription,{children:a("emptySourcesDescription")})]}),(0,b.jsxs)(w.Button,{className:"mt-4",onClick:()=>L(!0),children:[(0,b.jsx)(j.Plus,{}),a("addSource")]})]}):null,_?.cache.stale&&(0,b.jsxs)(u.Alert,{className:"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-300",children:[(0,b.jsx)(c.AlertTriangle,{}),(0,b.jsx)(u.AlertDescription,{className:"text-current",children:a("staleWarning")})]}),_?.truncated&&(0,b.jsx)(u.Alert,{className:"bg-muted",children:(0,b.jsx)(u.AlertDescription,{children:a("truncatedWarning")})}),_?.warnings.map(a=>(0,b.jsx)(u.Alert,{className:"bg-muted",children:(0,b.jsx)(u.AlertDescription,{children:a})},a)),Z&&C&&!_?(0,b.jsxs)("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-foreground",children:[(0,b.jsx)(G.Spinner,{}),a("loadingTickets")]}):_&&0===_.tickets.length?(0,b.jsx)(B.Empty,{className:"border py-10",children:(0,b.jsx)(B.EmptyHeader,{children:(0,b.jsx)(B.EmptyDescription,{children:a("emptyTickets")})})}):_?"table"===O?(0,b.jsx)("div",{className:"space-y-5 pb-4",children:ad.map(([c,f])=>(0,b.jsxs)(x.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(x.CardHeader,{className:T.has(c)?"bg-muted/40 py-3":"border-b bg-muted/40 py-3",children:(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsx)(w.Button,{"aria-expanded":!T.has(c),className:"-m-2 h-auto min-w-0 flex-1 justify-start p-2 text-left aria-expanded:bg-transparent aria-expanded:hover:bg-muted dark:aria-expanded:bg-transparent dark:aria-expanded:hover:bg-muted/50",onClick:()=>ae(c),type:"button",variant:"ghost",children:(0,b.jsx)("span",{className:"truncate font-medium",children:c})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center justify-end gap-2",children:[(0,b.jsx)(v.Badge,{children:f.length}),(0,b.jsx)(w.Button,{"aria-expanded":!T.has(c),"aria-label":a(T.has(c)?"expandStatus":"collapseStatus",{status:c}),className:"aria-expanded:bg-transparent aria-expanded:hover:bg-muted dark:aria-expanded:bg-transparent dark:aria-expanded:hover:bg-muted/50",onClick:()=>ae(c),size:"icon-sm",title:a(T.has(c)?"expandStatus":"collapseStatus",{status:c}),type:"button",variant:"ghost",children:T.has(c)?(0,b.jsx)(e.ChevronRight,{className:"size-5"}):(0,b.jsx)(d.ChevronDown,{className:"size-5"})})]})]})}),!T.has(c)&&(0,b.jsx)(x.CardContent,{className:"px-0",children:(0,b.jsxs)(H.Table,{children:[(0,b.jsx)(H.TableHeader,{children:(0,b.jsxs)(H.TableRow,{className:"hover:bg-transparent",children:[(0,b.jsx)(H.TableHead,{children:a("ticket")}),(0,b.jsx)(H.TableHead,{children:a("issueType")}),(0,b.jsx)(H.TableHead,{children:a("priority")}),(0,b.jsx)(H.TableHead,{children:a("assignee")}),(0,b.jsx)(H.TableHead,{children:a("updated")})]})}),(0,b.jsx)(H.TableBody,{children:f.map(c=>{var d;return(0,b.jsxs)(H.TableRow,{children:[(0,b.jsx)(H.TableCell,{className:"min-w-80 whitespace-normal",children:(0,b.jsxs)(w.Button,{className:"group h-auto w-full flex-col items-start justify-start gap-0 px-1 py-0.5 text-left whitespace-normal",onClick:()=>P({issue:c.key}),type:"button",variant:"ghost",children:[(0,b.jsx)("span",{className:"block text-xs font-semibold text-primary group-hover:underline",children:c.key}),(0,b.jsx)("span",{className:"mt-1 block font-medium",children:c.summary})]})}),(0,b.jsx)(H.TableCell,{children:c.issueType??a("issue")}),(0,b.jsx)(H.TableCell,{children:c.priority?(0,b.jsx)(v.Badge,{className:Q(c.priority),children:c.priority}):"—"}),(0,b.jsx)(H.TableCell,{children:(0,b.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,b.jsx)(s.JiraPersonAvatar,{avatarUrl:c.assigneeAvatarUrl}),c.assignee??a("unassigned")]})}),(0,b.jsx)(H.TableCell,{className:"text-muted-foreground",children:(d=c.updatedAt)?new Date(d).toLocaleString():"—"})]},c.key)})})]})})]},c))}):(0,b.jsx)("div",{className:"overflow-x-auto pb-4",children:(0,b.jsx)("div",{className:"flex min-w-max items-start gap-4",children:ad.map(([c,d])=>(0,b.jsxs)("section",{className:"w-[19rem] rounded-xl bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,b.jsx)("h2",{className:"font-medium",children:c}),(0,b.jsx)(v.Badge,{children:d.length})]}),(0,b.jsx)("div",{className:"space-y-2",children:d.map(c=>(0,b.jsxs)(w.Button,{className:"h-auto w-full flex-col items-stretch rounded-lg p-3 text-left whitespace-normal shadow-sm",onClick:()=>P({issue:c.key}),type:"button",variant:"outline",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:c.key}),c.priority&&(0,b.jsx)(v.Badge,{className:Q(c.priority),children:c.priority})]}),(0,b.jsx)("p",{className:"mt-2 line-clamp-3 text-sm font-medium",children:c.summary}),(0,b.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:c.issueType??a("issue")}),(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,b.jsx)(s.JiraPersonAvatar,{avatarUrl:c.assigneeAvatarUrl,compact:!0}),(0,b.jsx)("span",{className:"truncate",children:c.assignee??a("unassigned")})]})]})]},c.key))})]},c))})}):null]}),(0,b.jsx)(S,{onProjectsChanged:n,open:J,projects:i,selectedProjectId:Y?.id??null,setOpen:L}),(0,b.jsx)(t.JiraTicketDrawer,{issueKey:X,onClose:()=>P({issue:null}),onTicketChange:ac})]})}],775524)}];
3
+ }`,{projectId:ae.id,branchNamingScript:$});f(a.updateJiraProjectBranchNaming),ad(null)}catch(a){ad(a instanceof Error?a.message:String(a))}finally{ab(!1)}}};return(0,b.jsx)(z.Dialog,{onOpenChange:a=>{a||t(null),c(a)},open:a,children:(0,b.jsxs)(z.DialogContent,{className:"overflow-x-hidden sm:max-w-4xl",children:[(0,b.jsxs)(z.DialogHeader,{children:[(0,b.jsx)(z.DialogTitle,{children:g("manageTitle")}),(0,b.jsx)(z.DialogDescription,{children:g("manageDescription")})]}),ac&&(0,b.jsx)(u.Alert,{variant:"destructive",children:(0,b.jsx)(u.AlertDescription,{children:ac})}),(0,b.jsxs)("div",{className:"grid min-w-0 gap-6 md:grid-cols-2",children:[(0,b.jsxs)("section",{className:"min-w-0 space-y-3",children:[(0,b.jsx)("h3",{className:"font-medium",children:g("projects")}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(F.Select,{onValueChange:p,value:m,children:[(0,b.jsx)(F.SelectTrigger,{"aria-label":g("availableProjects"),className:"w-full",children:(0,b.jsx)(F.SelectValue,{placeholder:g("selectProject")})}),(0,b.jsx)(F.SelectContent,{className:"z-60",children:af.map(a=>(0,b.jsxs)(F.SelectItem,{value:a.jiraId,children:[a.key," · ",a.name]},a.jiraId))})]}),(0,b.jsxs)(w.Button,{disabled:!m||aa,onClick:()=>void ag(),size:"icon",children:[(0,b.jsx)(j.Plus,{}),(0,b.jsx)("span",{className:"sr-only",children:g("addProject")})]})]}),(0,b.jsx)("div",{className:"space-y-2",children:d.map(a=>(0,b.jsxs)(D.Item,{className:`min-w-0 gap-2 p-1 ${a.id===ae?.id?"border-primary bg-primary/5":""}`,variant:"outline",children:[(0,b.jsxs)(w.Button,{"aria-pressed":a.id===ae?.id,className:"h-auto min-w-0 flex-1 flex-col items-start p-2 text-left whitespace-normal",onClick:()=>{t(a.id),L(null),x(""),H(""),B("JQL")},type:"button",variant:"ghost",children:[(0,b.jsxs)("p",{className:"truncate text-sm font-medium",children:[a.key," · ",a.name]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g("sourceCount",{count:a.sources.length})})]}),(0,b.jsx)(r.ConfirmationDialog,{actionLabel:g("removeProject"),cancelLabel:h("cancel"),description:h("cannotBeUndone"),onConfirm:()=>ah(a.id),title:g("confirmRemoveProject"),trigger:(0,b.jsxs)(w.Button,{disabled:aa,size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(n.Trash2,{}),(0,b.jsx)("span",{className:"sr-only",children:g("removeProject")})]})})]},a.id))})]}),(0,b.jsxs)("section",{className:"min-w-0 space-y-3",children:[(0,b.jsx)("h3",{className:"font-medium",children:g("sourcesFor",{project:ae?.key??"—"})}),ae?.sources.map(a=>(0,b.jsxs)(D.Item,{className:"min-w-0 items-start gap-2 overflow-hidden",variant:"outline",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium",children:a.name}),(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground",children:[(0,b.jsxs)("span",{className:"shrink-0",children:[a.kind," ·"]}),(0,b.jsx)("span",{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap [direction:rtl] md:[direction:ltr]",children:(0,b.jsx)("bdi",{children:a.value})})]})]}),(0,b.jsxs)("div",{className:"flex shrink-0",children:[(0,b.jsxs)(w.Button,{onClick:()=>{L(a),x(a.name),B(a.kind),H(a.value)},size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(i.Pencil,{}),(0,b.jsx)("span",{className:"sr-only",children:g("editSource")})]}),(0,b.jsx)(r.ConfirmationDialog,{actionLabel:g("deleteSource"),cancelLabel:h("cancel"),description:h("cannotBeUndone"),onConfirm:()=>aj(a.id),title:g("confirmDeleteSource"),trigger:(0,b.jsxs)(w.Button,{disabled:aa,size:"icon-sm",variant:"ghost",children:[(0,b.jsx)(n.Trash2,{}),(0,b.jsx)("span",{className:"sr-only",children:g("deleteSource")})]})})]})]},a.id)),ae&&(0,b.jsxs)("form",{className:"min-w-0 space-y-3 rounded-lg border p-3",onSubmit:a=>void ai(a),children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-name",children:g("sourceName")}),(0,b.jsx)(C.Input,{id:"source-name",maxLength:100,onChange:a=>x(a.target.value),required:!0,value:v})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-kind",children:g("sourceType")}),(0,b.jsxs)(F.Select,{onValueChange:a=>B(a),value:A,children:[(0,b.jsx)(F.SelectTrigger,{className:"w-full",id:"source-kind",children:(0,b.jsx)(F.SelectValue,{})}),(0,b.jsxs)(F.SelectContent,{className:"z-60",children:[(0,b.jsx)(F.SelectItem,{value:"JQL",children:"JQL"}),(0,b.jsx)(F.SelectItem,{value:"BOARD",children:g("boardUrl")})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"source-value",children:"JQL"===A?"JQL":g("boardUrl")}),(0,b.jsx)(J.Textarea,{id:"source-value",onChange:a=>H(a.target.value),required:!0,value:G})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[I&&(0,b.jsx)(w.Button,{onClick:()=>{L(null),x(""),H("")},type:"button",variant:"ghost",children:g("cancel")}),(0,b.jsx)(w.Button,{disabled:aa,type:"submit",children:I?g("saveSource"):g("addSource")})]})]}),ae&&(0,b.jsxs)("section",{className:"min-w-0 space-y-3 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h4",{className:"text-sm font-medium",children:g("displaySettings")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:g("displaySettingsDescription")})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"ticket-assignment-filter",children:g("ticketsToShow")}),(0,b.jsxs)(F.Select,{onValueChange:a=>V(a),value:U,children:[(0,b.jsx)(F.SelectTrigger,{className:"w-full",id:"ticket-assignment-filter",children:(0,b.jsx)(F.SelectValue,{})}),(0,b.jsxs)(F.SelectContent,{className:"z-60",children:[(0,b.jsx)(F.SelectItem,{value:"ALL",children:g("allTickets")}),(0,b.jsx)(F.SelectItem,{value:"UNASSIGNED_OR_SELF",children:g("unassignedOrSelfAssigned")}),(0,b.jsx)(F.SelectItem,{value:"SELF_IN_PROGRESS",children:g("selfAssignedInProgress")})]})]})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,b.jsx)(y.Checkbox,{checked:W,className:"mt-0.5",id:"hide-completed-tickets",onCheckedChange:a=>X(!0===a)}),(0,b.jsx)(E.Label,{className:"block leading-normal",htmlFor:"hide-completed-tickets",children:(0,b.jsxs)("span",{children:[(0,b.jsx)("span",{className:"block font-medium",children:g("hideCompletedTickets")}),(0,b.jsx)("span",{className:"block text-xs text-muted-foreground",children:g("hideCompletedTicketsDescription")})]})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"mb-1 text-xs font-medium",children:g("completedStatuses")}),(0,b.jsx)(R,{disabled:!W||Q,label:g("completedStatuses"),onChange:Z,placeholder:Q?g("loadingStatuses"):g("selectCompletedStatuses"),statuses:N,value:Y})]}),(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsx)(w.Button,{disabled:aa,onClick:()=>void ak(),type:"button",children:g("saveDisplaySettings")})})]}),ae&&(0,b.jsxs)("section",{className:"min-w-0 space-y-3 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h4",{className:"text-sm font-medium",children:g("branchNaming")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:g("branchNamingDescription")})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(E.Label,{className:"mb-1 block text-xs font-medium",htmlFor:"jira-branch-naming-script",children:g("branchNamingFunction")}),(0,b.jsx)(J.Textarea,{className:"min-h-48 font-mono text-xs",id:"jira-branch-naming-script",onChange:a=>_(a.target.value),spellCheck:!1,value:$}),(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:g("branchNamingFunctionHelp")})]}),(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsx)(w.Button,{disabled:aa||!$.trim(),onClick:()=>void al(),type:"button",children:g("saveBranchNaming")})})]})]})]}),(0,b.jsx)(z.DialogFooter,{children:(0,b.jsx)(w.Button,{onClick:()=>c(!1),variant:"outline",children:g("done")})})]})})}a.s(["JiraTicketsPage",0,function(){let a=(0,o.useTranslations)("jiraTickets"),g=(0,p.useSearchParams)(),[i,n]=(0,q.useState)([]),[r,y]=(0,q.useState)(null),[z,A]=(0,q.useState)(!0),[C,D]=(0,q.useState)(!1),[E,F]=(0,q.useState)(null),[J,L]=(0,q.useState)(!1),[O,R]=(0,q.useState)("table"),[T,U]=(0,q.useState)(()=>new Set),V=g.get("project"),W=g.get("source"),X=g.get("issue"),Y=i.find(a=>a.id===V)??i[0]??null,Z=Y?.sources.find(a=>a.id===W)??Y?.sources[0]??null,$=(0,q.useRef)(0),_=r?.source.id===Z?.id?r:null,aa=(0,q.useCallback)(async()=>{try{let a=await (0,K.controlPlaneRequest)(`query JiraProjects { jiraProjects { ${M} } }`);n(a.jiraProjects),F(null)}catch(a){F(a instanceof Error?a.message:String(a))}finally{A(!1)}},[]);(0,q.useEffect)(()=>{let a=window.setTimeout(()=>void aa(),0);return()=>window.clearTimeout(a)},[aa]),(0,q.useEffect)(()=>{if(!Y)return;let a={};V!==Y.id&&(a.project=Y.id),Z&&W!==Z.id&&(a.source=Z.id),Object.keys(a).length>0&&P(a)},[V,W,Y,Z]);let ab=(0,q.useCallback)(async(a,b=!1)=>{let c=++$.current;D(!0),y(b=>b?.source.id===a?b:null);try{let d=b?`mutation RefreshJiraSource($sourceId: ID!) { refreshJiraSource(sourceId: $sourceId) { ${N} } }`:`query JiraTicketBoard($sourceId: ID!) { jiraTicketBoard(sourceId: $sourceId) { ${N} } }`,e=await (0,K.controlPlaneRequest)(d,{sourceId:a});if(c!==$.current)return;y(b?e.refreshJiraSource:e.jiraTicketBoard),F(null)}catch(a){if(c!==$.current)return;F(a instanceof Error?a.message:String(a)),y(null)}finally{c===$.current&&D(!1)}},[]),ac=(0,q.useCallback)(()=>{Z&&ab(Z.id)},[ab,Z]);(0,q.useEffect)(()=>{if(!Z){$.current+=1;let a=window.setTimeout(()=>{y(null),D(!1)},0);return()=>window.clearTimeout(a)}let a=window.setTimeout(()=>void ab(Z.id),0);return()=>{window.clearTimeout(a),$.current+=1}},[ab,Z]);let ad=(0,q.useMemo)(()=>{let a=new Map;for(let b of _?.statusOrder??[])a.set(b,[]);for(let b of _?.tickets??[]){let c=a.get(b.status)??[];c.push(b),a.set(b.status,c)}return[...a.entries()]},[_]),ae=a=>{U(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1600px] flex-col gap-5",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:a("title")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(w.Button,{onClick:()=>R(a=>"table"===a?"board":"table"),variant:"outline",children:["table"===O?(0,b.jsx)(f.Columns3,{}):(0,b.jsx)(m,{}),"table"===O?a("showBoardLayout"):a("showTableLayout")]}),(0,b.jsxs)(w.Button,{disabled:!Z||C,onClick:()=>Z&&void ab(Z.id,!0),variant:"outline",children:[(0,b.jsx)(k.RefreshCw,{className:C?"animate-spin":void 0}),a("refresh")]}),(0,b.jsxs)(w.Button,{onClick:()=>L(!0),children:[(0,b.jsx)(l.Settings2,{}),a("manage")]})]})]}),E&&(0,b.jsx)(u.Alert,{variant:"destructive",children:(0,b.jsx)(u.AlertDescription,{children:E})}),z?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(G.Spinner,{}),a("loading")]}):0===i.length?(0,b.jsxs)(B.Empty,{className:"border py-10",children:[(0,b.jsxs)(B.EmptyHeader,{children:[(0,b.jsx)(B.EmptyMedia,{variant:"icon",children:(0,b.jsx)(h,{})}),(0,b.jsx)(B.EmptyTitle,{children:a("emptyProjects")}),(0,b.jsx)(B.EmptyDescription,{children:a("emptyProjectsDescription")})]}),(0,b.jsxs)(w.Button,{className:"mt-4",onClick:()=>L(!0),children:[(0,b.jsx)(j.Plus,{}),a("addProject")]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"overflow-x-auto pb-1",children:(0,b.jsx)(I.Tabs,{value:Y?.id,onValueChange:a=>{let b=i.find(b=>b.id===a);P({project:a,source:b?.sources[0]?.id??null,issue:null})},children:(0,b.jsx)(I.TabsList,{"aria-label":a("projectTabs"),children:i.map(a=>(0,b.jsx)(I.TabsTrigger,{value:a.id,children:a.key},a.id))})})}),Y&&Y.sources.length>1?(0,b.jsx)("div",{className:"overflow-x-auto border-b pb-3",children:(0,b.jsx)(I.Tabs,{value:Z?.id,onValueChange:a=>P({source:a,issue:null}),children:(0,b.jsx)(I.TabsList,{"aria-label":a("sourceTabs"),variant:"line",children:Y.sources.map(a=>(0,b.jsx)(I.TabsTrigger,{value:a.id,children:a.name},a.id))})})}):Y?.sources.length===0?(0,b.jsxs)(B.Empty,{className:"border py-8",children:[(0,b.jsxs)(B.EmptyHeader,{children:[(0,b.jsx)(B.EmptyTitle,{children:a("emptySources")}),(0,b.jsx)(B.EmptyDescription,{children:a("emptySourcesDescription")})]}),(0,b.jsxs)(w.Button,{className:"mt-4",onClick:()=>L(!0),children:[(0,b.jsx)(j.Plus,{}),a("addSource")]})]}):null,_?.cache.stale&&(0,b.jsxs)(u.Alert,{className:"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-300",children:[(0,b.jsx)(c.AlertTriangle,{}),(0,b.jsx)(u.AlertDescription,{className:"text-current",children:a("staleWarning")})]}),_?.truncated&&(0,b.jsx)(u.Alert,{className:"bg-muted",children:(0,b.jsx)(u.AlertDescription,{children:a("truncatedWarning")})}),_?.warnings.map(a=>(0,b.jsx)(u.Alert,{className:"bg-muted",children:(0,b.jsx)(u.AlertDescription,{children:a})},a)),Z&&C&&!_?(0,b.jsxs)("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-foreground",children:[(0,b.jsx)(G.Spinner,{}),a("loadingTickets")]}):_&&0===_.tickets.length?(0,b.jsx)(B.Empty,{className:"border py-10",children:(0,b.jsx)(B.EmptyHeader,{children:(0,b.jsx)(B.EmptyDescription,{children:a("emptyTickets")})})}):_?"table"===O?(0,b.jsx)("div",{className:"space-y-5 pb-4",children:ad.map(([c,f])=>(0,b.jsxs)(x.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(x.CardHeader,{children:(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsx)(w.Button,{"aria-expanded":!T.has(c),className:"-m-2 h-auto min-w-0 flex-1 justify-start p-2 text-left aria-expanded:bg-transparent aria-expanded:hover:bg-muted dark:aria-expanded:bg-transparent dark:aria-expanded:hover:bg-muted/50",onClick:()=>ae(c),type:"button",variant:"ghost",children:(0,b.jsx)("span",{className:"truncate font-medium",children:c})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center justify-end gap-2",children:[(0,b.jsx)(v.Badge,{children:f.length}),(0,b.jsx)(w.Button,{"aria-expanded":!T.has(c),"aria-label":a(T.has(c)?"expandStatus":"collapseStatus",{status:c}),className:"aria-expanded:bg-transparent aria-expanded:hover:bg-muted dark:aria-expanded:bg-transparent dark:aria-expanded:hover:bg-muted/50",onClick:()=>ae(c),size:"icon-sm",title:a(T.has(c)?"expandStatus":"collapseStatus",{status:c}),type:"button",variant:"ghost",children:T.has(c)?(0,b.jsx)(e.ChevronRight,{className:"size-5"}):(0,b.jsx)(d.ChevronDown,{className:"size-5"})})]})]})}),!T.has(c)&&(0,b.jsx)(x.CardContent,{className:"px-0",children:(0,b.jsxs)(H.Table,{children:[(0,b.jsx)(H.TableHeader,{children:(0,b.jsxs)(H.TableRow,{className:"hover:bg-transparent",children:[(0,b.jsx)(H.TableHead,{children:a("ticket")}),(0,b.jsx)(H.TableHead,{children:a("issueType")}),(0,b.jsx)(H.TableHead,{children:a("priority")}),(0,b.jsx)(H.TableHead,{children:a("assignee")}),(0,b.jsx)(H.TableHead,{children:a("updated")})]})}),(0,b.jsx)(H.TableBody,{children:f.map(c=>{var d;return(0,b.jsxs)(H.TableRow,{children:[(0,b.jsx)(H.TableCell,{className:"min-w-80 whitespace-normal",children:(0,b.jsxs)(w.Button,{className:"group h-auto w-full flex-col items-start justify-start gap-0 px-1 py-0.5 text-left whitespace-normal",onClick:()=>P({issue:c.key}),type:"button",variant:"ghost",children:[(0,b.jsx)("span",{className:"block text-xs font-semibold text-primary group-hover:underline",children:c.key}),(0,b.jsx)("span",{className:"mt-1 block font-medium",children:c.summary})]})}),(0,b.jsx)(H.TableCell,{children:c.issueType??a("issue")}),(0,b.jsx)(H.TableCell,{children:c.priority?(0,b.jsx)(v.Badge,{className:Q(c.priority),children:c.priority}):"—"}),(0,b.jsx)(H.TableCell,{children:(0,b.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,b.jsx)(s.JiraPersonAvatar,{avatarUrl:c.assigneeAvatarUrl}),c.assignee??a("unassigned")]})}),(0,b.jsx)(H.TableCell,{className:"text-muted-foreground",children:(d=c.updatedAt)?new Date(d).toLocaleString():"—"})]},c.key)})})]})})]},c))}):(0,b.jsx)("div",{className:"overflow-x-auto pb-4",children:(0,b.jsx)("div",{className:"flex min-w-max items-start gap-4",children:ad.map(([c,d])=>(0,b.jsxs)("section",{className:"w-[19rem] rounded-xl bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,b.jsx)("h2",{className:"font-medium",children:c}),(0,b.jsx)(v.Badge,{children:d.length})]}),(0,b.jsx)("div",{className:"space-y-2",children:d.map(c=>(0,b.jsxs)(w.Button,{className:"h-auto w-full flex-col items-stretch rounded-lg p-3 text-left whitespace-normal shadow-sm",onClick:()=>P({issue:c.key}),type:"button",variant:"outline",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:c.key}),c.priority&&(0,b.jsx)(v.Badge,{className:Q(c.priority),children:c.priority})]}),(0,b.jsx)("p",{className:"mt-2 line-clamp-3 text-sm font-medium",children:c.summary}),(0,b.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:c.issueType??a("issue")}),(0,b.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,b.jsx)(s.JiraPersonAvatar,{avatarUrl:c.assigneeAvatarUrl,compact:!0}),(0,b.jsx)("span",{className:"truncate",children:c.assignee??a("unassigned")})]})]})]},c.key))})]},c))})}):null]}),(0,b.jsx)(S,{onProjectsChanged:n,open:J,projects:i,selectedProjectId:Y?.id??null,setOpen:L}),(0,b.jsx)(t.JiraTicketDrawer,{issueKey:X,onClose:()=>P({issue:null}),onTicketChange:ac})]})}],775524)}];
4
4
 
5
5
  //# sourceMappingURL=src_components_jira_tickets-page_tsx_0_ocldp._.js.map
@@ -7,6 +7,6 @@ module.exports=[733299,a=>{"use strict";var b=a.i(187924),c=a.i(503743),d=a.i(75
7
7
  id requestId status editor payload headers targetMode channelId recipientCount successCount failureCount error createdAt finishedAt
8
8
  deliveries { id registrationId topic environment status apnsId responseCode reason attempts durationMs }
9
9
  }
10
- }`;function H(a){if(!a.trim())return;let b=Number(a);return Number.isFinite(b)?b:void 0}function I(a){let b=a.split(",").map(a=>a.trim()).filter(Boolean);return b.length?b:void 0}function J(a,b){let c;try{c=JSON.parse(a)}catch{throw Error(`${b} must be valid JSON`)}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`${b} must be a JSON object`);return c}function K(a){let b=a.headers??{},c=a.aps??{},d=c.alert??{},e=a.liveActivity??{},f=c.sound,g=f&&"object"==typeof f&&!Array.isArray(f)?f:null,h=a=>Array.isArray(a)?a.map(String).join(", "):"";return{...F,pushType:a.pushType??"alert",topic:String(b.topic??""),priority:String(b.priority??10),apnsId:String(b.id??""),expiration:String(b.expiration??""),collapseId:String(b.collapseId??""),title:String(d.title??""),subtitle:String(d.subtitle??""),body:String(d.body??""),titleLocKey:String(d["title-loc-key"]??""),titleLocArgs:h(d["title-loc-args"]),subtitleLocKey:String(d["subtitle-loc-key"]??""),subtitleLocArgs:h(d["subtitle-loc-args"]),locKey:String(d["loc-key"]??""),locArgs:h(d["loc-args"]),launchImage:String(d["launch-image"]??""),summaryArg:String(d["summary-arg"]??""),summaryArgCount:void 0===d["summary-arg-count"]?"":String(d["summary-arg-count"]),badge:void 0===c.badge?"":String(c.badge),soundName:"string"==typeof f?f:String(g?.name??""),criticalSound:g?.critical===1,soundVolume:g?.volume===void 0?"1":String(g.volume),category:String(c.category??""),threadId:String(c["thread-id"]??""),contentAvailable:1===c["content-available"],mutableContent:1===c["mutable-content"],targetContentId:String(c["target-content-id"]??""),interruptionLevel:String(c["interruption-level"]??"active"),relevanceScore:void 0===c["relevance-score"]?"":String(c["relevance-score"]),customJson:JSON.stringify(a.custom??{},null,2),liveTimestamp:String(e.timestamp??Math.floor(Date.now()/1e3)),liveEvent:e.event??"update",liveContentState:JSON.stringify(e["content-state"]??{},null,2),liveAttributesType:String(e["attributes-type"]??""),liveAttributes:JSON.stringify(e.attributes??{},null,2),liveStaleDate:void 0===e["stale-date"]?"":String(e["stale-date"]),liveDismissalDate:void 0===e["dismissal-date"]?"":String(e["dismissal-date"]),liveInputPushToken:1===e["input-push-token"],credentialId:String(a.credentialId??"")}}function L(a,b){return{...a,pushType:b,..."background"===b?{priority:"5"}:{},..."mdm"===b?{}:{credentialId:""}}}function M({label:a,children:c,className:d}){return(0,b.jsxs)("div",{className:(0,D.cn)("space-y-2",d),children:[(0,b.jsx)(u.Label,{children:a}),c]})}function N({label:a,checked:c,onChange:d}){return(0,b.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)(r.Checkbox,{checked:c,onCheckedChange:a=>d(!!a)}),a]})}function O({eligible:a,selected:c,allEligible:d,onSelected:f,onAllEligible:g}){let h=(0,k.useTranslations)("pushNotifications");return(0,b.jsxs)(v.Popover,{children:[(0,b.jsx)(v.PopoverTrigger,{asChild:!0,children:(0,b.jsxs)(p.Button,{className:"w-full justify-between",variant:"outline",children:[d?h("allEligibleDevices",{count:a.length}):h("selectedDevices",{count:c.size}),(0,b.jsx)(e.ChevronDown,{})]})}),(0,b.jsx)(v.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:(0,b.jsxs)(s.Command,{children:[(0,b.jsx)(s.CommandInput,{placeholder:h("searchDevices")}),(0,b.jsxs)(s.CommandList,{children:[(0,b.jsx)(s.CommandEmpty,{children:h("noEligibleDevices")}),(0,b.jsxs)(s.CommandGroup,{children:[(0,b.jsx)(s.CommandItem,{"data-checked":d,onSelect:()=>{g(!d),d||f(new Set)},value:"all-eligible",children:h("allEligibleDevices",{count:a.length})}),a.map(a=>(0,b.jsxs)(s.CommandItem,{"data-checked":c.has(a.id),onSelect:()=>{g(!1);let b=new Set(c);b.has(a.id)?b.delete(a.id):b.add(a.id),f(b)},value:`${a.displayName} ${a.tokenMasked}`,children:[a.displayName,(0,b.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:a.environment})]},a.id))]})]})]})})]})}function P({channels:a,load:c}){let d=(0,k.useTranslations)("pushNotifications"),e=(0,k.useTranslations)("common"),[f,g]=(0,l.useState)(""),[h,j]=(0,l.useState)("SANDBOX"),[n,o]=(0,l.useState)("NO_STORAGE"),[r,s]=(0,l.useState)(!1),u=async()=>{s(!0);try{await (0,C.controlPlaneRequest)("mutation Create($input: CreateApnsBroadcastChannelInput!) { createApnsBroadcastChannel(input: $input) { id } }",{input:{bundleId:f,environment:h,storagePolicy:n}}),g(""),await c()}finally{s(!1)}};return(0,b.jsxs)(q.Card,{children:[(0,b.jsxs)(q.CardHeader,{children:[(0,b.jsx)(q.CardTitle,{children:d("broadcastChannels")}),(0,b.jsx)(q.CardDescription,{children:d("broadcastDescription")})]}),(0,b.jsxs)(q.CardContent,{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-4",children:[(0,b.jsx)(t.Input,{onChange:a=>g(a.target.value),placeholder:d("bundleId"),value:f}),(0,b.jsxs)(w.Select,{onValueChange:j,value:h,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,b.jsx)(w.SelectItem,{value:"PRODUCTION",children:"Production"})]})]}),(0,b.jsxs)(w.Select,{onValueChange:o,value:n,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"NO_STORAGE",children:d("noStorage")}),(0,b.jsx)(w.SelectItem,{value:"MOST_RECENT",children:d("mostRecent")})]})]}),(0,b.jsx)(p.Button,{disabled:r||!f,onClick:()=>void u(),children:d("createChannel")})]}),(0,b.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"font-mono text-xs",children:a.channelId}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a.bundleId," · ",a.environment," ·"," ",a.storagePolicy]})]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:d("delete"),cancelLabel:e("cancel"),description:d("deleteChannelDescription"),onConfirm:async()=>{await (0,C.controlPlaneRequest)("mutation Delete($id: ID!) { deleteApnsBroadcastChannel(id: $id) }",{id:a.id}),await c()},title:d("deleteChannel"),trigger:(0,b.jsx)(p.Button,{size:"icon-sm",variant:"ghost",children:(0,b.jsx)(i.Trash2,{})})})]},a.id))})]})]})}function Q({batches:a,expanded:c,setExpanded:d,onLoad:f,onResend:j,onPreset:n,onDelete:q,locale:r}){let s=(0,k.useTranslations)("pushNotifications"),t=(0,k.useTranslations)("common");return 0===a.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:s("noHistory")}):(0,b.jsxs)(z.Table,{children:[(0,b.jsx)(z.TableHeader,{children:(0,b.jsxs)(z.TableRow,{children:[(0,b.jsx)(z.TableHead,{className:"w-12"}),(0,b.jsx)(z.TableHead,{children:s("created")}),(0,b.jsx)(z.TableHead,{children:s("pushType")}),(0,b.jsx)(z.TableHead,{children:s("deliveryMode")}),(0,b.jsx)(z.TableHead,{children:s("recipients")}),(0,b.jsx)(z.TableHead,{children:s("result")}),(0,b.jsx)(z.TableHead,{children:s("status")})]})}),(0,b.jsx)(z.TableBody,{children:a.map(a=>(0,b.jsxs)(l.Fragment,{children:[(0,b.jsxs)(z.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let b;return b=a.id,d(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:[(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(e.ChevronDown,{className:(0,D.cn)("transition-transform",c.has(a.id)&&"rotate-180")})}),(0,b.jsx)(z.TableCell,{children:new Date(a.createdAt).toLocaleString(r)}),(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"secondary",children:String(a.editor.pushType??"—")})}),(0,b.jsx)(z.TableCell,{children:a.targetMode}),(0,b.jsx)(z.TableCell,{children:a.recipientCount}),(0,b.jsxs)(z.TableCell,{children:[a.successCount," / ",a.failureCount]}),(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"FAILED"===a.status?"destructive":"outline",children:a.status})})]}),c.has(a.id)&&(0,b.jsx)(z.TableRow,{className:"hover:bg-transparent",children:(0,b.jsxs)(z.TableCell,{colSpan:7,className:"bg-muted/20 p-5",children:[(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(u.Label,{children:s("payload")}),(0,b.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.payload,null,2)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(u.Label,{children:s("headers")}),(0,b.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.headers,null,2)})]})]}),a.deliveries.length>0&&(0,b.jsx)("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:a.deliveries.map(a=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background p-3",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"font-mono text-xs",children:a.topic}),(0,b.jsx)(o.Badge,{variant:"SUCCEEDED"===a.status?"default":"destructive",children:a.status})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["HTTP ",a.responseCode??"—"," ·"," ",a.reason??"—"," · ",a.attempts," ",s("attempts")," · ",a.durationMs??"—"," ms"]}),a.apnsId&&(0,b.jsx)("p",{className:"font-mono text-xs",children:a.apnsId})]},a.id))}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[(0,b.jsx)(p.Button,{onClick:()=>f(a.editor),variant:"outline",children:s("load")}),(0,b.jsxs)(p.Button,{onClick:()=>n(a),variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",s("saveAsPreset")]}),"DRAFT"!==a.targetMode&&(0,b.jsxs)(p.Button,{onClick:()=>void j(a.id),children:[(0,b.jsx)(h.Send,{})," ",s("resend")]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:s("delete"),cancelLabel:t("cancel"),description:s("deleteHistoryDescription"),onConfirm:()=>q(a.id),title:s("deleteHistory"),trigger:(0,b.jsxs)(p.Button,{disabled:["QUEUED","SENDING"].includes(a.status),variant:"ghost",children:[(0,b.jsx)(i.Trash2,{})," ",s("delete")]})})]})]})})]},a.id))})]})}function R({presets:a,registrations:c,expanded:f,setExpanded:g,onLoad:h,onSend:j,onDelete:n}){let o=(0,k.useTranslations)("pushNotifications"),q=(0,k.useTranslations)("common");return 0===a.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:o("noPresets")}):(0,b.jsxs)(z.Table,{children:[(0,b.jsx)(z.TableHeader,{children:(0,b.jsxs)(z.TableRow,{children:[(0,b.jsx)(z.TableHead,{className:"w-12"}),(0,b.jsx)(z.TableHead,{children:o("name")}),(0,b.jsx)(z.TableHead,{children:o("pushType")}),(0,b.jsx)(z.TableHead,{children:o("topic")}),(0,b.jsx)(z.TableHead,{children:o("updated")})]})}),(0,b.jsx)(z.TableBody,{children:a.map(a=>(0,b.jsxs)(l.Fragment,{children:[(0,b.jsxs)(z.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let b;return b=a.id,g(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:[(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(e.ChevronDown,{className:(0,D.cn)("transition-transform",f.has(a.id)&&"rotate-180")})}),(0,b.jsx)(z.TableCell,{className:"font-medium",children:a.name}),(0,b.jsx)(z.TableCell,{children:String(a.editor.pushType??"—")}),(0,b.jsx)(z.TableCell,{className:"font-mono text-xs",children:String(a.editor.headers?.topic??"—")}),(0,b.jsx)(z.TableCell,{children:new Date(a.updatedAt).toLocaleString()})]}),f.has(a.id)&&(0,b.jsx)(z.TableRow,{children:(0,b.jsxs)(z.TableCell,{className:"bg-muted/20 p-5",colSpan:5,children:[(0,b.jsx)("pre",{className:"max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.editor,null,2)}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap items-end justify-end gap-2",children:[(0,b.jsx)(S,{onSend:(b,c)=>j(a,b,c),preset:a,registrations:c}),(0,b.jsxs)(p.Button,{onClick:()=>h(a.editor),children:[(0,b.jsx)(d.Check,{})," ",o("loadEdit")]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:o("delete"),cancelLabel:q("cancel"),description:o("deletePresetDescription"),onConfirm:()=>n(a.id),title:o("deletePreset"),trigger:(0,b.jsxs)(p.Button,{variant:"ghost",children:[(0,b.jsx)(i.Trash2,{})," ",o("delete")]})})]})]})})]},a.id))})]})}function S({preset:a,registrations:c,onSend:d}){let e=(0,k.useTranslations)("pushNotifications"),[f,g]=(0,l.useState)(new Set),[i,j]=(0,l.useState)(!1),[m,n]=(0,l.useState)(!1),o=String((a.editor.headers??{}).topic??""),q=String(a.editor.pushType??""),r=c.filter(a=>"ACTIVE"===a.status&&a.topic===o&&a.supportedPushTypes.includes(q));return(0,b.jsxs)("div",{className:"grid min-w-72 flex-1 gap-2 sm:max-w-xl sm:grid-cols-[1fr_auto]",children:[(0,b.jsx)(O,{allEligible:i,eligible:r,onAllEligible:j,onSelected:g,selected:f}),(0,b.jsxs)(p.Button,{disabled:m||!i&&0===f.size,onClick:()=>void(async()=>{n(!0);try{await d(i,[...f]),j(!1),g(new Set)}finally{n(!1)}})(),children:[m?(0,b.jsx)(x.Spinner,{}):(0,b.jsx)(h.Send,{})," ",e("send")]})]})}a.s(["PushNotificationsPage",0,function(){let a=(0,k.useTranslations)("pushNotifications"),d=(0,k.useTranslations)("common"),e=(0,j.useLocale)(),[r,s]=(0,l.useState)(F),[v,z]=(0,l.useState)([]),[D,S]=(0,l.useState)([]),[T,U]=(0,l.useState)([]),[V,W]=(0,l.useState)([]),[X,Y]=(0,l.useState)([]),[Z,$]=(0,l.useState)(new Set),[_,aa]=(0,l.useState)(!1),[ab,ac]=(0,l.useState)(""),[ad,ae]=(0,l.useState)(!1),[af,ag]=(0,l.useState)(""),[ah,ai]=(0,l.useState)("HEX"),[aj,ak]=(0,l.useState)("SANDBOX"),[al,am]=(0,l.useState)("content"),[an,ao]=(0,l.useState)("history"),[ap,aq]=(0,l.useState)(""),[ar,as]=(0,l.useState)(new Set),[at,au]=(0,l.useState)(new Set),[av,aw]=(0,l.useState)(!0),[ax,ay]=(0,l.useState)(!1),[az,aA]=(0,l.useState)(null),[aB,aC]=(0,l.useState)(null),aD=(0,l.useCallback)(async()=>{try{let a=await (0,C.controlPlaneRequest)(G);z(a.apnsRegistrations),S(a.pushNotificationSettings.certificates),U(a.apnsBroadcastChannels),W(a.pushNotificationPresets),Y(a.pushNotificationHistory),aA(null)}catch(a){aA(a instanceof Error?a.message:String(a))}finally{aw(!1)}},[]);(0,l.useEffect)(()=>{let a=window.setTimeout(()=>void aD(),0),b=(0,C.controlPlaneSubscriptions)().subscribe({query:"subscription { pushNotificationsChanged }"},{next:()=>void aD(),error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(a),b()}},[aD]);let aE=(a,b)=>s(c=>({...c,[a]:b})),aF=(0,l.useMemo)(()=>{try{let b=Object.fromEntries(Object.entries({title:r.title||void 0,subtitle:r.subtitle||void 0,body:r.body||void 0,"title-loc-key":r.titleLocKey||void 0,"title-loc-args":I(r.titleLocArgs),"subtitle-loc-key":r.subtitleLocKey||void 0,"subtitle-loc-args":I(r.subtitleLocArgs),"loc-key":r.locKey||void 0,"loc-args":I(r.locArgs),"launch-image":r.launchImage||void 0,"summary-arg":r.summaryArg||void 0,"summary-arg-count":H(r.summaryArgCount)}).filter(([,a])=>void 0!==a)),c=Object.fromEntries(Object.entries({alert:Object.keys(b).length?b:void 0,badge:H(r.badge),sound:r.soundName?r.criticalSound?{critical:1,name:r.soundName,volume:Number(r.soundVolume)}:r.soundName:void 0,category:r.category||void 0,"thread-id":r.threadId||void 0,"content-available":r.contentAvailable?1:void 0,"mutable-content":r.mutableContent?1:void 0,"target-content-id":r.targetContentId||void 0,"interruption-level":r.interruptionLevel||void 0,"relevance-score":H(r.relevanceScore)}).filter(([,a])=>void 0!==a)),d=["background","mdm"].includes(r.pushType)?{}:c;return{value:{pushType:r.pushType,headers:{id:r.apnsId||void 0,topic:r.topic,priority:Number(r.priority),expiration:r.expiration||void 0,collapseId:r.collapseId||void 0,broadcastChannelId:ab||void 0},aps:d,custom:J(r.customJson,a("customJson")),liveActivity:"liveactivity"===r.pushType?{timestamp:Number(r.liveTimestamp),event:r.liveEvent,"content-state":J(r.liveContentState,a("contentState")),"attributes-type":r.liveAttributesType||void 0,attributes:"start"===r.liveEvent?J(r.liveAttributes,a("attributes")):void 0,"stale-date":H(r.liveStaleDate),"dismissal-date":H(r.liveDismissalDate),"input-push-token":r.liveInputPushToken?1:void 0}:void 0,credentialId:r.credentialId||null},error:null}}catch(a){return{value:null,error:a instanceof Error?a.message:String(a)}}},[ab,r,a]),aG=(0,l.useMemo)(()=>{if(!aF.value)return null;let a=aF.value,b="mdm"===a.pushType?{mdm:"<PushMagic>"}:{...a.custom,aps:"liveactivity"===a.pushType?{...a.aps,...a.liveActivity}:a.aps},c=JSON.stringify(b,null,2);return{payload:b,text:c,bytes:new TextEncoder().encode(JSON.stringify(b)).length}},[aF]),aH=v.filter(a=>"ACTIVE"===a.status&&a.topic===r.topic&&a.supportedPushTypes.includes(r.pushType)),aI=async(a,b,c)=>{ay(!0),aA(null),aC(null);try{await (0,C.controlPlaneRequest)(a,b),c&&aC(c),await aD()}catch(a){aA(a instanceof Error?a.message:String(a))}finally{ay(!1)}},aJ=async()=>{aF.value?await aI("mutation SendPush($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,B.createClientId)(),editor:aF.value,targetMode:ab?"BROADCAST":ad?"DIRECT":_?"ALL":"DEVICES",registrationIds:[...Z],channelId:ab||null,directToken:ad?af:null,directTokenEncoding:ad?ah:null,directEnvironment:ad?aj:null}},a("queued")):aA(aF.error)},aK=a=>{$(new Set),aa(!1),ac(""),ae(!1),ag(""),s(K(a))};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("h1",{className:"flex items-center gap-2 text-2xl font-semibold tracking-tight",children:[(0,b.jsx)(c.BellRing,{})," ",a("title")]}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),az&&(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:az})}),aB&&(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:aB})}),(0,b.jsxs)(q.Card,{children:[(0,b.jsxs)(q.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(q.CardTitle,{children:a("editor")}),(0,b.jsx)(q.CardDescription,{children:a("editorDescription")}),(0,b.jsx)(q.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:(0,b.jsxs)("div",{className:"grid gap-2 sm:flex",children:[(0,b.jsx)(t.Input,{className:"w-full sm:w-48",onChange:a=>aq(a.target.value),placeholder:a("presetName"),value:ap}),(0,b.jsxs)(p.Button,{disabled:ax||!aF.value||!ap.trim(),onClick:()=>void aI("mutation SavePreset($name: String!, $editor: JSON!) { savePushNotificationPreset(name: $name, editor: $editor) { id } }",{name:ap,editor:aF.value},a("presetSaved")),size:"sm",variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",a("savePreset")]})]})})]}),(0,b.jsxs)(q.CardContent,{className:"space-y-5",children:[(0,b.jsxs)(y.Tabs,{onValueChange:am,value:al,children:[(0,b.jsxs)(w.Select,{onValueChange:am,value:al,children:[(0,b.jsx)(w.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"content",children:a("content")}),(0,b.jsx)(w.SelectItem,{value:"headers",children:a("headers")}),(0,b.jsx)(w.SelectItem,{value:"advanced",children:a("advanced")}),(0,b.jsx)(w.SelectItem,{value:"specialized",children:a("specialized")})]})]}),(0,b.jsxs)(y.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsx)(y.TabsTrigger,{value:"content",children:a("content")}),(0,b.jsx)(y.TabsTrigger,{value:"headers",children:a("headers")}),(0,b.jsx)(y.TabsTrigger,{value:"advanced",children:a("advanced")}),(0,b.jsx)(y.TabsTrigger,{value:"specialized",children:a("specialized")})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 space-y-4",value:"content",children:[(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("pushType"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>{s(b=>L(b,a)),"liveactivity"!==a&&(ae(!1),ac(""))},value:r.pushType,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("titleField"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("title",a.target.value),value:r.title})}),(0,b.jsx)(M,{label:a("subtitle"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitle",a.target.value),value:r.subtitle})})]}),(0,b.jsx)(M,{label:a("body"),children:(0,b.jsx)(A.Textarea,{onChange:a=>aE("body",a.target.value),rows:4,value:r.body})}),(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,b.jsx)(M,{label:a("badge"),children:(0,b.jsx)(t.Input,{inputMode:"numeric",onChange:a=>aE("badge",a.target.value),value:r.badge})}),(0,b.jsx)(M,{label:a("sound"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("soundName",a.target.value),value:r.soundName})}),(0,b.jsx)(M,{label:a("category"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("category",a.target.value),value:r.category})}),(0,b.jsx)(M,{label:a("threadId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("threadId",a.target.value),value:r.threadId})})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-5",children:[(0,b.jsx)(N,{checked:r.contentAvailable,label:a("contentAvailable"),onChange:a=>aE("contentAvailable",a)}),(0,b.jsx)(N,{checked:r.mutableContent,label:a("mutableContent"),onChange:a=>aE("mutableContent",a)}),(0,b.jsx)(N,{checked:r.criticalSound,label:a("criticalSound"),onChange:a=>aE("criticalSound",a)})]}),r.criticalSound&&(0,b.jsx)(M,{label:a("soundVolume"),children:(0,b.jsx)(t.Input,{className:"max-w-40",max:"1",min:"0",onChange:a=>aE("soundVolume",a.target.value),step:"0.1",type:"number",value:r.soundVolume})})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",value:"headers",children:[(0,b.jsx)(M,{label:a("topic"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("topic",a.target.value),placeholder:"com.example.app",value:r.topic})}),(0,b.jsx)(M,{label:a("priority"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("priority",a),value:r.priority,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["1","5","10"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("apnsId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("apnsId",a.target.value),value:r.apnsId})}),(0,b.jsx)(M,{label:a("expiration"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("expiration",a.target.value),placeholder:"0 / Unix timestamp",value:r.expiration})}),(0,b.jsx)(M,{label:a("collapseId"),children:(0,b.jsx)(t.Input,{maxLength:64,onChange:a=>aE("collapseId",a.target.value),value:r.collapseId})}),"mdm"===r.pushType&&(0,b.jsx)(M,{label:a("certificateCredential"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("credentialId",a),value:r.credentialId,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{placeholder:a("selectCredential")})}),(0,b.jsx)(w.SelectContent,{children:D.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name," · ",a.environment]},a.id))})]})})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 space-y-4",value:"advanced",children:[(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("titleLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("titleLocKey",a.target.value),value:r.titleLocKey})}),(0,b.jsx)(M,{label:a("titleLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("titleLocArgs",a.target.value),value:r.titleLocArgs})}),(0,b.jsx)(M,{label:a("subtitleLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitleLocKey",a.target.value),value:r.subtitleLocKey})}),(0,b.jsx)(M,{label:a("subtitleLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitleLocArgs",a.target.value),value:r.subtitleLocArgs})}),(0,b.jsx)(M,{label:a("bodyLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("locKey",a.target.value),value:r.locKey})}),(0,b.jsx)(M,{label:a("bodyLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("locArgs",a.target.value),value:r.locArgs})}),(0,b.jsx)(M,{label:a("launchImage"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("launchImage",a.target.value),value:r.launchImage})}),(0,b.jsx)(M,{label:a("summaryArg"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("summaryArg",a.target.value),value:r.summaryArg})}),(0,b.jsx)(M,{label:a("summaryArgCount"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("summaryArgCount",a.target.value),value:r.summaryArgCount})}),(0,b.jsx)(M,{label:a("targetContentId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("targetContentId",a.target.value),value:r.targetContentId})}),(0,b.jsx)(M,{label:a("interruptionLevel"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("interruptionLevel",a),value:r.interruptionLevel,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["passive","active","time-sensitive","critical"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("relevanceScore"),children:(0,b.jsx)(t.Input,{max:"1",min:"0",onChange:a=>aE("relevanceScore",a.target.value),step:"0.1",type:"number",value:r.relevanceScore})})]}),(0,b.jsx)(M,{label:a("customJson"),children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",onChange:a=>aE("customJson",a.target.value),rows:7,value:r.customJson})})]}),(0,b.jsx)(y.TabsContent,{className:"mt-4 space-y-4",value:"specialized",children:"liveactivity"===r.pushType?(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("timestamp"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveTimestamp",a.target.value),value:r.liveTimestamp})}),(0,b.jsx)(M,{label:a("event"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("liveEvent",a),value:r.liveEvent,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["start","update","end"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("attributesType"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveAttributesType",a.target.value),value:r.liveAttributesType})}),(0,b.jsx)(M,{label:a("contentState"),className:"sm:col-span-2",children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",onChange:a=>aE("liveContentState",a.target.value),rows:5,value:r.liveContentState})}),(0,b.jsx)(M,{label:a("attributes"),children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",disabled:"start"!==r.liveEvent,onChange:a=>aE("liveAttributes",a.target.value),rows:5,value:r.liveAttributes})}),(0,b.jsx)(M,{label:a("staleDate"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveStaleDate",a.target.value),value:r.liveStaleDate})}),(0,b.jsx)(M,{label:a("dismissalDate"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveDismissalDate",a.target.value),value:r.liveDismissalDate})}),(0,b.jsx)(N,{checked:r.liveInputPushToken,label:a("inputPushToken"),onChange:a=>aE("liveInputPushToken",a)})]}):"mdm"===r.pushType?(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:a("mdmHelp")})}):(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:a("specializedHelp",{type:r.pushType})})})})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(u.Label,{children:a("payloadPreview")}),(0,b.jsxs)(o.Badge,{variant:aF.error||aG&&aG.bytes>("voip"===r.pushType?5120:4096)?"destructive":"secondary",children:[aG?.bytes??0," /"," ","voip"===r.pushType?5120:4096," bytes"]})]}),aF.error?(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:aF.error})}):(0,b.jsx)("pre",{className:"max-h-80 overflow-auto rounded-xl bg-muted p-4 text-xs",children:aG?.text})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(u.Label,{children:a("recipients")}),"liveactivity"===r.pushType&&(0,b.jsxs)(w.Select,{onValueChange:a=>{ae("TOKEN"===a),ac("DEVICES"===a||"TOKEN"===a?"":a)},value:ad?"TOKEN":ab||"DEVICES",children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"DEVICES",children:a("directDevices")}),(0,b.jsx)(w.SelectItem,{value:"TOKEN",children:a("directToken")}),T.filter(a=>a.bundleId===r.topic.replace(/\.push-type\.liveactivity$/,"")).map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.channelId," · ",a.storagePolicy]},a.id))]})]}),ad&&(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_9rem_10rem]",children:[(0,b.jsx)(t.Input,{autoComplete:"off",onChange:a=>ag(a.target.value),placeholder:a("liveActivityToken"),value:af}),(0,b.jsxs)(w.Select,{onValueChange:ai,value:ah,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"HEX",children:"HEX"}),(0,b.jsx)(w.SelectItem,{value:"BASE64",children:"Base64"})]})]}),(0,b.jsxs)(w.Select,{onValueChange:ak,value:aj,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,b.jsx)(w.SelectItem,{value:"PRODUCTION",children:"Production"})]})]})]}),!ab&&!ad&&(0,b.jsx)(O,{allEligible:_,eligible:aH,onAllEligible:aa,onSelected:$,selected:Z}),(0,b.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,b.jsxs)(p.Button,{disabled:ax||!aF.value,onClick:()=>void aI("mutation Draft($editor: JSON!) { savePushNotificationDraft(editor: $editor) { id } }",{editor:aF.value},a("draftSaved")),variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",a("saveDraft")]}),(0,b.jsxs)(p.Button,{disabled:ax||!aF.value||(ad?!af.trim():!ab&&!_&&0===Z.size),onClick:()=>void aJ(),children:[ax?(0,b.jsx)(x.Spinner,{}):(0,b.jsx)(h.Send,{})," ",a("send")]})]})]})]})]})]}),(0,b.jsx)(P,{channels:T,load:aD}),(0,b.jsx)(y.Tabs,{onValueChange:ao,value:an,children:(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{className:"border-b py-4 max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(q.CardTitle,{children:"history"===an?a("history"):a("presets")}),(0,b.jsx)(q.CardDescription,{children:"history"===an?a("historyDescription"):a("presetsDescription")}),(0,b.jsxs)(q.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:[(0,b.jsxs)(w.Select,{onValueChange:ao,value:an,children:[(0,b.jsx)(w.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"history",children:a("history")}),(0,b.jsx)(w.SelectItem,{value:"presets",children:a("presets")})]})]}),(0,b.jsxs)(y.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsxs)(y.TabsTrigger,{value:"history",children:[(0,b.jsx)(f.History,{})," ",a("history")]}),(0,b.jsxs)(y.TabsTrigger,{value:"presets",children:[(0,b.jsx)(g.Save,{})," ",a("presets")]})]})]})]}),(0,b.jsxs)(y.TabsContent,{value:"history",children:[(0,b.jsx)(Q,{batches:X,expanded:at,locale:e,onDelete:a=>aI("mutation Delete($id: ID!) { deletePushNotificationHistory(id: $id) }",{id:a}),onLoad:aK,onPreset:b=>{aq(`${a("presetFromHistory")} ${new Date(b.createdAt).toLocaleDateString(e)}`),aK(b.editor)},onResend:b=>aI("mutation Resend($id: ID!, $requestId: ID!) { resendPushNotification(id: $id, requestId: $requestId) { id } }",{id:b,requestId:(0,B.createClientId)()},a("queued")),setExpanded:au}),X.length>0&&(0,b.jsx)("div",{className:"flex justify-end border-t p-3",children:(0,b.jsx)(m.ConfirmationDialog,{actionLabel:a("clearHistory"),cancelLabel:d("cancel"),description:a("clearHistoryDescription"),onConfirm:()=>aI("mutation { clearPushNotificationHistory }"),title:a("clearHistory"),trigger:(0,b.jsxs)(p.Button,{variant:"outline",children:[(0,b.jsx)(i.Trash2,{})," ",a("clearHistory")]})})})]}),(0,b.jsx)(y.TabsContent,{value:"presets",children:(0,b.jsx)(R,{expanded:ar,onDelete:a=>aI("mutation Delete($id: ID!) { deletePushNotificationPreset(id: $id) }",{id:a}),onLoad:aK,onSend:(b,c,d)=>aI("mutation SendPreset($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,B.createClientId)(),editor:b.editor,targetMode:c?"ALL":"DEVICES",registrationIds:d}},a("queued")),presets:V,registrations:v,setExpanded:as})})]})}),av&&(0,b.jsx)("div",{className:"fixed bottom-4 right-4 rounded-full bg-background p-3 shadow",children:(0,b.jsx)(x.Spinner,{})})]})},"editorStateFromSaved",0,K,"editorStateWithPushType",0,L])}];
10
+ }`;function H(a){if(!a.trim())return;let b=Number(a);return Number.isFinite(b)?b:void 0}function I(a){let b=a.split(",").map(a=>a.trim()).filter(Boolean);return b.length?b:void 0}function J(a,b){let c;try{c=JSON.parse(a)}catch{throw Error(`${b} must be valid JSON`)}if(!c||"object"!=typeof c||Array.isArray(c))throw Error(`${b} must be a JSON object`);return c}function K(a){let b=a.headers??{},c=a.aps??{},d=c.alert??{},e=a.liveActivity??{},f=c.sound,g=f&&"object"==typeof f&&!Array.isArray(f)?f:null,h=a=>Array.isArray(a)?a.map(String).join(", "):"";return{...F,pushType:a.pushType??"alert",topic:String(b.topic??""),priority:String(b.priority??10),apnsId:String(b.id??""),expiration:String(b.expiration??""),collapseId:String(b.collapseId??""),title:String(d.title??""),subtitle:String(d.subtitle??""),body:String(d.body??""),titleLocKey:String(d["title-loc-key"]??""),titleLocArgs:h(d["title-loc-args"]),subtitleLocKey:String(d["subtitle-loc-key"]??""),subtitleLocArgs:h(d["subtitle-loc-args"]),locKey:String(d["loc-key"]??""),locArgs:h(d["loc-args"]),launchImage:String(d["launch-image"]??""),summaryArg:String(d["summary-arg"]??""),summaryArgCount:void 0===d["summary-arg-count"]?"":String(d["summary-arg-count"]),badge:void 0===c.badge?"":String(c.badge),soundName:"string"==typeof f?f:String(g?.name??""),criticalSound:g?.critical===1,soundVolume:g?.volume===void 0?"1":String(g.volume),category:String(c.category??""),threadId:String(c["thread-id"]??""),contentAvailable:1===c["content-available"],mutableContent:1===c["mutable-content"],targetContentId:String(c["target-content-id"]??""),interruptionLevel:String(c["interruption-level"]??"active"),relevanceScore:void 0===c["relevance-score"]?"":String(c["relevance-score"]),customJson:JSON.stringify(a.custom??{},null,2),liveTimestamp:String(e.timestamp??Math.floor(Date.now()/1e3)),liveEvent:e.event??"update",liveContentState:JSON.stringify(e["content-state"]??{},null,2),liveAttributesType:String(e["attributes-type"]??""),liveAttributes:JSON.stringify(e.attributes??{},null,2),liveStaleDate:void 0===e["stale-date"]?"":String(e["stale-date"]),liveDismissalDate:void 0===e["dismissal-date"]?"":String(e["dismissal-date"]),liveInputPushToken:1===e["input-push-token"],credentialId:String(a.credentialId??"")}}function L(a,b){return{...a,pushType:b,..."background"===b?{priority:"5"}:{},..."mdm"===b?{}:{credentialId:""}}}function M({label:a,children:c,className:d}){return(0,b.jsxs)("div",{className:(0,D.cn)("space-y-2",d),children:[(0,b.jsx)(u.Label,{children:a}),c]})}function N({label:a,checked:c,onChange:d}){return(0,b.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)(r.Checkbox,{checked:c,onCheckedChange:a=>d(!!a)}),a]})}function O({eligible:a,selected:c,allEligible:d,onSelected:f,onAllEligible:g}){let h=(0,k.useTranslations)("pushNotifications");return(0,b.jsxs)(v.Popover,{children:[(0,b.jsx)(v.PopoverTrigger,{asChild:!0,children:(0,b.jsxs)(p.Button,{className:"w-full justify-between",variant:"outline",children:[d?h("allEligibleDevices",{count:a.length}):h("selectedDevices",{count:c.size}),(0,b.jsx)(e.ChevronDown,{})]})}),(0,b.jsx)(v.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:(0,b.jsxs)(s.Command,{children:[(0,b.jsx)(s.CommandInput,{placeholder:h("searchDevices")}),(0,b.jsxs)(s.CommandList,{children:[(0,b.jsx)(s.CommandEmpty,{children:h("noEligibleDevices")}),(0,b.jsxs)(s.CommandGroup,{children:[(0,b.jsx)(s.CommandItem,{"data-checked":d,onSelect:()=>{g(!d),d||f(new Set)},value:"all-eligible",children:h("allEligibleDevices",{count:a.length})}),a.map(a=>(0,b.jsxs)(s.CommandItem,{"data-checked":c.has(a.id),onSelect:()=>{g(!1);let b=new Set(c);b.has(a.id)?b.delete(a.id):b.add(a.id),f(b)},value:`${a.displayName} ${a.tokenMasked}`,children:[a.displayName,(0,b.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:a.environment})]},a.id))]})]})]})})]})}function P({channels:a,load:c}){let d=(0,k.useTranslations)("pushNotifications"),e=(0,k.useTranslations)("common"),[f,g]=(0,l.useState)(""),[h,j]=(0,l.useState)("SANDBOX"),[n,o]=(0,l.useState)("NO_STORAGE"),[r,s]=(0,l.useState)(!1),u=async()=>{s(!0);try{await (0,C.controlPlaneRequest)("mutation Create($input: CreateApnsBroadcastChannelInput!) { createApnsBroadcastChannel(input: $input) { id } }",{input:{bundleId:f,environment:h,storagePolicy:n}}),g(""),await c()}finally{s(!1)}};return(0,b.jsxs)(q.Card,{children:[(0,b.jsxs)(q.CardHeader,{children:[(0,b.jsx)(q.CardTitle,{children:d("broadcastChannels")}),(0,b.jsx)(q.CardDescription,{children:d("broadcastDescription")})]}),(0,b.jsxs)(q.CardContent,{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-4",children:[(0,b.jsx)(t.Input,{onChange:a=>g(a.target.value),placeholder:d("bundleId"),value:f}),(0,b.jsxs)(w.Select,{onValueChange:j,value:h,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,b.jsx)(w.SelectItem,{value:"PRODUCTION",children:"Production"})]})]}),(0,b.jsxs)(w.Select,{onValueChange:o,value:n,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"NO_STORAGE",children:d("noStorage")}),(0,b.jsx)(w.SelectItem,{value:"MOST_RECENT",children:d("mostRecent")})]})]}),(0,b.jsx)(p.Button,{disabled:r||!f,onClick:()=>void u(),children:d("createChannel")})]}),(0,b.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"font-mono text-xs",children:a.channelId}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a.bundleId," · ",a.environment," ·"," ",a.storagePolicy]})]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:d("delete"),cancelLabel:e("cancel"),description:d("deleteChannelDescription"),onConfirm:async()=>{await (0,C.controlPlaneRequest)("mutation Delete($id: ID!) { deleteApnsBroadcastChannel(id: $id) }",{id:a.id}),await c()},title:d("deleteChannel"),trigger:(0,b.jsx)(p.Button,{size:"icon-sm",variant:"ghost",children:(0,b.jsx)(i.Trash2,{})})})]},a.id))})]})]})}function Q({batches:a,expanded:c,setExpanded:d,onLoad:f,onResend:j,onPreset:n,onDelete:q,locale:r}){let s=(0,k.useTranslations)("pushNotifications"),t=(0,k.useTranslations)("common");return 0===a.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:s("noHistory")}):(0,b.jsxs)(z.Table,{children:[(0,b.jsx)(z.TableHeader,{children:(0,b.jsxs)(z.TableRow,{children:[(0,b.jsx)(z.TableHead,{className:"w-12"}),(0,b.jsx)(z.TableHead,{children:s("created")}),(0,b.jsx)(z.TableHead,{children:s("pushType")}),(0,b.jsx)(z.TableHead,{children:s("deliveryMode")}),(0,b.jsx)(z.TableHead,{children:s("recipients")}),(0,b.jsx)(z.TableHead,{children:s("result")}),(0,b.jsx)(z.TableHead,{children:s("status")})]})}),(0,b.jsx)(z.TableBody,{children:a.map(a=>(0,b.jsxs)(l.Fragment,{children:[(0,b.jsxs)(z.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let b;return b=a.id,d(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:[(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(e.ChevronDown,{className:(0,D.cn)("transition-transform",c.has(a.id)&&"rotate-180")})}),(0,b.jsx)(z.TableCell,{children:new Date(a.createdAt).toLocaleString(r)}),(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"secondary",children:String(a.editor.pushType??"—")})}),(0,b.jsx)(z.TableCell,{children:a.targetMode}),(0,b.jsx)(z.TableCell,{children:a.recipientCount}),(0,b.jsxs)(z.TableCell,{children:[a.successCount," / ",a.failureCount]}),(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"FAILED"===a.status?"destructive":"outline",children:a.status})})]}),c.has(a.id)&&(0,b.jsx)(z.TableRow,{className:"hover:bg-transparent",children:(0,b.jsxs)(z.TableCell,{colSpan:7,className:"bg-muted/20 p-5",children:[(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(u.Label,{children:s("payload")}),(0,b.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.payload,null,2)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(u.Label,{children:s("headers")}),(0,b.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.headers,null,2)})]})]}),a.deliveries.length>0&&(0,b.jsx)("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:a.deliveries.map(a=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background p-3",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"font-mono text-xs",children:a.topic}),(0,b.jsx)(o.Badge,{variant:"SUCCEEDED"===a.status?"default":"destructive",children:a.status})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["HTTP ",a.responseCode??"—"," ·"," ",a.reason??"—"," · ",a.attempts," ",s("attempts")," · ",a.durationMs??"—"," ms"]}),a.apnsId&&(0,b.jsx)("p",{className:"font-mono text-xs",children:a.apnsId})]},a.id))}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[(0,b.jsx)(p.Button,{onClick:()=>f(a.editor),variant:"outline",children:s("load")}),(0,b.jsxs)(p.Button,{onClick:()=>n(a),variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",s("saveAsPreset")]}),"DRAFT"!==a.targetMode&&(0,b.jsxs)(p.Button,{onClick:()=>void j(a.id),children:[(0,b.jsx)(h.Send,{})," ",s("resend")]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:s("delete"),cancelLabel:t("cancel"),description:s("deleteHistoryDescription"),onConfirm:()=>q(a.id),title:s("deleteHistory"),trigger:(0,b.jsxs)(p.Button,{disabled:["QUEUED","SENDING"].includes(a.status),variant:"ghost",children:[(0,b.jsx)(i.Trash2,{})," ",s("delete")]})})]})]})})]},a.id))})]})}function R({presets:a,registrations:c,expanded:f,setExpanded:g,onLoad:h,onSend:j,onDelete:n}){let o=(0,k.useTranslations)("pushNotifications"),q=(0,k.useTranslations)("common");return 0===a.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:o("noPresets")}):(0,b.jsxs)(z.Table,{children:[(0,b.jsx)(z.TableHeader,{children:(0,b.jsxs)(z.TableRow,{children:[(0,b.jsx)(z.TableHead,{className:"w-12"}),(0,b.jsx)(z.TableHead,{children:o("name")}),(0,b.jsx)(z.TableHead,{children:o("pushType")}),(0,b.jsx)(z.TableHead,{children:o("topic")}),(0,b.jsx)(z.TableHead,{children:o("updated")})]})}),(0,b.jsx)(z.TableBody,{children:a.map(a=>(0,b.jsxs)(l.Fragment,{children:[(0,b.jsxs)(z.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let b;return b=a.id,g(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},children:[(0,b.jsx)(z.TableCell,{children:(0,b.jsx)(e.ChevronDown,{className:(0,D.cn)("transition-transform",f.has(a.id)&&"rotate-180")})}),(0,b.jsx)(z.TableCell,{className:"font-medium",children:a.name}),(0,b.jsx)(z.TableCell,{children:String(a.editor.pushType??"—")}),(0,b.jsx)(z.TableCell,{className:"font-mono text-xs",children:String(a.editor.headers?.topic??"—")}),(0,b.jsx)(z.TableCell,{children:new Date(a.updatedAt).toLocaleString()})]}),f.has(a.id)&&(0,b.jsx)(z.TableRow,{children:(0,b.jsxs)(z.TableCell,{className:"bg-muted/20 p-5",colSpan:5,children:[(0,b.jsx)("pre",{className:"max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(a.editor,null,2)}),(0,b.jsxs)("div",{className:"mt-4 flex flex-wrap items-end justify-end gap-2",children:[(0,b.jsx)(S,{onSend:(b,c)=>j(a,b,c),preset:a,registrations:c}),(0,b.jsxs)(p.Button,{onClick:()=>h(a.editor),children:[(0,b.jsx)(d.Check,{})," ",o("loadEdit")]}),(0,b.jsx)(m.ConfirmationDialog,{actionLabel:o("delete"),cancelLabel:q("cancel"),description:o("deletePresetDescription"),onConfirm:()=>n(a.id),title:o("deletePreset"),trigger:(0,b.jsxs)(p.Button,{variant:"ghost",children:[(0,b.jsx)(i.Trash2,{})," ",o("delete")]})})]})]})})]},a.id))})]})}function S({preset:a,registrations:c,onSend:d}){let e=(0,k.useTranslations)("pushNotifications"),[f,g]=(0,l.useState)(new Set),[i,j]=(0,l.useState)(!1),[m,n]=(0,l.useState)(!1),o=String((a.editor.headers??{}).topic??""),q=String(a.editor.pushType??""),r=c.filter(a=>"ACTIVE"===a.status&&a.topic===o&&a.supportedPushTypes.includes(q));return(0,b.jsxs)("div",{className:"grid min-w-72 flex-1 gap-2 sm:max-w-xl sm:grid-cols-[1fr_auto]",children:[(0,b.jsx)(O,{allEligible:i,eligible:r,onAllEligible:j,onSelected:g,selected:f}),(0,b.jsxs)(p.Button,{disabled:m||!i&&0===f.size,onClick:()=>void(async()=>{n(!0);try{await d(i,[...f]),j(!1),g(new Set)}finally{n(!1)}})(),children:[m?(0,b.jsx)(x.Spinner,{}):(0,b.jsx)(h.Send,{})," ",e("send")]})]})}a.s(["PushNotificationsPage",0,function(){let a=(0,k.useTranslations)("pushNotifications"),d=(0,k.useTranslations)("common"),e=(0,j.useLocale)(),[r,s]=(0,l.useState)(F),[v,z]=(0,l.useState)([]),[D,S]=(0,l.useState)([]),[T,U]=(0,l.useState)([]),[V,W]=(0,l.useState)([]),[X,Y]=(0,l.useState)([]),[Z,$]=(0,l.useState)(new Set),[_,aa]=(0,l.useState)(!1),[ab,ac]=(0,l.useState)(""),[ad,ae]=(0,l.useState)(!1),[af,ag]=(0,l.useState)(""),[ah,ai]=(0,l.useState)("HEX"),[aj,ak]=(0,l.useState)("SANDBOX"),[al,am]=(0,l.useState)("content"),[an,ao]=(0,l.useState)("history"),[ap,aq]=(0,l.useState)(""),[ar,as]=(0,l.useState)(new Set),[at,au]=(0,l.useState)(new Set),[av,aw]=(0,l.useState)(!0),[ax,ay]=(0,l.useState)(!1),[az,aA]=(0,l.useState)(null),[aB,aC]=(0,l.useState)(null),aD=(0,l.useCallback)(async()=>{try{let a=await (0,C.controlPlaneRequest)(G);z(a.apnsRegistrations),S(a.pushNotificationSettings.certificates),U(a.apnsBroadcastChannels),W(a.pushNotificationPresets),Y(a.pushNotificationHistory),aA(null)}catch(a){aA(a instanceof Error?a.message:String(a))}finally{aw(!1)}},[]);(0,l.useEffect)(()=>{let a=window.setTimeout(()=>void aD(),0),b=(0,C.controlPlaneSubscriptions)().subscribe({query:"subscription { pushNotificationsChanged }"},{next:()=>void aD(),error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(a),b()}},[aD]);let aE=(a,b)=>s(c=>({...c,[a]:b})),aF=(0,l.useMemo)(()=>{try{let b=Object.fromEntries(Object.entries({title:r.title||void 0,subtitle:r.subtitle||void 0,body:r.body||void 0,"title-loc-key":r.titleLocKey||void 0,"title-loc-args":I(r.titleLocArgs),"subtitle-loc-key":r.subtitleLocKey||void 0,"subtitle-loc-args":I(r.subtitleLocArgs),"loc-key":r.locKey||void 0,"loc-args":I(r.locArgs),"launch-image":r.launchImage||void 0,"summary-arg":r.summaryArg||void 0,"summary-arg-count":H(r.summaryArgCount)}).filter(([,a])=>void 0!==a)),c=Object.fromEntries(Object.entries({alert:Object.keys(b).length?b:void 0,badge:H(r.badge),sound:r.soundName?r.criticalSound?{critical:1,name:r.soundName,volume:Number(r.soundVolume)}:r.soundName:void 0,category:r.category||void 0,"thread-id":r.threadId||void 0,"content-available":r.contentAvailable?1:void 0,"mutable-content":r.mutableContent?1:void 0,"target-content-id":r.targetContentId||void 0,"interruption-level":r.interruptionLevel||void 0,"relevance-score":H(r.relevanceScore)}).filter(([,a])=>void 0!==a)),d=["background","mdm"].includes(r.pushType)?{}:c;return{value:{pushType:r.pushType,headers:{id:r.apnsId||void 0,topic:r.topic,priority:Number(r.priority),expiration:r.expiration||void 0,collapseId:r.collapseId||void 0,broadcastChannelId:ab||void 0},aps:d,custom:J(r.customJson,a("customJson")),liveActivity:"liveactivity"===r.pushType?{timestamp:Number(r.liveTimestamp),event:r.liveEvent,"content-state":J(r.liveContentState,a("contentState")),"attributes-type":r.liveAttributesType||void 0,attributes:"start"===r.liveEvent?J(r.liveAttributes,a("attributes")):void 0,"stale-date":H(r.liveStaleDate),"dismissal-date":H(r.liveDismissalDate),"input-push-token":r.liveInputPushToken?1:void 0}:void 0,credentialId:r.credentialId||null},error:null}}catch(a){return{value:null,error:a instanceof Error?a.message:String(a)}}},[ab,r,a]),aG=(0,l.useMemo)(()=>{if(!aF.value)return null;let a=aF.value,b="mdm"===a.pushType?{mdm:"<PushMagic>"}:{...a.custom,aps:"liveactivity"===a.pushType?{...a.aps,...a.liveActivity}:a.aps},c=JSON.stringify(b,null,2);return{payload:b,text:c,bytes:new TextEncoder().encode(JSON.stringify(b)).length}},[aF]),aH=v.filter(a=>"ACTIVE"===a.status&&a.topic===r.topic&&a.supportedPushTypes.includes(r.pushType)),aI=async(a,b,c)=>{ay(!0),aA(null),aC(null);try{await (0,C.controlPlaneRequest)(a,b),c&&aC(c),await aD()}catch(a){aA(a instanceof Error?a.message:String(a))}finally{ay(!1)}},aJ=async()=>{aF.value?await aI("mutation SendPush($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,B.createClientId)(),editor:aF.value,targetMode:ab?"BROADCAST":ad?"DIRECT":_?"ALL":"DEVICES",registrationIds:[...Z],channelId:ab||null,directToken:ad?af:null,directTokenEncoding:ad?ah:null,directEnvironment:ad?aj:null}},a("queued")):aA(aF.error)},aK=a=>{$(new Set),aa(!1),ac(""),ae(!1),ag(""),s(K(a))};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("h1",{className:"flex items-center gap-2 text-2xl font-semibold tracking-tight",children:[(0,b.jsx)(c.BellRing,{})," ",a("title")]}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),az&&(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:az})}),aB&&(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:aB})}),(0,b.jsxs)(q.Card,{children:[(0,b.jsxs)(q.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(q.CardTitle,{children:a("editor")}),(0,b.jsx)(q.CardDescription,{children:a("editorDescription")}),(0,b.jsx)(q.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:(0,b.jsxs)("div",{className:"grid gap-2 sm:flex",children:[(0,b.jsx)(t.Input,{className:"w-full sm:w-48",onChange:a=>aq(a.target.value),placeholder:a("presetName"),value:ap}),(0,b.jsxs)(p.Button,{disabled:ax||!aF.value||!ap.trim(),onClick:()=>void aI("mutation SavePreset($name: String!, $editor: JSON!) { savePushNotificationPreset(name: $name, editor: $editor) { id } }",{name:ap,editor:aF.value},a("presetSaved")),size:"sm",variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",a("savePreset")]})]})})]}),(0,b.jsxs)(q.CardContent,{className:"space-y-5",children:[(0,b.jsxs)(y.Tabs,{onValueChange:am,value:al,children:[(0,b.jsxs)(w.Select,{onValueChange:am,value:al,children:[(0,b.jsx)(w.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"content",children:a("content")}),(0,b.jsx)(w.SelectItem,{value:"headers",children:a("headers")}),(0,b.jsx)(w.SelectItem,{value:"advanced",children:a("advanced")}),(0,b.jsx)(w.SelectItem,{value:"specialized",children:a("specialized")})]})]}),(0,b.jsxs)(y.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsx)(y.TabsTrigger,{value:"content",children:a("content")}),(0,b.jsx)(y.TabsTrigger,{value:"headers",children:a("headers")}),(0,b.jsx)(y.TabsTrigger,{value:"advanced",children:a("advanced")}),(0,b.jsx)(y.TabsTrigger,{value:"specialized",children:a("specialized")})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 space-y-4",value:"content",children:[(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("pushType"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>{s(b=>L(b,a)),"liveactivity"!==a&&(ae(!1),ac(""))},value:r.pushType,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("titleField"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("title",a.target.value),value:r.title})}),(0,b.jsx)(M,{label:a("subtitle"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitle",a.target.value),value:r.subtitle})})]}),(0,b.jsx)(M,{label:a("body"),children:(0,b.jsx)(A.Textarea,{onChange:a=>aE("body",a.target.value),rows:4,value:r.body})}),(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,b.jsx)(M,{label:a("badge"),children:(0,b.jsx)(t.Input,{inputMode:"numeric",onChange:a=>aE("badge",a.target.value),value:r.badge})}),(0,b.jsx)(M,{label:a("sound"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("soundName",a.target.value),value:r.soundName})}),(0,b.jsx)(M,{label:a("category"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("category",a.target.value),value:r.category})}),(0,b.jsx)(M,{label:a("threadId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("threadId",a.target.value),value:r.threadId})})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-5",children:[(0,b.jsx)(N,{checked:r.contentAvailable,label:a("contentAvailable"),onChange:a=>aE("contentAvailable",a)}),(0,b.jsx)(N,{checked:r.mutableContent,label:a("mutableContent"),onChange:a=>aE("mutableContent",a)}),(0,b.jsx)(N,{checked:r.criticalSound,label:a("criticalSound"),onChange:a=>aE("criticalSound",a)})]}),r.criticalSound&&(0,b.jsx)(M,{label:a("soundVolume"),children:(0,b.jsx)(t.Input,{className:"max-w-40",max:"1",min:"0",onChange:a=>aE("soundVolume",a.target.value),step:"0.1",type:"number",value:r.soundVolume})})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",value:"headers",children:[(0,b.jsx)(M,{label:a("topic"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("topic",a.target.value),placeholder:"com.example.app",value:r.topic})}),(0,b.jsx)(M,{label:a("priority"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("priority",a),value:r.priority,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["1","5","10"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("apnsId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("apnsId",a.target.value),value:r.apnsId})}),(0,b.jsx)(M,{label:a("expiration"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("expiration",a.target.value),placeholder:"0 / Unix timestamp",value:r.expiration})}),(0,b.jsx)(M,{label:a("collapseId"),children:(0,b.jsx)(t.Input,{maxLength:64,onChange:a=>aE("collapseId",a.target.value),value:r.collapseId})}),"mdm"===r.pushType&&(0,b.jsx)(M,{label:a("certificateCredential"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("credentialId",a),value:r.credentialId,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{placeholder:a("selectCredential")})}),(0,b.jsx)(w.SelectContent,{children:D.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name," · ",a.environment]},a.id))})]})})]}),(0,b.jsxs)(y.TabsContent,{className:"mt-4 space-y-4",value:"advanced",children:[(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("titleLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("titleLocKey",a.target.value),value:r.titleLocKey})}),(0,b.jsx)(M,{label:a("titleLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("titleLocArgs",a.target.value),value:r.titleLocArgs})}),(0,b.jsx)(M,{label:a("subtitleLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitleLocKey",a.target.value),value:r.subtitleLocKey})}),(0,b.jsx)(M,{label:a("subtitleLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("subtitleLocArgs",a.target.value),value:r.subtitleLocArgs})}),(0,b.jsx)(M,{label:a("bodyLocKey"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("locKey",a.target.value),value:r.locKey})}),(0,b.jsx)(M,{label:a("bodyLocArgs"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("locArgs",a.target.value),value:r.locArgs})}),(0,b.jsx)(M,{label:a("launchImage"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("launchImage",a.target.value),value:r.launchImage})}),(0,b.jsx)(M,{label:a("summaryArg"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("summaryArg",a.target.value),value:r.summaryArg})}),(0,b.jsx)(M,{label:a("summaryArgCount"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("summaryArgCount",a.target.value),value:r.summaryArgCount})}),(0,b.jsx)(M,{label:a("targetContentId"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("targetContentId",a.target.value),value:r.targetContentId})}),(0,b.jsx)(M,{label:a("interruptionLevel"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("interruptionLevel",a),value:r.interruptionLevel,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["passive","active","time-sensitive","critical"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("relevanceScore"),children:(0,b.jsx)(t.Input,{max:"1",min:"0",onChange:a=>aE("relevanceScore",a.target.value),step:"0.1",type:"number",value:r.relevanceScore})})]}),(0,b.jsx)(M,{label:a("customJson"),children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",onChange:a=>aE("customJson",a.target.value),rows:7,value:r.customJson})})]}),(0,b.jsx)(y.TabsContent,{className:"mt-4 space-y-4",value:"specialized",children:"liveactivity"===r.pushType?(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,b.jsx)(M,{label:a("timestamp"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveTimestamp",a.target.value),value:r.liveTimestamp})}),(0,b.jsx)(M,{label:a("event"),children:(0,b.jsxs)(w.Select,{onValueChange:a=>aE("liveEvent",a),value:r.liveEvent,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsx)(w.SelectContent,{children:["start","update","end"].map(a=>(0,b.jsx)(w.SelectItem,{value:a,children:a},a))})]})}),(0,b.jsx)(M,{label:a("attributesType"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveAttributesType",a.target.value),value:r.liveAttributesType})}),(0,b.jsx)(M,{label:a("contentState"),className:"sm:col-span-2",children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",onChange:a=>aE("liveContentState",a.target.value),rows:5,value:r.liveContentState})}),(0,b.jsx)(M,{label:a("attributes"),children:(0,b.jsx)(A.Textarea,{className:"font-mono text-xs",disabled:"start"!==r.liveEvent,onChange:a=>aE("liveAttributes",a.target.value),rows:5,value:r.liveAttributes})}),(0,b.jsx)(M,{label:a("staleDate"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveStaleDate",a.target.value),value:r.liveStaleDate})}),(0,b.jsx)(M,{label:a("dismissalDate"),children:(0,b.jsx)(t.Input,{onChange:a=>aE("liveDismissalDate",a.target.value),value:r.liveDismissalDate})}),(0,b.jsx)(N,{checked:r.liveInputPushToken,label:a("inputPushToken"),onChange:a=>aE("liveInputPushToken",a)})]}):"mdm"===r.pushType?(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:a("mdmHelp")})}):(0,b.jsx)(n.Alert,{children:(0,b.jsx)(n.AlertDescription,{children:a("specializedHelp",{type:r.pushType})})})})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(u.Label,{children:a("payloadPreview")}),(0,b.jsxs)(o.Badge,{variant:aF.error||aG&&aG.bytes>("voip"===r.pushType?5120:4096)?"destructive":"secondary",children:[aG?.bytes??0," /"," ","voip"===r.pushType?5120:4096," bytes"]})]}),aF.error?(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:aF.error})}):(0,b.jsx)("pre",{className:"max-h-80 overflow-auto rounded-xl bg-muted p-4 text-xs",children:aG?.text})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(u.Label,{children:a("recipients")}),"liveactivity"===r.pushType&&(0,b.jsxs)(w.Select,{onValueChange:a=>{ae("TOKEN"===a),ac("DEVICES"===a||"TOKEN"===a?"":a)},value:ad?"TOKEN":ab||"DEVICES",children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"DEVICES",children:a("directDevices")}),(0,b.jsx)(w.SelectItem,{value:"TOKEN",children:a("directToken")}),T.filter(a=>a.bundleId===r.topic.replace(/\.push-type\.liveactivity$/,"")).map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.channelId," · ",a.storagePolicy]},a.id))]})]}),ad&&(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_9rem_10rem]",children:[(0,b.jsx)(t.Input,{autoComplete:"off",onChange:a=>ag(a.target.value),placeholder:a("liveActivityToken"),value:af}),(0,b.jsxs)(w.Select,{onValueChange:ai,value:ah,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"HEX",children:"HEX"}),(0,b.jsx)(w.SelectItem,{value:"BASE64",children:"Base64"})]})]}),(0,b.jsxs)(w.Select,{onValueChange:ak,value:aj,children:[(0,b.jsx)(w.SelectTrigger,{children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,b.jsx)(w.SelectItem,{value:"PRODUCTION",children:"Production"})]})]})]}),!ab&&!ad&&(0,b.jsx)(O,{allEligible:_,eligible:aH,onAllEligible:aa,onSelected:$,selected:Z}),(0,b.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,b.jsxs)(p.Button,{disabled:ax||!aF.value,onClick:()=>void aI("mutation Draft($editor: JSON!) { savePushNotificationDraft(editor: $editor) { id } }",{editor:aF.value},a("draftSaved")),variant:"outline",children:[(0,b.jsx)(g.Save,{})," ",a("saveDraft")]}),(0,b.jsxs)(p.Button,{disabled:ax||!aF.value||(ad?!af.trim():!ab&&!_&&0===Z.size),onClick:()=>void aJ(),children:[ax?(0,b.jsx)(x.Spinner,{}):(0,b.jsx)(h.Send,{})," ",a("send")]})]})]})]})]})]}),(0,b.jsx)(P,{channels:T,load:aD}),(0,b.jsx)(y.Tabs,{onValueChange:ao,value:an,children:(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(q.CardTitle,{children:"history"===an?a("history"):a("presets")}),(0,b.jsx)(q.CardDescription,{children:"history"===an?a("historyDescription"):a("presetsDescription")}),(0,b.jsxs)(q.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:[(0,b.jsxs)(w.Select,{onValueChange:ao,value:an,children:[(0,b.jsx)(w.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(w.SelectValue,{})}),(0,b.jsxs)(w.SelectContent,{children:[(0,b.jsx)(w.SelectItem,{value:"history",children:a("history")}),(0,b.jsx)(w.SelectItem,{value:"presets",children:a("presets")})]})]}),(0,b.jsxs)(y.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsxs)(y.TabsTrigger,{value:"history",children:[(0,b.jsx)(f.History,{})," ",a("history")]}),(0,b.jsxs)(y.TabsTrigger,{value:"presets",children:[(0,b.jsx)(g.Save,{})," ",a("presets")]})]})]})]}),(0,b.jsxs)(y.TabsContent,{value:"history",children:[(0,b.jsx)(Q,{batches:X,expanded:at,locale:e,onDelete:a=>aI("mutation Delete($id: ID!) { deletePushNotificationHistory(id: $id) }",{id:a}),onLoad:aK,onPreset:b=>{aq(`${a("presetFromHistory")} ${new Date(b.createdAt).toLocaleDateString(e)}`),aK(b.editor)},onResend:b=>aI("mutation Resend($id: ID!, $requestId: ID!) { resendPushNotification(id: $id, requestId: $requestId) { id } }",{id:b,requestId:(0,B.createClientId)()},a("queued")),setExpanded:au}),X.length>0&&(0,b.jsx)("div",{className:"flex justify-end border-t p-3",children:(0,b.jsx)(m.ConfirmationDialog,{actionLabel:a("clearHistory"),cancelLabel:d("cancel"),description:a("clearHistoryDescription"),onConfirm:()=>aI("mutation { clearPushNotificationHistory }"),title:a("clearHistory"),trigger:(0,b.jsxs)(p.Button,{variant:"outline",children:[(0,b.jsx)(i.Trash2,{})," ",a("clearHistory")]})})})]}),(0,b.jsx)(y.TabsContent,{value:"presets",children:(0,b.jsx)(R,{expanded:ar,onDelete:a=>aI("mutation Delete($id: ID!) { deletePushNotificationPreset(id: $id) }",{id:a}),onLoad:aK,onSend:(b,c,d)=>aI("mutation SendPreset($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,B.createClientId)(),editor:b.editor,targetMode:c?"ALL":"DEVICES",registrationIds:d}},a("queued")),presets:V,registrations:v,setExpanded:as})})]})}),av&&(0,b.jsx)("div",{className:"fixed bottom-4 right-4 rounded-full bg-background p-3 shadow",children:(0,b.jsx)(x.Spinner,{})})]})},"editorStateFromSaved",0,K,"editorStateWithPushType",0,L])}];
11
11
 
12
12
  //# sourceMappingURL=src_components_push-notifications_push-notifications-page_tsx_1c_b-t4._.js.map
@@ -32,6 +32,6 @@ module.exports=[883537,a=>{"use strict";var b=a.i(187924),c=a.i(536670),d=a.i(12
32
32
  importSigningIdentity(p12Base64: $content, passphrase: $passphrase, targetAgentIds: $agents) { id }
33
33
  }`,{content:await A(a),passphrase:V,agents:[...T]}),W(""))},aw=async a=>{let b=a.installedAgents[0];if(b){ai(!0);try{let c=await (0,x.controlPlaneRequest)(`mutation DownloadProfile($uuid: String!, $agentId: ID!) {
34
34
  downloadSigningProfile(uuid: $uuid, agentId: $agentId) { filename contentBase64 }
35
- }`,{uuid:a.uuid,agentId:b.id});C(c.downloadSigningProfile.contentBase64,c.downloadSigningProfile.filename)}catch(a){am(a instanceof Error?a.message:String(a))}finally{ai(!1)}}};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:a("title")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),(0,b.jsxs)(n.Button,{disabled:ah||aj||at,onClick:()=>void as(),variant:"outline",children:[(0,b.jsx)(e.RefreshCw,{className:aj||at?"animate-spin":void 0})," ",a("refresh")]})]}),al&&(0,b.jsx)(l.Alert,{variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:al})}),af.length>0&&(0,b.jsx)(D,{agents:H,jobs:af}),(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("agents")}),(0,b.jsx)(o.CardDescription,{children:a("agentsDescription")})]}),(0,b.jsx)(o.CardContent,{className:"flex flex-wrap gap-2",children:H.map(c=>(0,b.jsxs)("label",{className:"flex items-center gap-2 rounded-lg border px-3 py-2",children:[(0,b.jsx)(p.Checkbox,{checked:T.has(c.id),disabled:!c.supported,onCheckedChange:a=>U(b=>{let d=new Set(b);return a?d.add(c.id):d.delete(c.id),d})}),(0,b.jsx)("span",{children:c.name}),!c.supported&&(0,b.jsx)(m.Badge,{variant:"secondary",children:a("unsupported")})]},c.id))})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("uploadProfile")}),(0,b.jsx)(o.CardDescription,{children:a("uploadProfileDescription")})]}),(0,b.jsx)(o.CardContent,{children:(0,b.jsxs)(r.Label,{className:"flex cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed p-8",children:[(0,b.jsx)(h.Upload,{})," ",a("chooseMobileprovision"),(0,b.jsx)(q.Input,{accept:".mobileprovision,.provisionprofile",className:"sr-only",disabled:ah||!T.size,onChange:a=>void au(a.target.files?.[0]??null),type:"file"})]})})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("importIdentity")}),(0,b.jsx)(o.CardDescription,{children:a("importIdentityDescription")})]}),(0,b.jsxs)(o.CardContent,{className:"space-y-3",children:[(0,b.jsx)(q.Input,{onChange:a=>W(a.target.value),placeholder:a("passphrase"),type:"password",value:V}),(0,b.jsxs)(r.Label,{className:"flex cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed p-5",children:[(0,b.jsx)(d.KeyRound,{})," ",a("chooseP12"),(0,b.jsx)(q.Input,{accept:".p12,.pfx",className:"sr-only",disabled:ah||!T.size,onChange:a=>void av(a.target.files?.[0]??null),type:"file"})]})]})]})]}),(0,b.jsxs)(u.Tabs,{onValueChange:ae,value:ad,children:[(0,b.jsxs)(s.Select,{onValueChange:ae,value:ad,children:[(0,b.jsx)(s.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(s.SelectValue,{})}),(0,b.jsxs)(s.SelectContent,{children:[(0,b.jsx)(s.SelectItem,{value:"profiles",children:a("localProfiles")}),(0,b.jsx)(s.SelectItem,{value:"certificates",children:a("localCertificates")}),(0,b.jsx)(s.SelectItem,{value:"portal",children:a("applePortal")})]})]}),(0,b.jsxs)(u.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsxs)(u.TabsTrigger,{value:"profiles",children:[(0,b.jsx)(f.ShieldCheck,{})," ",a("localProfiles")]}),(0,b.jsxs)(u.TabsTrigger,{value:"certificates",children:[(0,b.jsx)(d.KeyRound,{})," ",a("localCertificates")]}),(0,b.jsx)(u.TabsTrigger,{value:"portal",children:a("applePortal")})]}),(0,b.jsx)(u.TabsContent,{value:"profiles",children:(0,b.jsxs)(o.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(o.CardHeader,{className:"border-b py-4 max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(o.CardTitle,{children:a("localProfiles")}),(0,b.jsx)(o.CardDescription,{children:a("profilesDescription")}),(0,b.jsx)(o.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("deleteExpired"),cancelLabel:F("cancel"),description:a("deleteExpiredDescription"),onConfirm:()=>ap("mutation { deleteExpiredSigningProfiles { id } }"),title:a("deleteExpired"),trigger:(0,b.jsxs)(n.Button,{disabled:ah,size:"sm",variant:"outline",children:[(0,b.jsx)(g.Trash2,{})," ",a("deleteExpired")]})})})]}),0===J.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:a("noLocalProfiles")}):(0,b.jsxs)(v.Table,{children:[(0,b.jsx)(v.TableHeader,{children:(0,b.jsxs)(v.TableRow,{children:[(0,b.jsx)(v.TableHead,{children:a("name")}),(0,b.jsx)(v.TableHead,{children:a("bundleId")}),(0,b.jsx)(v.TableHead,{children:a("type")}),(0,b.jsx)(v.TableHead,{children:a("team")}),(0,b.jsx)(v.TableHead,{children:a("devices")}),(0,b.jsx)(v.TableHead,{children:a("expires")}),(0,b.jsx)(v.TableHead,{children:a("installedAgents")}),(0,b.jsx)(v.TableHead,{})]})}),(0,b.jsx)(v.TableBody,{children:J.map(d=>{let e=new Set(d.installedAgents.map(a=>a.id)),f=H.filter(a=>a.supported&&!e.has(a.id)),h=`/provisioning-profiles/${encodeURIComponent(d.id)}`;return(0,b.jsxs)(v.TableRow,{"aria-label":a("viewProfile",{name:d.name}),className:"cursor-pointer focus-visible:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>G.push(h),onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),G.push(h))},role:"link",tabIndex:0,children:[(0,b.jsxs)(v.TableCell,{children:[(0,b.jsx)(w.Link,{className:"font-medium hover:underline",href:h,onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:d.name}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:d.uuid}),d.xcodeManaged&&(0,b.jsx)(m.Badge,{variant:"secondary",children:"Xcode"})]}),(0,b.jsx)(v.TableCell,{className:"font-mono text-xs",children:d.bundleId}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(m.Badge,{variant:"outline",children:d.profileType})}),(0,b.jsx)(v.TableCell,{children:d.teamName??d.teamId??"—"}),(0,b.jsx)(v.TableCell,{children:d.deviceCount}),(0,b.jsxs)(v.TableCell,{children:[d.expiresAt?new Date(d.expiresAt).toLocaleDateString():"—",d.expired&&(0,b.jsx)(m.Badge,{className:"ml-2",variant:"destructive",children:a("expired")})]}),(0,b.jsx)(v.TableCell,{children:d.installedAgents.map(a=>a.name).join(", ")}),(0,b.jsxs)(v.TableCell,{className:"space-x-1 text-right",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:[f.length>0&&d.installedAgents[0]&&(0,b.jsx)(n.Button,{disabled:ah,onClick:()=>void ap("mutation Sync($uuid: String!, $source: ID!, $targets: [ID!]!) { syncSigningProfile(uuid: $uuid, sourceAgentId: $source, targetAgentIds: $targets) { id } }",{uuid:d.uuid,source:d.installedAgents[0].id,targets:f.map(a=>a.id)}),size:"sm",variant:"outline",children:a("syncMissing")}),(0,b.jsx)(n.Button,{"aria-label":a("download"),disabled:ah||!d.installedAgents.length,onClick:()=>void aw(d),size:"icon-sm",variant:"ghost",children:(0,b.jsx)(c.Download,{})}),(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("delete"),cancelLabel:F("cancel"),description:a("deleteProfileDescription"),onConfirm:()=>ap("mutation Delete($uuid: String!, $agents: [ID!]!) { deleteSigningProfile(uuid: $uuid, agentIds: $agents) { id } }",{uuid:d.uuid,agents:d.installedAgents.map(a=>a.id)}),title:a("deleteProfile"),trigger:(0,b.jsx)(n.Button,{disabled:ah,size:"icon-sm",variant:"ghost",children:(0,b.jsx)(g.Trash2,{})})})]})]},d.id)})})]})]})}),(0,b.jsx)(u.TabsContent,{value:"certificates",children:(0,b.jsxs)(o.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(o.CardHeader,{className:"border-b py-4",children:[(0,b.jsx)(o.CardTitle,{children:a("localCertificates")}),(0,b.jsx)(o.CardDescription,{children:a("certificatesDescription")})]}),0===L.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:a("noLocalCertificates")}):(0,b.jsxs)(v.Table,{children:[(0,b.jsx)(v.TableHeader,{children:(0,b.jsxs)(v.TableRow,{children:[(0,b.jsx)(v.TableHead,{children:a("name")}),(0,b.jsx)(v.TableHead,{children:a("fingerprints")}),(0,b.jsx)(v.TableHead,{children:a("team")}),(0,b.jsx)(v.TableHead,{children:a("privateKey")}),(0,b.jsx)(v.TableHead,{children:a("expires")}),(0,b.jsx)(v.TableHead,{children:a("installedAgents")}),(0,b.jsx)(v.TableHead,{})]})}),(0,b.jsx)(v.TableBody,{children:L.map(c=>(0,b.jsxs)(v.TableRow,{children:[(0,b.jsxs)(v.TableCell,{children:[(0,b.jsx)("p",{className:"font-medium",children:c.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:c.certificateType})]}),(0,b.jsxs)(v.TableCell,{className:"font-mono text-xs",children:[(0,b.jsxs)("p",{children:["SHA-1 ",B(c.sha1)]}),(0,b.jsxs)("p",{children:["SHA-256 ",B(c.sha256)]})]}),(0,b.jsx)(v.TableCell,{children:c.teamId??"—"}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(m.Badge,{variant:c.hasPrivateKey?"default":"destructive",children:c.hasPrivateKey?a("available"):a("missing")})}),(0,b.jsx)(v.TableCell,{children:c.expiresAt?new Date(c.expiresAt).toLocaleDateString():"—"}),(0,b.jsx)(v.TableCell,{children:c.installedAgents.map(a=>a.name).join(", ")}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("delete"),cancelLabel:F("cancel"),description:a("deleteIdentityDescription"),onConfirm:()=>ap("mutation DeleteIdentity($sha1: String!, $agents: [ID!]!) { deleteSigningIdentity(sha1: $sha1, agentIds: $agents) { id } }",{sha1:c.sha1,agents:c.privateKeyAgents.map(a=>a.id)}),title:a("deleteIdentity"),trigger:(0,b.jsx)(n.Button,{disabled:ah||!c.hasPrivateKey,size:"icon-sm",variant:"ghost",children:(0,b.jsx)(g.Trash2,{})})})})]},c.id))})]})]})}),(0,b.jsxs)(u.TabsContent,{className:"space-y-4 pb-4",value:"portal",children:[R&&(0,b.jsx)(l.Alert,{className:"px-4 py-3",variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:R})}),P||R?P?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("createPortalProfile")}),(0,b.jsx)(o.CardDescription,{children:a("createPortalProfileDescription")})]}),(0,b.jsxs)(o.CardContent,{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-5",children:[(0,b.jsx)(q.Input,{onChange:a=>Y(a.target.value),placeholder:a("profileName"),value:X}),(0,b.jsxs)(s.Select,{onValueChange:$,value:Z,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{})}),(0,b.jsx)(s.SelectContent,{children:["IOS_APP_DEVELOPMENT","IOS_APP_ADHOC","IOS_APP_STORE","IOS_APP_INHOUSE"].map(a=>(0,b.jsx)(s.SelectItem,{value:a,children:a},a))})]}),(0,b.jsxs)(s.Select,{onValueChange:aa,value:_,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{placeholder:a("selectBundleId")})}),(0,b.jsx)(s.SelectContent,{children:(P?.bundleIds??[]).map(a=>(0,b.jsx)(s.SelectItem,{value:a.id,children:String(a.attributes.identifier??a.id)},a.id))})]}),(0,b.jsxs)(s.Select,{onValueChange:ac,value:ab,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{placeholder:a("selectCertificate")})}),(0,b.jsx)(s.SelectContent,{children:(P?.certificates??[]).map(a=>(0,b.jsx)(s.SelectItem,{value:a.id,children:String(a.attributes.displayName??a.attributes.name??a.id)},a.id))})]}),(0,b.jsx)(n.Button,{disabled:ah||!X||!_||!ab,onClick:()=>{var a;ap("mutation CreatePortal($input: CreateApplePortalProfileInput!) { createApplePortalProfile(input: $input) { id } }",{input:{name:X,profileType:Z,bundleIdId:_,certificateIds:[ab],deviceIds:(a=P?.devices??[],["IOS_APP_DEVELOPMENT","IOS_APP_ADHOC"].includes(Z)?a.filter(a=>"ENABLED"===a.attributes.status&&"IOS"===a.attributes.platform).map(a=>a.id):[])}}).then(async()=>{Y(""),await ao()})},children:a("create")})]})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(E,{resources:P?.profiles??[],title:a("portalProfiles"),onDelete:a=>ap("mutation DeletePortal($id: ID!) { deleteApplePortalProfile(id: $id) }",{id:a}).then(ao)}),(0,b.jsx)(E,{resources:P?.certificates??[],title:a("portalCertificates"),onDelete:a=>ap("mutation RevokePortal($id: ID!) { revokeApplePortalCertificate(id: $id) }",{id:a}).then(ao)})]})]}):null:(0,b.jsxs)("p",{className:"flex items-center gap-2 p-4 text-sm text-muted-foreground",children:[(0,b.jsx)(t.Spinner,{})," ",a("loadingPortal")]})]})]}),N.length>0&&(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.CardHeader,{children:(0,b.jsx)(o.CardTitle,{children:a("operations")})}),(0,b.jsx)(o.CardContent,{className:"space-y-2",children:N.map(a=>(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border p-3",children:[(0,b.jsx)("span",{children:a.kind}),(0,b.jsx)("span",{children:a.items.map(a=>`${a.agent.name}: ${a.status}`).join(" · ")}),(0,b.jsx)(m.Badge,{variant:"FAILED"===a.status?"destructive":"secondary",children:a.status}),a.error&&(0,b.jsx)("p",{className:"w-full text-xs text-destructive",children:a.error})]},a.id))})]})]})}],883537)}];
35
+ }`,{uuid:a.uuid,agentId:b.id});C(c.downloadSigningProfile.contentBase64,c.downloadSigningProfile.filename)}catch(a){am(a instanceof Error?a.message:String(a))}finally{ai(!1)}}};return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:a("title")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a("description")})]}),(0,b.jsxs)(n.Button,{disabled:ah||aj||at,onClick:()=>void as(),variant:"outline",children:[(0,b.jsx)(e.RefreshCw,{className:aj||at?"animate-spin":void 0})," ",a("refresh")]})]}),al&&(0,b.jsx)(l.Alert,{variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:al})}),af.length>0&&(0,b.jsx)(D,{agents:H,jobs:af}),(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("agents")}),(0,b.jsx)(o.CardDescription,{children:a("agentsDescription")})]}),(0,b.jsx)(o.CardContent,{className:"flex flex-wrap gap-2",children:H.map(c=>(0,b.jsxs)("label",{className:"flex items-center gap-2 rounded-lg border px-3 py-2",children:[(0,b.jsx)(p.Checkbox,{checked:T.has(c.id),disabled:!c.supported,onCheckedChange:a=>U(b=>{let d=new Set(b);return a?d.add(c.id):d.delete(c.id),d})}),(0,b.jsx)("span",{children:c.name}),!c.supported&&(0,b.jsx)(m.Badge,{variant:"secondary",children:a("unsupported")})]},c.id))})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("uploadProfile")}),(0,b.jsx)(o.CardDescription,{children:a("uploadProfileDescription")})]}),(0,b.jsx)(o.CardContent,{children:(0,b.jsxs)(r.Label,{className:"flex cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed p-8",children:[(0,b.jsx)(h.Upload,{})," ",a("chooseMobileprovision"),(0,b.jsx)(q.Input,{accept:".mobileprovision,.provisionprofile",className:"sr-only",disabled:ah||!T.size,onChange:a=>void au(a.target.files?.[0]??null),type:"file"})]})})]}),(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("importIdentity")}),(0,b.jsx)(o.CardDescription,{children:a("importIdentityDescription")})]}),(0,b.jsxs)(o.CardContent,{className:"space-y-3",children:[(0,b.jsx)(q.Input,{onChange:a=>W(a.target.value),placeholder:a("passphrase"),type:"password",value:V}),(0,b.jsxs)(r.Label,{className:"flex cursor-pointer items-center justify-center gap-2 rounded-xl border border-dashed p-5",children:[(0,b.jsx)(d.KeyRound,{})," ",a("chooseP12"),(0,b.jsx)(q.Input,{accept:".p12,.pfx",className:"sr-only",disabled:ah||!T.size,onChange:a=>void av(a.target.files?.[0]??null),type:"file"})]})]})]})]}),(0,b.jsxs)(u.Tabs,{onValueChange:ae,value:ad,children:[(0,b.jsxs)(s.Select,{onValueChange:ae,value:ad,children:[(0,b.jsx)(s.SelectTrigger,{className:"w-full sm:hidden",children:(0,b.jsx)(s.SelectValue,{})}),(0,b.jsxs)(s.SelectContent,{children:[(0,b.jsx)(s.SelectItem,{value:"profiles",children:a("localProfiles")}),(0,b.jsx)(s.SelectItem,{value:"certificates",children:a("localCertificates")}),(0,b.jsx)(s.SelectItem,{value:"portal",children:a("applePortal")})]})]}),(0,b.jsxs)(u.TabsList,{className:"hidden sm:inline-flex",children:[(0,b.jsxs)(u.TabsTrigger,{value:"profiles",children:[(0,b.jsx)(f.ShieldCheck,{})," ",a("localProfiles")]}),(0,b.jsxs)(u.TabsTrigger,{value:"certificates",children:[(0,b.jsx)(d.KeyRound,{})," ",a("localCertificates")]}),(0,b.jsx)(u.TabsTrigger,{value:"portal",children:a("applePortal")})]}),(0,b.jsx)(u.TabsContent,{value:"profiles",children:(0,b.jsxs)(o.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(o.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,b.jsx)(o.CardTitle,{children:a("localProfiles")}),(0,b.jsx)(o.CardDescription,{children:a("profilesDescription")}),(0,b.jsx)(o.CardAction,{className:"max-sm:col-start-1 max-sm:row-start-3 max-sm:row-span-1 max-sm:mt-3 max-sm:justify-self-stretch",children:(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("deleteExpired"),cancelLabel:F("cancel"),description:a("deleteExpiredDescription"),onConfirm:()=>ap("mutation { deleteExpiredSigningProfiles { id } }"),title:a("deleteExpired"),trigger:(0,b.jsxs)(n.Button,{disabled:ah,size:"sm",variant:"outline",children:[(0,b.jsx)(g.Trash2,{})," ",a("deleteExpired")]})})})]}),0===J.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:a("noLocalProfiles")}):(0,b.jsxs)(v.Table,{children:[(0,b.jsx)(v.TableHeader,{children:(0,b.jsxs)(v.TableRow,{children:[(0,b.jsx)(v.TableHead,{children:a("name")}),(0,b.jsx)(v.TableHead,{children:a("bundleId")}),(0,b.jsx)(v.TableHead,{children:a("type")}),(0,b.jsx)(v.TableHead,{children:a("team")}),(0,b.jsx)(v.TableHead,{children:a("devices")}),(0,b.jsx)(v.TableHead,{children:a("expires")}),(0,b.jsx)(v.TableHead,{children:a("installedAgents")}),(0,b.jsx)(v.TableHead,{})]})}),(0,b.jsx)(v.TableBody,{children:J.map(d=>{let e=new Set(d.installedAgents.map(a=>a.id)),f=H.filter(a=>a.supported&&!e.has(a.id)),h=`/provisioning-profiles/${encodeURIComponent(d.id)}`;return(0,b.jsxs)(v.TableRow,{"aria-label":a("viewProfile",{name:d.name}),className:"cursor-pointer focus-visible:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>G.push(h),onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),G.push(h))},role:"link",tabIndex:0,children:[(0,b.jsxs)(v.TableCell,{children:[(0,b.jsx)(w.Link,{className:"font-medium hover:underline",href:h,onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:d.name}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:d.uuid}),d.xcodeManaged&&(0,b.jsx)(m.Badge,{variant:"secondary",children:"Xcode"})]}),(0,b.jsx)(v.TableCell,{className:"font-mono text-xs",children:d.bundleId}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(m.Badge,{variant:"outline",children:d.profileType})}),(0,b.jsx)(v.TableCell,{children:d.teamName??d.teamId??"—"}),(0,b.jsx)(v.TableCell,{children:d.deviceCount}),(0,b.jsxs)(v.TableCell,{children:[d.expiresAt?new Date(d.expiresAt).toLocaleDateString():"—",d.expired&&(0,b.jsx)(m.Badge,{className:"ml-2",variant:"destructive",children:a("expired")})]}),(0,b.jsx)(v.TableCell,{children:d.installedAgents.map(a=>a.name).join(", ")}),(0,b.jsxs)(v.TableCell,{className:"space-x-1 text-right",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:[f.length>0&&d.installedAgents[0]&&(0,b.jsx)(n.Button,{disabled:ah,onClick:()=>void ap("mutation Sync($uuid: String!, $source: ID!, $targets: [ID!]!) { syncSigningProfile(uuid: $uuid, sourceAgentId: $source, targetAgentIds: $targets) { id } }",{uuid:d.uuid,source:d.installedAgents[0].id,targets:f.map(a=>a.id)}),size:"sm",variant:"outline",children:a("syncMissing")}),(0,b.jsx)(n.Button,{"aria-label":a("download"),disabled:ah||!d.installedAgents.length,onClick:()=>void aw(d),size:"icon-sm",variant:"ghost",children:(0,b.jsx)(c.Download,{})}),(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("delete"),cancelLabel:F("cancel"),description:a("deleteProfileDescription"),onConfirm:()=>ap("mutation Delete($uuid: String!, $agents: [ID!]!) { deleteSigningProfile(uuid: $uuid, agentIds: $agents) { id } }",{uuid:d.uuid,agents:d.installedAgents.map(a=>a.id)}),title:a("deleteProfile"),trigger:(0,b.jsx)(n.Button,{disabled:ah,size:"icon-sm",variant:"ghost",children:(0,b.jsx)(g.Trash2,{})})})]})]},d.id)})})]})]})}),(0,b.jsx)(u.TabsContent,{value:"certificates",children:(0,b.jsxs)(o.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("localCertificates")}),(0,b.jsx)(o.CardDescription,{children:a("certificatesDescription")})]}),0===L.length?(0,b.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:a("noLocalCertificates")}):(0,b.jsxs)(v.Table,{children:[(0,b.jsx)(v.TableHeader,{children:(0,b.jsxs)(v.TableRow,{children:[(0,b.jsx)(v.TableHead,{children:a("name")}),(0,b.jsx)(v.TableHead,{children:a("fingerprints")}),(0,b.jsx)(v.TableHead,{children:a("team")}),(0,b.jsx)(v.TableHead,{children:a("privateKey")}),(0,b.jsx)(v.TableHead,{children:a("expires")}),(0,b.jsx)(v.TableHead,{children:a("installedAgents")}),(0,b.jsx)(v.TableHead,{})]})}),(0,b.jsx)(v.TableBody,{children:L.map(c=>(0,b.jsxs)(v.TableRow,{children:[(0,b.jsxs)(v.TableCell,{children:[(0,b.jsx)("p",{className:"font-medium",children:c.name}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:c.certificateType})]}),(0,b.jsxs)(v.TableCell,{className:"font-mono text-xs",children:[(0,b.jsxs)("p",{children:["SHA-1 ",B(c.sha1)]}),(0,b.jsxs)("p",{children:["SHA-256 ",B(c.sha256)]})]}),(0,b.jsx)(v.TableCell,{children:c.teamId??"—"}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(m.Badge,{variant:c.hasPrivateKey?"default":"destructive",children:c.hasPrivateKey?a("available"):a("missing")})}),(0,b.jsx)(v.TableCell,{children:c.expiresAt?new Date(c.expiresAt).toLocaleDateString():"—"}),(0,b.jsx)(v.TableCell,{children:c.installedAgents.map(a=>a.name).join(", ")}),(0,b.jsx)(v.TableCell,{children:(0,b.jsx)(k.ConfirmationDialog,{actionLabel:a("delete"),cancelLabel:F("cancel"),description:a("deleteIdentityDescription"),onConfirm:()=>ap("mutation DeleteIdentity($sha1: String!, $agents: [ID!]!) { deleteSigningIdentity(sha1: $sha1, agentIds: $agents) { id } }",{sha1:c.sha1,agents:c.privateKeyAgents.map(a=>a.id)}),title:a("deleteIdentity"),trigger:(0,b.jsx)(n.Button,{disabled:ah||!c.hasPrivateKey,size:"icon-sm",variant:"ghost",children:(0,b.jsx)(g.Trash2,{})})})})]},c.id))})]})]})}),(0,b.jsxs)(u.TabsContent,{className:"space-y-4 pb-4",value:"portal",children:[R&&(0,b.jsx)(l.Alert,{className:"px-4 py-3",variant:"destructive",children:(0,b.jsx)(l.AlertDescription,{children:R})}),P||R?P?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.CardHeader,{children:[(0,b.jsx)(o.CardTitle,{children:a("createPortalProfile")}),(0,b.jsx)(o.CardDescription,{children:a("createPortalProfileDescription")})]}),(0,b.jsxs)(o.CardContent,{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-5",children:[(0,b.jsx)(q.Input,{onChange:a=>Y(a.target.value),placeholder:a("profileName"),value:X}),(0,b.jsxs)(s.Select,{onValueChange:$,value:Z,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{})}),(0,b.jsx)(s.SelectContent,{children:["IOS_APP_DEVELOPMENT","IOS_APP_ADHOC","IOS_APP_STORE","IOS_APP_INHOUSE"].map(a=>(0,b.jsx)(s.SelectItem,{value:a,children:a},a))})]}),(0,b.jsxs)(s.Select,{onValueChange:aa,value:_,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{placeholder:a("selectBundleId")})}),(0,b.jsx)(s.SelectContent,{children:(P?.bundleIds??[]).map(a=>(0,b.jsx)(s.SelectItem,{value:a.id,children:String(a.attributes.identifier??a.id)},a.id))})]}),(0,b.jsxs)(s.Select,{onValueChange:ac,value:ab,children:[(0,b.jsx)(s.SelectTrigger,{children:(0,b.jsx)(s.SelectValue,{placeholder:a("selectCertificate")})}),(0,b.jsx)(s.SelectContent,{children:(P?.certificates??[]).map(a=>(0,b.jsx)(s.SelectItem,{value:a.id,children:String(a.attributes.displayName??a.attributes.name??a.id)},a.id))})]}),(0,b.jsx)(n.Button,{disabled:ah||!X||!_||!ab,onClick:()=>{var a;ap("mutation CreatePortal($input: CreateApplePortalProfileInput!) { createApplePortalProfile(input: $input) { id } }",{input:{name:X,profileType:Z,bundleIdId:_,certificateIds:[ab],deviceIds:(a=P?.devices??[],["IOS_APP_DEVELOPMENT","IOS_APP_ADHOC"].includes(Z)?a.filter(a=>"ENABLED"===a.attributes.status&&"IOS"===a.attributes.platform).map(a=>a.id):[])}}).then(async()=>{Y(""),await ao()})},children:a("create")})]})]}),(0,b.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,b.jsx)(E,{resources:P?.profiles??[],title:a("portalProfiles"),onDelete:a=>ap("mutation DeletePortal($id: ID!) { deleteApplePortalProfile(id: $id) }",{id:a}).then(ao)}),(0,b.jsx)(E,{resources:P?.certificates??[],title:a("portalCertificates"),onDelete:a=>ap("mutation RevokePortal($id: ID!) { revokeApplePortalCertificate(id: $id) }",{id:a}).then(ao)})]})]}):null:(0,b.jsxs)("p",{className:"flex items-center gap-2 p-4 text-sm text-muted-foreground",children:[(0,b.jsx)(t.Spinner,{})," ",a("loadingPortal")]})]})]}),N.length>0&&(0,b.jsxs)(o.Card,{children:[(0,b.jsx)(o.CardHeader,{children:(0,b.jsx)(o.CardTitle,{children:a("operations")})}),(0,b.jsx)(o.CardContent,{className:"space-y-2",children:N.map(a=>(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border p-3",children:[(0,b.jsx)("span",{children:a.kind}),(0,b.jsx)("span",{children:a.items.map(a=>`${a.agent.name}: ${a.status}`).join(" · ")}),(0,b.jsx)(m.Badge,{variant:"FAILED"===a.status?"destructive":"secondary",children:a.status}),a.error&&(0,b.jsx)("p",{className:"w-full text-xs text-destructive",children:a.error})]},a.id))})]})]})}],883537)}];
36
36
 
37
37
  //# sourceMappingURL=src_components_signing-assets_provisioning-profiles-page_tsx_1zr20o7._.js.map
@@ -11,6 +11,6 @@ module.exports=[961514,a=>{"use strict";var b=a.i(187924),c=a.i(787037),d=a.i(21
11
11
  skipPendingSkillSync(runId: $runId) { ${B.SKILL_SYNC_RUN_FIELDS} }
12
12
  }`,{runId:a});K(b.skipPendingSkillSync),S(null)}catch(a){S(a instanceof Error?a.message:String(a))}finally{Q(!1)}},ar=async a=>{let b=a.candidatePackage?.package;if(b&&(U(a),Y(b.files.map(a=>({...a}))),$("SKILL.md"),aa("SKILL.md"),W([]),a.skill)){ac(!0);try{let b=await (0,A.controlPlaneRequest)(`query ConflictDatabasePackage($id: ID!) {
13
13
  skill(id: $id) { files { path contentsBase64 executable } }
14
- }`,{id:a.skill.id});W(b.skill?.files??[])}catch(a){S(a instanceof Error?a.message:String(a))}finally{ac(!1)}}},as=async()=>{if(!T?.candidatePackage?.package)return;let a=T.candidatePackage.package;await ao(T,"MANUAL",{...T.candidatePackage,package:{...a,files:X}})},at=async a=>{if(!a)return;let b=await Promise.all([...a].map(async a=>({path:a.name,contentsBase64:function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return window.btoa(b)}(new Uint8Array(await a.arrayBuffer())),executable:!1})));Y(a=>[...a.filter(a=>!b.some(b=>b.path===a.path)),...b]),b[0]&&($(b[0].path),aa(b[0].path))};return N||!J?(0,b.jsxs)("div",{className:"flex gap-2 p-6 text-sm text-muted-foreground",children:[(0,b.jsx)(w.Spinner,{})," ",e("loadingSync")]}):(0,b.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-4 overflow-auto p-4 sm:p-6",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(p.Button,{asChild:!0,size:"icon",variant:"ghost",children:(0,b.jsx)(z.Link,{"aria-label":e("backToSkills"),href:"/skills",children:(0,b.jsx)(d.ArrowLeft,{})})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:e("syncTitle")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:J.group?e("syncGroupName",{name:J.group.name}):e("syncAllDescription")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(o.Badge,{variant:"SUCCEEDED"===J.status?"secondary":"outline",children:G(J.status)}),ai.length>0&&(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void aq(),variant:"outline",children:[P?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(j,{})," ",e("skipPendingClients")]}),(0,b.jsxs)(p.Button,{disabled:P||!["READY","PARTIAL"].includes(J.status),onClick:()=>void ap(),children:[P?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(i.Play,{})," ",e("applySync")]})]})]}),R&&(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:R})}),ah.length>0&&(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{className:"border-b py-4",children:[(0,b.jsx)(q.CardTitle,{children:e("syncAgents")}),(0,b.jsx)(q.CardDescription,{children:e("syncAgentsDescription")})]}),(0,b.jsx)(q.CardContent,{className:"px-0",children:(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:e("agent")}),(0,b.jsx)(x.TableHead,{children:e("connection")}),(0,b.jsx)(x.TableHead,{children:e("operation")}),(0,b.jsx)(x.TableHead,{children:e("syncStatus")})]})}),(0,b.jsx)(x.TableBody,{children:ah.map(a=>{let c=a.agent?.connectionStatus==="ONLINE";return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableCell,{className:"font-medium",children:a.agent?.name??e("unknownAgent")}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{className:c?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":void 0,variant:c?"outline":"secondary",children:I(c?"online":"offline")})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"outline",children:G(a.direction)})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"FAILED"===a.status?"destructive":"COMPLETE"===a.status||"SUCCEEDED"===a.status?"secondary":"outline",children:G(a.status)})})]},a.id)})})]})})]}),(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{className:"border-b py-4",children:[(0,b.jsx)(q.CardTitle,{children:e("syncChanges")}),(0,b.jsx)(q.CardDescription,{children:e("syncChangesDescription")})]}),(0,b.jsx)(q.CardContent,{className:"px-0",children:(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:e("change")}),(0,b.jsx)(x.TableHead,{children:e("name")}),(0,b.jsx)(x.TableHead,{children:e("agent")}),(0,b.jsx)(x.TableHead,{children:e("location")}),(0,b.jsx)(x.TableHead,{children:e("status")}),(0,b.jsx)(x.TableHead,{children:e("resolution")})]})}),(0,b.jsxs)(x.TableBody,{children:[ag.map(a=>{var d;let i=a.candidatePackage?.projectGroupRequired,j="IMPORT"===a.direction&&a.installation&&!a.installation.tracked;return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableCell,{children:(0,b.jsxs)(o.Badge,{className:"gap-1",variant:"CONFLICT"===a.direction?"destructive":"outline",children:["IMPORT"===(d=a.direction)?(0,b.jsx)(c.ArrowDownToLine,{}):"EXPORT"===d?(0,b.jsx)(f,{}):"DELETE_REDUNDANT"===d?(0,b.jsx)(k.Trash2,{}):"CONFLICT"===d?(0,b.jsx)(h.GitCompareArrows,{}):(0,b.jsx)(g.Check,{})," ",G(a.direction)]})}),(0,b.jsx)(x.TableCell,{className:"font-medium",children:a.skill?.name??a.installation?.skillName??"—"}),(0,b.jsx)(x.TableCell,{children:a.agent?.name??a.installation?.agent.name??"—"}),(0,b.jsx)(x.TableCell,{className:"max-w-md whitespace-normal font-mono text-xs",children:a.installation?.rootPath??e("newSharedLocation")}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"BLOCKED"===a.status?"destructive":"READY"===a.status||"COMPLETE"===a.status?"secondary":"outline",children:G(a.status)})}),(0,b.jsxs)(x.TableCell,{children:[i&&"BLOCKED"===a.status&&(0,b.jsxs)(v.Select,{onValueChange:b=>ae(c=>({...c,[a.id]:b===C?"":b})),value:ad[a.id]||C,children:[(0,b.jsx)(v.SelectTrigger,{className:"mb-1 w-full min-w-48",size:"sm",children:(0,b.jsx)(v.SelectValue,{placeholder:e("chooseGroup")})}),(0,b.jsxs)(v.SelectContent,{align:"start",children:[(0,b.jsx)(v.SelectItem,{value:C,children:e("chooseGroup")}),L.map(a=>(0,b.jsx)(v.SelectItem,{value:a.id,children:a.name},a.id))]})]}),"BLOCKED"===a.status?(0,b.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.skill&&(0,b.jsx)(p.Button,{disabled:P,onClick:()=>void ao(a,"DATABASE"),size:"sm",variant:"outline",children:e("useDatabase")}),a.candidatePackage?.package&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Button,{disabled:P||i&&!ad[a.id],onClick:()=>void ao(a,"TARGET"),size:"sm",variant:"outline",children:e("useTarget")}),(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ar(a),size:"sm",variant:"outline",children:[(0,b.jsx)(h.GitCompareArrows,{})," ",e("compareAndResolve")]})]}),j&&(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ao(a,"DELETE"),size:"sm",variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("deleteClientCopy")]}),(0,b.jsx)(p.Button,{disabled:P,onClick:()=>void ao(a,"SKIP"),size:"sm",variant:"outline",children:e("skip")})]}):j&&"READY"===a.status?(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ao(a,"DELETE"),size:"sm",variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("deleteClientCopy")]}):a.resolution?G(a.resolution):"—"]})]},a.id)}),!ag.length&&(0,b.jsx)(x.TableRow,{children:(0,b.jsx)(x.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:6,children:"PREPARING"===J.status?e("scanningAgents"):e("noSyncChanges")})})]})]})})]}),(0,b.jsx)(s.Dialog,{onOpenChange:a=>{a||(U(null),W([]),Y([]))},open:!!T,children:(0,b.jsxs)(s.DialogContent,{className:"flex max-h-[92vh] flex-col overflow-hidden sm:max-w-6xl",children:[(0,b.jsxs)(s.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(s.DialogTitle,{children:e("manualResolution")}),(0,b.jsx)(s.DialogDescription,{children:e("manualResolutionDescription")})]}),(0,b.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,b.jsxs)(p.Button,{disabled:!V.length||ab,onClick:()=>Y(V.map(a=>({...a}))),size:"sm",variant:"outline",children:[ab?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(c.ArrowDownToLine,{})," ",e("startFromDatabase")]}),(0,b.jsxs)(p.Button,{disabled:!aj.length,onClick:()=>Y(aj.map(a=>({...a}))),size:"sm",variant:"outline",children:[(0,b.jsx)(c.ArrowDownToLine,{})," ",e("startFromTarget")]}),(0,b.jsx)(p.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,b.jsx)(u.Label,{className:"cursor-pointer",htmlFor:"manual-package-upload",children:e("addFiles")})}),(0,b.jsx)(t.Input,{className:"sr-only",id:"manual-package-upload",multiple:!0,onChange:a=>void at(a.currentTarget.files),type:"file"})]}),(0,b.jsxs)("div",{className:"grid min-h-0 flex-1 gap-4 overflow-y-auto lg:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,b.jsxs)("div",{className:"space-y-1 rounded-md border p-2",children:[(0,b.jsx)("p",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:e("packageFiles")}),ak.map(a=>(0,b.jsx)("button",{className:`block w-full truncate rounded px-2 py-1.5 text-left font-mono text-xs ${a===Z?"bg-accent text-accent-foreground":"hover:bg-muted"}`,onClick:()=>{$(a),aa(a)},type:"button",children:a},a))]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-4",children:[(0,b.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,b.jsx)(u.Label,{children:e("databaseVersion")}),ab?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(H,{binaryLabel:e("binaryPreview"),executableLabel:e("executable"),file:al,missingLabel:e("missingFile")})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,b.jsx)(u.Label,{children:e("targetVersion")}),(0,b.jsx)(H,{binaryLabel:e("binaryPreview"),executableLabel:e("executable"),file:am,missingLabel:e("missingFile")})]})]}),(0,b.jsxs)("div",{className:"space-y-3 rounded-md border p-3",children:[(0,b.jsx)(u.Label,{children:e("resultVersion")}),an?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,b.jsxs)("div",{className:"min-w-64 flex-1 space-y-1",children:[(0,b.jsx)(u.Label,{htmlFor:"manual-file-path",children:e("filePath")}),(0,b.jsx)(t.Input,{id:"manual-file-path",onChange:a=>aa(a.target.value),value:_})]}),(0,b.jsx)(p.Button,{disabled:!_.trim()||_.trim()!==an.path&&X.some(a=>a.path===_.trim()),onClick:()=>{let a=_.trim().replaceAll("\\","/");!an||!a||a!==an.path&&X.some(b=>b.path===a)||(Y(b=>b.map(b=>b.path===an.path?{...b,path:a}:b)),$(a),aa(a))},variant:"outline",children:e("rename")}),(0,b.jsxs)(u.Label,{className:"flex h-8 items-center gap-2 rounded-lg border px-3",children:[(0,b.jsx)(r.Checkbox,{checked:an.executable,onCheckedChange:a=>Y(b=>b.map(b=>b.path===an.path?{...b,executable:!0===a}:b))}),e("executable")]}),(0,b.jsxs)(p.Button,{disabled:"SKILL.md"===an.path,onClick:()=>{Y(a=>a.filter(a=>a.path!==an.path));let a=ak.find(a=>a!==an.path);$(a??"SKILL.md"),aa(a??"SKILL.md")},variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("removeFile")]})]}),null===F(an)?(0,b.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/30 p-3 text-sm text-muted-foreground",children:[(0,b.jsx)("p",{children:e("binaryFile")}),(0,b.jsxs)("p",{children:[E(an.contentsBase64).byteLength.toLocaleString()," ","B"]})]}):(0,b.jsx)(y.Textarea,{className:"min-h-48 font-mono text-xs",onChange:a=>Y(b=>b.map(b=>b.path===an.path?{...b,contentsBase64:function(a){let b=new TextEncoder().encode(a),c="";for(let a of b)c+=String.fromCharCode(a);return window.btoa(c)}(a.target.value)}:b)),value:F(an)??""})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e("missingResultFile")})]})]})]}),(0,b.jsx)(s.DialogFooter,{className:"shrink-0",children:(0,b.jsxs)(p.Button,{disabled:P||!X.some(a=>"SKILL.md"===a.path)||T?.candidatePackage?.projectGroupRequired===!0&&!ad[T.id],onClick:()=>void as(),children:[P&&(0,b.jsx)(w.Spinner,{})," ",e("useManualVersion")]})})]})})]})}],961514)}];
14
+ }`,{id:a.skill.id});W(b.skill?.files??[])}catch(a){S(a instanceof Error?a.message:String(a))}finally{ac(!1)}}},as=async()=>{if(!T?.candidatePackage?.package)return;let a=T.candidatePackage.package;await ao(T,"MANUAL",{...T.candidatePackage,package:{...a,files:X}})},at=async a=>{if(!a)return;let b=await Promise.all([...a].map(async a=>({path:a.name,contentsBase64:function(a){let b="";for(let c=0;c<a.length;c+=32768)b+=String.fromCharCode(...a.subarray(c,c+32768));return window.btoa(b)}(new Uint8Array(await a.arrayBuffer())),executable:!1})));Y(a=>[...a.filter(a=>!b.some(b=>b.path===a.path)),...b]),b[0]&&($(b[0].path),aa(b[0].path))};return N||!J?(0,b.jsxs)("div",{className:"flex gap-2 p-6 text-sm text-muted-foreground",children:[(0,b.jsx)(w.Spinner,{})," ",e("loadingSync")]}):(0,b.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-4 overflow-auto p-4 sm:p-6",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(p.Button,{asChild:!0,size:"icon",variant:"ghost",children:(0,b.jsx)(z.Link,{"aria-label":e("backToSkills"),href:"/skills",children:(0,b.jsx)(d.ArrowLeft,{})})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold",children:e("syncTitle")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:J.group?e("syncGroupName",{name:J.group.name}):e("syncAllDescription")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(o.Badge,{variant:"SUCCEEDED"===J.status?"secondary":"outline",children:G(J.status)}),ai.length>0&&(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void aq(),variant:"outline",children:[P?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(j,{})," ",e("skipPendingClients")]}),(0,b.jsxs)(p.Button,{disabled:P||!["READY","PARTIAL"].includes(J.status),onClick:()=>void ap(),children:[P?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(i.Play,{})," ",e("applySync")]})]})]}),R&&(0,b.jsx)(n.Alert,{variant:"destructive",children:(0,b.jsx)(n.AlertDescription,{children:R})}),ah.length>0&&(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{children:[(0,b.jsx)(q.CardTitle,{children:e("syncAgents")}),(0,b.jsx)(q.CardDescription,{children:e("syncAgentsDescription")})]}),(0,b.jsx)(q.CardContent,{className:"px-0",children:(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:e("agent")}),(0,b.jsx)(x.TableHead,{children:e("connection")}),(0,b.jsx)(x.TableHead,{children:e("operation")}),(0,b.jsx)(x.TableHead,{children:e("syncStatus")})]})}),(0,b.jsx)(x.TableBody,{children:ah.map(a=>{let c=a.agent?.connectionStatus==="ONLINE";return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableCell,{className:"font-medium",children:a.agent?.name??e("unknownAgent")}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{className:c?"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":void 0,variant:c?"outline":"secondary",children:I(c?"online":"offline")})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"outline",children:G(a.direction)})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"FAILED"===a.status?"destructive":"COMPLETE"===a.status||"SUCCEEDED"===a.status?"secondary":"outline",children:G(a.status)})})]},a.id)})})]})})]}),(0,b.jsxs)(q.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(q.CardHeader,{children:[(0,b.jsx)(q.CardTitle,{children:e("syncChanges")}),(0,b.jsx)(q.CardDescription,{children:e("syncChangesDescription")})]}),(0,b.jsx)(q.CardContent,{className:"px-0",children:(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:e("change")}),(0,b.jsx)(x.TableHead,{children:e("name")}),(0,b.jsx)(x.TableHead,{children:e("agent")}),(0,b.jsx)(x.TableHead,{children:e("location")}),(0,b.jsx)(x.TableHead,{children:e("status")}),(0,b.jsx)(x.TableHead,{children:e("resolution")})]})}),(0,b.jsxs)(x.TableBody,{children:[ag.map(a=>{var d;let i=a.candidatePackage?.projectGroupRequired,j="IMPORT"===a.direction&&a.installation&&!a.installation.tracked;return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableCell,{children:(0,b.jsxs)(o.Badge,{className:"gap-1",variant:"CONFLICT"===a.direction?"destructive":"outline",children:["IMPORT"===(d=a.direction)?(0,b.jsx)(c.ArrowDownToLine,{}):"EXPORT"===d?(0,b.jsx)(f,{}):"DELETE_REDUNDANT"===d?(0,b.jsx)(k.Trash2,{}):"CONFLICT"===d?(0,b.jsx)(h.GitCompareArrows,{}):(0,b.jsx)(g.Check,{})," ",G(a.direction)]})}),(0,b.jsx)(x.TableCell,{className:"font-medium",children:a.skill?.name??a.installation?.skillName??"—"}),(0,b.jsx)(x.TableCell,{children:a.agent?.name??a.installation?.agent.name??"—"}),(0,b.jsx)(x.TableCell,{className:"max-w-md whitespace-normal font-mono text-xs",children:a.installation?.rootPath??e("newSharedLocation")}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(o.Badge,{variant:"BLOCKED"===a.status?"destructive":"READY"===a.status||"COMPLETE"===a.status?"secondary":"outline",children:G(a.status)})}),(0,b.jsxs)(x.TableCell,{children:[i&&"BLOCKED"===a.status&&(0,b.jsxs)(v.Select,{onValueChange:b=>ae(c=>({...c,[a.id]:b===C?"":b})),value:ad[a.id]||C,children:[(0,b.jsx)(v.SelectTrigger,{className:"mb-1 w-full min-w-48",size:"sm",children:(0,b.jsx)(v.SelectValue,{placeholder:e("chooseGroup")})}),(0,b.jsxs)(v.SelectContent,{align:"start",children:[(0,b.jsx)(v.SelectItem,{value:C,children:e("chooseGroup")}),L.map(a=>(0,b.jsx)(v.SelectItem,{value:a.id,children:a.name},a.id))]})]}),"BLOCKED"===a.status?(0,b.jsxs)("div",{className:"flex flex-wrap gap-1",children:[a.skill&&(0,b.jsx)(p.Button,{disabled:P,onClick:()=>void ao(a,"DATABASE"),size:"sm",variant:"outline",children:e("useDatabase")}),a.candidatePackage?.package&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p.Button,{disabled:P||i&&!ad[a.id],onClick:()=>void ao(a,"TARGET"),size:"sm",variant:"outline",children:e("useTarget")}),(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ar(a),size:"sm",variant:"outline",children:[(0,b.jsx)(h.GitCompareArrows,{})," ",e("compareAndResolve")]})]}),j&&(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ao(a,"DELETE"),size:"sm",variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("deleteClientCopy")]}),(0,b.jsx)(p.Button,{disabled:P,onClick:()=>void ao(a,"SKIP"),size:"sm",variant:"outline",children:e("skip")})]}):j&&"READY"===a.status?(0,b.jsxs)(p.Button,{disabled:P,onClick:()=>void ao(a,"DELETE"),size:"sm",variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("deleteClientCopy")]}):a.resolution?G(a.resolution):"—"]})]},a.id)}),!ag.length&&(0,b.jsx)(x.TableRow,{children:(0,b.jsx)(x.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:6,children:"PREPARING"===J.status?e("scanningAgents"):e("noSyncChanges")})})]})]})})]}),(0,b.jsx)(s.Dialog,{onOpenChange:a=>{a||(U(null),W([]),Y([]))},open:!!T,children:(0,b.jsxs)(s.DialogContent,{className:"flex max-h-[92vh] flex-col overflow-hidden sm:max-w-6xl",children:[(0,b.jsxs)(s.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(s.DialogTitle,{children:e("manualResolution")}),(0,b.jsx)(s.DialogDescription,{children:e("manualResolutionDescription")})]}),(0,b.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,b.jsxs)(p.Button,{disabled:!V.length||ab,onClick:()=>Y(V.map(a=>({...a}))),size:"sm",variant:"outline",children:[ab?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(c.ArrowDownToLine,{})," ",e("startFromDatabase")]}),(0,b.jsxs)(p.Button,{disabled:!aj.length,onClick:()=>Y(aj.map(a=>({...a}))),size:"sm",variant:"outline",children:[(0,b.jsx)(c.ArrowDownToLine,{})," ",e("startFromTarget")]}),(0,b.jsx)(p.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,b.jsx)(u.Label,{className:"cursor-pointer",htmlFor:"manual-package-upload",children:e("addFiles")})}),(0,b.jsx)(t.Input,{className:"sr-only",id:"manual-package-upload",multiple:!0,onChange:a=>void at(a.currentTarget.files),type:"file"})]}),(0,b.jsxs)("div",{className:"grid min-h-0 flex-1 gap-4 overflow-y-auto lg:grid-cols-[14rem_minmax(0,1fr)]",children:[(0,b.jsxs)("div",{className:"space-y-1 rounded-md border p-2",children:[(0,b.jsx)("p",{className:"px-2 py-1 text-xs font-medium text-muted-foreground",children:e("packageFiles")}),ak.map(a=>(0,b.jsx)("button",{className:`block w-full truncate rounded px-2 py-1.5 text-left font-mono text-xs ${a===Z?"bg-accent text-accent-foreground":"hover:bg-muted"}`,onClick:()=>{$(a),aa(a)},type:"button",children:a},a))]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-4",children:[(0,b.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,b.jsx)(u.Label,{children:e("databaseVersion")}),ab?(0,b.jsx)(w.Spinner,{}):(0,b.jsx)(H,{binaryLabel:e("binaryPreview"),executableLabel:e("executable"),file:al,missingLabel:e("missingFile")})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,b.jsx)(u.Label,{children:e("targetVersion")}),(0,b.jsx)(H,{binaryLabel:e("binaryPreview"),executableLabel:e("executable"),file:am,missingLabel:e("missingFile")})]})]}),(0,b.jsxs)("div",{className:"space-y-3 rounded-md border p-3",children:[(0,b.jsx)(u.Label,{children:e("resultVersion")}),an?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-end gap-2",children:[(0,b.jsxs)("div",{className:"min-w-64 flex-1 space-y-1",children:[(0,b.jsx)(u.Label,{htmlFor:"manual-file-path",children:e("filePath")}),(0,b.jsx)(t.Input,{id:"manual-file-path",onChange:a=>aa(a.target.value),value:_})]}),(0,b.jsx)(p.Button,{disabled:!_.trim()||_.trim()!==an.path&&X.some(a=>a.path===_.trim()),onClick:()=>{let a=_.trim().replaceAll("\\","/");!an||!a||a!==an.path&&X.some(b=>b.path===a)||(Y(b=>b.map(b=>b.path===an.path?{...b,path:a}:b)),$(a),aa(a))},variant:"outline",children:e("rename")}),(0,b.jsxs)(u.Label,{className:"flex h-8 items-center gap-2 rounded-lg border px-3",children:[(0,b.jsx)(r.Checkbox,{checked:an.executable,onCheckedChange:a=>Y(b=>b.map(b=>b.path===an.path?{...b,executable:!0===a}:b))}),e("executable")]}),(0,b.jsxs)(p.Button,{disabled:"SKILL.md"===an.path,onClick:()=>{Y(a=>a.filter(a=>a.path!==an.path));let a=ak.find(a=>a!==an.path);$(a??"SKILL.md"),aa(a??"SKILL.md")},variant:"destructive",children:[(0,b.jsx)(k.Trash2,{})," ",e("removeFile")]})]}),null===F(an)?(0,b.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/30 p-3 text-sm text-muted-foreground",children:[(0,b.jsx)("p",{children:e("binaryFile")}),(0,b.jsxs)("p",{children:[E(an.contentsBase64).byteLength.toLocaleString()," ","B"]})]}):(0,b.jsx)(y.Textarea,{className:"min-h-48 font-mono text-xs",onChange:a=>Y(b=>b.map(b=>b.path===an.path?{...b,contentsBase64:function(a){let b=new TextEncoder().encode(a),c="";for(let a of b)c+=String.fromCharCode(a);return window.btoa(c)}(a.target.value)}:b)),value:F(an)??""})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e("missingResultFile")})]})]})]}),(0,b.jsx)(s.DialogFooter,{className:"shrink-0",children:(0,b.jsxs)(p.Button,{disabled:P||!X.some(a=>"SKILL.md"===a.path)||T?.candidatePackage?.projectGroupRequired===!0&&!ad[T.id],onClick:()=>void as(),children:[P&&(0,b.jsx)(w.Spinner,{})," ",e("useManualVersion")]})})]})})]})}],961514)}];
15
15
 
16
16
  //# sourceMappingURL=src_components_skills_skill-sync-page_tsx_15sidhb._.js.map
@@ -24,7 +24,7 @@ module.exports=[696334,a=>{"use strict";var b=a.i(187924),c=a.i(787037),d=a.i(16
24
24
  repositories { id name displayOrigin }
25
25
  }
26
26
  }
27
- `;function K(a,b){return"CURSOR"===b?a.cursorEnabled:"GITHUB_COPILOT"===b?a.githubCopilotEnabled:"CODEX"===b?a.codexEnabled:"CLAUDE"===b?a.claudeEnabled:a.openCodeEnabled}function L({overview:a}){let c=(0,r.useTranslations)("skills");return(0,b.jsxs)(w.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(w.CardHeader,{className:"border-b py-4",children:[(0,b.jsx)(w.CardTitle,{children:c("databaseSkills")}),(0,b.jsx)(w.CardDescription,{children:c("databaseSkillsDescription")})]}),(0,b.jsx)(w.CardContent,{className:"px-0",children:(0,b.jsxs)(D.Table,{children:[(0,b.jsx)(D.TableHeader,{children:(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableHead,{children:c("name")}),(0,b.jsx)(D.TableHead,{children:c("skillDescription")}),(0,b.jsx)(D.TableHead,{children:c("scope")}),(0,b.jsx)(D.TableHead,{children:c("groups")}),(0,b.jsx)(D.TableHead,{children:c("files")}),(0,b.jsx)(D.TableHead,{children:c("updated")})]})}),(0,b.jsxs)(D.TableBody,{children:[a.skills.map(a=>(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableCell,{children:(0,b.jsx)(F.Link,{className:"font-medium text-primary hover:underline",href:`/skills/${a.id}`,children:a.name})}),(0,b.jsx)(D.TableCell,{className:"max-w-lg whitespace-normal text-muted-foreground",children:a.description}),(0,b.jsx)(D.TableCell,{children:(0,b.jsx)(u.Badge,{variant:a.syncGlobally?"default":"secondary",children:a.syncGlobally?c("global"):c("groupOnly")})}),(0,b.jsx)(D.TableCell,{children:(0,b.jsx)("div",{className:"flex flex-wrap gap-1",children:a.groups.length?a.groups.map(a=>(0,b.jsx)(u.Badge,{variant:"outline",children:a.name},a.id)):"—"})}),(0,b.jsx)(D.TableCell,{children:a.files.length}),(0,b.jsx)(D.TableCell,{children:new Date(a.updatedAt).toLocaleString()})]},a.id)),!a.skills.length&&(0,b.jsx)(D.TableRow,{children:(0,b.jsx)(D.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:6,children:c("noSkills")})})]})]})})]})}function M({installations:a}){let d=(0,r.useTranslations)("skills");return(0,b.jsxs)(w.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(w.CardHeader,{className:"border-b py-4",children:[(0,b.jsx)(w.CardTitle,{children:d("clientSkills")}),(0,b.jsx)(w.CardDescription,{children:d("clientSkillsDescription")})]}),(0,b.jsx)(w.CardContent,{className:"px-0",children:(0,b.jsxs)(D.Table,{children:[(0,b.jsx)(D.TableHeader,{children:(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableHead,{children:d("name")}),(0,b.jsx)(D.TableHead,{children:d("scope")}),(0,b.jsx)(D.TableHead,{children:d("agent")}),(0,b.jsx)(D.TableHead,{children:d("location")}),(0,b.jsx)(D.TableHead,{children:d("status")})]})}),(0,b.jsxs)(D.TableBody,{children:[a.map(a=>{let e=a.skill?a.skill.packageHash===a.packageHash?"UNCHANGED":"CONFLICT":"IMPORT";return(0,b.jsxs)(D.TableRow,{children:[(0,b.jsxs)(D.TableCell,{children:[(0,b.jsx)("div",{className:"font-medium",children:a.skillName}),(0,b.jsx)("div",{className:"max-w-md whitespace-normal text-xs text-muted-foreground",children:a.description})]}),(0,b.jsxs)(D.TableCell,{children:[(0,b.jsx)(u.Badge,{variant:"outline",children:"GLOBAL"===a.scope?d("global"):d("project")}),a.codebase&&(0,b.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:a.codebase.repository.name})]}),(0,b.jsx)(D.TableCell,{children:a.agent.name}),(0,b.jsxs)(D.TableCell,{className:"max-w-md whitespace-normal font-mono text-xs",children:[a.rootPath,a.tracked&&(0,b.jsx)(u.Badge,{className:"ml-2",variant:"secondary",children:d("tracked")})]}),(0,b.jsx)(D.TableCell,{children:"UNCHANGED"===e?(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"secondary",children:[(0,b.jsx)(f.Check,{})," ",d("inSync")]}):"IMPORT"===e?(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"outline",children:[(0,b.jsx)(c.ArrowDownToLine,{})," ",d("toDatabase")]}):(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"destructive",children:[(0,b.jsx)(o,{})," ",d("conflict")]})})]},a.id)}),!a.length&&(0,b.jsx)(D.TableRow,{children:(0,b.jsx)(D.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:5,children:d("noClientSkills")})})]})]})})]})}function N({configuredCounts:a,onOpenChange:c,onSaved:d,open:e,settings:f}){let g=(0,r.useTranslations)("skills"),[h,i]=(0,s.useState)(f),[j,k]=(0,s.useState)(!1),[l,m]=(0,s.useState)(null),n=async()=>{k(!0);try{await (0,G.controlPlaneRequest)(`mutation SaveSkillSettings($input: SaveSkillSettingsInput!) {
27
+ `;function K(a,b){return"CURSOR"===b?a.cursorEnabled:"GITHUB_COPILOT"===b?a.githubCopilotEnabled:"CODEX"===b?a.codexEnabled:"CLAUDE"===b?a.claudeEnabled:a.openCodeEnabled}function L({overview:a}){let c=(0,r.useTranslations)("skills");return(0,b.jsxs)(w.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(w.CardHeader,{children:[(0,b.jsx)(w.CardTitle,{children:c("databaseSkills")}),(0,b.jsx)(w.CardDescription,{children:c("databaseSkillsDescription")})]}),(0,b.jsx)(w.CardContent,{className:"px-0",children:(0,b.jsxs)(D.Table,{children:[(0,b.jsx)(D.TableHeader,{children:(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableHead,{children:c("name")}),(0,b.jsx)(D.TableHead,{children:c("skillDescription")}),(0,b.jsx)(D.TableHead,{children:c("scope")}),(0,b.jsx)(D.TableHead,{children:c("groups")}),(0,b.jsx)(D.TableHead,{children:c("files")}),(0,b.jsx)(D.TableHead,{children:c("updated")})]})}),(0,b.jsxs)(D.TableBody,{children:[a.skills.map(a=>(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableCell,{children:(0,b.jsx)(F.Link,{className:"font-medium text-primary hover:underline",href:`/skills/${a.id}`,children:a.name})}),(0,b.jsx)(D.TableCell,{className:"max-w-lg whitespace-normal text-muted-foreground",children:a.description}),(0,b.jsx)(D.TableCell,{children:(0,b.jsx)(u.Badge,{variant:a.syncGlobally?"default":"secondary",children:a.syncGlobally?c("global"):c("groupOnly")})}),(0,b.jsx)(D.TableCell,{children:(0,b.jsx)("div",{className:"flex flex-wrap gap-1",children:a.groups.length?a.groups.map(a=>(0,b.jsx)(u.Badge,{variant:"outline",children:a.name},a.id)):"—"})}),(0,b.jsx)(D.TableCell,{children:a.files.length}),(0,b.jsx)(D.TableCell,{children:new Date(a.updatedAt).toLocaleString()})]},a.id)),!a.skills.length&&(0,b.jsx)(D.TableRow,{children:(0,b.jsx)(D.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:6,children:c("noSkills")})})]})]})})]})}function M({installations:a}){let d=(0,r.useTranslations)("skills");return(0,b.jsxs)(w.Card,{className:"gap-0 py-0",children:[(0,b.jsxs)(w.CardHeader,{children:[(0,b.jsx)(w.CardTitle,{children:d("clientSkills")}),(0,b.jsx)(w.CardDescription,{children:d("clientSkillsDescription")})]}),(0,b.jsx)(w.CardContent,{className:"px-0",children:(0,b.jsxs)(D.Table,{children:[(0,b.jsx)(D.TableHeader,{children:(0,b.jsxs)(D.TableRow,{children:[(0,b.jsx)(D.TableHead,{children:d("name")}),(0,b.jsx)(D.TableHead,{children:d("scope")}),(0,b.jsx)(D.TableHead,{children:d("agent")}),(0,b.jsx)(D.TableHead,{children:d("location")}),(0,b.jsx)(D.TableHead,{children:d("status")})]})}),(0,b.jsxs)(D.TableBody,{children:[a.map(a=>{let e=a.skill?a.skill.packageHash===a.packageHash?"UNCHANGED":"CONFLICT":"IMPORT";return(0,b.jsxs)(D.TableRow,{children:[(0,b.jsxs)(D.TableCell,{children:[(0,b.jsx)("div",{className:"font-medium",children:a.skillName}),(0,b.jsx)("div",{className:"max-w-md whitespace-normal text-xs text-muted-foreground",children:a.description})]}),(0,b.jsxs)(D.TableCell,{children:[(0,b.jsx)(u.Badge,{variant:"outline",children:"GLOBAL"===a.scope?d("global"):d("project")}),a.codebase&&(0,b.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:a.codebase.repository.name})]}),(0,b.jsx)(D.TableCell,{children:a.agent.name}),(0,b.jsxs)(D.TableCell,{className:"max-w-md whitespace-normal font-mono text-xs",children:[a.rootPath,a.tracked&&(0,b.jsx)(u.Badge,{className:"ml-2",variant:"secondary",children:d("tracked")})]}),(0,b.jsx)(D.TableCell,{children:"UNCHANGED"===e?(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"secondary",children:[(0,b.jsx)(f.Check,{})," ",d("inSync")]}):"IMPORT"===e?(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"outline",children:[(0,b.jsx)(c.ArrowDownToLine,{})," ",d("toDatabase")]}):(0,b.jsxs)(u.Badge,{className:"gap-1",variant:"destructive",children:[(0,b.jsx)(o,{})," ",d("conflict")]})})]},a.id)}),!a.length&&(0,b.jsx)(D.TableRow,{children:(0,b.jsx)(D.TableCell,{className:"py-10 text-center text-muted-foreground",colSpan:5,children:d("noClientSkills")})})]})]})})]})}function N({configuredCounts:a,onOpenChange:c,onSaved:d,open:e,settings:f}){let g=(0,r.useTranslations)("skills"),[h,i]=(0,s.useState)(f),[j,k]=(0,s.useState)(!1),[l,m]=(0,s.useState)(null),n=async()=>{k(!0);try{await (0,G.controlPlaneRequest)(`mutation SaveSkillSettings($input: SaveSkillSettingsInput!) {
28
28
  saveSkillSettings(input: $input) { updatedAt }
29
29
  }`,{input:{autoSyncProjectGroups:h.autoSyncProjectGroups,cursorEnabled:h.cursorEnabled,githubCopilotEnabled:h.githubCopilotEnabled,codexEnabled:h.codexEnabled,claudeEnabled:h.claudeEnabled,openCodeEnabled:h.openCodeEnabled}}),await d(),c(!1)}catch(a){m(a instanceof Error?a.message:String(a))}finally{k(!1)}};return(0,b.jsx)(y.Dialog,{onOpenChange:c,open:e,children:(0,b.jsxs)(y.DialogContent,{children:[(0,b.jsxs)(y.DialogHeader,{children:[(0,b.jsx)(y.DialogTitle,{children:g("settingsTitle")}),(0,b.jsx)(y.DialogDescription,{children:g("settingsDescription")})]}),l&&(0,b.jsx)(t.Alert,{variant:"destructive",children:(0,b.jsx)(t.AlertDescription,{children:l})}),(0,b.jsxs)("div",{className:"flex items-start gap-3 rounded-lg border p-3",children:[(0,b.jsx)(x.Checkbox,{checked:h.autoSyncProjectGroups,id:"skills-auto-sync",onCheckedChange:a=>i(b=>({...b,autoSyncProjectGroups:!0===a}))}),(0,b.jsxs)("div",{children:[(0,b.jsx)(A.Label,{htmlFor:"skills-auto-sync",children:g("autoSync")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g("autoSyncHelp")})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(A.Label,{children:g("enabledTools")}),Object.keys(H).map(c=>{let d=K(h,c);return(0,b.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,b.jsx)(x.Checkbox,{checked:d,id:`skill-tool-${c}`,onCheckedChange:a=>{var b;return b=!0===a,void i(a=>({...a,..."CURSOR"===c?{cursorEnabled:b}:{},..."GITHUB_COPILOT"===c?{githubCopilotEnabled:b}:{},..."CODEX"===c?{codexEnabled:b}:{},..."CLAUDE"===c?{claudeEnabled:b}:{},..."OPENCODE"===c?{openCodeEnabled:b}:{}}))}}),(0,b.jsxs)(A.Label,{className:"flex flex-1 justify-between",htmlFor:`skill-tool-${c}`,children:[(0,b.jsx)("span",{children:H[c]}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:a[c]>0?g("configuredAgents",{count:a[c]}):g("notDetected")})]})]},c)})]}),(0,b.jsx)(y.DialogFooter,{children:(0,b.jsxs)(v.Button,{disabled:j,onClick:()=>void n(),children:[j&&(0,b.jsx)(B.Spinner,{})," ",g("saveSettings")]})})]})})}a.s(["SkillsPage",0,function(){let a=(0,r.useTranslations)("skills"),c=(0,F.useRouter)(),[d,e]=(0,s.useState)(null),[f,g]=(0,s.useState)(""),[j,o]=(0,s.useState)("DATABASE"),[p,q]=(0,s.useState)(!1),[u,w]=(0,s.useState)(!0),[x,y]=(0,s.useState)(!1),[A,D]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{let a=await (0,G.controlPlaneRequest)(J,{search:f});e(a.skillsOverview),D(null)}catch(a){D(a instanceof Error?a.message:String(a))}finally{w(!1)}},[f]);(0,s.useEffect)(()=>{let a=window.setTimeout(()=>void O(),200);return()=>window.clearTimeout(a)},[O]);let P=(0,s.useMemo)(()=>d?Object.keys(H).filter(a=>K(d.settings,a)&&d.observations.some(b=>b.tool===a&&b.configured)):[],[d]),Q=(0,s.useMemo)(()=>Object.fromEntries(Object.keys(H).map(a=>[a,d?.observations.filter(b=>b.tool===a&&b.configured).length??0])),[d]),R="DATABASE"===j||P.includes(j)?j:"DATABASE",S=async()=>{y(!0);try{let a=await (0,G.controlPlaneRequest)("mutation PrepareSkillSync { prepareSkillSync(kind: ALL) { id } }");c.push(`/skills/sync/${a.prepareSkillSync.id}`)}catch(a){D(a instanceof Error?a.message:String(a))}finally{y(!1)}};return(0,b.jsxs)("div",{className:"flex h-full min-h-0 flex-col gap-4 overflow-auto p-4 sm:p-6",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:a("title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a("description")})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(v.Button,{asChild:!0,variant:"outline",children:(0,b.jsxs)(F.Link,{href:"/skills/groups",children:[(0,b.jsx)(i.FolderTree,{})," ",a("manageGroups")]})}),(0,b.jsxs)(v.Button,{onClick:()=>q(!0),variant:"outline",children:[(0,b.jsx)(n.Settings,{})," ",a("settings")]}),(0,b.jsx)(v.Button,{asChild:!0,variant:"outline",children:(0,b.jsxs)(F.Link,{href:"/skills/new",children:[(0,b.jsx)(k.Plus,{})," ",a("addSkill")]})}),(0,b.jsxs)(v.Button,{disabled:x,onClick:()=>void S(),children:[x?(0,b.jsx)(B.Spinner,{}):(0,b.jsx)(l.RefreshCw,{})," ",a("syncAll")]})]})]}),A&&(0,b.jsx)(t.Alert,{variant:"destructive",children:(0,b.jsx)(t.AlertDescription,{children:A})}),(0,b.jsxs)("div",{className:"relative max-w-xl",children:[(0,b.jsx)(m.Search,{className:"absolute top-2.5 left-3 size-4 text-muted-foreground"}),(0,b.jsx)(z.Input,{"aria-label":a("search"),className:"pl-9",onChange:a=>g(a.target.value),placeholder:a("searchPlaceholder"),value:f})]}),(0,b.jsx)("div",{className:"sm:hidden",children:(0,b.jsxs)(C.Select,{onValueChange:o,value:R,children:[(0,b.jsx)(C.SelectTrigger,{"aria-label":a("skillSource"),className:"w-full",children:(0,b.jsx)(C.SelectValue,{})}),(0,b.jsxs)(C.SelectContent,{children:[(0,b.jsxs)(C.SelectItem,{value:"DATABASE",children:[(0,b.jsx)(h.Database,{})," ",a("database")]}),P.map(a=>{let c=I[a];return(0,b.jsxs)(C.SelectItem,{value:a,children:[(0,b.jsx)(c,{})," ",H[a]]},a)})]})]})}),(0,b.jsx)(E.Tabs,{className:"hidden sm:flex",onValueChange:o,value:R,children:(0,b.jsxs)(E.TabsList,{className:"h-auto flex-wrap justify-start",children:[(0,b.jsxs)(E.TabsTrigger,{value:"DATABASE",children:[(0,b.jsx)(h.Database,{})," ",a("database")]}),P.map(a=>{let c=I[a];return(0,b.jsxs)(E.TabsTrigger,{value:a,children:[(0,b.jsx)(c,{})," ",H[a]]},a)})]})}),u||!d?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(B.Spinner,{})," ",a("loading")]}):"DATABASE"===R?(0,b.jsx)(L,{overview:d}):(0,b.jsx)(M,{installations:d.installations.filter(a=>a.consumers.includes(R))}),d&&(0,b.jsx)(N,{configuredCounts:Q,onOpenChange:q,onSaved:O,open:p,settings:d.settings},`${d.settings.updatedAt}-${p?"open":"closed"}`)]})}],696334)}];
30
30
 
@@ -30,7 +30,7 @@ module.exports=[141193,a=>{"use strict";var b=a.i(187924),c=a.i(416232),d=a.i(21
30
30
  artifacts { id kind relativePath sizeBytes checksum metadata createdAt }
31
31
  }
32
32
  }
33
- }`;function G({builds:a,coverageReports:e,buildsLoadingMore:j,buildsNextCursor:k,entry:l,overview:m,loadError:n,onLoadMoreBuilds:o,onReload:p,onUpdate:v}){let x=(0,h.useTranslations)("worktreeDetail"),B=(0,h.useTranslations)("worktrees"),F=(0,g.useLocale)(),I=(0,y.useRouter)(),[L,M]=(0,i.useState)(()=>null),[N,O]=(0,i.useState)(null),[P,Q]=(0,i.useState)(!1),[R,S]=(0,i.useState)(!1),[T,U]=(0,i.useState)(!1),[V,W]=(0,i.useState)(null),X=(0,i.useRef)(0),{worktree:Y,applyActivity:Z,setUnstagedChanges:$}=(0,C.useLiveWorktree)(l.worktree),_=m.activeMoves.some(a=>a.sourceCodebaseId===l.group.codebase.id||a.targetCodebaseId===l.group.codebase.id),aa="ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes(c.WORKTREE_INSPECT_JOB_KIND)&&"AVAILABLE"===Y.availability&&!Y.activeJob&&!_,ab="ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes(c.WORKTREE_WATCH_JOB_KIND),ac=(0,i.useCallback)(async()=>{if(!aa)return;let a=++X.current;S(!0);try{let b=await (0,C.inspectWorktree)(Y.id);if(a!==X.current)return;O(b),$(b.changes.some(a=>a.unstaged||a.untracked||a.conflicted)),W(null)}catch(b){a===X.current&&W(b instanceof Error?b.message:String(b))}finally{a===X.current&&S(!1)}},[aa,$,Y.id]),ad=(0,C.useQueuedWorktreeInspection)(ac);(0,i.useEffect)(()=>{if(!aa)return;let a=window.setTimeout(()=>void ad(),0);return()=>window.clearTimeout(a)},[aa,ad]);let ae=(0,i.useCallback)(a=>{Z(a),aa&&ad()},[Z,aa,ad]);(0,C.useWorktreeActivitySubscription)(Y.id,ab&&"AVAILABLE"===Y.availability,ae),(0,i.useEffect)(()=>{let a=()=>M(new URLSearchParams(window.location.search).get("issue"));return window.addEventListener("popstate",a),()=>window.removeEventListener("popstate",a)},[]);let af=a=>{let b,c;b=new URLSearchParams(window.location.search),a?b.set("issue",a):b.delete("issue"),c=b.toString(),window.history.pushState(null,"",`${window.location.pathname}${c?`?${c}`:""}`),M(a)},ag=(0,i.useCallback)(async()=>{await p(),aa&&await ad()},[aa,p,ad]),ah=async()=>{U(!0);try{await (0,z.controlPlaneRequest)("mutation RefreshWorktrees { refreshWorktrees }"),await ag(),W(null)}catch(a){W(a instanceof Error?a.message:String(a))}finally{U(!1)}},ai={worktree:Y,group:l.group,allTags:m.tags,baseRepoDirectory:l.agentGroup.agent.baseRepoDirectory,branchManagementEnabled:"ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes("worktree.branch"),editorVariant:m.settings.editorVariant,inspectionRefreshToken:0,liveUpdatesEnabled:ab,onReload:ag,onUpdate:v,onError:W,onManageTags:()=>Q(!0),onOpenTicket:a=>af(a),onDeleted:()=>I.push("/worktrees"),onMoved:a=>{a.targetWorktreeId&&I.push((0,D.worktreeDetailHref)(a.targetWorktreeId))},overview:m},aj=new Intl.DateTimeFormat(F,{dateStyle:"medium",timeStyle:"short"}),ak=a=>a?aj.format(new Date(a)):"—",al=aa?null:"OFFLINE"===l.agentGroup.agent.connectionStatus?x("inspectionOffline"):"AVAILABLE"!==Y.availability?Y.statusError||x("inspectionUnavailable"):x(Y.activeJob||_?"inspectionBusy":"inspectionUnsupported");return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-6xl flex-col gap-5",children:[(0,b.jsx)("div",{children:(0,b.jsx)(t.Button,{asChild:!0,className:"-ml-2",size:"sm",variant:"ghost",children:(0,b.jsxs)(y.Link,{href:"/worktrees",children:[(0,b.jsx)(d.ArrowLeft,{})," ",x("back")]})})}),(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("p",{className:"text-sm text-muted-foreground",children:[l.group.repository.name," · ",l.agentGroup.agent.name]}),(0,b.jsx)("h1",{className:"mt-1 truncate font-mono text-2xl font-semibold tracking-tight",children:Y.branch??Y.headSha?.slice(0,10)??B("detached")}),(0,b.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:Y.folder,children:(0,E.displayedWorktreePath)(Y.folder,l.agentGroup.agent.baseRepoDirectory)}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,b.jsx)(s.Badge,{variant:"secondary",children:Y.primary?B("primary"):x("linked")}),(0,b.jsx)(E.OriginStatusBadges,{worktree:Y}),Y.hasStagedChanges||Y.hasUnstagedChanges?(0,b.jsx)(s.Badge,{variant:"destructive",children:B("dirty")}):null,"AVAILABLE"!==Y.availability&&(0,b.jsx)(s.Badge,{variant:"destructive",children:Y.availability})]}),(Y.ticketKey||Y.ticketTitle)&&(0,b.jsx)(E.WorktreeTicketLink,{...ai})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(t.Button,{disabled:T,onClick:()=>void ah(),variant:"outline",children:[(0,b.jsx)(f.RefreshCw,{className:T?"animate-spin":void 0}),x("refresh")]}),(0,b.jsx)(E.WorktreeMenus,{...ai})]})]}),(n||V||Y.statusError)&&(0,b.jsx)(r.Alert,{variant:"destructive",children:(0,b.jsx)(r.AlertDescription,{children:V||n||Y.statusError})}),al&&(0,b.jsx)(r.Alert,{children:(0,b.jsx)(r.AlertDescription,{children:al})}),(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{className:"border-b",children:(0,b.jsx)(u.CardTitle,{children:x("actions")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsx)(E.ActionRow,{...ai,onCompleted:ag})})]}),(0,b.jsxs)("div",{className:"grid gap-5 lg:grid-cols-2",children:[(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{className:"border-b",children:(0,b.jsx)(u.CardTitle,{children:x("overview")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsxs)("dl",{className:"grid gap-3 text-sm sm:grid-cols-2",children:[(0,b.jsx)(K,{label:x("repository"),children:(0,b.jsx)(y.Link,{className:"text-primary hover:underline",href:`/codebases/${l.group.codebase.id}`,children:l.group.repository.name})}),(0,b.jsx)(K,{label:x("origin"),mono:!0,children:l.group.repository.displayOrigin}),(0,b.jsxs)(K,{label:x("agent"),children:[l.agentGroup.agent.name," ·"," ",l.agentGroup.agent.hostname]}),(0,b.jsx)(K,{label:x("folder"),mono:!0,children:Y.folder}),(0,b.jsx)(K,{label:x("head"),mono:!0,children:Y.headSha??"—"}),(0,b.jsx)(K,{label:x("upstream"),mono:!0,children:Y.upstream??"—"}),(0,b.jsx)(K,{label:x("originStatus"),children:(0,b.jsx)(E.OriginStatusBadges,{worktree:Y})}),(0,b.jsx)(K,{label:x("baseStatus"),children:(0,b.jsx)(E.BaseFreshnessBadge,{worktree:Y})}),(0,b.jsx)(K,{label:x("lastChecked"),children:ak(Y.lastCheckedAt)}),(0,b.jsx)(K,{label:x("lastFetched"),children:ak(l.group.codebase.lastFetchedAt)})]})})]}),(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{className:"border-b",children:(0,b.jsx)(u.CardTitle,{children:x("management")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsx)(E.WorktreeMetadata,{...ai})})]})]}),l.group.iosBuildConfigured&&(0,b.jsx)(H,{codebaseId:l.group.codebase.id,disabled:!aa,onReload:p,reports:e,worktreeId:Y.id}),(0,b.jsx)(J,{builds:a,loadingMore:j,nextCursor:k,onError:W,onLoadMore:o,onReload:p}),(0,b.jsxs)(u.Card,{className:"min-w-0",children:[(0,b.jsx)(u.CardHeader,{className:"border-b",children:(0,b.jsx)(u.CardTitle,{children:x("workingTree")})}),(0,b.jsx)(u.CardContent,{children:R&&!N?(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(w.Spinner,{})," ",B("loadingDetails")]}):N?(0,b.jsx)(A.WorktreeDetailPanel,{detail:N,worktreeId:Y.id}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:aa?x("inspectionFailed"):"—"})})]}),(0,b.jsxs)(u.Card,{className:"min-w-0",children:[(0,b.jsx)(u.CardHeader,{className:"border-b",children:(0,b.jsx)(u.CardTitle,{children:x("branchChanges")})}),(0,b.jsx)(u.CardContent,{children:N?(0,b.jsx)(A.BranchChangesPanel,{files:N.branchChanges??[],truncated:!0===N.branchChangesTruncated,worktreeId:Y.id}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"—"})})]}),(0,b.jsx)(q.JiraTicketDrawer,{issueKey:L,onClose:()=>af(null)}),(0,b.jsx)(E.TagManagerDialog,{onChanged:p,onOpenChange:Q,open:P,tags:m.tags})]})}function H({codebaseId:a,worktreeId:c,reports:d,disabled:e,onReload:f}){let i=(0,h.useTranslations)("worktreeDetail"),j=(0,g.useLocale)(),k=a=>"number"==typeof a?new Intl.NumberFormat(j,{style:"percent",maximumFractionDigits:1}).format(a):"—";return(0,b.jsxs)(u.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(u.CardHeader,{className:"border-b py-4",children:(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsx)(u.CardTitle,{children:i("codeCoverage")}),(0,b.jsx)("div",{className:"sm:ml-auto",children:(0,b.jsx)(o.WorktreeCoverageButton,{codebaseId:a,disabled:e,onStarted:()=>void f(),worktreeId:c})})]})}),d.length?(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:i("coverageBuild")}),(0,b.jsx)(x.TableHead,{children:i("coverageStatus")}),(0,b.jsx)(x.TableHead,{children:i("overallCoverage")}),(0,b.jsx)(x.TableHead,{children:i("changedCoverage")}),(0,b.jsx)(x.TableHead,{children:i("generated")}),(0,b.jsx)(x.TableHead,{className:"text-right",children:i("viewReport")})]})}),(0,b.jsx)(x.TableBody,{children:d.map(a=>{let c=a.build.snapshot.configuration;return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsxs)(x.TableCell,{children:[(0,b.jsx)("p",{className:"font-medium",children:c?.name??a.build.id}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.build.id.slice(0,8)})]}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(s.Badge,{variant:"FAILED"===a.status?"destructive":"outline",children:i(`coverageStatuses.${a.status}`)})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(I,{percent:k,value:a.summary.lineCoverage})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(I,{percent:k,value:a.summary.changedLineCoverage})}),(0,b.jsx)(x.TableCell,{className:"text-muted-foreground",children:new Date(a.finishedAt??a.createdAt).toLocaleString(j)}),(0,b.jsx)(x.TableCell,{className:"text-right",children:"READY"===a.status&&(0,b.jsx)(t.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,b.jsx)(y.Link,{href:`/builds/${a.build.id}/coverage`,children:i("viewReport")})})})]},a.id)})})]}):(0,b.jsx)(u.CardContent,{className:"py-6 text-sm text-muted-foreground",children:i("noCoverageReports")})]})}function I({percent:a,value:c}){if("number"!=typeof c)return(0,b.jsx)(b.Fragment,{children:"—"});let d=Math.max(0,Math.min(1,c));return(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[a(c),(0,b.jsx)("span",{"aria-hidden":"true",className:`size-3.5 shrink-0 rounded-full ring-1 ring-foreground/10 ${d>=.8?"text-emerald-500":d>=.5?"text-amber-500":"text-red-500"}`,"data-coverage-indicator":!0,style:{background:`conic-gradient(currentColor ${360*d}deg, var(--muted) 0deg)`}})]})}function J({builds:a,loadingMore:c,nextCursor:d,onError:e,onLoadMore:f,onReload:i}){let j=(0,h.useTranslations)("builds"),l=(0,g.useLocale)(),o=(0,y.useRouter)(),q=(0,p.useBuildTimeTicker)();return(0,b.jsxs)(u.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(u.CardHeader,{className:"border-b py-4",children:(0,b.jsx)(u.CardTitle,{children:j("title")})}),a.length?(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{className:"hover:bg-transparent",children:[(0,b.jsx)(x.TableHead,{children:j("build")}),(0,b.jsx)(x.TableHead,{children:j("status")}),(0,b.jsx)(x.TableHead,{children:j("action")}),(0,b.jsx)(x.TableHead,{children:j("destination")}),(0,b.jsx)(x.TableHead,{children:j("startedAt")}),(0,b.jsx)(x.TableHead,{className:"text-right",children:j("actionsLabel")})]})}),(0,b.jsx)(x.TableBody,{children:a.map(a=>{let c=a.snapshot.configuration,d=a.startedAt??a.createdAt,f="SUCCEEDED"===a.status&&a.artifacts.some(a=>"RUNNABLE_APP"===a.kind);return(0,b.jsxs)(x.TableRow,{"aria-label":j("viewBuild"),className:"cursor-pointer focus-visible:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>o.push(`/builds/${a.id}`),onKeyDown:b=>{("Enter"===b.key||" "===b.key)&&(b.preventDefault(),o.push(`/builds/${a.id}`))},role:"link",tabIndex:0,children:[(0,b.jsxs)(x.TableCell,{className:"min-w-52 whitespace-normal",children:[(0,b.jsx)(y.Link,{className:"font-medium hover:underline",href:`/builds/${a.id}`,onClick:a=>a.stopPropagation(),children:c?.name??a.id}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.id})]}),(0,b.jsx)(x.TableCell,{children:(0,b.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,b.jsx)(s.Badge,{variant:(0,k.buildStatusVariant)(a.status),children:j(`statuses.${a.status}`)}),a.outOfDate&&(0,b.jsx)(s.Badge,{className:"border-amber-500/40 text-amber-700 dark:text-amber-300",variant:"outline",children:j("outOfDate")})]})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(s.Badge,{variant:"outline",children:j(`actions.${a.action}`)})}),(0,b.jsx)(x.TableCell,{children:a.destination.name}),(0,b.jsx)(x.TableCell,{className:"text-muted-foreground",children:(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsx)("time",{dateTime:d,title:new Date(d).toLocaleString(l),children:(0,k.relativeBuildAge)(d,l,q)}),(0,b.jsx)("span",{className:"text-xs",children:j("durationValue",{duration:(0,k.buildDuration)(a,q)})})]})}),(0,b.jsx)(x.TableCell,{className:"text-right",children:(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,b.jsx)(m.RebuildButton,{buildId:a.id,onCompleted:()=>i(),onError:e,size:"sm"}),f&&(0,b.jsx)(n.RunBuildControls,{buildId:a.id,destinationType:a.destinationType,onCompleted:i,onError:e,preferredDestination:a.destination,size:"sm"})]})})]},a.id)})})]}):(0,b.jsx)(u.CardContent,{className:"py-6 text-sm text-muted-foreground",children:j("emptyTitle")}),d&&(0,b.jsx)("div",{className:"flex justify-center border-t p-3",children:(0,b.jsxs)(t.Button,{disabled:c,onClick:()=>void f(),variant:"outline",children:[c&&(0,b.jsx)(w.Spinner,{})," ",j("loadMore")]})})]})}function K({label:a,children:c,mono:d=!1}){return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-xs text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:d?"mt-0.5 break-all font-mono text-xs":"mt-0.5",children:c})]})}a.s(["WorktreeDetailPage",0,function({worktreeId:a}){let c=(0,h.useTranslations)("worktreeDetail"),[f,g]=(0,i.useState)(null),[j,k]=(0,i.useState)([]),[m,n]=(0,i.useState)(null),[o,p]=(0,i.useState)(!1),[q,s]=(0,i.useState)([]),[u,x]=(0,i.useState)(!0),[A,B]=(0,i.useState)(null),C=(0,i.useRef)(0),E=(0,i.useRef)(null),H=(0,i.useCallback)(async()=>{let b=++C.current;try{let c=await (0,z.controlPlaneRequest)(F,{worktreeId:a});if(b!==C.current)return;E.current=(0,D.findWorktreeOverviewEntry)(c.worktreeOverview,a)?.group.codebase.id??null,g(c.worktreeOverview),k(c.builds?.items??[]),n(c.builds?.nextCursor??null),s(c.worktreeCoverageReports??[]),B(null)}catch(a){b===C.current&&B(a instanceof Error?a.message:String(a))}finally{b===C.current&&x(!1)}},[a]),I=(0,i.useCallback)(async()=>{if(m){p(!0);try{let b=await (0,z.controlPlaneRequest)(`query WorktreeDetailBuilds($worktreeId: ID!, $after: ID!) {
33
+ }`;function G({builds:a,coverageReports:e,buildsLoadingMore:j,buildsNextCursor:k,entry:l,overview:m,loadError:n,onLoadMoreBuilds:o,onReload:p,onUpdate:v}){let x=(0,h.useTranslations)("worktreeDetail"),B=(0,h.useTranslations)("worktrees"),F=(0,g.useLocale)(),I=(0,y.useRouter)(),[L,M]=(0,i.useState)(()=>null),[N,O]=(0,i.useState)(null),[P,Q]=(0,i.useState)(!1),[R,S]=(0,i.useState)(!1),[T,U]=(0,i.useState)(!1),[V,W]=(0,i.useState)(null),X=(0,i.useRef)(0),{worktree:Y,applyActivity:Z,setUnstagedChanges:$}=(0,C.useLiveWorktree)(l.worktree),_=m.activeMoves.some(a=>a.sourceCodebaseId===l.group.codebase.id||a.targetCodebaseId===l.group.codebase.id),aa="ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes(c.WORKTREE_INSPECT_JOB_KIND)&&"AVAILABLE"===Y.availability&&!Y.activeJob&&!_,ab="ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes(c.WORKTREE_WATCH_JOB_KIND),ac=(0,i.useCallback)(async()=>{if(!aa)return;let a=++X.current;S(!0);try{let b=await (0,C.inspectWorktree)(Y.id);if(a!==X.current)return;O(b),$(b.changes.some(a=>a.unstaged||a.untracked||a.conflicted)),W(null)}catch(b){a===X.current&&W(b instanceof Error?b.message:String(b))}finally{a===X.current&&S(!1)}},[aa,$,Y.id]),ad=(0,C.useQueuedWorktreeInspection)(ac);(0,i.useEffect)(()=>{if(!aa)return;let a=window.setTimeout(()=>void ad(),0);return()=>window.clearTimeout(a)},[aa,ad]);let ae=(0,i.useCallback)(a=>{Z(a),aa&&ad()},[Z,aa,ad]);(0,C.useWorktreeActivitySubscription)(Y.id,ab&&"AVAILABLE"===Y.availability,ae),(0,i.useEffect)(()=>{let a=()=>M(new URLSearchParams(window.location.search).get("issue"));return window.addEventListener("popstate",a),()=>window.removeEventListener("popstate",a)},[]);let af=a=>{let b,c;b=new URLSearchParams(window.location.search),a?b.set("issue",a):b.delete("issue"),c=b.toString(),window.history.pushState(null,"",`${window.location.pathname}${c?`?${c}`:""}`),M(a)},ag=(0,i.useCallback)(async()=>{await p(),aa&&await ad()},[aa,p,ad]),ah=async()=>{U(!0);try{await (0,z.controlPlaneRequest)("mutation RefreshWorktrees { refreshWorktrees }"),await ag(),W(null)}catch(a){W(a instanceof Error?a.message:String(a))}finally{U(!1)}},ai={worktree:Y,group:l.group,allTags:m.tags,baseRepoDirectory:l.agentGroup.agent.baseRepoDirectory,branchManagementEnabled:"ONLINE"===l.agentGroup.agent.connectionStatus&&l.agentGroup.agent.capabilities.includes("worktree.branch"),editorVariant:m.settings.editorVariant,inspectionRefreshToken:0,liveUpdatesEnabled:ab,onReload:ag,onUpdate:v,onError:W,onManageTags:()=>Q(!0),onOpenTicket:a=>af(a),onDeleted:()=>I.push("/worktrees"),onMoved:a=>{a.targetWorktreeId&&I.push((0,D.worktreeDetailHref)(a.targetWorktreeId))},overview:m},aj=new Intl.DateTimeFormat(F,{dateStyle:"medium",timeStyle:"short"}),ak=a=>a?aj.format(new Date(a)):"—",al=aa?null:"OFFLINE"===l.agentGroup.agent.connectionStatus?x("inspectionOffline"):"AVAILABLE"!==Y.availability?Y.statusError||x("inspectionUnavailable"):x(Y.activeJob||_?"inspectionBusy":"inspectionUnsupported");return(0,b.jsxs)("section",{className:"mx-auto flex w-full max-w-6xl flex-col gap-5",children:[(0,b.jsx)("div",{children:(0,b.jsx)(t.Button,{asChild:!0,className:"-ml-2",size:"sm",variant:"ghost",children:(0,b.jsxs)(y.Link,{href:"/worktrees",children:[(0,b.jsx)(d.ArrowLeft,{})," ",x("back")]})})}),(0,b.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("p",{className:"text-sm text-muted-foreground",children:[l.group.repository.name," · ",l.agentGroup.agent.name]}),(0,b.jsx)("h1",{className:"mt-1 truncate font-mono text-2xl font-semibold tracking-tight",children:Y.branch??Y.headSha?.slice(0,10)??B("detached")}),(0,b.jsx)("p",{className:"mt-1 truncate font-mono text-xs text-muted-foreground",title:Y.folder,children:(0,E.displayedWorktreePath)(Y.folder,l.agentGroup.agent.baseRepoDirectory)}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,b.jsx)(s.Badge,{variant:"secondary",children:Y.primary?B("primary"):x("linked")}),(0,b.jsx)(E.OriginStatusBadges,{worktree:Y}),Y.hasStagedChanges||Y.hasUnstagedChanges?(0,b.jsx)(s.Badge,{variant:"destructive",children:B("dirty")}):null,"AVAILABLE"!==Y.availability&&(0,b.jsx)(s.Badge,{variant:"destructive",children:Y.availability})]}),(Y.ticketKey||Y.ticketTitle)&&(0,b.jsx)(E.WorktreeTicketLink,{...ai})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(t.Button,{disabled:T,onClick:()=>void ah(),variant:"outline",children:[(0,b.jsx)(f.RefreshCw,{className:T?"animate-spin":void 0}),x("refresh")]}),(0,b.jsx)(E.WorktreeMenus,{...ai})]})]}),(n||V||Y.statusError)&&(0,b.jsx)(r.Alert,{variant:"destructive",children:(0,b.jsx)(r.AlertDescription,{children:V||n||Y.statusError})}),al&&(0,b.jsx)(r.Alert,{children:(0,b.jsx)(r.AlertDescription,{children:al})}),(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:x("actions")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsx)(E.ActionRow,{...ai,onCompleted:ag})})]}),(0,b.jsxs)("div",{className:"grid gap-5 lg:grid-cols-2",children:[(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:x("overview")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsxs)("dl",{className:"grid gap-3 text-sm sm:grid-cols-2",children:[(0,b.jsx)(K,{label:x("repository"),children:(0,b.jsx)(y.Link,{className:"text-primary hover:underline",href:`/codebases/${l.group.codebase.id}`,children:l.group.repository.name})}),(0,b.jsx)(K,{label:x("origin"),mono:!0,children:l.group.repository.displayOrigin}),(0,b.jsxs)(K,{label:x("agent"),children:[l.agentGroup.agent.name," ·"," ",l.agentGroup.agent.hostname]}),(0,b.jsx)(K,{label:x("folder"),mono:!0,children:Y.folder}),(0,b.jsx)(K,{label:x("head"),mono:!0,children:Y.headSha??"—"}),(0,b.jsx)(K,{label:x("upstream"),mono:!0,children:Y.upstream??"—"}),(0,b.jsx)(K,{label:x("originStatus"),children:(0,b.jsx)(E.OriginStatusBadges,{worktree:Y})}),(0,b.jsx)(K,{label:x("baseStatus"),children:(0,b.jsx)(E.BaseFreshnessBadge,{worktree:Y})}),(0,b.jsx)(K,{label:x("lastChecked"),children:ak(Y.lastCheckedAt)}),(0,b.jsx)(K,{label:x("lastFetched"),children:ak(l.group.codebase.lastFetchedAt)})]})})]}),(0,b.jsxs)(u.Card,{children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:x("management")})}),(0,b.jsx)(u.CardContent,{children:(0,b.jsx)(E.WorktreeMetadata,{...ai})})]})]}),l.group.iosBuildConfigured&&(0,b.jsx)(H,{codebaseId:l.group.codebase.id,disabled:!aa,onReload:p,reports:e,worktreeId:Y.id}),(0,b.jsx)(J,{builds:a,loadingMore:j,nextCursor:k,onError:W,onLoadMore:o,onReload:p}),(0,b.jsxs)(u.Card,{className:"min-w-0",children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:x("workingTree")})}),(0,b.jsx)(u.CardContent,{children:R&&!N?(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(w.Spinner,{})," ",B("loadingDetails")]}):N?(0,b.jsx)(A.WorktreeDetailPanel,{detail:N,worktreeId:Y.id}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:aa?x("inspectionFailed"):"—"})})]}),(0,b.jsxs)(u.Card,{className:"min-w-0",children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:x("branchChanges")})}),(0,b.jsx)(u.CardContent,{children:N?(0,b.jsx)(A.BranchChangesPanel,{files:N.branchChanges??[],truncated:!0===N.branchChangesTruncated,worktreeId:Y.id}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"—"})})]}),(0,b.jsx)(q.JiraTicketDrawer,{issueKey:L,onClose:()=>af(null)}),(0,b.jsx)(E.TagManagerDialog,{onChanged:p,onOpenChange:Q,open:P,tags:m.tags})]})}function H({codebaseId:a,worktreeId:c,reports:d,disabled:e,onReload:f}){let i=(0,h.useTranslations)("worktreeDetail"),j=(0,g.useLocale)(),k=a=>"number"==typeof a?new Intl.NumberFormat(j,{style:"percent",maximumFractionDigits:1}).format(a):"—";return(0,b.jsxs)(u.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsx)(u.CardTitle,{children:i("codeCoverage")}),(0,b.jsx)("div",{className:"sm:ml-auto",children:(0,b.jsx)(o.WorktreeCoverageButton,{codebaseId:a,disabled:e,onStarted:()=>void f(),worktreeId:c})})]})}),d.length?(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{children:[(0,b.jsx)(x.TableHead,{children:i("coverageBuild")}),(0,b.jsx)(x.TableHead,{children:i("coverageStatus")}),(0,b.jsx)(x.TableHead,{children:i("overallCoverage")}),(0,b.jsx)(x.TableHead,{children:i("changedCoverage")}),(0,b.jsx)(x.TableHead,{children:i("generated")}),(0,b.jsx)(x.TableHead,{className:"text-right",children:i("viewReport")})]})}),(0,b.jsx)(x.TableBody,{children:d.map(a=>{let c=a.build.snapshot.configuration;return(0,b.jsxs)(x.TableRow,{children:[(0,b.jsxs)(x.TableCell,{children:[(0,b.jsx)("p",{className:"font-medium",children:c?.name??a.build.id}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.build.id.slice(0,8)})]}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(s.Badge,{variant:"FAILED"===a.status?"destructive":"outline",children:i(`coverageStatuses.${a.status}`)})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(I,{percent:k,value:a.summary.lineCoverage})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(I,{percent:k,value:a.summary.changedLineCoverage})}),(0,b.jsx)(x.TableCell,{className:"text-muted-foreground",children:new Date(a.finishedAt??a.createdAt).toLocaleString(j)}),(0,b.jsx)(x.TableCell,{className:"text-right",children:"READY"===a.status&&(0,b.jsx)(t.Button,{asChild:!0,size:"sm",variant:"outline",children:(0,b.jsx)(y.Link,{href:`/builds/${a.build.id}/coverage`,children:i("viewReport")})})})]},a.id)})})]}):(0,b.jsx)(u.CardContent,{className:"py-6 text-sm text-muted-foreground",children:i("noCoverageReports")})]})}function I({percent:a,value:c}){if("number"!=typeof c)return(0,b.jsx)(b.Fragment,{children:"—"});let d=Math.max(0,Math.min(1,c));return(0,b.jsxs)("span",{className:"inline-flex items-center gap-1.5 tabular-nums",children:[a(c),(0,b.jsx)("span",{"aria-hidden":"true",className:`size-3.5 shrink-0 rounded-full ring-1 ring-foreground/10 ${d>=.8?"text-emerald-500":d>=.5?"text-amber-500":"text-red-500"}`,"data-coverage-indicator":!0,style:{background:`conic-gradient(currentColor ${360*d}deg, var(--muted) 0deg)`}})]})}function J({builds:a,loadingMore:c,nextCursor:d,onError:e,onLoadMore:f,onReload:i}){let j=(0,h.useTranslations)("builds"),l=(0,g.useLocale)(),o=(0,y.useRouter)(),q=(0,p.useBuildTimeTicker)();return(0,b.jsxs)(u.Card,{className:"gap-0 py-0",children:[(0,b.jsx)(u.CardHeader,{children:(0,b.jsx)(u.CardTitle,{children:j("title")})}),a.length?(0,b.jsxs)(x.Table,{children:[(0,b.jsx)(x.TableHeader,{children:(0,b.jsxs)(x.TableRow,{className:"hover:bg-transparent",children:[(0,b.jsx)(x.TableHead,{children:j("build")}),(0,b.jsx)(x.TableHead,{children:j("status")}),(0,b.jsx)(x.TableHead,{children:j("action")}),(0,b.jsx)(x.TableHead,{children:j("destination")}),(0,b.jsx)(x.TableHead,{children:j("startedAt")}),(0,b.jsx)(x.TableHead,{className:"text-right",children:j("actionsLabel")})]})}),(0,b.jsx)(x.TableBody,{children:a.map(a=>{let c=a.snapshot.configuration,d=a.startedAt??a.createdAt,f="SUCCEEDED"===a.status&&a.artifacts.some(a=>"RUNNABLE_APP"===a.kind);return(0,b.jsxs)(x.TableRow,{"aria-label":j("viewBuild"),className:"cursor-pointer focus-visible:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",onClick:()=>o.push(`/builds/${a.id}`),onKeyDown:b=>{("Enter"===b.key||" "===b.key)&&(b.preventDefault(),o.push(`/builds/${a.id}`))},role:"link",tabIndex:0,children:[(0,b.jsxs)(x.TableCell,{className:"min-w-52 whitespace-normal",children:[(0,b.jsx)(y.Link,{className:"font-medium hover:underline",href:`/builds/${a.id}`,onClick:a=>a.stopPropagation(),children:c?.name??a.id}),(0,b.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:a.id})]}),(0,b.jsx)(x.TableCell,{children:(0,b.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,b.jsx)(s.Badge,{variant:(0,k.buildStatusVariant)(a.status),children:j(`statuses.${a.status}`)}),a.outOfDate&&(0,b.jsx)(s.Badge,{className:"border-amber-500/40 text-amber-700 dark:text-amber-300",variant:"outline",children:j("outOfDate")})]})}),(0,b.jsx)(x.TableCell,{children:(0,b.jsx)(s.Badge,{variant:"outline",children:j(`actions.${a.action}`)})}),(0,b.jsx)(x.TableCell,{children:a.destination.name}),(0,b.jsx)(x.TableCell,{className:"text-muted-foreground",children:(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,b.jsx)("time",{dateTime:d,title:new Date(d).toLocaleString(l),children:(0,k.relativeBuildAge)(d,l,q)}),(0,b.jsx)("span",{className:"text-xs",children:j("durationValue",{duration:(0,k.buildDuration)(a,q)})})]})}),(0,b.jsx)(x.TableCell,{className:"text-right",children:(0,b.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,b.jsx)(m.RebuildButton,{buildId:a.id,onCompleted:()=>i(),onError:e,size:"sm"}),f&&(0,b.jsx)(n.RunBuildControls,{buildId:a.id,destinationType:a.destinationType,onCompleted:i,onError:e,preferredDestination:a.destination,size:"sm"})]})})]},a.id)})})]}):(0,b.jsx)(u.CardContent,{className:"py-6 text-sm text-muted-foreground",children:j("emptyTitle")}),d&&(0,b.jsx)("div",{className:"flex justify-center border-t p-3",children:(0,b.jsxs)(t.Button,{disabled:c,onClick:()=>void f(),variant:"outline",children:[c&&(0,b.jsx)(w.Spinner,{})," ",j("loadMore")]})})]})}function K({label:a,children:c,mono:d=!1}){return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{className:"text-xs text-muted-foreground",children:a}),(0,b.jsx)("dd",{className:d?"mt-0.5 break-all font-mono text-xs":"mt-0.5",children:c})]})}a.s(["WorktreeDetailPage",0,function({worktreeId:a}){let c=(0,h.useTranslations)("worktreeDetail"),[f,g]=(0,i.useState)(null),[j,k]=(0,i.useState)([]),[m,n]=(0,i.useState)(null),[o,p]=(0,i.useState)(!1),[q,s]=(0,i.useState)([]),[u,x]=(0,i.useState)(!0),[A,B]=(0,i.useState)(null),C=(0,i.useRef)(0),E=(0,i.useRef)(null),H=(0,i.useCallback)(async()=>{let b=++C.current;try{let c=await (0,z.controlPlaneRequest)(F,{worktreeId:a});if(b!==C.current)return;E.current=(0,D.findWorktreeOverviewEntry)(c.worktreeOverview,a)?.group.codebase.id??null,g(c.worktreeOverview),k(c.builds?.items??[]),n(c.builds?.nextCursor??null),s(c.worktreeCoverageReports??[]),B(null)}catch(a){b===C.current&&B(a instanceof Error?a.message:String(a))}finally{b===C.current&&x(!1)}},[a]),I=(0,i.useCallback)(async()=>{if(m){p(!0);try{let b=await (0,z.controlPlaneRequest)(`query WorktreeDetailBuilds($worktreeId: ID!, $after: ID!) {
34
34
  builds(first: 50, after: $after, worktreeId: $worktreeId) {
35
35
  items { ${l.BUILD_LIST_FIELDS} }
36
36
  nextCursor