@hot-updater/console 1.2.0-rc.13 → 1.2.0-rc.14

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 (186) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{-native-builds-search-DC2PutLU.js → -native-builds-search-OlRj4Jz0.js} +1 -1
  3. package/.output/public/assets/BundleIdDisplay-CP6rsdFO.js +1 -0
  4. package/.output/public/assets/{ConsoleFeatureUnavailable-oMmbaqF6.js → ConsoleFeatureUnavailable-DUqlpHCp.js} +1 -1
  5. package/.output/public/assets/EventDetails-Dcpdu7re.js +1 -0
  6. package/.output/public/assets/HashValueDisplay-MoZMmTeP.js +1 -0
  7. package/.output/public/assets/{InsightsPageHeader-q2FgL8xS.js → InsightsPageHeader-CSas9gM0.js} +1 -1
  8. package/.output/public/assets/{PlatformIcon-DCTtCP5t.js → PlatformIcon-CJ69KopR.js} +1 -1
  9. package/.output/public/assets/RelativeTime-CiZ7yXNJ.js +1 -0
  10. package/.output/public/assets/RolloutPercentageBadge-D-tZKnX7.js +1 -0
  11. package/.output/public/assets/StoreSubmission-F00RL5rI.js +1 -0
  12. package/.output/public/assets/TargetDisplay-CoYY8Fs4.js +1 -0
  13. package/.output/public/assets/api-keys-3IL4dIHe.js +1 -0
  14. package/.output/public/assets/api-keys-4w2-ofii.js +1 -0
  15. package/.output/public/assets/badge-laIuYW1U.js +1 -0
  16. package/.output/public/assets/card-ulgg5xHn.js +1 -0
  17. package/.output/public/assets/{index-t0CToN0S.js → index-Cde2QQJq.js} +3 -3
  18. package/.output/public/assets/insights-0TUItqwh.js +1 -0
  19. package/.output/public/assets/insights-DDRfERph.js +2 -0
  20. package/.output/public/assets/insights-_6iMn8GR.js +42 -0
  21. package/.output/public/assets/{insights-search-B5cZsP6C.js → insights-search-CYPrQVUC.js} +1 -1
  22. package/.output/public/assets/{insights-usage-rpc-zut_JaSS.js → insights-usage-rpc-BbFllvi_.js} +1 -1
  23. package/.output/public/assets/insights_.distribution-AZcfvK7x.js +1 -0
  24. package/.output/public/assets/insights_.distribution-BGAqgPi0.js +1 -0
  25. package/.output/public/assets/insights_.distribution-CjYkDRA4.js +2 -0
  26. package/.output/public/assets/installations-Ap2G2tDs.js +1 -0
  27. package/.output/public/assets/{installations-BRS-vuRJ.js → installations-CSZfo1rG.js} +2 -2
  28. package/.output/public/assets/installations-CwQYwQ6K.js +1 -0
  29. package/.output/public/assets/native-builds-cT9Ha-jZ.js +1 -0
  30. package/.output/public/assets/native-builds-v5wez34c.js +2 -0
  31. package/.output/public/assets/native-builds_._buildId-BBwE8Pcc.js +2 -0
  32. package/.output/public/assets/native-builds_._buildId-DZPcR_up.js +1 -0
  33. package/.output/public/assets/package-ytYrywZH.js +1 -0
  34. package/.output/public/assets/remote-config-CIAEArwq.js +1 -0
  35. package/.output/public/assets/{remote-config-DQguWTMa.js → remote-config-Dwdc-sij.js} +1 -1
  36. package/.output/public/assets/remote-config-ZJ_IRSKE.js +6 -0
  37. package/.output/public/assets/routes-BUWLcUqW.js +1 -0
  38. package/.output/public/assets/routes-Rtz-KcQO.js +2 -0
  39. package/.output/public/assets/styles-bNNic0NS.css +2 -0
  40. package/.output/public/assets/valueToPercent-B6X9rUJM.js +1 -0
  41. package/.output/server/{__23tanstack-start-server-fn-resolver-DI0OnlQe.mjs → __23tanstack-start-server-fn-resolver-BD3yIgQW.mjs} +49 -49
  42. package/.output/server/_libs/_.mjs +1 -1
  43. package/.output/server/_libs/lucide-react.mjs +1 -27
  44. package/.output/server/_ssr/{BundleIdDisplay-SAvC-NlE.mjs → BundleIdDisplay-Di0dxxxD.mjs} +2 -2
  45. package/.output/server/_ssr/{ConsoleFeatureUnavailable-BgHEoZ36.mjs → ConsoleFeatureUnavailable-BJM23Zg6.mjs} +6 -6
  46. package/.output/server/_ssr/{EventDetails-VaS25yjE.mjs → EventDetails-BatEDlOf.mjs} +7 -7
  47. package/.output/server/_ssr/{HashValueDisplay-BGc-x_l8.mjs → HashValueDisplay-DoVLNSRc.mjs} +6 -6
  48. package/.output/server/_ssr/{InsightsPageHeader-gMuNJt-f.mjs → InsightsPageHeader--Lsgjvy7.mjs} +6 -6
  49. package/.output/server/_ssr/{NotFoundPage-DsRI-J4h.mjs → NotFoundPage-DsX6EelI.mjs} +2 -2
  50. package/.output/server/_ssr/{PlatformIcon-BsU0d0jN.mjs → PlatformIcon-Cuhy0CIO.mjs} +12 -2
  51. package/.output/server/_ssr/RelativeTime-BVQMmkQi.mjs +209 -0
  52. package/.output/server/_ssr/{git-WSg7LY17.mjs → RolloutPercentageBadge-B5_ASwiR.mjs} +18 -2
  53. package/.output/server/_ssr/StoreSubmission-B-oliflh.mjs +65 -0
  54. package/.output/server/_ssr/TargetDisplay-Zy7Xom4-.mjs +100 -0
  55. package/.output/server/_ssr/{alert-dialog-lury59vV.mjs → alert-dialog-C4wLRSPA.mjs} +1 -1
  56. package/.output/server/_ssr/{api-BQ8ztUgU.mjs → api-B9fz7k5l.mjs} +4 -4
  57. package/.output/server/_ssr/{api-keys-CHATVpa9.mjs → api-keys-CWRy6qIm.mjs} +2 -2
  58. package/.output/server/_ssr/{api-keys-DVChzF3r.mjs → api-keys-DSBFZRhe.mjs} +10 -9
  59. package/.output/server/_ssr/{api-keys-rpc-DXPJTfdr.mjs → api-keys-rpc-CWXJDGcR.mjs} +3 -3
  60. package/.output/server/_ssr/{api-rpc-BexxmTM9.mjs → api-rpc-DFAKchn0.mjs} +10 -10
  61. package/.output/server/_ssr/{auth-rpc-BgNCvy2L.mjs → auth-rpc-CCrZswwU.mjs} +4 -4
  62. package/.output/server/_ssr/{auth.server-43UW34Rd.mjs → auth.server-B_NFqTVL.mjs} +2 -2
  63. package/.output/server/_ssr/{badge-BYB825vl.mjs → badge-CrneyinM.mjs} +2 -44
  64. package/.output/server/_ssr/card-uJiVh8Ex.mjs +49 -0
  65. package/.output/server/_ssr/{config.server-QRTmD4Hf.mjs → config.server-DegewTDN.mjs} +3 -3
  66. package/.output/server/_ssr/{console-access-E91fYTIB.mjs → console-access-Dn2nyMoy.mjs} +2 -2
  67. package/.output/server/_ssr/{console-features-api-CLRjxvy2.mjs → console-features-api-XvLDCadj.mjs} +3 -3
  68. package/.output/server/_ssr/{console-features-rpc-C2rJ0u6i.mjs → console-features-rpc-BGj3a9MK.mjs} +3 -3
  69. package/.output/server/_ssr/{dialog-CcF1pxfR.mjs → dialog-Bd8rq2D6.mjs} +1 -1
  70. package/.output/server/_ssr/{empty-DkiJ7nWt.mjs → empty-CxQ3tY82.mjs} +2 -2
  71. package/.output/server/_ssr/{field-CHlDI06h.mjs → field-BO99RT90.mjs} +2 -2
  72. package/.output/server/_ssr/{input-group-BPZ4UtB5.mjs → input-group-DTHYcd9a.mjs} +1 -1
  73. package/.output/server/_ssr/{insights-B3YetvBK.mjs → insights-2DKWoVb_.mjs} +5 -5
  74. package/.output/server/_ssr/{insights-Dn32lJ18.mjs → insights-B7__SQut.mjs} +2 -2
  75. package/.output/server/_ssr/{insights-CEABWFk4.mjs → insights-BxElDwIK.mjs} +21 -20
  76. package/.output/server/_ssr/{insights-api-CYPf5853.mjs → insights-api-BJcM3WZe.mjs} +3 -3
  77. package/.output/server/_ssr/{insights-failures-rpc-CxPpBR1K.mjs → insights-failures-rpc-Waj0XZKw.mjs} +4 -4
  78. package/.output/server/_ssr/{insights-recovery-rpc-CwnQMTE3.mjs → insights-recovery-rpc-DrPel0ob.mjs} +3 -3
  79. package/.output/server/_ssr/{insights-rpc-CKd5ATFI.mjs → insights-rpc-ETBGnpx2.mjs} +3 -3
  80. package/.output/server/_ssr/{insights-search-B_92_iEj.mjs → insights-search-Dm005qPB.mjs} +2 -2
  81. package/.output/server/_ssr/{insights-usage-rpc-RIMNhPtj.mjs → insights-usage-rpc-DLReOGQK.mjs} +3 -3
  82. package/.output/server/_ssr/{insights-usage-rpc-D90uHpJJ.mjs → insights-usage-rpc-SqWTs_Dy.mjs} +3 -3
  83. package/.output/server/_ssr/{insights_.distribution-D4QWsHNo.mjs → insights_.distribution-BEUt7pIk.mjs} +5 -5
  84. package/.output/server/_ssr/{insights_.distribution-D42mHSe0.mjs → insights_.distribution-B_FxGnXR.mjs} +15 -14
  85. package/.output/server/_ssr/{insights_.distribution-DwjIdjQi.mjs → insights_.distribution-CCxFQ1g_.mjs} +2 -2
  86. package/.output/server/_ssr/{installations-BIu66J6Q.mjs → installations-Bphhuxoy.mjs} +2 -2
  87. package/.output/server/_ssr/{installations-DyzKzWuv.mjs → installations-C9cYjLEo.mjs} +12 -12
  88. package/.output/server/_ssr/{installations-CfmO_V_R.mjs → installations-ChnSJFAp.mjs} +4 -4
  89. package/.output/server/_ssr/{native-builds-BCp8ICrn.mjs → native-builds-CCLcEAUo.mjs} +2 -2
  90. package/.output/server/_ssr/{native-builds-qj346atQ.mjs → native-builds-CWA9Y__P.mjs} +11 -10
  91. package/.output/server/_ssr/native-builds-vEUV8Jcd.mjs +548 -0
  92. package/.output/server/_ssr/{native-builds_._buildId-C8gsW-Rh.mjs → native-builds_._buildId-C-AS0ccm.mjs} +2 -2
  93. package/.output/server/_ssr/{native-builds_._buildId-BAxkkEFo.mjs → native-builds_._buildId-CDnSyuLI.mjs} +107 -58
  94. package/.output/server/_ssr/{nativeBuildDevice-nU480p5A.mjs → nativeBuildDevice-Dn16gNmZ.mjs} +2 -2
  95. package/.output/server/_ssr/{nativeBuildDownloadLink-c3tcq3G5.mjs → nativeBuildDownloadLink-XqrSsk2n.mjs} +2 -2
  96. package/.output/server/_ssr/{nativeBuildInstall-B-_lHDsS.mjs → nativeBuildInstall-DqyrDtdY.mjs} +4 -4
  97. package/.output/server/_ssr/{nativeBuildQr-C5AFtpmE.mjs → nativeBuildQr-P9qKcI7l.mjs} +2 -2
  98. package/.output/server/_ssr/{nativeBuilds-CbxOJDhO.mjs → nativeBuilds-ByQdDnHG.mjs} +2 -2
  99. package/.output/server/_ssr/{release-adoption-rpc-BBwJO2hu.mjs → release-adoption-rpc-DUnqLbyh.mjs} +5 -5
  100. package/.output/server/_ssr/{remote-config-B1g7vrQD.mjs → remote-config-DC9HsCJa.mjs} +2 -2
  101. package/.output/server/_ssr/{remote-config-BDijmvj1.mjs → remote-config-Db3pXNkQ.mjs} +2 -2
  102. package/.output/server/_ssr/{remote-config-DjeXVIcr.mjs → remote-config-jOKasCsC.mjs} +19 -18
  103. package/.output/server/_ssr/{remote-config-rpc-B7bzKw4N.mjs → remote-config-rpc-D4rLBAC7.mjs} +3 -3
  104. package/.output/server/_ssr/{router-DhxgFNWn.mjs → router-B3iMYd1N.mjs} +28 -28
  105. package/.output/server/_ssr/{routes-BC-rBuu_.mjs → routes-BHhqwGpi.mjs} +254 -377
  106. package/.output/server/_ssr/{routes-BDriEBtF.mjs → routes-Bpb4VcCf.mjs} +10 -14
  107. package/.output/server/_ssr/{schema-migration-rpc-CNMqY0RE.mjs → schema-migration-rpc-BY84M6ZD.mjs} +3 -3
  108. package/.output/server/_ssr/{select-hFD2e3Bh.mjs → select-C_ARCTCI.mjs} +2 -2
  109. package/.output/server/_ssr/{server-D_hG9iIq.mjs → server-yFcuyI0b.mjs} +4 -4
  110. package/.output/server/_ssr/{sidebar-Dmq4j1qr.mjs → sidebar-CFRWCQFu.mjs} +2 -2
  111. package/.output/server/_ssr/ssr.mjs +1 -1
  112. package/.output/server/_ssr/{start-RjhaPVFE.mjs → start-C0XSSCq4.mjs} +1 -1
  113. package/.output/server/_ssr/{switch-CkNsEp9k.mjs → switch-DS2sIZvU.mjs} +2 -2
  114. package/.output/server/_ssr/{table-CTtXogFJ.mjs → table-C4kXCYKR.mjs} +1 -1
  115. package/.output/server/_ssr/{tabs-BTKDM4AJ.mjs → tabs-DxOJdu7O.mjs} +2 -2
  116. package/.output/server/_tanstack-start-manifest_v-AYP07Vaf.mjs +194 -0
  117. package/.output/server/index.mjs +305 -284
  118. package/package.json +7 -7
  119. package/src/components/ChannelBadge.tsx +9 -9
  120. package/src/components/DataTable.tsx +303 -0
  121. package/src/components/HashValueDisplay.tsx +6 -3
  122. package/src/components/PlatformIcon.tsx +10 -0
  123. package/src/components/RelativeTime.tsx +31 -0
  124. package/src/components/TargetDisplay.tsx +69 -0
  125. package/src/components/features/channels/ChannelManagementDialog.tsx +3 -8
  126. package/src/components/features/insights/ReleaseActivity.tsx +1 -1
  127. package/src/components/features/native-builds/BuiltInBundleCard.tsx +29 -28
  128. package/src/components/features/native-builds/CommitLink.tsx +1 -1
  129. package/src/components/features/native-builds/ImportBuild.tsx +1 -1
  130. package/src/components/features/native-builds/NativeBuildDetailPage.tsx +4 -1
  131. package/src/components/features/native-builds/NativeBuildsPage.tsx +63 -76
  132. package/src/components/features/native-builds/NativeBuildsTable.tsx +435 -317
  133. package/src/components/features/native-builds/ShortHash.tsx +1 -1
  134. package/src/components/features/native-builds/StoreSubmission.tsx +11 -2
  135. package/src/lib/native-builds.ts +22 -6
  136. package/src/routes/index.tsx +290 -429
  137. package/src/styles.css +16 -0
  138. package/.output/public/assets/EventDetails-ly7ygfdH.js +0 -1
  139. package/.output/public/assets/HashValueDisplay-BNoXZADg.js +0 -1
  140. package/.output/public/assets/RolloutPercentageBadge-frllRncE.js +0 -1
  141. package/.output/public/assets/StoreSubmission-D8BGGGgn.js +0 -1
  142. package/.output/public/assets/api-keys-B0N3SixL.js +0 -1
  143. package/.output/public/assets/api-keys-DFAOfU4U.js +0 -1
  144. package/.output/public/assets/badge-UNnTz4Dl.js +0 -1
  145. package/.output/public/assets/download-Cf24LBde.js +0 -1
  146. package/.output/public/assets/insights-B0_8xNxr.js +0 -1
  147. package/.output/public/assets/insights-BbIzm_QG.js +0 -42
  148. package/.output/public/assets/insights-BtmYg4vg.js +0 -2
  149. package/.output/public/assets/insights_.distribution-DLxq-IKU.js +0 -1
  150. package/.output/public/assets/insights_.distribution-izFBYfJL.js +0 -2
  151. package/.output/public/assets/insights_.distribution-rdeyNhH2.js +0 -1
  152. package/.output/public/assets/installations-CWx7vYY5.js +0 -1
  153. package/.output/public/assets/installations-Ce_dTa35.js +0 -1
  154. package/.output/public/assets/native-builds-Br0onFRc.js +0 -2
  155. package/.output/public/assets/native-builds-CDYL3y0I.js +0 -1
  156. package/.output/public/assets/native-builds-DEWHul-_.js +0 -1
  157. package/.output/public/assets/native-builds_._buildId-D1XEPQ-V.js +0 -1
  158. package/.output/public/assets/native-builds_._buildId-x-uu1Vbr.js +0 -2
  159. package/.output/public/assets/remote-config-Bw6sErCV.js +0 -6
  160. package/.output/public/assets/remote-config-S3xj8r3x.js +0 -1
  161. package/.output/public/assets/routes-Dw8zgqXz.js +0 -2
  162. package/.output/public/assets/routes-nKCEKnhh.js +0 -1
  163. package/.output/public/assets/styles-uK-0vUMk.css +0 -2
  164. package/.output/public/assets/valueToPercent-DRLgSP0P.js +0 -1
  165. package/.output/server/_ssr/RolloutPercentageBadge-axz7VuIZ.mjs +0 -21
  166. package/.output/server/_ssr/StoreSubmission-BqXKtpqW.mjs +0 -139
  167. package/.output/server/_ssr/native-builds-CqFeXByK.mjs +0 -514
  168. package/.output/server/_tanstack-start-manifest_v-BuGAtKIu.mjs +0 -189
  169. /package/.output/public/assets/{NotFoundPage-fiaucvsO.js → NotFoundPage-Ckb5GMhh.js} +0 -0
  170. /package/.output/public/assets/{alert-dialog-Z_RNBrFc.js → alert-dialog-DiRLrFVe.js} +0 -0
  171. /package/.output/public/assets/{api-BEEYDSCX.js → api-LQJH44FU.js} +0 -0
  172. /package/.output/public/assets/{dialog-C2U9bINi.js → dialog-CLIaC82_.js} +0 -0
  173. /package/.output/public/assets/{dist-UQUhRoJi.js → dist-Bf1BPKMs.js} +0 -0
  174. /package/.output/public/assets/{empty-PAp07lsC.js → empty-Bhlj8PEo.js} +0 -0
  175. /package/.output/public/assets/{field-DhKRWFG5.js → field-q4sTYzNU.js} +0 -0
  176. /package/.output/public/assets/{input-group-BJfBVqeI.js → input-group-D_NfhUbX.js} +0 -0
  177. /package/.output/public/assets/{refresh-cw-C6svDMfM.js → refresh-cw-C-tvoCcE.js} +0 -0
  178. /package/.output/public/assets/{relativeTime-BscR0TsX.js → relativeTime-DvyxGIsm.js} +0 -0
  179. /package/.output/public/assets/{rotate-cw-CxFW64IG.js → rotate-cw-Clk5xTeE.js} +0 -0
  180. /package/.output/public/assets/{search-bIYGuFCt.js → search-nnvSOTEB.js} +0 -0
  181. /package/.output/public/assets/{smartphone-Bn5FtEwt.js → smartphone-r0rRdPas.js} +0 -0
  182. /package/.output/public/assets/{switch-DtUu1RCw.js → switch-CP6GsHmN.js} +0 -0
  183. /package/.output/public/assets/{table-B22H8-RL.js → table-TUtVz-2l.js} +0 -0
  184. /package/.output/public/assets/{tabs-Fgz3sA51.js → tabs-CP3CSmtI.js} +0 -0
  185. /package/.output/public/assets/{undo-2-7gOxArtb.js → undo-2-Bt0YXG26.js} +0 -0
  186. /package/.output/public/assets/{uuidv7-BLyD3pAM.js → uuidv7-cI6C63Fm.js} +0 -0
@@ -1 +1 @@
1
- import{Fn as e,Wr as t,ii as n,it as r,nt as i,ti as a,tt as o}from"./sidebar-Di9SN47G.js";import{b as s}from"./insights-api-BVCXJsoV.js";import{m as c,t as l}from"./uuidv7-BLyD3pAM.js";var u=n(a(),1),d=t();function f({label:t,children:n}){let a=(0,u.useId)(),[c,l]=(0,u.useState)(!1);return(0,d.jsxs)(o,{open:c,onOpenChange:l,triggerId:a,children:[(0,d.jsx)(r,{id:a,"aria-describedby":c?`${a}-description`:void 0,closeOnClick:!1,onClick:()=>l(e=>!e),render:(0,d.jsx)(e,{"aria-label":t,className:`size-11 sm:size-7`,size:`icon`,variant:`ghost`}),children:(0,d.jsx)(s,{})}),(0,d.jsx)(i,{id:`${a}-description`,role:`tooltip`,className:`max-w-64`,side:`bottom`,children:n})]})}var p=e=>typeof e==`string`&&e.trim().length>0&&e.length<=1024?e:void 0,m=e=>e===`24h`||e===`7d`||e===`30d`?e:void 0,h=e=>e===`adoption`||e===`crashes`?e:void 0,g=e=>e===`12m`?e:m(e),_=`production`,v=e=>e===`all`||e===`ios`||e===`android`?e:void 0;function y(e){return{platform:v(e.platform),channel:p(e.channel),appVersion:p(e.appVersion),window:g(e.window),bundleWindow:m(e.bundleWindow),releaseId:p(e.releaseId),healthChart:h(e.healthChart),bundles:p(e.bundles)}}function b(e){return{...y(e),version:p(e.version),page:typeof e.page==`number`&&Number.isSafeInteger(e.page)&&e.page>0?e.page:void 0}}function x(e,t=Date.now()){if(!c(e))return`7d`;let n=t-l(e);return n<=864e5?`24h`:n<=7*864e5?`7d`:`30d`}var S=e=>e===void 0?void 0:[...new Set(e.split(`,`).filter(e=>e.length>0))];export{y as a,b as i,x as n,f as o,S as r,_ as t};
1
+ import{Fn as e,Wr as t,ii as n,it as r,nt as i,ti as a,tt as o}from"./sidebar-Di9SN47G.js";import{b as s}from"./insights-api-BVCXJsoV.js";import{m as c,t as l}from"./uuidv7-cI6C63Fm.js";var u=n(a(),1),d=t();function f({label:t,children:n}){let a=(0,u.useId)(),[c,l]=(0,u.useState)(!1);return(0,d.jsxs)(o,{open:c,onOpenChange:l,triggerId:a,children:[(0,d.jsx)(r,{id:a,"aria-describedby":c?`${a}-description`:void 0,closeOnClick:!1,onClick:()=>l(e=>!e),render:(0,d.jsx)(e,{"aria-label":t,className:`size-11 sm:size-7`,size:`icon`,variant:`ghost`}),children:(0,d.jsx)(s,{})}),(0,d.jsx)(i,{id:`${a}-description`,role:`tooltip`,className:`max-w-64`,side:`bottom`,children:n})]})}var p=e=>typeof e==`string`&&e.trim().length>0&&e.length<=1024?e:void 0,m=e=>e===`24h`||e===`7d`||e===`30d`?e:void 0,h=e=>e===`adoption`||e===`crashes`?e:void 0,g=e=>e===`12m`?e:m(e),_=`production`,v=e=>e===`all`||e===`ios`||e===`android`?e:void 0;function y(e){return{platform:v(e.platform),channel:p(e.channel),appVersion:p(e.appVersion),window:g(e.window),bundleWindow:m(e.bundleWindow),releaseId:p(e.releaseId),healthChart:h(e.healthChart),bundles:p(e.bundles)}}function b(e){return{...y(e),version:p(e.version),page:typeof e.page==`number`&&Number.isSafeInteger(e.page)&&e.page>0?e.page:void 0}}function x(e,t=Date.now()){if(!c(e))return`7d`;let n=t-l(e);return n<=864e5?`24h`:n<=7*864e5?`7d`:`30d`}var S=e=>e===void 0?void 0:[...new Set(e.split(`,`).filter(e=>e.length>0))];export{y as a,b as i,x as n,f as o,S as r,_ as t};
@@ -1 +1 @@
1
- import{Bn as e,Gr as t,Jn as n,Ln as r,Ut as i,Vr as a,Wr as o,ii as s,nr as c,qt as l,ti as u}from"./sidebar-Di9SN47G.js";import{r as d,t as f}from"./valueToPercent-DRLgSP0P.js";var p=s(u()),m=p.createContext(void 0);function h(){let e=p.useContext(m);if(e===void 0)throw Error(n(51));return e}var g=function(e){return e.complete=`data-complete`,e.indeterminate=`data-indeterminate`,e.progressing=`data-progressing`,e}({}),_={status(e){return e===`progressing`?{[g.progressing]:``}:e===`complete`?{[g.complete]:``}:e===`indeterminate`?{[g.indeterminate]:``}:null}},v=o();function y(e,t){return t==null?`indeterminate progress`:e||`${t}%`}var b=p.forwardRef(function(t,n){let{format:r,getAriaValueText:a=y,locale:o,max:s=100,min:c=0,value:u,render:f,className:h,children:g,style:b,...x}=t,[S,C]=p.useState(),w=l(r),T=`indeterminate`;Number.isFinite(u)&&(T=u===s?`complete`:`progressing`);let E=d(u,o,w.current),D=p.useMemo(()=>({status:T}),[T]),O={"aria-labelledby":S,"aria-valuemax":s,"aria-valuemin":c,"aria-valuenow":u??void 0,"aria-valuetext":a(E,u),role:`progressbar`,children:(0,v.jsxs)(p.Fragment,{children:[g,(0,v.jsx)(`span`,{role:`presentation`,style:i,children:`x`})]})},k=p.useMemo(()=>({formattedValue:E,max:s,min:c,setLabelId:C,state:D,status:T,value:u}),[E,s,c,C,D,T,u]),A=e(`div`,t,{state:D,ref:n,props:[O,x],stateAttributesMapping:_});return(0,v.jsx)(m.Provider,{value:k,children:A})}),x=p.forwardRef(function(t,n){let{render:r,className:i,style:a,...o}=t,{state:s}=h();return e(`div`,t,{state:s,ref:n,props:o,stateAttributesMapping:_})}),S=p.forwardRef(function(t,n){let{render:r,className:i,style:a,...o}=t,{max:s,min:c,value:l,state:u}=h(),d=Number.isFinite(l)&&l!==null?f(l,c,s):null;return e(`div`,t,{state:u,ref:n,props:[{style:d==null?{}:{insetInlineStart:0,height:`inherit`,width:`${d}%`}},o],stateAttributesMapping:_})});function C({className:e,children:t,value:n,...i}){return(0,v.jsxs)(b,{value:n,"data-slot":`progress`,className:r(`w-full`,e),...i,children:[t,(0,v.jsx)(w,{children:(0,v.jsx)(T,{})})]})}function w({className:e,...t}){return(0,v.jsx)(x,{className:r(`relative flex h-1 w-full items-center overflow-x-hidden rounded-md bg-muted`,e),"data-slot":`progress-track`,...t})}function T({className:e,...t}){return(0,v.jsx)(S,{"data-slot":`progress-indicator`,className:r(`h-full bg-primary transition-transform motion-reduce:transition-none`,e),...t})}var E=a({method:`GET`}).middleware([c]).handler(t(`8a98cd9c178e4a54185d62c25a95f09d3d59850c43d3f5baa1563e1614ad942e`));export{C as n,E as t};
1
+ import{Bn as e,Gr as t,Jn as n,Ln as r,Ut as i,Vr as a,Wr as o,ii as s,nr as c,qt as l,ti as u}from"./sidebar-Di9SN47G.js";import{r as d,t as f}from"./valueToPercent-B6X9rUJM.js";var p=s(u()),m=p.createContext(void 0);function h(){let e=p.useContext(m);if(e===void 0)throw Error(n(51));return e}var g=function(e){return e.complete=`data-complete`,e.indeterminate=`data-indeterminate`,e.progressing=`data-progressing`,e}({}),_={status(e){return e===`progressing`?{[g.progressing]:``}:e===`complete`?{[g.complete]:``}:e===`indeterminate`?{[g.indeterminate]:``}:null}},v=o();function y(e,t){return t==null?`indeterminate progress`:e||`${t}%`}var b=p.forwardRef(function(t,n){let{format:r,getAriaValueText:a=y,locale:o,max:s=100,min:c=0,value:u,render:f,className:h,children:g,style:b,...x}=t,[S,C]=p.useState(),w=l(r),T=`indeterminate`;Number.isFinite(u)&&(T=u===s?`complete`:`progressing`);let E=d(u,o,w.current),D=p.useMemo(()=>({status:T}),[T]),O={"aria-labelledby":S,"aria-valuemax":s,"aria-valuemin":c,"aria-valuenow":u??void 0,"aria-valuetext":a(E,u),role:`progressbar`,children:(0,v.jsxs)(p.Fragment,{children:[g,(0,v.jsx)(`span`,{role:`presentation`,style:i,children:`x`})]})},k=p.useMemo(()=>({formattedValue:E,max:s,min:c,setLabelId:C,state:D,status:T,value:u}),[E,s,c,C,D,T,u]),A=e(`div`,t,{state:D,ref:n,props:[O,x],stateAttributesMapping:_});return(0,v.jsx)(m.Provider,{value:k,children:A})}),x=p.forwardRef(function(t,n){let{render:r,className:i,style:a,...o}=t,{state:s}=h();return e(`div`,t,{state:s,ref:n,props:o,stateAttributesMapping:_})}),S=p.forwardRef(function(t,n){let{render:r,className:i,style:a,...o}=t,{max:s,min:c,value:l,state:u}=h(),d=Number.isFinite(l)&&l!==null?f(l,c,s):null;return e(`div`,t,{state:u,ref:n,props:[{style:d==null?{}:{insetInlineStart:0,height:`inherit`,width:`${d}%`}},o],stateAttributesMapping:_})});function C({className:e,children:t,value:n,...i}){return(0,v.jsxs)(b,{value:n,"data-slot":`progress`,className:r(`w-full`,e),...i,children:[t,(0,v.jsx)(w,{children:(0,v.jsx)(T,{})})]})}function w({className:e,...t}){return(0,v.jsx)(x,{className:r(`relative flex h-1 w-full items-center overflow-x-hidden rounded-md bg-muted`,e),"data-slot":`progress-track`,...t})}function T({className:e,...t}){return(0,v.jsx)(S,{"data-slot":`progress-indicator`,className:r(`h-full bg-primary transition-transform motion-reduce:transition-none`,e),...t})}var E=a({method:`GET`}).middleware([c]).handler(t(`8a98cd9c178e4a54185d62c25a95f09d3d59850c43d3f5baa1563e1614ad942e`));export{C as n,E as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-DUqlpHCp.js";var t=e;export{t as notFoundComponent};
@@ -0,0 +1 @@
1
+ import{$ as e,Fn as t,In as n,Wr as r,ar as i}from"./sidebar-Di9SN47G.js";import{t as a}from"./link-DTEyW70e.js";import{t as o}from"./arrow-left-g9cKqXuC.js";import{t as s}from"./arrow-up-right-DK8Zdg40.js";import{o as c,u as ee}from"./insights-api-BVCXJsoV.js";import{a as l,i as u,n as d,o as f,r as p,t as m}from"./select-CBIU0_M1.js";import{t as h}from"./rotate-cw-Clk5xTeE.js";import{a as g,i as _,n as v,t as y}from"./badge-laIuYW1U.js";import{a as te,o as ne}from"./insights-search-CYPrQVUC.js";import{a as re,i as b,n as x,o as S,t as C}from"./card-ulgg5xHn.js";import{i as w,o as T,r as E,t as D}from"./empty-Bhlj8PEo.js";import{t as O}from"./PlatformIcon-CJ69KopR.js";import{a as k,t as A}from"./field-q4sTYzNU.js";import{t as j}from"./insights_.distribution-CjYkDRA4.js";import{t as M}from"./BundleIdDisplay-CP6rsdFO.js";import{n as N,t as P}from"./insights-usage-rpc-BbFllvi_.js";import{c as ie,n as F,o as I,t as L}from"./InsightsPageHeader-CSas9gM0.js";var R=r(),z=20,B=new Intl.DateTimeFormat(`en`,{month:`short`,day:`numeric`,timeZone:`UTC`}),V=e=>e.releaseId??(e.builtinBundleId?`Built-in bundle ${e.builtinBundleId}`:`Unknown bundle`);function H({bundleId:e}){return(0,R.jsxs)(`div`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2 md:min-h-9`,children:[(0,R.jsx)(F,{}),(0,R.jsx)(M,{bundleId:e,className:`text-muted-foreground`})]})}function U(){let r=j.useSearch(),M=c(),F=j.useNavigate(),U={platform:r.platform??`all`,channel:r.channel??`production`,appVersion:r.appVersion,window:r.window??`24h`},W=i({queryKey:[`insights`,`app-usage`,U],queryFn:()=>P({data:U}),staleTime:3e4}),G=W.error?void 0:W.data,K=G?`since ${B.format(G.distributionSinceMs)}, 00:00 UTC`:`in this period`,q=(G?.bundleDistribution??[]).filter(e=>!r.version||e.appVersion===r.version),J=q.reduce((e,t)=>e+t.installations,0),Y=Math.max(1,Math.ceil(q.length/z)),X=Math.min(r.page??1,Y),Z=[...new Set([...G?.versions.map(e=>e.name)??[],...r.version?[r.version]:[]])],Q=te(r),$=e=>void F({search:{...r,page:void 0,...e}});return(0,R.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,R.jsx)(L,{view:`distribution`,overviewSearch:Q}),(0,R.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 px-4 py-6 sm:p-8`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col gap-6`,children:[(0,R.jsxs)(a,{to:`/insights`,search:Q,className:n({variant:`ghost`,className:`h-11 w-fit sm:h-9`}),children:[(0,R.jsx)(o,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Back to overview`]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,R.jsx)(`h2`,{className:`text-2xl font-semibold tracking-tight`,children:`Distribution`}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(I,{twelveMonths:ee(M),window:U.window,onWindowChange:e=>$({window:e})}),(0,R.jsx)(t,{"aria-label":`Refresh distribution`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,disabled:W.isFetching,onClick:()=>void W.refetch(),children:(0,R.jsx)(h,{"aria-hidden":`true`})})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-4`,children:[(0,R.jsxs)(A,{className:`w-full sm:w-64`,children:[(0,R.jsx)(k,{htmlFor:`distribution-version`,children:`App version`}),(0,R.jsxs)(m,{items:Object.fromEntries([[`all`,`All versions`],...Z.map(e=>[`version:${e}`,e])]),value:r.version?`version:${r.version}`:`all`,onValueChange:e=>{e!==null&&$({version:e===`all`?void 0:e.slice(8)})},children:[(0,R.jsx)(l,{id:`distribution-version`,className:`min-h-11 w-full sm:min-h-9`,children:(0,R.jsx)(f,{})}),(0,R.jsx)(d,{children:(0,R.jsxs)(p,{children:[(0,R.jsx)(u,{value:`all`,children:`All versions`}),Z.map(e=>(0,R.jsx)(u,{value:`version:${e}`,children:e},e))]})})]})]}),(0,R.jsxs)(`div`,{className:`flex min-h-9 flex-wrap items-center gap-2`,"aria-label":`Distribution scope`,children:[(0,R.jsxs)(y,{variant:`outline`,className:`gap-1.5`,children:[U.platform===`all`?null:(0,R.jsx)(O,{platform:U.platform,className:`size-3.5`}),U.platform===`all`?`All platforms`:U.platform===`ios`?`iOS`:`Android`]}),(0,R.jsx)(y,{variant:`outline`,children:U.channel}),U.appVersion?(0,R.jsxs)(y,{variant:`outline`,children:[`Reports from `,U.appVersion]}):null]})]}),(0,R.jsxs)(C,{"aria-label":`Bundles by app version`,role:`region`,className:`min-w-0`,children:[(0,R.jsxs)(re,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(S,{children:`Bundles by app version`}),(0,R.jsxs)(ne,{label:`How bundle distribution is counted`,children:[`Each installation counts once, by its latest report`,` `,K,`. Shares are within each app version. Built-in bundle: the bundle the native build shipped, by its ID. Unknown bundle: no deployment and no built-in bundle ID.`]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[W.isPending?(0,R.jsx)(e,{className:`h-9 w-16`}):(0,R.jsx)(`p`,{className:`text-3xl font-semibold tabular-nums`,children:G?`${G.truncated?`≥`:``}${J.toLocaleString()}`:`—`}),(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Reporting installations`})]})]}),(0,R.jsxs)(x,{className:`flex min-w-0 flex-col gap-4`,children:[G?.truncated?(0,R.jsxs)(v,{children:[(0,R.jsx)(g,{children:`Partial history`}),(0,R.jsxs)(_,{children:[`Counts and shares reflect reports since`,` `,new Date(G.sinceMs).toLocaleString(`en`,{timeZone:`UTC`}),` `,`UTC. Choose a shorter period for a more complete view.`]})]}):null,W.isPending?(0,R.jsx)(e,{"aria-label":`Loading bundle distribution`,className:`h-64`}):W.error?(0,R.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,R.jsx)(ie,{error:W.error,fallbackTitle:`Distribution unavailable`}),(0,R.jsx)(t,{variant:`outline`,onClick:()=>void W.refetch(),children:`Retry distribution`})]}):q.length===0?(0,R.jsxs)(D,{children:[(0,R.jsxs)(w,{children:[(0,R.jsx)(T,{children:`No bundles reported`}),(0,R.jsx)(E,{children:`Choose another version or period, or change the filters in the overview.`})]}),(0,R.jsx)(t,{variant:`outline`,onClick:()=>$({version:void 0}),children:`Show all versions`})]}):(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[8rem_minmax(0,1fr)_7rem_7rem] gap-4 border-b px-3 pb-3 text-xs text-muted-foreground md:grid`,children:[(0,R.jsx)(`span`,{children:`App version`}),(0,R.jsx)(`span`,{children:`Bundle ID`}),(0,R.jsx)(`span`,{className:`text-right`,children:`Active installations`}),(0,R.jsx)(`span`,{className:`text-right`,children:`Version share`})]}),(0,R.jsx)(`ul`,{"aria-label":`Bundle distribution`,className:`divide-y`,children:q.slice((X-1)*z,X*z).map(e=>{let t=G?.versions.find(t=>t.name===e.appVersion)?.installations??0,n=t>0?e.installations/t*100:0;return(0,R.jsxs)(`li`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-3 px-1 py-4 md:grid-cols-[8rem_minmax(0,1fr)_7rem_7rem] md:px-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-medium`,title:e.appVersion,children:e.appVersion}),(0,R.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(O,{platform:e.platform,className:`size-3.5`}),e.platform===`ios`?`iOS`:`Android`]})]}),(0,R.jsxs)(`div`,{className:`col-span-2 row-start-2 min-w-0 md:col-span-1 md:row-auto`,children:[e.releaseId?(0,R.jsxs)(a,{to:`/`,search:{releaseId:e.releaseId},"aria-label":`Review bundle ${e.releaseId} for app version ${e.appVersion}`,className:`flex min-h-11 min-w-0 items-center gap-2 text-xs underline-offset-4 hover:underline md:min-h-9`,children:[(0,R.jsx)(`span`,{className:`break-all font-mono`,children:e.releaseId}),(0,R.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]}):e.builtinBundleId?null:(0,R.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Unknown bundle`}),e.builtinBundleId?(0,R.jsx)(H,{bundleId:e.builtinBundleId}):null]}),(0,R.jsxs)(`div`,{className:`col-start-2 row-start-1 text-right md:col-auto md:row-auto`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium tabular-nums`,children:e.installations.toLocaleString()}),(0,R.jsx)(`span`,{className:`ml-1 text-xs text-muted-foreground md:sr-only`,children:`active`}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs tabular-nums text-muted-foreground md:hidden`,children:[n.toFixed(1),`% of version`]})]}),(0,R.jsxs)(`div`,{className:`hidden flex-col gap-2 md:flex`,children:[(0,R.jsxs)(`span`,{className:`text-right text-sm tabular-nums`,children:[n.toFixed(1),`%`]}),(0,R.jsx)(N,{"aria-label":`${V(e)} share in ${e.appVersion} on ${e.platform}`,value:n})]})]},JSON.stringify([e.appVersion,e.platform,e.releaseId,e.builtinBundleId]))})})]})]}),G&&q.length>0?(0,R.jsxs)(b,{className:`flex flex-wrap items-center justify-between gap-3 border-t pt-4`,children:[(0,R.jsxs)(`p`,{className:`text-xs tabular-nums text-muted-foreground`,children:[(X-1)*z+1,`–`,Math.min(X*z,q.length),` of `,q.length]}),(0,R.jsxs)(`nav`,{"aria-label":`Distribution pages`,className:`flex gap-2`,children:[(0,R.jsx)(t,{variant:`outline`,className:`h-11 sm:h-9`,disabled:X<=1,onClick:()=>$({page:X-1}),children:`Previous`}),(0,R.jsx)(t,{variant:`outline`,className:`h-11 sm:h-9`,disabled:X>=Y,onClick:()=>$({page:X+1}),children:`Next`})]})]}):null]})]})})]})}export{U as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/insights_.distribution-AZcfvK7x.js","assets/ConsoleFeatureUnavailable-DUqlpHCp.js","assets/sidebar-Di9SN47G.js","assets/console-features-api-DEXSwFtc.js","assets/arrow-up-right-DK8Zdg40.js","assets/NotFoundPage-Ckb5GMhh.js","assets/link-DTEyW70e.js","assets/empty-Bhlj8PEo.js","assets/insights_.distribution-BGAqgPi0.js","assets/select-CBIU0_M1.js","assets/useCompositeListItem-JmyDfo3-.js","assets/check-CXVR3s3X.js","assets/insights-usage-rpc-BbFllvi_.js","assets/valueToPercent-B6X9rUJM.js","assets/arrow-left-g9cKqXuC.js","assets/insights-api-BVCXJsoV.js","assets/useInfiniteQuery-DX4WpBRG.js","assets/rotate-cw-Clk5xTeE.js","assets/badge-laIuYW1U.js","assets/BundleIdDisplay-CP6rsdFO.js","assets/insights-search-CYPrQVUC.js","assets/uuidv7-cI6C63Fm.js","assets/PlatformIcon-CJ69KopR.js","assets/InsightsPageHeader-CSas9gM0.js","assets/tabs-CP3CSmtI.js","assets/list-B6GeoQ_b.js","assets/card-ulgg5xHn.js","assets/field-q4sTYzNU.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./preload-helper-B44EvKhG.js";import{r}from"./console-features-api-DEXSwFtc.js";import{i}from"./insights-search-CYPrQVUC.js";var a=t(`/insights_/distribution`)({beforeLoad:({context:e})=>r(e.queryClient,`insightsAnalytics`),notFoundComponent:e(()=>n(()=>import(`./insights_.distribution-AZcfvK7x.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:e(()=>n(()=>import(`./insights_.distribution-BGAqgPi0.js`),__vite__mapDeps([8,2,9,10,11,12,13,6,14,4,15,16,17,18,19,20,21,22,23,24,3,25,26,7,27])),`component`),validateSearch:i});export{a as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-DUqlpHCp.js";var t=e;export{t as notFoundComponent};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/installations-CWx7vYY5.js","assets/ConsoleFeatureUnavailable-oMmbaqF6.js","assets/sidebar-Di9SN47G.js","assets/console-features-api-DEXSwFtc.js","assets/arrow-up-right-DK8Zdg40.js","assets/NotFoundPage-fiaucvsO.js","assets/link-DTEyW70e.js","assets/empty-PAp07lsC.js","assets/installations-Ce_dTa35.js","assets/preload-helper-B44EvKhG.js","assets/useCompositeListItem-JmyDfo3-.js","assets/EventDetails-ly7ygfdH.js","assets/insights-api-BVCXJsoV.js","assets/useInfiniteQuery-DX4WpBRG.js","assets/check-CXVR3s3X.js","assets/copy-DsuLj3oj.js","assets/download-Cf24LBde.js","assets/input-group-BJfBVqeI.js","assets/smartphone-Bn5FtEwt.js","assets/badge-UNnTz4Dl.js","assets/dist-UQUhRoJi.js","assets/HashValueDisplay-BNoXZADg.js","assets/InsightsPageHeader-q2FgL8xS.js","assets/tabs-Fgz3sA51.js","assets/list-B6GeoQ_b.js","assets/arrow-left-g9cKqXuC.js","assets/refresh-cw-C6svDMfM.js","assets/search-bIYGuFCt.js","assets/field-DhKRWFG5.js","assets/table-B22H8-RL.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./preload-helper-B44EvKhG.js";import{r}from"./console-features-api-DEXSwFtc.js";var i=864e5,a={"24h":{period:`24 hours`,durationMs:i},"7d":{period:`7 days`,durationMs:7*i},"30d":{period:`30 days`,durationMs:30*i},"90d":{period:`90 days`,durationMs:90*i}},o=Object.keys(a),s=e=>o[o.indexOf(e)+1],c=(e,t)=>({beforeReceivedAtMs:t,sinceMs:Math.max(0,t-a[e].durationMs)}),l=e=>typeof e==`string`&&e.length>0?e:void 0,u=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0,d=e=>o.find(t=>t===e);function f(e){let t=p(e.search);return t.query===void 0&&t.installId===void 0?`/installations?eventsBefore=${t.eventsBefore??`new`}&eventsRange=${t.eventsRange??`7d`}&eventsCursor=${t.eventsCursor??`first`}`:e.state.__TSR_key}function p(e){return{query:typeof e.query==`string`?e.query:void 0,installId:typeof e.installId==`string`?e.installId:void 0,eventsCursor:l(e.eventsCursor),eventsBefore:u(e.eventsBefore),eventsRange:d(e.eventsRange),searchCursor:l(e.searchCursor),historyCursor:l(e.historyCursor),historyBefore:u(e.historyBefore)}}var m=t(`/installations`)({beforeLoad:({context:e})=>r(e.queryClient,`insights`),notFoundComponent:e(()=>n(()=>import(`./installations-CWx7vYY5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:e(()=>n(()=>import(`./installations-Ce_dTa35.js`),__vite__mapDeps([8,2,9,6,10,11,12,13,14,15,16,17,18,19,20,21,22,23,3,24,7,25,4,26,27,28,29])),`component`),staticData:{scrollRestorationKey:f},validateSearch:p});export{a,c as i,f as n,s as o,o as r,m as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/installations-Ap2G2tDs.js","assets/ConsoleFeatureUnavailable-DUqlpHCp.js","assets/sidebar-Di9SN47G.js","assets/console-features-api-DEXSwFtc.js","assets/arrow-up-right-DK8Zdg40.js","assets/NotFoundPage-Ckb5GMhh.js","assets/link-DTEyW70e.js","assets/empty-Bhlj8PEo.js","assets/installations-CwQYwQ6K.js","assets/preload-helper-B44EvKhG.js","assets/useCompositeListItem-JmyDfo3-.js","assets/EventDetails-Dcpdu7re.js","assets/insights-api-BVCXJsoV.js","assets/useInfiniteQuery-DX4WpBRG.js","assets/check-CXVR3s3X.js","assets/copy-DsuLj3oj.js","assets/HashValueDisplay-MoZMmTeP.js","assets/dist-Bf1BPKMs.js","assets/input-group-D_NfhUbX.js","assets/smartphone-r0rRdPas.js","assets/badge-laIuYW1U.js","assets/InsightsPageHeader-CSas9gM0.js","assets/tabs-CP3CSmtI.js","assets/list-B6GeoQ_b.js","assets/arrow-left-g9cKqXuC.js","assets/refresh-cw-C-tvoCcE.js","assets/search-nnvSOTEB.js","assets/card-ulgg5xHn.js","assets/field-q4sTYzNU.js","assets/table-TUtVz-2l.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./preload-helper-B44EvKhG.js";import{r}from"./console-features-api-DEXSwFtc.js";var i=864e5,a={"24h":{period:`24 hours`,durationMs:i},"7d":{period:`7 days`,durationMs:7*i},"30d":{period:`30 days`,durationMs:30*i},"90d":{period:`90 days`,durationMs:90*i}},o=Object.keys(a),s=e=>o[o.indexOf(e)+1],c=(e,t)=>({beforeReceivedAtMs:t,sinceMs:Math.max(0,t-a[e].durationMs)}),l=e=>typeof e==`string`&&e.length>0?e:void 0,u=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0,d=e=>o.find(t=>t===e);function f(e){let t=p(e.search);return t.query===void 0&&t.installId===void 0?`/installations?eventsBefore=${t.eventsBefore??`new`}&eventsRange=${t.eventsRange??`7d`}&eventsCursor=${t.eventsCursor??`first`}`:e.state.__TSR_key}function p(e){return{query:typeof e.query==`string`?e.query:void 0,installId:typeof e.installId==`string`?e.installId:void 0,eventsCursor:l(e.eventsCursor),eventsBefore:u(e.eventsBefore),eventsRange:d(e.eventsRange),searchCursor:l(e.searchCursor),historyCursor:l(e.historyCursor),historyBefore:u(e.historyBefore)}}var m=t(`/installations`)({beforeLoad:({context:e})=>r(e.queryClient,`insights`),notFoundComponent:e(()=>n(()=>import(`./installations-Ap2G2tDs.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:e(()=>n(()=>import(`./installations-CwQYwQ6K.js`),__vite__mapDeps([8,2,9,6,10,11,12,13,14,15,16,17,18,19,20,21,22,3,23,7,24,4,25,26,27,28,29])),`component`),staticData:{scrollRestorationKey:f},validateSearch:p});export{a,c as i,f as n,s as o,o as r,m as t};
@@ -0,0 +1 @@
1
+ import{$ as e,Fn as t,In as n,Ln as r,Wr as i,et as a,ii as o,rr as s,ti as c}from"./sidebar-Di9SN47G.js";import{h as l,i as u,m as d,t as f}from"./link-DTEyW70e.js";import{o as p,s as m}from"./preload-helper-B44EvKhG.js";import{a as h,n as g,o as _,r as v,t as y}from"./EventDetails-Dcpdu7re.js";import{t as b}from"./arrow-left-g9cKqXuC.js";import{t as x}from"./arrow-up-right-DK8Zdg40.js";import{a as S,c as C,i as w,l as T,n as E,o as ee,r as te}from"./insights-api-BVCXJsoV.js";import{t as D}from"./check-CXVR3s3X.js";import{a as O}from"./useCompositeListItem-JmyDfo3-.js";import{n as k,t as A}from"./HashValueDisplay-MoZMmTeP.js";import{t as j}from"./refresh-cw-C-tvoCcE.js";import{i as M,n as N,r as P,t as ne}from"./input-group-D_NfhUbX.js";import{t as re}from"./search-nnvSOTEB.js";import{a as F,n as I,o as L,r as R,t as z}from"./card-ulgg5xHn.js";import{a as B,i as ie,n as ae,o as oe,r as se,t as V}from"./installations-CSZfo1rG.js";import{a as ce,t as le}from"./field-q4sTYzNU.js";import{a as H,i as U,n as W,o as G,r as K,t as ue}from"./table-TUtVz-2l.js";import{a as de,c as q,n as fe,r as pe,t as me}from"./InsightsPageHeader-CSas9gM0.js";function he(){l(u(),!0)}function ge(e){return he(),d(u(),e)}function _e(e){let t=u();return m(t.stores.location,p(e,t))}var J=o(c(),1),Y=i();function ve({events:e,formatter:t,renderIdentity:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`px-4 pb-2 text-xs text-muted-foreground sm:px-6`,children:`Time in your browser zone`}),(0,Y.jsx)(`ol`,{"aria-label":`Events`,className:`divide-y border-y`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-3 px-4 py-4 sm:px-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-1`,children:[(0,Y.jsx)(v,{event:e}),(0,Y.jsx)(`div`,{className:`text-xs tabular-nums`,children:(0,Y.jsx)(g,{value:e.receivedAtMs,formatter:t,touch:!0})})]}),n?.(e),(0,Y.jsxs)(`dl`,{className:`flex flex-wrap gap-x-2 gap-y-1 text-sm`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:`App`}),(0,Y.jsxs)(`dd`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 text-muted-foreground`,children:[(0,Y.jsx)(`dt`,{className:`sr-only`,children:`Channel`}),(0,Y.jsx)(`dd`,{className:`wrap-anywhere`,children:e.channel})]})]}),(0,Y.jsx)(`div`,{className:`text-xs`,"aria-label":`Bundle`,children:(0,Y.jsx)(y,{event:e,touch:!0})})]},e.id))})]})}function X({hasPrevious:e,label:n,nextCursor:r,onNext:i,onPrevious:a,pageLength:o,pageNumber:s}){return(0,Y.jsxs)(`nav`,{"aria-label":`${n} pagination`,className:`flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 sm:px-6`,children:[(0,Y.jsxs)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:[`Page `,s,` · `,o.toLocaleString(),` rows`]}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(t,{className:`h-11 min-w-11 px-3 lg:h-8 lg:min-w-0 lg:px-2`,disabled:!e,onClick:a,size:`sm`,type:`button`,variant:`outline`,children:`Previous`}),(0,Y.jsx)(t,{className:`h-11 min-w-11 px-3 lg:h-8 lg:min-w-0 lg:px-2`,disabled:r===null,onClick:i,size:`sm`,type:`button`,variant:`outline`,children:`Next`})]})]})}var ye=e=>se.filter((t,n)=>n===0||B[t].durationMs<=e*864e5);function be({event:e,eventsLocation:t,touch:r=!1}){return(0,Y.jsxs)(`div`,{className:r?`flex min-w-0 flex-wrap items-center justify-between gap-2`:`flex min-w-0 flex-col items-start gap-2`,children:[(0,Y.jsxs)(f,{className:n({className:r?`-ml-2 h-auto min-h-11 min-w-0 flex-1 justify-start gap-2 whitespace-normal text-sm`:`-ml-2 max-w-full justify-start`,size:`sm`,variant:`ghost`}),to:`/installations`,search:{...t,query:e.installId||void 0,installId:e.installId},state:e=>({insightsPagination:{eventsBack:e.insightsPagination?.eventsBack}}),"aria-label":`View history for ${e.userId??`anonymous installation`} (${e.installId})`,children:[(0,Y.jsx)(`span`,{className:r?`min-w-0 text-left wrap-anywhere`:`truncate`,children:e.userId??`Anonymous installation`}),(0,Y.jsx)(x,{"aria-hidden":`true`,"data-icon":`inline-end`})]}),(0,Y.jsx)(A,{value:e.installId,maxLength:13,buttonClassName:r?`min-h-11 px-3`:void 0})]})}function xe({children:n,description:r,error:i,eventsLocation:a,history:o,isFetching:s,isLoading:c,onNext:l,onPrevious:u,onRangeChange:d,onRefresh:f,pageNumber:p,range:m,rawDays:h=90,title:b=`All events`}){let x=_(),S=p>1,C=ye(h),w=m===void 0?void 0:oe(m),T=w!==void 0&&C.includes(w)?w:void 0,E=T!==void 0&&d?(0,Y.jsx)(t,{className:`h-11 px-3 lg:h-8`,onClick:()=>d(T),type:`button`,variant:`outline`,children:`Show the last ${B[T].period}`}):null;return(0,Y.jsxs)(z,{className:`@container min-w-0 shadow-sm`,"aria-busy":s,children:[(0,Y.jsxs)(F,{className:`gap-4 p-4 sm:p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(L,{children:(0,Y.jsx)(`h2`,{children:b})}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[m!==void 0&&d?(0,Y.jsx)(de,{label:`Time range`,onPeriodChange:d,period:m,periods:C.map(e=>({value:e,name:`Last ${B[e].period}`}))}):null,(0,Y.jsxs)(t,{className:`h-11 lg:h-8`,disabled:s,onClick:f,size:`lg`,variant:`outline`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Refresh`]})]})]}),r?(0,Y.jsx)(R,{children:r}):null]}),n]}),(0,Y.jsx)(I,{className:`min-w-0 p-0`,children:c?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 p-6`,role:`status`,"aria-label":`Loading events`,children:[(0,Y.jsx)(e,{className:`h-12 w-full`}),(0,Y.jsx)(e,{className:`h-12 w-full`}),(0,Y.jsx)(e,{className:`h-12 w-full`})]}):i?(0,Y.jsx)(`div`,{className:`px-6 pb-6`,children:(0,Y.jsx)(q,{error:i,fallbackTitle:`Event history unavailable`})}):o?(0,Y.jsxs)(Y.Fragment,{children:[o.data.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`@[58rem]:hidden`,children:(0,Y.jsx)(ve,{events:o.data,formatter:x,renderIdentity:e=>(0,Y.jsx)(be,{event:e,eventsLocation:a,touch:!0})})}),(0,Y.jsx)(`div`,{className:`hidden @[58rem]:block`,children:(0,Y.jsxs)(ue,{className:`min-w-4xl table-fixed`,children:[(0,Y.jsx)(H,{children:(0,Y.jsxs)(G,{className:`[&>th]:px-4 sm:[&>th]:px-6`,children:[(0,Y.jsx)(U,{className:`w-64`,children:`Time`}),(0,Y.jsx)(U,{className:`w-48`,children:`Event`}),(0,Y.jsx)(U,{className:`w-48`,children:`User / installation`}),(0,Y.jsx)(U,{className:`w-32`,children:`App`}),(0,Y.jsx)(U,{className:`w-52`,children:`Bundle`})]})}),(0,Y.jsx)(W,{children:o.data.map(e=>(0,Y.jsxs)(G,{className:`[&>td]:px-4 [&>td]:py-4 [&>td]:align-top sm:[&>td]:px-6`,children:[(0,Y.jsx)(K,{className:`whitespace-normal text-xs tabular-nums`,children:(0,Y.jsx)(g,{value:e.receivedAtMs,formatter:x})}),(0,Y.jsx)(K,{children:(0,Y.jsx)(v,{event:e})}),(0,Y.jsx)(K,{children:(0,Y.jsx)(be,{event:e,eventsLocation:a})}),(0,Y.jsx)(K,{className:`whitespace-normal text-xs`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`span`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.channel})]})}),(0,Y.jsx)(K,{className:`whitespace-normal text-xs`,children:(0,Y.jsx)(y,{event:e})})]},e.id))})]})})]}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 pb-4 sm:px-6 sm:pb-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:S?`No older events in this range.`:m===void 0?b===`All events`?`No events recorded yet`:`No matching reports in this period`:`No events in the last ${B[m].period}.`}),S?null:E]}),m!==void 0&&o.nextCursor===null&&(o.data.length>0||S)?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t px-4 py-3 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Start of range reached`}),E]}):null,o.data.length>0||S||o.nextCursor?(0,Y.jsx)(X,{hasPrevious:S,label:b,nextCursor:o.nextCursor,onNext:l,onPrevious:u,pageLength:o.data.length,pageNumber:p}):null]}):null})]})}var Se=e=>e.userId??`—`,Ce=e=>`lastKnownBundleId`in e?e.lastKnownBundleId:e.type===`UPDATE_DOWNLOADED`||e.type===`UPDATE_FAILED`?e.fromBundleId:e.toBundleId;function we({error:n,history:r,isLoading:i,onNext:o,onPrevious:s,onRefresh:c,pageNumber:l,retention:u=C,selectedEvent:d,selectedInstallId:f}){let p=_(),m=d?Ce(d):void 0,b=d&&`pendingBundleId`in d?d.pendingBundleId:d&&`type`in d&&d.type===`UPDATE_DOWNLOADED`?d.toBundleId:null;return(0,Y.jsxs)(z,{className:`@container min-h-0 min-w-0 shadow-sm`,children:[(0,Y.jsx)(F,{className:`p-4 sm:p-6`,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Y.jsx)(L,{className:`text-sm font-medium`,children:(0,Y.jsx)(`h2`,{children:f===void 0?`Select an installation`:`Installation history`})}),f===void 0?null:(0,Y.jsxs)(R,{children:[`Bundle changes and update failures are kept for`,` `,T(u.rawDays),`; the latest report, for`,` `,T(u.dailyDays),` after the installation last reports.`]})]}),c&&f!==void 0?(0,Y.jsxs)(t,{className:`h-11 lg:h-8`,size:`lg`,variant:`outline`,onClick:c,disabled:i,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Refresh`]}):null]})}),(0,Y.jsxs)(I,{className:`min-h-0 p-0`,children:[f!==void 0&&d?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"aria-labelledby":`latest-installation-state`,className:`px-4 pb-4 sm:px-6 sm:pb-6`,children:[(0,Y.jsx)(`h3`,{className:`sr-only`,id:`latest-installation-state`,children:`Latest reported state`}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 @[36rem]:grid-cols-3`,children:[(0,Y.jsxs)(`div`,{className:`col-span-2 min-w-0 @[36rem]:col-span-1`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`User ID`}),(0,Y.jsx)(`dd`,{className:`mt-1 text-sm font-medium wrap-anywhere`,children:Se(d)})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Install ID`}),(0,Y.jsx)(`dd`,{className:`mt-1 font-mono text-xs`,children:(0,Y.jsx)(A,{value:f,buttonClassName:`min-h-11 px-3 lg:min-h-0 lg:px-1.5`})})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Last known bundle`}),(0,Y.jsxs)(`dd`,{className:`mt-1 flex min-w-0 flex-wrap items-center gap-2 font-mono text-xs`,children:[m?(0,Y.jsx)(A,{value:m,buttonClassName:`min-h-11 px-3 lg:min-h-0 lg:px-1.5`}):`—`,pe(m,d.minBundleId)?(0,Y.jsx)(fe,{}):null]})]}),b?(0,Y.jsxs)(`div`,{className:`col-span-2 min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:`Downloaded · Not launched yet`}),(0,Y.jsx)(`dd`,{className:`mt-1 text-xs`,children:(0,Y.jsx)(A,{value:b})})]}):null]}),d.httpResponse?(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(h,{event:d})}):null]}),(0,Y.jsx)(a,{})]}):null,f===void 0?null:i?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 p-6`,role:`status`,"aria-label":`Loading installation history`,children:[(0,Y.jsx)(e,{className:`h-10 w-full`}),(0,Y.jsx)(e,{className:`h-10 w-full`}),(0,Y.jsx)(e,{className:`h-10 w-full`})]}):n?(0,Y.jsx)(`div`,{className:`p-6`,children:(0,Y.jsx)(q,{error:n instanceof Error?n:Error(),fallbackTitle:`Installation history unavailable`})}):r&&r.data.length>0?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`@[48rem]:hidden`,children:(0,Y.jsx)(ve,{events:r.data,formatter:p})}),(0,Y.jsx)(`div`,{className:`hidden @[48rem]:block`,children:(0,Y.jsxs)(ue,{className:`min-w-3xl table-fixed`,children:[(0,Y.jsx)(H,{children:(0,Y.jsxs)(G,{className:`[&>th]:px-4 sm:[&>th]:px-6`,children:[(0,Y.jsx)(U,{className:`w-64`,children:`Time`}),(0,Y.jsx)(U,{className:`w-48`,children:`Event`}),(0,Y.jsx)(U,{className:`w-32`,children:`App`}),(0,Y.jsx)(U,{className:`w-52`,children:`Bundle`})]})}),(0,Y.jsx)(W,{children:r.data.map(e=>(0,Y.jsxs)(G,{className:`[&>td]:px-4 [&>td]:py-4 [&>td]:align-top sm:[&>td]:px-6`,children:[(0,Y.jsx)(K,{className:`whitespace-normal text-xs tabular-nums`,children:(0,Y.jsx)(g,{value:e.receivedAtMs,formatter:p})}),(0,Y.jsx)(K,{children:(0,Y.jsx)(v,{event:e})}),(0,Y.jsx)(K,{className:`whitespace-normal text-xs`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`span`,{children:[e.platform===`ios`?`iOS`:`Android`,` `,e.appVersion]}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.channel})]})}),(0,Y.jsx)(K,{className:`whitespace-normal text-xs`,children:(0,Y.jsx)(y,{event:e})})]},e.id))})]})}),(0,Y.jsx)(X,{hasPrevious:l>1,label:`Installation history`,nextCursor:r.nextCursor,onNext:o,onPrevious:s,pageLength:r.data.length,pageNumber:l})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:l>1?`No older bundle changes.`:`No bundle changes recorded yet.`}),r&&(l>1||r.nextCursor)?(0,Y.jsx)(X,{hasPrevious:l>1,label:`Installation history`,nextCursor:r.nextCursor,onNext:o,onPrevious:s,pageLength:0,pageNumber:l}):null]})]})]})}var Te=e=>e.lastKnownBundleId,Ee=e=>e.userId??`—`;function De({error:e,onNext:i,onPrevious:a,onSelect:o,pageNumber:s,results:c,selectedInstallId:l}){let[u,d]=(0,J.useState)(!1),f=(0,J.useId)(),p=(0,J.useRef)(null),m=!e&&c&&c.data.length>0;return(0,Y.jsxs)(z,{className:`min-h-0 min-w-0 shadow-sm`,children:[(0,Y.jsx)(F,{className:`p-4 sm:px-6`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:(0,Y.jsx)(L,{className:`text-sm font-medium`,children:(0,Y.jsx)(`h2`,{children:`Matching installations`})})}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:m?(0,Y.jsx)(t,{"aria-controls":f,"aria-expanded":u,"aria-label":u?`Hide matching installations`:`Show matching installations`,className:`size-11 lg:hidden`,onClick:()=>d(!u),ref:p,size:`icon-lg`,variant:`ghost`,children:(0,Y.jsx)(O,{"aria-hidden":`true`,className:r(u&&`rotate-180`)})}):null})]})}),(0,Y.jsxs)(I,{className:r(`min-h-0 p-0`,m&&!u&&`hidden lg:block`),id:f,children:[e?(0,Y.jsx)(`div`,{className:`p-6`,children:(0,Y.jsx)(q,{error:e instanceof Error?e:Error(),fallbackTitle:`Installation search unavailable`})}):c&&c.data.length>0?(0,Y.jsx)(`ul`,{"aria-label":`Matching installations`,className:`divide-y`,children:c.data.map(e=>{let t=Te(e),n=e.installId===l;return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{"aria-label":`${Ee(e)}, install ID ${e.installId}`,"aria-pressed":n,className:`group flex w-full min-w-0 flex-col gap-2 border-l-2 border-transparent px-4 py-4 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/30 aria-pressed:border-primary aria-pressed:bg-muted/60 motion-reduce:transition-none sm:px-6`,onClick:()=>{o(e.installId),d(!1),p.current?.focus()},type:`button`,children:[(0,Y.jsxs)(`span`,{className:`flex w-full min-w-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:Ee(e)}),n?(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs font-medium text-primary`,children:[(0,Y.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Selected`})]}):null]}),(0,Y.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,title:e.installId,children:k(e.installId)})}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Bundle`}),t?(0,Y.jsx)(`span`,{className:`font-mono text-xs`,title:t,children:k(t)}):(0,Y.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`—`})]})]})},e.installId)})}):(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 p-4 sm:px-6`,children:[(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matches`}),(0,Y.jsx)(`a`,{className:n({variant:`outline`,className:`h-11 px-3 lg:h-8`}),href:`#installation-history-search`,children:`Edit search`})]}),c&&(c.data.length>0||s>1||c.nextCursor)?(0,Y.jsx)(X,{hasPrevious:s>1,label:`Installation results`,nextCursor:c.nextCursor,onNext:i,onPrevious:a,pageLength:c.data.length,pageNumber:s}):null]})]})}function Oe({draftQuery:e,onDraftQueryChange:n,onSubmit:r,onClear:i}){return(0,Y.jsx)(`form`,{"aria-label":`Find installation`,onSubmit:t=>{t.preventDefault(),e.trim()&&r()},role:`search`,children:(0,Y.jsxs)(le,{className:`gap-2`,children:[(0,Y.jsx)(ce,{className:`sr-only`,htmlFor:`installation-history-search`,children:`User ID or installation ID`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(ne,{className:`h-11 w-auto min-w-0 flex-1 basis-44 lg:h-8`,children:[(0,Y.jsx)(N,{children:(0,Y.jsx)(re,{"aria-hidden":`true`})}),(0,Y.jsx)(M,{autoComplete:`off`,className:`h-11 text-base md:text-base lg:h-8 lg:text-xs`,id:`installation-history-search`,maxLength:1024,name:`installation`,onChange:e=>n(e.target.value),placeholder:`User ID or installation ID`,spellCheck:!1,type:`search`,value:e}),e.length>0?(0,Y.jsx)(N,{align:`inline-end`,children:(0,Y.jsx)(P,{"aria-label":`Clear installation lookup`,className:`size-11 lg:size-5`,onClick:i,size:`icon-xs`,children:(0,Y.jsx)(s,{"aria-hidden":`true`})})}):null]}),(0,Y.jsx)(t,{"aria-label":`Find installation`,className:`h-11 px-3 lg:h-8`,disabled:e.trim().length===0,size:`lg`,type:`submit`,variant:`outline`,children:`Find`})]})]})})}function ke(){return(0,Y.jsxs)(`div`,{className:`grid items-stretch gap-6 lg:min-h-96 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)]`,children:[(0,Y.jsx)(e,{className:`h-64 w-full lg:h-full`}),(0,Y.jsx)(e,{className:`h-64 w-full lg:h-full`})]})}var Ae=20,je=50,Z=()=>Date.now(),Q=(e,t)=>[...e,t??``],$=e=>({cursor:e?.at(-1)||void 0,stack:e.slice(0,-1)});function Me(){let e=V.useSearch(),n=V.useNavigate(),r=ee(),[i,a]=(0,J.useState)(e.query??``),[o]=(0,J.useState)(Z),[s]=(0,J.useState)(Z),c=_e({select:e=>e.state.insightsPagination}),l=c?.eventsBack??[],u=c?.searchBack??[],d=c?.historyBack??[],f=e.query?.trim()??``,p=f.length>0,m=e.installId!==void 0,h=p||m,g=e.eventsBefore??o,_=e.eventsRange??`7d`,v=e.historyBefore??s,y=(t,r=!1,i={})=>{n({to:`/installations`,search:{...e,...t},state:e=>({...e,insightsPagination:{...e.insightsPagination,...i}}),replace:r})};(0,J.useEffect)(()=>{a(e.query??``)},[e.query]),(0,J.useEffect)(()=>{e.eventsBefore===void 0&&y({eventsBefore:g},!0)},[g,e.eventsBefore]),(0,J.useEffect)(()=>{m&&e.historyBefore===void 0&&y({historyBefore:v},!0)},[m,v,e.historyBefore]);let x=E({...ie(_,g),cursor:e.eventsCursor,limit:20},!h),C=S({cursor:e.searchCursor,identity:f,limit:Ae},p);(0,J.useEffect)(()=>{let e=C.data?.data[0]?.installId;!p||m||e===void 0||y({historyBefore:Z(),historyCursor:void 0,installId:e},!0,{historyBack:[]})},[p,m,C.data?.data]);let D=w(e.installId??``,m),O=te({beforeReceivedAtMs:v,cursor:e.historyCursor,installId:e.installId??``,limit:je},m),k=D.data??C.data?.data.find(({installId:t})=>t===e.installId)??O.data?.data[0],A=h?`installation-history-${e.historyCursor??`first`}`:`all-events-${e.eventsCursor??`first`}`,j=(0,J.useRef)(null),M=ge({id:A,getKey:ae});(0,J.useLayoutEffect)(()=>{!h&&!x.isLoading&&j.current&&(j.current.scrollTop=M?.scrollY??0)},[x.isLoading,h,M?.scrollY,A]);let N=()=>{a(``),y({historyBefore:void 0,historyCursor:void 0,installId:void 0,query:void 0,searchCursor:void 0},!1,{historyBack:[],searchBack:[]})},P=(0,Y.jsx)(Oe,{draftQuery:i,onClear:N,onDraftQueryChange:a,onSubmit:()=>{let e=i.trim();if(!e){N();return}y({historyBefore:void 0,historyCursor:void 0,installId:void 0,query:e,searchCursor:void 0},!1,{historyBack:[],searchBack:[]})}});return(0,Y.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,Y.jsx)(me,{view:`events`}),(0,Y.jsx)(`div`,{ref:j,"data-scroll-restoration-id":A,id:`insights-events-scroll`,className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-4 sm:gap-6`,children:[h?(0,Y.jsx)(z,{className:`shadow-sm`,children:(0,Y.jsxs)(I,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,Y.jsxs)(t,{className:`-ml-2 h-11 self-start lg:h-8`,onClick:N,variant:`ghost`,children:[(0,Y.jsx)(b,{"aria-hidden":`true`,"data-icon":`inline-start`}),`Back to all events`]}),P]})}):null,h?C.isLoading&&p?(0,Y.jsx)(ke,{}):(0,Y.jsxs)(`div`,{className:`grid min-h-0 min-w-0 items-stretch gap-4 sm:gap-6 ${p?`lg:min-h-96 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)]`:`lg:grid-cols-1`}`,children:[p?(0,Y.jsx)(De,{error:C.error,onNext:()=>{C.data?.nextCursor&&y({installId:void 0,searchCursor:C.data.nextCursor},!0,{searchBack:Q(u,e.searchCursor)})},onPrevious:()=>{let e=$(u);y({installId:void 0,searchCursor:e.cursor},!0,{searchBack:e.stack})},onSelect:e=>{y({historyBefore:Z(),historyCursor:void 0,installId:e},!1,{historyBack:[]})},pageNumber:u.length+1,results:C.data,selectedInstallId:e.installId}):null,(0,Y.jsx)(we,{error:O.error??D.error,history:O.data,isLoading:O.isLoading||D.isLoading,onNext:()=>{O.data?.nextCursor&&y({historyCursor:O.data.nextCursor},!0,{historyBack:Q(d,e.historyCursor)})},onPrevious:()=>{let e=$(d);y({historyCursor:e.cursor},!0,{historyBack:e.stack})},onRefresh:()=>{y({historyBefore:Z(),historyCursor:void 0},!0,{historyBack:[]})},pageNumber:d.length+1,retention:r,selectedEvent:k,selectedInstallId:e.installId})]}):(0,Y.jsx)(xe,{description:`Downloads, launches, crashes, update failures, and other changes to what an installation runs, newest first, kept for ${T(r.rawDays)}. Launches that change nothing aren't listed.`,error:x.error,eventsLocation:{eventsBefore:g,eventsCursor:e.eventsCursor,eventsRange:e.eventsRange},history:x.data,isFetching:x.isFetching,isLoading:x.isLoading,onNext:()=>{x.data?.nextCursor&&y({eventsCursor:x.data.nextCursor},!0,{eventsBack:Q(l,e.eventsCursor)})},onPrevious:()=>{let e=$(l);y({eventsCursor:e.cursor},!0,{eventsBack:e.stack})},onRangeChange:e=>{y({eventsBefore:Z(),eventsCursor:void 0,eventsRange:e},!1,{eventsBack:[]})},onRefresh:()=>{y({eventsBefore:Z(),eventsCursor:void 0},!0,{eventsBack:[]})},pageNumber:l.length+1,range:_,rawDays:r.rawDays,children:P})]})},A)]})}export{Me as component};
@@ -0,0 +1 @@
1
+ import{Fn as e,In as t,Wr as n,h as r,ir as i,p as a}from"./sidebar-Di9SN47G.js";import{t as o}from"./link-DTEyW70e.js";import{a as s}from"./preload-helper-B44EvKhG.js";import{t as c}from"./arrow-up-right-DK8Zdg40.js";import{C as l,S as u,c as d,l as f,m as p,n as m,p as ee,r as h,t as g,u as _,y as v}from"./TargetDisplay-CoYY8Fs4.js";import{a as te,i as y,n as ne,o as b,r as x,t as re}from"./select-CBIU0_M1.js";import{r as ie}from"./HashValueDisplay-MoZMmTeP.js";import{r as S}from"./-native-builds-search-OlRj4Jz0.js";import{t as C}from"./refresh-cw-C-tvoCcE.js";import{n as w,t as ae}from"./StoreSubmission-F00RL5rI.js";import{a as oe,i as se,n as ce,o as le,r as ue,t as de}from"./badge-laIuYW1U.js";import{t as fe}from"./uuidv7-cI6C63Fm.js";import{t as T}from"./native-builds-v5wez34c.js";import{n as pe,t as me}from"./PlatformIcon-CJ69KopR.js";import{a as he,n as ge,o as E,r as D,s as O,t as k}from"./dialog-CLIaC82_.js";import{h as A,i as j}from"./api-LQJH44FU.js";import{i as M,r as N}from"./table-TUtVz-2l.js";import{a as P,c as F,d as I,f as L,i as _e,l as ve,n as ye,o as R,r as be,s as xe,t as z,u as Se}from"./RelativeTime-CiZ7yXNJ.js";var Ce=i(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),B=n(),V=`npx hot-updater native-build import <file>`,H=`https://hot-updater.dev/docs/guides/native-build#import-a-build-made-elsewhere`;function we(){return(0,B.jsxs)(k,{children:[(0,B.jsxs)(O,{render:(0,B.jsx)(e,{"aria-label":`Import a build`,className:`min-h-11 min-w-11 sm:min-h-7 sm:min-w-0`,size:`sm`,variant:`outline`}),children:[(0,B.jsx)(Ce,{"data-icon":`inline-start`}),(0,B.jsx)(`span`,{className:`hidden sm:inline`,children:`Import a build`})]}),(0,B.jsxs)(ge,{className:`sm:max-w-lg`,children:[(0,B.jsxs)(he,{children:[(0,B.jsx)(E,{children:`Import a build`}),(0,B.jsx)(D,{children:`Track an .ipa, .aab, .apk or .app built elsewhere as a patch base.`})]}),(0,B.jsx)(u,{label:`the import command`,value:V,wrap:!0}),(0,B.jsxs)(`a`,{className:t({className:`min-h-11 w-full sm:min-h-8 sm:w-fit`,variant:`outline`}),href:H,rel:`noreferrer`,target:`_blank`,children:[`Import guide`,(0,B.jsx)(c,{"data-icon":`inline-end`})]})]})]})}var Te=`https://hot-updater.dev/docs/guides/native-build#how-a-build-is-tracked`,U=10,W=e=>e===void 0?{}:{channel:e};function Ee({channel:n,paged:r,onClearChannel:i}){return r?(0,B.jsx)(R,{icon:S,title:`No more native builds`,children:(0,B.jsx)(o,{className:t({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),search:W(n),to:`/native-builds`,children:`Show the newest builds`})}):n===void 0?(0,B.jsxs)(R,{icon:S,title:`No native builds`,children:[(0,B.jsxs)(`p`,{children:[`Build one with`,` `,(0,B.jsx)(`code`,{className:`font-mono text-xs`,children:`native-build android`}),` or`,` `,(0,B.jsx)(`code`,{className:`font-mono text-xs`,children:`native-build ios`}),`, or import one built elsewhere:`]}),(0,B.jsx)(`div`,{className:`w-full text-left`,children:(0,B.jsx)(u,{label:`the import command`,value:V,wrap:!0})}),(0,B.jsxs)(`a`,{className:t({className:`mt-1 min-h-11 sm:min-h-8`,variant:`outline`}),href:Te,rel:`noreferrer`,target:`_blank`,children:[`Native build guide`,(0,B.jsx)(c,{"data-icon":`inline-end`})]}),(0,B.jsxs)(`a`,{className:t({className:`min-h-11 sm:min-h-8`,variant:`outline`}),href:H,rel:`noreferrer`,target:`_blank`,children:[`Import guide`,(0,B.jsx)(c,{"data-icon":`inline-end`})]})]}):(0,B.jsxs)(R,{icon:S,title:(0,B.jsxs)(B.Fragment,{children:[`No native build embeds `,(0,B.jsx)(`span`,{translate:`no`,children:n})]}),children:[(0,B.jsx)(`p`,{children:`A build embeds the channel it was built on. Build one on this channel, or list every channel's builds.`}),(0,B.jsx)(e,{className:`mt-1 min-h-11 sm:min-h-8`,onClick:i,variant:`outline`,children:`Show all channels`})]})}var G=e=>`${v(e.platform)} ${f[e.artifact_kind].label}`;function K({build:e}){return(0,B.jsx)(o,{"aria-label":G(e),className:`relative rounded-sm font-medium whitespace-nowrap text-foreground transition-colors underline-offset-4 after:absolute after:-inset-x-[10px] after:-inset-y-[10px] hover:text-primary hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:after:hidden`,params:{buildId:e.id},to:`/native-builds/$buildId`,children:f[e.artifact_kind].label})}function q({channel:e,onChannel:t}){return(0,B.jsx)(`button`,{"aria-label":`Show the builds that embed ${e}`,className:`relative rounded-md text-left after:absolute after:inset-x-0 after:-inset-y-[11px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none sm:after:hidden`,onClick:()=>t(e),type:`button`,children:(0,B.jsx)(l,{channel:e,className:`whitespace-nowrap`})})}function De({build:e}){return!w(e)&&e.store_build!==!0?(0,B.jsx)(m,{}):(0,B.jsx)(J,{build:e,className:`flex flex-col items-start gap-1`})}function J({build:e,className:t}){return(0,B.jsxs)(`span`,{className:t,children:[(0,B.jsx)(ae,{build:e}),e.store_build===!0?(0,B.jsx)(de,{variant:`secondary`,children:`Store build`}):null]})}function Y({build:e}){return(0,B.jsxs)(`a`,{"aria-label":`Download ${p(e)}`,className:t({className:`min-h-11 sm:min-h-8`,size:`sm`,variant:`outline`}),download:!0,href:ee(e.id),children:[(0,B.jsx)(ie,{"data-icon":`inline-start`}),`Download`]})}function Oe({build:e}){return e.build_number?(0,B.jsx)(`span`,{className:`font-mono tabular-nums`,translate:`no`,children:e.build_number}):(0,B.jsx)(m,{})}var X=e=>fe(e.id);function ke({build:e,onChannel:t}){let n=s(),r=_(e);return(0,B.jsxs)(Se,{"aria-label":`Open native build ${e.id}`,onOpen:()=>void n({to:`/native-builds/$buildId`,params:{buildId:e.id}}),children:[(0,B.jsx)(N,{children:(0,B.jsx)(K,{build:e})}),(0,B.jsx)(N,{children:(0,B.jsx)(q,{channel:r,onChannel:t})}),(0,B.jsx)(N,{className:`whitespace-nowrap`,children:(0,B.jsx)(pe,{platform:e.platform})}),(0,B.jsx)(N,{children:(0,B.jsx)(Oe,{build:e})}),(0,B.jsx)(N,{children:(0,B.jsx)(h,{appVersion:e.app_version,fingerprintHash:e.fingerprint_hash})}),(0,B.jsx)(N,{children:(0,B.jsx)(g,{value:e.build_key})}),(0,B.jsx)(N,{children:(0,B.jsx)(De,{build:e})}),(0,B.jsx)(N,{className:`whitespace-nowrap text-muted-foreground tabular-nums`,children:d(e.byte_size)}),(0,B.jsx)(N,{className:`text-xs text-muted-foreground`,children:(0,B.jsx)(z,{ms:X(e)})}),(0,B.jsx)(N,{className:`text-right`,children:(0,B.jsx)(Y,{build:e})})]})}function Ae({build:e,onChannel:t}){let n=s(),r=_(e),i=w(e)||e.store_build===!0;return(0,B.jsxs)(ye,{"aria-label":`Native build ${G(e)} ${e.id}`,className:`gap-3 border-b-0`,onClick:L(()=>void n({to:`/native-builds/$buildId`,params:{buildId:e.id}})),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,B.jsx)(me,{className:`size-4 shrink-0 text-muted-foreground`,platform:e.platform}),(0,B.jsx)(K,{build:e}),(0,B.jsx)(q,{channel:r,onChannel:t})]}),(0,B.jsx)(Y,{build:e})]}),(0,B.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:v(e.platform)}),e.build_number?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{translate:`no`,children:[`Build`,` `,(0,B.jsx)(`span`,{className:`font-mono tabular-nums text-foreground`,children:e.build_number})]}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,B.jsx)(`span`,{className:`tabular-nums`,children:d(e.byte_size)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(z,{ms:X(e)})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 text-xs`,children:[(0,B.jsxs)(`span`,{className:`flex items-center`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Target `}),(0,B.jsx)(h,{appVersion:e.app_version,fingerprintHash:e.fingerprint_hash})]}),e.build_key?(0,B.jsxs)(`span`,{className:`flex items-center`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Build key `}),(0,B.jsx)(g,{value:e.build_key})]}):null]}),i?(0,B.jsx)(J,{build:e,className:`flex flex-wrap items-center gap-1.5`}):null]})}function je({builds:t,channel:n,paged:i,onChannel:a}){let o=r(),s=t.data?.data,{next:c,previous:l}=t.data??{};if(t.isError)return(0,B.jsxs)(ce,{variant:`destructive`,children:[(0,B.jsx)(le,{}),(0,B.jsx)(oe,{children:`Native builds couldn't be loaded`}),(0,B.jsx)(se,{children:`Check your connection and try again.`}),(0,B.jsx)(ue,{children:(0,B.jsxs)(e,{onClick:()=>void t.refetch(),size:`xs`,variant:`outline`,children:[(0,B.jsx)(C,{"data-icon":`inline-start`}),`Retry`]})})]});let u=(0,B.jsx)(Ee,{channel:n,onClearChannel:()=>a(void 0),paged:i});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(xe,{children:o?(0,B.jsx)(`div`,{"aria-busy":t.isPlaceholderData,"aria-label":`Native builds`,className:`h-full overflow-y-auto aria-busy:opacity-60`,role:`list`,children:t.isLoading?(0,B.jsx)(be,{label:`Loading native builds`}):s?.length===0?(0,B.jsx)(_e,{children:u}):s?.map(e=>(0,B.jsx)(`div`,{className:`border-b last:border-b-0`,role:`listitem`,children:(0,B.jsx)(Ae,{build:e,onChannel:a})},e.id))}):(0,B.jsx)(P,{"aria-busy":t.isPlaceholderData,"aria-label":`Native builds`,className:`aria-busy:opacity-60`,header:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(M,{children:`Artifact`}),(0,B.jsx)(M,{children:`Channel`}),(0,B.jsx)(M,{children:`Platform`}),(0,B.jsx)(M,{children:`Build`}),(0,B.jsx)(M,{children:`Target`}),(0,B.jsx)(M,{children:`Build key`}),(0,B.jsx)(M,{children:`Store`}),(0,B.jsx)(M,{children:`Size`}),(0,B.jsx)(M,{children:`Created`}),(0,B.jsx)(M,{className:`text-right`,children:(0,B.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]}),children:t.isLoading?(0,B.jsx)(I,{columns:U,label:`Loading native builds`}):s?.length===0?(0,B.jsx)(F,{columns:U,children:u}):s?.map(e=>(0,B.jsx)(ke,{build:e,onChannel:a},e.id))})}),t.isLoading||s===void 0?null:(0,B.jsx)(ve,{count:s.length,label:`Native build pages`,pending:t.isPlaceholderData,newest:i?{search:W(n),to:`/native-builds`}:void 0,next:c===void 0?void 0:{search:{...W(n),before:c},to:`/native-builds`},previous:l===void 0?void 0:{search:{...W(n),after:l},to:`/native-builds`}})]})}var Z=`all`,Q=`channel:`,$=e=>`${Q}${e}`;function Me({search:t,onSearchChange:n}){let{channel:r,before:i,after:o}=t,s=A(t),c=j(),l=c.data?.map(({name:e})=>e)??[],u=r===void 0||l.includes(r)?l:[r,...l],d=e=>n(e===void 0?{}:{channel:e});return(0,B.jsxs)(`div`,{className:`flex h-svh min-h-0 min-w-0 flex-col`,children:[(0,B.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,B.jsx)(a,{className:`-ml-1 size-11 lg:size-7`}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,B.jsx)(`h1`,{className:`text-sm font-medium`,children:`Native builds`})]}),(0,B.jsx)(`p`,{className:`basis-full pl-12 text-xs text-muted-foreground sm:basis-auto sm:pl-0`,children:`Store and test builds, each the built-in bundle its OTAs patch from.`})]}),(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4 bg-muted/5 p-3 sm:p-6`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsxs)(re,{items:[{label:`All channels`,value:Z},...u.map(e=>({label:e,value:$(e)}))],onOpenChange:e=>{e&&c.refetch()},onValueChange:e=>d(e?.startsWith(Q)?e.slice(8):void 0),value:r===void 0?Z:$(r),children:[(0,B.jsx)(te,{"aria-label":`Channel`,className:`min-w-0 flex-1 text-xs data-[size=default]:h-11 sm:w-48 sm:flex-none sm:data-[size=default]:h-8`,children:(0,B.jsx)(b,{})}),(0,B.jsx)(ne,{children:(0,B.jsxs)(x,{children:[(0,B.jsx)(y,{value:Z,children:`All channels`}),u.map(e=>(0,B.jsx)(y,{translate:`no`,value:$(e),children:e},e))]})})]}),(0,B.jsx)(`div`,{className:`ml-auto`,children:(0,B.jsx)(we,{})}),(0,B.jsx)(e,{"aria-label":`Refresh native builds`,className:`size-11 sm:size-7`,disabled:s.isLoading,onClick:()=>void s.refetch(),size:`icon-sm`,variant:`ghost`,children:(0,B.jsx)(C,{"aria-hidden":`true`})})]}),(0,B.jsx)(je,{builds:s,channel:r,onChannel:d,paged:i!==void 0||o!==void 0})]})]})}function Ne(){let e=T.useSearch(),t=T.useNavigate();return(0,B.jsx)(Me,{onSearchChange:e=>void t({search:e}),search:e})}export{Ne as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-builds-cT9Ha-jZ.js","assets/sidebar-Di9SN47G.js","assets/preload-helper-B44EvKhG.js","assets/link-DTEyW70e.js","assets/select-CBIU0_M1.js","assets/useCompositeListItem-JmyDfo3-.js","assets/check-CXVR3s3X.js","assets/arrow-up-right-DK8Zdg40.js","assets/TargetDisplay-CoYY8Fs4.js","assets/copy-DsuLj3oj.js","assets/HashValueDisplay-MoZMmTeP.js","assets/dist-Bf1BPKMs.js","assets/key-round-DzBe6DHr.js","assets/package-ytYrywZH.js","assets/badge-laIuYW1U.js","assets/uuidv7-cI6C63Fm.js","assets/-native-builds-search-OlRj4Jz0.js","assets/refresh-cw-C-tvoCcE.js","assets/StoreSubmission-F00RL5rI.js","assets/relativeTime-DvyxGIsm.js","assets/RelativeTime-CiZ7yXNJ.js","assets/chevron-right-BoUXo82O.js","assets/table-TUtVz-2l.js","assets/PlatformIcon-CJ69KopR.js","assets/dialog-CLIaC82_.js","assets/api-LQJH44FU.js","assets/useMutation-DbYw7boA.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./preload-helper-B44EvKhG.js";import{n as r}from"./-native-builds-search-OlRj4Jz0.js";var i=t(`/native-builds`)({component:e(()=>n(()=>import(`./native-builds-cT9Ha-jZ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])),`component`),validateSearch:r});export{i as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/native-builds_._buildId-DZPcR_up.js","assets/sidebar-Di9SN47G.js","assets/link-DTEyW70e.js","assets/relativeTime-DvyxGIsm.js","assets/arrow-up-right-DK8Zdg40.js","assets/TargetDisplay-CoYY8Fs4.js","assets/copy-DsuLj3oj.js","assets/HashValueDisplay-MoZMmTeP.js","assets/dist-Bf1BPKMs.js","assets/key-round-DzBe6DHr.js","assets/package-ytYrywZH.js","assets/badge-laIuYW1U.js","assets/uuidv7-cI6C63Fm.js","assets/chevron-right-BoUXo82O.js","assets/RolloutPercentageBadge-D-tZKnX7.js","assets/history-DakJoeSM.js","assets/-native-builds-search-OlRj4Jz0.js","assets/refresh-cw-C-tvoCcE.js","assets/StoreSubmission-F00RL5rI.js","assets/smartphone-r0rRdPas.js","assets/BundleIdDisplay-CP6rsdFO.js","assets/PlatformIcon-CJ69KopR.js","assets/card-ulgg5xHn.js","assets/empty-Bhlj8PEo.js","assets/table-TUtVz-2l.js","assets/api-LQJH44FU.js","assets/useMutation-DbYw7boA.js"])))=>i.map(i=>d[i]);
2
+ import{ir as e}from"./sidebar-Di9SN47G.js";import{n as t,r as n,t as r}from"./preload-helper-B44EvKhG.js";import{t as i}from"./-native-builds-search-OlRj4Jz0.js";var a=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),o=n(`/native-builds_/$buildId`)({component:t(()=>r(()=>import(`./native-builds_._buildId-DZPcR_up.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26])),`component`),validateSearch:i});export{a as n,o as t};
@@ -0,0 +1 @@
1
+ import{$ as e,Fn as t,In as n,Ln as r,Wr as i,ii as a,ir as o,p as s,ti as c}from"./sidebar-Di9SN47G.js";import{t as l}from"./link-DTEyW70e.js";import{t as u}from"./arrow-up-right-DK8Zdg40.js";import{C as d,S as f,_ as ee,a as te,c as p,d as ne,f as re,g as ie,h as ae,i as oe,l as se,m,o as ce,p as le,r as ue,s as de,t as fe,v as pe,w as me,x as h,y as g}from"./TargetDisplay-CoYY8Fs4.js";import{t as he}from"./chevron-right-BoUXo82O.js";import{n as ge,t as _}from"./native-builds_._buildId-BBwE8Pcc.js";import{r as _e}from"./HashValueDisplay-MoZMmTeP.js";import{i as ve,n as ye,r as v,t as be}from"./RolloutPercentageBadge-D-tZKnX7.js";import{n as xe,t as Se}from"./history-DakJoeSM.js";import{r as Ce}from"./-native-builds-search-OlRj4Jz0.js";import{t as we}from"./refresh-cw-C-tvoCcE.js";import{n as y,t as Te}from"./StoreSubmission-F00RL5rI.js";import{t as Ee}from"./smartphone-r0rRdPas.js";import{a as b,i as x,n as S,o as C,r as De,t as Oe}from"./badge-laIuYW1U.js";import{n as w}from"./dist-Bf1BPKMs.js";import{a as T,n as E,o as D,t as O}from"./card-ulgg5xHn.js";import{r as ke}from"./uuidv7-cI6C63Fm.js";import{a as k,i as A,n as j,o as M,r as N,t as P}from"./empty-Bhlj8PEo.js";import{n as Ae}from"./relativeTime-DvyxGIsm.js";import{t as je}from"./PlatformIcon-CJ69KopR.js";import{a as Me,d as Ne,f as Pe,l as Fe,m as Ie,p as Le,u as Re}from"./api-LQJH44FU.js";import{a as ze,i as F,n as Be,o as I,r as L,t as Ve}from"./table-TUtVz-2l.js";import{t as He}from"./BundleIdDisplay-CP6rsdFO.js";var Ue=o(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),R=i();function We({value:e,length:t,label:n}){let r=async()=>{try{await navigator.clipboard.writeText(e),w.success(`Copied to clipboard`,{description:e})}catch{w.error(`Could not copy the ${n}`)}};return(0,R.jsx)(`button`,{"aria-label":`Copy the ${n} ${e}`,className:`relative cursor-copy rounded-sm font-mono after:absolute after:-inset-x-2 after:-inset-y-4 sm:after:hidden text-xs whitespace-nowrap tabular-nums underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,onClick:e=>{e.stopPropagation(),r()},title:e,translate:`no`,type:`button`,children:e.slice(0,t)})}function Ge({hash:e}){let t=Me();if(e===null)return(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let n=ye(t.data?.console.gitUrl,e);return n===null?(0,R.jsx)(We,{label:`commit`,length:7,value:e}):(0,R.jsx)(`a`,{className:`relative font-mono text-xs whitespace-nowrap underline-offset-4 after:absolute after:-inset-x-2 after:-inset-y-4 hover:underline sm:after:hidden`,href:n,onClick:e=>e.stopPropagation(),rel:`noreferrer`,target:`_blank`,title:e,translate:`no`,children:e.slice(0,7)})}function z({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-[10rem_minmax(0,1fr)] sm:gap-4`,children:[(0,R.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,R.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}function Ke({detail:e}){let{build:n,channel:r}=e,i=Fe();if(r.startsWith(`sandbox-`))return null;let a=n.store_build!==!0;return(0,R.jsx)(t,{className:`min-h-11 shrink-0 sm:min-h-8`,disabled:i.isPending,onClick:()=>i.mutate({id:n.id,storeBuild:a},{onSuccess:()=>{w.success(a?`Marked as the store build`:`Mark cleared`)},onError:e=>{w.error(`Could not change the mark`,{description:e.message})}}),size:`sm`,type:`button`,variant:`outline`,children:a?`Mark as store build`:`Clear mark`})}function qe({detail:e}){let{build:t,newestInScope:n,storeBuildInScope:r}=e,i=r??n;if(i===null)return null;let a=i.id===t.id;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-md border bg-muted/40 p-3 text-xs sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,R.jsx)(a?ge:Se,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),r?.id===t.id?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Store build.`}),` New deploys to this scope patch from this build.`]}):a?(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Current baseline.`}),` The newest build, and no store build is marked. New deploys to this scope patch from this build.`]}):(0,R.jsxs)(`p`,{children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Not the base.`}),` New deploys patch from`,` `,(0,R.jsxs)(l,{className:`inline-flex items-center gap-0.5 font-medium underline underline-offset-4`,params:{buildId:i.id},to:`/native-builds/$buildId`,children:[ee(i)??(0,R.jsxs)(R.Fragment,{children:[g(i.platform),` `,se[i.artifact_kind].label,` ·`,` `,(0,R.jsx)(v,{uuid:i.id})]}),(0,R.jsx)(u,{"aria-hidden":`true`,className:`size-3`})]}),`, so this one gets no new patches.`]})]}),(0,R.jsx)(Ke,{detail:e})]})}function Je({detail:e}){let{build:t,builtInBundle:n,channel:r}=e,i=n?.childCount??0;return(0,R.jsxs)(O,{className:`overflow-hidden shadow-sm`,children:[(0,R.jsx)(T,{className:`border-b px-4 py-3`,children:(0,R.jsx)(D,{className:`text-sm`,children:(0,R.jsx)(`h2`,{children:`Built-in bundle`})})}),(0,R.jsxs)(E,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,R.jsxs)(`dl`,{className:`flex flex-col gap-3`,children:[(0,R.jsx)(z,{label:`Bundle ID`,children:(0,R.jsx)(He,{bundleId:t.min_bundle_id})}),(0,R.jsx)(z,{label:`OTAs patching from it`,children:(0,R.jsx)(`span`,{className:`tabular-nums`,children:i===1?`1 bundle`:`${i} bundles`})}),(0,R.jsx)(z,{label:`Scope`,children:(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(l,{"aria-label":`Show the builds that embed ${r}`,className:`relative rounded-md after:absolute after:inset-x-0 after:-inset-y-[11px] sm:after:hidden`,search:{channel:r},to:`/native-builds`,children:(0,R.jsx)(d,{channel:r})}),(0,R.jsx)(`span`,{className:`text-xs`,children:g(t.platform)})]})}),(0,R.jsx)(z,{label:`Target`,children:(0,R.jsx)(`span`,{className:`text-xs`,children:(0,R.jsx)(ue,{appVersion:t.app_version,fingerprintHash:t.fingerprint_hash})})}),(0,R.jsx)(z,{label:`Build key`,children:(0,R.jsx)(`span`,{className:`text-xs`,children:(0,R.jsx)(fe,{value:t.build_key})})}),t.build_number?(0,R.jsx)(z,{label:`Build`,children:(0,R.jsx)(`span`,{className:`font-mono text-xs tabular-nums`,translate:`no`,children:t.build_number})}):null,y(t)?(0,R.jsx)(z,{label:`Store`,children:(0,R.jsx)(Te,{build:t,withTime:!0})}):null,(0,R.jsx)(z,{label:`Commit`,children:(0,R.jsx)(Ge,{hash:t.git_commit_hash})}),(0,R.jsx)(z,{label:`Created`,children:(0,R.jsx)(v,{format:`both`,uuid:t.id})})]}),(0,R.jsx)(qe,{detail:e}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`A store or test install of this build runs this bundle until its first OTA. That OTA downloads as a patch from this bundle when one exists, and as the full bundle otherwise.`})]})]})}var B=a(c(),1),Ye=a(Ae(),1),V=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(V||{}),Xe=[0,1],Ze=[1,0],Qe=[2,3],$e=[3,2],et={L:Xe,M:Ze,Q:Qe,H:$e},tt=/^\d*$/,nt=/^[A-Z0-9 $%*+./:-]*$/,H=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,U=1,W=40,rt=3,it=3,G=40,at=10,ot=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],st=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],ct=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<U||e>W)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,V.Timing),this.setFunctionModule(e,6,e%2==0,V.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,q(r,e));this.setFunctionModule(8,7,q(r,6)),this.setFunctionModule(8,8,q(r,7)),this.setFunctionModule(7,8,q(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,q(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,q(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,q(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=q(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,V.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,V.Alignment)}setFunctionModule(e,t,n,r=V.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==X(t,n))throw RangeError(`Invalid argument`);let r=st[n[0]][t],i=ot[n[0]][t],a=Math.floor(Y(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=xt(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=St(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Y(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=q(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=rt:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*G),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*G}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=rt:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*G),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*G}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=it)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*at,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function K(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function q(e,t){return(e>>>t&1)!=0}var J=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},lt=[1,10,12,14],ut=[2,9,11,13],dt=[4,8,16,16];function ft(e,t){return e[Math.floor((t+7)/17)+1]}function pt(e){let t=[];for(let n of e)K(n,8,t);return new J(dt,e.length,t)}function mt(e){if(!_t(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);K(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new J(lt,e.length,t)}function ht(e){if(!vt(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n;for(n=0;n+2<=e.length;n+=2){let r=H.indexOf(e.charAt(n))*45;r+=H.indexOf(e.charAt(n+1)),K(r,11,t)}return n<e.length&&K(H.indexOf(e.charAt(n)),6,t),new J(ut,e.length,t)}function gt(e){return e===``?[]:_t(e)?[mt(e)]:vt(e)?[ht(e)]:[pt(bt(e))]}function _t(e){return tt.test(e)}function vt(e){return nt.test(e)}function yt(e,t){let n=0;for(let r of e){let e=ft(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function bt(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Y(e){if(e<U||e>W)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function X(e,t){return Math.floor(Y(e)/8)-ot[t[0]][e]*st[t[0]][e]}function xt(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=Z(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Z(n,2)}return t}function St(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=Z(t,e))}return n}function Z(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Ct(e,t,n=1,r=40,i=-1,a=!0){if(!(U<=n&&n<=r&&r<=W)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=X(o,t)*8,i=yt(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[Ze,Qe,$e])a&&s<=X(o,e)*8&&(t=e);let c=[];for(let t of e){K(t.mode[0],4,c),K(t.numChars,ft(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=X(o,t)*8;K(0,Math.min(4,l-c.length),c),K(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)K(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new ct(o,t,u,i)}function wt(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?gt(e):Array.isArray(e)?[pt(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Ct(c,et[n],i,a,o,r),u=Tt({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Tt(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=V.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}var Et=e=>{let{data:t,size:n}=wt(e,{ecc:`M`,border:4}),r=``;return t.forEach((e,t)=>e.forEach((e,n)=>{e&&(r+=`M${n} ${t}h1v1h-1z`)})),{size:n,path:r}};function Dt({value:e,label:t,className:n}){let{size:i,path:a}=(0,B.useMemo)(()=>Et(e),[e]);return(0,R.jsxs)(`svg`,{"aria-label":t,className:r(`aspect-square rounded-md`,n),role:`img`,shapeRendering:`crispEdges`,viewBox:`0 0 ${i} ${i}`,children:[(0,R.jsx)(`rect`,{fill:`#fff`,height:i,width:i}),(0,R.jsx)(`path`,{d:a,fill:`#000`})]})}var Ot=`With the same bundle ID, this install replaces the App Store's copy of the app on this iPhone.`,Q=`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`,kt=e=>/iPhone|iPod|iPad/u.test(e.userAgent)||/Macintosh/u.test(e.userAgent)&&e.maxTouchPoints>1,At=()=>{let[e,t]=(0,B.useState)(null);return(0,B.useEffect)(()=>{let e=null;try{e=window.localStorage.getItem(te)}catch{}t({ios:kt(navigator),udid:e!==null&&oe.test(e)?e:null})},[]),e},jt=300*1e3,Mt=(e,t)=>{let[,n]=(0,B.useReducer)(e=>e+1,0),r=e+ce-jt;return(0,B.useEffect)(()=>{if(!t)return;let e=setTimeout(n,Math.max(0,r-Date.now()));return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,n),()=>{clearTimeout(e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,n)}},[r,t]),t&&Date.now()>=r};function Nt({fetching:e,onRenew:n}){return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:[`This install link has expired.`,e?` Getting a new one.`:``]}),e?null:(0,R.jsx)(t,{className:Q,onClick:n,variant:`outline`,children:`Get a new link`})]})}function Pt({build:e,token:t,secondary:r=!1}){return(0,R.jsx)(`a`,{className:n({className:Q,variant:r?`outline`:`default`}),href:ie(window.location,e.id,t),children:r?`Install anyway`:`Install`})}function $(){return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`On iOS 16 or later, the app opens only with Developer Mode on: Settings, Privacy & Security, Developer Mode.`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Ot})]})}function Ft({build:e,outline:t=!1}){return(0,R.jsxs)(`a`,{className:n({className:Q,variant:t?`outline`:`default`}),href:`${de(window.location,e.id)}${re(e.id)}`,children:[(0,R.jsx)(Ee,{"data-icon":`inline-start`}),`Check this iPhone`]})}function It({build:t,udid:n}){let r=Le(t.id,n),{refetch:i}=r,a=Mt(r.dataUpdatedAt,r.data?.status===`installable`);if((0,B.useEffect)(()=>{a&&i()},[a,i]),r.isPending)return(0,R.jsx)(e,{"aria-label":`Reading this IPA`,className:`h-11 w-full`});let o=r.data;if(o===void 0||o.status===`unavailable`)return(0,R.jsxs)(S,{children:[(0,R.jsx)(C,{}),(0,R.jsx)(b,{children:`Installation details unavailable`}),(0,R.jsx)(x,{children:`The Console couldn't read this IPA from storage in parts, which takes an HTTPS download link that answers Range requests. Xcode or Apple Configurator still installs the download over USB.`})]});if(o.status===`store`)return(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This IPA is an App Store export, which installs through TestFlight, not from this page.`});if(o.status===`expired`)return(0,R.jsxs)(S,{variant:`destructive`,children:[(0,R.jsx)(C,{}),(0,R.jsx)(b,{children:`This build's profile has expired`}),(0,R.jsxs)(x,{children:[`It expired on `,(0,Ye.default)(o.expiresAt).format(`YYYY-MM-DD`),`. A maintainer rebuilds it to install again.`]})]});let s=o.link.status===`issued`?o.link.token:null;if(o.link.status===`no-secret`)return(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:[`Set `,o.link.secretName,` on the Console to install from this page.`]});if(s===null)return null;let c=({secondary:e=!1}={})=>a?(0,R.jsx)(Nt,{fetching:r.isFetching,onRenew:()=>void i()}):(0,R.jsx)(Pt,{build:t,secondary:e,token:s});return o.device===`included`?(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:`This iPhone is in this build.`}),c(),(0,R.jsx)($,{})]}):o.device===`not-included`?(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:`Not in this build`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This IPA was signed without this iPhone. Send a maintainer this command, then open the newer build once they've rebuilt. Send it only if this is your iPhone.`})]}),(0,R.jsx)(f,{label:`the command that registers this iPhone`,value:ne(n??``),wrap:!0}),c({secondary:!0}),(0,R.jsx)($,{})]}):(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:`Is this iPhone in this build?`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`iOS installs this IPA only on the devices it lists. A profile reads this iPhone's ID and nothing else: allow the download, then install it from Settings, where iOS calls it not signed. Nothing stays installed.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,R.jsx)(Ft,{build:t}),c({secondary:!0})]}),(0,R.jsx)($,{})]})}var Lt={ipa:`The .ipa installs only on devices its signing profile allows (development or ad hoc); an App Store export reaches testers through TestFlight.`,aab:`The .aab installs through Google Play or bundletool, not from the file.`},Rt={apk:`Scan with an Android phone's camera, then open the APK to install it.`,ipa:`Scan to download. ${Lt.ipa}`,aab:`Scan to download. ${Lt.aab}`,app:`Scan to download the .app.zip on a Mac.`};function zt(){let{origin:e,pathname:t}=window.location;return(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,R.jsx)(Dt,{className:`size-48`,label:`Open this page on an iPhone`,value:`${e}${t}`}),(0,R.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:`Scan with an iPhone to install this build from here. The phone signs in to the Console first.`})]})}function Bt({build:e,url:t,note:n}){return(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,R.jsx)(Dt,{className:`size-48`,label:`Download ${m(e)}`,value:t}),(0,R.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:Rt[e.artifact_kind]}),n?(0,R.jsx)(`p`,{className:`max-w-56 text-center text-xs text-muted-foreground`,children:n}):null]})}function Vt({message:e}){return(0,R.jsxs)(S,{variant:`destructive`,children:[(0,R.jsx)(C,{}),(0,R.jsx)(b,{children:`The download link couldn't be created`}),(0,R.jsx)(x,{children:e})]})}function Ht({build:t}){let n=Pe(t.id),r=n.data?.url;if(r===null){let e=Lt[t.artifact_kind];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{children:`This storage gives no download link a phone can open without signing in, so there is no QR code. Download the build here, or open this page on the phone signed in to the console.`}),e?(0,R.jsx)(`p`,{children:e}):null]})}return r===void 0?n.isError?(0,R.jsx)(Vt,{message:n.error.message}):(0,R.jsx)(e,{className:`size-48`}):(0,R.jsx)(Bt,{build:t,note:`This link expires. If the download fails, reload this page.`,url:r})}function Ut({build:e}){return(0,R.jsx)(`span`,{className:`font-mono text-foreground`,translate:`no`,children:e.submitted_version??`this build`})}var Wt={testflight:{name:`App Store Connect`,url:`https://appstoreconnect.apple.com/apps`},"play-internal":{name:`Play Console`,url:`https://play.google.com/console`}};function Gt({build:e}){let t=Wt[e.submitted_to];return(0,R.jsxs)(O,{className:`overflow-hidden shadow-sm`,children:[(0,R.jsx)(T,{className:`border-b px-4 py-3`,children:(0,R.jsx)(D,{className:`text-sm`,children:(0,R.jsx)(`h2`,{children:`Install`})})}),(0,R.jsxs)(E,{className:`flex min-w-0 flex-col gap-4 p-4 sm:p-6`,children:[(0,R.jsx)(Kt,{build:e}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,R.jsxs)(`a`,{className:n({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`}),href:t.url,rel:`noreferrer`,target:`_blank`,children:[(0,R.jsx)(ve,{"data-icon":`inline-start`}),`Open `,t.name]}),(0,R.jsxs)(`a`,{className:n({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`,variant:`outline`}),download:!0,href:le(e.id),children:[(0,R.jsx)(_e,{"data-icon":`inline-start`}),(0,R.jsxs)(`span`,{className:`text-left [overflow-wrap:anywhere]`,children:[`Download `,m(e)]})]})]})]})]})}function Kt({build:e}){switch(e.artifact_kind){case`apk`:return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Your browser needs the "Install unknown apps" permission.`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If this package is already installed with another signing key, such as a Play copy, the install fails. Uninstall that copy first, or build with sandbox: true, whose .sandbox ID installs beside it.`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`On an emulator or a phone over USB, install and open it from your project:`}),(0,R.jsx)(f,{label:`the install command`,value:ae(e)})]});case`app`:return(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`It runs only in the iOS Simulator. In your project, install and open it on the booted one:`}),(0,R.jsx)(f,{label:`the install command`,value:ae(e)})]});case`aab`:return y(e)?(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Submitted to Google Play internal testing as`,` `,(0,R.jsx)(Ut,{build:e}),`. Testers get it once its release is rolled out; on an app Play Console hasn't published, the release is a draft you roll out in Play Console.`]}):(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`For testers, build and release to internal testing:`}),(0,R.jsx)(f,{label:`the Google Play command`,value:`npx hot-updater google-play upload`})]});case`ipa`:return y(e)?(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`On TestFlight as `,(0,R.jsx)(Ut,{build:e}),`. Internal testers install it from the TestFlight app once App Store Connect has processed it, and a preview's pull request comment shows that state.`]}):(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Over USB, Xcode or Apple Configurator installs it. For testers without a registered device:`}),(0,R.jsx)(f,{label:`the TestFlight command`,value:`npx hot-updater testflight`})]})}}function qt({link:e,url:t}){return e?.status===`no-secret`?(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,role:`status`,children:[`Set `,e.secretName,` on the Console to create links.`]}):e?.status!==`issued`||t===null?null:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,R.jsx)(f,{label:`the download link`,value:t}),(0,R.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Anyone with this link can download this build until`,` `,(0,Ye.default)(e.expiresAt).format(`YYYY-MM-DD`),`.`]})]})}function Jt({build:e}){return y(e)&&(e.artifact_kind===`ipa`||e.artifact_kind===`aab`)?(0,R.jsx)(Gt,{build:e}):(0,R.jsx)(Yt,{build:e})}function Yt({build:t}){let r=m(t),i=Ne(t.id),a=i.data?.status===`issued`?pe(window.location,t.id,i.data.token):null,o=At(),s=t.artifact_kind===`ipa`,c=s&&o?.ios===!0;return(0,R.jsxs)(O,{className:`overflow-hidden shadow-sm`,children:[(0,R.jsx)(T,{className:`border-b px-4 py-3`,children:(0,R.jsx)(D,{className:`text-sm`,children:(0,R.jsx)(`h2`,{children:`Install`})})}),(0,R.jsxs)(E,{className:c?`flex min-w-0 flex-col gap-6 p-4 sm:p-6`:`grid gap-6 p-4 sm:grid-cols-[12rem_minmax(0,1fr)] sm:p-6`,children:[c?(0,R.jsx)(It,{build:t,udid:o.udid}):s&&a!==null?(0,R.jsx)(zt,{}):a===null?i.data===void 0?i.isError?(0,R.jsx)(Vt,{message:i.error.message}):(0,R.jsx)(e,{className:`size-48`}):(0,R.jsx)(Ht,{build:t}):(0,R.jsx)(Bt,{build:t,url:a}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,R.jsx)(Kt,{build:t}),(0,R.jsxs)(`a`,{className:n({className:`h-auto min-h-11 w-full min-w-0 py-2 whitespace-normal sm:min-h-8 sm:w-fit`,variant:`outline`}),download:!0,href:a??le(t.id),children:[(0,R.jsx)(_e,{"data-icon":`inline-start`}),(0,R.jsxs)(`span`,{className:`text-left [overflow-wrap:anywhere]`,children:[`Download `,r]})]}),(0,R.jsx)(qt,{link:i.data,url:a})]})]})]})}var Xt=`https://hot-updater.dev/docs/guides/bundle-diffing#first-ota-update`;function Zt({detail:r,page:i,onPage:a}){let o=i.before!==void 0||i.after!==void 0,s=Ie(r.build.min_bundle_id,i,o),c=o?s.data:r.patches,{next:d,previous:f}=c??{};return(0,R.jsxs)(O,{className:`overflow-hidden shadow-sm`,id:`patches`,children:[(0,R.jsx)(T,{className:`border-b px-4 py-3`,children:(0,R.jsx)(D,{className:`text-sm`,children:(0,R.jsx)(`h2`,{children:`Patches from this build`})})}),(0,R.jsxs)(E,{className:`p-0`,children:[o&&s.isError?(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsxs)(S,{variant:`destructive`,children:[(0,R.jsx)(C,{}),(0,R.jsx)(b,{children:`Patches couldn't be loaded`}),(0,R.jsx)(x,{children:s.error.message}),(0,R.jsx)(De,{children:(0,R.jsxs)(t,{onClick:()=>void s.refetch(),size:`xs`,variant:`outline`,children:[(0,R.jsx)(we,{"data-icon":`inline-start`}),`Retry`]})})]})}):c===void 0?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`Loading patches`}),(0,R.jsx)(e,{className:`h-4 w-full`}),(0,R.jsx)(e,{className:`h-4 w-2/3`})]}):c.data.length===0?o?(0,R.jsxs)(P,{className:`py-10`,children:[(0,R.jsx)(A,{children:(0,R.jsx)(M,{children:`No more patches`})}),(0,R.jsx)(t,{className:`min-h-11 sm:min-h-8`,onClick:()=>a({}),variant:`outline`,children:`Show the newest patches`})]}):(0,R.jsxs)(P,{className:`py-10`,children:[(0,R.jsxs)(A,{children:[(0,R.jsx)(k,{variant:`icon`,children:(0,R.jsx)(xe,{})}),(0,R.jsx)(M,{children:`No patches from this build`}),(0,R.jsxs)(N,{children:[`A deploy adds a patch from this build's bundle while it is its scope's store build, or its newest build with none marked, and the deploy config turns patches on, with`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`patch`}),` in`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`hot-updater.config.ts`}),`.`]})]}),(0,R.jsx)(j,{children:(0,R.jsxs)(`a`,{className:n({className:`min-h-11 sm:min-h-8`,variant:`outline`}),href:Xt,rel:`noreferrer`,target:`_blank`,children:[`Bundle diffing guide`,(0,R.jsx)(u,{"data-icon":`inline-end`})]})})]}):(0,R.jsxs)(Ve,{"aria-busy":o&&s.isPlaceholderData,"aria-label":`Patches from this build`,className:`table-fixed`,children:[(0,R.jsx)(ze,{children:(0,R.jsxs)(I,{children:[(0,R.jsx)(F,{children:`Target bundle`}),(0,R.jsx)(F,{className:`w-28`,children:`Patch size`}),(0,R.jsx)(F,{className:`hidden w-32 sm:table-cell`,children:`Created`})]})}),(0,R.jsx)(Be,{children:c.data.map(e=>(0,R.jsxs)(I,{children:[(0,R.jsx)(L,{className:`py-3 whitespace-normal`,children:(0,R.jsx)(l,{className:`block font-mono text-xs [overflow-wrap:anywhere] underline-offset-4 hover:underline`,search:{bundleId:e.bundleId},title:e.bundleId,to:`/`,translate:`no`,children:e.bundleId})}),(0,R.jsx)(L,{className:`text-xs tabular-nums`,children:p(e.byteSize)}),(0,R.jsx)(L,{className:`hidden sm:table-cell`,children:(0,R.jsx)(v,{uuid:e.bundleId})})]},e.bundleId))})]}),d!==void 0||f!==void 0?(0,R.jsxs)(`nav`,{"aria-label":`Patch pages`,className:`flex items-center justify-end gap-2 border-t px-4 py-2`,children:[(0,R.jsxs)(t,{className:`min-h-11 sm:min-h-7`,disabled:f===void 0||o&&s.isPlaceholderData,onClick:()=>a({after:f}),size:`sm`,variant:`ghost`,children:[(0,R.jsx)(me,{"data-icon":`inline-start`}),`Newer`]}),(0,R.jsxs)(t,{className:`min-h-11 sm:min-h-7`,disabled:d===void 0||o&&s.isPlaceholderData,onClick:()=>a({before:d}),size:`sm`,variant:`ghost`,children:[`Older`,(0,R.jsx)(he,{"data-icon":`inline-end`})]})]}):null]})]})}var Qt=(e,t)=>{let n=e.data.find(e=>e.bundleId===t);if(n!==void 0)return{kind:`patch`,byteSize:n.byteSize};let r=e.data.at(-1)?.bundleId;return e.next!==void 0&&r!==void 0&&t<r?{kind:`unknown`}:{kind:`full`}};function $t({download:e}){switch(e.kind){case`patch`:return(0,R.jsxs)(`span`,{className:`text-xs`,children:[`Patch`,` `,(0,R.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[`(`,p(e.byteSize),`)`]})]});case`full`:return(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Full bundle`});case`unknown`:return(0,R.jsx)(`a`,{className:`text-xs underline-offset-4 hover:underline`,href:`#patches`,children:`See patches`})}}function en({detail:e}){let{build:t,channel:r,servedNow:i,patches:a,catalogScopeKey:o}=e,s=i.find(({rolloutCohortCount:e,targetCohorts:t})=>e>0||t.length>0)?.bundleId,c=t.store_build===!0&&s!=null&&Qt(a,s).kind===`full`?[`npx hot-updater patch`,`-p ${t.platform}`,`-c ${h(r)}`,`-b ${h(s)}`,`--base-artifact-id ${h(t.min_bundle_id)}`].join(` `):null,d=(0,R.jsxs)(l,{className:`inline-flex items-center gap-0.5 underline-offset-4 hover:underline`,search:{scopeKey:o},to:`/`,children:[`All releases in this scope`,(0,R.jsx)(u,{"aria-hidden":`true`,className:`size-3`})]});return(0,R.jsxs)(O,{className:`overflow-hidden shadow-sm`,children:[(0,R.jsx)(T,{className:`border-b px-4 py-3`,children:(0,R.jsx)(D,{className:`text-sm`,children:(0,R.jsx)(`h2`,{children:`Served now`})})}),(0,R.jsx)(E,{className:`p-0`,children:i.length===0?(0,R.jsxs)(P,{className:`py-10`,children:[(0,R.jsxs)(A,{children:[(0,R.jsx)(k,{variant:`icon`,children:(0,R.jsx)(Ue,{})}),(0,R.jsx)(M,{children:`No OTA for this build yet`}),(0,R.jsxs)(N,{children:[`No release in this build's scope is newer than its built-in bundle. Deploy one with`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`hot-updater deploy`}),`, and it shows here.`]})]}),(0,R.jsx)(j,{children:(0,R.jsx)(l,{className:n({className:`min-h-11 sm:min-h-8`,variant:`outline`}),search:{scopeKey:o},to:`/`,children:`All releases in this scope`})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Ve,{"aria-label":`Served now`,className:`table-fixed`,children:[(0,R.jsx)(ze,{children:(0,R.jsxs)(I,{children:[(0,R.jsx)(F,{children:`Bundle`}),(0,R.jsx)(F,{className:`hidden w-40 md:table-cell`,children:`Rollout`}),(0,R.jsx)(F,{className:`hidden w-32 sm:table-cell`,children:`Created`}),(0,R.jsx)(F,{className:`w-32`,children:`First OTA download`})]})}),(0,R.jsx)(Be,{children:i.map(e=>{let t=e.bundleId,n=e.rolloutCohortCount/ke*100;return(0,R.jsxs)(I,{children:[(0,R.jsx)(L,{className:`py-3 whitespace-normal`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,R.jsx)(l,{className:`font-mono text-xs [overflow-wrap:anywhere] underline-offset-4 hover:underline`,search:{releaseId:e.releaseId},title:t,to:`/`,translate:`no`,children:t}),e.message?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.message}):null]})}),(0,R.jsx)(L,{className:`hidden md:table-cell`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.targetCohorts.length>0?(0,R.jsx)(Oe,{variant:`secondary`,children:e.targetCohorts.length===1?`1 cohort`:`${e.targetCohorts.length} cohorts`}):(0,R.jsx)(be,{percentage:n}),e.shouldForceUpdate?(0,R.jsx)(Oe,{variant:`outline`,children:`Forced`}):null]})}),(0,R.jsx)(L,{className:`hidden sm:table-cell`,children:(0,R.jsx)(v,{uuid:t})}),(0,R.jsx)(L,{children:(0,R.jsx)($t,{download:Qt(a,t)})})]},e.releaseId)})})]}),c===null?null:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 border-t px-4 py-3 text-xs`,children:[(0,R.jsx)(`p`,{children:`The OTA fresh installs get first has no patch from this store build, so they download all of it. Add one from your project:`}),(0,R.jsx)(f,{label:`the patch command`,value:c})]}),(0,R.jsxs)(`p`,{className:`border-t px-4 py-3 text-xs text-muted-foreground`,children:[`What the update check serves an install of this build now, newest first: not the history. `,d]})]})})]})}function tn({buildId:r,search:i,onSearchChange:a}){let o=Re(r),c=o.data,u={...i.patchesBefore===void 0?{}:{before:i.patchesBefore},...i.patchesAfter===void 0?{}:{after:i.patchesAfter}};return(0,R.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,R.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 items-center gap-x-2 border-b bg-background px-3 py-3 sm:min-h-12 sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,R.jsx)(s,{className:`-ml-1 size-11 lg:size-7`}),(0,R.jsxs)(l,{className:n({className:`min-h-11 sm:min-h-7`,size:`sm`,variant:`ghost`}),to:`/native-builds`,children:[(0,R.jsx)(me,{"data-icon":`inline-start`}),`Native builds`]}),c?(0,R.jsxs)(`h1`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium`,children:[(0,R.jsx)(je,{className:`size-3.5 shrink-0 text-muted-foreground`,platform:c.build.platform}),(0,R.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,R.jsxs)(`span`,{className:`sr-only`,children:[g(c.build.platform),` `]}),se[c.build.artifact_kind].label,` ·`,` `,(0,R.jsx)(`span`,{translate:`no`,children:c.channel})]}),(0,R.jsx)(`span`,{className:`hidden text-xs font-normal text-muted-foreground tabular-nums sm:inline`,children:p(c.build.byte_size)})]}):(0,R.jsx)(`h1`,{className:`sr-only`,children:`Native build`})]}),(0,R.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,R.jsx)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4 sm:gap-6`,children:o.isError?(0,R.jsxs)(S,{variant:`destructive`,children:[(0,R.jsx)(C,{}),(0,R.jsx)(b,{children:`The native build couldn't be loaded`}),(0,R.jsx)(x,{children:o.error.message}),(0,R.jsx)(De,{children:(0,R.jsxs)(t,{onClick:()=>void o.refetch(),size:`xs`,variant:`outline`,children:[(0,R.jsx)(we,{"data-icon":`inline-start`}),`Retry`]})})]}):c===void 0?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`sr-only`,children:`Loading the native build`}),(0,R.jsx)(e,{className:`h-56 w-full rounded-xl`}),(0,R.jsx)(e,{className:`h-64 w-full rounded-xl`})]}):c===null?(0,R.jsxs)(P,{className:`border py-16`,children:[(0,R.jsxs)(A,{children:[(0,R.jsx)(k,{variant:`icon`,children:(0,R.jsx)(Ce,{})}),(0,R.jsx)(M,{children:`Native build not found`}),(0,R.jsxs)(N,{children:[`No native build has this ID. It may have been deleted with`,` `,(0,R.jsx)(`code`,{className:`font-mono`,children:`native-build delete`}),`, or be from another console.`]})]}),(0,R.jsx)(j,{children:(0,R.jsx)(l,{className:n({className:`min-h-11 sm:min-h-8`,variant:`outline`}),to:`/native-builds`,children:`Show all native builds`})})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Jt,{build:c.build}),(0,R.jsx)(Je,{detail:c}),(0,R.jsx)(en,{detail:c}),(0,R.jsx)(Zt,{detail:c,onPage:e=>a({...e.before===void 0?{}:{patchesBefore:e.before},...e.after===void 0?{}:{patchesAfter:e.after}}),page:u})]})})})]})}function nn(){let{buildId:e}=_.useParams(),t=_.useSearch(),n=_.useNavigate();return(0,R.jsx)(tn,{buildId:e,onSearchChange:e=>void n({search:e,replace:!0}),search:t})}export{nn as component};
@@ -0,0 +1 @@
1
+ import{ir as e}from"./sidebar-Di9SN47G.js";var t=e(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./ConsoleFeatureUnavailable-DUqlpHCp.js";var t=e;export{t as notFoundComponent};
@@ -1 +1 @@
1
- import{Wr as e}from"./sidebar-Di9SN47G.js";import{n as t,t as n}from"./remote-config-Bw6sErCV.js";var r=e();function i(){let{tab:e=`parameters`}=n.useSearch(),i=n.useNavigate();return(0,r.jsx)(t,{onTabChange:e=>void i({search:e===`parameters`?{}:{tab:e},replace:!0}),tab:e})}export{i as component};
1
+ import{Wr as e}from"./sidebar-Di9SN47G.js";import{n as t,t as n}from"./remote-config-ZJ_IRSKE.js";var r=e();function i(){let{tab:e=`parameters`}=n.useSearch(),i=n.useNavigate();return(0,r.jsx)(t,{onTabChange:e=>void i({search:e===`parameters`?{}:{tab:e},replace:!0}),tab:e})}export{i as component};
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-config-CIAEArwq.js","assets/ConsoleFeatureUnavailable-DUqlpHCp.js","assets/sidebar-Di9SN47G.js","assets/console-features-api-DEXSwFtc.js","assets/arrow-up-right-DK8Zdg40.js","assets/NotFoundPage-Ckb5GMhh.js","assets/link-DTEyW70e.js","assets/empty-Bhlj8PEo.js","assets/remote-config-Dwdc-sij.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,Bn as t,Fn as n,Gn as r,Gr as i,Hn as a,Jn as o,Ln as s,Or as c,Rn as l,Vn as u,Vr as d,Wr as f,Yt as p,Z as m,Zn as h,ar as g,fn as _,ii as v,ir as y,nr as b,p as x,rr as S,ti as C,ut as w,zr as T}from"./sidebar-Di9SN47G.js";import{n as ee,r as te,t as E}from"./preload-helper-B44EvKhG.js";import{t as D}from"./useInfiniteQuery-DX4WpBRG.js";import{t as O}from"./useMutation-DbYw7boA.js";import{r as k}from"./console-features-api-DEXSwFtc.js";import{t as ne}from"./arrow-right-CNII8TYn.js";import{i as re}from"./useCompositeListItem-JmyDfo3-.js";import{a as ie,i as A,n as ae,o as oe,r as se,s as ce,t as le}from"./select-CBIU0_M1.js";import{t as ue}from"./clipboard-DQbOcrL7.js";import{n as de,t as fe}from"./history-DakJoeSM.js";import{n as pe,t as j}from"./plus-BVhOauU3.js";import{t as me}from"./refresh-cw-C-tvoCcE.js";import{i as he,n as ge,o as _e,r as ve,s as ye,t as be}from"./input-group-D_NfhUbX.js";import{t as xe}from"./search-nnvSOTEB.js";import{a as Se,i as Ce,n as M,r as we,t as Te}from"./switch-CP6GsHmN.js";import{t as Ee}from"./smartphone-r0rRdPas.js";import{a as N,i as P,n as F,o as I,r as L,t as R}from"./badge-laIuYW1U.js";import{t as De}from"./undo-2-Bt0YXG26.js";import{n as z}from"./dist-Bf1BPKMs.js";import{a as Oe,n as ke,o as Ae,r as je,t as Me}from"./card-ulgg5xHn.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,t as Re}from"./empty-Bhlj8PEo.js";import{n as ze,t as Be}from"./relativeTime-DvyxGIsm.js";import{a as Ve,i as He,n as Ue,o as We,r as Ge,t as Ke}from"./tabs-CP3CSmtI.js";import{a as qe,i as Je,l as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./alert-dialog-DiRLrFVe.js";import{t as tt}from"./PlatformIcon-CJ69KopR.js";import{a as nt,i as rt,n as it,o as at,r as B,t as ot}from"./dialog-CLIaC82_.js";import{a as V,i as st,n as ct,o as lt,r as H,s as ut,t as U}from"./field-q4sTYzNU.js";import{i as dt}from"./api-LQJH44FU.js";var ft=y(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),pt=y(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),mt=y(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),ht=y(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),gt=y(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),_t=y(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),W=v(C()),G=f(),vt=v(ze(),1),yt=v(Be(),1),bt=d({method:`GET`}).middleware([b]).handler(i(`0ccfae64b399b03d820328fa98a38e2caa0b622d3da5a7ca633c5a0e8101e3f6`)),xt=d({method:`GET`}).middleware([b]).handler(i(`3377db68b9d1d971971595469029c0466da0777a177b294d655cd0c039737f1a`)),St=d({method:`GET`}).middleware([b]).handler(i(`af71e3c55a659ce46093e33b9d70e729359610eec7d576502e8f0e26c785b317`)),Ct=d({method:`POST`}).middleware([b]).handler(i(`4182bf9ccbb675700638f30bc6122517ccd90b16a339a6823a0f5f6c808d70a6`)),wt=d({method:`POST`}).middleware([b]).handler(i(`98c10bdc514eb4d3fe65af546be44452b492a81092cfe45625778a4c9f731727`)),Tt=d({method:`POST`}).middleware([b]).handler(i(`1371bff16085636e2c44b60a573ae434b556c63045c40a0a93a93ab69ec47999`)),K={all:[`remote-config`],active:[`remote-config`,`active`],versions:[`remote-config`,`versions`],version:e=>[`remote-config`,`version`,e],preview:e=>[`remote-config`,`preview`,e]},Et=()=>g({queryKey:K.active,queryFn:()=>bt(),staleTime:6e4}),Dt=({enabled:e})=>D({queryKey:K.versions,queryFn:({pageParam:e})=>xt({data:e===void 0?{}:{cursor:e}}),initialPageParam:void 0,getNextPageParam:e=>e.next,staleTime:6e4,enabled:e}),Ot=e=>g({queryKey:K.version(e??0),queryFn:()=>St({data:{version:e}}),enabled:e!==null,staleTime:1/0}),kt=()=>{let e=T();return async()=>{await Promise.all([e.invalidateQueries({queryKey:K.active}),e.invalidateQueries({queryKey:K.versions})])}},At=()=>{let e=kt();return O({mutationFn:e=>Ct({data:e}),onSuccess:async t=>{(t.status===`published`||t.status===`conflict`)&&await e()}})},jt=()=>O({mutationFn:e=>wt({data:e}),onSuccess:kt()}),Mt=e=>g({queryKey:K.preview(e),queryFn:()=>Tt({data:e}),placeholderData:c,staleTime:1/0}),q={STRING:`String`,NUMBER:`Number`,BOOLEAN:`Boolean`,JSON:`JSON`},J={platform:`Platform`,channel:`Channel`,appVersion:`App version`,percent:`Percentage of installs`,cohort:`Cohort`,fingerprint:`Fingerprint`,dateTime:`Date and time`},Y=(e,t)=>e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0,Nt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Pt=(e,t,n,r)=>{let i=Object.entries(e.parameters),a=t===null?-1:i.findIndex(([e])=>e===t),o=a===-1?[...i.filter(([e])=>e!==n),[n,r]]:i.map((e,t)=>t===a?[n,r]:e);return{...e,parameters:Object.fromEntries(o)}},Ft=(e,t)=>({...e,parameters:Object.fromEntries(Object.entries(e.parameters).filter(([e])=>e!==t))}),It=(e,t)=>Object.fromEntries(Object.entries(e.parameters).map(([e,n])=>{let{conditionalValues:r,...i}=n,a=Object.entries(r??{}).flatMap(([e,n])=>{let r=t(e);return r===null?[]:[[r,n]]});return[e,a.length===0?i:{...i,conditionalValues:Object.fromEntries(a)}]})),Lt=(e,t,n)=>t===null?{...e,conditions:[...e.conditions,n]}:{conditions:e.conditions.map(e=>e.name===t?n:e),parameters:t===n.name?e.parameters:It(e,e=>e===t?n.name:e)},Rt=(e,t)=>({conditions:e.conditions.filter(e=>e.name!==t),parameters:It(e,e=>e===t?null:e)}),zt=(e,t,n)=>{let r=t+n;if(r<0||r>=e.conditions.length)return e;let i=[...e.conditions];return[i[t],i[r]]=[i[r],i[t]],{...e,conditions:i}},Bt=(e,t)=>Object.entries(e.parameters).filter(([,e])=>Y(e.conditionalValues,t)!==void 0).map(([e])=>e),Vt=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} +${e.length-t}`,Ht=e=>Number.isInteger(e)?String(e):e.toFixed(1),Ut=e=>{let t=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:e===`UTC`?`short`:`shortOffset`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});return e=>t.format(new Date(e))},Wt=Ut(`UTC`),Gt=(e=new Date)=>{let t=new Date(e);t.setMinutes(60,0,0);let n=new Date(e);n.setDate(n.getDate()+1),n.setHours(9,0,0,0);let r=new Date(e);return r.setSeconds(0,0),[{label:`Now`,iso:r.toISOString()},{label:`Next hour`,iso:t.toISOString()},{label:`Tomorrow 09:00`,iso:n.toISOString()}]},Kt=(e,t=new Date)=>{let n=e===void 0?t:new Date(e),r=e=>{let t=new Date(n);return t.setDate(t.getDate()+e),t.setSeconds(0,0),t.toISOString()};return[{label:`+1 day`,iso:r(1)},{label:`+1 week`,iso:r(7)}]},qt=e=>{if(e===void 0)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`},Jt=e=>{if(e.length===0)return;let t=new Date(e).getTime();return Number.isFinite(t)?new Date(t).toISOString():void 0},Yt=(e,t=Wt)=>{switch(e.type){case`platform`:return`Platform is ${Vt(e.platforms.map(e=>e===`ios`?`iOS`:`Android`))}`;case`channel`:return`Channel is ${Vt(e.channels)}`;case`appVersion`:return`App version ${e.range}`;case`cohort`:return`Cohort is ${Vt(e.cohorts)}`;case`percent`:return e.from===0?`${Ht(e.to)}% of installs`:`${Ht(e.from)}–${Ht(e.to)}% of installs`;case`fingerprint`:return`Fingerprint is ${Vt(e.hashes.map(e=>e.slice(0,8)))}`;case`dateTime`:return e.from!==void 0&&e.to!==void 0?`From ${t(e.from)} until ${t(e.to)}`:e.from===void 0?`Until ${t(e.to??``)}`:`From ${t(e.from)}`}},X=e=>`value`in e?e.value.length===0?`""`:e.value:`In-app default`,Xt=()=>{let e=crypto.getRandomValues(new Uint8Array(6));return Array.from(e,e=>e.toString(36).padStart(2,`0`)).join(``).slice(0,8)},Zt=(e,t)=>({added:Object.keys(t).filter(t=>!Object.hasOwn(e,t)),changed:Object.keys(t).filter(n=>Object.hasOwn(e,n)&&JSON.stringify(e[n])!==JSON.stringify(t[n])),removed:Object.keys(e).filter(e=>!Object.hasOwn(t,e))}),Qt=(e,t)=>{let n=e=>Object.fromEntries(e.conditions.map(e=>[e.name,e])),r=(e,t)=>e.conditions.map(({name:e})=>e).filter(e=>t.conditions.some(t=>t.name===e));return{parameters:Zt(e.parameters,t.parameters),conditions:Zt(n(e),n(t)),reordered:r(e,t).join(`
3
+ `)!==r(t,e).join(`
4
+ `)}},Z=`Not set`,$t=(e,t)=>{let n=[],r=(e,t,r)=>{(t===null?r!==Z:t!==r)&&n.push({field:e,before:t,after:r})};r(`Type`,e===null?null:q[e.valueType],q[t.valueType]),r(`Default`,e===null?null:X(e.defaultValue),X(t.defaultValue));let i=new Set([...Object.keys(e?.conditionalValues??{}),...Object.keys(t.conditionalValues??{})]);for(let n of i){let i=Y(e?.conditionalValues,n),a=Y(t.conditionalValues,n);r(`When ${n}`,e===null?null:i===void 0?Z:X(i),a===void 0?Z:X(a))}return r(`Description`,e===null?null:e.description??Z,t.description??Z),n},en=(e,t,n=Wt)=>{let r=e=>e.rules.map(e=>Yt(e,n)).join(` · `),i=r(t);if(e===null)return[{field:`Rules`,before:null,after:i}];let a=r(e);return a===i?[]:[{field:`Rules`,before:a,after:i}]},tn=`hot-updater:remote-config-draft`,Q=e=>typeof e==`object`&&!!e&&!Array.isArray(e),nn=e=>Q(e)&&(typeof e.value==`string`||e.useInAppDefault===!0),rn=e=>Q(e)&&Q(e.parameters)&&Array.isArray(e.conditions)&&Object.values(e.parameters).every(e=>Q(e)&&Object.hasOwn(q,String(e.valueType))&&nn(e.defaultValue)&&(e.conditionalValues===void 0||Q(e.conditionalValues)&&Object.values(e.conditionalValues).every(nn)))&&e.conditions.every(e=>Q(e)&&typeof e.name==`string`&&Array.isArray(e.rules)&&e.rules.every(e=>Q(e)&&Object.hasOwn(J,String(e.type)))),an=e=>{try{let t=window.localStorage.getItem(tn);if(t===null)return null;let n=JSON.parse(t);return!Q(n)||n.baseVersion!==e.version||!rn(n.base)||!rn(n.template)||!Nt(n.base,e.template)||Nt(n.template,e.template)?null:{baseVersion:e.version,base:n.base,template:n.template}}catch{return null}},on=e=>{try{return e===null?window.localStorage.removeItem(tn):window.localStorage.setItem(tn,JSON.stringify(e)),!0}catch{return!1}},sn=/^[A-Za-z_][A-Za-z0-9_]{0,255}$/u,cn=(e,t)=>e.length===0?`Enter a key.`:sn.test(e)?t.includes(e)?`Another parameter uses this key.`:null:`Start with a letter or _, then use letters, digits, and _.`,ln=(e,t)=>{if(e===`NUMBER`)return t.trim().length>0&&Number.isFinite(Number(t))?null:`Enter a number.`;if(e===`JSON`)try{return JSON.parse(t),null}catch{return`Enter valid JSON.`}return e===`BOOLEAN`&&t!==`true`&&t!==`false`?`Choose true or false.`:null},un=(e,t,n)=>{let r=e.map(e=>Yt(e,n)).join(` · `),i=r.length<=100?r:`${r.slice(0,99).trimEnd()}…`;if(i.length===0||!t.includes(i))return i;for(let e=2;;e+=1){let n=` (${e})`,r=`${i.slice(0,100-n.length)}${n}`;if(!t.includes(r))return r}},dn=(e,t)=>{let n=e.trim();return n.length===0?`Enter a name.`:n.length>100?`Use 100 characters or fewer.`:t.includes(n)?`Another condition uses this name.`:null},fn=e=>[...new Set(e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e.length>0))],pn=e=>{switch(e.type){case`platform`:return e.platforms.length===0?`Choose a platform.`:null;case`channel`:return e.channels.length===0?`Enter a channel.`:null;case`appVersion`:return e.range.trim().length===0?`Enter a version range, such as >=1.4.0.`:null;case`cohort`:return e.cohorts.length===0?`Enter a cohort.`:null;case`percent`:return e.from>=e.to||e.from<0||e.to>100||Math.abs(e.to*10-Math.round(e.to*10))>1e-9||Math.abs(e.from*10-Math.round(e.from*10))>1e-9?`Use a range from 0 to 100 in steps of 0.1.`:null;case`fingerprint`:return e.hashes.length===0?`Enter a fingerprint.`:null;case`dateTime`:return e.from===void 0&&e.to===void 0?`Choose a start, an end, or both.`:e.from!==void 0&&e.to!==void 0&&e.from>=e.to?`End after the start.`:null}},mn=e=>{switch(e){case`platform`:return{type:e,platforms:[`ios`]};case`channel`:return{type:e,channels:[]};case`appVersion`:return{type:e,range:``};case`cohort`:return{type:e,cohorts:[]};case`percent`:return{type:e,seed:Xt(),from:0,to:10};case`fingerprint`:return{type:e,hashes:[]};case`dateTime`:return{type:e,from:Gt()[1].iso}}},hn=W.createContext(void 0);function gn(e=!0){let t=W.useContext(hn);if(t===void 0&&!e)throw Error(o(7));return t}function _n(e){let{render:n,className:r,style:i,state:o=a,props:s=u,refs:c=u,metadata:l,stateAttributesMapping:d,tag:f=`div`,...p}=e,{compositeProps:m,compositeRef:h}=We({metadata:l});return t(f,e,{state:o,ref:[...c,h],props:[m,...s,p],stateAttributesMapping:d})}var vn=W.forwardRef(function(e,n){let{className:i,defaultPressed:a=!1,disabled:o=!1,form:s,onPressedChange:c,pressed:l,render:u,type:d,value:f,nativeButton:m=!0,style:h,...g}=e,v=w(f||void 0),y=gn(),b=y?.value??[],x=y?void 0:a,S=(o||y?.disabled)??!1,[C,T]=re({controlled:y?v!==void 0&&b.indexOf(v)>-1:l,default:x,name:`Toggle`,state:`pressed`}),{getButtonProps:ee,buttonRef:te}=r({disabled:S,native:m}),E={disabled:S,pressed:C},D=[te,n],O=[{"aria-pressed":C,onClick(e){let t=!C,n=p(_,e.nativeEvent);v&&y?.setGroupValue?.(v,t,n),c?.(t,n),!n.isCanceled&&T(t)}},g,ee],k=t(`button`,e,{enabled:!y,state:E,ref:D,props:O});return y?(0,G.jsx)(_n,{tag:`button`,render:u,className:i,style:h,state:E,refs:D,props:O}):k}),yn=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),bn={multiple(e){return e?{[yn.multiple]:``}:null}},xn=W.forwardRef(function(e,n){let{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:o,orientation:s=`horizontal`,multiple:c=!1,value:l,className:d,render:f,style:p,...m}=e,g=ce(!0),_=W.useMemo(()=>l!==void 0||r!==void 0,[l,r]),v=(g?.disabled??!1)||i,[y,b]=re({controlled:l,default:l===void 0?r??u:void 0,name:`ToggleGroup`,state:`value`}),x=h((e,t,n)=>{let r;c?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],o?.(r,n),!n.isCanceled&&b(r)}),S={disabled:v,multiple:c,orientation:s},C=W.useMemo(()=>({disabled:v,orientation:s,setGroupValue:x,value:y,isValueInitialized:_}),[v,s,x,y,_]),w={role:`group`},T=t(`div`,e,{enabled:!!g,state:S,ref:n,props:[w,m],stateAttributesMapping:bn});return(0,G.jsx)(hn.Provider,{value:C,children:g?T:(0,G.jsx)(Ve,{render:f,className:d,style:p,state:S,refs:[n],props:[w,m],stateAttributesMapping:bn,loopFocus:a,enableHomeAndEndKeys:!0,orientation:s})})}),Sn=l(`group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-7 min-w-7 px-2 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,sm:`h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),Cn=W.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function wn({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,G.jsx)(xn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:s(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,G.jsx)(Cn.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Tn({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=W.useContext(Cn);return(0,G.jsx)(vn,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:s(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,Sn({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function $(){let[e,t]=(0,W.useState)(`UTC`);return(0,W.useEffect)(()=>{t(Intl.DateTimeFormat().resolvedOptions().timeZone)},[]),{timeZone:e,dateTimeText:(0,W.useMemo)(()=>Ut(e),[e])}}var En=Object.keys(J);function Dn({id:e,values:t,onChange:n,placeholder:r,multiline:i=!1}){let[a,o]=(0,W.useState)(t.join(`, `)),[s,c]=(0,W.useState)(t);s!==t&&(c(t),fn(a).join(`
5
+ `)!==t.join(`
6
+ `)&&o(t.join(`, `)));let l=e=>{o(e),n(fn(e))};return i?(0,G.jsx)(_e,{className:`min-h-20 font-mono text-xs`,id:e,onChange:e=>l(e.target.value),placeholder:r,spellCheck:!1,value:a}):(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:e,onChange:e=>l(e.target.value),placeholder:r,value:a})}function On({id:e,label:t,value:r,presets:i,onChange:a}){return(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:e,children:t}),(0,G.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(he,{className:`h-11 tabular-nums sm:h-9`,id:e,onChange:e=>a(Jt(e.target.value)),type:`datetime-local`,value:qt(r)}),r===void 0?null:(0,G.jsx)(ge,{align:`inline-end`,children:(0,G.jsx)(ve,{"aria-label":`Clear ${t.toLowerCase()}`,className:`size-11 sm:size-5`,onClick:()=>a(void 0),size:`icon-xs`,children:(0,G.jsx)(S,{})})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,G.jsx)(n,{"aria-pressed":e.iso===r,className:`min-h-11 sm:min-h-6`,onClick:()=>a(e.iso),size:`xs`,type:`button`,variant:e.iso===r?`secondary`:`outline`,children:e.label},e.label))})]})}function kn({rule:e,onChange:t}){let r=(0,W.useId)(),i=dt();switch(e.type){case`platform`:return(0,G.jsx)(wn,{"aria-label":`Platforms`,multiple:!0,onValueChange:n=>t({...e,platforms:n.filter(e=>e===`ios`||e===`android`)}),value:[...e.platforms],variant:`outline`,children:[`ios`,`android`].map(e=>(0,G.jsxs)(Tn,{className:`min-h-11 px-3 sm:min-h-8`,value:e,children:[(0,G.jsx)(tt,{className:`size-3.5`,platform:e}),e===`ios`?`iOS`:`Android`]},e))});case`channel`:{let a=(i.data??[]).map(({name:e})=>e).filter(t=>!e.channels.includes(t));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Dn,{id:`${r}-channels`,onChange:n=>t({...e,channels:n}),placeholder:`production, beta`,values:e.channels}),a.length>0?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Add:`}),a.slice(0,8).map(r=>(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-6`,onClick:()=>t({...e,channels:[...e.channels,r]}),size:`xs`,type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),r]},r))]}):null]})}case`appVersion`:return(0,G.jsx)(m,{"aria-label":`App version range`,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,onChange:n=>t({...e,range:n.target.value}),placeholder:`>=1.4.0`,value:e.range});case`cohort`:return(0,G.jsx)(Dn,{id:`${r}-cohorts`,onChange:n=>t({...e,cohorts:n}),placeholder:`1, 2, beta-testers`,values:e.cohorts});case`percent`:return(0,G.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[repeat(2,minmax(0,8rem))_minmax(0,1fr)]`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-from`,children:`From %`}),(0,G.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${r}-from`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,from:Number(n.target.value)}),step:.1,type:`number`,value:e.from})]}),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-to`,children:`To %`}),(0,G.jsx)(m,{className:`min-h-11 tabular-nums sm:min-h-9`,id:`${r}-to`,inputMode:`decimal`,max:100,min:0,onChange:n=>t({...e,to:Number(n.target.value)}),step:.1,type:`number`,value:e.to})]}),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-seed`,children:`Seed`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${r}-seed`,onChange:n=>t({...e,seed:n.target.value}),value:e.seed}),(0,G.jsx)(n,{"aria-label":`New seed`,className:`size-11 sm:size-9`,onClick:()=>t({...e,seed:Xt()}),size:`icon`,type:`button`,variant:`outline`,children:(0,G.jsx)(me,{})})]})]})]});case`fingerprint`:return(0,G.jsx)(Dn,{id:`${r}-hashes`,multiline:!0,onChange:n=>t({...e,hashes:n}),placeholder:`One fingerprint hash per line`,values:e.hashes});case`dateTime`:{let n=(n,r)=>{let{[n]:i,...a}=e;t(r===void 0?a:{...a,[n]:r})};return(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsx)(On,{id:`${r}-from`,label:`From`,onChange:e=>n(`from`,e),presets:Gt(),value:e.from}),(0,G.jsx)(On,{id:`${r}-until`,label:`Until`,onChange:e=>n(`to`,e),presets:Kt(e.from),value:e.to})]})}}}var An={platform:`Devices on any of these platforms.`,channel:`Devices on any of these channels, separated by commas.`,appVersion:`A semver range of native app versions, as release targets use: 2.x, >=1.4.0 <2.0.0.`,percent:`Installs whose numeric cohort lands in this share. Rules with one seed split the same order, so 0–10 and 10–20 never overlap.`,cohort:`Numeric cohorts from 1 to 1000, or custom cohort names.`,fingerprint:`Native builds with any of these fingerprints.`,dateTime:`Leave either end empty to keep it open. Devices get the change at their next fetch.`};function jn({open:e,onOpenChange:t,condition:n,takenNames:r,onSave:i}){let a=we(e);return(0,G.jsx)(ot,{onOpenChange:t,open:e,children:(0,G.jsx)(it,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-xl`,children:(0,G.jsx)(Mn,{condition:n,onCancel:()=>t(!1),onSave:e=>{i(e),t(!1)},takenNames:r},a)})})}function Mn({condition:e,takenNames:t,onSave:r,onCancel:i}){let a=(0,W.useId)(),{dateTimeText:o,timeZone:s}=$(),[c,l]=(0,W.useState)(()=>e===null||e.name===un(e.rules,t,o)?``:e.name),[u,d]=(0,W.useState)(e===null?[mn(`platform`)]:[...e.rules]),[f,p]=(0,W.useState)(!1),h=un(u,t,o),g=c.trim().length===0?h:c,_=dn(g,t),v=u.map(pn),y=En.filter(e=>!u.some(t=>t.type===e)),b=_!==null||u.length===0||v.some(e=>e!==null);return(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{e.preventDefault(),e.stopPropagation(),p(!0),!b&&r({name:g.trim(),rules:u.map(e=>e.type===`appVersion`?{...e,range:e.range.trim()}:e)})},children:[(0,G.jsxs)(nt,{children:[(0,G.jsx)(at,{children:e===null?`Add condition`:`Edit condition`}),(0,G.jsx)(B,{children:`A device matches when it matches every rule.`})]}),(0,G.jsxs)(st,{children:[(0,G.jsxs)(U,{"data-invalid":f&&_!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${a}-name`,children:`Name`}),(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${a}-name`,maxLength:101,onChange:e=>l(e.target.value),placeholder:h||`Beta testers on iOS`,value:c}),(0,G.jsx)(ct,{children:`Optional: without one, it is named after its rules.`}),(0,G.jsx)(H,{children:f?_:null})]}),(0,G.jsxs)(ut,{children:[(0,G.jsx)(lt,{variant:`label`,children:`Rules`}),u.length===0?(0,G.jsx)(H,{children:f?`Add at least one rule.`:null}):null,(0,G.jsx)(`ol`,{className:`flex flex-col gap-3`,children:u.map((e,t)=>(0,G.jsx)(`li`,{className:`rounded-lg border p-3`,children:(0,G.jsxs)(U,{"data-invalid":f&&v[t]!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:J[e.type]}),(0,G.jsx)(n,{"aria-label":`Remove the ${J[e.type].toLowerCase()} rule`,className:`size-11 sm:size-7`,onClick:()=>d(u.filter((e,n)=>n!==t)),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,G.jsx)(Ce,{})})]}),(0,G.jsx)(kn,{onChange:e=>d(u.map((n,r)=>r===t?e:n)),rule:e}),(0,G.jsx)(ct,{children:e.type===`dateTime`?`In your time zone, ${s}. ${An.dateTime}`:An[e.type]}),(0,G.jsx)(H,{children:f?v[t]:null})]})},e.type))}),y.length>0?(0,G.jsxs)(le,{items:Object.fromEntries(y.map(e=>[e,J[e]])),onValueChange:e=>{e!==null&&d([...u,mn(e)])},value:null,children:[(0,G.jsxs)(ie,{"aria-label":`Add a rule`,className:`min-h-11 w-full sm:min-h-9 sm:w-56`,children:[(0,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(oe,{placeholder:`Add a rule`})]}),(0,G.jsx)(ae,{alignItemWithTrigger:!1,children:(0,G.jsx)(se,{children:y.map(e=>(0,G.jsx)(A,{value:e,children:J[e]},e))})})]}):null]})]}),(0,G.jsxs)(rt,{children:[(0,G.jsx)(n,{onClick:i,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(n,{type:`submit`,children:e===null?`Add condition`:`Save condition`})]})]})}function Nn({condition:e,dateTimeText:t}){let n=e.rules.map(e=>Yt(e,t)).join(` · `);return n===e.name?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})}function Pn({template:e,onSaveCondition:t,onRemoveCondition:r,onMoveCondition:i}){let[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),l=M(a),u=M(s),{dateTimeText:d}=$(),{conditions:f}=e,p=l?.condition?.name??null,m=t=>{let n=Bt(e,t);n.length===0?r(t):c({name:t,users:n})};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(Oe,{className:`flex-row flex-wrap items-center justify-between gap-3 space-y-0 border-b px-4 py-3 sm:px-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Conditions`})}),(0,G.jsx)(je,{className:`text-xs`,children:`Listed by priority: when several match a device, the first wins.`})]}),(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})]}),(0,G.jsx)(ke,{className:`p-0`,children:f.length===0?(0,G.jsxs)(Re,{className:`py-10`,children:[(0,G.jsxs)(Pe,{children:[(0,G.jsx)(Ne,{variant:`icon`,children:(0,G.jsx)(de,{})}),(0,G.jsx)(Ie,{children:`No conditions`}),(0,G.jsx)(Le,{children:`Add a condition to give some devices other values: a platform, channel, app version range, cohort, or a share of installs.`})]}),(0,G.jsx)(Fe,{children:(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({condition:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add condition`]})})]}):(0,G.jsx)(`ol`,{"aria-label":`Conditions`,className:`divide-y`,children:f.map((t,r)=>{let a=Bt(e,t.name);return(0,G.jsxs)(`li`,{className:`grid gap-3 px-4 py-3 sm:px-6 md:grid-cols-[auto_minmax(0,1fr)_auto] md:items-center`,children:[(0,G.jsx)(`span`,{"aria-label":`Priority ${r+1}`,className:`flex size-6 items-center justify-center rounded-md bg-muted text-xs font-medium tabular-nums`,children:r+1}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:t.name}),(0,G.jsx)(Nn,{condition:t,dateTimeText:d}),(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:a.length===0?`No parameter uses it yet`:`Sets ${a.length===1?`1 parameter`:`${a.length} parameters`}: ${a.slice(0,3).join(`, `)}${a.length>3?`…`:``}`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1 md:justify-end`,children:[(0,G.jsx)(n,{"aria-label":`Move ${t.name} up`,className:`size-11 md:size-7`,disabled:r===0,onClick:()=>i(r,-1),size:`icon`,variant:`ghost`,children:(0,G.jsx)(pt,{})}),(0,G.jsx)(n,{"aria-label":`Move ${t.name} down`,className:`size-11 md:size-7`,disabled:r===f.length-1,onClick:()=>i(r,1),size:`icon`,variant:`ghost`,children:(0,G.jsx)(ft,{})}),(0,G.jsxs)(n,{"aria-label":`Edit ${t.name}`,className:`min-h-11 md:min-h-7`,onClick:()=>o({condition:t}),size:`sm`,variant:`outline`,children:[(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(n,{"aria-label":`Delete ${t.name}`,className:`size-11 md:size-7`,onClick:()=>m(t.name),size:`icon`,variant:`ghost`,children:(0,G.jsx)(Ce,{})})]})]},t.name)})})}),(0,G.jsx)(jn,{condition:l?.condition??null,onOpenChange:e=>{e||o(null)},onSave:e=>t(p,e),open:a!==null,takenNames:f.map(({name:e})=>e).filter(e=>e!==p)}),(0,G.jsx)(et,{onOpenChange:e=>{e||c(null)},open:s!==null,children:(0,G.jsxs)(Je,{children:[(0,G.jsxs)($e,{children:[(0,G.jsxs)(Ye,{children:[`Delete `,u?.name,`?`]}),(0,G.jsxs)(qe,{children:[u?.users.length===1?`1 parameter has a value for it`:`${u?.users.length} parameters have a value for it`,` `,`(`,u?.users.join(`, `),`). Those values are removed too, so matching devices get the default value after you publish.`]})]}),(0,G.jsxs)(Ze,{children:[(0,G.jsx)(Qe,{children:`Cancel`}),(0,G.jsx)(Xe,{onClick:e=>{e.preventDefault(),s!==null&&r(s.name),c(null)},variant:`destructive`,children:`Delete condition`})]})]})})]})}var Fn=e=>e===`BOOLEAN`?`false`:e===`NUMBER`?`0`:e===`JSON`?`{}`:``,In=(e,t)=>`value`in t?ln(e,t.value):null;function Ln({id:e,label:t,valueType:r,value:i,onChange:a,showErrors:o}){let s=!(`value`in i),c=`value`in i?i.value:``,l=o?In(r,i):null,u=e=>a({value:e});return(0,G.jsxs)(U,{"data-invalid":l!==null||void 0,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(V,{htmlFor:e,id:`${e}-label`,children:t}),(0,G.jsxs)(`div`,{className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground sm:min-h-0`,children:[(0,G.jsx)(Te,{checked:s,id:`${e}-in-app-default`,onCheckedChange:e=>a(e?{useInAppDefault:!0}:{value:Fn(r)})}),(0,G.jsx)(`label`,{htmlFor:`${e}-in-app-default`,children:`Use in-app default`})]})]}),s?(0,G.jsxs)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,id:e,children:[`Devices keep the default set in the app's`,` `,(0,G.jsxs)(`code`,{className:`font-mono`,children:[`remoteConfig(`,`{ defaults }`,`)`]}),`.`]}):r===`BOOLEAN`?(0,G.jsxs)(wn,{"aria-labelledby":`${e}-label`,id:e,onValueChange:e=>{let[t]=e;(t===`true`||t===`false`)&&u(t)},value:[c],variant:`outline`,children:[(0,G.jsx)(Tn,{className:`min-h-11 px-4 sm:min-h-8`,value:`true`,children:`true`}),(0,G.jsx)(Tn,{className:`min-h-11 px-4 sm:min-h-8`,value:`false`,children:`false`})]}):r===`NUMBER`?(0,G.jsx)(m,{"aria-invalid":l!==null||void 0,autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:e,inputMode:`decimal`,onChange:e=>u(e.target.value),value:c}):r===`JSON`?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(_e,{"aria-invalid":l!==null||void 0,className:`min-h-24 font-mono text-xs`,id:e,onChange:e=>u(e.target.value),spellCheck:!1,value:c}),(0,G.jsxs)(n,{className:`self-start`,disabled:ln(`JSON`,c)!==null,onClick:()=>u(JSON.stringify(JSON.parse(c),null,2)),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(mt,{"data-icon":`inline-start`}),`Format JSON`]})]}):(0,G.jsx)(_e,{"aria-invalid":l!==null||void 0,className:`min-h-11 text-sm sm:min-h-9`,id:e,onChange:e=>u(e.target.value),rows:2,value:c}),(0,G.jsx)(H,{children:l})]})}var Rn=Object.keys(q),zn={STRING:`getString`,NUMBER:`getNumber`,BOOLEAN:`getBoolean`,JSON:`getString`},Bn=(e,t)=>`value`in e&&In(t,e)!==null?{value:Fn(t)}:e;function Vn({open:e,onOpenChange:t,parameterKey:n,parameter:r,takenKeys:i,conditions:a,onSave:o,onAddCondition:s}){let c=we(e);return(0,G.jsx)(ot,{onOpenChange:t,open:e,children:(0,G.jsx)(it,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto data-nested-dialog-open:after:absolute data-nested-dialog-open:after:inset-0 data-nested-dialog-open:after:rounded-xl data-nested-dialog-open:after:bg-background/70 sm:max-w-2xl`,children:(0,G.jsx)(Hn,{conditions:a,onAddCondition:s,onCancel:()=>t(!1),onSave:(e,n)=>{o(e,n),t(!1)},parameter:r,parameterKey:n,takenKeys:i},c)})})}function Hn({parameterKey:e,parameter:t,takenKeys:r,conditions:i,onSave:a,onCancel:o,onAddCondition:s}){let c=(0,W.useId)(),{dateTimeText:l}=$(),[u,d]=(0,W.useState)(e??``),[f,p]=(0,W.useState)(t?.valueType??`STRING`),[h,g]=(0,W.useState)(t?.description??``),_=h.trim().length>256,[v,y]=(0,W.useState)(t?.defaultValue??{value:``}),[b,x]=(0,W.useState)(t?.conditionalValues??{}),[C,w]=(0,W.useState)({}),[T,ee]=(0,W.useState)(!1),[te,E]=(0,W.useState)(!1),D=cn(u.trim(),r),O=i.filter(({name:e})=>Y(b,e)!==void 0),k=i.filter(({name:e})=>Y(b,e)===void 0),ne=D!==null||_||[v,...Object.values(b)].some(e=>In(f,e)!==null),re=e=>{p(e),y(Bn(v,e)),x(Object.fromEntries(Object.entries(b).map(([t,n])=>[t,Bn(n,e)])))},ce=e=>{let t=Y(C,e);x({...b,[e]:t===void 0?{value:Fn(f)}:Bn(t,f)})},ue=e=>{let{[e]:t,...n}=b;t!==void 0&&w({...C,[e]:t}),x(n)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:e=>{if(e.preventDefault(),ee(!0),ne)return;let t=Object.fromEntries(O.map(({name:e})=>[e,Y(b,e)]));a(u.trim(),{valueType:f,defaultValue:v,...Object.keys(t).length===0?{}:{conditionalValues:t},...h.trim().length===0?{}:{description:h.trim()}})},children:[(0,G.jsxs)(nt,{children:[(0,G.jsx)(at,{children:e===null?`Add parameter`:`Edit parameter`}),(0,G.jsxs)(B,{children:[`The app reads it with`,` `,(0,G.jsxs)(`code`,{className:`font-mono`,children:[`hotUpdater.remoteConfig.`,zn[f],`("`,u.trim()||`key`,`")`]}),`, which is null when neither the server nor the app's defaults have a value.`]})]}),(0,G.jsxs)(st,{children:[(0,G.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[minmax(0,1fr)_11rem]`,children:[(0,G.jsxs)(U,{"data-invalid":T&&D!==null||void 0,children:[(0,G.jsx)(V,{htmlFor:`${c}-key`,children:`Key`}),(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 font-mono sm:min-h-9`,id:`${c}-key`,maxLength:257,onChange:e=>d(e.target.value),placeholder:`welcome_message`,spellCheck:!1,value:u}),(0,G.jsx)(H,{children:T?D:null})]}),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${c}-type`,children:`Type`}),(0,G.jsxs)(le,{items:q,onValueChange:e=>{e!==null&&re(e)},value:f,children:[(0,G.jsx)(ie,{className:`min-h-11 w-full sm:min-h-9`,id:`${c}-type`,children:(0,G.jsx)(oe,{})}),(0,G.jsx)(ae,{children:(0,G.jsx)(se,{children:Rn.map(e=>(0,G.jsx)(A,{value:e,children:q[e]},e))})})]})]})]}),(0,G.jsxs)(U,{"data-invalid":_||void 0,children:[(0,G.jsx)(V,{htmlFor:`${c}-description`,children:`Description`}),(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${c}-description`,onChange:e=>g(e.target.value),placeholder:`Optional: what the app does with it`,value:h}),(0,G.jsx)(H,{children:_?`Use 256 characters or fewer.`:null})]}),(0,G.jsx)(Ln,{id:`${c}-default`,label:`Default value`,onChange:y,showErrors:T,value:v,valueType:f}),(0,G.jsxs)(ut,{children:[(0,G.jsx)(lt,{variant:`label`,children:`Conditional values`}),(0,G.jsx)(ct,{children:`Devices that match a condition get its value. When several match, the first in the Conditions list wins. Removing a value keeps the condition, and its devices get the default value.`}),O.length>0?(0,G.jsx)(`ul`,{className:`flex flex-col gap-3`,children:O.map(e=>(0,G.jsxs)(`li`,{className:`rounded-lg border p-3`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.name}),(0,G.jsx)(Nn,{condition:e,dateTimeText:l})]}),(0,G.jsxs)(n,{"aria-label":`Remove the value for ${e.name}`,className:`min-h-11 shrink-0 text-muted-foreground sm:min-h-7`,onClick:()=>ue(e.name),size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(S,{"data-icon":`inline-start`}),`Remove value`]})]}),(0,G.jsx)(Ln,{id:`${c}-${e.name}`,label:(0,G.jsxs)(G.Fragment,{children:[`Value`,(0,G.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]}),onChange:t=>x({...b,[e.name]:t}),showErrors:T,value:Y(b,e.name),valueType:f})]},e.name))}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[k.length>0?(0,G.jsxs)(le,{items:Object.fromEntries(k.map(({name:e})=>[e,e])),onValueChange:e=>{e!==null&&ce(e)},value:null,children:[(0,G.jsxs)(ie,{"aria-label":`Add a value for a condition`,className:`min-h-11 w-full sm:min-h-9 sm:w-64`,children:[(0,G.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),(0,G.jsx)(oe,{placeholder:`Add a value for a condition`})]}),(0,G.jsx)(ae,{alignItemWithTrigger:!1,children:(0,G.jsx)(se,{children:k.map(({name:e})=>(0,G.jsx)(A,{value:e,children:e},e))})})]}):null,(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-9`,onClick:()=>E(!0),type:`button`,variant:`outline`,children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`New condition`]})]})]})]}),(0,G.jsxs)(rt,{children:[(0,G.jsx)(n,{onClick:o,type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsx)(n,{type:`submit`,children:e===null?`Add parameter`:`Save parameter`})]})]}),(0,G.jsx)(jn,{condition:null,onOpenChange:E,onSave:e=>{s(e),ce(e.name)},open:te,takenNames:i.map(({name:e})=>e)})]})}function Un({text:e}){return(0,G.jsx)(`span`,{className:`line-clamp-2 block min-w-0 break-words font-mono text-xs text-foreground`,title:e,children:e})}function Wn({parameterKey:e,parameter:t,conditions:r,onEdit:i,onRemove:a}){let o=r.filter(({name:e})=>Y(t.conditionalValues,e)!==void 0);return(0,G.jsxs)(`li`,{className:`grid gap-3 px-4 py-3 sm:px-6 md:grid-cols-[minmax(0,15rem)_minmax(0,1fr)_auto] md:items-start`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,children:e}),(0,G.jsx)(R,{className:`shrink-0`,variant:`outline`,children:q[t.valueType]})]}),t.description===void 0?null:(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t.description})]}),(0,G.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[minmax(0,9rem)_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:[o.map(({name:e})=>(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`line-clamp-2 break-words text-muted-foreground`,title:e,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:(0,G.jsx)(Un,{text:X(Y(t.conditionalValues,e))})})]},e)),(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`Default`}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:`value`in t.defaultValue?(0,G.jsx)(Un,{text:X(t.defaultValue)}):(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`In-app default`})})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.jsxs)(n,{"aria-label":`Edit ${e}`,className:`min-h-11 md:min-h-7`,onClick:i,size:`sm`,variant:`outline`,children:[(0,G.jsx)(gt,{"data-icon":`inline-start`}),`Edit`]}),(0,G.jsx)(n,{"aria-label":`Delete ${e}`,className:`size-11 md:size-7`,onClick:a,size:`icon`,variant:`ghost`,children:(0,G.jsx)(Ce,{})})]})]})}function Gn({template:e,onSaveParameter:t,onRemoveParameter:r,onAddCondition:i}){let[a,o]=(0,W.useState)(null),s=M(a),[c,l]=(0,W.useState)(``),u=Object.keys(e.parameters),d=u.filter(e=>e.toLowerCase().includes(c.trim().toLowerCase())),f=s?.key??null;return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(Oe,{className:`flex-row flex-wrap items-center justify-between gap-3 space-y-0 border-b px-4 py-3 sm:px-6`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Parameters`})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-wrap gap-2 sm:w-auto`,children:[u.length>5?(0,G.jsxs)(be,{className:`min-h-11 w-full sm:min-h-8 sm:w-56`,children:[(0,G.jsx)(ge,{children:(0,G.jsx)(xe,{"aria-hidden":`true`})}),(0,G.jsx)(he,{"aria-label":`Filter parameters by key`,className:`text-base sm:text-xs`,onChange:e=>l(e.target.value),placeholder:`Filter by key`,value:c})]}):null,(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})]})]}),(0,G.jsx)(ke,{className:`p-0`,children:u.length===0?(0,G.jsxs)(Re,{className:`py-10`,children:[(0,G.jsxs)(Pe,{children:[(0,G.jsx)(Ne,{variant:`icon`,children:(0,G.jsx)(Se,{})}),(0,G.jsx)(Ie,{children:`No parameters`}),(0,G.jsx)(Le,{children:`Add a parameter, give it a default, then publish to change the app without a new build.`})]}),(0,G.jsx)(Fe,{children:(0,G.jsxs)(n,{className:`min-h-11 sm:min-h-7`,onClick:()=>o({key:null,parameter:null}),children:[(0,G.jsx)(j,{"data-icon":`inline-start`}),`Add parameter`]})})]}):d.length===0?(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-xs text-muted-foreground`,children:[(0,G.jsx)(`p`,{className:`font-medium text-foreground`,children:`No matching keys`}),(0,G.jsx)(n,{onClick:()=>l(``),size:`sm`,variant:`outline`,children:`Clear filter`})]}):(0,G.jsx)(`ul`,{"aria-label":`Parameters`,className:`divide-y`,children:d.map(t=>(0,G.jsx)(Wn,{conditions:e.conditions,onEdit:()=>o({key:t,parameter:e.parameters[t]??null}),onRemove:()=>r(t),parameter:e.parameters[t],parameterKey:t},t))})}),(0,G.jsx)(Vn,{conditions:e.conditions,onAddCondition:i,onOpenChange:e=>{e||o(null)},onSave:(e,n)=>t(f,e,n),open:a!==null,parameter:s?.parameter??null,parameterKey:f,takenKeys:u.filter(e=>e!==f)})]})}var Kn={platform:`ios`,channel:`production`,appVersion:`1.0.0`,cohort:`1`,fingerprintHash:``,at:``},qn=(e,t=300)=>{let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n};function Jn({template:t,isDraft:n}){let r=(0,W.useId)(),[i,a]=(0,W.useState)(Kn),{at:o,...s}=qn(i),c=Jt(o),l=Mt({template:t,context:{...s,...c===void 0?{}:{now:Date.parse(c)}}}),u=Object.keys(t.parameters),d=(e,t)=>a({...i,[e]:t});return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsxs)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:[(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Preview a device`})}),(0,G.jsx)(je,{className:`text-xs`,children:n?`The values this device would get once your changes are published, now or at the time you pick.`:`The values this device gets from the active version, now or at the time you pick.`})]}),(0,G.jsxs)(ke,{className:`flex flex-col gap-4 p-4 sm:p-6`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-platform`,children:`Platform`}),(0,G.jsxs)(le,{items:{ios:`iOS`,android:`Android`},onValueChange:e=>{(e===`ios`||e===`android`)&&d(`platform`,e)},value:i.platform,children:[(0,G.jsx)(ie,{className:`min-h-11 w-full sm:min-h-9`,id:`${r}-platform`,children:(0,G.jsxs)(oe,{children:[(0,G.jsx)(tt,{className:`size-3.5`,platform:i.platform}),i.platform===`ios`?`iOS`:`Android`]})}),(0,G.jsx)(ae,{children:(0,G.jsxs)(se,{children:[(0,G.jsxs)(A,{value:`ios`,children:[(0,G.jsx)(tt,{className:`size-3.5`,platform:`ios`}),`iOS`]}),(0,G.jsxs)(A,{value:`android`,children:[(0,G.jsx)(tt,{className:`size-3.5`,platform:`android`}),`Android`]})]})})]})]}),[[`channel`,`Channel`,`production`],[`appVersion`,`App version`,`1.0.0`],[`cohort`,`Cohort`,`1-1000 or a name`],[`fingerprintHash`,`Fingerprint`,`Optional`]].map(([e,t,n])=>(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-${e}`,children:t}),(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 text-base sm:min-h-9 sm:text-xs`,id:`${r}-${e}`,onChange:t=>d(e,t.target.value),placeholder:n,spellCheck:!1,value:i[e]})]},e)),(0,G.jsxs)(U,{children:[(0,G.jsx)(V,{htmlFor:`${r}-at`,children:`Time`}),(0,G.jsxs)(be,{className:`h-11 sm:h-9`,children:[(0,G.jsx)(he,{className:`h-11 text-base tabular-nums sm:h-9 sm:text-xs`,id:`${r}-at`,onChange:e=>d(`at`,e.target.value),type:`datetime-local`,value:i.at}),i.at.length===0?null:(0,G.jsx)(ge,{align:`inline-end`,children:(0,G.jsx)(ve,{className:`min-h-11 sm:min-h-6`,onClick:()=>d(`at`,``),size:`xs`,children:`Now`})})]})]})]}),u.length===0?(0,G.jsx)(Re,{className:`border py-8`,children:(0,G.jsxs)(Pe,{children:[(0,G.jsx)(Ne,{variant:`icon`,children:(0,G.jsx)(Ee,{})}),(0,G.jsx)(Ie,{children:`Nothing to preview`}),(0,G.jsx)(Le,{children:`Add a parameter, and its value for this device shows here.`})]})}):l.data?.status===`invalid`?(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`The draft has problems to fix first`}),(0,G.jsx)(P,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:l.data.issues.slice(0,5).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):l.isError?(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`The preview couldn't be loaded`}),(0,G.jsx)(P,{children:`Check the connection, then change a field to try again.`})]}):l.data===void 0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading the preview`}),u.slice(0,4).map(t=>(0,G.jsx)(e,{className:`h-8 w-full`},t))]}):(0,G.jsx)(`dl`,{"aria-busy":l.isFetching||void 0,className:`divide-y rounded-lg border`,children:u.map(e=>{let t=l.data.status===`ok`?l.data.parameters[e]:void 0;return(0,G.jsxs)(`div`,{className:`grid gap-1 px-3 py-2.5 sm:grid-cols-[minmax(0,14rem)_minmax(0,1fr)_auto] sm:items-center sm:gap-3`,children:[(0,G.jsx)(`dt`,{className:`truncate font-mono text-xs font-medium`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs`,children:t===void 0?`…`:t.value===null?(0,G.jsx)(`span`,{className:`font-sans text-muted-foreground`,children:`In-app default`}):(0,G.jsx)(`span`,{title:t.value,children:t.value.length===0?`""`:t.value})}),(0,G.jsx)(`dd`,{children:t?.condition===void 0?null:t.condition===null?(0,G.jsx)(R,{variant:`outline`,children:`Default value`}):(0,G.jsx)(R,{variant:`secondary`,children:t.condition})})]},e)})})]})]})}function Yn({name:e,fields:t}){return(0,G.jsxs)(`li`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`break-words font-mono`,children:e}),t.length===0?null:(0,G.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:e.field}),e.before===null?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`max-w-full truncate font-mono line-through decoration-muted-foreground/60`,title:e.before,children:e.before}),(0,G.jsx)(ne,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`to`})]}),(0,G.jsx)(`span`,{className:`max-w-full truncate font-mono text-foreground`,title:e.after,children:e.after})]},e.field))})]})}function Xn({label:e,changes:t,describe:n}){let r=[[`Added`,t.added],[`Changed`,t.changed],[`Removed`,t.removed]];return r.every(([,e])=>e.length===0)?null:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-xs font-medium`,children:e}),(0,G.jsx)(`dl`,{className:`mt-1 grid grid-cols-[5rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.map(([e,t])=>t.length===0?null:(0,G.jsxs)(`div`,{className:`contents`,children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:e===`Removed`?(0,G.jsx)(`span`,{className:`break-words font-mono`,children:t.join(`, `)}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,G.jsx)(Yn,{fields:n(e),name:e},e))})})]},e))})]})}function Zn({open:e,onOpenChange:t,base:r,baseVersion:i,draft:a,onPublished:o,onLoadLatest:s,onPublishOver:c}){let l=(0,W.useId)(),u=At(),[d,f]=(0,W.useState)(``),[p,h]=(0,W.useState)(null),{dateTimeText:g}=$(),_=Qt(r,a),v=e=>{let t=Object.hasOwn(r.parameters,e)?r.parameters[e]:null,n=Object.hasOwn(a.parameters,e)?a.parameters[e]:null;return n===null?[]:$t(t,n)},y=e=>{let t=r.conditions.find(t=>t.name===e)??null,n=a.conditions.find(t=>t.name===e)??null;return n===null?[]:en(t,n,g)},b=d.trim().length>256,x=e=>{u.isPending||(t(e),e||(h(null),u.reset()))};return(0,G.jsx)(ot,{onOpenChange:x,open:e,children:(0,G.jsx)(it,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-lg`,children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,noValidate:!0,onSubmit:async e=>{if(e.preventDefault(),!b)try{let e=await u.mutateAsync({template:a,baseVersion:i,...d.trim().length===0?{}:{description:d.trim()}});h(e),e.status===`published`&&(z.success(`Published version ${e.version.version}`),f(``),h(null),t(!1),o())}catch(e){z.error(e instanceof Error?e.message:`Unable to publish`)}},children:[(0,G.jsxs)(nt,{children:[(0,G.jsx)(at,{children:`Publish changes`}),(0,G.jsxs)(B,{children:[`This becomes version `,i+1,`. Devices get its values on their next fetch; earlier versions stay available to roll back to.`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border p-3`,children:[(0,G.jsx)(Xn,{changes:_.parameters,describe:v,label:`Parameters`}),(0,G.jsx)(Xn,{changes:_.conditions,describe:y,label:`Conditions`}),_.reordered?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Condition priority changed.`}):null]}),p?.status===`invalid`?(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`The server refused the template`}),(0,G.jsx)(P,{children:(0,G.jsx)(`ul`,{className:`list-disc pl-4`,children:p.issues.slice(0,6).map(e=>(0,G.jsxs)(`li`,{children:[e.path===``?``:`${e.path}: `,e.message]},`${e.path}:${e.message}`))})})]}):null,p?.status===`conflict`?(0,G.jsxs)(F,{children:[(0,G.jsx)(I,{}),(0,G.jsxs)(N,{children:[`Version `,p.currentVersion,` was published while you edited`]}),(0,G.jsx)(P,{children:`Load it to review what changed, or publish yours after it, replacing its values.`}),(0,G.jsxs)(`div`,{className:`col-span-full mt-2 flex flex-wrap gap-2`,children:[(0,G.jsxs)(n,{onClick:()=>{x(!1),s()},size:`sm`,type:`button`,variant:`outline`,children:[`Load version `,p.currentVersion]}),(0,G.jsx)(n,{onClick:()=>{c(p.currentVersion),h(null)},size:`sm`,type:`button`,variant:`ghost`,children:`Publish mine after it`})]})]}):null,(0,G.jsxs)(U,{"data-invalid":b||void 0,children:[(0,G.jsx)(V,{htmlFor:`${l}-description`,children:`Description`}),(0,G.jsx)(m,{autoComplete:`off`,className:`min-h-11 sm:min-h-9`,id:`${l}-description`,onChange:e=>f(e.target.value),placeholder:`What changed and why`,value:d}),(0,G.jsx)(ct,{children:`Shown in the version history.`}),(0,G.jsx)(H,{children:b?`Use 256 characters or fewer.`:null})]}),(0,G.jsxs)(rt,{children:[(0,G.jsx)(n,{disabled:u.isPending,onClick:()=>x(!1),type:`button`,variant:`outline`,children:`Cancel`}),(0,G.jsxs)(n,{disabled:u.isPending||p?.status===`conflict`,type:`submit`,children:[u.isPending?(0,G.jsx)(pe,{className:`animate-spin`,"data-icon":`inline-start`}):(0,G.jsx)(_t,{"data-icon":`inline-start`}),`Publish version `,i+1]})]})]})})})}function Qn({ms:e}){let t=new Date(e);return(0,G.jsx)(`time`,{className:`tabular-nums`,dateTime:t.toISOString(),title:`${t.toISOString().replace(`T`,` `).slice(0,19)} UTC`,children:(0,vt.default)(e).format(`YYYY/MM/DD HH:mm`)})}function $n({open:t,version:r,onOpenChange:i}){let a=Ot(r),o=a.data===null||a.data===void 0?null:JSON.stringify(a.data.template,null,2);return(0,G.jsx)(ot,{onOpenChange:i,open:t,children:(0,G.jsxs)(it,{className:`max-h-[calc(100svh-2rem)] grid-rows-[auto_minmax(0,1fr)] sm:max-w-2xl`,children:[(0,G.jsxs)(nt,{children:[(0,G.jsxs)(at,{children:[`Version `,r]}),(0,G.jsx)(B,{children:`The template as it was published, in the JSON the admin API takes.`})]}),a.isLoading?(0,G.jsx)(e,{className:`h-48 w-full`}):a.isError?(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`This version couldn't be loaded`}),(0,G.jsx)(P,{children:`Check the connection and try again.`}),(0,G.jsx)(L,{children:(0,G.jsxs)(n,{onClick:()=>void a.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(me,{"data-icon":`inline-start`}),`Retry`]})})]}):o===null?(0,G.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Version `,r,` no longer exists.`]}):(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,G.jsx)(`pre`,{className:`min-h-0 overflow-auto rounded-md bg-muted p-3 font-mono text-xs`,children:o}),(0,G.jsxs)(n,{className:`self-end`,onClick:()=>{navigator.clipboard.writeText(o).then(()=>z.success(`Template JSON copied`),()=>z.error(`Unable to copy the template`))},size:`sm`,variant:`outline`,children:[(0,G.jsx)(ue,{"data-icon":`inline-start`}),`Copy JSON`]})]})]})})}function er({activeVersion:t,hasDraft:r,onRolledBack:i,onStartEditing:a}){let o=Dt({enabled:!0}),s=jt(),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),f=M(c),p=M(u),m=o.data?.pages.flatMap(e=>e.versions)??[],h=async e=>{if(e.preventDefault(),u!==null)try{let e=await s.mutateAsync({version:u.source,baseVersion:u.next-1});e.status===`published`?(z.success(`Version ${e.version.version} restores version ${u.source}`),i()):e.status===`conflict`?z.error(`Version ${e.currentVersion} was published meanwhile. Review it, then roll back again.`):z.error(`That version no longer exists.`),d(null)}catch(e){z.error(e instanceof Error?e.message:`Unable to roll back`)}};return(0,G.jsxs)(Me,{className:`overflow-hidden shadow-sm`,children:[(0,G.jsx)(Oe,{className:`border-b px-4 py-3 sm:px-6`,children:(0,G.jsx)(Ae,{className:`text-sm`,children:(0,G.jsx)(`h2`,{children:`Versions`})})}),(0,G.jsx)(ke,{className:`p-0`,children:o.isError?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`Versions couldn't be loaded`}),(0,G.jsx)(P,{children:`Check the connection and try again.`}),(0,G.jsx)(L,{children:(0,G.jsxs)(n,{onClick:()=>void o.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(me,{"data-icon":`inline-start`}),`Retry`]})})]})}):o.isLoading?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:p-6`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading versions`}),Array.from({length:3},(t,n)=>(0,G.jsx)(e,{className:`h-10 w-full`},n))]}):m.length===0?(0,G.jsxs)(Re,{className:`py-10`,children:[(0,G.jsxs)(Pe,{children:[(0,G.jsx)(Ne,{variant:`icon`,children:(0,G.jsx)(fe,{})}),(0,G.jsx)(Ie,{children:`No versions yet`}),(0,G.jsx)(Le,{children:`Your first publish becomes version 1. Every publish after it is kept here, ready to roll back to.`})]}),(0,G.jsx)(Fe,{children:(0,G.jsx)(n,{className:`min-h-11 sm:min-h-7`,onClick:a,children:`Add a parameter`})})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ol`,{"aria-label":`Versions`,className:`divide-y`,children:m.map(e=>(0,G.jsxs)(`li`,{className:`grid gap-2 px-4 py-3 sm:px-6 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`text-sm font-medium tabular-nums`,children:[`Version `,e.version]}),e.version===t?(0,G.jsx)(R,{children:`Active`}):null,e.updateType===`ROLLBACK`?(0,G.jsxs)(R,{variant:`outline`,children:[`Rollback to v`,e.rollbackSource]}):null]}),(0,G.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(Qn,{ms:e.createdAtMs}),e.description===null||e.updateType===`ROLLBACK`&&e.description===`Rollback to version ${e.rollbackSource}`?null:(0,G.jsxs)(G.Fragment,{children:[` · `,e.description]})]})]}),(0,G.jsxs)(`div`,{className:`flex gap-1 md:justify-end`,children:[(0,G.jsxs)(n,{"aria-label":`View version ${e.version}`,className:`min-h-11 md:min-h-7`,onClick:()=>l(e.version),size:`sm`,variant:`ghost`,children:[(0,G.jsx)(ht,{"data-icon":`inline-start`}),`View`]}),(0,G.jsxs)(n,{"aria-label":`Roll back to version ${e.version}`,className:`min-h-11 md:min-h-7`,disabled:e.version===t,onClick:()=>d({source:e.version,next:t+1}),size:`sm`,variant:`outline`,children:[(0,G.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]},e.version))}),o.hasNextPage?(0,G.jsx)(`div`,{className:`border-t px-4 py-3 sm:px-6`,children:(0,G.jsxs)(n,{className:`min-h-11 w-full sm:min-h-7 sm:w-auto`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),variant:`outline`,children:[o.isFetchingNextPage?(0,G.jsx)(pe,{className:`animate-spin`,"data-icon":`inline-start`}):null,`Load older versions`]})}):null]})}),(0,G.jsx)($n,{onOpenChange:e=>{e||l(null)},open:c!==null,version:f}),(0,G.jsx)(et,{onOpenChange:e=>{!s.isPending&&!e&&d(null)},open:u!==null,children:(0,G.jsxs)(Je,{children:[(0,G.jsxs)($e,{children:[(0,G.jsxs)(Ye,{children:[`Roll back to version `,p?.source,`?`]}),(0,G.jsxs)(qe,{children:[`Version `,p?.next,` will publish a copy of version`,` `,p?.source,`, and devices get its values on their next fetch.`,r?` Your unpublished changes are discarded.`:``]})]}),(0,G.jsxs)(Ze,{children:[(0,G.jsx)(Qe,{disabled:s.isPending,children:`Cancel`}),(0,G.jsxs)(Xe,{disabled:s.isPending,onClick:e=>void h(e),children:[s.isPending?(0,G.jsx)(pe,{className:`animate-spin`,"data-icon":`inline-start`}):(0,G.jsx)(ye,{"data-icon":`inline-start`}),`Roll back`]})]})]})})]})}vt.default.extend(yt.default);var tr=[`parameters`,`conditions`,`preview`,`versions`];function nr({tab:t,onTabChange:r}){let i=Et(),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),p=i.data,m=a?.template??p?.template,h=a!==null&&p!==void 0&&!Nt(a.template,p.template),g=h&&p!==void 0&&a.baseVersion!==p.version;(0,W.useEffect)(()=>{if(s||p===void 0)return;c(!0);let e=an(p);e!==null&&(o(e),u(!0))},[p,s]),(0,W.useEffect)(()=>{if(a===null||!h||on(a))return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[a,h]);let _=()=>{o(null),u(!1),on(null)},v=e=>{p===void 0||m===void 0||(u(!1),o({baseVersion:a?.baseVersion??p.version,base:a?.base??p.template,template:e(m)}))},y={parameters:m===void 0?null:Object.keys(m.parameters).length,conditions:m?.conditions.length??null};return(0,G.jsxs)(`div`,{className:`flex h-svh min-h-0 flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 border-b bg-background px-3 py-3 sm:min-h-12 sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm`,children:[(0,G.jsx)(x,{className:`-ml-1 size-11 lg:size-7`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),(0,G.jsx)(`h1`,{className:`text-sm font-medium`,children:`Remote Config`})]}),p===void 0?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p.version===0?`Nothing published yet`:(0,G.jsxs)(G.Fragment,{children:[`Version `,p.version,p.updatedAtMs===null?null:(0,G.jsxs)(G.Fragment,{children:[` · published `,(0,G.jsx)(`time`,{dateTime:new Date(p.updatedAtMs).toISOString(),title:(0,vt.default)(p.updatedAtMs).format(`YYYY/MM/DD HH:mm:ss`),children:(0,vt.default)(p.updatedAtMs).fromNow()})]})]})}),h?(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,G.jsx)(R,{className:`hidden sm:inline-flex`,variant:`secondary`,children:`Unpublished changes`}),(0,G.jsxs)(n,{className:`min-h-11 lg:min-h-7`,onClick:_,variant:`ghost`,children:[(0,G.jsx)(De,{"data-icon":`inline-start`}),`Discard`]}),(0,G.jsxs)(n,{className:`min-h-11 lg:min-h-7`,onClick:()=>f(!0),children:[(0,G.jsx)(_t,{"data-icon":`inline-start`}),`Publish changes`]})]}):null]}),(0,G.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-4`,children:[i.isError?(0,G.jsxs)(F,{variant:`destructive`,children:[(0,G.jsx)(I,{}),(0,G.jsx)(N,{children:`Remote Config couldn't be loaded`}),(0,G.jsx)(P,{children:`Check the connection and try again.`}),(0,G.jsx)(L,{children:(0,G.jsxs)(n,{onClick:()=>void i.refetch(),size:`xs`,variant:`outline`,children:[(0,G.jsx)(me,{"data-icon":`inline-start`}),`Retry`]})})]}):null,l&&h&&a!==null?(0,G.jsxs)(F,{children:[(0,G.jsx)(fe,{}),(0,G.jsx)(N,{children:`Your unpublished changes are back`}),(0,G.jsxs)(P,{children:[`This browser kept them from your last visit, on version`,` `,a.baseVersion,`.`]}),(0,G.jsx)(L,{children:(0,G.jsx)(n,{onClick:_,size:`xs`,variant:`outline`,children:`Discard them`})})]}):null,g&&a!==null&&p!==void 0?(0,G.jsxs)(F,{children:[(0,G.jsx)(I,{}),(0,G.jsxs)(N,{children:[`Version `,p.version,` was published while you edited`]}),(0,G.jsxs)(P,{children:[`Your draft started from version `,a.baseVersion,`. Discard it to review version `,p.version,`, or publish yours after it.`]}),(0,G.jsx)(L,{children:(0,G.jsxs)(n,{onClick:_,size:`xs`,variant:`outline`,children:[`Load version `,p.version]})})]}):null,(0,G.jsxs)(Ke,{onValueChange:e=>r(e),value:t,children:[(0,G.jsx)(Ge,{"aria-label":`Remote Config views`,className:`max-w-full group-data-horizontal/tabs:h-auto`,children:[[`parameters`,`Parameters`,y.parameters],[`conditions`,`Conditions`,y.conditions],[`preview`,`Preview`,null],[`versions`,`Versions`,null]].map(([e,t,n])=>(0,G.jsxs)(He,{className:`min-h-11 flex-none px-3 lg:min-h-7`,value:e,children:[t,n===null?null:(0,G.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]},e))}),m===void 0||p===void 0?i.isError?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading Remote Config`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`}),(0,G.jsx)(e,{className:`h-14 w-full`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ue,{value:`parameters`,children:(0,G.jsx)(Gn,{onAddCondition:e=>v(t=>Lt(t,null,e)),onRemoveParameter:e=>v(t=>Ft(t,e)),onSaveParameter:(e,t,n)=>v(r=>Pt(r,e,t,n)),template:m})}),(0,G.jsx)(Ue,{value:`conditions`,children:(0,G.jsx)(Pn,{onMoveCondition:(e,t)=>v(n=>zt(n,e,t)),onRemoveCondition:e=>v(t=>Rt(t,e)),onSaveCondition:(e,t)=>v(n=>Lt(n,e,t)),template:m})}),(0,G.jsx)(Ue,{value:`preview`,children:(0,G.jsx)(Jn,{isDraft:h,template:m})}),(0,G.jsx)(Ue,{value:`versions`,children:(0,G.jsx)(er,{activeVersion:p.version,hasDraft:h,onRolledBack:_,onStartEditing:()=>r(`parameters`)})})]})]})]})}),p!==void 0&&a!==null?(0,G.jsx)(Zn,{base:p.template,baseVersion:a.baseVersion,draft:a.template,onLoadLatest:_,onOpenChange:f,onPublishOver:e=>o({...a,baseVersion:e,base:p.template}),onPublished:_,open:d}):null]})}var rr=te(`/remote-config`)({beforeLoad:({context:e})=>k(e.queryClient,`remoteConfig`),notFoundComponent:ee(()=>E(()=>import(`./remote-config-CIAEArwq.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),`notFoundComponent`),component:ee(()=>E(()=>import(`./remote-config-Dwdc-sij.js`),__vite__mapDeps([8,2])),`component`),validateSearch:e=>tr.includes(e.tab)&&e.tab!==`parameters`?{tab:e.tab}:{}});export{nr as n,rr as t};