@hot-updater/console 1.2.0-rc.34 → 1.2.0-rc.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{IosInstall-DsKczesK.js → IosInstall-CyBFeLGv.js} +1 -1
  3. package/.output/public/assets/{RelativeTime-CP7nosYx.js → RelativeTime-BvgGWfXM.js} +1 -1
  4. package/.output/public/assets/{RowReason-D7TZ2xwW.js → RowReason-7dIWPxhy.js} +1 -1
  5. package/.output/public/assets/{TargetDisplay-DzSkf5yP.js → TargetDisplay-CiU6ZsDl.js} +1 -1
  6. package/.output/public/assets/{index-CccnEzaa.js → index-CQDGK7Fg.js} +1 -1
  7. package/.output/public/assets/{native-builds-CXDwW54k.js → native-builds-CkaoQZVh.js} +2 -2
  8. package/.output/public/assets/{native-builds-7sC78eTq.js → native-builds-CtqBGw8a.js} +1 -1
  9. package/.output/public/assets/native-builds-hOC_V15R.js +1 -0
  10. package/.output/public/assets/{native-builds_._buildId-C7-yUwvH.js → native-builds_._buildId-CAnF7xPa.js} +2 -2
  11. package/.output/public/assets/native-builds_._buildId-DSbzVVI5.js +1 -0
  12. package/.output/public/assets/{native-builds_.devices-CQ_tB3SO.js → native-builds_.devices-CCmLAkXG.js} +1 -1
  13. package/.output/public/assets/{native-builds_.devices-C_YZoRxB.js → native-builds_.devices-D-8DVNRB.js} +2 -2
  14. package/.output/public/assets/{routes-Dj_ukxU_.js → routes-BMbT1Qdm.js} +2 -2
  15. package/.output/public/assets/{routes-DvCD6Kib.js → routes-D8reVBSx.js} +1 -1
  16. package/.output/server/{__23tanstack-start-server-fn-resolver-CUEijItf.mjs → __23tanstack-start-server-fn-resolver-BkmGm73S.mjs} +58 -58
  17. package/.output/server/_libs/_.mjs +1 -1
  18. package/.output/server/_libs/lucide-react.mjs +13 -1
  19. package/.output/server/_ssr/{BundleIdDisplay-C2Yhau3H.mjs → BundleIdDisplay-B90reloJ.mjs} +2 -2
  20. package/.output/server/_ssr/{ChannelBadge-BTUSgvbr.mjs → ChannelBadge-Dbmjpe-k.mjs} +3 -3
  21. package/.output/server/_ssr/{ConsoleFeatureUnavailable-BDSJSs7U.mjs → ConsoleFeatureUnavailable-BX6uKVMH.mjs} +6 -6
  22. package/.output/server/_ssr/{EventDetails-wqpPsSDt.mjs → EventDetails-DiO0Njqj.mjs} +8 -8
  23. package/.output/server/_ssr/{HashValueDisplay-yosN9R32.mjs → HashValueDisplay-CicukMPP.mjs} +2 -2
  24. package/.output/server/_ssr/{InsightsPageHeader-DUvHESff.mjs → InsightsPageHeader-Bu88jQMD.mjs} +7 -7
  25. package/.output/server/_ssr/{IosInstall-DAZxDeBB.mjs → IosInstall-qOwrZE2v.mjs} +8 -8
  26. package/.output/server/_ssr/{NativeBuildsNav-JvQo5YkG.mjs → NativeBuildsNav-D20VrrNx.mjs} +3 -3
  27. package/.output/server/_ssr/{NotFoundPage-Z48ip8aB.mjs → NotFoundPage-_rXA1M7U.mjs} +2 -2
  28. package/.output/server/_ssr/{QrCode-NrGOfAPX.mjs → QrCode-DmEsrduv.mjs} +2 -2
  29. package/.output/server/_ssr/{RelativeTime-BiGH0j0S.mjs → RelativeTime-nw54zYAf.mjs} +4 -4
  30. package/.output/server/_ssr/{RolloutPercentageBadge-O0jbSRuI.mjs → RolloutPercentageBadge-DlRrxKdg.mjs} +3 -3
  31. package/.output/server/_ssr/{RowReason-DneEz--P.mjs → RowReason-D46cFeQO.mjs} +5 -5
  32. package/.output/server/_ssr/{SandboxBadge-ujAuQ6FN.mjs → SandboxBadge-DXM9RKlS.mjs} +2 -2
  33. package/.output/server/_ssr/{TargetDisplay-DFV5VpPn.mjs → TargetDisplay-CIU-9UqJ.mjs} +3 -3
  34. package/.output/server/_ssr/{alert-dialog-B2IG3q93.mjs → alert-dialog-CAb_7ZLL.mjs} +1 -1
  35. package/.output/server/_ssr/{api-keys-DpSj11mK.mjs → api-keys-CebW6Olm.mjs} +2 -2
  36. package/.output/server/_ssr/{api-keys-ZufcGzhb.mjs → api-keys-DY3XY8gz.mjs} +10 -10
  37. package/.output/server/_ssr/{api-keys-rpc-N3V7gkvv.mjs → api-keys-rpc-D0rQ5vvV.mjs} +3 -3
  38. package/.output/server/_ssr/{api-rpc-DXvqIbGs.mjs → api-rpc-OTsF60lZ.mjs} +16 -16
  39. package/.output/server/_ssr/{api-CHpFJ_c4.mjs → api-v-mDt0z9.mjs} +7 -6
  40. package/.output/server/_ssr/{auth-rpc-Cx72ajwL.mjs → auth-rpc-Cga9IGo3.mjs} +4 -4
  41. package/.output/server/_ssr/{auth.server-DT4SuI6u.mjs → auth.server-BVqW4FSJ.mjs} +25 -8
  42. package/.output/server/_ssr/{badge-DNrlMwwO.mjs → badge-Cy4z0pH1.mjs} +1 -1
  43. package/.output/server/_ssr/{bundleActivity-a-pEDiqu.mjs → bundleActivity-CjE9yslP.mjs} +1 -1
  44. package/.output/server/_ssr/{card-BSFwWT9T.mjs → card-UaEWfeRI.mjs} +1 -1
  45. package/.output/server/_ssr/{config.server-BEg-Ln3t.mjs → config.server-OJdvjs7r.mjs} +3 -3
  46. package/.output/server/_ssr/{console-access-CPYdc4mK.mjs → console-access-BM4TLI4g.mjs} +2 -2
  47. package/.output/server/_ssr/{console-features-api-D_KFX0JV.mjs → console-features-api-BmiP0aaD.mjs} +3 -3
  48. package/.output/server/_ssr/{console-features-rpc-CSogovr5.mjs → console-features-rpc-DPcZcHSW.mjs} +3 -3
  49. package/.output/server/_ssr/{deviceProfileToken-xzDLfE0T.mjs → deviceProfileToken-Eeltr-o0.mjs} +1 -1
  50. package/.output/server/_ssr/{dialog-BE-0BoPu.mjs → dialog-DWlZVg5y.mjs} +1 -1
  51. package/.output/server/_ssr/{downloadBundle-C1KOnpiF.mjs → downloadBundle-DLkb7A7E.mjs} +1 -1
  52. package/.output/server/_ssr/{empty-DVeNY_6z.mjs → empty-BPB71w6i.mjs} +2 -2
  53. package/.output/server/_ssr/{failureReports-BVufgM3l.mjs → failureReports-Bd7CaadE.mjs} +3 -3
  54. package/.output/server/_ssr/{field-C_NBjv_7.mjs → field-Bx8FKYuu.mjs} +2 -2
  55. package/.output/server/_ssr/{foldedPage-CUjJqtlF.mjs → foldedPage-DrxWt5XS.mjs} +1 -1
  56. package/.output/server/_ssr/{getBundleChildren-CnOf4Frp.mjs → getBundleChildren-DA9zbUBD.mjs} +1 -1
  57. package/.output/server/_ssr/{input-group-CGiryg7I.mjs → input-group-BzfbjZEj.mjs} +1 -1
  58. package/.output/server/_ssr/{insights-DNNsxJlD.mjs → insights-CBOTZToQ.mjs} +5 -5
  59. package/.output/server/_ssr/{insights-ECnoz9jp.mjs → insights-CFbpYpMy.mjs} +2 -2
  60. package/.output/server/_ssr/{insights-hDsGL-yq.mjs → insights-DaGJDccC.mjs} +25 -25
  61. package/.output/server/_ssr/{insights-api-DvbUK1vp.mjs → insights-api-b2wrxjFK.mjs} +5 -5
  62. package/.output/server/_ssr/{insights-errors-DwUaDs0Z.mjs → insights-errors-BrToSfI9.mjs} +2 -2
  63. package/.output/server/_ssr/{insights-failures-DGO2_3Vx.mjs → insights-failures-lmcxwKb3.mjs} +2 -2
  64. package/.output/server/_ssr/{insights-failures-rpc-DCu8iR4V.mjs → insights-failures-rpc-DLo_DEAi.mjs} +8 -8
  65. package/.output/server/_ssr/{insights-recovery-Cdg3Msrj.mjs → insights-recovery-Dhg3WGpC.mjs} +1 -1
  66. package/.output/server/_ssr/{insights-recovery-rpc-Bla1PuCq.mjs → insights-recovery-rpc-rpNu1Y8O.mjs} +5 -5
  67. package/.output/server/_ssr/{insights-rpc-ViJh0Q-s.mjs → insights-rpc-C2u-cHw2.mjs} +3 -3
  68. package/.output/server/_ssr/{insights-search-DfEqsfAa.mjs → insights-search-BBOEGM68.mjs} +2 -2
  69. package/.output/server/_ssr/{insights-usage-BVm7CDw9.mjs → insights-usage-gW3T5N6N.mjs} +1 -1
  70. package/.output/server/_ssr/{insights-usage-rpc-DWSPBftd.mjs → insights-usage-rpc-6VNQ-ZVG.mjs} +5 -5
  71. package/.output/server/_ssr/{insights-usage-rpc-CLsYlcnO.mjs → insights-usage-rpc-BOfXGKaq.mjs} +4 -4
  72. package/.output/server/_ssr/{insightsUsage-lPKyRC2o.mjs → insightsUsage-B_7pM9wp.mjs} +3 -3
  73. package/.output/server/_ssr/{insights_.distribution-CbZmys6X.mjs → insights_.distribution-DrY2XK92.mjs} +14 -14
  74. package/.output/server/_ssr/{insights_.distribution-6t26Hce4.mjs → insights_.distribution-a1c7v5MP.mjs} +2 -2
  75. package/.output/server/_ssr/{insights_.distribution-Bj054JTo.mjs → insights_.distribution-kX-VlU6s.mjs} +5 -5
  76. package/.output/server/_ssr/{installations-CL-nVRbZ.mjs → installations-B5-uJU9A.mjs} +4 -4
  77. package/.output/server/_ssr/{installations-BOzetKfl.mjs → installations-BG3Mf569.mjs} +2 -2
  78. package/.output/server/_ssr/{installations-ARFvJMie.mjs → installations-uML6v5Uo.mjs} +12 -12
  79. package/.output/server/_ssr/{ios-devices-rpc-Xln3pLFJ.mjs → ios-devices-rpc-DqTNHbdN.mjs} +8 -8
  80. package/.output/server/_ssr/{iosDeviceCookie-BG4X3Kbt.mjs → iosDeviceCookie-DNXjIPeF.mjs} +5 -5
  81. package/.output/server/_ssr/{iosDeviceProfile-C8NvflH9.mjs → iosDeviceProfile-Cl32eCmk.mjs} +6 -6
  82. package/.output/server/_ssr/{iosDevices-Ck5ko5IX.mjs → iosDevices-BQ0RaNWs.mjs} +3 -3
  83. package/.output/server/_ssr/{listReleases-QF91GLE7.mjs → listReleases-B2Q9xwFv.mjs} +3 -3
  84. package/.output/server/_ssr/{native-artifact-BRNP_q-y.mjs → native-artifact-BurROe05.mjs} +43 -2
  85. package/.output/server/_ssr/{native-builds-B70NqL0z.mjs → native-builds-BBOmHVsH.mjs} +16 -16
  86. package/.output/server/_ssr/{native-builds-nRuXKypG.mjs → native-builds-Bnx0fVWs.mjs} +10 -5
  87. package/.output/server/_ssr/{native-builds-6Kq2Pamq.mjs → native-builds-BuYIAi2p.mjs} +2 -2
  88. package/.output/server/_ssr/{native-builds_._buildId-B4uQUP7t.mjs → native-builds_._buildId-BUdWhQaH.mjs} +2 -2
  89. package/.output/server/_ssr/{native-builds_._buildId-zbXBoGs8.mjs → native-builds_._buildId-DZSLPTef.mjs} +58 -43
  90. package/.output/server/_ssr/{native-builds_.devices-DcgdiEiK.mjs → native-builds_.devices-QK5Z4ACD.mjs} +2 -2
  91. package/.output/server/_ssr/{native-builds_.devices-OLR3gTfc.mjs → native-builds_.devices-phkJgI1w.mjs} +17 -17
  92. package/.output/server/_ssr/{nativeBuildDownloadLink-DHsPiwsg.mjs → nativeBuildDownloadLink-BVtopV-4.mjs} +2 -2
  93. package/.output/server/_ssr/{nativeBuildInstall-DnpC3dUR.mjs → nativeBuildInstall-CVQLkYrX.mjs} +8 -8
  94. package/.output/server/_ssr/{nativeBuilds-DaF-TcfO.mjs → nativeBuilds-WKdqgemR.mjs} +7 -7
  95. package/.output/server/_ssr/{publicConsoleBase-wTKw3_iB.mjs → publicConsoleBase-C3sNbafy.mjs} +1 -1
  96. package/.output/server/_ssr/{release-adoption-gfhE5tz5.mjs → release-adoption-D2719HVh.mjs} +2 -2
  97. package/.output/server/_ssr/{release-adoption-rpc-C8oj79w3.mjs → release-adoption-rpc-DSlOL5v7.mjs} +7 -7
  98. package/.output/server/_ssr/{releaseAdoption-DfEYq7I4.mjs → releaseAdoption-CxGKmUXx.mjs} +4 -4
  99. package/.output/server/_ssr/{releaseReachability-Ch1JpJkY.mjs → releaseReachability-sWr0bLRk.mjs} +1 -1
  100. package/.output/server/_ssr/{remote-config-ClsnMl5Y.mjs → remote-config-9VJWDosm.mjs} +18 -18
  101. package/.output/server/_ssr/{remote-config-DOinV02U.mjs → remote-config-C4PKU5_z.mjs} +2 -2
  102. package/.output/server/_ssr/{remote-config-MEFtxtmM.mjs → remote-config-DPHJyAHV.mjs} +2 -2
  103. package/.output/server/_ssr/{remote-config-rpc-CCPIk5TC.mjs → remote-config-rpc-DxQ0jW52.mjs} +3 -3
  104. package/.output/server/_ssr/{router-jomm2ZkW.mjs → router-C1FV3SPc.mjs} +36 -36
  105. package/.output/server/_ssr/{routes-D0sAXxvj.mjs → routes-DDzrfaZr.mjs} +23 -23
  106. package/.output/server/_ssr/{routes-YuEmTB66.mjs → routes-Dg1cG9-d.mjs} +11 -11
  107. package/.output/server/_ssr/{schema-migration-rpc-CzOI4qIc.mjs → schema-migration-rpc-DdijfSjx.mjs} +3 -3
  108. package/.output/server/_ssr/{select-jxef2GHj.mjs → select-CQvxbdec.mjs} +2 -2
  109. package/.output/server/_ssr/{server-DowlVz8B.mjs → server-CGStUbwn.mjs} +3 -3
  110. package/.output/server/_ssr/{sidebar-DbK9IOE6.mjs → sidebar-zjbq02-o.mjs} +2 -2
  111. package/.output/server/_ssr/ssr.mjs +1 -1
  112. package/.output/server/_ssr/{switch-PuW4wKem.mjs → switch-_XoBaA1s.mjs} +2 -2
  113. package/.output/server/_ssr/{table-CTjtU7u0.mjs → table-FoAc6s3r.mjs} +1 -1
  114. package/.output/server/_ssr/{tabs-CYGM4B-P.mjs → tabs-BgUZHny1.mjs} +2 -2
  115. package/.output/server/_ssr/{updateFailures-BwDwIoNu.mjs → updateFailures-DGuFoK6A.mjs} +3 -3
  116. package/.output/server/{_tanstack-start-manifest_v-Dzfgn9EO.mjs → _tanstack-start-manifest_v-wLJ-tAN0.mjs} +22 -22
  117. package/.output/server/index.mjs +167 -167
  118. package/package.json +7 -7
  119. package/src/components/features/native-builds/BuiltInBundleCard.tsx +21 -5
  120. package/src/components/features/native-builds/InstallCard.tsx +32 -24
  121. package/src/components/features/native-builds/IosInstall.tsx +3 -2
  122. package/src/components/features/native-builds/PatchesCard.tsx +28 -20
  123. package/src/lib/api-rpc.ts +2 -1
  124. package/src/lib/native-builds.ts +10 -3
  125. package/src/lib/server/nativeBuildInstall.ts +3 -1
  126. package/src/lib/server/nativeBuilds.ts +15 -8
  127. package/.output/public/assets/native-builds-BOSmoLed.js +0 -1
  128. package/.output/public/assets/native-builds_._buildId-u5dG7ej5.js +0 -1
@@ -1 +1 @@
1
- import{$ as e,$n as t,Ar as n,Br as r,Cn as i,Di as a,Ei as o,F as s,Fr as c,H as l,I as u,Ir as d,L as f,Ln as p,M as m,Mr as h,Nn as g,On as _,P as v,Q as y,Qn as b,R as x,Ri as S,Sn as C,Tr as w,U as T,Un as ee,Vi as E,Vr as D,Xn as te,Zn as ne,_ as re,_r as ie,b as ae,bn as oe,dt as se,et as ce,ft as le,g as ue,gn as de,gr as O,h as k,jr as fe,kr as pe,p as me,v as A,vn as j,vr as M,w as he,wr as N,xn as P,xr as ge,y as F,yn as I}from"./sidebar-UnsNYOry.js";import{t as L}from"./link-D95E0fwF.js";import{t as R}from"./arrow-right-jHG0fJt7.js";import{t as _e}from"./arrow-up-right-BPRe5soE.js";import{a as ve,i as ye,n as z,r as be,s as xe,t as Se}from"./routes-Dj_ukxU_.js";import{t as Ce}from"./check-Dz_5aNwx.js";import{a as B,i as V,n as we,r as Te}from"./useCompositeListItem-B9ONn9qn.js";import{i as Ee,r as H}from"./TargetDisplay-DzSkf5yP.js";import{t as De}from"./chevron-right-CuYrscDY.js";import{A as Oe,D as ke,E as Ae,M as je,N as Me,T as Ne,a as Pe,d as Fe,f as Ie,h as Le,i as U,m as W,n as Re,o as ze,r as Be,t as G}from"./select-BAd2hAoW.js";import{t as Ve}from"./circle-off-BZFOMb8J.js";import{t as He}from"./download-ekENI2Sw.js";import{i as Ue,n as We,r as Ge,t as Ke}from"./RolloutPercentageBadge-DnmU8XbU.js";import{t as qe}from"./list-Dq40Mmoj.js";import{t as Je}from"./loader-circle-C26cZDSM.js";import{D as Ye,S as Xe,m as Ze,w as Qe}from"./native-builds-BOSmoLed.js";import{t as $e}from"./plus-Bp6IqwOH.js";import{a as et,i as tt,n as nt,o as rt,s as it,t as at}from"./input-group-DNfVeeYZ.js";import{n as ot,t as st}from"./switch-DNa3Cz9K.js";import{t as ct}from"./trash-2-BPH7ydek.js";import{a as lt,i as ut,n as dt,o as ft,t as K}from"./badge-D4Tiwei-.js";import{n as q}from"./dist-BEIz5ojx.js";import{o as pt}from"./insights-search-CtEcj6lz.js";import{a as mt,n as ht,o as gt,r as _t,t as vt}from"./card-BfeRlTvj.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,u as Dt}from"./uuidv7-DgXZ1zRR.js";import{a as Ot,c as kt,i as At,n as jt,r as Mt,t as Nt}from"./field-PkdRPD3A.js";import{C as Pt,S as Ft,_ as It,a as Lt,b as Rt,c as zt,i as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt,v as Kt,w as qt,x as Jt,y as Yt}from"./api-B1z_XXrQ.js";import{a as Xt,i as Zt,l as Qt,n as $t,o as en,r as tn,s as nn,t as rn}from"./alert-dialog-Dihztkem.js";import{n as an,t as on}from"./PlatformIcon-Kq3q98tU.js";import{a as sn,i as cn,n as ln,o as un,r as dn,s as fn,t as pn}from"./dialog-e9AF5T6h.js";import{a as mn,i as J,n as hn,o as gn,r as Y,t as _n}from"./table-r_sYqKTQ.js";import{t as vn}from"./BundleIdDisplay-D8oR8mcP.js";import{t as yn}from"./ChannelBadge-Do-lWsLM.js";import{a as bn,c as xn,d as Sn,f as Cn,i as wn,l as Tn,n as En,o as Dn,p as On,r as kn,s as An,t as jn,u as Mn}from"./RelativeTime-CP7nosYx.js";import{t as Nn}from"./HashValueDisplay-DKziWjEg.js";import{n as Pn,t as Fn}from"./valueToPercent-Bn8p2lng.js";import{a as In,c as Ln,i as Rn,l as zn,n as Bn,o as Vn,r as Hn,s as Un,t as Wn}from"./RowReason-D7TZ2xwW.js";var Gn=D(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Kn=D(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),qn=D(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Jn=D(`tags`,[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]),Yn=o();function Xn(){return N}function Zn(){return!1}function Qn(){return!0}function $n(){return(0,Yn.useSyncExternalStore)(Xn,Zn,Qn)}var X=E(S(),1),Z=a();function er({enabled:e,className:t,falseIcon:n=`x`,colorMode:i=`semantic`}){let a=i===`inherit`?`text-current`:void 0;return e?(0,Z.jsx)(Ce,{className:M(`h-4 w-4`,a??`text-green-600 dark:text-green-400`,t)}):n===`minus`?(0,Z.jsx)(Kn,{className:M(`h-4 w-4`,a??`text-muted-foreground`,t)}):(0,Z.jsx)(r,{className:M(`h-4 w-4`,a??`text-red-600 dark:text-red-400`,t)})}function tr({panelId:t,bundle:n,bundles:r,loading:i,onDetailClick:a}){let o=k();return(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-3 sm:p-4`,id:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Advanced artifact diagnostics`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-sm sm:items-center`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Base artifact ID`}),(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(K,{variant:`outline`,children:[r.length,` `,r.length===1?`patch`:`patches`]})]}),i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):r.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),o?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Target artifact ID`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Relation`}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-1 text-sm`,children:[(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(R,{className:`size-4 rotate-90 text-muted-foreground`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Artifact`}),(0,Z.jsx)(K,{variant:`secondary`,children:`bsdiff`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 text-right`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Created`}),(0,Z.jsx)(`div`,{className:`text-xs tabular-nums text-foreground`,children:(0,Z.jsx)(Ge,{uuid:e.id})})]})]}),(0,Z.jsx)(O,{className:`w-full`,onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})]})},e.id))}):(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-md border bg-background`,children:(0,Z.jsxs)(_n,{className:`min-w-max`,children:[(0,Z.jsx)(mn,{children:(0,Z.jsxs)(gn,{className:`hover:bg-transparent`,children:[(0,Z.jsx)(J,{children:`Target artifact ID`}),(0,Z.jsx)(J,{children:`Relation`}),(0,Z.jsx)(J,{children:`Artifact`}),(0,Z.jsx)(J,{children:`Created`}),(0,Z.jsx)(J,{className:`w-24 text-right`,children:`Detail`})]})}),(0,Z.jsx)(hn,{children:r.map(e=>(0,Z.jsxs)(gn,{children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`flex min-w-[280px] flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(R,{className:`size-4 shrink-0 rotate-90 text-muted-foreground sm:rotate-0`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(K,{variant:`secondary`,children:`bsdiff`})}),(0,Z.jsx)(Y,{className:`tabular-nums`,children:(0,Z.jsx)(Ge,{uuid:e.id})}),(0,Z.jsx)(Y,{className:`text-right`,children:(0,Z.jsx)(O,{onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})})]},e.id))})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`No direct patch artifacts.`})]})]})})}function nr({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(null),o=ot(i),{data:s=[],isPending:c}=Bt(),l=Ht(),u=Wt(),d=n.trim(),f=async e=>{if(e.preventDefault(),!(!d||l.isPending))try{let e=await l.mutateAsync({name:d});r(``),e.inserted?q.success(`Channel ${e.row.name} created`):q.info(`Channel ${e.row.name} already exists`)}catch(e){q.error(`Failed to create channel`),console.error(e)}},p=async()=>{if(!(!i||u.isPending))try{let e=await u.mutateAsync({id:i.id});e.deleted?q.success(`Channel ${i.name} deleted`):e.reason===`not_empty`?q.error(`Channel ${i.name} is still in use and cannot be deleted`):q.error(`Channel ${i.name} no longer exists`),a(null)}catch(e){q.error(`Failed to delete channel`),console.error(e)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pn,{open:e,onOpenChange:t,children:(0,Z.jsxs)(ln,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsxs)(un,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(qn,{className:`size-4 text-muted-foreground`}),`Channels`]}),(0,Z.jsx)(dn,{children:`Create deployment channels and remove them when no bundle uses them. Empty channels remain available until you delete them.`})]}),(0,Z.jsx)(`form`,{onSubmit:f,children:(0,Z.jsx)(At,{className:`gap-2`,children:(0,Z.jsxs)(Nt,{orientation:`horizontal`,children:[(0,Z.jsx)(Ot,{htmlFor:`channel-name`,className:`sr-only`,children:`Channel name`}),(0,Z.jsx)(y,{id:`channel-name`,value:n,onChange:e=>r(e.target.value),placeholder:`Channel name`,autoComplete:`off`,disabled:l.isPending}),(0,Z.jsxs)(O,{className:`max-md:h-11`,type:`submit`,disabled:!d||l.isPending,children:[l.isPending?(0,Z.jsx)(Je,{"data-icon":`inline-start`,className:`animate-spin motion-reduce:animate-none`}):(0,Z.jsx)($e,{"data-icon":`inline-start`}),`Create`]})]})})}),(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg border`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(Je,{className:`mr-2 size-3.5 animate-spin motion-reduce:animate-none`}),`Loading channels`]}):s.length===0?(0,Z.jsx)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:`No channels yet`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:s.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-12 items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,title:e.name,children:e.name}),(0,Z.jsx)(O,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,disabled:u.isPending,onClick:()=>a(e),className:`text-muted-foreground hover:text-destructive max-md:size-11`,children:(0,Z.jsx)(ct,{"data-icon":`inline-start`})})]},e.id))})})]})}),(0,Z.jsx)(rn,{open:i!==null,onOpenChange:e=>{!e&&!u.isPending&&a(null)},children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsxs)(Qt,{children:[`Delete `,o?.name,`?`]}),(0,Z.jsx)(Xt,{children:`Only empty channels can be removed. The server checks this when you delete it, and the channel can be created again later with a new ID.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{disabled:u.isPending,children:`Cancel`}),(0,Z.jsx)($t,{variant:`destructive`,disabled:u.isPending,onClick:e=>{e.preventDefault(),p()},children:u.isPending?`Deleting...`:`Delete channel`})]})]})})]})}var rr=`[a-zA-Z0-9-]`,ir=String.raw`0|[1-9]\d*`,ar=String.raw`\d+`,or=String.raw`\d*[a-zA-Z-]${rr}*`,sr=String.raw`(${ir})\.(${ir})\.(${ir})`,cr=String.raw`(${ar})\.(${ar})\.(${ar})`,lr=`(?:${or}|${ir})`,ur=`(?:${or}|${ar})`,dr=String.raw`(?:-(${lr}(?:\.${lr})*))`,fr=String.raw`(?:-?(${ur}(?:\.${ur})*))`,pr=`${rr}+`,mr=String.raw`(?:\+(${pr}(?:\.${pr})*))`,hr=`v?${sr}${dr}?${mr}?`,gr=String.raw`[v=\s]*${cr}${fr}?${mr}?`,_r=`((?:<|>)?=?)`,vr=String.raw`${ir}|x|X|\*`,yr=String.raw`${ar}|x|X|\*`,br=String.raw`[v=\s]*(${vr})(?:\.(${vr})(?:\.(${vr})(?:${dr})?${mr}?)?)?`,xr=String.raw`[v=\s]*(${yr})(?:\.(${yr})(?:\.(${yr})(?:${fr})?${mr}?)?)?`,Sr=`(?:~>?)`,Cr=String.raw`(?:\^)`,wr=String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;String.raw`${wr}(?:$|[^\d])`,String.raw`${wr}(?:${dr})?(?:${mr})?(?:$|[^\d])`;function Tr(e){let t=[[String.raw`\s`,1],[String.raw`\d`,256],[rr,250]];for(let[n,r]of t)e=e.split(`${n}*`).join(`${n}{0,${r}}`).split(`${n}+`).join(`${n}{1,${r}}`);return e}function Q(e,t){return new RegExp(Tr(e),t)}var Er=Q(`^${hr}$`),Dr=Q(`^${gr}$`),Or=/^\d+$/;function kr(e){let t=`${e.major}.${e.minor}.${e.patch}`;return e.prerelease?.length?`${t}-${e.prerelease.join(`.`)}`:t}function Ar(e,t={}){if(typeof e!=`string`)return e;if(e.length>256)throw TypeError(`Version exceeds the maximum length of 256 characters`);let n=e.trim().match(t.loose?Dr:Er);if(!n)throw TypeError(`Invalid version syntax: ${e}`);let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(r>2**53-1||r<0)throw TypeError(`Invalid major version: ${n[1]}`);if(i>2**53-1||i<0)throw TypeError(`Invalid minor version: ${n[2]}`);if(a>2**53-1||a<0)throw TypeError(`Invalid patch version: ${n[3]}`);let o=n[4]?n[4].split(`.`).map(e=>{if(Or.test(e)){let t=Number(e);if(t>=0&&t<2**53-1)return t}return e}):void 0;return{build:n[5]?.split(`.`),major:r,minor:i,patch:a,prerelease:o}}var jr=Q(String.raw`^${_r}\s*(${hr})$|^$`),Mr=Q(String.raw`^${_r}\s*(${gr})$|^$`);function Nr(e){return e.version?`${e.operator}${kr(e.version)}`:``}function Pr(e,t={}){if(typeof e!=`string`)return e;let n=e.trim().replaceAll(/\s+/g,` `),r=n.match(t.loose?Mr:jr);if(!r)throw TypeError(`Invalid comparator: ${n}`);let i=r[1]===`=`?``:r[1]||``,a=r[2]?Ar(r[2],t):null;return{operator:i,options:t,value:a?`${i}${kr(a)}`:``,version:a}}function Fr(e){return e.sets.map(e=>e.map(Nr).join(` `)).join(`||`)}var Ir=new RegExp(mr,`g`),Lr=Q(mr),Rr=Q(String.raw`^\s*(${br})\s+-\s+(${br})\s*$`),zr=Q(String.raw`^\s*(${xr})\s+-\s+(${xr})\s*$`),Br=Q(String.raw`(\s*)${_r}\s*(${gr}|${br})`,`g`),Vr=Q(String.raw`(\s*)${Sr}\s+`,`g`),Hr=Q(String.raw`(\s*)${Cr}\s+`,`g`),Ur=Q(`^${Sr}${br}$`),Wr=Q(`^${Sr}${xr}$`),Gr=Q(`^${Cr}${br}$`),Kr=Q(`^${Cr}${xr}$`),qr=Q(String.raw`^${_r}\s*${br}$`),Jr=Q(String.raw`^${_r}\s*${xr}$`),Yr=Q(String.raw`(<|>)?=?\s*\*`),Xr=/^\s*>=\s*0\.0\.0\s*$/,Zr=/^\s*>=\s*0\.0\.0-0\s*$/,Qr=Q(String.raw`^${_r}\s*(${gr})$|^$`);function $(e){return!e||String(e).toLowerCase()===`x`||String(e)===`*`}function $r(e,t,n){return $(e)&&!$(t)||$(t)&&!!n&&!$(n)}function ei(e,t){let n=t.loose?Wr:Ur,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:a?`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`)}function ti(e,t){return e.trim().split(/\s+/).map(e=>ei(e,t)).join(` `)}function ni(e,t){let n=t.loose?Kr:Gr,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0${r} <${Number(t)+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i}-${a} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${Number(t)+1}.0.0-0`)}function ri(e,t){return e.trim().split(/\s+/).map(e=>ni(e,t)).join(` `)}function ii(e,t){let n=t.loose?Jr:qr;return e.trim().replace(n,(n,r,i,a,o)=>{let s=r,c=i,l=a,u=o;if($r(String(c),l===void 0?void 0:String(l),u===void 0?void 0:String(u)))return e;let d=$(c),f=d||$(l),p=f||$(u);if(s===`=`&&p&&(s=``),d)return s===`>`||s===`<`?`<0.0.0-0`:`*`;let m=t.includePrerelease?`-0`:``;return s&&p?(f&&(l=0),u=0,s===`>`?(s=`>=`,f?(c=Number(c)+1,l=0):l=Number(l)+1):s===`<=`&&(s=`<`,f?c=Number(c)+1:l=Number(l)+1),s===`<`&&(m=`-0`),`${s}${c}.${l}.${u}${m}`):f?`>=${c}.0.0${m} <${Number(c)+1}.0.0-0`:p?`>=${c}.${l}.0${m} <${c}.${Number(l)+1}.0-0`:n})}function ai(e,t){return e.split(/\s+/).map(e=>ii(e,t)).join(` `)}function oi(e,t){let n=t.loose?zr:Rr;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>{let p=n,m=c;return p=$(r)?``:$(i)?`>=${r}.0.0${t.includePrerelease?`-0`:``}`:$(a)?`>=${r}.${i}.0${t.includePrerelease?`-0`:``}`:o?`>=${p}`:`>=${p}${t.includePrerelease?`-0`:``}`,m=$(l)?``:$(u)?`<${Number(l)+1}.0.0-0`:$(d)?`<${l}.${Number(u)+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t.includePrerelease?`<${l}.${u}.${Number(d)+1}-0`:`<=${m}`,`${p} ${m}`.trim()})}function si(e,t){return ai(ti(ri(e.replace(Lr,``),t),t),t).trim().replace(Yr,``)}function ci(e,t){let n=oi(e.replace(Ir,``),t).replace(Br,`$1$2$3`).replace(Vr,`$1~`).replace(Hr,`$1^`).split(` `).map(e=>si(e,t)).join(` `).split(/\s+/).map(e=>e.trim().replace(t.includePrerelease?Zr:Xr,``));t.loose&&(n=n.filter(e=>Qr.test(e)));let r=new Map;for(let e of n.map(e=>Pr(e,t))){if(e.value===`<0.0.0-0`)return[e];r.set(e.value,e)}return r.size>1&&r.delete(``),[...r.values()]}function li(e,t={}){if(typeof e!=`string`)return e;let n={...t},r=e.trim().replaceAll(/\s+/g,` `),i=r.split(`||`).map(e=>ci(e.trim(),n)).filter(e=>e.length);if(!i.length)throw TypeError(`Range contains no valid comparator sets: ${r}`);if(i.length>1){let e=i[0];if(i=i.filter(e=>e[0]?.value!==`<0.0.0-0`),!i.length)i=[e];else if(i.length>1){let e=i.find(e=>e.length===1&&e[0]?.value===``);e&&(i=[e])}}return{options:n,sets:i}}function ui(e,t={}){try{return li(e,t)}catch{return null}}function di(e,t={}){let n=ui(e,t);return n?Fr(n)||`*`:null}function fi({label:e,value:t}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-left text-sm sm:text-right`,children:t})]})}function pi({bundle:e,release:t}){let{data:n,isFetched:r}=Lt(),i=e?Et(e):null,a=e?wt(e):null,o=e?.gitCommitHash&&r?We(n?.console.gitUrl,e.gitCommitHash):null,s=t.strategy===`APP_VERSION`?t.target_app_version:t.fingerprint_hash;return s||e?.gitCommitHash||e?.manifestFileHash||a||i?(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm font-medium`,children:`Metadata`})}),(0,Z.jsx)(ht,{className:`px-4 pb-4`,children:(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Z.jsx)(fi,{label:t.strategy===`APP_VERSION`?`Target app version`:`Fingerprint target`,value:(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs`,translate:`no`,children:s??`—`})}),e?.gitCommitHash?(0,Z.jsx)(fi,{label:`Git commit`,value:(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-1 sm:justify-end`,children:[(0,Z.jsx)(Nn,{className:o?`text-primary`:void 0,maxLength:12,value:e.gitCommitHash}),o?(0,Z.jsx)(`a`,{"aria-label":`Open git commit`,className:`relative shrink-0 text-primary after:absolute after:-inset-2.5 hover:underline md:after:hidden`,href:o,rel:`noopener noreferrer`,target:`_blank`,children:(0,Z.jsx)(Ue,{"aria-hidden":`true`})}):null]})}):null,e?.manifestFileHash?(0,Z.jsx)(fi,{label:`Manifest hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:e.manifestFileHash})}):null,a?(0,Z.jsx)(fi,{label:`Base hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:a})}):null,i?(0,Z.jsx)(fi,{label:`Patch hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:i})}):null]})})]}):null}var mi=Array.from({length:Tt},(e,t)=>t+1);function hi({releaseId:e,rolloutCohortCount:t,targetCohorts:n}){let r=Dt(t),i=n??[],a=i.length>0,o=r>0&&r<1e3,s=r===Tt,c=k(),l=s?mi:o?mi.filter(t=>xt(e,t)<r):[],u=(r/10).toFixed(1),d=s?Tt:l.length,f=Tt-d,p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Selected cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:d})]})}),(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Excluded cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:f})]})})]}),a?(0,Z.jsxs)(vt,{children:[(0,Z.jsxs)(mt,{className:`p-4 pb-3`,children:[(0,Z.jsx)(gt,{className:`text-sm`,children:`Additional cohorts`}),(0,Z.jsx)(_t,{children:`Always included in addition to the percentage rollout.`})]}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-lg border bg-muted/20 p-3`,children:i.map(e=>(0,Z.jsx)(K,{className:`max-w-full font-mono`,variant:`secondary`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:e})},e))})})]}):null,(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm`,children:`Numeric cohorts`})}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto overscroll-contain rounded-lg border bg-muted/20 p-3 sm:max-h-[45vh]`,children:l.length>0?(0,Z.jsx)(`div`,{"aria-label":`Included numeric cohorts`,className:`grid grid-cols-3 gap-2 sm:grid-cols-6 lg:grid-cols-8`,role:`list`,children:l.map(e=>(0,Z.jsx)(K,{className:`justify-center font-mono tabular-nums`,role:`listitem`,variant:`outline`,children:e},e))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No numeric cohorts are included.`})})})]})]});return(0,Z.jsxs)(pn,{children:[(0,Z.jsxs)(fn,{render:(0,Z.jsx)(O,{className:`max-md:h-11`,size:`sm`,type:`button`,variant:`outline`}),children:[(0,Z.jsx)(qe,{"data-icon":`inline-start`}),`Preview cohorts`]}),(0,Z.jsx)(ln,{className:c?`top-0 left-0 h-dvh max-w-none translate-x-0 translate-y-0 rounded-none border-0 p-0`:`sm:max-w-3xl`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsxs)(sn,{className:`shrink-0 border-b border-border/70 px-4 py-4`,children:[(0,Z.jsx)(un,{children:`Rolled out cohorts`}),(0,Z.jsxs)(dn,{children:[u,`% includes `,d,` of`,` `,Tt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto overscroll-contain px-4 py-4`,children:p}),(0,Z.jsx)(cn,{className:`shrink-0 border-t border-border/70 px-4 py-3`,showCloseButton:!0})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(un,{children:`Rolled out cohorts`}),(0,Z.jsxs)(dn,{children:[u,`% includes `,d,` of`,` `,Tt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),p,(0,Z.jsx)(cn,{showCloseButton:!0})]})})]})}function gi({release:t,channel:n,bundle:r}){let i=t.bundle_id===null?null:{platform:t.platform,channel:n,fingerprintHash:t.fingerprint_hash,targetAppVersion:t.target_app_version},a=i!==null&&Qe(i)!==null,o=Jt(a?i:null);if(!a)return null;let s=o.data;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Native build`}),o.isPending?(0,Z.jsx)(e,{className:`h-4 w-40`}):s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:`inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 text-xs text-foreground underline-offset-4 hover:underline`,params:{buildId:s.id},to:`/native-builds/$buildId`,children:[Xe(s.platform),` `,Ze[s.artifact_kind].label,` ·`,` `,(0,Z.jsx)(`span`,{className:`font-mono`,translate:`no`,children:s.min_bundle_id}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-3`})]}),r?(0,Z.jsx)(K,{variant:`secondary`,children:(r.patches??[]).some(({baseBundleId:e})=>e===s.min_bundle_id)?`Patches from it`:`No patch from it`}):null]}):o.isError?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Couldn't load the scope's native build.`,` `,(0,Z.jsx)(`button`,{className:`underline underline-offset-4`,onClick:()=>void o.refetch(),type:`button`,children:`Retry`})]}):(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`None tracked for this scope ·`,` `,(0,Z.jsx)(L,{className:`relative underline-offset-4 after:absolute after:-inset-x-2 after:-inset-y-4 hover:text-foreground hover:underline md:after:hidden`,search:{channel:n},to:`/native-builds`,children:`This channel's builds`})]})]})}function _i(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function vi(e,t){return e-t}function yi(e,t,n){let r=e.slice();return r[t]=n,r.sort(vi)}function bi(e,t,n,r,i,a){let o=e;return o=W(o,n,r),i&&(o=yi(a,t,W(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function xi(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var Si={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...je},Ci=X.createContext(void 0);function wi(){let e=X.useContext(Ci);if(e===void 0)throw Error(pe(62));return e}function Ti(e){return`key`in e?p:g}function Ei(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?_i(e,t):!1}var Di=X.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:a,disabled:o=!1,id:s,format:c,largeStep:l=10,locale:u,render:d,max:f=100,min:p=0,minStepsBetweenValues:m=0,form:g,name:_,onValueChange:v,onValueCommitted:y,orientation:x=`horizontal`,step:S=1,thumbCollisionBehavior:w=`push`,thumbAlignment:T=`center`,value:ee,style:E,...D}=e,te=le(s),re=Fe(te),ie=h(v),ae=h(y),{clearErrors:se}=Le(),{state:ce,disabled:ue,name:de,setTouched:O,setDirty:k,validityData:pe,shouldValidateOnChange:me,validation:A}=Oe(),{labelId:M}=Ae(),[N,P]=X.useState(),F=n??Ie(M,N),I=ue||o,L=de??_,[R,_e]=V({controlled:ee,default:a??p,name:`Slider`}),ve=X.useRef(null),ye=X.useRef(null),z=X.useRef([]),be=X.useRef(null),xe=X.useRef(null),Se=X.useRef(-1),Ce=X.useRef(null),B=X.useRef(null),we=X.useRef(`none`),Ee=oe(c),[H,De]=X.useState(-1),[je,Me]=X.useState(-1),[Ne,Pe]=X.useState(!1),[U,Re]=X.useState(()=>new Map),[ze,Be]=X.useState([void 0,void 0]),G=h(e=>{De(e),e!==-1&&Me(e)});ke(ye,te,R),he(R,()=>{se(L),me()?A.commit(R):A.commit(R,!0);let e=pe.initialValue,t;t=Array.isArray(R)&&Array.isArray(e)?!_i(R,e):R!==e,k(t)});let Ve=h(e=>{e&&(ye.current=e)}),He=Array.isArray(R),Ue=X.useMemo(()=>He?R.slice().sort(vi):[W(R,p,f)],[f,p,He,R]),We=h((e,t)=>{if(Number.isNaN(e)||Ei(e,R))return;let n=t??C(`none`,void 0,void 0,{activeThumbIndex:-1});we.current=n.reason;let r=n.event,i=new(r.constructor??Event)(r.type,r);Object.defineProperty(i,`target`,{writable:!0,value:{value:e,name:L}}),n.event=i,B.current=e,ie(e,n),!n.isCanceled&&_e(e)}),Ge=h((e,t,n)=>{let r=bi(e,t,p,f,He,Ue);if(xi(r,S,m)){let e=Ti(n);We(r,C(e,n.nativeEvent,void 0,{activeThumbIndex:t})),O(!0),ae(B.current??r,i(e,n.nativeEvent))}});fe(()=>{let e=ne(j(ve.current));I&&b(ve.current,e)&&e.blur()},[I]),I&&H!==-1&&G(-1);let Ke=X.useMemo(()=>({...ce,activeThumbIndex:H,disabled:I,dragging:Ne,orientation:x,max:f,min:p,minStepsBetweenValues:m,step:S,values:Ue}),[ce,H,I,Ne,f,p,m,x,S,Ue]),qe=X.useMemo(()=>({active:H,controlRef:ye,disabled:I,dragging:Ne,validation:A,formatOptionsRef:Ee,handleInputChange:Ge,indicatorPosition:ze,inset:T!==`center`,labelId:F,rootLabelId:re,largeStep:l,lastUsedThumbIndex:je,lastChangedValueRef:B,lastChangeReasonRef:we,form:g,locale:u,max:f,min:p,minStepsBetweenValues:m,name:L,onValueCommitted:ae,orientation:x,pressedInputRef:be,pressedThumbCenterOffsetRef:xe,pressedThumbIndexRef:Se,pressedValuesRef:Ce,registerFieldControlRef:Ve,renderBeforeHydration:T===`edge`,setActive:G,setDragging:Pe,setIndicatorPosition:Be,setLabelId:P,setValue:We,state:Ke,step:S,thumbCollisionBehavior:w,thumbMap:U,thumbRefs:z,values:Ue}),[H,ye,F,re,I,Ne,A,Ee,Ge,ze,l,je,B,we,g,u,f,p,m,L,ae,x,be,xe,Se,Ce,Ve,G,Pe,Be,P,We,Ke,S,w,T,U,z,Ue]),Je=ge(`div`,e,{state:Ke,ref:[t,ve],props:[{"aria-labelledby":F,id:te,role:`group`},A.getValidationProps,D],stateAttributesMapping:Si});return(0,Z.jsx)(Ci.Provider,{value:qe,children:(0,Z.jsx)(Te,{elementsRef:z,onMapChange:Re,children:Je})})});function Oi(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function ki(e){if(e===0)return 0;if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function Ai(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(ki(t),ki(n))))}function ji({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=W(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=W(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=W(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function Mi({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=W(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=ji({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=W(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:ji({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=W(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var Ni=2;function Pi(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function Fi(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var Ii=X.forwardRef(function(e,n){let{render:r,className:a,style:o,...s}=e,{disabled:l,dragging:u,inset:f,lastChangedValueRef:p,lastChangeReasonRef:m,max:g,min:v,minStepsBetweenValues:y,onValueCommitted:x,orientation:S,pressedInputRef:w,pressedThumbCenterOffsetRef:T,pressedThumbIndexRef:E,pressedValuesRef:D,registerFieldControlRef:te,renderBeforeHydration:re,setActive:ie,setDragging:ae,setValue:ce,state:le,step:ue,thumbCollisionBehavior:de,thumbRefs:O,values:k}=wi(),fe=se(),pe=k.length>1,me=S===`vertical`,A=X.useRef(null),M=X.useRef(null),he=h(e=>{e&&M.current==null&&(M.current=c(e).getComputedStyle(e))}),N=X.useRef(null),F=X.useRef(0),L=X.useRef(0),R=oe(k);function _e(e){E.current!==e&&(E.current=e);let t=O.current[e];if(!t){T.current=null,w.current=null;return}w.current=t.querySelector(`input[type="range"]`)}function ve(e){let t=A.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=Pi(M.current,me),c=L.current,l=(me?r:n)-s.start-s.end-c*2,u=T.current??0,d=e.x-u,f=e.y-u,p=W(((me?i-f-s.end:(fe===`rtl`?o-d:d-a)-s.start)-c)/l,0,1),m=(g-v)*p+v;if(m=Ai(m,ue,v),m=W(m,v,g),!pe)return{value:m,thumbIndex:0,didSwap:!1};let h=E.current;if(h<0)return null;let _=Mi({behavior:de,values:k,currentValues:R.current??k,initialValues:D.current,pressedIndex:h,nextValue:m,min:v,max:g,step:ue,minStepsBetweenValues:y});return de===`swap`&&_.didSwap?_e(_.thumbIndex):E.current=_.thumbIndex,_}function ye(e){D.current=pe?k.slice():null,R.current=k;let t=E.current,n=t;if(t>-1&&t<k.length){if(k[t]===g){let e=t;for(;e>0&&k[e-1]===g;)--e;n=e}}else{let t=me?`y`:`x`,r;n=-1;for(let i=0;i<O.current.length;i+=1){let a=O.current[i];if(d(a)){let o=Oi(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&_e(n),f){let e=O.current[n];d(e)&&(L.current=e.getBoundingClientRect()[me?`height`:`width`]/2)}}function z(e){let t=O.current?.[e]?.querySelector(`input[type="range"]`);t&&t.focus({preventScroll:!0,focusVisible:!1})}let be=h(e=>{let t=Fi(e,N);if(t==null)return;if(F.current+=1,e.type===`pointermove`&&e.buttons===0){xe(e);return}let n=ve(t);n!=null&&xi(n.value,ue,y)&&(!u&&F.current>Ni&&ae(!0),ce(n.value,C(_,e,void 0,{activeThumbIndex:n.thumbIndex})),R.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&z(n.thumbIndex))});function xe(e){ie(-1),ae(!1),w.current=null,T.current=null;let t=Fi(e,N),n=t==null?null:ve(t);if(n!=null){let t=m.current;x(p.current??n.value,i(t,e))}`pointerType`in e&&A.current?.hasPointerCapture(e.pointerId)&&A.current?.releasePointerCapture(e.pointerId),E.current=-1,N.current=null,D.current=null,Ce()}let Se=h(e=>{if(l)return;let t=e.changedTouches[0];t!=null&&(N.current=t.identifier);let n=Fi(e,N);if(n!=null){ye(n);let t=ve(n);if(t==null)return;z(t.thumbIndex),ce(t.value,C(ee,e,void 0,{activeThumbIndex:t.thumbIndex})),R.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&z(t.thumbIndex)}F.current=0;let r=j(A.current);r.addEventListener(`touchmove`,be,{passive:!0}),r.addEventListener(`touchend`,xe,{passive:!0})}),Ce=h(()=>{let e=j(A.current);e.removeEventListener(`pointermove`,be),e.removeEventListener(`pointerup`,xe),e.removeEventListener(`touchmove`,be),e.removeEventListener(`touchend`,xe),D.current=null}),B=I();return X.useEffect(()=>{let e=A.current;if(!e)return()=>Ce();let t=P(e,`touchstart`,Se,{passive:!0});return()=>{t(),B.cancel(),Ce()}},[Ce,Se,A,B]),X.useEffect(()=>{l&&Ce()},[l,Ce]),ge(`div`,e,{state:le,ref:[n,te,A,he],props:[{"data-base-ui-slider-control":re?``:void 0,onPointerDown(e){let n=A.current,r=t(e.nativeEvent);if(!n||l||e.defaultPrevented||!d(r)||e.button!==0)return;let i=Fi(e,N);if(i!=null){ye(i);let t=ve(i);if(t==null)return;b(O.current[t.thumbIndex],ne(j(n)))?e.preventDefault():B.request(()=>{z(t.thumbIndex)}),ae(!0),T.current??(ce(t.value,C(ee,e.nativeEvent,void 0,{activeThumbIndex:t.thumbIndex})),R.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&z(t.thumbIndex))}e.nativeEvent.pointerId&&n.setPointerCapture(e.nativeEvent.pointerId),F.current=0;let a=j(A.current);a.addEventListener(`pointermove`,be,{passive:!0}),a.addEventListener(`pointerup`,xe,{once:!0})}},s],stateAttributesMapping:Si})}),Li=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=wi();return ge(`div`,e,{state:o,ref:t,props:[{style:{position:`relative`}},a],stateAttributesMapping:Si})}),Ri=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),zi=new Set([...f,T,l]);function Bi(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${Pn(e[t],r,n)} start range`:`${Pn(e[t],r,n)} end range`:n?Pn(e[t],r,n):void 0}function Vi(e,t,n,r,i){let a=n===1?e+t:e-t;return W(Number(a.toFixed(Math.max(ki(e),ki(t),ki(r)))),r,i)}var Hi=X.forwardRef(function(e,t){let{render:r,children:i,className:a,"aria-describedby":o,"aria-label":d,"aria-labelledby":p,disabled:g=!1,getAriaLabel:_,getAriaValueText:y,id:b,index:S,inputRef:C,onBlur:ee,onFocus:E,onKeyDown:D,tabIndex:ne,style:re,...ie}=e,{nonce:ae}=Me(),oe=le(b),{active:ce,lastUsedThumbIndex:ue,controlRef:O,disabled:k,validation:pe,formatOptionsRef:me,handleInputChange:A,inset:j,labelId:M,largeStep:he,locale:N,max:P,min:F,minStepsBetweenValues:I,form:L,name:R,orientation:_e,pressedInputRef:ve,pressedThumbCenterOffsetRef:ye,pressedThumbIndexRef:z,renderBeforeHydration:be,setActive:xe,setIndicatorPosition:Se,state:Ce,step:B,values:V}=wi(),Te=se(),Ee=g||k,H=V.length>1,De=_e===`vertical`,ke=Te===`rtl`,{setTouched:Ae,setFocused:je,validationMode:Pe}=Oe(),Fe=X.useRef(null),Ie=X.useRef(null),Le=X.useRef(!1),U=le(),W=Ne(),Re=H?U:W,{ref:ze,index:Be}=we({metadata:X.useMemo(()=>({inputId:Re}),[Re])}),G=H?S??Be:0,Ve=G===V.length-1,He=V[G],Ue=Fn(He,F,P),[We,Ge]=X.useState(),Ke=$n(),qe=ue>=0&&ue<V.length?ue:-1,Je=h(()=>{let e=O.current,t=Fe.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=De?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*Ue/100)/r[i]*100,s=Number.isFinite(o)?o:void 0;Ge(s),G===0?Se(e=>[s,e[1]]):Ve&&Se(e=>[e[0],s])});fe(()=>{j&&queueMicrotask(Je)},[Je,j]),fe(()=>{j&&Je()},[Je,j,Ue]),fe(()=>{if(!j)return;let e=O.current,t=Fe.current;if(!e||!t)return;let n=c(e).ResizeObserver;if(typeof n!=`function`)return;let r=new n(Je);return r.observe(e),r.observe(t),()=>{r.disconnect()}},[O,Je,j]);let Ye=De?`bottom`:`insetInlineStart`,Xe=De?`left`:`top`,Ze;H?ce===G?Ze=2:qe===G&&(Ze=1):ce===G&&(Ze=1);let Qe;Qe=j?{"--position":`${We??0}%`,visibility:be&&Ke||We===void 0?`hidden`:void 0,position:`absolute`,[Ye]:`var(--position)`,[Xe]:`50%`,translate:`${(De||!ke?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ze}:Number.isFinite(Ue)?{position:`absolute`,[Ye]:`${Ue}%`,[Xe]:`50%`,translate:`${(De||!ke?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ze}:de;let $e;_e===`vertical`&&($e=ke?`vertical-rl`:`vertical-lr`);let et=typeof _==`function`?_(G):d,tt=n({"aria-label":et,"aria-labelledby":p??(et==null?M:void 0),"aria-describedby":o,"aria-orientation":_e,"aria-valuenow":He,"aria-valuetext":typeof y==`function`?y(Pn(He,N,me.current??void 0),He,G):Bi(V,G,me.current??void 0,N),disabled:Ee,form:L,id:Re,max:P,min:F,name:R,onChange(e){A(e.currentTarget.valueAsNumber,G,e)},onFocus(e){let t=Le.current;Le.current=!1,xe(G),je(!0),t&&e.stopPropagation()},onBlur(e){if(Le.current){e.stopPropagation();return}Fe.current&&(xe(-1),Ae(!0),je(!1),Pe===`onBlur`&&pe.commit(bi(He,G,F,P,H,V)))},onKeyDown(e){if(!zi.has(e.key))return;f.has(e.key)&&e.stopPropagation();let t=null,n=Ai(He,B,F);switch(e.key){case u:t=Vi(n,e.shiftKey?he:B,1,F,P);break;case s:t=Vi(n,e.shiftKey?he:B,ke?-1:1,F,P);break;case m:t=Vi(n,e.shiftKey?he:B,-1,F,P);break;case v:t=Vi(n,e.shiftKey?he:B,ke?1:-1,F,P);break;case T:t=Vi(n,he,1,F,P);break;case l:t=Vi(n,he,-1,F,P);break;case`End`:t=P,H&&(t=Number.isFinite(V[G+1])?V[G+1]-B*I:P);break;case x:t=F,H&&(t=Number.isFinite(V[G-1])?V[G-1]+B*I:F);break;default:break}if(t!==null){let n=e.currentTarget;te(n)||(Le.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),A(t,G,e),e.preventDefault()}},step:B,style:{...de,width:`100%`,height:`100%`,writingMode:$e},tabIndex:ne??void 0,type:`range`,value:He??``},pe.getInputValidationProps),nt=w(Ie,pe.inputRef,C);return ge(`div`,e,{state:Ce,ref:[t,ze,Fe],props:[{[Ri.index]:G,children:(0,Z.jsxs)(X.Fragment,{children:[i,(0,Z.jsx)(`input`,{ref:nt,...tt,suppressHydrationWarning:!0}),j&&Ke&&be&&Ve&&(0,Z.jsx)(`script`,{nonce:ae,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:oe,onBlur:ee,onFocus:E,onPointerDown(e){if(z.current=G,Fe.current!=null){let t=_e===`horizontal`?`x`:`y`,n=Oi(Fe.current);ye.current=(_e===`horizontal`?e.clientX:e.clientY)-n[t]}Ie.current!=null&&ve.current!==Ie.current&&(ve.current=Ie.current)},style:Qe,suppressHydrationWarning:be||void 0},ie],stateAttributesMapping:Si})});function Ui(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function Wi(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var Gi=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{indicatorPosition:o,inset:s,max:c,min:l,orientation:u,renderBeforeHydration:d,state:f,values:p}=wi(),m=$n(),h=u===`vertical`,g=p.length>1,_=s?Ui(h,g,o[0],o[1],d,m):Wi(h,g,Fn(p[0],l,c),Fn(p[p.length-1],l,c));return ge(`div`,e,{state:f,ref:t,props:[{"data-base-ui-slider-indicator":d?``:void 0,style:_,suppressHydrationWarning:d||void 0},a],stateAttributesMapping:Si})});function Ki({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=Array.isArray(n)?n:n===void 0?Array.isArray(t)?t:t===void 0?[r]:[t]:[n];return(0,Z.jsx)(Di,{className:M(`data-horizontal:w-full data-vertical:h-full`,e),"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,thumbAlignment:`edge`,...a,children:(0,Z.jsxs)(Ii,{className:`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,children:[(0,Z.jsx)(Li,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-primary/20 select-none data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5`,children:(0,Z.jsx)(Gi,{"data-slot":`slider-range`,className:`bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,Z.jsx)(Hi,{"data-slot":`slider-thumb`,className:`relative block size-4 shrink-0 rounded-full border border-primary/50 bg-background shadow transition-colors select-none after:absolute after:-inset-2 max-md:after:-inset-3.5 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-disabled:pointer-events-none data-disabled:opacity-50`},t))]})})}var qi=[{label:`Move bundle`,value:`move`},{label:`Copy bundle`,value:`copy`}],Ji=e=>({enabled:e.enabled,message:e.message??``,rolloutCohortCount:e.rollout_cohort_count,shouldForceUpdate:e.should_force_update,targetAppVersion:e.target_app_version??``,targetCohorts:[...e.target_cohorts]}),Yi=(e,t)=>({enabled:t.enabled,message:t.message.trim()||null,rolloutCohortCount:t.rolloutCohortCount,shouldForceUpdate:t.shouldForceUpdate,...e.strategy===`APP_VERSION`?{targetAppVersion:t.targetAppVersion.trim()}:{},targetCohorts:t.targetCohorts}),Xi=e=>(e/10).toFixed(1),Zi=e=>{let t=e.replace(`,`,`.`),[n=``,...r]=t.split(`.`),i=n.replace(/\D/g,``).slice(0,3),a=r.join(``).replace(/\D/g,``).slice(0,1);return t.includes(`.`)?`${i}.${a}`:i},Qi=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.min(1e3,Math.max(0,Math.trunc(t*10))):null};function $i({value:e,onChange:t}){let[n,r]=(0,X.useState)(Xi(e)),[i,a]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{i||r(Xi(e))},[i,e]),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Ki,{"aria-label":`Rollout percentage`,max:1e3,min:0,onValueChange:n=>t(Array.isArray(n)?n[0]??e:n),step:1,value:e}),(0,Z.jsxs)(at,{className:`w-24 shrink-0`,children:[(0,Z.jsx)(tt,{"aria-label":`Rollout percentage`,autoComplete:`off`,className:`text-right tabular-nums`,id:`release-rollout-percentage`,inputMode:`decimal`,name:`rolloutPercentage`,onBlur:()=>{let i=Qi(n)??e;a(!1),r(Xi(i)),t(i)},onChange:e=>{let n=Zi(e.target.value);r(n);let i=Qi(n);i!==null&&t(i)},onFocus:()=>a(!0),value:n}),(0,Z.jsx)(nt,{align:`inline-end`,children:(0,Z.jsx)(et,{children:`%`})})]})]})}function ea({channels:t,onOpenChange:n,onShowScope:i,open:a,releaseId:o}){let s=Ft(o),c=s.data,l=Ut(c?.bundle_id??``),u=l.data,d=u?yt(u):null,f=Yt(c?.scope_key??``),p=qt(),m=It(),h=zt(),g=Kt(),[_,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(``),[w,T]=(0,X.useState)(!1),[ee,E]=(0,X.useState)(!1),[D,te]=(0,X.useState)(!1),[ne,ie]=(0,X.useState)(``),[oe,se]=(0,X.useState)(`move`);(0,X.useEffect)(()=>{v(c?Ji(c):null),C(``)},[c]);let le=c?Ji(c):null,de=_!==null&&le!==null&&JSON.stringify(_)!==JSON.stringify(le),k=m.isPending||p.isPending||h.isPending||g.isPending,fe=()=>{if(!k){if(de){T(!0);return}n(!1)}},pe=()=>{if(!_)return;let e=St(b);if(!bt(e)){C(Ct);return}v({..._,targetCohorts:Array.from(new Set([..._.targetCohorts,e]))}),x(``),C(``)},me=async()=>{if(!c||!_)return;let e=_.targetCohorts.map(St);if(e.some(e=>!bt(e))){C(Ct);return}if(c.strategy===`APP_VERSION`&&!di(_.targetAppVersion.trim())){C(`Enter a valid target app version range.`);return}let t={expectedRevision:c.revision,patch:Yi(c,{..._,targetCohorts:e}),releaseId:c.id};C(``);try{await m.mutateAsync(t),await p.mutateAsync(t),q.success(`Bundle settings saved`),n(!1)}catch(e){C(e instanceof Error?e.message:`Bundle settings could not be saved.`)}},j=t.find(e=>e.id===c?.channel_id)?.name??c?.channel_id,M=t.filter(e=>e.id!==c?.channel_id),he=M.map(e=>({label:e.name,value:e.name})),N=ne.trim(),P=oe===`copy`,ge=_?di(_.targetAppVersion.trim()):null,I=()=>{ie(``),se(`move`)},L=e=>{!e&&g.isPending||(te(e),e||I())};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{onOpenChange:e=>e?void 0:fe(),open:a,children:(0,Z.jsxs)(re,{className:`min-w-0 overflow-hidden data-[side=right]:w-full sm:max-w-[600px]`,children:[(0,Z.jsxs)(F,{className:`shrink-0 pr-12`,children:[(0,Z.jsx)(ae,{children:`Bundle Detail`}),(0,Z.jsx)(A,{className:`sr-only`,children:`Edit bundle delivery settings.`}),c?(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-col gap-3 text-sm`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(on,{className:`size-4`,platform:c.platform}),(0,Z.jsx)(`span`,{className:`font-medium`,children:c.platform===`ios`?`iOS`:`Android`})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`ID`}),(0,Z.jsxs)(`span`,{className:`min-w-0 basis-full sm:basis-auto`,children:[(0,Z.jsx)(vn,{bundleId:c.id,fullOnMobile:!0,maxLength:18}),c.bundle_id?null:(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:`Built-in bundle`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Channel`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,translate:`no`,children:j})]}),j?(0,Z.jsx)(gi,{bundle:u,channel:j,release:c}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Platform`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:c.platform===`ios`?`iOS`:`Android`})]})]}):(0,Z.jsx)(e,{className:`h-12 w-full`})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[s.isError?(0,Z.jsxs)(dt,{className:`m-4 sm:m-6`,variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Bundle details could not be loaded`}),(0,Z.jsx)(ut,{children:s.error.message})]}):null,c&&_?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6 px-4 pb-4 sm:px-6 sm:pb-6`,children:[j?(0,Z.jsx)(ve,{release:{platform:c.platform,channel:j,releaseId:c.id,builtIn:!c.bundle_id}}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`delivery-settings-heading`,className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,id:`delivery-settings-heading`,children:`Delivery settings`}),(0,Z.jsxs)(At,{className:`gap-6`,children:[(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-message`,children:`Message`}),(0,Z.jsx)(rt,{autoComplete:`off`,id:`release-message`,name:`message`,onChange:e=>v({..._,message:e.target.value}),rows:3,value:_.message})]}),c.strategy===`APP_VERSION`?(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-target`,children:`Target app version`}),(0,Z.jsx)(y,{autoComplete:`off`,id:`release-target`,name:`targetAppVersion`,onChange:e=>v({..._,targetAppVersion:e.target.value}),value:_.targetAppVersion}),ge?(0,Z.jsx)(jt,{children:ge}):null]}):null,(0,Z.jsx)(Nt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-enabled`,children:`Enabled`}),(0,Z.jsx)(pt,{label:`About Enabled`,children:`Disabling rolls devices back to the previous enabled bundle on their next check, or to the built-in app when none remains.`})]}),(0,Z.jsx)(st,{"aria-label":`Enabled`,checked:_.enabled,id:`release-enabled`,name:`enabled`,onCheckedChange:e=>v({..._,enabled:e})})]})}),(0,Z.jsx)(Nt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-force-update`,children:`Force update`}),(0,Z.jsx)(pt,{label:`About Force update`,children:`Devices apply this bundle right away, and so do devices that skip it to update straight to a newer bundle.`})]}),(0,Z.jsx)(st,{"aria-label":`Force update`,checked:_.shouldForceUpdate,id:`release-force-update`,name:`shouldForceUpdate`,onCheckedChange:e=>v({..._,shouldForceUpdate:e})})]})}),(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-rollout-percentage`,children:`Rollout percentage`}),(0,Z.jsx)($i,{onChange:e=>v({..._,rolloutCohortCount:e}),value:_.rolloutCohortCount})]}),(0,Z.jsxs)(Nt,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-cohort`,children:`Additional cohorts (optional)`}),(0,Z.jsx)(hi,{releaseId:c.id,rolloutCohortCount:_.rolloutCohortCount,targetCohorts:_.targetCohorts})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(y,{autoComplete:`off`,id:`release-cohort`,name:`targetCohort`,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),pe())},placeholder:`e.g. qa-team…`,value:b}),(0,Z.jsx)(O,{"aria-label":`Add cohort`,className:`max-md:size-11`,disabled:!b.trim(),onClick:pe,size:`icon`,type:`button`,variant:`outline`,children:(0,Z.jsx)($e,{})})]}),_.targetCohorts.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.targetCohorts.map(e=>(0,Z.jsxs)(K,{className:`gap-1 font-mono`,variant:`secondary`,children:[e,(0,Z.jsx)(`button`,{"aria-label":`Remove cohort ${e}`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>v({..._,targetCohorts:_.targetCohorts.filter(t=>t!==e)}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]},e))}):null,(0,Z.jsx)(jt,{children:`Public names—no IDs or secrets.`})]})]}),S?(0,Z.jsx)(Mt,{children:S}):null,(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:!de||k,onClick:me,size:`lg`,children:m.isPending||p.isPending?`Saving…`:`Save changes`})]}),(0,Z.jsx)(ce,{className:`my-2`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Actions`}),(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:!c.bundle_id||k,onClick:()=>te(!0),size:`sm`,variant:`outline`,children:`Promote to channel`}),c.bundle_id?(0,Z.jsxs)(O,{className:`w-full max-md:h-11`,disabled:k,onClick:()=>{window.open(`/api/bundles/${encodeURIComponent(c.bundle_id)}/download`,`_blank`,`noopener,noreferrer`),q.success(`Bundle download started`)},size:`sm`,variant:`outline`,children:[(0,Z.jsx)(He,{"data-icon":`inline-start`}),`Download manifest`]}):null,(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:c.enabled||k,onClick:()=>E(!0),size:`sm`,variant:`destructive`,children:`Remove from channel`})]}),c.bundle_id&&l.isPending?(0,Z.jsx)(e,{className:`h-40 w-full`}):null,c.bundle_id&&l.isError?(0,Z.jsxs)(dt,{variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Build details are unavailable`}),(0,Z.jsx)(ut,{children:`Delivery settings are unaffected.`})]}):null,!c.bundle_id||!l.isPending?(0,Z.jsx)(pi,{bundle:u,release:c}):null,(0,Z.jsxs)(`details`,{className:`rounded-lg border bg-muted/10 p-4 text-xs`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:`Advanced diagnostics`}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.bundle_id??`Built-in bundle`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Revision`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:c.revision})]}),d?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Patch base artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:d})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog generation`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?.generation??`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog size`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?`${f.data.byte_size} bytes`:`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Scope key`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.scope_key}),i?(0,Z.jsx)(O,{className:`mt-1 h-auto px-0 text-xs max-md:min-h-11`,onClick:()=>i(c.scope_key),size:`sm`,variant:`link`,children:`Show bundles for this target`}):null]})]}),f.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-destructive`,children:`Diagnostics are unavailable. Bundle settings are unaffected.`}):null]})]}):null]})]})}),(0,Z.jsx)(rn,{onOpenChange:T,open:w,children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsx)(Qt,{children:`Discard unsaved changes?`}),(0,Z.jsx)(Xt,{children:`Your Bundle changes will be lost.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{children:`Keep editing`}),(0,Z.jsx)($t,{onClick:()=>{T(!1),n(!1)},variant:`destructive`,children:`Discard changes`})]})]})}),(0,Z.jsx)(rn,{onOpenChange:E,open:ee,children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsxs)(Qt,{children:[`Remove this Bundle from `,j??`the channel`,`?`]}),(0,Z.jsx)(Xt,{children:`The uploaded artifact stays available. This only removes the Bundle from the channel.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{children:`Cancel`}),(0,Z.jsx)($t,{onClick:async()=>{if(c)try{await h.mutateAsync({expectedRevision:c.revision,releaseId:c.id}),q.success(`Bundle removed from ${j??`the channel`}`),E(!1),n(!1)}catch(e){C(e instanceof Error?e.message:`Bundle could not be removed from the channel.`)}},variant:`destructive`,children:`Remove from channel`})]})]})}),(0,Z.jsx)(pn,{onOpenChange:L,open:D,children:(0,Z.jsxs)(ln,{showCloseButton:!g.isPending,children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(un,{children:`Promote to Channel`}),(0,Z.jsx)(dn,{children:`Choose how to promote this Bundle, then select the target channel.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(kt,{htmlFor:`promote-action`,children:`Action`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:qi,onValueChange:e=>se(e),value:oe,children:[(0,Z.jsx)(Pe,{className:`w-full`,id:`promote-action`,children:(0,Z.jsx)(ze,{placeholder:`Select an action`})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`move`,children:`Move bundle`}),(0,Z.jsx)(U,{value:`copy`,children:`Copy bundle`})]})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:P?`Make this Bundle available in the target channel and keep it in the current channel.`:`Move this Bundle to the target channel. Devices in the current channel may fall back to an earlier Bundle.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(kt,{htmlFor:`target-channel`,children:`Target Channel`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:he,onValueChange:e=>ie(e??``),value:ne||null,children:[(0,Z.jsx)(Pe,{className:`w-full`,id:`target-channel`,children:(0,Z.jsx)(ze,{placeholder:`Select a channel`})}),(0,Z.jsx)(Re,{className:`max-h-64`,children:(0,Z.jsx)(Be,{children:M.map(e=>(0,Z.jsx)(U,{value:e.name,children:e.name},e.id))})})]})]})]}),(0,Z.jsxs)(cn,{children:[(0,Z.jsx)(O,{disabled:g.isPending,onClick:()=>L(!1),variant:`outline`,children:`Cancel`}),(0,Z.jsx)(O,{disabled:!N||g.isPending,onClick:async()=>{if(c)try{await g.mutateAsync({action:oe,expectedRevision:c.revision,releaseId:c.id,targetChannel:N}),L(!1),q.success(P?`Bundle copied to ${N}`:`Bundle moved to ${N}`)}catch(e){q.error(e instanceof Error?e.message:`Bundle could not be promoted.`)}},children:g.isPending?P?`Copying…`:`Moving…`:P?`Copy`:`Move`})]})]})})]})}function ta({release:e}){return(0,Z.jsxs)(K,{className:`gap-1 font-normal text-muted-foreground`,variant:e.enabled?`outline`:`secondary`,children:[e.enabled?(0,Z.jsx)(Ce,{className:`size-3`}):(0,Z.jsx)(Ve,{className:`size-3`}),e.enabled?`Enabled`:`Disabled`]})}var na={one:`unreachable bundle`,other:`unreachable bundles`},ra=[{label:`iOS`,value:`ios`},{label:`Android`,value:`android`}],ia=[{label:`Any Status`,value:`all`},{label:`Enabled`,value:`enabled`},{label:`Disabled`,value:`disabled`}];function aa({channels:e,onChange:t,onClear:n,onManageChannels:i,search:a}){let o=z(a),s=a.channelId!==void 0,c=[{label:`All Channels`,value:`all`},...e.map(e=>({label:e.name,value:e.id}))];return(0,Z.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-2 border-b bg-background px-3 py-3 sm:h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:py-0 sm:backdrop-blur-sm`,children:[(0,Z.jsx)(me,{className:`-ml-1 size-11 lg:size-7`}),(0,Z.jsx)(`h1`,{className:`sr-only`,children:`Bundles`}),(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-1.5 text-muted-foreground sm:ml-2`,children:[(0,Z.jsx)(Gn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:`Filters`})]}),(0,Z.jsxs)(G,{items:c,onValueChange:e=>t({channelId:e===null||e===`all`?void 0:e}),value:a.channelId??`all`,children:[(0,Z.jsx)(Pe,{"aria-label":`Channel`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`all`,children:`All Channels`}),e.map(e=>(0,Z.jsx)(U,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsxs)(G,{disabled:!s,items:ra,onValueChange:e=>t({platform:e===`android`?`android`:`ios`}),value:a.platform??`ios`,children:[(0,Z.jsx)(Pe,{"aria-label":`Platform`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,title:s?void 0:`Choose a channel first`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`ios`,children:`iOS`}),(0,Z.jsx)(U,{value:`android`,children:`Android`})]})})]}),(0,Z.jsxs)(G,{disabled:!s&&a.scopeKey===void 0,items:ia,onValueChange:e=>t({enabled:e===`enabled`?!0:e===`disabled`?!1:void 0}),value:a.enabled===void 0?`all`:a.enabled?`enabled`:`disabled`,children:[(0,Z.jsx)(Pe,{"aria-label":`Status`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`all`,children:`Any Status`}),(0,Z.jsx)(U,{value:`enabled`,children:`Enabled`}),(0,Z.jsx)(U,{value:`disabled`,children:`Disabled`})]})})]}),(0,Z.jsx)(O,{"aria-label":`Manage channels`,className:`size-11 max-sm:order-1 sm:size-7`,onClick:i,size:`icon-sm`,title:`Manage channels`,variant:`outline`,children:(0,Z.jsx)(Jn,{})}),a.bundleId?(0,Z.jsxs)(K,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Artifact filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear artifact filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>t({bundleId:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,a.scopeKey?(0,Z.jsxs)(K,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Target filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear target filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>t({scopeKey:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,o?(0,Z.jsxs)(O,{className:`h-11 px-2 text-xs text-muted-foreground hover:text-foreground max-sm:order-3 sm:ml-auto sm:h-8`,onClick:n,size:`sm`,variant:`ghost`,children:[(0,Z.jsx)(r,{"data-icon":`inline-start`}),`Clear`]}):null]})}function oa({expanded:e,onOpen:t,onToggleExpand:n,release:r}){let i=r.operation===`PROMOTE`?`Promoted`:r.operation===`ROLLBACK`?`Rollback`:null;return(0,Z.jsxs)(`div`,{className:`flex min-w-[240px] items-center gap-3`,children:[r.bundle_id?(0,Z.jsx)(O,{"aria-controls":`bundle-lineage-panel-${r.id}`,"aria-expanded":e,"aria-label":e?`Hide advanced artifact diagnostics`:`Show advanced artifact diagnostics`,title:`Advanced artifact diagnostics`,className:`size-11 shrink-0 touch-manipulation sm:size-8`,onClick:n,size:`icon`,type:`button`,variant:`ghost`,children:e?(0,Z.jsx)(B,{}):(0,Z.jsx)(De,{})}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-11 shrink-0 sm:size-8`}),(0,Z.jsxs)(`button`,{"aria-label":`Open details for ID ${r.id}`,className:`min-w-0 rounded-sm text-left text-foreground transition-colors underline-offset-4 hover:text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:t,title:r.id,type:`button`,children:[(0,Z.jsx)(vn,{bundleId:r.id,fullOnMobile:!0}),r.bundle_id?null:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,Z.jsx)(it,{className:`size-3.5`}),` Built-in bundle`]})]}),i?(0,Z.jsx)(K,{className:`shrink-0 font-normal`,variant:`secondary`,children:i}):null,r.currentlyUnreachable?(0,Z.jsx)(Wn,{icon:Ve,label:`Unreachable: no device gets this bundle with the current delivery settings.`,reason:`No device gets this bundle with the current delivery settings.`,children:`Unreachable`}):null]})}function sa({onDetailClick:t,panelId:n,release:r}){let i=r.bundle_id??``,a=Ut(i),o=Vt(i);return a.isError||o.isError?(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Patch lineage could not be loaded.`}):a.isPending?(0,Z.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2 border-t bg-muted/10 p-4`,id:n,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):a.data?(0,Z.jsx)(tr,{bundle:a.data,bundles:o.data??[],loading:o.isPending,onDetailClick:t,panelId:n}):(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Bundle details are unavailable.`})}function ca(e,t){return{patchCounts:Gt(Array.from(new Set(e.flatMap(e=>e.bundle_id?[e.bundle_id]:[])))).data??{},slotReleases:e.flatMap(e=>{let n=t.find(t=>t.id===e.channel_id)?.name;return n?[{releaseId:e.id,platform:e.platform,channel:n,builtIn:!e.bundle_id}]:[]})}}var la=(e,t)=>t>=e.to&&(e.from===void 0||t<e.from);function ua({fold:e,filter:t,channels:n,columns:r,isMobile:i,open:a,onOpenChange:o,render:s}){let c=Rt(t,{...e.from===void 0?{}:{from:e.from},to:e.to},a),l=c.data?.pages.flatMap(e=>e.rows)??[],u=ca(l,n),d=i?void 0:r,f=c.isError?(0,Z.jsx)(Rn,{columns:d,label:`Unreachable bundles`,onRetry:()=>void c.refetch(),state:`error`}):c.isPending||c.isFetchingNextPage?(0,Z.jsx)(Rn,{columns:d,label:`Loading unreachable bundles`,state:`loading`}):c.hasNextPage?(0,Z.jsx)(Rn,{columns:d,label:`Unreachable bundles`,onMore:()=>void c.fetchNextPage(),state:`more`}):null,p={label:Vn(e,na),open:a,onOpenChange:o,panelId:`bundle-fold-${e.to}`};return i?(0,Z.jsxs)(Bn,{...p,children:[l.map(e=>s(e,u)),f]}):(0,Z.jsxs)(Hn,{...p,columns:r,children:[l.map(e=>s(e,u)),f]})}function da(){let e=Se.useSearch(),t=Se.useNavigate(),n=k(),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(),s=zn(),c=be(e),l=Pt({afterReleaseId:e.afterReleaseId,beforeReleaseId:e.beforeReleaseId,filter:c,releaseId:e.releaseId}),u=Bt().data??[],d=l.data?.entries??[],f=d.flatMap(e=>e.kind===`row`?[e.row]:[]),p=ca(f,u),m=l.data?.next,h=l.data?.previous,g=xe(),_=10+g.length,v=new Map(u.map(e=>[e.id,e.name])),y=a!==void 0&&(e=>f.some(t=>t.id===e)||d.some(t=>t.kind===`fold`&&s.isOpen(In(t))&&la(t,e)))(a);(0,X.useEffect)(()=>{a!==void 0&&!y&&o(void 0)},[a,y]);let b=(e,n=!0)=>void t({resetScroll:n,search:e,to:`/`}),x=t=>b(ye(e,t)),S=t=>{f.some(({id:e})=>e===t.id)||s.set(t.id,!0),b({...e,releaseId:t.id},!1)},C=t=>{let n=f.find(e=>e.bundle_id===t.id);if(o(void 0),n){b({...e,releaseId:n.id},!1);return}x({bundleId:t.id})},w=e.afterReleaseId!==void 0||e.beforeReleaseId!==void 0,T=h?{...e,afterReleaseId:`after`in h?h.after:void 0,beforeReleaseId:`before`in h?h.before:void 0,releaseId:void 0}:null,ee=m?{...e,afterReleaseId:void 0,beforeReleaseId:m,releaseId:void 0}:null,E={...e,afterReleaseId:void 0,beforeReleaseId:void 0,releaseId:void 0},D=(t,n)=>{let r=v.get(t.channel_id)??t.channel_id,i=t.bundle_id?n.patchCounts[t.bundle_id]:0,s=y&&a===t.id,c=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(En,{"aria-label":`Bundle ${t.id}`,className:M(`gap-3`,t.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,s&&`border-b-0 bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onClick:On(()=>S(t)),children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(oa,{expanded:s,onOpen:()=>S(t),onToggleExpand:()=>o(s?void 0:t.id),release:t}),(0,Z.jsx)(yn,{channel:r,className:`shrink-0`})]}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-foreground`,children:[(0,Z.jsx)(on,{className:`size-4`,platform:t.platform}),t.platform===`ios`?`iOS`:`Android`]}),i===void 0||i>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(`span`,{children:i===void 0?`Checking patches`:`${i} ${i===1?`patch`:`patches`}`})]}):null,(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(jn,{ms:t.created_at_ms})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-xs`,children:[(0,Z.jsx)(Ke,{percentage:t.rollout_cohort_count/10}),(0,Z.jsx)(ta,{release:t}),t.should_force_update?(0,Z.jsx)(K,{variant:`secondary`,children:`Force update`}):null,(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:`Target `}),(0,Z.jsx)(H,{appVersion:t.target_app_version,fingerprintHash:t.fingerprint_hash})]})]}),g.map(({Cell:e,feature:r,label:i})=>(0,Z.jsxs)(`div`,{className:`mt-3 text-xs`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:i}),(0,Z.jsx)(e,{releaseId:t.id,releases:n.slotReleases})]},r)),t.message?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:t.message}):null]}),s&&t.bundle_id?(0,Z.jsx)(sa,{onDetailClick:C,panelId:c,release:t}):null]},t.id)},te=(t,n)=>{let r=y&&a===t.id,i=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(Sn,{"aria-label":`Open bundle ${t.id}`,className:M(t.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,r&&`bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onOpen:()=>S(t),children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(oa,{expanded:r,onOpen:()=>S(t),onToggleExpand:()=>o(r?void 0:t.id),release:t})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(yn,{channel:v.get(t.channel_id)??t.channel_id})}),(0,Z.jsx)(Y,{className:`whitespace-nowrap`,children:(0,Z.jsx)(an,{platform:t.platform})}),(0,Z.jsx)(Y,{children:t.bundle_id&&n.patchCounts[t.bundle_id]===void 0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Checking`}):t.bundle_id&&n.patchCounts[t.bundle_id]>0?(0,Z.jsxs)(K,{variant:`secondary`,children:[n.patchCounts[t.bundle_id],` `,n.patchCounts[t.bundle_id]===1?`patch`:`patches`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(H,{appVersion:t.target_app_version,fingerprintHash:t.fingerprint_hash})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(er,{enabled:t.enabled}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.enabled?`Enabled`:`Disabled`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(er,{enabled:t.should_force_update,falseIcon:`minus`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.should_force_update?`Required`:`Optional`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(Ke,{percentage:t.rollout_cohort_count/10})}),g.map(({Cell:e,feature:r})=>(0,Z.jsx)(Y,{children:(0,Z.jsx)(e,{releaseId:t.id,releases:n.slotReleases})},r)),(0,Z.jsx)(Y,{className:`text-sm text-muted-foreground`,title:t.message??void 0,children:t.message||`-`}),(0,Z.jsx)(Y,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(jn,{ms:t.created_at_ms})})]}),r&&t.bundle_id?(0,Z.jsx)(gn,{className:`hover:bg-transparent`,children:(0,Z.jsx)(Y,{className:`border-t-0 p-0`,colSpan:_,children:(0,Z.jsx)(sa,{onDetailClick:C,panelId:i,release:t})})}):null]},t.id)},ne=(e,t)=>(0,Z.jsx)(ua,{channels:u,columns:_,filter:c,fold:e,isMobile:n,onOpenChange:t=>s.set(In(e),t),open:s.isOpen(In(e)),render:t},`fold-${e.to}`),re=(0,Z.jsx)(An,{icon:Ye,title:f.length===0&&d.length>0?`No device gets the bundles here`:w?`No more bundles`:z(e)?`No bundles match these filters`:`No bundles yet`,children:w?(0,Z.jsx)(L,{className:ie({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),search:E,to:`/`,children:`Show the newest bundles`}):z(e)?(0,Z.jsx)(O,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:()=>b({}),variant:`outline`,children:`Clear filters`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`Deploy one from your app's project:`}),(0,Z.jsx)(`div`,{className:`w-full text-left`,children:(0,Z.jsx)(Ee,{label:`the deploy command`,value:`npx hot-updater deploy`,wrap:!0})})]})});return(0,Z.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,Z.jsx)(aa,{channels:u,onChange:x,onClear:()=>b({}),onManageChannels:()=>i(!0),search:e}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-6 bg-muted/5 p-3 sm:p-6`,children:[l.isError?(0,Z.jsxs)(dt,{variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Bundles could not be loaded`}),(0,Z.jsx)(ut,{children:l.error.message})]}):(0,Z.jsx)(xn,{children:n?(0,Z.jsx)(`div`,{className:`h-full overflow-y-auto`,children:l.isPending?(0,Z.jsx)(kn,{}):(0,Z.jsxs)(Z.Fragment,{children:[f.length===0?(0,Z.jsx)(wn,{children:re}):null,d.map(e=>e.kind===`row`?D(e.row,p):ne(e,D))]})}):(0,Z.jsx)(bn,{rowGroups:!0,header:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{children:`ID`}),(0,Z.jsx)(J,{children:`Channel`}),(0,Z.jsx)(J,{children:`Platform`}),(0,Z.jsx)(J,{children:`Patches`}),(0,Z.jsx)(J,{children:`Target`}),(0,Z.jsx)(J,{children:`Enabled`}),(0,Z.jsx)(J,{children:`Force update`}),(0,Z.jsx)(J,{children:`Rollout`}),g.map(({feature:e,label:t})=>(0,Z.jsx)(J,{children:t},e)),(0,Z.jsx)(J,{children:`Message`}),(0,Z.jsx)(J,{children:`Created`})]}),children:l.isPending?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(Cn,{columns:_})}):(0,Z.jsxs)(Z.Fragment,{children:[f.length===0?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(Tn,{columns:_,children:re})}):null,Ln(d).map(e=>e.kind===`fold`?ne(e.fold,te):(0,Z.jsx)(Dn,{children:e.rows.map(e=>te(e,p))},`rows-${e.rows[0].id}`))]})})}),!l.isError&&!l.isPending?(0,Z.jsx)(Mn,{count:f.length,folded:{...Un(d),label:`unreachable`},label:`Bundle pagination`,noun:[`bundle`,`bundles`],pending:l.isPlaceholderData,newest:w?{search:E,to:`/`}:void 0,next:ee?{search:ee,to:`/`}:void 0,previous:T?{search:T,to:`/`}:void 0}):null]}),(0,Z.jsx)(ea,{channels:u,onOpenChange:t=>!t&&b({...e,releaseId:void 0},!1),onShowScope:e=>x({scopeKey:e}),open:!!e.releaseId,releaseId:e.releaseId??``}),(0,Z.jsx)(nr,{onOpenChange:i,open:r})]})}export{da as component};
1
+ import{$ as e,$n as t,Ar as n,Br as r,Cn as i,Di as a,Ei as o,F as s,Fr as c,H as l,I as u,Ir as d,L as f,Ln as p,M as m,Mr as h,Nn as g,On as _,P as v,Q as y,Qn as b,R as x,Ri as S,Sn as C,Tr as w,U as T,Un as ee,Vi as E,Vr as D,Xn as te,Zn as ne,_ as re,_r as ie,b as ae,bn as oe,dt as se,et as ce,ft as le,g as ue,gn as de,gr as O,h as k,jr as fe,kr as pe,p as me,v as A,vn as j,vr as M,w as he,wr as N,xn as P,xr as ge,y as F,yn as I}from"./sidebar-UnsNYOry.js";import{t as L}from"./link-D95E0fwF.js";import{t as R}from"./arrow-right-jHG0fJt7.js";import{t as _e}from"./arrow-up-right-BPRe5soE.js";import{a as ve,i as ye,n as z,r as be,s as xe,t as Se}from"./routes-BMbT1Qdm.js";import{t as Ce}from"./check-Dz_5aNwx.js";import{a as B,i as V,n as we,r as Te}from"./useCompositeListItem-B9ONn9qn.js";import{i as Ee,r as H}from"./TargetDisplay-CiU6ZsDl.js";import{t as De}from"./chevron-right-CuYrscDY.js";import{A as Oe,D as ke,E as Ae,M as je,N as Me,T as Ne,a as Pe,d as Fe,f as Ie,h as Le,i as U,m as W,n as Re,o as ze,r as Be,t as G}from"./select-BAd2hAoW.js";import{t as Ve}from"./circle-off-BZFOMb8J.js";import{t as He}from"./download-ekENI2Sw.js";import{i as Ue,n as We,r as Ge,t as Ke}from"./RolloutPercentageBadge-DnmU8XbU.js";import{t as qe}from"./list-Dq40Mmoj.js";import{t as Je}from"./loader-circle-C26cZDSM.js";import{C as Ye,O as Xe,T as Ze,h as Qe}from"./native-builds-hOC_V15R.js";import{t as $e}from"./plus-Bp6IqwOH.js";import{a as et,i as tt,n as nt,o as rt,s as it,t as at}from"./input-group-DNfVeeYZ.js";import{n as ot,t as st}from"./switch-DNa3Cz9K.js";import{t as ct}from"./trash-2-BPH7ydek.js";import{a as lt,i as ut,n as dt,o as ft,t as K}from"./badge-D4Tiwei-.js";import{n as q}from"./dist-BEIz5ojx.js";import{o as pt}from"./insights-search-CtEcj6lz.js";import{a as mt,n as ht,o as gt,r as _t,t as vt}from"./card-BfeRlTvj.js";import{a as yt,c as bt,i as xt,l as St,n as Ct,o as wt,r as Tt,s as Et,u as Dt}from"./uuidv7-DgXZ1zRR.js";import{a as Ot,c as kt,i as At,n as jt,r as Mt,t as Nt}from"./field-PkdRPD3A.js";import{C as Pt,S as Ft,_ as It,a as Lt,b as Rt,c as zt,i as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt,v as Kt,w as qt,x as Jt,y as Yt}from"./api-B1z_XXrQ.js";import{a as Xt,i as Zt,l as Qt,n as $t,o as en,r as tn,s as nn,t as rn}from"./alert-dialog-Dihztkem.js";import{n as an,t as on}from"./PlatformIcon-Kq3q98tU.js";import{a as sn,i as cn,n as ln,o as un,r as dn,s as fn,t as pn}from"./dialog-e9AF5T6h.js";import{a as mn,i as J,n as hn,o as gn,r as Y,t as _n}from"./table-r_sYqKTQ.js";import{t as vn}from"./BundleIdDisplay-D8oR8mcP.js";import{t as yn}from"./ChannelBadge-Do-lWsLM.js";import{a as bn,c as xn,d as Sn,f as Cn,i as wn,l as Tn,n as En,o as Dn,p as On,r as kn,s as An,t as jn,u as Mn}from"./RelativeTime-BvgGWfXM.js";import{t as Nn}from"./HashValueDisplay-DKziWjEg.js";import{n as Pn,t as Fn}from"./valueToPercent-Bn8p2lng.js";import{a as In,c as Ln,i as Rn,l as zn,n as Bn,o as Vn,r as Hn,s as Un,t as Wn}from"./RowReason-7dIWPxhy.js";var Gn=D(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Kn=D(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),qn=D(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Jn=D(`tags`,[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]),Yn=o();function Xn(){return N}function Zn(){return!1}function Qn(){return!0}function $n(){return(0,Yn.useSyncExternalStore)(Xn,Zn,Qn)}var X=E(S(),1),Z=a();function er({enabled:e,className:t,falseIcon:n=`x`,colorMode:i=`semantic`}){let a=i===`inherit`?`text-current`:void 0;return e?(0,Z.jsx)(Ce,{className:M(`h-4 w-4`,a??`text-green-600 dark:text-green-400`,t)}):n===`minus`?(0,Z.jsx)(Kn,{className:M(`h-4 w-4`,a??`text-muted-foreground`,t)}):(0,Z.jsx)(r,{className:M(`h-4 w-4`,a??`text-red-600 dark:text-red-400`,t)})}function tr({panelId:t,bundle:n,bundles:r,loading:i,onDetailClick:a}){let o=k();return(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-3 sm:p-4`,id:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Advanced artifact diagnostics`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 text-sm sm:items-center`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`Base artifact ID`}),(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(K,{variant:`outline`,children:[r.length,` `,r.length===1?`patch`:`patches`]})]}),i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):r.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),o?(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:r.map(e=>(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Target artifact ID`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})]}),(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Relation`}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-start gap-1 text-sm`,children:[(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(R,{className:`size-4 rotate-90 text-muted-foreground`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Artifact`}),(0,Z.jsx)(K,{variant:`secondary`,children:`bsdiff`})]}),(0,Z.jsxs)(`div`,{className:`space-y-1 text-right`,children:[(0,Z.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:`Created`}),(0,Z.jsx)(`div`,{className:`text-xs tabular-nums text-foreground`,children:(0,Z.jsx)(Ge,{uuid:e.id})})]})]}),(0,Z.jsx)(O,{className:`w-full`,onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})]})},e.id))}):(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-md border bg-background`,children:(0,Z.jsxs)(_n,{className:`min-w-max`,children:[(0,Z.jsx)(mn,{children:(0,Z.jsxs)(gn,{className:`hover:bg-transparent`,children:[(0,Z.jsx)(J,{children:`Target artifact ID`}),(0,Z.jsx)(J,{children:`Relation`}),(0,Z.jsx)(J,{children:`Artifact`}),(0,Z.jsx)(J,{children:`Created`}),(0,Z.jsx)(J,{className:`w-24 text-right`,children:`Detail`})]})}),(0,Z.jsx)(hn,{children:r.map(e=>(0,Z.jsxs)(gn,{children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:18})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`div`,{className:`flex min-w-[280px] flex-col items-start gap-1 sm:flex-row sm:items-center sm:gap-2`,children:[(0,Z.jsx)(vn,{bundleId:n.id,fullOnMobile:!0,maxLength:12}),(0,Z.jsx)(R,{className:`size-4 shrink-0 rotate-90 text-muted-foreground sm:rotate-0`}),(0,Z.jsx)(vn,{bundleId:e.id,fullOnMobile:!0,maxLength:12})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(K,{variant:`secondary`,children:`bsdiff`})}),(0,Z.jsx)(Y,{className:`tabular-nums`,children:(0,Z.jsx)(Ge,{uuid:e.id})}),(0,Z.jsx)(Y,{className:`text-right`,children:(0,Z.jsx)(O,{onClick:()=>a(e),size:`sm`,type:`button`,variant:`outline`,children:`Detail`})})]},e.id))})]})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-muted-foreground/70`,children:`Patch artifacts from this base`}),(0,Z.jsx)(`div`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`No direct patch artifacts.`})]})]})})}function nr({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[i,a]=(0,X.useState)(null),o=ot(i),{data:s=[],isPending:c}=Bt(),l=Ht(),u=Wt(),d=n.trim(),f=async e=>{if(e.preventDefault(),!(!d||l.isPending))try{let e=await l.mutateAsync({name:d});r(``),e.inserted?q.success(`Channel ${e.row.name} created`):q.info(`Channel ${e.row.name} already exists`)}catch(e){q.error(`Failed to create channel`),console.error(e)}},p=async()=>{if(!(!i||u.isPending))try{let e=await u.mutateAsync({id:i.id});e.deleted?q.success(`Channel ${i.name} deleted`):e.reason===`not_empty`?q.error(`Channel ${i.name} is still in use and cannot be deleted`):q.error(`Channel ${i.name} no longer exists`),a(null)}catch(e){q.error(`Failed to delete channel`),console.error(e)}};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pn,{open:e,onOpenChange:t,children:(0,Z.jsxs)(ln,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsxs)(un,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(qn,{className:`size-4 text-muted-foreground`}),`Channels`]}),(0,Z.jsx)(dn,{children:`Create deployment channels and remove them when no bundle uses them. Empty channels remain available until you delete them.`})]}),(0,Z.jsx)(`form`,{onSubmit:f,children:(0,Z.jsx)(At,{className:`gap-2`,children:(0,Z.jsxs)(Nt,{orientation:`horizontal`,children:[(0,Z.jsx)(Ot,{htmlFor:`channel-name`,className:`sr-only`,children:`Channel name`}),(0,Z.jsx)(y,{id:`channel-name`,value:n,onChange:e=>r(e.target.value),placeholder:`Channel name`,autoComplete:`off`,disabled:l.isPending}),(0,Z.jsxs)(O,{className:`max-md:h-11`,type:`submit`,disabled:!d||l.isPending,children:[l.isPending?(0,Z.jsx)(Je,{"data-icon":`inline-start`,className:`animate-spin motion-reduce:animate-none`}):(0,Z.jsx)($e,{"data-icon":`inline-start`}),`Create`]})]})})}),(0,Z.jsx)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg border`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:[(0,Z.jsx)(Je,{className:`mr-2 size-3.5 animate-spin motion-reduce:animate-none`}),`Loading channels`]}):s.length===0?(0,Z.jsx)(`div`,{className:`flex h-20 items-center justify-center text-muted-foreground`,children:`No channels yet`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:s.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-12 items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,title:e.name,children:e.name}),(0,Z.jsx)(O,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,disabled:u.isPending,onClick:()=>a(e),className:`text-muted-foreground hover:text-destructive max-md:size-11`,children:(0,Z.jsx)(ct,{"data-icon":`inline-start`})})]},e.id))})})]})}),(0,Z.jsx)(rn,{open:i!==null,onOpenChange:e=>{!e&&!u.isPending&&a(null)},children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsxs)(Qt,{children:[`Delete `,o?.name,`?`]}),(0,Z.jsx)(Xt,{children:`Only empty channels can be removed. The server checks this when you delete it, and the channel can be created again later with a new ID.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{disabled:u.isPending,children:`Cancel`}),(0,Z.jsx)($t,{variant:`destructive`,disabled:u.isPending,onClick:e=>{e.preventDefault(),p()},children:u.isPending?`Deleting...`:`Delete channel`})]})]})})]})}var rr=`[a-zA-Z0-9-]`,ir=String.raw`0|[1-9]\d*`,ar=String.raw`\d+`,or=String.raw`\d*[a-zA-Z-]${rr}*`,sr=String.raw`(${ir})\.(${ir})\.(${ir})`,cr=String.raw`(${ar})\.(${ar})\.(${ar})`,lr=`(?:${or}|${ir})`,ur=`(?:${or}|${ar})`,dr=String.raw`(?:-(${lr}(?:\.${lr})*))`,fr=String.raw`(?:-?(${ur}(?:\.${ur})*))`,pr=`${rr}+`,mr=String.raw`(?:\+(${pr}(?:\.${pr})*))`,hr=`v?${sr}${dr}?${mr}?`,gr=String.raw`[v=\s]*${cr}${fr}?${mr}?`,_r=`((?:<|>)?=?)`,vr=String.raw`${ir}|x|X|\*`,yr=String.raw`${ar}|x|X|\*`,br=String.raw`[v=\s]*(${vr})(?:\.(${vr})(?:\.(${vr})(?:${dr})?${mr}?)?)?`,xr=String.raw`[v=\s]*(${yr})(?:\.(${yr})(?:\.(${yr})(?:${fr})?${mr}?)?)?`,Sr=`(?:~>?)`,Cr=String.raw`(?:\^)`,wr=String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;String.raw`${wr}(?:$|[^\d])`,String.raw`${wr}(?:${dr})?(?:${mr})?(?:$|[^\d])`;function Tr(e){let t=[[String.raw`\s`,1],[String.raw`\d`,256],[rr,250]];for(let[n,r]of t)e=e.split(`${n}*`).join(`${n}{0,${r}}`).split(`${n}+`).join(`${n}{1,${r}}`);return e}function Q(e,t){return new RegExp(Tr(e),t)}var Er=Q(`^${hr}$`),Dr=Q(`^${gr}$`),Or=/^\d+$/;function kr(e){let t=`${e.major}.${e.minor}.${e.patch}`;return e.prerelease?.length?`${t}-${e.prerelease.join(`.`)}`:t}function Ar(e,t={}){if(typeof e!=`string`)return e;if(e.length>256)throw TypeError(`Version exceeds the maximum length of 256 characters`);let n=e.trim().match(t.loose?Dr:Er);if(!n)throw TypeError(`Invalid version syntax: ${e}`);let r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(r>2**53-1||r<0)throw TypeError(`Invalid major version: ${n[1]}`);if(i>2**53-1||i<0)throw TypeError(`Invalid minor version: ${n[2]}`);if(a>2**53-1||a<0)throw TypeError(`Invalid patch version: ${n[3]}`);let o=n[4]?n[4].split(`.`).map(e=>{if(Or.test(e)){let t=Number(e);if(t>=0&&t<2**53-1)return t}return e}):void 0;return{build:n[5]?.split(`.`),major:r,minor:i,patch:a,prerelease:o}}var jr=Q(String.raw`^${_r}\s*(${hr})$|^$`),Mr=Q(String.raw`^${_r}\s*(${gr})$|^$`);function Nr(e){return e.version?`${e.operator}${kr(e.version)}`:``}function Pr(e,t={}){if(typeof e!=`string`)return e;let n=e.trim().replaceAll(/\s+/g,` `),r=n.match(t.loose?Mr:jr);if(!r)throw TypeError(`Invalid comparator: ${n}`);let i=r[1]===`=`?``:r[1]||``,a=r[2]?Ar(r[2],t):null;return{operator:i,options:t,value:a?`${i}${kr(a)}`:``,version:a}}function Fr(e){return e.sets.map(e=>e.map(Nr).join(` `)).join(`||`)}var Ir=new RegExp(mr,`g`),Lr=Q(mr),Rr=Q(String.raw`^\s*(${br})\s+-\s+(${br})\s*$`),zr=Q(String.raw`^\s*(${xr})\s+-\s+(${xr})\s*$`),Br=Q(String.raw`(\s*)${_r}\s*(${gr}|${br})`,`g`),Vr=Q(String.raw`(\s*)${Sr}\s+`,`g`),Hr=Q(String.raw`(\s*)${Cr}\s+`,`g`),Ur=Q(`^${Sr}${br}$`),Wr=Q(`^${Sr}${xr}$`),Gr=Q(`^${Cr}${br}$`),Kr=Q(`^${Cr}${xr}$`),qr=Q(String.raw`^${_r}\s*${br}$`),Jr=Q(String.raw`^${_r}\s*${xr}$`),Yr=Q(String.raw`(<|>)?=?\s*\*`),Xr=/^\s*>=\s*0\.0\.0\s*$/,Zr=/^\s*>=\s*0\.0\.0-0\s*$/,Qr=Q(String.raw`^${_r}\s*(${gr})$|^$`);function $(e){return!e||String(e).toLowerCase()===`x`||String(e)===`*`}function $r(e,t,n){return $(e)&&!$(t)||$(t)&&!!n&&!$(n)}function ei(e,t){let n=t.loose?Wr:Ur,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:a?`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`)}function ti(e,t){return e.trim().split(/\s+/).map(e=>ei(e,t)).join(` `)}function ni(e,t){let n=t.loose?Kr:Gr,r=t.includePrerelease?`-0`:``;return e.replace(n,(e,t,n,i,a)=>$(t)?``:$(n)?`>=${t}.0.0${r} <${Number(t)+1}.0.0-0`:$(i)?t===`0`?`>=${t}.${n}.0${r} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.0${r} <${Number(t)+1}.0.0-0`:a?t===`0`?n===`0`?`>=${t}.${n}.${i}-${a} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i}-${a} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i}-${a} <${Number(t)+1}.0.0-0`:t===`0`?n===`0`?`>=${t}.${n}.${i} <${t}.${n}.${Number(i)+1}-0`:`>=${t}.${n}.${i} <${t}.${Number(n)+1}.0-0`:`>=${t}.${n}.${i} <${Number(t)+1}.0.0-0`)}function ri(e,t){return e.trim().split(/\s+/).map(e=>ni(e,t)).join(` `)}function ii(e,t){let n=t.loose?Jr:qr;return e.trim().replace(n,(n,r,i,a,o)=>{let s=r,c=i,l=a,u=o;if($r(String(c),l===void 0?void 0:String(l),u===void 0?void 0:String(u)))return e;let d=$(c),f=d||$(l),p=f||$(u);if(s===`=`&&p&&(s=``),d)return s===`>`||s===`<`?`<0.0.0-0`:`*`;let m=t.includePrerelease?`-0`:``;return s&&p?(f&&(l=0),u=0,s===`>`?(s=`>=`,f?(c=Number(c)+1,l=0):l=Number(l)+1):s===`<=`&&(s=`<`,f?c=Number(c)+1:l=Number(l)+1),s===`<`&&(m=`-0`),`${s}${c}.${l}.${u}${m}`):f?`>=${c}.0.0${m} <${Number(c)+1}.0.0-0`:p?`>=${c}.${l}.0${m} <${c}.${Number(l)+1}.0-0`:n})}function ai(e,t){return e.split(/\s+/).map(e=>ii(e,t)).join(` `)}function oi(e,t){let n=t.loose?zr:Rr;return e.replace(n,(e,n,r,i,a,o,s,c,l,u,d,f)=>{let p=n,m=c;return p=$(r)?``:$(i)?`>=${r}.0.0${t.includePrerelease?`-0`:``}`:$(a)?`>=${r}.${i}.0${t.includePrerelease?`-0`:``}`:o?`>=${p}`:`>=${p}${t.includePrerelease?`-0`:``}`,m=$(l)?``:$(u)?`<${Number(l)+1}.0.0-0`:$(d)?`<${l}.${Number(u)+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:t.includePrerelease?`<${l}.${u}.${Number(d)+1}-0`:`<=${m}`,`${p} ${m}`.trim()})}function si(e,t){return ai(ti(ri(e.replace(Lr,``),t),t),t).trim().replace(Yr,``)}function ci(e,t){let n=oi(e.replace(Ir,``),t).replace(Br,`$1$2$3`).replace(Vr,`$1~`).replace(Hr,`$1^`).split(` `).map(e=>si(e,t)).join(` `).split(/\s+/).map(e=>e.trim().replace(t.includePrerelease?Zr:Xr,``));t.loose&&(n=n.filter(e=>Qr.test(e)));let r=new Map;for(let e of n.map(e=>Pr(e,t))){if(e.value===`<0.0.0-0`)return[e];r.set(e.value,e)}return r.size>1&&r.delete(``),[...r.values()]}function li(e,t={}){if(typeof e!=`string`)return e;let n={...t},r=e.trim().replaceAll(/\s+/g,` `),i=r.split(`||`).map(e=>ci(e.trim(),n)).filter(e=>e.length);if(!i.length)throw TypeError(`Range contains no valid comparator sets: ${r}`);if(i.length>1){let e=i[0];if(i=i.filter(e=>e[0]?.value!==`<0.0.0-0`),!i.length)i=[e];else if(i.length>1){let e=i.find(e=>e.length===1&&e[0]?.value===``);e&&(i=[e])}}return{options:n,sets:i}}function ui(e,t={}){try{return li(e,t)}catch{return null}}function di(e,t={}){let n=ui(e,t);return n?Fr(n)||`*`:null}function fi({label:e,value:t}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Z.jsx)(`dd`,{className:`min-w-0 text-left text-sm sm:text-right`,children:t})]})}function pi({bundle:e,release:t}){let{data:n,isFetched:r}=Lt(),i=e?Et(e):null,a=e?wt(e):null,o=e?.gitCommitHash&&r?We(n?.console.gitUrl,e.gitCommitHash):null,s=t.strategy===`APP_VERSION`?t.target_app_version:t.fingerprint_hash;return s||e?.gitCommitHash||e?.manifestFileHash||a||i?(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm font-medium`,children:`Metadata`})}),(0,Z.jsx)(ht,{className:`px-4 pb-4`,children:(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-3 text-sm`,children:[(0,Z.jsx)(fi,{label:t.strategy===`APP_VERSION`?`Target app version`:`Fingerprint target`,value:(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs`,translate:`no`,children:s??`—`})}),e?.gitCommitHash?(0,Z.jsx)(fi,{label:`Git commit`,value:(0,Z.jsxs)(`div`,{className:`flex items-center justify-start gap-1 sm:justify-end`,children:[(0,Z.jsx)(Nn,{className:o?`text-primary`:void 0,maxLength:12,value:e.gitCommitHash}),o?(0,Z.jsx)(`a`,{"aria-label":`Open git commit`,className:`relative shrink-0 text-primary after:absolute after:-inset-2.5 hover:underline md:after:hidden`,href:o,rel:`noopener noreferrer`,target:`_blank`,children:(0,Z.jsx)(Ue,{"aria-hidden":`true`})}):null]})}):null,e?.manifestFileHash?(0,Z.jsx)(fi,{label:`Manifest hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:e.manifestFileHash})}):null,a?(0,Z.jsx)(fi,{label:`Base hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:a})}):null,i?(0,Z.jsx)(fi,{label:`Patch hash`,value:(0,Z.jsx)(Nn,{maxLength:16,value:i})}):null]})})]}):null}var mi=Array.from({length:Tt},(e,t)=>t+1);function hi({releaseId:e,rolloutCohortCount:t,targetCohorts:n}){let r=Dt(t),i=n??[],a=i.length>0,o=r>0&&r<1e3,s=r===Tt,c=k(),l=s?mi:o?mi.filter(t=>xt(e,t)<r):[],u=(r/10).toFixed(1),d=s?Tt:l.length,f=Tt-d,p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Selected cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:d})]})}),(0,Z.jsx)(vt,{children:(0,Z.jsxs)(mt,{className:`p-4`,children:[(0,Z.jsx)(_t,{children:`Excluded cohorts`}),(0,Z.jsx)(gt,{className:`font-mono text-2xl tabular-nums`,children:f})]})})]}),a?(0,Z.jsxs)(vt,{children:[(0,Z.jsxs)(mt,{className:`p-4 pb-3`,children:[(0,Z.jsx)(gt,{className:`text-sm`,children:`Additional cohorts`}),(0,Z.jsx)(_t,{children:`Always included in addition to the percentage rollout.`})]}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-lg border bg-muted/20 p-3`,children:i.map(e=>(0,Z.jsx)(K,{className:`max-w-full font-mono`,variant:`secondary`,children:(0,Z.jsx)(`span`,{className:`truncate`,children:e})},e))})})]}):null,(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(mt,{className:`p-4 pb-3`,children:(0,Z.jsx)(gt,{className:`text-sm`,children:`Numeric cohorts`})}),(0,Z.jsx)(ht,{className:`p-4 pt-0`,children:(0,Z.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto overscroll-contain rounded-lg border bg-muted/20 p-3 sm:max-h-[45vh]`,children:l.length>0?(0,Z.jsx)(`div`,{"aria-label":`Included numeric cohorts`,className:`grid grid-cols-3 gap-2 sm:grid-cols-6 lg:grid-cols-8`,role:`list`,children:l.map(e=>(0,Z.jsx)(K,{className:`justify-center font-mono tabular-nums`,role:`listitem`,variant:`outline`,children:e},e))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No numeric cohorts are included.`})})})]})]});return(0,Z.jsxs)(pn,{children:[(0,Z.jsxs)(fn,{render:(0,Z.jsx)(O,{className:`max-md:h-11`,size:`sm`,type:`button`,variant:`outline`}),children:[(0,Z.jsx)(qe,{"data-icon":`inline-start`}),`Preview cohorts`]}),(0,Z.jsx)(ln,{className:c?`top-0 left-0 h-dvh max-w-none translate-x-0 translate-y-0 rounded-none border-0 p-0`:`sm:max-w-3xl`,children:c?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsxs)(sn,{className:`shrink-0 border-b border-border/70 px-4 py-4`,children:[(0,Z.jsx)(un,{children:`Rolled out cohorts`}),(0,Z.jsxs)(dn,{children:[u,`% includes `,d,` of`,` `,Tt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto overscroll-contain px-4 py-4`,children:p}),(0,Z.jsx)(cn,{className:`shrink-0 border-t border-border/70 px-4 py-3`,showCloseButton:!0})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(un,{children:`Rolled out cohorts`}),(0,Z.jsxs)(dn,{children:[u,`% includes `,d,` of`,` `,Tt,` numeric cohorts.`,a?` Additional cohorts are always included.`:``]})]}),p,(0,Z.jsx)(cn,{showCloseButton:!0})]})})]})}function gi({release:t,channel:n,bundle:r}){let i=t.bundle_id===null?null:{platform:t.platform,channel:n,fingerprintHash:t.fingerprint_hash,targetAppVersion:t.target_app_version},a=i!==null&&Ze(i)!==null,o=Jt(a?i:null);if(!a)return null;let s=o.data;return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Native build`}),o.isPending?(0,Z.jsx)(e,{className:`h-4 w-40`}):s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(L,{className:`inline-flex flex-wrap items-center gap-x-1 gap-y-0.5 text-xs text-foreground underline-offset-4 hover:underline`,params:{buildId:s.id},to:`/native-builds/$buildId`,children:[Ye(s.platform),` `,Qe[s.artifact_kind].label,` ·`,` `,(0,Z.jsx)(`span`,{className:`font-mono`,translate:`no`,children:s.min_bundle_id}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-3`})]}),r?(0,Z.jsx)(K,{variant:`secondary`,children:(r.patches??[]).some(({baseBundleId:e})=>e===s.min_bundle_id)?`Patches from it`:`No patch from it`}):null]}):o.isError?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Couldn't load the scope's native build.`,` `,(0,Z.jsx)(`button`,{className:`underline underline-offset-4`,onClick:()=>void o.refetch(),type:`button`,children:`Retry`})]}):(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`None tracked for this scope ·`,` `,(0,Z.jsx)(L,{className:`relative underline-offset-4 after:absolute after:-inset-x-2 after:-inset-y-4 hover:text-foreground hover:underline md:after:hidden`,search:{channel:n},to:`/native-builds`,children:`This channel's builds`})]})]})}function _i(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function vi(e,t){return e-t}function yi(e,t,n){let r=e.slice();return r[t]=n,r.sort(vi)}function bi(e,t,n,r,i,a){let o=e;return o=W(o,n,r),i&&(o=yi(a,t,W(o,a[t-1]||-1/0,a[t+1]||1/0))),o}function xi(e,t,n){if(!Array.isArray(e))return!0;let r=e.reduce((e,t,n,r)=>(n===r.length-1||e.push(Math.abs(t-r[n+1])),e),[]);return Math.min(...r)>=t*n}var Si={activeThumbIndex:()=>null,max:()=>null,min:()=>null,minStepsBetweenValues:()=>null,step:()=>null,values:()=>null,...je},Ci=X.createContext(void 0);function wi(){let e=X.useContext(Ci);if(e===void 0)throw Error(pe(62));return e}function Ti(e){return`key`in e?p:g}function Ei(e,t){return typeof e==`number`&&typeof t==`number`?e===t:Array.isArray(e)&&Array.isArray(t)?_i(e,t):!1}var Di=X.forwardRef(function(e,t){let{"aria-labelledby":n,className:r,defaultValue:a,disabled:o=!1,id:s,format:c,largeStep:l=10,locale:u,render:d,max:f=100,min:p=0,minStepsBetweenValues:m=0,form:g,name:_,onValueChange:v,onValueCommitted:y,orientation:x=`horizontal`,step:S=1,thumbCollisionBehavior:w=`push`,thumbAlignment:T=`center`,value:ee,style:E,...D}=e,te=le(s),re=Fe(te),ie=h(v),ae=h(y),{clearErrors:se}=Le(),{state:ce,disabled:ue,name:de,setTouched:O,setDirty:k,validityData:pe,shouldValidateOnChange:me,validation:A}=Oe(),{labelId:M}=Ae(),[N,P]=X.useState(),F=n??Ie(M,N),I=ue||o,L=de??_,[R,_e]=V({controlled:ee,default:a??p,name:`Slider`}),ve=X.useRef(null),ye=X.useRef(null),z=X.useRef([]),be=X.useRef(null),xe=X.useRef(null),Se=X.useRef(-1),Ce=X.useRef(null),B=X.useRef(null),we=X.useRef(`none`),Ee=oe(c),[H,De]=X.useState(-1),[je,Me]=X.useState(-1),[Ne,Pe]=X.useState(!1),[U,Re]=X.useState(()=>new Map),[ze,Be]=X.useState([void 0,void 0]),G=h(e=>{De(e),e!==-1&&Me(e)});ke(ye,te,R),he(R,()=>{se(L),me()?A.commit(R):A.commit(R,!0);let e=pe.initialValue,t;t=Array.isArray(R)&&Array.isArray(e)?!_i(R,e):R!==e,k(t)});let Ve=h(e=>{e&&(ye.current=e)}),He=Array.isArray(R),Ue=X.useMemo(()=>He?R.slice().sort(vi):[W(R,p,f)],[f,p,He,R]),We=h((e,t)=>{if(Number.isNaN(e)||Ei(e,R))return;let n=t??C(`none`,void 0,void 0,{activeThumbIndex:-1});we.current=n.reason;let r=n.event,i=new(r.constructor??Event)(r.type,r);Object.defineProperty(i,`target`,{writable:!0,value:{value:e,name:L}}),n.event=i,B.current=e,ie(e,n),!n.isCanceled&&_e(e)}),Ge=h((e,t,n)=>{let r=bi(e,t,p,f,He,Ue);if(xi(r,S,m)){let e=Ti(n);We(r,C(e,n.nativeEvent,void 0,{activeThumbIndex:t})),O(!0),ae(B.current??r,i(e,n.nativeEvent))}});fe(()=>{let e=ne(j(ve.current));I&&b(ve.current,e)&&e.blur()},[I]),I&&H!==-1&&G(-1);let Ke=X.useMemo(()=>({...ce,activeThumbIndex:H,disabled:I,dragging:Ne,orientation:x,max:f,min:p,minStepsBetweenValues:m,step:S,values:Ue}),[ce,H,I,Ne,f,p,m,x,S,Ue]),qe=X.useMemo(()=>({active:H,controlRef:ye,disabled:I,dragging:Ne,validation:A,formatOptionsRef:Ee,handleInputChange:Ge,indicatorPosition:ze,inset:T!==`center`,labelId:F,rootLabelId:re,largeStep:l,lastUsedThumbIndex:je,lastChangedValueRef:B,lastChangeReasonRef:we,form:g,locale:u,max:f,min:p,minStepsBetweenValues:m,name:L,onValueCommitted:ae,orientation:x,pressedInputRef:be,pressedThumbCenterOffsetRef:xe,pressedThumbIndexRef:Se,pressedValuesRef:Ce,registerFieldControlRef:Ve,renderBeforeHydration:T===`edge`,setActive:G,setDragging:Pe,setIndicatorPosition:Be,setLabelId:P,setValue:We,state:Ke,step:S,thumbCollisionBehavior:w,thumbMap:U,thumbRefs:z,values:Ue}),[H,ye,F,re,I,Ne,A,Ee,Ge,ze,l,je,B,we,g,u,f,p,m,L,ae,x,be,xe,Se,Ce,Ve,G,Pe,Be,P,We,Ke,S,w,T,U,z,Ue]),Je=ge(`div`,e,{state:Ke,ref:[t,ve],props:[{"aria-labelledby":F,id:te,role:`group`},A.getValidationProps,D],stateAttributesMapping:Si});return(0,Z.jsx)(Ci.Provider,{value:qe,children:(0,Z.jsx)(Te,{elementsRef:z,onMapChange:Re,children:Je})})});function Oi(e){let t=e.getBoundingClientRect();return{x:(t.left+t.right)/2,y:(t.top+t.bottom)/2}}function ki(e){if(e===0)return 0;if(Math.abs(e)<1){let t=e.toExponential().split(`e-`),n=t[0].split(`.`)[1];return(n?n.length:0)+parseInt(t[1],10)}let t=e.toString().split(`.`)[1];return t?t.length:0}function Ai(e,t,n){let r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Math.max(ki(t),ki(n))))}function ji({values:e,index:t,nextValue:n,min:r,max:i,step:a,minStepsBetweenValues:o,initialValues:s}){if(e.length===0)return[];let c=e.slice(),l=a*o,u=c.length-1,d=s??e;c[t]=W(n,r+t*l,i-(u-t)*l);for(let e=t+1;e<=u;e+=1){let t=c[e-1]+l,n=i-(u-e)*l,r=d[e]??c[e],a=Math.max(c[e],t);r<a&&(a=Math.max(r,t)),c[e]=W(a,t,n)}for(let e=t-1;e>=0;--e){let t=c[e+1]-l,n=r+e*l,i=d[e]??c[e],a=Math.min(c[e],t);i>a&&(a=Math.min(i,t)),c[e]=W(a,n,t)}for(let e=0;e<=u;e+=1)c[e]=Number(c[e].toFixed(12));return c}function Mi({behavior:e,values:t,currentValues:n,initialValues:r,pressedIndex:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}){let u=n??t,d=r??t;if(!(u.length>1))return{value:a,thumbIndex:0,didSwap:!1};let f=c*l;switch(e){case`swap`:{let e=u[i],t=1e-7,n=u.slice(),r=n[i-1],p=n[i+1],m=W(a,r==null?o:r+f,p==null?s:p-f),h=Number(m.toFixed(12));n[i]=h;let g=a>e,_=a<e,v=g&&p!=null&&a>=p-t,y=_&&r!=null&&a<=r+t;if(!v&&!y)return{value:n,thumbIndex:i,didSwap:!1};let b=v?i+1:i-1,x=n.map((e,t)=>t===i?h:d[t]??u[t]),S=a;S=v?Math.max(a,n[b]):Math.min(a,n[b]);let C=ji({values:n,index:b,nextValue:S,min:o,max:s,step:c,minStepsBetweenValues:l,initialValues:x}),w=v?b-1:b+1;if(w>=0&&w<C.length){let e=C[w-1],t=C[w+1],n=e==null?o:e+f;n=Math.max(n,o+w*f);let r=t==null?s:t-f;r=Math.min(r,s-(C.length-1-w)*f);let i=W(h,n,r);C[w]=Number(i.toFixed(12))}return{value:C,thumbIndex:b,didSwap:!0}}case`push`:return{value:ji({values:u,index:i,nextValue:a,min:o,max:s,step:c,minStepsBetweenValues:l}),thumbIndex:i,didSwap:!1};default:{let e=u.slice(),t=e[i-1],n=e[i+1],r=W(a,t==null?o:t+f,n==null?s:n-f);return e[i]=Number(r.toFixed(12)),{value:e,thumbIndex:i,didSwap:!1}}}}var Ni=2;function Pi(e,t){if(!e)return{start:0,end:0};function n(e){let t=e==null?0:parseFloat(e);return Number.isNaN(t)?0:t}let r=t?`Top`:`InlineStart`,i=t?`Bottom`:`InlineEnd`;return{start:n(e[`border${r}Width`])+n(e[`padding${r}`]),end:n(e[`border${i}Width`])+n(e[`padding${i}`])}}function Fi(e,t){if(t.current!=null&&e.changedTouches){let n=e;for(let e=0;e<n.changedTouches.length;e+=1){let r=n.changedTouches[e];if(r.identifier===t.current)return{x:r.clientX,y:r.clientY}}return null}return{x:e.clientX,y:e.clientY}}var Ii=X.forwardRef(function(e,n){let{render:r,className:a,style:o,...s}=e,{disabled:l,dragging:u,inset:f,lastChangedValueRef:p,lastChangeReasonRef:m,max:g,min:v,minStepsBetweenValues:y,onValueCommitted:x,orientation:S,pressedInputRef:w,pressedThumbCenterOffsetRef:T,pressedThumbIndexRef:E,pressedValuesRef:D,registerFieldControlRef:te,renderBeforeHydration:re,setActive:ie,setDragging:ae,setValue:ce,state:le,step:ue,thumbCollisionBehavior:de,thumbRefs:O,values:k}=wi(),fe=se(),pe=k.length>1,me=S===`vertical`,A=X.useRef(null),M=X.useRef(null),he=h(e=>{e&&M.current==null&&(M.current=c(e).getComputedStyle(e))}),N=X.useRef(null),F=X.useRef(0),L=X.useRef(0),R=oe(k);function _e(e){E.current!==e&&(E.current=e);let t=O.current[e];if(!t){T.current=null,w.current=null;return}w.current=t.querySelector(`input[type="range"]`)}function ve(e){let t=A.current;if(!t)return null;let{width:n,height:r,bottom:i,left:a,right:o}=t.getBoundingClientRect(),s=Pi(M.current,me),c=L.current,l=(me?r:n)-s.start-s.end-c*2,u=T.current??0,d=e.x-u,f=e.y-u,p=W(((me?i-f-s.end:(fe===`rtl`?o-d:d-a)-s.start)-c)/l,0,1),m=(g-v)*p+v;if(m=Ai(m,ue,v),m=W(m,v,g),!pe)return{value:m,thumbIndex:0,didSwap:!1};let h=E.current;if(h<0)return null;let _=Mi({behavior:de,values:k,currentValues:R.current??k,initialValues:D.current,pressedIndex:h,nextValue:m,min:v,max:g,step:ue,minStepsBetweenValues:y});return de===`swap`&&_.didSwap?_e(_.thumbIndex):E.current=_.thumbIndex,_}function ye(e){D.current=pe?k.slice():null,R.current=k;let t=E.current,n=t;if(t>-1&&t<k.length){if(k[t]===g){let e=t;for(;e>0&&k[e-1]===g;)--e;n=e}}else{let t=me?`y`:`x`,r;n=-1;for(let i=0;i<O.current.length;i+=1){let a=O.current[i];if(d(a)){let o=Oi(a),s=Math.abs(e[t]-o[t]);(r===void 0||s<=r)&&(n=i,r=s)}}}if(n>-1&&n!==t&&_e(n),f){let e=O.current[n];d(e)&&(L.current=e.getBoundingClientRect()[me?`height`:`width`]/2)}}function z(e){let t=O.current?.[e]?.querySelector(`input[type="range"]`);t&&t.focus({preventScroll:!0,focusVisible:!1})}let be=h(e=>{let t=Fi(e,N);if(t==null)return;if(F.current+=1,e.type===`pointermove`&&e.buttons===0){xe(e);return}let n=ve(t);n!=null&&xi(n.value,ue,y)&&(!u&&F.current>Ni&&ae(!0),ce(n.value,C(_,e,void 0,{activeThumbIndex:n.thumbIndex})),R.current=Array.isArray(n.value)?n.value:[n.value],n.didSwap&&z(n.thumbIndex))});function xe(e){ie(-1),ae(!1),w.current=null,T.current=null;let t=Fi(e,N),n=t==null?null:ve(t);if(n!=null){let t=m.current;x(p.current??n.value,i(t,e))}`pointerType`in e&&A.current?.hasPointerCapture(e.pointerId)&&A.current?.releasePointerCapture(e.pointerId),E.current=-1,N.current=null,D.current=null,Ce()}let Se=h(e=>{if(l)return;let t=e.changedTouches[0];t!=null&&(N.current=t.identifier);let n=Fi(e,N);if(n!=null){ye(n);let t=ve(n);if(t==null)return;z(t.thumbIndex),ce(t.value,C(ee,e,void 0,{activeThumbIndex:t.thumbIndex})),R.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&z(t.thumbIndex)}F.current=0;let r=j(A.current);r.addEventListener(`touchmove`,be,{passive:!0}),r.addEventListener(`touchend`,xe,{passive:!0})}),Ce=h(()=>{let e=j(A.current);e.removeEventListener(`pointermove`,be),e.removeEventListener(`pointerup`,xe),e.removeEventListener(`touchmove`,be),e.removeEventListener(`touchend`,xe),D.current=null}),B=I();return X.useEffect(()=>{let e=A.current;if(!e)return()=>Ce();let t=P(e,`touchstart`,Se,{passive:!0});return()=>{t(),B.cancel(),Ce()}},[Ce,Se,A,B]),X.useEffect(()=>{l&&Ce()},[l,Ce]),ge(`div`,e,{state:le,ref:[n,te,A,he],props:[{"data-base-ui-slider-control":re?``:void 0,onPointerDown(e){let n=A.current,r=t(e.nativeEvent);if(!n||l||e.defaultPrevented||!d(r)||e.button!==0)return;let i=Fi(e,N);if(i!=null){ye(i);let t=ve(i);if(t==null)return;b(O.current[t.thumbIndex],ne(j(n)))?e.preventDefault():B.request(()=>{z(t.thumbIndex)}),ae(!0),T.current??(ce(t.value,C(ee,e.nativeEvent,void 0,{activeThumbIndex:t.thumbIndex})),R.current=Array.isArray(t.value)?t.value:[t.value],t.didSwap&&z(t.thumbIndex))}e.nativeEvent.pointerId&&n.setPointerCapture(e.nativeEvent.pointerId),F.current=0;let a=j(A.current);a.addEventListener(`pointermove`,be,{passive:!0}),a.addEventListener(`pointerup`,xe,{once:!0})}},s],stateAttributesMapping:Si})}),Li=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=wi();return ge(`div`,e,{state:o,ref:t,props:[{style:{position:`relative`}},a],stateAttributesMapping:Si})}),Ri=function(e){return e.index=`data-index`,e.dragging=`data-dragging`,e.orientation=`data-orientation`,e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.focused=`data-focused`,e}({}),zi=new Set([...f,T,l]);function Bi(e,t,n,r){if(!(t<0))return e.length===2?t===0?`${Pn(e[t],r,n)} start range`:`${Pn(e[t],r,n)} end range`:n?Pn(e[t],r,n):void 0}function Vi(e,t,n,r,i){let a=n===1?e+t:e-t;return W(Number(a.toFixed(Math.max(ki(e),ki(t),ki(r)))),r,i)}var Hi=X.forwardRef(function(e,t){let{render:r,children:i,className:a,"aria-describedby":o,"aria-label":d,"aria-labelledby":p,disabled:g=!1,getAriaLabel:_,getAriaValueText:y,id:b,index:S,inputRef:C,onBlur:ee,onFocus:E,onKeyDown:D,tabIndex:ne,style:re,...ie}=e,{nonce:ae}=Me(),oe=le(b),{active:ce,lastUsedThumbIndex:ue,controlRef:O,disabled:k,validation:pe,formatOptionsRef:me,handleInputChange:A,inset:j,labelId:M,largeStep:he,locale:N,max:P,min:F,minStepsBetweenValues:I,form:L,name:R,orientation:_e,pressedInputRef:ve,pressedThumbCenterOffsetRef:ye,pressedThumbIndexRef:z,renderBeforeHydration:be,setActive:xe,setIndicatorPosition:Se,state:Ce,step:B,values:V}=wi(),Te=se(),Ee=g||k,H=V.length>1,De=_e===`vertical`,ke=Te===`rtl`,{setTouched:Ae,setFocused:je,validationMode:Pe}=Oe(),Fe=X.useRef(null),Ie=X.useRef(null),Le=X.useRef(!1),U=le(),W=Ne(),Re=H?U:W,{ref:ze,index:Be}=we({metadata:X.useMemo(()=>({inputId:Re}),[Re])}),G=H?S??Be:0,Ve=G===V.length-1,He=V[G],Ue=Fn(He,F,P),[We,Ge]=X.useState(),Ke=$n(),qe=ue>=0&&ue<V.length?ue:-1,Je=h(()=>{let e=O.current,t=Fe.current;if(!e||!t)return;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=De?`height`:`width`,a=r[i]-n[i],o=(n[i]/2+a*Ue/100)/r[i]*100,s=Number.isFinite(o)?o:void 0;Ge(s),G===0?Se(e=>[s,e[1]]):Ve&&Se(e=>[e[0],s])});fe(()=>{j&&queueMicrotask(Je)},[Je,j]),fe(()=>{j&&Je()},[Je,j,Ue]),fe(()=>{if(!j)return;let e=O.current,t=Fe.current;if(!e||!t)return;let n=c(e).ResizeObserver;if(typeof n!=`function`)return;let r=new n(Je);return r.observe(e),r.observe(t),()=>{r.disconnect()}},[O,Je,j]);let Ye=De?`bottom`:`insetInlineStart`,Xe=De?`left`:`top`,Ze;H?ce===G?Ze=2:qe===G&&(Ze=1):ce===G&&(Ze=1);let Qe;Qe=j?{"--position":`${We??0}%`,visibility:be&&Ke||We===void 0?`hidden`:void 0,position:`absolute`,[Ye]:`var(--position)`,[Xe]:`50%`,translate:`${(De||!ke?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ze}:Number.isFinite(Ue)?{position:`absolute`,[Ye]:`${Ue}%`,[Xe]:`50%`,translate:`${(De||!ke?-1:1)*50}% ${(De?1:-1)*50}%`,zIndex:Ze}:de;let $e;_e===`vertical`&&($e=ke?`vertical-rl`:`vertical-lr`);let et=typeof _==`function`?_(G):d,tt=n({"aria-label":et,"aria-labelledby":p??(et==null?M:void 0),"aria-describedby":o,"aria-orientation":_e,"aria-valuenow":He,"aria-valuetext":typeof y==`function`?y(Pn(He,N,me.current??void 0),He,G):Bi(V,G,me.current??void 0,N),disabled:Ee,form:L,id:Re,max:P,min:F,name:R,onChange(e){A(e.currentTarget.valueAsNumber,G,e)},onFocus(e){let t=Le.current;Le.current=!1,xe(G),je(!0),t&&e.stopPropagation()},onBlur(e){if(Le.current){e.stopPropagation();return}Fe.current&&(xe(-1),Ae(!0),je(!1),Pe===`onBlur`&&pe.commit(bi(He,G,F,P,H,V)))},onKeyDown(e){if(!zi.has(e.key))return;f.has(e.key)&&e.stopPropagation();let t=null,n=Ai(He,B,F);switch(e.key){case u:t=Vi(n,e.shiftKey?he:B,1,F,P);break;case s:t=Vi(n,e.shiftKey?he:B,ke?-1:1,F,P);break;case m:t=Vi(n,e.shiftKey?he:B,-1,F,P);break;case v:t=Vi(n,e.shiftKey?he:B,ke?1:-1,F,P);break;case T:t=Vi(n,he,1,F,P);break;case l:t=Vi(n,he,-1,F,P);break;case`End`:t=P,H&&(t=Number.isFinite(V[G+1])?V[G+1]-B*I:P);break;case x:t=F,H&&(t=Number.isFinite(V[G-1])?V[G-1]+B*I:F);break;default:break}if(t!==null){let n=e.currentTarget;te(n)||(Le.current=!0,n.blur(),n.focus({preventScroll:!0,focusVisible:!0})),A(t,G,e),e.preventDefault()}},step:B,style:{...de,width:`100%`,height:`100%`,writingMode:$e},tabIndex:ne??void 0,type:`range`,value:He??``},pe.getInputValidationProps),nt=w(Ie,pe.inputRef,C);return ge(`div`,e,{state:Ce,ref:[t,ze,Fe],props:[{[Ri.index]:G,children:(0,Z.jsxs)(X.Fragment,{children:[i,(0,Z.jsx)(`input`,{ref:nt,...tt,suppressHydrationWarning:!0}),j&&Ke&&be&&Ve&&(0,Z.jsx)(`script`,{nonce:ae,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();'},suppressHydrationWarning:!0})]}),id:oe,onBlur:ee,onFocus:E,onPointerDown(e){if(z.current=G,Fe.current!=null){let t=_e===`horizontal`?`x`:`y`,n=Oi(Fe.current);ye.current=(_e===`horizontal`?e.clientX:e.clientY)-n[t]}Ie.current!=null&&ve.current!==Ie.current&&(ve.current=Ie.current)},style:Qe,suppressHydrationWarning:be||void 0},ie],stateAttributesMapping:Si})});function Ui(e,t,n,r,i,a){let o=n===void 0||t&&r===void 0?`hidden`:void 0,s=e?`bottom`:`insetInlineStart`,c=e?`height`:`width`,l={visibility:i&&a?`hidden`:o,position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};return l[`--start-position`]=`${n??0}%`,t?(l[`--relative-size`]=`${(r??0)-(n??0)}%`,l[s]=`var(--start-position)`,l[c]=`var(--relative-size)`,l):(l[s]=0,l[c]=`var(--start-position)`,l)}function Wi(e,t,n,r){let i=e?`bottom`:`insetInlineStart`,a=e?`height`:`width`,o={position:e?`absolute`:`relative`,[e?`width`:`height`]:`inherit`};if(!t)return o[i]=0,o[a]=`${n}%`,o;let s=r-n;return o[i]=`${n}%`,o[a]=`${s}%`,o}var Gi=X.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{indicatorPosition:o,inset:s,max:c,min:l,orientation:u,renderBeforeHydration:d,state:f,values:p}=wi(),m=$n(),h=u===`vertical`,g=p.length>1,_=s?Ui(h,g,o[0],o[1],d,m):Wi(h,g,Fn(p[0],l,c),Fn(p[p.length-1],l,c));return ge(`div`,e,{state:f,ref:t,props:[{"data-base-ui-slider-indicator":d?``:void 0,style:_,suppressHydrationWarning:d||void 0},a],stateAttributesMapping:Si})});function Ki({className:e,defaultValue:t,value:n,min:r=0,max:i=100,...a}){let o=Array.isArray(n)?n:n===void 0?Array.isArray(t)?t:t===void 0?[r]:[t]:[n];return(0,Z.jsx)(Di,{className:M(`data-horizontal:w-full data-vertical:h-full`,e),"data-slot":`slider`,defaultValue:t,value:n,min:r,max:i,thumbAlignment:`edge`,...a,children:(0,Z.jsxs)(Ii,{className:`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,children:[(0,Z.jsx)(Li,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-primary/20 select-none data-horizontal:h-1.5 data-horizontal:w-full data-vertical:h-full data-vertical:w-1.5`,children:(0,Z.jsx)(Gi,{"data-slot":`slider-range`,className:`bg-primary select-none data-horizontal:h-full data-vertical:w-full`})}),Array.from({length:o.length},(e,t)=>(0,Z.jsx)(Hi,{"data-slot":`slider-thumb`,className:`relative block size-4 shrink-0 rounded-full border border-primary/50 bg-background shadow transition-colors select-none after:absolute after:-inset-2 max-md:after:-inset-3.5 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-disabled:pointer-events-none data-disabled:opacity-50`},t))]})})}var qi=[{label:`Move bundle`,value:`move`},{label:`Copy bundle`,value:`copy`}],Ji=e=>({enabled:e.enabled,message:e.message??``,rolloutCohortCount:e.rollout_cohort_count,shouldForceUpdate:e.should_force_update,targetAppVersion:e.target_app_version??``,targetCohorts:[...e.target_cohorts]}),Yi=(e,t)=>({enabled:t.enabled,message:t.message.trim()||null,rolloutCohortCount:t.rolloutCohortCount,shouldForceUpdate:t.shouldForceUpdate,...e.strategy===`APP_VERSION`?{targetAppVersion:t.targetAppVersion.trim()}:{},targetCohorts:t.targetCohorts}),Xi=e=>(e/10).toFixed(1),Zi=e=>{let t=e.replace(`,`,`.`),[n=``,...r]=t.split(`.`),i=n.replace(/\D/g,``).slice(0,3),a=r.join(``).replace(/\D/g,``).slice(0,1);return t.includes(`.`)?`${i}.${a}`:i},Qi=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.min(1e3,Math.max(0,Math.trunc(t*10))):null};function $i({value:e,onChange:t}){let[n,r]=(0,X.useState)(Xi(e)),[i,a]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{i||r(Xi(e))},[i,e]),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(Ki,{"aria-label":`Rollout percentage`,max:1e3,min:0,onValueChange:n=>t(Array.isArray(n)?n[0]??e:n),step:1,value:e}),(0,Z.jsxs)(at,{className:`w-24 shrink-0`,children:[(0,Z.jsx)(tt,{"aria-label":`Rollout percentage`,autoComplete:`off`,className:`text-right tabular-nums`,id:`release-rollout-percentage`,inputMode:`decimal`,name:`rolloutPercentage`,onBlur:()=>{let i=Qi(n)??e;a(!1),r(Xi(i)),t(i)},onChange:e=>{let n=Zi(e.target.value);r(n);let i=Qi(n);i!==null&&t(i)},onFocus:()=>a(!0),value:n}),(0,Z.jsx)(nt,{align:`inline-end`,children:(0,Z.jsx)(et,{children:`%`})})]})]})}function ea({channels:t,onOpenChange:n,onShowScope:i,open:a,releaseId:o}){let s=Ft(o),c=s.data,l=Ut(c?.bundle_id??``),u=l.data,d=u?yt(u):null,f=Yt(c?.scope_key??``),p=qt(),m=It(),h=zt(),g=Kt(),[_,v]=(0,X.useState)(null),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(``),[w,T]=(0,X.useState)(!1),[ee,E]=(0,X.useState)(!1),[D,te]=(0,X.useState)(!1),[ne,ie]=(0,X.useState)(``),[oe,se]=(0,X.useState)(`move`);(0,X.useEffect)(()=>{v(c?Ji(c):null),C(``)},[c]);let le=c?Ji(c):null,de=_!==null&&le!==null&&JSON.stringify(_)!==JSON.stringify(le),k=m.isPending||p.isPending||h.isPending||g.isPending,fe=()=>{if(!k){if(de){T(!0);return}n(!1)}},pe=()=>{if(!_)return;let e=St(b);if(!bt(e)){C(Ct);return}v({..._,targetCohorts:Array.from(new Set([..._.targetCohorts,e]))}),x(``),C(``)},me=async()=>{if(!c||!_)return;let e=_.targetCohorts.map(St);if(e.some(e=>!bt(e))){C(Ct);return}if(c.strategy===`APP_VERSION`&&!di(_.targetAppVersion.trim())){C(`Enter a valid target app version range.`);return}let t={expectedRevision:c.revision,patch:Yi(c,{..._,targetCohorts:e}),releaseId:c.id};C(``);try{await m.mutateAsync(t),await p.mutateAsync(t),q.success(`Bundle settings saved`),n(!1)}catch(e){C(e instanceof Error?e.message:`Bundle settings could not be saved.`)}},j=t.find(e=>e.id===c?.channel_id)?.name??c?.channel_id,M=t.filter(e=>e.id!==c?.channel_id),he=M.map(e=>({label:e.name,value:e.name})),N=ne.trim(),P=oe===`copy`,ge=_?di(_.targetAppVersion.trim()):null,I=()=>{ie(``),se(`move`)},L=e=>{!e&&g.isPending||(te(e),e||I())};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ue,{onOpenChange:e=>e?void 0:fe(),open:a,children:(0,Z.jsxs)(re,{className:`min-w-0 overflow-hidden data-[side=right]:w-full sm:max-w-[600px]`,children:[(0,Z.jsxs)(F,{className:`shrink-0 pr-12`,children:[(0,Z.jsx)(ae,{children:`Bundle Detail`}),(0,Z.jsx)(A,{className:`sr-only`,children:`Edit bundle delivery settings.`}),c?(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 flex-col gap-3 text-sm`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(on,{className:`size-4`,platform:c.platform}),(0,Z.jsx)(`span`,{className:`font-medium`,children:c.platform===`ios`?`iOS`:`Android`})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`ID`}),(0,Z.jsxs)(`span`,{className:`min-w-0 basis-full sm:basis-auto`,children:[(0,Z.jsx)(vn,{bundleId:c.id,fullOnMobile:!0,maxLength:18}),c.bundle_id?null:(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:`Built-in bundle`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Channel`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,translate:`no`,children:j})]}),j?(0,Z.jsx)(gi,{bundle:u,channel:j,release:c}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:`Platform`}),(0,Z.jsx)(`span`,{className:`text-xs text-foreground`,children:c.platform===`ios`?`iOS`:`Android`})]})]}):(0,Z.jsx)(e,{className:`h-12 w-full`})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[s.isError?(0,Z.jsxs)(dt,{className:`m-4 sm:m-6`,variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Bundle details could not be loaded`}),(0,Z.jsx)(ut,{children:s.error.message})]}):null,c&&_?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6 px-4 pb-4 sm:px-6 sm:pb-6`,children:[j?(0,Z.jsx)(ve,{release:{platform:c.platform,channel:j,releaseId:c.id,builtIn:!c.bundle_id}}):null,(0,Z.jsxs)(`section`,{"aria-labelledby":`delivery-settings-heading`,className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,id:`delivery-settings-heading`,children:`Delivery settings`}),(0,Z.jsxs)(At,{className:`gap-6`,children:[(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-message`,children:`Message`}),(0,Z.jsx)(rt,{autoComplete:`off`,id:`release-message`,name:`message`,onChange:e=>v({..._,message:e.target.value}),rows:3,value:_.message})]}),c.strategy===`APP_VERSION`?(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-target`,children:`Target app version`}),(0,Z.jsx)(y,{autoComplete:`off`,id:`release-target`,name:`targetAppVersion`,onChange:e=>v({..._,targetAppVersion:e.target.value}),value:_.targetAppVersion}),ge?(0,Z.jsx)(jt,{children:ge}):null]}):null,(0,Z.jsx)(Nt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-enabled`,children:`Enabled`}),(0,Z.jsx)(pt,{label:`About Enabled`,children:`Disabling rolls devices back to the previous enabled bundle on their next check, or to the built-in app when none remains.`})]}),(0,Z.jsx)(st,{"aria-label":`Enabled`,checked:_.enabled,id:`release-enabled`,name:`enabled`,onCheckedChange:e=>v({..._,enabled:e})})]})}),(0,Z.jsx)(Nt,{children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-force-update`,children:`Force update`}),(0,Z.jsx)(pt,{label:`About Force update`,children:`Devices apply this bundle right away, and so do devices that skip it to update straight to a newer bundle.`})]}),(0,Z.jsx)(st,{"aria-label":`Force update`,checked:_.shouldForceUpdate,id:`release-force-update`,name:`shouldForceUpdate`,onCheckedChange:e=>v({..._,shouldForceUpdate:e})})]})}),(0,Z.jsxs)(Nt,{children:[(0,Z.jsx)(Ot,{htmlFor:`release-rollout-percentage`,children:`Rollout percentage`}),(0,Z.jsx)($i,{onChange:e=>v({..._,rolloutCohortCount:e}),value:_.rolloutCohortCount})]}),(0,Z.jsxs)(Nt,{children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(Ot,{htmlFor:`release-cohort`,children:`Additional cohorts (optional)`}),(0,Z.jsx)(hi,{releaseId:c.id,rolloutCohortCount:_.rolloutCohortCount,targetCohorts:_.targetCohorts})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(y,{autoComplete:`off`,id:`release-cohort`,name:`targetCohort`,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),pe())},placeholder:`e.g. qa-team…`,value:b}),(0,Z.jsx)(O,{"aria-label":`Add cohort`,className:`max-md:size-11`,disabled:!b.trim(),onClick:pe,size:`icon`,type:`button`,variant:`outline`,children:(0,Z.jsx)($e,{})})]}),_.targetCohorts.length?(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.targetCohorts.map(e=>(0,Z.jsxs)(K,{className:`gap-1 font-mono`,variant:`secondary`,children:[e,(0,Z.jsx)(`button`,{"aria-label":`Remove cohort ${e}`,className:`rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>v({..._,targetCohorts:_.targetCohorts.filter(t=>t!==e)}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]},e))}):null,(0,Z.jsx)(jt,{children:`Public names—no IDs or secrets.`})]})]}),S?(0,Z.jsx)(Mt,{children:S}):null,(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:!de||k,onClick:me,size:`lg`,children:m.isPending||p.isPending?`Saving…`:`Save changes`})]}),(0,Z.jsx)(ce,{className:`my-2`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Actions`}),(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:!c.bundle_id||k,onClick:()=>te(!0),size:`sm`,variant:`outline`,children:`Promote to channel`}),c.bundle_id?(0,Z.jsxs)(O,{className:`w-full max-md:h-11`,disabled:k,onClick:()=>{window.open(`/api/bundles/${encodeURIComponent(c.bundle_id)}/download`,`_blank`,`noopener,noreferrer`),q.success(`Bundle download started`)},size:`sm`,variant:`outline`,children:[(0,Z.jsx)(He,{"data-icon":`inline-start`}),`Download manifest`]}):null,(0,Z.jsx)(O,{className:`w-full max-md:h-11`,disabled:c.enabled||k,onClick:()=>E(!0),size:`sm`,variant:`destructive`,children:`Remove from channel`})]}),c.bundle_id&&l.isPending?(0,Z.jsx)(e,{className:`h-40 w-full`}):null,c.bundle_id&&l.isError?(0,Z.jsxs)(dt,{variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Build details are unavailable`}),(0,Z.jsx)(ut,{children:`Delivery settings are unaffected.`})]}):null,!c.bundle_id||!l.isPending?(0,Z.jsx)(pi,{bundle:u,release:c}):null,(0,Z.jsxs)(`details`,{className:`rounded-lg border bg-muted/10 p-4 text-xs`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:`Advanced diagnostics`}),(0,Z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.bundle_id??`Built-in bundle`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Revision`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:c.revision})]}),d?(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Patch base artifact ID`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:d})]}):null,(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog generation`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?.generation??`—`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{children:`Catalog size`}),(0,Z.jsx)(`dd`,{className:`mt-1 font-mono text-foreground`,children:f.data?`${f.data.byte_size} bytes`:`—`})]}),(0,Z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,Z.jsx)(`dt`,{children:`Scope key`}),(0,Z.jsx)(`dd`,{className:`mt-1 break-all font-mono text-foreground`,children:c.scope_key}),i?(0,Z.jsx)(O,{className:`mt-1 h-auto px-0 text-xs max-md:min-h-11`,onClick:()=>i(c.scope_key),size:`sm`,variant:`link`,children:`Show bundles for this target`}):null]})]}),f.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-destructive`,children:`Diagnostics are unavailable. Bundle settings are unaffected.`}):null]})]}):null]})]})}),(0,Z.jsx)(rn,{onOpenChange:T,open:w,children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsx)(Qt,{children:`Discard unsaved changes?`}),(0,Z.jsx)(Xt,{children:`Your Bundle changes will be lost.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{children:`Keep editing`}),(0,Z.jsx)($t,{onClick:()=>{T(!1),n(!1)},variant:`destructive`,children:`Discard changes`})]})]})}),(0,Z.jsx)(rn,{onOpenChange:E,open:ee,children:(0,Z.jsxs)(Zt,{children:[(0,Z.jsxs)(nn,{children:[(0,Z.jsxs)(Qt,{children:[`Remove this Bundle from `,j??`the channel`,`?`]}),(0,Z.jsx)(Xt,{children:`The uploaded artifact stays available. This only removes the Bundle from the channel.`})]}),(0,Z.jsxs)(en,{children:[(0,Z.jsx)(tn,{children:`Cancel`}),(0,Z.jsx)($t,{onClick:async()=>{if(c)try{await h.mutateAsync({expectedRevision:c.revision,releaseId:c.id}),q.success(`Bundle removed from ${j??`the channel`}`),E(!1),n(!1)}catch(e){C(e instanceof Error?e.message:`Bundle could not be removed from the channel.`)}},variant:`destructive`,children:`Remove from channel`})]})]})}),(0,Z.jsx)(pn,{onOpenChange:L,open:D,children:(0,Z.jsxs)(ln,{showCloseButton:!g.isPending,children:[(0,Z.jsxs)(sn,{children:[(0,Z.jsx)(un,{children:`Promote to Channel`}),(0,Z.jsx)(dn,{children:`Choose how to promote this Bundle, then select the target channel.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(kt,{htmlFor:`promote-action`,children:`Action`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:qi,onValueChange:e=>se(e),value:oe,children:[(0,Z.jsx)(Pe,{className:`w-full`,id:`promote-action`,children:(0,Z.jsx)(ze,{placeholder:`Select an action`})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`move`,children:`Move bundle`}),(0,Z.jsx)(U,{value:`copy`,children:`Copy bundle`})]})})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:P?`Make this Bundle available in the target channel and keep it in the current channel.`:`Move this Bundle to the target channel. Devices in the current channel may fall back to an earlier Bundle.`})]}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(kt,{htmlFor:`target-channel`,children:`Target Channel`}),(0,Z.jsxs)(G,{disabled:g.isPending,items:he,onValueChange:e=>ie(e??``),value:ne||null,children:[(0,Z.jsx)(Pe,{className:`w-full`,id:`target-channel`,children:(0,Z.jsx)(ze,{placeholder:`Select a channel`})}),(0,Z.jsx)(Re,{className:`max-h-64`,children:(0,Z.jsx)(Be,{children:M.map(e=>(0,Z.jsx)(U,{value:e.name,children:e.name},e.id))})})]})]})]}),(0,Z.jsxs)(cn,{children:[(0,Z.jsx)(O,{disabled:g.isPending,onClick:()=>L(!1),variant:`outline`,children:`Cancel`}),(0,Z.jsx)(O,{disabled:!N||g.isPending,onClick:async()=>{if(c)try{await g.mutateAsync({action:oe,expectedRevision:c.revision,releaseId:c.id,targetChannel:N}),L(!1),q.success(P?`Bundle copied to ${N}`:`Bundle moved to ${N}`)}catch(e){q.error(e instanceof Error?e.message:`Bundle could not be promoted.`)}},children:g.isPending?P?`Copying…`:`Moving…`:P?`Copy`:`Move`})]})]})})]})}function ta({release:e}){return(0,Z.jsxs)(K,{className:`gap-1 font-normal text-muted-foreground`,variant:e.enabled?`outline`:`secondary`,children:[e.enabled?(0,Z.jsx)(Ce,{className:`size-3`}):(0,Z.jsx)(Ve,{className:`size-3`}),e.enabled?`Enabled`:`Disabled`]})}var na={one:`unreachable bundle`,other:`unreachable bundles`},ra=[{label:`iOS`,value:`ios`},{label:`Android`,value:`android`}],ia=[{label:`Any Status`,value:`all`},{label:`Enabled`,value:`enabled`},{label:`Disabled`,value:`disabled`}];function aa({channels:e,onChange:t,onClear:n,onManageChannels:i,search:a}){let o=z(a),s=a.channelId!==void 0,c=[{label:`All Channels`,value:`all`},...e.map(e=>({label:e.name,value:e.id}))];return(0,Z.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-2 border-b bg-background px-3 py-3 sm:h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:py-0 sm:backdrop-blur-sm`,children:[(0,Z.jsx)(me,{className:`-ml-1 size-11 lg:size-7`}),(0,Z.jsx)(`h1`,{className:`sr-only`,children:`Bundles`}),(0,Z.jsxs)(`div`,{className:`ml-1 flex items-center gap-1.5 text-muted-foreground sm:ml-2`,children:[(0,Z.jsx)(Gn,{className:`size-3.5`}),(0,Z.jsx)(`span`,{className:`text-xs font-medium`,children:`Filters`})]}),(0,Z.jsxs)(G,{items:c,onValueChange:e=>t({channelId:e===null||e===`all`?void 0:e}),value:a.channelId??`all`,children:[(0,Z.jsx)(Pe,{"aria-label":`Channel`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`all`,children:`All Channels`}),e.map(e=>(0,Z.jsx)(U,{value:e.id,children:e.name},e.id))]})})]}),(0,Z.jsxs)(G,{disabled:!s,items:ra,onValueChange:e=>t({platform:e===`android`?`android`:`ios`}),value:a.platform??`ios`,children:[(0,Z.jsx)(Pe,{"aria-label":`Platform`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,title:s?void 0:`Choose a channel first`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`ios`,children:`iOS`}),(0,Z.jsx)(U,{value:`android`,children:`Android`})]})})]}),(0,Z.jsxs)(G,{disabled:!s&&a.scopeKey===void 0,items:ia,onValueChange:e=>t({enabled:e===`enabled`?!0:e===`disabled`?!1:void 0}),value:a.enabled===void 0?`all`:a.enabled?`enabled`:`disabled`,children:[(0,Z.jsx)(Pe,{"aria-label":`Status`,className:`w-[calc(50%-0.25rem)] min-w-[132px] text-xs data-[size=default]:h-11 max-sm:order-2 sm:w-[140px] sm:data-[size=default]:h-8`,children:(0,Z.jsx)(ze,{})}),(0,Z.jsx)(Re,{children:(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(U,{value:`all`,children:`Any Status`}),(0,Z.jsx)(U,{value:`enabled`,children:`Enabled`}),(0,Z.jsx)(U,{value:`disabled`,children:`Disabled`})]})})]}),(0,Z.jsx)(O,{"aria-label":`Manage channels`,className:`size-11 max-sm:order-1 sm:size-7`,onClick:i,size:`icon-sm`,title:`Manage channels`,variant:`outline`,children:(0,Z.jsx)(Jn,{})}),a.bundleId?(0,Z.jsxs)(K,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Artifact filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear artifact filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>t({bundleId:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,a.scopeKey?(0,Z.jsxs)(K,{className:`max-w-48 gap-1 max-sm:order-3`,variant:`secondary`,children:[`Target filter`,(0,Z.jsx)(`button`,{"aria-label":`Clear target filter`,className:`relative rounded-sm after:absolute after:-inset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:after:hidden`,onClick:()=>t({scopeKey:void 0}),type:`button`,children:(0,Z.jsx)(r,{className:`size-3`})})]}):null,o?(0,Z.jsxs)(O,{className:`h-11 px-2 text-xs text-muted-foreground hover:text-foreground max-sm:order-3 sm:ml-auto sm:h-8`,onClick:n,size:`sm`,variant:`ghost`,children:[(0,Z.jsx)(r,{"data-icon":`inline-start`}),`Clear`]}):null]})}function oa({expanded:e,onOpen:t,onToggleExpand:n,release:r}){let i=r.operation===`PROMOTE`?`Promoted`:r.operation===`ROLLBACK`?`Rollback`:null;return(0,Z.jsxs)(`div`,{className:`flex min-w-[240px] items-center gap-3`,children:[r.bundle_id?(0,Z.jsx)(O,{"aria-controls":`bundle-lineage-panel-${r.id}`,"aria-expanded":e,"aria-label":e?`Hide advanced artifact diagnostics`:`Show advanced artifact diagnostics`,title:`Advanced artifact diagnostics`,className:`size-11 shrink-0 touch-manipulation sm:size-8`,onClick:n,size:`icon`,type:`button`,variant:`ghost`,children:e?(0,Z.jsx)(B,{}):(0,Z.jsx)(De,{})}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-11 shrink-0 sm:size-8`}),(0,Z.jsxs)(`button`,{"aria-label":`Open details for ID ${r.id}`,className:`min-w-0 rounded-sm text-left text-foreground transition-colors underline-offset-4 hover:text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:t,title:r.id,type:`button`,children:[(0,Z.jsx)(vn,{bundleId:r.id,fullOnMobile:!0}),r.bundle_id?null:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-sm`,children:[(0,Z.jsx)(it,{className:`size-3.5`}),` Built-in bundle`]})]}),i?(0,Z.jsx)(K,{className:`shrink-0 font-normal`,variant:`secondary`,children:i}):null,r.currentlyUnreachable?(0,Z.jsx)(Wn,{icon:Ve,label:`Unreachable: no device gets this bundle with the current delivery settings.`,reason:`No device gets this bundle with the current delivery settings.`,children:`Unreachable`}):null]})}function sa({onDetailClick:t,panelId:n,release:r}){let i=r.bundle_id??``,a=Ut(i),o=Vt(i);return a.isError||o.isError?(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Patch lineage could not be loaded.`}):a.isPending?(0,Z.jsxs)(`div`,{"aria-live":`polite`,className:`flex flex-col gap-2 border-t bg-muted/10 p-4`,id:n,children:[(0,Z.jsx)(e,{className:`h-10 w-full`}),(0,Z.jsx)(e,{className:`h-10 w-full`})]}):a.data?(0,Z.jsx)(tr,{bundle:a.data,bundles:o.data??[],loading:o.isPending,onDetailClick:t,panelId:n}):(0,Z.jsx)(`div`,{"aria-live":`polite`,className:`border-t bg-muted/10 p-4 text-sm text-muted-foreground`,id:n,children:`Bundle details are unavailable.`})}function ca(e,t){return{patchCounts:Gt(Array.from(new Set(e.flatMap(e=>e.bundle_id?[e.bundle_id]:[])))).data??{},slotReleases:e.flatMap(e=>{let n=t.find(t=>t.id===e.channel_id)?.name;return n?[{releaseId:e.id,platform:e.platform,channel:n,builtIn:!e.bundle_id}]:[]})}}var la=(e,t)=>t>=e.to&&(e.from===void 0||t<e.from);function ua({fold:e,filter:t,channels:n,columns:r,isMobile:i,open:a,onOpenChange:o,render:s}){let c=Rt(t,{...e.from===void 0?{}:{from:e.from},to:e.to},a),l=c.data?.pages.flatMap(e=>e.rows)??[],u=ca(l,n),d=i?void 0:r,f=c.isError?(0,Z.jsx)(Rn,{columns:d,label:`Unreachable bundles`,onRetry:()=>void c.refetch(),state:`error`}):c.isPending||c.isFetchingNextPage?(0,Z.jsx)(Rn,{columns:d,label:`Loading unreachable bundles`,state:`loading`}):c.hasNextPage?(0,Z.jsx)(Rn,{columns:d,label:`Unreachable bundles`,onMore:()=>void c.fetchNextPage(),state:`more`}):null,p={label:Vn(e,na),open:a,onOpenChange:o,panelId:`bundle-fold-${e.to}`};return i?(0,Z.jsxs)(Bn,{...p,children:[l.map(e=>s(e,u)),f]}):(0,Z.jsxs)(Hn,{...p,columns:r,children:[l.map(e=>s(e,u)),f]})}function da(){let e=Se.useSearch(),t=Se.useNavigate(),n=k(),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(),s=zn(),c=be(e),l=Pt({afterReleaseId:e.afterReleaseId,beforeReleaseId:e.beforeReleaseId,filter:c,releaseId:e.releaseId}),u=Bt().data??[],d=l.data?.entries??[],f=d.flatMap(e=>e.kind===`row`?[e.row]:[]),p=ca(f,u),m=l.data?.next,h=l.data?.previous,g=xe(),_=10+g.length,v=new Map(u.map(e=>[e.id,e.name])),y=a!==void 0&&(e=>f.some(t=>t.id===e)||d.some(t=>t.kind===`fold`&&s.isOpen(In(t))&&la(t,e)))(a);(0,X.useEffect)(()=>{a!==void 0&&!y&&o(void 0)},[a,y]);let b=(e,n=!0)=>void t({resetScroll:n,search:e,to:`/`}),x=t=>b(ye(e,t)),S=t=>{f.some(({id:e})=>e===t.id)||s.set(t.id,!0),b({...e,releaseId:t.id},!1)},C=t=>{let n=f.find(e=>e.bundle_id===t.id);if(o(void 0),n){b({...e,releaseId:n.id},!1);return}x({bundleId:t.id})},w=e.afterReleaseId!==void 0||e.beforeReleaseId!==void 0,T=h?{...e,afterReleaseId:`after`in h?h.after:void 0,beforeReleaseId:`before`in h?h.before:void 0,releaseId:void 0}:null,ee=m?{...e,afterReleaseId:void 0,beforeReleaseId:m,releaseId:void 0}:null,E={...e,afterReleaseId:void 0,beforeReleaseId:void 0,releaseId:void 0},D=(t,n)=>{let r=v.get(t.channel_id)??t.channel_id,i=t.bundle_id?n.patchCounts[t.bundle_id]:0,s=y&&a===t.id,c=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(En,{"aria-label":`Bundle ${t.id}`,className:M(`gap-3`,t.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,s&&`border-b-0 bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onClick:On(()=>S(t)),children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsx)(oa,{expanded:s,onOpen:()=>S(t),onToggleExpand:()=>o(s?void 0:t.id),release:t}),(0,Z.jsx)(yn,{channel:r,className:`shrink-0`})]}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-foreground`,children:[(0,Z.jsx)(on,{className:`size-4`,platform:t.platform}),t.platform===`ios`?`iOS`:`Android`]}),i===void 0||i>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(`span`,{children:i===void 0?`Checking patches`:`${i} ${i===1?`patch`:`patches`}`})]}):null,(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Z.jsx)(jn,{ms:t.created_at_ms})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-xs`,children:[(0,Z.jsx)(Ke,{percentage:t.rollout_cohort_count/10}),(0,Z.jsx)(ta,{release:t}),t.should_force_update?(0,Z.jsx)(K,{variant:`secondary`,children:`Force update`}):null,(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:`Target `}),(0,Z.jsx)(H,{appVersion:t.target_app_version,fingerprintHash:t.fingerprint_hash})]})]}),g.map(({Cell:e,feature:r,label:i})=>(0,Z.jsxs)(`div`,{className:`mt-3 text-xs`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:i}),(0,Z.jsx)(e,{releaseId:t.id,releases:n.slotReleases})]},r)),t.message?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:t.message}):null]}),s&&t.bundle_id?(0,Z.jsx)(sa,{onDetailClick:C,panelId:c,release:t}):null]},t.id)},te=(t,n)=>{let r=y&&a===t.id,i=`bundle-lineage-panel-${t.id}`;return(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsxs)(Sn,{"aria-label":`Open bundle ${t.id}`,className:M(t.currentlyUnreachable&&`bg-muted/60 saturate-50 hover:bg-muted/60 hover:saturate-100 focus-within:saturate-100`,r&&`bg-primary/5`),"data-state":e.releaseId===t.id?`selected`:void 0,onOpen:()=>S(t),children:[(0,Z.jsx)(Y,{children:(0,Z.jsx)(oa,{expanded:r,onOpen:()=>S(t),onToggleExpand:()=>o(r?void 0:t.id),release:t})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(yn,{channel:v.get(t.channel_id)??t.channel_id})}),(0,Z.jsx)(Y,{className:`whitespace-nowrap`,children:(0,Z.jsx)(an,{platform:t.platform})}),(0,Z.jsx)(Y,{children:t.bundle_id&&n.patchCounts[t.bundle_id]===void 0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Checking`}):t.bundle_id&&n.patchCounts[t.bundle_id]>0?(0,Z.jsxs)(K,{variant:`secondary`,children:[n.patchCounts[t.bundle_id],` `,n.patchCounts[t.bundle_id]===1?`patch`:`patches`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`-`})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(H,{appVersion:t.target_app_version,fingerprintHash:t.fingerprint_hash})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(er,{enabled:t.enabled}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.enabled?`Enabled`:`Disabled`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsxs)(`span`,{className:`flex items-center`,children:[(0,Z.jsx)(er,{enabled:t.should_force_update,falseIcon:`minus`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t.should_force_update?`Required`:`Optional`})]})}),(0,Z.jsx)(Y,{children:(0,Z.jsx)(Ke,{percentage:t.rollout_cohort_count/10})}),g.map(({Cell:e,feature:r})=>(0,Z.jsx)(Y,{children:(0,Z.jsx)(e,{releaseId:t.id,releases:n.slotReleases})},r)),(0,Z.jsx)(Y,{className:`text-sm text-muted-foreground`,title:t.message??void 0,children:t.message||`-`}),(0,Z.jsx)(Y,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(jn,{ms:t.created_at_ms})})]}),r&&t.bundle_id?(0,Z.jsx)(gn,{className:`hover:bg-transparent`,children:(0,Z.jsx)(Y,{className:`border-t-0 p-0`,colSpan:_,children:(0,Z.jsx)(sa,{onDetailClick:C,panelId:i,release:t})})}):null]},t.id)},ne=(e,t)=>(0,Z.jsx)(ua,{channels:u,columns:_,filter:c,fold:e,isMobile:n,onOpenChange:t=>s.set(In(e),t),open:s.isOpen(In(e)),render:t},`fold-${e.to}`),re=(0,Z.jsx)(An,{icon:Xe,title:f.length===0&&d.length>0?`No device gets the bundles here`:w?`No more bundles`:z(e)?`No bundles match these filters`:`No bundles yet`,children:w?(0,Z.jsx)(L,{className:ie({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),search:E,to:`/`,children:`Show the newest bundles`}):z(e)?(0,Z.jsx)(O,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:()=>b({}),variant:`outline`,children:`Clear filters`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`Deploy one from your app's project:`}),(0,Z.jsx)(`div`,{className:`w-full text-left`,children:(0,Z.jsx)(Ee,{label:`the deploy command`,value:`npx hot-updater deploy`,wrap:!0})})]})});return(0,Z.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,Z.jsx)(aa,{channels:u,onChange:x,onClear:()=>b({}),onManageChannels:()=>i(!0),search:e}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-6 bg-muted/5 p-3 sm:p-6`,children:[l.isError?(0,Z.jsxs)(dt,{variant:`destructive`,children:[(0,Z.jsx)(ft,{}),(0,Z.jsx)(lt,{children:`Bundles could not be loaded`}),(0,Z.jsx)(ut,{children:l.error.message})]}):(0,Z.jsx)(xn,{children:n?(0,Z.jsx)(`div`,{className:`h-full overflow-y-auto`,children:l.isPending?(0,Z.jsx)(kn,{}):(0,Z.jsxs)(Z.Fragment,{children:[f.length===0?(0,Z.jsx)(wn,{children:re}):null,d.map(e=>e.kind===`row`?D(e.row,p):ne(e,D))]})}):(0,Z.jsx)(bn,{rowGroups:!0,header:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{children:`ID`}),(0,Z.jsx)(J,{children:`Channel`}),(0,Z.jsx)(J,{children:`Platform`}),(0,Z.jsx)(J,{children:`Patches`}),(0,Z.jsx)(J,{children:`Target`}),(0,Z.jsx)(J,{children:`Enabled`}),(0,Z.jsx)(J,{children:`Force update`}),(0,Z.jsx)(J,{children:`Rollout`}),g.map(({feature:e,label:t})=>(0,Z.jsx)(J,{children:t},e)),(0,Z.jsx)(J,{children:`Message`}),(0,Z.jsx)(J,{children:`Created`})]}),children:l.isPending?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(Cn,{columns:_})}):(0,Z.jsxs)(Z.Fragment,{children:[f.length===0?(0,Z.jsx)(Dn,{children:(0,Z.jsx)(Tn,{columns:_,children:re})}):null,Ln(d).map(e=>e.kind===`fold`?ne(e.fold,te):(0,Z.jsx)(Dn,{children:e.rows.map(e=>te(e,p))},`rows-${e.rows[0].id}`))]})})}),!l.isError&&!l.isPending?(0,Z.jsx)(Mn,{count:f.length,folded:{...Un(d),label:`unreachable`},label:`Bundle pagination`,noun:[`bundle`,`bundles`],pending:l.isPlaceholderData,newest:w?{search:E,to:`/`}:void 0,next:ee?{search:ee,to:`/`}:void 0,previous:T?{search:T,to:`/`}:void 0}):null]}),(0,Z.jsx)(ea,{channels:u,onOpenChange:t=>!t&&b({...e,releaseId:void 0},!1),onShowScope:e=>x({scopeKey:e}),open:!!e.releaseId,releaseId:e.releaseId??``}),(0,Z.jsx)(nr,{onOpenChange:i,open:r})]})}export{da as component};