@crewlethq/artifact-kit 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kit.js CHANGED
@@ -9,4 +9,4 @@ Error generating stack: `+l.message+`
9
9
  `).replace(Q4,"")}function kv(e,t){return t=U1(t),U1(e)===t}function fe(e,t,a,l,n,i){switch(a){case"children":if(typeof l=="string")t==="body"||t==="textarea"&&l===""||Ti(e,l);else if(typeof l=="number"||typeof l=="bigint")t!=="body"&&Ti(e,""+l);else return;break;case"className":Io(e,"class",l);break;case"tabIndex":Io(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Io(e,a,l);break;case"style":Dm(e,l,i);return;case"data":if(t!=="object"){Io(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=fs(l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(a==="formAction"?(t!=="input"&&fe(e,t,"name",n.name,n,null),fe(e,t,"formEncType",n.formEncType,n,null),fe(e,t,"formMethod",n.formMethod,n,null),fe(e,t,"formTarget",n.formTarget,n,null)):(fe(e,t,"encType",n.encType,n,null),fe(e,t,"method",n.method,n,null),fe(e,t,"target",n.target,n,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=fs(l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=qa);return;case"onScroll":l!=null&&P("scroll",e);return;case"onScrollEnd":l!=null&&P("scrollend",e);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(_(61));if(a=l.__html,a!=null){if(n.children!=null)throw Error(_(60));i?.__html!==a&&(e.innerHTML=a)}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=fs(l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":P("beforetoggle",e),P("toggle",e),ds(e,"popover",l);break;case"xlinkActuate":al(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":al(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":al(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":al(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":al(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":al(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":al(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":al(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":al(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ds(e,"is",l);break;case"innerText":case"textContent":return;default:if(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")a=hw.get(a)||a,ds(e,a,l);else return}ne=!0}function Id(e,t,a,l,n,i){switch(a){case"style":Dm(e,l,i);return;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(_(61));if(a=l.__html,a!=null){if(n.children!=null)throw Error(_(60));i?.__html!==a&&(e.innerHTML=a)}}break;case"children":if(typeof l=="string")Ti(e,l);else if(typeof l=="number"||typeof l=="bigint")Ti(e,""+l);else return;break;case"onScroll":l!=null&&P("scroll",e);return;case"onScrollEnd":l!=null&&P("scrollend",e);return;case"onClick":l!=null&&(e.onclick=qa);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Am.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(n=a.endsWith("Capture"),i=a.slice(2,n?a.length-7:void 0),t=e[Vt]||null,t=t!=null?t[a]:null,typeof t=="function"&&e.removeEventListener(i,t,n),typeof l=="function")){typeof t!="function"&&t!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(i,l,n);break e}ne=!0,a in e?e[a]=l:l===!0?e.setAttribute(a,""):ds(e,a,l)}return}ne=!0}function mt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":P("error",e),P("load",e);var l=!1,n=!1,i;for(i in a)if(a.hasOwnProperty(i)){var r=a[i];if(r!=null)switch(i){case"src":l=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(_(137,t));default:fe(e,t,i,r,a,null)}}n&&fe(e,t,"srcSet",a.srcSet,a,null),l&&fe(e,t,"src",a.src,a,null);return;case"input":P("invalid",e);var o=i=r=n=null,s=null,c=null;for(l in a)if(a.hasOwnProperty(l)){var d=a[l];if(d!=null)switch(l){case"name":n=d;break;case"type":r=d;break;case"checked":s=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":o=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(_(137,t));break;default:fe(e,t,l,d,a,null)}}Om(e,i,o,s,c,r,n,!1);return;case"select":P("invalid",e),l=r=i=null;for(n in a)if(a.hasOwnProperty(n)&&(o=a[n],o!=null))switch(n){case"value":i=o;break;case"defaultValue":r=o;break;case"multiple":l=o;default:fe(e,t,n,o,a,null)}t=i,a=r,e.multiple=!!l,t!=null?fi(e,!!l,t,!1):a!=null&&fi(e,!!l,a,!0);return;case"textarea":P("invalid",e),i=n=l=null;for(r in a)if(a.hasOwnProperty(r)&&(o=a[r],o!=null))switch(r){case"value":l=o;break;case"defaultValue":n=o;break;case"children":i=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(_(91));break;default:fe(e,t,r,o,a,null)}Rm(e,l,n,i);return;case"option":for(s in a)a.hasOwnProperty(s)&&(l=a[s],l!=null)&&(s==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":fe(e,t,s,l,a,null));return;case"dialog":P("beforetoggle",e),P("toggle",e),P("cancel",e),P("close",e);break;case"iframe":case"object":P("load",e);break;case"video":case"audio":for(l=0;l<Zr.length;l++)P(Zr[l],e);break;case"image":P("error",e),P("load",e);break;case"details":P("toggle",e);break;case"embed":case"source":case"link":P("error",e),P("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in a)if(a.hasOwnProperty(c)&&(l=a[c],l!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(_(137,t));default:fe(e,t,c,l,a,null)}return;default:if(df(t)){for(d in a)a.hasOwnProperty(d)&&(l=a[d],l!==void 0&&Id(e,t,d,l,a,void 0));return}}for(o in a)a.hasOwnProperty(o)&&(l=a[o],l!=null&&fe(e,t,o,l,a,null))}var Z4={};function I4(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,i=null,r=null,o=null,s=null,c=null,d=null;for(m in a){var g=a[m];if(a.hasOwnProperty(m)&&g!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":s=g;default:l.hasOwnProperty(m)||fe(e,t,m,null,l,g)}}for(var u in l){var m=l[u];if(g=a[u],l.hasOwnProperty(u)&&(m!=null||g!=null))switch(u){case"type":m!==g&&(ne=!0),i=m;break;case"name":m!==g&&(ne=!0),n=m;break;case"checked":m!==g&&(ne=!0),c=m;break;case"defaultChecked":m!==g&&(ne=!0),d=m;break;case"value":m!==g&&(ne=!0),r=m;break;case"defaultValue":m!==g&&(ne=!0),o=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(_(137,t));break;default:m!==g&&fe(e,t,u,m,l,g)}}rd(e,r,o,s,c,d,i,n);return;case"select":m=r=o=u=null;for(i in a)if(s=a[i],a.hasOwnProperty(i)&&s!=null)switch(i){case"value":break;case"multiple":m=s;default:l.hasOwnProperty(i)||fe(e,t,i,null,l,s)}for(n in l)if(i=l[n],s=a[n],l.hasOwnProperty(n)&&(i!=null||s!=null))switch(n){case"value":i!==s&&(ne=!0),u=i;break;case"defaultValue":i!==s&&(ne=!0),o=i;break;case"multiple":i!==s&&(ne=!0),r=i;default:i!==s&&fe(e,t,n,i,l,s)}t=o,a=r,l=m,u!=null?fi(e,!!a,u,!1):!!l!=!!a&&(t!=null?fi(e,!!a,t,!0):fi(e,!!a,a?[]:"",!1));return;case"textarea":m=u=null;for(o in a)if(n=a[o],a.hasOwnProperty(o)&&n!=null&&!l.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:fe(e,t,o,null,l,n)}for(r in l)if(n=l[r],i=a[r],l.hasOwnProperty(r)&&(n!=null||i!=null))switch(r){case"value":n!==i&&(ne=!0),u=n;break;case"defaultValue":n!==i&&(ne=!0),m=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(_(91));break;default:n!==i&&fe(e,t,r,n,l,i)}Cm(e,u,m);return;case"option":for(var b in a)u=a[b],a.hasOwnProperty(b)&&u!=null&&!l.hasOwnProperty(b)&&(b==="selected"?e.selected=!1:fe(e,t,b,null,l,u));for(s in l)u=l[s],m=a[s],l.hasOwnProperty(s)&&u!==m&&(u!=null||m!=null)&&(s==="selected"?(u!==m&&(ne=!0),e.selected=u&&typeof u!="function"&&typeof u!="symbol"):fe(e,t,s,u,l,m));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var w in a)u=a[w],a.hasOwnProperty(w)&&u!=null&&!l.hasOwnProperty(w)&&fe(e,t,w,null,l,u);for(c in l)if(u=l[c],m=a[c],l.hasOwnProperty(c)&&u!==m&&(u!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(_(137,t));break;default:fe(e,t,c,u,l,m)}return;default:if(df(t)){for(var S in a)u=a[S],a.hasOwnProperty(S)&&u!==void 0&&!l.hasOwnProperty(S)&&Id(e,t,S,void 0,l,u);for(d in l)u=l[d],m=a[d],!l.hasOwnProperty(d)||u===m||u===void 0&&m===void 0||Id(e,t,d,u,l,m);return}}for(var f in a)u=a[f],a.hasOwnProperty(f)&&u!=null&&!l.hasOwnProperty(f)&&fe(e,t,f,null,l,u);for(g in l)u=l[g],m=a[g],!l.hasOwnProperty(g)||u===m||u==null&&m==null||fe(e,t,g,u,l,m)}function B1(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function J4(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var n=a[l],i=n.transferSize,r=n.initiatorType,o=n.duration;if(i&&o&&B1(r)){for(r=0,o=n.responseEnd,l+=1;l<a.length;l++){var s=a[l],c=s.startTime;if(c>o)break;var d=s.transferSize,g=s.initiatorType;d&&B1(g)&&(s=s.responseEnd,r+=d*(s<o?1:(o-c)/(s-c)))}if(--l,t+=8*(i+r)/(n.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Jd=null,$d=null;function Jr(e){return e.nodeType===9?e:e.ownerDocument}function q1(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Lv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Uv(e,t,a,l){return a=Jr(a).createElement(e),a[dt]=l,a[Vt]=t,mt(a,e,t),it(a),a}function Fd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xu=null;function $4(){var e=window.event;return e&&e.type==="popstate"?e===Xu?!1:(Xu=e,!0):(Xu=null,!1)}var Ff=typeof setTimeout=="function"?setTimeout:void 0,F4=typeof clearTimeout=="function"?clearTimeout:void 0,V1=typeof Promise=="function"?Promise:void 0,Y1=typeof requestAnimationFrame=="function"?requestAnimationFrame:Ff,W4=typeof queueMicrotask=="function"?queueMicrotask:typeof V1<"u"?function(e){return V1.resolve(null).then(e).catch(P4)}:Ff;function P4(e){setTimeout(function(){throw e})}function Pl(e){return e==="head"}function j1(e,t){var a=t,l=0;do{var n=a.nextSibling;if(e.removeChild(a),n&&n.nodeType===8)if(a=n.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(n),Di(t);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")Zu(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Zu(a);for(var i=a.firstChild;i;){var r=i.nextSibling,o=i.nodeName;i[no]||o==="SCRIPT"||o==="STYLE"||o==="LINK"&&i.rel.toLowerCase()==="stylesheet"||a.removeChild(i),i=r}}else a==="body"&&Zu(e.ownerDocument.body);a=n}while(a);Di(t)}function K1(e,t){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function Bv(e,t,a){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,a!=null&&(e.style.viewTransitionClass=a),a=getComputedStyle(e),a.display==="inline"){if(t=e.getClientRects(),t.length===1)var l=1;else for(var n=l=0;n<t.length;n++){var i=t[n];0<i.width&&0<i.height&&l++}l===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+a.paddingTop,e.marginBottom="-"+a.paddingBottom)}}function qv(e,t){e=e.style,t=t.style;var a=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=a==null||typeof a=="boolean"?"":(""+a).trim(),a=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=a==null||typeof a=="boolean"?"":(""+a).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(a=t.display,e.display=a==null||typeof a=="boolean"?"":a,a=t.margin,a!=null?e.margin=a:(a=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=a==null||typeof a=="boolean"?"":a,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Vv(e,t,a){return a=a.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=a.innerHeight&&e.left<=a.innerWidth}}function Wd(e){var t=e.getBoundingClientRect(),a=getComputedStyle(e);return Vv(t,a,e)}function e3(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var a=getComputedStyle(e);return Vv(t,a,e)}function t3(e){return e.documentElement.clientHeight}function a3(e){this.addEventListener("load",e),this.addEventListener("error",e)}function l3(e,t,a,l,n,i,r,o,s){var c=t.nodeType===9?t:t.ownerDocument;try{var d=c.startViewTransition({update:function(){var u=c.defaultView,m=u.navigation&&u.navigation.transition,b=c.fonts.status;l();var w=[];if(b==="loaded"&&(t3(c),c.fonts.status==="loading"&&w.push(c.fonts.ready)),b=w.length,e!==null)for(var S=e.suspenseyImages,f=0,h=0;h<S.length;h++){var p=S[h];if(!p.complete){var y=p.getBoundingClientRect();if(0<y.bottom&&0<y.right&&y.top<u.innerHeight&&y.left<u.innerWidth){if(f+=Pv(p),f>As){w.length=b;break}p=new Promise(a3.bind(p)),w.push(p)}}}if(0<w.length)return u=Promise.race([Promise.all(w),new Promise(function(T){return setTimeout(T,500)})]).then(n,n),(m?Promise.allSettled([m.finished,u]):u).then(i,i);if(n(),m)return m.finished.then(i,i);i()},types:a});c.__reactViewTransition=d;var g=[];return d.ready.then(function(){for(var u=c.documentElement.getAnimations({subtree:!0}),m=0;m<u.length;m++){var b=u[m],w=b.effect,S=w.pseudoElement;if(S!=null&&S.startsWith("::view-transition")){g.push(b),b=w.getKeyframes();for(var f=S=void 0,h=!0,p=0;p<b.length;p++){var y=b[p],T=y.width;if(S===void 0)S=T;else if(S!==T){h=!1;break}if(T=y.height,f===void 0)f=T;else if(f!==T){h=!1;break}delete y.width,delete y.height,y.transform==="none"&&delete y.transform}h&&S!==void 0&&f!==void 0&&(w.setKeyframes(b),h=getComputedStyle(w.target,w.pseudoElement),h.width!==S||h.height!==f)&&(h=b[0],h.width=S,h.height=f,h=b[b.length-1],h.width=S,h.height=f,w.setKeyframes(b))}}r()},function(u){c.__reactViewTransition===d&&(c.__reactViewTransition=null);try{typeof u=="object"&&u!==null&&u.name==="InvalidStateError"&&(u.message==="View transition was skipped because document visibility state is hidden."||u.message==="Skipping view transition because document visibility state has become hidden."||u.message==="Skipping view transition because viewport size changed."||u.message==="Transition was aborted because of invalid state")&&(u=null),u!==null&&s(u)}finally{l(),n(),r()}}),d.finished.finally(function(){for(var u=0;u<g.length;u++)g[u].cancel();c.__reactViewTransition===d&&(c.__reactViewTransition=null),o()}),d}catch{return l(),n(),r(),null}}function gn(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}gn.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:ye({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)};gn.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,a=e.getAnimations({subtree:!0}),l=[],n=0;n<a.length;n++){var i=a[n].effect;i!==null&&i.target===e&&i.pseudoElement===t&&l.push(a[n])}return l};gn.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Yv(e){return{name:e,group:new gn("group",e),imagePair:new gn("image-pair",e),old:new gn("old",e),new:new gn("new",e)}}function Pt(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Pt.prototype.addEventListener=function(e,t,a){var l=null,n=null;if(!(a!=null&&typeof a!="boolean"&&(l=a.signal||null,l!==null&&l.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var i=this._eventListeners;if(jv(i,e,t,a)===-1){var r=this,o=t;a!=null&&typeof a!="boolean"&&a.once===!0&&(o=function(s){r.removeEventListener(e,t,a),typeof t=="function"?t.call(this,s):t.handleEvent(s)}),l!==null&&(n=r.removeEventListener.bind(r,e,t,a),l.addEventListener("abort",n,{once:!0}),n=l.removeEventListener.bind(l,"abort",n)),l=zi(a),i.push({type:e,listener:t,optionsOrUseCapture:a,attachedListener:o,cleanup:n}),qt(this._fragmentFiber.child,!1,n3,e,o,l)}this._eventListeners=i}};function n3(e,t,a,l){return Je(e).addEventListener(t,a,l),!1}Pt.prototype.removeEventListener=function(e,t,a){var l=this._eventListeners;if(l!==null&&(t=jv(l,e,t,a),t!==-1)){var n=l[t];a=n.attachedListener;var i=n.cleanup;n=zi(n.optionsOrUseCapture),qt(this._fragmentFiber.child,!1,i3,e,a,n),l.splice(t,1),i!==null&&i()}};function i3(e,t,a,l){return Je(e).removeEventListener(t,a,l),!1}function zi(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function X1(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function jv(e,t,a,l){if(e.length===0)return-1;l=X1(l);for(var n=0;n<e.length;n++){var i=e[n];if(i.type===t&&i.listener===a&&X1(i.optionsOrUseCapture)===l)return n}return-1}Pt.prototype.dispatchEvent=function(e){var t=On(this._fragmentFiber);if(t===null)return!0;t=Je(t);var a=this._eventListeners;if(a!==null&&0<a.length||!e.bubbles){var l=t.nodeType===9?t.createComment(""):document.createTextNode("");if(a)for(var n=0;n<a.length;n++){var i=a[n];l.addEventListener(i.type,i.attachedListener,zi(i.optionsOrUseCapture))}if(t.appendChild(l),e=l.dispatchEvent(e),a)for(n=0;n<a.length;n++)i=a[n],l.removeEventListener(i.type,i.attachedListener,zi(i.optionsOrUseCapture));return t.removeChild(l),e}return t.dispatchEvent(e)};Pt.prototype.focus=function(e){qt(this._fragmentFiber.child,!0,Kv,e,void 0,void 0)};function Kv(e,t){return e.tag===6?!1:(e=Je(e),v3(e,t))}Pt.prototype.focusLast=function(e){var t=[];qt(this._fragmentFiber.child,!0,Wf,t,void 0,void 0);for(var a=t.length-1;0<=a&&!Kv(t[a],e);a--);};function Wf(e,t){return t.push(e),!1}Pt.prototype.blur=function(){var e=On(this._fragmentFiber);e!==null&&(e=Je(e),e=Jr(e).activeElement,e!==null&&qt(this._fragmentFiber.child,!1,r3,e,void 0,void 0))};function r3(e,t){return e.tag===6?!1:(e=Je(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Pt.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),qt(this._fragmentFiber.child,!1,o3,e,void 0,void 0)};function o3(e,t){return e.tag===6||(e=Je(e),t.observe(e)),!1}Pt.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),qt(this._fragmentFiber.child,!1,s3,e,void 0,void 0);for(var a=t=0;a<Ta.length;a++){var l=Ta[a];l.fragmentInstance===this&&l.observer===e?e.unobserve(l.instance):Ta[t++]=l}Ta.length=t}};function s3(e,t){return e.tag===6||(e=Je(e),t.unobserve(e)),!1}var Ta=[],Qu=!1;function c3(e,t,a){Ta.push({fragmentInstance:e,observer:t,instance:a}),Qu||(Qu=!0,y3(function(){Qu=!1;var l=Ta;Ta=[];for(var n=0;n<l.length;n++){var i=l[n];i.observer.unobserve(i.instance)}}))}Pt.prototype.getClientRects=function(){var e=[];return qt(this._fragmentFiber.child,!1,u3,e,void 0,void 0),e};function u3(e,t){if(e.tag===6){e=e.stateNode;var a=e.ownerDocument.createRange();a.selectNodeContents(e),t.push.apply(t,a.getClientRects())}else e=Je(e),t.push.apply(t,e.getClientRects());return!1}Pt.prototype.getRootNode=function(e){var t=On(this._fragmentFiber);return t===null?this:Je(t).getRootNode(e)};Pt.prototype.compareDocumentPosition=function(e){var t=On(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var a=[];qt(this._fragmentFiber.child,!1,Wf,a,void 0,void 0);var l=Je(t);if(a.length===0){if(a=l,Sp(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(a=t)}t=this._fragmentFiber;var n=l=a.compareDocumentPosition(e);return a===e?n=Node.DOCUMENT_POSITION_CONTAINS:l&Node.DOCUMENT_POSITION_CONTAINED_BY&&(a=fm(t)[1],a===null?n=Node.DOCUMENT_POSITION_PRECEDING:(e=Je(a).compareDocumentPosition(e),n=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),n|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=Je(a[0]),n=Je(a[a.length-1]);var i=Sp(this._fragmentFiber)?t.parentElement:l;if(i==null)return Node.DOCUMENT_POSITION_DISCONNECTED;l=i.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,i=i.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_CONTAINED_BY;var r=t.compareDocumentPosition(e),o=n.compareDocumentPosition(e),s=r&Node.DOCUMENT_POSITION_CONTAINED_BY||o&Node.DOCUMENT_POSITION_CONTAINED_BY;return o=l&&i&&r&Node.DOCUMENT_POSITION_FOLLOWING&&o&Node.DOCUMENT_POSITION_PRECEDING,t=l&&t===e||i&&n===e||s||o?Node.DOCUMENT_POSITION_CONTAINED_BY:!l&&t===e||!i&&n===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:r,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||d3(t,this._fragmentFiber,a[0],a[a.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function d3(e,t,a,l,n){var i=mn(n);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(a=!!i)e:{for(;i!==null;){if(i.tag===7&&(i===t||i.alternate===t)){a=!0;break e}i=i.return}a=!1}return a}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(i===null)return i=n.ownerDocument,n===i||n===i.documentElement||n===i.body;e:{for(i=t,t=On(t);i!==null;){if(!(i.tag!==5&&i.tag!==3&&i.tag!==27||i!==t&&i.alternate!==t)){i=!0;break e}i=i.return}i=!1}return i}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!i)&&!(t=i===a)&&(t=Ju(a,i,Ep),t===null?t=!1:(qt(t,!0,Vb,i,a),i=Pn,Pn=null,t=i!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!i)&&!(t=i===l)&&(t=Ju(l,i,Ep),t===null?t=!1:(qt(t,!0,Yb,i,l),i=Pn,Iu=Pn=null,t=i!==null)),t):!1}function Q1(e,t){var a=e.ownerDocument.createRange();a.selectNodeContents(e),e=a.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Pt.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(_(566));var t=[];qt(this._fragmentFiber.child,!1,Wf,t,void 0,void 0);var a=e!==!1;if(t.length===0){var l=fm(this._fragmentFiber);if(l=a?l[1]||l[0]||On(this._fragmentFiber):l[0]||l[1],l===null)return;if(l.tag===6){e=Je(l),Q1(e,a);return}if(l=Je(l),l.nodeType!==9){if(l.nodeType===11){a="host"in l?l.host:null,a!==null&&a.scrollIntoView(e);return}l.scrollIntoView(e)}}for(l=a?t.length-1:0;l!==(a?-1:t.length);){var n=t[l];n.tag===6?(n=Je(n),Q1(n,a)):Je(n).scrollIntoView(e),l+=a?-1:1}};function f3(e,t){return e=Je(e),Xv(e,t),!1}function Xv(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Qv(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var n=a[l];e.addEventListener(n.type,n.attachedListener,zi(n.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(i){for(var r=0,o=0;o<Ta.length;o++){var s=Ta[o];(s.fragmentInstance!==t||s.observer!==i||s.instance!==e)&&(Ta[r++]=s)}Ta.length=r,i.observe(e)}),Xv(e,t))}function h3(e,t){var a=t._eventListeners;if(a!==null)for(var l=0;l<a.length;l++){var n=a[l];e.removeEventListener(n.type,n.attachedListener,zi(n.optionsOrUseCapture))}e.nodeType!==3&&(a=t._observers,a!==null&&a.forEach(function(i){typeof i.rootMargin=="string"?c3(t,i,e):i.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function Pd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Pd(a),rc(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function p3(e,t,a,l){for(;e.nodeType===1;){var n=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[no])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=pa(e.nextSibling),e===null)break}return null}function m3(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=pa(e.nextSibling),e===null))return null;return e}function Zv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=pa(e.nextSibling),e===null))return null;return e}function ef(e){return e.data==="$?"||e.data==="$~"}function Pf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function g3(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function pa(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var tf=null;function Z1(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return pa(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function I1(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function v3(e,t){function a(){l=!0}if(e.ownerDocument.activeElement===e)return!0;var l=!1;try{e.ownerDocument.addEventListener("focus",a,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",a,!0)}return l}function y3(e){Y1(function(){Y1(function(t){return e(t)})})}function Iv(e,t,a){switch(t=Jr(a),e){case"html":if(e=t.documentElement,!e)throw Error(_(452));return e;case"head":if(e=t.head,!e)throw Error(_(453));return e;case"body":if(e=t.body,!e)throw Error(_(454));return e;default:throw Error(_(451))}}function Jv(e,t,a){for(var l in a){var n=a[l];a.hasOwnProperty(l)&&n!=null&&fe(e,t,l,null,Z4,n)}a.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===qa&&(e.onclick=null),rc(e)}function Zu(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rc(e)}var ma=new Map,J1=new Set;function $r(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var gl=re.d;re.d={f:b3,r:w3,D:x3,C:_3,L:T3,m:S3,X:M3,S:E3,M:A3};function b3(){var e=gl.f(),t=wc();return e||t}function w3(e){var t=Gi(e);t!==null&&t.tag===5&&t.type==="form"?Dg(t):gl.r(e)}var Bi=typeof document>"u"?null:document;function $v(e,t,a){var l=Bi;if(l&&typeof t=="string"&&t){var n=da(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof a=="string"&&(n+='[crossorigin="'+a+'"]'),J1.has(n)||(J1.add(n),e={rel:e,crossOrigin:a,href:t},l.querySelector(n)===null&&(t=l.createElement("link"),mt(t,"link",e),it(t),l.head.appendChild(t)))}}function x3(e){gl.D(e),$v("dns-prefetch",e,null)}function _3(e,t){gl.C(e,t),$v("preconnect",e,t)}function T3(e,t,a){gl.L(e,t,a);var l=Bi;if(l&&e&&t){var n='link[rel="preload"][as="'+da(t)+'"]';t==="image"&&a&&a.imageSrcSet?(n+='[imagesrcset="'+da(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(n+='[imagesizes="'+da(a.imageSizes)+'"]')):n+='[href="'+da(e)+'"]';var i=n;switch(t){case"style":i=Oi(e);break;case"script":i=qi(e)}if(!(ma.has(i)||(e=ye({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),ma.set(i,e),l.querySelector(n)!==null||t==="style"&&l.querySelector(uo(i))||t==="script"&&l.querySelector(fo(i))))){var r=l.createElement("link");mt(r,"link",e),t==="style"&&(r[Hs]=!0,r.onload=r.onerror=function(){Em(r)}),it(r),l.head.appendChild(r)}}}function S3(e,t){gl.m(e,t);var a=Bi;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+da(l)+'"][href="'+da(e)+'"]',i=n;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=qi(e)}if(!ma.has(i)&&(e=ye({rel:"modulepreload",href:e},t),ma.set(i,e),a.querySelector(n)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(fo(i)))return}l=a.createElement("link"),mt(l,"link",e),it(l),a.head.appendChild(l)}}}function E3(e,t,a){gl.S(e,t,a);var l=Bi;if(l&&e){var n=di(l).hoistableStyles,i=Oi(e);t=t||"default";var r=n.get(i);if(!r){var o={loading:0,preload:null};if(r=l.querySelector(uo(i)))o.loading=5;else{e=ye({rel:"stylesheet",href:e,"data-precedence":t},a),(a=ma.get(i))&&eh(e,a);var s=r=l.createElement("link");it(s),mt(s,"link",e),s._p=new Promise(function(c,d){s.onload=c,s.onerror=d}),s.addEventListener("load",function(){o.loading|=1}),s.addEventListener("error",function(){o.loading|=2}),o.loading|=4,Es(r,t,l)}r={type:"stylesheet",instance:r,count:1,state:o},n.set(i,r)}}}function M3(e,t){gl.X(e,t);var a=Bi;if(a&&e){var l=di(a).hoistableScripts,n=qi(e),i=l.get(n);i||(i=a.querySelector(fo(n)),i||(e=ye({src:e,async:!0},t),(t=ma.get(n))&&th(e,t),i=a.createElement("script"),it(i),mt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},l.set(n,i))}}function A3(e,t){gl.M(e,t);var a=Bi;if(a&&e){var l=di(a).hoistableScripts,n=qi(e),i=l.get(n);i||(i=a.querySelector(fo(n)),i||(e=ye({src:e,async:!0,type:"module"},t),(t=ma.get(n))&&th(e,t),i=a.createElement("script"),it(i),mt(i,"link",e),a.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},l.set(n,i))}}function $1(e,t,a,l){var n=(n=Ll.current)?$r(n):null;if(!n)throw Error(_(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(a=Oi(a.href),t=di(n).hoistableStyles,l=t.get(a),l||(l={type:"style",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Oi(a.href);var i=di(n).hoistableStyles,r=i.get(e);if(r||(n=n.ownerDocument||n,r={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,r),(i=n.querySelector(uo(e)))?i._p||(r.instance=i,r.state.loading=5):(i=ma.get(e),i||(i={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},ma.set(e,i)),N3(n,e,i,r.state))),t&&l===null)throw Error(_(528,""));return r}if(t&&l!==null)throw Error(_(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(a=qi(a),t=di(n).hoistableScripts,l=t.get(a),l||(l={type:"script",instance:null,count:0,state:null},t.set(a,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(_(444,e))}}function Oi(e){return'href="'+da(e)+'"'}function uo(e){return'link[rel="stylesheet"]['+e+"]"}function Fv(e){return ye({},e,{"data-precedence":e.precedence,precedence:null})}function N3(e,t,a,l){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Hs]!==!0){l.loading=1;return}}else t=e.createElement("link"),t[Hs]=!0,t.onload=t.onerror=Em.bind(null,t),mt(t,"link",a),it(t),e.head.appendChild(t);l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2})}function qi(e){return'[src="'+da(e)+'"]'}function fo(e){return"script[async]"+e}function F1(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+da(a.href)+'"]');if(l)return t.instance=l,it(l),l;var n=ye({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),it(l),mt(l,"style",n),Es(l,a.precedence,e),t.instance=l;case"stylesheet":n=Oi(a.href);var i=e.querySelector(uo(n));if(i)return t.state.loading|=4,t.instance=i,it(i),i;l=Fv(a),(n=ma.get(n))&&eh(l,n),i=(e.ownerDocument||e).createElement("link"),it(i);var r=i;return r._p=new Promise(function(o,s){r.onload=o,r.onerror=s}),mt(i,"link",l),t.state.loading|=4,Es(i,a.precedence,e),t.instance=i;case"script":return i=qi(a.src),(n=e.querySelector(fo(i)))?(t.instance=n,it(n),n):(l=a,(n=ma.get(i))&&(l=ye({},a),th(l,n)),e=e.ownerDocument||e,n=e.createElement("script"),it(n),mt(n,"link",l),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(_(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,Es(l,a.precedence,e));return t.instance}function Es(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=l.length?l[l.length-1]:null,i=n,r=0;r<l.length;r++){var o=l[r];if(o.dataset.precedence===t)i=o;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function eh(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function th(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ms=null;function W1(e,t,a){if(Ms===null){var l=new Map,n=Ms=new Map;n.set(a,l)}else n=Ms,l=n.get(a),l||(l=new Map,n.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),n=0;n<a.length;n++){var i=a[n];if(!(i[no]||i[dt]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var r=i.getAttribute(t)||"";r=e+r;var o=l.get(r);o?o.push(i):l.set(r,[i])}}return l}function af(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function z3(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function P1(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function Wv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pv(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function em(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=Pv(t),e.suspenseyImages.push(t)),e=R3.bind(e),t.decode().then(e,e))}function O3(e,t,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var n=Oi(l.href),i=t.querySelector(uo(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Fr.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=i,it(i);return}i=t.ownerDocument||t,l=Fv(l),(n=ma.get(n))&&eh(l,n),i=i.createElement("link"),it(i);var r=i;r._p=new Promise(function(o,s){r.onload=o,r.onerror=s}),mt(i,"link",l),a.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=Fr.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var As=0;function C3(e,t){return e.stylesheets&&e.count===0&&Ns(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&Ns(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&As===0&&(As=62500*J4());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ns(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>As?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(n)}}:null}function ey(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)Ns(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function Fr(){this.count--,ey(this)}function R3(){this.imgCount--,ey(this)}var lc=null;function Ns(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,lc=new Map,t.forEach(D3,e),lc=null,Fr.call(e))}function D3(e,t){if(!(t.state.loading&4)){var a=lc.get(e);if(a)var l=a.get(null);else{a=new Map,lc.set(e,a);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var r=n[i];(r.nodeName==="LINK"||r.getAttribute("media")!=="not all")&&(a.set(r.dataset.precedence,r),l=r)}l&&a.set(null,l)}n=t.instance,r=n.getAttribute("data-precedence"),i=a.get(r)||l,i===l&&a.set(null,n),a.set(r,n),this.count++,l=Fr.bind(this),n.addEventListener("load",l),n.addEventListener("error",l),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var Ci={$$typeof:Ba,Provider:null,Consumer:null,_currentValue:vn,_currentValue2:vn,_threadCount:0};function H3(e,t,a,l,n,i,r,o,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=xu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xu(0),this.hiddenUpdates=xu(null),this.identifierPrefix=l,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=r,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.transitionTypes=null,this.incompleteTransitions=new Map}function ty(e,t,a,l,n,i,r,o,s,c,d,g){return e=new H3(e,t,a,r,s,c,d,g,o),t=1,i===!0&&(t|=24),i=Ut(3,null,null,t),e.current=i,i.stateNode=e,t=xf(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:l,isDehydrated:a,cache:t},Sf(i),e}function ay(e){return e?(e=oi,e):oi}function ly(e,t,a,l,n,i){n=ay(n),l.context===null?l.context=n:l.pendingContext=n,l=Bl(t),l.payload={element:a},i=i===void 0?null:i,i!==null&&(l.callback=i),a=ql(e,l,t),a!==null&&(Bt(a,e,t),zr(a,e,t))}function tm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function ah(e,t){tm(e,t),(e=e.alternate)&&tm(e,t)}function ny(e){if(e.tag===13||e.tag===31){var t=Dn(e,67108864);t!==null&&Bt(t,e,67108864),ah(e,67108864)}}function am(e){if(e.tag===13||e.tag===31){var t=Ft();t=cf(t);var a=Dn(e,t);a!==null&&Bt(a,e,t),ah(e,t)}}var Ri=!0;function G3(e,t,a,l){var n=Y.T;Y.T=null;var i=re.p;try{re.p=2,lh(e,t,a,l)}finally{re.p=i,Y.T=n}}function k3(e,t,a,l){var n=Y.T;Y.T=null;var i=re.p;try{re.p=8,lh(e,t,a,l)}finally{re.p=i,Y.T=n}}function lh(e,t,a,l){if(Ri){var n=lf(l);if(n===null)Ku(e,t,l,nc,a),lm(e,l);else if(U3(n,e,t,a,l))l.stopPropagation();else if(lm(e,l),t&4&&-1<L3.indexOf(e)){for(;n!==null;){var i=Gi(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var r=fn(i.pendingLanes);if(r!==0){var o=i;for(o.pendingLanes|=2,o.entangledLanes|=2;r;){var s=1<<31-$t(r);o.entanglements[1]|=s,r&=~s}Za(i),(ie&6)===0&&(Ws=It()+500,co(0,!1))}}break;case 31:case 13:o=Dn(i,2),o!==null&&Bt(o,i,2),wc(),ah(i,2)}if(i=lf(l),i===null&&Ku(e,t,l,nc,a),i===n)break;n=i}n!==null&&l.stopPropagation()}else Ku(e,t,l,null,a)}}function lf(e){return e=ff(e),nh(e)}var nc=null;function nh(e){if(nc=null,e=mn(e),e!==null){var t=eo(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=cm(t),e!==null)return e;e=null}else if(a===31){if(e=um(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return nc=e,null}function iy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fb()){case gm:return 2;case vm:return 8;case Ds:case Wb:return 32;case ym:return 268435456;default:return 32}default:return 32}}var nf=!1,Kl=null,Xl=null,Ql=null,Wr=new Map,Pr=new Map,Ol=[],L3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function lm(e,t){switch(e){case"focusin":case"focusout":Kl=null;break;case"dragenter":case"dragleave":Xl=null;break;case"mouseover":case"mouseout":Ql=null;break;case"pointerover":case"pointerout":Wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pr.delete(t.pointerId)}}function yr(e,t,a,l,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:i,targetContainers:[n]},t!==null&&(t=Gi(t),t!==null&&ny(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function U3(e,t,a,l,n){switch(t){case"focusin":return Kl=yr(Kl,e,t,a,l,n),!0;case"dragenter":return Xl=yr(Xl,e,t,a,l,n),!0;case"mouseover":return Ql=yr(Ql,e,t,a,l,n),!0;case"pointerover":var i=n.pointerId;return Wr.set(i,yr(Wr.get(i)||null,e,t,a,l,n)),!0;case"gotpointercapture":return i=n.pointerId,Pr.set(i,yr(Pr.get(i)||null,e,t,a,l,n)),!0}return!1}function ry(e){var t=mn(e.target);if(t!==null){var a=eo(t);if(a!==null){if(t=a.tag,t===13){if(t=cm(a),t!==null){e.blockedOn=t,zp(e.priority,function(){am(a)});return}}else if(t===31){if(t=um(a),t!==null){e.blockedOn=t,zp(e.priority,function(){am(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zs(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=lf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);od=l,a.target.dispatchEvent(l),od=null}else return t=Gi(a),t!==null&&ny(t),e.blockedOn=a,!1;t.shift()}return!0}function nm(e,t,a){zs(e)&&a.delete(t)}function B3(){nf=!1,Kl!==null&&zs(Kl)&&(Kl=null),Xl!==null&&zs(Xl)&&(Xl=null),Ql!==null&&zs(Ql)&&(Ql=null),Wr.forEach(nm),Pr.forEach(nm)}function cs(e,t){e.blockedOn===t&&(e.blockedOn=null,nf||(nf=!0,$e.unstable_scheduleCallback($e.unstable_NormalPriority,B3)))}var us=null;function im(e){us!==e&&(us=e,$e.unstable_scheduleCallback($e.unstable_NormalPriority,function(){us===e&&(us=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],n=e[t+2];if(typeof l!="function"){if(nh(l||a)===null)continue;break}var i=Gi(a);i!==null&&(e.splice(t,3),t-=3,Td(i,{pending:!0,data:n,method:a.method,action:l},l,n))}}))}function Di(e){function t(s){return cs(s,e)}Kl!==null&&cs(Kl,e),Xl!==null&&cs(Xl,e),Ql!==null&&cs(Ql,e),Wr.forEach(t),Pr.forEach(t);for(var a=0;a<Ol.length;a++){var l=Ol[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ol.length&&(a=Ol[0],a.blockedOn===null);)ry(a),a.blockedOn===null&&Ol.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var n=a[l],i=a[l+1],r=n[Vt]||null;if(typeof i=="function")r||im(a);else if(r){var o=null;if(i&&i.hasAttribute("formAction")){if(n=i,r=i[Vt]||null)o=r.formAction;else if(nh(n)!==null)continue}else o=r.action;typeof o=="function"?a[l+1]=o:(a.splice(l,3),l-=3),im(a)}}}function oy(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(r){return n=r})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function ih(e){this._internalRoot=e}Tc.prototype.render=ih.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(_(409));var a=t.current,l=Ft();ly(a,l,e,t,null,null)};Tc.prototype.unmount=ih.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ly(e.current,2,null,e,null,null),wc(),t[Hi]=null}};function Tc(e){this._internalRoot=e}Tc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Sm();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ol.length&&t!==0&&t<Ol[a].priority;a++);Ol.splice(a,0,e),a===0&&ry(e)}};var rm=om.version;if(rm!=="19.3.1")throw Error(_(527,rm,"19.3.1"));re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(_(188)):(e=Object.keys(e).join(","),Error(_(268,e)));return e=qb(t),e=e!==null?dm(e):null,e=e===null?null:e.stateNode,e};var q3={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:Y,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(br=__REACT_DEVTOOLS_GLOBAL_HOOK__,!br.isDisabled&&br.supportsFiber))try{to=br.inject(q3),Jt=br}catch{}var br;Sc.createRoot=function(e,t){if(!sm(e))throw Error(_(299));var a=!1,l="",n=Vg,i=Yg,r=jg;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(r=t.onRecoverableError)),t=ty(e,1,!1,null,null,a,l,null,n,i,r,oy),e[Hi]=t.current,$f(e),new ih(t)};Sc.hydrateRoot=function(e,t,a){if(!sm(e))throw Error(_(299));var l=!1,n="",i=Vg,r=Yg,o=jg,s=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(n=a.identifierPrefix),a.onUncaughtError!==void 0&&(i=a.onUncaughtError),a.onCaughtError!==void 0&&(r=a.onCaughtError),a.onRecoverableError!==void 0&&(o=a.onRecoverableError),a.formState!==void 0&&(s=a.formState)),t=ty(e,1,!0,t,a??null,l,n,s,i,r,o,oy),t.context=ay(null),a=t.current,l=Ft(),l=cf(l),n=Bl(l),n.callback=null,ql(a,n,l),a=l,t.current.lanes=a,lo(t,a),Za(t),e[Hi]=t.current,$f(e),new Tc(t)};Sc.version="19.3.1"});var dy=Ra((Rx,uy)=>{"use strict";function cy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(cy)}catch(e){console.error(e)}}cy(),uy.exports=sy()});var Ny=Ra(kc=>{"use strict";var l5=Symbol.for("react.transitional.element"),n5=Symbol.for("react.fragment");function Ay(e,t,a){var l=null;if(a!==void 0&&(l=""+a),t.key!==void 0&&(l=""+t.key),"key"in t){a={};for(var n in t)n!=="key"&&(a[n]=t[n])}else a=t;return t=a.ref,{$$typeof:l5,type:e,key:l,ref:t!==void 0?t:null,props:a}}kc.Fragment=n5;kc.jsx=Ay;kc.jsxs=Ay});var be=Ra(($x,zy)=>{"use strict";zy.exports=Ny()});var j2=Q(dy(),1);var Ec=["purple","cyan","green","amber","rose","blue"];var ho=e=>typeof e=="string"&&Ec.includes(e);var fy={editing:{human:0,agent:1},viewing:{human:2,agent:3},idle:{human:4,agent:5}};function rh(e){return e.map((t,a)=>({member:t,index:a})).sort((t,a)=>fy[t.member.activity][t.member.kind]-fy[a.member.activity][a.member.kind]||t.index-a.index).map(({member:t})=>t)}var Mc=Ec.filter(e=>e!=="purple");function oh(e,t=new Map){let a=new Map,l=new Map(Mc.map(i=>[i,0])),n=(i,r)=>{a.set(i,r),l.set(r,(l.get(r)??0)+1)};for(let i of e)i.kind==="agent"&&i.hue!==void 0&&n(i.id,i.hue);for(let i of e){if(a.has(i.id))continue;let r=t.get(i.id);r!==void 0&&n(i.id,r)}for(let i of e){if(a.has(i.id))continue;let r=Mc[0];for(let o of Mc)(l.get(o)??0)<(l.get(r)??0)&&(r=o);n(i.id,r)}return a}function hy(e,t=2){if(e.length===0)return"";if(e.length===1)return e[0];if(e.length<=t)return`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`;let a=e.length-t;return`${e.slice(0,t).join(", ")} and ${a===1?"1 other":`${a} others`}`}var po={activity:(e,t)=>e==="editing"?"Editing":e==="idle"?"Idle":t==="agent"?"Reading":"Viewing",here:(e,t)=>t?e===0?"Only you are here":`You and ${e===1?"1 other":`${e} others`} are here`:e===1?"1 person is here":`${e} people are here`,member:e=>e.location?`${e.name}, ${e.location}`:`${e.name}, ${po.activity(e.activity,e.kind).toLowerCase()}`,more:e=>`${e} more`,editing:e=>`${e} is editing`,alsoHere:e=>e.length===0?"":`${hy(e)} ${e.length===1?"is":"are"} also here.`};function mo(e){return{...po,...e}}var gy=["text","longtext","number","checkbox","select","multiselect","status","person","date","url","rating"],Nc=e=>typeof e=="string"&&gy.includes(e),V3={text:"Text",longtext:"Long text",number:"Number",checkbox:"Checkbox",select:"Select",multiselect:"Multi-select",status:"Status",person:"Person",date:"Date",url:"URL",rating:"Rating"},sh=e=>e===1?"1 change":`${e} changes`,Gn={rowHeader:"Row",addRow:"Add row",empty:"Empty",checked:"Checked",unchecked:"Not checked",rating:(e,t)=>`${e} of ${t} stars`,archived:e=>`Archived: ${e}`,unknownPerson:"Unknown person",types:V3,saving:"Saving",forbidden:"You can view this sheet but not edit it.",couldNotSave:"Could not save this change.",notANumber:e=>`${e} must be a number.`,belowMin:(e,t)=>`${e} must be at least ${t}.`,aboveMax:(e,t)=>`${e} must be at most ${t}.`,tooLong:(e,t)=>`${e} must be at most ${t} characters.`,required:e=>`${e} is required.`,notAnOption:e=>`${e} must be one of its options.`,tooManyItems:(e,t)=>`${e} holds at most ${t} options.`,notAPerson:e=>`${e} must be a person or an agent in this company.`,notADate:e=>`${e} must be a date.`,notAUrl:e=>`${e} must be a web address starting with https:// or http://.`,notARating:(e,t)=>`${e} must be a whole number from 1 to ${t}.`,notABoolean:e=>`${e} must be checked or not checked.`,readOnly:e=>`${e} is read only.`,conflict:(e,t)=>`${e} changed this to ${t} while you were editing.`,keepMine:"Keep yours",useTheirs:e=>`Use ${e}'s`,someone:"Someone",changed:(e,t,a)=>`Changed by ${e}, ${t}.${a===null?"":` Was ${a}.`}`,history:"Cell history",sync:e=>e.offline?e.saving===0?"Offline.":`Offline. ${sh(e.saving)} will sync when you reconnect.`:e.failed!==void 0&&e.failed>0?"Could not save.":e.refused!==void 0&&e.refused>0?`${sh(e.refused)} not saved`:e.saving>0?`Saving ${sh(e.saving)}`:"Saved",retry:"Retry",dismiss:"Dismiss",notSaved:e=>`Not saved: ${e}`,rowActions:e=>`Row actions for row ${e}`,deleteRow:"Delete row",rowActionsHelp:"Shift and F10 opens the actions of the row.",filter:"Filter options",noOptions:"No matching options",clear:"Clear",keyboardHelp:"Arrow keys move between cells. Enter or F2 edits a cell, Escape cancels, and typing replaces its value. Space toggles a checkbox. Control or Command with C and V copies and pastes. Control or Command with Alt and H opens the history of a cell.",sortBy:e=>`Sort by ${e}`};function go(e){return{...Gn,...e,types:{...Gn.types,...e?.types}}}var Y3={violet:"purple",indigo:"purple",teal:"cyan",sky:"cyan",emerald:"green",lime:"green",yellow:"amber",orange:"amber",red:"rose",pink:"rose"};function zc(e){if(e===void 0)return"neutral";let t=e.trim().toLowerCase();return ho(t)?t:Y3[t]??"neutral"}var j3=["neutral","info","success","warning","danger"],K3={green:"success",amber:"warning",rose:"danger",blue:"info",cyan:"info",purple:"neutral"},X3={todo:"neutral",in_progress:"info",done:"success",blocked:"danger"};function Oc(e){let t=e.color?.trim().toLowerCase();if(t!==void 0&&j3.includes(t))return t;if(t!==void 0){let a=zc(t);if(a!=="neutral")return K3[a]}return e.category?X3[e.category]:"neutral"}function vl(e,t){return e.options?.find(a=>a.id===t)}function Vi(e){return(e.options??[]).filter(t=>!t.archived)}function dh(e){let t=new Set,a=[];for(let l of e.split(",")){let[n="",i]=l.split(":"),r=n.trim();if(r==="")continue;let o=r.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"");for(o===""&&(o=`option_${a.length+1}`);t.has(o);)o=`${o}_`;t.add(o);let s=i?.trim();a.push(s?{id:o,label:r,color:s}:{id:o,label:r})}return a}var vy=1e3,yy=2e4,by=2048,ch=5,wy=10,xy=1900,_y=2200;function yl(e){let t=e.max??ch;return Number.isInteger(t)&&t>=1?Math.min(t,wy):ch}function en(e){return e.maxLength??(e.type==="longtext"?yy:vy)}var Q3=e=>Array.isArray(e)&&e.every(t=>typeof t=="string");function Ct(e,t){if(t==null)return e.type==="checkbox"?!1:e.type==="multiselect"?[]:null;switch(e.type){case"checkbox":return t===!0;case"number":{let a=typeof t=="number"?t:typeof t=="string"&&t.trim()!==""?Number(t):Number.NaN;return Number.isFinite(a)?a:null}case"rating":return typeof t=="number"&&Number.isInteger(t)&&t>=1?t:null;case"multiselect":return Q3(t)?t:[];case"text":case"longtext":case"url":case"date":return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null;case"select":case"status":case"person":return typeof t=="string"?t:null}}function bl(e){return e===null||e===""||Array.isArray(e)&&e.length===0}function Yi(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((a,l)=>a===t[l]):e===t}function ji(e,t){return e?.find(a=>a.id===t)}function Z3(e,t){let a=e.precision,l=a===void 0?{maximumFractionDigits:10}:{minimumFractionDigits:a,maximumFractionDigits:a};return e.numberStyle==="percent"?new Intl.NumberFormat(t,{style:"percent",...l}):e.numberStyle==="currency"&&e.currency?new Intl.NumberFormat(t,{style:"currency",currency:e.currency,...l}):new Intl.NumberFormat(t,l)}var I3=/^(\d{4})-(\d{2})-(\d{2})$/;function Ty(e){let t=I3.exec(e);if(!t)return null;let a=Number(t[1]),l=Number(t[2]),n=Number(t[3]),i=new Date(Date.UTC(a,l-1,n));return i.getUTCFullYear()!==a||i.getUTCMonth()!==l-1||i.getUTCDate()!==n||a<xy||a>_y?null:{year:a,month:l,day:n}}function Ma(e,t,a){let{labels:l,locale:n}=a;if(e.type==="checkbox")return t===!0?l.checked:l.unchecked;if(bl(t))return"";switch(e.type){case"number":return typeof t=="number"?Z3(e,n).format(t):"";case"rating":return typeof t=="number"?l.rating(t,yl(e)):"";case"select":case"status":{let i=vl(e,String(t));return i?i.archived?l.archived(i.label):i.label:String(t)}case"multiselect":return t.map(i=>{let r=vl(e,i);return r?r.archived?l.archived(r.label):r.label:i}).join(", ");case"person":return ji(a.people,String(t))?.name??l.unknownPerson;case"date":{let i=String(t);if(Ty(i))return new Intl.DateTimeFormat(n,{dateStyle:"medium",timeZone:"UTC"}).format(new Date(`${i}T00:00:00Z`));let r=Date.parse(i);return Number.isNaN(r)?i:new Intl.DateTimeFormat(n,{dateStyle:"medium",timeStyle:"short"}).format(r)}default:return String(t)}}function Ki(e,t,a){if(e.type==="checkbox")return t===!0?"TRUE":"FALSE";if(bl(t))return"";switch(e.type){case"number":return typeof t!="number"?"":e.numberStyle==="percent"?`${uh(t*100,10)}%`:String(t);case"select":case"status":return vl(e,String(t))?.label??String(t);case"multiselect":return t.map(l=>vl(e,l)?.label??l).join(", ");case"person":return ji(a.people,String(t))?.name??String(t);default:return String(t)}}function uh(e,t){let a=10**t;return Math.round(e*a)/a}var Fe=e=>({ok:!1,error:e});function py(e,t){let a=t.trim().toLowerCase(),l=Vi(e),n=l.find(i=>i.id===t.trim())??l.find(i=>i.label.toLowerCase()===a);return n?n.id:null}function J3(e,t){let a=t.trim().toLowerCase();if(!e||a==="")return null;let l=e.find(i=>i.id===t.trim()||i.name.toLowerCase()===a);if(l)return l.id;let n=e.filter(i=>i.name.toLowerCase().startsWith(a));return n.length===1?n[0].id:null}var $3=new Set(["true","yes","y","1","x","checked","on","\u2713","\u2714"]),F3=new Set(["false","no","n","0","","unchecked","off"]);function W3(e,t,a){let l=t.trim().replace(/\s+/g,""),n=l.endsWith("%");if(n&&(l=l.slice(0,-1)),l=l.replace(/^[$€£¥]|[$€£¥]$/g,""),/^-?\d{1,3}(,\d{3})+(\.\d+)?$/.test(l)&&(l=l.replaceAll(",","")),!/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(l))return Fe(a.notANumber(e.label));let i=Number(l);if((n||e.numberStyle==="percent")&&(i/=100),!Number.isFinite(i))return Fe(a.notANumber(e.label));e.precision!==void 0&&(i=uh(i,e.precision));let r=o=>e.numberStyle==="percent"?`${uh(o*100,10)}%`:String(o);return e.min!==void 0&&i<e.min?Fe(a.belowMin(e.label,r(e.min))):e.max!==void 0&&i>e.max?Fe(a.aboveMax(e.label,r(e.max))):{ok:!0,value:i}}function P3(e,t,a){let l=t.trim();if(!e.time)return Ty(l.slice(0,10))&&(l.length===10||l[10]==="T"||l[10]===" ")?{ok:!0,value:l.slice(0,10)}:Fe(a.notADate(e.label));let n=Date.parse(l);if(Number.isNaN(n))return Fe(a.notADate(e.label));let i=new Date(n).getUTCFullYear();return i<xy||i>_y?Fe(a.notADate(e.label)):{ok:!0,value:new Date(n).toISOString().replace(/\.000Z$/,"Z")}}function e5(e,t,a){let l=t.trim();!/^[a-z][a-z0-9+.-]*:/i.test(l)&&/^[^\s/]+\.[^\s/]+/.test(l)&&(l=`https://${l}`);let n;try{n=new URL(l)}catch{return Fe(a.notAUrl(e.label))}return n.protocol!=="https:"&&n.protocol!=="http:"||l.length>by||n.host===""?Fe(a.notAUrl(e.label)):{ok:!0,value:l}}function Xi(e,t,a){let{labels:l}=a;if(t.trim()===""&&e.type!=="checkbox")return e.required?Fe(l.required(e.label)):{ok:!0,value:e.type==="multiselect"?[]:null};switch(e.type){case"checkbox":{let i=t.trim().toLowerCase();return $3.has(i)?{ok:!0,value:!0}:F3.has(i)?{ok:!0,value:!1}:Fe(l.notABoolean(e.label))}case"number":return W3(e,t,l);case"rating":{let i=yl(e),r=t.trim(),o=/^★+$/.test(r)?r.length:Number(r);return o===0?e.required?Fe(l.required(e.label)):{ok:!0,value:null}:!Number.isInteger(o)||o<1||o>i?Fe(l.notARating(e.label,i)):{ok:!0,value:o}}case"text":{let i=t.replace(/\s*[\r\n]+\s*/g," ");return i.length>en(e)?Fe(l.tooLong(e.label,en(e))):{ok:!0,value:i}}case"longtext":return t.length>en(e)?Fe(l.tooLong(e.label,en(e))):{ok:!0,value:t};case"select":case"status":{let i=py(e,t);return i===null?Fe(l.notAnOption(e.label)):{ok:!0,value:i}}case"multiselect":{let i=[];for(let r of t.split(/[,;\n]/)){if(r.trim()==="")continue;let o=py(e,r);if(o===null)return Fe(l.notAnOption(e.label));i.includes(o)||i.push(o)}return e.maxItems!==void 0&&i.length>e.maxItems?Fe(l.tooManyItems(e.label,e.maxItems)):{ok:!0,value:i}}case"person":{let i=J3(a.people,t);return i===null?Fe(l.notAPerson(e.label)):{ok:!0,value:i}}case"date":return P3(e,t,l);case"url":return e5(e,t,l)}}function fh(e,t,a){let{labels:l}=a;if(e.required&&e.type!=="checkbox"&&bl(t))return l.required(e.label);if(bl(t))return null;switch(e.type){case"checkbox":return typeof t=="boolean"?null:l.notABoolean(e.label);case"select":case"status":return typeof t=="string"&&Vi(e).some(n=>n.id===t)?null:l.notAnOption(e.label);case"multiselect":{if(!Array.isArray(t))return l.notAnOption(e.label);let n=new Set(Vi(e).map(i=>i.id));return t.every(i=>n.has(i)||vl(e,i)?.archived)?e.maxItems!==void 0&&t.length>e.maxItems?l.tooManyItems(e.label,e.maxItems):null:l.notAnOption(e.label)}case"person":return typeof t=="string"&&ji(a.people,t)?null:l.notAPerson(e.label);case"rating":return typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=yl(e)?null:l.notARating(e.label,yl(e));default:{let n=Xi(e,Ki(e,t,a),a);return n.ok?null:n.error}}}function Sy(e,t,a,l){let n=e.type!=="checkbox"&&bl(t),i=e.type!=="checkbox"&&bl(a);if(n||i)return n===i?0:n?1:-1;switch(e.type){case"number":case"rating":return t-a;case"checkbox":return+(t===!0)-+(a===!0);case"select":case"status":{let r=o=>(e.options??[]).findIndex(s=>s.id===o);return r(t)-r(a)}default:return Ma(e,t,l).localeCompare(Ma(e,a,l),l.locale,{numeric:!0})}}var kn=e=>!!(e.ctrlKey||e.metaKey),my=(e,t,a)=>Math.min(Math.max(e,t),a);function hh(e,t,a){let l=a.rows-1,n=a.cols-1;if(a.cols===0)return null;let i=kn(t);switch(t.key){case"ArrowUp":return{row:i?e.row<0?-1:0:Math.max(e.row-1,-1),col:e.col};case"ArrowDown":return l<0?e:{row:i?l:my(e.row+1,-1,l),col:e.col};case"ArrowLeft":return{row:e.row,col:i?0:Math.max(e.col-1,0)};case"ArrowRight":return{row:e.row,col:i?n:Math.min(e.col+1,n)};case"Home":return i?{row:l<0?-1:0,col:0}:{row:e.row,col:0};case"End":return i?{row:Math.max(l,-1),col:n}:{row:e.row,col:n};case"PageUp":return{row:e.row<0?-1:Math.max(e.row-a.page,0),col:e.col};case"PageDown":return l<0?e:{row:my(e.row+a.page,0,l),col:e.col};default:return null}}function ph(e,t){let a=Math.max(e.row,0),l=Math.max(t.row,0);return{top:Math.min(a,l),bottom:Math.max(a,l),left:Math.min(e.col,t.col),right:Math.max(e.col,t.col)}}var mh=(e,t,a)=>t>=e.top&&t<=e.bottom&&a>=e.left&&a<=e.right;function gh(e,t,a,l,n=8){if(l===0)return[0,-1];let i=t>0?t:a*40,r=Math.max(0,Math.floor(e/a)-n),o=Math.min(l-1,Math.ceil((e+i)/a)+n);return[r,o]}function vh(e,t,a,l,n){let i=e*l,r=i+l,o=t,s=t+Math.max(a-n,l);return i<o?i:r>s?r-Math.max(a-n,l):t}function yh(e,t,a,l,n){let i=l-t,r=e-a;return i>=n||i>=r?"below":"above"}var Ey={text:200,longtext:260,number:112,checkbox:104,select:144,multiselect:208,status:144,person:176,date:136,url:208,rating:128},Qi=52,Cc=32,tn=e=>e.width!==void 0&&e.width>0?e.width:Ey[e.type];function bh(e){let t=[],a=Qi;for(let l of e)t.push(a),a+=tn(l);return t}function wh(e){return[...e.filter(t=>t.frozen),...e.filter(t=>!t.frozen)]}var xh=e=>e.key.length===1&&!kn(e)&&!e.altKey;function t5(e){return/[\t\n\r"]/.test(e)?`"${e.replaceAll('"','""')}"`:e}function _h(e,t,a,l){let n=[];for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(!r)continue;let o=[];for(let s=a.left;s<=a.right;s+=1){let c=e[s];c&&o.push(t5(Ki(c,Ct(c,r.values[c.field]),l)))}n.push(o.join(" "))}return n.join(`
10
10
  `)}function Th(e){let t=[],a=[],l="",n=!1,i=0,r=e.replace(/\r\n?/g,`
11
11
  `);for(;i<r.length;){let o=r[i];if(n){if(o==='"'&&r[i+1]==='"'){l+='"',i+=2;continue}if(o==='"'){n=!1,i+=1;continue}l+=o,i+=1;continue}o==='"'&&l===""?n=!0:o===" "?(a.push(l),l=""):o===`
12
- `?(a.push(l),t.push(a),a=[],l=""):l+=o,i+=1}return(l!==""||a.length>0)&&(a.push(l),t.push(a)),t}function Sh(e,t,a,l,n){let i={edits:[],refused:[]};if(l.length===0)return i;let r=l.length===1&&l[0].length===1,o=r?a.bottom-a.top+1:l.length,s=r?a.right-a.left+1:Math.max(...l.map(c=>c.length));for(let c=0;c<o;c+=1){let d=t[a.top+c];if(!d)break;for(let g=0;g<s;g+=1){let u=e[a.left+g];if(!u)break;if(u.readOnly)continue;let m=r?l[0][0]:l[c]?.[g];if(m===void 0)continue;let b=Xi(u,m,n);if(!b.ok){i.refused.push({rowId:d.id,field:u.field,error:b.error});continue}Yi(b.value,Ct(u,d.values[u.field]))||i.edits.push({rowId:d.id,field:u.field,value:b.value})}}return i}function Eh(e,t,a,l){let n={edits:[],refused:[]};for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(r)for(let o=a.left;o<=a.right;o+=1){let s=e[o];if(!s||s.readOnly)continue;let c=s.type==="checkbox"?!1:s.type==="multiselect"?[]:null;if(!Yi(Ct(s,r.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){n.refused.push({rowId:r.id,field:s.field,error:l.labels.required(s.label)});continue}n.edits.push({rowId:r.id,field:s.field,value:c})}}}return n}function vo(e,t,a){if(e==="forbidden"||e==="capability_not_declared")return a.forbidden;let l=t?.trim();return l||a.couldNotSave}var Ac=(e,t)=>`${e}\0${t}`,Mh=class{constructor(){el(this,"waiting",new Map);el(this,"refusals",new Map);el(this,"listeners",new Set);el(this,"failed",0)}begin(e,t){let a=Ac(e,t);this.refusals.delete(a),this.waiting.set(a,(this.waiting.get(a)??0)+1),this.emit();let l=!1;return n=>{if(l)return;l=!0;let i=(this.waiting.get(a)??1)-1;i<=0?this.waiting.delete(a):this.waiting.set(a,i),n.ok||(this.refusals.set(a,n.message),this.failed+=1),this.emit()}}isPending(e,t){return this.waiting.has(Ac(e,t))}refusal(e,t){return this.refusals.get(Ac(e,t))}dismiss(e,t){this.refusals.delete(Ac(e,t))&&this.emit()}get saving(){let e=0;for(let t of this.waiting.values())e+=t;return e}dismissAll(){this.refusals.size!==0&&(this.refusals.clear(),this.emit())}sync(e=!1){return{saving:this.saving,offline:e,refused:this.refusals.size}}get failures(){return this.failed}resetFailures(){this.failed=0}decorate(e){return this.waiting.size===0&&this.refusals.size===0?[...e]:e.map(t=>{let a=[],l={};for(let n of this.waiting.keys()){let[i,r]=n.split("\0");i===t.id&&a.push(r)}for(let[n,i]of this.refusals){let[r,o]=n.split("\0");r===t.id&&(l[o]=i)}return a.length===0&&Object.keys(l).length===0?t:{...t,pending:[...t.pending??[],...a],refused:{...t.refused,...l}}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}};function My(e,t){let a=e instanceof Date?e:new Date(e);return Number.isNaN(a.getTime())?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(a)}function Rc(e,t,a,l){return t.changed(e.by,My(e.at,l),a)}var Dc=e=>e.previous!==void 0;function Ah(e,t,a,l){if(!a)return[...t];let n=e.find(r=>r.field===a.field);if(!n)return[...t];let i=a.direction==="descending"?-1:1;return t.map((r,o)=>({row:r,index:o,value:Ct(n,r.values[n.field])})).sort((r,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return n.type!=="checkbox"&&(s(r.value)||s(o.value))?s(r.value)===s(o.value)?r.index-o.index:s(r.value)?1:-1:i*Sy(n,r.value,o.value,l)||r.index-o.index}).map(({row:r})=>r)}function Hc(e,t){return!e||e.field!==t?{field:t,direction:"ascending"}:e.direction==="ascending"?{field:t,direction:"descending"}:null}var ga=(e,t)=>`${e}\0${t}`;function Nh(e){let t=new Map;for(let a of e??[]){let l=ga(a.rowId,a.field),n=t.get(l);n?n.push(a):t.set(l,[a])}for(let a of t.values())a.sort((l,n)=>+!!n.editing-+!!l.editing);return t}function zh(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function Oh(e,t=2){let a=new Map;for(let l of e??[]){let n=a.get(l.field)??[];n.length<t&&!n.some(i=>i.id===l.id)&&n.push(l),a.set(l.field,n)}return a}function Ch(e){return e.map(t=>t.name).join(", ")}function Rh(e,t,a,l,n=po){let{labels:i}=l,r=[`${e.label}.`];e.readOnly&&r.push(i.readOnly(e.label)),t.pending?.includes(e.field)&&r.push(`${i.saving}.`);let o=t.refused?.[e.field];o&&r.push(o);let s=a.map(d=>d.name);s.length>0&&r.push(n.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=Dc(c)&&Ma(e,Ct(e,c.previous),l)||null;r.push(Rc(c,i,d,l.locale))}return r.join(" ")}function Gc(e,t,a,l){let n=e.find(i=>i.type==="text");if(n){let i=Ma(n,Ct(n,t.values[n.field]),l);if(i)return i}return String(a+1)}var Dh=Q(wt(),1),Oy=Q(be(),1),i5=(0,Dh.createContext)(2);function Cy({level:e,children:t}){return(0,Oy.jsx)(i5.Provider,{value:e,children:t})}function k(...e){return e.filter(Boolean).join(" ")}var r5=["todo","in_progress","done","blocked"];function o5(e){if(e.options)return e.options.map(t=>{let a={id:t.id,label:t.label};return t.color&&(a.color=t.color),t.category&&r5.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function Ry(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let l=a.type,n=Nc(l),i={field:a.key,label:a.label||a.key,type:n?l:"text"};n||(i.readOnly=!0),a.primary&&(i.frozen=!0),a.required&&(i.required=!0),a.min!==void 0&&(i.min=a.min),a.max!==void 0&&(i.max=a.max),a.max_length!==void 0&&(i.maxLength=a.max_length),a.max_items!==void 0&&(i.maxItems=a.max_items);let r=o5(a);r&&(i.options=r),t.push(i)}return t}function s5(e,t){let a=t.trim();if(a===""||a==="plain")return;let l=/^currency:([A-Za-z]{3})$/.exec(a);if(l){e.numberStyle="currency",e.currency=l[1].toUpperCase();return}if(a==="percent"){e.numberStyle="percent";return}let n=/^0(?:\.(0+))?(%)?$/.exec(a);n&&(e.precision=n[1]?.length??0,n[2]&&(e.numberStyle="percent"))}var yo=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},Dy=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function Hy(e){let t=e("field")?.trim();if(!t)return null;let a=e("type")?.trim()??"text",l=Nc(a),n={field:t,label:e("label")?.trim()||t,type:l?a:"text"};(!l||e("readonly")!==null)&&(n.readOnly=!0),e("required")!==null&&(n.required=!0),e("frozen")!==null&&(n.frozen=!0),e("time")!==null&&(n.time=!0);let i=yo(e("width"));i!==void 0&&(n.width=i);let r=yo(e("min"));r!==void 0&&(n.min=r);let o=yo(e("max"));o!==void 0&&(n.max=o);let s=yo(e("max-length"));s!==void 0&&(n.maxLength=s);let c=yo(e("max-items"));c!==void 0&&(n.maxItems=c);let d=e("options");d&&(n.options=dh(d));let g=e("format");return g&&n.type==="number"&&s5(n,g),n}function Gy(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function ky(e,t){return t===void 0?[...e]:e.map((a,l)=>l<t?{...a,frozen:!0}:a)}var Ly=e=>e!==void 0&&ho(e)?e:void 0;function Uy(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=Ly(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function By(e,t){return e.filter(a=>a.seat!==t)}function qy(e,t){return oh(e.map(a=>({id:a.session,kind:a.kind,hue:Ly(a.avatar?.hue)})),t)}function Vy(e,t,a,l){let n=[];for(let i of By(e,a)){let r=i.focus;r.collection!==t||!r.doc||!r.field||n.push({rowId:r.doc,field:r.field,id:i.session,name:i.displayName,kind:i.kind,hue:l.get(i.session)??"purple",editing:i.activity==="editing",idle:i.activity==="idle"})}return n}function Yy(e,t,a){return By(e,t).map(l=>{let n={id:l.session,seat:l.seat,name:l.displayName,kind:l.kind,activity:l.activity},i=a.get(l.session);return i&&(n.hue=i),l.avatar?.character&&(n.character=l.avatar.character),n})}var $=Q(wt(),1);var Ky=Q(be(),1),jy={xs:12,sm:14,md:16,lg:20,xl:24},Xy=1.75,c5=`var(--crewlet-glyph-stroke, ${Xy})`;function u5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in jy?`${jy[e]}px`:e}function ot({size:e,title:t,filled:a=!1,fillable:l,className:n,style:i,children:r,...o}){let s=u5(e);return(0,Ky.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,stroke:"currentColor",...t?{role:"img","aria-label":t}:{"aria-hidden":!0,focusable:!1},className:n===void 0?"crewlet-glyph":`crewlet-glyph ${n}`,...o,viewBox:"0 0 24 24",fill:l&&a?"currentColor":"none",strokeWidth:Xy,strokeLinecap:"round",strokeLinejoin:"round",style:{...i,strokeWidth:c5},children:r})}var U=Q(be(),1);function Hh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function Gh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function Zi(e){return(0,U.jsx)(ot,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function kh(e){return(0,U.jsx)(ot,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function Ii(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,U.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}function Lh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"m16 9-5.5 5.5L8 12"})]})}function Uh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"5",cy:"12",r:"1"})]})}function Bh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"5",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"19",r:"1"})]})}function qh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M15 3h6v6"}),(0,U.jsx)("path",{d:"M10 14 21 3"}),(0,U.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Lc(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"M12 16v-4"}),(0,U.jsx)("path",{d:"M12 8h.01"})]})}function Vh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("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"}),(0,U.jsx)("path",{d:"m15 5 4 4"})]})}function Yh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function jh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,U.jsx)("path",{d:"M3 3v5h5"}),(0,U.jsx)("path",{d:"M12 7v5l4 2"})]})}function Kh(e){return(0,U.jsx)(ot,{...e,fillable:!0,children:(0,U.jsx)("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"})})}function Xh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M10 11v6"}),(0,U.jsx)("path",{d:"M14 11v6"}),(0,U.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,U.jsx)("path",{d:"M3 6h18"}),(0,U.jsx)("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}function Qh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("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"}),(0,U.jsx)("path",{d:"M12 9v4"}),(0,U.jsx)("path",{d:"M12 17h.01"})]})}function bo(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var va=Q(be(),1),d5={neutral:(0,va.jsx)(Lc,{size:"md"}),info:(0,va.jsx)(Lc,{size:"md"}),success:(0,va.jsx)(Lh,{size:"md"}),warning:(0,va.jsx)(Qh,{size:"md"}),danger:(0,va.jsx)(Ii,{size:"md"})},Ji=({variant:e="info",title:t,icon:a,layout:l="card",action:n,live:i,className:r,children:o,...s})=>(0,va.jsxs)("div",{...s,"aria-live":i,className:k("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${l}`,r),children:[(0,va.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??d5[e]}),(0,va.jsxs)("div",{className:"crewlet-callout__content",children:[t?(0,va.jsx)("span",{className:"crewlet-callout__title",children:t}):null,o]}),n?(0,va.jsx)("div",{className:"crewlet-callout__action",children:n}):null]});var Qy=Q(be(),1);function Tt({as:e="span",id:t,className:a,children:l}){return(0,Qy.jsx)(e,{id:t,className:k("crewlet-visually-hidden",a),children:l})}var Aa=Q(wt(),1);var st=Q(be(),1);function Zy({variant:e="primary",size:t="medium",shape:a="square",block:l,className:n},i){return k("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,l&&"crewlet-btn--block",i,n)}function Zh({leadingIcon:e,trailingIcon:t,loading:a,children:l}){return(0,st.jsxs)(st.Fragment,{children:[a?(0,st.jsx)("span",{className:"crewlet-btn__spinner","aria-hidden":!0}):e?(0,st.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,st.jsx)("span",{className:"crewlet-btn__label",children:l}),t?(0,st.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var Na=(0,Aa.forwardRef)(function({variant:t="primary",size:a="medium",shape:l="square",leadingIcon:n,trailingIcon:i,block:r,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:g,disabledReason:u,disabled:m,onClick:b,title:w,children:S,...f},h){let p=(0,Aa.useId)(),T=Zy({variant:t,size:a,shape:l,block:r,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Aa.Children.only(S);if(!(0,Aa.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let A=N;return(0,Aa.cloneElement)(A,{...f,title:w,className:k(A.props.className,T)},(0,st.jsx)(Zh,{leadingIcon:n,trailingIcon:i,children:A.props.children}))}let R=d||u!==void 0;return(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)("button",{...f,ref:h,type:s,className:T,disabled:m,title:w,"aria-label":f["aria-label"]??(S===void 0?w:void 0),"aria-pressed":g,"aria-busy":d||void 0,"aria-disabled":R||void 0,"aria-describedby":u===void 0?f["aria-describedby"]:k(f["aria-describedby"],p),onClick:N=>{if(R){N.preventDefault();return}b?.(N)},children:(0,st.jsx)(Zh,{leadingIcon:n,trailingIcon:i,loading:d,children:S})}),u===void 0?null:(0,st.jsx)(Tt,{id:p,children:u})]})}),eT=(0,Aa.forwardRef)(function({variant:t="primary",size:a="medium",shape:l="square",leadingIcon:n,trailingIcon:i,block:r,className:o,external:s=!1,title:c,children:d,...g},u){let m=i??(s?(0,st.jsx)(qh,{size:"sm"}):void 0);return(0,st.jsx)("a",{...g,ref:u,className:Zy({variant:t,size:a,shape:l,block:r,className:o}),title:c,"aria-label":g["aria-label"]??(d===void 0?c:void 0),target:s?"_blank":g.target,rel:s?"noreferrer":g.rel,children:(0,st.jsx)(Zh,{leadingIcon:n,trailingIcon:m,children:d})})});var wo=Q(wt(),1),Iy=Q(be(),1),$i="crewlet:viewchange",ea=4;function Uc(e,t,a,l=ea,n="below"){let i=e.y+e.height+l,r=e.y-l-t.height,o=a.y+a.height-i,s=e.y-l-a.y,d=(n==="below"?o>=t.height||o>=s:s>=t.height||s>=o)?n:n==="below"?"above":"below",g=d==="below"?i:r,u=a.y+a.height-t.height,m=Math.max(a.y,Math.min(g,u)),b=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,b)),top:m,side:d}}function Bc(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function qc(e,t){return e.x+e.width<t.x||e.y+e.height<t.y||e.x>t.x+t.width||e.y>t.y+t.height}var f5=(0,wo.createContext)(null);function Fi(){let e=(0,wo.useContext)(f5);return e||(typeof document>"u"?null:document.body)}var Ae=Q(wt(),1);var Ih={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms"},easing:{default:"ease",out:"ease-out",inOut:"ease-in-out",emphasized:"cubic-bezier(0.16, 1, 0.3, 1)",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)"}};var Jh={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Jy=Symbol.for("crewlet.layer-stack");function h5(){let e=globalThis,t=e[Jy];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Jy]=a,a}var ge=h5();function $y(){ge.version+=1;for(let e of[...ge.listeners])e()}function p5(e){return ge.listeners.add(e),()=>ge.listeners.delete(e)}function Wi(e){let t;for(let a of ge.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var $h={base:Number(Jh.layerBase),max:Number(Jh.layerMax)};function m5(e){let t=0;for(let a of ge.entries)a.order<e&&(t+=1);return t}function g5(e){return e===0?$h.base:Math.min($h.base+m5(e),$h.max)}var v5=229;function Pi(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===v5}function xo(e){let t=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[contenteditable='true']","[tabindex]"].join(",");return[...e.querySelectorAll(t)].filter(a=>a.tabIndex>=0&&!a.disabled&&!a.closest("[hidden],[inert]")&&(typeof a.checkVisibility!="function"||a.checkVisibility()))}function Fy(e){if(Pi(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=Wi();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=Wi("modal"),a=t?.panel();if(!t||!a)return;let l=Wi("popup"),n=document.activeElement;if(l&&l.order>t.order&&n&&l.panel()?.contains(n))return;let i=xo(a);if(i.length===0){e.preventDefault(),a.focus();return}let r=i[0],o=i[i.length-1];if(!(n instanceof Node)||!a.contains(n)){e.preventDefault(),(e.shiftKey?o:r).focus();return}let s=c=>(n.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!i.some(c=>c!==n&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!i.some(c=>c!==n&&s(c))&&(e.preventDefault(),r.focus())}function Wy(e){ge.armed=null;let t=Wi();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(ge.armed=t);return}[t.panel(),...t.inside()].some(n=>n?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Py(e){let t=ge.armed;ge.armed=null,!(!t||t!==Wi()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function e2(e){return ge.entries.length===0&&(document.addEventListener("keydown",Fy),document.addEventListener("pointerdown",Wy,!0),document.addEventListener("click",Py,!0)),ge.entries.push(e),$y(),()=>{let t=ge.entries.indexOf(e);t>=0&&ge.entries.splice(t,1),ge.armed===e&&(ge.armed=null),ge.entries.length===0&&(document.removeEventListener("keydown",Fy),document.removeEventListener("pointerdown",Wy,!0),document.removeEventListener("click",Py,!0)),$y()}}function t2(e){let t=(0,Ae.useRef)(0);return e&&t.current===0&&(t.current=++ge.opened),e||(t.current=0),t.current}function y5(e){if(!e)return[];let t;for(let l of ge.entries)l.kind!=="modal"||!l.panel()?.contains(e)||(!t||l.order>t.order)&&(t=l);let a=t?.panel();return t&&a?[e,a,...t.returnTo]:[e]}function a2(e){return(0,Ae.useSyncExternalStore)(p5,()=>ge.version,()=>0),{zIndex:g5(e),isTopmost:e!==0&&Wi()?.order===e}}function l2({onClose:e,dismissable:t=!0,initialFocus:a}){let l=(0,Ae.useRef)(null),n=(0,Ae.useRef)(null),i=(0,Ae.useRef)(e),r=(0,Ae.useRef)(t),o=(0,Ae.useRef)(a);i.current=e,r.current=t,o.current=a;let s=t2(!0),[c]=(0,Ae.useState)(()=>typeof document>"u"?[]:y5(document.activeElement)),d=a2(s);(0,Ae.useLayoutEffect)(()=>e2({kind:"modal",order:s,panel:()=>l.current,returnTo:c,veil:()=>n.current,inside:()=>[],dismiss:()=>i.current(),dismissable:()=>r.current}),[s,c]),(0,Ae.useEffect)(()=>{let m=l.current;return m&&!m.contains(document.activeElement)&&(o.current?.()??xo(m)[0]??m).focus(),()=>{let b=document.activeElement;if(!(b&&ge.entries.some(w=>w.panel()?.contains(b)))){for(let w of c)if(!(!(w instanceof HTMLElement)||!w.isConnected||w===document.body)&&(w.focus(),document.activeElement===w))return}}},[c]);let g=(0,Ae.useCallback)(m=>{l.current=m},[]),u=(0,Ae.useCallback)(m=>{n.current=m},[]);return{panelRef:g,veilRef:u,...d}}function Vc({open:e,onDismiss:t}){let a=(0,Ae.useRef)(null),l=(0,Ae.useRef)(null),n=(0,Ae.useRef)(t);n.current=t;let i=t2(e),r=a2(i);(0,Ae.useLayoutEffect)(()=>{if(e)return e2({kind:"popup",order:i,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[l.current],dismiss:c=>n.current(c),dismissable:()=>!0})},[e,i]);let o=(0,Ae.useCallback)(c=>{a.current=c},[]),s=(0,Ae.useCallback)(c=>{l.current=c},[]);return{panelRef:o,insideRef:s,...r}}function n2(e){(0,Ae.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return ge.locks===0&&(ge.restore=document.body.style.overflow,document.body.style.overflow="hidden"),ge.locks+=1,()=>{ge.locks-=1,ge.locks===0&&(document.body.style.overflow=ge.restore??"",ge.restore=null)}},[e])}var Ia=Q(wt(),1),Ln=Q(be(),1),_o=(0,Ia.forwardRef)(function({label:t,icon:a,size:l="md",variant:n="ghost",pressed:i,disabledReason:r,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:g,title:u,children:m,...b},w){let S=(0,Ia.useId)(),f=k("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${n}`,o),h=a??m;if(c){let y=Ia.Children.only(m);if(!(0,Ia.isValidElement)(y))throw new Error("IconButton with asChild expects exactly one valid React element child.");let T=y;return(0,Ia.cloneElement)(T,{...b,"aria-label":t,title:u??t,className:k(T.props.className,f)})}let p=r!==void 0;return(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)("button",{...b,ref:w,type:s,className:f,disabled:d,title:u??t,"aria-label":t,"aria-pressed":i,"aria-disabled":p||void 0,"aria-describedby":p?k(b["aria-describedby"],S):b["aria-describedby"],onClick:y=>{if(p){y.preventDefault();return}g?.(y)},children:h}),p?(0,Ln.jsx)(Tt,{id:S,children:r}):null]})});var za=Q(wt(),1),r2=Q(hr(),1);var oe=Q(be(),1);function o2({open:e,...t}){let a=Fi();return e&&a?(0,oe.jsx)(w5,{container:a,...t},b5(a)):null}var i2=new WeakMap,Fh=0;function b5(e){let t=i2.get(e);return t!==void 0?t:(Fh+=1,i2.set(e,Fh),Fh)}function vt(e){return e!=null&&e!==!1&&e!==""}function w5({container:e,onClose:t,title:a,subtitle:l,icon:n,footer:i,footerStart:r,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:g="sm",variant:u="dialog",shape:m="framed",placement:b,role:w="dialog",dismissable:S=!0,closeOnBackdrop:f=!0,backdrop:h="veil",showCloseButton:p=!0,stackBody:y=!1,flush:T=!1,className:R,ariaLabel:N,describedBy:A,initialFocus:X,onSubmit:C,closeLabel:G="Close",closeDisabledReason:Be="Closing is unavailable until this finishes.",...H}){let D=(0,za.useId)(),q=`${D}-title`,ae=`${D}-subtitle`,O=m==="prompt"&&u==="dialog",F=!O,I=u==="sheet",qe=b??(O?"center":"top"),St=(0,za.useRef)(null),We=(0,za.useRef)(null),we=(0,za.useRef)(null),Ee=(0,za.useRef)(X);Ee.current=X;let ba=(0,za.useCallback)(()=>{let ke=Ee.current?.();if(ke)return ke;let et=We.current?xo(We.current)[0]:void 0;return et||((we.current?xo(we.current)[0]:void 0)??St.current)},[]),je=l2({onClose:t,dismissable:S,initialFocus:ba});n2(!0);let M=vt(a)?q:void 0,Me=A??(vt(l)?ae:void 0),Yt={...H,ref:ke=>{St.current=ke,je.panelRef(ke)},className:k("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${g}`:void 0,O?"crewlet-modal--prompt":void 0,R),role:w,"aria-modal":!0,"aria-labelledby":M,"aria-label":M===void 0?N:void 0,"aria-describedby":Me,tabIndex:-1},Ke=F&&p,Pe=(0,oe.jsxs)(oe.Fragment,{children:[F&&(vt(a)||vt(l)||vt(o)||Ke||s)?(0,oe.jsxs)("div",{className:k("crewlet-modal__header",I?"crewlet-modal__header--sheet":void 0),children:[s?(0,oe.jsx)(_o,{className:"crewlet-modal__back",label:c,icon:(0,oe.jsx)(kh,{size:"md"}),onClick:s}):null,vt(n)?(0,oe.jsx)("span",{className:"crewlet-modal__icon","aria-hidden":"true",children:n}):null,(0,oe.jsxs)("div",{className:"crewlet-modal__heading",children:[vt(a)?(0,oe.jsx)("p",{className:k("crewlet-modal__title",I?"crewlet-modal__title--sheet":void 0),id:q,children:a}):null,vt(l)?(0,oe.jsx)("p",{className:"crewlet-modal__subtitle",id:ae,children:l}):null]}),vt(o)?(0,oe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,Ke?(0,oe.jsx)(_o,{className:"crewlet-modal__close",label:G,icon:(0,oe.jsx)(bo,{size:"md"}),onClick:t,disabledReason:S?void 0:Be}):null]}):null,vt(d)||O&&vt(a)?(0,oe.jsxs)("div",{ref:We,className:k("crewlet-modal__body",y?"crewlet-modal__body--stacked":void 0,T?"crewlet-modal__body--flush":void 0,I?"crewlet-modal__body--sheet":void 0),children:[O&&vt(a)?(0,oe.jsx)("p",{className:"crewlet-modal__prompt-title",id:q,children:a}):null,(0,oe.jsx)(Cy,{level:2,children:d})]}):null,vt(i)||vt(r)?(0,oe.jsxs)("div",{ref:we,className:k("crewlet-modal__footer",I?"crewlet-modal__footer--sheet":void 0),children:[vt(r)?(0,oe.jsx)("div",{className:"crewlet-modal__footer-start",children:r}):null,(0,oe.jsx)("div",{className:"crewlet-modal__footer-end",children:i})]}):null]});return(0,r2.createPortal)((0,oe.jsx)("div",{ref:f?je.veilRef:void 0,className:k("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${qe}`,h==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:je.zIndex},children:(0,oe.jsx)("div",{...Yt,children:C?(0,oe.jsx)("form",{className:"crewlet-modal__form",onSubmit:ke=>{ke.preventDefault(),C()},children:Pe}):Pe})}),e)}function Wh({open:e,onClose:t,onConfirm:a,title:l,message:n,children:i,confirmLabel:r="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:g=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:m=!1,busyReason:b="Waiting for this to finish.",shape:w="prompt",size:S="sm"}){let f=`${(0,za.useId)()}-message`,h=c??(s?"danger":"primary"),p=g||m,y=(0,za.useCallback)(()=>{p||(async()=>{try{await a()}catch{}})()},[p,a]);return(0,oe.jsxs)(o2,{open:e,onClose:t,title:l,shape:w,size:S,role:s?"alertdialog":"dialog",describedBy:vt(n)?f:void 0,dismissable:!m,closeDisabledReason:b,onSubmit:y,stackBody:!0,footer:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Na,{variant:d,onClick:t,disabledReason:m?b:void 0,children:o}),(0,oe.jsx)(Na,{type:"submit",variant:h,loading:m,disabledReason:g?u:void 0,children:r})]}),children:[vt(n)?(0,oe.jsx)("p",{className:"crewlet-modal__message",id:f,children:n}):null,i]})}var x5=Q(be(),1);function an(e){return`crewlet-presence-hue--${e}`}var Qc=Q(wt(),1);var Yc=Q(be(),1),l0={paths:["M543.42 868.92 l-34.44 -0.24 0 -58.77 0 -58.77 -28.92 0 -28.80 0 -40.20 -39.61 c-119.78 -118.25 -181.49 -179.97 -204.30 -204.30 -15.87 -16.93 -82.75 -96.74 -92.51 -110.38 l-3.76 -5.17 26.80 -18.46 c14.69 -10.11 34.09 -23.51 43.14 -29.86 55.25 -38.32 70.29 -48.43 71.12 -47.49 0.47 0.47 11.64 13.87 24.69 29.74 13.17 15.87 27.98 33.62 32.80 39.50 4.94 5.88 21.63 26.10 37.15 44.90 15.52 18.81 28.56 34.21 29.15 34.21 0.47 0.12 0.82 -30.44 0.82 -67.83 l0 -68.06 37.26 -34.56 c43.38 -40.20 61.83 -57.13 75.11 -69 l9.52 -8.46 261.78 0 261.90 0 47.14 45.73 c25.98 25.16 52.43 51.02 58.66 57.36 l11.52 11.52 0.24 67.94 0.35 67.83 31.74 -40.79 c17.51 -22.33 34.91 -45.02 38.91 -50.19 15.16 -20.34 44.32 -57.72 45.14 -58.07 0.71 -0.24 104.97 75.82 126.83 92.51 2.23 1.65 4.58 3.41 5.17 3.76 1.65 1.18 -7.99 14.22 -46.08 62.07 -35.38 44.32 -49.84 61.13 -92.39 106.97 -19.28 20.81 -38.91 41.73 -148.70 157.40 l-34.68 36.56 -26.45 0.12 c-19.04 0 -26.92 0.35 -27.98 1.41 -1.06 1.06 -1.41 15.05 -1.41 55.72 l0 54.31 -34.91 0.47 c-19.28 0.24 -53.72 0.24 -76.41 0 l-41.49 -0.47 0 -55.72 0 -55.72 -99.33 0 -99.33 0 -0.24 56.19 -0.35 56.07 -39.97 0 c-21.98 0 -55.48 -0.12 -74.29 -0.35z m94.74 -13.87 l7.17 -0.82 0 -54.89 c0 -49.02 0.24 -55.13 1.88 -55.72 1.06 -0.35 51.84 -0.71 112.85 -0.71 l110.97 0 0 55.84 0 55.84 62.89 0 62.89 0 0 -55.84 0 -55.84 31.50 0 31.50 0 14.69 -14.93 c30.80 -31.50 113.20 -118.49 144.47 -152.58 48.66 -53.01 81.34 -90.28 104.85 -119.43 22.80 -28.45 44.43 -56.42 44.43 -57.48 0 -0.59 -2 -2.47 -4.35 -4.23 -2.47 -1.76 -7.05 -5.17 -10.34 -7.64 -3.17 -2.35 -16.93 -12.34 -30.56 -22.22 -13.52 -9.87 -33.50 -24.57 -44.43 -32.68 -16.34 -12.11 -19.98 -14.34 -21.39 -13.17 -0.94 0.82 -5.88 6.82 -10.81 13.40 -4.94 6.47 -13.99 18.46 -20.10 26.57 -6.23 8.11 -26.57 34.44 -45.37 58.54 -18.81 24.10 -36.56 47.02 -39.50 50.78 -5.29 7.05 -5.29 7.05 -11.40 7.05 l-6.23 0 0 -79.58 0 -79.58 -37.85 -37.03 c-20.92 -20.45 -45.14 -44.08 -53.95 -52.66 l-15.99 -15.63 -256.84 0 -256.73 0 -47.49 44.20 c-26.21 24.33 -51.13 47.49 -55.60 51.37 l-7.88 7.05 0 79.11 0 79.23 -6.35 0 -6.35 0 -48.66 -58.54 c-26.80 -32.09 -55.95 -67.24 -64.89 -78.17 -8.93 -10.81 -16.69 -19.63 -17.16 -19.63 -0.94 0 -8.58 5.17 -34.32 22.92 -34.21 23.74 -46.08 31.86 -62.65 43.26 -10.34 7.05 -19.28 13.28 -19.87 13.87 -0.59 0.47 2.35 5.05 6.47 10.11 13.87 16.93 53.13 63.12 66.77 78.40 21.86 24.57 83.81 87.69 145.41 148.23 31.62 31.03 68.65 67.36 82.28 80.76 l24.69 24.45 33.50 0.24 33.38 0.35 0.35 59.13 0.24 59.01 53.37 0 c29.27 0 56.54 -0.35 60.54 -0.71z","M535.78 783.81 l-0.35 -59.13 -36.67 0 -36.67 0 -6.82 -6.47 c-48.78 -46.43 -176.91 -173.03 -210.41 -207.82 -24.69 -25.74 -75.70 -81.70 -93.69 -102.85 -3.29 -3.88 -5.29 -7.17 -4.70 -7.76 1.29 -1.06 58.30 -40.32 82.05 -56.42 l16.34 -11.05 3.64 4.47 c11.05 13.87 76.99 92.51 98.98 118.14 l25.74 29.97 15.63 0.35 15.52 0.35 0 -82.87 0 -82.75 50.55 -46.67 c27.86 -25.74 50.55 -47.14 50.55 -47.72 0 -0.59 46.78 -1.06 111.55 -1.06 l111.55 0 15.52 14.81 c15.28 14.58 15.52 14.69 17.98 12.58 1.29 -1.18 8.46 -7.76 15.75 -14.58 l13.40 -12.46 17.75 -0.71 c9.76 -0.47 58.77 -0.82 108.85 -0.82 l90.98 0 14.34 13.75 c7.76 7.64 24.57 23.86 37.15 36.20 12.58 12.34 29.15 28.45 36.67 35.85 l13.87 13.40 0.24 82.87 0.35 82.99 14.22 0.35 14.34 0.35 4.47 -5.64 c2.47 -3.06 11.52 -14.11 19.98 -24.45 8.46 -10.34 30.56 -38.32 49.14 -62.30 43.85 -56.42 46.20 -59.36 48.43 -59.36 2.12 0 4.82 1.88 47.96 33.27 43.02 31.27 45.37 33.03 45.37 34.09 0 0.82 -39.03 46.20 -62.42 72.53 -62.42 70.29 -106.50 117.67 -184.08 197.60 l-50.78 52.43 -13.28 0.71 c-7.29 0.47 -23.98 0.82 -37.03 0.82 l-23.86 0 0 57.01 0 57.01 -49.37 0 -49.37 0 0 -56.42 0 -56.42 -114.37 0 c-63.01 0 -120.13 0.35 -126.95 0.82 l-12.58 0.71 0 55.72 0 55.60 -47.61 0 -47.61 0 -0.24 -59.01z m443.16 -373.22 l-0.35 -119.66 -223.93 0.12 -223.93 0.12 -0.35 119.43 -0.24 119.55 224.52 0 224.52 0 -0.24 -119.55z","M546.36 516.39 c-0.24 -0.59 -0.47 -4.94 -0.35 -9.76 0 -4.82 0.12 -52.54 0.35 -106.15 l0.24 -97.21 209.59 0.24 209.47 0.35 0.35 106.73 0.24 106.62 -209.71 0 c-115.43 0 -209.94 -0.35 -210.18 -0.82z m121.07 -100.50 l-0.35 -66.18 -34.32 -0.35 -34.44 -0.24 0 66.41 0 66.41 34.68 0 34.68 0 -0.24 -66.06z m260.96 0 l-0.35 -66.18 -34.09 0 -34.09 0 0 10.93 c0 5.88 0.12 35.62 0.35 66.06 l0.24 55.25 34.09 0 34.09 0 -0.24 -66.06z"],box:{left:110.48999999999992,top:196.30999999999992,right:1389.0800000000002,bottom:869.2899999999998},centroid:{x:755.6746766446299,y:497.3295661269271}},Kc=e=>e.reduce((t,a,l)=>{let n=e[(l+1)%e.length];return t+a[0]*n[1]-n[0]*a[1]},0);function s2(e,t,a){for(let l of e)l.forEach((n,i)=>{let r=l[(i+1)%l.length];n[1]!==r[1]&&a.push(n[1]<r[1]?{x0:n[0],y0:n[1],x1:r[0],y1:r[1],wind:1,add:t}:{x0:r[0],y0:r[1],x1:n[0],y1:n[1],wind:-1,add:t})})}var er=(e,t)=>t===e.y0?e.x0:t===e.y1?e.x1:e.x0+(t-e.y0)*(e.x1-e.x0)/(e.y1-e.y0);function _5(e){let t=new Set;for(let a of e)t.add(a.y0),t.add(a.y1);for(let a=0;a<e.length;a+=1){let l=e[a];for(let n=a+1;n<e.length&&e[n].y0<l.y1;n+=1){let i=e[n],r=Math.max(l.y0,i.y0),o=Math.min(l.y1,i.y1);if(o<=r)continue;let s=er(l,r)-er(i,r),c=er(l,o)-er(i,o);s*c<0&&t.add(r+(o-r)*s/(s-c))}}return[...t].sort((a,l)=>a-l)}var T5=1e-9;function S5(){let e=new Map;return(t,a)=>{let l=e.get(t);l||e.set(t,l=[]);for(let n of l)if(Math.abs(n-a)<=T5)return n;return l.push(a),a}}function E5(e,t,a,l){let n=e.map(d=>({e:d,a:l(t,er(d,t)),b:l(a,er(d,a))})).sort((d,g)=>d.a+d.b-(g.a+g.b)),i=[],r=0,o=0,s=!1,c=[0,0];for(let d=0;d<n.length;){let{a:g,b:u}=n[d];for(;d<n.length&&n[d].a===g&&n[d].b===u;d+=1){let{e:b}=n[d];b.add?r+=b.wind:o+=b.wind}let m=r!==0&&o===0;m&&!s?c=[g,u]:!m&&s&&i.push({left:c,right:[g,u]}),s=m}return i}function c2(e,t){let a=[],l=0;for(let[n,i]of e){let r=n;for(;l<t.length&&t[l][1]<=r;)l+=1;for(let o=l;o<t.length&&t[o][0]<i&&r<i;o+=1){let[s,c]=t[o];s>r&&a.push([r,s]),r=Math.max(r,c)}r<i&&a.push([r,i])}return a}function M5(e,t){let a=[];return t.forEach((l,n)=>{let i=e[n],r=e[n+1];for(let{left:o,right:s}of l)a.push([[s[0],i],[s[1],r]]),a.push([[o[1],r],[o[0],i]])}),e.forEach((l,n)=>{let i=n>0?t[n-1].map(({left:o,right:s})=>[o[1],s[1]]):[],r=n<t.length?t[n].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of c2(r,i))a.push([[o,l],[s,l]]);for(let[o,s]of c2(i,r))a.push([[s,l],[o,l]])}),a.filter(([l,n])=>l[0]!==n[0]||l[1]!==n[1])}var n0=1e-9;function A5(e){let t=[...e],a=!0;for(;a&&t.length>=3;){a=!1;let l=[];for(let n=0;n<t.length;n+=1){let i=l.length>0?l[l.length-1]:t[t.length-1],r=t[n],o=t[(n+1)%t.length],s=r[0]-i[0],c=r[1]-i[1],d=o[0]-r[0],g=o[1]-r[1],u=Math.hypot(s,c)<n0,m=Math.abs(s*g-c*d)<n0;if(u||m){a=!0;continue}l.push(r)}t=l}return t}function N5(e){let t=i=>`${i[0]} ${i[1]}`,a=new Map;e.forEach(([i],r)=>{let o=a.get(t(i));o?o.push(r):a.set(t(i),[r])});let l=new Uint8Array(e.length),n=[];return e.forEach((i,r)=>{if(l[r])return;let o=[],s=r;for(;s!==void 0;){l[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===i[0][0]&&d[1]===i[0][1])break;s=a.get(t(d))?.find(g=>!l[g])}n.push(o)}),n.map(A5).filter(i=>i.length>=3&&Math.abs(Kc(i))>n0)}function i0(e,t=[]){let a=[];s2(e,!0,a),s2(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let l=_5(a),n=S5(),i=[],r=0,o=[];for(let s=0;s+1<l.length;s+=1){let c=l[s],d=l[s+1];for(;r<a.length&&a[r].y0<=c;)o.push(a[r++]);o=o.filter(g=>g.y1>c),i.push(E5(o,c,d,n))}return N5(M5(l,i))}var z5=e=>e.reduce((t,a)=>t+Kc(a),0)/2;function O5(e){let t=0,a=0;for(let n of e)n.forEach((i,r)=>{let o=n[(r+1)%n.length],s=i[0]*o[1]-o[0]*i[1];t+=(i[0]+o[0])*s,a+=(i[1]+o[1])*s});let l=6*z5(e);return[t/l,a/l]}var Ph=e=>Kc(e)<0?e.reverse():e;function v2(e,t,a=4){let l=[];for(let n of e)n.forEach((i,r)=>{let o=n[(r+1)%n.length],s=n[(r+2)%n.length],c=Math.hypot(o[0]-i[0],o[1]-i[1]),d=(o[1]-i[1])/c,g=-(o[0]-i[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),m=(s[1]-o[1])/u,b=-(s[0]-o[0])/u,w=t;l.push(Ph([[i[0]+d*w,i[1]+g*w],[o[0]+d*w,o[1]+g*w],[o[0]-d*w,o[1]-g*w],[i[0]-d*w,i[1]-g*w]]));let S=(o[0]-i[0])*(s[1]-o[1])-(o[1]-i[1])*(s[0]-o[0]);if(S===0)return;let f=S>0?1:-1,h=[o[0]+f*d*w,o[1]+f*g*w],p=[o[0]+f*m*w,o[1]+f*b*w],y=d+m,T=g+b,R=y*y+T*T;if(R>0&&2/Math.sqrt(R)<=a){let N=[o[0]+f*y*2*w/R,o[1]+f*T*2*w/R];l.push(Ph([o,h,N,p]))}else l.push(Ph([o,h,p]))});return l}var u2=e=>Math.round(e*100)/100;function d2(e){return e.map(t=>`M${t.map(([l,n])=>`${u2(l)} ${u2(n)}`).filter((l,n,i)=>l!==i[n-1]).join("L")}Z`).join("")}var y2=["crewlet","hexlet","peaklet","prismlet","towerlet","bricklet","gemlet","coglet","pluslet","shieldlet","stacklet","sparklet","cloudlet","foxlet","rocketlet","crownlet","cactlet","wisplet","heartlet","flasklet","chiplet","duolet","chatlet","pagelet","archlet","dashlet","octlet","conelet","hivelet","folderlet"],So=e=>typeof e=="string"&&y2.includes(e),jc=96,C5=1.35,b2=.9,To=1.3,R5=2,e0={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},t0={half:3.2,depth:2.6},f2=e=>Math.round(e*100)/100;function h2(e,t){let a=[];return e.forEach((l,n)=>{let i=typeof t=="number"?t:t[n]??0;if(!i){a.push(l);return}let r=o=>{let s=o[0]-l[0],c=o[1]-l[1],d=Math.min(i/Math.hypot(s,c),.45);return[l[0]+s*d,l[1]+c*d]};a.push(r(e[(n-1+e.length)%e.length]),r(e[(n+1)%e.length]))}),a}var p2=e=>`M${e.map(([t,a])=>`${f2(t)} ${f2(a)}`).join("L")}Z`;function ze(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return Kc(e)<0?h2([...e].reverse(),[...a].reverse()):h2(e,a)}var se=(e,t,a,l,n=0)=>ze([[e,t],[e+a,t],[e+a,t+l],[e,t+l]],n),Ne=(e,t,a,l=10)=>[se(e,a,l,jc-a),se(t,a,l,jc-a)];function D5(e,t,a,l,n){let i=[];for(let r=0;r<n;r+=1){let o=(r*360/n-90)*(Math.PI/180);for(let[s,c]of[[l,-15],[a,-8.5],[a,8.5],[l,15]]){let d=o+c*(Math.PI/180);i.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return ze(i)}function H5(e){let t=e.flat(),a=t.map(([r])=>r),l=t.map(([,r])=>r),n=Math.min(...a),i=Math.min(...l);return{x:n,y:i,width:Math.max(...a)-n,height:Math.max(...l)-i}}var G5=([e,t,a,l])=>({x:e,y:t,width:a,height:l}),w2=new WeakMap;function pe(e){let t=e.holes??[],a,l={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(p2),holes:t.map(p2),visor:G5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=H5([...s0(l),...x2(l)]))}};return w2.set(l,{parts:e.shapes,holes:t}),l}var Xc=e=>w2.get(e);function s0(e){let t=Xc(e);return t.silhouette??(t.silhouette=i0(t.parts))}function x2(e){let t=Xc(e);return t.reach??(t.reach=v2(s0(e),b2+C5))}var r0=.095,_2=760,T2=869,o0=(e,t)=>[50+(e-_2)*r0,jc+(t-T2)*r0],k5=o0(l0.centroid.x,l0.centroid.y);function L5(){let{paths:e,box:t}=l0,[a,l]=o0(t.left,t.top),[n,i]=o0(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${jc}) scale(${r0}) translate(${-_2} ${-T2})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:l,width:n-a,height:i-l}}}var c0={crewlet:L5(),hexlet:pe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[ze([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...Ne(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:pe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[ze([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...Ne(28,62,84)],visor:[26,44,48,20]}),prismlet:pe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[ze([[50,10],[90,86],[10,86]],[9,8,8]),...Ne(28,62,84)],visor:[31,54,38,18]}),towerlet:pe({name:"Towerlet",shape:"Tall pillar, narrow stance",shapes:[se(32,12,36,74,[8,8,4,4]),...Ne(35,55,84)],visor:[36,24,28,16],notch:12}),bricklet:pe({name:"Bricklet",shape:"Wide, low slab",shapes:[se(10,42,80,44,[9,9,6,6]),...Ne(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:pe({name:"Gemlet",shape:"Diamond on its point",shapes:[ze([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...Ne(40,52,76,8)],visor:[27,38,46,20]}),coglet:pe({name:"Coglet",shape:"Eight-tooth gear",shapes:[D5(50,52,37,31,8),...Ne(36,54,78)],visor:[30,40,40,18]}),pluslet:pe({name:"Pluslet",shape:"Cross with squared arms",shapes:[se(34,14,32,72,[7,7,0,0]),se(10,34,80,30,7),...Ne(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:pe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[ze([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...Ne(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:pe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[ze([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...Ne(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:pe({name:"Sparklet",shape:"Faceted drop",shapes:[ze([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...Ne(36,54,84)],visor:[30,48,40,18]}),cloudlet:pe({name:"Cloudlet",shape:"Three-lobed cloud",shapes:[se(14,44,72,42,[0,0,8,8]),se(16,30,32,32,9),se(33,18,34,34,10),se(56,32,30,30,9),...Ne(30,60,84)],visor:[24,48,52,18],notch:18}),foxlet:pe({name:"Foxlet",shape:"Square body, pointed ears",shapes:[se(18,34,64,52,6),ze([[20,36],[26,12],[44,36]],[0,4,0]),ze([[56,36],[74,12],[80,36]],[0,4,0]),...Ne(28,62,84)],visor:[26,46,48,20]}),rocketlet:pe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[ze([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),ze([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),ze([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...Ne(37,55,80,8)],visor:[37,32,26,16]}),crownlet:pe({name:"Crownlet",shape:"Three-point crown",shapes:[se(18,40,64,46,[0,0,6,6]),ze([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...Ne(28,62,84)],visor:[27,48,46,20]}),cactlet:pe({name:"Cactlet",shape:"Trunk with two raised arms",shapes:[se(32,12,36,74,[10,10,0,0]),se(16,50,18,9,[0,0,0,3]),se(16,28,9,31,[4.5,4.5,0,3]),se(66,58,18,9,[0,0,3,0]),se(75,38,9,29,[4.5,4.5,3,0]),...Ne(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:pe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[ze([[16,10],[84,10],[84,92],[72.5,82],[61,92],[50,82],[39,92],[27.5,82],[16,92]],[14,14,2,0,2,0,2,0,2])],visor:[26,28,48,20],notch:10}),heartlet:pe({name:"Heartlet",shape:"Faceted heart",shapes:[ze([[50,26],[62,14],[78,14],[90,26],[90,44],[50,84],[10,44],[10,26],[22,14],[38,14]],[0,3,3,3,4,6,4,3,3,3]),...Ne(41,51,74,8)],visor:[23,30,54,18]}),flasklet:pe({name:"Flasklet",shape:"Lab flask with a narrow neck",shapes:[se(35,6,30,7,2),se(40,10,20,22),ze([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...Ne(26,64,84)],visor:[33,54,34,14],notch:6}),chiplet:pe({name:"Chiplet",shape:"Square chip with pins",shapes:[se(24,20,52,60,6),...[31,47,63].map(e=>se(e,11,6,10)),...[32,47,62].map(e=>se(15,e,10,6)),...[32,47,62].map(e=>se(75,e,10,6)),...[31,47,63].map(e=>se(e,78,6,18))],holes:[se(29,70,5,5)],visor:[31,34,38,18]}),duolet:pe({name:"Duolet",shape:"Small head on a wide body",shapes:[se(30,10,40,34,8),se(18,40,64,46,6),...Ne(28,62,84)],visor:[36,19,28,15],notch:10}),chatlet:pe({name:"Chatlet",shape:"Speech bubble with a tail",shapes:[se(14,22,72,54,8),ze([[26,72],[46,72],[22,94]],[0,0,2])],visor:[24,34,52,22],notch:22}),pagelet:pe({name:"Pagelet",shape:"Page with a folded corner",shapes:[ze([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...Ne(28,62,84)],holes:[se(63.3,10,1.4,17.4),se(63.3,25.3,17,1.4)],visor:[27,36,46,20],notch:10}),archlet:pe({name:"Archlet",shape:"Gate with built-in legs",shapes:[ze([[16,18],[84,18],[84,96],[64,96],[64,74],[36,74],[36,96],[16,96]],[8,8,0,0,4,4,0,0])],visor:[25,30,50,22],notch:18}),dashlet:pe({name:"Dashlet",shape:"Body leaning forward",shapes:[ze([[29,14],[87,14],[71,86],[13,86]],6),...Ne(20,48,84)],visor:[31.5,28,42,20],notch:14,notchX:58}),octlet:pe({name:"Octlet",shape:"Regular octagon",shapes:[se(16,16,68,68,20),...Ne(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:pe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[ze([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...Ne(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:pe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[ze([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...Ne(40,52,80,8)],visor:[25,36,50,20]}),folderlet:pe({name:"Folderlet",shape:"Folder with a tab",shapes:[ze([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...Ne(26,64,82)],visor:[24,40,52,22]})},m2=.5,a0=(e,t,a,l)=>[[e,t],[e+a,t],[e+a,t+l],[e,t+l]];function U5(e){let t=1/0;return e.forEach((a,l)=>{let n=e[(l+1)%e.length],i=Math.hypot(n[0]-a[0],n[1]-a[1]);if(i===0)return;let r=Math.max(...e.map(o=>Math.abs((n[0]-a[0])*(o[1]-a[1])-(n[1]-a[1])*(o[0]-a[0]))/i));t=Math.min(t,r)}),t}function B5(e,t){let{visor:a,notch:l}=e,n=t==="full",i=n?e0.full:e0.compact,r=a.width*i.width,o=a.height*i.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*e0.offset,g=[c-d,c+d].map(u=>a0(u-r/2,s,r,o));l&&g.push([[l[0]-t0.half,l[1]-1],[l[0]+t0.half,l[1]-1],[l[0],l[1]+t0.depth]]);for(let u of Xc(e).holes)(n||U5(u)>R5)&&g.push(u);if(n){let u=To/2;g.push(a0(a.x-u,a.y-u,a.width+To,a.height+To)),g.push([...a0(a.x+u,a.y+u,a.width-To,a.height-To)].reverse())}return g}function S2(e,t){let a=e.x+e.width/2,l=e.y+e.height/2,n=a+m2*(t[0]-a),i=l+m2*(t[1]-l),r=Math.max(e.width+2*Math.abs(n-a),e.height+2*Math.abs(i-l));return{x:n-r/2,y:i-r/2,width:r,height:r}}function q5(e){let{parts:t}=Xc(e),a=s0(e),l={},n=r=>d2(i0(t,B5(e,r))),i=()=>d2(i0([...a,...x2(e)],[...a,...v2(a,b2)]));return{frame:S2(e.bounds,O5(a)),paths:r=>l[r]??(l[r]=r==="full"?[i(),n("full")]:[n("compact")])}}var g2=new Map;function V5(e){let t=g2.get(e);if(t)return t;let a=c0[e];if(a.kind==="mark"){let l=[a.keyline,...a.body];t={frame:S2(a.bounds,k5),paths:n=>n==="full"?l:a.body}}else t=q5(a);return g2.set(e,t),t}var Y5=e=>Math.round(e*100)/100,j5=({character:e,detail:t="full",...a})=>{let l=c0[e],{frame:n,paths:i}=V5(e),r=i(t).map(o=>(0,Yc.jsx)("path",{d:o},o));return(0,Yc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:[n.x,n.y,n.width,n.height].map(Y5).join(" "),width:"1em",height:"1em","aria-hidden":"true",focusable:"false","data-character":e,"data-detail":t,...a,children:(0,Yc.jsx)("g",{fill:"currentColor",transform:l.kind==="mark"?l.transform:void 0,children:r})})},u0=j5;var yt=Q(be(),1);var K5={working:"working",needs:"needs you",stopped:"stopped"},d0={xs:20,sm:26,md:32,lg:40};var X5=/^agent(?:[\s._-]+)(?=\S)/i;function Q5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(X5,"");return a.trim()?a:e}var Z5=56,I5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.]+/).filter(Boolean);if(t.length===0)return"?";let a=i=>(Array.from(i)[0]??"").toUpperCase();if(t.length>=2)return t.slice(0,2).map(a).join("")||"?";let l=t[0],n=l.split(/(?<=\p{Ll})(?=\p{Lu})/u);return n.length>=2?n.slice(0,2).map(a).join(""):Array.from(l).slice(0,2).map(i=>i.toUpperCase()).join("")||"?"},J5=10,$5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%J5};function F5(e){return typeof e=="number"?e:d0[e]}var Eo=({src:e,name:t,size:a="md",kind:l="agent",tone:n="neutral",ring:i,status:r,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:g,hue:u,icon:m,className:b,style:w,...S})=>{let[f,h]=(0,Qc.useState)(!1);(0,Qc.useEffect)(()=>{h(!1)},[e]);let p=typeof a=="number"?null:a,y=F5(a),T=p===null?{"--crewlet-avatar-size":`${y}px`,fontSize:Math.max(9,Math.round(y*.36))}:{},R=n==="seeded"?$5(d??t??""):null,N=r===void 0&&o!==void 0&&o!==null,A=r!==void 0||N,X=r!==void 0?K5[r]:N?s:void 0,C=t?`${t} avatar`:"Avatar",G=X?`${C}, ${X}`:C,Be=k("crewlet-avatar",`crewlet-avatar--${l}`,p===null?null:`crewlet-avatar--${p}`,A?"crewlet-avatar--notched":null,i===void 0||A?null:`crewlet-avatar--ring-${i}`,A?null:b),H=A?T:{...T,...w};function D(){return g!==void 0&&l==="agent"?(0,yt.jsx)("span",{...S,className:k(Be,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:H,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:G,children:(0,yt.jsx)(u0,{className:"crewlet-avatar__character",character:g,detail:y>=Z5?"full":"compact"})}):e&&!f?(0,yt.jsx)("img",{...S,className:k(Be,"crewlet-avatar--image"),style:H,src:e,alt:c?"":X?`${t??""}, ${X}`:t??"","aria-hidden":c?!0:void 0,onError:()=>h(!0)}):(0,yt.jsx)("span",{...S,className:k(Be,"crewlet-avatar--fallback",`crewlet-avatar--${n}`,R===null?null:`crewlet-avatar--tint-${R}`,m==null?null:"crewlet-avatar--icon"),style:H,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:G,children:m==null?I5(Q5(t,l)):(0,yt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:m})})}let q=D();return A?(0,yt.jsxs)("span",{className:k("crewlet-avatar-frame",b),style:{"--crewlet-avatar-size":`${y}px`,...w},children:[q,r!==void 0?(0,yt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${r}`,"aria-hidden":"true",children:W5[r]}):(0,yt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):q},W5={working:(0,yt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,yt.jsx)("path",{d:"M5.4 3.9 10.2 7l-4.8 3.1z",fill:"currentColor"})}),needs:(0,yt.jsxs)("svg",{viewBox:"0 0 14 14",focusable:"false",children:[(0,yt.jsx)("path",{d:"M5.1 5.3a1.9 1.9 0 1 1 2.7 1.7c-.55.27-.8.62-.8 1.15v.3",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,yt.jsx)("circle",{cx:"7",cy:"10.45",r:".85",fill:"currentColor"})]}),stopped:(0,yt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,yt.jsx)("rect",{x:"4.6",y:"4.6",width:"4.8",height:"4.8",rx:".7",fill:"currentColor"})})};var wl=Q(be(),1);function f0({members:e,self:t=!0,max:a=4,size:l="sm",onSelect:n,label:i,labels:r,className:o}){if(!Number.isInteger(a)||a<1)throw new RangeError(`PresenceStack max must be a whole number of at least 1; it was ${a}`);let s=mo(r),c=rh(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),g=c.slice(a),u=i??s.here(c.length,t),m=[u,...c.map(f=>s.member(f))].join(". "),b=f=>(0,wl.jsx)(Eo,{name:f.name,kind:f.kind,src:f.src,character:f.character!==void 0&&So(f.character)?f.character:void 0,hue:f.kind==="agent"?f.hue:void 0,size:l,decorative:!0,className:k("crewlet-presence-stack__badge",f.hue!==void 0&&f.activity!=="idle"&&an(f.hue),f.hue!==void 0&&f.activity!=="idle"&&"crewlet-presence-stack__badge--present",f.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),w=g.length>0?(0,wl.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",g.length]}):null,S={"--crewlet-avatar-stack-size":`${d0[l]}px`};return n===void 0?c.length===0?null:(0,wl.jsxs)("span",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"img","aria-label":m,children:[d.map(f=>(0,wl.jsx)("span",{className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${f.kind}`),children:b(f)},f.id)),w]}):(0,wl.jsxs)("div",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"group","aria-label":u,children:[d.map(f=>(0,wl.jsx)("button",{type:"button",className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${f.kind}`),"aria-label":s.member(f),title:s.member(f),onClick:()=>n(f),children:b(f)},f.id)),w,g.length>0?(0,wl.jsx)(Tt,{children:`${s.more(g.length)}: ${g.map(f=>s.member(f)).join(", ")}`}):null]})}var h0=Q(wt(),1),P5=Q(be(),1),E2={text:"",n:0},ex=new Set,tx=0;function ax(e){if(e!==""){if(tx===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}E2={text:e,n:E2.n+1};for(let t of[...ex])t()}}function M2(){return(0,h0.useCallback)(ax,[])}var ya=Q(wt(),1),ln=Q(be(),1);function A2({label:e,max:t=6,overflow:a="expand",moreLabel:l=s=>`+${s} more`,countLabel:n=s=>`+${s}`,expandedMessage:i=s=>`Showing all ${s}.`,className:r,children:o}){let[s,c]=(0,ya.useState)(!1),d=M2(),g=(0,ya.useRef)(null),u=ya.Children.toArray(o),m=a==="fit",b=lx(g,m,u.length),w=m?u.slice(0,b):s?u:u.slice(0,t),S=u.length-w.length;return(0,ln.jsxs)("ul",{ref:g,tabIndex:-1,className:k("crewlet-tag-group",m&&"crewlet-tag-group--fit",r),"aria-label":`${e}, ${u.length}`,children:[w.map((f,h)=>(0,ln.jsx)("li",{className:"crewlet-tag-group__item",children:f},h)),S>0&&m?(0,ln.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,ln.jsx)("span",{className:"crewlet-tag-group__count",children:n(S)})}):S>0?(0,ln.jsx)("li",{className:"crewlet-tag-group__item",children:(0,ln.jsx)("button",{type:"button",className:"crewlet-tag-group__more",onClick:()=>{c(!0),g.current?.focus(),d(i(u.length))},children:l(S)})}):null]})}function lx(e,t,a){let[l,n]=(0,ya.useState)(a),i=(0,ya.useRef)(null);return(0,ya.useLayoutEffect)(()=>{t&&n(a)},[t,a]),(0,ya.useLayoutEffect)(()=>{let r=e.current;if(!t||!r)return;let o=[...r.children],s=o[0];if(!s)return;let c=s.offsetTop,d=o.filter(w=>!w.hasAttribute("data-count")),g=o.find(w=>w.hasAttribute("data-count")),u=d.filter(w=>w.offsetTop===c).length,m=g&&g.offsetTop!==c?u-1:u,b=Math.max(1,Math.min(m,d.length));b<d.length&&n(b)},[e,t,l,a]),(0,ya.useLayoutEffect)(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;i.current!==null&&i.current!==c&&n(a),i.current=c});return o.observe(r),()=>o.disconnect()},[e,t,a]),t?l:a}var Mo=Q(be(),1);function N2({name:e,hue:t,kind:a="human",editing:l=!1,placement:n="top-end",className:i,...r}){let o=typeof e=="string"?e:e.join(", ");return(0,Mo.jsxs)("span",{...r,"aria-hidden":"true",className:k("crewlet-cursor-flag",an(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${n}`,i),children:[l?(0,Mo.jsx)(Vh,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,Mo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Ao=Q(be(),1);function No({tone:e="neutral",pulse:t=!1,children:a,className:l}){let n=a!=null&&a!==!1&&a!=="",i=(0,Ao.jsx)("span",{"aria-hidden":!0,className:k("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!n&&l)});return n?(0,Ao.jsxs)("span",{className:k("crewlet-status",l),children:[i," ",(0,Ao.jsx)("span",{className:"crewlet-status__label",children:a})]}):i}var Rt=Q(be(),1);function Zc(e){let{variant:t="neutral",hue:a,appearance:l="soft",size:n="sm",leadingIcon:i,dot:r=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:g,onRemove:u,removeAriaLabel:m="Remove tag",className:b,children:w,...S}=e,f=d!==void 0,h=f||u!==void 0,p=f&&u!==void 0;h&&n==="xs"&&console.warn('[crewlet] Tag size="xs" cannot act: an interactive tag starts at "sm", so its target clears 24px. Drawn at "sm".');let y=h&&n==="xs"?"sm":n,T=k("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${l}`,`crewlet-tag--${y}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",h&&"crewlet-tag--acts",f&&!p&&"crewlet-tag--actionable",p&&"crewlet-tag--split",p&&g===!0&&"is-pressed",b),R=(0,Rt.jsxs)(Rt.Fragment,{children:[r?(0,Rt.jsx)(No,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,i?(0,Rt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:i}):null,(0,Rt.jsx)("span",{className:"crewlet-tag__label",children:w}),o===void 0?null:(0,Rt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,Rt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:A=>{A.stopPropagation(),u()},"aria-label":m,children:(0,Rt.jsx)(bo,{size:"xs"})});return p?(0,Rt.jsxs)("span",{...S,className:T,children:[(0,Rt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":g===!0,children:R}),N]}):f?(0,Rt.jsx)("button",{...S,type:"button",className:T,onClick:d,"aria-pressed":g===!0,children:R}):(0,Rt.jsxs)("span",{...S,className:T,children:[R,N]})}var He=Q(wt(),1),z2=Q(hr(),1);var tr=Q(be(),1);function O2(e){return Number.parseFloat(e)}function nx(e,t){if(typeof e=="function"){let l=e(t);return typeof l=="function"?l:()=>{e(null)}}if(!e)return()=>{};let a=e;return a.current=t,()=>{a.current=null}}var ix=O2(Ih.duration.slow),rx=O2(Ih.duration.base);function C2({content:e,placement:t="top",disabled:a=!1,openDelay:l=ix,closeDelay:n=rx,className:i,children:r}){let s=`${(0,He.useId)()}-tooltip`,[c,d]=(0,He.useState)(!1),g=(0,He.useRef)(null),u=(0,He.useRef)(null),m=(0,He.useRef)(void 0),b=(0,He.useRef)({pointer:!1,focus:!1}),[w,S]=(0,He.useState)(null),f=Fi(),h=(0,He.useCallback)(()=>{m.current!==void 0&&clearTimeout(m.current),m.current=void 0},[]),p=(0,He.useCallback)(H=>{if(h(),!a){if(H<=0){d(!0);return}m.current=setTimeout(()=>d(!0),H)}},[h,a]),y=(0,He.useCallback)(H=>{h();let D=()=>{b.current.pointer||b.current.focus||d(!1)};if(H<=0){D();return}m.current=setTimeout(D,H)},[h]),T=Vc({open:c,onDismiss:()=>{b.current={pointer:!1,focus:!1},h(),d(!1)}});(0,He.useEffect)(()=>h,[h]),(0,He.useEffect)(()=>{a&&(h(),d(!1))},[a,h]);let R=(0,He.useCallback)(()=>{let H=g.current,D=u.current;if(!H||!D||!f)return;let q=f!==document.body,ae=q?f.getBoundingClientRect():Bc(),O=H.getBoundingClientRect(),F=D.getBoundingClientRect(),I={x:O.x+O.width/2-F.width/2-(q?ae.x:0),y:O.y-(q?ae.y:0),width:O.width,height:O.height},qe={x:0,y:0,width:ae.width,height:ae.height},St={x:ea,y:ea,width:ae.width-2*ea,height:ae.height-2*ea};if(qc({...I,x:O.x-(q?ae.x:0)},qe)){d(!1);return}let We=Uc(I,{width:F.width,height:F.height},St,ea,t==="top"?"above":"below");S(we=>we&&we.left===We.left&&we.top===We.top&&we.side===We.side?we:We)},[f,t]);(0,He.useLayoutEffect)(()=>{if(!c)return;R();let H=()=>R();f?.addEventListener($i,H),window.addEventListener("resize",H),window.addEventListener("scroll",H,!0);let D=typeof ResizeObserver=="function"?new ResizeObserver(H):null;return u.current&&D?.observe(u.current),()=>{f?.removeEventListener($i,H),window.removeEventListener("resize",H),window.removeEventListener("scroll",H,!0),D?.disconnect()}},[c,f,R]),(0,He.useEffect)(()=>{c||S(null)},[c]);let N=r,A=N.props["aria-describedby"],X=N.props.ref,C=(0,He.cloneElement)(N,{ref:H=>{g.current=H,T.insideRef(H);let D=nx(X,H);return()=>{g.current=null,T.insideRef(null),D()}},"aria-describedby":c?k(A,s):A,onPointerEnter:H=>{b.current.pointer=!0,p(l),N.props.onPointerEnter?.(H)},onPointerLeave:H=>{b.current.pointer=!1,y(n),N.props.onPointerLeave?.(H)},onFocus:H=>{b.current.focus=!0,p(0),N.props.onFocus?.(H)},onBlur:H=>{b.current.focus=!1,y(0),N.props.onBlur?.(H)}}),G=w?{left:w.left,top:w.top,zIndex:T.zIndex}:{visibility:"hidden",zIndex:T.zIndex},Be=c?(0,tr.jsx)("div",{ref:H=>{u.current=H,T.panelRef(H)},id:s,role:"tooltip",className:k("crewlet-tooltip",`crewlet-tooltip--${w?.side??(t==="top"?"above":"below")}`,f!==null&&f!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",i),style:G,onPointerEnter:()=>{b.current.pointer=!0,h()},onPointerLeave:()=>{b.current.pointer=!1,y(n)},children:e}):null;return(0,tr.jsxs)(tr.Fragment,{children:[C,Be&&f?(0,z2.createPortal)(Be,f):null]})}var p0=Q(be(),1);function R2({by:e,at:t,previous:a=null,locale:l,className:n,labels:i}){let r=Rc({by:e,at:t},go(i),a,l);return(0,p0.jsx)(C2,{content:r,children:(0,p0.jsx)("span",{"aria-hidden":"true",className:k("crewlet-change-mark",n)})})}var Ge=Q(wt(),1),D2=Q(hr(),1);var ct=Q(be(),1),ox="[role='menuitem'],[role='menuitemradio']";function sx(e){let t=[];for(let a of e){if(a.kind==="separator"){t.push({kind:"separator",key:a.key});continue}let l=t[t.length-1];a.checked===void 0?t.push({kind:"action",item:a}):l?.kind==="answers"?l.items.push(a):t.push({kind:"answers",key:`${a.key}:answers`,items:[a]})}return t}function H2({label:e,items:t,icon:a,trigger:l,trailingIcon:n,triggerVariant:i="ghost",triggerTabIndex:r,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:g,header:u,className:m}){let b=(0,Ge.useId)(),w=`${b}-menu`,S=`${b}-header`,[f,h]=(0,Ge.useState)(!1),p=o??f,y=(0,Ge.useRef)(null),T=(0,Ge.useRef)(null),R=(0,Ge.useRef)(null),N=(0,Ge.useRef)("first"),[A,X]=(0,Ge.useState)(null),C=Fi(),G=(0,Ge.useRef)(o!==void 0),Be=(0,Ge.useRef)(s);G.current=o!==void 0,Be.current=s;let H=(0,Ge.useCallback)(M=>{G.current||h(M),Be.current?.(M)},[]),D=(0,Ge.useCallback)(()=>{let M=R.current;(M&&M.isConnected&&M!==document.body?M:y.current)?.focus()},[]),q=(0,Ge.useCallback)(M=>{M&&D(),H(!1)},[D,H]),ae=Vc({open:p,onDismiss:M=>q(M!=="outside")}),O=()=>T.current?[...T.current.querySelectorAll(ox)]:[];(0,Ge.useLayoutEffect)(()=>{if(!p)return;let M=document.activeElement;M instanceof Node&&T.current?.contains(M)||(R.current=M instanceof HTMLElement?M:null)},[p]);let F=(0,Ge.useCallback)(()=>{let M=y.current,Me=T.current;if(!M||!Me||!C)return;let Yt=C!==document.body,Ke=Yt?C.getBoundingClientRect():Bc(),Pe=M.getBoundingClientRect(),ke=Me.getBoundingClientRect(),et=d==="trigger"?Pe.width:void 0,ta={width:Math.max(ke.width,et??0),height:ke.height},Fa={x:(c==="end"?Pe.right-ta.width:Pe.left)-(Yt?Ke.x:0),y:Pe.top-(Yt?Ke.y:0),width:Pe.width,height:Pe.height},j={x:0,y:0,width:Ke.width,height:Ke.height},aa={x:ea,y:ea,width:Ke.width-2*ea,height:Ke.height-2*ea};if(qc(Fa,j)){q(!0);return}let Wa=Uc(Fa,{width:ta.width,height:ta.height},aa,ea);X(la=>la&&la.left===Wa.left&&la.top===Wa.top&&la.floor===et?la:{left:Wa.left,top:Wa.top,floor:et})},[c,q,C,d]);(0,Ge.useLayoutEffect)(()=>{if(!p)return;F();let M=()=>F();C?.addEventListener($i,M),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0);let Me=typeof ResizeObserver=="function"?new ResizeObserver(M):null;return T.current&&Me?.observe(T.current),()=>{C?.removeEventListener($i,M),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0),Me?.disconnect()}},[p,C,F]),(0,Ge.useEffect)(()=>{p||X(null)},[p]);let I=p&&A!==null;(0,Ge.useLayoutEffect)(()=>{if(!I)return;let M=O();(N.current==="last"?M[M.length-1]:M[0])?.focus(),N.current="first"},[I]);function qe(M){(M.key==="ArrowDown"||M.key==="ArrowUp")&&(M.preventDefault(),N.current=M.key==="ArrowUp"?"last":"first",H(!0))}function St(M){M.key!=="Escape"&&M.key!=="Tab"&&!M.ctrlKey&&!M.metaKey&&!M.altKey&&M.stopPropagation();let Me=O(),Yt=Me.indexOf(document.activeElement),Ke=Pe=>Me[(Pe+Me.length)%Me.length]?.focus();switch(M.key){case"ArrowDown":M.preventDefault(),Ke(Yt+1);return;case"ArrowUp":M.preventDefault(),Ke(Yt-1);return;case"Home":M.preventDefault(),Ke(0);return;case"End":M.preventDefault(),Ke(Me.length-1);return;case"Tab":q(!0);return;default:if(M.key.length===1&&!M.ctrlKey&&!M.metaKey&&!M.altKey&&M.key!==" "){let Pe=M.key.toLocaleLowerCase();for(let ke=1;ke<=Me.length;ke++){let et=Me[(Yt+ke)%Me.length];if((et.textContent??"").trim().toLocaleLowerCase().startsWith(Pe)){M.preventDefault(),et.focus();return}}}}}function We(M){M.disabled||(q(!0),M.onSelect())}let we=M=>M.description!==void 0&&M.description!==null&&M.description!==!1&&M.description!=="",Ee=M=>(0,ct.jsxs)("button",{type:"button",role:M.checked===void 0?"menuitem":"menuitemradio","aria-checked":M.checked,tabIndex:-1,className:k("crewlet-menu__item",we(M)?"crewlet-menu__item--described":void 0,M.danger&&"is-danger",M.disabled&&"is-disabled"),"aria-disabled":M.disabled||void 0,onClick:()=>We(M),children:[M.checked!==void 0&&(0,ct.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:M.checked&&(0,ct.jsx)(Zi,{size:"sm"})}),M.icon&&(0,ct.jsx)("span",{className:"crewlet-menu__icon",children:M.icon}),(0,ct.jsxs)("span",{className:"crewlet-menu__text",children:[(0,ct.jsx)("span",{className:"crewlet-menu__label",children:M.label}),we(M)?(0,ct.jsx)("span",{className:"crewlet-menu__description",children:M.description}):null]}),M.hint&&(0,ct.jsx)("span",{className:"crewlet-menu__hint",children:M.hint})]},M.key),ba=p?(0,ct.jsxs)("div",{className:k("crewlet-menu",C!==null&&C!==document.body?"crewlet-menu--in-host":null,m),id:w,role:"menu","aria-label":e,"aria-describedby":u?S:void 0,tabIndex:-1,ref:M=>{T.current=M,ae.panelRef(M)},style:A?{left:A.left,top:A.top,zIndex:ae.zIndex,...A.floor===void 0?null:{"--crewlet-menu-floor":`${A.floor}px`}}:{visibility:"hidden"},onKeyDown:St,onPointerDown:M=>M.stopPropagation(),onClick:M=>M.stopPropagation(),children:[u?(0,ct.jsx)("div",{role:"presentation",id:S,className:"crewlet-menu__header",children:u}):null,sx(t).map(M=>M.kind==="separator"?(0,ct.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},M.key):M.kind==="answers"?(0,ct.jsx)("div",{role:"group",className:"crewlet-menu__group",children:M.items.map(Ee)},M.key):Ee(M.item))]}):null,je={ref:M=>{y.current=M,ae.insideRef(M)},"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?w:void 0,tabIndex:r,onClick:()=>{p?q(!0):(N.current="first",H(!0))},onKeyDown:qe};return(0,ct.jsxs)("span",{className:"crewlet-menu-anchor",children:[g?g(je):l===void 0?(0,ct.jsx)(_o,{...je,label:e,icon:a??(0,ct.jsx)(Bh,{}),size:"sm"}):(0,ct.jsx)(Na,{...je,variant:i,size:"small",leadingIcon:a,trailingIcon:n,children:l}),ba&&C?(0,D2.createPortal)(ba,C):null]})}var z=Q(wt(),1);var E=Q(be(),1);function g0({column:e,id:t,labels:a}){let l=vl(e,t);if(!l)return(0,E.jsx)(Zc,{size:"xs",children:t});if(l.archived)return(0,E.jsx)(Zc,{size:"xs",appearance:"outline",children:a.archived(l.label)});let n=zc(l.color);return(0,E.jsx)(Zc,{size:"xs",hue:n==="neutral"?void 0:n,children:l.label})}function k2({person:e,fallback:t}){return e?(0,E.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,E.jsx)(Eo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&So(e.character)?e.character:void 0,hue:e.kind==="agent"?e.hue:void 0,size:"xs",decorative:!0}),(0,E.jsx)("span",{className:"crewlet-sheet-cell__text",children:e.name})]}):(0,E.jsx)("span",{className:"crewlet-sheet-cell__muted",children:t})}function L2({column:e,value:t,context:a,onOpenLink:l}){let{labels:n}=a;if(e.type==="checkbox"){let i=t===!0;return(0,E.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,E.jsx)("span",{className:k("crewlet-sheet-cell__check",i&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:i?(0,E.jsx)(Zi,{size:"xs"}):null}),(0,E.jsx)(Tt,{children:i?n.checked:n.unchecked})]})}if(bl(t))return(0,E.jsx)(Tt,{children:n.empty});switch(e.type){case"select":return(0,E.jsx)(g0,{column:e,id:String(t),labels:n});case"multiselect":return(0,E.jsx)(A2,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(i=>(0,E.jsx)(g0,{column:e,id:i,labels:n},i))});case"status":{let i=vl(e,String(t)),r=Ma(e,t,a);return(0,E.jsx)(No,{tone:i&&!i.archived?Oc(i):"neutral",children:r})}case"person":return(0,E.jsx)(k2,{person:ji(a.people,String(t)),fallback:n.unknownPerson});case"rating":{let i=yl(e),r=Number(t);return(0,E.jsxs)("span",{className:"crewlet-sheet-cell__rating",children:[(0,E.jsx)("span",{className:"crewlet-sheet-cell__stars","aria-hidden":"true",children:Array.from({length:i},(o,s)=>(0,E.jsx)(Kh,{size:"sm",filled:s<r,className:k("crewlet-sheet-cell__star",s<r&&"crewlet-sheet-cell__star--on")},s))}),(0,E.jsx)(Tt,{children:n.rating(r,i)})]})}case"url":{let i=String(t);return(0,E.jsx)("a",{className:"crewlet-sheet-cell__link",href:i,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:l?r=>{r.preventDefault(),l(i)}:void 0,children:i})}case"number":return(0,E.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:Ma(e,t,a)});default:return(0,E.jsx)("span",{className:"crewlet-sheet-cell__text",children:Ma(e,t,a)})}}var cx=new Set(["text","number","url","date","rating"]),ux=new Set(["text","longtext"]),dx=6,fx=8,U2=new Set(["select","multiselect","status","person"]),hx=e=>e!=="checkbox",G2=e=>cx.has(e)||U2.has(e)||e==="longtext";function B2(e,t){if(e.key==="Tab")return e.shiftKey?"left":"right";if(e.key==="Enter")return t?e.shiftKey&&!kn(e)?void 0:"down":e.shiftKey?"up":"down"}function v0(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function y0(e){let t=(0,z.useRef)(!1);return{finish:()=>{t.current=!0},onBlur:a=>{if(t.current)return;let l=a.relatedTarget;l!==null&&a.currentTarget.contains(l)||(t.current=!0,e())}}}function px(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let a=l=>String(l).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function b0({conflict:e,labels:t}){return(0,E.jsxs)("div",{className:"crewlet-sheet-editor__conflict",role:"alert",children:[(0,E.jsx)("p",{className:"crewlet-sheet-editor__conflict-text",children:t.conflict(e.writer,e.value)}),(0,E.jsxs)("div",{className:"crewlet-sheet-editor__conflict-actions",children:[(0,E.jsx)(Na,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function w0({id:e,message:t}){return(0,E.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,E.jsx)(Ii,{size:"xs","aria-hidden":"true"}),(0,E.jsx)("span",{children:t})]})}function q2(e){let{column:t}=e;return U2.has(t.type)?(0,E.jsx)(bx,{...e}):ux.has(t.type)?(0,E.jsx)(gx,{...e}):(0,E.jsx)(mx,{...e})}function mx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,conflict:o}){let{labels:s}=a,c=(0,z.useId)(),d=(0,z.useRef)(null),g=e.type==="date",u=(0,z.useMemo)(()=>{if(g){let p=typeof t=="string"?t:"";return e.time?px(p):p}return l??Ki(e,t,a)},[]),[m,b]=(0,z.useState)(u),[w,S]=(0,z.useState)(null);(0,z.useLayoutEffect)(()=>{v0(d.current,!g)},[g]);let f=p=>{let y=g&&e.time&&m!==""?new Date(m).toISOString():m,T=Xi(e,y,a);return T.ok?(h.finish(),i(T.value,p),!0):(S(T.error),!1)},h=y0(()=>{f(null)||r()});return(0,E.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:h.onBlur,children:[(0,E.jsx)("input",{ref:d,className:"crewlet-sheet-editor__input",type:g?e.time?"datetime-local":"date":e.type==="url"?"url":"text",inputMode:e.type==="number"?"decimal":e.type==="rating"?"numeric":void 0,"aria-label":n,"aria-invalid":w!==null,"aria-describedby":w!==null?c:void 0,maxLength:e.type==="text"?en(e):void 0,value:m,onChange:p=>{b(p.target.value),S(null)},onKeyDown:p=>{if(Pi(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),h.finish(),r();return}if(p.key==="Tab"&&o)return;let y=B2(p,!1);y!==void 0&&(p.preventDefault(),p.stopPropagation(),f(y))}}),w!==null||o?(0,E.jsxs)("div",{className:k("crewlet-sheet-editor__panel"),children:[w!==null?(0,E.jsx)(w0,{id:c,message:w}):null,o?(0,E.jsx)(b0,{conflict:o,labels:s}):null]}):null]})}function gx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",g=(0,z.useId)(),u=(0,z.useRef)(null),[m,b]=(0,z.useState)(()=>l??Ki(e,t,a)),[w,S]=(0,z.useState)(null);(0,z.useLayoutEffect)(()=>{v0(u.current,!0)},[]),(0,z.useLayoutEffect)(()=>{let p=u.current;!p||p.scrollHeight===0||(p.style.height="auto",p.style.height=`${p.scrollHeight}px`)},[m]);let f=p=>{let y=Xi(e,m,a);return y.ok?(h.finish(),i(y.value,p),!0):(S(y.error),!1)},h=y0(()=>{f(null)||r()});return(0,E.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:h.onBlur,children:(0,E.jsxs)("div",{className:"crewlet-sheet-editor__overlay",children:[(0,E.jsx)("textarea",{ref:u,className:"crewlet-sheet-editor__textarea","aria-label":n,"aria-multiline":d,"aria-invalid":w!==null,"aria-describedby":w!==null?g:void 0,maxLength:en(e),rows:1,style:{"--crewlet-sheet-editor-lines":dx},value:m,onChange:p=>{b(d?p.target.value:p.target.value.replace(/\r?\n/g," ")),S(null)},onKeyDown:p=>{if(Pi(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),h.finish(),r();return}if(p.key==="Tab"&&s)return;let y=B2(p,d);y!==void 0&&(p.preventDefault(),p.stopPropagation(),f(y))}}),w!==null?(0,E.jsx)(w0,{id:g,message:w}):null,s?(0,E.jsx)(b0,{conflict:s,labels:c}):null]})})}function vx(e,t){return e.type==="person"?(t.people??[]).map(a=>({id:a.id,label:a.name,person:a})):Vi(e).map(a=>({id:a.id,label:a.label,option:a}))}function yx({column:e,choice:t,context:a}){return t.person?(0,E.jsx)(k2,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,E.jsx)(No,{tone:Oc(t.option),children:t.label}):(0,E.jsx)(g0,{column:e,id:t.id,labels:a.labels})}var Ja="";function bx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",g=(0,z.useId)(),u=(0,z.useId)(),m=(0,z.useRef)(null),b=(0,z.useRef)(null),w=(0,z.useMemo)(()=>vx(e,a),[e,a]),S=w.length>fx,[f,h]=(0,z.useState)(S?l??"":""),[p,y]=(0,z.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[T,R]=(0,z.useState)(null),N=!d&&!e.required,A=(0,z.useMemo)(()=>{let O=f.trim().toLowerCase(),F=O===""?w:w.filter(I=>I.label.toLowerCase().includes(O));return N&&O===""?[...F,{id:Ja,label:c.clear}]:F},[w,f,N,c.clear]),[X,C]=(0,z.useState)(()=>{let O=!S&&l?A.findIndex(I=>I.id!==Ja&&I.label.toLowerCase().startsWith(l.toLowerCase())):-1;if(O>=0)return O;let F=A.findIndex(I=>I.id!==Ja&&p.includes(I.id));return F>=0?F:0});(0,z.useEffect)(()=>{C(O=>Math.min(O,Math.max(A.length-1,0)))},[A.length]),(0,z.useLayoutEffect)(()=>{v0(S?m.current:b.current,!1)},[S]);let G=(O,F)=>{let I=fh(e,O,a);return I!==null?(R(I),!1):(Be.finish(),i(O,F),!0)},Be=y0(()=>{(!d||!G(p,null))&&r()}),H=(O,F)=>{if(O){if(!d){G(O.id===Ja?null:O.id,F);return}R(null),y(I=>I.includes(O.id)?I.filter(qe=>qe!==O.id):[...I,O.id])}},D=O=>`${g}-${O}`,q=A.length>0?D(X):void 0,ae=O=>{if(!Pi(O))switch(O.key){case"Escape":O.preventDefault(),O.stopPropagation(),Be.finish(),r();return;case"ArrowDown":O.preventDefault(),O.stopPropagation(),C(F=>Math.min(F+1,A.length-1));return;case"ArrowUp":O.preventDefault(),O.stopPropagation(),C(F=>Math.max(F-1,0));return;case"Home":case"End":if(f!=="")return;O.preventDefault(),O.stopPropagation(),C(O.key==="Home"?0:A.length-1);return;case"Enter":O.preventDefault(),O.stopPropagation(),d&&kn(O)?G(p,"down"):H(A[X],O.shiftKey?"up":"down");return;case" ":if(S)return;O.preventDefault(),O.stopPropagation(),H(A[X],d?null:"down");return;case"Tab":if(s)return;O.preventDefault(),O.stopPropagation(),G(d?p:t,O.shiftKey?"left":"right");return;default:if(!S&&O.key.length===1&&!O.ctrlKey&&!O.metaKey&&!O.altKey){let F=O.key.toLowerCase(),I=X+1,St=[...A.slice(I),...A.slice(0,I)].find(We=>We.id!==Ja&&We.label.toLowerCase().startsWith(F));St&&(O.preventDefault(),O.stopPropagation(),C(A.indexOf(St)))}return}};return(0,E.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Be.onBlur,children:(0,E.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[S?(0,E.jsx)("input",{ref:m,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":n,"aria-expanded":"true","aria-controls":g,"aria-autocomplete":"list","aria-activedescendant":q,"aria-invalid":T!==null,"aria-describedby":T!==null?u:void 0,placeholder:c.filter,value:f,onChange:O=>{h(O.target.value),C(0)},onKeyDown:ae}):null,(0,E.jsx)("ul",{ref:b,className:"crewlet-sheet-editor__list",id:g,role:"listbox","aria-label":n,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":S?void 0:q,"aria-invalid":S?void 0:T!==null,"aria-describedby":!S&&T!==null?u:void 0,onKeyDown:S?void 0:ae,children:A.length===0?(0,E.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):A.map((O,F)=>{let I=O.id===Ja?p.length===0:p.includes(O.id);return(0,E.jsxs)("li",{id:D(F),role:"option","aria-selected":I,className:k("crewlet-sheet-editor__option",O.id===Ja&&"crewlet-sheet-editor__option--clear",F===X&&"crewlet-sheet-editor__option--highlight",I&&"crewlet-sheet-editor__option--selected"),onMouseDown:qe=>qe.preventDefault(),onMouseEnter:()=>C(F),onClick:()=>H(O,d?null:"down"),children:[(0,E.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:I&&O.id!==Ja?(0,E.jsx)(Zi,{size:"xs"}):null}),O.id===Ja?(0,E.jsx)("span",{className:"crewlet-sheet-cell__muted",children:O.label}):(0,E.jsx)(yx,{column:e,choice:O,context:a})]},O.id===Ja?"\0clear":O.id)})}),T!==null?(0,E.jsx)(w0,{id:u,message:T}):null,s?(0,E.jsx)(b0,{conflict:s,labels:c}):null]})})}var nn=-1;function x0({label:e,columns:t,rows:a,people:l,mode:n="edit",onEdit:i,onAddRow:r,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:g,onOpenLink:u,presence:m,sort:b,onSortChange:w,sync:S,onRetry:f,height:h,fit:p="container",onDeleteRow:y,onDismissRefused:T,locale:R,className:N,labels:A,presenceLabels:X}){let C=(0,z.useId)(),G=(0,z.useMemo)(()=>go(A),[A]),Be=(0,z.useMemo)(()=>mo(X),[X]),H=(0,z.useMemo)(()=>({people:l,locale:R,labels:G}),[l,R,G]),D=(0,z.useMemo)(()=>wh(t),[t]),q=(0,z.useMemo)(()=>Ah(D,a,b,H),[D,a,b,H]),ae=n==="edit"&&i!==void 0,O=n==="edit"&&y!==void 0,F=(0,z.useRef)(null),I=(0,z.useRef)(null),qe=(0,z.useRef)(null),[St,We]=(0,z.useState)(0),we=(0,z.useRef)(0),[Ee,ba]=(0,z.useState)(Cc),[je,M]=(0,z.useState)(Cc),[Me,Yt]=(0,z.useState)(0),[Ke,Pe]=(0,z.useState)(0),[ke,et]=(0,z.useState)(null),[ta,Fa]=(0,z.useState)(null),[j,aa]=(0,z.useState)(null),[Wa,la]=(0,z.useState)(new Map),[V,J]=(0,z.useState)({text:"",n:0}),tt=(0,z.useRef)(!1),[na,Ca]=(0,z.useState)(null),[Re,rn]=(0,z.useState)(null),Dt=(0,z.useCallback)(v=>J(x=>({text:v,n:x.n+1})),[]),A0=(0,z.useRef)(new Map);(0,z.useEffect)(()=>{let v=new Map;for(let x of a)for(let[L,B]of Object.entries(x.refused??{}))v.set(ga(x.id,L),B);for(let[x,L]of v)if(A0.current.get(x)!==L){Dt(G.notSaved(L));break}A0.current=v},[a,G,Dt]),(0,z.useLayoutEffect)(()=>{let v=()=>{let L=I.current?.offsetHeight??0;L>0&&ba(L);let B=qe.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;B>0&&M(B),Yt(F.current?.clientHeight??0)};if(v(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(v);return F.current&&x.observe(F.current),I.current&&x.observe(I.current),()=>x.disconnect()},[]);let Un=(0,z.useMemo)(()=>bh(D),[D]),Q2=(0,z.useMemo)(()=>[`${Qi}px`,...D.map((v,x)=>x===D.length-1?`minmax(${tn(v)}px, 1fr)`:`${tn(v)}px`)].join(" "),[D]),Z2=(0,z.useMemo)(()=>D.reduce((v,x)=>v+tn(x),Qi),[D]),$c=(0,z.useMemo)(()=>{let v=Qi;return D.forEach((x,L)=>{x.frozen&&(v=(Un[L]??v)+tn(x))}),v},[D,Un]),on=(0,z.useMemo)(()=>new Map(q.map((v,x)=>[v.id,x])),[q]),Oo=(0,z.useMemo)(()=>new Map(D.map((v,x)=>[v.field,x])),[D]),Bn=(0,z.useCallback)(v=>{if(!v)return null;let x=Oo.get(v.field);if(x===void 0)return null;if(v.rowId===null)return{row:nn,col:x};let L=on.get(v.rowId);return L===void 0?null:{row:L,col:x}},[Oo,on]),Pa=(0,z.useCallback)(v=>{let x=D[v.col];if(!x)return null;if(v.row===nn)return{rowId:null,field:x.field};let L=q[v.row];return L?{rowId:L.id,field:x.field}:null},[D,q]),I2=q.length>0&&D.length>0?{rowId:q[0].id,field:D[0].field}:D.length>0?{rowId:null,field:D[0].field}:null,le=Bn(ke)??Bn(I2),at=le?Pa(le):null,N0=Bn(ta)??le,Et=le&&N0&&le.row!==nn?ph(N0,le):null,z0=(0,z.useMemo)(()=>Nh(m),[m]),J2=(0,z.useMemo)(()=>zh(m),[m]),$2=(0,z.useMemo)(()=>Oh(m),[m]),O0=(0,z.useRef)(null);(0,z.useEffect)(()=>{let v=at&&at.rowId!==null?{rowId:at.rowId,field:at.field}:null,x=v?ga(v.rowId,v.field):null;x!==O0.current&&(O0.current=x,s?.(v))},[at,s]);let C0=(0,z.useRef)(null);(0,z.useEffect)(()=>{let v=j?ga(j.rowId,j.field):null;v!==C0.current&&(C0.current=v,c?.(j?{rowId:j.rowId,field:j.field}:null))},[j,c]);let Co=(0,z.useCallback)(v=>{v.length!==0&&(la(x=>{let L=new Map(x);for(let B of v)L.set(ga(B.rowId,B.field),B.error);return L}),Dt(v[0].error))},[Dt]),Ro=(0,z.useCallback)(v=>{la(x=>{if(!v.some(B=>x.has(B)))return x;let L=new Map(x);for(let B of v)L.delete(B);return L})},[]),xl=(0,z.useCallback)(v=>{v.length===0||!i||(Ro(v.map(x=>ga(x.rowId,x.field))),i(v))},[i,Ro]),sn=(0,z.useCallback)(v=>D[Oo.get(v)??-1],[D,Oo]),cn=(0,z.useCallback)(v=>q[on.get(v)??-1],[q,on]),qn=(0,z.useCallback)(v=>ae&&v!==void 0&&!v.readOnly,[ae]),Fc=(0,z.useCallback)(()=>We(v=>v+1),[]),Vn=(0,z.useCallback)((v,x=!1)=>{v&&(et(v),x||Fa(v),Fc())},[Fc]),R0=v=>{ke&&ke.rowId===v.rowId&&ke.field===v.field||(et(v),Fa(v))},ar=le?.row??null,lr=le?.col??null;(0,z.useLayoutEffect)(()=>{if(ar===null||lr===null)return;let v=F.current;if(v&&ar>=0){let x=vh(ar,v.scrollTop,v.clientHeight,Ee,je);x!==v.scrollTop&&(v.scrollTop=x,Pe(x));let L=D[lr];if(L&&!L.frozen){let B=Un[lr]??0,ce=B+tn(L);B-$c<v.scrollLeft?v.scrollLeft=Math.max(B-$c,0):ce>v.scrollLeft+v.clientWidth&&(v.scrollLeft=ce-v.clientWidth)}}St===we.current||j||(we.current=St,document.getElementById(m0(C,{row:ar,col:lr}))?.focus({preventScroll:!0}))},[ar,lr,St,j,C,Ee,je,D,Un,$c]);let Do=(0,z.useCallback)((v,x)=>{if(v.rowId===null)return;let L=sn(v.field),B=cn(v.rowId);if(!(!B||!L)){if(!qn(L)){Dt(ae?G.readOnly(L.label):G.forbidden);return}hx(L.type)&&(Ro([ga(v.rowId,v.field)]),aa({rowId:v.rowId,field:v.field,seed:x,base:Ct(L,B.values[L.field])}))}},[qn,Ro,sn,ae,G,cn,Dt]),Wc=(0,z.useCallback)(v=>{if(v.rowId===null)return;let x=sn(v.field),L=cn(v.rowId);if(!(!L||!x||x.type!=="checkbox")){if(!qn(x)){Dt(ae?G.readOnly(x.label):G.forbidden);return}xl([{rowId:L.id,field:x.field,value:Ct(x,L.values[x.field])!==!0}])}},[qn,sn,ae,xl,G,cn,Dt]),D0=(0,z.useCallback)((v,x)=>{if(x===null)return Pa(v);let L={down:{row:Math.min(v.row+1,q.length-1),col:v.col},up:{row:Math.max(v.row-1,0),col:v.col},right:{row:v.row,col:Math.min(v.col+1,D.length-1)},left:{row:v.row,col:Math.max(v.col-1,0)}}[x];return Pa(L)},[Pa,D.length,q.length]),H0=(0,z.useCallback)((v,x)=>{if(!j)return;let L=Bn({rowId:j.rowId,field:j.field}),B=sn(j.field),ce=cn(j.rowId);aa(null),v!==void 0&&B&&ce&&!Yi(v,Ct(B,ce.values[B.field]))&&xl([{rowId:ce.id,field:B.field,value:v}]);let Ve=document.activeElement,Ht=Ve!==null&&Ve!==document.body&&!!qe.current?.contains(Ve);L&&Ht&&Vn(D0(L,x))},[sn,j,xl,Vn,Bn,cn,D0]);(0,z.useEffect)(()=>{j&&!on.has(j.rowId)&&aa(null)},[j,on]);let Ho=j?cn(j.rowId):void 0,Yn=j?sn(j.field):void 0,Pc=j&&Ho&&Yn?Ct(Yn,Ho.values[Yn.field]):null,G0=!!(j&&Ho&&Yn&&!Yi(Pc,j.base)),F2=G0&&j?Ho?.changed?.[j.field]?.by??G.someone:"",Go=G0&&j&&Yn?{writer:F2,value:Ma(Yn,Pc,H)||G.empty,onKeepMine:()=>aa(v=>v&&{...v,base:Pc}),onUseTheirs:()=>{let v=Bn({rowId:j.rowId,field:j.field});aa(null),v&&Vn(Pa(v))}}:null,eu=Go?G.conflict(Go.writer,Go.value):"";(0,z.useEffect)(()=>{eu&&Dt(eu)},[eu,Dt]);let k0=v=>{j||!Et||(v.preventDefault(),v.clipboardData.setData("text/plain",_h(D,q,Et,H)))},L0=(0,z.useCallback)(()=>{if(!Et)return;if(!ae){Dt(G.forbidden);return}let v=Eh(D,q,Et,H);xl(v.edits),Co(v.refused)},[D,H,ae,xl,G.forbidden,Et,Co,q,Dt]),W2=v=>{j||!Et||(k0(v),L0())},P2=v=>{if(j||!Et)return;if(v.preventDefault(),!ae){Dt(G.forbidden);return}let x=Sh(D,q,Et,Th(v.clipboardData.getData("text/plain")),H);xl(x.edits),Co(x.refused)},eb=Math.max(1,Math.floor(Math.max(Me-je,Ee)/Ee)-1),tb=v=>{if(j||Pi(v)||!le||!at)return;let x=D[le.col],L=kn(v);if(L&&v.altKey&&v.key.toLowerCase()==="h"){o&&at.rowId!==null&&(v.preventDefault(),o({rowId:at.rowId,field:at.field}));return}if(L&&!v.altKey&&v.key.toLowerCase()==="z"){let ce=v.shiftKey?g:d;ce&&(v.preventDefault(),ce());return}if(L&&!v.altKey&&v.key.toLowerCase()==="y"){g&&(v.preventDefault(),g());return}if(L&&!v.altKey&&v.key.toLowerCase()==="a"){if(v.preventDefault(),q.length===0)return;Fa(Pa({row:0,col:0})),et(Pa({row:q.length-1,col:D.length-1})),Fc();return}if(O&&at.rowId!==null&&(v.key==="ContextMenu"||v.shiftKey&&v.key==="F10")){v.preventDefault(),rn(at.rowId);return}let B=hh(le,v,{rows:q.length,cols:D.length,page:eb});if(B){v.preventDefault();let ce=v.shiftKey&&B.row!==nn&&le.row!==nn;Vn(Pa(B),ce);return}if(v.key==="Tab"){let ce=v.shiftKey?-1:1,Ve=le.col+ce;if(Ve<0||Ve>=D.length)return;v.preventDefault(),Vn(Pa({row:le.row,col:Ve}));return}if(le.row===nn){(v.key==="Enter"||v.key===" ")&&x&&w&&(v.preventDefault(),w(Hc(b,x.field)));return}switch(v.key){case"Enter":case"F2":if(v.preventDefault(),v.key==="Enter"&&L&&x?.type==="url"){let ce=q[le.row],Ve=ce?Ct(x,ce.values[x.field]):null;typeof Ve=="string"&&Ve&&(u?u(Ve):window.open(Ve,"_blank","noopener,noreferrer"));return}x?.type==="checkbox"?Wc(at):Do(at);return;case" ":v.preventDefault(),x?.type==="checkbox"?Wc(at):x&&G2(x.type)&&Do(at," ");return;case"Delete":case"Backspace":v.preventDefault(),L0();return;case"Escape":ta&&Et&&(Et.top!==Et.bottom||Et.left!==Et.right)&&(v.preventDefault(),Fa(at));return}if(xh(v)&&x){if(x.type==="rating"&&/^\d$/.test(v.key)){if(v.preventDefault(),!qn(x)){Dt(ae?G.readOnly(x.label):G.forbidden);return}let ce=Number(v.key),Ve=q[le.row];if(!Ve)return;if(ce>yl(x)){Co([{rowId:Ve.id,field:x.field,error:G.notARating(x.label,yl(x))}]);return}xl([{rowId:Ve.id,field:x.field,value:ce===0?null:ce}]);return}G2(x.type)&&(v.preventDefault(),Do(at,x.type==="date"?void 0:v.key))}};(0,z.useEffect)(()=>{let v=()=>{tt.current=!1};return window.addEventListener("mouseup",v),()=>window.removeEventListener("mouseup",v)},[]);let U0=(v,x)=>{if(v.button!==0)return;let L=v.shiftKey&&x.rowId!==null&&at?.rowId!==null;j&&j.rowId===x.rowId&&j.field===x.field||Vn(x,L),tt.current=x.rowId!==null},ab=v=>{!tt.current||v.rowId===null||et(v)},[B0,q0]=gh(Math.max(Ke-je,0),Me,Ee,q.length),nr=[];for(let v=B0;v<=q0;v+=1)nr.push(v);if(le&&le.row>=0&&(le.row<B0||le.row>q0)&&nr.push(le.row),j){let v=on.get(j.rowId);v!==void 0&&!nr.includes(v)&&nr.push(v)}let V0=`${C}-described`,Y0=`${C}-help`,ir=le?D[le.col]:void 0,ko=le&&le.row>=0?q[le.row]:void 0,lb=ko&&ir?z0.get(ga(ko.id,ir.field))??[]:[],nb=ko&&ir?Rh(ir,wx(ko,Wa,ir.field),lb,H,Be):"",ib={"--crewlet-sheet-columns":Q2,"--crewlet-sheet-row-height":`${Ee}px`,width:`${Z2}px`},j0=je+q.length*Ee+2,rb=p==="content"?{height:`${h!==void 0?Math.min(j0,h):j0}px`}:h!==void 0?{height:`${h}px`}:void 0,ob=v=>{let x=je+v*Ee-Ke,L=Me>0?Me:Ee*12;return yh(x,x+Ee,je,L,Ee*8)};return(0,E.jsxs)("div",{className:k("crewlet-sheet-grid",n==="read"&&"crewlet-sheet-grid--read",p==="content"&&"crewlet-sheet-grid--fit-content",N),children:[(0,E.jsx)("div",{ref:I,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,E.jsx)("div",{ref:F,className:"crewlet-sheet-grid__scroller",style:rb,onScroll:v=>Pe(v.currentTarget.scrollTop),children:(0,E.jsxs)("div",{ref:qe,role:"grid","aria-label":e,"aria-rowcount":q.length+1,"aria-colcount":D.length+1,"aria-readonly":!ae||void 0,"aria-multiselectable":"true","aria-describedby":Y0,tabIndex:-1,className:"crewlet-sheet-grid__grid",style:ib,onKeyDown:tb,onMouseMove:O?v=>{let x=v.target.closest("[data-row-id]")?.dataset.rowId??null;Ca(L=>L===x?L:x)}:void 0,onMouseLeave:O?()=>Ca(null):void 0,onCopy:k0,onCut:W2,onPaste:P2,children:[(0,E.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,E.jsxs)("div",{role:"row","aria-rowindex":1,className:"crewlet-sheet-grid__row crewlet-sheet-grid__row--head",children:[(0,E.jsx)("div",{role:"columnheader","aria-colindex":1,className:"crewlet-sheet-grid__corner",children:(0,E.jsx)(Tt,{children:G.rowHeader})}),D.map((v,x)=>{let L={row:nn,col:x},B=le?.row===nn&&le.col===x,ce=b?.field===v.field?b.direction:void 0,Ve=$2.get(v.field)??[];return(0,E.jsxs)("div",{id:m0(C,L),role:"columnheader","aria-colindex":x+2,"aria-sort":ce??(w?"none":void 0),tabIndex:B?0:-1,className:k("crewlet-sheet-grid__header",v.frozen&&"crewlet-sheet-grid__cell--frozen",B&&"crewlet-sheet-grid__header--active"),style:v.frozen?{insetInlineStart:`${Un[x]}px`}:void 0,onMouseDown:Ht=>U0(Ht,{rowId:null,field:v.field}),onFocus:Ht=>{Ht.target===Ht.currentTarget&&R0({rowId:null,field:v.field})},onClick:()=>{w&&w(Hc(b,v.field))},title:w?G.sortBy(v.label):void 0,children:[(0,E.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:v.label}),(0,E.jsx)(Tt,{children:`, ${G.types[v.type]}`}),ce?(0,E.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:ce==="ascending"?(0,E.jsx)(Gh,{size:"xs"}):(0,E.jsx)(Hh,{size:"xs"})}):null,Ve.length>0?(0,E.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:Ve.map(Ht=>(0,E.jsx)(Eo,{name:Ht.name,kind:Ht.kind,size:16,decorative:!0,className:k("crewlet-sheet-grid__header-badge",an(Ht.hue))},Ht.id))}):null]},v.field)})]})}),(0,E.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${q.length*Ee}px`},children:nr.map(v=>{let x=q[v],L=J2.get(x.id);return(0,E.jsxs)("div",{role:"row","aria-rowindex":v+2,className:"crewlet-sheet-grid__row",style:{top:`${v*Ee}px`},"data-row-id":x.id,children:[(0,E.jsxs)("div",{role:"rowheader","aria-colindex":1,className:k("crewlet-sheet-grid__rownum",L&&"crewlet-sheet-grid__rownum--present",L&&an(L.hue)),children:[(0,E.jsx)("span",{"aria-hidden":"true",children:v+1}),(0,E.jsx)(Tt,{children:Gc(D,x,v,H)}),O&&(Re===x.id||na===x.id||le?.row===v)?(0,E.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,E.jsx)(H2,{label:G.rowActions(v+1),icon:(0,E.jsx)(Uh,{size:"xs"}),triggerTabIndex:-1,open:Re===x.id,onOpenChange:B=>rn(B?x.id:null),items:[{key:"delete",label:G.deleteRow,icon:(0,E.jsx)(Xh,{size:"sm"}),danger:!0,onSelect:()=>y?.(x.id)}]})}):null]}),D.map((B,ce)=>{let Ve={row:v,col:ce},Ht=ga(x.id,B.field),rr=le?.row===v&&le.col===ce,K0=Et?mh(Et,v,ce):!1,sb=x.pending?.includes(B.field)??!1,Lo=x.refused?.[B.field]??Wa.get(Ht),or=x.changed?.[B.field],X0=Ct(B,x.values[B.field]),Uo=z0.get(Ht),_l=Uo?.[0],sr=j?.rowId===x.id&&j.field===B.field;return(0,E.jsxs)("div",{id:m0(C,Ve),role:"gridcell","aria-colindex":ce+2,"aria-selected":K0,"aria-readonly":!qn(B)||void 0,"aria-describedby":rr?V0:void 0,tabIndex:rr&&!sr?0:-1,className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${B.type}`,B.frozen&&"crewlet-sheet-grid__cell--frozen",K0&&"crewlet-sheet-grid__cell--selected",rr&&"crewlet-sheet-grid__cell--active",sb&&"crewlet-sheet-grid__cell--pending",Lo!==void 0&&"crewlet-sheet-grid__cell--refused",sr&&"crewlet-sheet-grid__cell--editing",_l&&"crewlet-presence-ring",_l&&an(_l.hue),_l&&(_l.idle?"crewlet-presence-ring--idle":null)),style:B.frozen?{insetInlineStart:`${Un[ce]}px`}:void 0,onMouseDown:ia=>U0(ia,{rowId:x.id,field:B.field}),onFocus:ia=>{ia.target===ia.currentTarget&&R0({rowId:x.id,field:B.field})},onMouseEnter:()=>ab({rowId:x.id,field:B.field}),onDoubleClick:()=>{B.type!=="checkbox"&&Do({rowId:x.id,field:B.field})},onClick:ia=>{B.type==="checkbox"&&ia.target.closest(".crewlet-sheet-cell__check")&&Wc({rowId:x.id,field:B.field})},children:[(0,E.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,E.jsx)(L2,{column:B,value:X0,context:H,onOpenLink:u})}),Lo!==void 0?(0,E.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,E.jsx)(Ii,{size:"xs"})}):null,or?(0,E.jsx)(R2,{by:or.by,at:or.at,previous:Dc(or)&&Ma(B,Ct(B,or.previous),H)||null,locale:R,labels:G}):null,Uo&&_l?(0,E.jsx)(N2,{name:Ch(Uo),hue:_l.hue,kind:_l.kind,editing:Uo.some(ia=>ia.editing)}):null,rr&&Lo!==void 0&&!sr?(0,E.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:Lo}):null,rr&&o&&!sr?(0,E.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:G.history,onMouseDown:ia=>ia.stopPropagation(),onClick:()=>o({rowId:x.id,field:B.field}),children:(0,E.jsx)(jh,{size:"xs"})}):null,sr?(0,E.jsx)(q2,{column:B,value:X0,context:H,seed:j.seed,label:`${B.label}, ${Gc(D,x,v,H)}`,side:ob(v),conflict:Go,onCommit:(ia,cb)=>H0(ia,cb),onCancel:()=>H0(void 0,null)}):null]},B.field)})]},x.id)})})]})}),(0,E.jsx)(Tt,{id:V0,children:nb}),(0,E.jsx)(Tt,{id:Y0,children:O?`${G.keyboardHelp} ${G.rowActionsHelp}`:G.keyboardHelp}),(0,E.jsx)(Tt,{children:(0,E.jsx)("span",{role:"status","aria-live":"polite",children:(0,E.jsx)("span",{children:V.text},V.n)})}),r||S?(0,E.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[r&&ae?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:r,leadingIcon:(0,E.jsx)(Yh,{size:"sm"}),children:G.addRow}):null,S?(0,E.jsxs)("span",{className:k("crewlet-sheet-grid__sync",((S.failed??0)>0||!S.offline&&(S.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,E.jsx)("span",{children:G.sync(S)}),(S.failed??0)>0&&f?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:f,children:G.retry}):null,(S.failed??0)===0&&(S.refused??0)>0&&T?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:T,children:G.dismiss}):null]}):null]}):null]})}function m0(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function wx(e,t,a){let l=t.get(ga(e.id,a));return l===void 0||e.refused?.[a]!==void 0?e:{...e,refused:{...e.refused,[a]:l}}}var _0="crewlet:ready";function T0(e=window){return e.crewlet?Promise.resolve(e.crewlet):new Promise(t=>{let a=()=>{e.crewlet&&(e.removeEventListener(_0,a),t(e.crewlet))};e.addEventListener(_0,a)})}function V2(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Oa=Q(be(),1),$a={noData:"This page did not declare the db capability, so the sheet cannot load.",noColumns:e=>`The ${e} collection has no columns yet.`,loadFailed:(e,t)=>t==="forbidden"?`You do not have access to the ${e} collection.`:t==="not_found"?`There is no ${e} collection in this artifact.`:`The ${e} collection could not be loaded. Reload the page to try again.`,stepOvertaken:e=>`Somebody changed this after you, so the ${e} was skipped.`,addRowFailed:e=>`Could not add a row. ${e}`,deleteRowTitle:"Delete this row?",deleteRowMessage:"The row is removed for everyone who can open this page.",deleteRowConfirm:"Delete row",deleteRowCancel:"Cancel"};function S0(e,t){console.warn(`[crewlet artifact-kit] ${e}`,t)}function E0(e){return e.verdict==="applied"||e.verdict==="pending"?null:vo(e.verdict,e.reason,Gn)}function Ic(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return vo(t,a,Gn)}function Y2({runtime:e,collection:t,columns:a,sort:l,frozen:n,readOnly:i=!1,label:r,height:o}){let s=e.capabilities.has("db"),c=e.capabilities.has("presence"),d=e.capabilities.has("identity"),g=(0,$.useMemo)(()=>e.data.collection(t),[e,t]),[u,m]=(0,$.useState)(null),[b,w]=(0,$.useState)(void 0),[S,f]=(0,$.useState)([]),[h,p]=(0,$.useState)(null),[y,T]=(0,$.useState)(l),[R,N]=(0,$.useState)(null),[A,X]=(0,$.useState)([]),[C,G]=(0,$.useState)([]),[Be,H]=(0,$.useState)(!1),[D,q]=(0,$.useState)(0),[ae,O]=(0,$.useState)({text:"",n:0}),[F,I]=(0,$.useState)(null),qe=(0,$.useCallback)(V=>O(J=>({text:V,n:J.n+1})),[]),[,St]=(0,$.useState)(0),We=(0,$.useRef)(new Map),we=(0,$.useMemo)(()=>new Mh,[]);(0,$.useEffect)(()=>T(l),[l]),(0,$.useEffect)(()=>we.subscribe(()=>St(V=>V+1)),[we]),(0,$.useEffect)(()=>{if(!s)return;let V=!0;return e.data.schema().then(J=>{if(!V)return;let tt=J.find(na=>na.name===t)??null;w(tt?.title),a||m(Ry(tt))}).catch(J=>{S0(`the schema of ${t} could not be read`,J),V&&!a&&m([])}),()=>{V=!1}},[e,a,s,t]),(0,$.useEffect)(()=>{if(s)return p(null),g.subscribe(V=>f(V.map(J=>({id:J.id,values:J.data}))),V=>p($a.loadFailed(t,V.code)))},[g,s,t]),(0,$.useEffect)(()=>{if(!d)return;let V=!0;return e.identity.me().then(J=>{V&&N(J)}).catch(J=>S0("the reader could not be identified",J)),e.identity.people().then(J=>{V&&X(J.map(Uy))}).catch(J=>S0("the people a person cell offers could not be listed",J)),()=>{V=!1}},[e,d]);let Ee=(0,$.useMemo)(()=>ky(a??u??[],n),[a,u,n]);(0,$.useEffect)(()=>{if(c)return G(e.presence.roster().members),e.presence.subscribe(V=>G(V.members))},[e,c]),(0,$.useEffect)(()=>{if(e.connection)return H(e.connection.state==="offline"),e.connection.subscribe(V=>H(V==="offline"))},[e]);let ba=(0,$.useMemo)(()=>{let V=qy(C,We.current);return We.current=V,V},[C]),je=R?.seat??null,M=(0,$.useMemo)(()=>Vy(C,t,je,ba),[C,t,je,ba]),Me=(0,$.useMemo)(()=>Yy(C,je,ba),[C,je,ba]),Yt=(0,$.useCallback)(V=>{let J=V.map(Re=>we.begin(Re.rowId,Re.field)),tt=Re=>{for(let rn of J)rn(Re===null?{ok:!0}:{ok:!1,message:Re})},na=Re=>({[Re.field]:Re.value}),Ca;if(V.length===1){let[Re]=V;Ca=g.merge(Re.rowId,na(Re))}else{let Re=e.data.batch();for(let rn of V)Re.merge(t,rn.rowId,na(rn));Ca=Re.commit()}Ca.then(Re=>tt(E0(Re)),Re=>tt(Ic(Re)))},[t,we,e,g]),Ke=(0,$.useCallback)(()=>{g.set(V2(),{}).then(V=>{let J=E0(V);q(tt=>J===null?0:tt+1),J!==null&&qe($a.addRowFailed(J))},V=>{q(J=>J+1),qe($a.addRowFailed(Ic(V)))})},[g,qe]),Pe=(0,$.useCallback)(V=>{let J=Ee[0],tt=J?we.begin(V,J.field):()=>{};g.delete(V).then(na=>{let Ca=E0(na);if(tt(Ca===null?{ok:!0}:{ok:!1,message:Ca}),Ca===null)for(let Re of Ee)we.dismiss(V,Re.field)},na=>tt({ok:!1,message:Ic(na)}))},[Ee,we,g]),ke=(0,$.useCallback)(V=>{e.data[V]().then(J=>{J===null||J.verdict==="applied"||J.verdict==="pending"||qe(J.verdict==="conflict"?$a.stepOvertaken(V):vo(J.verdict,J.reason,Gn))},J=>qe(Ic(J)))},[e,qe]),et=(0,$.useRef)({active:null,editing:null}),ta=(0,$.useCallback)(()=>{if(!c)return;let{active:V,editing:J}=et.current,tt=J??V,na=tt?{collection:t,doc:tt.rowId,field:tt.field}:{};e.presence.set({activity:J?"editing":"viewing",focus:na})},[e,c,t]),Fa=(0,$.useCallback)(V=>{et.current.active=V,ta()},[ta]),j=(0,$.useCallback)(V=>{et.current.editing=V,ta()},[ta]);if(!s)return(0,Oa.jsx)(Ji,{variant:"warning",children:$a.noData});if(h!==null)return(0,Oa.jsx)(Ji,{variant:"warning",children:h});if(Ee.length===0&&(a!==null||u!==null))return(0,Oa.jsx)(Ji,{variant:"neutral",children:$a.noColumns(t)});let aa=i||R?.role==="viewer",Wa={...we.sync(Be),failed:D},la=F===null?void 0:S.find(V=>V.id===F);return(0,Oa.jsxs)("div",{className:"crewlet-kit-sheet",children:[Me.length>0?(0,Oa.jsx)("div",{className:"crewlet-kit-sheet__presence",children:(0,Oa.jsx)(f0,{members:Me})}):null,(0,Oa.jsx)(x0,{label:r??b??t,columns:Ee,rows:we.decorate(S),people:A,mode:aa?"read":"edit",onEdit:aa?void 0:Yt,onAddRow:aa?void 0:Ke,onDeleteRow:aa?void 0:I,onActiveCellChange:Fa,onEditingChange:j,onUndo:()=>ke("undo"),onRedo:()=>ke("redo"),presence:M,sort:y,onSortChange:T,sync:Wa,onRetry:D>0?Ke:void 0,onDismissRefused:()=>we.dismissAll(),height:o,fit:"content"}),(0,Oa.jsx)(Wh,{open:la!==void 0,onClose:()=>I(null),onConfirm:()=>{la&&Pe(la.id),I(null)},title:$a.deleteRowTitle,message:$a.deleteRowMessage,confirmLabel:$a.deleteRowConfirm,cancelLabel:$a.deleteRowCancel,destructive:!0}),ae.text?(0,Oa.jsx)(Ji,{variant:"warning",live:"polite",children:ae.text},ae.n):null]})}var X2=Q(be(),1);function K2(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let l=(0,j2.createRoot)(a),n=t,i=t.runtime??null,r=!1,o=()=>{r||!i||l.render((0,X2.jsx)(Y2,{runtime:i,collection:n.collection,columns:n.columns&&n.columns.length>0?n.columns:null,sort:n.sort??null,frozen:n.frozen,readOnly:n.readOnly,label:n.label,height:n.height}))};return i?o():T0(e.ownerDocument.defaultView??window).then(s=>{i=s,o()}),{update(s){n=s,s.runtime&&(i=s.runtime),o()},unmount(){r=!0,l.unmount(),a.remove()}}}var zo=class extends HTMLElement{static get observedAttributes(){return Dy}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return Hy(t=>this.getAttribute(t))}},xx=["collection","sort","frozen","readonly","label","height"],Jc=class extends HTMLElement{constructor(){super(...arguments);el(this,"mounted",null);el(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);el(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return xx}connectedCallback(){this.addEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.observe(this,{childList:!0}),this.refresh()}disconnectedCallback(){this.removeEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.disconnect(),this.mounted?.unmount(),this.mounted=null}attributeChangedCallback(){this.isConnected&&this.refresh()}options(){let a=this.getAttribute("collection")?.trim();if(!a)return null;let l=[...this.children].filter(s=>s instanceof zo).map(s=>s.toColumn()).filter(s=>s!==null),n=Number(this.getAttribute("frozen")),i=Number(this.getAttribute("height")),r={collection:a,columns:l,sort:Gy(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(n)&&n>=0&&(r.frozen=n),this.hasAttribute("height")&&Number.isFinite(i)&&i>0&&(r.height=i);let o=this.getAttribute("label")?.trim();return o&&(r.label=o),r}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=K2(this,a)}};function M0(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",zo),e.get("crewlet-sheet")||e.define("crewlet-sheet",Jc)}M0();export{zo as CrewletColumnElement,Jc as CrewletSheetElement,_0 as RUNTIME_READY_EVENT,M0 as defineElements,K2 as mountSheet,T0 as whenRuntime};
12
+ `?(a.push(l),t.push(a),a=[],l=""):l+=o,i+=1}return(l!==""||a.length>0)&&(a.push(l),t.push(a)),t}function Sh(e,t,a,l,n){let i={edits:[],refused:[]};if(l.length===0)return i;let r=l.length===1&&l[0].length===1,o=r?a.bottom-a.top+1:l.length,s=r?a.right-a.left+1:Math.max(...l.map(c=>c.length));for(let c=0;c<o;c+=1){let d=t[a.top+c];if(!d)break;for(let g=0;g<s;g+=1){let u=e[a.left+g];if(!u)break;if(u.readOnly)continue;let m=r?l[0][0]:l[c]?.[g];if(m===void 0)continue;let b=Xi(u,m,n);if(!b.ok){i.refused.push({rowId:d.id,field:u.field,error:b.error});continue}Yi(b.value,Ct(u,d.values[u.field]))||i.edits.push({rowId:d.id,field:u.field,value:b.value})}}return i}function Eh(e,t,a,l){let n={edits:[],refused:[]};for(let i=a.top;i<=a.bottom;i+=1){let r=t[i];if(r)for(let o=a.left;o<=a.right;o+=1){let s=e[o];if(!s||s.readOnly)continue;let c=s.type==="checkbox"?!1:s.type==="multiselect"?[]:null;if(!Yi(Ct(s,r.values[s.field]),c)){if(s.required&&s.type!=="checkbox"){n.refused.push({rowId:r.id,field:s.field,error:l.labels.required(s.label)});continue}n.edits.push({rowId:r.id,field:s.field,value:c})}}}return n}function vo(e,t,a){if(e==="forbidden"||e==="capability_not_declared")return a.forbidden;let l=t?.trim();return l||a.couldNotSave}var Ac=(e,t)=>`${e}\0${t}`,Mh=class{constructor(){el(this,"waiting",new Map);el(this,"refusals",new Map);el(this,"listeners",new Set);el(this,"failed",0)}begin(e,t){let a=Ac(e,t);this.refusals.delete(a),this.waiting.set(a,(this.waiting.get(a)??0)+1),this.emit();let l=!1;return n=>{if(l)return;l=!0;let i=(this.waiting.get(a)??1)-1;i<=0?this.waiting.delete(a):this.waiting.set(a,i),n.ok||(this.refusals.set(a,n.message),this.failed+=1),this.emit()}}isPending(e,t){return this.waiting.has(Ac(e,t))}refusal(e,t){return this.refusals.get(Ac(e,t))}dismiss(e,t){this.refusals.delete(Ac(e,t))&&this.emit()}get saving(){let e=0;for(let t of this.waiting.values())e+=t;return e}dismissAll(){this.refusals.size!==0&&(this.refusals.clear(),this.emit())}sync(e=!1){return{saving:this.saving,offline:e,refused:this.refusals.size}}get failures(){return this.failed}resetFailures(){this.failed=0}decorate(e){return this.waiting.size===0&&this.refusals.size===0?[...e]:e.map(t=>{let a=[],l={};for(let n of this.waiting.keys()){let[i,r]=n.split("\0");i===t.id&&a.push(r)}for(let[n,i]of this.refusals){let[r,o]=n.split("\0");r===t.id&&(l[o]=i)}return a.length===0&&Object.keys(l).length===0?t:{...t,pending:[...t.pending??[],...a],refused:{...t.refused,...l}}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(){for(let e of this.listeners)e()}};function My(e,t){let a=e instanceof Date?e:new Date(e);return Number.isNaN(a.getTime())?"":new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit"}).format(a)}function Rc(e,t,a,l){return t.changed(e.by,My(e.at,l),a)}var Dc=e=>e.previous!==void 0;function Ah(e,t,a,l){if(!a)return[...t];let n=e.find(r=>r.field===a.field);if(!n)return[...t];let i=a.direction==="descending"?-1:1;return t.map((r,o)=>({row:r,index:o,value:Ct(n,r.values[n.field])})).sort((r,o)=>{let s=c=>c===null||c===""||Array.isArray(c)&&c.length===0;return n.type!=="checkbox"&&(s(r.value)||s(o.value))?s(r.value)===s(o.value)?r.index-o.index:s(r.value)?1:-1:i*Sy(n,r.value,o.value,l)||r.index-o.index}).map(({row:r})=>r)}function Hc(e,t){return!e||e.field!==t?{field:t,direction:"ascending"}:e.direction==="ascending"?{field:t,direction:"descending"}:null}var ga=(e,t)=>`${e}\0${t}`;function Nh(e){let t=new Map;for(let a of e??[]){let l=ga(a.rowId,a.field),n=t.get(l);n?n.push(a):t.set(l,[a])}for(let a of t.values())a.sort((l,n)=>+!!n.editing-+!!l.editing);return t}function zh(e){let t=new Map;for(let a of e??[])t.has(a.rowId)||t.set(a.rowId,a);return t}function Oh(e,t=2){let a=new Map;for(let l of e??[]){let n=a.get(l.field)??[];n.length<t&&!n.some(i=>i.id===l.id)&&n.push(l),a.set(l.field,n)}return a}function Ch(e){return e.map(t=>t.name).join(", ")}function Rh(e,t,a,l,n=po){let{labels:i}=l,r=[`${e.label}.`];e.readOnly&&r.push(i.readOnly(e.label)),t.pending?.includes(e.field)&&r.push(`${i.saving}.`);let o=t.refused?.[e.field];o&&r.push(o);let s=a.map(d=>d.name);s.length>0&&r.push(n.alsoHere(s));let c=t.changed?.[e.field];if(c){let d=Dc(c)&&Ma(e,Ct(e,c.previous),l)||null;r.push(Rc(c,i,d,l.locale))}return r.join(" ")}function Gc(e,t,a,l){let n=e.find(i=>i.type==="text");if(n){let i=Ma(n,Ct(n,t.values[n.field]),l);if(i)return i}return String(a+1)}var Dh=Q(wt(),1),Oy=Q(be(),1),i5=(0,Dh.createContext)(2);function Cy({level:e,children:t}){return(0,Oy.jsx)(i5.Provider,{value:e,children:t})}function k(...e){return e.filter(Boolean).join(" ")}var r5=["todo","in_progress","done","blocked"];function o5(e){if(e.options)return e.options.map(t=>{let a={id:t.id,label:t.label};return t.color&&(a.color=t.color),t.category&&r5.includes(t.category)&&(a.category=t.category),t.archived&&(a.archived=!0),a})}function Ry(e){let t=[];for(let a of e?.columns??[]){if(a.hidden)continue;let l=a.type,n=Nc(l),i={field:a.key,label:a.label||a.key,type:n?l:"text"};n||(i.readOnly=!0),a.primary&&(i.frozen=!0),a.required&&(i.required=!0),a.min!==void 0&&(i.min=a.min),a.max!==void 0&&(i.max=a.max),a.max_length!==void 0&&(i.maxLength=a.max_length),a.max_items!==void 0&&(i.maxItems=a.max_items);let r=o5(a);r&&(i.options=r),t.push(i)}return t}function s5(e,t){let a=t.trim();if(a===""||a==="plain")return;let l=/^currency:([A-Za-z]{3})$/.exec(a);if(l){e.numberStyle="currency",e.currency=l[1].toUpperCase();return}if(a==="percent"){e.numberStyle="percent";return}let n=/^0(?:\.(0+))?(%)?$/.exec(a);n&&(e.precision=n[1]?.length??0,n[2]&&(e.numberStyle="percent"))}var yo=e=>{if(e===null||e.trim()==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0},Dy=["field","type","label","format","options","width","readonly","required","frozen","min","max","max-length","max-items","time"];function Hy(e){let t=e("field")?.trim();if(!t)return null;let a=e("type")?.trim()??"text",l=Nc(a),n={field:t,label:e("label")?.trim()||t,type:l?a:"text"};(!l||e("readonly")!==null)&&(n.readOnly=!0),e("required")!==null&&(n.required=!0),e("frozen")!==null&&(n.frozen=!0),e("time")!==null&&(n.time=!0);let i=yo(e("width"));i!==void 0&&(n.width=i);let r=yo(e("min"));r!==void 0&&(n.min=r);let o=yo(e("max"));o!==void 0&&(n.max=o);let s=yo(e("max-length"));s!==void 0&&(n.maxLength=s);let c=yo(e("max-items"));c!==void 0&&(n.maxItems=c);let d=e("options");d&&(n.options=dh(d));let g=e("format");return g&&n.type==="number"&&s5(n,g),n}function Gy(e){let t=e?.trim();return t?t.startsWith("-")?{field:t.slice(1),direction:"descending"}:{field:t,direction:"ascending"}:null}function ky(e,t){return t===void 0?[...e]:e.map((a,l)=>l<t?{...a,frozen:!0}:a)}var Ly=e=>e!==void 0&&ho(e)?e:void 0;function Uy(e){let t={id:e.seat,name:e.displayName,kind:e.kind},a=Ly(e.avatar?.hue);return a&&(t.hue=a),e.avatar?.character&&(t.character=e.avatar.character),t}function By(e,t){return e.filter(a=>a.seat!==t)}function qy(e,t){return oh(e.map(a=>({id:a.session,kind:a.kind,hue:Ly(a.avatar?.hue)})),t)}function Vy(e,t,a,l){let n=[];for(let i of By(e,a)){let r=i.focus;r.collection!==t||!r.doc||!r.field||n.push({rowId:r.doc,field:r.field,id:i.session,name:i.displayName,kind:i.kind,hue:l.get(i.session)??"purple",editing:i.activity==="editing",idle:i.activity==="idle"})}return n}function Yy(e,t,a){return By(e,t).map(l=>{let n={id:l.session,seat:l.seat,name:l.displayName,kind:l.kind,activity:l.activity},i=a.get(l.session);return i&&(n.hue=i),l.avatar?.character&&(n.character=l.avatar.character),n})}var $=Q(wt(),1);var Ky=Q(be(),1),jy={xs:12,sm:14,md:16,lg:20,xl:24},Xy=1.75,c5=`var(--crewlet-glyph-stroke, ${Xy})`;function u5(e){return e===void 0?"1em":typeof e=="number"?`${e}px`:e in jy?`${jy[e]}px`:e}function ot({size:e,title:t,filled:a=!1,fillable:l,className:n,style:i,children:r,...o}){let s=u5(e);return(0,Ky.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,stroke:"currentColor",...t?{role:"img","aria-label":t}:{"aria-hidden":!0,focusable:!1},className:n===void 0?"crewlet-glyph":`crewlet-glyph ${n}`,...o,viewBox:"0 0 24 24",fill:l&&a?"currentColor":"none",strokeWidth:Xy,strokeLinecap:"round",strokeLinejoin:"round",style:{...i,strokeWidth:c5},children:r})}var U=Q(be(),1);function Hh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M12 5v14"}),(0,U.jsx)("path",{d:"m19 12-7 7-7-7"})]})}function Gh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"m5 12 7-7 7 7"}),(0,U.jsx)("path",{d:"M12 19V5"})]})}function Zi(e){return(0,U.jsx)(ot,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"M20 6 9 17l-5-5"})})}function kh(e){return(0,U.jsx)(ot,{...e,fillable:!1,children:(0,U.jsx)("path",{d:"m15 18-6-6 6-6"})})}function Ii(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("line",{x1:"12",x2:"12",y1:"8",y2:"12"}),(0,U.jsx)("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"})]})}function Lh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"m16 9-5.5 5.5L8 12"})]})}function Uh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"19",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"5",cy:"12",r:"1"})]})}function Bh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"5",r:"1"}),(0,U.jsx)("circle",{cx:"12",cy:"19",r:"1"})]})}function qh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M15 3h6v6"}),(0,U.jsx)("path",{d:"M10 14 21 3"}),(0,U.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Lc(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,U.jsx)("path",{d:"M12 16v-4"}),(0,U.jsx)("path",{d:"M12 8h.01"})]})}function Vh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("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"}),(0,U.jsx)("path",{d:"m15 5 4 4"})]})}function Yh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M5 12h14"}),(0,U.jsx)("path",{d:"M12 5v14"})]})}function jh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,U.jsx)("path",{d:"M3 3v5h5"}),(0,U.jsx)("path",{d:"M12 7v5l4 2"})]})}function Kh(e){return(0,U.jsx)(ot,{...e,fillable:!0,children:(0,U.jsx)("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"})})}function Xh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M10 11v6"}),(0,U.jsx)("path",{d:"M14 11v6"}),(0,U.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),(0,U.jsx)("path",{d:"M3 6h18"}),(0,U.jsx)("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}function Qh(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("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"}),(0,U.jsx)("path",{d:"M12 9v4"}),(0,U.jsx)("path",{d:"M12 17h.01"})]})}function bo(e){return(0,U.jsxs)(ot,{...e,fillable:!1,children:[(0,U.jsx)("path",{d:"M18 6 6 18"}),(0,U.jsx)("path",{d:"m6 6 12 12"})]})}var va=Q(be(),1),d5={neutral:(0,va.jsx)(Lc,{size:"md"}),info:(0,va.jsx)(Lc,{size:"md"}),success:(0,va.jsx)(Lh,{size:"md"}),warning:(0,va.jsx)(Qh,{size:"md"}),danger:(0,va.jsx)(Ii,{size:"md"})},Ji=({variant:e="info",title:t,icon:a,layout:l="card",action:n,live:i,className:r,children:o,...s})=>(0,va.jsxs)("div",{...s,"aria-live":i,className:k("crewlet-callout",`crewlet-callout--${e}`,`crewlet-callout--${l}`,r),children:[(0,va.jsx)("span",{className:"crewlet-callout__icon","aria-hidden":!0,children:a??d5[e]}),(0,va.jsxs)("div",{className:"crewlet-callout__content",children:[t?(0,va.jsx)("span",{className:"crewlet-callout__title",children:t}):null,o]}),n?(0,va.jsx)("div",{className:"crewlet-callout__action",children:n}):null]});var wo=Q(wt(),1),Qy=Q(be(),1),$i="crewlet:viewchange",ea=4;function Uc(e,t,a,l=ea,n="below"){let i=e.y+e.height+l,r=e.y-l-t.height,o=a.y+a.height-i,s=e.y-l-a.y,d=(n==="below"?o>=t.height||o>=s:s>=t.height||s>=o)?n:n==="below"?"above":"below",g=d==="below"?i:r,u=a.y+a.height-t.height,m=Math.max(a.y,Math.min(g,u)),b=a.x+a.width-t.width;return{left:Math.max(a.x,Math.min(e.x,b)),top:m,side:d}}function Bc(){return{x:0,y:0,width:window.innerWidth,height:window.innerHeight}}function qc(e,t){return e.x+e.width<t.x||e.y+e.height<t.y||e.x>t.x+t.width||e.y>t.y+t.height}var f5=(0,wo.createContext)(null);function Fi(){let e=(0,wo.useContext)(f5);return e||(typeof document>"u"?null:document.body)}var Ae=Q(wt(),1);var Zh={duration:{instant:"75ms",fast:"120ms",base:"150ms",moderate:"200ms",slow:"300ms",breath:"2200ms"},easing:{default:"ease",out:"ease-out",inOut:"ease-in-out",emphasized:"cubic-bezier(0.16, 1, 0.3, 1)",spring:"cubic-bezier(0.34, 1.56, 0.64, 1)"}};var Ih={base:"0",raised:"1",sticky:"10",presence:"20",dropdown:"100",overlay:"200",layerBase:"9000",layerMax:"9899",modal:"9999",popover:"10000",toast:"10001"};var Zy=Symbol.for("crewlet.layer-stack");function h5(){let e=globalThis,t=e[Zy];if(t)return t;let a={entries:[],opened:0,armed:null,listeners:new Set,version:0,locks:0,restore:null};return e[Zy]=a,a}var ge=h5();function Iy(){ge.version+=1;for(let e of[...ge.listeners])e()}function p5(e){return ge.listeners.add(e),()=>ge.listeners.delete(e)}function Wi(e){let t;for(let a of ge.entries)e&&a.kind!==e||(!t||a.order>t.order)&&(t=a);return t}var Jh={base:Number(Ih.layerBase),max:Number(Ih.layerMax)};function m5(e){let t=0;for(let a of ge.entries)a.order<e&&(t+=1);return t}function g5(e){return e===0?Jh.base:Math.min(Jh.base+m5(e),Jh.max)}var v5=229;function Pi(e){let t="nativeEvent"in e&&e.nativeEvent||e;return!!t.isComposing||t.keyCode===v5}function xo(e){let t=["a[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","[contenteditable='true']","[tabindex]"].join(",");return[...e.querySelectorAll(t)].filter(a=>a.tabIndex>=0&&!a.disabled&&!a.closest("[hidden],[inert]")&&(typeof a.checkVisibility!="function"||a.checkVisibility()))}function Jy(e){if(Pi(e))return;if(e.key==="Escape"){if(e.defaultPrevented)return;let c=Wi();if(!c)return;e.preventDefault(),c.dismissable()&&c.dismiss("escape");return}if(e.key!=="Tab"||e.defaultPrevented)return;let t=Wi("modal"),a=t?.panel();if(!t||!a)return;let l=Wi("popup"),n=document.activeElement;if(l&&l.order>t.order&&n&&l.panel()?.contains(n))return;let i=xo(a);if(i.length===0){e.preventDefault(),a.focus();return}let r=i[0],o=i[i.length-1];if(!(n instanceof Node)||!a.contains(n)){e.preventDefault(),(e.shiftKey?o:r).focus();return}let s=c=>(n.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING)!==0;e.shiftKey&&!i.some(c=>c!==n&&!s(c))?(e.preventDefault(),o.focus()):!e.shiftKey&&!i.some(c=>c!==n&&s(c))&&(e.preventDefault(),r.focus())}function $y(e){ge.armed=null;let t=Wi();if(!t||!(e.target instanceof Node))return;let a=e.target;if(t.kind==="modal"){a===t.veil()&&(ge.armed=t);return}[t.panel(),...t.inside()].some(n=>n?.contains(a))||t.dismissable()&&t.dismiss("outside")}function Fy(e){let t=ge.armed;ge.armed=null,!(!t||t!==Wi()||e.target!==t.veil())&&t.dismissable()&&t.dismiss("outside")}function Wy(e){return ge.entries.length===0&&(document.addEventListener("keydown",Jy),document.addEventListener("pointerdown",$y,!0),document.addEventListener("click",Fy,!0)),ge.entries.push(e),Iy(),()=>{let t=ge.entries.indexOf(e);t>=0&&ge.entries.splice(t,1),ge.armed===e&&(ge.armed=null),ge.entries.length===0&&(document.removeEventListener("keydown",Jy),document.removeEventListener("pointerdown",$y,!0),document.removeEventListener("click",Fy,!0)),Iy()}}function Py(e){let t=(0,Ae.useRef)(0);return e&&t.current===0&&(t.current=++ge.opened),e||(t.current=0),t.current}function y5(e){if(!e)return[];let t;for(let l of ge.entries)l.kind!=="modal"||!l.panel()?.contains(e)||(!t||l.order>t.order)&&(t=l);let a=t?.panel();return t&&a?[e,a,...t.returnTo]:[e]}function e2(e){return(0,Ae.useSyncExternalStore)(p5,()=>ge.version,()=>0),{zIndex:g5(e),isTopmost:e!==0&&Wi()?.order===e}}function t2({onClose:e,dismissable:t=!0,initialFocus:a}){let l=(0,Ae.useRef)(null),n=(0,Ae.useRef)(null),i=(0,Ae.useRef)(e),r=(0,Ae.useRef)(t),o=(0,Ae.useRef)(a);i.current=e,r.current=t,o.current=a;let s=Py(!0),[c]=(0,Ae.useState)(()=>typeof document>"u"?[]:y5(document.activeElement)),d=e2(s);(0,Ae.useLayoutEffect)(()=>Wy({kind:"modal",order:s,panel:()=>l.current,returnTo:c,veil:()=>n.current,inside:()=>[],dismiss:()=>i.current(),dismissable:()=>r.current}),[s,c]),(0,Ae.useEffect)(()=>{let m=l.current;return m&&!m.contains(document.activeElement)&&(o.current?.()??xo(m)[0]??m).focus(),()=>{let b=document.activeElement;if(!(b&&ge.entries.some(w=>w.panel()?.contains(b)))){for(let w of c)if(!(!(w instanceof HTMLElement)||!w.isConnected||w===document.body)&&(w.focus(),document.activeElement===w))return}}},[c]);let g=(0,Ae.useCallback)(m=>{l.current=m},[]),u=(0,Ae.useCallback)(m=>{n.current=m},[]);return{panelRef:g,veilRef:u,...d}}function Vc({open:e,onDismiss:t}){let a=(0,Ae.useRef)(null),l=(0,Ae.useRef)(null),n=(0,Ae.useRef)(t);n.current=t;let i=Py(e),r=e2(i);(0,Ae.useLayoutEffect)(()=>{if(e)return Wy({kind:"popup",order:i,panel:()=>a.current,returnTo:[],veil:()=>null,inside:()=>[l.current],dismiss:c=>n.current(c),dismissable:()=>!0})},[e,i]);let o=(0,Ae.useCallback)(c=>{a.current=c},[]),s=(0,Ae.useCallback)(c=>{l.current=c},[]);return{panelRef:o,insideRef:s,...r}}function a2(e){(0,Ae.useLayoutEffect)(()=>{if(!(!e||typeof document>"u"))return ge.locks===0&&(ge.restore=document.body.style.overflow,document.body.style.overflow="hidden"),ge.locks+=1,()=>{ge.locks-=1,ge.locks===0&&(document.body.style.overflow=ge.restore??"",ge.restore=null)}},[e])}var l2=Q(be(),1);function Tt({as:e="span",id:t,className:a,children:l}){return(0,l2.jsx)(e,{id:t,className:k("crewlet-visually-hidden",a),children:l})}var Aa=Q(wt(),1);var st=Q(be(),1);function n2({variant:e="primary",size:t="medium",shape:a="square",block:l,className:n},i){return k("crewlet-btn",`crewlet-btn--${e}`,`crewlet-btn--${t}`,`crewlet-btn--${a}`,l&&"crewlet-btn--block",i,n)}function $h({leadingIcon:e,trailingIcon:t,loading:a,children:l}){return(0,st.jsxs)(st.Fragment,{children:[a?(0,st.jsx)("span",{className:"crewlet-btn__spinner","aria-hidden":!0}):e?(0,st.jsx)("span",{className:"crewlet-btn__icon",children:e}):null,(0,st.jsx)("span",{className:"crewlet-btn__label",children:l}),t?(0,st.jsx)("span",{className:"crewlet-btn__icon",children:t}):null]})}var Na=(0,Aa.forwardRef)(function({variant:t="primary",size:a="medium",shape:l="square",leadingIcon:n,trailingIcon:i,block:r,className:o,type:s="button",asChild:c=!1,loading:d=!1,pressed:g,disabledReason:u,disabled:m,onClick:b,title:w,children:S,...f},h){let p=(0,Aa.useId)(),T=n2({variant:t,size:a,shape:l,block:r,className:o},d?"crewlet-btn--loading":void 0);if(c){let N=Aa.Children.only(S);if(!(0,Aa.isValidElement)(N))throw new Error("Button with asChild expects exactly one valid React element child.");let A=N;return(0,Aa.cloneElement)(A,{...f,title:w,className:k(A.props.className,T)},(0,st.jsx)($h,{leadingIcon:n,trailingIcon:i,children:A.props.children}))}let R=d||u!==void 0;return(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)("button",{...f,ref:h,type:s,className:T,disabled:m,title:w,"aria-label":f["aria-label"]??(S===void 0?w:void 0),"aria-pressed":g,"aria-busy":d||void 0,"aria-disabled":R||void 0,"aria-describedby":u===void 0?f["aria-describedby"]:k(f["aria-describedby"],p),onClick:N=>{if(R){N.preventDefault();return}b?.(N)},children:(0,st.jsx)($h,{leadingIcon:n,trailingIcon:i,loading:d,children:S})}),u===void 0?null:(0,st.jsx)(Tt,{id:p,children:u})]})}),oT=(0,Aa.forwardRef)(function({variant:t="primary",size:a="medium",shape:l="square",leadingIcon:n,trailingIcon:i,block:r,className:o,external:s=!1,title:c,children:d,...g},u){let m=i??(s?(0,st.jsx)(qh,{size:"sm"}):void 0);return(0,st.jsx)("a",{...g,ref:u,className:n2({variant:t,size:a,shape:l,block:r,className:o}),title:c,"aria-label":g["aria-label"]??(d===void 0?c:void 0),target:s?"_blank":g.target,rel:s?"noreferrer":g.rel,children:(0,st.jsx)($h,{leadingIcon:n,trailingIcon:m,children:d})})});var Ia=Q(wt(),1),Ln=Q(be(),1),_o=(0,Ia.forwardRef)(function({label:t,icon:a,size:l="md",variant:n="ghost",pressed:i,disabledReason:r,className:o,type:s="button",asChild:c=!1,disabled:d,onClick:g,title:u,children:m,...b},w){let S=(0,Ia.useId)(),f=k("crewlet-icon-btn",`crewlet-icon-btn--${l}`,`crewlet-icon-btn--${n}`,o),h=a??m;if(c){let y=Ia.Children.only(m);if(!(0,Ia.isValidElement)(y))throw new Error("IconButton with asChild expects exactly one valid React element child.");let T=y;return(0,Ia.cloneElement)(T,{...b,"aria-label":t,title:u??t,className:k(T.props.className,f)})}let p=r!==void 0;return(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)("button",{...b,ref:w,type:s,className:f,disabled:d,title:u??t,"aria-label":t,"aria-pressed":i,"aria-disabled":p||void 0,"aria-describedby":p?k(b["aria-describedby"],S):b["aria-describedby"],onClick:y=>{if(p){y.preventDefault();return}g?.(y)},children:h}),p?(0,Ln.jsx)(Tt,{id:S,children:r}):null]})});var za=Q(wt(),1),r2=Q(hr(),1);var oe=Q(be(),1);function o2({open:e,...t}){let a=Fi();return e&&a?(0,oe.jsx)(w5,{container:a,...t},b5(a)):null}var i2=new WeakMap,Fh=0;function b5(e){let t=i2.get(e);return t!==void 0?t:(Fh+=1,i2.set(e,Fh),Fh)}function vt(e){return e!=null&&e!==!1&&e!==""}function w5({container:e,onClose:t,title:a,subtitle:l,icon:n,footer:i,footerStart:r,headerActions:o,onBack:s,backLabel:c="Back",children:d,size:g="sm",variant:u="dialog",shape:m="framed",placement:b,role:w="dialog",dismissable:S=!0,closeOnBackdrop:f=!0,backdrop:h="veil",showCloseButton:p=!0,stackBody:y=!1,flush:T=!1,className:R,ariaLabel:N,describedBy:A,initialFocus:X,onSubmit:C,closeLabel:G="Close",closeDisabledReason:Be="Closing is unavailable until this finishes.",...H}){let D=(0,za.useId)(),q=`${D}-title`,ae=`${D}-subtitle`,O=m==="prompt"&&u==="dialog",F=!O,I=u==="sheet",qe=b??(O?"center":"top"),St=(0,za.useRef)(null),We=(0,za.useRef)(null),we=(0,za.useRef)(null),Ee=(0,za.useRef)(X);Ee.current=X;let ba=(0,za.useCallback)(()=>{let ke=Ee.current?.();if(ke)return ke;let et=We.current?xo(We.current)[0]:void 0;return et||((we.current?xo(we.current)[0]:void 0)??St.current)},[]),je=t2({onClose:t,dismissable:S,initialFocus:ba});a2(!0);let M=vt(a)?q:void 0,Me=A??(vt(l)?ae:void 0),Yt={...H,ref:ke=>{St.current=ke,je.panelRef(ke)},className:k("crewlet-modal",`crewlet-modal--${u}`,u==="dialog"?`crewlet-modal--${g}`:void 0,O?"crewlet-modal--prompt":void 0,R),role:w,"aria-modal":!0,"aria-labelledby":M,"aria-label":M===void 0?N:void 0,"aria-describedby":Me,tabIndex:-1},Ke=F&&p,Pe=(0,oe.jsxs)(oe.Fragment,{children:[F&&(vt(a)||vt(l)||vt(o)||Ke||s)?(0,oe.jsxs)("div",{className:k("crewlet-modal__header",I?"crewlet-modal__header--sheet":void 0),children:[s?(0,oe.jsx)(_o,{className:"crewlet-modal__back",label:c,icon:(0,oe.jsx)(kh,{size:"md"}),onClick:s}):null,vt(n)?(0,oe.jsx)("span",{className:"crewlet-modal__icon","aria-hidden":"true",children:n}):null,(0,oe.jsxs)("div",{className:"crewlet-modal__heading",children:[vt(a)?(0,oe.jsx)("p",{className:k("crewlet-modal__title",I?"crewlet-modal__title--sheet":void 0),id:q,children:a}):null,vt(l)?(0,oe.jsx)("p",{className:"crewlet-modal__subtitle",id:ae,children:l}):null]}),vt(o)?(0,oe.jsx)("div",{className:"crewlet-modal__actions",children:o}):null,Ke?(0,oe.jsx)(_o,{className:"crewlet-modal__close",label:G,icon:(0,oe.jsx)(bo,{size:"md"}),onClick:t,disabledReason:S?void 0:Be}):null]}):null,vt(d)||O&&vt(a)?(0,oe.jsxs)("div",{ref:We,className:k("crewlet-modal__body",y?"crewlet-modal__body--stacked":void 0,T?"crewlet-modal__body--flush":void 0,I?"crewlet-modal__body--sheet":void 0),children:[O&&vt(a)?(0,oe.jsx)("p",{className:"crewlet-modal__prompt-title",id:q,children:a}):null,(0,oe.jsx)(Cy,{level:2,children:d})]}):null,vt(i)||vt(r)?(0,oe.jsxs)("div",{ref:we,className:k("crewlet-modal__footer",I?"crewlet-modal__footer--sheet":void 0),children:[vt(r)?(0,oe.jsx)("div",{className:"crewlet-modal__footer-start",children:r}):null,(0,oe.jsx)("div",{className:"crewlet-modal__footer-end",children:i})]}):null]});return(0,r2.createPortal)((0,oe.jsx)("div",{ref:f?je.veilRef:void 0,className:k("crewlet-modal-overlay",`crewlet-modal-overlay--${u}`,`crewlet-modal-overlay--${qe}`,h==="clear"&&"crewlet-modal-overlay--clear",e===document.body?"crewlet-modal-overlay--fixed":"crewlet-modal-overlay--in-host"),role:"presentation",style:{zIndex:je.zIndex},children:(0,oe.jsx)("div",{...Yt,children:C?(0,oe.jsx)("form",{className:"crewlet-modal__form",onSubmit:ke=>{ke.preventDefault(),C()},children:Pe}):Pe})}),e)}function Wh({open:e,onClose:t,onConfirm:a,title:l,message:n,children:i,confirmLabel:r="Confirm",cancelLabel:o="Cancel",destructive:s=!1,confirmVariant:c,cancelVariant:d="ghost",confirmDisabled:g=!1,confirmDisabledReason:u="Complete the confirmation above to continue.",submitting:m=!1,busyReason:b="Waiting for this to finish.",shape:w="prompt",size:S="sm"}){let f=`${(0,za.useId)()}-message`,h=c??(s?"danger":"primary"),p=g||m,y=(0,za.useCallback)(()=>{p||(async()=>{try{await a()}catch{}})()},[p,a]);return(0,oe.jsxs)(o2,{open:e,onClose:t,title:l,shape:w,size:S,role:s?"alertdialog":"dialog",describedBy:vt(n)?f:void 0,dismissable:!m,closeDisabledReason:b,onSubmit:y,stackBody:!0,footer:(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Na,{variant:d,onClick:t,disabledReason:m?b:void 0,children:o}),(0,oe.jsx)(Na,{type:"submit",variant:h,loading:m,disabledReason:g?u:void 0,children:r})]}),children:[vt(n)?(0,oe.jsx)("p",{className:"crewlet-modal__message",id:f,children:n}):null,i]})}var x5=Q(be(),1);function an(e){return`crewlet-presence-hue--${e}`}var Qc=Q(wt(),1);var Yc=Q(be(),1),l0={paths:["M543.42 868.92 l-34.44 -0.24 0 -58.77 0 -58.77 -28.92 0 -28.80 0 -40.20 -39.61 c-119.78 -118.25 -181.49 -179.97 -204.30 -204.30 -15.87 -16.93 -82.75 -96.74 -92.51 -110.38 l-3.76 -5.17 26.80 -18.46 c14.69 -10.11 34.09 -23.51 43.14 -29.86 55.25 -38.32 70.29 -48.43 71.12 -47.49 0.47 0.47 11.64 13.87 24.69 29.74 13.17 15.87 27.98 33.62 32.80 39.50 4.94 5.88 21.63 26.10 37.15 44.90 15.52 18.81 28.56 34.21 29.15 34.21 0.47 0.12 0.82 -30.44 0.82 -67.83 l0 -68.06 37.26 -34.56 c43.38 -40.20 61.83 -57.13 75.11 -69 l9.52 -8.46 261.78 0 261.90 0 47.14 45.73 c25.98 25.16 52.43 51.02 58.66 57.36 l11.52 11.52 0.24 67.94 0.35 67.83 31.74 -40.79 c17.51 -22.33 34.91 -45.02 38.91 -50.19 15.16 -20.34 44.32 -57.72 45.14 -58.07 0.71 -0.24 104.97 75.82 126.83 92.51 2.23 1.65 4.58 3.41 5.17 3.76 1.65 1.18 -7.99 14.22 -46.08 62.07 -35.38 44.32 -49.84 61.13 -92.39 106.97 -19.28 20.81 -38.91 41.73 -148.70 157.40 l-34.68 36.56 -26.45 0.12 c-19.04 0 -26.92 0.35 -27.98 1.41 -1.06 1.06 -1.41 15.05 -1.41 55.72 l0 54.31 -34.91 0.47 c-19.28 0.24 -53.72 0.24 -76.41 0 l-41.49 -0.47 0 -55.72 0 -55.72 -99.33 0 -99.33 0 -0.24 56.19 -0.35 56.07 -39.97 0 c-21.98 0 -55.48 -0.12 -74.29 -0.35z m94.74 -13.87 l7.17 -0.82 0 -54.89 c0 -49.02 0.24 -55.13 1.88 -55.72 1.06 -0.35 51.84 -0.71 112.85 -0.71 l110.97 0 0 55.84 0 55.84 62.89 0 62.89 0 0 -55.84 0 -55.84 31.50 0 31.50 0 14.69 -14.93 c30.80 -31.50 113.20 -118.49 144.47 -152.58 48.66 -53.01 81.34 -90.28 104.85 -119.43 22.80 -28.45 44.43 -56.42 44.43 -57.48 0 -0.59 -2 -2.47 -4.35 -4.23 -2.47 -1.76 -7.05 -5.17 -10.34 -7.64 -3.17 -2.35 -16.93 -12.34 -30.56 -22.22 -13.52 -9.87 -33.50 -24.57 -44.43 -32.68 -16.34 -12.11 -19.98 -14.34 -21.39 -13.17 -0.94 0.82 -5.88 6.82 -10.81 13.40 -4.94 6.47 -13.99 18.46 -20.10 26.57 -6.23 8.11 -26.57 34.44 -45.37 58.54 -18.81 24.10 -36.56 47.02 -39.50 50.78 -5.29 7.05 -5.29 7.05 -11.40 7.05 l-6.23 0 0 -79.58 0 -79.58 -37.85 -37.03 c-20.92 -20.45 -45.14 -44.08 -53.95 -52.66 l-15.99 -15.63 -256.84 0 -256.73 0 -47.49 44.20 c-26.21 24.33 -51.13 47.49 -55.60 51.37 l-7.88 7.05 0 79.11 0 79.23 -6.35 0 -6.35 0 -48.66 -58.54 c-26.80 -32.09 -55.95 -67.24 -64.89 -78.17 -8.93 -10.81 -16.69 -19.63 -17.16 -19.63 -0.94 0 -8.58 5.17 -34.32 22.92 -34.21 23.74 -46.08 31.86 -62.65 43.26 -10.34 7.05 -19.28 13.28 -19.87 13.87 -0.59 0.47 2.35 5.05 6.47 10.11 13.87 16.93 53.13 63.12 66.77 78.40 21.86 24.57 83.81 87.69 145.41 148.23 31.62 31.03 68.65 67.36 82.28 80.76 l24.69 24.45 33.50 0.24 33.38 0.35 0.35 59.13 0.24 59.01 53.37 0 c29.27 0 56.54 -0.35 60.54 -0.71z","M535.78 783.81 l-0.35 -59.13 -36.67 0 -36.67 0 -6.82 -6.47 c-48.78 -46.43 -176.91 -173.03 -210.41 -207.82 -24.69 -25.74 -75.70 -81.70 -93.69 -102.85 -3.29 -3.88 -5.29 -7.17 -4.70 -7.76 1.29 -1.06 58.30 -40.32 82.05 -56.42 l16.34 -11.05 3.64 4.47 c11.05 13.87 76.99 92.51 98.98 118.14 l25.74 29.97 15.63 0.35 15.52 0.35 0 -82.87 0 -82.75 50.55 -46.67 c27.86 -25.74 50.55 -47.14 50.55 -47.72 0 -0.59 46.78 -1.06 111.55 -1.06 l111.55 0 15.52 14.81 c15.28 14.58 15.52 14.69 17.98 12.58 1.29 -1.18 8.46 -7.76 15.75 -14.58 l13.40 -12.46 17.75 -0.71 c9.76 -0.47 58.77 -0.82 108.85 -0.82 l90.98 0 14.34 13.75 c7.76 7.64 24.57 23.86 37.15 36.20 12.58 12.34 29.15 28.45 36.67 35.85 l13.87 13.40 0.24 82.87 0.35 82.99 14.22 0.35 14.34 0.35 4.47 -5.64 c2.47 -3.06 11.52 -14.11 19.98 -24.45 8.46 -10.34 30.56 -38.32 49.14 -62.30 43.85 -56.42 46.20 -59.36 48.43 -59.36 2.12 0 4.82 1.88 47.96 33.27 43.02 31.27 45.37 33.03 45.37 34.09 0 0.82 -39.03 46.20 -62.42 72.53 -62.42 70.29 -106.50 117.67 -184.08 197.60 l-50.78 52.43 -13.28 0.71 c-7.29 0.47 -23.98 0.82 -37.03 0.82 l-23.86 0 0 57.01 0 57.01 -49.37 0 -49.37 0 0 -56.42 0 -56.42 -114.37 0 c-63.01 0 -120.13 0.35 -126.95 0.82 l-12.58 0.71 0 55.72 0 55.60 -47.61 0 -47.61 0 -0.24 -59.01z m443.16 -373.22 l-0.35 -119.66 -223.93 0.12 -223.93 0.12 -0.35 119.43 -0.24 119.55 224.52 0 224.52 0 -0.24 -119.55z","M546.36 516.39 c-0.24 -0.59 -0.47 -4.94 -0.35 -9.76 0 -4.82 0.12 -52.54 0.35 -106.15 l0.24 -97.21 209.59 0.24 209.47 0.35 0.35 106.73 0.24 106.62 -209.71 0 c-115.43 0 -209.94 -0.35 -210.18 -0.82z m121.07 -100.50 l-0.35 -66.18 -34.32 -0.35 -34.44 -0.24 0 66.41 0 66.41 34.68 0 34.68 0 -0.24 -66.06z m260.96 0 l-0.35 -66.18 -34.09 0 -34.09 0 0 10.93 c0 5.88 0.12 35.62 0.35 66.06 l0.24 55.25 34.09 0 34.09 0 -0.24 -66.06z"],box:{left:110.48999999999992,top:196.30999999999992,right:1389.0800000000002,bottom:869.2899999999998},centroid:{x:755.6746766446299,y:497.3295661269271}},Kc=e=>e.reduce((t,a,l)=>{let n=e[(l+1)%e.length];return t+a[0]*n[1]-n[0]*a[1]},0);function s2(e,t,a){for(let l of e)l.forEach((n,i)=>{let r=l[(i+1)%l.length];n[1]!==r[1]&&a.push(n[1]<r[1]?{x0:n[0],y0:n[1],x1:r[0],y1:r[1],wind:1,add:t}:{x0:r[0],y0:r[1],x1:n[0],y1:n[1],wind:-1,add:t})})}var er=(e,t)=>t===e.y0?e.x0:t===e.y1?e.x1:e.x0+(t-e.y0)*(e.x1-e.x0)/(e.y1-e.y0);function _5(e){let t=new Set;for(let a of e)t.add(a.y0),t.add(a.y1);for(let a=0;a<e.length;a+=1){let l=e[a];for(let n=a+1;n<e.length&&e[n].y0<l.y1;n+=1){let i=e[n],r=Math.max(l.y0,i.y0),o=Math.min(l.y1,i.y1);if(o<=r)continue;let s=er(l,r)-er(i,r),c=er(l,o)-er(i,o);s*c<0&&t.add(r+(o-r)*s/(s-c))}}return[...t].sort((a,l)=>a-l)}var T5=1e-9;function S5(){let e=new Map;return(t,a)=>{let l=e.get(t);l||e.set(t,l=[]);for(let n of l)if(Math.abs(n-a)<=T5)return n;return l.push(a),a}}function E5(e,t,a,l){let n=e.map(d=>({e:d,a:l(t,er(d,t)),b:l(a,er(d,a))})).sort((d,g)=>d.a+d.b-(g.a+g.b)),i=[],r=0,o=0,s=!1,c=[0,0];for(let d=0;d<n.length;){let{a:g,b:u}=n[d];for(;d<n.length&&n[d].a===g&&n[d].b===u;d+=1){let{e:b}=n[d];b.add?r+=b.wind:o+=b.wind}let m=r!==0&&o===0;m&&!s?c=[g,u]:!m&&s&&i.push({left:c,right:[g,u]}),s=m}return i}function c2(e,t){let a=[],l=0;for(let[n,i]of e){let r=n;for(;l<t.length&&t[l][1]<=r;)l+=1;for(let o=l;o<t.length&&t[o][0]<i&&r<i;o+=1){let[s,c]=t[o];s>r&&a.push([r,s]),r=Math.max(r,c)}r<i&&a.push([r,i])}return a}function M5(e,t){let a=[];return t.forEach((l,n)=>{let i=e[n],r=e[n+1];for(let{left:o,right:s}of l)a.push([[s[0],i],[s[1],r]]),a.push([[o[1],r],[o[0],i]])}),e.forEach((l,n)=>{let i=n>0?t[n-1].map(({left:o,right:s})=>[o[1],s[1]]):[],r=n<t.length?t[n].map(({left:o,right:s})=>[o[0],s[0]]):[];for(let[o,s]of c2(r,i))a.push([[o,l],[s,l]]);for(let[o,s]of c2(i,r))a.push([[s,l],[o,l]])}),a.filter(([l,n])=>l[0]!==n[0]||l[1]!==n[1])}var n0=1e-9;function A5(e){let t=[...e],a=!0;for(;a&&t.length>=3;){a=!1;let l=[];for(let n=0;n<t.length;n+=1){let i=l.length>0?l[l.length-1]:t[t.length-1],r=t[n],o=t[(n+1)%t.length],s=r[0]-i[0],c=r[1]-i[1],d=o[0]-r[0],g=o[1]-r[1],u=Math.hypot(s,c)<n0,m=Math.abs(s*g-c*d)<n0;if(u||m){a=!0;continue}l.push(r)}t=l}return t}function N5(e){let t=i=>`${i[0]} ${i[1]}`,a=new Map;e.forEach(([i],r)=>{let o=a.get(t(i));o?o.push(r):a.set(t(i),[r])});let l=new Uint8Array(e.length),n=[];return e.forEach((i,r)=>{if(l[r])return;let o=[],s=r;for(;s!==void 0;){l[s]=1;let[c,d]=e[s];if(o.push(c),d[0]===i[0][0]&&d[1]===i[0][1])break;s=a.get(t(d))?.find(g=>!l[g])}n.push(o)}),n.map(A5).filter(i=>i.length>=3&&Math.abs(Kc(i))>n0)}function i0(e,t=[]){let a=[];s2(e,!0,a),s2(t,!1,a),a.sort((s,c)=>s.y0-c.y0);let l=_5(a),n=S5(),i=[],r=0,o=[];for(let s=0;s+1<l.length;s+=1){let c=l[s],d=l[s+1];for(;r<a.length&&a[r].y0<=c;)o.push(a[r++]);o=o.filter(g=>g.y1>c),i.push(E5(o,c,d,n))}return N5(M5(l,i))}var z5=e=>e.reduce((t,a)=>t+Kc(a),0)/2;function O5(e){let t=0,a=0;for(let n of e)n.forEach((i,r)=>{let o=n[(r+1)%n.length],s=i[0]*o[1]-o[0]*i[1];t+=(i[0]+o[0])*s,a+=(i[1]+o[1])*s});let l=6*z5(e);return[t/l,a/l]}var Ph=e=>Kc(e)<0?e.reverse():e;function v2(e,t,a=4){let l=[];for(let n of e)n.forEach((i,r)=>{let o=n[(r+1)%n.length],s=n[(r+2)%n.length],c=Math.hypot(o[0]-i[0],o[1]-i[1]),d=(o[1]-i[1])/c,g=-(o[0]-i[0])/c,u=Math.hypot(s[0]-o[0],s[1]-o[1]),m=(s[1]-o[1])/u,b=-(s[0]-o[0])/u,w=t;l.push(Ph([[i[0]+d*w,i[1]+g*w],[o[0]+d*w,o[1]+g*w],[o[0]-d*w,o[1]-g*w],[i[0]-d*w,i[1]-g*w]]));let S=(o[0]-i[0])*(s[1]-o[1])-(o[1]-i[1])*(s[0]-o[0]);if(S===0)return;let f=S>0?1:-1,h=[o[0]+f*d*w,o[1]+f*g*w],p=[o[0]+f*m*w,o[1]+f*b*w],y=d+m,T=g+b,R=y*y+T*T;if(R>0&&2/Math.sqrt(R)<=a){let N=[o[0]+f*y*2*w/R,o[1]+f*T*2*w/R];l.push(Ph([o,h,N,p]))}else l.push(Ph([o,h,p]))});return l}var u2=e=>Math.round(e*100)/100;function d2(e){return e.map(t=>`M${t.map(([l,n])=>`${u2(l)} ${u2(n)}`).filter((l,n,i)=>l!==i[n-1]).join("L")}Z`).join("")}var y2=["crewlet","hexlet","peaklet","prismlet","towerlet","bricklet","gemlet","coglet","pluslet","shieldlet","stacklet","sparklet","cloudlet","foxlet","rocketlet","crownlet","cactlet","wisplet","heartlet","flasklet","chiplet","duolet","chatlet","pagelet","archlet","dashlet","octlet","conelet","hivelet","folderlet"],So=e=>typeof e=="string"&&y2.includes(e),jc=96,C5=1.35,b2=.9,To=1.3,R5=2,e0={full:{width:.164,height:.62},compact:{width:.19,height:.68},offset:.312},t0={half:3.2,depth:2.6},f2=e=>Math.round(e*100)/100;function h2(e,t){let a=[];return e.forEach((l,n)=>{let i=typeof t=="number"?t:t[n]??0;if(!i){a.push(l);return}let r=o=>{let s=o[0]-l[0],c=o[1]-l[1],d=Math.min(i/Math.hypot(s,c),.45);return[l[0]+s*d,l[1]+c*d]};a.push(r(e[(n-1+e.length)%e.length]),r(e[(n+1)%e.length]))}),a}var p2=e=>`M${e.map(([t,a])=>`${f2(t)} ${f2(a)}`).join("L")}Z`;function ze(e,t=0){let a=typeof t=="number"?e.map(()=>t):t;return Kc(e)<0?h2([...e].reverse(),[...a].reverse()):h2(e,a)}var se=(e,t,a,l,n=0)=>ze([[e,t],[e+a,t],[e+a,t+l],[e,t+l]],n),Ne=(e,t,a,l=10)=>[se(e,a,l,jc-a),se(t,a,l,jc-a)];function D5(e,t,a,l,n){let i=[];for(let r=0;r<n;r+=1){let o=(r*360/n-90)*(Math.PI/180);for(let[s,c]of[[l,-15],[a,-8.5],[a,8.5],[l,15]]){let d=o+c*(Math.PI/180);i.push([e+s*Math.cos(d),t+s*Math.sin(d)])}}return ze(i)}function H5(e){let t=e.flat(),a=t.map(([r])=>r),l=t.map(([,r])=>r),n=Math.min(...a),i=Math.min(...l);return{x:n,y:i,width:Math.max(...a)-n,height:Math.max(...l)-i}}var G5=([e,t,a,l])=>({x:e,y:t,width:a,height:l}),w2=new WeakMap;function pe(e){let t=e.holes??[],a,l={kind:"drawn",name:e.name,shape:e.shape,shapes:e.shapes.map(p2),holes:t.map(p2),visor:G5(e.visor),notch:e.notch===void 0?null:[e.notchX??50,e.notch],get bounds(){return a??(a=H5([...s0(l),...x2(l)]))}};return w2.set(l,{parts:e.shapes,holes:t}),l}var Xc=e=>w2.get(e);function s0(e){let t=Xc(e);return t.silhouette??(t.silhouette=i0(t.parts))}function x2(e){let t=Xc(e);return t.reach??(t.reach=v2(s0(e),b2+C5))}var r0=.095,_2=760,T2=869,o0=(e,t)=>[50+(e-_2)*r0,jc+(t-T2)*r0],k5=o0(l0.centroid.x,l0.centroid.y);function L5(){let{paths:e,box:t}=l0,[a,l]=o0(t.left,t.top),[n,i]=o0(t.right,t.bottom);return{kind:"mark",name:"Crewlet",shape:"The original mark, arms raised",transform:`translate(50 ${jc}) scale(${r0}) translate(${-_2} ${-T2})`,keyline:e[0],body:[e[1],e[2]],bounds:{x:a,y:l,width:n-a,height:i-l}}}var c0={crewlet:L5(),hexlet:pe({name:"Hexlet",shape:"Hexagon with pointed flanks",shapes:[ze([[30,22],[70,22],[86,54],[70,86],[30,86],[14,54]],[5,5,4,4,4,4]),...Ne(34,56,84)],visor:[28,38,44,20],notch:22}),peaklet:pe({name:"Peaklet",shape:"Pentagon with a peaked roof",shapes:[ze([[50,12],[82,36],[82,86],[18,86],[18,36]],[6,5,4,4,5]),...Ne(28,62,84)],visor:[26,44,48,20]}),prismlet:pe({name:"Prismlet",shape:"Triangle with cut tips",shapes:[ze([[50,10],[90,86],[10,86]],[9,8,8]),...Ne(28,62,84)],visor:[31,54,38,18]}),towerlet:pe({name:"Towerlet",shape:"Tall pillar, narrow stance",shapes:[se(32,12,36,74,[8,8,4,4]),...Ne(35,55,84)],visor:[36,24,28,16],notch:12}),bricklet:pe({name:"Bricklet",shape:"Wide, low slab",shapes:[se(10,42,80,44,[9,9,6,6]),...Ne(22,68,84)],visor:[21,50,58,19],notch:42}),gemlet:pe({name:"Gemlet",shape:"Diamond on its point",shapes:[ze([[50,6],[90,48],[50,90],[10,48]],[7,7,16,7]),...Ne(40,52,76,8)],visor:[27,38,46,20]}),coglet:pe({name:"Coglet",shape:"Eight-tooth gear",shapes:[D5(50,52,37,31,8),...Ne(36,54,78)],visor:[30,40,40,18]}),pluslet:pe({name:"Pluslet",shape:"Cross with squared arms",shapes:[se(34,14,32,72,[7,7,0,0]),se(10,34,80,30,7),...Ne(37,53,84)],visor:[20,40,60,18],notch:14}),shieldlet:pe({name:"Shieldlet",shape:"Flat crown, pointed base",shapes:[ze([[16,16],[84,16],[84,54],[50,92],[16,54]],[9,9,5,14,5]),...Ne(41,51,79,8)],visor:[26,28,48,20],notch:16}),stacklet:pe({name:"Stacklet",shape:"Stepped crown, square base",shapes:[ze([[34,12],[66,12],[66,26],[82,26],[82,86],[18,86],[18,26],[34,26]],[4,4,0,5,4,4,5,0]),...Ne(28,62,84)],visor:[26,40,48,20],notch:12}),sparklet:pe({name:"Sparklet",shape:"Faceted drop",shapes:[ze([[50,8],[80,48],[78,74],[64,86],[36,86],[22,74],[20,48]],[6,4,2,2,2,2,4]),...Ne(36,54,84)],visor:[30,48,40,18]}),cloudlet:pe({name:"Cloudlet",shape:"Three-lobed cloud",shapes:[se(14,44,72,42,[0,0,8,8]),se(16,30,32,32,9),se(33,18,34,34,10),se(56,32,30,30,9),...Ne(30,60,84)],visor:[24,48,52,18],notch:18}),foxlet:pe({name:"Foxlet",shape:"Square body, pointed ears",shapes:[se(18,34,64,52,6),ze([[20,36],[26,12],[44,36]],[0,4,0]),ze([[56,36],[74,12],[80,36]],[0,4,0]),...Ne(28,62,84)],visor:[26,46,48,20]}),rocketlet:pe({name:"Rocketlet",shape:"Nose cone and swept fins",shapes:[ze([[50,6],[66,26],[66,80],[34,80],[34,26]],[5,3,3,3,3]),ze([[34,54],[34,80],[18,90],[18,70]],[0,0,3,3]),ze([[66,54],[82,70],[82,90],[66,80]],[0,3,3,0]),...Ne(37,55,80,8)],visor:[37,32,26,16]}),crownlet:pe({name:"Crownlet",shape:"Three-point crown",shapes:[se(18,40,64,46,[0,0,6,6]),ze([[18,44],[18,18],[34,32],[50,12],[66,32],[82,18],[82,44]],[0,3,0,3,0,3,0]),...Ne(28,62,84)],visor:[27,48,46,20]}),cactlet:pe({name:"Cactlet",shape:"Trunk with two raised arms",shapes:[se(32,12,36,74,[10,10,0,0]),se(16,50,18,9,[0,0,0,3]),se(16,28,9,31,[4.5,4.5,0,3]),se(66,58,18,9,[0,0,3,0]),se(75,38,9,29,[4.5,4.5,3,0]),...Ne(36,54,84)],visor:[37,26,26,16],notch:12}),wisplet:pe({name:"Wisplet",shape:"Tall ghost with a zigzag hem",shapes:[ze([[16,10],[84,10],[84,92],[72.5,82],[61,92],[50,82],[39,92],[27.5,82],[16,92]],[14,14,2,0,2,0,2,0,2])],visor:[26,28,48,20],notch:10}),heartlet:pe({name:"Heartlet",shape:"Faceted heart",shapes:[ze([[50,26],[62,14],[78,14],[90,26],[90,44],[50,84],[10,44],[10,26],[22,14],[38,14]],[0,3,3,3,4,6,4,3,3,3]),...Ne(41,51,74,8)],visor:[23,30,54,18]}),flasklet:pe({name:"Flasklet",shape:"Lab flask with a narrow neck",shapes:[se(35,6,30,7,2),se(40,10,20,22),ze([[40,28],[60,28],[86,80],[86,86],[14,86],[14,80]],[0,0,6,3,3,6]),...Ne(26,64,84)],visor:[33,54,34,14],notch:6}),chiplet:pe({name:"Chiplet",shape:"Square chip with pins",shapes:[se(24,20,52,60,6),...[31,47,63].map(e=>se(e,11,6,10)),...[32,47,62].map(e=>se(15,e,10,6)),...[32,47,62].map(e=>se(75,e,10,6)),...[31,47,63].map(e=>se(e,78,6,18))],holes:[se(29,70,5,5)],visor:[31,34,38,18]}),duolet:pe({name:"Duolet",shape:"Small head on a wide body",shapes:[se(30,10,40,34,8),se(18,40,64,46,6),...Ne(28,62,84)],visor:[36,19,28,15],notch:10}),chatlet:pe({name:"Chatlet",shape:"Speech bubble with a tail",shapes:[se(14,22,72,54,8),ze([[26,72],[46,72],[22,94]],[0,0,2])],visor:[24,34,52,22],notch:22}),pagelet:pe({name:"Pagelet",shape:"Page with a folded corner",shapes:[ze([[20,10],[64,10],[80,26],[80,86],[20,86]],[4,0,0,4,4]),...Ne(28,62,84)],holes:[se(63.3,10,1.4,17.4),se(63.3,25.3,17,1.4)],visor:[27,36,46,20],notch:10}),archlet:pe({name:"Archlet",shape:"Gate with built-in legs",shapes:[ze([[16,18],[84,18],[84,96],[64,96],[64,74],[36,74],[36,96],[16,96]],[8,8,0,0,4,4,0,0])],visor:[25,30,50,22],notch:18}),dashlet:pe({name:"Dashlet",shape:"Body leaning forward",shapes:[ze([[29,14],[87,14],[71,86],[13,86]],6),...Ne(20,48,84)],visor:[31.5,28,42,20],notch:14,notchX:58}),octlet:pe({name:"Octlet",shape:"Regular octagon",shapes:[se(16,16,68,68,20),...Ne(35,55,81)],visor:[26,36,48,22],notch:16}),conelet:pe({name:"Conelet",shape:"Narrow crown, wide base",shapes:[ze([[30,12],[70,12],[88,84],[12,84]],[6,6,5,5]),...Ne(26,64,82)],visor:[28,40,44,20],notch:12}),hivelet:pe({name:"Hivelet",shape:"Upright honeycomb cell",shapes:[ze([[50,6],[84,24],[84,72],[50,90],[16,72],[16,24]],[6,4,4,6,4,4]),...Ne(40,52,80,8)],visor:[25,36,50,20]}),folderlet:pe({name:"Folderlet",shape:"Folder with a tab",shapes:[ze([[12,14],[38,14],[50,26],[88,26],[88,84],[12,84]],[4,0,0,6,5,5]),...Ne(26,64,82)],visor:[24,40,52,22]})},m2=.5,a0=(e,t,a,l)=>[[e,t],[e+a,t],[e+a,t+l],[e,t+l]];function U5(e){let t=1/0;return e.forEach((a,l)=>{let n=e[(l+1)%e.length],i=Math.hypot(n[0]-a[0],n[1]-a[1]);if(i===0)return;let r=Math.max(...e.map(o=>Math.abs((n[0]-a[0])*(o[1]-a[1])-(n[1]-a[1])*(o[0]-a[0]))/i));t=Math.min(t,r)}),t}function B5(e,t){let{visor:a,notch:l}=e,n=t==="full",i=n?e0.full:e0.compact,r=a.width*i.width,o=a.height*i.height,s=a.y+(a.height-o)/2,c=a.x+a.width/2,d=a.width*e0.offset,g=[c-d,c+d].map(u=>a0(u-r/2,s,r,o));l&&g.push([[l[0]-t0.half,l[1]-1],[l[0]+t0.half,l[1]-1],[l[0],l[1]+t0.depth]]);for(let u of Xc(e).holes)(n||U5(u)>R5)&&g.push(u);if(n){let u=To/2;g.push(a0(a.x-u,a.y-u,a.width+To,a.height+To)),g.push([...a0(a.x+u,a.y+u,a.width-To,a.height-To)].reverse())}return g}function S2(e,t){let a=e.x+e.width/2,l=e.y+e.height/2,n=a+m2*(t[0]-a),i=l+m2*(t[1]-l),r=Math.max(e.width+2*Math.abs(n-a),e.height+2*Math.abs(i-l));return{x:n-r/2,y:i-r/2,width:r,height:r}}function q5(e){let{parts:t}=Xc(e),a=s0(e),l={},n=r=>d2(i0(t,B5(e,r))),i=()=>d2(i0([...a,...x2(e)],[...a,...v2(a,b2)]));return{frame:S2(e.bounds,O5(a)),paths:r=>l[r]??(l[r]=r==="full"?[i(),n("full")]:[n("compact")])}}var g2=new Map;function V5(e){let t=g2.get(e);if(t)return t;let a=c0[e];if(a.kind==="mark"){let l=[a.keyline,...a.body];t={frame:S2(a.bounds,k5),paths:n=>n==="full"?l:a.body}}else t=q5(a);return g2.set(e,t),t}var Y5=e=>Math.round(e*100)/100,j5=({character:e,detail:t="full",...a})=>{let l=c0[e],{frame:n,paths:i}=V5(e),r=i(t).map(o=>(0,Yc.jsx)("path",{d:o},o));return(0,Yc.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:[n.x,n.y,n.width,n.height].map(Y5).join(" "),width:"1em",height:"1em","aria-hidden":"true",focusable:"false","data-character":e,"data-detail":t,...a,children:(0,Yc.jsx)("g",{fill:"currentColor",transform:l.kind==="mark"?l.transform:void 0,children:r})})},u0=j5;var yt=Q(be(),1);var K5={working:"working",needs:"needs you",stopped:"stopped"},d0={xs:20,sm:26,md:32,lg:40};var X5=/^agent(?:[\s._-]+)(?=\S)/i;function Q5(e,t){if(e===void 0||t!=="agent")return e;let a=e.replace(X5,"");return a.trim()?a:e}var Z5=56,I5=e=>{if(!e)return"?";let t=e.trim().split(/[\s\-_.]+/).filter(Boolean);if(t.length===0)return"?";let a=i=>(Array.from(i)[0]??"").toUpperCase();if(t.length>=2)return t.slice(0,2).map(a).join("")||"?";let l=t[0],n=l.split(/(?<=\p{Ll})(?=\p{Lu})/u);return n.length>=2?n.slice(0,2).map(a).join(""):Array.from(l).slice(0,2).map(i=>i.toUpperCase()).join("")||"?"},J5=10,$5=e=>{let t=0;for(let a=0;a<e.length;a+=1)t=t*31+e.charCodeAt(a)>>>0;return t%J5};function F5(e){return typeof e=="number"?e:d0[e]}var Eo=({src:e,name:t,size:a="md",kind:l="agent",tone:n="neutral",ring:i,status:r,mark:o,markLabel:s,decorative:c=!1,colorSeed:d,character:g,hue:u,icon:m,className:b,style:w,...S})=>{let[f,h]=(0,Qc.useState)(!1);(0,Qc.useEffect)(()=>{h(!1)},[e]);let p=typeof a=="number"?null:a,y=F5(a),T=p===null?{"--crewlet-avatar-size":`${y}px`,fontSize:Math.max(9,Math.round(y*.36))}:{},R=n==="seeded"?$5(d??t??""):null,N=r===void 0&&o!==void 0&&o!==null,A=r!==void 0||N,X=r!==void 0?K5[r]:N?s:void 0,C=t?`${t} avatar`:"Avatar",G=X?`${C}, ${X}`:C,Be=k("crewlet-avatar",`crewlet-avatar--${l}`,p===null?null:`crewlet-avatar--${p}`,A?"crewlet-avatar--notched":null,i===void 0||A?null:`crewlet-avatar--ring-${i}`,A?null:b),H=A?T:{...T,...w};function D(){return g!==void 0&&l==="agent"?(0,yt.jsx)("span",{...S,className:k(Be,"crewlet-avatar--character",u===void 0?"crewlet-avatar--neutral":`crewlet-avatar--hue-${u}`),style:H,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:G,children:(0,yt.jsx)(u0,{className:"crewlet-avatar__character",character:g,detail:y>=Z5?"full":"compact"})}):e&&!f?(0,yt.jsx)("img",{...S,className:k(Be,"crewlet-avatar--image"),style:H,src:e,alt:c?"":X?`${t??""}, ${X}`:t??"","aria-hidden":c?!0:void 0,onError:()=>h(!0)}):(0,yt.jsx)("span",{...S,className:k(Be,"crewlet-avatar--fallback",`crewlet-avatar--${n}`,R===null?null:`crewlet-avatar--tint-${R}`,m==null?null:"crewlet-avatar--icon"),style:H,role:c?void 0:"img","aria-hidden":c?!0:void 0,"aria-label":c?void 0:G,children:m==null?I5(Q5(t,l)):(0,yt.jsx)("span",{className:"crewlet-avatar__icon","aria-hidden":"true",children:m})})}let q=D();return A?(0,yt.jsxs)("span",{className:k("crewlet-avatar-frame",b),style:{"--crewlet-avatar-size":`${y}px`,...w},children:[q,r!==void 0?(0,yt.jsx)("span",{className:`crewlet-avatar__status crewlet-avatar__status--${r}`,"aria-hidden":"true",children:W5[r]}):(0,yt.jsx)("span",{className:"crewlet-avatar__status crewlet-avatar__status--mark","aria-hidden":"true",children:o})]}):q},W5={working:(0,yt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,yt.jsx)("path",{d:"M5.4 3.9 10.2 7l-4.8 3.1z",fill:"currentColor"})}),needs:(0,yt.jsxs)("svg",{viewBox:"0 0 14 14",focusable:"false",children:[(0,yt.jsx)("path",{d:"M5.1 5.3a1.9 1.9 0 1 1 2.7 1.7c-.55.27-.8.62-.8 1.15v.3",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,yt.jsx)("circle",{cx:"7",cy:"10.45",r:".85",fill:"currentColor"})]}),stopped:(0,yt.jsx)("svg",{viewBox:"0 0 14 14",focusable:"false",children:(0,yt.jsx)("rect",{x:"4.6",y:"4.6",width:"4.8",height:"4.8",rx:".7",fill:"currentColor"})})};var wl=Q(be(),1);function f0({members:e,self:t=!0,max:a=4,size:l="sm",onSelect:n,label:i,labels:r,className:o}){if(!Number.isInteger(a)||a<1)throw new RangeError(`PresenceStack max must be a whole number of at least 1; it was ${a}`);let s=mo(r),c=rh(e);if(c.length===0&&!t)return null;let d=c.slice(0,a),g=c.slice(a),u=i??s.here(c.length,t),m=[u,...c.map(f=>s.member(f))].join(". "),b=f=>(0,wl.jsx)(Eo,{name:f.name,kind:f.kind,src:f.src,character:f.character!==void 0&&So(f.character)?f.character:void 0,hue:f.kind==="agent"?f.hue:void 0,size:l,decorative:!0,className:k("crewlet-presence-stack__badge",f.hue!==void 0&&f.activity!=="idle"&&an(f.hue),f.hue!==void 0&&f.activity!=="idle"&&"crewlet-presence-stack__badge--present",f.activity==="idle"&&"crewlet-presence-stack__badge--idle")}),w=g.length>0?(0,wl.jsxs)("span",{className:"crewlet-avatar-stack__member crewlet-avatar-stack__more","aria-hidden":"true",children:["+",g.length]}):null,S={"--crewlet-avatar-stack-size":`${d0[l]}px`};return n===void 0?c.length===0?null:(0,wl.jsxs)("span",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"img","aria-label":m,children:[d.map(f=>(0,wl.jsx)("span",{className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${f.kind}`),children:b(f)},f.id)),w]}):(0,wl.jsxs)("div",{className:k("crewlet-avatar-stack","crewlet-presence-stack",o),style:S,role:"group","aria-label":u,children:[d.map(f=>(0,wl.jsx)("button",{type:"button",className:k("crewlet-avatar-stack__member","crewlet-presence-stack__member",`crewlet-presence-stack__member--${f.kind}`),"aria-label":s.member(f),title:s.member(f),onClick:()=>n(f),children:b(f)},f.id)),w,g.length>0?(0,wl.jsx)(Tt,{children:`${s.more(g.length)}: ${g.map(f=>s.member(f)).join(", ")}`}):null]})}var h0=Q(wt(),1),P5=Q(be(),1),E2={text:"",n:0},ex=new Set,tx=0;function ax(e){if(e!==""){if(tx===0){console.warn("[crewlet] announce() was called with no <Announcer> mounted, so nothing was said:",e);return}E2={text:e,n:E2.n+1};for(let t of[...ex])t()}}function M2(){return(0,h0.useCallback)(ax,[])}var ya=Q(wt(),1),ln=Q(be(),1);function A2({label:e,max:t=6,overflow:a="expand",moreLabel:l=s=>`+${s} more`,countLabel:n=s=>`+${s}`,expandedMessage:i=s=>`Showing all ${s}.`,className:r,children:o}){let[s,c]=(0,ya.useState)(!1),d=M2(),g=(0,ya.useRef)(null),u=ya.Children.toArray(o),m=a==="fit",b=lx(g,m,u.length),w=m?u.slice(0,b):s?u:u.slice(0,t),S=u.length-w.length;return(0,ln.jsxs)("ul",{ref:g,tabIndex:-1,className:k("crewlet-tag-group",m&&"crewlet-tag-group--fit",r),"aria-label":`${e}, ${u.length}`,children:[w.map((f,h)=>(0,ln.jsx)("li",{className:"crewlet-tag-group__item",children:f},h)),S>0&&m?(0,ln.jsx)("li",{className:"crewlet-tag-group__item","data-count":"",children:(0,ln.jsx)("span",{className:"crewlet-tag-group__count",children:n(S)})}):S>0?(0,ln.jsx)("li",{className:"crewlet-tag-group__item",children:(0,ln.jsx)("button",{type:"button",className:"crewlet-tag-group__more",onClick:()=>{c(!0),g.current?.focus(),d(i(u.length))},children:l(S)})}):null]})}function lx(e,t,a){let[l,n]=(0,ya.useState)(a),i=(0,ya.useRef)(null);return(0,ya.useLayoutEffect)(()=>{t&&n(a)},[t,a]),(0,ya.useLayoutEffect)(()=>{let r=e.current;if(!t||!r)return;let o=[...r.children],s=o[0];if(!s)return;let c=s.offsetTop,d=o.filter(w=>!w.hasAttribute("data-count")),g=o.find(w=>w.hasAttribute("data-count")),u=d.filter(w=>w.offsetTop===c).length,m=g&&g.offsetTop!==c?u-1:u,b=Math.max(1,Math.min(m,d.length));b<d.length&&n(b)},[e,t,l,a]),(0,ya.useLayoutEffect)(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver!="function")return;let o=new ResizeObserver(([s])=>{let c=s?.contentRect.width??0;i.current!==null&&i.current!==c&&n(a),i.current=c});return o.observe(r),()=>o.disconnect()},[e,t,a]),t?l:a}var Mo=Q(be(),1);function N2({name:e,hue:t,kind:a="human",editing:l=!1,placement:n="top-end",className:i,...r}){let o=typeof e=="string"?e:e.join(", ");return(0,Mo.jsxs)("span",{...r,"aria-hidden":"true",className:k("crewlet-cursor-flag",an(t),`crewlet-cursor-flag--${a}`,`crewlet-cursor-flag--${n}`,i),children:[l?(0,Mo.jsx)(Vh,{size:"xs",className:"crewlet-cursor-flag__glyph"}):null,(0,Mo.jsx)("span",{className:"crewlet-cursor-flag__name",children:o})]})}var Ao=Q(be(),1);function No({tone:e="neutral",pulse:t=!1,children:a,className:l}){let n=a!=null&&a!==!1&&a!=="",i=(0,Ao.jsx)("span",{"aria-hidden":!0,className:k("crewlet-status-dot",`crewlet-status-dot--${e}`,t&&"is-pulsing",!n&&l)});return n?(0,Ao.jsxs)("span",{className:k("crewlet-status",l),children:[i," ",(0,Ao.jsx)("span",{className:"crewlet-status__label",children:a})]}):i}var Rt=Q(be(),1);function Zc(e){let{variant:t="neutral",hue:a,appearance:l="soft",size:n="sm",leadingIcon:i,dot:r=!1,count:o,monospace:s=!1,animateIn:c=!1,onClick:d,pressed:g,onRemove:u,removeAriaLabel:m="Remove tag",className:b,children:w,...S}=e,f=d!==void 0,h=f||u!==void 0,p=f&&u!==void 0;h&&n==="xs"&&console.warn('[crewlet] Tag size="xs" cannot act: an interactive tag starts at "sm", so its target clears 24px. Drawn at "sm".');let y=h&&n==="xs"?"sm":n,T=k("crewlet-tag",a===void 0?`crewlet-tag--${t}`:`crewlet-tag--hue-${a}`,`crewlet-tag--${l}`,`crewlet-tag--${y}`,s&&"crewlet-tag--monospace",c&&"crewlet-tag--animate-in",h&&"crewlet-tag--acts",f&&!p&&"crewlet-tag--actionable",p&&"crewlet-tag--split",p&&g===!0&&"is-pressed",b),R=(0,Rt.jsxs)(Rt.Fragment,{children:[r?(0,Rt.jsx)(No,{tone:a===void 0?t:"neutral",className:"crewlet-tag__dot"}):null,i?(0,Rt.jsx)("span",{className:"crewlet-tag__icon","aria-hidden":!0,children:i}):null,(0,Rt.jsx)("span",{className:"crewlet-tag__label",children:w}),o===void 0?null:(0,Rt.jsx)("span",{className:"crewlet-tag__count",children:o})]}),N=u===void 0?null:(0,Rt.jsx)("button",{type:"button",className:"crewlet-tag__remove",onClick:A=>{A.stopPropagation(),u()},"aria-label":m,children:(0,Rt.jsx)(bo,{size:"xs"})});return p?(0,Rt.jsxs)("span",{...S,className:T,children:[(0,Rt.jsx)("button",{type:"button",className:"crewlet-tag__press",onClick:d,"aria-pressed":g===!0,children:R}),N]}):f?(0,Rt.jsx)("button",{...S,type:"button",className:T,onClick:d,"aria-pressed":g===!0,children:R}):(0,Rt.jsxs)("span",{...S,className:T,children:[R,N]})}var He=Q(wt(),1),z2=Q(hr(),1);var tr=Q(be(),1);function O2(e){return Number.parseFloat(e)}function nx(e,t){if(typeof e=="function"){let l=e(t);return typeof l=="function"?l:()=>{e(null)}}if(!e)return()=>{};let a=e;return a.current=t,()=>{a.current=null}}var ix=O2(Zh.duration.slow),rx=O2(Zh.duration.base);function C2({content:e,placement:t="top",disabled:a=!1,openDelay:l=ix,closeDelay:n=rx,className:i,children:r}){let s=`${(0,He.useId)()}-tooltip`,[c,d]=(0,He.useState)(!1),g=(0,He.useRef)(null),u=(0,He.useRef)(null),m=(0,He.useRef)(void 0),b=(0,He.useRef)({pointer:!1,focus:!1}),[w,S]=(0,He.useState)(null),f=Fi(),h=(0,He.useCallback)(()=>{m.current!==void 0&&clearTimeout(m.current),m.current=void 0},[]),p=(0,He.useCallback)(H=>{if(h(),!a){if(H<=0){d(!0);return}m.current=setTimeout(()=>d(!0),H)}},[h,a]),y=(0,He.useCallback)(H=>{h();let D=()=>{b.current.pointer||b.current.focus||d(!1)};if(H<=0){D();return}m.current=setTimeout(D,H)},[h]),T=Vc({open:c,onDismiss:()=>{b.current={pointer:!1,focus:!1},h(),d(!1)}});(0,He.useEffect)(()=>h,[h]),(0,He.useEffect)(()=>{a&&(h(),d(!1))},[a,h]);let R=(0,He.useCallback)(()=>{let H=g.current,D=u.current;if(!H||!D||!f)return;let q=f!==document.body,ae=q?f.getBoundingClientRect():Bc(),O=H.getBoundingClientRect(),F=D.getBoundingClientRect(),I={x:O.x+O.width/2-F.width/2-(q?ae.x:0),y:O.y-(q?ae.y:0),width:O.width,height:O.height},qe={x:0,y:0,width:ae.width,height:ae.height},St={x:ea,y:ea,width:ae.width-2*ea,height:ae.height-2*ea};if(qc({...I,x:O.x-(q?ae.x:0)},qe)){d(!1);return}let We=Uc(I,{width:F.width,height:F.height},St,ea,t==="top"?"above":"below");S(we=>we&&we.left===We.left&&we.top===We.top&&we.side===We.side?we:We)},[f,t]);(0,He.useLayoutEffect)(()=>{if(!c)return;R();let H=()=>R();f?.addEventListener($i,H),window.addEventListener("resize",H),window.addEventListener("scroll",H,!0);let D=typeof ResizeObserver=="function"?new ResizeObserver(H):null;return u.current&&D?.observe(u.current),()=>{f?.removeEventListener($i,H),window.removeEventListener("resize",H),window.removeEventListener("scroll",H,!0),D?.disconnect()}},[c,f,R]),(0,He.useEffect)(()=>{c||S(null)},[c]);let N=r,A=N.props["aria-describedby"],X=N.props.ref,C=(0,He.cloneElement)(N,{ref:H=>{g.current=H,T.insideRef(H);let D=nx(X,H);return()=>{g.current=null,T.insideRef(null),D()}},"aria-describedby":c?k(A,s):A,onPointerEnter:H=>{b.current.pointer=!0,p(l),N.props.onPointerEnter?.(H)},onPointerLeave:H=>{b.current.pointer=!1,y(n),N.props.onPointerLeave?.(H)},onFocus:H=>{b.current.focus=!0,p(0),N.props.onFocus?.(H)},onBlur:H=>{b.current.focus=!1,y(0),N.props.onBlur?.(H)}}),G=w?{left:w.left,top:w.top,zIndex:T.zIndex}:{visibility:"hidden",zIndex:T.zIndex},Be=c?(0,tr.jsx)("div",{ref:H=>{u.current=H,T.panelRef(H)},id:s,role:"tooltip",className:k("crewlet-tooltip",`crewlet-tooltip--${w?.side??(t==="top"?"above":"below")}`,f!==null&&f!==document.body?"crewlet-tooltip--in-host":"crewlet-tooltip--fixed",i),style:G,onPointerEnter:()=>{b.current.pointer=!0,h()},onPointerLeave:()=>{b.current.pointer=!1,y(n)},children:e}):null;return(0,tr.jsxs)(tr.Fragment,{children:[C,Be&&f?(0,z2.createPortal)(Be,f):null]})}var p0=Q(be(),1);function R2({by:e,at:t,previous:a=null,locale:l,className:n,labels:i}){let r=Rc({by:e,at:t},go(i),a,l);return(0,p0.jsx)(C2,{content:r,children:(0,p0.jsx)("span",{"aria-hidden":"true",className:k("crewlet-change-mark",n)})})}var Ge=Q(wt(),1),D2=Q(hr(),1);var ct=Q(be(),1),ox="[role='menuitem'],[role='menuitemradio']";function sx(e){let t=[];for(let a of e){if(a.kind==="separator"){t.push({kind:"separator",key:a.key});continue}let l=t[t.length-1];a.checked===void 0?t.push({kind:"action",item:a}):l?.kind==="answers"?l.items.push(a):t.push({kind:"answers",key:`${a.key}:answers`,items:[a]})}return t}function H2({label:e,items:t,icon:a,trigger:l,trailingIcon:n,triggerVariant:i="ghost",triggerTabIndex:r,open:o,onOpenChange:s,align:c="start",width:d="content",renderTrigger:g,header:u,className:m}){let b=(0,Ge.useId)(),w=`${b}-menu`,S=`${b}-header`,[f,h]=(0,Ge.useState)(!1),p=o??f,y=(0,Ge.useRef)(null),T=(0,Ge.useRef)(null),R=(0,Ge.useRef)(null),N=(0,Ge.useRef)("first"),[A,X]=(0,Ge.useState)(null),C=Fi(),G=(0,Ge.useRef)(o!==void 0),Be=(0,Ge.useRef)(s);G.current=o!==void 0,Be.current=s;let H=(0,Ge.useCallback)(M=>{G.current||h(M),Be.current?.(M)},[]),D=(0,Ge.useCallback)(()=>{let M=R.current;(M&&M.isConnected&&M!==document.body?M:y.current)?.focus()},[]),q=(0,Ge.useCallback)(M=>{M&&D(),H(!1)},[D,H]),ae=Vc({open:p,onDismiss:M=>q(M!=="outside")}),O=()=>T.current?[...T.current.querySelectorAll(ox)]:[];(0,Ge.useLayoutEffect)(()=>{if(!p)return;let M=document.activeElement;M instanceof Node&&T.current?.contains(M)||(R.current=M instanceof HTMLElement?M:null)},[p]);let F=(0,Ge.useCallback)(()=>{let M=y.current,Me=T.current;if(!M||!Me||!C)return;let Yt=C!==document.body,Ke=Yt?C.getBoundingClientRect():Bc(),Pe=M.getBoundingClientRect(),ke=Me.getBoundingClientRect(),et=d==="trigger"?Pe.width:void 0,ta={width:Math.max(ke.width,et??0),height:ke.height},Fa={x:(c==="end"?Pe.right-ta.width:Pe.left)-(Yt?Ke.x:0),y:Pe.top-(Yt?Ke.y:0),width:Pe.width,height:Pe.height},j={x:0,y:0,width:Ke.width,height:Ke.height},aa={x:ea,y:ea,width:Ke.width-2*ea,height:Ke.height-2*ea};if(qc(Fa,j)){q(!0);return}let Wa=Uc(Fa,{width:ta.width,height:ta.height},aa,ea);X(la=>la&&la.left===Wa.left&&la.top===Wa.top&&la.floor===et?la:{left:Wa.left,top:Wa.top,floor:et})},[c,q,C,d]);(0,Ge.useLayoutEffect)(()=>{if(!p)return;F();let M=()=>F();C?.addEventListener($i,M),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0);let Me=typeof ResizeObserver=="function"?new ResizeObserver(M):null;return T.current&&Me?.observe(T.current),()=>{C?.removeEventListener($i,M),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0),Me?.disconnect()}},[p,C,F]),(0,Ge.useEffect)(()=>{p||X(null)},[p]);let I=p&&A!==null;(0,Ge.useLayoutEffect)(()=>{if(!I)return;let M=O();(N.current==="last"?M[M.length-1]:M[0])?.focus(),N.current="first"},[I]);function qe(M){(M.key==="ArrowDown"||M.key==="ArrowUp")&&(M.preventDefault(),N.current=M.key==="ArrowUp"?"last":"first",H(!0))}function St(M){M.key!=="Escape"&&M.key!=="Tab"&&!M.ctrlKey&&!M.metaKey&&!M.altKey&&M.stopPropagation();let Me=O(),Yt=Me.indexOf(document.activeElement),Ke=Pe=>Me[(Pe+Me.length)%Me.length]?.focus();switch(M.key){case"ArrowDown":M.preventDefault(),Ke(Yt+1);return;case"ArrowUp":M.preventDefault(),Ke(Yt-1);return;case"Home":M.preventDefault(),Ke(0);return;case"End":M.preventDefault(),Ke(Me.length-1);return;case"Tab":q(!0);return;default:if(M.key.length===1&&!M.ctrlKey&&!M.metaKey&&!M.altKey&&M.key!==" "){let Pe=M.key.toLocaleLowerCase();for(let ke=1;ke<=Me.length;ke++){let et=Me[(Yt+ke)%Me.length];if((et.textContent??"").trim().toLocaleLowerCase().startsWith(Pe)){M.preventDefault(),et.focus();return}}}}}function We(M){M.disabled||(q(!0),M.onSelect())}let we=M=>M.description!==void 0&&M.description!==null&&M.description!==!1&&M.description!=="",Ee=M=>(0,ct.jsxs)("button",{type:"button",role:M.checked===void 0?"menuitem":"menuitemradio","aria-checked":M.checked,tabIndex:-1,className:k("crewlet-menu__item",we(M)?"crewlet-menu__item--described":void 0,M.danger&&"is-danger",M.disabled&&"is-disabled"),"aria-disabled":M.disabled||void 0,onClick:()=>We(M),children:[M.checked!==void 0&&(0,ct.jsx)("span",{className:"crewlet-menu__check","aria-hidden":!0,children:M.checked&&(0,ct.jsx)(Zi,{size:"sm"})}),M.icon&&(0,ct.jsx)("span",{className:"crewlet-menu__icon",children:M.icon}),(0,ct.jsxs)("span",{className:"crewlet-menu__text",children:[(0,ct.jsx)("span",{className:"crewlet-menu__label",children:M.label}),we(M)?(0,ct.jsx)("span",{className:"crewlet-menu__description",children:M.description}):null]}),M.hint&&(0,ct.jsx)("span",{className:"crewlet-menu__hint",children:M.hint})]},M.key),ba=p?(0,ct.jsxs)("div",{className:k("crewlet-menu",C!==null&&C!==document.body?"crewlet-menu--in-host":null,m),id:w,role:"menu","aria-label":e,"aria-describedby":u?S:void 0,tabIndex:-1,ref:M=>{T.current=M,ae.panelRef(M)},style:A?{left:A.left,top:A.top,zIndex:ae.zIndex,...A.floor===void 0?null:{"--crewlet-menu-floor":`${A.floor}px`}}:{visibility:"hidden"},onKeyDown:St,onPointerDown:M=>M.stopPropagation(),onClick:M=>M.stopPropagation(),children:[u?(0,ct.jsx)("div",{role:"presentation",id:S,className:"crewlet-menu__header",children:u}):null,sx(t).map(M=>M.kind==="separator"?(0,ct.jsx)("div",{role:"separator",className:"crewlet-menu__separator"},M.key):M.kind==="answers"?(0,ct.jsx)("div",{role:"group",className:"crewlet-menu__group",children:M.items.map(Ee)},M.key):Ee(M.item))]}):null,je={ref:M=>{y.current=M,ae.insideRef(M)},"aria-haspopup":"menu","aria-expanded":p,"aria-controls":p?w:void 0,tabIndex:r,onClick:()=>{p?q(!0):(N.current="first",H(!0))},onKeyDown:qe};return(0,ct.jsxs)("span",{className:"crewlet-menu-anchor",children:[g?g(je):l===void 0?(0,ct.jsx)(_o,{...je,label:e,icon:a??(0,ct.jsx)(Bh,{}),size:"sm"}):(0,ct.jsx)(Na,{...je,variant:i,size:"small",leadingIcon:a,trailingIcon:n,children:l}),ba&&C?(0,D2.createPortal)(ba,C):null]})}var z=Q(wt(),1);var E=Q(be(),1);function g0({column:e,id:t,labels:a}){let l=vl(e,t);if(!l)return(0,E.jsx)(Zc,{size:"xs",children:t});if(l.archived)return(0,E.jsx)(Zc,{size:"xs",appearance:"outline",children:a.archived(l.label)});let n=zc(l.color);return(0,E.jsx)(Zc,{size:"xs",hue:n==="neutral"?void 0:n,children:l.label})}function k2({person:e,fallback:t}){return e?(0,E.jsxs)("span",{className:"crewlet-sheet-cell__person",children:[(0,E.jsx)(Eo,{name:e.name,kind:e.kind==="human"?"human":"agent",src:e.src,character:e.character!==void 0&&So(e.character)?e.character:void 0,hue:e.kind==="agent"?e.hue:void 0,size:"xs",decorative:!0}),(0,E.jsx)("span",{className:"crewlet-sheet-cell__text",children:e.name})]}):(0,E.jsx)("span",{className:"crewlet-sheet-cell__muted",children:t})}function L2({column:e,value:t,context:a,onOpenLink:l}){let{labels:n}=a;if(e.type==="checkbox"){let i=t===!0;return(0,E.jsxs)("span",{className:"crewlet-sheet-cell__checkbox",children:[(0,E.jsx)("span",{className:k("crewlet-sheet-cell__check",i&&"crewlet-sheet-cell__check--on"),"aria-hidden":"true",children:i?(0,E.jsx)(Zi,{size:"xs"}):null}),(0,E.jsx)(Tt,{children:i?n.checked:n.unchecked})]})}if(bl(t))return(0,E.jsx)(Tt,{children:n.empty});switch(e.type){case"select":return(0,E.jsx)(g0,{column:e,id:String(t),labels:n});case"multiselect":return(0,E.jsx)(A2,{label:e.label,overflow:"fit",className:"crewlet-sheet-cell__chips",children:t.map(i=>(0,E.jsx)(g0,{column:e,id:i,labels:n},i))});case"status":{let i=vl(e,String(t)),r=Ma(e,t,a);return(0,E.jsx)(No,{tone:i&&!i.archived?Oc(i):"neutral",children:r})}case"person":return(0,E.jsx)(k2,{person:ji(a.people,String(t)),fallback:n.unknownPerson});case"rating":{let i=yl(e),r=Number(t);return(0,E.jsxs)("span",{className:"crewlet-sheet-cell__rating",children:[(0,E.jsx)("span",{className:"crewlet-sheet-cell__stars","aria-hidden":"true",children:Array.from({length:i},(o,s)=>(0,E.jsx)(Kh,{size:"sm",filled:s<r,className:k("crewlet-sheet-cell__star",s<r&&"crewlet-sheet-cell__star--on")},s))}),(0,E.jsx)(Tt,{children:n.rating(r,i)})]})}case"url":{let i=String(t);return(0,E.jsx)("a",{className:"crewlet-sheet-cell__link",href:i,target:"_blank",rel:"noopener noreferrer",tabIndex:-1,onClick:l?r=>{r.preventDefault(),l(i)}:void 0,children:i})}case"number":return(0,E.jsx)("span",{className:"crewlet-sheet-cell__text crewlet-sheet-cell__number",children:Ma(e,t,a)});default:return(0,E.jsx)("span",{className:"crewlet-sheet-cell__text",children:Ma(e,t,a)})}}var cx=new Set(["text","number","url","date","rating"]),ux=new Set(["text","longtext"]),dx=6,fx=8,U2=new Set(["select","multiselect","status","person"]),hx=e=>e!=="checkbox",G2=e=>cx.has(e)||U2.has(e)||e==="longtext";function B2(e,t){if(e.key==="Tab")return e.shiftKey?"left":"right";if(e.key==="Enter")return t?e.shiftKey&&!kn(e)?void 0:"down":e.shiftKey?"up":"down"}function v0(e,t){e&&(e.focus({preventScroll:!0}),t&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.setSelectionRange(e.value.length,e.value.length))}function y0(e){let t=(0,z.useRef)(!1);return{finish:()=>{t.current=!0},onBlur:a=>{if(t.current)return;let l=a.relatedTarget;l!==null&&a.currentTarget.contains(l)||(t.current=!0,e())}}}function px(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return"";let a=l=>String(l).padStart(2,"0");return`${t.getFullYear()}-${a(t.getMonth()+1)}-${a(t.getDate())}T${a(t.getHours())}:${a(t.getMinutes())}`}function b0({conflict:e,labels:t}){return(0,E.jsxs)("div",{className:"crewlet-sheet-editor__conflict",role:"alert",children:[(0,E.jsx)("p",{className:"crewlet-sheet-editor__conflict-text",children:t.conflict(e.writer,e.value)}),(0,E.jsxs)("div",{className:"crewlet-sheet-editor__conflict-actions",children:[(0,E.jsx)(Na,{size:"small",variant:"secondary",onClick:e.onKeepMine,children:t.keepMine}),(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:e.onUseTheirs,children:t.useTheirs(e.writer)})]})]})}function w0({id:e,message:t}){return(0,E.jsxs)("p",{id:e,className:"crewlet-sheet-editor__error",children:[(0,E.jsx)(Ii,{size:"xs","aria-hidden":"true"}),(0,E.jsx)("span",{children:t})]})}function q2(e){let{column:t}=e;return U2.has(t.type)?(0,E.jsx)(bx,{...e}):ux.has(t.type)?(0,E.jsx)(gx,{...e}):(0,E.jsx)(mx,{...e})}function mx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,conflict:o}){let{labels:s}=a,c=(0,z.useId)(),d=(0,z.useRef)(null),g=e.type==="date",u=(0,z.useMemo)(()=>{if(g){let p=typeof t=="string"?t:"";return e.time?px(p):p}return l??Ki(e,t,a)},[]),[m,b]=(0,z.useState)(u),[w,S]=(0,z.useState)(null);(0,z.useLayoutEffect)(()=>{v0(d.current,!g)},[g]);let f=p=>{let y=g&&e.time&&m!==""?new Date(m).toISOString():m,T=Xi(e,y,a);return T.ok?(h.finish(),i(T.value,p),!0):(S(T.error),!1)},h=y0(()=>{f(null)||r()});return(0,E.jsxs)("div",{className:"crewlet-sheet-editor crewlet-sheet-editor--line",onBlur:h.onBlur,children:[(0,E.jsx)("input",{ref:d,className:"crewlet-sheet-editor__input",type:g?e.time?"datetime-local":"date":e.type==="url"?"url":"text",inputMode:e.type==="number"?"decimal":e.type==="rating"?"numeric":void 0,"aria-label":n,"aria-invalid":w!==null,"aria-describedby":w!==null?c:void 0,maxLength:e.type==="text"?en(e):void 0,value:m,onChange:p=>{b(p.target.value),S(null)},onKeyDown:p=>{if(Pi(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),h.finish(),r();return}if(p.key==="Tab"&&o)return;let y=B2(p,!1);y!==void 0&&(p.preventDefault(),p.stopPropagation(),f(y))}}),w!==null||o?(0,E.jsxs)("div",{className:k("crewlet-sheet-editor__panel"),children:[w!==null?(0,E.jsx)(w0,{id:c,message:w}):null,o?(0,E.jsx)(b0,{conflict:o,labels:s}):null]}):null]})}function gx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="longtext",g=(0,z.useId)(),u=(0,z.useRef)(null),[m,b]=(0,z.useState)(()=>l??Ki(e,t,a)),[w,S]=(0,z.useState)(null);(0,z.useLayoutEffect)(()=>{v0(u.current,!0)},[]),(0,z.useLayoutEffect)(()=>{let p=u.current;!p||p.scrollHeight===0||(p.style.height="auto",p.style.height=`${p.scrollHeight}px`)},[m]);let f=p=>{let y=Xi(e,m,a);return y.ok?(h.finish(),i(y.value,p),!0):(S(y.error),!1)},h=y0(()=>{f(null)||r()});return(0,E.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--text",d&&"crewlet-sheet-editor--long",`crewlet-sheet-editor--${o}`),onBlur:h.onBlur,children:(0,E.jsxs)("div",{className:"crewlet-sheet-editor__overlay",children:[(0,E.jsx)("textarea",{ref:u,className:"crewlet-sheet-editor__textarea","aria-label":n,"aria-multiline":d,"aria-invalid":w!==null,"aria-describedby":w!==null?g:void 0,maxLength:en(e),rows:1,style:{"--crewlet-sheet-editor-lines":dx},value:m,onChange:p=>{b(d?p.target.value:p.target.value.replace(/\r?\n/g," ")),S(null)},onKeyDown:p=>{if(Pi(p))return;if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),h.finish(),r();return}if(p.key==="Tab"&&s)return;let y=B2(p,d);y!==void 0&&(p.preventDefault(),p.stopPropagation(),f(y))}}),w!==null?(0,E.jsx)(w0,{id:g,message:w}):null,s?(0,E.jsx)(b0,{conflict:s,labels:c}):null]})})}function vx(e,t){return e.type==="person"?(t.people??[]).map(a=>({id:a.id,label:a.name,person:a})):Vi(e).map(a=>({id:a.id,label:a.label,option:a}))}function yx({column:e,choice:t,context:a}){return t.person?(0,E.jsx)(k2,{person:t.person,fallback:t.label}):e.type==="status"&&t.option?(0,E.jsx)(No,{tone:Oc(t.option),children:t.label}):(0,E.jsx)(g0,{column:e,id:t.id,labels:a.labels})}var Ja="";function bx({column:e,value:t,context:a,seed:l,label:n,onCommit:i,onCancel:r,side:o="below",conflict:s}){let{labels:c}=a,d=e.type==="multiselect",g=(0,z.useId)(),u=(0,z.useId)(),m=(0,z.useRef)(null),b=(0,z.useRef)(null),w=(0,z.useMemo)(()=>vx(e,a),[e,a]),S=w.length>fx,[f,h]=(0,z.useState)(S?l??"":""),[p,y]=(0,z.useState)(()=>d?[...t??[]]:typeof t=="string"?[t]:[]),[T,R]=(0,z.useState)(null),N=!d&&!e.required,A=(0,z.useMemo)(()=>{let O=f.trim().toLowerCase(),F=O===""?w:w.filter(I=>I.label.toLowerCase().includes(O));return N&&O===""?[...F,{id:Ja,label:c.clear}]:F},[w,f,N,c.clear]),[X,C]=(0,z.useState)(()=>{let O=!S&&l?A.findIndex(I=>I.id!==Ja&&I.label.toLowerCase().startsWith(l.toLowerCase())):-1;if(O>=0)return O;let F=A.findIndex(I=>I.id!==Ja&&p.includes(I.id));return F>=0?F:0});(0,z.useEffect)(()=>{C(O=>Math.min(O,Math.max(A.length-1,0)))},[A.length]),(0,z.useLayoutEffect)(()=>{v0(S?m.current:b.current,!1)},[S]);let G=(O,F)=>{let I=fh(e,O,a);return I!==null?(R(I),!1):(Be.finish(),i(O,F),!0)},Be=y0(()=>{(!d||!G(p,null))&&r()}),H=(O,F)=>{if(O){if(!d){G(O.id===Ja?null:O.id,F);return}R(null),y(I=>I.includes(O.id)?I.filter(qe=>qe!==O.id):[...I,O.id])}},D=O=>`${g}-${O}`,q=A.length>0?D(X):void 0,ae=O=>{if(!Pi(O))switch(O.key){case"Escape":O.preventDefault(),O.stopPropagation(),Be.finish(),r();return;case"ArrowDown":O.preventDefault(),O.stopPropagation(),C(F=>Math.min(F+1,A.length-1));return;case"ArrowUp":O.preventDefault(),O.stopPropagation(),C(F=>Math.max(F-1,0));return;case"Home":case"End":if(f!=="")return;O.preventDefault(),O.stopPropagation(),C(O.key==="Home"?0:A.length-1);return;case"Enter":O.preventDefault(),O.stopPropagation(),d&&kn(O)?G(p,"down"):H(A[X],O.shiftKey?"up":"down");return;case" ":if(S)return;O.preventDefault(),O.stopPropagation(),H(A[X],d?null:"down");return;case"Tab":if(s)return;O.preventDefault(),O.stopPropagation(),G(d?p:t,O.shiftKey?"left":"right");return;default:if(!S&&O.key.length===1&&!O.ctrlKey&&!O.metaKey&&!O.altKey){let F=O.key.toLowerCase(),I=X+1,St=[...A.slice(I),...A.slice(0,I)].find(We=>We.id!==Ja&&We.label.toLowerCase().startsWith(F));St&&(O.preventDefault(),O.stopPropagation(),C(A.indexOf(St)))}return}};return(0,E.jsx)("div",{className:k("crewlet-sheet-editor","crewlet-sheet-editor--list",`crewlet-sheet-editor--${o}`),onBlur:Be.onBlur,children:(0,E.jsxs)("div",{className:"crewlet-sheet-editor__panel crewlet-sheet-editor__panel--list",children:[S?(0,E.jsx)("input",{ref:m,className:"crewlet-sheet-editor__filter",role:"combobox","aria-label":n,"aria-expanded":"true","aria-controls":g,"aria-autocomplete":"list","aria-activedescendant":q,"aria-invalid":T!==null,"aria-describedby":T!==null?u:void 0,placeholder:c.filter,value:f,onChange:O=>{h(O.target.value),C(0)},onKeyDown:ae}):null,(0,E.jsx)("ul",{ref:b,className:"crewlet-sheet-editor__list",id:g,role:"listbox","aria-label":n,"aria-multiselectable":d||void 0,tabIndex:-1,"aria-activedescendant":S?void 0:q,"aria-invalid":S?void 0:T!==null,"aria-describedby":!S&&T!==null?u:void 0,onKeyDown:S?void 0:ae,children:A.length===0?(0,E.jsx)("li",{className:"crewlet-sheet-editor__empty",role:"presentation",children:c.noOptions}):A.map((O,F)=>{let I=O.id===Ja?p.length===0:p.includes(O.id);return(0,E.jsxs)("li",{id:D(F),role:"option","aria-selected":I,className:k("crewlet-sheet-editor__option",O.id===Ja&&"crewlet-sheet-editor__option--clear",F===X&&"crewlet-sheet-editor__option--highlight",I&&"crewlet-sheet-editor__option--selected"),onMouseDown:qe=>qe.preventDefault(),onMouseEnter:()=>C(F),onClick:()=>H(O,d?null:"down"),children:[(0,E.jsx)("span",{className:"crewlet-sheet-editor__mark","aria-hidden":"true",children:I&&O.id!==Ja?(0,E.jsx)(Zi,{size:"xs"}):null}),O.id===Ja?(0,E.jsx)("span",{className:"crewlet-sheet-cell__muted",children:O.label}):(0,E.jsx)(yx,{column:e,choice:O,context:a})]},O.id===Ja?"\0clear":O.id)})}),T!==null?(0,E.jsx)(w0,{id:u,message:T}):null,s?(0,E.jsx)(b0,{conflict:s,labels:c}):null]})})}var nn=-1;function x0({label:e,columns:t,rows:a,people:l,mode:n="edit",onEdit:i,onAddRow:r,onShowHistory:o,onActiveCellChange:s,onEditingChange:c,onUndo:d,onRedo:g,onOpenLink:u,presence:m,sort:b,onSortChange:w,sync:S,onRetry:f,height:h,fit:p="container",onDeleteRow:y,onDismissRefused:T,locale:R,className:N,labels:A,presenceLabels:X}){let C=(0,z.useId)(),G=(0,z.useMemo)(()=>go(A),[A]),Be=(0,z.useMemo)(()=>mo(X),[X]),H=(0,z.useMemo)(()=>({people:l,locale:R,labels:G}),[l,R,G]),D=(0,z.useMemo)(()=>wh(t),[t]),q=(0,z.useMemo)(()=>Ah(D,a,b,H),[D,a,b,H]),ae=n==="edit"&&i!==void 0,O=n==="edit"&&y!==void 0,F=(0,z.useRef)(null),I=(0,z.useRef)(null),qe=(0,z.useRef)(null),[St,We]=(0,z.useState)(0),we=(0,z.useRef)(0),[Ee,ba]=(0,z.useState)(Cc),[je,M]=(0,z.useState)(Cc),[Me,Yt]=(0,z.useState)(0),[Ke,Pe]=(0,z.useState)(0),[ke,et]=(0,z.useState)(null),[ta,Fa]=(0,z.useState)(null),[j,aa]=(0,z.useState)(null),[Wa,la]=(0,z.useState)(new Map),[V,J]=(0,z.useState)({text:"",n:0}),tt=(0,z.useRef)(!1),[na,Ca]=(0,z.useState)(null),[Re,rn]=(0,z.useState)(null),Dt=(0,z.useCallback)(v=>J(x=>({text:v,n:x.n+1})),[]),A0=(0,z.useRef)(new Map);(0,z.useEffect)(()=>{let v=new Map;for(let x of a)for(let[L,B]of Object.entries(x.refused??{}))v.set(ga(x.id,L),B);for(let[x,L]of v)if(A0.current.get(x)!==L){Dt(G.notSaved(L));break}A0.current=v},[a,G,Dt]),(0,z.useLayoutEffect)(()=>{let v=()=>{let L=I.current?.offsetHeight??0;L>0&&ba(L);let B=qe.current?.querySelector(".crewlet-sheet-grid__row--head")?.offsetHeight??0;B>0&&M(B),Yt(F.current?.clientHeight??0)};if(v(),typeof ResizeObserver!="function")return;let x=new ResizeObserver(v);return F.current&&x.observe(F.current),I.current&&x.observe(I.current),()=>x.disconnect()},[]);let Un=(0,z.useMemo)(()=>bh(D),[D]),Q2=(0,z.useMemo)(()=>[`${Qi}px`,...D.map((v,x)=>x===D.length-1?`minmax(${tn(v)}px, 1fr)`:`${tn(v)}px`)].join(" "),[D]),Z2=(0,z.useMemo)(()=>D.reduce((v,x)=>v+tn(x),Qi),[D]),$c=(0,z.useMemo)(()=>{let v=Qi;return D.forEach((x,L)=>{x.frozen&&(v=(Un[L]??v)+tn(x))}),v},[D,Un]),on=(0,z.useMemo)(()=>new Map(q.map((v,x)=>[v.id,x])),[q]),Oo=(0,z.useMemo)(()=>new Map(D.map((v,x)=>[v.field,x])),[D]),Bn=(0,z.useCallback)(v=>{if(!v)return null;let x=Oo.get(v.field);if(x===void 0)return null;if(v.rowId===null)return{row:nn,col:x};let L=on.get(v.rowId);return L===void 0?null:{row:L,col:x}},[Oo,on]),Pa=(0,z.useCallback)(v=>{let x=D[v.col];if(!x)return null;if(v.row===nn)return{rowId:null,field:x.field};let L=q[v.row];return L?{rowId:L.id,field:x.field}:null},[D,q]),I2=q.length>0&&D.length>0?{rowId:q[0].id,field:D[0].field}:D.length>0?{rowId:null,field:D[0].field}:null,le=Bn(ke)??Bn(I2),at=le?Pa(le):null,N0=Bn(ta)??le,Et=le&&N0&&le.row!==nn?ph(N0,le):null,z0=(0,z.useMemo)(()=>Nh(m),[m]),J2=(0,z.useMemo)(()=>zh(m),[m]),$2=(0,z.useMemo)(()=>Oh(m),[m]),O0=(0,z.useRef)(null);(0,z.useEffect)(()=>{let v=at&&at.rowId!==null?{rowId:at.rowId,field:at.field}:null,x=v?ga(v.rowId,v.field):null;x!==O0.current&&(O0.current=x,s?.(v))},[at,s]);let C0=(0,z.useRef)(null);(0,z.useEffect)(()=>{let v=j?ga(j.rowId,j.field):null;v!==C0.current&&(C0.current=v,c?.(j?{rowId:j.rowId,field:j.field}:null))},[j,c]);let Co=(0,z.useCallback)(v=>{v.length!==0&&(la(x=>{let L=new Map(x);for(let B of v)L.set(ga(B.rowId,B.field),B.error);return L}),Dt(v[0].error))},[Dt]),Ro=(0,z.useCallback)(v=>{la(x=>{if(!v.some(B=>x.has(B)))return x;let L=new Map(x);for(let B of v)L.delete(B);return L})},[]),xl=(0,z.useCallback)(v=>{v.length===0||!i||(Ro(v.map(x=>ga(x.rowId,x.field))),i(v))},[i,Ro]),sn=(0,z.useCallback)(v=>D[Oo.get(v)??-1],[D,Oo]),cn=(0,z.useCallback)(v=>q[on.get(v)??-1],[q,on]),qn=(0,z.useCallback)(v=>ae&&v!==void 0&&!v.readOnly,[ae]),Fc=(0,z.useCallback)(()=>We(v=>v+1),[]),Vn=(0,z.useCallback)((v,x=!1)=>{v&&(et(v),x||Fa(v),Fc())},[Fc]),R0=v=>{ke&&ke.rowId===v.rowId&&ke.field===v.field||(et(v),Fa(v))},ar=le?.row??null,lr=le?.col??null;(0,z.useLayoutEffect)(()=>{if(ar===null||lr===null)return;let v=F.current;if(v&&ar>=0){let x=vh(ar,v.scrollTop,v.clientHeight,Ee,je);x!==v.scrollTop&&(v.scrollTop=x,Pe(x));let L=D[lr];if(L&&!L.frozen){let B=Un[lr]??0,ce=B+tn(L);B-$c<v.scrollLeft?v.scrollLeft=Math.max(B-$c,0):ce>v.scrollLeft+v.clientWidth&&(v.scrollLeft=ce-v.clientWidth)}}St===we.current||j||(we.current=St,document.getElementById(m0(C,{row:ar,col:lr}))?.focus({preventScroll:!0}))},[ar,lr,St,j,C,Ee,je,D,Un,$c]);let Do=(0,z.useCallback)((v,x)=>{if(v.rowId===null)return;let L=sn(v.field),B=cn(v.rowId);if(!(!B||!L)){if(!qn(L)){Dt(ae?G.readOnly(L.label):G.forbidden);return}hx(L.type)&&(Ro([ga(v.rowId,v.field)]),aa({rowId:v.rowId,field:v.field,seed:x,base:Ct(L,B.values[L.field])}))}},[qn,Ro,sn,ae,G,cn,Dt]),Wc=(0,z.useCallback)(v=>{if(v.rowId===null)return;let x=sn(v.field),L=cn(v.rowId);if(!(!L||!x||x.type!=="checkbox")){if(!qn(x)){Dt(ae?G.readOnly(x.label):G.forbidden);return}xl([{rowId:L.id,field:x.field,value:Ct(x,L.values[x.field])!==!0}])}},[qn,sn,ae,xl,G,cn,Dt]),D0=(0,z.useCallback)((v,x)=>{if(x===null)return Pa(v);let L={down:{row:Math.min(v.row+1,q.length-1),col:v.col},up:{row:Math.max(v.row-1,0),col:v.col},right:{row:v.row,col:Math.min(v.col+1,D.length-1)},left:{row:v.row,col:Math.max(v.col-1,0)}}[x];return Pa(L)},[Pa,D.length,q.length]),H0=(0,z.useCallback)((v,x)=>{if(!j)return;let L=Bn({rowId:j.rowId,field:j.field}),B=sn(j.field),ce=cn(j.rowId);aa(null),v!==void 0&&B&&ce&&!Yi(v,Ct(B,ce.values[B.field]))&&xl([{rowId:ce.id,field:B.field,value:v}]);let Ve=document.activeElement,Ht=Ve!==null&&Ve!==document.body&&!!qe.current?.contains(Ve);L&&Ht&&Vn(D0(L,x))},[sn,j,xl,Vn,Bn,cn,D0]);(0,z.useEffect)(()=>{j&&!on.has(j.rowId)&&aa(null)},[j,on]);let Ho=j?cn(j.rowId):void 0,Yn=j?sn(j.field):void 0,Pc=j&&Ho&&Yn?Ct(Yn,Ho.values[Yn.field]):null,G0=!!(j&&Ho&&Yn&&!Yi(Pc,j.base)),F2=G0&&j?Ho?.changed?.[j.field]?.by??G.someone:"",Go=G0&&j&&Yn?{writer:F2,value:Ma(Yn,Pc,H)||G.empty,onKeepMine:()=>aa(v=>v&&{...v,base:Pc}),onUseTheirs:()=>{let v=Bn({rowId:j.rowId,field:j.field});aa(null),v&&Vn(Pa(v))}}:null,eu=Go?G.conflict(Go.writer,Go.value):"";(0,z.useEffect)(()=>{eu&&Dt(eu)},[eu,Dt]);let k0=v=>{j||!Et||(v.preventDefault(),v.clipboardData.setData("text/plain",_h(D,q,Et,H)))},L0=(0,z.useCallback)(()=>{if(!Et)return;if(!ae){Dt(G.forbidden);return}let v=Eh(D,q,Et,H);xl(v.edits),Co(v.refused)},[D,H,ae,xl,G.forbidden,Et,Co,q,Dt]),W2=v=>{j||!Et||(k0(v),L0())},P2=v=>{if(j||!Et)return;if(v.preventDefault(),!ae){Dt(G.forbidden);return}let x=Sh(D,q,Et,Th(v.clipboardData.getData("text/plain")),H);xl(x.edits),Co(x.refused)},eb=Math.max(1,Math.floor(Math.max(Me-je,Ee)/Ee)-1),tb=v=>{if(j||Pi(v)||!le||!at)return;let x=D[le.col],L=kn(v);if(L&&v.altKey&&v.key.toLowerCase()==="h"){o&&at.rowId!==null&&(v.preventDefault(),o({rowId:at.rowId,field:at.field}));return}if(L&&!v.altKey&&v.key.toLowerCase()==="z"){let ce=v.shiftKey?g:d;ce&&(v.preventDefault(),ce());return}if(L&&!v.altKey&&v.key.toLowerCase()==="y"){g&&(v.preventDefault(),g());return}if(L&&!v.altKey&&v.key.toLowerCase()==="a"){if(v.preventDefault(),q.length===0)return;Fa(Pa({row:0,col:0})),et(Pa({row:q.length-1,col:D.length-1})),Fc();return}if(O&&at.rowId!==null&&(v.key==="ContextMenu"||v.shiftKey&&v.key==="F10")){v.preventDefault(),rn(at.rowId);return}let B=hh(le,v,{rows:q.length,cols:D.length,page:eb});if(B){v.preventDefault();let ce=v.shiftKey&&B.row!==nn&&le.row!==nn;Vn(Pa(B),ce);return}if(v.key==="Tab"){let ce=v.shiftKey?-1:1,Ve=le.col+ce;if(Ve<0||Ve>=D.length)return;v.preventDefault(),Vn(Pa({row:le.row,col:Ve}));return}if(le.row===nn){(v.key==="Enter"||v.key===" ")&&x&&w&&(v.preventDefault(),w(Hc(b,x.field)));return}switch(v.key){case"Enter":case"F2":if(v.preventDefault(),v.key==="Enter"&&L&&x?.type==="url"){let ce=q[le.row],Ve=ce?Ct(x,ce.values[x.field]):null;typeof Ve=="string"&&Ve&&(u?u(Ve):window.open(Ve,"_blank","noopener,noreferrer"));return}x?.type==="checkbox"?Wc(at):Do(at);return;case" ":v.preventDefault(),x?.type==="checkbox"?Wc(at):x&&G2(x.type)&&Do(at," ");return;case"Delete":case"Backspace":v.preventDefault(),L0();return;case"Escape":ta&&Et&&(Et.top!==Et.bottom||Et.left!==Et.right)&&(v.preventDefault(),Fa(at));return}if(xh(v)&&x){if(x.type==="rating"&&/^\d$/.test(v.key)){if(v.preventDefault(),!qn(x)){Dt(ae?G.readOnly(x.label):G.forbidden);return}let ce=Number(v.key),Ve=q[le.row];if(!Ve)return;if(ce>yl(x)){Co([{rowId:Ve.id,field:x.field,error:G.notARating(x.label,yl(x))}]);return}xl([{rowId:Ve.id,field:x.field,value:ce===0?null:ce}]);return}G2(x.type)&&(v.preventDefault(),Do(at,x.type==="date"?void 0:v.key))}};(0,z.useEffect)(()=>{let v=()=>{tt.current=!1};return window.addEventListener("mouseup",v),()=>window.removeEventListener("mouseup",v)},[]);let U0=(v,x)=>{if(v.button!==0)return;let L=v.shiftKey&&x.rowId!==null&&at?.rowId!==null;j&&j.rowId===x.rowId&&j.field===x.field||Vn(x,L),tt.current=x.rowId!==null},ab=v=>{!tt.current||v.rowId===null||et(v)},[B0,q0]=gh(Math.max(Ke-je,0),Me,Ee,q.length),nr=[];for(let v=B0;v<=q0;v+=1)nr.push(v);if(le&&le.row>=0&&(le.row<B0||le.row>q0)&&nr.push(le.row),j){let v=on.get(j.rowId);v!==void 0&&!nr.includes(v)&&nr.push(v)}let V0=`${C}-described`,Y0=`${C}-help`,ir=le?D[le.col]:void 0,ko=le&&le.row>=0?q[le.row]:void 0,lb=ko&&ir?z0.get(ga(ko.id,ir.field))??[]:[],nb=ko&&ir?Rh(ir,wx(ko,Wa,ir.field),lb,H,Be):"",ib={"--crewlet-sheet-columns":Q2,"--crewlet-sheet-row-height":`${Ee}px`,width:`${Z2}px`},j0=je+q.length*Ee+2,rb=p==="content"?{height:`${h!==void 0?Math.min(j0,h):j0}px`}:h!==void 0?{height:`${h}px`}:void 0,ob=v=>{let x=je+v*Ee-Ke,L=Me>0?Me:Ee*12;return yh(x,x+Ee,je,L,Ee*8)};return(0,E.jsxs)("div",{className:k("crewlet-sheet-grid",n==="read"&&"crewlet-sheet-grid--read",p==="content"&&"crewlet-sheet-grid--fit-content",N),children:[(0,E.jsx)("div",{ref:I,className:"crewlet-sheet-grid__probe","aria-hidden":"true"}),(0,E.jsx)("div",{ref:F,className:"crewlet-sheet-grid__scroller",style:rb,onScroll:v=>Pe(v.currentTarget.scrollTop),children:(0,E.jsxs)("div",{ref:qe,role:"grid","aria-label":e,"aria-rowcount":q.length+1,"aria-colcount":D.length+1,"aria-readonly":!ae||void 0,"aria-multiselectable":"true","aria-describedby":Y0,tabIndex:-1,className:"crewlet-sheet-grid__grid",style:ib,onKeyDown:tb,onMouseMove:O?v=>{let x=v.target.closest("[data-row-id]")?.dataset.rowId??null;Ca(L=>L===x?L:x)}:void 0,onMouseLeave:O?()=>Ca(null):void 0,onCopy:k0,onCut:W2,onPaste:P2,children:[(0,E.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__head",children:(0,E.jsxs)("div",{role:"row","aria-rowindex":1,className:"crewlet-sheet-grid__row crewlet-sheet-grid__row--head",children:[(0,E.jsx)("div",{role:"columnheader","aria-colindex":1,className:"crewlet-sheet-grid__corner",children:(0,E.jsx)(Tt,{children:G.rowHeader})}),D.map((v,x)=>{let L={row:nn,col:x},B=le?.row===nn&&le.col===x,ce=b?.field===v.field?b.direction:void 0,Ve=$2.get(v.field)??[];return(0,E.jsxs)("div",{id:m0(C,L),role:"columnheader","aria-colindex":x+2,"aria-sort":ce??(w?"none":void 0),tabIndex:B?0:-1,className:k("crewlet-sheet-grid__header",v.frozen&&"crewlet-sheet-grid__cell--frozen",B&&"crewlet-sheet-grid__header--active"),style:v.frozen?{insetInlineStart:`${Un[x]}px`}:void 0,onMouseDown:Ht=>U0(Ht,{rowId:null,field:v.field}),onFocus:Ht=>{Ht.target===Ht.currentTarget&&R0({rowId:null,field:v.field})},onClick:()=>{w&&w(Hc(b,v.field))},title:w?G.sortBy(v.label):void 0,children:[(0,E.jsx)("span",{className:"crewlet-sheet-grid__header-label",children:v.label}),(0,E.jsx)(Tt,{children:`, ${G.types[v.type]}`}),ce?(0,E.jsx)("span",{className:"crewlet-sheet-grid__sort","aria-hidden":"true",children:ce==="ascending"?(0,E.jsx)(Gh,{size:"xs"}):(0,E.jsx)(Hh,{size:"xs"})}):null,Ve.length>0?(0,E.jsx)("span",{className:"crewlet-sheet-grid__header-presence","aria-hidden":"true",children:Ve.map(Ht=>(0,E.jsx)(Eo,{name:Ht.name,kind:Ht.kind,size:16,decorative:!0,className:k("crewlet-sheet-grid__header-badge",an(Ht.hue))},Ht.id))}):null]},v.field)})]})}),(0,E.jsx)("div",{role:"rowgroup",className:"crewlet-sheet-grid__body",style:{height:`${q.length*Ee}px`},children:nr.map(v=>{let x=q[v],L=J2.get(x.id);return(0,E.jsxs)("div",{role:"row","aria-rowindex":v+2,className:"crewlet-sheet-grid__row",style:{top:`${v*Ee}px`},"data-row-id":x.id,children:[(0,E.jsxs)("div",{role:"rowheader","aria-colindex":1,className:k("crewlet-sheet-grid__rownum",L&&"crewlet-sheet-grid__rownum--present",L&&an(L.hue)),children:[(0,E.jsx)("span",{"aria-hidden":"true",children:v+1}),(0,E.jsx)(Tt,{children:Gc(D,x,v,H)}),O&&(Re===x.id||na===x.id||le?.row===v)?(0,E.jsx)("span",{className:"crewlet-sheet-grid__row-actions",children:(0,E.jsx)(H2,{label:G.rowActions(v+1),icon:(0,E.jsx)(Uh,{size:"xs"}),triggerTabIndex:-1,open:Re===x.id,onOpenChange:B=>rn(B?x.id:null),items:[{key:"delete",label:G.deleteRow,icon:(0,E.jsx)(Xh,{size:"sm"}),danger:!0,onSelect:()=>y?.(x.id)}]})}):null]}),D.map((B,ce)=>{let Ve={row:v,col:ce},Ht=ga(x.id,B.field),rr=le?.row===v&&le.col===ce,K0=Et?mh(Et,v,ce):!1,sb=x.pending?.includes(B.field)??!1,Lo=x.refused?.[B.field]??Wa.get(Ht),or=x.changed?.[B.field],X0=Ct(B,x.values[B.field]),Uo=z0.get(Ht),_l=Uo?.[0],sr=j?.rowId===x.id&&j.field===B.field;return(0,E.jsxs)("div",{id:m0(C,Ve),role:"gridcell","aria-colindex":ce+2,"aria-selected":K0,"aria-readonly":!qn(B)||void 0,"aria-describedby":rr?V0:void 0,tabIndex:rr&&!sr?0:-1,className:k("crewlet-sheet-grid__cell",`crewlet-sheet-grid__cell--${B.type}`,B.frozen&&"crewlet-sheet-grid__cell--frozen",K0&&"crewlet-sheet-grid__cell--selected",rr&&"crewlet-sheet-grid__cell--active",sb&&"crewlet-sheet-grid__cell--pending",Lo!==void 0&&"crewlet-sheet-grid__cell--refused",sr&&"crewlet-sheet-grid__cell--editing",_l&&"crewlet-presence-ring",_l&&an(_l.hue),_l&&(_l.idle?"crewlet-presence-ring--idle":null)),style:B.frozen?{insetInlineStart:`${Un[ce]}px`}:void 0,onMouseDown:ia=>U0(ia,{rowId:x.id,field:B.field}),onFocus:ia=>{ia.target===ia.currentTarget&&R0({rowId:x.id,field:B.field})},onMouseEnter:()=>ab({rowId:x.id,field:B.field}),onDoubleClick:()=>{B.type!=="checkbox"&&Do({rowId:x.id,field:B.field})},onClick:ia=>{B.type==="checkbox"&&ia.target.closest(".crewlet-sheet-cell__check")&&Wc({rowId:x.id,field:B.field})},children:[(0,E.jsx)("span",{className:"crewlet-sheet-grid__value",children:(0,E.jsx)(L2,{column:B,value:X0,context:H,onOpenLink:u})}),Lo!==void 0?(0,E.jsx)("span",{className:"crewlet-sheet-grid__refused","aria-hidden":"true",children:(0,E.jsx)(Ii,{size:"xs"})}):null,or?(0,E.jsx)(R2,{by:or.by,at:or.at,previous:Dc(or)&&Ma(B,Ct(B,or.previous),H)||null,locale:R,labels:G}):null,Uo&&_l?(0,E.jsx)(N2,{name:Ch(Uo),hue:_l.hue,kind:_l.kind,editing:Uo.some(ia=>ia.editing)}):null,rr&&Lo!==void 0&&!sr?(0,E.jsx)("span",{className:"crewlet-sheet-grid__message","aria-hidden":"true",children:Lo}):null,rr&&o&&!sr?(0,E.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"crewlet-sheet-grid__history",title:G.history,onMouseDown:ia=>ia.stopPropagation(),onClick:()=>o({rowId:x.id,field:B.field}),children:(0,E.jsx)(jh,{size:"xs"})}):null,sr?(0,E.jsx)(q2,{column:B,value:X0,context:H,seed:j.seed,label:`${B.label}, ${Gc(D,x,v,H)}`,side:ob(v),conflict:Go,onCommit:(ia,cb)=>H0(ia,cb),onCancel:()=>H0(void 0,null)}):null]},B.field)})]},x.id)})})]})}),(0,E.jsx)(Tt,{id:V0,children:nb}),(0,E.jsx)(Tt,{id:Y0,children:O?`${G.keyboardHelp} ${G.rowActionsHelp}`:G.keyboardHelp}),(0,E.jsx)(Tt,{children:(0,E.jsx)("span",{role:"status","aria-live":"polite",children:(0,E.jsx)("span",{children:V.text},V.n)})}),r||S?(0,E.jsxs)("div",{className:"crewlet-sheet-grid__foot",children:[r&&ae?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:r,leadingIcon:(0,E.jsx)(Yh,{size:"sm"}),children:G.addRow}):null,S?(0,E.jsxs)("span",{className:k("crewlet-sheet-grid__sync",((S.failed??0)>0||!S.offline&&(S.refused??0)>0)&&"crewlet-sheet-grid__sync--failed"),children:[(0,E.jsx)("span",{children:G.sync(S)}),(S.failed??0)>0&&f?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:f,children:G.retry}):null,(S.failed??0)===0&&(S.refused??0)>0&&T?(0,E.jsx)(Na,{size:"small",variant:"ghost",onClick:T,children:G.dismiss}):null]}):null]}):null]})}function m0(e,t){return`${e}-r${t.row<0?"h":t.row}-c${t.col}`}function wx(e,t,a){let l=t.get(ga(e.id,a));return l===void 0||e.refused?.[a]!==void 0?e:{...e,refused:{...e.refused,[a]:l}}}var _0="crewlet:ready";function T0(e=window){return e.crewlet?Promise.resolve(e.crewlet):new Promise(t=>{let a=()=>{e.crewlet&&(e.removeEventListener(_0,a),t(e.crewlet))};e.addEventListener(_0,a)})}function V2(){let e=crypto.getRandomValues(new Uint8Array(12));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}var Oa=Q(be(),1),$a={noData:"This page did not declare the db capability, so the sheet cannot load.",noColumns:e=>`The ${e} collection has no columns yet.`,loadFailed:(e,t)=>t==="forbidden"?`You do not have access to the ${e} collection.`:t==="not_found"?`There is no ${e} collection in this artifact.`:`The ${e} collection could not be loaded. Reload the page to try again.`,stepOvertaken:e=>`Somebody changed this after you, so the ${e} was skipped.`,addRowFailed:e=>`Could not add a row. ${e}`,deleteRowTitle:"Delete this row?",deleteRowMessage:"The row is removed for everyone who can open this page.",deleteRowConfirm:"Delete row",deleteRowCancel:"Cancel"};function S0(e,t){console.warn(`[crewlet artifact-kit] ${e}`,t)}function E0(e){return e.verdict==="applied"||e.verdict==="pending"?null:vo(e.verdict,e.reason,Gn)}function Ic(e){let t=typeof e?.code=="string"?e.code:"",a=e instanceof Error?e.message:void 0;return vo(t,a,Gn)}function Y2({runtime:e,collection:t,columns:a,sort:l,frozen:n,readOnly:i=!1,label:r,height:o}){let s=e.capabilities.has("db"),c=e.capabilities.has("presence"),d=e.capabilities.has("identity"),g=(0,$.useMemo)(()=>e.data.collection(t),[e,t]),[u,m]=(0,$.useState)(null),[b,w]=(0,$.useState)(void 0),[S,f]=(0,$.useState)([]),[h,p]=(0,$.useState)(null),[y,T]=(0,$.useState)(l),[R,N]=(0,$.useState)(null),[A,X]=(0,$.useState)([]),[C,G]=(0,$.useState)([]),[Be,H]=(0,$.useState)(!1),[D,q]=(0,$.useState)(0),[ae,O]=(0,$.useState)({text:"",n:0}),[F,I]=(0,$.useState)(null),qe=(0,$.useCallback)(V=>O(J=>({text:V,n:J.n+1})),[]),[,St]=(0,$.useState)(0),We=(0,$.useRef)(new Map),we=(0,$.useMemo)(()=>new Mh,[]);(0,$.useEffect)(()=>T(l),[l]),(0,$.useEffect)(()=>we.subscribe(()=>St(V=>V+1)),[we]),(0,$.useEffect)(()=>{if(!s)return;let V=!0;return e.data.schema().then(J=>{if(!V)return;let tt=J.find(na=>na.name===t)??null;w(tt?.title),a||m(Ry(tt))}).catch(J=>{S0(`the schema of ${t} could not be read`,J),V&&!a&&m([])}),()=>{V=!1}},[e,a,s,t]),(0,$.useEffect)(()=>{if(s)return p(null),g.subscribe(V=>f(V.map(J=>({id:J.id,values:J.data}))),V=>p($a.loadFailed(t,V.code)))},[g,s,t]),(0,$.useEffect)(()=>{if(!d)return;let V=!0;return e.identity.me().then(J=>{V&&N(J)}).catch(J=>S0("the reader could not be identified",J)),e.identity.people().then(J=>{V&&X(J.map(Uy))}).catch(J=>S0("the people a person cell offers could not be listed",J)),()=>{V=!1}},[e,d]);let Ee=(0,$.useMemo)(()=>ky(a??u??[],n),[a,u,n]);(0,$.useEffect)(()=>{if(c)return G(e.presence.roster().members),e.presence.subscribe(V=>G(V.members))},[e,c]),(0,$.useEffect)(()=>{if(e.connection)return H(e.connection.state==="offline"),e.connection.subscribe(V=>H(V==="offline"))},[e]);let ba=(0,$.useMemo)(()=>{let V=qy(C,We.current);return We.current=V,V},[C]),je=R?.seat??null,M=(0,$.useMemo)(()=>Vy(C,t,je,ba),[C,t,je,ba]),Me=(0,$.useMemo)(()=>Yy(C,je,ba),[C,je,ba]),Yt=(0,$.useCallback)(V=>{let J=V.map(Re=>we.begin(Re.rowId,Re.field)),tt=Re=>{for(let rn of J)rn(Re===null?{ok:!0}:{ok:!1,message:Re})},na=Re=>({[Re.field]:Re.value}),Ca;if(V.length===1){let[Re]=V;Ca=g.merge(Re.rowId,na(Re))}else{let Re=e.data.batch();for(let rn of V)Re.merge(t,rn.rowId,na(rn));Ca=Re.commit()}Ca.then(Re=>tt(E0(Re)),Re=>tt(Ic(Re)))},[t,we,e,g]),Ke=(0,$.useCallback)(()=>{g.set(V2(),{}).then(V=>{let J=E0(V);q(tt=>J===null?0:tt+1),J!==null&&qe($a.addRowFailed(J))},V=>{q(J=>J+1),qe($a.addRowFailed(Ic(V)))})},[g,qe]),Pe=(0,$.useCallback)(V=>{let J=Ee[0],tt=J?we.begin(V,J.field):()=>{};g.delete(V).then(na=>{let Ca=E0(na);if(tt(Ca===null?{ok:!0}:{ok:!1,message:Ca}),Ca===null)for(let Re of Ee)we.dismiss(V,Re.field)},na=>tt({ok:!1,message:Ic(na)}))},[Ee,we,g]),ke=(0,$.useCallback)(V=>{e.data[V]().then(J=>{J===null||J.verdict==="applied"||J.verdict==="pending"||qe(J.verdict==="conflict"?$a.stepOvertaken(V):vo(J.verdict,J.reason,Gn))},J=>qe(Ic(J)))},[e,qe]),et=(0,$.useRef)({active:null,editing:null}),ta=(0,$.useCallback)(()=>{if(!c)return;let{active:V,editing:J}=et.current,tt=J??V,na=tt?{collection:t,doc:tt.rowId,field:tt.field}:{};e.presence.set({activity:J?"editing":"viewing",focus:na})},[e,c,t]),Fa=(0,$.useCallback)(V=>{et.current.active=V,ta()},[ta]),j=(0,$.useCallback)(V=>{et.current.editing=V,ta()},[ta]);if(!s)return(0,Oa.jsx)(Ji,{variant:"warning",children:$a.noData});if(h!==null)return(0,Oa.jsx)(Ji,{variant:"warning",children:h});if(Ee.length===0&&(a!==null||u!==null))return(0,Oa.jsx)(Ji,{variant:"neutral",children:$a.noColumns(t)});let aa=i||R?.role==="viewer",Wa={...we.sync(Be),failed:D},la=F===null?void 0:S.find(V=>V.id===F);return(0,Oa.jsxs)("div",{className:"crewlet-kit-sheet",children:[Me.length>0?(0,Oa.jsx)("div",{className:"crewlet-kit-sheet__presence",children:(0,Oa.jsx)(f0,{members:Me})}):null,(0,Oa.jsx)(x0,{label:r??b??t,columns:Ee,rows:we.decorate(S),people:A,mode:aa?"read":"edit",onEdit:aa?void 0:Yt,onAddRow:aa?void 0:Ke,onDeleteRow:aa?void 0:I,onActiveCellChange:Fa,onEditingChange:j,onUndo:()=>ke("undo"),onRedo:()=>ke("redo"),presence:M,sort:y,onSortChange:T,sync:Wa,onRetry:D>0?Ke:void 0,onDismissRefused:()=>we.dismissAll(),height:o,fit:"content"}),(0,Oa.jsx)(Wh,{open:la!==void 0,onClose:()=>I(null),onConfirm:()=>{la&&Pe(la.id),I(null)},title:$a.deleteRowTitle,message:$a.deleteRowMessage,confirmLabel:$a.deleteRowConfirm,cancelLabel:$a.deleteRowCancel,destructive:!0}),ae.text?(0,Oa.jsx)(Ji,{variant:"warning",live:"polite",children:ae.text},ae.n):null]})}var X2=Q(be(),1);function K2(e,t){let a=e.ownerDocument.createElement("div");a.className="crewlet-kit-sheet__root",e.append(a);let l=(0,j2.createRoot)(a),n=t,i=t.runtime??null,r=!1,o=()=>{r||!i||l.render((0,X2.jsx)(Y2,{runtime:i,collection:n.collection,columns:n.columns&&n.columns.length>0?n.columns:null,sort:n.sort??null,frozen:n.frozen,readOnly:n.readOnly,label:n.label,height:n.height}))};return i?o():T0(e.ownerDocument.defaultView??window).then(s=>{i=s,o()}),{update(s){n=s,s.runtime&&(i=s.runtime),o()},unmount(){r=!0,l.unmount(),a.remove()}}}var zo=class extends HTMLElement{static get observedAttributes(){return Dy}attributeChangedCallback(){this.closest("crewlet-sheet")?.dispatchEvent(new Event("crewlet-columnchange"))}toColumn(){return Hy(t=>this.getAttribute(t))}},xx=["collection","sort","frozen","readonly","label","height"],Jc=class extends HTMLElement{constructor(){super(...arguments);el(this,"mounted",null);el(this,"observer",typeof MutationObserver=="function"?new MutationObserver(()=>this.refresh()):null);el(this,"onColumnChange",()=>this.refresh())}static get observedAttributes(){return xx}connectedCallback(){this.addEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.observe(this,{childList:!0}),this.refresh()}disconnectedCallback(){this.removeEventListener("crewlet-columnchange",this.onColumnChange),this.observer?.disconnect(),this.mounted?.unmount(),this.mounted=null}attributeChangedCallback(){this.isConnected&&this.refresh()}options(){let a=this.getAttribute("collection")?.trim();if(!a)return null;let l=[...this.children].filter(s=>s instanceof zo).map(s=>s.toColumn()).filter(s=>s!==null),n=Number(this.getAttribute("frozen")),i=Number(this.getAttribute("height")),r={collection:a,columns:l,sort:Gy(this.getAttribute("sort")),readOnly:this.hasAttribute("readonly")};this.hasAttribute("frozen")&&Number.isInteger(n)&&n>=0&&(r.frozen=n),this.hasAttribute("height")&&Number.isFinite(i)&&i>0&&(r.height=i);let o=this.getAttribute("label")?.trim();return o&&(r.label=o),r}refresh(){let a=this.options();if(!a){this.mounted?.unmount(),this.mounted=null;return}this.mounted?this.mounted.update(a):this.mounted=K2(this,a)}};function M0(e=customElements){e.get("crewlet-column")||e.define("crewlet-column",zo),e.get("crewlet-sheet")||e.define("crewlet-sheet",Jc)}M0();export{zo as CrewletColumnElement,Jc as CrewletSheetElement,_0 as RUNTIME_READY_EVENT,M0 as defineElements,K2 as mountSheet,T0 as whenRuntime};