ponzu 1.78.0 → 1.78.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/chromium.js
CHANGED
|
@@ -11817,7 +11817,7 @@ var SYSTEM = new Set([
|
|
|
11817
11817
|
|
|
11818
11818
|
// packages/render/src/document.ts
|
|
11819
11819
|
var ARTBOARD_BASE_CSS = `
|
|
11820
|
-
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; }
|
|
11820
|
+
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
11821
11821
|
[data-artboard] *, [data-artboard] *::before, [data-artboard] *::after { box-sizing: border-box; }
|
|
11822
11822
|
[data-artboard] img, [data-artboard] video, [data-artboard] svg { max-width: none; }
|
|
11823
11823
|
`;
|
package/dist/index.js
CHANGED
|
@@ -41737,7 +41737,7 @@ var SYSTEM = new Set([
|
|
|
41737
41737
|
|
|
41738
41738
|
// packages/render/src/document.ts
|
|
41739
41739
|
var ARTBOARD_BASE_CSS = `
|
|
41740
|
-
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; }
|
|
41740
|
+
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
41741
41741
|
[data-artboard] *, [data-artboard] *::before, [data-artboard] *::after { box-sizing: border-box; }
|
|
41742
41742
|
[data-artboard] img, [data-artboard] video, [data-artboard] svg { max-width: none; }
|
|
41743
41743
|
`;
|
|
@@ -49938,7 +49938,7 @@ function remoteUpdater(endpoint, token) {
|
|
|
49938
49938
|
// apps/cli/package.json
|
|
49939
49939
|
var package_default = {
|
|
49940
49940
|
name: "ponzu",
|
|
49941
|
-
version: "1.78.
|
|
49941
|
+
version: "1.78.2",
|
|
49942
49942
|
description: "The open source canvas your agent draws on in HTML and CSS.",
|
|
49943
49943
|
type: "module",
|
|
49944
49944
|
license: "MIT",
|
package/package.json
CHANGED
|
@@ -2044,7 +2044,7 @@ Zilla Slab Highlight;400,700
|
|
|
2044
2044
|
}
|
|
2045
2045
|
return issues;
|
|
2046
2046
|
})()`,ft=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-sans-serif`,`ui-serif`,`ui-monospace`,`ui-rounded`,`math`,`emoji`,`fangsong`,`inherit`,`initial`,`unset`,`revert`]),pt=new Set([`-apple-system`,`blinkmacsystemfont`,`segoe ui`,`helvetica`,`helvetica neue`,`arial`,`sf pro`,`sf pro text`,`sf pro display`,`sf mono`,`menlo`,`monaco`,`consolas`,`times`,`times new roman`,`georgia`,`courier`,`courier new`,`apple color emoji`]),mt=`
|
|
2047
|
-
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; }
|
|
2047
|
+
[data-artboard] { display: flex; flex-direction: column; position: relative; overflow: hidden; box-sizing: border-box; background: #fff; color: #000; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
2048
2048
|
[data-artboard] *, [data-artboard] *::before, [data-artboard] *::after { box-sizing: border-box; }
|
|
2049
2049
|
[data-artboard] img, [data-artboard] video, [data-artboard] svg { max-width: none; }
|
|
2050
2050
|
`;function ht(e){return e.replace(/<\/(style)/gi,`<\\/$1`)}function gt(e,t){return e.replace(/\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)/gi,(e,n)=>n.toLowerCase()===t?`(min-width: 0px)`:`(not (min-width: 0px))`)}var _t=[256,512,1024,2048,4096,8192];function vt(e){for(let t of _t)if(t>=e)return t;return _t[_t.length-1]}var yt=/\.(jpe?g|png|webp|avif|bmp|gif)$/i;function bt(e){let t=e.replace(/[?#].*$/,``);return yt.test(t)}function xt(e,t,n){let r=n.replace(/\/$/,``);if(e.startsWith(`${r}/assets/`)){let n=e.replace(/([?&])w=\d+(&|$)/,(e,t,n)=>n?t:``),r=n.indexOf(`#`),i=r<0?n:n.slice(0,r),a=r<0?``:n.slice(r);return`${i}${i.includes(`?`)?`&`:`?`}w=${t}${a}`}return/^https?:\/\//i.test(e)&&!e.startsWith(`${wt(r)}/`)?`${wt(r)}/api/image?w=${t}&url=${encodeURIComponent(e)}`:null}function St(e,t){let n=t.replace(/\/$/,``),r=`${wt(n)}/api/image?`;return e.startsWith(r)?new URLSearchParams(e.slice(r.length)).get(`url`)??e:e.startsWith(`${n}/assets/`)&&/[?&]w=\d+/.test(e)?e.replace(/([?&])w=\d+(&?)/,(e,t,n)=>n?t:``).replace(/[?&]$/,``):e}function Ct(e,t,n){let r=t.replace(/\/$/,``);if(e.startsWith(`${r}/assets/`))return bt(e);if(!/^https?:\/\//i.test(e)||e.startsWith(`${wt(r)}/`))return!1;if(bt(e))return!0;let i=n?.tag.toLowerCase();return i===`img`&&(n.attr===`src`||n.attr===`srcset`)||i===`source`&&n.attr===`srcset`||i===`image`&&(n.attr===`href`||n.attr===`xlink:href`)}function wt(e){let t=/^(https?:\/\/[^/]+)/i.exec(e);return t?t[1]:``}function Tt(e,t){return t?Se(e,e=>Dt(e,t)):e}function Et(e){return e.match(/@font-face\s*\{[^}]*\}/gi)??[]}function Dt(e,t){if(!t||/^(https?:|data:|blob:|#|\/\/)/i.test(e))return e;let n=e.replace(/^(\.\.\/)+/,``).replace(/^\.\//,``).replace(/^\//,``);return`${t.replace(/\/$/,``)}/${n}`}var Ot=`(() => {
|
|
@@ -2379,5 +2379,5 @@ Zilla Slab Highlight;400,700
|
|
|
2379
2379
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
2380
2380
|
`},pf=0,mf=[];function hf(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),i=W.useState(pf++)[0],a=W.useState(Id)[0],o=W.useRef(e);W.useEffect(function(){o.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fd([e.lockRef.current],(e.shards||[]).map(uf),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=W.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=cf(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ef(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ef(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return sf(h,t,e,h===`h`?s:c,!0)},[]),c=W.useCallback(function(e){var n=e;if(mf.length&&mf[mf.length-1]===a){var r=`deltaY`in n?lf(n):cf(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&df(e.delta,r)})[0];if(i&&i.should)n.cancelable&&n.preventDefault();else if(!i){var c=(o.current.shards||[]).map(uf).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=W.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:gf(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=W.useCallback(function(e){n.current=cf(e),r.current=void 0},[]),d=W.useCallback(function(t){l(t.type,lf(t),t.target,s(t,e.lockRef.current))},[]),f=W.useCallback(function(t){l(t.type,cf(t),t.target,s(t,e.lockRef.current))},[]);W.useEffect(function(){return mf.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yd),document.addEventListener(`touchmove`,c,Yd),document.addEventListener(`touchstart`,u,Yd),function(){mf=mf.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yd),document.removeEventListener(`touchmove`,c,Yd),document.removeEventListener(`touchstart`,u,Yd)}},[]);var p=e.removeScrollBar,m=e.inert;return W.createElement(W.Fragment,null,m?W.createElement(a,{styles:ff(i)}):null,p?W.createElement(Kd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var _f=Ed(Dd,hf),vf=W.forwardRef(function(e,t){return W.createElement(kd,ud({},e,{ref:t,sideCar:_f}))});vf.classNames=kd.classNames;var yf=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},bf=new WeakMap,xf=new WeakMap,Sf={},Cf=0,wf=function(e){return e&&(e.host||wf(e.parentNode))},Tf=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=wf(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Ef=function(e,t,n,r){var i=Tf(t,Array.isArray(e)?e:[e]);Sf[n]||(Sf[n]=new WeakMap);var a=Sf[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(bf.get(e)||0)+1,l=(a.get(e)||0)+1;bf.set(e,c),a.set(e,l),o.push(e),c===1&&i&&xf.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Cf++,function(){o.forEach(function(e){var t=bf.get(e)-1,i=a.get(e)-1;bf.set(e,t),a.set(e,i),t||(xf.has(e)||e.removeAttribute(r),xf.delete(e)),i||e.removeAttribute(n)}),Cf--,Cf||(bf=new WeakMap,bf=new WeakMap,xf=new WeakMap,Sf={})}},Df=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||yf(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ef(r,i,n,`aria-hidden`)):function(){return null}},Of=Object.defineProperty,kf=(e,t)=>Of(e,`name`,{value:t,configurable:!0}),Af=`Dialog`,[jf,Mf]=hl(Af),[Nf,Pf]=jf(Af),Ff=kf(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=W.useRef(null),c=W.useRef(null),{nodes:l,registry:u}=Hu(),[d,f]=ql({prop:r,defaultProp:i??!1,onChange:a,caller:Af}),[p,m]=W.useState(0),[h,g]=W.useState(0);return(0,G.jsx)(Nf,{scope:t,triggerRef:s,contentRef:c,contentId:uu(),titleId:uu(),descriptionId:uu(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:W.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),If=`DialogPortal`,[Lf,Rf]=jf(If,{forceMount:void 0}),zf=kf(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Pf(If,t);return(0,G.jsx)(Lf,{scope:t,forceMount:n,children:W.Children.map(r,e=>(0,G.jsx)(Y,{present:n||a.open,children:(0,G.jsx)(nd,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Bf=`DialogOverlay`,Vf=W.forwardRef(kf(function(e,t){let n=Rf(Bf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Pf(Bf,e.__scopeDialog);return a.modal?(0,G.jsx)(Y,{present:r||a.open,children:(0,G.jsx)(Uf,{...i,ref:t})}):null},`DialogOverlay`)),Hf=Vc(`DialogOverlay.RemoveScroll`),Uf=W.forwardRef(kf(function(e,t){let{__scopeDialog:n,...r}=e,i=Pf(Bf,n),a=Rc(t,Ou());return(0,G.jsx)(vf,{as:Hf,allowPinchZoom:!0,shards:W.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,G.jsx)(ol.div,{"data-state":$f(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),X=`DialogContent`,Wf=W.forwardRef(kf(function(e,t){let n=Rf(X,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Pf(X,e.__scopeDialog);return(0,G.jsx)(Y,{present:r||a.open,children:a.modal?(0,G.jsx)(Gf,{...i,ref:t}):(0,G.jsx)(Kf,{...i,ref:t})})},`DialogContent`)),Gf=W.forwardRef(kf(function(e,t){let n=Pf(X,e.__scopeDialog),r=W.useRef(null),i=Rc(t,n.contentRef,r);return W.useEffect(()=>{let e=r.current;if(e)return Df(e)},[]),(0,G.jsx)(qf,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Kf=W.forwardRef(kf(function(e,t){let n=Pf(X,e.__scopeDialog),r=W.useRef(!1),i=W.useRef(!1);return(0,G.jsx)(qf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),qf=W.forwardRef(kf(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Pf(X,n);return cd(),(0,G.jsx)(Vu,{registry:l.branchRegistry,children:(0,G.jsx)(zu,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(Du,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?Qf(o,l.descriptionId):o,"data-state":$f(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),Jf=W.forwardRef(kf(function(e,t){let{__scopeDialog:n,...r}=e,i=Pf(`DialogTitle`,n),{setTitleCount:a}=i;return _l(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(ol.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Yf=W.forwardRef(kf(function(e,t){let{__scopeDialog:n,...r}=e,i=Pf(`DialogDescription`,n),{setDescriptionCount:a}=i;return _l(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(ol.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Xf=`DialogClose`,Zf=W.forwardRef(kf(function(e,t){let{__scopeDialog:n,...r}=e,i=Pf(Xf,n);return(0,G.jsx)(ol.button,{type:`button`,...r,ref:t,onClick:J(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Qf(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}kf(Qf,`concatAriaDescribedby`);function $f(e){return e?`open`:`closed`}kf($f,`getState`);var ep=Object.defineProperty,tp=(e,t)=>ep(e,`name`,{value:t,configurable:!0});function np(e){let[t,n]=W.useState(void 0);return _l(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=0,r=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;let i=r[0];window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{let t,r;if(`borderBoxSize`in i){let e=i.borderBoxSize,n=Array.isArray(e)?e[0]:e;t=n.inlineSize,r=n.blockSize}else t=e.offsetWidth,r=e.offsetHeight;n({width:t,height:r})})});return r.observe(e,{box:`border-box`}),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}n(void 0)},[e]),t}tp(np,`useSize`);var rp=[`top`,`right`,`bottom`,`left`],ip=Math.min,ap=Math.max,op=Math.round,sp=Math.floor,cp=e=>({x:e,y:e}),lp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function up(e,t,n){return ap(e,ip(t,n))}function dp(e,t){return typeof e==`function`?e(t):e}function fp(e){return e.split(`-`)[0]}function pp(e){return e.split(`-`)[1]}function mp(e){return e===`x`?`y`:`x`}function hp(e){return e===`y`?`height`:`width`}function gp(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function _p(e){return mp(gp(e))}function vp(e,t,n){n===void 0&&(n=!1);let r=pp(e),i=_p(e),a=hp(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Dp(o)),[o,Dp(o)]}function yp(e){let t=Dp(e);return[bp(e),t,bp(t)]}function bp(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var xp=[`left`,`right`],Sp=[`right`,`left`],Cp=[`top`,`bottom`],wp=[`bottom`,`top`];function Tp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Sp:xp:t?xp:Sp;case`left`:case`right`:return t?Cp:wp;default:return[]}}function Ep(e,t,n,r){let i=pp(e),a=Tp(fp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(bp)))),a}function Dp(e){let t=fp(e);return lp[t]+e.slice(t.length)}function Op(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function kp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Op(e)}function Ap(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function jp(e,t,n){let{reference:r,floating:i}=e,a=gp(t),o=_p(t),s=hp(o),c=fp(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=pp(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Mp(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=dp(t,e),p=kp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ap(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ap(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Np=50,Pp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Mp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=jp(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Np&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=jp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Fp=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=dp(e,t)||{};if(l==null)return{};let d=kp(u),f={x:n,y:r},p=_p(i),m=hp(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=ip(d[_],T),D=ip(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=up(E,k,O),j=!c.arrow&&pp(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ip=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=dp(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=fp(r),_=gp(o),v=fp(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Dp(o)]:yp(o)),x=p!==`none`;!d&&x&&b.push(...Ep(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=vp(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===gp(t)||T.every(e=>gp(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=gp(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Lp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Rp(e){return rp.some(t=>e[t]>=0)}var zp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=dp(e,t);switch(i){case`referenceHidden`:{let e=Lp(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Rp(e)}}}case`escaped`:{let e=Lp(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Rp(e)}}}default:return{}}}}},Bp=new Set([`left`,`top`]);async function Vp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fp(n),s=pp(n),c=gp(n)===`y`,l=Bp.has(o)?-1:1,u=a&&c?-1:1,d=dp(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Hp=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Vp(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Up=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=dp(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=gp(i),p=mp(f),m=u[p],h=u[f],g=(e,t)=>up(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Wp=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=dp(e,t),u={x:n,y:r},d=gp(i),f=mp(d),p=u[f],m=u[d],h=dp(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Bp.has(fp(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Gp=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=dp(e,t),c=await i.detectOverflow(t,s),l=fp(n),u=pp(n),d=gp(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=ip(p-c[m],g),y=ip(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*ap(c.left,c.right):S=p-2*ap(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Kp(){return typeof window<`u`}function qp(e){return Xp(e)?(e.nodeName||``).toLowerCase():`#document`}function Jp(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yp(e){return((Xp(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xp(e){return Kp()?e instanceof Node||e instanceof Jp(e).Node:!1}function Zp(e){return Kp()?e instanceof Element||e instanceof Jp(e).Element:!1}function Qp(e){return Kp()?e instanceof HTMLElement||e instanceof Jp(e).HTMLElement:!1}function $p(e){return!Kp()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Jp(e).ShadowRoot}function em(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=dm(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function tm(e){return/^(table|td|th)$/.test(qp(e))}function nm(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var rm=/transform|translate|scale|rotate|perspective|filter/,im=/paint|layout|strict|content/,am=e=>!!e&&e!==`none`,om;function sm(e){let t=Zp(e)?dm(e):e;return am(t.transform)||am(t.translate)||am(t.scale)||am(t.rotate)||am(t.perspective)||!lm()&&(am(t.backdropFilter)||am(t.filter))||rm.test(t.willChange||``)||im.test(t.contain||``)}function cm(e){let t=pm(e);for(;Qp(t)&&!um(t);){if(sm(t))return t;if(nm(t))return null;t=pm(t)}return null}function lm(){return om??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),om}function um(e){return/^(html|body|#document)$/.test(qp(e))}function dm(e){return Jp(e).getComputedStyle(e)}function fm(e){return Zp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pm(e){if(qp(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||$p(e)&&e.host||Yp(e);return $p(t)?t.host:t}function mm(e){let t=pm(e);return um(t)?(e.ownerDocument||e).body:Qp(t)&&em(t)?t:mm(t)}function hm(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=mm(e),i=r===e.ownerDocument?.body,a=Jp(r);if(i){let e=gm(a);return t.concat(a,a.visualViewport||[],em(r)?r:[],e&&n?hm(e):[])}return t.concat(r,hm(r,[],n))}function gm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _m(e){let t=dm(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Qp(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=op(n)!==a||op(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vm(e){return Zp(e)?e:e.contextElement}function ym(e){let t=vm(e);if(!Qp(t))return cp(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_m(t),o=(a?op(n.width):n.width)/r,s=(a?op(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var bm=cp(0);function xm(e){let t=Jp(e);return!lm()||!t.visualViewport?bm:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Sm(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Jp(e)}function Cm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vm(e),o=cp(1);t&&(r?Zp(r)&&(o=ym(r)):o=ym(e));let s=Sm(a,n,r)?xm(a):cp(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Jp(a),t=Zp(r)?Jp(r):r,n=e,i=gm(n);for(;i&&t!==n;){let e=ym(i),t=i.getBoundingClientRect(),r=dm(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Jp(i),i=gm(n)}}return Ap({width:u,height:d,x:c,y:l})}function wm(e,t){let n=fm(e).scrollLeft;return t?t.left+n:Cm(Yp(e)).left+n}function Tm(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wm(e,n),y:n.top+t.scrollTop}}function Em(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Yp(r),s=t?nm(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=cp(1),u=cp(0),d=Qp(r);if((d||!a)&&((qp(r)!==`body`||em(o))&&(c=fm(r)),d)){let e=Cm(r);l=ym(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Tm(o,c):cp(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Dm(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Om(e){let t=fm(e),n=e.ownerDocument.body,r=ap(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ap(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+wm(e),o=-t.scrollTop;return dm(n).direction===`rtl`&&(a+=ap(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var km=25;function Am(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Jp(e),a=Yp(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!lm()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(wm(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=km&&(s-=o)}return{width:s,height:c,x:l,y:u}}function jm(e,t){let n=Cm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ym(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Mm(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Am(e,n,t);else if(t===`document`)r=Om(Yp(e));else if(Zp(t))r=jm(t,n);else{let n=xm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ap(r)}function Nm(e,t){let n=t.get(e);if(n)return n;let r=hm(e,[],!1).filter(e=>Zp(e)&&qp(e)!==`body`),i=null,a=dm(e).position===`fixed`,o=a?pm(e):e;for(;Zp(o)&&!um(o);){let e=dm(o),t=sm(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=pm(o)}return t.set(e,r),r}function Pm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?nm(t)?[]:Nm(t,this._c):[].concat(n),r],o=Mm(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Mm(t,a[e],i);s=ap(n.top,s),c=ip(n.right,c),l=ip(n.bottom,l),u=ap(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Fm(e){let{width:t,height:n}=_m(e);return{width:t,height:n}}function Im(e,t,n){let r=Qp(t),i=Yp(t),a=n===`fixed`,o=Cm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=cp(0);if((r||!a)&&((qp(t)!==`body`||em(i))&&(s=fm(t)),r)){let e=Cm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=wm(i));let l=i&&!r&&!a?Tm(i,s):cp(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Lm(e){return dm(e).position===`static`}function Rm(e,t){if(!Qp(e)||dm(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Yp(e)===n&&(n=n.ownerDocument.body),n}function zm(e,t){let n=Jp(e);if(nm(e))return n;if(!Qp(e)){let t=pm(e);for(;t&&!um(t);){if(Zp(t)&&!Lm(t))return t;t=pm(t)}return n}let r=Rm(e,t);for(;r&&tm(r)&&Lm(r);)r=Rm(r,t);return r&&um(r)&&Lm(r)&&!sm(r)?n:r||cm(e)||n}var Bm=async function(e){let t=this.getOffsetParent||zm,n=this.getDimensions,r=await n(e.floating);return{reference:Im(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Vm(e){return dm(e).direction===`rtl`}var Hm={convertOffsetParentRelativeRectToViewportRelativeRect:Em,getDocumentElement:Yp,getClippingRect:Pm,getOffsetParent:zm,getElementRects:Bm,getClientRects:Dm,getDimensions:Fm,getScale:ym,isElement:Zp,isRTL:Vm};function Um(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wm(e,t,n){let r=null,i,a=Yp(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=sp(d),h=sp(a.clientWidth-(u+f)),g=sp(a.clientHeight-(d+p)),_=sp(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ap(0,ip(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Um(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Jp(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function Gm(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=vm(e),u=i||a?[...l?hm(l):[],...t?hm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Wm(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Cm(e):null;c&&g();function g(){let t=Cm(e);h&&!Um(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Km=Hp,qm=Up,Jm=Ip,Ym=Gp,Xm=zp,Zm=Fp,Qm=Wp,$m=(e,t,n)=>{let r=new Map,i=n??{},a={...Hm,...i.platform,_c:r};return Pp(e,t,{...i,platform:a})},eh=typeof document<`u`?W.useLayoutEffect:function(){};function th(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!th(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!th(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function nh(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rh(e,t){let n=nh(e);return Math.round(t*n)/n}function ih(e){let t=W.useRef(e);return eh(()=>{t.current=e}),t}function ah(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=W.useState(r);th(f,r)||p(r);let[m,h]=W.useState(null),[g,_]=W.useState(null),v=W.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=W.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=W.useRef(null),C=W.useRef(null),w=W.useRef(u),T=c!=null,E=ih(c),D=ih(i),O=ih(l),k=W.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),$m(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!th(w.current,t)&&(w.current=t,rl.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);eh(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=W.useRef(!1);eh(()=>(A.current=!0,()=>{A.current=!1}),[]),eh(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=W.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=W.useMemo(()=>({reference:b,floating:x}),[b,x]),N=W.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=rh(M.floating,u.x),r=rh(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...nh(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var oh=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Zm({element:r.current,padding:i}).fn(n):r?Zm({element:r,padding:i}).fn(n):{}}}},sh=(e,t)=>{let n=Km(e);return{name:n.name,fn:n.fn,options:[e,t]}},ch=(e,t)=>{let n=qm(e);return{name:n.name,fn:n.fn,options:[e,t]}},lh=(e,t)=>({fn:Qm(e).fn,options:[e,t]}),uh=(e,t)=>{let n=Jm(e);return{name:n.name,fn:n.fn,options:[e,t]}},dh=(e,t)=>{let n=Ym(e);return{name:n.name,fn:n.fn,options:[e,t]}},fh=(e,t)=>{let n=Xm(e);return{name:n.name,fn:n.fn,options:[e,t]}},ph=(e,t)=>{let n=oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},mh=Object.defineProperty,hh=(e,t)=>mh(e,`name`,{value:t,configurable:!0}),gh={Partial:`partial`,Always:`always`},_h={Optimized:`optimized`,Always:`always`},vh=`Popper`,[yh,bh]=hl(vh),[xh,Sh]=yh(vh),Ch=hh(e=>{let{__scopePopper:t,children:n}=e,[r,i]=W.useState(null),[a,o]=W.useState(void 0);return(0,G.jsx)(xh,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),wh=`PopperAnchor`,Th=W.forwardRef(hh(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=Sh(wh,n),o=W.useRef(null),s=a.onAnchorChange,c=Rc(t,W.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=W.useRef(null);W.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Mh(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,G.jsx)(ol.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Eh=`PopperContent`,[Dh,Oh]=yh(Eh),kh=W.forwardRef(hh(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=gh.Partial,hideWhenDetached:f=!1,updatePositionStrategy:p=_h.Optimized,onPlaced:m,...h}=e,g=Sh(Eh,n),[_,v]=W.useState(null),y=Rc(t,v),[b,x]=W.useState(null),S=np(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(Ah),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=ah({strategy:`fixed`,placement:T,whileElementsMounted:hh((...e)=>Gm(...e,{animationFrame:p===_h.Always}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[sh({mainAxis:i+w,alignmentAxis:o}),c&&ch({mainAxis:!0,crossAxis:!1,...d===gh.Partial?{limiter:lh()}:{},...k}),c&&uh({...k}),dh({...k,apply:hh(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&ph({element:b,padding:s}),jh({arrowWidth:C,arrowHeight:w}),f&&fh(O?{strategy:`referenceHidden`,...k}:{strategy:`referenceHidden`,padding:k.padding,altBoundary:k.altBoundary})]}),F=g.setPlacementState;_l(()=>(F(M),()=>{F(void 0)}),[M,F]);let[I,ee]=Mh(M),L=yu(m);_l(()=>{N&&L?.()},[N,L]);let te=P.arrow?.x,R=P.arrow?.y,z=P.arrow?.centerOffset!==0,[ne,re]=W.useState();return _l(()=>{_&&re(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ne,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(Dh,{scope:n,placedSide:I,placedAlign:ee,onArrowChange:x,arrowX:te,arrowY:R,shouldHideArrow:z,children:(0,G.jsx)(ol.div,{"data-side":I,"data-align":ee,...h,ref:y,style:{...h.style,animation:N?h.style?.animation:`none`}})})})},`PopperContent`));function Ah(e){return e!==null}hh(Ah,`isNotNull`);var jh=hh(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Mh(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function Mh(e){let[t,n=`center`]=e.split(`-`);return[t,n]}hh(Mh,`getSideAndAlignFromPlacement`);var Nh=Object.defineProperty,Ph=(e,t)=>Nh(e,`name`,{value:t,configurable:!0}),Fh=!1;function Ih(){let[e,t]=W.useState(Fh);return W.useEffect(()=>{Fh||(Fh=!0,t(!0))},[]),e}Ph(Ih,`useIsHydrated`);var Lh=W.useSyncExternalStore;function Rh(){return()=>{}}Ph(Rh,`subscribe`);function zh(){return Lh(Rh,()=>!0,()=>!1)}Ph(zh,`useIsHydratedModern`);var Bh=typeof Lh==`function`?zh:Ih,Vh=Object.defineProperty,Hh=(e,t)=>Vh(e,`name`,{value:t,configurable:!0}),Uh=`rovingFocusGroup.onEntryFocus`,Wh={bubbles:!1,cancelable:!0},Gh=`RovingFocusGroup`,[Kh,qh,Jh]=bl(Gh),[Yh,Xh]=hl(Gh,[Jh]),Zh={Vertical:`vertical`,Horizontal:`horizontal`},Qh={LTR:`ltr`,RTL:`rtl`},[$h,eg]=Yh(Gh),tg=W.forwardRef(Hh(function(e,t){return(0,G.jsx)(Kh.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(Kh.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,G.jsx)(ng,{...e,ref:t})})})},`RovingFocusGroup`)),ng=W.forwardRef(Hh(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=W.useRef(null),p=Rc(t,f),m=hu(a),[h,g]=ql({prop:o,defaultProp:s??null,onChange:c,caller:Gh}),[_,v]=W.useState(!1),y=yu(l),b=qh(n),x=W.useRef(!1),[S,C]=W.useState(0);return W.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Uh,y),()=>e.removeEventListener(Uh,y)},[y]),(0,G.jsx)($h,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:W.useCallback(e=>g(e),[g]),onItemShiftTab:W.useCallback(()=>v(!0),[]),onFocusableItemAdd:W.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:W.useCallback(()=>C(e=>e-1),[]),children:(0,G.jsx)(ol.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:J(e.onMouseDown,()=>{x.current=!0}),onFocus:J(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Uh,Wh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);cg([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:J(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),rg=`RovingFocusGroupItem`,ig=W.forwardRef(Hh(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=uu(),l=a||c,u=eg(rg,n),d=u.currentTabStopId===l,f=qh(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Bh();return _l(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),W.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,G.jsx)(Kh.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,G.jsx)(ol.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:J(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:J(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=sg(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?lg(n,r+1):n.slice(r+1)}setTimeout(()=>cg(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),ag={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function og(e,t){return t===Qh.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Hh(og,`getDirectionAwareKey`);function sg(e,t,n){let r=og(e.key,n);if(!(t===Zh.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Zh.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return ag[r]}Hh(sg,`getFocusIntent`);function cg(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Hh(cg,`focusFirst`);function lg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Hh(lg,`wrapArray`);var ug=Object.defineProperty,dg=(e,t)=>ug(e,`name`,{value:t,configurable:!0}),fg=[`Enter`,` `],pg=[`ArrowDown`,`PageUp`,`Home`],mg=[`ArrowUp`,`PageDown`,`End`],hg=[...pg,...mg];[...fg],[...fg];var gg=`Menu`,[_g,vg,yg]=bl(gg),[bg,xg]=hl(gg,[yg,bh,Xh]),Sg=bh(),Cg=Xh(),[wg,Tg]=bg(gg),[Eg,Dg]=bg(gg),Og=dg(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Sg(t),[c,l]=W.useState(null),u=W.useRef(!1),d=yu(a),f=hu(i);return W.useEffect(()=>{let e=dg(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=dg(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),W.useEffect(()=>{if(!n)return;let e=dg(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,G.jsx)(Ch,{...s,children:(0,G.jsx)(wg,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,G.jsx)(Eg,{scope:t,onClose:W.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),kg=W.forwardRef(dg(function(e,t){let{__scopeMenu:n,...r}=e,i=Sg(n);return(0,G.jsx)(Th,{...i,...r,ref:t})},`MenuAnchor`)),Ag=`MenuPortal`,[jg,Mg]=bg(Ag,{forceMount:void 0}),Ng=dg(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Tg(Ag,t);return(0,G.jsx)(jg,{scope:t,forceMount:n,children:(0,G.jsx)(Y,{present:n||a.open,children:(0,G.jsx)(nd,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Pg=`MenuContent`,[Fg,Ig]=bg(Pg),Lg=W.forwardRef(dg(function(e,t){let n=Mg(Pg,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Tg(Pg,e.__scopeMenu),o=Dg(Pg,e.__scopeMenu);return(0,G.jsx)(_g.Provider,{scope:e.__scopeMenu,children:(0,G.jsx)(Y,{present:r||a.open,children:(0,G.jsx)(_g.Slot,{scope:e.__scopeMenu,children:o.modal?(0,G.jsx)(Rg,{...i,ref:t}):(0,G.jsx)(zg,{...i,ref:t})})})})},`MenuContent`)),Rg=W.forwardRef(dg(function(e,t){let n=Tg(Pg,e.__scopeMenu),r=W.useRef(null),i=Rc(t,r);return W.useEffect(()=>{let e=r.current;if(e)return Df(e)},[]),(0,G.jsx)(Vg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),zg=W.forwardRef(dg(function(e,t){let n=Tg(Pg,e.__scopeMenu);return(0,G.jsx)(Vg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Bg=Vc(`MenuContent.ScrollLock`),Vg=W.forwardRef(dg(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Tg(Pg,n),_=Dg(Pg,n),v=Sg(n),y=Cg(n),b=vg(n),[x,S]=W.useState(null),C=W.useRef(null),[w,T]=W.useState(null);Uu(w);let{nodes:E,registry:D}=Hu(),O=!!(i||m),k=Rc(t,C,g.onContentChange,T),A=W.useRef(0),j=W.useRef(``),M=W.useRef(0),N=W.useRef(null),P=W.useRef(`right`),F=W.useRef(0),I=W.useMemo(()=>m?[C,...E.map(e=>({current:e}))]:[],[C,E,m]),ee=m?vf:W.Fragment,L=m?{as:Bg,allowPinchZoom:!0,shards:I}:void 0,te=dg(e=>{let t=j.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=i_(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;function s(e){j.current=e,window.clearTimeout(A.current),e!==``&&(A.current=window.setTimeout(()=>s(``),1e3))}dg(s,`updateSearch`),s(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);W.useEffect(()=>()=>window.clearTimeout(A.current),[]),cd();let R=W.useCallback(e=>P.current===N.current?.side&&o_(e,N.current?.area),[]);return(0,G.jsx)(Fg,{scope:n,searchRef:j,onItemEnter:W.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:W.useCallback(e=>{R(e)||(C.current?.focus(),S(null))},[R]),onTriggerLeave:W.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:M,onPointerGraceIntentChange:W.useCallback(e=>{N.current=e},[]),children:(0,G.jsx)(Vu,{registry:O?D:null,children:(0,G.jsx)(ee,{...L,children:(0,G.jsx)(zu,{asChild:!0,trapped:i,branches:E,onMountAutoFocus:J(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,G.jsx)(Du,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,G.jsx)(tg,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:J(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,G.jsx)(kh,{role:`menu`,"aria-orientation":`vertical`,"data-state":$g(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:k,style:{outline:`none`,...h.style},onKeyDown:J(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=C.current;if(e.target!==i||!hg.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);mg.includes(e.key)&&a.reverse(),n_(a)}),onBlur:J(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:J(e.onPointerMove,s_(e=>{let t=e.target,n=F.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>F.current?`right`:`left`;P.current=t,F.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),Hg=`MenuItem`,Ug=`menu.itemSelect`,Wg=W.forwardRef(dg(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=W.useRef(null),o=Dg(Hg,e.__scopeMenu),s=Ig(Hg,e.__scopeMenu),c=Rc(t,a),l=W.useRef(!1),u=dg(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Ug,{bubbles:!0,cancelable:!0});e.addEventListener(Ug,e=>r?.(e),{once:!0}),sl(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,G.jsx)(Gg,{...i,ref:c,disabled:n,onClick:J(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:J(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:J(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&fg.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Gg=W.forwardRef(dg(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Ig(Hg,n),s=Cg(n),c=W.useRef(null),l=Rc(t,c),[u,d]=W.useState(!1),[f,p]=W.useState(``);return W.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,G.jsx)(_g.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,G.jsx)(ig,{asChild:!0,...s,focusable:!r,children:(0,G.jsx)(ol.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:J(e.onPointerMove,s_(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:J(e.onPointerLeave,s_(e=>o.onItemLeave(e))),onFocus:J(e.onFocus,()=>d(!0)),onBlur:J(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Kg,qg]=bg(`MenuRadioGroup`,{value:void 0,onValueChange:dg(()=>{},`onValueChange`)}),[Jg,Yg]=bg(`MenuItemIndicator`,{checked:!1}),Xg=W.forwardRef(dg(function(e,t){let{__scopeMenu:n,...r}=e;return(0,G.jsx)(ol.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Zg,Qg]=bg(`MenuSub`);function $g(e){return e?`open`:`closed`}dg($g,`getOpenState`);function e_(e){return e===`indeterminate`}dg(e_,`isIndeterminate`);function t_(e){return e_(e)?`indeterminate`:e?`checked`:`unchecked`}dg(t_,`getCheckedState`);function n_(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}dg(n_,`focusFirst`);function r_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}dg(r_,`wrapArray`);function i_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=r_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}dg(i_,`getNextMatch`);function a_(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}dg(a_,`isPointInPolygon`);function o_(e,t){return t?a_({x:e.clientX,y:e.clientY},t):!1}dg(o_,`isPointerInGraceArea`);function s_(e){return t=>t.pointerType===`mouse`?e(t):void 0}dg(s_,`whenMouse`);var c_=Object.defineProperty,l_=(e,t)=>c_(e,`name`,{value:t,configurable:!0}),u_=`ContextMenu`,[d_,f_]=hl(u_,[xg]),p_=xg(),[m_,h_]=d_(u_),g_=l_(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=W.useRef(!1),[c,l]=ql({prop:i,defaultProp:!1,onChange:r,caller:u_}),u=p_(t);return(0,G.jsx)(m_,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,G.jsx)(Og,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),__=`ContextMenuTrigger`,v_=W.forwardRef(l_(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=h_(__,n),o=p_(n),[s,c]=W.useState({x:0,y:0}),l=W.useMemo(()=>({current:{getBoundingClientRect:l_(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=W.useRef(0),d=W.useCallback(()=>window.clearTimeout(u.current),[]),f=l_(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return W.useEffect(()=>d,[d]),W.useEffect(()=>void(r&&d()),[r,d]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(kg,{...o,virtualRef:l}),(0,G.jsx)(ol.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:J(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:J(e.onPointerDown,w_(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:J(e.onPointerMove,w_(d)),onPointerCancel:r?e.onPointerCancel:J(e.onPointerCancel,w_(d)),onPointerUp:r?e.onPointerUp:J(e.onPointerUp,w_(d))})]})},`ContextMenuTrigger`)),y_=l_(e=>{let{__scopeContextMenu:t,...n}=e,r=p_(t);return(0,G.jsx)(Ng,{...r,...n})},`ContextMenuPortal`),b_=`ContextMenuContent`,x_=W.forwardRef(l_(function(e,t){let{__scopeContextMenu:n,...r}=e,i=h_(b_,n),a=p_(n),o=W.useRef(!1);return(0,G.jsx)(Lg,{...a,side:`right`,sideOffset:2,align:`start`,...r,ref:t,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),S_=W.forwardRef(l_(function(e,t){let{__scopeContextMenu:n,...r}=e,i=p_(n);return(0,G.jsx)(Wg,{...i,...r,ref:t})},`ContextMenuItem`)),C_=W.forwardRef(l_(function(e,t){let{__scopeContextMenu:n,...r}=e,i=p_(n);return(0,G.jsx)(Xg,{...i,...r,ref:t})},`ContextMenuSeparator`));function w_(e){return t=>t.pointerType===`mouse`?void 0:e(t)}l_(w_,`whenTouchOrPen`);var T_=Object.defineProperty,E_=(e,t)=>T_(e,`name`,{value:t,configurable:!0}),D_=`DropdownMenu`,[O_,k_]=hl(D_,[xg]),A_=xg(),[j_,M_]=O_(D_),N_=E_(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=A_(t),l=W.useRef(null),[u,d]=ql({prop:i,defaultProp:a??!1,onChange:o,caller:D_});return(0,G.jsx)(j_,{scope:t,triggerId:uu(),triggerRef:l,contentId:uu(),open:u,onOpenChange:d,onOpenToggle:W.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,G.jsx)(Og,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),P_=`DropdownMenuTrigger`,F_=W.forwardRef(E_(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=M_(P_,n),o=A_(n),s=Rc(t,a.triggerRef);return(0,G.jsx)(kg,{asChild:!0,...o,children:(0,G.jsx)(ol.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:J(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:J(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),I_=E_(e=>{let{__scopeDropdownMenu:t,...n}=e,r=A_(t);return(0,G.jsx)(Ng,{...r,...n})},`DropdownMenuPortal`),L_=`DropdownMenuContent`,R_=W.forwardRef(E_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=M_(L_,n),a=A_(n),o=W.useRef(!1);return(0,G.jsx)(Lg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:J(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),z_=W.forwardRef(E_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=A_(n);return(0,G.jsx)(Wg,{...i,...r,ref:t})},`DropdownMenuItem`)),B_=W.forwardRef(E_(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=A_(n);return(0,G.jsx)(Xg,{...i,...r,ref:t})},`DropdownMenuSeparator`)),V_=Object.defineProperty,H_=(e,t)=>V_(e,`name`,{value:t,configurable:!0}),U_,W_=`HoverCard`,[G_,K_]=hl(W_,[bh]),q_=bh(),[J_,Y_]=G_(W_),X_=H_(e=>{let{__scopeHoverCard:t,children:n,open:r,defaultOpen:i,onOpenChange:a,openDelay:o=700,closeDelay:s=300}=e,c=q_(t),l=W.useRef(0),u=W.useRef(0),d=W.useRef(!1),f=W.useRef(!1),[p,m]=ql({prop:r,defaultProp:i??!1,onChange:a,caller:W_}),h=W.useCallback(()=>{clearTimeout(u.current),l.current=window.setTimeout(()=>m(!0),o)},[o,m]),g=W.useCallback(()=>{clearTimeout(l.current),!d.current&&!f.current&&(u.current=window.setTimeout(()=>m(!1),s))},[s,m]),_=W.useCallback(()=>m(!1),[m]);return W.useEffect(()=>()=>{clearTimeout(l.current),clearTimeout(u.current)},[]),(0,G.jsx)(J_,{scope:t,open:p,onOpenChange:m,onOpen:h,onClose:g,onDismiss:_,hasSelectionRef:d,isPointerDownOnContentRef:f,children:(0,G.jsx)(Ch,{...c,children:n})})},`HoverCard`),Z_=`HoverCardTrigger`,Q_=W.forwardRef(H_(function(e,t){let{__scopeHoverCard:n,...r}=e,i=Y_(Z_,n),a=q_(n);return(0,G.jsx)(Th,{asChild:!0,...a,children:(0,G.jsx)(ol.a,{"data-state":i.open?`open`:`closed`,...r,ref:t,onPointerEnter:J(e.onPointerEnter,ov(i.onOpen)),onPointerLeave:J(e.onPointerLeave,ov(i.onClose)),onFocus:J(e.onFocus,i.onOpen),onBlur:J(e.onBlur,i.onClose),onTouchStart:J(e.onTouchStart,e=>e.preventDefault())})})},`HoverCardTrigger`)),$_=`HoverCardPortal`,[ev,tv]=G_($_,{forceMount:void 0}),nv=H_(e=>{let{__scopeHoverCard:t,forceMount:n,children:r,container:i}=e,a=Y_($_,t);return(0,G.jsx)(ev,{scope:t,forceMount:n,children:(0,G.jsx)(Y,{present:n||a.open,children:(0,G.jsx)(nd,{asChild:!0,container:i,children:r})})})},`HoverCardPortal`),rv=`HoverCardContent`,iv=W.forwardRef(H_(function(e,t){let n=tv(rv,e.__scopeHoverCard),{forceMount:r=n.forceMount,...i}=e,a=Y_(rv,e.__scopeHoverCard);return(0,G.jsx)(Y,{present:r||a.open,children:(0,G.jsx)(av,{"data-state":a.open?`open`:`closed`,...i,onPointerEnter:J(e.onPointerEnter,ov(a.onOpen)),onPointerLeave:J(e.onPointerLeave,ov(a.onClose)),ref:t})})},`HoverCardContent`)),av=W.forwardRef(H_(function(e,t){let{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,...s}=e,c=Y_(rv,n),l=q_(n),u=W.useRef(null),[d,f]=W.useState(null),p=Rc(t,u,f);Uu(d);let[m,h]=W.useState(!1);return W.useEffect(()=>{if(m){let e=document.body;return U_=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect=`none`,e.style.webkitUserSelect=`none`,()=>{e.style.userSelect=U_,e.style.webkitUserSelect=U_}}},[m]),W.useEffect(()=>{if(u.current){let e=H_(()=>{h(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==``&&(c.hasSelectionRef.current=!0)})},`handlePointerUp`);return document.addEventListener(`pointerup`,e),()=>{document.removeEventListener(`pointerup`,e),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),W.useEffect(()=>{u.current&&sv(u.current).forEach(e=>e.setAttribute(`tabindex`,`-1`))}),(0,G.jsx)(Du,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:o,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:J(a,e=>{e.preventDefault()}),onDismiss:c.onDismiss,children:(0,G.jsx)(kh,{...l,...s,onPointerDown:J(s.onPointerDown,e=>{e.currentTarget.contains(e.target)&&h(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:p,style:{...s.style,userSelect:m?`text`:void 0,WebkitUserSelect:m?`text`:void 0,"--radix-hover-card-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-hover-card-content-available-width":`var(--radix-popper-available-width)`,"--radix-hover-card-content-available-height":`var(--radix-popper-available-height)`,"--radix-hover-card-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-hover-card-trigger-height":`var(--radix-popper-anchor-height)`}})})},`HoverCardContentImpl`));function ov(e){return t=>t.pointerType===`touch`?void 0:e()}H_(ov,`excludeTouch`);function sv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:H_(e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}H_(sv,`getTabbableNodes`);var cv=Object.defineProperty,lv=(e,t)=>cv(e,`name`,{value:t,configurable:!0}),uv=`Popover`,[dv,fv]=hl(uv,[bh]),pv=bh(),[mv,hv]=dv(uv),gv=lv(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=pv(t),c=W.useRef(null),[l,u]=W.useState(!1),[d,f]=W.useState(0),[p,m]=W.useState(0),[h,g]=ql({prop:r,defaultProp:i??!1,onChange:a,caller:uv});return(0,G.jsx)(Ch,{...s,children:(0,G.jsx)(mv,{scope:t,contentId:uu(),titleId:uu(),descriptionId:uu(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:W.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:W.useCallback(()=>u(!0),[]),onCustomAnchorRemove:W.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),_v=`PopoverTrigger`,vv=W.forwardRef(lv(function(e,t){let{__scopePopover:n,...r}=e,i=hv(_v,n),a=pv(n),o=Rc(t,i.triggerRef),s=(0,G.jsx)(ol.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":kv(i.open),...r,ref:o,onClick:J(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,G.jsx)(Th,{asChild:!0,...a,children:s})},`PopoverTrigger`)),yv=`PopoverPortal`,[bv,xv]=dv(yv,{forceMount:void 0}),Sv=lv(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=hv(yv,t);return(0,G.jsx)(bv,{scope:t,forceMount:n,children:(0,G.jsx)(Y,{present:n||a.open,children:(0,G.jsx)(nd,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Cv=`PopoverContent`,wv=W.forwardRef(lv(function(e,t){let n=xv(Cv,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=hv(Cv,e.__scopePopover);return(0,G.jsx)(Y,{present:r||a.open,children:a.modal?(0,G.jsx)(Ev,{...i,ref:t}):(0,G.jsx)(Dv,{...i,ref:t})})},`PopoverContent`)),Tv=Vc(`PopoverContent.RemoveScroll`),Ev=W.forwardRef(lv(function(e,t){let n=hv(Cv,e.__scopePopover),r=W.useRef(null),i=Rc(t,r),a=W.useRef(!1),{nodes:o,registry:s}=Hu();return W.useEffect(()=>{let e=r.current;if(e)return Df(e)},[]),(0,G.jsx)(vf,{as:Tv,allowPinchZoom:!0,shards:W.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,G.jsx)(Ov,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:J(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Dv=W.forwardRef(lv(function(e,t){let n=hv(Cv,e.__scopePopover),r=W.useRef(!1),i=W.useRef(!1);return(0,G.jsx)(Ov,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Ov=W.forwardRef(lv(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=hv(Cv,n),g=pv(n),[_,v]=W.useState(null),y=Rc(t,v);return Uu(_),cd(),(0,G.jsx)(Vu,{registry:p,children:(0,G.jsx)(zu,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(Du,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,G.jsx)(kh,{"data-state":kv(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?Av(d,h.descriptionId):d,...g,...m,ref:y,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`));function kv(e){return e?`open`:`closed`}lv(kv,`getState`);function Av(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}lv(Av,`concatAriaDescribedby`);var jv=Object.defineProperty,Mv=(e,t)=>jv(e,`name`,{value:t,configurable:!0}),Nv=`Toggle`,Pv=W.forwardRef(Mv(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ql({prop:n,onChange:i,defaultProp:r??!1,caller:Nv});return(0,G.jsx)(ol.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:J(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),Fv=Object.defineProperty,Iv=(e,t)=>Fv(e,`name`,{value:t,configurable:!0}),Lv=`ToggleGroup`,Rv={Single:`single`,Multiple:`multiple`},[zv,Bv]=hl(Lv,[Xh]),Vv=Xh(),Hv=W.forwardRef(Iv(function(e,t){let{type:n,...r}=e;if(n===Rv.Single)return(0,G.jsx)(Gv,{role:`radiogroup`,...r,ref:t});if(n===Rv.Multiple)return(0,G.jsx)(Kv,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${Lv}\``)},`ToggleGroup`)),[Uv,Wv]=zv(Lv),Gv=W.forwardRef(Iv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Iv(()=>{},`onValueChange`),...a}=e,[o,s]=ql({prop:n,defaultProp:r??``,onChange:i,caller:Lv});return(0,G.jsx)(Uv,{scope:e.__scopeToggleGroup,type:Rv.Single,value:W.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:W.useCallback(()=>s(``),[s]),children:(0,G.jsx)(Yv,{...a,ref:t})})},`ToggleGroupImplSingle`)),Kv=W.forwardRef(Iv(function(e,t){let{value:n,defaultValue:r,onValueChange:i=Iv(()=>{},`onValueChange`),...a}=e,[o,s]=ql({prop:n,defaultProp:r??[],onChange:i,caller:Lv}),c=W.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=W.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,G.jsx)(Uv,{scope:e.__scopeToggleGroup,type:Rv.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,G.jsx)(Yv,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[qv,Jv]=zv(Lv),Yv=W.forwardRef(Iv(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=Vv(n),u=hu(o),d={dir:u,...c};return(0,G.jsx)(qv,{scope:n,rovingFocus:i,disabled:r,children:i?(0,G.jsx)(tg,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,G.jsx)(ol.div,{...d,ref:t})}):(0,G.jsx)(ol.div,{...d,ref:t})})},`ToggleGroupImpl`)),Xv=`ToggleGroupItem`,Zv=W.forwardRef(Iv(function(e,t){let n=Wv(Xv,e.__scopeToggleGroup),r=Jv(Xv,e.__scopeToggleGroup),i=Vv(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=W.useRef(null);return r.rovingFocus?(0,G.jsx)(ig,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,G.jsx)(Qv,{...s,ref:t})}):(0,G.jsx)(Qv,{...s,ref:t})},`ToggleGroupItem`)),Qv=W.forwardRef(Iv(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Wv(Xv,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===Rv.Single?o:void 0;return(0,G.jsx)(Pv,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),$v=Object.defineProperty,ey=(e,t)=>$v(e,`name`,{value:t,configurable:!0}),[ty,ny]=hl(`Tooltip`,[bh]),ry=bh(),iy=`TooltipProvider`,ay=700,oy=`tooltip.open`,[sy,cy]=ty(iy),ly=ey(e=>{let{__scopeTooltip:t,delayDuration:n=ay,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=W.useRef(!0),s=W.useRef(!1),c=W.useRef(0);return W.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,G.jsx)(sy,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:W.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:W.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:W.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),uy=`Tooltip`,[dy,fy]=ty(uy),py=ey(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=cy(uy,e.__scopeTooltip),l=ry(t),[u,d]=W.useState(null),[f,p]=W.useState(void 0),m=uu(),h=W.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=W.useRef(!1),[y,b]=ql({prop:r,defaultProp:i??!1,onChange:ey(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(oy))):c.onClose(),a?.(e)},`onChange`),caller:uy}),x=W.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=W.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=W.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=W.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);W.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,G.jsx)(Ch,{...l,children:(0,G.jsx)(dy,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:W.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:W.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),my=`TooltipTrigger`,hy=W.forwardRef(ey(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,a=fy(my,n),o=cy(my,n),s=ry(n),c=Rc(t,W.useRef(null),a.onTriggerChange),l=W.useRef(!1),u=W.useRef(!1),d=W.useCallback(()=>l.current=!1,[]);return W.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,G.jsx)(Th,{asChild:!0,...s,children:(0,G.jsx)(ol.button,{"aria-describedby":a.open?jy(r,a.contentId):r,"data-state":a.stateAttribute,...i,ref:c,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:J(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:J(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:J(e.onBlur,a.onClose),onClick:J(e.onClick,a.onClose)})})},`TooltipTrigger`)),gy=`TooltipPortal`,[_y,vy]=ty(gy,{forceMount:void 0}),yy=ey(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=fy(gy,t);return(0,G.jsx)(_y,{scope:t,forceMount:n,children:(0,G.jsx)(Y,{present:n||a.open,children:(0,G.jsx)(nd,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),by=`TooltipContent`,xy=W.forwardRef(ey(function(e,t){let n=vy(by,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=fy(by,e.__scopeTooltip);return(0,G.jsx)(Y,{present:r||o.open,children:o.disableHoverableContent?(0,G.jsx)(wy,{side:i,...a,ref:t}):(0,G.jsx)(Sy,{side:i,...a,ref:t})})},`TooltipContent`)),Sy=W.forwardRef(ey(function(e,t){let n=fy(by,e.__scopeTooltip),r=cy(by,e.__scopeTooltip),i=W.useRef(null),a=Rc(t,i),[o,s]=W.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=W.useCallback(()=>{s(null),d(!1)},[d]),p=W.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ey(r,Ty(r,n.getBoundingClientRect())),a=Dy(t.getBoundingClientRect()),o=ky([...i,...a]);s(o),d(!0)},[d]);return W.useEffect(()=>()=>f(),[f]),W.useEffect(()=>{if(c&&u){let e=ey(e=>p(e,u),`handleTriggerLeave`),t=ey(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),W.useEffect(()=>{if(o){let e=ey(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Oy(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,G.jsx)(wy,{...e,ref:a})},`TooltipContentHoverable`)),Cy=Wc(`TooltipContent`),wy=W.forwardRef(ey(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=fy(by,n),u=ry(n),{onClose:d}=l,[f,p]=W.useState(null),m=Rc(t,p);Uu(f),W.useEffect(()=>(document.addEventListener(oy,d),()=>document.removeEventListener(oy,d)),[d]),W.useEffect(()=>{if(l.trigger){let e=ey(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:h}=l;return _l(()=>(h(a),()=>{h(void 0)}),[a,h]),(0,G.jsx)(Du,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,G.jsxs)(kh,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:m,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,G.jsx)(Cy,{children:r}),i?(0,G.jsx)(dl,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function Ty(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}ey(Ty,`getExitSideFromRect`);function Ey(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}ey(Ey,`getPaddedExitPoints`);function Dy(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}ey(Dy,`getPointsFromRect`);function Oy(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}ey(Oy,`isPointInPolygon`);function ky(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Ay(t)}ey(ky,`getHull`);function Ay(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ey(Ay,`getHullPresorted`);function jy(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}ey(jy,`concatAriaDescribedby`);var My=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ny=(e,t)=>({classGroupId:e,validator:t}),Py=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fy=`-`,Iy=[],Ly=`arbitrary..`,Ry=e=>{let t=Vy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return By(e);let n=e.split(Fy);return zy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?My(i,t):t:i||Iy}return n[e]||Iy}}},zy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=zy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Fy):e.slice(t).join(Fy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},By=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ly+r:void 0})(),Vy=e=>{let{theme:t,classGroups:n}=e;return Hy(n,t)},Hy=(e,t)=>{let n=Py();for(let r in e){let i=e[r];Uy(i,n,r,t)}return n},Uy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Wy(i,t,n,r)}},Wy=(e,t,n,r)=>{typeof e==`string`?Gy(e,t,n):typeof e==`function`?Ky(e,t,n,r):qy(e,t,n,r)},Gy=(e,t,n)=>{let r=e===``?t:Jy(t,e);r.classGroupId=n},Ky=(e,t,n,r)=>{Yy(e)?Uy(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(Ny(n,e)))},qy=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Uy(o,Jy(t,a),n,r)}},Jy=(e,t)=>{let n=e,r=t.split(Fy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Py(),n.nextPart.set(t,i)),n=i}return n},Yy=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Xy=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Zy=`!`,Qy=`:`,$y=[],eb=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),tb=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Qy){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Zy)?(c=s.slice(0,-1),l=!0):s.startsWith(Zy)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return eb(t,l,c,u)};if(t){let e=t+Qy,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):eb($y,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},nb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},rb=e=>({cache:Xy(e.cacheSize),parseClassName:tb(e),sortModifiers:nb(e),postfixLookupClassGroupIds:ib(e),...Ry(e)}),ib=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},ab=/\s+/,ob=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(ab),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Zy:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},sb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=cb(n))&&(i&&(i+=` `),i+=r);return i},cb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=cb(e[r]))&&(n&&(n+=` `),n+=t);return n},lb=(e,...t)=>{let n,r,i,a,o=o=>(n=rb(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ob(e,n);return i(e,a),a};return a=o,(...e)=>a(sb(...e))},ub=[],db=e=>{let t=t=>t[e]||ub;return t.isThemeGetter=!0,t.themeKey=e,t},fb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,mb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,hb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,_b=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,vb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bb=e=>mb.test(e),xb=e=>!!e&&!Number.isNaN(Number(e)),Sb=e=>!!e&&Number.isInteger(Number(e)),Cb=e=>e.endsWith(`%`)&&xb(e.slice(0,-1)),wb=e=>hb.test(e),Tb=()=>!0,Eb=e=>gb.test(e)&&!_b.test(e),Db=()=>!1,Ob=e=>vb.test(e),kb=e=>yb.test(e),Ab=e=>!Z(e)&&!Q(e),jb=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Mb=e=>qb(e,Zb,Db),Z=e=>fb.test(e),Nb=e=>qb(e,Qb,Eb),Pb=e=>qb(e,$b,xb),Fb=e=>qb(e,tx,Tb),Ib=e=>qb(e,ex,Db),Lb=e=>qb(e,Yb,Db),Rb=e=>qb(e,Xb,kb),zb=e=>qb(e,nx,Ob),Q=e=>pb.test(e),Bb=e=>Jb(e,Qb),Vb=e=>Jb(e,ex),Hb=e=>Jb(e,Yb),Ub=e=>Jb(e,Zb),Wb=e=>Jb(e,Xb),Gb=e=>Jb(e,nx,!0),Kb=e=>Jb(e,tx,!0),qb=(e,t,n)=>{let r=fb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Jb=(e,t,n=!1)=>{let r=pb.exec(e);return r?r[1]?t(r[1]):n:!1},Yb=e=>e===`position`||e===`percentage`,Xb=e=>e===`image`||e===`url`,Zb=e=>e===`length`||e===`size`||e===`bg-size`,Qb=e=>e===`length`,$b=e=>e===`number`,ex=e=>e===`family-name`,tx=e=>e===`number`||e===`weight`,nx=e=>e===`shadow`,rx=()=>{let e=db(`color`),t=db(`font`),n=db(`text`),r=db(`font-weight`),i=db(`tracking`),a=db(`leading`),o=db(`breakpoint`),s=db(`container`),c=db(`spacing`),l=db(`radius`),u=db(`shadow`),d=db(`inset-shadow`),f=db(`text-shadow`),p=db(`drop-shadow`),m=db(`blur`),h=db(`perspective`),g=db(`aspect`),_=db(`ease`),v=db(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Q,Z],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Q,Z,c],T=()=>[bb,`full`,`auto`,...w()],E=()=>[Sb,`none`,`subgrid`,Q,Z],D=()=>[`auto`,{span:[`full`,Sb,Q,Z]},Sb,Q,Z],O=()=>[Sb,`auto`,Q,Z],k=()=>[`auto`,`min`,`max`,`fr`,Q,Z],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[bb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[s,bb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[bb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Q,Z],ee=()=>[...b(),Hb,Lb,{position:[Q,Z]}],L=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Ub,Mb,{size:[Q,Z]}],R=()=>[Cb,Bb,Nb],z=()=>[``,`none`,`full`,l,Q,Z],ne=()=>[``,xb,Bb,Nb],re=()=>[`solid`,`dashed`,`dotted`,`double`],ie=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ae=()=>[xb,Cb,Hb,Lb],oe=()=>[``,`none`,m,Q,Z],se=()=>[`none`,xb,Q,Z],ce=()=>[`none`,xb,Q,Z],B=()=>[xb,Q,Z],V=()=>[bb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[wb],breakpoint:[wb],color:[Tb],container:[wb],"drop-shadow":[wb],ease:[`in`,`out`,`in-out`],font:[Ab],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[wb],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[wb],shadow:[wb],spacing:[`px`,xb],text:[wb],"text-shadow":[wb],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,bb,Z,Q,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Q,Z]}],"container-named":[jb],columns:[{columns:[xb,`auto`,Z,Q,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Sb,`auto`,Q,Z]}],basis:[{basis:[bb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[xb,bb,`auto`,`initial`,`none`,Z]}],grow:[{grow:[``,xb,Q,Z]}],shrink:[{shrink:[``,xb,Q,Z]}],order:[{order:[Sb,`first`,`last`,`none`,Q,Z]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...N()]}],"font-size":[{text:[`base`,n,Bb,Nb]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Kb,Fb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Cb,Z]}],"font-family":[{font:[Vb,Ib,t]}],"font-features":[{"font-features":[Z]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Q,Z]}],"line-clamp":[{"line-clamp":[xb,`none`,Q,Pb]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Q,Z]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Q,Z]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...re(),`wavy`]}],"text-decoration-thickness":[{decoration:[xb,`from-font`,`auto`,Q,Nb]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[xb,`auto`,Q,Z]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Sb,Q,Z]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Q,Z]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Q,Z]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Sb,Q,Z],radial:[``,Q,Z],conic:[``,Sb,Q,Z]},Wb,Rb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...re(),`hidden`,`none`]}],"divide-style":[{divide:[...re(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...re(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[xb,Q,Z]}],"outline-w":[{outline:[``,xb,Bb,Nb]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`inner`,`none`,u,Gb,zb]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Gb,zb]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:ne()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[xb,Nb]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Gb,zb]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[xb,Q,Z]}],"mix-blend":[{"mix-blend":[...ie(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[xb]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Q,Z]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[xb]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Q,Z]}],filter:[{filter:[``,`none`,Q,Z]}],blur:[{blur:oe()}],brightness:[{brightness:[xb,Q,Z]}],contrast:[{contrast:[xb,Q,Z]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Gb,zb]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,xb,Q,Z]}],"hue-rotate":[{"hue-rotate":[xb,Q,Z]}],invert:[{invert:[``,xb,Q,Z]}],saturate:[{saturate:[xb,Q,Z]}],sepia:[{sepia:[``,xb,Q,Z]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Q,Z]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[xb,Q,Z]}],"backdrop-contrast":[{"backdrop-contrast":[xb,Q,Z]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,xb,Q,Z]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xb,Q,Z]}],"backdrop-invert":[{"backdrop-invert":[``,xb,Q,Z]}],"backdrop-opacity":[{"backdrop-opacity":[xb,Q,Z]}],"backdrop-saturate":[{"backdrop-saturate":[xb,Q,Z]}],"backdrop-sepia":[{"backdrop-sepia":[``,xb,Q,Z]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Q,Z]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[xb,`initial`,Q,Z]}],ease:[{ease:[`linear`,`initial`,_,Q,Z]}],delay:[{delay:[xb,Q,Z]}],animate:[{animate:[`none`,v,Q,Z]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Q,Z]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":[`scale-3d`],skew:[{skew:B()}],"skew-x":[{"skew-x":B()}],"skew-y":[{"skew-y":B()}],transform:[{transform:[Q,Z,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:V()}],"translate-x":[{"translate-x":V()}],"translate-y":[{"translate-y":V()}],"translate-z":[{"translate-z":V()}],"translate-none":[`translate-none`],zoom:[{zoom:[Sb,Q,Z]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Q,Z]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Q,Z]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[xb,Bb,Nb,Pb]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},ix=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(ax(e,`cacheSize`,t),ax(e,`prefix`,n),ax(e,`experimentalParseClassName`,r),ox(e.theme,a.theme),ox(e.classGroups,a.classGroups),ox(e.conflictingClassGroups,a.conflictingClassGroups),ox(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),ax(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),ax(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),sx(e.theme,i.theme),sx(e.classGroups,i.classGroups),sx(e.conflictingClassGroups,i.conflictingClassGroups),sx(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),cx(e,i,`postfixLookupClassGroups`),cx(e,i,`orderSensitiveModifiers`),e),ax=(e,t,n)=>{n!==void 0&&(e[t]=n)},ox=(e,t)=>{if(t)for(let n in t)ax(e,n,t[n])},sx=(e,t)=>{if(t)for(let n in t)cx(e,t,n)},cx=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},lx=(e,...t)=>typeof e==`function`?lb(rx,e,...t):lb(()=>ix(rx(),e),...t),ux=lb(rx),dx=lx({prefix:`pz`});function fx(...e){return dx(Ac(e))}var px=Nc(`pz:inline-flex pz:shrink-0 pz:items-center pz:justify-center pz:gap-1.5 pz:whitespace-nowrap pz:outline-none pz:focus-visible:ring-2 pz:focus-visible:ring-ring/50 pz:disabled:pointer-events-none pz:disabled:opacity-30`,{variants:{variant:{default:`pz:bg-primary pz:text-primary-foreground pz:hover:bg-primary/90`,ghost:`pz:text-muted-foreground pz:hover:bg-accent pz:hover:text-foreground`},size:{default:`pz:h-7 pz:rounded-lg pz:px-2.5`,"icon-sm":`pz:size-6 pz:rounded-md`,icon:`pz:size-[26px] pz:rounded-[7px]`,"icon-lg":`pz:size-7 pz:rounded-lg`}},defaultVariants:{variant:`default`,size:`default`}});function mx({className:e,variant:t,size:n,type:r=`button`,...i}){return(0,G.jsx)(`button`,{type:r,"data-slot":`button`,className:fx(px({variant:t,size:n,className:e})),...i})}function hx({className:e,...t}){return(0,G.jsx)(`textarea`,{"data-slot":`textarea`,className:fx(`pz:field-sizing-content pz:min-h-7 pz:w-full pz:resize-none pz:bg-transparent pz:py-1 pz:outline-0 pz:placeholder:text-muted-foreground pz:disabled:cursor-not-allowed pz:disabled:opacity-50`,e),...t})}var gx=(0,W.createContext)(!1);function _x({children:e}){return(0,G.jsx)(ly,{delayDuration:300,skipDelayDuration:300,disableHoverableContent:!0,children:(0,G.jsx)(gx.Provider,{value:!0,children:e})})}function vx({label:e,keys:t,side:n=`top`,children:r}){let i=(0,G.jsxs)(py,{children:[(0,G.jsx)(hy,{asChild:!0,children:r}),(0,G.jsx)(yy,{children:(0,G.jsxs)(xy,{side:n,sideOffset:8,collisionPadding:8,"data-slot":`tip`,className:`pz-tip pz:z-50 pz:flex pz:h-[26px] pz:select-none pz:items-center pz:gap-2 pz:whitespace-nowrap pz:rounded-[7px] pz:bg-[#1c1c1b] pz:pr-1.5 pz:pl-[9px] pz:text-[12px] pz:text-white pz:leading-4 pz:antialiased pz:shadow-[0_0_0_0.5px_rgba(255,255,255,0.1),0_4px_14px_rgba(0,0,0,0.18)]`,children:[e,t?.length?(0,G.jsx)(`span`,{className:`pz:flex pz:gap-0.5`,children:t.map(e=>(0,G.jsx)(`kbd`,{className:`pz:min-w-4 pz:rounded pz:bg-white/15 pz:px-1 pz:text-center pz:text-[11px] pz:text-white/85 pz:leading-4 pz:[font-family:inherit]`,children:e},e))}):null]})})]});return(0,W.useContext)(gx)?i:(0,G.jsx)(_x,{children:i})}function yx({modifier:e,n:t,shown:n,index:r=0,center:i=!1,children:a}){return t===void 0?a:(0,G.jsxs)(`span`,{className:fx(`pz-hint`,i&&`pz-hint-center`),"data-shown":n||void 0,style:{"--i":r},children:[(0,G.jsx)(`span`,{className:`pz-hint-icon`,children:a}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pz-hint-keys`,children:(0,G.jsxs)(`span`,{className:`pz-hint-label`,children:[(0,G.jsx)(`span`,{className:`pz-hint-mod`,children:e}),t]})})]})}var bx=Nc(`pz:flex pz:gap-0.5 pz:p-0.5`,{variants:{variant:{solid:`pz:rounded-[9px]`,segmented:`pz:rounded-lg pz:bg-muted`,raised:`pz:p-0`}},defaultVariants:{variant:`solid`}}),xx=Nc(`pz:text-muted-foreground pz:outline-none pz:hover:text-foreground pz:focus-visible:ring-2 pz:focus-visible:ring-ring/50`,{variants:{variant:{solid:`pz:grid pz:h-[26px] pz:w-[30px] pz:place-items-center pz:rounded-[7px] pz:hover:bg-accent pz:aria-checked:bg-muted pz:aria-checked:text-foreground`,segmented:`pz:rounded-md pz:px-2.5 pz:py-1 pz:aria-checked:bg-card pz:aria-checked:text-foreground pz:aria-checked:shadow-[0_1px_2px_rgba(0,0,0,0.08)]`,raised:`pz:grid pz:size-7 pz:place-items-center pz:rounded-lg pz:hover:bg-accent pz:aria-checked:bg-raised pz:aria-checked:text-foreground pz:aria-checked:shadow-raised`}},defaultVariants:{variant:`solid`}});function Sx({value:e,onValueChange:t,variant:n,className:r,items:i}){return(0,G.jsx)(Hv,{type:`single`,"data-slot":`toggle-group`,value:e,onValueChange:e=>e&&t(e),className:fx(bx({variant:n,className:r})),children:i.map(e=>{let t=!!(e.keys&&e.title),r=(0,G.jsx)(Zv,{value:e.value,title:t?void 0:e.title,"aria-label":e.title,"data-slot":`toggle-group-item`,className:xx({variant:n}),children:e.label},e.value);return t?(0,G.jsx)(vx,{label:e.title,keys:e.keys,children:r},e.value):r})})}var Cx=`pz:z-10 pz:min-w-40 pz:rounded-[10px] pz:bg-card pz:p-1 pz:shadow-pop pz:outline-none pz:ring-1 pz:ring-black/5 pz:dark:ring-white/10`,wx=e=>fx(`pz:flex pz:h-[30px] pz:cursor-default pz:items-center pz:gap-2 pz:rounded-md pz:px-2 pz:outline-none pz:data-highlighted:bg-accent`,e&&`pz:text-danger`);function Tx({trigger:e,items:t}){let n=(0,W.useRef)(!1);return(0,G.jsxs)(N_,{modal:!1,children:[(0,G.jsx)(F_,{asChild:!0,children:e}),(0,G.jsx)(R_,{align:`end`,sideOffset:4,className:Cx,onPointerDown:e=>e.stopPropagation(),onEscapeKeyDown:e=>e.stopPropagation(),onCloseAutoFocus:e=>{n.current&&e.preventDefault(),n.current=!1},children:t.map(e=>(0,G.jsxs)(z_,{onSelect:()=>{n.current=!0,e.onSelect()},className:wx(e.danger),children:[e.icon,e.label]},e.label))})]})}function Ex({children:e,items:t}){let n=(0,W.useRef)(!1);return(0,G.jsxs)(g_,{modal:!1,children:[(0,G.jsx)(v_,{asChild:!0,children:e}),(0,G.jsx)(x_,{className:Cx,onPointerDown:e=>e.stopPropagation(),onEscapeKeyDown:e=>e.stopPropagation(),onCloseAutoFocus:e=>{n.current&&e.preventDefault(),n.current=!1},children:t.map(e=>(0,G.jsxs)(S_,{onSelect:()=>{n.current=!0,e.onSelect()},className:wx(e.danger),children:[e.icon,e.label]},e.label))})]})}var Dx=`pz:absolute pz:-top-3 pz:left-5 pz:w-[300px] pz:select-text pz:overflow-hidden pz:rounded-xl pz:bg-card pz:shadow-pop`,Ox=`pz:text-[11.5px] pz:text-muted-foreground`,kx=`pz:whitespace-pre-wrap pz:text-[13.5px] pz:leading-[1.55] pz:[overflow-wrap:anywhere]`;function Ax(e){let t=Math.max(1,Math.round((Date.now()-e)/1e3));if(t<60)return`now`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function jx(e){return e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase()}function Mx(e){if(e.kind!==`agent`)return null;let t=e.name.toLowerCase();return t.includes(`claude`)?`claude`:t.includes(`codex`)||t.includes(`openai`)||t.includes(`chatgpt`)?`openai`:null}function Nx({author:e,size:t=20}){let n=Mx(e);return n?(0,G.jsx)(`span`,{className:`pz:inline-grid pz:shrink-0 pz:place-items-center pz:text-foreground`,style:{width:t,height:t},children:(0,G.jsx)(Oc,{client:n,size:t})}):(0,G.jsx)(`span`,{className:fx(`pz:inline-grid pz:shrink-0 pz:place-items-center pz:rounded-full pz:font-semibold`,e.kind===`agent`?`pz:bg-comment-soft pz:text-foreground`:`pz:bg-muted pz:text-foreground`),style:{width:t,height:t,fontSize:t*.42},children:jx(e.name)})}function Px(e,t,n){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),t()),e.key===`Escape`&&n(),e.stopPropagation()}function Fx(e){(0,W.useEffect)(()=>{let t=requestAnimationFrame(()=>{let t=e.current;t&&(t.focus({preventScroll:!0}),t.setSelectionRange(t.value.length,t.value.length))});return()=>cancelAnimationFrame(t)},[e])}function Ix({onSubmit:e,onCancel:t,placeholder:n=`Leave a comment…`,draft:r}){let[i,a]=(0,W.useState)(``),[o,s]=ji(r?.key??``,r??{file:``}),c=r?o:i,l=r?s:a,u=(0,W.useRef)(null);Fx(u);let d=()=>{let t=c.trim();t&&(e(t),l(``))};return(0,G.jsxs)(`div`,{className:`pz:flex pz:items-end pz:gap-2 pz:border-t pz:py-2 pz:pr-2 pz:pl-3.5 pz:only:border-t-0`,onPointerDown:e=>e.stopPropagation(),children:[(0,G.jsx)(hx,{className:`pz:max-h-40 pz:flex-1 pz:text-[13.5px] pz:leading-[1.55]`,ref:u,value:c,placeholder:n,rows:1,onChange:e=>l(e.target.value),onKeyDown:e=>Px(e,d,t)}),(0,G.jsx)(mx,{size:`icon-lg`,disabled:!c.trim(),onClick:d,"aria-label":`Send`,children:(0,G.jsx)(q,{name:`send`,size:14})})]})}function Lx({initial:e,draft:t,onSave:n,onClose:r}){let[i,a]=ji(t.key,t,e),o=(0,W.useRef)(null);Fx(o),(0,W.useEffect)(()=>()=>{let e=Di(t.key);e&&!Ai(e)&&Oi(t.key,null)},[t.key]);let s=()=>{a(e),r()},c=()=>{let t=i.trim();if(!t||t===e)return s();n(t),a(e)};return(0,G.jsxs)(`div`,{className:`pz:flex pz:flex-col pz:gap-1.5`,children:[(0,G.jsx)(hx,{className:`pz:max-h-60 pz:rounded-lg pz:px-2 pz:text-[13.5px] pz:leading-[1.55] pz:ring-[1.5px] pz:ring-select`,ref:o,value:i,"aria-label":`Edit message`,onChange:e=>a(e.target.value),onKeyDown:e=>Px(e,c,r)}),(0,G.jsxs)(`div`,{className:`pz:flex pz:items-center pz:justify-end pz:gap-1`,children:[(0,G.jsx)(`span`,{className:fx(Ox,`pz:mr-auto`),children:`Enter to save`}),(0,G.jsx)(mx,{variant:`ghost`,className:`pz:h-6 pz:rounded-md pz:px-2`,onClick:s,children:`Cancel`}),(0,G.jsx)(mx,{className:`pz:h-6 pz:rounded-md pz:px-2`,disabled:!i.trim(),onClick:c,children:`Save`})]})]})}function Rx({thread:e,source:t,me:n,file:r=``,readOnly:i=!1,onClose:a}){let[o,s]=(0,W.useState)(()=>{if(i)return null;let t=e=>{let t=Di(Ei.edit(r,e));return!!(t&&Ai(t))};return e.messages.find(e=>t(e.id))?.id??null}),[c,l]=(0,W.useState)(!1),u=(0,W.useRef)(null),d=(0,W.useRef)(!0);(0,W.useLayoutEffect)(()=>{let e=u.current;e&&(d.current=e.scrollHeight-e.clientHeight<8)},[]);let f=(0,W.useRef)(!1),p=(0,W.useRef)(e.messages.length);(0,W.useLayoutEffect)(()=>{let t=u.current,r=e.messages.length>p.current;p.current=e.messages.length;let i=e.messages.at(-1);t&&r&&i&&(i.author.kind===n.kind&&i.author.name===n.name||d.current)&&(f.current=t.scrollHeight-t.scrollTop-t.clientHeight>=8,d.current=!0,t.scrollTop=t.scrollHeight)},[e.messages,n]);let m=()=>{f.current=!1},h=e.status===`resolved`,g=r=>{let i={op:`thread.message`,id:e.id,message:{id:k(`m`),author:n,text:r,createdAt:Date.now()}};t.apply(h?{op:`batch`,ops:[i,{op:`thread.update`,id:e.id,status:`open`}]}:i)},_=()=>{t.apply({op:`thread.update`,id:e.id,status:`resolved`}),a()},v=()=>t.apply({op:`thread.update`,id:e.id,status:`open`}),y=()=>{for(let t of[Ei.reply(r,e.id),...e.messages.map(e=>Ei.edit(r,e.id))])Oi(t,null);t.apply({op:`thread.delete`,id:e.id}),a()},b=(n,r)=>{t.apply({op:`thread.edit`,id:e.id,messageId:n,text:r,editedAt:Date.now()}),s(null)},x=n=>{Oi(Ei.edit(r,n),null),t.apply({op:`thread.unmessage`,id:e.id,messageId:n})},S=e=>!i&&e.kind===n.kind&&e.name===n.name,C=e.messages[0],w=(e,t)=>t>0&&S(e.author)&&o!==e.id;return(0,G.jsxs)(`div`,{className:Dx,onPointerDown:e=>e.stopPropagation(),children:[!i&&(0,G.jsxs)(`div`,{className:`pz:absolute pz:top-1.5 pz:right-1.5 pz:z-[1] pz:flex pz:gap-0.5 pz:rounded-lg pz:bg-card`,children:[h?(0,G.jsx)(mx,{variant:`ghost`,size:`icon`,onClick:v,title:`Resolved · Reopen`,children:(0,G.jsx)(q,{name:`undo`,size:15})}):(0,G.jsx)(mx,{variant:`ghost`,size:`icon`,onClick:_,title:`Resolve`,children:(0,G.jsx)(q,{name:`check`,size:15})}),(0,G.jsx)(Tx,{trigger:(0,G.jsx)(mx,{variant:`ghost`,size:`icon`,title:`More`,children:(0,G.jsx)(q,{name:`more`,size:15})}),items:[...C&&S(C.author)?[{label:`Edit`,icon:(0,G.jsx)(q,{name:`edit`,size:14}),onSelect:()=>s(C.id)}]:[],{label:`Delete`,icon:(0,G.jsx)(q,{name:`trash`,size:14}),danger:!0,onSelect:y}]})]}),(0,G.jsx)(`div`,{ref:u,"data-scroll":!0,className:fx(`pz:flex pz:max-h-80 pz:flex-col pz:gap-1 pz:overflow-y-auto pz:overscroll-contain pz:scroll-smooth pz:px-1.5 pz:pt-1.5 pz:pb-2.5 pz:motion-reduce:scroll-auto`,c&&`pz:[mask-image:linear-gradient(transparent_24px,#000_44px)]`),onScroll:e=>{let t=e.currentTarget;l(t.scrollTop>0);let n=t.scrollHeight-t.scrollTop-t.clientHeight<8;n&&(f.current=!1),f.current||(d.current=n)},onWheel:m,onPointerDown:m,onTouchStart:m,children:e.messages.map((t,n)=>(0,G.jsxs)(`div`,{className:fx(`pz:group pz:flex pz:flex-col pz:gap-1 pz:rounded-lg pz:px-2 pz:py-1.5`,w(t,n)&&`pz:hover:bg-accent`),children:[(0,G.jsxs)(`div`,{className:fx(`pz:flex pz:h-6 pz:items-center pz:gap-1.5`,n===0&&!i&&`pz:pr-14`),children:[(0,G.jsx)(Nx,{author:t.author,size:18}),(0,G.jsx)(`span`,{className:`pz:truncate pz:font-medium`,children:t.author.name}),(0,G.jsxs)(`span`,{className:fx(Ox,`pz:shrink-0`),children:[Ax(t.createdAt),t.editedAt?` · edited`:``]}),w(t,n)&&(0,G.jsxs)(`div`,{className:`pz:ml-auto pz:flex pz:shrink-0 pz:opacity-0 pz:group-hover:opacity-100 pz:focus-within:opacity-100`,children:[(0,G.jsx)(mx,{variant:`ghost`,size:`icon-sm`,onClick:()=>s(t.id),title:`Edit`,children:(0,G.jsx)(q,{name:`edit`,size:14})}),(0,G.jsx)(mx,{variant:`ghost`,size:`icon-sm`,onClick:()=>x(t.id),title:`Delete`,children:(0,G.jsx)(q,{name:`trash`,size:14})})]})]}),!i&&o===t.id?(0,G.jsx)(Lx,{initial:t.text,draft:{key:Ei.edit(r,t.id),file:r,thread:e.id},onSave:e=>b(t.id,e),onClose:()=>s(null)}):(0,G.jsx)(`div`,{className:kx,children:t.text})]},t.id))}),!i&&(0,G.jsx)(Ix,{onSubmit:g,onCancel:a,placeholder:h?`Reply to reopen…`:`Reply…`,draft:{key:Ei.reply(r,e.id),file:r,thread:e.id}})]})}var zx=1100,Bx=250,Vx=180,Hx=2400,Ux=900;function Wx(e){return Math.min(Vx,Hx/Math.max(1,e))}function Gx(e){let t=e.frames?.length??0;return e.kind===`record`&&t?Bx+t*Wx(t)+Ux:zx}function Kx(e){let[t,n]=(0,W.useState)(()=>new Map);return(0,W.useEffect)(()=>{let t=new Set,r=e.onCapture?.(e=>{if(li())return;n(t=>new Map(t).set(e.artboard,e));let r=setTimeout(()=>{t.delete(r),n(t=>{if(t.get(e.artboard)!==e)return t;let n=new Map(t);return n.delete(e.artboard),n})},Gx(e));t.add(r)});return()=>{r?.();for(let e of t)clearTimeout(e)}},[e]),t}function qx({capture:e,...t}){return e.kind===`record`&&e.frames?.length?(0,G.jsx)(Xx,{frames:e.frames,...t}):(0,G.jsx)(Yx,{...t})}var Jx=[{dx:-1,dy:-1,edges:[`Top`,`Left`]},{dx:1,dy:-1,edges:[`Top`,`Right`]},{dx:-1,dy:1,edges:[`Bottom`,`Left`]},{dx:1,dy:1,edges:[`Bottom`,`Right`]}];function Yx({ring:e,ringRadius:t,area:n,radius:r}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`pz-shot-flash pz:absolute`,style:{...n,borderRadius:r}}),(0,G.jsx)(`div`,{className:`pz:absolute`,style:e,children:Jx.map(({dx:e,dy:n,edges:r})=>(0,G.jsx)(`span`,{className:`pz-bracket pz:absolute pz:size-[18px]`,style:{[e<0?`left`:`right`]:-2,[n<0?`top`:`bottom`]:-2,[`border${r[0]}`]:`2px solid var(--pz-rind)`,[`border${r[1]}`]:`2px solid var(--pz-rind)`,[`border${r[0]}${r[1]}Radius`]:t+2,"--dx":e,"--dy":n}},`${e}${n}`))})]})}function Xx({frames:e,ring:t,ringRadius:n,area:r,radius:i}){let a=e.length,[o,s]=(0,W.useState)(-1);(0,W.useEffect)(()=>{let e=Wx(a),t=Array.from({length:a+1},(t,n)=>setTimeout(()=>s(n),Bx+n*e));return()=>{for(let e of t)clearTimeout(e)}},[a]);let c=o>=0&&o<a,l=o>=a;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:fx(`pz:absolute pz:overflow-hidden`,l&&`pz:transition-opacity pz:duration-300`),style:{...r,borderRadius:i,opacity:+!!c},children:[e.map((e,t)=>(0,G.jsx)(`img`,{src:e,alt:``,className:`pz:absolute pz:inset-0 pz:size-full`,style:{opacity:+(t===o)}},t)),c&&(0,G.jsx)(`div`,{className:`pz-tick pz:absolute pz:inset-0`},o)]}),(0,G.jsx)(`svg`,{"aria-hidden":!0,className:`pz:absolute pz:overflow-visible pz:text-[var(--pz-rind)] pz:transition-opacity pz:delay-150 pz:duration-500`,style:{...t,opacity:+!l},children:(0,G.jsx)(`rect`,{x:1,y:1,style:{width:`calc(100% - 2px)`,height:`calc(100% - 2px)`,transition:`stroke-dashoffset 130ms cubic-bezier(0.2, 0.8, 0.3, 1)`},rx:n,pathLength:100,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeDasharray:`100 100`,strokeDashoffset:100-Math.min(o+1,a)*100/a})}),l&&(0,G.jsx)(`div`,{className:`pz-flare pz:absolute`,style:{...t,borderRadius:n}})]})}var Zx=1500,Qx=2,$x=2e4,eS=new WeakMap;function tS(e){let t=eS.get(e);if(t)return t;let n=0,r=0,i=!1,a=(e,t)=>{if(e.kind===`text`){t&&(/\binfinite\b/.test(e.value)&&(i=!0),r+=(e.value.match(/url\(\s*["']?(?!#|data:)/g)??[]).length);return}let o=e;n++;let s=o.tag.toLowerCase();(s===`img`||s===`video`||s===`image`||s===`picture`)&&r++,(s===`animate`||s===`animatetransform`||s===`animatemotion`)&&(o.attrs.repeatCount===`indefinite`||o.attrs.repeatcount===`indefinite`)&&(i=!0);let c=Object.entries(o.style);for(let[e,t]of c)/^animation/.test(e)&&/\binfinite\b/.test(t)&&(i=!0),/background/.test(e)&&/url\(\s*["']?(?!#|data:)/.test(t)&&r++;for(let e of o.children)a(e,s===`style`)};a(e.root,!1);let o={elements:n,media:r,loops:i,cheap:n<=Zx&&r<=Qx&&!i};return eS.set(e,o),o}function nS(e){let t=new Set,n=0;for(let r of e){let e=tS(r);!e.cheap||n+e.elements>$x||(n+=e.elements,t.add(r.id))}return t}function rS(e){let t=e.root.style,n=t[`background-color`]??t.background??``;return/^(#[0-9a-f]{3,8}|rgba?\([^)]*\)|hsla?\([^)]*\)|[a-z]+)$/i.test(n.trim())?n.trim():`#fff`}var iS=8e4;function aS(e){let t=new Set,n=0;for(let r of e){let e=tS(r);e.cheap||n+e.elements>iS||(n+=e.elements,t.add(r.id))}return t}var oS=`img,video,image,picture,canvas{visibility:hidden!important}
|
|
2381
2381
|
*,*::before,*::after{animation:none!important;transition:none!important;filter:none!important;backdrop-filter:none!important}`,sS=class{origin;file;opts;state;listeners=new Set;opListeners=new Set;captureListeners=new Set;socket=null;req=0;retry=0;closed=!1;theme;writing=[];seq=0;syncing=!1;assetBase;renditions=!0;constructor(e,t,n={}){this.origin=e,this.file=t,this.opts=n,this.state={status:`connecting`,doc:null,path:t,presence:[],canUndo:!1,canRedo:!1},this.assetBase=`${e}/files/${encodeURIComponent(t)}`,this.connect()}snapshotUrl(e,t,n,r){let i=new URLSearchParams({file:this.file,artboard:e,scale:String(t),v:n,scheme:r});return`${this.origin}/api/snapshot?${i}`}loopsUrl(e,t,n){let r=new URLSearchParams({file:this.file,artboard:e,v:t,scheme:n});return`${this.origin}/api/loops?${r}`}connect(){let e=this.opts.watch?`&watch=1`:``,t=`${this.origin.replace(/^http/,`ws`)}/ws?file=${encodeURIComponent(this.file)}${e}`,n=new WebSocket(t);this.socket=n,n.onmessage=e=>this.onMessage(JSON.parse(String(e.data))),n.onopen=()=>{this.retry=0,this.theme&&this.send({t:`theme`,theme:this.theme}),this.writing.length&&this.send({t:`writing`,threads:this.writing})},n.onclose=()=>{if(this.closed)return;this.set({status:`offline`,presence:[]});let e=Math.min(5e3,250*2**this.retry++);setTimeout(()=>!this.closed&&this.connect(),e)}}onMessage(e){switch(e.t){case`hello`:this.seq=e.seq,this.syncing=!1,this.set({status:`ready`,doc:e.doc,path:e.path,presence:e.presence,canUndo:e.canUndo,canRedo:e.canRedo});break;case`op`:{let t=this.state.doc;if(!t||this.syncing)return;if(e.seq!==this.seq+1)return this.sync(`gap`);let n=structuredClone(t);try{ee(n,e.op)}catch{return this.sync(`apply`)}this.seq=e.seq;for(let t of this.opListeners)try{t(e.op,e.origin,n)}catch(e){console.error(`[ponzu] op listener failed:`,e)}this.set({doc:n,canUndo:e.canUndo,canRedo:e.canRedo,lastOrigin:e.origin});break}case`reset`:this.seq=e.seq,this.syncing=!1,this.set({doc:e.doc});break;case`presence`:this.set({presence:e.presence});break;case`focus`:this.set({focus:{artboard:e.artboard,page:e.page,at:Date.now()}});break;case`capture`:for(let t of this.captureListeners)t(e.capture);break;case`error`:this.set({error:e.message})}}sync(e){this.syncing||(this.syncing=!0,this.send({t:`sync`,reason:e}))}send(e){this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify(e))}set(e){this.state={...this.state,...e};for(let e of this.listeners)e(this.state)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getState(){return this.state}onOp(e){return this.opListeners.add(e),()=>this.opListeners.delete(e)}onCapture(e){return this.captureListeners.add(e),()=>this.captureListeners.delete(e)}apply(e){this.send({t:`op`,req:++this.req,op:e})}undo(){this.send({t:`undo`,req:++this.req})}redo(){this.send({t:`redo`,req:++this.req})}setTheme(e){this.opts.watch||e===this.theme||(this.theme=e,this.send({t:`theme`,theme:e}))}setWriting(e){this.opts.watch||e.join(` `)===this.writing.join(` `)||(this.writing=e,this.send({t:`writing`,threads:e}))}async upload(e){let t=new FormData;t.set(`file`,e);let n=await fetch(`${this.assetBase}/upload`,{method:`POST`,body:t});if(!n.ok)throw Error(await n.text());return(await n.json()).path}close(){this.closed=!0,this.socket?.close()}};function cS(e){return{subscribe:t=>e.subscribe(t),getState:()=>e.getState(),apply(){},undo(){},redo(){},assetBase:e.assetBase,renditions:e.renditions,setTheme:e.setTheme?t=>e.setTheme?.(t):void 0,onOp:e.onOp?t=>e.onOp(t):void 0,onCapture:e.onCapture?t=>e.onCapture(t):void 0,snapshotUrl:e.snapshotUrl?.bind(e),loopsUrl:e.loopsUrl?.bind(e)}}var lS=new WeakMap,uS=4,dS=3e3,fS=6e4,pS=160,mS=new Map,hS=512;async function gS(e,t=fetch){try{let n=await t(`${e}${e.includes(`?`)?`&`:`?`}wait=0`),r=n.headers.get(`x-pz-version`),i=new URL(e,globalThis.location?.href).searchParams.get(`v`);if(n.status===202||r&&i&&r!==i)return`pending`;if(n.status>=500||n.status===429)return`failed`;if(n.status===204||!n.ok)return null;let a=await n.json();return{...a,regions:a.regions.map(t=>({...t,src:new URL(t.src,e).href}))}}catch{return`failed`}}function _S(e){let[t,n]=(0,W.useState)(`pending`);return(0,W.useEffect)(()=>{if(!e)return n(null);n(`pending`);let t=!0,r,i=0,a=()=>{let o=mS.get(e);o?mS.delete(e):o=gS(e),mS.set(e,o),mS.size>hS&&mS.delete(mS.keys().next().value),o.then(o=>{t&&(n(o===`failed`?`pending`:o),(o===`pending`||o===`failed`)&&(mS.delete(e),i=o===`failed`?i+1:0,r=setTimeout(a,Math.min(fS,dS*2**i))))})};return a(),()=>{t=!1,clearTimeout(r)}},[e]),t}function vS(e,t){let n=e.map(()=>[]),r=new Map;e.forEach((e,t)=>{for(let n of e.ids)r.set(n,t)});for(let e of t){let t=(e.effect?.target)?.closest(`[data-id]`)?.getAttribute(`data-id`),i=t?r.get(t):void 0;i!==void 0&&n[i].push(e)}return n}function yS(e){for(let t of e){let e=t.currentTime;if(typeof e==`number`)return e}return null}function bS(e){for(let t of e){let e=t.time();if(e!==null)return e}return null}function xS(e,t,n,r){let i=Math.max(1,Math.ceil((r-t-e)/n));return t+e+i*n}function SS(e,t,n){return((e-t)%n+n)%n}var CS=new WeakMap;function wS(e,t){if(!e)return;let n=t?lS.get(t)??null:null,r=t?[...t.querySelectorAll(`video`)]:[],i=Cn(e),a=CS.get(e);CS.delete(e);let o=a?i.filter(e=>a.has(e)&&e.playState===`paused`):[],s=[];if(n){let t=new Set,a=vS(n.regions,i);n.regions.forEach((i,o)=>{let c=r[o];if(!c||c.readyState<1)return;let l=a[o],u=wn(e,i.ids),d=yS(l)??bS(u)??0,f=xS(c.currentTime*1e3,n.t0,i.period,d);for(let e of l)s.push([e,f]),t.add(e);for(let e of u)e.phase(f)});for(let e of i){if(t.has(e)||e.timeline!==document.timeline)continue;let r=e.effect?.getComputedTiming(),i=Number(r?.duration)*(String(r?.direction).includes(`alternate`)?2:1);if(Number.isFinite(r?.iterations)||!(i>0))continue;let a=Number(e.currentTime)||0;s.push([e,n.t0+Math.max(1,Math.ceil((a-n.t0)/i))*i])}}for(let[e,t]of s)e.currentTime=t;for(let e of o)e.play()}async function TS(e,t,n,r,i){let a=[...t.querySelectorAll(`video`)];if(await Promise.all(a.map(e=>e.readyState>=1?Promise.resolve():new Promise(t=>{e.addEventListener(`loadedmetadata`,()=>t(),{once:!0}),e.addEventListener(`error`,()=>t(),{once:!0})}))),i())return!1;let o=e?vS(n.regions,Cn(e)):[],s=n.regions.map((t,n)=>({r:t,anims:o[n]??[],fields:e?wn(e,t.ids):[]})),c=e=>yS(e.anims)??bS(e.fields);for(let t=pS;t<=1280;t*=2){let o=performance.now(),l=s.map(e=>{let{r}=e,i=c(e);return i===null?null:SS(i+t,n.t0,r.period)});if(await Promise.all(a.map((e,t)=>new Promise(n=>{let r=l[t];if(e.pause(),r==null)return n();e.addEventListener(`seeked`,()=>n(),{once:!0}),setTimeout(n,1e3),e.currentTime=r/1e3}))),i())return!1;let u=o+t;if(performance.now()>u-4)continue;if(await new Promise(e=>{let t=n=>n>=u-8?e():requestAnimationFrame(t);requestAnimationFrame(t)}),i())return!1;let d=s.map((e,t)=>{let r=l[t];return r==null?null:xS(r,n.t0,e.r.period,(c(e)??0)-e.r.period/2)}),f=s.map(({anims:e})=>e.filter(e=>e.playState===`running`)),p=new Set;f.forEach((e,t)=>{let n=d[t];if(n!=null)for(let t of e)t.currentTime=n,t.pause(),p.add(t)}),e&&CS.set(e,p),r();for(let e of a)AS.want(e);return!0}r();for(let e of a)AS.want(e);return!0}var ES=new WeakMap;function DS(e){e.readyState>=1&&e.currentTime>0&&ES.set(e,e.currentTime),e.pause(),e.removeAttribute(`src`),e.load()}function OS(e,t){let n=ES.get(e);ES.delete(e),n&&e.addEventListener(`loadedmetadata`,()=>{e.currentTime=n},{once:!0}),e.src=t}function kS(e,t){return new Set([...e].sort((e,t)=>t[1]-e[1]).slice(0,t).map(([e])=>e))}var AS=(()=>{let e=new Map,t=new Map,n=null,r=!1,i=()=>{let n=r?new Set:kS(t,uS);for(let[t,r]of e)n.has(t)?(r&&!t.getAttribute(`src`)&&OS(t,r),t.paused&&t.play().catch(()=>{})):r?t.getAttribute(`src`)&&DS(t):t.paused||t.pause()},a=()=>n??=new IntersectionObserver(e=>{for(let n of e){let e=n.target,r=n.intersectionRect;n.isIntersecting?t.set(e,r.width*r.height):t.delete(e)}i()});return{want(t,n){e.set(t,n),a().observe(t),i()},drop(r){let a=e.get(r);e.delete(r),t.delete(r),n?.unobserve(r),a?DS(r):r.pause(),ES.delete(r),i()},hold(e){e!==r&&(r=e,i())}}})();function jS(e){let{loops:t,play:n,visible:r}=e,i=e=>{if(e)return n?AS.want(e):AS.drop(e),()=>AS.drop(e)};return(0,G.jsx)(`div`,{ref:n=>{n&&lS.set(n,t),e.layerRef(n)},"data-pz-loops":``,style:{position:`absolute`,inset:0,pointerEvents:`none`,visibility:r?`visible`:`hidden`},children:t.regions.map(e=>(0,G.jsx)(`video`,{ref:i,src:e.src,muted:!0,loop:!0,playsInline:!0,preload:`auto`,disablePictureInPicture:!0,style:{position:`absolute`,left:e.x,top:e.y,width:e.width,height:e.height,objectFit:`fill`,display:`block`}},e.src))})}var MS=.5;MS*.8;var NS=[.25,.5,1],PS=120,FS=350,IS=8,LS=700,RS=3e4,zS=250,BS=6e4;function VS(e){for(let t of NS)if(t>=e)return t;return NS[NS.length-1]}function HS(e){return e.attention?`live`:e.onScreen?e.pictures?e.moving&&e.current!==`live`&&e.pictured?`picture`:e.scale>=(e.current===`picture`?.5:.4)||e.motion>=64&&!e.looped&&!e.moving?`live`:`picture`:`live`:`away`}var US=`missing`,WS=`failed`;function GS(e,t){let n=e.headers.get(`x-pz-version`);return e.status===202||e.ok&&n&&t&&n!==t?US:e.status>=500||e.status===429?WS:e.ok?`draw`:null}var KS=new Map,qS=new Map,JS=new Map;function YS(e){return JS.set(e,(JS.get(e)??0)+1),()=>{let t=(JS.get(e)??1)-1;t>0?JS.set(e,t):JS.delete(e)}}function XS(e,t,n,r){let i=[];for(let a of e){if(t-i.length<=n)break;r(a)||i.push(a)}return i}function ZS(e){let t=qS.get(e);KS.delete(e),qS.delete(e),t&&!JS.has(t)&&URL.revokeObjectURL(t)}function QS(e,t){KS.delete(e),KS.set(e,t);let n=XS(KS.keys(),KS.size,256,e=>{let t=qS.get(e);return!t||JS.has(t)});for(let e of n)KS.delete(e),URL.revokeObjectURL(qS.get(e)),qS.delete(e)}var $S=[],eC=0;function tC(){for(;eC<IS&&$S.length;)eC++,$S.shift()()}function nC(e,t=!1){let n=KS.get(e);if(n)return QS(e,n),n;let r=new Promise(n=>{let r=async()=>{let t;try{let r=await fetch(`${e}&wait=0`),i=new URL(e,location.href).searchParams.get(`v`),a=GS(r,i);if(a!==`draw`)return a!==null&&KS.delete(e),n(a);let o=r.headers.get(`x-pz-loops`)===`1`,s=Number(r.headers.get(`x-pz-loop-size`))||0;t=URL.createObjectURL(await r.blob());let c=new Image;c.src=t,await c.decode(),qS.set(e,t);let l=r.headers.get(`x-pz-partial`)===`1`;l&&setTimeout(()=>ZS(e),RS),n({url:t,version:i??``,loops:o,loopSize:s,partial:l})}catch{t&&URL.revokeObjectURL(t),KS.delete(e),n(WS)}finally{eC--,tC()}};t?$S.unshift(r):$S.push(r),tC()});return QS(e,r),r}var rC=4e3,iC=[],aC=0;function oC(e,t){e.sort((e,t)=>e.rank-t.rank);let n=0,r=0;for(;r<e.length&&(r===0||n+e[r].cost<=t);)n+=e[r++].cost;return e.splice(0,r)}function sC(){aC=0;for(let e of oC(iC,rC))e.go();iC.length&&(aC=requestAnimationFrame(sC))}function cC(e,t,n){let r={go:e,rank:t(),cost:n};return iC.push(r),aC||=requestAnimationFrame(sC),()=>{let e=iC.indexOf(r);e>=0&&iC.splice(e,1)}}var lC=1,uC=1e3,dC=80,fC=1200;function pC(e){if(!e.regions.length||e.attention||e.intent||e.scale>=lC)return!1;let t=0;for(let n of e.regions){if(n.ids.length>=48)return!0;t+=n.ids.length}return t>uC}function mC(e,t){if(!e||e.style.contentVisibility!==`hidden`)return t();e.style.contentVisibility=`visible`;try{return t()}finally{e.style.contentVisibility=`hidden`}}function hC(e){let{id:t,scale:n,onScreen:r,moving:i,attention:a,snapshotUrl:o,loopsUrl:s,cheap:c}=e,l=(0,W.useRef)({rank:e.rank,cost:e.cost??0});l.current={rank:e.rank,cost:e.cost??0};let u=()=>l.current.rank?.()??0,[d,f]=(0,W.useState)(()=>o&&!a?`pending`:`live`),[p,m]=(0,W.useState)(null),h=o?gC(o(t,1)):``,g=p&&p.version===h?p:null,[_,v]=(0,W.useState)(!1),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(0),C=(0,W.useRef)(0),w=(0,W.useRef)(null);w.current=g;let T=VS(n),E=VS(T*1.01),D=n<=(g?.loops?lC:MS*1.5),O=o&&D?o(t,T):``,k=o&&D&&E>T&&n>T*.7?o(t,E):``,A=_S(s&&g?.loops&&n<lC?s(t):null),j=A&&A!==`pending`?A:null,M=HS({scale:n,current:d===`pending`?`picture`:d,onScreen:r,pictures:!!o&&!_,pictured:!!g,motion:(g?.loopSize??0)*n,looped:!!j,moving:i,attention:a});M===`live`&&g&&j&&pC({regions:j.regions,scale:n,attention:a,intent:!!e.intent})&&(M=`picture`),M===`picture`&&!g&&y&&c&&(M=`live`),(0,W.useEffect)(()=>{if(!O)return;let e=setTimeout(()=>b(e=>e||!w.current),zS);return()=>clearTimeout(e)},[O]),(0,W.useEffect)(()=>{if(!O)return;let e=!0,t;return k&&nC(k),nC(O,r).then(n=>{if(e){if(n===US||n===WS){b(!0),C.current=n===WS?C.current+1:0;let e=LS*2**C.current;t=setTimeout(()=>S(e=>e+1),Math.min(BS,e))}else{if(C.current=0,!n)return v(!0);b(!1),m(e=>e?.url===n.url?e:n),n.partial&&(t=setTimeout(()=>S(e=>e+1),30050))}}}),()=>{e=!1,clearTimeout(t)}},[O,k,T,E,r,x]),(0,W.useEffect)(()=>{if(M===d||M===`picture`&&!g||M===`picture`&&d===`live`&&g?.loops&&s&&A===`pending`)return;if(d===`pending`){let e=setTimeout(()=>f(M),PS);return()=>clearTimeout(e)}if(M===`live`){let e=()=>f(`live`);if(d!==`picture`||a&&!i)return cC(e,u,l.current.cost);let t=()=>{},n=setTimeout(()=>{t=cC(e,u,l.current.cost)},FS);return()=>{clearTimeout(n),t()}}let e=requestAnimationFrame(()=>f(M));return()=>cancelAnimationFrame(e)},[M,d,g,A,s,a,i]);let N=g?.url;return(0,W.useEffect)(()=>N?YS(N):void 0,[N]),{tier:d,picture:g,loops:j,missing:y}}function gC(e){return/[?&]v=([^&#]*)/.exec(e)?.[1]??``}var _C=new WeakMap;function vC(e,t,n){let r=_C.get(e);if(r&&r.tokens===t)return r.v;let i=Ue(n(),t);return _C.set(e,{tokens:t,v:i}),i}var yC={x:NaN,y:NaN};function bC(e){let[t,n]=(0,W.useState)(!1),r=(0,W.useRef)(void 0);return(0,W.useEffect)(()=>()=>clearTimeout(r.current),[]),{on:t,move:i=>{let a=i.clientX!==yC.x||i.clientY!==yC.y;yC={x:i.clientX,y:i.clientY},a&&!e&&i.pointerType!==`touch`&&(clearTimeout(r.current),t||(r.current=setTimeout(()=>n(!0),dC)))},leave:()=>{clearTimeout(r.current),t&&(r.current=setTimeout(()=>n(!1),fC))}}}var xC=120;function SC(e){let t=bC(e.moving),{tier:n,picture:r,loops:i,missing:a}=hC({...e,intent:t.on}),o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=n===`picture`&&r?`picture`:n===`picture`?`pending`:n,[l,u]=(0,W.useState)(c),[d,f]=(0,W.useState)(null),p=(0,W.useRef)(e.moving);p.current=e.moving;let m=(e,t)=>{u(e),f(t&&!p.current?{kind:t,of:e}:null)},h=d&&d.of===l&&!e.moving?d.kind:null,g=()=>o.current?.querySelector(`[data-artboard-host]`)?.shadowRoot;(0,W.useEffect)(()=>{if(c!==l){if(c===`live`&&l===`picture`&&r)m(`thaw`);else if(l===`thaw`&&c!==`live`)m(c);else{if(l===`thaw`){let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>{wS(g(),s.current),(0,rl.flushSync)(()=>m(`live`,`out`))})});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}}if(c===`picture`&&l===`live`&&i&&s.current){let e=!1;return TS(g(),s.current,i,()=>(0,rl.flushSync)(()=>m(`picture`,`in`)),()=>e),()=>{e=!0}}m(c,c===`picture`&&l===`live`?`in`:void 0)}}},[c,l,i,r]);let _=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{let e=_.current;if(!e)return;let t=e.style.opacity?Number(e.style.opacity):null;if(!h){e.style.opacity=``;return}let n=+(h===`in`),r=t??1-n,i=xC*Math.abs(n-r);e.style.opacity=String(r);let a=0,o=0,s=t=>{a||=t;let c=i?Math.min(1,(t-a)/i):1;e.style.opacity=String(r+(n-r)*c),c<1?o=requestAnimationFrame(s):f(null)};return o=requestAnimationFrame(s),()=>cancelAnimationFrame(o)},[h]),(0,W.useEffect)(()=>{e.moving&&f(null)},[e.moving]);let v=l===`picture`&&!!i?.regions.length&&!e.moving;(0,W.useEffect)(()=>{if(!v)return;let e=globalThis.requestIdleCallback??(e=>setTimeout(e,200)),t=globalThis.cancelIdleCallback??clearTimeout,n=e(()=>mC(o.current,()=>Tn(g())),{timeout:2e3});return()=>t(n)},[v]);let y=(l===`picture`||l===`thaw`)&&r,b=!!(y||h===`out`&&r),x=l===`pending`&&a&&!!e.skeleton,S=l!==`live`&&l!==`thaw`&&!x&&h!==`in`;(0,W.useLayoutEffect)(()=>{let e=g();if(!e)return;let t=e.querySelector(`style[data-pz-skeleton]`);x&&!t?(t=document.createElement(`style`),t.setAttribute(`data-pz-skeleton`,``),t.textContent=oS,e.appendChild(t)):!x&&t&&t.remove()},[x]);let C={position:`absolute`,left:0,top:0,width:e.w,height:e.h,pointerEvents:`none`};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{ref:o,onPointerMove:t.move,onPointerLeave:t.leave,"data-pz-tier":l===`thaw`?`thaw`:y?`picture`:x?`skeleton`:l,style:{contentVisibility:S?`hidden`:void 0,containIntrinsicSize:`${e.w}px ${e.h}px`},children:e.children(S)}),l===`pending`&&!x&&(0,G.jsx)(`div`,{"data-pz-placeholder":a?`missing`:`waiting`,style:{...C,background:e.fill??`#fff`}}),(0,G.jsxs)(`div`,{ref:_,"data-pz-cover":``,style:C,children:[r&&(b||c===`picture`)&&(0,G.jsx)(`img`,{alt:``,draggable:!1,src:r.url,style:{...C,visibility:b?`visible`:`hidden`}}),y&&l===`picture`&&(0,G.jsx)(CC,{root:g,scale:e.scale}),i&&r&&(0,G.jsx)(jS,{loops:i,play:b,visible:b,layerRef:e=>{s.current=e}})]})]})}function CC({root:e,scale:t}){let[n,r]=(0,W.useState)([]);return(0,W.useLayoutEffect)(()=>{let n=e(),i=n?.querySelector(`[data-artboard]`);if(!n||!i)return;let a=i.getBoundingClientRect(),o=i.offsetWidth/(a.width||1);r([...n.querySelectorAll(`video`)].filter(e=>e.currentSrc&&e.loop&&(e.autoplay||e.played.length)).map(e=>{let n=e.getBoundingClientRect(),r=n.width*o,i=n.height*o;return Math.max(r,i)*t<64?null:{src:e.currentSrc,x:(n.left-a.left)*o,y:(n.top-a.top)*o,w:r,h:i,t:e.currentTime,fit:getComputedStyle(e).objectFit}}).filter(e=>e!==null))},[e,t]),(0,G.jsx)(G.Fragment,{children:n.map(e=>(0,G.jsx)(wC,{...e},e.src+e.x+e.y))})}function wC(e){let t=(0,W.useRef)(null),{src:n,t:r}=e;return(0,W.useEffect)(()=>{let e=t.current;if(!e)return;let i=()=>{r&&(e.currentTime=r%(e.duration||1/0))};return e.addEventListener(`loadedmetadata`,i,{once:!0}),AS.want(e,n),()=>{e.removeEventListener(`loadedmetadata`,i),AS.drop(e)}},[n,r]),(0,G.jsx)(`video`,{ref:t,muted:!0,loop:!0,playsInline:!0,disablePictureInPicture:!0,style:{position:`absolute`,left:e.x,top:e.y,width:e.w,height:e.h,objectFit:e.fit,pointerEvents:`none`}})}function TC(e){return(0,W.useSyncExternalStore)((0,W.useCallback)(t=>e.subscribe(t),[e]),()=>e.getState(),()=>e.getState())}var EC=.02,DC=8;function OC(e){let t=e,n=0,r=new Set,i=()=>{n&&cancelAnimationFrame(n),n=0;for(let e of r)e(t)};return{get:()=>t,set(e,r=!1){t=typeof e==`function`?e(t):e,r?i():n||=requestAnimationFrame(i)},subscribe(e){return r.add(e),()=>r.delete(e)}}}function kC(e={x:80,y:80,zoom:.5}){let[t]=(0,W.useState)(()=>OC(e));return{camera:t,zoomAt:(0,W.useCallback)((e,n,r)=>{t.set(t=>{let i=Math.min(DC,Math.max(EC,t.zoom*e)),a=i/t.zoom;return{zoom:i,x:n-(n-t.x)*a,y:r-(r-t.y)*a}})},[t]),panBy:(0,W.useCallback)((e,n)=>t.set(t=>({...t,x:t.x+e,y:t.y+n})),[t]),fit:(0,W.useCallback)((e,n,r=64,i=1)=>{if(!(e.w>0&&e.h>0&&Number.isFinite(e.x+e.y+e.w+e.h)))return;let a=Math.min(i,(n.w-r*2)/e.w,(n.h-r*2)/e.h),o=Math.max(EC,a);t.set({zoom:o,x:(n.w-e.w*o)/2-e.x*o,y:(n.h-e.h*o)/2-e.y*o},!0)},[t])}}function AC(e){return(0,W.useSyncExternalStore)((0,W.useCallback)(t=>e.subscribe(t),[e]),()=>Math.round(e.get().zoom*100),()=>Math.round(e.get().zoom*100))}function jC(e,t,n=150){let r=(0,W.useRef)(t);r.current=t;let[i,a]=(0,W.useState)(()=>({...e.get(),moving:!1}));return(0,W.useEffect)(()=>MC(e,e=>r.current(e),a,n),[e,n]),i}function MC(e,t,n,r=150){let i,a=!1,o=t(e.get()),s=e=>n({...e,moving:a});s(e.get());let c=e.subscribe(n=>{let c=t(n);(!a||c!==o)&&(a=!0,o=c,s(n)),clearTimeout(i),i=setTimeout(()=>{a=!1,o=t(e.get()),s(e.get())},r)});return()=>{c(),clearTimeout(i)}}var NC=2**18,PC=NC/2;function FC(e,t,n,r,i,a,o=150){let s=(0,W.useRef)(a);s.current=a,(0,W.useLayoutEffect)(()=>{let a=t.current;if(!i||!a)return;let c,l=NaN,u=0,d=0,f=PC,p=PC,m=()=>{let e=`translate(${u}px, ${d}px)`;n.current&&(n.current.style.transform=`${e} scale(${l})`);let t=r.current;t&&(t.style.transform=e,t.style.setProperty(`--z`,String(l)))},h=(e,t)=>{f=e,p=t,a.scrollLeft!==e&&(a.scrollLeft=e),a.scrollTop!==t&&(a.scrollTop=t)},g=e=>{if(e.zoom!==l){l=e.zoom,u=e.x+f,d=e.y+p,m();return}let t=Math.round(u-e.x),n=Math.round(d-e.y);if(Math.abs(t-PC)<PC/2&&Math.abs(n-PC)<PC/2)return h(t,n);u=e.x+PC,d=e.y+PC,m(),h(PC,PC)},_=()=>{if(a.scrollLeft===f&&a.scrollTop===p)return;if(Math.abs(a.scrollLeft-f)>a.clientWidth||Math.abs(a.scrollTop-p)>a.clientHeight){a.scrollLeft=f,a.scrollTop=p;return}f=a.scrollLeft,p=a.scrollTop;let t=u-f,n=d-p;e.set(e=>({...e,x:t,y:n}))},v=`${a.clientWidth}x${a.clientHeight}`,y=new ResizeObserver(()=>{let t=`${a.clientWidth}x${a.clientHeight}`;t!==v&&(v=t,e.set(e=>({...e})))});y.observe(a);let b=()=>{clearTimeout(c),c=void 0,n.current?.style.removeProperty(`will-change`)};h(PC,PC),g(e.get()),a.addEventListener(`scroll`,_,{passive:!0});let x=e.subscribe(e=>{c===void 0&&n.current?.style.setProperty(`will-change`,`transform`),g(e),clearTimeout(c),c=setTimeout(()=>{b(),s.current?.()},o)});return()=>{x(),y.disconnect(),a.removeEventListener(`scroll`,_),b()}},[e,t,n,r,i,o])}function IC(e){let[t,n]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let t=t=>{t.code===e&&!RC(t)&&(n(!0),e===`Space`&&t.preventDefault())},r=t=>t.code===e&&n(!1),i=()=>n(!1);return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,r),window.addEventListener(`blur`,i),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,r),window.removeEventListener(`blur`,i)}},[e]),t}function LC(e,t=250){let[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{let n,i=!1,a=e=>{i=e,r(e)},o=()=>{clearTimeout(n),a(!1)},s=r=>{let s=r.metaKey===(e===`Meta`)&&r.ctrlKey===(e===`Control`)&&r.altKey===(e===`Alt`)&&!r.shiftKey;r.key===e?r.repeat||(o(),s&&!RC(r)&&(n=setTimeout(()=>a(!0),t))):i&&s&&/^Digit[0-9]$/.test(r.code)||o()},c=t=>t.key===e&&o();return window.addEventListener(`keydown`,s,!0),window.addEventListener(`keyup`,c,!0),window.addEventListener(`pointerdown`,o,!0),window.addEventListener(`wheel`,o,!0),window.addEventListener(`blur`,o),()=>{clearTimeout(n),window.removeEventListener(`keydown`,s,!0),window.removeEventListener(`keyup`,c,!0),window.removeEventListener(`pointerdown`,o,!0),window.removeEventListener(`wheel`,o,!0),window.removeEventListener(`blur`,o)}},[e,t]),n}function RC(e){let t=e.composedPath()[0];return!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable)}function zC({size:e=20,dark:t=!1,dry:n=!1}){let r=n?t?`#5e5b54`:`#c9c5bc`:`#ffc81e`;return(0,G.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 64 64`,role:`img`,"aria-label":`Loading`,className:n?`pz-juice pz-juice-slow`:`pz-juice`,children:(0,G.jsx)(`g`,{fill:r,stroke:r,strokeWidth:Tc,strokeLinejoin:`round`,children:wc.map(e=>(0,G.jsx)(`path`,{d:e},e))})})}function BC({columns:e=24,className:t,label:n,title:r}){return(0,G.jsx)(`span`,{className:`pz-rain pz:inline-flex pz:shrink-0 pz:items-center${t?` ${t}`:``}`,...n?{role:`img`,"aria-label":n}:{"aria-hidden":!0},title:r,children:VC.slice(0,e).map((e,t)=>(0,G.jsx)(`span`,{style:{"--i":t,"--fall":`${e.fall}s`,"--drift":`${e.drift}s`}},t))})}var VC=Array.from({length:24},(e,t)=>{let n=e=>(Math.sin((t+1)*e)*43758.5453%1+1)%1;return{fall:(1.05+n(12.9898)*.5).toFixed(2),drift:(-n(78.233)*1.5).toFixed(2)}});function HC(e,t=300){let[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>{if(!e){r(!1);return}let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),e&&n}function UC(e,t){let[n,r]=(0,W.useState)(e),[i,a]=(0,W.useState)(new Map);if(e!==n){r(e);let i=[...n.keys()].filter(t=>!e.has(t));if(i.length){let e=performance.now()+t;a(t=>new Map([...t,...i.map(t=>[t,e])]))}}(0,W.useEffect)(()=>{if(!i.size)return;let e=Math.min(...i.values()),t=setTimeout(()=>{let e=performance.now();a(t=>new Map([...t].filter(([,t])=>t>e)))},Math.max(0,e-performance.now()));return()=>clearTimeout(t)},[i]);let o=new Map;for(let e of i.keys())o.set(e,!0);for(let t of e.keys())o.set(t,!1);return o}var WC=new WeakMap;function GC(e,t){let n=WC.get(t);if(n&&n.tokens===e)return n.themed;let r=D(e,t.root);return WC.set(t,{tokens:e,themed:r}),r}var KC=38,qC=22,JC=4,YC=4;function XC(e,t,n){let r=e.y-qC/n;return t.some(t=>t.id!==e.id&&t.x<e.x+e.w&&t.x+t.w>e.x&&t.y<e.y&&t.y+t.h>r)}function ZC(e,t,n){let r=e.x*t.zoom+t.x,i=e.y*t.zoom+t.y,a=e.w*t.zoom,o=e.h*t.zoom;return r+a<=0||i+o<=0||r>=n.w||i>=n.h||Math.max(a,o)<160}function QC(e,t,n){let r=0;for(let i of e){if(ZC(i,t,n))continue;let e=i.x*t.zoom+t.x,a=i.y*t.zoom+t.y,o=i.w*t.zoom,s=i.h*t.zoom;if((Math.min(e+o,n.w)-Math.max(e,0))*(Math.min(a+s,n.h)-Math.max(a,0))>=o*s*.25&&++r>4)return!0}return!1}function $C(e,t,n){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.y,t.y);return n.filter(e=>e.x<=i&&e.x+e.w>=r&&e.y<=o&&e.y+e.h>=a).map(e=>e.id)}function ew(e){let t=Number.parseFloat(e.root.style.width??``)||1440,n=e.root.style.height;return{w:t,h:n&&/^\d+(\.\d+)?px$/.test(n)?Number.parseFloat(n):null}}function tw({source:e,me:t={kind:`user`,name:`You`},theme:n=`light`,footer:r=!0,footerExtra:i,readOnly:a=!1,page:o,onPageChange:s,initialFit:c=`page`,link:l,className:u}){let d=(0,W.useMemo)(()=>a?cS(e):e,[e,a]),f=TC(d),p=f.doc,[m,h]=(0,W.useState)(null),g=o??m,_=e=>{h(e),s?.(e)},v=p?.pages.find(e=>e.id===g)??p?.pages[0],[y,b]=(0,W.useState)(`select`),x=IC(`Space`),S=y===`hand`||x,{camera:C,zoomAt:w,panBy:T,fit:E}=kC(),D=zr(),O=(0,W.useRef)(null),A=(0,W.useRef)(null),j=(0,W.useRef)(null),M=(0,W.useRef)(null),[P,ee]=(0,W.useState)({}),[L,te]=(0,W.useState)(null),[R,z]=(0,W.useState)(null),[ne,re]=(0,W.useState)(null),[ie,ae]=(0,W.useState)([]),oe=(0,W.useRef)(null),se=(0,W.useMemo)(()=>{let e=new Map;for(let t of f.presence)if(!(t.file&&t.file!==f.path))for(let n of t.working)e.set(n,[...e.get(n)??[],{id:t.id,name:t.name,client:t.client,status:t.status}]);return e},[f.presence,f.path]),ce=(0,W.useMemo)(()=>new Set(p?.pages.filter(e=>e.artboards.some(e=>se.has(e.id))).map(e=>e.id)),[p,se]),B=HC(!p||!v);(0,W.useEffect)(()=>d.setTheme?.(n),[d,n]);let V=(0,W.useMemo)(()=>new pi,[d]),[,H]=(0,W.useState)(0);(0,W.useEffect)(()=>{let e,t=d.onOp?.((t,n,r)=>{(n.kind===`agent`||n.kind===`disk`)&&(V.add(t,r,void 0,d.getState().doc),clearTimeout(e),e=setTimeout(()=>H(e=>e+1),V.until()))});return()=>{t?.(),clearTimeout(e)}},[d,V]);let U=UC(se,500),le=Kx(d),ue=v?.artboards??[],de=(0,W.useMemo)(()=>nS(ue),[ue]),fe=(0,W.useMemo)(()=>aS(ue),[ue]),pe=e=>ew(e).h??P[e.id]??900,me=(0,W.useMemo)(()=>p&&v?p.threads.filter(e=>(e.status===`open`||e.id===R)&&I(p,e)?.id===v.id):[],[p,v,R]),he=Mi(),ge=d.assetBase??f.path,_e=(0,W.useMemo)(()=>a||!v?[]:he.flatMap(e=>e.file===ge&&e.pin&&Ai(e)&&(e.pin.artboardId?ue.some(t=>t.id===e.pin.artboardId):e.pin.pageId===v.id)?[e.pin]:[]),[he,ge,a,v,ue]),ve=(0,W.useMemo)(()=>a?[]:[...new Set(he.flatMap(e=>e.file===ge&&e.thread&&Ai(e)?[e.thread]:[]))],[he,ge,a]),ye=ve.join(` `);(0,W.useEffect)(()=>{d.setWriting?.(ye?ye.split(` `):[])},[d,ye]);let be=(0,W.useMemo)(()=>{if(!ue.length)return null;let e=1/0,t=1/0,n=-1/0,r=-1/0;for(let i of ue){let{w:a}=ew(i);e=Math.min(e,i.x),t=Math.min(t,i.y),n=Math.max(n,i.x+a),r=Math.max(r,i.y+pe(i))}return{x:e,y:t,w:n-e,h:r-t}},[ue,P]),xe=(0,W.useMemo)(()=>ue.map(e=>({id:e.id,x:e.x,y:e.y,w:ew(e).w,h:pe(e)})),[ue,P]),Se=()=>{let e=O.current?.getBoundingClientRect();return{w:e?.width??1200,h:e?.height??800}},Ce=(0,W.useCallback)(()=>{be&&E(be,Se(),72,1)},[be,E]),we=(0,W.useCallback)(()=>{let e=[...ue].sort((e,t)=>e.y-t.y||e.x-t.x)[0];if(!e)return;let t=Se(),n=Math.min(1,(t.w-32)/ew(e).w);n>0&&C.set({zoom:n,x:(t.w-ew(e).w*n)/2-e.x*n,y:KC-e.y*n},!0)},[ue,C]);(0,W.useLayoutEffect)(()=>{if(!v||!be)return;let e=`${v.id}:${c}`;oe.current!==e&&(oe.current=e,c===`first`?we():Ce())},[v,be,Ce,we,c]);let Te=(e,t)=>{e!==v?.id&&(oe.current=`${e}:${c}`,_(e)),t&&E({x:t.x,y:t.y,w:ew(t).w,h:pe(t)},Se(),96,1)},Ee=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(!l||!p)return;let e=ke(p,l),t=e?.artboardId?F(p,e.artboardId)?.artboard:void 0,n=!!t&&(ew(t).h!==null||P[t.id]!==void 0),r=`${l.page}:${l.artboard}`,i=Ee.current;(i?.key!==r||!i.sized&&n)&&(Ee.current={key:r,sized:n},e&&t?Te(e.pageId,t):e&&e.pageId!==v?.id&&_(e.pageId))},[l?.page,l?.artboard,p,P]);let De=(0,W.useRef)(!1),Oe=()=>{De.current=!0};(0,W.useEffect)(()=>{De.current=!1},[e]),(0,W.useEffect)(()=>{let e=f.focus;e&&p&&!De.current&&Te(e.page,F(p,e.artboard)?.artboard)},[f.focus?.at]),(0,W.useEffect)(()=>{let e=O.current;if(!e)return;let t=new Map;for(let n of ue){if(ew(n).h!==null)continue;let r=e.querySelector(`[data-artboard-host="${n.id}"]`);r?.shadowRoot&&t.set(n.id,r.shadowRoot)}if(!t.size)return;let n=new Map,r=new ResizeObserver(()=>i()),i=()=>{let e={};for(let[i,a]of t){let t=a.querySelector(`[data-artboard]`);if(t){if(n.get(i)!==t){let e=n.get(i);e&&r.unobserve(e),r.observe(t),n.set(i,t)}e[i]=t.offsetHeight}}ee(t=>Object.keys(e).some(n=>e[n]!==t[n])?{...t,...e}:t)};i();let a=0,o=()=>{a||=requestAnimationFrame(()=>{a=0,i()})},s=new MutationObserver(o);for(let e of t.values())e.addEventListener(`load`,o,!0),e.addEventListener(`error`,o,!0),s.observe(e,{childList:!0});return document.fonts?.addEventListener(`loadingdone`,o),()=>{r.disconnect(),s.disconnect(),cancelAnimationFrame(a);for(let e of t.values())e.removeEventListener(`load`,o,!0),e.removeEventListener(`error`,o,!0);document.fonts?.removeEventListener(`loadingdone`,o)}},[ue,p?.tokens]);let Ae=!!(p&&v);(0,W.useEffect)(()=>{if(!Ae)return;let e=O.current;if(!e)return;let t=t=>{let n=e.getBoundingClientRect();if(t.ctrlKey||t.metaKey){t.preventDefault(),w(Math.exp(-t.deltaY*.01),t.clientX-n.left,t.clientY-n.top);return}let r=t.composedPath(),i=r.findIndex(e=>e instanceof Element&&e.hasAttribute(`data-comment-open`));i>=0&&r.slice(0,i).some(e=>e instanceof HTMLElement&&mw(e,t))||(t.preventDefault(),i<0&&T(-t.deltaX,-t.deltaY))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[Ae,w,T]),(0,W.useEffect)(()=>{if(!R&&!L)return;let e=e=>{e.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-comment-open`))||(z(null),te(null))};return window.addEventListener(`pointerdown`,e,!0),()=>window.removeEventListener(`pointerdown`,e,!0)},[R,L]);let je=LC(`Alt`),Me=v?.id;(0,W.useEffect)(()=>{Me&&ae([])},[Me]);let Ne=e=>{Oe(),_(e),te(null),z(null)};(0,W.useEffect)(()=>{let e=e=>{b(e);let t=document.activeElement;t instanceof HTMLElement&&t.closest(`[data-slot="canvas-bar"]`)&&t.blur()},t=t=>{if(RC(t))return;let n=t.metaKey||t.ctrlKey,r=/^Digit([1-9])$/.exec(t.code)?.[1];if(t.altKey&&!n&&!t.shiftKey&&r&&p){t.preventDefault();let e=r===`9`?p.pages.at(-1):p.pages[Number(r)-1];e&&Ne(e.id)}else if(n&&t.key.toLowerCase()===`z`)t.preventDefault(),a||(t.shiftKey?d.redo():d.undo());else if(n&&(t.key===`=`||t.key===`+`)){t.preventDefault();let e=Se();Oe(),w(1.25,e.w/2,e.h/2)}else if(n&&t.key===`-`){t.preventDefault();let e=Se();Oe(),w(.8,e.w/2,e.h/2)}else if(t.shiftKey&&!n&&!t.altKey&&r===`1`)Oe(),Ce();else if(t.shiftKey&&!n&&!t.altKey&&r===`2`&&ie[0]&&p){let e=N(p,ie[0]);if(e){let{w:t}=ew(e.artboard);Oe(),E({x:e.artboard.x,y:e.artboard.y,w:t,h:pe(e.artboard)},Se(),96,2)}}else if(!n&&t.key===`v`)e(`select`);else if(!n&&t.key===`h`)e(`hand`);else if(!n&&t.key===`c`&&!a)e(`comment`);else if(t.key===`Escape`)te(null),z(null),ae([]),Le.current?.kind===`marquee`&&(Le.current=null),Ue(null),e(`select`);else if((t.key===`Backspace`||t.key===`Delete`)&&!a&&ie.length&&p){let e=ie.filter(e=>F(p,e));e.length&&d.apply(e.length===1?{op:`artboard.delete`,id:e[0]}:{op:`batch`,ops:e.map(e=>({op:`artboard.delete`,id:e}))}),ae([])}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)});let Pe=(e,t)=>{let n=O.current.getBoundingClientRect(),r=C.get();return{x:(e-n.left-r.x)/r.zoom,y:(t-n.top-r.y)/r.zoom}},Fe=e=>{let t=Pe(e.clientX,e.clientY),n=[...ue].reverse().find(e=>t.x>=e.x&&t.x<=e.x+ew(e).w&&t.y>=e.y&&t.y<=e.y+pe(e));if(!n)return null;let r=O.current.querySelector(`[data-artboard-host="${n.id}"]`);return{artboard:n,nodeId:mC(r?.parentElement,()=>r?.shadowRoot?r.shadowRoot.elementsFromPoint(e.clientX,e.clientY):[]).find(e=>e.hasAttribute(`data-id`)&&!e.hasAttribute(`data-artboard`))?.getAttribute(`data-id`)??void 0}},Ie=(e,t=Fe(e))=>{if(!v)return null;let n=Pe(e.clientX,e.clientY);return t?{artboardId:t.artboard.id,pageId:v.id,nodeId:t.nodeId,x:n.x-t.artboard.x,y:n.y-t.artboard.y}:{pageId:v.id,x:n.x,y:n.y}},Le=(0,W.useRef)(null),Re=e=>{if(e.button===1||S){Le.current={kind:`pan`,startX:e.clientX,startY:e.clientY,ids:[],origin:[],moved:!1},e.target.setPointerCapture?.(e.pointerId);return}if(e.button!==0||!p)return;let t=Fe(e);if(y===`comment`&&!a){let n=Ie(e,t);if(!n)return;z(null),te(n);return}if(te(null),z(null),!t){let t=e.pointerType!==`touch`,n=t&&e.shiftKey?ie:[];ae(n),Le.current={kind:t?`marquee`:`pan`,startX:e.clientX,startY:e.clientY,ids:n,origin:[],anchor:Pe(e.clientX,e.clientY),moved:!1},e.target.setPointerCapture?.(e.pointerId);return}let n=e.altKey||!t.nodeId?t.artboard.id:t.nodeId,r=e.shiftKey?ie.includes(n)?ie.filter(e=>e!==n):[...ie,n]:[n];ae(r)},ze=(e,t)=>{if(e.button!==0||S)return;if(e.stopPropagation(),a){te(null),z(null),ae([t.id]);return}let n=ie.includes(t.id)?ie.filter(e=>F(p,e)):[t.id];ie.includes(t.id)||ae([t.id]),Le.current={kind:`move`,startX:e.clientX,startY:e.clientY,ids:n,origin:n.map(e=>{let t=F(p,e).artboard;return{id:e,x:t.x,y:t.y}}),moved:!1},e.target.setPointerCapture?.(e.pointerId)},[Be,Ve]=(0,W.useState)(null),[He,Ue]=(0,W.useState)(null),We=e=>{if(!e.anchor||!e.pointer)return;let t=Pe(e.pointer.x,e.pointer.y);Ue({a:e.anchor,b:t});let n=$C(e.anchor,t,xe);ae([...e.ids,...n.filter(t=>!e.ids.includes(t))])},Ge=(0,W.useRef)(We);Ge.current=We,(0,W.useEffect)(()=>C.subscribe(()=>{let e=Le.current;e?.kind===`marquee`&&e.moved&&Ge.current(e)}),[C]);let Ke=e=>{(!a||e===null)&&re(e)},qe=(0,W.useRef)({startMove:ze,setRenaming:Ke,apply:d.apply});qe.current={startMove:ze,setRenaming:Ke,apply:e=>d.apply(e)};let Je=(0,W.useMemo)(()=>({down:(e,t)=>qe.current.startMove(e,t),rename:e=>qe.current.setRenaming(e),apply:e=>qe.current.apply(e)}),[]),Ye=e=>{let t=Le.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.abs(n)+Math.abs(r)>2&&(t.moved=!0),t.kind===`pan`)T(e.movementX,e.movementY);else if(t.kind===`marquee`){if(!t.moved)return;t.pointer={x:e.clientX,y:e.clientY},We(t)}else if(t.moved){let{zoom:e}=C.get();Ve({dx:n/e,dy:r/e})}},Xe=()=>{let e=Le.current;if(Le.current=null,e?.kind===`move`&&e.moved&&Be&&!a){let t=e.origin.map(e=>({op:`artboard.update`,id:e.id,x:Math.round(e.x+Be.dx),y:Math.round(e.y+Be.dy)}));d.apply(t.length===1?t[0]:{op:`batch`,ops:t})}Ve(null),Ue(null)},Ze=e=>{if(!L||a)return;let n=Date.now(),r={id:k(`th`),...L.artboardId?{artboardId:L.artboardId}:{pageId:L.pageId},...L.nodeId?{nodeId:L.nodeId}:{},x:Math.round(L.x),y:Math.round(L.y),status:`open`,createdAt:n,updatedAt:n,messages:[{id:k(`m`),author:t,text:e,createdAt:n}]};d.apply({op:`thread.create`,thread:r}),te(null)},[Qe,$e]=(0,W.useState)(null),et=(e,t)=>{S||e.button!==0||(e.stopPropagation(),e.target.setPointerCapture?.(e.pointerId),$e({id:t,startX:e.clientX,startY:e.clientY,moved:!1,...Pe(e.clientX,e.clientY)}))},tt=e=>{if(!Qe||a)return;let t=Qe.moved||Math.abs(e.clientX-Qe.startX)+Math.abs(e.clientY-Qe.startY)>3;if(!t)return;let n=Fe(e);$e({...Qe,moved:t,...Pe(e.clientX,e.clientY),target:n?n.nodeId??n.artboard.id:void 0})},nt=(e,t)=>{let n=Qe;if($e(null),!n||n.id!==t.id||!v)return;if(!n.moved||a){te(null),z(R===t.id?null:t.id);return}let r=Pe(e.clientX,e.clientY),i=Fe(e);d.apply(i?{op:`thread.update`,id:t.id,artboardId:i.artboard.id,pageId:null,nodeId:i.nodeId??null,x:Math.round(r.x-i.artboard.x),y:Math.round(r.y-i.artboard.y)}:{op:`thread.update`,id:t.id,artboardId:null,pageId:v.id,nodeId:null,x:Math.round(r.x),y:Math.round(r.y)})},rt=(e,t)=>{let n=Qe,r=Ei.comment(ge,t);if($e(null),!n||n.id!==r)return;let i=L!==null&&r===Ei.comment(ge,L);if(!n.moved){z(null),te(i?null:t);return}let a=Ie(e);a&&(ki(r,Ei.comment(ge,a),a),i&&te(a))},it=e=>{let t=Ei.comment(ge,e);Oi(t,null),L&&t===Ei.comment(ge,L)&&te(null)},[at,ot]=(0,W.useState)({}),st=(0,W.useRef)(()=>{});st.current=()=>{let e=O.current;if(!e)return;let t={},n=(n,r)=>{if(!(t[n]||ue.some(e=>e.id===n)))for(let i of r?[r]:ue){let r=xw(e,i,n);if(r){t[n]={...r,artboardId:i.id};return}}};for(let e of ie)n(e);Qe?.moved&&Qe.target&&n(Qe.target);for(let e of me){let t=ue.find(t=>t.id===e.artboardId);t&&e.nodeId&&n(e.nodeId,t)}ot(e=>yw(e,t)?e:t)};let ct=Qe?.moved?Qe.target:void 0;(0,W.useLayoutEffect)(()=>st.current(),[p,v,ie,P,ct]),FC(C,A,j,M,Ae,()=>st.current());let lt=typeof window>`u`?1:window.devicePixelRatio||1,ut=(0,W.useRef)(()=>0);ut.current=e=>{let t=ue.find(t=>t.id===e);return t?Qn({x:t.x,y:t.y,w:ew(t).w,h:pe(t)},C.get(),Se()):0};let dt=(0,W.useCallback)(e=>ut.current(e),[]),ft=jC(C,e=>{let t=Se(),n=String(er(e.zoom,lt));for(let r of ue){let i={x:r.x,y:r.y,w:ew(r).w,h:pe(r)},a=nr(i,e,t);n+=$n(i,e,t)?`+${a?`${a.y0}:${a.y1}`:``}`:`-`}return n}),pt=ft.moving&&QC(xe,ft,Se());if((0,W.useEffect)(()=>AS.hold(pt||D),[pt,D]),!p||!v){let e=f.status===`offline`,t=f.path.split(`/`).pop()?.replace(/\.design$/,``);return(0,G.jsx)(`div`,{className:fx(`pz-root`,`pz-${n}`,D&&`pz-still`,u),children:B&&(0,G.jsxs)(`div`,{className:`pz-appear pz:pointer-events-none pz:absolute pz:inset-0 pz:flex pz:flex-col pz:items-center pz:justify-center pz:gap-3 pz:text-muted-foreground`,children:[(0,G.jsx)(zC,{size:44,dark:n===`dark`,dry:e}),(0,G.jsx)(`span`,{children:f.error?f.error:e?`Reconnecting to Ponzu`:t?`Opening ${t}`:`Opening`})]})})}let mt=e=>Be&&Le.current?.ids.includes(e)?Be:null,ht=e=>Sw(e,ue,pe,mt,at),gt=ht(ie),_t=Se(),vt=er(ft.zoom,lt),yt=V.boardsArriving(ue);return(0,G.jsxs)(`div`,{className:fx(`pz-root`,`pz-${n}`,D&&`pz-still`,u),onPointerDownCapture:Oe,onWheelCapture:Oe,onClickCapture:Oe,children:[(0,G.jsx)(Ar,{}),(0,G.jsx)(`div`,{ref:O,className:fx(`pz:relative pz:min-h-0 pz:flex-1 pz:touch-none pz:overflow-hidden`,S?`pz:cursor-grab pz:active:cursor-grabbing`:y===`comment`?`pz:cursor-crosshair`:`pz:cursor-default`),onPointerDown:Re,onPointerMove:Ye,onPointerUp:Xe,onPointerCancel:Xe,onDragOver:e=>e.preventDefault(),children:(0,G.jsxs)(`div`,{ref:A,className:`pz:absolute pz:inset-0 pz:touch-none pz:overflow-scroll pz:overscroll-none pz:outline-none pz:[overflow-anchor:none] pz:[scrollbar-width:none]`,tabIndex:-1,onMouseDown:e=>e.button===1&&e.preventDefault(),children:[(0,G.jsx)(`div`,{"aria-hidden":!0,style:{width:NC,height:NC}}),(0,G.jsx)(`div`,{ref:j,className:`pz:absolute pz:top-0 pz:left-0 pz:origin-top-left`,children:ue.map(e=>{let t=mt(e.id),r={x:e.x,y:e.y,w:ew(e).w,h:pe(e)},i=nr(r,ft,_t);return(0,G.jsx)(fw,{artboard:e,dx:t?.dx??0,dy:t?.dy??0,h:r.h,tokens:p.tokens,source:d,colorScheme:GC(p.tokens,e)?n:`light`,zoom:ft.zoom*lt,scale:vt,onScreen:$n(r,ft,_t),moving:ft.moving,y0:i?.y0,y1:i?.y1,attention:!!t||ie.includes(e.id)||se.has(e.id)||ne===e.id||yt.has(e.id),cheap:de.has(e.id),skeleton:fe.has(e.id),rankOf:dt,arrivals:V,radius:JC*lt/vt,hold:pt||ZC({...r,x:r.x+(t?.dx??0),y:r.y+(t?.dy??0)},ft,_t)},e.id)})}),(0,G.jsxs)(`div`,{ref:M,className:`pz:pointer-events-none pz:absolute pz:top-0 pz:left-0 pz:origin-top-left`,children:[ue.map(e=>{let t=mt(e.id);return(0,G.jsx)(pw,{artboard:e,dx:t?.dx??0,dy:t?.dy??0,who:se.get(e.id),selected:ie.includes(e.id),renaming:ne===e.id,covered:XC({id:e.id,x:e.x+(t?.dx??0),y:e.y+(t?.dy??0),w:ew(e).w},xe,ft.zoom),events:Je,arrivedAt:V.boardAt(e.id)},e.id)}),ue.map(e=>{let t=V.boardAt(e.id),n=U.get(e.id),r=le.get(e.id);if(t===void 0&&n===void 0&&!r)return null;let i=mt(e.id),a={x:e.x+(i?.dx??0),y:e.y+(i?.dy??0),w:ew(e).w,h:pe(e)},o=r?.box?{x:a.x+r.box.x,y:a.y+r.box.y,w:r.box.width,h:r.box.height}:a;return(0,G.jsxs)(W.Fragment,{children:[n!==void 0&&(0,G.jsx)(aw,{...a,leaving:n,dim:!!r,delay:bi(t)}),t!==void 0&&(0,G.jsx)(ow,{...a,at:t}),r&&(0,G.jsx)(qx,{capture:r,ring:_w(a),ringRadius:8,area:gw(o),radius:JC},r.id)]},e.id)}),Qe?.moved&&Qe.target&&ht([Qe.target]).map(e=>(0,G.jsx)(`div`,{className:`pz:pointer-events-none pz:absolute pz:outline-[1.5px] pz:outline-select`,style:gw(e)},e.id)),gt.map(e=>(0,G.jsx)(`div`,{className:fx(`pz:pointer-events-none pz:absolute pz:outline-select`,e.artboard?`pz:outline-2`:`pz:outline-[1.5px]`),style:gw(e)},e.id)),He&&(0,G.jsx)(`div`,{className:`pz:pointer-events-none pz:absolute pz:bg-select/8 pz:outline-1 pz:outline-select`,style:gw({x:Math.min(He.a.x,He.b.x),y:Math.min(He.a.y,He.b.y),w:Math.abs(He.b.x-He.a.x),h:Math.abs(He.b.y-He.a.y)})}),me.map(e=>{let n=ue.find(t=>t.id===e.artboardId),r=Qe?.id===e.id&&Qe.moved?Qe:null,i=R===e.id,o=r??bw(e,n,at);return(0,G.jsxs)(`div`,{className:fx(sw,i?`pz:z-[3]`:`pz:z-[2]`),style:{left:hw(o.x),top:hw(o.y)},"data-comment-open":i||void 0,children:[(0,G.jsx)(`button`,{type:`button`,title:a?`Open thread`:ve.includes(e.id)?`Unsent reply · Drag to move`:`Drag to move`,className:fx(cw,`pz:bg-comment pz:text-comment-foreground`,S?`pz:cursor-grab`:`pz:cursor-pointer`,(i||r)&&`pz:scale-112`,r&&lw),onPointerDown:t=>et(t,e.id),onPointerMove:tt,onPointerUp:t=>nt(t,e),onPointerCancel:()=>$e(null),onClick:t=>t.detail===0&&z(i?null:e.id),children:ve.includes(e.id)?(0,G.jsx)(Ec,{}):e.messages.length}),i&&(0,G.jsx)(Rx,{thread:e,source:d,me:t,file:ge,readOnly:a,onClose:()=>z(null)})]},e.id)}),_e.map(e=>{let t=Ei.comment(ge,e);if(L&&t===Ei.comment(ge,L))return null;let n=ue.find(t=>t.id===e.artboardId),r=Qe?.id===t&&Qe.moved?Qe:null,i=r??{x:(n?.x??0)+e.x,y:(n?.y??0)+e.y};return(0,G.jsx)(`div`,{className:fx(sw,`pz:z-[2]`),style:{left:hw(i.x),top:hw(i.y)},children:(0,G.jsx)(Ex,{items:[{label:`Open`,icon:(0,G.jsx)(q,{name:`comment`,size:14}),onSelect:()=>{z(null),te(e)}},{label:`Discard draft`,icon:(0,G.jsx)(q,{name:`trash`,size:14}),danger:!0,onSelect:()=>it(e)}],children:(0,G.jsx)(`button`,{type:`button`,title:`Unsent comment · Drag to move`,className:fx(cw,uw,S?`pz:cursor-grab`:`pz:cursor-pointer`,r&&fx(`pz:scale-112`,lw)),onPointerDown:e=>et(e,t),onPointerMove:tt,onPointerUp:t=>rt(t,e),onPointerCancel:()=>$e(null),onClick:t=>{t.detail===0&&(z(null),te(e))},children:(0,G.jsx)(Ec,{})})})},t)}),L&&(()=>{let e=Ei.comment(ge,L),t=ue.find(e=>e.id===L.artboardId),n=Qe?.id===e&&Qe.moved?Qe:null,r=n??{x:(t?.x??0)+L.x,y:(t?.y??0)+L.y};return(0,G.jsxs)(`div`,{className:fx(sw,`pz:z-[3]`),style:{left:hw(r.x),top:hw(r.y)},"data-comment-open":!0,children:[(0,G.jsx)(Ex,{items:[{label:`Discard draft`,icon:(0,G.jsx)(q,{name:`trash`,size:14}),danger:!0,onSelect:()=>it(L)}],children:(0,G.jsx)(`button`,{type:`button`,title:`Drag to move`,className:fx(cw,`pz:scale-112 pz:bg-comment pz:text-comment-foreground`,S?`pz:cursor-grab`:`pz:cursor-pointer`,n&&lw),onPointerDown:t=>et(t,e),onPointerMove:tt,onPointerUp:e=>rt(e,L),onPointerCancel:()=>$e(null),onClick:e=>e.detail===0&&te(null),children:(0,G.jsx)(Ec,{})})}),(0,G.jsx)(`div`,{className:`pz:absolute pz:-top-3 pz:left-5 pz:w-[300px] pz:select-text pz:overflow-hidden pz:rounded-xl pz:bg-card pz:shadow-pop`,children:(0,G.jsx)(Ix,{onSubmit:Ze,onCancel:()=>te(null),draft:{key:e,file:ge,pin:L}},e)})]})})()]})]})}),r&&(0,G.jsx)(_x,{children:(0,G.jsxs)(`div`,{className:`pz:pointer-events-none pz:absolute pz:inset-x-2.5 pz:bottom-2.5 pz:z-[3] pz:flex pz:items-end pz:justify-between pz:gap-2.5`,children:[(0,G.jsxs)(rw,{name:`Pages`,className:`pz:min-w-0 pz:shrink`,children:[(0,G.jsx)(`div`,{className:`pz:flex pz:min-w-0 pz:items-center pz:gap-0.5 pz:overflow-x-auto pz:[scrollbar-width:none]`,children:p.pages.map((e,t)=>(0,G.jsx)(dw,{name:e.name,shortcut:t<8?t+1:t===p.pages.length-1?9:void 0,showShortcut:je,icon:e.icon,active:e.id===v.id,working:ce.has(e.id),onClick:()=>Ne(e.id),onRename:a?void 0:t=>d.apply({op:`page.update`,id:e.id,name:t})},e.id))}),!a&&(0,G.jsx)(vx,{label:`New page`,children:(0,G.jsx)(mx,{variant:`ghost`,size:`icon-lg`,"aria-label":`New page`,onClick:()=>{let e=k(`pg`);d.apply({op:`page.create`,index:p.pages.length,page:{id:e,name:`Page ${p.pages.length+1}`}}),_(e)},children:(0,G.jsx)(q,{name:`add`,size:15})})})]}),(0,G.jsxs)(rw,{name:`Controls`,className:`pz:shrink-0`,children:[i,(0,G.jsx)(Sx,{variant:`raised`,value:S?`hand`:y,onValueChange:b,items:nw.filter(e=>!a||e.value!==`comment`).map(e=>({value:e.value,title:e.label,keys:[e.key],label:(0,G.jsx)(q,{name:e.value,size:16})}))}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pz:mx-1.5 pz:h-4 pz:w-px pz:bg-foreground/10`}),(0,G.jsx)(vx,{label:`Zoom out`,keys:[`⌘`,`−`],children:(0,G.jsx)(mx,{variant:`ghost`,size:`icon`,"aria-label":`Zoom out`,onClick:()=>w(.8,Se().w/2,Se().h/2),children:(0,G.jsx)(q,{name:`minus`,size:14})})}),(0,G.jsx)(vx,{label:`Zoom to fit`,keys:[`⇧`,`1`],children:(0,G.jsx)(mx,{variant:`ghost`,className:`pz:h-7 pz:min-w-9 pz:rounded-lg pz:px-0.5 pz:text-foreground pz:tabular-nums`,"aria-label":`Zoom to fit`,onClick:Ce,children:(0,G.jsx)(vw,{camera:C})})}),(0,G.jsx)(vx,{label:`Zoom in`,keys:[`⌘`,`+`],children:(0,G.jsx)(mx,{variant:`ghost`,size:`icon`,"aria-label":`Zoom in`,onClick:()=>w(1.25,Se().w/2,Se().h/2),children:(0,G.jsx)(q,{name:`plus`,size:14})})})]})]})})]})}var nw=[{value:`select`,label:`Select`,key:`V`},{value:`hand`,label:`Hand`,key:`H`},{value:`comment`,label:`Comment`,key:`C`}];function rw({name:e,className:t,children:n}){return(0,G.jsx)(`div`,{role:`toolbar`,"aria-label":e,"data-slot":`canvas-bar`,className:fx(`pz:pointer-events-auto pz:flex pz:items-center pz:gap-0.5 pz:rounded-xl pz:bg-bar pz:p-1 pz:shadow-bar pz:backdrop-blur-[18px] pz:backdrop-saturate-[1.6]`,t),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>{e.target instanceof Element&&e.target.closest(`input, textarea`)||e.preventDefault()},onWheel:e=>e.stopPropagation(),children:n})}function iw({who:e}){return(0,G.jsx)(BC,{className:`pz-rain-fit pz:ml-auto`,label:`Working`,title:e.map(e=>`${e.name}: ${e.status??`working`}`).join(`
|
|
2382
|
-
`)})}function aw({x:e,y:t,w:n,h:r,leaving:i=!1,dim:a=!1,delay:o=0}){let[s]=(0,W.useState)(o);return(0,G.jsx)(`div`,{className:`pz:pointer-events-none pz:absolute pz:transition-opacity pz:duration-500`,style:{..._w({x:e,y:t,w:n,h:r}),opacity:i||a?0:1},"aria-hidden":!0,children:(0,G.jsx)(`div`,{className:`pz-ring pz:absolute pz:inset-0`,style:{borderRadius:8,animationDelay:`${s}ms`}})})}function ow({x:e,y:t,w:n,h:r,at:i}){let a=(0,W.useRef)(null);return(0,W.useLayoutEffect)(()=>{a.current&&yi(a.current,i)},[i]),(0,G.jsx)(`svg`,{className:`pz:pointer-events-none pz:absolute pz:overflow-visible pz:text-[var(--pz-rind)]`,style:_w({x:e,y:t,w:n,h:r}),"aria-hidden":!0,children:(0,G.jsx)(`rect`,{ref:a,x:1,y:1,style:{width:`calc(100% - 2px)`,height:`calc(100% - 2px)`},rx:8,pathLength:100,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeDasharray:`100 100`,strokeDashoffset:100})})}var sw=`pz:pointer-events-auto pz:absolute pz:size-0`,cw=`pz:absolute pz:top-0 pz:left-0 pz:grid pz:size-6 pz:-translate-1/2 pz:place-items-center pz:rounded-full pz:font-semibold pz:text-[11px] pz:tabular-nums pz:shadow-[0_0_0_1px_rgba(17,17,16,0.18),0_1px_3px_rgba(0,0,0,0.25)] pz:transition-transform pz:duration-[120ms] pz:hover:scale-112`,lw=`pz:cursor-grabbing pz:shadow-[0_0_0_1px_rgba(17,17,16,0.18),0_4px_12px_rgba(0,0,0,0.25)]`,uw=`pz:bg-comment-soft pz:text-foreground pz:shadow-[0_0_0_1.5px_var(--pz-comment),0_1px_3px_rgba(0,0,0,0.2)]`;function dw({name:e,shortcut:t,showShortcut:n,icon:r,active:i,working:a,onClick:o,onRename:s}){let[c,l]=(0,W.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,className:fx(`pz:inline-flex pz:h-7 pz:shrink-0 pz:items-center pz:gap-1.5 pz:whitespace-nowrap pz:rounded-lg pz:px-2.5`,i?`pz:bg-raised pz:text-foreground pz:shadow-raised`:`pz:text-muted-foreground pz:hover:bg-accent pz:hover:text-foreground`),onClick:o,onDoubleClick:()=>s&&l(!0),children:[(0,G.jsx)(yx,{modifier:`⌥`,n:t,shown:n,index:t,children:(0,G.jsx)(q,{name:r&&r in xc?r:`board`,size:14})}),c?(0,G.jsx)(`input`,{autoFocus:!0,className:`pz:w-[9em] pz:bg-transparent pz:outline-0`,defaultValue:e,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e&&s?.(n),l(!1)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&l(!1),e.stopPropagation()}}):(0,G.jsx)(`span`,{className:fx(a&&`pz-shimmer`),children:e})]})}var fw=(0,W.memo)(function({artboard:e,dx:t,dy:n,h:r,tokens:i,source:a,colorScheme:o,zoom:s,scale:c,onScreen:l,moving:u,y0:d,y1:f,attention:p,cheap:m,skeleton:h,rankOf:g,arrivals:_,radius:v,hold:y}){let{w:b,h:x}=ew(e),S=(0,W.useCallback)(()=>g(e.id),[g,e.id]),C=vC(e,i,()=>Oe(e)),w=(0,W.useMemo)(()=>a.snapshotUrl&&((e,t)=>a.snapshotUrl(e,t,C,o)),[a,C,o]),T=(0,W.useMemo)(()=>a.loopsUrl&&(e=>a.loopsUrl(e,C,o)),[a,C,o]),E=d===void 0||f===void 0?void 0:{y0:d,y1:f};return(0,G.jsx)(`div`,{ref:t=>{let n=t?_.takeBoard(e.id):void 0;t&&n!==void 0&&_i(t,n)},className:`pz:absolute pz:shadow-board`,style:{left:e.x+t,top:e.y+n,width:b,height:x??void 0,borderRadius:v,"--pz-board-radius":`${v}px`},children:(0,G.jsx)(SC,{id:e.id,w:b,h:r,scale:s,onScreen:l,moving:u,attention:p,snapshotUrl:w,loopsUrl:T,cheap:m,rank:S,cost:tS(e).elements,skeleton:h,fill:rS(e),children:t=>(0,G.jsx)(Wr,{artboard:e,tokens:i,assetBase:a.assetBase,renditions:a.renditions,colorScheme:o,detail:{hidden:t,scale:c,moving:u,visible:E},arrivals:_,rounded:!0,hold:y})})})}),pw=(0,W.memo)(function({artboard:e,dx:t,dy:n,who:r,selected:i,renaming:a,covered:o,events:s,arrivedAt:c}){let l=o&&!r&&!a&&!i,u=(0,W.useRef)(null);return(0,W.useLayoutEffect)(()=>{u.current&&c!==void 0&&vi(u.current,c)},[c]),(0,G.jsx)(`div`,{className:`pz:absolute pz:h-0`,style:{left:hw(e.x+t),top:hw(e.y+n),width:hw(ew(e).w),visibility:l?`hidden`:void 0},children:(0,G.jsxs)(`div`,{className:fx(`pz:pointer-events-auto pz:absolute pz:top-[-22px] pz:left-0 pz:flex pz:cursor-default pz:items-center pz:gap-[0.5em] pz:whitespace-nowrap pz:text-[12px] pz:leading-[1.4]`,!a&&`pz:max-w-full`,r&&`pz:right-0`,i?`pz:text-select`:`pz:text-muted-foreground pz:hover:text-foreground`),onPointerDown:t=>s.down(t,e),onDoubleClick:()=>s.rename(e.id),children:[a?(0,G.jsx)(`input`,{autoFocus:!0,className:`pz:rounded-[3px] pz:bg-card pz:px-[0.3em] pz:text-[12px] pz:outline-1 pz:outline-select`,defaultValue:e.name,onPointerDown:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&s.apply({op:`artboard.update`,id:e.id,name:n}),s.rename(null)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&s.rename(null)}}):(0,G.jsx)(`span`,{ref:u,"data-board-name":!0,className:`pz:min-w-0 pz:truncate`,title:e.name,children:e.name}),r&&(0,G.jsx)(iw,{who:r})]})})});function mw(e,t){let n=getComputedStyle(e),r=/auto|scroll/.test(n.overflowY)&&(t.deltaY>0&&e.scrollTop+e.clientHeight<e.scrollHeight||t.deltaY<0&&e.scrollTop>0),i=/auto|scroll/.test(n.overflowX)&&(t.deltaX>0&&e.scrollLeft+e.clientWidth<e.scrollWidth||t.deltaX<0&&e.scrollLeft>0);return r||i}function hw(e){return`calc(var(--z) * ${e}px)`}function gw(e){return{left:hw(e.x),top:hw(e.y),width:hw(e.w),height:hw(e.h)}}function _w(e){return{left:`calc(var(--z) * ${e.x}px - ${YC}px)`,top:`calc(var(--z) * ${e.y}px - ${YC}px)`,width:`calc(var(--z) * ${e.w}px + 8px)`,height:`calc(var(--z) * ${e.h}px + 8px)`}}function vw({camera:e}){return(0,G.jsxs)(G.Fragment,{children:[AC(e),`%`]})}function yw(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>{let r=e[n],i=t[n];return!!i&&r.artboardId===i.artboardId&&Math.abs(r.x-i.x)<.5&&Math.abs(r.y-i.y)<.5&&Math.abs(r.w-i.w)<.5&&Math.abs(r.h-i.h)<.5})}function bw(e,t,n){let{x:r,y:i}=e,a=t&&e.nodeId?n[e.nodeId]:void 0;return a&&a.artboardId===t?.id&&(r=Math.min(Math.max(r,a.x),a.x+a.w),i=Math.min(Math.max(i,a.y),a.y+a.h)),{x:(t?.x??0)+r,y:(t?.y??0)+i}}function xw(e,t,n){let r=e.querySelector(`[data-artboard-host="${CSS.escape(t.id)}"]`),i=r?.parentElement,a=r?.shadowRoot?.querySelector(`[data-id="${CSS.escape(n)}"]`);if(!i||!a)return null;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect(),c=o.width/ew(t).w;return c?{x:(s.left-o.left)/c,y:(s.top-o.top)/c,w:s.width/c,h:s.height/c}:null}function Sw(e,t,n,r,i){let a=[];for(let o of e){let e=t.find(e=>e.id===o),s=e?{x:0,y:0,w:ew(e).w,h:n(e)}:void 0;if(!s){let n=i[o];e=n&&t.find(e=>e.id===n.artboardId),s=n}if(!e||!s)continue;let c=r(e.id);a.push({id:o,x:e.x+(c?.dx??0)+s.x,y:e.y+(c?.dy??0)+s.y,w:s.w,h:s.h,artboard:e.id===o})}return a}function Cw(e){return Array.isArray?Array.isArray(e):Nw(e)===`[object Array]`}function ww(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function Tw(e){return e==null?``:ww(e)}function Ew(e){return typeof e==`string`}function Dw(e){return typeof e==`number`}function Ow(e){return e===!0||e===!1||Aw(e)&&Nw(e)==`[object Boolean]`}function kw(e){return typeof e==`object`}function Aw(e){return kw(e)&&e!==null}function jw(e){return e!=null}function Mw(e){return!e.trim().length}function Nw(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Pw=`Incorrect 'index' type`,Fw=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Iw=e=>`Invalid value for key ${e}`,Lw=e=>`Pattern length exceeds max of ${e}.`,Rw=e=>`Missing ${e} property in key`,zw=e=>`Property 'weight' in key '${e}' must be a positive integer`,Bw=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Vw=Object.prototype.hasOwnProperty,Hw=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Uw(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Uw(e){let t=null,n=null,r=null,i=1,a=null;if(Ew(e)||Cw(e))r=e,t=Ww(e),n=Gw(e);else{if(!Vw.call(e,`name`))throw Error(Rw(`name`));let o=e.name;if(r=o,Vw.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(zw(Gw(o)));t=Ww(o),n=Gw(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Ww(e){return Cw(e)?e:e.split(`.`)}function Gw(e){return Cw(e)?e.join(`.`):e}function Kw(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(jw(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!jw(s))return;if(a===t.length-1&&(Ew(s)||Dw(s)||Ow(s)||typeof s==`bigint`))n.push(o===void 0?Tw(s):{v:Tw(s),i:o});else if(Cw(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,Ew(t)?t.split(`.`):t,0),r?n:n[0]}var qw={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Jw={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Yw={location:0,threshold:.6,distance:100},Xw={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:Kw,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},$=Object.freeze({...Jw,...qw,...Yw,...Xw});function Zw(e){return e>=9&&e<=13||e===32||e===160}function Qw(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)Zw(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var $w=class{constructor({getFn:e=$.getFn,fieldNormWeight:t=$.fieldNormWeight}={}){this.norm=Qw(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(Ew(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(Fw);if(Ew(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(Fw);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!jw(e)||Mw(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(jw(i)){if(Cw(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(jw(n)){if(Ew(n)){if(!Mw(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(jw(n.v)){let t=Ew(n.v)?n.v:Tw(n.v);if(!Mw(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Ew(i)&&!Mw(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function eT(e,t,{getFn:n=$.getFn,fieldNormWeight:r=$.fieldNormWeight}={}){let i=new $w({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Uw)),i.setSources(t),i.create(),i}function tT(e,{getFn:t=$.getFn,fieldNormWeight:n=$.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new $w({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function nT(e=[],t=$.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function rT(e,t,n,{location:r=$.location,distance:i=$.distance,threshold:a=$.threshold,findAllMatches:o=$.findAllMatches,minMatchCharLength:s=$.minMatchCharLength,includeMatches:c=$.includeMatches,ignoreLocation:l=$.ignoreLocation}={}){if(t.length>32)throw Error(Lw(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=nT(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function iT(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function aT(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var oT={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},sT=RegExp(`[`+Object.keys(oT).join(``)+`]`,`g`),cT=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(sT,e=>oT[e]):e=>e,lT=class{constructor(e,{location:t=$.location,threshold:n=$.threshold,distance:r=$.distance,includeMatches:i=$.includeMatches,findAllMatches:a=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,isCaseSensitive:s=$.isCaseSensitive,ignoreDiacritics:c=$.ignoreDiacritics,ignoreLocation:l=$.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?cT(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:iT(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?cT(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=rT(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=aT(u)),p}},uT=new Set([`fuzzy`,`include`]);function dT(e){return e.startsWith(`inverse`)}var fT=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new lT(e,{location:t.location??$.location,threshold:t.threshold??$.threshold,distance:t.distance??$.distance,includeMatches:t.includeMatches??$.includeMatches,findAllMatches:t.findAllMatches??$.findAllMatches,minMatchCharLength:t.minMatchCharLength??$.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??$.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??$.ignoreDiacritics,ignoreLocation:t.ignoreLocation??$.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],pT=fT.length,mT=`\0`,hT=`|`;function gT(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function _T(e,t){let n=e.match(t);return n?n[1]:null}function vT(e,t={}){return e.replace(/\\\|/g,mT).split(hT).map(e=>{let n=gT(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<pT;){let e=fT[o],n=_T(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<pT;){let e=fT[o],n=_T(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var yT=class{constructor(e,{isCaseSensitive:t=$.isCaseSensitive,ignoreDiacritics:n=$.ignoreDiacritics,includeMatches:r=$.includeMatches,minMatchCharLength:i=$.minMatchCharLength,ignoreLocation:a=$.ignoreLocation,findAllMatches:o=$.findAllMatches,location:s=$.location,threshold:c=$.threshold,distance:l=$.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?cT(e):e,this.pattern=e,this.query=vT(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?cT(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,dT(r.type)&&(c=!0),n&&(uT.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=aT(o)),e}}return{isMatch:!1,score:1}}},bT=[];function xT(...e){bT.push(...e)}function ST(e,t){for(let n=0,r=bT.length;n<r;n+=1){let r=bT[n];if(r.condition(e,t))return new r(e,t)}return new lT(e,t)}var CT={AND:`$and`,OR:`$or`},wT={PATH:`$path`,PATTERN:`$val`},TT=e=>!!(e[CT.AND]||e[CT.OR]),ET=e=>!!e[wT.PATH],DT=e=>!Cw(e)&&kw(e)&&!TT(e),OT=e=>({[CT.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function kT(e,t,{auto:n=!0}={}){let r=e=>{if(Ew(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=ST(e,t)),r}let i=Object.keys(e),a=ET(e);if(!a&&i.length>1&&!TT(e))return r(OT(e));if(DT(e)){let r=a?e[wT.PATH]:i[0],o=a?e[wT.PATTERN]:e[r];if(!Ew(o))throw Error(Iw(r));let s={keyId:Gw(r),pattern:o};return n&&(s.searcher=ST(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Cw(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return TT(e)||(e=OT(e)),r(e)}function AT(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function jT(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){e.forEach(e=>{e.score=AT(e.matches,{ignoreFieldNorm:t})})}var MT=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function NT(e){let t=[];return e.matches.forEach(e=>{if(!jw(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function PT(e,t,{includeMatches:n=$.includeMatches,includeScore:r=$.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=NT(e)),r&&(a.score=e.score),a})}var FT=/[\p{L}\p{M}\p{N}_]+/gu,IT=new WeakSet;function LT(e){IT.has(e)||(IT.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function RT(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||LT(e),t=>t.match(e)||[]):e=>e.match(FT)||[]}function zT({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=RT(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=cT(n)),r(n)}}}var BT=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=zT({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new lT(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=aT(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function VT(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function HT(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)VT(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)VT(e,t.v,i,r);else VT(e,n.v,i,r)}}}function UT(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)HT(r,i,t,n);return r}function WT(e,t,n,r){HT(e,t,n,r)}function GT(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function KT(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)GT(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var qT=class{constructor(e,t,n){this.options={...$,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Hw(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=ST(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof $w))throw Error(Pw);if(this._myIndex=t||eT(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=zT({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=UT(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!jw(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=zT({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});WT(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&KT(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(Fw);this._invertedIndex&&KT(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(Ew(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return Dw(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&Dw(n)&&n>0&&Ew(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new MT(n,u);Ew(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=Ew(e)?Ew(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),jT(d,{ignoreFieldNorm:s}),a&&d.sort(Ew(e)?u:l),Dw(n)&&n>-1&&(d=d.slice(0,n));return PT(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!jw(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=AT(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=kT(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===CT.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(jw(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!jw(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=AT(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!jw(t))return[];let r=[];if(Cw(t))t.forEach(({v:t,i,n:a})=>{if(!jw(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};qT.version=`7.5.0`,qT.createIndex=eT,qT.parseIndex=tT,qT.config=$,qT.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Bw);return ST(e,{...$,...n}).searchIn(t)},qT.parseQuery=kT,xT(yT),xT(BT),qT.use=function(...e){e.forEach(e=>xT(e))};var JT=qT;function YT(...e){return ux(Ac(e))}function XT(e,t){return e?.files.find(e=>e.key===t.key&&e.base===t.base)}function ZT(e){return e.replace(/^\/private(?=\/(tmp|var|etc)(\/|$))/,``).replace(/^\/(Users|home)\/[^/]+/,`~`)}function QT(e){return e.git?.root??(e.key.slice(0,e.key.lastIndexOf(`/`))||`/`)}function $T(e){return e.git?.branch??e.git?.commit}function eE(e){let t=e.git;if(!t)return null;let n=t.project??t.root;return{id:n,name:t.projectName??n.split(`/`).pop()??n}}function tE({machine:e}){return(0,G.jsxs)(`span`,{className:`flex items-center gap-[5px]`,children:[(0,G.jsx)(q,{name:e?.kind===`laptop`?`laptop`:`desktop`,size:13,strokeWidth:1.7,className:`text-faint`}),e?.name??`This Mac`]})}function nE({file:e,className:t,project:n=!0}){let r=$T(e),i=n?eE(e):null,a=r??ZT(QT(e));return(0,G.jsxs)(`span`,{className:YT(`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,t),title:ZT(e.key),children:[i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(q,{name:`repo`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 shrink-0 truncate`,children:i.name}),(0,G.jsx)(`span`,{className:`text-faint`,children:`·`})]}),(0,G.jsx)(q,{name:r?`branch`:`folder`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,dir:r?void 0:`rtl`,children:(0,G.jsx)(`bdi`,{children:a})})]})}function rE({file:e,name:t,machine:n}){let r=e&&eE(e),i=e&&$T(e),a=e&&!r&&QT(e);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(`b`,{className:`truncate font-semibold text-[14px]`,title:e&&ZT(e.key),children:e?.name??t}),(r||a)&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[r&&(0,G.jsx)(iE,{icon:`repo`,label:aE(r),title:ZT(r.id)}),i&&(0,G.jsx)(iE,{icon:`branch`,label:i,title:e?.git?.branch?i:`Detached at ${i}`}),a&&(0,G.jsx)(iE,{icon:`folder`,label:ZT(a),title:ZT(a),fromEnd:!0})]}),e?.locked&&(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Open it to let Ponzu read this folder.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-[5px] whitespace-nowrap border-t pt-2.5 text-muted-foreground text-xs`,children:[(0,G.jsx)(tE,{machine:n}),e?.modified?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),oE(e.modified)]}):null]})]})}function iE({icon:e,label:t,title:n,fromEnd:r}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-xs`,title:n,children:[(0,G.jsx)(q,{name:e,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,dir:r?`rtl`:void 0,children:(0,G.jsx)(`bdi`,{children:t})})]})}function aE(e){return e.id.startsWith(`/`)?e.name:e.id.slice(e.id.indexOf(`/`)+1)}function oE(e){if(!e)return`Edited a while ago`;let t=Ax(e);if(t===`now`)return`Just now`;let n=t.slice(-1),r=Number(t.slice(0,-1));return n===`m`?`${cE(r,`min`)} ago`:n===`h`?`${cE(r,`hour`)} ago`:r===1?`Yesterday`:r<7?`${r} days ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function sE(e){if(!e)return``;let t=Ax(e);return t===`now`?`now`:/^\d+[mhd]$/.test(t)&&!(t.endsWith(`d`)&&Number(t.slice(0,-1))>=7)?t:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function cE(e,t){return`${e} ${t}${e===1?``:`s`}`}var lE=Nc(`inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-[9px] font-medium outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,outline:`border bg-card hover:bg-accent`,ghost:`text-muted-foreground hover:bg-accent hover:text-foreground`},size:{default:`h-[34px] px-3.5`,sm:`h-7 rounded-lg px-2.5`,icon:`size-7 rounded-lg`}},defaultVariants:{variant:`default`,size:`default`}});function uE({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,type:i=`button`,...a}){let o=r?Hc:`button`;return(0,G.jsx)(o,{"data-slot":`button`,"data-variant":t,"data-size":n,type:r?void 0:i,className:YT(lE({variant:t,size:n,className:e})),...a})}function dE({...e}){return(0,G.jsx)(Ff,{"data-slot":`dialog`,...e})}function fE({...e}){return(0,G.jsx)(zf,{"data-slot":`dialog-portal`,...e})}function pE({className:e,...t}){return(0,G.jsx)(Vf,{"data-slot":`dialog-overlay`,className:YT(`fixed inset-0 z-50 bg-black/40 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function mE({className:e,children:t,showCloseButton:n=!0,...r}){return(0,G.jsxs)(fE,{"data-slot":`dialog-portal`,children:[(0,G.jsx)(pE,{}),(0,G.jsxs)(Wf,{"data-slot":`dialog-content`,className:YT(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl bg-popover p-6 text-popover-foreground shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-md`,e),...r,children:[t,n&&(0,G.jsxs)(Zf,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 grid size-7 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,G.jsx)(q,{name:`close`,size:15}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function hE({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`dialog-header`,className:YT(`flex flex-col gap-1 text-left`,e),...t})}function gE({className:e,...t}){return(0,G.jsx)(Jf,{"data-slot":`dialog-title`,className:YT(`font-semibold text-[17px] leading-none tracking-[-0.01em]`,e),...t})}function _E({className:e,...t}){return(0,G.jsx)(Yf,{"data-slot":`dialog-description`,className:YT(`text-muted-foreground`,e),...t})}var vE=500,yE={agent:null,ideas:[],running:!1,looking:[]},bE=null;function xE(e,t=``){let[n,r]=(0,W.useState)(bE),[i,a]=(0,W.useState)(!1),o=e=>{bE=e,AE(e.ideas),r(e)};(0,W.useEffect)(()=>{let e=!0;return TE(`GET`).then(t=>e&&o(t??bE??yE)),()=>{e=!1}},[t]),(0,W.useEffect)(()=>{if(!e)return;let t=!0;return a(!0),TE(`POST`).then(e=>{t&&(a(!1),e&&o(e))}),()=>{t=!1,a(!1)}},[e]);let s=!!n?.running;return(0,W.useEffect)(()=>{if(!s)return;let e=!0,t=setInterval(()=>{TE(`GET`).then(t=>e&&t&&o(t))},vE);return()=>{e=!1,clearInterval(t)}},[s]),n?i&&!n.running?{...n,running:!0}:n:null}function SE(e,t){let[n,r]=(0,W.useState)({}),i=(e,t)=>{t&&AE(t.ideas),r(n=>CE(n,e,t))},a=t.map(e=>e.id).join(` `);(0,W.useEffect)(()=>{let e=!0;for(let t of a.split(` `).filter(Boolean))TE(`GET`,wE(t)).then(n=>e&&i(t,n));return()=>{e=!1}},[a]),(0,W.useEffect)(()=>{if(!e)return;let t=!0;for(let e of a.split(` `).filter(Boolean))TE(`POST`,wE(e)).then(n=>t&&i(e,n));return()=>{t=!1}},[e,a]);let o=Object.entries(n).filter(([,e])=>e.running).map(([e])=>e).join(` `);return(0,W.useEffect)(()=>{if(!o)return;let e=!0,t=setInterval(()=>{for(let t of o.split(` `))TE(`GET`,wE(t)).then(n=>e&&i(t,n))},vE);return()=>{e=!1,clearInterval(t)}},[o]),t.flatMap(e=>{let t=n[e.id];return t?.agent?[{...t,machine:e}]:[]})}function CE(e,t,n){if(n)return{...e,[t]:n};let{[t]:r,...i}=e;return i}function wE(e){return`/peers/${encodeURIComponent(e)}`}async function TE(e,t=``){let n=e===`POST`?`/api/suggestions/refresh`:`/api/suggestions`;try{let r=await fetch(`${window.location.origin}${t}${n}`,{method:e});if(!r.ok)return null;let i=await r.json();return Array.isArray(i?.ideas)?{...i,looking:i.looking??[]}:null}catch{return null}}var EE=new Map,DE=!1,OE=0;function kE(e){return`${e.project}\n${e.name.toLowerCase()}`}function AE(e,t=performance.now()){for(let n of e){let e=kE(n);EE.has(e)||(DE?(OE=Math.max(t,OE+700),EE.set(e,OE)):EE.set(e,0))}DE=!0}function jE(e){return EE.get(kE(e))??0}var ME=[-90,110],NE=[950,1200],PE=[550,1e3],FE=[1e3,1350],IE=90+FE[1],LE=7,RE=8;function zE(){return(0,G.jsx)(`div`,{className:`pz-appear grid h-[560px] place-items-center`,role:`status`,"aria-label":`Looking for designs to suggest`,children:(0,G.jsx)(BC,{columns:RE,className:`text-[30px]`})})}function BE({at:e,machine:t}){return(0,G.jsxs)(`div`,{className:`pz-appear flex min-w-0 flex-col gap-2.5`,role:`status`,"aria-label":`Looking around ${e.folder}`,children:[(0,G.jsx)(`div`,{className:`aspect-[16/11] rounded-xl border border-foreground/18 border-dashed px-4 py-3.5`,children:(0,G.jsxs)(`span`,{className:`pz-shimmer block truncate text-[12px] text-muted-foreground leading-[18px]`,children:[`Looking around `,e.folder,`…`]})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`flex h-5 items-center`,children:(0,G.jsx)(BC,{columns:LE,className:`text-[17px]`})}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]})]})}function VE({idea:e,machine:t,onPick:n}){let r=jE(e),[i]=(0,W.useState)(()=>!e.prompt),[a,o]=(0,W.useState)(()=>r>0&&performance.now()-r<IE&&!li()),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(!a)return;let e=performance.now(),t=r+90;s.current&&yi(s.current,r,e);let n=[qE(c.current,t,PE,e),qE(u.current,t,FE,e),l.current?.animate([{opacity:0,offset:0},{opacity:1,offset:KE(ME)/KE([ME[0],NE[1]])},{opacity:1,offset:(NE[0]-ME[0])/KE([ME[0],NE[1]])},{opacity:0,offset:1}],{duration:KE([ME[0],NE[1]]),fill:`both`})],i=n[2];i&&(i.currentTime=e-(t+ME[0]));let d=setTimeout(()=>o(!1),r+IE-e);return()=>{clearTimeout(d);for(let e of n)e?.cancel()}},[a,r]);let d=()=>n(e);return(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group flex min-w-0 cursor-default flex-col gap-2.5 text-left outline-none`,onClick:d,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())},children:[(0,G.jsxs)(`div`,{className:`relative aspect-[16/11]`,children:[(0,G.jsx)(`div`,{ref:c,className:`absolute inset-0 overflow-hidden rounded-xl border border-foreground/18 border-dashed px-4 py-3.5 transition-[border-color,box-shadow] group-hover:border-foreground/30 group-focus-visible:shadow-[0_0_0_2px_var(--ring)]`,children:e.prompt?(0,G.jsx)(`p`,{className:YT(`h-full overflow-hidden text-pretty wrap-break-word text-[12px] text-foreground/80 leading-[18px] [mask-image:linear-gradient(to_bottom,#000_calc(100%-40px),transparent)]`,i&&`pz-appear`),children:e.prompt}):(0,G.jsx)(WE,{steps:e.steps??[]})}),a&&(0,G.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 size-full overflow-visible`,children:(0,G.jsx)(`rect`,{ref:s,x:.75,y:.75,rx:12,pathLength:100,fill:`none`,stroke:`#f2b100`,strokeWidth:1.5,strokeDasharray:`100 100`,strokeDashoffset:100,style:{width:`calc(100% - 1.5px)`,height:`calc(100% - 1.5px)`}})})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[a&&(0,G.jsx)(`div`,{ref:l,className:`absolute top-[9px] left-0.5 flex`,children:(0,G.jsx)(BC,{columns:LE,className:`text-[17px]`})}),(0,G.jsxs)(`div`,{ref:u,className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-[13.5px]`,children:e.name}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]})]})]})}function HE({project:e,name:t,machine:n}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:n?`${e} on ${n.name}`:e,children:[(0,G.jsx)(q,{name:`repo`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,G.jsx)(q,{name:n.kind===`laptop`?`laptop`:`desktop`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:n.name})]})]})}var UE={read:`Reading`,find:`Finding`,search:`Searching for`};function WE({steps:e,label:t=`Reading the code…`}){let n=new Map;return(0,G.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col gap-1.5`,role:`status`,children:[(0,G.jsx)(`span`,{className:`pz-shimmer mb-1 text-[12px] text-muted-foreground leading-[18px]`,children:t}),e.map((t,r)=>{let i=`${t.verb}:${t.what}`,a=(n.get(i)??0)+1;return n.set(i,a),(0,G.jsxs)(`span`,{className:`pz-appear flex min-w-0 items-baseline gap-1.5 text-[11.5px] leading-4`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-faint`,children:UE[t.verb]}),(0,G.jsx)(`span`,{className:YT(`min-w-0 truncate font-mono text-[11px]`,r===e.length-1?`text-foreground/80`:`text-faint`),children:t.verb===`search`?`“${t.what}”`:t.what})]},`${i}:${a}`)})]})}var GE={claude:`Claude Code`,codex:`Codex`};function KE([e,t]){return t-e}function qE(e,t,[n,r],i){if(!e)return;let a=e.animate([{opacity:0,offset:0},{opacity:0,offset:n/r,easing:`ease-out`},{opacity:1,offset:1}],{duration:r,fill:`backwards`});return a.currentTime=i-t,a}function JE({idea:e,machine:t,agent:n,open:r,onClose:i}){let[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(void 0);return(0,G.jsx)(dE,{open:r,onOpenChange:e=>{e||(i(),o(!1))},children:(0,G.jsx)(mE,{"aria-describedby":void 0,children:e&&(0,G.jsx)(YE,{idea:e,machine:t,agent:n,copied:a,onCopy:()=>{e?.prompt&&(navigator.clipboard.writeText(e.prompt),o(!0),clearTimeout(s.current),s.current=setTimeout(()=>o(!1),1400))}})})})}function YE({idea:e,machine:t,agent:n=null,copied:r,onCopy:i}){let a=!e.prompt;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(hE,{className:`gap-2 pr-8`,children:[(0,G.jsx)(gE,{children:e.name}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]}),(0,G.jsx)(`div`,{className:YT(`select-text wrap-break-word rounded-[10px] bg-secondary px-3.5 py-3 text-[13px] leading-5 shadow-[inset_0_0_0_1px_var(--hairline)]`,a&&`min-h-30`),children:a?(0,G.jsx)(WE,{steps:e.steps??[],label:`${n?GE[n]:`Your agent`} is reading ${e.projectName} to write this prompt…`}):e.prompt}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex-1 text-faint text-xs`,children:a&&`Copy prompt works once it’s written.`}),(0,G.jsxs)(uE,{onClick:i,disabled:a,className:`text-[13px]`,children:[(0,G.jsx)(q,{name:r?`check`:`copy`,size:15}),r?`Copied`:`Copy prompt`]})]})]})}var XE=`z-50 min-w-[200px] rounded-[11px] bg-popover p-[5px] text-[13px] text-popover-foreground shadow-[0_0_0_1px_var(--hairline-strong),0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,ZE=`flex h-[30px] cursor-default select-none items-center gap-[9px] rounded-[7px] px-2.5 outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[disabled]:opacity-40 [&_svg]:text-muted-foreground`,QE=`mx-1.5 my-1 h-px bg-[var(--hairline-strong)]`,$E=N_,eD=F_;function tD({className:e,sideOffset:t=6,...n}){return(0,G.jsx)(I_,{children:(0,G.jsx)(R_,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:YT(XE,e),...n})})}function nD({className:e,...t}){return(0,G.jsx)(z_,{"data-slot":`dropdown-menu-item`,className:YT(ZE,e),...t})}function rD({className:e,...t}){return(0,G.jsx)(B_,{className:YT(QE,e),...t})}var iD=g_,aD=v_;function oD({className:e,...t}){return(0,G.jsx)(y_,{children:(0,G.jsx)(x_,{"data-slot":`context-menu-content`,className:YT(XE,e),...t})})}function sD({className:e,...t}){return(0,G.jsx)(S_,{"data-slot":`context-menu-item`,className:YT(ZE,e),...t})}function cD({className:e,...t}){return(0,G.jsx)(C_,{className:YT(QE,e),...t})}var lD=`ponzu.seen`;function uD(){try{return JSON.parse(localStorage.getItem(lD)??`{}`)}catch{return{}}}function dD(e){let t=uD();for(let[n,r]of Object.entries(e))t[n]=Math.max(t[n]??0,r);try{localStorage.setItem(lD,JSON.stringify(t))}catch{}}function fD(e,t,n){let r=e;for(let i of t){let t=e[i.id];t!==void 0&&(i.id!==n||t>=i.modified)||(r===e&&(r={...e}),r[i.id]=i.modified)}return r}function pD(e,t){let n=e[t.id];return n!==void 0&&t.modified>n+1e3}var mD=navigator.userAgent.includes(`Mac`),hD=mD?`⌘`:`Ctrl+`,gD=8,_D=12,vD=4,yD=1e4;function bD({catalog:e,onOpen:t,onOpenFolder:n,onNew:r,onShelve:i,seen:a={}}){let[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),m=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=e=>{e.metaKey===mD&&e.ctrlKey===!mD&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`f`&&(e.preventDefault(),m.current?.focus(),m.current?.select())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let h=(0,W.useMemo)(()=>x(e?.files??[]),[e?.files]),g=o.trim(),_=JD(h),v=(0,W.useMemo)(()=>{let e={recent:[],archived:[]};for(let t of h)e[y(t)].push(t);return{recent:S(e.recent),archived:S(e.archived)}},[h]),b=e!==null&&v.recent.length===0,C=MD(e!==null,e!==null&&h.length===0),[w,T]=(0,W.useState)(!1),E=xE(w,e?.agents.filter(e=>e.found).map(e=>e.id).join(` `)??``),D=SE(w,(0,W.useMemo)(()=>e?.machines.filter(e=>e.id!==`local`)??[],[e?.machines])),O=!!E?.agent||D.length>0,k=c===`suggested`&&!O?`recent`:c??(b&&O?`suggested`:`recent`),A=e===null||C||b&&E===null,j=!A&&!g&&k===`suggested`;(0,W.useEffect)(()=>T(j),[j]);let[M,N]=(0,W.useState)(()=>Date.now()),P=(0,W.useMemo)(()=>{let e=Math.max(M,Date.now()),t=(t,n)=>{let r=h.filter(e=>e.machine===(n?.id??`local`));return t.flatMap(t=>{let i=ze(t,r);return i&&Be(i,e)?[]:[{idea:t,file:i,machine:n}]})};return[...t(E?.ideas??[]),...D.flatMap(e=>t(e.ideas,e.machine))]},[E?.ideas,D,h,M]);(0,W.useEffect)(()=>{let e=P.flatMap(({file:e})=>e?.created&&!e.busy?[e.created+Re]:[]);if(!e.length)return;let t=setTimeout(()=>N(Date.now()),Math.max(0,Math.min(...e)-Date.now())+50);return()=>clearTimeout(t)},[P]);let[F,I]=(0,W.useState)({idea:null,open:!1}),ee=F.idea,L=ee?P.find(e=>e.machine?.id===F.machine?.id&&kE(e.idea)===kE(ee))?.idea??ee:null,te=v.recent,R=k===`suggested`?wD:v[k],z=DD((0,W.useMemo)(()=>k===`suggested`?[...P.map(({idea:e})=>e),...E?.looking??[],...D.flatMap(e=>e.looking)].map(e=>({id:e.projectId,name:e.projectName})):R.map(e=>eE(e.file)),[k,P,R,E?.looking,D])),ne=u!==null&&z.some(e=>e.id===u)?u:null,re=ne===null?R:R.filter(e=>(eE(e.file)?.id??TD)===ne),ie=ne===null?P:P.filter(({idea:e})=>e.projectId===ne),ae=[...(E?.looking??[]).map(e=>({at:e,machine:void 0})),...D.flatMap(e=>e.looking.map(t=>({at:t,machine:e.machine})))].filter(({at:e})=>ne===null||e.projectId===ne),oe=!!E?.running||D.some(e=>e.running),se=e=>p({text:e instanceof Error&&e.message?e.message:`That didn’t work.`}),ce=i?async(e,t)=>{let n=t=>Promise.all([e.file,...e.copies].map(e=>i(e,t)));try{await n(t)}catch(e){se(e);return}let r={archive:`restore`,restore:`archive`};p({text:CD[t](e.file.name),undo:()=>{p(null),n(r[t]).catch(se)}})}:void 0;return(0,W.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(null),6e3);return()=>clearTimeout(e)},[f]),(0,G.jsxs)(`div`,{className:`h-full overflow-auto rounded-xl bg-home`,children:[(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-[1088px] flex-col gap-7 px-8 pt-12 pb-12`,children:[(0,G.jsx)(_x,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`label`,{className:`search flex h-10 flex-1 items-center gap-2.5 rounded-[10px] bg-card px-3.5 text-[14px]`,children:[(0,G.jsx)(q,{name:`search`,size:18,className:`shrink-0 text-faint`}),(0,G.jsx)(`input`,{ref:m,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(s(``),e.currentTarget.blur())},placeholder:`Search designs`,spellCheck:!1,className:`h-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-faint`}),g?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,className:`grid size-5 place-items-center rounded text-faint hover:text-foreground`,onClick:()=>{s(``),m.current?.focus()},children:(0,G.jsx)(q,{name:`close`,size:14,strokeWidth:1.8})}):(0,G.jsxs)(`span`,{className:`text-faint text-xs`,children:[hD,`F`]})]}),(0,G.jsx)(`span`,{className:`w-1.5`}),n&&(0,G.jsx)(LD,{label:`Open`,keys:[`⌘`,`O`],icon:`folderOpen`,onClick:n}),r&&(0,G.jsx)(LD,{label:`New`,keys:[`⌘`,`N`],icon:`add`,onClick:r})]})}),A?(0,G.jsx)(FD,{}):g?(0,G.jsx)(eO,{query:g,cards:te,onOpen:t,onShelve:ce,live:_,seen:a}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`-mb-3.5 flex h-7 items-center justify-between gap-4`,children:[(0,G.jsx)(ED,{view:k,has:{recent:!0,suggested:O,archived:v.archived.length>0},onView:l}),z.length>1&&(0,G.jsx)(OD,{projects:z,scope:ne,onScope:d})]}),k===`suggested`?ie.length||ae.length?(0,G.jsxs)(BD,{children:[ae.map(({at:e,machine:t})=>(0,G.jsx)(BE,{at:e,machine:t},`looking:${t?.id??`local`}:${e.project}`)),ie.map(({idea:e,file:n,machine:r})=>n?(0,G.jsx)(VD,{card:{file:n,copies:[]},onOpen:t,onShelve:ce,live:_.has(n.id),unseen:pD(a,n)},n.id):(0,G.jsx)(VE,{idea:e,machine:r,onPick:e=>I({idea:e,machine:r,open:!0})},`${r?.id??`local`}:${e.project}:${e.name}`))]}):oe?(0,G.jsx)(zE,{}):(0,G.jsx)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:SD[k]}):re.length?(0,G.jsx)(BD,{children:re.map(e=>(0,G.jsx)(VD,{card:e,onOpen:t,onShelve:ce,live:_.has(e.file.id),unseen:pD(a,e.file),short:!!ne},e.file.id))}):(0,G.jsx)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:SD[k]})]})]}),f&&(0,G.jsx)(ID,{text:f.text,onUndo:f.undo,onClose:()=>p(null)}),(0,G.jsx)(JE,{idea:L,machine:F.machine,agent:(F.machine?D.find(e=>e.machine.id===F.machine?.id)?.agent:E?.agent)??null,open:F.open,onClose:()=>I(e=>({...e,open:!1}))})]})}var xD=[{id:`recent`,label:`Recent`,icon:`clock`},{id:`suggested`,label:`Suggested`,icon:`sparkle`},{id:`archived`,label:`Archived`,icon:`shelved`}],SD={recent:`Nothing here yet.`,suggested:`Nothing to suggest yet.`,archived:`Nothing archived.`},CD={archive:e=>`Archived “${e}”. It comes back when you open it or an agent edits it.`,restore:e=>`Restored “${e}”.`},wD=[],TD=``;function ED({view:e,has:t,onView:n}){return(0,G.jsx)(`div`,{className:`flex items-center gap-[18px] text-[13px]`,role:`tablist`,children:xD.map(r=>t[r.id]||e===r.id?(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e===r.id,onClick:()=>n(r.id),className:YT(`group flex items-center gap-1.5`,e===r.id?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(q,{name:r.icon,size:14,className:e===r.id?`text-foreground`:`text-faint group-hover:text-muted-foreground`}),r.label]},r.id):null)})}function DD(e){return(0,W.useMemo)(()=>{let t=new Map;for(let n of e){let e=n?.id??TD,r=t.get(e);r?r.count++:t.set(e,{id:e,name:n?.name??`Not in a project`,count:1})}let n=new Map;for(let e of t.values())n.set(e.name,(n.get(e.name)??0)+1);for(let e of t.values())e.id!==TD&&(n.get(e.name)??0)>1&&(e.name=e.id.split(`/`).slice(-2).join(`/`));return[...t.values()].sort((e,t)=>Number(e.id===TD)-Number(t.id===TD)||t.count-e.count||e.name.localeCompare(t.name))},[e])}function OD({projects:e,scope:t,onScope:n}){let r=e.find(e=>e.id===t);return(0,G.jsxs)($E,{children:[(0,G.jsx)(eD,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Project: ${r?r.name:`All projects`}`,className:YT(`flex h-7 items-center gap-1.5 whitespace-nowrap rounded-[7px] pr-2 pl-2.5 text-[13px] outline-none hover:bg-accent focus-visible:shadow-[0_0_0_2px_var(--ring)] data-[state=open]:bg-accent`,r?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground data-[state=open]:text-foreground`),children:[(0,G.jsx)(q,{name:r?r.id===TD?`loose`:`folder`:`folders`,size:14,strokeWidth:1.6,className:r?`text-foreground`:void 0}),r?r.name:`All projects`,(0,G.jsx)(q,{name:`chevronDown`,size:13,strokeWidth:2,className:`text-faint`})]})}),(0,G.jsxs)(tD,{align:`end`,className:`min-w-56`,children:[(0,G.jsx)(kD,{on:t===null,onSelect:()=>n(null),icon:`folders`,children:`All projects`}),(0,G.jsx)(rD,{}),e.map(e=>(0,G.jsx)(kD,{on:t===e.id,onSelect:()=>n(e.id),icon:e.id===TD?`loose`:`folder`,title:e.id||void 0,children:e.name},e.id))]})]})}function kD({on:e,onSelect:t,icon:n,title:r,children:i}){return(0,G.jsxs)(nD,{onSelect:t,title:r,"aria-checked":e,role:`menuitemcheckbox`,children:[(0,G.jsx)(`span`,{className:`grid w-3.5 place-items-center`,children:e&&(0,G.jsx)(q,{name:`check`,size:14,strokeWidth:2})}),(0,G.jsx)(`span`,{className:`grid w-3.5 place-items-center text-muted-foreground`,children:n&&(0,G.jsx)(q,{name:n,size:14,strokeWidth:1.6})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i})]})}var AD=`ponzu.setUp`,jD=3e4;function MD(e,t){let[n,r]=(0,W.useState)(()=>{try{return localStorage.getItem(AD)===`1`}catch{return!1}}),[i,a]=(0,W.useState)(null),[,o]=(0,W.useState)(0),s=e&&!t;return(0,W.useEffect)(()=>{if(s){r(!0);try{localStorage.setItem(AD,`1`)}catch{}}},[s]),(0,W.useEffect)(()=>{a(e=>t?e??Date.now():null)},[t]),(0,W.useEffect)(()=>{if(i===null)return;let e=setTimeout(()=>o(Date.now()),i+jD-Date.now());return()=>clearTimeout(e)},[i]),!n||!t?!1:i===null||Date.now()-i<jD}var ND=[`62%`,`48%`,`71%`,`55%`,`44%`,`66%`,`52%`,`60%`],PD=[`34%`,`26%`,`40%`,`30%`,`24%`,`36%`,`28%`,`32%`];function FD(){return HC(!0)?(0,G.jsxs)(`div`,{className:`pz-appear flex flex-col gap-7`,role:`status`,"aria-label":`Loading designs`,children:[(0,G.jsx)(`div`,{className:`-mb-3.5 flex h-7 items-center text-[13px]`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,G.jsx)(q,{name:`clock`,size:14,className:`text-foreground`}),`Recent`]})}),(0,G.jsx)(BD,{children:ND.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 motion-safe:animate-pulse`,style:{animationDelay:`${t*90}ms`},children:[(0,G.jsx)(`div`,{className:`aspect-[16/11] rounded-xl bg-preview shadow-[0_0_0_1px_var(--hairline)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex h-5 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex-1`,children:(0,G.jsx)(`span`,{className:`block h-[11px] rounded-full bg-secondary`,style:{width:e}})}),(0,G.jsx)(`span`,{className:`h-[9px] w-5 rounded-full bg-secondary`})]}),(0,G.jsxs)(`span`,{className:`flex h-4 items-center gap-[5px]`,children:[(0,G.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-[3px] bg-secondary`}),(0,G.jsx)(`span`,{className:`h-[9px] rounded-full bg-secondary`,style:{width:PD[t]}}),(0,G.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-[3px] bg-secondary`}),(0,G.jsx)(`span`,{className:`h-[9px] w-[22%] rounded-full bg-secondary`})]})]})]},t))})]}):null}function ID({text:e,onUndo:t,onClose:n}){return(0,G.jsxs)(`div`,{role:`status`,className:`fixed bottom-6 left-1/2 z-50 flex h-10 -translate-x-1/2 items-center gap-3.5 rounded-xl bg-foreground pr-2 pl-3.5 text-[13px] text-home shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)]`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`flex h-7 items-center rounded-lg bg-home/15 px-2.5 font-medium hover:bg-home/25`,children:`Undo`}):(0,G.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`px-1.5 opacity-70`,children:(0,G.jsx)(q,{name:`close`,size:13})})]})}function LD({label:e,keys:t,icon:n,onClick:r}){return(0,G.jsx)(vx,{label:e,keys:t,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":e,onClick:r,className:`grid size-10 place-items-center rounded-[10px] text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(q,{name:n,size:20,strokeWidth:1.5})})})}function RD(e){return e===`claude`?`Claude`:e===`openai`?`Codex`:e===`cursor`?`Cursor`:`Your agent`}function zD({left:e}){return(0,G.jsx)(`div`,{className:`-mb-3.5 text-muted-foreground text-xs`,children:e})}function BD({children:e,columns:t=4}){return(0,G.jsx)(`div`,{className:YT(`grid gap-x-5 gap-y-7`,t===4?`grid-cols-4 max-[1100px]:grid-cols-3 max-[820px]:grid-cols-2`:`grid-cols-3 max-[820px]:grid-cols-2`),children:e})}function VD({card:e,onOpen:t,onShelve:n,match:r,pathMatch:i,live:a,unseen:o,short:s}){let{file:c,copies:l}=e,u=!!c.busy,d=y(c)===`archived`,f=()=>t({key:c.key,base:c.base}),p=(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group relative flex min-w-0 cursor-default flex-col gap-2.5 text-left outline-none`,onClick:f,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},title:c.locked?`Open it to let Ponzu read this folder.`:void 0,children:[(0,G.jsxs)(`div`,{className:`relative aspect-[16/11] overflow-hidden rounded-xl bg-preview shadow-[0_0_0_1px_var(--hairline)] transition-shadow group-hover:shadow-[0_0_0_1px_var(--hairline-strong),0_4px_14px_rgba(0,0,0,0.06)] group-focus-visible:shadow-[0_0_0_2px_var(--ring)]`,children:[(0,G.jsxs)(`div`,{className:YT(`absolute inset-0`,d&&`opacity-55 grayscale`),children:[(0,G.jsx)(qD,{src:c.preview,working:u}),a&&(0,G.jsx)(ZD,{file:c})]}),o&&(0,G.jsx)(`span`,{role:`img`,"aria-label":`Changed since you looked`,title:`Changed since you looked`,className:`absolute top-2 left-2 z-[4] size-2.5 rounded-full bg-flesh shadow-[0_0_0_1.5px_var(--card),0_0_0_2.5px_rgba(17,17,16,0.18)]`})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,G.jsx)(`span`,{className:YT(`min-w-0 flex-1 truncate font-medium text-[13.5px]`,u&&`pz-shimmer`,d&&`text-muted-foreground`),children:(0,G.jsx)(rO,{text:c.name,ranges:r})}),(0,G.jsx)(`span`,{className:`shrink-0 text-faint text-xs tabular-nums`,title:d&&c.archived?`Archived ${new Date(c.archived).toLocaleString()}`:void 0,children:c.busy?(0,G.jsx)(BC,{columns:_D,className:`self-center text-[17px]`,label:`${RD(c.busy)} is working`,title:`${RD(c.busy)} is working`}):sE(c.modified)})]}),d&&!i?(0,G.jsx)(HD,{file:c}):i?(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,dir:`rtl`,children:(0,G.jsx)(`bdi`,{children:(0,G.jsx)(rO,{text:c.key,ranges:i})})}):(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,children:[l.length?(0,G.jsx)(WD,{card:e}):(0,G.jsx)(nE,{file:c,project:!s,className:`min-w-0 shrink`}),s&&c.git&&!l.length&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,G.jsx)(`span`,{className:`min-w-0 shrink-[2] truncate`,children:QT(c).split(`/`).pop()})]})]})]})]});return n?(0,G.jsxs)(iD,{children:[(0,G.jsx)(aD,{asChild:!0,children:p}),(0,G.jsx)(oD,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)(KD,{card:e,onOpen:t,onShelve:n})})]}):p}function HD({file:e}){let[t,n]=e.archivedFor===`idle`?[`clock`,`Not opened since ${UD(e.active??e.modified)}`]:e.archivedFor===`scratch`||e.shelf===`scratch`?[`bot`,`Made by an agent`]:e.archivedFor===`temp`?[`bot`,`In a temporary folder`]:[`shelved`,`You archived it`];return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:e.archived?`Archived ${new Date(e.archived).toLocaleString()}`:void 0,children:[(0,G.jsx)(q,{name:t,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`truncate`,children:n})]})}function UD(e){let t=new Date(e);return t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`}})}function WD({card:e}){let t=GD(e),n=[e.file,...e.copies].every(e=>e.git?.branch);return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:`The same design, unchanged, on ${t.map(e=>e.label).join(`, `)}`,children:[(0,G.jsx)(q,{name:`branch`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.length,` `,n?`branches`:`checkouts`]})]})}function GD(e){return[e.file,...e.copies].map(e=>({file:e,label:$T(e)??ZT(QT(e))})).sort((e,t)=>e.label.localeCompare(t.label))}function KD({card:e,onOpen:t,onShelve:n}){let{file:r,copies:i}=e,a=window.ponzuDesktop,o=r.machine===`local`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(sD,{onSelect:()=>t({key:r.key,base:r.base}),children:[(0,G.jsx)(q,{name:`folderOpen`,size:15}),`Open`]}),i.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(cD,{}),(0,G.jsx)(`div`,{className:`px-2.5 pt-1 pb-0.5 text-[11.5px] text-faint`,children:`Open on`}),(0,G.jsx)(`div`,{className:`max-h-[225px] overflow-y-auto`,children:GD(e).map(({file:e,label:n})=>(0,G.jsxs)(sD,{title:ZT(e.key),onSelect:()=>t({key:e.key,base:e.base}),children:[(0,G.jsx)(q,{name:`branch`,size:15}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-[240px] truncate`,children:n})]},e.id))}),(0,G.jsx)(cD,{})]}),a&&o&&(0,G.jsxs)(sD,{onSelect:()=>a.reveal(r.key),children:[(0,G.jsx)(q,{name:`folder`,size:15}),`Show in Finder`]}),(0,G.jsxs)(sD,{onSelect:()=>void navigator.clipboard.writeText(r.key),children:[(0,G.jsx)(q,{name:`copy`,size:15}),`Copy path`]}),(0,G.jsx)(cD,{}),y(r)===`archived`?(0,G.jsxs)(sD,{onSelect:()=>void n(e,`restore`),children:[(0,G.jsx)(q,{name:`unarchive`,size:15}),`Restore`]}):(0,G.jsxs)(sD,{onSelect:()=>void n(e,`archive`),children:[(0,G.jsx)(q,{name:`shelved`,size:15}),`Archive`]})]})}function qD({src:e,working:t}){let[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>r(!1),[e]),!e||n?(0,G.jsx)(`span`,{className:`absolute inset-0 grid place-items-center text-faint`,children:t?(0,G.jsx)(BC,{columns:gD,className:`text-[30px]`}):(0,G.jsx)(q,{name:`blank`,size:28,strokeWidth:1.3})}):(0,G.jsxs)(`picture`,{children:[(0,G.jsx)(`source`,{srcSet:`${e}&theme=dark`,media:`(prefers-color-scheme: dark)`}),(0,G.jsx)(`img`,{src:e,alt:``,loading:`lazy`,draggable:!1,onError:()=>r(!0),className:`absolute inset-0 size-full object-contain`})]})}function JD(e){let t=(0,W.useRef)(new Set),n=(0,W.useRef)(new Map),[,r]=(0,W.useState)(0),i=Date.now();for(let r of e)r.busy?(t.current.add(r.id),n.current.delete(r.id)):t.current.delete(r.id)&&n.current.set(r.id,i+yD);let a=new Set;for(let t of e){if(a.size===vD)break;(t.busy||(n.current.get(t.id)??0)>i)&&a.add(t.id)}let o=Math.min(...[...a].map(e=>n.current.get(e)??0).filter(e=>e>i));return(0,W.useEffect)(()=>{if(!Number.isFinite(o))return;let e=setTimeout(()=>r(e=>e+1),o-Date.now()+50);return()=>clearTimeout(e)},[o]),a}var YD=window.matchMedia(`(prefers-color-scheme: dark)`);function XD(){let[e,t]=(0,W.useState)(YD.matches);return(0,W.useEffect)(()=>{let e=()=>t(YD.matches);return YD.addEventListener(`change`,e),()=>YD.removeEventListener(`change`,e)},[]),e?`dark`:`light`}function ZD({file:e}){let t=XD(),[n,r]=(0,W.useState)(null);return(0,W.useEffect)(()=>{let t=new sS(`${window.location.origin}${e.base}`,e.key,{watch:!0});return r(t),()=>t.close()},[e.base,e.key]),n?(0,G.jsx)(QD,{source:n,scheme:t}):null}function QD({source:e,scheme:t}){let{doc:n}=TC(e),r=(0,W.useMemo)(()=>n&&Fe(n,t),[n,t]),i=(0,W.useRef)(null),[a,o]=(0,W.useState)(null),s=r?Number.parseFloat(r.root.style.width):0,c=r?Number.parseFloat(r.root.style.height):0;return(0,W.useEffect)(()=>{let e=i.current;if(!e||!s||!c)return;let t=()=>o(Math.min(e.clientWidth/s,e.clientHeight/c));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,c]),(0,G.jsx)(`div`,{ref:i,inert:!0,"aria-hidden":!0,className:YT(`pointer-events-none absolute inset-0 grid place-items-center overflow-hidden transition-opacity duration-300`,r&&a?`opacity-100`:`opacity-0`),children:r&&(0,G.jsx)(`div`,{style:{width:s*(a??0),height:c*(a??0)},children:(0,G.jsx)(`div`,{style:{width:s,height:c,transform:`scale(${a??0})`,transformOrigin:`0 0`},children:(0,G.jsx)(Wr,{artboard:r,tokens:n.tokens,assetBase:e.assetBase,colorScheme:t})})})})}var $D={includeMatches:!0,ignoreLocation:!0,threshold:.32,minMatchCharLength:2};function eO({query:e,cards:t,onOpen:n,onShelve:r,live:i,seen:a}){let o=(0,W.useMemo)(()=>new JT(t,{...$D,keys:[{name:`file.name`,weight:3},{name:`file.key`,weight:.5}]}),[t]),s=(0,W.useMemo)(()=>t.flatMap(({file:e})=>e.artboards.map(t=>({file:e,artboard:t,page:e.pages.find(e=>e.id===t.page)?.name}))),[t]),c=(0,W.useMemo)(()=>new JT(s,{...$D,keys:[{name:`artboard.name`,weight:3},{name:`page`,weight:1}]}),[s]),l=o.search(e,{limit:24}),u=c.search(e,{limit:30});return!l.length&&!u.length?(0,G.jsxs)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:[`Nothing matches “`,e,`”.`]}):(0,G.jsxs)(G.Fragment,{children:[l.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zD,{left:`Files`}),(0,G.jsx)(BD,{children:l.map(({item:e,matches:t})=>(0,G.jsx)(VD,{card:e,onOpen:n,onShelve:r,live:i.has(e.file.id),unseen:pD(a,e.file),match:nO(t,`file.name`),pathMatch:nO(t,`file.name`)?void 0:nO(t,`file.key`)},e.file.id))})]}),u.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zD,{left:`Frames`}),(0,G.jsx)(BD,{columns:3,children:u.map(({item:e,matches:t})=>(0,G.jsx)(tO,{hit:e,match:nO(t,`artboard.name`),pageMatch:nO(t,`page`),onOpen:n},`${e.file.id}:${e.artboard.id}`))})]})]})}function tO({hit:e,match:t,pageMatch:n,onOpen:r}){let[i,a]=(0,W.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,className:`group flex min-w-0 flex-col gap-2.5 text-left`,onClick:()=>r({key:e.file.key,base:e.file.base}),children:[(0,G.jsx)(`div`,{className:`grid h-[200px] place-items-center overflow-hidden rounded-xl bg-preview p-5 shadow-[0_0_0_1px_var(--hairline)] transition-shadow group-hover:shadow-[0_0_0_1px_var(--hairline-strong),0_4px_14px_rgba(0,0,0,0.06)]`,children:i?(0,G.jsx)(q,{name:`board`,size:28,strokeWidth:1.3,className:`text-faint`}):(0,G.jsx)(`img`,{src:e.artboard.thumb,alt:``,loading:`lazy`,draggable:!1,onError:()=>a(!0),className:`block max-h-[160px] max-w-full object-contain shadow-[0_0_0_1px_rgba(0,0,0,0.06),0_2px_6px_rgba(0,0,0,0.06)] dark:shadow-[0_0_0_1px_rgba(255,255,255,0.08)]`})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[13.5px]`,children:(0,G.jsx)(rO,{text:e.artboard.name,ranges:t})}),(0,G.jsx)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,children:(0,G.jsxs)(`span`,{className:`truncate`,children:[e.page?(0,G.jsx)(rO,{text:e.page,ranges:n}):`Artboard`,` in`,` `,e.file.name]})})]})]})}function nO(e,t){return e?.find(e=>e.key===t)?.indices}function rO({text:e,ranges:t}){let n=(t??[]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]);if(!n.length)return(0,G.jsx)(G.Fragment,{children:e});let r=[],i=0;for(let[t,a]of n)t<i||(r.push(e.slice(i,t)),r.push((0,G.jsx)(`mark`,{className:`rounded-[2px] bg-highlight text-inherit`,children:e.slice(t,a+1)},t)),i=a+1);return r.push(e.slice(i)),(0,G.jsx)(G.Fragment,{children:r})}var iO=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(iO||{}),aO=[0,1],oO=[1,0],sO=[2,3],cO=[3,2],lO={L:aO,M:oO,Q:sO,H:cO},uO=/^\d*$/,dO=/^[A-Z0-9 $%*+./:-]*$/,fO=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,pO=1,mO=40,hO=3,gO=3,_O=40,vO=10,yO=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],bO=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],xO=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<pO||e>mO)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,iO.Timing),this.setFunctionModule(e,6,e%2==0,iO.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,CO(r,e));this.setFunctionModule(8,7,CO(r,6)),this.setFunctionModule(8,8,CO(r,7)),this.setFunctionModule(7,8,CO(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,CO(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,CO(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,CO(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=CO(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,iO.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,iO.Alignment)}setFunctionModule(e,t,n,r=iO.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==RO(t,n))throw RangeError(`Invalid argument`);let r=bO[n[0]][t],i=yO[n[0]][t],a=Math.floor(LO(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=zO(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=BO(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(LO(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=CO(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=hO:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*_O),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*_O}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=hO:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*_O),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*_O}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=gO)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*vO,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function SO(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function CO(e,t){return!!(e>>>t&1)}var wO=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},TO=[1,10,12,14],EO=[2,9,11,13],DO=[4,8,16,16];function OO(e,t){return e[Math.floor((t+7)/17)+1]}function kO(e){let t=[];for(let n of e)SO(n,8,t);return new wO(DO,e.length,t)}function AO(e){if(!NO(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);SO(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new wO(TO,e.length,t)}function jO(e){if(!PO(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=fO.indexOf(e.charAt(n))*45;r+=fO.indexOf(e.charAt(n+1)),SO(r,11,t)}return n<e.length&&SO(fO.indexOf(e.charAt(n)),6,t),new wO(EO,e.length,t)}function MO(e){return e===``?[]:NO(e)?[AO(e)]:PO(e)?[jO(e)]:[kO(IO(e))]}function NO(e){return uO.test(e)}function PO(e){return dO.test(e)}function FO(e,t){let n=0;for(let r of e){let e=OO(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function IO(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function LO(e){if(e<pO||e>mO)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function RO(e,t){return Math.floor(LO(e)/8)-yO[t[0]][e]*bO[t[0]][e]}function zO(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=VO(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=VO(n,2)}return t}function BO(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=VO(t,e))}return n}function VO(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function HO(e,t,n=1,r=40,i=-1,a=!0){if(!(pO<=n&&n<=r&&r<=mO)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=RO(o,t)*8,i=FO(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[oO,sO,cO])a&&s<=RO(o,e)*8&&(t=e);let c=[];for(let t of e){SO(t.mode[0],4,c),SO(t.numChars,OO(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=RO(o,t)*8;SO(0,Math.min(4,l-c.length),c),SO(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)SO(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new xO(o,t,u,i)}function UO(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?MO(e):Array.isArray(e)?[kO(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=HO(c,lO[n],i,a,o,r),u=WO({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function WO(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=iO.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}var GO=e=>`ponzu://pair?host=${encodeURIComponent(e)}&v=1`;function KO(e){let{data:t,size:n}=UO(e,{ecc:`M`,border:0}),r=``;return t.forEach((e,t)=>{for(let i=0;i<n;){if(!e[i]){i++;continue}let n=1;for(;e[i+n];)n++;r+=`M${i} ${t}h${n}v1h-${n}z`,i+=n}}),{size:n,d:r}}function qO(){let[e,t]=(0,W.useState)(()=>new URLSearchParams(location.search).has(`pair`)),[n,r]=(0,W.useState)(null);(0,W.useEffect)(()=>window.ponzuDesktop?.onPairIphone?.(()=>t(!0)),[]);let i=e=>{if(t(e),e)return;let n=new URL(location.href);n.searchParams.has(`pair`)&&(n.searchParams.delete(`pair`),history.replaceState(null,``,n))};return(0,W.useEffect)(()=>{if(!e)return;let t=!1,n;r(null);let a=async()=>{try{let e=await(await fetch(`/api/info`)).json();if(t)return;r({name:e.machine?.name??null,dns:e.machine?.dns??null});let a=e.pairedAt??0;n===void 0?n=a:a>n&&i(!1)}catch{}};a();let o=setInterval(a,2e3);return()=>{t=!0,clearInterval(o)}},[e]),(0,G.jsx)(dE,{open:e,onOpenChange:i,children:(0,G.jsx)(mE,{className:`gap-[22px] rounded-[18px] p-8 shadow-[0_1px_2px_rgba(0,0,0,0.06),0_18px_50px_rgba(0,0,0,0.2),0_0_0_0.5px_rgba(0,0,0,0.12)] sm:max-w-[520px]`,children:(0,G.jsx)(JO,{machine:n})})})}function JO({machine:e}){let t=e?.dns;return(0,G.jsxs)(`div`,{className:`flex items-center gap-6`,children:[t?(0,G.jsx)(YO,{text:GO(t)}):(0,G.jsx)(`div`,{className:`ghost size-[176px] shrink-0 rounded-[14px]`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(gE,{className:`font-bold font-display text-2xl leading-[1.15] tracking-[-0.02em]`,children:`Pair your iPhone`}),(0,G.jsx)(_E,{className:`m-0 text-sm leading-normal`,children:t||!e?`Open Ponzu on your iPhone and scan this code. Both need Tailscale, signed in to the same account.`:e.name?`Turn on MagicDNS for your tailnet to pair an iPhone. The phone finds this Mac by its tailnet name.`:`Turn on Tailscale on this Mac to pair an iPhone.`})]})]})}function YO({text:e}){let{size:t,d:n}=KO(e);return(0,G.jsx)(`div`,{className:`size-[176px] shrink-0 rounded-[14px] bg-white p-3 shadow-[0_0_0_1px_rgba(17,17,16,0.1)]`,children:(0,G.jsx)(`svg`,{role:`img`,"aria-label":`Pairing code`,"data-pair":e,viewBox:`0 0 ${t} ${t}`,className:`block size-full`,shapeRendering:`crispEdges`,children:(0,G.jsx)(`path`,{d:n,fill:`#111110`})})})}function XO(e){return(0,G.jsx)(X_,{"data-slot":`hover-card`,...e})}function ZO(e){return(0,G.jsx)(Q_,{"data-slot":`hover-card-trigger`,...e})}function QO({className:e,align:t=`end`,sideOffset:n=6,...r}){return(0,G.jsx)(nv,{"data-slot":`hover-card-portal`,children:(0,G.jsx)(iv,{"data-slot":`hover-card-content`,align:t,sideOffset:n,className:YT(`z-50 w-[272px] rounded-xl bg-popover p-3.5 text-popover-foreground shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...r})})}var $O=gv,ek=vv;function tk({className:e,align:t=`end`,sideOffset:n=6,...r}){return(0,G.jsx)(Sv,{children:(0,G.jsx)(wv,{"data-slot":`popover-content`,align:t,sideOffset:n,className:YT(`z-50 rounded-xl bg-popover p-4 text-popover-foreground shadow-[0_0_0_0.5px_var(--hairline-strong),0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...r})})}function nk({machines:e,origin:t}){let n=Ve(e??[]),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(!1),c=!!n?.installing;(0,W.useEffect)(()=>{n&&r&&r!==n.version?i(null):r&&c?s.current=!0:r&&s.current&&!c&&i(null)},[n,r,c]);let l=rk(n,t);if(!n)return null;let u=n.installing||r===n.version,d=async()=>{s.current=!1,i(n.version);try{let e=await fetch(`${t}/api/update`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({macs:n.macs,version:n.version})}),r=e.ok?await e.json():null;Object.values(r?.macs??{}).some(Boolean)||i(null)}catch{}};return(0,G.jsxs)($O,{open:a,onOpenChange:o,children:[(0,G.jsx)(ek,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":u?`Updating to Ponzu ${n.version}`:`Ponzu ${n.version} is ready`,className:`app-no-drag grid size-7 shrink-0 place-items-center rounded-full bg-flesh text-[#0e0e0e] outline-none transition-[filter] hover:brightness-95 focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:u?(0,G.jsx)(q,{name:`loading`,size:15,strokeWidth:2,className:`animate-spin`}):(0,G.jsx)(`svg`,{"aria-hidden":!0,width:15,height:15,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.4,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})})})}),(0,G.jsx)(tk,{className:`w-[320px]`,children:(0,G.jsx)(ik,{plan:l?{...n,notes:l}:n,machines:e??[],updating:u,onUpdate:d,onLater:()=>o(!1)})})]})}function rk(e,t){let n=e&&!e.notes.length?`since=${e.since}&version=${e.version}`:null,[r,i]=(0,W.useState)(null);return(0,W.useEffect)(()=>{if(!n)return;let e=!0;return fetch(`${t}/api/update/notes?${n}`).then(e=>e.ok?e.json():null).then(t=>{e&&t?.notes&&i({want:n,notes:t.notes})}).catch(()=>{}),()=>{e=!1}},[n,t]),n&&r?.want===n?r.notes:null}function ik({plan:e,machines:t=[],updating:n,onUpdate:r,onLater:i}){let a=t.find(e=>e.id===`local`)?.update?.waitsFor;return n?(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-[14px] leading-5`,children:[`Updating to `,e.version]}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted-foreground leading-[17px]`,children:a?`Ponzu restarts once ${sk(a)} finishes, and reopens your tabs.`:`Ponzu restarts in a moment and reopens your tabs. Agents reconnect on their own.`})]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-[14px] leading-5`,children:[`Ponzu `,e.version]}),e.notes.length>0&&(0,G.jsx)(`ul`,{className:`flex max-h-[min(320px,50vh)] list-disc flex-col gap-1.5 overflow-y-auto pl-[18px] leading-[19px] marker:text-muted-foreground`,children:e.notes.map(e=>(0,G.jsx)(`li`,{children:e},e))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.macs.length>1&&(0,G.jsx)(ak,{plan:e,machines:t}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(uE,{variant:`outline`,size:`sm`,onClick:i,children:`Later`}),(0,G.jsxs)(uE,{size:`sm`,onClick:r,className:`gap-1.5 pl-2`,children:[(0,G.jsx)(q,{name:`refresh`,size:14,strokeWidth:1.9}),`Restart`]})]})]})}function ak({plan:e,machines:t}){let n=e.macs.flatMap(e=>t.find(t=>t.id===e)??[]),r=e.macs.length===e.of?`On all ${e.of} of your Macs`:`On ${e.macs.length} of your Macs`,i=n.map(e=>[e.name,e.update?.version,ok(e)].filter(Boolean).join(`, `)).join(`; `);return(0,G.jsxs)(XO,{openDelay:150,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"aria-label":i?`${r}: ${i}`:r,className:`-ml-1.5 inline-flex h-6 cursor-default items-center gap-[5px] whitespace-nowrap rounded-md px-1.5 text-[12px] text-muted-foreground tabular-nums outline-none hover:bg-secondary hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,G.jsx)(q,{name:`laptop`,size:13}),e.macs.length]})}),(0,G.jsx)(QO,{align:`start`,side:`bottom`,className:`w-[248px] p-1.5`,children:(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[12.5px]`,children:n.map(e=>(0,G.jsxs)(`li`,{className:`flex items-baseline gap-2 px-2 py-1.5`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,(0,G.jsxs)(`span`,{className:`text-faint`,children:[` · `,ok(e)]})]}),(0,G.jsx)(`span`,{className:`text-faint tabular-nums`,children:e.update?.version})]},e.id))})})]})}function ok(e){return e.update?.waitsFor?`after ${sk(e.update.waitsFor)} finishes`:e.id===`local`?`restarts last`:`now`}function sk(e){return e===`claude`?`Claude`:e===`openai`?`Codex`:e===`cursor`?`Cursor`:`your agent`}function ck(e,t){let n=null,r=0,i=0,a,o=!1,s=`${e.replace(/^http/,`ws`)}/api/catalog/stream`,c=()=>{let l=!1,u=new WebSocket(s);n=u,u.onopen=()=>{l=!0,i=0},u.onmessage=e=>{let n;try{n=JSON.parse(String(e.data))}catch{return}n.t===`snapshot`?(r++,t(()=>n.catalog)):n.t===`patch`&&t(e=>e&&C(e,n.patch))},u.onclose=()=>{if(!o){if(!l){let n=r;fetch(`${e}/api/catalog`).then(e=>e.ok?e.json():null).then(e=>!o&&e&&r===n&&t(()=>e)).catch(()=>{})}a=setTimeout(c,Math.min(5e3,250*2**i++))}}};return c(),()=>{o=!0,clearTimeout(a),n?.close()}}var lk=window.location.origin,uk=navigator.userAgent.includes(`Mac`),dk=uk?`⌘`:`Ctrl`,fk=({key:e,base:t})=>t?`${t}\n${e}`:e,pk=e=>{let t=e.indexOf(`
|
|
2383
|
-
`);return t<0?{key:e,base:``}:{base:e.slice(0,t),key:e.slice(t+1)}},mk=window.matchMedia(`(prefers-color-scheme: dark)`);function hk(){let[e,t]=(0,W.useState)(mk.matches?`dark`:`light`);return(0,W.useEffect)(()=>{let e=()=>t(mk.matches?`dark`:`light`);return mk.addEventListener(`change`,e),()=>mk.removeEventListener(`change`,e)},[]),(0,W.useEffect)(()=>{document.documentElement.dataset.theme=e},[e]),e}function gk(){let e=hk(),[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(()=>{let e=new URLSearchParams(location.search).get(`file`),t=JSON.parse(localStorage.getItem(`ponzu.tabs`)??`[]`);return e?[...new Set([...t,e])]:t}),[a,o]=(0,W.useState)(()=>new URLSearchParams(location.search).get(`file`)),[s,c]=(0,W.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`file`),n=e.get(`page`)??void 0,r=e.get(`artboard`)??void 0;return t&&(n||r)?{file:t,at:{page:n,artboard:r}}:null}),l=(0,W.useMemo)(()=>new Map,[]),u=e=>{let t=l.get(e);if(!t){let{key:n,base:r}=pk(e);t=new sS(`${lk}${r}`,n),l.set(e,t)}return t};(0,W.useEffect)(()=>ck(lk,n),[]);let[d,f]=(0,W.useState)(uD),p=a?XT(t,pk(a))?.id:void 0;(0,W.useEffect)(()=>{if(!t)return;let e=fD(d,t.files,p);e!==d&&(dD(e),f(e))},[t,p]);let[m]=(0,W.useState)(()=>new Set),[h,g]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(t)for(let e of t.files)e.machine===`local`&&e.created&&!m.has(e.key)&&(m.add(e.key),!(e.shelf&&e.shelf!==`recent`)&&(Date.now()-e.created>6e4||r.includes(e.key)||(i(t=>t.includes(e.key)?t:[...t,e.key]),g(e.key))))},[t]),(0,W.useEffect)(()=>{localStorage.setItem(`ponzu.tabs`,JSON.stringify(r));let e=new URL(location.href);a?e.searchParams.set(`file`,a):e.searchParams.delete(`file`),s&&a!==s.file&&(c(null),e.searchParams.delete(`page`),e.searchParams.delete(`artboard`)),history.replaceState(null,``,e)},[r,a]);let _=async(e,t)=>{let r=await fetch(`${lk}${e.base}/api/shelf`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e.key,action:b(e,t)})});if(!r.ok)throw Error(r.status===502?`That Mac isn’t answering. Try again once it’s back.`:await r.text());n(n=>n&&{...n,files:n.files.map(n=>n.id===e.id?{...n,shelf:t===`archive`?`archived`:`recent`,archivedFor:t===`archive`?`person`:void 0}:n)})},v=async e=>{e.base||await fetch(`${lk}/api/files`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e.key,by:`person`})});let t=fk(e);i(e=>e.includes(t)?e:[...e,t]),o(t)},y=e=>{l.get(e)?.close(),l.delete(e);let t=r.indexOf(e);i(t=>t.filter(t=>t!==e)),a===e&&o(r[t+1]??r[t-1]??null)};(0,W.useEffect)(()=>window.ponzuDesktop?.onCloseTab?.(()=>{a?y(a):window.ponzuDesktop?.closeWindow?.()}),[r,a]),(0,W.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let t=e.shiftKey&&{BracketLeft:-1,BracketRight:1}[e.code];if(t){e.preventDefault();let n=[null,...r],i=n.indexOf(a);o(n[(i+t+n.length)%n.length]??null);return}let n=/^Digit([0-9])$/.exec(e.code)?.[1];if(!n||e.shiftKey)return;if(n===`0`){e.preventDefault(),o(null);return}let i=n===`9`?r.at(-1):r[Number(n)-1];i&&(e.preventDefault(),o(i))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,a]);let{strip:x,dragProps:S}=yk(r,i);xk(x,r),(0,W.useEffect)(()=>{let e=x.current;h&&e&&e.scrollTo({left:e.scrollWidth,behavior:`smooth`})},[h]);let C=LC(uk?`Meta`:`Control`),w=window.ponzuDesktop,T=w?.platform===`darwin`,E=w?.platform===`win32`;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-background text-foreground`,children:[(0,G.jsxs)(`header`,{className:YT(`flex h-10 shrink-0 items-center gap-1 px-2`,w&&`app-drag [&_button]:app-no-drag`,T&&`pl-[88px]`,E&&`pr-[calc(100vw-env(titlebar-area-x,0px)-env(titlebar-area-width,100vw)+8px)]`),children:[(0,G.jsx)(uE,{variant:`ghost`,size:`icon`,"aria-label":`Home`,className:YT(`w-8`,a===null&&`bg-secondary text-foreground hover:bg-secondary`),onClick:()=>o(null),children:(0,G.jsx)(yx,{modifier:dk,n:0,shown:C,center:!0,children:(0,G.jsx)(Dc,{size:18,color:`currentColor`})})}),(0,G.jsx)(`div`,{ref:x,className:`relative flex min-w-0 gap-0.5 overflow-x-auto [mask-image:linear-gradient(to_right,transparent,#000_var(--fade-start,0px),#000_calc(100%_-_var(--fade-end,0px)),transparent)] [scrollbar-width:none]`,children:r.map((e,n)=>(0,G.jsx)(_k,{source:u(e),file:XT(t,pk(e)),machines:t?.machines,shortcut:n<8?n+1:n===r.length-1?9:void 0,showShortcut:C,active:e===a,onClick:()=>o(e),onClose:()=>y(e),...S(e)},e))}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,G.jsx)(nk,{machines:t?.machines,origin:lk}),a&&(0,G.jsx)(Sk,{source:u(a)})]})]}),(0,G.jsx)(`main`,{className:`min-h-0 flex-1 px-2 pb-2`,children:a?(0,G.jsx)(`div`,{className:`h-full overflow-hidden rounded-xl bg-canvas`,children:(0,G.jsx)(tw,{source:u(a),theme:e,me:{kind:`user`,name:`You`},link:a===s?.file?s.at:void 0})},a):(0,G.jsx)(bD,{catalog:t,seen:d,onOpen:e=>void v(e),onShelve:_,onOpenFolder:w&&(async()=>{let e=await w.openFolder();e&&await v({key:e,base:``})}),onNew:w&&(async()=>{let e=await w.newFile();e&&await v({key:e,base:``})})})}),(0,G.jsx)(qO,{})]})}function _k({source:e,file:t,machines:n,shortcut:r,showShortcut:i,active:a,onClick:o,onClose:s,...c}){let l=TC(e),u=l.presence.some(e=>v(e,l.path)===`working`),d=l.status===`offline`,f=HC(!l.doc||d),[p,m]=(0,W.useState)(!1),h=l.doc?.name??e.file.split(`/`).pop()?.replace(/\.design$/,``),g=(0,G.jsxs)(`div`,{className:YT(`group app-no-drag relative flex h-7 max-w-[220px] shrink-0 cursor-default select-none items-center whitespace-nowrap rounded-lg px-2.5 outline-none`,a?`bg-secondary text-foreground`:`text-muted-foreground hover:bg-accent hover:text-foreground`),onClick:o,onKeyDown:e=>e.key===`Enter`&&o(),role:`tab`,tabIndex:0,...c,onPointerDown:e=>{m(!0),c.onPointerDown(e)},onPointerLeave:()=>m(!1),children:[(0,G.jsxs)(`span`,{className:`-ml-1.5 flex min-w-0 items-center gap-[7px] pl-1.5 group-focus-visible:[mask-image:linear-gradient(to_left,transparent_14px,#000_32px)] group-hover:[mask-image:linear-gradient(to_left,transparent_14px,#000_32px)]`,children:[(0,G.jsx)(yx,{modifier:dk,n:r,shown:i,index:r,children:f?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center`,title:d?`Reconnecting`:`Opening`,children:(0,G.jsx)(`span`,{className:YT(`size-3 animate-spin rounded-full border-[1.5px] border-current border-r-transparent text-faint motion-reduce:animate-none`,d&&`[animation-duration:2s]`)})}):(0,G.jsx)(q,{name:l.doc?.icon??`blank`,size:14})}),(0,G.jsx)(`span`,{className:YT(`truncate`,u&&`pz-shimmer`),children:h})]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Close tab`,className:`absolute top-1/2 right-1 grid size-[18px] -translate-y-1/2 place-items-center rounded-[5px] opacity-0 hover:bg-accent hover:opacity-100! group-focus-visible:opacity-60 group-hover:opacity-60`,onClick:e=>{e.stopPropagation(),s()},children:(0,G.jsx)(q,{name:`close`,size:12})})]});return(0,G.jsxs)(XO,{open:!p&&void 0,openDelay:600,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,onFocus:e=>{e.currentTarget.matches(`:focus-visible`)||e.preventDefault()},children:g}),(0,G.jsx)(QO,{align:`start`,side:`bottom`,children:(0,G.jsx)(rE,{file:t,name:h,machine:n?.find(e=>e.id===(t?.machine??`local`))})})]})}var vk={duration:150,easing:`ease-out`};function yk(e,t){let n=(0,W.useRef)(null),r=(0,W.useRef)(e);r.current=e;let i=(0,W.useRef)(null),a=(0,W.useRef)(new Map),o=()=>{let e=i.current,t=n.current;if(!e||!t)return;let r=t.getBoundingClientRect().left-t.scrollLeft+e.el.offsetLeft;e.dx=Math.min(Math.max(e.x-e.grab-r,-e.el.offsetLeft),t.scrollWidth-e.el.offsetLeft-e.el.offsetWidth),e.el.style.transform=`translateX(${e.dx}px)`};return(0,W.useLayoutEffect)(()=>{for(let[e,t]of a.current){for(let t of e.getAnimations())t.cancel();let n=t-e.getBoundingClientRect().left;n&&e.animate([{transform:`translateX(${n}px)`},{transform:`none`}],vk)}a.current.clear(),o()},[e]),{strip:n,dragProps:e=>({onPointerDown:s=>{if(s.button!==0||s.target.closest(`button`))return;let c=s.currentTarget,l=s.clientX-c.getBoundingClientRect().left,u=u=>{let d=n.current;if(!d)return;if(!i.current){if(Math.abs(u.clientX-s.clientX)<4)return;i.current={el:c,grab:l,x:u.clientX,dx:0},c.style.zIndex=`1`}let f=i.current;f.x=u.clientX,o();let p=[...d.children].filter(e=>e instanceof HTMLElement&&e!==c),m=d.getBoundingClientRect().left-d.scrollLeft,h=f.x-f.grab-m+c.offsetWidth/2,g=p.filter(e=>e.offsetLeft+e.offsetWidth/2<h).length,_=r.current;if(g===_.indexOf(e))return;for(let e of p)a.current.set(e,e.getBoundingClientRect().left);let v=_.filter(t=>t!==e);v.splice(g,0,e),t(v)},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d);let e=i.current;i.current=null,e&&(c.style.transform=``,c.animate([{transform:`translateX(${e.dx}px)`},{transform:`none`}],vk).finished.then(()=>{c.style.zIndex=``}).catch(()=>{}))};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}})}}var bk=32;function xk(e,t){(0,W.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{let e=Math.min(bk,t.clientWidth/4),n=t.scrollWidth-t.clientWidth-t.scrollLeft;t.style.setProperty(`--fade-start`,`${Math.min(Math.max(t.scrollLeft,0),e)}px`),t.style.setProperty(`--fade-end`,`${Math.min(Math.max(n,0),e)}px`)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(n);r.observe(t);for(let e of t.children)r.observe(e);return()=>{t.removeEventListener(`scroll`,n),r.disconnect()}},[e,t])}function Sk({source:e}){let{presence:t,path:n,doc:r}=TC(e),i=Tk(15e3),a=t.map(e=>({p:e,activity:v(e,n,i)})).filter(e=>e.activity);return a.length?(0,G.jsx)(`div`,{className:`flex gap-0.5 pr-1`,children:a.map(({p:e,activity:t})=>(0,G.jsxs)(XO,{openDelay:150,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,children:(0,G.jsx)(`span`,{className:YT(`app-no-drag grid size-6 cursor-default place-items-center rounded-md transition-opacity duration-200 hover:bg-accent`,t===`watching`&&`opacity-50`),children:(0,G.jsx)(Oc,{client:e.client,size:16})})}),(0,G.jsx)(QO,{children:(0,G.jsx)(Ck,{presence:e,activity:t,doc:r})})]},e.id))}):null}function Ck({presence:e,activity:t,doc:n}){let r=wk(e),i=n?e.working.map(e=>F(n,e)?.artboard.name).filter(Boolean):[],a=[];return e.origin?.cwd&&a.push([`Project`,(0,G.jsx)(`span`,{className:YT(Ek,`truncate`),title:e.origin.cwd,children:ZT(e.origin.cwd)},`cwd`)]),a.push([`Via`,e.origin?.via===`bridge`?(0,G.jsxs)(`span`,{children:[`Terminal · `,(0,G.jsx)(`span`,{className:Ek,children:`ponzu mcp`})]},`via`):`MCP over HTTP`]),a.push([`Since`,`${Ax(e.since)}${Ax(e.since)===`now`?``:` ago`}`]),i.length&&a.push([`On`,i.join(`, `)]),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-canvas`,children:(0,G.jsx)(Oc,{client:e.client,size:16})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`b`,{className:`font-semibold`,children:r}),(0,G.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:t===`working`?`Working${e.status?` · ${e.status}`:``}`:`Watching for your comments`})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[56px_minmax(0,1fr)] gap-x-2.5 gap-y-1.5 border-t pt-2.5 text-xs`,children:a.map(([e,t])=>(0,G.jsxs)(W.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`flex min-w-0`,children:t})]},e))})]})}function wk(e){let t=e.origin?.clientName,n=t?{"claude-code":`Claude Code`,"claude-ai":`Claude`,codex:`Codex`,"codex-mcp-client":`Codex`,cursor:`Cursor`,"cursor-vscode":`Cursor`}[t]??t:e.name;return e.origin?.clientVersion?`${n} ${e.origin.clientVersion}`:n}function Tk(e){let[t,n]=(0,W.useState)(Date.now);return(0,W.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Ek=`font-mono text-xs`,Dk=document.getElementById(`root`);(0,g.createRoot)(Dk).render((0,G.jsx)(gk,{}));
|
|
2382
|
+
`)})}function aw({x:e,y:t,w:n,h:r,leaving:i=!1,dim:a=!1,delay:o=0}){let[s]=(0,W.useState)(o);return(0,G.jsx)(`div`,{className:`pz:pointer-events-none pz:absolute pz:transition-opacity pz:duration-500`,style:{..._w({x:e,y:t,w:n,h:r}),opacity:i||a?0:1},"aria-hidden":!0,children:(0,G.jsx)(`div`,{className:`pz-ring pz:absolute pz:inset-0`,style:{borderRadius:8,animationDelay:`${s}ms`}})})}function ow({x:e,y:t,w:n,h:r,at:i}){let a=(0,W.useRef)(null);return(0,W.useLayoutEffect)(()=>{a.current&&yi(a.current,i)},[i]),(0,G.jsx)(`svg`,{className:`pz:pointer-events-none pz:absolute pz:overflow-visible pz:text-[var(--pz-rind)]`,style:_w({x:e,y:t,w:n,h:r}),"aria-hidden":!0,children:(0,G.jsx)(`rect`,{ref:a,x:1,y:1,style:{width:`calc(100% - 2px)`,height:`calc(100% - 2px)`},rx:8,pathLength:100,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeDasharray:`100 100`,strokeDashoffset:100})})}var sw=`pz:pointer-events-auto pz:absolute pz:size-0`,cw=`pz:absolute pz:top-0 pz:left-0 pz:grid pz:size-6 pz:-translate-1/2 pz:place-items-center pz:rounded-full pz:font-semibold pz:text-[11px] pz:tabular-nums pz:shadow-[0_0_0_1px_rgba(17,17,16,0.18),0_1px_3px_rgba(0,0,0,0.25)] pz:transition-transform pz:duration-[120ms] pz:hover:scale-112`,lw=`pz:cursor-grabbing pz:shadow-[0_0_0_1px_rgba(17,17,16,0.18),0_4px_12px_rgba(0,0,0,0.25)]`,uw=`pz:bg-comment-soft pz:text-foreground pz:shadow-[0_0_0_1.5px_var(--pz-comment),0_1px_3px_rgba(0,0,0,0.2)]`;function dw({name:e,shortcut:t,showShortcut:n,icon:r,active:i,working:a,onClick:o,onRename:s}){let[c,l]=(0,W.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,className:fx(`pz:inline-flex pz:h-7 pz:shrink-0 pz:items-center pz:gap-1.5 pz:whitespace-nowrap pz:rounded-lg pz:px-2.5`,i?`pz:bg-raised pz:text-foreground pz:shadow-raised`:`pz:text-muted-foreground pz:hover:bg-accent pz:hover:text-foreground`),onClick:o,onDoubleClick:()=>s&&l(!0),children:[(0,G.jsx)(yx,{modifier:`⌥`,n:t,shown:n,index:t,children:(0,G.jsx)(q,{name:r&&r in xc?r:`board`,size:14})}),c?(0,G.jsx)(`input`,{autoFocus:!0,className:`pz:w-[9em] pz:bg-transparent pz:outline-0`,defaultValue:e,onClick:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e&&s?.(n),l(!1)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&l(!1),e.stopPropagation()}}):(0,G.jsx)(`span`,{className:fx(a&&`pz-shimmer`),children:e})]})}var fw=(0,W.memo)(function({artboard:e,dx:t,dy:n,h:r,tokens:i,source:a,colorScheme:o,zoom:s,scale:c,onScreen:l,moving:u,y0:d,y1:f,attention:p,cheap:m,skeleton:h,rankOf:g,arrivals:_,radius:v,hold:y}){let{w:b,h:x}=ew(e),S=(0,W.useCallback)(()=>g(e.id),[g,e.id]),C=vC(e,i,()=>Oe(e)),w=(0,W.useMemo)(()=>a.snapshotUrl&&((e,t)=>a.snapshotUrl(e,t,C,o)),[a,C,o]),T=(0,W.useMemo)(()=>a.loopsUrl&&(e=>a.loopsUrl(e,C,o)),[a,C,o]),E=d===void 0||f===void 0?void 0:{y0:d,y1:f};return(0,G.jsx)(`div`,{ref:t=>{let n=t?_.takeBoard(e.id):void 0;t&&n!==void 0&&_i(t,n)},className:`pz:absolute pz:shadow-board`,style:{left:e.x+t,top:e.y+n,width:b,height:x??void 0,borderRadius:v,"--pz-board-radius":`${v}px`},children:(0,G.jsx)(SC,{id:e.id,w:b,h:r,scale:s,onScreen:l,moving:u,attention:p,snapshotUrl:w,loopsUrl:T,cheap:m,rank:S,cost:tS(e).elements,skeleton:h,fill:rS(e),children:t=>(0,G.jsx)(Wr,{artboard:e,tokens:i,assetBase:a.assetBase,renditions:a.renditions,colorScheme:o,detail:{hidden:t,scale:c,moving:u,visible:E},arrivals:_,rounded:!0,hold:y})})})}),pw=(0,W.memo)(function({artboard:e,dx:t,dy:n,who:r,selected:i,renaming:a,covered:o,events:s,arrivedAt:c}){let l=o&&!r&&!a&&!i,u=(0,W.useRef)(null);return(0,W.useLayoutEffect)(()=>{u.current&&c!==void 0&&vi(u.current,c)},[c]),(0,G.jsx)(`div`,{className:`pz:absolute pz:h-0`,style:{left:hw(e.x+t),top:hw(e.y+n),width:hw(ew(e).w),visibility:l?`hidden`:void 0},children:(0,G.jsxs)(`div`,{className:fx(`pz:pointer-events-auto pz:absolute pz:top-[-22px] pz:left-0 pz:flex pz:cursor-default pz:items-center pz:gap-[0.5em] pz:whitespace-nowrap pz:text-[12px] pz:leading-[1.4]`,!a&&`pz:max-w-full`,r&&`pz:right-0`,i?`pz:text-select`:`pz:text-muted-foreground pz:hover:text-foreground`),onPointerDown:t=>s.down(t,e),onDoubleClick:()=>s.rename(e.id),children:[a?(0,G.jsx)(`input`,{autoFocus:!0,className:`pz:rounded-[3px] pz:bg-card pz:px-[0.3em] pz:text-[12px] pz:outline-1 pz:outline-select`,defaultValue:e.name,onPointerDown:e=>e.stopPropagation(),onBlur:t=>{let n=t.target.value.trim();n&&n!==e.name&&s.apply({op:`artboard.update`,id:e.id,name:n}),s.rename(null)},onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&s.rename(null)}}):(0,G.jsx)(`span`,{ref:u,"data-board-name":!0,className:`pz:min-w-0 pz:truncate`,title:e.name,children:e.name}),r&&(0,G.jsx)(iw,{who:r})]})})});function mw(e,t){let n=getComputedStyle(e),r=/auto|scroll/.test(n.overflowY)&&(t.deltaY>0&&e.scrollTop+e.clientHeight<e.scrollHeight||t.deltaY<0&&e.scrollTop>0),i=/auto|scroll/.test(n.overflowX)&&(t.deltaX>0&&e.scrollLeft+e.clientWidth<e.scrollWidth||t.deltaX<0&&e.scrollLeft>0);return r||i}function hw(e){return`calc(var(--z) * ${e}px)`}function gw(e){return{left:hw(e.x),top:hw(e.y),width:hw(e.w),height:hw(e.h)}}function _w(e){return{left:`calc(var(--z) * ${e.x}px - ${YC}px)`,top:`calc(var(--z) * ${e.y}px - ${YC}px)`,width:`calc(var(--z) * ${e.w}px + 8px)`,height:`calc(var(--z) * ${e.h}px + 8px)`}}function vw({camera:e}){return(0,G.jsxs)(G.Fragment,{children:[AC(e),`%`]})}function yw(e,t){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>{let r=e[n],i=t[n];return!!i&&r.artboardId===i.artboardId&&Math.abs(r.x-i.x)<.5&&Math.abs(r.y-i.y)<.5&&Math.abs(r.w-i.w)<.5&&Math.abs(r.h-i.h)<.5})}function bw(e,t,n){let{x:r,y:i}=e,a=t&&e.nodeId?n[e.nodeId]:void 0;return a&&a.artboardId===t?.id&&(r=Math.min(Math.max(r,a.x),a.x+a.w),i=Math.min(Math.max(i,a.y),a.y+a.h)),{x:(t?.x??0)+r,y:(t?.y??0)+i}}function xw(e,t,n){let r=e.querySelector(`[data-artboard-host="${CSS.escape(t.id)}"]`),i=r?.parentElement,a=r?.shadowRoot?.querySelector(`[data-id="${CSS.escape(n)}"]`);if(!i||!a)return null;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect(),c=o.width/ew(t).w;return c?{x:(s.left-o.left)/c,y:(s.top-o.top)/c,w:s.width/c,h:s.height/c}:null}function Sw(e,t,n,r,i){let a=[];for(let o of e){let e=t.find(e=>e.id===o),s=e?{x:0,y:0,w:ew(e).w,h:n(e)}:void 0;if(!s){let n=i[o];e=n&&t.find(e=>e.id===n.artboardId),s=n}if(!e||!s)continue;let c=r(e.id);a.push({id:o,x:e.x+(c?.dx??0)+s.x,y:e.y+(c?.dy??0)+s.y,w:s.w,h:s.h,artboard:e.id===o})}return a}function Cw(e){return Array.isArray?Array.isArray(e):Nw(e)===`[object Array]`}function ww(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function Tw(e){return e==null?``:ww(e)}function Ew(e){return typeof e==`string`}function Dw(e){return typeof e==`number`}function Ow(e){return e===!0||e===!1||Aw(e)&&Nw(e)==`[object Boolean]`}function kw(e){return typeof e==`object`}function Aw(e){return kw(e)&&e!==null}function jw(e){return e!=null}function Mw(e){return!e.trim().length}function Nw(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Pw=`Incorrect 'index' type`,Fw=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Iw=e=>`Invalid value for key ${e}`,Lw=e=>`Pattern length exceeds max of ${e}.`,Rw=e=>`Missing ${e} property in key`,zw=e=>`Property 'weight' in key '${e}' must be a positive integer`,Bw=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Vw=Object.prototype.hasOwnProperty,Hw=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Uw(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Uw(e){let t=null,n=null,r=null,i=1,a=null;if(Ew(e)||Cw(e))r=e,t=Ww(e),n=Gw(e);else{if(!Vw.call(e,`name`))throw Error(Rw(`name`));let o=e.name;if(r=o,Vw.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(zw(Gw(o)));t=Ww(o),n=Gw(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Ww(e){return Cw(e)?e:e.split(`.`)}function Gw(e){return Cw(e)?e.join(`.`):e}function Kw(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(jw(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!jw(s))return;if(a===t.length-1&&(Ew(s)||Dw(s)||Ow(s)||typeof s==`bigint`))n.push(o===void 0?Tw(s):{v:Tw(s),i:o});else if(Cw(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,Ew(t)?t.split(`.`):t,0),r?n:n[0]}var qw={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Jw={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Yw={location:0,threshold:.6,distance:100},Xw={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:Kw,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},$=Object.freeze({...Jw,...qw,...Yw,...Xw});function Zw(e){return e>=9&&e<=13||e===32||e===160}function Qw(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)Zw(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var $w=class{constructor({getFn:e=$.getFn,fieldNormWeight:t=$.fieldNormWeight}={}){this.norm=Qw(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(Ew(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(Fw);if(Ew(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(Fw);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!jw(e)||Mw(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(jw(i)){if(Cw(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(jw(n)){if(Ew(n)){if(!Mw(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(jw(n.v)){let t=Ew(n.v)?n.v:Tw(n.v);if(!Mw(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(Ew(i)&&!Mw(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function eT(e,t,{getFn:n=$.getFn,fieldNormWeight:r=$.fieldNormWeight}={}){let i=new $w({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Uw)),i.setSources(t),i.create(),i}function tT(e,{getFn:t=$.getFn,fieldNormWeight:n=$.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new $w({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function nT(e=[],t=$.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function rT(e,t,n,{location:r=$.location,distance:i=$.distance,threshold:a=$.threshold,findAllMatches:o=$.findAllMatches,minMatchCharLength:s=$.minMatchCharLength,includeMatches:c=$.includeMatches,ignoreLocation:l=$.ignoreLocation}={}){if(t.length>32)throw Error(Lw(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=nT(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function iT(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function aT(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var oT={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},sT=RegExp(`[`+Object.keys(oT).join(``)+`]`,`g`),cT=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(sT,e=>oT[e]):e=>e,lT=class{constructor(e,{location:t=$.location,threshold:n=$.threshold,distance:r=$.distance,includeMatches:i=$.includeMatches,findAllMatches:a=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,isCaseSensitive:s=$.isCaseSensitive,ignoreDiacritics:c=$.ignoreDiacritics,ignoreLocation:l=$.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?cT(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:iT(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?cT(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=rT(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=aT(u)),p}},uT=new Set([`fuzzy`,`include`]);function dT(e){return e.startsWith(`inverse`)}var fT=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new lT(e,{location:t.location??$.location,threshold:t.threshold??$.threshold,distance:t.distance??$.distance,includeMatches:t.includeMatches??$.includeMatches,findAllMatches:t.findAllMatches??$.findAllMatches,minMatchCharLength:t.minMatchCharLength??$.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??$.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??$.ignoreDiacritics,ignoreLocation:t.ignoreLocation??$.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],pT=fT.length,mT=`\0`,hT=`|`;function gT(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function _T(e,t){let n=e.match(t);return n?n[1]:null}function vT(e,t={}){return e.replace(/\\\|/g,mT).split(hT).map(e=>{let n=gT(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<pT;){let e=fT[o],n=_T(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<pT;){let e=fT[o],n=_T(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var yT=class{constructor(e,{isCaseSensitive:t=$.isCaseSensitive,ignoreDiacritics:n=$.ignoreDiacritics,includeMatches:r=$.includeMatches,minMatchCharLength:i=$.minMatchCharLength,ignoreLocation:a=$.ignoreLocation,findAllMatches:o=$.findAllMatches,location:s=$.location,threshold:c=$.threshold,distance:l=$.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?cT(e):e,this.pattern=e,this.query=vT(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?cT(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,dT(r.type)&&(c=!0),n&&(uT.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=aT(o)),e}}return{isMatch:!1,score:1}}},bT=[];function xT(...e){bT.push(...e)}function ST(e,t){for(let n=0,r=bT.length;n<r;n+=1){let r=bT[n];if(r.condition(e,t))return new r(e,t)}return new lT(e,t)}var CT={AND:`$and`,OR:`$or`},wT={PATH:`$path`,PATTERN:`$val`},TT=e=>!!(e[CT.AND]||e[CT.OR]),ET=e=>!!e[wT.PATH],DT=e=>!Cw(e)&&kw(e)&&!TT(e),OT=e=>({[CT.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function kT(e,t,{auto:n=!0}={}){let r=e=>{if(Ew(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=ST(e,t)),r}let i=Object.keys(e),a=ET(e);if(!a&&i.length>1&&!TT(e))return r(OT(e));if(DT(e)){let r=a?e[wT.PATH]:i[0],o=a?e[wT.PATTERN]:e[r];if(!Ew(o))throw Error(Iw(r));let s={keyId:Gw(r),pattern:o};return n&&(s.searcher=ST(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Cw(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return TT(e)||(e=OT(e)),r(e)}function AT(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function jT(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){e.forEach(e=>{e.score=AT(e.matches,{ignoreFieldNorm:t})})}var MT=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function NT(e){let t=[];return e.matches.forEach(e=>{if(!jw(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function PT(e,t,{includeMatches:n=$.includeMatches,includeScore:r=$.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=NT(e)),r&&(a.score=e.score),a})}var FT=/[\p{L}\p{M}\p{N}_]+/gu,IT=new WeakSet;function LT(e){IT.has(e)||(IT.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function RT(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||LT(e),t=>t.match(e)||[]):e=>e.match(FT)||[]}function zT({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=RT(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=cT(n)),r(n)}}}var BT=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=zT({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new lT(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=aT(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function VT(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function HT(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)VT(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)VT(e,t.v,i,r);else VT(e,n.v,i,r)}}}function UT(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)HT(r,i,t,n);return r}function WT(e,t,n,r){HT(e,t,n,r)}function GT(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function KT(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)GT(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var qT=class{constructor(e,t,n){this.options={...$,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Hw(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=ST(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof $w))throw Error(Pw);if(this._myIndex=t||eT(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=zT({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=UT(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!jw(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=zT({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});WT(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&KT(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(Fw);this._invertedIndex&&KT(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(Ew(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return Dw(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&Dw(n)&&n>0&&Ew(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new MT(n,u);Ew(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=Ew(e)?Ew(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),jT(d,{ignoreFieldNorm:s}),a&&d.sort(Ew(e)?u:l),Dw(n)&&n>-1&&(d=d.slice(0,n));return PT(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!jw(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=AT(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=kT(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===CT.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(jw(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!jw(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=AT(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!jw(t))return[];let r=[];if(Cw(t))t.forEach(({v:t,i,n:a})=>{if(!jw(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};qT.version=`7.5.0`,qT.createIndex=eT,qT.parseIndex=tT,qT.config=$,qT.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Bw);return ST(e,{...$,...n}).searchIn(t)},qT.parseQuery=kT,xT(yT),xT(BT),qT.use=function(...e){e.forEach(e=>xT(e))};var JT=qT;function YT(...e){return ux(Ac(e))}function XT(e,t){return e?.files.find(e=>e.key===t.key&&e.base===t.base)}function ZT(e){return e.replace(/^\/private(?=\/(tmp|var|etc)(\/|$))/,``).replace(/^\/(Users|home)\/[^/]+/,`~`)}function QT(e){return e.git?.root??(e.key.slice(0,e.key.lastIndexOf(`/`))||`/`)}function $T(e){return e.git?.branch??e.git?.commit}function eE(e){let t=e.git;if(!t)return null;let n=t.project??t.root;return{id:n,name:t.projectName??n.split(`/`).pop()??n}}function tE({machine:e}){return(0,G.jsxs)(`span`,{className:`flex items-center gap-[5px]`,children:[(0,G.jsx)(q,{name:e?.kind===`laptop`?`laptop`:`desktop`,size:13,strokeWidth:1.7,className:`text-faint`}),e?.name??`This Mac`]})}function nE({file:e,className:t,project:n=!0}){let r=$T(e),i=n?eE(e):null,a=r??ZT(QT(e));return(0,G.jsxs)(`span`,{className:YT(`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,t),title:ZT(e.key),children:[i&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(q,{name:`repo`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 shrink-0 truncate`,children:i.name}),(0,G.jsx)(`span`,{className:`text-faint`,children:`·`})]}),(0,G.jsx)(q,{name:r?`branch`:`folder`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,dir:r?void 0:`rtl`,children:(0,G.jsx)(`bdi`,{children:a})})]})}function rE({file:e,name:t,machine:n}){let r=e&&eE(e),i=e&&$T(e),a=e&&!r&&QT(e);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(`b`,{className:`truncate font-semibold text-[14px]`,title:e&&ZT(e.key),children:e?.name??t}),(r||a)&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[r&&(0,G.jsx)(iE,{icon:`repo`,label:aE(r),title:ZT(r.id)}),i&&(0,G.jsx)(iE,{icon:`branch`,label:i,title:e?.git?.branch?i:`Detached at ${i}`}),a&&(0,G.jsx)(iE,{icon:`folder`,label:ZT(a),title:ZT(a),fromEnd:!0})]}),e?.locked&&(0,G.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Open it to let Ponzu read this folder.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-[5px] whitespace-nowrap border-t pt-2.5 text-muted-foreground text-xs`,children:[(0,G.jsx)(tE,{machine:n}),e?.modified?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),oE(e.modified)]}):null]})]})}function iE({icon:e,label:t,title:n,fromEnd:r}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-xs`,title:n,children:[(0,G.jsx)(q,{name:e,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,dir:r?`rtl`:void 0,children:(0,G.jsx)(`bdi`,{children:t})})]})}function aE(e){return e.id.startsWith(`/`)?e.name:e.id.slice(e.id.indexOf(`/`)+1)}function oE(e){if(!e)return`Edited a while ago`;let t=Ax(e);if(t===`now`)return`Just now`;let n=t.slice(-1),r=Number(t.slice(0,-1));return n===`m`?`${cE(r,`min`)} ago`:n===`h`?`${cE(r,`hour`)} ago`:r===1?`Yesterday`:r<7?`${r} days ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function sE(e){if(!e)return``;let t=Ax(e);return t===`now`?`now`:/^\d+[mhd]$/.test(t)&&!(t.endsWith(`d`)&&Number(t.slice(0,-1))>=7)?t:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function cE(e,t){return`${e} ${t}${e===1?``:`s`}`}var lE=Nc(`inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-[9px] font-medium outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,outline:`border bg-card hover:bg-accent`,ghost:`text-muted-foreground hover:bg-accent hover:text-foreground`},size:{default:`h-[34px] px-3.5`,sm:`h-7 rounded-lg px-2.5`,icon:`size-7 rounded-lg`}},defaultVariants:{variant:`default`,size:`default`}});function uE({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,type:i=`button`,...a}){let o=r?Hc:`button`;return(0,G.jsx)(o,{"data-slot":`button`,"data-variant":t,"data-size":n,type:r?void 0:i,className:YT(lE({variant:t,size:n,className:e})),...a})}function dE({...e}){return(0,G.jsx)(Ff,{"data-slot":`dialog`,...e})}function fE({...e}){return(0,G.jsx)(zf,{"data-slot":`dialog-portal`,...e})}function pE({className:e,...t}){return(0,G.jsx)(Vf,{"data-slot":`dialog-overlay`,className:YT(`fixed inset-0 z-50 bg-black/40 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function mE({className:e,children:t,showCloseButton:n=!0,...r}){return(0,G.jsxs)(fE,{"data-slot":`dialog-portal`,children:[(0,G.jsx)(pE,{}),(0,G.jsxs)(Wf,{"data-slot":`dialog-content`,className:YT(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-xl bg-popover p-6 text-popover-foreground shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-md`,e),...r,children:[t,n&&(0,G.jsxs)(Zf,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 grid size-7 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,G.jsx)(q,{name:`close`,size:15}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function hE({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`dialog-header`,className:YT(`flex flex-col gap-1 text-left`,e),...t})}function gE({className:e,...t}){return(0,G.jsx)(Jf,{"data-slot":`dialog-title`,className:YT(`font-semibold text-[17px] leading-none tracking-[-0.01em]`,e),...t})}function _E({className:e,...t}){return(0,G.jsx)(Yf,{"data-slot":`dialog-description`,className:YT(`text-muted-foreground`,e),...t})}var vE=500,yE={agent:null,ideas:[],running:!1,looking:[]},bE=null;function xE(e,t=``){let[n,r]=(0,W.useState)(bE),[i,a]=(0,W.useState)(!1),o=e=>{bE=e,AE(e.ideas),r(e)};(0,W.useEffect)(()=>{let e=!0;return TE(`GET`).then(t=>e&&o(t??bE??yE)),()=>{e=!1}},[t]),(0,W.useEffect)(()=>{if(!e)return;let t=!0;return a(!0),TE(`POST`).then(e=>{t&&(a(!1),e&&o(e))}),()=>{t=!1,a(!1)}},[e]);let s=!!n?.running;return(0,W.useEffect)(()=>{if(!s)return;let e=!0,t=setInterval(()=>{TE(`GET`).then(t=>e&&t&&o(t))},vE);return()=>{e=!1,clearInterval(t)}},[s]),n?i&&!n.running?{...n,running:!0}:n:null}function SE(e,t){let[n,r]=(0,W.useState)({}),i=(e,t)=>{t&&AE(t.ideas),r(n=>CE(n,e,t))},a=t.map(e=>e.id).join(` `);(0,W.useEffect)(()=>{let e=!0;for(let t of a.split(` `).filter(Boolean))TE(`GET`,wE(t)).then(n=>e&&i(t,n));return()=>{e=!1}},[a]),(0,W.useEffect)(()=>{if(!e)return;let t=!0;for(let e of a.split(` `).filter(Boolean))TE(`POST`,wE(e)).then(n=>t&&i(e,n));return()=>{t=!1}},[e,a]);let o=Object.entries(n).filter(([,e])=>e.running).map(([e])=>e).join(` `);return(0,W.useEffect)(()=>{if(!o)return;let e=!0,t=setInterval(()=>{for(let t of o.split(` `))TE(`GET`,wE(t)).then(n=>e&&i(t,n))},vE);return()=>{e=!1,clearInterval(t)}},[o]),t.flatMap(e=>{let t=n[e.id];return t?.agent?[{...t,machine:e}]:[]})}function CE(e,t,n){if(n)return{...e,[t]:n};let{[t]:r,...i}=e;return i}function wE(e){return`/peers/${encodeURIComponent(e)}`}async function TE(e,t=``){let n=e===`POST`?`/api/suggestions/refresh`:`/api/suggestions`;try{let r=await fetch(`${window.location.origin}${t}${n}`,{method:e});if(!r.ok)return null;let i=await r.json();return Array.isArray(i?.ideas)?{...i,looking:i.looking??[]}:null}catch{return null}}var EE=new Map,DE=!1,OE=0;function kE(e){return`${e.project}\n${e.name.toLowerCase()}`}function AE(e,t=performance.now()){for(let n of e){let e=kE(n);EE.has(e)||(DE?(OE=Math.max(t,OE+700),EE.set(e,OE)):EE.set(e,0))}DE=!0}function jE(e){return EE.get(kE(e))??0}var ME=[-90,110],NE=[950,1200],PE=[550,1e3],FE=[1e3,1350],IE=90+FE[1],LE=7,RE=8;function zE(){return(0,G.jsx)(`div`,{className:`pz-appear grid h-[560px] place-items-center`,role:`status`,"aria-label":`Looking for designs to suggest`,children:(0,G.jsx)(BC,{columns:RE,className:`text-[30px]`})})}function BE({at:e,machine:t}){return(0,G.jsxs)(`div`,{className:`pz-appear flex min-w-0 flex-col gap-2.5`,role:`status`,"aria-label":`Looking around ${e.folder}`,children:[(0,G.jsx)(`div`,{className:`aspect-[16/11] rounded-xl border border-foreground/18 border-dashed px-4 py-3.5`,children:(0,G.jsxs)(`span`,{className:`pz-shimmer block truncate text-[12px] text-muted-foreground leading-[18px]`,children:[`Looking around `,e.folder,`…`]})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`flex h-5 items-center`,children:(0,G.jsx)(BC,{columns:LE,className:`text-[17px]`})}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]})]})}function VE({idea:e,machine:t,onPick:n}){let r=jE(e),[i]=(0,W.useState)(()=>!e.prompt),[a,o]=(0,W.useState)(()=>r>0&&performance.now()-r<IE&&!li()),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{if(!a)return;let e=performance.now(),t=r+90;s.current&&yi(s.current,r,e);let n=[qE(c.current,t,PE,e),qE(u.current,t,FE,e),l.current?.animate([{opacity:0,offset:0},{opacity:1,offset:KE(ME)/KE([ME[0],NE[1]])},{opacity:1,offset:(NE[0]-ME[0])/KE([ME[0],NE[1]])},{opacity:0,offset:1}],{duration:KE([ME[0],NE[1]]),fill:`both`})],i=n[2];i&&(i.currentTime=e-(t+ME[0]));let d=setTimeout(()=>o(!1),r+IE-e);return()=>{clearTimeout(d);for(let e of n)e?.cancel()}},[a,r]);let d=()=>n(e);return(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group flex min-w-0 cursor-default flex-col gap-2.5 text-left outline-none`,onClick:d,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())},children:[(0,G.jsxs)(`div`,{className:`relative aspect-[16/11]`,children:[(0,G.jsx)(`div`,{ref:c,className:`absolute inset-0 overflow-hidden rounded-xl border border-foreground/18 border-dashed px-4 py-3.5 transition-[border-color,box-shadow] group-hover:border-foreground/30 group-focus-visible:shadow-[0_0_0_2px_var(--ring)]`,children:e.prompt?(0,G.jsx)(`p`,{className:YT(`h-full overflow-hidden text-pretty wrap-break-word text-[12px] text-foreground/80 leading-[18px] [mask-image:linear-gradient(to_bottom,#000_calc(100%-40px),transparent)]`,i&&`pz-appear`),children:e.prompt}):(0,G.jsx)(WE,{steps:e.steps??[]})}),a&&(0,G.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 size-full overflow-visible`,children:(0,G.jsx)(`rect`,{ref:s,x:.75,y:.75,rx:12,pathLength:100,fill:`none`,stroke:`#f2b100`,strokeWidth:1.5,strokeDasharray:`100 100`,strokeDashoffset:100,style:{width:`calc(100% - 1.5px)`,height:`calc(100% - 1.5px)`}})})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[a&&(0,G.jsx)(`div`,{ref:l,className:`absolute top-[9px] left-0.5 flex`,children:(0,G.jsx)(BC,{columns:LE,className:`text-[17px]`})}),(0,G.jsxs)(`div`,{ref:u,className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate font-medium text-[13.5px]`,children:e.name}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]})]})]})}function HE({project:e,name:t,machine:n}){return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:n?`${e} on ${n.name}`:e,children:[(0,G.jsx)(q,{name:`repo`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),n&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,G.jsx)(q,{name:n.kind===`laptop`?`laptop`:`desktop`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:n.name})]})]})}var UE={read:`Reading`,find:`Finding`,search:`Searching for`};function WE({steps:e,label:t=`Reading the code…`}){let n=new Map;return(0,G.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col gap-1.5`,role:`status`,children:[(0,G.jsx)(`span`,{className:`pz-shimmer mb-1 text-[12px] text-muted-foreground leading-[18px]`,children:t}),e.map((t,r)=>{let i=`${t.verb}:${t.what}`,a=(n.get(i)??0)+1;return n.set(i,a),(0,G.jsxs)(`span`,{className:`pz-appear flex min-w-0 items-baseline gap-1.5 text-[11.5px] leading-4`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-faint`,children:UE[t.verb]}),(0,G.jsx)(`span`,{className:YT(`min-w-0 truncate font-mono text-[11px]`,r===e.length-1?`text-foreground/80`:`text-faint`),children:t.verb===`search`?`“${t.what}”`:t.what})]},`${i}:${a}`)})]})}var GE={claude:`Claude Code`,codex:`Codex`};function KE([e,t]){return t-e}function qE(e,t,[n,r],i){if(!e)return;let a=e.animate([{opacity:0,offset:0},{opacity:0,offset:n/r,easing:`ease-out`},{opacity:1,offset:1}],{duration:r,fill:`backwards`});return a.currentTime=i-t,a}function JE({idea:e,machine:t,agent:n,open:r,onClose:i}){let[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(void 0);return(0,G.jsx)(dE,{open:r,onOpenChange:e=>{e||(i(),o(!1))},children:(0,G.jsx)(mE,{"aria-describedby":void 0,children:e&&(0,G.jsx)(YE,{idea:e,machine:t,agent:n,copied:a,onCopy:()=>{e?.prompt&&(navigator.clipboard.writeText(e.prompt),o(!0),clearTimeout(s.current),s.current=setTimeout(()=>o(!1),1400))}})})})}function YE({idea:e,machine:t,agent:n=null,copied:r,onCopy:i}){let a=!e.prompt;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(hE,{className:`gap-2 pr-8`,children:[(0,G.jsx)(gE,{children:e.name}),(0,G.jsx)(HE,{project:e.project,name:e.projectName,machine:t})]}),(0,G.jsx)(`div`,{className:YT(`select-text wrap-break-word rounded-[10px] bg-secondary px-3.5 py-3 text-[13px] leading-5 shadow-[inset_0_0_0_1px_var(--hairline)]`,a&&`min-h-30`),children:a?(0,G.jsx)(WE,{steps:e.steps??[],label:`${n?GE[n]:`Your agent`} is reading ${e.projectName} to write this prompt…`}):e.prompt}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex-1 text-faint text-xs`,children:a&&`Copy prompt works once it’s written.`}),(0,G.jsxs)(uE,{onClick:i,disabled:a,className:`text-[13px]`,children:[(0,G.jsx)(q,{name:r?`check`:`copy`,size:15}),r?`Copied`:`Copy prompt`]})]})]})}var XE=`z-50 min-w-[200px] rounded-[11px] bg-popover p-[5px] text-[13px] text-popover-foreground shadow-[0_0_0_1px_var(--hairline-strong),0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,ZE=`flex h-[30px] cursor-default select-none items-center gap-[9px] rounded-[7px] px-2.5 outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[disabled]:opacity-40 [&_svg]:text-muted-foreground`,QE=`mx-1.5 my-1 h-px bg-[var(--hairline-strong)]`,$E=N_,eD=F_;function tD({className:e,sideOffset:t=6,...n}){return(0,G.jsx)(I_,{children:(0,G.jsx)(R_,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:YT(XE,e),...n})})}function nD({className:e,...t}){return(0,G.jsx)(z_,{"data-slot":`dropdown-menu-item`,className:YT(ZE,e),...t})}function rD({className:e,...t}){return(0,G.jsx)(B_,{className:YT(QE,e),...t})}var iD=g_,aD=v_;function oD({className:e,...t}){return(0,G.jsx)(y_,{children:(0,G.jsx)(x_,{"data-slot":`context-menu-content`,className:YT(XE,e),...t})})}function sD({className:e,...t}){return(0,G.jsx)(S_,{"data-slot":`context-menu-item`,className:YT(ZE,e),...t})}function cD({className:e,...t}){return(0,G.jsx)(C_,{className:YT(QE,e),...t})}var lD=`ponzu.seen`;function uD(){try{return JSON.parse(localStorage.getItem(lD)??`{}`)}catch{return{}}}function dD(e){let t=uD();for(let[n,r]of Object.entries(e))t[n]=Math.max(t[n]??0,r);try{localStorage.setItem(lD,JSON.stringify(t))}catch{}}function fD(e,t,n){let r=e;for(let i of t){let t=e[i.id];t!==void 0&&(i.id!==n||t>=i.modified)||(r===e&&(r={...e}),r[i.id]=i.modified)}return r}function pD(e,t){let n=e[t.id];return n!==void 0&&t.modified>n+1e3}var mD=navigator.userAgent.includes(`Mac`),hD=mD?`⌘`:`Ctrl+`,gD=8,_D=12,vD=4,yD=1e4;function bD({catalog:e,onOpen:t,onOpenFolder:n,onNew:r,onShelve:i,seen:a={}}){let[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),m=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=e=>{e.metaKey===mD&&e.ctrlKey===!mD&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`f`&&(e.preventDefault(),m.current?.focus(),m.current?.select())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let h=(0,W.useMemo)(()=>x(e?.files??[]),[e?.files]),g=o.trim(),_=JD(h),v=(0,W.useMemo)(()=>{let e={recent:[],archived:[]};for(let t of h)e[y(t)].push(t);return{recent:S(e.recent),archived:S(e.archived)}},[h]),b=e!==null&&v.recent.length===0,C=MD(e!==null,e!==null&&h.length===0),[w,T]=(0,W.useState)(!1),E=xE(w,e?.agents.filter(e=>e.found).map(e=>e.id).join(` `)??``),D=SE(w,(0,W.useMemo)(()=>e?.machines.filter(e=>e.id!==`local`)??[],[e?.machines])),O=!!E?.agent||D.length>0,k=c===`suggested`&&!O?`recent`:c??(b&&O?`suggested`:`recent`),A=e===null||C||b&&E===null,j=!A&&!g&&k===`suggested`;(0,W.useEffect)(()=>T(j),[j]);let[M,N]=(0,W.useState)(()=>Date.now()),P=(0,W.useMemo)(()=>{let e=Math.max(M,Date.now()),t=(t,n)=>{let r=h.filter(e=>e.machine===(n?.id??`local`));return t.flatMap(t=>{let i=ze(t,r);return i&&Be(i,e)?[]:[{idea:t,file:i,machine:n}]})};return[...t(E?.ideas??[]),...D.flatMap(e=>t(e.ideas,e.machine))]},[E?.ideas,D,h,M]);(0,W.useEffect)(()=>{let e=P.flatMap(({file:e})=>e?.created&&!e.busy?[e.created+Re]:[]);if(!e.length)return;let t=setTimeout(()=>N(Date.now()),Math.max(0,Math.min(...e)-Date.now())+50);return()=>clearTimeout(t)},[P]);let[F,I]=(0,W.useState)({idea:null,open:!1}),ee=F.idea,L=ee?P.find(e=>e.machine?.id===F.machine?.id&&kE(e.idea)===kE(ee))?.idea??ee:null,te=v.recent,R=k===`suggested`?wD:v[k],z=DD((0,W.useMemo)(()=>k===`suggested`?[...P.map(({idea:e})=>e),...E?.looking??[],...D.flatMap(e=>e.looking)].map(e=>({id:e.projectId,name:e.projectName})):R.map(e=>eE(e.file)),[k,P,R,E?.looking,D])),ne=u!==null&&z.some(e=>e.id===u)?u:null,re=ne===null?R:R.filter(e=>(eE(e.file)?.id??TD)===ne),ie=ne===null?P:P.filter(({idea:e})=>e.projectId===ne),ae=[...(E?.looking??[]).map(e=>({at:e,machine:void 0})),...D.flatMap(e=>e.looking.map(t=>({at:t,machine:e.machine})))].filter(({at:e})=>ne===null||e.projectId===ne),oe=!!E?.running||D.some(e=>e.running),se=e=>p({text:e instanceof Error&&e.message?e.message:`That didn’t work.`}),ce=i?async(e,t)=>{let n=t=>Promise.all([e.file,...e.copies].map(e=>i(e,t)));try{await n(t)}catch(e){se(e);return}let r={archive:`restore`,restore:`archive`};p({text:CD[t](e.file.name),undo:()=>{p(null),n(r[t]).catch(se)}})}:void 0;return(0,W.useEffect)(()=>{if(!f)return;let e=setTimeout(()=>p(null),6e3);return()=>clearTimeout(e)},[f]),(0,G.jsxs)(`div`,{className:`h-full overflow-auto rounded-xl bg-home`,children:[(0,G.jsxs)(`div`,{className:`mx-auto flex max-w-[1088px] flex-col gap-7 px-8 pt-12 pb-12`,children:[(0,G.jsx)(_x,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsxs)(`label`,{className:`search flex h-10 flex-1 items-center gap-2.5 rounded-[10px] bg-card px-3.5 text-[14px]`,children:[(0,G.jsx)(q,{name:`search`,size:18,className:`shrink-0 text-faint`}),(0,G.jsx)(`input`,{ref:m,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(s(``),e.currentTarget.blur())},placeholder:`Search designs`,spellCheck:!1,className:`h-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-faint`}),g?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,className:`grid size-5 place-items-center rounded text-faint hover:text-foreground`,onClick:()=>{s(``),m.current?.focus()},children:(0,G.jsx)(q,{name:`close`,size:14,strokeWidth:1.8})}):(0,G.jsxs)(`span`,{className:`text-faint text-xs`,children:[hD,`F`]})]}),(0,G.jsx)(`span`,{className:`w-1.5`}),n&&(0,G.jsx)(LD,{label:`Open`,keys:[`⌘`,`O`],icon:`folderOpen`,onClick:n}),r&&(0,G.jsx)(LD,{label:`New`,keys:[`⌘`,`N`],icon:`add`,onClick:r})]})}),A?(0,G.jsx)(FD,{}):g?(0,G.jsx)(eO,{query:g,cards:te,onOpen:t,onShelve:ce,live:_,seen:a}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`-mb-3.5 flex h-7 items-center justify-between gap-4`,children:[(0,G.jsx)(ED,{view:k,has:{recent:!0,suggested:O,archived:v.archived.length>0},onView:l}),z.length>1&&(0,G.jsx)(OD,{projects:z,scope:ne,onScope:d})]}),k===`suggested`?ie.length||ae.length?(0,G.jsxs)(BD,{children:[ae.map(({at:e,machine:t})=>(0,G.jsx)(BE,{at:e,machine:t},`looking:${t?.id??`local`}:${e.project}`)),ie.map(({idea:e,file:n,machine:r})=>n?(0,G.jsx)(VD,{card:{file:n,copies:[]},onOpen:t,onShelve:ce,live:_.has(n.id),unseen:pD(a,n)},n.id):(0,G.jsx)(VE,{idea:e,machine:r,onPick:e=>I({idea:e,machine:r,open:!0})},`${r?.id??`local`}:${e.project}:${e.name}`))]}):oe?(0,G.jsx)(zE,{}):(0,G.jsx)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:SD[k]}):re.length?(0,G.jsx)(BD,{children:re.map(e=>(0,G.jsx)(VD,{card:e,onOpen:t,onShelve:ce,live:_.has(e.file.id),unseen:pD(a,e.file),short:!!ne},e.file.id))}):(0,G.jsx)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:SD[k]})]})]}),f&&(0,G.jsx)(ID,{text:f.text,onUndo:f.undo,onClose:()=>p(null)}),(0,G.jsx)(JE,{idea:L,machine:F.machine,agent:(F.machine?D.find(e=>e.machine.id===F.machine?.id)?.agent:E?.agent)??null,open:F.open,onClose:()=>I(e=>({...e,open:!1}))})]})}var xD=[{id:`recent`,label:`Recent`,icon:`clock`},{id:`suggested`,label:`Suggested`,icon:`sparkle`},{id:`archived`,label:`Archived`,icon:`shelved`}],SD={recent:`Nothing here yet.`,suggested:`Nothing to suggest yet.`,archived:`Nothing archived.`},CD={archive:e=>`Archived “${e}”. It comes back when you open it or an agent edits it.`,restore:e=>`Restored “${e}”.`},wD=[],TD=``;function ED({view:e,has:t,onView:n}){return(0,G.jsx)(`div`,{className:`flex items-center gap-[18px] text-[13px]`,role:`tablist`,children:xD.map(r=>t[r.id]||e===r.id?(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e===r.id,onClick:()=>n(r.id),className:YT(`group flex items-center gap-1.5`,e===r.id?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,G.jsx)(q,{name:r.icon,size:14,className:e===r.id?`text-foreground`:`text-faint group-hover:text-muted-foreground`}),r.label]},r.id):null)})}function DD(e){return(0,W.useMemo)(()=>{let t=new Map;for(let n of e){let e=n?.id??TD,r=t.get(e);r?r.count++:t.set(e,{id:e,name:n?.name??`Not in a project`,count:1})}let n=new Map;for(let e of t.values())n.set(e.name,(n.get(e.name)??0)+1);for(let e of t.values())e.id!==TD&&(n.get(e.name)??0)>1&&(e.name=e.id.split(`/`).slice(-2).join(`/`));return[...t.values()].sort((e,t)=>Number(e.id===TD)-Number(t.id===TD)||t.count-e.count||e.name.localeCompare(t.name))},[e])}function OD({projects:e,scope:t,onScope:n}){let r=e.find(e=>e.id===t);return(0,G.jsxs)($E,{children:[(0,G.jsx)(eD,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Project: ${r?r.name:`All projects`}`,className:YT(`flex h-7 items-center gap-1.5 whitespace-nowrap rounded-[7px] pr-2 pl-2.5 text-[13px] outline-none hover:bg-accent focus-visible:shadow-[0_0_0_2px_var(--ring)] data-[state=open]:bg-accent`,r?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground data-[state=open]:text-foreground`),children:[(0,G.jsx)(q,{name:r?r.id===TD?`loose`:`folder`:`folders`,size:14,strokeWidth:1.6,className:r?`text-foreground`:void 0}),r?r.name:`All projects`,(0,G.jsx)(q,{name:`chevronDown`,size:13,strokeWidth:2,className:`text-faint`})]})}),(0,G.jsxs)(tD,{align:`end`,className:`min-w-56`,children:[(0,G.jsx)(kD,{on:t===null,onSelect:()=>n(null),icon:`folders`,children:`All projects`}),(0,G.jsx)(rD,{}),e.map(e=>(0,G.jsx)(kD,{on:t===e.id,onSelect:()=>n(e.id),icon:e.id===TD?`loose`:`folder`,title:e.id||void 0,children:e.name},e.id))]})]})}function kD({on:e,onSelect:t,icon:n,title:r,children:i}){return(0,G.jsxs)(nD,{onSelect:t,title:r,"aria-checked":e,role:`menuitemcheckbox`,children:[(0,G.jsx)(`span`,{className:`grid w-3.5 place-items-center`,children:e&&(0,G.jsx)(q,{name:`check`,size:14,strokeWidth:2})}),(0,G.jsx)(`span`,{className:`grid w-3.5 place-items-center text-muted-foreground`,children:n&&(0,G.jsx)(q,{name:n,size:14,strokeWidth:1.6})}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i})]})}var AD=`ponzu.setUp`,jD=3e4;function MD(e,t){let[n,r]=(0,W.useState)(()=>{try{return localStorage.getItem(AD)===`1`}catch{return!1}}),[i,a]=(0,W.useState)(null),[,o]=(0,W.useState)(0),s=e&&!t;return(0,W.useEffect)(()=>{if(s){r(!0);try{localStorage.setItem(AD,`1`)}catch{}}},[s]),(0,W.useEffect)(()=>{a(e=>t?e??Date.now():null)},[t]),(0,W.useEffect)(()=>{if(i===null)return;let e=setTimeout(()=>o(Date.now()),i+jD-Date.now());return()=>clearTimeout(e)},[i]),!n||!t?!1:i===null||Date.now()-i<jD}var ND=[`62%`,`48%`,`71%`,`55%`,`44%`,`66%`,`52%`,`60%`],PD=[`34%`,`26%`,`40%`,`30%`,`24%`,`36%`,`28%`,`32%`];function FD(){return HC(!0)?(0,G.jsxs)(`div`,{className:`pz-appear flex flex-col gap-7`,role:`status`,"aria-label":`Loading designs`,children:[(0,G.jsx)(`div`,{className:`-mb-3.5 flex h-7 items-center text-[13px]`,children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,G.jsx)(q,{name:`clock`,size:14,className:`text-foreground`}),`Recent`]})}),(0,G.jsx)(BD,{children:ND.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 motion-safe:animate-pulse`,style:{animationDelay:`${t*90}ms`},children:[(0,G.jsx)(`div`,{className:`aspect-[16/11] rounded-xl bg-preview shadow-[0_0_0_1px_var(--hairline)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 px-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex h-5 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex-1`,children:(0,G.jsx)(`span`,{className:`block h-[11px] rounded-full bg-secondary`,style:{width:e}})}),(0,G.jsx)(`span`,{className:`h-[9px] w-5 rounded-full bg-secondary`})]}),(0,G.jsxs)(`span`,{className:`flex h-4 items-center gap-[5px]`,children:[(0,G.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-[3px] bg-secondary`}),(0,G.jsx)(`span`,{className:`h-[9px] rounded-full bg-secondary`,style:{width:PD[t]}}),(0,G.jsx)(`span`,{className:`size-[11px] shrink-0 rounded-[3px] bg-secondary`}),(0,G.jsx)(`span`,{className:`h-[9px] w-[22%] rounded-full bg-secondary`})]})]})]},t))})]}):null}function ID({text:e,onUndo:t,onClose:n}){return(0,G.jsxs)(`div`,{role:`status`,className:`fixed bottom-6 left-1/2 z-50 flex h-10 -translate-x-1/2 items-center gap-3.5 rounded-xl bg-foreground pr-2 pl-3.5 text-[13px] text-home shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)]`,children:[(0,G.jsx)(`span`,{children:e}),t?(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`flex h-7 items-center rounded-lg bg-home/15 px-2.5 font-medium hover:bg-home/25`,children:`Undo`}):(0,G.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`px-1.5 opacity-70`,children:(0,G.jsx)(q,{name:`close`,size:13})})]})}function LD({label:e,keys:t,icon:n,onClick:r}){return(0,G.jsx)(vx,{label:e,keys:t,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":e,onClick:r,className:`grid size-10 place-items-center rounded-[10px] text-muted-foreground hover:bg-accent hover:text-foreground`,children:(0,G.jsx)(q,{name:n,size:20,strokeWidth:1.5})})})}function RD(e){return e===`claude`?`Claude`:e===`openai`?`Codex`:e===`cursor`?`Cursor`:`Your agent`}function zD({left:e}){return(0,G.jsx)(`div`,{className:`-mb-3.5 text-muted-foreground text-xs`,children:e})}function BD({children:e,columns:t=4}){return(0,G.jsx)(`div`,{className:YT(`grid gap-x-5 gap-y-7`,t===4?`grid-cols-4 max-[1100px]:grid-cols-3 max-[820px]:grid-cols-2`:`grid-cols-3 max-[820px]:grid-cols-2`),children:e})}function VD({card:e,onOpen:t,onShelve:n,match:r,pathMatch:i,live:a,unseen:o,short:s}){let{file:c,copies:l}=e,u=!!c.busy,d=y(c)===`archived`,f=()=>t({key:c.key,base:c.base}),p=(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`group relative flex min-w-0 cursor-default flex-col gap-2.5 text-left outline-none`,onClick:f,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},title:c.locked?`Open it to let Ponzu read this folder.`:void 0,children:[(0,G.jsxs)(`div`,{className:`relative aspect-[16/11] overflow-hidden rounded-xl bg-preview shadow-[0_0_0_1px_var(--hairline)] transition-shadow group-hover:shadow-[0_0_0_1px_var(--hairline-strong),0_4px_14px_rgba(0,0,0,0.06)] group-focus-visible:shadow-[0_0_0_2px_var(--ring)]`,children:[(0,G.jsxs)(`div`,{className:YT(`absolute inset-0`,d&&`opacity-55 grayscale`),children:[(0,G.jsx)(qD,{src:c.preview,working:u}),a&&(0,G.jsx)(ZD,{file:c})]}),o&&(0,G.jsx)(`span`,{role:`img`,"aria-label":`Changed since you looked`,title:`Changed since you looked`,className:`absolute top-2 left-2 z-[4] size-2.5 rounded-full bg-flesh shadow-[0_0_0_1.5px_var(--card),0_0_0_2.5px_rgba(17,17,16,0.18)]`})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,G.jsx)(`span`,{className:YT(`min-w-0 flex-1 truncate font-medium text-[13.5px]`,u&&`pz-shimmer`,d&&`text-muted-foreground`),children:(0,G.jsx)(rO,{text:c.name,ranges:r})}),(0,G.jsx)(`span`,{className:`shrink-0 text-faint text-xs tabular-nums`,title:d&&c.archived?`Archived ${new Date(c.archived).toLocaleString()}`:void 0,children:c.busy?(0,G.jsx)(BC,{columns:_D,className:`self-center text-[17px]`,label:`${RD(c.busy)} is working`,title:`${RD(c.busy)} is working`}):sE(c.modified)})]}),d&&!i?(0,G.jsx)(HD,{file:c}):i?(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,dir:`rtl`,children:(0,G.jsx)(`bdi`,{children:(0,G.jsx)(rO,{text:c.key,ranges:i})})}):(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,children:[l.length?(0,G.jsx)(WD,{card:e}):(0,G.jsx)(nE,{file:c,project:!s,className:`min-w-0 shrink`}),s&&c.git&&!l.length&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,G.jsx)(`span`,{className:`min-w-0 shrink-[2] truncate`,children:QT(c).split(`/`).pop()})]})]})]})]});return n?(0,G.jsxs)(iD,{children:[(0,G.jsx)(aD,{asChild:!0,children:p}),(0,G.jsx)(oD,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)(KD,{card:e,onOpen:t,onShelve:n})})]}):p}function HD({file:e}){let[t,n]=e.archivedFor===`idle`?[`clock`,`Not opened since ${UD(e.active??e.modified)}`]:e.archivedFor===`scratch`||e.shelf===`scratch`?[`bot`,`Made by an agent`]:e.archivedFor===`temp`?[`bot`,`In a temporary folder`]:[`shelved`,`You archived it`];return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:e.archived?`Archived ${new Date(e.archived).toLocaleString()}`:void 0,children:[(0,G.jsx)(q,{name:t,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsx)(`span`,{className:`truncate`,children:n})]})}function UD(e){let t=new Date(e);return t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`}})}function WD({card:e}){let t=GD(e),n=[e.file,...e.copies].every(e=>e.git?.branch);return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,title:`The same design, unchanged, on ${t.map(e=>e.label).join(`, `)}`,children:[(0,G.jsx)(q,{name:`branch`,size:13,strokeWidth:1.7,className:`shrink-0 text-faint`}),(0,G.jsxs)(`span`,{className:`truncate`,children:[t.length,` `,n?`branches`:`checkouts`]})]})}function GD(e){return[e.file,...e.copies].map(e=>({file:e,label:$T(e)??ZT(QT(e))})).sort((e,t)=>e.label.localeCompare(t.label))}function KD({card:e,onOpen:t,onShelve:n}){let{file:r,copies:i}=e,a=window.ponzuDesktop,o=r.machine===`local`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(sD,{onSelect:()=>t({key:r.key,base:r.base}),children:[(0,G.jsx)(q,{name:`folderOpen`,size:15}),`Open`]}),i.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(cD,{}),(0,G.jsx)(`div`,{className:`px-2.5 pt-1 pb-0.5 text-[11.5px] text-faint`,children:`Open on`}),(0,G.jsx)(`div`,{className:`max-h-[225px] overflow-y-auto`,children:GD(e).map(({file:e,label:n})=>(0,G.jsxs)(sD,{title:ZT(e.key),onSelect:()=>t({key:e.key,base:e.base}),children:[(0,G.jsx)(q,{name:`branch`,size:15}),(0,G.jsx)(`span`,{className:`min-w-0 max-w-[240px] truncate`,children:n})]},e.id))}),(0,G.jsx)(cD,{})]}),a&&o&&(0,G.jsxs)(sD,{onSelect:()=>a.reveal(r.key),children:[(0,G.jsx)(q,{name:`folder`,size:15}),`Show in Finder`]}),(0,G.jsxs)(sD,{onSelect:()=>void navigator.clipboard.writeText(r.key),children:[(0,G.jsx)(q,{name:`copy`,size:15}),`Copy path`]}),(0,G.jsx)(cD,{}),y(r)===`archived`?(0,G.jsxs)(sD,{onSelect:()=>void n(e,`restore`),children:[(0,G.jsx)(q,{name:`unarchive`,size:15}),`Restore`]}):(0,G.jsxs)(sD,{onSelect:()=>void n(e,`archive`),children:[(0,G.jsx)(q,{name:`shelved`,size:15}),`Archive`]})]})}function qD({src:e,working:t}){let[n,r]=(0,W.useState)(!1);return(0,W.useEffect)(()=>r(!1),[e]),!e||n?(0,G.jsx)(`span`,{className:`absolute inset-0 grid place-items-center text-faint`,children:t?(0,G.jsx)(BC,{columns:gD,className:`text-[30px]`}):(0,G.jsx)(q,{name:`blank`,size:28,strokeWidth:1.3})}):(0,G.jsxs)(`picture`,{children:[(0,G.jsx)(`source`,{srcSet:`${e}&theme=dark`,media:`(prefers-color-scheme: dark)`}),(0,G.jsx)(`img`,{src:e,alt:``,loading:`lazy`,draggable:!1,onError:()=>r(!0),className:`absolute inset-0 size-full object-contain`})]})}function JD(e){let t=(0,W.useRef)(new Set),n=(0,W.useRef)(new Map),[,r]=(0,W.useState)(0),i=Date.now();for(let r of e)r.busy?(t.current.add(r.id),n.current.delete(r.id)):t.current.delete(r.id)&&n.current.set(r.id,i+yD);let a=new Set;for(let t of e){if(a.size===vD)break;(t.busy||(n.current.get(t.id)??0)>i)&&a.add(t.id)}let o=Math.min(...[...a].map(e=>n.current.get(e)??0).filter(e=>e>i));return(0,W.useEffect)(()=>{if(!Number.isFinite(o))return;let e=setTimeout(()=>r(e=>e+1),o-Date.now()+50);return()=>clearTimeout(e)},[o]),a}var YD=window.matchMedia(`(prefers-color-scheme: dark)`);function XD(){let[e,t]=(0,W.useState)(YD.matches);return(0,W.useEffect)(()=>{let e=()=>t(YD.matches);return YD.addEventListener(`change`,e),()=>YD.removeEventListener(`change`,e)},[]),e?`dark`:`light`}function ZD({file:e}){let t=XD(),[n,r]=(0,W.useState)(null);return(0,W.useEffect)(()=>{let t=new sS(`${window.location.origin}${e.base}`,e.key,{watch:!0});return r(t),()=>t.close()},[e.base,e.key]),n?(0,G.jsx)(QD,{source:n,scheme:t}):null}function QD({source:e,scheme:t}){let{doc:n}=TC(e),r=(0,W.useMemo)(()=>n&&Fe(n,t),[n,t]),i=(0,W.useRef)(null),[a,o]=(0,W.useState)(null),s=r?Number.parseFloat(r.root.style.width):0,c=r?Number.parseFloat(r.root.style.height):0;return(0,W.useEffect)(()=>{let e=i.current;if(!e||!s||!c)return;let t=()=>o(Math.min(e.clientWidth/s,e.clientHeight/c));t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,c]),(0,G.jsx)(`div`,{ref:i,inert:!0,"aria-hidden":!0,className:YT(`pointer-events-none absolute inset-0 grid place-items-center overflow-hidden transition-opacity duration-300`,r&&a?`opacity-100`:`opacity-0`),children:r&&(0,G.jsx)(`div`,{style:{width:s*(a??0),height:c*(a??0)},children:(0,G.jsx)(`div`,{style:{width:s,height:c,transform:`scale(${a??0})`,transformOrigin:`0 0`},children:(0,G.jsx)(Wr,{artboard:r,tokens:n.tokens,assetBase:e.assetBase,colorScheme:t})})})})}var $D={includeMatches:!0,ignoreLocation:!0,threshold:.32,minMatchCharLength:2};function eO({query:e,cards:t,onOpen:n,onShelve:r,live:i,seen:a}){let o=(0,W.useMemo)(()=>new JT(t,{...$D,keys:[{name:`file.name`,weight:3},{name:`file.key`,weight:.5}]}),[t]),s=(0,W.useMemo)(()=>t.flatMap(({file:e})=>e.artboards.map(t=>({file:e,artboard:t,page:e.pages.find(e=>e.id===t.page)?.name}))),[t]),c=(0,W.useMemo)(()=>new JT(s,{...$D,keys:[{name:`artboard.name`,weight:3},{name:`page`,weight:1}]}),[s]),l=o.search(e,{limit:24}),u=c.search(e,{limit:30});return!l.length&&!u.length?(0,G.jsxs)(`p`,{className:`mt-6 text-center text-muted-foreground`,children:[`Nothing matches “`,e,`”.`]}):(0,G.jsxs)(G.Fragment,{children:[l.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zD,{left:`Files`}),(0,G.jsx)(BD,{children:l.map(({item:e,matches:t})=>(0,G.jsx)(VD,{card:e,onOpen:n,onShelve:r,live:i.has(e.file.id),unseen:pD(a,e.file),match:nO(t,`file.name`),pathMatch:nO(t,`file.name`)?void 0:nO(t,`file.key`)},e.file.id))})]}),u.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(zD,{left:`Frames`}),(0,G.jsx)(BD,{columns:3,children:u.map(({item:e,matches:t})=>(0,G.jsx)(tO,{hit:e,match:nO(t,`artboard.name`),pageMatch:nO(t,`page`),onOpen:n},`${e.file.id}:${e.artboard.id}`))})]})]})}function tO({hit:e,match:t,pageMatch:n,onOpen:r}){let[i,a]=(0,W.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,className:`group flex min-w-0 flex-col gap-2.5 text-left`,onClick:()=>r({key:e.file.key,base:e.file.base}),children:[(0,G.jsx)(`div`,{className:`grid h-[200px] place-items-center overflow-hidden rounded-xl bg-preview p-5 shadow-[0_0_0_1px_var(--hairline)] transition-shadow group-hover:shadow-[0_0_0_1px_var(--hairline-strong),0_4px_14px_rgba(0,0,0,0.06)]`,children:i?(0,G.jsx)(q,{name:`board`,size:28,strokeWidth:1.3,className:`text-faint`}):(0,G.jsx)(`img`,{src:e.artboard.thumb,alt:``,loading:`lazy`,draggable:!1,onError:()=>a(!0),className:`block max-h-[160px] max-w-full object-contain shadow-[0_0_0_1px_rgba(0,0,0,0.06),0_2px_6px_rgba(0,0,0,0.06)] dark:shadow-[0_0_0_1px_rgba(255,255,255,0.08)]`})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 px-0.5`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[13.5px]`,children:(0,G.jsx)(rO,{text:e.artboard.name,ranges:t})}),(0,G.jsx)(`span`,{className:`flex min-w-0 items-center gap-[5px] text-muted-foreground text-xs`,children:(0,G.jsxs)(`span`,{className:`truncate`,children:[e.page?(0,G.jsx)(rO,{text:e.page,ranges:n}):`Artboard`,` in`,` `,e.file.name]})})]})]})}function nO(e,t){return e?.find(e=>e.key===t)?.indices}function rO({text:e,ranges:t}){let n=(t??[]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]);if(!n.length)return(0,G.jsx)(G.Fragment,{children:e});let r=[],i=0;for(let[t,a]of n)t<i||(r.push(e.slice(i,t)),r.push((0,G.jsx)(`mark`,{className:`rounded-[2px] bg-highlight text-inherit`,children:e.slice(t,a+1)},t)),i=a+1);return r.push(e.slice(i)),(0,G.jsx)(G.Fragment,{children:r})}var iO=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(iO||{}),aO=[0,1],oO=[1,0],sO=[2,3],cO=[3,2],lO={L:aO,M:oO,Q:sO,H:cO},uO=/^\d*$/,dO=/^[A-Z0-9 $%*+./:-]*$/,fO=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,pO=1,mO=40,hO=3,gO=3,_O=40,vO=10,yO=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],bO=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],xO=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<pO||e>mO)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,iO.Timing),this.setFunctionModule(e,6,e%2==0,iO.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,CO(r,e));this.setFunctionModule(8,7,CO(r,6)),this.setFunctionModule(8,8,CO(r,7)),this.setFunctionModule(7,8,CO(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,CO(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,CO(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,CO(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=CO(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,iO.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,iO.Alignment)}setFunctionModule(e,t,n,r=iO.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==RO(t,n))throw RangeError(`Invalid argument`);let r=bO[n[0]][t],i=yO[n[0]][t],a=Math.floor(LO(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=zO(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=BO(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(LO(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=CO(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=hO:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*_O),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*_O}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=hO:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*_O),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*_O}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=gO)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*vO,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function SO(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function CO(e,t){return!!(e>>>t&1)}var wO=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},TO=[1,10,12,14],EO=[2,9,11,13],DO=[4,8,16,16];function OO(e,t){return e[Math.floor((t+7)/17)+1]}function kO(e){let t=[];for(let n of e)SO(n,8,t);return new wO(DO,e.length,t)}function AO(e){if(!NO(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);SO(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new wO(TO,e.length,t)}function jO(e){if(!PO(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=fO.indexOf(e.charAt(n))*45;r+=fO.indexOf(e.charAt(n+1)),SO(r,11,t)}return n<e.length&&SO(fO.indexOf(e.charAt(n)),6,t),new wO(EO,e.length,t)}function MO(e){return e===``?[]:NO(e)?[AO(e)]:PO(e)?[jO(e)]:[kO(IO(e))]}function NO(e){return uO.test(e)}function PO(e){return dO.test(e)}function FO(e,t){let n=0;for(let r of e){let e=OO(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function IO(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function LO(e){if(e<pO||e>mO)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function RO(e,t){return Math.floor(LO(e)/8)-yO[t[0]][e]*bO[t[0]][e]}function zO(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=VO(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=VO(n,2)}return t}function BO(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=VO(t,e))}return n}function VO(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function HO(e,t,n=1,r=40,i=-1,a=!0){if(!(pO<=n&&n<=r&&r<=mO)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=RO(o,t)*8,i=FO(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[oO,sO,cO])a&&s<=RO(o,e)*8&&(t=e);let c=[];for(let t of e){SO(t.mode[0],4,c),SO(t.numChars,OO(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=RO(o,t)*8;SO(0,Math.min(4,l-c.length),c),SO(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)SO(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new xO(o,t,u,i)}function UO(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?MO(e):Array.isArray(e)?[kO(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=HO(c,lO[n],i,a,o,r),u=WO({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function WO(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=iO.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}var GO=e=>`ponzu://pair?host=${encodeURIComponent(e)}&v=1`;function KO(e){let{data:t,size:n}=UO(e,{ecc:`M`,border:0}),r=``;return t.forEach((e,t)=>{for(let i=0;i<n;){if(!e[i]){i++;continue}let n=1;for(;e[i+n];)n++;r+=`M${i} ${t}h${n}v1h-${n}z`,i+=n}}),{size:n,d:r}}function qO(){let[e,t]=(0,W.useState)(()=>new URLSearchParams(location.search).has(`pair`)),[n,r]=(0,W.useState)(null);(0,W.useEffect)(()=>window.ponzuDesktop?.onPairIphone?.(()=>t(!0)),[]);let i=e=>{if(t(e),e)return;let n=new URL(location.href);n.searchParams.has(`pair`)&&(n.searchParams.delete(`pair`),history.replaceState(null,``,n))};return(0,W.useEffect)(()=>{if(!e)return;let t=!1,n;r(null);let a=async()=>{try{let e=await(await fetch(`/api/info`)).json();if(t)return;r({name:e.machine?.name??null,dns:e.machine?.dns??null});let a=e.pairedAt??0;n===void 0?n=a:a>n&&i(!1)}catch{}};a();let o=setInterval(a,2e3);return()=>{t=!0,clearInterval(o)}},[e]),(0,G.jsx)(dE,{open:e,onOpenChange:i,children:(0,G.jsx)(mE,{className:`gap-[22px] rounded-[18px] p-8 shadow-[0_1px_2px_rgba(0,0,0,0.06),0_18px_50px_rgba(0,0,0,0.2),0_0_0_0.5px_rgba(0,0,0,0.12)] sm:max-w-[520px]`,children:(0,G.jsx)(JO,{machine:n})})})}function JO({machine:e}){let t=e?.dns;return(0,G.jsxs)(`div`,{className:`flex items-center gap-6`,children:[t?(0,G.jsx)(YO,{text:GO(t)}):(0,G.jsx)(`div`,{className:`ghost size-[176px] shrink-0 rounded-[14px]`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsx)(gE,{className:`font-bold font-display text-2xl leading-[1.15] tracking-[-0.02em]`,children:`Pair your iPhone`}),(0,G.jsx)(_E,{className:`m-0 text-sm leading-normal`,children:t||!e?`Open Ponzu on your iPhone and scan this code. Both need Tailscale, signed in to the same account.`:e.name?`Turn on MagicDNS for your tailnet to pair an iPhone. The phone finds this Mac by its tailnet name.`:`Turn on Tailscale on this Mac to pair an iPhone.`})]})]})}function YO({text:e}){let{size:t,d:n}=KO(e);return(0,G.jsx)(`div`,{className:`size-[176px] shrink-0 rounded-[14px] bg-white p-3 shadow-[0_0_0_1px_rgba(17,17,16,0.1)]`,children:(0,G.jsx)(`svg`,{role:`img`,"aria-label":`Pairing code`,"data-pair":e,viewBox:`0 0 ${t} ${t}`,className:`block size-full`,shapeRendering:`crispEdges`,children:(0,G.jsx)(`path`,{d:n,fill:`#111110`})})})}function XO(e){return(0,G.jsx)(X_,{"data-slot":`hover-card`,...e})}function ZO(e){return(0,G.jsx)(Q_,{"data-slot":`hover-card-trigger`,...e})}function QO({className:e,align:t=`end`,sideOffset:n=6,...r}){return(0,G.jsx)(nv,{"data-slot":`hover-card-portal`,children:(0,G.jsx)(iv,{"data-slot":`hover-card-content`,align:t,sideOffset:n,className:YT(`z-50 w-[272px] rounded-xl bg-popover p-3.5 text-popover-foreground shadow-[0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...r})})}var $O=gv,ek=vv;function tk({className:e,align:t=`end`,sideOffset:n=6,...r}){return(0,G.jsx)(Sv,{children:(0,G.jsx)(wv,{"data-slot":`popover-content`,align:t,sideOffset:n,className:YT(`z-50 rounded-xl bg-popover p-4 text-popover-foreground shadow-[0_0_0_0.5px_var(--hairline-strong),0_1px_2px_rgba(0,0,0,0.06),0_8px_28px_rgba(0,0,0,0.1)] outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...r})})}function nk({machines:e,origin:t}){let n=Ve(e??[]),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(!1),s=(0,W.useRef)(!1),c=!!n?.installing;(0,W.useEffect)(()=>{n&&r&&r!==n.version?i(null):r&&c?s.current=!0:r&&s.current&&!c&&i(null)},[n,r,c]);let l=rk(n,t);if(!n)return null;let u=n.installing||r===n.version,d=async()=>{s.current=!1,i(n.version);try{let e=await fetch(`${t}/api/update`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({macs:n.macs,version:n.version})}),r=e.ok?await e.json():null;Object.values(r?.macs??{}).some(Boolean)||i(null)}catch{}};return(0,G.jsxs)($O,{open:a,onOpenChange:o,children:[(0,G.jsx)(ek,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":u?`Updating to Ponzu ${n.version}`:`Ponzu ${n.version} is ready`,className:`app-no-drag grid size-7 shrink-0 place-items-center rounded-full bg-flesh text-[#0e0e0e] outline-none transition-[filter] hover:brightness-95 focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:u?(0,G.jsx)(q,{name:`loading`,size:15,strokeWidth:2,className:`animate-spin`}):(0,G.jsx)(`svg`,{"aria-hidden":!0,width:15,height:15,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2.4,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 19V5M6 11l6-6 6 6`})})})}),(0,G.jsx)(tk,{className:`w-[320px]`,children:(0,G.jsx)(ik,{plan:l?{...n,notes:l}:n,machines:e??[],updating:u,onUpdate:d,onLater:()=>o(!1)})})]})}function rk(e,t){let n=e&&!e.notes.length?`since=${e.since}&version=${e.version}`:null,[r,i]=(0,W.useState)(null);return(0,W.useEffect)(()=>{if(!n)return;let e=!0;return fetch(`${t}/api/update/notes?${n}`).then(e=>e.ok?e.json():null).then(t=>{e&&t?.notes&&i({want:n,notes:t.notes})}).catch(()=>{}),()=>{e=!1}},[n,t]),n&&r?.want===n?r.notes:null}function ik({plan:e,machines:t=[],updating:n,onUpdate:r,onLater:i}){let a=t.find(e=>e.id===`local`)?.update?.waitsFor;return n?(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-[14px] leading-5`,children:[`Updating to `,e.version]}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted-foreground leading-[17px]`,children:a?`Ponzu restarts once ${sk(a)} finishes, and reopens your tabs.`:`Ponzu restarts in a moment and reopens your tabs. Agents reconnect on their own.`})]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,G.jsxs)(`span`,{className:`font-semibold text-[14px] leading-5`,children:[`Ponzu `,e.version]}),e.notes.length>0&&(0,G.jsx)(`ul`,{className:`flex max-h-[min(320px,50vh)] list-disc flex-col gap-1.5 overflow-y-auto pl-[18px] leading-[19px] marker:text-muted-foreground`,children:e.notes.map(e=>(0,G.jsx)(`li`,{children:e},e))}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.macs.length>1&&(0,G.jsx)(ak,{plan:e,machines:t}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(uE,{variant:`outline`,size:`sm`,onClick:i,children:`Later`}),(0,G.jsxs)(uE,{size:`sm`,onClick:r,className:`gap-1.5 pl-2`,children:[(0,G.jsx)(q,{name:`refresh`,size:14,strokeWidth:1.9}),`Restart`]})]})]})}function ak({plan:e,machines:t}){let n=e.macs.flatMap(e=>t.find(t=>t.id===e)??[]),r=e.macs.length===e.of?`On all ${e.of} of your Macs`:`On ${e.macs.length} of your Macs`,i=n.map(e=>[e.name,e.update?.version,ok(e)].filter(Boolean).join(`, `)).join(`; `);return(0,G.jsxs)(XO,{openDelay:150,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"aria-label":i?`${r}: ${i}`:r,className:`-ml-1.5 inline-flex h-6 cursor-default items-center gap-[5px] whitespace-nowrap rounded-md px-1.5 text-[12px] text-muted-foreground tabular-nums outline-none hover:bg-secondary hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,G.jsx)(q,{name:`laptop`,size:13}),e.macs.length]})}),(0,G.jsx)(QO,{align:`start`,side:`bottom`,className:`w-[248px] p-1.5`,children:(0,G.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0 text-[12.5px]`,children:n.map(e=>(0,G.jsxs)(`li`,{className:`flex items-baseline gap-2 px-2 py-1.5`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.name,(0,G.jsxs)(`span`,{className:`text-faint`,children:[` · `,ok(e)]})]}),(0,G.jsx)(`span`,{className:`text-faint tabular-nums`,children:e.update?.version})]},e.id))})})]})}function ok(e){return e.update?.waitsFor?`after ${sk(e.update.waitsFor)} finishes`:e.id===`local`?`restarts last`:`now`}function sk(e){return e===`claude`?`Claude`:e===`openai`?`Codex`:e===`cursor`?`Cursor`:`your agent`}function ck(e,t){let n=null,r=0,i=0,a,o=!1,s=`${e.replace(/^http/,`ws`)}/api/catalog/stream`,c=()=>{let l=!1,u=new WebSocket(s);n=u,u.onopen=()=>{l=!0,i=0},u.onmessage=e=>{let n;try{n=JSON.parse(String(e.data))}catch{return}n.t===`snapshot`?(r++,t(()=>n.catalog)):n.t===`patch`&&t(e=>e&&C(e,n.patch))},u.onclose=()=>{if(!o){if(!l){let n=r;fetch(`${e}/api/catalog`).then(e=>e.ok?e.json():null).then(e=>!o&&e&&r===n&&t(()=>e)).catch(()=>{})}a=setTimeout(c,Math.min(5e3,250*2**i++))}}};return c(),()=>{o=!0,clearTimeout(a),n?.close()}}var lk=`ponzu.pages`;function uk(){let e;try{e=JSON.parse(localStorage.getItem(lk)??`{}`)}catch{return{}}return!e||typeof e!=`object`||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`string`))}function dk(e,t){let n=uk();if(n[e]!==t){n[e]=t;try{localStorage.setItem(lk,JSON.stringify(n))}catch{}}}var fk=window.location.origin,pk=navigator.userAgent.includes(`Mac`),mk=pk?`⌘`:`Ctrl`,hk=({key:e,base:t})=>t?`${t}\n${e}`:e,gk=e=>{let t=e.indexOf(`
|
|
2383
|
+
`);return t<0?{key:e,base:``}:{base:e.slice(0,t),key:e.slice(t+1)}},_k=window.matchMedia(`(prefers-color-scheme: dark)`);function vk(){let[e,t]=(0,W.useState)(_k.matches?`dark`:`light`);return(0,W.useEffect)(()=>{let e=()=>t(_k.matches?`dark`:`light`);return _k.addEventListener(`change`,e),()=>_k.removeEventListener(`change`,e)},[]),(0,W.useEffect)(()=>{document.documentElement.dataset.theme=e},[e]),e}function yk(){let e=vk(),[t,n]=(0,W.useState)(null),[r,i]=(0,W.useState)(()=>{let e=new URLSearchParams(location.search).get(`file`),t=JSON.parse(localStorage.getItem(`ponzu.tabs`)??`[]`);return e?[...new Set([...t,e])]:t}),[a,o]=(0,W.useState)(()=>new URLSearchParams(location.search).get(`file`)),[s,c]=(0,W.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`file`),n=e.get(`page`)??void 0,r=e.get(`artboard`)??void 0;return t&&(n||r)?{file:t,at:{page:n,artboard:r}}:null}),[l,u]=(0,W.useState)(()=>({tab:a,page:a?uk()[a]:void 0}));l.tab!==a&&u({tab:a,page:a?uk()[a]:void 0});let d=(0,W.useMemo)(()=>new Map,[]),f=e=>{let t=d.get(e);if(!t){let{key:n,base:r}=gk(e);t=new sS(`${fk}${r}`,n),d.set(e,t)}return t};(0,W.useEffect)(()=>ck(fk,n),[]);let[p,m]=(0,W.useState)(uD),h=a?XT(t,gk(a))?.id:void 0;(0,W.useEffect)(()=>{if(!t)return;let e=fD(p,t.files,h);e!==p&&(dD(e),m(e))},[t,h]);let[g]=(0,W.useState)(()=>new Set),[_,v]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(t)for(let e of t.files)e.machine===`local`&&e.created&&!g.has(e.key)&&(g.add(e.key),!(e.shelf&&e.shelf!==`recent`)&&(Date.now()-e.created>6e4||r.includes(e.key)||(i(t=>t.includes(e.key)?t:[...t,e.key]),v(e.key))))},[t]),(0,W.useEffect)(()=>{localStorage.setItem(`ponzu.tabs`,JSON.stringify(r));let e=new URL(location.href);a?e.searchParams.set(`file`,a):e.searchParams.delete(`file`),s&&a!==s.file&&(c(null),e.searchParams.delete(`page`),e.searchParams.delete(`artboard`)),history.replaceState(null,``,e)},[r,a]);let y=async(e,t)=>{let r=await fetch(`${fk}${e.base}/api/shelf`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e.key,action:b(e,t)})});if(!r.ok)throw Error(r.status===502?`That Mac isn’t answering. Try again once it’s back.`:await r.text());n(n=>n&&{...n,files:n.files.map(n=>n.id===e.id?{...n,shelf:t===`archive`?`archived`:`recent`,archivedFor:t===`archive`?`person`:void 0}:n)})},x=async e=>{e.base||await fetch(`${fk}/api/files`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e.key,by:`person`})});let t=hk(e);i(e=>e.includes(t)?e:[...e,t]),o(t)},S=e=>{d.get(e)?.close(),d.delete(e);let t=r.indexOf(e);i(t=>t.filter(t=>t!==e)),a===e&&o(r[t+1]??r[t-1]??null)};(0,W.useEffect)(()=>window.ponzuDesktop?.onCloseTab?.(()=>{a?S(a):window.ponzuDesktop?.closeWindow?.()}),[r,a]),(0,W.useEffect)(()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let t=e.shiftKey&&{BracketLeft:-1,BracketRight:1}[e.code];if(t){e.preventDefault();let n=[null,...r],i=n.indexOf(a);o(n[(i+t+n.length)%n.length]??null);return}let n=/^Digit([0-9])$/.exec(e.code)?.[1];if(!n||e.shiftKey)return;if(n===`0`){e.preventDefault(),o(null);return}let i=n===`9`?r.at(-1):r[Number(n)-1];i&&(e.preventDefault(),o(i))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,a]);let{strip:C,dragProps:w}=Sk(r,i);wk(C,r),(0,W.useEffect)(()=>{let e=C.current;_&&e&&e.scrollTo({left:e.scrollWidth,behavior:`smooth`})},[_]);let T=LC(pk?`Meta`:`Control`),E=window.ponzuDesktop,D=E?.platform===`darwin`,O=E?.platform===`win32`;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-background text-foreground`,children:[(0,G.jsxs)(`header`,{className:YT(`flex h-10 shrink-0 items-center gap-1 px-2`,E&&`app-drag [&_button]:app-no-drag`,D&&`pl-[88px]`,O&&`pr-[calc(100vw-env(titlebar-area-x,0px)-env(titlebar-area-width,100vw)+8px)]`),children:[(0,G.jsx)(uE,{variant:`ghost`,size:`icon`,"aria-label":`Home`,className:YT(`w-8`,a===null&&`bg-secondary text-foreground hover:bg-secondary`),onClick:()=>o(null),children:(0,G.jsx)(yx,{modifier:mk,n:0,shown:T,center:!0,children:(0,G.jsx)(Dc,{size:18,color:`currentColor`})})}),(0,G.jsx)(`div`,{ref:C,className:`relative flex min-w-0 gap-0.5 overflow-x-auto [mask-image:linear-gradient(to_right,transparent,#000_var(--fade-start,0px),#000_calc(100%_-_var(--fade-end,0px)),transparent)] [scrollbar-width:none]`,children:r.map((e,n)=>(0,G.jsx)(bk,{source:f(e),file:XT(t,gk(e)),machines:t?.machines,shortcut:n<8?n+1:n===r.length-1?9:void 0,showShortcut:T,active:e===a,onClick:()=>o(e),onClose:()=>S(e),...w(e)},e))}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,G.jsx)(nk,{machines:t?.machines,origin:fk}),a&&(0,G.jsx)(Tk,{source:f(a)})]})]}),(0,G.jsx)(`main`,{className:`min-h-0 flex-1 px-2 pb-2`,children:a?(0,G.jsx)(`div`,{className:`h-full overflow-hidden rounded-xl bg-canvas`,children:(0,G.jsx)(tw,{source:f(a),theme:e,me:{kind:`user`,name:`You`},link:a===s?.file?s.at:void 0,page:l.tab===a?l.page:void 0,onPageChange:e=>{dk(a,e),u({tab:a,page:e})}})},a):(0,G.jsx)(bD,{catalog:t,seen:p,onOpen:e=>void x(e),onShelve:y,onOpenFolder:E&&(async()=>{let e=await E.openFolder();e&&await x({key:e,base:``})}),onNew:E&&(async()=>{let e=await E.newFile();e&&await x({key:e,base:``})})})}),(0,G.jsx)(qO,{})]})}function bk({source:e,file:t,machines:n,shortcut:r,showShortcut:i,active:a,onClick:o,onClose:s,...c}){let l=TC(e),u=l.presence.some(e=>v(e,l.path)===`working`),d=l.status===`offline`,f=HC(!l.doc||d),[p,m]=(0,W.useState)(!1),h=l.doc?.name??e.file.split(`/`).pop()?.replace(/\.design$/,``),g=(0,G.jsxs)(`div`,{className:YT(`group app-no-drag relative flex h-7 max-w-[220px] shrink-0 cursor-default select-none items-center whitespace-nowrap rounded-lg px-2.5 outline-none`,a?`bg-secondary text-foreground`:`text-muted-foreground hover:bg-accent hover:text-foreground`),onClick:o,onKeyDown:e=>e.key===`Enter`&&o(),role:`tab`,tabIndex:0,...c,onPointerDown:e=>{m(!0),c.onPointerDown(e)},onPointerLeave:()=>m(!1),children:[(0,G.jsxs)(`span`,{className:`-ml-1.5 flex min-w-0 items-center gap-[7px] pl-1.5 group-focus-visible:[mask-image:linear-gradient(to_left,transparent_14px,#000_32px)] group-hover:[mask-image:linear-gradient(to_left,transparent_14px,#000_32px)]`,children:[(0,G.jsx)(yx,{modifier:mk,n:r,shown:i,index:r,children:f?(0,G.jsx)(`span`,{className:`grid size-3.5 shrink-0 place-items-center`,title:d?`Reconnecting`:`Opening`,children:(0,G.jsx)(`span`,{className:YT(`size-3 animate-spin rounded-full border-[1.5px] border-current border-r-transparent text-faint motion-reduce:animate-none`,d&&`[animation-duration:2s]`)})}):(0,G.jsx)(q,{name:l.doc?.icon??`blank`,size:14})}),(0,G.jsx)(`span`,{className:YT(`truncate`,u&&`pz-shimmer`),children:h})]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Close tab`,className:`absolute top-1/2 right-1 grid size-[18px] -translate-y-1/2 place-items-center rounded-[5px] opacity-0 hover:bg-accent hover:opacity-100! group-focus-visible:opacity-60 group-hover:opacity-60`,onClick:e=>{e.stopPropagation(),s()},children:(0,G.jsx)(q,{name:`close`,size:12})})]});return(0,G.jsxs)(XO,{open:!p&&void 0,openDelay:600,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,onFocus:e=>{e.currentTarget.matches(`:focus-visible`)||e.preventDefault()},children:g}),(0,G.jsx)(QO,{align:`start`,side:`bottom`,children:(0,G.jsx)(rE,{file:t,name:h,machine:n?.find(e=>e.id===(t?.machine??`local`))})})]})}var xk={duration:150,easing:`ease-out`};function Sk(e,t){let n=(0,W.useRef)(null),r=(0,W.useRef)(e);r.current=e;let i=(0,W.useRef)(null),a=(0,W.useRef)(new Map),o=()=>{let e=i.current,t=n.current;if(!e||!t)return;let r=t.getBoundingClientRect().left-t.scrollLeft+e.el.offsetLeft;e.dx=Math.min(Math.max(e.x-e.grab-r,-e.el.offsetLeft),t.scrollWidth-e.el.offsetLeft-e.el.offsetWidth),e.el.style.transform=`translateX(${e.dx}px)`};return(0,W.useLayoutEffect)(()=>{for(let[e,t]of a.current){for(let t of e.getAnimations())t.cancel();let n=t-e.getBoundingClientRect().left;n&&e.animate([{transform:`translateX(${n}px)`},{transform:`none`}],xk)}a.current.clear(),o()},[e]),{strip:n,dragProps:e=>({onPointerDown:s=>{if(s.button!==0||s.target.closest(`button`))return;let c=s.currentTarget,l=s.clientX-c.getBoundingClientRect().left,u=u=>{let d=n.current;if(!d)return;if(!i.current){if(Math.abs(u.clientX-s.clientX)<4)return;i.current={el:c,grab:l,x:u.clientX,dx:0},c.style.zIndex=`1`}let f=i.current;f.x=u.clientX,o();let p=[...d.children].filter(e=>e instanceof HTMLElement&&e!==c),m=d.getBoundingClientRect().left-d.scrollLeft,h=f.x-f.grab-m+c.offsetWidth/2,g=p.filter(e=>e.offsetLeft+e.offsetWidth/2<h).length,_=r.current;if(g===_.indexOf(e))return;for(let e of p)a.current.set(e,e.getBoundingClientRect().left);let v=_.filter(t=>t!==e);v.splice(g,0,e),t(v)},d=()=>{window.removeEventListener(`pointermove`,u),window.removeEventListener(`pointerup`,d),window.removeEventListener(`pointercancel`,d);let e=i.current;i.current=null,e&&(c.style.transform=``,c.animate([{transform:`translateX(${e.dx}px)`},{transform:`none`}],xk).finished.then(()=>{c.style.zIndex=``}).catch(()=>{}))};window.addEventListener(`pointermove`,u),window.addEventListener(`pointerup`,d),window.addEventListener(`pointercancel`,d)}})}}var Ck=32;function wk(e,t){(0,W.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{let e=Math.min(Ck,t.clientWidth/4),n=t.scrollWidth-t.clientWidth-t.scrollLeft;t.style.setProperty(`--fade-start`,`${Math.min(Math.max(t.scrollLeft,0),e)}px`),t.style.setProperty(`--fade-end`,`${Math.min(Math.max(n,0),e)}px`)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=new ResizeObserver(n);r.observe(t);for(let e of t.children)r.observe(e);return()=>{t.removeEventListener(`scroll`,n),r.disconnect()}},[e,t])}function Tk({source:e}){let{presence:t,path:n,doc:r}=TC(e),i=Ok(15e3),a=t.map(e=>({p:e,activity:v(e,n,i)})).filter(e=>e.activity);return a.length?(0,G.jsx)(`div`,{className:`flex gap-0.5 pr-1`,children:a.map(({p:e,activity:t})=>(0,G.jsxs)(XO,{openDelay:150,closeDelay:100,children:[(0,G.jsx)(ZO,{asChild:!0,children:(0,G.jsx)(`span`,{className:YT(`app-no-drag grid size-6 cursor-default place-items-center rounded-md transition-opacity duration-200 hover:bg-accent`,t===`watching`&&`opacity-50`),children:(0,G.jsx)(Oc,{client:e.client,size:16})})}),(0,G.jsx)(QO,{children:(0,G.jsx)(Ek,{presence:e,activity:t,doc:r})})]},e.id))}):null}function Ek({presence:e,activity:t,doc:n}){let r=Dk(e),i=n?e.working.map(e=>F(n,e)?.artboard.name).filter(Boolean):[],a=[];return e.origin?.cwd&&a.push([`Project`,(0,G.jsx)(`span`,{className:YT(kk,`truncate`),title:e.origin.cwd,children:ZT(e.origin.cwd)},`cwd`)]),a.push([`Via`,e.origin?.via===`bridge`?(0,G.jsxs)(`span`,{children:[`Terminal · `,(0,G.jsx)(`span`,{className:kk,children:`ponzu mcp`})]},`via`):`MCP over HTTP`]),a.push([`Since`,`${Ax(e.since)}${Ax(e.since)===`now`?``:` ago`}`]),i.length&&a.push([`On`,i.join(`, `)]),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,G.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-canvas`,children:(0,G.jsx)(Oc,{client:e.client,size:16})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`b`,{className:`font-semibold`,children:r}),(0,G.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:t===`working`?`Working${e.status?` · ${e.status}`:``}`:`Watching for your comments`})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[56px_minmax(0,1fr)] gap-x-2.5 gap-y-1.5 border-t pt-2.5 text-xs`,children:a.map(([e,t])=>(0,G.jsxs)(W.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`flex min-w-0`,children:t})]},e))})]})}function Dk(e){let t=e.origin?.clientName,n=t?{"claude-code":`Claude Code`,"claude-ai":`Claude`,codex:`Codex`,"codex-mcp-client":`Codex`,cursor:`Cursor`,"cursor-vscode":`Cursor`}[t]??t:e.name;return e.origin?.clientVersion?`${n} ${e.origin.clientVersion}`:n}function Ok(e){let[t,n]=(0,W.useState)(Date.now);return(0,W.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var kk=`font-mono text-xs`,Ak=document.getElementById(`root`);(0,g.createRoot)(Ak).render((0,G.jsx)(yk,{}));
|
package/studio/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="icon" href="/favicon.svg" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
9
9
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..600&family=Funnel+Display:wght@700&family=IBM+Plex+Mono:wght@400;500&display=swap" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-DSVfDuFP.js"></script>
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/index-BZh-aQhF.css">
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|