rivet-design 0.13.1 → 0.13.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/routes/static.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE,KAAK,mBAAmB,GAAG;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,iBAAiB,EAChC,cAAc,MAAM,EACpB,UAAS,mBAAwB,KAChC,MAuDF,CAAC"}
1
+ {"version":3,"file":"static.d.ts","sourceRoot":"","sources":["../../src/routes/static.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE,KAAK,mBAAmB,GAAG;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC,CAAC;AA2EF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,iBAAiB,EAChC,cAAc,MAAM,EACpB,UAAS,mBAAwB,KAChC,MAqDF,CAAC"}
@@ -43,6 +43,78 @@ const fs_1 = __importDefault(require("fs"));
43
43
  const logger_1 = require("../utils/logger");
44
44
  const preview_bridge_1 = require("../proxy-middleware/preview-bridge");
45
45
  const log = (0, logger_1.createLogger)('StaticRoutes');
46
+ /** Renders a friendly HTML page when the project has no entry file yet. */
47
+ const renderEmptyState = (entryFileName) => `<!DOCTYPE html>
48
+ <html lang="en">
49
+ <head>
50
+ <meta charset="UTF-8" />
51
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
52
+ <title>No entry file</title>
53
+ <style>
54
+ * { margin: 0; padding: 0; box-sizing: border-box; }
55
+ body {
56
+ min-height: 100vh;
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
61
+ background: #0a0a0b;
62
+ color: #e4e4e7;
63
+ }
64
+ .container {
65
+ text-align: center;
66
+ max-width: 420px;
67
+ padding: 2rem;
68
+ }
69
+ .icon {
70
+ width: 48px;
71
+ height: 48px;
72
+ margin: 0 auto 1.25rem;
73
+ border-radius: 12px;
74
+ background: #18181b;
75
+ border: 1px solid #27272a;
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ }
80
+ .icon svg { width: 24px; height: 24px; color: #71717a; }
81
+ h1 {
82
+ font-size: 1.125rem;
83
+ font-weight: 600;
84
+ margin-bottom: 0.5rem;
85
+ color: #fafafa;
86
+ }
87
+ p {
88
+ font-size: 0.875rem;
89
+ line-height: 1.5;
90
+ color: #a1a1aa;
91
+ }
92
+ code {
93
+ display: inline-block;
94
+ margin-top: 0.75rem;
95
+ padding: 0.25rem 0.625rem;
96
+ background: #18181b;
97
+ border: 1px solid #27272a;
98
+ border-radius: 6px;
99
+ font-family: "SF Mono", "Fira Code", monospace;
100
+ font-size: 0.8125rem;
101
+ color: #d4d4d8;
102
+ }
103
+ </style>
104
+ </head>
105
+ <body>
106
+ <div class="container">
107
+ <div class="icon">
108
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
109
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
110
+ </svg>
111
+ </div>
112
+ <h1>No entry file found</h1>
113
+ <p>This project doesn\u2019t have an entry file yet. Create one to get started.</p>
114
+ <code>${entryFileName}</code>
115
+ </div>
116
+ </body>
117
+ </html>`;
46
118
  /**
47
119
  * Create routes for serving static files
48
120
  */
@@ -64,15 +136,15 @@ const createStaticRoutes = (staticService, _projectPath, options = {}) => {
64
136
  }
65
137
  res.sendFile(entryFileName, { root: basePath });
66
138
  };
139
+ const sendEmptyState = (res) => {
140
+ res.status(200).type('html').send(renderEmptyState(entryFileName));
141
+ };
67
142
  // Serve the entry point at /static/ (root of static site)
68
143
  router.get('/static', (_req, res) => {
69
144
  const entryPath = path_1.default.join(basePath, entryFileName);
70
145
  log.debug(`Serving entry point: ${entryPath}`);
71
146
  if (!fs_1.default.existsSync(entryPath)) {
72
- res.status(404).json({
73
- error: 'Static entry not found',
74
- details: entryPath,
75
- });
147
+ sendEmptyState(res);
76
148
  return;
77
149
  }
78
150
  sendEntry(res, entryPath);
@@ -81,10 +153,7 @@ const createStaticRoutes = (staticService, _projectPath, options = {}) => {
81
153
  const entryPath = path_1.default.join(basePath, entryFileName);
82
154
  log.debug(`Serving entry point: ${entryPath}`);
83
155
  if (!fs_1.default.existsSync(entryPath)) {
84
- res.status(404).json({
85
- error: 'Static entry not found',
86
- details: entryPath,
87
- });
156
+ sendEmptyState(res);
88
157
  return;
89
158
  }
90
159
  sendEntry(res, entryPath);
@@ -1 +1 @@
1
- {"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/routes/static.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA6D;AAC7D,gDAAwB;AACxB,4CAAoB;AAEpB,4CAA+C;AAC/C,uEAAyE;AAEzE,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,cAAc,CAAC,CAAC;AAOzC;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,aAAgC,EAChC,YAAoB,EACpB,UAA+B,EAAE,EACzB,EAAE;IACV,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;IAEvD,GAAG,CAAC,IAAI,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IACnD,GAAG,CAAC,IAAI,CAAC,eAAe,aAAa,EAAE,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,CAAC,GAAa,EAAE,SAAiB,EAAE,EAAE;QACrD,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACnC,GAAG;iBACA,IAAI,CAAC,MAAM,CAAC;iBACZ,IAAI,CACH,IAAA,oCAAmB,EAAC,YAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE;gBACtD,oBAAoB,EAAE,OAAO,CAAC,2BAA2B;aAC1D,CAAC,CACH,CAAC;YACJ,OAAO;QACT,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,0DAA0D;IAC1D,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QACrD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACrD,GAAG,CAAC,KAAK,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,wBAAwB;gBAC/B,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QACtD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACrD,GAAG,CAAC,KAAK,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,wBAAwB;gBAC/B,OAAO,EAAE,SAAS;aACnB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,+BAA+B;IAC/B,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA3DW,QAAA,kBAAkB,sBA2D7B"}
1
+ {"version":3,"file":"static.js","sourceRoot":"","sources":["../../src/routes/static.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAA6D;AAC7D,gDAAwB;AACxB,4CAAoB;AAEpB,4CAA+C;AAC/C,uEAAyE;AAEzE,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,cAAc,CAAC,CAAC;AAOzC,2EAA2E;AAC3E,MAAM,gBAAgB,GAAG,CAAC,aAAqB,EAAU,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAmEhD,aAAa;;;QAGjB,CAAC;AAET;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAChC,aAAgC,EAChC,YAAoB,EACpB,UAA+B,EAAE,EACzB,EAAE;IACV,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;IAEvD,GAAG,CAAC,IAAI,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IACnD,GAAG,CAAC,IAAI,CAAC,eAAe,aAAa,EAAE,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,CAAC,GAAa,EAAE,SAAiB,EAAE,EAAE;QACrD,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;YACnC,GAAG;iBACA,IAAI,CAAC,MAAM,CAAC;iBACZ,IAAI,CACH,IAAA,oCAAmB,EAAC,YAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE;gBACtD,oBAAoB,EAAE,OAAO,CAAC,2BAA2B;aAC1D,CAAC,CACH,CAAC;YACJ,OAAO;QACT,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,GAAa,EAAE,EAAE;QACvC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC;IAEF,0DAA0D;IAC1D,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QACrD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACrD,GAAG,CAAC,KAAK,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,cAAc,CAAC,GAAG,CAAC,CAAC;YACpB,OAAO;QACT,CAAC;QACD,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;QACtD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACrD,GAAG,CAAC,KAAK,CAAC,wBAAwB,SAAS,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,cAAc,CAAC,GAAG,CAAC,CAAC;YACpB,OAAO;QACT,CAAC;QACD,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,+BAA+B;IAC/B,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEhD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAzDW,QAAA,kBAAkB,sBAyD7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivet-design",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Local visual web development tool with AI-powered code modification",
5
5
  "main": "dist/index.js",
6
6
  "workspaces": [
@@ -108,7 +108,7 @@ function useAtomValueWithDelay<Value>(
108
108
  .block-interactivity-`.concat(t,` {pointer-events: none;}
109
109
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
110
110
  `)},AH=0,Wl=[];function RH(t){var e=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),s=g.useState(AH++)[0],i=g.useState(U3)[0],a=g.useRef(t);g.useEffect(function(){a.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var _=X$([t.lockRef.current],(t.shards||[]).map(_k),!0).filter(Boolean);return _.forEach(function(b){return b.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),_.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var u=g.useCallback(function(_,b){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!a.current.allowPinchZoom;var E=Zh(_),C=n.current,P="deltaX"in _?_.deltaX:C[0]-E[0],T="deltaY"in _?_.deltaY:C[1]-E[1],A,O=_.target,M=Math.abs(P)>Math.abs(T)?"h":"v";if("touches"in _&&M==="h"&&O.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,N=L?L===O||L.contains(O):!1;if(N)return!1;var j=vk(M,O);if(!j)return!0;if(j?A=M:(A=M==="v"?"h":"v",j=vk(M,O)),!j)return!1;if(!r.current&&"changedTouches"in _&&(P||T)&&(r.current=A),!A)return!0;var V=r.current||A;return CH(V,b,_,V==="h"?P:T)},[]),c=g.useCallback(function(_){var b=_;if(!(!Wl.length||Wl[Wl.length-1]!==i)){var E="deltaY"in b?yk(b):Zh(b),C=e.current.filter(function(A){return A.name===b.type&&(A.target===b.target||b.target===A.shadowParent)&&PH(A.delta,E)})[0];if(C&&C.should){b.cancelable&&b.preventDefault();return}if(!C){var P=(a.current.shards||[]).map(_k).filter(Boolean).filter(function(A){return A.contains(b.target)}),T=P.length>0?u(b,P[0]):!a.current.noIsolation;T&&b.cancelable&&b.preventDefault()}}},[]),f=g.useCallback(function(_,b,E,C){var P={name:_,delta:b,target:E,should:C,shadowParent:IH(E)};e.current.push(P),setTimeout(function(){e.current=e.current.filter(function(T){return T!==P})},1)},[]),h=g.useCallback(function(_){n.current=Zh(_),r.current=void 0},[]),p=g.useCallback(function(_){f(_.type,yk(_),_.target,u(_,t.lockRef.current))},[]),v=g.useCallback(function(_){f(_.type,Zh(_),_.target,u(_,t.lockRef.current))},[]);g.useEffect(function(){return Wl.push(i),t.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",c,Bl),document.addEventListener("touchmove",c,Bl),document.addEventListener("touchstart",h,Bl),function(){Wl=Wl.filter(function(_){return _!==i}),document.removeEventListener("wheel",c,Bl),document.removeEventListener("touchmove",c,Bl),document.removeEventListener("touchstart",h,Bl)}},[]);var y=t.removeScrollBar,x=t.inert;return g.createElement(g.Fragment,null,x?g.createElement(i,{styles:TH(s)}):null,y?g.createElement(_H,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function IH(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const MH=oH(z3,RH);var G2=g.forwardRef(function(t,e){return g.createElement(Qm,ni({},t,{ref:e,sideCar:MH}))});G2.classNames=Qm.classNames;var LH=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Gl=new WeakMap,qh=new WeakMap,Yh={},r1=0,K3=function(t){return t&&(t.host||K3(t.parentNode))},OH=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=K3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},NH=function(t,e,n,r){var s=OH(e,Array.isArray(t)?t:[t]);Yh[n]||(Yh[n]=new WeakMap);var i=Yh[n],a=[],u=new Set,c=new Set(s),f=function(p){!p||u.has(p)||(u.add(p),f(p.parentNode))};s.forEach(f);var h=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(v){if(u.has(v))h(v);else try{var y=v.getAttribute(r),x=y!==null&&y!=="false",_=(Gl.get(v)||0)+1,b=(i.get(v)||0)+1;Gl.set(v,_),i.set(v,b),a.push(v),_===1&&x&&qh.set(v,!0),b===1&&v.setAttribute(n,"true"),x||v.setAttribute(r,"true")}catch(E){console.error("aria-hidden: cannot operate on ",v,E)}})};return h(e),u.clear(),r1++,function(){a.forEach(function(p){var v=Gl.get(p)-1,y=i.get(p)-1;Gl.set(p,v),i.set(p,y),v||(qh.has(p)||p.removeAttribute(r),qh.delete(p)),y||p.removeAttribute(n)}),r1--,r1||(Gl=new WeakMap,Gl=new WeakMap,qh=new WeakMap,Yh={})}},Z3=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=LH(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),NH(r,s,n,"aria-hidden")):function(){return null}},Jm="Dialog",[q3]=na(Jm),[DH,Ms]=q3(Jm),e0=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!0}=t,u=g.useRef(null),c=g.useRef(null),[f,h]=fl({prop:r,defaultProp:s??!1,onChange:i,caller:Jm});return S.jsx(DH,{scope:e,triggerRef:u,contentRef:c,contentId:il(),titleId:il(),descriptionId:il(),open:f,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(p=>!p),[h]),modal:a,children:n})};e0.displayName=Jm;var Y3="DialogTrigger",jH=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(Y3,n),i=Yt(e,s.triggerRef);return S.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":Z2(s.open),...r,ref:i,onClick:Et(t.onClick,s.onOpenToggle)})});jH.displayName=Y3;var K2="DialogPortal",[FH,X3]=q3(K2,{forceMount:void 0}),t0=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=Ms(K2,e);return S.jsx(FH,{scope:e,forceMount:n,children:g.Children.map(r,a=>S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:a})}))})};t0.displayName=K2;var xm="DialogOverlay",n0=g.forwardRef((t,e)=>{const n=X3(xm,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Ms(xm,t.__scopeDialog);return i.modal?S.jsx(Qi,{present:r||i.open,children:S.jsx($H,{...s,ref:e})}):null});n0.displayName=xm;var VH=Vd("DialogOverlay.RemoveScroll"),$H=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(xm,n),i=N$(),a=Yt(e,i);return S.jsx(G2,{as:VH,allowPinchZoom:!0,shards:[s.contentRef],children:S.jsx(Rt.div,{"data-state":Z2(s.open),...r,ref:a,style:{pointerEvents:"auto",...r.style}})})}),ju="DialogContent",r0=g.forwardRef((t,e)=>{const n=X3(ju,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Ms(ju,t.__scopeDialog);return S.jsx(Qi,{present:r||i.open,children:i.modal?S.jsx(HH,{...s,ref:e}):S.jsx(zH,{...s,ref:e})})});r0.displayName=ju;var HH=g.forwardRef((t,e)=>{const n=Ms(ju,t.__scopeDialog),r=g.useRef(null),s=Yt(e,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return Z3(i)},[]),S.jsx(Q3,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Et(t.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,i=>{const a=i.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&i.preventDefault()}),onFocusOutside:Et(t.onFocusOutside,i=>i.preventDefault())})}),zH=g.forwardRef((t,e)=>{const n=Ms(ju,t.__scopeDialog),r=g.useRef(!1),s=g.useRef(!1);return S.jsx(Q3,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,u;(a=t.onCloseAutoFocus)==null||a.call(t,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,f;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Q3=g.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...a}=t,u=Ms(ju,n);return V3(),S.jsx(S.Fragment,{children:S.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:S.jsx(Ym,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Z2(u.open),...a,ref:e,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1)})})})}),J3="DialogTitle",s0=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(J3,n);return S.jsx(Rt.h2,{id:s.titleId,...r,ref:e})});s0.displayName=J3;var eT="DialogDescription",i0=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(eT,n);return S.jsx(Rt.p,{id:s.descriptionId,...r,ref:e})});i0.displayName=eT;var tT="DialogClose",UH=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Ms(tT,n);return S.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>s.onOpenChange(!1))})});UH.displayName=tT;function Z2(t){return t?"open":"closed"}const BH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M112,56V200L40,128Z",opacity:"0.2"}),g.createElement("path",{d:"M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z"}))]]),WH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z",opacity:"0.2"}),g.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z"}))]]),GH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,112H56l72-72Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z"}))]]),KH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),g.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),ZH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,20A108,108,0,0,0,31.85,177.23L21,209.66A20,20,0,0,0,46.34,235l32.43-10.81A108,108,0,1,0,128,20Zm0,192a84,84,0,0,1-42.06-11.27,12,12,0,0,0-6-1.62,12.1,12.1,0,0,0-3.8.62l-29.79,9.93,9.93-29.79a12,12,0,0,0-1-9.81A84,84,0,1,1,128,212Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z",opacity:"0.2"}),g.createElement("path",{d:"M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z"}))]]),qH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),YH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M236,128a108,108,0,0,1-216,0c0-42.52,24.73-81.34,63-98.9A12,12,0,1,1,93,50.91C63.24,64.57,44,94.83,44,128a84,84,0,0,0,168,0c0-33.17-19.24-63.43-49-77.09A12,12,0,1,1,173,29.1C211.27,46.66,236,85.48,236,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),g.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,176A72,72,0,0,1,92,65.64a8,8,0,0,1,8,13.85,56,56,0,1,0,56,0,8,8,0,0,1,8-13.85A72,72,0,0,1,128,200Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M230,128a102,102,0,0,1-204,0c0-40.18,23.35-76.86,59.5-93.45a6,6,0,0,1,5,10.9C58.61,60.09,38,92.49,38,128a90,90,0,0,0,180,0c0-35.51-20.61-67.91-52.5-82.55a6,6,0,0,1,5-10.9C206.65,51.14,230,87.82,230,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232,128a104,104,0,0,1-208,0c0-41,23.81-78.36,60.66-95.27a8,8,0,0,1,6.68,14.54C60.15,61.59,40,93.27,40,128a88,88,0,0,0,176,0c0-34.73-20.15-66.41-51.34-80.73a8,8,0,0,1,6.68-14.54C208.19,49.64,232,87,232,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228,128a100,100,0,0,1-200,0c0-39.4,22.9-75.37,58.33-91.63a4,4,0,1,1,3.34,7.27C57.07,58.6,36,91.71,36,128a92,92,0,0,0,184,0c0-36.29-21.07-69.4-53.67-84.36a4,4,0,1,1,3.34-7.27C205.1,52.63,228,88.6,228,128Z"}))]]),XH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,28H88A12,12,0,0,0,76,40V76H40A12,12,0,0,0,28,88V216a12,12,0,0,0,12,12H168a12,12,0,0,0,12-12V180h36a12,12,0,0,0,12-12V40A12,12,0,0,0,216,28ZM156,204H52V100H156Zm48-48H180V88a12,12,0,0,0-12-12H100V52H204Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40V168H168V88H88V40Z",opacity:"0.2"}),g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32Zm-8,128H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,34H88a6,6,0,0,0-6,6V82H40a6,6,0,0,0-6,6V216a6,6,0,0,0,6,6H168a6,6,0,0,0,6-6V174h42a6,6,0,0,0,6-6V40A6,6,0,0,0,216,34ZM162,210H46V94H162Zm48-48H174V88a6,6,0,0,0-6-6H94V46H210Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,36H88a4,4,0,0,0-4,4V84H40a4,4,0,0,0-4,4V216a4,4,0,0,0,4,4H168a4,4,0,0,0,4-4V172h44a4,4,0,0,0,4-4V40A4,4,0,0,0,216,36ZM164,212H44V92H164Zm48-48H172V88a4,4,0,0,0-4-4H92V44H212Z"}))]]),QH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),g.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),JH=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z",opacity:"0.2"}),g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z"}))]]),ez=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,36H40A20,20,0,0,0,20,56V200a20,20,0,0,0,20,20H216a20,20,0,0,0,20-20V56A20,20,0,0,0,216,36ZM44,60H76V196H44ZM212,196H100V60H212Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M88,48V208H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8Z",opacity:"0.2"}),g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,160H88V56H216V200Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,42H40A14,14,0,0,0,26,56V200a14,14,0,0,0,14,14H216a14,14,0,0,0,14-14V56A14,14,0,0,0,216,42ZM38,200V56a2,2,0,0,1,2-2H82V202H40A2,2,0,0,1,38,200Zm180,0a2,2,0,0,1-2,2H94V54H216a2,2,0,0,1,2,2Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,44H40A12,12,0,0,0,28,56V200a12,12,0,0,0,12,12H216a12,12,0,0,0,12-12V56A12,12,0,0,0,216,44ZM36,200V56a4,4,0,0,1,4-4H84V204H40A4,4,0,0,1,36,200Zm184,0a4,4,0,0,1-4,4H92V52H216a4,4,0,0,1,4,4Z"}))]]),tz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z",opacity:"0.2"}),g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z"}))]]),nz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z",opacity:"0.2"}),g.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z"}))]]),rz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M242.79,149.32,223.7,97.11A20,20,0,0,0,198.12,85.2l-61.31,22.22L147.7,45.18A20,20,0,0,0,131.55,22L76.87,12.31A19.94,19.94,0,0,0,53.76,28.55l-25,143.13A48,48,0,0,0,67.4,227.26a51.19,51.19,0,0,0,8.7.74H224a20,20,0,0,0,20-20V156.19A21.74,21.74,0,0,0,242.79,149.32ZM99,184.18a23.84,23.84,0,0,1-9.86,15.56,23.28,23.28,0,0,1-17.56,3.89,24,24,0,0,1-19.23-27.82L76.71,36.66,123.37,45,99,184.18Zm23.64,4.13,9.39-53.64,70.49-25.54,16.3,44.59-96.23,34.87C122.62,188.5,122.65,188.41,122.66,188.31ZM220,204H150.52L220,178.82ZM89.22,174.07l-1.4,8A12,12,0,0,1,76,192a12.35,12.35,0,0,1-2.08-.18,12,12,0,0,1-9.75-13.89l1.4-8a12,12,0,0,1,23.64,4.14Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M135.88,43.11l-25,143.14a35.71,35.71,0,0,1-41.34,29.2h0a36,36,0,0,1-28.95-41.71l25-143.13a8,8,0,0,1,9.19-6.49l54.67,9.73A8,8,0,0,1,135.88,43.11Z",opacity:"0.2"}),g.createElement("path",{d:"M88,180a12,12,0,1,1-12-12A12,12,0,0,1,88,180Zm152-23.81V208a16,16,0,0,1-16,16H76a46.36,46.36,0,0,1-7.94-.68,44,44,0,0,1-35.43-50.95l25-143.13a15.94,15.94,0,0,1,18.47-13L130.84,26a16,16,0,0,1,12.92,18.52l-12.08,69L199.49,89a16,16,0,0,1,20.45,9.52L239,150.69A18.35,18.35,0,0,1,240,156.19ZM103,184.87,128,41.74,73.46,32l-25,143.1A28,28,0,0,0,70.9,207.57,27.29,27.29,0,0,0,91.46,203,27.84,27.84,0,0,0,103,184.87ZM116.78,195,224,156.11,204.92,104,128.5,131.7l-9.78,55.92A44.63,44.63,0,0,1,116.78,195ZM224,173.12,127.74,208H224Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M240,155.91a16,16,0,0,0-1-5.22L219.94,98.48A16,16,0,0,0,199.49,89l-67.81,24.57,12.08-69A16,16,0,0,0,130.84,26L76.17,16.25a15.94,15.94,0,0,0-18.47,13l-25,143.12A43.82,43.82,0,0,0,75.78,224H224a16,16,0,0,0,16-16ZM76,196a16,16,0,1,1,16-16A16,16,0,0,1,76,196Zm42.72-8.38,9.78-55.92L204.92,104,224,156.11,116.78,195A44.89,44.89,0,0,0,118.72,187.62ZM224,208H127.74L224,173.11Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M86,180a10,10,0,1,1-10-10A10,10,0,0,1,86,180Zm152-23.81V208a14,14,0,0,1-14,14H76a44.18,44.18,0,0,1-7.58-.65,42,42,0,0,1-33.81-48.64l25-143.13A13.94,13.94,0,0,1,75.82,18.22l54.67,9.72a14,14,0,0,1,11.3,16.21l-12.67,72.44,71-25.75a14,14,0,0,1,17.89,8.32l19.09,52.22A15.66,15.66,0,0,1,238,156.19Zm-133.07,29L130,42.08a2,2,0,0,0-1.58-2.32L73.72,30l-.34,0a1.84,1.84,0,0,0-1.07.35,2,2,0,0,0-.82,1.3l-25,143.13a30,30,0,0,0,24.09,34.76,29.25,29.25,0,0,0,22-4.89,29.81,29.81,0,0,0,12.33-19.44Zm8.25,13.17L224.71,158a2,2,0,0,0,1.11-1,1.86,1.86,0,0,0,.06-1.46l-19.09-52.21a2,2,0,0,0-2.53-1.17l-77.53,28.09-10,57.07A41.9,41.9,0,0,1,113.18,198.38ZM226,170.27,116.35,210H224a2,2,0,0,0,2-2Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M88,180a12,12,0,1,1-12-12A12,12,0,0,1,88,180Zm152-23.81V208a16,16,0,0,1-16,16H76a46.36,46.36,0,0,1-7.94-.68,44,44,0,0,1-35.43-50.95l25-143.13a15.94,15.94,0,0,1,18.47-13L130.84,26a16,16,0,0,1,12.92,18.52l-12.08,69L199.49,89a16,16,0,0,1,20.45,9.52L239,150.69A18.35,18.35,0,0,1,240,156.19ZM103,184.87,128,41.74,73.46,32l-25,143.1A28,28,0,0,0,70.9,207.57,27.29,27.29,0,0,0,91.46,203,27.84,27.84,0,0,0,103,184.87ZM116.78,195,224,156.11,204.92,104,128.5,131.7l-9.78,55.92A44.63,44.63,0,0,1,116.78,195ZM224,173.12,127.74,208H224Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M235.27,152.07,216.19,99.85a12,12,0,0,0-15.34-7.13l-74.3,26.92,13.27-75.83a12,12,0,0,0-9.68-13.9L75.47,20.19a11.75,11.75,0,0,0-8.89,2,11.9,11.9,0,0,0-4.94,7.77l-25,143.13A40,40,0,0,0,68.8,219.39,42.68,42.68,0,0,0,76,220H224a12,12,0,0,0,12-12V156.19A14,14,0,0,0,235.27,152.07Zm-31.7-51.83a4,4,0,0,1,5.1,2.36l19.09,52.21a3.9,3.9,0,0,1-.13,3,3.94,3.94,0,0,1-2.24,2L108.78,202.11a40,40,0,0,0,6-15.17L125,128.73ZM93.75,206.29a31.25,31.25,0,0,1-23.55,5.22,32,32,0,0,1-25.71-37.08l25-143.13a4,4,0,0,1,1.64-2.59A3.85,3.85,0,0,1,73.38,28a4,4,0,0,1,.69.06l54.67,9.73a4,4,0,0,1,3.2,4.64l-25,143.13h0A31.79,31.79,0,0,1,93.75,206.29ZM228,208a4,4,0,0,1-4,4H105l123-44.59ZM84,180a8,8,0,1,1-8-8A8,8,0,0,1,84,180Z"}))]]),sz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),iz=new Map([["bold",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",g.createElement(g.Fragment,null,g.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),g.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",g.createElement(g.Fragment,null,g.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",g.createElement(g.Fragment,null,g.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",g.createElement(g.Fragment,null,g.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",g.createElement(g.Fragment,null,g.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),oz=g.createContext({color:"currentColor",size:"1em",weight:"regular",mirrored:!1}),zn=g.forwardRef((t,e)=>{const{alt:n,color:r,size:s,weight:i,mirrored:a,children:u,weights:c,...f}=t,{color:h="currentColor",size:p,weight:v="regular",mirrored:y=!1,...x}=g.useContext(oz);return g.createElement("svg",{ref:e,xmlns:"http://www.w3.org/2000/svg",width:s??p,height:s??p,fill:r??h,viewBox:"0 0 256 256",transform:a||y?"scale(-1, 1)":void 0,...x,...f},!!n&&g.createElement("title",null,n),u,c.get(i??v))});zn.displayName="IconBase";const nT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:BH}));nT.displayName="ArrowLeftIcon";const az=nT,rT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:WH}));rT.displayName="ArrowSquareOutIcon";const lz=rT,sT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:GH}));sT.displayName="ArrowUpIcon";const uz=sT,iT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:KH}));iT.displayName="CaretDownIcon";const cz=iT,oT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:ZH}));oT.displayName="ChatCircleIcon";const dz=oT,aT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:qH}));aT.displayName="CheckIcon";const lT=aT,uT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:YH}));uT.displayName="CircleNotchIcon";const o0=uT,cT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:XH}));cT.displayName="CopyIcon";const $d=cT,dT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:QH}));dT.displayName="MagnifyingGlassIcon";const fz=dT,fT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:JH}));fT.displayName="PencilSimpleIcon";const hz=fT,hT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:ez}));hT.displayName="SidebarSimpleIcon";const pz=hT,pT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:tz}));pT.displayName="SignOutIcon";const mz=pT,mT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:nz}));mT.displayName="SparkleIcon";const s1=mT,gT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:rz}));gT.displayName="SwatchesIcon";const vT=gT,yT=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:sz}));yT.displayName="TrashIcon";const gz=yT,_T=g.forwardRef((t,e)=>g.createElement(zn,{ref:e,...t,weights:iz}));_T.displayName="XIcon";const xT=_T;function wT(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=wT(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function vz(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=wT(t))&&(r&&(r+=" "),r+=e);return r}const yz=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},_z=(t,e)=>({classGroupId:t,validator:e}),bT=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),wm="-",xk=[],xz="arbitrary..",wz=t=>{const e=Sz(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bz(a);const u=a.split(wm),c=u[0]===""&&u.length>1?1:0;return ST(u,c,e)},getConflictingClassGroupIds:(a,u)=>{if(u){const c=r[a],f=n[a];return c?f?yz(f,c):c:f||xk}return n[a]||xk}}},ST=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const f=ST(t,e+1,i);if(f)return f}const a=n.validators;if(a===null)return;const u=e===0?t.join(wm):t.slice(e).join(wm),c=a.length;for(let f=0;f<c;f++){const h=a[f];if(h.validator(u))return h.classGroupId}},bz=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?xz+r:void 0})(),Sz=t=>{const{theme:e,classGroups:n}=t;return Ez(n,e)},Ez=(t,e)=>{const n=bT();for(const r in t){const s=t[r];q2(s,n,r,e)}return n},q2=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const a=t[i];kz(a,e,n,r)}},kz=(t,e,n,r)=>{if(typeof t=="string"){Cz(t,e,n);return}if(typeof t=="function"){Pz(t,e,n,r);return}Tz(t,e,n,r)},Cz=(t,e,n)=>{const r=t===""?e:ET(e,t);r.classGroupId=n},Pz=(t,e,n,r)=>{if(Az(t)){q2(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(_z(n,t))},Tz=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a<i;a++){const[u,c]=s[a];q2(c,ET(e,u),n,r)}},ET=(t,e)=>{let n=t;const r=e.split(wm),s=r.length;for(let i=0;i<s;i++){const a=r[i];let u=n.nextPart.get(a);u||(u=bT(),n.nextPart.set(a,u)),n=u}return n},Az=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Rz=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},a_="!",wk=":",Iz=[],bk=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Mz=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,u=0,c=0,f;const h=s.length;for(let _=0;_<h;_++){const b=s[_];if(a===0&&u===0){if(b===wk){i.push(s.slice(c,_)),c=_+1;continue}if(b==="/"){f=_;continue}}b==="["?a++:b==="]"?a--:b==="("?u++:b===")"&&u--}const p=i.length===0?s:s.slice(c);let v=p,y=!1;p.endsWith(a_)?(v=p.slice(0,-1),y=!0):p.startsWith(a_)&&(v=p.slice(1),y=!0);const x=f&&f>c?f-c:void 0;return bk(i,y,v,x)};if(e){const s=e+wk,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):bk(Iz,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},Lz=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const a=n[i],u=a[0]==="[",c=e.has(a);u||c?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},Oz=t=>({cache:Rz(t.cacheSize),parseClassName:Mz(t),sortModifiers:Lz(t),postfixLookupClassGroupIds:Nz(t),...wz(t)}),Nz=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)e[n[r]]=!0;return e},Dz=/\s+/,jz=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:a}=e,u=[],c=t.trim().split(Dz);let f="";for(let h=c.length-1;h>=0;h-=1){const p=c[h],{isExternal:v,modifiers:y,hasImportantModifier:x,baseClassName:_,maybePostfixModifierPosition:b}=n(p);if(v){f=p+(f.length>0?" "+f:f);continue}let E=!!b,C;if(E){const M=_.substring(0,b);C=r(M);const R=C&&a[C]?r(_):void 0;R&&R!==C&&(C=R,E=!1)}else C=r(_);if(!C){if(!E){f=p+(f.length>0?" "+f:f);continue}if(C=r(_),!C){f=p+(f.length>0?" "+f:f);continue}E=!1}const P=y.length===0?"":y.length===1?y[0]:i(y).join(":"),T=x?P+a_:P,A=T+C;if(u.indexOf(A)>-1)continue;u.push(A);const O=s(C,E);for(let M=0;M<O.length;++M){const R=O[M];u.push(T+R)}f=p+(f.length>0?" "+f:f)}return f},Fz=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=kT(n))&&(s&&(s+=" "),s+=r);return s},kT=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=kT(t[r]))&&(n&&(n+=" "),n+=e);return n},Vz=(t,...e)=>{let n,r,s,i;const a=c=>{const f=e.reduce((h,p)=>p(h),t());return n=Oz(f),r=n.cache.get,s=n.cache.set,i=u,u(c)},u=c=>{const f=r(c);if(f)return f;const h=jz(c,n);return s(c,h),h};return i=a,(...c)=>i(Fz(...c))},$z=[],gn=t=>{const e=n=>n[t]||$z;return e.isThemeGetter=!0,e},CT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,PT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Bz=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Wz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Gz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,So=t=>Hz.test(t),nt=t=>!!t&&!Number.isNaN(Number(t)),Zs=t=>!!t&&Number.isInteger(Number(t)),i1=t=>t.endsWith("%")&&nt(t.slice(0,-1)),Ai=t=>zz.test(t),TT=()=>!0,Kz=t=>Uz.test(t)&&!Bz.test(t),Y2=()=>!1,Zz=t=>Wz.test(t),qz=t=>Gz.test(t),Yz=t=>!Ie(t)&&!Le(t),Xz=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Qz=t=>ra(t,IT,Y2),Ie=t=>CT.test(t),Ta=t=>ra(t,MT,Kz),Sk=t=>ra(t,oU,nt),Jz=t=>ra(t,OT,TT),eU=t=>ra(t,LT,Y2),Ek=t=>ra(t,AT,Y2),tU=t=>ra(t,RT,qz),Xh=t=>ra(t,NT,Zz),Le=t=>PT.test(t),Yc=t=>hl(t,MT),nU=t=>hl(t,LT),kk=t=>hl(t,AT),rU=t=>hl(t,IT),sU=t=>hl(t,RT),Qh=t=>hl(t,NT,!0),iU=t=>hl(t,OT,!0),ra=(t,e,n)=>{const r=CT.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},hl=(t,e,n=!1)=>{const r=PT.exec(t);return r?r[1]?e(r[1]):n:!1},AT=t=>t==="position"||t==="percentage",RT=t=>t==="image"||t==="url",IT=t=>t==="length"||t==="size"||t==="bg-size",MT=t=>t==="length",oU=t=>t==="number",LT=t=>t==="family-name",OT=t=>t==="number"||t==="weight",NT=t=>t==="shadow",aU=()=>{const t=gn("color"),e=gn("font"),n=gn("text"),r=gn("font-weight"),s=gn("tracking"),i=gn("leading"),a=gn("breakpoint"),u=gn("container"),c=gn("spacing"),f=gn("radius"),h=gn("shadow"),p=gn("inset-shadow"),v=gn("text-shadow"),y=gn("drop-shadow"),x=gn("blur"),_=gn("perspective"),b=gn("aspect"),E=gn("ease"),C=gn("animate"),P=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...T(),Le,Ie],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],R=()=>[Le,Ie,c],L=()=>[So,"full","auto",...R()],N=()=>[Zs,"none","subgrid",Le,Ie],j=()=>["auto",{span:["full",Zs,Le,Ie]},Zs,Le,Ie],V=()=>[Zs,"auto",Le,Ie],G=()=>["auto","min","max","fr",Le,Ie],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],K=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...R()],X=()=>[So,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],$=()=>[So,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ee=()=>[So,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[t,Le,Ie],D=()=>[...T(),kk,Ek,{position:[Le,Ie]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",rU,Qz,{size:[Le,Ie]}],se=()=>[i1,Yc,Ta],oe=()=>["","none","full",f,Le,Ie],ue=()=>["",nt,Yc,Ta],de=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[nt,i1,kk,Ek],me=()=>["","none",x,Le,Ie],Se=()=>["none",nt,Le,Ie],Re=()=>["none",nt,Le,Ie],Ke=()=>[nt,Le,Ie],it=()=>[So,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ai],breakpoint:[Ai],color:[TT],container:[Ai],"drop-shadow":[Ai],ease:["in","out","in-out"],font:[Yz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ai],shadow:[Ai],spacing:["px",nt],text:[Ai],"text-shadow":[Ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",So,Ie,Le,b]}],container:["container"],"container-type":[{"@container":["","normal","size",Le,Ie]}],"container-named":[Xz],columns:[{columns:[nt,Ie,Le,u]}],"break-after":[{"break-after":P()}],"break-before":[{"break-before":P()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Zs,"auto",Le,Ie]}],basis:[{basis:[So,"full","auto",u,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[nt,So,"auto","initial","none",Ie]}],grow:[{grow:["",nt,Le,Ie]}],shrink:[{shrink:["",nt,Le,Ie]}],order:[{order:[Zs,"first","last","none",Le,Ie]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...K(),"normal"]}],"justify-self":[{"justify-self":["auto",...K()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...K(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...K(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...K(),"baseline"]}],"place-self":[{"place-self":["auto",...K()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[u,"screen",...X()]}],"min-w":[{"min-w":[u,"screen","none",...X()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Yc,Ta]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,iU,Jz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",i1,Ie]}],"font-family":[{font:[nU,eU,e]}],"font-features":[{"font-features":[Ie]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Le,Ie]}],"line-clamp":[{"line-clamp":[nt,"none",Le,Sk]}],leading:[{leading:[i,...R()]}],"list-image":[{"list-image":["none",Le,Ie]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Le,Ie]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[nt,"from-font","auto",Le,Ta]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[nt,"auto",Le,Ie]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Zs,Le,Ie]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le,Ie]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Le,Ie]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zs,Le,Ie],radial:["",Le,Ie],conic:[Zs,Le,Ie]},sU,tU]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[nt,Le,Ie]}],"outline-w":[{outline:["",nt,Yc,Ta]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",h,Qh,Xh]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",p,Qh,Xh]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[nt,Ta]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",v,Qh,Xh]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[nt,Le,Ie]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[Le,Ie]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Le,Ie]}],filter:[{filter:["","none",Le,Ie]}],blur:[{blur:me()}],brightness:[{brightness:[nt,Le,Ie]}],contrast:[{contrast:[nt,Le,Ie]}],"drop-shadow":[{"drop-shadow":["","none",y,Qh,Xh]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",nt,Le,Ie]}],"hue-rotate":[{"hue-rotate":[nt,Le,Ie]}],invert:[{invert:["",nt,Le,Ie]}],saturate:[{saturate:[nt,Le,Ie]}],sepia:[{sepia:["",nt,Le,Ie]}],"backdrop-filter":[{"backdrop-filter":["","none",Le,Ie]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[nt,Le,Ie]}],"backdrop-contrast":[{"backdrop-contrast":[nt,Le,Ie]}],"backdrop-grayscale":[{"backdrop-grayscale":["",nt,Le,Ie]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[nt,Le,Ie]}],"backdrop-invert":[{"backdrop-invert":["",nt,Le,Ie]}],"backdrop-opacity":[{"backdrop-opacity":[nt,Le,Ie]}],"backdrop-saturate":[{"backdrop-saturate":[nt,Le,Ie]}],"backdrop-sepia":[{"backdrop-sepia":["",nt,Le,Ie]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Le,Ie]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[nt,"initial",Le,Ie]}],ease:[{ease:["linear","initial",E,Le,Ie]}],delay:[{delay:[nt,Le,Ie]}],animate:[{animate:["none",C,Le,Ie]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Le,Ie]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:Re()}],"scale-x":[{"scale-x":Re()}],"scale-y":[{"scale-y":Re()}],"scale-z":[{"scale-z":Re()}],"scale-3d":["scale-3d"],skew:[{skew:Ke()}],"skew-x":[{"skew-x":Ke()}],"skew-y":[{"skew-y":Ke()}],transform:[{transform:[Le,Ie,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],zoom:[{zoom:[Zs,Le,Ie]}],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Le,Ie]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":H()}],"scrollbar-track-color":[{"scrollbar-track":H()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Le,Ie]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[nt,Yc,Ta,Sk]}],stroke:[{stroke:["none",...H()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},lU=Vz(aU);function lr(...t){return lU(vz(t))}const Hd={fast:{type:"spring",duration:.08,bounce:0},moderate:{type:"spring",duration:.16,bounce:.15}},Ck=["#f59e0b","#38bdf8","#34d399","#a78bfa","#fb7185","#22d3ee","#fb923c","#a3e635","#e879f9","#2dd4bf"];function DT(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)|0;const n=Ck[Math.abs(e)%Ck.length];return{color:n,backgroundColor:`${n}22`}}function jT(t,e={}){const{axis:n="y"}=e,r=g.useRef(new Map),[s,i]=g.useState(null),[a,u]=g.useState([]),c=g.useRef([]),f=g.useRef(0),h=g.useRef(null),p=g.useRef(null),v=g.useCallback(()=>{if(!t.current)return;const C=[];r.current.forEach((P,T)=>{C[T]={top:P.offsetTop,height:P.offsetHeight,left:P.offsetLeft,width:P.offsetWidth}}),c.current=C,u(C)},[t]),y=g.useCallback((E,C)=>{C?r.current.set(E,C):r.current.delete(E),p.current!==null&&cancelAnimationFrame(p.current),p.current=requestAnimationFrame(()=>{p.current=null,v()})},[v]),x=g.useCallback(E=>{const C=E.clientX,P=E.clientY;h.current!==null&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{h.current=null;const T=t.current;if(!T)return;const A=T.getBoundingClientRect(),O=n==="x"?C:P;let M=null,R=1/0,L=null;const N=c.current,j=n==="x"?T.scrollLeft:T.scrollTop,V=n==="x"?T.clientLeft:T.clientTop,G=n==="x"?A.left:A.top,Y=n==="x"?T.offsetWidth:T.offsetHeight,K=n==="x"?A.width:A.height,B=Y>0?K/Y:1;for(let X=0;X<N.length;X++){const $=N[X];if(!$)continue;const ee=n==="x"?$.left:$.top,H=G+(V+ee-j)*B,D=(n==="x"?$.width:$.height)*B,q=H+D;O>=H&&O<=q&&(L=X);const re=H+D/2,se=Math.abs(O-re);se<R&&(R=se,M=X)}i(L??M)})},[n,t]),_=g.useCallback(()=>{f.current+=1,v()},[v]),b=g.useCallback(()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),i(null)},[]);return g.useEffect(()=>()=>{h.current!==null&&cancelAnimationFrame(h.current),p.current!==null&&cancelAnimationFrame(p.current)},[]),{activeIndex:s,setActiveIndex:i,itemRects:a,sessionRef:f,handlers:{onMouseMove:x,onMouseEnter:_,onMouseLeave:b},registerItem:y,measureItems:v}}function uU(t,e,n){g.useEffect(()=>(t(e,n.current),()=>t(e,null)),[e,t,n])}const FT=(t,e)=>`style:${t}:${e}`,VT=t=>`text:${t}`,$T=t=>{const e=[t.rivetId,t.xpath,t.cssSelector].filter(n=>!!n).map(n=>n.trim()).filter(Boolean);return e.length>0?[...new Set(e)]:["unknown"]},HT=t=>$T(t)[0],Jh=(t,e)=>$T(t).includes(e),cU=t=>{const e=HT(t.elementId),n=t.batchId?`:${t.batchId}`:"";return t.type==="style"?`${FT(e,t.property)}${n}`:`${VT(e)}${n}`},Nn=[];for(let t=0;t<256;++t)Nn.push((t+256).toString(16).slice(1));function dU(t,e=0){return(Nn[t[e+0]]+Nn[t[e+1]]+Nn[t[e+2]]+Nn[t[e+3]]+"-"+Nn[t[e+4]]+Nn[t[e+5]]+"-"+Nn[t[e+6]]+Nn[t[e+7]]+"-"+Nn[t[e+8]]+Nn[t[e+9]]+"-"+Nn[t[e+10]]+Nn[t[e+11]]+Nn[t[e+12]]+Nn[t[e+13]]+Nn[t[e+14]]+Nn[t[e+15]]).toLowerCase()}const fU=new Uint8Array(16);function hU(){return crypto.getRandomValues(fU)}function Pk(t,e,n){return crypto.randomUUID?crypto.randomUUID():pU(t)}function pU(t,e,n){var s;t=t||{};const r=t.random??((s=t.rng)==null?void 0:s.call(t))??hU();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,dU(r)}const mU=300;class gU{constructor(){bo(this,"history",{current:new Map,past:[],future:[]});bo(this,"pendingChanges",new Map);bo(this,"currentBatchId",null);bo(this,"debounceTimer",null);bo(this,"onChangeCallbacks",[]);bo(this,"stateBeforePending",null);bo(this,"transactionDepth",0)}recordChange(e){this.pendingChanges.size===0&&(this.currentBatchId=Pk(),this.stateBeforePending=new Map(this.history.current)),this.currentBatchId&&(e.batchId=this.currentBatchId);const n=HT(e.elementId),r=e.type==="style"?FT(n,e.property):VT(n),s=Array.from(this.history.current.entries()).find(([a])=>a===r||a.startsWith(`${r}:`));if(s){const a=s[1];e.type==="style"&&a.type==="style"?e.oldValue=a.oldValue:e.type==="text"&&a.type==="text"&&(e.oldText=a.oldText)}const i=cU(e);this.history.current.set(i,e),this.pendingChanges.set(i,e),this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.commitPending()},mU),this.notifyChange()}flushPending(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.commitPending()}removeChange(e){const n=this.history.current.get(e)??this.pendingChanges.get(e)??null,r=this.history.current.has(e),s=this.pendingChanges.has(e);return!r&&!s?null:(r&&this.history.current.delete(e),s&&this.pendingChanges.delete(e),n&&this.stateBeforePending&&(this.stateBeforePending=this.removeChangeFromSnapshotById(this.stateBeforePending,n.id)),s&&this.pendingChanges.size===0&&(this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.stateBeforePending=null,this.currentBatchId=null),r&&(this.history.future=[]),n&&(this.history.past=this.history.past.map(i=>this.removeChangeFromSnapshotById(i,n.id)).filter(i=>i.size>0)),this.notifyChange(),n)}removeChangeById(e){const n=Array.from(this.history.current.entries()).find(([,s])=>s.id===e);if(n)return this.removeChange(n[0]);const r=Array.from(this.pendingChanges.entries()).find(([,s])=>s.id===e);return r?this.removeChange(r[0]):null}removeChangeFromSnapshotById(e,n){return new Map(Array.from(e.entries()).filter(([,r])=>r.id!==n))}commitPending(){this.pendingChanges.size===0||!this.stateBeforePending||this.transactionDepth>0||(this.history.past.push(this.stateBeforePending),this.history.future=[],this.pendingChanges.clear(),this.stateBeforePending=null,this.currentBatchId=null,this.notifyChange())}undo(){if(this.pendingChanges.size>0&&this.commitPending(),this.history.past.length===0)return null;const e=new Map(this.history.current);this.history.future.push(e),this.history.current=this.history.past.pop(),this.notifyChange();const n=[];for(const[r,s]of e)this.history.current.has(r)||n.push(s);return n}redo(){if(this.history.future.length===0)return null;const e=new Map(this.history.current);this.history.past.push(e),this.history.current=this.history.future.pop(),this.notifyChange();const n=[];for(const[r,s]of this.history.current)e.has(r)||n.push(s);return n}getChanges(){return Array.from(this.history.current.values())}getStyleChanges(){return Array.from(this.history.current.values()).filter(e=>e.type==="style")}getTextChanges(){return Array.from(this.history.current.values()).filter(e=>e.type==="text")}getChangeCount(){return this.getUniqueBatchCount(this.history.current.values())}getStyleBatchCount(){return this.getUniqueBatchCount(Array.from(this.history.current.values()).filter(e=>e.type==="style"))}getTextBatchCount(){return this.getUniqueBatchCount(Array.from(this.history.current.values()).filter(e=>e.type==="text"))}getUniqueBatchCount(e){const n=new Set;for(const r of e)r.batchId?n.add(r.batchId):n.add(r.id);return n.size}canUndo(){return this.history.past.length>0||this.pendingChanges.size>0}canRedo(){return this.history.future.length>0}clear(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.history={current:new Map,past:[],future:[]},this.pendingChanges.clear(),this.stateBeforePending=null,this.currentBatchId=null,this.notifyChange()}getStyleChange(e,n){return Array.from(this.history.current.values()).filter(s=>s.type==="style"&&Jh(s.elementId,e)&&s.property===n).sort((s,i)=>i.timestamp-s.timestamp)[0]}getTextChange(e){return Array.from(this.history.current.values()).filter(r=>r.type==="text"&&Jh(r.elementId,e)).sort((r,s)=>s.timestamp-r.timestamp)[0]}hasChanges(e){return Array.from(this.history.current.values()).some(n=>Jh(n.elementId,e))}getChangesForElement(e){return Array.from(this.history.current.values()).filter(n=>Jh(n.elementId,e))}onChange(e){return this.onChangeCallbacks.push(e),()=>{const n=this.onChangeCallbacks.indexOf(e);n!==-1&&this.onChangeCallbacks.splice(n,1)}}notifyChange(){this.onChangeCallbacks.forEach(e=>e())}export(){return{current:Array.from(this.history.current.entries()),past:this.history.past.map(e=>Array.from(e.entries())),future:this.history.future.map(e=>Array.from(e.entries()))}}import(e){this.history={current:new Map(e.current),past:e.past.map(n=>new Map(n)),future:e.future.map(n=>new Map(n))},this.notifyChange()}async transaction(e){const n=this.pendingChanges.size===0;n&&(this.currentBatchId=Pk(),this.stateBeforePending=new Map(this.history.current)),this.transactionDepth++;try{await e()}catch(r){throw n&&this.stateBeforePending&&(this.history.current=new Map(this.stateBeforePending),this.pendingChanges.clear(),this.currentBatchId=null,this.stateBeforePending=null),r}finally{this.transactionDepth--,n&&this.transactionDepth===0&&this.flushPending()}}}const bm={kind:"base"};function zd(t){return t.kind==="base"?"base":`variant:${t.sessionId}:${t.variantId}`}function vU(t,e){return t.kind==="base"&&e.kind,t.kind==="variant"&&e.kind==="variant"?t.sessionId===e.sessionId&&t.variantId===e.variantId:!1}const yU={resize:{default:!1},variants:{default:!1},designSystemEditor:{default:!1},branchDiff:{default:!1},gitUi:{default:!0},createProject:{default:!1},desktopForceUpgrade:{default:!1},deployPrototype:{default:!1},canvasShare:{default:!1},variantSend:{default:!1},generativeControls:{default:!1},refineMode:{default:!1},designContextViewer:{default:!1},variantReferences:{default:!1},inspectorUndoRedo:{default:!1}},zT=Object.fromEntries(Object.entries(yU).map(([t,e])=>[t,{isEnabled:e.default}]));et("view");const UT=et(!0),BT=et(null),_U=et("chat"),WT=et(0),GT=et({name:null,email:null}),Tk=et(bm);et(null);const Ud=new Map,xU=t=>{const e=zd(t);let n=Ud.get(e);return n||(n=new gU,Ud.set(e,n)),n};et(t=>xU(t(Tk)),(t,e,n)=>{Ud.set(zd(t(Tk)),n)});const wU=t=>{for(const e of[...Ud.keys()])e==="base"||t.has(e)||Ud.delete(e)},Bd=et(new Map),Ak=et(null);et(null);const l_=et(0),Sm=et(null),u_=et(!1),c_=et(null),KT=et(!1),ZT=et(!1),d_=et(null),f_=et(null),Wd=et(null),X2=et(null),qo=et(null),pf=et({active:!1}),qT=et([]),Rk=et(null),bU=(t,e,n)=>{let r=!1;const s=new Map(t);for(const[i,a]of t)a.target&&vU(a.target,e)&&(s.set(i,{...a,target:n}),r=!0);return r?s:t},SU=et(null,(t,e,n)=>{const r=c=>{const f=c??bm;return f.kind==="variant"&&!n.has(zd(f))},s=t(Bd);let i=null;for(const[c,f]of s)r(f.target)&&(i??(i=new Set)).add(c);if(i){const c=new Map(s);for(const f of i)c.delete(f);e(Bd,c)}const a=t(Ak);a&&r(a.target)&&(e(Ak,null),e(PU,!1));const u=t(Rk);u&&(i!=null&&i.has(u.commentId))&&e(Rk,null),wU(n)}),h_=et(zT),EU=et(!1),YT=et(null),mf=et(!0),XT=et(!1),QT=et(!1),JT=et(!1),e5=et(null),kU=()=>{var t;return typeof window>"u"?null:((t=window.__RIVET_BOOTSTRAP__)==null?void 0:t.agentApplyMode)??null},a0=et(kU()),CU=et(null),PU=et(!1);et(0);et(0);var Sp={exports:{}},TU=Sp.exports,Ik;function AU(){return Ik||(Ik=1,(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(TU,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"],i={},a=null;function u(_,b){var E=_[b];if(typeof E.bind=="function")return E.bind(_);try{return Function.prototype.bind.call(E,_)}catch{return function(){return Function.prototype.apply.apply(E,[_,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(_){return _==="debug"&&(_="log"),typeof console===n?!1:_==="trace"&&r?c:console[_]!==void 0?u(console,_):console.log!==void 0?u(console,"log"):e}function h(){for(var _=this.getLevel(),b=0;b<s.length;b++){var E=s[b];this[E]=b<_?e:this.methodFactory(E,_,this.name)}if(this.log=this.debug,typeof console===n&&_<this.levels.SILENT)return"No console available for logging"}function p(_){return function(){typeof console!==n&&(h.call(this),this[_].apply(this,arguments))}}function v(_,b,E){return f(_)||p.apply(this,arguments)}function y(_,b){var E=this,C,P,T,A="loglevel";typeof _=="string"?A+=":"+_:typeof _=="symbol"&&(A=void 0);function O(j){var V=(s[j]||"silent").toUpperCase();if(!(typeof window===n||!A)){try{window.localStorage[A]=V;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+V+";"}catch{}}}function M(){var j;if(!(typeof window===n||!A)){try{j=window.localStorage[A]}catch{}if(typeof j===n)try{var V=window.document.cookie,G=encodeURIComponent(A),Y=V.indexOf(G+"=");Y!==-1&&(j=/^([^;]+)/.exec(V.slice(Y+G.length+1))[1])}catch{}return E.levels[j]===void 0&&(j=void 0),j}}function R(){if(!(typeof window===n||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function L(j){var V=j;if(typeof V=="string"&&E.levels[V.toUpperCase()]!==void 0&&(V=E.levels[V.toUpperCase()]),typeof V=="number"&&V>=0&&V<=E.levels.SILENT)return V;throw new TypeError("log.setLevel() called with invalid level: "+j)}E.name=_,E.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},E.methodFactory=b||v,E.getLevel=function(){return T??P??C},E.setLevel=function(j,V){return T=L(j),V!==!1&&O(T),h.call(E)},E.setDefaultLevel=function(j){P=L(j),M()||E.setLevel(j,!1)},E.resetLevel=function(){T=null,R(),h.call(E)},E.enableAll=function(j){E.setLevel(E.levels.TRACE,j)},E.disableAll=function(j){E.setLevel(E.levels.SILENT,j)},E.rebuild=function(){if(a!==E&&(C=L(a.getLevel())),h.call(E),a===E)for(var j in i)i[j].rebuild()},C=L(a?a.getLevel():"WARN");var N=M();N!=null&&(T=L(N)),h.call(E)}a=new y,a.getLogger=function(b){if(typeof b!="symbol"&&typeof b!="string"||b==="")throw new TypeError("You must supply a name when creating a logger.");var E=i[b];return E||(E=i[b]=new y(b,a.methodFactory)),E};var x=typeof window!==n?window.log:void 0;return a.noConflict=function(){return typeof window!==n&&window.log===a&&(window.log=x),a},a.getLoggers=function(){return i},a.default=a,a})})(Sp)),Sp.exports}var RU=AU();const Cs=$m(RU),IU="INFO",MU=IU.toUpperCase();Cs.setLevel(Cs.levels[MU]||Cs.levels.INFO);const hs=t=>{const e=t?`[${t}] `:"";return{trace:(n,...r)=>Cs.trace(`${e}${n}`,...r),debug:(n,...r)=>Cs.debug(`${e}${n}`,...r),info:(n,...r)=>Cs.info(`${e}${n}`,...r),warn:(n,...r)=>Cs.warn(`${e}${n}`,...r),error:(n,...r)=>{Cs.error(`${e}${n}`,...r);try{const i=r.map(u=>u instanceof Error?u.message:String(u)).join(" ").slice(0,512),a={source:"ui",error_message:n,service:t??"unknown",error_type:"logged_error",url:window.location.pathname,error_args_count:r.length,...i?{error_detail:i}:{}};Te.capture("logger_error",a)}catch(s){console.error("[logger] Failed to send logger_error to PostHog:",s)}},api:(n,...r)=>Cs.info(`${e}API: ${n}`,...r),hook:(n,...r)=>Cs.debug(`${e}Hook: ${n}`,...r),mount:(n,...r)=>Cs.debug(`${e}Mount: ${n}`,...r)}};let Ep=0;const LU=()=>{Ep+=1;let t=!1;return()=>{t||(t=!0,Ep=Math.max(0,Ep-1))}},OU=()=>Ep>0;function NU(t){return t==="cursor"?"Cursor":t==="codex"?"Codex":t==="claude-desktop"?"Claude":"Claude Code"}const DU=["⡡⠊⢔⠡","⠊⡰⡡⡘","⢔⢅⠈⢢","⡁⢂⠆⡍","⢔⠨⢑⢐","⠨⡑⡠⠊"],Q2=({className:t,"data-testid":e}={})=>S.jsx("div",{className:`rivet-sparkle relative overflow-hidden font-mono leading-none ${t??"text-base text-primary"}`,style:{height:"1em",width:"4ch"},"aria-hidden":"true","data-testid":e,children:S.jsx("div",{className:"rivet-sparkle-strip",children:DU.map((n,r)=>S.jsx("span",{className:"block",style:{height:"1em",lineHeight:"1em"},children:n},r))})}),jU=["top","right","bottom","left"],Yo=Math.min,jr=Math.max,Em=Math.round,ep=Math.floor,ci=t=>({x:t,y:t}),FU={left:"right",right:"left",bottom:"top",top:"bottom"};function p_(t,e,n){return jr(t,Yo(e,n))}function Zi(t,e){return typeof t=="function"?t(e):t}function qi(t){return t.split("-")[0]}function qu(t){return t.split("-")[1]}function J2(t){return t==="x"?"y":"x"}function ex(t){return t==="y"?"height":"width"}function ii(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function tx(t){return J2(ii(t))}function VU(t,e,n){n===void 0&&(n=!1);const r=qu(t),s=tx(t),i=ex(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(a=km(a)),[a,km(a)]}function $U(t){const e=km(t);return[m_(t),e,m_(e)]}function m_(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Mk=["left","right"],Lk=["right","left"],HU=["top","bottom"],zU=["bottom","top"];function UU(t,e,n){switch(t){case"top":case"bottom":return n?e?Lk:Mk:e?Mk:Lk;case"left":case"right":return e?HU:zU;default:return[]}}function BU(t,e,n,r){const s=qu(t);let i=UU(qi(t),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),e&&(i=i.concat(i.map(m_)))),i}function km(t){const e=qi(t);return FU[e]+t.slice(e.length)}function WU(t){return{top:0,right:0,bottom:0,left:0,...t}}function t5(t){return typeof t!="number"?WU(t):{top:t,right:t,bottom:t,left:t}}function Cm(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function Ok(t,e,n){let{reference:r,floating:s}=t;const i=ii(e),a=tx(e),u=ex(a),c=qi(e),f=i==="y",h=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,v=r[u]/2-s[u]/2;let y;switch(c){case"top":y={x:h,y:r.y-s.height};break;case"bottom":y={x:h,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:p};break;case"left":y={x:r.x-s.width,y:p};break;default:y={x:r.x,y:r.y}}switch(qu(e)){case"start":y[a]-=v*(n&&f?-1:1);break;case"end":y[a]+=v*(n&&f?-1:1);break}return y}async function GU(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:a,elements:u,strategy:c}=t,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:p="floating",altBoundary:v=!1,padding:y=0}=Zi(e,t),x=t5(y),b=u[v?p==="floating"?"reference":"floating":p],E=Cm(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:f,rootBoundary:h,strategy:c})),C=p==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(P))?await(i.getScale==null?void 0:i.getScale(P))||{x:1,y:1}:{x:1,y:1},A=Cm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:P,strategy:c}):C);return{top:(E.top-A.top+x.top)/T.y,bottom:(A.bottom-E.bottom+x.bottom)/T.y,left:(E.left-A.left+x.left)/T.x,right:(A.right-E.right+x.right)/T.x}}const KU=50,ZU=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,u=a.detectOverflow?a:{...a,detectOverflow:GU},c=await(a.isRTL==null?void 0:a.isRTL(e));let f=await a.getElementRects({reference:t,floating:e,strategy:s}),{x:h,y:p}=Ok(f,r,c),v=r,y=0;const x={};for(let _=0;_<i.length;_++){const b=i[_];if(!b)continue;const{name:E,fn:C}=b,{x:P,y:T,data:A,reset:O}=await C({x:h,y:p,initialPlacement:r,placement:v,strategy:s,middlewareData:x,rects:f,platform:u,elements:{reference:t,floating:e}});h=P??h,p=T??p,x[E]={...x[E],...A},O&&y<KU&&(y++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(f=O.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:s}):O.rects),{x:h,y:p}=Ok(f,v,c)),_=-1)}return{x:h,y:p,placement:v,strategy:s,middlewareData:x}},qU=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:a,elements:u,middlewareData:c}=e,{element:f,padding:h=0}=Zi(t,e)||{};if(f==null)return{};const p=t5(h),v={x:n,y:r},y=tx(s),x=ex(y),_=await a.getDimensions(f),b=y==="y",E=b?"top":"left",C=b?"bottom":"right",P=b?"clientHeight":"clientWidth",T=i.reference[x]+i.reference[y]-v[y]-i.floating[x],A=v[y]-i.reference[y],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let M=O?O[P]:0;(!M||!await(a.isElement==null?void 0:a.isElement(O)))&&(M=u.floating[P]||i.floating[x]);const R=T/2-A/2,L=M/2-_[x]/2-1,N=Yo(p[E],L),j=Yo(p[C],L),V=N,G=M-_[x]-j,Y=M/2-_[x]/2+R,K=p_(V,Y,G),B=!c.arrow&&qu(s)!=null&&Y!==K&&i.reference[x]/2-(Y<V?N:j)-_[x]/2<0,X=B?Y<V?Y-V:Y-G:0;return{[y]:v[y]+X,data:{[y]:K,centerOffset:Y-K-X,...B&&{alignmentOffset:X}},reset:B}}}),YU=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:u,platform:c,elements:f}=e,{mainAxis:h=!0,crossAxis:p=!0,fallbackPlacements:v,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:_=!0,...b}=Zi(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const E=qi(s),C=ii(u),P=qi(u)===u,T=await(c.isRTL==null?void 0:c.isRTL(f.floating)),A=v||(P||!_?[km(u)]:$U(u)),O=x!=="none";!v&&O&&A.push(...BU(u,_,x,T));const M=[u,...A],R=await c.detectOverflow(e,b),L=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&L.push(R[E]),p){const Y=VU(s,a,T);L.push(R[Y[0]],R[Y[1]])}if(N=[...N,{placement:s,overflows:L}],!L.every(Y=>Y<=0)){var j,V;const Y=(((j=i.flip)==null?void 0:j.index)||0)+1,K=M[Y];if(K&&(!(p==="alignment"?C!==ii(K):!1)||N.every($=>ii($.placement)===C?$.overflows[0]>0:!0)))return{data:{index:Y,overflows:N},reset:{placement:K}};let B=(V=N.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(y){case"bestFit":{var G;const X=(G=N.filter($=>{if(O){const ee=ii($.placement);return ee===C||ee==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ee=>ee>0).reduce((ee,H)=>ee+H,0)]).sort(($,ee)=>$[1]-ee[1])[0])==null?void 0:G[0];X&&(B=X);break}case"initialPlacement":B=u;break}if(s!==B)return{reset:{placement:B}}}return{}}}};function Nk(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Dk(t){return jU.some(e=>t[e]>=0)}const XU=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=Zi(t,e);switch(s){case"referenceHidden":{const a=await r.detectOverflow(e,{...i,elementContext:"reference"}),u=Nk(a,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Dk(u)}}}case"escaped":{const a=await r.detectOverflow(e,{...i,altBoundary:!0}),u=Nk(a,n.floating);return{data:{escapedOffsets:u,escaped:Dk(u)}}}default:return{}}}}},n5=new Set(["left","top"]);async function QU(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=qi(n),u=qu(n),c=ii(n)==="y",f=n5.has(a)?-1:1,h=i&&c?-1:1,p=Zi(e,t);let{mainAxis:v,crossAxis:y,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return u&&typeof x=="number"&&(y=u==="end"?x*-1:x),c?{x:y*h,y:v*f}:{x:v*f,y:y*h}}const JU=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:a,middlewareData:u}=e,c=await QU(e,t);return a===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},eB=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:c={fn:E=>{let{x:C,y:P}=E;return{x:C,y:P}}},...f}=Zi(t,e),h={x:n,y:r},p=await i.detectOverflow(e,f),v=ii(qi(s)),y=J2(v);let x=h[y],_=h[v];if(a){const E=y==="y"?"top":"left",C=y==="y"?"bottom":"right",P=x+p[E],T=x-p[C];x=p_(P,x,T)}if(u){const E=v==="y"?"top":"left",C=v==="y"?"bottom":"right",P=_+p[E],T=_-p[C];_=p_(P,_,T)}const b=c.fn({...e,[y]:x,[v]:_});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[v]:u}}}}}},tB=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:a}=e,{offset:u=0,mainAxis:c=!0,crossAxis:f=!0}=Zi(t,e),h={x:n,y:r},p=ii(s),v=J2(p);let y=h[v],x=h[p];const _=Zi(u,e),b=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const P=v==="y"?"height":"width",T=i.reference[v]-i.floating[P]+b.mainAxis,A=i.reference[v]+i.reference[P]-b.mainAxis;y<T?y=T:y>A&&(y=A)}if(f){var E,C;const P=v==="y"?"width":"height",T=n5.has(qi(s)),A=i.reference[p]-i.floating[P]+(T&&((E=a.offset)==null?void 0:E[p])||0)+(T?0:b.crossAxis),O=i.reference[p]+i.reference[P]+(T?0:((C=a.offset)==null?void 0:C[p])||0)-(T?b.crossAxis:0);x<A?x=A:x>O&&(x=O)}return{[v]:y,[p]:x}}}},nB=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:a,elements:u}=e,{apply:c=()=>{},...f}=Zi(t,e),h=await a.detectOverflow(e,f),p=qi(s),v=qu(s),y=ii(s)==="y",{width:x,height:_}=i.floating;let b,E;p==="top"||p==="bottom"?(b=p,E=v===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(E=p,b=v==="end"?"top":"bottom");const C=_-h.top-h.bottom,P=x-h.left-h.right,T=Yo(_-h[b],C),A=Yo(x-h[E],P),O=!e.middlewareData.shift;let M=T,R=A;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=P),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(M=C),O&&!v){const N=jr(h.left,0),j=jr(h.right,0),V=jr(h.top,0),G=jr(h.bottom,0);y?R=x-2*(N!==0||j!==0?N+j:jr(h.left,h.right)):M=_-2*(V!==0||G!==0?V+G:jr(h.top,h.bottom))}await c({...e,availableWidth:R,availableHeight:M});const L=await a.getDimensions(u.floating);return x!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function l0(){return typeof window<"u"}function Yu(t){return r5(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function hi(t){var e;return(e=(r5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function r5(t){return l0()?t instanceof Node||t instanceof Br(t).Node:!1}function Rs(t){return l0()?t instanceof Element||t instanceof Br(t).Element:!1}function Ji(t){return l0()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function jk(t){return!l0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}function gf(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Is(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function rB(t){return/^(table|td|th)$/.test(Yu(t))}function u0(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sB=/transform|translate|scale|rotate|perspective|filter/,iB=/paint|layout|strict|content/,Aa=t=>!!t&&t!=="none";let o1;function nx(t){const e=Rs(t)?Is(t):t;return Aa(e.transform)||Aa(e.translate)||Aa(e.scale)||Aa(e.rotate)||Aa(e.perspective)||!rx()&&(Aa(e.backdropFilter)||Aa(e.filter))||sB.test(e.willChange||"")||iB.test(e.contain||"")}function oB(t){let e=Xo(t);for(;Ji(e)&&!Fu(e);){if(nx(e))return e;if(u0(e))return null;e=Xo(e)}return null}function rx(){return o1==null&&(o1=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),o1}function Fu(t){return/^(html|body|#document)$/.test(Yu(t))}function Is(t){return Br(t).getComputedStyle(t)}function c0(t){return Rs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Xo(t){if(Yu(t)==="html")return t;const e=t.assignedSlot||t.parentNode||jk(t)&&t.host||hi(t);return jk(e)?e.host:e}function s5(t){const e=Xo(t);return Fu(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ji(e)&&gf(e)?e:s5(e)}function Gd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=s5(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),a=Br(s);if(i){const u=g_(a);return e.concat(a,a.visualViewport||[],gf(s)?s:[],u&&n?Gd(u):[])}else return e.concat(s,Gd(s,[],n))}function g_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function i5(t){const e=Is(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ji(t),i=s?t.offsetWidth:n,a=s?t.offsetHeight:r,u=Em(n)!==i||Em(r)!==a;return u&&(n=i,r=a),{width:n,height:r,$:u}}function sx(t){return Rs(t)?t:t.contextElement}function uu(t){const e=sx(t);if(!Ji(e))return ci(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=i5(e);let a=(i?Em(n.width):n.width)/r,u=(i?Em(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const aB=ci(0);function o5(t){const e=Br(t);return!rx()||!e.visualViewport?aB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function dl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=sx(t);let a=ci(1);e&&(r?Rs(r)&&(a=uu(r)):a=uu(t));const u=lB(i,n,r)?o5(i):ci(0);let c=(s.left+u.x)/a.x,f=(s.top+u.y)/a.y,h=s.width/a.x,p=s.height/a.y;if(i){const v=Br(i),y=r&&Rs(r)?Br(r):r;let x=v,_=g_(x);for(;_&&r&&y!==x;){const b=uu(_),E=_.getBoundingClientRect(),C=Is(_),P=E.left+(_.clientLeft+parseFloat(C.paddingLeft))*b.x,T=E.top+(_.clientTop+parseFloat(C.paddingTop))*b.y;c*=b.x,f*=b.y,h*=b.x,p*=b.y,c+=P,f+=T,x=Br(_),_=g_(x)}}return Cm({width:h,height:p,x:c,y:f})}function d0(t,e){const n=c0(t).scrollLeft;return e?e.left+n:dl(hi(t)).left+n}function a5(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-d0(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function uB(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",a=hi(r),u=e?u0(e.floating):!1;if(r===a||u&&i)return n;let c={scrollLeft:0,scrollTop:0},f=ci(1);const h=ci(0),p=Ji(r);if((p||!p&&!i)&&((Yu(r)!=="body"||gf(a))&&(c=c0(r)),p)){const y=dl(r);f=uu(r),h.x=y.x+r.clientLeft,h.y=y.y+r.clientTop}const v=a&&!p&&!i?a5(a,c):ci(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+h.x+v.x,y:n.y*f.y-c.scrollTop*f.y+h.y+v.y}}function cB(t){return Array.from(t.getClientRects())}function dB(t){const e=hi(t),n=c0(t),r=t.ownerDocument.body,s=jr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=jr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+d0(t);const u=-n.scrollTop;return Is(r).direction==="rtl"&&(a+=jr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:u}}const Fk=25;function fB(t,e){const n=Br(t),r=hi(t),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,u=0,c=0;if(s){i=s.width,a=s.height;const h=rx();(!h||h&&e==="fixed")&&(u=s.offsetLeft,c=s.offsetTop)}const f=d0(r);if(f<=0){const h=r.ownerDocument,p=h.body,v=getComputedStyle(p),y=h.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-y);x<=Fk&&(i-=x)}else f<=Fk&&(i+=f);return{width:i,height:a,x:u,y:c}}function hB(t,e){const n=dl(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Ji(t)?uu(t):ci(1),a=t.clientWidth*i.x,u=t.clientHeight*i.y,c=s*i.x,f=r*i.y;return{width:a,height:u,x:c,y:f}}function Vk(t,e,n){let r;if(e==="viewport")r=fB(t,n);else if(e==="document")r=dB(hi(t));else if(Rs(e))r=hB(e,n);else{const s=o5(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Cm(r)}function l5(t,e){const n=Xo(t);return n===e||!Rs(n)||Fu(n)?!1:Is(n).position==="fixed"||l5(n,e)}function pB(t,e){const n=e.get(t);if(n)return n;let r=Gd(t,[],!1).filter(u=>Rs(u)&&Yu(u)!=="body"),s=null;const i=Is(t).position==="fixed";let a=i?Xo(t):t;for(;Rs(a)&&!Fu(a);){const u=Is(a),c=nx(a);!c&&u.position==="fixed"&&(s=null),(i?!c&&!s:!c&&u.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||gf(a)&&!c&&l5(t,a))?r=r.filter(h=>h!==a):s=u,a=Xo(a)}return e.set(t,r),r}function mB(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const a=[...n==="clippingAncestors"?u0(e)?[]:pB(e,this._c):[].concat(n),r],u=Vk(e,a[0],s);let c=u.top,f=u.right,h=u.bottom,p=u.left;for(let v=1;v<a.length;v++){const y=Vk(e,a[v],s);c=jr(y.top,c),f=Yo(y.right,f),h=Yo(y.bottom,h),p=jr(y.left,p)}return{width:f-p,height:h-c,x:p,y:c}}function gB(t){const{width:e,height:n}=i5(t);return{width:e,height:n}}function vB(t,e,n){const r=Ji(e),s=hi(e),i=n==="fixed",a=dl(t,!0,i,e);let u={scrollLeft:0,scrollTop:0};const c=ci(0);function f(){c.x=d0(s)}if(r||!r&&!i)if((Yu(e)!=="body"||gf(s))&&(u=c0(e)),r){const y=dl(e,!0,i,e);c.x=y.x+e.clientLeft,c.y=y.y+e.clientTop}else s&&f();i&&!r&&s&&f();const h=s&&!r&&!i?a5(s,u):ci(0),p=a.left+u.scrollLeft-c.x-h.x,v=a.top+u.scrollTop-c.y-h.y;return{x:p,y:v,width:a.width,height:a.height}}function a1(t){return Is(t).position==="static"}function $k(t,e){if(!Ji(t)||Is(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return hi(t)===n&&(n=n.ownerDocument.body),n}function u5(t,e){const n=Br(t);if(u0(t))return n;if(!Ji(t)){let s=Xo(t);for(;s&&!Fu(s);){if(Rs(s)&&!a1(s))return s;s=Xo(s)}return n}let r=$k(t,e);for(;r&&rB(r)&&a1(r);)r=$k(r,e);return r&&Fu(r)&&a1(r)&&!nx(r)?n:r||oB(t)||n}const yB=async function(t){const e=this.getOffsetParent||u5,n=this.getDimensions,r=await n(t.floating);return{reference:vB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _B(t){return Is(t).direction==="rtl"}const xB={convertOffsetParentRelativeRectToViewportRelativeRect:uB,getDocumentElement:hi,getClippingRect:mB,getOffsetParent:u5,getElementRects:yB,getClientRects:cB,getDimensions:gB,getScale:uu,isElement:Rs,isRTL:_B};function c5(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wB(t,e){let n=null,r;const s=hi(t);function i(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function a(u,c){u===void 0&&(u=!1),c===void 0&&(c=1),i();const f=t.getBoundingClientRect(),{left:h,top:p,width:v,height:y}=f;if(u||e(),!v||!y)return;const x=ep(p),_=ep(s.clientWidth-(h+v)),b=ep(s.clientHeight-(p+y)),E=ep(h),P={rootMargin:-x+"px "+-_+"px "+-b+"px "+-E+"px",threshold:jr(0,Yo(1,c))||1};let T=!0;function A(O){const M=O[0].intersectionRatio;if(M!==c){if(!T)return a();M?a(!1,M):r=setTimeout(()=>{a(!1,1e-7)},1e3)}M===1&&!c5(f,t.getBoundingClientRect())&&a(),T=!1}try{n=new IntersectionObserver(A,{...P,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,P)}n.observe(t)}return a(!0),i}function bB(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,f=sx(t),h=s||i?[...f?Gd(f):[],...e?Gd(e):[]]:[];h.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),i&&E.addEventListener("resize",n)});const p=f&&u?wB(f,n):null;let v=-1,y=null;a&&(y=new ResizeObserver(E=>{let[C]=E;C&&C.target===f&&y&&e&&(y.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var P;(P=y)==null||P.observe(e)})),n()}),f&&!c&&y.observe(f),e&&y.observe(e));let x,_=c?dl(t):null;c&&b();function b(){const E=dl(t);_&&!c5(_,E)&&n(),_=E,x=requestAnimationFrame(b)}return n(),()=>{var E;h.forEach(C=>{s&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),p==null||p(),(E=y)==null||E.disconnect(),y=null,c&&cancelAnimationFrame(x)}}const SB=JU,EB=eB,kB=YU,CB=nB,PB=XU,Hk=qU,TB=tB,AB=(t,e,n)=>{const r=new Map,s={platform:xB,...n},i={...s.platform,_c:r};return ZU(t,e,{...s,platform:i})};var RB=typeof document<"u",IB=function(){},kp=RB?g.useLayoutEffect:IB;function Pm(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Pm(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!Pm(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function d5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function zk(t,e){const n=d5(t);return Math.round(e*n)/n}function l1(t){const e=g.useRef(t);return kp(()=>{e.current=t}),e}function MB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:u=!0,whileElementsMounted:c,open:f}=t,[h,p]=g.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[v,y]=g.useState(r);Pm(v,r)||y(r);const[x,_]=g.useState(null),[b,E]=g.useState(null),C=g.useCallback($=>{$!==O.current&&(O.current=$,_($))},[]),P=g.useCallback($=>{$!==M.current&&(M.current=$,E($))},[]),T=i||x,A=a||b,O=g.useRef(null),M=g.useRef(null),R=g.useRef(h),L=c!=null,N=l1(c),j=l1(s),V=l1(f),G=g.useCallback(()=>{if(!O.current||!M.current)return;const $={placement:e,strategy:n,middleware:v};j.current&&($.platform=j.current),AB(O.current,M.current,$).then(ee=>{const H={...ee,isPositioned:V.current!==!1};Y.current&&!Pm(R.current,H)&&(R.current=H,qm.flushSync(()=>{p(H)}))})},[v,e,n,j,V]);kp(()=>{f===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,p($=>({...$,isPositioned:!1})))},[f]);const Y=g.useRef(!1);kp(()=>(Y.current=!0,()=>{Y.current=!1}),[]),kp(()=>{if(T&&(O.current=T),A&&(M.current=A),T&&A){if(N.current)return N.current(T,A,G);G()}},[T,A,G,N,L]);const K=g.useMemo(()=>({reference:O,floating:M,setReference:C,setFloating:P}),[C,P]),B=g.useMemo(()=>({reference:T,floating:A}),[T,A]),X=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!B.floating)return $;const ee=zk(B.floating,h.x),H=zk(B.floating,h.y);return u?{...$,transform:"translate("+ee+"px, "+H+"px)",...d5(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ee,top:H}},[n,u,B.floating,h.x,h.y]);return g.useMemo(()=>({...h,update:G,refs:K,elements:B,floatingStyles:X}),[h,G,K,B,X])}const LB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?Hk({element:r.current,padding:s}).fn(n):{}:r?Hk({element:r,padding:s}).fn(n):{}}}},OB=(t,e)=>{const n=SB(t);return{name:n.name,fn:n.fn,options:[t,e]}},NB=(t,e)=>{const n=EB(t);return{name:n.name,fn:n.fn,options:[t,e]}},DB=(t,e)=>({fn:TB(t).fn,options:[t,e]}),jB=(t,e)=>{const n=kB(t);return{name:n.name,fn:n.fn,options:[t,e]}},FB=(t,e)=>{const n=CB(t);return{name:n.name,fn:n.fn,options:[t,e]}},VB=(t,e)=>{const n=PB(t);return{name:n.name,fn:n.fn,options:[t,e]}},$B=(t,e)=>{const n=LB(t);return{name:n.name,fn:n.fn,options:[t,e]}};var HB="Arrow",f5=g.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return S.jsx(Rt.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});f5.displayName=HB;var zB=f5;function h5(t){const[e,n]=g.useState(void 0);return ui(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let a,u;if("borderBoxSize"in i){const c=i.borderBoxSize,f=Array.isArray(c)?c[0]:c;a=f.inlineSize,u=f.blockSize}else a=t.offsetWidth,u=t.offsetHeight;n({width:a,height:u})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var ix="Popper",[p5,f0]=na(ix),[UB,m5]=p5(ix),g5=t=>{const{__scopePopper:e,children:n}=t,[r,s]=g.useState(null),[i,a]=g.useState(void 0);return S.jsx(UB,{scope:e,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:a,children:n})};g5.displayName=ix;var v5="PopperAnchor",y5=g.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=m5(v5,n),a=g.useRef(null),u=i.onAnchorChange,c=g.useCallback(x=>{a.current=x,x&&u(x)},[u]),f=Yt(e,c),h=g.useRef(null);g.useEffect(()=>{if(!r)return;const x=h.current;h.current=r.current,x!==h.current&&u(h.current)});const p=i.placementState&&ax(i.placementState),v=p==null?void 0:p[0],y=p==null?void 0:p[1];return r?null:S.jsx(Rt.div,{"data-radix-popper-side":v,"data-radix-popper-align":y,...s,ref:f})});y5.displayName=v5;var ox="PopperContent",[BB,WB]=p5(ox),_5=g.forwardRef((t,e)=>{var ie,ae,me,Se,Re,Ke;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:u=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:h=0,sticky:p="partial",hideWhenDetached:v=!1,updatePositionStrategy:y="optimized",onPlaced:x,..._}=t,b=m5(ox,n),[E,C]=g.useState(null),P=Yt(e,C),[T,A]=g.useState(null),O=h5(T),M=(O==null?void 0:O.width)??0,R=(O==null?void 0:O.height)??0,L=r+(i!=="center"?"-"+i:""),N=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},j=Array.isArray(f)?f:[f],V=j.length>0,G={padding:N,boundary:j.filter(KB),altBoundary:V},{refs:Y,floatingStyles:K,placement:B,isPositioned:X,middlewareData:$}=MB({strategy:"fixed",placement:L,whileElementsMounted:(...it)=>bB(...it,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[OB({mainAxis:s+R,alignmentAxis:a}),c&&NB({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?DB():void 0,...G}),c&&jB({...G}),FB({...G,apply:({elements:it,rects:Oe,availableWidth:at,availableHeight:It})=>{const{width:mt,height:je}=Oe.reference,Qe=it.floating.style;Qe.setProperty("--radix-popper-available-width",`${at}px`),Qe.setProperty("--radix-popper-available-height",`${It}px`),Qe.setProperty("--radix-popper-anchor-width",`${mt}px`),Qe.setProperty("--radix-popper-anchor-height",`${je}px`)}}),T&&$B({element:T,padding:u}),ZB({arrowWidth:M,arrowHeight:R}),v&&VB({strategy:"referenceHidden",...G,boundary:V?G.boundary:void 0})]}),ee=b.setPlacementState;ui(()=>(ee(B),()=>{ee(void 0)}),[B,ee]);const[H,D]=ax(B),q=Du(x);ui(()=>{X&&(q==null||q())},[X,q]);const re=(ie=$.arrow)==null?void 0:ie.x,se=(ae=$.arrow)==null?void 0:ae.y,oe=((me=$.arrow)==null?void 0:me.centerOffset)!==0,[ue,de]=g.useState();return ui(()=>{E&&de(window.getComputedStyle(E).zIndex)},[E]),S.jsx("div",{ref:Y.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:X?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(Se=$.transformOrigin)==null?void 0:Se.x,(Re=$.transformOrigin)==null?void 0:Re.y].join(" "),...((Ke=$.hide)==null?void 0:Ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:S.jsx(BB,{scope:n,placedSide:H,placedAlign:D,onArrowChange:A,arrowX:re,arrowY:se,shouldHideArrow:oe,children:S.jsx(Rt.div,{"data-side":H,"data-align":D,..._,ref:P,style:{..._.style,animation:X?void 0:"none"}})})})});_5.displayName=ox;var x5="PopperArrow",GB={top:"bottom",right:"left",bottom:"top",left:"right"},w5=g.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=WB(x5,r),a=GB[i.placedSide];return S.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:S.jsx(zB,{...s,ref:n,style:{...s.style,display:"block"}})})});w5.displayName=x5;function KB(t){return t!==null}var ZB=t=>({name:"transformOrigin",options:t,fn(e){var b,E,C;const{placement:n,rects:r,middlewareData:s}=e,a=((b=s.arrow)==null?void 0:b.centerOffset)!==0,u=a?0:t.arrowWidth,c=a?0:t.arrowHeight,[f,h]=ax(n),p={start:"0%",center:"50%",end:"100%"}[h],v=(((E=s.arrow)==null?void 0:E.x)??0)+u/2,y=(((C=s.arrow)==null?void 0:C.y)??0)+c/2;let x="",_="";return f==="bottom"?(x=a?p:`${v}px`,_=`${-c}px`):f==="top"?(x=a?p:`${v}px`,_=`${r.floating.height+c}px`):f==="right"?(x=`${-c}px`,_=a?p:`${y}px`):f==="left"&&(x=`${r.floating.width+c}px`,_=a?p:`${y}px`),{data:{x,y:_}}}});function ax(t){const[e,n="center"]=t.split("-");return[e,n]}var b5=g5,lx=y5,S5=_5,E5=w5,h0="Popover",[k5]=na(h0,[f0]),vf=f0(),[qB,sa]=k5(h0),C5=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,u=vf(e),c=g.useRef(null),[f,h]=g.useState(!1),[p,v]=fl({prop:r,defaultProp:s??!1,onChange:i,caller:h0});return S.jsx(b5,{...u,children:S.jsx(qB,{scope:e,contentId:il(),triggerRef:c,open:p,onOpenChange:v,onOpenToggle:g.useCallback(()=>v(y=>!y),[v]),hasCustomAnchor:f,onCustomAnchorAdd:g.useCallback(()=>h(!0),[]),onCustomAnchorRemove:g.useCallback(()=>h(!1),[]),modal:a,children:n})})};C5.displayName=h0;var P5="PopoverAnchor",YB=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(P5,n),i=vf(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:u}=s;return g.useEffect(()=>(a(),()=>u()),[a,u]),S.jsx(lx,{...i,...r,ref:e})});YB.displayName=P5;var T5="PopoverTrigger",A5=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(T5,n),i=vf(n),a=Yt(e,s.triggerRef),u=S.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":O5(s.open),...r,ref:a,onClick:Et(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?u:S.jsx(lx,{asChild:!0,...i,children:u})});A5.displayName=T5;var ux="PopoverPortal",[XB,QB]=k5(ux,{forceMount:void 0}),R5=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=sa(ux,e);return S.jsx(XB,{scope:e,forceMount:n,children:S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:r})})})};R5.displayName=ux;var Vu="PopoverContent",I5=g.forwardRef((t,e)=>{const n=QB(Vu,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=sa(Vu,t.__scopePopover);return S.jsx(Qi,{present:r||i.open,children:i.modal?S.jsx(eW,{...s,ref:e}):S.jsx(tW,{...s,ref:e})})});I5.displayName=Vu;var JB=Vd("PopoverContent.RemoveScroll"),eW=g.forwardRef((t,e)=>{const n=sa(Vu,t.__scopePopover),r=g.useRef(null),s=Yt(e,r),i=g.useRef(!1);return g.useEffect(()=>{const a=r.current;if(a)return Z3(a)},[]),S.jsx(G2,{as:JB,allowPinchZoom:!0,children:S.jsx(M5,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Et(t.onCloseAutoFocus,a=>{var u;a.preventDefault(),i.current||(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:Et(t.onPointerDownOutside,a=>{const u=a.detail.originalEvent,c=u.button===0&&u.ctrlKey===!0,f=u.button===2||c;i.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:Et(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),tW=g.forwardRef((t,e)=>{const n=sa(Vu,t.__scopePopover),r=g.useRef(!1),s=g.useRef(!1);return S.jsx(M5,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,u;(a=t.onCloseAutoFocus)==null||a.call(t,i),i.defaultPrevented||(r.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,f;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),M5=g.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onInteractOutside:h,...p}=t,v=sa(Vu,n),y=vf(n);return V3(),S.jsx(W2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:S.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:u,onPointerDownOutside:c,onFocusOutside:f,onDismiss:()=>v.onOpenChange(!1),deferPointerDownOutside:!0,children:S.jsx(S5,{"data-state":O5(v.open),role:"dialog",id:v.contentId,...y,...p,ref:e,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L5="PopoverClose",nW=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=sa(L5,n);return S.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Et(t.onClick,()=>s.onOpenChange(!1))})});nW.displayName=L5;var rW="PopoverArrow",sW=g.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=vf(n);return S.jsx(E5,{...s,...r,ref:e})});sW.displayName=rW;function O5(t){return t?"open":"closed"}var N5=C5,D5=A5,j5=R5,F5=I5;const V5=({primaryLabel:t,primaryIcon:e,primaryAction:n,isDisabled:r=!1,isDropdownDisabled:s=!1,isLoading:i=!1,loadingLabel:a,dropdownAriaLabel:u="More actions",dropdownItems:c})=>{const[f,h]=g.useState(!1),p=i?a??t:t,v=c.length>0;return S.jsxs("div",{className:"flex items-stretch",children:[S.jsxs("button",{onClick:n,disabled:r||i,className:`bg-main-hover hover:bg-main-input flex h-7 shrink-0 items-center gap-1.5 px-3 text-xs font-medium text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${v?"rounded-l-md":"rounded-md"}`,children:[e?S.jsx(e,{className:"h-3.5 w-3.5",weight:"bold"}):null,p]}),v?S.jsxs(N5,{open:f,onOpenChange:h,children:[S.jsx(D5,{asChild:!0,children:S.jsx("button",{"aria-label":u,disabled:s||i,title:u,className:"bg-main-hover hover:bg-main-input h-7 shrink-0 rounded-r-md border-l border-white/20 px-1.5 text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(cz,{className:"h-3.5 w-3.5",weight:"bold"})})}),S.jsx(j5,{children:S.jsx(F5,{className:"border-divider bg-main z-[60] min-w-[140px] rounded-lg border p-1 shadow-lg",sideOffset:5,align:"end",children:c.map(y=>{const x=y.icon;return S.jsxs("button",{onClick:()=>{y.isDisabled||(y.onClick(),h(!1))},disabled:y.isDisabled,className:"text-content hover:bg-hover flex w-full items-center gap-2 rounded px-3 py-1.5 text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[x?S.jsx(x,{className:"h-3.5 w-3.5",weight:"bold"}):null,y.label]},y.label)})})})]}):null]})};var iW=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),oW="VisuallyHidden",$5=g.forwardRef((t,e)=>S.jsx(Rt.span,{...t,ref:e,style:{...iW,...t.style}}));$5.displayName=oW;var aW=$5,[p0]=na("Tooltip",[f0]),m0=f0(),H5="TooltipProvider",lW=700,v_="tooltip.open",[uW,cx]=p0(H5),z5=t=>{const{__scopeTooltip:e,delayDuration:n=lW,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=g.useRef(!0),u=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),S.jsx(uW,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:u,onPointerInTransitChange:g.useCallback(f=>{u.current=f},[]),disableHoverableContent:s,children:i})};z5.displayName=H5;var Kd="Tooltip",[cW,yf]=p0(Kd),U5=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:u}=t,c=cx(Kd,t.__scopeTooltip),f=m0(e),[h,p]=g.useState(null),v=il(),y=g.useRef(0),x=a??c.disableHoverableContent,_=u??c.delayDuration,b=g.useRef(!1),[E,C]=fl({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(v_))):c.onClose(),i==null||i(M)},caller:Kd}),P=g.useMemo(()=>E?b.current?"delayed-open":"instant-open":"closed",[E]),T=g.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,C(!0)},[C]),A=g.useCallback(()=>{window.clearTimeout(y.current),y.current=0,C(!1)},[C]),O=g.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,C(!0),y.current=0},_)},[_,C]);return g.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),S.jsx(b5,{...f,children:S.jsx(cW,{scope:e,contentId:v,open:E,stateAttribute:P,trigger:h,onTriggerChange:p,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?O():T()},[c.isOpenDelayedRef,O,T]),onTriggerLeave:g.useCallback(()=>{x?A():(window.clearTimeout(y.current),y.current=0)},[A,x]),onOpen:T,onClose:A,disableHoverableContent:x,children:n})})};U5.displayName=Kd;var y_="TooltipTrigger",B5=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=yf(y_,n),i=cx(y_,n),a=m0(n),u=g.useRef(null),c=Yt(e,u,s.onTriggerChange),f=g.useRef(!1),h=g.useRef(!1),p=g.useCallback(()=>f.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),S.jsx(lx,{asChild:!0,...a,children:S.jsx(Rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Et(t.onPointerMove,v=>{v.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:Et(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:Et(t.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Et(t.onFocus,()=>{f.current||s.onOpen()}),onBlur:Et(t.onBlur,s.onClose),onClick:Et(t.onClick,s.onClose)})})});B5.displayName=y_;var dx="TooltipPortal",[dW,fW]=p0(dx,{forceMount:void 0}),W5=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=yf(dx,e);return S.jsx(dW,{scope:e,forceMount:n,children:S.jsx(Qi,{present:n||i.open,children:S.jsx(Xm,{asChild:!0,container:s,children:r})})})};W5.displayName=dx;var $u="TooltipContent",G5=g.forwardRef((t,e)=>{const n=fW($u,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=yf($u,t.__scopeTooltip);return S.jsx(Qi,{present:r||a.open,children:a.disableHoverableContent?S.jsx(K5,{side:s,...i,ref:e}):S.jsx(hW,{side:s,...i,ref:e})})}),hW=g.forwardRef((t,e)=>{const n=yf($u,t.__scopeTooltip),r=cx($u,t.__scopeTooltip),s=g.useRef(null),i=Yt(e,s),[a,u]=g.useState(null),{trigger:c,onClose:f}=n,h=s.current,{onPointerInTransitChange:p}=r,v=g.useCallback(()=>{u(null),p(!1)},[p]),y=g.useCallback((x,_)=>{const b=x.currentTarget,E={x:x.clientX,y:x.clientY},C=yW(E,b.getBoundingClientRect()),P=_W(E,C),T=xW(_.getBoundingClientRect()),A=bW([...P,...T]);u(A),p(!0)},[p]);return g.useEffect(()=>()=>v(),[v]),g.useEffect(()=>{if(c&&h){const x=b=>y(b,h),_=b=>y(b,c);return c.addEventListener("pointerleave",x),h.addEventListener("pointerleave",_),()=>{c.removeEventListener("pointerleave",x),h.removeEventListener("pointerleave",_)}}},[c,h,y,v]),g.useEffect(()=>{if(a){const x=_=>{const b=_.target,E={x:_.clientX,y:_.clientY},C=(c==null?void 0:c.contains(b))||(h==null?void 0:h.contains(b)),P=!wW(E,a);C?v():P&&(v(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,h,a,f,v]),S.jsx(K5,{...t,ref:i})}),[pW,mW]=p0(Kd,{isInside:!1}),gW=_$("TooltipContent"),K5=g.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...u}=t,c=yf($u,n),f=m0(n),{onClose:h}=c;return g.useEffect(()=>(document.addEventListener(v_,h),()=>document.removeEventListener(v_,h)),[h]),g.useEffect(()=>{if(c.trigger){const p=v=>{v.target instanceof Node&&v.target.contains(c.trigger)&&h()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,h]),S.jsx(Ym,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:p=>p.preventDefault(),onDismiss:h,children:S.jsxs(S5,{"data-state":c.stateAttribute,...f,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[S.jsx(gW,{children:r}),S.jsx(pW,{scope:n,isInside:!0,children:S.jsx(aW,{id:c.contentId,role:"tooltip",children:s||r})})]})})});G5.displayName=$u;var Z5="TooltipArrow",vW=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=m0(n);return mW(Z5,n).isInside?null:S.jsx(E5,{...s,...r,ref:e})});vW.displayName=Z5;function yW(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function _W(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function xW(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function wW(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const u=e[i],c=e[a],f=u.x,h=u.y,p=c.x,v=c.y;h>r!=v>r&&n<(p-f)*(r-h)/(v-h)+f&&(s=!s)}return s}function bW(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),SW(e)}function SW(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var EW=z5,kW=U5,CW=B5,PW=W5,TW=G5;const _d={normal:"'wght' 400",medium:"'wght' 450",semibold:"'wght' 550"},q5={pill:{item:"rounded-[20px]",bg:"rounded-[20px]",focusRing:"rounded-[22px]",mergedBg:"rounded-2xl",container:"rounded-3xl",button:"rounded-[20px]",input:"rounded-[20px]"},rounded:{item:"rounded-lg",bg:"rounded-lg",focusRing:"rounded-[10px]",mergedBg:"rounded-lg",container:"rounded-xl",button:"rounded-lg",input:"rounded-lg"}},Y5=g.createContext(null);function g0(){const t=g.useContext(Y5);return t?t.classes:q5.pill}function AW(t){const e=document.documentElement;e.classList.add("transitioning"),e.offsetHeight,t(),setTimeout(()=>e.classList.remove("transitioning"),200)}function RW({children:t,defaultShape:e="pill"}){const[n,r]=g.useState(e),s=g.useCallback(i=>{AW(()=>r(i))},[]);return S.jsx(Y5.Provider,{value:{shape:n,setShape:s,classes:q5[n]},children:t})}const X5=g.createContext(null);function Q5({value:t,children:e}){return S.jsx(X5.Provider,{value:t,children:e})}function IW(t){switch(t){case"top":return{y:4};case"bottom":return{y:-4};case"left":return{x:4};case"right":return{x:-4}}}function fx({content:t,children:e,side:n="top",sideOffset:r=8,delayDuration:s=200,className:i,forceOpen:a,onOpenChange:u}){const[c,f]=g.useState(!1),h=a!==void 0?a:c,[p,v]=g.useState(!1),y=g0(),x=g.useContext(X5);g.useEffect(()=>{h&&v(!0)},[h]);const _=()=>{h||v(!1)},b=IW(n);return S.jsx(EW,{delayDuration:s,children:S.jsxs(kW,{open:h,onOpenChange:E=>{f(E),u==null||u(E)},children:[S.jsx(CW,{asChild:!0,children:e}),p&&S.jsx(PW,{forceMount:!0,container:x??void 0,children:S.jsx(TW,{side:n,sideOffset:r,forceMount:!0,className:"z-tooltip",children:S.jsx(Ki.div,{className:lr("bg-neutral-900 text-white text-[12px] px-2 py-1 border border-white/10 shadow-lg",y.bg,i),style:{fontVariationSettings:_d.medium},initial:{opacity:0,scale:.8,...b},animate:{opacity:h?1:0,scale:h?1:.9,x:0,y:0},transition:h?{type:"spring",duration:.34,bounce:.55}:{duration:.1},onAnimationComplete:_,children:t})})})]})})}const Fo=({label:t,children:e,side:n="top",sideOffset:r=8,delayDuration:s=300,disabled:i=!1,forceOpen:a})=>i?S.jsx(S.Fragment,{children:e}):S.jsx(fx,{content:t,side:n,sideOffset:r,delayDuration:s,forceOpen:a,children:e}),v0="/__rivet/preview",Uk=`${v0}/variant/`,Bk=`${v0}/history/`,J5=t=>t?t.startsWith("/")?t:`/${t}`:"/",MW=t=>`${v0}/variant/${encodeURIComponent(t.sessionId)}/${encodeURIComponent(t.variantId)}${J5(t.routePath)}`,LW=t=>`${v0}/history/${encodeURIComponent(t.sessionId)}/${encodeURIComponent(t.variantId)}${J5(t.routePath)}`,OW=t=>{try{const e=new URL(t,"http://localhost");return e.pathname.startsWith(Uk)||e.pathname.startsWith(Bk)}catch{return t.startsWith(Uk)||t.startsWith(Bk)}},Wk=t=>{var s,i,a,u;const{sessionId:e,variant:n,projectContext:r}=t;return n.status!=="succeeded"?null:((s=n.preview)==null?void 0:s.kind)==="static_artifact"?n.preview.url:e&&(((i=n.preview)==null?void 0:i.kind)==="dev_server"||typeof n.port=="number")?MW({sessionId:e,variantId:n.workItemId,routePath:t.routePath}):e&&(r==null?void 0:r.kind)==="fresh"&&((a=r.executionPlan)==null?void 0:a.mode)!=="vite_app"&&((u=n.preview)==null?void 0:u.kind)!=="dev_server"?`/api/variants/${e}/static/${n.workItemId}`:null},Gk="/rivet/",eA=t=>{if(!t.startsWith(Gk))return null;const e=t.slice(Gk.length);return!e||e==="/"?null:`/${e}`},Zd=(t,e=fetch)=>{if((t==null?void 0:t.source)!=="history-dev-server")return;const n=new URLSearchParams({sessionId:t.sessionId,variantId:t.variantId});e(`/api/variants/history/replay/stop?${n.toString()}`,{method:"POST"}).catch(()=>{})},NW=(t,e=fetch)=>{const n=new Set;for(const r of[t==null?void 0:t.left,t==null?void 0:t.right]){if((r==null?void 0:r.source)!=="history-dev-server")continue;const s=`${r.sessionId}:${r.variantId}`;n.has(s)||(n.add(s),Zd(r,e))}},Kk=6,__="original",hx="Original",px="The original state of your app before any variants were generated.",Zk=200,vn=hs("AgentVariantsPanel"),u1=()=>{var t;(t=window.getSelection())==null||t.removeAllRanges()},DW=t=>t?t.kind==="active"?t.variant.workItemId:`${t.entry.sessionId}:${t.entry.variantId}`:null,Xc=t=>{var e;return!!t.hasTree&&((e=t.serve)==null?void 0:e.kind)==="dev-server"},jW=t=>{var e;return t?t.kind==="existing"?!0:((e=t.executionPlan)==null?void 0:e.mode)==="vite_app":!1};function cu(t,...e){return t?e.some(n=>(n??"").toLowerCase().includes(t)):!0}async function Eo(t){try{const e=await t.json();return{message:typeof e.message=="string"?e.message:null,errorCode:typeof e.errorCode=="string"?e.errorCode:null}}catch{return{message:null,errorCode:null}}}const FW=t=>{var n,r;const e=((r=(n=t.actions)==null?void 0:n.commit)==null?void 0:r.enabled)??t.status==="succeeded";return t.status==="succeeded"&&e},$a=t=>{var e,n;return t.status!=="succeeded"?!1:((n=(e=t.actions)==null?void 0:e.view)==null?void 0:n.enabled)??(!!t.preview||typeof t.port=="number")},tA=t=>t.status==="succeeded"&&!$a(t)&&!t.previewUnavailable,Cp=t=>{var e,n;return((e=t.preview)==null?void 0:e.kind)==="static_artifact"?"static_artifact":((n=t.preview)==null?void 0:n.kind)==="dev_server"||typeof t.port=="number"?"dev_server":"none"},qk=(t,e,n)=>{const r=t.includes("?")?"&":"?";return`${t}${r}${encodeURIComponent(e)}=${encodeURIComponent(n)}`},VW=t=>{var e;return FW(t)&&((e=t.preview)==null?void 0:e.kind)==="static_artifact"},Yk=(t,e)=>t.map(n=>`${n.workItemId}:${e[n.workItemId]??""}`).join("|"),$W=(t,e)=>t.length===e.length&&t.every((n,r)=>{var i,a;const s=e[r];return n.sessionId===s.sessionId&&n.variantId===s.variantId&&n.label===s.label&&n.brief===s.brief&&n.createdAt===s.createdAt&&((i=n.serve)==null?void 0:i.kind)===((a=s.serve)==null?void 0:a.kind)&&n.hasTree===s.hasTree}),HW=()=>{var la,kf,sc,ua;const t=Xe(pf),e=Xe(qT),n=Xe(YT),r=Xe(mf),s=Xe(h_),i=((la=s.deployPrototype)==null?void 0:la.isEnabled)??!1,a=((kf=s.canvasShare)==null?void 0:kf.isEnabled)??!1,u=((sc=s.variantSend)==null?void 0:sc.isEnabled)??!1,c=((ua=s.designContextViewer)==null?void 0:ua.isEnabled)??!1,f=Xe(JT),h=Xe(e5),p=st(l_),v=st(Sm),y=st(u_),x=st(c_),_=st(KT),b=st(ZT),E=st(Wd),C=st(X2),P=st(BT);g.useEffect(()=>(P("Directions"),()=>P(null)),[P]);const T=Xe(qo),A=st(qo),O=g.useCallback(()=>{NW(T),A(null)},[A,T]),M=Xe(d_),R=st(d_),L=Xe(f_),N=st(f_),j=L?`${L.sessionId}:${L.variantId}`:null,[V,G]=g.useState(""),[Y,K]=g.useState(null),[B,X]=g.useState(null),[$,ee]=g.useState({}),[H,D]=g.useState(null),[q,re]=g.useState({}),[se,oe]=g.useState(null),[ue,de]=g.useState([]),ie=g.useRef([]);ie.current=ue;const[ae,me]=g.useState(!1),Se=g.useMemo(()=>t.active?t.variants:[],[t]),Re=g.useMemo(()=>Se.filter(VW),[Se]),Ke=g.useMemo(()=>Yk(Re,$),[Re,$]),it=(H==null?void 0:H.key)===Ke?H.shareUrl:null,Oe=t.active?t.sessionId:null,at=g.useMemo(()=>{const z=new Set;for(const le of ue){const xe=le.parentVariant;xe&&xe.sessionId!==le.sessionId&&z.add(xe.sessionId)}return z},[ue]),It=g.useMemo(()=>{var le;const z=new Set;for(const xe of Se)(le=xe.adoptedSource)!=null&&le.sessionId&&z.add(xe.adoptedSource.sessionId);return z},[Se]),mt=g.useMemo(()=>[...ue.filter(le=>le.sessionId!==Oe&&!at.has(le.sessionId)&&!It.has(le.sessionId))].sort((le,xe)=>{const ge=new Date(le.createdAt).getTime(),we=new Date(xe.createdAt).getTime();return(Number.isNaN(we)?0:we)-(Number.isNaN(ge)?0:ge)}),[ue,Oe,at,It]),je=g.useMemo(()=>L?Se.find(z=>{var le,xe;return((le=z.adoptedSource)==null?void 0:le.sessionId)===L.sessionId&&((xe=z.adoptedSource)==null?void 0:xe.variantId)===L.variantId})??null:null,[L,Se]),Qe=g.useMemo(()=>L?mt.find(z=>z.sessionId===L.sessionId&&z.variantId===L.variantId)??null:null,[L,mt]),lt=t.active?t.projectContext:null,Je=(lt==null?void 0:lt.kind)==="fresh"?lt.workspacePath:n,vt=!t.active&&mt.length>0&&mt.every(z=>z.projectKind==="fresh"),xn=t.active?jW(lt):!!n&&!vt,zt=g.useMemo(()=>Je?`?projectPath=${encodeURIComponent(Je)}`:"",[Je]),An=g.useRef(null),Xn=g.useRef(null),Pr=typeof window>"u"?"/":eA(window.location.pathname)??"/",Qn=g.useRef(null),wn=g.useRef(!1),Os=g.useCallback((z,le)=>{le.button!==0&&le.pointerType==="mouse"||(le.preventDefault(),u1(),Qn.current={kind:"live",variantId:z,startX:le.clientX,startY:le.clientY,committed:!1})},[]),Ns=g.useCallback((z,le)=>{le.button!==0&&le.pointerType==="mouse"||(le.preventDefault(),u1(),Qn.current={kind:"past",entry:z,startX:le.clientX,startY:le.clientY,committed:!1})},[]);g.useEffect(()=>{const z=ge=>{const we=Qn.current;if(!we)return;const Ce=ge.clientX-we.startX,We=ge.clientY-we.startY;if(!we.committed){if(Ce*Ce+We*We<Kk*Kk)return;if(u1(),we.kind==="live"){const ke=Se.find(Mn=>Mn.workItemId===we.variantId);if(!ke||ke.status!=="succeeded"){Qn.current=null;return}const hn=Wk({sessionId:Oe,variant:ke,projectContext:lt,routePath:Pr});E({sessionId:Oe??"",variantId:ke.workItemId,label:ke.label||"Direction",url:hn,source:"live",runLabel:ke.runLabel,description:ke.description})}else{const{entry:ke}=we,hn=Xc(ke),Mn=hn?LW({sessionId:ke.sessionId,variantId:ke.variantId,routePath:Pr}):`/api/variants/history/${encodeURIComponent(ke.sessionId)}/${encodeURIComponent(ke.variantId)}/preview${zt}`;if(E({sessionId:ke.sessionId,variantId:ke.variantId,label:ke.label||"Direction",url:Mn,source:hn?"history-dev-server":"history-static",runLabel:ke.runLabel,description:ke.brief}),hn){const Vs=qk(`/api/variants/history/${encodeURIComponent(ke.sessionId)}/${encodeURIComponent(ke.variantId)}/run${zt}`,"targetAddressed","1");(async()=>{try{if(!(await fetch(Vs,{method:"POST"})).ok)return;const qr=qk(Mn,"replay",String(Date.now()));E(Sn=>!Sn||Sn.sessionId!==ke.sessionId||Sn.variantId!==ke.variantId||Sn.source!=="history-dev-server"?Sn:{...Sn,url:qr}),A(Sn=>{if(!Sn)return Sn;const Yr=Ar=>!Ar||Ar.sessionId!==ke.sessionId||Ar.variantId!==ke.variantId?Ar:{...Ar,url:qr};return{...Sn,left:Yr(Sn.left),right:Yr(Sn.right)}})}catch($s){vn.warn("history replay drag boot failed",$s)}})()}}we.committed=!0}C({x:ge.clientX,y:ge.clientY})},le=()=>{const ge=Qn.current;ge!=null&&ge.committed&&(wn.current=!0),Qn.current=null,C(null)},xe=ge=>{if(ge.key!=="Escape")return;const we=Qn.current;we!=null&&we.committed&&(we.kind==="past"&&Xc(we.entry)&&Zd({sessionId:we.entry.sessionId,variantId:we.entry.variantId,source:"history-dev-server"}),Qn.current=null,E(null),C(null))};return window.addEventListener("pointermove",z),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",le),window.addEventListener("keydown",xe),()=>{window.removeEventListener("pointermove",z),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",le),window.removeEventListener("keydown",xe)}},[Se,Oe,lt,Pr,zt,E,C,A]);const Rn=g.useMemo(()=>{var le;if(ae||j)return null;const z=M?Se.find(xe=>xe.workItemId===M):null;return M&&!z?null:z?$a(z)?z.workItemId:null:t.active?((le=Se.find(xe=>{var ge,we;return $a(xe)&&(((ge=xe.preview)==null?void 0:ge.kind)==="static_artifact"||((we=xe.preview)==null?void 0:we.kind)==="dev_server")}))==null?void 0:le.workItemId)??null:null},[M,j,ae,t,Se]),pi=g.useCallback(async z=>{var xe,ge,we,Ce;if(!Oe)return;const le=(z==null?void 0:z.workItemId)??null;K({kind:"switch",variantId:le??void 0});try{if(((xe=z==null?void 0:z.preview)==null?void 0:xe.kind)==="static_artifact"){if(y(!1),x(null),((ge=z.refinement)==null?void 0:ge.status)==="succeeded"){const ke=z.preview.url.includes("?")?"&":"?";v(`${z.preview.url}${ke}refinement=${encodeURIComponent(z.refinement.workItemId)}`)}else v(z.preview.url);p(ke=>ke+1);return}if(le&&Oe&&t.active&&t.projectContext.kind==="fresh"&&((we=t.projectContext.executionPlan)==null?void 0:we.mode)!=="vite_app"&&((Ce=z==null?void 0:z.preview)==null?void 0:Ce.kind)!=="dev_server"){y(!1),x(null),v(`/api/variants/${Oe}/static/${le}`),p(ke=>ke+1);return}const We=z&&le?Wk({sessionId:Oe,variant:z,projectContext:t.active?t.projectContext:null,routePath:Pr}):null;if(We){y(!1),x(null),v(We),p(ke=>ke+1);return}Te.capture("variants_panel.preview_display_failed",{sessionId:Oe,variantId:le,previewKind:z?Cp(z):"none",hasPreview:!!(z!=null&&z.preview),hasPort:typeof(z==null?void 0:z.port)=="number",errorMessage:"No addressable dev-server preview URL"}),y(!1),x(null)}catch(We){vn.warn("preview display failed",We),Te.capture("variants_panel.preview_display_failed",{sessionId:Oe,variantId:le,previewKind:z?Cp(z):"none",hasPreview:!!(z!=null&&z.preview),hasPort:typeof(z==null?void 0:z.port)=="number",errorMessage:We instanceof Error?We.message:String(We)}),y(!1),x(null)}finally{K(null)}},[Oe,t,Pr,p,v,y,x]),mi=g.useRef(!1),ps=g.useRef(null),Ds=g.useRef(0),ur=g.useCallback(()=>{if(Ds.current++,_(!1),b(!1),!mi.current)return;const z=ps.current;mi.current=!1,ps.current=null;const le=z?new URLSearchParams({sessionId:z.sessionId,variantId:z.variantId}):null,xe=le?`/api/variants/history/replay/stop?${le.toString()}`:"/api/variants/history/replay/stop";fetch(xe,{method:"POST"}).catch(ge=>vn.warn("history replay stop failed",ge))},[_,b]),In=g.useCallback(z=>{var Ce,We,ke,hn,Mn;if(wn.current){wn.current=!1;return}const le=$a(z),xe=z.status==="pending"||z.status==="running"||tA(z);if(!le&&!xe)return;ur();const ge=Cp(z),we=Se.find(Vs=>Vs.workItemId===M);Te.capture("variants_panel.preview_requested",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,variantStatus:z.status,isPreviewReady:le,isArmed:xe,previewKind:ge,hasPreview:!!z.preview,hasPort:typeof z.port=="number",viewEnabled:((We=(Ce=z.actions)==null?void 0:Ce.view)==null?void 0:We.enabled)??null,previewUnavailableReason:((ke=z.previewUnavailable)==null?void 0:ke.reason)??null}),R(z.workItemId),N(null),le?(Xn.current=z.workItemId,me(!1),O(),pi(z)):(me(!1),v(null),y(!1),Te.capture("variants_panel.preview_armed",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,variantStatus:z.status,previewKind:ge,hasPreview:!!z.preview,hasPort:typeof z.port=="number",viewEnabled:((Mn=(hn=z.actions)==null?void 0:hn.view)==null?void 0:Mn.enabled)??null})),Te.capture("variants_panel.preview_switched",{sessionId:Oe,fromVariantId:we==null?void 0:we.workItemId,toVariantId:z.workItemId,armed:xe})},[M,Oe,O,R,N,ur,pi,Se,v,y]),oa=t.active?`${t.sessionId}:${t.stage}`:"inactive";g.useEffect(()=>{if(r)return;let z=!1;return(async()=>{try{const le=await fetch(`/api/variants/history${zt}`,{credentials:"same-origin"});if(!le.ok)return;const xe=await le.json();if(z)return;const ge=(xe.variants??[]).filter(we=>{var Ce,We;return((Ce=we.preview)==null?void 0:Ce.kind)==="static"||((We=we.serve)==null?void 0:We.kind)==="static"||Xc(we)});if($W(ie.current,ge))return;ie.current=ge,de(ge)}catch(le){vn.warn("Failed to load past variants",le)}})(),()=>{z=!0}},[r,oa,zt]);const Zr=g.useCallback(()=>{mi.current=!1,ps.current=null,_(!1),b(!1),N(null),R(null),me(!0),y(!1),x(null),v(null),p(z=>z+1)},[R,_,b,p,v,x,N,y]),Tr=g.useCallback(z=>{if(wn.current){wn.current=!1;return}if(O(),N({sessionId:z.sessionId,variantId:z.variantId,previewKind:Xc(z)?"dev_server":"static"}),R(null),me(!1),Xc(z)){const le=++Ds.current;mi.current=!0,ps.current={sessionId:z.sessionId,variantId:z.variantId},_(!0),b(!0),(async()=>{K({kind:"switch"}),Te.capture("variants_panel.history_replay_started",{sessionId:z.sessionId,variantId:z.variantId});const xe=ge=>Te.capture("variants_panel.history_replay_failed",{sessionId:z.sessionId,variantId:z.variantId,...ge});try{const ge=await fetch(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/run${zt}`,{method:"POST"});if(le!==Ds.current)return;if(!ge.ok){const{errorCode:we}=await Eo(ge);vn.warn(`history replay failed: HTTP ${ge.status} ${we??""}`),xe({httpStatus:ge.status,errorCode:we}),Zr();return}b(!1),y(!0),x(null),v(null),p(we=>we+1),Te.capture("variants_panel.history_replay_ready",{sessionId:z.sessionId,variantId:z.variantId})}catch(ge){if(le!==Ds.current)return;vn.warn("history replay failed",ge),xe({errorMessage:ge instanceof Error?ge.message:String(ge)}),Zr()}finally{K(null)}})();return}ur(),y(!1),x(null),v(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/preview${zt}`)},[Zr,K,_,b,p,N,R,v,x,O,y,ur,zt]),gi=g.useCallback(async()=>{ur();const z=()=>{O(),R(null),N(null),me(!0),Xn.current=null,y(!1),x(null),v(null),p(le=>le+1)};if(!Oe){z();return}K({kind:"switch"});try{const le=await fetch(`/api/variants/${Oe}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})});if(!le.ok){vn.warn(`switch to original failed: HTTP ${le.status}`);return}z(),y(!0),Te.capture("variants_panel.preview_switched",{sessionId:Oe,fromVariantId:M,toVariantId:null,target:"original",armed:!1})}catch(le){vn.warn("preview-port original switch failed",le)}finally{K(null)}},[M,Oe,R,N,p,v,x,O,y,ur]),Ze=g.useCallback(async z=>{var xe,ge;const le=((ge=(xe=z.actions)==null?void 0:xe.commit)==null?void 0:ge.enabled)??z.status==="succeeded";if(!(!Oe||!le)){Te.capture("variants_panel.commit_clicked",{sessionId:Oe,variantId:z.workItemId,variantLabel:z.label}),K({kind:"commit",variantId:z.workItemId});try{const we=await fetch(`/api/variants/${Oe}/commit`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:z.workItemId})});if(!we.ok){const{message:We,errorCode:ke}=await Eo(we);vn.warn(`commit failed: HTTP ${we.status} ${ke??""} ${We??""}`),Te.capture("variants_panel.commit_failed",{sessionId:Oe,variantId:z.workItemId,httpStatus:we.status,errorCode:ke??null,errorMessage:We??null}),ht.error("Couldn't send direction",{description:We??`The server rejected the request (HTTP ${we.status}). Try again, or pick a different direction.`});return}const Ce=await we.json().catch(()=>null);Te.capture("variants_panel.commit_succeeded",{sessionId:Oe,variantId:z.workItemId,payloadKind:(Ce==null?void 0:Ce.payloadKind)??null,duplicate:(Ce==null?void 0:Ce.duplicate)??!1}),ht.success(`Sent "${z.label}" to your project`,{description:(Ce==null?void 0:Ce.payloadKind)==="project-created"?`Project created at ${(Ce==null?void 0:Ce.destinationPath)??"destination"}.`:"Direction diff applied to your working tree (uncommitted)."}),(Ce==null?void 0:Ce.payloadKind)!=="project-created"&&(v(null),y(!1),p(We=>We+1))}catch(we){vn.warn("commit failed",we),Te.capture("variants_panel.commit_failed",{sessionId:Oe,variantId:z.workItemId,httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:we instanceof Error?we.message:String(we)}),ht.error("Couldn't send direction",{description:"Network or server error. Check that the Rivet backend is reachable and try again."})}finally{K(null)}}},[Oe,p,v,y]),Pt=g.useCallback(async(z,le,xe)=>{Te.capture("variants_panel.deploy_clicked",{sessionId:z,variantId:le,variantLabel:xe});try{const ge=await fetch(`/api/variants/${z}/deploy`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:le,...n?{projectPath:n}:{}})});if(!ge.ok){const{message:We,errorCode:ke}=await Eo(ge);return vn.warn(`deploy failed: HTTP ${ge.status} ${ke??""} ${We??""}`),Te.capture("variants_panel.deploy_failed",{sessionId:z,variantId:le,httpStatus:ge.status,errorCode:ke??null,errorMessage:We??null}),ht.error("Couldn't deploy this direction",{description:We??`The server rejected the request (HTTP ${ge.status}). Try again.`}),null}const we=await ge.json().catch(()=>null),Ce=we==null?void 0:we.shareUrl;return Ce?(await navigator.clipboard.writeText(Ce).catch(()=>{}),Te.capture("variants_panel.deploy_succeeded",{sessionId:z,variantId:le}),ht.success(`"${xe}" is live — link copied`,{action:{label:"Open",onClick:()=>window.open(Ce,"_blank","noopener")}}),Ce):(ht.error("Couldn't deploy this direction",{description:"The deploy host returned an unexpected response."}),null)}catch(ge){return vn.warn("deploy failed",ge),Te.capture("variants_panel.deploy_failed",{sessionId:z,variantId:le,httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:ge instanceof Error?ge.message:String(ge)}),ht.error("Couldn't deploy this direction",{description:"Network or server error. Check that the Rivet backend is reachable and try again."}),null}},[n]),nn=g.useCallback(async z=>{if(!Oe)return;const le=$[z.workItemId];if(le){await navigator.clipboard.writeText(le).catch(()=>{}),ht.success("Share link copied",{action:{label:"Open",onClick:()=>window.open(le,"_blank","noopener")}});return}K({kind:"deploy",variantId:z.workItemId});try{const xe=await Pt(Oe,z.workItemId,z.label);xe&&ee(ge=>({...ge,[z.workItemId]:xe}))}finally{K(null)}},[Oe,$,Pt]),bn=g.useCallback(async()=>{if(!(!Oe||Re.length===0)){if(it){await navigator.clipboard.writeText(it).catch(()=>{}),ht.success("Canvas link copied",{action:{label:"Open",onClick:()=>window.open(it,"_blank","noopener")}});return}Te.capture("variants_panel.deploy_clicked",{sessionId:Oe,variantId:"canvas",variantLabel:"Canvas",variantCount:Re.length}),K({kind:"deploy-canvas"});try{const z=await fetch(`/api/variants/${Oe}/canvas/deploy`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantIds:Re.map(Ce=>Ce.workItemId),...n?{projectPath:n}:{}})});if(!z.ok){const{message:Ce,errorCode:We}=await Eo(z);vn.warn(`canvas deploy failed: HTTP ${z.status} ${We??""} ${Ce??""}`),Te.capture("variants_panel.deploy_failed",{sessionId:Oe,variantId:"canvas",httpStatus:z.status,errorCode:We??null,errorMessage:Ce??null,variantCount:Re.length}),ht.error("Couldn't share this canvas",{description:Ce??`The server rejected the request (HTTP ${z.status}). Try again.`});return}const le=await z.json().catch(()=>null),xe=le==null?void 0:le.shareUrl;if(!xe){ht.error("Couldn't share this canvas",{description:"The deploy host returned an unexpected response."});return}const ge=Object.fromEntries(((le==null?void 0:le.variants)??[]).filter(Ce=>typeof Ce.variantId=="string"&&typeof Ce.shareUrl=="string").map(Ce=>[Ce.variantId,Ce.shareUrl])),we=Object.keys(ge).length>0?{...$,...ge}:$;we!==$&&ee(we),await navigator.clipboard.writeText(xe).catch(()=>{}),D({key:Yk(Re,we),shareUrl:xe}),Te.capture("variants_panel.deploy_succeeded",{sessionId:Oe,variantId:"canvas",variantCount:Re.length}),ht.success("Canvas is live — link copied",{action:{label:"Open",onClick:()=>window.open(xe,"_blank","noopener")}})}catch(z){vn.warn("canvas deploy failed",z),Te.capture("variants_panel.deploy_failed",{sessionId:Oe,variantId:"canvas",httpStatus:null,errorCode:"NETWORK_ERROR",errorMessage:z instanceof Error?z.message:String(z),variantCount:Re.length}),ht.error("Couldn't share this canvas",{description:"Network or server error. Check that the Rivet backend is reachable and try again."})}finally{K(null)}}},[it,Re,$,n,Oe]),js=g.useCallback(async z=>{const le=`${z.sessionId}:${z.variantId}`,xe=q[le];if(xe){await navigator.clipboard.writeText(xe).catch(()=>{}),ht.success("Share link copied",{action:{label:"Open",onClick:()=>window.open(xe,"_blank","noopener")}});return}oe(le);try{const ge=await Pt(z.sessionId,z.variantId,z.label);ge&&re(we=>({...we,[le]:ge}))}finally{oe(null)}},[q,Pt]),Ut=g.useCallback(async z=>{if(Oe){Te.capture("variants_panel.remove_clicked",{sessionId:Oe,variantId:z.workItemId,variantLabelLength:z.label.length}),K({kind:"remove",variantId:z.workItemId});try{const le=await fetch(`/api/variants/${Oe}/${z.workItemId}/remove`,{method:"POST",headers:{"content-type":"application/json"},body:"{}"});if(!le.ok){const{message:xe}=await Eo(le);vn.warn(`remove failed: HTTP ${le.status} ${xe??""}`),ht.error("Couldn't remove direction",{description:xe??`The server rejected the request (HTTP ${le.status}). Try again.`});return}(z.workItemId===Rn||z.workItemId===M)&&(R(null),v(null),y(!1),p(xe=>xe+1))}catch(le){vn.warn("remove failed",le),ht.error("Couldn't remove direction",{description:"Network or server error. Try again."})}finally{K(null)}}},[Oe,M,Rn,R,v,y,p]),rn=g.useCallback(async z=>{if(!Je){ht.error("Couldn't remove direction",{description:"No project path available."});return}Te.capture("variants_panel.remove_past_clicked",{sessionId:z.sessionId,variantId:z.variantId});const le=`${z.sessionId}:${z.variantId}`,xe=ge=>ge.sessionId===z.sessionId&&ge.variantId===z.variantId;K({kind:"remove",variantId:le}),de(ge=>ge.filter(we=>!xe(we))),j===le&&(N(null),v(null),y(!1),p(ge=>ge+1));try{const ge=await fetch(`/api/variants/history/${encodeURIComponent(z.sessionId)}/${encodeURIComponent(z.variantId)}/remove`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({projectPath:Je})});if(!ge.ok){const{message:we}=await Eo(ge);de(Ce=>Ce.some(xe)?Ce:[...Ce,z]),ht.error("Couldn't remove direction",{description:we??`The server rejected the request (HTTP ${ge.status}). Try again.`})}}catch(ge){vn.warn("remove past failed",ge),de(we=>we.some(xe)?we:[...we,z]),ht.error("Couldn't remove direction",{description:"Network or server error. Try again."})}finally{K(null)}},[Je,j,N,v,y,p]),ms=g.useCallback(z=>{X(z)},[]),fn=g.useCallback(async()=>{if(B)try{B.kind==="active"?await Ut(B.variant):await rn(B.entry)}finally{X(null)}},[B,Ut,rn]),Jn=DW(B),Fs=(Y==null?void 0:Y.kind)==="remove"&&Y.variantId===Jn,[er,aa]=g.useState(null),[Qu,Ju]=g.useState(null),E0=g.useCallback(z=>{Ju(z)},[]),k0=g.useCallback(()=>{Ju(null)},[]),vi=g.useCallback(async z=>{const le=z.trim();if(le)try{await navigator.clipboard.writeText(le),ht.success("Copied")}catch{ht.error("Couldn't copy")}},[]),wf=g.useCallback(async(z,le)=>{Ju(null);const xe=le.trim();if(!xe||z.kind==="original")return;if(z.kind==="active"){if(!Oe||xe===z.variant.label)return;Te.capture("variants_panel.rename",{sessionId:Oe,variantId:z.variant.workItemId,labelLength:xe.length,past:!1});try{const Ce=await fetch(`/api/variants/${Oe}/${z.variant.workItemId}/rename`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:xe})});if(!Ce.ok){const{message:We}=await Eo(Ce);ht.error("Couldn't rename direction",{description:We??`The server rejected the request (HTTP ${Ce.status}). Try again.`})}}catch(Ce){vn.warn("rename failed",Ce),ht.error("Couldn't rename direction",{description:"Network or server error. Try again."})}return}const{entry:ge}=z;if(xe===ge.label.trim())return;if(!Je){ht.error("Couldn't rename direction",{description:"No project path available."});return}Te.capture("variants_panel.rename",{sessionId:ge.sessionId,variantId:ge.variantId,labelLength:xe.length,past:!0});const we=Ce=>Ce.sessionId===ge.sessionId&&Ce.variantId===ge.variantId;de(Ce=>Ce.map(We=>we(We)?{...We,label:xe}:We));try{const Ce=await fetch(`/api/variants/history/${encodeURIComponent(ge.sessionId)}/${encodeURIComponent(ge.variantId)}/rename`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({label:xe,projectPath:Je})});if(!Ce.ok){const{message:We}=await Eo(Ce);de(ke=>ke.map(hn=>we(hn)?{...hn,label:ge.label}:hn)),ht.error("Couldn't rename direction",{description:We??`The server rejected the request (HTTP ${Ce.status}). Try again.`})}}catch(Ce){vn.warn("rename failed",Ce),de(We=>We.map(ke=>we(ke)?{...ke,label:ge.label}:ke)),ht.error("Couldn't rename direction",{description:"Network or server error. Try again."})}},[Oe,Je]);g.useEffect(()=>{if(An.current!==Oe){const le=An.current===null;if(An.current=Oe,Xn.current=null,D(null),v(null),y(!1),x(null),O(),R(null),N(null),me(!1),!le)return}if(j||ae||!Rn||t.active!==!0||Xn.current===Rn)return;const z=Se.find(le=>le.workItemId===Rn);z&&(Xn.current=Rn,O(),pi(z))},[Oe,j,ae,Rn,t,Se,pi,O,R,N,v,x,y]),g.useEffect(()=>{!L||!je||(Xn.current=null,N(null),R(je.workItemId),me(!1))},[je,L,Oe,R,N]),g.useEffect(()=>{!L||je||Qe||N(null)},[je,L,Qe,Oe,N,mt]),g.useEffect(()=>{const z=V.trim().toLowerCase(),le=Se.filter(ke=>$a(ke)&&cu(z,ke.label,ke.runLabel)),xe=mt.filter(ke=>cu(z,ke.label,ke.runLabel,ke.brief)),ge=xn&&cu(z,hx,px);if(le.length===0&&xe.length===0&&!ge)return;const we=[...le.map(ke=>({source:"live",variant:ke})),...xe.map(ke=>({source:"past",entry:ke})),...ge?[{source:"original"}]:[]],Ce=ke=>ke.source==="live"?`live:${ke.variant.workItemId}`:ke.source==="past"?`past:${ke.entry.sessionId}:${ke.entry.variantId}`:__,We=ke=>{if(OU())return;if(ke.key==="Enter"){const Yr=Se.find(Ar=>Ar.workItemId===er);Yr&&$a(Yr)&&(ke.preventDefault(),In(Yr));return}if(ke.key!=="ArrowUp"&&ke.key!=="ArrowDown")return;ke.preventDefault();let Mn=Rn?`live:${Rn}`:null;j?Mn=`past:${j}`:ae&&(Mn=__);const Vs=Mn?we.findIndex(Yr=>Ce(Yr)===Mn):-1;let $s;if(Vs===-1?$s=ke.key==="ArrowDown"?0:we.length-1:ke.key==="ArrowDown"?$s=Math.min(Vs+1,we.length-1):$s=Math.max(Vs-1,0),$s===Vs)return;const qr=we[$s];qr.source==="live"?In(qr.variant):qr.source==="past"?Tr(qr.entry):gi();const Sn=document.querySelector(`[data-variant-key="${Ce(qr)}"]`);Sn instanceof HTMLElement&&Sn.focus({preventScroll:!0})};return window.addEventListener("keydown",We),()=>window.removeEventListener("keydown",We)},[Se,mt,V,xn,j,ae,Rn,er,In,Tr,gi]);const ml=Se.find(z=>z.workItemId===Rn)??null,ec=j?mt.find(z=>`${z.sessionId}:${z.variantId}`===j)??null:null,tc=!!ec,bf=t.active?t.artifacts??[]:[],nc=t.active?Se.filter(z=>z.status!=="cancelled"):[],eo=[...nc.map(z=>({kind:"active",variant:z})),...mt.map(z=>({kind:"past",entry:z})),...xn?[{kind:"original"}]:[]],Sf=V.trim().toLowerCase(),rc=Sf?eo.filter(z=>WW(z,Sf)):eo,Bt=new Set(Se.map(z=>z.requestId).filter(Boolean)),Ef=e.filter(z=>!Bt.has(z.requestId)),to=Ef.length>0,gl=r&&!to&&eo.length===0;return S.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[eo.length>0?S.jsx("div",{className:"px-3 pt-2 pb-1",children:S.jsxs("div",{className:"relative",children:[S.jsx(fz,{size:13,className:"text-content-muted pointer-events-none absolute top-1/2 left-2 -translate-y-1/2"}),S.jsx("input",{type:"text",value:V,onChange:z=>G(z.target.value),placeholder:"Search directions…","aria-label":"Search directions",className:"border-main-border bg-main-input/40 text-content placeholder:text-content-muted focus:ring-content-muted/40 w-full rounded-md border py-1.5 pr-2 pl-7 text-xs focus:ring-1 focus:outline-none"})]})}):null,S.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-2",children:[to?S.jsx(rG,{groups:Ef}):null,gl?S.jsx(sG,{}):null,t.active&&nc.length===0&&!to&&!gl?S.jsx(iG,{}):null,!t.active&&!to&&!gl&&mt.length===0&&!xn?S.jsx(oG,{isMCPSession:f,mcpEditor:h}):null,eo.length>0&&rc.length===0?S.jsxs("p",{className:"text-content-muted px-1 py-6 text-center text-xs",children:["No directions match “",V.trim(),"”."]}):null,rc.length>0?S.jsx(KW,{rows:rc,activeVariantId:M??Rn,activePastKey:j,isOriginalSelected:ae,busy:Y,editingKey:Qu,onSelectActive:In,onSelectPast:Tr,onSelectOriginal:gi,onActivePointerDown:Os,onPastPointerDown:Ns,onHover:aa,onRemove:z=>ms({kind:"active",variant:z}),onRemovePast:z=>ms({kind:"past",entry:z}),onStartRename:E0,onCommitRename:wf,onCancelRename:k0,onCopyDescription:vi}):null,t.active&&c?S.jsx(JW,{artifacts:bf}):null]}),tc&&ec?S.jsx(YW,{entry:ec,deploying:se===j,deployedUrl:j?q[j]??null:null,onDeploy:js,isDeployDisabled:!i}):null,!tc&&t.active?S.jsx(nG,{selectedVariant:ml,busy:Y,onSend:Ze,onDeploy:nn,onDeployCanvas:bn,canDeploy:i&&(lt==null?void 0:lt.kind)==="fresh",canDeployCanvas:i&&a&&(lt==null?void 0:lt.kind)==="fresh",canSendToAgent:u,canvasVariantCount:Re.length,canvasDeployedUrl:it,deployedUrl:ml?$[ml.workItemId]??null:null}):null,S.jsx(UW,{target:B,isConfirming:Fs,onCancel:()=>X(null),onConfirm:fn})]})},zW=t=>t.kind==="active"?t.variant.label.trim()||"this direction":t.entry.label.trim()||"this direction",UW=({target:t,isConfirming:e,onCancel:n,onConfirm:r})=>{if(!t)return null;const s=zW(t);return S.jsx(e0,{open:!0,onOpenChange:i=>{!i&&!e&&n()},children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{className:"fixed left-1/2 top-1/2 z-max w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Remove direction?"}),S.jsxs(i0,{className:"text-sm leading-5 text-content-subtle",children:['This removes "',s,'" from the directions list.']}),S.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[S.jsx("button",{type:"button",onClick:n,disabled:e,className:"rounded-md px-3 py-1.5 text-sm font-medium text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),S.jsx("button",{type:"button","aria-label":"Confirm remove direction",onClick:r,disabled:e,className:"rounded-md bg-red-500/15 px-3 py-1.5 text-sm font-medium text-red-200 transition-colors hover:bg-red-500/25 disabled:cursor-not-allowed disabled:opacity-50",children:e?"Removing...":"Remove direction"})]})]})})]})})},BW=t=>t.kind==="active"?`live:${t.variant.workItemId}`:t.kind==="past"?`past:${t.entry.sessionId}:${t.entry.variantId}`:__,WW=(t,e)=>t.kind==="active"?cu(e,t.variant.label,t.variant.runLabel):t.kind==="past"?cu(e,t.entry.label,t.entry.runLabel,t.entry.brief):cu(e,hx,px),GW=t=>t.length<=Zk?t:`${t.slice(0,Zk-1)}…`,KW=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy:s,editingKey:i,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:f,onPastPointerDown:h,onHover:p,onRemove:v,onRemovePast:y,onStartRename:x,onCommitRename:_,onCancelRename:b,onCopyDescription:E})=>{const C=g.useRef(null),{activeIndex:P,itemRects:T,sessionRef:A,handlers:O,registerItem:M}=jT(C),R=(s==null?void 0:s.kind)==="switch",L=P!==null?T[P]:null;return S.jsxs("div",{ref:C,className:"relative",onMouseEnter:O.onMouseEnter,onMouseMove:O.onMouseMove,onMouseLeave:O.onMouseLeave,children:[S.jsx(Gi,{children:L&&S.jsx(sl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:L.top,left:L.left,width:L.width,height:L.height},animate:{opacity:1,top:L.top,left:L.left,width:L.width,height:L.height},exit:{opacity:0,transition:{duration:.06}},transition:{...Hd.fast,opacity:{duration:.08}}},A.current)}),S.jsx("ul",{className:"relative",children:t.map((N,j)=>{const V=BW(N);let G=!1;return N.kind==="active"?G=N.variant.workItemId===e:N.kind==="past"?G=`${N.entry.sessionId}:${N.entry.variantId}`===n:G=r,S.jsx(ZW,{rowKey:V,row:N,index:j,isSelected:G,isEditing:i===V,isSwitchInFlight:R,busy:s,registerItem:M,onSelectActive:a,onSelectPast:u,onSelectOriginal:c,onActivePointerDown:f,onPastPointerDown:h,onHover:p,onRemove:v,onRemovePast:y,onStartRename:x,onCommitRename:_,onCancelRename:b,onCopyDescription:E},V)})})]})},ZW=({rowKey:t,row:e,index:n,isSelected:r,isEditing:s,isSwitchInFlight:i,busy:a,registerItem:u,onSelectActive:c,onSelectPast:f,onSelectOriginal:h,onActivePointerDown:p,onPastPointerDown:v,onHover:y,onRemove:x,onRemovePast:_,onStartRename:b,onCommitRename:E,onCancelRename:C,onCopyDescription:P})=>{var oe,ue;const T=g.useRef(null);uU(u,n,T);const A=e.kind==="active",O=e.kind==="original",M=e.kind==="active"?e.variant:null,R=e.kind==="past"?e.entry:null,L=A?M.status==="succeeded":!0,N=A?$a(M):!0,j=A?tA(M):!1,V=A&&(M.status==="pending"||M.status==="running"),G=A?L&&(N||j)||V:!0,Y=A&&M.status==="failed",K=A&&M.status==="cancelled",B=A&&(!G||i),X=A&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,$=A&&(((oe=M.refinement)==null?void 0:oe.status)==="pending"||((ue=M.refinement)==null?void 0:ue.status)==="running");let ee=hx;A?ee=M.label||`Direction ${n+1}`:R&&(ee=R.label.trim()||"Untitled direction");let H;A?H=M.runLabel:R&&(H=R.runLabel);let D=px;A?D=M.description:R&&(D=R.brief);const q=D?GW(D):null,re=A?M.changedFilesCount:void 0,se=A&&M.status==="succeeded"&&Cp(M)==="none"&&typeof re=="number"&&re>0?`${re} file${re===1?"":"s"} changed`:null;return s?S.jsx("li",{ref:T,"data-proximity-index":n,className:"group relative z-10",children:S.jsx("div",{className:"bg-main-input flex w-full items-start gap-2 rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsx(qW,{initial:ee,onCommit:de=>E(e,de),onCancel:C}),q&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:q})]})})}):S.jsxs("li",{ref:T,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:G?0:-1,"data-variant-id":A?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if(B)return;const de=window.getSelection();de&&!de.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onKeyDown:de=>{B||(de.key==="Enter"||de.key===" ")&&(de.preventDefault(),de.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onPointerDown:de=>{B||(e.kind==="active"?L&&p(e.variant.workItemId,de):e.kind==="past"&&v(e.entry,de))},"aria-pressed":G?r:void 0,"aria-disabled":A?!G:void 0,"aria-busy":V||$,onMouseEnter:A?()=>y(M.workItemId):void 0,onMouseLeave:A?()=>y(null):void 0,className:lr("focus-visible:ring-content-muted/40 flex w-full items-start gap-2 rounded-md px-3 py-2 text-left transition-colors focus:outline-none focus-visible:ring-1",r&&"bg-main-input ring-content-muted/40 ring-1 ring-inset",L&&N&&"cursor-grab active:cursor-grabbing",(V||j)&&"cursor-pointer",!L&&!V&&!j&&"cursor-not-allowed opacity-60",B&&"cursor-not-allowed opacity-50"),style:L?{touchAction:"none"}:void 0,children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[(V||$)&&S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm","data-testid":$&&!V?"variant-refining":void 0}),S.jsx(Fo,{label:"Double-click to rename",disabled:O,children:S.jsx("span",{onDoubleClick:de=>{de.stopPropagation(),O||b(t)},className:lr("min-w-0 flex-1 truncate text-sm font-medium select-text",O?"cursor-default":"cursor-text",L||r?"text-content":"text-content-muted"),children:ee})}),Y&&S.jsx(Xk,{label:"Failed"}),K&&S.jsx(Xk,{label:"Cancelled"}),H&&S.jsx("span",{className:"ml-auto max-w-[8rem] shrink-0 truncate rounded px-1.5 py-0.5 text-[10px] font-medium opacity-100 transition-opacity duration-150 group-hover:opacity-0 group-has-[:focus-visible]:opacity-0",style:DT(H),children:H})]}),q&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:q}),se&&S.jsx("span",{"data-testid":"variant-diff-summary",className:"text-content-muted mt-0.5 block text-[11px] leading-snug",children:se})]})}),S.jsxs("div",{className:lr("absolute top-1.5 right-2 flex items-center gap-0.5 transition-opacity duration-150","pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:opacity-100"),children:[D&&S.jsx(Fo,{label:"Copy description",children:S.jsx("button",{type:"button","aria-label":"Copy description",onClick:de=>{de.stopPropagation();const ie=ee.trim();P(ie?`${ie}
111
- ${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx($d,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:de=>{de.stopPropagation(),b(t)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(hz,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:X,onClick:de=>{de.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(gz,{size:13,weight:"bold"})})})]})]})},qW=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=g.useState(t),i=g.useRef(!1),a=g.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},Xk=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),YW=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx($d,{size:12,weight:"bold"}):null,a]})]})},XW={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},QW={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},JW=({artifacts:t})=>{const[e,n]=g.useState(null),r=g.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(eG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},eG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=QW[t.kind],s=t.source?XW[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(lz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(tG,{artifact:t})}):null]})},tG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),nG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var M,R,L,N;const p=t?((R=(M=t.actions)==null?void 0:M.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,v=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),x=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",b=!i||!p||e!==null,E=a&&c>0,P=x?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":f?"Copy canvas link":"Share canvas",O=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(V5,{primaryLabel:P,primaryIcon:h&&!x?$d:void 0,primaryAction:()=>{t&&r(t)},isDisabled:b,isDropdownDisabled:e!==null,isLoading:x,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:f&&!_?$d:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(N=(L=t==null?void 0:t.actions)==null?void 0:L.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:O}):null]})]})},nA=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),rG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(nA,{},`${e.requestId}-${r}`)))}),sG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(nA,{},e))}),iG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),Qk="Try different ways to create a dropdown that feels fluid and dynamic",oG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=NU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(Qk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",Qk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(lT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx($d,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},aG=({onClose:t})=>{const e=Xe(BT);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Fo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(pz,{className:"h-4 w-4",weight:"bold"})})})]}):null},lG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',uG=({itemSelector:t=lG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=LU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=g.useCallback(a=>{var x;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const f=Array.from(c.querySelectorAll(t));if(f.length===0)return;a.preventDefault(),a.stopPropagation();const h=f.indexOf(document.activeElement),p=f.length-1,v=_=>{if(h===-1)return _===1?0:p;const b=h+_;return e?(b+f.length)%f.length:Math.min(Math.max(b,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=v(1):y=v(-1),(x=f[y])==null||x.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},Jk="/assets/arena-Db0j1set.png",cG=hs("useIntegrations"),eC=["integrations"],dG="rivet:connect-result",fG=t=>typeof t=="object"&&t!==null&&t.type===dG,hG=et(null),pG=()=>{const t=h8(),[e,n]=Q6(hG),r=H1({queryKey:eC,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=g.useCallback(()=>t.invalidateQueries({queryKey:eC}),[t]),i=g.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const f=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await f.json().catch(()=>({}));if(!f.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const v=()=>{window.removeEventListener("message",y),clearInterval(x),s(),p()},y=_=>{fG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&cG.warn(`Connect failed for ${u}:`,_.data.message),v())};window.addEventListener("message",y);const x=setInterval(()=>{c.closed&&v()},500)})}finally{n(null)}},[s,n]),a=g.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const f=await c.json().catch(()=>({}));throw new Error(f.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},du=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(fx,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},tC=hs("ConnectorsModal"),mG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),gG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${Jk})`,maskImage:`url(${Jk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),vG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(mG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(gG,{})}],yG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(lT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},x_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:f}=pG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const C=E instanceof Error?E.message:"Could not connect.";tC.warn(`Connect error for ${b}:`,C),ht.error(C)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const C=E instanceof Error?E.message:"Could not disconnect.";tC.warn(`Disconnect error for ${b}:`,C),ht.error(C)})},[f]),_=n==="onboarding";return S.jsx(e0,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(du,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:vG.map(b=>S.jsx(yG,{meta:b,integration:v(b.provider),isPending:i||u===b.provider,isHighlighted:r===b.provider,onConnect:()=>y(b.provider),onDisconnect:()=>x(b.provider)},b.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},nC=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),_G=hs("SupportTicketModal"),rC=5e3,c1="feedback",xG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},wG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=xG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},bG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=QN(),[s,i]=g.useState(""),[a,u]=g.useState(!1),[c,f]=g.useState(null),h=g.useCallback(()=>{i("")},[]),p=g.useCallback(()=>{a||(h(),e())},[a,e,h]),v=g.useCallback(async()=>{const b=s.trim();if(!(!b||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,C=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:c1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:C??void 0,appVersion:"0.13.1",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await wG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:c1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const C=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:c1,error:C}),_G.error("Failed to submit support ticket:",C),ht.error("Could not send feedback",{description:C})}finally{u(!1)}}},[n,a,s,e,r,h]),y=g.useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),v())},[v]),x=rC-s.length,_=a||s.trim().length===0;return S.jsx(e0,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:f,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(du,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:b=>i(b.target.value),onKeyDown:y,maxLength:rC,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[x<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:x}),S.jsx(du,{onClick:v,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(o0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(uz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},SG=hs("ProfileAvatar"),rA=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},EG=(t,e)=>rA(t,e).charAt(0).toUpperCase(),kG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Xe(GT),i=Xe(QT),a=Xe(XT),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=uG(),E=Xe(mf),C=EG(r,s);if(!C)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(nC,{className:"h-7 w-7 rounded-full"}),S.jsx(nC,{className:"h-3 w-16"})]}):null;const P=rA(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const M=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!M.ok)throw new Error(`Logout failed: ${M.status}`)}catch(M){SG.warn("Logout request failed",M),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(N5,{open:u,onOpenChange:c,children:[S.jsx(D5,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:C}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(j5,{children:S.jsxs(F5,{ref:_,onKeyDown:b,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(vT,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),v(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:O,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(mz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(bG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},CG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(aG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(HW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(kG,{side:"top",align:"start"})})]}),PG=hs("useServerConfig"),TG=()=>{const[t,e]=g.useState(null),[n,r]=g.useState(!0),[s,i]=g.useState(null),a=g.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const f=await c.json();if(!f.framework)throw new Error("Server did not return framework information");const h={userPort:((u=f.ports)==null?void 0:u.userDevServer)||3e3,framework:f.framework};return e(h),h}catch(c){const f=c instanceof Error?c.message:"Failed to fetch server config";throw i(f),PG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},AG="#1C1C20",Ri=[118,118,124],sC=.85,RG=3,IG=.15,tp=36,MG=4.4,LG=.7,OG=3.5,NG=.8,iC=9,DG=11,jG=[1.35,1.12,.95,.85],FG=[0,1.1,2.3,3.1],VG=[0,.35,.16,.13],$G=[.9,.5,.4,.35],Ra=3,d1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],np=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Pp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Ia=(t,e)=>(Math.round(t/e-.5)+.5)*e,HG=Math.sin(Math.PI/3),oC=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*HG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},zG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-iC}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-iC}return Pp(.5-r/(2*DG))},sA=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(WT),r=g.useRef(null),s=g.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=tp,v=tp,y=null,x=null,_=0,b=-1;const E=new Array(33),C=j=>{const V=Math.round(j*32);let G=E[V];if(!G){const Y=V/32,K=Math.round(Ri[0]+(255-Ri[0])*Y),B=Math.round(Ri[1]+(255-Ri[1])*Y),X=Math.round(Ri[2]+(255-Ri[2])*Y);G=`rgba(${K}, ${B}, ${X}, ${sC})`,E[V]=G}return G},P=j=>{const V=1-.35*j,G=Math.round(Ri[0]*V),Y=Math.round(Ri[1]*V),K=Math.round(Ri[2]*V);return`rgba(${G}, ${Y}, ${K}, ${sC})`},T=j=>{let V=Math.floor(Math.random()*d1.length);V===b&&(V=(V+1)%d1.length),b=V;const G=[0,0,0,0],Y=d1[V].map((D,q)=>{const re=D.level,se=G[re]++,oe=FG[re]+se*VG[re],ue=$G[re]+np(V*131+q*17+5)*.2;if(D.hline){const ae=Ia((D.y??0)*h,v);return{hline:!0,x1:Ia(D.x1*f,p),x2:Ia(D.x2*f,p),y1:ae,y2:ae,level:re,start:oe,dur:ue}}const de=Ia(D.x1*f,p),ie=Ia((D.y1??0)*h,v);return{hline:!1,x1:de,y1:ie,x2:Math.max(Ia(D.x2*f,p),de+p),y2:Math.max(Ia((D.y2??0)*h,v),ie+v),level:re,start:oe,dur:ue}}),K=Y.reduce((D,q)=>Math.max(D,q.start+q.dur),0),B=c.length,X=new Float32Array(B*Ra),$=new Int16Array(B*Ra).fill(-1),ee=new Uint8Array(B),H=Y[0];for(let D=0;D<B;D++){const q=c[D];q.x>H.x1&&q.x<H.x2&&q.y>H.y1&&q.y<H.y2&&(ee[D]=1);const re=D*Ra;for(let se=0;se<Y.length;se++){const oe=zG(q.x,q.y,Y[se]);if(oe<=.02)continue;let ue=re;for(let de=re;de<re+Ra;de++){if($[de]===-1){ue=de;break}X[de]<X[ue]&&(ue=de)}($[ue]===-1||oe>X[ue])&&(X[ue]=oe,$[ue]=se)}}return{startT:j,buildEnd:K,els:Y,frame:H,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();f=Math.max(1,j.width),h=Math.max(1,j.height);const V=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(f*V),i.height=Math.round(h*V),a.setTransform(V,0,0,V,0,0);const G=Math.max(8,Math.round(f/tp)),Y=Math.max(6,Math.round(h/tp));p=f/G,v=h/Y,c=[];for(let K=0;K<Y;K++){const B=Y>1?K/(Y-1):.5,X=MG*(1+LG*.4*(B*2-1));for(let $=0;$<G;$++){const ee=K*8191+$*131+1,H={x:($+.5)*p,y:(K+.5)*v,size:X,seed:ee,phase:np(ee),kind:0};H.kind=Math.floor(np(ee*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),M=j=>{a.fillStyle=AG,a.fillRect(0,0,f,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+OG&&(x=y,_=j,y=T(j+.2));let V=0;x&&(V=1-Pp((j-_)/NG),V<=0&&(x=null));const G=y;for(let H=0;H<G.els.length;H++){const D=G.els[H];O[H]=Pp(Math.min(1,Math.max(0,(j-G.startT-D.start)/D.dur)))}const Y=O[0],K=P(0),B=P(Y),X=V>0?P(V):K,$=V>0?P(Math.max(Y,V)):B,ee=c.length;for(let H=0;H<ee;H++){const D=c[H];let q=0,re=0;const se=H*Ra;for(let Se=se;Se<se+Ra;Se++){const Re=G.cellEl[Se];if(Re<0)break;const Ke=G.cellQ[Se]*O[Re];Ke>q&&(q=Ke,re=G.els[Re].level)}if(x)for(let Se=se;Se<se+Ra;Se++){const Re=x.cellEl[Se];if(Re<0)break;const Ke=x.cellQ[Se]*V;Ke>q&&(q=Ke,re=x.els[Re].level)}const oe=j/RG+D.phase,ue=Math.floor(oe),de=oe-ue,ie=Pp(Math.min(de,1-de)/IG),ae=Math.floor(np(D.seed*97+ue*7919)*3);ae!==D.kind&&q<.02&&ie<.05&&(D.kind=ae);const me=Math.max(ie*(1-q),q);if(!(me<.01))if(q<.02){const Se=G.inFrame[H]===1,Re=x?x.inFrame[H]===1:!1;Se?a.fillStyle=Re?$:B:a.fillStyle=Re?X:K;const Ke=Math.max(Se?Y:0,Re?V:0);oC(a,D.kind,D.x,D.y,D.size*me*(1-.2*Ke))}else{a.fillStyle=C(q);const Se=1+(jG[re]-1)*q;oC(a,D.kind,D.x,D.y,D.size*me*Se)}}};A();let R=0;if(u)y=T(-100),M(0);else{const j=performance.now(),V=G=>{M((G-j)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const L=new ResizeObserver(()=>{A(),u&&(y=T(-100),M(0))});L.observe(i),r.current=()=>{cancelAnimationFrame(R),L.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},UG=async(t=null)=>{if(t)return BG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return rp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return rp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:rp()},BG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},rp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},aC=hs("usePreviewUpstreamHealth"),WG=500,GG=4e3,KG=15e3,ZG=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??WG,i=e.probeMsWhileUp??GG,a=e.firstUnreachableCaptureAfterMs??KG,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,f=e.skip??!1,[h,p]=g.useState(t==="static"),[v,y]=g.useState(0),[x,_]=g.useState(null),[b,E]=g.useState(0),[C,P]=g.useState(!1),[T,A]=g.useState(!1),[O,M]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),M(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),M("upstream_unreachable"),n.current=null;return}let R=!0;const L=Date.now();_(L),E(0),P(!1),p(!1),A(!1),M("upstream_unreachable");const N={current:!1},j={current:!1},V={current:!1},G={current:null},Y={current:!1};let K=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},X=()=>{K!==null&&(clearTimeout(K),K=null)},$=(H,D)=>{X(),K=setTimeout(D,H)},ee=async()=>{if(!R)return;E(se=>se+1);const{isOk:H,unavailableReason:D}=await UG(c);if(!R)return;if(B(),H){const se=!Y.current;Y.current=!0,p(!0),M(null),G.current=null,j.current=!1,P(!1),N.current?se&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-L})),$(i,ee);return}const q=Y.current;Y.current=!1,p(!1),M(D),G.current===null&&(G.current=Date.now(),j.current=!1,P(!1)),q&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(se=>se+1),aC.warn("Preview upstream became unavailable after it was ready"));const re=Date.now()-G.current;re>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:re}),aC.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,f]),g.useEffect(()=>{var L;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((L=n.current)==null||L.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:C,initialProbeComplete:T,unavailableReason:O}};function qG(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const iA=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},oA=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${iA(t)}${e}`:e,YG="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",XG=t=>YG,QG=hs("PreviewSurface"),lC=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",aA=({target:t,src:e,framework:n,remountKey:r})=>(Xe(a0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:XG(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n})),QG.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),JG="modulepreload",eK=function(t){return"/"+t},uC={},tK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(f=>{if(f=eK(f),f in uC)return;uC[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":JG,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,x)=>{v.addEventListener("load",y),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},nK=g.lazy(()=>tK(()=>Promise.resolve().then(()=>OZ),void 0)),rK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},sK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},iK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},xd=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:f,role:h="status",busy:p=!1,className:v=""})=>{const y=g.useCallback(_=>{_&&f&&(Te==null||Te.capture("status_surface_shown",{state:f,tone:i,fill:a}))},[f,i,a]),x=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${rK[a]} ${v}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":f,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,x?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:sK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:iK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},wd=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(sA,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(nK,{className:"absolute inset-0"})})}):S.jsx(xd,{...r,size:n,busy:!0,media:S.jsx(o0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),lA=({icon:t,...e})=>S.jsx(xd,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Tm=t=>S.jsx(xd,{...t,tone:"error",role:"alert"}),cC="/static/",oK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(cC)}catch{return t.endsWith(cC)}},aK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Xe(l_),a=st(l_),u=Xe(Sm),c=st(Sm),f=Xe(pf),h=Xe(a0),p=Xe(u_),v=Xe(c_),y=Xe(KT),x=Xe(ZT),_=st(c_),b=Xe(qo),E=Xe(f_),C=st(u_),P=f.active&&f.projectContext.kind==="fresh",T=Xe(d_),A=f.active?f.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&!je.previewUnavailable))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),M=P||O,R=f.active?f.variants.find(je=>je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable)??null:null,L=e==="static"&&u!==null&&oK(u);g.useEffect(()=>{f.active||C(!1)},[f.active,C]);const N=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Qe=je&&!N.current;N.current=je;const lt=f.active?f.sessionId:null;!lt||!qG({enteringSplit:Qe,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(C(!1),_(null),a(Je=>Je+1),fetch(`/api/variants/${encodeURIComponent(lt)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[b,f,p,v,C,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!L||!f.active)return null;const{stage:je,variants:Qe}=f,lt=je==="ready"||je==="degraded",Je=Qe.some(zt=>{var An,Xn;return((An=zt.refinement)==null?void 0:An.status)==="pending"||((Xn=zt.refinement)==null?void 0:Xn.status)==="running"});if(!lt&&!Je)return null;const vt=Qe.find(zt=>{var An;return zt.status==="succeeded"&&((An=zt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[L,u,p,f])??u,G=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Qe;return((Qe=je.preview)==null?void 0:Qe.kind)==="static_artifact"&&V.startsWith(je.preview.url)})??null,[V,f]),Y=g.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!f.active)return bm;if(G)return{kind:"variant",sessionId:f.sessionId,variantId:G.workItemId};if(V){const Qe=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Qe!=null&&Qe[1]?decodeURIComponent(Qe[1]):null,Je=Qe!=null&&Qe[2]?decodeURIComponent(Qe[2]):null;if(lt===f.sessionId&&Je&&f.variants.some(zt=>zt.workItemId===Je))return{kind:"variant",sessionId:f.sessionId,variantId:Je};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(zt=>zt.workItemId===xn))return{kind:"variant",sessionId:f.sessionId,variantId:xn}}const je=!!(b!=null&&b.left||b!=null&&b.right);return(!je||P)&&!V&&p&&v&&f.variants.some(Qe=>Qe.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Qe=>Qe.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:bm},[E,G,f,p,v,V,b,P,T]),K=g.useRef(null);g.useEffect(()=>{var Je,vt;if(!G||((Je=G.preview)==null?void 0:Je.kind)!=="static_artifact"||((vt=G.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${G.workItemId}:${G.refinement.workItemId}`;if(K.current===je)return;K.current=je;const Qe=G.preview.url.includes("?")?"&":"?",lt=`${G.preview.url}${Qe}refinement=${encodeURIComponent(G.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,G,a,c,f]);const B=V!==null&&OW(V),X=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:H,initialProbeComplete:D}=ZG(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:X}),[q,re]=g.useState(()=>y&&$?i:null),se=g.useRef(null);g.useEffect(()=>{if(!y){se.current=null,re(null);return}if(q===i){se.current=null;return}const je=se.current;if(!je||je.remountKey!==i){se.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(se.current=null,re(i))},[q,i,y,H,$]);const ue=V!==null&&!B||$,ie=x||y&&q!==i||y&&!ue,ae=`${ee}:${i}`,me=r?`/try/${encodeURIComponent(r)}`:"",Se=eA(window.location.pathname),Re=e==="static"?`${me}/static${Se??"/"}`:`${me}${Se??"/"}`,Ke=iA(h);let it=null;V&&(it=oA({agentApplyMode:h,url:V}));const at=A||ie?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${Ke}${Re}`),It=!!A||!!R||!ue&&D;let mt=null;return ie?mt=S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=A.status==="succeeded"?S.jsx(wd,{fill:"overlay",loader:"spinner",state:"variant_building",title:"Starting preview",description:"Its preview server is starting up."}):S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Tm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):It&&(mt=M?S.jsx(lA,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Tm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[mt,S.jsx(aA,{target:Y,src:at,framework:e,remountKey:ae})]})};function dC({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(qo),c=Xe(pf),f=Xe(a0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Zd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(C=>{if(!C)return null;const P={...C};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=g.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),x=g.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(C=>C.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let C=r;if(((P=x==null?void 0:x.preview)==null?void 0:P.kind)==="static_artifact"&&((T=x.refinement)==null?void 0:T.status)==="succeeded"){const A=x.preview.url.includes("?")?"&":"?";C=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return oA({agentApplyMode:f,url:C})},[f,x,r]),b=((E=x==null?void 0:x.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${x.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Fo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:v,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(aA,{target:y,src:_,framework:"static",remountKey:b})})]})}const fC=240;function lK(){const t=Xe(Wd),e=Xe(X2),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-fC/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:fC},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:DT(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function uK(){const t=Xe(Wd),e=Xe(X2),n=Xe(qo),r=st(Wd),s=st(qo),i=g.useRef(null),[a,u]=g.useState(null),[c,f]=g.useState("hidden");g.useEffect(()=>{if(!t){f("hidden"),u(null);return}const v=requestAnimationFrame(()=>f("visible"));return()=>cancelAnimationFrame(v)},[t]);const h=g.useCallback((v,y)=>{const x=i.current;if(!x)return null;const _=x.getBoundingClientRect();return v<_.left||v>_.right||y<_.top||y>_.bottom?null:v<(_.left+_.right)/2?"left":"right"},[]);if(g.useEffect(()=>{if(!t||!e)return;const v=h(e.x,e.y);u(y=>y===v?y:v)},[t,e,h]),g.useEffect(()=>{if(!t)return;const v=y=>{const x=h(y.clientX,y.clientY);if(x&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},b=n==null?void 0:n[x];b&&(b.sessionId!==_.sessionId||b.variantId!==_.variantId)&&Zd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Zd(t),f("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),()=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(hC,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(hC,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function hC({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const uA=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},pC=(t,e)=>{if(!t)return;const n=uA(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},cK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(sA,{trackGlobalLoaderCount:!1})})}),dK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=TG();return g.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(cK,{}):u||!s?S.jsx(Tm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(fK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function fK(t){const e=Xe(qo),n=Xe(Wd),r=Xe(pf),s=Xe(Sm),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=g.useMemo(()=>{var A,O;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,b=r.variants.filter(M=>{var R;return M.status==="succeeded"&&((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(M=>{var R;return((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=uA(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=pC(i,r)??(a?u:void 0),f=pC(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(aK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${v?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(dC,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&f)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),f&&S.jsx(dC,{side:"right",sessionId:f.sessionId,variantId:f.variantId,url:f.url,label:f.label,source:f.source,isFallback:p},`right-${f.sessionId}:${f.variantId}:${f.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(uK,{}),S.jsx(lK,{})]})})}const cA=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(o0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function ji(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dA(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
111
+ ${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx($d,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:de=>{de.stopPropagation(),b(t)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1",children:S.jsx(hz,{size:13,weight:"bold"})})}),!O&&S.jsx(Fo,{label:"Remove",children:S.jsx("button",{type:"button","data-variant-remove-id":e.kind==="active"?e.variant.workItemId:void 0,"aria-label":"Remove direction",disabled:X,onClick:de=>{de.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted hover:bg-main-hover hover:text-content focus-visible:ring-content-muted/40 ml-1 flex h-6 w-6 items-center justify-center rounded focus:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(gz,{size:13,weight:"bold"})})})]})]})},qW=({initial:t,onCommit:e,onCancel:n})=>{const[r,s]=g.useState(t),i=g.useRef(!1),a=g.useCallback(c=>{c&&(c.focus(),c.select())},[]),u=c=>{i.current||(i.current=!0,c?e(r):n())};return S.jsx("input",{ref:a,type:"text",value:r,maxLength:120,"aria-label":"Rename direction",onChange:c=>s(c.target.value),onKeyDown:c=>{c.stopPropagation(),c.key==="Enter"?(c.preventDefault(),u(!0)):c.key==="Escape"&&(c.preventDefault(),u(!1))},onBlur:()=>u(!0),onClick:c=>c.stopPropagation(),onPointerDown:c=>c.stopPropagation(),className:"border-content-muted/40 bg-main text-content focus:ring-content-muted/50 w-full rounded border px-1.5 py-0.5 text-sm font-medium focus:ring-1 focus:outline-none"})},Xk=({label:t})=>S.jsx("span",{className:"bg-main-input text-content-muted shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tracking-wide uppercase",children:t}),YW=({entry:t,deploying:e,deployedUrl:n,onDeploy:r,isDeployDisabled:s=!1})=>{const a=e?"Deploying…":n?"Copy link":"Share";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsxs("div",{className:"min-w-0",children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),n?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}),S.jsxs("button",{type:"button",onClick:()=>r(t),disabled:e||s,title:n?`Copy share link (${n})`:"Deploy this direction and get a public link to share",className:"border-main-border text-content hover:bg-main-input flex shrink-0 items-center gap-1 rounded-md border px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[n&&!e?S.jsx($d,{size:12,weight:"bold"}):null,a]})]})},XW={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},QW={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},JW=({artifacts:t})=>{const[e,n]=g.useState(null),r=g.useMemo(()=>e&&t.some(i=>i.id===e)?e:null,[t,e]);if(t.length===0)return null;const s=i=>{n(a=>a===i?null:i)};return S.jsxs("section",{"aria-label":"Directions session artifacts",className:"mt-4",children:[S.jsx("div",{className:"flex shrink-0 items-center px-3 py-2",children:S.jsx("span",{className:"text-content truncate text-sm font-medium",children:"Artifacts"})}),S.jsx("ul",{className:"mt-2 space-y-1 px-1",children:t.map(i=>S.jsx(eG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},eG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=QW[t.kind],s=t.source?XW[t.source]:null,i=[t.kind==="design_context"?null:s,t.summary].filter(Boolean).join(" · "),a=t.kind==="design_context"&&!!t.viewUrl,u=`${e?"Hide":"View"} ${r} artifact${t.label?`: ${t.label}`:""}`;return a?S.jsx("li",{className:"border-main-border rounded-md border",children:S.jsxs("div",{className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"border-content-muted/30 bg-main-input text-content-muted shrink-0 rounded-full border px-2 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("a",{href:t.viewUrl,target:"_blank",rel:"noreferrer","aria-label":`Open ${r} artifact${t.label?`: ${t.label}`:""}`,className:"text-content-muted hover:bg-main-input hover:text-content focus-visible:ring-content-muted/40 shrink-0 rounded p-1 transition-colors focus:outline-none focus-visible:ring-1",children:S.jsx(lz,{className:"h-3.5 w-3.5",weight:"bold"})})]})}):S.jsxs("li",{className:"border-main-border rounded-md border",children:[S.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-label":u,className:"hover:bg-main-input flex w-full items-center justify-between gap-2 px-3 py-2 text-left text-xs transition-colors",children:[S.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"text-content-muted text-[10px] font-semibold tracking-wide uppercase",children:r}),S.jsx("span",{className:"text-content truncate text-xs font-medium",children:t.label})]}),i?S.jsx("span",{className:"text-content-muted mt-0.5 truncate text-[11px]",children:i}):null]}),S.jsx("span",{className:"text-content-muted shrink-0 text-[11px]",children:e?"Hide":"View"})]}),e?S.jsx("div",{className:"border-main-border bg-main-light border-t px-3 py-2",children:S.jsx(tG,{artifact:t})}):null]})},tG=({artifact:t})=>S.jsxs("div",{className:"text-content-muted space-y-1 text-[11px]",children:[t.summary?S.jsx("p",{children:t.summary}):null,t.path?S.jsxs("p",{children:["Stored at ",t.path]}):null,!t.summary&&!t.path?S.jsx("p",{children:"No inline content available for this artifact."}):null]}),nG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var M,R,L,N;const p=t?((R=(M=t.actions)==null?void 0:M.commit)==null?void 0:R.enabled)??t.status==="succeeded":!1,v=p&&e===null,y=(e==null?void 0:e.kind)==="commit"&&e.variantId===(t==null?void 0:t.workItemId),x=(e==null?void 0:e.kind)==="deploy"&&e.variantId===(t==null?void 0:t.workItemId),_=(e==null?void 0:e.kind)==="deploy-canvas",b=!i||!p||e!==null,E=a&&c>0,P=x?"Deploying…":h?"Copy link":"Share",A=_?"Sharing…":f?"Copy canvas link":"Share canvas",O=y?"Applying…":"Apply to project";return S.jsxs("div",{className:"border-main-border bg-main-light flex shrink-0 items-center justify-between gap-3 border-t px-3 pt-2 pb-4",children:[S.jsx("div",{className:"min-w-0",children:t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"text-content truncate text-sm font-medium",children:t.label.trim()||"Untitled direction"}),h?S.jsx("div",{className:"text-content-muted text-[11px]",children:"Deployed — share link ready"}):null]}):null}),S.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[S.jsx(V5,{primaryLabel:P,primaryIcon:h&&!x?$d:void 0,primaryAction:()=>{t&&r(t)},isDisabled:b,isDropdownDisabled:e!==null,isLoading:x,loadingLabel:"Deploying…",dropdownAriaLabel:"More share actions",dropdownItems:E?[{label:A,icon:f&&!_?$d:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(N=(L=t==null?void 0:t.actions)==null?void 0:L.commit)==null?void 0:N.reason,className:"bg-secondary text-secondary-foreground hover:bg-accent rounded-md px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:O}):null]})]})},nA=()=>S.jsx("div",{"data-testid":"direction-skeleton-row","aria-hidden":"true",className:"flex w-full items-start rounded-md px-3 py-2",children:S.jsxs("span",{className:"min-w-0 flex-1",children:[S.jsxs("span",{className:"flex items-center gap-2",children:[S.jsx(Q2,{className:"text-content-muted shrink-0 text-sm"}),S.jsx("span",{className:"bg-muted-foreground/15 h-3.5 w-28 animate-pulse rounded"})]}),S.jsx("span",{className:"mt-1.5 flex",children:S.jsx("span",{className:"bg-muted-foreground/10 h-2.5 w-full max-w-[14rem] animate-pulse rounded"})})]})}),rG=({groups:t})=>S.jsx("div",{className:"space-y-0.5",children:t.flatMap(e=>Array.from({length:Math.max(1,e.count)}).map((n,r)=>S.jsx(nA,{},`${e.requestId}-${r}`)))}),sG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(nA,{},e))}),iG=()=>S.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[S.jsx("div",{className:"text-content text-sm",children:"No directions yet"}),S.jsx("div",{className:"text-content-muted text-xs",children:"They’ll appear here as they generate."})]}),Qk="Try different ways to create a dropdown that feels fluid and dynamic",oG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=NU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(Qk).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})};return S.jsxs("div",{className:"flex flex-col items-start gap-3 px-2 py-2",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"Create your first direction"}),S.jsxs("p",{className:"text-content-muted text-xs",children:["Use ",i," to generate directions."]}),S.jsxs("div",{className:"w-full",children:[S.jsx("p",{className:"text-content-muted mb-2 text-xs",children:"Here's a sample prompt to use:"}),S.jsxs("div",{className:"border-main-border bg-main-input relative rounded-md border px-3 py-2.5 pr-8",children:[S.jsxs("p",{className:"text-content-muted text-xs leading-snug",children:["“",Qk,"”"]}),S.jsx("button",{type:"button",onClick:a,className:"text-content-muted hover:bg-main-border hover:text-content absolute top-2 right-2 rounded p-0.5 transition-colors",title:"Copy to clipboard",children:n?S.jsx(lT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx($d,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},aG=({onClose:t})=>{const e=Xe(BT);return t?S.jsxs("div",{className:"z-10 flex flex-shrink-0 items-center justify-between gap-2 border-b border-main-border bg-main-light px-2.5 py-2.5",children:[e?S.jsx("span",{className:"text-content min-w-0 truncate text-sm font-medium",title:e,children:e}):S.jsx("span",{}),S.jsx(Fo,{label:"Close panel",side:"bottom",children:S.jsx("button",{onClick:t,className:"flex h-6 w-6 flex-shrink-0 items-center justify-center rounded p-1 text-content-subtle transition-colors hover:bg-main-input hover:text-content",children:S.jsx(pz,{className:"h-4 w-4",weight:"bold"})})})]}):null},lG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',uG=({itemSelector:t=lG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=LU():((u=r.current)==null||u.call(r),r.current=null)},[]),i=g.useCallback(a=>{var x;const{key:u}=a;if(u!=="ArrowDown"&&u!=="ArrowUp"&&u!=="Home"&&u!=="End")return;const c=n.current;if(!c)return;const f=Array.from(c.querySelectorAll(t));if(f.length===0)return;a.preventDefault(),a.stopPropagation();const h=f.indexOf(document.activeElement),p=f.length-1,v=_=>{if(h===-1)return _===1?0:p;const b=h+_;return e?(b+f.length)%f.length:Math.min(Math.max(b,0),p)};let y;u==="Home"?y=0:u==="End"?y=p:u==="ArrowDown"?y=v(1):y=v(-1),(x=f[y])==null||x.focus()},[t,e]);return{containerRef:s,onKeyDown:i}},Jk="/assets/arena-Db0j1set.png",cG=hs("useIntegrations"),eC=["integrations"],dG="rivet:connect-result",fG=t=>typeof t=="object"&&t!==null&&t.type===dG,hG=et(null),pG=()=>{const t=h8(),[e,n]=Q6(hG),r=H1({queryKey:eC,queryFn:async()=>{const u=await fetch("/api/integrations");if(!u.ok)throw new Error(`Failed to load integrations (${u.status})`);return(await u.json()).integrations??[]},staleTime:1e4}),s=g.useCallback(()=>t.invalidateQueries({queryKey:eC}),[t]),i=g.useCallback(async u=>{const c=window.open("","_blank","width=560,height=720");if(!c)throw new Error("Popup blocked. Allow popups to connect.");n(u);try{const f=await fetch(`/api/integrations/${u}/connect`,{method:"POST"}),h=await f.json().catch(()=>({}));if(!f.ok||!h.authUrl)throw c.close(),new Error(h.error||`Could not connect ${u}`);c.location.href=h.authUrl,await new Promise(p=>{const v=()=>{window.removeEventListener("message",y),clearInterval(x),s(),p()},y=_=>{fG(_.data)&&_.data.provider===u&&(_.data.status==="error"&&cG.warn(`Connect failed for ${u}:`,_.data.message),v())};window.addEventListener("message",y);const x=setInterval(()=>{c.closed&&v()},500)})}finally{n(null)}},[s,n]),a=g.useCallback(async u=>{n(u);try{const c=await fetch(`/api/integrations/${u}`,{method:"DELETE"});if(!c.ok){const f=await c.json().catch(()=>({}));throw new Error(f.error||`Could not disconnect ${u}`)}await s()}finally{n(null)}},[s,n]);return{integrations:r.data??[],isLoading:r.isPending,error:r.error instanceof Error?r.error.message:null,pendingProvider:e,connect:i,disconnect:a,refetch:s}},du=({onClick:t,title:e,shortcut:n,children:r,disabled:s=!1,className:i="",type:a="button","data-cy":u})=>{const c=S.jsx("button",{onClick:t,disabled:s,className:i,type:a,"data-cy":u,children:r});return e?S.jsx(fx,{content:S.jsxs("div",{className:"flex flex-row items-center gap-2",children:[S.jsx("span",{children:e}),n?S.jsx("span",{className:"rounded bg-white/15 px-1.5 py-0.5 text-[11px]",children:n}):null]}),children:c}):c},tC=hs("ConnectorsModal"),mG=()=>S.jsx("svg",{viewBox:"0 0 24 24",className:"h-6 w-6","aria-hidden":"true",children:S.jsx("path",{fill:"currentColor",d:"M12 0C5.373 0 0 5.372 0 12c0 5.084 3.163 9.426 7.627 11.174-.105-.949-.2-2.405.042-3.441.218-.937 1.407-5.965 1.407-5.965s-.359-.719-.359-1.781c0-1.669.967-2.915 2.171-2.915 1.024 0 1.518.769 1.518 1.69 0 1.029-.655 2.568-.994 3.995-.283 1.194.599 2.169 1.777 2.169 2.132 0 3.772-2.249 3.772-5.495 0-2.873-2.064-4.882-5.012-4.882-3.414 0-5.418 2.561-5.418 5.207 0 1.031.397 2.137.893 2.739.098.119.112.223.083.344-.091.379-.293 1.194-.333 1.361-.052.22-.174.266-.401.16-1.499-.698-2.436-2.889-2.436-4.649 0-3.785 2.75-7.262 7.929-7.262 4.163 0 7.398 2.967 7.398 6.931 0 4.136-2.607 7.464-6.227 7.464-1.216 0-2.36-.631-2.75-1.378l-.748 2.853c-.271 1.043-1.002 2.35-1.492 3.146A12.004 12.004 0 0 0 12 24c6.627 0 12-5.373 12-12C24 5.372 18.627 0 12 0z"})}),gG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${Jk})`,maskImage:`url(${Jk})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),vG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(mG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(gG,{})}],yG=({meta:t,integration:e,isPending:n,isHighlighted:r,onConnect:s,onDisconnect:i})=>{const a=(e==null?void 0:e.status)==="connected",u=e!=null&&e.externalUsername?`@${e.externalUsername}`:null;return S.jsxs("article",{className:`flex flex-col rounded-xl bg-main-light p-[18px] ${r?"ring-2 ring-secondary":""}`,children:[S.jsx("span",{className:`grid h-[52px] w-[52px] flex-none place-items-center rounded-xl ${t.tileClassName}`,"aria-hidden":"true",children:t.icon}),S.jsxs("div",{className:"mt-4 flex-1",children:[S.jsxs("h2",{className:"text-content flex items-center gap-1.5 text-[15px] font-semibold",children:[t.name,a?S.jsx(lT,{className:"h-3.5 w-3.5",weight:"bold","aria-hidden":"true"}):null]}),S.jsx("p",{className:"text-content-subtle mt-1 text-[13px] leading-relaxed",children:t.description}),a&&u?S.jsx("p",{className:"text-content-muted mt-2.5 text-xs font-medium",children:u}):null]}),a?S.jsx("button",{type:"button",onClick:i,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-main-input px-3.5 text-[13px] font-semibold text-content-muted transition-colors hover:bg-red-500/10 hover:text-red-300 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Disconnecting…":"Disconnect"}):S.jsx("button",{type:"button",onClick:s,disabled:n,className:"active-push mt-[18px] inline-flex min-h-[38px] w-full items-center justify-center rounded-lg bg-secondary px-3.5 text-[13px] font-semibold text-secondary-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:n?"Connecting…":"Connect"})]})},x_=({isOpen:t,onClose:e,context:n="menu",highlightProvider:r=null})=>{const{integrations:s,isLoading:i,error:a,pendingProvider:u,connect:c,disconnect:f}=pG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const C=E instanceof Error?E.message:"Could not connect.";tC.warn(`Connect error for ${b}:`,C),ht.error(C)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const C=E instanceof Error?E.message:"Could not disconnect.";tC.warn(`Disconnect error for ${b}:`,C),ht.error(C)})},[f]),_=n==="onboarding";return S.jsx(e0,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:p,className:"fixed left-1/2 top-1/2 z-max w-[560px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:h,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(du,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Connect your design references to use them with Rivet’s MCP."}),a?S.jsx("p",{className:"rounded-lg bg-red-500/10 px-4 py-3 text-[13px] font-medium text-red-300",children:a}):null,S.jsx("div",{className:"grid grid-cols-2 gap-4",children:vG.map(b=>S.jsx(yG,{meta:b,integration:v(b.provider),isPending:i||u===b.provider,isHighlighted:r===b.provider,onConnect:()=>y(b.provider),onDisconnect:()=>x(b.provider)},b.provider))}),_?S.jsxs("div",{className:"flex items-center justify-between gap-4",children:[S.jsx("p",{className:"text-xs text-content-subtle",children:"You can always do this later from the account menu."}),S.jsx("button",{type:"button",onClick:e,className:"active-push flex-none rounded-lg bg-secondary px-3.5 py-2 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent",children:"Skip for now"})]}):null]})]})})]})})},nC=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),_G=hs("SupportTicketModal"),rC=5e3,c1="feedback",xG=t=>{var r;if(!t)return null;const e=(r=t.formErrors)==null?void 0:r[0];if(e)return e;const n=t.fieldErrors??{};for(const s of Object.values(n)){const i=s==null?void 0:s[0];if(i)return i}return null},wG=async t=>{let e;try{e=await t.json()}catch{e=void 0}if(t.status===400){if(typeof(e==null?void 0:e.details)=="string"&&e.details.trim())return e.details;if(typeof(e==null?void 0:e.details)=="object"&&e.details!==null){const n=xG(e.details);if(n)return n}return"Please check your feedback and try again."}return t.status>=500?typeof(e==null?void 0:e.details)=="string"&&e.details.trim()?e.details:"Could not send feedback right now. Please try again later.":typeof(e==null?void 0:e.error)=="string"&&e.error.trim()?e.error:`HTTP ${t.status}`},bG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=QN(),[s,i]=g.useState(""),[a,u]=g.useState(!1),[c,f]=g.useState(null),h=g.useCallback(()=>{i("")},[]),p=g.useCallback(()=>{a||(h(),e())},[a,e,h]),v=g.useCallback(async()=>{const b=s.trim();if(!(!b||a)){u(!0);try{const E=typeof(r==null?void 0:r.get_session_id)=="function"?r.get_session_id():void 0,C=typeof(r==null?void 0:r.get_distinct_id)=="function"?r.get_distinct_id():void 0,P=n==null?void 0:n.trim(),T=await fetch("/api/support/tickets",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:c1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:C??void 0,appVersion:"0.13.2",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await wG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:c1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const C=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:c1,error:C}),_G.error("Failed to submit support ticket:",C),ht.error("Could not send feedback",{description:C})}finally{u(!1)}}},[n,a,s,e,r,h]),y=g.useCallback(b=>{b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),v())},[v]),x=rC-s.length,_=a||s.trim().length===0;return S.jsx(e0,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(t0,{children:[S.jsx(n0,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(r0,{ref:f,className:"fixed left-1/2 top-1/2 z-max w-[440px] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-main-border bg-main font-main shadow-2xl outline-none",children:S.jsxs(Q5,{value:c,children:[S.jsxs("div",{className:"flex items-center justify-between rounded-t-lg border-b border-main-border bg-main-light px-4 py-2",children:[S.jsx(s0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(du,{onClick:p,disabled:a,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(xT,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(i0,{className:"text-sm text-content-subtle",children:"Tell us what happened or what we can improve."}),S.jsxs("div",{className:"rounded-lg bg-main-input outline outline-1 outline-transparent transition-[outline-color] focus-within:outline-white/20",children:[S.jsx("textarea",{id:"support-ticket-message","aria-label":"Your feedback",value:s,onChange:b=>i(b.target.value),onKeyDown:y,maxLength:rC,rows:6,disabled:a,placeholder:"What happened?",className:"max-h-64 w-full resize-none overflow-y-auto bg-transparent pb-1 pl-3 pr-3 pt-3 text-sm text-content placeholder-content-subtle focus:outline-none disabled:opacity-50"}),S.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[S.jsx("span",{className:"text-xs text-content-subtle",children:"Context details are included automatically."}),S.jsxs("div",{className:"flex items-center gap-2",children:[x<=500&&S.jsx("span",{className:"text-xs text-content-subtle",children:x}),S.jsx(du,{onClick:v,disabled:_,title:"Send feedback",shortcut:"⌘↵",className:"flex items-center justify-center rounded bg-primary p-1 text-content transition-colors hover:bg-primary-hover disabled:cursor-not-allowed disabled:opacity-80",children:a?S.jsx(o0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(uz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},SG=hs("ProfileAvatar"),rA=(t,e)=>{const n=(t??"").trim();if(n)return n.split(/\s+/).filter(Boolean)[0]??"";const s=((e??"").split("@")[0]??"").split(/[._\-+]/).filter(Boolean)[0]??"";return s?s[0].toUpperCase()+s.slice(1):""},EG=(t,e)=>rA(t,e).charAt(0).toUpperCase(),kG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Xe(GT),i=Xe(QT),a=Xe(XT),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=uG(),E=Xe(mf),C=EG(r,s);if(!C)return E?S.jsxs("span",{"data-testid":"profile-avatar-skeleton","aria-hidden":"true",className:`flex shrink-0 items-center gap-2 ${t}`.trim(),children:[S.jsx(nC,{className:"h-7 w-7 rounded-full"}),S.jsx(nC,{className:"h-3 w-16"})]}):null;const P=rA(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const M=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!M.ok)throw new Error(`Logout failed: ${M.status}`)}catch(M){SG.warn("Logout request failed",M),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(N5,{open:u,onOpenChange:c,children:[S.jsx(D5,{asChild:!0,children:S.jsxs("button",{type:"button","aria-label":"Account",className:`flex shrink-0 select-none items-center gap-2 text-content-muted transition-colors hover:text-content ${t}`,children:[S.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full border border-main-border bg-main-input text-[11px] font-semibold leading-none",children:C}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(j5,{children:S.jsxs(F5,{ref:_,onKeyDown:b,role:"menu",className:"z-[60] min-w-[180px] rounded-lg bg-surface-2 p-1 shadow-lg",side:e,sideOffset:6,align:n,children:[T||A?S.jsxs("div",{className:"border-b border-main-border px-3 py-2",children:[T?S.jsx("div",{className:"truncate text-xs font-medium text-content",children:T}):null,A?S.jsx("div",{className:"truncate text-[11px] text-content-muted",children:A}):null]}):null,S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),h(!0)},disabled:!i||a,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(vT,{className:"h-3.5 w-3.5",weight:"bold"}),"Connect design references"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:()=>{c(!1),v(!0)},className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none",children:[S.jsx(dz,{className:"h-3.5 w-3.5",weight:"bold"}),"Share feedback"]}),S.jsxs("button",{type:"button",role:"menuitem","data-menu-item":!0,onClick:O,disabled:y,className:"mt-1 flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs text-content transition-colors hover:bg-hover focus:bg-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[S.jsx(mz,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(bG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},CG=({onClose:t})=>S.jsxs("div",{className:"bg-main font-main scrollbar-hide relative flex h-full w-full cursor-auto flex-col overflow-hidden shadow-2xl","data-cy":"element-inspector",children:[S.jsx(aG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(HW,{})}),S.jsx("div",{className:"border-main-border bg-main-light flex flex-shrink-0 items-center border-t px-2.5 py-1.5",children:S.jsx(kG,{side:"top",align:"start"})})]}),PG=hs("useServerConfig"),TG=()=>{const[t,e]=g.useState(null),[n,r]=g.useState(!0),[s,i]=g.useState(null),a=g.useCallback(async()=>{var u;try{r(!0),i(null);const c=await fetch("/api/health");if(!c.ok)throw new Error(`Failed to fetch config: ${c.status}`);const f=await c.json();if(!f.framework)throw new Error("Server did not return framework information");const h={userPort:((u=f.ports)==null?void 0:u.userDevServer)||3e3,framework:f.framework};return e(h),h}catch(c){const f=c instanceof Error?c.message:"Failed to fetch server config";throw i(f),PG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},AG="#1C1C20",Ri=[118,118,124],sC=.85,RG=3,IG=.15,tp=36,MG=4.4,LG=.7,OG=3.5,NG=.8,iC=9,DG=11,jG=[1.35,1.12,.95,.85],FG=[0,1.1,2.3,3.1],VG=[0,.35,.16,.13],$G=[.9,.5,.4,.35],Ra=3,d1=[[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.23,level:1},{x1:.14,y1:.28,x2:.3,y2:.87,level:1},{x1:.34,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.155,x2:.225,y2:.205,level:2},{x1:.7,y1:.155,x2:.755,y2:.205,level:2},{x1:.775,y1:.155,x2:.83,y2:.205,level:2},{x1:.165,y1:.32,x2:.275,y2:.375,level:2},{x1:.165,y1:.415,x2:.275,y2:.47,level:2},{x1:.165,y1:.51,x2:.275,y2:.565,level:2},{x1:.37,y1:.32,x2:.585,y2:.56,level:2},{x1:.615,y1:.32,x2:.83,y2:.56,level:2},{x1:.37,y1:.61,x2:.83,y2:.83,level:2},{hline:!0,x1:.39,x2:.81,y:.685,level:3},{hline:!0,x1:.39,x2:.75,y:.755,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.16,y1:.17,x2:.52,y2:.45,level:1},{x1:.58,y1:.17,x2:.685,y2:.29,level:1},{x1:.715,y1:.17,x2:.84,y2:.29,level:1},{x1:.58,y1:.33,x2:.685,y2:.45,level:1},{x1:.715,y1:.33,x2:.84,y2:.45,level:1},{x1:.16,y1:.55,x2:.84,y2:.85,level:1},{x1:.19,y1:.21,x2:.36,y2:.33,level:2},{hline:!0,x1:.19,x2:.48,y:.37,level:3},{hline:!0,x1:.19,x2:.42,y:.42,level:3},{x1:.19,y1:.6,x2:.49,y2:.8,level:2},{hline:!0,x1:.53,x2:.8,y:.63,level:3},{hline:!0,x1:.53,x2:.76,y:.7,level:3},{hline:!0,x1:.53,x2:.79,y:.77,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.14,y1:.13,x2:.86,y2:.22,level:1},{x1:.14,y1:.28,x2:.36,y2:.87,level:1},{x1:.39,y1:.28,x2:.61,y2:.87,level:1},{x1:.64,y1:.28,x2:.86,y2:.87,level:1},{x1:.165,y1:.15,x2:.225,y2:.2,level:2},{x1:.165,y1:.32,x2:.335,y2:.52,level:2},{x1:.415,y1:.32,x2:.585,y2:.52,level:2},{x1:.665,y1:.32,x2:.835,y2:.52,level:2},{hline:!0,x1:.165,x2:.335,y:.6,level:3},{hline:!0,x1:.165,x2:.3,y:.67,level:3},{hline:!0,x1:.415,x2:.585,y:.6,level:3},{hline:!0,x1:.415,x2:.55,y:.67,level:3},{hline:!0,x1:.665,x2:.835,y:.6,level:3},{hline:!0,x1:.665,x2:.8,y:.67,level:3}],[{x1:.1,y1:.08,x2:.9,y2:.92,level:0},{x1:.3,y1:.22,x2:.7,y2:.74,level:1},{x1:.34,y1:.27,x2:.55,y2:.34,level:2},{hline:!0,x1:.36,x2:.64,y:.42,level:3},{hline:!0,x1:.36,x2:.6,y:.49,level:3},{hline:!0,x1:.36,x2:.62,y:.56,level:3},{x1:.5,y1:.63,x2:.575,y2:.69,level:2},{x1:.595,y1:.63,x2:.66,y2:.69,level:2}]],np=t=>{let e=t|0;return e=Math.imul(e^e>>>16,73244475),e=Math.imul(e^e>>>16,73244475),e^=e>>>16,(e>>>0)/4294967296},Pp=t=>{const e=Math.min(1,Math.max(0,t));return e*e*(3-2*e)},Ia=(t,e)=>(Math.round(t/e-.5)+.5)*e,HG=Math.sin(Math.PI/3),oC=(t,e,n,r,s)=>{if(t.beginPath(),e===0)t.arc(n,r,s,0,Math.PI*2);else if(e===1){const i=s*HG;t.moveTo(n,r-s),t.lineTo(n+i,r+s/2),t.lineTo(n-i,r+s/2),t.closePath()}else{const i=s*.85;t.rect(n-i,r-i,i*2,i*2)}t.fill()},zG=(t,e,n)=>{let r;if(n.hline){const s=Math.max(n.x1-t,t-n.x2,0),i=Math.abs(e-n.y1);r=Math.hypot(s,i)-iC}else{const s=Math.max(n.x1-t,t-n.x2,0),i=Math.max(n.y1-e,e-n.y2,0);s===0&&i===0?r=-Math.min(t-n.x1,n.x2-t,e-n.y1,n.y2-e):r=Math.hypot(s,i),r=Math.abs(r)-iC}return Pp(.5-r/(2*DG))},sA=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(WT),r=g.useRef(null),s=g.useCallback(i=>{var N;if((N=r.current)==null||N.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(j=>j+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=tp,v=tp,y=null,x=null,_=0,b=-1;const E=new Array(33),C=j=>{const V=Math.round(j*32);let G=E[V];if(!G){const Y=V/32,K=Math.round(Ri[0]+(255-Ri[0])*Y),B=Math.round(Ri[1]+(255-Ri[1])*Y),X=Math.round(Ri[2]+(255-Ri[2])*Y);G=`rgba(${K}, ${B}, ${X}, ${sC})`,E[V]=G}return G},P=j=>{const V=1-.35*j,G=Math.round(Ri[0]*V),Y=Math.round(Ri[1]*V),K=Math.round(Ri[2]*V);return`rgba(${G}, ${Y}, ${K}, ${sC})`},T=j=>{let V=Math.floor(Math.random()*d1.length);V===b&&(V=(V+1)%d1.length),b=V;const G=[0,0,0,0],Y=d1[V].map((D,q)=>{const re=D.level,se=G[re]++,oe=FG[re]+se*VG[re],ue=$G[re]+np(V*131+q*17+5)*.2;if(D.hline){const ae=Ia((D.y??0)*h,v);return{hline:!0,x1:Ia(D.x1*f,p),x2:Ia(D.x2*f,p),y1:ae,y2:ae,level:re,start:oe,dur:ue}}const de=Ia(D.x1*f,p),ie=Ia((D.y1??0)*h,v);return{hline:!1,x1:de,y1:ie,x2:Math.max(Ia(D.x2*f,p),de+p),y2:Math.max(Ia((D.y2??0)*h,v),ie+v),level:re,start:oe,dur:ue}}),K=Y.reduce((D,q)=>Math.max(D,q.start+q.dur),0),B=c.length,X=new Float32Array(B*Ra),$=new Int16Array(B*Ra).fill(-1),ee=new Uint8Array(B),H=Y[0];for(let D=0;D<B;D++){const q=c[D];q.x>H.x1&&q.x<H.x2&&q.y>H.y1&&q.y<H.y2&&(ee[D]=1);const re=D*Ra;for(let se=0;se<Y.length;se++){const oe=zG(q.x,q.y,Y[se]);if(oe<=.02)continue;let ue=re;for(let de=re;de<re+Ra;de++){if($[de]===-1){ue=de;break}X[de]<X[ue]&&(ue=de)}($[ue]===-1||oe>X[ue])&&(X[ue]=oe,$[ue]=se)}}return{startT:j,buildEnd:K,els:Y,frame:H,cellQ:X,cellEl:$,inFrame:ee}},A=()=>{const j=i.getBoundingClientRect();f=Math.max(1,j.width),h=Math.max(1,j.height);const V=Math.min(2,window.devicePixelRatio||1);i.width=Math.round(f*V),i.height=Math.round(h*V),a.setTransform(V,0,0,V,0,0);const G=Math.max(8,Math.round(f/tp)),Y=Math.max(6,Math.round(h/tp));p=f/G,v=h/Y,c=[];for(let K=0;K<Y;K++){const B=Y>1?K/(Y-1):.5,X=MG*(1+LG*.4*(B*2-1));for(let $=0;$<G;$++){const ee=K*8191+$*131+1,H={x:($+.5)*p,y:(K+.5)*v,size:X,seed:ee,phase:np(ee),kind:0};H.kind=Math.floor(np(ee*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),M=j=>{a.fillStyle=AG,a.fillRect(0,0,f,h),y||(y=T(j+.2)),j>=y.startT+y.buildEnd+OG&&(x=y,_=j,y=T(j+.2));let V=0;x&&(V=1-Pp((j-_)/NG),V<=0&&(x=null));const G=y;for(let H=0;H<G.els.length;H++){const D=G.els[H];O[H]=Pp(Math.min(1,Math.max(0,(j-G.startT-D.start)/D.dur)))}const Y=O[0],K=P(0),B=P(Y),X=V>0?P(V):K,$=V>0?P(Math.max(Y,V)):B,ee=c.length;for(let H=0;H<ee;H++){const D=c[H];let q=0,re=0;const se=H*Ra;for(let Se=se;Se<se+Ra;Se++){const Re=G.cellEl[Se];if(Re<0)break;const Ke=G.cellQ[Se]*O[Re];Ke>q&&(q=Ke,re=G.els[Re].level)}if(x)for(let Se=se;Se<se+Ra;Se++){const Re=x.cellEl[Se];if(Re<0)break;const Ke=x.cellQ[Se]*V;Ke>q&&(q=Ke,re=x.els[Re].level)}const oe=j/RG+D.phase,ue=Math.floor(oe),de=oe-ue,ie=Pp(Math.min(de,1-de)/IG),ae=Math.floor(np(D.seed*97+ue*7919)*3);ae!==D.kind&&q<.02&&ie<.05&&(D.kind=ae);const me=Math.max(ie*(1-q),q);if(!(me<.01))if(q<.02){const Se=G.inFrame[H]===1,Re=x?x.inFrame[H]===1:!1;Se?a.fillStyle=Re?$:B:a.fillStyle=Re?X:K;const Ke=Math.max(Se?Y:0,Re?V:0);oC(a,D.kind,D.x,D.y,D.size*me*(1-.2*Ke))}else{a.fillStyle=C(q);const Se=1+(jG[re]-1)*q;oC(a,D.kind,D.x,D.y,D.size*me*Se)}}};A();let R=0;if(u)y=T(-100),M(0);else{const j=performance.now(),V=G=>{M((G-j)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const L=new ResizeObserver(()=>{A(),u&&(y=T(-100),M(0))});L.observe(i),r.current=()=>{cancelAnimationFrame(R),L.disconnect(),e&&n(j=>j-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},UG=async(t=null)=>{if(t)return BG(t);let e;try{e=await fetch("/api/mcp/status")}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}if(e.status===404||!(e.headers.get("content-type")??"").toLowerCase().includes("application/json"))return rp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return rp()}const s=r.devServerHealth;return s?s.ownership==="none"?{isOk:!1,unavailableReason:"upstream_unreachable"}:s.isReachable===!0?{isOk:!0,unavailableReason:"upstream_unreachable"}:{isOk:!1,unavailableReason:s.reason==="rivet_unreachable"?"rivet_unreachable":"upstream_unreachable"}:rp()},BG=async t=>{try{const e=await fetch(t);return{isOk:e.status!==502&&e.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},rp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},aC=hs("usePreviewUpstreamHealth"),WG=500,GG=4e3,KG=15e3,ZG=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??WG,i=e.probeMsWhileUp??GG,a=e.firstUnreachableCaptureAfterMs??KG,u=e.rerunProbeImmediatelyOnVersion,c=e.probePath??null,f=e.skip??!1,[h,p]=g.useState(t==="static"),[v,y]=g.useState(0),[x,_]=g.useState(null),[b,E]=g.useState(0),[C,P]=g.useState(!1),[T,A]=g.useState(!1),[O,M]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),M(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),M("upstream_unreachable"),n.current=null;return}let R=!0;const L=Date.now();_(L),E(0),P(!1),p(!1),A(!1),M("upstream_unreachable");const N={current:!1},j={current:!1},V={current:!1},G={current:null},Y={current:!1};let K=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},X=()=>{K!==null&&(clearTimeout(K),K=null)},$=(H,D)=>{X(),K=setTimeout(D,H)},ee=async()=>{if(!R)return;E(se=>se+1);const{isOk:H,unavailableReason:D}=await UG(c);if(!R)return;if(B(),H){const se=!Y.current;Y.current=!0,p(!0),M(null),G.current=null,j.current=!1,P(!1),N.current?se&&(Te==null||Te.capture("preview_upstream_restored",{framework:t})):(N.current=!0,Te==null||Te.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-L})),$(i,ee);return}const q=Y.current;Y.current=!1,p(!1),M(D),G.current===null&&(G.current=Date.now(),j.current=!1,P(!1)),q&&(Te==null||Te.capture("preview_upstream_lost",{framework:t}),y(se=>se+1),aC.warn("Preview upstream became unavailable after it was ready"));const re=Date.now()-G.current;re>=a&&!j.current&&(j.current=!0,P(!0),Te==null||Te.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:re}),aC.warn("Dev server did not become ready within timeout window")),$(s,ee)};return n.current=()=>$(0,ee),$(0,ee),()=>{R=!1,n.current=null,X()}},[t,s,i,a,c,f]),g.useEffect(()=>{var L;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((L=n.current)==null||L.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:C,initialProbeComplete:T,unavailableReason:O}};function qG(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const iA=t=>{var e;return t!=="embedded"||typeof window>"u"?"":((e=window.__RIVET_BOOTSTRAP__)==null?void 0:e.previewOrigin)??`${window.location.protocol}//localhost:${window.location.port}`},oA=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${iA(t)}${e}`:e,YG="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",XG=t=>YG,QG=hs("PreviewSurface"),lC=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",aA=({target:t,src:e,framework:n,remountKey:r})=>(Xe(a0),S.jsx("div",{className:"relative h-full w-full",children:S.jsx("iframe",{src:e,className:"h-full w-full border-none",title:"Project Preview",sandbox:XG(),onLoad:()=>{Te==null||Te.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n}))},onError:()=>{Te==null||Te.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Te==null||Te.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:lC(e,t),framework:n})),QG.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),JG="modulepreload",eK=function(t){return"/"+t},uC={},tK=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));s=a(n.map(f=>{if(f=eK(f),f in uC)return;uC[f]=!0;const h=f.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":JG,h||(v.as="script"),v.crossOrigin="",v.href=f,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((y,x)=>{v.addEventListener("load",y),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return s.then(a=>{for(const u of a||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})},nK=g.lazy(()=>tK(()=>Promise.resolve().then(()=>OZ),void 0)),rK={surface:"relative flex h-full w-full items-center justify-center bg-main px-6",overlay:"absolute inset-0 z-10 flex items-center justify-center bg-main/90 px-6",page:"relative flex h-screen w-full items-center justify-center bg-main px-6"},sK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},iK={neutral:"rounded-md border border-divider bg-transparent px-5 py-2 text-sm font-medium text-content transition-colors hover:bg-surface-3",ghost:"rounded-md px-5 py-2 text-sm font-medium text-content-muted transition-colors hover:text-content"},xd=({backdrop:t,media:e,title:n,description:r,actions:s,tone:i="neutral",fill:a="surface",size:u="md",children:c,state:f,role:h="status",busy:p=!1,className:v=""})=>{const y=g.useCallback(_=>{_&&f&&(Te==null||Te.capture("status_surface_shown",{state:f,tone:i,fill:a}))},[f,i,a]),x=!!(e||n||r||c||s!=null&&s.length);return S.jsxs("div",{ref:y,className:`${rK[a]} ${v}`.trim(),role:h,"aria-live":"polite","aria-busy":p||void 0,"data-state":f,children:[t?S.jsx("div",{className:"absolute inset-0",children:t}):null,x?S.jsxs("div",{className:"relative z-10 flex max-w-sm flex-col items-center gap-5 text-center",children:[e,n?S.jsx("h2",{className:sK[u],children:n}):null,r?S.jsx("p",{className:"text-content-muted text-base leading-relaxed",children:r}):null,c,s!=null&&s.length?S.jsx("div",{className:"flex flex-row items-center gap-3",children:s.map(_=>S.jsx("button",{type:"button",onClick:_.onClick,className:iK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},wd=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(sA,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(xd,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(nK,{className:"absolute inset-0"})})}):S.jsx(xd,{...r,size:n,busy:!0,media:S.jsx(o0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),lA=({icon:t,...e})=>S.jsx(xd,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Tm=t=>S.jsx(xd,{...t,tone:"error",role:"alert"}),cC="/static/",oK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(cC)}catch{return t.endsWith(cC)}},aK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Xe(l_),a=st(l_),u=Xe(Sm),c=st(Sm),f=Xe(pf),h=Xe(a0),p=Xe(u_),v=Xe(c_),y=Xe(KT),x=Xe(ZT),_=st(c_),b=Xe(qo),E=Xe(f_),C=st(u_),P=f.active&&f.projectContext.kind==="fresh",T=Xe(d_),A=f.active?f.variants.find(je=>je.workItemId===T&&(je.status==="pending"||je.status==="running"||je.status==="succeeded"&&!je.preview&&typeof je.port!="number"&&!je.previewUnavailable))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),M=P||O,R=f.active?f.variants.find(je=>je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable)??null:null,L=e==="static"&&u!==null&&oK(u);g.useEffect(()=>{f.active||C(!1)},[f.active,C]);const N=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Qe=je&&!N.current;N.current=je;const lt=f.active?f.sessionId:null;!lt||!qG({enteringSplit:Qe,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(C(!1),_(null),a(Je=>Je+1),fetch(`/api/variants/${encodeURIComponent(lt)}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(()=>{}))},[b,f,p,v,C,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!L||!f.active)return null;const{stage:je,variants:Qe}=f,lt=je==="ready"||je==="degraded",Je=Qe.some(zt=>{var An,Xn;return((An=zt.refinement)==null?void 0:An.status)==="pending"||((Xn=zt.refinement)==null?void 0:Xn.status)==="running"});if(!lt&&!Je)return null;const vt=Qe.find(zt=>{var An;return zt.status==="succeeded"&&((An=zt.preview)==null?void 0:An.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[L,u,p,f])??u,G=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Qe;return((Qe=je.preview)==null?void 0:Qe.kind)==="static_artifact"&&V.startsWith(je.preview.url)})??null,[V,f]),Y=g.useMemo(()=>{if((E==null?void 0:E.previewKind)==="static")return{kind:"variant",sessionId:E.sessionId,variantId:E.variantId};if(!f.active)return bm;if(G)return{kind:"variant",sessionId:f.sessionId,variantId:G.workItemId};if(V){const Qe=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Qe!=null&&Qe[1]?decodeURIComponent(Qe[1]):null,Je=Qe!=null&&Qe[2]?decodeURIComponent(Qe[2]):null;if(lt===f.sessionId&&Je&&f.variants.some(zt=>zt.workItemId===Je))return{kind:"variant",sessionId:f.sessionId,variantId:Je};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(zt=>zt.workItemId===xn))return{kind:"variant",sessionId:f.sessionId,variantId:xn}}const je=!!(b!=null&&b.left||b!=null&&b.right);return(!je||P)&&!V&&p&&v&&f.variants.some(Qe=>Qe.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Qe=>Qe.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:bm},[E,G,f,p,v,V,b,P,T]),K=g.useRef(null);g.useEffect(()=>{var Je,vt;if(!G||((Je=G.preview)==null?void 0:Je.kind)!=="static_artifact"||((vt=G.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${G.workItemId}:${G.refinement.workItemId}`;if(K.current===je)return;K.current=je;const Qe=G.preview.url.includes("?")?"&":"?",lt=`${G.preview.url}${Qe}refinement=${encodeURIComponent(G.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,G,a,c,f]);const B=V!==null&&OW(V),X=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:ee,probeAttemptCount:H,initialProbeComplete:D}=ZG(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:X}),[q,re]=g.useState(()=>y&&$?i:null),se=g.useRef(null);g.useEffect(()=>{if(!y){se.current=null,re(null);return}if(q===i){se.current=null;return}const je=se.current;if(!je||je.remountKey!==i){se.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(se.current=null,re(i))},[q,i,y,H,$]);const ue=V!==null&&!B||$,ie=x||y&&q!==i||y&&!ue,ae=`${ee}:${i}`,me=r?`/try/${encodeURIComponent(r)}`:"",Se=eA(window.location.pathname),Re=e==="static"?`${me}/static${Se??"/"}`:`${me}${Se??"/"}`,Ke=iA(h);let it=null;V&&(it=oA({agentApplyMode:h,url:V}));const at=A||ie?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${Ke}${Re}`),It=!!A||!!R||!ue&&D;let mt=null;return ie?mt=S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=A.status==="succeeded"?S.jsx(wd,{fill:"overlay",loader:"spinner",state:"variant_building",title:"Starting preview",description:"Its preview server is starting up."}):S.jsx(wd,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Tm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):It&&(mt=M?S.jsx(lA,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Tm,{fill:"overlay",state:"preview_offline",title:"Preview isn't connected",description:"Rivet lost connection to your project.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]})),S.jsxs("div",{className:"relative h-full w-full",children:[mt,S.jsx(aA,{target:Y,src:at,framework:e,remountKey:ae})]})};function dC({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(qo),c=Xe(pf),f=Xe(a0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Zd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(C=>{if(!C)return null;const P={...C};return delete P[t],P.left||P.right?P:null})},[u,t,a,p]),y=g.useMemo(()=>({kind:"variant",sessionId:e,variantId:n}),[e,n]),x=g.useMemo(()=>!c.active||c.sessionId!==e?null:c.variants.find(C=>C.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let C=r;if(((P=x==null?void 0:x.preview)==null?void 0:P.kind)==="static_artifact"&&((T=x.refinement)==null?void 0:T.status)==="succeeded"){const A=x.preview.url.includes("?")?"&":"?";C=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return oA({agentApplyMode:f,url:C})},[f,x,r]),b=((E=x==null?void 0:x.refinement)==null?void 0:E.status)==="succeeded"?`${n}:${x.refinement.workItemId}`:n;return S.jsxs("div",{className:"variant-split-secondary","data-cy":"variant-split-pane","data-variant-id":n,children:[S.jsxs("div",{className:"variant-split-secondary-toolbar",children:[S.jsx("span",{className:"variant-split-secondary-label",title:s,children:s}),S.jsx(Fo,{label:"Collapse",children:S.jsx("button",{type:"button",className:"variant-split-secondary-close",onClick:v,"aria-label":"Collapse split view",children:S.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",children:S.jsx("path",{d:"M2.5 2.5 L9.5 9.5 M9.5 2.5 L2.5 9.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})})})]}),S.jsx("div",{className:"variant-split-secondary-body relative min-h-0 flex-1",children:S.jsx(aA,{target:y,src:_,framework:"static",remountKey:b})})]})}const fC=240;function lK(){const t=Xe(Wd),e=Xe(X2),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-fC/2,s=e.y-22;n.current.style.transform=`translate3d(${r}px, ${s}px, 0)`},[t,e]),!t||!e?null:S.jsx("div",{ref:n,"aria-hidden":"true",className:"variant-drag-ghost",style:{width:fC},children:S.jsxs("div",{className:"variant-drag-ghost-body",children:[S.jsxs("div",{className:"variant-drag-ghost-row",children:[S.jsx("div",{className:"variant-drag-ghost-title",children:t.label}),t.runLabel?S.jsx("div",{className:"variant-drag-ghost-tag",style:DT(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function uK(){const t=Xe(Wd),e=Xe(X2),n=Xe(qo),r=st(Wd),s=st(qo),i=g.useRef(null),[a,u]=g.useState(null),[c,f]=g.useState("hidden");g.useEffect(()=>{if(!t){f("hidden"),u(null);return}const v=requestAnimationFrame(()=>f("visible"));return()=>cancelAnimationFrame(v)},[t]);const h=g.useCallback((v,y)=>{const x=i.current;if(!x)return null;const _=x.getBoundingClientRect();return v<_.left||v>_.right||y<_.top||y>_.bottom?null:v<(_.left+_.right)/2?"left":"right"},[]);if(g.useEffect(()=>{if(!t||!e)return;const v=h(e.x,e.y);u(y=>y===v?y:v)},[t,e,h]),g.useEffect(()=>{if(!t)return;const v=y=>{const x=h(y.clientX,y.clientY);if(x&&t.url){const _={sessionId:t.sessionId,variantId:t.variantId,label:t.label,url:t.url,source:t.source},b=n==null?void 0:n[x];b&&(b.sessionId!==_.sessionId||b.variantId!==_.variantId)&&Zd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Zd(t),f("exiting"),window.setTimeout(()=>r(null),220)};return window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v),()=>{window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)}},[t,h,r,s,n]),!t)return null;const p=["variant-drop-zones",c==="visible"&&"is-visible",c==="exiting"&&"is-exiting"].filter(Boolean).join(" ");return S.jsxs("div",{ref:i,className:p,"aria-hidden":"true",children:[S.jsx(hC,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(hC,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function hC({side:t,hovered:e,canDrop:n,label:r}){return S.jsxs("div",{className:["variant-drop-zone",`is-${t}`,e&&"is-hover",!n&&"is-disabled"].filter(Boolean).join(" "),children:[S.jsxs("div",{className:"variant-drop-zone-inner",children:[S.jsx("div",{className:`variant-drop-zone-icon is-${t}`}),S.jsx("div",{className:"variant-drop-zone-caption",children:n?`Add ${t} split`:"Split unavailable for this direction"})]}),S.jsx("div",{className:"variant-drop-zone-preview","aria-hidden":"true",children:S.jsx("div",{className:"variant-drop-zone-preview-label",children:r})}),S.jsx("div",{className:"variant-drop-zone-border"})]})}const uA=(t,e,n)=>{var i,a;if(!t.active||t.sessionId!==e)return null;const r=t.variants.find(u=>u.workItemId===n);if(((i=r==null?void 0:r.preview)==null?void 0:i.kind)!=="static_artifact")return null;if(((a=r.refinement)==null?void 0:a.status)!=="succeeded")return r.preview.url;const s=r.preview.url.includes("?")?"&":"?";return`${r.preview.url}${s}refinement=${encodeURIComponent(r.refinement.workItemId)}`},pC=(t,e)=>{if(!t)return;const n=uA(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},cK=()=>S.jsx("div",{"data-testid":"preview-boot-skeleton",role:"status","aria-busy":"true","aria-label":"Loading preview",className:"bg-main flex h-full min-h-0 w-full flex-1 flex-col p-3",children:S.jsx("div",{className:"border-main-border relative min-h-0 flex-1 overflow-hidden rounded-lg border",children:S.jsx(sA,{trackGlobalLoaderCount:!1})})}),dK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=TG();return g.useEffect(()=>{i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})},[i]),a?r?S.jsx("div",{className:"bg-main flex h-full min-h-0 w-full flex-1","aria-busy":"true"}):S.jsx(cK,{}):u||!s?S.jsx(Tm,{fill:"surface",size:"sm",state:"preview_config_error",title:"Couldn't load preview",description:"We couldn't load the preview configuration.",actions:[{label:"Retry",onClick:()=>{Te==null||Te.capture("preview_config_retry_clicked"),i().catch(c=>{Te==null||Te.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(fK,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function fK(t){const e=Xe(qo),n=Xe(Wd),r=Xe(pf),s=Xe(Sm),i=e==null?void 0:e.left,a=e==null?void 0:e.right,u=g.useMemo(()=>{var A,O;if(!r.active||r.projectContext.kind!=="fresh"||!(!!i!=!!a))return;const _=(A=i??a)==null?void 0:A.variantId,b=r.variants.filter(M=>{var R;return M.status==="succeeded"&&((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(M=>{var R;return((R=M.preview)==null?void 0:R.kind)==="static_artifact"&&M.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=uA(r,r.sessionId,P.workItemId);if(T)return{sessionId:r.sessionId,variantId:P.workItemId,label:P.label,url:T,source:"live"}},[r,i,a,s]),c=pC(i,r)??(a?u:void 0),f=pC(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(aK,{isInteractionDisabled:t.isInteractionDisabled,framework:t.framework,userPort:t.userPort,activeDemoSessionId:t.activeDemoSessionId,holdPreviewNavigation:t.holdHostedTryoutPreviewNavigation});return S.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 flex-col",children:S.jsxs("div",{className:`variant-preview-region relative flex h-full min-h-0 w-full flex-1 flex-col ${n?"is-dragging":""} ${v?"is-split":""}`,children:[S.jsxs("div",{className:"variant-preview-row flex h-full min-h-0 w-full flex-1",children:[c&&S.jsx(dC,{side:"left",sessionId:c.sessionId,variantId:c.variantId,url:c.url,label:c.label,source:c.source,isFallback:h},`left-${c.sessionId}:${c.variantId}:${c.url}`),!(c&&f)&&S.jsx("div",{className:"variant-preview-primary flex h-full min-h-0 flex-1 flex-col",children:y}),f&&S.jsx(dC,{side:"right",sessionId:f.sessionId,variantId:f.variantId,url:f.url,label:f.label,source:f.source,isFallback:p},`right-${f.sessionId}:${f.variantId}:${f.url}`)]}),S.jsx("div",{className:"variant-preview-atmosphere","aria-hidden":"true"}),S.jsx(uK,{}),S.jsx(lK,{})]})})}const cA=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(o0,{className:"h-4 w-4 shrink-0 animate-spin text-primary",weight:"bold"}):null,S.jsx("span",{className:"whitespace-pre-wrap font-sans",children:t})]});function ji(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dA(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
112
112
  * GSAP 3.15.0
113
113
  * https://gsap.com
114
114
  *
@@ -416,4 +416,4 @@ ${D}`:D)},onPointerDown:de=>de.stopPropagation(),className:"text-content-muted h
416
416
  <body>
417
417
  <div class="panel">${UC}</div>
418
418
  </body>
419
- </html>`,_Q="Too many people are trying Rivet right now. Please try again in a few minutes.",oI="Failed to start an isolated demo session.",xQ=async t=>{if(t.status===429)return _Q;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return oI},$_=274,Vm=395,C1=Math.min(Vm,Math.round(($_+Vm)/2*1.1)),WC="rivet:panelWidth:v2",wQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},bQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:f=!1})=>{const h=Xe(WT)>0,[p,v]=Q6(UT),y=jV(),[x,_]=g.useState(()=>{if(typeof window>"u")return C1;const Y=Number(window.localStorage.getItem(WC));return Number.isFinite(Y)&&Y>=$_&&Y<=Vm?Y:C1}),[b,E]=g.useState(!1),[C,P]=g.useState(YZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>qZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(WC,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=K=>{K.key==="Escape"&&(wQ(K.target)||(K.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const M=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const K=Y.clientX,B=x;E(!0);const X=ee=>{const H=Math.min(Vm,Math.max($_,B+(ee.clientX-K)));_(H)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(C1),[]),L=uq(),N=Xe(mf);fq({enabled:!N});const j=L.isProcessing?"Completing authentication...":a,V=j!==null,G=st(YT);return g.useEffect(()=>{G(t??null)},[t,G]),g.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(sl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(DZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(aR,{isSigningIn:s||V,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(dK,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(cA,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!f&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?x:0},children:S.jsxs(sl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-x},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&O(!0)},style:{width:x,willChange:"transform"},children:[S.jsx(CG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:M,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${b?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),b&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(JZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:C,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(d$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},H_="rivet_connect_deep_link",SQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(H_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(H_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},EQ=SQ(),kQ=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Mp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(EQ);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Mp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=aq(),p=st(mf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[C,P]=g.useState(!1),[T,A]=g.useState(null),[O,M]=g.useState(!1),R=g.useRef(!1),L=g.useRef(!1),N=pQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,V=N??T??j,G=g.useMemo(()=>cQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V]),Y=g.useMemo(()=>uQ({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,f,N,T,j]);g.useLayoutEffect(()=>{if(!Y){M(!1);return}M(!0)},[Y]);const K=O,B=g.useMemo(()=>dQ(K),[K]),X=(u==null?void 0:u.demoMode)===!0&&K,$=g.useRef(null);$.current=V;const ee=g.useCallback(async()=>{if(!R.current)return;A(null);const me=await c();if((me==null?void 0:me.demoMode)===!0&&me.agentModeAvailable!==!0){P(!1);return}(me==null?void 0:me.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return iQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const me=window.fetch.bind(window);return lQ({nativeFetch:me,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),g.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const H=g.useCallback(async me=>{const Se=$.current;if(!(me!=null&&me.forceRefresh)&&Se)return Se;if(L.current)return"";L.current=!0;try{const Re=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Re.ok){const it=await xQ(Re);throw new Error(it)}const Ke=await Re.json();if(!Ke.sessionId)throw new Error("Demo session response missing session id.");return A(Ke.sessionId),Ke.sessionId}finally{L.current=!1}},[]);g.useEffect(()=>{j&&A(j)},[j]),g.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const me=!!u.demoMode,Se=me?V:null;Te.register({source:me?"tryout":"core",demo_mode:me,...Se?{demo_session_id:Se}:{}})},[u,V]);const D=g.useCallback(async()=>{var Se;y(!0),_(null);let me=null;try{if(me=window.open("","_blank"),!me)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{me.document.open(),me.document.write(yQ),me.document.close()}catch(it){k1.warn("Failed to render loading state in auth popup:",it)}const Re=await fetch(`${BC}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),Ke=await Re.json();if(!Re.ok||!Ke.success||!Ke.authUrl||!Ke.sessionId||!Ke.pollSecret)throw new Error(Ke.error||Ke.message||"Failed to start Google login");if(me.closed)throw new Error("Sign-in window was closed before Google login started.");me.location.href=Ke.authUrl;for(let it=0;it<vQ;it+=1){if(me.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${BC}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:Ke.sessionId,pollSecret:Ke.pollSecret})})).json();if(at.success&&at.token&&((Se=at.user)!=null&&Se.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:at.user.email,token:at.token,refreshToken:at.refreshToken,userId:at.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(me.close(),window.sessionStorage.setItem(Mp,"1"),(u==null?void 0:u.demoMode)===!0){await H({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(at.error&&at.error!=="Pending")throw new Error(at.error||"Google login failed");await new Promise(It=>setTimeout(It,gQ))}throw new Error("Authentication timed out. Please try again.")}catch(Re){me&&!me.closed&&me.close();const Ke=Re instanceof Error?Re.message:"Failed to start login flow";k1.warn("Hosted login failed:",Ke),_(Ke),y(!1)}},[u==null?void 0:u.demoMode,H]),q=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||C||v),re=u!=null&&u.agentModeAvailable!==!0,se=mQ(t),oe=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let me=!1;return H({forceRefresh:!0}).catch(Se=>{const Re=Se instanceof Error?Se.message:oI;k1.warn("Hosted session bootstrap failed:",Re),_(Re),ht.error(Re)}).finally(()=>{me||M(!1)}),()=>{me=!0}},[Y,H]),g.useEffect(()=>{const me=()=>{const Se=window.location.hash;e(Se)};return window.addEventListener("hashchange",me),()=>window.removeEventListener("hashchange",me)},[]),se==="design-system")return S.jsx(tQ,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(hQ(ue)){const me=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:me}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{oe()},children:"Retry"})]})})}if(re)return S.jsx(aR,{isSigningIn:v,onStartSignIn:()=>{D()},errorMessage:x,displayMode:"full"});const ie=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ie;return S.jsxs(S.Fragment,{children:[S.jsx(bQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:G,showLoginGate:q,onStartLogin:D,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:K,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:X}),S.jsx(x_,{context:"onboarding",isOpen:ae,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ie,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(H_),a(null)}})]})},CQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",PQ=new vL,TQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},AQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});lD.createRoot(document.getElementById("root")).render(S.jsx(ve.StrictMode,{children:S.jsx(XN,{apiKey:CQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...TQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.13.1",env:"production"})}},children:S.jsx(nD,{fallback:S.jsx(AQ,{}),children:S.jsx(yL,{client:PQ,children:S.jsx(RW,{defaultShape:"rounded",children:S.jsx(kX,{defaultLibrary:"lucide",children:S.jsx(kQ,{})})})})})})}));
419
+ </html>`,_Q="Too many people are trying Rivet right now. Please try again in a few minutes.",oI="Failed to start an isolated demo session.",xQ=async t=>{if(t.status===429)return _Q;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return oI},$_=274,Vm=395,C1=Math.min(Vm,Math.round(($_+Vm)/2*1.1)),WC="rivet:panelWidth:v2",wQ=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},bQ=({projectPath:t,activeDemoSessionId:e=null,showLoginGate:n=!1,onStartLogin:r,isStartingLogin:s=!1,loginError:i=null,fullPageHostedLoginProgressMessage:a=null,holdHostedTryoutPreviewNavigation:u=!1,hostedTryoutPreviewHoldMessage:c=null,deferInspectorUntilPreviewReady:f=!1})=>{const h=Xe(WT)>0,[p,v]=Q6(UT),y=jV(),[x,_]=g.useState(()=>{if(typeof window>"u")return C1;const Y=Number(window.localStorage.getItem(WC));return Number.isFinite(Y)&&Y>=$_&&Y<=Vm?Y:C1}),[b,E]=g.useState(!1),[C,P]=g.useState(YZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>qZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(WC,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=K=>{K.key==="Escape"&&(wQ(K.target)||(K.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const M=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const K=Y.clientX,B=x;E(!0);const X=ee=>{const H=Math.min(Vm,Math.max($_,B+(ee.clientX-K)));_(H)},$=()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",X),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(C1),[]),L=uq(),N=Xe(mf);fq({enabled:!N});const j=L.isProcessing?"Completing authentication...":a,V=j!==null,G=st(YT);return g.useEffect(()=>{G(t??null)},[t,G]),g.useEffect(()=>{n&&(document.body.style.cursor="auto")},[n]),S.jsxs(sl.div,{className:"relative flex h-screen overflow-hidden",initial:!1,animate:{opacity:1},transition:{duration:.5,ease:"easeOut"},"data-cy":"rivet-app",children:[j!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(DZ,{message:j})}):null,n?S.jsx("div",{className:"absolute inset-0 z-40 flex items-center justify-center bg-black/45 backdrop-blur-[2px]",children:S.jsx(aR,{isSigningIn:s||V,onStartSignIn:()=>{r==null||r()},errorMessage:i,displayMode:"modal"})}):null,S.jsxs("div",{className:`relative flex min-w-0 flex-1 flex-col ${n?"pointer-events-none select-none":""}`,children:[S.jsx(dK,{holdHostedTryoutPreviewNavigation:u,isInteractionDisabled:n,activeDemoSessionId:e}),u&&c?S.jsx("div",{className:"bg-main absolute inset-0 z-30 flex items-center justify-center",children:S.jsx("div",{className:"border-divider bg-main-light rounded-lg border p-6 shadow-lg",children:S.jsx(cA,{message:c})})}):null]}),n?null:S.jsx(S.Fragment,{children:!f&&!h?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"relative order-first h-full flex-shrink-0",style:{width:A?x:0},children:S.jsxs(sl.div,{className:"absolute inset-y-0 left-0 z-30",initial:!1,animate:{x:p?0:-x},transition:y?{duration:0}:{duration:.2,ease:[.22,1,.36,1]},onAnimationComplete:()=>{p&&O(!0)},style:{width:x,willChange:"transform"},children:[S.jsx(CG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:M,onDoubleClick:R,className:"group/resize absolute inset-y-0 right-0 z-20 flex w-3 cursor-col-resize touch-none justify-end",children:S.jsx("span",{className:`h-full transition-all duration-150 ${b?"w-0.5 bg-content-muted":"w-px bg-divider group-hover/resize:w-0.5 group-hover/resize:bg-content-muted"}`})})]})}),b&&S.jsx("div",{className:"fixed inset-0 z-[100] cursor-col-resize"}),S.jsx(JZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:C,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(d$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},H_="rivet_connect_deep_link",SQ=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(H_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(H_,n),e){t.delete("connect");const r=t.toString();window.history.replaceState(null,document.title,window.location.pathname+(r?`?${r}`:"")+window.location.hash)}return n},EQ=SQ(),kQ=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Mp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(EQ);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Mp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=aq(),p=st(mf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[C,P]=g.useState(!1),[T,A]=g.useState(null),[O,M]=g.useState(!1),R=g.useRef(!1),L=g.useRef(!1),N=pQ(window.location.pathname),j=(u==null?void 0:u.activeDemoSessionId)??null,V=N??T??j,G=g.useMemo(()=>cQ(u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V),[u==null?void 0:u.demoMode,u==null?void 0:u.agentModeAvailable,V]),Y=g.useMemo(()=>uQ({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:N,activeDemoSessionId:T,configuredDemoSessionId:j}),[u,f,N,T,j]);g.useLayoutEffect(()=>{if(!Y){M(!1);return}M(!0)},[Y]);const K=O,B=g.useMemo(()=>dQ(K),[K]),X=(u==null?void 0:u.demoMode)===!0&&K,$=g.useRef(null);$.current=V;const ee=g.useCallback(async()=>{if(!R.current)return;A(null);const me=await c();if((me==null?void 0:me.demoMode)===!0&&me.agentModeAvailable!==!0){P(!1);return}(me==null?void 0:me.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return iQ(()=>{ee()})},[u==null?void 0:u.demoMode,ee]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const me=window.fetch.bind(window);return lQ({nativeFetch:me,pageOrigin:window.location.origin,getShouldIntercept:()=>R.current})},[u==null?void 0:u.demoMode]),g.useEffect(()=>{(u==null?void 0:u.agentModeAvailable)===!0&&P(!1)},[u==null?void 0:u.agentModeAvailable]);const H=g.useCallback(async me=>{const Se=$.current;if(!(me!=null&&me.forceRefresh)&&Se)return Se;if(L.current)return"";L.current=!0;try{const Re=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Re.ok){const it=await xQ(Re);throw new Error(it)}const Ke=await Re.json();if(!Ke.sessionId)throw new Error("Demo session response missing session id.");return A(Ke.sessionId),Ke.sessionId}finally{L.current=!1}},[]);g.useEffect(()=>{j&&A(j)},[j]),g.useEffect(()=>{u!=null&&u.userId?(Te.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Te.alias(u.email,u.userId)):u!=null&&u.email&&Te.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const me=!!u.demoMode,Se=me?V:null;Te.register({source:me?"tryout":"core",demo_mode:me,...Se?{demo_session_id:Se}:{}})},[u,V]);const D=g.useCallback(async()=>{var Se;y(!0),_(null);let me=null;try{if(me=window.open("","_blank"),!me)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{me.document.open(),me.document.write(yQ),me.document.close()}catch(it){k1.warn("Failed to render loading state in auth popup:",it)}const Re=await fetch(`${BC}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),Ke=await Re.json();if(!Re.ok||!Ke.success||!Ke.authUrl||!Ke.sessionId||!Ke.pollSecret)throw new Error(Ke.error||Ke.message||"Failed to start Google login");if(me.closed)throw new Error("Sign-in window was closed before Google login started.");me.location.href=Ke.authUrl;for(let it=0;it<vQ;it+=1){if(me.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${BC}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:Ke.sessionId,pollSecret:Ke.pollSecret})})).json();if(at.success&&at.token&&((Se=at.user)!=null&&Se.email)){if(!(await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:at.user.email,token:at.token,refreshToken:at.refreshToken,userId:at.user.id})})).ok)throw new Error("Signed in, but failed to store session locally.");if(me.close(),window.sessionStorage.setItem(Mp,"1"),(u==null?void 0:u.demoMode)===!0){await H({forceRefresh:!0}),window.location.reload();return}window.location.reload();return}if(at.error&&at.error!=="Pending")throw new Error(at.error||"Google login failed");await new Promise(It=>setTimeout(It,gQ))}throw new Error("Authentication timed out. Please try again.")}catch(Re){me&&!me.closed&&me.close();const Ke=Re instanceof Error?Re.message:"Failed to start login flow";k1.warn("Hosted login failed:",Ke),_(Ke),y(!1)}},[u==null?void 0:u.demoMode,H]),q=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||C||v),re=u!=null&&u.agentModeAvailable!==!0,se=mQ(t),oe=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let me=!1;return H({forceRefresh:!0}).catch(Se=>{const Re=Se instanceof Error?Se.message:oI;k1.warn("Hosted session bootstrap failed:",Re),_(Re),ht.error(Re)}).finally(()=>{me||M(!1)}),()=>{me=!0}},[Y,H]),g.useEffect(()=>{const me=()=>{const Se=window.location.hash;e(Se)};return window.addEventListener("hashchange",me),()=>window.removeEventListener("hashchange",me)},[]),se==="design-system")return S.jsx(tQ,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(hQ(ue)){const me=h||"Could not load Rivet configuration.";return S.jsx("div",{className:"bg-main flex h-screen items-center justify-center px-6",children:S.jsxs("div",{className:"border-divider bg-main w-full max-w-md rounded-lg border p-6 text-center shadow-lg",children:[S.jsx("p",{className:"text-content text-sm font-medium",children:"We could not start Rivet yet."}),S.jsx("p",{className:"text-content-dim mt-2 text-xs",children:me}),S.jsx("button",{type:"button",className:"border-divider text-content hover:bg-main/80 mt-4 rounded-md border px-3 py-1.5 text-xs",onClick:()=>{oe()},children:"Retry"})]})})}if(re)return S.jsx(aR,{isSigningIn:v,onStartSignIn:()=>{D()},errorMessage:x,displayMode:"full"});const ie=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ie;return S.jsxs(S.Fragment,{children:[S.jsx(bQ,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:G,showLoginGate:q,onStartLogin:D,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:K,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:X}),S.jsx(x_,{context:"onboarding",isOpen:ae,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ie,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(H_),a(null)}})]})},CQ="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",PQ=new vL,TQ={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},AQ=()=>S.jsx("div",{style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center"},children:S.jsx("p",{style:{fontSize:"14px",color:"#6b7280"},children:"Something went wrong. Please reload the page."})});lD.createRoot(document.getElementById("root")).render(S.jsx(ve.StrictMode,{children:S.jsx(XN,{apiKey:CQ,options:{api_host:"https://rivet-proxy.onrender.com/ingest",ui_host:"https://us.posthog.com",person_profiles:"always",capture_exceptions:!0,autocapture:!0,capture_pageview:!0,capture_performance:!0,persistence:"localStorage",...TQ,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.13.2",env:"production"})}},children:S.jsx(nD,{fallback:S.jsx(AQ,{}),children:S.jsx(yL,{client:PQ,children:S.jsx(RW,{defaultShape:"rounded",children:S.jsx(kX,{defaultLibrary:"lucide",children:S.jsx(kQ,{})})})})})})}));
@@ -7,7 +7,7 @@
7
7
  <link rel="icon" type="image/x-icon" href="/favicon.ico" />
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
9
9
  <title>Rivet - The visual editor for design</title>
10
- <script type="module" crossorigin src="/assets/main-B725ucb9.js"></script>
10
+ <script type="module" crossorigin src="/assets/main-BBHg643G.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/main-Dyos9I29.css">
12
12
  </head>
13
13
  <body>