rivet-design 0.14.1 → 0.14.3
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.
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +6 -0
- package/dist/cli/commands/mcpServe.js.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +18 -3
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/index.js +8 -12
- package/dist/index.js.map +1 -1
- package/dist/install/harnesses.d.ts +5 -4
- package/dist/install/harnesses.d.ts.map +1 -1
- package/dist/install/harnesses.js +76 -31
- package/dist/install/harnesses.js.map +1 -1
- package/dist/utils/loginShellPath.d.ts +25 -0
- package/dist/utils/loginShellPath.d.ts.map +1 -0
- package/dist/utils/loginShellPath.js +178 -0
- package/dist/utils/loginShellPath.js.map +1 -0
- package/package.json +1 -1
- package/src/ui/dist/assets/{main-C-8Mff7k.js → main-DiPNi-Yg.js} +55 -55
- package/src/ui/dist/index.html +1 -1
|
@@ -111,7 +111,7 @@ function useAtomValueWithDelay<Value>(
|
|
|
111
111
|
`);if(!t.reference)return e;const n=((a=t.projectPath)==null?void 0:a.trim())??"",r=n?` --project '${n.replace(/'/g,"'\\''")}'`:"",s=[`Rivet variant: ${t.reference}`,"To inspect the full variant context, run:",`rivet variants get ${t.reference}${r}`].join(`
|
|
112
112
|
`);return e?`${e}
|
|
113
113
|
|
|
114
|
-
${s}`:s},eG=({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,onCopyVariantContext:E,activeSessionId:k,projectPath:P})=>{const T=g.useRef(null),{activeIndex:A,itemRects:O,sessionRef:N,handlers:R,registerItem:M}=HT(T),L=(s==null?void 0:s.kind)==="switch",D=A!==null?O[A]:null;return S.jsxs("div",{ref:T,className:"relative",onMouseEnter:R.onMouseEnter,onMouseMove:R.onMouseMove,onMouseLeave:R.onMouseLeave,children:[S.jsx(Gi,{children:D&&S.jsx(sl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:D.top,left:D.left,width:D.width,height:D.height},animate:{opacity:1,top:D.top,left:D.left,width:D.width,height:D.height},exit:{opacity:0,transition:{duration:.06}},transition:{...Vd.fast,opacity:{duration:.08}}},N.current)}),S.jsx("ul",{className:"relative",children:t.map((V,K)=>{const Y=ZW(V);let G=!1;return V.kind==="active"?G=V.variant.workItemId===e:V.kind==="past"?G=`${V.entry.sessionId}:${V.entry.variantId}`===n:G=r,S.jsx(tG,{rowKey:Y,row:V,index:K,isSelected:G,isEditing:i===Y,isSwitchInFlight:L,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,onCopyVariantContext:E,activeSessionId:k,projectPath:P},Y)})})]})},tG=({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:k,onCopyVariantContext:P,activeSessionId:T,projectPath:A})=>{var Ce,ae;const O=g.useRef(null);hU(u,n,O);const N=e.kind==="active",R=e.kind==="original",M=e.kind==="active"?e.variant:null,L=e.kind==="past"?e.entry:null,D=N?M.status==="succeeded":!0,V=N?$a(M):!0,K=N?oR(M):!1,Y=N&&(M.status==="pending"||M.status==="running"),G=N?D&&(V||K)||Y:!0,B=N&&M.status==="failed",Q=N&&M.status==="cancelled",$=N&&(!G||i),te=N&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,H=N&&(((Ce=M.refinement)==null?void 0:Ce.status)==="pending"||((ae=M.refinement)==null?void 0:ae.status)==="running");let j=gx;N?j=M.label||`Direction ${n+1}`:L&&(j=L.label.trim()||"Untitled direction");let Z;N?Z=M.runLabel:L&&(Z=L.runLabel);let ee=vx;N?ee=M.description:L&&(ee=L.brief);const ie=ee?QW(ee):null,le=XW(e,T),ue=le?"Copy variant reference":"Copy description";return s?S.jsx("li",{ref:O,"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(nG,{initial:j,onCommit:se=>E(e,se),onCancel:k}),ie&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:ie})]})})}):S.jsxs("li",{ref:O,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:G?0:-1,"data-variant-id":N?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if($)return;const se=window.getSelection();se&&!se.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onKeyDown:se=>{$||(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onPointerDown:se=>{$||(e.kind==="active"?D&&p(e.variant.workItemId,se):e.kind==="past"&&v(e.entry,se))},"aria-pressed":G?r:void 0,"aria-disabled":N?!G:void 0,"aria-busy":Y||H,onMouseEnter:N?()=>y(M.workItemId):void 0,onMouseLeave:N?()=>y(null):void 0,className:ar("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",D&&V&&"cursor-grab active:cursor-grabbing",(Y||K)&&"cursor-pointer",!D&&!Y&&!K&&"cursor-not-allowed opacity-60",$&&"cursor-not-allowed opacity-50"),style:D?{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:[(Y||H)&&S.jsx(tx,{className:"text-content-muted shrink-0 text-sm","data-testid":H&&!Y?"variant-refining":void 0}),S.jsx(Fo,{label:"Double-click to rename",disabled:R,children:S.jsx("span",{onDoubleClick:se=>{se.stopPropagation(),R||b(t)},className:ar("min-w-0 flex-1 truncate text-sm font-medium select-text",R?"cursor-default":"cursor-text",D||r?"text-content":"text-content-muted"),children:j})}),B&&S.jsx(YC,{label:"Failed"}),Q&&S.jsx(YC,{label:"Cancelled"}),Z&&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:$T(Z),children:Z})]}),ie&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:ie})]})}),S.jsxs("div",{className:ar("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:[ee||le?S.jsx(Fo,{label:ue,children:S.jsx("button",{type:"button","aria-label":ue,onClick:se=>{se.stopPropagation(),P(JW({label:j,description:ee,reference:le,projectPath:A}))},onPointerDown:se=>se.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(Fd,{size:13,weight:"bold"})})}):null,!R&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:se=>{se.stopPropagation(),b(t)},onPointerDown:se=>se.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(vz,{size:13,weight:"bold"})})}),!R&&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:te,onClick:se=>{se.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:se=>se.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(xz,{size:13,weight:"bold"})})})]})]})},nG=({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"})},YC=({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}),rG=({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(Fd,{size:12,weight:"bold"}):null,a]})]})},sG={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},iG={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},oG=({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(aG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},aG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=iG[t.kind],s=t.source?sG[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(fz,{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(lG,{artifact:t})}):null]})},lG=({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]}),uG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var N,R,M,L;const p=t?((R=(N=t.actions)==null?void 0:N.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(U5,{primaryLabel:P,primaryIcon:h&&!x?Fd: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&&!_?Fd:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(L=(M=t==null?void 0:t.actions)==null?void 0:M.commit)==null?void 0:L.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]})]})},aR=()=>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(tx,{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"})})]})}),cG=({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(aR,{},`${e.requestId}-${r}`)))}),dG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(aR,{},e))}),fG=()=>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."})]}),QC="Try different ways to create a dropdown that feels fluid and dynamic",hG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=VU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(QC).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:["“",QC,"”"]}),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(fT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx(Fd,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},pG=({onClose:t})=>{const e=Je(qT);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(yz,{className:"h-4 w-4",weight:"bold"})})})]}):null},mG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',gG=({itemSelector:t=mG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=jU():((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}},XC="/assets/arena-Db0j1set.png",vG=ds("useIntegrations"),JC=["integrations"],yG="rivet:connect-result",_G=t=>typeof t=="object"&&t!==null&&t.type===yG,xG=tt(null),wG=()=>{const t=f8(),[e,n]=nP(xG),r=U1({queryKey:JC,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:JC}),[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=_=>{_G(_.data)&&_.data.provider===u&&(_.data.status==="error"&&vG.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}},fu=({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(mx,{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},ek=ds("ConnectorsModal"),bG=()=>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"})}),SG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${XC})`,maskImage:`url(${XC})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),EG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(bG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(SG,{})}],CG=({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(fT,{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}=wG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const k=E instanceof Error?E.message:"Could not connect.";ek.warn(`Connect error for ${b}:`,k),ht.error(k)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const k=E instanceof Error?E.message:"Could not disconnect.";ek.warn(`Disconnect error for ${b}:`,k),ht.error(k)})},[f]),_=n==="onboarding";return S.jsx(Qm,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(Xm,{children:[S.jsx(Jm,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(e0,{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(nR,{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(t0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(fu,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(ET,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(n0,{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:EG.map(b=>S.jsx(CG,{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]})]})})]})})},tk=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),kG=ds("SupportTicketModal"),nk=5e3,f1="feedback",PG=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},TG=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=PG(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}`},RG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=nD(),[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,k=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:f1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:k??void 0,appVersion:"0.14.1",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await TG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:f1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const k=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:f1,error:k}),kG.error("Failed to submit support ticket:",k),ht.error("Could not send feedback",{description:k})}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=nk-s.length,_=a||s.trim().length===0;return S.jsx(Qm,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(Xm,{children:[S.jsx(Jm,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(e0,{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(nR,{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(t0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(fu,{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(ET,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(n0,{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:nk,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(fu,{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(r0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(hz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},AG=ds("ProfileAvatar"),lR=(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):""},IG=(t,e)=>lR(t,e).charAt(0).toUpperCase(),MG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Je(YT),i=Je(n5),a=Je(t5),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=gG(),E=Je(pf),k=IG(r,s);if(!k)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(tk,{className:"h-7 w-7 rounded-full"}),S.jsx(tk,{className:"h-3 w-16"})]}):null;const P=lR(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const N=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!N.ok)throw new Error(`Logout failed: ${N.status}`)}catch(N){AG.warn("Logout request failed",N),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(V5,{open:u,onOpenChange:c,children:[S.jsx($5,{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:k}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(H5,{children:S.jsxs(z5,{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(wT,{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(mz,{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(_z,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(RG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},NG=({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(pG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(GW,{})}),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(MG,{side:"top",align:"start"})})]}),OG=ds("useServerConfig"),LG=()=>{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),OG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},DG="#1C1C20",Ai=[118,118,124],rk=.85,jG=3,FG=.15,Jh=36,VG=4.4,$G=.7,HG=3.5,zG=.8,sk=9,UG=11,BG=[1.35,1.12,.95,.85],WG=[0,1.1,2.3,3.1],GG=[0,.35,.16,.13],KG=[.9,.5,.4,.35],Aa=3,h1=[[{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}]],ep=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},Ep=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,qG=Math.sin(Math.PI/3),ik=(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*qG;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)-sk}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)-sk}return Ep(.5-r/(2*UG))},uR=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(ZT),r=g.useRef(null),s=g.useCallback(i=>{var L;if((L=r.current)==null||L.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(D=>D+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=Jh,v=Jh,y=null,x=null,_=0,b=-1;const E=new Array(33),k=D=>{const V=Math.round(D*32);let K=E[V];if(!K){const Y=V/32,G=Math.round(Ai[0]+(255-Ai[0])*Y),B=Math.round(Ai[1]+(255-Ai[1])*Y),Q=Math.round(Ai[2]+(255-Ai[2])*Y);K=`rgba(${G}, ${B}, ${Q}, ${rk})`,E[V]=K}return K},P=D=>{const V=1-.35*D,K=Math.round(Ai[0]*V),Y=Math.round(Ai[1]*V),G=Math.round(Ai[2]*V);return`rgba(${K}, ${Y}, ${G}, ${rk})`},T=D=>{let V=Math.floor(Math.random()*h1.length);V===b&&(V=(V+1)%h1.length),b=V;const K=[0,0,0,0],Y=h1[V].map((j,Z)=>{const ee=j.level,ie=K[ee]++,le=WG[ee]+ie*GG[ee],ue=KG[ee]+ep(V*131+Z*17+5)*.2;if(j.hline){const se=Ia((j.y??0)*h,v);return{hline:!0,x1:Ia(j.x1*f,p),x2:Ia(j.x2*f,p),y1:se,y2:se,level:ee,start:le,dur:ue}}const Ce=Ia(j.x1*f,p),ae=Ia((j.y1??0)*h,v);return{hline:!1,x1:Ce,y1:ae,x2:Math.max(Ia(j.x2*f,p),Ce+p),y2:Math.max(Ia((j.y2??0)*h,v),ae+v),level:ee,start:le,dur:ue}}),G=Y.reduce((j,Z)=>Math.max(j,Z.start+Z.dur),0),B=c.length,Q=new Float32Array(B*Aa),$=new Int16Array(B*Aa).fill(-1),te=new Uint8Array(B),H=Y[0];for(let j=0;j<B;j++){const Z=c[j];Z.x>H.x1&&Z.x<H.x2&&Z.y>H.y1&&Z.y<H.y2&&(te[j]=1);const ee=j*Aa;for(let ie=0;ie<Y.length;ie++){const le=ZG(Z.x,Z.y,Y[ie]);if(le<=.02)continue;let ue=ee;for(let Ce=ee;Ce<ee+Aa;Ce++){if($[Ce]===-1){ue=Ce;break}Q[Ce]<Q[ue]&&(ue=Ce)}($[ue]===-1||le>Q[ue])&&(Q[ue]=le,$[ue]=ie)}}return{startT:D,buildEnd:G,els:Y,frame:H,cellQ:Q,cellEl:$,inFrame:te}},A=()=>{const D=i.getBoundingClientRect();f=Math.max(1,D.width),h=Math.max(1,D.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 K=Math.max(8,Math.round(f/Jh)),Y=Math.max(6,Math.round(h/Jh));p=f/K,v=h/Y,c=[];for(let G=0;G<Y;G++){const B=Y>1?G/(Y-1):.5,Q=VG*(1+$G*.4*(B*2-1));for(let $=0;$<K;$++){const te=G*8191+$*131+1,H={x:($+.5)*p,y:(G+.5)*v,size:Q,seed:te,phase:ep(te),kind:0};H.kind=Math.floor(ep(te*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),N=D=>{a.fillStyle=DG,a.fillRect(0,0,f,h),y||(y=T(D+.2)),D>=y.startT+y.buildEnd+HG&&(x=y,_=D,y=T(D+.2));let V=0;x&&(V=1-Ep((D-_)/zG),V<=0&&(x=null));const K=y;for(let H=0;H<K.els.length;H++){const j=K.els[H];O[H]=Ep(Math.min(1,Math.max(0,(D-K.startT-j.start)/j.dur)))}const Y=O[0],G=P(0),B=P(Y),Q=V>0?P(V):G,$=V>0?P(Math.max(Y,V)):B,te=c.length;for(let H=0;H<te;H++){const j=c[H];let Z=0,ee=0;const ie=H*Aa;for(let we=ie;we<ie+Aa;we++){const Ie=K.cellEl[we];if(Ie<0)break;const qe=K.cellQ[we]*O[Ie];qe>Z&&(Z=qe,ee=K.els[Ie].level)}if(x)for(let we=ie;we<ie+Aa;we++){const Ie=x.cellEl[we];if(Ie<0)break;const qe=x.cellQ[we]*V;qe>Z&&(Z=qe,ee=x.els[Ie].level)}const le=D/jG+j.phase,ue=Math.floor(le),Ce=le-ue,ae=Ep(Math.min(Ce,1-Ce)/FG),se=Math.floor(ep(j.seed*97+ue*7919)*3);se!==j.kind&&Z<.02&&ae<.05&&(j.kind=se);const pe=Math.max(ae*(1-Z),Z);if(!(pe<.01))if(Z<.02){const we=K.inFrame[H]===1,Ie=x?x.inFrame[H]===1:!1;we?a.fillStyle=Ie?$:B:a.fillStyle=Ie?Q:G;const qe=Math.max(we?Y:0,Ie?V:0);ik(a,j.kind,j.x,j.y,j.size*pe*(1-.2*qe))}else{a.fillStyle=k(Z);const we=1+(BG[ee]-1)*Z;ik(a,j.kind,j.x,j.y,j.size*pe*we)}}};A();let R=0;if(u)y=T(-100),N(0);else{const D=performance.now(),V=K=>{N((K-D)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const M=new ResizeObserver(()=>{A(),u&&(y=T(-100),N(0))});M.observe(i),r.current=()=>{cancelAnimationFrame(R),M.disconnect(),e&&n(D=>D-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},YG=async(t=null)=>{if(t)return QG(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 tp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return tp()}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"}:tp()},QG=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"}}},tp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},ok=ds("usePreviewUpstreamHealth"),XG=500,JG=4e3,eK=15e3,tK=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??XG,i=e.probeMsWhileUp??JG,a=e.firstUnreachableCaptureAfterMs??eK,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),[k,P]=g.useState(!1),[T,A]=g.useState(!1),[O,N]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),N(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),N("upstream_unreachable"),n.current=null;return}let R=!0;const M=Date.now();_(M),E(0),P(!1),p(!1),A(!1),N("upstream_unreachable");const L={current:!1},D={current:!1},V={current:!1},K={current:null},Y={current:!1};let G=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},Q=()=>{G!==null&&(clearTimeout(G),G=null)},$=(H,j)=>{Q(),G=setTimeout(j,H)},te=async()=>{if(!R)return;E(ie=>ie+1);const{isOk:H,unavailableReason:j}=await YG(c);if(!R)return;if(B(),H){const ie=!Y.current;Y.current=!0,p(!0),N(null),K.current=null,D.current=!1,P(!1),L.current?ie&&(Pe==null||Pe.capture("preview_upstream_restored",{framework:t})):(L.current=!0,Pe==null||Pe.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-M})),$(i,te);return}const Z=Y.current;Y.current=!1,p(!1),N(j),K.current===null&&(K.current=Date.now(),D.current=!1,P(!1)),Z&&(Pe==null||Pe.capture("preview_upstream_lost",{framework:t}),y(ie=>ie+1),ok.warn("Preview upstream became unavailable after it was ready"));const ee=Date.now()-K.current;ee>=a&&!D.current&&(D.current=!0,P(!0),Pe==null||Pe.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:ee}),ok.warn("Dev server did not become ready within timeout window")),$(s,te)};return n.current=()=>$(0,te),$(0,te),()=>{R=!1,n.current=null,Q()}},[t,s,i,a,c,f]),g.useEffect(()=>{var M;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((M=n.current)==null||M.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:k,initialProbeComplete:T,unavailableReason:O}};function nK(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const cR=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}`},dR=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${cR(t)}${e}`:e,rK="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",sK=t=>rK,iK=ds("PreviewSurface"),ak=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",fR=({target:t,src:e,framework:n,remountKey:r})=>(Je(s0),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:sK(),onLoad:()=>{Pe==null||Pe.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Pe==null||Pe.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:ak(e,t),framework:n}))},onError:()=>{Pe==null||Pe.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Pe==null||Pe.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:ak(e,t),framework:n})),iK.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),oK="modulepreload",aK=function(t){return"/"+t},lk={},lK=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=aK(f),f in lk)return;lk[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":oK,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)})},uK=g.lazy(()=>lK(()=>Promise.resolve().then(()=>Hq),void 0)),cK={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"},dK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},fK={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"},_d=({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&&(Pe==null||Pe.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:`${cK[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:dK[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:fK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},w_=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(_d,{...r,size:n,busy:!0,backdrop:S.jsx(uR,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(_d,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(uK,{className:"absolute inset-0"})})}):S.jsx(_d,{...r,size:n,busy:!0,media:S.jsx(r0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),hR=({icon:t,...e})=>S.jsx(_d,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Cm=t=>S.jsx(_d,{...t,tone:"error",role:"alert"}),uk="/static/",hK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(uk)}catch{return t.endsWith(uk)}},pK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Je(u_),a=st(u_),u=Je(xm),c=st(xm),f=Je(hf),h=Je(s0),p=Je(c_),v=Je(d_),y=Je(QT),x=Je(XT),_=st(d_),b=Je(Zo),E=Je(h_),k=st(c_),P=f.active&&f.projectContext.kind==="fresh",T=Je(f_),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||je.previewUnavailable.reason==="idle_timeout")))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),N=P||O,R=f.active?f.variants.find(je=>{var Ye;return je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable&&((Ye=je.previewUnavailable)==null?void 0:Ye.reason)!=="idle_timeout"})??null:null,M=e==="static"&&u!==null&&hK(u);g.useEffect(()=>{f.active||k(!1)},[f.active,k]);const L=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Ye=je&&!L.current;L.current=je;const lt=f.active?f.sessionId:null;!lt||!nK({enteringSplit:Ye,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(k(!1),_(null),a(Xe=>Xe+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,k,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!M||!f.active)return null;const{stage:je,variants:Ye}=f,lt=je==="ready"||je==="degraded",Xe=Ye.some(Ut=>{var Rn,Hn;return((Rn=Ut.refinement)==null?void 0:Rn.status)==="pending"||((Hn=Ut.refinement)==null?void 0:Hn.status)==="running"});if(!lt&&!Xe)return null;const vt=Ye.find(Ut=>{var Rn;return Ut.status==="succeeded"&&((Rn=Ut.preview)==null?void 0:Rn.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[M,u,p,f])??u,K=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Ye;return((Ye=je.preview)==null?void 0:Ye.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 _m;if(K)return{kind:"variant",sessionId:f.sessionId,variantId:K.workItemId};if(V){const Ye=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Ye!=null&&Ye[1]?decodeURIComponent(Ye[1]):null,Xe=Ye!=null&&Ye[2]?decodeURIComponent(Ye[2]):null;if(lt===f.sessionId&&Xe&&f.variants.some(Ut=>Ut.workItemId===Xe))return{kind:"variant",sessionId:f.sessionId,variantId:Xe};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(Ut=>Ut.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(Ye=>Ye.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Ye=>Ye.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:_m},[E,K,f,p,v,V,b,P,T]),G=g.useRef(null);g.useEffect(()=>{var Xe,vt;if(!K||((Xe=K.preview)==null?void 0:Xe.kind)!=="static_artifact"||((vt=K.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${K.workItemId}:${K.refinement.workItemId}`;if(G.current===je)return;G.current=je;const Ye=K.preview.url.includes("?")?"&":"?",lt=`${K.preview.url}${Ye}refinement=${encodeURIComponent(K.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,K,a,c,f]);const B=V!==null&&VW(V),Q=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:te,probeAttemptCount:H,initialProbeComplete:j}=tK(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:Q}),[Z,ee]=g.useState(()=>y&&$?i:null),ie=g.useRef(null);g.useEffect(()=>{if(!y){ie.current=null,ee(null);return}if(Z===i){ie.current=null;return}const je=ie.current;if(!je||je.remountKey!==i){ie.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(ie.current=null,ee(i))},[Z,i,y,H,$]);const ue=V!==null&&!B||$,ae=x||y&&Z!==i||y&&!ue,se=`${te}:${i}`,pe=r?`/try/${encodeURIComponent(r)}`:"",we=sR(window.location.pathname),Ie=e==="static"?`${pe}/static${we??"/"}`:`${pe}${we??"/"}`,qe=cR(h);let it=null;V&&(it=dR({agentApplyMode:h,url:V}));const at=A||ae?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${qe}${Ie}`),At=!!A||!!R||!ue&&j;let mt=null;return ae?mt=S.jsx(w_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=S.jsx(w_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Cm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):At&&(mt=N?S.jsx(hR,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Cm,{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(fR,{target:Y,src:at,framework:e,remountKey:se})]})};function ck({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(Zo),c=Je(hf),f=Je(s0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Kd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(k=>{if(!k)return null;const P={...k};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(k=>k.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let k=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("?")?"&":"?";k=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return dR({agentApplyMode:f,url:k})},[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(fR,{target:y,src:_,framework:"static",remountKey:b})})]})}const dk=240;function mK(){const t=Je(Ud),e=Je(ex),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-dk/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:dk},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:$T(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function gK(){const t=Je(Ud),e=Je(ex),n=Je(Zo),r=st(Ud),s=st(Zo),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)&&Kd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Kd(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(fk,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(fk,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function fk({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 pR=(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)}`},hk=(t,e)=>{if(!t)return;const n=pR(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},vK=()=>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(uR,{trackGlobalLoaderCount:!1})})}),yK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=LG();return g.useEffect(()=>{i().catch(c=>{Pe==null||Pe.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(vK,{}):u||!s?S.jsx(Cm,{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:()=>{Pe==null||Pe.capture("preview_config_retry_clicked"),i().catch(c=>{Pe==null||Pe.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(_K,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function _K(t){const e=Je(Zo),n=Je(Ud),r=Je(hf),s=Je(xm),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(N=>{var R;return N.status==="succeeded"&&((R=N.preview)==null?void 0:R.kind)==="static_artifact"&&N.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(N=>{var R;return((R=N.preview)==null?void 0:R.kind)==="static_artifact"&&N.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=pR(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=hk(i,r)??(a?u:void 0),f=hk(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(pK,{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(ck,{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(ck,{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(gK,{}),S.jsx(mK,{})]})})}const mR=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(r0,{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 gR(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
|
|
114
|
+
${s}`:s},eG=({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,onCopyVariantContext:E,activeSessionId:k,projectPath:P})=>{const T=g.useRef(null),{activeIndex:A,itemRects:O,sessionRef:N,handlers:R,registerItem:M}=HT(T),L=(s==null?void 0:s.kind)==="switch",D=A!==null?O[A]:null;return S.jsxs("div",{ref:T,className:"relative",onMouseEnter:R.onMouseEnter,onMouseMove:R.onMouseMove,onMouseLeave:R.onMouseLeave,children:[S.jsx(Gi,{children:D&&S.jsx(sl.div,{className:"bg-hover pointer-events-none absolute z-0 rounded-md",initial:{opacity:0,top:D.top,left:D.left,width:D.width,height:D.height},animate:{opacity:1,top:D.top,left:D.left,width:D.width,height:D.height},exit:{opacity:0,transition:{duration:.06}},transition:{...Vd.fast,opacity:{duration:.08}}},N.current)}),S.jsx("ul",{className:"relative",children:t.map((V,K)=>{const Y=ZW(V);let G=!1;return V.kind==="active"?G=V.variant.workItemId===e:V.kind==="past"?G=`${V.entry.sessionId}:${V.entry.variantId}`===n:G=r,S.jsx(tG,{rowKey:Y,row:V,index:K,isSelected:G,isEditing:i===Y,isSwitchInFlight:L,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,onCopyVariantContext:E,activeSessionId:k,projectPath:P},Y)})})]})},tG=({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:k,onCopyVariantContext:P,activeSessionId:T,projectPath:A})=>{var Ce,ae;const O=g.useRef(null);hU(u,n,O);const N=e.kind==="active",R=e.kind==="original",M=e.kind==="active"?e.variant:null,L=e.kind==="past"?e.entry:null,D=N?M.status==="succeeded":!0,V=N?$a(M):!0,K=N?oR(M):!1,Y=N&&(M.status==="pending"||M.status==="running"),G=N?D&&(V||K)||Y:!0,B=N&&M.status==="failed",Q=N&&M.status==="cancelled",$=N&&(!G||i),te=N&&(a==null?void 0:a.kind)==="remove"&&a.variantId===M.workItemId,H=N&&(((Ce=M.refinement)==null?void 0:Ce.status)==="pending"||((ae=M.refinement)==null?void 0:ae.status)==="running");let j=gx;N?j=M.label||`Direction ${n+1}`:L&&(j=L.label.trim()||"Untitled direction");let Z;N?Z=M.runLabel:L&&(Z=L.runLabel);let ee=vx;N?ee=M.description:L&&(ee=L.brief);const ie=ee?QW(ee):null,le=XW(e,T),ue=le?"Copy variant reference":"Copy description";return s?S.jsx("li",{ref:O,"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(nG,{initial:j,onCommit:se=>E(e,se),onCancel:k}),ie&&S.jsx("span",{className:"text-content-muted mt-1 line-clamp-2 block text-xs leading-snug",children:ie})]})})}):S.jsxs("li",{ref:O,"data-proximity-index":n,className:"group relative z-10",children:[S.jsx("div",{role:"button",tabIndex:G?0:-1,"data-variant-id":N?M.workItemId:void 0,"data-variant-key":t,onClick:()=>{if($)return;const se=window.getSelection();se&&!se.isCollapsed||(e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onKeyDown:se=>{$||(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),e.kind==="active"?c(e.variant):e.kind==="past"?f(e.entry):h())},onPointerDown:se=>{$||(e.kind==="active"?D&&p(e.variant.workItemId,se):e.kind==="past"&&v(e.entry,se))},"aria-pressed":G?r:void 0,"aria-disabled":N?!G:void 0,"aria-busy":Y||H,onMouseEnter:N?()=>y(M.workItemId):void 0,onMouseLeave:N?()=>y(null):void 0,className:ar("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",D&&V&&"cursor-grab active:cursor-grabbing",(Y||K)&&"cursor-pointer",!D&&!Y&&!K&&"cursor-not-allowed opacity-60",$&&"cursor-not-allowed opacity-50"),style:D?{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:[(Y||H)&&S.jsx(tx,{className:"text-content-muted shrink-0 text-sm","data-testid":H&&!Y?"variant-refining":void 0}),S.jsx(Fo,{label:"Double-click to rename",disabled:R,children:S.jsx("span",{onDoubleClick:se=>{se.stopPropagation(),R||b(t)},className:ar("min-w-0 flex-1 truncate text-sm font-medium select-text",R?"cursor-default":"cursor-text",D||r?"text-content":"text-content-muted"),children:j})}),B&&S.jsx(YC,{label:"Failed"}),Q&&S.jsx(YC,{label:"Cancelled"}),Z&&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:$T(Z),children:Z})]}),ie&&S.jsx("span",{className:"text-content-muted mt-0.5 line-clamp-2 block cursor-text text-xs leading-snug select-text",children:ie})]})}),S.jsxs("div",{className:ar("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:[ee||le?S.jsx(Fo,{label:ue,children:S.jsx("button",{type:"button","aria-label":ue,onClick:se=>{se.stopPropagation(),P(JW({label:j,description:ee,reference:le,projectPath:A}))},onPointerDown:se=>se.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(Fd,{size:13,weight:"bold"})})}):null,!R&&S.jsx(Fo,{label:"Rename",children:S.jsx("button",{type:"button","aria-label":"Rename direction",onClick:se=>{se.stopPropagation(),b(t)},onPointerDown:se=>se.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(vz,{size:13,weight:"bold"})})}),!R&&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:te,onClick:se=>{se.stopPropagation(),e.kind==="active"?x(e.variant):_(e.entry)},onPointerDown:se=>se.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(xz,{size:13,weight:"bold"})})})]})]})},nG=({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"})},YC=({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}),rG=({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(Fd,{size:12,weight:"bold"}):null,a]})]})},sG={agent_browser:"Browser extracted",cache:"Cached",static:"Bundled catalog",manual:"Manual"},iG={design_context:"DESIGN.md",source_context:"Source",qa_report:"QA",asset:"Asset"},oG=({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(aG,{artifact:i,isExpanded:i.id===r,onToggle:()=>s(i.id)},i.id))})]})},aG=({artifact:t,isExpanded:e,onToggle:n})=>{const r=iG[t.kind],s=t.source?sG[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(fz,{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(lG,{artifact:t})}):null]})},lG=({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]}),uG=({selectedVariant:t,busy:e,onSend:n,onDeploy:r,onDeployCanvas:s,canDeploy:i,canDeployCanvas:a,canSendToAgent:u,canvasVariantCount:c,canvasDeployedUrl:f,deployedUrl:h})=>{var N,R,M,L;const p=t?((R=(N=t.actions)==null?void 0:N.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(U5,{primaryLabel:P,primaryIcon:h&&!x?Fd: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&&!_?Fd:void 0,onClick:s,isDisabled:e!==null}]:[]}),u?S.jsx("button",{type:"button",onClick:()=>{t&&n(t)},disabled:!v,title:(L=(M=t==null?void 0:t.actions)==null?void 0:M.commit)==null?void 0:L.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]})]})},aR=()=>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(tx,{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"})})]})}),cG=({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(aR,{},`${e.requestId}-${r}`)))}),dG=()=>S.jsx("div",{"data-testid":"direction-boot-skeletons",className:"space-y-0.5",children:Array.from({length:3}).map((t,e)=>S.jsx(aR,{},e))}),fG=()=>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."})]}),QC="Try different ways to create a dropdown that feels fluid and dynamic",hG=({isMCPSession:t=!1,mcpEditor:e=null})=>{const[n,r]=g.useState(!1),s=VU(e),i=t?s:"your coding agent",a=()=>{navigator.clipboard.writeText(QC).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:["“",QC,"”"]}),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(fT,{className:"h-3.5 w-3.5 text-emerald-500",weight:"bold"}):S.jsx(Fd,{className:"h-3.5 w-3.5",weight:"bold"})})]})]})]})},pG=({onClose:t})=>{const e=Je(qT);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(yz,{className:"h-4 w-4",weight:"bold"})})})]}):null},mG='[data-menu-item]:not([disabled]):not([aria-disabled="true"])',gG=({itemSelector:t=mG,loop:e=!1}={})=>{const n=g.useRef(null),r=g.useRef(null),s=g.useCallback(a=>{var u;n.current=a,a?r.current=jU():((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}},XC="/assets/arena-Db0j1set.png",vG=ds("useIntegrations"),JC=["integrations"],yG="rivet:connect-result",_G=t=>typeof t=="object"&&t!==null&&t.type===yG,xG=tt(null),wG=()=>{const t=f8(),[e,n]=nP(xG),r=U1({queryKey:JC,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:JC}),[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=_=>{_G(_.data)&&_.data.provider===u&&(_.data.status==="error"&&vG.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}},fu=({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(mx,{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},ek=ds("ConnectorsModal"),bG=()=>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"})}),SG=()=>S.jsx("span",{"aria-hidden":"true",className:"h-6 w-6 bg-[#b1b1b1]",style:{WebkitMaskImage:`url(${XC})`,maskImage:`url(${XC})`,WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"}}),EG=[{provider:"pinterest",name:"Pinterest",description:"Pull boards and pins in as visual references.",tileClassName:"bg-[#e60023] text-white",icon:S.jsx(bG,{})},{provider:"arena",name:"Are.na",description:"Connect channels of collected blocks and links.",tileClassName:"bg-[#18181b] text-content",icon:S.jsx(SG,{})}],CG=({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(fT,{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}=wG(),[h,p]=g.useState(null),v=b=>s.find(E=>E.provider===b),y=g.useCallback(b=>{c(b).catch(E=>{const k=E instanceof Error?E.message:"Could not connect.";ek.warn(`Connect error for ${b}:`,k),ht.error(k)})},[c]),x=g.useCallback(b=>{f(b).catch(E=>{const k=E instanceof Error?E.message:"Could not disconnect.";ek.warn(`Disconnect error for ${b}:`,k),ht.error(k)})},[f]),_=n==="onboarding";return S.jsx(Qm,{open:t,onOpenChange:b=>!b&&e(),children:S.jsxs(Xm,{children:[S.jsx(Jm,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(e0,{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(nR,{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(t0,{className:"text-base font-medium text-content",children:"Connect design references"}),S.jsx(fu,{onClick:e,title:"Close",className:"rounded p-1 text-content-subtle transition-colors hover:bg-main-hover hover:text-content",children:S.jsx(ET,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[S.jsx(n0,{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:EG.map(b=>S.jsx(CG,{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]})]})})]})})},tk=({className:t=""})=>S.jsx("span",{"aria-hidden":"true",className:`rivet-skeleton block rounded ${t}`.trim()}),kG=ds("SupportTicketModal"),nk=5e3,f1="feedback",PG=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},TG=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=PG(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}`},RG=({isOpen:t,onClose:e,contactEmail:n})=>{const r=nD(),[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,k=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:f1,message:b,contactEmail:P||void 0,metadata:{posthogSessionId:E??void 0,posthogDistinctId:k??void 0,appVersion:"0.14.3",appEnvironment:"production",pageUrl:window.location.href,userAgent:navigator.userAgent,submittedAt:new Date().toISOString()}})});if(!T.ok){const A=await TG(T);throw new Error(A)}r==null||r.capture("support_ticket_submitted",{ticket_type:f1,has_posthog_session_id:!!E}),ht.success("Feedback sent",{description:"Thanks for sharing this."}),h(),e()}catch(E){const k=E instanceof Error?E.message:"Failed to send message";r==null||r.capture("support_ticket_submit_failed",{ticket_type:f1,error:k}),kG.error("Failed to submit support ticket:",k),ht.error("Could not send feedback",{description:k})}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=nk-s.length,_=a||s.trim().length===0;return S.jsx(Qm,{open:t,onOpenChange:b=>!b&&p(),children:S.jsxs(Xm,{children:[S.jsx(Jm,{className:"fixed inset-0 z-max bg-black/40"}),S.jsx(e0,{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(nR,{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(t0,{className:"text-base font-medium text-content",children:"Send feedback"}),S.jsx(fu,{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(ET,{className:"h-4 w-4",weight:"bold"})})]}),S.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[S.jsx(n0,{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:nk,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(fu,{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(r0,{className:"h-5 w-5 animate-spin",weight:"bold"}):S.jsx(hz,{className:"h-5 w-5",weight:"bold"})})]})]})]})]})]})})]})})},AG=ds("ProfileAvatar"),lR=(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):""},IG=(t,e)=>lR(t,e).charAt(0).toUpperCase(),MG=({className:t="",side:e="bottom",align:n="end"})=>{const{name:r,email:s}=Je(YT),i=Je(n5),a=Je(t5),[u,c]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[y,x]=g.useState(!1),{containerRef:_,onKeyDown:b}=gG(),E=Je(pf),k=IG(r,s);if(!k)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(tk,{className:"h-7 w-7 rounded-full"}),S.jsx(tk,{className:"h-3 w-16"})]}):null;const P=lR(r,s),T=(r==null?void 0:r.trim())||null,A=(s==null?void 0:s.trim())||null,O=async()=>{x(!0);try{const N=await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"});if(!N.ok)throw new Error(`Logout failed: ${N.status}`)}catch(N){AG.warn("Logout request failed",N),ht.error("Could not log out. Please try again."),x(!1);return}window.location.reload()};return S.jsxs(S.Fragment,{children:[S.jsxs(V5,{open:u,onOpenChange:c,children:[S.jsx($5,{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:k}),P?S.jsx("span",{className:"max-w-[8rem] truncate text-xs font-medium",children:P}):null]})}),S.jsx(H5,{children:S.jsxs(z5,{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(wT,{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(mz,{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(_z,{className:"h-3.5 w-3.5",weight:"bold"}),y?"Logging out…":"Log out"]})]})})]}),S.jsx(x_,{isOpen:f,onClose:()=>h(!1)}),S.jsx(RG,{isOpen:p,onClose:()=>v(!1),contactEmail:s??void 0})]})},NG=({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(pG,{onClose:t}),S.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:S.jsx(GW,{})}),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(MG,{side:"top",align:"start"})})]}),OG=ds("useServerConfig"),LG=()=>{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),OG.warn("Error fetching server config:",c),c}finally{r(!1)}},[]);return{config:t,fetchConfig:a,isLoading:n,error:s}},DG="#1C1C20",Ai=[118,118,124],rk=.85,jG=3,FG=.15,Jh=36,VG=4.4,$G=.7,HG=3.5,zG=.8,sk=9,UG=11,BG=[1.35,1.12,.95,.85],WG=[0,1.1,2.3,3.1],GG=[0,.35,.16,.13],KG=[.9,.5,.4,.35],Aa=3,h1=[[{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}]],ep=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},Ep=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,qG=Math.sin(Math.PI/3),ik=(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*qG;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)-sk}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)-sk}return Ep(.5-r/(2*UG))},uR=({className:t="",trackGlobalLoaderCount:e=!0})=>{const n=st(ZT),r=g.useRef(null),s=g.useCallback(i=>{var L;if((L=r.current)==null||L.call(r),r.current=null,!i)return;const a=i.getContext("2d");if(!a)return;e&&n(D=>D+1);const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let c=[],f=0,h=0,p=Jh,v=Jh,y=null,x=null,_=0,b=-1;const E=new Array(33),k=D=>{const V=Math.round(D*32);let K=E[V];if(!K){const Y=V/32,G=Math.round(Ai[0]+(255-Ai[0])*Y),B=Math.round(Ai[1]+(255-Ai[1])*Y),Q=Math.round(Ai[2]+(255-Ai[2])*Y);K=`rgba(${G}, ${B}, ${Q}, ${rk})`,E[V]=K}return K},P=D=>{const V=1-.35*D,K=Math.round(Ai[0]*V),Y=Math.round(Ai[1]*V),G=Math.round(Ai[2]*V);return`rgba(${K}, ${Y}, ${G}, ${rk})`},T=D=>{let V=Math.floor(Math.random()*h1.length);V===b&&(V=(V+1)%h1.length),b=V;const K=[0,0,0,0],Y=h1[V].map((j,Z)=>{const ee=j.level,ie=K[ee]++,le=WG[ee]+ie*GG[ee],ue=KG[ee]+ep(V*131+Z*17+5)*.2;if(j.hline){const se=Ia((j.y??0)*h,v);return{hline:!0,x1:Ia(j.x1*f,p),x2:Ia(j.x2*f,p),y1:se,y2:se,level:ee,start:le,dur:ue}}const Ce=Ia(j.x1*f,p),ae=Ia((j.y1??0)*h,v);return{hline:!1,x1:Ce,y1:ae,x2:Math.max(Ia(j.x2*f,p),Ce+p),y2:Math.max(Ia((j.y2??0)*h,v),ae+v),level:ee,start:le,dur:ue}}),G=Y.reduce((j,Z)=>Math.max(j,Z.start+Z.dur),0),B=c.length,Q=new Float32Array(B*Aa),$=new Int16Array(B*Aa).fill(-1),te=new Uint8Array(B),H=Y[0];for(let j=0;j<B;j++){const Z=c[j];Z.x>H.x1&&Z.x<H.x2&&Z.y>H.y1&&Z.y<H.y2&&(te[j]=1);const ee=j*Aa;for(let ie=0;ie<Y.length;ie++){const le=ZG(Z.x,Z.y,Y[ie]);if(le<=.02)continue;let ue=ee;for(let Ce=ee;Ce<ee+Aa;Ce++){if($[Ce]===-1){ue=Ce;break}Q[Ce]<Q[ue]&&(ue=Ce)}($[ue]===-1||le>Q[ue])&&(Q[ue]=le,$[ue]=ie)}}return{startT:D,buildEnd:G,els:Y,frame:H,cellQ:Q,cellEl:$,inFrame:te}},A=()=>{const D=i.getBoundingClientRect();f=Math.max(1,D.width),h=Math.max(1,D.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 K=Math.max(8,Math.round(f/Jh)),Y=Math.max(6,Math.round(h/Jh));p=f/K,v=h/Y,c=[];for(let G=0;G<Y;G++){const B=Y>1?G/(Y-1):.5,Q=VG*(1+$G*.4*(B*2-1));for(let $=0;$<K;$++){const te=G*8191+$*131+1,H={x:($+.5)*p,y:(G+.5)*v,size:Q,seed:te,phase:ep(te),kind:0};H.kind=Math.floor(ep(te*97)*3),c.push(H)}}x=null,y=null},O=new Float32Array(32),N=D=>{a.fillStyle=DG,a.fillRect(0,0,f,h),y||(y=T(D+.2)),D>=y.startT+y.buildEnd+HG&&(x=y,_=D,y=T(D+.2));let V=0;x&&(V=1-Ep((D-_)/zG),V<=0&&(x=null));const K=y;for(let H=0;H<K.els.length;H++){const j=K.els[H];O[H]=Ep(Math.min(1,Math.max(0,(D-K.startT-j.start)/j.dur)))}const Y=O[0],G=P(0),B=P(Y),Q=V>0?P(V):G,$=V>0?P(Math.max(Y,V)):B,te=c.length;for(let H=0;H<te;H++){const j=c[H];let Z=0,ee=0;const ie=H*Aa;for(let we=ie;we<ie+Aa;we++){const Ie=K.cellEl[we];if(Ie<0)break;const qe=K.cellQ[we]*O[Ie];qe>Z&&(Z=qe,ee=K.els[Ie].level)}if(x)for(let we=ie;we<ie+Aa;we++){const Ie=x.cellEl[we];if(Ie<0)break;const qe=x.cellQ[we]*V;qe>Z&&(Z=qe,ee=x.els[Ie].level)}const le=D/jG+j.phase,ue=Math.floor(le),Ce=le-ue,ae=Ep(Math.min(Ce,1-Ce)/FG),se=Math.floor(ep(j.seed*97+ue*7919)*3);se!==j.kind&&Z<.02&&ae<.05&&(j.kind=se);const pe=Math.max(ae*(1-Z),Z);if(!(pe<.01))if(Z<.02){const we=K.inFrame[H]===1,Ie=x?x.inFrame[H]===1:!1;we?a.fillStyle=Ie?$:B:a.fillStyle=Ie?Q:G;const qe=Math.max(we?Y:0,Ie?V:0);ik(a,j.kind,j.x,j.y,j.size*pe*(1-.2*qe))}else{a.fillStyle=k(Z);const we=1+(BG[ee]-1)*Z;ik(a,j.kind,j.x,j.y,j.size*pe*we)}}};A();let R=0;if(u)y=T(-100),N(0);else{const D=performance.now(),V=K=>{N((K-D)/1e3),R=requestAnimationFrame(V)};R=requestAnimationFrame(V)}const M=new ResizeObserver(()=>{A(),u&&(y=T(-100),N(0))});M.observe(i),r.current=()=>{cancelAnimationFrame(R),M.disconnect(),e&&n(D=>D-1)}},[e,n]);return S.jsx("canvas",{ref:s,"aria-hidden":"true",className:`h-full w-full ${t}`.trim()})},YG=async(t=null)=>{if(t)return QG(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 tp();if(!e.ok)return{isOk:!1,unavailableReason:"rivet_unreachable"};let r;try{r=await e.json()}catch{return tp()}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"}:tp()},QG=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"}}},tp=async()=>{try{const t=await fetch("/");return{isOk:t.status!==502&&t.status!==503,unavailableReason:"upstream_unreachable"}}catch{return{isOk:!1,unavailableReason:"rivet_unreachable"}}},ok=ds("usePreviewUpstreamHealth"),XG=500,JG=4e3,eK=15e3,tK=(t,e={})=>{const n=g.useRef(null),r=g.useRef(null),s=e.probeMsWhileDown??XG,i=e.probeMsWhileUp??JG,a=e.firstUnreachableCaptureAfterMs??eK,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),[k,P]=g.useState(!1),[T,A]=g.useState(!1),[O,N]=g.useState(t==="static"?null:"upstream_unreachable");return g.useEffect(()=>{if(t==="static"){p(!0),_(null),E(0),P(!1),A(!0),N(null);return}if(f){p(!1),_(null),E(0),P(!1),A(!0),N("upstream_unreachable"),n.current=null;return}let R=!0;const M=Date.now();_(M),E(0),P(!1),p(!1),A(!1),N("upstream_unreachable");const L={current:!1},D={current:!1},V={current:!1},K={current:null},Y={current:!1};let G=null;const B=()=>{V.current||(V.current=!0,R&&A(!0))},Q=()=>{G!==null&&(clearTimeout(G),G=null)},$=(H,j)=>{Q(),G=setTimeout(j,H)},te=async()=>{if(!R)return;E(ie=>ie+1);const{isOk:H,unavailableReason:j}=await YG(c);if(!R)return;if(B(),H){const ie=!Y.current;Y.current=!0,p(!0),N(null),K.current=null,D.current=!1,P(!1),L.current?ie&&(Pe==null||Pe.capture("preview_upstream_restored",{framework:t})):(L.current=!0,Pe==null||Pe.capture("preview_dev_server_ready",{framework:t,ready_after_ms:Date.now()-M})),$(i,te);return}const Z=Y.current;Y.current=!1,p(!1),N(j),K.current===null&&(K.current=Date.now(),D.current=!1,P(!1)),Z&&(Pe==null||Pe.capture("preview_upstream_lost",{framework:t}),y(ie=>ie+1),ok.warn("Preview upstream became unavailable after it was ready"));const ee=Date.now()-K.current;ee>=a&&!D.current&&(D.current=!0,P(!0),Pe==null||Pe.capture("preview_dev_server_unreachable",{framework:t,elapsed_ms:ee}),ok.warn("Dev server did not become ready within timeout window")),$(s,te)};return n.current=()=>$(0,te),$(0,te),()=>{R=!1,n.current=null,Q()}},[t,s,i,a,c,f]),g.useEffect(()=>{var M;if(t==="static"||u===void 0)return;const R=r.current;r.current=u,R!==null&&R!==u&&((M=n.current)==null||M.call(n))},[t,u]),{isUpstreamReady:h,iframeRemountKey:v,probeStartedAt:x,probeAttemptCount:b,isFirstUnreachableWindowExceeded:k,initialProbeComplete:T,unavailableReason:O}};function nK(t){return t.enteringSplit&&t.isExistingSession&&t.hasActiveVariantProxy}const cR=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}`},dR=({agentApplyMode:t,url:e})=>e.startsWith("/")?`${cR(t)}${e}`:e,rK="allow-scripts allow-same-origin allow-forms allow-popups allow-modals",sK=t=>rK,iK=ds("PreviewSurface"),ak=(t,e)=>t==="about:blank"?"blank":t.includes("/api/variants/")?"static_artifact":e.kind==="variant"?"dev_server":"original",fR=({target:t,src:e,framework:n,remountKey:r})=>(Je(s0),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:sK(),onLoad:()=>{Pe==null||Pe.capture("preview_iframe_loaded",{framework:n,src:e}),t.kind==="variant"&&(Pe==null||Pe.capture("variants_panel.preview_displayed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:ak(e,t),framework:n}))},onError:()=>{Pe==null||Pe.capture("preview_iframe_load_failed",{framework:n,src:e}),t.kind==="variant"&&(Pe==null||Pe.capture("variants_panel.preview_display_failed",{sessionId:t.sessionId,variantId:t.variantId,renderedTarget:"variant",iframeSrcKind:ak(e,t),framework:n})),iK.warn("Preview iframe failed to load",{framework:n,src:e})}},r)})),oK="modulepreload",aK=function(t){return"/"+t},lk={},lK=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=aK(f),f in lk)return;lk[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":oK,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)})},uK=g.lazy(()=>lK(()=>Promise.resolve().then(()=>Hq),void 0)),cK={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"},dK={sm:"text-lg font-semibold text-content",md:"text-2xl font-semibold text-content",lg:"text-3xl font-semibold text-content"},fK={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"},_d=({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&&(Pe==null||Pe.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:`${cK[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:dK[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:fK[_.variant??"neutral"],children:_.label},_.label))}):null]}):null]})},w_=({loader:t="coalesce",trackGlobalLoaderCount:e,size:n="lg",...r})=>t==="coalesce"?S.jsx(_d,{...r,size:n,busy:!0,backdrop:S.jsx(uR,{trackGlobalLoaderCount:e})}):t==="logo"?S.jsx(_d,{...r,size:n,busy:!0,backdrop:S.jsx(g.Suspense,{fallback:null,children:S.jsx(uK,{className:"absolute inset-0"})})}):S.jsx(_d,{...r,size:n,busy:!0,media:S.jsx(r0,{"aria-hidden":!0,className:"text-content h-8 w-8 shrink-0 animate-spin",weight:"bold"})}),hR=({icon:t,...e})=>S.jsx(_d,{...e,tone:"neutral",media:t?S.jsx("div",{className:"text-content-muted",children:t}):void 0}),Cm=t=>S.jsx(_d,{...t,tone:"error",role:"alert"}),uk="/static/",hK=t=>{try{return new URL(t,"http://localhost").pathname.endsWith(uk)}catch{return t.endsWith(uk)}},pK=({isInteractionDisabled:t=!1,framework:e,userPort:n,activeDemoSessionId:r=null,holdPreviewNavigation:s=!1})=>{const i=Je(u_),a=st(u_),u=Je(xm),c=st(xm),f=Je(hf),h=Je(s0),p=Je(c_),v=Je(d_),y=Je(QT),x=Je(XT),_=st(d_),b=Je(Zo),E=Je(h_),k=st(c_),P=f.active&&f.projectContext.kind==="fresh",T=Je(f_),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||je.previewUnavailable.reason==="idle_timeout")))??null:null,O=f.active&&f.variants.some(je=>je.status==="pending"||je.status==="running"),N=P||O,R=f.active?f.variants.find(je=>{var Ye;return je.workItemId===T&&je.status==="succeeded"&&!!je.previewUnavailable&&((Ye=je.previewUnavailable)==null?void 0:Ye.reason)!=="idle_timeout"})??null:null,M=e==="static"&&u!==null&&hK(u);g.useEffect(()=>{f.active||k(!1)},[f.active,k]);const L=g.useRef(!1);g.useEffect(()=>{const je=!!(b!=null&&b.left||b!=null&&b.right),Ye=je&&!L.current;L.current=je;const lt=f.active?f.sessionId:null;!lt||!nK({enteringSplit:Ye,isExistingSession:f.active&&f.projectContext.kind==="existing",hasActiveVariantProxy:p&&v!==null})||(k(!1),_(null),a(Xe=>Xe+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,k,_,a]);const V=g.useMemo(()=>{var xn;if(p||u&&!M||!f.active)return null;const{stage:je,variants:Ye}=f,lt=je==="ready"||je==="degraded",Xe=Ye.some(Ut=>{var Rn,Hn;return((Rn=Ut.refinement)==null?void 0:Rn.status)==="pending"||((Hn=Ut.refinement)==null?void 0:Hn.status)==="running"});if(!lt&&!Xe)return null;const vt=Ye.find(Ut=>{var Rn;return Ut.status==="succeeded"&&((Rn=Ut.preview)==null?void 0:Rn.kind)==="static_artifact"});return((xn=vt==null?void 0:vt.preview)==null?void 0:xn.kind)==="static_artifact"?vt.preview.url:null},[M,u,p,f])??u,K=g.useMemo(()=>!f.active||!V?null:f.variants.find(je=>{var Ye;return((Ye=je.preview)==null?void 0:Ye.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 _m;if(K)return{kind:"variant",sessionId:f.sessionId,variantId:K.workItemId};if(V){const Ye=V.match(/\/__rivet\/preview\/variant\/([^/]+)\/([^/?#]+)/),lt=Ye!=null&&Ye[1]?decodeURIComponent(Ye[1]):null,Xe=Ye!=null&&Ye[2]?decodeURIComponent(Ye[2]):null;if(lt===f.sessionId&&Xe&&f.variants.some(Ut=>Ut.workItemId===Xe))return{kind:"variant",sessionId:f.sessionId,variantId:Xe};const vt=V.match(/\/api\/variants\/[^/]+\/static\/([^/?#]+)/),xn=vt!=null&&vt[1]?decodeURIComponent(vt[1]):null;if(xn&&f.variants.some(Ut=>Ut.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(Ye=>Ye.workItemId===v)?{kind:"variant",sessionId:f.sessionId,variantId:v}:(!je||P)&&!V&&T&&f.variants.some(Ye=>Ye.workItemId===T)?{kind:"variant",sessionId:f.sessionId,variantId:T}:_m},[E,K,f,p,v,V,b,P,T]),G=g.useRef(null);g.useEffect(()=>{var Xe,vt;if(!K||((Xe=K.preview)==null?void 0:Xe.kind)!=="static_artifact"||((vt=K.refinement)==null?void 0:vt.status)!=="succeeded")return;const je=`${K.workItemId}:${K.refinement.workItemId}`;if(G.current===je)return;G.current=je;const Ye=K.preview.url.includes("?")?"&":"?",lt=`${K.preview.url}${Ye}refinement=${encodeURIComponent(K.refinement.workItemId)}`;V!==lt&&(c(lt),a(xn=>xn+1))},[V,K,a,c,f]);const B=V!==null&&VW(V),Q=V!==null&&!B||P&&!p&&!B,{isUpstreamReady:$,iframeRemountKey:te,probeAttemptCount:H,initialProbeComplete:j}=tK(e,{rerunProbeImmediatelyOnVersion:i,probePath:B?V:null,skip:Q}),[Z,ee]=g.useState(()=>y&&$?i:null),ie=g.useRef(null);g.useEffect(()=>{if(!y){ie.current=null,ee(null);return}if(Z===i){ie.current=null;return}const je=ie.current;if(!je||je.remountKey!==i){ie.current={remountKey:i,probeAttemptCount:H};return}$&&H>je.probeAttemptCount&&(ie.current=null,ee(i))},[Z,i,y,H,$]);const ue=V!==null&&!B||$,ae=x||y&&Z!==i||y&&!ue,se=`${te}:${i}`,pe=r?`/try/${encodeURIComponent(r)}`:"",we=sR(window.location.pathname),Ie=e==="static"?`${pe}/static${we??"/"}`:`${pe}${we??"/"}`,qe=cR(h);let it=null;V&&(it=dR({agentApplyMode:h,url:V}));const at=A||ae?"about:blank":(B&&!ue?"about:blank":it)??(s||!ue?"about:blank":`${qe}${Ie}`),At=!!A||!!R||!ue&&j;let mt=null;return ae?mt=S.jsx(w_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"preview_replay_boot"}):A?mt=S.jsx(w_,{fill:"overlay",loader:"coalesce",trackGlobalLoaderCount:!1,state:"variant_building",children:S.jsx("span",{className:"sr-only",children:"Building your direction"})}):R?mt=S.jsx(Cm,{fill:"overlay",state:"preview_unavailable",title:"Preview couldn’t start",description:"Its preview server didn’t start.",actions:[{label:"Reload",onClick:()=>window.location.reload()}]}):At&&(mt=N?S.jsx(hR,{fill:"overlay",state:"preview_no_selection",title:"Nothing to preview yet",description:"Pick a direction from the panel."}):S.jsx(Cm,{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(fR,{target:Y,src:at,framework:e,remountKey:se})]})};function ck({side:t,sessionId:e,variantId:n,url:r,label:s,source:i,isFallback:a=!1}){var E;const u=st(Zo),c=Je(hf),f=Je(s0),h=g.useRef(!1),p=g.useCallback(()=>{h.current||(h.current=!0,Kd({source:i,sessionId:e,variantId:n}))},[i,e,n]),v=g.useCallback(()=>{if(a){u(null);return}p(),u(k=>{if(!k)return null;const P={...k};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(k=>k.workItemId===n)??null,[e,n,c]),_=g.useMemo(()=>{var P,T;let k=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("?")?"&":"?";k=`${x.preview.url}${A}refinement=${encodeURIComponent(x.refinement.workItemId)}`}return dR({agentApplyMode:f,url:k})},[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(fR,{target:y,src:_,framework:"static",remountKey:b})})]})}const dk=240;function mK(){const t=Je(Ud),e=Je(ex),n=g.useRef(null);return g.useEffect(()=>{if(!t||!e||!n.current)return;const r=e.x-dk/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:dk},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:$T(t.runLabel),children:t.runLabel}):null]}),t.description?S.jsx("div",{className:"variant-drag-ghost-desc",children:t.description}):null]})})}function gK(){const t=Je(Ud),e=Je(ex),n=Je(Zo),r=st(Ud),s=st(Zo),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)&&Kd(b),s(E=>({...E??{},[x]:_})),f("exiting"),window.setTimeout(()=>r(null),220)}else Kd(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(fk,{side:"left",hovered:a==="left",canDrop:!!t.url,label:t.label}),S.jsx(fk,{side:"right",hovered:a==="right",canDrop:!!t.url,label:t.label})]})}function fk({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 pR=(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)}`},hk=(t,e)=>{if(!t)return;const n=pR(e,t.sessionId,t.variantId);return!n||n===t.url?t:{...t,url:n}},vK=()=>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(uR,{trackGlobalLoaderCount:!1})})}),yK=({isLoading:t=!1,isInteractionDisabled:e=!1,activeDemoSessionId:n=null,holdHostedTryoutPreviewNavigation:r=!1})=>{const{config:s,fetchConfig:i,isLoading:a,error:u}=LG();return g.useEffect(()=>{i().catch(c=>{Pe==null||Pe.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(vK,{}):u||!s?S.jsx(Cm,{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:()=>{Pe==null||Pe.capture("preview_config_retry_clicked"),i().catch(c=>{Pe==null||Pe.capture("preview_config_load_failed",{message:c instanceof Error?c.message:"unknown_error"})})}}]}):S.jsx(_K,{isLoading:t,isInteractionDisabled:e,framework:s.framework,userPort:s.userPort,activeDemoSessionId:n,holdHostedTryoutPreviewNavigation:r})};function _K(t){const e=Je(Zo),n=Je(Ud),r=Je(hf),s=Je(xm),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(N=>{var R;return N.status==="succeeded"&&((R=N.preview)==null?void 0:R.kind)==="static_artifact"&&N.workItemId!==_}),E=s==null?void 0:s.replace(/[?&]refinement=[^&]*$/,""),P=b.find(N=>{var R;return((R=N.preview)==null?void 0:R.kind)==="static_artifact"&&N.preview.url===E})??b[0];if(((O=P==null?void 0:P.preview)==null?void 0:O.kind)!=="static_artifact")return;const T=pR(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=hk(i,r)??(a?u:void 0),f=hk(a,r)??(i?u:void 0),h=!i&&!!c,p=!a&&!!f,v=!!(c||f),y=S.jsx(pK,{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(ck,{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(ck,{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(gK,{}),S.jsx(mK,{})]})})}const mR=({message:t,isLoading:e=!0})=>S.jsxs("div",{className:"flex items-center gap-2 text-sm text-content",children:[e?S.jsx(r0,{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 gR(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}/*!
|
|
115
115
|
* GSAP 3.15.0
|
|
116
116
|
* https://gsap.com
|
|
117
117
|
*
|
|
@@ -126,267 +126,267 @@ ${s}`:s},eG=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy
|
|
|
126
126
|
* Subject to the terms at https://gsap.com/standard-license
|
|
127
127
|
* @author: Jack Doyle, jack@greensock.com
|
|
128
128
|
*/var bk,$o,pu,Mx,Wa,Sk,Nx,gq=function(){return typeof window<"u"},Xi={},Fa=180/Math.PI,mu=Math.PI/180,ql=Math.atan2,Ek=1e8,Ox=/([A-Z])/g,vq=/(left|right|width|margin|padding|x)/i,yq=/[\s,\(]\S/,si={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},M_=function(e,n){return n.set(n.t,n.p,Math.round((n.s+n.c*e)*1e4)/1e4+n.u,n)},_q=function(e,n){return n.set(n.t,n.p,e===1?n.e:Math.round((n.s+n.c*e)*1e4)/1e4+n.u,n)},xq=function(e,n){return n.set(n.t,n.p,e?Math.round((n.s+n.c*e)*1e4)/1e4+n.u:n.b,n)},wq=function(e,n){return n.set(n.t,n.p,e===1?n.e:e?Math.round((n.s+n.c*e)*1e4)/1e4+n.u:n.b,n)},bq=function(e,n){var r=n.s+n.c*e;n.set(n.t,n.p,~~(r+(r<0?-.5:.5))+n.u,n)},tA=function(e,n){return n.set(n.t,n.p,e?n.e:n.b,n)},nA=function(e,n){return n.set(n.t,n.p,e!==1?n.b:n.e,n)},Sq=function(e,n,r){return e.style[n]=r},Eq=function(e,n,r){return e.style.setProperty(n,r)},Cq=function(e,n,r){return e._gsap[n]=r},kq=function(e,n,r){return e._gsap.scaleX=e._gsap.scaleY=r},Pq=function(e,n,r,s,i){var a=e._gsap;a.scaleX=a.scaleY=r,a.renderTransform(i,a)},Tq=function(e,n,r,s,i){var a=e._gsap;a[n]=r,a.renderTransform(i,a)},Zt="transform",Tr=Zt+"Origin",Rq=function t(e,n){var r=this,s=this.target,i=s.style,a=s._gsap;if(e in Xi&&i){if(this.tfm=this.tfm||{},e!=="transform")e=si[e]||e,~e.indexOf(",")?e.split(",").forEach(function(u){return r.tfm[u]=Vi(s,u)}):this.tfm[e]=a.x?a[e]:Vi(s,e),e===Tr&&(this.tfm.zOrigin=a.zOrigin);else return si.transform.split(",").forEach(function(u){return t.call(r,u,n)});if(this.props.indexOf(Zt)>=0)return;a.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Tr,n,"")),e=Zt}(i||n)&&this.props.push(e,n,i[e])},rA=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Aq=function(){var e=this.props,n=this.target,r=n.style,s=n._gsap,i,a;for(i=0;i<e.length;i+=3)e[i+1]?e[i+1]===2?n[e[i]](e[i+2]):n[e[i]]=e[i+2]:e[i+2]?r[e[i]]=e[i+2]:r.removeProperty(e[i].substr(0,2)==="--"?e[i]:e[i].replace(Ox,"-$1").toLowerCase());if(this.tfm){for(a in this.tfm)s[a]=this.tfm[a];s.svg&&(s.renderTransform(),n.setAttribute("data-svg-origin",this.svgo||"")),i=Nx(),(!i||!i.isStart)&&!r[Zt]&&(rA(r),s.zOrigin&&r[Tr]&&(r[Tr]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},sA=function(e,n){var r={target:e,props:[],revert:Aq,save:Rq};return e._gsap||Rr.core.getCache(e),n&&e.style&&e.nodeType&&n.split(",").forEach(function(s){return r.save(s)}),r},iA,N_=function(e,n){var r=$o.createElementNS?$o.createElementNS((n||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):$o.createElement(e);return r&&r.style?r:$o.createElement(e)},Ur=function t(e,n,r){var s=getComputedStyle(e);return s[n]||s.getPropertyValue(n.replace(Ox,"-$1").toLowerCase())||s.getPropertyValue(n)||!r&&t(e,Wu(n)||n,1)||""},Ck="O,Moz,ms,Ms,Webkit".split(","),Wu=function(e,n,r){var s=n||Wa,i=s.style,a=5;if(e in i&&!r)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);a--&&!(Ck[a]+e in i););return a<0?null:(a===3?"ms":a>=0?Ck[a]:"")+e},O_=function(){gq()&&window.document&&(bk=window,$o=bk.document,pu=$o.documentElement,Wa=N_("div")||{style:{}},N_("div"),Zt=Wu(Zt),Tr=Zt+"Origin",Wa.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",iA=!!Wu("perspective"),Nx=Rr.core.reverting,Mx=1)},kk=function(e){var n=e.ownerSVGElement,r=N_("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=e.cloneNode(!0),i;s.style.display="block",r.appendChild(s),pu.appendChild(r);try{i=s.getBBox()}catch{}return r.removeChild(s),pu.removeChild(r),i},Pk=function(e,n){for(var r=n.length;r--;)if(e.hasAttribute(n[r]))return e.getAttribute(n[r])},oA=function(e){var n,r;try{n=e.getBBox()}catch{n=kk(e),r=1}return n&&(n.width||n.height)||r||(n=kk(e)),n&&!n.width&&!n.x&&!n.y?{x:+Pk(e,["x","cx","x1"])||0,y:+Pk(e,["y","cy","y1"])||0,width:0,height:0}:n},aA=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&oA(e))},Jo=function(e,n){if(n){var r=e.style,s;n in Xi&&n!==Tr&&(n=Zt),r.removeProperty?(s=n.substr(0,2),(s==="ms"||n.substr(0,6)==="webkit")&&(n="-"+n),r.removeProperty(s==="--"?n:n.replace(Ox,"-$1").toLowerCase())):r.removeAttribute(n)}},Ho=function(e,n,r,s,i,a){var u=new Pr(e._pt,n,r,0,1,a?nA:tA);return e._pt=u,u.b=s,u.e=i,e._props.push(r),u},Tk={deg:1,rad:1,turn:1},Iq={grid:1,flex:1},ea=function t(e,n,r,s){var i=parseFloat(r)||0,a=(r+"").trim().substr((i+"").length)||"px",u=Wa.style,c=vq.test(n),f=e.tagName.toLowerCase()==="svg",h=(f?"client":"offset")+(c?"Width":"Height"),p=100,v=s==="px",y=s==="%",x,_,b,E;if(s===a||!i||Tk[s]||Tk[a])return i;if(a!=="px"&&!v&&(i=t(e,n,r,"px")),E=e.getCTM&&aA(e),(y||a==="%")&&(Xi[n]||~n.indexOf("adius")))return x=E?e.getBBox()[c?"width":"height"]:e[h],an(y?i/x*p:i/100*x);if(u[c?"width":"height"]=p+(v?a:s),_=s!=="rem"&&~n.indexOf("adius")||s==="em"&&e.appendChild&&!f?e:e.parentNode,E&&(_=(e.ownerSVGElement||{}).parentNode),(!_||_===$o||!_.appendChild)&&(_=$o.body),b=_._gsap,b&&y&&b.width&&c&&b.time===$r.time&&!b.uncache)return an(i/b.width*p);if(y&&(n==="height"||n==="width")){var k=e.style[n];e.style[n]=p+s,x=e[h],k?e.style[n]=k:Jo(e,n)}else(y||a==="%")&&!Iq[Ur(_,"display")]&&(u.position=Ur(e,"position")),_===e&&(u.position="static"),_.appendChild(Wa),x=Wa[h],_.removeChild(Wa),u.position="absolute";return c&&y&&(b=ol(_),b.time=$r.time,b.width=_[h]),an(v?x*i/p:x&&i?p/x*i:0)},Vi=function(e,n,r,s){var i;return Mx||O_(),n in si&&n!=="transform"&&(n=si[n],~n.indexOf(",")&&(n=n.split(",")[0])),Xi[n]&&n!=="transform"?(i=tf(e,s),i=n!=="transformOrigin"?i[n]:i.svg?i.origin:Mm(Ur(e,Tr))+" "+i.zOrigin+"px"):(i=e.style[n],(!i||i==="auto"||s||~(i+"").indexOf("calc("))&&(i=Im[n]&&Im[n](e,n,r)||Ur(e,n)||CR(e,n)||(n==="opacity"?1:0))),r&&!~(i+"").trim().indexOf(" ")?ea(e,n,i,r)+r:i},Mq=function(e,n,r,s){if(!r||r==="none"){var i=Wu(n,e,1),a=i&&Ur(e,i,1);a&&a!==r?(n=i,r=a):n==="borderColor"&&(r=Ur(e,"borderTopColor"))}var u=new Pr(this._pt,e.style,n,0,1,XR),c=0,f=0,h,p,v,y,x,_,b,E,k,P,T,A;if(u.b=r,u.e=s,r+="",s+="",s.substring(0,6)==="var(--"&&(s=Ur(e,s.substring(4,s.indexOf(")")))),s==="auto"&&(_=e.style[n],e.style[n]=s,s=Ur(e,n)||s,_?e.style[n]=_:Jo(e,n)),h=[r,s],BR(h),r=h[0],s=h[1],v=r.match(iu)||[],A=s.match(iu)||[],A.length){for(;p=iu.exec(s);)b=p[0],k=s.substring(c,p.index),x?x=(x+1)%5:(k.substr(-5)==="rgba("||k.substr(-5)==="hsla(")&&(x=1),b!==(_=v[f++]||"")&&(y=parseFloat(_)||0,T=_.substr((y+"").length),b.charAt(1)==="="&&(b=hu(y,b)+T),E=parseFloat(b),P=b.substr((E+"").length),c=iu.lastIndex-P.length,P||(P=P||Gr.units[n]||T,c===s.length&&(s+=P,u.e+=P)),T!==P&&(y=ea(e,n,_,P)||0),u._pt={_next:u._pt,p:k||f===1?k:",",s:y,c:E-y,m:x&&x<4||n==="zIndex"?Math.round:0});u.c=c<s.length?s.substring(c,s.length):""}else u.r=n==="display"&&s==="none"?nA:tA;return xR.test(s)&&(u.e=0),this._pt=u,u},Rk={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Nq=function(e){var n=e.split(" "),r=n[0],s=n[1]||"50%";return(r==="top"||r==="bottom"||s==="left"||s==="right")&&(e=r,r=s,s=e),n[0]=Rk[r]||r,n[1]=Rk[s]||s,n.join(" ")},Oq=function(e,n){if(n.tween&&n.tween._time===n.tween._dur){var r=n.t,s=r.style,i=n.u,a=r._gsap,u,c,f;if(i==="all"||i===!0)s.cssText="",c=1;else for(i=i.split(","),f=i.length;--f>-1;)u=i[f],Xi[u]&&(c=1,u=u==="transformOrigin"?Tr:Zt),Jo(r,u);c&&(Jo(r,Zt),a&&(a.svg&&r.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",tf(r,1),a.uncache=1,rA(s)))}},Im={clearProps:function(e,n,r,s,i){if(i.data!=="isFromStart"){var a=e._pt=new Pr(e._pt,n,r,0,0,Oq);return a.u=s,a.pr=-10,a.tween=i,e._props.push(r),1}}},ef=[1,0,0,1,0,0],lA={},uA=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},Ak=function(e){var n=Ur(e,Zt);return uA(n)?ef:n.substr(7).match(_R).map(an)},Lx=function(e,n){var r=e._gsap||ol(e),s=e.style,i=Ak(e),a,u,c,f;return r.svg&&e.getAttribute("transform")?(c=e.transform.baseVal.consolidate().matrix,i=[c.a,c.b,c.c,c.d,c.e,c.f],i.join(",")==="1,0,0,1,0,0"?ef:i):(i===ef&&!e.offsetParent&&e!==pu&&!r.svg&&(c=s.display,s.display="block",a=e.parentNode,(!a||!e.offsetParent&&!e.getBoundingClientRect().width)&&(f=1,u=e.nextElementSibling,pu.appendChild(e)),i=Ak(e),c?s.display=c:Jo(e,"display"),f&&(u?a.insertBefore(e,u):a?a.appendChild(e):pu.removeChild(e))),n&&i.length>6?[i[0],i[1],i[4],i[5],i[12],i[13]]:i)},L_=function(e,n,r,s,i,a){var u=e._gsap,c=i||Lx(e,!0),f=u.xOrigin||0,h=u.yOrigin||0,p=u.xOffset||0,v=u.yOffset||0,y=c[0],x=c[1],_=c[2],b=c[3],E=c[4],k=c[5],P=n.split(" "),T=parseFloat(P[0])||0,A=parseFloat(P[1])||0,O,N,R,M;r?c!==ef&&(N=y*b-x*_)&&(R=T*(b/N)+A*(-_/N)+(_*k-b*E)/N,M=T*(-x/N)+A*(y/N)-(y*k-x*E)/N,T=R,A=M):(O=oA(e),T=O.x+(~P[0].indexOf("%")?T/100*O.width:T),A=O.y+(~(P[1]||P[0]).indexOf("%")?A/100*O.height:A)),s||s!==!1&&u.smooth?(E=T-f,k=A-h,u.xOffset=p+(E*y+k*_)-E,u.yOffset=v+(E*x+k*b)-k):u.xOffset=u.yOffset=0,u.xOrigin=T,u.yOrigin=A,u.smooth=!!s,u.origin=n,u.originIsAbsolute=!!r,e.style[Tr]="0px 0px",a&&(Ho(a,u,"xOrigin",f,T),Ho(a,u,"yOrigin",h,A),Ho(a,u,"xOffset",p,u.xOffset),Ho(a,u,"yOffset",v,u.yOffset)),e.setAttribute("data-svg-origin",T+" "+A)},tf=function(e,n){var r=e._gsap||new GR(e);if("x"in r&&!n&&!r.uncache)return r;var s=e.style,i=r.scaleX<0,a="px",u="deg",c=getComputedStyle(e),f=Ur(e,Tr)||"0",h,p,v,y,x,_,b,E,k,P,T,A,O,N,R,M,L,D,V,K,Y,G,B,Q,$,te,H,j,Z,ee,ie,le;return h=p=v=_=b=E=k=P=T=0,y=x=1,r.svg=!!(e.getCTM&&aA(e)),c.translate&&((c.translate!=="none"||c.scale!=="none"||c.rotate!=="none")&&(s[Zt]=(c.translate!=="none"?"translate3d("+(c.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(c.rotate!=="none"?"rotate("+c.rotate+") ":"")+(c.scale!=="none"?"scale("+c.scale.split(" ").join(",")+") ":"")+(c[Zt]!=="none"?c[Zt]:"")),s.scale=s.rotate=s.translate="none"),N=Lx(e,r.svg),r.svg&&(r.uncache?($=e.getBBox(),f=r.xOrigin-$.x+"px "+(r.yOrigin-$.y)+"px",Q=""):Q=!n&&e.getAttribute("data-svg-origin"),L_(e,Q||f,!!Q||r.originIsAbsolute,r.smooth!==!1,N)),A=r.xOrigin||0,O=r.yOrigin||0,N!==ef&&(D=N[0],V=N[1],K=N[2],Y=N[3],h=G=N[4],p=B=N[5],N.length===6?(y=Math.sqrt(D*D+V*V),x=Math.sqrt(Y*Y+K*K),_=D||V?ql(V,D)*Fa:0,k=K||Y?ql(K,Y)*Fa+_:0,k&&(x*=Math.abs(Math.cos(k*mu))),r.svg&&(h-=A-(A*D+O*K),p-=O-(A*V+O*Y))):(le=N[6],ee=N[7],H=N[8],j=N[9],Z=N[10],ie=N[11],h=N[12],p=N[13],v=N[14],R=ql(le,Z),b=R*Fa,R&&(M=Math.cos(-R),L=Math.sin(-R),Q=G*M+H*L,$=B*M+j*L,te=le*M+Z*L,H=G*-L+H*M,j=B*-L+j*M,Z=le*-L+Z*M,ie=ee*-L+ie*M,G=Q,B=$,le=te),R=ql(-K,Z),E=R*Fa,R&&(M=Math.cos(-R),L=Math.sin(-R),Q=D*M-H*L,$=V*M-j*L,te=K*M-Z*L,ie=Y*L+ie*M,D=Q,V=$,K=te),R=ql(V,D),_=R*Fa,R&&(M=Math.cos(R),L=Math.sin(R),Q=D*M+V*L,$=G*M+B*L,V=V*M-D*L,B=B*M-G*L,D=Q,G=$),b&&Math.abs(b)+Math.abs(_)>359.9&&(b=_=0,E=180-E),y=an(Math.sqrt(D*D+V*V+K*K)),x=an(Math.sqrt(B*B+le*le)),R=ql(G,B),k=Math.abs(R)>2e-4?R*Fa:0,T=ie?1/(ie<0?-ie:ie):0),r.svg&&(Q=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!uA(Ur(e,Zt)),Q&&e.setAttribute("transform",Q))),Math.abs(k)>90&&Math.abs(k)<270&&(i?(y*=-1,k+=_<=0?180:-180,_+=_<=0?180:-180):(x*=-1,k+=k<=0?180:-180)),n=n||r.uncache,r.x=h-((r.xPercent=h&&(!n&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-h)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+a,r.y=p-((r.yPercent=p&&(!n&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-p)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+a,r.z=v+a,r.scaleX=an(y),r.scaleY=an(x),r.rotation=an(_)+u,r.rotationX=an(b)+u,r.rotationY=an(E)+u,r.skewX=k+u,r.skewY=P+u,r.transformPerspective=T+a,(r.zOrigin=parseFloat(f.split(" ")[2])||!n&&r.zOrigin||0)&&(s[Tr]=Mm(f)),r.xOffset=r.yOffset=0,r.force3D=Gr.force3D,r.renderTransform=r.svg?Dq:iA?cA:Lq,r.uncache=0,r},Mm=function(e){return(e=e.split(" "))[0]+" "+e[1]},w1=function(e,n,r){var s=qn(n);return an(parseFloat(n)+parseFloat(ea(e,"x",r+"px",s)))+s},Lq=function(e,n){n.z="0px",n.rotationY=n.rotationX="0deg",n.force3D=0,cA(e,n)},Ma="0deg",Qc="0px",Na=") ",cA=function(e,n){var r=n||this,s=r.xPercent,i=r.yPercent,a=r.x,u=r.y,c=r.z,f=r.rotation,h=r.rotationY,p=r.rotationX,v=r.skewX,y=r.skewY,x=r.scaleX,_=r.scaleY,b=r.transformPerspective,E=r.force3D,k=r.target,P=r.zOrigin,T="",A=E==="auto"&&e&&e!==1||E===!0;if(P&&(p!==Ma||h!==Ma)){var O=parseFloat(h)*mu,N=Math.sin(O),R=Math.cos(O),M;O=parseFloat(p)*mu,M=Math.cos(O),a=w1(k,a,N*M*-P),u=w1(k,u,-Math.sin(O)*-P),c=w1(k,c,R*M*-P+P)}b!==Qc&&(T+="perspective("+b+Na),(s||i)&&(T+="translate("+s+"%, "+i+"%) "),(A||a!==Qc||u!==Qc||c!==Qc)&&(T+=c!==Qc||A?"translate3d("+a+", "+u+", "+c+") ":"translate("+a+", "+u+Na),f!==Ma&&(T+="rotate("+f+Na),h!==Ma&&(T+="rotateY("+h+Na),p!==Ma&&(T+="rotateX("+p+Na),(v!==Ma||y!==Ma)&&(T+="skew("+v+", "+y+Na),(x!==1||_!==1)&&(T+="scale("+x+", "+_+Na),k.style[Zt]=T||"translate(0, 0)"},Dq=function(e,n){var r=n||this,s=r.xPercent,i=r.yPercent,a=r.x,u=r.y,c=r.rotation,f=r.skewX,h=r.skewY,p=r.scaleX,v=r.scaleY,y=r.target,x=r.xOrigin,_=r.yOrigin,b=r.xOffset,E=r.yOffset,k=r.forceCSS,P=parseFloat(a),T=parseFloat(u),A,O,N,R,M;c=parseFloat(c),f=parseFloat(f),h=parseFloat(h),h&&(h=parseFloat(h),f+=h,c+=h),c||f?(c*=mu,f*=mu,A=Math.cos(c)*p,O=Math.sin(c)*p,N=Math.sin(c-f)*-v,R=Math.cos(c-f)*v,f&&(h*=mu,M=Math.tan(f-h),M=Math.sqrt(1+M*M),N*=M,R*=M,h&&(M=Math.tan(h),M=Math.sqrt(1+M*M),A*=M,O*=M)),A=an(A),O=an(O),N=an(N),R=an(R)):(A=p,R=v,O=N=0),(P&&!~(a+"").indexOf("px")||T&&!~(u+"").indexOf("px"))&&(P=ea(y,"x",a,"px"),T=ea(y,"y",u,"px")),(x||_||b||E)&&(P=an(P+x-(x*A+_*N)+b),T=an(T+_-(x*O+_*R)+E)),(s||i)&&(M=y.getBBox(),P=an(P+s/100*M.width),T=an(T+i/100*M.height)),M="matrix("+A+","+O+","+N+","+R+","+P+","+T+")",y.setAttribute("transform",M),k&&(y.style[Zt]=M)},jq=function(e,n,r,s,i){var a=360,u=Tn(i),c=parseFloat(i)*(u&&~i.indexOf("rad")?Fa:1),f=c-s,h=s+f+"deg",p,v;return u&&(p=i.split("_")[1],p==="short"&&(f%=a,f!==f%(a/2)&&(f+=f<0?a:-a)),p==="cw"&&f<0?f=(f+a*Ek)%a-~~(f/a)*a:p==="ccw"&&f>0&&(f=(f-a*Ek)%a-~~(f/a)*a)),e._pt=v=new Pr(e._pt,n,r,s,f,_q),v.e=h,v.u="deg",e._props.push(r),v},Ik=function(e,n){for(var r in n)e[r]=n[r];return e},Fq=function(e,n,r){var s=Ik({},r._gsap),i="perspective,force3D,transformOrigin,svgOrigin",a=r.style,u,c,f,h,p,v,y,x;s.svg?(f=r.getAttribute("transform"),r.setAttribute("transform",""),a[Zt]=n,u=tf(r,1),Jo(r,Zt),r.setAttribute("transform",f)):(f=getComputedStyle(r)[Zt],a[Zt]=n,u=tf(r,1),a[Zt]=f);for(c in Xi)f=s[c],h=u[c],f!==h&&i.indexOf(c)<0&&(y=qn(f),x=qn(h),p=y!==x?ea(r,c,f,x):parseFloat(f),v=parseFloat(h),e._pt=new Pr(e._pt,u,c,p,v-p,M_),e._pt.u=x||0,e._props.push(c));Ik(u,s)};kr("padding,margin,Width,Radius",function(t,e){var n="Top",r="Right",s="Bottom",i="Left",a=(e<3?[n,r,s,i]:[n+i,n+r,s+r,s+i]).map(function(u){return e<2?t+u:"border"+u+t});Im[e>1?"border"+t:t]=function(u,c,f,h,p){var v,y;if(arguments.length<4)return v=a.map(function(x){return Vi(u,x,f)}),y=v.join(" "),y.split(v[0]).length===5?v[0]:y;v=(h+"").split(" "),y={},a.forEach(function(x,_){return y[x]=v[_]=v[_]||v[(_-1)/2|0]}),u.init(c,y,p)}});var dA={name:"css",register:O_,targetTest:function(e){return e.style&&e.nodeType},init:function(e,n,r,s,i){var a=this._props,u=e.style,c=r.vars.startAt,f,h,p,v,y,x,_,b,E,k,P,T,A,O,N,R,M;Mx||O_(),this.styles=this.styles||sA(e),R=this.styles.props,this.tween=r;for(_ in n)if(_!=="autoRound"&&(h=n[_],!(Vr[_]&&KR(_,n,r,s,e,i)))){if(y=typeof h,x=Im[_],y==="function"&&(h=h.call(r,s,e,i),y=typeof h),y==="string"&&~h.indexOf("random(")&&(h=Qd(h)),x)x(this,e,_,h,r)&&(N=1);else if(_.substr(0,2)==="--")f=(getComputedStyle(e).getPropertyValue(_)+"").trim(),h+="",Bo.lastIndex=0,Bo.test(f)||(b=qn(f),E=qn(h),E?b!==E&&(f=ea(e,_,f,E)+E):b&&(h+=b)),this.add(u,"setProperty",f,h,s,i,0,0,_),a.push(_),R.push(_,0,u[_]);else if(y!=="undefined"){if(c&&_ in c?(f=typeof c[_]=="function"?c[_].call(r,s,e,i):c[_],Tn(f)&&~f.indexOf("random(")&&(f=Qd(f)),qn(f+"")||f==="auto"||(f+=Gr.units[_]||qn(Vi(e,_))||""),(f+"").charAt(1)==="="&&(f=Vi(e,_))):f=Vi(e,_),v=parseFloat(f),k=y==="string"&&h.charAt(1)==="="&&h.substr(0,2),k&&(h=h.substr(2)),p=parseFloat(h),_ in si&&(_==="autoAlpha"&&(v===1&&Vi(e,"visibility")==="hidden"&&p&&(v=0),R.push("visibility",0,u.visibility),Ho(this,u,"visibility",v?"inherit":"hidden",p?"inherit":"hidden",!p)),_!=="scale"&&_!=="transform"&&(_=si[_],~_.indexOf(",")&&(_=_.split(",")[0]))),P=_ in Xi,P){if(this.styles.save(_),M=h,y==="string"&&h.substring(0,6)==="var(--"){if(h=Ur(e,h.substring(4,h.indexOf(")"))),h.substring(0,5)==="calc("){var L=e.style.perspective;e.style.perspective=h,h=Ur(e,"perspective"),L?e.style.perspective=L:Jo(e,"perspective")}p=parseFloat(h)}if(T||(A=e._gsap,A.renderTransform&&!n.parseTransform||tf(e,n.parseTransform),O=n.smoothOrigin!==!1&&A.smooth,T=this._pt=new Pr(this._pt,u,Zt,0,1,A.renderTransform,A,0,-1),T.dep=1),_==="scale")this._pt=new Pr(this._pt,A,"scaleY",A.scaleY,(k?hu(A.scaleY,k+p):p)-A.scaleY||0,M_),this._pt.u=0,a.push("scaleY",_),_+="X";else if(_==="transformOrigin"){R.push(Tr,0,u[Tr]),h=Nq(h),A.svg?L_(e,h,0,O,0,this):(E=parseFloat(h.split(" ")[2])||0,E!==A.zOrigin&&Ho(this,A,"zOrigin",A.zOrigin,E),Ho(this,u,_,Mm(f),Mm(h)));continue}else if(_==="svgOrigin"){L_(e,h,1,O,0,this);continue}else if(_ in lA){jq(this,A,_,v,k?hu(v,k+h):h);continue}else if(_==="smoothOrigin"){Ho(this,A,"smooth",A.smooth,h);continue}else if(_==="force3D"){A[_]=h;continue}else if(_==="transform"){Fq(this,h,e);continue}}else _ in u||(_=Wu(_)||_);if(P||(p||p===0)&&(v||v===0)&&!yq.test(h)&&_ in u)b=(f+"").substr((v+"").length),p||(p=0),E=qn(h)||(_ in Gr.units?Gr.units[_]:b),b!==E&&(v=ea(e,_,f,E)),this._pt=new Pr(this._pt,P?A:u,_,v,(k?hu(v,k+p):p)-v,!P&&(E==="px"||_==="zIndex")&&n.autoRound!==!1?bq:M_),this._pt.u=E||0,P&&M!==h?(this._pt.b=f,this._pt.e=M,this._pt.r=wq):b!==E&&E!=="%"&&(this._pt.b=f,this._pt.r=xq);else if(_ in u)Mq.call(this,e,_,f,k?k+h:h);else if(_ in e)this.add(e,_,f||e[_],k?k+h:h,s,i);else if(_!=="parseTransform"){bx(_,h);continue}P||(_ in u?R.push(_,0,u[_]):typeof e[_]=="function"?R.push(_,2,e[_]()):R.push(_,1,f||e[_])),a.push(_)}}N&&JR(this)},render:function(e,n){if(n.tween._time||!Nx())for(var r=n._pt;r;)r.r(e,r.d),r=r._next;else n.styles.revert()},get:Vi,aliases:si,getSetter:function(e,n,r){var s=si[n];return s&&s.indexOf(",")<0&&(n=s),n in Xi&&n!==Tr&&(e._gsap.x||Vi(e,"x"))?r&&Sk===r?n==="scale"?kq:Cq:(Sk=r||{})&&(n==="scale"?Pq:Tq):e.style&&!_x(e.style[n])?Sq:~n.indexOf("-")?Eq:Ax(e,n)},core:{_removeProperty:Jo,_getMatrix:Lx}};Rr.utils.checkPrefix=Wu;Rr.core.getStyleSaver=sA;(function(t,e,n,r){var s=kr(t+","+e+","+n,function(i){Xi[i]=1});kr(e,function(i){Gr.units[i]="deg",lA[i]=1}),si[s[13]]=t+","+e,kr(r,function(i){var a=i.split(":");si[a[1]]=s[a[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");kr("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){Gr.units[t]="px"});Rr.registerPlugin(dA);var bs=Rr.registerPlugin(dA)||Rr;bs.core.Tween;const Tp="/assets/logo-animation",b1=1280,Vq=[{id:"eraser",src:`${Tp}/eraser.png`,cssW:189,cssH:74,rot:-90,fit:337,localX:60,localY:168,seaX:.2,seaY:.27,seaRot:-8},{id:"clasp",src:`${Tp}/clasp.png`,cssW:170,cssH:170,rot:-248,fit:205,flip:!0,localX:188,localY:97,seaX:.8,seaY:.24,seaRot:-18},{id:"ball",src:`${Tp}/playdough.png`,cssW:236,cssH:206,rot:5,fit:150,localX:182,localY:277,seaX:.52,seaY:.79,seaRot:6}],$q=[{k:"pot",x:.075,y:.2,r:-12,w:152},{k:"chair",x:.1,y:.52,r:8,w:150},{k:"mug",x:.11,y:.84,r:-6,w:140},{k:"cart",x:.3,y:.13,r:10,w:178},{k:"terracotta-1",x:.345,y:.45,r:-18,w:122},{k:"pitcher",x:.285,y:.71,r:14,w:128},{k:"desk",x:.46,y:.25,r:-8,w:198},{k:"startac",x:.475,y:.55,r:16,w:140},{k:"vhsplant",x:.4,y:.9,r:-6,w:188},{k:"bubblephone",x:.63,y:.12,r:12,w:150},{k:"terracotta-2",x:.61,y:.43,r:20,w:122},{k:"pot",x:.675,y:.68,r:14,w:140},{k:"chair",x:.71,y:.91,r:-12,w:140},{k:"mug",x:.91,y:.15,r:8,w:136},{k:"cart",x:.905,y:.47,r:-10,w:166},{k:"startac",x:.88,y:.76,r:18,w:136}],D_=({className:t})=>{const e=g.useRef(null),n=g.useRef(null),r=g.useRef(null);return g.useEffect(()=>{const s=e.current,i=n.current,a=r.current;if(!s||!i||!a)return;const u=window.matchMedia("(prefers-reduced-motion: reduce)").matches,c=(E,k)=>E+Math.random()*(k-E);let f=null,h,p=1;const v=Vq.map(E=>({...E})),y=()=>{s.querySelectorAll(".la-obj").forEach(R=>R.remove());const E=s.getBoundingClientRect(),k=E.width||b1,P=E.height||b1*.64;p=k/b1,i.style.width=`${242*p}px`,i.style.height=`${250*p}px`;const A=250*p/337,O=[],N=(R,M,L)=>{const D=document.createElement("div");return D.className="la-obj",D.style.width=`${M}px`,D.innerHTML=`<img src="${R}" alt="" style="${L?"transform:scaleX(-1)":""}">`,s.appendChild(D),D};return $q.forEach((R,M)=>{const L=R.w*p,D=N(`${Tp}/sea/${R.k}.png`,L,M%2===0);bs.set(D,{x:R.x*k-L/2,y:R.y*P-L/2,rotation:R.r,opacity:1,scale:0,transformOrigin:"50% 50%"}),O.push({el:D,hero:!1,rest:1})}),v.forEach(R=>{const M=R.cssW*p;R.el=N(R.src,M,!!R.flip),R.finalScale=R.fit*A/(R.cssW*p),bs.set(R.el,{x:R.seaX*k-M/2,y:R.seaY*P-R.cssH*p/2,rotation:R.seaRot,opacity:1,scale:0,transformOrigin:"50% 50%",zIndex:30}),O.push({el:R.el,hero:!0,rest:150/R.cssW})}),O},x=(E,k)=>{const P=s.getBoundingClientRect(),T=a.getBoundingClientRect();return{x:T.left-P.left+E/326*T.width,y:T.top-P.top+k/337*T.height}},_=()=>{f&&f.revert();const E=y();if(u){f=bs.context(()=>{E.filter(T=>!T.hero).forEach(T=>bs.set(T.el,{scale:0})),v.forEach(T=>{if(!T.el)return;const A=x(T.localX,T.localY);bs.set(T.el,{x:A.x-T.cssW*p/2,y:A.y-T.cssH*p/2,rotation:T.rot,scale:T.finalScale})})},s);return}const k=[],P=[];f=bs.context(()=>{const T=bs.timeline();T.to(E.map(A=>A.el),{scale:A=>E[A].rest,duration:.5,ease:"steps(4)",stagger:{each:.045,from:"random"}}),T.add(()=>{E.forEach(({el:A,hero:O},N)=>{const R=O?k:P,M=N%2?1:-1;R.push(bs.to(A,{rotation:"+="+c(2.5,6)*M,duration:c(.5,.9),repeat:-1,yoyo:!0,ease:"steps(2)",delay:c(0,.4)}),bs.to(A,{y:"+="+c(5,11)*M,x:"+="+c(4,9)*-M,duration:c(.7,1.2),repeat:-1,yoyo:!0,ease:"steps(3)",delay:c(0,.4)}))})},"<0.1"),T.to({},{duration:1.1}),T.add("pick"),v.forEach((A,O)=>{A.el&&T.to(A.el,{scale:150/A.cssW*1.2,duration:.28,ease:"steps(3)",yoyo:!0,repeat:1},"pick+="+O*.08)}),T.add("clear","pick+=0.7"),T.add(()=>P.forEach(A=>A.kill()),"clear"),T.to(E.filter(A=>!A.hero).map(A=>A.el),{scale:0,rotation:"+=40",duration:.5,ease:"steps(5)",overwrite:"auto",stagger:{each:.025,from:"random"}},"clear"),T.add("assemble","clear+=0.25"),T.add(()=>k.forEach(A=>A.kill()),"assemble"),v.forEach((A,O)=>{if(!A.el||A.finalScale===void 0)return;const N=x(A.localX,A.localY);T.to(A.el,{x:N.x-A.cssW*p/2,y:N.y-A.cssH*p/2,rotation:A.rot,scale:A.finalScale,duration:1.05,ease:"steps(9)",overwrite:"auto"},"assemble+="+O*.12)}),v.forEach(A=>{!A.el||A.finalScale===void 0||T.to(A.el,{scale:A.finalScale*1.03,duration:.16,ease:"steps(2)",yoyo:!0,repeat:1},"assemble+=1.45")})},s)};bs.ticker.fps(12),_();const b=()=>{clearTimeout(h),h=setTimeout(_,250)};return window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b),clearTimeout(h),f==null||f.revert(),s.querySelectorAll(".la-obj").forEach(E=>E.remove())}},[]),S.jsx("div",{ref:e,className:`la-scene ${t??""}`,children:S.jsx("div",{ref:n,className:"la-logo-stage",children:S.jsx("svg",{ref:r,className:"la-mark",viewBox:"0 0 326 337","aria-hidden":"true"})})})},Hq=Object.freeze(Object.defineProperty({__proto__:null,default:D_},Symbol.toStringTag,{value:"Module"})),Mk=({isSigningIn:t})=>t?S.jsxs(S.Fragment,{children:[S.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent"}),S.jsx("span",{children:"Signing in..."})]}):S.jsxs(S.Fragment,{children:[S.jsx("img",{src:"https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg",alt:"Google",className:"h-5 w-5"}),S.jsx("span",{children:"Sign in with Google"})]}),fA=({isSigningIn:t,onStartSignIn:e,errorMessage:n=null,isDesktopShell:r=!1,displayMode:s="full"})=>s==="modal"?S.jsxs("div",{className:"glass-panel relative w-full max-w-sm overflow-hidden rounded-2xl border border-white/10 font-main text-white shadow-2xl",children:[S.jsx(D_,{className:"relative z-0 h-44 w-full"}),S.jsxs("div",{className:"relative z-10 flex flex-col items-center gap-6 px-8 pb-12 pt-8",children:[S.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[S.jsx("h1",{className:"text-xl font-medium text-content",children:"Welcome to Rivet"}),S.jsx("p",{className:"text-sm leading-relaxed text-content-muted",children:"Rivet understands your references, and then explores dozens of design directions with you."})]}),S.jsx("button",{onClick:e,disabled:t,className:"glass-panel active-push flex cursor-pointer items-center gap-3 rounded-xl px-8 py-3.5 text-sm font-medium transition-colors hover:bg-main-hover disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(Mk,{isSigningIn:t})}),n?S.jsx("p",{className:"text-center text-xs text-red-200",children:n}):null]})]}):S.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-white font-main text-[#18181b]",children:[r?S.jsx("div",{className:"fixed left-0 right-0 top-0 z-10 h-8",style:{WebkitAppRegion:"drag"}}):null,S.jsx(D_,{className:"absolute inset-0 z-0"}),S.jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-10 flex flex-col items-center gap-5 pb-[14vh]",children:[S.jsxs("div",{className:"flex flex-col items-center gap-2 px-6 text-center",children:[S.jsx("h1",{className:"text-xl font-medium tracking-tight text-[#18181b]",children:"Welcome to Rivet"}),S.jsx("p",{className:"max-w-md text-sm leading-relaxed text-[#71717a]",children:"Rivet understands your references, and then explores dozens of design directions with you."})]}),S.jsx("button",{onClick:e,disabled:t,className:"active-push pointer-events-auto flex cursor-pointer items-center gap-3 rounded-full border border-black/10 bg-white px-8 py-3.5 text-sm font-medium text-[#18181b] shadow-[0_8px_24px_rgba(40,33,28,0.14)] transition-colors hover:bg-[#faf9f7] disabled:cursor-not-allowed disabled:opacity-50",children:S.jsx(Mk,{isSigningIn:t})}),n?S.jsx("p",{className:"text-center text-xs text-red-500",children:n}):null]})]}),zq="data:image/svg+xml,%3csvg%20width='94'%20height='24'%20viewBox='0%200%2094%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M-0.000156164%2023.832V7.704H5.11184L6.47984%208.424C7.58384%207.704%209.04784%207.344%2010.8718%207.344C12.0718%207.344%2013.1278%207.476%2014.0398%207.74C14.9518%207.98%2015.6838%208.244%2016.2358%208.532C16.8118%208.82%2017.1718%209.024%2017.3158%209.144L15.5158%2013.824C15.2758%2013.656%2014.8198%2013.428%2014.1478%2013.14C13.4998%2012.852%2012.7318%2012.588%2011.8438%2012.348C10.9558%2012.084%2010.0198%2011.952%209.03584%2011.952H8.63984C7.96784%2011.952%207.45184%2012.072%207.09184%2012.312C6.73184%2012.528%206.55184%2013.02%206.55184%2013.788V23.832H-0.000156164ZM23.464%206.156C21.04%206.156%2019.828%205.124%2019.828%203.06C19.828%201.908%2020.128%201.116%2020.728%200.684C21.352%200.227999%2022.264%20-1.43051e-06%2023.464%20-1.43051e-06C24.736%20-1.43051e-06%2025.66%200.227999%2026.236%200.684C26.836%201.116%2027.136%201.908%2027.136%203.06C27.136%205.124%2025.912%206.156%2023.464%206.156ZM20.152%2023.832V7.704H26.704V23.832H20.152ZM37.4767%2023.832L29.6647%207.704H36.9007L40.3207%2016.524L41.2567%2019.116H41.6167L42.5527%2016.524L46.0087%207.704H53.1727L52.5967%209.9L45.4327%2023.832H37.4767ZM61.1953%2023.832C59.6113%2023.832%2058.3873%2023.604%2057.5233%2023.148C56.6833%2022.692%2056.1073%2022.068%2055.7953%2021.276C55.4833%2020.46%2055.3273%2019.524%2055.3273%2018.468V13.032C55.3273%2012.072%2055.4833%2011.196%2055.7953%2010.404C56.1313%209.588%2056.7193%208.94%2057.5593%208.46C58.3993%207.956%2059.6113%207.704%2061.1953%207.704H68.6473C70.5193%207.704%2071.9473%207.932%2072.9313%208.388C73.9393%208.82%2074.6233%209.444%2074.9833%2010.26C75.3673%2011.052%2075.5593%2011.976%2075.5593%2013.032V17.64H69.2593C67.0993%2017.64%2065.4553%2017.592%2064.3273%2017.496C63.2233%2017.4%2062.4433%2017.34%2061.9873%2017.316V17.856C61.9633%2018.816%2062.5393%2019.296%2063.7153%2019.296H64.8313C66.7513%2019.296%2068.5273%2019.26%2070.1593%2019.188C71.7913%2019.092%2073.0033%2019.008%2073.7953%2018.936L75.9553%2022.356C75.9553%2022.596%2075.7513%2022.824%2075.3433%2023.04C74.9353%2023.256%2074.2153%2023.448%2073.1833%2023.616C72.1753%2023.76%2070.7353%2023.832%2068.8633%2023.832H61.1953ZM61.9873%2014.184H68.8993V13.68C68.8993%2013.2%2068.8513%2012.864%2068.7553%2012.672C68.6833%2012.48%2068.4313%2012.36%2067.9993%2012.312C67.5673%2012.264%2066.8353%2012.24%2065.8033%2012.24H63.7153C62.5633%2012.24%2061.9873%2012.72%2061.9873%2013.68V14.184ZM85.8224%2023.832C83.9984%2023.832%2082.7504%2023.448%2082.0784%2022.68C81.4064%2021.912%2081.0704%2020.76%2081.0704%2019.224V12.24H78.1184V7.704H79.6304C80.0384%207.704%2080.3624%207.632%2080.6024%207.488C80.8664%207.32%2081.0344%207.032%2081.1064%206.624L81.7904%202.772H87.6944V7.704H93.7064V12.24H87.6944V17.82C87.6944%2018.42%2087.8384%2018.816%2088.1264%2019.008C88.4144%2019.2%2088.8464%2019.296%2089.4224%2019.296H93.0224L93.7424%2023.472C93.2384%2023.544%2092.4704%2023.628%2091.4384%2023.724C90.4064%2023.796%2089.2784%2023.832%2088.0544%2023.832H85.8224Z'%20fill='%23FF3300'/%3e%3c/svg%3e",Uq=({message:t})=>S.jsx("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-[#1c1c20] font-main text-white",children:S.jsxs("div",{className:"flex flex-col items-center gap-10",children:[S.jsx("img",{src:zq,alt:"Rivet",className:"h-8 w-auto object-contain"}),S.jsxs("div",{className:"glass-panel flex items-center gap-3 rounded-xl px-8 py-3.5 text-sm font-medium",children:[S.jsx(r0,{className:"h-5 w-5 shrink-0 animate-spin text-primary",weight:"bold"}),S.jsx("span",{children:t})]})]})}),Bq="data:image/svg+xml,%3csvg%20width='548'%20height='565'%20viewBox='0%200%20548%20565'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M136.53%20-0.00177124C170.301%20-0.00177124%20197.687%2027.3551%20197.724%2061.1255L198.089%20394.976C198.189%20486.214%20124.253%20560.23%2033.0153%20560.23C14.7818%20560.23%200.000557184%20545.449%200.000557184%20527.216V61.1923C0.000557184%2027.3957%2027.3981%20-0.00177124%2061.1947%20-0.00177124H136.53Z'%20fill='white'/%3e%3cpath%20d='M271.092%20463.876C271.092%20530.762%20310.368%20564.205%20388.919%20564.205C468.248%20564.205%20507.913%20530.762%20507.913%20463.876C507.913%20426.545%20498.191%20400.88%20478.748%20386.88C460.082%20372.103%20430.139%20364.715%20388.919%20364.715C350.032%20364.715%20320.478%20372.103%20300.257%20386.88C280.814%20400.88%20271.092%20426.545%20271.092%20463.876Z'%20fill='white'/%3e%3cpath%20d='M405.25%200.917969C408.273%200.917973%20411.331%201.11183%20414.358%201.66895C437.891%205.99962%20471.151%2018.8698%20498.612%2044.5137C526.065%2070.1496%20547.676%20108.515%20547.992%20163.691C547.992%20163.693%20547.994%20163.695%20547.997%20163.695C547.999%20163.695%20548.001%20163.697%20548.001%20163.7L547.996%20164.612L548.001%20165.526C548.001%20165.528%20547.999%20165.53%20547.997%20165.53C547.994%20165.53%20547.992%20165.532%20547.992%20165.535C547.665%20222.498%20524.643%20261.54%20495.935%20287.156C467.223%20312.776%20432.863%20324.939%20409.917%20328.291C409.844%20328.302%20409.769%20328.308%20409.695%20328.308H283.146C254.52%20328.308%20231.314%20305.102%20231.314%20276.477C231.315%20244.265%20255.799%20218.161%20287.447%20213.026C309.663%20209.422%20329.612%20204.399%20344.084%20196.322C354.361%20190.586%20359.717%20184.074%20362.521%20178.421C365.332%20172.756%20365.636%20167.843%20365.636%20165.225V163.994C365.635%20161.374%20365.33%20156.465%20362.521%20150.805C359.717%20145.152%20354.361%20138.639%20344.084%20132.903C329.612%20124.826%20309.663%20119.803%20287.447%20116.199C255.799%20111.065%20231.315%2084.9602%20231.314%2052.749C231.314%2024.1235%20254.52%200.917969%20283.146%200.917969H405.25Z'%20fill='white'/%3e%3c/svg%3e",Nm=44,Xc=8,rp=16,Wq=4,Nk=-18,Gq=.18,Kq=[.22,1,.36,1],Ok=.92,qq=1,Zq=.95,Yq=.4,Qq=[.19,1,.22,1],S1=0,Xq=1,Jq=0,eZ=0,tZ=0,hA=({position:t,viewport:e,boundsLeft:n=0})=>{const r=n+Xc,s=Math.max(r,e.width-Nm-Xc),i=Math.max(Xc,e.height-Nm-Xc);return{x:Math.min(s,Math.max(r,t.x)),y:Math.min(i,Math.max(Xc,t.y))}},Dx=()=>({width:window.innerWidth,height:window.innerHeight}),nZ=({position:t,boundsLeftPx:e=0})=>hA({position:t,viewport:Dx(),boundsLeft:e}),rZ=()=>{if(typeof window>"u")return{x:rp,y:rp};const t=Dx();return{x:t.width-Nm-rp,y:t.height-Nm-rp}},sZ=({deltaX:t,deltaY:e})=>Math.hypot(t,e)>=Wq,iZ=t=>t.button===void 0||t.button<=tZ,Lk=t=>{const e=t.nativeEvent;return{x:Number.isFinite(t.clientX)?t.clientX:e.clientX,y:Number.isFinite(t.clientY)?t.clientY:e.clientY}},oZ=({isVisible:t,isPanelOpen:e,isReducedMotion:n,position:r,dragBoundsLeftPx:s=0,onToggle:i,onPositionChange:a})=>{const u=g.useRef(null),c=g.useRef(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),y=n?!1:{opacity:S1,scale:Ok,x:Nk},x=n?{opacity:S1}:{opacity:S1,scale:Ok,x:Nk},_=n?{duration:eZ}:{duration:Gq,ease:Kq,scale:{duration:Yq,ease:Qq}},b=g.useCallback(()=>{const A=u.current;A&&(c.current=A.hasMoved),u.current=null,h(!1)},[]),E=g.useCallback(A=>{const O=u.current;if(!O)return;const N=Lk(A),R=N.x-O.startPointer.x,M=N.y-O.startPointer.y,L=O.hasMoved||sZ({deltaX:R,deltaY:M});u.current={...O,hasMoved:L},L&&a(hA({position:{x:O.startPosition.x+R,y:O.startPosition.y+M},viewport:Dx(),boundsLeft:s}))},[a,s]),k=g.useCallback(A=>{if(u.current||!iZ(A))return;const O=Lk(A);u.current={startPointer:O,startPosition:r,hasMoved:!1},h(!0)},[r]),P=g.useCallback(()=>{if(c.current){c.current=!1;return}i()},[i]),T=e?"Close panel":"Open panel";return S.jsxs(S.Fragment,{children:[f?S.jsx("div",{className:"fixed inset-0 z-40 cursor-grabbing","data-cy":"rivet-panel-launcher-drag-surface",onPointerMove:E,onPointerUp:b,onPointerCancel:b,onMouseMove:E,onMouseUp:b}):null,S.jsx(Gi,{children:t?S.jsx(Fo,{label:T,side:"top",forceOpen:p&&!f?void 0:!1,children:S.jsx(sl.button,{type:"button","aria-label":T,"data-cy":"reopen-panel",onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),initial:y,animate:{opacity:Xq,scale:qq,x:Jq},whileTap:{scale:Zq},exit:x,transition:_,onPointerDown:k,onMouseDown:k,onPointerMove:E,onPointerUp:b,onPointerCancel:b,onMouseMove:E,onMouseUp:b,onClick:P,className:`bg-main absolute z-50 flex h-11 w-11 touch-none select-none items-center justify-center overflow-hidden rounded-full border border-white/10 shadow-[0_2px_8px_rgba(0,0,0,0.2),0_4px_16px_rgba(0,0,0,0.1)] transition-[background-color,box-shadow] duration-150 hover:bg-[#2a2a2a] focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75 ${f?"cursor-grabbing shadow-[0_4px_12px_rgba(0,0,0,0.28),0_10px_24px_rgba(0,0,0,0.16)]":"cursor-grab"}`,style:{left:r.x,top:r.y,willChange:"left, top, transform"},children:S.jsx("img",{src:Bq,alt:"","aria-hidden":"true",draggable:!1,className:"h-4 w-4"})})}):null})]})},E1=ds("useConfig"),aZ=300*1e3,lZ=1800*1e3,uZ=60*1e3,cZ=300*1e3,dZ=()=>{var t;return typeof window>"u"?null:((t=window.__RIVET_BOOTSTRAP__)==null?void 0:t.queueAccessToken)??null},fZ=()=>{var t;return typeof window>"u"?null:((t=window.__RIVET_BOOTSTRAP__)==null?void 0:t.agentApplyMode)??null},hZ=t=>({...GT,...t??{}}),pZ=()=>{const t=Je(p_),e=st(p_),n=st(r5),r=st(s5),s=st(s0),i=st(AU),a=st(n5),u=st(TU),c=st(pf),f=st(YT),h=st(t5),p=g.useCallback(k=>{a(k.agentModeAvailable),f({name:k.name??null,email:k.email??null}),h(k.demoMode===!0),k.isMCPSession&&n(!0),k.mcpEditor&&r(k.mcpEditor),s(k.agentApplyMode??fZ()??null),i(k.queueAccessToken??dZ())},[s,a,h,n,r,i,f]),v=U1({queryKey:["rivet-config"],queryFn:async()=>{const k=await fetch("/api/config");if(!k.ok)throw new Error(`Failed to fetch config: ${k.statusText}`);return await k.json()},staleTime:aZ,gcTime:lZ}),y=U1({queryKey:["rivet-feature-flags"],queryFn:async()=>{const k=await fetch("/api/feature-flags");if(!k.ok)throw new Error(`Failed to fetch feature flags: ${k.statusText}`);return await k.json()},staleTime:uZ,gcTime:cZ}),{refetch:x}=v,{refetch:_}=y;g.useLayoutEffect(()=>{v.data&&(p(v.data),c(!1),E1.info("Config loaded:",v.data)),y.data&&(e(hZ(y.data.featureFlags)),u(!0))},[v.data,y.data,p,c,e,u]),g.useLayoutEffect(()=>{v.error&&(u(!0),c(!1),E1.warn("Failed to load config:",v.error instanceof Error?v.error.message:"Failed to load config")),y.error&&(u(!0),E1.warn("Failed to load feature flags:",y.error instanceof Error?y.error.message:"Failed to load feature flags"))},[v.error,y.error,c,u]);const b=g.useCallback(async()=>{const[k]=await Promise.all([x(),_()]);return k.data?k.data:null},[x,_]);let E=null;return v.error instanceof Error?E=v.error.message:v.error&&(E="Failed to load config"),{config:v.data??null,featureFlags:t,loading:v.isPending||!v.error&&y.isPending,error:E,refetchConfig:b}},Rp="rivet_just_signed_in",Zl=ds("useOAuthCallback"),mZ="https://rivet-proxy.onrender.com",gZ=()=>{const[t,e]=g.useState({isProcessing:!1,isComplete:!1,error:null});return g.useEffect(()=>{const n=new AbortController;let r=!1;return(async()=>{var u,c,f;const i=window.location.hash,a=window.location.search;if(!(!i||!i.includes("access_token"))&&!r){e({isProcessing:!0,isComplete:!1,error:null});try{Zl.info("Processing OAuth callback...");const h=new URLSearchParams(i.substring(1)),p=h.get("access_token"),v=h.get("refresh_token"),x=new URLSearchParams(a).get("session");if(!p)throw new Error("No access token found in URL");if(!x)throw new Error("No session ID found in URL");Zl.info(`Completing OAuth with session: ${x}`);const _=await fetch(`${mZ}/api/auth/google/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:x,accessToken:p,refreshToken:v}),signal:n.signal}),b=await _.json();if(!_.ok||!b.success)throw new Error(b.error||b.message||"Failed to complete authentication");if(Zl.info("OAuth authentication completed successfully"),r)return;if((u=b.user)!=null&&u.id?(Pe.identify(b.user.id,{...b.user.email?{email:b.user.email}:{}}),b.user.email&&Pe.alias(b.user.email,b.user.id)):(c=b.user)!=null&&c.email&&Pe.identify(b.user.email,{email:b.user.email}),(f=b.user)!=null&&f.email&&p)try{const k=await fetch("/api/auth/store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:b.user.email,token:p,refreshToken:v,userId:b.user.id}),signal:n.signal});k.ok||Zl.warn(`Local auth store returned ${k.status}`)}catch(k){if(r)return;Zl.warn("Failed to store auth locally:",k)}if(r)return;window.sessionStorage.setItem(Rp,"1");const E=window.location.pathname;window.history.replaceState({},document.title,E),e({isProcessing:!1,isComplete:!0,error:null})}catch(h){if(r)return;const p=h instanceof Error?h.message:"Unknown error occurred";Zl.warn("OAuth callback error:",h),e({isProcessing:!1,isComplete:!1,error:p})}}})(),()=>{r=!0,n.abort()}},[]),t},C1=ds("useAgentVariantsSession"),vZ=t=>typeof t.pendingCount=="number"&&t.pendingCount===0&&(t.pendingVariantRequests??0)===0&&(t.leasedVariantRequests??0)===0&&(t.activeLeases??[]).length===0,Dk=(t,e,n)=>{e.size===0&&!n||t.set(zd,r=>{if(r.size===0)return r;const s=new Map(r);let i=!1;for(const[a,u]of r)u.status==="sending"&&u.variantRequestId&&(e.has(u.variantRequestId)||n&&u.variantRequest!==void 0)&&(s.delete(a),i=!0);return i?s:r})},yZ=(t,e)=>{var s;if(t.size===0)return t;let n=!1;const r=new Map(t);for(const[i,a]of t){if(a.status!=="sending"||!a.awaitingSnapshotOutcome||a.variantRequest!==void 0)continue;const u=a.target;if(!u||u.kind!=="variant"||u.sessionId!==e.sessionId)continue;const c=(s=e.variants.find(f=>f.workItemId===u.variantId))==null?void 0:s.refinement;c&&(c.status==="succeeded"?(r.set(i,{...a,status:"complete",awaitingSnapshotOutcome:void 0}),n=!0):(c.status==="failed"||c.status==="cancelled")&&(r.set(i,{...a,status:"error",awaitingSnapshotOutcome:void 0}),n=!0))}return n?r:t},_Z=({enabled:t=!0}={})=>{const e=st(hf),n=st(KT),r=st(SU),s=st(JT),i=st(PU),a=m2(),u=g.useRef(null);g.useEffect(()=>{if(!t)return;const c=new EventSource("/api/variants/events");return c.onmessage=f=>{try{const h=JSON.parse(f.data),p=u.current;if(h.active){const x=new Set(h.variants.map(_=>_.requestId).filter(_=>!!_));s(_=>_.filter(E=>!x.has(E.requestId))),Dk(a,x,!1),a.set(zd,_=>{let b=_;for(const E of h.variants){const k=E.adoptedSource;k&&(b=kU(b,{kind:"variant",sessionId:k.sessionId,variantId:k.variantId},{kind:"variant",sessionId:h.sessionId,variantId:E.workItemId}))}return b}),a.set(zd,_=>yZ(_,h)),h.sessionId!==u.current&&(u.current=h.sessionId,n(!0),r("directions"))}else u.current=null,Dk(a,new Set,vZ(h));e(h);const v=!h.active&&p!==null,y=h.active&&h.sessionId!==p;if(y&&fetch(`/api/variants/${h.sessionId}/preview-port`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({variantId:null})}).catch(x=>C1.warn("failed to reset preview-port on session switch",x)),v||y){const x=new Set;if(h.active)for(const b of h.variants)x.add($d({kind:"variant",sessionId:h.sessionId,variantId:b.workItemId}));const _=a.get(Zo);for(const b of[_==null?void 0:_.left,_==null?void 0:_.right])b&&x.add($d({kind:"variant",sessionId:b.sessionId,variantId:b.variantId}));i(x)}}catch(h){C1.warn("failed to parse SSE event payload",h)}},c.onerror=f=>{C1.warn("SSE error (auto-reconnects)",f)},()=>{c.close()}},[t,e,n,r,s,i,a])};function pA(t){const e=t+"CollectionProvider",[n,r]=na(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=_=>{const{scope:b,children:E}=_,k=g.useRef(null),P=g.useRef(new Map).current;return S.jsx(s,{scope:b,itemMap:P,collectionRef:k,children:E})};a.displayName=e;const u=t+"CollectionSlot",c=jd(u),f=g.forwardRef((_,b)=>{const{scope:E,children:k}=_,P=i(u,E),T=Yt(b,P.collectionRef);return S.jsx(c,{ref:T,children:k})});f.displayName=u;const h=t+"CollectionItemSlot",p="data-radix-collection-item",v=jd(h),y=g.forwardRef((_,b)=>{const{scope:E,children:k,...P}=_,T=g.useRef(null),A=Yt(b,T),O=i(h,E);return g.useEffect(()=>(O.itemMap.set(T,{ref:T,...P}),()=>void O.itemMap.delete(T))),S.jsx(v,{[p]:"",ref:A,children:k})});y.displayName=h;function x(_){const b=i(t+"CollectionConsumer",_);return g.useCallback(()=>{const k=b.collectionRef.current;if(!k)return[];const P=Array.from(k.querySelectorAll(`[${p}]`));return Array.from(b.itemMap.values()).sort((O,N)=>P.indexOf(O.ref.current)-P.indexOf(N.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},x,r]}var _0="Collapsible",[xZ,mA]=na(_0),[wZ,jx]=xZ(_0),gA=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...u}=t,[c,f]=hl({prop:r,defaultProp:s??!1,onChange:a,caller:_0});return S.jsx(wZ,{scope:n,disabled:i,contentId:il(),open:c,onOpenToggle:g.useCallback(()=>f(h=>!h),[f]),children:S.jsx(Rt.div,{"data-state":Vx(c),"data-disabled":i?"":void 0,...u,ref:e})})});gA.displayName=_0;var vA="CollapsibleTrigger",yA=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=jx(vA,n);return S.jsx(Rt.button,{type:"button","aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open||!1,"data-state":Vx(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Et(t.onClick,s.onOpenToggle)})});yA.displayName=vA;var Fx="CollapsibleContent",_A=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=jx(Fx,t.__scopeCollapsible);return S.jsx(Ji,{present:n||s.open,children:({present:i})=>S.jsx(bZ,{...r,ref:e,present:i})})});_A.displayName=Fx;var bZ=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=jx(Fx,n),[u,c]=g.useState(r),f=g.useRef(null),h=Yt(e,f),p=g.useRef(0),v=p.current,y=g.useRef(0),x=y.current,_=a.open||u,b=g.useRef(_),E=g.useRef(void 0);return g.useEffect(()=>{const k=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(k)},[]),ai(()=>{const k=f.current;if(k){E.current=E.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const P=k.getBoundingClientRect();p.current=P.height,y.current=P.width,b.current||(k.style.transitionDuration=E.current.transitionDuration,k.style.animationName=E.current.animationName),c(r)}},[a.open,r]),S.jsx(Rt.div,{"data-state":Vx(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!_,...i,ref:h,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...t.style},children:_&&s})});function Vx(t){return t?"open":"closed"}var SZ=gA,EZ=yA,CZ=_A,kZ=g.createContext(void 0);function xA(t){const e=g.useContext(kZ);return t||e||"ltr"}var As="Accordion",PZ=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[$x,TZ,RZ]=pA(As),[x0]=na(As,[RZ,mA]),Hx=mA(),wA=g.forwardRef((t,e)=>{const{type:n,...r}=t,s=r,i=r;return S.jsx($x.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?S.jsx(NZ,{...i,ref:e}):S.jsx(MZ,{...s,ref:e})})});wA.displayName=As;var[bA,AZ]=x0(As),[SA,IZ]=x0(As,{collapsible:!1}),MZ=g.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...a}=t,[u,c]=hl({prop:n,defaultProp:r??"",onChange:s,caller:As});return S.jsx(bA,{scope:t.__scopeAccordion,value:g.useMemo(()=>u?[u]:[],[u]),onItemOpen:c,onItemClose:g.useCallback(()=>i&&c(""),[i,c]),children:S.jsx(SA,{scope:t.__scopeAccordion,collapsible:i,children:S.jsx(EA,{...a,ref:e})})})}),NZ=g.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[a,u]=hl({prop:n,defaultProp:r??[],onChange:s,caller:As}),c=g.useCallback(h=>u((p=[])=>[...p,h]),[u]),f=g.useCallback(h=>u((p=[])=>p.filter(v=>v!==h)),[u]);return S.jsx(bA,{scope:t.__scopeAccordion,value:a,onItemOpen:c,onItemClose:f,children:S.jsx(SA,{scope:t.__scopeAccordion,collapsible:!0,children:S.jsx(EA,{...i,ref:e})})})}),[OZ,w0]=x0(As),EA=g.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...a}=t,u=g.useRef(null),c=Yt(u,e),f=TZ(n),p=xA(s)==="ltr",v=Et(t.onKeyDown,y=>{var R;if(!PZ.includes(y.key))return;const x=y.target,_=f().filter(M=>{var L;return!((L=M.ref.current)!=null&&L.disabled)}),b=_.findIndex(M=>M.ref.current===x),E=_.length;if(b===-1)return;y.preventDefault();let k=b;const P=0,T=E-1,A=()=>{k=b+1,k>T&&(k=P)},O=()=>{k=b-1,k<P&&(k=T)};switch(y.key){case"Home":k=P;break;case"End":k=T;break;case"ArrowRight":i==="horizontal"&&(p?A():O());break;case"ArrowDown":i==="vertical"&&A();break;case"ArrowLeft":i==="horizontal"&&(p?O():A());break;case"ArrowUp":i==="vertical"&&O();break}const N=k%E;(R=_[N].ref.current)==null||R.focus()});return S.jsx(OZ,{scope:n,disabled:r,direction:s,orientation:i,children:S.jsx($x.Slot,{scope:n,children:S.jsx(Rt.div,{...a,"data-orientation":i,ref:c,onKeyDown:r?void 0:v})})})}),Om="AccordionItem",[LZ,zx]=x0(Om),CA=g.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...s}=t,i=w0(Om,n),a=AZ(Om,n),u=Hx(n),c=il(),f=r&&a.value.includes(r)||!1,h=i.disabled||t.disabled;return S.jsx(LZ,{scope:n,open:f,disabled:h,triggerId:c,children:S.jsx(SZ,{"data-orientation":i.orientation,"data-state":IA(f),...u,...s,ref:e,disabled:h,open:f,onOpenChange:p=>{p?a.onItemOpen(r):a.onItemClose(r)}})})});CA.displayName=Om;var kA="AccordionHeader",PA=g.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=w0(As,n),i=zx(kA,n);return S.jsx(Rt.h3,{"data-orientation":s.orientation,"data-state":IA(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:e})});PA.displayName=kA;var j_="AccordionTrigger",TA=g.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=w0(As,n),i=zx(j_,n),a=IZ(j_,n),u=Hx(n);return S.jsx($x.ItemSlot,{scope:n,children:S.jsx(EZ,{"aria-disabled":i.open&&!a.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...u,...r,ref:e})})});TA.displayName=j_;var RA="AccordionContent",AA=g.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=w0(As,n),i=zx(RA,n),a=Hx(n);return S.jsx(CZ,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...a,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});AA.displayName=RA;function IA(t){return t?"open":"closed"}var MA=wA,DZ=CA,jZ=PA,FZ=TA,VZ=AA;/**
|
|
129
|
-
* @license lucide-react v1.
|
|
129
|
+
* @license lucide-react v1.25.0 - ISC
|
|
130
130
|
*
|
|
131
131
|
* This source code is licensed under the ISC license.
|
|
132
132
|
* See the LICENSE file in the root directory of this source tree.
|
|
133
133
|
*/const NA=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
|
|
134
|
-
* @license lucide-react v1.
|
|
134
|
+
* @license lucide-react v1.25.0 - ISC
|
|
135
135
|
*
|
|
136
136
|
* This source code is licensed under the ISC license.
|
|
137
137
|
* See the LICENSE file in the root directory of this source tree.
|
|
138
138
|
*/const $Z=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
139
|
-
* @license lucide-react v1.
|
|
139
|
+
* @license lucide-react v1.25.0 - ISC
|
|
140
140
|
*
|
|
141
141
|
* This source code is licensed under the ISC license.
|
|
142
142
|
* See the LICENSE file in the root directory of this source tree.
|
|
143
143
|
*/const HZ=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
144
|
-
* @license lucide-react v1.
|
|
144
|
+
* @license lucide-react v1.25.0 - ISC
|
|
145
145
|
*
|
|
146
146
|
* This source code is licensed under the ISC license.
|
|
147
147
|
* See the LICENSE file in the root directory of this source tree.
|
|
148
148
|
*/const jk=t=>{const e=HZ(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
|
|
149
|
-
* @license lucide-react v1.
|
|
149
|
+
* @license lucide-react v1.25.0 - ISC
|
|
150
150
|
*
|
|
151
151
|
* This source code is licensed under the ISC license.
|
|
152
152
|
* See the LICENSE file in the root directory of this source tree.
|
|
153
153
|
*/var k1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
154
|
-
* @license lucide-react v1.
|
|
154
|
+
* @license lucide-react v1.25.0 - ISC
|
|
155
155
|
*
|
|
156
156
|
* This source code is licensed under the ISC license.
|
|
157
157
|
* See the LICENSE file in the root directory of this source tree.
|
|
158
158
|
*/const zZ=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},UZ=g.createContext({}),BZ=()=>g.useContext(UZ),WZ=g.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...u},c)=>{const{size:f=24,strokeWidth:h=2,absoluteStrokeWidth:p=!1,color:v="currentColor",className:y=""}=BZ()??{},x=r??p?Number(n??h)*24/Number(e??f):n??h;return g.createElement("svg",{ref:c,...k1,width:e??f??k1.width,height:e??f??k1.height,stroke:t??v,strokeWidth:x,className:NA("lucide",y,s),...!i&&!zZ(u)&&{"aria-hidden":"true"},...u},[...a.map(([_,b])=>g.createElement(_,b)),...Array.isArray(i)?i:[i]])});/**
|
|
159
|
-
* @license lucide-react v1.
|
|
159
|
+
* @license lucide-react v1.25.0 - ISC
|
|
160
160
|
*
|
|
161
161
|
* This source code is licensed under the ISC license.
|
|
162
162
|
* See the LICENSE file in the root directory of this source tree.
|
|
163
163
|
*/const Ze=(t,e)=>{const n=g.forwardRef(({className:r,...s},i)=>g.createElement(WZ,{ref:i,iconNode:e,className:NA(`lucide-${$Z(jk(t))}`,`lucide-${t}`,r),...s}));return n.displayName=jk(t),n};/**
|
|
164
|
-
* @license lucide-react v1.
|
|
164
|
+
* @license lucide-react v1.25.0 - ISC
|
|
165
165
|
*
|
|
166
166
|
* This source code is licensed under the ISC license.
|
|
167
167
|
* See the LICENSE file in the root directory of this source tree.
|
|
168
168
|
*/const GZ=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],KZ=Ze("arrow-left",GZ);/**
|
|
169
|
-
* @license lucide-react v1.
|
|
169
|
+
* @license lucide-react v1.25.0 - ISC
|
|
170
170
|
*
|
|
171
171
|
* This source code is licensed under the ISC license.
|
|
172
172
|
* See the LICENSE file in the root directory of this source tree.
|
|
173
173
|
*/const qZ=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ZZ=Ze("arrow-right",qZ);/**
|
|
174
|
-
* @license lucide-react v1.
|
|
174
|
+
* @license lucide-react v1.25.0 - ISC
|
|
175
175
|
*
|
|
176
176
|
* This source code is licensed under the ISC license.
|
|
177
177
|
* See the LICENSE file in the root directory of this source tree.
|
|
178
178
|
*/const YZ=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],QZ=Ze("arrow-up",YZ);/**
|
|
179
|
-
* @license lucide-react v1.
|
|
179
|
+
* @license lucide-react v1.25.0 - ISC
|
|
180
180
|
*
|
|
181
181
|
* This source code is licensed under the ISC license.
|
|
182
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
183
183
|
*/const XZ=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],JZ=Ze("bell",XZ);/**
|
|
184
|
-
* @license lucide-react v1.
|
|
184
|
+
* @license lucide-react v1.25.0 - ISC
|
|
185
185
|
*
|
|
186
186
|
* This source code is licensed under the ISC license.
|
|
187
187
|
* See the LICENSE file in the root directory of this source tree.
|
|
188
188
|
*/const eY=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],tY=Ze("brain",eY);/**
|
|
189
|
-
* @license lucide-react v1.
|
|
189
|
+
* @license lucide-react v1.25.0 - ISC
|
|
190
190
|
*
|
|
191
191
|
* This source code is licensed under the ISC license.
|
|
192
192
|
* See the LICENSE file in the root directory of this source tree.
|
|
193
193
|
*/const nY=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],rY=Ze("check",nY);/**
|
|
194
|
-
* @license lucide-react v1.
|
|
194
|
+
* @license lucide-react v1.25.0 - ISC
|
|
195
195
|
*
|
|
196
196
|
* This source code is licensed under the ISC license.
|
|
197
197
|
* See the LICENSE file in the root directory of this source tree.
|
|
198
198
|
*/const sY=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],iY=Ze("chevron-down",sY);/**
|
|
199
|
-
* @license lucide-react v1.
|
|
199
|
+
* @license lucide-react v1.25.0 - ISC
|
|
200
200
|
*
|
|
201
201
|
* This source code is licensed under the ISC license.
|
|
202
202
|
* See the LICENSE file in the root directory of this source tree.
|
|
203
203
|
*/const oY=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],aY=Ze("chevron-right",oY);/**
|
|
204
|
-
* @license lucide-react v1.
|
|
204
|
+
* @license lucide-react v1.25.0 - ISC
|
|
205
205
|
*
|
|
206
206
|
* This source code is licensed under the ISC license.
|
|
207
207
|
* See the LICENSE file in the root directory of this source tree.
|
|
208
208
|
*/const lY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],uY=Ze("circle",lY);/**
|
|
209
|
-
* @license lucide-react v1.
|
|
209
|
+
* @license lucide-react v1.25.0 - ISC
|
|
210
210
|
*
|
|
211
211
|
* This source code is licensed under the ISC license.
|
|
212
212
|
* See the LICENSE file in the root directory of this source tree.
|
|
213
213
|
*/const cY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],dY=Ze("clock",cY);/**
|
|
214
|
-
* @license lucide-react v1.
|
|
214
|
+
* @license lucide-react v1.25.0 - ISC
|
|
215
215
|
*
|
|
216
216
|
* This source code is licensed under the ISC license.
|
|
217
217
|
* See the LICENSE file in the root directory of this source tree.
|
|
218
218
|
*/const fY=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],hY=Ze("copy",fY);/**
|
|
219
|
-
* @license lucide-react v1.
|
|
219
|
+
* @license lucide-react v1.25.0 - ISC
|
|
220
220
|
*
|
|
221
221
|
* This source code is licensed under the ISC license.
|
|
222
222
|
* See the LICENSE file in the root directory of this source tree.
|
|
223
223
|
*/const pY=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],mY=Ze("dot",pY);/**
|
|
224
|
-
* @license lucide-react v1.
|
|
224
|
+
* @license lucide-react v1.25.0 - ISC
|
|
225
225
|
*
|
|
226
226
|
* This source code is licensed under the ISC license.
|
|
227
227
|
* See the LICENSE file in the root directory of this source tree.
|
|
228
228
|
*/const gY=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],vY=Ze("globe",gY);/**
|
|
229
|
-
* @license lucide-react v1.
|
|
229
|
+
* @license lucide-react v1.25.0 - ISC
|
|
230
230
|
*
|
|
231
231
|
* This source code is licensed under the ISC license.
|
|
232
232
|
* See the LICENSE file in the root directory of this source tree.
|
|
233
233
|
*/const yY=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],_Y=Ze("heart",yY);/**
|
|
234
|
-
* @license lucide-react v1.
|
|
234
|
+
* @license lucide-react v1.25.0 - ISC
|
|
235
235
|
*
|
|
236
236
|
* This source code is licensed under the ISC license.
|
|
237
237
|
* See the LICENSE file in the root directory of this source tree.
|
|
238
238
|
*/const xY=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],wY=Ze("house",xY);/**
|
|
239
|
-
* @license lucide-react v1.
|
|
239
|
+
* @license lucide-react v1.25.0 - ISC
|
|
240
240
|
*
|
|
241
241
|
* This source code is licensed under the ISC license.
|
|
242
242
|
* See the LICENSE file in the root directory of this source tree.
|
|
243
243
|
*/const bY=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],SY=Ze("image",bY);/**
|
|
244
|
-
* @license lucide-react v1.
|
|
244
|
+
* @license lucide-react v1.25.0 - ISC
|
|
245
245
|
*
|
|
246
246
|
* This source code is licensed under the ISC license.
|
|
247
247
|
* See the LICENSE file in the root directory of this source tree.
|
|
248
248
|
*/const EY=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],CY=Ze("inbox",EY);/**
|
|
249
|
-
* @license lucide-react v1.
|
|
249
|
+
* @license lucide-react v1.25.0 - ISC
|
|
250
250
|
*
|
|
251
251
|
* This source code is licensed under the ISC license.
|
|
252
252
|
* See the LICENSE file in the root directory of this source tree.
|
|
253
253
|
*/const kY=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],PY=Ze("lightbulb",kY);/**
|
|
254
|
-
* @license lucide-react v1.
|
|
254
|
+
* @license lucide-react v1.25.0 - ISC
|
|
255
255
|
*
|
|
256
256
|
* This source code is licensed under the ISC license.
|
|
257
257
|
* See the LICENSE file in the root directory of this source tree.
|
|
258
258
|
*/const TY=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],RY=Ze("link",TY);/**
|
|
259
|
-
* @license lucide-react v1.
|
|
259
|
+
* @license lucide-react v1.25.0 - ISC
|
|
260
260
|
*
|
|
261
261
|
* This source code is licensed under the ISC license.
|
|
262
262
|
* See the LICENSE file in the root directory of this source tree.
|
|
263
263
|
*/const AY=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],IY=Ze("loader",AY);/**
|
|
264
|
-
* @license lucide-react v1.
|
|
264
|
+
* @license lucide-react v1.25.0 - ISC
|
|
265
265
|
*
|
|
266
266
|
* This source code is licensed under the ISC license.
|
|
267
267
|
* See the LICENSE file in the root directory of this source tree.
|
|
268
268
|
*/const MY=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],NY=Ze("lock",MY);/**
|
|
269
|
-
* @license lucide-react v1.
|
|
269
|
+
* @license lucide-react v1.25.0 - ISC
|
|
270
270
|
*
|
|
271
271
|
* This source code is licensed under the ISC license.
|
|
272
272
|
* See the LICENSE file in the root directory of this source tree.
|
|
273
273
|
*/const OY=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],LY=Ze("mail",OY);/**
|
|
274
|
-
* @license lucide-react v1.
|
|
274
|
+
* @license lucide-react v1.25.0 - ISC
|
|
275
275
|
*
|
|
276
276
|
* This source code is licensed under the ISC license.
|
|
277
277
|
* See the LICENSE file in the root directory of this source tree.
|
|
278
278
|
*/const DY=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jY=Ze("menu",DY);/**
|
|
279
|
-
* @license lucide-react v1.
|
|
279
|
+
* @license lucide-react v1.25.0 - ISC
|
|
280
280
|
*
|
|
281
281
|
* This source code is licensed under the ISC license.
|
|
282
282
|
* See the LICENSE file in the root directory of this source tree.
|
|
283
283
|
*/const FY=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],VY=Ze("message-circle",FY);/**
|
|
284
|
-
* @license lucide-react v1.
|
|
284
|
+
* @license lucide-react v1.25.0 - ISC
|
|
285
285
|
*
|
|
286
286
|
* This source code is licensed under the ISC license.
|
|
287
287
|
* See the LICENSE file in the root directory of this source tree.
|
|
288
288
|
*/const $Y=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],HY=Ze("monitor",$Y);/**
|
|
289
|
-
* @license lucide-react v1.
|
|
289
|
+
* @license lucide-react v1.25.0 - ISC
|
|
290
290
|
*
|
|
291
291
|
* This source code is licensed under the ISC license.
|
|
292
292
|
* See the LICENSE file in the root directory of this source tree.
|
|
293
293
|
*/const zY=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],UY=Ze("moon",zY);/**
|
|
294
|
-
* @license lucide-react v1.
|
|
294
|
+
* @license lucide-react v1.25.0 - ISC
|
|
295
295
|
*
|
|
296
296
|
* This source code is licensed under the ISC license.
|
|
297
297
|
* See the LICENSE file in the root directory of this source tree.
|
|
298
298
|
*/const BY=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],WY=Ze("paintbrush",BY);/**
|
|
299
|
-
* @license lucide-react v1.
|
|
299
|
+
* @license lucide-react v1.25.0 - ISC
|
|
300
300
|
*
|
|
301
301
|
* This source code is licensed under the ISC license.
|
|
302
302
|
* See the LICENSE file in the root directory of this source tree.
|
|
303
303
|
*/const GY=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],KY=Ze("palette",GY);/**
|
|
304
|
-
* @license lucide-react v1.
|
|
304
|
+
* @license lucide-react v1.25.0 - ISC
|
|
305
305
|
*
|
|
306
306
|
* This source code is licensed under the ISC license.
|
|
307
307
|
* See the LICENSE file in the root directory of this source tree.
|
|
308
308
|
*/const qY=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ZY=Ze("pause",qY);/**
|
|
309
|
-
* @license lucide-react v1.
|
|
309
|
+
* @license lucide-react v1.25.0 - ISC
|
|
310
310
|
*
|
|
311
311
|
* This source code is licensed under the ISC license.
|
|
312
312
|
* See the LICENSE file in the root directory of this source tree.
|
|
313
313
|
*/const YY=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],QY=Ze("pencil",YY);/**
|
|
314
|
-
* @license lucide-react v1.
|
|
314
|
+
* @license lucide-react v1.25.0 - ISC
|
|
315
315
|
*
|
|
316
316
|
* This source code is licensed under the ISC license.
|
|
317
317
|
* See the LICENSE file in the root directory of this source tree.
|
|
318
318
|
*/const XY=[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]],JY=Ze("pipette",XY);/**
|
|
319
|
-
* @license lucide-react v1.
|
|
319
|
+
* @license lucide-react v1.25.0 - ISC
|
|
320
320
|
*
|
|
321
321
|
* This source code is licensed under the ISC license.
|
|
322
322
|
* See the LICENSE file in the root directory of this source tree.
|
|
323
323
|
*/const eQ=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],tQ=Ze("play",eQ);/**
|
|
324
|
-
* @license lucide-react v1.
|
|
324
|
+
* @license lucide-react v1.25.0 - ISC
|
|
325
325
|
*
|
|
326
326
|
* This source code is licensed under the ISC license.
|
|
327
327
|
* See the LICENSE file in the root directory of this source tree.
|
|
328
328
|
*/const nQ=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],rQ=Ze("plus",nQ);/**
|
|
329
|
-
* @license lucide-react v1.
|
|
329
|
+
* @license lucide-react v1.25.0 - ISC
|
|
330
330
|
*
|
|
331
331
|
* This source code is licensed under the ISC license.
|
|
332
332
|
* See the LICENSE file in the root directory of this source tree.
|
|
333
333
|
*/const sQ=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],iQ=Ze("rectangle-horizontal",sQ);/**
|
|
334
|
-
* @license lucide-react v1.
|
|
334
|
+
* @license lucide-react v1.25.0 - ISC
|
|
335
335
|
*
|
|
336
336
|
* This source code is licensed under the ISC license.
|
|
337
337
|
* See the LICENSE file in the root directory of this source tree.
|
|
338
338
|
*/const oQ=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],aQ=Ze("rocket",oQ);/**
|
|
339
|
-
* @license lucide-react v1.
|
|
339
|
+
* @license lucide-react v1.25.0 - ISC
|
|
340
340
|
*
|
|
341
341
|
* This source code is licensed under the ISC license.
|
|
342
342
|
* See the LICENSE file in the root directory of this source tree.
|
|
343
343
|
*/const lQ=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],uQ=Ze("rotate-ccw",lQ);/**
|
|
344
|
-
* @license lucide-react v1.
|
|
344
|
+
* @license lucide-react v1.25.0 - ISC
|
|
345
345
|
*
|
|
346
346
|
* This source code is licensed under the ISC license.
|
|
347
347
|
* See the LICENSE file in the root directory of this source tree.
|
|
348
348
|
*/const cQ=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],dQ=Ze("search",cQ);/**
|
|
349
|
-
* @license lucide-react v1.
|
|
349
|
+
* @license lucide-react v1.25.0 - ISC
|
|
350
350
|
*
|
|
351
351
|
* This source code is licensed under the ISC license.
|
|
352
352
|
* See the LICENSE file in the root directory of this source tree.
|
|
353
353
|
*/const fQ=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],hQ=Ze("settings",fQ);/**
|
|
354
|
-
* @license lucide-react v1.
|
|
354
|
+
* @license lucide-react v1.25.0 - ISC
|
|
355
355
|
*
|
|
356
356
|
* This source code is licensed under the ISC license.
|
|
357
357
|
* See the LICENSE file in the root directory of this source tree.
|
|
358
358
|
*/const pQ=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],mQ=Ze("shield",pQ);/**
|
|
359
|
-
* @license lucide-react v1.
|
|
359
|
+
* @license lucide-react v1.25.0 - ISC
|
|
360
360
|
*
|
|
361
361
|
* This source code is licensed under the ISC license.
|
|
362
362
|
* See the LICENSE file in the root directory of this source tree.
|
|
363
363
|
*/const gQ=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],vQ=Ze("skip-forward",gQ);/**
|
|
364
|
-
* @license lucide-react v1.
|
|
364
|
+
* @license lucide-react v1.25.0 - ISC
|
|
365
365
|
*
|
|
366
366
|
* This source code is licensed under the ISC license.
|
|
367
367
|
* See the LICENSE file in the root directory of this source tree.
|
|
368
368
|
*/const yQ=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]],_Q=Ze("square-library",yQ);/**
|
|
369
|
-
* @license lucide-react v1.
|
|
369
|
+
* @license lucide-react v1.25.0 - ISC
|
|
370
370
|
*
|
|
371
371
|
* This source code is licensed under the ISC license.
|
|
372
372
|
* See the LICENSE file in the root directory of this source tree.
|
|
373
373
|
*/const xQ=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],wQ=Ze("star",xQ);/**
|
|
374
|
-
* @license lucide-react v1.
|
|
374
|
+
* @license lucide-react v1.25.0 - ISC
|
|
375
375
|
*
|
|
376
376
|
* This source code is licensed under the ISC license.
|
|
377
377
|
* See the LICENSE file in the root directory of this source tree.
|
|
378
378
|
*/const bQ=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],SQ=Ze("sun",bQ);/**
|
|
379
|
-
* @license lucide-react v1.
|
|
379
|
+
* @license lucide-react v1.25.0 - ISC
|
|
380
380
|
*
|
|
381
381
|
* This source code is licensed under the ISC license.
|
|
382
382
|
* See the LICENSE file in the root directory of this source tree.
|
|
383
383
|
*/const EQ=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],CQ=Ze("user",EQ);/**
|
|
384
|
-
* @license lucide-react v1.
|
|
384
|
+
* @license lucide-react v1.25.0 - ISC
|
|
385
385
|
*
|
|
386
386
|
* This source code is licensed under the ISC license.
|
|
387
387
|
* See the LICENSE file in the root directory of this source tree.
|
|
388
388
|
*/const kQ=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],PQ=Ze("users",kQ);/**
|
|
389
|
-
* @license lucide-react v1.
|
|
389
|
+
* @license lucide-react v1.25.0 - ISC
|
|
390
390
|
*
|
|
391
391
|
* This source code is licensed under the ISC license.
|
|
392
392
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -419,4 +419,4 @@ ${s}`:s},eG=({rows:t,activeVariantId:e,activePastKey:n,isOriginalSelected:r,busy
|
|
|
419
419
|
<body>
|
|
420
420
|
<div class="panel">${zk}</div>
|
|
421
421
|
</body>
|
|
422
|
-
</html>`,kX="Too many people are trying Rivet right now. Please try again in a few minutes.",dI="Failed to start an isolated demo session.",PX=async t=>{if(t.status===429)return kX;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return dI},H_=274,Dm=395,T1=Math.min(Dm,Math.round((H_+Dm)/2*1.1)),Bk="rivet:panelWidth:v2",TX=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},RX=({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=Je(ZT)>0,[p,v]=nP(KT),y=HV(),[x,_]=g.useState(()=>{if(typeof window>"u")return T1;const Y=Number(window.localStorage.getItem(Bk));return Number.isFinite(Y)&&Y>=H_&&Y<=Dm?Y:T1}),[b,E]=g.useState(!1),[k,P]=g.useState(rZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>nZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(Bk,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=G=>{G.key==="Escape"&&(TX(G.target)||(G.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const N=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const G=Y.clientX,B=x;E(!0);const Q=te=>{const H=Math.min(Dm,Math.max(H_,B+(te.clientX-G)));_(H)},$=()=>{window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",Q),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(T1),[]),M=gZ(),L=Je(pf);_Z({enabled:!L});const D=M.isProcessing?"Completing authentication...":a,V=D!==null,K=st(e5);return g.useEffect(()=>{K(t??null)},[t,K]),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:[D!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(Uq,{message:D})}):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(fA,{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(yK,{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(mR,{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(NG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:N,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(oZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:k,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(m$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},z_="rivet_connect_deep_link",AX=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(z_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(z_,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},IX=AX(),MX=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Rp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(IX);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Rp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=pZ(),p=st(pf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[k,P]=g.useState(!1),[T,A]=g.useState(null),[O,N]=g.useState(!1),R=g.useRef(!1),M=g.useRef(!1),L=wX(window.location.pathname),D=(u==null?void 0:u.activeDemoSessionId)??null,V=L??T??D,K=g.useMemo(()=>vX(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(()=>gX({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:L,activeDemoSessionId:T,configuredDemoSessionId:D}),[u,f,L,T,D]);g.useLayoutEffect(()=>{if(!Y){N(!1);return}N(!0)},[Y]);const G=O,B=g.useMemo(()=>yX(G),[G]),Q=(u==null?void 0:u.demoMode)===!0&&G,$=g.useRef(null);$.current=V;const te=g.useCallback(async()=>{if(!R.current)return;A(null);const pe=await c();if((pe==null?void 0:pe.demoMode)===!0&&pe.agentModeAvailable!==!0){P(!1);return}(pe==null?void 0:pe.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return fX(()=>{te()})},[u==null?void 0:u.demoMode,te]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const pe=window.fetch.bind(window);return mX({nativeFetch:pe,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 pe=>{const we=$.current;if(!(pe!=null&&pe.forceRefresh)&&we)return we;if(M.current)return"";M.current=!0;try{const Ie=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Ie.ok){const it=await PX(Ie);throw new Error(it)}const qe=await Ie.json();if(!qe.sessionId)throw new Error("Demo session response missing session id.");return A(qe.sessionId),qe.sessionId}finally{M.current=!1}},[]);g.useEffect(()=>{D&&A(D)},[D]),g.useEffect(()=>{u!=null&&u.userId?(Pe.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Pe.alias(u.email,u.userId)):u!=null&&u.email&&Pe.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const pe=!!u.demoMode,we=pe?V:null;Pe.register({source:pe?"tryout":"core",demo_mode:pe,...we?{demo_session_id:we}:{}})},[u,V]);const j=g.useCallback(async()=>{var we;y(!0),_(null);let pe=null;try{if(pe=window.open("","_blank"),!pe)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{pe.document.open(),pe.document.write(CX),pe.document.close()}catch(it){P1.warn("Failed to render loading state in auth popup:",it)}const Ie=await fetch(`${Uk}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),qe=await Ie.json();if(!Ie.ok||!qe.success||!qe.authUrl||!qe.sessionId||!qe.pollSecret)throw new Error(qe.error||qe.message||"Failed to start Google login");if(pe.closed)throw new Error("Sign-in window was closed before Google login started.");pe.location.href=qe.authUrl;for(let it=0;it<EX;it+=1){if(pe.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${Uk}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:qe.sessionId,pollSecret:qe.pollSecret})})).json();if(at.success&&at.token&&((we=at.user)!=null&&we.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(pe.close(),window.sessionStorage.setItem(Rp,"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(At=>setTimeout(At,SX))}throw new Error("Authentication timed out. Please try again.")}catch(Ie){pe&&!pe.closed&&pe.close();const qe=Ie instanceof Error?Ie.message:"Failed to start login flow";P1.warn("Hosted login failed:",qe),_(qe),y(!1)}},[u==null?void 0:u.demoMode,H]),Z=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||k||v),ee=u!=null&&u.agentModeAvailable!==!0,ie=bX(t),le=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let pe=!1;return H({forceRefresh:!0}).catch(we=>{const Ie=we instanceof Error?we.message:dI;P1.warn("Hosted session bootstrap failed:",Ie),_(Ie),ht.error(Ie)}).finally(()=>{pe||N(!1)}),()=>{pe=!0}},[Y,H]),g.useEffect(()=>{const pe=()=>{const we=window.location.hash;e(we)};return window.addEventListener("hashchange",pe),()=>window.removeEventListener("hashchange",pe)},[]),ie==="design-system")return S.jsx(lX,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(xX(ue)){const pe=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:pe}),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:()=>{le()},children:"Retry"})]})})}if(ee)return S.jsx(fA,{isSigningIn:v,onStartSignIn:()=>{j()},errorMessage:x,displayMode:"full"});const ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,se=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ae;return S.jsxs(S.Fragment,{children:[S.jsx(RX,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:K,showLoginGate:Z,onStartLogin:j,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:G,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:Q}),S.jsx(x_,{context:"onboarding",isOpen:se,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ae,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(z_),a(null)}})]})},NX="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",OX=new wN,LX={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},DX=()=>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."})});fD.createRoot(document.getElementById("root")).render(S.jsx(ge.StrictMode,{children:S.jsx(tD,{apiKey:NX,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",...LX,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.14.1",env:"production"})}},children:S.jsx(oD,{fallback:S.jsx(DX,{}),children:S.jsx(bN,{client:OX,children:S.jsx(LW,{defaultShape:"rounded",children:S.jsx(MQ,{defaultLibrary:"lucide",children:S.jsx(MX,{})})})})})})}));
|
|
422
|
+
</html>`,kX="Too many people are trying Rivet right now. Please try again in a few minutes.",dI="Failed to start an isolated demo session.",PX=async t=>{if(t.status===429)return kX;try{const e=await t.json();if(e.error)return e.error;if(e.message)return e.message}catch{}return dI},H_=274,Dm=395,T1=Math.min(Dm,Math.round((H_+Dm)/2*1.1)),Bk="rivet:panelWidth:v2",TX=t=>{if(!(t instanceof HTMLElement))return!1;const e=t.tagName.toLowerCase();return t.isContentEditable||e==="input"||e==="textarea"||e==="select"},RX=({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=Je(ZT)>0,[p,v]=nP(KT),y=HV(),[x,_]=g.useState(()=>{if(typeof window>"u")return T1;const Y=Number(window.localStorage.getItem(Bk));return Number.isFinite(Y)&&Y>=H_&&Y<=Dm?Y:T1}),[b,E]=g.useState(!1),[k,P]=g.useState(rZ),T=p?x:0,[A,O]=g.useState(p);g.useEffect(()=>{if(!p){O(!1);return}P(Y=>nZ({position:Y,boundsLeftPx:x}))},[p,x]),g.useEffect(()=>{window.localStorage.setItem(Bk,String(x))},[x]),g.useEffect(()=>{if(!p)return;const Y=G=>{G.key==="Escape"&&(TX(G.target)||(G.preventDefault(),v(!1)))};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[p,v]);const N=g.useCallback(Y=>{Y.preventDefault(),Y.stopPropagation();const G=Y.clientX,B=x;E(!0);const Q=te=>{const H=Math.min(Dm,Math.max(H_,B+(te.clientX-G)));_(H)},$=()=>{window.removeEventListener("pointermove",Q),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",$),E(!1)};window.addEventListener("pointermove",Q),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",$)},[x]),R=g.useCallback(()=>_(T1),[]),M=gZ(),L=Je(pf);_Z({enabled:!L});const D=M.isProcessing?"Completing authentication...":a,V=D!==null,K=st(e5);return g.useEffect(()=>{K(t??null)},[t,K]),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:[D!==null&&!n?S.jsx("div",{className:"absolute inset-0 z-50",children:S.jsx(Uq,{message:D})}):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(fA,{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(yK,{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(mR,{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(NG,{onClose:()=>v(!1)}),S.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",onPointerDown:N,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(oZ,{isVisible:!0,isPanelOpen:p,isReducedMotion:!!y,position:k,dragBoundsLeftPx:T,onPositionChange:P,onToggle:()=>v(Y=>!Y)})]}):null}),S.jsx(m$,{duration:5e3,richColors:!0,toastOptions:{style:{maxHeight:"150px",overflow:"hidden"}}})]})},z_="rivet_connect_deep_link",AX=()=>{if(typeof window>"u")return null;const t=new URLSearchParams(window.location.search),e=t.get("connect"),n=e??window.sessionStorage.getItem(z_);if(n!=="pinterest"&&n!=="arena")return null;if(window.sessionStorage.setItem(z_,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},IX=AX(),MX=()=>{const[t,e]=g.useState(window.location.hash),[n]=g.useState(()=>typeof window<"u"&&window.sessionStorage.getItem(Rp)==="1"),[r,s]=g.useState(!1),[i,a]=g.useState(IX);g.useEffect(()=>{n&&window.sessionStorage.removeItem(Rp)},[n]);const{config:u,refetchConfig:c,loading:f,error:h}=pZ(),p=st(pf),[v,y]=g.useState(!1),[x,_]=g.useState(null),[b,E]=g.useState(!1),[k,P]=g.useState(!1),[T,A]=g.useState(null),[O,N]=g.useState(!1),R=g.useRef(!1),M=g.useRef(!1),L=wX(window.location.pathname),D=(u==null?void 0:u.activeDemoSessionId)??null,V=L??T??D,K=g.useMemo(()=>vX(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(()=>gX({configLoading:f,hasConfig:u!==null,demoMode:u==null?void 0:u.demoMode,agentModeAvailable:u==null?void 0:u.agentModeAvailable,pathnameDemoSessionId:L,activeDemoSessionId:T,configuredDemoSessionId:D}),[u,f,L,T,D]);g.useLayoutEffect(()=>{if(!Y){N(!1);return}N(!0)},[Y]);const G=O,B=g.useMemo(()=>yX(G),[G]),Q=(u==null?void 0:u.demoMode)===!0&&G,$=g.useRef(null);$.current=V;const te=g.useCallback(async()=>{if(!R.current)return;A(null);const pe=await c();if((pe==null?void 0:pe.demoMode)===!0&&pe.agentModeAvailable!==!0){P(!1);return}(pe==null?void 0:pe.demoMode)===!0&&P(!0)},[c]);g.useEffect(()=>{if((u==null?void 0:u.demoMode)===!0)return fX(()=>{te()})},[u==null?void 0:u.demoMode,te]),g.useEffect(()=>{if(R.current=(u==null?void 0:u.demoMode)===!0,(u==null?void 0:u.demoMode)!==!0)return;const pe=window.fetch.bind(window);return mX({nativeFetch:pe,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 pe=>{const we=$.current;if(!(pe!=null&&pe.forceRefresh)&&we)return we;if(M.current)return"";M.current=!0;try{const Ie=await fetch("/api/demo/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!Ie.ok){const it=await PX(Ie);throw new Error(it)}const qe=await Ie.json();if(!qe.sessionId)throw new Error("Demo session response missing session id.");return A(qe.sessionId),qe.sessionId}finally{M.current=!1}},[]);g.useEffect(()=>{D&&A(D)},[D]),g.useEffect(()=>{u!=null&&u.userId?(Pe.identify(u.userId,{...u.email?{email:u.email}:{}}),u.email&&Pe.alias(u.email,u.userId)):u!=null&&u.email&&Pe.identify(u.email,{email:u.email})},[u==null?void 0:u.userId,u==null?void 0:u.email]),g.useEffect(()=>{if(!u)return;const pe=!!u.demoMode,we=pe?V:null;Pe.register({source:pe?"tryout":"core",demo_mode:pe,...we?{demo_session_id:we}:{}})},[u,V]);const j=g.useCallback(async()=>{var we;y(!0),_(null);let pe=null;try{if(pe=window.open("","_blank"),!pe)throw new Error("Pop-up blocked. Please allow pop-ups and try again.");try{pe.document.open(),pe.document.write(CX),pe.document.close()}catch(it){P1.warn("Failed to render loading state in auth popup:",it)}const Ie=await fetch(`${Uk}/api/auth/google/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:"desktop"})}),qe=await Ie.json();if(!Ie.ok||!qe.success||!qe.authUrl||!qe.sessionId||!qe.pollSecret)throw new Error(qe.error||qe.message||"Failed to start Google login");if(pe.closed)throw new Error("Sign-in window was closed before Google login started.");pe.location.href=qe.authUrl;for(let it=0;it<EX;it+=1){if(pe.closed)throw new Error("Sign-in window was closed before authentication completed.");const at=await(await fetch(`${Uk}/api/auth/google/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:qe.sessionId,pollSecret:qe.pollSecret})})).json();if(at.success&&at.token&&((we=at.user)!=null&&we.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(pe.close(),window.sessionStorage.setItem(Rp,"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(At=>setTimeout(At,SX))}throw new Error("Authentication timed out. Please try again.")}catch(Ie){pe&&!pe.closed&&pe.close();const qe=Ie instanceof Error?Ie.message:"Failed to start login flow";P1.warn("Hosted login failed:",qe),_(qe),y(!1)}},[u==null?void 0:u.demoMode,H]),Z=(u==null?void 0:u.demoMode)===!0&&((u==null?void 0:u.agentModeAvailable)!==!0||k||v),ee=u!=null&&u.agentModeAvailable!==!0,ie=bX(t),le=g.useCallback(async()=>{E(!0),p(!0);try{await c()}finally{p(!1),E(!1)}},[c,p]);if(g.useEffect(()=>{if(!Y)return;let pe=!1;return H({forceRefresh:!0}).catch(we=>{const Ie=we instanceof Error?we.message:dI;P1.warn("Hosted session bootstrap failed:",Ie),_(Ie),ht.error(Ie)}).finally(()=>{pe||N(!1)}),()=>{pe=!0}},[Y,H]),g.useEffect(()=>{const pe=()=>{const we=window.location.hash;e(we)};return window.addEventListener("hashchange",pe),()=>window.removeEventListener("hashchange",pe)},[]),ie==="design-system")return S.jsx(lX,{});const ue={pathname:window.location.pathname,configLoading:f,hasConfig:u!==null,isRetryingConfig:b};if(xX(ue)){const pe=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:pe}),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:()=>{le()},children:"Retry"})]})})}if(ee)return S.jsx(fA,{isSigningIn:v,onStartSignIn:()=>{j()},errorMessage:x,displayMode:"full"});const ae=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&i!==null,se=(u==null?void 0:u.agentModeAvailable)===!0&&(u==null?void 0:u.demoMode)!==!0&&n&&!r&&!ae;return S.jsxs(S.Fragment,{children:[S.jsx(RX,{projectPath:u==null?void 0:u.projectPath,activeDemoSessionId:K,showLoginGate:Z,onStartLogin:j,isStartingLogin:v,loginError:x,fullPageHostedLoginProgressMessage:(u==null?void 0:u.demoMode)===!0&&v?"Completing sign-in...":null,holdHostedTryoutPreviewNavigation:G,hostedTryoutPreviewHoldMessage:B,deferInspectorUntilPreviewReady:Q}),S.jsx(x_,{context:"onboarding",isOpen:se,onClose:()=>s(!0)}),S.jsx(x_,{context:"menu",isOpen:ae,highlightProvider:i,onClose:()=>{window.sessionStorage.removeItem(z_),a(null)}})]})},NX="phc_Ntj9tXHbS64XgYxlTfhglRmFivFsfm0AERph4ZlnNH",OX=new wN,LX={session_recording:{maskAllInputs:!1,maskInputOptions:{password:!0},maskTextSelector:null}},DX=()=>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."})});fD.createRoot(document.getElementById("root")).render(S.jsx(ge.StrictMode,{children:S.jsx(tD,{apiKey:NX,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",...LX,mask_all_text:!1,mask_all_element_attributes:!1,loaded:t=>{t.register({source:"core",rivet_version:"0.14.3",env:"production"})}},children:S.jsx(oD,{fallback:S.jsx(DX,{}),children:S.jsx(bN,{client:OX,children:S.jsx(LW,{defaultShape:"rounded",children:S.jsx(MQ,{defaultLibrary:"lucide",children:S.jsx(MX,{})})})})})})}));
|