@lunora/studio 1.0.0-alpha.5 → 1.0.0-alpha.51

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 (198) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +45 -23
  4. package/dist/index.js +31 -31
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.js +3 -2
  7. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  8. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
  9. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
  10. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +55 -32
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +15 -32
  12. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
  13. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  14. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
  15. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
  16. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
  17. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  18. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
  19. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  20. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
  21. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
  22. package/dist/packem_chunks/SettingsPanel.js +391 -0
  23. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +179 -401
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +13 -94
  25. package/dist/packem_chunks/agents-panel.js +326 -0
  26. package/dist/packem_chunks/analytics-panel.js +261 -0
  27. package/dist/packem_chunks/auth-config-panel.js +365 -0
  28. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  29. package/dist/packem_chunks/containers-panel.js +261 -0
  30. package/dist/packem_chunks/dashboards-panel.js +781 -0
  31. package/dist/packem_chunks/fanout-panel.js +482 -0
  32. package/dist/packem_chunks/flags-panel.js +176 -0
  33. package/dist/packem_chunks/issues-panel.js +188 -0
  34. package/dist/packem_chunks/kv-browser.js +1896 -0
  35. package/dist/packem_chunks/log-drains-panel.js +273 -0
  36. package/dist/packem_chunks/organizations-panel.js +3178 -0
  37. package/dist/packem_chunks/payments-panel.js +186 -0
  38. package/dist/packem_chunks/permissions-panel.js +805 -0
  39. package/dist/packem_chunks/queues-panel.js +1075 -0
  40. package/dist/packem_chunks/rls-panel.js +315 -0
  41. package/dist/packem_chunks/schedule-panel.js +831 -0
  42. package/dist/packem_chunks/sparkline.js +79 -0
  43. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  44. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  45. package/dist/packem_chunks/users-panel.js +1731 -0
  46. package/dist/packem_chunks/vector-browser.js +281 -0
  47. package/dist/packem_chunks/workflows-panel.js +562 -0
  48. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-DNeyYtUN.js} +8 -0
  49. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-_aEZxAMX.js} +2 -2
  50. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Dd8pcswz.js} +2 -1
  51. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-BXV4eKf5.js} +1 -1
  52. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-C8hejnub.js} +201 -250
  53. package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
  54. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-f5Ll2AQK.js} +43 -68
  55. package/dist/packem_shared/HomePanel-Ye8PaqQL.js +14 -0
  56. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CWaf0ZtX.js} +2 -1
  57. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-dHMgnJbx.js} +163 -60
  58. package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
  59. package/dist/packem_shared/Studio-BNGjxLVo.js +16 -0
  60. package/dist/packem_shared/{StudioApp-D4azxYBu.js → StudioApp-K9dn1Q9d.js} +75 -24
  61. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-Cx21PS_T.js} +6 -6
  62. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  63. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CGdOmLTm.d.ts} +1 -1
  64. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  65. package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
  66. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  67. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-C9I16KWr.js} +1 -1
  68. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  69. package/dist/packem_shared/error-alert-vIPQoN3Y.js +114 -0
  70. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-B_fZH4iQ.js} +133 -164
  71. package/dist/packem_shared/home-panel-D62G8108.js +1889 -0
  72. package/dist/packem_shared/internal-zwBoOv24.js +122 -0
  73. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  74. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUULLuOi.js} +8 -61
  75. package/dist/packem_shared/result-chart-DZradBAS.js +119 -0
  76. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  77. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  78. package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
  79. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  80. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  81. package/dist/packem_shared/studio-Cd21fp4v.js +4090 -0
  82. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  83. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-huX4VmgI.js} +19 -9
  84. package/dist/packem_shared/use-admin-query-BGJ010yZ.js +106 -0
  85. package/dist/packem_shared/use-async-submit-DGCtuDyz.js +91 -0
  86. package/dist/standalone/chunk-22C6COGE.js +13 -0
  87. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  88. package/dist/standalone/chunk-2MLA6WFH.js +1 -0
  89. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  90. package/dist/standalone/chunk-2ZL6MXBC.js +4 -0
  91. package/dist/standalone/chunk-3GXGLNKW.js +1 -0
  92. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  93. package/dist/standalone/chunk-4PC7IXNY.js +1 -0
  94. package/dist/standalone/chunk-4QA5TWYJ.js +1 -0
  95. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  96. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  97. package/dist/standalone/chunk-6TYT447C.js +1 -0
  98. package/dist/standalone/chunk-7SN6J4DZ.js +1 -0
  99. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  100. package/dist/standalone/chunk-A3ZJACVT.js +4 -0
  101. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  102. package/dist/standalone/chunk-AITOCPML.js +1 -0
  103. package/dist/standalone/chunk-AJ2B326V.js +1 -0
  104. package/dist/standalone/chunk-APSSZB6Z.js +1 -0
  105. package/dist/standalone/chunk-AVONJCNY.js +4 -0
  106. package/dist/standalone/chunk-BE24FXAK.js +1 -0
  107. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  108. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  109. package/dist/standalone/chunk-CP2EQVLU.js +1 -0
  110. package/dist/standalone/chunk-DTPFXYHG.js +1 -0
  111. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  112. package/dist/standalone/chunk-E3FVNRH7.js +1 -0
  113. package/dist/standalone/chunk-EEWKIQUE.js +1 -0
  114. package/dist/standalone/chunk-EOE5NDMK.js +1 -0
  115. package/dist/standalone/chunk-FJV4UNYY.js +1 -0
  116. package/dist/standalone/chunk-FWTZYHX4.js +1 -0
  117. package/dist/standalone/chunk-G465LTLD.js +1 -0
  118. package/dist/standalone/chunk-G6URLCRC.js +3 -0
  119. package/dist/standalone/chunk-G7ZBM54M.js +1 -0
  120. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  121. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  122. package/dist/standalone/chunk-IMZKGRPW.js +1 -0
  123. package/dist/standalone/chunk-ITQKVEP7.js +19 -0
  124. package/dist/standalone/chunk-IZN4TYMN.js +1 -0
  125. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  126. package/dist/standalone/chunk-JM7XBQVK.js +1 -0
  127. package/dist/standalone/chunk-JPILGFXT.js +1 -0
  128. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  129. package/dist/standalone/chunk-KDZJ5A3R.js +1 -0
  130. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  131. package/dist/standalone/chunk-KGQGNJJ2.js +1 -0
  132. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  133. package/dist/standalone/chunk-KKJZL75J.js +1 -0
  134. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  135. package/dist/standalone/chunk-L2YBC2BV.js +11 -0
  136. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  137. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  138. package/dist/standalone/chunk-LDEVBRDZ.js +1 -0
  139. package/dist/standalone/chunk-LUP4YTBS.js +1 -0
  140. package/dist/standalone/chunk-LVH4KLXS.js +13 -0
  141. package/dist/standalone/chunk-MDTNVR3G.js +1 -0
  142. package/dist/standalone/chunk-N4NG7HGI.js +1 -0
  143. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  144. package/dist/standalone/chunk-ONSKQCYN.js +3 -0
  145. package/dist/standalone/chunk-OQE56NBE.js +1 -0
  146. package/dist/standalone/chunk-OSPEOESV.js +8 -0
  147. package/dist/standalone/chunk-Q7PYLDZU.js +1 -0
  148. package/dist/standalone/chunk-Q7TKOAGT.js +1 -0
  149. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  150. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  151. package/dist/standalone/chunk-RXVQJ4DO.js +1 -0
  152. package/dist/standalone/chunk-S5NTGHCG.js +1 -0
  153. package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
  154. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  155. package/dist/standalone/chunk-SHERR7ZP.js +1 -0
  156. package/dist/standalone/chunk-T3UCZ5PJ.js +1 -0
  157. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  158. package/dist/standalone/chunk-TAQM5WML.js +1 -0
  159. package/dist/standalone/chunk-TO6D2PJC.js +6 -0
  160. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  161. package/dist/standalone/chunk-TSLR3ZU2.js +1 -0
  162. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  163. package/dist/standalone/chunk-UX53GWGU.js +1 -0
  164. package/dist/standalone/chunk-V43BLH4J.js +1 -0
  165. package/dist/standalone/chunk-VC5RNEHU.js +1 -0
  166. package/dist/standalone/chunk-VL23Y44O.js +4 -0
  167. package/dist/standalone/chunk-VLIRTNLA.js +4 -0
  168. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  169. package/dist/standalone/chunk-VN2PDOMK.js +1 -0
  170. package/dist/standalone/chunk-VZFJI6XE.js +1 -0
  171. package/dist/standalone/chunk-W6JKUZKD.js +1 -0
  172. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  173. package/dist/standalone/chunk-WJ6OBCUM.js +1 -0
  174. package/dist/standalone/chunk-WUFVFVHJ.js +1 -0
  175. package/dist/standalone/chunk-WVTPZ6CM.js +1 -0
  176. package/dist/standalone/chunk-X4QFAAZ5.js +76 -0
  177. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  178. package/dist/standalone/chunk-XOANGJJP.js +1 -0
  179. package/dist/standalone/chunk-YA6POZJD.js +1 -0
  180. package/dist/standalone/chunk-ZECNJ4FG.js +1 -0
  181. package/dist/standalone/chunk-ZETIKSQJ.js +1 -0
  182. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  183. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  184. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  185. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  186. package/dist/standalone/chunk-ZZMGCPXE.js +2 -0
  187. package/dist/standalone/studio.js +104 -246
  188. package/dist/styles.css +2 -2
  189. package/package.json +17 -15
  190. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  191. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  192. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  193. package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
  194. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  195. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  196. package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
  197. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  198. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -0,0 +1,4 @@
1
+ import{a as Fr}from"./chunk-HV7G6DFP.js";import{a as D,b as xe,c as T,h as Ce,i as Ie,j as Nt,w as de}from"./chunk-O3NAGRTR.js";import{a as St,c as H,g as N,i as ue,j as $}from"./chunk-CKSHCYGC.js";import{a as ce}from"./chunk-3OA7PECS.js";import{a as r,d as re,e as g,f as y,g as Tr,h as Dr,j as At}from"./chunk-RRCPZMC2.js";var hr=g(Tr(),1),Wa=g(y(),1);var gr=g(y(),1);var He={};re(He,{Control:()=>vt,Description:()=>ht,Error:()=>Rt,Item:()=>It,Label:()=>pt,Root:()=>mt,Validity:()=>Et});var S=g(y(),1);var ye=g(y(),1);var et=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});var oe={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},fe={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},wt={disabled:!1,...fe},W={valid(e){return e===null?null:e?{[et.valid]:""}:{[et.invalid]:""}}};var Vr={invalid:void 0,name:void 0,validityData:{state:oe,errors:[],error:"",value:"",initialValue:null},setValidityData:N,disabled:void 0,touched:fe.touched,setTouched:N,dirty:fe.dirty,setDirty:N,filled:fe.filled,setFilled:N,focused:fe.focused,setFocused:N,validate:r(()=>null,"validate"),validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:r(()=>!1,"shouldValidateOnChange"),state:wt,markedDirtyRef:{current:!1},registerFieldControl:N,validation:{getValidationProps:r((e,t=ue)=>t,"getValidationProps"),inputRef:{current:null},registerInput:N,commit:r(async()=>{},"commit"),change:N}},Fe=ye.createContext(Vr);Fe.displayName="FieldRootContext";function B(e=!0){let t=ye.useContext(Fe);if(t.setValidityData===N&&!e)throw new Error("Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.");return t}r(B,"useFieldRootContext");var Te=g(y(),1);var _t=Te.createContext(void 0);_t.displayName="FieldsetRootContext";function Ot(e=!1){let t=Te.useContext(_t);if(!t&&!e)throw new Error("Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.");return t}r(Ot,"useFieldsetRootContext");var De=g(y(),1);var Mt=De.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:N,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});Mt.displayName="FormContext";function z(){return De.useContext(Mt)}r(z,"useFormContext");var Z=g(y(),1);var Ve=g(y(),1);var Lt=0;function Ar(e,t="mui"){let[o,n]=Ve.useState(e),i=e||o;return Ve.useEffect(()=>{o==null&&(Lt+=1,n(`${t}-${Lt}`))},[o,t]),i}r(Ar,"useGlobalId");var Pt=xe.useId;function kt(e,t){if(Pt!==void 0){let o=Pt();return e??(t?`${t}-${o}`:o)}return Ar(e,t)}r(kt,"useId");function J(e){return kt(e,"base-ui")}r(J,"useBaseUiId");var Ae=g(y(),1);var Se=Ae.createContext({controlId:void 0,registerControlId:N,labelId:void 0,setLabelId:N,messageIds:[],setMessageIds:N,getDescriptionProps:r(e=>e,"getDescriptionProps")});Se.displayName="LabelableContext";function P(){return Ae.useContext(Se)}r(P,"useLabelableContext");var Ut=g(ce(),1);var ge=r(function(t){let o=J(),n=t.controlId===void 0?o:t.controlId,[i,s]=Z.useState(n),[a,l]=Z.useState(t.labelId),[u,d]=Z.useState([]),m=H(()=>new Map),{messageIds:f}=P(),h=T((R,F)=>{let V=m.current;if(F===void 0){V.delete(R);return}V.set(R,F),s(E=>{if(V.size===0)return;let k;for(let c of V.values()){if(E!==void 0&&c===E)return E;k===void 0&&(k=c)}return k})}),p=Z.useCallback(R=>{let F=R["aria-describedby"]?R["aria-describedby"].split(" "):[];return F.push(...f,...u),{...R,"aria-describedby":Array.from(new Set(F)).join(" ")||void 0}},[f,u]),v=Z.useMemo(()=>({controlId:i,registerControlId:h,labelId:a,setLabelId:l,messageIds:u,setMessageIds:d,getDescriptionProps:p}),[i,h,a,l,u,d,p]);return(0,Ut.jsx)(Se.Provider,{value:v,children:t.children})},"LabelableProvider");ge.displayName="LabelableProvider";var Re=g(y(),1);function jt(e={}){let{id:t,implicit:o=!1,controlRef:n}=e,{controlId:i,registerControlId:s}=P(),a=J(t),l=o?i:void 0,u=H(()=>Symbol("labelable-control")),d=Re.useRef(!1),m=Re.useRef(t!=null),f=T(()=>{!d.current||s===N||(d.current=!1,s(u.current,void 0))});return D(()=>{if(s===N)return;let h;if(o){let p=n?.current;Ce(p)&&p.closest("label")!=null?h=t??null:h=l??a}else if(t!=null)m.current=!0,h=t;else if(m.current)h=a;else{f();return}if(h===void 0){f();return}d.current=!0,s(u.current,h)},[t,n,l,s,o,a,u,f]),Re.useEffect(()=>f,[f]),i??a}r(jt,"useLabelableId");function Ne(e){return e?.ownerDocument||document}r(Ne,"ownerDocument");var we={};re(we,{engine:()=>it,env:()=>at,os:()=>ot,screenReader:()=>st});var ot={};re(ot,{android:()=>Wt,apple:()=>rt,ios:()=>tt,linux:()=>Or,mac:()=>qt,windows:()=>_r});function Sr(){if(typeof navigator>"u")return{userAgent:"",platform:"",maxTouchPoints:0};{let e=navigator.userAgentData;if(e&&Array.isArray(e.brands))return{userAgent:e.brands.map(({brand:t,version:o})=>`${t}/${o}`).join(" "),platform:e.platform??navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}return{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}r(Sr,"readRawData");var{userAgent:Nr,platform:wr,maxTouchPoints:Bt}=Sr(),ne=Nr.toLowerCase(),ie=wr.toLowerCase();var tt=/^i(os$|p)/.test(ie)||ie==="macintel"&&Bt>1,$t="android",Wt=ie===$t||ne.includes($t),qt=!tt&&ie.startsWith("mac"),_r=ie.startsWith("win"),Or=!Wt&&/^(linux|chrome os)/.test(ie),rt=qt||tt;var it={};re(it,{blink:()=>Lr,gecko:()=>Mr,webkit:()=>nt});var nt=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none"),Mr=!nt&&ne.includes("firefox"),Lr=!nt&&ne.includes("chrom");var st={};re(st,{voiceOver:()=>Pr});var Pr=rt;var at={};re(at,{jsdom:()=>kr});var kr=/jsdom|happydom/.test(ne);var lt="data-base-ui-focusable";var ct="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Tn="ArrowLeft",Dn="ArrowRight",Vn="ArrowUp",An="ArrowDown";function ut(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}r(ut,"activeElement");function Gt(e,t){if(!e||!t)return!1;let o=t.getRootNode?.();if(e.contains(t))return!0;if(o&&Nt(o)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}r(Gt,"contains");function dt(e){return"composedPath"in e?e.composedPath()[0]:e.target}r(dt,"getTarget");function kn(e,t){if(!Ce(e))return!1;let o=e;if(t.hasElement(o))return!o.hasAttribute("data-trigger-disabled");for(let[,n]of t.entries())if(Gt(n,o))return!n.hasAttribute("data-trigger-disabled");return!1}r(kn,"isTargetInsideEnabledTrigger");function Un(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);let o=e;return o.target!=null&&t.contains(o.target)}r(Un,"isEventTargetWithin");function jn(e){return e.matches("html,body")}r(jn,"isRootElement");function Ur(e){return Ie(e)&&e.matches(ct)}r(Ur,"isTypeableElement");function Bn(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${ct}`)!=null}r(Bn,"isInteractiveElement");function $n(e){return e?e.getAttribute("role")==="combobox"&&Ur(e):!1}r($n,"isTypeableCombobox");function Wn(e){if(!e||we.env.jsdom)return!0;try{return e.matches(":focus-visible")}catch{return!0}}r(Wn,"matchesFocusVisible");function qn(e){return e?e.hasAttribute(lt)?e:e.querySelector(`[${lt}]`)||e:null}r(qn,"getFloatingFocusElement");function Yt(e,t){let o=J(e);return D(()=>(t(o),()=>{t(void 0)}),[o,t]),o}r(Yt,"useRegisteredLabelId");function Kt(e={}){let{id:t,fallbackControlId:o,native:n=!1,setLabelId:i,focusControl:s}=e,{controlId:a,setLabelId:l}=P(),u=T(p=>{l(p),i?.(p)}),d=Yt(t,u),m=a??o;function f(p){if(s){s(p,m);return}if(!m)return;let v=Ne(p.currentTarget).getElementById(m);Ie(v)&&jr(v)}r(f,"focusControl");function h(p){dt(p.nativeEvent)?.closest("button,input,select,textarea")||(!p.defaultPrevented&&p.detail>1&&p.preventDefault(),!n&&f(p))}return r(h,"handleInteraction"),n?{id:d,htmlFor:m??void 0,onMouseDown:h}:{id:d,onClick:h,onPointerDown(p){p.preventDefault()}}}r(Kt,"useLabel");function jr(e){e.focus({focusVisible:!0})}r(jr,"focusElementWithVisible");var ee=g(y(),1);var Ht=g(y(),1);var Br=[];function _e(e){Ht.useEffect(e,Br)}r(_e,"useOnMount");var he=0,ft=class e{static{r(this,"Timeout")}static create(){return new e}currentId=he;start(t,o){this.clear(),this.currentId=setTimeout(()=>{this.currentId=he,o()},t)}isStarted(){return this.currentId!==he}clear=r(()=>{this.currentId!==he&&(clearTimeout(this.currentId),this.currentId=he)},"clear");disposeEffect=r(()=>this.clear,"disposeEffect")};function zt(){let e=H(ft.create).current;return _e(e.disposeEffect),e}r(zt,"useTimeout");function se(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}r(se,"getCombinedFieldValidityData");var Oe=Object.keys(oe);function $r(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let o of Oe)o!=="valid"&&(o==="valueMissing"?t=e[o]:e[o]&&(t=!1));return t}r($r,"isOnlyValueMissing");function Wr(e){let t=null;for(let o of e)if(!o.disabled){if(!o.validity.valid)return o;t??=o}return t}r(Wr,"findRepresentativeInput");function Jt(e,t){let o=!1;for(let n of t)n.setCustomValidity(""),o||=n===e;o||e.setCustomValidity("")}r(Jt,"clearCustomValidity");function Xt(e){let{formRef:t}=z(),{setValidityData:o,validate:n,validityData:i,validationDebounceTime:s,invalid:a,markedDirtyRef:l,state:u,shouldValidateOnChange:d,getRegisteredFieldId:m}=e,{controlId:f,getDescriptionProps:h}=P(),p=zt(),v=ee.useRef(null),R=H(()=>new Set).current,F=ee.useRef(0),V=ee.useCallback(b=>{if(b)return R.add(b),()=>{R.delete(b)}},[R]),E=T(async(b,w=!1)=>{let C=Wr(R)??v.current;if(!C)return;F.current+=1;let te=F.current;function q(L,A=a){let O=m()??f;if(O==null)return;let x=t.current.fields.get(O);if(!x)return;let K=se(L,A);t.current.fields.set(O,{...x,validityData:K})}if(r(q,"updateRegisteredFieldValidity"),w){if(u.valid!==!1)return;let L=C.validity;if(!L.valueMissing){let O={value:b,state:{...oe,valid:!0},error:"",errors:[],initialValue:i.initialValue};Jt(C,R),q(O,!1),o(O);return}let A=Oe.reduce((O,x)=>(O[x]=L[x],O),{});if(!A.valid&&!$r(A))return}function G(L){let A=Oe.reduce((x,K)=>(x[K]=L.validity[K],x),{}),O=!1;for(let x of Oe)if(x!=="valid"){if(x==="valueMissing"&&A[x])O=!0;else if(A[x])return A}return O&&!l.current&&(A.valid=!0,A.valueMissing=!1),A}r(G,"getState"),p.clear();let I=null,M=[],U=G(C),j,Y=d();if(C.validationMessage&&!Y)j=C.validationMessage,M=[C.validationMessage];else{let L=Array.from(t.current.fields.values()).reduce((O,x)=>(x.name&&(O[x.name]=x.getValue()),O),{}),A=n(b,L);if(typeof A=="object"&&A!==null&&"then"in A){if(I=await A,te!==F.current)return}else I=A;I!==null?(U.valid=!1,U.customError=!0,Array.isArray(I)?(M=I,C.setCustomValidity(I.join(`
2
+ `))):I&&(M=[I],C.setCustomValidity(I))):Y&&(Jt(C,R),U.customError=!1,C.validationMessage?(j=C.validationMessage,M=[C.validationMessage]):C.validity.valid&&!U.valid&&(U.valid=!0))}let _={value:b,state:U,error:j??(Array.isArray(I)?I[0]:I??""),errors:M,initialValue:i.initialValue};q(_),o(_)}),k=T(b=>{p.clear();let w=d();w&&b!==""&&s?(F.current+=1,p.start(s,()=>{E(b)})):E(b,!w)}),c=ee.useCallback((b,w={})=>St(h(w),u.valid===!1&&!u.disabled&&!b?{"aria-invalid":!0}:ue),[h,u.disabled,u.valid]);return ee.useMemo(()=>({getValidationProps:c,inputRef:v,registerInput:V,commit:E,change:k}),[c,V,E,k])}r(Xt,"useFieldValidation");var Me=g(y(),1);function Qt(e){let{commit:t,invalid:o,markedDirtyRef:n,name:i,setRegisteredFieldName:s,setRegisteredFieldId:a,setValidityData:l,validityData:u}=e,{formRef:d}=z(),m=Me.useRef(null),f=Me.useRef(null),h=Me.useRef(null),p=T(()=>{let c=f.current;if(c)return c.getValue?c.getValue():c.value});function v(c){return c.value===void 0?p():c.value}r(v,"getRegistrationValue");let R=T(()=>{let c=f.current;if(n.current=!0,!c){t(u.value);return}t(v(c))});function F(){let c=f.current;!c||!c.id||d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R})}r(F,"refreshRegistration");function V(c=f.current?.id){c&&d.current.fields.delete(c)}r(V,"deleteRegistration");function E(){let c=f.current;if(!c)return;let b=v(c);u.initialValue===null&&b!==null&&l(w=>({...w,initialValue:b}))}r(E,"syncInitialValue"),D(()=>{let c=f.current;!c||!c.id||(s(i?void 0:c.name),d.current.fields.set(c.id,{getValue:p,name:i??c.name,controlRef:c.controlRef??h,validityData:se(u,o),validate:R}))},[d,p,o,i,s,R,u]),D(()=>{let c=d.current.fields;return()=>{let b=f.current?.id;b&&c.delete(b)}},[d]);let k=T((c,b)=>{if(!b){m.current===c&&(m.current=null,V(),f.current=null,s(void 0),a(void 0));return}let w=f.current?.id;m.current=c,f.current=b,i||s(b.name),a(b.id),w&&w!==b.id&&V(w),E(),F()});return[R,k]}r(Qt,"useFieldControlRegistration");var Le=g(ce(),1);var Zt=S.forwardRef(r(function(t,o){let{errors:n,validationMode:i,submitAttemptedRef:s}=z(),{render:a,className:l,validate:u,validationDebounceTime:d=0,validationMode:m=i,name:f,disabled:h=!1,invalid:p,dirty:v,touched:R,actionsRef:F,style:V,...E}=t,k=Ot(!0)?.disabled,c=T(u||(()=>null)),b=k||h,[w,C]=S.useState(!1),[te,q]=S.useState(!1),[G,I]=S.useState(!1),[M,U]=S.useState(!1),j=v??te,Y=R??w,_=S.useRef(j),L=S.useRef(void 0),[A,O]=S.useState(),x=f??A;D(()=>{v!==void 0&&(_.current=v)},[v]);let K=S.useCallback(()=>L.current,[]),Er=S.useCallback(le=>{L.current=le},[]),yt=T(le=>{v===void 0&&(le&&(_.current=!0),q(le))}),Ft=T(le=>{R===void 0&&C(le)}),Je=T(()=>m==="onChange"||m==="onSubmit"&&s.current),Xe=x&&Object.hasOwn(n,x)?n[x]:null,Cr=!!(Array.isArray(Xe)?Xe.length:Xe),pe=p===!0||Cr,[be,Qe]=S.useState({state:oe,error:"",errors:[],value:null,initialValue:null}),Tt=b?null:!pe&&be.state.valid,Ee=S.useMemo(()=>({disabled:b,touched:Y,dirty:j,valid:Tt,filled:G,focused:M}),[b,Y,j,Tt,G,M]),Ze=Xt({setValidityData:Qe,validate:c,validityData:be,validationDebounceTime:d,invalid:pe,markedDirtyRef:_,state:Ee,shouldValidateOnChange:Je,getRegisteredFieldId:K}),[Dt,Vt]=Qt({commit:Ze.commit,invalid:pe,markedDirtyRef:_,name:f,setRegisteredFieldName:O,setRegisteredFieldId:Er,setValidityData:Qe,validityData:be});S.useImperativeHandle(F,()=>({validate:Dt}),[Dt]);let Ir=S.useMemo(()=>({invalid:pe,name:x,validityData:be,setValidityData:Qe,disabled:b,touched:Y,setTouched:Ft,dirty:j,setDirty:yt,filled:G,setFilled:I,focused:M,setFocused:U,validate:c,validationMode:m,validationDebounceTime:d,shouldValidateOnChange:Je,state:Ee,markedDirtyRef:_,registerFieldControl:Vt,validation:Ze}),[pe,x,be,b,Y,Ft,j,yt,G,I,M,U,c,m,d,Je,Ee,Vt,Ze]),yr=$("div",t,{ref:o,state:Ee,props:E,stateAttributesMapping:W});return(0,Le.jsx)(Fe.Provider,{value:Ir,children:yr})},"FieldRootInner"));Zt.displayName="FieldRootInner";var mt=S.forwardRef(r(function(t,o){return(0,Le.jsx)(ge,{children:(0,Le.jsx)(Zt,{...t,ref:o})})},"FieldRoot"));mt.displayName="FieldRoot";var me=g(y(),1);var Pe=g(y(),1);var ke=Pe.createContext({disabled:!1});ke.displayName="FieldItemContext";function Ue(){return Pe.useContext(ke)}r(Ue,"useFieldItemContext");var pt=me.forwardRef(r(function(t,o){let{render:n,className:i,style:s,id:a,nativeLabel:l=!0,...u}=t,d=B(!1),m=Ue(),{labelId:f}=P(),h={...d.state,disabled:d.disabled||m.disabled},p=me.useRef(null),v=Kt({id:f??a,native:l});return me.useEffect(()=>{if(!p.current)return;let F=p.current.tagName==="LABEL";if(l){if(!F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a <label> element because the \`nativeLabel\` prop is true. Rendering a non-<label> disables native label association, so \`htmlFor\` will not work. Use a real <label> in the \`render\` prop, or set \`nativeLabel\` to \`false\`.${V}`)}}else if(F){let V=xe.captureOwnerStack?.()||"";de(`<Field.Label> expected a non-<label> element because the \`nativeLabel\` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the \`render\` prop, or set \`nativeLabel\` to \`true\`.${V}`)}},[l]),$("label",t,{ref:[o,p],state:h,props:[v,u],stateAttributesMapping:W})},"FieldLabel"));pt.displayName="FieldLabel";var ae=g(y(),1);var sr=g(y(),1);var nr=g(Fr(),1);var je=null,er=globalThis.requestAnimationFrame,bt=class{static{r(this,"Scheduler")}callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=r(t=>{this.isScheduled=!1;let o=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let i=0;i<o.length;i+=1)o[i]?.(t)},"tick");request(t){let o=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;let n=er!==requestAnimationFrame&&(er=requestAnimationFrame,!0);return(!this.isScheduled||n)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),o}cancel(t){let o=t-this.startId;o<0||o>=this.callbacks.length||(this.callbacks[o]=null,this.callbacksCount-=1)}},Be=new bt,X=class e{static{r(this,"AnimationFrame")}static create(){return new e}static request(t){return Be.request(t)}static cancel(t){return Be.cancel(t)}currentId=je;request(t){this.cancel(),this.currentId=Be.request(()=>{this.currentId=je,t()})}cancel=r(()=>{this.currentId!==je&&(Be.cancel(this.currentId),this.currentId=je)},"cancel");disposeEffect=r(()=>this.cancel,"disposeEffect")};function tr(){let e=H(X.create).current;return _e(e.disposeEffect),e}r(tr,"useAnimationFrame");function rr(e){return e==null?e:"current"in e?e.current:e}r(rr,"resolveRef");var $e=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({}),qr={[$e.startingStyle]:""},Gr={[$e.endingStyle]:""},or={transitionStatus(e){return e==="starting"?qr:e==="ending"?Gr:null}};function ir(e,t=!1,o=!0){let n=tr();return T((i,s=null)=>{n.cancel();let a=rr(e);if(a==null)return;let l=a,u=r(()=>{nr.flushSync(i)},"done");if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function d(){Promise.all(l.getAnimations().map(m=>m.finished)).then(()=>{s?.aborted||u()}).catch(()=>{if(o){s?.aborted||u();return}let m=l.getAnimations();!s?.aborted&&m.length>0&&m.some(f=>f.pending||f.playState!=="finished")&&d()})}if(r(d,"exec"),t){let m=$e.startingStyle;if(!l.hasAttribute(m)){n.request(d);return}let f=new MutationObserver(()=>{l.hasAttribute(m)||(f.disconnect(),d())});f.observe(l,{attributes:!0,attributeFilter:[m]}),s?.addEventListener("abort",()=>f.disconnect(),{once:!0});return}n.request(d)})}r(ir,"useAnimationsFinished");function ar(e){let{enabled:t=!0,open:o,ref:n,onComplete:i}=e,s=T(i),a=ir(n,o,!1);sr.useEffect(()=>{if(!t)return;let l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,o,s,a])}r(ar,"useOpenChangeComplete");var xt=g(y(),1);function We(e,t=!1,o=!1){let[n,i]=xt.useState(e&&t?"idle":void 0),[s,a]=xt.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&n!=="ending"&&!o&&i("ending"),!e&&!s&&n==="ending"&&i(void 0),D(()=>{if(!e&&s&&n!=="ending"&&o){let l=X.request(()=>{i("ending")});return()=>{X.cancel(l)}}},[e,s,n,o]),D(()=>{if(!e||t)return;let l=X.request(()=>{i(void 0)});return()=>{X.cancel(l)}},[t,e]),D(()=>{if(!e||!t)return;e&&s&&n!=="idle"&&i("starting");let l=X.request(()=>{i("idle")});return()=>{X.cancel(l)}},[t,e,s,n]),{mounted:s,setMounted:a,transitionStatus:n}}r(We,"useTransitionStatus");var gt=g(ce(),1);var Yr={...W,...or},Rt=ae.forwardRef(r(function(t,o){let{render:n,id:i,className:s,match:a,style:l,...u}=t,d=J(i),{validityData:m,state:f,name:h}=B(!1),{setMessageIds:p}=P(),{errors:v}=z(),R=h&&Object.hasOwn(v,h)?v[h]:null,F=!!(Array.isArray(R)?R.length:R),V=typeof a=="string",E=!1;a===!0?E=!0:f.disabled?E=!1:V?E=!!m.state[a]:E=F||m.state.valid===!1;let{mounted:k,transitionStatus:c,setMounted:b}=We(E);D(()=>{if(!(!E||!d))return p(_=>_.concat(d)),()=>{p(_=>_.filter(L=>L!==d))}},[E,d,p]);let w=ae.useRef(null),[C,te]=ae.useState(null),[q,G]=ae.useState(null),I=m.error;!V&&F?I=R:m.errors.length>1&&(I=m.errors);let M=I??"";Array.isArray(I)&&(M=I.length>1?(0,gt.jsx)("ul",{children:I.map(_=>(0,gt.jsx)("li",{children:_},_))}):I[0]??"");let U=Array.isArray(I)?JSON.stringify(I):I;E&&U!==q&&(G(U),te(M)),ar({open:E,ref:w,onComplete(){E||b(!1)}});let j={...f,transitionStatus:c},Y=$("div",t,{ref:[o,w],state:j,props:[{id:d,children:E?M:C},u],stateAttributesMapping:Yr,enabled:k});return k?Y:null},"FieldError"));Rt.displayName="FieldError";var lr=g(y(),1);var ht=lr.forwardRef(r(function(t,o){let{render:n,id:i,className:s,style:a,...l}=t,u=J(i),d=B(!1),m=Ue(),{setMessageIds:f}=P(),h={...d.state,disabled:d.disabled||m.disabled};return D(()=>{if(u)return f(v=>v.concat(u)),()=>{f(v=>v.filter(R=>R!==u))}},[u,f]),$("p",t,{ref:o,state:h,props:[{id:u},l],stateAttributesMapping:W})},"FieldDescription"));ht.displayName="FieldDescription";var Ge=g(y(),1);var Q=g(y(),1);function ur({controlled:e,default:t,name:o,state:n="value"}){let{current:i}=Q.useRef(e!==void 0),[s,a]=Q.useState(t),l=i?e:s;{Q.useEffect(()=>{i!==(e!==void 0)&&de([`A component is changing the ${i?"":"un"}controlled ${n} state of ${o} to be ${i?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
3
+ `))},[n,o,e]);let{current:d}=Q.useRef(t);Q.useEffect(()=>{!i&&cr(d)!==cr(t)&&de([`A component is changing the default ${n} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
4
+ `))},[t])}let u=Q.useCallback(d=>{i||a(d)},[]);return[l,u]}r(ur,"useControlled");function cr(e){let t=0,o=new WeakMap;try{return JSON.stringify(e,r(function(s,a){if(!(s==="_owner"&&this!=null&&typeof this=="object"&&"$$typeof"in this)){if(typeof a=="bigint")return`__bigint__:${a}`;if(a!==null&&typeof a=="object"){let l=o.get(a);if(l!==void 0)return`__object__:${l}`;o.set(a,t),t+=1}return a}},"replacer"))??`__top__:${typeof e}`}catch{return"__unserializable__"}}r(cr,"serializeToDevModeString");var dr=g(y(),1);function fr(e,t,o,n,i=!0,s){let{registerFieldControl:a}=B(),l=dr.useRef(null);l.current||(l.current=Symbol()),D(()=>{let u=l.current;return!u||!i?void 0:(a(u,{controlRef:e,getValue:n,id:t,name:s,value:o}),()=>{a(u,void 0)})},[e,i,n,t,s,a,o])}r(fr,"useRegisterFieldControl");var qe={};re(qe,{cancelOpen:()=>Eo,chipRemovePress:()=>ro,clearPress:()=>to,closePress:()=>Zr,closeWatcher:()=>po,decrementPress:()=>io,disabled:()=>Io,drag:()=>Ro,escapeKey:()=>mo,focusOut:()=>fo,imperativeAction:()=>To,incrementPress:()=>no,initial:()=>Fo,inputBlur:()=>lo,inputChange:()=>so,inputClear:()=>ao,inputPaste:()=>co,inputPress:()=>uo,itemPress:()=>Qr,keyboard:()=>xo,linkPress:()=>eo,listNavigation:()=>bo,missing:()=>yo,none:()=>Kr,outsidePress:()=>Xr,pointer:()=>go,scrub:()=>vo,siblingOpen:()=>Co,swipe:()=>Do,trackPress:()=>oo,triggerFocus:()=>Jr,triggerHover:()=>zr,triggerPress:()=>Hr,wheel:()=>ho,windowResize:()=>Vo});var Kr="none",Hr="trigger-press",zr="trigger-hover",Jr="trigger-focus",Xr="outside-press",Qr="item-press",Zr="close-press",eo="link-press",to="clear-press",ro="chip-remove-press",oo="track-press",no="increment-press",io="decrement-press",so="input-change",ao="input-clear",lo="input-blur",co="input-paste",uo="input-press",fo="focus-out",mo="escape-key",po="close-watcher",bo="list-navigation",xo="keyboard",go="pointer",Ro="drag",ho="wheel",vo="scrub",Eo="cancel-open",Co="sibling-open",Io="disabled",yo="missing",Fo="initial",To="imperative-action",Do="swipe",Vo="window-resize";function mr(e,t,o,n){let i=!1,s=!1,a=n??ue;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:o,...a}}r(mr,"createChangeEventDetails");var vt=Ge.forwardRef(r(function(t,o){let{render:n,className:i,id:s,name:a,value:l,disabled:u=!1,onValueChange:d,defaultValue:m,autoFocus:f=!1,style:h,...p}=t,{state:v,name:R,disabled:F,setTouched:V,setDirty:E,validityData:k,setFocused:c,setFilled:b,validationMode:w,validation:C}=B(),{clearErrors:te}=z(),q=F||u,G=R??a,I={...v,disabled:q},{labelId:M}=P(),U=jt({id:s});D(()=>{let x=l!=null;C.inputRef.current?.value||x&&l!==""?b(!0):x&&l===""&&b(!1)},[C.inputRef,b,l]);let j=Ge.useRef(null);D(()=>{f&&j.current===ut(Ne(j.current))&&c(!0)},[f,c]);let[Y]=ur({controlled:l,default:m,name:"FieldControl",state:"value"}),_=l!==void 0,L=_?Y:void 0,A=T(()=>C.inputRef.current?.value);return fr(C.inputRef,U,L,A,!q,a),$("input",t,{ref:[o,j],state:I,props:[{id:U,disabled:q,name:G,ref:C.inputRef,"aria-labelledby":M,autoFocus:f,..._?{value:L}:{defaultValue:m},onChange(x){let K=x.currentTarget.value;d?.(K,mr(qe.none,x.nativeEvent)),E(K!==k.initialValue),b(K!==""),x.nativeEvent.defaultPrevented||(te(G),C.change(K))},onFocus(){c(!0)},onBlur(x){V(!0),c(!1),w==="onBlur"&&C.commit(x.currentTarget.value)},onKeyDown(x){x.currentTarget.tagName==="INPUT"&&x.key==="Enter"&&(V(!0),C.commit(x.currentTarget.value))}},p,x=>C.getValidationProps(q,x)],stateAttributesMapping:W})},"FieldControl"));vt.displayName="FieldControl";var ve=g(y(),1);var pr=g(ce(),1);var Et=r(function(t){let{children:o}=t,{validityData:n,invalid:i}=B(!1),s=ve.useMemo(()=>se(n,i),[n,i]),a=s.state.valid===!1,{transitionStatus:l}=We(a),u=ve.useMemo(()=>({...s,validity:s.state,transitionStatus:l}),[s,l]);return(0,pr.jsx)(ve.Fragment,{children:o(u)})},"FieldValidity");Et.displayName="FieldValidity";var Ke=g(y(),1);var Ye=g(y(),1);var br=Ye.createContext(void 0);br.displayName="CheckboxGroupContext";function xr(e=!0){let t=Ye.useContext(br);if(t===void 0&&!e)throw new Error("Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>.");return t}r(xr,"useCheckboxGroupContext");var Ct=g(ce(),1);var It=Ke.forwardRef(r(function(t,o){let{render:n,className:i,style:s,disabled:a=!1,...l}=t,{state:u,disabled:d}=B(!1),m=d||a,f={...u,disabled:m},h=xr(),v=h?.allValues!==void 0?h?.parent.id:void 0,R=Ke.useMemo(()=>({disabled:m}),[m]),F=$("div",t,{ref:o,state:f,props:l,stateAttributesMapping:W});return(0,Ct.jsx)(ge,{controlId:v,children:(0,Ct.jsx)(ke.Provider,{value:R,children:F})})},"FieldItem"));It.displayName="FieldItem";var Rr=g(ce(),1);var ze=gr.forwardRef(r(function(t,o){return(0,Rr.jsx)(He.Control,{ref:o,...t})},"Input"));ze.displayName="Input";var vr=g(Dr(),1);function Ya(e){let t=(0,hr.c)(10),o,n,i;t[0]!==e?({className:o,type:i,...n}=e,t[0]=e,t[1]=o,t[2]=n,t[3]=i):(o=t[1],n=t[2],i=t[3]);let s;t[4]!==o?(s=At("h-8 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",o),t[4]=o,t[5]=s):s=t[5];let a;return t[6]!==n||t[7]!==s||t[8]!==i?(a=(0,vr.jsxDEV)(ze,{type:i,"data-slot":"input",className:s,...n},void 0,!1),t[6]=n,t[7]=s,t[8]=i,t[9]=a):a=t[9],a}r(Ya,"Input");export{W as a,B as b,z as c,kt as d,J as e,P as f,jt as g,Ne as h,we as i,lt as j,Tn as k,Dn as l,Vn as m,An as n,ut as o,Gt as p,dt as q,kn as r,Un as s,jn as t,Ur as u,Bn as v,$n as w,Wn as x,qn as y,Kt as z,_e as A,ft as B,zt as C,Ue as D,X as E,tr as F,rr as G,$e as H,or as I,ir as J,ar as K,We as L,ur as M,fr as N,qe as O,mr as P,xr as Q,Ya as R};
@@ -0,0 +1,4 @@
1
+ import{b as Le}from"./chunk-TO6D2PJC.js";import"./chunk-V43BLH4J.js";import"./chunk-APSSZB6Z.js";import"./chunk-QAFAJBAW.js";import{c as Be}from"./chunk-TQ36RWOP.js";import{a as ye}from"./chunk-3GXGLNKW.js";import"./chunk-AHILM3ZP.js";import{a as Ke}from"./chunk-J6J54MBP.js";import"./chunk-WVTPZ6CM.js";import"./chunk-SHERR7ZP.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import{a as ze}from"./chunk-EEWKIQUE.js";import"./chunk-KEGAWN6Y.js";import{a as Fe,b as De,c as Re,d as de,e as le,f as ee}from"./chunk-GTM65MVX.js";import{a as Te,e as _e}from"./chunk-SEU5V7I6.js";import"./chunk-4QHKBC77.js";import{a as $e}from"./chunk-LUP4YTBS.js";import"./chunk-4PC7IXNY.js";import"./chunk-2MLA6WFH.js";import{R as Ne}from"./chunk-VL23Y44O.js";import"./chunk-HV7G6DFP.js";import{c as se}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{b as ie}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as be}from"./chunk-G7ZBM54M.js";import{f as we}from"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as me}from"./chunk-TAD43CG5.js";import{d as Ce,f as ge,g as pe,h as Q,l as H,n as Ee,o as ve}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as g,e as he,f as gt,g as pt,h as vt}from"./chunk-RRCPZMC2.js";var j=he(pt(),1),_=he(gt(),1);var l=he(vt(),1);var je=g((c,e,s)=>{let t=(0,j.c)(21),{onCopy:n,onDelete:o,onDownload:u,onToggleSelect:a}=s,r;t[0]!==c.key||t[1]!==n?(r=g(()=>{n(c.key)},"t0"),t[0]=c.key,t[1]=n,t[2]=r):r=t[2];let d=r,h;t[3]!==c.key||t[4]!==u?(h=g(()=>{u(c.key)},"t1"),t[3]=c.key,t[4]=u,t[5]=h):h=t[5];let f=h,m;t[6]!==c.key||t[7]!==o?(m=g(()=>{o(c.key)},"t2"),t[6]=c.key,t[7]=o,t[8]=m):m=t[8];let S=m,i;t[9]!==c.key||t[10]!==a?(i=g(()=>{a(c.key)},"t3"),t[9]=c.key,t[10]=a,t[11]=i):i=t[11];let x=i,y;t[12]!==c.key||t[13]!==e.length?(y=c.key.slice(e.length),t[12]=c.key,t[13]=e.length,t[14]=y):y=t[14];let v;return t[15]!==d||t[16]!==f||t[17]!==S||t[18]!==y||t[19]!==x?(v={copy:d,download:f,name:y,remove:S,toggle:x},t[15]=d,t[16]=f,t[17]=S,t[18]=y,t[19]=x,t[20]=v):v=t[20],v},"useFileItem"),Ue=g(c=>{let e=(0,j.c)(31),{busy:s,buttonClassName:t,copied:n,objectKey:o,onCopy:u,onDelete:a,onDownload:r,t:d}=c,h=`storage-copy-${o}`,f;e[0]!==n||e[1]!==d?(f=d(n?"Copied":"Copy URL"),e[0]=n,e[1]=d,e[2]=f):f=e[2];let m;e[3]!==s||e[4]!==t||e[5]!==u||e[6]!==h||e[7]!==f?(m=(0,l.jsxDEV)(se,{className:t,"data-testid":h,disabled:s,onClick:u,size:"sm",type:"button",variant:"ghost",children:f},void 0,!1),e[3]=s,e[4]=t,e[5]=u,e[6]=h,e[7]=f,e[8]=m):m=e[8];let S=`storage-download-${o}`,i;e[9]!==d?(i=d("Download"),e[9]=d,e[10]=i):i=e[10];let x;e[11]!==s||e[12]!==t||e[13]!==r||e[14]!==S||e[15]!==i?(x=(0,l.jsxDEV)(se,{className:t,"data-testid":S,disabled:s,onClick:r,size:"sm",type:"button",variant:"ghost",children:i},void 0,!1),e[11]=s,e[12]=t,e[13]=r,e[14]=S,e[15]=i,e[16]=x):x=e[16];let y;e[17]!==d?(y=d("Delete object?"),e[17]=d,e[18]=y):y=e[18];let v=`storage-delete-${o}`,b;e[19]!==d?(b=d("Delete"),e[19]=d,e[20]=b):b=e[20];let k;e[21]!==s||e[22]!==a||e[23]!==y||e[24]!==v||e[25]!==b?(k=(0,l.jsxDEV)(ze,{confirmLabel:y,disabled:s,onConfirm:a,testId:v,children:b},void 0,!1),e[21]=s,e[22]=a,e[23]=y,e[24]=v,e[25]=b,e[26]=k):k=e[26];let w;return e[27]!==k||e[28]!==m||e[29]!==x?(w=(0,l.jsxDEV)(l.Fragment,{children:[m,x,k]},void 0,!0),e[27]=k,e[28]=m,e[29]=x,e[30]=w):w=e[30],w},"FileActions"),Me=g(c=>{let e=(0,j.c)(14),{objectKey:s,references:t,t:n}=c;if(t===void 0)return null;if(t.length===0){let h=`storage-orphan-${s}`,f;e[0]!==n?(f=n("Orphan"),e[0]=n,e[1]=f):f=e[1];let m;return e[2]!==h||e[3]!==f?(m=(0,l.jsxDEV)(ie,{"data-testid":h,variant:"warning",children:f},void 0,!1),e[2]=h,e[3]=f,e[4]=m):m=e[4],m}let o;e[5]!==t?(o=t.map(bt).join(`
2
+ `),e[5]=t,e[6]=o):o=e[6];let u=o,a=`storage-refs-${s}`,r;e[7]!==t.length||e[8]!==n?(r=t.length===1?n("1 record"):n("{count} records",{count:t.length}),e[7]=t.length,e[8]=n,e[9]=r):r=e[9];let d;return e[10]!==u||e[11]!==a||e[12]!==r?(d=(0,l.jsxDEV)(ie,{"data-testid":a,title:u,variant:"secondary",children:r},void 0,!1),e[10]=u,e[11]=a,e[12]=r,e[13]=d):d=e[13],d},"FileReferences"),Ge=g(c=>{let e=(0,j.c)(7),{objectKey:s,onToggle:t,selected:n,t:o}=c,u;e[0]!==o?(u=o("Select row"),e[0]=o,e[1]=u):u=e[1];let a=`storage-select-${s}`,r;return e[2]!==t||e[3]!==n||e[4]!==u||e[5]!==a?(r=(0,l.jsxDEV)(ye,{"aria-label":u,checked:n,"data-testid":a,onCheckedChange:t},void 0,!1),e[2]=t,e[3]=n,e[4]=u,e[5]=a,e[6]=r):r=e[6],r},"FileSelect");function bt(c){return`${c.table}\xB7${c.id}`}g(bt,"_temp$2");var yt=g(c=>{let e=(0,j.c)(10),{colSpan:s,name:t,onEnter:n}=c,o;e[0]!==t||e[1]!==n?(o=g(()=>{n(t)},"t1"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let u=o,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1),e[3]=a):a=e[3];let r;e[4]!==u||e[5]!==t?(r=(0,l.jsxDEV)("button",{className:"inline-flex items-center gap-2 font-mono text-xs outline-none hover:text-foreground focus-visible:text-foreground","data-testid":"fb-folder",onClick:u,type:"button",children:[a,t]},void 0,!0),e[4]=u,e[5]=t,e[6]=r):r=e[6];let d;return e[7]!==s||e[8]!==r?(d=(0,l.jsxDEV)(de,{children:(0,l.jsxDEV)(ee,{colSpan:s,children:r},void 0,!1)},void 0,!1),e[7]=s,e[8]=r,e[9]=d):d=e[9],d},"FolderRow"),xt=g(c=>{let e=(0,j.c)(33),{busy:s,copiedKey:t,handlers:n,object:o,prefix:u,references:a,selected:r,showReferences:d,t:h}=c,{copy:f,download:m,name:S,remove:i,toggle:x}=je(o,u,n),y;e[0]!==o.key||e[1]!==r||e[2]!==h||e[3]!==x?(y=(0,l.jsxDEV)(ee,{className:"w-8",children:(0,l.jsxDEV)(Ge,{objectKey:o.key,onToggle:x,selected:r,t:h},void 0,!1)},void 0,!1),e[0]=o.key,e[1]=r,e[2]=h,e[3]=x,e[4]=y):y=e[4];let v;e[5]!==S?(v=(0,l.jsxDEV)(ee,{className:"font-mono text-xs",children:S},void 0,!1),e[5]=S,e[6]=v):v=e[6];let b;e[7]!==o.size?(b=ve(o.size),e[7]=o.size,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(ee,{className:"tabular-nums text-muted-foreground",children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w=o.httpMetadata?.contentType??"",T;e[11]!==w?(T=(0,l.jsxDEV)(ee,{children:w},void 0,!1),e[11]=w,e[12]=T):T=e[12];let C;e[13]!==o.key||e[14]!==a||e[15]!==d||e[16]!==h?(C=d&&(0,l.jsxDEV)(ee,{children:(0,l.jsxDEV)(Me,{objectKey:o.key,references:a,t:h},void 0,!1)},void 0,!1),e[13]=o.key,e[14]=a,e[15]=d,e[16]=h,e[17]=C):C=e[17];let N=t===o.key,E;e[18]!==s||e[19]!==f||e[20]!==m||e[21]!==o.key||e[22]!==i||e[23]!==h||e[24]!==N?(E=(0,l.jsxDEV)(ee,{className:"text-right",children:(0,l.jsxDEV)("span",{className:"inline-flex items-center gap-1",children:(0,l.jsxDEV)(Ue,{busy:s,copied:N,objectKey:o.key,onCopy:f,onDelete:i,onDownload:m,t:h},void 0,!1)},void 0,!1)},void 0,!1),e[18]=s,e[19]=f,e[20]=m,e[21]=o.key,e[22]=i,e[23]=h,e[24]=N,e[25]=E):E=e[25];let F;return e[26]!==y||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==C||e[31]!==E?(F=(0,l.jsxDEV)(de,{"data-testid":"fb-row",children:[y,v,k,T,C,E]},void 0,!0),e[26]=y,e[27]=v,e[28]=k,e[29]=T,e[30]=C,e[31]=E,e[32]=F):F=e[32],F},"FileRow"),kt=g(c=>{let e=(0,j.c)(65),{allSelected:s,busy:t,copiedKey:n,files:o,folders:u,handlers:a,onEnterFolder:r,prefix:d,references:h,selected:f,showReferences:m,someSelected:S,t:i,toggleSelectAll:x}=c,y;e[0]!==i?(y=i("Select all rows"),e[0]=i,e[1]=y):y=e[1];let v;e[2]!==s||e[3]!==S||e[4]!==y||e[5]!==x?(v=(0,l.jsxDEV)(le,{className:"w-8",children:(0,l.jsxDEV)(ye,{"aria-label":y,checked:s,"data-testid":"storage-select-all",indeterminate:S,onCheckedChange:x},void 0,!1)},void 0,!1),e[2]=s,e[3]=S,e[4]=y,e[5]=x,e[6]=v):v=e[6];let b;e[7]!==i?(b=i("key"),e[7]=i,e[8]=b):b=e[8];let k;e[9]!==b?(k=(0,l.jsxDEV)(le,{children:b},void 0,!1),e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=i("size"),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==w?(T=(0,l.jsxDEV)(le,{children:w},void 0,!1),e[13]=w,e[14]=T):T=e[14];let C;e[15]!==i?(C=i("content-type"),e[15]=i,e[16]=C):C=e[16];let N;e[17]!==C?(N=(0,l.jsxDEV)(le,{children:C},void 0,!1),e[17]=C,e[18]=N):N=e[18];let E;e[19]!==m||e[20]!==i?(E=m&&(0,l.jsxDEV)(le,{children:i("used by")},void 0,!1),e[19]=m,e[20]=i,e[21]=E):E=e[21];let F;e[22]!==i?(F=i("Actions"),e[22]=i,e[23]=F):F=e[23];let R;e[24]!==F?(R=(0,l.jsxDEV)(le,{"aria-label":F},void 0,!1),e[24]=F,e[25]=R):R=e[25];let D;e[26]!==R||e[27]!==v||e[28]!==k||e[29]!==T||e[30]!==N||e[31]!==E?(D=(0,l.jsxDEV)(De,{children:(0,l.jsxDEV)(de,{children:[v,k,T,N,E,R]},void 0,!0)},void 0,!1),e[26]=R,e[27]=v,e[28]=k,e[29]=T,e[30]=N,e[31]=E,e[32]=D):D=e[32];let B;if(e[33]!==u||e[34]!==r||e[35]!==m){let z;e[37]!==r||e[38]!==m?(z=g(L=>(0,l.jsxDEV)(yt,{colSpan:m?6:5,name:L,onEnter:r},L,!1),"t142"),e[37]=r,e[38]=m,e[39]=z):z=e[39],B=u.map(z),e[33]=u,e[34]=r,e[35]=m,e[36]=B}else B=e[36];let I;if(e[40]!==t||e[41]!==n||e[42]!==o||e[43]!==a||e[44]!==d||e[45]!==h||e[46]!==f||e[47]!==m||e[48]!==i){let z;e[50]!==t||e[51]!==n||e[52]!==a||e[53]!==d||e[54]!==h||e[55]!==f||e[56]!==m||e[57]!==i?(z=g(L=>(0,l.jsxDEV)(xt,{busy:t,copiedKey:n,handlers:a,object:L,prefix:d,references:h[L.key],selected:f.has(L.key),showReferences:m,t:i},L.key,!1),"t152"),e[50]=t,e[51]=n,e[52]=a,e[53]=d,e[54]=h,e[55]=f,e[56]=m,e[57]=i,e[58]=z):z=e[58],I=o.map(z),e[40]=t,e[41]=n,e[42]=o,e[43]=a,e[44]=d,e[45]=h,e[46]=f,e[47]=m,e[48]=i,e[49]=I}else I=e[49];let K;e[59]!==B||e[60]!==I?(K=(0,l.jsxDEV)(Re,{children:[B,I]},void 0,!0),e[59]=B,e[60]=I,e[61]=K):K=e[61];let A;return e[62]!==D||e[63]!==K?(A=(0,l.jsxDEV)(Te,{className:"overflow-hidden py-0",children:(0,l.jsxDEV)(_e,{className:"px-0",children:(0,l.jsxDEV)(Fe,{"data-testid":"fb-table",children:[D,K]},void 0,!0)},void 0,!1)},void 0,!1),e[62]=D,e[63]=K,e[64]=A):A=e[64],A},"FileBrowserList"),St=[{label:"15m",seconds:900},{label:"1h",seconds:3600},{label:"24h",seconds:86400},{label:"7d",seconds:604800}],wt=3600,Ie=g((c,e)=>{if(e==="size")return c.size;if(e==="type")return c.httpMetadata?.contentType??"";if(e==="date"){if(c.uploaded===void 0)return 0;let s=new Date(c.uploaded).getTime();return Number.isNaN(s)?0:s}return e.startsWith("tag:")?c.customMetadata?.[e.slice(4)]??"":c.key},"fileSortValue"),Ct=g((c,e,s)=>{let t=s==="desc"?-1:1;return c.toSorted((n,o)=>{let u=Ie(n,e),a=Ie(o,e);return(typeof u=="number"&&typeof a=="number"?u-a:String(u).localeCompare(String(a)))*t})},"sortFiles"),Nt=g((c,e)=>{let s=new Set,t=[];for(let n of c){let o=n.key.slice(e.length),u=o.indexOf("/");u===-1?t.push(n):s.add(o.slice(0,u+1))}return{files:t,folders:[...s].toSorted((n,o)=>n.localeCompare(o))}},"deriveEntries"),Tt=g(c=>{let e=(0,j.c)(59),{bucket:s,buckets:t,busy:n,draftPrefix:o,expiry:u,fileInputRef:a,onBucketChange:r,onExpiryChange:d,onFileChange:h,onList:f,onPrefixChange:m,onUploadClick:S,t:i}=c,x;e[0]!==m?(x=g(G=>{m(G.target.value)},"t1"),e[0]=m,e[1]=x):x=e[1];let y=x,v;e[2]!==r?(v=g(G=>{r(G.target.value)},"t2"),e[2]=r,e[3]=v):v=e[3];let b=v,k;e[4]!==d?(k=g(G=>{d(Number.parseInt(G.target.value,10))},"t3"),e[4]=d,e[5]=k):k=e[5];let w=k,T;e[6]!==s||e[7]!==t||e[8]!==b||e[9]!==i?(T=t.length>0&&(0,l.jsxDEV)("select",{"aria-label":i("Bucket"),className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-bucket",onChange:b,value:s,children:t.map(Et)},void 0,!1),e[6]=s,e[7]=t,e[8]=b,e[9]=i,e[10]=T):T=e[10];let C;e[11]!==i?(C=i("Key prefix"),e[11]=i,e[12]=C):C=e[12];let N;e[13]!==i?(N=i("key prefix (optional)"),e[13]=i,e[14]=N):N=e[14];let E;e[15]!==o||e[16]!==y||e[17]!==C||e[18]!==N?(E=(0,l.jsxDEV)(Ne,{"aria-label":C,className:"h-8 w-64 max-w-full","data-testid":"fb-prefix-input",onChange:y,placeholder:N,value:o},void 0,!1),e[15]=o,e[16]=y,e[17]=C,e[18]=N,e[19]=E):E=e[19];let F;e[20]!==i?(F=i("List"),e[20]=i,e[21]=F):F=e[21];let R;e[22]!==n||e[23]!==f||e[24]!==F?(R=(0,l.jsxDEV)(se,{"data-testid":"fb-list",disabled:n,onClick:f,size:"sm",type:"button",children:F},void 0,!1),e[22]=n,e[23]=f,e[24]=F,e[25]=R):R=e[25];let D;e[26]!==n||e[27]!==i?(D=i(n?"Uploading\u2026":"Upload"),e[26]=n,e[27]=i,e[28]=D):D=e[28];let B;e[29]!==n||e[30]!==S||e[31]!==D?(B=(0,l.jsxDEV)(se,{"data-testid":"storage-upload",disabled:n,onClick:S,size:"sm",type:"button",variant:"outline",children:D},void 0,!1),e[29]=n,e[30]=S,e[31]=D,e[32]=B):B=e[32];let I;e[33]!==a||e[34]!==h?(I=(0,l.jsxDEV)("input",{className:"hidden","data-testid":"storage-file-input",onChange:h,ref:a,type:"file"},void 0,!1),e[33]=a,e[34]=h,e[35]=I):I=e[35];let K;e[36]!==i?(K=i("Link expiry"),e[36]=i,e[37]=K):K=e[37];let A;e[38]!==i?(A=St.map(G=>(0,l.jsxDEV)("option",{value:G.seconds,children:i(G.label)},G.seconds,!1)),e[38]=i,e[39]=A):A=e[39];let z;e[40]!==u||e[41]!==w||e[42]!==A?(z=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 tabular-nums outline-none focus-visible:border-ring","data-testid":"storage-expiry",id:"storage-expiry",onChange:w,value:u,children:A},void 0,!1),e[40]=u,e[41]=w,e[42]=A,e[43]=z):z=e[43];let L;e[44]!==K||e[45]!==z?(L=(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"storage-expiry",children:[K,z]},void 0,!0),e[44]=K,e[45]=z,e[46]=L):L=e[46];let U;e[47]!==i?(U=i("Open in Cloudflare"),e[47]=i,e[48]=U):U=e[48];let M;e[49]!==U?(M=(0,l.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"fb-cf-link",href:Be,rel:"noreferrer",target:"_blank",children:U},void 0,!1),e[49]=U,e[50]=M):M=e[50];let P;return e[51]!==B||e[52]!==I||e[53]!==L||e[54]!==M||e[55]!==T||e[56]!==E||e[57]!==R?(P=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[T,E,R,B,I,L,M]},void 0,!0),e[51]=B,e[52]=I,e[53]=L,e[54]=M,e[55]=T,e[56]=E,e[57]=R,e[58]=P):P=e[58],P},"FileBrowserToolbar"),_t=g(c=>{let e=(0,j.c)(66),{onSortKeyChange:s,onThumbSizeChange:t,showGrid:n,showList:o,sortDirection:u,sortKey:a,t:r,tagKeys:d,thumbSize:h,toggleSortDirection:f,view:m}=c,S;e[0]!==s?(S=g(W=>{s(W.target.value)},"t1"),e[0]=s,e[1]=S):S=e[1];let i=S,x;e[2]!==t?(x=g(W=>{t(Number.parseInt(W.target.value,10))},"t2"),e[2]=t,e[3]=x):x=e[3];let y=x,v=m==="list",b;e[4]!==r?(b=r("List"),e[4]=r,e[5]=b):b=e[5];let k;e[6]!==o||e[7]!==v||e[8]!==b?(k=(0,l.jsxDEV)("button",{"aria-pressed":v,className:"px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-list",onClick:o,type:"button",children:b},void 0,!1),e[6]=o,e[7]=v,e[8]=b,e[9]=k):k=e[9];let w=m==="grid",T;e[10]!==r?(T=r("Grid"),e[10]=r,e[11]=T):T=e[11];let C;e[12]!==n||e[13]!==w||e[14]!==T?(C=(0,l.jsxDEV)("button",{"aria-pressed":w,className:"border-s border-border px-2 py-1 outline-none transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-testid":"fb-view-grid",onClick:n,type:"button",children:T},void 0,!1),e[12]=n,e[13]=w,e[14]=T,e[15]=C):C=e[15];let N;e[16]!==k||e[17]!==C?(N=(0,l.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-md border border-border",children:[k,C]},void 0,!0),e[16]=k,e[17]=C,e[18]=N):N=e[18];let E;e[19]!==r?(E=r("Sort"),e[19]=r,e[20]=E):E=e[20];let F;e[21]!==r?(F=r("Name"),e[21]=r,e[22]=F):F=e[22];let R;e[23]!==F?(R=(0,l.jsxDEV)("option",{value:"name",children:F},void 0,!1),e[23]=F,e[24]=R):R=e[24];let D;e[25]!==r?(D=r("size"),e[25]=r,e[26]=D):D=e[26];let B;e[27]!==D?(B=(0,l.jsxDEV)("option",{value:"size",children:D},void 0,!1),e[27]=D,e[28]=B):B=e[28];let I;e[29]!==r?(I=r("Type"),e[29]=r,e[30]=I):I=e[30];let K;e[31]!==I?(K=(0,l.jsxDEV)("option",{value:"type",children:I},void 0,!1),e[31]=I,e[32]=K):K=e[32];let A;e[33]!==r?(A=r("Modified"),e[33]=r,e[34]=A):A=e[34];let z;e[35]!==A?(z=(0,l.jsxDEV)("option",{value:"date",children:A},void 0,!1),e[35]=A,e[36]=z):z=e[36];let L;e[37]!==d?(L=d.map($t),e[37]=d,e[38]=L):L=e[38];let U;e[39]!==i||e[40]!==a||e[41]!==R||e[42]!==B||e[43]!==K||e[44]!==z||e[45]!==L?(U=(0,l.jsxDEV)("select",{className:"h-8 rounded-md border border-border bg-background px-1 outline-none focus-visible:border-ring","data-testid":"fb-sort",id:"fb-sort",onChange:i,value:a,children:[R,B,K,z,L]},void 0,!0),e[39]=i,e[40]=a,e[41]=R,e[42]=B,e[43]=K,e[44]=z,e[45]=L,e[46]=U):U=e[46];let M;e[47]!==E||e[48]!==U?(M=(0,l.jsxDEV)("label",{className:"flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-sort",children:[E,U]},void 0,!0),e[47]=E,e[48]=U,e[49]=M):M=e[49];let P;e[50]!==r?(P=r("Toggle sort direction"),e[50]=r,e[51]=P):P=e[51];let G=u==="asc"?"\u2191":"\u2193",q;e[52]!==P||e[53]!==G||e[54]!==f?(q=(0,l.jsxDEV)("button",{"aria-label":P,className:"flex size-8 items-center justify-center rounded-md border border-border tabular-nums outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"fb-sort-dir",onClick:f,type:"button",children:G},void 0,!1),e[52]=P,e[53]=G,e[54]=f,e[55]=q):q=e[55];let Y;e[56]!==y||e[57]!==r||e[58]!==h||e[59]!==m?(Y=m==="grid"&&(0,l.jsxDEV)("label",{className:"ml-auto flex items-center gap-1.5 text-muted-foreground",htmlFor:"fb-thumb-size",children:[r("Thumbnail size"),(0,l.jsxDEV)("input",{className:"accent-primary","data-testid":"fb-thumb-size",id:"fb-thumb-size",max:240,min:80,onChange:y,step:8,type:"range",value:h},void 0,!1)]},void 0,!0),e[56]=y,e[57]=r,e[58]=h,e[59]=m,e[60]=Y):Y=e[60];let oe;return e[61]!==M||e[62]!==q||e[63]!==Y||e[64]!==N?(oe=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2 text-xs","data-testid":"fb-controls",children:[N,M,q,Y]},void 0,!0),e[61]=M,e[62]=q,e[63]=Y,e[64]=N,e[65]=oe):oe=e[65],oe},"FileBrowserControls");function Et(c){return(0,l.jsxDEV)("option",{value:c,children:c},c,!1)}g(Et,"_temp$1");function $t(c){return(0,l.jsxDEV)("option",{value:`tag:${c}`,children:c},c,!1)}g($t,"_temp2");var Ft=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,Dt=g(c=>(c.httpMetadata?.contentType??"").startsWith("image/")||Ft.test(c.key),"isImage"),Rt=g(()=>{let c=(0,j.c)(1),e;return c[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-8 text-muted-foreground/60",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm7 0v5h5"},void 0,!1)},void 0,!1),c[0]=e):e=c[0],e},"FileGlyph"),zt=g(c=>{let e=(0,j.c)(13),{object:s,resolveUrl:t}=c,[n,o]=(0,_.useState)(null),[u,a]=(0,_.useState)(!1),r;e[0]!==s?(r=Dt(s),e[0]=s,e[1]=r):r=e[1];let d=r,h,f;e[2]!==d||e[3]!==s.key||e[4]!==t?(h=g(()=>{if(!d)return;let x={cancelled:!1};return H((async()=>{try{let y=await t(s.key);x.cancelled||o(y)}catch{x.cancelled||a(!0)}})()),()=>{x.cancelled=!0}},"t2"),f=[d,s.key,t],e[2]=d,e[3]=s.key,e[4]=t,e[5]=h,e[6]=f):(h=e[5],f=e[6]),(0,_.useEffect)(h,f);let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=g(()=>{a(!0)},"t4"),e[7]=m):m=e[7];let S=m,i;return e[8]!==u||e[9]!==d||e[10]!==s.key||e[11]!==n?(i=(0,l.jsxDEV)("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:d&&n!==null&&!u?(0,l.jsxDEV)("img",{alt:s.key,className:"size-full object-cover",loading:"lazy",onError:S,src:n},void 0,!1):(0,l.jsxDEV)(Rt,{},void 0,!1)},void 0,!1),e[8]=u,e[9]=d,e[10]=s.key,e[11]=n,e[12]=i):i=e[12],i},"Thumbnail"),Kt=g(c=>{let e=(0,j.c)(38),{busy:s,copiedKey:t,handlers:n,object:o,prefix:u,references:a,resolveUrl:r,selected:d,showReferences:h,t:f}=c,{copy:m,download:S,name:i,remove:x,toggle:y}=je(o,u,n),v;e[0]!==o||e[1]!==r?(v=(0,l.jsxDEV)(zt,{object:o,resolveUrl:r},void 0,!1),e[0]=o,e[1]=r,e[2]=v):v=e[2];let b;e[3]!==o.key||e[4]!==d||e[5]!==f||e[6]!==y?(b=(0,l.jsxDEV)("span",{className:"absolute left-1.5 top-1.5 rounded bg-background/80 p-0.5",children:(0,l.jsxDEV)(Ge,{objectKey:o.key,onToggle:y,selected:d,t:f},void 0,!1)},void 0,!1),e[3]=o.key,e[4]=d,e[5]=f,e[6]=y,e[7]=b):b=e[7];let k;e[8]!==v||e[9]!==b?(k=(0,l.jsxDEV)("div",{className:"relative",children:[v,b]},void 0,!0),e[8]=v,e[9]=b,e[10]=k):k=e[10];let w;e[11]!==i?(w=(0,l.jsxDEV)("p",{className:"truncate font-mono text-xs",title:i,children:i},void 0,!1),e[11]=i,e[12]=w):w=e[12];let T;e[13]!==o.size?(T=ve(o.size),e[13]=o.size,e[14]=T):T=e[14];let C;e[15]!==T?(C=(0,l.jsxDEV)("p",{className:"text-[11px] tabular-nums text-muted-foreground",children:T},void 0,!1),e[15]=T,e[16]=C):C=e[16];let N;e[17]!==o.key||e[18]!==a||e[19]!==h||e[20]!==f?(N=h&&(0,l.jsxDEV)("div",{className:"mt-1",children:(0,l.jsxDEV)(Me,{objectKey:o.key,references:a,t:f},void 0,!1)},void 0,!1),e[17]=o.key,e[18]=a,e[19]=h,e[20]=f,e[21]=N):N=e[21];let E;e[22]!==w||e[23]!==C||e[24]!==N?(E=(0,l.jsxDEV)("div",{className:"min-w-0",children:[w,C,N]},void 0,!0),e[22]=w,e[23]=C,e[24]=N,e[25]=E):E=e[25];let F=t===o.key,R;e[26]!==s||e[27]!==m||e[28]!==S||e[29]!==o.key||e[30]!==x||e[31]!==f||e[32]!==F?(R=(0,l.jsxDEV)("div",{className:"flex items-center gap-1",children:(0,l.jsxDEV)(Ue,{busy:s,buttonClassName:"h-7 px-2 text-xs",copied:F,objectKey:o.key,onCopy:m,onDelete:x,onDownload:S,t:f},void 0,!1)},void 0,!1),e[26]=s,e[27]=m,e[28]=S,e[29]=o.key,e[30]=x,e[31]=f,e[32]=F,e[33]=R):R=e[33];let D;return e[34]!==R||e[35]!==k||e[36]!==E?(D=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1.5","data-testid":"fb-tile",children:[k,E,R]},void 0,!0),e[34]=R,e[35]=k,e[36]=E,e[37]=D):D=e[37],D},"GalleryTile"),Lt=g(c=>{let e=(0,j.c)(9),{name:s,onEnter:t}=c,n;e[0]!==s||e[1]!==t?(n=g(()=>{t(s)},"t1"),e[0]=s,e[1]=t,e[2]=n):n=e[2];let o=n,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=(0,l.jsxDEV)("span",{className:"flex aspect-square w-full items-center justify-center rounded-md border border-border bg-muted/30 transition-colors hover:bg-accent",children:(0,l.jsxDEV)("svg",{"aria-hidden":"true",className:"size-10 text-muted-foreground",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.4,viewBox:"0 0 24 24",children:(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1)},void 0,!1)},void 0,!1),e[3]=u):u=e[3];let a;e[4]!==s?(a=(0,l.jsxDEV)("span",{className:"truncate font-mono text-xs",title:s,children:s},void 0,!1),e[4]=s,e[5]=a):a=e[5];let r;return e[6]!==o||e[7]!==a?(r=(0,l.jsxDEV)("button",{className:"flex flex-col gap-1.5 text-left outline-none","data-testid":"fb-folder",onClick:o,type:"button",children:[u,a]},void 0,!0),e[6]=o,e[7]=a,e[8]=r):r=e[8],r},"FolderTile"),Bt=g(c=>{let e=(0,j.c)(34),{busy:s,copiedKey:t,files:n,folders:o,handlers:u,onEnterFolder:a,prefix:r,references:d,resolveUrl:h,selected:f,showReferences:m,size:S,t:i}=c,x;e[0]!==S?(x=S.toString(),e[0]=S,e[1]=x):x=e[1];let y=`repeat(auto-fill, minmax(${x}px, 1fr))`,v;e[2]!==y?(v={gridTemplateColumns:y},e[2]=y,e[3]=v):v=e[3];let b=v,k;if(e[4]!==o||e[5]!==a){let C;e[7]!==a?(C=g(N=>(0,l.jsxDEV)(Lt,{name:N,onEnter:a},N,!1),"t52"),e[7]=a,e[8]=C):C=e[8],k=o.map(C),e[4]=o,e[5]=a,e[6]=k}else k=e[6];let w;if(e[9]!==s||e[10]!==t||e[11]!==n||e[12]!==u||e[13]!==r||e[14]!==d||e[15]!==h||e[16]!==f||e[17]!==m||e[18]!==i){let C;e[20]!==s||e[21]!==t||e[22]!==u||e[23]!==r||e[24]!==d||e[25]!==h||e[26]!==f||e[27]!==m||e[28]!==i?(C=g(N=>(0,l.jsxDEV)(Kt,{busy:s,copiedKey:t,handlers:u,object:N,prefix:r,references:d[N.key],resolveUrl:h,selected:f.has(N.key),showReferences:m,t:i},N.key,!1),"t62"),e[20]=s,e[21]=t,e[22]=u,e[23]=r,e[24]=d,e[25]=h,e[26]=f,e[27]=m,e[28]=i,e[29]=C):C=e[29],w=n.map(C),e[9]=s,e[10]=t,e[11]=n,e[12]=u,e[13]=r,e[14]=d,e[15]=h,e[16]=f,e[17]=m,e[18]=i,e[19]=w}else w=e[19];let T;return e[30]!==b||e[31]!==k||e[32]!==w?(T=(0,l.jsxDEV)("div",{className:"grid gap-4","data-testid":"fb-gallery",style:b,children:[k,w]},void 0,!0),e[30]=b,e[31]=k,e[32]=w,e[33]=T):T=e[33],T},"FileGallery"),It=g(c=>{let e=(0,j.c)(23),{reference:s,t}=c,n=`fb-dangling-${s.table}-${s.id}-${s.column}`,o=`${s.table}\xB7${s.id}`,u;e[0]!==o?(u=(0,l.jsxDEV)(ie,{variant:"secondary",children:o},void 0,!1),e[0]=o,e[1]=u):u=e[1];let a;e[2]!==s.column?(a=(0,l.jsxDEV)("span",{className:"text-muted-foreground",children:s.column},void 0,!1),e[2]=s.column,e[3]=a):a=e[3];let r;e[4]!==t?(r=t("\u2192"),e[4]=t,e[5]=r):r=e[5];let d;e[6]!==r?(d=(0,l.jsxDEV)("span",{className:"text-muted-foreground/60",children:r},void 0,!1),e[6]=r,e[7]=d):d=e[7];let h;e[8]!==s.key?(h=(0,l.jsxDEV)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:s.key},void 0,!1),e[8]=s.key,e[9]=h):h=e[9];let f;e[10]!==u||e[11]!==a||e[12]!==d||e[13]!==h?(f=(0,l.jsxDEV)("span",{className:"flex flex-wrap items-center gap-1.5",children:[u,a,d,h]},void 0,!0),e[10]=u,e[11]=a,e[12]=d,e[13]=h,e[14]=f):f=e[14];let m;e[15]!==t?(m=t("Missing object"),e[15]=t,e[16]=m):m=e[16];let S;e[17]!==m?(S=(0,l.jsxDEV)(ie,{className:"border-destructive/40 text-destructive",variant:"outline",children:m},void 0,!1),e[17]=m,e[18]=S):S=e[18];let i;return e[19]!==n||e[20]!==S||e[21]!==f?(i=(0,l.jsxDEV)("li",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-border/60 px-3 py-2 text-xs","data-testid":n,children:[f,S]},void 0,!0),e[19]=n,e[20]=S,e[21]=f,e[22]=i):i=e[22],i},"DanglingRow"),Ot=g(c=>{let e=(0,j.c)(37),{busy:s,onCheck:t,references:n,t:o,truncated:u}=c,a;e[0]!==o?(a=o("Integrity"),e[0]=o,e[1]=a):a=e[1];let r;e[2]!==a?(r=(0,l.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:a},void 0,!1),e[2]=a,e[3]=r):r=e[3];let d;e[4]!==o?(d=o("Orphaned objects"),e[4]=o,e[5]=d):d=e[5];let h;e[6]!==d?(h=(0,l.jsxDEV)("span",{className:"text-sm font-medium text-foreground",children:d},void 0,!1),e[6]=d,e[7]=h):h=e[7];let f;e[8]!==o?(f=o("Find records whose file reference points at an object the bucket no longer has."),e[8]=o,e[9]=f):f=e[9];let m;e[10]!==f?(m=(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:f},void 0,!1),e[10]=f,e[11]=m):m=e[11];let S;e[12]!==r||e[13]!==h||e[14]!==m?(S=(0,l.jsxDEV)("div",{className:"flex flex-col gap-1",children:[r,h,m]},void 0,!0),e[12]=r,e[13]=h,e[14]=m,e[15]=S):S=e[15];let i;e[16]!==s||e[17]!==o?(i=o(s?"Checking\u2026":"Check for orphans"),e[16]=s,e[17]=o,e[18]=i):i=e[18];let x;e[19]!==s||e[20]!==t||e[21]!==i?(x=(0,l.jsxDEV)(se,{"data-testid":"fb-orphans-check",disabled:s,onClick:t,size:"sm",type:"button",variant:"outline",children:i},void 0,!1),e[19]=s,e[20]=t,e[21]=i,e[22]=x):x=e[22];let y;e[23]!==S||e[24]!==x?(y=(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[S,x]},void 0,!0),e[23]=S,e[24]=x,e[25]=y):y=e[25];let v;e[26]!==n?.length||e[27]!==o?(v=n?.length===0&&(0,l.jsxDEV)(me,{description:o("Every record's file reference points at an object that exists in the bucket."),testId:"fb-orphans-empty",title:o("No dangling references.")},void 0,!1),e[26]=n?.length,e[27]=o,e[28]=v):v=e[28];let b;e[29]!==n||e[30]!==o||e[31]!==u?(b=n!==void 0&&n.length>0&&(0,l.jsxDEV)(l.Fragment,{children:[u&&(0,l.jsxDEV)("p",{className:"text-xs text-warning","data-testid":"fb-orphans-truncated",children:o("Showing the first {count} dangling references \u2014 the scan was truncated.",{count:n.length})},void 0,!1),(0,l.jsxDEV)("ul",{className:"flex flex-col gap-1.5","data-testid":"fb-orphans-list",children:n.map(w=>(0,l.jsxDEV)(It,{reference:w,t:o},`${w.table}\xB7${w.id}\xB7${w.column}`,!1))},void 0,!1)]},void 0,!0),e[29]=n,e[30]=o,e[31]=u,e[32]=b):b=e[32];let k;return e[33]!==y||e[34]!==v||e[35]!==b?(k=(0,l.jsxDEV)("section",{className:"flex flex-col gap-2 rounded-lg border border-border/60 p-3","data-testid":"fb-orphans",children:[y,v,b]},void 0,!0),e[33]=y,e[34]=v,e[35]=b,e[36]=k):k=e[36],k},"OrphanedObjectsSection"),At=g(function(c,e){let s=(0,j.c)(18),t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,s[0]=t):t=s[0];let[n,o]=(0,_.useState)(t),u;s[1]===Symbol.for("react.memo_cache_sentinel")?(u=g(v=>{o(b=>{let k=new Set(b);return k.has(v)?k.delete(v):k.add(v),k})},"t1"),s[1]=u):u=s[1];let a=u,r;s[2]===Symbol.for("react.memo_cache_sentinel")?(r=g(()=>{o(new Set)},"t2"),s[2]=r):r=s[2];let d=r,h,f,m;if(s[3]!==c||s[4]!==e||s[5]!==n){let v;s[9]!==e?(v=g(b=>e(b),"t42"),s[9]=e,s[10]=v):v=s[10],f=c.map(v),h=f.length>0&&f.every(b=>n.has(b)),m=!h&&f.some(b=>n.has(b)),s[3]=c,s[4]=e,s[5]=n,s[6]=h,s[7]=f,s[8]=m}else h=s[6],f=s[7],m=s[8];let S=m,i;s[11]!==f?(i=g(()=>{o(v=>f.every(b=>v.has(b))?new Set:new Set(f))},"t4"),s[11]=f,s[12]=i):i=s[12];let x=i,y;return s[13]!==h||s[14]!==n||s[15]!==S||s[16]!==x?(y={allSelected:h,clear:d,selected:n,someSelected:S,toggle:a,toggleAll:x},s[13]=h,s[14]=n,s[15]=S,s[16]=x,s[17]=y):y=s[17],y},"useKeySelection"),jt=ge(be.storageReferences),Ut=ge(be.storageOrphans),Oe=1e4,Mt=1e3,Gt=3600,Ht=g((c,e)=>{if(!("document"in globalThis))return;let s=globalThis.document.createElement("a");s.href=c,s.download=e,s.rel="noopener",globalThis.document.body.append(s),s.click(),s.remove()},"triggerDownload"),Pt=g(({initialPrefix:c,pageSize:e})=>{let s=we(),[t,n]=(0,_.useState)(c??""),[o,u]=(0,_.useState)(c??""),[a,r]=(0,_.useState)(wt),[d,h]=(0,_.useState)("list"),[f,m]=(0,_.useState)(128),[S,i]=(0,_.useState)("name"),[x,y]=(0,_.useState)("asc"),[v,b]=(0,_.useState)(void 0),[k,w]=(0,_.useState)(void 0),[T,C]=(0,_.useState)(!1),[N,E]=(0,_.useState)(void 0),[F,R]=(0,_.useState)(void 0),[D,B]=(0,_.useState)(""),[I,K]=(0,_.useState)({}),[A,z]=(0,_.useState)(!1),[L,U]=(0,_.useState)(void 0),[M,P]=(0,_.useState)(!1),[G,q]=(0,_.useState)(!1),[Y,oe]=(0,_.useState)([]),[W,xe]=(0,_.useState)(""),re=(0,_.useRef)(0),J=(0,_.useRef)(0);(0,_.useEffect)(()=>{let p={cancelled:!1};return H((async()=>{try{let $=await s.listStorageBuckets();if(!p.cancelled){oe($);let[O]=$;O!==void 0&&xe(te=>te===""?O:te)}}catch{}})()),()=>{p.cancelled=!0}},[s]);let Z=(0,_.useMemo)(()=>({list:g(p=>s.listStorageObjects({...p,bucket:W}),"list"),remove:g(p=>s.deleteStorageObject(p,{bucket:W}),"remove"),signedUrl:g((p,$)=>s.signedStorageUrl(p,{...$,bucket:W}),"signedUrl"),upload:g(p=>s.uploadStorageObject({...p,bucket:W}),"upload")}),[W,s]),X=(0,_.useCallback)(async(p,$,O)=>{re.current+=1;let te=re.current;w(void 0),C(!0);try{let V=await Z.list({cursor:$,limit:e,prefix:p});if(te!==re.current)return;b(ce=>O&&ce!==void 0?[...ce,...V.objects]:V.objects),R(V.cursor)}catch(V){if(te!==re.current)return;O||b(void 0),w(Q(V))}finally{te===re.current&&C(!1)}},[e,Z]);(0,_.useEffect)(()=>{H(X(c??"",void 0,!1))},[X,c]);let He=(v?.length??0)<=e;Ke(()=>{H(X(t,void 0,!1))},He);let{files:fe,folders:Pe}=Nt(v??[],t),qe=(0,_.useMemo)(()=>{let p=new Set;for(let $ of fe)for(let O of Object.keys($.customMetadata??{}))p.add(O);return[...p].toSorted(($,O)=>$.localeCompare(O))},[fe]),ae=Ct(fe,S,x),ue=(0,_.useMemo)(()=>[...new Set(ae.map(p=>p.key))].toSorted((p,$)=>p.localeCompare($)).join(`
3
+ `),[ae]);(0,_.useEffect)(()=>{let p=ue===""?[]:ue.split(`
4
+ `);if(p.length===0){K({});return}let $={current:!0};return H((async()=>{try{let O=await s.query(jt,{keys:p},pe(D));$.current&&(K(O.references??{}),z(Object.keys(O.storageColumns??{}).length>0))}catch{$.current&&(K({}),z(!1))}})()),()=>{$.current=!1}},[s,ue,D]);let Ve=g(p=>p.key,"keyOf"),{allSelected:We,clear:ne,selected:ke,someSelected:Ze,toggle:Xe,toggleAll:Ye}=At(ae,Ve),Je=g(()=>{n(o),ne(),H(X(o,void 0,!1))},"listFirst"),Qe=g(()=>{H(X(t,F,!0))},"loadMore"),Se=g(p=>{n(p),u(p),ne(),H(X(p,void 0,!1))},"navigate"),et=g(p=>{Se(`${t}${p}`)},"enterFolder"),tt=g(p=>Z.signedUrl(p,{expiresInSeconds:Gt}),"resolveUrl"),st=g(()=>{h("list")},"showList"),lt=g(()=>{h("grid")},"showGrid"),ot=g(p=>{i(p)},"onSortKeyChange"),rt=g(()=>{y(p=>p==="asc"?"desc":"asc")},"toggleSortDirection"),nt=g(p=>{m(p)},"onThumbSizeChange"),it=g(p=>{r(p)},"onExpiryChange"),at=g(()=>{w(void 0),C(!0),H((async()=>{try{for(let p of ke)await Z.remove(p);await X(t,void 0,!1),ne()}catch(p){w(Q(p))}finally{C(!1)}})())},"bulkDelete"),ct=g(p=>{w(void 0),H((async()=>{try{let $=await Z.signedUrl(p,{expiresInSeconds:a});Ee($)&&E(p)}catch($){w(Q($))}})())},"onCopy"),dt=g(p=>{w(void 0),H((async()=>{try{let $=await Z.signedUrl(p,{expiresInSeconds:a}),O=p.slice(p.lastIndexOf("/")+1)||p;Ht($,O)}catch($){w(Q($))}})())},"onDownload");(0,_.useEffect)(()=>{if(N===void 0)return;let p=globalThis.setTimeout(()=>{E(void 0)},2e3);return()=>{globalThis.clearTimeout(p)}},[N]);let ft=g(p=>{w(void 0),C(!0),H((async()=>{try{await Z.remove(p),await X(t,void 0,!1)}catch($){w(Q($))}finally{C(!1)}})())},"onDelete"),ut=g(p=>{let $=`${t}${p.name}`;w(void 0),C(!0),H((async()=>{try{let O=await p.arrayBuffer();await Z.upload({body:O,contentType:p.type===""?void 0:p.type,key:$}),await X(t,void 0,!1)}catch(O){w(Q(O))}finally{C(!1)}})())},"onFile");(0,_.useEffect)(()=>{J.current+=1,U(void 0),q(!1)},[D]);let ht=g(()=>{J.current+=1;let p=J.current;w(void 0),P(!0),H((async()=>{try{let $=[],O;do{let V=await Z.list({cursor:O,limit:Mt});for(let ce of V.objects)$.push(ce.key);O=$.length>=Oe?void 0:V.cursor}while(O!==void 0);if($.length>=Oe)p===J.current&&(U([]),q(!0));else{let V=await s.query(Ut,{liveKeys:$},pe(D));p===J.current&&(U(V.references??[]),q(V.truncated===!0))}}catch($){p===J.current&&(U([]),q(!1),w(Q($)))}finally{p===J.current&&P(!1)}})())},"checkOrphans"),mt=g(p=>{re.current+=1,J.current+=1,xe(p),n(c??""),u(c??""),b(void 0),U(void 0),q(!1),ne()},"selectBucket");return{allSelected:We,bucket:W,buckets:Y,bulkDelete:at,busy:T,checkOrphans:ht,clearSelection:ne,copiedKey:N,danglingBusy:M,danglingReferences:L,danglingTruncated:G,draftPrefix:o,enterFolder:et,error:k,expiry:a,files:ae,folders:Pe,hasObjects:v!==void 0&&v.length>0,hasStorageColumns:A,listFirst:Je,loaded:v!==void 0,loadMore:Qe,navigate:Se,nextCursor:F,onCopy:ct,onDelete:ft,onDownload:dt,onExpiryChange:it,onFile:ut,onSortKeyChange:ot,onThumbSizeChange:nt,prefix:t,referenceShard:D,references:I,resolveUrl:tt,selectBucket:mt,selected:ke,setDraftPrefix:u,setReferenceShard:B,showGrid:lt,showList:st,someSelected:Ze,sortDirection:x,sortKey:S,tagKeys:qe,thumbSize:f,toggleSelect:Xe,toggleSelectAll:Ye,toggleSortDirection:rt,view:d}},"useFileBrowser"),qt=100,Ae=g(c=>{let e=(0,j.c)(6),{label:s,onNavigate:t,target:n}=c,o;e[0]!==t||e[1]!==n?(o=g(()=>{t(n)},"t1"),e[0]=t,e[1]=n,e[2]=o):o=e[2];let u=o,a;return e[3]!==u||e[4]!==s?(a=(0,l.jsxDEV)("button",{className:"rounded px-1 text-muted-foreground outline-none hover:text-foreground focus-visible:text-foreground",onClick:u,type:"button",children:s},void 0,!1),e[3]=u,e[4]=s,e[5]=a):a=e[5],a},"Crumb"),Vt=g(c=>{let e=(0,j.c)(11),{onNavigate:s,prefix:t,t:n}=c,o;if(e[0]!==s||e[1]!==t||e[2]!==n){let u=t.split("/").filter(Wt),a;e[4]!==n?(a=n("Folder path"),e[4]=n,e[5]=a):a=e[5];let r;e[6]!==n?(r=n("root"),e[6]=n,e[7]=r):r=e[7];let d;e[8]!==s||e[9]!==r?(d=(0,l.jsxDEV)(Ae,{label:r,onNavigate:s,target:""},void 0,!1),e[8]=s,e[9]=r,e[10]=d):d=e[10],o=(0,l.jsxDEV)("nav",{"aria-label":a,className:"flex flex-wrap items-center gap-0.5 text-xs","data-testid":"fb-breadcrumbs",children:[d,u.map((h,f)=>(0,l.jsxDEV)("span",{className:"flex items-center gap-0.5",children:[(0,l.jsxDEV)("span",{className:"text-muted-foreground/50",children:"/"},void 0,!1),(0,l.jsxDEV)(Ae,{label:h,onNavigate:s,target:`${u.slice(0,f+1).join("/")}/`},void 0,!1)]},`${h}-${f.toString()}`,!0))]},void 0,!0),e[0]=s,e[1]=t,e[2]=n,e[3]=o}else o=e[3];return o},"Breadcrumbs"),fs=g(({initialPrefix:c,pageSize:e=qt})=>{let s=Ce(),t=Pt({initialPrefix:c,pageSize:e}),n=(0,_.useRef)(null),{onCopy:o,onDelete:u,onDownload:a,onFile:r,toggleSelect:d}=t,h={onCopy:o,onDelete:u,onDownload:a,onToggleSelect:d},f=g(()=>{n.current?.click()},"onUploadClick"),m=g(i=>{let x=i.target,y=x.files?.[0];x.value="",y&&r(y)},"onFileChange"),S=t.loaded&&!t.hasObjects;return(0,l.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-file-browser",children:[(0,l.jsxDEV)(Tt,{bucket:t.bucket,buckets:t.buckets,busy:t.busy,draftPrefix:t.draftPrefix,expiry:t.expiry,fileInputRef:n,onBucketChange:t.selectBucket,onExpiryChange:t.onExpiryChange,onFileChange:m,onList:t.listFirst,onPrefixChange:t.setDraftPrefix,onUploadClick:f,t:s},void 0,!1),t.loaded&&(0,l.jsxDEV)(Vt,{onNavigate:t.navigate,prefix:t.prefix,t:s},void 0,!1),t.hasObjects&&(0,l.jsxDEV)(_t,{onSortKeyChange:t.onSortKeyChange,onThumbSizeChange:t.onThumbSizeChange,showGrid:t.showGrid,showList:t.showList,sortDirection:t.sortDirection,sortKey:t.sortKey,t:s,tagKeys:t.tagKeys,thumbSize:t.thumbSize,toggleSortDirection:t.toggleSortDirection,view:t.view},void 0,!1),t.hasStorageColumns&&(0,l.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"fb-references-shard",children:[(0,l.jsxDEV)("label",{className:"text-xs text-muted-foreground",htmlFor:"fb-reference-shard-input",children:s("References shard")},void 0,!1),(0,l.jsxDEV)($e,{id:"fb-reference-shard-input",onChange:t.setReferenceShard,testId:"fb-reference-shard-input",value:t.referenceShard},void 0,!1),(0,l.jsxDEV)("span",{className:"text-xs text-muted-foreground",children:s("Which shard's records are checked for references to these files. Empty = root shard.")},void 0,!1)]},void 0,!0),t.hasStorageColumns&&(0,l.jsxDEV)(Ot,{busy:t.danglingBusy,onCheck:t.checkOrphans,references:t.danglingReferences,t:s,truncated:t.danglingTruncated},void 0,!1),t.selected.size>0&&(0,l.jsxDEV)(Le,{count:t.selected.size,editable:!0,onClear:t.clearSelection,onDelete:t.bulkDelete},void 0,!1),t.error!==void 0&&(0,l.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"storage-error",role:"alert",children:t.error},void 0,!1),S&&(0,l.jsxDEV)(me,{description:s("Objects you upload to your R2 buckets will appear here."),icon:(0,l.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,l.jsxDEV)("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"},void 0,!1),(0,l.jsxDEV)("path",{d:"M12 11v5m-2.5-2.5h5"},void 0,!1)]},void 0,!0),testId:"fb-empty",title:s("No objects.")},void 0,!1),t.hasObjects&&t.view==="list"&&(0,l.jsxDEV)(kt,{allSelected:t.allSelected,busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,selected:t.selected,showReferences:t.hasStorageColumns,someSelected:t.someSelected,t:s,toggleSelectAll:t.toggleSelectAll},void 0,!1),t.hasObjects&&t.view==="grid"&&(0,l.jsxDEV)(Bt,{busy:t.busy,copiedKey:t.copiedKey,files:t.files,folders:t.folders,handlers:h,onEnterFolder:t.enterFolder,prefix:t.prefix,references:t.references,resolveUrl:t.resolveUrl,selected:t.selected,showReferences:t.hasStorageColumns,size:t.thumbSize,t:s},void 0,!1),t.nextCursor!==void 0&&(0,l.jsxDEV)("div",{children:(0,l.jsxDEV)(se,{"data-testid":"fb-next",disabled:t.busy,onClick:t.loadMore,size:"sm",type:"button",variant:"outline",children:s("Load more")},void 0,!1)},void 0,!1)]},void 0,!0)},"FileBrowser");function Wt(c){return c!==""}g(Wt,"_temp");export{fs as FileBrowser};
@@ -0,0 +1 @@
1
+ import{a as o,e as n,f as u,g as b,h as p,j as s}from"./chunk-RRCPZMC2.js";var l=n(b(),1),f=n(u(),1);var c=n(p(),1);function m(d){let i=(0,l.c)(8),e,r;i[0]!==d?({className:e,...r}=d,i[0]=d,i[1]=e,i[2]=r):(e=i[1],r=i[2]);let t;i[3]!==e?(t=s("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-xs transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 md:text-xs dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),i[3]=e,i[4]=t):t=i[4];let a;return i[5]!==r||i[6]!==t?(a=(0,c.jsxDEV)("textarea",{"data-slot":"textarea",className:t,...r},void 0,!1),i[5]=r,i[6]=t,i[7]=a):a=i[7],a}o(m,"Textarea");export{m as a};
@@ -0,0 +1 @@
1
+ import{b as $}from"./chunk-TQ36RWOP.js";import{a as M}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as H}from"./chunk-RXVQJ4DO.js";import{a as P,b as Q,c as W,d as V,e as C,f as E}from"./chunk-GTM65MVX.js";import{a as K,e as O}from"./chunk-SEU5V7I6.js";import{b as F}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as j}from"./chunk-G7ZBM54M.js";import"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as B}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as U,e as L,f as G,g as J,h as X}from"./chunk-RRCPZMC2.js";var q=L(J(),1),te=L(G(),1);var r=L(X(),1);var Y={binding:"outline",secret:"destructive",var:"secondary"},me=U(a=>{let e=(0,q.c)(68),{initialShardKey:z}=a,t=B(),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N={},e[0]=N):N=e[0];let R=z??"",T;e[1]!==R?(T={shardKey:R},e[1]=R,e[2]=T):T=e[2];let{data:k,error:d,errorSource:S,isLoading:A}=H(j.getSettings,N,T),D;e:{let s=k?.deploy;if(s===void 0){let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3],D=l;break e}let o;if(e[4]!==s.deploymentId||e[5]!==s.environment||e[6]!==s.versionTag||e[7]!==s.workerUrl||e[8]!==t){if(o=[],s.workerUrl!==void 0){let l;e[10]!==t?(l=t("URL"),e[10]=t,e[11]=l):l=e[11];let i;e[12]!==s.workerUrl||e[13]!==l?(i={label:l,value:s.workerUrl},e[12]=s.workerUrl,e[13]=l,e[14]=i):i=e[14],o.push(i)}if(s.environment!==void 0){let l;e[15]!==t?(l=t("Environment"),e[15]=t,e[16]=l):l=e[16];let i;e[17]!==s.environment||e[18]!==l?(i={label:l,value:s.environment},e[17]=s.environment,e[18]=l,e[19]=i):i=e[19],o.push(i)}if(s.deploymentId!==void 0){let l;e[20]!==t?(l=t("Deployment"),e[20]=t,e[21]=l):l=e[21];let i;e[22]!==s.deploymentId||e[23]!==l?(i={label:l,value:s.deploymentId},e[22]=s.deploymentId,e[23]=l,e[24]=i):i=e[24],o.push(i)}if(s.versionTag!==void 0){let l;e[25]!==t?(l=t("Version"),e[25]=t,e[26]=l):l=e[26];let i;e[27]!==s.versionTag||e[28]!==l?(i={label:l,value:s.versionTag},e[27]=s.versionTag,e[28]=l,e[29]=i):i=e[29],o.push(i)}e[4]=s.deploymentId,e[5]=s.environment,e[6]=s.versionTag,e[7]=s.workerUrl,e[8]=t,e[9]=o}else o=e[9];D=o}let w=D,_;e[30]!==k?.settings?(_=k?.settings??[],e[30]=k?.settings,e[31]=_):_=e[31];let n=_,m;e[32]!==t?(m=t("Open in Cloudflare"),e[32]=t,e[33]=m):m=e[33];let f;e[34]!==m?(f=(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"set-cf-link",href:$,rel:"noreferrer",target:"_blank",children:m},void 0,!1)},void 0,!1),e[34]=m,e[35]=f):f=e[35];let c;e[36]!==t?(c=t("View-only \u2014 values are masked. Edit vars, secrets, and bindings in wrangler or the Cloudflare dashboard."),e[36]=t,e[37]=c):c=e[37];let v;e[38]!==c?(v=(0,r.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"set-readonly-note",children:c},void 0,!1),e[38]=c,e[39]=v):v=e[39];let p;e[40]!==d||e[41]!==S?(p=d!==null&&(0,r.jsxDEV)(M,{error:S,testId:"set-error"},void 0,!1),e[40]=d,e[41]=S,e[42]=p):p=e[42];let u;e[43]!==w||e[44]!==t?(u=w.length>0&&(0,r.jsxDEV)(K,{className:"py-0","data-testid":"set-deploy",children:[(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Deployment")},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{className:"py-3",children:(0,r.jsxDEV)("dl",{className:"grid grid-cols-[8rem_minmax(0,1fr)] gap-x-4 gap-y-1 text-sm",children:w.map(Z)},void 0,!1)},void 0,!1)]},void 0,!0),e[43]=w,e[44]=t,e[45]=u):u=e[45];let h;e[46]!==t?(h=t("Environment & bindings"),e[46]=t,e[47]=h):h=e[47];let g;e[48]!==h?(g=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h},void 0,!1)},void 0,!1),e[48]=h,e[49]=g):g=e[49];let x;e[50]!==d||e[51]!==A||e[52]!==n.length||e[53]!==t?(x=d===null&&!A&&n.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"set-empty",children:t("No environment variables or bindings.")},void 0,!1),e[50]=d,e[51]=A,e[52]=n.length,e[53]=t,e[54]=x):x=e[54];let b;e[55]!==n||e[56]!==t?(b=n.length>0&&(0,r.jsxDEV)(O,{className:"px-0 py-0",children:(0,r.jsxDEV)(P,{"data-testid":"set-table",children:[(0,r.jsxDEV)(Q,{children:(0,r.jsxDEV)(V,{children:[(0,r.jsxDEV)(C,{children:t("name")},void 0,!1),(0,r.jsxDEV)(C,{children:t("kind")},void 0,!1),(0,r.jsxDEV)(C,{children:t("value")},void 0,!1)]},void 0,!0)},void 0,!1),(0,r.jsxDEV)(W,{children:n.map(ee)},void 0,!1)]},void 0,!0)},void 0,!1),e[55]=n,e[56]=t,e[57]=b):b=e[57];let y;e[58]!==g||e[59]!==x||e[60]!==b?(y=(0,r.jsxDEV)(K,{className:"py-0",children:[g,x,b]},void 0,!0),e[58]=g,e[59]=x,e[60]=b,e[61]=y):y=e[61];let I;return e[62]!==p||e[63]!==u||e[64]!==y||e[65]!==f||e[66]!==v?(I=(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-settings",children:[f,v,p,u,y]},void 0,!0),e[62]=p,e[63]=u,e[64]=y,e[65]=f,e[66]=v,e[67]=I):I=e[67],I},"SettingsPanel");function Z(a){return(0,r.jsxDEV)("div",{className:"contents","data-testid":"set-deploy-row",children:[(0,r.jsxDEV)("dt",{className:"text-muted-foreground",children:a.label},void 0,!1),(0,r.jsxDEV)("dd",{className:"truncate font-mono text-xs",title:a.value,children:a.value},void 0,!1)]},a.label,!0)}U(Z,"_temp");function ee(a){return(0,r.jsxDEV)(V,{"data-testid":"set-row",children:[(0,r.jsxDEV)(E,{className:"font-mono text-xs font-medium",children:a.name},void 0,!1),(0,r.jsxDEV)(E,{children:(0,r.jsxDEV)(F,{variant:Y[a.kind],children:a.bindingType??a.kind},void 0,!1)},void 0,!1),(0,r.jsxDEV)(E,{className:"max-w-[28ch] truncate font-mono text-xs text-muted-foreground",children:a.value??(0,r.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1)},void 0,!1)]},a.name,!0)}U(ee,"_temp2");export{me as SettingsPanel};
@@ -0,0 +1 @@
1
+ import{a as H}from"./chunk-J6J54MBP.js";import{a as E}from"./chunk-RXVQJ4DO.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{a as C,e as k}from"./chunk-SEU5V7I6.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-CKSHCYGC.js";import{f as A}from"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as w}from"./chunk-TAD43CG5.js";import{d as g,l as I,p as B}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as m,e as T,g as j,h as z}from"./chunk-RRCPZMC2.js";var Q=T(j(),1);var t=T(z(),1);var L=200,K=m(()=>{let e=(0,Q.c)(21),d=A(),s=g(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",L],e[0]=u):u=e[0];let h;e[1]!==d?(h=m(()=>d.listAuthSessions({limit:L}),"t1"),e[1]=d,e[2]=h):h=e[2];let l=E(u,h),{error:v}=l,i=l.data?.rows??null,p;e[3]!==l?(p=m(()=>{l.refetch()},"t2"),e[3]=l,e[4]=p):p=e[4],H(p,!0);let x;e[5]!==d||e[6]!==l?(x=m(a=>{I((async()=>{await d.revokeAuthSession({sessionId:a}),l.refetch()})())},"t3"),e[5]=d,e[6]=l,e[7]=x):x=e[7];let y=x,n;e[8]!==v?(n=v!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:v},void 0,!1),e[8]=v,e[9]=n):n=e[9];let c;e[10]!==i||e[11]!==s?(c=i!==null&&i.length===0&&(0,t.jsxDEV)(w,{testId:"auth-sessions-empty",title:s("No active sessions.")},void 0,!1),e[10]=i,e[11]=s,e[12]=c):c=e[12];let f;e[13]!==y||e[14]!==i||e[15]!==s?(f=i!==null&&i.length>0&&(0,t.jsxDEV)(C,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(k,{className:"px-0",children:(0,t.jsxDEV)(R,{"data-testid":"auth-sessions-table",children:[(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(N,{children:[(0,t.jsxDEV)(o,{children:s("user")},void 0,!1),(0,t.jsxDEV)(o,{children:s("expires")},void 0,!1),(0,t.jsxDEV)(o,{children:s("ip")},void 0,!1),(0,t.jsxDEV)(o,{children:s("user agent")},void 0,!1),(0,t.jsxDEV)(o,{children:s("impersonated by")},void 0,!1),(0,t.jsxDEV)(o,{"aria-label":s("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($,{children:i.map(a=>(0,t.jsxDEV)(N,{"data-testid":`auth-session-${a.id}`,children:[(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.userId},void 0,!1),(0,t.jsxDEV)(r,{className:"text-muted-foreground tabular-nums",children:B(a.expiresAt)},void 0,!1),(0,t.jsxDEV)(r,{children:a.ipAddress??""},void 0,!1),(0,t.jsxDEV)(r,{className:"max-w-40 truncate",children:a.userAgent??""},void 0,!1),(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.impersonatedBy??""},void 0,!1),(0,t.jsxDEV)(r,{children:(0,t.jsxDEV)(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:m(()=>{y(a.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")},void 0,!1)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[13]=y,e[14]=i,e[15]=s,e[16]=f):f=e[16];let b;return e[17]!==n||e[18]!==c||e[19]!==f?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[n,c,f]},void 0,!0),e[17]=n,e[18]=c,e[19]=f,e[20]=b):b=e[20],b},"AuthSessionsPanel");export{K as AuthSessionsPanel};
@@ -0,0 +1 @@
1
+ import{a as k,b as N,c as O,d as x,e as q,f as D}from"./chunk-GTM65MVX.js";import{a as g}from"./chunk-SEU5V7I6.js";import{a as C}from"./chunk-TAD43CG5.js";import{d as T,h as I,k as _,l as w}from"./chunk-ITQKVEP7.js";import{b as L}from"./chunk-22C6COGE.js";import{a as d,e as b,f as U,g as Y,h as F}from"./chunk-RRCPZMC2.js";var M=b(Y(),1);var H="https://api.cloudflare.com/client/v4/accounts",E=class extends L{static{d(this,"AnalyticsSqlError")}constructor(e,f){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(e)}: ${f}`,{name:"AnalyticsSqlError",status:e})}},v=d(t=>{let e=t.fetch??globalThis.fetch,f=`${H}/${encodeURIComponent(t.accountId)}/analytics_engine/sql`;return{query:d(async s=>{let l=await e(f,{body:s,headers:{Authorization:`Bearer ${t.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new E(l.status,await l.text());let n;try{n=await l.json()}catch{throw new E(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let o=n,a=o.data??[];return{columns:o.meta??[],rowCount:o.rows??a.length,rows:a}},"query")}},"createAnalyticsSqlClient");var m=b(U(),1);var r=b(F(),1);var W="ANALYTICS",P=[{key:"volume",sql:d(t=>`SELECT blob2 AS fn, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:d(t=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${t} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:d(t=>`SELECT blob3 AS shard, count() AS calls FROM ${t} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],j={error:null,loading:!0,result:null},G=d(t=>{let e=(0,M.c)(27),{state:f,title:p}=t,s=T(),{error:l,loading:n,result:o}=f,a=`analytics-panel-${p}`,i;e[0]!==s||e[1]!==p?(i=s(p),e[0]=s,e[1]=p,e[2]=i):i=e[2];let c;e[3]!==i?(c=(0,r.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1)},void 0,!1),e[3]=i,e[4]=c):c=e[4];let u;e[5]!==n||e[6]!==s?(u=n&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:s("Loading\u2026")},void 0,!1),e[5]=n,e[6]=s,e[7]=u):u=e[7];let y;e[8]!==l||e[9]!==n?(y=!n&&l!==null&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:l},void 0,!1),e[8]=l,e[9]=n,e[10]=y):y=e[10];let h;e[11]!==l||e[12]!==n||e[13]!==o||e[14]!==s?(h=!n&&l===null&&o!==null&&o.rows.length===0&&(0,r.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:s("No data points yet.")},void 0,!1),e[11]=l,e[12]=n,e[13]=o,e[14]=s,e[15]=h):h=e[15];let A;e[16]!==l||e[17]!==n||e[18]!==o?(A=!n&&l===null&&o!==null&&o.rows.length>0&&(0,r.jsxDEV)(k,{children:[(0,r.jsxDEV)(N,{children:(0,r.jsxDEV)(x,{children:o.columns.map(Q)},void 0,!1)},void 0,!1),(0,r.jsxDEV)(O,{children:o.rows.map((B,$)=>(0,r.jsxDEV)(x,{children:o.columns.map(R=>(0,r.jsxDEV)(D,{className:"font-mono text-xs",children:_(B[R.name])},R.name,!1))},$,!1))},void 0,!1)]},void 0,!0),e[16]=l,e[17]=n,e[18]=o,e[19]=A):A=e[19];let S;return e[20]!==a||e[21]!==c||e[22]!==u||e[23]!==y||e[24]!==h||e[25]!==A?(S=(0,r.jsxDEV)(g,{className:"gap-0 py-0","data-testid":a,children:[c,u,y,h,A]},void 0,!0),e[20]=a,e[21]=c,e[22]=u,e[23]=y,e[24]=h,e[25]=A,e[26]=S):S=e[26],S},"PanelResult"),re=d(({config:t,dataset:e=W,runQuery:f}={})=>{let p=T(),[s,l]=(0,m.useState)({}),n=(0,m.useMemo)(()=>{if(f!==void 0)return f;if(t===void 0)return null;let a=v({accountId:t.accountId,apiToken:t.apiToken});return i=>a.query(i)},[t,f]),o=(0,m.useCallback)(async a=>{if(n!==null)for(let i of P){if(a.cancelled)return;l(c=>({...c,[i.key]:{error:null,loading:!0,result:null}}));try{let c=await n(i.sql(e));a.cancelled||l(u=>({...u,[i.key]:{error:null,loading:!1,result:c}}))}catch(c){a.cancelled||l(u=>({...u,[i.key]:{error:I(c),loading:!1,result:null}}))}}},[n,e]);return(0,m.useEffect)(()=>{let a={cancelled:!1};return w(o(a)),()=>{a.cancelled=!0}},[o]),n===null?(0,r.jsxDEV)(C,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"},void 0,!1)},void 0,!1),testId:"analytics-not-configured",title:p("Analytics is not configured.")},void 0,!1):(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:P.map(a=>(0,r.jsxDEV)(G,{state:s[a.key]??j,title:a.title},a.key,!1))},void 0,!1)},"AnalyticsPanel");function Q(t){return(0,r.jsxDEV)(q,{children:t.name},t.name,!1)}d(Q,"_temp");export{re as AnalyticsPanel};
@@ -0,0 +1 @@
1
+ import{b as ws}from"./chunk-KEGAWN6Y.js";import{a as xs}from"./chunk-HV7G6DFP.js";import{a as rt}from"./chunk-3OA7PECS.js";import{a as i,e as k,f as j}from"./chunk-RRCPZMC2.js";var Yo=k(j(),1),le=Yo.createContext(null);var Xo=k(j(),1);function D(t){let o=Xo.useContext(le);return(t?.warn??!0)&&!o&&console.warn("Warning: useRouter must be used inside a <RouterProvider> component!"),o}i(D,"useRouter");var Ke=k(j(),1),Mt=Ke.createContext(void 0),Zo=Ke.createContext(void 0);function pt(t){return t[t.length-1]}i(pt,"last");function _s(t){return typeof t=="function"}i(_s,"isFunction");function Y(t,o){return _s(t)?t(o):t}i(Y,"functionalUpdate");var rr=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;function mt(t){for(let o in t)if(rr.call(t,o))return!0;return!1}i(mt,"hasKeys");var Cs=i(()=>Object.create(null),"createNull"),gt=i((t,o)=>at(t,o,Cs),"nullReplaceEqualDeep");function at(t,o,e=()=>({}),s=0){if(!1)return o;if(t===o)return t;if(s>500)return o;let r=o,n=qe(t)&&qe(r);if(!n&&!(Xt(t)&&Xt(r)))return r;let a=n?t:tr(t);if(!a)return r;let f=n?r:tr(r);if(!f)return r;let u=a.length,d=f.length,l=n?new Array(d):e(),c=0;for(let p=0;p<d;p++){let h=n?p:f[p],m=t[h],y=r[h];if(m===y){l[h]=m,(n?p<u:rr.call(t,h))&&c++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){l[h]=y;continue}let g=at(m,y,e,s+1);l[h]=g,g===m&&c++}return u===d&&c===u?t:l}i(at,"replaceEqualDeep");function tr(t){let o=Object.getOwnPropertyNames(t);for(let r of o)if(!Qo.call(t,r))return!1;let e=Object.getOwnPropertySymbols(t);if(e.length===0)return o;let s=o;for(let r of e){if(!Qo.call(t,r))return!1;s.push(r)}return s}i(tr,"getEnumerableOwnKeys");function Xt(t){if(!er(t))return!1;let o=t.constructor;if(typeof o>"u")return!0;let e=o.prototype;return!(!er(e)||!e.hasOwnProperty("isPrototypeOf"))}i(Xt,"isPlainObject");function er(t){return Object.prototype.toString.call(t)==="[object Object]"}i(er,"hasObjectPrototype");function qe(t){return Array.isArray(t)&&t.length===Object.keys(t).length}i(qe,"isPlainArray");function st(t,o,e){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(Array.isArray(t)&&Array.isArray(o)){if(t.length!==o.length)return!1;for(let s=0,r=t.length;s<r;s++)if(!st(t[s],o[s],e))return!1;return!0}if(Xt(t)&&Xt(o)){let s=e?.ignoreUndefined??!0;if(e?.partial){for(let a in o)if((!s||o[a]!==void 0)&&!st(t[a],o[a],e))return!1;return!0}let r=0;if(!s)r=Object.keys(t).length;else for(let a in t)t[a]!==void 0&&r++;let n=0;for(let a in o)if((!s||o[a]!==void 0)&&(n++,n>r||!st(t[a],o[a],e)))return!1;return r===n}return!1}i(st,"deepEqual");function ct(t){let o,e,s=new Promise((r,n)=>{o=r,e=n});return s.status="pending",s.resolve=r=>{s.status="resolved",s.value=r,o(r),t?.(r)},s.reject=r=>{s.status="rejected",e(r)},s}i(ct,"createControlledPromise");function vt(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}i(vt,"isPromise");function Ge(t,o){for(let e=t.length-1;e>=0;e--){let s=t[e];if(o(s))return s}}i(Ge,"findLast");var bs=/[\x00-\x1f\x7f"<>`{}]/g;function Ls(t){return t.replace(bs,o=>"%"+o.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}i(Ls,"sanitizePathSegment");function or(t){let o;try{o=decodeURI(t)}catch{o=t.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ls(o)}i(or,"decodeSegment");var Je=["http:","https:","mailto:","tel:"];function ut(t,o){if(!t)return!1;try{let e=new URL(t);return!o.has(e.protocol)}catch{return!1}}i(ut,"isDangerousProtocol");function Bt(t){if(!t)return{path:t,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(t)&&!t.startsWith("//"))return{path:t,handledProtocolRelativeURL:!1};let o=/%25|%5C/gi,e=0,s="",r;for(;(r=o.exec(t))!==null;)s+=or(t.slice(e,r.index))+r[0],e=o.lastIndex;s=s+or(e?t.slice(e):t);let n=!1;return s.startsWith("//")&&(n=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:n}}i(Bt,"decodePath");function sr(t){return/\s|[^\u0000-\u007F]/.test(t)?t.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):t}i(sr,"encodePathLikeUrl");function nr(t,o){if(t===o)return!0;if(t.length!==o.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==o[e])return!1;return!0}i(nr,"arraysEqual");function $(){throw new Error("Invariant failed")}i($,"invariant");function yt(t){let o=new Map,e,s,r=i(n=>{n.next&&(n.prev?(n.prev.next=n.next,n.next.prev=n.prev,n.next=void 0,s&&(s.next=n,n.prev=s)):(n.next.prev=void 0,e=n.next,n.next=void 0,s&&(n.prev=s,s.next=n)),s=n)},"touch");return{get(n){let a=o.get(n);if(a)return r(a),a.value},set(n,a){if(o.size>=t&&e){let u=e;o.delete(u.key),u.next&&(e=u.next,u.next.prev=void 0),u===s&&(s=void 0)}let f=o.get(n);if(f)f.value=a,r(f);else{let u={key:n,value:a,prev:s};s&&(s.next=u),s=u,e||(e=u),o.set(n,u)}},clear(){o.clear(),e=void 0,s=void 0}}}i(yt,"createLRUCache");var St=4,ar=5;function Ms(t){let o=t.indexOf("{");if(o===-1)return null;let e=t.indexOf("}",o);return e===-1||o+1>=t.length?null:[o,e]}i(Ms,"getOpenAndCloseBraces");function Ze(t,o,e=new Uint16Array(6)){let s=t.indexOf("/",o),r=s===-1?t.length:s,n=t.substring(o,r);if(!n||!n.includes("$"))return e[0]=0,e[1]=o,e[2]=o,e[3]=r,e[4]=r,e[5]=r,e;if(n==="$"){let f=t.length;return e[0]=2,e[1]=o,e[2]=o,e[3]=f,e[4]=f,e[5]=f,e}if(n.charCodeAt(0)===36)return e[0]=1,e[1]=o,e[2]=o+1,e[3]=r,e[4]=r,e[5]=r,e;let a=Ms(n);if(a){let[f,u]=a,d=n.charCodeAt(f+1);if(d===45){if(f+2<n.length&&n.charCodeAt(f+2)===36){let l=f+3,c=u;if(l<c)return e[0]=3,e[1]=o+f,e[2]=o+l,e[3]=o+c,e[4]=o+u+1,e[5]=r,e}}else if(d===36){let l=f+1,c=f+2;return c===u?(e[0]=2,e[1]=o+f,e[2]=o+l,e[3]=o+c,e[4]=o+u+1,e[5]=t.length,e):(e[0]=1,e[1]=o+f,e[2]=o+c,e[3]=o+u,e[4]=o+u+1,e[5]=r,e)}}return e[0]=0,e[1]=o,e[2]=o,e[3]=r,e[4]=r,e[5]=r,e}i(Ze,"parseSegment");function he(t,o,e,s,r,n,a){a?.(e);let f=s;{let u=e.fullPath??e.from,d=u.length,l=e.options?.caseSensitive??t,c=e.options?.params?.parse??e.options?.parseParams;for(;f<d;){let h=Ze(u,f,o),m,y=f,g=h[5];switch(f=g+1,n++,h[0]){case 0:{let v=u.substring(h[2],h[3]);if(l){let R=r.static?.get(v);if(R)m=R;else{r.static??=new Map;let S=It(e.fullPath??e.from);S.parent=r,S.depth=n,m=S,r.static.set(v,S)}}else{let R=v.toLowerCase(),S=r.staticInsensitive?.get(R);if(S)m=S;else{r.staticInsensitive??=new Map;let P=It(e.fullPath??e.from);P.parent=r,P.depth=n,m=P,r.staticInsensitive.set(R,P)}}break}case 1:{let v=u.substring(y,h[1]),R=u.substring(h[4],g),S=l&&!!(v||R),P=v?S?v:v.toLowerCase():void 0,_=R?S?R:R.toLowerCase():void 0,b=!c&&r.dynamic?.find(x=>!x.parse&&x.caseSensitive===S&&x.prefix===P&&x.suffix===_);if(b)m=b;else{let x=Xe(1,e.fullPath??e.from,S,P,_);m=x,x.depth=n,x.parent=r,r.dynamic??=[],r.dynamic.push(x)}break}case 3:{let v=u.substring(y,h[1]),R=u.substring(h[4],g),S=l&&!!(v||R),P=v?S?v:v.toLowerCase():void 0,_=R?S?R:R.toLowerCase():void 0,b=!c&&r.optional?.find(x=>!x.parse&&x.caseSensitive===S&&x.prefix===P&&x.suffix===_);if(b)m=b;else{let x=Xe(3,e.fullPath??e.from,S,P,_);m=x,x.parent=r,x.depth=n,r.optional??=[],r.optional.push(x)}break}case 2:{let v=u.substring(y,h[1]),R=u.substring(h[4],g),S=l&&!!(v||R),P=v?S?v:v.toLowerCase():void 0,_=R?S?R:R.toLowerCase():void 0,b=Xe(2,e.fullPath??e.from,S,P,_);m=b,b.parent=r,b.depth=n,r.wildcard??=[],r.wildcard.push(b)}}r=m}if(c&&e.children&&!e.isRoot&&e.id&&e.id.charCodeAt(e.id.lastIndexOf("/")+1)===95){let h=It(e.fullPath??e.from);h.kind=ar,h.parent=r,n++,h.depth=n,r.pathless??=[],r.pathless.push(h),r=h}let p=(e.path||!e.children)&&!e.isRoot;if(p&&u.endsWith("/")){let h=It(e.fullPath??e.from);h.kind=St,h.parent=r,n++,h.depth=n,r.index=h,r=h}r.parse=c??null,r.priority=e.options?.params?.priority??0,p&&!r.route&&(r.route=e,r.fullPath=e.fullPath??e.from)}if(e.children)for(let u of e.children)he(t,o,u,f,r,n,a)}i(he,"parseSegments");function Ye(t,o){if(t.parse&&!o.parse)return-1;if(!t.parse&&o.parse)return 1;if(t.parse&&o.parse&&(t.priority||o.priority))return o.priority-t.priority;if(t.prefix&&o.prefix&&t.prefix!==o.prefix){if(t.prefix.startsWith(o.prefix))return-1;if(o.prefix.startsWith(t.prefix))return 1}if(t.suffix&&o.suffix&&t.suffix!==o.suffix){if(t.suffix.endsWith(o.suffix))return-1;if(o.suffix.endsWith(t.suffix))return 1}return t.prefix&&!o.prefix?-1:!t.prefix&&o.prefix?1:t.suffix&&!o.suffix?-1:!t.suffix&&o.suffix?1:t.caseSensitive&&!o.caseSensitive?-1:!t.caseSensitive&&o.caseSensitive?1:0}i(Ye,"sortDynamic");function Rt(t){if(t.pathless)for(let o of t.pathless)Rt(o);if(t.static)for(let o of t.static.values())Rt(o);if(t.staticInsensitive)for(let o of t.staticInsensitive.values())Rt(o);if(t.dynamic?.length){t.dynamic.sort(Ye);for(let o of t.dynamic)Rt(o)}if(t.optional?.length){t.optional.sort(Ye);for(let o of t.optional)Rt(o)}if(t.wildcard?.length){t.wildcard.sort(Ye);for(let o of t.wildcard)Rt(o)}}i(Rt,"sortTreeNodes");function It(t){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0}}i(It,"createStaticNode");function Xe(t,o,e,s,r){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:o,parent:null,parse:null,priority:0,caseSensitive:e,prefix:s,suffix:r}}i(Xe,"createDynamicNode");function cr(t,o){let e=It("/"),s=new Uint16Array(6);for(let r of t)he(!1,s,r,1,e,0);Rt(e),o.masksTree=e,o.flatCache=yt(1e3)}i(cr,"processRouteMasks");function ur(t,o){t||="/";let e=o.flatCache.get(t);if(e)return e;let s=Qe(t,o.masksTree);return o.flatCache.set(t,s),s}i(ur,"findFlatMatch");function lr(t,o,e,s,r){t||="/",s||="/";let n=o?`case\0${t}`:t,a=r.singleCache.get(n);return a||(a=It("/"),he(o,new Uint16Array(6),{from:t},1,a,0),r.singleCache.set(n,a)),Qe(s,a,e)}i(lr,"findSingleMatch");function fr(t,o,e=!1){let s=e?t:`nofuzz\0${t}`,r=o.matchCache.get(s);if(r!==void 0)return r;t||="/";let n;try{n=Qe(t,o.segmentTree,e)}catch(a){if(a instanceof URIError)n=null;else throw a}return n&&(n.branch=to(n.route)),o.matchCache.set(s,n),n}i(fr,"findRouteMatch");function Is(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}i(Is,"trimPathRight");function dr(t,o=!1,e){let s=It(t.fullPath),r=new Uint16Array(6),n={},a={},f=0;return he(o,r,t,1,s,0,u=>{if(e?.(u,f),u.id in n)throw new Error(`Invariant failed: Duplicate routes found with id: ${String(u.id)}`);if(n[u.id]=u,f!==0&&u.path){let d=Is(u.fullPath);(!a[d]||u.fullPath.endsWith("/"))&&(a[d]=u)}f++}),Rt(s),{processedTree:{segmentTree:s,singleCache:yt(1e3),matchCache:yt(1e3),flatCache:null,masksTree:null},routesById:n,routesByPath:a}}i(dr,"processRouteTree");function Qe(t,o,e=!1){let s=t.split("/"),r=ks(t,s,o,e);if(!r)return null;let[n]=hr(t,s,r);return{route:r.node.route,rawParams:n}}i(Qe,"findMatch");function hr(t,o,e){let s=Es(e.node),r=null,n=Object.create(null),a=e.extract?.part??0,f=e.extract?.node??0,u=e.extract?.path??0,d=e.extract?.segment??0;for(;f<s.length;a++,f++,u++,d++){let l=s[f];if(l.kind===St)break;if(l.kind===ar){d--,a--,u--;continue}let c=o[a],p=u;if(c&&(u+=c.length),l.kind===1){r??=e.node.fullPath.split("/");let h=r[d],m=l.prefix?.length??0;if(h.charCodeAt(m)===123){let y=l.suffix?.length??0,g=h.substring(m+2,h.length-y-1),v=c.substring(m,c.length-y);n[g]=decodeURIComponent(v)}else{let y=h.substring(1);n[y]=decodeURIComponent(c)}}else if(l.kind===3){if(e.skipped&1<<f){a--,u=p-1;continue}r??=e.node.fullPath.split("/");let h=r[d],m=l.prefix?.length??0,y=l.suffix?.length??0,g=h.substring(m+3,h.length-y-1),v=l.suffix||l.prefix?c.substring(m,c.length-y):c;v&&(n[g]=decodeURIComponent(v))}else if(l.kind===2){let h=l,m=t.substring(p+(h.prefix?.length??0),t.length-(h.suffix?.length??0)),y=decodeURIComponent(m);n["*"]=y,n._splat=y;break}}return e.rawParams&&Object.assign(n,e.rawParams),[n,{part:a,node:f,path:u,segment:d}]}i(hr,"extractParams");function to(t){let o=[t];for(;t.parentRoute;)t=t.parentRoute,o.push(t);return o.reverse(),o}i(to,"buildRouteBranch");function Es(t){let o=Array(t.depth+1);do o[t.depth]=t,t=t.parent;while(t);return o}i(Es,"buildBranch");function ks(t,o,e,s){if(t==="/"&&e.index)return{node:e.index,skipped:0};let r=!pt(o),n=r&&t!=="/",a=o.length-(r?1:0),f=[{node:e,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],u=null,d=null;for(;f.length;){let l=f.pop(),{node:c,index:p,skipped:h,depth:m,statics:y,dynamics:g,optionals:v}=l,{extract:R,rawParams:S}=l;if(c.kind===2&&c.route&&!de(d,l))continue;if(c.parse){if(!ir(t,o,l))continue;S=l.rawParams,R=l.extract}s&&c.route&&c.kind!==St&&de(u,l)&&(u=l);let P=p===a;if(P&&(c.route&&(!n||c.kind===St||c.kind===2)&&de(d,l)&&(d=l),!c.optional&&!c.wildcard&&!c.index&&!c.pathless))continue;let _=P?void 0:o[p],b;if(P&&c.index){let x={node:c.index,index:p,skipped:h,depth:m+1,statics:y,dynamics:g,optionals:v,extract:R,rawParams:S},w=!0;if(c.index.parse&&(ir(t,o,x)||(w=!1)),w){if(!g&&!v&&!h&&Ts(y,a))return x;de(d,x)&&(d=x)}}if(c.wildcard)for(let x=c.wildcard.length-1;x>=0;x--){let w=c.wildcard[x],{prefix:C,suffix:I}=w;if(!(C&&(P||!(w.caseSensitive?_:b??=_.toLowerCase()).startsWith(C)))){if(I){if(P)continue;let L=o.slice(p).join("/").slice(-I.length);if((w.caseSensitive?L:L.toLowerCase())!==I)continue}f.push({node:w,index:a,skipped:h,depth:m+1,statics:y,dynamics:g,optionals:v,extract:R,rawParams:S})}}if(c.optional){let x=h|1<<m,w=m+1;for(let C=c.optional.length-1;C>=0;C--){let I=c.optional[C];f.push({node:I,index:p,skipped:x,depth:w,statics:y,dynamics:g,optionals:v,extract:R,rawParams:S})}if(!P)for(let C=c.optional.length-1;C>=0;C--){let I=c.optional[C],{prefix:L,suffix:M}=I;if(L||M){let et=I.caseSensitive?_:b??=_.toLowerCase();if(L&&!et.startsWith(L)||M&&!et.endsWith(M))continue}f.push({node:I,index:p+1,skipped:h,depth:w,statics:y,dynamics:g,optionals:v+fe(a,p),extract:R,rawParams:S})}}if(!P&&c.dynamic&&_)for(let x=c.dynamic.length-1;x>=0;x--){let w=c.dynamic[x],{prefix:C,suffix:I}=w;if(C||I){let L=w.caseSensitive?_:b??=_.toLowerCase();if(C&&!L.startsWith(C)||I&&!L.endsWith(I))continue}f.push({node:w,index:p+1,skipped:h,depth:m+1,statics:y,dynamics:g+fe(a,p),optionals:v,extract:R,rawParams:S})}if(!P&&c.staticInsensitive){let x=c.staticInsensitive.get(b??=_.toLowerCase());x&&f.push({node:x,index:p+1,skipped:h,depth:m+1,statics:y+fe(a,p),dynamics:g,optionals:v,extract:R,rawParams:S})}if(!P&&c.static){let x=c.static.get(_);x&&f.push({node:x,index:p+1,skipped:h,depth:m+1,statics:y+fe(a,p),dynamics:g,optionals:v,extract:R,rawParams:S})}if(c.pathless){let x=m+1;for(let w=c.pathless.length-1;w>=0;w--){let C=c.pathless[w];f.push({node:C,index:p,skipped:h,depth:x,statics:y,dynamics:g,optionals:v,extract:R,rawParams:S})}}}if(d)return d;if(s&&u){let l=u.index;for(let p=0;p<u.index;p++)l+=o[p].length;let c=l===t.length?"/":t.slice(l);return u.rawParams??=Object.create(null),u.rawParams["**"]=decodeURIComponent(c),u}return null}i(ks,"getNodeMatch");function fe(t,o){return 2**(t-o-1)}i(fe,"segmentScore");function Ts(t,o){return t===2**(o-1)-1}i(Ts,"isPerfectStaticMatch");function ir(t,o,e){let s,r;try{[s,r]=hr(t,o,e)}catch{return null}if(e.rawParams=s,e.extract=r,!e.node.parse)return!0;try{if(e.node.parse(s)===!1)return null}catch{}return!0}i(ir,"validateParseParams");function de(t,o){return t?o.statics>t.statics||o.statics===t.statics&&(o.dynamics>t.dynamics||o.dynamics===t.dynamics&&(o.optionals>t.optionals||o.optionals===t.optionals&&((o.node.kind===St)>(t.node.kind===St)||o.node.kind===St==(t.node.kind===St)&&o.depth>t.depth))):!0}i(de,"isFrameMoreSpecific");function Et(t){return Qt(t.filter(o=>o!==void 0).join("/"))}i(Et,"joinPaths");function Qt(t){return t.replace(/\/{2,}/g,"/")}i(Qt,"cleanPath");function pe(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}i(pe,"trimPathLeft");function Q(t){let o=t.length;return o>1&&t[o-1]==="/"?t.replace(/\/{1,}$/,""):t}i(Q,"trimPathRight");function te(t){return Q(pe(t))}i(te,"trimPath");function Pt(t,o){return t?.endsWith("/")&&t!=="/"&&t!==`${o}/`?t.slice(0,-1):t}i(Pt,"removeTrailingSlash");function me(t,o,e){return Pt(t,e)===Pt(o,e)}i(me,"exactPathTest");function eo({base:t,to:o,trailingSlash:e="never",cache:s}){let r=o.startsWith("/"),n=!r&&o===".",a;if(s){a=r?o:n?t:t+"\0"+o;let d=s.get(a);if(d)return d}let f;if(n)f=t.split("/");else if(r)f=o.split("/");else{for(f=t.split("/");f.length>1&&pt(f)==="";)f.pop();let d=o.split("/");for(let l=0,c=d.length;l<c;l++){let p=d[l];p===""?l?l===c-1&&f.push(p):f=[p]:p===".."?f.pop():p==="."||f.push(p)}}f.length>1&&(pt(f)===""?e==="never"&&f.pop():e==="always"&&f.push(""));let u=Qt(f.join("/"))||"/";return a&&s&&s.set(a,u),u}i(eo,"resolvePath");function mr(t){let o=new Map(t.map(r=>[encodeURIComponent(r),r])),e=Array.from(o.keys()).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(e,"g");return r=>r.replace(s,n=>o.get(n)??n)}i(mr,"compileDecodeCharMap");function Zt(t,o,e){let s=o[t];return typeof s!="string"?s:t==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(r=>pr(r,e)).join("/"):pr(s,e)}i(Zt,"encodeParam");function ge({path:t,params:o,decoder:e,...s}){let r=!1,n=Object.create(null);if(!t||t==="/")return{interpolatedPath:"/",usedParams:n,isMissingParams:r};if(!t.includes("$"))return{interpolatedPath:t,usedParams:n,isMissingParams:r};if(!1){let l=t.length,c=0,p="";for(;c<l;){for(;c<l&&t.charCodeAt(c)===47;)c++;if(c>=l)break;let h=c,m=t.indexOf("/",c);m===-1&&(m=l),c=m;let y=t.substring(h,m);if(y)if(y.charCodeAt(0)===36)if(y.length===1){let g=o._splat;if(n._splat=g,n["*"]=g,!g){r=!0;continue}let v=Zt("_splat",o,e);p+="/"+v}else{let g=y.substring(1);!r&&!(g in o)&&(r=!0),n[g]=o[g];let v=Zt(g,o,e)??"undefined";p+="/"+v}else p+="/"+y}return t.endsWith("/")&&(p+="/"),{usedParams:n,interpolatedPath:p||"/",isMissingParams:r}}let a=t.length,f=0,u,d="";for(;f<a;){let l=f;u=Ze(t,l,u);let c=u[5];if(f=c+1,l===c)continue;let p=u[0];if(p===0){d+="/"+t.substring(l,c);continue}if(p===2){let h=o._splat;n._splat=h,n["*"]=h;let m=t.substring(l,u[1]),y=t.substring(u[4],c);if(!h){r=!0,(m||y)&&(d+="/"+m+y);continue}let g=Zt("_splat",o,e);d+="/"+m+g+y;continue}if(p===1){let h=t.substring(u[2],u[3]);!r&&!(h in o)&&(r=!0),n[h]=o[h];let m=t.substring(l,u[1]),y=t.substring(u[4],c),g=Zt(h,o,e)??"undefined";d+="/"+m+g+y;continue}if(p===3){let h=t.substring(u[2],u[3]),m=o[h];if(m==null)continue;n[h]=m;let y=t.substring(l,u[1]),g=t.substring(u[4],c),v=Zt(h,o,e)??"";d+="/"+y+v+g;continue}}return t.endsWith("/")&&(d+="/"),{usedParams:n,interpolatedPath:d||"/",isMissingParams:r}}i(ge,"interpolatePath");function pr(t,o){let e=encodeURIComponent(t);return o?.(e)??e}i(pr,"encodePathParam");function A(t){return t?.isNotFound===!0}i(A,"isNotFound");function gr(t,o=String){let e=new URLSearchParams;for(let s in t){let r=t[s];r!==void 0&&e.set(s,o(r))}return e.toString()}i(gr,"encode");function oo(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}i(oo,"toValue");function vr(t){let o=new URLSearchParams(t),e=Object.create(null);for(let[s,r]of o.entries()){let n=e[s];n==null?e[s]=oo(r):Array.isArray(n)?n.push(oo(r)):e[s]=[n,oo(r)]}return e}i(vr,"decode");var yr=Os(JSON.parse),Rr=Ns(JSON.stringify,JSON.parse);function Os(t){return o=>{o[0]==="?"&&(o=o.substring(1));let e=vr(o);for(let s in e){let r=e[s];if(typeof r=="string")try{e[s]=t(r)}catch{}}return e}}i(Os,"parseSearchWith");function Ns(t,o){let e=typeof o=="function";function s(r){if(typeof r=="object"&&r!==null)try{return t(r)}catch{}else if(e&&typeof r=="string")try{return o(r),t(r)}catch{}return r}return i(s,"stringifyValue"),r=>{let n=gr(r,s);return n?`?${n}`:""}}i(Ns,"stringifySearchWith");var X="__root__";function $t(t){if(t.statusCode=t.statusCode||t.code||307,!t._builtLocation&&!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}let o=new Headers(t.headers);t.href&&o.get("Location")===null&&o.set("Location",t.href);let e=new Response(null,{status:t.statusCode,headers:o});if(e.options=t,t.throw)throw e;return e}i($t,"redirect");function H(t){return t instanceof Response&&!!t.options}i(H,"isRedirect");var ro=i(t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},"triggerOnReady"),Ds=i(t=>t.stores.matchesId.get().some(o=>t.stores.matchStores.get(o)?.get()._forcePending),"hasForcePendingActiveMatch"),Re=i((t,o)=>!!(t.preload&&!t.router.stores.matchStores.has(o)),"resolvePreload"),kt=i((t,o,e=!0)=>{let s={...t.router.options.context??{}},r=e?o:o-1;for(let n=0;n<=r;n++){let a=t.matches[n];if(!a)continue;let f=t.router.getMatch(a.id);f&&Object.assign(s,f.__routeContext,f.__beforeLoadContext)}return s},"buildMatchContext"),Sr=i((t,o)=>{if(!t.matches.length)return;let e=o.routeId,s=t.matches.findIndex(a=>a.routeId===t.router.routeTree.id),r=s>=0?s:0,n=e?t.matches.findIndex(a=>a.routeId===e):t.firstBadMatchIndex??t.matches.length-1;n<0&&(n=r);for(let a=n;a>=0;a--){let f=t.matches[a];if(t.router.looseRoutesById[f.routeId].options.notFoundComponent)return a}return e?n:r},"getNotFoundBoundaryIndex"),xt=i((t,o,e)=>{if(!(!H(e)&&!A(e)))throw H(e)&&e.redirectHandled&&!e.options.reloadDocument||(o&&(o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.loaderPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,o._nonReactive.loaderPromise=void 0,o._nonReactive.error=e,t.updateMatch(o.id,s=>({...s,status:H(e)?"redirected":A(e)?"notFound":s.status==="pending"?"success":s.status,context:kt(t,o.index),isFetching:!1,error:e})),A(e)&&!e.routeId&&(e.routeId=o.routeId),o._nonReactive.loadPromise?.resolve()),H(e)&&(t.rendered=!0,e.options._fromLocation=t.location,e.redirectHandled=!0,e=t.router.resolveRedirect(e))),e},"handleRedirectAndNotFound"),_r=i((t,o)=>{let e=t.router.getMatch(o);return!!(!e||!!1&&e._nonReactive.dehydrated||!1)},"shouldSkipLoader"),Pr=i((t,o,e)=>{let s=kt(t,e);t.updateMatch(o,r=>({...r,context:s}))},"syncMatchContext"),ee=i((t,o,e)=>{let{id:s,routeId:r}=t.matches[o],n=t.router.looseRoutesById[r];if(e instanceof Promise)throw e;t.firstBadMatchIndex??=o,xt(t,t.router.getMatch(s),e);try{n.options.onError?.(e)}catch(a){e=a,xt(t,t.router.getMatch(s),e)}t.updateMatch(s,a=>(a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,a._nonReactive.loadPromise?.resolve(),{...a,error:e,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!t.preload&&!H(e)&&!A(e)&&(t.serialError??=e)},"handleSerialError"),Fs=i((t,o,e,s)=>{let r=t.router.getMatch(o),n=t.matches[e-1]?.id,a=n?t.router.getMatch(n):void 0;if(t.router.isShell()){r.ssr=s.id===X;return}if(a?.ssr===!1){r.ssr=!1;return}let f=i(h=>h===!0&&a?.ssr==="data-only"?"data-only":h,"parentOverride"),u=t.router.options.defaultSsr??!0;if(s.options.ssr===void 0){r.ssr=f(u);return}if(typeof s.options.ssr!="function"){r.ssr=f(s.options.ssr);return}let{search:d,params:l}=r,c={search:ve(d,r.searchError),params:ve(l,r.paramsError),location:t.location,matches:t.matches.map(h=>({index:h.index,pathname:h.pathname,fullPath:h.fullPath,staticData:h.staticData,id:h.id,routeId:h.routeId,search:ve(h.search,h.searchError),params:ve(h.params,h.paramsError),ssr:h.ssr}))},p=s.options.ssr(c);if(vt(p))return p.then(h=>{r.ssr=f(h??u)});r.ssr=f(p??u)},"isBeforeLoadSsr"),Cr=i((t,o,e,s)=>{if(s._nonReactive.pendingTimeout!==void 0)return;let r=e.options.pendingMs??t.router.options.defaultPendingMs;if(t.onReady&&!!1&&!Re(t,o)&&(e.options.loader||e.options.beforeLoad||no(e))&&typeof r=="number"&&r!==1/0&&(e.options.pendingComponent??t.router.options?.defaultPendingComponent)){let n=setTimeout(()=>{ro(t)},r);s._nonReactive.pendingTimeout=n}},"setupPendingTimeout"),As=i((t,o,e)=>{let s=t.router.getMatch(o);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;Cr(t,o,e,s);let r=i(()=>{let n=t.router.getMatch(o);n.preload&&(n.status==="redirected"||n.status==="notFound")&&xt(t,n,n.error)},"then");return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(r):r()},"preBeforeLoadSetup"),Bs=i((t,o,e,s)=>{let r=t.router.getMatch(o),n=r._nonReactive.loadPromise;r._nonReactive.loadPromise=ct(()=>{n?.resolve(),n=void 0});let{paramsError:a,searchError:f}=r;a&&ee(t,e,a),f&&ee(t,e,f),Cr(t,o,s,r);let u=new AbortController,d=!1,l=i(()=>{d||(d=!0,t.updateMatch(o,P=>({...P,isFetching:"beforeLoad",fetchCount:P.fetchCount+1,abortController:u})))},"pending"),c=i(()=>{r._nonReactive.beforeLoadPromise?.resolve(),r._nonReactive.beforeLoadPromise=void 0,t.updateMatch(o,P=>({...P,isFetching:!1}))},"resolve");if(!s.options.beforeLoad){t.router.batch(()=>{l(),c()});return}r._nonReactive.beforeLoadPromise=ct();let p={...kt(t,e,!1),...r.__routeContext},{search:h,params:m,cause:y}=r,g=Re(t,o),v={search:h,abortController:u,params:m,preload:g,context:p,location:t.location,navigate:i(P=>t.router.navigate({...P,_fromLocation:t.location}),"navigate"),buildLocation:t.router.buildLocation,cause:g?"preload":y,matches:t.matches,routeId:s.id,...t.router.options.additionalContext},R=i(P=>{if(P===void 0){t.router.batch(()=>{l(),c()});return}(H(P)||A(P))&&(l(),ee(t,e,P)),t.router.batch(()=>{l(),t.updateMatch(o,_=>({..._,__beforeLoadContext:P})),c()})},"updateContext"),S;try{if(S=s.options.beforeLoad(v),vt(S))return l(),S.catch(P=>{ee(t,e,P)}).then(R)}catch(P){l(),ee(t,e,P)}R(S)},"executeBeforeLoad"),$s=i((t,o)=>{let{id:e,routeId:s}=t.matches[o],r=t.router.looseRoutesById[s],n=i(()=>{if(!1){let u=Fs(t,e,o,r);if(vt(u))return u.then(f)}return f()},"serverSsr"),a=i(()=>Bs(t,e,o,r),"execute"),f=i(()=>{if(_r(t,e))return;let u=As(t,e,r);return vt(u)?u.then(a):a()},"queueExecution");return n()},"handleBeforeLoad"),Us=i((t,o,e)=>{let s=t.router.getMatch(o);if(!s||!e.options.head&&!e.options.scripts&&!e.options.headers)return;let r={ssr:t.router.options.ssr,matches:t.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([e.options.head?.(r),e.options.scripts?.(r),e.options.headers?.(r)]).then(([n,a,f])=>({meta:n?.meta,links:n?.links,headScripts:n?.scripts,headers:f,scripts:a,styles:n?.styles}))},"executeHead"),br=i((t,o,e,s,r)=>{let n=o[s-1],{params:a,loaderDeps:f,abortController:u,cause:d}=t.router.getMatch(e),l=kt(t,s),c=Re(t,e);return{params:a,deps:f,preload:!!c,parentMatchPromise:n,abortController:u,context:l,location:t.location,navigate:i(p=>t.router.navigate({...p,_fromLocation:t.location}),"navigate"),cause:c?"preload":d,route:r,...t.router.options.additionalContext}},"getLoaderContext"),xr=i(async(t,o,e,s,r)=>{try{let n=t.router.getMatch(e);try{(!!1||n.ssr===!0)&&Ut(r);let a=r.options.loader,f=typeof a=="function"?a:a?.handler,u=f?.(br(t,o,e,s,r)),d=!!f&&vt(u);if((d||r._lazyPromise||r._componentsPromise||r.options.head||r.options.scripts||r.options.headers||n._nonReactive.minPendingPromise)&&t.updateMatch(e,c=>({...c,isFetching:"loader"})),f){let c=d?await u:u;xt(t,t.router.getMatch(e),c),c!==void 0&&t.updateMatch(e,p=>({...p,loaderData:c}))}r._lazyPromise&&await r._lazyPromise;let l=n._nonReactive.minPendingPromise;l&&await l,r._componentsPromise&&await r._componentsPromise,t.updateMatch(e,c=>({...c,error:void 0,context:kt(t,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(a){let f=a;if(f?.name==="AbortError"){if(n.abortController.signal.aborted){n._nonReactive.loaderPromise?.resolve(),n._nonReactive.loaderPromise=void 0;return}t.updateMatch(e,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:kt(t,s)}));return}let u=n._nonReactive.minPendingPromise;u&&await u,A(a)&&await r.options.notFoundComponent?.preload?.(),xt(t,t.router.getMatch(e),a);try{r.options.onError?.(a)}catch(d){f=d,xt(t,t.router.getMatch(e),d)}!H(f)&&!A(f)&&await Ut(r,["errorComponent"]),t.updateMatch(e,d=>({...d,error:f,context:kt(t,s),status:"error",isFetching:!1}))}}catch(n){let a=t.router.getMatch(e);a&&(a._nonReactive.loaderPromise=void 0),xt(t,a,n)}},"runLoader"),Hs=i(async(t,o,e)=>{async function s(h,m,y,g,v){let R=Date.now()-m.updatedAt,S=h?v.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:v.options.staleTime??t.router.options.defaultStaleTime??0,P=v.options.shouldReload,_=typeof P=="function"?P(br(t,o,r,e,v)):P,{status:b,invalid:x}=g,w=R>=S&&(!!t.forceStaleReload||g.cause==="enter"||y!==void 0&&y!==g.id);a=b==="success"&&(x||(_??w)),h&&v.options.preload===!1||(a&&!t.sync&&l?(f=!0,(async()=>{try{await xr(t,o,r,e,v);let C=t.router.getMatch(r);C._nonReactive.loaderPromise?.resolve(),C._nonReactive.loadPromise?.resolve(),C._nonReactive.loaderPromise=void 0,C._nonReactive.loadPromise=void 0}catch(C){H(C)&&await t.router.navigate(C.options)}})()):b!=="success"||a?await xr(t,o,r,e,v):Pr(t,r,e))}i(s,"handleLoader");let{id:r,routeId:n}=t.matches[e],a=!1,f=!1,u=t.router.looseRoutesById[n],d=u.options.loader,l=((typeof d=="function"?void 0:d?.staleReloadMode)??t.router.options.defaultStaleReloadMode)!=="blocking";if(_r(t,r)){if(!t.router.getMatch(r))return t.matches[e];if(Pr(t,r,e),!1)return t.router.getMatch(r)}else{let h=t.router.getMatch(r),m=t.router.stores.matchesId.get()[e],y=(m&&t.router.stores.matchStores.get(m)||null)?.routeId===n?m:t.router.stores.matches.get().find(v=>v.routeId===n)?.id,g=Re(t,r);if(h._nonReactive.loaderPromise){if(h.status==="success"&&!t.sync&&!h.preload&&l)return h;await h._nonReactive.loaderPromise;let v=t.router.getMatch(r),R=v._nonReactive.error||v.error;R&&xt(t,v,R),v.status==="pending"&&await s(g,h,y,v,u)}else{let v=g&&!t.router.stores.matchStores.has(r),R=t.router.getMatch(r);R._nonReactive.loaderPromise=ct(),v!==R.preload&&t.updateMatch(r,S=>({...S,preload:v})),await s(g,h,y,R,u)}}let c=t.router.getMatch(r);f||(c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loadPromise?.resolve(),c._nonReactive.loadPromise=void 0),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0,f||(c._nonReactive.loaderPromise=void 0),c._nonReactive.dehydrated=void 0;let p=f?c.isFetching:!1;return p!==c.isFetching||c.invalid!==!1?(t.updateMatch(r,h=>({...h,isFetching:p,invalid:!1})),t.router.getMatch(r)):c},"loadRouteMatch");async function so(t){let o=t,e=[];!!1&&Ds(o.router)&&ro(o);let s;for(let p=0;p<o.matches.length;p++){try{let h=$s(o,p);vt(h)&&await h}catch(h){if(H(h))throw h;if(A(h))s=h;else if(!o.preload)throw h;break}if(o.serialError||o.firstBadMatchIndex!=null)break}let r=o.firstBadMatchIndex??o.matches.length,n=s&&!o.preload?Sr(o,s):void 0,a=s&&o.preload?0:n!==void 0?Math.min(n+1,r):r,f,u;for(let p=0;p<a;p++)e.push(Hs(o,e,p));try{await Promise.all(e)}catch{let p=await Promise.allSettled(e);for(let h of p){if(h.status!=="rejected")continue;let m=h.reason;if(H(m))throw m;A(m)?f??=m:u??=m}if(u!==void 0)throw u}let d=f??(s&&!o.preload?s:void 0),l=o.firstBadMatchIndex!==void 0?o.firstBadMatchIndex:o.matches.length-1;if(!d&&s&&o.preload)return o.matches;if(d){let p=Sr(o,d);if(p===void 0)throw new Error("Invariant failed: Could not find match for notFound boundary");let h=o.matches[p],m=o.router.looseRoutesById[h.routeId],y=o.router.options?.defaultNotFoundComponent;!m.options.notFoundComponent&&y&&(m.options.notFoundComponent=y),d.routeId=h.routeId;let g=h.routeId===o.router.routeTree.id;o.updateMatch(h.id,v=>({...v,...g?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:d},isFetching:!1})),l=p,await Ut(m,["notFoundComponent"])}else if(!o.preload){let p=o.matches[0];p.globalNotFound||o.router.getMatch(p.id)?.globalNotFound&&o.updateMatch(p.id,h=>({...h,globalNotFound:!1,error:void 0}))}if(o.serialError&&o.firstBadMatchIndex!==void 0){let p=o.router.looseRoutesById[o.matches[o.firstBadMatchIndex].routeId];await Ut(p,["errorComponent"])}for(let p=0;p<=l;p++){let{id:h,routeId:m}=o.matches[p],y=o.router.looseRoutesById[m];try{let g=Us(o,h,y);if(g){let v=await g;o.updateMatch(h,R=>({...R,...v}))}}catch(g){console.error(`Error executing head for route ${m}:`,g)}}let c=ro(o);if(vt(c)&&await c,d)throw d;if(o.serialError&&!o.preload&&!o.onReady)throw o.serialError;return o.matches}i(so,"loadMatches");function wr(t,o){let e=o.map(s=>t.options[s]?.preload?.()).filter(Boolean);if(e.length!==0)return Promise.all(e)}i(wr,"preloadRouteComponents");function Ut(t,o=ye){!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(s=>{let{id:r,...n}=s.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0);let e=i(()=>t._componentsLoaded?void 0:o===ye?(()=>{if(t._componentsPromise===void 0){let s=wr(t,ye);s?t._componentsPromise=s.then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0}):t._componentsLoaded=!0}return t._componentsPromise})():wr(t,o),"runAfterLazy");return t._lazyPromise?t._lazyPromise.then(e):e()}i(Ut,"loadRouteChunk");function ve(t,o){return o?{status:"error",error:o}:{status:"success",value:t}}i(ve,"makeMaybe");function no(t){for(let o of ye)if(t.options[o]?.preload)return!0;return!1}i(no,"routeNeedsPreload");var ye=["component","errorComponent","pendingComponent","notFoundComponent"];function Lr(t){return{input:i(({url:o})=>{for(let e of t)o=Se(e,o);return o},"input"),output:i(({url:o})=>{for(let e=t.length-1;e>=0;e--)o=io(t[e],o);return o},"output")}}i(Lr,"composeRewrites");function Mr(t){let o=te(t.basepath),e=`/${o}`,s=t.caseSensitive?e:e.toLowerCase(),r=`${s}/`;return{input:i(({url:n})=>{let a=t.caseSensitive?n.pathname:n.pathname.toLowerCase();return a===s?n.pathname="/":a.startsWith(r)&&(n.pathname=n.pathname.slice(e.length)),n},"input"),output:i(({url:n})=>(n.pathname=Et(["/",o,n.pathname]),n),"output")}}i(Mr,"rewriteBasepath");function Se(t,o){let e=t?.input?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}i(Se,"executeRewriteInput");function io(t,o){let e=t?.output?.({url:o});if(e){if(typeof e=="string")return new URL(e);if(e instanceof URL)return e}return o}i(io,"executeRewriteOutput");function uo(t){let o=t;return{get(){return o},set(e){o=Y(e,o)}}}i(uo,"createNonReactiveMutableStore");function lo(t){return{get(){return t()}}}i(lo,"createNonReactiveReadonlyStore");function Ir(t,o){let{createMutableStore:e,createReadonlyStore:s,batch:r,init:n}=o,a=new Map,f=new Map,u=new Map,d=e(t.status),l=e(t.loadedAt),c=e(t.isLoading),p=e(t.isTransitioning),h=e(t.location),m=e(t.resolvedLocation),y=e(t.statusCode),g=e(t.redirect),v=e([]),R=e([]),S=e([]),P=s(()=>ao(a,v.get())),_=s(()=>ao(f,R.get())),b=s(()=>ao(u,S.get())),x=s(()=>v.get()[0]),w=s(()=>v.get().some(ot=>a.get(ot)?.get().status==="pending")),C=s(()=>({locationHref:h.get().href,resolvedLocationHref:m.get()?.href,status:d.get()})),I=s(()=>({status:d.get(),loadedAt:l.get(),isLoading:c.get(),isTransitioning:p.get(),matches:P.get(),location:h.get(),resolvedLocation:m.get(),statusCode:y.get(),redirect:g.get()})),L=yt(64);function M(ot){let qt=L.get(ot);return qt||(qt=s(()=>{let Bo=v.get();for(let $o of Bo){let ae=a.get($o);if(ae&&ae.routeId===ot)return ae.get()}}),L.set(ot,qt)),qt}i(M,"getRouteMatchStore");let et={status:d,loadedAt:l,isLoading:c,isTransitioning:p,location:h,resolvedLocation:m,statusCode:y,redirect:g,matchesId:v,pendingIds:R,cachedIds:S,matches:P,pendingMatches:_,cachedMatches:b,firstId:x,hasPending:w,matchRouteDeps:C,matchStores:a,pendingMatchStores:f,cachedMatchStores:u,__store:I,getRouteMatchStore:M,setMatches:W,setPending:dt,setCached:ie};W(t.matches),n?.(et);function W(ot){co(ot,a,v,e,r)}i(W,"setMatches");function dt(ot){co(ot,f,R,e,r)}i(dt,"setPending");function ie(ot){co(ot,u,S,e,r)}return i(ie,"setCached"),et}i(Ir,"createRouterStores");function ao(t,o){let e=[];for(let s of o){let r=t.get(s);r&&e.push(r.get())}return e}i(ao,"readPoolMatches");function co(t,o,e,s,r){let n=t.map(f=>f.id),a=new Set(n);r(()=>{for(let f of o.keys())a.has(f)||o.delete(f);for(let f of t){let u=o.get(f.id);if(!u){let d=s(f);d.routeId=f.routeId,o.set(f.id,d);continue}u.routeId=f.routeId,u.get()!==f&&u.set(f)}nr(e.get(),n)||e.set(n)})}i(co,"reconcileMatchPool");var wt="__TSR_index",Er="popstate",kr="beforeunload";function ho(t){let o=t.getLocation(),e=new Set,s=i(a=>{o=t.getLocation(),e.forEach(f=>f({location:o,action:a}))},"notify"),r=i(a=>{t.notifyOnIndexChange??!0?s(a):o=t.getLocation()},"handleIndexChange"),n=i(async({task:a,navigateOpts:f,...u})=>{if(f?.ignoreBlocker??!1){a();return}let d=t.getBlockers?.()??[],l=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&d.length&&l)for(let c of d){let p=Ht(u.path,u.state);if(await c.blockerFn({currentLocation:o,nextLocation:p,action:u.type})){t.onBlocked?.();return}}a()},"tryNavigation");return{get location(){return o},get length(){return t.getLength()},subscribers:e,subscribe:i(a=>(e.add(a),()=>{e.delete(a)}),"subscribe"),push:i((a,f,u)=>{let d=o.state[wt];f=fo(d+1,f),n({task:i(()=>{t.pushState(a,f),s({type:"PUSH"})},"task"),navigateOpts:u,type:"PUSH",path:a,state:f})},"push"),replace:i((a,f,u)=>{let d=o.state[wt];f=fo(d,f),n({task:i(()=>{t.replaceState(a,f),s({type:"REPLACE"})},"task"),navigateOpts:u,type:"REPLACE",path:a,state:f})},"replace"),go:i((a,f)=>{n({task:i(()=>{t.go(a),r({type:"GO",index:a})},"task"),navigateOpts:f,type:"GO"})},"go"),back:i(a=>{n({task:i(()=>{t.back(a?.ignoreBlocker??!1),r({type:"BACK"})},"task"),navigateOpts:a,type:"BACK"})},"back"),forward:i(a=>{n({task:i(()=>{t.forward(a?.ignoreBlocker??!1),r({type:"FORWARD"})},"task"),navigateOpts:a,type:"FORWARD"})},"forward"),canGoBack:i(()=>o.state[wt]!==0,"canGoBack"),createHref:i(a=>t.createHref(a),"createHref"),block:i(a=>{if(!t.setBlockers)return()=>{};let f=t.getBlockers?.()??[];return t.setBlockers([...f,a]),()=>{let u=t.getBlockers?.()??[];t.setBlockers?.(u.filter(d=>d!==a))}},"block"),flush:i(()=>t.flush?.(),"flush"),destroy:i(()=>t.destroy?.(),"destroy"),notify:s}}i(ho,"createHistory");function fo(t,o){o||(o={});let e=mo();return{...o,key:e,__TSR_key:e,[wt]:t}}i(fo,"assignKeyAndIndex");function po(t){let o=t?.window??(typeof document<"u"?window:void 0),e=o.history.pushState,s=o.history.replaceState,r=[],n=i(()=>r,"_getBlockers"),a=i(w=>r=w,"_setBlockers"),f=t?.createHref??(w=>w),u=t?.parseLocation??(()=>Ht(`${o.location.pathname}${o.location.search}${o.location.hash}`,o.history.state));if(!o.history.state?.__TSR_key&&!o.history.state?.key){let w=mo();o.history.replaceState({[wt]:0,key:w,__TSR_key:w},"")}let d=u(),l,c=!1,p=!1,h=!1,m=!1,y=i(()=>d,"getLocation"),g,v,R=i(()=>{g&&(x._ignoreSubscribers=!0,(g.isPush?o.history.pushState:o.history.replaceState)(g.state,"",g.href),x._ignoreSubscribers=!1,g=void 0,v=void 0,l=void 0)},"flush"),S=i((w,C,I)=>{let L=f(C);v||(l=d),d=Ht(C,I),g={href:L,state:I,isPush:g?.isPush||w==="push"},v||(v=Promise.resolve().then(()=>R()))},"queueHistoryAction"),P=i(w=>{d=u(),x.notify({type:w})},"onPushPop"),_=i(async()=>{if(p){p=!1;return}let w=u(),C=w.state[wt]-d.state[wt],I=C===1,L=C===-1,M=!I&&!L||c;c=!1;let et=M?"GO":L?"BACK":"FORWARD",W=M?{type:"GO",index:C}:{type:L?"BACK":"FORWARD"};if(h)h=!1;else{let dt=n();if(typeof document<"u"&&dt.length){for(let ie of dt)if(await ie.blockerFn({currentLocation:d,nextLocation:w,action:et})){p=!0,o.history.go(1),x.notify(W);return}}}d=u(),x.notify(W)},"onPushPopEvent"),b=i(w=>{if(m){m=!1;return}let C=!1,I=n();if(typeof document<"u"&&I.length)for(let L of I){let M=L.enableBeforeUnload??!0;if(M===!0){C=!0;break}if(typeof M=="function"&&M()===!0){C=!0;break}}if(C)return w.preventDefault(),w.returnValue=""},"onBeforeUnload"),x=ho({getLocation:y,getLength:i(()=>o.history.length,"getLength"),pushState:i((w,C)=>S("push",w,C),"pushState"),replaceState:i((w,C)=>S("replace",w,C),"replaceState"),back:i(w=>(w&&(h=!0),m=!0,o.history.back()),"back"),forward:i(w=>{w&&(h=!0),m=!0,o.history.forward()},"forward"),go:i(w=>{c=!0,o.history.go(w)},"go"),createHref:i(w=>f(w),"createHref"),flush:R,destroy:i(()=>{o.history.pushState=e,o.history.replaceState=s,o.removeEventListener(kr,b,{capture:!0}),o.removeEventListener(Er,_)},"destroy"),onBlocked:i(()=>{l&&d!==l&&(d=l)},"onBlocked"),getBlockers:n,setBlockers:a,notifyOnIndexChange:!1});return o.addEventListener(kr,b,{capture:!0}),o.addEventListener(Er,_),o.history.pushState=function(...w){let C=e.apply(o.history,w);return x._ignoreSubscribers||P("PUSH"),C},o.history.replaceState=function(...w){let C=s.apply(o.history,w);return x._ignoreSubscribers||P("REPLACE"),C},x}i(po,"createBrowserHistory");function Ws(t={initialEntries:["/"]}){let o=t.initialEntries,e=t.initialIndex?Math.min(Math.max(t.initialIndex,0),o.length-1):o.length-1,s=o.map((u,d)=>fo(d,void 0)),r=i(()=>Ht(o[e],s[e]),"getLocation"),n=[];return ho({getLocation:r,getLength:i(()=>o.length,"getLength"),pushState:i((u,d)=>{e<o.length-1&&(o.splice(e+1),s.splice(e+1)),s.push(d),o.push(u),e=Math.max(o.length-1,0)},"pushState"),replaceState:i((u,d)=>{s[e]=d,o[e]=u},"replaceState"),back:i(()=>{e=Math.max(e-1,0)},"back"),forward:i(()=>{e=Math.min(e+1,o.length-1)},"forward"),go:i(u=>{e=Math.min(Math.max(e+u,0),o.length-1)},"go"),createHref:i(u=>u,"createHref"),getBlockers:i(()=>n,"_getBlockers"),setBlockers:i(u=>n=u,"_setBlockers")})}i(Ws,"createMemoryHistory");function Vs(t){let o=t.replace(/[\x00-\x1f\x7f]/g,"");return o.startsWith("//")&&(o="/"+o.replace(/^\/+/,"")),o}i(Vs,"sanitizePath");function Ht(t,o){let e=Vs(t),s=e.indexOf("#"),r=e.indexOf("?"),n=mo();return{href:e,pathname:e.substring(0,s>0?r>0?Math.min(s,r):s:r>0?r:e.length),hash:s>-1?e.substring(s):"",search:r>-1?e.slice(r,s===-1?void 0:s):"",state:o||{[wt]:0,key:n,__TSR_key:n}}}i(Ht,"parseHref");function mo(){return(Math.random()+1).toString(36).substring(7)}i(mo,"createRandomKey");function ht(t,o){let e=o,s=t;return{fromLocation:e,toLocation:s,pathChanged:e?.pathname!==s.pathname,hrefChanged:e?.href!==s.href,hashChanged:e?.hash!==s.hash}}i(ht,"getLocationChangeInfo");var xe=new WeakMap,go=class{static{i(this,"RouterCore")}constructor(t,o){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");let s=this.options,r=this.basepath??s?.basepath??"/",n=this.basepath===void 0,a=s?.rewrite;if(this.options={...s,...e},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=mr(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=po()),this.origin=this.options.origin,this.origin||(!!1&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let l;!1,this.resolvePathCache=yt(1e3),l=this.buildRouteTree(),!1,this.setRoutes(l)}if(!this.stores&&this.latestLocation){let l=this.getStoreConfig(this);this.batch=l.batch,this.stores=Ir(Fr(this.latestLocation),l),Br(this)}let f=!1,u=this.options.basepath??"/",d=this.options.rewrite;if(n||r!==u||a!==d){this.basepath=u;let l=[],c=te(u);c&&c!=="/"&&l.push(Mr({basepath:u})),d&&l.push(d),this.rewrite=l.length===0?void 0:l.length===1?l[0]:Lr(l),this.history&&this.updateLatestLocation(),f=!0}f&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=dr(this.routeTree,this.options.caseSensitive,(s,r)=>{s.init({originalIndex:r})});return this.options.routeMasks&&cr(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,s)=>{let r={eventType:e,fn:s};return this.subscribers.add(r),()=>{this.subscribers.delete(r)}},this.emit=e=>{this.subscribers.forEach(s=>{s.eventType===e.type&&s.fn(e)})},this.parseLocation=(e,s)=>{let r=i(({pathname:u,search:d,hash:l,href:c,state:p})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(u)){let v=this.options.parseSearch(d),R=this.options.stringifySearch(v);return{href:u+R+l,publicHref:u+R+l,pathname:Bt(u).path,external:!1,searchStr:R,search:gt(s?.search,v),hash:Bt(l.slice(1)).path,state:at(s?.state,p)}}let h=new URL(c,this.origin),m=Se(this.rewrite,h),y=this.options.parseSearch(m.search),g=this.options.stringifySearch(y);return m.search=g,{href:m.href.replace(m.origin,""),publicHref:c,pathname:Bt(m.pathname).path,external:!!this.rewrite&&m.origin!==this.origin,searchStr:g,search:gt(s?.search,y),hash:Bt(m.hash.slice(1)).path,state:at(s?.state,p)}},"parse"),n=r(e),{__tempLocation:a,__tempKey:f}=n.state;if(a&&(!f||f===this.tempLocationKey)){let u=r(a);return u.state.key=n.state.key,u.state.__TSR_key=n.state.__TSR_key,delete u.state.__tempLocation,{...u,maskedLocation:n}}return n},this.resolvePathWithBase=(e,s)=>eo({base:e,to:s.includes("//")?Qt(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,s,r)=>typeof e=="string"?this.matchRoutesInternal({pathname:e,search:s},r):this.matchRoutesInternal(e,s),this.getMatchedRoutes=e=>Ar({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let s=this.getMatch(e);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let s=this.stores.matchStores.get(e)?.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(e)})},this.buildLocation=e=>{let s=i((n={})=>{let a=n._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(a);if(n.from&&n._isNavigate){let L=this.getMatchedRoutes(n.from).matchedRoutes,M=Ge(f.matchedRoutes,W=>Or(W.fullPath,n.from)),et=Ge(L,W=>Or(W.fullPath,f.fullPath));!M&&!et&&console.warn(`Could not find match for from: ${n.from}`)}let u=n.unsafeRelative==="path"?a.pathname:n.from??f.fullPath,d=n.to?`${n.to}`:void 0,l=f.search,c=Object.assign(Object.create(null),f.params),p=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(u,"."),h=d?this.resolvePathWithBase(p,d):p,m=n.params===!1||n.params===null?Object.create(null):(n.params??!0)===!0?c:Object.assign(c,Y(n.params,c)),y=this.routesByPath[Q(h)],g;if(y)g=this.getRouteBranch(y);else if(h.includes("$"))g=[];else{let L=this.getMatchedRoutes(h);g=L.matchedRoutes,this.options.notFoundRoute&&(!L.foundRoute||L.foundRoute.path!=="/"&&L.routeParams["**"])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&mt(m))for(let L of g){let M=L.options.params?.stringify??L.options.stringifyParams;if(M)try{Object.assign(m,M(m))}catch{}}let v=e.leaveParams?h:Bt(ge({path:h,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(y&&!e.leaveParams)try{let L=this.getMatchedRoutes(v);L.foundRoute?.id!==y.id&&console.warn(`Generated path "${v}" for route "${y.id}" matched route "${L.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let R=l;if(e._includeValidateSearch&&this.options.search?.strict){let L={};g.forEach(M=>{if(M.options.validateSearch)try{Object.assign(L,Pe(M.options.validateSearch,{...L,...R}))}catch{}}),R=L}R=js({search:R,dest:n,destRoutes:g,_includeValidateSearch:e._includeValidateSearch}),R=gt(l,R);let S=this.options.stringifySearch(R),P=n.hash===!0?a.hash:n.hash?Y(n.hash,a.hash):void 0,_=P?`#${P}`:"",b=n.state===!0?a.state:n.state?Y(n.state,a.state):{};b=at(a.state,b);let x=`${v}${S}${_}`,w,C,I=!1;if(this.rewrite){let L=new URL(x,this.origin),M=io(this.rewrite,L);w=L.href.replace(L.origin,""),M.origin!==this.origin?(C=M.href,I=!0):C=M.pathname+M.search+M.hash}else w=sr(x),C=w;return{publicHref:C,href:w,pathname:v,search:R,searchStr:S,state:b,hash:P??"",external:I,unmaskOnReload:n.unmaskOnReload}},"build"),r=i((n={},a)=>{let f=s(n),u=a?s(a):void 0;if(!u){let d=Object.create(null);if(this.options.routeMasks){let l=ur(f.pathname,this.processedTree);if(l){Object.assign(d,l.rawParams);let{from:c,params:p,...h}=l.route,m=p===!1||p===null?Object.create(null):(p??!0)===!0?d:Object.assign(d,Y(p,d));a={from:e.from,...h,params:m},u=s(a)}}}return u&&(f.maskedLocation=u),f},"buildWithMatches");return e.mask?r(e,{from:e.from,...e.mask}):r(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:s,...r})=>{let n,a=i(()=>{let d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(c=>{r.state[c]=this.latestLocation.state[c]});let l=st(r.state,this.latestLocation.state);return d.forEach(c=>{delete r.state[c]}),l},"isSameState"),f=Q(this.latestLocation.href)===Q(r.href),u=this.commitLocationPromise;if(this.commitLocationPromise=ct(()=>{u?.resolve(),u=void 0}),f&&a())this.load();else{let{maskedLocation:d,hashScrollIntoView:l,...c}=r;d&&(c={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...c,search:c.searchStr,state:{...c.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(c.unmaskOnReload??this.options.unmaskOnReload??!1)&&(c.state.__tempKey=this.tempLocationKey)),c.state.__hashScrollIntoViewOptions=l??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,n=r.replace?"REPLACE":"PUSH",this.history[n==="REPLACE"?"replace":"push"](c.publicHref,c.state,{ignoreBlocker:s})}return this._scroll.next=r.resetScroll??!0,this.history.subscribers.size||this.load(n?{action:{type:n}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:s,hashScrollIntoView:r,viewTransition:n,ignoreBlocker:a,href:f,...u}={})=>{if(f){let c=this.history.location.state.__TSR_index,p=Ht(f,{__TSR_index:e?c:c+1}),h=new URL(p.pathname,this.origin);u.to=Se(this.rewrite,h).pathname,u.search=this.options.parseSearch(p.search),u.hash=p.hash.slice(1)}let d=this.buildLocation({...u,_includeValidateSearch:!0});this.pendingBuiltLocation=d;let l=this.commitLocation({...d,viewTransition:n,replace:e,resetScroll:s,hashScrollIntoView:r,ignoreBlocker:a});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),l},this.navigate=async({to:e,reloadDocument:s,href:r,publicHref:n,...a})=>{let f=!1;if(r)try{new URL(`${r}`),f=!0}catch{}if(f&&!s&&(s=!0),s){if(e!==void 0||!r){let d=this.buildLocation({to:e,...a});r=r??d.publicHref,n=n??d.publicHref}let u=!f&&n?n:r;if(ut(u,this.protocolAllowlist)){console.warn(`Blocked navigation to dangerous protocol: ${u}`);return}if(!a.ignoreBlocker){let d=this.history.getBlockers?.()??[];for(let l of d)if(l?.blockerFn&&await l.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}a.replace?window.location.replace(u):window.location.href=u;return}return this.buildAndCommitLocation({...a,href:r,to:e,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),!1){let r=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(this.latestLocation.publicHref!==r.publicHref){let n=this.getParsedLocationHref(r);throw r.external?$t({href:n}):$t({href:n,_builtLocation:r})}}let e=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(r=>!e.some(n=>n.id===r.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(s)})},this.load=async e=>{let s=e?.action?.type,r,n,a,f=this.stores.resolvedLocation.get()??this.stores.location.get();for(a=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),s?xe.set(this.latestLocation,s):xe.delete(this.latestLocation);let l=this.latestLocation,c=ht(l,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...c}),this.emit({type:"onBeforeLoad",...c}),await so({router:this,sync:e?.sync,forceStaleReload:f.href===l.href,matches:this.stores.pendingMatches.get(),location:l,updateMatch:this.updateMatch,onReady:i(async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let p=null,h=null,m=null,y=null;this.batch(()=>{let g=this.stores.pendingMatches.get(),v=g.length,R=this.stores.matches.get();p=v?R.filter(_=>!this.stores.pendingMatchStores.has(_.id)):null;let S=new Set;for(let _ of this.stores.pendingMatchStores.values())_.routeId&&S.add(_.routeId);let P=new Set;for(let _ of this.stores.matchStores.values())_.routeId&&P.add(_.routeId);h=v?R.filter(_=>!S.has(_.routeId)):null,m=v?g.filter(_=>!P.has(_.routeId)):null,y=v?g.filter(_=>P.has(_.routeId)):R,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),v&&(this.stores.setMatches(g),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...p.filter(_=>_.status!=="error"&&_.status!=="notFound"&&_.status!=="redirected")]),this.clearExpiredCache())});for(let[g,v]of[[h,"onLeave"],[m,"onEnter"],[y,"onStay"]])if(g)for(let R of g)this.looseRoutesById[R.routeId].options[v]?.(R)})})},"onReady")})}catch(l){H(l)?(r=l,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):A(l)&&(n=l);let c=r?r.status:n?404:this.stores.matches.get().some(p=>p.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(c),this.stores.redirect.set(r)})}this.latestLoadPromise===a&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=a,await a;this.latestLoadPromise&&a!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(d=>d.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=e=>{let s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let r;if(typeof s=="object"&&this.isViewTransitionTypesSupported){let n=this.latestLocation,a=this.stores.resolvedLocation.get(),f=typeof s.types=="function"?s.types(ht(n,a)):s.types;if(f===!1){e();return}r={update:e,types:f}}else r=e;document.startViewTransition(r)}else e()},this.updateMatch=(e,s)=>{this.startTransition(()=>{let r=this.stores.pendingMatchStores.get(e);if(r){r.set(s);return}let n=this.stores.matchStores.get(e);if(n){n.set(s);return}let a=this.stores.cachedMatchStores.get(e);if(a){let f=s(a.get());f.status==="redirected"?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(u=>u.filter(d=>d!==e)):a.set(f)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let s=i(r=>e?.filter?.(r)??!0?{...r,invalid:!0,...e?.forcePending||r.status==="error"||r.status==="notFound"?{status:"pending",error:void 0}:void 0}:r,"invalidate");return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||"/",this.resolveRedirect=e=>{let s=e.headers.get("Location");if(!e.options.href||e.options._builtLocation){let r=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(r);e.options.href=n,e.headers.set("Location",n)}else if(s)try{let r=new URL(s);if(this.origin&&r.origin===this.origin){let n=r.pathname+r.search+r.hash;e.options.href=n,e.headers.set("Location",n)}}catch{}if(e.options.href&&!e.options._builtLocation&&ut(e.options.href,this.protocolAllowlist))throw new Error(`Redirect blocked: unsafe protocol in href "${e.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`);return e.headers.get("Location")||e.headers.set("Location",e.options.href),e},this.clearCache=e=>{let s=e?.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(r=>!s(r))):this.stores.setCached([])},this.clearExpiredCache=()=>{let e=Date.now(),s=i(r=>{let n=this.looseRoutesById[r.routeId];if(!n.options.loader)return!0;let a=(r.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return r.status==="error"?!0:e-r.updatedAt>=a},"filter");this.clearCache({filter:s})},this.loadRouteChunk=Ut,this.preloadRoute=async e=>{let s=e._builtLocation??this.buildLocation(e),r=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:e}),n=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),a=new Set([...n,...this.stores.cachedIds.get()]),f=r.filter(u=>!a.has(u.id));if(f.length){let u=this.stores.cachedMatches.get();this.stores.setCached([...u,...f])}try{return r=await so({router:this,matches:r,location:s,preload:!0,updateMatch:i((u,d)=>{n.has(u)?r=r.map(l=>l.id===u?d(l):l):this.updateMatch(u,d)},"updateMatch")}),r}catch(u){if(H(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:s});A(u)||console.error(u);return}},this.matchRoute=(e,s)=>{let r={...e,to:e.to?this.resolvePathWithBase(e.from||"",e.to):void 0,params:e.params||{},leaveParams:!0},n=this.buildLocation(r);if(s?.pending&&this.stores.status.get()!=="pending")return!1;let a=(s?.pending===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),f=lr(n.pathname,s?.caseSensitive??!1,s?.fuzzy??!1,a.pathname,this.processedTree);return!f||e.params&&!st(f.rawParams,e.params,{partial:!0})?!1:s?.includeSearch??!0?st(a.search,n.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status==="notFound"||e.globalNotFound),this.getStoreConfig=o,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...t,caseSensitive:t.caseSensitive??!1,notFoundMode:t.notFoundMode??"fuzzy",stringifySearch:t.stringifySearch??Rr,parseSearch:t.parseSearch??yr,protocolAllowlist:t.protocolAllowlist??Je}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:t,routesByPath:o,processedTree:e}){this.routesById=t,this.routesByPath=o,this.processedTree=e;let s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(t){let o=this.routeBranchCache.get(t);return o||(o=to(t),this.routeBranchCache.set(t,o)),o}get looseRoutesById(){return this.routesById}getParentContext(t){return t?.id?t.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(t,o){let e=this.getMatchedRoutes(t.pathname),{foundRoute:s,routeParams:r}=e,{matchedRoutes:n}=e,a=!1;(s?s.path!=="/"&&r["**"]:Q(t.pathname))&&(this.options.notFoundRoute?n=[...n,this.options.notFoundRoute]:a=!0);let f=a?Ks(this.options.notFoundMode,n):void 0,u=new Array(n.length),d=new Map;for(let l of this.stores.matchStores.values())l.routeId&&d.set(l.routeId,l.get());for(let l=0;l<n.length;l++){let c=n[l],p=u[l-1],h,m,y;{let M=p?.search??t.search,et=p?._strictSearch??void 0;try{let W=Pe(c.options.validateSearch,{...M})??void 0;h={...M,...W},m={...et,...W},y=void 0}catch(W){let dt=W;if(W instanceof oe||(dt=new oe(W.message,{cause:W})),o?.throwOnError)throw dt;h=M,m={},y=dt}}let g=c.options.loaderDeps?.({search:h})??"",v=g?JSON.stringify(g):"",{interpolatedPath:R,usedParams:S}=ge({path:c.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),P=c.id+R+v,_=this.getMatch(P),b=d.get(c.id),x=_?._strictParams??S,w;if(!_)try{Nr(c,x)}catch(M){if(A(M)||H(M)?w=M:w=new Dr(M.message,{cause:M}),o?.throwOnError)throw w}Object.assign(r,x);let C=b?"stay":"enter",I;if(_)I={..._,cause:C,params:b?.params??r,_strictParams:x,search:b?gt(b.search,h):gt(_.search,h),_strictSearch:m};else{let M=c.options.loader||c.options.beforeLoad||c.lazyFn||no(c)?"pending":"success";I={id:P,ssr:c.options.ssr,index:l,routeId:c.id,params:b?.params??r,_strictParams:x,pathname:R,updatedAt:Date.now(),search:b?gt(b.search,h):h,_strictSearch:m,searchError:void 0,status:M,isFetching:!1,error:void 0,paramsError:w,__routeContext:void 0,_nonReactive:{loadPromise:ct()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:b?at(b.loaderDeps,g):g,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:c.options.staticData||{},fullPath:c.fullPath}}o?.preload||(I.globalNotFound=f===c.id),I.searchError=y;let L=this.getParentContext(p);I.context={...L,...I.__routeContext,...I.__beforeLoadContext},u[l]=I}for(let l=0;l<u.length;l++){let c=u[l],p=this.looseRoutesById[c.routeId],h=this.getMatch(c.id),m=d.get(c.routeId);if(c.params=m?gt(m.params,r):r,!h){let y=u[l-1],g=this.getParentContext(y);if(p.options.context){let v={deps:c.loaderDeps,params:c.params,context:g??{},location:t,navigate:i(R=>this.navigate({...R,_fromLocation:t}),"navigate"),buildLocation:this.buildLocation,cause:c.cause,abortController:c.abortController,preload:!!c.preload,matches:u,routeId:p.id};c.__routeContext=p.options.context(v)??void 0}c.context={...g,...c.__routeContext,...c.__beforeLoadContext}}}return u}matchRoutesLightweight(t){let o=pt(this.stores.matchesId.get()),e=this.lightweightCache.get(t);if(e&&e[0]===o)return e[1];let{matchedRoutes:s,routeParams:r}=this.getMatchedRoutes(t.pathname),n=pt(s),a={...t.search};for(let c of s)try{Object.assign(a,Pe(c.options.validateSearch,a))}catch{}let f=o&&this.stores.matchStores.get(o)?.get(),u=f&&f.routeId===n.id&&f.pathname===t.pathname,d;if(u)d=f.params;else{let c=Object.assign(Object.create(null),r);for(let p of s)try{Nr(p,c)}catch{}d=c}let l={matchedRoutes:s,fullPath:n.fullPath,search:a,params:d};return this.lightweightCache.set(t,[o,l]),l}},oe=class extends Error{static{i(this,"SearchParamError")}},Dr=class extends Error{static{i(this,"PathParamError")}},Tr=i(t=>t.endsWith("/")&&t.length>1?t.slice(0,-1):t,"normalize");function Or(t,o){return Tr(t)===Tr(o)}i(Or,"comparePaths");function Fr(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],statusCode:200}}i(Fr,"getInitialRouterState");function Pe(t,o){if(t==null)return{};if("~standard"in t){let e=t["~standard"].validate(o);if(e instanceof Promise)throw new oe("Async validation not supported");if(e.issues)throw new oe(JSON.stringify(e.issues,void 0,2),{cause:e});return e.value}return"parse"in t?t.parse(o):typeof t=="function"?t(o):{}}i(Pe,"validateSearch");function Ar({pathname:t,routesById:o,processedTree:e}){let s=Object.create(null),r=Q(t),n,a=fr(r,e,!0);return a&&(n=a.route,Object.assign(s,a.rawParams)),{matchedRoutes:a?.branch||[o.__root__],routeParams:s,foundRoute:n}}i(Ar,"getMatchedRoutes");function js({search:t,dest:o,destRoutes:e,_includeValidateSearch:s}){return zs(e)(t,o,s??!1)}i(js,"applySearchMiddleware");function zs(t){let o,e,s=[];for(let n of t){let a=n.options;if("search"in a)a.search?.middlewares&&s.push(...a.search.middlewares);else if(a.preSearchFilters||a.postSearchFilters){let u=i(({search:d,next:l})=>{let c=l(a.preSearchFilters?a.preSearchFilters.reduce((p,h)=>h(p),d):d);return a.postSearchFilters?a.postSearchFilters.reduce((p,h)=>h(p),c):c},"legacyMiddleware");s.push(u)}let f=a.validateSearch;if(f){let u=i(({search:d,next:l,meta:c})=>{let p=l(d);if(e)try{let h=Pe(f,p);if(c&&h)for(let m in h)m in p||(c.defaulted||=new Map).set(m,h[m]);return{...p,...h}}catch{}return p},"validate");s.push(u)}}let r=i((n,a,f)=>{if(n>=s.length){if(!o.search)return{};if(o.search===!0)return a;let d=Y(o.search,a);return f&&(f.explicit=d),d}let u=i((d,l)=>{if(l){let c=f||{};return{search:r(n+1,d,c),meta:c}}return r(n+1,d,f)},"next");return s[n]({search:a,next:u,meta:f})},"applyNext");return i(function(a,f,u){return o=f,e=u,r(0,a)},"middleware")}i(zs,"buildMiddlewareChain");function Ks(t,o){if(t!=="root")for(let e=o.length-1;e>=0;e--){let s=o[e];if(s.children)return s.id}return X}i(Ks,"findGlobalNotFoundRouteId");function Nr(t,o){let e=t.options.params?.parse??t.options.parseParams;if(e){let s=e(o);if(s===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(o,s)}}i(Nr,"extractStrictParams");function qs(){try{return sessionStorage}catch{return}}i(qs,"getSafeSessionStorage");var Gs="tsr-scroll-restoration-v1_3",Hr=qs();function Js(){try{return JSON.parse(Hr?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}i(Js,"createScrollRestorationCache");function Ys(){try{Hr?.setItem(Gs,JSON.stringify(Wt))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}i(Ys,"persistScrollRestorationCache");var Wt=Js(),$r="data-scroll-restoration-id",Xs=i(t=>t.state.__TSR_key||t.href,"defaultGetScrollRestorationKey");function Zs(t){let o=t.getAttribute($r);if(o)return`[${$r}="${o}"]`;let e="",s=t,r;for(;r=s.parentNode;){let n=1,a=s;for(;a=a.previousElementSibling;)n++;let f=`${s.localName}:nth-child(${n})`;e=e?`${f} > ${e}`:f,s=r}return e}i(Zs,"getScrollRestorationSelector");var we=!1,Vt="window";function vo(t){try{return typeof t=="function"?t():document.querySelector(t)}catch{}}i(vo,"getElement");function Ur(t){let o=[];for(let e of t){if(e===Vt)continue;let s=vo(e);s&&o.push(s)}return o}i(Ur,"getScrollToTopElements");function Br(t,o){let e=o??t.options.scrollRestoration,s=t._scroll;if(e&&(s.restoring=!0),!1)return;let r=t.options.getScrollRestorationKey||Xs,n=new Map,a=i((d,l,c)=>{let p=n.get(d)||{};p.scrollX=l,p.scrollY=c,n.set(d,p)},"setTrackedScrollEntry"),f=i(d=>{if(!(we||!s.restoring))if(d.target===document)a(Vt,scrollX,scrollY);else{let l=d.target;a(l,l.scrollLeft,l.scrollTop)}},"onScroll"),u=i(d=>{if(!s.restoring)return;let l=Wt[d]||={};for(let[c,p]of n)c===Vt?l[Vt]=p:c.isConnected&&(l[Zs(c)]=p)},"snapshotCurrentScrollTargets");e&&!s.restoration&&(s.restoration=!0,we=!1,history.scrollRestoration="manual",document.addEventListener("scroll",f,!0),t.subscribe("onBeforeLoad",d=>{d.fromLocation&&u(r(d.fromLocation)),n.clear()}),addEventListener("pagehide",()=>{u(r(t.stores.resolvedLocation.get()??t.stores.location.get())),Ys()})),!s.reset&&(s.reset=!0,t.subscribe("onRendered",d=>{let l=t.options.scrollRestorationBehavior,c=t.options.scrollToTopSelectors,p=s.next,h;if(n.clear(),p||(s.next=!0),typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return;let m=r(d.toLocation),y=d.fromLocation&&r(d.fromLocation);if(s.restoring&&y&&y!==m){let g=Wt[y];if(g){let v=Wt[m];for(let R in g){if(R===Vt){if(p)continue}else{let S=vo(R);if(!S||p&&c&&(h??=Ur(c),h.includes(S)))continue}v||(v=Wt[m]={}),v[R]??=g[R]}}}we=!0;try{let g=d.toLocation.hash,v=d.toLocation.state.__hashScrollIntoViewOptions??!0,R=!1;if(p){let S=xe.get(d.toLocation),P=g&&v&&(S==="PUSH"||S==="REPLACE"),_=s.restoring?Wt[m]:void 0;if(_)for(let b in _){let{scrollX:x,scrollY:w}=_[b];if(b===Vt){if(P)continue;scrollTo({top:w,left:x,behavior:l}),R=!0}else{let C=vo(b);C&&(C.scrollLeft=x,C.scrollTop=w)}}if(!R&&!g){let b={top:0,left:0,behavior:l};if(scrollTo(b),c){h??=Ur(c);for(let x of h)x.scrollTo(b)}}}!R&&g&&v&&document.getElementById(g)?.scrollIntoView(v)}finally{we=!1}}))}i(Br,"setupScrollRestoration");var yo="Error preloading route! \u261D\uFE0F";var _e=class{static{i(this,"BaseRoute")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=o=>{this.originalIndex=o.originalIndex;let e=this.options,s=!e?.path&&!e?.id;if(this.parentRoute=this.options.getParentRoute?.(),s)this._path=X;else if(!this.parentRoute)throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");let r=s?X:e?.path;r&&r!=="/"&&(r=pe(r));let n=e?.id||r,a=s?X:Et([this.parentRoute.id==="__root__"?"":this.parentRoute.id,n]);r==="__root__"&&(r="/"),a!=="__root__"&&(a=Et(["/",a]));let f=a==="__root__"?"/":Et([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=f,this._to=Q(f)},this.addChildren=o=>this._addFileChildren(o),this._addFileChildren=o=>(Array.isArray(o)&&(this.children=o),typeof o=="object"&&o!==null&&(this.children=Object.values(o)),this),this._addFileTypes=()=>this,this.updateLoader=o=>(Object.assign(this.options,o),this),this.update=o=>(Object.assign(this.options,o),this),this.lazy=o=>(this.lazyFn=o,this),this.redirect=o=>$t({from:this.fullPath,...o}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}};var Ro=class extends _e{static{i(this,"BaseRootRoute")}constructor(t){super(t)}};var Ie=k(j(),1);var F=(t=>(t[t.None=0]="None",t[t.Mutable=1]="Mutable",t[t.Watching=2]="Watching",t[t.RecursedCheck=4]="RecursedCheck",t[t.Recursed=8]="Recursed",t[t.Dirty=16]="Dirty",t[t.Pending=32]="Pending",t))(F||{});function Wr({update:t,notify:o,unwatched:e}){return{link:s,unlink:r,propagate:n,checkDirty:a,shallowPropagate:f};function s(d,l,c){let p=l.depsTail;if(p!==void 0&&p.dep===d)return;let h=p!==void 0?p.nextDep:l.deps;if(h!==void 0&&h.dep===d){h.version=c,l.depsTail=h;return}let m=d.subsTail;if(m!==void 0&&m.version===c&&m.sub===l)return;let y=l.depsTail=d.subsTail={version:c,dep:d,sub:l,prevDep:p,nextDep:h,prevSub:m,nextSub:void 0};h!==void 0&&(h.prevDep=y),p!==void 0?p.nextDep=y:l.deps=y,m!==void 0?m.nextSub=y:d.subs=y}function r(d,l=d.sub){let c=d.dep,p=d.prevDep,h=d.nextDep,m=d.nextSub,y=d.prevSub;return h!==void 0?h.prevDep=p:l.depsTail=p,p!==void 0?p.nextDep=h:l.deps=h,m!==void 0?m.prevSub=y:c.subsTail=y,y!==void 0?y.nextSub=m:(c.subs=m)===void 0&&e(c),h}function n(d){let l=d.nextSub,c;t:do{let p=d.sub,h=p.flags;if(h&60?h&12?h&4?!(h&48)&&u(d,p)?(p.flags=h|40,h&=1):h=0:p.flags=h&-9|32:h=0:p.flags=h|32,h&2&&o(p),h&1){let m=p.subs;if(m!==void 0){let y=(d=m).nextSub;y!==void 0&&(c={value:l,prev:c},l=y);continue}}if((d=l)!==void 0){l=d.nextSub;continue}for(;c!==void 0;)if(d=c.value,c=c.prev,d!==void 0){l=d.nextSub;continue t}break}while(!0)}function a(d,l){let c,p=0,h=!1;t:do{let m=d.dep,y=m.flags;if(l.flags&16)h=!0;else if((y&17)===17){if(t(m)){let g=m.subs;g.nextSub!==void 0&&f(g),h=!0}}else if((y&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(c={value:d,prev:c}),d=m.deps,l=m,++p;continue}if(!h){let g=d.nextDep;if(g!==void 0){d=g;continue}}for(;p--;){let g=l.subs,v=g.nextSub!==void 0;if(v?(d=c.value,c=c.prev):d=g,h){if(t(l)){v&&f(g),l=d.sub;continue}h=!1}else l.flags&=-33;l=d.sub;let R=d.nextDep;if(R!==void 0){d=R;continue t}}return h}while(!0)}function f(d){do{let l=d.sub,c=l.flags;(c&48)===32&&(l.flags=c|16,(c&6)===2&&o(l))}while((d=d.nextSub)!==void 0)}function u(d,l){let c=l.depsTail;for(;c!==void 0;){if(c===d)return!0;c=c.prevDep}return!1}}i(Wr,"createReactiveSystem");function zr(t,o,e){let s=typeof t=="object",r=s?t:void 0;return{next:(s?t.next:t)?.bind(r),error:(s?t.error:o)?.bind(r),complete:(s?t.complete:e)?.bind(r)}}i(zr,"toObserver");var So=[],be=0,{link:Vr,unlink:en,propagate:on,checkDirty:Kr,shallowPropagate:jr}=Wr({update(t){return t._update()},notify(t){So[Po++]=t,t.flags&=~F.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=F.Mutable|F.Dirty,Le(t))}}),Ce=0,Po=0,lt,xo=0;function re(t){try{++xo,t()}finally{--xo||wo()}}i(re,"batch");function Le(t){let o=t.depsTail,e=o!==void 0?o.nextDep:t.deps;for(;e!==void 0;)e=en(e,t)}i(Le,"purgeDeps");function wo(){if(!(xo>0)){for(;Ce<Po;){let t=So[Ce];So[Ce++]=void 0,t.notify()}Ce=0,Po=0}}i(wo,"flush");function Me(t,o){let e=typeof t=="function",s=t,r={_snapshot:e?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:e?F.None:F.Mutable,get(){return lt!==void 0&&Vr(r,lt,be),r._snapshot},subscribe(n){let a=zr(n),f={current:!1},u=rn(()=>{r.get(),f.current?a.next?.(r._snapshot):f.current=!0});return{unsubscribe:i(()=>{u.stop()},"unsubscribe")}},_update(n){let a=lt,f=o?.compare??Object.is;if(e)lt=r,++be,r.depsTail=void 0;else if(n===void 0)return!1;e&&(r.flags=F.Mutable|F.RecursedCheck);try{let u=r._snapshot,d=typeof n=="function"?n(u):n===void 0&&e?s(u):n;return u===void 0||!f(u,d)?(r._snapshot=d,!0):!1}finally{lt=a,e&&(r.flags&=~F.RecursedCheck),Le(r)}}};return e?(r.flags=F.Mutable|F.Dirty,r.get=function(){let n=r.flags;if(n&F.Dirty||n&F.Pending&&Kr(r.deps,r)){if(r._update()){let a=r.subs;a!==void 0&&jr(a)}}else n&F.Pending&&(r.flags=n&~F.Pending);return lt!==void 0&&Vr(r,lt,be),r._snapshot}):r.set=function(n){if(r._update(n)){let a=r.subs;a!==void 0&&(on(a),jr(a),wo())}},r}i(Me,"createAtom");function rn(t){let o=i(()=>{let s=lt;lt=e,++be,e.depsTail=void 0,e.flags=F.Watching|F.RecursedCheck;try{return t()}finally{lt=s,e.flags&=~F.RecursedCheck,Le(e)}},"run"),e={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:F.Watching|F.RecursedCheck,notify(){let s=this.flags;s&F.Dirty||s&F.Pending&&Kr(this.deps,this)?o():this.flags=F.Watching},stop(){this.flags=F.None,this.depsTail=void 0,Le(this)}};return o(),e}i(rn,"effect");var _o=k(j(),1),qr=k(ws(),1);function sn(t,o){return t===o}i(sn,"defaultCompare");function B(t,o,e=sn){let s=(0,_o.useCallback)(a=>{if(!t)return()=>{};let{unsubscribe:f}=t.subscribe(a);return f},[t]),r=(0,_o.useCallback)(()=>t?.get(),[t]);return(0,qr.useSyncExternalStoreWithSelector)(s,r,r,o,e)}i(B,"useStore");var Co={get(){},subscribe(){return{unsubscribe(){}}}};function bo(t,o){let e=Ie.useRef();return s=>{let r=t?.select?t.select(s):s;return t?.structuralSharing??o.options.defaultStructuralSharing?e.current=at(e.current,r):r}}i(bo,"useStructuralSharing");function tt(t){let o=D(),e=Ie.useContext(t.from?Zo:Mt),s=t.from?o.stores.getRouteMatchStore(t.from):o.stores.matchStores.get(e);if(!1){let a=s?.get();if(!a){if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`);return}return t.select?t.select(a):a}let r=bo(t,o),n=B(s??Co,a=>a?r(a):Co);if(n!==Co)return n;if(t.shouldThrow??!0)throw new Error(`Invariant failed: Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`)}i(tt,"useMatch");function Ee(t){return tt({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:i(o=>t.select?t.select(o.search):o.search,"select")})}i(Ee,"useSearch");var nt=k(j(),1);var Tt=typeof window<"u"?nt.useLayoutEffect:nt.useEffect;function ke(t){let o=nt.useRef({value:t,prev:null}),e=o.current.value;return t!==e&&(o.current={value:t,prev:e}),o.current.prev}i(ke,"usePrevious");function Gr(t,o,e={},s={}){nt.useEffect(()=>{if(!t.current||s.disabled||typeof IntersectionObserver!="function")return;let r=new IntersectionObserver(([n])=>{o(n)},e);return r.observe(t.current),()=>{r.disconnect()}},[o,e,s.disabled,t])}i(Gr,"useIntersectionObserver");function Jr(t){let o=nt.useRef(null);return nt.useImperativeHandle(t,()=>o.current,[]),o}i(Jr,"useForwardedRef");var Lo=k(j(),1);function Te(t){let o=D();return Lo.useCallback(e=>o.navigate({...e,from:e.from??t?.from}),[t?.from,o])}i(Te,"useNavigate");var jt=k(j(),1),it=k(rt(),1);function Ot(t){let o=t.errorComponent??Nt;return(0,it.jsx)(nn,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:i(({error:e,reset:s})=>e?jt.createElement(o,{error:e,reset:s}):t.children,"children")})}i(Ot,"CatchBoundary");var nn=class extends jt.Component{static{i(this,"CatchBoundaryImpl")}constructor(...t){super(...t),this.state={error:null}}static getDerivedStateFromProps(t,o){let e=t.getResetKey();return o.error&&o.resetKey!==e?{resetKey:e,error:null}:{resetKey:e}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidCatch(t,o){this.props.onCatch&&this.props.onCatch(t,o)}render(){return this.props.children({error:this.state.error,reset:i(()=>{this.reset()},"reset")})}};function Nt({error:t}){let[o,e]=jt.useState(!0);return(0,it.jsxs)("div",{style:{padding:".5rem",maxWidth:"100%"},children:[(0,it.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[(0,it.jsx)("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),(0,it.jsx)("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:i(()=>e(s=>!s),"onClick"),children:o?"Hide Error":"Show Error"})]}),(0,it.jsx)("div",{style:{height:".25rem"}}),o?(0,it.jsx)("div",{children:(0,it.jsx)("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?(0,it.jsx)("code",{children:t.message}):null})}):null]})}i(Nt,"ErrorComponent");var Oe=k(j(),1),Mo=k(rt(),1);function Yr({children:t,fallback:o=null}){return Io()?(0,Mo.jsx)(Oe.default.Fragment,{children:t}):(0,Mo.jsx)(Oe.default.Fragment,{children:o})}i(Yr,"ClientOnly");function Io(){return Oe.default.useSyncExternalStore(an,()=>!0,()=>!1)}i(Io,"useHydrated");function an(){return()=>{}}i(an,"subscribe");function Eo(t){return tt({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:i(o=>t.select?t.select(o.loaderData):o.loaderData,"select")})}i(Eo,"useLoaderData");function ko(t){let{select:o,...e}=t;return tt({...e,select:i(s=>o?o(s.loaderDeps):s.loaderDeps,"select")})}i(ko,"useLoaderDeps");function To(t){return tt({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:i(o=>{let e=t.strict===!1?o.params:o._strictParams;return t.select?t.select(e):e},"select")})}i(To,"useParams");function Oo(t){return tt({...t,select:i(o=>t.select?t.select(o.context):o.context,"select")})}i(Oo,"useRouteContext");var U=k(j(),1),cn=k(rt(),1);var os=k(xs(),1);function un(t,o){let e=D(),s=Jr(o),r=!1,{activeProps:n,inactiveProps:a,activeOptions:f,to:u,preload:d,preloadDelay:l,preloadIntentProximity:c,hashScrollIntoView:p,replace:h,startTransition:m,resetScroll:y,viewTransition:g,children:v,target:R,disabled:S,style:P,className:_,onClick:b,onBlur:x,onFocus:w,onMouseEnter:C,onMouseLeave:I,onTouchStart:L,ignoreBlocker:M,params:et,search:W,hash:dt,state:ie,mask:ot,reloadDocument:qt,unsafeRelative:Bo,from:$o,_fromLocation:ae,...Dt}=t;if(r){let O=es(u);if(typeof u=="string"&&!O&&u.indexOf(":")>-1)try{return new URL(u),ut(u,e.protocolAllowlist)?(console.warn(`Blocked Link with dangerous protocol: ${u}`),{...Dt,ref:s,href:void 0,...v&&{children:v},...R&&{target:R},...S&&{disabled:S},...P&&{style:P},..._&&{className:_}}):{...Dt,ref:s,href:u,...v&&{children:v},...R&&{target:R},...S&&{disabled:S},...P&&{style:P},..._&&{className:_}}}catch{}let T=e.buildLocation({...t,from:t.from}),Z=ts(T.maskedLocation?T.maskedLocation.publicHref:T.publicHref,T.maskedLocation?T.maskedLocation.external:T.external,e.history,S),Yt=(()=>{if(Z?.external){if(ut(Z.href,e.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${Z.href}`);return}return Z.href}if(!O&&typeof u=="string"&&u.indexOf(":")>-1)try{if(new URL(u),ut(u,e.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${u}`);return}return u}catch{}})(),Ve=(()=>{if(Yt)return!1;let V=e.stores.location.get(),G=f?.exact??!1;if(G){if(!me(V.pathname,T.pathname,e.basepath))return!1}else{let z=Pt(V.pathname,e.basepath),J=Pt(T.pathname,e.basepath);if(!(z.startsWith(J)&&(z.length===J.length||z[J.length]==="/")))return!1}if((f?.includeSearch??!0)&&V.search!==T.search){let z=!V.search||typeof V.search=="object"&&!mt(V.search),J=!T.search||typeof T.search=="object"&&!mt(T.search);if(!(z&&J)&&!st(V.search,T.search,{partial:!G,ignoreUndefined:!f?.explicitUndefined}))return!1}return!f?.includeHash})();if(Yt)return{...Dt,ref:s,href:Yt,...v&&{children:v},...R&&{target:R},...S&&{disabled:S},...P&&{style:P},..._&&{className:_}};let je=Ve?Y(n,{})??Xr:zt,ze=Ve?zt:Y(a,{})??zt,Go=(()=>{let V=P,G=je.style,z=ze.style;if(!(!V&&!G&&!z))return V&&!G&&!z?V:!V&&G&&!z?G:!V&&!G&&z?z:{...V,...G,...z}})(),Jo=(()=>{let V=_,G=je.className,z=ze.className;if(!V&&!G&&!z)return"";let J="";return V&&(J=V),G&&(J=J?`${J} ${G}`:G),z&&(J=J?`${J} ${z}`:z),J})();return{...Dt,...je,...ze,href:Z?.href,ref:s,disabled:!!S,target:R,...Go&&{style:Go},...Jo&&{className:Jo},...S&&Zr,...Ve&&Qr}}let Ue=Io(),Gt=U.useMemo(()=>t,[e,t.from,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),bt=B(e.stores.location,O=>O,(O,T)=>O.href===T.href),q=U.useMemo(()=>{let O={_fromLocation:bt,...Gt};return e.buildLocation(O)},[e,bt,Gt]),Uo=q.maskedLocation?q.maskedLocation.publicHref:q.publicHref,Ho=q.maskedLocation?q.maskedLocation.external:q.external,Ft=U.useMemo(()=>ts(Uo,Ho,e.history,S),[S,Ho,Uo,e.history]),Jt=U.useMemo(()=>{if(Ft?.external){if(ut(Ft.href,e.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${Ft.href}`);return}return Ft.href}if(!es(u)&&!(typeof u!="string"||u.indexOf(":")===-1))try{if(new URL(u),ut(u,e.protocolAllowlist)){console.warn(`Blocked Link with dangerous protocol: ${u}`);return}return u}catch{}},[u,Ft,e.protocolAllowlist]),He=U.useMemo(()=>{if(Jt)return!1;if(f?.exact){if(!me(bt.pathname,q.pathname,e.basepath))return!1}else{let O=Pt(bt.pathname,e.basepath),T=Pt(q.pathname,e.basepath);if(!(O.startsWith(T)&&(O.length===T.length||O[T.length]==="/")))return!1}return(f?.includeSearch??!0)&&!st(bt.search,q.search,{partial:!f?.exact,ignoreUndefined:!f?.explicitUndefined})?!1:f?.includeHash?Ue&&bt.hash===q.hash:!0},[f?.exact,f?.explicitUndefined,f?.includeHash,f?.includeSearch,bt,Jt,Ue,q.hash,q.pathname,q.search,e.basepath]),ce=He?Y(n,{})??Xr:zt,ue=He?zt:Y(a,{})??zt,Wo=[_,ce.className,ue.className].filter(Boolean).join(" "),Vo=(P||ce.style||ue.style)&&{...P,...ce.style,...ue.style},[Rs,jo]=U.useState(!1),zo=U.useRef(!1),At=t.reloadDocument||Jt?!1:d??e.options.defaultPreload,We=l??e.options.defaultPreloadDelay??0,Lt=U.useCallback(()=>{e.preloadRoute({...Gt,_builtLocation:q}).catch(O=>{console.warn(O),console.warn(yo)})},[e,Gt,q]);Gr(s,U.useCallback(O=>{O?.isIntersecting&&Lt()},[Lt]),fn,{disabled:!!S||At!=="viewport"}),U.useEffect(()=>{zo.current||!S&&At==="render"&&(Lt(),zo.current=!0)},[S,Lt,At]);let Ss=i(O=>{let T=O.currentTarget.getAttribute("target"),Z=R!==void 0?R:T;if(!S&&!dn(O)&&!O.defaultPrevented&&(!Z||Z==="_self")&&O.button===0){O.preventDefault(),(0,os.flushSync)(()=>{jo(!0)});let Yt=e.subscribe("onResolved",()=>{Yt(),jo(!1)});e.navigate({...Gt,replace:h,resetScroll:y,hashScrollIntoView:p,startTransition:m,viewTransition:g,ignoreBlocker:M})}},"handleClick");if(Jt)return{...Dt,ref:s,href:Jt,...v&&{children:v},...R&&{target:R},...S&&{disabled:S},...P&&{style:P},..._&&{className:_},...b&&{onClick:b},...x&&{onBlur:x},...w&&{onFocus:w},...C&&{onMouseEnter:C},...I&&{onMouseLeave:I},...L&&{onTouchStart:L}};let Ko=i(O=>{if(S||At!=="intent")return;if(!We){Lt();return}let T=O.currentTarget;if(se.has(T))return;let Z=setTimeout(()=>{se.delete(T),Lt()},We);se.set(T,Z)},"enqueueIntentPreload"),Ps=i(O=>{S||At!=="intent"||Lt()},"handleTouchStart"),qo=i(O=>{if(S||!At||!We)return;let T=O.currentTarget,Z=se.get(T);Z&&(clearTimeout(Z),se.delete(T))},"handleLeave");return{...Dt,...ce,...ue,href:Ft?.href,ref:s,onClick:Kt([b,Ss]),onBlur:Kt([x,qo]),onFocus:Kt([w,Ko]),onMouseEnter:Kt([C,Ko]),onMouseLeave:Kt([I,qo]),onTouchStart:Kt([L,Ps]),disabled:!!S,target:R,...Vo&&{style:Vo},...Wo&&{className:Wo},...S&&Zr,...He&&Qr,...Ue&&Rs&&ln}}i(un,"useLinkProps");var zt={},Xr={className:"active"},Zr={role:"link","aria-disabled":!0},Qr={"data-status":"active","aria-current":"page"},ln={"data-transitioning":"transitioning"},se=new WeakMap,fn={rootMargin:"100px"},Kt=i(t=>o=>{for(let e of t)if(e){if(o.defaultPrevented)return;e(o)}},"composeHandlers");function ts(t,o,e,s){if(!s)return o?{href:t,external:!0}:{href:e.createHref(t)||"/",external:!1}}i(ts,"getHrefOption");function es(t){if(typeof t!="string")return!1;let o=t.charCodeAt(0);return o===47?t.charCodeAt(1)!==47:o===46}i(es,"isSafeInternal");var No=U.forwardRef((t,o)=>{let{_asChild:e,...s}=t,{type:r,...n}=un(s,o),a=typeof s.children=="function"?s.children({isActive:n["data-status"]==="active"}):s.children;if(!e){let{disabled:f,...u}=n;return U.createElement("a",u,a)}return U.createElement(e,n,a)});function dn(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}i(dn,"isCtrlEvent");var Do=k(j(),1),Fo=k(rt(),1);var rs=class extends _e{static{i(this,"Route")}constructor(t){super(t),this.useMatch=o=>tt({select:o?.select,from:this.id,structuralSharing:o?.structuralSharing}),this.useRouteContext=o=>Oo({...o,from:this.id}),this.useSearch=o=>Ee({select:o?.select,structuralSharing:o?.structuralSharing,from:this.id}),this.useParams=o=>To({select:o?.select,structuralSharing:o?.structuralSharing,from:this.id}),this.useLoaderDeps=o=>ko({...o,from:this.id}),this.useLoaderData=o=>Eo({...o,from:this.id}),this.useNavigate=()=>Te({from:this.fullPath}),this.Link=Do.default.forwardRef((o,e)=>(0,Fo.jsx)(No,{ref:e,from:this.fullPath,...o}))}};function hn(t){return new rs(t)}i(hn,"createRoute");var ss=class extends Ro{static{i(this,"RootRoute")}constructor(t){super(t),this.useMatch=o=>tt({select:o?.select,from:this.id,structuralSharing:o?.structuralSharing}),this.useRouteContext=o=>Oo({...o,from:this.id}),this.useSearch=o=>Ee({select:o?.select,structuralSharing:o?.structuralSharing,from:this.id}),this.useParams=o=>To({select:o?.select,structuralSharing:o?.structuralSharing,from:this.id}),this.useLoaderDeps=o=>ko({...o,from:this.id}),this.useLoaderData=o=>Eo({...o,from:this.id}),this.useNavigate=()=>Te({from:this.fullPath}),this.Link=Do.default.forwardRef((o,e)=>(0,Fo.jsx)(No,{ref:e,from:this.fullPath,...o}))}};function pn(t){return new ss(t)}i(pn,"createRootRoute");var wc=k(j(),1),Ne=k(rt(),1);function ns(t){let o=D();if(!1){let s=`not-found-${o.stores.location.get().pathname}-${o.stores.status.get()}`;return(0,Ne.jsx)(Ot,{getResetKey:i(()=>s,"getResetKey"),onCatch:i((r,n)=>{if(A(r))t.onCatch?.(r,n);else throw r},"onCatch"),errorComponent:i(({error:r})=>{if(A(r))return t.fallback?.(r);throw r},"errorComponent"),children:t.children})}let e=`not-found-${B(o.stores.location,s=>s.pathname)}-${B(o.stores.status,s=>s)}`;return(0,Ne.jsx)(Ot,{getResetKey:i(()=>e,"getResetKey"),onCatch:i((s,r)=>{if(A(s))t.onCatch?.(s,r);else throw s},"onCatch"),errorComponent:i(({error:s})=>{if(A(s))return t.fallback?.(s);throw s},"errorComponent"),children:t.children})}i(ns,"CatchNotFound");function is(){return(0,Ne.jsx)("p",{children:"Not Found"})}i(is,"DefaultGlobalNotFound");var as=k(rt(),1);function cs({children:t}){let o=D();return null}i(cs,"ScriptOnce");var Ec=k(j(),1),De=k(rt(),1);function _t(t){return(0,De.jsx)(De.Fragment,{children:t.children})}i(_t,"SafeFragment");var Nc=k(j(),1),Fe=k(rt(),1);function Ae(t,o,e){return o.options.notFoundComponent?(0,Fe.jsx)(o.options.notFoundComponent,{...e}):t.options.defaultNotFoundComponent?(0,Fe.jsx)(t.options.defaultNotFoundComponent,{...e}):(o.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${o.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`),(0,Fe.jsx)(is,{}))}i(Ae,"renderRouteNotFound");var ls=k(rt(),1);function us(t){return null}i(us,"getScrollRestorationScriptForRouter");function fs(){let t=us(D());return t?(0,ls.jsx)(cs,{children:t}):null}i(fs,"ScrollRestoration");var K=k(j(),1),N=k(rt(),1);var mn=i((t,o)=>t.routeId===o.routeId&&t._displayPending===o._displayPending,"matchViewFieldsEqual"),gn=i((t,o)=>t[0]===o[0]&&t[1]===o[1],"outletMatchSelectionEqual"),Be=K.memo(i(function({matchId:o}){let e=D();if(!1){let a=e.stores.matchStores.get(o)?.get();if(!a)throw new Error(`Invariant failed: Could not find match for matchId "${o}". Please file an issue!`);let f=a.routeId,u=e.routesById[f].parentRoute?.id;return(0,N.jsx)(ds,{router:e,matchId:o,resetKey:e.stores.loadedAt.get(),matchState:{routeId:f,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:u}})}let s=e.stores.matchStores.get(o);if(!s)throw new Error(`Invariant failed: Could not find match for matchId "${o}". Please file an issue!`);let r=B(e.stores.loadedAt,a=>a),n=B(s,a=>a,mn);return(0,N.jsx)(ds,{router:e,matchId:o,resetKey:r,matchState:K.useMemo(()=>{let a=n.routeId,f=e.routesById[a].parentRoute?.id;return{routeId:a,ssr:n.ssr,_displayPending:n._displayPending,parentRouteId:f}},[n._displayPending,n.routeId,n.ssr,e.routesById])})},"MatchImpl"));function ds({router:t,matchId:o,resetKey:e,matchState:s}){let r=t.routesById[s.routeId],n=r.options.pendingComponent??t.options.defaultPendingComponent,a=n?(0,N.jsx)(n,{}):null,f=r.options.errorComponent??t.options.defaultErrorComponent,u=r.options.onCatch??t.options.defaultOnCatch,d=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,l=s.ssr===!1||s.ssr==="data-only",c=(!r.isRoot||r.options.wrapInSuspense||l)&&(r.options.wrapInSuspense??n??(r.options.errorComponent?.preload||l))?K.Suspense:_t,p=f?Ot:_t,h=d?ns:_t;return(0,N.jsxs)(r.isRoot?r.options.shellComponent??_t:_t,{children:[(0,N.jsx)(Mt.Provider,{value:o,children:(0,N.jsx)(c,{fallback:a,children:(0,N.jsx)(p,{getResetKey:i(()=>e,"getResetKey"),errorComponent:f||Nt,onCatch:i((m,y)=>{if(A(m))throw m.routeId??=s.routeId,m;console.warn(`Warning: Error in route match: ${o}`),u?.(m,y)},"onCatch"),children:(0,N.jsx)(h,{fallback:i(m=>{if(m.routeId??=s.routeId,!d||m.routeId&&m.routeId!==s.routeId||!m.routeId&&!r.isRoot)throw m;return K.createElement(d,m)},"fallback"),children:l||s._displayPending?(0,N.jsx)(Yr,{fallback:a,children:(0,N.jsx)(hs,{matchId:o})}):(0,N.jsx)(hs,{matchId:o})})})})}),s.parentRouteId===X?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(vn,{}),t.options.scrollRestoration&&!1?(0,N.jsx)(fs,{}):null]}):null]})}i(ds,"MatchView");function vn(){let t=D();if(!1)return null;let o=K.useRef();return Tt(()=>{let e=t.stores.resolvedLocation.get(),s=o.current;e&&(!s||s.href!==e.href)&&t.emit({type:"onRendered",...ht(t.stores.location.get(),s??e)}),o.current=e},[B(t.stores.resolvedLocation,e=>e?.state.__TSR_key),t]),null}i(vn,"OnRendered");var hs=K.memo(i(function({matchId:o}){let e=D(),s=i((l,c)=>e.getMatch(l.id)?._nonReactive[c]??l._nonReactive[c],"getMatchPromise");if(!1){let l=e.stores.matchStores.get(o)?.get();if(!l)throw new Error(`Invariant failed: Could not find match for matchId "${o}". Please file an issue!`);let c=l.routeId,p=e.routesById[c],h=(e.routesById[c].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:c,loaderDeps:l.loaderDeps,params:l._strictParams,search:l._strictSearch}),m=h?JSON.stringify(h):void 0,y=p.options.component??e.options.defaultComponent,g=y?(0,N.jsx)(y,{},m):(0,N.jsx)(Ao,{});if(l._displayPending)throw s(l,"displayPendingPromise");if(l._forcePending)throw s(l,"minPendingPromise");if(l.status==="pending")throw s(l,"loadPromise");if(l.status==="notFound"){if(!A(l.error))throw new Error("Invariant failed: Expected a notFound error");return Ae(e,p,l.error)}if(l.status==="redirected")throw H(l.error)?s(l,"loadPromise"):new Error("Invariant failed: Expected a redirect error");return l.status==="error"?(0,N.jsx)((p.options.errorComponent??e.options.defaultErrorComponent)||Nt,{error:l.error,reset:void 0,info:{componentStack:""}}):g}let r=e.stores.matchStores.get(o);if(!r)throw new Error(`Invariant failed: Could not find match for matchId "${o}". Please file an issue!`);let n=B(r,l=>l),a=n.routeId,f=e.routesById[a],u=K.useMemo(()=>{let l=(e.routesById[a].options.remountDeps??e.options.defaultRemountDeps)?.({routeId:a,loaderDeps:n.loaderDeps,params:n._strictParams,search:n._strictSearch});return l?JSON.stringify(l):void 0},[a,n.loaderDeps,n._strictParams,n._strictSearch,e.options.defaultRemountDeps,e.routesById]),d=K.useMemo(()=>{let l=f.options.component??e.options.defaultComponent;return l?(0,N.jsx)(l,{},u):(0,N.jsx)(Ao,{})},[u,f.options.component,e.options.defaultComponent]);if(n._displayPending)throw s(n,"displayPendingPromise");if(n._forcePending)throw s(n,"minPendingPromise");if(n.status==="pending"){let l=f.options.pendingMinMs??e.options.defaultPendingMinMs;if(l){let c=e.getMatch(n.id);if(c&&!c._nonReactive.minPendingPromise&&!!1){let p=ct();c._nonReactive.minPendingPromise=p,setTimeout(()=>{p.resolve(),c._nonReactive.minPendingPromise=void 0},l)}}throw s(n,"loadPromise")}if(n.status==="notFound"){if(!A(n.error))throw new Error("Invariant failed: Expected a notFound error");return Ae(e,f,n.error)}if(n.status==="redirected")throw H(n.error)?s(n,"loadPromise"):new Error("Invariant failed: Expected a redirect error");if(n.status==="error"){if(!1)return(0,N.jsx)((f.options.errorComponent??e.options.defaultErrorComponent)||Nt,{error:n.error,reset:void 0,info:{componentStack:""}});throw n.error}return d},"MatchInnerImpl")),Ao=K.memo(i(function(){let o=D(),e=K.useContext(Mt),s,r=!1,n;if(!1){let d=o.stores.matches.get(),l=e?d.findIndex(p=>p.id===e):-1,c=l>=0?d[l]:void 0;s=c?.routeId,r=c?.globalNotFound??!1,n=l>=0?d[l+1]?.id:void 0}else{let d=e?o.stores.matchStores.get(e):void 0;[s,r]=B(d,l=>[l?.routeId,l?.globalNotFound??!1],gn),n=B(o.stores.matchesId,l=>l[l.findIndex(c=>c===e)+1])}let a=s?o.routesById[s]:void 0,f=o.options.defaultPendingComponent?(0,N.jsx)(o.options.defaultPendingComponent,{}):null;if(r){if(!a)throw new Error("Invariant failed: Could not resolve route for Outlet render");return Ae(o,a,void 0)}if(!n)return null;let u=(0,N.jsx)(Be,{matchId:n});return s===X?(0,N.jsx)(K.Suspense,{fallback:f,children:u}):u},"OutletImpl"));var Ct=k(j(),1);function ps(){let t=D(),o=Ct.useRef({router:t,mounted:!1}),[e,s]=Ct.useState(!1),r=B(t.stores.isLoading,c=>c),n=B(t.stores.hasPending,c=>c),a=ke(r),f=r||e||n,u=ke(f),d=r||n,l=ke(d);return t.startTransition=c=>{s(!0),Ct.startTransition(()=>{c(),s(!1)})},Ct.useEffect(()=>{let c=t.history.subscribe(t.load),p=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Q(t.latestLocation.publicHref)!==Q(p.publicHref)&&t.commitLocation({...p,replace:!0}),()=>{c()}},[t,t.history]),Tt(()=>{if(typeof window<"u"&&t.ssr||o.current.router===t&&o.current.mounted)return;o.current={router:t,mounted:!0},i(async()=>{try{await t.load()}catch(p){console.error(p)}},"tryLoad")()},[t]),Tt(()=>{a&&!r&&t.emit({type:"onLoad",...ht(t.stores.location.get(),t.stores.resolvedLocation.get())})},[a,t,r]),Tt(()=>{l&&!d&&t.emit({type:"onBeforeRouteMount",...ht(t.stores.location.get(),t.stores.resolvedLocation.get())})},[d,l,t]),Tt(()=>{if(u&&!f){let c=ht(t.stores.location.get(),t.stores.resolvedLocation.get());t.emit({type:"onResolved",...c}),re(()=>{t.stores.status.set("idle"),t.stores.resolvedLocation.set(t.stores.location.get())})}},[f,u,t]),null}i(ps,"Transitioner");var $e=k(j(),1),ft=k(rt(),1);function ms(){let t=D(),o=t.routesById[X].options.pendingComponent??t.options.defaultPendingComponent,e=o?(0,ft.jsx)(o,{}):null,s=(0,ft.jsxs)(typeof document<"u"&&t.ssr?_t:$e.Suspense,{fallback:e,children:[!!1&&(0,ft.jsx)(ps,{}),(0,ft.jsx)(yn,{})]});return t.options.InnerWrap?(0,ft.jsx)(t.options.InnerWrap,{children:s}):s}i(ms,"Matches");function yn(){let t=D(),o=!1,e=o?t.stores.firstId.get():B(t.stores.firstId,n=>n),s=o?t.stores.loadedAt.get():B(t.stores.loadedAt,n=>n),r=e?(0,ft.jsx)(Be,{matchId:e}):null;return(0,ft.jsx)(Mt.Provider,{value:e,children:t.options.disableGlobalCatchBoundary?r:(0,ft.jsx)(Ot,{getResetKey:i(()=>s,"getResetKey"),errorComponent:Nt,onCatch:n=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${n.message||n.toString()}`)},children:r})})}i(yn,"MatchesInner");var gs=i(t=>({createMutableStore:Me,createReadonlyStore:Me,batch:re}),"getStoreFactory");var Rn=i(t=>new vs(t),"createRouter"),vs=class extends go{static{i(this,"Router")}constructor(t){super(t,gs)}};var ku=k(j(),1),ne=k(rt(),1);function ys({router:t,children:o,...e}){mt(e)&&t.update({...t.options,...e,context:{...t.options.context,...e.context}});let s=(0,ne.jsx)(le.Provider,{value:t,children:o});return t.options.Wrap?(0,ne.jsx)(t.options.Wrap,{children:s}):s}i(ys,"RouterContextProvider");function Sn({router:t,...o}){return(0,ne.jsx)(ys,{router:t,...o,children:(0,ne.jsx)(ms,{})})}i(Sn,"RouterProvider");function Pn(t){let o=D({warn:t?.router===void 0}),e=t?.router||o;if(!1){let s=e.stores.__store.get();return t?.select?t.select(s):s}return B(e.stores.__store,bo(t,e))}i(Pn,"useRouterState");export{po as a,Ws as b,D as c,Ee as d,Te as e,hn as f,pn as g,Ao as h,Rn as i,Sn as j,Pn as k};
@@ -0,0 +1 @@
1
+ import{a as S}from"./chunk-WUFVFVHJ.js";import"./chunk-XNJNSCLM.js";import{b as T}from"./chunk-RXVQJ4DO.js";import{a as w,b as A,c as E,d as m,e as s,f as l}from"./chunk-GTM65MVX.js";import{a as N,e as b}from"./chunk-SEU5V7I6.js";import{a as O}from"./chunk-VLXV72QE.js";import{a as k}from"./chunk-JSEXCW5Q.js";import{b as y}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{a as C}from"./chunk-G7ZBM54M.js";import"./chunk-L2YBC2BV.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{a as u}from"./chunk-TAD43CG5.js";import{d as h}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as d,e as p,f as D,h as H}from"./chunk-RRCPZMC2.js";var n=p(D(),1);var e=p(H(),1);var K=d(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"parseContext"),R='{ "targetingKey": "user-123", "plan": "premium" }',M=d(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"formatValue"),Y=d(({initialShardKey:a=""})=>{let t=h(),[o,F]=(0,n.useState)(""),{context:f,error:g}=K(o),I=(0,n.useMemo)(()=>f===void 0?{}:{context:f},[f]),{data:i,error:J,errorSource:L,liveError:j}=T(C.listFlags,I,{live:!0,shardKey:a}),v=i!==void 0,V=i?.configured??!1,x=(0,n.useMemo)(()=>Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],[i]),c;return v&&!V?c=(0,e.jsxDEV)(u,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")},void 0,!1):v&&x.length===0?c=(0,e.jsxDEV)(u,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")},void 0,!1):c=(0,e.jsxDEV)(N,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(b,{className:"px-0",children:(0,e.jsxDEV)(w,{"data-testid":"flags-table",children:[(0,e.jsxDEV)(A,{children:(0,e.jsxDEV)(m,{children:[(0,e.jsxDEV)(s,{children:t("Key")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Type")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Value")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Reason")},void 0,!1),(0,e.jsxDEV)(s,{children:t("Variant")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(E,{children:x.map(r=>(0,e.jsxDEV)(m,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:r.key},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs",children:M(r)},void 0,!1),(0,e.jsxDEV)(l,{children:r.errorCode===void 0?(0,e.jsxDEV)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"},void 0,!1):(0,e.jsxDEV)(y,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode},void 0,!1)},void 0,!1),(0,e.jsxDEV)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"},void 0,!1)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsxDEV)(S,{error:L,testId:"flags-error"},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-col gap-2",children:[(0,e.jsxDEV)(k,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")},void 0,!1),(0,e.jsxDEV)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:d(r=>{F(r.target.value)},"onChange"),placeholder:R,rows:3,value:o},void 0,!1),g!==null&&(0,e.jsxDEV)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(g)},void 0,!1),j!==void 0&&(0,e.jsxDEV)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")},void 0,!1)]},void 0,!0),c]},void 0,!0)},"FlagsPanel");export{Y as FlagsPanel};
@@ -0,0 +1 @@
1
+ import{a as V}from"./chunk-XNJNSCLM.js";import{h as w,i as A,j as E}from"./chunk-ITQKVEP7.js";import{a as b}from"./chunk-22C6COGE.js";import{a as x,e as N,g as D,h as H}from"./chunk-RRCPZMC2.js";var g=N(D(),1);var d=N(H(),1);var y=x(k=>{let e=(0,g.c)(26),{className:u,error:t,testId:h}=k,o,l,i,s,a,r,n;if(e[0]!==u||e[1]!==t||e[2]!==h){let v=A(t),p;e[10]!==t?(p=E(t),e[10]=t,e[11]=p):p=e[11],l=p,o=V,i=u,s=h,a="destructive";let m;e[12]!==t?(m=w(t),e[12]=t,e[13]=m):m=e[13],e[14]!==m?(r=(0,d.jsxDEV)("p",{className:"font-medium",children:m},void 0,!1),e[14]=m,e[15]=r):r=e[15],n=v===void 0?null:(0,d.jsxDEV)("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:b(v)},void 0,!1),e[0]=u,e[1]=t,e[2]=h,e[3]=o,e[4]=l,e[5]=i,e[6]=s,e[7]=a,e[8]=r,e[9]=n}else o=e[3],l=e[4],i=e[5],s=e[6],a=e[7],r=e[8],n=e[9];let c;e[16]!==l?(c=l===void 0?null:(0,d.jsxDEV)("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"},void 0,!1),e[16]=l,e[17]=c):c=e[17];let f;return e[18]!==o||e[19]!==i||e[20]!==s||e[21]!==a||e[22]!==r||e[23]!==n||e[24]!==c?(f=(0,d.jsxDEV)(o,{className:i,testId:s,variant:a,children:[r,n,c]},void 0,!0),e[18]=o,e[19]=i,e[20]=s,e[21]=a,e[22]=r,e[23]=n,e[24]=c,e[25]=f):f=e[25],f},"ErrorAlert");export{y as a};
@@ -0,0 +1 @@
1
+ import{D as a,J as j,Y as de,c as J,e as ce,f as le,g as pe,h as fe,ma as me,wa as ge}from"./chunk-SHERR7ZP.js";import{b as H}from"./chunk-5OIBXYZM.js";import{F as B,J as k,O as Y,P as z,h as ue,p as ae}from"./chunk-VL23Y44O.js";import{a as re}from"./chunk-HV7G6DFP.js";import{a as P,c as F,i as ie,r as se}from"./chunk-O3NAGRTR.js";import{g as O,i as w}from"./chunk-CKSHCYGC.js";import{a as we}from"./chunk-3OA7PECS.js";import{a as r,e as b,f as q}from"./chunk-RRCPZMC2.js";var he=b(q(),1),Q=b(re(),1);function $e(e,t){let n=he.useRef(null);function o(u){Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))}),pe(n.current)?.focus()}r(o,"handlePreFocusGuardFocus");function c(u){let i=e.select("positionerElement");if(i&&fe(u,i))e.context.beforeContentFocusGuardRef.current?.focus();else{Q.flushSync(()=>{e.setOpen(!1,z(Y.focusOut,u.nativeEvent,u.currentTarget))});let s=le(e.context.triggerFocusTargetRef.current||t.current);for(;s!==null&&ae(i,s);){let m=s;if(s=ce(s),s===m)break}s?.focus()}}return r(c,"handleFocusTargetFocus"),{preFocusGuardRef:n,handlePreFocusGuardFocus:o,handleFocusTargetFocus:c}}r($e,"useTriggerFocusGuards");var l=b(q(),1),ve=b(re(),1);var M=b(q(),1);function X(e){let t=se(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,c=ie(e),u=c?e.offsetWidth:n,i=c?e.offsetHeight:o;return(J(n)!==u||J(o)!==i)&&(n=u,o=i),{width:n,height:o}}r(X,"getCssDimensions");function Re(e){let{popupElement:t,positionerElement:n,content:o,mounted:c,onMeasureLayout:u,onMeasureLayoutComplete:i,side:s,direction:m}=e,x=k(t,!0,!1),g=B(),p=M.useRef(null),D=M.useRef(!0),f=M.useRef(O),I=F(u),v=F(i),C=M.useMemo(()=>{let h=s==="top",R=s==="left";return m==="rtl"?(h=h||s==="inline-end",R=R||s==="inline-end"):(h=h||s==="inline-start",R=R||s==="inline-start"),h?{position:"absolute",[s==="top"?"bottom":"top"]:"0",[R?"right":"left"]:"0"}:w},[s,m]);P(()=>{if(!c){f.current=O,D.current=!0,p.current=null;return}if(!t||!n)return;f.current=ye(t,C),Z(t,"auto");let h=K(t,"position","static"),R=K(t,"transform","none"),U=K(t,"scale","1"),y=ye(n,{"--available-width":"max-content","--available-height":"max-content"});function T(){h(),R(),y()}r(T,"restoreMeasurementOverrides");function L(){T(),U()}if(r(L,"restoreMeasurementOverridesIncludingScale"),I?.(),D.current||p.current===null){G(n,"max-content");let E=X(t);return p.current=E,G(n,E),L(),v?.(null,E),D.current=!1,()=>{f.current(),f.current=O}}G(n,"max-content");let N=p.current,S=X(t);p.current=S,Z(t,N),L(),v?.(N,S),G(n,S);let $=new AbortController;return g.request(()=>{Z(t,S),x(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},$.signal)}),()=>{$.abort(),g.cancel(),f.current(),f.current=O}},[o,t,n,x,g,c,I,v,C])}r(Re,"usePopupAutoResize");function K(e,t,n){let o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,o)}}r(K,"overrideElementStyle");function ye(e,t){let n=[];for(let[o,c]of Object.entries(t))n.push(K(e,o,c));return n.length?()=>{n.forEach(o=>o())}:O}r(ye,"applyElementStyles");function Z(e,t){let n=t==="auto"?"auto":`${t.width}px`,o=t==="auto"?"auto":`${t.height}px`;e.style.setProperty("--popup-width",n),e.style.setProperty("--popup-height",o)}r(Z,"setPopupCssSize");function G(e,t){let n=t==="max-content"?"max-content":`${t.width}px`,o=t==="max-content"?"max-content":`${t.height}px`;e.style.setProperty("--positioner-width",n),e.style.setProperty("--positioner-height",o)}r(G,"setPositionerCssSize");var A=b(we(),1);function pt(e){let{store:t,side:n,cssVars:o,children:c}=e,u=H(),i=t.useState("activeTriggerElement"),s=t.useState("activeTriggerId"),m=t.useState("open"),x=t.useState("payload"),g=t.useState("mounted"),p=t.useState("popupElement"),D=t.useState("positionerElement"),f=ge(m?i:null),I=Ae(s,x),v=l.useRef(null),[C,h]=l.useState(null),[R,U]=l.useState(null),y=l.useRef(null),T=l.useRef(null),L=k(y,!0,!1),N=B(),[S,$]=l.useState(null),[E,te]=l.useState(!1);P(()=>(t.set("hasViewport",!0),()=>{t.set("hasViewport",!1)}),[t]);let Te=F(()=>{y.current?.style.setProperty("animation","none"),y.current?.style.setProperty("transition","none"),T.current?.style.setProperty("display","none")}),Ee=F(d=>{y.current?.style.removeProperty("animation"),y.current?.style.removeProperty("transition"),T.current?.style.removeProperty("display"),d&&$(d)}),W=l.useRef(null);P(()=>{(!m||!g)&&(W.current=null)},[m,g]),P(()=>{if(i&&f&&i!==f&&W.current!==i&&v.current){h(v.current),te(!0);let d=Me(f,i);U(d),N.request(()=>{ve.flushSync(()=>{te(!1)}),L(()=>{h(null),$(null),v.current=null})}),W.current=i}},[i,f,C,L,N]),P(()=>{let d=y.current;if(!d)return;let oe=ue(d).createElement("div");for(let Oe of Array.from(d.childNodes))oe.appendChild(Oe.cloneNode(!0));v.current=oe});let ne=C!=null,_;ne?_=(0,A.jsxs)(l.Fragment,{children:[(0,A.jsx)("div",{"data-previous":!0,inert:me(!0),ref:T,style:{...S?{[o.popupWidth]:`${S.width}px`,[o.popupHeight]:`${S.height}px`}:null,position:"absolute"},"data-ending-style":E?void 0:""},"previous"),(0,A.jsx)("div",{"data-current":!0,ref:y,"data-starting-style":E?"":void 0,children:c},I)]}):_=(0,A.jsx)("div",{"data-current":!0,ref:y,children:c},I),P(()=>{let d=T.current;!d||!C||d.replaceChildren(...Array.from(C.childNodes))},[C]),Re({popupElement:p,positionerElement:D,mounted:g,content:x,onMeasureLayout:Te,onMeasureLayoutComplete:Ee,side:n,direction:u});let be={activationDirection:Fe(R),transitioning:ne};return{children:_,state:be}}r(pt,"usePopupViewport");function Fe(e){if(e)return`${Pe(e.horizontal,5,"right","left")} ${Pe(e.vertical,5,"down","up")}`}r(Fe,"getActivationDirection");function Pe(e,t,n,o){return e>t?n:e<-t?o:""}r(Pe,"getValueWithTolerance");function Me(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),c={x:n.left+n.width/2,y:n.top+n.height/2},u={x:o.left+o.width/2,y:o.top+o.height/2};return{horizontal:u.x-c.x,vertical:u.y-c.y}}r(Me,"calculateRelativePosition");function Ae(e,t){let[n,o]=l.useState(0),c=l.useRef(e),u=l.useRef(t),i=l.useRef(!1);return P(()=>{let s=c.current,m=u.current,x=e!==s,g=t!==m;x?(o(p=>p+1),i.current=!g):i.current&&g&&(o(p=>p+1),i.current=!1),c.current=e,u.current=t},[e,t]),`${e??"current"}-${n}`}r(Ae,"usePopupContentKey");function Ce(){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new de,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}r(Ce,"getEmptyRootContext");function St(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ce(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:w,inactiveTriggerProps:w,popupProps:w}}r(St,"createInitialPopupStoreState");function xt(e,t,n=!1){return new j({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}r(xt,"createPopupFloatingRootContext");var V=a(e=>e.triggerIdProp??e.activeTriggerId),ee=a(e=>e.openProp??e.open),Se=a(e=>(e.popupElement?.id??e.floatingId)||void 0);function xe(e,t){return t!==void 0&&ee(e)&&V(e)===t}r(xe,"triggerOwnsOpenPopup");function De(e,t){return xe(e,t)?!0:t!==void 0&&ee(e)&&V(e)==null&&e.triggerCount===1}r(De,"triggerOwnsOpenPopupOrIsOnlyTrigger");var Tt={open:ee,mounted:a(e=>e.mounted),transitionStatus:a(e=>e.transitionStatus),floatingRootContext:a(e=>e.floatingRootContext),triggerCount:a(e=>e.triggerCount),preventUnmountingOnClose:a(e=>e.preventUnmountingOnClose),payload:a(e=>e.payload),activeTriggerId:V,activeTriggerElement:a(e=>e.mounted?e.activeTriggerElement:null),popupId:Se,isTriggerActive:a((e,t)=>t!==void 0&&V(e)===t),isOpenedByTrigger:a((e,t)=>xe(e,t)),isMountedByTrigger:a((e,t)=>t!==void 0&&V(e)===t&&e.mounted),triggerProps:a((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:a((e,t)=>De(e,t)?Se(e):void 0),popupProps:a(e=>e.popupProps),popupElement:a(e=>e.popupElement),positionerElement:a(e=>e.positionerElement)};export{St as a,xt as b,Tt as c,$e as d,pt as e};