@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
@@ -7,4 +7,4 @@
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 k(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function V(e){let t=e.split(",").map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function O(e,t){let s;try{s=JSON.parse(e)}catch{throw Error(`${t} must be valid JSON`)}if(!s||"object"!=typeof s||Array.isArray(s))throw Error(`${t} must be a JSON object`);return s}function B(e){let t=e.headers??{},s=e.aps??{},l=s.alert??{},a=e.liveActivity??{},i=s.sound,n=i&&"object"==typeof i&&!Array.isArray(i)?i:null,r=e=>Array.isArray(e)?e.map(String).join(", "):"";return{...L,pushType:e.pushType??"alert",topic:String(t.topic??""),priority:String(t.priority??10),apnsId:String(t.id??""),expiration:String(t.expiration??""),collapseId:String(t.collapseId??""),title:String(l.title??""),subtitle:String(l.subtitle??""),body:String(l.body??""),titleLocKey:String(l["title-loc-key"]??""),titleLocArgs:r(l["title-loc-args"]),subtitleLocKey:String(l["subtitle-loc-key"]??""),subtitleLocArgs:r(l["subtitle-loc-args"]),locKey:String(l["loc-key"]??""),locArgs:r(l["loc-args"]),launchImage:String(l["launch-image"]??""),summaryArg:String(l["summary-arg"]??""),summaryArgCount:void 0===l["summary-arg-count"]?"":String(l["summary-arg-count"]),badge:void 0===s.badge?"":String(s.badge),soundName:"string"==typeof i?i:String(n?.name??""),criticalSound:n?.critical===1,soundVolume:n?.volume===void 0?"1":String(n.volume),category:String(s.category??""),threadId:String(s["thread-id"]??""),contentAvailable:1===s["content-available"],mutableContent:1===s["mutable-content"],targetContentId:String(s["target-content-id"]??""),interruptionLevel:String(s["interruption-level"]??"active"),relevanceScore:void 0===s["relevance-score"]?"":String(s["relevance-score"]),customJson:JSON.stringify(e.custom??{},null,2),liveTimestamp:String(a.timestamp??Math.floor(Date.now()/1e3)),liveEvent:a.event??"update",liveContentState:JSON.stringify(a["content-state"]??{},null,2),liveAttributesType:String(a["attributes-type"]??""),liveAttributes:JSON.stringify(a.attributes??{},null,2),liveStaleDate:void 0===a["stale-date"]?"":String(a["stale-date"]),liveDismissalDate:void 0===a["dismissal-date"]?"":String(a["dismissal-date"]),liveInputPushToken:1===a["input-push-token"],credentialId:String(e.credentialId??"")}}function H(e,t){return{...e,pushType:t,..."background"===t?{priority:"5"}:{},..."mdm"===t?{}:{credentialId:""}}}function $({label:e,children:s,className:l}){return(0,t.jsxs)("div",{className:(0,w.cn)("space-y-2",l),children:[(0,t.jsx)(S.Label,{children:e}),s]})}function R({label:e,checked:s,onChange:l}){return(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(v.Checkbox,{checked:s,onCheckedChange:e=>l(!!e)}),e]})}function K({eligible:e,selected:s,allEligible:l,onSelected:i,onAllEligible:n}){let r=(0,d.useTranslations)("pushNotifications");return(0,t.jsxs)(y.Popover,{children:[(0,t.jsx)(y.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(p.Button,{className:"w-full justify-between",variant:"outline",children:[l?r("allEligibleDevices",{count:e.length}):r("selectedDevices",{count:s.size}),(0,t.jsx)(a.ChevronDown,{})]})}),(0,t.jsx)(y.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:(0,t.jsxs)(j.Command,{children:[(0,t.jsx)(j.CommandInput,{placeholder:r("searchDevices")}),(0,t.jsxs)(j.CommandList,{children:[(0,t.jsx)(j.CommandEmpty,{children:r("noEligibleDevices")}),(0,t.jsxs)(j.CommandGroup,{children:[(0,t.jsx)(j.CommandItem,{"data-checked":l,onSelect:()=>{n(!l),l||i(new Set)},value:"all-eligible",children:r("allEligibleDevices",{count:e.length})}),e.map(e=>(0,t.jsxs)(j.CommandItem,{"data-checked":s.has(e.id),onSelect:()=>{n(!1);let t=new Set(s);t.has(e.id)?t.delete(e.id):t.add(e.id),i(t)},value:`${e.displayName} ${e.tokenMasked}`,children:[e.displayName,(0,t.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:e.environment})]},e.id))]})]})]})})]})}function J({channels:e,load:s}){let l=(0,d.useTranslations)("pushNotifications"),a=(0,d.useTranslations)("common"),[i,n]=(0,u.useState)(""),[r,c]=(0,u.useState)("SANDBOX"),[x,m]=(0,u.useState)("NO_STORAGE"),[v,j]=(0,u.useState)(!1),S=async()=>{j(!0);try{await (0,D.controlPlaneRequest)("mutation Create($input: CreateApnsBroadcastChannelInput!) { createApnsBroadcastChannel(input: $input) { id } }",{input:{bundleId:i,environment:r,storagePolicy:x}}),n(""),await s()}finally{j(!1)}};return(0,t.jsxs)(g.Card,{children:[(0,t.jsxs)(g.CardHeader,{children:[(0,t.jsx)(g.CardTitle,{children:l("broadcastChannels")}),(0,t.jsx)(g.CardDescription,{children:l("broadcastDescription")})]}),(0,t.jsxs)(g.CardContent,{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-4",children:[(0,t.jsx)(b.Input,{onChange:e=>n(e.target.value),placeholder:l("bundleId"),value:i}),(0,t.jsxs)(C.Select,{onValueChange:c,value:r,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,t.jsx)(C.SelectItem,{value:"PRODUCTION",children:"Production"})]})]}),(0,t.jsxs)(C.Select,{onValueChange:m,value:x,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"NO_STORAGE",children:l("noStorage")}),(0,t.jsx)(C.SelectItem,{value:"MOST_RECENT",children:l("mostRecent")})]})]}),(0,t.jsx)(p.Button,{disabled:v||!i,onClick:()=>void S(),children:l("createChannel")})]}),(0,t.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-mono text-xs",children:e.channelId}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.bundleId," · ",e.environment," ·"," ",e.storagePolicy]})]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:l("delete"),cancelLabel:a("cancel"),description:l("deleteChannelDescription"),onConfirm:async()=>{await (0,D.controlPlaneRequest)("mutation Delete($id: ID!) { deleteApnsBroadcastChannel(id: $id) }",{id:e.id}),await s()},title:l("deleteChannel"),trigger:(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",children:(0,t.jsx)(o.Trash2,{})})})]},e.id))})]})]})}function M({batches:e,expanded:s,setExpanded:l,onLoad:i,onResend:c,onPreset:x,onDelete:g,locale:v}){let j=(0,d.useTranslations)("pushNotifications"),b=(0,d.useTranslations)("common");return 0===e.length?(0,t.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:j("noHistory")}):(0,t.jsxs)(I.Table,{children:[(0,t.jsx)(I.TableHeader,{children:(0,t.jsxs)(I.TableRow,{children:[(0,t.jsx)(I.TableHead,{className:"w-12"}),(0,t.jsx)(I.TableHead,{children:j("created")}),(0,t.jsx)(I.TableHead,{children:j("pushType")}),(0,t.jsx)(I.TableHead,{children:j("deliveryMode")}),(0,t.jsx)(I.TableHead,{children:j("recipients")}),(0,t.jsx)(I.TableHead,{children:j("result")}),(0,t.jsx)(I.TableHead,{children:j("status")})]})}),(0,t.jsx)(I.TableBody,{children:e.map(e=>(0,t.jsxs)(u.Fragment,{children:[(0,t.jsxs)(I.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let t;return t=e.id,l(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},children:[(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(a.ChevronDown,{className:(0,w.cn)("transition-transform",s.has(e.id)&&"rotate-180")})}),(0,t.jsx)(I.TableCell,{children:new Date(e.createdAt).toLocaleString(v)}),(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"secondary",children:String(e.editor.pushType??"—")})}),(0,t.jsx)(I.TableCell,{children:e.targetMode}),(0,t.jsx)(I.TableCell,{children:e.recipientCount}),(0,t.jsxs)(I.TableCell,{children:[e.successCount," / ",e.failureCount]}),(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"FAILED"===e.status?"destructive":"outline",children:e.status})})]}),s.has(e.id)&&(0,t.jsx)(I.TableRow,{className:"hover:bg-transparent",children:(0,t.jsxs)(I.TableCell,{colSpan:7,className:"bg-muted/20 p-5",children:[(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(S.Label,{children:j("payload")}),(0,t.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.payload,null,2)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(S.Label,{children:j("headers")}),(0,t.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.headers,null,2)})]})]}),e.deliveries.length>0&&(0,t.jsx)("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:e.deliveries.map(e=>(0,t.jsxs)("div",{className:"rounded-lg border bg-background p-3",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"font-mono text-xs",children:e.topic}),(0,t.jsx)(m.Badge,{variant:"SUCCEEDED"===e.status?"default":"destructive",children:e.status})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["HTTP ",e.responseCode??"—"," ·"," ",e.reason??"—"," · ",e.attempts," ",j("attempts")," · ",e.durationMs??"—"," ms"]}),e.apnsId&&(0,t.jsx)("p",{className:"font-mono text-xs",children:e.apnsId})]},e.id))}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[(0,t.jsx)(p.Button,{onClick:()=>i(e.editor),variant:"outline",children:j("load")}),(0,t.jsxs)(p.Button,{onClick:()=>x(e),variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",j("saveAsPreset")]}),"DRAFT"!==e.targetMode&&(0,t.jsxs)(p.Button,{onClick:()=>void c(e.id),children:[(0,t.jsx)(r.Send,{})," ",j("resend")]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:j("delete"),cancelLabel:b("cancel"),description:j("deleteHistoryDescription"),onConfirm:()=>g(e.id),title:j("deleteHistory"),trigger:(0,t.jsxs)(p.Button,{disabled:["QUEUED","SENDING"].includes(e.status),variant:"ghost",children:[(0,t.jsx)(o.Trash2,{})," ",j("delete")]})})]})]})})]},e.id))})]})}function q({presets:e,registrations:s,expanded:i,setExpanded:n,onLoad:r,onSend:c,onDelete:x}){let m=(0,d.useTranslations)("pushNotifications"),g=(0,d.useTranslations)("common");return 0===e.length?(0,t.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:m("noPresets")}):(0,t.jsxs)(I.Table,{children:[(0,t.jsx)(I.TableHeader,{children:(0,t.jsxs)(I.TableRow,{children:[(0,t.jsx)(I.TableHead,{className:"w-12"}),(0,t.jsx)(I.TableHead,{children:m("name")}),(0,t.jsx)(I.TableHead,{children:m("pushType")}),(0,t.jsx)(I.TableHead,{children:m("topic")}),(0,t.jsx)(I.TableHead,{children:m("updated")})]})}),(0,t.jsx)(I.TableBody,{children:e.map(e=>(0,t.jsxs)(u.Fragment,{children:[(0,t.jsxs)(I.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let t;return t=e.id,n(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},children:[(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(a.ChevronDown,{className:(0,w.cn)("transition-transform",i.has(e.id)&&"rotate-180")})}),(0,t.jsx)(I.TableCell,{className:"font-medium",children:e.name}),(0,t.jsx)(I.TableCell,{children:String(e.editor.pushType??"—")}),(0,t.jsx)(I.TableCell,{className:"font-mono text-xs",children:String(e.editor.headers?.topic??"—")}),(0,t.jsx)(I.TableCell,{children:new Date(e.updatedAt).toLocaleString()})]}),i.has(e.id)&&(0,t.jsx)(I.TableRow,{children:(0,t.jsxs)(I.TableCell,{className:"bg-muted/20 p-5",colSpan:5,children:[(0,t.jsx)("pre",{className:"max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.editor,null,2)}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap items-end justify-end gap-2",children:[(0,t.jsx)(z,{onSend:(t,s)=>c(e,t,s),preset:e,registrations:s}),(0,t.jsxs)(p.Button,{onClick:()=>r(e.editor),children:[(0,t.jsx)(l.Check,{})," ",m("loadEdit")]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:m("delete"),cancelLabel:g("cancel"),description:m("deletePresetDescription"),onConfirm:()=>x(e.id),title:m("deletePreset"),trigger:(0,t.jsxs)(p.Button,{variant:"ghost",children:[(0,t.jsx)(o.Trash2,{})," ",m("delete")]})})]})]})})]},e.id))})]})}function z({preset:e,registrations:s,onSend:l}){let a=(0,d.useTranslations)("pushNotifications"),[i,n]=(0,u.useState)(new Set),[o,c]=(0,u.useState)(!1),[h,x]=(0,u.useState)(!1),m=String((e.editor.headers??{}).topic??""),g=String(e.editor.pushType??""),v=s.filter(e=>"ACTIVE"===e.status&&e.topic===m&&e.supportedPushTypes.includes(g));return(0,t.jsxs)("div",{className:"grid min-w-72 flex-1 gap-2 sm:max-w-xl sm:grid-cols-[1fr_auto]",children:[(0,t.jsx)(K,{allEligible:o,eligible:v,onAllEligible:c,onSelected:n,selected:i}),(0,t.jsxs)(p.Button,{disabled:h||!o&&0===i.size,onClick:()=>void(async()=>{x(!0);try{await l(o,[...i]),c(!1),n(new Set)}finally{x(!1)}})(),children:[h?(0,t.jsx)(T.Spinner,{}):(0,t.jsx)(r.Send,{})," ",a("send")]})]})}e.s(["PushNotificationsPage",0,function(){let e=(0,d.useTranslations)("pushNotifications"),l=(0,d.useTranslations)("common"),a=(0,c.useLocale)(),[v,j]=(0,u.useState)(L),[y,I]=(0,u.useState)([]),[w,z]=(0,u.useState)([]),[F,U]=(0,u.useState)([]),[X,_]=(0,u.useState)([]),[G,Q]=(0,u.useState)([]),[W,Y]=(0,u.useState)(new Set),[Z,ee]=(0,u.useState)(!1),[et,es]=(0,u.useState)(""),[el,ea]=(0,u.useState)(!1),[ei,en]=(0,u.useState)(""),[er,eo]=(0,u.useState)("HEX"),[ec,ed]=(0,u.useState)("SANDBOX"),[eu,eh]=(0,u.useState)("content"),[ex,em]=(0,u.useState)("history"),[ep,eg]=(0,u.useState)(""),[ev,ej]=(0,u.useState)(new Set),[eb,eS]=(0,u.useState)(new Set),[ey,eC]=(0,u.useState)(!0),[eT,ef]=(0,u.useState)(!1),[eI,eN]=(0,u.useState)(null),[eA,eD]=(0,u.useState)(null),ew=(0,u.useCallback)(async()=>{try{let e=await (0,D.controlPlaneRequest)(P);I(e.apnsRegistrations),z(e.pushNotificationSettings.certificates),U(e.apnsBroadcastChannels),_(e.pushNotificationPresets),Q(e.pushNotificationHistory),eN(null)}catch(e){eN(e instanceof Error?e.message:String(e))}finally{eC(!1)}},[]);(0,u.useEffect)(()=>{let e=window.setTimeout(()=>void ew(),0),t=(0,D.controlPlaneSubscriptions)().subscribe({query:"subscription { pushNotificationsChanged }"},{next:()=>void ew(),error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(e),t()}},[ew]);let eE=(e,t)=>j(s=>({...s,[e]:t})),eL=(0,u.useMemo)(()=>{try{let t=Object.fromEntries(Object.entries({title:v.title||void 0,subtitle:v.subtitle||void 0,body:v.body||void 0,"title-loc-key":v.titleLocKey||void 0,"title-loc-args":V(v.titleLocArgs),"subtitle-loc-key":v.subtitleLocKey||void 0,"subtitle-loc-args":V(v.subtitleLocArgs),"loc-key":v.locKey||void 0,"loc-args":V(v.locArgs),"launch-image":v.launchImage||void 0,"summary-arg":v.summaryArg||void 0,"summary-arg-count":k(v.summaryArgCount)}).filter(([,e])=>void 0!==e)),s=Object.fromEntries(Object.entries({alert:Object.keys(t).length?t:void 0,badge:k(v.badge),sound:v.soundName?v.criticalSound?{critical:1,name:v.soundName,volume:Number(v.soundVolume)}:v.soundName:void 0,category:v.category||void 0,"thread-id":v.threadId||void 0,"content-available":v.contentAvailable?1:void 0,"mutable-content":v.mutableContent?1:void 0,"target-content-id":v.targetContentId||void 0,"interruption-level":v.interruptionLevel||void 0,"relevance-score":k(v.relevanceScore)}).filter(([,e])=>void 0!==e)),l=["background","mdm"].includes(v.pushType)?{}:s;return{value:{pushType:v.pushType,headers:{id:v.apnsId||void 0,topic:v.topic,priority:Number(v.priority),expiration:v.expiration||void 0,collapseId:v.collapseId||void 0,broadcastChannelId:et||void 0},aps:l,custom:O(v.customJson,e("customJson")),liveActivity:"liveactivity"===v.pushType?{timestamp:Number(v.liveTimestamp),event:v.liveEvent,"content-state":O(v.liveContentState,e("contentState")),"attributes-type":v.liveAttributesType||void 0,attributes:"start"===v.liveEvent?O(v.liveAttributes,e("attributes")):void 0,"stale-date":k(v.liveStaleDate),"dismissal-date":k(v.liveDismissalDate),"input-push-token":v.liveInputPushToken?1:void 0}:void 0,credentialId:v.credentialId||null},error:null}}catch(e){return{value:null,error:e instanceof Error?e.message:String(e)}}},[et,v,e]),eP=(0,u.useMemo)(()=>{if(!eL.value)return null;let e=eL.value,t="mdm"===e.pushType?{mdm:"<PushMagic>"}:{...e.custom,aps:"liveactivity"===e.pushType?{...e.aps,...e.liveActivity}:e.aps},s=JSON.stringify(t,null,2);return{payload:t,text:s,bytes:new TextEncoder().encode(JSON.stringify(t)).length}},[eL]),ek=y.filter(e=>"ACTIVE"===e.status&&e.topic===v.topic&&e.supportedPushTypes.includes(v.pushType)),eV=async(e,t,s)=>{ef(!0),eN(null),eD(null);try{await (0,D.controlPlaneRequest)(e,t),s&&eD(s),await ew()}catch(e){eN(e instanceof Error?e.message:String(e))}finally{ef(!1)}},eO=async()=>{eL.value?await eV("mutation SendPush($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,A.createClientId)(),editor:eL.value,targetMode:et?"BROADCAST":el?"DIRECT":Z?"ALL":"DEVICES",registrationIds:[...W],channelId:et||null,directToken:el?ei:null,directTokenEncoding:el?er:null,directEnvironment:el?ec:null}},e("queued")):eN(eL.error)},eB=e=>{Y(new Set),ee(!1),es(""),ea(!1),en(""),j(B(e))};return(0,t.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"flex items-center gap-2 text-2xl font-semibold tracking-tight",children:[(0,t.jsx)(s.BellRing,{})," ",e("title")]}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e("description")})]}),eI&&(0,t.jsx)(x.Alert,{variant:"destructive",children:(0,t.jsx)(x.AlertDescription,{children:eI})}),eA&&(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:eA})}),(0,t.jsxs)(g.Card,{children:[(0,t.jsxs)(g.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(g.CardTitle,{children:e("editor")}),(0,t.jsx)(g.CardDescription,{children:e("editorDescription")}),(0,t.jsx)(g.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,t.jsxs)("div",{className:"grid gap-2 sm:flex",children:[(0,t.jsx)(b.Input,{className:"w-full sm:w-48",onChange:e=>eg(e.target.value),placeholder:e("presetName"),value:ep}),(0,t.jsxs)(p.Button,{disabled:eT||!eL.value||!ep.trim(),onClick:()=>void eV("mutation SavePreset($name: String!, $editor: JSON!) { savePushNotificationPreset(name: $name, editor: $editor) { id } }",{name:ep,editor:eL.value},e("presetSaved")),size:"sm",variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",e("savePreset")]})]})})]}),(0,t.jsxs)(g.CardContent,{className:"space-y-5",children:[(0,t.jsxs)(f.Tabs,{onValueChange:eh,value:eu,children:[(0,t.jsxs)(C.Select,{onValueChange:eh,value:eu,children:[(0,t.jsx)(C.SelectTrigger,{className:"w-full sm:hidden",children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"content",children:e("content")}),(0,t.jsx)(C.SelectItem,{value:"headers",children:e("headers")}),(0,t.jsx)(C.SelectItem,{value:"advanced",children:e("advanced")}),(0,t.jsx)(C.SelectItem,{value:"specialized",children:e("specialized")})]})]}),(0,t.jsxs)(f.TabsList,{className:"hidden sm:inline-flex",children:[(0,t.jsx)(f.TabsTrigger,{value:"content",children:e("content")}),(0,t.jsx)(f.TabsTrigger,{value:"headers",children:e("headers")}),(0,t.jsx)(f.TabsTrigger,{value:"advanced",children:e("advanced")}),(0,t.jsx)(f.TabsTrigger,{value:"specialized",children:e("specialized")})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 space-y-4",value:"content",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("pushType"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>{j(t=>H(t,e)),"liveactivity"!==e&&(ea(!1),es(""))},value:v.pushType,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:E.map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("titleField"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("title",e.target.value),value:v.title})}),(0,t.jsx)($,{label:e("subtitle"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitle",e.target.value),value:v.subtitle})})]}),(0,t.jsx)($,{label:e("body"),children:(0,t.jsx)(N.Textarea,{onChange:e=>eE("body",e.target.value),rows:4,value:v.body})}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,t.jsx)($,{label:e("badge"),children:(0,t.jsx)(b.Input,{inputMode:"numeric",onChange:e=>eE("badge",e.target.value),value:v.badge})}),(0,t.jsx)($,{label:e("sound"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("soundName",e.target.value),value:v.soundName})}),(0,t.jsx)($,{label:e("category"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("category",e.target.value),value:v.category})}),(0,t.jsx)($,{label:e("threadId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("threadId",e.target.value),value:v.threadId})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-5",children:[(0,t.jsx)(R,{checked:v.contentAvailable,label:e("contentAvailable"),onChange:e=>eE("contentAvailable",e)}),(0,t.jsx)(R,{checked:v.mutableContent,label:e("mutableContent"),onChange:e=>eE("mutableContent",e)}),(0,t.jsx)(R,{checked:v.criticalSound,label:e("criticalSound"),onChange:e=>eE("criticalSound",e)})]}),v.criticalSound&&(0,t.jsx)($,{label:e("soundVolume"),children:(0,t.jsx)(b.Input,{className:"max-w-40",max:"1",min:"0",onChange:e=>eE("soundVolume",e.target.value),step:"0.1",type:"number",value:v.soundVolume})})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",value:"headers",children:[(0,t.jsx)($,{label:e("topic"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("topic",e.target.value),placeholder:"com.example.app",value:v.topic})}),(0,t.jsx)($,{label:e("priority"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("priority",e),value:v.priority,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["1","5","10"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("apnsId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("apnsId",e.target.value),value:v.apnsId})}),(0,t.jsx)($,{label:e("expiration"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("expiration",e.target.value),placeholder:"0 / Unix timestamp",value:v.expiration})}),(0,t.jsx)($,{label:e("collapseId"),children:(0,t.jsx)(b.Input,{maxLength:64,onChange:e=>eE("collapseId",e.target.value),value:v.collapseId})}),"mdm"===v.pushType&&(0,t.jsx)($,{label:e("certificateCredential"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("credentialId",e),value:v.credentialId,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{placeholder:e("selectCredential")})}),(0,t.jsx)(C.SelectContent,{children:w.map(e=>(0,t.jsxs)(C.SelectItem,{value:e.id,children:[e.name," · ",e.environment]},e.id))})]})})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 space-y-4",value:"advanced",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("titleLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("titleLocKey",e.target.value),value:v.titleLocKey})}),(0,t.jsx)($,{label:e("titleLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("titleLocArgs",e.target.value),value:v.titleLocArgs})}),(0,t.jsx)($,{label:e("subtitleLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitleLocKey",e.target.value),value:v.subtitleLocKey})}),(0,t.jsx)($,{label:e("subtitleLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitleLocArgs",e.target.value),value:v.subtitleLocArgs})}),(0,t.jsx)($,{label:e("bodyLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("locKey",e.target.value),value:v.locKey})}),(0,t.jsx)($,{label:e("bodyLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("locArgs",e.target.value),value:v.locArgs})}),(0,t.jsx)($,{label:e("launchImage"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("launchImage",e.target.value),value:v.launchImage})}),(0,t.jsx)($,{label:e("summaryArg"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("summaryArg",e.target.value),value:v.summaryArg})}),(0,t.jsx)($,{label:e("summaryArgCount"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("summaryArgCount",e.target.value),value:v.summaryArgCount})}),(0,t.jsx)($,{label:e("targetContentId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("targetContentId",e.target.value),value:v.targetContentId})}),(0,t.jsx)($,{label:e("interruptionLevel"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("interruptionLevel",e),value:v.interruptionLevel,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["passive","active","time-sensitive","critical"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("relevanceScore"),children:(0,t.jsx)(b.Input,{max:"1",min:"0",onChange:e=>eE("relevanceScore",e.target.value),step:"0.1",type:"number",value:v.relevanceScore})})]}),(0,t.jsx)($,{label:e("customJson"),children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",onChange:e=>eE("customJson",e.target.value),rows:7,value:v.customJson})})]}),(0,t.jsx)(f.TabsContent,{className:"mt-4 space-y-4",value:"specialized",children:"liveactivity"===v.pushType?(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("timestamp"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveTimestamp",e.target.value),value:v.liveTimestamp})}),(0,t.jsx)($,{label:e("event"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("liveEvent",e),value:v.liveEvent,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["start","update","end"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("attributesType"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveAttributesType",e.target.value),value:v.liveAttributesType})}),(0,t.jsx)($,{label:e("contentState"),className:"sm:col-span-2",children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",onChange:e=>eE("liveContentState",e.target.value),rows:5,value:v.liveContentState})}),(0,t.jsx)($,{label:e("attributes"),children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",disabled:"start"!==v.liveEvent,onChange:e=>eE("liveAttributes",e.target.value),rows:5,value:v.liveAttributes})}),(0,t.jsx)($,{label:e("staleDate"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveStaleDate",e.target.value),value:v.liveStaleDate})}),(0,t.jsx)($,{label:e("dismissalDate"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveDismissalDate",e.target.value),value:v.liveDismissalDate})}),(0,t.jsx)(R,{checked:v.liveInputPushToken,label:e("inputPushToken"),onChange:e=>eE("liveInputPushToken",e)})]}):"mdm"===v.pushType?(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:e("mdmHelp")})}):(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:e("specializedHelp",{type:v.pushType})})})})]}),(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(S.Label,{children:e("payloadPreview")}),(0,t.jsxs)(m.Badge,{variant:eL.error||eP&&eP.bytes>("voip"===v.pushType?5120:4096)?"destructive":"secondary",children:[eP?.bytes??0," /"," ","voip"===v.pushType?5120:4096," bytes"]})]}),eL.error?(0,t.jsx)(x.Alert,{variant:"destructive",children:(0,t.jsx)(x.AlertDescription,{children:eL.error})}):(0,t.jsx)("pre",{className:"max-h-80 overflow-auto rounded-xl bg-muted p-4 text-xs",children:eP?.text})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(S.Label,{children:e("recipients")}),"liveactivity"===v.pushType&&(0,t.jsxs)(C.Select,{onValueChange:e=>{ea("TOKEN"===e),es("DEVICES"===e||"TOKEN"===e?"":e)},value:el?"TOKEN":et||"DEVICES",children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"DEVICES",children:e("directDevices")}),(0,t.jsx)(C.SelectItem,{value:"TOKEN",children:e("directToken")}),F.filter(e=>e.bundleId===v.topic.replace(/\.push-type\.liveactivity$/,"")).map(e=>(0,t.jsxs)(C.SelectItem,{value:e.id,children:[e.channelId," · ",e.storagePolicy]},e.id))]})]}),el&&(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_9rem_10rem]",children:[(0,t.jsx)(b.Input,{autoComplete:"off",onChange:e=>en(e.target.value),placeholder:e("liveActivityToken"),value:ei}),(0,t.jsxs)(C.Select,{onValueChange:eo,value:er,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"HEX",children:"HEX"}),(0,t.jsx)(C.SelectItem,{value:"BASE64",children:"Base64"})]})]}),(0,t.jsxs)(C.Select,{onValueChange:ed,value:ec,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,t.jsx)(C.SelectItem,{value:"PRODUCTION",children:"Production"})]})]})]}),!et&&!el&&(0,t.jsx)(K,{allEligible:Z,eligible:ek,onAllEligible:ee,onSelected:Y,selected:W}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,t.jsxs)(p.Button,{disabled:eT||!eL.value,onClick:()=>void eV("mutation Draft($editor: JSON!) { savePushNotificationDraft(editor: $editor) { id } }",{editor:eL.value},e("draftSaved")),variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",e("saveDraft")]}),(0,t.jsxs)(p.Button,{disabled:eT||!eL.value||(el?!ei.trim():!et&&!Z&&0===W.size),onClick:()=>void eO(),children:[eT?(0,t.jsx)(T.Spinner,{}):(0,t.jsx)(r.Send,{})," ",e("send")]})]})]})]})]})]}),(0,t.jsx)(J,{channels:F,load:ew}),(0,t.jsx)(f.Tabs,{onValueChange:em,value:ex,children:(0,t.jsxs)(g.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(g.CardHeader,{className:"border-b py-4 max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(g.CardTitle,{children:"history"===ex?e("history"):e("presets")}),(0,t.jsx)(g.CardDescription,{children:"history"===ex?e("historyDescription"):e("presetsDescription")}),(0,t.jsxs)(g.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,t.jsxs)(C.Select,{onValueChange:em,value:ex,children:[(0,t.jsx)(C.SelectTrigger,{className:"w-full sm:hidden",children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"history",children:e("history")}),(0,t.jsx)(C.SelectItem,{value:"presets",children:e("presets")})]})]}),(0,t.jsxs)(f.TabsList,{className:"hidden sm:inline-flex",children:[(0,t.jsxs)(f.TabsTrigger,{value:"history",children:[(0,t.jsx)(i.History,{})," ",e("history")]}),(0,t.jsxs)(f.TabsTrigger,{value:"presets",children:[(0,t.jsx)(n.Save,{})," ",e("presets")]})]})]})]}),(0,t.jsxs)(f.TabsContent,{value:"history",children:[(0,t.jsx)(M,{batches:G,expanded:eb,locale:a,onDelete:e=>eV("mutation Delete($id: ID!) { deletePushNotificationHistory(id: $id) }",{id:e}),onLoad:eB,onPreset:t=>{eg(`${e("presetFromHistory")} ${new Date(t.createdAt).toLocaleDateString(a)}`),eB(t.editor)},onResend:t=>eV("mutation Resend($id: ID!, $requestId: ID!) { resendPushNotification(id: $id, requestId: $requestId) { id } }",{id:t,requestId:(0,A.createClientId)()},e("queued")),setExpanded:eS}),G.length>0&&(0,t.jsx)("div",{className:"flex justify-end border-t p-3",children:(0,t.jsx)(h.ConfirmationDialog,{actionLabel:e("clearHistory"),cancelLabel:l("cancel"),description:e("clearHistoryDescription"),onConfirm:()=>eV("mutation { clearPushNotificationHistory }"),title:e("clearHistory"),trigger:(0,t.jsxs)(p.Button,{variant:"outline",children:[(0,t.jsx)(o.Trash2,{})," ",e("clearHistory")]})})})]}),(0,t.jsx)(f.TabsContent,{value:"presets",children:(0,t.jsx)(q,{expanded:ev,onDelete:e=>eV("mutation Delete($id: ID!) { deletePushNotificationPreset(id: $id) }",{id:e}),onLoad:eB,onSend:(t,s,l)=>eV("mutation SendPreset($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,A.createClientId)(),editor:t.editor,targetMode:s?"ALL":"DEVICES",registrationIds:l}},e("queued")),presets:X,registrations:y,setExpanded:ej})})]})}),ey&&(0,t.jsx)("div",{className:"fixed bottom-4 right-4 rounded-full bg-background p-3 shadow",children:(0,t.jsx)(T.Spinner,{})})]})},"editorStateFromSaved",0,B,"editorStateWithPushType",0,H])}]);
10
+ }`;function k(e){if(!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function V(e){let t=e.split(",").map(e=>e.trim()).filter(Boolean);return t.length?t:void 0}function O(e,t){let s;try{s=JSON.parse(e)}catch{throw Error(`${t} must be valid JSON`)}if(!s||"object"!=typeof s||Array.isArray(s))throw Error(`${t} must be a JSON object`);return s}function B(e){let t=e.headers??{},s=e.aps??{},l=s.alert??{},a=e.liveActivity??{},i=s.sound,n=i&&"object"==typeof i&&!Array.isArray(i)?i:null,r=e=>Array.isArray(e)?e.map(String).join(", "):"";return{...L,pushType:e.pushType??"alert",topic:String(t.topic??""),priority:String(t.priority??10),apnsId:String(t.id??""),expiration:String(t.expiration??""),collapseId:String(t.collapseId??""),title:String(l.title??""),subtitle:String(l.subtitle??""),body:String(l.body??""),titleLocKey:String(l["title-loc-key"]??""),titleLocArgs:r(l["title-loc-args"]),subtitleLocKey:String(l["subtitle-loc-key"]??""),subtitleLocArgs:r(l["subtitle-loc-args"]),locKey:String(l["loc-key"]??""),locArgs:r(l["loc-args"]),launchImage:String(l["launch-image"]??""),summaryArg:String(l["summary-arg"]??""),summaryArgCount:void 0===l["summary-arg-count"]?"":String(l["summary-arg-count"]),badge:void 0===s.badge?"":String(s.badge),soundName:"string"==typeof i?i:String(n?.name??""),criticalSound:n?.critical===1,soundVolume:n?.volume===void 0?"1":String(n.volume),category:String(s.category??""),threadId:String(s["thread-id"]??""),contentAvailable:1===s["content-available"],mutableContent:1===s["mutable-content"],targetContentId:String(s["target-content-id"]??""),interruptionLevel:String(s["interruption-level"]??"active"),relevanceScore:void 0===s["relevance-score"]?"":String(s["relevance-score"]),customJson:JSON.stringify(e.custom??{},null,2),liveTimestamp:String(a.timestamp??Math.floor(Date.now()/1e3)),liveEvent:a.event??"update",liveContentState:JSON.stringify(a["content-state"]??{},null,2),liveAttributesType:String(a["attributes-type"]??""),liveAttributes:JSON.stringify(a.attributes??{},null,2),liveStaleDate:void 0===a["stale-date"]?"":String(a["stale-date"]),liveDismissalDate:void 0===a["dismissal-date"]?"":String(a["dismissal-date"]),liveInputPushToken:1===a["input-push-token"],credentialId:String(e.credentialId??"")}}function H(e,t){return{...e,pushType:t,..."background"===t?{priority:"5"}:{},..."mdm"===t?{}:{credentialId:""}}}function $({label:e,children:s,className:l}){return(0,t.jsxs)("div",{className:(0,w.cn)("space-y-2",l),children:[(0,t.jsx)(S.Label,{children:e}),s]})}function R({label:e,checked:s,onChange:l}){return(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(v.Checkbox,{checked:s,onCheckedChange:e=>l(!!e)}),e]})}function K({eligible:e,selected:s,allEligible:l,onSelected:i,onAllEligible:n}){let r=(0,d.useTranslations)("pushNotifications");return(0,t.jsxs)(y.Popover,{children:[(0,t.jsx)(y.PopoverTrigger,{asChild:!0,children:(0,t.jsxs)(p.Button,{className:"w-full justify-between",variant:"outline",children:[l?r("allEligibleDevices",{count:e.length}):r("selectedDevices",{count:s.size}),(0,t.jsx)(a.ChevronDown,{})]})}),(0,t.jsx)(y.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0",children:(0,t.jsxs)(j.Command,{children:[(0,t.jsx)(j.CommandInput,{placeholder:r("searchDevices")}),(0,t.jsxs)(j.CommandList,{children:[(0,t.jsx)(j.CommandEmpty,{children:r("noEligibleDevices")}),(0,t.jsxs)(j.CommandGroup,{children:[(0,t.jsx)(j.CommandItem,{"data-checked":l,onSelect:()=>{n(!l),l||i(new Set)},value:"all-eligible",children:r("allEligibleDevices",{count:e.length})}),e.map(e=>(0,t.jsxs)(j.CommandItem,{"data-checked":s.has(e.id),onSelect:()=>{n(!1);let t=new Set(s);t.has(e.id)?t.delete(e.id):t.add(e.id),i(t)},value:`${e.displayName} ${e.tokenMasked}`,children:[e.displayName,(0,t.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:e.environment})]},e.id))]})]})]})})]})}function J({channels:e,load:s}){let l=(0,d.useTranslations)("pushNotifications"),a=(0,d.useTranslations)("common"),[i,n]=(0,u.useState)(""),[r,c]=(0,u.useState)("SANDBOX"),[x,m]=(0,u.useState)("NO_STORAGE"),[v,j]=(0,u.useState)(!1),S=async()=>{j(!0);try{await (0,D.controlPlaneRequest)("mutation Create($input: CreateApnsBroadcastChannelInput!) { createApnsBroadcastChannel(input: $input) { id } }",{input:{bundleId:i,environment:r,storagePolicy:x}}),n(""),await s()}finally{j(!1)}};return(0,t.jsxs)(g.Card,{children:[(0,t.jsxs)(g.CardHeader,{children:[(0,t.jsx)(g.CardTitle,{children:l("broadcastChannels")}),(0,t.jsx)(g.CardDescription,{children:l("broadcastDescription")})]}),(0,t.jsxs)(g.CardContent,{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-4",children:[(0,t.jsx)(b.Input,{onChange:e=>n(e.target.value),placeholder:l("bundleId"),value:i}),(0,t.jsxs)(C.Select,{onValueChange:c,value:r,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,t.jsx)(C.SelectItem,{value:"PRODUCTION",children:"Production"})]})]}),(0,t.jsxs)(C.Select,{onValueChange:m,value:x,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"NO_STORAGE",children:l("noStorage")}),(0,t.jsx)(C.SelectItem,{value:"MOST_RECENT",children:l("mostRecent")})]})]}),(0,t.jsx)(p.Button,{disabled:v||!i,onClick:()=>void S(),children:l("createChannel")})]}),(0,t.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border p-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-mono text-xs",children:e.channelId}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.bundleId," · ",e.environment," ·"," ",e.storagePolicy]})]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:l("delete"),cancelLabel:a("cancel"),description:l("deleteChannelDescription"),onConfirm:async()=>{await (0,D.controlPlaneRequest)("mutation Delete($id: ID!) { deleteApnsBroadcastChannel(id: $id) }",{id:e.id}),await s()},title:l("deleteChannel"),trigger:(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",children:(0,t.jsx)(o.Trash2,{})})})]},e.id))})]})]})}function M({batches:e,expanded:s,setExpanded:l,onLoad:i,onResend:c,onPreset:x,onDelete:g,locale:v}){let j=(0,d.useTranslations)("pushNotifications"),b=(0,d.useTranslations)("common");return 0===e.length?(0,t.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:j("noHistory")}):(0,t.jsxs)(I.Table,{children:[(0,t.jsx)(I.TableHeader,{children:(0,t.jsxs)(I.TableRow,{children:[(0,t.jsx)(I.TableHead,{className:"w-12"}),(0,t.jsx)(I.TableHead,{children:j("created")}),(0,t.jsx)(I.TableHead,{children:j("pushType")}),(0,t.jsx)(I.TableHead,{children:j("deliveryMode")}),(0,t.jsx)(I.TableHead,{children:j("recipients")}),(0,t.jsx)(I.TableHead,{children:j("result")}),(0,t.jsx)(I.TableHead,{children:j("status")})]})}),(0,t.jsx)(I.TableBody,{children:e.map(e=>(0,t.jsxs)(u.Fragment,{children:[(0,t.jsxs)(I.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let t;return t=e.id,l(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},children:[(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(a.ChevronDown,{className:(0,w.cn)("transition-transform",s.has(e.id)&&"rotate-180")})}),(0,t.jsx)(I.TableCell,{children:new Date(e.createdAt).toLocaleString(v)}),(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"secondary",children:String(e.editor.pushType??"—")})}),(0,t.jsx)(I.TableCell,{children:e.targetMode}),(0,t.jsx)(I.TableCell,{children:e.recipientCount}),(0,t.jsxs)(I.TableCell,{children:[e.successCount," / ",e.failureCount]}),(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"FAILED"===e.status?"destructive":"outline",children:e.status})})]}),s.has(e.id)&&(0,t.jsx)(I.TableRow,{className:"hover:bg-transparent",children:(0,t.jsxs)(I.TableCell,{colSpan:7,className:"bg-muted/20 p-5",children:[(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(S.Label,{children:j("payload")}),(0,t.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.payload,null,2)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(S.Label,{children:j("headers")}),(0,t.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.headers,null,2)})]})]}),e.deliveries.length>0&&(0,t.jsx)("div",{className:"mt-4 grid gap-2 md:grid-cols-2",children:e.deliveries.map(e=>(0,t.jsxs)("div",{className:"rounded-lg border bg-background p-3",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{className:"font-mono text-xs",children:e.topic}),(0,t.jsx)(m.Badge,{variant:"SUCCEEDED"===e.status?"default":"destructive",children:e.status})]}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["HTTP ",e.responseCode??"—"," ·"," ",e.reason??"—"," · ",e.attempts," ",j("attempts")," · ",e.durationMs??"—"," ms"]}),e.apnsId&&(0,t.jsx)("p",{className:"font-mono text-xs",children:e.apnsId})]},e.id))}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[(0,t.jsx)(p.Button,{onClick:()=>i(e.editor),variant:"outline",children:j("load")}),(0,t.jsxs)(p.Button,{onClick:()=>x(e),variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",j("saveAsPreset")]}),"DRAFT"!==e.targetMode&&(0,t.jsxs)(p.Button,{onClick:()=>void c(e.id),children:[(0,t.jsx)(r.Send,{})," ",j("resend")]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:j("delete"),cancelLabel:b("cancel"),description:j("deleteHistoryDescription"),onConfirm:()=>g(e.id),title:j("deleteHistory"),trigger:(0,t.jsxs)(p.Button,{disabled:["QUEUED","SENDING"].includes(e.status),variant:"ghost",children:[(0,t.jsx)(o.Trash2,{})," ",j("delete")]})})]})]})})]},e.id))})]})}function q({presets:e,registrations:s,expanded:i,setExpanded:n,onLoad:r,onSend:c,onDelete:x}){let m=(0,d.useTranslations)("pushNotifications"),g=(0,d.useTranslations)("common");return 0===e.length?(0,t.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:m("noPresets")}):(0,t.jsxs)(I.Table,{children:[(0,t.jsx)(I.TableHeader,{children:(0,t.jsxs)(I.TableRow,{children:[(0,t.jsx)(I.TableHead,{className:"w-12"}),(0,t.jsx)(I.TableHead,{children:m("name")}),(0,t.jsx)(I.TableHead,{children:m("pushType")}),(0,t.jsx)(I.TableHead,{children:m("topic")}),(0,t.jsx)(I.TableHead,{children:m("updated")})]})}),(0,t.jsx)(I.TableBody,{children:e.map(e=>(0,t.jsxs)(u.Fragment,{children:[(0,t.jsxs)(I.TableRow,{className:"h-16 cursor-pointer",onClick:()=>{let t;return t=e.id,n(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},children:[(0,t.jsx)(I.TableCell,{children:(0,t.jsx)(a.ChevronDown,{className:(0,w.cn)("transition-transform",i.has(e.id)&&"rotate-180")})}),(0,t.jsx)(I.TableCell,{className:"font-medium",children:e.name}),(0,t.jsx)(I.TableCell,{children:String(e.editor.pushType??"—")}),(0,t.jsx)(I.TableCell,{className:"font-mono text-xs",children:String(e.editor.headers?.topic??"—")}),(0,t.jsx)(I.TableCell,{children:new Date(e.updatedAt).toLocaleString()})]}),i.has(e.id)&&(0,t.jsx)(I.TableRow,{children:(0,t.jsxs)(I.TableCell,{className:"bg-muted/20 p-5",colSpan:5,children:[(0,t.jsx)("pre",{className:"max-h-72 overflow-auto rounded-xl bg-background p-3 text-xs",children:JSON.stringify(e.editor,null,2)}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap items-end justify-end gap-2",children:[(0,t.jsx)(z,{onSend:(t,s)=>c(e,t,s),preset:e,registrations:s}),(0,t.jsxs)(p.Button,{onClick:()=>r(e.editor),children:[(0,t.jsx)(l.Check,{})," ",m("loadEdit")]}),(0,t.jsx)(h.ConfirmationDialog,{actionLabel:m("delete"),cancelLabel:g("cancel"),description:m("deletePresetDescription"),onConfirm:()=>x(e.id),title:m("deletePreset"),trigger:(0,t.jsxs)(p.Button,{variant:"ghost",children:[(0,t.jsx)(o.Trash2,{})," ",m("delete")]})})]})]})})]},e.id))})]})}function z({preset:e,registrations:s,onSend:l}){let a=(0,d.useTranslations)("pushNotifications"),[i,n]=(0,u.useState)(new Set),[o,c]=(0,u.useState)(!1),[h,x]=(0,u.useState)(!1),m=String((e.editor.headers??{}).topic??""),g=String(e.editor.pushType??""),v=s.filter(e=>"ACTIVE"===e.status&&e.topic===m&&e.supportedPushTypes.includes(g));return(0,t.jsxs)("div",{className:"grid min-w-72 flex-1 gap-2 sm:max-w-xl sm:grid-cols-[1fr_auto]",children:[(0,t.jsx)(K,{allEligible:o,eligible:v,onAllEligible:c,onSelected:n,selected:i}),(0,t.jsxs)(p.Button,{disabled:h||!o&&0===i.size,onClick:()=>void(async()=>{x(!0);try{await l(o,[...i]),c(!1),n(new Set)}finally{x(!1)}})(),children:[h?(0,t.jsx)(T.Spinner,{}):(0,t.jsx)(r.Send,{})," ",a("send")]})]})}e.s(["PushNotificationsPage",0,function(){let e=(0,d.useTranslations)("pushNotifications"),l=(0,d.useTranslations)("common"),a=(0,c.useLocale)(),[v,j]=(0,u.useState)(L),[y,I]=(0,u.useState)([]),[w,z]=(0,u.useState)([]),[F,U]=(0,u.useState)([]),[X,_]=(0,u.useState)([]),[G,Q]=(0,u.useState)([]),[W,Y]=(0,u.useState)(new Set),[Z,ee]=(0,u.useState)(!1),[et,es]=(0,u.useState)(""),[el,ea]=(0,u.useState)(!1),[ei,en]=(0,u.useState)(""),[er,eo]=(0,u.useState)("HEX"),[ec,ed]=(0,u.useState)("SANDBOX"),[eu,eh]=(0,u.useState)("content"),[ex,em]=(0,u.useState)("history"),[ep,eg]=(0,u.useState)(""),[ev,ej]=(0,u.useState)(new Set),[eb,eS]=(0,u.useState)(new Set),[ey,eC]=(0,u.useState)(!0),[eT,ef]=(0,u.useState)(!1),[eI,eN]=(0,u.useState)(null),[eA,eD]=(0,u.useState)(null),ew=(0,u.useCallback)(async()=>{try{let e=await (0,D.controlPlaneRequest)(P);I(e.apnsRegistrations),z(e.pushNotificationSettings.certificates),U(e.apnsBroadcastChannels),_(e.pushNotificationPresets),Q(e.pushNotificationHistory),eN(null)}catch(e){eN(e instanceof Error?e.message:String(e))}finally{eC(!1)}},[]);(0,u.useEffect)(()=>{let e=window.setTimeout(()=>void ew(),0),t=(0,D.controlPlaneSubscriptions)().subscribe({query:"subscription { pushNotificationsChanged }"},{next:()=>void ew(),error:()=>void 0,complete:()=>void 0});return()=>{window.clearTimeout(e),t()}},[ew]);let eE=(e,t)=>j(s=>({...s,[e]:t})),eL=(0,u.useMemo)(()=>{try{let t=Object.fromEntries(Object.entries({title:v.title||void 0,subtitle:v.subtitle||void 0,body:v.body||void 0,"title-loc-key":v.titleLocKey||void 0,"title-loc-args":V(v.titleLocArgs),"subtitle-loc-key":v.subtitleLocKey||void 0,"subtitle-loc-args":V(v.subtitleLocArgs),"loc-key":v.locKey||void 0,"loc-args":V(v.locArgs),"launch-image":v.launchImage||void 0,"summary-arg":v.summaryArg||void 0,"summary-arg-count":k(v.summaryArgCount)}).filter(([,e])=>void 0!==e)),s=Object.fromEntries(Object.entries({alert:Object.keys(t).length?t:void 0,badge:k(v.badge),sound:v.soundName?v.criticalSound?{critical:1,name:v.soundName,volume:Number(v.soundVolume)}:v.soundName:void 0,category:v.category||void 0,"thread-id":v.threadId||void 0,"content-available":v.contentAvailable?1:void 0,"mutable-content":v.mutableContent?1:void 0,"target-content-id":v.targetContentId||void 0,"interruption-level":v.interruptionLevel||void 0,"relevance-score":k(v.relevanceScore)}).filter(([,e])=>void 0!==e)),l=["background","mdm"].includes(v.pushType)?{}:s;return{value:{pushType:v.pushType,headers:{id:v.apnsId||void 0,topic:v.topic,priority:Number(v.priority),expiration:v.expiration||void 0,collapseId:v.collapseId||void 0,broadcastChannelId:et||void 0},aps:l,custom:O(v.customJson,e("customJson")),liveActivity:"liveactivity"===v.pushType?{timestamp:Number(v.liveTimestamp),event:v.liveEvent,"content-state":O(v.liveContentState,e("contentState")),"attributes-type":v.liveAttributesType||void 0,attributes:"start"===v.liveEvent?O(v.liveAttributes,e("attributes")):void 0,"stale-date":k(v.liveStaleDate),"dismissal-date":k(v.liveDismissalDate),"input-push-token":v.liveInputPushToken?1:void 0}:void 0,credentialId:v.credentialId||null},error:null}}catch(e){return{value:null,error:e instanceof Error?e.message:String(e)}}},[et,v,e]),eP=(0,u.useMemo)(()=>{if(!eL.value)return null;let e=eL.value,t="mdm"===e.pushType?{mdm:"<PushMagic>"}:{...e.custom,aps:"liveactivity"===e.pushType?{...e.aps,...e.liveActivity}:e.aps},s=JSON.stringify(t,null,2);return{payload:t,text:s,bytes:new TextEncoder().encode(JSON.stringify(t)).length}},[eL]),ek=y.filter(e=>"ACTIVE"===e.status&&e.topic===v.topic&&e.supportedPushTypes.includes(v.pushType)),eV=async(e,t,s)=>{ef(!0),eN(null),eD(null);try{await (0,D.controlPlaneRequest)(e,t),s&&eD(s),await ew()}catch(e){eN(e instanceof Error?e.message:String(e))}finally{ef(!1)}},eO=async()=>{eL.value?await eV("mutation SendPush($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,A.createClientId)(),editor:eL.value,targetMode:et?"BROADCAST":el?"DIRECT":Z?"ALL":"DEVICES",registrationIds:[...W],channelId:et||null,directToken:el?ei:null,directTokenEncoding:el?er:null,directEnvironment:el?ec:null}},e("queued")):eN(eL.error)},eB=e=>{Y(new Set),ee(!1),es(""),ea(!1),en(""),j(B(e))};return(0,t.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"flex items-center gap-2 text-2xl font-semibold tracking-tight",children:[(0,t.jsx)(s.BellRing,{})," ",e("title")]}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e("description")})]}),eI&&(0,t.jsx)(x.Alert,{variant:"destructive",children:(0,t.jsx)(x.AlertDescription,{children:eI})}),eA&&(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:eA})}),(0,t.jsxs)(g.Card,{children:[(0,t.jsxs)(g.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(g.CardTitle,{children:e("editor")}),(0,t.jsx)(g.CardDescription,{children:e("editorDescription")}),(0,t.jsx)(g.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,t.jsxs)("div",{className:"grid gap-2 sm:flex",children:[(0,t.jsx)(b.Input,{className:"w-full sm:w-48",onChange:e=>eg(e.target.value),placeholder:e("presetName"),value:ep}),(0,t.jsxs)(p.Button,{disabled:eT||!eL.value||!ep.trim(),onClick:()=>void eV("mutation SavePreset($name: String!, $editor: JSON!) { savePushNotificationPreset(name: $name, editor: $editor) { id } }",{name:ep,editor:eL.value},e("presetSaved")),size:"sm",variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",e("savePreset")]})]})})]}),(0,t.jsxs)(g.CardContent,{className:"space-y-5",children:[(0,t.jsxs)(f.Tabs,{onValueChange:eh,value:eu,children:[(0,t.jsxs)(C.Select,{onValueChange:eh,value:eu,children:[(0,t.jsx)(C.SelectTrigger,{className:"w-full sm:hidden",children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"content",children:e("content")}),(0,t.jsx)(C.SelectItem,{value:"headers",children:e("headers")}),(0,t.jsx)(C.SelectItem,{value:"advanced",children:e("advanced")}),(0,t.jsx)(C.SelectItem,{value:"specialized",children:e("specialized")})]})]}),(0,t.jsxs)(f.TabsList,{className:"hidden sm:inline-flex",children:[(0,t.jsx)(f.TabsTrigger,{value:"content",children:e("content")}),(0,t.jsx)(f.TabsTrigger,{value:"headers",children:e("headers")}),(0,t.jsx)(f.TabsTrigger,{value:"advanced",children:e("advanced")}),(0,t.jsx)(f.TabsTrigger,{value:"specialized",children:e("specialized")})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 space-y-4",value:"content",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("pushType"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>{j(t=>H(t,e)),"liveactivity"!==e&&(ea(!1),es(""))},value:v.pushType,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:E.map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("titleField"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("title",e.target.value),value:v.title})}),(0,t.jsx)($,{label:e("subtitle"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitle",e.target.value),value:v.subtitle})})]}),(0,t.jsx)($,{label:e("body"),children:(0,t.jsx)(N.Textarea,{onChange:e=>eE("body",e.target.value),rows:4,value:v.body})}),(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[(0,t.jsx)($,{label:e("badge"),children:(0,t.jsx)(b.Input,{inputMode:"numeric",onChange:e=>eE("badge",e.target.value),value:v.badge})}),(0,t.jsx)($,{label:e("sound"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("soundName",e.target.value),value:v.soundName})}),(0,t.jsx)($,{label:e("category"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("category",e.target.value),value:v.category})}),(0,t.jsx)($,{label:e("threadId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("threadId",e.target.value),value:v.threadId})})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-5",children:[(0,t.jsx)(R,{checked:v.contentAvailable,label:e("contentAvailable"),onChange:e=>eE("contentAvailable",e)}),(0,t.jsx)(R,{checked:v.mutableContent,label:e("mutableContent"),onChange:e=>eE("mutableContent",e)}),(0,t.jsx)(R,{checked:v.criticalSound,label:e("criticalSound"),onChange:e=>eE("criticalSound",e)})]}),v.criticalSound&&(0,t.jsx)($,{label:e("soundVolume"),children:(0,t.jsx)(b.Input,{className:"max-w-40",max:"1",min:"0",onChange:e=>eE("soundVolume",e.target.value),step:"0.1",type:"number",value:v.soundVolume})})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",value:"headers",children:[(0,t.jsx)($,{label:e("topic"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("topic",e.target.value),placeholder:"com.example.app",value:v.topic})}),(0,t.jsx)($,{label:e("priority"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("priority",e),value:v.priority,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["1","5","10"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("apnsId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("apnsId",e.target.value),value:v.apnsId})}),(0,t.jsx)($,{label:e("expiration"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("expiration",e.target.value),placeholder:"0 / Unix timestamp",value:v.expiration})}),(0,t.jsx)($,{label:e("collapseId"),children:(0,t.jsx)(b.Input,{maxLength:64,onChange:e=>eE("collapseId",e.target.value),value:v.collapseId})}),"mdm"===v.pushType&&(0,t.jsx)($,{label:e("certificateCredential"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("credentialId",e),value:v.credentialId,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{placeholder:e("selectCredential")})}),(0,t.jsx)(C.SelectContent,{children:w.map(e=>(0,t.jsxs)(C.SelectItem,{value:e.id,children:[e.name," · ",e.environment]},e.id))})]})})]}),(0,t.jsxs)(f.TabsContent,{className:"mt-4 space-y-4",value:"advanced",children:[(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("titleLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("titleLocKey",e.target.value),value:v.titleLocKey})}),(0,t.jsx)($,{label:e("titleLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("titleLocArgs",e.target.value),value:v.titleLocArgs})}),(0,t.jsx)($,{label:e("subtitleLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitleLocKey",e.target.value),value:v.subtitleLocKey})}),(0,t.jsx)($,{label:e("subtitleLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("subtitleLocArgs",e.target.value),value:v.subtitleLocArgs})}),(0,t.jsx)($,{label:e("bodyLocKey"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("locKey",e.target.value),value:v.locKey})}),(0,t.jsx)($,{label:e("bodyLocArgs"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("locArgs",e.target.value),value:v.locArgs})}),(0,t.jsx)($,{label:e("launchImage"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("launchImage",e.target.value),value:v.launchImage})}),(0,t.jsx)($,{label:e("summaryArg"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("summaryArg",e.target.value),value:v.summaryArg})}),(0,t.jsx)($,{label:e("summaryArgCount"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("summaryArgCount",e.target.value),value:v.summaryArgCount})}),(0,t.jsx)($,{label:e("targetContentId"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("targetContentId",e.target.value),value:v.targetContentId})}),(0,t.jsx)($,{label:e("interruptionLevel"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("interruptionLevel",e),value:v.interruptionLevel,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["passive","active","time-sensitive","critical"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("relevanceScore"),children:(0,t.jsx)(b.Input,{max:"1",min:"0",onChange:e=>eE("relevanceScore",e.target.value),step:"0.1",type:"number",value:v.relevanceScore})})]}),(0,t.jsx)($,{label:e("customJson"),children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",onChange:e=>eE("customJson",e.target.value),rows:7,value:v.customJson})})]}),(0,t.jsx)(f.TabsContent,{className:"mt-4 space-y-4",value:"specialized",children:"liveactivity"===v.pushType?(0,t.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[(0,t.jsx)($,{label:e("timestamp"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveTimestamp",e.target.value),value:v.liveTimestamp})}),(0,t.jsx)($,{label:e("event"),children:(0,t.jsxs)(C.Select,{onValueChange:e=>eE("liveEvent",e),value:v.liveEvent,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsx)(C.SelectContent,{children:["start","update","end"].map(e=>(0,t.jsx)(C.SelectItem,{value:e,children:e},e))})]})}),(0,t.jsx)($,{label:e("attributesType"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveAttributesType",e.target.value),value:v.liveAttributesType})}),(0,t.jsx)($,{label:e("contentState"),className:"sm:col-span-2",children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",onChange:e=>eE("liveContentState",e.target.value),rows:5,value:v.liveContentState})}),(0,t.jsx)($,{label:e("attributes"),children:(0,t.jsx)(N.Textarea,{className:"font-mono text-xs",disabled:"start"!==v.liveEvent,onChange:e=>eE("liveAttributes",e.target.value),rows:5,value:v.liveAttributes})}),(0,t.jsx)($,{label:e("staleDate"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveStaleDate",e.target.value),value:v.liveStaleDate})}),(0,t.jsx)($,{label:e("dismissalDate"),children:(0,t.jsx)(b.Input,{onChange:e=>eE("liveDismissalDate",e.target.value),value:v.liveDismissalDate})}),(0,t.jsx)(R,{checked:v.liveInputPushToken,label:e("inputPushToken"),onChange:e=>eE("liveInputPushToken",e)})]}):"mdm"===v.pushType?(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:e("mdmHelp")})}):(0,t.jsx)(x.Alert,{children:(0,t.jsx)(x.AlertDescription,{children:e("specializedHelp",{type:v.pushType})})})})]}),(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(S.Label,{children:e("payloadPreview")}),(0,t.jsxs)(m.Badge,{variant:eL.error||eP&&eP.bytes>("voip"===v.pushType?5120:4096)?"destructive":"secondary",children:[eP?.bytes??0," /"," ","voip"===v.pushType?5120:4096," bytes"]})]}),eL.error?(0,t.jsx)(x.Alert,{variant:"destructive",children:(0,t.jsx)(x.AlertDescription,{children:eL.error})}):(0,t.jsx)("pre",{className:"max-h-80 overflow-auto rounded-xl bg-muted p-4 text-xs",children:eP?.text})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(S.Label,{children:e("recipients")}),"liveactivity"===v.pushType&&(0,t.jsxs)(C.Select,{onValueChange:e=>{ea("TOKEN"===e),es("DEVICES"===e||"TOKEN"===e?"":e)},value:el?"TOKEN":et||"DEVICES",children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"DEVICES",children:e("directDevices")}),(0,t.jsx)(C.SelectItem,{value:"TOKEN",children:e("directToken")}),F.filter(e=>e.bundleId===v.topic.replace(/\.push-type\.liveactivity$/,"")).map(e=>(0,t.jsxs)(C.SelectItem,{value:e.id,children:[e.channelId," · ",e.storagePolicy]},e.id))]})]}),el&&(0,t.jsxs)("div",{className:"grid gap-3 sm:grid-cols-[1fr_9rem_10rem]",children:[(0,t.jsx)(b.Input,{autoComplete:"off",onChange:e=>en(e.target.value),placeholder:e("liveActivityToken"),value:ei}),(0,t.jsxs)(C.Select,{onValueChange:eo,value:er,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"HEX",children:"HEX"}),(0,t.jsx)(C.SelectItem,{value:"BASE64",children:"Base64"})]})]}),(0,t.jsxs)(C.Select,{onValueChange:ed,value:ec,children:[(0,t.jsx)(C.SelectTrigger,{children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"SANDBOX",children:"Sandbox"}),(0,t.jsx)(C.SelectItem,{value:"PRODUCTION",children:"Production"})]})]})]}),!et&&!el&&(0,t.jsx)(K,{allEligible:Z,eligible:ek,onAllEligible:ee,onSelected:Y,selected:W}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,t.jsxs)(p.Button,{disabled:eT||!eL.value,onClick:()=>void eV("mutation Draft($editor: JSON!) { savePushNotificationDraft(editor: $editor) { id } }",{editor:eL.value},e("draftSaved")),variant:"outline",children:[(0,t.jsx)(n.Save,{})," ",e("saveDraft")]}),(0,t.jsxs)(p.Button,{disabled:eT||!eL.value||(el?!ei.trim():!et&&!Z&&0===W.size),onClick:()=>void eO(),children:[eT?(0,t.jsx)(T.Spinner,{}):(0,t.jsx)(r.Send,{})," ",e("send")]})]})]})]})]})]}),(0,t.jsx)(J,{channels:F,load:ew}),(0,t.jsx)(f.Tabs,{onValueChange:em,value:ex,children:(0,t.jsxs)(g.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(g.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(g.CardTitle,{children:"history"===ex?e("history"):e("presets")}),(0,t.jsx)(g.CardDescription,{children:"history"===ex?e("historyDescription"):e("presetsDescription")}),(0,t.jsxs)(g.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,t.jsxs)(C.Select,{onValueChange:em,value:ex,children:[(0,t.jsx)(C.SelectTrigger,{className:"w-full sm:hidden",children:(0,t.jsx)(C.SelectValue,{})}),(0,t.jsxs)(C.SelectContent,{children:[(0,t.jsx)(C.SelectItem,{value:"history",children:e("history")}),(0,t.jsx)(C.SelectItem,{value:"presets",children:e("presets")})]})]}),(0,t.jsxs)(f.TabsList,{className:"hidden sm:inline-flex",children:[(0,t.jsxs)(f.TabsTrigger,{value:"history",children:[(0,t.jsx)(i.History,{})," ",e("history")]}),(0,t.jsxs)(f.TabsTrigger,{value:"presets",children:[(0,t.jsx)(n.Save,{})," ",e("presets")]})]})]})]}),(0,t.jsxs)(f.TabsContent,{value:"history",children:[(0,t.jsx)(M,{batches:G,expanded:eb,locale:a,onDelete:e=>eV("mutation Delete($id: ID!) { deletePushNotificationHistory(id: $id) }",{id:e}),onLoad:eB,onPreset:t=>{eg(`${e("presetFromHistory")} ${new Date(t.createdAt).toLocaleDateString(a)}`),eB(t.editor)},onResend:t=>eV("mutation Resend($id: ID!, $requestId: ID!) { resendPushNotification(id: $id, requestId: $requestId) { id } }",{id:t,requestId:(0,A.createClientId)()},e("queued")),setExpanded:eS}),G.length>0&&(0,t.jsx)("div",{className:"flex justify-end border-t p-3",children:(0,t.jsx)(h.ConfirmationDialog,{actionLabel:e("clearHistory"),cancelLabel:l("cancel"),description:e("clearHistoryDescription"),onConfirm:()=>eV("mutation { clearPushNotificationHistory }"),title:e("clearHistory"),trigger:(0,t.jsxs)(p.Button,{variant:"outline",children:[(0,t.jsx)(o.Trash2,{})," ",e("clearHistory")]})})})]}),(0,t.jsx)(f.TabsContent,{value:"presets",children:(0,t.jsx)(q,{expanded:ev,onDelete:e=>eV("mutation Delete($id: ID!) { deletePushNotificationPreset(id: $id) }",{id:e}),onLoad:eB,onSend:(t,s,l)=>eV("mutation SendPreset($input: SendPushNotificationInput!) { sendPushNotification(input: $input) { id } }",{input:{requestId:(0,A.createClientId)(),editor:t.editor,targetMode:s?"ALL":"DEVICES",registrationIds:l}},e("queued")),presets:X,registrations:y,setExpanded:ej})})]})}),ey&&(0,t.jsx)("div",{className:"fixed bottom-4 right-4 rounded-full bg-background p-3 shadow",children:(0,t.jsx)(T.Spinner,{})})]})},"editorStateFromSaved",0,B,"editorStateWithPushType",0,H])}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,573474,e=>{"use strict";let t=(0,e.i(456420).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],573474)},340953,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(30030);function n(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return r.useCallback(function(...e){return t=>{let r=!1,a=e.map(e=>{let a=n(e,t);return r||"function"!=typeof a||(r=!0),a});if(r)return()=>{for(let t=0;t<a.length;t++){let r=a[t];"function"==typeof r?r():n(e[t],null)}}}}(...e),e)}var i=e.i(326999);"u">typeof window&&window.document&&window.document.createElement;var s="AlertDialog",[o,d]=(0,a.createContextScope)(s,[i.createDialogScope]),c=(0,i.createDialogScope)(),u=e=>{let{__scopeAlertDialog:r,...a}=e,n=c(r);return(0,t.jsx)(i.Root,{...n,...a,modal:!0})};u.displayName=s;var f=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Trigger,{...l,...n,ref:r})});f.displayName="AlertDialogTrigger";var m=e=>{let{__scopeAlertDialog:r,...a}=e,n=c(r);return(0,t.jsx)(i.Portal,{...n,...a})};m.displayName="AlertDialogPortal";var p=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Overlay,{...l,...n,ref:r})});p.displayName="AlertDialogOverlay";var h="AlertDialogContent",[x,g]=o(h),y=r.forwardRef((e,a)=>{let{__scopeAlertDialog:n,children:s,...o}=e,d=c(n),u=l(a,r.useRef(null)),f=r.useRef(null);return(0,t.jsx)(x,{scope:n,cancelRef:f,children:(0,t.jsx)(i.Content,{role:"alertdialog",...d,...o,ref:u,onOpenAutoFocus:function(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),!1===r||!a||!a.defaultPrevented)return t?.(a)}}(o.onOpenAutoFocus,e=>{e.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:s})})});y.displayName=h;var v=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Title,{...l,...n,ref:r})});v.displayName="AlertDialogTitle";var j=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Description,{...l,...n,ref:r})});j.displayName="AlertDialogDescription";var w=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Close,{...l,...n,ref:r})});w.displayName="AlertDialogAction";var b="AlertDialogCancel",D=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,{cancelRef:s}=g(b,a),o=c(a),d=l(r,s);return(0,t.jsx)(i.Close,{...o,...n,ref:d})});D.displayName=b,e.s(["Action",0,w,"AlertDialog",0,u,"AlertDialogAction",0,w,"AlertDialogCancel",0,D,"AlertDialogContent",0,y,"AlertDialogDescription",0,j,"AlertDialogOverlay",0,p,"AlertDialogPortal",0,m,"AlertDialogTitle",0,v,"AlertDialogTrigger",0,f,"Cancel",0,D,"Content",0,y,"Description",0,j,"Overlay",0,p,"Portal",0,m,"Root",0,u,"Title",0,v,"Trigger",0,f,"createAlertDialogScope",0,d],691162);var C=e.i(691162),C=C,T=e.i(975157),S=e.i(519455);function k({...e}){return(0,t.jsx)(C.Root,{"data-slot":"alert-dialog",...e})}function E({...e}){return(0,t.jsx)(C.Trigger,{"data-slot":"alert-dialog-trigger",...e})}function N({...e}){return(0,t.jsx)(C.Portal,{"data-slot":"alert-dialog-portal",...e})}function A({className:e,...r}){return(0,t.jsx)(C.Overlay,{"data-slot":"alert-dialog-overlay",className:(0,T.cn)("fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...r})}function I({className:e,size:r="default",...a}){return(0,t.jsxs)(N,{children:[(0,t.jsx)(A,{}),(0,t.jsx)(C.Content,{"data-slot":"alert-dialog-content","data-size":r,className:(0,T.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a})]})}function R({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,T.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...r})}function $({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,T.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...r})}function M({className:e,...r}){return(0,t.jsx)(C.Title,{"data-slot":"alert-dialog-title",className:(0,T.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...r})}function H({className:e,...r}){return(0,t.jsx)(C.Description,{"data-slot":"alert-dialog-description",className:(0,T.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...r})}function B({className:e,variant:r="default",size:a="default",...n}){return(0,t.jsx)(S.Button,{variant:r,size:a,asChild:!0,children:(0,t.jsx)(C.Action,{"data-slot":"alert-dialog-action",className:(0,T.cn)(e),...n})})}function z({className:e,variant:r="outline",size:a="default",...n}){return(0,t.jsx)(S.Button,{variant:r,size:a,asChild:!0,children:(0,t.jsx)(C.Cancel,{"data-slot":"alert-dialog-cancel",className:(0,T.cn)(e),...n})})}e.s(["ConfirmationDialog",0,function({actionLabel:e,cancelLabel:r,description:a,onConfirm:n,onOpenChange:l,open:i,title:s,trigger:o}){return(0,t.jsxs)(k,{onOpenChange:l,open:i,children:[o&&(0,t.jsx)(E,{asChild:!0,children:o}),(0,t.jsxs)(I,{children:[(0,t.jsxs)(R,{children:[(0,t.jsx)(M,{children:s}),(0,t.jsx)(H,{children:a})]}),(0,t.jsxs)($,{children:[(0,t.jsx)(z,{children:r}),(0,t.jsx)(B,{onClick:()=>void n(),variant:"destructive",children:e})]})]})]})}],340953)},778434,e=>{"use strict";e.s(["AGENT_FIELDS",0,"id name hostname version osVersion architecture cpuModel memoryTotalBytes memoryFreeBytes diskTotalBytes diskFreeBytes capabilities baseRepoDirectory derivedDataLocationMode derivedDataPath buildsDirectory defaultBuildsDirectory effectiveBuildsDirectory connectionStatus ipAddress lastSeenAt disconnectedAt createdAt","JOB_FIELDS",0,"id agentId kind payload status error result timeoutSeconds createdAt startedAt finishedAt updatedAt","JOB_LOG_FIELDS",0,"id jobId sequence stream message createdAt"])},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},82612,e=>{"use strict";var t=e.i(843476),r=e.i(225913),a=e.i(975157);let n=(0,r.cva)("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});e.s(["Empty",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty",className:(0,a.cn)("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...r})},"EmptyDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-description",className:(0,a.cn)("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...r})},"EmptyHeader",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-header",className:(0,a.cn)("flex max-w-sm flex-col items-center gap-2",e),...r})},"EmptyMedia",0,function({className:e,variant:r="default",...l}){return(0,t.jsx)("div",{"data-slot":"empty-icon","data-variant":r,className:(0,a.cn)(n({variant:r,className:e})),...l})},"EmptyTitle",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-title",className:(0,a.cn)("font-heading text-sm font-medium tracking-tight",e),...r})}])},462777,e=>{"use strict";async function t(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();let r=document.execCommand("copy");if(t.remove(),!r)throw Error("Copy is not supported by this browser")}e.s(["copyText",0,t,"createClientId",0,function(){try{if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID()}catch{}if(globalThis.crypto?.getRandomValues)try{let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}])},986253,e=>{"use strict";let t=(0,e.i(456420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},842727,e=>{"use strict";var t=e.i(271645);function r(e,t,{checkForDefaultPrevented:a=!0}={}){return function(r){if(e?.(r),!1===a||!r||!r.defaultPrevented)return t?.(r)}}"u">typeof window&&window.document&&window.document.createElement;var a=e.i(75830);function n(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return t.useCallback(function(...e){return t=>{let r=!1,a=e.map(e=>{let a=n(e,t);return r||"function"!=typeof a||(r=!0),a});if(r)return()=>{for(let t=0;t<a.length;t++){let r=a[t];"function"==typeof r?r():n(e[t],null)}}}}(...e),e)}var i=e.i(30030),s=e.i(610772);e.i(174080);var o=Symbol.for("radix.slottable"),d=Symbol.for("react.lazy");function c(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===d&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var u=t[" use ".trim().toString()],f=e.i(843476),m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{var a;let n,i=(a=`Primitive.${r}`,(n=t.forwardRef((e,r)=>{var n;let i,s,{children:d,...f}=e,m=null,p=!1,h=[];c(d)&&"function"==typeof u&&(d=u(d._payload)),t.Children.forEach(d,e=>{var r;if(r=e,t.isValidElement(r)&&"function"==typeof r.type&&"__radixId"in r.type&&r.type.__radixId===o){p=!0;let r="child"in e.props?e.props.child:e.props.children;c(r)&&"function"==typeof u&&(r=u(r._payload)),m=((e,r)=>{if("child"in e.props){let r=e.props.child;return t.isValidElement(r)?t.cloneElement(r,void 0,e.props.children(r.props.children)):null}return t.isValidElement(r)?r:null})(e,r),h.push(m?.props?.children)}else h.push(e)}),m?m=t.cloneElement(m,void 0,h):!p&&1===t.Children.count(d)&&t.isValidElement(d)&&(m=d);let x=m?(n=m,(s=(i=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?n.ref:(s=(i=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?n.props.ref:n.props.ref||n.ref):void 0,g=l(r,x);if(!m){if(d||0===d){let e,t;throw Error(p?(e=a,`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`):(t=a,`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`))}return d}let y=function(e,t){let r={...t};for(let a in t){let n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?r[a]=(...e)=>{let t=l(...e);return n(...e),t}:n&&(r[a]=n):"style"===a?r[a]={...n,...l}:"className"===a&&(r[a]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}(f,m.props??{});return m.type!==t.Fragment&&(y.ref=r?g:x),t.cloneElement(m,y)})).displayName=`${a}.Slot`,n),s=t.forwardRef((e,t)=>{let{asChild:a,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,f.jsx)(a?i:r,{...n,ref:t})});return s.displayName=`Primitive.${r}`,{...e,[r]:s}},{}),p=e.i(30207),h=globalThis?.document?t.useLayoutEffect:()=>{};t[" useEffectEvent ".trim().toString()],t[" useInsertionEffect ".trim().toString()];var x=t[" useInsertionEffect ".trim().toString()]||h;Symbol("RADIX:SYNC_STATE");var g=e.i(586318),y=!1,v=t[" useSyncExternalStore ".trim().toString()];function j(){return()=>{}}var w="function"==typeof v?function(){return v(j,()=>!0,()=>!1)}:function(){let[e,r]=t.useState(y);return t.useEffect(()=>{y||(y=!0,r(!0))},[]),e},b="rovingFocusGroup.onEntryFocus",D={bubbles:!1,cancelable:!0},C="RovingFocusGroup",[T,S,k]=(0,a.createCollection)(C),[E,N]=(0,i.createContextScope)(C,[k]),[A,I]=E(C),R=t.forwardRef((e,t)=>(0,f.jsx)(T.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(T.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)($,{...e,ref:t})})}));R.displayName=C;var $=t.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:s=!1,dir:o,currentTabStopId:d,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:y=!1,...v}=e,j=t.useRef(null),w=l(a,j),T=(0,g.useDirection)(o),[k,E]=function({prop:e,defaultProp:r,onChange:a=()=>{},caller:n}){let[l,i,s]=function({defaultProp:e,onChange:r}){let[a,n]=t.useState(e),l=t.useRef(a),i=t.useRef(r);return x(()=>{i.current=r},[r]),t.useEffect(()=>{l.current!==a&&(i.current?.(a),l.current=a)},[a,l]),[a,n,i]}({defaultProp:r,onChange:a}),o=void 0!==e,d=o?e:l;{let r=t.useRef(void 0!==e);t.useEffect(()=>{let e=r.current;if(e!==o){let t=o?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=o},[o,n])}return[d,t.useCallback(t=>{if(o){let r="function"==typeof t?t(e):t;r!==e&&s.current?.(r)}else i(t)},[o,e,i,s])]}({prop:d,defaultProp:c??null,onChange:u,caller:C}),[N,I]=t.useState(!1),R=(0,p.useCallbackRef)(h),$=S(n),M=t.useRef(!1),[H,B]=t.useState(0);return t.useEffect(()=>{let e=j.current;if(e)return e.addEventListener(b,R),()=>e.removeEventListener(b,R)},[R]),(0,f.jsx)(A,{scope:n,orientation:i,dir:T,loop:s,currentTabStopId:k,onItemFocus:t.useCallback(e=>E(e),[E]),onItemShiftTab:t.useCallback(()=>I(!0),[]),onFocusableItemAdd:t.useCallback(()=>B(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>B(e=>e-1),[]),children:(0,f.jsx)(m.div,{tabIndex:N||0===H?-1:0,"data-orientation":i,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:r(e.onMouseDown,()=>{M.current=!0}),onFocus:r(e.onFocus,e=>{let t=!M.current;if(e.target===e.currentTarget&&t&&!N){let t=new CustomEvent(b,D);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=$().filter(e=>e.focusable);z([e.find(e=>e.active),e.find(e=>e.id===k),...e].filter(Boolean).map(e=>e.ref.current),y)}}M.current=!1}),onBlur:r(e.onBlur,()=>I(!1))})})}),M="RovingFocusGroupItem",H=t.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:n,focusable:l=!0,active:i=!1,tabStopId:o,children:d,...c}=e,u=(0,s.useId)(),p=o||u,x=I(M,n),g=x.currentTabStopId===p,y=S(n),{onFocusableItemAdd:v,onFocusableItemRemove:j,currentTabStopId:b}=x,D=w();return h(()=>{if(D&&l)return v(),()=>j()},[D,l,v,j]),t.useEffect(()=>{if(!D&&l)return v(),()=>j()},[D,l,v,j]),(0,f.jsx)(T.ItemSlot,{scope:n,id:p,focusable:l,active:i,children:(0,f.jsx)(m.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...c,ref:a,onMouseDown:r(e.onMouseDown,e=>{l?x.onItemFocus(p):e.preventDefault()}),onFocus:r(e.onFocus,()=>x.onItemFocus(p)),onKeyDown:r(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void x.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var a;let n=(a=e.key,"rtl"!==r?a:"ArrowLeft"===a?"ArrowRight":"ArrowRight"===a?"ArrowLeft":a);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return B[n]}(e,x.orientation,x.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){var r,a;"prev"===t&&n.reverse();let l=n.indexOf(e.currentTarget);n=x.loop?(r=n,a=l+1,r.map((e,t)=>r[(a+t)%r.length])):n.slice(l+1)}setTimeout(()=>z(n))}}),children:"function"==typeof d?d({isCurrentTabStop:g,hasTabStop:null!=b}):d})})});H.displayName=M;var B={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function z(e,t=!1){let r=document.activeElement;for(let a of e)if(a===r||(a.focus({preventScroll:t}),document.activeElement!==r))return}e.s(["Item",0,H,"Root",0,R,"createRovingFocusGroupScope",0,N],842727)},560972,e=>{"use strict";let t=(0,e.i(456420).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["default",0,t])},648119,e=>{"use strict";var t=e.i(560972);e.s(["MoreHorizontal",()=>t.default])},955862,e=>{"use strict";var t=e.i(843476);let r=(0,e.i(456420).default)("calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);var a=e.i(689664),n=e.i(648119),l=e.i(741120),i=e.i(573474),s=e.i(861745),o=e.i(948148),d=e.i(271645),c=e.i(778434),u=e.i(340953),f=e.i(929592),m=e.i(487486),p=e.i(519455),h=e.i(515288),x=e.i(59497),g=e.i(755146),y=e.i(82612),v=e.i(987968),j=e.i(784774),w=e.i(520133),b=e.i(462777),D=e.i(637611);let C=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,573474,e=>{"use strict";let t=(0,e.i(456420).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],573474)},340953,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(30030);function n(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return r.useCallback(function(...e){return t=>{let r=!1,a=e.map(e=>{let a=n(e,t);return r||"function"!=typeof a||(r=!0),a});if(r)return()=>{for(let t=0;t<a.length;t++){let r=a[t];"function"==typeof r?r():n(e[t],null)}}}}(...e),e)}var i=e.i(326999);"u">typeof window&&window.document&&window.document.createElement;var s="AlertDialog",[o,d]=(0,a.createContextScope)(s,[i.createDialogScope]),c=(0,i.createDialogScope)(),u=e=>{let{__scopeAlertDialog:r,...a}=e,n=c(r);return(0,t.jsx)(i.Root,{...n,...a,modal:!0})};u.displayName=s;var f=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Trigger,{...l,...n,ref:r})});f.displayName="AlertDialogTrigger";var m=e=>{let{__scopeAlertDialog:r,...a}=e,n=c(r);return(0,t.jsx)(i.Portal,{...n,...a})};m.displayName="AlertDialogPortal";var h=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Overlay,{...l,...n,ref:r})});h.displayName="AlertDialogOverlay";var p="AlertDialogContent",[x,g]=o(p),y=r.forwardRef((e,a)=>{let{__scopeAlertDialog:n,children:s,...o}=e,d=c(n),u=l(a,r.useRef(null)),f=r.useRef(null);return(0,t.jsx)(x,{scope:n,cancelRef:f,children:(0,t.jsx)(i.Content,{role:"alertdialog",...d,...o,ref:u,onOpenAutoFocus:function(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e?.(a),!1===r||!a||!a.defaultPrevented)return t?.(a)}}(o.onOpenAutoFocus,e=>{e.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:s})})});y.displayName=p;var v=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Title,{...l,...n,ref:r})});v.displayName="AlertDialogTitle";var j=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Description,{...l,...n,ref:r})});j.displayName="AlertDialogDescription";var w=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,l=c(a);return(0,t.jsx)(i.Close,{...l,...n,ref:r})});w.displayName="AlertDialogAction";var b="AlertDialogCancel",D=r.forwardRef((e,r)=>{let{__scopeAlertDialog:a,...n}=e,{cancelRef:s}=g(b,a),o=c(a),d=l(r,s);return(0,t.jsx)(i.Close,{...o,...n,ref:d})});D.displayName=b,e.s(["Action",0,w,"AlertDialog",0,u,"AlertDialogAction",0,w,"AlertDialogCancel",0,D,"AlertDialogContent",0,y,"AlertDialogDescription",0,j,"AlertDialogOverlay",0,h,"AlertDialogPortal",0,m,"AlertDialogTitle",0,v,"AlertDialogTrigger",0,f,"Cancel",0,D,"Content",0,y,"Description",0,j,"Overlay",0,h,"Portal",0,m,"Root",0,u,"Title",0,v,"Trigger",0,f,"createAlertDialogScope",0,d],691162);var C=e.i(691162),C=C,T=e.i(975157),S=e.i(519455);function k({...e}){return(0,t.jsx)(C.Root,{"data-slot":"alert-dialog",...e})}function E({...e}){return(0,t.jsx)(C.Trigger,{"data-slot":"alert-dialog-trigger",...e})}function N({...e}){return(0,t.jsx)(C.Portal,{"data-slot":"alert-dialog-portal",...e})}function A({className:e,...r}){return(0,t.jsx)(C.Overlay,{"data-slot":"alert-dialog-overlay",className:(0,T.cn)("fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...r})}function I({className:e,size:r="default",...a}){return(0,t.jsxs)(N,{children:[(0,t.jsx)(A,{}),(0,t.jsx)(C.Content,{"data-slot":"alert-dialog-content","data-size":r,className:(0,T.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a})]})}function R({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,T.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...r})}function $({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,T.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...r})}function M({className:e,...r}){return(0,t.jsx)(C.Title,{"data-slot":"alert-dialog-title",className:(0,T.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...r})}function H({className:e,...r}){return(0,t.jsx)(C.Description,{"data-slot":"alert-dialog-description",className:(0,T.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...r})}function B({className:e,variant:r="default",size:a="default",...n}){return(0,t.jsx)(S.Button,{variant:r,size:a,asChild:!0,children:(0,t.jsx)(C.Action,{"data-slot":"alert-dialog-action",className:(0,T.cn)(e),...n})})}function z({className:e,variant:r="outline",size:a="default",...n}){return(0,t.jsx)(S.Button,{variant:r,size:a,asChild:!0,children:(0,t.jsx)(C.Cancel,{"data-slot":"alert-dialog-cancel",className:(0,T.cn)(e),...n})})}e.s(["ConfirmationDialog",0,function({actionLabel:e,cancelLabel:r,description:a,onConfirm:n,onOpenChange:l,open:i,title:s,trigger:o}){return(0,t.jsxs)(k,{onOpenChange:l,open:i,children:[o&&(0,t.jsx)(E,{asChild:!0,children:o}),(0,t.jsxs)(I,{children:[(0,t.jsxs)(R,{children:[(0,t.jsx)(M,{children:s}),(0,t.jsx)(H,{children:a})]}),(0,t.jsxs)($,{children:[(0,t.jsx)(z,{children:r}),(0,t.jsx)(B,{onClick:()=>void n(),variant:"destructive",children:e})]})]})]})}],340953)},778434,e=>{"use strict";e.s(["AGENT_FIELDS",0,"id name hostname version osVersion architecture cpuModel memoryTotalBytes memoryFreeBytes diskTotalBytes diskFreeBytes capabilities baseRepoDirectory derivedDataLocationMode derivedDataPath buildsDirectory defaultBuildsDirectory effectiveBuildsDirectory connectionStatus ipAddress lastSeenAt disconnectedAt createdAt","JOB_FIELDS",0,"id agentId kind payload status error result timeoutSeconds createdAt startedAt finishedAt updatedAt","JOB_LOG_FIELDS",0,"id jobId sequence stream message createdAt"])},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},82612,e=>{"use strict";var t=e.i(843476),r=e.i(225913),a=e.i(975157);let n=(0,r.cva)("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});e.s(["Empty",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty",className:(0,a.cn)("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...r})},"EmptyDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-description",className:(0,a.cn)("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...r})},"EmptyHeader",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-header",className:(0,a.cn)("flex max-w-sm flex-col items-center gap-2",e),...r})},"EmptyMedia",0,function({className:e,variant:r="default",...l}){return(0,t.jsx)("div",{"data-slot":"empty-icon","data-variant":r,className:(0,a.cn)(n({variant:r,className:e})),...l})},"EmptyTitle",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-title",className:(0,a.cn)("font-heading text-sm font-medium tracking-tight",e),...r})}])},462777,e=>{"use strict";async function t(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();let r=document.execCommand("copy");if(t.remove(),!r)throw Error("Copy is not supported by this browser")}e.s(["copyText",0,t,"createClientId",0,function(){try{if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID()}catch{}if(globalThis.crypto?.getRandomValues)try{let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}])},986253,e=>{"use strict";let t=(0,e.i(456420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},842727,e=>{"use strict";var t=e.i(271645);function r(e,t,{checkForDefaultPrevented:a=!0}={}){return function(r){if(e?.(r),!1===a||!r||!r.defaultPrevented)return t?.(r)}}"u">typeof window&&window.document&&window.document.createElement;var a=e.i(75830);function n(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function l(...e){return t.useCallback(function(...e){return t=>{let r=!1,a=e.map(e=>{let a=n(e,t);return r||"function"!=typeof a||(r=!0),a});if(r)return()=>{for(let t=0;t<a.length;t++){let r=a[t];"function"==typeof r?r():n(e[t],null)}}}}(...e),e)}var i=e.i(30030),s=e.i(610772);e.i(174080);var o=Symbol.for("radix.slottable"),d=Symbol.for("react.lazy");function c(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===d&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var u=t[" use ".trim().toString()],f=e.i(843476),m=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,r)=>{var a;let n,i=(a=`Primitive.${r}`,(n=t.forwardRef((e,r)=>{var n;let i,s,{children:d,...f}=e,m=null,h=!1,p=[];c(d)&&"function"==typeof u&&(d=u(d._payload)),t.Children.forEach(d,e=>{var r;if(r=e,t.isValidElement(r)&&"function"==typeof r.type&&"__radixId"in r.type&&r.type.__radixId===o){h=!0;let r="child"in e.props?e.props.child:e.props.children;c(r)&&"function"==typeof u&&(r=u(r._payload)),m=((e,r)=>{if("child"in e.props){let r=e.props.child;return t.isValidElement(r)?t.cloneElement(r,void 0,e.props.children(r.props.children)):null}return t.isValidElement(r)?r:null})(e,r),p.push(m?.props?.children)}else p.push(e)}),m?m=t.cloneElement(m,void 0,p):!h&&1===t.Children.count(d)&&t.isValidElement(d)&&(m=d);let x=m?(n=m,(s=(i=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?n.ref:(s=(i=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?n.props.ref:n.props.ref||n.ref):void 0,g=l(r,x);if(!m){if(d||0===d){let e,t;throw Error(h?(e=a,`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`):(t=a,`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`))}return d}let y=function(e,t){let r={...t};for(let a in t){let n=e[a],l=t[a];/^on[A-Z]/.test(a)?n&&l?r[a]=(...e)=>{let t=l(...e);return n(...e),t}:n&&(r[a]=n):"style"===a?r[a]={...n,...l}:"className"===a&&(r[a]=[n,l].filter(Boolean).join(" "))}return{...e,...r}}(f,m.props??{});return m.type!==t.Fragment&&(y.ref=r?g:x),t.cloneElement(m,y)})).displayName=`${a}.Slot`,n),s=t.forwardRef((e,t)=>{let{asChild:a,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,f.jsx)(a?i:r,{...n,ref:t})});return s.displayName=`Primitive.${r}`,{...e,[r]:s}},{}),h=e.i(30207),p=globalThis?.document?t.useLayoutEffect:()=>{};t[" useEffectEvent ".trim().toString()],t[" useInsertionEffect ".trim().toString()];var x=t[" useInsertionEffect ".trim().toString()]||p;Symbol("RADIX:SYNC_STATE");var g=e.i(586318),y=!1,v=t[" useSyncExternalStore ".trim().toString()];function j(){return()=>{}}var w="function"==typeof v?function(){return v(j,()=>!0,()=>!1)}:function(){let[e,r]=t.useState(y);return t.useEffect(()=>{y||(y=!0,r(!0))},[]),e},b="rovingFocusGroup.onEntryFocus",D={bubbles:!1,cancelable:!0},C="RovingFocusGroup",[T,S,k]=(0,a.createCollection)(C),[E,N]=(0,i.createContextScope)(C,[k]),[A,I]=E(C),R=t.forwardRef((e,t)=>(0,f.jsx)(T.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)(T.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,f.jsx)($,{...e,ref:t})})}));R.displayName=C;var $=t.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:s=!1,dir:o,currentTabStopId:d,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=e,j=t.useRef(null),w=l(a,j),T=(0,g.useDirection)(o),[k,E]=function({prop:e,defaultProp:r,onChange:a=()=>{},caller:n}){let[l,i,s]=function({defaultProp:e,onChange:r}){let[a,n]=t.useState(e),l=t.useRef(a),i=t.useRef(r);return x(()=>{i.current=r},[r]),t.useEffect(()=>{l.current!==a&&(i.current?.(a),l.current=a)},[a,l]),[a,n,i]}({defaultProp:r,onChange:a}),o=void 0!==e,d=o?e:l;{let r=t.useRef(void 0!==e);t.useEffect(()=>{let e=r.current;if(e!==o){let t=o?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=o},[o,n])}return[d,t.useCallback(t=>{if(o){let r="function"==typeof t?t(e):t;r!==e&&s.current?.(r)}else i(t)},[o,e,i,s])]}({prop:d,defaultProp:c??null,onChange:u,caller:C}),[N,I]=t.useState(!1),R=(0,h.useCallbackRef)(p),$=S(n),M=t.useRef(!1),[H,B]=t.useState(0);return t.useEffect(()=>{let e=j.current;if(e)return e.addEventListener(b,R),()=>e.removeEventListener(b,R)},[R]),(0,f.jsx)(A,{scope:n,orientation:i,dir:T,loop:s,currentTabStopId:k,onItemFocus:t.useCallback(e=>E(e),[E]),onItemShiftTab:t.useCallback(()=>I(!0),[]),onFocusableItemAdd:t.useCallback(()=>B(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>B(e=>e-1),[]),children:(0,f.jsx)(m.div,{tabIndex:N||0===H?-1:0,"data-orientation":i,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:r(e.onMouseDown,()=>{M.current=!0}),onFocus:r(e.onFocus,e=>{let t=!M.current;if(e.target===e.currentTarget&&t&&!N){let t=new CustomEvent(b,D);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=$().filter(e=>e.focusable);z([e.find(e=>e.active),e.find(e=>e.id===k),...e].filter(Boolean).map(e=>e.ref.current),y)}}M.current=!1}),onBlur:r(e.onBlur,()=>I(!1))})})}),M="RovingFocusGroupItem",H=t.forwardRef((e,a)=>{let{__scopeRovingFocusGroup:n,focusable:l=!0,active:i=!1,tabStopId:o,children:d,...c}=e,u=(0,s.useId)(),h=o||u,x=I(M,n),g=x.currentTabStopId===h,y=S(n),{onFocusableItemAdd:v,onFocusableItemRemove:j,currentTabStopId:b}=x,D=w();return p(()=>{if(D&&l)return v(),()=>j()},[D,l,v,j]),t.useEffect(()=>{if(!D&&l)return v(),()=>j()},[D,l,v,j]),(0,f.jsx)(T.ItemSlot,{scope:n,id:h,focusable:l,active:i,children:(0,f.jsx)(m.span,{tabIndex:g?0:-1,"data-orientation":x.orientation,...c,ref:a,onMouseDown:r(e.onMouseDown,e=>{l?x.onItemFocus(h):e.preventDefault()}),onFocus:r(e.onFocus,()=>x.onItemFocus(h)),onKeyDown:r(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void x.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var a;let n=(a=e.key,"rtl"!==r?a:"ArrowLeft"===a?"ArrowRight":"ArrowRight"===a?"ArrowLeft":a);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return B[n]}(e,x.orientation,x.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=y().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)n.reverse();else if("prev"===t||"next"===t){var r,a;"prev"===t&&n.reverse();let l=n.indexOf(e.currentTarget);n=x.loop?(r=n,a=l+1,r.map((e,t)=>r[(a+t)%r.length])):n.slice(l+1)}setTimeout(()=>z(n))}}),children:"function"==typeof d?d({isCurrentTabStop:g,hasTabStop:null!=b}):d})})});H.displayName=M;var B={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function z(e,t=!1){let r=document.activeElement;for(let a of e)if(a===r||(a.focus({preventScroll:t}),document.activeElement!==r))return}e.s(["Item",0,H,"Root",0,R,"createRovingFocusGroupScope",0,N],842727)},560972,e=>{"use strict";let t=(0,e.i(456420).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["default",0,t])},648119,e=>{"use strict";var t=e.i(560972);e.s(["MoreHorizontal",()=>t.default])},955862,e=>{"use strict";var t=e.i(843476);let r=(0,e.i(456420).default)("calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);var a=e.i(689664),n=e.i(648119),l=e.i(741120),i=e.i(573474),s=e.i(861745),o=e.i(948148),d=e.i(271645),c=e.i(778434),u=e.i(340953),f=e.i(929592),m=e.i(487486),h=e.i(519455),p=e.i(515288),x=e.i(59497),g=e.i(755146),y=e.i(82612),v=e.i(987968),j=e.i(784774),w=e.i(520133),b=e.i(462777),D=e.i(637611);let C=`
2
2
  id status createdAt deadlineAt finishedAt
3
3
  progress {
4
4
  eligibleCount finishedCount successfulCount
@@ -8,7 +8,7 @@
8
8
  id name kind status workspacePath worktreeId worktreePath sizeBytes operation error
9
9
  agent { ${c.AGENT_FIELDS} }
10
10
  }
11
- `;function T(e,t){let r=["B","KiB","MiB","GiB","TiB"],a=Math.min(Math.floor(Math.log(Math.max(e,1))/Math.log(1024)),r.length-1);return`${new Intl.NumberFormat(t,{maximumFractionDigits:1}).format(e/1024**a)} ${r[a]}`}function S({entries:e,selected:r,activeOperation:a,locale:n,onSelectionChange:l,onDelete:s,onDeleteMany:d}){let c=(0,o.useTranslations)("buildData"),f=(0,o.useTranslations)("common"),m=e.filter(e=>r.has(e.id)),g=e.length>0&&m.length===e.length;return(0,t.jsxs)(h.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(h.CardHeader,{className:"border-b py-4 max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(h.CardTitle,{children:c("deviceSupportTitle")}),(0,t.jsx)(h.CardDescription,{children:c("deviceSupportDescription")}),m.length>0&&(0,t.jsx)(h.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,t.jsx)(u.ConfirmationDialog,{actionLabel:c("deleteSelected"),cancelLabel:f("cancel"),description:c("deleteDeviceSupportDescription",{count:m.length}),onConfirm:()=>d(m.map(e=>e.id)),title:c("deleteDeviceSupportTitle"),trigger:(0,t.jsxs)(p.Button,{disabled:a,size:"sm",variant:"outline",children:[(0,t.jsx)(i.Trash2,{})," ",c("deleteSelected")]})})})]}),0===e.length?(0,t.jsx)(y.Empty,{className:"py-8",children:(0,t.jsx)(y.EmptyHeader,{children:(0,t.jsx)(y.EmptyDescription,{children:c("noDeviceSupport")})})}):(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)(x.Checkbox,{"aria-label":c("selectAllDeviceSupport"),checked:!!g||!!m.length&&"indeterminate",onCheckedChange:t=>{for(let r of e)l(r.id,!0===t)}})}),(0,t.jsx)(j.TableHead,{children:c("deviceSupportVersion")}),(0,t.jsx)(j.TableHead,{children:c("size")}),(0,t.jsx)(j.TableHead,{children:c("agent")}),(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)("span",{className:"sr-only",children:c("actions")})})]})}),(0,t.jsx)(j.TableBody,{children:e.map(e=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(x.Checkbox,{"aria-label":c("selectEntry",{name:e.name}),checked:r.has(e.id),onCheckedChange:t=>l(e.id,!0===t)})}),(0,t.jsxs)(j.TableCell,{children:[(0,t.jsx)("span",{className:"font-mono text-xs",children:e.name}),"IDLE"!==e.operation&&(0,t.jsx)(v.Spinner,{className:"ml-2"}),e.error&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive",children:e.error})]}),(0,t.jsx)(j.TableCell,{className:"tabular-nums",children:null===e.sizeBytes?"—":T(e.sizeBytes,n)}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(w.Link,{href:`/agents/${e.agent.id}`,children:e.agent.name})}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(u.ConfirmationDialog,{actionLabel:c("delete"),cancelLabel:f("cancel"),description:c("deleteDeviceSupportDescription",{count:1}),onConfirm:()=>s(e.id),title:c("deleteDeviceSupportTitle"),trigger:(0,t.jsx)(p.Button,{"aria-label":c("entryActions",{name:e.name}),disabled:a,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(i.Trash2,{})})})})]},e.id))})]})]})}function k({collection:e}){let r=(0,o.useTranslations)("buildData"),a=e.progress.agents.filter(e=>"SUCCEEDED"!==e.status||e.warnings.length>0);return"COMPLETED"===e.status&&0===a.length?null:(0,t.jsx)(f.Alert,{children:(0,t.jsxs)(f.AlertDescription,{className:"space-y-1",children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:["COLLECTING"===e.status&&(0,t.jsx)(v.Spinner,{}),r("progress",{complete:e.progress.finishedCount,total:e.progress.eligibleCount})]}),a.map(e=>(0,t.jsxs)("p",{children:[e.agent.name,": ",r(`agentStatus.${e.status}`),e.error?` — ${e.error}`:"",e.warnings.length?` — ${e.warnings.join("; ")}`:""]},e.agent.id))]})})}e.s(["BuildDataPage",0,function(){let e=(0,o.useTranslations)("buildData"),c=(0,o.useTranslations)("common"),E=(0,s.useLocale)(),[N,A]=(0,d.useState)(b.createClientId),[I,R]=(0,d.useState)(null),[$,M]=(0,d.useState)(!0),[H,B]=(0,d.useState)(null),[z,P]=(0,d.useState)(new Set),[F,L]=(0,d.useState)(null),_=(0,d.useRef)(null),[O,q]=(0,d.useState)(!1),[U,V]=(0,d.useState)([]),[G,K]=(0,d.useState)(null),[W,Y]=(0,d.useState)(!0),[J,X]=(0,d.useState)(0),[Z,Q]=(0,d.useState)(null),ee=(0,d.useCallback)(e=>{R(e),M(!1),B(null)},[]);(0,d.useEffect)(()=>{let e=!1,t=(0,D.controlPlaneSubscriptions)().subscribe({query:`subscription DerivedDataCollectionChanged($id: ID!) {
11
+ `;function T(e,t){let r=["B","KiB","MiB","GiB","TiB"],a=Math.min(Math.floor(Math.log(Math.max(e,1))/Math.log(1024)),r.length-1);return`${new Intl.NumberFormat(t,{maximumFractionDigits:1}).format(e/1024**a)} ${r[a]}`}function S({entries:e,selected:r,activeOperation:a,locale:n,onSelectionChange:l,onDelete:s,onDeleteMany:d}){let c=(0,o.useTranslations)("buildData"),f=(0,o.useTranslations)("common"),m=e.filter(e=>r.has(e.id)),g=e.length>0&&m.length===e.length;return(0,t.jsxs)(p.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(p.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(p.CardTitle,{children:c("deviceSupportTitle")}),(0,t.jsx)(p.CardDescription,{children:c("deviceSupportDescription")}),m.length>0&&(0,t.jsx)(p.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,t.jsx)(u.ConfirmationDialog,{actionLabel:c("deleteSelected"),cancelLabel:f("cancel"),description:c("deleteDeviceSupportDescription",{count:m.length}),onConfirm:()=>d(m.map(e=>e.id)),title:c("deleteDeviceSupportTitle"),trigger:(0,t.jsxs)(h.Button,{disabled:a,size:"sm",variant:"outline",children:[(0,t.jsx)(i.Trash2,{})," ",c("deleteSelected")]})})})]}),0===e.length?(0,t.jsx)(y.Empty,{className:"py-8",children:(0,t.jsx)(y.EmptyHeader,{children:(0,t.jsx)(y.EmptyDescription,{children:c("noDeviceSupport")})})}):(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)(x.Checkbox,{"aria-label":c("selectAllDeviceSupport"),checked:!!g||!!m.length&&"indeterminate",onCheckedChange:t=>{for(let r of e)l(r.id,!0===t)}})}),(0,t.jsx)(j.TableHead,{children:c("deviceSupportVersion")}),(0,t.jsx)(j.TableHead,{children:c("size")}),(0,t.jsx)(j.TableHead,{children:c("agent")}),(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)("span",{className:"sr-only",children:c("actions")})})]})}),(0,t.jsx)(j.TableBody,{children:e.map(e=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(x.Checkbox,{"aria-label":c("selectEntry",{name:e.name}),checked:r.has(e.id),onCheckedChange:t=>l(e.id,!0===t)})}),(0,t.jsxs)(j.TableCell,{children:[(0,t.jsx)("span",{className:"font-mono text-xs",children:e.name}),"IDLE"!==e.operation&&(0,t.jsx)(v.Spinner,{className:"ml-2"}),e.error&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive",children:e.error})]}),(0,t.jsx)(j.TableCell,{className:"tabular-nums",children:null===e.sizeBytes?"—":T(e.sizeBytes,n)}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(w.Link,{href:`/agents/${e.agent.id}`,children:e.agent.name})}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(u.ConfirmationDialog,{actionLabel:c("delete"),cancelLabel:f("cancel"),description:c("deleteDeviceSupportDescription",{count:1}),onConfirm:()=>s(e.id),title:c("deleteDeviceSupportTitle"),trigger:(0,t.jsx)(h.Button,{"aria-label":c("entryActions",{name:e.name}),disabled:a,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(i.Trash2,{})})})})]},e.id))})]})]})}function k({collection:e}){let r=(0,o.useTranslations)("buildData"),a=e.progress.agents.filter(e=>"SUCCEEDED"!==e.status||e.warnings.length>0);return"COMPLETED"===e.status&&0===a.length?null:(0,t.jsx)(f.Alert,{children:(0,t.jsxs)(f.AlertDescription,{className:"space-y-1",children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:["COLLECTING"===e.status&&(0,t.jsx)(v.Spinner,{}),r("progress",{complete:e.progress.finishedCount,total:e.progress.eligibleCount})]}),a.map(e=>(0,t.jsxs)("p",{children:[e.agent.name,": ",r(`agentStatus.${e.status}`),e.error?` — ${e.error}`:"",e.warnings.length?` — ${e.warnings.join("; ")}`:""]},e.agent.id))]})})}e.s(["BuildDataPage",0,function(){let e=(0,o.useTranslations)("buildData"),c=(0,o.useTranslations)("common"),E=(0,s.useLocale)(),[N,A]=(0,d.useState)(b.createClientId),[I,R]=(0,d.useState)(null),[$,M]=(0,d.useState)(!0),[H,B]=(0,d.useState)(null),[z,P]=(0,d.useState)(new Set),[F,L]=(0,d.useState)(null),_=(0,d.useRef)(null),[O,q]=(0,d.useState)(!1),[U,V]=(0,d.useState)([]),[G,K]=(0,d.useState)(null),[W,Y]=(0,d.useState)(!0),[J,X]=(0,d.useState)(0),[Z,Q]=(0,d.useState)(null),ee=(0,d.useCallback)(e=>{R(e),M(!1),B(null)},[]);(0,d.useEffect)(()=>{let e=!1,t=(0,D.controlPlaneSubscriptions)().subscribe({query:`subscription DerivedDataCollectionChanged($id: ID!) {
12
12
  derivedDataCollectionChanged(id: $id) { ${C} }
13
13
  }`,variables:{id:N}},{next:e=>{e.data?.derivedDataCollectionChanged&&ee(e.data.derivedDataCollectionChanged)},error:()=>void 0,complete:()=>void 0}),r=async()=>{try{let t=await (0,D.controlPlaneRequest)(`query DerivedDataCollection($id: ID!) {
14
14
  derivedDataCollection(id: $id) { ${C} }
@@ -23,4 +23,4 @@
23
23
  ${e}(collectionId: $collectionId, entryIds: $entryIds, requestId: $requestId) {
24
24
  ${C}
25
25
  }
26
- }`,{collectionId:I.id,entryIds:t,requestId:(0,b.createClientId)()});ee(r[e]),"deleteDerivedDataEntries"===e&&(P(new Set),L(null))}catch(e){B(e instanceof Error?e.message:String(e))}finally{q(!1)}}},ec=(0,d.useMemo)(()=>er.length,[er.length]);(0,d.useEffect)(()=>{let e=window.setTimeout(()=>{el||$||X(e=>e+1)},0);return()=>window.clearTimeout(e)},[el,$,ec]);let eu=(e,t)=>{if(F!==e){L(e),_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>L(null),5e3);return}_.current&&(window.clearTimeout(_.current),_.current=null),L(null),ed("deleteDerivedDataEntries",t)},ef=(0,d.useMemo)(()=>{let e=new Map,t=new Intl.DateTimeFormat(E,{dateStyle:"full"});for(let r of U){let a=new Date(r.deletedAt),n=`${a.getFullYear()}-${a.getMonth()}-${a.getDate()}`,l=e.get(n)??{label:t.format(a),items:[]};l.items.push(r),e.set(n,l)}return[...e.values()]},[U,E]),em=`bulk:${ei.map(e=>e.id).sort().join(":")}`,ep=F===em;return(0,t.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:e("title")}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(p.Button,{disabled:!er.length||$||el||O,onClick:()=>void ed("calculateDerivedDataSizes",er.map(e=>e.id)),variant:"outline",children:[(0,t.jsx)(r,{})," ",e("calculateSizes")]}),(0,t.jsxs)(p.Button,{disabled:$||el,onClick:()=>{M(!0),B(null),P(new Set),L(null),A((0,b.createClientId)())},variant:"outline",children:[(0,t.jsx)(l.RefreshCw,{className:$?"animate-spin":void 0}),e("refresh")]})]})]}),H&&(0,t.jsx)(f.Alert,{variant:"destructive",children:(0,t.jsx)(f.AlertDescription,{children:H})}),I&&(0,t.jsx)(k,{collection:I}),$&&!I?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(v.Spinner,{})," ",e("loading")]}):0===er.length?(0,t.jsx)(y.Empty,{children:(0,t.jsxs)(y.EmptyHeader,{children:[(0,t.jsx)(y.EmptyTitle,{children:e("emptyTitle")}),(0,t.jsx)(y.EmptyDescription,{children:e("emptyDescription")})]})}):(0,t.jsxs)(t.Fragment,{children:[ea.length>0&&(0,t.jsxs)(h.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(h.CardHeader,{className:"border-b py-4",children:[(0,t.jsx)(h.CardTitle,{children:e("derivedDataTitle")}),(0,t.jsx)(h.CardDescription,{children:e("derivedDataDescription")})]}),ei.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b p-3",children:[(0,t.jsx)("p",{className:"text-sm",children:e("selected",{count:ei.length})}),(0,t.jsxs)(p.Button,{className:"w-40",disabled:el||O,onClick:()=>eu(em,ei.map(e=>e.id)),size:"sm",variant:ep?"destructive":"outline",children:[ep?(0,t.jsx)(a.Check,{}):(0,t.jsx)(i.Trash2,{}),ep?e("confirmDelete"):e("deleteSelected")]})]}),(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)(x.Checkbox,{"aria-label":e("selectAll"),checked:!!es||!!eo&&"indeterminate",onCheckedChange:e=>{L(null),P(!0===e?new Set(er.map(e=>e.id)):new Set)}})}),(0,t.jsx)(j.TableHead,{children:e("folder")}),(0,t.jsx)(j.TableHead,{children:e("worktree")}),(0,t.jsx)(j.TableHead,{children:e("size")}),(0,t.jsx)(j.TableHead,{children:e("agent")}),(0,t.jsx)(j.TableHead,{className:"w-12 text-right",children:(0,t.jsx)("span",{className:"sr-only",children:e("actions")})})]})}),(0,t.jsx)(j.TableBody,{children:ea.map(r=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(x.Checkbox,{"aria-label":e("selectEntry",{name:r.name}),checked:z.has(r.id),onCheckedChange:e=>{L(null),P(t=>{let a=new Set(t);return!0===e?a.add(r.id):a.delete(r.id),a})}})}),(0,t.jsxs)(j.TableCell,{children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:r.name}),"READY"!==r.status&&(0,t.jsx)(m.Badge,{variant:"secondary",children:e(`status.${r.status}`)}),"IDLE"!==r.operation&&(0,t.jsx)(v.Spinner,{})]}),r.error&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive",children:r.error})]}),(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.worktreeId&&r.worktreePath?(0,t.jsx)(w.Link,{className:"underline-offset-4 hover:underline",href:`/worktrees/${r.worktreeId}`,children:r.worktreePath}):"—"}),(0,t.jsx)(j.TableCell,{className:"tabular-nums",children:null===r.sizeBytes?"—":T(r.sizeBytes,E)}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(w.Link,{className:"underline-offset-4 hover:underline",href:`/agents/${r.agent.id}`,children:r.agent.name})}),(0,t.jsx)(j.TableCell,{className:"w-12 text-right",children:(0,t.jsxs)(g.DropdownMenu,{onOpenChange:e=>{e||F!==`row:${r.id}`||(_.current&&(window.clearTimeout(_.current),_.current=null),L(null))},children:[(0,t.jsx)(g.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(p.Button,{"aria-label":e("entryActions",{name:r.name}),className:"ml-auto",disabled:el||O,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(n.MoreHorizontal,{})})}),(0,t.jsx)(g.DropdownMenuContent,{align:"end",className:"w-40",children:(0,t.jsxs)(g.DropdownMenuItem,{onSelect:e=>{F!==`row:${r.id}`&&e.preventDefault(),eu(`row:${r.id}`,[r.id])},variant:F===`row:${r.id}`?"destructive":"default",children:[F===`row:${r.id}`?(0,t.jsx)(a.Check,{}):(0,t.jsx)(i.Trash2,{}),F===`row:${r.id}`?e("confirmDelete"):e("delete")]})})]})})]},r.id))})]})]}),(0,t.jsx)(S,{activeOperation:el||O,entries:en,locale:E,onDelete:e=>void ed("deleteDerivedDataEntries",[e]),onDeleteMany:e=>void ed("deleteDerivedDataEntries",e),onSelectionChange:(e,t)=>{L(null),P(r=>{let a=new Set(r);return t?a.add(e):a.delete(e),a})},selected:z})]}),(0,t.jsxs)(h.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(h.CardHeader,{className:"border-b py-4 max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(h.CardTitle,{children:e("history")}),(0,t.jsx)(h.CardDescription,{children:e("historyDescription")}),U.length>0&&(0,t.jsx)(h.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,t.jsx)(u.ConfirmationDialog,{actionLabel:e("clearHistory"),cancelLabel:c("cancel"),description:e("clearHistoryDescription"),onConfirm:async()=>{await (0,D.controlPlaneRequest)("mutation { clearDerivedDataDeletionHistory }"),X(e=>e+1)},title:e("clearHistoryTitle"),trigger:(0,t.jsxs)(p.Button,{size:"sm",variant:"outline",children:[(0,t.jsx)(i.Trash2,{})," ",e("clearHistory")]})})})]}),W&&0===U.length?(0,t.jsxs)("p",{className:"flex items-center gap-2 p-6 text-sm text-muted-foreground",children:[(0,t.jsx)(v.Spinner,{})," ",e("loadingHistory")]}):0===U.length?(0,t.jsx)(y.Empty,{className:"py-8",children:(0,t.jsx)(y.EmptyHeader,{children:(0,t.jsx)(y.EmptyDescription,{children:e("noHistory")})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{children:e("folder")}),(0,t.jsx)(j.TableHead,{children:e("worktree")}),(0,t.jsx)(j.TableHead,{children:e("agent")}),(0,t.jsx)(j.TableHead,{children:e("deleted")}),(0,t.jsx)(j.TableHead,{children:e("sourceLabel")})]})}),(0,t.jsx)(j.TableBody,{children:ef.map(r=>(0,t.jsxs)(d.Fragment,{children:[(0,t.jsx)(j.TableRow,{className:"bg-muted/20 hover:bg-muted/20",children:(0,t.jsx)(j.TableCell,{className:"py-1.5 text-xs font-normal text-muted-foreground",colSpan:5,children:r.label})}),r.items.map(r=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.folderName}),(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.worktreePath??"—"}),(0,t.jsx)(j.TableCell,{children:r.agentName}),(0,t.jsx)(j.TableCell,{title:new Date(r.deletedAt).toLocaleString(E),children:function(e,t,r){let a=Math.round((Date.parse(e)-r)/1e3),n=new Intl.RelativeTimeFormat(t,{numeric:"auto"});for(let[e,t]of[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]])if(Math.abs(a)>=t)return n.format(Math.round(a/t),e);return n.format(a,"second")}(r.deletedAt,E,Z??Date.parse(r.deletedAt))}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"secondary",children:e(`source.${r.source}`)})})]},r.id))]},r.label))})]}),G&&(0,t.jsx)("div",{className:"border-t p-3 text-center",children:(0,t.jsxs)(p.Button,{disabled:W,onClick:()=>void et(G),variant:"outline",children:[W&&(0,t.jsx)(v.Spinner,{})," ",e("loadMore")]})})]})]})]})}],955862)}]);
26
+ }`,{collectionId:I.id,entryIds:t,requestId:(0,b.createClientId)()});ee(r[e]),"deleteDerivedDataEntries"===e&&(P(new Set),L(null))}catch(e){B(e instanceof Error?e.message:String(e))}finally{q(!1)}}},ec=(0,d.useMemo)(()=>er.length,[er.length]);(0,d.useEffect)(()=>{let e=window.setTimeout(()=>{el||$||X(e=>e+1)},0);return()=>window.clearTimeout(e)},[el,$,ec]);let eu=(e,t)=>{if(F!==e){L(e),_.current&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>L(null),5e3);return}_.current&&(window.clearTimeout(_.current),_.current=null),L(null),ed("deleteDerivedDataEntries",t)},ef=(0,d.useMemo)(()=>{let e=new Map,t=new Intl.DateTimeFormat(E,{dateStyle:"full"});for(let r of U){let a=new Date(r.deletedAt),n=`${a.getFullYear()}-${a.getMonth()}-${a.getDate()}`,l=e.get(n)??{label:t.format(a),items:[]};l.items.push(r),e.set(n,l)}return[...e.values()]},[U,E]),em=`bulk:${ei.map(e=>e.id).sort().join(":")}`,eh=F===em;return(0,t.jsxs)("section",{className:"mx-auto flex w-full max-w-[1500px] flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:e("title")}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:e("description")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(h.Button,{disabled:!er.length||$||el||O,onClick:()=>void ed("calculateDerivedDataSizes",er.map(e=>e.id)),variant:"outline",children:[(0,t.jsx)(r,{})," ",e("calculateSizes")]}),(0,t.jsxs)(h.Button,{disabled:$||el,onClick:()=>{M(!0),B(null),P(new Set),L(null),A((0,b.createClientId)())},variant:"outline",children:[(0,t.jsx)(l.RefreshCw,{className:$?"animate-spin":void 0}),e("refresh")]})]})]}),H&&(0,t.jsx)(f.Alert,{variant:"destructive",children:(0,t.jsx)(f.AlertDescription,{children:H})}),I&&(0,t.jsx)(k,{collection:I}),$&&!I?(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(v.Spinner,{})," ",e("loading")]}):0===er.length?(0,t.jsx)(y.Empty,{children:(0,t.jsxs)(y.EmptyHeader,{children:[(0,t.jsx)(y.EmptyTitle,{children:e("emptyTitle")}),(0,t.jsx)(y.EmptyDescription,{children:e("emptyDescription")})]})}):(0,t.jsxs)(t.Fragment,{children:[ea.length>0&&(0,t.jsxs)(p.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(p.CardHeader,{children:[(0,t.jsx)(p.CardTitle,{children:e("derivedDataTitle")}),(0,t.jsx)(p.CardDescription,{children:e("derivedDataDescription")})]}),ei.length>0&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 border-b p-3",children:[(0,t.jsx)("p",{className:"text-sm",children:e("selected",{count:ei.length})}),(0,t.jsxs)(h.Button,{className:"w-40",disabled:el||O,onClick:()=>eu(em,ei.map(e=>e.id)),size:"sm",variant:eh?"destructive":"outline",children:[eh?(0,t.jsx)(a.Check,{}):(0,t.jsx)(i.Trash2,{}),eh?e("confirmDelete"):e("deleteSelected")]})]}),(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{className:"w-12",children:(0,t.jsx)(x.Checkbox,{"aria-label":e("selectAll"),checked:!!es||!!eo&&"indeterminate",onCheckedChange:e=>{L(null),P(!0===e?new Set(er.map(e=>e.id)):new Set)}})}),(0,t.jsx)(j.TableHead,{children:e("folder")}),(0,t.jsx)(j.TableHead,{children:e("worktree")}),(0,t.jsx)(j.TableHead,{children:e("size")}),(0,t.jsx)(j.TableHead,{children:e("agent")}),(0,t.jsx)(j.TableHead,{className:"w-12 text-right",children:(0,t.jsx)("span",{className:"sr-only",children:e("actions")})})]})}),(0,t.jsx)(j.TableBody,{children:ea.map(r=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(x.Checkbox,{"aria-label":e("selectEntry",{name:r.name}),checked:z.has(r.id),onCheckedChange:e=>{L(null),P(t=>{let a=new Set(t);return!0===e?a.add(r.id):a.delete(r.id),a})}})}),(0,t.jsxs)(j.TableCell,{children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"break-all font-mono text-xs",children:r.name}),"READY"!==r.status&&(0,t.jsx)(m.Badge,{variant:"secondary",children:e(`status.${r.status}`)}),"IDLE"!==r.operation&&(0,t.jsx)(v.Spinner,{})]}),r.error&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive",children:r.error})]}),(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.worktreeId&&r.worktreePath?(0,t.jsx)(w.Link,{className:"underline-offset-4 hover:underline",href:`/worktrees/${r.worktreeId}`,children:r.worktreePath}):"—"}),(0,t.jsx)(j.TableCell,{className:"tabular-nums",children:null===r.sizeBytes?"—":T(r.sizeBytes,E)}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(w.Link,{className:"underline-offset-4 hover:underline",href:`/agents/${r.agent.id}`,children:r.agent.name})}),(0,t.jsx)(j.TableCell,{className:"w-12 text-right",children:(0,t.jsxs)(g.DropdownMenu,{onOpenChange:e=>{e||F!==`row:${r.id}`||(_.current&&(window.clearTimeout(_.current),_.current=null),L(null))},children:[(0,t.jsx)(g.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsx)(h.Button,{"aria-label":e("entryActions",{name:r.name}),className:"ml-auto",disabled:el||O,size:"icon-sm",variant:"ghost",children:(0,t.jsx)(n.MoreHorizontal,{})})}),(0,t.jsx)(g.DropdownMenuContent,{align:"end",className:"w-40",children:(0,t.jsxs)(g.DropdownMenuItem,{onSelect:e=>{F!==`row:${r.id}`&&e.preventDefault(),eu(`row:${r.id}`,[r.id])},variant:F===`row:${r.id}`?"destructive":"default",children:[F===`row:${r.id}`?(0,t.jsx)(a.Check,{}):(0,t.jsx)(i.Trash2,{}),F===`row:${r.id}`?e("confirmDelete"):e("delete")]})})]})})]},r.id))})]})]}),(0,t.jsx)(S,{activeOperation:el||O,entries:en,locale:E,onDelete:e=>void ed("deleteDerivedDataEntries",[e]),onDeleteMany:e=>void ed("deleteDerivedDataEntries",e),onSelectionChange:(e,t)=>{L(null),P(r=>{let a=new Set(r);return t?a.add(e):a.delete(e),a})},selected:z})]}),(0,t.jsxs)(p.Card,{className:"gap-0 py-0",children:[(0,t.jsxs)(p.CardHeader,{className:"max-sm:has-data-[slot=card-action]:grid-cols-1",children:[(0,t.jsx)(p.CardTitle,{children:e("history")}),(0,t.jsx)(p.CardDescription,{children:e("historyDescription")}),U.length>0&&(0,t.jsx)(p.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,t.jsx)(u.ConfirmationDialog,{actionLabel:e("clearHistory"),cancelLabel:c("cancel"),description:e("clearHistoryDescription"),onConfirm:async()=>{await (0,D.controlPlaneRequest)("mutation { clearDerivedDataDeletionHistory }"),X(e=>e+1)},title:e("clearHistoryTitle"),trigger:(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",children:[(0,t.jsx)(i.Trash2,{})," ",e("clearHistory")]})})})]}),W&&0===U.length?(0,t.jsxs)("p",{className:"flex items-center gap-2 p-6 text-sm text-muted-foreground",children:[(0,t.jsx)(v.Spinner,{})," ",e("loadingHistory")]}):0===U.length?(0,t.jsx)(y.Empty,{className:"py-8",children:(0,t.jsx)(y.EmptyHeader,{children:(0,t.jsx)(y.EmptyDescription,{children:e("noHistory")})})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(j.Table,{children:[(0,t.jsx)(j.TableHeader,{children:(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableHead,{children:e("folder")}),(0,t.jsx)(j.TableHead,{children:e("worktree")}),(0,t.jsx)(j.TableHead,{children:e("agent")}),(0,t.jsx)(j.TableHead,{children:e("deleted")}),(0,t.jsx)(j.TableHead,{children:e("sourceLabel")})]})}),(0,t.jsx)(j.TableBody,{children:ef.map(r=>(0,t.jsxs)(d.Fragment,{children:[(0,t.jsx)(j.TableRow,{className:"bg-muted/20 hover:bg-muted/20",children:(0,t.jsx)(j.TableCell,{className:"py-1.5 text-xs font-normal text-muted-foreground",colSpan:5,children:r.label})}),r.items.map(r=>(0,t.jsxs)(j.TableRow,{children:[(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.folderName}),(0,t.jsx)(j.TableCell,{className:"font-mono text-xs",children:r.worktreePath??"—"}),(0,t.jsx)(j.TableCell,{children:r.agentName}),(0,t.jsx)(j.TableCell,{title:new Date(r.deletedAt).toLocaleString(E),children:function(e,t,r){let a=Math.round((Date.parse(e)-r)/1e3),n=new Intl.RelativeTimeFormat(t,{numeric:"auto"});for(let[e,t]of[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]])if(Math.abs(a)>=t)return n.format(Math.round(a/t),e);return n.format(a,"second")}(r.deletedAt,E,Z??Date.parse(r.deletedAt))}),(0,t.jsx)(j.TableCell,{children:(0,t.jsx)(m.Badge,{variant:"secondary",children:e(`source.${r.source}`)})})]},r.id))]},r.label))})]}),G&&(0,t.jsx)("div",{className:"border-t p-3 text-center",children:(0,t.jsxs)(h.Button,{disabled:W,onClick:()=>void et(G),variant:"outline",children:[W&&(0,t.jsx)(v.Spinner,{})," ",e("loadMore")]})})]})]})]})}],955862)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,867927,e=>{"use strict";var t=e.i(986253);e.s(["ChevronRight",()=>t.default])},462777,e=>{"use strict";async function t(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.append(t),t.select();let r=document.execCommand("copy");if(t.remove(),!r)throw Error("Copy is not supported by this browser")}e.s(["copyText",0,t,"createClientId",0,function(){try{if(globalThis.crypto?.randomUUID)return globalThis.crypto.randomUUID()}catch{}if(globalThis.crypto?.getRandomValues)try{let e=globalThis.crypto.getRandomValues(new Uint8Array(16));return Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}])},986253,e=>{"use strict";let t=(0,e.i(456420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},929592,e=>{"use strict";var t=e.i(843476),r=e.i(225913),o=e.i(975157);let a=(0,r.cva)("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});e.s(["Alert",0,function({className:e,variant:r,...n}){return(0,t.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,o.cn)(a({variant:r}),e),...n})},"AlertDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"alert-description",className:(0,o.cn)("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...r})}])},515288,e=>{"use strict";var t=e.i(843476),r=e.i(975157);e.s(["Card",0,function({className:e,size:o="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":o,className:(0,r.cn)("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>[data-slot=card-header]]:pt-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...a})},"CardAction",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-action",className:(0,r.cn)("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...o})},"CardContent",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-(--card-spacing)",e),...o})},"CardDescription",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-sm text-muted-foreground",e),...o})},"CardFooter",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-footer",className:(0,r.cn)("flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)",e),...o})},"CardHeader",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl bg-muted/40 px-(--card-spacing) py-(--card-spacing) not-last:border-b has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",e),...o})},"CardTitle",0,function({className:e,...o}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...o})}])},758379,e=>{"use strict";let t=(0,e.i(456420).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["default",0,t])},987968,e=>{"use strict";var t=e.i(843476),r=e.i(975157),o=e.i(758379),o=o;e.s(["Spinner",0,function({className:e,...a}){return(0,t.jsx)(o.default,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,r.cn)("size-4 animate-spin",e),...a})}],987968)},637611,e=>{"use strict";var t,r,o=e.i(247167);function a(e){return null===e?"null":Array.isArray(e)?"array":typeof e}function n(e){return"object"===a(e)}function s(e,t){return e.length<124?e:t}var i=((t=i||{})[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests",t),c=((r=c||{}).ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete",r);function l(e){if(!n(e))throw Error(`Message is expected to be an object, but got ${a(e)}`);if(!e.type)throw Error("Message is missing the 'type' property");if("string"!=typeof e.type)throw Error(`Message is expects the 'type' property to be a string, but got ${a(e.type)}`);switch(e.type){case"connection_init":case"connection_ack":case"ping":case"pong":if(null!=e.payload&&!n(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break;case"subscribe":if("string"!=typeof e.id)throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${a(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!n(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${a(e.payload)}`);if("string"!=typeof e.payload.query)throw Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${a(e.payload.query)}`);if(null!=e.payload.variables&&!n(e.payload.variables))throw Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${a(e.payload.variables)}`);if(null!=e.payload.operationName&&"string"!==a(e.payload.operationName))throw Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${a(e.payload.operationName)}`);if(null!=e.payload.extensions&&!n(e.payload.extensions))throw Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${a(e.payload.extensions)}`);break;case"next":if("string"!=typeof e.id)throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${a(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!n(e.payload))throw Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${a(e.payload)}`);break;case"error":var t;if("string"!=typeof e.id)throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${a(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);if(!(Array.isArray(t=e.payload)&&t.length>0&&t.every(e=>"message"in e)))throw Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break;case"complete":if("string"!=typeof e.id)throw Error(`"${e.type}" message expects the 'id' property to be a string, but got ${a(e.id)}`);if(!e.id)throw Error(`"${e.type}" message requires a non-empty 'id' property`);break;default:throw Error(`Invalid message 'type' property "${e.type}"`)}return e}function d(e,t){return l(e),JSON.stringify(e,t)}class p extends Error{name="TerminatedCloseEvent";message="4499: Terminated";code=4499;reason="Terminated";wasClean=!1}function u(e){return n(e)&&"code"in e&&"reason"in e}async function y(e,t){let r=await fetch("/api/graphql",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({query:e,variables:t})}),o=await r.json();if(!r.ok||o.errors?.length||!o.data)throw Error(o.errors?.map(e=>e.message).join("; ")||`HTTP ${r.status}`);return o.data}let m=null;function f(){return function(e,t,r){let o=`${"https:"===t?"wss":"ws"}://${r}/graphql`;if(!e)return o;try{let r=new URL(e);if("https:"===t&&"wss:"!==r.protocol)return o}catch{}return e}(o.default.env.NEXT_PUBLIC_AGENT_WS_URL,window.location.protocol,window.location.host)}e.s(["controlPlaneRequest",0,y,"controlPlaneSubscriptions",0,function(){return m??=function(t){let r,o,a,n,{url:y,connectionParams:m,lazy:f=!0,onNonLazyError:g=console.error,lazyCloseTimeout:h=0,keepAlive:x=0,disablePong:b,connectionAckWaitTimeout:v=0,retryAttempts:w=5,retryWait:E=async function(e){let t=Math.pow(2,e);await new Promise(e=>setTimeout(e,1e3*t+Math.floor(2700*Math.random()+300)))},shouldRetry:N=u,on:C,webSocketImpl:S,generateID:T=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},jsonMessageReplacer:j,jsonMessageReviver:A}=t;if(S){var $;if(!("function"==typeof($=S)&&"constructor"in $&&"CLOSED"in $&&"CLOSING"in $&&"CONNECTING"in $&&"OPEN"in $))throw Error("Invalid WebSocket implementation provided");r=S}else r="u">typeof WebSocket?WebSocket:e.g.WebSocket||e.g.MozWebSocket;if(!r)throw Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let k=r,I=(o={},a={on:(e,t)=>(o[e]=t,()=>{delete o[e]}),emit(e){"id"in e&&o[e.id]?.(e)}},n={connecting:C?.connecting?[C.connecting]:[],opened:C?.opened?[C.opened]:[],connected:C?.connected?[C.connected]:[],ping:C?.ping?[C.ping]:[],pong:C?.pong?[C.pong]:[],message:C?.message?[a.emit,C.message]:[a.emit],closed:C?.closed?[C.closed]:[],error:C?.error?[C.error]:[]},{onMessage:a.on,on(e,t){let r=n[e];return r.push(t),()=>{r.splice(r.indexOf(t),1)}},emit(e,...t){for(let r of[...n[e]])r(...t)}});function R(e){let t=[I.on("error",r=>{t.forEach(e=>e()),e(r)}),I.on("closed",r=>{t.forEach(e=>e()),e(r)})]}let _,O=0,P,M=!1,q=0,B=!1;async function z(){clearTimeout(P);let[e,t]=await (_??(_=new Promise((e,t)=>(async()=>{let r,o;if(M){if(await E(q),!O)return _=void 0,t({code:1e3,reason:"All Subscriptions Gone"});q++}I.emit("connecting",M);let a=new k("function"==typeof y?await y():y,"graphql-transport-ws");function n(){isFinite(x)&&x>0&&(clearTimeout(o),o=setTimeout(()=>{a.readyState===k.OPEN&&(a.send(d({type:c.Ping})),I.emit("ping",!1,void 0))},x))}R(e=>{_=void 0,clearTimeout(r),clearTimeout(o),t(e),e instanceof p&&(a.close(4499,"Terminated"),a.onerror=null,a.onclose=null)}),a.onerror=e=>I.emit("error",e),a.onclose=e=>I.emit("closed",e),a.onopen=async()=>{try{I.emit("opened",a);let e="function"==typeof m?await m():m;if(a.readyState!==k.OPEN)return;a.send(d(e?{type:c.ConnectionInit,payload:e}:{type:c.ConnectionInit},j)),isFinite(v)&&v>0&&(r=setTimeout(()=>{a.close(i.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},v)),n()}catch(e){I.emit("error",e),a.close(i.InternalClientError,s(e instanceof Error?e.message:String(e),"Internal client error"))}};let u=!1;a.onmessage=({data:t})=>{try{let o=l("string"==typeof t?JSON.parse(t,A):t);if(I.emit("message",o),"ping"===o.type||"pong"===o.type){I.emit(o.type,!0,o.payload),"pong"===o.type?n():b||(a.send(d(o.payload?{type:c.Pong,payload:o.payload}:{type:c.Pong})),I.emit("pong",!1,o.payload));return}if(u)return;if(o.type!==c.ConnectionAck)throw Error(`First message cannot be of type ${o.type}`);clearTimeout(r),u=!0,I.emit("connected",a,o.payload,M),M=!1,q=0,e([a,new Promise((e,t)=>R(t))])}catch(e){a.onmessage=null,I.emit("error",e),a.close(i.BadResponse,s(e instanceof Error?e.message:String(e),"Bad response"))}}})())));e.readyState===k.CLOSING&&await t;let r=()=>{},o=new Promise(e=>r=e);return[e,r,Promise.race([o.then(()=>{O||(isFinite(h)&&h>0?P=setTimeout(()=>{e.readyState===k.OPEN&&e.close(1e3,"Normal Closure")},h):e.close(1e3,"Normal Closure"))}),t])]}function D(e){var t;if(u(e)&&(![1e3,1001,1006,1005,1012,1013,1014].includes(t=e.code)&&t>=1e3&&t<=1999||[i.InternalServerError,i.InternalClientError,i.BadRequest,i.BadResponse,i.Unauthorized,i.SubprotocolNotAcceptable,i.SubscriberAlreadyExists,i.TooManyInitialisationRequests].includes(e.code)))throw e;if(B)return!1;if(u(e)&&1e3===e.code)return O>0;if(!w||q>=w||!N(e))throw e;return M=!0}function L(e,t){let r=T(e),o=!1,a=!1,n=()=>{O--,o=!0};return(async()=>{for(O++;;)try{let[s,i,l]=await z();if(o)return i();let p=I.onMessage(r,e=>{switch(e.type){case c.Next:return void t.next(e.payload);case c.Error:a=!0,o=!0,t.error(e.payload),n();return;case c.Complete:o=!0,n();return}});s.send(d({id:r,type:c.Subscribe,payload:e},j)),n=()=>{o||s.readyState!==k.OPEN||s.send(d({id:r,type:c.Complete},j)),O--,o=!0,i()},await l.finally(p);return}catch(e){if(!D(e))return}})().then(()=>{a||t.complete()}).catch(e=>{t.error(e)}),()=>{o||n()}}return f||(async()=>{for(O++;;)try{let[,,e]=await z();await e}catch(e){try{if(!D(e))return}catch(e){return g?.(e)}}})(),{on:I.on,subscribe:L,iterate(e){let t=[],r={done:!1,error:null,resolve:()=>{}},o=L(e,{next(e){t.push(e),r.resolve()},error(e){r.done=!0,r.error=e,r.resolve()},complete(){r.done=!0,r.resolve()}}),a=async function*(){for(;;){for(t.length||await new Promise(e=>r.resolve=e);t.length;)yield t.shift();if(r.error)throw r.error;if(r.done)return}}();return a.throw=async e=>(r.done||(r.done=!0,r.error=e,r.resolve()),{done:!0,value:void 0}),a.return=async()=>(o(),{done:!0,value:void 0}),a},async dispose(){if(B=!0,_){let[e]=await _;e.close(1e3,"Normal Closure")}},terminate(){_&&I.emit("closed",new p)}}}({url:f,lazy:!0,retryAttempts:1/0,shouldRetry:()=>!0})}],637611)},784774,e=>{"use strict";var t=e.i(843476),r=e.i(975157);e.s(["Table",0,function({className:e,containerClassName:o,...a}){return(0,t.jsx)("div",{className:(0,r.cn)("w-full overflow-x-auto",o),children:(0,t.jsx)("table",{className:(0,r.cn)("w-full caption-bottom text-sm",e),...a})})},"TableBody",0,function({className:e,...o}){return(0,t.jsx)("tbody",{className:(0,r.cn)("divide-y",e),...o})},"TableCell",0,function({className:e,...o}){return(0,t.jsx)("td",{className:(0,r.cn)("whitespace-nowrap px-3 py-3 align-middle",e),...o})},"TableFooter",0,function({className:e,...o}){return(0,t.jsx)("tfoot",{className:(0,r.cn)("border-t bg-muted/50 font-medium",e),...o})},"TableHead",0,function({className:e,...o}){return(0,t.jsx)("th",{className:(0,r.cn)("h-10 whitespace-nowrap px-3 text-left align-middle text-xs font-medium text-muted-foreground",e),...o})},"TableHeader",0,function({className:e,...o}){return(0,t.jsx)("thead",{className:(0,r.cn)("border-b",e),...o})},"TableRow",0,function({className:e,...o}){return(0,t.jsx)("tr",{className:(0,r.cn)("transition-colors hover:bg-muted/40",e),...o})}])},26495,e=>{"use strict";let t=(0,e.i(456420).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",0,t])},716327,e=>{"use strict";var t=e.i(26495);e.s(["ChevronDown",()=>t.default])},741120,e=>{"use strict";let t=(0,e.i(456420).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],741120)},82612,e=>{"use strict";var t=e.i(843476),r=e.i(225913),o=e.i(975157);let a=(0,r.cva)("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});e.s(["Empty",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty",className:(0,o.cn)("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...r})},"EmptyDescription",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-description",className:(0,o.cn)("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...r})},"EmptyHeader",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-header",className:(0,o.cn)("flex max-w-sm flex-col items-center gap-2",e),...r})},"EmptyMedia",0,function({className:e,variant:r="default",...n}){return(0,t.jsx)("div",{"data-slot":"empty-icon","data-variant":r,className:(0,o.cn)(a({variant:r,className:e})),...n})},"EmptyTitle",0,function({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-title",className:(0,o.cn)("font-heading text-sm font-medium tracking-tight",e),...r})}])},778434,e=>{"use strict";e.s(["AGENT_FIELDS",0,"id name hostname version osVersion architecture cpuModel memoryTotalBytes memoryFreeBytes diskTotalBytes diskFreeBytes capabilities baseRepoDirectory derivedDataLocationMode derivedDataPath buildsDirectory defaultBuildsDirectory effectiveBuildsDirectory connectionStatus ipAddress lastSeenAt disconnectedAt createdAt","JOB_FIELDS",0,"id agentId kind payload status error result timeoutSeconds createdAt startedAt finishedAt updatedAt","JOB_LOG_FIELDS",0,"id jobId sequence stream message createdAt"])},990142,e=>{"use strict";RegExp("^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$"),e.s(["CCUSAGE_REPORT_JOB_KIND",0,"ccusage.report"])}]);