local-operator-ui 0.36.3 → 0.36.4

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 (72) hide show
  1. package/out/renderer/assets/{_basePickBy-DVPdsJYh.js → _basePickBy-DQ6BzkJm.js} +1 -1
  2. package/out/renderer/assets/{_baseUniq-DiBAxxuH.js → _baseUniq-D4Pzw8OZ.js} +1 -1
  3. package/out/renderer/assets/{agent-details-page-Bbf-ap4W.js → agent-details-page-vUtr6XRL.js} +1 -1
  4. package/out/renderer/assets/{agent-hub-page-CYf0qdg8.js → agent-hub-page-DLfJB8ns.js} +1 -1
  5. package/out/renderer/assets/{agents-page-Ddhn0OiX.js → agents-page-B-PHMFxF.js} +3 -3
  6. package/out/renderer/assets/{arc-Dw2y_5Ul.js → arc-BvXLfjiv.js} +1 -1
  7. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DEF1EAW4.js → architectureDiagram-IEHRJDOE-DGO7ixLg.js} +1 -1
  8. package/out/renderer/assets/{blockDiagram-JOT3LUYC-Si8mcap-.js → blockDiagram-JOT3LUYC-Bpj3zFYQ.js} +1 -1
  9. package/out/renderer/assets/{browser-page-BXSI_6KL.js → browser-page-DAQis2Rt.js} +1 -1
  10. package/out/renderer/assets/{browser-webauthn-prompt-bdks5x_s.js → browser-webauthn-prompt-CLrsocAn.js} +1 -1
  11. package/out/renderer/assets/{c4Diagram-VJAJSXHY-D1lx9sOj.js → c4Diagram-VJAJSXHY-tA5p19nS.js} +1 -1
  12. package/out/renderer/assets/channel-CG3c-hsB.js +1 -0
  13. package/out/renderer/assets/{chunk-4BMEZGHF-B1OoXuiC.js → chunk-4BMEZGHF-CAtpoCnM.js} +1 -1
  14. package/out/renderer/assets/{chunk-A2AXSNBT-Cr084INE.js → chunk-A2AXSNBT-CYHy7Mvk.js} +1 -1
  15. package/out/renderer/assets/{chunk-AEK57VVT-6BBu10_U.js → chunk-AEK57VVT-B2bXanTe.js} +1 -1
  16. package/out/renderer/assets/{chunk-D6G4REZN-DIlAHP8p.js → chunk-D6G4REZN-DfhdrNKB.js} +1 -1
  17. package/out/renderer/assets/{chunk-RZ5BOZE2-Da0rWE9o.js → chunk-RZ5BOZE2-BNdcLGHR.js} +1 -1
  18. package/out/renderer/assets/{chunk-XZIHB7SX-BtHW2mRW.js → chunk-XZIHB7SX-Caa_mRlB.js} +1 -1
  19. package/out/renderer/assets/classDiagram-GIVACNV2-BGWu-T14.js +1 -0
  20. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BGWu-T14.js +1 -0
  21. package/out/renderer/assets/clone-UwOnPjS7.js +1 -0
  22. package/out/renderer/assets/{conversation-input-sync-neD8lOHF.js → conversation-input-sync-CJiOSzCX.js} +250 -250
  23. package/out/renderer/assets/{dagre-OKDRZEBW-QJnzHJrX.js → dagre-OKDRZEBW-pq4RiyaY.js} +1 -1
  24. package/out/renderer/assets/{diagram-SSKATNLV-CblG8bwr.js → diagram-SSKATNLV-DnlzCGD2.js} +1 -1
  25. package/out/renderer/assets/{diagram-VNBRO52H-D9VlUgES.js → diagram-VNBRO52H-DbJ2RTVe.js} +1 -1
  26. package/out/renderer/assets/{erDiagram-Q7BY3M3F-CYdAsxl1.js → erDiagram-Q7BY3M3F-C56WVcbc.js} +1 -1
  27. package/out/renderer/assets/{flowDiagram-4HSFHLVR-EKGuFRMH.js → flowDiagram-4HSFHLVR-CL1GRaaq.js} +1 -1
  28. package/out/renderer/assets/{ganttDiagram-APWFNJXF-yTSMo4Sy.js → ganttDiagram-APWFNJXF-CES2U6dP.js} +1 -1
  29. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-e48WwwO4.js → gitGraphDiagram-7IBYFJ6S-CRyPEqXz.js} +1 -1
  30. package/out/renderer/assets/{graph-BFjFFISR.js → graph-Dtsej9jG.js} +1 -1
  31. package/out/renderer/assets/{index-CY29neUf.js → index-BsV4LVu3.js} +1 -1
  32. package/out/renderer/assets/{index-CZI34YVW.js → index-D0l2JJ6w.js} +3 -3
  33. package/out/renderer/assets/{index-Cb5EO4yE.js → index-DAoplO_Z.js} +1 -1
  34. package/out/renderer/assets/{infoDiagram-PH2N3AL5-BWXZd-TM.js → infoDiagram-PH2N3AL5-BwRaN2ZH.js} +1 -1
  35. package/out/renderer/assets/{journeyDiagram-U35MCT3I-DKPVvkIm.js → journeyDiagram-U35MCT3I-CwrSuzth.js} +1 -1
  36. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-ChDhsrXv.js → kanban-definition-NDS4AKOZ-CjW130n-.js} +1 -1
  37. package/out/renderer/assets/{layout-BOqocwgL.js → layout-DnBx2qbk.js} +1 -1
  38. package/out/renderer/assets/{legacy-agents-page-BSdAE-Bg.js → legacy-agents-page-BiAHAYWZ.js} +1 -1
  39. package/out/renderer/assets/{library-page-BHX5kaQb.js → library-page-BGmng_P-.js} +3 -3
  40. package/out/renderer/assets/{mermaid.core-CWiad1OO.js → mermaid.core-BHqZ2SZO.js} +5 -5
  41. package/out/renderer/assets/{mesh-page-BEVPzgDt.js → mesh-page-1yPLxWRO.js} +1 -1
  42. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-2i781X8G.js → mindmap-definition-ALO5MXBD-Ca2VY79V.js} +1 -1
  43. package/out/renderer/assets/{mini-Bs0TB08-.js → mini-Dd3N58po.js} +1 -1
  44. package/out/renderer/assets/{org-access-CJm_anOl.js → org-access-WIuI99P6.js} +1 -1
  45. package/out/renderer/assets/{org-surface-gate-DbysPTcD.js → org-surface-gate-BsP8aWCi.js} +1 -1
  46. package/out/renderer/assets/{pieDiagram-IB7DONF6-B9lioqV6.js → pieDiagram-IB7DONF6-C7lP9J7V.js} +1 -1
  47. package/out/renderer/assets/{projects-page-ZT73ye5v.js → projects-page-BIRVv4yi.js} +1 -1
  48. package/out/renderer/assets/{publication-validation-CyRIAFX-.js → publication-validation-C73bqNja.js} +1 -1
  49. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-D2U4lJl9.js → quadrantDiagram-7GDLP6J5-CPMEK8EO.js} +1 -1
  50. package/out/renderer/assets/{radar-MK3ICKWK-CGhy5L8a.js → radar-MK3ICKWK-sbfBaJo0.js} +1 -1
  51. package/out/renderer/assets/{radient-auth-buttons-DneyxZkw.js → radient-auth-buttons-C0ljZy4O.js} +1 -1
  52. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-Cmc8UYRV.js → requirementDiagram-KVF5MWMF-S2rhrmTH.js} +1 -1
  53. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-B_CbdQsw.js → sankeyDiagram-QLVOVGJD-sNpc3Wfn.js} +1 -1
  54. package/out/renderer/assets/{schedules-page-B4YBOXYX.js → schedules-page-DbZSRb3g.js} +1 -1
  55. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-Bafdaefv.js → sequenceDiagram-X6HHIX6F-Cv-47OeQ.js} +1 -1
  56. package/out/renderer/assets/{settings-page-7C4s3Pn-.js → settings-page-DH9sXfEW.js} +1 -1
  57. package/out/renderer/assets/{smartart-CrK5frje.js → smartart-C2eRO4WK.js} +1 -1
  58. package/out/renderer/assets/{stateDiagram-DGXRK772-y86P6pOD.js → stateDiagram-DGXRK772-DIBWf8qm.js} +1 -1
  59. package/out/renderer/assets/{stateDiagram-v2-YXO3MK2T-CqZEeEIQ.js → stateDiagram-v2-YXO3MK2T-DBPLNjJl.js} +1 -1
  60. package/out/renderer/assets/{tags-input-chips-GdqiLTXD.js → tags-input-chips-B4_gHGYO.js} +1 -1
  61. package/out/renderer/assets/{timeline-definition-BDJGKUSR-QGAbBb-D.js → timeline-definition-BDJGKUSR-CE8q2f33.js} +1 -1
  62. package/out/renderer/assets/{use-download-agent-mutation-DS3LpOcX.js → use-download-agent-mutation-LdjExo2g.js} +1 -1
  63. package/out/renderer/assets/{use-memberships-query-DUb5oPXP.js → use-memberships-query-DcD9UeVY.js} +1 -1
  64. package/out/renderer/assets/{use-session-snapshot-C_Px0a_8.js → use-session-snapshot-Cqye2iDz.js} +1 -1
  65. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-xB9WOxhm.js → xychartDiagram-VJFVF3MP-DlbgdRgT.js} +1 -1
  66. package/out/renderer/index.html +2 -2
  67. package/out/renderer/mini.html +3 -3
  68. package/package.json +2 -2
  69. package/out/renderer/assets/channel-Cq3l3rsO.js +0 -1
  70. package/out/renderer/assets/classDiagram-GIVACNV2-DoZsDzLJ.js +0 -1
  71. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DoZsDzLJ.js +0 -1
  72. package/out/renderer/assets/clone-aroLRPNj.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-Bbf-ap4W.js","./index-hX_aZwq0.js","./index-vPvXCaIy.css","./publication-validation-CyRIAFX-.js","./conversation-input-sync-neD8lOHF.js","./ui-preferences-store-C6eXGzFs.js","./error-boundary-Tv9TlaZ8.js","./conversation-input-sync-CAX4_ErH.css","./use-memberships-query-DUb5oPXP.js","./use-download-agent-mutation-DS3LpOcX.js","./en-US-CHJkXXr4.js","./book-open-DeWHPw1t.js","./console-mirror-BnHVC7eO.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-CYf0qdg8.js","./page-header-ggruiR-O.js","./org-access-CJm_anOl.js","./radient-auth-buttons-DneyxZkw.js","./format-esAOn2VS.js","./org-surface-gate-DbysPTcD.js","./agents-page-Ddhn0OiX.js","./schedules-page-B4YBOXYX.js","./parseISO-BHJWTxrA.js","./projects-page-ZT73ye5v.js","./use-session-snapshot-C_Px0a_8.js","./arrow-up-D8Tgt51O.js","./library-page-BHX5kaQb.js","./tags-input-chips-GdqiLTXD.js","./browser-page-BXSI_6KL.js","./mesh-page-BEVPzgDt.js","./settings-page-7C4s3Pn-.js","./notebook-pen-CcH01r1l.js","./browser-webauthn-prompt-bdks5x_s.js"])))=>i.map(i=>d[i]);
2
- import{r as g,j as c,c as R,b as ze,i as yF,p as Oz,y as Lz,o as Bz,t as x,z as gS,L as Ho,A as jz,a as Hz,R as Uz}from"./index-hX_aZwq0.js";import{ar as _e,en as Gz,eo as mS,ep as lC,cz as Kx,bI as zc,cx as to,bQ as gT,C as ps,ah as Ra,ai as Ts,a4 as qt,aK as qn,aL as hs,u as sn,a3 as fu,aR as K0,cA as Vz,aS as Y0,eq as cB,er as Wz,a as Ln,c as yt,e as X0,es as Wm,et as $z,eu as zz,ev as qz,ew as Kz,aO as uB,aN as si,ex as mT,ey as Fo,ez as Oy,eA as Ly,c9 as Dl,c0 as vT,d6 as tc,cN as Yx,cM as Yz,cL as tr,cO as ln,eB as dB,eC as Xz,eD as vS,d as vt,Z as Ci,cU as xT,dq as Qz,ay as Xa,D as bT,eE as _F,eF as Jz,eG as Zz,eH as xS,eI as eq,eJ as tq,eK as nq,eL as sq,aC as pf,eM as SF,eN as EF,eO as rq,eP as iq,eQ as aq,eR as hB,eS as oq,eT as lq,eU as fB,eV as cC,eW as uC,eX as cq,eY as uq,eZ as dq,e_ as kF,e$ as hq,f0 as rf,f1 as pB,f2 as fq,f3 as pq,f4 as gq,f5 as mq,f6 as vq,f7 as xq,f8 as bq,f9 as gB,fa as wq,fb as Cq,a0 as ni,fc as mB,fd as yq,fe as TF,ff as _q,fg as Sq,c7 as Yi,fh as dC,fi as vB,fj as Eq,fk as kq,fl as RF,fm as Tq,fn as Rq,aT as yp,fo as Aq,fp as Fq,fq as Dq,bq as xB,fr as Pq,fs as Iq,ft as Nq,ei as bB,fu as Mq,bH as Xo,fv as Oq,fw as Lq,bG as Rd,fx as tu,fy as Bq,ad as wT,fz as AF,fA as jq,fB as Hq,fC as Uq,fD as Gq,fE as Vq,fF as Wq,fG as Kh,dh as $q,fH as zq,fI as qq,dk as Kq,fJ as hC,fK as bS,fL as fC,fM as Yq,fN as Xq,fO as Qq,fP as Jq,at as ud,fQ as By,_ as wB,fR as CB,aV as yB,aX as Wi,fS as CT,fT as Zq,bu as wS,aP as yT,de as pC,fU as _B,fV as eK,bM as nu,c2 as gC,fW as tK,b$ as mC,bE as Ad,fX as nK,fY as sK,fZ as rK,f_ as iK,f$ as aK,g0 as oK,g1 as lK,g2 as cK,g3 as FF,g4 as uK,g5 as dK,g6 as _T,g7 as DF,dm as hK,g8 as fK,g9 as SB,ga as pK,gb as gK,gc as EB,gd as CS,ge as mK,b as kB,gf,gg as _p,gh as vK,gi as ST,bv as xK,gj as bK,gk as wK,gl as CK,gm as PF,gn as yK,c3 as vC,go as _K,gp as SK,gq as TB,gr as RB,gs as EK,gt as AB,gu as Eb,gv as kK,gw as TK,gx as RK,gy as AK,gz as FK,gA as DK,gB as PK,av as ns,gC as IK,au as Lc,gD as FB,gE as DB,gF as NK,gG as MK,gH as OK,gI as ET,gJ as LK,gK as PB,cC as xC,cD as bC,gL as wC,gM as Aa,gN as BK,gO as kn,gP as en,gQ as Q0,gR as $m,gS as CC,gT as kT,gU as yC,gV as jK,gW as HK,gX as UK,gY as pn,gZ as zm,g_ as IB,g$ as ha,h0 as Fd,h1 as GK,h2 as NB,h3 as VK,h4 as WK,h5 as IF,h6 as $K,h7 as zK,h8 as qK,c1 as KK,h9 as YK,ha as mf,hb as MB,hc as OB,hd as TT,he as kb,hf as LB,V as RT,hg as yS,hh as AT,hi as jy,hj as XK,hk as QK,hl as JK,hm as af,hn as _S,ho as BB,hp as ZK,hq as jB,hr as eY,hs as tY,ht as nY,hu as sY,hv as rY,hw as iY,hx as aY,hy as oY,hz as lY,hA as cY,hB as Tb,hC as uY,hD as dY,hE as hY,hF as fY,hG as pY,hH as gY,hI as FT,hJ as mY,hK as HB,I as st,hL as vY,hM as _C,hN as Dd,bP as UB,bT as xY,hO as NF,bl as GB,hP as bY,hQ as wY,hR as CY,hS as yY,hT as _Y,hU as SY,aA as Er,hV as EY,hW as kY,hX as TY,hY as RY,hZ as AY,h_ as FY,h$ as DY,i0 as PY,i1 as IY,i2 as NY,i3 as MY,i4 as OY,i5 as qm,i6 as VB,i7 as Rb,i8 as Wf,i9 as SC,ia as DT,ib as LY,ic as BY,id as jY,ie as WB,ig as HY,ih as MF,ii as UY,ij as PT,ik as GY,il as IT,im as J0,io as Z0,ip as VY,iq as $B,ir as Km,is as WY,it as $Y,iu as zY,iv as qY,iw as KY,ix as YY,iy as OF,iz as zB,cd as qB,iA as XY,iB as QY,iC as JY,aW as $f,iD as ZY,c6 as eX,iE as LF,iF as tX,iG as nX,iH as KB,iI as BF,iJ as sX,iK as rX,iL as iX,iM as YB,iN as Hy,iO as aX,iP as XB,bD as rm,iQ as NT,e7 as oX,iR as lX,bS as MT,iS as qc,iT as OT,iU as LT,iV as cX,bz as uX,bA as EC,bx as zf,iW as QB,iX as dX,iY as JB,iZ as ZB,cK as Uy,aM as ev,i_ as jF,i$ as hX,j0 as Ab,j1 as HF,j2 as fX,bN as UF,j3 as pX,j4 as gX,j5 as mX,j6 as SS,j7 as vX,j8 as GF,ct as Yh,j9 as xX,ja as bX,c8 as wX,jb as CX,jc as e6,cu as yX,ce as _X,jd as SX,je as EX,jf as kX,jg as TX,d5 as RX,jh as AX,ji as BT,jj as FX,jk as DX,jl as Uv,jm as t6,jn as ES,a8 as VF,cZ as PX,jo as IX,jp as NX,jq as dd,dJ as n6,dK as jT,jr as MX,js as OX,jt as LX,ju as s6,cc as BX,jv as WF,ae as $F,jw as jX,aD as r6,dI as HX,jx as im,jy as UX,bL as i6,jz as GX,jA as VX,jB as WX,jC as $X,jD as zX,jE as qX,jF as KX,bn as zF,bo as qF,bp as KF,aB as YX,jG as XX,jH as QX,jI as JX,jJ as Ah,jK as Fh,jL as ZX,jM as eQ,jN as tQ,jO as nQ,jP as a6,jQ as sQ,jR as o6,jS as kS,jT as TS,jU as Gy,jV as rQ,jW as iQ,jX as Xh,jY as aQ,aq as Fb,as as l6,aw as oQ,aa as YF,jZ as lQ,j_ as cQ,j$ as uQ,k0 as dQ,k1 as hQ,k2 as fQ,k3 as pQ,k4 as c6,k5 as gQ,k6 as RS,k7 as u6,k8 as d6,k9 as mQ,ka as vQ,kb as xQ,kc as bQ,kd as h6,ke as Sp,kf as wQ,kg as CQ,kh as HT,br as yQ,ki as _Q,kj as SQ,kk as EQ,kl as kQ,km as TQ,kn as RQ,ko as AQ,kp as FQ,kq as DQ,kr as PQ,bm as IQ,ks as XF,kt as NQ,ku as MQ,kv as Vy,kw as QF,kx as OQ,ky as LQ,kz as BQ,kA as jQ,kB as HQ,kC as UQ,kD as GQ,kE as VQ,kF as WQ,kG as $Q,kH as zQ,kI as qQ,kJ as KQ,kK as YQ,kL as XQ,kM as QQ,kN as JQ,kO as JF,kP as ZQ,kQ as eJ,al as tJ,am as nJ,an as sJ,ao as rJ,ap as iJ,kR as aJ,kS as oJ,kT as lJ,kU as cJ,kV as uJ,ax as dJ,kW as hJ,kX as fJ,kY as pJ,kZ as ZF,dl as f6,k_ as UT,k$ as gJ,aU as p6,l0 as g6,l1 as mJ,l2 as vJ,l3 as m6,l4 as xJ,l5 as kr,l6 as bJ,l7 as kc,l8 as v6,l9 as x6,la as b6,lb as GT,lc as Mi,ld as wJ,le as CJ,lf as yJ,lg as _J,lh as SJ,li as EJ,lj as kJ,lk as TJ,ll as RJ,lm as AJ,ln as FJ,lo as w6,lp as DJ,lq as PJ,lr as IJ,ls as NJ,lt as MJ,lu as AS,lv as OJ,lw as LJ,lx as eD,ly as C6,lz as BJ,lA as jJ,lB as HJ,lC as tD,lD as UJ,lE as GJ,lF as VJ,lG as WJ,lH as $J,lI as zJ,lJ as qJ,lK as KJ,lL as y6,lM as YJ,lN as XJ,d4 as Db,lO as QJ,dB as JJ,lP as nD,lQ as ZJ,lR as eZ,lS as tZ,da as nZ,ds as sZ,lT as rZ,lU as iZ,lV as aZ,B as _6,dr as sD,lW as oZ,af as lZ,bF as uo,lX as cZ,lY as uZ,lZ as dZ,l_ as Cr,aY as rD,l$ as Dh,m0 as hZ,m1 as Pb,m2 as fZ,m3 as iD,m4 as pZ,m5 as Wy,m6 as $y,m7 as aD,m8 as zy,m9 as oD,ma as S6,mb as E6,aJ as gZ,mc as k6,md as mZ,aG as vZ,aH as xZ,aE as bZ,aF as wZ,me as CZ,aI as yZ}from"./conversation-input-sync-neD8lOHF.js";import{c as ct,ai as _Z,aj as T6,ak as SZ,al as EZ,am as kZ,an as TZ,ao as RZ,ap as AZ,aq as ag,ar as FZ,f as oo,S as gn,q as ho,u as _t,a as ie,L as lr,I as Bn,T as VT,h as Us,X as Tn,a8 as FS,as as Pl,D as _a,b as Sa,e as $i,z as Ea,y as Ir,p as tv,i as qf,ah as kC,m as Ze,a0 as Ep,d as Pd,A as Jr,g as Id,F as Ym,G as Xm,H as Qm,J as Jm,K as Zm,r as zl,s as Qo,t as ql,v as DS,w as Zr,x as Gt,at as kp,au as DZ,av as PZ,B as Kl,af as R6,aw as PS,ax as IZ,ay as NZ,az as MZ,Y as A6,Z as F6,_ as IS,l as Xx,ag as OZ,a1 as e0,a2 as D6,a3 as Kf,aA as vf,aB as LZ,C as P6,M as NS,j as I6,aC as BZ,k as N6,aD as jZ,aE as lD,a4 as HZ,ad as MS,aF as og,aG as WT,N as $T,$ as UZ,a5 as GZ,a6 as VZ,a7 as WZ,ab as $Z,ac as zZ,a9 as qZ,aa as KZ,aH as YZ,aI as XZ,aJ as M6,n as cD,o as uD,E as QZ}from"./error-boundary-Tv9TlaZ8.js";import{e as th,g as O6,t as dD,v as qy,w as JZ,x as OS,n as LS,y as ZZ,u as qe,z as L6,A as B6,B as TC,S as eee,C as j6,E as tee,R as nee,F as see,G as Il,H as hD,I as ree,J as iee,L as aee,M as fD,N as RC,O as oee,Q as lee,U as Bg,V as cee,W as H6,X as uee,Y as pD,Z as gD,_ as dee,$ as mD,a0 as hee,a1 as Mu,a2 as Gv,a3 as fee,a4 as pee,a5 as gee,a6 as vD,a7 as xD,a8 as mee,a9 as vee,aa as xee,ab as bee,ac as bD,ad as wD,ae as CD,af as wee,ag as Cee,ah as yee,ai as _ee,aj as See,ak as yD,al as Eee,am as kee,an as _D,ao as Tee,ap as Ree,aq as Aee,ar as Fee,as as Dee,at as Pee,au as U6,s as SD,av as Iee,T as Nee,aw as Mee,ax as Oee,ay as Lee,az as Vv,aA as Wv,aB as ED,aC as $v,aD as zv,aE as kD,aF as TD,aG as Bee,aH as Qx,aI as jee,aJ as Hee,aK as Uee,aL as Gee,aM as RD,aN as Vee,aO as Wee,aP as AD,aQ as $ee}from"./ui-preferences-store-C6eXGzFs.js";import{C as zee}from"./console-mirror-BnHVC7eO.js";const BS=8e3,G6=1e4;function qee(e){return e?`“${e}”`:"Conversation"}const Kee="archived.";function Yee(e){return _e.getState().archiveFacts[e]}function Xee(e){const t=_e.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Qee(){const e=_e(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=_e.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&_e.getState().setArchiveUndo(null)},r=_e.subscribe(()=>{const i=Yee(e.sessionId);i!==void 0&&!i.answered||Gz(e.archived,Xee(e.sessionId))||s()});return n},[e])}function Jee(e){return e===1?"Draft":`${e} drafts`}const Zee="discarded.",ete=e=>{const t=mS(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>lC(o)!==null&&mS([o]).length===0).length,a=[`Mark ${n} unread ${r} as read${s>0?`, including ${s} in Previous chats`:""}.`];return i>0&&a.push(`${i} unread ${i===1?"mark":"marks"} with no completion token cannot be cleared.`),{count:n,label:`Mark all ${n} read`,scope:a.join(" "),nameSuffix:s>0?`, including ${s} in Previous chats`:""}},V6=e=>e===1?"1 lives on another device and clears when that device updates.":`${e} live on other devices and clear when those devices update.`,tte=e=>{if(e.attempted===0)return{tone:"success",message:"Nothing to clear."};const t=e.unknown-e.deferred,n=[e.superseded>0?`${e.superseded} ${e.superseded===1?"has a newer result and stays":"have newer results and stay"} unread.`:null,t>0?`${t} could not be cleared and ${t===1?"stays":"stay"} unread.`:null,e.deferred>0?V6(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:["Nothing was cleared.",...n].join(" ")}:{tone:"success",message:[`Marked ${e.cleared} ${e.cleared===1?"chat":"chats"} as read.`,...n].join(" ")}},Ky="archive",FD="drafts-undo",DD="bulk-read-deferral",nte=8e3;function ste(){const e=_e(h=>h.archiveFailure),t=_e(h=>h.archiveUndo),n=_e(h=>h.draftsUndo),s=_e(h=>h.bulkReadDeferral),r=_e(h=>h.clearArchiveFailure),i=_e(h=>h.setArchiveUndo),a=_e(h=>h.setSessionArchived),o=_e(h=>h.restoreDraftsUndo);Qee();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,Kx(Ky);return}const h=e&&t?t.at>e.at?"offer":"failure":e?"failure":"offer",f=h==="offer"?t?.at??0:e?.at??0,p=l.current;l.current={kind:h,at:f},p!==null&&p.kind!==h&&f>p.at&&(h==="failure"?i(null):r());const m=(v,b)=>()=>{const w=_e.getState();v==="offer"?w.archiveUndo?.at===b&&w.setArchiveUndo(null):w.archiveFailure?.at===b&&w.clearArchiveFailure();const C=l.current;C!==null&&C.kind===v&&C.at===b&&(l.current=null)};if(h==="failure"&&e){zc(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:Ky,duration:G6,onAutoClose:m("failure",e.at),onDismiss:m("failure",e.at),action:{label:"Retry",onClick:v=>{v.preventDefault(),a(e.sessionId,e.archived,e.title)}}});return}t&&to(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:qee(t.title)}),c.jsx("span",{className:R("shrink-0"),children:Kee})]}),{id:Ky,duration:BS,classNames:{content:"min-w-0"},onAutoClose:m("offer",t.at),onDismiss:m("offer",t.at),action:{label:"Undo",onClick:v=>{v.preventDefault(),a(t.sessionId,!t.archived,t.title)}}})},[e,t,i,r,a]);const u=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!u.current)return;u.current=!1,Kx(FD);return}u.current=!0;const h=()=>{const f=_e.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),u.current=!1)};to(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Jee(n.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:Zee})]}),{id:FD,duration:BS,classNames:{content:"min-w-0"},onAutoClose:h,onDismiss:h,action:{label:"Undo",onClick:f=>{f.preventDefault(),o();const p=_e.getState(),m=p.stagedByDiscard;p.setStagedByDiscard(null),n.keys.length===1&&m!==null&&_e.getState().activeDraftKey===m&&_e.getState().openDraft(n.keys[0])}}})},[n,o]);const d=g.useRef(!1);return g.useEffect(()=>{if(s===null){if(!d.current)return;d.current=!1,Kx(DD);return}d.current=!0;const h=()=>{const f=_e.getState();f.bulkReadDeferral?.at===s.at&&(f.clearBulkReadDeferral(),d.current=!1)};to(V6(s.count),{id:DD,duration:nte,onAutoClose:h,onDismiss:h})},[s]),null}var Qa,je=typeof window<"u"?window:void 0,fi=typeof globalThis<"u"?globalThis:je,W6=Array.prototype,PD=W6.forEach,ID=W6.indexOf,Hi=fi?.navigator,St=fi?.document,di=fi?.location,jS=fi?.fetch,HS=fi!=null&&fi.XMLHttpRequest&&"withCredentials"in new fi.XMLHttpRequest?fi.XMLHttpRequest:void 0,ND=fi?.AbortController,Bs=Hi?.userAgent,Vt=je??{},kl={DEBUG:!1,LIB_VERSION:"1.235.6"},Yy="$copy_autocapture",rte=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(Qa||(Qa={}));var ite=["fatal","error","warning","log","info","debug"];function Zt(e,t){return e.indexOf(t)!==-1}var AC=function(e){return e.trim()},zT=function(e){return e.replace(/^\$/,"")},ate=Array.isArray,$6=Object.prototype,z6=$6.hasOwnProperty,FC=$6.toString,cs=ate||function(e){return FC.call(e)==="[object Array]"},no=e=>typeof e=="function",us=e=>e===Object(e)&&!cs(e),of=e=>{if(us(e)){for(var t in e)if(z6.call(e,t))return!1;return!0}return!1},Ct=e=>e===void 0,Hs=e=>FC.call(e)=="[object String]",US=e=>Hs(e)&&e.trim().length===0,pu=e=>e===null,En=e=>Ct(e)||pu(e),Qr=e=>FC.call(e)=="[object Number]",Rl=e=>FC.call(e)==="[object Boolean]",ote=e=>e instanceof FormData,lte=e=>Zt(rte,e),q6=e=>{var t={_log:function(n){if(je&&(kl.DEBUG||Vt.POSTHOG_DEBUG)&&!Ct(je.console)&&je.console){for(var s=("__rrweb_original__"in je.console[n])?je.console[n].__rrweb_original__:je.console[n],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];s(e,...i)}},info:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];console.error(e,...s)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>q6("".concat(e," ").concat(n))};return t},At=q6("[PostHog.js]"),Or=At.createLogger,cte=Or("[ExternalScriptsLoader]"),MD=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return cte.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=St?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!St)return n("document not found");var a=St.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=u=>n(void 0,u),a.onerror=u=>n(u),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=St.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):St.body.appendChild(a)};St!=null&&St.body?i():St?.addEventListener("DOMContentLoaded",i)};function OD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function We(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OD(Object(n),!0).forEach(function(s){ft(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ft(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K6(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},h=Object.keys(a);for(u=0;u<h.length;u++)l=h[u],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}Vt.__PosthogExtensions__=Vt.__PosthogExtensions__||{},Vt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(s="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var r=3e5,i=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",s);MD(e,a,n)},Vt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);MD(e,s,n)};var Ib={};function Kc(e,t,n){if(cs(e)){if(PD&&e.forEach===PD)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===Ib)return}}}function Mn(e,t,n){if(!En(e)){if(cs(e))return Kc(e,t,n);if(ote(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===Ib)return}else for(var r in e)if(z6.call(e,r)&&t.call(n,e[r],r)===Ib)return}}var ys=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Kc(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},Jx=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Kc(n,function(r){Kc(r,function(i){e.push(i)})}),e};function Zx(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var LD=function(e){try{return e()}catch{return}},ute=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(this,n)}catch(r){At.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),At.critical(r)}}},t0=function(e){var t={};return Mn(e,function(n,s){Hs(n)&&n.length>0&&(t[s]=n)}),t};function dte(e,t){return n=e,s=i=>Hs(i)&&!pu(t)?i.slice(0,t):i,r=new Set,function i(a,o){return a!==Object(a)?s?s(a,o):a:r.has(a)?void 0:(r.add(a),cs(a)?(l=[],Kc(a,u=>{l.push(i(u))})):(l={},Mn(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var hte=["herokuapp.com","vercel.app","netlify.app"];function fte(e){var t=e?.hostname;if(!Hs(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of hte)if(n===s)return!1;return!0}function Y6(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Ss(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var X6="$people_distinct_id",jg="__alias",Hg="__timers",BD="$autocapture_disabled_server_side",GS="$heatmaps_enabled_server_side",jD="$exception_capture_enabled_server_side",HD="$web_vitals_enabled_server_side",Q6="$dead_clicks_enabled_server_side",UD="$web_vitals_allowed_metrics",VS="$session_recording_enabled_server_side",GD="$console_log_recording_enabled_server_side",VD="$session_recording_network_payload_capture",WD="$session_recording_masking",$D="$session_recording_canvas_recording",zD="$replay_sample_rate",qD="$replay_minimum_duration",KD="$replay_script_config",Nb="$sesid",Ug="$session_is_sampled",Xy="$session_recording_url_trigger_activated_session",Qy="$session_recording_event_trigger_activated_session",lf="$enabled_feature_flags",eb="$early_access_features",WS="$feature_flag_details",Gg="$stored_person_properties",Wu="$stored_group_properties",$S="$surveys",qv="$surveys_activated",Mb="$flag_call_reported",_l="$user_state",zS="$client_session_props",qS="$capture_rate_limit",KS="$initial_campaign_params",YS="$initial_referrer_info",XS="$initial_person_info",Ob="$epp",J6="__POSTHOG_TOOLBAR__",YD="$posthog_cookieless",pte=[X6,jg,"__cmpns",Hg,VS,GS,Nb,lf,_l,eb,WS,Wu,Gg,$S,Mb,zS,qS,KS,YS,Ob];function XD(e){var t;return e instanceof Element&&(e.id===J6||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function DC(e){return!!e&&e.nodeType===1}function Yc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Z6(e){return!!e&&e.nodeType===3}function ej(e){return!!e&&e.nodeType===11}function qT(e){return e?AC(e).split(/\s+/):[]}function QD(e){var t=je?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Lb(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return qT(t)}function tj(e){return En(e)?null:AC(e).split(/(\s+)/).filter(t=>Yf(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function PC(e){var t="";return JS(e)&&!rj(e)&&e.childNodes&&e.childNodes.length&&Mn(e.childNodes,function(n){var s;Z6(n)&&n.textContent&&(t+=(s=tj(n.textContent))!==null&&s!==void 0?s:"")}),AC(t)}function nj(e){return Ct(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var QS=["a","button","form","input","select","textarea","label"];function sj(e){var t=e.parentNode;return!(!t||!DC(t))&&t}function gte(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!je||!e||Yc(e,"html")||!DC(e)||n!=null&&n.url_allowlist&&!QD(n.url_allowlist)||n!=null&&n.url_ignorelist&&QD(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(p=>t.type===p))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Yc(u,"body");)if(ej(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=sj(u)))break;if(s||QS.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=je.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(p,m){var v=m?.element_allowlist;if(Ct(v))return!0;var b=function(y){if(v.some(k=>y.tagName.toLowerCase()===k))return{v:!0}};for(var w of p){var C=b(w);if(typeof C=="object")return C.v}return!1}(o,n)||!function(p,m){var v=m?.css_selector_allowlist;if(Ct(v))return!0;var b=function(y){if(v.some(k=>y.matches(k)))return{v:!0}};for(var w of p){var C=b(w);if(typeof C=="object")return C.v}return!1}(o,n))return!1;var h=je.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var f=e.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(QS.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function JS(e){for(var t=e;t.parentNode&&!Yc(t,"body");t=t.parentNode){var n=Lb(t);if(Zt(n,"ph-sensitive")||Zt(n,"ph-no-capture"))return!1}if(Zt(Lb(e),"ph-include"))return!0;var s=e.type||"";if(Hs(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(Hs(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function rj(e){return!!(Yc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Yc(e,"select")||Yc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ij="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",mte=new RegExp("^(?:".concat(ij,")$")),vte=new RegExp(ij),aj="\\d{3}-?\\d{2}-?\\d{4}",xte=new RegExp("^(".concat(aj,")$")),bte=new RegExp("(".concat(aj,")"));function Yf(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(En(e)||Hs(e)&&(e=AC(e),(t?mte:vte).test((e||"").replace(/[- ]/g,""))||(t?xte:bte).test(e)))}function oj(e){var t=PC(e);return Yf(t="".concat(t," ").concat(lj(e)).trim())?t:""}function lj(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Mn(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=PC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(lj(n)).trim())}catch(i){At.error("[AutoCapture]",i)}}),t}function wte(e){return function(t){var n=t.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var o of(s.attr_class.sort(),s.attr_class))a+=".".concat(o.replace(/"/g,""));var l=We(We(We(We({},s.text?{text:s.text}:{}),{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{}),s.attr_id?{attr_id:s.attr_id}:{}),s.attributes),u={};return Zx(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return u[JD(h.toString())]=JD(f.toString())}),a+=":",a+=Zx(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var s,r,i={text:(s=n.$el_text)===null||s===void 0?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)===null||r===void 0?void 0:r.slice(0,2048),attr_class:Cte(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return i.attributes[o]=l}),i})}(e))}function JD(e){return e.replace(/"|\\"/g,'\\"')}function Cte(e){var t=e.attr__class;return t?cs(t)?t:qT(t):void 0}class cj{constructor(){this.clicks=[]}isRageClick(t,n,s){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(n-r.y)<30&&s-r.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var yte=["localhost","127.0.0.1"],xf=e=>{var t=St?.createElement("a");return Ct(t)?null:(t.href=e,t)},_te=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return Mn(e,function(i,a){Ct(i)||Ct(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(s)},Bb=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===t){n=i;break}}if(!cs(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{At.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Jy=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),d=[],h=0;h<u.length;h++){var f=u[h].split("=");cs(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(u[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},jb=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ZD=Or("[AutoCapture]");function Zy(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ste(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!DC(t));return t}function Ete(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};QS.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Zy(1024,oj(e)):i.$el_text=Zy(1024,PC(e)));var a=Lb(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Mn(e.attributes,function(d){var h;if((!rj(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Yf(d.value)&&(h=d.name,!Hs(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=qT(f).join(" ")),i["attr__"+d.name]=Zy(1024,f)}});for(var o=1,l=1,u=e;u=Ste(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function kte(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Yc(d,"body");)ej(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Mn(u,k=>{var _=JS(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&Yf(m)&&m),Zt(Lb(k),"ph-no-capture")&&(v=!0),f.push(Ete(k,i,a,o));var E=function(T){if(!JS(T))return{};var A={};return Mn(T.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var I=F.name.replace("data-ph-capture-attribute-",""),M=F.value;I&&M&&Yf(M)&&(A[I]=M)}}),A}(k);ys(p,E)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=oj(e):f[0].$el_text=PC(e)),m){var b,w;f[0].attr__href=m;var C=(b=xf(m))===null||b===void 0?void 0:b.host,y=je==null||(w=je.location)===null||w===void 0?void 0:w.host;C&&y&&C!==y&&(h=m)}return{props:ys({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:wte(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=f[0])===null||s===void 0?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},p)}}let Tte=class{constructor(t){ft(this,"_initialized",!1),ft(this,"_isDisabledServerSide",null),ft(this,"rageclicks",new cj),ft(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=us(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(t=s.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),s.url_ignorelist=(n=s.url_ignorelist)===null||n===void 0?void 0:n.map(r=>new RegExp(r)),s}_addDomEventHandlers(){if(this.isBrowserSupported()){if(je&&St){var t=s=>{s=s||je?.event;try{this._captureEvent(s)}catch(r){ZD.error("Failed to capture event",r)}};if(Ss(St,"submit",t,{capture:!0}),Ss(St,"change",t,{capture:!0}),Ss(St,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||je?.event,this._captureEvent(s,Yy)};Ss(St,"copy",n,{capture:!0}),Ss(St,"cut",n,{capture:!0})}}}else ZD.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[BD]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,s=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(r=>{var i=St?.querySelectorAll(r);i?.forEach(a=>{t===a&&s.push(r)})}),s}get isEnabled(){var t,n,s=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[BD],r=this._isDisabledServerSide;if(pu(r)&&!Rl(s)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!s;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=nj(t);Z6(r)&&(r=r.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===Yy;if(r&&gte(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=kte(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),n===Yy){var u,d=tj(je==null||(u=je.getSelection())===null||u===void 0?void 0:u.toString()),h=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return no(St?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Qr(e)&&isFinite(e)&&Math.floor(e)===e});var eP="0123456789abcdef";let Rte=class ZS{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||t<0||n<0||s<0||r<0||t>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/Math.pow(2,8),i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new ZS(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+eP.charAt(this.bytes[n]>>>4)+eP.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ZS(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}},Ate=class{constructor(){ft(this,"timestamp",0),ft(this,"counter",0),ft(this,"random",new Fte)}generate(){var t=this.generateOrAbort();if(Ct(t)){this.timestamp=0;var n=this.generateOrAbort();if(Ct(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Rte.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}};var tP,uj=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};je&&!Ct(je.crypto)&&crypto.getRandomValues&&(uj=e=>crypto.getRandomValues(e));let Fte=class{constructor(){ft(this,"buffer",new Uint32Array(8)),ft(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(uj(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Bc=()=>Dte().toString(),Dte=()=>(tP||(tP=new Ate)).generate(),Pte="Thu, 01 Jan 1970 00:00:00 GMT",lg="",Ite=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Nte(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:St;if(lg)return lg;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Bc(),u=new RegExp("(^|;)\\s*"+l+"=1");!lg&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,u.test(i.cookie)&&(i.cookie=h+";expires="+Pte,lg=d)}return lg}(e);if(!n){var s=(r=>{var i=r.match(Ite);return i?i[0]:""})(e);s!==n&&At.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var Dc,Ml={is_supported:()=>!!St,error:function(e){At.error("cookieStore error: "+e)},get:function(e){if(St){try{for(var t=e+"=",n=St.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Ml.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(St)try{var i="",a="",o=Nte(St.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&At.warn("cookieStore warning: large cookie, len="+u.length),St.cookie=u,u}catch{return}},remove:function(e,t){try{Ml.set(e,"",-1,t)}catch{return}}},e_=null,Ws={is_supported:function(){if(!pu(e_))return e_;var e=!0;if(Ct(je))e=!1;else try{var t="__mplssupport__";Ws.set(t,"xyz"),Ws.get(t)!=='"xyz"'&&(e=!1),Ws.remove(t)}catch{e=!1}return e||At.error("localStorage unsupported; falling back to cookie store"),e_=e,e},error:function(e){At.error("localStorage error: "+e)},get:function(e){try{return je?.localStorage.getItem(e)}catch(t){Ws.error(t)}return null},parse:function(e){try{return JSON.parse(Ws.get(e))||{}}catch{}return null},set:function(e,t){try{je?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Ws.error(n)}},remove:function(e){try{je?.localStorage.removeItem(e)}catch(t){Ws.error(t)}}},Mte=["distinct_id",Nb,Ug,Ob,XS],Kv=We(We({},Ws),{},{parse:function(e){try{var t={};try{t=Ml.parse(e)||{}}catch{}var n=ys(t,JSON.parse(Ws.get(e)||"{}"));return Ws.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{Ws.set(e,t,void 0,void 0,i);var a={};Mte.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&Ml.set(e,a,n,s,r,i)}catch(o){Ws.error(o)}},remove:function(e,t){try{je?.localStorage.removeItem(e),Ml.remove(e,t)}catch(n){Ws.error(n)}}}),Yv={},Ote={is_supported:function(){return!0},error:function(e){At.error("memoryStorage error: "+e)},get:function(e){return Yv[e]||null},parse:function(e){return Yv[e]||null},set:function(e,t){Yv[e]=t},remove:function(e){delete Yv[e]}},Ou=null,hr={is_supported:function(){if(!pu(Ou))return Ou;if(Ou=!0,Ct(je))Ou=!1;else try{var e="__support__";hr.set(e,"xyz"),hr.get(e)!=='"xyz"'&&(Ou=!1),hr.remove(e)}catch{Ou=!1}return Ou},error:function(e){At.error("sessionStorage error: ",e)},get:function(e){try{return je?.sessionStorage.getItem(e)}catch(t){hr.error(t)}return null},parse:function(e){try{return JSON.parse(hr.get(e))||null}catch{}return null},set:function(e,t){try{je?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){hr.error(n)}},remove:function(e){try{je?.sessionStorage.removeItem(e)}catch(t){hr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Dc||(Dc={}));let Lte=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Dc.DENIED:this.storedConsent}isOptedOut(){return this.consent===Dc.DENIED||this.consent===Dc.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Dc.GRANTED:t==="0"?Dc.DENIED:Dc.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Ws:Ml;var n=t==="localStorage"?Ml:Ws;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!Y6([Hi?.doNotTrack,Hi?.msDoNotTrack,Vt.doNotTrack],t=>Zt([!0,1,"1","yes"],t))}};var Xv=Or("[Dead Clicks]"),Bte=()=>!0,jte=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(Q6)),s=e.instance.config.capture_dead_clicks;return Rl(s)?s:n};let dj=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Q6]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?Xv.error("failed to load script",i):t()})}start(){var t;if(St){if(!this._lazyLoadedDeadClicksAutocapture&&(t=Vt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=us(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Vt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(St),Xv.info("starting...")}}else Xv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Xv.info("stopping..."))}};var t_=Or("[ExceptionAutocapture]");let Hte=class{constructor(t){var n;ft(this,"startCapturing",()=>{var s;if(je&&this.isEnabled&&(s=Vt.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=r(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){t_.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jD]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return us(t)?n=We(We({},n),t):(Ct(t)?this.remoteEnabled:t)&&(n=We(We({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(t_.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return t_.error("failed to load script",i);t()})}stopCapturing(){var t,n,s;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(s=this.unwrapConsoleError)===null||s===void 0||s.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[jD]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}};function hj(e){return!Ct(Event)&&fj(e,Event)}function fj(e,t){try{return e instanceof t}catch{return!1}}function tb(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function n_(e){return tb(e,"DOMError")}var nP=/\(error: (.*)\)/,sP=50,cf="?";function s_(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?cf:t,in_app:!0};return Ct(n)||(r.lineno=n),Ct(s)||(r.colno=s),r}var Ute=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gte=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Vte=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wte=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$te=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zte=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=t.sort((r,i)=>r[0]-i[0]).map(r=>r[1]);return function(r){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=r.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-vUtr6XRL.js","./index-hX_aZwq0.js","./index-vPvXCaIy.css","./publication-validation-C73bqNja.js","./conversation-input-sync-CJiOSzCX.js","./ui-preferences-store-C6eXGzFs.js","./error-boundary-Tv9TlaZ8.js","./conversation-input-sync-CAX4_ErH.css","./use-memberships-query-DcD9UeVY.js","./use-download-agent-mutation-LdjExo2g.js","./en-US-CHJkXXr4.js","./book-open-DeWHPw1t.js","./console-mirror-BnHVC7eO.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-DLfJB8ns.js","./page-header-ggruiR-O.js","./org-access-WIuI99P6.js","./radient-auth-buttons-C0ljZy4O.js","./format-esAOn2VS.js","./org-surface-gate-BsP8aWCi.js","./agents-page-B-PHMFxF.js","./schedules-page-DbZSRb3g.js","./parseISO-BHJWTxrA.js","./projects-page-BIRVv4yi.js","./use-session-snapshot-Cqye2iDz.js","./arrow-up-D8Tgt51O.js","./library-page-BGmng_P-.js","./tags-input-chips-B4_gHGYO.js","./browser-page-DAQis2Rt.js","./mesh-page-1yPLxWRO.js","./settings-page-DH9sXfEW.js","./notebook-pen-CcH01r1l.js","./browser-webauthn-prompt-CLrsocAn.js"])))=>i.map(i=>d[i]);
2
+ import{r as g,j as c,c as R,b as ze,i as yF,p as Oz,y as Lz,o as Bz,t as x,z as gS,L as Ho,A as jz,a as Hz,R as Uz}from"./index-hX_aZwq0.js";import{ar as _e,en as Gz,eo as mS,ep as lC,cz as Kx,bI as zc,cx as to,bQ as gT,C as ps,ah as Ra,ai as Ts,a4 as qt,aK as qn,aL as hs,u as sn,a3 as fu,aR as K0,cA as Vz,aS as Y0,eq as cB,er as Wz,a as Ln,c as yt,e as X0,es as Wm,et as $z,eu as zz,ev as qz,ew as Kz,aO as uB,aN as si,ex as mT,ey as Fo,ez as Oy,eA as Ly,c9 as Dl,c0 as vT,d6 as tc,cN as Yx,cM as Yz,cL as tr,cO as ln,eB as dB,eC as Xz,eD as vS,d as vt,Z as Ci,cU as xT,dq as Qz,ay as Xa,D as bT,eE as _F,eF as Jz,eG as Zz,eH as xS,eI as eq,eJ as tq,eK as nq,eL as sq,aC as pf,eM as SF,eN as EF,eO as rq,eP as iq,eQ as aq,eR as hB,eS as oq,eT as lq,eU as fB,eV as cC,eW as uC,eX as cq,eY as uq,eZ as dq,e_ as kF,e$ as hq,f0 as rf,f1 as pB,f2 as fq,f3 as pq,f4 as gq,f5 as mq,f6 as vq,f7 as xq,f8 as bq,f9 as gB,fa as wq,fb as Cq,a0 as ni,fc as mB,fd as yq,fe as TF,ff as _q,fg as Sq,c7 as Yi,fh as dC,fi as vB,fj as Eq,fk as kq,fl as RF,fm as Tq,fn as Rq,aT as yp,fo as Aq,fp as Fq,fq as Dq,bq as xB,fr as Pq,fs as Iq,ft as Nq,ei as bB,fu as Mq,bH as Xo,fv as Oq,fw as Lq,bG as Rd,fx as tu,fy as Bq,ad as wT,fz as AF,fA as jq,fB as Hq,fC as Uq,fD as Gq,fE as Vq,fF as Wq,fG as Kh,dh as $q,fH as zq,fI as qq,dk as Kq,fJ as hC,fK as bS,fL as fC,fM as Yq,fN as Xq,fO as Qq,fP as Jq,at as ud,fQ as By,_ as wB,fR as CB,aV as yB,aX as Wi,fS as CT,fT as Zq,bu as wS,aP as yT,de as pC,fU as _B,fV as eK,bM as nu,c2 as gC,fW as tK,b$ as mC,bE as Ad,fX as nK,fY as sK,fZ as rK,f_ as iK,f$ as aK,g0 as oK,g1 as lK,g2 as cK,g3 as FF,g4 as uK,g5 as dK,g6 as _T,g7 as DF,dm as hK,g8 as fK,g9 as SB,ga as pK,gb as gK,gc as EB,gd as CS,ge as mK,b as kB,gf,gg as _p,gh as vK,gi as ST,bv as xK,gj as bK,gk as wK,gl as CK,gm as PF,gn as yK,c3 as vC,go as _K,gp as SK,gq as TB,gr as RB,gs as EK,gt as AB,gu as Eb,gv as kK,gw as TK,gx as RK,gy as AK,gz as FK,gA as DK,gB as PK,av as ns,gC as IK,au as Lc,gD as FB,gE as DB,gF as NK,gG as MK,gH as OK,gI as ET,gJ as LK,gK as PB,cC as xC,cD as bC,gL as wC,gM as Aa,gN as BK,gO as kn,gP as en,gQ as Q0,gR as $m,gS as CC,gT as kT,gU as yC,gV as jK,gW as HK,gX as UK,gY as pn,gZ as zm,g_ as IB,g$ as ha,h0 as Fd,h1 as GK,h2 as NB,h3 as VK,h4 as WK,h5 as IF,h6 as $K,h7 as zK,h8 as qK,c1 as KK,h9 as YK,ha as mf,hb as MB,hc as OB,hd as TT,he as kb,hf as LB,V as RT,hg as yS,hh as AT,hi as jy,hj as XK,hk as QK,hl as JK,hm as af,hn as _S,ho as BB,hp as ZK,hq as jB,hr as eY,hs as tY,ht as nY,hu as sY,hv as rY,hw as iY,hx as aY,hy as oY,hz as lY,hA as cY,hB as Tb,hC as uY,hD as dY,hE as hY,hF as fY,hG as pY,hH as gY,hI as FT,hJ as mY,hK as HB,I as st,hL as vY,hM as _C,hN as Dd,bP as UB,bT as xY,hO as NF,bl as GB,hP as bY,hQ as wY,hR as CY,hS as yY,hT as _Y,hU as SY,aA as Er,hV as EY,hW as kY,hX as TY,hY as RY,hZ as AY,h_ as FY,h$ as DY,i0 as PY,i1 as IY,i2 as NY,i3 as MY,i4 as OY,i5 as qm,i6 as VB,i7 as Rb,i8 as Wf,i9 as SC,ia as DT,ib as LY,ic as BY,id as jY,ie as WB,ig as HY,ih as MF,ii as UY,ij as PT,ik as GY,il as IT,im as J0,io as Z0,ip as VY,iq as $B,ir as Km,is as WY,it as $Y,iu as zY,iv as qY,iw as KY,ix as YY,iy as OF,iz as zB,cd as qB,iA as XY,iB as QY,iC as JY,aW as $f,iD as ZY,c6 as eX,iE as LF,iF as tX,iG as nX,iH as KB,iI as BF,iJ as sX,iK as rX,iL as iX,iM as YB,iN as Hy,iO as aX,iP as XB,bD as rm,iQ as NT,e7 as oX,iR as lX,bS as MT,iS as qc,iT as OT,iU as LT,iV as cX,bz as uX,bA as EC,bx as zf,iW as QB,iX as dX,iY as JB,iZ as ZB,cK as Uy,aM as ev,i_ as jF,i$ as hX,j0 as Ab,j1 as HF,j2 as fX,bN as UF,j3 as pX,j4 as gX,j5 as mX,j6 as SS,j7 as vX,j8 as GF,ct as Yh,j9 as xX,ja as bX,c8 as wX,jb as CX,jc as e6,cu as yX,ce as _X,jd as SX,je as EX,jf as kX,jg as TX,d5 as RX,jh as AX,ji as BT,jj as FX,jk as DX,jl as Uv,jm as t6,jn as ES,a8 as VF,cZ as PX,jo as IX,jp as NX,jq as dd,dJ as n6,dK as jT,jr as MX,js as OX,jt as LX,ju as s6,cc as BX,jv as WF,ae as $F,jw as jX,aD as r6,dI as HX,jx as im,jy as UX,bL as i6,jz as GX,jA as VX,jB as WX,jC as $X,jD as zX,jE as qX,jF as KX,bn as zF,bo as qF,bp as KF,aB as YX,jG as XX,jH as QX,jI as JX,jJ as Ah,jK as Fh,jL as ZX,jM as eQ,jN as tQ,jO as nQ,jP as a6,jQ as sQ,jR as o6,jS as kS,jT as TS,jU as Gy,jV as rQ,jW as iQ,jX as Xh,jY as aQ,aq as Fb,as as l6,aw as oQ,aa as YF,jZ as lQ,j_ as cQ,j$ as uQ,k0 as dQ,k1 as hQ,k2 as fQ,k3 as pQ,k4 as c6,k5 as gQ,k6 as RS,k7 as u6,k8 as d6,k9 as mQ,ka as vQ,kb as xQ,kc as bQ,kd as h6,ke as Sp,kf as wQ,kg as CQ,kh as HT,br as yQ,ki as _Q,kj as SQ,kk as EQ,kl as kQ,km as TQ,kn as RQ,ko as AQ,kp as FQ,kq as DQ,kr as PQ,bm as IQ,ks as XF,kt as NQ,ku as MQ,kv as Vy,kw as QF,kx as OQ,ky as LQ,kz as BQ,kA as jQ,kB as HQ,kC as UQ,kD as GQ,kE as VQ,kF as WQ,kG as $Q,kH as zQ,kI as qQ,kJ as KQ,kK as YQ,kL as XQ,kM as QQ,kN as JQ,kO as JF,kP as ZQ,kQ as eJ,al as tJ,am as nJ,an as sJ,ao as rJ,ap as iJ,kR as aJ,kS as oJ,kT as lJ,kU as cJ,kV as uJ,ax as dJ,kW as hJ,kX as fJ,kY as pJ,kZ as ZF,dl as f6,k_ as UT,k$ as gJ,aU as p6,l0 as g6,l1 as mJ,l2 as vJ,l3 as m6,l4 as xJ,l5 as kr,l6 as bJ,l7 as kc,l8 as v6,l9 as x6,la as b6,lb as GT,lc as Mi,ld as wJ,le as CJ,lf as yJ,lg as _J,lh as SJ,li as EJ,lj as kJ,lk as TJ,ll as RJ,lm as AJ,ln as FJ,lo as w6,lp as DJ,lq as PJ,lr as IJ,ls as NJ,lt as MJ,lu as AS,lv as OJ,lw as LJ,lx as eD,ly as C6,lz as BJ,lA as jJ,lB as HJ,lC as tD,lD as UJ,lE as GJ,lF as VJ,lG as WJ,lH as $J,lI as zJ,lJ as qJ,lK as KJ,lL as y6,lM as YJ,lN as XJ,d4 as Db,lO as QJ,dB as JJ,lP as nD,lQ as ZJ,lR as eZ,lS as tZ,da as nZ,ds as sZ,lT as rZ,lU as iZ,lV as aZ,B as _6,dr as sD,lW as oZ,af as lZ,bF as uo,lX as cZ,lY as uZ,lZ as dZ,l_ as Cr,aY as rD,l$ as Dh,m0 as hZ,m1 as Pb,m2 as fZ,m3 as iD,m4 as pZ,m5 as Wy,m6 as $y,m7 as aD,m8 as zy,m9 as oD,ma as S6,mb as E6,aJ as gZ,mc as k6,md as mZ,aG as vZ,aH as xZ,aE as bZ,aF as wZ,me as CZ,aI as yZ}from"./conversation-input-sync-CJiOSzCX.js";import{c as ct,ai as _Z,aj as T6,ak as SZ,al as EZ,am as kZ,an as TZ,ao as RZ,ap as AZ,aq as ag,ar as FZ,f as oo,S as gn,q as ho,u as _t,a as ie,L as lr,I as Bn,T as VT,h as Us,X as Tn,a8 as FS,as as Pl,D as _a,b as Sa,e as $i,z as Ea,y as Ir,p as tv,i as qf,ah as kC,m as Ze,a0 as Ep,d as Pd,A as Jr,g as Id,F as Ym,G as Xm,H as Qm,J as Jm,K as Zm,r as zl,s as Qo,t as ql,v as DS,w as Zr,x as Gt,at as kp,au as DZ,av as PZ,B as Kl,af as R6,aw as PS,ax as IZ,ay as NZ,az as MZ,Y as A6,Z as F6,_ as IS,l as Xx,ag as OZ,a1 as e0,a2 as D6,a3 as Kf,aA as vf,aB as LZ,C as P6,M as NS,j as I6,aC as BZ,k as N6,aD as jZ,aE as lD,a4 as HZ,ad as MS,aF as og,aG as WT,N as $T,$ as UZ,a5 as GZ,a6 as VZ,a7 as WZ,ab as $Z,ac as zZ,a9 as qZ,aa as KZ,aH as YZ,aI as XZ,aJ as M6,n as cD,o as uD,E as QZ}from"./error-boundary-Tv9TlaZ8.js";import{e as th,g as O6,t as dD,v as qy,w as JZ,x as OS,n as LS,y as ZZ,u as qe,z as L6,A as B6,B as TC,S as eee,C as j6,E as tee,R as nee,F as see,G as Il,H as hD,I as ree,J as iee,L as aee,M as fD,N as RC,O as oee,Q as lee,U as Bg,V as cee,W as H6,X as uee,Y as pD,Z as gD,_ as dee,$ as mD,a0 as hee,a1 as Mu,a2 as Gv,a3 as fee,a4 as pee,a5 as gee,a6 as vD,a7 as xD,a8 as mee,a9 as vee,aa as xee,ab as bee,ac as bD,ad as wD,ae as CD,af as wee,ag as Cee,ah as yee,ai as _ee,aj as See,ak as yD,al as Eee,am as kee,an as _D,ao as Tee,ap as Ree,aq as Aee,ar as Fee,as as Dee,at as Pee,au as U6,s as SD,av as Iee,T as Nee,aw as Mee,ax as Oee,ay as Lee,az as Vv,aA as Wv,aB as ED,aC as $v,aD as zv,aE as kD,aF as TD,aG as Bee,aH as Qx,aI as jee,aJ as Hee,aK as Uee,aL as Gee,aM as RD,aN as Vee,aO as Wee,aP as AD,aQ as $ee}from"./ui-preferences-store-C6eXGzFs.js";import{C as zee}from"./console-mirror-BnHVC7eO.js";const BS=8e3,G6=1e4;function qee(e){return e?`“${e}”`:"Conversation"}const Kee="archived.";function Yee(e){return _e.getState().archiveFacts[e]}function Xee(e){const t=_e.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Qee(){const e=_e(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=_e.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&_e.getState().setArchiveUndo(null)},r=_e.subscribe(()=>{const i=Yee(e.sessionId);i!==void 0&&!i.answered||Gz(e.archived,Xee(e.sessionId))||s()});return n},[e])}function Jee(e){return e===1?"Draft":`${e} drafts`}const Zee="discarded.",ete=e=>{const t=mS(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>lC(o)!==null&&mS([o]).length===0).length,a=[`Mark ${n} unread ${r} as read${s>0?`, including ${s} in Previous chats`:""}.`];return i>0&&a.push(`${i} unread ${i===1?"mark":"marks"} with no completion token cannot be cleared.`),{count:n,label:`Mark all ${n} read`,scope:a.join(" "),nameSuffix:s>0?`, including ${s} in Previous chats`:""}},V6=e=>e===1?"1 lives on another device and clears when that device updates.":`${e} live on other devices and clear when those devices update.`,tte=e=>{if(e.attempted===0)return{tone:"success",message:"Nothing to clear."};const t=e.unknown-e.deferred,n=[e.superseded>0?`${e.superseded} ${e.superseded===1?"has a newer result and stays":"have newer results and stay"} unread.`:null,t>0?`${t} could not be cleared and ${t===1?"stays":"stay"} unread.`:null,e.deferred>0?V6(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:["Nothing was cleared.",...n].join(" ")}:{tone:"success",message:[`Marked ${e.cleared} ${e.cleared===1?"chat":"chats"} as read.`,...n].join(" ")}},Ky="archive",FD="drafts-undo",DD="bulk-read-deferral",nte=8e3;function ste(){const e=_e(h=>h.archiveFailure),t=_e(h=>h.archiveUndo),n=_e(h=>h.draftsUndo),s=_e(h=>h.bulkReadDeferral),r=_e(h=>h.clearArchiveFailure),i=_e(h=>h.setArchiveUndo),a=_e(h=>h.setSessionArchived),o=_e(h=>h.restoreDraftsUndo);Qee();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,Kx(Ky);return}const h=e&&t?t.at>e.at?"offer":"failure":e?"failure":"offer",f=h==="offer"?t?.at??0:e?.at??0,p=l.current;l.current={kind:h,at:f},p!==null&&p.kind!==h&&f>p.at&&(h==="failure"?i(null):r());const m=(v,b)=>()=>{const w=_e.getState();v==="offer"?w.archiveUndo?.at===b&&w.setArchiveUndo(null):w.archiveFailure?.at===b&&w.clearArchiveFailure();const C=l.current;C!==null&&C.kind===v&&C.at===b&&(l.current=null)};if(h==="failure"&&e){zc(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:Ky,duration:G6,onAutoClose:m("failure",e.at),onDismiss:m("failure",e.at),action:{label:"Retry",onClick:v=>{v.preventDefault(),a(e.sessionId,e.archived,e.title)}}});return}t&&to(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:qee(t.title)}),c.jsx("span",{className:R("shrink-0"),children:Kee})]}),{id:Ky,duration:BS,classNames:{content:"min-w-0"},onAutoClose:m("offer",t.at),onDismiss:m("offer",t.at),action:{label:"Undo",onClick:v=>{v.preventDefault(),a(t.sessionId,!t.archived,t.title)}}})},[e,t,i,r,a]);const u=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!u.current)return;u.current=!1,Kx(FD);return}u.current=!0;const h=()=>{const f=_e.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),u.current=!1)};to(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Jee(n.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:Zee})]}),{id:FD,duration:BS,classNames:{content:"min-w-0"},onAutoClose:h,onDismiss:h,action:{label:"Undo",onClick:f=>{f.preventDefault(),o();const p=_e.getState(),m=p.stagedByDiscard;p.setStagedByDiscard(null),n.keys.length===1&&m!==null&&_e.getState().activeDraftKey===m&&_e.getState().openDraft(n.keys[0])}}})},[n,o]);const d=g.useRef(!1);return g.useEffect(()=>{if(s===null){if(!d.current)return;d.current=!1,Kx(DD);return}d.current=!0;const h=()=>{const f=_e.getState();f.bulkReadDeferral?.at===s.at&&(f.clearBulkReadDeferral(),d.current=!1)};to(V6(s.count),{id:DD,duration:nte,onAutoClose:h,onDismiss:h})},[s]),null}var Qa,je=typeof window<"u"?window:void 0,fi=typeof globalThis<"u"?globalThis:je,W6=Array.prototype,PD=W6.forEach,ID=W6.indexOf,Hi=fi?.navigator,St=fi?.document,di=fi?.location,jS=fi?.fetch,HS=fi!=null&&fi.XMLHttpRequest&&"withCredentials"in new fi.XMLHttpRequest?fi.XMLHttpRequest:void 0,ND=fi?.AbortController,Bs=Hi?.userAgent,Vt=je??{},kl={DEBUG:!1,LIB_VERSION:"1.235.6"},Yy="$copy_autocapture",rte=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(Qa||(Qa={}));var ite=["fatal","error","warning","log","info","debug"];function Zt(e,t){return e.indexOf(t)!==-1}var AC=function(e){return e.trim()},zT=function(e){return e.replace(/^\$/,"")},ate=Array.isArray,$6=Object.prototype,z6=$6.hasOwnProperty,FC=$6.toString,cs=ate||function(e){return FC.call(e)==="[object Array]"},no=e=>typeof e=="function",us=e=>e===Object(e)&&!cs(e),of=e=>{if(us(e)){for(var t in e)if(z6.call(e,t))return!1;return!0}return!1},Ct=e=>e===void 0,Hs=e=>FC.call(e)=="[object String]",US=e=>Hs(e)&&e.trim().length===0,pu=e=>e===null,En=e=>Ct(e)||pu(e),Qr=e=>FC.call(e)=="[object Number]",Rl=e=>FC.call(e)==="[object Boolean]",ote=e=>e instanceof FormData,lte=e=>Zt(rte,e),q6=e=>{var t={_log:function(n){if(je&&(kl.DEBUG||Vt.POSTHOG_DEBUG)&&!Ct(je.console)&&je.console){for(var s=("__rrweb_original__"in je.console[n])?je.console[n].__rrweb_original__:je.console[n],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];s(e,...i)}},info:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];console.error(e,...s)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>q6("".concat(e," ").concat(n))};return t},At=q6("[PostHog.js]"),Or=At.createLogger,cte=Or("[ExternalScriptsLoader]"),MD=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return cte.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=St?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!St)return n("document not found");var a=St.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=u=>n(void 0,u),a.onerror=u=>n(u),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=St.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):St.body.appendChild(a)};St!=null&&St.body?i():St?.addEventListener("DOMContentLoaded",i)};function OD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function We(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?OD(Object(n),!0).forEach(function(s){ft(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OD(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ft(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K6(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},h=Object.keys(a);for(u=0;u<h.length;u++)l=h[u],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}Vt.__PosthogExtensions__=Vt.__PosthogExtensions__||{},Vt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(s="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var r=3e5,i=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",s);MD(e,a,n)},Vt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);MD(e,s,n)};var Ib={};function Kc(e,t,n){if(cs(e)){if(PD&&e.forEach===PD)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===Ib)return}}}function Mn(e,t,n){if(!En(e)){if(cs(e))return Kc(e,t,n);if(ote(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===Ib)return}else for(var r in e)if(z6.call(e,r)&&t.call(n,e[r],r)===Ib)return}}var ys=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Kc(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},Jx=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Kc(n,function(r){Kc(r,function(i){e.push(i)})}),e};function Zx(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var LD=function(e){try{return e()}catch{return}},ute=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(this,n)}catch(r){At.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),At.critical(r)}}},t0=function(e){var t={};return Mn(e,function(n,s){Hs(n)&&n.length>0&&(t[s]=n)}),t};function dte(e,t){return n=e,s=i=>Hs(i)&&!pu(t)?i.slice(0,t):i,r=new Set,function i(a,o){return a!==Object(a)?s?s(a,o):a:r.has(a)?void 0:(r.add(a),cs(a)?(l=[],Kc(a,u=>{l.push(i(u))})):(l={},Mn(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var hte=["herokuapp.com","vercel.app","netlify.app"];function fte(e){var t=e?.hostname;if(!Hs(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of hte)if(n===s)return!1;return!0}function Y6(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Ss(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var X6="$people_distinct_id",jg="__alias",Hg="__timers",BD="$autocapture_disabled_server_side",GS="$heatmaps_enabled_server_side",jD="$exception_capture_enabled_server_side",HD="$web_vitals_enabled_server_side",Q6="$dead_clicks_enabled_server_side",UD="$web_vitals_allowed_metrics",VS="$session_recording_enabled_server_side",GD="$console_log_recording_enabled_server_side",VD="$session_recording_network_payload_capture",WD="$session_recording_masking",$D="$session_recording_canvas_recording",zD="$replay_sample_rate",qD="$replay_minimum_duration",KD="$replay_script_config",Nb="$sesid",Ug="$session_is_sampled",Xy="$session_recording_url_trigger_activated_session",Qy="$session_recording_event_trigger_activated_session",lf="$enabled_feature_flags",eb="$early_access_features",WS="$feature_flag_details",Gg="$stored_person_properties",Wu="$stored_group_properties",$S="$surveys",qv="$surveys_activated",Mb="$flag_call_reported",_l="$user_state",zS="$client_session_props",qS="$capture_rate_limit",KS="$initial_campaign_params",YS="$initial_referrer_info",XS="$initial_person_info",Ob="$epp",J6="__POSTHOG_TOOLBAR__",YD="$posthog_cookieless",pte=[X6,jg,"__cmpns",Hg,VS,GS,Nb,lf,_l,eb,WS,Wu,Gg,$S,Mb,zS,qS,KS,YS,Ob];function XD(e){var t;return e instanceof Element&&(e.id===J6||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function DC(e){return!!e&&e.nodeType===1}function Yc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Z6(e){return!!e&&e.nodeType===3}function ej(e){return!!e&&e.nodeType===11}function qT(e){return e?AC(e).split(/\s+/):[]}function QD(e){var t=je?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Lb(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return qT(t)}function tj(e){return En(e)?null:AC(e).split(/(\s+)/).filter(t=>Yf(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function PC(e){var t="";return JS(e)&&!rj(e)&&e.childNodes&&e.childNodes.length&&Mn(e.childNodes,function(n){var s;Z6(n)&&n.textContent&&(t+=(s=tj(n.textContent))!==null&&s!==void 0?s:"")}),AC(t)}function nj(e){return Ct(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var QS=["a","button","form","input","select","textarea","label"];function sj(e){var t=e.parentNode;return!(!t||!DC(t))&&t}function gte(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!je||!e||Yc(e,"html")||!DC(e)||n!=null&&n.url_allowlist&&!QD(n.url_allowlist)||n!=null&&n.url_ignorelist&&QD(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(p=>t.type===p))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Yc(u,"body");)if(ej(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=sj(u)))break;if(s||QS.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=je.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(p,m){var v=m?.element_allowlist;if(Ct(v))return!0;var b=function(y){if(v.some(k=>y.tagName.toLowerCase()===k))return{v:!0}};for(var w of p){var C=b(w);if(typeof C=="object")return C.v}return!1}(o,n)||!function(p,m){var v=m?.css_selector_allowlist;if(Ct(v))return!0;var b=function(y){if(v.some(k=>y.matches(k)))return{v:!0}};for(var w of p){var C=b(w);if(typeof C=="object")return C.v}return!1}(o,n))return!1;var h=je.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var f=e.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(QS.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function JS(e){for(var t=e;t.parentNode&&!Yc(t,"body");t=t.parentNode){var n=Lb(t);if(Zt(n,"ph-sensitive")||Zt(n,"ph-no-capture"))return!1}if(Zt(Lb(e),"ph-include"))return!0;var s=e.type||"";if(Hs(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(Hs(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function rj(e){return!!(Yc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Yc(e,"select")||Yc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ij="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",mte=new RegExp("^(?:".concat(ij,")$")),vte=new RegExp(ij),aj="\\d{3}-?\\d{2}-?\\d{4}",xte=new RegExp("^(".concat(aj,")$")),bte=new RegExp("(".concat(aj,")"));function Yf(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(En(e)||Hs(e)&&(e=AC(e),(t?mte:vte).test((e||"").replace(/[- ]/g,""))||(t?xte:bte).test(e)))}function oj(e){var t=PC(e);return Yf(t="".concat(t," ").concat(lj(e)).trim())?t:""}function lj(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Mn(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=PC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(lj(n)).trim())}catch(i){At.error("[AutoCapture]",i)}}),t}function wte(e){return function(t){var n=t.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var o of(s.attr_class.sort(),s.attr_class))a+=".".concat(o.replace(/"/g,""));var l=We(We(We(We({},s.text?{text:s.text}:{}),{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{}),s.attr_id?{attr_id:s.attr_id}:{}),s.attributes),u={};return Zx(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return u[JD(h.toString())]=JD(f.toString())}),a+=":",a+=Zx(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var s,r,i={text:(s=n.$el_text)===null||s===void 0?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)===null||r===void 0?void 0:r.slice(0,2048),attr_class:Cte(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return i.attributes[o]=l}),i})}(e))}function JD(e){return e.replace(/"|\\"/g,'\\"')}function Cte(e){var t=e.attr__class;return t?cs(t)?t:qT(t):void 0}class cj{constructor(){this.clicks=[]}isRageClick(t,n,s){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(n-r.y)<30&&s-r.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var yte=["localhost","127.0.0.1"],xf=e=>{var t=St?.createElement("a");return Ct(t)?null:(t.href=e,t)},_te=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return Mn(e,function(i,a){Ct(i)||Ct(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(s)},Bb=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===t){n=i;break}}if(!cs(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{At.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Jy=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),d=[],h=0;h<u.length;h++){var f=u[h].split("=");cs(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(u[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},jb=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},ZD=Or("[AutoCapture]");function Zy(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ste(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!DC(t));return t}function Ete(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};QS.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Zy(1024,oj(e)):i.$el_text=Zy(1024,PC(e)));var a=Lb(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Mn(e.attributes,function(d){var h;if((!rj(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Yf(d.value)&&(h=d.name,!Hs(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=qT(f).join(" ")),i["attr__"+d.name]=Zy(1024,f)}});for(var o=1,l=1,u=e;u=Ste(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function kte(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Yc(d,"body");)ej(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Mn(u,k=>{var _=JS(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&Yf(m)&&m),Zt(Lb(k),"ph-no-capture")&&(v=!0),f.push(Ete(k,i,a,o));var E=function(T){if(!JS(T))return{};var A={};return Mn(T.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var I=F.name.replace("data-ph-capture-attribute-",""),M=F.value;I&&M&&Yf(M)&&(A[I]=M)}}),A}(k);ys(p,E)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=oj(e):f[0].$el_text=PC(e)),m){var b,w;f[0].attr__href=m;var C=(b=xf(m))===null||b===void 0?void 0:b.host,y=je==null||(w=je.location)===null||w===void 0?void 0:w.host;C&&y&&C!==y&&(h=m)}return{props:ys({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:wte(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=f[0])===null||s===void 0?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},p)}}let Tte=class{constructor(t){ft(this,"_initialized",!1),ft(this,"_isDisabledServerSide",null),ft(this,"rageclicks",new cj),ft(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=us(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(t=s.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),s.url_ignorelist=(n=s.url_ignorelist)===null||n===void 0?void 0:n.map(r=>new RegExp(r)),s}_addDomEventHandlers(){if(this.isBrowserSupported()){if(je&&St){var t=s=>{s=s||je?.event;try{this._captureEvent(s)}catch(r){ZD.error("Failed to capture event",r)}};if(Ss(St,"submit",t,{capture:!0}),Ss(St,"change",t,{capture:!0}),Ss(St,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||je?.event,this._captureEvent(s,Yy)};Ss(St,"copy",n,{capture:!0}),Ss(St,"cut",n,{capture:!0})}}}else ZD.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[BD]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,s=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(r=>{var i=St?.querySelectorAll(r);i?.forEach(a=>{t===a&&s.push(r)})}),s}get isEnabled(){var t,n,s=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[BD],r=this._isDisabledServerSide;if(pu(r)&&!Rl(s)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!s;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=nj(t);Z6(r)&&(r=r.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===Yy;if(r&&gte(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=kte(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),n===Yy){var u,d=tj(je==null||(u=je.getSelection())===null||u===void 0?void 0:u.toString()),h=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return no(St?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Qr(e)&&isFinite(e)&&Math.floor(e)===e});var eP="0123456789abcdef";let Rte=class ZS{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||t<0||n<0||s<0||r<0||t>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/Math.pow(2,8),i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new ZS(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+eP.charAt(this.bytes[n]>>>4)+eP.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ZS(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}},Ate=class{constructor(){ft(this,"timestamp",0),ft(this,"counter",0),ft(this,"random",new Fte)}generate(){var t=this.generateOrAbort();if(Ct(t)){this.timestamp=0;var n=this.generateOrAbort();if(Ct(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Rte.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}};var tP,uj=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};je&&!Ct(je.crypto)&&crypto.getRandomValues&&(uj=e=>crypto.getRandomValues(e));let Fte=class{constructor(){ft(this,"buffer",new Uint32Array(8)),ft(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(uj(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Bc=()=>Dte().toString(),Dte=()=>(tP||(tP=new Ate)).generate(),Pte="Thu, 01 Jan 1970 00:00:00 GMT",lg="",Ite=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Nte(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:St;if(lg)return lg;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Bc(),u=new RegExp("(^|;)\\s*"+l+"=1");!lg&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,u.test(i.cookie)&&(i.cookie=h+";expires="+Pte,lg=d)}return lg}(e);if(!n){var s=(r=>{var i=r.match(Ite);return i?i[0]:""})(e);s!==n&&At.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var Dc,Ml={is_supported:()=>!!St,error:function(e){At.error("cookieStore error: "+e)},get:function(e){if(St){try{for(var t=e+"=",n=St.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Ml.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(St)try{var i="",a="",o=Nte(St.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&At.warn("cookieStore warning: large cookie, len="+u.length),St.cookie=u,u}catch{return}},remove:function(e,t){try{Ml.set(e,"",-1,t)}catch{return}}},e_=null,Ws={is_supported:function(){if(!pu(e_))return e_;var e=!0;if(Ct(je))e=!1;else try{var t="__mplssupport__";Ws.set(t,"xyz"),Ws.get(t)!=='"xyz"'&&(e=!1),Ws.remove(t)}catch{e=!1}return e||At.error("localStorage unsupported; falling back to cookie store"),e_=e,e},error:function(e){At.error("localStorage error: "+e)},get:function(e){try{return je?.localStorage.getItem(e)}catch(t){Ws.error(t)}return null},parse:function(e){try{return JSON.parse(Ws.get(e))||{}}catch{}return null},set:function(e,t){try{je?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Ws.error(n)}},remove:function(e){try{je?.localStorage.removeItem(e)}catch(t){Ws.error(t)}}},Mte=["distinct_id",Nb,Ug,Ob,XS],Kv=We(We({},Ws),{},{parse:function(e){try{var t={};try{t=Ml.parse(e)||{}}catch{}var n=ys(t,JSON.parse(Ws.get(e)||"{}"));return Ws.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{Ws.set(e,t,void 0,void 0,i);var a={};Mte.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&Ml.set(e,a,n,s,r,i)}catch(o){Ws.error(o)}},remove:function(e,t){try{je?.localStorage.removeItem(e),Ml.remove(e,t)}catch(n){Ws.error(n)}}}),Yv={},Ote={is_supported:function(){return!0},error:function(e){At.error("memoryStorage error: "+e)},get:function(e){return Yv[e]||null},parse:function(e){return Yv[e]||null},set:function(e,t){Yv[e]=t},remove:function(e){delete Yv[e]}},Ou=null,hr={is_supported:function(){if(!pu(Ou))return Ou;if(Ou=!0,Ct(je))Ou=!1;else try{var e="__support__";hr.set(e,"xyz"),hr.get(e)!=='"xyz"'&&(Ou=!1),hr.remove(e)}catch{Ou=!1}return Ou},error:function(e){At.error("sessionStorage error: ",e)},get:function(e){try{return je?.sessionStorage.getItem(e)}catch(t){hr.error(t)}return null},parse:function(e){try{return JSON.parse(hr.get(e))||null}catch{}return null},set:function(e,t){try{je?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){hr.error(n)}},remove:function(e){try{je?.sessionStorage.removeItem(e)}catch(t){hr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Dc||(Dc={}));let Lte=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Dc.DENIED:this.storedConsent}isOptedOut(){return this.consent===Dc.DENIED||this.consent===Dc.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Dc.GRANTED:t==="0"?Dc.DENIED:Dc.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Ws:Ml;var n=t==="localStorage"?Ml:Ws;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!Y6([Hi?.doNotTrack,Hi?.msDoNotTrack,Vt.doNotTrack],t=>Zt([!0,1,"1","yes"],t))}};var Xv=Or("[Dead Clicks]"),Bte=()=>!0,jte=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(Q6)),s=e.instance.config.capture_dead_clicks;return Rl(s)?s:n};let dj=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Q6]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?Xv.error("failed to load script",i):t()})}start(){var t;if(St){if(!this._lazyLoadedDeadClicksAutocapture&&(t=Vt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=us(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Vt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(St),Xv.info("starting...")}}else Xv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Xv.info("stopping..."))}};var t_=Or("[ExceptionAutocapture]");let Hte=class{constructor(t){var n;ft(this,"startCapturing",()=>{var s;if(je&&this.isEnabled&&(s=Vt.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=Vt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=r(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){t_.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jD]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return us(t)?n=We(We({},n),t):(Ct(t)?this.remoteEnabled:t)&&(n=We(We({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(t_.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return t_.error("failed to load script",i);t()})}stopCapturing(){var t,n,s;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(s=this.unwrapConsoleError)===null||s===void 0||s.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[jD]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}};function hj(e){return!Ct(Event)&&fj(e,Event)}function fj(e,t){try{return e instanceof t}catch{return!1}}function tb(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function n_(e){return tb(e,"DOMError")}var nP=/\(error: (.*)\)/,sP=50,cf="?";function s_(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?cf:t,in_app:!0};return Ct(n)||(r.lineno=n),Ct(s)||(r.colno=s),r}var Ute=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gte=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Vte=/\((\S*)(?::(\d+))(?::(\d+))\)/,Wte=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$te=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zte=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=t.sort((r,i)=>r[0]-i[0]).map(r=>r[1]);return function(r){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=r.split(`
3
3
  `),l=i;l<o.length;l++){var u=o[l];if(!(u.length>1024)){var d=nP.test(u)?u.replace(nP,"$1"):u;if(!d.match(/\S*Error: /)){for(var h of s){var f=h(d);if(f){a.push(f);break}}if(a.length>=sP)break}}}return function(p){if(!p.length)return[];var m=Array.from(p);return m.reverse(),m.slice(0,sP).map(v=>We(We({},v),{},{filename:v.filename||qte(m).filename,function:v.function||cf}))}(a)}}([30,e=>{var t=Ute.exec(e);if(t){var[,n,s,r]=t;return s_(n,cf,+s,+r)}var i=Gte.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Vte.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=iP(i[1]||cf,i[2]);return s_(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=Wte.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=$te.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var s=t[3],r=t[1]||cf;return[r,s]=iP(r,s),s_(s,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function qte(e){return e[e.length-1]||{}}var Qv,rP,r_,iP=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:cf,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Kte=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function KT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",s=function(a){return a&&Yte.test(a.message)?1:0}(e);try{var r=zte,i=function(a,o){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var h=Object.keys(d);return r_&&h.length===rP||(rP=h.length,r_=h.reduce((f,p)=>{Qv||(Qv={});var m=Qv[p];if(m)f[m[0]]=m[1];else for(var v=u(p),b=v.length-1;b>=0;b--){var w=v[b],C=w?.filename,y=d[p];if(C&&y){f[C]=y,Qv[p]=[C,y];break}}return f},{})),r_}(o);return a.forEach(u=>{u.filename&&(u.chunk_id=l[u.filename])}),a}(r(n,s),r);return i.slice(0,i.length-t)}catch{}return[]}var Yte=/Minified React error #\d+;/i;function i_(e,t){var n,s,r=KT(e),i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)!==null&&s!==void 0&&s;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(o){var l=o.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:i,synthetic:a}}],$exception_level:"error"}}function a_(e,t){var n,s,r,i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)===null||s===void 0||s,o={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(r=t?.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:e||t?.defaultExceptionMessage,mechanism:{handled:i,synthetic:a}};if(t!=null&&t.syntheticException){var l=KT(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function Xte(e){return Hs(e)&&!US(e)&&ite.indexOf(e)>=0}function Qte(e,t){var n,s,r=(n=t?.handled)===null||n===void 0||n,i=(s=t?.synthetic)===null||s===void 0||s,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:hj(e)?e.constructor.name:"Error",o="Non-Error 'exception' captured with keys: ".concat(function(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,f=Object.keys(d);if(f.sort(),!f.length)return"[object has no keys]";for(var p=f.length;p>0;p--){var m=f.slice(0,p).join(", ");if(!(m.length>h))return p===f.length||m.length<=h?m:"".concat(m.slice(0,h),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:r,synthetic:i}};if(t!=null&&t.syntheticException){var u=KT(t?.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Xte(e.level)?e.level:"error"}}function Jte(e,t){var{error:n,event:s}=e,r={$exception_list:[]},i=n||s;if(n_(i)||function(p){return tb(p,"DOMException")}(i)){var a=i;if(function(p){return"stack"in p}(i))r=i_(i,t);else{var o=a.name||(n_(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,u=n_(a)?"DOMError":"DOMException";r=a_(l,We(We({},t),{},{overrideExceptionType:u,defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code="".concat(a.code)),r}if(function(p){return tb(p,"ErrorEvent")}(i)&&i.error)return i_(i.error,t);if(function(p){switch(Object.prototype.toString.call(p)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return fj(p,Error)}}(i))return i_(i,t);if(function(p){return tb(p,"Object")}(i)||hj(i))return Qte(i,t);if(Ct(n)&&Hs(s)){var d="Error",h=s,f=s.match(Kte);return f&&(d=f[1],h=f[2]),a_(h,We(We({},t),{},{overrideExceptionType:d,defaultExceptionMessage:h}))}return a_(i,t)}function Hb(e){var t,n;return((t=JSON.stringify(e,(n=[],function(s,r){if(us(r)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(r)?"[Circular]":(n.push(r),r)}return r})))===null||t===void 0?void 0:t.length)||0}function eE(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),s=e.data.slice(0,n),r=e.data.slice(n);return[eE({size:Hb(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),eE({size:Hb(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var Sl=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Sl||{}),qa=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(qa||{}),tE="[SessionRecording]",nE="redacted",Jv={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},Zte=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ene=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],tne=["/s/","/e/","/i/"];function aP(e,t,n,s){if(En(e))return e;var r=t?.["content-length"]||function(i){return new Blob([i]).size}(e);return Hs(r)&&(r=parseInt(r)),r>n?tE+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function oP(e,t){if(En(e))return e;var n=e;return Yf(n,!1)||(n=tE+" "+t+" body "+nE),Mn(ene,s=>{var r,i;(r=n)!==null&&r!==void 0&&r.length&&((i=n)===null||i===void 0?void 0:i.indexOf(s))!==-1&&(n=tE+" "+t+" body "+nE+" as might contain: "+s)}),n}var nne=(e,t)=>{var n,s,r,i={payloadSizeLimitBytes:Jv.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Jv.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Jv.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,o=e.session_recording.recordBody!==!1&&t.recordBody,l=e.capture_performance!==!1&&t.recordPerformance,u=(n=i,r=Math.min(1e6,(s=n.payloadSizeLimitBytes)!==null&&s!==void 0?s:1e6),f=>(f!=null&&f.requestBody&&(f.requestBody=aP(f.requestBody,f.requestHeaders,r,"Request")),f!=null&&f.responseBody&&(f.responseBody=aP(f.responseBody,f.responseHeaders,r,"Response")),f)),d=f=>{return u(((v,b)=>{var w,C=xf(v.name),y=b.indexOf("http")===0?(w=xf(b))===null||w===void 0?void 0:w.pathname:b;y==="/"&&(y="");var k=C?.pathname.replace(y||"","");if(!(C&&k&&tne.some(_=>k.indexOf(_)===0)))return v})((m=(p=f).requestHeaders,En(m)||Mn(Object.keys(m??{}),v=>{Zte.includes(v.toLowerCase())&&(m[v]=nE)}),p),e.api_host));var p,m},h=no(e.session_recording.maskNetworkRequestFn);return h&&no(e.session_recording.maskCapturedNetworkRequestFn)&&At.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=f=>{var p=e.session_recording.maskNetworkRequestFn({url:f.name});return We(We({},f),{},{name:p?.url})}),i.maskRequestFn=no(e.session_recording.maskCapturedNetworkRequestFn)?f=>{var p,m,v,b=d(f);return b&&(p=(m=(v=e.session_recording).maskCapturedNetworkRequestFn)===null||m===void 0?void 0:m.call(v,b))!==null&&p!==void 0?p:void 0}:f=>function(p){if(!Ct(p))return p.requestBody=oP(p.requestBody,"Request"),p.responseBody=oP(p.responseBody,"Response"),p}(d(f)),We(We(We({},Jv),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function fa(e,t,n,s,r){return t>n&&(At.warn("min cannot be greater than max."),t=n),Qr(e)?e>n?(s&&At.warn(s+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(s&&At.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&At.warn(s+" must be a number. using max or fallback. max: "+n+", fallback: "+r),fa(r||n,t,n,s))}let sne=class{constructor(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ft(this,"bucketSize",100),ft(this,"refillRate",10),ft(this,"mutationBuckets",{}),ft(this,"loggedTracker",{}),ft(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(i=>{this.mutationBuckets[i]=this.mutationBuckets[i]+this.refillRate,this.mutationBuckets[i]>=this.bucketSize&&delete this.mutationBuckets[i]})}),ft(this,"getNodeOrRelevantParent",i=>{var a=this.rrweb.mirror.getNode(i);if(a?.nodeName!=="svg"&&a instanceof Element){var o=a.closest("svg");if(o)return[this.rrweb.mirror.getId(o),o]}return[i,a]}),ft(this,"numberOfChanges",i=>{var a,o,l,u,d,h,f,p;return((a=(o=i.removes)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0)+((l=(u=i.attributes)===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0)+((d=(h=i.texts)===null||h===void 0?void 0:h.length)!==null&&d!==void 0?d:0)+((f=(p=i.adds)===null||p===void 0?void 0:p.length)!==null&&f!==void 0?f:0)}),ft(this,"throttleMutations",i=>{if(i.type!==3||i.data.source!==0)return i;var a=i.data,o=this.numberOfChanges(a);a.attributes&&(a.attributes=a.attributes.filter(u=>{var d,h,f,[p,m]=this.getNodeOrRelevantParent(u.id);return this.mutationBuckets[p]===0?!1:(this.mutationBuckets[p]=(d=this.mutationBuckets[p])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[p]=Math.max(this.mutationBuckets[p]-1,0),this.mutationBuckets[p]===0&&(this.loggedTracker[p]||(this.loggedTracker[p]=!0,(h=(f=this.options).onBlockedNode)===null||h===void 0||h.call(f,p,m))),u)}));var l=this.numberOfChanges(a);return l!==0||o===l?i:void 0}),this.rrweb=t,this.options=r,this.refillRate=fa((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=fa((s=this.options.bucketSize)!==null&&s!==void 0?s:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var va=Uint8Array,pi=Uint16Array,Xf=Uint32Array,YT=new va([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),XT=new va([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),lP=new va([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pj=function(e,t){for(var n=new pi(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];var r=new Xf(n[30]);for(s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return[n,r]},gj=pj(YT,2),rne=gj[0],sE=gj[1];rne[28]=258,sE[258]=28;for(var cP=pj(XT,0)[1],mj=new pi(32768),Un=0;Un<32768;++Un){var Lu=(43690&Un)>>>1|(21845&Un)<<1;Lu=(61680&(Lu=(52428&Lu)>>>2|(13107&Lu)<<2))>>>4|(3855&Lu)<<4,mj[Un]=((65280&Lu)>>>8|(255&Lu)<<8)>>>1}var am=function(e,t,n){for(var s=e.length,r=0,i=new pi(t);r<s;++r)++i[e[r]-1];var a,o=new pi(t);for(r=0;r<t;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new pi(s),r=0;r<s;++r)a[r]=mj[o[e[r]-1]++]>>>15-e[r];return a},Nd=new va(288);for(Un=0;Un<144;++Un)Nd[Un]=8;for(Un=144;Un<256;++Un)Nd[Un]=9;for(Un=256;Un<280;++Un)Nd[Un]=7;for(Un=280;Un<288;++Un)Nd[Un]=8;var Ub=new va(32);for(Un=0;Un<32;++Un)Ub[Un]=5;var ine=am(Nd,9),ane=am(Ub,5),vj=function(e){return(e/8>>0)+(7&e&&1)},xj=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof pi?pi:e instanceof Xf?Xf:va)(n-t);return s.set(e.subarray(t,n)),s},Cl=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8},cg=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8,e[s+2]|=n>>>16},o_=function(e,t){for(var n=[],s=0;s<e.length;++s)e[s]&&n.push({s,f:e[s]});var r=n.length,i=n.slice();if(!r)return[new va(0),0];if(r==1){var a=new va(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(_,E){return _.f-E.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,h=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[u].f<n[h].f?u++:h++],l=n[u!=d&&n[u].f<n[h].f?u++:h++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var f=i[0].s;for(s=1;s<r;++s)i[s].s>f&&(f=i[s].s);var p=new pi(f+1),m=rE(n[d-1],p,0);if(m>t){s=0;var v=0,b=m-t,w=1<<b;for(i.sort(function(_,E){return p[E.s]-p[_.s]||_.f-E.f});s<r;++s){var C=i[s].s;if(!(p[C]>t))break;v+=w-(1<<m-p[C]),p[C]=t}for(v>>>=b;v>0;){var y=i[s].s;p[y]<t?v-=1<<t-p[y]++-1:++s}for(;s>=0&&v;--s){var k=i[s].s;p[k]==t&&(--p[k],++v)}m=t}return[new va(p),m]},rE=function(e,t,n){return e.s==-1?Math.max(rE(e.l,t,n+1),rE(e.r,t,n+1)):t[e.s]=n},uP=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new pi(++t),s=0,r=e[0],i=1,a=function(l){n[s++]=l},o=1;o<=t;++o)if(e[o]==r&&o!=t)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=e[o]}return[n.subarray(0,s),t]},ug=function(e,t){for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},iE=function(e,t,n){var s=n.length,r=vj(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var i=0;i<s;++i)e[r+i+4]=n[i];return 8*(r+4+s)},dP=function(e,t,n,s,r,i,a,o,l,u,d){Cl(t,d++,n),++r[256];for(var h=o_(r,15),f=h[0],p=h[1],m=o_(i,15),v=m[0],b=m[1],w=uP(f),C=w[0],y=w[1],k=uP(v),_=k[0],E=k[1],T=new pi(19),A=0;A<C.length;++A)T[31&C[A]]++;for(A=0;A<_.length;++A)T[31&_[A]]++;for(var F=o_(T,7),I=F[0],M=F[1],D=19;D>4&&!I[lP[D-1]];--D);var O,z,B,q,K=u+5<<3,Q=ug(r,Nd)+ug(i,Ub)+a,G=ug(r,f)+ug(i,v)+a+14+3*D+ug(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(K<=Q&&K<=G)return iE(t,d,e.subarray(l,l+u));if(Cl(t,d,1+(G<Q)),d+=2,G<Q){O=am(f,p),z=f,B=am(v,b),q=v;var X=am(I,M);for(Cl(t,d,y-257),Cl(t,d+5,E-1),Cl(t,d+10,D-4),d+=14,A=0;A<D;++A)Cl(t,d+3*A,I[lP[A]]);d+=3*D;for(var oe=[C,_],N=0;N<2;++N){var U=oe[N];for(A=0;A<U.length;++A){var V=31&U[A];Cl(t,d,X[V]),d+=I[V],V>15&&(Cl(t,d,U[A]>>>5&127),d+=U[A]>>>12)}}}else O=ine,z=Nd,B=ane,q=Ub;for(A=0;A<o;++A)if(s[A]>255){V=s[A]>>>18&31,cg(t,d,O[V+257]),d+=z[V+257],V>7&&(Cl(t,d,s[A]>>>23&31),d+=YT[V]);var H=31&s[A];cg(t,d,B[H]),d+=q[H],H>3&&(cg(t,d,s[A]>>>5&8191),d+=XT[H])}else cg(t,d,O[s[A]]),d+=z[s[A]];return cg(t,d,O[256]),d+z[256]},one=new Xf([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),lne=function(){for(var e=new Xf(256),t=0;t<256;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),cne=function(){var e=4294967295;return{p:function(t){for(var n=e,s=0;s<t.length;++s)n=lne[255&n^t[s]]^n>>>8;e=n},d:function(){return 4294967295^e}}},une=function(e,t,n,s,r){return function(i,a,o,l,u,d){var h=i.length,f=new va(l+h+5*(1+Math.floor(h/7e3))+u),p=f.subarray(l,f.length-u),m=0;if(!a||h<8)for(var v=0;v<=h;v+=65535){var b=v+65535;b<h?m=iE(p,m,i.subarray(v,b)):(p[v]=d,m=iE(p,m,i.subarray(v,h)))}else{for(var w=one[a-1],C=w>>>13,y=8191&w,k=(1<<o)-1,_=new pi(32768),E=new pi(k+1),T=Math.ceil(o/3),A=2*T,F=function(ue){return(i[ue]^i[ue+1]<<T^i[ue+2]<<A)&k},I=new Xf(25e3),M=new pi(288),D=new pi(32),O=0,z=0,B=(v=0,0),q=0,K=0;v<h;++v){var Q=F(v),G=32767&v,X=E[Q];if(_[G]=X,E[Q]=G,q<=v){var oe=h-v;if((O>7e3||B>24576)&&oe>423){m=dP(i,p,0,I,M,D,z,B,K,v-K,m),B=O=z=0,K=v;for(var N=0;N<286;++N)M[N]=0;for(N=0;N<30;++N)D[N]=0}var U=2,V=0,H=y,ae=G-X&32767;if(oe>2&&Q==F(v-ae))for(var he=Math.min(C,oe)-1,de=Math.min(32767,v),pe=Math.min(258,oe);ae<=de&&--H&&G!=X;){if(i[v+U]==i[v+U-ae]){for(var se=0;se<pe&&i[v+se]==i[v+se-ae];++se);if(se>U){if(U=se,V=ae,se>he)break;var ce=Math.min(ae,se-2),L=0;for(N=0;N<ce;++N){var xe=v-ae+N+32768&32767,ne=xe-_[xe]+32768&32767;ne>L&&(L=ne,X=xe)}}}ae+=(G=X)-(X=_[G])+32768&32767}if(V){I[B++]=268435456|sE[U]<<18|cP[V];var me=31&sE[U],ee=31&cP[V];z+=YT[me]+XT[ee],++M[257+me],++D[ee],q=v+U,++O}else I[B++]=i[v],++M[i[v]]}}m=dP(i,p,d,I,M,D,z,B,K,v-K,m)}return xj(f,0,l+vj(m)+u)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,s,!0)},aE=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},dne=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&aE(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var s=0;s<=n.length;++s)e[s+10]=n.charCodeAt(s)}},hne=function(e){return 10+(e.filename&&e.filename.length+1||0)};function bj(e,t){t===void 0&&(t={});var n=cne(),s=e.length;n.p(e);var r=une(e,t,hne(t),8),i=r.length;return dne(r,t),aE(r,i-8,n.d()),aE(r,i-4,s),r}function wj(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new va(e.length+(e.length>>>1)),r=0,i=function(u){s[r++]=u},a=0;a<n;++a){if(r+5>s.length){var o=new va(r+8+(n-a<<1));o.set(s),s=o}var l=e.charCodeAt(a);l<128||t?i(l):l<2048?(i(192|l>>>6),i(128|63&l)):l>55295&&l<57344?(i(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),i(128|l>>>12&63),i(128|l>>>6&63),i(128|63&l)):(i(224|l>>>12),i(128|l>>>6&63),i(128|63&l))}return xj(s,0,r)}function fne(e,t){return function(n){for(var s=0,r=0;r<n.length;r++)s=(s<<5)-s+n.charCodeAt(r),s|=0;return Math.abs(s)}(e)%100<fa(100*t,0,100)}var Vg="[SessionRecording]",yr=Or(Vg);function Zv(){var e,t;return Vt==null||(e=Vt.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var pne=3e5,gne=[qa.MouseMove,qa.MouseInteraction,qa.Scroll,qa.ViewportResize,qa.Input,qa.TouchMove,qa.MediaInteraction,qa.Drag],hP=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Bu(e){return function(t,n){for(var s="",r=0;r<t.length;){var i=t[r++];s+=String.fromCharCode(i)}return s}(bj(wj(JSON.stringify(e))))}function fP(e){return e.type===Sl.Custom&&e.data.tag==="sessionIdle"}function pP(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let mne=class{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Vg+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var t,n;return this.triggerStatus==="trigger_pending"?6e4:(t=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:pne}get isSampled(){var t=this.instance.get_property(Ug);return Rl(t)?t:null}get sessionDuration(){var t,n,s=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return s?s.timestamp-r:null}get isRecordingEnabled(){var t=!!this.instance.get_property(VS),n=!this.instance.config.disable_session_recording;return je&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(GD),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,s,r,i,a,o=this.instance.config.session_recording.captureCanvas,l=this.instance.get_property($D),u=(t=(n=o?.recordCanvas)!==null&&n!==void 0?n:l?.enabled)!==null&&t!==void 0&&t,d=(s=(r=o?.canvasFps)!==null&&r!==void 0?r:l?.fps)!==null&&s!==void 0?s:4,h=(i=(a=o?.canvasQuality)!==null&&a!==void 0?a:l?.quality)!==null&&i!==void 0?i:.4;if(typeof h=="string"){var f=parseFloat(h);h=isNaN(f)?.4:f}return{enabled:u,fps:fa(d,0,12,"canvas recording fps",4),quality:fa(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,s=this.instance.get_property(VD),r={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},i=r?.recordHeaders||s?.recordHeaders,a=r?.recordBody||s?.recordBody,o=us(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(Rl(o)?o:s?.capturePerformance);return i||a||l?{recordHeaders:i,recordBody:a,recordPerformance:l}:void 0}get masking(){var t,n,s,r,i,a,o=this.instance.get_property(WD),l={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(s=this.instance.config.session_recording)===null||s===void 0?void 0:s.blockSelector},u=(r=l?.maskAllInputs)!==null&&r!==void 0?r:o?.maskAllInputs,d=(i=l?.maskTextSelector)!==null&&i!==void 0?i:o?.maskTextSelector,h=(a=l?.blockSelector)!==null&&a!==void 0?a:o?.blockSelector;return Ct(u)&&Ct(d)&&Ct(h)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(zD);return Qr(t)?t:null}get minimumDuration(){var t=this.instance.get_property(qD);return Qr(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":En(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":Rl(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var t;return this._urlTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(Xy))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var t;return this._eventTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(Qy))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(ft(this,"queuedRRWebEvents",[]),ft(this,"isIdle","unknown"),ft(this,"_linkedFlagSeen",!1),ft(this,"_lastActivityTimestamp",Date.now()),ft(this,"_linkedFlag",null),ft(this,"_removePageViewCaptureHook",void 0),ft(this,"_onSessionIdListener",void 0),ft(this,"_persistDecideOnSessionListener",void 0),ft(this,"_samplingSessionListener",void 0),ft(this,"_urlTriggers",[]),ft(this,"_urlBlocklist",[]),ft(this,"_urlBlocked",!1),ft(this,"_eventTriggers",[]),ft(this,"_removeEventTriggerCaptureHook",void 0),ft(this,"_forceAllowLocalhostNetworkCapture",!1),ft(this,"_onBeforeUnload",()=>{this._flushBuffer()}),ft(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),ft(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),ft(this,"_onVisibilityChange",()=>{if(St!=null&&St.visibilityState){var r="window "+St.visibilityState;this._tryAddCustomEvent(r,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw yr.error("started without valid sessionManager"),new Error(Vg+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Vg+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:s}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=s,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&yr.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),Ss(je,"beforeunload",this._onBeforeUnload),Ss(je,"offline",this._onOffline),Ss(je,"online",this._onOnline),Ss(je,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),En(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var s=n!=null&&n.properties.$current_url?this._maskUrl(n?.properties.$current_url):"";if(!s)return;this._tryAddCustomEvent("$pageview",{href:s})}}catch(r){yr.error("Could not add $pageview to rrweb session",r)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,s,r)=>{var i,a,o,l;r&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:s,changeReason:r}),(i=this.instance)===null||i===void 0||(a=i.persistence)===null||a===void 0||a.unregister(Qy),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(Xy))}))):this.stopRecording()}stopRecording(){var t,n,s,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,je?.removeEventListener("beforeunload",this._onBeforeUnload),je?.removeEventListener("offline",this._onOffline),je?.removeEventListener("online",this._onOnline),je?.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(s=this._onSessionIdListener)===null||s===void 0||s.call(this),this._onSessionIdListener=void 0,(r=this._samplingSessionListener)===null||r===void 0||r.call(this),this._samplingSessionListener=void 0,yr.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Ug)}makeSamplingDecision(t){var n,s=this.sessionId!==t,r=this.sampleRate;if(Qr(r)){var i=this.isSampled,a=s||!Rl(i),o=a?fne(t,r):i;a&&(o?this._reportStarted("sampled"):yr.warn("Sample rate (".concat(r,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:o})),(n=this.instance.persistence)===null||n===void 0||n.register({[Ug]:o})}else this._resetSampling()}onRemoteConfig(t){var n,s,r,i,a,o;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(s=t.sessionRecording)!==null&&s!==void 0&&s.endpoint&&(this._endpoint=(o=t.sessionRecording)===null||o===void 0?void 0:o.endpoint),this._setupSampling(),!En(this._linkedFlag)&&!this._linkedFlagSeen){var l=Hs(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=Hs(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,h)=>{var f=us(h)&&l in h,p=u?h[l]===u:f;p&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),this._linkedFlagSeen=p})}(r=t.sessionRecording)!==null&&r!==void 0&&r.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(i=t.sessionRecording)!==null&&i!==void 0&&i.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(a=t.sessionRecording)!==null&&a!==void 0&&a.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Qr(this.sampleRate)&&En(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,s=this.instance.persistence,r=()=>{var i,a,o,l,u,d,h,f,p,m=(i=t.sessionRecording)===null||i===void 0?void 0:i.sampleRate,v=En(m)?null:parseFloat(m);En(v)&&this._resetSampling();var b=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;s.register({[VS]:!!t.sessionRecording,[GD]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[VD]:We({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[WD]:(u=t.sessionRecording)===null||u===void 0?void 0:u.masking,[$D]:{enabled:(d=t.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(h=t.sessionRecording)===null||h===void 0?void 0:h.canvasFps,quality:(f=t.sessionRecording)===null||f===void 0?void 0:f.canvasQuality},[zD]:v,[qD]:Ct(b)?null:b,[KD]:(p=t.sessionRecording)===null||p===void 0?void 0:p.scriptConfig})};r(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}log(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:s,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Ct(Object.assign)&&!Ct(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,s;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Zv()?this._onScriptLoaded():(n=Vt.__PosthogExtensions__)===null||n===void 0||(s=n.loadExternalDependency)===null||s===void 0||s.call(n,this.instance,this.scriptName,r=>{if(r)return yr.error("could not load recorder",r);this._onScriptLoaded()}),yr.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,s;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(s=n.get_property(KD))===null||s===void 0?void 0:s.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&gne.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var s=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var r=this.isIdle==="unknown";this.isIdle=!1,r||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}if(!this.isIdle){var{windowId:i,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),o=this.sessionId!==a,l=this.windowId!==i;this.windowId=i,this.sessionId=a,o||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):s&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):yr.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(hP(()=>Zv().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(hP(()=>Zv().takeFullSnapshot()))}_onScriptLoaded(){var t,n,s,r,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this.instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in i&&(o==="maskInputOptions"?i.maskInputOptions=We({password:!0},l):i[o]=l);this.canvasRecording&&this.canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling={canvas:this.canvasRecording.fps},i.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(i.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,i.maskTextSelector=(s=this.masking.maskTextSelector)!==null&&s!==void 0?s:void 0,i.blockSelector=(r=this.masking.blockSelector)!==null&&r!==void 0?r:void 0);var u=Zv();if(u){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new sne(u,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(h,f)=>{var p="Too many mutations on node '".concat(h,"'. Rate limiting. This could be due to SVG animations or something similar");yr.info(p,{node:f}),this.log(Vg+" "+p,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u(We({emit:h=>{this.onRRwebEmit(h)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=Rl(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map(h=>h?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else yr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,s,r,i=[],a=(t=Vt.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&i.push(a());var o=(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.rrwebPlugins)===null||r===void 0?void 0:r.getRecordNetworkPlugin;return this.networkPayloadCapture&&no(o)&&(!yte.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(nne(this.instance.config,this.networkPayloadCapture))):yr.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&us(t)){if(t.type===Sl.Meta){var s=this._maskUrl(t.data.href);if(this._lastHref=s,!s)return;t.data.href=s}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(h){return h.type===Sl.Custom&&h.data.tag==="recording paused"}(t)){t.type===Sl.FullSnapshot&&this._scheduleFullSnapshot(),t.type===Sl.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(r){var i=function(h){var f=h;if(f&&us(f)&&f.type===6&&us(f.data)&&f.data.plugin==="rrweb/console@1"){f.data.payload.payload.length>10&&(f.data.payload.payload=f.data.payload.payload.slice(0,10),f.data.payload.payload.push("...[truncated]"));for(var p=[],m=0;m<f.data.payload.payload.length;m++)f.data.payload.payload[m]&&f.data.payload.payload[m].length>2e3?p.push(f.data.payload.payload[m].slice(0,2e3)+"...[truncated]"):p.push(f.data.payload.payload[m]);return f.data.payload.payload=p,h}return h}(r);if(this._updateWindowAndSessionIds(i),this.isIdle!==!0||fP(i)){if(fP(i)){var a=i.data.payload;if(a){var o=a.lastActivityTimestamp,l=a.threshold;i.timestamp=o+l}}var u=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(h){if(Hb(h)<1024)return h;try{if(h.type===Sl.FullSnapshot)return We(We({},h),{},{data:Bu(h.data),cv:"2024-10"});if(h.type===Sl.IncrementalSnapshot&&h.data.source===qa.Mutation)return We(We({},h),{},{cv:"2024-10",data:We(We({},h.data),{},{texts:Bu(h.data.texts),attributes:Bu(h.data.attributes),removes:Bu(h.data.removes),adds:Bu(h.data.adds)})});if(h.type===Sl.IncrementalSnapshot&&h.data.source===qa.StyleSheetRule)return We(We({},h),{},{cv:"2024-10",data:We(We({},h.data),{},{adds:h.data.adds?Bu(h.data.adds):void 0,removes:h.data.removes?Bu(h.data.removes):void 0})})}catch(f){yr.error("could not compress event - will use uncompressed event",f)}return h}(i):i,d={$snapshot_bytes:Hb(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&je){var t=this._maskUrl(je.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var s,r={url:t};return(s=r=n.maskNetworkRequestFn(r))===null||s===void 0?void 0:s.url}return t}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,s=Qr(n)&&n>=0,r=Qr(t)&&s&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||r?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&eE(this.buffer).forEach(i=>{this._captureSnapshot({$snapshot_bytes:i.size,$snapshot_data:i.data,$session_id:i.sessionId,$window_id:i.windowId,$lib:"web",$lib_version:kl.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,s=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+s>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(je!==void 0&&je.location.href){var t=je.location.href,n=this._urlBlocked,s=pP(t,this._urlBlocklist);s&&!n?this._pauseRecording():!s&&n&&this._resumeRecording(),pP(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,s;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[t==="url"?Xy:Qy]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),yr.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),yr.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&En(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){yr.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.register({[Ug]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(t){this._activateTrigger(t)}_reportStarted(t,n){this.instance.register_for_session({$session_recording_start_reason:t}),yr.info(t.replace("_"," "),n),Zt(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.buffer.data.length,$sdk_debug_replay_internal_buffer_size:this.buffer.size,$sdk_debug_current_session_duration:this.sessionDuration,$sdk_debug_session_start:t}}};var l_=Or("[SegmentIntegration]");function vne(e,t){var n=e.config.segment;if(!n)return t();(function(s,r){var i=s.config.segment;if(!i)return r();var a=l=>{var u=()=>l.anonymousId()||Bc();s.config.get_device_id=u,l.id()&&(s.register({distinct_id:l.id(),$device_id:u()}),s.persistence.set_property(_l,"identified")),r()},o=i.user();"then"in o&&no(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((s=>{Promise&&Promise.resolve||l_.warn("This browser does not have Promise support, and can not use the segment integration");var r=(i,a)=>{var o;if(!a)return i;i.event.userId||i.event.anonymousId===s.get_distinct_id()||(l_.info("No userId set, resetting PostHog"),s.reset()),i.event.userId&&i.event.userId!==s.get_distinct_id()&&(l_.info("UserId set, identifying with PostHog"),s.identify(i.event.userId));var l=s._calculate_event_properties(a,(o=i.event.properties)!==null&&o!==void 0?o:{},new Date);return i.event.properties=Object.assign({},l,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:i=>r(i,i.event.event),page:i=>r(i,"$pageview"),identify:i=>r(i,"$identify"),screen:i=>r(i,"$screen")}})(e)).then(()=>{t()})})}var Cj="posthog-js";function yj(e){var{organization:t,projectId:n,prefix:s,severityAllowList:r=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=>{var a,o,l,u,d;if(!(r==="*"||r.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var h=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));i.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var f=((a=i.exception)===null||a===void 0?void 0:a.values)||[],p=f.map(v=>We(We({},v),{},{stacktrace:v.stacktrace?We(We({},v.stacktrace),{},{type:"raw",frames:(v.stacktrace.frames||[]).map(b=>We(We({},b),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((o=f[0])===null||o===void 0?void 0:o.value)||i.message,$exception_type:(l=f[0])===null||l===void 0?void 0:l.type,$exception_personURL:h,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((u=f[0])===null||u===void 0?void 0:u.value)||i.message,$sentry_exception_type:(d=f[0])===null||d===void 0?void 0:d.type,$sentry_tags:i.tags};return t&&n&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(m),i}}let xne=class{constructor(t,n,s,r,i){this.name=Cj,this.setupOnce=function(a){a(yj(t,{organization:n,projectId:s,prefix:r,severityAllowList:i}))}}};var El,bne=je!=null&&je.location?jb(je.location.hash,"__posthog")||jb(location.hash,"state"):null,gP="_postHogToolbarParams",mP=Or("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(El||(El={}));class wne{constructor(t){this.instance=t}setToolbarState(t){Vt.ph_toolbar_state=t}getToolbarState(){var t;return(t=Vt.ph_toolbar_state)!==null&&t!==void 0?t:El.UNINITIALIZED}maybeLoadToolbar(){var t,n,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!je||!St)return!1;s=(t=s)!==null&&t!==void 0?t:je.location,i=(n=i)!==null&&n!==void 0?n:je.history;try{if(!r){try{je.localStorage.setItem("test","test"),je.localStorage.removeItem("test")}catch{return!1}r=je?.localStorage}var a,o=bne||jb(s.hash,"__posthog")||jb(s.hash,"state"),l=o?LD(()=>JSON.parse(atob(decodeURIComponent(o))))||LD(()=>JSON.parse(decodeURIComponent(o))):null;return l&&l.action==="ph_authorize"?((a=l).source="url",a&&Object.keys(a).length>0&&(l.desiredHash?s.hash=l.desiredHash:i?i.replaceState(i.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(r.getItem(gP)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=Vt.ph_load_toolbar||Vt.ph_load_editor;!En(n)&&no(n)?n(t,this.instance):mP.warn("No toolbar load function found")}loadToolbar(t){var n=!(St==null||!St.getElementById(J6));if(!je||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=We(We({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(je.localStorage.setItem(gP,JSON.stringify(We(We({},r),{},{source:void 0}))),this.getToolbarState()===El.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===El.UNINITIALIZED){var i,a;this.setToolbarState(El.LOADING),(i=Vt.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this.instance,"toolbar",o=>{if(o)return mP.error("[Toolbar] Failed to load",o),void this.setToolbarState(El.UNINITIALIZED);this.setToolbarState(El.LOADED),this._callLoadToolbar(r)}),Ss(je,"turbolinks:load",()=>{this.setToolbarState(El.UNINITIALIZED),this.loadToolbar(r)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,s)}}var Cne=Or("[TracingHeaders]");class yne{constructor(t){ft(this,"_restoreXHRPatch",void 0),ft(this,"_restoreFetchPatch",void 0),ft(this,"_startCapturing",()=>{var n,s,r,i;Ct(this._restoreXHRPatch)&&((n=Vt.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchXHR(this.instance.sessionManager)),Ct(this._restoreFetchPatch)&&((r=Vt.__PosthogExtensions__)===null||r===void 0||(i=r.tracingHeadersPatchFns)===null||i===void 0||i._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"tracing-headers",i=>{if(i)return Cne.error("failed to load script",i);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var wc=Or("[Web Vitals]"),vP=9e5;class _ne{constructor(t){var n;ft(this,"_enabledServerSide",!1),ft(this,"_initialized",!1),ft(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),ft(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((s,r)=>We(We({},s),{},{["$web_vitals_".concat(r.name,"_event")]:We({},r),["$web_vitals_".concat(r.name,"_value")]:r.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),ft(this,"_addToBuffer",s=>{var r,i=(r=this.instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0);if(Ct(i))wc.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Ct(a)||(En(s?.name)||En(s?.value)?wc.error("Invalid metric received",s):this._maxAllowedValue&&s.value>=this._maxAllowedValue?wc.error("Ignoring metric with value >= "+this._maxAllowedValue,s):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Ct(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Ct(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(We(We({},s),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),ft(this,"_startCapturing",()=>{var s,r,i,a,o=Vt.__PosthogExtensions__;Ct(o)||Ct(o.postHogWebVitalsCallbacks)||({onLCP:s,onCLS:r,onFCP:i,onINP:a}=o.postHogWebVitalsCallbacks),s&&r&&i&&a?(this.allowedMetrics.indexOf("LCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this._addToBuffer.bind(this)),this._initialized=!0):wc.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[HD]),this.startIfEnabled()}get allowedMetrics(){var t,n,s=us(this.instance.config.capture_performance)?(t=this.instance.config.capture_performance)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Ct(s)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[UD])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(us(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=us(this.instance.config.capture_performance)&&Qr(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:vP;return 0<t&&t<=6e4?vP:t}get isEnabled(){var t=di?.protocol;if(t!=="http:"&&t!=="https:")return wc.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=us(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:Rl(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return Rl(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(wc.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=us(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=us(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[HD]:n}),this.instance.persistence.register({[UD]:s})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"web-vitals",i=>{i?wc.error("failed to load script",i):t()})}_currentURL(){var t=je?je.location.href:void 0;return t||wc.error("Could not determine current URL"),t}}var Sne=Or("[Heatmaps]");function xP(e){return us(e)&&"clientX"in e&&"clientY"in e&&Qr(e.clientX)&&Qr(e.clientY)}class Ene{constructor(t){var n;ft(this,"rageclicks",new cj),ft(this,"_enabledServerSide",!1),ft(this,"_initialized",!1),ft(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[GS])}get flushIntervalMilliseconds(){var t=5e3;return us(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ct(this.instance.config.capture_heatmaps)?Ct(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Sne.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this._flushInterval)!==null&&t!==void 0?t:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[GS]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.buffer;return this.buffer=void 0,t}_onDeadClick(t){this._onClick(t.originalEvent,"deadclick")}_setupListeners(){je&&St&&(Ss(je,"beforeunload",this.flush.bind(this)),Ss(St,"click",t=>this._onClick(t||je?.event),{capture:!0}),Ss(St,"mousemove",t=>this._onMouseMove(t||je?.event),{capture:!0}),this.deadClicksCapture=new dj(this.instance,Bte,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(o,l,u){for(var d=o;d&&DC(d)&&!Yc(d,"body");){if(d===u)return!1;if(Zt(l,je?.getComputedStyle(d).position))return!0;d=sj(d)}return!1}(nj(t),["fixed","sticky"],i);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:s),target_fixed:a,type:n}}_onClick(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!XD(t.target)&&xP(t)){var r=this._getProperties(t,s);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(We(We({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(t){!XD(t.target)&&xP(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(je){var n=je.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!of(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class kne{constructor(t){this._instance=t}doPageView(t,n){var s,r=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(s=je?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var s=this._currentPageview;if(!s)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:s.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:d,maxContentY:h}=i;if(!(Ct(a)||Ct(o)||Ct(l)||Ct(u)||Ct(d)||Ct(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),h=Math.ceil(h);var f=a<=1?1:fa(o/a,0,1),p=a<=1?1:fa(l/a,0,1),m=u<=1?1:fa(d/u,0,1),v=u<=1?1:fa(h/u,0,1);r=ys(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),r}}let Tne=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var xa="Mobile",Gb="iOS",Uo="Android",n0="Tablet",_j=Uo+" "+n0,Sj="iPad",Ej="Apple",kj=Ej+" Watch",s0="Safari",Qf="BlackBerry",Tj="Samsung",Rj=Tj+"Browser",Aj=Tj+" Internet",Md="Chrome",Rne=Md+" OS",Fj=Md+" "+Gb,QT="Internet Explorer",Dj=QT+" "+xa,JT="Opera",Ane=JT+" Mini",ZT="Edge",Pj="Microsoft "+ZT,bf="Firefox",Ij=bf+" "+Gb,r0="Nintendo",i0="PlayStation",wf="Xbox",Nj=Uo+" "+xa,Mj=xa+" "+s0,Wg="Windows",oE=Wg+" Phone",bP="Nokia",lE="Ouya",Oj="Generic",Fne=Oj+" "+xa.toLowerCase(),Lj=Oj+" "+n0.toLowerCase(),cE="Konqueror",qr="(\\d+(\\.\\d+)?)",c_=new RegExp("Version/"+qr),Dne=new RegExp(wf,"i"),Pne=new RegExp(i0+" \\w+","i"),Ine=new RegExp(r0+" \\w+","i"),eR=new RegExp(Qf+"|PlayBook|BB10","i"),Nne={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},uE,Mne=(e,t)=>t&&Zt(t,Ej)||function(n){return Zt(n,s0)&&!Zt(n,Md)&&!Zt(n,Uo)}(e),wP=function(e,t){return t=t||"",Zt(e," OPR/")&&Zt(e,"Mini")?Ane:Zt(e," OPR/")?JT:eR.test(e)?Qf:Zt(e,"IE"+xa)||Zt(e,"WPDesktop")?Dj:Zt(e,Rj)?Aj:Zt(e,ZT)||Zt(e,"Edg/")?Pj:Zt(e,"FBIOS")?"Facebook "+xa:Zt(e,"UCWEB")||Zt(e,"UCBrowser")?"UC Browser":Zt(e,"CriOS")?Fj:Zt(e,"CrMo")||Zt(e,Md)?Md:Zt(e,Uo)&&Zt(e,s0)?Nj:Zt(e,"FxiOS")?Ij:Zt(e.toLowerCase(),cE.toLowerCase())?cE:Mne(e,t)?Zt(e,xa)?Mj:s0:Zt(e,bf)?bf:Zt(e,"MSIE")||Zt(e,"Trident/")?QT:Zt(e,"Gecko")?bf:""},One={[Dj]:[new RegExp("rv:"+qr)],[Pj]:[new RegExp(ZT+"?\\/"+qr)],[Md]:[new RegExp("("+Md+"|CrMo)\\/"+qr)],[Fj]:[new RegExp("CriOS\\/"+qr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+qr)],[s0]:[c_],[Mj]:[c_],[JT]:[new RegExp("(Opera|OPR)\\/"+qr)],[bf]:[new RegExp(bf+"\\/"+qr)],[Ij]:[new RegExp("FxiOS\\/"+qr)],[cE]:[new RegExp("Konqueror[:/]?"+qr,"i")],[Qf]:[new RegExp(Qf+" "+qr),c_],[Nj]:[new RegExp("android\\s"+qr,"i")],[Aj]:[new RegExp(Rj+"\\/"+qr)],[QT]:[new RegExp("(rv:|MSIE )"+qr)],Mozilla:[new RegExp("rv:"+qr)]},CP=[[new RegExp(wf+"; "+wf+" (.*?)[);]","i"),e=>[wf,e&&e[1]||""]],[new RegExp(r0,"i"),[r0,""]],[new RegExp(i0,"i"),[i0,""]],[eR,[Qf,""]],[new RegExp(Wg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[oE,""];if(new RegExp(xa).test(t)&&!/IEMobile\b/.test(t))return[Wg+" "+xa,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=n[1],r=Nne[s]||"";return/arm/i.test(t)&&(r="RT"),[Wg,r]}return[Wg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Gb,t.join(".")]}return[Gb,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ct(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Uo+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Uo+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Uo,t.join(".")]}return[Uo,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Rne,""]],[/Linux|debian/i,["Linux",""]]],yP=function(e){return Ine.test(e)?r0:Pne.test(e)?i0:Dne.test(e)?wf:new RegExp(lE,"i").test(e)?lE:new RegExp("("+oE+"|WPDesktop)","i").test(e)?oE:/iPad/.test(e)?Sj:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?kj:eR.test(e)?Qf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(bP,"i").test(e)?bP:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(xa).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Uo:_j:Uo:new RegExp("(pda|"+xa+")","i").test(e)?Fne:new RegExp(n0,"i").test(e)&&!new RegExp(n0+" pc","i").test(e)?Lj:""},ex="https?://(.*)",nb=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],Lne=Jx(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],nb),u_="<masked>",Qn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!St)return{};var s=t?Jx([],nb,n||[]):[];return this._campaignParamsFromUrl(Jy(St.URL,s,u_),e)},_campaignParamsFromUrl:function(e,t){var n=Lne.concat(t||[]),s={};return Mn(n,function(r){var i=Bb(e,r);s[r]=i||null}),s},_searchEngine:function(e){return e?e.search(ex+"google.([^/?]*)")===0?"google":e.search(ex+"bing.com")===0?"bing":e.search(ex+"yahoo.com")===0?"yahoo":e.search(ex+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Qn._searchEngine(e),n=t!="yahoo"?"q":"p",s={};if(!pu(t)){s.$search_engine=t;var r=St?Bb(St.referrer,n):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=St?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:wP,browserVersion:function(e,t){var n=wP(e,t),s=One[n];if(Ct(s))return null;for(var r=0;r<s.length;r++){var i=s[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<CP.length;t++){var[n,s]=CP[t],r=n.exec(e),i=r&&(no(s)?s(r,e):s);if(i)return i}return["",""]},device:yP,deviceType:function(e){var t=yP(e);return t===Sj||t===_j||t==="Kobo"||t==="Kindle Fire"||t===Lj?n0:t===r0||t===wf||t===i0||t===lE?"Console":t===kj?"Wearable":t?xa:"Desktop"},referrer:function(){return St?.referrer||"$direct"},referringDomain:function(){var e;return St!=null&&St.referrer&&((e=xf(St.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?Jx([],nb,t||[]):[],s=di?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:s?Jy(s,n,u_):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:s}=e,r={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=xf(n))===null||t===void 0?void 0:t.host};if(s){r.$current_url=s;var i=xf(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(s);ys(r,a)}if(n){var o=this._searchInfoFromReferrer(n);ys(r,o)}return r},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return Mn(t,function(s,r){n["$initial_".concat(zT(r))]=s}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Bs)return{};var n=e?Jx([],nb,t||[]):[],[s,r]=Qn.os(Bs);return ys(t0({$os:s,$os_version:r,$browser:Qn.browser(Bs,navigator.vendor),$device:Qn.device(Bs),$device_type:Qn.deviceType(Bs),$timezone:Qn.timezone(),$timezone_offset:Qn.timezoneOffset()}),{$current_url:Jy(di?.href,n,u_),$host:di?.host,$pathname:di?.pathname,$raw_user_agent:Bs.length>1e3?Bs.substring(0,997)+"...":Bs,$browser_version:Qn.browserVersion(Bs,navigator.vendor),$browser_language:Qn.browserLanguage(),$browser_language_prefix:Qn.browserLanguagePrefix(),$screen_height:je?.screen.height,$screen_width:je?.screen.width,$viewport_height:je?.innerHeight,$viewport_width:je?.innerWidth,$lib:"web",$lib_version:kl.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!Bs)return{};var[e,t]=Qn.os(Bs);return ys(t0({$os:e,$os_version:t,$browser:Qn.browser(Bs,navigator.vendor)}),{$browser_version:Qn.browserVersion(Bs,navigator.vendor)})}},Do=Or("[FeatureFlags]"),d_="$active_feature_flags",Ph="$override_feature_flags",_P="$feature_flag_payloads",dg="$override_feature_flag_payloads",SP="$feature_flag_request_id",EP=e=>{var t={};for(var[n,s]of Zx(e||{}))s&&(t[n]=s);return t},Bne=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var s;return[n,(s=t[n].variant)!==null&&s!==void 0?s:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var s;return(s=t[n].metadata)===null||s===void 0?void 0:s.payload}).map(n=>{var s;return[n,(s=t[n].metadata)===null||s===void 0?void 0:s.payload]}))):Do.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(uE||(uE={}));class jne{constructor(t){ft(this,"_override_warning",!1),ft(this,"_hasLoadedFlags",!1),ft(this,"_requestInFlight",!1),ft(this,"_reloadingDisabled",!1),ft(this,"_additionalReloadRequested",!1),ft(this,"_decideCalled",!1),ft(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property(WS),n=this.instance.get_property(Ph),s=this.instance.get_property(dg);if(!s&&!n)return t||{};var r=ys({},t||{}),i=[...new Set([...Object.keys(s||{}),...Object.keys(n||{})])];for(var a of i){var o,l,u=r[a],d=n?.[a],h=Ct(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,f=Ct(d)?u.variant:typeof d=="string"?d:void 0,p=s?.[a],m=We(We({},u),{},{enabled:h,variant:h?f??u?.variant:void 0});h!==u?.enabled&&(m.original_enabled=u?.enabled),f!==u?.variant&&(m.original_variant=u?.variant),p&&(m.metadata=We(We({},u?.metadata),{},{payload:p,original_payload:u==null||(l=u.metadata)===null||l===void 0?void 0:l.payload})),r[a]=m}return this._override_warning||(Do.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var t=this.instance.get_property(lf),n=this.instance.get_property(Ph);if(!n)return t||{};for(var s=ys({},t),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(Do.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:s}),this._override_warning=!0),s}getFlagPayloads(){var t=this.instance.get_property(_P),n=this.instance.get_property(dg);if(!n)return t||{};for(var s=ys({},t||{}),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(Do.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:s}),this._override_warning=!0),s}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:We(We({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Gg)||{}),group_properties:this.instance.get_property(Wu)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0);var r=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;r&&(s.timezone=Qn.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",r?"/flags/?v=2":"/decide/?v=4"),data:s,compression:this.instance.config.disable_compression?void 0:Qa.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var a,o,l,u=!0;i.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),u=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((l=i.json)!==null&&l!==void 0?l:{})),s.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!u,i.json&&(a=i.json.quotaLimited)!==null&&a!==void 0&&a.includes(uE.FeatureFlags)?Do.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((o=i.json)!==null&&o!==void 0?o:{},u),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var s=this.getFlagVariants()[t],r="".concat(s),i=this.instance.get_property(SP)||void 0,a=this.instance.get_property(Mb)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(r))){var o,l,u,d,h,f,p,m,v,b,w;cs(a[t])?a[t].push(r):a[t]=[r],(o=this.instance.persistence)===null||o===void 0||o.register({[Mb]:a});var C=this.getFeatureFlagDetails(t),y={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:i,$feature_flag_bootstrapped_response:((l=this.instance.config.bootstrap)===null||l===void 0||(u=l.featureFlags)===null||u===void 0?void 0:u[t])||null,$feature_flag_bootstrapped_payload:((d=this.instance.config.bootstrap)===null||d===void 0||(h=d.featureFlagPayloads)===null||h===void 0?void 0:h[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Ct(C==null||(f=C.metadata)===null||f===void 0?void 0:f.version)||(y.$feature_flag_version=C.metadata.version);var k,_=(p=C==null||(m=C.reason)===null||m===void 0?void 0:m.description)!==null&&p!==void 0?p:C==null||(v=C.reason)===null||v===void 0?void 0:v.code;_&&(y.$feature_flag_reason=_),C!=null&&(b=C.metadata)!==null&&b!==void 0&&b.id&&(y.$feature_flag_id=C.metadata.id),Ct(C?.original_variant)&&Ct(C?.original_enabled)||(y.$feature_flag_original_response=Ct(C.original_variant)?C.original_enabled:C.original_variant),C!=null&&(w=C.metadata)!==null&&w!==void 0&&w.original_payload&&(y.$feature_flag_original_payload=C==null||(k=C.metadata)===null||k===void 0?void 0:k.original_payload),this.instance.capture("$feature_flag_called",y)}return s}Do.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var s=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:s},compression:this.instance.config.disable_compression?void 0:Qa.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:r=>{var i,a=(i=r.json)===null||i===void 0?void 0:i.featureFlagPayloads;n(a?.[t]||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);Do.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},h=Bne(a),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var v=a.requestId;if(cs(p)){Do.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(p)for(var w=0;w<p.length;w++)b[p[w]]=!0;o&&o.register({[d_]:p,[lf]:b})}else{var C=p,y=m,k=f;a.errorsWhileComputingFlags&&(C=We(We({},l),C),y=We(We({},u),y),k=We(We({},d),k)),o&&o.register(We({[d_]:Object.keys(EP(C)),[lf]:C||{},[_P]:y||{},[WS]:k||{}},v?{[SP]:v}:{}))}}})(t,this.instance.persistence,s,r,i),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];Do.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return Do.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Ph),this.instance.persistence.unregister(dg),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,s=t;if(this._override_warning=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.instance.persistence.unregister(Ph);else if(s.flags)if(cs(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this.instance.persistence.register({[Ph]:r})}else this.instance.persistence.register({[Ph]:s.flags})}return"payloads"in s&&(s.payloads===!1?this.instance.persistence.unregister(dg):s.payloads&&this.instance.persistence.register({[dg]:s.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();t(n,s)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var s,r=(this.instance.get_property(eb)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:i};r&&(a.$early_access_feature_name=r.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var o=We(We({},this.getFlagVariants()),{},{[t]:n});(s=this.instance.persistence)===null||s===void 0||s.register({[d_]:Object.keys(EP(o)),[lf]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0,r=this.instance.get_property(eb),i=s?"&".concat(s.map(a=>"stage=".concat(a)).join("&")):"";if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(i)),method:"GET",callback:a=>{var o;if(a.json){var l=a.json.earlyAccessFeatures;return(o=this.instance.persistence)===null||o===void 0||o.register({[eb]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(s=>n[s]),flagVariants:Object.keys(n).filter(s=>n[s]).reduce((s,r)=>(s[r]=n[r],s),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(r=>r(n,s,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Gg)||{};this.instance.register({[Gg]:We(We({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Gg)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Wu)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=We(We({},s[r]),t[r]),delete t[r]}),this.instance.register({[Wu]:We(We({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Wu)||{};this.instance.register({[Wu]:We(We({},n),{},{[t]:{}})})}else this.instance.unregister(Wu)}}var Hne=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class h_{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&At.info("Persistence loaded",t.persistence,We({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){Hne.indexOf(t.persistence.toLowerCase())===-1&&(At.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Ws.is_supported()?Ws:n==="localstorage+cookie"&&Kv.is_supported()?Kv:n==="sessionstorage"&&hr.is_supported()?hr:n==="memory"?Ote:n==="cookie"?Ml:Kv.is_supported()?Kv:Ml}properties(){var t={};return Mn(this.props,function(n,s){if(s===lf&&us(n))for(var r=Object.keys(n),i=0;i<r.length;i++)t["$feature/".concat(r[i])]=n[r[i]];else o=s,l=!1,(pu(a=pte)?l:ID&&a.indexOf===ID?a.indexOf(o)!=-1:(Mn(a,function(u){if(l||(l=u===o))return Ib}),l))||(t[s]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=ys({},t))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(t,n,s){if(us(t)){Ct(n)&&(n="None"),this.expire_days=Ct(s)?this.default_expiry:s;var r=!1;if(Mn(t,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,r=!0)}),r)return this.save(),!0}return!1}register(t,n){if(us(t)){this.expire_days=Ct(n)?this.default_expiry:n;var s=!1;if(Mn(t,(r,i)=>{t.hasOwnProperty(i)&&this.props[i]!==r&&(this.props[i]=r,s=!0)}),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=Qn.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});of(t0(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Qn.searchInfo())}update_referrer_info(){this.register_once(Qn.referrerInfo(),void 0)}set_initial_person_info(){this.props[KS]||this.props[YS]||this.register_once({[XS]:Qn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return t0({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};Mn([YS,KS],r=>{var i=this.props[r];i&&Mn(i,function(a,o){t["$initial_"+zT(o)]=a})});var n=this.props[XS];if(n){var s=Qn.initialPersonPropsFromInfo(n);ys(t,s)}return t}safe_merge(t){return Mn(this.props,function(n,s){s in t||(t[s]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var s=this.buildStorage(t),r=this.props;this.clear(),this.storage=s,this.props=r,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var s=this.props[Hg]||{};s[t]=n,this.props[Hg]=s,this.save()}remove_event_timer(t){var n=(this.props[Hg]||{})[t];return Ct(n)||(delete this.props[Hg][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var Bj,ds,jj,Yu,kP,Hj,dE,Uj,TP,hE,RP,AP,FP,DP,fE={},Gj=[],Une=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tR=Array.isArray;function jc(e,t){for(var n in t)e[n]=t[n];return e}function Vj(e){var t=e.parentNode;t&&t.removeChild(e)}function f_(e,t,n,s,r){var i={type:e,props:t,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++jj,__i:-1,__u:0};return r==null&&ds.vnode!=null&&ds.vnode(i),i}function nR(e){return e.children}function sb(e,t){this.props=e,this.context=t}function Jf(e,t){if(t==null)return e.__?Jf(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Jf(e):null}function Wj(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Wj(e)}}function pE(e){(!e.__d&&(e.__d=!0)&&Yu.push(e)&&!Vb.__r++||kP!==ds.debounceRendering)&&((kP=ds.debounceRendering)||Hj)(Vb)}function Vb(){var e,t,n,s,r,i,a,o,l;for(Yu.sort(dE);e=Yu.shift();)e.__d&&(t=Yu.length,s=void 0,i=(r=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((s=jc({},r)).__v=r.__v+1,ds.vnode&&ds.vnode(s),qj(a,s,r,n.__n,a.ownerSVGElement!==void 0,32&r.__u?[i]:null,o,i??Jf(r),!!(32&r.__u),l),s.__.__k[s.__i]=s,Wne(o,s,l),s.__e!=i&&Wj(s)),Yu.length>t&&Yu.sort(dE));Vb.__r=0}function $j(e,t,n,s,r,i,a,o,l,u,d){var h,f,p,m,v,b=s&&s.__k||Gj,w=t.length;for(n.__d=l,Gne(n,t,b),l=n.__d,h=0;h<w;h++)(p=n.__k[h])!=null&&typeof p!="boolean"&&typeof p!="function"&&(f=p.__i===-1?fE:b[p.__i]||fE,p.__i=h,qj(e,p,f,r,i,a,o,l,u,d),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&sR(f.ref,null,p),d.push(p.ref,p.__c||m,p)),v==null&&m!=null&&(v=m),65536&p.__u||f.__k===p.__k?l=zj(p,l,e):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:m&&(l=m.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=v}function Gne(e,t,n){var s,r,i,a,o,l=t.length,u=n.length,d=u,h=0;for(e.__k=[],s=0;s<l;s++)(r=e.__k[s]=(r=t[s])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?f_(null,r,null,null,r):tR(r)?f_(nR,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?f_(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,o=Vne(r,n,a=s+h,d),r.__i=o,i=null,o!==-1&&(d--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&h--,typeof r.type!="function"&&(r.__u|=65536)):o!==a&&(o===a+1?h++:o>a?d>l-a?h+=o-a:h--:h=o<a&&o==a-1?o-a:0,o!==s+h&&(r.__u|=65536))):(i=n[s])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=Jf(i)),gE(i,i,!1),n[s]=null,d--);if(d)for(s=0;s<u;s++)(i=n[s])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Jf(i)),gE(i,i))}function zj(e,t,n){var s,r;if(typeof e.type=="function"){for(s=e.__k,r=0;s&&r<s.length;r++)s[r]&&(s[r].__=e,t=zj(s[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Vne(e,t,n,s){var r=e.key,i=e.type,a=n-1,o=n+1,l=t[n];if(l===null||l&&r==l.key&&i===l.type)return n;if(s>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||o<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return a;a--}if(o<t.length){if((l=t[o])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return o;o++}}return-1}function PP(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Une.test(t)?n:n+"px"}function tx(e,t,n,s,r){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(t in s)n&&t in n||PP(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||PP(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?s?n.u=s.u:(n.u=Date.now(),e.addEventListener(t,i?NP:IP,i)):e.removeEventListener(t,i?NP:IP,i);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function IP(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(ds.event?ds.event(e):e)}function NP(e){return this.l[e.type+!0](ds.event?ds.event(e):e)}function qj(e,t,n,s,r,i,a,o,l,u){var d,h,f,p,m,v,b,w,C,y,k,_,E,T,A,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=ds.__b)&&d(t);e:if(typeof F=="function")try{if(w=t.props,C=(d=F.contextType)&&s[d.__c],y=d?C?C.props.value:d.__:s,n.__c?b=(h=t.__c=n.__c).__=h.__E:("prototype"in F&&F.prototype.render?t.__c=h=new F(w,y):(t.__c=h=new sb(w,y),h.constructor=F,h.render=zne),C&&C.sub(h),h.props=w,h.state||(h.state={}),h.context=y,h.__n=s,f=h.__d=!0,h.__h=[],h._sb=[]),h.__s==null&&(h.__s=h.state),F.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=jc({},h.__s)),jc(h.__s,F.getDerivedStateFromProps(w,h.__s))),p=h.props,m=h.state,h.__v=t,f)F.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(F.getDerivedStateFromProps==null&&w!==p&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(w,y),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(w,h.__s,y)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=w,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(I){I&&(I.__=t)}),k=0;k<h._sb.length;k++)h.__h.push(h._sb[k]);h._sb=[],h.__h.length&&a.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(w,h.__s,y),h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(p,m,v)})}if(h.context=y,h.props=w,h.__P=e,h.__e=!1,_=ds.__r,E=0,"prototype"in F&&F.prototype.render){for(h.state=h.__s,h.__d=!1,_&&_(t),d=h.render(h.props,h.state,h.context),T=0;T<h._sb.length;T++)h.__h.push(h._sb[T]);h._sb=[]}else do h.__d=!1,_&&_(t),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++E<25);h.state=h.__s,h.getChildContext!=null&&(s=jc(jc({},s),h.getChildContext())),f||h.getSnapshotBeforeUpdate==null||(v=h.getSnapshotBeforeUpdate(p,m)),$j(e,tR(A=d!=null&&d.type===nR&&d.key==null?d.props.children:d)?A:[A],t,n,s,r,i,a,o,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&a.push(h),b&&(h.__E=h.__=null)}catch(I){t.__v=null,l||i!=null?(t.__e=o,t.__u|=l?160:32,i[i.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),ds.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=$ne(n.__e,t,n,s,r,i,a,l,u);(d=ds.diffed)&&d(t)}function Wne(e,t,n){t.__d=void 0;for(var s=0;s<n.length;s++)sR(n[s],n[++s],n[++s]);ds.__c&&ds.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){ds.__e(i,r.__v)}})}function $ne(e,t,n,s,r,i,a,o,l){var u,d,h,f,p,m,v,b=n.props,w=t.props,C=t.type;if(C==="svg"&&(r=!0),i!=null){for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!C&&(C?p.localName===C:p.nodeType===3)){e=p,i[u]=null;break}}if(e==null){if(C===null)return document.createTextNode(w);e=r?document.createElementNS("http://www.w3.org/2000/svg",C):document.createElement(C,w.is&&w),i=null,o=!1}if(C===null)b===w||o&&e.data===w||(e.data=w);else{if(i=i&&Bj.call(e.childNodes),b=n.props||fE,!o&&i!=null)for(b={},u=0;u<e.attributes.length;u++)b[(p=e.attributes[u]).name]=p.value;for(u in b)p=b[u],u=="children"||(u=="dangerouslySetInnerHTML"?h=p:u==="key"||u in w||tx(e,u,null,p,r));for(u in w)p=w[u],u=="children"?f=p:u=="dangerouslySetInnerHTML"?d=p:u=="value"?m=p:u=="checked"?v=p:u==="key"||o&&typeof p!="function"||b[u]===p||tx(e,u,p,b[u],r);if(d)o||h&&(d.__html===h.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),$j(e,tR(f)?f:[f],t,n,s,r&&C!=="foreignObject",i,a,i?i[0]:n.__k&&Jf(n,0),o,l),i!=null)for(u=i.length;u--;)i[u]!=null&&Vj(i[u]);o||(u="value",m!==void 0&&(m!==e[u]||C==="progress"&&!m||C==="option"&&m!==b[u])&&tx(e,u,m,b[u],!1),u="checked",v!==void 0&&v!==e[u]&&tx(e,u,v,b[u],!1))}return e}function sR(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(s){ds.__e(s,n)}}function gE(e,t,n){var s,r;if(ds.unmount&&ds.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||sR(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){ds.__e(i,t)}s.base=s.__P=null,e.__c=void 0}if(s=e.__k)for(r=0;r<s.length;r++)s[r]&&gE(s[r],t,n||typeof e.type!="function");n||e.__e==null||Vj(e.__e),e.__=e.__e=e.__d=void 0}function zne(e,t,n){return this.constructor(e,n)}Bj=Gj.slice,ds={__e:function(e,t,n,s){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,s||{}),a=r.__d),a)return r.__E=r}catch(o){e=o}throw e}},jj=0,sb.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=jc({},this.state),typeof e=="function"&&(e=e(jc({},n),this.props)),e&&jc(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pE(this))},sb.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pE(this))},sb.prototype.render=nR,Yu=[],Hj=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,dE=function(e,t){return e.__v.__b-t.__v.__b},Vb.__r=0,Uj=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(TP||(TP={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(hE||(hE={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(RP||(RP={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(AP||(AP={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(FP||(FP={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(DP||(DP={}));var Zf=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},ur=Or("[Surveys]"),MP={icontains:(e,t)=>e.some(n=>t.toLowerCase().includes(n.toLowerCase())),not_icontains:(e,t)=>e.every(n=>!t.toLowerCase().includes(n.toLowerCase())),regex:(e,t)=>e.some(n=>Zf(t,n)),not_regex:(e,t)=>e.every(n=>!Zf(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function OP(e){return e??"icontains"}hE.Right;(function(e,t){var n={__c:t="__cC"+Uj++,__:e,Consumer:function(s,r){return s.children(r)},Provider:function(s){var r,i;return this.getChildContext||(r=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&r.some(function(o){o.__e=!0,pE(o)})},this.sub=function(a){r.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){r.splice(r.indexOf(a),1),o&&o.call(a)}}),s.children}};n.Provider.__=n.Consumer.contextType=n})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});let Kj=class{constructor(){ft(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(s=>s!==n)}}emit(t,n){for(var s of this.events[t]||[])s(n);for(var r of this.events["*"]||[])r(t,n)}},qne=class Qh{constructor(t){ft(this,"_debugEventEmitter",new Kj),ft(this,"checkStep",(n,s)=>this.checkStepEvent(n,s)&&this.checkStepUrl(n,s)&&this.checkStepElement(n,s)),ft(this,"checkStepEvent",(n,s)=>s==null||!s.event||n?.event===s?.event),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Ct((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.on(s,r)})}}register(t){var n,s;if(!Ct((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(a=>{var o,l;(o=this.actionRegistry)===null||o===void 0||o.add(a),(l=a.steps)===null||l===void 0||l.forEach(u=>{var d;(d=this.actionEvents)===null||d===void 0||d.add(u?.event||"")})}),(s=this.instance)!==null&&s!==void 0&&s.autocapture)){var r,i=new Set;t.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(l=>{l!=null&&l.selector&&i.add(l?.selector)})}),(r=this.instance)===null||r===void 0||r.autocapture.setElementSelectors(i)}}on(t,n){var s;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n?.event))&&this.actionRegistry&&((s=this.actionRegistry)===null||s===void 0?void 0:s.size)>0&&this.actionRegistry.forEach(r=>{this.checkAction(n,r)&&this._debugEventEmitter.emit("actionCaptured",r.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if(n?.steps==null)return!1;for(var s of n.steps)if(this.checkStep(t,s))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$current_url;if(!r||typeof r!="string"||!Qh.matchString(r,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,s){switch(s){case"regex":return!!je&&Zf(t,n);case"exact":return n===t;case"contains":var r=Qh.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Zf(t,r);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(i=>!(n!=null&&n.href&&!Qh.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!Qh.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!Qh.matchString(i.$el_text||"",n?.text,n?.text_matching||"exact"))))return!1;if(n!=null&&n.selector){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$element_selectors;if(!r||!r.includes(n?.selector))return!1}return!0}getElementsList(t){return t?.properties.$elements==null?[]:t?.properties.$elements}},mE=class Yj{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Ct((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.actions)&&((i=s.conditions)===null||i===void 0||(a=i.actions)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new qne(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(s=>{this.onAction(s)})),n.forEach(s=>{var r,i,a,o,l,u,d,h,f,p;s.conditions&&(r=s.conditions)!==null&&r!==void 0&&r.actions&&(i=s.conditions)!==null&&i!==void 0&&(a=i.actions)!==null&&a!==void 0&&a.values&&((o=s.conditions)===null||o===void 0||(l=o.actions)===null||l===void 0||(u=l.values)===null||u===void 0?void 0:u.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(s.conditions.actions.values),(h=s.conditions)===null||h===void 0||(f=h.actions)===null||f===void 0||(p=f.values)===null||p===void 0||p.forEach(m=>{if(m&&m.name){var v=this.actionToSurveys.get(m.name);v&&v.push(s.id),this.actionToSurveys.set(m.name,v||[s.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.events)&&((i=s.conditions)===null||i===void 0||(a=i.events)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.onEvent(s,r)}),t.forEach(s=>{var r,i,a;(r=s.conditions)===null||r===void 0||(i=r.events)===null||i===void 0||(a=i.values)===null||a===void 0||a.forEach(o=>{if(o&&o.name){var l=this.eventToSurveys.get(o.name);l&&l.push(s.id),this.eventToSurveys.set(o.name,l||[s.id])}})}))}onEvent(t,n){var s,r,i=((s=this.instance)===null||s===void 0||(r=s.persistence)===null||r===void 0?void 0:r.props[qv])||[];if(Yj.SURVEY_SHOWN_EVENT_NAME==t&&n&&i.length>0){var a,o=n==null||(a=n.properties)===null||a===void 0?void 0:a.$survey_id;if(o){var l=i.indexOf(o);l>=0&&(i.splice(l,1),this._updateActivatedSurveys(i))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,s,r=((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0?void 0:s.props[qv])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,s;(n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[qv]:[...new Set(t)]})}getSurveys(){var t,n,s=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[qv];return s||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};ft(mE,"SURVEY_SHOWN_EVENT_NAME","survey shown");let Kne=class{constructor(t){ft(this,"_isFetchingSurveys",!1),ft(this,"_isInitializingSurveys",!1),ft(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(En(n))return ur.warn("Decide not loaded yet. Not loading surveys.");var s=cs(n);this._hasSurveys=s?n.length>0:n,ur.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],s=0;s<localStorage.length;s++){var r=localStorage.key(s);r!=null&&r.startsWith("seenSurvey_")&&n.push(r)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)ur.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)ur.info("Disabled. Not loading surveys.");else{var t=Vt?.__PosthogExtensions__;if(t)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=t.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new mE(this.instance),ur.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var s=t.loadExternalDependency;if(s)s(this.instance,"surveys",i=>{if(i||!t.generateSurveys)return ur.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new mE(this.instance),ur.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";ur.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(i){throw ur.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else ur.info("No surveys to load.");else ur.error("PostHog Extensions not found.")}}onSurveysLoaded(t){return this._surveyCallbacks.push(t),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==t)}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ur.info("Disabled. Not loading surveys."),t([]);var s=this.instance.get_property($S);if(s&&!n)return t(s,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:r=>{var i;this._isFetchingSurveys=!1;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: ".concat(a);return ur.error(o),t([],{isLoaded:!1,error:o})}var l,u=r.json.surveys||[],d=u.filter(h=>{var f,p,m,v,b,w,C,y,k,_,E,T;return((f=h.conditions)===null||f===void 0?void 0:f.events)&&((p=h.conditions)===null||p===void 0||(m=p.events)===null||m===void 0?void 0:m.values)&&((v=h.conditions)===null||v===void 0||(b=v.events)===null||b===void 0||(w=b.values)===null||w===void 0?void 0:w.length)>0||((C=h.conditions)===null||C===void 0?void 0:C.actions)&&((y=h.conditions)===null||y===void 0||(k=y.actions)===null||k===void 0?void 0:k.values)&&((_=h.conditions)===null||_===void 0||(E=_.actions)===null||E===void 0||(T=E.values)===null||T===void 0?void 0:T.length)>0});return d.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(d)),(i=this.instance.persistence)===null||i===void 0||i.register({[$S]:u}),t(u,{isLoaded:!0})}})}catch(r){throw this._isFetchingSurveys=!1,r}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(s){ur.error("Error in survey callback",s)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(s=>{var r,i=s.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var u;if(!l.conditions)return!0;var d=function(p){var m,v,b;if((m=p.conditions)===null||m===void 0||!m.url)return!0;var w=je==null||(v=je.location)===null||v===void 0?void 0:v.href;if(!w)return!1;var C=[p.conditions.url];return MP[OP((b=p.conditions)===null||b===void 0?void 0:b.urlMatchType)](C,w)}(l),h=(u=l.conditions)===null||u===void 0||!u.selector||St?.querySelector(l.conditions.selector),f=function(p){var m,v,b;if((m=p.conditions)===null||m===void 0||!m.deviceTypes||((v=p.conditions)===null||v===void 0?void 0:v.deviceTypes.length)===0)return!0;if(!Bs)return!1;var w=Qn.deviceType(Bs);return MP[OP((b=p.conditions)===null||b===void 0?void 0:b.deviceTypesMatchType)](p.conditions.deviceTypes,w)}(l);return d&&h&&f}),a=(r=this._surveyEventReceiver)===null||r===void 0?void 0:r.getSurveys(),o=i.filter(l=>{var u,d,h,f,p,m,v,b,w;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(u=l.feature_flag_keys)!==null&&u!==void 0&&u.length))return!0;var C=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),y=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),k=((d=(h=l.conditions)===null||h===void 0||(f=h.events)===null||f===void 0||(p=f.values)===null||p===void 0?void 0:p.length)!==null&&d!==void 0?d:0)>0,_=((m=(v=l.conditions)===null||v===void 0||(b=v.actions)===null||b===void 0||(w=b.values)===null||w===void 0?void 0:w.length)!==null&&m!==void 0?m:0)>0,E=!k&&!_||a?.includes(l.id),T=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),A=this.checkFlags(l);return C&&y&&T&&E&&A});return t(o)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(s=>{var{key:r,value:i}=s;return!r||!i||this.instance.featureFlags.isFeatureEnabled(i)})}_canActivateRepeatedly(t){var n;return En((n=Vt.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(ur.warn("init was not called"),!1):Vt.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(En(this._surveyManager))return ur.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];n=r?We({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){En(this._surveyManager)?ur.warn("init was not called"):this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];this._surveyManager.renderSurvey(r,St?.querySelector(n))})}};var LP=Or("[RateLimiter]");let Yne=class{constructor(t){var n,s;ft(this,"serverLimits",{}),ft(this,"lastEventRateLimited",!1),ft(this,"checkForLimiting",r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{LP.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void LP.warn('could not rate limit - continuing. Error: "'.concat(a?.message,'"'),{text:i})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((s=t.config.rate_limiting)===null||s===void 0?void 0:s.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,s,r=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=new Date().getTime(),a=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(qS))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:i};a.tokens+=(i-a.last)/1e3*this.captureEventsPerSecond,a.last=i,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||r||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)===null||s===void 0||s.set_property(qS,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var ju=Or("[RemoteConfig]");let Xne=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=Vt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,s,r;(n=Vt.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(s=Vt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"remote-config",()=>t(this.remoteConfig)):(ju.error("PostHog Extensions not found. Cannot load remote config."),t())}_loadRemoteConfigJSON(t){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return ju.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void ju.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return ju.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(t)})}catch(t){ju.error("Error loading remote config",t)}}onRemoteConfig(t){t?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(t),t.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):ju.info("__preview_remote_config is disabled. Logging config instead",t):ju.error("Failed to fetch remote config from PostHog.")}};var Qne=function(e){var t,n,s,r,i="";for(t=n=0,s=(e=(e+"").replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
5
  `)).length,r=0;r<s;r++){var a=e.charCodeAt(r),o=null;a<128?n++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),pu(o)||(n>t&&(i+=e.substring(t,n)),i+=o,t=n=r+1)}return n>t&&(i+=e.substring(t,e.length)),i},Jne=!!HS||!!jS,BP="text/plain",Wb=(e,t)=>{var[n,s]=e.split("?"),r=We({},t);s?.split("&").forEach(a=>{var[o]=a.split("=");delete r[o]});var i=_te(r);return i=i?(s?s+"&":"")+i:s,"".concat(n,"?").concat(i)},$g=(e,t)=>JSON.stringify(e,(n,s)=>typeof s=="bigint"?s.toString():s,t),p_=e=>{var{data:t,compression:n}=e;if(t){if(n===Qa.GZipJS){var s=bj(wj($g(t)),{mtime:0}),r=new Blob([s],{type:BP});return{contentType:BP,body:r,estimatedSize:r.size}}if(n===Qa.Base64){var i=function(l){var u,d,h,f,p,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,b=0,w="",C=[];if(!l)return l;l=Qne(l);do u=(p=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,d=p>>12&63,h=p>>6&63,f=63&p,C[b++]=m.charAt(u)+m.charAt(d)+m.charAt(h)+m.charAt(f);while(v<l.length);switch(w=C.join(""),l.length%3){case 1:w=w.slice(0,-2)+"==";break;case 2:w=w.slice(0,-1)+"="}return w}($g(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:$g(l)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=$g(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},om=[];jS&&om.push({transport:"fetch",method:e=>{var t,n,{contentType:s,body:r,estimatedSize:i}=(t=p_(e))!==null&&t!==void 0?t:{},a=new Headers;Mn(e.headers,function(d,h){a.append(h,d)}),s&&a.append("Content-Type",s);var o=e.url,l=null;if(ND){var u=new ND;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}jS(o,We({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&(i||0)<52428.8,body:r,signal:(n=l)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(d=>d.text().then(h=>{var f,p={statusCode:d.status,text:h};if(d.status===200)try{p.json=JSON.parse(h)}catch(m){At.error(m)}(f=e.callback)===null||f===void 0||f.call(e,p)})).catch(d=>{var h;At.error(d),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),HS&&om.push({transport:"XHR",method:e=>{var t,n=new HS;n.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=(t=p_(e))!==null&&t!==void 0?t:{};Mn(e.headers,function(i,a){n.setRequestHeader(a,i)}),s&&n.setRequestHeader("Content-Type",s),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var i,a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}(i=e.callback)===null||i===void 0||i.call(e,a)}},n.send(r)}}),Hi!=null&&Hi.sendBeacon&&om.push({transport:"sendBeacon",method:e=>{var t=Wb(e.url,{beacon:"1"});try{var n,{contentType:s,body:r}=(n=p_(e))!==null&&n!==void 0?n:{},i=typeof r=="string"?new Blob([r],{type:s}):r;Hi.sendBeacon(t,i)}catch{}}});var vE=3e3;let Zne=class{constructor(t,n){ft(this,"isPaused",!0),ft(this,"queue",[]),this.flushTimeoutMs=fa(n?.flush_interval_ms||vE,250,5e3,"flush interval",vE),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),s=[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)];s.map(r=>{this.sendRequest(We(We({},r),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),s=function(i){var a=n[i],o=new Date().getTime();a.data&&cs(a.data)&&Mn(a.data,l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp}),t.sendRequest(a)};for(var r in n)s(r)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return Mn(this.queue,n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;Ct(t[i])&&(t[i]=We(We({},r),{},{data:[]})),(s=t[i].data)===null||s===void 0||s.push(r.data)}),this.queue=[],t}};var ese=["retriesPerformedSoFar"];let tse=class{constructor(t){ft(this,"isPolling",!1),ft(this,"pollIntervalMs",3e3),ft(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Ct(je)&&"onLine"in je.navigator&&(this.areWeOnline=je.navigator.onLine,Ss(je,"online",()=>{this.areWeOnline=!0,this.flush()}),Ss(je,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=K6(t,ese);Qr(n)&&n>0&&(s.url=Wb(s.url,{retry_count:n})),this.instance._send_request(We(We({},s),{},{callback:r=>{var i;r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(n??0)<10?this.enqueue(We({retriesPerformedSoFar:n},s)):(i=s.callback)===null||i===void 0||i.call(s,r)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)}(n),r=Date.now()+s;this.queue.push({retryAt:r,requestOptions:t});var i="Enqueued failed request for retry in ".concat(s);navigator.onLine||(i+=" (Browser is offline)"),At.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],s=this.queue.filter(i=>i.retryAt<t||(n.push(i),!1));if(this.queue=n,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(We(We({},t),{},{transport:"sendBeacon"}))}catch(n){At.error(n)}this.queue=[]}},nse=class{constructor(t){ft(this,"_updateScrollData",()=>{var n,s,r,i;this.context||(this.context={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),d=a?.scrollHeight||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(l,(s=this.context.maxScrollHeight)!==null&&s!==void 0?s:0),this.context.lastContentY=u,this.context.maxContentY=Math.max(u,(r=this.context.maxContentY)!==null&&r!==void 0?r:0),this.context.maxContentHeight=Math.max(d,(i=this.context.maxContentHeight)!==null&&i!==void 0?i:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){Ss(je,"scroll",this._updateScrollData,{capture:!0}),Ss(je,"scrollend",this._updateScrollData,{capture:!0}),Ss(je,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return je?.document.documentElement;var t=cs(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var s=je?.document.querySelector(n);if(s)return s}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return je&&(je.scrollY||je.pageYOffset||je.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return je&&(je.scrollX||je.pageXOffset||je.document.documentElement.scrollLeft)||0}};var sse=e=>Qn.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let rse=class{constructor(t,n,s,r){ft(this,"_onSessionIdCallback",i=>{var a=this._getStored();if(!a||a.sessionId!==i){var o={sessionId:i,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[zS]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=s,this._sessionSourceParamGenerator=r||sse,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[zS]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?Qn.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Mn(t0(this.getSetOnceProps()),(n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_".concat(zT(s))]=n}),t}};var jP=Or("[SessionId]");let ise=class{constructor(t,n,s){var r;if(ft(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Bc,this._windowIdGenerator=s||Bc;var i=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*fa(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+i+"_window_id",this._primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var o=hr.parse(this._window_id_storage_key),l=hr.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:hr.remove(this._window_id_storage_key),hr.set(this._primary_window_exists_storage_key,!0)}if((r=this.config.bootstrap)!==null&&r!==void 0&&r.sessionID)try{var u=(d=>{var h=d.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(d){jP.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ct(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(t),this._sessionId&&t(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==t)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&hr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&hr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?hr.parse(this._window_id_storage_key):null}_setSessionId(t,n,s){t===this._sessionId&&n===this._sessionActivityTimestamp&&s===this._sessionStartTimestamp||(this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[Nb]:[n,t,s]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[Nb];return cs(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){Ss(je,"beforeunload",()=>{this._canUseSessionStorage()&&hr.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var s=n||new Date().getTime(),[r,i,a]=this._getSessionId(),o=this._getWindowId(),l=Qr(a)&&a>0&&Math.abs(s-a)>864e5,u=!1,d=!i,h=!t&&Math.abs(s-r)>this.sessionTimeoutMs;d||h||l?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),jP.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}}),a=s,u=!0):o||(o=this._windowIdGenerator(),u=!0);var f=r===0||!t||l?s:r,p=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,f,p),t||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach(m=>m(i,o,u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:o,sessionStartTimestamp:p,changeReason:u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var ase=["$set_once","$set"],Cc=Or("[SiteApps]");let ose=class{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var s=this.globalsForEvent(n);this.bufferedInvocations.push(s),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=Vt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,s,r,i,a,o,l;if(!t)throw new Error("Event payload is required");var u={},d=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(h))u[f]={id:d[f],type:f,properties:p};var{$set_once:m,$set:v}=t;return{event:We(We({},K6(t,ase)),{},{properties:We(We(We({},t.properties),v?{$set:We(We({},(n=(s=t.properties)===null||s===void 0?void 0:s.$set)!==null&&n!==void 0?n:{}),v)}:{}),m?{$set_once:We(We({},(r=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&r!==void 0?r:{}),m)}:{}),elements_chain:(a=(o=t.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=t.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var n=this.apps[t.id],s=()=>{var o;!n.errored&&this.bufferedInvocations.length&&(Cc.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(l=>{var u;return(u=n.processEvent)===null||u===void 0?void 0:u.call(n,l)}),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.stopBuffering)===null||o===void 0||o.call(this))},r=!1,i=o=>{n.errored=!o,n.loaded=!0,Cc.info("Site app with id ".concat(t.id," ").concat(o?"loaded":"errored")),r&&s()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:o=>{i(o)}});a&&(n.processEvent=a),r=!0}catch(o){Cc.error("Error while initializing PostHog app with config id ".concat(t.id),o),i(!1)}if(r&&n.loaded)try{s()}catch(o){Cc.error("Error while processing buffered events PostHog app with config id ".concat(t.id),o),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var s of t)this.setupSiteApp(s)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var s of Object.values(this.apps))try{var r;(r=s.processEvent)===null||r===void 0||r.call(s,n)}catch(i){Cc.error("Error while processing event ".concat(t.event," for site app ").concat(s.id),i)}}}onRemoteConfig(t){var n,s,r,i=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",u=>this.onCapturedEvent(u))):void Cc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.stopBuffering)===null||s===void 0||s.call(this),(r=t.siteApps)!==null&&r!==void 0&&r.length)if(this.isEnabled){var a=function(u,d){var h,f;Vt["__$$ph_site_app_".concat(u)]=i.instance,(h=Vt.__PosthogExtensions__)===null||h===void 0||(f=h.loadSiteApp)===null||f===void 0||f.call(h,i.instance,d,p=>{if(p)return Cc.error("Error while initializing PostHog app with config id ".concat(u),p)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else Cc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var rd,lse=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],HP=function(e,t){if(!e)return!1;var n=e.toLowerCase();return lse.concat(t||[]).some(s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1})},Xj=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&HP(n,t))return!0;try{var s=e?.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>HP(r?.brand,t)))return!0}catch{}return!!e.webdriver};function UP(e,t,n){return $g({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(rd||(rd={}));var GP="i.posthog.com";let cse=class{constructor(t){ft(this,"_regionCache",{}),this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(GP),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=rd.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=rd.EU:this._regionCache[this.apiHost]=rd.CUSTOM),this._regionCache[this.apiHost]}endpointFor(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),t==="ui")return this.uiHost+n;if(this.region===rd.CUSTOM)return this.apiHost+n;var s=GP+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(s);case"api":return"https://".concat(this.region,".").concat(s)}}};var use={icontains:(e,t)=>!!je&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!je&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!je&&Zf(t.href,e),not_regex:(e,t)=>!!je&&!Zf(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let dse=class Kr{constructor(t){var n=this;ft(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var s=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(r=>{Kr.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,r.forEach(i=>{if(i.feature_flag_key){var a;n._flagToExperiments&&(Kr.logInfo("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n._flagToExperiments)===null||a===void 0||a.set(i.feature_flag_key,i));var o=n.instance.getFeatureFlag(i.feature_flag_key);Hs(o)&&i.variants[o]&&n.applyTransforms(i.name,o,i.variants[o].transforms)}else if(i.variants)for(var l in i.variants){var u=i.variants[l];Kr.matchesTestVariant(u)&&n.applyTransforms(i.name,l,u.transforms)}})},s)}),this.instance=t,this.instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}onFeatureFlags(t){if(this._is_bot())Kr.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(En(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Kr.logInfo("applying feature flags",t),t.forEach(n=>{var s;if(this._flagToExperiments&&(s=this._flagToExperiments)!==null&&s!==void 0&&s.has(n)){var r,i=this.instance.getFeatureFlag(n),a=(r=this._flagToExperiments)===null||r===void 0?void 0:r.get(n);i&&a!=null&&a.variants[i]&&this.applyTransforms(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var t=Kr.getWindowLocation();if(t!=null&&t.search){var n=Bb(t?.search,"__experiment_id"),s=Bb(t?.search,"__experiment_variant");n&&s&&(Kr.logInfo("previewing web experiments ".concat(n," && ").concat(s)),this.getWebExperiments(r=>{this.showPreviewWebExperiment(parseInt(n),s,r)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.instance.config.disable_web_experiments&&!s)return t([]);var r=this.instance.get_property("$web_experiments");if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:i=>{if(i.statusCode!==200||!i.json)return t([]);var a=i.json.experiments||[];return t(a)}})}showPreviewWebExperiment(t,n,s){var r=s.filter(i=>i.id===t);r&&r.length>0&&(Kr.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(r[0].name,n,r[0].variants[n].transforms))}static matchesTestVariant(t){return!En(t.conditions)&&Kr.matchUrlConditions(t)&&Kr.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(En(t.conditions)||En((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var s,r,i,a=Kr.getWindowLocation();return!!a&&((s=t.conditions)===null||s===void 0||!s.url||use[(r=(i=t.conditions)===null||i===void 0?void 0:i.urlMatchType)!==null&&r!==void 0?r:"icontains"](t.conditions.url,a))}static getWindowLocation(){return je?.location}static matchUTMConditions(t){var n;if(En(t.conditions)||En((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var s=Qn.campaignParams();if(s.utm_source){var r,i,a,o,l,u,d,h,f,p,m,v,b,w,C,y,k=(r=t.conditions)===null||r===void 0||(i=r.utm)===null||i===void 0||!i.utm_campaign||((a=t.conditions)===null||a===void 0||(o=a.utm)===null||o===void 0?void 0:o.utm_campaign)==s.utm_campaign,_=(l=t.conditions)===null||l===void 0||(u=l.utm)===null||u===void 0||!u.utm_source||((d=t.conditions)===null||d===void 0||(h=d.utm)===null||h===void 0?void 0:h.utm_source)==s.utm_source,E=(f=t.conditions)===null||f===void 0||(p=f.utm)===null||p===void 0||!p.utm_medium||((m=t.conditions)===null||m===void 0||(v=m.utm)===null||v===void 0?void 0:v.utm_medium)==s.utm_medium,T=(b=t.conditions)===null||b===void 0||(w=b.utm)===null||w===void 0||!w.utm_term||((C=t.conditions)===null||C===void 0||(y=C.utm)===null||y===void 0?void 0:y.utm_term)==s.utm_term;return k&&E&&T&&_}return!1}static logInfo(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];At.info("[WebExperiments] ".concat(t),s)}applyTransforms(t,n,s){this._is_bot()?Kr.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?s.forEach(r=>{if(r.selector){var i;Kr.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),r);var a=(i=document)===null||i===void 0?void 0:i.querySelectorAll(r.selector);a?.forEach(o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):Kr.logInfo("Control variants leave the page unmodified.")}_is_bot(){return Hi&&this.instance?Xj(Hi,this.instance.config.custom_blocked_useragents):void 0}};var lm={},xE=()=>{},Jh="posthog",Qj=!Jne&&Bs?.indexOf("MSIE")===-1&&Bs?.indexOf("Mozilla")===-1,VP=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:fte(St?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:xE,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:di&&Hs(di?.search)&&di.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(je==null||(e=je.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;At.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:vE},_onCapture:xE}},WP=e=>{var t={};Ct(e.process_person)||(t.person_profiles=e.process_person),Ct(e.xhr_headers)||(t.request_headers=e.xhr_headers),Ct(e.cookie_name)||(t.persistence_name=e.cookie_name),Ct(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Ct(e.store_google)||(t.save_campaign_params=e.store_google),Ct(e.verbose)||(t.debug=e.verbose);var n=ys({},t,e);return cs(e.property_blacklist)&&(Ct(e.property_denylist)?n.property_denylist=e.property_blacklist:cs(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:At.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class hse{constructor(){ft(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){At.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class IC{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){ft(this,"webPerformance",new hse),ft(this,"_personProcessingSetOncePropertiesSent",!1),ft(this,"version",kl.LIB_VERSION),ft(this,"_internalEventEmitter",new Kj),this.config=VP(),this.SentryIntegration=xne,this.sentryIntegration=t=>function(n,s){var r=yj(n,s);return{name:Cj,processEvent:i=>r(i)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new jne(this),this.toolbar=new wne(this),this.scrollManager=new nse(this),this.pageViewManager=new kne(this),this.surveys=new Kne(this),this.experiments=new dse(this),this.exceptions=new Tne(this),this.rateLimiter=new Yne(this),this.requestRouter=new cse(this),this.consent=new Lte(this),this.people={set:(t,n,s)=>{var r=Hs(t)?{[t]:n}:t;this.setPersonProperties(r),s?.({})},set_once:(t,n,s)=>{var r=Hs(t)?{[t]:n}:t;this.setPersonProperties(void 0,r),s?.({})}},this.on("eventCaptured",t=>At.info('send "'.concat(t?.event,'"'),t))}init(t,n,s){if(s&&s!==Jh){var r,i=(r=lm[s])!==null&&r!==void 0?r:new IC;return i._init(t,n,s),lm[s]=i,lm[Jh][s]=i,i}return this._init(t,n,s)}_init(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(Ct(t)||US(t))return At.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return At.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],r.person_profiles&&(this._initialPersonProfilesConfig=r.person_profiles),this.set_config(ys({},VP(),WP(r),{name:i,token:t})),this.config.on_xhr_error&&At.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Qa.GZipJS,this.persistence=new h_(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new h_(We(We({},this.config),{},{persistence:"sessionStorage"}));var a=We({},this.persistence.props),o=We({},this.sessionPersistence.props);if(this._requestQueue=new Zne(w=>this._send_retriable_request(w),this.config.request_queue_config),this._retryQueue=new tse(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new ise(this),this.sessionPropsManager=new rse(this,this.sessionManager,this.persistence)),new yne(this).startIfEnabledOrStop(),this.siteApps=new ose(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new mne(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Tte(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Ene(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new _ne(this),this.exceptionObserver=new Hte(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new dj(this,jte),this.deadClicksAutocapture.startIfEnabled(),kl.DEBUG=kl.DEBUG||this.config.debug,kl.DEBUG&&At.info("Starting in debug mode",{this:this,config:r,thisC:We({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),((s=r.bootstrap)===null||s===void 0?void 0:s.distinctID)!==void 0){var l,u,d=this.config.get_device_id(Bc()),h=(l=r.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:r.bootstrap.distinctID;this.persistence.set_property(_l,(u=r.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var f,p,m=Object.keys(((f=r.bootstrap)===null||f===void 0?void 0:f.featureFlags)||{}).filter(w=>{var C,y;return!((C=r.bootstrap)===null||C===void 0||(y=C.featureFlags)===null||y===void 0||!y[w])}).reduce((w,C)=>{var y,k;return w[C]=((y=r.bootstrap)===null||y===void 0||(k=y.featureFlags)===null||k===void 0?void 0:k[C])||!1,w},{}),v=Object.keys(((p=r.bootstrap)===null||p===void 0?void 0:p.featureFlagPayloads)||{}).filter(w=>m[w]).reduce((w,C)=>{var y,k,_,E;return(y=r.bootstrap)!==null&&y!==void 0&&(k=y.featureFlagPayloads)!==null&&k!==void 0&&k[C]&&(w[C]=(_=r.bootstrap)===null||_===void 0||(E=_.featureFlagPayloads)===null||E===void 0?void 0:E[C]),w},{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:YD,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Bc());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(_l,"anonymous")}return Ss(je,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?vne(this,()=>this._loaded()):this._loaded(),no(this.config._onCapture)&&this.config._onCapture!==xE&&(At.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",w=>this.config._onCapture(w.event,w))),this}_onRemoteConfig(t){var n,s,r,i,a,o,l,u;if(!St||!St.body)return At.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Zt(t.supportedCompression,Qa.GZipJS)?Qa.GZipJS:Zt(t.supportedCompression,Qa.Base64)?Qa.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(s=this.siteApps)===null||s===void 0||s.onRemoteConfig(t),(r=this.sessionRecording)===null||r===void 0||r.onRemoteConfig(t),(i=this.autocapture)===null||i===void 0||i.onRemoteConfig(t),(a=this.heatmaps)===null||a===void 0||a.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(o=this.webVitalsAutocapture)===null||o===void 0||o.onRemoteConfig(t),(l=this.exceptionObserver)===null||l===void 0||l.onRemoteConfig(t),(u=this.deadClicksAutocapture)===null||u===void 0||u.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){At.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new Xne(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||Kc(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(t=this._requestQueue)===null||t===void 0||t.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Qj?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Wb(t.url,{ip:this.config.ip?1:0}),t.headers=We({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var s,r,i,a=We({},n);a.timeout=a.timeout||6e4,a.url=Wb(a.url,{_:new Date().getTime().toString(),ver:kl.LIB_VERSION,compression:a.compression});var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=(r=(i=Y6(om,u=>u.transport===o))===null||i===void 0?void 0:i.method)!==null&&r!==void 0?r:om[0].method;if(!l)throw new Error("No available transport method");l(a)})(We(We({},t),{},{callback:n=>{var s,r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)===null||r===void 0||r.call(i,n)),(s=t.callback)===null||s===void 0||s.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,s=[],r=[],i=[];Kc(t,o=>{o&&(n=o[0],cs(n)?i.push(o):no(o)?o.call(this):cs(o)&&n==="alias"?s.push(o):cs(o)&&n.indexOf("capture")!==-1&&no(this[n])?i.push(o):r.push(o))});var a=function(o,l){Kc(o,function(u){if(cs(u[0])){var d=l;Mn(u,function(h){d=d[h[0]].apply(d,h.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};a(s,this),a(r,this),a(i,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,s){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Ct(t)&&Hs(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var i=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){n!=null&&n.$current_url&&!Hs(n?.$current_url)&&(At.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=s?.timestamp||a,l=Bc(),u={uuid:l,event:t,properties:this._calculate_event_properties(t,n||{},o,l)};i&&(u.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),s?.$set&&(u.$set=s?.$set);var d=this._calculate_set_once_properties(s?.$set_once);d&&(u.$set_once=d),(u=dte(u,s!=null&&s._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,Ct(s?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a);var h=We(We({},u.properties.$set),u.$set);if(of(h)||this.setPersonPropertiesForFlags(h),!En(this.config.before_send)){var f=this._runBeforeSend(u);if(!f)return;u=f}this._internalEventEmitter.emit("eventCaptured",u);var p={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:s?._batchKey};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this._send_retriable_request(p):this._requestQueue.enqueue(p),u}At.critical("This capture call is ignored due to client rate limiting.")}}else At.error("No event name provided to posthog.capture")}else At.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,s,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(t),a=We({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=We(We({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!Hs(a.distinct_id)&&!Qr(a.distinct_id)||US(a.distinct_id))&&At.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=Qn.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&ys(a,this.sessionPropsManager.getSessionProps());try{var f,p;this.sessionRecording&&ys(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this._retryQueue)===null||f===void 0||(p=f.queue)===null||p===void 0?void 0:p.length}catch(w){a.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===rd.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=t==="$pageview"?this.pageViewManager.doPageView(s,r):t==="$pageleave"?this.pageViewManager.doPageLeave(s):this.pageViewManager.doEvent(),a=ys(a,l),t==="$pageview"&&St&&(a.title=St.title),!Ct(i)){var m=s.getTime()-i;a.$duration=parseFloat((m/1e3).toFixed(3))}Bs&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ys({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),cs(this.config.property_denylist)?Mn(this.config.property_denylist,function(w){delete a[w]}):At.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(At.error("sanitize_properties is deprecated. Use before_send instead"),a=v(a,t));var b=this._hasPersonProcessing();return a.$process_person_profile=b,b&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var s=this.persistence.get_initial_props(),r=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),i=ys({},s,r||{},t||{}),a=this.config.sanitize_properties;return a&&(At.error("sanitize_properties is deprecated. Use before_send instead"),i=a(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,of(i)?void 0:i}register(t,n){var s;(s=this.persistence)===null||s===void 0||s.register(t,n)}register_once(t,n,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,s)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,s;return(n=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,s){if(!this.__loaded||!this.persistence)return At.uninitializedWarning("posthog.identify");if(Qr(t)&&(t=t.toString(),At.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))At.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}t!==r&&t!==this.get_property(jg)&&(this.unregister(jg),this.register({distinct_id:t}));var a=(this.persistence.get_property(_l)||"anonymous")==="anonymous";t!==r&&a?(this.persistence.set_property(_l,"identified"),this.setPersonPropertiesForFlags(We(We({},s||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:n||{},$set_once:s||{}}),this._cachedPersonProperties=UP(t,n,s),this.featureFlags.setAnonymousDistinctId(r)):(n||s)&&this.setPersonProperties(n,s),t!==r&&(this.reloadFeatureFlags(),this.unregister(Mb))}}else At.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var s=UP(this.get_distinct_id(),t,n);this._cachedPersonProperties!==s?(this.setPersonPropertiesForFlags(We(We({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=s):At.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,s){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:We(We({},r),{},{[t]:n})}),s&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:s}),this.setGroupPropertiesForFlags({[t]:s})),r[t]===n||s||this.reloadFeatureFlags()}}else At.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,s,r,i;if(At.info("reset"),!this.__loaded)return At.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(s=this.sessionPersistence)===null||s===void 0||s.clear(),this.surveys.reset(),(r=this.persistence)===null||r===void 0||r.set_property(_l,"anonymous"),(i=this.sessionManager)===null||i===void 0||i.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:YD,$device_id:null},"");else{var o=this.config.get_device_id(Bc());this.register_once({distinct_id:o,$device_id:t?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&s){var i,a=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return r;var o=Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0);r+="?t=".concat(o)}return r}alias(t,n){return t===this.get_property(X6)?(At.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ct(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(jg,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(At.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,s,r,i,a=We({},this.config);us(t)&&(ys(this.config,WP(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new h_(We(We({},this.config),{},{persistence:"sessionStorage"})),Ws.is_supported()&&Ws.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(kl.DEBUG=!0,At.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:We({},this.config)},null,2))),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),(r=this.autocapture)===null||r===void 0||r.startIfEnabled(),(i=this.heatmaps)===null||i===void 0||i.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,s={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(s).some(Boolean)){var r,i,a,o,l;(r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),s.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),s.url_trigger&&((o=this.sessionRecording)===null||o===void 0||o.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var s=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(We(We({},Jte((r=>r instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:s})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Jh;return n!==Jh&&(n=Jh+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(_l))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(_l))==="identified"}_hasPersonProcessing(){var t,n,s,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&of(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[jg])&&((s=this.persistence)===null||s===void 0||(r=s.props)===null||r===void 0||!r[Ob]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(At.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(Ob,!0),!0)}_sync_opt_out_with_persistence(){var t,n,s,r,i=this.consent.isOptedOut(),a=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||i&&!!a;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==o&&((s=this.persistence)===null||s===void 0||s.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==o&&((r=this.sessionPersistence)===null||r===void 0||r.set_disabled(o))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(Ct(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t?.captureEventName)!==null&&n!==void 0?n:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Hi?Xj(Hi,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){St&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:St.title},{send_instantly:!0}))}debug(t){t===!1?(je?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(je?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(t){if(En(this.config.before_send))return t;var n=cs(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var r of n){if(s=r(s),En(s)){var i="Event '".concat(t.event,"' was rejected in beforeSend function");return lte(t.event)?At.warn("".concat(i,". This can cause unexpected behavior.")):At.info(i),null}s.properties&&!of(s.properties)||At.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return s}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=ute(e.prototype[t[n]])})(IC,["identify"]);var $P,Xu=($P=lm[Jh]=new IC,function(){function e(){e.done||(e.done=!0,Qj=!1,Mn(lm,function(t){t._dom_loaded()}))}St!=null&&St.addEventListener?St.readyState==="complete"?e():Ss(St,"DOMContentLoaded",e,{capture:!1}):je&&At.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$P),rR=g.createContext({client:Xu});function Jj(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(var i=0,a=s;i<a.length;i++){var o=a[i];if(!r.includes(o)||!Jj(e[o],t[o],n))return!1}return!0}function fse(e){var t=e.children,n=e.client,s=e.apiKey,r=e.options,i=g.useRef(null),a=g.useMemo(function(){return n?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),r&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),Xu)},[n,s,JSON.stringify(r)]);return g.useEffect(function(){if(!n){var o=i.current;o?(s!==o.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),r&&!Jj(r,o.options)&&Xu.set_config(r),i.current={apiKey:s,options:r??{}}):(Xu.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Xu.init(s,r),i.current={apiKey:s,options:r??{}})}},[n,s,JSON.stringify(r)]),ze.createElement(rR.Provider,{value:{client:a}},t)}var pse=function(){var e=g.useContext(rR).client;return e};function g_(e){var t=pse(),n=g.useState(function(){return t.isFeatureEnabled(e)}),s=n[0],r=n[1];return g.useEffect(function(){return t.onFeatureFlags(function(){r(t.isFeatureEnabled(e))})},[t,e]),s}var bE=function(e,t){return bE=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[r]=s[r])},bE(e,t)};function gse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");bE(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var m_=function(e){return typeof e=="function"},mse={componentStack:null,error:null},vse={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){gse(t,e);function t(n){var s=e.call(this,n)||this;return s.state=mse,s}return t.prototype.componentDidCatch=function(n,s){var r=s.componentStack,i=this.props.additionalProperties;this.setState({error:n,componentStack:r});var a;m_(i)?a=i(n):typeof i=="object"&&(a=i);var o=this.context.client;o.captureException(n,a)},t.prototype.render=function(){var n=this.props,s=n.children,r=n.fallback,i=this.state;if(i.componentStack==null)return m_(s)?s():s;var a=m_(r)?ze.createElement(r,{error:i.error,componentStack:i.componentStack}):r;return ze.isValidElement(a)?a:(console.warn(vse.INVALID_FALLBACK),ze.createElement(ze.Fragment,null))},t.contextType=rR,t})(ze.Component);/**
@@ -701,7 +701,7 @@ ${LW(r)}`)}const BW=tX;function r3(e){return e.artifact&&nX(e.path)?e.artifact:n
701
701
  * LICENSE file in the root directory of this source tree.
702
702
  */var y4;function oXe(){if(y4)return Mg;y4=1;var e=ze,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var d,h={},f=null,p=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:f,ref:p,props:h,_owner:r.current}}return Mg.Fragment=n,Mg.jsx=a,Mg.jsxs=a,Mg}var _4;function lXe(){return _4||(_4=1,C4.exports=oXe()),C4.exports}var cXe=lXe();/*! shepherd.js 14.5.0 */function uXe(e){return e instanceof Element}function mp(e){return e instanceof HTMLElement}function du(e){return typeof e=="function"}function W0(e){return typeof e=="string"}function Dr(e){return e===void 0}class PA{on(t,n,s,r=!1){var i;return Dr(this.bindings)&&(this.bindings={}),Dr(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:s,once:r}),this}once(t,n,s){return this.on(t,n,s,!0)}off(t,n){if(Dr(this.bindings)||Dr(this.bindings[t]))return this;if(Dr(n))delete this.bindings[t];else{var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{if(r.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!Dr(this.bindings)&&this.bindings[t]){var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{const{ctx:a,handler:o,once:l}=r,u=a||this;if(o.apply(u,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function xi(){return xi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},xi.apply(null,arguments)}function IA(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;n[s]=e[s]}return n}const Cu={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};Cu.defaultMerge;function dXe(e,t){return t}function hXe(e,t){return e.filter(n=>n!==void 0)}var S4;(function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"})(S4||(S4={}));function E4(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:gXe(e)?1:e instanceof Set?3:e instanceof Map?4:5}function fXe(e){const t=new Set;for(const n of e)for(const s of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(s);return t}function pXe(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function I$(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const k4=new Set(["[object Object]","[object Module]"]);function gXe(e){if(!k4.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!k4.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function mXe(e,t,n){const s={};for(const r of fXe(e)){const i=[];for(const l of e)pXe(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=N$(i,t,a);o!==Cu.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function vXe(e){return e.flat()}function xXe(e){return new Set(I$(e))}function bXe(e){return new Map(I$(e))}function wXe(e){return e.at(-1)}const zx={mergeRecords:mXe,mergeArrays:vXe,mergeSets:xXe,mergeMaps:bXe,mergeOthers:wXe};function NA(...e){return CXe({})(...e)}function CXe(e,t){const n=yXe(e,s);function s(...r){return N$(r,n,t)}return s}function yXe(e,t){var n,s,r;return{defaultMergeFunctions:zx,mergeFunctions:xi({},zx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(zx,i)).map(([i,a])=>a===!1?[i,zx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:dXe,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:hXe,actions:Cu}}function N$(e,t,n){var s;const r=(s=t.filterValues==null?void 0:t.filterValues(e,n))!=null?s:e;if(r.length===0)return;if(r.length===1)return dS(r,t,n);const i=E4(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(E4(r[a])!==i)return dS(r,t,n)}switch(i){case 1:return _Xe(r,t,n);case 2:return SXe(r,t,n);case 3:return EXe(r,t,n);case 4:return kXe(r,t,n);default:return dS(r,t,n)}}function _Xe(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===Cu.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function SXe(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===Cu.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function EXe(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===Cu.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function kXe(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===Cu.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function dS(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===Cu.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function MA(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const s=t[n],r=e[s];s!=="constructor"&&typeof r=="function"&&(e[s]=r.bind(e))}return e}function TXe(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!Dr(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function RXe(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=TXe(e,n);let r=null;if(!Dr(n)&&(r=document.querySelector(n),!r))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(t,s),e.on("destroy",()=>r.removeEventListener(t,s))):(document.body.addEventListener(t,s,!0),e.on("destroy",()=>document.body.removeEventListener(t,s,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class AXe{constructor(t){}}class FXe{constructor(t,n){}}function M$(e){return!W0(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function DXe(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(du(n.element)&&(n.element=n.element.call(e)),W0(n.element)){try{n.element=document.querySelector(n.element)}catch{}n.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return n}function PXe(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function O$(e){return e==null?!0:!e.element||!e.on}function L$(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)})}const IXe=["top","right","bottom","left"],T4=["start","end"],R4=IXe.reduce((e,t)=>e.concat(t,t+"-"+T4[0],t+"-"+T4[1]),[]),vp=Math.min,Ed=Math.max,sC=Math.round,qx=Math.floor,Yo=e=>({x:e,y:e}),NXe={left:"right",right:"left",bottom:"top",top:"bottom"},MXe={start:"end",end:"start"};function lT(e,t,n){return Ed(e,vp(t,n))}function Zd(e,t){return typeof e=="function"?e(t):e}function ec(e){return e.split("-")[0]}function $l(e){return e.split("-")[1]}function OA(e){return e==="x"?"y":"x"}function LA(e){return e==="y"?"height":"width"}function xp(e){return["top","bottom"].includes(ec(e))?"y":"x"}function BA(e){return OA(xp(e))}function B$(e,t,n){n===void 0&&(n=!1);const s=$l(e),r=BA(e),i=LA(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=iC(a)),[a,iC(a)]}function OXe(e){const t=iC(e);return[rC(e),t,rC(t)]}function rC(e){return e.replace(/start|end/g,t=>MXe[t])}function LXe(e,t,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:s:t?s:r;case"left":case"right":return t?i:a;default:return[]}}function BXe(e,t,n,s){const r=$l(e);let i=LXe(ec(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(rC)))),i}function iC(e){return e.replace(/left|right|bottom|top/g,t=>NXe[t])}function jXe(e){return xi({top:0,right:0,bottom:0,left:0},e)}function j$(e){return typeof e!="number"?jXe(e):{top:e,right:e,bottom:e,left:e}}function aC(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const HXe=["crossAxis","alignment","allowedPlacements","autoAlignment"],UXe=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],GXe=["mainAxis","crossAxis","limiter"];function A4(e,t,n){let{reference:s,floating:r}=e;const i=xp(t),a=BA(t),o=LA(a),l=ec(t),u=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,f=s[o]/2-r[o]/2;let p;switch(l){case"top":p={x:d,y:s.y-r.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-r.width,y:h};break;default:p={x:s.x,y:s.y}}switch($l(t)){case"start":p[a]-=f*(n&&u?-1:1);break;case"end":p[a]+=f*(n&&u?-1:1);break}return p}const VXe=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:h}=A4(u,s,l),f=s,p={},m=0;for(let v=0;v<o.length;v++){const{name:b,fn:w}=o[v],{x:C,y,data:k,reset:_}=await w({x:d,y:h,initialPlacement:s,placement:f,strategy:r,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});d=C??d,h=y??h,p=xi({},p,{[b]:xi({},p[b],k)}),_&&m<=50&&(m++,typeof _=="object"&&(_.placement&&(f=_.placement),_.rects&&(u=_.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):_.rects),{x:d,y:h}=A4(u,f,l)),v=-1)}return{x:d,y:h,placement:f,strategy:r,middlewareData:p}};async function jA(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=Zd(t,e),m=j$(p),v=o[f?h==="floating"?"reference":"floating":h],b=aC(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),w=h==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},k=aC(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:w,offsetParent:C,strategy:l}):w);return{top:(b.top-k.top+m.top)/y.y,bottom:(k.bottom-b.bottom+m.bottom)/y.y,left:(b.left-k.left+m.left)/y.x,right:(k.right-b.right+m.right)/y.x}}const WXe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=Zd(e,t)||{};if(u==null)return{};const h=j$(d),f={x:n,y:s},p=BA(r),m=LA(p),v=await a.getDimensions(u),b=p==="y",w=b?"top":"left",C=b?"bottom":"right",y=b?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[p]-f[p]-i.floating[m],_=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let T=E?E[y]:0;(!T||!await(a.isElement==null?void 0:a.isElement(E)))&&(T=o.floating[y]||i.floating[m]);const A=k/2-_/2,F=T/2-v[m]/2-1,I=vp(h[w],F),M=vp(h[C],F),D=I,O=T-v[m]-M,z=T/2-v[m]/2+A,B=lT(D,z,O),q=!l.arrow&&$l(r)!=null&&z!==B&&i.reference[m]/2-(z<D?I:M)-v[m]/2<0,K=q?z<D?z-D:z-O:0;return{[p]:f[p]+K,data:xi({[p]:B,centerOffset:z-B-K},q&&{alignmentOffset:K}),reset:q}}});function $Xe(e,t,n){return(e?[...n.filter(s=>$l(s)===e),...n.filter(s=>$l(s)!==e)]:n.filter(s=>ec(s)===s)).filter(s=>e?$l(s)===e||(t?rC(s)!==s:!1):!0)}const zXe=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,r;const{rects:i,middlewareData:a,placement:o,platform:l,elements:u}=t,d=Zd(e,t),{crossAxis:h=!1,alignment:f,allowedPlacements:p=R4,autoAlignment:m=!0}=d,v=IA(d,HXe),b=f!==void 0||p===R4?$Xe(f||null,m,p):p,w=await jA(t,v),C=((n=a.autoPlacement)==null?void 0:n.index)||0,y=b[C];if(y==null)return{};const k=B$(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:b[0]}};const _=[w[ec(y)],w[k[0]],w[k[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:_}],T=b[C+1];if(T)return{data:{index:C+1,overflows:E},reset:{placement:T}};const A=E.map(I=>{const M=$l(I.placement);return[I.placement,M&&h?I.overflows.slice(0,2).reduce((D,O)=>D+O,0):I.overflows[0],I.overflows]}).sort((I,M)=>I[1]-M[1]),F=((r=A.filter(I=>I[2].slice(0,$l(I[0])?2:3).every(M=>M<=0))[0])==null?void 0:r[0])||A[0][0];return F!==o?{data:{index:C+1,overflows:E},reset:{placement:F}}:{}}}},qXe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,d=Zd(e,t),{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0}=d,w=IA(d,UXe);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=ec(r),y=xp(o),k=ec(o)===o,_=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=p||(k||!b?[iC(o)]:OXe(o)),T=v!=="none";!p&&T&&E.push(...BXe(o,b,v,_));const A=[o,...E],F=await jA(t,w),I=[];let M=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&I.push(F[C]),f){const B=B$(r,a,_);I.push(F[B[0]],F[B[1]])}if(M=[...M,{placement:r,overflows:I}],!I.every(B=>B<=0)){var D,O;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,q=A[B];if(q)return{data:{index:B,overflows:M},reset:{placement:q}};let K=(O=M.filter(Q=>Q.overflows[0]<=0).sort((Q,G)=>Q.overflows[1]-G.overflows[1])[0])==null?void 0:O.placement;if(!K)switch(m){case"bestFit":{var z;const Q=(z=M.filter(G=>{if(T){const X=xp(G.placement);return X===y||X==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(X=>X>0).reduce((X,oe)=>X+oe,0)]).sort((G,X)=>G[1]-X[1])[0])==null?void 0:z[0];Q&&(K=Q);break}case"initialPlacement":K=o;break}if(r!==K)return{reset:{placement:K}}}return{}}}},KXe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=Zd(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:w=>{let{x:C,y}=w;return{x:C,y}}}}=i,u=IA(i,GXe),d={x:n,y:s},h=await jA(t,u),f=xp(ec(r)),p=OA(f);let m=d[p],v=d[f];if(a){const w=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=m+h[w],k=m-h[C];m=lT(y,m,k)}if(o){const w=f==="y"?"top":"left",C=f==="y"?"bottom":"right",y=v+h[w],k=v-h[C];v=lT(y,v,k)}const b=l.fn(xi({},t,{[p]:m,[f]:v}));return xi({},b,{data:{x:b.x-n,y:b.y-s}})}}},YXe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=Zd(e,t),d={x:n,y:s},h=xp(r),f=OA(h);let p=d[f],m=d[h];const v=Zd(o,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:xi({mainAxis:0,crossAxis:0},v);if(l){const y=f==="y"?"height":"width",k=i.reference[f]-i.floating[y]+b.mainAxis,_=i.reference[f]+i.reference[y]-b.mainAxis;p<k?p=k:p>_&&(p=_)}if(u){var w,C;const y=f==="y"?"width":"height",k=["top","left"].includes(ec(r)),_=i.reference[h]-i.floating[y]+(k&&((w=a.offset)==null?void 0:w[h])||0)+(k?0:b.crossAxis),E=i.reference[h]+i.reference[y]+(k?0:((C=a.offset)==null?void 0:C[h])||0)-(k?b.crossAxis:0);m<_?m=_:m>E&&(m=E)}return{[f]:p,[h]:m}}}};function by(){return typeof window<"u"}function Vp(e){return H$(e)?(e.nodeName||"").toLowerCase():"#document"}function Vi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function al(e){var t;return(t=(H$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function H$(e){return by()?e instanceof Node||e instanceof Vi(e).Node:!1}function lo(e){return by()?e instanceof Element||e instanceof Vi(e).Element:!1}function el(e){return by()?e instanceof HTMLElement||e instanceof Vi(e).HTMLElement:!1}function F4(e){return!by()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Vi(e).ShadowRoot}function kv(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=co(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function XXe(e){return["table","td","th"].includes(Vp(e))}function wy(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function HA(e){const t=UA(),n=lo(e)?co(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function QXe(e){let t=hu(e);for(;el(t)&&!bp(t);){if(HA(t))return t;if(wy(t))return null;t=hu(t)}return null}function UA(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bp(e){return["html","body","#document"].includes(Vp(e))}function co(e){return Vi(e).getComputedStyle(e)}function Cy(e){return lo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hu(e){if(Vp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||F4(e)&&e.host||al(e);return F4(t)?t.host:t}function U$(e){const t=hu(e);return bp(t)?e.ownerDocument?e.ownerDocument.body:e.body:el(t)&&kv(t)?t:U$(t)}function $0(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=U$(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Vi(r);if(i){const o=cT(a);return t.concat(a,a.visualViewport||[],kv(r)?r:[],o&&n?$0(o):[])}return t.concat(r,$0(r,[],n))}function cT(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function G$(e){const t=co(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=el(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=sC(n)!==i||sC(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function GA(e){return lo(e)?e:e.contextElement}function Gf(e){const t=GA(e);if(!el(t))return Yo(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=G$(t);let a=(i?sC(n.width):n.width)/s,o=(i?sC(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const JXe=Yo(0);function V$(e){const t=Vi(e);return!UA()||!t.visualViewport?JXe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ZXe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Vi(e)?!1:t}function eh(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=GA(e);let a=Yo(1);t&&(s?lo(s)&&(a=Gf(s)):a=Gf(e));const o=ZXe(i,n,s)?V$(i):Yo(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,h=r.height/a.y;if(i){const f=Vi(i),p=s&&lo(s)?Vi(s):s;let m=f,v=cT(m);for(;v&&s&&p!==m;){const b=Gf(v),w=v.getBoundingClientRect(),C=co(v),y=w.left+(v.clientLeft+parseFloat(C.paddingLeft))*b.x,k=w.top+(v.clientTop+parseFloat(C.paddingTop))*b.y;l*=b.x,u*=b.y,d*=b.x,h*=b.y,l+=y,u+=k,m=Vi(v),v=cT(m)}}return aC({width:d,height:h,x:l,y:u})}function VA(e,t){const n=Cy(e).scrollLeft;return t?t.left+n:eh(al(e)).left+n}function W$(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:VA(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function eQe(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=al(s),o=t?wy(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Yo(1);const d=Yo(0),h=el(s);if((h||!h&&!i)&&((Vp(s)!=="body"||kv(a))&&(l=Cy(s)),el(s))){const p=eh(s);u=Gf(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const f=a&&!h&&!i?W$(a,l,!0):Yo(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-l.scrollTop*u.y+d.y+f.y}}function tQe(e){return Array.from(e.getClientRects())}function nQe(e){const t=al(e),n=Cy(e),s=e.ownerDocument.body,r=Ed(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Ed(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+VA(e);const o=-n.scrollTop;return co(s).direction==="rtl"&&(a+=Ed(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function sQe(e,t){const n=Vi(e),s=al(e),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,o=0,l=0;if(r){i=r.width,a=r.height;const u=UA();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function rQe(e,t){const n=eh(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=el(e)?Gf(e):Yo(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function D4(e,t,n){let s;if(t==="viewport")s=sQe(e,n);else if(t==="document")s=nQe(al(e));else if(lo(t))s=rQe(t,n);else{const r=V$(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return aC(s)}function $$(e,t){const n=hu(e);return n===t||!lo(n)||bp(n)?!1:co(n).position==="fixed"||$$(n,t)}function iQe(e,t){const n=t.get(e);if(n)return n;let s=$0(e,[],!1).filter(o=>lo(o)&&Vp(o)!=="body"),r=null;const i=co(e).position==="fixed";let a=i?hu(e):e;for(;lo(a)&&!bp(a);){const o=co(a),l=HA(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||kv(a)&&!l&&$$(e,a))?s=s.filter(u=>u!==a):r=o,a=hu(a)}return t.set(e,s),s}function aQe(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?wy(t)?[]:iQe(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=D4(t,u,r);return l.top=Ed(d.top,l.top),l.right=vp(d.right,l.right),l.bottom=vp(d.bottom,l.bottom),l.left=Ed(d.left,l.left),l},D4(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function oQe(e){const{width:t,height:n}=G$(e);return{width:t,height:n}}function lQe(e,t,n){const s=el(t),r=al(t),i=n==="fixed",a=eh(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Yo(0);if(s||!s&&!i)if((Vp(t)!=="body"||kv(r))&&(o=Cy(t)),s){const f=eh(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else r&&(l.x=VA(r));const u=r&&!s&&!i?W$(r,o):Yo(0),d=a.left+o.scrollLeft-l.x-u.x,h=a.top+o.scrollTop-l.y-u.y;return{x:d,y:h,width:a.width,height:a.height}}function hS(e){return co(e).position==="static"}function P4(e,t){if(!el(e)||co(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return al(e)===n&&(n=n.ownerDocument.body),n}function z$(e,t){const n=Vi(e);if(wy(e))return n;if(!el(e)){let r=hu(e);for(;r&&!bp(r);){if(lo(r)&&!hS(r))return r;r=hu(r)}return n}let s=P4(e,t);for(;s&&XXe(s)&&hS(s);)s=P4(s,t);return s&&bp(s)&&hS(s)&&!HA(s)?n:s||QXe(e)||n}const cQe=async function(e){const t=this.getOffsetParent||z$,n=this.getDimensions,s=await n(e.floating);return{reference:lQe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function uQe(e){return co(e).direction==="rtl"}const dQe={convertOffsetParentRelativeRectToViewportRelativeRect:eQe,getDocumentElement:al,getClippingRect:aQe,getOffsetParent:z$,getElementRects:cQe,getClientRects:tQe,getDimensions:oQe,getScale:Gf,isElement:lo,isRTL:uQe};function hQe(e,t){let n=null,s;const r=al(e);function i(){var o;clearTimeout(s),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:h,height:f}=e.getBoundingClientRect();if(o||t(),!h||!f)return;const p=qx(d),m=qx(r.clientWidth-(u+h)),v=qx(r.clientHeight-(d+f)),b=qx(u),w={rootMargin:-p+"px "+-m+"px "+-v+"px "+-b+"px",threshold:Ed(0,vp(1,l))||1};let C=!0;function y(k){const _=k[0].intersectionRatio;if(_!==l){if(!C)return a();_?a(!1,_):s=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{n=new IntersectionObserver(y,xi({},w,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,w)}n.observe(e)}return a(!0),i}function fQe(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=GA(e),d=r||i?[...u?$0(u):[],...$0(t)]:[];d.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const h=u&&o?hQe(u,n):null;let f=-1,p=null;a&&(p=new ResizeObserver(w=>{let[C]=w;C&&C.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var y;(y=p)==null||y.observe(t)})),n()}),u&&!l&&p.observe(u),p.observe(t));let m,v=l?eh(e):null;l&&b();function b(){const w=eh(e);v&&(w.x!==v.x||w.y!==v.y||w.width!==v.width||w.height!==v.height)&&n(),v=w,m=requestAnimationFrame(b)}return n(),()=>{var w;d.forEach(C=>{r&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),h?.(),(w=p)==null||w.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const pQe=zXe,gQe=KXe,mQe=qXe,vQe=WXe,xQe=YXe,bQe=(e,t,n)=>{const s=new Map,r=xi({platform:dQe},n),i=xi({},r.platform,{_c:s});return VXe(e,t,xi({},r,{platform:i}))};function wQe(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=kQe(t,e),r=O$(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=fQe(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}_Qe(n,e,s,r)}),e.target=t.element,s}function CQe(e,t){return{floatingUIOptions:NA(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function yQe(e){e.cleanup&&e.cleanup(),e.cleanup=null}function _Qe(e,t,n,s){return bQe(e,t.el,n).then(SQe(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function SQe(e,t){return({x:n,y:s,placement:r,middlewareData:i})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${s}px`}),e.el.dataset.popperPlacement=r,EQe(e.el,i)),e)}function EQe(e,t){const n=e.querySelector(".shepherd-arrow");if(mp(n)&&t.arrow){const{x:s,y:r}=t.arrow;Object.assign(n.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:""})}}function kQe(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=TQe(t),o=O$(e),l=(n=e.on)==null?void 0:n.includes("auto"),u=(e==null||(s=e.on)==null?void 0:s.includes("-start"))||(e==null||(r=e.on)==null?void 0:r.includes("-end"));if(!o){if(l){var d;i.middleware.push(pQe({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(mQe());if(i.middleware.push(gQe({limiter:xQe(),crossAxis:!0})),a){const h=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(vQe({element:a,padding:u?h.padding:0}))}l||(i.placement=e.on)}return NA(i,t.options.floatingUIOptions||{})}function TQe(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Ki(){}function RQe(e,t){for(const n in t)e[n]=t[n];return e}function q$(e){return e()}function I4(){return Object.create(null)}function Tv(e){e.forEach(q$)}function WA(e){return typeof e=="function"}function lc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function AQe(e){return Object.keys(e).length===0}function wp(e,t){e.appendChild(t)}function vo(e,t,n){e.insertBefore(t,n||null)}function Pa(e){e.parentNode&&e.parentNode.removeChild(e)}function FQe(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function tl(e){return document.createElement(e)}function N4(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function K$(e){return document.createTextNode(e)}function oC(){return K$(" ")}function DQe(){return K$("")}function yy(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function On(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const PQe=["width","height"];function M4(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const s in t)t[s]==null?e.removeAttribute(s):s==="style"?e.style.cssText=t[s]:s==="__value"?e.value=e[s]=t[s]:n[s]&&n[s].set&&PQe.indexOf(s)===-1?e[s]=t[s]:On(e,s,t[s])}function IQe(e){return Array.from(e.childNodes)}function Vh(e,t,n){e.classList.toggle(t,!!n)}let z0;function Um(e){z0=e}function Y$(){if(!z0)throw new Error("Function called outside component initialization");return z0}function NQe(e){Y$().$$.on_mount.push(e)}function $A(e){Y$().$$.after_update.push(e)}const sf=[],Cp=[];let Vf=[];const O4=[],MQe=Promise.resolve();let uT=!1;function OQe(){uT||(uT=!0,MQe.then(X$))}function dT(e){Vf.push(e)}const fS=new Set;let Wh=0;function X$(){if(Wh!==0)return;const e=z0;do{try{for(;Wh<sf.length;){const t=sf[Wh];Wh++,Um(t),LQe(t.$$)}}catch(t){throw sf.length=0,Wh=0,t}for(Um(null),sf.length=0,Wh=0;Cp.length;)Cp.pop()();for(let t=0;t<Vf.length;t+=1){const n=Vf[t];fS.has(n)||(fS.add(n),n())}Vf.length=0}while(sf.length);for(;O4.length;)O4.pop()();uT=!1,fS.clear(),Um(e)}function LQe(e){if(e.fragment!==null){e.update(),Tv(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(dT)}}function BQe(e){const t=[],n=[];Vf.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Vf=t}const Sb=new Set;let ld;function kd(){ld={r:0,c:[],p:ld}}function Td(){ld.r||Tv(ld.c),ld=ld.p}function Sn(e,t){e&&e.i&&(Sb.delete(e),e.i(t))}function _s(e,t,n,s){if(e&&e.o){if(Sb.has(e))return;Sb.add(e),ld.c.push(()=>{Sb.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function L4(e){return e?.length!==void 0?e:Array.from(e)}function jQe(e,t){const n={},s={},r={$$scope:1};let i=e.length;for(;i--;){const a=e[i],o=t[i];if(o){for(const l in a)l in o||(s[l]=1);for(const l in o)r[l]||(n[l]=o[l],r[l]=1);e[i]=o}else for(const l in a)r[l]=1}for(const a in s)a in n||(n[a]=void 0);return n}function mh(e){e&&e.c()}function yu(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),dT(()=>{const i=e.$$.on_mount.map(q$).filter(WA);e.$$.on_destroy?e.$$.on_destroy.push(...i):Tv(i),e.$$.on_mount=[]}),r.forEach(dT)}function _u(e,t){const n=e.$$;n.fragment!==null&&(BQe(n.after_update),Tv(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function HQe(e,t){e.$$.dirty[0]===-1&&(sf.push(e),OQe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function cc(e,t,n,s,r,i,a=null,o=[-1]){const l=z0;Um(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Ki,not_equal:r,bound:I4(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:I4(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(u.root);let d=!1;if(u.ctx=n?n(e,t.props||{},(h,f,...p)=>{const m=p.length?p[0]:f;return u.ctx&&r(u.ctx[h],u.ctx[h]=m)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](m),d&&HQe(e,h)),f}):[],u.update(),d=!0,Tv(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const h=IQe(t.target);u.fragment&&u.fragment.l(h),h.forEach(Pa)}else u.fragment&&u.fragment.c();t.intro&&Sn(e.$$.fragment),yu(e,t.target,t.anchor),X$()}Um(l)}class uc{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){_u(this,1),this.$destroy=Ki}$on(t,n){if(!WA(n))return Ki;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!AQe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const UQe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(UQe);function GQe(e){let t,n,s,r,i;return{c(){t=tl("button"),On(t,"aria-label",n=e[3]?e[3]:null),On(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],On(t,"tabindex","0"),On(t,"type","button")},m(a,o){vo(a,t,o),t.innerHTML=e[5],r||(i=yy(t,"click",function(){WA(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&On(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&On(t,"class",s),o&4&&(t.disabled=e[2])},i:Ki,o:Ki,d(a){a&&Pa(t),r=!1,i()}}}function VQe(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function h(f){return du(f)?f=f.call(r):f}return e.$$set=f=>{"config"in f&&n(6,s=f.config),"step"in f&&n(7,r=f.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=s.action?s.action.bind(r.tour):null),n(1,a=s.classes),n(2,o=s.disabled?h(s.disabled):!1),n(3,l=s.label?h(s.label):null),n(4,u=s.secondary),n(5,d=s.text?h(s.text):null))},[i,a,o,l,u,d,s,r]}class WQe extends uc{constructor(t){super(),cc(this,t,VQe,GQe,lc,{config:6,step:7})}}function B4(e,t,n){const s=e.slice();return s[2]=t[n],s}function j4(e){let t,n,s=L4(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=H4(B4(e,s,a));const i=a=>_s(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=DQe()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);vo(a,t,o),n=!0},p(a,o){if(o&3){s=L4(a[1]);let l;for(l=0;l<s.length;l+=1){const u=B4(a,s,l);r[l]?(r[l].p(u,o),Sn(r[l],1)):(r[l]=H4(u),r[l].c(),Sn(r[l],1),r[l].m(t.parentNode,t))}for(kd(),l=s.length;l<r.length;l+=1)i(l);Td()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)Sn(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)_s(r[o]);n=!1},d(a){a&&Pa(t),FQe(r,a)}}}function H4(e){let t,n;return t=new WQe({props:{config:e[2],step:e[0]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.config=s[2]),r&1&&(i.step=s[0]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function $Qe(e){let t,n,s=e[1]&&j4(e);return{c(){t=tl("footer"),s&&s.c(),On(t,"class","shepherd-footer")},m(r,i){vo(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&Sn(s,1)):(s=j4(r),s.c(),Sn(s,1),s.m(t,null)):s&&(kd(),_s(s,1,1,()=>{s=null}),Td())},i(r){n||(Sn(s),n=!0)},o(r){_s(s),n=!1},d(r){r&&Pa(t),s&&s.d()}}}function zQe(e,t,n){let s,{step:r}=t;return e.$$set=i=>{"step"in i&&n(0,r=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,s=r.options.buttons)},[r,s]}class qQe extends uc{constructor(t){super(),cc(this,t,zQe,$Qe,lc,{step:0})}}function KQe(e){let t,n,s,r,i;return{c(){t=tl("button"),n=tl("span"),n.textContent="×",On(n,"aria-hidden","true"),On(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),On(t,"class","shepherd-cancel-icon"),On(t,"type","button")},m(a,o){vo(a,t,o),wp(t,n),r||(i=yy(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&On(t,"aria-label",s)},i:Ki,o:Ki,d(a){a&&Pa(t),r=!1,i()}}}function YQe(e,t,n){let{cancelIcon:s,step:r}=t;const i=a=>{a.preventDefault(),r.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,s=a.cancelIcon),"step"in a&&n(2,r=a.step)},[s,i,r]}class XQe extends uc{constructor(t){super(),cc(this,t,YQe,KQe,lc,{cancelIcon:0,step:2})}}function QQe(e){let t;return{c(){t=tl("h3"),On(t,"id",e[1]),On(t,"class","shepherd-title")},m(n,s){vo(n,t,s),e[3](t)},p(n,[s]){s&2&&On(t,"id",n[1])},i:Ki,o:Ki,d(n){n&&Pa(t),e[3](null)}}}function JQe(e,t,n){let{labelId:s,element:r,title:i}=t;$A(()=>{du(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){Cp[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"labelId"in o&&n(1,s=o.labelId),"element"in o&&n(0,r=o.element),"title"in o&&n(2,i=o.title)},[r,s,i,a]}class ZQe extends uc{constructor(t){super(),cc(this,t,JQe,QQe,lc,{labelId:1,element:0,title:2})}}function U4(e){let t,n;return t=new ZQe({props:{labelId:e[0],title:e[2]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.labelId=s[0]),r&4&&(i.title=s[2]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function G4(e){let t,n;return t=new XQe({props:{cancelIcon:e[3],step:e[1]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&8&&(i.cancelIcon=s[3]),r&2&&(i.step=s[1]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function eJe(e){let t,n,s,r=e[2]&&U4(e),i=e[3]&&e[3].enabled&&G4(e);return{c(){t=tl("header"),r&&r.c(),n=oC(),i&&i.c(),On(t,"class","shepherd-header")},m(a,o){vo(a,t,o),r&&r.m(t,null),wp(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&Sn(r,1)):(r=U4(a),r.c(),Sn(r,1),r.m(t,n)):r&&(kd(),_s(r,1,1,()=>{r=null}),Td()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&Sn(i,1)):(i=G4(a),i.c(),Sn(i,1),i.m(t,null)):i&&(kd(),_s(i,1,1,()=>{i=null}),Td())},i(a){s||(Sn(r),Sn(i),s=!0)},o(a){_s(r),_s(i),s=!1},d(a){a&&Pa(t),r&&r.d(),i&&i.d()}}}function tJe(e,t,n){let{labelId:s,step:r}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,s=o.labelId),"step"in o&&n(1,r=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=r.options.title),n(3,a=r.options.cancelIcon))},[s,r,i,a]}class nJe extends uc{constructor(t){super(),cc(this,t,tJe,eJe,lc,{labelId:0,step:1})}}function sJe(e){let t;return{c(){t=tl("div"),On(t,"class","shepherd-text"),On(t,"id",e[1])},m(n,s){vo(n,t,s),e[3](t)},p(n,[s]){s&2&&On(t,"id",n[1])},i:Ki,o:Ki,d(n){n&&Pa(t),e[3](null)}}}function rJe(e,t,n){let{descriptionId:s,element:r,step:i}=t;$A(()=>{let{text:o}=i.options;du(o)&&(o=o.call(i)),mp(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){Cp[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"descriptionId"in o&&n(1,s=o.descriptionId),"element"in o&&n(0,r=o.element),"step"in o&&n(2,i=o.step)},[r,s,i,a]}class iJe extends uc{constructor(t){super(),cc(this,t,rJe,sJe,lc,{descriptionId:1,element:0,step:2})}}function V4(e){let t,n;return t=new nJe({props:{labelId:e[1],step:e[2]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.labelId=s[1]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function W4(e){let t,n;return t=new iJe({props:{descriptionId:e[0],step:e[2]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.descriptionId=s[0]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function $4(e){let t,n;return t=new qQe({props:{step:e[2]}}),{c(){mh(t.$$.fragment)},m(s,r){yu(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(Sn(t.$$.fragment,s),n=!0)},o(s){_s(t.$$.fragment,s),n=!1},d(s){_u(t,s)}}}function aJe(e){let t,n=!Dr(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!Dr(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&V4(e),u=r&&W4(e),d=a&&$4(e);return{c(){t=tl("div"),l&&l.c(),s=oC(),u&&u.c(),i=oC(),d&&d.c(),On(t,"class","shepherd-content")},m(h,f){vo(h,t,f),l&&l.m(t,null),wp(t,s),u&&u.m(t,null),wp(t,i),d&&d.m(t,null),o=!0},p(h,[f]){f&4&&(n=!Dr(h[2].options.title)||h[2].options.cancelIcon&&h[2].options.cancelIcon.enabled),n?l?(l.p(h,f),f&4&&Sn(l,1)):(l=V4(h),l.c(),Sn(l,1),l.m(t,s)):l&&(kd(),_s(l,1,1,()=>{l=null}),Td()),f&4&&(r=!Dr(h[2].options.text)),r?u?(u.p(h,f),f&4&&Sn(u,1)):(u=W4(h),u.c(),Sn(u,1),u.m(t,i)):u&&(kd(),_s(u,1,1,()=>{u=null}),Td()),f&4&&(a=Array.isArray(h[2].options.buttons)&&h[2].options.buttons.length),a?d?(d.p(h,f),f&4&&Sn(d,1)):(d=$4(h),d.c(),Sn(d,1),d.m(t,null)):d&&(kd(),_s(d,1,1,()=>{d=null}),Td())},i(h){o||(Sn(l),Sn(u),Sn(d),o=!0)},o(h){_s(l),_s(u),_s(d),o=!1},d(h){h&&Pa(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function oJe(e,t,n){let{descriptionId:s,labelId:r,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,s=a.descriptionId),"labelId"in a&&n(1,r=a.labelId),"step"in a&&n(2,i=a.step)},[s,r,i]}class lJe extends uc{constructor(t){super(),cc(this,t,oJe,aJe,lc,{descriptionId:0,labelId:1,step:2})}}function z4(e){let t;return{c(){t=tl("div"),On(t,"class","shepherd-arrow"),On(t,"data-popper-arrow","")},m(n,s){vo(n,t,s)},d(n){n&&Pa(t)}}}function cJe(e){let t,n,s,r,i,a,o,l,u=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&z4();s=new lJe({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=Dr(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],h={};for(let f=0;f<d.length;f+=1)h=RQe(h,d[f]);return{c(){t=tl("dialog"),u&&u.c(),n=oC(),mh(s.$$.fragment),M4(t,h),Vh(t,"shepherd-has-cancel-icon",e[5]),Vh(t,"shepherd-has-title",e[6]),Vh(t,"shepherd-element",!0)},m(f,p){vo(f,t,p),u&&u.m(t,null),wp(t,n),yu(s,t,null),e[13](t),a=!0,o||(l=yy(t,"keydown",e[7]),o=!0)},p(f,[p]){f[4].options.arrow&&f[4].options.attachTo&&f[4].options.attachTo.element&&f[4].options.attachTo.on?u||(u=z4(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const m={};p&4&&(m.descriptionId=f[2]),p&8&&(m.labelId=f[3]),p&16&&(m.step=f[4]),s.$set(m),M4(t,h=jQe(d,[(!a||p&20&&r!==(r=Dr(f[4].options.text)?null:f[2]))&&{"aria-describedby":r},(!a||p&24&&i!==(i=f[4].options.title?f[3]:null))&&{"aria-labelledby":i},p&2&&f[1],{open:"true"}])),Vh(t,"shepherd-has-cancel-icon",f[5]),Vh(t,"shepherd-has-title",f[6]),Vh(t,"shepherd-element",!0)},i(f){a||(Sn(s.$$.fragment,f),a=!0)},o(f){_s(s.$$.fragment,f),a=!1},d(f){f&&Pa(t),u&&u.d(),_u(s),e[13](null),o=!1,l()}}}const uJe=9,dJe=27,hJe=37,fJe=39;function q4(e){return e.split(" ").filter(t=>!!t.length)}function pJe(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:h}=t,f,p,m;const v=()=>r;NQe(()=>{n(1,h={[`data-${s}shepherd-step-id`]:d.id}),n(9,o=r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,u=o[o.length-1])}),$A(()=>{m!==d.options.classes&&b()});function b(){w(m),m=d.options.classes,C(m)}function w(_){if(W0(_)){const E=q4(_);E.length&&r.classList.remove(...E)}}function C(_){if(W0(_)){const E=q4(_);E.length&&r.classList.add(...E)}}const y=_=>{const{tour:E}=d;switch(_.keyCode){case uJe:if(o.length===0){_.preventDefault();break}_.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(_.preventDefault(),u.focus()):document.activeElement===u&&(_.preventDefault(),a.focus());break;case dJe:E.options.exitOnEsc&&(_.preventDefault(),_.stopPropagation(),d.cancel());break;case hJe:E.options.keyboardNavigation&&(_.preventDefault(),_.stopPropagation(),E.back());break;case fJe:E.options.keyboardNavigation&&(_.preventDefault(),_.stopPropagation(),E.next());break}};function k(_){Cp[_?"unshift":"push"](()=>{r=_,n(0,r)})}return e.$$set=_=>{"classPrefix"in _&&n(11,s=_.classPrefix),"element"in _&&n(0,r=_.element),"descriptionId"in _&&n(2,i=_.descriptionId),"firstFocusableElement"in _&&n(8,a=_.firstFocusableElement),"focusableElements"in _&&n(9,o=_.focusableElements),"labelId"in _&&n(3,l=_.labelId),"lastFocusableElement"in _&&n(10,u=_.lastFocusableElement),"step"in _&&n(4,d=_.step),"dataStepId"in _&&n(1,h=_.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,f=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,p=d.options&&d.options.title))},[r,h,i,l,d,f,p,y,a,o,u,s,v,k]}class gJe extends uc{constructor(t){super(),cc(this,t,pJe,cJe,lc,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}class hT extends PA{constructor(t,n={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this.classPrefix=void 0,this.el=void 0,this.target=void 0,this.tour=void 0,this.tour=t,this.classPrefix=this.tour.options?M$(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,MA(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){yQe(this),mp(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=PXe(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=DXe(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return du(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){const t=`${this.id}-description`,n=`${this.id}-label`;return this.shepherdElementComponent=new gJe({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:t,labelId:n,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(t){const{element:n}=this._getResolvedAttachToOptions();du(this.options.scrollToHandler)?this.options.scrollToHandler(n):uXe(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,s=t.classes?t.classes:"",r=n&&n.classes?n.classes:"",i=[...s.split(" "),...r.split(" ")],a=new Set(i);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=NA({},n||{}),this.options=Object.assign({arrow:!0},n,t,CQe(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${L$()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){Dr(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&RXe(this),wQe(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),s=this.target||document.body,r=this._resolvedExtraHighlightElements;s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),r?.forEach(i=>{i.classList.add(`${this.classPrefix}shepherd-enabled`),i.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,s=t._resolvedExtraHighlightElements;if(!n)return;const r=t.options.highlightClass;r&&(n.classList.add(r),s?.forEach(i=>i.classList.add(r))),n.classList.remove("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,s=this.options.highlightClass;s&&(t.classList.remove(s),n?.forEach(r=>r.classList.remove(s))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(r=>{r.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function mJe(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(mp(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{mp(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function vJe(e){let t="";const{innerWidth:n,innerHeight:s}=window;return e.forEach(r=>{const{width:i,height:a,x:o=0,y:l=0,r:u=0}=r,{topLeft:d=0,topRight:h=0,bottomRight:f=0,bottomLeft:p=0}=typeof u=="number"?{topLeft:u,topRight:u,bottomRight:u,bottomLeft:u}:u;t+=`M${o+d},${l} a${d},${d},0,0,0-${d},${d} V${a+l-p} a${p},${p},0,0,0,${p},${p} H${i+o-f} a${f},${f},0,0,0,${f}-${f} V${l+h} a${h},${h},0,0,0-${h}-${h} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function xJe(e){let t,n,s,r,i;return{c(){t=N4("svg"),n=N4("path"),On(n,"d",e[2]),On(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){vo(a,t,o),wp(t,n),e[11](t),r||(i=yy(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&On(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&On(t,"class",s)},i:Ki,o:Ki,d(a){a&&Pa(t),e[11](null),r=!1,i()}}}function Q$(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:Q$(e.parentElement)}function bJe(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var s;const a=(s=n)==null?void 0:s.frameElement;if(a){var r,i;const o=a.getBoundingClientRect();t.top+=o.top+((r=o.scrollTop)!=null?r:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function wJe(e,t){const n=e.getBoundingClientRect();let s=n.y||n.top,r=n.bottom||s+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;s=Math.max(s,o),r=Math.min(r,l)}const i=Math.max(r-s,0);return{y:s,height:i}}function CJe(e,t,n){let{element:s,openingProperties:r}=t,i=!1,a,o;u();const l=()=>s;function u(){n(4,r=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),w()}function h(k=0,_=0,E=0,T=0,A,F,I){if(F){const M=[F,...I||[]];n(4,r=[]);for(const D of M){if(!D||M.indexOf(D)!==M.lastIndexOf(D))continue;const{y:O,height:z}=wJe(D,A),{x:B,width:q,left:K}=D.getBoundingClientRect();M.some(Q=>{if(Q===D)return!1;const G=Q.getBoundingClientRect();return B>=G.left&&B+q<=G.right&&O>=G.top&&O+z<=G.bottom})||r.push({width:q+k*2,height:z+k*2,x:(B||K)+E-k,y:O+T-k,r:_})}}else u()}function f(k){w(),k.tour.options.useModalOverlay?(C(k),p()):d()}function p(){n(1,i=!0)}const m=k=>{k.preventDefault()},v=k=>{k.stopPropagation()};function b(){window.addEventListener("touchmove",m,{passive:!1})}function w(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",m,{passive:!1})}function C(k){const{modalOverlayOpeningPadding:_,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:T=0,modalOverlayOpeningYOffset:A=0}=k.options,F=bJe(k.target),I=Q$(k.target),M=()=>{a=void 0,h(_,E,T+F.left,A+F.top,I,k.target,k._resolvedExtraHighlightElements),a=requestAnimationFrame(M)};M(),b()}function y(k){Cp[k?"unshift":"push"](()=>{s=k,n(0,s)})}return e.$$set=k=>{"element"in k&&n(0,s=k.element),"openingProperties"in k&&n(4,r=k.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=vJe(r))},[s,i,o,v,r,l,u,d,h,f,p,y]}class yJe extends uc{constructor(t){super(),cc(this,t,CJe,xJe,lc,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}class _Je extends PA{constructor(){super(),this.activeTour=void 0,MA(this)}}class SJe extends PA{constructor(t={}){super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,MA(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=M$(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(s=>{(r=>{this.on(r,i=>{i=i||{},i.tour=this,cd.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof hT?s.tour=this:s=new hT(this,s),Dr(n)?this.steps.push(s):this.steps.splice(n,0,s),s}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;du(this.options.confirmCancel)?n=await this.options.confirmCancel():n=window.confirm(t),n&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(t){return this.steps.find(n=>n.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return cd.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((s,r)=>{if(s.id===t)return s.isOpen()&&s.hide(),s.destroy(),this.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const s=W0(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),du(s.options.showOn)&&!s.options.showOn()?this._skipStep(s,n):(this.currentStep=s,this.trigger("show",{step:s,previous:this.currentStep}),s.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(s=>s.destroy()),mJe(this),this.trigger(t,{index:n}),cd.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const s=document.querySelector(".shepherd-modal-overlay-container");s&&(s.remove(),this.modal=null)}mp(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),cd.activeTour=this}setupModal(){this.modal=new yJe({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const s=this.steps.indexOf(t);if(s===this.steps.length-1)this.complete();else{const r=n?s+1:s-1;this.show(r,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",s=t||L$();this.id=`${n}--${s}`}}const cd=new _Je,J$=typeof window>"u";cd.Step=J$?AXe:hT;cd.Tour=J$?FXe:SJe;const _y=g.createContext(void 0);_y.Consumer;const EJe=({children:e})=>cXe.jsx(_y.Provider,{value:{Shepherd:cd},children:e}),kJe=""+new URL("agentic-sequence-CExfswgi.png",import.meta.url).href,TJe=""+new URL("canvas-code-inline-edit-DLji9b0m.png",import.meta.url).href,RJe=""+new URL("canvas-overview-CruGEIRC.png",import.meta.url).href,AJe=""+new URL("canvas-variables-view-DrA20zqs.png",import.meta.url).href,FJe=""+new URL("chat-attachments-_3cRrONU.png",import.meta.url).href,DJe=""+new URL("chat-full-view-e-eJPzrw.png",import.meta.url).href,PJe=""+new URL("chat-input-CU-CA7Se.png",import.meta.url).href,IJe=""+new URL("inline-edit-canvas-O9conTkE.png",import.meta.url).href,NJe=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},K4=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},Y4=[{id:"welcome",title:"Welcome to Local Operator",text:`Local Operator is an AI agents platform that allows you to create a team of proactive AI agents that support you and help to reduce your daily workload.<br/><img src="${DJe}" alt="Chat full view" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />These agents are different from simple chatbots because they can actually do things for you on your computer like create files, run code and analytics, edit images, videos, and PDFs, organize your system, and much more.<br/><br/>In this walkthrough we'll cover:<ul><li>Creating agents</li><li>Making agents do things</li><li>The canvas workspace</li><li>Customizing agents</li><li>Agent hub for sharing and collaborating</li><li>Schedules for proactive agents</li><li>Settings for customization</li></ul>Let's explore how it works.`,buttons:[{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:"right"},title:"Your agents",text:"On the left, you'll see a list of your available AI agents. You can select an agent to start a conversation or manage its settings. Think of this as your messenger contacts list, but for AI agents. There are no limits to how many agents you can have, so create as many as you need to handle all your daily tasks.<br/><br/>Use the create agents button at the top of the toolbar to create a new agent at any time. You can also import agents from the Agent hub, which we will cover later in this tour.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:"right"},title:"Select an agent",text:"Click on an agent to open the chat window to pull up your conversation with it. This will show the messages that you have sent them and the responses and actions that they have taken.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:"Ask your agent anything",text:`Type your request here. Agents can answer questions, perform tasks, search the web, and much more. When you create a new agent, you'll see suggested prompts for ideas.<br /><br />Some powerful requests that you can try:<br /><br /><ul><li>"Create a spreadsheet in my Documents folder with all the major cities in Canada."</li><li>"Search the web for the latest news on AI and make a thorough report."</li><li>Select an attachment and then "translate this document to French."</li></ul><br /><img src="${PJe}" alt="Chat input" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />You can also attach files to your message by clicking the paperclip button, which we will cover in the next step.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:"Attach files to your message",text:`You can attach any files, images, or documents to your message by clicking this paperclip button, there are no limitations on the file types. Your agent can process, analyze, or translate these attachments as part of your request.<br /><br />Try attaching a PDF, image, or text file and then ask your agent to summarize, translate, or extract information from it.<br /><img src="${FJe}" alt="Chat attachments" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />Images like PNGs, JPGs, and PDFs are natively streamed into the model context window, so they can understand them directly without needing to run any code. Other files like Excel, Word, and CSV files are included as file paths on your device to direct the model's attention to work with them using code. You can attach massive files like million line CSVs and have the agent work with them using code.<br /><br />You can also paste images into the chat input, and attach multiple files at once to achieve more complex tasks. Try taking a screenshot of a website and then asking your agent to try to code it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:"More than just chat",text:`Local Operator agents are different from simple chatbots. They can perform actions on your computer, like creating files, running code, or browsing the web, based on your instructions. You'll see them use "tools" like reading, writing, and executing code to get things done. Agents have memory of the conversation, previous steps, learnings, and even store the execution variables of previous steps in code to be able to use them later in the conversation.<br /><img src="${kJe}" alt="Agentic sequence" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />Local Operator agents are extremely flexible, so they can bounce back and forth with you for simple chatting, and know when they need to embark on a work journey to get things done in multiple steps with tool use.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{openCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"pre-command-palette-open-canvas",title:"Command palette",attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:"right"},text:`Let's quickly look at another powerful feature: the Command Palette. You can open it anywhere in the app by pressing <code>${Bo("everything",!0)}</code> on Mac and <code>${Bo("everything",!1)}</code> on Windows or Linux. This is a helpful window that you can open from anywhere in the app to be able to access your chats, agents, settings, pages and actions, and much more, using your keyboard. It can often be faster to access sections in the app this way instead of clicking through menus. Type a word to search everything at once, or start with a prefix to narrow it: <code>#</code> for chats, <code>@</code> for agents and teams, <code>,</code> for settings, and <code>&gt;</code> for commands and pages.<br /><br />In a hurry for a conversation? Press <code>${Bo("chats",!0)}</code> on Mac and <code>${Bo("chats",!1)}</code> on Windows or Linux and the palette opens already searching your chats, so you can jump straight to one — and <code>${Bo("commands",!0)}</code> on Mac and <code>${Bo("commands",!1)}</code> on Windows or Linux opens it on the app's own commands and pages when that is what you are after. You can also just click Search in the sidebar to open it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{closeCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{closeCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:"left"},title:"Open the canvas",text:"Click here to open the Canvas, a workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{openCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:"left"},title:"The canvas: your visual workspace",text:`This is the Canvas, your workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way. Any files that your agents create on your device can be opened here by clicking on the file icons that you see as they work.<br/><br/>Agents can make dynamic visualizations like games, charts, maps, and more in HTML files. Any HTML files you open will be rendered dynamically in an iframe. Any markdown files that you open will be rendered in full markdown viewer with support for code blocks, tables, mermaid diagrams, and more.<br/><img src="${RJe}" alt="Canvas overview" style="width: 100%; height: 300px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:"Documents view",text:`The Documents view shows all your open notes, blog articles, code, and visualizations as tabs. You can switch between documents to edit them and see dynamic visualizations in HTML created by your agents. Use this view to work with your notes, reports, and agent-generated content.<br /><br />This is where you can get more precise around your agents' work.<br/><img src="${IJe}" alt="Inline edit canvas" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />In your documents, highlight any text that you want your agent to improve and press Cmd/Ctrl+K to bring up the inline AI editor.
703
703
  <br /><img src="${TJe}" alt="Canvas code inline edit" style="width: 100%; height: 200px; object-fit: cover; object-position: top; border-radius: 8px;"/><br />You can be as precise as you want and the agent will edit the document for you in place, using its memories and context so you don't have to re-explain things.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:"Files view",text:"The Files view lets you browse and open files that your agents have created or that are relevant to your current conversation. Use this to quickly access, preview, and open files in the Canvas workspace.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:"Variables view",text:`The Variables view displays the "code memory" that agents have stored during their work. These are technical variables that include results, intermediate values, and other data that agents use to perform tasks. You can inspect and manage these variables here.<br /><br />This section will be most helpful for more technical users who want to understand how agents are working and what they are doing.<br/><img src="${AJe}" alt="Canvas variables" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:"right"},title:"Agent options",text:"Click here to see options for the currently selected agent, like viewing its settings, exporting it, or deleting it.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:"right"},title:"View configuration",text:'Click "View agent settings" to see and change how this agent works and change things like its name, description, hosting provider, and AI model.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:"left"},title:"Agent configuration",text:"This is where you can customize and configure your agent. You can change its name, description, the AI model it uses, its temperature for creativity, and other chat settings.<br /><br />The agents will already have default settings that work well for most use cases, but if you want to roll up your sleeves and customize, you can do so here.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:"left"},title:"Select hosting provider",text:`Choose an AI provider for your agent. If you don't pick one here, then the default provider from the settings page will be used. Providers offer different AI models and pricing. Radient is recommended for Local Operator as its "Automatic" mode is optimized for the lowest cost and best performance.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:"left"},title:"Select AI model",text:"After selecting a provider, choose an AI model. Models marked as 'Recommended' are known to work well with Local Operator. Other models might have inconsistent performance. If a model you expect to be recommended isn't listed, please let us know if it works well for you in Local Operator via GitHub Issues or email.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:"left"},title:"Customize security behaviors",text:"This prompt provides separate instructions to the security agent that reviews this agent's work. You can explicitly allow certain actions that would normally be blocked. If you encounter frequent security interventions, consider adding a note here for the security agent.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:"left"},title:"Customize the agent's behavior",text:"This prompt allows you to customize the baseline behavior of the agent. While most customization can happen by talking to the agent (it records learnings in its notebook), you can provide specific workflow instructions here that will be followed separately.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:"Create a new agent",text:'Click the "+" button to create a brand new agent from scratch. You can then customize its behavior and capabilities.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:"right"},title:"Naming and describing your agent",text:`Give your agent a clear, descriptive name that reflects its purpose (e.g., "File Organizer" or "Web Researcher").
704
- A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>NJe("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){K4("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog publishes your agent's instruction set to the community. You need a Radient account to publish, which is free to create and costs nothing per agent. You can review the details before confirming. What is published is what describes the agent - its name, description, instructions and tool surface; no conversation, execution history, memory, plan or machine-specific configuration leaves your computer. Make sure your agent meets the required criteria before submitting.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{K4("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:"right"},title:"General settings",text:"Here you can update your user profile and configure model settings (like default hosting provider and model).",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],MJe=()=>{const e=si(),{completeTourOnboarding:t}=Wm(),n=g.useContext(_y),s={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},r=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=Wm.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const u=n?.Shepherd;if(!l&&u&&(l=u.activeTour,!l&&u.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new u.Tour({useModalOverlay:r,defaultStepOptions:s}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...s},l.options.useModalOverlay=r,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const d=[...l.steps];for(const h of d)h.id&&l.removeStep(h.id);l.addSteps(Y4)}else l.steps.length===0&&l.addSteps(Y4);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},OJe=()=>{const{isModalComplete:e,isTourComplete:t}=Wm(),{startTour:n}=MJe(),s=ze.useContext(_y),{data:r}=_E(1,1);return g.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},LJe=({children:e})=>c.jsxs(EJe,{children:[e,c.jsx(OJe,{})]}),BJe=()=>{_t();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=g6(),r=g.useRef(null);g.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=si();return c.jsx(_a,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Sa,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx($i,{className:"text-title",children:x("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(oo,{className:"text-body-sm text-ink-muted",children:x("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(D$,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})},jJe=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l})=>c.jsxs("div",{ref:i,id:l,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),Att=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),Ftt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});async function Z$(e){await vt({op:"settings.edit",key:Ho,value:e.value}),QJ(e.queryClient)}async function HJe(e){await Z$(e),e.queryClient.setQueryData(Db.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Ho?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const Dtt=({focus:e=!1})=>{_t();const t=sn(),n=Ln(),s=yt(n.data,"settings"),r=ps({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),enabled:s,retry:!1,refetchOnReconnect:!0}),i=r.data?.settings.find(A=>A.key===Ho),[a,o]=g.useState(!1),[l,u]=g.useState(null),[d,h]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),v=g.useRef(null),b=g.useRef(!1);g.useEffect(()=>{if(!e){b.current=!1;return}!i||b.current||(v.current?.querySelector("[role=combobox]")?.focus(),b.current=!0)},[e,i]),g.useEffect(()=>{r.isSuccess&&!r.isFetching&&h(!1)},[r.isFetching,r.isSuccess]);const w=async A=>{if(!(!i||m.current||d||!i.choices.some(F=>F.value===A))){m.current=!0,o(!0),u(null),p(!1);try{const F=await HJe({value:A,queryClient:t});h(F==="readback-unknown"),p(F==="confirmed")}catch(F){u({value:A,message:F instanceof Error?F.message:""})}finally{m.current=!1,o(!1)}}},C=async()=>{const[A,F]=await Promise.all([r.refetch(),n.refetch()]);!A.isError&&!F.isError&&h(!1)},y=!r.data&&r.error||!n.data&&n.error,k=n.data&&(!s||r.data&&!i),_=!y&&!k&&!i,E=n.data?.features?.i18n?n.data.language:void 0,T=typeof E=="string"&&E!==""?E:void 0;return c.jsx(jJe,{title:x("ui.settings.language.dialog.title"),icon:s5,description:x("ui.settings.language.general.description"),children:c.jsxs("div",{ref:v,"data-setting-key":Ho,className:"flex flex-col gap-3","aria-busy":a,children:[_&&c.jsx("output",{className:"text-meta text-ink-dim",children:x("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:x("ui.settings.language.dialog.unavailable")}),i&&c.jsx(y6,{setting:{...UT(i),label:x("ui.settings.language.dialog.title")},value:String(i.value),onValueChange:A=>{w(A)},disabled:a||d,suppressEffectiveNote:!0}),c.jsx("output",{id:YJ(Ho),"aria-live":"polite",className:"text-meta text-ink-dim",children:a?x("ui.settings.language.general.pending"):f?x("ui.settings.language.general.saved"):T?x(d||n.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:XJ(T)?.name??T}):x("ui.settings.language.general.no_resolution")}),(y||l||d)&&c.jsx(Jr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:l?x("ui.settings.language.general.write_error",{message:l.message}):d?x("ui.settings.language.general.readback_error"):x("ui.settings.language.dialog.unavailable")}),c.jsx(ie,{variant:"outline",size:"sm",disabled:a||r.isFetching||n.isFetching,onClick:()=>{l?w(l.value):C()},children:x("ui.settings.language.dialog.retry")})]})})]})})},UJe=()=>{_t();const e=aT(q=>q.open),t=aT(q=>q.closeLanguage),n=sn(),s=Ln(),r=yt(s.data,"settings"),i=ps({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=g.useRef(null),o=i6(),l=(i.data?.settings??[]).find(q=>q.key===Ho),u=l?UT(l):void 0,[d,h]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[b,w]=g.useState(null),C=g.useRef(null);g.useEffect(()=>{e&&h(null)},[e]),g.useEffect(()=>{if(!e||!u)return;const q=String(u.value??"");(d===null||d===C.current)&&h(q),C.current=q},[e,u,d]),g.useEffect(()=>{e&&(v(!1),w(null))},[e]);const y=d??String(u?.value??""),k=!!u&&y!==String(u?.value??""),_=!u||!k||f,E=async()=>{if(!(!u||!k)){p(!0),w(null);try{await Z$({value:y,queryClient:n}),v(!0),h(null),await i.refetch()}catch(q){w(q instanceof Error?q.message:x("ui.settings.configuration.language_dialog.the_language_could_not_be_saved"))}finally{p(!1)}}},T=!!s.data,A=T&&!r,F=s.error&&!s.data?s.error:null,I=F??i.error,M=!T&&!I,{sentence:D,remedy:O}=JJ(o??null,x("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),I),z=s.isFetching||i.isFetching,B=u?"combo":I?"retry":"none";return g.useEffect(()=>{!e||B==="none"||requestAnimationFrame(()=>{a.current?.querySelector(B==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,B]),c.jsx(_a,{open:e,onOpenChange:q=>!q&&t(),children:c.jsxs(Sa,{ref:a,onOpenAutoFocus:q=>q.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx($i,{className:"text-title",children:x("ui.settings.language.dialog.title")}),c.jsx(oo,{className:"text-body-sm text-ink-muted",children:x("ui.settings.language.dialog.description")})]}),M?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(gn,{}),x("ui.settings.language.dialog.loading")]}):A?c.jsx(Jr,{variant:"warning",children:c.jsx("span",{children:x("ui.settings.language.dialog.unavailable")})}):I?c.jsx(Jr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:D}),O&&c.jsx(ie,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:z,children:z?x("ui.settings.language.dialog.retrying"):x("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(gn,{}),x("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:nD(Ho),className:"text-meta text-ink-dim",children:u.help}),c.jsx(y6,{setting:u,value:y,disabled:f,helpId:nD(Ho),effectiveNoteId:ZJ(Ho,eZ),onValueChange:q=>{v(!1),h(q)}})]}),b&&c.jsx("p",{className:"text-meta text-danger",children:b}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:m&&!k?c.jsxs("output",{"data-language-save":"",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Us,{"aria-hidden":"true",className:"size-3.5"}),x("ui.settings.language.dialog.saved")]}):c.jsx(ie,{onClick:E,disabled:_,"data-language-save":"",children:f?`${x("ui.settings.language.dialog.save")}...`:x("ui.settings.language.dialog.save")})})]}):c.jsx(Jr,{variant:"warning",children:c.jsx("span",{children:x("ui.settings.language.dialog.unavailable")})})]})})};function GJe(){const{data:e}=Ln();g.useEffect(()=>{e&&jz(e)},[e]);const t=OT(),n=sn(),s=g.useRef(null);g.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Ho)&&(s.current=i,n.invalidateQueries({queryKey:Xo.capabilities}),n.invalidateQueries({queryKey:Xo.settings}),!tZ()&&to(x("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function VJe(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=nZ(e);if(n===null)return null;const s=Gee(t.bindings).get(n);return s===void 0||BT(e.target)||!Sde(ez(s),t.route)?null:s}const ez=e=>e.slice(6);function WJe(e){const t=_e.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Sp(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Ju(ez(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function $Je(){g.useEffect(()=>{const e=t=>{const n=qe.getState(),s=VJe(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),WJe(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}const zJe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,tz=th()(O6(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),qJe=({open:e,onClose:t,onGoToConsole:n})=>{_t();const{setHasBeenNotified:s}=tz(),{prices:r,isLoading:i,error:a}=sZ(),o=d=>typeof d!="number"?"$...":x("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(fu,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:zJe,alt:x("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),x("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(K0,{onClick:l,children:x("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(Y0,{onClick:u,startIcon:c.jsx(Dl,{size:18}),className:"min-w-55",children:x("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[x("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:x("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:x("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:x("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[x("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(gn,{size:"sm",className:"mr-0.5 align-middle"}):o(r?.default_registration_credits)})," ",x("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:x("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:x("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},KJe=(e,t)=>t?mS(e.filter(n=>n.session_id===t)).length:0;function YJe(e){return _e(t=>KJe(t.sessions,e))}const XJe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function QJe(e){return _e(t=>XJe(t.sessions,e))}const JJe=[];function ZJe(){const{state:e}=jC(),t=e?.pendingConsent??JJe,n=Y5(s=>TI(t,s));return g.useEffect(()=>{t.length>0&&wR()},[t]),TI(t,n)}const nz={approvals:["desktop","mesh","approvals"]},eZe=15e3,tZe=new Set(["requested","approved","connecting","failed"]);function nZe(e){return tZe.has(e)}function sZe(e){return e==="requested"}function rZe(e){return e.filter(t=>sZe(t.state)).length}function Ptt(e){return e.state==="requested"&&e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function Itt(e){return nZe(e)}function Ntt(e){switch(e){case"requested":return x("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return x("ui.mesh.mesh_approvals.approved");case"connecting":return x("ui.mesh.mesh_approvals.connecting");case"connected":return x("ui.mesh.mesh_approvals.connected");case"denied":return x("ui.mesh.mesh_approvals.denied");case"expired":return x("ui.mesh.mesh_approvals.expired");case"failed":return x("ui.mesh.mesh_approvals.failed");default:return e}}function Oc(e){return typeof e=="object"&&e!==null}function iZe(e){const t=Oc(e)?e:{};return{deviceId:Ft(t.device_id),name:Ft(t.name),host:Ft(t.host),user:Ft(t.user),transport:Ft(t.transport),hostKeyFp:Ft(t.host_key_fp)}}function aZe(e){const t=Oc(e)?e:{};return{connect:qo(t.connect,!1),install:qo(t.install,!1),anchor:Oc(t.anchor),networkId:Ft(t.network_id),role:Ft(t.role),unattended:qo(t.unattended,!1),grants:sp(t.grant)}}function oZe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Oc(s))continue;const r=Ft(s.approval_id),i=Ft(s.state);if(!r||!i)continue;const a=Oc(s.what)&&Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance"),o=Object.prototype.hasOwnProperty.call(s,"kind")?Ft(s.kind):void 0,l=a||o==="credential_inheritance"?"credential":o!==void 0&&!["device_onboard","local_authority"].includes(o)?"unknown":!Oc(s.device)&&Oc(s.machine)?"machine":"device",u=Oc(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:l,summary:Ft(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(d=>typeof d=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:Ft(s.approve_remedy)||void 0,where:iZe(l==="machine"?s.machine:s.device),what:aZe(s.what),requestedBy:{surface:Ft(u.surface),sessionId:Ft(u.session_id),deviceId:Ft(u.device_id)},expiresAt:Uc(s.expires_at)})}return n}function lZe(e){return e.kind==="machine"?x("ui.mesh.mesh_approvals.this_machine"):v8({device_id:e.where.deviceId,name:e.where.name})}function Mtt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return X4(e)}const n=X4(e),s=uZe(e,t).map(r=>r.clause);return s.length?x("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:cZe(s)}):x("ui.mesh.mesh_approvals.approval_title",{head:n})}function X4(e){return e.kind==="credential"?e.summary||x("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||x("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?x("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):x("ui.mesh.mesh_approvals.onboard_subject",{subject:lZe(e)})}function cZe(e){return e.length===1?e[0]:x("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Ott(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?x("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function Ltt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Btt(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?x("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?x("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function uZe(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?x("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):x("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?x("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):x("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?x("ui.mesh.mesh_approvals.install_local_operator"):x("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?x("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):x("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:x("ui.mesh.mesh_approvals.install_operator_anchor"),clause:x("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:x("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),h=x("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:h,clause:h,consequence:x("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:x("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:x("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:x("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of dZe(l,o)){const h=hZe()[d];u.push({term:h?.term??x("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:fZe()[d]??x("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:h?.gloss??x("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function dZe(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const hZe=()=>({unattended:{term:x("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:x("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:x("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:x("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),fZe=()=>({list:x("ui.mesh.mesh_approvals.see_its_sessions"),view:x("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:x("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:x("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:x("ui.mesh.mesh_approvals.stop_a_session_there"),slash:x("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:x("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:x("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:x("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:x("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:x("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function jtt(e,t){if(e===null||e<=0)return null;const n=e-t;if(n<=0)return null;if(n<60)return x("ui.mesh.mesh_approvals.expires_in_under_a_minute");const s=Math.ceil(n/60);if(s<90)return x("ui.mesh.mesh_approvals.expires_minutes",{count:s});const r=Math.ceil(s/60);return x("ui.mesh.mesh_approvals.expires_hours",{count:r})}function pZe(e,{poll:t=!0}={}){return ps({queryKey:nz.approvals,enabled:e,queryFn:async()=>oZe(await vt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?eZe:!1,refetchOnWindowFocus:t})}function Htt(){const e=sn();return qn({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await vt(n)},onSettled:()=>{e.invalidateQueries({queryKey:nz.approvals}),e.invalidateQueries({queryKey:Yl.networks}),e.invalidateQueries({queryKey:Yl.peers})}})}function Utt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():x("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function Gtt(e){const t=e;return{code:Ft(t?.code)||"approval_refused",sentence:Ft(t?.message)||x("ui.mesh.mesh_approvals.decision_could_not_be_answered")}}const Q4=e=>{const t=aZ(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},sz=e=>iZ({type:e.type,version:e.offer.version}),gZe=e=>`${e.map(s=>sz(s)).map((s,r)=>r===0?s:`${s.charAt(0).toLowerCase()}${s.slice(1)}`).join(" and ")} available. Show the update notice.`,mZe=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(_t(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(Ze,{side:"top",collisionPadding:8,content:Q4(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":Q4(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(Yi,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(Ze,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[sz(i)," ",x("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:x("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":gZe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(NT,{className:"size-4 shrink-0","aria-hidden":"true"})})})},J4=()=>{const e=tr(p=>p.followed),t=tr(p=>p.running),n=tr(p=>p.offers),s=tr(p=>p.detailOpen),r=tr(p=>p.inflight),i=tr(p=>p.downloadPercent),a=tr(p=>p.openNotice),o=tr(p=>p.noticeOpen),l=tr(p=>p.dismissNotice),u=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:s};return dB.filter(m=>rZ(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,s]),d=g.useMemo(()=>r[ln.BACKEND]?{type:ln.BACKEND,percent:null}:r[ln.UI]?{type:ln.UI,percent:i[ln.UI]}:null,[r,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return c.jsx(mZe,{surfaces:u,inflight:d,onShow:h,onDismiss:o?f:void 0})},Z4=({expanded:e})=>(_t(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(_B,{className:"size-6",label:e?void 0:x("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:x("ui.shell.collapsible_app_logo.local_operator")})]})),fT=ze.memo(({expanded:e,useAuth:t=!1})=>{_t();const n=si(),{user:s,isAuthenticated:r,accountRead:i,signOut:a}=_6(),o=i==="checking"?x("ui.shell.user_profile_sidebar.checking_account"):sD(i)?x("ui.shell.user_profile_sidebar.account_unavailable"):null,l=s?.name??o??x("ui.shell.user_profile_sidebar.user"),u=sD(i),d=s?.email??"",h=u?x("ui.shell.user_profile_sidebar.reconnect_radient"):d,f=u?"/settings?section=providers&provider=radient":"/settings",p=u?x("ui.shell.user_profile_sidebar.reconnect_radient"):x("ui.shell.user_profile_sidebar.account_settings"),m=g.useCallback(async()=>{r&&(await a(),window.location.reload())},[r,a]),v=g.useMemo(()=>{const C=s?.name;return C?C.split(" ").map(y=>y.charAt(0)).join("").toUpperCase().substring(0,2):null},[s?.name]),b=c.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsx(I6,{className:"size-7 shrink-0",children:c.jsx(N6,{className:"border border-control bg-elevated text-ink",children:v??c.jsx(Kie,{size:14,"aria-hidden":"true"})})}),e&&l&&c.jsxs("span",{className:"min-w-0 text-left",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&c.jsx("span",{className:R("block truncate text-meta",u?"text-accent":"text-ink-dim"),children:h})]})]}),w=e?b:c.jsx(Ze,{content:p,side:"right",children:b});return t?c.jsxs(zl,{children:[e?c.jsx(Qo,{asChild:!0,children:b}):c.jsx(Ze,{content:p,side:"right",children:c.jsx(Qo,{asChild:!0,children:b})}),c.jsxs(ql,{align:"end",side:"top",className:"min-w-50",children:[u?c.jsxs(Gt,{onSelect:()=>n(f),children:[c.jsx(R6,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(Gt,{onSelect:()=>n("/settings"),children:[c.jsx(Hc,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(Gt,{children:[c.jsx(mie,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Zr,{}),c.jsxs(Gt,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ore,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.sign_out")]})]})]}):w});fT.displayName="UserProfileSidebar";const vZe=()=>{const e=OT(),t=Ln(),n=_e(u=>u.setCataloguePageable),s=_e(u=>u.setCatalogueActivityHead),r=_e(u=>u.fetchSessions),i=yt(t.data,"session_catalogue_page"),a=yt(t.data,"session_catalogue_sort");g.useEffect(()=>{n(i)},[i,n]),g.useEffect(()=>{s(a)},[a,s]);const o=Wi(t.data,"session_catalogue",2)==="enabled",l=g.useCallback(()=>r(i?QB:pC,i),[r,i]);return g.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},eB="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",xZe=()=>{_t();const e=si(),t=Yoe(),{expanded:n,mode:s,onCollapse:r}=oZ(),i=qe(me=>me.openCommandPalette),a=Ln(),o=_e(me=>me.activeSessionId),l=ZJe(),u=Wi(a.data,"peers")==="enabled",d=AR(u),h=Wi(a.data,"approvals")==="enabled",f=pZe(d==="member"&&h,{poll:!0}),p=rZe(f.data??[]),m=yt(a.data,"projects",1),v=yt(a.data,"library",1),b=qe(me=>me.sidebarOverflowExpanded),w=qe(me=>me.setSidebarOverflowExpanded),C=yt(a.data,"aida",1),y=iv(C),k=C&&y.data?.enabled===!0,_=y.data?.name??"Aida",E=Cce(),T=YJe(y.data?.session_id),A=QJe(y.data?.session_id),F=()=>{E(e,y.data).catch(me=>qt(Xh(me)))},I=[...k?[{icon:Use,label:_,path:"/chat",isActive:t==="chat"&&!!y.data?.session_id&&o===y.data?.session_id,tourTag:"nav-item-aida",onSelect:F,attention:T,attentionTag:"nav-aida-badge",attentionName:me=>x("ui.shell.sidebar_navigation.aida_missed",{name:_,count:me}),working:A,workingName:x("ui.shell.sidebar_navigation.aida_working",{name:_})}]:[],...v?[{icon:Tre,label:x("ui.library.page.title"),path:"/library",isActive:t==="library",tourTag:"nav-item-library"}]:[],...m?[{icon:n5,label:x("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:su,label:x("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:e5,label:x("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:nu,label:x("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:me=>x("ui.shell.sidebar_navigation.browser_waiting",{count:me,countText:String(me)})}],M=[{icon:u5,label:x("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:p6,label:x("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:me=>x("ui.shell.sidebar_navigation.mesh_waiting",{count:me,countText:String(me)})}]:[]],D=b||M.some(me=>me.isActive),O=c.jsx(Bze,{selectedConversation:o??void 0,onSelectConversation:me=>void Rp(e,me),onStageDraft:(me,ee)=>{_e.getState().stageDraft(me,ee),e("/chat")}}),z=me=>{const ee=me.attention??0,ue=ee>0&&me.attentionName?me.attentionName(ee):me.label;return me.working&&me.workingName?me.workingName:ue},B=me=>{const ee=me.attention??0,ue=z(me),Se=me.isActive?Ya:"text-ink-muted hover:bg-row-hover hover:text-ink",Ge=c.jsx(me.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",me.isActive&&"text-accent")});return c.jsx("li",{className:R("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",Se),children:c.jsxs("button",{type:"button",onClick:()=>me.onSelect?me.onSelect():e(me.path),"data-tour-tag":me.tourTag,"aria-current":me.isActive?"page":void 0,"aria-label":n&&ue===me.label?void 0:ue,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[n?Ge:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Ge,ee>0&&c.jsx("span",{className:"pointer-events-none absolute -top-0.5 -right-0.5 flex",children:c.jsx(Kl,{variant:"attentionQuiet",shape:"pill",size:"count",className:"h-3.5 min-w-3.5 px-0.75 leading-none","data-tour-tag":me.attentionTag,children:ee})})]}),n&&c.jsx("span",{className:"truncate",children:me.label}),n&&ee>0&&c.jsx("span",{className:"ml-auto inline-flex",children:c.jsx(Kl,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":me.attentionTag,children:ee})}),me.working&&c.jsx("span",{className:R(n&&"ml-auto","inline-flex"),children:c.jsx(Yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},me.tourTag)},q=me=>n?B(me):c.jsx("li",{children:c.jsx(Ze,{content:z(me),side:"right",children:B(me)})},me.tourTag),K=s==="overlay"?x("ui.shell.sidebar_navigation.close_sidebar"):n?x("ui.shell.sidebar_navigation.collapse_sidebar"):x("ui.shell.sidebar_navigation.expand_sidebar"),Q=s==="overlay"?Tn:n?Rd:Ea,G=navigator.platform.toUpperCase().indexOf("MAC")>=0,X=yt(a.data,"session_catalogue",2),oe=_e(me=>me.activeDraftKey),N=_e(me=>me.drafts),U=!!oe&&!(oe?N[oe]:void 0)?.target,V=()=>{_e.getState().stageDraft(void 0,!0),e("/chat")},H=x("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:c4(G).replace("+","")}),ae=x("ui.shell.sidebar_navigation.search_accessible",{everything:Bo("everything",G),chats:Bo("chats",G)}),he=x("ui.shell.sidebar_navigation.search_tooltip",{everything:Bo("everything",G),chats:Bo("chats",G)}),de=(me,ee,ue,Se)=>{const Ge=me;return c.jsxs("button",{type:"button",...Se.attrs,onClick:Se.onClick,disabled:Se.disabled,"aria-label":Se.ariaLabel,"aria-current":Se.current?"page":void 0,className:R(eB,Se.current?Ya:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(Ge,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:ee}),c.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:c.jsx(Er,{shortcut:ue,joined:!0})})]})},pe=de(yE,x("ui.shell.sidebar_navigation.new_chat"),c4(G),{onClick:V,ariaLabel:H,current:U,disabled:!X,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),se=de(Ad,x("ui.shell.sidebar_navigation.search"),GKe("everything",G),{onClick:i,ariaLabel:ae,attrs:{"data-command-palette-trigger":"",title:he}}),ce=(me,ee,ue)=>{const Se=me;return c.jsx(Ze,{content:ee,side:"right",children:c.jsx("button",{type:"button",...ue.attrs,onClick:ue.onClick,disabled:ue.disabled,"aria-label":ee,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsx(Se,{size:16,"aria-hidden":"true"})})})},L=c.jsx("div",{className:R(s!=="overlay"&&R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100")),children:c.jsx(Ze,{content:K,side:"right",children:c.jsx(ie,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":K,"aria-expanded":s==="overlay"?void 0:n,"aria-keyshortcuts":RD(G),children:c.jsx(Q,{"aria-hidden":"true"})})})}),xe=()=>M.length===0?null:c.jsxs("li",{className:R("flex flex-col",n?"gap-0.5":"items-center gap-1"),children:[n?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","aria-expanded":D,"aria-controls":"sidebar-more-destinations","aria-label":x("ui.library.page.more_destinations"),onClick:()=>w(!D),className:R(eB,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx($f,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:x("ui.library.page.more")}),c.jsx(Ir,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",D&&"rotate-180")})]}):ce($f,x("ui.library.page.more_destinations"),{onClick:()=>w(!D),attrs:{"aria-expanded":D,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more"}}),D&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!n&&"items-center gap-1"),children:M.map(q)})]},"nav-overflow"),ne=c.jsx(Ze,{content:x("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":x("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Hc,{size:16,"aria-hidden":"true"})})});return n?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pr-2 pl-4",children:[c.jsx(Z4,{expanded:!0}),c.jsx("span",{className:"ml-auto",children:L})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[pe,se]}),c.jsx("ul",{className:"flex flex-col gap-0.5",children:I.map(q)})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:O}),c.jsx("div",{className:"shrink-0 px-2 pb-1",children:c.jsx("ul",{className:"flex flex-col gap-0.5",children:xe()})}),c.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[c.jsx(fT,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(J4,{}),ne]})]})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(vZe,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(Z4,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:ce(Ea,K,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":RD(G)}})}),c.jsx("li",{children:ce(yE,H,{onClick:V,disabled:!X,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:ce(Ad,ae,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:I.map(q)}),c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[xe(),c.jsx(J4,{}),ne,c.jsx(fT,{expanded:!1})]})]})},bZe=1,wZe=()=>{const{isAuthenticated:e,user:t}=_6(),{hasBeenNotified:n,setHasBeenNotified:s}=tz(),[r,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await lZ({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!f||typeof f.balance!="number")throw new Error("Invalid credit balance response format");o(f.balance)}catch(f){console.error("Failed to fetch Radient credits:",f),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return g.useEffect(()=>{e&&l()},[e,l]),g.useEffect(()=>{e&&a!==null?a<bZe?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function CZe(){const e=si();g.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=cpe(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=upe(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function yZe(){const e=navigator.windowControlsOverlay;if(!e?.getTitlebarAreaRect)return null;try{const t=e.getTitlebarAreaRect();return t.width<=0&&t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}}catch{return null}}function _Ze(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function SZe(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function EZe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>_Ze(yZe(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),g.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const kZe=g.lazy(()=>uo(()=>import("./agent-details-page-Bbf-ap4W.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),TZe=g.lazy(()=>uo(()=>import("./agent-hub-page-CYf0qdg8.js"),__vite__mapDeps([14,1,2,4,5,6,7,15,3,8,9,10,11,16,17,18,19,12,13]),import.meta.url).then(e=>({default:e.AgentHubPage}))),tB=g.lazy(()=>uo(()=>import("./agents-page-Ddhn0OiX.js"),__vite__mapDeps([20,4,1,2,5,6,7,8,16,12,13]),import.meta.url).then(e=>({default:e.AgentsPage}))),RZe=g.lazy(()=>uo(()=>import("./schedules-page-B4YBOXYX.js"),__vite__mapDeps([21,1,2,4,5,6,7,15,18,10,22,12,13]),import.meta.url).then(e=>({default:e.SchedulesPage}))),nB=g.lazy(()=>uo(()=>import("./projects-page-ZT73ye5v.js"),__vite__mapDeps([23,1,2,4,5,6,7,15,24,25,12,13]),import.meta.url).then(e=>({default:e.ProjectsPage}))),sB=g.lazy(()=>uo(()=>import("./library-page-BHX5kaQb.js").then(e=>e.l),__vite__mapDeps([26,1,2,4,5,6,7,15,27,25]),import.meta.url).then(e=>({default:e.LibraryPage}))),AZe=g.lazy(()=>uo(()=>import("./browser-page-BXSI_6KL.js"),__vite__mapDeps([28,1,2,4,5,6,7,12,13]),import.meta.url).then(e=>({default:e.BrowserPage}))),FZe=g.lazy(()=>uo(()=>import("./mesh-page-BEVPzgDt.js"),__vite__mapDeps([29,1,2,4,5,6,7,15,12,13]),import.meta.url).then(e=>({default:e.MeshPage}))),DZe=g.lazy(()=>uo(()=>import("./settings-page-7C4s3Pn-.js"),__vite__mapDeps([30,1,2,4,5,6,7,15,17,31,11,22,10,18,12,13]),import.meta.url).then(e=>({default:e.SettingsPage}))),PZe=g.lazy(()=>uo(()=>import("./browser-webauthn-prompt-bdks5x_s.js"),__vite__mapDeps([32,1,2,5,6,4,7,12,13]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),IZe=()=>{_t(),EZe(),GJe();const{pathname:e}=MT(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=qoe(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=wZe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=qe();Pl(a,"command-palette"),Pl(o,"create-agent-dialog"),Pl(n,"onboarding"),Pl(s,"low-credits");const d=si(),h=Ln(),f=yt(h.data,"session_catalogue",2),p=yt(h.data,"session_archive");g.useEffect(()=>{_e.getState().requestArchiveConfirm(null)},[e]);const m=Wi(h.data,"peers"),v=Wi(h.data,"library"),b=T=>{_e.getState().stageDraft({kind:"agent",name:T.name}),d("/chat"),u()};dYe(),$Je(),YKe(),CZe(),Kpe();const w=_e(T=>T.setActiveSession),C=_e(T=>{const A=T.activeDraftKey?T.drafts[T.activeDraftKey]:void 0;return Sp(T.activeDraftKey,A?.sessionId,T.activeSessionId)}),y=Nle({displayedSessionId:C,archiveEnabled:p}),k=qe(T=>T.setConsolePaneOpen),_=qe(T=>T.setBrowserPaneOpen),E=qe(T=>T.setConsoleActiveSurface);return g.useEffect(()=>{const T=window.api?.desktop?.onOpenConversation?.((A,F)=>{A!==null&&performance.mark("lop:open:requested"),w(A),F!==void 0&&A!==null&&(E(F),k(!0)),d("/chat")});return()=>T?.()},[d,w,k,E]),g.useEffect(()=>{const T=window.api?.console?.onReveal?.(A=>{A.mode!=="none"&&(A.mode==="session"&&A.session_id!==C||(A.mode==="open"&&w(A.session_id),E(A.surface),k(!0)))});return()=>T?.()},[C,w,k,E]),fce(),MKe(),g.useEffect(()=>{const T=window.api?.browser?.onConsentAttention?.(A=>{const F=Ble(A.requesterSessionId,_e.getState().sessions);if(Mle(A.entryId),F.kind==="browser"){d("/browser");return}w(F.sessionId),_(!0),d("/chat")});return()=>T?.()},[d,w,_]),g.useEffect(()=>{const T=A=>{n||f&&LKe(A)&&(A.preventDefault(),_e.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,n,d]),c.jsx(LJe,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(oYe,{}),c.jsx(BKe,{}),c.jsx(cZ,{}),c.jsx(hYe,{enabled:m==="enabled"}),c.jsx(aXe,{open:n}),c.jsx(BJe,{}),c.jsx(UJe,{}),p&&c.jsx(vce,{}),c.jsx(xle,{}),c.jsx(g.Suspense,{fallback:null,children:c.jsx(PZe,{})}),c.jsx(Rle,{blocked:n||s||a||o||y,sessionId:e.startsWith("/chat")?C??null:null}),c.jsx(qJe,{open:s,onClose:i,onGoToConsole:r}),c.jsx(Joe,{open:o,onClose:u,onAgentCreated:b}),c.jsx(uZ,{sidebar:c.jsx(xZe,{}),content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(gn,{size:"lg",label:x("ui.common.loading.page")})}),children:c.jsxs(dZ,{children:[c.jsx(Cr,{path:"/",element:c.jsx(rD,{to:"/chat",replace:!0})}),c.jsx(Cr,{path:"/chat",element:c.jsx(o4,{})}),c.jsx(Cr,{path:"/chat/:agentId",element:c.jsx(o4,{})}),c.jsx(Cr,{path:"/agents",element:c.jsx(tB,{})}),c.jsx(Cr,{path:"/agents/:agentId",element:c.jsx(tB,{})}),c.jsx(Cr,{path:"/settings",element:c.jsx(DZe,{})}),c.jsx(Cr,{path:"/agent-hub",element:c.jsx(TZe,{})}),c.jsx(Cr,{path:"/agent-hub/:agentId",element:c.jsx(kZe,{})}),c.jsx(Cr,{path:"/schedules",element:c.jsx(RZe,{})}),c.jsx(Cr,{path:"/projects",element:c.jsx(nB,{})}),c.jsx(Cr,{path:"/projects/:projectId",element:c.jsx(nB,{})}),c.jsx(Cr,{path:"/browser",element:c.jsx(AZe,{})}),v==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(Cr,{path:"/library",element:c.jsx(sB,{})}),c.jsx(Cr,{path:"/library/assets/:assetId",element:c.jsx(sB,{})})]}),m==="enabled"&&c.jsx(Cr,{path:"/mesh",element:c.jsx(FZe,{})}),c.jsx(Cr,{path:"*",element:c.jsx(rD,{to:"/chat",replace:!0})})]})})]})})]})})})};let Ao=null,$h=null,Og=null,zh=null,pS=null;const NZe={soundsArm:async()=>{if(Dh.getState().element)throw new Error("sounds safety: element already exists");if(Ao)throw new Error("sounds safety: graph already armed");return Ao=new AudioContext,await Ao.resume(),hZ(e=>{if(!Ao)throw new Error("sounds safety: no context");const t=Ao.createMediaElementSource(e);Og=Ao.createGain(),Og.gain.value=0,$h=Ao.createAnalyser(),zh=Ao.createAnalyser(),t.connect(zh),zh.connect(Og),Og.connect($h),$h.connect(Ao.destination)}),{armed:!0,contextState:Ao.state}},soundsFacts:()=>{const e=Dh.getState(),t=new Float32Array($h?.fftSize??32);$h?.getFloatTimeDomainData(t);const n=new Float32Array(zh?.fftSize??32);return zh?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Og?.gain.value??null,inputRms:zh?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:$h?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(ns.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(o,l)=>n.dispatchEvent(new PointerEvent(o,{pointerId:17,pointerType:"mouse",clientX:l,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;return n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction),new Promise(o=>requestAnimationFrame(()=>{const l=n.closest("[data-sound-player]")?.getAttribute("data-sound-status");pS=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},o({during:l,seconds:Dh.getState().element?.currentTime})}))},soundsScrubFinish:()=>(pS?.(),pS=null,{committed:!0}),soundsEnd:()=>{const e=Dh.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=Dh.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await uo(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-neD8lOHF.js").then(i=>i.mg);return{fetchAttachmentBlob:r}},__vite__mapDeps([4,1,2,5,6,7]),import.meta.url),n=_e.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await NB.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Dh.getState().ownerId}}};function sd(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const MZe=3,OZe=3e3;function LZe(e){return e instanceof CSSTransition&&e.playState==="running"}function BZe(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${q0(n)??"an element no longer in the document"} = ${i}`}async function jZe(e=OZe){const t=performance.now();let n=0;for(;;){await sd();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(LZe);if(n=r.length===0?n+1:0,n>=MZe)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(BZe)}}}const HZe=/^#/;function Gm(){const e=window.location.hash.replace(HZe,"");return e===""?"/":e}function q0(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function UZe(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>q0(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:q0(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Lg(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function GZe(e,t=1e4){const n=Date.now();for(;Gm()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${Gm()})`);await new Promise(s=>setTimeout(s,50))}return await sd(),Gm()}const pT=["dev-driver","query-fetch-probe"];let Vm=null;function VZe(){if(Vm)return Vm;const e=[],t=iD.prototype.fetch;return iD.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
704
+ A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>NJe("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){K4("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog publishes your agent's instruction set to the community. You need a Radient account to publish, which is free to create and costs nothing per agent. You can review the details before confirming. What is published is what describes the agent - its name, description, instructions and tool surface; no conversation, execution history, memory, plan or machine-specific configuration leaves your computer. Make sure your agent meets the required criteria before submitting.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{K4("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:"right"},title:"General settings",text:"Here you can update your user profile and configure model settings (like default hosting provider and model).",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],MJe=()=>{const e=si(),{completeTourOnboarding:t}=Wm(),n=g.useContext(_y),s={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},r=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=Wm.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const u=n?.Shepherd;if(!l&&u&&(l=u.activeTour,!l&&u.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new u.Tour({useModalOverlay:r,defaultStepOptions:s}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...s},l.options.useModalOverlay=r,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const d=[...l.steps];for(const h of d)h.id&&l.removeStep(h.id);l.addSteps(Y4)}else l.steps.length===0&&l.addSteps(Y4);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},OJe=()=>{const{isModalComplete:e,isTourComplete:t}=Wm(),{startTour:n}=MJe(),s=ze.useContext(_y),{data:r}=_E(1,1);return g.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},LJe=({children:e})=>c.jsxs(EJe,{children:[e,c.jsx(OJe,{})]}),BJe=()=>{_t();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=g6(),r=g.useRef(null);g.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=si();return c.jsx(_a,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Sa,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx($i,{className:"text-title",children:x("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(oo,{className:"text-body-sm text-ink-muted",children:x("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(D$,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})},jJe=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l})=>c.jsxs("div",{ref:i,id:l,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),Att=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),Ftt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});async function Z$(e){await vt({op:"settings.edit",key:Ho,value:e.value}),QJ(e.queryClient)}async function HJe(e){await Z$(e),e.queryClient.setQueryData(Db.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Ho?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const Dtt=({focus:e=!1})=>{_t();const t=sn(),n=Ln(),s=yt(n.data,"settings"),r=ps({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),enabled:s,retry:!1,refetchOnReconnect:!0}),i=r.data?.settings.find(A=>A.key===Ho),[a,o]=g.useState(!1),[l,u]=g.useState(null),[d,h]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),v=g.useRef(null),b=g.useRef(!1);g.useEffect(()=>{if(!e){b.current=!1;return}!i||b.current||(v.current?.querySelector("[role=combobox]")?.focus(),b.current=!0)},[e,i]),g.useEffect(()=>{r.isSuccess&&!r.isFetching&&h(!1)},[r.isFetching,r.isSuccess]);const w=async A=>{if(!(!i||m.current||d||!i.choices.some(F=>F.value===A))){m.current=!0,o(!0),u(null),p(!1);try{const F=await HJe({value:A,queryClient:t});h(F==="readback-unknown"),p(F==="confirmed")}catch(F){u({value:A,message:F instanceof Error?F.message:""})}finally{m.current=!1,o(!1)}}},C=async()=>{const[A,F]=await Promise.all([r.refetch(),n.refetch()]);!A.isError&&!F.isError&&h(!1)},y=!r.data&&r.error||!n.data&&n.error,k=n.data&&(!s||r.data&&!i),_=!y&&!k&&!i,E=n.data?.features?.i18n?n.data.language:void 0,T=typeof E=="string"&&E!==""?E:void 0;return c.jsx(jJe,{title:x("ui.settings.language.dialog.title"),icon:s5,description:x("ui.settings.language.general.description"),children:c.jsxs("div",{ref:v,"data-setting-key":Ho,className:"flex flex-col gap-3","aria-busy":a,children:[_&&c.jsx("output",{className:"text-meta text-ink-dim",children:x("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:x("ui.settings.language.dialog.unavailable")}),i&&c.jsx(y6,{setting:{...UT(i),label:x("ui.settings.language.dialog.title")},value:String(i.value),onValueChange:A=>{w(A)},disabled:a||d,suppressEffectiveNote:!0}),c.jsx("output",{id:YJ(Ho),"aria-live":"polite",className:"text-meta text-ink-dim",children:a?x("ui.settings.language.general.pending"):f?x("ui.settings.language.general.saved"):T?x(d||n.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:XJ(T)?.name??T}):x("ui.settings.language.general.no_resolution")}),(y||l||d)&&c.jsx(Jr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:l?x("ui.settings.language.general.write_error",{message:l.message}):d?x("ui.settings.language.general.readback_error"):x("ui.settings.language.dialog.unavailable")}),c.jsx(ie,{variant:"outline",size:"sm",disabled:a||r.isFetching||n.isFetching,onClick:()=>{l?w(l.value):C()},children:x("ui.settings.language.dialog.retry")})]})})]})})},UJe=()=>{_t();const e=aT(q=>q.open),t=aT(q=>q.closeLanguage),n=sn(),s=Ln(),r=yt(s.data,"settings"),i=ps({queryKey:Db.all,queryFn:()=>vt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=g.useRef(null),o=i6(),l=(i.data?.settings??[]).find(q=>q.key===Ho),u=l?UT(l):void 0,[d,h]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[b,w]=g.useState(null),C=g.useRef(null);g.useEffect(()=>{e&&h(null)},[e]),g.useEffect(()=>{if(!e||!u)return;const q=String(u.value??"");(d===null||d===C.current)&&h(q),C.current=q},[e,u,d]),g.useEffect(()=>{e&&(v(!1),w(null))},[e]);const y=d??String(u?.value??""),k=!!u&&y!==String(u?.value??""),_=!u||!k||f,E=async()=>{if(!(!u||!k)){p(!0),w(null);try{await Z$({value:y,queryClient:n}),v(!0),h(null),await i.refetch()}catch(q){w(q instanceof Error?q.message:x("ui.settings.configuration.language_dialog.the_language_could_not_be_saved"))}finally{p(!1)}}},T=!!s.data,A=T&&!r,F=s.error&&!s.data?s.error:null,I=F??i.error,M=!T&&!I,{sentence:D,remedy:O}=JJ(o??null,x("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),I),z=s.isFetching||i.isFetching,B=u?"combo":I?"retry":"none";return g.useEffect(()=>{!e||B==="none"||requestAnimationFrame(()=>{a.current?.querySelector(B==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,B]),c.jsx(_a,{open:e,onOpenChange:q=>!q&&t(),children:c.jsxs(Sa,{ref:a,onOpenAutoFocus:q=>q.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx($i,{className:"text-title",children:x("ui.settings.language.dialog.title")}),c.jsx(oo,{className:"text-body-sm text-ink-muted",children:x("ui.settings.language.dialog.description")})]}),M?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(gn,{}),x("ui.settings.language.dialog.loading")]}):A?c.jsx(Jr,{variant:"warning",children:c.jsx("span",{children:x("ui.settings.language.dialog.unavailable")})}):I?c.jsx(Jr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:D}),O&&c.jsx(ie,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:z,children:z?x("ui.settings.language.dialog.retrying"):x("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(gn,{}),x("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:nD(Ho),className:"text-meta text-ink-dim",children:u.help}),c.jsx(y6,{setting:u,value:y,disabled:f,helpId:nD(Ho),effectiveNoteId:ZJ(Ho,eZ),onValueChange:q=>{v(!1),h(q)}})]}),b&&c.jsx("p",{className:"text-meta text-danger",children:b}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:m&&!k?c.jsxs("output",{"data-language-save":"",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Us,{"aria-hidden":"true",className:"size-3.5"}),x("ui.settings.language.dialog.saved")]}):c.jsx(ie,{onClick:E,disabled:_,"data-language-save":"",children:f?`${x("ui.settings.language.dialog.save")}...`:x("ui.settings.language.dialog.save")})})]}):c.jsx(Jr,{variant:"warning",children:c.jsx("span",{children:x("ui.settings.language.dialog.unavailable")})})]})})};function GJe(){const{data:e}=Ln();g.useEffect(()=>{e&&jz(e)},[e]);const t=OT(),n=sn(),s=g.useRef(null);g.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Ho)&&(s.current=i,n.invalidateQueries({queryKey:Xo.capabilities}),n.invalidateQueries({queryKey:Xo.settings}),!tZ()&&to(x("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function VJe(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=nZ(e);if(n===null)return null;const s=Gee(t.bindings).get(n);return s===void 0||BT(e.target)||!Sde(ez(s),t.route)?null:s}const ez=e=>e.slice(6);function WJe(e){const t=_e.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Sp(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Ju(ez(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function $Je(){g.useEffect(()=>{const e=t=>{const n=qe.getState(),s=VJe(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),WJe(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}const zJe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,tz=th()(O6(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),qJe=({open:e,onClose:t,onGoToConsole:n})=>{_t();const{setHasBeenNotified:s}=tz(),{prices:r,isLoading:i,error:a}=sZ(),o=d=>typeof d!="number"?"$...":x("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(fu,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:zJe,alt:x("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),x("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(K0,{onClick:l,children:x("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(Y0,{onClick:u,startIcon:c.jsx(Dl,{size:18}),className:"min-w-55",children:x("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[x("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:x("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:x("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:x("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[x("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(gn,{size:"sm",className:"mr-0.5 align-middle"}):o(r?.default_registration_credits)})," ",x("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:x("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:x("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},KJe=(e,t)=>t?mS(e.filter(n=>n.session_id===t)).length:0;function YJe(e){return _e(t=>KJe(t.sessions,e))}const XJe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function QJe(e){return _e(t=>XJe(t.sessions,e))}const JJe=[];function ZJe(){const{state:e}=jC(),t=e?.pendingConsent??JJe,n=Y5(s=>TI(t,s));return g.useEffect(()=>{t.length>0&&wR()},[t]),TI(t,n)}const nz={approvals:["desktop","mesh","approvals"]},eZe=15e3,tZe=new Set(["requested","approved","connecting","failed"]);function nZe(e){return tZe.has(e)}function sZe(e){return e==="requested"}function rZe(e){return e.filter(t=>sZe(t.state)).length}function Ptt(e){return e.state==="requested"&&e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function Itt(e){return nZe(e)}function Ntt(e){switch(e){case"requested":return x("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return x("ui.mesh.mesh_approvals.approved");case"connecting":return x("ui.mesh.mesh_approvals.connecting");case"connected":return x("ui.mesh.mesh_approvals.connected");case"denied":return x("ui.mesh.mesh_approvals.denied");case"expired":return x("ui.mesh.mesh_approvals.expired");case"failed":return x("ui.mesh.mesh_approvals.failed");default:return e}}function Oc(e){return typeof e=="object"&&e!==null}function iZe(e){const t=Oc(e)?e:{};return{deviceId:Ft(t.device_id),name:Ft(t.name),host:Ft(t.host),user:Ft(t.user),transport:Ft(t.transport),hostKeyFp:Ft(t.host_key_fp)}}function aZe(e){const t=Oc(e)?e:{};return{connect:qo(t.connect,!1),install:qo(t.install,!1),anchor:Oc(t.anchor),networkId:Ft(t.network_id),role:Ft(t.role),unattended:qo(t.unattended,!1),grants:sp(t.grant)}}function oZe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Oc(s))continue;const r=Ft(s.approval_id),i=Ft(s.state);if(!r||!i)continue;const a=Oc(s.what)&&Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance"),o=Object.prototype.hasOwnProperty.call(s,"kind")?Ft(s.kind):void 0,l=a||o==="credential_inheritance"?"credential":o!==void 0&&!["device_onboard","local_authority"].includes(o)?"unknown":!Oc(s.device)&&Oc(s.machine)?"machine":"device",u=Oc(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:l,summary:Ft(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(d=>typeof d=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:Ft(s.approve_remedy)||void 0,where:iZe(l==="machine"?s.machine:s.device),what:aZe(s.what),requestedBy:{surface:Ft(u.surface),sessionId:Ft(u.session_id),deviceId:Ft(u.device_id)},expiresAt:Uc(s.expires_at)})}return n}function lZe(e){return e.kind==="machine"?x("ui.mesh.mesh_approvals.this_machine"):v8({device_id:e.where.deviceId,name:e.where.name})}function Mtt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return X4(e)}const n=X4(e),s=uZe(e,t).map(r=>r.clause);return s.length?x("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:cZe(s)}):x("ui.mesh.mesh_approvals.approval_title",{head:n})}function X4(e){return e.kind==="credential"?e.summary||x("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||x("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?x("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):x("ui.mesh.mesh_approvals.onboard_subject",{subject:lZe(e)})}function cZe(e){return e.length===1?e[0]:x("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Ott(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?x("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function Ltt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Btt(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?x("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?x("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function uZe(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?x("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):x("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?x("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):x("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?x("ui.mesh.mesh_approvals.install_local_operator"):x("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?x("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):x("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:x("ui.mesh.mesh_approvals.install_operator_anchor"),clause:x("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:x("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),h=x("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:h,clause:h,consequence:x("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:x("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:x("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:x("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of dZe(l,o)){const h=hZe()[d];u.push({term:h?.term??x("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:fZe()[d]??x("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:h?.gloss??x("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function dZe(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const hZe=()=>({unattended:{term:x("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:x("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:x("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:x("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),fZe=()=>({list:x("ui.mesh.mesh_approvals.see_its_sessions"),view:x("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:x("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:x("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:x("ui.mesh.mesh_approvals.stop_a_session_there"),slash:x("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:x("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:x("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:x("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:x("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:x("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function jtt(e,t){if(e===null||e<=0)return null;const n=e-t;if(n<=0)return null;if(n<60)return x("ui.mesh.mesh_approvals.expires_in_under_a_minute");const s=Math.ceil(n/60);if(s<90)return x("ui.mesh.mesh_approvals.expires_minutes",{count:s});const r=Math.ceil(s/60);return x("ui.mesh.mesh_approvals.expires_hours",{count:r})}function pZe(e,{poll:t=!0}={}){return ps({queryKey:nz.approvals,enabled:e,queryFn:async()=>oZe(await vt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?eZe:!1,refetchOnWindowFocus:t})}function Htt(){const e=sn();return qn({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await vt(n)},onSettled:()=>{e.invalidateQueries({queryKey:nz.approvals}),e.invalidateQueries({queryKey:Yl.networks}),e.invalidateQueries({queryKey:Yl.peers})}})}function Utt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():x("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function Gtt(e){const t=e;return{code:Ft(t?.code)||"approval_refused",sentence:Ft(t?.message)||x("ui.mesh.mesh_approvals.decision_could_not_be_answered")}}const Q4=e=>{const t=aZ(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},sz=e=>iZ({type:e.type,version:e.offer.version}),gZe=e=>`${e.map(s=>sz(s)).map((s,r)=>r===0?s:`${s.charAt(0).toLowerCase()}${s.slice(1)}`).join(" and ")} available. Show the update notice.`,mZe=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(_t(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(Ze,{side:"top",collisionPadding:8,content:Q4(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":Q4(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(Yi,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(Ze,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[sz(i)," ",x("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:x("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":gZe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(NT,{className:"size-4 shrink-0","aria-hidden":"true"})})})},J4=()=>{const e=tr(p=>p.followed),t=tr(p=>p.running),n=tr(p=>p.offers),s=tr(p=>p.detailOpen),r=tr(p=>p.inflight),i=tr(p=>p.downloadPercent),a=tr(p=>p.openNotice),o=tr(p=>p.noticeOpen),l=tr(p=>p.dismissNotice),u=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:s};return dB.filter(m=>rZ(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,s]),d=g.useMemo(()=>r[ln.BACKEND]?{type:ln.BACKEND,percent:null}:r[ln.UI]?{type:ln.UI,percent:i[ln.UI]}:null,[r,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return c.jsx(mZe,{surfaces:u,inflight:d,onShow:h,onDismiss:o?f:void 0})},Z4=({expanded:e})=>(_t(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(_B,{className:"size-6",label:e?void 0:x("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:x("ui.shell.collapsible_app_logo.local_operator")})]})),fT=ze.memo(({expanded:e,useAuth:t=!1})=>{_t();const n=si(),{user:s,isAuthenticated:r,accountRead:i,signOut:a}=_6(),o=i==="checking"?x("ui.shell.user_profile_sidebar.checking_account"):sD(i)?x("ui.shell.user_profile_sidebar.account_unavailable"):null,l=s?.name??o??x("ui.shell.user_profile_sidebar.user"),u=sD(i),d=s?.email??"",h=u?x("ui.shell.user_profile_sidebar.reconnect_radient"):d,f=u?"/settings?section=providers&provider=radient":"/settings",p=u?x("ui.shell.user_profile_sidebar.reconnect_radient"):x("ui.shell.user_profile_sidebar.account_settings"),m=g.useCallback(async()=>{r&&(await a(),window.location.reload())},[r,a]),v=g.useMemo(()=>{const C=s?.name;return C?C.split(" ").map(y=>y.charAt(0)).join("").toUpperCase().substring(0,2):null},[s?.name]),b=c.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsx(I6,{className:"size-7 shrink-0",children:c.jsx(N6,{className:"border border-control bg-elevated text-ink",children:v??c.jsx(Kie,{size:14,"aria-hidden":"true"})})}),e&&l&&c.jsxs("span",{className:"min-w-0 text-left",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&c.jsx("span",{className:R("block truncate text-meta",u?"text-accent":"text-ink-dim"),children:h})]})]}),w=e?b:c.jsx(Ze,{content:p,side:"right",children:b});return t?c.jsxs(zl,{children:[e?c.jsx(Qo,{asChild:!0,children:b}):c.jsx(Ze,{content:p,side:"right",children:c.jsx(Qo,{asChild:!0,children:b})}),c.jsxs(ql,{align:"end",side:"top",className:"min-w-50",children:[u?c.jsxs(Gt,{onSelect:()=>n(f),children:[c.jsx(R6,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(Gt,{onSelect:()=>n("/settings"),children:[c.jsx(Hc,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(Gt,{children:[c.jsx(mie,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Zr,{}),c.jsxs(Gt,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ore,{size:16,"aria-hidden":"true"}),x("ui.shell.user_profile_sidebar.sign_out")]})]})]}):w});fT.displayName="UserProfileSidebar";const vZe=()=>{const e=OT(),t=Ln(),n=_e(u=>u.setCataloguePageable),s=_e(u=>u.setCatalogueActivityHead),r=_e(u=>u.fetchSessions),i=yt(t.data,"session_catalogue_page"),a=yt(t.data,"session_catalogue_sort");g.useEffect(()=>{n(i)},[i,n]),g.useEffect(()=>{s(a)},[a,s]);const o=Wi(t.data,"session_catalogue",2)==="enabled",l=g.useCallback(()=>r(i?QB:pC,i),[r,i]);return g.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},eB="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",xZe=()=>{_t();const e=si(),t=Yoe(),{expanded:n,mode:s,onCollapse:r}=oZ(),i=qe(me=>me.openCommandPalette),a=Ln(),o=_e(me=>me.activeSessionId),l=ZJe(),u=Wi(a.data,"peers")==="enabled",d=AR(u),h=Wi(a.data,"approvals")==="enabled",f=pZe(d==="member"&&h,{poll:!0}),p=rZe(f.data??[]),m=yt(a.data,"projects",1),v=yt(a.data,"library",1),b=qe(me=>me.sidebarOverflowExpanded),w=qe(me=>me.setSidebarOverflowExpanded),C=yt(a.data,"aida",1),y=iv(C),k=C&&y.data?.enabled===!0,_=y.data?.name??"Aida",E=Cce(),T=YJe(y.data?.session_id),A=QJe(y.data?.session_id),F=()=>{E(e,y.data).catch(me=>qt(Xh(me)))},I=[...k?[{icon:Use,label:_,path:"/chat",isActive:t==="chat"&&!!y.data?.session_id&&o===y.data?.session_id,tourTag:"nav-item-aida",onSelect:F,attention:T,attentionTag:"nav-aida-badge",attentionName:me=>x("ui.shell.sidebar_navigation.aida_missed",{name:_,count:me}),working:A,workingName:x("ui.shell.sidebar_navigation.aida_working",{name:_})}]:[],...v?[{icon:Tre,label:x("ui.library.page.title"),path:"/library",isActive:t==="library",tourTag:"nav-item-library"}]:[],...m?[{icon:n5,label:x("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:su,label:x("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:e5,label:x("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:nu,label:x("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:me=>x("ui.shell.sidebar_navigation.browser_waiting",{count:me,countText:String(me)})}],M=[{icon:u5,label:x("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:p6,label:x("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:me=>x("ui.shell.sidebar_navigation.mesh_waiting",{count:me,countText:String(me)})}]:[]],D=b||M.some(me=>me.isActive),O=c.jsx(Bze,{selectedConversation:o??void 0,onSelectConversation:me=>void Rp(e,me),onStageDraft:(me,ee)=>{_e.getState().stageDraft(me,ee),e("/chat")}}),z=me=>{const ee=me.attention??0,ue=ee>0&&me.attentionName?me.attentionName(ee):me.label;return me.working&&me.workingName?me.workingName:ue},B=me=>{const ee=me.attention??0,ue=z(me),Se=me.isActive?Ya:"text-ink-muted hover:bg-row-hover hover:text-ink",Ge=c.jsx(me.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",me.isActive&&"text-accent")});return c.jsx("li",{className:R("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",Se),children:c.jsxs("button",{type:"button",onClick:()=>me.onSelect?me.onSelect():e(me.path),"data-tour-tag":me.tourTag,"aria-current":me.isActive?"page":void 0,"aria-label":n&&ue===me.label?void 0:ue,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[n?Ge:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Ge,ee>0&&c.jsx("span",{className:"pointer-events-none absolute -top-0.5 -right-0.5 flex",children:c.jsx(Kl,{variant:"attentionQuiet",shape:"pill",size:"count",className:"h-3.5 min-w-3.5 px-0.75 leading-none","data-tour-tag":me.attentionTag,children:ee})})]}),n&&c.jsx("span",{className:"truncate",children:me.label}),n&&ee>0&&c.jsx("span",{className:"ml-auto inline-flex",children:c.jsx(Kl,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":me.attentionTag,children:ee})}),me.working&&c.jsx("span",{className:R(n&&"ml-auto","inline-flex"),children:c.jsx(Yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},me.tourTag)},q=me=>n?B(me):c.jsx("li",{children:c.jsx(Ze,{content:z(me),side:"right",children:B(me)})},me.tourTag),K=s==="overlay"?x("ui.shell.sidebar_navigation.close_sidebar"):n?x("ui.shell.sidebar_navigation.collapse_sidebar"):x("ui.shell.sidebar_navigation.expand_sidebar"),Q=s==="overlay"?Tn:n?Rd:Ea,G=navigator.platform.toUpperCase().indexOf("MAC")>=0,X=yt(a.data,"session_catalogue",2),oe=_e(me=>me.activeDraftKey),N=_e(me=>me.drafts),U=!!oe&&!(oe?N[oe]:void 0)?.target,V=()=>{_e.getState().stageDraft(void 0,!0),e("/chat")},H=x("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:c4(G).replace("+","")}),ae=x("ui.shell.sidebar_navigation.search_accessible",{everything:Bo("everything",G),chats:Bo("chats",G)}),he=x("ui.shell.sidebar_navigation.search_tooltip",{everything:Bo("everything",G),chats:Bo("chats",G)}),de=(me,ee,ue,Se)=>{const Ge=me;return c.jsxs("button",{type:"button",...Se.attrs,onClick:Se.onClick,disabled:Se.disabled,"aria-label":Se.ariaLabel,"aria-current":Se.current?"page":void 0,className:R(eB,Se.current?Ya:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(Ge,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:ee}),c.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:c.jsx(Er,{shortcut:ue,joined:!0})})]})},pe=de(yE,x("ui.shell.sidebar_navigation.new_chat"),c4(G),{onClick:V,ariaLabel:H,current:U,disabled:!X,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),se=de(Ad,x("ui.shell.sidebar_navigation.search"),GKe("everything",G),{onClick:i,ariaLabel:ae,attrs:{"data-command-palette-trigger":"",title:he}}),ce=(me,ee,ue)=>{const Se=me;return c.jsx(Ze,{content:ee,side:"right",children:c.jsx("button",{type:"button",...ue.attrs,onClick:ue.onClick,disabled:ue.disabled,"aria-label":ee,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsx(Se,{size:16,"aria-hidden":"true"})})})},L=c.jsx("div",{className:R(s!=="overlay"&&R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100")),children:c.jsx(Ze,{content:K,side:"right",children:c.jsx(ie,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":K,"aria-expanded":s==="overlay"?void 0:n,"aria-keyshortcuts":RD(G),children:c.jsx(Q,{"aria-hidden":"true"})})})}),xe=()=>M.length===0?null:c.jsxs("li",{className:R("flex flex-col",n?"gap-0.5":"items-center gap-1"),children:[n?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","aria-expanded":D,"aria-controls":"sidebar-more-destinations","aria-label":x("ui.library.page.more_destinations"),onClick:()=>w(!D),className:R(eB,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx($f,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:x("ui.library.page.more")}),c.jsx(Ir,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",D&&"rotate-180")})]}):ce($f,x("ui.library.page.more_destinations"),{onClick:()=>w(!D),attrs:{"aria-expanded":D,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more"}}),D&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!n&&"items-center gap-1"),children:M.map(q)})]},"nav-overflow"),ne=c.jsx(Ze,{content:x("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":x("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Hc,{size:16,"aria-hidden":"true"})})});return n?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pr-2 pl-4",children:[c.jsx(Z4,{expanded:!0}),c.jsx("span",{className:"ml-auto",children:L})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[pe,se]}),c.jsx("ul",{className:"flex flex-col gap-0.5",children:I.map(q)})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:O}),c.jsx("div",{className:"shrink-0 px-2 pb-1",children:c.jsx("ul",{className:"flex flex-col gap-0.5",children:xe()})}),c.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[c.jsx(fT,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(J4,{}),ne]})]})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(vZe,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(Z4,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:ce(Ea,K,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":RD(G)}})}),c.jsx("li",{children:ce(yE,H,{onClick:V,disabled:!X,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:ce(Ad,ae,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:I.map(q)}),c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[xe(),c.jsx(J4,{}),ne,c.jsx(fT,{expanded:!1})]})]})},bZe=1,wZe=()=>{const{isAuthenticated:e,user:t}=_6(),{hasBeenNotified:n,setHasBeenNotified:s}=tz(),[r,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await lZ({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!f||typeof f.balance!="number")throw new Error("Invalid credit balance response format");o(f.balance)}catch(f){console.error("Failed to fetch Radient credits:",f),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return g.useEffect(()=>{e&&l()},[e,l]),g.useEffect(()=>{e&&a!==null?a<bZe?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function CZe(){const e=si();g.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=cpe(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=upe(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function yZe(){const e=navigator.windowControlsOverlay;if(!e?.getTitlebarAreaRect)return null;try{const t=e.getTitlebarAreaRect();return t.width<=0&&t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}}catch{return null}}function _Ze(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function SZe(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function EZe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>_Ze(yZe(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),g.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const kZe=g.lazy(()=>uo(()=>import("./agent-details-page-vUtr6XRL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),TZe=g.lazy(()=>uo(()=>import("./agent-hub-page-DLfJB8ns.js"),__vite__mapDeps([14,1,2,4,5,6,7,15,3,8,9,10,11,16,17,18,19,12,13]),import.meta.url).then(e=>({default:e.AgentHubPage}))),tB=g.lazy(()=>uo(()=>import("./agents-page-B-PHMFxF.js"),__vite__mapDeps([20,4,1,2,5,6,7,8,16,12,13]),import.meta.url).then(e=>({default:e.AgentsPage}))),RZe=g.lazy(()=>uo(()=>import("./schedules-page-DbZSRb3g.js"),__vite__mapDeps([21,1,2,4,5,6,7,15,18,10,22,12,13]),import.meta.url).then(e=>({default:e.SchedulesPage}))),nB=g.lazy(()=>uo(()=>import("./projects-page-BIRVv4yi.js"),__vite__mapDeps([23,1,2,4,5,6,7,15,24,25,12,13]),import.meta.url).then(e=>({default:e.ProjectsPage}))),sB=g.lazy(()=>uo(()=>import("./library-page-BGmng_P-.js").then(e=>e.l),__vite__mapDeps([26,1,2,4,5,6,7,15,27,25]),import.meta.url).then(e=>({default:e.LibraryPage}))),AZe=g.lazy(()=>uo(()=>import("./browser-page-DAQis2Rt.js"),__vite__mapDeps([28,1,2,4,5,6,7,12,13]),import.meta.url).then(e=>({default:e.BrowserPage}))),FZe=g.lazy(()=>uo(()=>import("./mesh-page-1yPLxWRO.js"),__vite__mapDeps([29,1,2,4,5,6,7,15,12,13]),import.meta.url).then(e=>({default:e.MeshPage}))),DZe=g.lazy(()=>uo(()=>import("./settings-page-DH9sXfEW.js"),__vite__mapDeps([30,1,2,4,5,6,7,15,17,31,11,22,10,18,12,13]),import.meta.url).then(e=>({default:e.SettingsPage}))),PZe=g.lazy(()=>uo(()=>import("./browser-webauthn-prompt-CLrsocAn.js"),__vite__mapDeps([32,1,2,5,6,4,7,12,13]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),IZe=()=>{_t(),EZe(),GJe();const{pathname:e}=MT(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=qoe(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=wZe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=qe();Pl(a,"command-palette"),Pl(o,"create-agent-dialog"),Pl(n,"onboarding"),Pl(s,"low-credits");const d=si(),h=Ln(),f=yt(h.data,"session_catalogue",2),p=yt(h.data,"session_archive");g.useEffect(()=>{_e.getState().requestArchiveConfirm(null)},[e]);const m=Wi(h.data,"peers"),v=Wi(h.data,"library"),b=T=>{_e.getState().stageDraft({kind:"agent",name:T.name}),d("/chat"),u()};dYe(),$Je(),YKe(),CZe(),Kpe();const w=_e(T=>T.setActiveSession),C=_e(T=>{const A=T.activeDraftKey?T.drafts[T.activeDraftKey]:void 0;return Sp(T.activeDraftKey,A?.sessionId,T.activeSessionId)}),y=Nle({displayedSessionId:C,archiveEnabled:p}),k=qe(T=>T.setConsolePaneOpen),_=qe(T=>T.setBrowserPaneOpen),E=qe(T=>T.setConsoleActiveSurface);return g.useEffect(()=>{const T=window.api?.desktop?.onOpenConversation?.((A,F)=>{A!==null&&performance.mark("lop:open:requested"),w(A),F!==void 0&&A!==null&&(E(F),k(!0)),d("/chat")});return()=>T?.()},[d,w,k,E]),g.useEffect(()=>{const T=window.api?.console?.onReveal?.(A=>{A.mode!=="none"&&(A.mode==="session"&&A.session_id!==C||(A.mode==="open"&&w(A.session_id),E(A.surface),k(!0)))});return()=>T?.()},[C,w,k,E]),fce(),MKe(),g.useEffect(()=>{const T=window.api?.browser?.onConsentAttention?.(A=>{const F=Ble(A.requesterSessionId,_e.getState().sessions);if(Mle(A.entryId),F.kind==="browser"){d("/browser");return}w(F.sessionId),_(!0),d("/chat")});return()=>T?.()},[d,w,_]),g.useEffect(()=>{const T=A=>{n||f&&LKe(A)&&(A.preventDefault(),_e.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,n,d]),c.jsx(LJe,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(oYe,{}),c.jsx(BKe,{}),c.jsx(cZ,{}),c.jsx(hYe,{enabled:m==="enabled"}),c.jsx(aXe,{open:n}),c.jsx(BJe,{}),c.jsx(UJe,{}),p&&c.jsx(vce,{}),c.jsx(xle,{}),c.jsx(g.Suspense,{fallback:null,children:c.jsx(PZe,{})}),c.jsx(Rle,{blocked:n||s||a||o||y,sessionId:e.startsWith("/chat")?C??null:null}),c.jsx(qJe,{open:s,onClose:i,onGoToConsole:r}),c.jsx(Joe,{open:o,onClose:u,onAgentCreated:b}),c.jsx(uZ,{sidebar:c.jsx(xZe,{}),content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(gn,{size:"lg",label:x("ui.common.loading.page")})}),children:c.jsxs(dZ,{children:[c.jsx(Cr,{path:"/",element:c.jsx(rD,{to:"/chat",replace:!0})}),c.jsx(Cr,{path:"/chat",element:c.jsx(o4,{})}),c.jsx(Cr,{path:"/chat/:agentId",element:c.jsx(o4,{})}),c.jsx(Cr,{path:"/agents",element:c.jsx(tB,{})}),c.jsx(Cr,{path:"/agents/:agentId",element:c.jsx(tB,{})}),c.jsx(Cr,{path:"/settings",element:c.jsx(DZe,{})}),c.jsx(Cr,{path:"/agent-hub",element:c.jsx(TZe,{})}),c.jsx(Cr,{path:"/agent-hub/:agentId",element:c.jsx(kZe,{})}),c.jsx(Cr,{path:"/schedules",element:c.jsx(RZe,{})}),c.jsx(Cr,{path:"/projects",element:c.jsx(nB,{})}),c.jsx(Cr,{path:"/projects/:projectId",element:c.jsx(nB,{})}),c.jsx(Cr,{path:"/browser",element:c.jsx(AZe,{})}),v==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(Cr,{path:"/library",element:c.jsx(sB,{})}),c.jsx(Cr,{path:"/library/assets/:assetId",element:c.jsx(sB,{})})]}),m==="enabled"&&c.jsx(Cr,{path:"/mesh",element:c.jsx(FZe,{})}),c.jsx(Cr,{path:"*",element:c.jsx(rD,{to:"/chat",replace:!0})})]})})]})})]})})})};let Ao=null,$h=null,Og=null,zh=null,pS=null;const NZe={soundsArm:async()=>{if(Dh.getState().element)throw new Error("sounds safety: element already exists");if(Ao)throw new Error("sounds safety: graph already armed");return Ao=new AudioContext,await Ao.resume(),hZ(e=>{if(!Ao)throw new Error("sounds safety: no context");const t=Ao.createMediaElementSource(e);Og=Ao.createGain(),Og.gain.value=0,$h=Ao.createAnalyser(),zh=Ao.createAnalyser(),t.connect(zh),zh.connect(Og),Og.connect($h),$h.connect(Ao.destination)}),{armed:!0,contextState:Ao.state}},soundsFacts:()=>{const e=Dh.getState(),t=new Float32Array($h?.fftSize??32);$h?.getFloatTimeDomainData(t);const n=new Float32Array(zh?.fftSize??32);return zh?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Og?.gain.value??null,inputRms:zh?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:$h?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(ns.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(o,l)=>n.dispatchEvent(new PointerEvent(o,{pointerId:17,pointerType:"mouse",clientX:l,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;return n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction),new Promise(o=>requestAnimationFrame(()=>{const l=n.closest("[data-sound-player]")?.getAttribute("data-sound-status");pS=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},o({during:l,seconds:Dh.getState().element?.currentTime})}))},soundsScrubFinish:()=>(pS?.(),pS=null,{committed:!0}),soundsEnd:()=>{const e=Dh.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=Dh.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await uo(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-CJiOSzCX.js").then(i=>i.mg);return{fetchAttachmentBlob:r}},__vite__mapDeps([4,1,2,5,6,7]),import.meta.url),n=_e.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await NB.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Dh.getState().ownerId}}};function sd(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const MZe=3,OZe=3e3;function LZe(e){return e instanceof CSSTransition&&e.playState==="running"}function BZe(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${q0(n)??"an element no longer in the document"} = ${i}`}async function jZe(e=OZe){const t=performance.now();let n=0;for(;;){await sd();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(LZe);if(n=r.length===0?n+1:0,n>=MZe)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(BZe)}}}const HZe=/^#/;function Gm(){const e=window.location.hash.replace(HZe,"");return e===""?"/":e}function q0(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function UZe(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>q0(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:q0(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Lg(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function GZe(e,t=1e4){const n=Date.now();for(;Gm()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${Gm()})`);await new Promise(s=>setTimeout(s,50))}return await sd(),Gm()}const pT=["dev-driver","query-fetch-probe"];let Vm=null;function VZe(){if(Vm)return Vm;const e=[],t=iD.prototype.fetch;return iD.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
705
705
  `).slice(2).join(" | ")}),t.apply(this,s)},Vm=e,e}function WZe(e){const t=Vm??[],n=JSON.stringify(pT),s=t.filter(i=>i.key!==n&&(e===void 0||i.key.includes(e))),r=new Map;for(const i of s){const a=r.get(i.stack)??{key:i.key,count:0,firstAt:i.at,lastAt:i.at};a.count+=1,a.lastAt=i.at,r.set(i.stack,a)}return{armed:Vm!==null,total:s.length,probeRecords:t.filter(i=>i.key===n).length,callers:[...r.entries()].map(([i,a])=>({stack:i,...a})).sort((i,a)=>i.firstAt-a.firstAt)}}function $Ze(){const e=window.__loDevDriver;return e?.armed?e.install({...NZe,hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:Gm(),href:window.location.href,theme:qe.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:Ts.baseUrl,userAgent:navigator.userAgent}),filesFacts:()=>fZ(),state:()=>{const t=qe.getState(),n=_e.getState();return{route:Gm(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,rightSlotWidth:t.rightSlotWidth,rightSlotKey:t.rightSlotKey??null,rightSlotMemory:t.rightSlotMemory.map(([s,r])=>[s,r]),activeSessionId:n.activeSessionId,activeDraftKey:n.activeDraftKey,drafts:Object.fromEntries(Object.entries(n.drafts).map(([s,r])=>[s,{sessionId:r.sessionId??null,error:r.error!==void 0,undelivered:r.undelivered!==void 0,submitted:r.submittedText!==void 0,admissionAttempted:r.admissionAttempted===!0}])),sessionCount:n.sessions.length,cataloguePinnedCount:n.sessions.filter(s=>s.pinned===!0).length,cataloguePageable:n.cataloguePageable,catalogueActivityHead:n.catalogueActivityHead,scopes:Object.fromEntries(Object.entries(n.scopes).map(([s,r])=>[s,{ids:r.ids.length,nextCursor:r.nextCursor,loading:r.loading,error:r.error}])),countsTotal:n.counts?.total??null,archiveAttempts:n.answerSeq,archiveFailure:n.archiveFailure?{sessionId:n.archiveFailure.sessionId,archived:n.archiveFailure.archived}:null,onboardingVisible:!!document.querySelector("[data-onboarding-modal]")}},queries:()=>Pb.getQueryCache().getAll().map(t=>({key:JSON.stringify(t.queryKey),status:t.state.status,fetchStatus:t.state.fetchStatus,isLoading:t.state.status==="pending"&&t.state.fetchStatus==="fetching",error:t.state.error instanceof Error?t.state.error.message:null,hasData:t.state.data!==void 0,updatedAt:t.state.dataUpdatedAt,failureCount:t.state.fetchFailureCount,observers:t.getObserversCount()})),queryFetches:async t=>{const n=t??{};if(!n.arm)return WZe(n.key);const s=VZe(),r=JSON.stringify(pT),i=s.length;return await Pb.fetchQuery({queryKey:pT,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:s.slice(i).some(a=>a.key===r)}},navigate:async t=>{const n=Lg(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await GZe(n)}},setTheme:async t=>{const n=Lg(t,"theme name");qe.getState().setTheme(n),await sd();const s=document.documentElement.getAttribute("data-theme"),r=await jZe();return{theme:qe.getState().themeName,dataTheme:s,settledAfterMs:r.waitedMs,settleTimedOut:r.timedOut,settlePending:r.pending}},setSidebarWidth:async t=>{const n=Number(t?.width);if(!Number.isFinite(n))throw new Error("sidebar width must be a number");const s=Vee(n);return qe.getState().setChatSidebarWidth(s),await sd(),{width:qe.getState().chatSidebarWidth,clamped:s!==n}},measure:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Lg(n?.selector,"measure selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(d=>setTimeout(d,100))}const o=a.getBoundingClientRect(),l={x:Math.round(o.left+o.width/2),y:Math.round(o.top+o.height/2)},u=document.elementFromPoint(l.x,l.y);return{selector:s,target:q0(a),centre:l,rect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)},hitTest:u!==null&&(u===a||a.contains(u)),focused:a===document.activeElement,inViewport:o.top>=0&&o.left>=0&&o.bottom<=window.innerHeight&&o.right<=window.innerWidth}},press:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Lg(n?.selector,"press selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=UZe(a);return await sd(),{selector:s,target:q0(a),...o}},openCanvasDocument:async t=>{const n=t,s=Lg(n?.path,"canvas document path"),r=typeof n?.title=="string"?n.title:void 0,[i]=await window.api.probeFiles([s]);if(!i||!i.exists||!i.isFile)throw new Error(`no file at ${i?.resolved??s}`);const a=i.resolved??s,o=Lc(a,{title:r,type:Wf(a),availability:"present",sizeBytes:i.sizeBytes??void 0,lastAgentModified:i.mtimeMs??void 0,readMtimeMs:i.mtimeMs??void 0}),l=_C[Dd(a,o.type)??"code"];if(l==="utf-8"||l==="base64"){const h=await window.api.readFile(o.path,l);if(!h.success)throw new Error(`could not read ${o.path}`);o.content=h.data}const u=_e.getState(),d=HT(u.activeDraftKey,u.activeSessionId)??u.stageDraft();return qe.getState().setCanvasOpen(!0),ns.getState().addFileAndSelect(d,o),n?.mention===!0&&ns.getState().addMentionedFile(d,o),await sd(),{conversationId:d,documentId:o.id,readMtimeMs:o.readMtimeMs??null,contentLength:o.content.length,encoding:l}},stageLiveConsents:async t=>{const s=t?.count;if(typeof s!="number"||!Number.isInteger(s)||s<0)throw new Error(`stageLiveConsents count must be a non-negative integer (got ${JSON.stringify(s)})`);const r=Date.now();return Jle({tabs:[],activeTabId:null,url:"",title:"",loading:!1,canGoBack:!1,canGoForward:!1,pendingConsent:Array.from({length:s},(i,a)=>({entryId:`dev-driver-probe-${a+1}`,origin:`https://dev-driver-probe-${a+1}.example.com`,authority:`dev-driver-probe-${a+1}.example.com`,broad:null,expiresAt:r+10*6e4,requesterSessionId:null})),approvals:[],navFailure:null}),await sd(),{count:s}}}):[]}function zZe(){const e=g.useMemo(wT,[]),t=g.useRef(null);return g.useEffect(()=>{const n=window.api?.miniView;if(!n?.onRegistration)return;let s=!1;const r=a=>{if(s)return;const o=t.current;if(t.current=a.status,o===null||a.status===o||a.status==="registered")return;const l=Wee(a.value,e);qt(pZ(a.status,l))};n.getRegistration?.()?.then(r)?.catch(()=>{});const i=n.onRegistration(r);return()=>{s=!0,i?.()}},[e]),null}const qZe=`
706
706
  /*
707
707
  * A transition declared on ::-webkit-scrollbar-thumb does not animate in