clay-server 5.5.0 → 5.5.1-beta.1

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 (37) hide show
  1. package/lib/public/modules/app-messages.js +4 -3
  2. package/lib/public/modules/sidebar-sessions.js +45 -0
  3. package/lib/public/modules/sidebar.js +12 -0
  4. package/lib/public/modules/split-session-boundary.js +11 -1
  5. package/lib/public/pane-assets/{app-BNMUDWD5.js → app-EYGYCM2T.js} +1 -1
  6. package/lib/public/pane-assets/{chunk-D2BDBUG5.js → chunk-2JXAANCI.js} +1 -1
  7. package/lib/public/pane-assets/chunk-4MBLPK54.js +1 -0
  8. package/lib/public/pane-assets/chunk-546IPPXQ.js +1 -0
  9. package/lib/public/pane-assets/chunk-6TSFZ4FL.js +1 -0
  10. package/lib/public/pane-assets/{chunk-B4JTSONS.js → chunk-C2FSPTQF.js} +1 -1
  11. package/lib/public/pane-assets/{chunk-HY74JLC5.js → chunk-F7KXA6MA.js} +1 -1
  12. package/lib/public/pane-assets/{chunk-FWEHZLDA.js → chunk-GSFLTR5F.js} +1 -1
  13. package/lib/public/pane-assets/{chunk-FDZ37JGF.js → chunk-JFPKTZNT.js} +93 -93
  14. package/lib/public/pane-assets/{chunk-ULGL2YFP.js → chunk-LYYAXURP.js} +1 -1
  15. package/lib/public/pane-assets/{chunk-YXTZSYUM.js → chunk-M3R7EZRU.js} +1 -1
  16. package/lib/public/pane-assets/{chunk-FA454EFE.js → chunk-MACWHBDE.js} +1 -1
  17. package/lib/public/pane-assets/{chunk-ENPPQJSX.js → chunk-MIY5SZAA.js} +1 -1
  18. package/lib/public/pane-assets/{chunk-ZY4WB3PH.js → chunk-NNR4GHCN.js} +1 -1
  19. package/lib/public/pane-assets/{chunk-AF5TDQTT.js → chunk-OAAIBT72.js} +1 -1
  20. package/lib/public/pane-assets/chunk-PP5WRIOP.js +1 -0
  21. package/lib/public/pane-assets/{chunk-LH46GC2K.js → chunk-SMMJMW5H.js} +1 -1
  22. package/lib/public/pane-assets/chunk-T2H4XKIR.js +1 -0
  23. package/lib/public/pane-assets/{chunk-U3KC4P2F.js → chunk-VDPYWAHD.js} +1 -1
  24. package/lib/public/pane-assets/{chunk-4FKXTJ6O.js → chunk-WT5P53UH.js} +1 -1
  25. package/lib/public/pane-assets/{chunk-WI3BTTUY.js → chunk-YEKR6TQM.js} +1 -1
  26. package/lib/public/pane-assets/chunk-YHEALGET.js +1 -0
  27. package/lib/public/pane-assets/{chunk-SQC7XIGG.js → chunk-YM5Z4AR6.js} +1 -1
  28. package/lib/public/pane-assets/chunk-ZJF5GGAU.js +1 -0
  29. package/lib/public/pane-assets/manifest.json +400 -400
  30. package/package.json +1 -1
  31. package/lib/public/pane-assets/chunk-3EA7GMQB.js +0 -1
  32. package/lib/public/pane-assets/chunk-4WIT6JEU.js +0 -1
  33. package/lib/public/pane-assets/chunk-A5YYSG4B.js +0 -1
  34. package/lib/public/pane-assets/chunk-ENWMPEO2.js +0 -1
  35. package/lib/public/pane-assets/chunk-PDHV6Q3E.js +0 -1
  36. package/lib/public/pane-assets/chunk-TIEOZRO2.js +0 -1
  37. package/lib/public/pane-assets/chunk-W3KJANR2.js +0 -1
@@ -830,9 +830,10 @@ export function processMessage(msg) {
830
830
  break;
831
831
 
832
832
  case "split_groups":
833
- applyProjectSplitGroups(msg.groups || []);
834
- renderSessionList(null);
835
- syncPaneTitles();
833
+ if (applyProjectSplitGroups(msg.groups || [])) {
834
+ renderSessionList(null);
835
+ syncPaneTitles();
836
+ }
836
837
  maybeRestoreSplitGroup();
837
838
  break;
838
839
 
@@ -986,6 +986,40 @@ function sessionRenderFingerprint(sessions) {
986
986
  }
987
987
  }
988
988
 
989
+ var lastStructureFingerprint = null;
990
+
991
+ // Fields that move on nearly every server frame without changing the sidebar's
992
+ // structure: lastActivity orders the list and feeds a tooltip, unread lives in
993
+ // badges that updateSessionBadge can patch in place. The relative activity
994
+ // order stays part of the fingerprint so a reordering frame still rebuilds.
995
+ function sessionStructureFingerprint(sessions) {
996
+ try {
997
+ var order = sessions.slice().sort(function (a, b) {
998
+ return (b.lastActivity || 0) - (a.lastActivity || 0) || (a.id - b.id);
999
+ }).map(function (s) { return s.id; });
1000
+ var stripped = sessions.map(function (s) {
1001
+ var copy = Object.assign({}, s);
1002
+ delete copy.lastActivity;
1003
+ delete copy.unread;
1004
+ return copy;
1005
+ });
1006
+ return JSON.stringify([stripped, order, store.get('splitGroups') || [], store.get('splitPanes') || null]);
1007
+ } catch (e) {
1008
+ return null;
1009
+ }
1010
+ }
1011
+
1012
+ function applyVolatileSessionUpdates(sessions) {
1013
+ for (var i = 0; i < sessions.length; i++) {
1014
+ var s = sessions[i];
1015
+ updateSessionBadge(s.id, s.unread || 0);
1016
+ var activityTitle = formatSessionActivity(s.lastActivity);
1017
+ if (!activityTitle) continue;
1018
+ var titleEls = document.querySelectorAll('.session-item[data-session-id="' + s.id + '"] .session-item-title');
1019
+ for (var t = 0; t < titleEls.length; t++) titleEls[t].title = activityTitle;
1020
+ }
1021
+ }
1022
+
989
1023
  export function renderSessionList(sessions) {
990
1024
  // Pane activation consumes this exact list, but its sidebar is parent-owned.
991
1025
  // Avoid building every hidden session/folder/Worker row in each iframe.
@@ -995,6 +1029,16 @@ export function renderSessionList(sessions) {
995
1029
  // rebuilding the sidebar for an identical frame is what made it flicker.
996
1030
  var incoming = sessionRenderFingerprint(sessions);
997
1031
  if (incoming !== null && incoming === lastRenderFingerprint) return;
1032
+ // A frame that only moves volatile fields must not rebuild the DOM either:
1033
+ // replacing the hovered row drops its CSS :hover until the pointer moves,
1034
+ // so the row's action icons flash whenever any session is streaming.
1035
+ var structure = sessionStructureFingerprint(sessions);
1036
+ if (structure !== null && structure === lastStructureFingerprint) {
1037
+ cachedSessions = sessions;
1038
+ applyVolatileSessionUpdates(sessions);
1039
+ lastRenderFingerprint = incoming;
1040
+ return;
1041
+ }
998
1042
  cachedSessions = sessions;
999
1043
  }
1000
1044
 
@@ -1143,6 +1187,7 @@ export function renderSessionList(sessions) {
1143
1187
  // Recorded from the sessions actually rendered, so a null-argument re-render
1144
1188
  // driven by other state refreshes the fingerprint rather than stranding it.
1145
1189
  lastRenderFingerprint = sessionRenderFingerprint(cachedSessions);
1190
+ lastStructureFingerprint = sessionStructureFingerprint(cachedSessions);
1146
1191
  }
1147
1192
 
1148
1193
  // --- Search results ---
@@ -299,12 +299,23 @@ export function initSidebar(_ctx) {
299
299
  syncUserIslandWidth();
300
300
  }
301
301
 
302
+ // The column animates width changes (transition: width .2s). A drag must
303
+ // bypass that: an animated width lags the cursor, and syncResizeHandle
304
+ // would read mid-animation geometry, drifting the handle away from the
305
+ // pointer. The saved-width restore below already does the same.
306
+ function setResizeTransitions(value) {
307
+ sidebarColumn.style.transition = value;
308
+ var mateColumn = document.getElementById("mate-sidebar-column");
309
+ if (mateColumn) mateColumn.style.transition = value;
310
+ }
311
+
302
312
  function onResizeEnd() {
303
313
  if (!dragging) return;
304
314
  dragging = false;
305
315
  resizeHandle.classList.remove("dragging");
306
316
  document.body.style.cursor = "";
307
317
  document.body.style.userSelect = "";
318
+ setResizeTransitions("");
308
319
  document.removeEventListener("mousemove", onResizeMove);
309
320
  document.removeEventListener("mouseup", onResizeEnd);
310
321
  document.removeEventListener("touchmove", onResizeMove);
@@ -318,6 +329,7 @@ export function initSidebar(_ctx) {
318
329
  resizeHandle.classList.add("dragging");
319
330
  document.body.style.cursor = "col-resize";
320
331
  document.body.style.userSelect = "none";
332
+ setResizeTransitions("none");
321
333
  document.addEventListener("mousemove", onResizeMove);
322
334
  document.addEventListener("mouseup", onResizeEnd);
323
335
  document.addEventListener("touchmove", onResizeMove, { passive: false });
@@ -43,7 +43,17 @@ export function markProjectSessionListHydrated() {
43
43
  if (slug) store.set({ sessionListProjectSlug: slug });
44
44
  }
45
45
 
46
+ // Returns whether anything changed so callers can skip a sidebar rebuild for
47
+ // a repeated, identical broadcast (a rebuild drops the hovered row's :hover).
46
48
  export function applyProjectSplitGroups(groups) {
47
49
  var slug = store.get('activeProjectSlug');
48
- store.set({ splitGroups: groups || [], splitGroupsProjectSlug: slug || null });
50
+ var next = groups || [];
51
+ var nextSlug = slug || null;
52
+ if (store.get('splitGroupsProjectSlug') === nextSlug) {
53
+ try {
54
+ if (JSON.stringify(store.get('splitGroups') || []) === JSON.stringify(next)) return false;
55
+ } catch (e) {}
56
+ }
57
+ store.set({ splitGroups: next, splitGroupsProjectSlug: nextSlug });
58
+ return true;
49
59
  }
@@ -1 +1 @@
1
- import{$ as En,$a as Zn,$b as Or,$c as xo,A as rn,Aa as Fn,Ab as Ae,B as on,Ba as Hn,Bb as Be,Bc as rt,Bd as he,Ca as qn,Cb as wr,Cc as so,Da as Vn,Db as kr,Dc as lo,Ea as Wn,Eb as Cr,Ec as co,F as an,Fa as zn,Fb as Mr,Fc as uo,G as sn,Ga as Gn,Gb as Er,Gc as fo,H as ln,Ha as Kn,Hb as Pr,Hc as po,I as dn,Ib as Ir,Ic as mo,J as cn,Jb as xr,Jc as go,K as un,Kc as ho,L as fn,Lc as vo,M as pn,Mc as bo,Md as _o,N as F,Nb as me,Nc as yo,O as mn,Oc as So,P as gn,Pc as wo,Q as H,Qc as ko,Qd as No,R as hn,Rb as Lr,Rc as Co,S as vn,Sa as Yn,Sb as Tr,Sc as Mo,Sd as Oo,T as bn,Tb as Rr,U as yn,Ub as Dr,Ud as Fo,V as Sn,Vb as Ar,Vd as Ho,W as wn,Wb as Br,Wc as Eo,X as kn,Xa as Jn,Xb as jr,Xc as Po,Y as Cn,Ya as Qn,Yb as Ur,Yc as ne,Z as De,Za as $n,Zb as _r,Zc as re,_ as Mn,_a as Xn,_b as Nr,_c as Io,a as Ft,aa as Pn,ab as er,ac as Fr,ad as Lo,ae as qo,b as Ht,ba as In,bb as tr,bc as Hr,bd as To,c as qt,ca as xn,cb as nr,cc as qr,cd as Ro,d as Vt,da as Ln,db as et,dc as Vr,e as Wt,ea as Tn,eb as rr,ec as Wr,f as zt,fa as Rn,fb as or,fc as zr,g as Gt,ga as Dn,gb as te,gc as Gr,h as Kt,ha as An,hb as ar,hc as Kr,i as Yt,ia as Bn,ib as ir,ic as Yr,j as Jt,ja as jn,jb as sr,k as Qt,ka as Un,kb as lr,l as $t,la as _n,lb as dr,m as Xt,ma as Nn,mb as cr,mc as Jr,na as Ze,nb as ur,nc as Qr,oa as On,ob as fr,oc as $r,pb as pr,pc as Xr,qb as mr,qc as Zr,qd as Do,rb as tt,rc as eo,rd as Ao,sc as to,sd as Bo,t as Qe,tb as gr,tc as no,td as jo,ub as hr,uc as ro,v as Zt,vb as vr,vc as oo,vd as Ue,wb as br,wc as ao,x as en,xb as yr,xc as ge,xd as ot,y as $e,yb as nt,yc as io,yd as Uo,z as Xe,zb as Sr,zc as je}from"./chunk-FDZ37JGF.js";import"./chunk-LH46GC2K.js";import"./chunk-YHBTK56T.js";import{g as tn}from"./chunk-YXTZSYUM.js";import{h as nn}from"./chunk-B4JTSONS.js";import{A as Ot,a as jt,b as Ut,f as _t,w as Je,x as Nt}from"./chunk-WI3BTTUY.js";import{a as w}from"./chunk-R7QVVFUG.js";import{d as D,e as ee}from"./chunk-D2BDBUG5.js";import{c as Bt,d as o}from"./chunk-EGCR2MH4.js";var ve=[];function at(){var e=o.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(o.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=o.snap(),r=n.paneDeferredBootstrap;if(r){var a=r.jobs.slice(),s=n.connected&&n.paneReady&&!n.paneSuspended?a.shift():null;o.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:a})});try{if(s!==null&&ve[s]){var i=ve[s];ve[s]=null,i()}}finally{at()}}},0))}function _e(e){if(!o.get("paneMode")){e.forEach(function(n){n()});return}var t=o.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},o.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&at()})),o.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ve.length;return ve.push(n),r}))})}),at()}function Vo(){Ot(),_t(),window.addEventListener("message",function(e){var t=e.data;if(e.origin===location.origin&&t&&t.type==="clay-studio-document-update"&&t.message){var n=Ut(t.message.path);n&&n.source===e.source&&n.descriptor.token===t.token&&qo(t.message,n);return}!t||["clay-pane-present-markdown","clay-pane-present-wireframe"].indexOf(t.type)<0||!t.message||!t.message.controlPresentation||!Je(e,t)||!Nt(e,t)||(t.type==="clay-pane-present-markdown"?(jt(e,t,Je(e,t)),Fo(t.message)):nn(t.message))})}var si="(max-width: 768px)",li=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],di=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function Wo(e){var t=document.querySelector("#main-column > .title-bar-content .status"),n=document.querySelector("#top-bar .top-bar-actions"),r=document.getElementById("notif-center-btn");if(!(!t||!n))for(var a=e?li:di,s=0;s<a.length;s++){var i=document.getElementById(a[s]);i&&(e?t.appendChild(i):n.insertBefore(i,r))}}var ci=150,oe=24,be=12,zo=null;function Go(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function Ko(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),a=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!a)&&t.offsetWidth&&!(!e&&zo===Go(t,n,r))&&getComputedStyle(a).display!=="none"){for(var s=[[],["usage-compact"],["usage-compact","usage-compact-link"]],i=null,l=0;l<s.length&&!i;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),s[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var c=t.getBoundingClientRect().width,d=c/2,u=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-u,m=r.getBoundingClientRect().left-u,v=Math.min(d-p,m-d)-be,y=Math.min(520,c*.4);if(2*v>=ci)i={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(m-p>=oe+2*be){var M=p+be+oe/2,E=m-be-oe/2;i={mode:"icon",width:oe,left:Math.min(Math.max(d,M),E),level:l}}}i||(i={mode:"icon",width:oe,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+be+oe/2,0),level:s.length-1}),t.classList.toggle("search-icon",i.mode==="icon"),i.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(i.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(i.left)+"px"),zo=Go(t,n,r)}}function ui(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(a){t||(t=!0,requestAnimationFrame(function(){t=!1,Ko(a===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(a){var s=e.querySelector(a);s&&r.observe(s)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),Ko(!0)}}function fi(){var e=document.querySelector("#main-column > .title-bar-content"),t=document.getElementById("top-bar");if(!(!e||!t)){var n=function(){t.classList.toggle("title-bar-hidden",e.classList.contains("hidden"))};n(),new MutationObserver(n).observe(e,{attributes:!0,attributeFilter:["class"]})}}function Yo(){var e=window.matchMedia(si);Wo(e.matches),e.addEventListener("change",function(){Wo(e.matches)}),fi(),ui()}var $o={},st={},I=null,B=null,j=null,Xo=0,Zo=[],Ne={},lt=null;function Jo(e){$o[e.id]=e}function it(e,t){st[e]=t}function ea(e,t){var n=$o[e];n&&(j=n,Xo=0,Zo=[],lt=t||null,pi(),Oe(n.steps[0].id),B.classList.remove("hidden"),I.classList.remove("hidden"),setTimeout(function(){I.focus()},50))}function ye(){B&&B.classList.add("hidden"),I&&I.classList.add("hidden");var e=lt;j=null,lt=null,e&&e()}function ta(){gi(),hi()}function pi(){I||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&ye()}),I=document.createElement("div"),I.className="playbook-modal hidden",I.setAttribute("tabindex","-1"),I.addEventListener("keydown",function(e){e.key==="Escape"&&ye()}),B.appendChild(I),document.body.appendChild(B))}function Oe(e){if(j){for(var t=null,n=0,r=0;r<j.steps.length;r++)if(j.steps[r].id===e){t=j.steps[r],n=r;break}if(t){if(Xo=n,Zo.push(e),t.condition&&t.branches){var a=t.condition(),s=t.branches[a]||t.branches.default;if(s){Oe(s);return}}mi(t)}}}function mi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,a=0,s=0;s<t.steps.length;s++)t.steps[s].condition||(a++,t.steps[s].id===e.id&&(r=a));var i="";i+='<div class="playbook-header">',i+='<div class="playbook-header-left">',i+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",i+='<span class="playbook-title">'+ae(t.title)+"</span>",i+="</div>",i+='<button class="playbook-close" title="Close">&times;</button>',i+="</div>",i+='<div class="playbook-progress">';for(var l=0;l<n;l++){var c="playbook-progress-dot";l+1<r?c+=" done":l+1===r&&(c+=" active"),i+='<span class="'+c+'"></span>'}i+="</div>",i+='<div class="playbook-body">',i+='<h2 class="playbook-step-title">'+ae(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(i+='<div class="playbook-step-body">'+d+"</div>",e.note&&(i+='<div class="playbook-step-note">'+ae(e.note)+"</div>"),i+="</div>",e.actions&&e.actions.length>0){i+='<div class="playbook-actions">';for(var u=0;u<e.actions.length;u++){var p=e.actions[u],m="playbook-btn";u===0?m+=" playbook-btn-primary":m+=" playbook-btn-secondary",i+='<button class="'+m+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+ae(p.label)+"</button>"}i+="</div>"}I.innerHTML=i,D();var v=I.querySelector(".playbook-close");v&&v.addEventListener("click",ye);for(var y=I.querySelectorAll(".playbook-btn"),M=0;M<y.length;M++)(function(k){k.addEventListener("click",function(){var A=k.dataset.action,h=k.dataset.next;A&&st[A]?(k.disabled=!0,k.textContent+="...",st[A](function(){h?Oe(h):(Qo(j.id),ye())})):h?Oe(h):(Qo(j.id),ye())})})(y[M]);for(var E=I.querySelectorAll("[data-copy-url]"),P=0;P<E.length;P++)(function(k){k.addEventListener("click",function(A){A.stopPropagation();var h=k.dataset.copyUrl;navigator.clipboard.writeText(h).then(function(){k.textContent="Copied!",setTimeout(function(){k.textContent="Copy"},1500)})})})(E[P])}function Qo(e){Ne[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(Ne))}catch{}}function gi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");Ne=e||{}}catch{Ne={}}}function hi(){if(Jo({id:"push-notifications",title:"Push Notifications",icon:"\u{1F514}",description:"Get notified when Claude finishes a long task",tipMatch:function(t){return t.indexOf("Push notification")!==-1},steps:[{id:"intro",title:"Never miss a response",body:"When Claude is working on a long task, you can walk away and get a push notification the moment it's done. Works even when Clay is in the background.",actions:[{label:"Enable notifications",action:"notif_request",next:"check_perm"},{label:"Not now",next:""}]},{id:"check_perm",condition:function(){return typeof Notification>"u"?"unsupported":Notification.permission},branches:{granted:"test",denied:"denied",default:"denied",unsupported:"unsupported"}},{id:"test",title:"Let's test it!",body:"Click below to send a test notification. You should see it pop up from your system.",actions:[{label:"Send test notification",action:"notif_test",next:"check_test"},{label:"Skip",next:"done"}]},{id:"check_test",title:"Did you see it?",body:"A notification should have appeared from your system just now.",actions:[{label:"Yes, it worked!",next:"done"},{label:"No, nothing appeared",next:"troubleshoot"}]},{id:"troubleshoot",title:"Troubleshooting",body:function(){var t=navigator.platform&&navigator.platform.indexOf("Mac")!==-1,n="your browser",r=navigator.userAgent||"";r.indexOf("Arc")!==-1?n="Arc":r.indexOf("Edg/")!==-1?n="Edge":r.indexOf("Firefox")!==-1?n="Firefox":r.indexOf("Chrome")!==-1?n="Chrome":r.indexOf("Safari")!==-1&&(n="Safari");var a=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",s="The browser says permission is granted, but the notification didn't show.<br><br>";return a&&(s+="\u{1F512} <strong>Untrusted certificate?</strong><br>If you're using a self-signed or untrusted TLS certificate, some browsers silently block notifications even on HTTPS.<br>Run <strong>mkcert -install</strong> on the server to trust the root CA, or add the certificate to your system keychain as trusted.<br><br>"),s+="<strong>Also check your OS notification settings:</strong><br>",t?s+="<strong>1.</strong> Open <strong>System Settings \u2192 Notifications</strong><br><strong>2.</strong> Find <strong>"+n+"</strong> in the list<br><strong>3.</strong> Make sure <strong>Allow Notifications</strong> is turned on<br><strong>4.</strong> Check that <strong>Do Not Disturb</strong> / Focus mode is off<br>":s+="<strong>1.</strong> Make sure notifications are enabled for <strong>"+n+"</strong><br><strong>2.</strong> Check that Do Not Disturb / Focus mode is off<br>",s+="<br>After adjusting, come back and try again.",s},actions:[{label:"Try again",action:"notif_test",next:"check_test"},{label:"I'll fix it later",next:"done"}]},{id:"denied",title:"Permission needed",body:function(){var t=!window.isSecureContext||location.protocol==="http:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1"&&location.hostname!=="[::1]";if(t)return"\u26A0\uFE0F <strong>Insecure context detected.</strong><br><br>Notifications require a <strong>secure context</strong> (HTTPS or localhost). You're accessing Clay over <strong>"+location.protocol+"//"+location.hostname+"</strong>, so the browser automatically blocks notifications.<br><br><strong>How to fix:</strong><br><strong>1.</strong> Access Clay via <strong>https://</strong> (set up a TLS certificate)<br><strong>2.</strong> Or access via <strong>localhost:"+location.port+"</strong> instead of an IP address<br>";var n="chrome://settings/content/notifications",r=navigator.userAgent||"";return r.indexOf("Firefox")!==-1?n="about:preferences#privacy":r.indexOf("Edg/")!==-1?n="edge://settings/content/notifications":r.indexOf("Arc")!==-1&&(n="arc://settings/content/notifications"),'Your browser blocked the notification permission.<br><br><strong>1.</strong> Click the lock icon in the address bar<br><strong>2.</strong> Find "Notifications" and set it to "Allow"<br><strong>3.</strong> Reload the page<br><br>Or paste this into your address bar:<br><div style="display:flex;align-items:center;gap:6px;margin-top:6px"><code style="font-size:12px;color:var(--accent);flex:1;user-select:all">'+n+'</code><button class="playbook-btn-secondary" style="padding:3px 8px;font-size:11px" data-copy-url="'+n+'">Copy</button></div>'},actions:[{label:"Got it",next:""}]},{id:"unsupported",title:"Not supported",body:"Your browser doesn't support notifications. Try Chrome, Edge, or Firefox for the best experience.",actions:[{label:"Got it",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"You'll now get a notification whenever Claude finishes processing. This works even when Clay is minimized or in another tab.",note:"You can toggle notifications anytime from the header bar.",actions:[{label:"Done",next:""}]}]}),it("notif_request",function(t){if(typeof Notification>"u"){t();return}Notification.requestPermission().then(function(n){if(n==="granted")try{localStorage.setItem("notif-alert","1");var r=document.getElementById("notif-toggle-alert");r&&(r.checked=!0)}catch{}t()}).catch(function(){t()})}),it("notif_test",function(t){if(typeof Notification>"u"){t();return}if(Notification.permission!=="granted"){Notification.requestPermission().then(function(n){n==="granted"?e(t):t()}).catch(function(){t()});return}e(t)}),location.protocol==="https:"){let t=function(){var a=navigator.userAgent||"",s=navigator.platform||"";return s.indexOf("Mac")!==-1||a.indexOf("Mac")!==-1?"mac":s.indexOf("Win")!==-1||a.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var a=t(),s="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return a==="mac"?(s+="<strong>macOS \u2014 run in Terminal:</strong><br>",s+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):a==="windows"?(s+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",s+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(s+="<strong>Linux \u2014 run in terminal:</strong><br>",s+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),s+='<br><div style="padding:8px 10px;background:var(--bg-deeper);border-radius:6px;border-left:3px solid var(--accent)"><strong style="font-size:11px">Or ask Claude Code:</strong><br><code style="font-family:monospace;font-size:12px;line-height:1.5;color:var(--text-secondary)">Install ~/Downloads/clay-ca.pem as a trusted root certificate</code></div>',s+="<br>Then <strong>restart your browser</strong> to apply the change.",s},r=function(a){return'<div style="margin-top:8px;position:relative;background:var(--bg-deeper);border-radius:6px;padding:8px 10px"><code style="display:block;font-family:monospace;font-size:12px;word-break:break-all;line-height:1.5;padding-right:50px">'+ae(a)+'</code><button class="playbook-btn-secondary" style="position:absolute;top:8px;right:8px;padding:2px 8px;font-size:11px;white-space:nowrap" data-copy-url="'+ae(a)+'">Copy</button></div>'};Jo({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(a){return a.indexOf("certificate")!==-1||a.indexOf("Certificate")!==-1},steps:[{id:"intro",title:"Getting certificate warnings?",body:"Clay generates a local CA certificate for secure HTTPS connections. Your browser may show warnings until you install and trust this certificate on your device.",actions:[{label:"Download certificate",action:"cert_download",next:"install"},{label:"Not now",next:""}]},{id:"install",title:"Install the certificate",body:n,actions:[{label:"Done, I installed it",next:"done"},{label:"I'll do it later",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"After restarting your browser, certificate warnings should disappear. If you still see them, make sure you ran the terminal command with admin privileges.",actions:[{label:"Done",next:""}]}]}),it("cert_download",function(a){var s=document.createElement("a");s.href="/ca/download",s.download="clay-ca.pem",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(a,500)})}function e(t){try{var n=new Notification("Clay",{body:"Notifications are working! \u{1F389}",tag:"clay-test-"+Date.now()});n.onclick=function(){window.focus(),n.close()},setTimeout(function(){try{n.close()}catch{}},5e3)}catch(r){console.warn("[Playbook] Notification failed:",r)}setTimeout(t,800)}}function ae(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function na(e){var t=document.createElement("span");t.className="stt-meter",t.setAttribute("aria-hidden","true");var n=document.createElement("canvas");t.appendChild(n);var r=n.getContext("2d"),a=null,s=0,i=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function c(d){a=null;var u=o.get("speechActive");if(!(!u||u.id!==e||!t.isConnected||!r)&&(a=requestAnimationFrame(c),!(d-s<(l?100:32)))){s=d;var p=t.clientWidth,m=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(m*v))&&(n.width=Math.round(p*v),n.height=Math.round(m*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,m);var y=getComputedStyle(t),M=r.createLinearGradient(0,0,p,0);M.addColorStop(0,y.getPropertyValue("--brand-green").trim()||y.color),M.addColorStop(.5,y.getPropertyValue("--brand-blue").trim()||y.color),M.addColorStop(1,y.getPropertyValue("--brand-green").trim()||y.color),r.fillStyle=M;for(var E=u.audioSignal,P=E?E.levels:[],k=E?Date.now()-E.updatedAt:0,A=Math.max(0,1-Math.max(0,k-250)/900),h=Math.max(2,Math.floor(p/4)),b=Math.round(Math.min(160,Math.max(80,h))*1.25),R=l?0:Math.min(1,k/20),S=0;S<h;S++){var _=P.length-b+S/(h-1)*(b-1)+R,N=Math.floor(_),Le=_-N,Q=P[N]||0,Te=P[Math.min(N+1,P.length-1)]||0,$=(Q+(Te-Q)*Le)*A,O=i[S]||0,X=l?$:O+($-O)*($>O?.5:.24);i[S]=X;for(var G=1+X*(m*.46-1),Re=Math.min(1,(S+1)/8,(h-S)/8),Z=0;Z<=m*.48;Z+=3.2){var Ye=Math.exp(-Math.pow(Z/G,2)*1.7);if(!(Ye<.035)){var At=.35+Ye*.65;r.globalAlpha=(.12+Ye*.78)*Re,r.beginPath(),r.arc((S+.5)*p/h,m/2+Z,At,0,Math.PI*2),r.fill(),Z&&(r.beginPath(),r.arc((S+.5)*p/h,m/2-Z,At,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&a===null&&(a=requestAnimationFrame(c)),!d&&a!==null&&(cancelAnimationFrame(a),a=null,i=[])}}}function ra(e,t,n){var r=document.getElementById(e),a=document.getElementById(t),s=document.getElementById(n);if(!r||!a||!s||r.dataset.speechBound)return;var i=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||s,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||i;r.addEventListener("click",Fe),r.dataset.speechBound="true",r.classList.add("stt-button");var c=document.createElement("span");c.className="stt-controls",r.before(c),c.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=ee("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",c.appendChild(d),d.addEventListener("click",function(){Fe(),Be(d)});var u=document.createElement("div");u.className="stt-progress",u.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var m=document.createElement("span");m.className="stt-timer",m.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=ee("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){te(),o.set({speechRetry:null})});var y=na(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",dr);var E=document.createElement("a");E.textContent="Provider account",E.target="_blank",E.rel="noopener noreferrer";var P=document.createElement("button");P.type="button",P.textContent="Dismiss",P.addEventListener("click",function(){or(e,"")}),u.append(v,y.element,m,p,M,E,P),i.prepend(u),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=o.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?lr():te();return}var b=nt(),R=o.get("speechSettings");if(b.provider==="browser"&&!et().available){Be(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){Be(d);return}b.provider==="browser"?ar(e,a):sr(e,a,b)}),a.addEventListener("beforeinput",function(){var h=o.get("speechActive");h&&h.id===e&&te("Voice input stopped so you can edit your draft."),o.set({speechRetry:null})}),a.addEventListener("input",function(){var h=o.get("speechActive");h&&h.id===e&&!h.writing&&te()});function k(){var h=o.get("speechActive"),b=!!h&&h.id===e,R=nt(),S=Sr(R.provider),_=R.provider==="browser"?o.get("speechBrowserIdentity"):null,N=b&&h.model&&h.phase!=="recording",Le=b&&!!h.autoSend;i.classList.toggle("stt-recording",b),u.classList.toggle("stt-auto-send",Le),u.classList.toggle("stt-progress-active",b),u.classList.toggle("stt-progress-pending",!!N);var Q=b?l:i;(u.parentElement!==Q||u!==Q.firstElementChild)&&Q.prepend(u),y.update(b?h:null),d.hidden=b,r.disabled=a.disabled||a.readOnly||!o.get("speechSettings"),d.disabled=a.disabled||a.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var Te=b?Le?"Cancel pending voice send":N?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",Te+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=Te+" \xB7 "+R.name;var $=[b,N,S&&S.id,_&&_.id].join(":");if(r.dataset.speechIcon!==$){if(r.dataset.speechIcon=$,r.innerHTML=ee(b?N?"x":"square":"mic"),!b&&(S||_&&_.icon)){var O=document.createElement("img");O.className="stt-vendor-badge",O.src=S?S.icon:_.icon,O.alt="",r.appendChild(O)}D()}var X=(o.get("speechStatuses")||{})[e]||"",G=(o.get("speechErrors")||{})[e];u.classList.toggle("stt-progress-error",!!G),p.setAttribute("role",G?"alert":"status"),P.hidden=!G,E.hidden=!G||!S,S&&(E.href=S.url),R.provider==="browser"&&!rr()&&(X="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(X="Voice input requires a secure HTTPS connection."),p.textContent=X,m.textContent=b&&h.startTime?Math.floor((Date.now()-h.startTime)/6e4)+":"+String(Math.floor((Date.now()-h.startTime)/1e3)%60).padStart(2,"0"):"",v.hidden=!b;var Re=o.get("speechRetry");M.hidden=!Re||Re.id!==e,u.hidden=!b&&!G&&M.hidden}o.subscribe(k);var A=new MutationObserver(k);A.observe(a,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function Fe(){o.set({speechBrowserIdentity:et()})}function oa(){Fe(),window.addEventListener("focus",Fe),ir(),wr(),ra("stt-btn","input","input-wrapper"),ra("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Ae(),window.addEventListener("focus",Ae);try{window.top.document.addEventListener("clay:speech-settings-saved",Ae)}catch{}}var g=null,T=null,Se=null;function we(){return document.body.dataset.myDisplayName||"Clay user"}function se(e){if(g){var t=g.querySelector("#account-ai-section");t&&Cr(t),g.remove(),g=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+we()),document.removeEventListener("pointerdown",aa),document.removeEventListener("focusin",ia),document.removeEventListener("keydown",sa),window.removeEventListener("resize",ie),o.set({defaultAiInlineEditing:!1}),e&&Se&&document.contains(Se)&&Se.focus({preventScroll:!0}),Se=null}}function ut(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function aa(e){!g||g.contains(e.target)||T.contains(e.target)||ut(e.target)||se(!1)}function ia(e){!g||g.contains(e.target)||T.contains(e.target)||ut(e.target)||se(!1)}function sa(e){e.key==="Escape"&&(ut(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),se(!0)))}function ie(){if(!(!g||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));g.style.width=t+"px",g.style.left=n+"px",g.style.top=Math.max(12,e.top-g.offsetHeight-8)+"px"}}function dt(e){var t=g&&g.querySelector(".account-identity-copy");t&&(t.innerHTML='<button type="button" id="account-name-edit" class="account-name-display"><span></span><i data-lucide="pencil" aria-hidden="true"></i></button><small>Personal account</small>',t.querySelector("span").textContent=we(),t.querySelector("#account-name-edit").addEventListener("click",vi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function vi(){var e=g&&g.querySelector(".account-identity-copy");if(e){var t=document.createElement("input");t.id="account-profile-name",t.setAttribute("aria-label","Display name"),t.className="account-name-input",t.type="text",t.maxLength=50,t.autocomplete="name",t.value=o.get("accountNameDraft")===void 0?tt().name||"":o.get("accountNameDraft"),t.addEventListener("input",function(){o.set({accountNameDraft:t.value})}),e.innerHTML="",e.appendChild(t);var n=document.createElement("small");n.textContent="Enter to save \xB7 Escape to cancel",e.appendChild(n),t.addEventListener("keydown",function(r){r.key==="Enter"?(r.preventDefault(),t.disabled=!0,n.textContent="Saving\u2026",cr({name:t.value.trim()}).then(function(){o.set({accountNameDraft:void 0}),dt(!0)}).catch(function(a){t.disabled=!1,n.textContent=a.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),o.set({accountNameDraft:void 0}),dt(!0)),r.stopPropagation()}),t.focus(),t.select()}}function bi(){var e=g&&g.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),ie())}function yi(){var e=g.querySelector("#account-avatar-edit"),t=g.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),a=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(s){s.stopPropagation(),bi()}),t.addEventListener("click",function(s){s.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var s=r.files&&r.files[0];if(s){var i=new Image,l=URL.createObjectURL(s);i.onload=function(){pr(i,l,function(c){URL.revokeObjectURL(l),fr(c).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},i.src=l}}),a.addEventListener("click",function(){ur(),t.hidden=!0})}function Si(){g=document.createElement("div"),g.id="account-popover",g.className="account-popover",g.setAttribute("role","dialog"),g.setAttribute("aria-label","Account");var e=tt(),t=document.createElement("div");t.className="account-menu-identity",t.innerHTML='<button type="button" id="account-avatar-edit" class="account-avatar-edit" aria-label="Edit avatar"><img src="'+(document.body.dataset.myAvatarUrl||"")+'" alt=""></button><div class="account-identity-copy"></div><button type="button" class="account-settings-button" aria-label="User Settings" title="User Settings"><i data-lucide="settings" aria-hidden="true"></i></button>',t.querySelector("#account-avatar-edit img").alt=e.name||"Clay user";var n=document.createElement("div");n.id="account-avatar-editor",n.className="account-avatar-editor",n.hidden=!0,n.innerHTML='<button type="button" id="account-avatar-upload">Upload photo</button><button type="button" id="account-avatar-generate">Generate avatar</button><input id="account-avatar-file" type="file" accept="image/*">',g.appendChild(t),g.appendChild(n);var r=document.createElement("section");r.id="account-ai-section",r.className="account-inline-section account-ai-section",r.setAttribute("aria-label","Default AI"),g.appendChild(r),kr(r),t.querySelector(".account-settings-button").addEventListener("click",wi),document.body.appendChild(g),dt(),yi(),ct(),window.lucide&&window.lucide.createIcons({nodes:[g]}),ie()}function ct(){var e=document.getElementById("cursor-share-toggle");if(e){var t=o.get("cursorSharingHydrated")===!0,n=t&&o.get("cursorSharingEnabled")===!0,r=o.get("cursorSharingPending")!==null&&o.get("cursorSharingPending")!==void 0,a=o.get("connected")!==!1,s=o.get("cursorSharingError"),i=!!s&&!t&&a,l=t&&!n&&!r&&!s&&a;e.hidden=o.get("isMultiUserMode")!==!0,e.removeAttribute("role"),e.removeAttribute("aria-checked"),e.setAttribute("aria-pressed",n?"true":"false"),e.classList.toggle("on",n),e.classList.toggle("off",l),e.classList.toggle("pending",r),e.disabled=r||!a||!t&&!i;var c=r?"waiting":a?s?i?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+c);var d=r?"Cursor sharing is waiting for confirmation.":a?s?i?"Cursor sharing is unavailable. Click to retry.":"Cursor sharing is unavailable.":t?n?"Your cursor is visible to others. Click to stop sharing.":"Cursor sharing is off. Click to share your cursor.":"Cursor sharing is unavailable.":"Cursor sharing is offline.";Un(e,d)}}function wi(e){e.stopPropagation(),se(!0),Er()}function ki(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(o.get("cursorSharingError")&&o.get("cursorSharingHydrated")!==!0){Br();return}Ar(o.get("cursorSharingEnabled")!==!0)}}function Ci(){var e=g&&g.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function Mi(){g||la(),o.set({defaultAiInlineEditing:!0}),Ci()}function la(){if(g){se(!0);return}Se=document.activeElement,Si(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+we()),document.addEventListener("pointerdown",aa),document.addEventListener("focusin",ia),document.addEventListener("keydown",sa),window.addEventListener("resize",ie)}function da(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",la),document.addEventListener("clay:open-account-default-ai",Mi);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",ki),ct(),T.setAttribute("aria-label","Open account menu for "+we()),o.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&o.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&se(!1),ct(),g&&ie()}),document.addEventListener("clay:profile-updated",function(){if(g){var t=g.querySelector(".account-name-display span");t&&(t.textContent=we());var n=g.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",ie)}}var Ei=[{id:"file-browser-btn",icon:"folder-tree",label:"File browser"},{id:"terminal-sidebar-btn",icon:"square-terminal",label:"Terminal",countId:"terminal-sidebar-count"},{id:"sticky-notes-sidebar-btn",icon:"sticky-note",label:"Sticky Notes",countId:"sticky-notes-sidebar-count"},{id:"project-logs-btn",icon:"notebook-tabs",label:"Logs",countId:"project-logs-count"},{id:"mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mcp-sidebar-count"},{id:"scheduler-btn",icon:"calendar-clock",label:"Scheduled"},{id:"issues-btn",icon:"circle-dot",label:"Issues"},{id:"shared-browser-btn",icon:"globe",label:"Browser"}],Pi=[{id:"mate-memory-btn",icon:"brain",label:"Memory",countId:"mate-memory-count"},{id:"mate-knowledge-btn",icon:"book-open",label:"Knowledge",countId:"mate-knowledge-count"},{id:"mate-sticky-notes-btn",icon:"sticky-note",label:"Sticky Notes"},{id:"mate-debates-btn",icon:"messages-square",label:"Debates"},{id:"mate-mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mate-mcp-sidebar-count"}],de={session:{tools:Ei,fixedTools:[{id:"you-button",icon:"user-round",label:"Me",countId:"me-unread-badge",fixed:!0,scope:"clay"}],activeContainerId:"session-actions",hiddenSectionId:"session-actions-hidden"},mate:{tools:Pi,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ii={"skills-btn":"mcp-btn"},xi={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},ca=["git-sidebar-btn","loop-tool-btn","debates-btn"];function le(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function pa(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],a={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return a;for(var s=e==="mate"?xi:Ii,i=Object.keys(s),l=0;l<i.length;l++){var c=i[l],d=s[c],u=le(a.order,c)!==-1,p=le(a.hidden,c)!==-1;if(!(!u&&!p)){var m=le(a.order,d)!==-1||le(a.hidden,d)!==-1;a.order=fa(a.order,c,d,m),a.hidden=fa(a.hidden,c,d,m),a.migrated=!0}}if(e!=="session")return a;for(var v=0;v<ca.length;v++){var y=ca[v];le(a.order,y)===-1&&le(a.hidden,y)===-1||(a.order=ua(a.order,y),a.hidden=ua(a.hidden,y),a.migrated=!0)}return a}function ua(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function fa(e,t,n,r){for(var a=[],s={},i=0;i<e.length;i++){var l=e[i];if(l===t){if(r)continue;l=n}s[l]||(s[l]=!0,a.push(l))}return a}var He={},q=null,ce=null;function ha(){for(var e in de)Li(e);Ri(),D()}function Li(e){var t=de[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(a){n.appendChild(ma(a,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(ma(t.tools[r],e));n.addEventListener("dragover",function(a){if(!(ce!==e||!q)){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="move");var s=Ti(n,a.clientX,a.clientY);s==null?(q.parentNode!==n||q.nextSibling)&&n.appendChild(q):s!==q&&n.insertBefore(q,s)}}),n.addEventListener("drop",function(a){ce===e&&a.preventDefault()})}}function ma(e,t){var n=document.createElement("button");n.id=e.id,n.type="button",n.className="palette-tile",n.title=e.label,n.setAttribute("aria-label",e.label),n.dataset.toolId=e.id,n.dataset.palette=t,n.draggable=!0,e.fixed&&(n.draggable=!1,n.dataset.fixed="true"),e.scope&&(n.dataset.scope=e.scope),e.id==="you-button"&&(n.classList.add("you-button"),n.setAttribute("aria-pressed","false"));var r=document.createElement("i");r.setAttribute("data-lucide",e.icon),n.appendChild(r);var a=document.createElement("span");if(a.className="tool-btn-label",a.textContent=e.label,n.appendChild(a),e.countId){var s=document.createElement("span");s.id=e.countId,s.className="sidebar-badge hidden",e.id==="you-button"&&(s.className="sidebar-badge me-unread-badge",s.hidden=!0),n.appendChild(s)}return n.addEventListener("dragstart",function(i){if(e.fixed){i.preventDefault();return}var l=n.parentNode;if(!l||l.id!==de[t].activeContainerId){i.preventDefault();return}q=n,ce=t,i.dataTransfer.effectAllowed="move";try{i.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),ce&&Di(ce),q=null,ce=null}),n}function Ti(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),a=null,s=Number.POSITIVE_INFINITY,i=0;i<r.length;i++)if(r[i].dataset.fixed!=="true"){var l=r[i].getBoundingClientRect(),c=n-(l.top+l.height/2),d=t-(l.left+l.width/2),u=Math.abs(c)*2+Math.abs(d),p=c<-l.height/2||Math.abs(c)<=l.height/2&&d<0;p&&u<s&&(s=u,a=r[i])}return a}function Ri(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(ga("session",e.session||null),ga("mate",e.mate||null))}).catch(function(){})}function ga(e,t){if(!t)return;var n=de[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var a=pa(e,t),s={};function i(v){if(!s[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),s[v]=!0)}}for(var l={},c=0;c<a.hidden.length;c++)l[a.hidden[c]]=!0;for(var d=0;d<a.order.length;d++)l[a.order[d]]||i(a.order[d]);for(var u=0;u<n.tools.length;u++)l[n.tools[u].id]||i(n.tools[u].id);for(var p=0;p<a.hidden.length;p++)i(a.hidden[p]);for(var m=0;m<n.tools.length;m++)i(n.tools[m].id)}function Di(e){He[e]&&clearTimeout(He[e]),He[e]=setTimeout(function(){He[e]=null,Ai(e)},250)}function Ai(e){var t=de[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],a=n.querySelectorAll("[data-tool-id]"),s=0;s<a.length;s++)a[s].dataset.fixed!=="true"&&r.push(a[s].dataset.toolId);fetch("/api/user/tool-palettes",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({palette:e,order:r,hidden:[]})}).catch(function(){})}}}var ke=[],ft=[],x=null,K=null,pt=null,U=!1,Ce="project",V=0,C=[];function va(e){e!=="project"&&e!=="mate"||(U&&W(!1),mt(e))}function Sa(){Bi(),K=x.querySelector(".cmd-palette-results"),pt=x.querySelector(".project-switcher-header");var e=o.get("currentSlug");e&&(ke=[e]);var t=o.get("dmTargetUser");t&&t.isMate&&t.id&&(ft=[t.id]),o.subscribe(function(d,u){d.currentSlug&&d.currentSlug!==u.currentSlug&&(ya(ke,d.currentSlug),ke=ke);var p=ba(d.dmTargetUser),m=ba(u.dmTargetUser);p&&p!==m&&ya(ft,p)});var n=x.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){W(!1)}),document.addEventListener("keydown",ji,!0),document.addEventListener("keyup",Ui,!0),window.addEventListener("blur",function(){U&&W(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),a=r?"\u2318E":"Ctrl+E",s=r?"\u2318M":"Ctrl+M",i=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");i&&(i.textContent=a,i.title="Switch project ("+a+")",i.addEventListener("click",function(){va("project")})),l&&(l.textContent=s,l.title="Switch mate ("+s+")",l.addEventListener("click",function(){va("mate")}));function c(){if(l){var d=o.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}c(),o.subscribe(function(d,u){(d.cachedMatesList!==u.cachedMatesList||d.projectMateDmsEnabled!==u.projectMateDmsEnabled)&&c()})}function Bi(){if(x=document.getElementById("project-switcher"),!x){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";x=document.createElement("div"),x.id="project-switcher",x.className="cmd-palette hidden project-switcher",x.innerHTML='<div class="cmd-palette-backdrop"></div><div class="cmd-palette-dialog project-switcher-dialog"><div class="project-switcher-header">Switch project</div><div class="cmd-palette-results"></div><div class="cmd-palette-footer project-switcher-footer"><span class="project-switcher-shortcuts">'+t+'<kbd class="proj-next-key">E</kbd> next \xB7 <kbd>\u21E7</kbd>'+t+'<kbd class="proj-prev-key">E</kbd> prev \xB7 <kbd>\u23CE</kbd> select \xB7 <kbd>Esc</kbd> cancel</span></div></div>',document.body.appendChild(x)}}function ba(e){return e&&e.isMate&&e.id?e.id:null}function ya(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function ji(e){if(e.key){var t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase();if(t&&(n==="e"||n==="m")){var r=n==="e"?"project":"mate";e.preventDefault(),e.stopPropagation(),U?Ce!==r?mt(r):e.shiftKey?qe(-1):qe(1):mt(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),W(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),W(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),qe(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),qe(-1);return}}}}function Ui(e){U&&(e.key==="Meta"||e.key==="Control")&&W(!0)}function mt(e){if(Ce=e,C=Oi(e),C.length===0){U&&W(!1);return}pt&&(pt.textContent=e==="mate"?"Switch mate":"Switch project"),_i(e),qi(),V=Ni(),gt(),x.classList.remove("hidden"),U=!0,D(),Ue(K)}function _i(e){var t=x.querySelector(".proj-next-key"),n=x.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Ni(){if(C.length===0)return 0;for(var e=Ce==="mate"?ft:ke,t=wa(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var a=0;a<C.length;a++)if(C[a].key===r&&!C[a].disabled)return a}}for(var s=0;s<C.length;s++)if(!C[s].disabled&&C[s].key!==t)return s;for(var i=0;i<C.length;i++)if(!C[i].disabled)return i;return 0}function wa(){if(Ce==="mate"){var e=rt(o.snap());return e?e.id:null}return o.get("currentSlug")}function Oi(e){return e==="mate"?Hi():Fi()}function Fi(){var e=(ge()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=no(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===o.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Hi(){var e=o.get("cachedMatesList")||[],t=rt(o.snap()),n=t?t.id:null;return e.map(function(r){return{key:r.id,title:r.displayName||r.name||r.id,icon:null,avatarUrl:qt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function W(e){if(U&&(U=!1,x.classList.add("hidden"),!!e)){var t=C[V];!t||t.disabled||(Ce==="mate"?t.key!==wa()&&so(t.key):t.key!==o.get("currentSlug")&&je(t.key))}}function qe(e){if(C.length!==0){for(var t=e>0?1:-1,n=V,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){V=n,gt();return}}}function qi(){if(K){K.innerHTML="";for(var e=0;e<C.length;e++)K.appendChild(Vi(C[e],e))}}function Vi(e,t){var n=document.createElement("button");n.type="button",n.className="cmd-palette-item project-switcher-item",e.disabled&&n.classList.add("disabled"),e.disabled&&e.disabledReason&&(n.title=e.disabledReason),e.external&&(n.title=ro(e.title)),n.dataset.index=String(t);var r=document.createElement("div");if(r.className="cmd-palette-item-icon",e.icon)r.textContent=e.icon;else if(e.avatarUrl){var a=document.createElement("img");a.src=e.avatarUrl,a.alt="",a.className="project-switcher-avatar",r.appendChild(a)}else{var s=document.createElement("i");s.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(s)}e.external&&oo(r,"project-switcher-external-badge"),n.appendChild(r);var i=document.createElement("div");i.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var c=document.createElement("span");if(c.className="cmd-palette-item-title",c.textContent=e.title,l.appendChild(c),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var u=document.createElement("span");u.className="project-switcher-disabled-reason",u.textContent=e.disabledReason,l.appendChild(u)}return i.appendChild(l),n.appendChild(i),n.addEventListener("mouseenter",function(){e.disabled||(V=t,gt())}),n.addEventListener("click",function(){e.disabled||(V=t,W(!0))}),n}function gt(){if(K){for(var e=K.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===V);var n=e[V];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var Wi=/^[a-zA-Z0-9_-]{1,120}$/;function ht(){return Array.prototype.filter.call(document.querySelectorAll("iframe"),function(e){try{var t=new URL(e.src,window.location.href);return t.origin===window.location.origin&&t.searchParams.get("pane")==="1"}catch{return!1}})}function vt(e){var t=Ao();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function ka(e){return typeof e=="string"&&Wi.test(e)}function bt(e){return e===null||ka(e)}function zi(e){var t=e&&typeof e=="object"?e.preference:null;if(!t||typeof t!="object"||!ka(e.themeId)||e.userId!==null&&(typeof e.userId!="string"||!e.userId||e.userId.length>200)||typeof t.configured!="boolean"||t.mode!==null&&t.mode!=="light"&&t.mode!=="dark"||t.background!==void 0&&["plain","workshop"].indexOf(t.background)<0)return!1;var n=$e.normalizeCustom(t.customBackgroundColors||[]);return!n||t.backgroundColor!==void 0&&!$e.isColor(t.backgroundColor,n)?!1:bt(t.theme)&&bt(t.lightTheme)&&bt(t.darkTheme)}function Ca(){if(o.get("paneMode")){if(window.parent===window)return;window.addEventListener("message",function(e){if(!(e.origin!==window.location.origin||e.source!==window.parent)){var t=e.data;if(!(!t||t.type!=="clay-appearance"||!zi(t.snapshot))){var n=o.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Bo(t.snapshot)}}});return}Do(function(){ht().forEach(vt)}),o.subscribe(function(e,t){var n=Xe(e),r=Xe(t);(e.myUserId!==t.myUserId||n.background!==r.background||n.backgroundColor!==r.backgroundColor||JSON.stringify(n.customBackgroundColors)!==JSON.stringify(r.customBackgroundColors))&&ht().forEach(vt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&ht().indexOf(e.target)>=0&&vt(e.target)},!0)}var Gi=500,Ma=10,ue=null,yt=0,St=0,Me=!1,Ea=null;function Ve(){ue&&(clearTimeout(ue),ue=null)}function Pa(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){Ve();return}var t=e.touches[0];yt=t.clientX,St=t.clientY,Me=!1,Ea=e.target,ue=setTimeout(function(){ue=null,Me=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:yt,clientY:St});Ea.dispatchEvent(n)},Gi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(ue){var t=e.touches[0],n=t.clientX-yt,r=t.clientY-St;n*n+r*r>Ma*Ma&&Ve()}},{passive:!0}),document.addEventListener("touchend",function(e){Ve(),Me&&(Me=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){Ve(),Me=!1},{passive:!0}))}var Ia=!1,xa=!1;function wt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function Ki(e){return e?e.paneMode||wt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function La(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&o.get("connected")&&e.classList.add("hidden")}function Yi(e){return e?"/p/"+e+"/":null}function Ta(e){if(!xa){var t=Ki({surfaceLoaded:e.homeSurfaceLoaded,projectsLoaded:e.projectListLoaded,dockLoaded:e.homeDockPreferenceLoaded,surface:e.homePrimarySurface,currentSlug:e.currentSlug,pathname:location.pathname,paneMode:e.paneMode});if(t!=="wait"){if(xa=!0,t==="project"){if(!wt(location.pathname)){var n=Yi(e.currentSlug);n&&history.replaceState(null,"",n)}o.set({homeSurfaceBootResolved:!0}),La();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}o.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),La()}}}function Ra(){if(!Ia){if(Ia=!0,!wt(location.pathname)&&!o.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}o.subscribe(function(t){Ta(t)}),Ta(o.snap())}}var Ji=3600*1e3,Qi="(max-width: 768px)",kt=null,Ct=!1;function $i(e){if(typeof e!="number"||!isFinite(e)||e<0)return"";if(e=Math.floor(e),e<1e3)return String(e);for(var t=[[1e6,"m"],[1e3,"k"]],n=0;n<t.length;n++)if(e>=t[n][0]){var r=Math.floor(e/t[n][0]*10)/10;return(r%1===0?String(r):r.toFixed(1))+t[n][1]}return String(e)}function Aa(){var e=o.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?$i(e):"";t.textContent=r,t.classList.toggle("hidden",!r),n.setAttribute("aria-label",r?"Star Clay on GitHub, "+e+" stars":"Star Clay on GitHub")}}function Xi(){return!!(window.matchMedia&&window.matchMedia(Qi).matches)}function Da(){return Ct||Xi()?Promise.resolve():(Ct=!0,fetch("/api/github-stars",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&typeof e.stars=="number"&&(o.set({githubStarCount:e.stars}),Aa())}).catch(function(){}).then(function(){Ct=!1}))}function Ba(){document.getElementById("github-star")&&(Aa(),Da(),kt&&clearInterval(kt),kt=setInterval(Da,Ji))}function _a(){o.subscribe(function(e,t){if(e.sessionOriginId!==t.sessionOriginId||e.currentSlug!==t.currentSlug){o.set({activeBackgroundTasks:[],backgroundTaskCatalog:[]});return}e.backgroundTaskViewer!==t.backgroundTaskViewer&&document.querySelectorAll("[data-background-task]").forEach(function(n){var r=e.backgroundTaskViewer;n.setAttribute("aria-expanded",String(!!r&&n.dataset.backgroundTask===r.taskId))}),(e.activeBackgroundTasks!==t.activeBackgroundTasks||e.backgroundTaskCatalog!==t.backgroundTaskCatalog)&&Ua()}),Ua()}function Zi(e,t){if(typeof e!="number"||!isFinite(e)||e<=0)return"";var n=typeof t=="number"?t:Date.now(),r=Math.floor((n-e)/1e3);if(r<0&&(r=0),r<60)return r+"s";var a=Math.floor(r/60),s=r%60;if(a<60)return a+"m "+ja(s)+"s";var i=Math.floor(a/60);return i+"h "+ja(a%60)+"m"}function ja(e){return e<10?"0"+e:String(e)}function es(e){return!!(e&&e.ambient===!0)}function ts(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],a=0;a<r.length;a++)r[a]&&(es(r[a])?n.push(r[a]):t.push(r[a]));return{user:t,ambient:n}}function Ua(){var e=document.getElementById("background-tasks-bar");e&&e.remove();var t=ts(o.get("backgroundTaskCatalog")||o.get("activeBackgroundTasks")||[]),n=t.user.length?t.user.concat(t.ambient):[],r=document.getElementById("background-task-tabs");if(!n.length){r&&r.remove();return}var a=document.getElementById("messages");if(a){r||(r=document.createElement("div"),r.id="background-task-tabs",r.className="split-view-workers background-task-tabs",r.setAttribute("aria-label","Background tasks"),a.parentNode.insertBefore(r,a));var s=JSON.stringify(n.map(function(i){return[i.task_id,i.run_id,i.active,i.description]}));r.dataset.signature!==s&&(r.dataset.signature=s,r.textContent="",n.forEach(function(i){var l=document.createElement("span");l.className="split-view-worker-pill"+(i.ambient?" background-task-ambient":"");var c=document.createElement("button");c.type="button",c.className="split-view-worker-chip",c.dataset.backgroundTask=i.task_id,Nn(c,Ze(i)),i.preview&&_n(Ze(i),i.preview,!1),c.title=(i.ambient?"Housekeeping \xB7 ":"")+(i.description||"Background task")+(i.started_at?" \xB7 "+Zi(i.started_at):"")+(i.active===!1?" \xB7 Finished":" \xB7 Running"),c.setAttribute("aria-haspopup","dialog");var d=o.get("backgroundTaskViewer");c.setAttribute("aria-expanded",String(!!d&&d.taskId===i.task_id));var u=document.createElement("span");u.className="split-view-worker-dot",u.dataset.state=i.active===!1?"ready":"working";var p=document.createElement("span");if(p.className="split-view-worker-name",p.textContent=i.description||"Background task",u.setAttribute("aria-label",i.active===!1?"Finished":"Running"),c.append(u,p),c.addEventListener("click",function(){On(i)}),l.appendChild(c),i.active!==!1){var m=document.createElement("button");m.type="button",m.className="split-view-worker-remove",m.setAttribute("aria-label","Stop "+(i.description||"background task")),m.title="Stop task",m.innerHTML=ee("square"),m.addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"background_task_stop",requestId:crypto.randomUUID(),taskId:i.task_id,runId:i.run_id||null,sessionOriginId:o.get("sessionOriginId")}))}),l.appendChild(m)}r.appendChild(l)}),D())}}var xt=new URLSearchParams(location.search),pe=xt.get("pane")==="1";pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var J=Number(xt.get("session"));(!Number.isSafeInteger(J)||J<1)&&(J=null);pe&&document.body.classList.add("pane-mode");var ze=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),ns=document.body.dataset.homeProjectSlug||null,Ie=ze?ze[1]:ns,z=Ie?"/p/"+Ie+"/":"/",fe=Ie?"/p/"+Ie+"/ws":"/ws";pe&&(fe+="?pane=1",J&&(fe+="&session="+J),xt.get("contextual")==="1"&&(fe+="&contextual=1"));var f=function(e){return document.getElementById(e)},L=f("messages"),Ke=f("input"),rs=f("send-btn");var Pt=f("header-title"),gh=f("header-rename-btn"),os=f("slash-menu"),hh=f("suggestion-chips"),as=f("sidebar"),is=f("sidebar-overlay"),Ka=f("session-list"),ss=f("new-session-btn"),ls=f("hamburger-btn"),ds=f("sidebar-toggle-btn"),cs=f("sidebar-expand-btn"),us=f("image-preview-bar"),vh=f("connect-overlay");var fs="/claude-code-avatar.png";function Ya(e){De(e)}function ps(){return!1}function Ja(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Qa(e){eo(e)}function ms(){to()}var bh=f("project-list-section"),yh=f("project-list"),Sh=f("project-list-add"),gs=f("project-hint"),Na=f("project-hint-dismiss"),Ge=Ie||null;document.addEventListener("keydown",function(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"){var t=document.activeElement,n=t&&t.tagName;(n==="TEXTAREA"||n==="INPUT"||t&&t.isContentEditable)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?document.execCommand("redo",!1,null):document.execCommand("undo",!1,null))}},!0);document.addEventListener("keydown",function(e){e.key==="Escape"&&Tt()});Na&&Na.addEventListener("click",function(){gs.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",ot);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",ot);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",Tt);f("image-modal").querySelector(".image-modal-close").addEventListener("click",Tt);function Lt(e){dn(e)}function Tt(){cn()}var $a="";try{Ee=localStorage.getItem("clay-project-name-"+(Ge||"default")),Ee&&($a=Ee,Pt&&(Pt.textContent=Ee),Mt=f("title-bar-project-name"),Mt&&(Mt.textContent=Ee)),Et=localStorage.getItem("clay-project-icon-"+(Ge||"default")),Et&&(Pe=f("title-bar-project-icon"),Pe&&(Pe.textContent=Et,Ue(Pe),Pe.classList.add("has-icon")))}catch{}var Ee,Mt,Et,Pe;function Xa(e,t,n,r){un(e,t,n,r)}Bt({agentBehavior:{status:"idle",error:"",catalog:null,policy:null,effective:null,edits:{},saved:{}},networkSettings:{loaded:!1,busy:!1,confirming:!1,draft:"",saved:"",status:"",errorKind:"",requestId:0},vendorLoginBrowser:null,githubStarCount:null,sharedBrowser:null,sharedBrowsers:[],mcpSkillsWorkbench:{},mateKnowledgeWorkspaces:{},mateColorSave:null,mcpConnections:{screen:"list",servers:[],search:"",loaded:!1},sharedBrowserOpen:!1,sharedBrowserUi:{},sharedBrowserSettings:{},browserLinksBound:!1,basePath:z,wsPath:fe,paneMode:pe,paneSessionId:J,panePinPending:pe&&!!J,paneCommittedBinding:null,panePendingBinding:null,paneReady:!1,paneSuspended:!1,paneActivationGeneration:0,paneActivationTimer:null,panePointerBinding:null,paneRichDrafts:{},paneLayoutScrollLock:null,paneLastUserScrollTop:null,paneUserScrollIntent:null,paneUserScrollRevision:0,sessionRichDrafts:{},sessionActionEpoch:0,composerUploadingCount:0,deferredSessionSwitch:null,paneCallbackBinding:null,paneActionEvents:[],paneHeldKeys:{},rewindAction:null,handoffAction:null,authIdentityLoaded:!1,splitIdentityBlockedSocket:null,splitIdentityHydrated:!1,paneActivationUnsupported:!1,paneBindingSessions:[],splitPanes:null,splitGroups:[],splitViewWorkerConversation:null,splitViewWorkerRemoval:null,projectSplitViews:[],projectSplitViewRevision:0,projectSplitViewContextKey:null,projectSplitViewHydrated:!1,projectSplitViewPending:null,projectSplitViewError:"",projectSplitViewActiveId:null,projectSplitViewFocusedOrigin:null,projectSplitViewPreviewTree:null,projectSplitViewDrag:null,splitViewOrganizationDrag:null,projectSplitViewDividerDrag:null,projectSplitViewTranscriptScroll:{},projectSplitViewSuppressClick:null,projectSplitViewSocketGeneration:0,projectSplitViewRequestSocket:null,projectSplitViewRequestGeneration:null,projectSplitViewRequestOwnerId:null,projectSplitViewRequestSlug:null,sessionFolders:null,sessionFoldersSlug:null,sessionFolderCreate:null,sidebarCreationEffects:[],sessionSearch:null,sessionFolderViewMenu:null,sessionFolderLayouts:{},sessionFolderDrag:null,sessionFolderMenu:null,sessionFolderContext:null,sessionFolderModal:null,sessionContextMenu:null,sessionInlineRename:null,splitDelegations:{},pairResultStatus:[],notesTemporarilyHidden:!1,pairResultTrayOpen:!1,dmMode:!1,historyFrom:0,loadingMore:!1,historyTotal:0,replayingHistory:!1,historyReplayBatch:null,pendingSessionEntryNavigation:null,sessionEntryHighlight:null,sessionNavigationRequestId:null,projectName:$a,cwd:"",currentSlug:Ge,githubWorkPopoverBound:!1,githubWorkSessions:[],githubWorkProject:null,githubWorkRefresh:null,workPrimaryPending:null,activeProjectSlug:null,activeProjectMateId:null,activeProjectMateName:"",clayReturnTarget:null,contextualPrepared:null,contextualSubmitted:{},contextualClay:{mode:"closed",mateId:null},contextualConversationHistory:null,contextualConversationRequest:null,clayControlActivity:null,clayControlOrder:0,clayControlReceipts:[],clayControlForwarded:null,controlRuntimeId:null,studioDocumentSource:null,studioDocumentView:null,clayStudioRelays:{},clayStudioForwarded:{},clayStudioSurfaces:{},clayControlNotifications:[],clayControlFileView:null,clayControlTerminalViews:[],clayControlGitView:null,clayNavigationRendering:null,clayControlViewerRef:null,contextualSessionReady:!1,contextualSessionReceived:!1,contextualSessionUnavailable:!1,clayReturnPendingProjectSlug:null,activeSessionMateId:null,activeSessionMateName:"",sessionActivatedProjectSlug:null,sessionListProjectSlug:null,splitGroupsProjectSlug:null,socketPath:null,pendingHomeProjectSlug:null,homeProjectEmptyVisible:!1,homeShellVisible:!1,projectMateFilterMode:"all",projectMateFilterTurns:0,projectMateFilterActivated:!1,projectMateCreationActive:!1,projectMateCreationMateId:null,projectMateCreationSessionId:null,projectMateCreationRequestId:null,projectMateCreationPendingStart:!1,projectMateCreationAwaitingHistory:!1,projectMateCreationAwaitingMateList:!1,projectMateCreationHistoryReady:!1,projectMateCreationLocalId:null,projectMateCreationMessages:[],projectMateCreationPendingMateId:null,projectDebatePlanningActive:!1,projectDebatePlanningMateId:null,projectDebatePlanningSessionId:null,projectDebatePlanningLocalId:null,projectDebatePlanningRequestId:null,projectDebatePlanningPendingStart:!1,projectDebatePlanningAwaitingHistory:!1,projectDebatePlanningAwaitingMateList:!1,projectDebatePlanningHistoryReady:!1,projectDebatePlanningTopic:"",projectDebatePlanningMessages:[],projectDebatePlanningError:"",projectDebatePlanningRetryable:!1,debatesWorkbenchStatus:"idle",debatesWorkbenchRequestId:null,debatesWorkbenchItems:[],debatesWorkbenchError:"",debatesWorkbenchFilter:"all",debatesWorkbenchCreating:!1,debatesWorkbenchWide:!1,debatesWorkbenchFullscreen:!1,debatesWorkbenchScrollTop:0,pendingDebateNavigation:null,pendingProjectSessionNavigation:null,projectsHubVisible:!1,projectsHubMarkup:null,projectsHubList:[],projectListLoaded:!1,projectsAccessLoaded:!1,projectsHubRestoreRequested:!1,projectStart:bn(),projectStartFolder:yn(),onboardingStep:"welcome",onboardingIntent:null,currentProjectOwnerId:null,isOsUsers:!1,skipPermsEnabled:!1,autonomousSelectedMode:"normal",autonomousArming:!1,autonomousArmToken:null,autonomousArmRequestId:null,autonomousArmSessionId:null,autonomousActionRequestId:null,autonomousActionSessionId:null,autonomousCriteria:"",autonomousMaxContinuations:10,autonomousMaxMinutes:60,autonomousRun:null,autonomousExpanded:!1,loopInterviewBrief:null,loopInterviewEditing:!1,loopInterviewRunRequestId:null,loopInterviewRunSessionId:null,loopInterviewStarting:!1,loopInterviewRequestId:null,loopInterviewSessionId:null,slashCommands:[],processing:!1,scheduledMessageCorrelation:null,activeSessionId:null,speechActive:null,settingsSectionPage:null,settingsSectionScope:null,settingsSectionActive:null,settingsPageScroll:{},personalProvidersOpen:!1,personalProvidersLoading:!1,personalProvidersError:"",personalProvidersNotice:"",personalProviderSignInResults:{},personalProviderCatalog:null,personalProviderContext:null,personalProviderRequest:null,personalProviderRevision:null,personalProviderEditing:null,personalProviderRuntimeDetailsOpen:!1,personalProviderSigningIn:null,personalProviderInstall:null,personalProviderInstallBusy:!1,personalProviderInstallRequest:null,personalProviderInstallAwaiting:null,speechSettingsContextGeneration:0,speechSettings:null,speechSettingsRequest:0,speechSettingsSaving:!1,speechSettingsError:"",speechPopup:null,speechRetry:null,speechLang:"en-US",speechStatuses:{},speechErrors:{},speechLanguageSaving:!1,speechLifecycleBound:!1,askUserRequests:{},activeBackgroundTasks:[],backgroundTaskCatalog:[],backgroundTaskViewer:null,splitSessionPicker:null,splitSessionCreation:null,agentMessagePreviews:{},agentMessageBubble:null,workerMessagePreviewSubscription:null,workerActivityIndicators:{},sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest:null,filePaneInstances:{},activeFilePaneId:null,fileViewerIsPlantUml:!1,plantUmlPreviewJob:null,wireframeDraft:null,wireframeRenderQueue:[],wireframeRenderActive:null,wireframeRenderCache:[],pendingFileNavigation:null,rightWorkbenchOwner:null,rightWorkbenchRevision:0,fileViewerOpenRevision:0,cursorSharingEnabled:!1,cursorSharingHydrated:!1,cursorSharingPending:null,pendingOutboundMessages:[],pendingMessageQueue:{projectSlug:null,sessionId:null,revision:0,paused:!1,items:[],loading:!1,error:""},pendingMessageQueueRecovery:!1,pendingMessageQueueRequests:{},pendingMessageQueueEdit:null,pendingMessageQueueDrag:null,pendingMessageQueueFocusReturn:null,searchClayChatState:null,homeChatMateId:null,homeChatSessionId:null,homeChatSessionModel:null,homeChatSessionVendor:null,homeChatSessionModelLoading:!1,homeMateSessions:{},homeActiveSessionByMate:{},homePreferredMateId:null,homeSidebarCollapsed:!1,homeMatesCollapsed:!1,homeChatScope:"all",homeSubSurface:"chat",homeDebatesStatus:"idle",homeDebates:[],homeDebatesRequestId:null,homeDebatesError:"",homeSurfaceLoaded:!1,homePrimarySurface:null,homeSurfaceProjectSlug:null,homeSurfaceIntent:null,homeSurfaceBootResolved:!1,homeSurfaceRestoreRequested:!1,dockActiveToolId:null,dockOpen:!1,homeDockPreferenceLoaded:!1,dockFocus:!1,dockLibraryOpen:!1,dockBackstageOpen:!1,dockWidth:null,dockHasActivity:!1,dockActivityToolId:null,you:{},youActivity:{},youSequence:0,projectLogsOpen:!1,projectLogsWide:!1,projectLogsFullscreen:!1,projectLogsEntries:[],projectLogsSelectedRef:null,projectLogsView:"list",projectLogsCategory:"",projectLogsContextMode:"",projectLogsIsWorktree:!1,projectLogsListScroll:0,projectLogsListRequestId:null,projectLogsReadRequestId:null,projectLogsCommentRequestId:null,projectLogsCommentStatusEl:null,projectLogsDeleteRequestId:null,projectLogsCanDelete:!1,projectLogsUnread:0,projectLogsSeenRevisions:{},scheduledResultUnread:0,scheduledResultAutoFocusHandled:!1,scheduledResultFocusRef:null,scheduledResultPendingReadRef:null,scheduledResultSeenRefs:{},scheduledResultSessionRequestId:null,issuesOpen:!1,issuesView:"list",issuesSelected:null,issuesRows:[],issuesRequests:{},issueGithub:null,issuesViewRequest:null,issuesViewGeneration:0,issuesUpdateAvailable:null,issuesCache:{},issuesEpoch:0,issuesSearchTimer:null,issueLinkRequests:{},issueLinkOpenRef:null,scheduledTasksOpen:!1,scheduledTasksWide:!1,scheduledTasksFullscreen:!1,scheduledTaskRecords:[],scheduledTaskDraft:null,scheduledTaskEditingId:null,scheduledTaskNewSessionPending:!1,scheduledTaskInterviewRequestId:null,scheduledTaskActionRequestId:null,scheduledTaskListRequest:null,scheduledTaskInterviewId:null,scheduledTaskExpandedId:null,scheduledTaskDeleteId:null,scheduledTaskDraftForm:null,scheduledTaskEditForm:null,scheduledTaskCreateMenuOpen:!1,scheduledTaskManualRequest:null,installedTools:[],capsulesEnabled:!1,capsulesPreferenceLoaded:!1,homeToolRegistryLoaded:!1,toolScanErrors:[],defaultAiState:{loading:!1,saving:!1,refreshRequestId:null,saveRequestId:null,catalogRequestIds:{},catalogs:{},preference:null,selection:null,installedVendors:[],accountAvailable:!0,accountId:null,serverEpoch:null,canonicalRevision:0,error:""},defaultAiDraft:{vendor:"",model:"",effort:""},defaultAiDraftDirty:!1,defaultVendorState:{loading:!1,saving:!1,getRequestId:null,saveRequestId:null,preference:null,preferencePresent:!1,installedVendors:[],accountId:null,projectSlug:null,serverEpoch:null,canonicalRevision:0,error:""},projectSessionVisibilityState:{active:null,pending:null},dmTargetUser:null,dmKey:null,cachedMatesList:[],cachedDmFavorites:[],cachedAvailableBuiltins:[],projectMateDmsEnabled:!0,returningFromMateDm:!1,pendingMateInterview:null,pendingTermCommand:null,shellCommandMode:!1,shellCommandRunning:!1,pendingShellCommandId:null,mateProjectSlug:null,myUserId:null,contextViewPreferenceState:{mode:"off",canonicalMode:"off",preferencePresent:!1,loading:!1,saving:!1,requestId:null,saveRequestId:null,pendingSaves:[],accountId:null,serverEpoch:null,rejectedEpoch:null,canonicalRevision:0,error:""},contextViewOverride:null,isMultiUserMode:!1,dmUnread:{},dmRemovedUsers:{},cachedAllUsers:[],cachedOnlineIds:[],cachedDmConversations:[],sessionDrafts:{},messageUuidMap:[],currentMsgTs:null,richContextUsage:null,contextMeasurement:"unavailable",currentMsgEl:null,currentFullText:"",matePreThinkingEl:null,thinkingState:null,fileViewerFullscreen:!1,markdownSlidesActive:!1,markdownSlideIndex:0,markdownSlideCount:0,markdownSlideLevel:1,markdownSlidePreferredLevel:1,markdownSlideLevelExplicit:!1,currentModel:"",currentModels:[],modelListVendor:"",modelListStatus:"idle",modelListError:"",modelRequestId:"",modelSelectionPending:null,modelSelectionError:"",lastVendor:"",vendorInfo:{},rateLimitState:{},vendorUsageOverview:null,vendorUsageOpen:null,currentMode:"default",effectivePermissionMode:null,permissionCapabilities:{auto:!1,mcpOverride:!1},permissionModePendingByTarget:{},mcpPermissionModePendingByTarget:{},mcpPermissionModeOverrides:{},currentEffort:"medium",currentBetas:[],currentThinking:"adaptive",currentThinkingBudget:1e4,sessionFullAccess:!1,codexApproval:null,codexSandbox:null,codexWebSearch:null,ctxPopoverVisible:!1,headerContextEl:null,loopActive:!1,loopAvailable:!1,loopIteration:0,loopMaxIterations:0,loopBannerName:null,ralphPhase:"idle",ralphCraftingSessionId:null,ralphCraftingSource:null,ralphFilesReady:{promptReady:!1,judgeReady:!1,bothReady:!1},ralphPreviewContent:{prompt:"",judge:""},execModalShown:!1,debateStickyState:null,debateFloorMode:!1,debateConcludeMode:!1,debateEndedMode:!1,knownInstalledSkills:{},permissions:null,wizardData:{name:"",task:"",maxIterations:null,cron:null}});Ir({$:f,get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},messagesEl:L,addSystemMessage:oi});jo();Ca();jn();Pa();var hs={$:f,get ws(){return w()},get connected(){return o.get("connected")},get projectName(){return o.get("projectName")},messagesEl:L,sessionListEl:Ka,sidebar:as,sidebarOverlay:is,sidebarToggleBtn:ds,sidebarExpandBtn:cs,hamburgerBtn:ls,newSessionBtn:ss,headerTitleEl:Pt,showConfirm:Xa,onFilesTabOpen:function(){Oo(),Ho(),H()&&F()},requestKnowledgeList:function(){tr()},switchProject:function(e){ai(e)},openTerminal:function(){Ro()},showHomeHub:function(){Ya()},getUpcomingSchedules:hn,get multiUser(){return o.get("isMultiUserMode")},get myUserId(){return o.get("myUserId")},get projectOwnerId(){return o.get("currentProjectOwnerId")},get ownerLocked(){return o.get("ownerLocked")},openDm:function(e){Qa(e)},openMateWizard:function(){Ja()},openAddProjectModal:function(){Sn()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},o.get("dmRemovedUsers"));t[e]=!0,o.set({dmRemovedUsers:t})},getHistoryFrom:function(){return o.get("historyFrom")},get permissions(){return o.get("permissions")},get projectList(){return ge()||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]}};ha();_e([Uo,Jn,Qn,Zt,$n,en,Lr,Jr]);Lo(hs);var Rt=function(){return w()};nr(Rt);Zn(Rt);_e([gr]);Xn(Rt,{onShow:function(){er(),Co()}});vn({switchProject:function(e){ai(e)},currentSlug:function(){return o.get("currentSlug")},matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},dmConversations:function(){return o.get("cachedDmConversations")||[]},myUserId:function(){return o.get("myUserId")},selectSession:function(e){H()&&F();var t=document.getElementById("sticky-notes-panel");if(t&&!t.classList.contains("hidden")){var n=document.getElementById("sticky-notes-sidebar-btn");n&&n.click()}var r=w();r&&r.readyState===1&&r.send(JSON.stringify({type:"switch_session",id:e}))},openDm:function(e){Qa(e)},runAction:function(e){switch(e){case"createMate":Ja();break;case"openSettings":Pn();break;case"showHome":Ya();break}}});Sa();Kn();Xt();function vs(e){Rn(e)}function bs(){Dn()}function ys(e){An(e)}function Ss(){go()}function ws(){ho()}function Za(){qn()}function ei(){Vn()}function ks(){Wn()}function Cs(){zn()}function Dt(e){Kt(e)}var Y=f("new-msg-btn"),Oa="\u2193 Latest";function It(){var e=f("input-area");e&&(Y.style.bottom=e.offsetHeight+12+"px")}var Fa=f("input-area");Fa&&window.ResizeObserver?new ResizeObserver(It).observe(Fa):window.addEventListener("resize",It);It();L.addEventListener("scroll",function(){if(!Vt()){var e=L.scrollHeight-L.scrollTop-L.clientHeight,t=e>150;Gt(t),t?(Y.classList.contains("hidden")&&(Y.textContent=Oa),Y.classList.remove("hidden")):(Y.classList.add("hidden"),Y.textContent=Oa)}});Y.addEventListener("click",function(){ti()});document.addEventListener("visibilitychange",function(){document.hidden||xe()});L.addEventListener("click",function(e){var t=e.target.closest(".msg-action-fork");if(t){var n=t.closest("[data-uuid]");if(!(!n||!n.dataset.uuid)){var r=n.dataset.uuid;Xa("Fork session from this message?",function(){var a=w();a&&a.readyState===1&&a.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function xe(){Yt()}function ti(){Jt()}ln();Tn();Tr();hr();Vr();Fr();_a();Qr();Hr();qr();Gr();Ht();Hn();Gn();Wt();rn({$:f,get ws(){return w()},get connected(){return o.get("connected")},get turnCounter(){return zt()},messagesEl:L,inputEl:Ke,finalizeAssistantBlock:function(){Ms()},addToMessages:function(e){Dt(e)},scrollToBottom:function(){xe()},setActivity:function(e){ys(e)},stopUrgentBlink:function(){bs()},showImageModal:Lt,getContextPercent:function(){var e=Fn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return fs},getMateById:function(e){var t=o.get("cachedMatesList");if(!e||!t)return null;for(var n=0;n<t.length;n++)if(t[n].id===e)return t[n];return null}});function ni(e,t,n,r,a){uo(e,t,n,r,a)}function ri(e,t){po(e,t)}function Ms(){mo()}function oi(e,t){fo(e,t)}function Es(){bo()}function Ps(){io()}function ai(e){je(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){De(!0);return}Mn();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){De(!0);return}Cn("project",t),ps()&&void 0,t&&t!==o.get("currentSlug")&&(No(),ne(),H()&&F(),mn(t),o.set({currentSlug:t}),z="/p/"+t+"/",fe="/p/"+t+"/ws",o.set({basePath:z,wsPath:fe}),Ps(),ii())});function ii(){Xr()}co({get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},get basePath(){return z},inputEl:Ke,sendBtn:rs,slashMenu:os,messagesEl:L,imagePreviewBar:us,slashCommands:function(){return o.get("slashCommands")},messageUuidMap:function(){return o.get("messageUuidMap")},addUserMessage:ni,addSystemMessage:oi,toggleUsagePanel:Za,toggleStatusPanel:ei,toggleContextPanel:Cs,resetContextData:ks,showImageModal:Lt,hideSuggestionChips:Es,getGhostSuggestion:function(){return vo()},setSendBtnMode:vs,isDmMode:function(){return o.get("dmMode")&&!(o.get("dmTargetUser")&&o.get("dmTargetUser").isMate)},getDmKey:function(){return o.get("dmKey")},handleDmSend:function(){ms()},isDebateEndedMode:function(){return o.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return o.get("debateConcludeMode")},handleDebateConcludeSend:function(){Ls()},isDebateFloorMode:function(){return o.get("debateFloorMode")},handleDebateFloorSend:function(){Rs()},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getDmMateId:function(){var e=o.get("dmTargetUser");return o.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){ws()},showClaudePreThinking:function(){Ss()},myUserId:function(){return o.get("myUserId")},myDisplayName:function(){var e=null;try{e=JSON.parse(localStorage.getItem("clay_my_user")||"null")}catch{}return e&&(e.displayName||e.username)||document.body.dataset.myDisplayName||"Me"}});xr();Kr({get ws(){return w()},get connected(){return o.get("connected")},inputEl:Ke,messagesEl:L,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},myUserId:function(){return o.get("myUserId")},scrollToBottom:xe,addUserMessage:ni,addCopyHandler:ri,addToMessages:Dt,showImageModal:Lt,showPasteModal:sn});Ur({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:L,addToMessages:function(e){Dt(e)},scrollToBottom:xe,addCopyHandler:ri,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").isMate?o.get("dmTargetUser").id:o.get("homeChatMateId")||null},requireSkills:xs,showDebateEndedMode:function(e){Ts(e)}});oa();mr({basePath:z});In();Mr({basePath:z});function Is(){fn()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(o.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(o.set({myUserId:e.user.id}),Bn()),o.set({authIdentityLoaded:!0}),o.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Is(),!o.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}da();var n=o.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var a=document.getElementById("terminal-sidebar-btn");a&&(a.style.display="none");var s=document.getElementById("shell-command-btn");s&&(s.style.display="none");var i=document.getElementById("input-more-shell");i&&(i.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var c=document.getElementById("git-placard");c&&(c.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var u=document.getElementById("mate-skills-btn");u&&(u.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var m=document.getElementById("icon-strip-add");m&&(m.style.display="none")}}}).catch(function(){});br().then(function(e){if(o.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});vr({$:f,get ws(){return w()},get connected(){return o.get("connected")},messagesEl:L,sessionListEl:Ka,scrollToBottom:xe,forceScrollToBottom:ti,basePath:z,toggleUsagePanel:Za,toggleStatusPanel:ei});yr();xn(ao());Ln();_o({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},get cwd(){return o.get("cwd")},messagesEl:L,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});_e([xo,Yo,tn]);Vo();Ft();Yn();To({get ws(){return w()},get connected(){return o.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});on({get ws(){return w()},get connected(){return o.get("connected")}});ta();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){ea(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Qt({messagesEl:L,get ws(){return w()},getHistoryFrom:function(){return o.get("historyFrom")}});var Ha=f("find-in-session-btn");Ha&&Ha.addEventListener("click",function(){$t()});wo();Io();yo(function(){re()&&Eo()});var qa=f("sticky-notes-sidebar-btn");qa&&qa.addEventListener("click",function(){he(),me(),H()&&F(),re()&&ne(),ko(),Mo()});var Va=document.querySelectorAll("#sticky-notes-toggle-btn");for(We=0;We<Va.length;We++)Va[We].addEventListener("click",function(){So()});var We,Wa=f("sticky-notes-sidebar-count");Wa&&Wa.addEventListener("click",function(e){e.stopPropagation(),he(),me(),H()&&F(),re()?ne():Po()});var za=f("git-placard-more"),Ga=f("terminal-sidebar-btn");za&&za.addEventListener("click",function(){Qe(),he(),me(),re()&&ne(),H()&&F()});Ga&&Ga.addEventListener("click",function(){Qe(),he(),me(),re()&&ne(),H()&&F()});function xs(e,t){Wr(e,t)}function Ls(){_r()}function Ts(e){Nr(e)}function Rs(){Or()}an();Pr();pn({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},basePath:z,currentSlug:Ge,getProjects:function(){return ge()}});jr();Rr();Dr();Ba();wn();lo();zr();kn();Yr();En();Ra();Zr();$r();lucide.createIcons();pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");ii();ze&&location.hash==="#scheduler"?setTimeout(function(){gn("calendar")},500):ze&&Ke.focus();
1
+ import{$ as En,$a as Zn,$b as Or,$c as xo,A as rn,Aa as Fn,Ab as Ae,B as on,Ba as Hn,Bb as Be,Bc as rt,Bd as he,Ca as qn,Cb as wr,Cc as so,Da as Vn,Db as kr,Dc as lo,Ea as Wn,Eb as Cr,Ec as co,F as an,Fa as zn,Fb as Mr,Fc as uo,G as sn,Ga as Gn,Gb as Er,Gc as fo,H as ln,Ha as Kn,Hb as Pr,Hc as po,I as dn,Ib as Ir,Ic as mo,J as cn,Jb as xr,Jc as go,K as un,Kc as ho,L as fn,Lc as vo,M as pn,Mc as bo,Md as _o,N as F,Nb as me,Nc as yo,O as mn,Oc as So,P as gn,Pc as wo,Q as H,Qc as ko,Qd as No,R as hn,Rb as Lr,Rc as Co,S as vn,Sa as Yn,Sb as Tr,Sc as Mo,Sd as Oo,T as bn,Tb as Rr,U as yn,Ub as Dr,Ud as Fo,V as Sn,Vb as Ar,Vd as Ho,W as wn,Wb as Br,Wc as Eo,X as kn,Xa as Jn,Xb as jr,Xc as Po,Y as Cn,Ya as Qn,Yb as Ur,Yc as ne,Z as De,Za as $n,Zb as _r,Zc as re,_ as Mn,_a as Xn,_b as Nr,_c as Io,a as Ft,aa as Pn,ab as er,ac as Fr,ad as Lo,ae as qo,b as Ht,ba as In,bb as tr,bc as Hr,bd as To,c as qt,ca as xn,cb as nr,cc as qr,cd as Ro,d as Vt,da as Ln,db as et,dc as Vr,e as Wt,ea as Tn,eb as rr,ec as Wr,f as zt,fa as Rn,fb as or,fc as zr,g as Gt,ga as Dn,gb as te,gc as Gr,h as Kt,ha as An,hb as ar,hc as Kr,i as Yt,ia as Bn,ib as ir,ic as Yr,j as Jt,ja as jn,jb as sr,k as Qt,ka as Un,kb as lr,l as $t,la as _n,lb as dr,m as Xt,ma as Nn,mb as cr,mc as Jr,na as Ze,nb as ur,nc as Qr,oa as On,ob as fr,oc as $r,pb as pr,pc as Xr,qb as mr,qc as Zr,qd as Do,rb as tt,rc as eo,rd as Ao,sc as to,sd as Bo,t as Qe,tb as gr,tc as no,td as jo,ub as hr,uc as ro,v as Zt,vb as vr,vc as oo,vd as Ue,wb as br,wc as ao,x as en,xb as yr,xc as ge,xd as ot,y as $e,yb as nt,yc as io,yd as Uo,z as Xe,zb as Sr,zc as je}from"./chunk-JFPKTZNT.js";import"./chunk-SMMJMW5H.js";import"./chunk-YHBTK56T.js";import{g as tn}from"./chunk-M3R7EZRU.js";import{h as nn}from"./chunk-C2FSPTQF.js";import{A as Ot,a as jt,b as Ut,f as _t,w as Je,x as Nt}from"./chunk-YEKR6TQM.js";import{a as w}from"./chunk-R7QVVFUG.js";import{d as D,e as ee}from"./chunk-2JXAANCI.js";import{c as Bt,d as o}from"./chunk-EGCR2MH4.js";var ve=[];function at(){var e=o.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(o.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=o.snap(),r=n.paneDeferredBootstrap;if(r){var a=r.jobs.slice(),s=n.connected&&n.paneReady&&!n.paneSuspended?a.shift():null;o.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:a})});try{if(s!==null&&ve[s]){var i=ve[s];ve[s]=null,i()}}finally{at()}}},0))}function _e(e){if(!o.get("paneMode")){e.forEach(function(n){n()});return}var t=o.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},o.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&at()})),o.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ve.length;return ve.push(n),r}))})}),at()}function Vo(){Ot(),_t(),window.addEventListener("message",function(e){var t=e.data;if(e.origin===location.origin&&t&&t.type==="clay-studio-document-update"&&t.message){var n=Ut(t.message.path);n&&n.source===e.source&&n.descriptor.token===t.token&&qo(t.message,n);return}!t||["clay-pane-present-markdown","clay-pane-present-wireframe"].indexOf(t.type)<0||!t.message||!t.message.controlPresentation||!Je(e,t)||!Nt(e,t)||(t.type==="clay-pane-present-markdown"?(jt(e,t,Je(e,t)),Fo(t.message)):nn(t.message))})}var si="(max-width: 768px)",li=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],di=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function Wo(e){var t=document.querySelector("#main-column > .title-bar-content .status"),n=document.querySelector("#top-bar .top-bar-actions"),r=document.getElementById("notif-center-btn");if(!(!t||!n))for(var a=e?li:di,s=0;s<a.length;s++){var i=document.getElementById(a[s]);i&&(e?t.appendChild(i):n.insertBefore(i,r))}}var ci=150,oe=24,be=12,zo=null;function Go(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function Ko(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),a=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!a)&&t.offsetWidth&&!(!e&&zo===Go(t,n,r))&&getComputedStyle(a).display!=="none"){for(var s=[[],["usage-compact"],["usage-compact","usage-compact-link"]],i=null,l=0;l<s.length&&!i;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),s[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var c=t.getBoundingClientRect().width,d=c/2,u=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-u,m=r.getBoundingClientRect().left-u,v=Math.min(d-p,m-d)-be,y=Math.min(520,c*.4);if(2*v>=ci)i={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(m-p>=oe+2*be){var M=p+be+oe/2,E=m-be-oe/2;i={mode:"icon",width:oe,left:Math.min(Math.max(d,M),E),level:l}}}i||(i={mode:"icon",width:oe,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+be+oe/2,0),level:s.length-1}),t.classList.toggle("search-icon",i.mode==="icon"),i.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(i.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(i.left)+"px"),zo=Go(t,n,r)}}function ui(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(a){t||(t=!0,requestAnimationFrame(function(){t=!1,Ko(a===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(a){var s=e.querySelector(a);s&&r.observe(s)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),Ko(!0)}}function fi(){var e=document.querySelector("#main-column > .title-bar-content"),t=document.getElementById("top-bar");if(!(!e||!t)){var n=function(){t.classList.toggle("title-bar-hidden",e.classList.contains("hidden"))};n(),new MutationObserver(n).observe(e,{attributes:!0,attributeFilter:["class"]})}}function Yo(){var e=window.matchMedia(si);Wo(e.matches),e.addEventListener("change",function(){Wo(e.matches)}),fi(),ui()}var $o={},st={},I=null,B=null,j=null,Xo=0,Zo=[],Ne={},lt=null;function Jo(e){$o[e.id]=e}function it(e,t){st[e]=t}function ea(e,t){var n=$o[e];n&&(j=n,Xo=0,Zo=[],lt=t||null,pi(),Oe(n.steps[0].id),B.classList.remove("hidden"),I.classList.remove("hidden"),setTimeout(function(){I.focus()},50))}function ye(){B&&B.classList.add("hidden"),I&&I.classList.add("hidden");var e=lt;j=null,lt=null,e&&e()}function ta(){gi(),hi()}function pi(){I||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&ye()}),I=document.createElement("div"),I.className="playbook-modal hidden",I.setAttribute("tabindex","-1"),I.addEventListener("keydown",function(e){e.key==="Escape"&&ye()}),B.appendChild(I),document.body.appendChild(B))}function Oe(e){if(j){for(var t=null,n=0,r=0;r<j.steps.length;r++)if(j.steps[r].id===e){t=j.steps[r],n=r;break}if(t){if(Xo=n,Zo.push(e),t.condition&&t.branches){var a=t.condition(),s=t.branches[a]||t.branches.default;if(s){Oe(s);return}}mi(t)}}}function mi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,a=0,s=0;s<t.steps.length;s++)t.steps[s].condition||(a++,t.steps[s].id===e.id&&(r=a));var i="";i+='<div class="playbook-header">',i+='<div class="playbook-header-left">',i+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",i+='<span class="playbook-title">'+ae(t.title)+"</span>",i+="</div>",i+='<button class="playbook-close" title="Close">&times;</button>',i+="</div>",i+='<div class="playbook-progress">';for(var l=0;l<n;l++){var c="playbook-progress-dot";l+1<r?c+=" done":l+1===r&&(c+=" active"),i+='<span class="'+c+'"></span>'}i+="</div>",i+='<div class="playbook-body">',i+='<h2 class="playbook-step-title">'+ae(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(i+='<div class="playbook-step-body">'+d+"</div>",e.note&&(i+='<div class="playbook-step-note">'+ae(e.note)+"</div>"),i+="</div>",e.actions&&e.actions.length>0){i+='<div class="playbook-actions">';for(var u=0;u<e.actions.length;u++){var p=e.actions[u],m="playbook-btn";u===0?m+=" playbook-btn-primary":m+=" playbook-btn-secondary",i+='<button class="'+m+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+ae(p.label)+"</button>"}i+="</div>"}I.innerHTML=i,D();var v=I.querySelector(".playbook-close");v&&v.addEventListener("click",ye);for(var y=I.querySelectorAll(".playbook-btn"),M=0;M<y.length;M++)(function(k){k.addEventListener("click",function(){var A=k.dataset.action,h=k.dataset.next;A&&st[A]?(k.disabled=!0,k.textContent+="...",st[A](function(){h?Oe(h):(Qo(j.id),ye())})):h?Oe(h):(Qo(j.id),ye())})})(y[M]);for(var E=I.querySelectorAll("[data-copy-url]"),P=0;P<E.length;P++)(function(k){k.addEventListener("click",function(A){A.stopPropagation();var h=k.dataset.copyUrl;navigator.clipboard.writeText(h).then(function(){k.textContent="Copied!",setTimeout(function(){k.textContent="Copy"},1500)})})})(E[P])}function Qo(e){Ne[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(Ne))}catch{}}function gi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");Ne=e||{}}catch{Ne={}}}function hi(){if(Jo({id:"push-notifications",title:"Push Notifications",icon:"\u{1F514}",description:"Get notified when Claude finishes a long task",tipMatch:function(t){return t.indexOf("Push notification")!==-1},steps:[{id:"intro",title:"Never miss a response",body:"When Claude is working on a long task, you can walk away and get a push notification the moment it's done. Works even when Clay is in the background.",actions:[{label:"Enable notifications",action:"notif_request",next:"check_perm"},{label:"Not now",next:""}]},{id:"check_perm",condition:function(){return typeof Notification>"u"?"unsupported":Notification.permission},branches:{granted:"test",denied:"denied",default:"denied",unsupported:"unsupported"}},{id:"test",title:"Let's test it!",body:"Click below to send a test notification. You should see it pop up from your system.",actions:[{label:"Send test notification",action:"notif_test",next:"check_test"},{label:"Skip",next:"done"}]},{id:"check_test",title:"Did you see it?",body:"A notification should have appeared from your system just now.",actions:[{label:"Yes, it worked!",next:"done"},{label:"No, nothing appeared",next:"troubleshoot"}]},{id:"troubleshoot",title:"Troubleshooting",body:function(){var t=navigator.platform&&navigator.platform.indexOf("Mac")!==-1,n="your browser",r=navigator.userAgent||"";r.indexOf("Arc")!==-1?n="Arc":r.indexOf("Edg/")!==-1?n="Edge":r.indexOf("Firefox")!==-1?n="Firefox":r.indexOf("Chrome")!==-1?n="Chrome":r.indexOf("Safari")!==-1&&(n="Safari");var a=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",s="The browser says permission is granted, but the notification didn't show.<br><br>";return a&&(s+="\u{1F512} <strong>Untrusted certificate?</strong><br>If you're using a self-signed or untrusted TLS certificate, some browsers silently block notifications even on HTTPS.<br>Run <strong>mkcert -install</strong> on the server to trust the root CA, or add the certificate to your system keychain as trusted.<br><br>"),s+="<strong>Also check your OS notification settings:</strong><br>",t?s+="<strong>1.</strong> Open <strong>System Settings \u2192 Notifications</strong><br><strong>2.</strong> Find <strong>"+n+"</strong> in the list<br><strong>3.</strong> Make sure <strong>Allow Notifications</strong> is turned on<br><strong>4.</strong> Check that <strong>Do Not Disturb</strong> / Focus mode is off<br>":s+="<strong>1.</strong> Make sure notifications are enabled for <strong>"+n+"</strong><br><strong>2.</strong> Check that Do Not Disturb / Focus mode is off<br>",s+="<br>After adjusting, come back and try again.",s},actions:[{label:"Try again",action:"notif_test",next:"check_test"},{label:"I'll fix it later",next:"done"}]},{id:"denied",title:"Permission needed",body:function(){var t=!window.isSecureContext||location.protocol==="http:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1"&&location.hostname!=="[::1]";if(t)return"\u26A0\uFE0F <strong>Insecure context detected.</strong><br><br>Notifications require a <strong>secure context</strong> (HTTPS or localhost). You're accessing Clay over <strong>"+location.protocol+"//"+location.hostname+"</strong>, so the browser automatically blocks notifications.<br><br><strong>How to fix:</strong><br><strong>1.</strong> Access Clay via <strong>https://</strong> (set up a TLS certificate)<br><strong>2.</strong> Or access via <strong>localhost:"+location.port+"</strong> instead of an IP address<br>";var n="chrome://settings/content/notifications",r=navigator.userAgent||"";return r.indexOf("Firefox")!==-1?n="about:preferences#privacy":r.indexOf("Edg/")!==-1?n="edge://settings/content/notifications":r.indexOf("Arc")!==-1&&(n="arc://settings/content/notifications"),'Your browser blocked the notification permission.<br><br><strong>1.</strong> Click the lock icon in the address bar<br><strong>2.</strong> Find "Notifications" and set it to "Allow"<br><strong>3.</strong> Reload the page<br><br>Or paste this into your address bar:<br><div style="display:flex;align-items:center;gap:6px;margin-top:6px"><code style="font-size:12px;color:var(--accent);flex:1;user-select:all">'+n+'</code><button class="playbook-btn-secondary" style="padding:3px 8px;font-size:11px" data-copy-url="'+n+'">Copy</button></div>'},actions:[{label:"Got it",next:""}]},{id:"unsupported",title:"Not supported",body:"Your browser doesn't support notifications. Try Chrome, Edge, or Firefox for the best experience.",actions:[{label:"Got it",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"You'll now get a notification whenever Claude finishes processing. This works even when Clay is minimized or in another tab.",note:"You can toggle notifications anytime from the header bar.",actions:[{label:"Done",next:""}]}]}),it("notif_request",function(t){if(typeof Notification>"u"){t();return}Notification.requestPermission().then(function(n){if(n==="granted")try{localStorage.setItem("notif-alert","1");var r=document.getElementById("notif-toggle-alert");r&&(r.checked=!0)}catch{}t()}).catch(function(){t()})}),it("notif_test",function(t){if(typeof Notification>"u"){t();return}if(Notification.permission!=="granted"){Notification.requestPermission().then(function(n){n==="granted"?e(t):t()}).catch(function(){t()});return}e(t)}),location.protocol==="https:"){let t=function(){var a=navigator.userAgent||"",s=navigator.platform||"";return s.indexOf("Mac")!==-1||a.indexOf("Mac")!==-1?"mac":s.indexOf("Win")!==-1||a.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var a=t(),s="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return a==="mac"?(s+="<strong>macOS \u2014 run in Terminal:</strong><br>",s+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):a==="windows"?(s+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",s+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(s+="<strong>Linux \u2014 run in terminal:</strong><br>",s+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),s+='<br><div style="padding:8px 10px;background:var(--bg-deeper);border-radius:6px;border-left:3px solid var(--accent)"><strong style="font-size:11px">Or ask Claude Code:</strong><br><code style="font-family:monospace;font-size:12px;line-height:1.5;color:var(--text-secondary)">Install ~/Downloads/clay-ca.pem as a trusted root certificate</code></div>',s+="<br>Then <strong>restart your browser</strong> to apply the change.",s},r=function(a){return'<div style="margin-top:8px;position:relative;background:var(--bg-deeper);border-radius:6px;padding:8px 10px"><code style="display:block;font-family:monospace;font-size:12px;word-break:break-all;line-height:1.5;padding-right:50px">'+ae(a)+'</code><button class="playbook-btn-secondary" style="position:absolute;top:8px;right:8px;padding:2px 8px;font-size:11px;white-space:nowrap" data-copy-url="'+ae(a)+'">Copy</button></div>'};Jo({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(a){return a.indexOf("certificate")!==-1||a.indexOf("Certificate")!==-1},steps:[{id:"intro",title:"Getting certificate warnings?",body:"Clay generates a local CA certificate for secure HTTPS connections. Your browser may show warnings until you install and trust this certificate on your device.",actions:[{label:"Download certificate",action:"cert_download",next:"install"},{label:"Not now",next:""}]},{id:"install",title:"Install the certificate",body:n,actions:[{label:"Done, I installed it",next:"done"},{label:"I'll do it later",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"After restarting your browser, certificate warnings should disappear. If you still see them, make sure you ran the terminal command with admin privileges.",actions:[{label:"Done",next:""}]}]}),it("cert_download",function(a){var s=document.createElement("a");s.href="/ca/download",s.download="clay-ca.pem",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(a,500)})}function e(t){try{var n=new Notification("Clay",{body:"Notifications are working! \u{1F389}",tag:"clay-test-"+Date.now()});n.onclick=function(){window.focus(),n.close()},setTimeout(function(){try{n.close()}catch{}},5e3)}catch(r){console.warn("[Playbook] Notification failed:",r)}setTimeout(t,800)}}function ae(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function na(e){var t=document.createElement("span");t.className="stt-meter",t.setAttribute("aria-hidden","true");var n=document.createElement("canvas");t.appendChild(n);var r=n.getContext("2d"),a=null,s=0,i=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function c(d){a=null;var u=o.get("speechActive");if(!(!u||u.id!==e||!t.isConnected||!r)&&(a=requestAnimationFrame(c),!(d-s<(l?100:32)))){s=d;var p=t.clientWidth,m=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(m*v))&&(n.width=Math.round(p*v),n.height=Math.round(m*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,m);var y=getComputedStyle(t),M=r.createLinearGradient(0,0,p,0);M.addColorStop(0,y.getPropertyValue("--brand-green").trim()||y.color),M.addColorStop(.5,y.getPropertyValue("--brand-blue").trim()||y.color),M.addColorStop(1,y.getPropertyValue("--brand-green").trim()||y.color),r.fillStyle=M;for(var E=u.audioSignal,P=E?E.levels:[],k=E?Date.now()-E.updatedAt:0,A=Math.max(0,1-Math.max(0,k-250)/900),h=Math.max(2,Math.floor(p/4)),b=Math.round(Math.min(160,Math.max(80,h))*1.25),R=l?0:Math.min(1,k/20),S=0;S<h;S++){var _=P.length-b+S/(h-1)*(b-1)+R,N=Math.floor(_),Le=_-N,Q=P[N]||0,Te=P[Math.min(N+1,P.length-1)]||0,$=(Q+(Te-Q)*Le)*A,O=i[S]||0,X=l?$:O+($-O)*($>O?.5:.24);i[S]=X;for(var G=1+X*(m*.46-1),Re=Math.min(1,(S+1)/8,(h-S)/8),Z=0;Z<=m*.48;Z+=3.2){var Ye=Math.exp(-Math.pow(Z/G,2)*1.7);if(!(Ye<.035)){var At=.35+Ye*.65;r.globalAlpha=(.12+Ye*.78)*Re,r.beginPath(),r.arc((S+.5)*p/h,m/2+Z,At,0,Math.PI*2),r.fill(),Z&&(r.beginPath(),r.arc((S+.5)*p/h,m/2-Z,At,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&a===null&&(a=requestAnimationFrame(c)),!d&&a!==null&&(cancelAnimationFrame(a),a=null,i=[])}}}function ra(e,t,n){var r=document.getElementById(e),a=document.getElementById(t),s=document.getElementById(n);if(!r||!a||!s||r.dataset.speechBound)return;var i=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||s,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||i;r.addEventListener("click",Fe),r.dataset.speechBound="true",r.classList.add("stt-button");var c=document.createElement("span");c.className="stt-controls",r.before(c),c.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=ee("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",c.appendChild(d),d.addEventListener("click",function(){Fe(),Be(d)});var u=document.createElement("div");u.className="stt-progress",u.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var m=document.createElement("span");m.className="stt-timer",m.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=ee("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){te(),o.set({speechRetry:null})});var y=na(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",dr);var E=document.createElement("a");E.textContent="Provider account",E.target="_blank",E.rel="noopener noreferrer";var P=document.createElement("button");P.type="button",P.textContent="Dismiss",P.addEventListener("click",function(){or(e,"")}),u.append(v,y.element,m,p,M,E,P),i.prepend(u),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=o.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?lr():te();return}var b=nt(),R=o.get("speechSettings");if(b.provider==="browser"&&!et().available){Be(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){Be(d);return}b.provider==="browser"?ar(e,a):sr(e,a,b)}),a.addEventListener("beforeinput",function(){var h=o.get("speechActive");h&&h.id===e&&te("Voice input stopped so you can edit your draft."),o.set({speechRetry:null})}),a.addEventListener("input",function(){var h=o.get("speechActive");h&&h.id===e&&!h.writing&&te()});function k(){var h=o.get("speechActive"),b=!!h&&h.id===e,R=nt(),S=Sr(R.provider),_=R.provider==="browser"?o.get("speechBrowserIdentity"):null,N=b&&h.model&&h.phase!=="recording",Le=b&&!!h.autoSend;i.classList.toggle("stt-recording",b),u.classList.toggle("stt-auto-send",Le),u.classList.toggle("stt-progress-active",b),u.classList.toggle("stt-progress-pending",!!N);var Q=b?l:i;(u.parentElement!==Q||u!==Q.firstElementChild)&&Q.prepend(u),y.update(b?h:null),d.hidden=b,r.disabled=a.disabled||a.readOnly||!o.get("speechSettings"),d.disabled=a.disabled||a.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var Te=b?Le?"Cancel pending voice send":N?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",Te+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=Te+" \xB7 "+R.name;var $=[b,N,S&&S.id,_&&_.id].join(":");if(r.dataset.speechIcon!==$){if(r.dataset.speechIcon=$,r.innerHTML=ee(b?N?"x":"square":"mic"),!b&&(S||_&&_.icon)){var O=document.createElement("img");O.className="stt-vendor-badge",O.src=S?S.icon:_.icon,O.alt="",r.appendChild(O)}D()}var X=(o.get("speechStatuses")||{})[e]||"",G=(o.get("speechErrors")||{})[e];u.classList.toggle("stt-progress-error",!!G),p.setAttribute("role",G?"alert":"status"),P.hidden=!G,E.hidden=!G||!S,S&&(E.href=S.url),R.provider==="browser"&&!rr()&&(X="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(X="Voice input requires a secure HTTPS connection."),p.textContent=X,m.textContent=b&&h.startTime?Math.floor((Date.now()-h.startTime)/6e4)+":"+String(Math.floor((Date.now()-h.startTime)/1e3)%60).padStart(2,"0"):"",v.hidden=!b;var Re=o.get("speechRetry");M.hidden=!Re||Re.id!==e,u.hidden=!b&&!G&&M.hidden}o.subscribe(k);var A=new MutationObserver(k);A.observe(a,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function Fe(){o.set({speechBrowserIdentity:et()})}function oa(){Fe(),window.addEventListener("focus",Fe),ir(),wr(),ra("stt-btn","input","input-wrapper"),ra("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Ae(),window.addEventListener("focus",Ae);try{window.top.document.addEventListener("clay:speech-settings-saved",Ae)}catch{}}var g=null,T=null,Se=null;function we(){return document.body.dataset.myDisplayName||"Clay user"}function se(e){if(g){var t=g.querySelector("#account-ai-section");t&&Cr(t),g.remove(),g=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+we()),document.removeEventListener("pointerdown",aa),document.removeEventListener("focusin",ia),document.removeEventListener("keydown",sa),window.removeEventListener("resize",ie),o.set({defaultAiInlineEditing:!1}),e&&Se&&document.contains(Se)&&Se.focus({preventScroll:!0}),Se=null}}function ut(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function aa(e){!g||g.contains(e.target)||T.contains(e.target)||ut(e.target)||se(!1)}function ia(e){!g||g.contains(e.target)||T.contains(e.target)||ut(e.target)||se(!1)}function sa(e){e.key==="Escape"&&(ut(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),se(!0)))}function ie(){if(!(!g||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));g.style.width=t+"px",g.style.left=n+"px",g.style.top=Math.max(12,e.top-g.offsetHeight-8)+"px"}}function dt(e){var t=g&&g.querySelector(".account-identity-copy");t&&(t.innerHTML='<button type="button" id="account-name-edit" class="account-name-display"><span></span><i data-lucide="pencil" aria-hidden="true"></i></button><small>Personal account</small>',t.querySelector("span").textContent=we(),t.querySelector("#account-name-edit").addEventListener("click",vi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function vi(){var e=g&&g.querySelector(".account-identity-copy");if(e){var t=document.createElement("input");t.id="account-profile-name",t.setAttribute("aria-label","Display name"),t.className="account-name-input",t.type="text",t.maxLength=50,t.autocomplete="name",t.value=o.get("accountNameDraft")===void 0?tt().name||"":o.get("accountNameDraft"),t.addEventListener("input",function(){o.set({accountNameDraft:t.value})}),e.innerHTML="",e.appendChild(t);var n=document.createElement("small");n.textContent="Enter to save \xB7 Escape to cancel",e.appendChild(n),t.addEventListener("keydown",function(r){r.key==="Enter"?(r.preventDefault(),t.disabled=!0,n.textContent="Saving\u2026",cr({name:t.value.trim()}).then(function(){o.set({accountNameDraft:void 0}),dt(!0)}).catch(function(a){t.disabled=!1,n.textContent=a.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),o.set({accountNameDraft:void 0}),dt(!0)),r.stopPropagation()}),t.focus(),t.select()}}function bi(){var e=g&&g.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),ie())}function yi(){var e=g.querySelector("#account-avatar-edit"),t=g.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),a=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(s){s.stopPropagation(),bi()}),t.addEventListener("click",function(s){s.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var s=r.files&&r.files[0];if(s){var i=new Image,l=URL.createObjectURL(s);i.onload=function(){pr(i,l,function(c){URL.revokeObjectURL(l),fr(c).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},i.src=l}}),a.addEventListener("click",function(){ur(),t.hidden=!0})}function Si(){g=document.createElement("div"),g.id="account-popover",g.className="account-popover",g.setAttribute("role","dialog"),g.setAttribute("aria-label","Account");var e=tt(),t=document.createElement("div");t.className="account-menu-identity",t.innerHTML='<button type="button" id="account-avatar-edit" class="account-avatar-edit" aria-label="Edit avatar"><img src="'+(document.body.dataset.myAvatarUrl||"")+'" alt=""></button><div class="account-identity-copy"></div><button type="button" class="account-settings-button" aria-label="User Settings" title="User Settings"><i data-lucide="settings" aria-hidden="true"></i></button>',t.querySelector("#account-avatar-edit img").alt=e.name||"Clay user";var n=document.createElement("div");n.id="account-avatar-editor",n.className="account-avatar-editor",n.hidden=!0,n.innerHTML='<button type="button" id="account-avatar-upload">Upload photo</button><button type="button" id="account-avatar-generate">Generate avatar</button><input id="account-avatar-file" type="file" accept="image/*">',g.appendChild(t),g.appendChild(n);var r=document.createElement("section");r.id="account-ai-section",r.className="account-inline-section account-ai-section",r.setAttribute("aria-label","Default AI"),g.appendChild(r),kr(r),t.querySelector(".account-settings-button").addEventListener("click",wi),document.body.appendChild(g),dt(),yi(),ct(),window.lucide&&window.lucide.createIcons({nodes:[g]}),ie()}function ct(){var e=document.getElementById("cursor-share-toggle");if(e){var t=o.get("cursorSharingHydrated")===!0,n=t&&o.get("cursorSharingEnabled")===!0,r=o.get("cursorSharingPending")!==null&&o.get("cursorSharingPending")!==void 0,a=o.get("connected")!==!1,s=o.get("cursorSharingError"),i=!!s&&!t&&a,l=t&&!n&&!r&&!s&&a;e.hidden=o.get("isMultiUserMode")!==!0,e.removeAttribute("role"),e.removeAttribute("aria-checked"),e.setAttribute("aria-pressed",n?"true":"false"),e.classList.toggle("on",n),e.classList.toggle("off",l),e.classList.toggle("pending",r),e.disabled=r||!a||!t&&!i;var c=r?"waiting":a?s?i?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+c);var d=r?"Cursor sharing is waiting for confirmation.":a?s?i?"Cursor sharing is unavailable. Click to retry.":"Cursor sharing is unavailable.":t?n?"Your cursor is visible to others. Click to stop sharing.":"Cursor sharing is off. Click to share your cursor.":"Cursor sharing is unavailable.":"Cursor sharing is offline.";Un(e,d)}}function wi(e){e.stopPropagation(),se(!0),Er()}function ki(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(o.get("cursorSharingError")&&o.get("cursorSharingHydrated")!==!0){Br();return}Ar(o.get("cursorSharingEnabled")!==!0)}}function Ci(){var e=g&&g.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function Mi(){g||la(),o.set({defaultAiInlineEditing:!0}),Ci()}function la(){if(g){se(!0);return}Se=document.activeElement,Si(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+we()),document.addEventListener("pointerdown",aa),document.addEventListener("focusin",ia),document.addEventListener("keydown",sa),window.addEventListener("resize",ie)}function da(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",la),document.addEventListener("clay:open-account-default-ai",Mi);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",ki),ct(),T.setAttribute("aria-label","Open account menu for "+we()),o.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&o.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&se(!1),ct(),g&&ie()}),document.addEventListener("clay:profile-updated",function(){if(g){var t=g.querySelector(".account-name-display span");t&&(t.textContent=we());var n=g.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",ie)}}var Ei=[{id:"file-browser-btn",icon:"folder-tree",label:"File browser"},{id:"terminal-sidebar-btn",icon:"square-terminal",label:"Terminal",countId:"terminal-sidebar-count"},{id:"sticky-notes-sidebar-btn",icon:"sticky-note",label:"Sticky Notes",countId:"sticky-notes-sidebar-count"},{id:"project-logs-btn",icon:"notebook-tabs",label:"Logs",countId:"project-logs-count"},{id:"mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mcp-sidebar-count"},{id:"scheduler-btn",icon:"calendar-clock",label:"Scheduled"},{id:"issues-btn",icon:"circle-dot",label:"Issues"},{id:"shared-browser-btn",icon:"globe",label:"Browser"}],Pi=[{id:"mate-memory-btn",icon:"brain",label:"Memory",countId:"mate-memory-count"},{id:"mate-knowledge-btn",icon:"book-open",label:"Knowledge",countId:"mate-knowledge-count"},{id:"mate-sticky-notes-btn",icon:"sticky-note",label:"Sticky Notes"},{id:"mate-debates-btn",icon:"messages-square",label:"Debates"},{id:"mate-mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mate-mcp-sidebar-count"}],de={session:{tools:Ei,fixedTools:[{id:"you-button",icon:"user-round",label:"Me",countId:"me-unread-badge",fixed:!0,scope:"clay"}],activeContainerId:"session-actions",hiddenSectionId:"session-actions-hidden"},mate:{tools:Pi,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ii={"skills-btn":"mcp-btn"},xi={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},ca=["git-sidebar-btn","loop-tool-btn","debates-btn"];function le(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function pa(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],a={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return a;for(var s=e==="mate"?xi:Ii,i=Object.keys(s),l=0;l<i.length;l++){var c=i[l],d=s[c],u=le(a.order,c)!==-1,p=le(a.hidden,c)!==-1;if(!(!u&&!p)){var m=le(a.order,d)!==-1||le(a.hidden,d)!==-1;a.order=fa(a.order,c,d,m),a.hidden=fa(a.hidden,c,d,m),a.migrated=!0}}if(e!=="session")return a;for(var v=0;v<ca.length;v++){var y=ca[v];le(a.order,y)===-1&&le(a.hidden,y)===-1||(a.order=ua(a.order,y),a.hidden=ua(a.hidden,y),a.migrated=!0)}return a}function ua(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function fa(e,t,n,r){for(var a=[],s={},i=0;i<e.length;i++){var l=e[i];if(l===t){if(r)continue;l=n}s[l]||(s[l]=!0,a.push(l))}return a}var He={},q=null,ce=null;function ha(){for(var e in de)Li(e);Ri(),D()}function Li(e){var t=de[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(a){n.appendChild(ma(a,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(ma(t.tools[r],e));n.addEventListener("dragover",function(a){if(!(ce!==e||!q)){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="move");var s=Ti(n,a.clientX,a.clientY);s==null?(q.parentNode!==n||q.nextSibling)&&n.appendChild(q):s!==q&&n.insertBefore(q,s)}}),n.addEventListener("drop",function(a){ce===e&&a.preventDefault()})}}function ma(e,t){var n=document.createElement("button");n.id=e.id,n.type="button",n.className="palette-tile",n.title=e.label,n.setAttribute("aria-label",e.label),n.dataset.toolId=e.id,n.dataset.palette=t,n.draggable=!0,e.fixed&&(n.draggable=!1,n.dataset.fixed="true"),e.scope&&(n.dataset.scope=e.scope),e.id==="you-button"&&(n.classList.add("you-button"),n.setAttribute("aria-pressed","false"));var r=document.createElement("i");r.setAttribute("data-lucide",e.icon),n.appendChild(r);var a=document.createElement("span");if(a.className="tool-btn-label",a.textContent=e.label,n.appendChild(a),e.countId){var s=document.createElement("span");s.id=e.countId,s.className="sidebar-badge hidden",e.id==="you-button"&&(s.className="sidebar-badge me-unread-badge",s.hidden=!0),n.appendChild(s)}return n.addEventListener("dragstart",function(i){if(e.fixed){i.preventDefault();return}var l=n.parentNode;if(!l||l.id!==de[t].activeContainerId){i.preventDefault();return}q=n,ce=t,i.dataTransfer.effectAllowed="move";try{i.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),ce&&Di(ce),q=null,ce=null}),n}function Ti(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),a=null,s=Number.POSITIVE_INFINITY,i=0;i<r.length;i++)if(r[i].dataset.fixed!=="true"){var l=r[i].getBoundingClientRect(),c=n-(l.top+l.height/2),d=t-(l.left+l.width/2),u=Math.abs(c)*2+Math.abs(d),p=c<-l.height/2||Math.abs(c)<=l.height/2&&d<0;p&&u<s&&(s=u,a=r[i])}return a}function Ri(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(ga("session",e.session||null),ga("mate",e.mate||null))}).catch(function(){})}function ga(e,t){if(!t)return;var n=de[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var a=pa(e,t),s={};function i(v){if(!s[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),s[v]=!0)}}for(var l={},c=0;c<a.hidden.length;c++)l[a.hidden[c]]=!0;for(var d=0;d<a.order.length;d++)l[a.order[d]]||i(a.order[d]);for(var u=0;u<n.tools.length;u++)l[n.tools[u].id]||i(n.tools[u].id);for(var p=0;p<a.hidden.length;p++)i(a.hidden[p]);for(var m=0;m<n.tools.length;m++)i(n.tools[m].id)}function Di(e){He[e]&&clearTimeout(He[e]),He[e]=setTimeout(function(){He[e]=null,Ai(e)},250)}function Ai(e){var t=de[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],a=n.querySelectorAll("[data-tool-id]"),s=0;s<a.length;s++)a[s].dataset.fixed!=="true"&&r.push(a[s].dataset.toolId);fetch("/api/user/tool-palettes",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({palette:e,order:r,hidden:[]})}).catch(function(){})}}}var ke=[],ft=[],x=null,K=null,pt=null,U=!1,Ce="project",V=0,C=[];function va(e){e!=="project"&&e!=="mate"||(U&&W(!1),mt(e))}function Sa(){Bi(),K=x.querySelector(".cmd-palette-results"),pt=x.querySelector(".project-switcher-header");var e=o.get("currentSlug");e&&(ke=[e]);var t=o.get("dmTargetUser");t&&t.isMate&&t.id&&(ft=[t.id]),o.subscribe(function(d,u){d.currentSlug&&d.currentSlug!==u.currentSlug&&(ya(ke,d.currentSlug),ke=ke);var p=ba(d.dmTargetUser),m=ba(u.dmTargetUser);p&&p!==m&&ya(ft,p)});var n=x.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){W(!1)}),document.addEventListener("keydown",ji,!0),document.addEventListener("keyup",Ui,!0),window.addEventListener("blur",function(){U&&W(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),a=r?"\u2318E":"Ctrl+E",s=r?"\u2318M":"Ctrl+M",i=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");i&&(i.textContent=a,i.title="Switch project ("+a+")",i.addEventListener("click",function(){va("project")})),l&&(l.textContent=s,l.title="Switch mate ("+s+")",l.addEventListener("click",function(){va("mate")}));function c(){if(l){var d=o.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}c(),o.subscribe(function(d,u){(d.cachedMatesList!==u.cachedMatesList||d.projectMateDmsEnabled!==u.projectMateDmsEnabled)&&c()})}function Bi(){if(x=document.getElementById("project-switcher"),!x){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";x=document.createElement("div"),x.id="project-switcher",x.className="cmd-palette hidden project-switcher",x.innerHTML='<div class="cmd-palette-backdrop"></div><div class="cmd-palette-dialog project-switcher-dialog"><div class="project-switcher-header">Switch project</div><div class="cmd-palette-results"></div><div class="cmd-palette-footer project-switcher-footer"><span class="project-switcher-shortcuts">'+t+'<kbd class="proj-next-key">E</kbd> next \xB7 <kbd>\u21E7</kbd>'+t+'<kbd class="proj-prev-key">E</kbd> prev \xB7 <kbd>\u23CE</kbd> select \xB7 <kbd>Esc</kbd> cancel</span></div></div>',document.body.appendChild(x)}}function ba(e){return e&&e.isMate&&e.id?e.id:null}function ya(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function ji(e){if(e.key){var t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase();if(t&&(n==="e"||n==="m")){var r=n==="e"?"project":"mate";e.preventDefault(),e.stopPropagation(),U?Ce!==r?mt(r):e.shiftKey?qe(-1):qe(1):mt(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),W(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),W(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),qe(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),qe(-1);return}}}}function Ui(e){U&&(e.key==="Meta"||e.key==="Control")&&W(!0)}function mt(e){if(Ce=e,C=Oi(e),C.length===0){U&&W(!1);return}pt&&(pt.textContent=e==="mate"?"Switch mate":"Switch project"),_i(e),qi(),V=Ni(),gt(),x.classList.remove("hidden"),U=!0,D(),Ue(K)}function _i(e){var t=x.querySelector(".proj-next-key"),n=x.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Ni(){if(C.length===0)return 0;for(var e=Ce==="mate"?ft:ke,t=wa(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var a=0;a<C.length;a++)if(C[a].key===r&&!C[a].disabled)return a}}for(var s=0;s<C.length;s++)if(!C[s].disabled&&C[s].key!==t)return s;for(var i=0;i<C.length;i++)if(!C[i].disabled)return i;return 0}function wa(){if(Ce==="mate"){var e=rt(o.snap());return e?e.id:null}return o.get("currentSlug")}function Oi(e){return e==="mate"?Hi():Fi()}function Fi(){var e=(ge()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=no(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===o.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Hi(){var e=o.get("cachedMatesList")||[],t=rt(o.snap()),n=t?t.id:null;return e.map(function(r){return{key:r.id,title:r.displayName||r.name||r.id,icon:null,avatarUrl:qt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function W(e){if(U&&(U=!1,x.classList.add("hidden"),!!e)){var t=C[V];!t||t.disabled||(Ce==="mate"?t.key!==wa()&&so(t.key):t.key!==o.get("currentSlug")&&je(t.key))}}function qe(e){if(C.length!==0){for(var t=e>0?1:-1,n=V,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){V=n,gt();return}}}function qi(){if(K){K.innerHTML="";for(var e=0;e<C.length;e++)K.appendChild(Vi(C[e],e))}}function Vi(e,t){var n=document.createElement("button");n.type="button",n.className="cmd-palette-item project-switcher-item",e.disabled&&n.classList.add("disabled"),e.disabled&&e.disabledReason&&(n.title=e.disabledReason),e.external&&(n.title=ro(e.title)),n.dataset.index=String(t);var r=document.createElement("div");if(r.className="cmd-palette-item-icon",e.icon)r.textContent=e.icon;else if(e.avatarUrl){var a=document.createElement("img");a.src=e.avatarUrl,a.alt="",a.className="project-switcher-avatar",r.appendChild(a)}else{var s=document.createElement("i");s.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(s)}e.external&&oo(r,"project-switcher-external-badge"),n.appendChild(r);var i=document.createElement("div");i.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var c=document.createElement("span");if(c.className="cmd-palette-item-title",c.textContent=e.title,l.appendChild(c),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var u=document.createElement("span");u.className="project-switcher-disabled-reason",u.textContent=e.disabledReason,l.appendChild(u)}return i.appendChild(l),n.appendChild(i),n.addEventListener("mouseenter",function(){e.disabled||(V=t,gt())}),n.addEventListener("click",function(){e.disabled||(V=t,W(!0))}),n}function gt(){if(K){for(var e=K.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===V);var n=e[V];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var Wi=/^[a-zA-Z0-9_-]{1,120}$/;function ht(){return Array.prototype.filter.call(document.querySelectorAll("iframe"),function(e){try{var t=new URL(e.src,window.location.href);return t.origin===window.location.origin&&t.searchParams.get("pane")==="1"}catch{return!1}})}function vt(e){var t=Ao();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function ka(e){return typeof e=="string"&&Wi.test(e)}function bt(e){return e===null||ka(e)}function zi(e){var t=e&&typeof e=="object"?e.preference:null;if(!t||typeof t!="object"||!ka(e.themeId)||e.userId!==null&&(typeof e.userId!="string"||!e.userId||e.userId.length>200)||typeof t.configured!="boolean"||t.mode!==null&&t.mode!=="light"&&t.mode!=="dark"||t.background!==void 0&&["plain","workshop"].indexOf(t.background)<0)return!1;var n=$e.normalizeCustom(t.customBackgroundColors||[]);return!n||t.backgroundColor!==void 0&&!$e.isColor(t.backgroundColor,n)?!1:bt(t.theme)&&bt(t.lightTheme)&&bt(t.darkTheme)}function Ca(){if(o.get("paneMode")){if(window.parent===window)return;window.addEventListener("message",function(e){if(!(e.origin!==window.location.origin||e.source!==window.parent)){var t=e.data;if(!(!t||t.type!=="clay-appearance"||!zi(t.snapshot))){var n=o.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Bo(t.snapshot)}}});return}Do(function(){ht().forEach(vt)}),o.subscribe(function(e,t){var n=Xe(e),r=Xe(t);(e.myUserId!==t.myUserId||n.background!==r.background||n.backgroundColor!==r.backgroundColor||JSON.stringify(n.customBackgroundColors)!==JSON.stringify(r.customBackgroundColors))&&ht().forEach(vt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&ht().indexOf(e.target)>=0&&vt(e.target)},!0)}var Gi=500,Ma=10,ue=null,yt=0,St=0,Me=!1,Ea=null;function Ve(){ue&&(clearTimeout(ue),ue=null)}function Pa(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){Ve();return}var t=e.touches[0];yt=t.clientX,St=t.clientY,Me=!1,Ea=e.target,ue=setTimeout(function(){ue=null,Me=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:yt,clientY:St});Ea.dispatchEvent(n)},Gi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(ue){var t=e.touches[0],n=t.clientX-yt,r=t.clientY-St;n*n+r*r>Ma*Ma&&Ve()}},{passive:!0}),document.addEventListener("touchend",function(e){Ve(),Me&&(Me=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){Ve(),Me=!1},{passive:!0}))}var Ia=!1,xa=!1;function wt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function Ki(e){return e?e.paneMode||wt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function La(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&o.get("connected")&&e.classList.add("hidden")}function Yi(e){return e?"/p/"+e+"/":null}function Ta(e){if(!xa){var t=Ki({surfaceLoaded:e.homeSurfaceLoaded,projectsLoaded:e.projectListLoaded,dockLoaded:e.homeDockPreferenceLoaded,surface:e.homePrimarySurface,currentSlug:e.currentSlug,pathname:location.pathname,paneMode:e.paneMode});if(t!=="wait"){if(xa=!0,t==="project"){if(!wt(location.pathname)){var n=Yi(e.currentSlug);n&&history.replaceState(null,"",n)}o.set({homeSurfaceBootResolved:!0}),La();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}o.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),La()}}}function Ra(){if(!Ia){if(Ia=!0,!wt(location.pathname)&&!o.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}o.subscribe(function(t){Ta(t)}),Ta(o.snap())}}var Ji=3600*1e3,Qi="(max-width: 768px)",kt=null,Ct=!1;function $i(e){if(typeof e!="number"||!isFinite(e)||e<0)return"";if(e=Math.floor(e),e<1e3)return String(e);for(var t=[[1e6,"m"],[1e3,"k"]],n=0;n<t.length;n++)if(e>=t[n][0]){var r=Math.floor(e/t[n][0]*10)/10;return(r%1===0?String(r):r.toFixed(1))+t[n][1]}return String(e)}function Aa(){var e=o.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?$i(e):"";t.textContent=r,t.classList.toggle("hidden",!r),n.setAttribute("aria-label",r?"Star Clay on GitHub, "+e+" stars":"Star Clay on GitHub")}}function Xi(){return!!(window.matchMedia&&window.matchMedia(Qi).matches)}function Da(){return Ct||Xi()?Promise.resolve():(Ct=!0,fetch("/api/github-stars",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&typeof e.stars=="number"&&(o.set({githubStarCount:e.stars}),Aa())}).catch(function(){}).then(function(){Ct=!1}))}function Ba(){document.getElementById("github-star")&&(Aa(),Da(),kt&&clearInterval(kt),kt=setInterval(Da,Ji))}function _a(){o.subscribe(function(e,t){if(e.sessionOriginId!==t.sessionOriginId||e.currentSlug!==t.currentSlug){o.set({activeBackgroundTasks:[],backgroundTaskCatalog:[]});return}e.backgroundTaskViewer!==t.backgroundTaskViewer&&document.querySelectorAll("[data-background-task]").forEach(function(n){var r=e.backgroundTaskViewer;n.setAttribute("aria-expanded",String(!!r&&n.dataset.backgroundTask===r.taskId))}),(e.activeBackgroundTasks!==t.activeBackgroundTasks||e.backgroundTaskCatalog!==t.backgroundTaskCatalog)&&Ua()}),Ua()}function Zi(e,t){if(typeof e!="number"||!isFinite(e)||e<=0)return"";var n=typeof t=="number"?t:Date.now(),r=Math.floor((n-e)/1e3);if(r<0&&(r=0),r<60)return r+"s";var a=Math.floor(r/60),s=r%60;if(a<60)return a+"m "+ja(s)+"s";var i=Math.floor(a/60);return i+"h "+ja(a%60)+"m"}function ja(e){return e<10?"0"+e:String(e)}function es(e){return!!(e&&e.ambient===!0)}function ts(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],a=0;a<r.length;a++)r[a]&&(es(r[a])?n.push(r[a]):t.push(r[a]));return{user:t,ambient:n}}function Ua(){var e=document.getElementById("background-tasks-bar");e&&e.remove();var t=ts(o.get("backgroundTaskCatalog")||o.get("activeBackgroundTasks")||[]),n=t.user.length?t.user.concat(t.ambient):[],r=document.getElementById("background-task-tabs");if(!n.length){r&&r.remove();return}var a=document.getElementById("messages");if(a){r||(r=document.createElement("div"),r.id="background-task-tabs",r.className="split-view-workers background-task-tabs",r.setAttribute("aria-label","Background tasks"),a.parentNode.insertBefore(r,a));var s=JSON.stringify(n.map(function(i){return[i.task_id,i.run_id,i.active,i.description]}));r.dataset.signature!==s&&(r.dataset.signature=s,r.textContent="",n.forEach(function(i){var l=document.createElement("span");l.className="split-view-worker-pill"+(i.ambient?" background-task-ambient":"");var c=document.createElement("button");c.type="button",c.className="split-view-worker-chip",c.dataset.backgroundTask=i.task_id,Nn(c,Ze(i)),i.preview&&_n(Ze(i),i.preview,!1),c.title=(i.ambient?"Housekeeping \xB7 ":"")+(i.description||"Background task")+(i.started_at?" \xB7 "+Zi(i.started_at):"")+(i.active===!1?" \xB7 Finished":" \xB7 Running"),c.setAttribute("aria-haspopup","dialog");var d=o.get("backgroundTaskViewer");c.setAttribute("aria-expanded",String(!!d&&d.taskId===i.task_id));var u=document.createElement("span");u.className="split-view-worker-dot",u.dataset.state=i.active===!1?"ready":"working";var p=document.createElement("span");if(p.className="split-view-worker-name",p.textContent=i.description||"Background task",u.setAttribute("aria-label",i.active===!1?"Finished":"Running"),c.append(u,p),c.addEventListener("click",function(){On(i)}),l.appendChild(c),i.active!==!1){var m=document.createElement("button");m.type="button",m.className="split-view-worker-remove",m.setAttribute("aria-label","Stop "+(i.description||"background task")),m.title="Stop task",m.innerHTML=ee("square"),m.addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"background_task_stop",requestId:crypto.randomUUID(),taskId:i.task_id,runId:i.run_id||null,sessionOriginId:o.get("sessionOriginId")}))}),l.appendChild(m)}r.appendChild(l)}),D())}}var xt=new URLSearchParams(location.search),pe=xt.get("pane")==="1";pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var J=Number(xt.get("session"));(!Number.isSafeInteger(J)||J<1)&&(J=null);pe&&document.body.classList.add("pane-mode");var ze=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),ns=document.body.dataset.homeProjectSlug||null,Ie=ze?ze[1]:ns,z=Ie?"/p/"+Ie+"/":"/",fe=Ie?"/p/"+Ie+"/ws":"/ws";pe&&(fe+="?pane=1",J&&(fe+="&session="+J),xt.get("contextual")==="1"&&(fe+="&contextual=1"));var f=function(e){return document.getElementById(e)},L=f("messages"),Ke=f("input"),rs=f("send-btn");var Pt=f("header-title"),gh=f("header-rename-btn"),os=f("slash-menu"),hh=f("suggestion-chips"),as=f("sidebar"),is=f("sidebar-overlay"),Ka=f("session-list"),ss=f("new-session-btn"),ls=f("hamburger-btn"),ds=f("sidebar-toggle-btn"),cs=f("sidebar-expand-btn"),us=f("image-preview-bar"),vh=f("connect-overlay");var fs="/claude-code-avatar.png";function Ya(e){De(e)}function ps(){return!1}function Ja(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Qa(e){eo(e)}function ms(){to()}var bh=f("project-list-section"),yh=f("project-list"),Sh=f("project-list-add"),gs=f("project-hint"),Na=f("project-hint-dismiss"),Ge=Ie||null;document.addEventListener("keydown",function(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"){var t=document.activeElement,n=t&&t.tagName;(n==="TEXTAREA"||n==="INPUT"||t&&t.isContentEditable)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?document.execCommand("redo",!1,null):document.execCommand("undo",!1,null))}},!0);document.addEventListener("keydown",function(e){e.key==="Escape"&&Tt()});Na&&Na.addEventListener("click",function(){gs.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",ot);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",ot);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",Tt);f("image-modal").querySelector(".image-modal-close").addEventListener("click",Tt);function Lt(e){dn(e)}function Tt(){cn()}var $a="";try{Ee=localStorage.getItem("clay-project-name-"+(Ge||"default")),Ee&&($a=Ee,Pt&&(Pt.textContent=Ee),Mt=f("title-bar-project-name"),Mt&&(Mt.textContent=Ee)),Et=localStorage.getItem("clay-project-icon-"+(Ge||"default")),Et&&(Pe=f("title-bar-project-icon"),Pe&&(Pe.textContent=Et,Ue(Pe),Pe.classList.add("has-icon")))}catch{}var Ee,Mt,Et,Pe;function Xa(e,t,n,r){un(e,t,n,r)}Bt({agentBehavior:{status:"idle",error:"",catalog:null,policy:null,effective:null,edits:{},saved:{}},networkSettings:{loaded:!1,busy:!1,confirming:!1,draft:"",saved:"",status:"",errorKind:"",requestId:0},vendorLoginBrowser:null,githubStarCount:null,sharedBrowser:null,sharedBrowsers:[],mcpSkillsWorkbench:{},mateKnowledgeWorkspaces:{},mateColorSave:null,mcpConnections:{screen:"list",servers:[],search:"",loaded:!1},sharedBrowserOpen:!1,sharedBrowserUi:{},sharedBrowserSettings:{},browserLinksBound:!1,basePath:z,wsPath:fe,paneMode:pe,paneSessionId:J,panePinPending:pe&&!!J,paneCommittedBinding:null,panePendingBinding:null,paneReady:!1,paneSuspended:!1,paneActivationGeneration:0,paneActivationTimer:null,panePointerBinding:null,paneRichDrafts:{},paneLayoutScrollLock:null,paneLastUserScrollTop:null,paneUserScrollIntent:null,paneUserScrollRevision:0,sessionRichDrafts:{},sessionActionEpoch:0,composerUploadingCount:0,deferredSessionSwitch:null,paneCallbackBinding:null,paneActionEvents:[],paneHeldKeys:{},rewindAction:null,handoffAction:null,authIdentityLoaded:!1,splitIdentityBlockedSocket:null,splitIdentityHydrated:!1,paneActivationUnsupported:!1,paneBindingSessions:[],splitPanes:null,splitGroups:[],splitViewWorkerConversation:null,splitViewWorkerRemoval:null,projectSplitViews:[],projectSplitViewRevision:0,projectSplitViewContextKey:null,projectSplitViewHydrated:!1,projectSplitViewPending:null,projectSplitViewError:"",projectSplitViewActiveId:null,projectSplitViewFocusedOrigin:null,projectSplitViewPreviewTree:null,projectSplitViewDrag:null,splitViewOrganizationDrag:null,projectSplitViewDividerDrag:null,projectSplitViewTranscriptScroll:{},projectSplitViewSuppressClick:null,projectSplitViewSocketGeneration:0,projectSplitViewRequestSocket:null,projectSplitViewRequestGeneration:null,projectSplitViewRequestOwnerId:null,projectSplitViewRequestSlug:null,sessionFolders:null,sessionFoldersSlug:null,sessionFolderCreate:null,sidebarCreationEffects:[],sessionSearch:null,sessionFolderViewMenu:null,sessionFolderLayouts:{},sessionFolderDrag:null,sessionFolderMenu:null,sessionFolderContext:null,sessionFolderModal:null,sessionContextMenu:null,sessionInlineRename:null,splitDelegations:{},pairResultStatus:[],notesTemporarilyHidden:!1,pairResultTrayOpen:!1,dmMode:!1,historyFrom:0,loadingMore:!1,historyTotal:0,replayingHistory:!1,historyReplayBatch:null,pendingSessionEntryNavigation:null,sessionEntryHighlight:null,sessionNavigationRequestId:null,projectName:$a,cwd:"",currentSlug:Ge,githubWorkPopoverBound:!1,githubWorkSessions:[],githubWorkProject:null,githubWorkRefresh:null,workPrimaryPending:null,activeProjectSlug:null,activeProjectMateId:null,activeProjectMateName:"",clayReturnTarget:null,contextualPrepared:null,contextualSubmitted:{},contextualClay:{mode:"closed",mateId:null},contextualConversationHistory:null,contextualConversationRequest:null,clayControlActivity:null,clayControlOrder:0,clayControlReceipts:[],clayControlForwarded:null,controlRuntimeId:null,studioDocumentSource:null,studioDocumentView:null,clayStudioRelays:{},clayStudioForwarded:{},clayStudioSurfaces:{},clayControlNotifications:[],clayControlFileView:null,clayControlTerminalViews:[],clayControlGitView:null,clayNavigationRendering:null,clayControlViewerRef:null,contextualSessionReady:!1,contextualSessionReceived:!1,contextualSessionUnavailable:!1,clayReturnPendingProjectSlug:null,activeSessionMateId:null,activeSessionMateName:"",sessionActivatedProjectSlug:null,sessionListProjectSlug:null,splitGroupsProjectSlug:null,socketPath:null,pendingHomeProjectSlug:null,homeProjectEmptyVisible:!1,homeShellVisible:!1,projectMateFilterMode:"all",projectMateFilterTurns:0,projectMateFilterActivated:!1,projectMateCreationActive:!1,projectMateCreationMateId:null,projectMateCreationSessionId:null,projectMateCreationRequestId:null,projectMateCreationPendingStart:!1,projectMateCreationAwaitingHistory:!1,projectMateCreationAwaitingMateList:!1,projectMateCreationHistoryReady:!1,projectMateCreationLocalId:null,projectMateCreationMessages:[],projectMateCreationPendingMateId:null,projectDebatePlanningActive:!1,projectDebatePlanningMateId:null,projectDebatePlanningSessionId:null,projectDebatePlanningLocalId:null,projectDebatePlanningRequestId:null,projectDebatePlanningPendingStart:!1,projectDebatePlanningAwaitingHistory:!1,projectDebatePlanningAwaitingMateList:!1,projectDebatePlanningHistoryReady:!1,projectDebatePlanningTopic:"",projectDebatePlanningMessages:[],projectDebatePlanningError:"",projectDebatePlanningRetryable:!1,debatesWorkbenchStatus:"idle",debatesWorkbenchRequestId:null,debatesWorkbenchItems:[],debatesWorkbenchError:"",debatesWorkbenchFilter:"all",debatesWorkbenchCreating:!1,debatesWorkbenchWide:!1,debatesWorkbenchFullscreen:!1,debatesWorkbenchScrollTop:0,pendingDebateNavigation:null,pendingProjectSessionNavigation:null,projectsHubVisible:!1,projectsHubMarkup:null,projectsHubList:[],projectListLoaded:!1,projectsAccessLoaded:!1,projectsHubRestoreRequested:!1,projectStart:bn(),projectStartFolder:yn(),onboardingStep:"welcome",onboardingIntent:null,currentProjectOwnerId:null,isOsUsers:!1,skipPermsEnabled:!1,autonomousSelectedMode:"normal",autonomousArming:!1,autonomousArmToken:null,autonomousArmRequestId:null,autonomousArmSessionId:null,autonomousActionRequestId:null,autonomousActionSessionId:null,autonomousCriteria:"",autonomousMaxContinuations:10,autonomousMaxMinutes:60,autonomousRun:null,autonomousExpanded:!1,loopInterviewBrief:null,loopInterviewEditing:!1,loopInterviewRunRequestId:null,loopInterviewRunSessionId:null,loopInterviewStarting:!1,loopInterviewRequestId:null,loopInterviewSessionId:null,slashCommands:[],processing:!1,scheduledMessageCorrelation:null,activeSessionId:null,speechActive:null,settingsSectionPage:null,settingsSectionScope:null,settingsSectionActive:null,settingsPageScroll:{},personalProvidersOpen:!1,personalProvidersLoading:!1,personalProvidersError:"",personalProvidersNotice:"",personalProviderSignInResults:{},personalProviderCatalog:null,personalProviderContext:null,personalProviderRequest:null,personalProviderRevision:null,personalProviderEditing:null,personalProviderRuntimeDetailsOpen:!1,personalProviderSigningIn:null,personalProviderInstall:null,personalProviderInstallBusy:!1,personalProviderInstallRequest:null,personalProviderInstallAwaiting:null,speechSettingsContextGeneration:0,speechSettings:null,speechSettingsRequest:0,speechSettingsSaving:!1,speechSettingsError:"",speechPopup:null,speechRetry:null,speechLang:"en-US",speechStatuses:{},speechErrors:{},speechLanguageSaving:!1,speechLifecycleBound:!1,askUserRequests:{},activeBackgroundTasks:[],backgroundTaskCatalog:[],backgroundTaskViewer:null,splitSessionPicker:null,splitSessionCreation:null,agentMessagePreviews:{},agentMessageBubble:null,workerMessagePreviewSubscription:null,workerActivityIndicators:{},sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest:null,filePaneInstances:{},activeFilePaneId:null,fileViewerIsPlantUml:!1,plantUmlPreviewJob:null,wireframeDraft:null,wireframeRenderQueue:[],wireframeRenderActive:null,wireframeRenderCache:[],pendingFileNavigation:null,rightWorkbenchOwner:null,rightWorkbenchRevision:0,fileViewerOpenRevision:0,cursorSharingEnabled:!1,cursorSharingHydrated:!1,cursorSharingPending:null,pendingOutboundMessages:[],pendingMessageQueue:{projectSlug:null,sessionId:null,revision:0,paused:!1,items:[],loading:!1,error:""},pendingMessageQueueRecovery:!1,pendingMessageQueueRequests:{},pendingMessageQueueEdit:null,pendingMessageQueueDrag:null,pendingMessageQueueFocusReturn:null,searchClayChatState:null,homeChatMateId:null,homeChatSessionId:null,homeChatSessionModel:null,homeChatSessionVendor:null,homeChatSessionModelLoading:!1,homeMateSessions:{},homeActiveSessionByMate:{},homePreferredMateId:null,homeSidebarCollapsed:!1,homeMatesCollapsed:!1,homeChatScope:"all",homeSubSurface:"chat",homeDebatesStatus:"idle",homeDebates:[],homeDebatesRequestId:null,homeDebatesError:"",homeSurfaceLoaded:!1,homePrimarySurface:null,homeSurfaceProjectSlug:null,homeSurfaceIntent:null,homeSurfaceBootResolved:!1,homeSurfaceRestoreRequested:!1,dockActiveToolId:null,dockOpen:!1,homeDockPreferenceLoaded:!1,dockFocus:!1,dockLibraryOpen:!1,dockBackstageOpen:!1,dockWidth:null,dockHasActivity:!1,dockActivityToolId:null,you:{},youActivity:{},youSequence:0,projectLogsOpen:!1,projectLogsWide:!1,projectLogsFullscreen:!1,projectLogsEntries:[],projectLogsSelectedRef:null,projectLogsView:"list",projectLogsCategory:"",projectLogsContextMode:"",projectLogsIsWorktree:!1,projectLogsListScroll:0,projectLogsListRequestId:null,projectLogsReadRequestId:null,projectLogsCommentRequestId:null,projectLogsCommentStatusEl:null,projectLogsDeleteRequestId:null,projectLogsCanDelete:!1,projectLogsUnread:0,projectLogsSeenRevisions:{},scheduledResultUnread:0,scheduledResultAutoFocusHandled:!1,scheduledResultFocusRef:null,scheduledResultPendingReadRef:null,scheduledResultSeenRefs:{},scheduledResultSessionRequestId:null,issuesOpen:!1,issuesView:"list",issuesSelected:null,issuesRows:[],issuesRequests:{},issueGithub:null,issuesViewRequest:null,issuesViewGeneration:0,issuesUpdateAvailable:null,issuesCache:{},issuesEpoch:0,issuesSearchTimer:null,issueLinkRequests:{},issueLinkOpenRef:null,scheduledTasksOpen:!1,scheduledTasksWide:!1,scheduledTasksFullscreen:!1,scheduledTaskRecords:[],scheduledTaskDraft:null,scheduledTaskEditingId:null,scheduledTaskNewSessionPending:!1,scheduledTaskInterviewRequestId:null,scheduledTaskActionRequestId:null,scheduledTaskListRequest:null,scheduledTaskInterviewId:null,scheduledTaskExpandedId:null,scheduledTaskDeleteId:null,scheduledTaskDraftForm:null,scheduledTaskEditForm:null,scheduledTaskCreateMenuOpen:!1,scheduledTaskManualRequest:null,installedTools:[],capsulesEnabled:!1,capsulesPreferenceLoaded:!1,homeToolRegistryLoaded:!1,toolScanErrors:[],defaultAiState:{loading:!1,saving:!1,refreshRequestId:null,saveRequestId:null,catalogRequestIds:{},catalogs:{},preference:null,selection:null,installedVendors:[],accountAvailable:!0,accountId:null,serverEpoch:null,canonicalRevision:0,error:""},defaultAiDraft:{vendor:"",model:"",effort:""},defaultAiDraftDirty:!1,defaultVendorState:{loading:!1,saving:!1,getRequestId:null,saveRequestId:null,preference:null,preferencePresent:!1,installedVendors:[],accountId:null,projectSlug:null,serverEpoch:null,canonicalRevision:0,error:""},projectSessionVisibilityState:{active:null,pending:null},dmTargetUser:null,dmKey:null,cachedMatesList:[],cachedDmFavorites:[],cachedAvailableBuiltins:[],projectMateDmsEnabled:!0,returningFromMateDm:!1,pendingMateInterview:null,pendingTermCommand:null,shellCommandMode:!1,shellCommandRunning:!1,pendingShellCommandId:null,mateProjectSlug:null,myUserId:null,contextViewPreferenceState:{mode:"off",canonicalMode:"off",preferencePresent:!1,loading:!1,saving:!1,requestId:null,saveRequestId:null,pendingSaves:[],accountId:null,serverEpoch:null,rejectedEpoch:null,canonicalRevision:0,error:""},contextViewOverride:null,isMultiUserMode:!1,dmUnread:{},dmRemovedUsers:{},cachedAllUsers:[],cachedOnlineIds:[],cachedDmConversations:[],sessionDrafts:{},messageUuidMap:[],currentMsgTs:null,richContextUsage:null,contextMeasurement:"unavailable",currentMsgEl:null,currentFullText:"",matePreThinkingEl:null,thinkingState:null,fileViewerFullscreen:!1,markdownSlidesActive:!1,markdownSlideIndex:0,markdownSlideCount:0,markdownSlideLevel:1,markdownSlidePreferredLevel:1,markdownSlideLevelExplicit:!1,currentModel:"",currentModels:[],modelListVendor:"",modelListStatus:"idle",modelListError:"",modelRequestId:"",modelSelectionPending:null,modelSelectionError:"",lastVendor:"",vendorInfo:{},rateLimitState:{},vendorUsageOverview:null,vendorUsageOpen:null,currentMode:"default",effectivePermissionMode:null,permissionCapabilities:{auto:!1,mcpOverride:!1},permissionModePendingByTarget:{},mcpPermissionModePendingByTarget:{},mcpPermissionModeOverrides:{},currentEffort:"medium",currentBetas:[],currentThinking:"adaptive",currentThinkingBudget:1e4,sessionFullAccess:!1,codexApproval:null,codexSandbox:null,codexWebSearch:null,ctxPopoverVisible:!1,headerContextEl:null,loopActive:!1,loopAvailable:!1,loopIteration:0,loopMaxIterations:0,loopBannerName:null,ralphPhase:"idle",ralphCraftingSessionId:null,ralphCraftingSource:null,ralphFilesReady:{promptReady:!1,judgeReady:!1,bothReady:!1},ralphPreviewContent:{prompt:"",judge:""},execModalShown:!1,debateStickyState:null,debateFloorMode:!1,debateConcludeMode:!1,debateEndedMode:!1,knownInstalledSkills:{},permissions:null,wizardData:{name:"",task:"",maxIterations:null,cron:null}});Ir({$:f,get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},messagesEl:L,addSystemMessage:oi});jo();Ca();jn();Pa();var hs={$:f,get ws(){return w()},get connected(){return o.get("connected")},get projectName(){return o.get("projectName")},messagesEl:L,sessionListEl:Ka,sidebar:as,sidebarOverlay:is,sidebarToggleBtn:ds,sidebarExpandBtn:cs,hamburgerBtn:ls,newSessionBtn:ss,headerTitleEl:Pt,showConfirm:Xa,onFilesTabOpen:function(){Oo(),Ho(),H()&&F()},requestKnowledgeList:function(){tr()},switchProject:function(e){ai(e)},openTerminal:function(){Ro()},showHomeHub:function(){Ya()},getUpcomingSchedules:hn,get multiUser(){return o.get("isMultiUserMode")},get myUserId(){return o.get("myUserId")},get projectOwnerId(){return o.get("currentProjectOwnerId")},get ownerLocked(){return o.get("ownerLocked")},openDm:function(e){Qa(e)},openMateWizard:function(){Ja()},openAddProjectModal:function(){Sn()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},o.get("dmRemovedUsers"));t[e]=!0,o.set({dmRemovedUsers:t})},getHistoryFrom:function(){return o.get("historyFrom")},get permissions(){return o.get("permissions")},get projectList(){return ge()||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]}};ha();_e([Uo,Jn,Qn,Zt,$n,en,Lr,Jr]);Lo(hs);var Rt=function(){return w()};nr(Rt);Zn(Rt);_e([gr]);Xn(Rt,{onShow:function(){er(),Co()}});vn({switchProject:function(e){ai(e)},currentSlug:function(){return o.get("currentSlug")},matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},dmConversations:function(){return o.get("cachedDmConversations")||[]},myUserId:function(){return o.get("myUserId")},selectSession:function(e){H()&&F();var t=document.getElementById("sticky-notes-panel");if(t&&!t.classList.contains("hidden")){var n=document.getElementById("sticky-notes-sidebar-btn");n&&n.click()}var r=w();r&&r.readyState===1&&r.send(JSON.stringify({type:"switch_session",id:e}))},openDm:function(e){Qa(e)},runAction:function(e){switch(e){case"createMate":Ja();break;case"openSettings":Pn();break;case"showHome":Ya();break}}});Sa();Kn();Xt();function vs(e){Rn(e)}function bs(){Dn()}function ys(e){An(e)}function Ss(){go()}function ws(){ho()}function Za(){qn()}function ei(){Vn()}function ks(){Wn()}function Cs(){zn()}function Dt(e){Kt(e)}var Y=f("new-msg-btn"),Oa="\u2193 Latest";function It(){var e=f("input-area");e&&(Y.style.bottom=e.offsetHeight+12+"px")}var Fa=f("input-area");Fa&&window.ResizeObserver?new ResizeObserver(It).observe(Fa):window.addEventListener("resize",It);It();L.addEventListener("scroll",function(){if(!Vt()){var e=L.scrollHeight-L.scrollTop-L.clientHeight,t=e>150;Gt(t),t?(Y.classList.contains("hidden")&&(Y.textContent=Oa),Y.classList.remove("hidden")):(Y.classList.add("hidden"),Y.textContent=Oa)}});Y.addEventListener("click",function(){ti()});document.addEventListener("visibilitychange",function(){document.hidden||xe()});L.addEventListener("click",function(e){var t=e.target.closest(".msg-action-fork");if(t){var n=t.closest("[data-uuid]");if(!(!n||!n.dataset.uuid)){var r=n.dataset.uuid;Xa("Fork session from this message?",function(){var a=w();a&&a.readyState===1&&a.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function xe(){Yt()}function ti(){Jt()}ln();Tn();Tr();hr();Vr();Fr();_a();Qr();Hr();qr();Gr();Ht();Hn();Gn();Wt();rn({$:f,get ws(){return w()},get connected(){return o.get("connected")},get turnCounter(){return zt()},messagesEl:L,inputEl:Ke,finalizeAssistantBlock:function(){Ms()},addToMessages:function(e){Dt(e)},scrollToBottom:function(){xe()},setActivity:function(e){ys(e)},stopUrgentBlink:function(){bs()},showImageModal:Lt,getContextPercent:function(){var e=Fn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return fs},getMateById:function(e){var t=o.get("cachedMatesList");if(!e||!t)return null;for(var n=0;n<t.length;n++)if(t[n].id===e)return t[n];return null}});function ni(e,t,n,r,a){uo(e,t,n,r,a)}function ri(e,t){po(e,t)}function Ms(){mo()}function oi(e,t){fo(e,t)}function Es(){bo()}function Ps(){io()}function ai(e){je(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){De(!0);return}Mn();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){De(!0);return}Cn("project",t),ps()&&void 0,t&&t!==o.get("currentSlug")&&(No(),ne(),H()&&F(),mn(t),o.set({currentSlug:t}),z="/p/"+t+"/",fe="/p/"+t+"/ws",o.set({basePath:z,wsPath:fe}),Ps(),ii())});function ii(){Xr()}co({get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},get basePath(){return z},inputEl:Ke,sendBtn:rs,slashMenu:os,messagesEl:L,imagePreviewBar:us,slashCommands:function(){return o.get("slashCommands")},messageUuidMap:function(){return o.get("messageUuidMap")},addUserMessage:ni,addSystemMessage:oi,toggleUsagePanel:Za,toggleStatusPanel:ei,toggleContextPanel:Cs,resetContextData:ks,showImageModal:Lt,hideSuggestionChips:Es,getGhostSuggestion:function(){return vo()},setSendBtnMode:vs,isDmMode:function(){return o.get("dmMode")&&!(o.get("dmTargetUser")&&o.get("dmTargetUser").isMate)},getDmKey:function(){return o.get("dmKey")},handleDmSend:function(){ms()},isDebateEndedMode:function(){return o.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return o.get("debateConcludeMode")},handleDebateConcludeSend:function(){Ls()},isDebateFloorMode:function(){return o.get("debateFloorMode")},handleDebateFloorSend:function(){Rs()},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getDmMateId:function(){var e=o.get("dmTargetUser");return o.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){ws()},showClaudePreThinking:function(){Ss()},myUserId:function(){return o.get("myUserId")},myDisplayName:function(){var e=null;try{e=JSON.parse(localStorage.getItem("clay_my_user")||"null")}catch{}return e&&(e.displayName||e.username)||document.body.dataset.myDisplayName||"Me"}});xr();Kr({get ws(){return w()},get connected(){return o.get("connected")},inputEl:Ke,messagesEl:L,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},myUserId:function(){return o.get("myUserId")},scrollToBottom:xe,addUserMessage:ni,addCopyHandler:ri,addToMessages:Dt,showImageModal:Lt,showPasteModal:sn});Ur({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:L,addToMessages:function(e){Dt(e)},scrollToBottom:xe,addCopyHandler:ri,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").isMate?o.get("dmTargetUser").id:o.get("homeChatMateId")||null},requireSkills:xs,showDebateEndedMode:function(e){Ts(e)}});oa();mr({basePath:z});In();Mr({basePath:z});function Is(){fn()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(o.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(o.set({myUserId:e.user.id}),Bn()),o.set({authIdentityLoaded:!0}),o.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Is(),!o.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}da();var n=o.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var a=document.getElementById("terminal-sidebar-btn");a&&(a.style.display="none");var s=document.getElementById("shell-command-btn");s&&(s.style.display="none");var i=document.getElementById("input-more-shell");i&&(i.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var c=document.getElementById("git-placard");c&&(c.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var u=document.getElementById("mate-skills-btn");u&&(u.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var m=document.getElementById("icon-strip-add");m&&(m.style.display="none")}}}).catch(function(){});br().then(function(e){if(o.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});vr({$:f,get ws(){return w()},get connected(){return o.get("connected")},messagesEl:L,sessionListEl:Ka,scrollToBottom:xe,forceScrollToBottom:ti,basePath:z,toggleUsagePanel:Za,toggleStatusPanel:ei});yr();xn(ao());Ln();_o({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},get cwd(){return o.get("cwd")},messagesEl:L,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});_e([xo,Yo,tn]);Vo();Ft();Yn();To({get ws(){return w()},get connected(){return o.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});on({get ws(){return w()},get connected(){return o.get("connected")}});ta();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){ea(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Qt({messagesEl:L,get ws(){return w()},getHistoryFrom:function(){return o.get("historyFrom")}});var Ha=f("find-in-session-btn");Ha&&Ha.addEventListener("click",function(){$t()});wo();Io();yo(function(){re()&&Eo()});var qa=f("sticky-notes-sidebar-btn");qa&&qa.addEventListener("click",function(){he(),me(),H()&&F(),re()&&ne(),ko(),Mo()});var Va=document.querySelectorAll("#sticky-notes-toggle-btn");for(We=0;We<Va.length;We++)Va[We].addEventListener("click",function(){So()});var We,Wa=f("sticky-notes-sidebar-count");Wa&&Wa.addEventListener("click",function(e){e.stopPropagation(),he(),me(),H()&&F(),re()?ne():Po()});var za=f("git-placard-more"),Ga=f("terminal-sidebar-btn");za&&za.addEventListener("click",function(){Qe(),he(),me(),re()&&ne(),H()&&F()});Ga&&Ga.addEventListener("click",function(){Qe(),he(),me(),re()&&ne(),H()&&F()});function xs(e,t){Wr(e,t)}function Ls(){_r()}function Ts(e){Nr(e)}function Rs(){Or()}an();Pr();pn({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},basePath:z,currentSlug:Ge,getProjects:function(){return ge()}});jr();Rr();Dr();Ba();wn();lo();zr();kn();Yr();En();Ra();Zr();$r();lucide.createIcons();pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");ii();ze&&location.hash==="#scheduler"?setTimeout(function(){gn("calendar")},500):ze&&Ke.focus();