foss-design 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -54,7 +54,7 @@ Error generating stack: `+e.message+`
|
|
|
54
54
|
`},wh=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Th=function(){v.useEffect(function(){return document.body.setAttribute(Sh,(wh()+1).toString()),function(){var e=wh()-1;e<=0?document.body.removeAttribute(Sh):document.body.setAttribute(Sh,e.toString())}},[])},Eh=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Th();var a=v.useMemo(function(){return bh(i)},[i]);return v.createElement(xh,{styles:Ch(a,!t,i,n?``:`!important`)})},Dh=!1;if(typeof window<`u`)try{var Oh=Object.defineProperty({},"passive",{get:function(){return Dh=!0,!0}});window.addEventListener(`test`,Oh,Oh),window.removeEventListener(`test`,Oh,Oh)}catch{Dh=!1}var kh=Dh?{passive:!1}:!1,Ah=function(e){return e.tagName===`TEXTAREA`},jh=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Ah(e)&&n[t]===`visible`)},Mh=function(e){return jh(e,`overflowY`)},Nh=function(e){return jh(e,`overflowX`)},Ph=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Lh(e,r)){var i=Rh(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fh=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ih=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Lh=function(e,t){return e===`v`?Mh(t):Nh(t)},Rh=function(e,t){return e===`v`?Fh(t):Ih(t)},zh=function(e,t){return e===`h`&&t===`rtl`?-1:1},Bh=function(e,t,n,r,i){var a=zh(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Rh(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Lh(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Vh=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hh=function(e){return[e.deltaX,e.deltaY]},Uh=function(e){return e&&`current`in e?e.current:e},Wh=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Gh=function(e){return`
|
|
55
55
|
.block-interactivity-${e} {pointer-events: none;}
|
|
56
56
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
57
|
-
`},Kh=0,qh=[];function Jh(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(Kh++)[0],a=v.useState(gh)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Km([e.lockRef.current],(e.shards||[]).map(Uh),!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=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Vh(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=Ph(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ph(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 Bh(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(qh.length&&qh[qh.length-1]===a){var r=`deltaY`in n?Hh(n):Vh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Wh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Uh).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=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Yh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=Vh(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,Hh(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,Vh(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return qh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,kh),document.addEventListener(`touchmove`,c,kh),document.addEventListener(`touchstart`,u,kh),function(){qh=qh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,kh),document.removeEventListener(`touchmove`,c,kh),document.removeEventListener(`touchstart`,u,kh)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:Gh(i)}):null,p?v.createElement(Eh,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Yh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xh=oh(sh,Jh),Zh=v.forwardRef(function(e,t){return v.createElement(lh,Wm({},e,{ref:t,sideCar:Xh}))});Zh.classNames=lh.classNames;var Qh=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$h=new WeakMap,eg=new WeakMap,tg={},ng=0,rg=function(e){return e&&(e.host||rg(e.parentNode))},ig=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=rg(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})},ag=function(e,t,n,r){var i=ig(t,Array.isArray(e)?e:[e]);tg[n]||(tg[n]=new WeakMap);var a=tg[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=($h.get(e)||0)+1,l=(a.get(e)||0)+1;$h.set(e,c),a.set(e,l),o.push(e),c===1&&i&&eg.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(),ng++,function(){o.forEach(function(e){var t=$h.get(e)-1,i=a.get(e)-1;$h.set(e,t),a.set(e,i),t||(eg.has(e)||e.removeAttribute(r),eg.delete(e)),i||e.removeAttribute(n)}),ng--,ng||($h=new WeakMap,$h=new WeakMap,eg=new WeakMap,tg={})}},og=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qh(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ag(r,i,n,`aria-hidden`)):function(){return null}},sg=Object.defineProperty,cg=(e,t)=>sg(e,`name`,{value:t,configurable:!0}),lg=`Dialog`,[ug,dg]=ap(lg),[fg,pg]=ug(lg),mg=cg(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=xp({prop:r,defaultProp:i??!1,onChange:a,caller:lg}),[d,f]=v.useState(0),[p,m]=v.useState(0);return(0,I.jsx)(fg,{scope:t,triggerRef:s,contentRef:c,contentId:fp(),titleId:fp(),descriptionId:fp(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),hg=`DialogPortal`,[gg,_g]=ug(hg,{forceMount:void 0}),vg=cg(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=pg(hg,t);return(0,I.jsx)(gg,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),yg=`DialogOverlay`,bg=v.forwardRef(cg(function(e,t){let n=_g(yg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pg(yg,e.__scopeDialog);return a.modal?(0,I.jsx)(jm,{present:r||a.open,children:(0,I.jsx)(Sg,{...i,ref:t})}):null},`DialogOverlay`)),xg=kp(`DialogOverlay.RemoveScroll`),Sg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,...r}=e,i=pg(yg,n),a=tp(t,rm());return(0,I.jsx)(Zh,{as:xg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,I.jsx)(Wp.div,{"data-state":Ag(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Cg=`DialogContent`,wg=v.forwardRef(cg(function(e,t){let n=_g(Cg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pg(Cg,e.__scopeDialog);return(0,I.jsx)(jm,{present:r||a.open,children:a.modal?(0,I.jsx)(Tg,{...i,ref:t}):(0,I.jsx)(Eg,{...i,ref:t})})},`DialogContent`)),Tg=v.forwardRef(cg(function(e,t){let n=pg(Cg,e.__scopeDialog),r=v.useRef(null),i=tp(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(Dg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Eg=v.forwardRef(cg(function(e,t){let n=pg(Cg,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,I.jsx)(Dg,{...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`)),Dg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=pg(Cg,n);return Hm(),(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(mm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,I.jsx)(nm,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Ag(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Og=`DialogTitle`,kg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,...r}=e,i=pg(Og,n),{setTitleCount:a}=i;return sp(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,I.jsx)(Wp.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`));function Ag(e){return e?`open`:`closed`}cg(Ag,`getState`);var jg=window.__DESIGN_STATIC__===!0,Mg=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Ng(e,t){let n=await fetch(e,{cache:t});if(!n.ok){let e=`${n.status} ${n.statusText}`;try{let t=await n.json();t.error&&(e=t.error)}catch{}throw new Mg(n.status,e)}return await n.json()}async function Pg(e){try{return await e}catch(e){if(e instanceof Mg&&e.status===404)return null;throw e}}var Fg=``;function Ig(e){return Fg!==e.version&&(Fg=e.version,console.info(`foss-design ${e.version}${jg?` (static build)`:``}`)),e}var Lg={live:!0,project:()=>Ng(`/api/project`,`no-store`).then(Ig),canvas:async e=>({doc:await Ng(`/api/canvas/${encodeURIComponent(e)}`,`no-store`),base:``}),system:async()=>{let e=await Pg(Ng(`/api/system`,`no-store`));return e?{doc:e,base:``}:null},async source(e){let t=await fetch(`/api/source?path=${encodeURIComponent(e)}`,{cache:`no-store`});if(!t.ok)throw new Mg(t.status,`Could not read ${e}`);return t.text()}},Rg=null,zg={live:!1,project:()=>Ng(`api/project.json`,`default`).then(Ig),canvas:async e=>({doc:await Ng(`api/canvas/${encodeURIComponent(e)}.json`,`default`),base:``}),system:async()=>{let e=await Pg(Ng(`api/system.json`,`default`));return e?{doc:e,base:``}:null},async source(e){Rg??=Ng(`api/sources.json`,`default`).catch(()=>({}));let t=(await Rg)[e];if(t===void 0)throw new Mg(404,`${e} is not in this build`);return t}};function Bg(e,t){if(!t)return e;try{let n=new URL(t.endsWith(`/`)?t:`${t}/`,document.baseURI);return new URL(e,n).href}catch{return e}}function Vg(e,t){if(!t)return e;let n=e=>Bg(e,t);return{...e,pages:e.pages.map(e=>({...e,sections:e.sections.map(e=>({...e,items:e.items.map(e=>{if(e.kind===`screen`){let t=e=>e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t&&n(t)])):void 0;return{...e,url:n(e.url),snapshots:t(e.snapshots),thumbs:t(e.thumbs)}}return e.kind===`image`?{...e,url:n(e.url)}:e})}))}))}}function Hg(e,t){if(!t)return e;let n=e=>Bg(e,t);return{...e,components:e.components.map(e=>({...e,url:n(e.url)})),assets:e.assets.map(e=>({...e,url:n(e.url)})),typographyUrl:e.typographyUrl&&n(e.typographyUrl)}}function Ug(e){return{all:[`design`,e],project:[`design`,e,`project`],canvas:t=>[`design`,e,`canvas`,t],system:[`design`,e,`system`],sources:[`design`,e,`source`],source:(t,n)=>[`design`,e,`source`,t,n]}}var Wg=new WeakMap,Gg=0;function Kg(e){let t=Wg.get(e);return t||(Gg+=1,t=String(Gg),Wg.set(e,t)),t}var qg=(0,v.createContext)(null);function Jg(){let e=(0,v.useContext)(qg);if(!e)throw Error(`foss-design: this component renders inside <DesignViewer>`);return e}function Yg(e,t){if(e===t)return!0;try{return decodeURIComponent(e)===t}catch{return!1}}function Xg(e){return new Vt({defaultOptions:{queries:{staleTime:e?0:1/0,retry:1,refetchOnWindowFocus:!1}}})}function Zg(){let{source:e,keys:t,scope:n}=Jg();return $t({queryKey:t.project,queryFn:()=>e.project(),enabled:!n})}function Qg(e,t=!0){let{source:n,keys:r}=Jg();return $t({queryKey:r.canvas(e),queryFn:async()=>{let{doc:t,base:r}=await n.canvas(e);return Vg(t,r)},placeholderData:e=>e,enabled:t})}function $g(e=!0){let{source:t,keys:n}=Jg();return $t({queryKey:n.system,queryFn:async()=>{let e=await t.system();return e?Hg(e.doc,e.base):null},enabled:e})}function e_(e,t=`system`){let{source:n,keys:r}=Jg();return $t({queryKey:r.source(t,e??``),queryFn:()=>n.source(e,t),enabled:!!e})}function t_(e,t){let n=null,r=!1;return n=new EventSource(`/api/events`),n.onopen=()=>{r&&(r=!1,e.invalidateQueries({queryKey:t.all}))},n.onerror=()=>{r=!0},n.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r.type===`project`)e.invalidateQueries({queryKey:t.project});else if(r.type===`system`)e.invalidateQueries({queryKey:t.system}),e.invalidateQueries({queryKey:t.sources});else if(r.type===`canvas`||r.type===`snapshot`){let n=r.type===`canvas`?r.id:r.canvas;e.invalidateQueries({queryKey:t.canvas(n)}),r.type===`snapshot`&&e.invalidateQueries({queryKey:t.project})}},()=>n?.close()}function X(...e){return e.filter(Boolean).join(` `)}var n_=null;function r_(e,t){n_={canvas:e,item:t},window.dispatchEvent(new CustomEvent(`design:focus`,{detail:n_}))}function i_(e){if(!n_||n_.canvas!==e)return null;let t=n_.item;return n_=null,t}var a_=class{value;listeners=new Set;constructor(e){this.value=e}get=()=>this.value;set=e=>{let t=typeof e==`function`?e(this.value):e;if(!Object.is(t,this.value)){this.value=t;for(let e of this.listeners)e()}};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})};function o_(e,t=e=>e){return(0,v.useSyncExternalStore)(e.subscribe,()=>t(e.get()),()=>t(e.get()))}var s_=`foss-design.theme`;function c_(){try{let e=localStorage.getItem(s_);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var l_=new a_(c_()),u_=window.matchMedia(`(prefers-color-scheme: dark)`);function d_(e){return e===`system`?u_.matches?`dark`:`light`:e}function f_(){document.documentElement.dataset.theme=d_(l_.get())}u_.addEventListener(`change`,f_),l_.subscribe(f_),f_();function p_(e){try{localStorage.setItem(s_,e)}catch{}l_.set(e)}function m_(){return o_(l_)}function h_(){let e=o_(l_),t=(0,v.useSyncExternalStore)(e=>(u_.addEventListener(`change`,e),()=>u_.removeEventListener(`change`,e)),()=>u_.matches);return e===`system`?t?`dark`:`light`:e}var g_={plus:`<path d="M5 12h14"/><path d="M12 5v14"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,"chevron-down":`<path d="m6 9 6 6 6-6"/>`,"chevron-up":`<path d="m18 15-6-6-6 6"/>`,"chevron-right":`<path d="m9 18 6-6-6-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,chevrons:`<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>`,copy:`<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,bell:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,refresh:`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`,"up-right":`<path d="M7 7h10v10"/><path d="M7 17 17 7"/>`,"down-left":`<path d="M17 7 7 17"/><path d="M17 17H7V7"/>`,external:`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"user-plus":`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M19 8v6"/><path d="M22 11h-6"/>`,user:`<circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`,more:`<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>`,alert:`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>`,info:`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,upload:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>`,download:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>`,shield:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`,logout:`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>`,loader:`<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,"circle-check":`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,"circle-dashed":`<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`,send:`<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>`,chat:`<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>`,wallet:`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>`,"file-code":`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/>`,ban:`<circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/>`,code:`<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>`,"chevron-left":`<path d="m15 18-6-6 6-6"/>`,bluetooth:`<path d="m7 7 10 10-5 5V2l5 5L7 17"/>`,face:`<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>`,eye:`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`,clipboard:`<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>`,grip:`<circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/>`,list:`<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>`,lock:`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,hw:`<rect width="20" height="10" x="2" y="7" rx="2"/><path d="M15 7v10"/><circle cx="8" cy="12" r="1.5"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,signal:`<path d="M2 20h.01"/><path d="M7 20v-4"/><path d="M12 20v-8"/><path d="M17 20V8"/>`,grid:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>`,coins:`<circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="m16.71 13.88.7.71-2.82 2.82"/>`,arrows:`<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>`,key:`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`,blocks:`<rect width="7" height="7" x="14" y="3" rx="1"/><path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"/>`,settings:`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,qr:`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`,edit:`<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>`,home:`<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,"arrow-left":`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`,play:`<polygon points="6 3 20 12 6 21 6 3"/>`,"zoom-in":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>`,"zoom-out":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M8 11h6"/>`,fit:`<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>`,"panel-left":`<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>`,layers:`<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,file:`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>`,palette:`<circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.96 6.01 17.46 2 12 2z"/>`,type:`<path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/>`,shape:`<path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M21 19a2 2 0 0 1-2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h1"/><path d="M14 3h1"/><path d="M14 21h1"/><path d="M3 9v1"/><path d="M21 9v1"/><path d="M3 14v1"/><path d="M21 14v1"/>`,motion:`<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 6c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>`,book:`<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,image:`<rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>`,monitor:`<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/>`,tablet:`<rect width="16" height="20" x="4" y="2" rx="2"/><path d="M12 18h.01"/>`,note:`<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,pointer:`<path d="M4.04 4.69a.5.5 0 0 1 .65-.65l16 6.5a.5.5 0 0 1-.06.95l-6.12 1.58a2 2 0 0 0-1.44 1.44l-1.58 6.12a.5.5 0 0 1-.95.06z"/>`,component:`<path d="M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5Z"/><path d="m12 2 3.5 3.5L12 9 8.5 5.5 12 2Z"/><path d="M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5Z"/><path d="m12 15 3.5 3.5L12 22l-3.5-3.5L12 15Z"/>`,keyboard:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>`,folder:`<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>`,canvas:`<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>`};function Z({name:e,size:t=16,strokeWidth:n=1.75,className:r}){return(0,I.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`shrink-0 ${e===`loader`?`animate-spin`:``} ${r??``}`,dangerouslySetInnerHTML:{__html:g_[e]}})}function Q({children:e,size:t=12.5,className:n,title:r,wrap:i}){return(0,I.jsx)(`span`,{title:r,className:X(i?`break-all`:`whitespace-nowrap`,`font-mono`,n),style:{fontSize:t},children:e})}function __({children:e}){return(0,I.jsx)(`kbd`,{className:`rounded-[4px] border border-rule bg-surface px-[5px] py-px font-mono text-[11px] text-ink2`,children:e})}function v_({top:e,bottom:t,weight:n=500}){return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px`,children:[(0,I.jsx)(`span`,{className:`truncate leading-[1.35]`,style:{fontWeight:n},children:e}),t?(0,I.jsx)(`span`,{className:`flex min-w-0 items-center gap-2.5 overflow-hidden whitespace-nowrap text-[12.5px] leading-[1.35] text-muted`,children:t}):null]})}var y_={canvas:`This canvas`,canvases:`Canvases`,system:`Design system`,actions:`Actions`};function b_(e){let t=/^\/c\/([^/]+)/.exec(e);return t?decodeURIComponent(t[1]):null}function x_({onClose:e}){let[t,n]=P(),r=Jg().scope,i=Zg().data,a=r?.canvas??b_(t),o=Qg(a??``,!!a).data,s=$g(!!i?.system).data,[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(0),f=t=>()=>{e(),t()},p=[];if(o)for(let e of o.pages){p.push({id:`page:${e.id}`,group:`canvas`,label:e.title,icon:`file`,hint:`Page`,run:f(()=>n(`/c/${encodeURIComponent(o.id)}/p/${encodeURIComponent(e.id)}`))});for(let t of e.sections)for(let r of t.items)(r.kind===`screen`||r.kind===`url`)&&p.push({id:`item:${e.id}:${r.id}`,group:`canvas`,label:r.title,icon:r.kind===`url`?`globe`:`monitor`,hint:t.title?`${e.title} · ${t.title}`:e.title,keywords:`${r.id} ${t.title??``}`,searchOnly:!0,run:f(()=>{n(`/c/${encodeURIComponent(o.id)}/p/${encodeURIComponent(e.id)}`),r_(o.id,r.id)})})}for(let e of i?.canvases??[])e.id!==a&&p.push({id:`canvas:${e.id}`,group:`canvases`,label:e.title,icon:`canvas`,hint:`${e.screens} screens`,keywords:e.id,run:f(()=>n(`/c/${encodeURIComponent(e.id)}`))});if(i?.system){for(let[e,t,r]of[[`Overview`,`/system`,`book`],[`Colors`,`/system/colors`,`palette`],[`Typography`,`/system/typography`,`type`],[`Spacing & shape`,`/system/shape`,`shape`]])p.push({id:`sys:${t}`,group:`system`,label:e,icon:r,run:f(()=>n(t))});for(let e of s?.components??[])p.push({id:`component:${e.id}`,group:`system`,label:e.title,icon:`component`,hint:e.group,searchOnly:!0,run:f(()=>n(`/system/components/${encodeURIComponent(e.id)}`))});for(let e of s?.guidelines??[])p.push({id:`guide:${e.slug}`,group:`system`,label:e.title,icon:`book`,hint:`Guideline`,searchOnly:!0,run:f(()=>n(`/system/guidelines/${encodeURIComponent(e.slug)}`))})}r||p.push({id:`home`,group:`actions`,label:`All canvases`,icon:`home`,run:f(()=>n(`/`))}),p.push({id:`light`,group:`actions`,label:`Light appearance`,icon:`sun`,searchOnly:!0,run:f(()=>p_(`light`))},{id:`dark`,group:`actions`,label:`Dark appearance`,icon:`moon`,searchOnly:!0,run:f(()=>p_(`dark`))},{id:`system-theme`,group:`actions`,label:`System appearance`,icon:`monitor`,searchOnly:!0,run:f(()=>p_(`system`))});let m=c.trim().toLowerCase(),h=p.filter(e=>m?`${e.label} ${e.keywords??``} ${typeof e.hint==`string`?e.hint:``}`.toLowerCase().includes(m):!e.searchOnly),g=[`canvas`,`canvases`,`system`,`actions`].map(e=>({group:e,items:h.filter(t=>t.group===e)})).filter(e=>e.items.length),_=g.flatMap(e=>e.items),y=Math.min(u,Math.max(_.length-1,0)),b=-1;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(kg,{className:`sr-only`,children:`Search and jump`}),(0,I.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-rule px-4`,children:[(0,I.jsx)(Z,{name:`search`,size:16,className:`text-muted`}),(0,I.jsx)(`input`,{value:c,onChange:e=>{l(e.target.value),d(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),d((y+1)%Math.max(_.length,1))):e.key===`ArrowUp`?(e.preventDefault(),d((y-1+_.length)%Math.max(_.length,1))):e.key===`Enter`&&(e.preventDefault(),_[y]?.run())},placeholder:`Canvases, screens, components…`,"aria-label":`Search and jump`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`palette-list`,autoComplete:`off`,spellCheck:!1,className:`h-full min-w-0 grow border-0 bg-transparent text-[15px] text-ink outline-none placeholder:text-muted`}),(0,I.jsx)(__,{children:`esc`})]}),(0,I.jsx)(`div`,{id:`palette-list`,role:`listbox`,className:`min-h-0 grow overflow-y-auto py-1.5`,children:g.length?g.map(({group:e,items:t})=>(0,I.jsxs)(`div`,{role:`presentation`,children:[(0,I.jsx)(`div`,{className:`px-4 pt-2.5 pb-1 text-[12px] text-muted`,children:y_[e]}),t.map(e=>{b+=1;let t=b,n=t===y;return(0,I.jsxs)(`button`,{type:`button`,role:`option`,tabIndex:-1,"aria-selected":n,ref:n?e=>e?.scrollIntoView({block:`nearest`}):void 0,onMouseMove:()=>n?void 0:d(t),onClick:e.run,className:X(`flex h-10 w-full cursor-pointer items-center gap-3 border-0 px-4 text-left text-[13.5px] text-ink`,n?`bg-soft`:`bg-transparent`),children:[(0,I.jsx)(`span`,{className:`flex w-5 shrink-0 justify-center text-ink2`,children:(0,I.jsx)(Z,{name:e.icon,size:16})}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.label}),e.hint?(0,I.jsx)(`span`,{className:`flex shrink-0 items-center text-[12.5px] text-muted`,children:e.hint}):null]},e.id)})]},e)):(0,I.jsx)(`div`,{className:`px-6 py-10 text-center text-[13px] text-muted`,children:`Nothing matches.`})}),(0,I.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-4 border-t border-rule bg-soft px-4 text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(__,{children:`↑`}),(0,I.jsx)(__,{children:`↓`}),`move`]}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(__,{children:`↵`}),`open`]})]})]})}function S_(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=()=>t(e=>!e),n=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())};return window.addEventListener(`keydown`,n),window.addEventListener(`design:palette`,e),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`design:palette`,e)}},[]),(0,I.jsx)(mg,{open:e,onOpenChange:t,children:(0,I.jsx)(ed,{children:e?(0,I.jsx)(vg,{forceMount:!0,children:(0,I.jsx)(bg,{asChild:!0,forceMount:!0,children:(0,I.jsx)(Wf.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.14},className:`fixed inset-0 z-50 flex items-start justify-center bg-overlay p-6 pt-[12vh]`,children:(0,I.jsx)(wg,{asChild:!0,forceMount:!0,"aria-describedby":void 0,children:(0,I.jsx)(Wf.div,{initial:{opacity:0,scale:.98,y:-6},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,transition:{duration:.1}},transition:{type:`spring`,stiffness:560,damping:40},className:`flex max-h-[min(560px,76vh)] w-[560px] max-w-full flex-col overflow-hidden rounded-[12px] border border-rule bg-surface shadow-pop outline-none`,children:(0,I.jsx)(x_,{onClose:()=>t(!1)})})})})})}):null})})}var C_=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`;function w_(){window.dispatchEvent(new CustomEvent(`design:palette`))}function T_({width:e=240,label:t=`Search and jump`}){return(0,I.jsxs)(`button`,{type:`button`,onClick:w_,style:{width:e},className:`flex h-ctrl min-w-0 shrink cursor-pointer items-center gap-2 rounded-[6px] border border-rule bg-soft pr-1.5 pl-3 text-ctrl text-muted transition-colors hover:border-rule-strong max-lg:w-auto!`,children:[(0,I.jsx)(Z,{name:`search`,size:15}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate text-left max-lg:hidden`,children:t}),(0,I.jsx)(__,{children:C_===`⌘`?`⌘K`:`Ctrl K`})]})}var E_={primary:`border border-primary bg-primary text-primary-ink hover:opacity-90`,secondary:`border border-rule-strong bg-surface text-ink hover:bg-soft`,ghost:`border border-transparent bg-transparent text-ink2 hover:bg-soft2`,dashed:`border border-dashed border-rule-strong bg-transparent text-ink2 hover:bg-soft`,danger:`border border-danger bg-danger text-on-danger hover:opacity-90`},D_=(e=`secondary`,t)=>X(`inline-flex h-ctrl shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] px-ctrl text-ctrl font-medium leading-none no-underline transition-[background-color,opacity] duration-100`,`disabled:cursor-not-allowed disabled:opacity-45 aria-disabled:cursor-not-allowed aria-disabled:opacity-45`,E_[e],t),O_=(0,v.forwardRef)(function({kind:e=`secondary`,icon:t,loading:n,disabled:r,className:i,children:a,type:o=`button`,...s},c){return(0,I.jsxs)(`button`,{ref:c,type:o,disabled:r||n,"aria-busy":n||void 0,className:D_(e,i),...s,children:[n?(0,I.jsx)(Z,{name:`loader`,size:15,className:`animate-spin`}):t?(0,I.jsx)(Z,{name:t,size:15}):null,a]})}),k_={ghost:`border border-transparent bg-transparent text-muted hover:bg-soft2 hover:text-ink2`,secondary:`border border-rule-strong bg-surface text-ink2 hover:bg-soft`},A_=(e=`ghost`,t)=>X(`inline-flex h-ctrl w-ctrl shrink-0 cursor-pointer items-center justify-center rounded-[6px] p-0 transition-colors duration-100 disabled:cursor-not-allowed disabled:opacity-45`,k_[e],t),j_=(0,v.forwardRef)(function({icon:e,label:t,kind:n=`ghost`,size:r=16,className:i,type:a=`button`,...o},s){return(0,I.jsx)(`button`,{ref:s,type:a,"aria-label":t,title:t,className:A_(n,i),...o,children:(0,I.jsx)(Z,{name:e,size:r})})});function M_({to:e,kind:t=`secondary`,icon:n,className:r,children:i}){return(0,I.jsxs)(xe,{href:e,className:D_(t,r),children:[n?(0,I.jsx)(Z,{name:n,size:15}):null,i]})}function N_({kind:e=`secondary`,icon:t,className:n,children:r,...i}){return(0,I.jsxs)(`a`,{className:D_(e,n),...i,children:[t?(0,I.jsx)(Z,{name:t,size:15}):null,r]})}var P_=Object.defineProperty,F_=(e,t)=>P_(e,`name`,{value:t,configurable:!0});function I_(e){let t=e+`CollectionProvider`,[n,r]=ap(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=F_(e=>{let{scope:t,children:n}=e,r=v.useRef(null),a=v.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=kp(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(s,n).collectionRef);return(0,I.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=kp(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=tp(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return v.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return F_(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}F_(I_,`createCollection`);var L_=new WeakMap,R_=class e extends Map{static{F_(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],L_.set(this,!0)}set(e,t){return L_.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=V_(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=z_(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=z_(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return z_(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function z_(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=B_(e,t);return n===-1?void 0:e[n]}F_(z_,`at`);function B_(e,t){let n=e.length,r=V_(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}F_(B_,`toSafeIndex`);function V_(e){return e!==e||e===0?0:Math.trunc(e)}F_(V_,`toSafeInteger`);function H_(e){let t=e+`CollectionProvider`,[n,r]=ap(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new R_,setItemMap:F_(()=>void 0,`setItemMap`)}),o=F_(({state:e,...t})=>e?(0,I.jsx)(c,{...t,state:e}):(0,I.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=F_(e=>{let t=h();return(0,I.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=F_(e=>{let{scope:t,children:n,state:r}=e,a=v.useRef(null),[o,s]=v.useState(null),c=tp(a,s),[l,u]=r;return v.useEffect(()=>{if(!o)return;let e=K_(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,I.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=kp(l),d=v.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(l,n).collectionRef);return(0,I.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=kp(f),m=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),[s,c]=v.useState(null),l=tp(t,o,c),{setItemMap:u}=a(f,n),d=v.useRef(i);U_(d.current,i)||(d.current=i);let m=d.current;return v.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(G_):(t.set(s,{...e,element:s}),t.toSorted(G_)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new R_(e)))}},[s,m,u]),(0,I.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return v.useState(new R_)}F_(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return F_(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}F_(H_,`createCollection`);function U_(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}F_(U_,`shallowEqual`);function W_(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}F_(W_,`isElementPreceding`);function G_(e,t){return!e[1].element||!t[1].element?0:W_(e[1].element,t[1].element)?-1:1}F_(G_,`sortByDocumentPosition`);function K_(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}F_(K_,`getChildListObserver`);var q_=Object.defineProperty,J_=(e,t)=>q_(e,`name`,{value:t,configurable:!0}),Y_=v.createContext(void 0);function X_(e){let t=v.useContext(Y_);return e||t||`ltr`}J_(X_,`useDirection`);var Z_=[`top`,`right`,`bottom`,`left`],Q_=Math.min,$_=Math.max,ev=Math.round,tv=Math.floor,nv=e=>({x:e,y:e}),rv={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function iv(e,t,n){return $_(e,Q_(t,n))}function av(e,t){return typeof e==`function`?e(t):e}function ov(e){return e.split(`-`)[0]}function sv(e){return e.split(`-`)[1]}function cv(e){return e===`x`?`y`:`x`}function lv(e){return e===`y`?`height`:`width`}function uv(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dv(e){return cv(uv(e))}function fv(e,t,n){n===void 0&&(n=!1);let r=sv(e),i=dv(e),a=lv(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xv(o)),[o,xv(o)]}function pv(e){let t=xv(e);return[mv(e),t,mv(t)]}function mv(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hv=[`left`,`right`],gv=[`right`,`left`],_v=[`top`,`bottom`],vv=[`bottom`,`top`];function yv(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gv:hv:t?hv:gv;case`left`:case`right`:return t?_v:vv;default:return[]}}function bv(e,t,n,r){let i=sv(e),a=yv(ov(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mv)))),a}function xv(e){let t=ov(e);return rv[t]+e.slice(t.length)}function Sv(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Cv(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sv(e)}function wv(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 Tv(e,t,n){let{reference:r,floating:i}=e,a=uv(t),o=dv(t),s=lv(o),c=ov(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=sv(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ev(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}=av(t,e),p=Cv(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wv(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=wv(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 Dv=50,Ov=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ev},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Tv(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<Dv&&(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}=Tv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kv=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}=av(e,t)||{};if(l==null)return{};let d=Cv(u),f={x:n,y:r},p=dv(i),m=lv(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=Q_(d[_],T),D=Q_(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=iv(E,k,O),j=!c.arrow&&sv(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),Av=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}=av(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ov(r),_=uv(o),v=ov(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xv(o)]:pv(o)),x=p!==`none`;!d&&x&&b.push(...bv(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=fv(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`||_===uv(t)||T.every(e=>uv(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=uv(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 jv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mv(e){return Z_.some(t=>e[t]>=0)}var Nv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=av(e,t);switch(i){case`referenceHidden`:{let e=jv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mv(e)}}}case`escaped`:{let e=jv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mv(e)}}}default:return{}}}}},Pv=new Set([`left`,`top`]);async function Fv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ov(n),s=sv(n),c=uv(n)===`y`,l=Pv.has(o)?-1:1,u=a&&c?-1:1,d=av(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 Iv=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 Fv(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}}}}},Lv=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}=av(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=uv(i),p=cv(f),m=u[p],h=u[f],g=(e,t)=>iv(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}}}}}},Rv=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}=av(e,t),u={x:n,y:r},d=uv(i),f=cv(d),p=u[f],m=u[d],h=av(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=Pv.has(ov(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}}}},zv=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}=av(e,t),c=await i.detectOverflow(t,s),l=ov(n),u=sv(n),d=uv(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=Q_(p-c[m],g),y=Q_(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*$_(c.left,c.right):S=p-2*$_(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 Bv(){return typeof window<`u`}function Vv(e){return Wv(e)?(e.nodeName||``).toLowerCase():`#document`}function Hv(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Uv(e){return((Wv(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wv(e){return Bv()?e instanceof Node||e instanceof Hv(e).Node:!1}function Gv(e){return Bv()?e instanceof Element||e instanceof Hv(e).Element:!1}function Kv(e){return Bv()?e instanceof HTMLElement||e instanceof Hv(e).HTMLElement:!1}function qv(e){return!Bv()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hv(e).ShadowRoot}function Jv(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ay(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yv(e){return/^(table|td|th)$/.test(Vv(e))}function Xv(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zv=/transform|translate|scale|rotate|perspective|filter/,Qv=/paint|layout|strict|content/,$v=e=>!!e&&e!==`none`,ey;function ty(e){let t=Gv(e)?ay(e):e;return $v(t.transform)||$v(t.translate)||$v(t.scale)||$v(t.rotate)||$v(t.perspective)||!ry()&&($v(t.backdropFilter)||$v(t.filter))||Zv.test(t.willChange||``)||Qv.test(t.contain||``)}function ny(e){let t=sy(e);for(;Kv(t)&&!iy(t);){if(ty(t))return t;if(Xv(t))return null;t=sy(t)}return null}function ry(){return ey??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ey}function iy(e){return/^(html|body|#document)$/.test(Vv(e))}function ay(e){return Hv(e).getComputedStyle(e)}function oy(e){return Gv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sy(e){if(Vv(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qv(e)&&e.host||Uv(e);return qv(t)?t.host:t}function cy(e){let t=sy(e);return iy(t)?(e.ownerDocument||e).body:Kv(t)&&Jv(t)?t:cy(t)}function ly(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cy(e),i=r===e.ownerDocument?.body,a=Hv(r);if(i){let e=uy(a);return t.concat(a,a.visualViewport||[],Jv(r)?r:[],e&&n?ly(e):[])}return t.concat(r,ly(r,[],n))}function uy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dy(e){let t=ay(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Kv(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ev(n)!==a||ev(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fy(e){return Gv(e)?e:e.contextElement}function py(e){let t=fy(e);if(!Kv(t))return nv(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dy(t),o=(a?ev(n.width):n.width)/r,s=(a?ev(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var my=nv(0);function hy(e){let t=Hv(e);return!ry()||!t.visualViewport?my:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Hv(e)}function _y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fy(e),o=nv(1);t&&(r?Gv(r)&&(o=py(r)):o=py(e));let s=gy(a,n,r)?hy(a):nv(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=Hv(a),t=Gv(r)?Hv(r):r,n=e,i=uy(n);for(;i&&t!==n;){let e=py(i),t=i.getBoundingClientRect(),r=ay(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=Hv(i),i=uy(n)}}return wv({width:u,height:d,x:c,y:l})}function vy(e,t){let n=oy(e).scrollLeft;return t?t.left+n:_y(Uv(e)).left+n}function yy(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vy(e,n),y:n.top+t.scrollTop}}function by(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Uv(r),s=t?Xv(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=nv(1),u=nv(0),d=Kv(r);if((d||!a)&&((Vv(r)!==`body`||Jv(o))&&(c=oy(r)),d)){let e=_y(r);l=py(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yy(o,c):nv(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 xy(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Sy(e){let t=oy(e),n=e.ownerDocument.body,r=$_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=$_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vy(e),o=-t.scrollTop;return ay(n).direction===`rtl`&&(a+=$_(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Cy=25;function wy(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Hv(e),a=Uv(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ry()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vy(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<=Cy&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ty(e,t){let n=_y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=py(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ey(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=wy(e,n,t);else if(t===`document`)r=Sy(Uv(e));else if(Gv(t))r=Ty(t,n);else{let n=hy(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wv(r)}function Dy(e,t){let n=t.get(e);if(n)return n;let r=ly(e,[],!1).filter(e=>Gv(e)&&Vv(e)!==`body`),i=null,a=ay(e).position===`fixed`,o=a?sy(e):e;for(;Gv(o)&&!iy(o);){let e=ay(o),t=ty(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=sy(o)}return t.set(e,r),r}function Oy(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xv(t)?[]:Dy(t,this._c):[].concat(n),r],o=Ey(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=Ey(t,a[e],i);s=$_(n.top,s),c=Q_(n.right,c),l=Q_(n.bottom,l),u=$_(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ky(e){let{width:t,height:n}=dy(e);return{width:t,height:n}}function Ay(e,t,n){let r=Kv(t),i=Uv(t),a=n===`fixed`,o=_y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=nv(0);if((r||!a)&&((Vv(t)!==`body`||Jv(i))&&(s=oy(t)),r)){let e=_y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vy(i));let l=i&&!r&&!a?yy(i,s):nv(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 jy(e){return ay(e).position===`static`}function My(e,t){if(!Kv(e)||ay(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Uv(e)===n&&(n=n.ownerDocument.body),n}function Ny(e,t){let n=Hv(e);if(Xv(e))return n;if(!Kv(e)){let t=sy(e);for(;t&&!iy(t);){if(Gv(t)&&!jy(t))return t;t=sy(t)}return n}let r=My(e,t);for(;r&&Yv(r)&&jy(r);)r=My(r,t);return r&&iy(r)&&jy(r)&&!ty(r)?n:r||ny(e)||n}var Py=async function(e){let t=this.getOffsetParent||Ny,n=this.getDimensions,r=await n(e.floating);return{reference:Ay(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fy(e){return ay(e).direction===`rtl`}var Iy={convertOffsetParentRelativeRectToViewportRelativeRect:by,getDocumentElement:Uv,getClippingRect:Oy,getOffsetParent:Ny,getElementRects:Py,getClientRects:xy,getDimensions:ky,getScale:py,isElement:Gv,isRTL:Fy};function Ly(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ry(e,t,n){let r=null,i,a=Uv(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=tv(d),h=tv(a.clientWidth-(u+f)),g=tv(a.clientHeight-(d+p)),_=tv(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:$_(0,Q_(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ly(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=Hv(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function zy(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=fy(e),u=i||a?[...l?ly(l):[],...t?ly(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ry(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?_y(e):null;c&&g();function g(){let t=_y(e);h&&!Ly(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 By=Iv,Vy=Lv,Hy=Av,Uy=zv,Wy=Nv,Gy=kv,Ky=Rv,qy=(e,t,n)=>{let r=new Map,i=n??{},a={...Iy,...i.platform,_c:r};return Ov(e,t,{...i,platform:a})},Jy=typeof document<`u`?v.useLayoutEffect:function(){};function Yy(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(!Yy(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)&&!Yy(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Xy(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zy(e,t){let n=Xy(e);return Math.round(t*n)/n}function Qy(e){let t=v.useRef(e);return Jy(()=>{t.current=e}),t}function $y(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]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);Yy(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Qy(c),O=Qy(i),k=Qy(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),qy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Yy(T.current,t)&&(T.current=t,Ep.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Jy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Jy(()=>(j.current=!0,()=>{j.current=!1}),[]),Jy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=v.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Zy(te.floating,u.x),r=Zy(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Xy(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:ee,elements:te,floatingStyles:ne}),[u,A,ee,te,ne])}var eb=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?{}:Gy({element:r.current,padding:i}).fn(n):r?Gy({element:r,padding:i}).fn(n):{}}}},tb=(e,t)=>{let n=By(e);return{name:n.name,fn:n.fn,options:[e,t]}},nb=(e,t)=>{let n=Vy(e);return{name:n.name,fn:n.fn,options:[e,t]}},rb=(e,t)=>({fn:Ky(e).fn,options:[e,t]}),ib=(e,t)=>{let n=Hy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ab=(e,t)=>{let n=Uy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ob=(e,t)=>{let n=Wy(e);return{name:n.name,fn:n.fn,options:[e,t]}},sb=(e,t)=>{let n=eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},cb=Object.defineProperty,lb=(e,t)=>cb(e,`name`,{value:t,configurable:!0});function ub(e){let[t,n]=v.useState(void 0);return sp(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}lb(ub,`useSize`);var db=Object.defineProperty,fb=(e,t)=>db(e,`name`,{value:t,configurable:!0}),pb=`Popper`,[mb,hb]=ap(pb),[gb,_b]=mb(pb),vb=fb(e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,I.jsx)(gb,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),yb=`PopperAnchor`,bb=v.forwardRef(fb(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=_b(yb,n),o=v.useRef(null),s=a.onAnchorChange,c=tp(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Db(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,I.jsx)(Wp.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),xb=`PopperContent`,[Sb,Cb]=mb(xb),wb=v.forwardRef(fb(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=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=_b(xb,n),[_,y]=v.useState(null),b=tp(t,y),[x,S]=v.useState(null),C=ub(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Tb),altBoundary:k},{refs:j,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:M}=$y({strategy:`fixed`,placement:E,whileElementsMounted:fb((...e)=>zy(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[tb({mainAxis:i+T,alignmentAxis:o}),c&&nb({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?rb():void 0,...A}),c&&ib({...A}),ab({...A,apply:fb(({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`)}),x&&sb({element:x,padding:s}),Eb({arrowWidth:w,arrowHeight:T}),f&&ob({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),re=g.setPlacementState;sp(()=>(re(te),()=>{re(void 0)}),[te,re]);let[ie,N]=Db(te),ae=Jp(m);sp(()=>{ne&&ae?.()},[ne,ae]);let oe=M.arrow?.x,se=M.arrow?.y,ce=M.arrow?.centerOffset!==0,[le,ue]=v.useState();return sp(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,I.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,I.jsx)(Sb,{scope:n,placedSide:ie,placedAlign:N,onArrowChange:S,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,I.jsx)(Wp.div,{"data-side":ie,"data-align":N,...h,ref:b,style:{...h.style,animation:ne?h.style?.animation:`none`}})})})},`PopperContent`));function Tb(e){return e!==null}fb(Tb,`isNotNull`);var Eb=fb(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]=Db(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 Db(e){let[t,n=`center`]=e.split(`-`);return[t,n]}fb(Db,`getSideAndAlignFromPlacement`);var Ob=vb,kb=bb,Ab=wb,jb=Object.defineProperty,Mb=(e,t)=>jb(e,`name`,{value:t,configurable:!0}),Nb=!1;function Pb(){let[e,t]=v.useState(Nb);return v.useEffect(()=>{Nb||(Nb=!0,t(!0))},[]),e}Mb(Pb,`useIsHydrated`);var Fb=v.useSyncExternalStore;function Ib(){return()=>{}}Mb(Ib,`subscribe`);function Lb(){return Fb(Ib,()=>!0,()=>!1)}Mb(Lb,`useIsHydratedModern`);var Rb=typeof Fb==`function`?Lb:Pb,zb=Object.defineProperty,Bb=(e,t)=>zb(e,`name`,{value:t,configurable:!0}),Vb=`rovingFocusGroup.onEntryFocus`,Hb={bubbles:!1,cancelable:!0},Ub=`RovingFocusGroup`,[Wb,Gb,Kb]=I_(Ub),[qb,Jb]=ap(Ub,[Kb]),[Yb,Xb]=qb(Ub),Zb=v.forwardRef(Bb(function(e,t){return(0,I.jsx)(Wb.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Wb.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Qb,{...e,ref:t})})})},`RovingFocusGroup`)),Qb=v.forwardRef(Bb(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=v.useRef(null),p=tp(t,f),m=X_(a),[h,g]=xp({prop:o,defaultProp:s??null,onChange:c,caller:Ub}),[_,y]=v.useState(!1),b=Jp(l),x=Gb(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Vb,b),()=>e.removeEventListener(Vb,b)},[b]),(0,I.jsx)(Yb,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,I.jsx)(Wp.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Y(e.onMouseDown,()=>{S.current=!0}),onFocus:Y(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Vb,Hb);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);ix([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Y(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),$b=`RovingFocusGroupItem`,ex=v.forwardRef(Bb(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=fp(),l=a||c,u=Xb($b,n),d=u.currentTabStopId===l,f=Gb(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Rb();return sp(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),v.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,I.jsx)(Wb.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,I.jsx)(Wp.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=rx(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?ax(n,r+1):n.slice(r+1)}setTimeout(()=>ix(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),tx={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function nx(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Bb(nx,`getDirectionAwareKey`);function rx(e,t,n){let r=nx(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return tx[r]}Bb(rx,`getFocusIntent`);function ix(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Bb(ix,`focusFirst`);function ax(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Bb(ax,`wrapArray`);var ox=Zb,sx=ex,cx=Object.defineProperty,lx=(e,t)=>cx(e,`name`,{value:t,configurable:!0}),ux=[`Enter`,` `],dx=[`ArrowDown`,`PageUp`,`Home`],fx=[`ArrowUp`,`PageDown`,`End`],px=[...dx,...fx];[...ux],[...ux];var mx=`Menu`,[hx,gx,_x]=I_(mx),[vx,yx]=ap(mx,[_x,hb,Jb]),bx=hb(),xx=Jb(),[Sx,Cx]=vx(mx),[wx,Tx]=vx(mx),Ex=lx(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=bx(t),[c,l]=v.useState(null),u=v.useRef(!1),d=Jp(a),f=X_(i);return v.useEffect(()=>{let e=lx(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=lx(()=>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})}},[]),v.useEffect(()=>{if(!n)return;let e=lx(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,I.jsx)(Ob,{...s,children:(0,I.jsx)(Sx,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,I.jsx)(wx,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Dx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e,i=bx(n);return(0,I.jsx)(kb,{...i,...r,ref:t})},`MenuAnchor`)),Ox=`MenuPortal`,[kx,Ax]=vx(Ox,{forceMount:void 0}),jx=lx(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Cx(Ox,t);return(0,I.jsx)(kx,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Mx=`MenuContent`,[Nx,Px]=vx(Mx),Fx=v.forwardRef(lx(function(e,t){let n=Ax(Mx,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Cx(Mx,e.__scopeMenu),o=Tx(Mx,e.__scopeMenu);return(0,I.jsx)(hx.Provider,{scope:e.__scopeMenu,children:(0,I.jsx)(jm,{present:r||a.open,children:(0,I.jsx)(hx.Slot,{scope:e.__scopeMenu,children:o.modal?(0,I.jsx)(Ix,{...i,ref:t}):(0,I.jsx)(Lx,{...i,ref:t})})})})},`MenuContent`)),Ix=v.forwardRef(lx(function(e,t){let n=Cx(Mx,e.__scopeMenu),r=v.useRef(null),i=tp(t,r);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(zx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Lx=v.forwardRef(lx(function(e,t){let n=Cx(Mx,e.__scopeMenu);return(0,I.jsx)(zx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Rx=kp(`MenuContent.ScrollLock`),zx=v.forwardRef(lx(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=Cx(Mx,n),_=Tx(Mx,n),y=bx(n),b=xx(n),x=gx(n),[S,C]=v.useState(null),w=v.useRef(null),T=tp(t,w,g.onContentChange),E=v.useRef(0),D=v.useRef(``),O=v.useRef(0),k=v.useRef(null),A=v.useRef(`right`),j=v.useRef(0),ee=m?Zh:v.Fragment,te=m?{as:Rx,allowPinchZoom:!0}:void 0,ne=lx(e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=rS(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;lx((function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);v.useEffect(()=>()=>window.clearTimeout(E.current),[]),Hm();let M=v.useCallback(e=>A.current===k.current?.side&&aS(e,k.current?.area),[]);return(0,I.jsx)(Nx,{scope:n,searchRef:D,onItemEnter:v.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:v.useCallback(e=>{M(e)||(w.current?.focus(),C(null))},[M]),onTriggerLeave:v.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(e=>{k.current=e},[]),children:(0,I.jsx)(ee,{...te,children:(0,I.jsx)(mm,{asChild:!0,trapped:i,onMountAutoFocus:Y(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,I.jsx)(ox,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Y(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,I.jsx)(Ab,{role:`menu`,"aria-orientation":`vertical`,"data-state":Qx(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:Y(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&&ne(e.key));let i=w.current;if(e.target!==i||!px.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);fx.includes(e.key)&&a.reverse(),tS(a)}),onBlur:Y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:Y(e.onPointerMove,oS(e=>{let t=e.target,n=j.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>j.current?`right`:`left`;A.current=t,j.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),Bx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e;return(0,I.jsx)(Wp.div,{...r,ref:t})},`MenuLabel`)),Vx=`MenuItem`,Hx=`menu.itemSelect`,Ux=v.forwardRef(lx(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=Tx(Vx,e.__scopeMenu),s=Px(Vx,e.__scopeMenu),c=tp(t,a),l=v.useRef(!1),u=lx(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Hx,{bubbles:!0,cancelable:!0});e.addEventListener(Hx,e=>r?.(e),{once:!0}),Gp(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,I.jsx)(Wx,{...i,ref:c,disabled:n,onClick:Y(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Y(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Y(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&ux.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Wx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Px(Vx,n),s=xx(n),c=v.useRef(null),l=tp(t,c),[u,d]=v.useState(!1),[f,p]=v.useState(``);return v.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,I.jsx)(hx.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,I.jsx)(sx,{asChild:!0,...s,focusable:!r,children:(0,I.jsx)(Wp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Y(e.onPointerMove,oS(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Y(e.onPointerLeave,oS(e=>o.onItemLeave(e))),onFocus:Y(e.onFocus,()=>d(!0)),onBlur:Y(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Gx,Kx]=vx(`MenuRadioGroup`,{value:void 0,onValueChange:lx(()=>{},`onValueChange`)}),[qx,Jx]=vx(`MenuItemIndicator`,{checked:!1}),Yx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e;return(0,I.jsx)(Wp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Xx,Zx]=vx(`MenuSub`);function Qx(e){return e?`open`:`closed`}lx(Qx,`getOpenState`);function $x(e){return e===`indeterminate`}lx($x,`isIndeterminate`);function eS(e){return $x(e)?`indeterminate`:e?`checked`:`unchecked`}lx(eS,`getCheckedState`);function tS(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}lx(tS,`focusFirst`);function nS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}lx(nS,`wrapArray`);function rS(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=nS(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}lx(rS,`getNextMatch`);function iS(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}lx(iS,`isPointInPolygon`);function aS(e,t){return t?iS({x:e.clientX,y:e.clientY},t):!1}lx(aS,`isPointerInGraceArea`);function oS(e){return t=>t.pointerType===`mouse`?e(t):void 0}lx(oS,`whenMouse`);var sS=Ex,cS=Dx,lS=jx,uS=Fx,dS=Bx,fS=Ux,pS=Yx,mS=Object.defineProperty,hS=(e,t)=>mS(e,`name`,{value:t,configurable:!0}),gS=`DropdownMenu`,[_S,vS]=ap(gS,[yx]),yS=yx(),[bS,xS]=_S(gS),SS=hS(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=yS(t),l=v.useRef(null),[u,d]=xp({prop:i,defaultProp:a??!1,onChange:o,caller:gS});return(0,I.jsx)(bS,{scope:t,triggerId:fp(),triggerRef:l,contentId:fp(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,I.jsx)(sS,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),CS=`DropdownMenuTrigger`,wS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=xS(CS,n),o=yS(n),s=tp(t,a.triggerRef);return(0,I.jsx)(cS,{asChild:!0,...o,children:(0,I.jsx)(Wp.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:Y(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Y(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),TS=hS(e=>{let{__scopeDropdownMenu:t,...n}=e,r=yS(t);return(0,I.jsx)(lS,{...r,...n})},`DropdownMenuPortal`),ES=`DropdownMenuContent`,DS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=xS(ES,n),a=yS(n),o=v.useRef(!1);return(0,I.jsx)(uS,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Y(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`)),OS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(dS,{...i,...r,ref:t})},`DropdownMenuLabel`)),kS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(fS,{...i,...r,ref:t})},`DropdownMenuItem`)),AS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(pS,{...i,...r,ref:t})},`DropdownMenuSeparator`)),jS=SS,MS=wS,NS=TS,PS=DS,FS=OS,IS=kS,LS=AS,RS=`z-50 overflow-hidden rounded-[8px] border border-rule bg-surface shadow-pop outline-none py-1 data-[state=open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function zS({trigger:e,children:t,width:n=220,align:r=`start`,side:i=`bottom`,sideOffset:a=6,open:o,onOpenChange:s}){return(0,I.jsxs)(jS,{open:o,onOpenChange:s,modal:!1,children:[(0,I.jsx)(MS,{asChild:!0,children:e}),(0,I.jsx)(NS,{children:(0,I.jsx)(PS,{align:r,side:i,sideOffset:a,collisionPadding:12,className:RS,style:{width:n},children:t})})]})}var BS=(e,t)=>X(`flex min-h-9 w-full cursor-pointer items-center gap-2.5 border-0 px-3 py-1.5 text-left text-[13.5px] outline-none select-none`,`data-[highlighted]:bg-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,t?`bg-soft`:`bg-transparent`,e?`text-danger-text`:`text-ink`);function VS({children:e,onSelect:t,danger:n,active:r,disabled:i,hint:a}){return(0,I.jsxs)(IS,{disabled:i,onSelect:t,className:BS(n,r),children:[e,a?(0,I.jsx)(`span`,{className:`ml-auto pl-3 text-[12px] text-muted`,children:a}):null]})}function HS(){return(0,I.jsx)(LS,{className:`my-1 h-px bg-rule`})}function US({children:e}){return(0,I.jsx)(FS,{className:`px-3 pt-1.5 pb-1 text-[12px] text-muted`,children:e})}var WS=[{value:`system`,label:`System`,icon:`monitor`},{value:`light`,label:`Light`,icon:`sun`},{value:`dark`,label:`Dark`,icon:`moon`}];function GS(){let e=m_(),t=h_();return(0,I.jsxs)(zS,{align:`end`,width:180,trigger:(0,I.jsx)(j_,{icon:t===`dark`?`moon`:`sun`,label:`Appearance`}),children:[(0,I.jsx)(US,{children:`Appearance`}),WS.map(t=>(0,I.jsxs)(VS,{active:e===t.value,onSelect:()=>p_(t.value),children:[(0,I.jsx)(Z,{name:t.icon,size:15,className:`text-ink2`}),t.label,e===t.value?(0,I.jsx)(Z,{name:`check`,size:15,className:`ml-auto text-ink2`}):null]},t.value))]})}function KS({size:e=24}){return(0,I.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,I.jsx)(`rect`,{width:`32`,height:`32`,rx:`7`,className:`fill-primary`}),(0,I.jsx)(`rect`,{x:`7`,y:`7`,width:`8`,height:`11`,rx:`1.5`,className:`fill-primary-ink`}),(0,I.jsx)(`rect`,{x:`17`,y:`7`,width:`8`,height:`6`,rx:`1.5`,fill:`#f0a040`}),(0,I.jsx)(`rect`,{x:`17`,y:`15`,width:`8`,height:`10`,rx:`1.5`,className:`fill-primary-ink`}),(0,I.jsx)(`rect`,{x:`7`,y:`20`,width:`8`,height:`5`,rx:`1.5`,className:`fill-primary-ink`})]})}function qS({name:e,version:t}){return(0,I.jsxs)(xe,{href:`/`,title:t?`foss-design ${t}`:void 0,className:`flex min-w-0 items-center gap-2 text-[14px] font-semibold text-ink no-underline`,children:[(0,I.jsx)(KS,{}),(0,I.jsx)(`span`,{className:`truncate`,children:e??`Design`})]})}function JS({children:e,className:t}){return(0,I.jsx)(`header`,{className:X(`sticky top-0 z-30 flex h-[52px] shrink-0 items-center gap-3 border-b border-rule bg-surface px-4`,t),children:e})}var YS=[{to:`/`,label:`Canvases`,match:e=>e===`/`||e.startsWith(`/c/`)},{to:`/system`,label:`Design system`,match:e=>e.startsWith(`/system`)}];function XS({location:e}){let t=(0,v.useRef)(null),n=YS.findIndex(t=>t.match(e)),[r,i]=(0,v.useState)(null);return(0,v.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let r=()=>{let t=e.children[n];if(!t?.offsetWidth){i(null);return}let r=t.offsetLeft+10,a=t.offsetWidth-20;i(e=>e?.tab===n&&e.x===r&&e.width===a?e:{tab:n,x:r,width:a,slide:e!==null&&e.tab!==n})};r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[n]),(0,I.jsxs)(`nav`,{ref:t,className:`relative flex h-[52px] items-stretch gap-0.5 max-md:hidden`,children:[YS.map((e,t)=>(0,I.jsx)(xe,{href:e.to,"aria-current":t===n?`page`:void 0,className:X(`flex items-center px-2.5 text-[14px] no-underline transition-colors`,t===n?`font-medium text-ink`:`text-ink2 hover:text-ink`),children:e.label},e.to)),r?(0,I.jsx)(Wf.span,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 h-[2px] bg-action`,initial:!1,animate:{x:r.x,width:r.width},transition:r.slide?{type:`spring`,stiffness:520,damping:42}:{duration:0}}):null]})}function ZS(){let e=Zg().data,{slots:t}=Jg(),[n]=P();return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(JS,{children:[t.barStart,(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-6`,children:[(0,I.jsx)(qS,{name:e?.name,version:e?.version}),(0,I.jsx)(XS,{location:n})]}),(0,I.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,I.jsx)(T_,{}),(0,I.jsx)(GS,{}),t.barEnd]})]}),t.belowBar]})}var QS=Object.defineProperty,$S=(e,t)=>QS(e,`name`,{value:t,configurable:!0}),eC=`Popover`,[tC,nC]=ap(eC,[hb]),rC=hb(),[iC,aC]=tC(eC),oC=$S(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rC(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=xp({prop:r,defaultProp:i??!1,onChange:a,caller:eC});return(0,I.jsx)(Ob,{...s,children:(0,I.jsx)(iC,{scope:t,contentId:fp(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),sC=`PopoverTrigger`,cC=v.forwardRef($S(function(e,t){let{__scopePopover:n,...r}=e,i=aC(sC,n),a=rC(n),o=tp(t,i.triggerRef),s=(0,I.jsx)(Wp.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":yC(i.open),...r,ref:o,onClick:Y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,I.jsx)(kb,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lC=`PopoverPortal`,[uC,dC]=tC(lC,{forceMount:void 0}),fC=$S(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=aC(lC,t);return(0,I.jsx)(uC,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),pC=`PopoverContent`,mC=v.forwardRef($S(function(e,t){let n=dC(pC,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=aC(pC,e.__scopePopover);return(0,I.jsx)(jm,{present:r||a.open,children:a.modal?(0,I.jsx)(gC,{...i,ref:t}):(0,I.jsx)(_C,{...i,ref:t})})},`PopoverContent`)),hC=kp(`PopoverContent.RemoveScroll`),gC=v.forwardRef($S(function(e,t){let n=aC(pC,e.__scopePopover),r=v.useRef(null),i=tp(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(Zh,{as:hC,allowPinchZoom:!0,children:(0,I.jsx)(vC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Y(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:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_C=v.forwardRef($S(function(e,t){let n=aC(pC,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,I.jsx)(vC,{...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`)),vC=v.forwardRef($S(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=aC(pC,n),p=rC(n);return Hm(),(0,I.jsx)(mm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,I.jsx)(Ab,{"data-state":yC(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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 yC(e){return e?`open`:`closed`}$S(yC,`getState`);var bC=oC,xC=cC,SC=fC,CC=mC,wC=new a_([]),TC=1;function EC(e,t,n=`ok`){let r=TC++;wC.set(i=>[...i.slice(-2),{id:r,title:e,text:t,tone:n}]),setTimeout(()=>wC.set(e=>e.filter(e=>e.id!==r)),n===`error`?4200:2200)}var DC=new a_([]),OC=1;function kC(){let[e]=(0,v.useState)(()=>OC++);(0,v.useEffect)(()=>(DC.set(t=>[...t,e]),()=>DC.set(t=>t.filter(t=>t!==e))),[e]);let t=o_(DC,t=>t[0]===e),n=o_(wC);return t?(0,I.jsx)(`div`,{className:`pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col items-center gap-2`,children:(0,I.jsx)(ed,{children:n.map(e=>(0,I.jsxs)(Wf.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,transition:{duration:.12}},transition:{type:`spring`,stiffness:520,damping:40},className:`flex max-w-[420px] items-center gap-2.5 rounded-[8px] border border-rule bg-surface px-3 py-2 text-[13px] text-ink shadow-pop`,children:[e.tone===`error`?(0,I.jsx)(Z,{name:`alert`,size:15,className:`text-danger-text`}):(0,I.jsx)(Z,{name:`check`,size:15,className:`text-ok-text`}),(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.text?(0,I.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.text}):null]},e.id))})}):null}async function AC(e,t=`Copied`){try{await navigator.clipboard.writeText(e),EC(t,e.length>64?void 0:e)}catch{EC(`Could not copy`,`The browser blocked clipboard access`,`error`)}}var jC=new Map;window.addEventListener(`message`,e=>{let t=e.data;if(t?.source===`design-runtime`&&e.source)for(let n of jC.get(e.source)??[])n(t)});function MC(e,t){let n=null,r=()=>{if(!n)return;let e=jC.get(n);e?.delete(t),e?.size||jC.delete(n),n=null},i=()=>{if(r(),n=e.contentWindow,!n)return;let i=jC.get(n)??new Set;i.add(t),jC.set(n,i)};return i(),e.addEventListener(`load`,i),()=>{e.removeEventListener(`load`,i),r()}}function NC(e,t){e?.contentWindow?.postMessage({source:`design-viewer`,...t},`*`)}function PC(e){NC(e,{type:`canvas`})}function FC(e,t){NC(e,{type:`theme`,theme:t})}function IC(e){e&&(e.src=e.src)}var LC=(()=>{if(jg)return``;let{protocol:e,hostname:t,port:n}=window.location,r=t===`localhost`?`127.0.0.1`:t===`127.0.0.1`?`localhost`:null;return r?`${e}//${r}${n?`:${n}`:``}`:``})();function RC(e,t,n){let[r=``,i=``]=e.split(`?`),a=new URLSearchParams(i);a.set(`theme`,t);for(let[e,t]of Object.entries(n??{}))a.set(e,t);return`${r.startsWith(`/`)?LC:``}${r}?${a.toString()}`}function zC(e){return new URL(e,document.baseURI).toString()}function BC(e,t,n){let r=Zg().data,i=$g(!!r?.system).data?.tokens,[a,o]=(0,v.useState)(null),s=(0,v.useRef)({enabled:t,tokens:i});s.current={enabled:t,tokens:i};let c=(0,v.useRef)(n.onEscape);c.current=n.onEscape;let l=(0,v.useRef)(e);l.current=e;let u=(0,v.useRef)(new Map),d=(e,t=!1)=>{let{enabled:n,tokens:r}=s.current,i=u.current.get(e);(t||i?.on!==n||i.tokens!==r)&&(u.current.set(e,{on:n,tokens:r}),NC(e,{type:`inspect`,on:n,tokens:n?r??[]:void 0}))};(0,v.useEffect)(()=>{for(let t of e)d(t);for(let t of u.current.keys())e.includes(t)||u.current.delete(t)},[e,t,i]),(0,v.useEffect)(()=>{let t=e.map(e=>MC(e,t=>{if(t.type===`ready`)s.current.enabled?d(e,!0):u.current.set(e,{on:!1});else if(t.type===`inspect`){if(t.info){for(let t of l.current)t!==e&&NC(t,{type:`inspect-select`,ref:null});o({info:t.info,frame:e})}else o(t=>t?.frame===e?null:t)}else t.type===`inspect-escape`&&c.current()}));return()=>{for(let e of t)e()}},[e]);let f=a&&e.includes(a.frame)?a.frame:null;return{info:f?a.info:null,frame:f,select(e){if(e===null){for(let e of l.current)NC(e,{type:`inspect-select`,ref:null});o(null)}else a&&NC(a.frame,{type:`inspect-select`,ref:e})}}}function VC(e){let[t,n]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let t=e=>e===`Meta`||e===`Control`,r=!1,i=!1,a,o=()=>{r=!1,clearTimeout(a),n(!1)},s=e=>{if(t(e)){if(r)return;r=!0,i=!1,a=setTimeout(()=>{r&&!i&&n(!0)},150)}else r&&(i=!0,clearTimeout(a),n(!1))},c=e=>s(e.key),l=e=>{t(e.key)&&o()};window.addEventListener(`keydown`,c,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,o);let u=e.map(e=>MC(e,e=>{e.type===`key`?e.down?s(e.name):t(e.name)&&o():e.type===`blur`&&o()}));return()=>{window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,o);for(let e of u)e();clearTimeout(a)}},[e]),t}function HC({title:e,children:t,right:n}){return(0,I.jsxs)(`section`,{className:`border-t border-rule pb-2 first:border-t-0`,children:[(0,I.jsxs)(`div`,{className:`flex h-9 items-center justify-between px-4 text-[12px] font-medium text-muted`,children:[e,n]}),t]})}function UC({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`grid min-h-7 grid-cols-[92px_minmax(0,1fr)] items-center gap-x-3 px-4 py-0.5 text-[12.5px]`,children:[(0,I.jsx)(`span`,{className:`text-muted`,children:e}),(0,I.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-ink`,children:t})]})}function WC({name:e}){return e?(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(`var(${e})`,`Token copied`),title:`Copy var()`,className:`shrink-0 cursor-pointer truncate rounded-[4px] border-0 bg-action-soft px-1.5 py-px font-mono text-[11px] text-action`,children:e}):null}function GC({children:e,title:t}){return(0,I.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[12px]`,title:t,children:e})}function KC({label:e,color:t}){return(0,I.jsxs)(UC,{label:e,children:[(0,I.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:t.css}}),(0,I.jsx)(GC,{title:t.css,children:t.value}),(0,I.jsx)(WC,{name:t.token})]})}var qC=e=>e?String(e):`–`;function JC({label:e,values:t,className:n,children:r}){let[i,a,o,s]=t;return(0,I.jsxs)(`div`,{className:X(`relative grid grid-cols-[28px_minmax(0,1fr)_28px] grid-rows-[20px_auto_20px] rounded-[4px]`,n),children:[(0,I.jsx)(`span`,{className:`absolute top-1 left-1.5 text-[9.5px] tracking-wide text-muted uppercase`,children:e}),(0,I.jsx)(`span`,{className:`col-start-2 self-center text-center`,children:qC(i)}),(0,I.jsx)(`span`,{className:`row-start-2 self-center text-center`,children:qC(s)}),(0,I.jsx)(`div`,{className:`row-start-2 col-start-2`,children:r}),(0,I.jsx)(`span`,{className:`row-start-2 col-start-3 self-center text-center`,children:qC(a)}),(0,I.jsx)(`span`,{className:`row-start-3 col-start-2 self-center text-center`,children:qC(o)})]})}function YC({info:e}){let t={w:Math.max(0,e.rect.w-e.border[1]-e.border[3]-e.padding[1]-e.padding[3]),h:Math.max(0,e.rect.h-e.border[0]-e.border[2]-e.padding[0]-e.padding[2])};return(0,I.jsx)(`div`,{className:`px-4 pt-1 pb-2 font-mono text-[11px] text-ink2`,children:(0,I.jsx)(JC,{label:`margin`,values:e.margin,className:`border border-dashed border-rule-strong bg-[#f6b26b]/15`,children:(0,I.jsx)(JC,{label:`border`,values:e.border,className:`border border-rule-strong bg-[#f9e27d]/15`,children:(0,I.jsx)(JC,{label:`padding`,values:e.padding,className:`border border-rule-strong bg-[#93c47d]/20`,children:(0,I.jsxs)(`div`,{className:`flex h-8 items-center justify-center rounded-[3px] border border-rule-strong bg-[#6fa8dc]/25 text-ink`,children:[Math.round(t.w*100)/100,` × `,Math.round(t.h*100)/100]})})})})})}function XC({info:e,onSelect:t}){return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-4 pb-2`,children:[e.path.slice(-4).map((e,n)=>(0,I.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`cursor-pointer rounded-[4px] border-0 bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2 hover:text-ink`,children:e.label}),(0,I.jsx)(Z,{name:`chevron-right`,size:11,className:`text-muted`})]},n)),(0,I.jsx)(`span`,{className:`rounded-[4px] bg-action-soft px-1.5 py-0.5 font-mono text-[11px] text-action`,children:e.label})]})}function ZC({info:e,onSelect:t,onClose:n,active:r}){return(0,I.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[320px] shrink-0 flex-col overflow-hidden border-l border-rule bg-surface`,children:[(0,I.jsxs)(`div`,{className:`flex h-[46px] shrink-0 items-center justify-between border-b border-rule pr-2 pl-4`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-semibold`,children:[(0,I.jsx)(Z,{name:`pointer`,size:15,className:`text-action`}),` Inspect`]}),(0,I.jsx)(j_,{icon:`x`,label:`Close inspector (I)`,onClick:n})]}),e?(0,I.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto`,children:[(0,I.jsxs)(HC,{title:`Element`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2`,children:[(0,I.jsx)(`div`,{className:`flex min-w-0 items-baseline gap-1.5`,children:e.component?.owners[0]?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:[`<`,e.component.owners[0],`>`]}),(0,I.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.tag})]}):(0,I.jsx)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:e.label})}),e.component&&e.component.owners.length>1?(0,I.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[`in `,e.component.owners.slice(1).join(` ← `)]}):null,e.component?.file?(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(e.component.file,`Path copied`),className:`w-fit max-w-full cursor-pointer truncate border-0 bg-transparent p-0 text-left font-mono text-[11.5px] text-muted hover:text-ink2`,title:`Copy path`,children:e.component.file}):null,e.text?(0,I.jsxs)(`span`,{className:`line-clamp-2 text-[12.5px] text-ink2`,children:[`“`,e.text,`”`]}):null]}),(0,I.jsx)(XC,{info:e,onSelect:t})]}),(0,I.jsxs)(HC,{title:`Box`,children:[(0,I.jsx)(YC,{info:e}),(0,I.jsx)(UC,{label:`Size`,children:(0,I.jsxs)(GC,{children:[e.rect.w,` × `,e.rect.h]})}),(0,I.jsx)(UC,{label:`Position`,children:(0,I.jsxs)(GC,{children:[`x `,e.rect.x,` · y `,e.rect.y]})})]}),e.layout.length?(0,I.jsx)(HC,{title:`Layout`,children:e.layout.map(([e,t])=>(0,I.jsx)(UC,{label:e,children:(0,I.jsx)(GC,{title:t,children:t})},e))}):null,e.typography?(0,I.jsxs)(HC,{title:`Typography`,children:[(0,I.jsxs)(UC,{label:`Font`,children:[(0,I.jsx)(GC,{title:e.typography.family,children:e.typography.family.split(`,`)[0]?.replace(/["']/g,``)}),(0,I.jsx)(WC,{name:e.typography.familyToken})]}),(0,I.jsxs)(UC,{label:`Size`,children:[(0,I.jsxs)(GC,{children:[e.typography.size,` / `,e.typography.lineHeight]}),(0,I.jsx)(WC,{name:e.typography.sizeToken})]}),(0,I.jsx)(UC,{label:`Weight`,children:(0,I.jsx)(GC,{children:e.typography.weight})}),e.typography.letterSpacing===`normal`?null:(0,I.jsx)(UC,{label:`Tracking`,children:(0,I.jsx)(GC,{children:e.typography.letterSpacing})}),(0,I.jsx)(KC,{label:`Color`,color:e.typography.color}),e.typography.align===`start`?null:(0,I.jsx)(UC,{label:`Align`,children:(0,I.jsx)(GC,{children:e.typography.align})}),e.typography.transform?(0,I.jsx)(UC,{label:`Transform`,children:(0,I.jsx)(GC,{children:e.typography.transform})}):null]}):null,Object.values(e.appearance).some(Boolean)?(0,I.jsxs)(HC,{title:`Appearance`,children:[e.appearance.background?(0,I.jsx)(KC,{label:`Background`,color:e.appearance.background}):null,e.appearance.backgroundImage?(0,I.jsx)(UC,{label:`Image`,children:(0,I.jsx)(GC,{title:e.appearance.backgroundImage,children:e.appearance.backgroundImage})}):null,e.appearance.border?(0,I.jsxs)(UC,{label:`Border`,children:[(0,I.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:e.appearance.border.color.css}}),(0,I.jsxs)(GC,{children:[e.appearance.border.width,` `,e.appearance.border.style,` `,e.appearance.border.color.value]}),(0,I.jsx)(WC,{name:e.appearance.border.color.token})]}):null,e.appearance.radius?(0,I.jsxs)(UC,{label:`Radius`,children:[(0,I.jsx)(GC,{children:e.appearance.radius.value}),(0,I.jsx)(WC,{name:e.appearance.radius.token})]}):null,e.appearance.shadow?(0,I.jsxs)(UC,{label:`Shadow`,children:[(0,I.jsx)(GC,{title:e.appearance.shadow.value,children:e.appearance.shadow.value}),(0,I.jsx)(WC,{name:e.appearance.shadow.token})]}):null,e.appearance.opacity?(0,I.jsx)(UC,{label:`Opacity`,children:(0,I.jsx)(GC,{children:e.appearance.opacity})}):null]}):null,e.classes.length?(0,I.jsx)(HC,{title:`Classes`,right:(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(e.classes.join(` `),`Classes copied`),className:`cursor-pointer border-0 bg-transparent text-[12px] text-muted hover:text-ink2`,children:`Copy`}),children:(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 px-4 pb-1`,children:e.classes.map(e=>(0,I.jsx)(`span`,{className:`rounded-[4px] bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2`,children:e},e))})}):null,e.attributes.length?(0,I.jsx)(HC,{title:`Attributes`,children:e.attributes.map(([e,t])=>(0,I.jsx)(UC,{label:e,children:(0,I.jsx)(GC,{title:t,children:t})},e))}):null,e.children.length?(0,I.jsx)(HC,{title:`Children · ${e.children.length}`,children:(0,I.jsx)(`div`,{className:`flex flex-col px-2 pb-1`,children:e.children.map((e,n)=>(0,I.jsxs)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`flex h-7 cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left font-mono text-[12px] text-ink2 hover:bg-soft2`,children:[(0,I.jsx)(Z,{name:`chevron-right`,size:12,className:`text-muted`}),(0,I.jsx)(`span`,{className:`truncate`,children:e.label})]},n))})}):null]}):(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-10 text-center`,children:[(0,I.jsx)(Z,{name:`pointer`,size:22,className:`text-muted`}),(0,I.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:r?`Click an element in any screen.`:`Hold ${C_} to highlight, click to inspect.`}),(0,I.jsx)(`span`,{className:`text-[12.5px] leading-[1.5] text-muted`,children:`Hover shows margin, padding and content. Clicks go to the inspector, not the screen.`}),(0,I.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,I.jsx)(__,{children:`I`}),` toggle · hold `,(0,I.jsx)(__,{children:C_}),` · `,(0,I.jsx)(__,{children:`esc`}),` clear`]})]}),e?(0,I.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-rule bg-soft px-4 py-2.5`,children:(0,I.jsx)(O_,{icon:`copy`,onClick:()=>void AC(e.css,`CSS copied`),className:`grow`,children:`Copy CSS`})}):null]})}var QC={neutral:`bg-soft2 text-ink2`,action:`bg-action-soft text-action`,ok:`bg-ok-soft text-ok-text`,danger:`bg-danger-soft text-danger-text`};function $C({tone:e=`neutral`,children:t,className:n}){return(0,I.jsx)(`span`,{className:X(`inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-[6px] px-2 text-[12px] font-medium`,QC[e],n),children:t})}function ew({value:e,tone:t=`neutral`}){return(0,I.jsx)(`span`,{className:X(`inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[4px] px-[5px] text-[11.5px] font-semibold tabular`,t===`action`?`bg-action-soft text-action`:t===`danger`?`bg-danger-soft text-danger-text`:`bg-soft2 text-ink2`),children:e})}function tw({children:e,className:t,style:n}){return(0,I.jsx)(`section`,{className:X(`min-w-0 shrink-0 overflow-hidden rounded-[10px] border border-rule bg-surface`,t),style:n,children:e})}function nw({title:e,count:t,sub:n,right:r,as:i=`h2`}){return(0,I.jsxs)(`div`,{className:`flex min-h-[46px] items-center justify-between gap-3 px-4`,children:[(0,I.jsxs)(i,{className:`m-0 flex min-w-0 items-center gap-2 whitespace-nowrap text-[14px] font-semibold`,children:[e,t===void 0?null:(0,I.jsx)(ew,{value:t}),n?(0,I.jsx)(`span`,{className:`truncate text-[12.5px] font-normal text-muted`,children:n}):null]}),r?(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function rw({items:e,value:t,onChange:n,right:r}){let i=(0,v.useId)();return(0,I.jsxs)(`div`,{className:`flex h-[46px] items-center justify-between gap-3 px-4`,children:[(0,I.jsx)(`div`,{role:`tablist`,className:`flex gap-5`,children:e.map(e=>{let r=e.value===t;return(0,I.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.value),className:X(`relative flex h-[46px] cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0.5 text-[14px] transition-colors`,r?`font-semibold text-ink`:`font-medium text-ink2 hover:text-ink`),children:[e.label,e.count===void 0?null:(0,I.jsx)(ew,{value:e.count}),r?(0,I.jsx)(Wf.span,{layoutId:i,className:`absolute inset-x-0 bottom-0 h-[2px] bg-ink`,transition:{type:`spring`,stiffness:520,damping:42}}):null]},e.value)})}),r?(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function iw({align:e,children:t}){return(0,I.jsx)(`div`,{className:X(`flex min-w-0 items-center gap-2`,e===`r`&&`justify-end text-right`,e===`c`&&`justify-center`),children:t})}function aw(e,t){return v.Children.toArray(e).map((e,n)=>(0,I.jsx)(iw,{align:t?.[n]??`l`,children:e},n))}function ow({cols:e,align:t,labels:n}){return(0,I.jsx)(`div`,{className:`grid h-8 items-center gap-x-4 border-t border-rule bg-soft px-4 text-[12.5px] text-muted`,style:{gridTemplateColumns:e},children:n.map((e,n)=>(0,I.jsx)(iw,{align:t?.[n]??`l`,children:(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:e})},n))})}var sw=(e,t,n)=>X(`grid items-center gap-x-4 border-rule`,!e&&`border-t`,t&&`cursor-pointer transition-colors hover:bg-soft`,n);function cw({cols:e,align:t,minH:n=44,pad:r=`10px 16px`,children:i,first:a,className:o,onClick:s,title:c}){return(0,I.jsx)(`div`,{className:sw(a,!!s,o),style:{gridTemplateColumns:e,minHeight:n,padding:r},onClick:s,title:c,children:aw(i,t)})}function lw({to:e,cols:t,align:n,minH:r=44,pad:i=`10px 16px`,first:a,className:o,children:s}){return(0,I.jsx)(xe,{href:e,className:X(sw(a,!0,o),`text-inherit no-underline`),style:{gridTemplateColumns:t,minHeight:r,padding:i},children:aw(s,n)})}function uw({label:e,children:t,labelWidth:n=180,minH:r=40,end:i=!1}){return(0,I.jsxs)(`div`,{className:`grid content-center items-baseline gap-x-4 border-t border-rule px-4 py-2`,style:{gridTemplateColumns:`${n}px minmax(0, 1fr)`,minHeight:r},children:[(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,I.jsx)(`div`,{className:X(`flex min-w-0 flex-wrap items-center gap-2`,i&&`justify-end`),children:t})]})}function dw({children:e,pad:t=`16px`,gap:n=16,top:r=!0,className:i}){return(0,I.jsx)(`div`,{className:X(`flex flex-col`,r&&`border-t border-rule`,i),style:{padding:t,gap:n},children:e})}function fw({issues:e,className:t}){return(0,I.jsx)(`div`,{className:X(`flex flex-col`,t),children:e.map((e,t)=>(0,I.jsxs)(`div`,{className:`flex items-start gap-2.5 border-t border-rule px-4 py-2.5 text-[13px] first:border-t-0`,children:[(0,I.jsx)(Z,{name:e.severity===`error`?`alert`:`info`,size:15,className:X(`mt-0.5`,e.severity===`error`?`text-danger-text`:`text-action`)}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`text-ink`,children:e.message}),(0,I.jsxs)(`span`,{className:`font-mono text-[12px] break-all text-muted`,children:[e.file,e.at?` · ${e.at}`:``]})]})]},t))})}function pw({issues:e,title:t=`Problems`}){if(!e.length)return null;let n=e.filter(e=>e.severity===`error`).length;return(0,I.jsxs)(tw,{className:n?`border-danger/40`:void 0,children:[(0,I.jsx)(nw,{title:t,count:e.length,sub:n?`${n} blocking`:`warnings`}),(0,I.jsx)(`div`,{className:`border-t border-rule`,children:(0,I.jsx)(fw,{issues:e})})]})}var mw=[.2,.7,.2,1];function hw({open:e,side:t,width:n,children:r}){return(0,I.jsx)(ed,{initial:!1,children:e?(0,I.jsx)(Wf.div,{initial:{width:0,opacity:.6},animate:{width:n,opacity:1},exit:{width:0,opacity:.6},transition:{duration:.22,ease:mw},className:X(`flex min-h-0 shrink-0 overflow-hidden`,t===`right`?`justify-start`:`justify-end`),children:(0,I.jsx)(`div`,{className:`flex min-h-0 shrink-0`,style:{width:n},children:r})},`panel`):null})}function gw({children:e,className:t,gap:n=20,wide:r=!1}){return(0,I.jsx)(`main`,{className:X(`mx-auto flex w-full min-h-0 grow flex-col px-8 pt-6 pb-7 animate-[q-fade-in_160ms_ease-out] max-md:px-4 max-md:pt-4`,r?`max-w-[1440px]`:`max-w-[1200px]`,t),style:{gap:n},children:e})}function _w({title:e,sub:t,right:n,badge:r,crumbs:i}){return(0,I.jsxs)(`div`,{className:`flex shrink-0 items-end justify-between gap-6 max-md:flex-col max-md:items-stretch max-md:gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[i?(0,I.jsx)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:i}):null,(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h1`,{className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:e}),r]}),t?(0,I.jsx)(`div`,{className:`text-[13px] text-muted`,children:t}):null]}),n?(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n}):null]})}function vw({items:e,label:t}){return(0,I.jsx)(`nav`,{"aria-label":t,className:`flex flex-col gap-0.5`,children:e.map(e=>(0,I.jsxs)(xe,{href:e.to,className:e=>X(`flex h-8 items-center gap-2 whitespace-nowrap rounded-[6px] px-3 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,e?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),e.hint?(0,I.jsx)(`span`,{className:`ml-auto text-[12px] font-normal text-muted`,children:e.hint}):null]},e.to))})}function yw({children:e}){return(0,I.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[12px] text-muted`,children:e})}function bw({title:e,text:t,action:n}){return(0,I.jsxs)(tw,{className:`flex w-[480px] max-w-full flex-col items-center gap-2 px-6 py-8 text-center`,children:[(0,I.jsx)(`h1`,{className:`m-0 text-[16px] font-semibold`,children:e}),t?(0,I.jsx)(`div`,{className:`m-0 max-w-[400px] text-[14px] text-ink2`,children:t}):null,n?(0,I.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:n}):null]})}function xw(e){return(0,I.jsx)(`div`,{className:`flex min-h-[50vh] grow items-center justify-center p-6 max-md:px-4`,children:(0,I.jsx)(bw,{...e})})}function Sw({title:e=`Nothing here`,text:t}){let n=!!Jg().scope;return(0,I.jsx)(xw,{title:e,text:t??`This address does not match a canvas or a page of the design system.`,action:n?void 0:(0,I.jsx)(M_,{to:`/`,children:`All canvases`})})}var Cw=.1,ww=(e,t=Cw)=>Math.min(8,Math.max(t,e)),Tw=class{camera={x:0,y:0,z:1};minZoom=Cw;listeners=new Set;animation=0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}set(e){this.camera={x:e.x,y:e.y,z:ww(e.z,this.minZoom)};for(let e of this.listeners)e(this.camera)}interrupt(){cancelAnimationFrame(this.animation),this.animation=0}panBy(e,t){this.interrupt();let{x:n,y:r,z:i}=this.camera;this.set({x:n+e,y:r+t,z:i})}zoomAt(e,t,n){this.interrupt();let{x:r,y:i,z:a}=this.camera,o=ww(a*n,this.minZoom),s=(e-r)/a,c=(t-i)/a;this.set({x:e-s*o,y:t-c*o,z:o})}animateTo(e,t=320){this.interrupt();let n={...this.camera},r={...e,z:ww(e.z,this.minZoom)};if(t<=0||matchMedia(`(prefers-reduced-motion: reduce)`).matches){this.set(r);return}let i=performance.now(),a=e=>{let o=Math.min(1,(e-i)/t),s=1-(1-o)**3,c=n.z*(r.z/n.z)**s,l=n.z===r.z?s:(c-n.z)/(r.z-n.z);this.set({x:n.x+(r.x-n.x)*l,y:n.y+(r.y-n.y)*l,z:c}),this.animation=o<1?requestAnimationFrame(a):0};this.animation=requestAnimationFrame(a)}toWorld(e,t){let{x:n,y:r,z:i}=this.camera;return{x:(e-n)/i,y:(t-r)/i}}};function Ew(e,t,n,r=72,i=1,a=Cw){let o=ww(Math.min((t-r*2)/Math.max(e.w,1),(n-r*2)/Math.max(e.h,1),i),a),s=(e,t,n)=>t*o<=n-r*2?n/2-(e+t/2)*o:r-e*o;return{z:o,x:s(e.x,e.w,t),y:s(e.y,e.h,n)}}function Dw(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function Ow({items:e,value:t,onChange:n,label:r,stretch:i,size:a=`ctrl`}){let o=(0,v.useId)();return(0,I.jsx)(`div`,{role:`group`,"aria-label":r,className:X(`shrink-0 items-center gap-0.5 rounded-[6px] bg-track p-[3px]`,a===`ctrl`?`h-ctrl`:`h-7`,i?`flex`:`inline-flex`),children:e.map(e=>{let r=e.value===t;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":r,title:e.title,onClick:()=>n(e.value),className:X(`relative flex h-full cursor-pointer items-center justify-center whitespace-nowrap rounded-[4px] border-0 bg-transparent font-medium transition-colors`,a===`ctrl`?`px-2.5 text-ctrl`:`px-2 text-[12.5px]`,i&&`flex-1`,r?`text-ink`:`text-muted hover:text-ink2`),children:[r?(0,I.jsx)(Wf.span,{layoutId:o,className:`absolute inset-0 rounded-[4px] bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.10)]`,transition:{type:`spring`,stiffness:520,damping:42}}):null,(0,I.jsx)(`span`,{className:`relative flex items-center gap-1.5`,children:e.label})]},e.value)})})}var kw=Object.defineProperty,Aw=(e,t)=>kw(e,`name`,{value:t,configurable:!0}),jw=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Mw=v.forwardRef(Aw(function(e,t){return(0,I.jsx)(Wp.span,{...e,ref:t,style:{...jw,...e.style}})},`VisuallyHidden`)),Nw=Object.defineProperty,Pw=(e,t)=>Nw(e,`name`,{value:t,configurable:!0}),[Fw,Iw]=ap(`Tooltip`,[hb]),Lw=hb(),Rw=`TooltipProvider`,zw=700,Bw=`tooltip.open`,[Vw,Hw]=Fw(Rw),Uw=Pw(e=>{let{__scopeTooltip:t,delayDuration:n=zw,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,I.jsx)(Vw,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Ww=`Tooltip`,[Gw,Kw]=Fw(Ww),qw=Pw(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Hw(Ww,e.__scopeTooltip),l=Lw(t),[u,d]=v.useState(null),[f,p]=v.useState(void 0),m=fp(),h=v.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,y=v.useRef(!1),[b,x]=xp({prop:r,defaultProp:i??!1,onChange:Pw(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Bw))):c.onClose(),a?.(e)},`onChange`),caller:Ww}),S=v.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,x(!0)},[x]),w=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),T=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,x(!0),h.current=0},_)},[_,x]);v.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let E=f??m;return(0,I.jsx)(Ob,{...l,children:(0,I.jsx)(Gw,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:v.useCallback(()=>{g?w():(window.clearTimeout(h.current),h.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})},`Tooltip`),Jw=`TooltipTrigger`,Yw=v.forwardRef(Pw(function(e,t){let{__scopeTooltip:n,...r}=e,i=Kw(Jw,n),a=Hw(Jw,n),o=Lw(n),s=tp(t,v.useRef(null),i.onTriggerChange),c=v.useRef(!1),l=v.useRef(!1),u=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,I.jsx)(kb,{asChild:!0,...o,children:(0,I.jsx)(Wp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Y(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Y(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Y(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Y(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Y(e.onBlur,i.onClose),onClick:Y(e.onClick,i.onClose)})})},`TooltipTrigger`)),Xw=`TooltipPortal`,[Zw,Qw]=Fw(Xw,{forceMount:void 0}),$w=Pw(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Kw(Xw,t);return(0,I.jsx)(Zw,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),eT=`TooltipContent`,tT=v.forwardRef(Pw(function(e,t){let n=Qw(eT,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Kw(eT,e.__scopeTooltip);return(0,I.jsx)(jm,{present:r||o.open,children:o.disableHoverableContent?(0,I.jsx)(iT,{side:i,...a,ref:t}):(0,I.jsx)(nT,{side:i,...a,ref:t})})},`TooltipContent`)),nT=v.forwardRef(Pw(function(e,t){let n=Kw(eT,e.__scopeTooltip),r=Hw(eT,e.__scopeTooltip),i=v.useRef(null),a=tp(t,i),[o,s]=v.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=v.useCallback(()=>{s(null),d(!1)},[d]),p=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=oT(r,aT(r,n.getBoundingClientRect())),a=sT(t.getBoundingClientRect()),o=lT([...i,...a]);s(o),d(!0)},[d]);return v.useEffect(()=>()=>f(),[f]),v.useEffect(()=>{if(c&&u){let e=Pw(e=>p(e,u),`handleTriggerLeave`),t=Pw(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]),v.useEffect(()=>{if(o){let e=Pw(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!cT(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,I.jsx)(iT,{...e,ref:a})},`TooltipContentHoverable`)),rT=jp(`TooltipContent`),iT=v.forwardRef(Pw(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Kw(eT,n),u=Lw(n),{onClose:d}=l;v.useEffect(()=>(document.addEventListener(Bw,d),()=>document.removeEventListener(Bw,d)),[d]),v.useEffect(()=>{if(l.trigger){let e=Pw(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:f}=l;return sp(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,I.jsxs)(Ab,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,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,I.jsx)(rT,{children:r}),i?(0,I.jsx)(Mw,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function aT(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`)}}Pw(aT,`getExitSideFromRect`);function oT(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}Pw(oT,`getPaddedExitPoints`);function sT(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}]}Pw(sT,`getPointsFromRect`);function cT(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}Pw(cT,`isPointInPolygon`);function lT(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)),uT(t)}Pw(lT,`getHull`);function uT(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)}Pw(uT,`getHullPresorted`);var dT=Uw,fT=qw,pT=Yw,mT=$w,hT=tT;function gT({children:e}){return(0,I.jsx)(dT,{delayDuration:250,children:e})}var _T=`z-50 max-w-[280px] rounded-[8px] border border-rule bg-surface px-[10px] py-[7px] text-[12.5px] leading-[1.35] text-ink shadow-pop outline-none data-[state=delayed-open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function vT({content:e,children:t,side:n=`top`,align:r=`center`,className:i}){return(0,I.jsxs)(fT,{children:[(0,I.jsx)(pT,{asChild:!0,children:t}),(0,I.jsx)(mT,{children:(0,I.jsx)(hT,{side:n,align:r,sideOffset:6,collisionPadding:12,className:X(_T,i),children:e})})]})}function yT(e){return e.kind===`note`?`note`:e.kind===`image`?`image`:e.kind===`url`?`globe`:e.frame.width<600?`smartphone`:e.frame.width<1100?`tablet`:`monitor`}function bT(e,t){return`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(t.id)}`}function xT({canvas:e,page:t,store:n,onPick:r}){let i=o_(n,e=>e.selected),a=o_(n,e=>e.frames);return(0,I.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[264px] shrink-0 flex-col overflow-hidden border-r border-rule bg-surface`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-rule px-4 py-3.5`,children:[(0,I.jsx)(`div`,{className:`truncate text-[14px] font-semibold`,children:e.title}),e.description?(0,I.jsx)(`div`,{className:`line-clamp-3 text-[12.5px] leading-[1.45] text-muted`,children:e.description}):null]}),(0,I.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto pb-4`,children:[e.pages.length>1?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:`Pages`}),(0,I.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2`,children:e.pages.map(n=>{let r=n.sections.reduce((e,t)=>e+t.items.filter(e=>e.kind===`screen`||e.kind===`url`).length,0);return(0,I.jsxs)(xe,{href:bT(e,n),className:X(`flex h-8 items-center gap-2 rounded-[6px] px-2.5 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,n.id===t.id?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:n.title}),(0,I.jsx)(`span`,{className:`text-[12px] text-muted tabular`,children:r})]},n.id)})})]}):null,(0,I.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:e.pages.length>1?t.title:`Layers`}),(0,I.jsx)(`div`,{className:`flex flex-col px-2`,children:t.sections.map(e=>(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[e.title?(0,I.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-2.5 pt-1 text-[12px] font-medium text-ink2`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:e.title}),(0,I.jsx)(ew,{value:e.items.length})]}):null,e.items.map(t=>{let n=(a[t.id]?.errors.length??0)>0||t.kind===`screen`&&t.missing;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r(t.id),className:X(`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 px-2.5 text-left text-[13px] transition-colors focus-visible:outline-offset-[-2px]`,e.title&&`pl-4`,i===t.id?`bg-action-soft text-ink`:`bg-transparent text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(Z,{name:yT(t),size:15,className:`text-muted`}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:t.title||(t.kind===`note`?`Note`:t.id)}),n?(0,I.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`}):null]},t.id)})]},e.id))})]})]})}function ST({canvas:e,page:t,theme:n,onTheme:r,sidebar:i,onSidebar:a,onPlay:o,canPlay:s,inspect:c,onInspect:l}){let[,u]=P(),{slots:d,scope:f}=Jg();return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(JS,{children:[d.barStart,f?(0,I.jsx)(KS,{}):(0,I.jsx)(vT,{content:`All canvases`,children:(0,I.jsx)(xe,{href:`/`,className:`flex items-center`,"aria-label":`All canvases`,children:(0,I.jsx)(KS,{})})}),(0,I.jsx)(j_,{icon:`panel-left`,label:i?`Hide sidebar (⌘\\)`:`Show sidebar (⌘\\)`,onClick:()=>a(!i)}),(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[14px]`,children:[(0,I.jsx)(`span`,{className:`truncate font-semibold`,children:e.title}),t&&e.pages.length>1?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Z,{name:`chevron-right`,size:14,className:`shrink-0 text-muted`}),(0,I.jsxs)(zS,{width:240,trigger:(0,I.jsxs)(`button`,{type:`button`,className:`flex h-ctrl cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-[14px] text-ink2 hover:bg-soft2`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:t.title}),(0,I.jsx)(Z,{name:`chevron-down`,size:14,className:`text-muted`})]}),children:[(0,I.jsx)(US,{children:`Pages`}),e.pages.map(n=>(0,I.jsxs)(VS,{active:n.id===t.id,onSelect:()=>u(bT(e,n)),children:[(0,I.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),n.title]},n.id))]})]}):null]}),(0,I.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,I.jsx)(Ow,{label:`Screen theme`,value:n,onChange:r,items:[{value:`light`,label:(0,I.jsx)(Z,{name:`sun`,size:15}),title:`Light screens`},{value:`dark`,label:(0,I.jsx)(Z,{name:`moon`,size:15}),title:`Dark screens`}]}),(0,I.jsx)(wT,{on:c,onChange:l}),(0,I.jsx)(O_,{kind:`secondary`,icon:`play`,onClick:o,disabled:!s,children:`Play`}),(0,I.jsx)(T_,{width:200,label:`Search`}),(0,I.jsx)(GS,{}),d.barEnd]})]}),d.belowBar]})}function CT({canvas:e,store:t,layoutItems:n,theme:r,onPlay:i,inspect:a}){let o=o_(t,e=>e.selected),s=o_(t,e=>e.active),c=o_(t,e=>o?e.frames[o]:void 0),{frameSandbox:l}=Jg(),u=n.find(e=>e.id===o);if(!u)return null;let d=u.kind===`screen`||u.kind===`url`,f=u.kind===`screen`&&!l?zC(RC(u.url,u.theme??r)):u.kind===`url`?u.url:null,p=()=>IC(document.querySelector(`[data-item="${CSS.escape(u.id)}"] iframe`)),m=c?.errors??[];return(0,I.jsx)(`div`,{"data-ui":!0,className:`pointer-events-none absolute inset-x-0 bottom-5 z-20 flex justify-center px-4`,children:(0,I.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full flex-col overflow-hidden rounded-[10px] border border-rule bg-surface shadow-pop animate-[q-pop_120ms_ease-out]`,children:[m.length?(0,I.jsxs)(`div`,{className:`flex max-h-40 items-start gap-2 overflow-y-auto border-b border-rule bg-danger-soft px-3.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,I.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),(0,I.jsx)(`span`,{className:`min-w-0`,children:m.join(`
|
|
57
|
+
`},Kh=0,qh=[];function Jh(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(Kh++)[0],a=v.useState(gh)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Km([e.lockRef.current],(e.shards||[]).map(Uh),!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=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Vh(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=Ph(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ph(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 Bh(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(qh.length&&qh[qh.length-1]===a){var r=`deltaY`in n?Hh(n):Vh(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Wh(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Uh).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=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Yh(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=Vh(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,Hh(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,Vh(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return qh.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,kh),document.addEventListener(`touchmove`,c,kh),document.addEventListener(`touchstart`,u,kh),function(){qh=qh.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,kh),document.removeEventListener(`touchmove`,c,kh),document.removeEventListener(`touchstart`,u,kh)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:Gh(i)}):null,p?v.createElement(Eh,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Yh(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Xh=oh(sh,Jh),Zh=v.forwardRef(function(e,t){return v.createElement(lh,Wm({},e,{ref:t,sideCar:Xh}))});Zh.classNames=lh.classNames;var Qh=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},$h=new WeakMap,eg=new WeakMap,tg={},ng=0,rg=function(e){return e&&(e.host||rg(e.parentNode))},ig=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=rg(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})},ag=function(e,t,n,r){var i=ig(t,Array.isArray(e)?e:[e]);tg[n]||(tg[n]=new WeakMap);var a=tg[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=($h.get(e)||0)+1,l=(a.get(e)||0)+1;$h.set(e,c),a.set(e,l),o.push(e),c===1&&i&&eg.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(),ng++,function(){o.forEach(function(e){var t=$h.get(e)-1,i=a.get(e)-1;$h.set(e,t),a.set(e,i),t||(eg.has(e)||e.removeAttribute(r),eg.delete(e)),i||e.removeAttribute(n)}),ng--,ng||($h=new WeakMap,$h=new WeakMap,eg=new WeakMap,tg={})}},og=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Qh(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ag(r,i,n,`aria-hidden`)):function(){return null}},sg=Object.defineProperty,cg=(e,t)=>sg(e,`name`,{value:t,configurable:!0}),lg=`Dialog`,[ug,dg]=ap(lg),[fg,pg]=ug(lg),mg=cg(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=xp({prop:r,defaultProp:i??!1,onChange:a,caller:lg}),[d,f]=v.useState(0),[p,m]=v.useState(0);return(0,I.jsx)(fg,{scope:t,triggerRef:s,contentRef:c,contentId:fp(),titleId:fp(),descriptionId:fp(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),hg=`DialogPortal`,[gg,_g]=ug(hg,{forceMount:void 0}),vg=cg(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=pg(hg,t);return(0,I.jsx)(gg,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),yg=`DialogOverlay`,bg=v.forwardRef(cg(function(e,t){let n=_g(yg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pg(yg,e.__scopeDialog);return a.modal?(0,I.jsx)(jm,{present:r||a.open,children:(0,I.jsx)(Sg,{...i,ref:t})}):null},`DialogOverlay`)),xg=kp(`DialogOverlay.RemoveScroll`),Sg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,...r}=e,i=pg(yg,n),a=tp(t,rm());return(0,I.jsx)(Zh,{as:xg,allowPinchZoom:!0,shards:[i.contentRef],children:(0,I.jsx)(Wp.div,{"data-state":Ag(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Cg=`DialogContent`,wg=v.forwardRef(cg(function(e,t){let n=_g(Cg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pg(Cg,e.__scopeDialog);return(0,I.jsx)(jm,{present:r||a.open,children:a.modal?(0,I.jsx)(Tg,{...i,ref:t}):(0,I.jsx)(Eg,{...i,ref:t})})},`DialogContent`)),Tg=v.forwardRef(cg(function(e,t){let n=pg(Cg,e.__scopeDialog),r=v.useRef(null),i=tp(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(Dg,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Y(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Eg=v.forwardRef(cg(function(e,t){let n=pg(Cg,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,I.jsx)(Dg,{...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`)),Dg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=pg(Cg,n);return Hm(),(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(mm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,I.jsx)(nm,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Ag(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Og=`DialogTitle`,kg=v.forwardRef(cg(function(e,t){let{__scopeDialog:n,...r}=e,i=pg(Og,n),{setTitleCount:a}=i;return sp(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,I.jsx)(Wp.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`));function Ag(e){return e?`open`:`closed`}cg(Ag,`getState`);var jg=window.__DESIGN_STATIC__===!0,Mg=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Ng(e,t){let n=await fetch(e,{cache:t});if(!n.ok){let e=`${n.status} ${n.statusText}`;try{let t=await n.json();t.error&&(e=t.error)}catch{}throw new Mg(n.status,e)}return await n.json()}async function Pg(e){try{return await e}catch(e){if(e instanceof Mg&&e.status===404)return null;throw e}}var Fg=``;function Ig(e){return Fg!==e.version&&(Fg=e.version,console.info(`foss-design ${e.version}${jg?` (static build)`:``}`)),e}var Lg={live:!0,project:()=>Ng(`/api/project`,`no-store`).then(Ig),canvas:async e=>({doc:await Ng(`/api/canvas/${encodeURIComponent(e)}`,`no-store`),base:``}),system:async()=>{let e=await Pg(Ng(`/api/system`,`no-store`));return e?{doc:e,base:``}:null},async source(e){let t=await fetch(`/api/source?path=${encodeURIComponent(e)}`,{cache:`no-store`});if(!t.ok)throw new Mg(t.status,`Could not read ${e}`);return t.text()}},Rg=null,zg={live:!1,project:()=>Ng(`api/project.json`,`default`).then(Ig),canvas:async e=>({doc:await Ng(`api/canvas/${encodeURIComponent(e)}.json`,`default`),base:``}),system:async()=>{let e=await Pg(Ng(`api/system.json`,`default`));return e?{doc:e,base:``}:null},async source(e){Rg??=Ng(`api/sources.json`,`default`).catch(()=>({}));let t=(await Rg)[e];if(t===void 0)throw new Mg(404,`${e} is not in this build`);return t}};function Bg(e,t){if(!t)return e;try{let n=new URL(t.endsWith(`/`)?t:`${t}/`,document.baseURI);return new URL(e,n).href}catch{return e}}function Vg(e,t){if(!t)return e;let n=e=>Bg(e,t);return{...e,pages:e.pages.map(e=>({...e,sections:e.sections.map(e=>({...e,items:e.items.map(e=>{if(e.kind===`screen`){let t=e=>e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t&&n(t)])):void 0;return{...e,url:n(e.url),snapshots:t(e.snapshots),thumbs:t(e.thumbs)}}return e.kind===`image`?{...e,url:n(e.url)}:e})}))}))}}function Hg(e,t){if(!t)return e;let n=e=>Bg(e,t);return{...e,components:e.components.map(e=>({...e,url:n(e.url)})),assets:e.assets.map(e=>({...e,url:n(e.url)})),typographyUrl:e.typographyUrl&&n(e.typographyUrl)}}function Ug(e){return{all:[`design`,e],project:[`design`,e,`project`],canvas:t=>[`design`,e,`canvas`,t],system:[`design`,e,`system`],sources:[`design`,e,`source`],source:(t,n)=>[`design`,e,`source`,t,n]}}var Wg=new WeakMap,Gg=0;function Kg(e){let t=Wg.get(e);return t||(Gg+=1,t=String(Gg),Wg.set(e,t)),t}var qg=(0,v.createContext)(null);function Jg(){let e=(0,v.useContext)(qg);if(!e)throw Error(`foss-design: this component renders inside <DesignViewer>`);return e}function Yg(e,t){if(e===t)return!0;try{return decodeURIComponent(e)===t}catch{return!1}}function Xg(e){return new Vt({defaultOptions:{queries:{staleTime:e?0:1/0,retry:1,refetchOnWindowFocus:!1}}})}function Zg(){let{source:e,keys:t,scope:n}=Jg();return $t({queryKey:t.project,queryFn:()=>e.project(),enabled:!n})}function Qg(e,t=!0){let{source:n,keys:r}=Jg();return $t({queryKey:r.canvas(e),queryFn:async()=>{let{doc:t,base:r}=await n.canvas(e);return Vg(t,r)},placeholderData:e=>e,enabled:t})}function $g(e=!0){let{source:t,keys:n}=Jg();return $t({queryKey:n.system,queryFn:async()=>{let e=await t.system();return e?Hg(e.doc,e.base):null},enabled:e})}function e_(e,t=`system`){let{source:n,keys:r}=Jg();return $t({queryKey:r.source(t,e??``),queryFn:()=>n.source(e,t),enabled:!!e})}function t_(e,t){let n=null,r=!1;return n=new EventSource(`/api/events`),n.onopen=()=>{r&&(r=!1,e.invalidateQueries({queryKey:t.all}))},n.onerror=()=>{r=!0},n.onmessage=n=>{let r;try{r=JSON.parse(n.data)}catch{return}if(r.type===`project`)e.invalidateQueries({queryKey:t.project});else if(r.type===`system`)e.invalidateQueries({queryKey:t.system}),e.invalidateQueries({queryKey:t.sources});else if(r.type===`canvas`||r.type===`snapshot`){let n=r.type===`canvas`?r.id:r.canvas;e.invalidateQueries({queryKey:t.canvas(n)}),r.type===`snapshot`&&e.invalidateQueries({queryKey:t.project})}},()=>n?.close()}function X(...e){return e.filter(Boolean).join(` `)}var n_=null;function r_(e,t){n_={canvas:e,item:t},window.dispatchEvent(new CustomEvent(`design:focus`,{detail:n_}))}function i_(e){if(!n_||n_.canvas!==e)return null;let t=n_.item;return n_=null,t}var a_=class{value;listeners=new Set;constructor(e){this.value=e}get=()=>this.value;set=e=>{let t=typeof e==`function`?e(this.value):e;if(!Object.is(t,this.value)){this.value=t;for(let e of this.listeners)e()}};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})};function o_(e,t=e=>e){return(0,v.useSyncExternalStore)(e.subscribe,()=>t(e.get()),()=>t(e.get()))}var s_=`foss-design.theme`;function c_(){try{let e=localStorage.getItem(s_);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var l_=new a_(c_()),u_=window.matchMedia(`(prefers-color-scheme: dark)`);function d_(e){return e===`system`?u_.matches?`dark`:`light`:e}function f_(){document.documentElement.dataset.theme=d_(l_.get())}u_.addEventListener(`change`,f_),l_.subscribe(f_),f_();function p_(e){try{localStorage.setItem(s_,e)}catch{}l_.set(e)}function m_(){return o_(l_)}function h_(){let e=o_(l_),t=(0,v.useSyncExternalStore)(e=>(u_.addEventListener(`change`,e),()=>u_.removeEventListener(`change`,e)),()=>u_.matches);return e===`system`?t?`dark`:`light`:e}var g_={plus:`<path d="M5 12h14"/><path d="M12 5v14"/>`,check:`<path d="M20 6 9 17l-5-5"/>`,x:`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`,"chevron-down":`<path d="m6 9 6 6 6-6"/>`,"chevron-up":`<path d="m18 15-6-6-6 6"/>`,"chevron-right":`<path d="m9 18 6-6-6-6"/>`,"arrow-right":`<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>`,chevrons:`<path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/>`,copy:`<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,search:`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,bell:`<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,refresh:`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`,"up-right":`<path d="M7 7h10v10"/><path d="M7 17 17 7"/>`,"down-left":`<path d="M17 7 7 17"/><path d="M17 17H7V7"/>`,external:`<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>`,"user-plus":`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M19 8v6"/><path d="M22 11h-6"/>`,user:`<circle cx="12" cy="8" r="5"/><path d="M20 21a8 8 0 0 0-16 0"/>`,trash:`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`,more:`<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>`,alert:`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>`,info:`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,upload:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>`,download:`<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>`,shield:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`,logout:`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><path d="m16 17 5-5-5-5"/><path d="M21 12H9"/>`,loader:`<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,"circle-check":`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,"circle-dashed":`<circle cx="12" cy="12" r="9" stroke-dasharray="3 3"/>`,clock:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,mail:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`,send:`<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>`,chat:`<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/>`,wallet:`<path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/>`,"file-code":`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="m10 13-2 2 2 2"/><path d="m14 17 2-2-2-2"/>`,ban:`<circle cx="12" cy="12" r="10"/><path d="m4.9 4.9 14.2 14.2"/>`,code:`<path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/>`,"chevron-left":`<path d="m15 18-6-6 6-6"/>`,bluetooth:`<path d="m7 7 10 10-5 5V2l5 5L7 17"/>`,face:`<path d="M3 7V5a2 2 0 0 1 2-2h2"/><path d="M17 3h2a2 2 0 0 1 2 2v2"/><path d="M21 17v2a2 2 0 0 1-2 2h-2"/><path d="M7 21H5a2 2 0 0 1-2-2v-2"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><path d="M9 9h.01"/><path d="M15 9h.01"/>`,eye:`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`,clipboard:`<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/>`,grip:`<circle cx="9" cy="5" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="19" r="1"/>`,list:`<path d="M3 12h.01"/><path d="M3 18h.01"/><path d="M3 6h.01"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M8 6h13"/>`,lock:`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,hw:`<rect width="20" height="10" x="2" y="7" rx="2"/><path d="M15 7v10"/><circle cx="8" cy="12" r="1.5"/>`,link:`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,signal:`<path d="M2 20h.01"/><path d="M7 20v-4"/><path d="M12 20v-8"/><path d="M17 20V8"/>`,grid:`<rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/>`,coins:`<circle cx="8" cy="8" r="6"/><path d="M18.09 10.37A6 6 0 1 1 10.34 18"/><path d="M7 6h1v4"/><path d="m16.71 13.88.7.71-2.82 2.82"/>`,arrows:`<path d="M8 3 4 7l4 4"/><path d="M4 7h16"/><path d="m16 21 4-4-4-4"/><path d="M20 17H4"/>`,key:`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`,blocks:`<rect width="7" height="7" x="14" y="3" rx="1"/><path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"/>`,settings:`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,qr:`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`,edit:`<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>`,star:`<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>`,home:`<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>`,moon:`<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,sun:`<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>`,languages:`<path d="m5 8 6 6"/><path d="m4 14 6-6 2-3"/><path d="M2 5h12"/><path d="M7 2h1"/><path d="m22 22-5-10-5 10"/><path d="M14 18h6"/>`,"arrow-left":`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`,play:`<polygon points="6 3 20 12 6 21 6 3"/>`,"zoom-in":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>`,"zoom-out":`<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M8 11h6"/>`,fit:`<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>`,"panel-left":`<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>`,layers:`<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>`,file:`<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>`,palette:`<circle cx="13.5" cy="6.5" r="1"/><circle cx="17.5" cy="10.5" r="1"/><circle cx="8.5" cy="7.5" r="1"/><circle cx="6.5" cy="12.5" r="1"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.93 0 1.65-.75 1.65-1.69 0-.44-.18-.84-.44-1.13-.29-.29-.44-.65-.44-1.13a1.64 1.64 0 0 1 1.67-1.67h2c3.05 0 5.55-2.5 5.55-5.55C21.96 6.01 17.46 2 12 2z"/>`,type:`<path d="M4 7V4h16v3"/><path d="M9 20h6"/><path d="M12 4v16"/>`,shape:`<path d="M5 3a2 2 0 0 0-2 2"/><path d="M19 3a2 2 0 0 1 2 2"/><path d="M21 19a2 2 0 0 1-2 2"/><path d="M5 21a2 2 0 0 1-2-2"/><path d="M9 3h1"/><path d="M9 21h1"/><path d="M14 3h1"/><path d="M14 21h1"/><path d="M3 9v1"/><path d="M21 9v1"/><path d="M3 14v1"/><path d="M21 14v1"/>`,motion:`<path d="M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M2 6c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1 .6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>`,book:`<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,image:`<rect width="18" height="18" x="3" y="3" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>`,monitor:`<rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/>`,smartphone:`<rect width="14" height="20" x="5" y="2" rx="2"/><path d="M12 18h.01"/>`,tablet:`<rect width="16" height="20" x="4" y="2" rx="2"/><path d="M12 18h.01"/>`,note:`<path d="M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z"/><path d="M15 3v4a2 2 0 0 0 2 2h4"/>`,globe:`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`,pointer:`<path d="M4.04 4.69a.5.5 0 0 1 .65-.65l16 6.5a.5.5 0 0 1-.06.95l-6.12 1.58a2 2 0 0 0-1.44 1.44l-1.58 6.12a.5.5 0 0 1-.95.06z"/>`,component:`<path d="M5.5 8.5 9 12l-3.5 3.5L2 12l3.5-3.5Z"/><path d="m12 2 3.5 3.5L12 9 8.5 5.5 12 2Z"/><path d="M18.5 8.5 22 12l-3.5 3.5L15 12l3.5-3.5Z"/><path d="m12 15 3.5 3.5L12 22l-3.5-3.5L12 15Z"/>`,keyboard:`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="M6 8h.01"/><path d="M10 8h.01"/><path d="M14 8h.01"/><path d="M18 8h.01"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/><path d="M7 16h10"/>`,folder:`<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>`,canvas:`<rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/>`};function Z({name:e,size:t=16,strokeWidth:n=1.75,className:r}){return(0,I.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`shrink-0 ${e===`loader`?`animate-spin`:``} ${r??``}`,dangerouslySetInnerHTML:{__html:g_[e]}})}function Q({children:e,size:t=12.5,className:n,title:r,wrap:i}){return(0,I.jsx)(`span`,{title:r,className:X(i?`break-all`:`whitespace-nowrap`,`font-mono`,n),style:{fontSize:t},children:e})}function __({children:e}){return(0,I.jsx)(`kbd`,{className:`rounded-[4px] border border-rule bg-surface px-[5px] py-px font-mono text-[11px] text-ink2`,children:e})}function v_({top:e,bottom:t,weight:n=500}){return(0,I.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px`,children:[(0,I.jsx)(`span`,{className:`truncate leading-[1.35]`,style:{fontWeight:n},children:e}),t?(0,I.jsx)(`span`,{className:`flex min-w-0 items-center gap-2.5 overflow-hidden whitespace-nowrap text-[12.5px] leading-[1.35] text-muted`,children:t}):null]})}var y_={canvas:`This canvas`,canvases:`Canvases`,system:`Design system`,actions:`Actions`};function b_(e){let t=/^\/c\/([^/]+)/.exec(e);return t?decodeURIComponent(t[1]):null}function x_({onClose:e}){let[t,n]=P(),r=Jg().scope,i=Zg().data,a=r?.canvas??b_(t),o=Qg(a??``,!!a).data,s=$g(!!i?.system).data,[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(0),f=t=>()=>{e(),t()},p=[];if(o)for(let e of o.pages){p.push({id:`page:${e.id}`,group:`canvas`,label:e.title,icon:`file`,hint:`Page`,run:f(()=>n(`/c/${encodeURIComponent(o.id)}/p/${encodeURIComponent(e.id)}`))});for(let t of e.sections)for(let r of t.items)(r.kind===`screen`||r.kind===`url`)&&p.push({id:`item:${e.id}:${r.id}`,group:`canvas`,label:r.title,icon:r.kind===`url`?`globe`:`monitor`,hint:t.title?`${e.title} · ${t.title}`:e.title,keywords:`${r.id} ${t.title??``}`,searchOnly:!0,run:f(()=>{n(`/c/${encodeURIComponent(o.id)}/p/${encodeURIComponent(e.id)}`),r_(o.id,r.id)})})}for(let e of i?.canvases??[])e.id!==a&&p.push({id:`canvas:${e.id}`,group:`canvases`,label:e.title,icon:`canvas`,hint:`${e.screens} screens`,keywords:e.id,run:f(()=>n(`/c/${encodeURIComponent(e.id)}`))});if(i?.system){for(let[e,t,r]of[[`Overview`,`/system`,`book`],[`Colors`,`/system/colors`,`palette`],[`Typography`,`/system/typography`,`type`],[`Spacing & shape`,`/system/shape`,`shape`]])p.push({id:`sys:${t}`,group:`system`,label:e,icon:r,run:f(()=>n(t))});for(let e of s?.components??[])p.push({id:`component:${e.id}`,group:`system`,label:e.title,icon:`component`,hint:e.group,searchOnly:!0,run:f(()=>n(`/system/components/${encodeURIComponent(e.id)}`))});for(let e of s?.guidelines??[])p.push({id:`guide:${e.slug}`,group:`system`,label:e.title,icon:`book`,hint:`Guideline`,searchOnly:!0,run:f(()=>n(`/system/guidelines/${encodeURIComponent(e.slug)}`))})}r||p.push({id:`home`,group:`actions`,label:`All canvases`,icon:`home`,run:f(()=>n(`/`))}),p.push({id:`light`,group:`actions`,label:`Light appearance`,icon:`sun`,searchOnly:!0,run:f(()=>p_(`light`))},{id:`dark`,group:`actions`,label:`Dark appearance`,icon:`moon`,searchOnly:!0,run:f(()=>p_(`dark`))},{id:`system-theme`,group:`actions`,label:`System appearance`,icon:`monitor`,searchOnly:!0,run:f(()=>p_(`system`))});let m=c.trim().toLowerCase(),h=p.filter(e=>m?`${e.label} ${e.keywords??``} ${typeof e.hint==`string`?e.hint:``}`.toLowerCase().includes(m):!e.searchOnly),g=[`canvas`,`canvases`,`system`,`actions`].map(e=>({group:e,items:h.filter(t=>t.group===e)})).filter(e=>e.items.length),_=g.flatMap(e=>e.items),y=Math.min(u,Math.max(_.length-1,0)),b=-1;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(kg,{className:`sr-only`,children:`Search and jump`}),(0,I.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-rule px-4`,children:[(0,I.jsx)(Z,{name:`search`,size:16,className:`text-muted`}),(0,I.jsx)(`input`,{value:c,onChange:e=>{l(e.target.value),d(0)},onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),d((y+1)%Math.max(_.length,1))):e.key===`ArrowUp`?(e.preventDefault(),d((y-1+_.length)%Math.max(_.length,1))):e.key===`Enter`&&(e.preventDefault(),_[y]?.run())},placeholder:`Canvases, screens, components…`,"aria-label":`Search and jump`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`palette-list`,autoComplete:`off`,spellCheck:!1,className:`h-full min-w-0 grow border-0 bg-transparent text-[15px] text-ink outline-none placeholder:text-muted`}),(0,I.jsx)(__,{children:`esc`})]}),(0,I.jsx)(`div`,{id:`palette-list`,role:`listbox`,className:`min-h-0 grow overflow-y-auto py-1.5`,children:g.length?g.map(({group:e,items:t})=>(0,I.jsxs)(`div`,{role:`presentation`,children:[(0,I.jsx)(`div`,{className:`px-4 pt-2.5 pb-1 text-[12px] text-muted`,children:y_[e]}),t.map(e=>{b+=1;let t=b,n=t===y;return(0,I.jsxs)(`button`,{type:`button`,role:`option`,tabIndex:-1,"aria-selected":n,ref:n?e=>e?.scrollIntoView({block:`nearest`}):void 0,onMouseMove:()=>n?void 0:d(t),onClick:e.run,className:X(`flex h-10 w-full cursor-pointer items-center gap-3 border-0 px-4 text-left text-[13.5px] text-ink`,n?`bg-soft`:`bg-transparent`),children:[(0,I.jsx)(`span`,{className:`flex w-5 shrink-0 justify-center text-ink2`,children:(0,I.jsx)(Z,{name:e.icon,size:16})}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.label}),e.hint?(0,I.jsx)(`span`,{className:`flex shrink-0 items-center text-[12.5px] text-muted`,children:e.hint}):null]},e.id)})]},e)):(0,I.jsx)(`div`,{className:`px-6 py-10 text-center text-[13px] text-muted`,children:`Nothing matches.`})}),(0,I.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-4 border-t border-rule bg-soft px-4 text-[12px] text-muted`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(__,{children:`↑`}),(0,I.jsx)(__,{children:`↓`}),`move`]}),(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(__,{children:`↵`}),`open`]})]})]})}function S_(){let[e,t]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let e=()=>t(e=>!e),n=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`k`&&(t.preventDefault(),e())};return window.addEventListener(`keydown`,n),window.addEventListener(`design:palette`,e),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`design:palette`,e)}},[]),(0,I.jsx)(mg,{open:e,onOpenChange:t,children:(0,I.jsx)(ed,{children:e?(0,I.jsx)(vg,{forceMount:!0,children:(0,I.jsx)(bg,{asChild:!0,forceMount:!0,children:(0,I.jsx)(Wf.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.14},className:`fixed inset-0 z-50 flex items-start justify-center bg-overlay p-6 pt-[12vh]`,children:(0,I.jsx)(wg,{asChild:!0,forceMount:!0,"aria-describedby":void 0,children:(0,I.jsx)(Wf.div,{initial:{opacity:0,scale:.98,y:-6},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,transition:{duration:.1}},transition:{type:`spring`,stiffness:560,damping:40},className:`flex max-h-[min(560px,76vh)] w-[560px] max-w-full flex-col overflow-hidden rounded-[12px] border border-rule bg-surface shadow-pop outline-none`,children:(0,I.jsx)(x_,{onClose:()=>t(!1)})})})})})}):null})})}var C_=/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`;function w_(){window.dispatchEvent(new CustomEvent(`design:palette`))}function T_({width:e=240,label:t=`Search and jump`}){return(0,I.jsxs)(`button`,{type:`button`,onClick:w_,style:{width:e},className:`flex h-ctrl min-w-0 shrink cursor-pointer items-center gap-2 rounded-[6px] border border-rule bg-soft pr-1.5 pl-3 text-ctrl text-muted transition-colors hover:border-rule-strong max-lg:w-auto!`,children:[(0,I.jsx)(Z,{name:`search`,size:15}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate text-left max-lg:hidden`,children:t}),(0,I.jsx)(__,{children:C_===`⌘`?`⌘K`:`Ctrl K`})]})}var E_={primary:`border border-primary bg-primary text-primary-ink hover:opacity-90`,secondary:`border border-rule-strong bg-surface text-ink hover:bg-soft`,ghost:`border border-transparent bg-transparent text-ink2 hover:bg-soft2`,dashed:`border border-dashed border-rule-strong bg-transparent text-ink2 hover:bg-soft`,danger:`border border-danger bg-danger text-on-danger hover:opacity-90`},D_=(e=`secondary`,t)=>X(`inline-flex h-ctrl shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-[6px] px-ctrl text-ctrl font-medium leading-none no-underline transition-[background-color,opacity] duration-100`,`disabled:cursor-not-allowed disabled:opacity-45 aria-disabled:cursor-not-allowed aria-disabled:opacity-45`,E_[e],t),O_=(0,v.forwardRef)(function({kind:e=`secondary`,icon:t,loading:n,disabled:r,className:i,children:a,type:o=`button`,...s},c){return(0,I.jsxs)(`button`,{ref:c,type:o,disabled:r||n,"aria-busy":n||void 0,className:D_(e,i),...s,children:[n?(0,I.jsx)(Z,{name:`loader`,size:15,className:`animate-spin`}):t?(0,I.jsx)(Z,{name:t,size:15}):null,a]})}),k_={ghost:`border border-transparent bg-transparent text-muted hover:bg-soft2 hover:text-ink2`,secondary:`border border-rule-strong bg-surface text-ink2 hover:bg-soft`},A_=(e=`ghost`,t)=>X(`inline-flex h-ctrl w-ctrl shrink-0 cursor-pointer items-center justify-center rounded-[6px] p-0 transition-colors duration-100 disabled:cursor-not-allowed disabled:opacity-45`,k_[e],t),j_=(0,v.forwardRef)(function({icon:e,label:t,kind:n=`ghost`,size:r=16,className:i,type:a=`button`,...o},s){return(0,I.jsx)(`button`,{ref:s,type:a,"aria-label":t,title:t,className:A_(n,i),...o,children:(0,I.jsx)(Z,{name:e,size:r})})});function M_({to:e,kind:t=`secondary`,icon:n,className:r,children:i}){return(0,I.jsxs)(xe,{href:e,className:D_(t,r),children:[n?(0,I.jsx)(Z,{name:n,size:15}):null,i]})}function N_({kind:e=`secondary`,icon:t,className:n,children:r,...i}){return(0,I.jsxs)(`a`,{className:D_(e,n),...i,children:[t?(0,I.jsx)(Z,{name:t,size:15}):null,r]})}var P_=Object.defineProperty,F_=(e,t)=>P_(e,`name`,{value:t,configurable:!0});function I_(e){let t=e+`CollectionProvider`,[n,r]=ap(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=F_(e=>{let{scope:t,children:n}=e,r=v.useRef(null),a=v.useRef(new Map).current;return(0,I.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=kp(s),l=v.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(s,n).collectionRef);return(0,I.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=kp(u),p=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),s=tp(t,o),c=a(u,n);return v.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,I.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return v.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return F_(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}F_(I_,`createCollection`);var L_=new WeakMap,R_=class e extends Map{static{F_(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],L_.set(this,!0)}set(e,t){return L_.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=V_(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=z_(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=z_(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return z_(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function z_(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=B_(e,t);return n===-1?void 0:e[n]}F_(z_,`at`);function B_(e,t){let n=e.length,r=V_(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}F_(B_,`toSafeIndex`);function V_(e){return e!==e||e===0?0:Math.trunc(e)}F_(V_,`toSafeInteger`);function H_(e){let t=e+`CollectionProvider`,[n,r]=ap(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new R_,setItemMap:F_(()=>void 0,`setItemMap`)}),o=F_(({state:e,...t})=>e?(0,I.jsx)(c,{...t,state:e}):(0,I.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=F_(e=>{let t=h();return(0,I.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=F_(e=>{let{scope:t,children:n,state:r}=e,a=v.useRef(null),[o,s]=v.useState(null),c=tp(a,s),[l,u]=r;return v.useEffect(()=>{if(!o)return;let e=K_(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,I.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=kp(l),d=v.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=tp(t,a(l,n).collectionRef);return(0,I.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=kp(f),m=v.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=v.useRef(null),[s,c]=v.useState(null),l=tp(t,o,c),{setItemMap:u}=a(f,n),d=v.useRef(i);U_(d.current,i)||(d.current=i);let m=d.current;return v.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(G_):(t.set(s,{...e,element:s}),t.toSorted(G_)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new R_(e)))}},[s,m,u]),(0,I.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return v.useState(new R_)}F_(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return F_(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}F_(H_,`createCollection`);function U_(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}F_(U_,`shallowEqual`);function W_(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}F_(W_,`isElementPreceding`);function G_(e,t){return!e[1].element||!t[1].element?0:W_(e[1].element,t[1].element)?-1:1}F_(G_,`sortByDocumentPosition`);function K_(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}F_(K_,`getChildListObserver`);var q_=Object.defineProperty,J_=(e,t)=>q_(e,`name`,{value:t,configurable:!0}),Y_=v.createContext(void 0);function X_(e){let t=v.useContext(Y_);return e||t||`ltr`}J_(X_,`useDirection`);var Z_=[`top`,`right`,`bottom`,`left`],Q_=Math.min,$_=Math.max,ev=Math.round,tv=Math.floor,nv=e=>({x:e,y:e}),rv={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function iv(e,t,n){return $_(e,Q_(t,n))}function av(e,t){return typeof e==`function`?e(t):e}function ov(e){return e.split(`-`)[0]}function sv(e){return e.split(`-`)[1]}function cv(e){return e===`x`?`y`:`x`}function lv(e){return e===`y`?`height`:`width`}function uv(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function dv(e){return cv(uv(e))}function fv(e,t,n){n===void 0&&(n=!1);let r=sv(e),i=dv(e),a=lv(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=xv(o)),[o,xv(o)]}function pv(e){let t=xv(e);return[mv(e),t,mv(t)]}function mv(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var hv=[`left`,`right`],gv=[`right`,`left`],_v=[`top`,`bottom`],vv=[`bottom`,`top`];function yv(e,t,n){switch(e){case`top`:case`bottom`:return n?t?gv:hv:t?hv:gv;case`left`:case`right`:return t?_v:vv;default:return[]}}function bv(e,t,n,r){let i=sv(e),a=yv(ov(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(mv)))),a}function xv(e){let t=ov(e);return rv[t]+e.slice(t.length)}function Sv(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Cv(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Sv(e)}function wv(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 Tv(e,t,n){let{reference:r,floating:i}=e,a=uv(t),o=dv(t),s=lv(o),c=ov(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=sv(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Ev(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}=av(t,e),p=Cv(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=wv(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=wv(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 Dv=50,Ov=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Ev},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Tv(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<Dv&&(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}=Tv(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},kv=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}=av(e,t)||{};if(l==null)return{};let d=Cv(u),f={x:n,y:r},p=dv(i),m=lv(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=Q_(d[_],T),D=Q_(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=iv(E,k,O),j=!c.arrow&&sv(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,ee=j?k<E?k-E:k-O:0;return{[p]:f[p]+ee,data:{[p]:A,centerOffset:k-A-ee,...j&&{alignmentOffset:ee}},reset:j}}}),Av=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}=av(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ov(r),_=uv(o),v=ov(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[xv(o)]:pv(o)),x=p!==`none`;!d&&x&&b.push(...bv(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=fv(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`||_===uv(t)||T.every(e=>uv(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=uv(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 jv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mv(e){return Z_.some(t=>e[t]>=0)}var Nv=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=av(e,t);switch(i){case`referenceHidden`:{let e=jv(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Mv(e)}}}case`escaped`:{let e=jv(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Mv(e)}}}default:return{}}}}},Pv=new Set([`left`,`top`]);async function Fv(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ov(n),s=sv(n),c=uv(n)===`y`,l=Pv.has(o)?-1:1,u=a&&c?-1:1,d=av(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 Iv=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 Fv(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}}}}},Lv=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}=av(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=uv(i),p=cv(f),m=u[p],h=u[f],g=(e,t)=>iv(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}}}}}},Rv=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}=av(e,t),u={x:n,y:r},d=uv(i),f=cv(d),p=u[f],m=u[d],h=av(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=Pv.has(ov(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}}}},zv=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}=av(e,t),c=await i.detectOverflow(t,s),l=ov(n),u=sv(n),d=uv(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=Q_(p-c[m],g),y=Q_(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*$_(c.left,c.right):S=p-2*$_(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 Bv(){return typeof window<`u`}function Vv(e){return Wv(e)?(e.nodeName||``).toLowerCase():`#document`}function Hv(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Uv(e){return((Wv(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Wv(e){return Bv()?e instanceof Node||e instanceof Hv(e).Node:!1}function Gv(e){return Bv()?e instanceof Element||e instanceof Hv(e).Element:!1}function Kv(e){return Bv()?e instanceof HTMLElement||e instanceof Hv(e).HTMLElement:!1}function qv(e){return!Bv()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Hv(e).ShadowRoot}function Jv(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ay(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Yv(e){return/^(table|td|th)$/.test(Vv(e))}function Xv(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Zv=/transform|translate|scale|rotate|perspective|filter/,Qv=/paint|layout|strict|content/,$v=e=>!!e&&e!==`none`,ey;function ty(e){let t=Gv(e)?ay(e):e;return $v(t.transform)||$v(t.translate)||$v(t.scale)||$v(t.rotate)||$v(t.perspective)||!ry()&&($v(t.backdropFilter)||$v(t.filter))||Zv.test(t.willChange||``)||Qv.test(t.contain||``)}function ny(e){let t=sy(e);for(;Kv(t)&&!iy(t);){if(ty(t))return t;if(Xv(t))return null;t=sy(t)}return null}function ry(){return ey??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ey}function iy(e){return/^(html|body|#document)$/.test(Vv(e))}function ay(e){return Hv(e).getComputedStyle(e)}function oy(e){return Gv(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function sy(e){if(Vv(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||qv(e)&&e.host||Uv(e);return qv(t)?t.host:t}function cy(e){let t=sy(e);return iy(t)?(e.ownerDocument||e).body:Kv(t)&&Jv(t)?t:cy(t)}function ly(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=cy(e),i=r===e.ownerDocument?.body,a=Hv(r);if(i){let e=uy(a);return t.concat(a,a.visualViewport||[],Jv(r)?r:[],e&&n?ly(e):[])}return t.concat(r,ly(r,[],n))}function uy(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dy(e){let t=ay(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Kv(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ev(n)!==a||ev(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function fy(e){return Gv(e)?e:e.contextElement}function py(e){let t=fy(e);if(!Kv(t))return nv(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dy(t),o=(a?ev(n.width):n.width)/r,s=(a?ev(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var my=nv(0);function hy(e){let t=Hv(e);return!ry()||!t.visualViewport?my:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gy(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Hv(e)}function _y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=fy(e),o=nv(1);t&&(r?Gv(r)&&(o=py(r)):o=py(e));let s=gy(a,n,r)?hy(a):nv(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=Hv(a),t=Gv(r)?Hv(r):r,n=e,i=uy(n);for(;i&&t!==n;){let e=py(i),t=i.getBoundingClientRect(),r=ay(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=Hv(i),i=uy(n)}}return wv({width:u,height:d,x:c,y:l})}function vy(e,t){let n=oy(e).scrollLeft;return t?t.left+n:_y(Uv(e)).left+n}function yy(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vy(e,n),y:n.top+t.scrollTop}}function by(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Uv(r),s=t?Xv(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=nv(1),u=nv(0),d=Kv(r);if((d||!a)&&((Vv(r)!==`body`||Jv(o))&&(c=oy(r)),d)){let e=_y(r);l=py(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yy(o,c):nv(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 xy(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Sy(e){let t=oy(e),n=e.ownerDocument.body,r=$_(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=$_(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+vy(e),o=-t.scrollTop;return ay(n).direction===`rtl`&&(a+=$_(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Cy=25;function wy(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Hv(e),a=Uv(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ry()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(vy(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<=Cy&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ty(e,t){let n=_y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=py(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ey(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=wy(e,n,t);else if(t===`document`)r=Sy(Uv(e));else if(Gv(t))r=Ty(t,n);else{let n=hy(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return wv(r)}function Dy(e,t){let n=t.get(e);if(n)return n;let r=ly(e,[],!1).filter(e=>Gv(e)&&Vv(e)!==`body`),i=null,a=ay(e).position===`fixed`,o=a?sy(e):e;for(;Gv(o)&&!iy(o);){let e=ay(o),t=ty(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=sy(o)}return t.set(e,r),r}function Oy(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Xv(t)?[]:Dy(t,this._c):[].concat(n),r],o=Ey(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=Ey(t,a[e],i);s=$_(n.top,s),c=Q_(n.right,c),l=Q_(n.bottom,l),u=$_(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ky(e){let{width:t,height:n}=dy(e);return{width:t,height:n}}function Ay(e,t,n){let r=Kv(t),i=Uv(t),a=n===`fixed`,o=_y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=nv(0);if((r||!a)&&((Vv(t)!==`body`||Jv(i))&&(s=oy(t)),r)){let e=_y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=vy(i));let l=i&&!r&&!a?yy(i,s):nv(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 jy(e){return ay(e).position===`static`}function My(e,t){if(!Kv(e)||ay(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Uv(e)===n&&(n=n.ownerDocument.body),n}function Ny(e,t){let n=Hv(e);if(Xv(e))return n;if(!Kv(e)){let t=sy(e);for(;t&&!iy(t);){if(Gv(t)&&!jy(t))return t;t=sy(t)}return n}let r=My(e,t);for(;r&&Yv(r)&&jy(r);)r=My(r,t);return r&&iy(r)&&jy(r)&&!ty(r)?n:r||ny(e)||n}var Py=async function(e){let t=this.getOffsetParent||Ny,n=this.getDimensions,r=await n(e.floating);return{reference:Ay(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Fy(e){return ay(e).direction===`rtl`}var Iy={convertOffsetParentRelativeRectToViewportRelativeRect:by,getDocumentElement:Uv,getClippingRect:Oy,getOffsetParent:Ny,getElementRects:Py,getClientRects:xy,getDimensions:ky,getScale:py,isElement:Gv,isRTL:Fy};function Ly(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ry(e,t,n){let r=null,i,a=Uv(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=tv(d),h=tv(a.clientWidth-(u+f)),g=tv(a.clientHeight-(d+p)),_=tv(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:$_(0,Q_(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Ly(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=Hv(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function zy(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=fy(e),u=i||a?[...l?ly(l):[],...t?ly(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ry(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?_y(e):null;c&&g();function g(){let t=_y(e);h&&!Ly(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 By=Iv,Vy=Lv,Hy=Av,Uy=zv,Wy=Nv,Gy=kv,Ky=Rv,qy=(e,t,n)=>{let r=new Map,i=n??{},a={...Iy,...i.platform,_c:r};return Ov(e,t,{...i,platform:a})},Jy=typeof document<`u`?v.useLayoutEffect:function(){};function Yy(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(!Yy(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)&&!Yy(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Xy(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zy(e,t){let n=Xy(e);return Math.round(t*n)/n}function Qy(e){let t=v.useRef(e);return Jy(()=>{t.current=e}),t}function $y(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]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);Yy(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Qy(c),O=Qy(i),k=Qy(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),qy(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Yy(T.current,t)&&(T.current=t,Ep.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Jy(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);Jy(()=>(j.current=!0,()=>{j.current=!1}),[]),Jy(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let ee=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),te=v.useMemo(()=>({reference:x,floating:S}),[x,S]),ne=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Zy(te.floating,u.x),r=Zy(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Xy(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:ee,elements:te,floatingStyles:ne}),[u,A,ee,te,ne])}var eb=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?{}:Gy({element:r.current,padding:i}).fn(n):r?Gy({element:r,padding:i}).fn(n):{}}}},tb=(e,t)=>{let n=By(e);return{name:n.name,fn:n.fn,options:[e,t]}},nb=(e,t)=>{let n=Vy(e);return{name:n.name,fn:n.fn,options:[e,t]}},rb=(e,t)=>({fn:Ky(e).fn,options:[e,t]}),ib=(e,t)=>{let n=Hy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ab=(e,t)=>{let n=Uy(e);return{name:n.name,fn:n.fn,options:[e,t]}},ob=(e,t)=>{let n=Wy(e);return{name:n.name,fn:n.fn,options:[e,t]}},sb=(e,t)=>{let n=eb(e);return{name:n.name,fn:n.fn,options:[e,t]}},cb=Object.defineProperty,lb=(e,t)=>cb(e,`name`,{value:t,configurable:!0});function ub(e){let[t,n]=v.useState(void 0);return sp(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}lb(ub,`useSize`);var db=Object.defineProperty,fb=(e,t)=>db(e,`name`,{value:t,configurable:!0}),pb=`Popper`,[mb,hb]=ap(pb),[gb,_b]=mb(pb),vb=fb(e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,I.jsx)(gb,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),yb=`PopperAnchor`,bb=v.forwardRef(fb(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=_b(yb,n),o=v.useRef(null),s=a.onAnchorChange,c=tp(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Db(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,I.jsx)(Wp.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),xb=`PopperContent`,[Sb,Cb]=mb(xb),wb=v.forwardRef(fb(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=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=_b(xb,n),[_,y]=v.useState(null),b=tp(t,y),[x,S]=v.useState(null),C=ub(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Tb),altBoundary:k},{refs:j,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:M}=$y({strategy:`fixed`,placement:E,whileElementsMounted:fb((...e)=>zy(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[tb({mainAxis:i+T,alignmentAxis:o}),c&&nb({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?rb():void 0,...A}),c&&ib({...A}),ab({...A,apply:fb(({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`)}),x&&sb({element:x,padding:s}),Eb({arrowWidth:w,arrowHeight:T}),f&&ob({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),re=g.setPlacementState;sp(()=>(re(te),()=>{re(void 0)}),[te,re]);let[ie,N]=Db(te),ae=Jp(m);sp(()=>{ne&&ae?.()},[ne,ae]);let oe=M.arrow?.x,se=M.arrow?.y,ce=M.arrow?.centerOffset!==0,[le,ue]=v.useState();return sp(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,I.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,I.jsx)(Sb,{scope:n,placedSide:ie,placedAlign:N,onArrowChange:S,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,I.jsx)(Wp.div,{"data-side":ie,"data-align":N,...h,ref:b,style:{...h.style,animation:ne?h.style?.animation:`none`}})})})},`PopperContent`));function Tb(e){return e!==null}fb(Tb,`isNotNull`);var Eb=fb(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]=Db(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 Db(e){let[t,n=`center`]=e.split(`-`);return[t,n]}fb(Db,`getSideAndAlignFromPlacement`);var Ob=vb,kb=bb,Ab=wb,jb=Object.defineProperty,Mb=(e,t)=>jb(e,`name`,{value:t,configurable:!0}),Nb=!1;function Pb(){let[e,t]=v.useState(Nb);return v.useEffect(()=>{Nb||(Nb=!0,t(!0))},[]),e}Mb(Pb,`useIsHydrated`);var Fb=v.useSyncExternalStore;function Ib(){return()=>{}}Mb(Ib,`subscribe`);function Lb(){return Fb(Ib,()=>!0,()=>!1)}Mb(Lb,`useIsHydratedModern`);var Rb=typeof Fb==`function`?Lb:Pb,zb=Object.defineProperty,Bb=(e,t)=>zb(e,`name`,{value:t,configurable:!0}),Vb=`rovingFocusGroup.onEntryFocus`,Hb={bubbles:!1,cancelable:!0},Ub=`RovingFocusGroup`,[Wb,Gb,Kb]=I_(Ub),[qb,Jb]=ap(Ub,[Kb]),[Yb,Xb]=qb(Ub),Zb=v.forwardRef(Bb(function(e,t){return(0,I.jsx)(Wb.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Wb.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,I.jsx)(Qb,{...e,ref:t})})})},`RovingFocusGroup`)),Qb=v.forwardRef(Bb(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=v.useRef(null),p=tp(t,f),m=X_(a),[h,g]=xp({prop:o,defaultProp:s??null,onChange:c,caller:Ub}),[_,y]=v.useState(!1),b=Jp(l),x=Gb(n),S=v.useRef(!1),[C,w]=v.useState(0);return v.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Vb,b),()=>e.removeEventListener(Vb,b)},[b]),(0,I.jsx)(Yb,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:v.useCallback(e=>g(e),[g]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>w(e=>e-1),[]),children:(0,I.jsx)(Wp.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Y(e.onMouseDown,()=>{S.current=!0}),onFocus:Y(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Vb,Hb);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);ix([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:Y(e.onBlur,()=>y(!1))})})},`RovingFocusGroupImpl`)),$b=`RovingFocusGroupItem`,ex=v.forwardRef(Bb(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=fp(),l=a||c,u=Xb($b,n),d=u.currentTabStopId===l,f=Gb(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Rb();return sp(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),v.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,I.jsx)(Wb.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,I.jsx)(Wp.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Y(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Y(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Y(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=rx(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?ax(n,r+1):n.slice(r+1)}setTimeout(()=>ix(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),tx={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function nx(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}Bb(nx,`getDirectionAwareKey`);function rx(e,t,n){let r=nx(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return tx[r]}Bb(rx,`getFocusIntent`);function ix(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Bb(ix,`focusFirst`);function ax(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Bb(ax,`wrapArray`);var ox=Zb,sx=ex,cx=Object.defineProperty,lx=(e,t)=>cx(e,`name`,{value:t,configurable:!0}),ux=[`Enter`,` `],dx=[`ArrowDown`,`PageUp`,`Home`],fx=[`ArrowUp`,`PageDown`,`End`],px=[...dx,...fx];[...ux],[...ux];var mx=`Menu`,[hx,gx,_x]=I_(mx),[vx,yx]=ap(mx,[_x,hb,Jb]),bx=hb(),xx=Jb(),[Sx,Cx]=vx(mx),[wx,Tx]=vx(mx),Ex=lx(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=bx(t),[c,l]=v.useState(null),u=v.useRef(!1),d=Jp(a),f=X_(i);return v.useEffect(()=>{let e=lx(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=lx(()=>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})}},[]),v.useEffect(()=>{if(!n)return;let e=lx(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,I.jsx)(Ob,{...s,children:(0,I.jsx)(Sx,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,I.jsx)(wx,{scope:t,onClose:v.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Dx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e,i=bx(n);return(0,I.jsx)(kb,{...i,...r,ref:t})},`MenuAnchor`)),Ox=`MenuPortal`,[kx,Ax]=vx(Ox,{forceMount:void 0}),jx=lx(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Cx(Ox,t);return(0,I.jsx)(kx,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`MenuPortal`),Mx=`MenuContent`,[Nx,Px]=vx(Mx),Fx=v.forwardRef(lx(function(e,t){let n=Ax(Mx,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Cx(Mx,e.__scopeMenu),o=Tx(Mx,e.__scopeMenu);return(0,I.jsx)(hx.Provider,{scope:e.__scopeMenu,children:(0,I.jsx)(jm,{present:r||a.open,children:(0,I.jsx)(hx.Slot,{scope:e.__scopeMenu,children:o.modal?(0,I.jsx)(Ix,{...i,ref:t}):(0,I.jsx)(Lx,{...i,ref:t})})})})},`MenuContent`)),Ix=v.forwardRef(lx(function(e,t){let n=Cx(Mx,e.__scopeMenu),r=v.useRef(null),i=tp(t,r);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(zx,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),Lx=v.forwardRef(lx(function(e,t){let n=Cx(Mx,e.__scopeMenu);return(0,I.jsx)(zx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),Rx=kp(`MenuContent.ScrollLock`),zx=v.forwardRef(lx(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=Cx(Mx,n),_=Tx(Mx,n),y=bx(n),b=xx(n),x=gx(n),[S,C]=v.useState(null),w=v.useRef(null),T=tp(t,w,g.onContentChange),E=v.useRef(0),D=v.useRef(``),O=v.useRef(0),k=v.useRef(null),A=v.useRef(`right`),j=v.useRef(0),ee=m?Zh:v.Fragment,te=m?{as:Rx,allowPinchZoom:!0}:void 0,ne=lx(e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=rS(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;lx((function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);v.useEffect(()=>()=>window.clearTimeout(E.current),[]),Hm();let M=v.useCallback(e=>A.current===k.current?.side&&aS(e,k.current?.area),[]);return(0,I.jsx)(Nx,{scope:n,searchRef:D,onItemEnter:v.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:v.useCallback(e=>{M(e)||(w.current?.focus(),C(null))},[M]),onTriggerLeave:v.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(e=>{k.current=e},[]),children:(0,I.jsx)(ee,{...te,children:(0,I.jsx)(mm,{asChild:!0,trapped:i,onMountAutoFocus:Y(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,I.jsx)(ox,{asChild:!0,...b,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Y(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,I.jsx)(Ab,{role:`menu`,"aria-orientation":`vertical`,"data-state":Qx(g.open),"data-radix-menu-content":``,dir:_.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:Y(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&&ne(e.key));let i=w.current;if(e.target!==i||!px.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);fx.includes(e.key)&&a.reverse(),tS(a)}),onBlur:Y(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:Y(e.onPointerMove,oS(e=>{let t=e.target,n=j.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>j.current?`right`:`left`;A.current=t,j.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),Bx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e;return(0,I.jsx)(Wp.div,{...r,ref:t})},`MenuLabel`)),Vx=`MenuItem`,Hx=`menu.itemSelect`,Ux=v.forwardRef(lx(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=v.useRef(null),o=Tx(Vx,e.__scopeMenu),s=Px(Vx,e.__scopeMenu),c=tp(t,a),l=v.useRef(!1),u=lx(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Hx,{bubbles:!0,cancelable:!0});e.addEventListener(Hx,e=>r?.(e),{once:!0}),Gp(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,I.jsx)(Wx,{...i,ref:c,disabled:n,onClick:Y(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:Y(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:Y(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&ux.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),Wx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Px(Vx,n),s=xx(n),c=v.useRef(null),l=tp(t,c),[u,d]=v.useState(!1),[f,p]=v.useState(``);return v.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,I.jsx)(hx.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,I.jsx)(sx,{asChild:!0,...s,focusable:!r,children:(0,I.jsx)(Wp.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:Y(e.onPointerMove,oS(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Y(e.onPointerLeave,oS(e=>o.onItemLeave(e))),onFocus:Y(e.onFocus,()=>d(!0)),onBlur:Y(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[Gx,Kx]=vx(`MenuRadioGroup`,{value:void 0,onValueChange:lx(()=>{},`onValueChange`)}),[qx,Jx]=vx(`MenuItemIndicator`,{checked:!1}),Yx=v.forwardRef(lx(function(e,t){let{__scopeMenu:n,...r}=e;return(0,I.jsx)(Wp.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Xx,Zx]=vx(`MenuSub`);function Qx(e){return e?`open`:`closed`}lx(Qx,`getOpenState`);function $x(e){return e===`indeterminate`}lx($x,`isIndeterminate`);function eS(e){return $x(e)?`indeterminate`:e?`checked`:`unchecked`}lx(eS,`getCheckedState`);function tS(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}lx(tS,`focusFirst`);function nS(e,t){return e.map((n,r)=>e[(t+r)%e.length])}lx(nS,`wrapArray`);function rS(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=nS(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}lx(rS,`getNextMatch`);function iS(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}lx(iS,`isPointInPolygon`);function aS(e,t){return t?iS({x:e.clientX,y:e.clientY},t):!1}lx(aS,`isPointerInGraceArea`);function oS(e){return t=>t.pointerType===`mouse`?e(t):void 0}lx(oS,`whenMouse`);var sS=Ex,cS=Dx,lS=jx,uS=Fx,dS=Bx,fS=Ux,pS=Yx,mS=Object.defineProperty,hS=(e,t)=>mS(e,`name`,{value:t,configurable:!0}),gS=`DropdownMenu`,[_S,vS]=ap(gS,[yx]),yS=yx(),[bS,xS]=_S(gS),SS=hS(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=yS(t),l=v.useRef(null),[u,d]=xp({prop:i,defaultProp:a??!1,onChange:o,caller:gS});return(0,I.jsx)(bS,{scope:t,triggerId:fp(),triggerRef:l,contentId:fp(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,I.jsx)(sS,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),CS=`DropdownMenuTrigger`,wS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=xS(CS,n),o=yS(n),s=tp(t,a.triggerRef);return(0,I.jsx)(cS,{asChild:!0,...o,children:(0,I.jsx)(Wp.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:Y(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:Y(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),TS=hS(e=>{let{__scopeDropdownMenu:t,...n}=e,r=yS(t);return(0,I.jsx)(lS,{...r,...n})},`DropdownMenuPortal`),ES=`DropdownMenuContent`,DS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=xS(ES,n),a=yS(n),o=v.useRef(!1);return(0,I.jsx)(uS,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:Y(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`)),OS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(dS,{...i,...r,ref:t})},`DropdownMenuLabel`)),kS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(fS,{...i,...r,ref:t})},`DropdownMenuItem`)),AS=v.forwardRef(hS(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yS(n);return(0,I.jsx)(pS,{...i,...r,ref:t})},`DropdownMenuSeparator`)),jS=SS,MS=wS,NS=TS,PS=DS,FS=OS,IS=kS,LS=AS,RS=`z-50 overflow-hidden rounded-[8px] border border-rule bg-surface shadow-pop outline-none py-1 data-[state=open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function zS({trigger:e,children:t,width:n=220,align:r=`start`,side:i=`bottom`,sideOffset:a=6,open:o,onOpenChange:s}){return(0,I.jsxs)(jS,{open:o,onOpenChange:s,modal:!1,children:[(0,I.jsx)(MS,{asChild:!0,children:e}),(0,I.jsx)(NS,{children:(0,I.jsx)(PS,{align:r,side:i,sideOffset:a,collisionPadding:12,className:RS,style:{width:n},children:t})})]})}var BS=(e,t)=>X(`flex min-h-9 w-full cursor-pointer items-center gap-2.5 border-0 px-3 py-1.5 text-left text-[13.5px] outline-none select-none`,`data-[highlighted]:bg-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,t?`bg-soft`:`bg-transparent`,e?`text-danger-text`:`text-ink`);function VS({children:e,onSelect:t,danger:n,active:r,disabled:i,hint:a}){return(0,I.jsxs)(IS,{disabled:i,onSelect:t,className:BS(n,r),children:[e,a?(0,I.jsx)(`span`,{className:`ml-auto pl-3 text-[12px] text-muted`,children:a}):null]})}function HS(){return(0,I.jsx)(LS,{className:`my-1 h-px bg-rule`})}function US({children:e}){return(0,I.jsx)(FS,{className:`px-3 pt-1.5 pb-1 text-[12px] text-muted`,children:e})}var WS=[{value:`system`,label:`System`,icon:`monitor`},{value:`light`,label:`Light`,icon:`sun`},{value:`dark`,label:`Dark`,icon:`moon`}];function GS(){let e=m_(),t=h_();return(0,I.jsxs)(zS,{align:`end`,width:180,trigger:(0,I.jsx)(j_,{icon:t===`dark`?`moon`:`sun`,label:`Appearance`}),children:[(0,I.jsx)(US,{children:`Appearance`}),WS.map(t=>(0,I.jsxs)(VS,{active:e===t.value,onSelect:()=>p_(t.value),children:[(0,I.jsx)(Z,{name:t.icon,size:15,className:`text-ink2`}),t.label,e===t.value?(0,I.jsx)(Z,{name:`check`,size:15,className:`ml-auto text-ink2`}):null]},t.value))]})}function KS({size:e=24}){return(0,I.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 32 32`,"aria-hidden":`true`,className:`shrink-0`,children:[(0,I.jsx)(`rect`,{width:`32`,height:`32`,rx:`7`,className:`fill-primary`}),(0,I.jsx)(`rect`,{x:`7`,y:`7`,width:`8`,height:`11`,rx:`1.5`,className:`fill-primary-ink`}),(0,I.jsx)(`rect`,{x:`17`,y:`7`,width:`8`,height:`6`,rx:`1.5`,fill:`#f0a040`}),(0,I.jsx)(`rect`,{x:`17`,y:`15`,width:`8`,height:`10`,rx:`1.5`,className:`fill-primary-ink`}),(0,I.jsx)(`rect`,{x:`7`,y:`20`,width:`8`,height:`5`,rx:`1.5`,className:`fill-primary-ink`})]})}function qS({name:e,version:t}){return(0,I.jsxs)(xe,{href:`/`,title:t?`foss-design ${t}`:void 0,className:`flex min-w-0 items-center gap-2 text-[14px] font-semibold text-ink no-underline`,children:[(0,I.jsx)(KS,{}),(0,I.jsx)(`span`,{className:`truncate`,children:e??`Design`})]})}function JS({children:e,className:t}){return(0,I.jsx)(`header`,{className:X(`sticky top-0 z-30 flex h-[52px] shrink-0 items-center gap-3 border-b border-rule bg-surface px-4`,t),children:e})}var YS=[{to:`/`,label:`Canvases`,match:e=>e===`/`||e.startsWith(`/c/`)},{to:`/system`,label:`Design system`,match:e=>e.startsWith(`/system`)}];function XS({location:e}){let t=(0,v.useRef)(null),n=YS.findIndex(t=>t.match(e)),[r,i]=(0,v.useState)(null);return(0,v.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let r=()=>{let t=e.children[n];if(!t?.offsetWidth){i(null);return}let r=t.offsetLeft+10,a=t.offsetWidth-20;i(e=>e?.tab===n&&e.x===r&&e.width===a?e:{tab:n,x:r,width:a,slide:e!==null&&e.tab!==n})};r();let a=new ResizeObserver(r);return a.observe(e),()=>a.disconnect()},[n]),(0,I.jsxs)(`nav`,{ref:t,className:`relative flex h-[52px] items-stretch gap-0.5 max-md:hidden`,children:[YS.map((e,t)=>(0,I.jsx)(xe,{href:e.to,"aria-current":t===n?`page`:void 0,className:X(`flex items-center px-2.5 text-[14px] no-underline transition-colors`,t===n?`font-medium text-ink`:`text-ink2 hover:text-ink`),children:e.label},e.to)),r?(0,I.jsx)(Wf.span,{"aria-hidden":!0,className:`pointer-events-none absolute bottom-0 left-0 h-[2px] bg-action`,initial:!1,animate:{x:r.x,width:r.width},transition:r.slide?{type:`spring`,stiffness:520,damping:42}:{duration:0}}):null]})}function ZS(){let e=Zg().data,{slots:t}=Jg(),[n]=P();return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(JS,{children:[t.barStart,(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-6`,children:[t.brand??(0,I.jsx)(qS,{name:e?.name,version:e?.version}),(0,I.jsx)(XS,{location:n})]}),(0,I.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,I.jsx)(T_,{}),(0,I.jsx)(GS,{}),t.barEnd]})]}),t.belowBar]})}var QS=Object.defineProperty,$S=(e,t)=>QS(e,`name`,{value:t,configurable:!0}),eC=`Popover`,[tC,nC]=ap(eC,[hb]),rC=hb(),[iC,aC]=tC(eC),oC=$S(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=rC(t),c=v.useRef(null),[l,u]=v.useState(!1),[d,f]=xp({prop:r,defaultProp:i??!1,onChange:a,caller:eC});return(0,I.jsx)(Ob,{...s,children:(0,I.jsx)(iC,{scope:t,contentId:fp(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:v.useCallback(()=>u(!0),[]),onCustomAnchorRemove:v.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),sC=`PopoverTrigger`,cC=v.forwardRef($S(function(e,t){let{__scopePopover:n,...r}=e,i=aC(sC,n),a=rC(n),o=tp(t,i.triggerRef),s=(0,I.jsx)(Wp.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":yC(i.open),...r,ref:o,onClick:Y(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,I.jsx)(kb,{asChild:!0,...a,children:s})},`PopoverTrigger`)),lC=`PopoverPortal`,[uC,dC]=tC(lC,{forceMount:void 0}),fC=$S(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=aC(lC,t);return(0,I.jsx)(uC,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),pC=`PopoverContent`,mC=v.forwardRef($S(function(e,t){let n=dC(pC,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=aC(pC,e.__scopePopover);return(0,I.jsx)(jm,{present:r||a.open,children:a.modal?(0,I.jsx)(gC,{...i,ref:t}):(0,I.jsx)(_C,{...i,ref:t})})},`PopoverContent`)),hC=kp(`PopoverContent.RemoveScroll`),gC=v.forwardRef($S(function(e,t){let n=aC(pC,e.__scopePopover),r=v.useRef(null),i=tp(t,r),a=v.useRef(!1);return v.useEffect(()=>{let e=r.current;if(e)return og(e)},[]),(0,I.jsx)(Zh,{as:hC,allowPinchZoom:!0,children:(0,I.jsx)(vC,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Y(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Y(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:Y(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),_C=v.forwardRef($S(function(e,t){let n=aC(pC,e.__scopePopover),r=v.useRef(!1),i=v.useRef(!1);return(0,I.jsx)(vC,{...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`)),vC=v.forwardRef($S(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=aC(pC,n),p=rC(n);return Hm(),(0,I.jsx)(mm,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,I.jsx)(Ab,{"data-state":yC(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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 yC(e){return e?`open`:`closed`}$S(yC,`getState`);var bC=oC,xC=cC,SC=fC,CC=mC,wC=new a_([]),TC=1;function EC(e,t,n=`ok`){let r=TC++;wC.set(i=>[...i.slice(-2),{id:r,title:e,text:t,tone:n}]),setTimeout(()=>wC.set(e=>e.filter(e=>e.id!==r)),n===`error`?4200:2200)}var DC=new a_([]),OC=1;function kC(){let[e]=(0,v.useState)(()=>OC++);(0,v.useEffect)(()=>(DC.set(t=>[...t,e]),()=>DC.set(t=>t.filter(t=>t!==e))),[e]);let t=o_(DC,t=>t[0]===e),n=o_(wC);return t?(0,I.jsx)(`div`,{className:`pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col items-center gap-2`,children:(0,I.jsx)(ed,{children:n.map(e=>(0,I.jsxs)(Wf.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:4,transition:{duration:.12}},transition:{type:`spring`,stiffness:520,damping:40},className:`flex max-w-[420px] items-center gap-2.5 rounded-[8px] border border-rule bg-surface px-3 py-2 text-[13px] text-ink shadow-pop`,children:[e.tone===`error`?(0,I.jsx)(Z,{name:`alert`,size:15,className:`text-danger-text`}):(0,I.jsx)(Z,{name:`check`,size:15,className:`text-ok-text`}),(0,I.jsx)(`span`,{className:`font-medium`,children:e.title}),e.text?(0,I.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.text}):null]},e.id))})}):null}async function AC(e,t=`Copied`){try{await navigator.clipboard.writeText(e),EC(t,e.length>64?void 0:e)}catch{EC(`Could not copy`,`The browser blocked clipboard access`,`error`)}}var jC=new Map;window.addEventListener(`message`,e=>{let t=e.data;if(t?.source===`design-runtime`&&e.source)for(let n of jC.get(e.source)??[])n(t)});function MC(e,t){let n=null,r=()=>{if(!n)return;let e=jC.get(n);e?.delete(t),e?.size||jC.delete(n),n=null},i=()=>{if(r(),n=e.contentWindow,!n)return;let i=jC.get(n)??new Set;i.add(t),jC.set(n,i)};return i(),e.addEventListener(`load`,i),()=>{e.removeEventListener(`load`,i),r()}}function NC(e,t){e?.contentWindow?.postMessage({source:`design-viewer`,...t},`*`)}function PC(e){NC(e,{type:`canvas`})}function FC(e,t){NC(e,{type:`theme`,theme:t})}function IC(e){e&&(e.src=e.src)}var LC=(()=>{if(jg)return``;let{protocol:e,hostname:t,port:n}=window.location,r=t===`localhost`?`127.0.0.1`:t===`127.0.0.1`?`localhost`:null;return r?`${e}//${r}${n?`:${n}`:``}`:``})();function RC(e,t,n){let[r=``,i=``]=e.split(`?`),a=new URLSearchParams(i);a.set(`theme`,t);for(let[e,t]of Object.entries(n??{}))a.set(e,t);return`${r.startsWith(`/`)?LC:``}${r}?${a.toString()}`}function zC(e){return new URL(e,document.baseURI).toString()}function BC(e,t,n){let r=Zg().data,i=$g(!!r?.system).data?.tokens,[a,o]=(0,v.useState)(null),s=(0,v.useRef)({enabled:t,tokens:i});s.current={enabled:t,tokens:i};let c=(0,v.useRef)(n.onEscape);c.current=n.onEscape;let l=(0,v.useRef)(e);l.current=e;let u=(0,v.useRef)(new Map),d=(e,t=!1)=>{let{enabled:n,tokens:r}=s.current,i=u.current.get(e);(t||i?.on!==n||i.tokens!==r)&&(u.current.set(e,{on:n,tokens:r}),NC(e,{type:`inspect`,on:n,tokens:n?r??[]:void 0}))};(0,v.useEffect)(()=>{for(let t of e)d(t);for(let t of u.current.keys())e.includes(t)||u.current.delete(t)},[e,t,i]),(0,v.useEffect)(()=>{let t=e.map(e=>MC(e,t=>{if(t.type===`ready`)s.current.enabled?d(e,!0):u.current.set(e,{on:!1});else if(t.type===`inspect`){if(t.info){for(let t of l.current)t!==e&&NC(t,{type:`inspect-select`,ref:null});o({info:t.info,frame:e})}else o(t=>t?.frame===e?null:t)}else t.type===`inspect-escape`&&c.current()}));return()=>{for(let e of t)e()}},[e]);let f=a&&e.includes(a.frame)?a.frame:null;return{info:f?a.info:null,frame:f,select(e){if(e===null){for(let e of l.current)NC(e,{type:`inspect-select`,ref:null});o(null)}else a&&NC(a.frame,{type:`inspect-select`,ref:e})}}}function VC(e){let[t,n]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let t=e=>e===`Meta`||e===`Control`,r=!1,i=!1,a,o=()=>{r=!1,clearTimeout(a),n(!1)},s=e=>{if(t(e)){if(r)return;r=!0,i=!1,a=setTimeout(()=>{r&&!i&&n(!0)},150)}else r&&(i=!0,clearTimeout(a),n(!1))},c=e=>s(e.key),l=e=>{t(e.key)&&o()};window.addEventListener(`keydown`,c,!0),window.addEventListener(`keyup`,l,!0),window.addEventListener(`blur`,o);let u=e.map(e=>MC(e,e=>{e.type===`key`?e.down?s(e.name):t(e.name)&&o():e.type===`blur`&&o()}));return()=>{window.removeEventListener(`keydown`,c,!0),window.removeEventListener(`keyup`,l,!0),window.removeEventListener(`blur`,o);for(let e of u)e();clearTimeout(a)}},[e]),t}function HC({title:e,children:t,right:n}){return(0,I.jsxs)(`section`,{className:`border-t border-rule pb-2 first:border-t-0`,children:[(0,I.jsxs)(`div`,{className:`flex h-9 items-center justify-between px-4 text-[12px] font-medium text-muted`,children:[e,n]}),t]})}function UC({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`grid min-h-7 grid-cols-[92px_minmax(0,1fr)] items-center gap-x-3 px-4 py-0.5 text-[12.5px]`,children:[(0,I.jsx)(`span`,{className:`text-muted`,children:e}),(0,I.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-ink`,children:t})]})}function WC({name:e}){return e?(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(`var(${e})`,`Token copied`),title:`Copy var()`,className:`shrink-0 cursor-pointer truncate rounded-[4px] border-0 bg-action-soft px-1.5 py-px font-mono text-[11px] text-action`,children:e}):null}function GC({children:e,title:t}){return(0,I.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[12px]`,title:t,children:e})}function KC({label:e,color:t}){return(0,I.jsxs)(UC,{label:e,children:[(0,I.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:t.css}}),(0,I.jsx)(GC,{title:t.css,children:t.value}),(0,I.jsx)(WC,{name:t.token})]})}var qC=e=>e?String(e):`–`;function JC({label:e,values:t,className:n,children:r}){let[i,a,o,s]=t;return(0,I.jsxs)(`div`,{className:X(`relative grid grid-cols-[28px_minmax(0,1fr)_28px] grid-rows-[20px_auto_20px] rounded-[4px]`,n),children:[(0,I.jsx)(`span`,{className:`absolute top-1 left-1.5 text-[9.5px] tracking-wide text-muted uppercase`,children:e}),(0,I.jsx)(`span`,{className:`col-start-2 self-center text-center`,children:qC(i)}),(0,I.jsx)(`span`,{className:`row-start-2 self-center text-center`,children:qC(s)}),(0,I.jsx)(`div`,{className:`row-start-2 col-start-2`,children:r}),(0,I.jsx)(`span`,{className:`row-start-2 col-start-3 self-center text-center`,children:qC(a)}),(0,I.jsx)(`span`,{className:`row-start-3 col-start-2 self-center text-center`,children:qC(o)})]})}function YC({info:e}){let t={w:Math.max(0,e.rect.w-e.border[1]-e.border[3]-e.padding[1]-e.padding[3]),h:Math.max(0,e.rect.h-e.border[0]-e.border[2]-e.padding[0]-e.padding[2])};return(0,I.jsx)(`div`,{className:`px-4 pt-1 pb-2 font-mono text-[11px] text-ink2`,children:(0,I.jsx)(JC,{label:`margin`,values:e.margin,className:`border border-dashed border-rule-strong bg-[#f6b26b]/15`,children:(0,I.jsx)(JC,{label:`border`,values:e.border,className:`border border-rule-strong bg-[#f9e27d]/15`,children:(0,I.jsx)(JC,{label:`padding`,values:e.padding,className:`border border-rule-strong bg-[#93c47d]/20`,children:(0,I.jsxs)(`div`,{className:`flex h-8 items-center justify-center rounded-[3px] border border-rule-strong bg-[#6fa8dc]/25 text-ink`,children:[Math.round(t.w*100)/100,` × `,Math.round(t.h*100)/100]})})})})})}function XC({info:e,onSelect:t}){return(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-4 pb-2`,children:[e.path.slice(-4).map((e,n)=>(0,I.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`cursor-pointer rounded-[4px] border-0 bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2 hover:text-ink`,children:e.label}),(0,I.jsx)(Z,{name:`chevron-right`,size:11,className:`text-muted`})]},n)),(0,I.jsx)(`span`,{className:`rounded-[4px] bg-action-soft px-1.5 py-0.5 font-mono text-[11px] text-action`,children:e.label})]})}function ZC({info:e,onSelect:t,onClose:n,active:r}){return(0,I.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[320px] shrink-0 flex-col overflow-hidden border-l border-rule bg-surface`,children:[(0,I.jsxs)(`div`,{className:`flex h-[46px] shrink-0 items-center justify-between border-b border-rule pr-2 pl-4`,children:[(0,I.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] font-semibold`,children:[(0,I.jsx)(Z,{name:`pointer`,size:15,className:`text-action`}),` Inspect`]}),(0,I.jsx)(j_,{icon:`x`,label:`Close inspector (I)`,onClick:n})]}),e?(0,I.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto`,children:[(0,I.jsxs)(HC,{title:`Element`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2`,children:[(0,I.jsx)(`div`,{className:`flex min-w-0 items-baseline gap-1.5`,children:e.component?.owners[0]?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:[`<`,e.component.owners[0],`>`]}),(0,I.jsx)(`span`,{className:`truncate font-mono text-[12px] text-muted`,children:e.tag})]}):(0,I.jsx)(`span`,{className:`truncate font-mono text-[14px] font-medium text-ink`,children:e.label})}),e.component&&e.component.owners.length>1?(0,I.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[`in `,e.component.owners.slice(1).join(` ← `)]}):null,e.component?.file?(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(e.component.file,`Path copied`),className:`w-fit max-w-full cursor-pointer truncate border-0 bg-transparent p-0 text-left font-mono text-[11.5px] text-muted hover:text-ink2`,title:`Copy path`,children:e.component.file}):null,e.text?(0,I.jsxs)(`span`,{className:`line-clamp-2 text-[12.5px] text-ink2`,children:[`“`,e.text,`”`]}):null]}),(0,I.jsx)(XC,{info:e,onSelect:t})]}),(0,I.jsxs)(HC,{title:`Box`,children:[(0,I.jsx)(YC,{info:e}),(0,I.jsx)(UC,{label:`Size`,children:(0,I.jsxs)(GC,{children:[e.rect.w,` × `,e.rect.h]})}),(0,I.jsx)(UC,{label:`Position`,children:(0,I.jsxs)(GC,{children:[`x `,e.rect.x,` · y `,e.rect.y]})})]}),e.layout.length?(0,I.jsx)(HC,{title:`Layout`,children:e.layout.map(([e,t])=>(0,I.jsx)(UC,{label:e,children:(0,I.jsx)(GC,{title:t,children:t})},e))}):null,e.typography?(0,I.jsxs)(HC,{title:`Typography`,children:[(0,I.jsxs)(UC,{label:`Font`,children:[(0,I.jsx)(GC,{title:e.typography.family,children:e.typography.family.split(`,`)[0]?.replace(/["']/g,``)}),(0,I.jsx)(WC,{name:e.typography.familyToken})]}),(0,I.jsxs)(UC,{label:`Size`,children:[(0,I.jsxs)(GC,{children:[e.typography.size,` / `,e.typography.lineHeight]}),(0,I.jsx)(WC,{name:e.typography.sizeToken})]}),(0,I.jsx)(UC,{label:`Weight`,children:(0,I.jsx)(GC,{children:e.typography.weight})}),e.typography.letterSpacing===`normal`?null:(0,I.jsx)(UC,{label:`Tracking`,children:(0,I.jsx)(GC,{children:e.typography.letterSpacing})}),(0,I.jsx)(KC,{label:`Color`,color:e.typography.color}),e.typography.align===`start`?null:(0,I.jsx)(UC,{label:`Align`,children:(0,I.jsx)(GC,{children:e.typography.align})}),e.typography.transform?(0,I.jsx)(UC,{label:`Transform`,children:(0,I.jsx)(GC,{children:e.typography.transform})}):null]}):null,Object.values(e.appearance).some(Boolean)?(0,I.jsxs)(HC,{title:`Appearance`,children:[e.appearance.background?(0,I.jsx)(KC,{label:`Background`,color:e.appearance.background}):null,e.appearance.backgroundImage?(0,I.jsx)(UC,{label:`Image`,children:(0,I.jsx)(GC,{title:e.appearance.backgroundImage,children:e.appearance.backgroundImage})}):null,e.appearance.border?(0,I.jsxs)(UC,{label:`Border`,children:[(0,I.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-[3px] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.12)]`,style:{background:e.appearance.border.color.css}}),(0,I.jsxs)(GC,{children:[e.appearance.border.width,` `,e.appearance.border.style,` `,e.appearance.border.color.value]}),(0,I.jsx)(WC,{name:e.appearance.border.color.token})]}):null,e.appearance.radius?(0,I.jsxs)(UC,{label:`Radius`,children:[(0,I.jsx)(GC,{children:e.appearance.radius.value}),(0,I.jsx)(WC,{name:e.appearance.radius.token})]}):null,e.appearance.shadow?(0,I.jsxs)(UC,{label:`Shadow`,children:[(0,I.jsx)(GC,{title:e.appearance.shadow.value,children:e.appearance.shadow.value}),(0,I.jsx)(WC,{name:e.appearance.shadow.token})]}):null,e.appearance.opacity?(0,I.jsx)(UC,{label:`Opacity`,children:(0,I.jsx)(GC,{children:e.appearance.opacity})}):null]}):null,e.classes.length?(0,I.jsx)(HC,{title:`Classes`,right:(0,I.jsx)(`button`,{type:`button`,onClick:()=>void AC(e.classes.join(` `),`Classes copied`),className:`cursor-pointer border-0 bg-transparent text-[12px] text-muted hover:text-ink2`,children:`Copy`}),children:(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1 px-4 pb-1`,children:e.classes.map(e=>(0,I.jsx)(`span`,{className:`rounded-[4px] bg-soft2 px-1.5 py-0.5 font-mono text-[11px] text-ink2`,children:e},e))})}):null,e.attributes.length?(0,I.jsx)(HC,{title:`Attributes`,children:e.attributes.map(([e,t])=>(0,I.jsx)(UC,{label:e,children:(0,I.jsx)(GC,{title:t,children:t})},e))}):null,e.children.length?(0,I.jsx)(HC,{title:`Children · ${e.children.length}`,children:(0,I.jsx)(`div`,{className:`flex flex-col px-2 pb-1`,children:e.children.map((e,n)=>(0,I.jsxs)(`button`,{type:`button`,onClick:()=>t(e.ref),className:`flex h-7 cursor-pointer items-center gap-2 rounded-[6px] border-0 bg-transparent px-2 text-left font-mono text-[12px] text-ink2 hover:bg-soft2`,children:[(0,I.jsx)(Z,{name:`chevron-right`,size:12,className:`text-muted`}),(0,I.jsx)(`span`,{className:`truncate`,children:e.label})]},n))})}):null]}):(0,I.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-6 py-10 text-center`,children:[(0,I.jsx)(Z,{name:`pointer`,size:22,className:`text-muted`}),(0,I.jsx)(`span`,{className:`text-[13.5px] text-ink2`,children:r?`Click an element in any screen.`:`Hold ${C_} to highlight, click to inspect.`}),(0,I.jsx)(`span`,{className:`text-[12.5px] leading-[1.5] text-muted`,children:`Hover shows margin, padding and content. Clicks go to the inspector, not the screen.`}),(0,I.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[12px] text-muted`,children:[(0,I.jsx)(__,{children:`I`}),` toggle · hold `,(0,I.jsx)(__,{children:C_}),` · `,(0,I.jsx)(__,{children:`esc`}),` clear`]})]}),e?(0,I.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-t border-rule bg-soft px-4 py-2.5`,children:(0,I.jsx)(O_,{icon:`copy`,onClick:()=>void AC(e.css,`CSS copied`),className:`grow`,children:`Copy CSS`})}):null]})}var QC={neutral:`bg-soft2 text-ink2`,action:`bg-action-soft text-action`,ok:`bg-ok-soft text-ok-text`,danger:`bg-danger-soft text-danger-text`};function $C({tone:e=`neutral`,children:t,className:n}){return(0,I.jsx)(`span`,{className:X(`inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-[6px] px-2 text-[12px] font-medium`,QC[e],n),children:t})}function ew({value:e,tone:t=`neutral`}){return(0,I.jsx)(`span`,{className:X(`inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[4px] px-[5px] text-[11.5px] font-semibold tabular`,t===`action`?`bg-action-soft text-action`:t===`danger`?`bg-danger-soft text-danger-text`:`bg-soft2 text-ink2`),children:e})}function tw({children:e,className:t,style:n}){return(0,I.jsx)(`section`,{className:X(`min-w-0 shrink-0 overflow-hidden rounded-[10px] border border-rule bg-surface`,t),style:n,children:e})}function nw({title:e,count:t,sub:n,right:r,as:i=`h2`}){return(0,I.jsxs)(`div`,{className:`flex min-h-[46px] items-center justify-between gap-3 px-4`,children:[(0,I.jsxs)(i,{className:`m-0 flex min-w-0 items-center gap-2 whitespace-nowrap text-[14px] font-semibold`,children:[e,t===void 0?null:(0,I.jsx)(ew,{value:t}),n?(0,I.jsx)(`span`,{className:`truncate text-[12.5px] font-normal text-muted`,children:n}):null]}),r?(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function rw({items:e,value:t,onChange:n,right:r}){let i=(0,v.useId)();return(0,I.jsxs)(`div`,{className:`flex h-[46px] items-center justify-between gap-3 px-4`,children:[(0,I.jsx)(`div`,{role:`tablist`,className:`flex gap-5`,children:e.map(e=>{let r=e.value===t;return(0,I.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.value),className:X(`relative flex h-[46px] cursor-pointer items-center gap-1.5 border-0 bg-transparent px-0.5 text-[14px] transition-colors`,r?`font-semibold text-ink`:`font-medium text-ink2 hover:text-ink`),children:[e.label,e.count===void 0?null:(0,I.jsx)(ew,{value:e.count}),r?(0,I.jsx)(Wf.span,{layoutId:i,className:`absolute inset-x-0 bottom-0 h-[2px] bg-ink`,transition:{type:`spring`,stiffness:520,damping:42}}):null]},e.value)})}),r?(0,I.jsx)(`div`,{className:`flex items-center gap-2`,children:r}):null]})}function iw({align:e,children:t}){return(0,I.jsx)(`div`,{className:X(`flex min-w-0 items-center gap-2`,e===`r`&&`justify-end text-right`,e===`c`&&`justify-center`),children:t})}function aw(e,t){return v.Children.toArray(e).map((e,n)=>(0,I.jsx)(iw,{align:t?.[n]??`l`,children:e},n))}function ow({cols:e,align:t,labels:n}){return(0,I.jsx)(`div`,{className:`grid h-8 items-center gap-x-4 border-t border-rule bg-soft px-4 text-[12.5px] text-muted`,style:{gridTemplateColumns:e},children:n.map((e,n)=>(0,I.jsx)(iw,{align:t?.[n]??`l`,children:(0,I.jsx)(`span`,{className:`whitespace-nowrap`,children:e})},n))})}var sw=(e,t,n)=>X(`grid items-center gap-x-4 border-rule`,!e&&`border-t`,t&&`cursor-pointer transition-colors hover:bg-soft`,n);function cw({cols:e,align:t,minH:n=44,pad:r=`10px 16px`,children:i,first:a,className:o,onClick:s,title:c}){return(0,I.jsx)(`div`,{className:sw(a,!!s,o),style:{gridTemplateColumns:e,minHeight:n,padding:r},onClick:s,title:c,children:aw(i,t)})}function lw({to:e,cols:t,align:n,minH:r=44,pad:i=`10px 16px`,first:a,className:o,children:s}){return(0,I.jsx)(xe,{href:e,className:X(sw(a,!0,o),`text-inherit no-underline`),style:{gridTemplateColumns:t,minHeight:r,padding:i},children:aw(s,n)})}function uw({label:e,children:t,labelWidth:n=180,minH:r=40,end:i=!1}){return(0,I.jsxs)(`div`,{className:`grid content-center items-baseline gap-x-4 border-t border-rule px-4 py-2`,style:{gridTemplateColumns:`${n}px minmax(0, 1fr)`,minHeight:r},children:[(0,I.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,I.jsx)(`div`,{className:X(`flex min-w-0 flex-wrap items-center gap-2`,i&&`justify-end`),children:t})]})}function dw({children:e,pad:t=`16px`,gap:n=16,top:r=!0,className:i}){return(0,I.jsx)(`div`,{className:X(`flex flex-col`,r&&`border-t border-rule`,i),style:{padding:t,gap:n},children:e})}function fw({issues:e,className:t}){return(0,I.jsx)(`div`,{className:X(`flex flex-col`,t),children:e.map((e,t)=>(0,I.jsxs)(`div`,{className:`flex items-start gap-2.5 border-t border-rule px-4 py-2.5 text-[13px] first:border-t-0`,children:[(0,I.jsx)(Z,{name:e.severity===`error`?`alert`:`info`,size:15,className:X(`mt-0.5`,e.severity===`error`?`text-danger-text`:`text-action`)}),(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,I.jsx)(`span`,{className:`text-ink`,children:e.message}),(0,I.jsxs)(`span`,{className:`font-mono text-[12px] break-all text-muted`,children:[e.file,e.at?` · ${e.at}`:``]})]})]},t))})}function pw({issues:e,title:t=`Problems`}){if(!e.length)return null;let n=e.filter(e=>e.severity===`error`).length;return(0,I.jsxs)(tw,{className:n?`border-danger/40`:void 0,children:[(0,I.jsx)(nw,{title:t,count:e.length,sub:n?`${n} blocking`:`warnings`}),(0,I.jsx)(`div`,{className:`border-t border-rule`,children:(0,I.jsx)(fw,{issues:e})})]})}var mw=[.2,.7,.2,1];function hw({open:e,side:t,width:n,children:r}){return(0,I.jsx)(ed,{initial:!1,children:e?(0,I.jsx)(Wf.div,{initial:{width:0,opacity:.6},animate:{width:n,opacity:1},exit:{width:0,opacity:.6},transition:{duration:.22,ease:mw},className:X(`flex min-h-0 shrink-0 overflow-hidden`,t===`right`?`justify-start`:`justify-end`),children:(0,I.jsx)(`div`,{className:`flex min-h-0 shrink-0`,style:{width:n},children:r})},`panel`):null})}function gw({children:e,className:t,gap:n=20,wide:r=!1}){return(0,I.jsx)(`main`,{className:X(`mx-auto flex w-full min-h-0 grow flex-col px-8 pt-6 pb-7 animate-[q-fade-in_160ms_ease-out] max-md:px-4 max-md:pt-4`,r?`max-w-[1440px]`:`max-w-[1200px]`,t),style:{gap:n},children:e})}function _w({title:e,sub:t,right:n,badge:r,crumbs:i}){return(0,I.jsxs)(`div`,{className:`flex shrink-0 items-end justify-between gap-6 max-md:flex-col max-md:items-stretch max-md:gap-3`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[i?(0,I.jsx)(`div`,{className:`flex items-center gap-1.5 text-[13px] text-muted`,children:i}):null,(0,I.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,I.jsx)(`h1`,{className:`m-0 text-[22px] font-semibold tracking-[-0.01em]`,children:e}),r]}),t?(0,I.jsx)(`div`,{className:`text-[13px] text-muted`,children:t}):null]}),n?(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:n}):null]})}function vw({items:e,label:t}){return(0,I.jsx)(`nav`,{"aria-label":t,className:`flex flex-col gap-0.5`,children:e.map(e=>(0,I.jsxs)(xe,{href:e.to,className:e=>X(`flex h-8 items-center gap-2 whitespace-nowrap rounded-[6px] px-3 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,e?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),e.hint?(0,I.jsx)(`span`,{className:`ml-auto text-[12px] font-normal text-muted`,children:e.hint}):null]},e.to))})}function yw({children:e}){return(0,I.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[12px] text-muted`,children:e})}function bw({title:e,text:t,action:n}){return(0,I.jsxs)(tw,{className:`flex w-[480px] max-w-full flex-col items-center gap-2 px-6 py-8 text-center`,children:[(0,I.jsx)(`h1`,{className:`m-0 text-[16px] font-semibold`,children:e}),t?(0,I.jsx)(`div`,{className:`m-0 max-w-[400px] text-[14px] text-ink2`,children:t}):null,n?(0,I.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:n}):null]})}function xw(e){return(0,I.jsx)(`div`,{className:`flex min-h-[50vh] grow items-center justify-center p-6 max-md:px-4`,children:(0,I.jsx)(bw,{...e})})}function Sw({title:e=`Nothing here`,text:t}){let n=!!Jg().scope;return(0,I.jsx)(xw,{title:e,text:t??`This address does not match a canvas or a page of the design system.`,action:n?void 0:(0,I.jsx)(M_,{to:`/`,children:`All canvases`})})}var Cw=.1,ww=(e,t=Cw)=>Math.min(8,Math.max(t,e)),Tw=class{camera={x:0,y:0,z:1};minZoom=Cw;listeners=new Set;animation=0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}set(e){this.camera={x:e.x,y:e.y,z:ww(e.z,this.minZoom)};for(let e of this.listeners)e(this.camera)}interrupt(){cancelAnimationFrame(this.animation),this.animation=0}panBy(e,t){this.interrupt();let{x:n,y:r,z:i}=this.camera;this.set({x:n+e,y:r+t,z:i})}zoomAt(e,t,n){this.interrupt();let{x:r,y:i,z:a}=this.camera,o=ww(a*n,this.minZoom),s=(e-r)/a,c=(t-i)/a;this.set({x:e-s*o,y:t-c*o,z:o})}animateTo(e,t=320){this.interrupt();let n={...this.camera},r={...e,z:ww(e.z,this.minZoom)};if(t<=0||matchMedia(`(prefers-reduced-motion: reduce)`).matches){this.set(r);return}let i=performance.now(),a=e=>{let o=Math.min(1,(e-i)/t),s=1-(1-o)**3,c=n.z*(r.z/n.z)**s,l=n.z===r.z?s:(c-n.z)/(r.z-n.z);this.set({x:n.x+(r.x-n.x)*l,y:n.y+(r.y-n.y)*l,z:c}),this.animation=o<1?requestAnimationFrame(a):0};this.animation=requestAnimationFrame(a)}toWorld(e,t){let{x:n,y:r,z:i}=this.camera;return{x:(e-n)/i,y:(t-r)/i}}};function Ew(e,t,n,r=72,i=1,a=Cw){let o=ww(Math.min((t-r*2)/Math.max(e.w,1),(n-r*2)/Math.max(e.h,1),i),a),s=(e,t,n)=>t*o<=n-r*2?n/2-(e+t/2)*o:r-e*o;return{z:o,x:s(e.x,e.w,t),y:s(e.y,e.h,n)}}function Dw(e,t){return e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y}function Ow({items:e,value:t,onChange:n,label:r,stretch:i,size:a=`ctrl`}){let o=(0,v.useId)();return(0,I.jsx)(`div`,{role:`group`,"aria-label":r,className:X(`shrink-0 items-center gap-0.5 rounded-[6px] bg-track p-[3px]`,a===`ctrl`?`h-ctrl`:`h-7`,i?`flex`:`inline-flex`),children:e.map(e=>{let r=e.value===t;return(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":r,title:e.title,onClick:()=>n(e.value),className:X(`relative flex h-full cursor-pointer items-center justify-center whitespace-nowrap rounded-[4px] border-0 bg-transparent font-medium transition-colors`,a===`ctrl`?`px-2.5 text-ctrl`:`px-2 text-[12.5px]`,i&&`flex-1`,r?`text-ink`:`text-muted hover:text-ink2`),children:[r?(0,I.jsx)(Wf.span,{layoutId:o,className:`absolute inset-0 rounded-[4px] bg-surface shadow-[0_1px_2px_rgba(0,0,0,0.10)]`,transition:{type:`spring`,stiffness:520,damping:42}}):null,(0,I.jsx)(`span`,{className:`relative flex items-center gap-1.5`,children:e.label})]},e.value)})})}var kw=Object.defineProperty,Aw=(e,t)=>kw(e,`name`,{value:t,configurable:!0}),jw=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Mw=v.forwardRef(Aw(function(e,t){return(0,I.jsx)(Wp.span,{...e,ref:t,style:{...jw,...e.style}})},`VisuallyHidden`)),Nw=Object.defineProperty,Pw=(e,t)=>Nw(e,`name`,{value:t,configurable:!0}),[Fw,Iw]=ap(`Tooltip`,[hb]),Lw=hb(),Rw=`TooltipProvider`,zw=700,Bw=`tooltip.open`,[Vw,Hw]=Fw(Rw),Uw=Pw(e=>{let{__scopeTooltip:t,delayDuration:n=zw,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,I.jsx)(Vw,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Ww=`Tooltip`,[Gw,Kw]=Fw(Ww),qw=Pw(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Hw(Ww,e.__scopeTooltip),l=Lw(t),[u,d]=v.useState(null),[f,p]=v.useState(void 0),m=fp(),h=v.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,y=v.useRef(!1),[b,x]=xp({prop:r,defaultProp:i??!1,onChange:Pw(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Bw))):c.onClose(),a?.(e)},`onChange`),caller:Ww}),S=v.useMemo(()=>b?y.current?`delayed-open`:`instant-open`:`closed`,[b]),C=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,x(!0)},[x]),w=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x(!1)},[x]),T=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,x(!0),h.current=0},_)},[_,x]);v.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let E=f??m;return(0,I.jsx)(Ob,{...l,children:(0,I.jsx)(Gw,{scope:t,contentId:E,setContentId:p,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:v.useCallback(()=>{g?w():(window.clearTimeout(h.current),h.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})},`Tooltip`),Jw=`TooltipTrigger`,Yw=v.forwardRef(Pw(function(e,t){let{__scopeTooltip:n,...r}=e,i=Kw(Jw,n),a=Hw(Jw,n),o=Lw(n),s=tp(t,v.useRef(null),i.onTriggerChange),c=v.useRef(!1),l=v.useRef(!1),u=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,I.jsx)(kb,{asChild:!0,...o,children:(0,I.jsx)(Wp.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Y(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Y(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Y(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Y(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Y(e.onBlur,i.onClose),onClick:Y(e.onClick,i.onClose)})})},`TooltipTrigger`)),Xw=`TooltipPortal`,[Zw,Qw]=Fw(Xw,{forceMount:void 0}),$w=Pw(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Kw(Xw,t);return(0,I.jsx)(Zw,{scope:t,forceMount:n,children:(0,I.jsx)(jm,{present:n||a.open,children:(0,I.jsx)(Dm,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),eT=`TooltipContent`,tT=v.forwardRef(Pw(function(e,t){let n=Qw(eT,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Kw(eT,e.__scopeTooltip);return(0,I.jsx)(jm,{present:r||o.open,children:o.disableHoverableContent?(0,I.jsx)(iT,{side:i,...a,ref:t}):(0,I.jsx)(nT,{side:i,...a,ref:t})})},`TooltipContent`)),nT=v.forwardRef(Pw(function(e,t){let n=Kw(eT,e.__scopeTooltip),r=Hw(eT,e.__scopeTooltip),i=v.useRef(null),a=tp(t,i),[o,s]=v.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=v.useCallback(()=>{s(null),d(!1)},[d]),p=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=oT(r,aT(r,n.getBoundingClientRect())),a=sT(t.getBoundingClientRect()),o=lT([...i,...a]);s(o),d(!0)},[d]);return v.useEffect(()=>()=>f(),[f]),v.useEffect(()=>{if(c&&u){let e=Pw(e=>p(e,u),`handleTriggerLeave`),t=Pw(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]),v.useEffect(()=>{if(o){let e=Pw(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!cT(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,I.jsx)(iT,{...e,ref:a})},`TooltipContentHoverable`)),rT=jp(`TooltipContent`),iT=v.forwardRef(Pw(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=Kw(eT,n),u=Lw(n),{onClose:d}=l;v.useEffect(()=>(document.addEventListener(Bw,d),()=>document.removeEventListener(Bw,d)),[d]),v.useEffect(()=>{if(l.trigger){let e=Pw(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:f}=l;return sp(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,I.jsx)(nm,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,I.jsxs)(Ab,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,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,I.jsx)(rT,{children:r}),i?(0,I.jsx)(Mw,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`));function aT(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`)}}Pw(aT,`getExitSideFromRect`);function oT(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}Pw(oT,`getPaddedExitPoints`);function sT(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}]}Pw(sT,`getPointsFromRect`);function cT(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}Pw(cT,`isPointInPolygon`);function lT(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)),uT(t)}Pw(lT,`getHull`);function uT(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)}Pw(uT,`getHullPresorted`);var dT=Uw,fT=qw,pT=Yw,mT=$w,hT=tT;function gT({children:e}){return(0,I.jsx)(dT,{delayDuration:250,children:e})}var _T=`z-50 max-w-[280px] rounded-[8px] border border-rule bg-surface px-[10px] py-[7px] text-[12.5px] leading-[1.35] text-ink shadow-pop outline-none data-[state=delayed-open]:animate-[q-pop_120ms_ease-out] data-[state=closed]:animate-[q-pop-out_100ms_ease-in_forwards]`;function vT({content:e,children:t,side:n=`top`,align:r=`center`,className:i}){return(0,I.jsxs)(fT,{children:[(0,I.jsx)(pT,{asChild:!0,children:t}),(0,I.jsx)(mT,{children:(0,I.jsx)(hT,{side:n,align:r,sideOffset:6,collisionPadding:12,className:X(_T,i),children:e})})]})}function yT(e){return e.kind===`note`?`note`:e.kind===`image`?`image`:e.kind===`url`?`globe`:e.frame.width<600?`smartphone`:e.frame.width<1100?`tablet`:`monitor`}function bT(e,t){return`/c/${encodeURIComponent(e.id)}/p/${encodeURIComponent(t.id)}`}function xT({canvas:e,page:t,store:n,onPick:r}){let i=o_(n,e=>e.selected),a=o_(n,e=>e.frames);return(0,I.jsxs)(`aside`,{"data-ui":!0,className:`flex w-[264px] shrink-0 flex-col overflow-hidden border-r border-rule bg-surface`,children:[(0,I.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-rule px-4 py-3.5`,children:[(0,I.jsx)(`div`,{className:`truncate text-[14px] font-semibold`,children:e.title}),e.description?(0,I.jsx)(`div`,{className:`line-clamp-3 text-[12.5px] leading-[1.45] text-muted`,children:e.description}):null]}),(0,I.jsxs)(`div`,{className:`min-h-0 grow overflow-y-auto pb-4`,children:[e.pages.length>1?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:`Pages`}),(0,I.jsx)(`nav`,{className:`flex flex-col gap-0.5 px-2`,children:e.pages.map(n=>{let r=n.sections.reduce((e,t)=>e+t.items.filter(e=>e.kind===`screen`||e.kind===`url`).length,0);return(0,I.jsxs)(xe,{href:bT(e,n),className:X(`flex h-8 items-center gap-2 rounded-[6px] px-2.5 text-[13.5px] no-underline transition-colors focus-visible:outline-offset-[-2px]`,n.id===t.id?`bg-soft2 font-medium text-ink`:`text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:n.title}),(0,I.jsx)(`span`,{className:`text-[12px] text-muted tabular`,children:r})]},n.id)})})]}):null,(0,I.jsx)(`div`,{className:`px-4 pt-3 pb-1 text-[12px] text-muted`,children:e.pages.length>1?t.title:`Layers`}),(0,I.jsx)(`div`,{className:`flex flex-col px-2`,children:t.sections.map(e=>(0,I.jsxs)(`div`,{className:`flex flex-col`,children:[e.title?(0,I.jsxs)(`div`,{className:`flex h-7 items-center gap-2 px-2.5 pt-1 text-[12px] font-medium text-ink2`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:e.title}),(0,I.jsx)(ew,{value:e.items.length})]}):null,e.items.map(t=>{let n=(a[t.id]?.errors.length??0)>0||t.kind===`screen`&&t.missing;return(0,I.jsxs)(`button`,{type:`button`,onClick:()=>r(t.id),className:X(`flex h-8 w-full cursor-pointer items-center gap-2 rounded-[6px] border-0 px-2.5 text-left text-[13px] transition-colors focus-visible:outline-offset-[-2px]`,e.title&&`pl-4`,i===t.id?`bg-action-soft text-ink`:`bg-transparent text-ink2 hover:bg-soft2`),children:[(0,I.jsx)(Z,{name:yT(t),size:15,className:`text-muted`}),(0,I.jsx)(`span`,{className:`min-w-0 grow truncate`,children:t.title||(t.kind===`note`?`Note`:t.id)}),n?(0,I.jsx)(`span`,{className:`size-[7px] shrink-0 rounded-full bg-danger`}):null]},t.id)})]},e.id))})]})]})}function ST({canvas:e,page:t,theme:n,onTheme:r,sidebar:i,onSidebar:a,onPlay:o,canPlay:s,inspect:c,onInspect:l}){let[,u]=P(),{slots:d,scope:f}=Jg();return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(JS,{children:[d.barStart,d.brand?d.brand:f?(0,I.jsx)(KS,{}):(0,I.jsx)(vT,{content:`All canvases`,children:(0,I.jsx)(xe,{href:`/`,className:`flex items-center`,"aria-label":`All canvases`,children:(0,I.jsx)(KS,{})})}),(0,I.jsx)(j_,{icon:`panel-left`,label:i?`Hide sidebar (⌘\\)`:`Show sidebar (⌘\\)`,onClick:()=>a(!i)}),(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[14px]`,children:[(0,I.jsx)(`span`,{className:`truncate font-semibold`,children:e.title}),t&&e.pages.length>1?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(Z,{name:`chevron-right`,size:14,className:`shrink-0 text-muted`}),(0,I.jsxs)(zS,{width:240,trigger:(0,I.jsxs)(`button`,{type:`button`,className:`flex h-ctrl cursor-pointer items-center gap-1 rounded-[6px] border-0 bg-transparent px-2 text-[14px] text-ink2 hover:bg-soft2`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:t.title}),(0,I.jsx)(Z,{name:`chevron-down`,size:14,className:`text-muted`})]}),children:[(0,I.jsx)(US,{children:`Pages`}),e.pages.map(n=>(0,I.jsxs)(VS,{active:n.id===t.id,onSelect:()=>u(bT(e,n)),children:[(0,I.jsx)(Z,{name:`file`,size:15,className:`text-muted`}),n.title]},n.id))]})]}):null]}),(0,I.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,I.jsx)(Ow,{label:`Screen theme`,value:n,onChange:r,items:[{value:`light`,label:(0,I.jsx)(Z,{name:`sun`,size:15}),title:`Light screens`},{value:`dark`,label:(0,I.jsx)(Z,{name:`moon`,size:15}),title:`Dark screens`}]}),(0,I.jsx)(wT,{on:c,onChange:l}),(0,I.jsx)(O_,{kind:`secondary`,icon:`play`,onClick:o,disabled:!s,children:`Play`}),(0,I.jsx)(T_,{width:200,label:`Search`}),(0,I.jsx)(GS,{}),d.barEnd]})]}),d.belowBar]})}function CT({canvas:e,store:t,layoutItems:n,theme:r,onPlay:i,inspect:a}){let o=o_(t,e=>e.selected),s=o_(t,e=>e.active),c=o_(t,e=>o?e.frames[o]:void 0),{frameSandbox:l}=Jg(),u=n.find(e=>e.id===o);if(!u)return null;let d=u.kind===`screen`||u.kind===`url`,f=u.kind===`screen`&&!l?zC(RC(u.url,u.theme??r)):u.kind===`url`?u.url:null,p=()=>IC(document.querySelector(`[data-item="${CSS.escape(u.id)}"] iframe`)),m=c?.errors??[];return(0,I.jsx)(`div`,{"data-ui":!0,className:`pointer-events-none absolute inset-x-0 bottom-5 z-20 flex justify-center px-4`,children:(0,I.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full flex-col overflow-hidden rounded-[10px] border border-rule bg-surface shadow-pop animate-[q-pop_120ms_ease-out]`,children:[m.length?(0,I.jsxs)(`div`,{className:`flex max-h-40 items-start gap-2 overflow-y-auto border-b border-rule bg-danger-soft px-3.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-danger-text`,children:[(0,I.jsx)(Z,{name:`alert`,size:14,className:`mt-px`}),(0,I.jsx)(`span`,{className:`min-w-0`,children:m.join(`
|
|
58
58
|
`)})]}):null,(0,I.jsxs)(`div`,{className:`flex h-[44px] items-center gap-1 pr-1.5 pl-3.5`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2`,children:[(0,I.jsx)(`span`,{className:`truncate text-[13.5px] font-medium`,children:u.title||u.id}),d&&s===u.id?(0,I.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-[12px] text-muted`,children:[(0,I.jsx)(Z,{name:`pointer`,size:13}),` `,a?`Inspecting`:`Interacting`,` `,(0,I.jsx)(__,{children:`esc`})]}):d?(0,I.jsx)(`span`,{className:`shrink-0 text-[12px] text-muted`,children:a?`Click an element to inspect it`:`Click the screen to interact`}):null]}),d?(0,I.jsx)(vT,{content:(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Play `,(0,I.jsx)(__,{children:`↵`})]}),children:(0,I.jsx)(j_,{icon:`play`,label:`Play`,onClick:()=>i(u.id)})}):null,f?(0,I.jsx)(vT,{content:`Open in a new tab`,children:(0,I.jsx)(`a`,{href:f,target:`_blank`,rel:`noreferrer`,"aria-label":`Open in a new tab`,className:`inline-flex h-ctrl w-ctrl items-center justify-center rounded-[6px] text-muted hover:bg-soft2 hover:text-ink2`,children:(0,I.jsx)(Z,{name:`external`,size:16})})}):null,d?(0,I.jsx)(vT,{content:`Reload`,children:(0,I.jsx)(j_,{icon:`refresh`,label:`Reload`,onClick:p})}):null,u.kind===`screen`?(0,I.jsx)(vT,{content:`Copy source path`,children:(0,I.jsx)(j_,{icon:`copy`,label:`Copy source path`,onClick:()=>void AC(u.file,`Path copied`)})}):null,(0,I.jsx)(vT,{content:(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Zoom to `,(0,I.jsx)(__,{children:`⇧2`})]}),children:(0,I.jsx)(j_,{icon:`fit`,label:`Zoom to`,onClick:()=>window.dispatchEvent(new CustomEvent(`design:focus`,{detail:{canvas:e.id,item:u.id}}))})})]})]})})}function wT({on:e,onChange:t}){return(0,I.jsx)(vT,{content:(0,I.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Inspect elements `,(0,I.jsx)(__,{children:`I`})]}),children:(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(!e),className:e?`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-action-line bg-action-soft px-ctrl text-ctrl font-medium text-action`:`inline-flex h-ctrl cursor-pointer items-center gap-1.5 rounded-[6px] border border-rule-strong bg-surface px-ctrl text-ctrl font-medium text-ink hover:bg-soft`,children:[(0,I.jsx)(Z,{name:`pointer`,size:15}),`Inspect`]})})}var TT=280,ET=96,DT=150,OT=110,kT=720,AT=e=>e.kind===`screen`||e.kind===`url`;function jT(e,t){let n=t[e.id];if(e.kind===`screen`||e.kind===`url`){let t=e.frame.width;if(e.frame.height!==`auto`)return{w:t,h:e.frame.height};let r=e.kind===`screen`?e.measuredHeight:void 0;return{w:t,h:n?.h??r??900}}if(e.kind===`note`)return{w:e.width,h:n?.h??Math.max(80,Math.ceil(e.text.length/38)*26+40)};let r=e.width??n?.w??480;return{w:r,h:n?.w?n.h/n.w*r:n?.h??r*.62}}function MT(e,t){return!e.title&&!e.description?0:t[`section:${e.id}`]?.h??(e.title?56:0)+(e.description?60:0)}function NT(e,t){let n=[],r=[];if(e.layout===`free`){let r=0;for(let i of e.sections)for(let e of i.items){let{w:a,h:o}=jT(e,t),s=e.x??r,c=e.y??0;r=Math.max(r,s+a+ET),n.push({item:e,section:i,x:s,y:c,w:a,h:o})}}else{let i=0;for(let a of e.sections){let e=MT(a,t),o=i,s=i+(e?e+OT:0),c=0,l=0,u=0,d=0;for(let e of a.items){a.columns&&d===a.columns&&(s+=l+DT,c=0,l=0,d=0);let{w:r,h:i}=jT(e,t);n.push({item:e,section:a,x:c,y:s,w:r,h:i}),c+=r+ET,u=Math.max(u,c-ET),l=Math.max(l,i),d++}let f=s+l;r.push({section:a,x:0,y:o,w:Math.max(u,e?kT:0),h:f-o,header:e}),i=f+TT}}let i=0,a=0,o=0,s=0,c=[...n,...r];return c.length&&(i=Math.min(...c.map(e=>e.x)),a=Math.min(...c.map(e=>e.y)),o=Math.max(...c.map(e=>e.x+e.w)),s=Math.max(...c.map(e=>e.y+e.h))),{items:n,sections:r,bounds:{x:i,y:a,w:o-i,h:s-a}}}function PT(e){return e.items.filter(e=>AT(e.item))}function FT(){return new a_({selected:null,active:null,hovered:null,sizes:{},frames:{},live:[],panning:!1,zoomTiny:!1,frameEls:{},inspecting:!1})}function IT(e,t,n){e.set(e=>{let r=e.sizes[t];return r&&Math.abs(r.h-n.h)<1&&r.w===n.w?e:{...e,sizes:{...e.sizes,[t]:n}}})}function LT(e,t,n){e.set(e=>{let r=e.frames[t]??{ready:!1,errors:[]};return{...e,frames:{...e.frames,[t]:{...r,...n}}}})}function RT(e,t,n){e.set(e=>e.frameEls[t]===n?e:{...e,frameEls:{...e.frameEls,[t]:n}})}function zT(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var BT=zT();function VT(e){BT=e}var HT={exec:()=>null};function UT(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(GT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var WT=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),GT={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:UT(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:UT(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:UT(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:UT(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:UT(e=>RegExp(`^ {0,${e}}(?:</?(?:${oE})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:UT(e=>RegExp(`^ {0,${e}}>`))},KT=/^(?:[ \t]*(?:\n|$))+/,qT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,YT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,XT=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ZT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,QT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$T=$(QT).replace(/bull/g,ZT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),eE=$(QT).replace(/bull/g,ZT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),tE=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,nE=/^[^\n]+/,rE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,iE=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,rE).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),aE=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ZT).getRegex(),oE=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,sE=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cE=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,sE).replace(`tag`,oE).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),lE=e=>$(tE).replace(`hr`,YT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,oE).getRegex(),uE=lE(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),dE=lE(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),fE={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,dE).getRegex(),code:qT,def:iE,fences:JT,heading:XT,hr:YT,html:cE,lheading:$T,list:aE,newline:KT,paragraph:uE,table:HT,text:nE},pE=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,YT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,oE).getRegex(),mE={...fE,lheading:eE,table:pE,paragraph:$(tE).replace(`hr`,YT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,pE).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,oE).getRegex()},hE={...fE,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,sE).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:HT,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(tE).replace(`hr`,YT).replace(`heading`,` *#{1,6} *[^
|
|
59
59
|
]`).replace(`lheading`,$T).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},gE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,_E=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,vE=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,yE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,bE=/[\p{P}\p{S}]/u,xE=/[\s\p{P}\p{S}]/u,SE=/[^\s\p{P}\p{S}]/u,CE=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,xE).getRegex(),wE=/[\p{Pi}\p{Ps}"']/u,TE=/(?!~)[\p{P}\p{S}]/u,EE=/(?!~)[\s\p{P}\p{S}]/u,DE=/(?:[^\s\p{P}\p{S}]|~)/u,OE=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,WT?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),kE=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,AE=$(kE,`u`).replace(/punct/g,bE).getRegex(),jE=$(kE,`u`).replace(/punct/g,TE).getRegex(),ME=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,wE).replace(/punct/g,bE).getRegex(),NE=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,PE=$(NE,`gu`).replace(/notPunctSpace/g,SE).replace(/punctSpace/g,xE).replace(/punct/g,bE).getRegex(),FE=$(NE,`gu`).replace(/notPunctSpace/g,DE).replace(/punctSpace/g,EE).replace(/punct/g,TE).getRegex(),IE=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,SE).replace(/punctSpace/g,xE).replace(/punct/g,bE).getRegex(),LE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,SE).replace(/punctSpace/g,xE).replace(/punct/g,bE).getRegex(),RE=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,SE).replace(/punctSpace/g,xE).replace(/punct/g,bE).getRegex(),zE=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,bE).getRegex(),BE=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,SE).replace(/punctSpace/g,xE).replace(/punct/g,bE).getRegex(),VE=$(/\\(punct)/,`gu`).replace(/punct/g,bE).getRegex(),HE=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),UE=$(sE).replace(`(?:-->|$)`,`-->`).getRegex(),WE=$(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,UE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),GE=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,KE=$(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,GE).getRegex(),qE=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,KE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),JE=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,KE).replace(`ref`,rE).getRegex(),YE=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,rE).getRegex(),XE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,ZE=$(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,GE).getRegex(),QE=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,ZE).replace(`ref`,XE).getRegex()).replace(`nolink`,$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,XE).getRegex()).getRegex(),$E=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eD=$(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),tD={_backpedal:HT,anyPunctuation:VE,autolink:HE,blockSkip:OE,br:vE,code:_E,del:HT,delLDelim:HT,delRDelim:HT,emStrongLDelim:AE,emStrongRDelimAst:PE,emStrongRDelimUnd:LE,escape:gE,link:qE,nolink:YE,punctuation:CE,reflink:JE,reflinkSearch:QE,tag:WE,text:yE,url:HT},nD={...tD,emStrongLDelim:ME,emStrongRDelimAst:IE,emStrongRDelimUnd:RE,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,KE).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,KE).getRegex()},rD={...tD,emStrongRDelimAst:FE,emStrongLDelim:jE,delLDelim:zE,delRDelim:BE,url:$(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,eD).replace(`protocol`,$E).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,$E).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},iD={...rD,br:$(vE).replace(`{2,}`,`*`).getRegex(),text:$(rD.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},aD={normal:fE,gfm:mE,pedantic:hE},oD={normal:tD,gfm:rD,breaks:iD,pedantic:nD},sD={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},cD=e=>sD[e];function lD(e,t){if(t){if(GT.escapeTest.test(e))return e.replace(GT.escapeReplace,cD)}else if(GT.escapeTestNoEncode.test(e))return e.replace(GT.escapeReplaceNoEncode,cD);return e}function uD(e){return e.replace(GT.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function dD(e){try{e=encodeURI(e).replace(GT.percentDecode,`%`)}catch{return null}return e}function fD(e,t){let n=e.replace(GT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(GT.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(GT.slashPipe,`|`);return n}function pD(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function mD(e){let t=e.split(`
|
|
60
60
|
`),n=t.length-1;for(;n>=0&>.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
package/dist/viewer/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = dark ? 'dark' : 'light'
|
|
15
15
|
} catch (e) {}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="./assets/index-
|
|
17
|
+
<script type="module" crossorigin src="./assets/index-nWUkiwia.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="./assets/index-ChcZNlVM.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/viewer-lib/index.js
CHANGED
|
@@ -6721,7 +6721,7 @@ function AppTopBar() {
|
|
|
6721
6721
|
slots.barStart,
|
|
6722
6722
|
/* @__PURE__ */ jsxs("div", {
|
|
6723
6723
|
className: "flex min-w-0 items-center gap-6",
|
|
6724
|
-
children: [/* @__PURE__ */ jsx(Wordmark, {
|
|
6724
|
+
children: [slots.brand ?? /* @__PURE__ */ jsx(Wordmark, {
|
|
6725
6725
|
name: project?.name,
|
|
6726
6726
|
version: project?.version
|
|
6727
6727
|
}), /* @__PURE__ */ jsx(Tabs, { location })]
|
|
@@ -8834,7 +8834,7 @@ function CanvasBar({ canvas, page, theme, onTheme, sidebar, onSidebar, onPlay, c
|
|
|
8834
8834
|
const { slots, scope } = useViewer();
|
|
8835
8835
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Bar, { children: [
|
|
8836
8836
|
slots.barStart,
|
|
8837
|
-
scope ? /* @__PURE__ */ jsx(Mark, {}) : /* @__PURE__ */ jsx(Tooltip, {
|
|
8837
|
+
slots.brand ? slots.brand : scope ? /* @__PURE__ */ jsx(Mark, {}) : /* @__PURE__ */ jsx(Tooltip, {
|
|
8838
8838
|
content: "All canvases",
|
|
8839
8839
|
children: /* @__PURE__ */ jsx(Link, {
|
|
8840
8840
|
href: "/",
|
|
@@ -4,6 +4,11 @@ import type { ViewerSource } from './source';
|
|
|
4
4
|
export interface ViewerSlots {
|
|
5
5
|
/** At the start of every top bar. */
|
|
6
6
|
barStart?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* In place of the project wordmark on the home bar and the mark on the canvas bar: a project
|
|
9
|
+
* switcher. Links in it resolve against the viewer's base, so `/` is the project's home.
|
|
10
|
+
*/
|
|
11
|
+
brand?: ReactNode;
|
|
7
12
|
/** At the end of every top bar. */
|
|
8
13
|
barEnd?: ReactNode;
|
|
9
14
|
/** Full width under every top bar, above the page: a notice strip. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foss-design",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Design canvases and design systems for coding agents: live, animated, clickable screens on an infinite canvas, served locally from a .design folder.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|