@sudobility/entity-components 1.0.10 → 1.0.11

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/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(S,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react/jsx-runtime"),require("@heroicons/react/24/outline"),require("react"),require("@sudobility/types")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@heroicons/react/24/outline","react","@sudobility/types"],s):(S=typeof globalThis<"u"?globalThis:S||self,s(S.EntityComponents={},S.ReactJSXRuntime,S.HeroiconsOutline,S.React,S.SudobilityTypes))})(this,(function(S,s,C,P,H){"use strict";function ue(e){var o,r,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(r=ue(e[o]))&&(t&&(t+=" "),t+=r)}else for(r in e)e[r]&&(t&&(t+=" "),t+=r);return t}function _e(){for(var e,o,r=0,t="",n=arguments.length;r<n;r++)(e=arguments[r])&&(o=ue(e))&&(t&&(t+=" "),t+=o);return t}const De=(e,o)=>{const r=new Array(e.length+o.length);for(let t=0;t<e.length;t++)r[t]=e[t];for(let t=0;t<o.length;t++)r[e.length+t]=o[t];return r},We=(e,o)=>({classGroupId:e,validator:o}),fe=(e=new Map,o=null,r)=>({nextPart:e,validators:o,classGroupId:r}),K="-",ge=[],$e="arbitrary..",qe=e=>{const o=Ye(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:t}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Xe(a);const l=a.split(K),i=l[0]===""&&l.length>1?1:0;return be(l,i,o)},getConflictingClassGroupIds:(a,l)=>{if(l){const i=t[a],m=r[a];return i?m?De(m,i):i:m||ge}return r[a]||ge}}},be=(e,o,r)=>{if(e.length-o===0)return r.classGroupId;const n=e[o],c=r.nextPart.get(n);if(c){const m=be(e,o+1,c);if(m)return m}const a=r.validators;if(a===null)return;const l=o===0?e.join(K):e.slice(o).join(K),i=a.length;for(let m=0;m<i;m++){const f=a[m];if(f.validator(l))return f.classGroupId}},Xe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=e.slice(1,-1),r=o.indexOf(":"),t=o.slice(0,r);return t?$e+t:void 0})(),Ye=e=>{const{theme:o,classGroups:r}=e;return Je(r,o)},Je=(e,o)=>{const r=fe();for(const t in e){const n=e[t];se(n,r,t,o)}return r},se=(e,o,r,t)=>{const n=e.length;for(let c=0;c<n;c++){const a=e[c];He(a,o,r,t)}},He=(e,o,r,t)=>{if(typeof e=="string"){Ke(e,o,r);return}if(typeof e=="function"){Qe(e,o,r,t);return}Ze(e,o,r,t)},Ke=(e,o,r)=>{const t=e===""?o:he(o,e);t.classGroupId=r},Qe=(e,o,r,t)=>{if(Re(e)){se(e(t),o,r,t);return}o.validators===null&&(o.validators=[]),o.validators.push(We(r,e))},Ze=(e,o,r,t)=>{const n=Object.entries(e),c=n.length;for(let a=0;a<c;a++){const[l,i]=n[a];se(i,he(o,l),r,t)}},he=(e,o)=>{let r=e;const t=o.split(K),n=t.length;for(let c=0;c<n;c++){const a=t[c];let l=r.nextPart.get(a);l||(l=fe(),r.nextPart.set(a,l)),r=l}return r},Re=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,er=e=>{if(e<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),t=Object.create(null);const n=(c,a)=>{r[c]=a,o++,o>e&&(o=0,t=r,r=Object.create(null))};return{get(c){let a=r[c];if(a!==void 0)return a;if((a=t[c])!==void 0)return n(c,a),a},set(c,a){c in r?r[c]=a:n(c,a)}}},ne="!",xe=":",rr=[],ye=(e,o,r,t,n)=>({modifiers:e,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:t,isExternal:n}),tr=e=>{const{prefix:o,experimentalParseClassName:r}=e;let t=n=>{const c=[];let a=0,l=0,i=0,m;const f=n.length;for(let y=0;y<f;y++){const E=n[y];if(a===0&&l===0){if(E===xe){c.push(n.slice(i,y)),i=y+1;continue}if(E==="/"){m=y;continue}}E==="["?a++:E==="]"?a--:E==="("?l++:E===")"&&l--}const k=c.length===0?n:n.slice(i);let N=k,w=!1;k.endsWith(ne)?(N=k.slice(0,-1),w=!0):k.startsWith(ne)&&(N=k.slice(1),w=!0);const h=m&&m>i?m-i:void 0;return ye(c,w,N,h)};if(o){const n=o+xe,c=t;t=a=>a.startsWith(n)?c(a.slice(n.length)):ye(rr,!1,a,void 0,!0)}if(r){const n=t;t=c=>r({className:c,parseClassName:n})}return t},or=e=>{const o=new Map;return e.orderSensitiveModifiers.forEach((r,t)=>{o.set(r,1e6+t)}),r=>{const t=[];let n=[];for(let c=0;c<r.length;c++){const a=r[c],l=a[0]==="[",i=o.has(a);l||i?(n.length>0&&(n.sort(),t.push(...n),n=[]),t.push(a)):n.push(a)}return n.length>0&&(n.sort(),t.push(...n)),t}},sr=e=>({cache:er(e.cacheSize),parseClassName:tr(e),sortModifiers:or(e),...qe(e)}),nr=/\s+/,ar=(e,o)=>{const{parseClassName:r,getClassGroupId:t,getConflictingClassGroupIds:n,sortModifiers:c}=o,a=[],l=e.trim().split(nr);let i="";for(let m=l.length-1;m>=0;m-=1){const f=l[m],{isExternal:k,modifiers:N,hasImportantModifier:w,baseClassName:h,maybePostfixModifierPosition:y}=r(f);if(k){i=f+(i.length>0?" "+i:i);continue}let E=!!y,T=t(E?h.substring(0,y):h);if(!T){if(!E){i=f+(i.length>0?" "+i:i);continue}if(T=t(h),!T){i=f+(i.length>0?" "+i:i);continue}E=!1}const v=N.length===0?"":N.length===1?N[0]:c(N).join(":"),G=w?v+ne:v,j=G+T;if(a.indexOf(j)>-1)continue;a.push(j);const q=n(T,E);for(let U=0;U<q.length;++U){const J=q[U];a.push(G+J)}i=f+(i.length>0?" "+i:i)}return i},lr=(...e)=>{let o=0,r,t,n="";for(;o<e.length;)(r=e[o++])&&(t=we(r))&&(n&&(n+=" "),n+=t);return n},we=e=>{if(typeof e=="string")return e;let o,r="";for(let t=0;t<e.length;t++)e[t]&&(o=we(e[t]))&&(r&&(r+=" "),r+=o);return r},ir=(e,...o)=>{let r,t,n,c;const a=i=>{const m=o.reduce((f,k)=>k(f),e());return r=sr(m),t=r.cache.get,n=r.cache.set,c=l,l(i)},l=i=>{const m=t(i);if(m)return m;const f=ar(i,r);return n(i,f),f};return c=a,(...i)=>c(lr(...i))},cr=[],I=e=>{const o=r=>r[e]||cr;return o.isThemeGetter=!0,o},ve=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ke=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dr=/^\d+\/\d+$/,pr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ur=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,D=e=>dr.test(e),b=e=>!!e&&!Number.isNaN(Number(e)),B=e=>!!e&&Number.isInteger(Number(e)),ae=e=>e.endsWith("%")&&b(e.slice(0,-1)),O=e=>pr.test(e),br=()=>!0,hr=e=>mr.test(e)&&!ur.test(e),Ne=()=>!1,xr=e=>fr.test(e),yr=e=>gr.test(e),wr=e=>!d(e)&&!p(e),vr=e=>W(e,Ee,Ne),d=e=>ve.test(e),V=e=>W(e,Ae,hr),le=e=>W(e,zr,b),Ce=e=>W(e,ze,Ne),kr=e=>W(e,Se,yr),Q=e=>W(e,Me,xr),p=e=>ke.test(e),Y=e=>$(e,Ae),Nr=e=>$(e,Sr),Ie=e=>$(e,ze),Cr=e=>$(e,Ee),Ir=e=>$(e,Se),Z=e=>$(e,Me,!0),W=(e,o,r)=>{const t=ve.exec(e);return t?t[1]?o(t[1]):r(t[2]):!1},$=(e,o,r=!1)=>{const t=ke.exec(e);return t?t[1]?o(t[1]):r:!1},ze=e=>e==="position"||e==="percentage",Se=e=>e==="image"||e==="url",Ee=e=>e==="length"||e==="size"||e==="bg-size",Ae=e=>e==="length",zr=e=>e==="number",Sr=e=>e==="family-name",Me=e=>e==="shadow",Er=ir(()=>{const e=I("color"),o=I("font"),r=I("text"),t=I("font-weight"),n=I("tracking"),c=I("leading"),a=I("breakpoint"),l=I("container"),i=I("spacing"),m=I("radius"),f=I("shadow"),k=I("inset-shadow"),N=I("text-shadow"),w=I("drop-shadow"),h=I("blur"),y=I("perspective"),E=I("aspect"),T=I("ease"),v=I("animate"),G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],q=()=>[...j(),p,d],U=()=>["auto","hidden","clip","visible","scroll"],J=()=>["auto","contain","none"],g=()=>[p,d,i],L=()=>[D,"full","auto",...g()],Te=()=>[B,"none","subgrid",p,d],Ge=()=>["auto",{span:["full",B,p,d]},B,p,d],R=()=>[B,"auto",p,d],je=()=>["auto","min","max","fr",p,d],de=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...g()],_=()=>[D,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],u=()=>[e,p,d],Le=()=>[...j(),Ie,Ce,{position:[p,d]}],Fe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Be=()=>["auto","cover","contain",Cr,vr,{size:[p,d]}],pe=()=>[ae,Y,V],A=()=>["","none","full",m,p,d],M=()=>["",b,Y,V],ee=()=>["solid","dashed","dotted","double"],Ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>[b,ae,Ie,Ce],Ue=()=>["","none",h,p,d],re=()=>["none",b,p,d],te=()=>["none",b,p,d],me=()=>[b,p,d],oe=()=>[D,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[O],breakpoint:[O],color:[br],container:[O],"drop-shadow":[O],ease:["in","out","in-out"],font:[wr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[O],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[O],shadow:[O],spacing:["px",b],text:[O],"text-shadow":[O],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",D,d,p,E]}],container:["container"],columns:[{columns:[b,d,p,l]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:q()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:J()}],"overscroll-x":[{"overscroll-x":J()}],"overscroll-y":[{"overscroll-y":J()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",p,d]}],basis:[{basis:[D,"full","auto",l,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[b,D,"auto","initial","none",d]}],grow:[{grow:["",b,p,d]}],shrink:[{shrink:["",b,p,d]}],order:[{order:[B,"first","last","none",p,d]}],"grid-cols":[{"grid-cols":Te()}],"col-start-end":[{col:Ge()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":Te()}],"row-start-end":[{row:Ge()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...de(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...de()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":de()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[l,"screen",..._()]}],"min-w":[{"min-w":[l,"screen","none",..._()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",r,Y,V]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,p,le]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ae,d]}],"font-family":[{font:[Nr,d,o]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,p,d]}],"line-clamp":[{"line-clamp":[b,"none",p,le]}],leading:[{leading:[c,...g()]}],"list-image":[{"list-image":["none",p,d]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",p,d]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:u()}],"text-color":[{text:u()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[b,"from-font","auto",p,V]}],"text-decoration-color":[{decoration:u()}],"underline-offset":[{"underline-offset":[b,"auto",p,d]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",p,d]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",p,d]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Le()}],"bg-repeat":[{bg:Fe()}],"bg-size":[{bg:Be()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,p,d],radial:["",p,d],conic:[B,p,d]},Ir,kr]}],"bg-color":[{bg:u()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:u()}],"gradient-via":[{via:u()}],"gradient-to":[{to:u()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":M()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:u()}],"border-color-x":[{"border-x":u()}],"border-color-y":[{"border-y":u()}],"border-color-s":[{"border-s":u()}],"border-color-e":[{"border-e":u()}],"border-color-t":[{"border-t":u()}],"border-color-r":[{"border-r":u()}],"border-color-b":[{"border-b":u()}],"border-color-l":[{"border-l":u()}],"divide-color":[{divide:u()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[b,p,d]}],"outline-w":[{outline:["",b,Y,V]}],"outline-color":[{outline:u()}],shadow:[{shadow:["","none",f,Z,Q]}],"shadow-color":[{shadow:u()}],"inset-shadow":[{"inset-shadow":["none",k,Z,Q]}],"inset-shadow-color":[{"inset-shadow":u()}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:u()}],"ring-offset-w":[{"ring-offset":[b,V]}],"ring-offset-color":[{"ring-offset":u()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":u()}],"text-shadow":[{"text-shadow":["none",N,Z,Q]}],"text-shadow-color":[{"text-shadow":u()}],opacity:[{opacity:[b,p,d]}],"mix-blend":[{"mix-blend":[...Ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[b]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"mask-image-linear-from-color":[{"mask-linear-from":u()}],"mask-image-linear-to-color":[{"mask-linear-to":u()}],"mask-image-t-from-pos":[{"mask-t-from":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"mask-image-t-from-color":[{"mask-t-from":u()}],"mask-image-t-to-color":[{"mask-t-to":u()}],"mask-image-r-from-pos":[{"mask-r-from":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"mask-image-r-from-color":[{"mask-r-from":u()}],"mask-image-r-to-color":[{"mask-r-to":u()}],"mask-image-b-from-pos":[{"mask-b-from":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"mask-image-b-from-color":[{"mask-b-from":u()}],"mask-image-b-to-color":[{"mask-b-to":u()}],"mask-image-l-from-pos":[{"mask-l-from":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"mask-image-l-from-color":[{"mask-l-from":u()}],"mask-image-l-to-color":[{"mask-l-to":u()}],"mask-image-x-from-pos":[{"mask-x-from":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"mask-image-x-from-color":[{"mask-x-from":u()}],"mask-image-x-to-color":[{"mask-x-to":u()}],"mask-image-y-from-pos":[{"mask-y-from":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":u()}],"mask-image-y-to-color":[{"mask-y-to":u()}],"mask-image-radial":[{"mask-radial":[p,d]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"mask-image-radial-from-color":[{"mask-radial-from":u()}],"mask-image-radial-to-color":[{"mask-radial-to":u()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[b]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"mask-image-conic-from-color":[{"mask-conic-from":u()}],"mask-image-conic-to-color":[{"mask-conic-to":u()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Le()}],"mask-repeat":[{mask:Fe()}],"mask-size":[{mask:Be()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",p,d]}],filter:[{filter:["","none",p,d]}],blur:[{blur:Ue()}],brightness:[{brightness:[b,p,d]}],contrast:[{contrast:[b,p,d]}],"drop-shadow":[{"drop-shadow":["","none",w,Z,Q]}],"drop-shadow-color":[{"drop-shadow":u()}],grayscale:[{grayscale:["",b,p,d]}],"hue-rotate":[{"hue-rotate":[b,p,d]}],invert:[{invert:["",b,p,d]}],saturate:[{saturate:[b,p,d]}],sepia:[{sepia:["",b,p,d]}],"backdrop-filter":[{"backdrop-filter":["","none",p,d]}],"backdrop-blur":[{"backdrop-blur":Ue()}],"backdrop-brightness":[{"backdrop-brightness":[b,p,d]}],"backdrop-contrast":[{"backdrop-contrast":[b,p,d]}],"backdrop-grayscale":[{"backdrop-grayscale":["",b,p,d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b,p,d]}],"backdrop-invert":[{"backdrop-invert":["",b,p,d]}],"backdrop-opacity":[{"backdrop-opacity":[b,p,d]}],"backdrop-saturate":[{"backdrop-saturate":[b,p,d]}],"backdrop-sepia":[{"backdrop-sepia":["",b,p,d]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",p,d]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[b,"initial",p,d]}],ease:[{ease:["linear","initial",T,p,d]}],delay:[{delay:[b,p,d]}],animate:[{animate:["none",v,p,d]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,p,d]}],"perspective-origin":[{"perspective-origin":q()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[p,d,"","none","gpu","cpu"]}],"transform-origin":[{origin:q()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:u()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:u()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",p,d]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",p,d]}],fill:[{fill:["none",...u()]}],"stroke-w":[{stroke:[b,Y,V,le]}],stroke:[{stroke:["none",...u()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function x(...e){return Er(_e(e))}const Ar={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Pe({entity:e,isSelected:o=!1,onClick:r,className:t,onTrack:n,trackingLabel:c,componentName:a="EntityCard"}){const l=e.entityType==="personal",i=l?C.UserIcon:C.BuildingOffice2Icon,m=()=>{n?.({action:"click",trackingLabel:c,componentName:a}),r?.()};return s.jsx("div",{onClick:r?m:void 0,className:x("rounded-lg border p-4 transition-all",r&&"cursor-pointer hover:border-primary",o&&"border-primary bg-primary/5",!o&&"border-border bg-card",t),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:x("flex h-10 w-10 items-center justify-center rounded-full",l?"bg-blue-100 dark:bg-blue-900":"bg-purple-100 dark:bg-purple-900"),children:e.avatarUrl?s.jsx("img",{src:e.avatarUrl,alt:e.displayName,className:"h-10 w-10 rounded-full object-cover"}):s.jsx(i,{className:x("h-5 w-5",l?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400")})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-medium text-foreground truncate",children:e.displayName}),s.jsx("span",{className:x("text-xs px-2 py-0.5 rounded-full font-medium",Ar[e.userRole]),children:e.userRole})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Personal workspace":"Organization"}),e.description&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:e.description})]})]})})}function Mr({entities:e,selectedSlug:o,onSelect:r,isLoading:t=!1,emptyMessage:n="No workspaces found",className:c,onTrack:a,trackingLabel:l,componentName:i="EntityList"}){if(t)return s.jsx("div",{className:x("space-y-3",c),children:[1,2,3].map(f=>s.jsx("div",{className:"h-24 rounded-lg border border-border bg-muted animate-pulse"},f))});if(e.length===0)return s.jsx("div",{className:x("text-center py-8 text-muted-foreground",c),children:n});const m=f=>{a?.({action:"select",trackingLabel:l,componentName:i}),r?.(f)};return s.jsx("div",{className:x("space-y-3",c),children:e.map(f=>s.jsx(Pe,{entity:f,isSelected:f.entitySlug===o,onClick:r?()=>m(f):void 0,onTrack:a,trackingLabel:l},f.id))})}function Pr({entities:e,currentEntity:o,onSelect:r,onCreateNew:t,isLoading:n=!1,className:c,onTrack:a,trackingLabel:l,componentName:i="EntitySelector"}){const[m,f]=P.useState(!1),k=()=>{a?.({action:"toggle",trackingLabel:l,componentName:i}),f(!m)},N=h=>{a?.({action:"select",trackingLabel:l,componentName:i}),r(h),f(!1)},w=()=>{a?.({action:"create_new",trackingLabel:l,componentName:i}),t?.(),f(!1)};return s.jsxs("div",{className:x("relative",c),children:[s.jsxs("button",{type:"button",onClick:k,disabled:n,className:x("flex items-center gap-2 px-3 py-2 rounded-lg border","bg-background hover:bg-muted transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",n&&"opacity-50 cursor-not-allowed"),children:[o?s.jsxs(s.Fragment,{children:[o.entityType==="personal"?s.jsx(C.UserIcon,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}):s.jsx(C.BuildingOffice2Icon,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),s.jsx("span",{className:"font-medium text-sm truncate max-w-[150px]",children:o.displayName})]}):s.jsx("span",{className:"text-sm text-muted-foreground",children:"Select workspace"}),s.jsx(C.ChevronDownIcon,{className:x("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),m&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),s.jsx("div",{className:x("absolute top-full left-0 mt-1 z-50","min-w-[220px] rounded-lg border bg-popover shadow-lg","animate-in fade-in-0 zoom-in-95"),children:s.jsxs("div",{className:"p-1",children:[e.filter(h=>h.entityType==="personal").map(h=>s.jsx(Oe,{entity:h,isSelected:h.id===o?.id,onClick:()=>N(h)},h.id)),e.some(h=>h.entityType==="personal")&&e.some(h=>h.entityType==="organization")&&s.jsx("div",{className:"my-1 h-px bg-border"}),e.filter(h=>h.entityType==="organization").map(h=>s.jsx(Oe,{entity:h,isSelected:h.id===o?.id,onClick:()=>N(h)},h.id)),t&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 h-px bg-border"}),s.jsxs("button",{type:"button",onClick:w,className:x("flex items-center gap-2 w-full px-2 py-1.5 rounded","text-sm text-primary hover:bg-muted transition-colors"),children:[s.jsx(C.PlusIcon,{className:"h-4 w-4"}),s.jsx("span",{children:"Create organization"})]})]})]})})]})]})}function Oe({entity:e,isSelected:o,onClick:r}){const t=e.entityType==="personal",n=t?C.UserIcon:C.BuildingOffice2Icon;return s.jsxs("button",{type:"button",onClick:r,className:x("flex items-center gap-2 w-full px-2 py-1.5 rounded","text-sm transition-colors",o?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"),children:[s.jsx(n,{className:x("h-4 w-4",t?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400")}),s.jsx("span",{className:"flex-1 text-left truncate",children:e.displayName}),o&&s.jsx(C.CheckIcon,{className:"h-4 w-4"})]})}const ie=[{value:H.EntityRole.OWNER,label:"Owner",description:"Full access to all settings and members",icon:C.ShieldCheckIcon,color:"text-purple-600 dark:text-purple-400"},{value:H.EntityRole.MANAGER,label:"Manager",description:"Can manage projects and API keys",icon:C.BriefcaseIcon,color:"text-blue-600 dark:text-blue-400"},{value:H.EntityRole.MEMBER,label:"Member",description:"Read-only access",icon:C.EyeIcon,color:"text-gray-600 dark:text-gray-400"}];function ce({value:e,onChange:o,disabled:r=!1,className:t,onTrack:n,trackingLabel:c,componentName:a="MemberRoleSelector"}){const[l,i]=P.useState(!1),[m,f]=P.useState({top:0,left:0}),k=P.useRef(null),N=P.useRef(null),w=P.useRef(null),h=ie.find(v=>v.value===e)||ie[2],y=P.useCallback(()=>{if(w.current){const v=w.current.getBoundingClientRect();f({top:v.bottom+4,left:v.right-200})}},[]),E=()=>{r||(n?.({action:"toggle",trackingLabel:c,componentName:a}),l||y(),i(!l))},T=v=>{n?.({action:"select",trackingLabel:c,componentName:a}),o(v),i(!1)};return P.useEffect(()=>{const v=G=>{const j=G.target;k.current&&!k.current.contains(j)&&N.current&&!N.current.contains(j)&&i(!1)};if(l)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),P.useEffect(()=>{const v=G=>{G.key==="Escape"&&i(!1)};if(l)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]),s.jsxs("div",{ref:k,className:x("relative",t),children:[s.jsxs("button",{ref:w,type:"button",onClick:E,disabled:r,className:x("flex items-center gap-1.5 px-2 py-1 rounded border text-sm","bg-background transition-colors",r?"opacity-50 cursor-not-allowed":"hover:bg-muted cursor-pointer"),"aria-expanded":l,"aria-haspopup":"listbox",children:[s.jsx(h.icon,{className:x("h-3.5 w-3.5",h.color)}),s.jsx("span",{children:h.label}),s.jsx(C.ChevronDownIcon,{className:x("h-3.5 w-3.5 text-muted-foreground transition-transform",l&&"rotate-180")})]}),l&&s.jsx("div",{ref:N,className:x("fixed z-50","min-w-[200px] rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg p-1","animate-in fade-in-0 zoom-in-95"),style:{top:m.top,left:Math.max(0,m.left)},role:"listbox","aria-label":"Roles",children:ie.map(v=>s.jsxs("button",{type:"button",onClick:()=>T(v.value),className:x("flex items-start gap-2 w-full px-2 py-2 rounded text-left","transition-colors",v.value===e?"bg-primary/10":"hover:bg-muted"),role:"option","aria-selected":v.value===e,children:[s.jsx(v.icon,{className:x("h-4 w-4 mt-0.5",v.color)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-sm",children:v.label}),v.value===e&&s.jsx(C.CheckIcon,{className:"h-3.5 w-3.5 text-primary"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:v.description})]})]},v.value))})]})}const Or={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Tr({members:e,currentUserId:o,canManage:r=!1,onRoleChange:t,onRemove:n,isLoading:c=!1,emptyMessage:a="No members found",className:l,onTrack:i,trackingLabel:m,componentName:f="MemberList"}){if(c)return s.jsx("div",{className:x("space-y-2",l),children:[1,2,3].map(w=>s.jsx("div",{className:"h-16 rounded-lg border border-border bg-muted animate-pulse"},w))});if(e.length===0)return s.jsx("div",{className:x("text-center py-8 text-muted-foreground",l),children:a});const k=(w,h)=>{i?.({action:"role_change",trackingLabel:m,componentName:f}),t?.(w,h)},N=w=>{i?.({action:"remove",trackingLabel:m,componentName:f}),n?.(w)};return s.jsx("div",{className:x("divide-y divide-border rounded-lg border",l),children:e.map(w=>s.jsx(Gr,{member:w,isSelf:w.userId===o,canManage:r,onRoleChange:t?k:void 0,onRemove:n?N:void 0},w.id))})}function Gr({member:e,isSelf:o,canManage:r,onRoleChange:t,onRemove:n}){const c=e.user?.displayName||e.user?.email||"Unknown user",a=e.user?.email;return s.jsxs("div",{className:"flex items-center gap-3 p-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(C.UserIcon,{className:"h-5 w-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"font-medium text-foreground truncate",children:c}),o&&s.jsx("span",{className:"text-xs text-muted-foreground",children:"(you)"})]}),a&&s.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a})]}),r&&t&&!o?s.jsx(ce,{value:e.role,onChange:l=>t(e.userId,l)}):s.jsx("span",{className:x("text-xs px-2 py-1 rounded-full font-medium",Or[e.role]),children:e.role}),r&&n&&!o&&s.jsx("button",{type:"button",onClick:()=>n(e.userId),className:x("p-1.5 rounded hover:bg-destructive/10 text-muted-foreground","hover:text-destructive transition-colors"),title:"Remove member",children:s.jsx(C.TrashIcon,{className:"h-4 w-4"})})]})}function jr({onSubmit:e,isSubmitting:o=!1,defaultRole:r=H.EntityRole.MEMBER,className:t,onTrack:n,trackingLabel:c,componentName:a="InvitationForm"}){const[l,i]=P.useState(""),[m,f]=P.useState(r),[k,N]=P.useState(null),w=async h=>{if(h.preventDefault(),N(null),!l.trim()){N("Email is required");return}if(!Lr(l)){N("Please enter a valid email address");return}n?.({action:"submit",trackingLabel:c,componentName:a});try{await e({email:l.trim(),role:m}),i(""),f(r)}catch(y){N(y.message||"Failed to send invitation")}};return s.jsxs("form",{onSubmit:w,className:x("space-y-4",t),children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(C.EnvelopeIcon,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx("input",{type:"email",value:l,onChange:h=>i(h.target.value),placeholder:"Enter email address",disabled:o,className:x("w-full pl-10 pr-3 py-2 rounded-lg border bg-background","text-sm placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",k&&"border-destructive focus:ring-destructive",o&&"opacity-50 cursor-not-allowed")})]}),s.jsx(ce,{value:m,onChange:f,disabled:o}),s.jsxs("button",{type:"submit",disabled:o||!l.trim(),className:x("flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",(o||!l.trim())&&"opacity-50 cursor-not-allowed"),children:[o?s.jsx(C.ArrowPathIcon,{className:"h-4 w-4 animate-spin"}):s.jsx(C.PaperAirplaneIcon,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Invite"})]})]}),k&&s.jsx("p",{className:"text-sm text-destructive",children:k})]})}function Lr(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}const Fr={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Br({invitations:e,mode:o,onCancel:r,onAccept:t,onDecline:n,isLoading:c=!1,emptyMessage:a="No pending invitations",className:l,onTrack:i,trackingLabel:m,componentName:f="InvitationList"}){const k=e.filter(y=>y.status==="pending");if(c)return s.jsx("div",{className:x("space-y-2",l),children:[1,2].map(y=>s.jsx("div",{className:"h-16 rounded-lg border border-border bg-muted animate-pulse"},y))});if(k.length===0)return s.jsx("div",{className:x("text-center py-8 text-muted-foreground",l),children:a});const N=y=>{i?.({action:"cancel",trackingLabel:m,componentName:f}),r?.(y)},w=y=>{i?.({action:"accept",trackingLabel:m,componentName:f}),t?.(y)},h=y=>{i?.({action:"decline",trackingLabel:m,componentName:f}),n?.(y)};return s.jsx("div",{className:x("divide-y divide-border rounded-lg border",l),children:k.map(y=>s.jsx(Vr,{invitation:y,mode:o,onCancel:r?N:void 0,onAccept:t?w:void 0,onDecline:n?h:void 0},y.id))})}function Vr({invitation:e,mode:o,onCancel:r,onAccept:t,onDecline:n}){const c=new Date(e.expiresAt),a=c<new Date,l=Math.ceil((c.getTime()-Date.now())/(1e3*60*60*24));return s.jsxs("div",{className:"flex items-center gap-3 p-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(C.EnvelopeIcon,{className:"h-5 w-5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[o==="user"&&e.entity?s.jsx("p",{className:"font-medium text-foreground truncate",children:e.entity.displayName}):s.jsx("p",{className:"font-medium text-foreground truncate",children:e.email}),s.jsx("span",{className:x("text-xs px-2 py-0.5 rounded-full font-medium",Fr[e.role]),children:e.role})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[s.jsx(C.ClockIcon,{className:"h-3.5 w-3.5"}),a?s.jsx("span",{className:"text-destructive",children:"Expired"}):s.jsxs("span",{children:["Expires in ",l," days"]})]})]}),o==="admin"&&r&&s.jsx("button",{type:"button",onClick:()=>r(e.id),className:x("p-1.5 rounded hover:bg-destructive/10 text-muted-foreground","hover:text-destructive transition-colors"),title:"Cancel invitation",children:s.jsx(C.XCircleIcon,{className:"h-4 w-4"})}),o==="user"&&s.jsxs("div",{className:"flex items-center gap-2",children:[n&&s.jsxs("button",{type:"button",onClick:()=>n(e.token),className:x("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm","border hover:bg-muted transition-colors"),children:[s.jsx(C.XMarkIcon,{className:"h-4 w-4"}),s.jsx("span",{children:"Decline"})]}),t&&s.jsxs("button",{type:"button",onClick:()=>t(e.token),disabled:a,className:x("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm","bg-primary text-primary-foreground","hover:bg-primary/90 transition-colors",a&&"opacity-50 cursor-not-allowed"),children:[s.jsx(C.CheckIcon,{className:"h-4 w-4"}),s.jsx("span",{children:"Accept"})]})]})]})}S.EntityCard=Pe,S.EntityList=Mr,S.EntitySelector=Pr,S.InvitationForm=jr,S.InvitationList=Br,S.MemberList=Tr,S.MemberRoleSelector=ce,S.cn=x,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(z,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("react/jsx-runtime"),require("@heroicons/react/24/outline"),require("react"),require("react-dom"),require("@sudobility/types")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@heroicons/react/24/outline","react","react-dom","@sudobility/types"],r):(z=typeof globalThis<"u"?globalThis:z||self,r(z.EntityComponents={},z.ReactJSXRuntime,z.HeroiconsOutline,z.React,z.ReactDOM,z.SudobilityTypes))})(this,(function(z,r,C,T,Ue,J){"use strict";function ue(e){var s,t,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(s=0;s<a;s++)e[s]&&(t=ue(e[s]))&&(o&&(o+=" "),o+=t)}else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function _e(){for(var e,s,t=0,o="",a=arguments.length;t<a;t++)(e=arguments[t])&&(s=ue(e))&&(o&&(o+=" "),o+=s);return o}const We=(e,s)=>{const t=new Array(e.length+s.length);for(let o=0;o<e.length;o++)t[o]=e[o];for(let o=0;o<s.length;o++)t[e.length+o]=s[o];return t},$e=(e,s)=>({classGroupId:e,validator:s}),fe=(e=new Map,s=null,t)=>({nextPart:e,validators:s,classGroupId:t}),H="-",ge=[],qe="arbitrary..",Xe=e=>{const s=Je(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return Ye(n);const l=n.split(H),i=l[0]===""&&l.length>1?1:0;return be(l,i,s)},getConflictingClassGroupIds:(n,l)=>{if(l){const i=o[n],m=t[n];return i?m?We(m,i):i:m||ge}return t[n]||ge}}},be=(e,s,t)=>{if(e.length-s===0)return t.classGroupId;const a=e[s],c=t.nextPart.get(a);if(c){const m=be(e,s+1,c);if(m)return m}const n=t.validators;if(n===null)return;const l=s===0?e.join(H):e.slice(s).join(H),i=n.length;for(let m=0;m<i;m++){const f=n[m];if(f.validator(l))return f.classGroupId}},Ye=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=e.slice(1,-1),t=s.indexOf(":"),o=s.slice(0,t);return o?qe+o:void 0})(),Je=e=>{const{theme:s,classGroups:t}=e;return He(t,s)},He=(e,s)=>{const t=fe();for(const o in e){const a=e[o];se(a,t,o,s)}return t},se=(e,s,t,o)=>{const a=e.length;for(let c=0;c<a;c++){const n=e[c];Ke(n,s,t,o)}},Ke=(e,s,t,o)=>{if(typeof e=="string"){Qe(e,s,t);return}if(typeof e=="function"){Ze(e,s,t,o);return}Re(e,s,t,o)},Qe=(e,s,t)=>{const o=e===""?s:he(s,e);o.classGroupId=t},Ze=(e,s,t,o)=>{if(er(e)){se(e(o),s,t,o);return}s.validators===null&&(s.validators=[]),s.validators.push($e(t,e))},Re=(e,s,t,o)=>{const a=Object.entries(e),c=a.length;for(let n=0;n<c;n++){const[l,i]=a[n];se(i,he(s,l),t,o)}},he=(e,s)=>{let t=e;const o=s.split(H),a=o.length;for(let c=0;c<a;c++){const n=o[c];let l=t.nextPart.get(n);l||(l=fe(),t.nextPart.set(n,l)),t=l}return t},er=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,rr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,t=Object.create(null),o=Object.create(null);const a=(c,n)=>{t[c]=n,s++,s>e&&(s=0,o=t,t=Object.create(null))};return{get(c){let n=t[c];if(n!==void 0)return n;if((n=o[c])!==void 0)return a(c,n),n},set(c,n){c in t?t[c]=n:a(c,n)}}},ae="!",xe=":",tr=[],ye=(e,s,t,o,a)=>({modifiers:e,hasImportantModifier:s,baseClassName:t,maybePostfixModifierPosition:o,isExternal:a}),or=e=>{const{prefix:s,experimentalParseClassName:t}=e;let o=a=>{const c=[];let n=0,l=0,i=0,m;const f=a.length;for(let w=0;w<f;w++){const y=a[w];if(n===0&&l===0){if(y===xe){c.push(a.slice(i,w)),i=w+1;continue}if(y==="/"){m=w;continue}}y==="["?n++:y==="]"?n--:y==="("?l++:y===")"&&l--}const v=c.length===0?a:a.slice(i);let k=v,N=!1;v.endsWith(ae)?(k=v.slice(0,-1),N=!0):v.startsWith(ae)&&(k=v.slice(1),N=!0);const h=m&&m>i?m-i:void 0;return ye(c,N,k,h)};if(s){const a=s+xe,c=o;o=n=>n.startsWith(a)?c(n.slice(a.length)):ye(tr,!1,n,void 0,!0)}if(t){const a=o;o=c=>t({className:c,parseClassName:a})}return o},sr=e=>{const s=new Map;return e.orderSensitiveModifiers.forEach((t,o)=>{s.set(t,1e6+o)}),t=>{const o=[];let a=[];for(let c=0;c<t.length;c++){const n=t[c],l=n[0]==="[",i=s.has(n);l||i?(a.length>0&&(a.sort(),o.push(...a),a=[]),o.push(n)):a.push(n)}return a.length>0&&(a.sort(),o.push(...a)),o}},ar=e=>({cache:rr(e.cacheSize),parseClassName:or(e),sortModifiers:sr(e),...Xe(e)}),nr=/\s+/,lr=(e,s)=>{const{parseClassName:t,getClassGroupId:o,getConflictingClassGroupIds:a,sortModifiers:c}=s,n=[],l=e.trim().split(nr);let i="";for(let m=l.length-1;m>=0;m-=1){const f=l[m],{isExternal:v,modifiers:k,hasImportantModifier:N,baseClassName:h,maybePostfixModifierPosition:w}=t(f);if(v){i=f+(i.length>0?" "+i:i);continue}let y=!!w,F=o(y?h.substring(0,w):h);if(!F){if(!y){i=f+(i.length>0?" "+i:i);continue}if(F=o(h),!F){i=f+(i.length>0?" "+i:i);continue}y=!1}const Z=k.length===0?"":k.length===1?k[0]:c(k).join(":"),X=N?Z+ae:Z,_=X+F;if(n.indexOf(_)>-1)continue;n.push(_);const W=a(F,y);for(let B=0;B<W.length;++B){const Y=W[B];n.push(X+Y)}i=f+(i.length>0?" "+i:i)}return i},ir=(...e)=>{let s=0,t,o,a="";for(;s<e.length;)(t=e[s++])&&(o=we(t))&&(a&&(a+=" "),a+=o);return a},we=e=>{if(typeof e=="string")return e;let s,t="";for(let o=0;o<e.length;o++)e[o]&&(s=we(e[o]))&&(t&&(t+=" "),t+=s);return t},cr=(e,...s)=>{let t,o,a,c;const n=i=>{const m=s.reduce((f,v)=>v(f),e());return t=ar(m),o=t.cache.get,a=t.cache.set,c=l,l(i)},l=i=>{const m=o(i);if(m)return m;const f=lr(i,t);return a(i,f),f};return c=n,(...i)=>c(ir(...i))},dr=[],I=e=>{const s=t=>t[e]||dr;return s.isThemeGetter=!0,s},ve=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ke=/^\((?:(\w[\w-]*):)?(.+)\)$/i,pr=/^\d+\/\d+$/,mr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ur=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,br=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,V=e=>pr.test(e),b=e=>!!e&&!Number.isNaN(Number(e)),G=e=>!!e&&Number.isInteger(Number(e)),ne=e=>e.endsWith("%")&&b(e.slice(0,-1)),E=e=>mr.test(e),hr=()=>!0,xr=e=>ur.test(e)&&!fr.test(e),Ne=()=>!1,yr=e=>gr.test(e),wr=e=>br.test(e),vr=e=>!d(e)&&!p(e),kr=e=>D(e,Ae,Ne),d=e=>ve.test(e),j=e=>D(e,Me,xr),le=e=>D(e,Sr,b),Ce=e=>D(e,ze,Ne),Nr=e=>D(e,Se,wr),K=e=>D(e,Ee,yr),p=e=>ke.test(e),q=e=>U(e,Me),Cr=e=>U(e,Ar),Ie=e=>U(e,ze),Ir=e=>U(e,Ae),zr=e=>U(e,Se),Q=e=>U(e,Ee,!0),D=(e,s,t)=>{const o=ve.exec(e);return o?o[1]?s(o[1]):t(o[2]):!1},U=(e,s,t=!1)=>{const o=ke.exec(e);return o?o[1]?s(o[1]):t:!1},ze=e=>e==="position"||e==="percentage",Se=e=>e==="image"||e==="url",Ae=e=>e==="length"||e==="size"||e==="bg-size",Me=e=>e==="length",Sr=e=>e==="number",Ar=e=>e==="family-name",Ee=e=>e==="shadow",Mr=cr(()=>{const e=I("color"),s=I("font"),t=I("text"),o=I("font-weight"),a=I("tracking"),c=I("leading"),n=I("breakpoint"),l=I("container"),i=I("spacing"),m=I("radius"),f=I("shadow"),v=I("inset-shadow"),k=I("text-shadow"),N=I("drop-shadow"),h=I("blur"),w=I("perspective"),y=I("aspect"),F=I("ease"),Z=I("animate"),X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[..._(),p,d],B=()=>["auto","hidden","clip","visible","scroll"],Y=()=>["auto","contain","none"],g=()=>[p,d,i],P=()=>[V,"full","auto",...g()],Te=()=>[G,"none","subgrid",p,d],Ge=()=>["auto",{span:["full",G,p,d]},G,p,d],R=()=>[G,"auto",p,d],je=()=>["auto","min","max","fr",p,d],de=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...g()],L=()=>[V,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],u=()=>[e,p,d],Fe=()=>[..._(),Ie,Ce,{position:[p,d]}],Be=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Le=()=>["auto","cover","contain",Ir,kr,{size:[p,d]}],pe=()=>[ne,q,j],A=()=>["","none","full",m,p,d],M=()=>["",b,q,j],ee=()=>["solid","dashed","dotted","double"],Ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],S=()=>[b,ne,Ie,Ce],De=()=>["","none",h,p,d],re=()=>["none",b,p,d],te=()=>["none",b,p,d],me=()=>[b,p,d],oe=()=>[V,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[E],breakpoint:[E],color:[hr],container:[E],"drop-shadow":[E],ease:["in","out","in-out"],font:[vr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[E],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[E],shadow:[E],spacing:["px",b],text:[E],"text-shadow":[E],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",V,d,p,y]}],container:["container"],columns:[{columns:[b,d,p,l]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[G,"auto",p,d]}],basis:[{basis:[V,"full","auto",l,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[b,V,"auto","initial","none",d]}],grow:[{grow:["",b,p,d]}],shrink:[{shrink:["",b,p,d]}],order:[{order:[G,"first","last","none",p,d]}],"grid-cols":[{"grid-cols":Te()}],"col-start-end":[{col:Ge()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":Te()}],"row-start-end":[{row:Ge()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":je()}],"auto-rows":[{"auto-rows":je()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...de(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...de()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":de()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[l,"screen",...L()]}],"min-w":[{"min-w":[l,"screen","none",...L()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[n]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",t,q,j]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,p,le]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ne,d]}],"font-family":[{font:[Cr,d,s]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,p,d]}],"line-clamp":[{"line-clamp":[b,"none",p,le]}],leading:[{leading:[c,...g()]}],"list-image":[{"list-image":["none",p,d]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",p,d]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:u()}],"text-color":[{text:u()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:[b,"from-font","auto",p,j]}],"text-decoration-color":[{decoration:u()}],"underline-offset":[{"underline-offset":[b,"auto",p,d]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",p,d]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",p,d]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Fe()}],"bg-repeat":[{bg:Be()}],"bg-size":[{bg:Le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},G,p,d],radial:["",p,d],conic:[G,p,d]},zr,Nr]}],"bg-color":[{bg:u()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:u()}],"gradient-via":[{via:u()}],"gradient-to":[{to:u()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:M()}],"border-w-x":[{"border-x":M()}],"border-w-y":[{"border-y":M()}],"border-w-s":[{"border-s":M()}],"border-w-e":[{"border-e":M()}],"border-w-t":[{"border-t":M()}],"border-w-r":[{"border-r":M()}],"border-w-b":[{"border-b":M()}],"border-w-l":[{"border-l":M()}],"divide-x":[{"divide-x":M()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":M()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ee(),"hidden","none"]}],"divide-style":[{divide:[...ee(),"hidden","none"]}],"border-color":[{border:u()}],"border-color-x":[{"border-x":u()}],"border-color-y":[{"border-y":u()}],"border-color-s":[{"border-s":u()}],"border-color-e":[{"border-e":u()}],"border-color-t":[{"border-t":u()}],"border-color-r":[{"border-r":u()}],"border-color-b":[{"border-b":u()}],"border-color-l":[{"border-l":u()}],"divide-color":[{divide:u()}],"outline-style":[{outline:[...ee(),"none","hidden"]}],"outline-offset":[{"outline-offset":[b,p,d]}],"outline-w":[{outline:["",b,q,j]}],"outline-color":[{outline:u()}],shadow:[{shadow:["","none",f,Q,K]}],"shadow-color":[{shadow:u()}],"inset-shadow":[{"inset-shadow":["none",v,Q,K]}],"inset-shadow-color":[{"inset-shadow":u()}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:u()}],"ring-offset-w":[{"ring-offset":[b,j]}],"ring-offset-color":[{"ring-offset":u()}],"inset-ring-w":[{"inset-ring":M()}],"inset-ring-color":[{"inset-ring":u()}],"text-shadow":[{"text-shadow":["none",k,Q,K]}],"text-shadow-color":[{"text-shadow":u()}],opacity:[{opacity:[b,p,d]}],"mix-blend":[{"mix-blend":[...Ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[b]}],"mask-image-linear-from-pos":[{"mask-linear-from":S()}],"mask-image-linear-to-pos":[{"mask-linear-to":S()}],"mask-image-linear-from-color":[{"mask-linear-from":u()}],"mask-image-linear-to-color":[{"mask-linear-to":u()}],"mask-image-t-from-pos":[{"mask-t-from":S()}],"mask-image-t-to-pos":[{"mask-t-to":S()}],"mask-image-t-from-color":[{"mask-t-from":u()}],"mask-image-t-to-color":[{"mask-t-to":u()}],"mask-image-r-from-pos":[{"mask-r-from":S()}],"mask-image-r-to-pos":[{"mask-r-to":S()}],"mask-image-r-from-color":[{"mask-r-from":u()}],"mask-image-r-to-color":[{"mask-r-to":u()}],"mask-image-b-from-pos":[{"mask-b-from":S()}],"mask-image-b-to-pos":[{"mask-b-to":S()}],"mask-image-b-from-color":[{"mask-b-from":u()}],"mask-image-b-to-color":[{"mask-b-to":u()}],"mask-image-l-from-pos":[{"mask-l-from":S()}],"mask-image-l-to-pos":[{"mask-l-to":S()}],"mask-image-l-from-color":[{"mask-l-from":u()}],"mask-image-l-to-color":[{"mask-l-to":u()}],"mask-image-x-from-pos":[{"mask-x-from":S()}],"mask-image-x-to-pos":[{"mask-x-to":S()}],"mask-image-x-from-color":[{"mask-x-from":u()}],"mask-image-x-to-color":[{"mask-x-to":u()}],"mask-image-y-from-pos":[{"mask-y-from":S()}],"mask-image-y-to-pos":[{"mask-y-to":S()}],"mask-image-y-from-color":[{"mask-y-from":u()}],"mask-image-y-to-color":[{"mask-y-to":u()}],"mask-image-radial":[{"mask-radial":[p,d]}],"mask-image-radial-from-pos":[{"mask-radial-from":S()}],"mask-image-radial-to-pos":[{"mask-radial-to":S()}],"mask-image-radial-from-color":[{"mask-radial-from":u()}],"mask-image-radial-to-color":[{"mask-radial-to":u()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[b]}],"mask-image-conic-from-pos":[{"mask-conic-from":S()}],"mask-image-conic-to-pos":[{"mask-conic-to":S()}],"mask-image-conic-from-color":[{"mask-conic-from":u()}],"mask-image-conic-to-color":[{"mask-conic-to":u()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Fe()}],"mask-repeat":[{mask:Be()}],"mask-size":[{mask:Le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",p,d]}],filter:[{filter:["","none",p,d]}],blur:[{blur:De()}],brightness:[{brightness:[b,p,d]}],contrast:[{contrast:[b,p,d]}],"drop-shadow":[{"drop-shadow":["","none",N,Q,K]}],"drop-shadow-color":[{"drop-shadow":u()}],grayscale:[{grayscale:["",b,p,d]}],"hue-rotate":[{"hue-rotate":[b,p,d]}],invert:[{invert:["",b,p,d]}],saturate:[{saturate:[b,p,d]}],sepia:[{sepia:["",b,p,d]}],"backdrop-filter":[{"backdrop-filter":["","none",p,d]}],"backdrop-blur":[{"backdrop-blur":De()}],"backdrop-brightness":[{"backdrop-brightness":[b,p,d]}],"backdrop-contrast":[{"backdrop-contrast":[b,p,d]}],"backdrop-grayscale":[{"backdrop-grayscale":["",b,p,d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b,p,d]}],"backdrop-invert":[{"backdrop-invert":["",b,p,d]}],"backdrop-opacity":[{"backdrop-opacity":[b,p,d]}],"backdrop-saturate":[{"backdrop-saturate":[b,p,d]}],"backdrop-sepia":[{"backdrop-sepia":["",b,p,d]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",p,d]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[b,"initial",p,d]}],ease:[{ease:["linear","initial",F,p,d]}],delay:[{delay:[b,p,d]}],animate:[{animate:["none",Z,p,d]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,p,d]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[p,d,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:u()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:u()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",p,d]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",p,d]}],fill:[{fill:["none",...u()]}],"stroke-w":[{stroke:[b,q,j,le]}],stroke:[{stroke:["none",...u()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function x(...e){return Mr(_e(e))}const Er={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Pe({entity:e,isSelected:s=!1,onClick:t,className:o,onTrack:a,trackingLabel:c,componentName:n="EntityCard"}){const l=e.entityType==="personal",i=l?C.UserIcon:C.BuildingOffice2Icon,m=()=>{a?.({action:"click",trackingLabel:c,componentName:n}),t?.()};return r.jsx("div",{onClick:t?m:void 0,className:x("rounded-lg border p-4 transition-all",t&&"cursor-pointer hover:border-primary",s&&"border-primary bg-primary/5",!s&&"border-border bg-card",o),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:x("flex h-10 w-10 items-center justify-center rounded-full",l?"bg-blue-100 dark:bg-blue-900":"bg-purple-100 dark:bg-purple-900"),children:e.avatarUrl?r.jsx("img",{src:e.avatarUrl,alt:e.displayName,className:"h-10 w-10 rounded-full object-cover"}):r.jsx(i,{className:x("h-5 w-5",l?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium text-foreground truncate",children:e.displayName}),r.jsx("span",{className:x("text-xs px-2 py-0.5 rounded-full font-medium",Er[e.userRole]),children:e.userRole})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Personal workspace":"Organization"}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:e.description})]})]})})}function Pr({entities:e,selectedSlug:s,onSelect:t,isLoading:o=!1,emptyMessage:a="No workspaces found",className:c,onTrack:n,trackingLabel:l,componentName:i="EntityList"}){if(o)return r.jsx("div",{className:x("space-y-3",c),children:[1,2,3].map(f=>r.jsx("div",{className:"h-24 rounded-lg border border-border bg-muted animate-pulse"},f))});if(e.length===0)return r.jsx("div",{className:x("text-center py-8 text-muted-foreground",c),children:a});const m=f=>{n?.({action:"select",trackingLabel:l,componentName:i}),t?.(f)};return r.jsx("div",{className:x("space-y-3",c),children:e.map(f=>r.jsx(Pe,{entity:f,isSelected:f.entitySlug===s,onClick:t?()=>m(f):void 0,onTrack:n,trackingLabel:l},f.id))})}function Or({entities:e,currentEntity:s,onSelect:t,onCreateNew:o,isLoading:a=!1,className:c,onTrack:n,trackingLabel:l,componentName:i="EntitySelector"}){const[m,f]=T.useState(!1),v=()=>{n?.({action:"toggle",trackingLabel:l,componentName:i}),f(!m)},k=h=>{n?.({action:"select",trackingLabel:l,componentName:i}),t(h),f(!1)},N=()=>{n?.({action:"create_new",trackingLabel:l,componentName:i}),o?.(),f(!1)};return r.jsxs("div",{className:x("relative",c),children:[r.jsxs("button",{type:"button",onClick:v,disabled:a,className:x("flex items-center gap-2 px-3 py-2 rounded-lg border","bg-background hover:bg-muted transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",a&&"opacity-50 cursor-not-allowed"),children:[s?r.jsxs(r.Fragment,{children:[s.entityType==="personal"?r.jsx(C.UserIcon,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}):r.jsx(C.BuildingOffice2Icon,{className:"h-4 w-4 text-purple-600 dark:text-purple-400"}),r.jsx("span",{className:"font-medium text-sm truncate max-w-[150px]",children:s.displayName})]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"Select workspace"}),r.jsx(C.ChevronDownIcon,{className:x("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),m&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>f(!1)}),r.jsx("div",{className:x("absolute top-full left-0 mt-1 z-50","min-w-[220px] rounded-lg border bg-popover shadow-lg","animate-in fade-in-0 zoom-in-95"),children:r.jsxs("div",{className:"p-1",children:[e.filter(h=>h.entityType==="personal").map(h=>r.jsx(Oe,{entity:h,isSelected:h.id===s?.id,onClick:()=>k(h)},h.id)),e.some(h=>h.entityType==="personal")&&e.some(h=>h.entityType==="organization")&&r.jsx("div",{className:"my-1 h-px bg-border"}),e.filter(h=>h.entityType==="organization").map(h=>r.jsx(Oe,{entity:h,isSelected:h.id===s?.id,onClick:()=>k(h)},h.id)),o&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 h-px bg-border"}),r.jsxs("button",{type:"button",onClick:N,className:x("flex items-center gap-2 w-full px-2 py-1.5 rounded","text-sm text-primary hover:bg-muted transition-colors"),children:[r.jsx(C.PlusIcon,{className:"h-4 w-4"}),r.jsx("span",{children:"Create organization"})]})]})]})})]})]})}function Oe({entity:e,isSelected:s,onClick:t}){const o=e.entityType==="personal",a=o?C.UserIcon:C.BuildingOffice2Icon;return r.jsxs("button",{type:"button",onClick:t,className:x("flex items-center gap-2 w-full px-2 py-1.5 rounded","text-sm transition-colors",s?"bg-primary/10 text-primary":"hover:bg-muted text-foreground"),children:[r.jsx(a,{className:x("h-4 w-4",o?"text-blue-600 dark:text-blue-400":"text-purple-600 dark:text-purple-400")}),r.jsx("span",{className:"flex-1 text-left truncate",children:e.displayName}),s&&r.jsx(C.CheckIcon,{className:"h-4 w-4"})]})}const ie=[{value:J.EntityRole.OWNER,label:"Owner",description:"Full access to all settings and members",icon:C.ShieldCheckIcon,color:"text-purple-600 dark:text-purple-400"},{value:J.EntityRole.MANAGER,label:"Manager",description:"Can manage projects and API keys",icon:C.BriefcaseIcon,color:"text-blue-600 dark:text-blue-400"},{value:J.EntityRole.MEMBER,label:"Member",description:"Read-only access",icon:C.EyeIcon,color:"text-gray-600 dark:text-gray-400"}];function ce({value:e,onChange:s,disabled:t=!1,className:o,onTrack:a,trackingLabel:c,componentName:n="MemberRoleSelector"}){const[l,i]=T.useState(!1),[m,f]=T.useState({top:0,right:0}),v=T.useRef(null),k=ie.find(y=>y.value===e)||ie[2],N=T.useCallback(()=>{if(v.current){const y=v.current.getBoundingClientRect();f({top:y.bottom+4,right:window.innerWidth-y.right})}},[]),h=()=>{t||(a?.({action:"toggle",trackingLabel:c,componentName:n}),l||N(),i(!l))},w=y=>{a?.({action:"select",trackingLabel:c,componentName:n}),s(y),i(!1)};return r.jsxs("div",{className:x("relative",o),children:[r.jsxs("button",{ref:v,type:"button",onClick:h,disabled:t,className:x("flex items-center gap-1.5 px-2 py-1 rounded border text-sm","bg-background transition-colors",t?"opacity-50 cursor-not-allowed":"hover:bg-muted cursor-pointer"),"aria-expanded":l,"aria-haspopup":"listbox",children:[r.jsx(k.icon,{className:x("h-3.5 w-3.5",k.color)}),r.jsx("span",{children:k.label}),r.jsx(C.ChevronDownIcon,{className:x("h-3.5 w-3.5 text-muted-foreground transition-transform",l&&"rotate-180")})]}),l&&Ue.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"fixed inset-0 z-[999998]",onClick:()=>i(!1)}),r.jsx("div",{className:"fixed z-[999999] w-52 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700 py-1",style:{top:m.top,right:m.right},role:"listbox","aria-label":"Roles",children:ie.map(y=>r.jsxs("button",{type:"button",onClick:()=>w(y.value),className:x("flex items-start gap-2 w-full px-3 py-2 text-left","transition-colors cursor-pointer",y.value===e?"bg-gray-100 dark:bg-gray-700":"hover:bg-gray-50 dark:hover:bg-gray-700"),role:"option","aria-selected":y.value===e,children:[r.jsx(y.icon,{className:x("h-4 w-4 mt-0.5",y.color)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm text-gray-900 dark:text-gray-100",children:y.label}),y.value===e&&r.jsx(C.CheckIcon,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"})]}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:y.description})]})]},y.value))})]}),document.body)]})}const Tr={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Gr({members:e,currentUserId:s,canManage:t=!1,onRoleChange:o,onRemove:a,isLoading:c=!1,emptyMessage:n="No members found",className:l,onTrack:i,trackingLabel:m,componentName:f="MemberList"}){if(c)return r.jsx("div",{className:x("space-y-2",l),children:[1,2,3].map(N=>r.jsx("div",{className:"h-16 rounded-lg border border-border bg-muted animate-pulse"},N))});if(e.length===0)return r.jsx("div",{className:x("text-center py-8 text-muted-foreground",l),children:n});const v=(N,h)=>{i?.({action:"role_change",trackingLabel:m,componentName:f}),o?.(N,h)},k=N=>{i?.({action:"remove",trackingLabel:m,componentName:f}),a?.(N)};return r.jsx("div",{className:x("divide-y divide-border rounded-lg border",l),children:e.map(N=>r.jsx(jr,{member:N,isSelf:N.userId===s,canManage:t,onRoleChange:o?v:void 0,onRemove:a?k:void 0},N.id))})}function jr({member:e,isSelf:s,canManage:t,onRoleChange:o,onRemove:a}){const c=e.user?.displayName||e.user?.email||"Unknown user",n=e.user?.email;return r.jsxs("div",{className:"flex items-center gap-3 p-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:r.jsx(C.UserIcon,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"font-medium text-foreground truncate",children:c}),s&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"(you)"})]}),n&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:n})]}),t&&o&&!s?r.jsx(ce,{value:e.role,onChange:l=>o(e.userId,l)}):r.jsx("span",{className:x("text-xs px-2 py-1 rounded-full font-medium",Tr[e.role]),children:e.role}),t&&a&&!s&&r.jsx("button",{type:"button",onClick:()=>a(e.userId),className:x("p-1.5 rounded hover:bg-destructive/10 text-muted-foreground","hover:text-destructive transition-colors"),title:"Remove member",children:r.jsx(C.TrashIcon,{className:"h-4 w-4"})})]})}function Fr({onSubmit:e,isSubmitting:s=!1,defaultRole:t=J.EntityRole.MEMBER,className:o,onTrack:a,trackingLabel:c,componentName:n="InvitationForm"}){const[l,i]=T.useState(""),[m,f]=T.useState(t),[v,k]=T.useState(null),N=async h=>{if(h.preventDefault(),k(null),!l.trim()){k("Email is required");return}if(!Br(l)){k("Please enter a valid email address");return}a?.({action:"submit",trackingLabel:c,componentName:n});try{await e({email:l.trim(),role:m}),i(""),f(t)}catch(w){k(w.message||"Failed to send invitation")}};return r.jsxs("form",{onSubmit:N,className:x("space-y-4",o),children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(C.EnvelopeIcon,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx("input",{type:"email",value:l,onChange:h=>i(h.target.value),placeholder:"Enter email address",disabled:s,className:x("w-full pl-10 pr-3 py-2 rounded-lg border bg-background","text-sm placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent",v&&"border-destructive focus:ring-destructive",s&&"opacity-50 cursor-not-allowed")})]}),r.jsx(ce,{value:m,onChange:f,disabled:s}),r.jsxs("button",{type:"submit",disabled:s||!l.trim(),className:x("flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",(s||!l.trim())&&"opacity-50 cursor-not-allowed"),children:[s?r.jsx(C.ArrowPathIcon,{className:"h-4 w-4 animate-spin"}):r.jsx(C.PaperAirplaneIcon,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Invite"})]})]}),v&&r.jsx("p",{className:"text-sm text-destructive",children:v})]})}function Br(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}const Lr={owner:"bg-purple-100 text-purple-700 dark:bg-purple-900 dark:text-purple-300",manager:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",member:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"};function Vr({invitations:e,mode:s,onCancel:t,onAccept:o,onDecline:a,isLoading:c=!1,emptyMessage:n="No pending invitations",className:l,onTrack:i,trackingLabel:m,componentName:f="InvitationList"}){const v=e.filter(w=>w.status==="pending");if(c)return r.jsx("div",{className:x("space-y-2",l),children:[1,2].map(w=>r.jsx("div",{className:"h-16 rounded-lg border border-border bg-muted animate-pulse"},w))});if(v.length===0)return r.jsx("div",{className:x("text-center py-8 text-muted-foreground",l),children:n});const k=w=>{i?.({action:"cancel",trackingLabel:m,componentName:f}),t?.(w)},N=w=>{i?.({action:"accept",trackingLabel:m,componentName:f}),o?.(w)},h=w=>{i?.({action:"decline",trackingLabel:m,componentName:f}),a?.(w)};return r.jsx("div",{className:x("divide-y divide-border rounded-lg border",l),children:v.map(w=>r.jsx(Dr,{invitation:w,mode:s,onCancel:t?k:void 0,onAccept:o?N:void 0,onDecline:a?h:void 0},w.id))})}function Dr({invitation:e,mode:s,onCancel:t,onAccept:o,onDecline:a}){const c=new Date(e.expiresAt),n=c<new Date,l=Math.ceil((c.getTime()-Date.now())/(1e3*60*60*24));return r.jsxs("div",{className:"flex items-center gap-3 p-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:r.jsx(C.EnvelopeIcon,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[s==="user"&&e.entity?r.jsx("p",{className:"font-medium text-foreground truncate",children:e.entity.displayName}):r.jsx("p",{className:"font-medium text-foreground truncate",children:e.email}),r.jsx("span",{className:x("text-xs px-2 py-0.5 rounded-full font-medium",Lr[e.role]),children:e.role})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[r.jsx(C.ClockIcon,{className:"h-3.5 w-3.5"}),n?r.jsx("span",{className:"text-destructive",children:"Expired"}):r.jsxs("span",{children:["Expires in ",l," days"]})]})]}),s==="admin"&&t&&r.jsx("button",{type:"button",onClick:()=>t(e.id),className:x("p-1.5 rounded hover:bg-destructive/10 text-muted-foreground","hover:text-destructive transition-colors"),title:"Cancel invitation",children:r.jsx(C.XCircleIcon,{className:"h-4 w-4"})}),s==="user"&&r.jsxs("div",{className:"flex items-center gap-2",children:[a&&r.jsxs("button",{type:"button",onClick:()=>a(e.token),className:x("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm","border hover:bg-muted transition-colors"),children:[r.jsx(C.XMarkIcon,{className:"h-4 w-4"}),r.jsx("span",{children:"Decline"})]}),o&&r.jsxs("button",{type:"button",onClick:()=>o(e.token),disabled:n,className:x("flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm","bg-primary text-primary-foreground","hover:bg-primary/90 transition-colors",n&&"opacity-50 cursor-not-allowed"),children:[r.jsx(C.CheckIcon,{className:"h-4 w-4"}),r.jsx("span",{children:"Accept"})]})]})]})}z.EntityCard=Pe,z.EntityList=Pr,z.EntitySelector=Or,z.InvitationForm=Fr,z.InvitationList=Vr,z.MemberList=Gr,z.MemberRoleSelector=ce,z.cn=x,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/entity-components",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Entity/Organization UI components for React",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",