@dxos/shell 0.4.10-main.b112538 → 0.4.10-main.cd13a57

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.
@@ -827,7 +827,7 @@ button {
827
827
  background-color: #61493f;
828
828
  }
829
829
 
830
- `;function mN(e){const n=l.useRef(null),t=l.useRef(null);return t.current&&t.current.update(e),l.useEffect(()=>(t.current=new Wu({...e,ref:n}),()=>{t.current=null}),[]),l.createElement("div",{ref:n})}const gN=({disabled:e,defaultEmoji:n,emoji:t,onChangeEmoji:i,onClickClear:r})=>{const{t:a}=fn("os"),[o]=Th("md",{ssr:!1}),[s,f]=yt({prop:t,onChange:i,defaultProp:n}),[d,u]=l.useState(!1);return l.createElement(l.Fragment,null,l.createElement(Ws.Root,{open:d,onOpenChange:u},l.createElement(Ws.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",classNames:"gap-2 text-2xl plb-1",disabled:e},l.createElement("span",{className:"sr-only"},a("select emoji label")),l.createElement("span",{className:"grow pis-14"},s),l.createElement(Ge.CaretDown,{className:He(4)}))),l.createElement(Ws.Content,{side:"right",sideOffset:o?0:-310,onKeyDownCapture:h=>{h.key==="Escape"&&(h.stopPropagation(),u(!1))}},l.createElement(mN,{data:PM,onEmojiSelect:({native:h})=>{h&&(f(h),u(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0}),l.createElement(Ws.Arrow,null))),l.createElement(_n.Root,null,l.createElement(_n.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",onClick:r,disabled:e},l.createElement("span",{className:"sr-only"},a("clear label")),l.createElement(Ge.ArrowCounterClockwise,null))),l.createElement(_n.Portal,null,l.createElement(_n.Content,{style:{zIndex:70},side:"right"},a("clear label"),l.createElement(_n.Arrow,null)))))},Xb=({hue:e})=>{const{tx:n}=Ie();return l.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12"},l.createElement("rect",{x:0,y:0,width:12,height:12,className:n("hue.fill","select--hue__preview",{hue:e})}))},bN=({disabled:e,hue:n,onChangeHue:t,defaultHue:i,onClickClear:r})=>{const{t:a}=fn("os"),[o,s]=yt({prop:n,onChange:t,defaultProp:i});return l.createElement(l.Fragment,null,l.createElement(ct.Root,{modal:!1},l.createElement(ct.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",classNames:"gap-2 plb-1",disabled:e},l.createElement("span",{className:"sr-only"},a("select hue label")),l.createElement("div",{role:"none",className:"pis-14 grow flex items-center justify-center gap-2"},l.createElement(Xb,{hue:o}),l.createElement("span",null,a(`${o} label`))),l.createElement(Ge.CaretDown,{className:He(4)}))),l.createElement(ct.Content,{side:"right"},l.createElement(ct.Viewport,null,Object.keys(na).map(f=>l.createElement(ct.CheckboxItem,{key:f,checked:f===o,onCheckedChange:()=>s(f)},l.createElement(Xb,{hue:f}),l.createElement("span",{className:"grow"},a(`${f} label`)),l.createElement(ct.ItemIndicator,null,l.createElement(Ge.Check,null))))),l.createElement(ct.Arrow,null))),l.createElement(_n.Root,null,l.createElement(_n.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",onClick:r,disabled:e},l.createElement("span",{className:"sr-only"},a("clear label")),l.createElement(Ge.ArrowCounterClockwise,null))),l.createElement(_n.Portal,null,l.createElement(_n.Content,{style:{zIndex:70},side:"right"},a("clear label"),l.createElement(_n.Arrow,null)))))};var bf={adjectives:["abundant","accessible","accomplished","accurate","achievable","adaptable","adaptive","adequate","adjustable","admirable","admiring","adorable","adored","adoring","adroit","adulatory","advanced","advantageous","adventurous","affable","affectionate","affirmative","affluent","affordable","agile","agreeable","alluring","altruistic","amazed","amazing","ambitious","amenable","amiable","amicable","ample","amusing","angelic","appealing","appreciable","appreciated","appreciative","appropriate","ardent","articulate","artistic","assuring","astonished","astonishing","astounded","astounding","athletic","attentive","attractive","audible","auspicious","authentic","autonomous","available","avid","awed","awesome","awestruck","beauteous","beautiful","believable","beloved","beneficent","beneficial","benevolent","blameless","blissful","blithe","bonny","booming","boundless","bountiful","brainiest","brainy","brave","breathtaking","bright","brighter","brightest","brilliant","brisk","brotherly","bullish","buoyant","calm","calming","capable","captivating","carefree","catchy","celebrated","celebratory","champion","charismatic","charitable","charming","chaste","cheaper","cheapest","cheerful","cheery","cherished","chivalrous","classic","classy","clean","cleaner","cleanest","cleanly","clear","cleared","clearer","clever","coherent","cohesive","colorful","comely","comfortable","comforting","comfy","commendable","commodious","compact","compatible","competitive","compliant","conciliatory","concise","confident","congenial","considerate","consistent","constructive","consummate","contrasty","convenient","convincing","cool","coolest","cooperative","correct","courageous","courteous","courtly","cozy","creative","credible","crisp","crisper","cushy","cute","daring","darling","dashing","dauntless","dazzled","dazzling","decent","decisive","dedicated","defeated","deft","delectable","delicate","delicious","delighted","delightful","dependable","deserving","desirable","desirous","detachable","devout","dexterous","dextrous","dignified","diligent","diplomatic","distinctive","diversified","divine","dominated","dumbfounded","durable","dynamic","eager","earnest","eased","easy","easygoing","ebullient","economical","ecstatic","educated","effective","efficacious","efficient","effortless","effusive","elated","elegant","elite","eloquent","eminent","enchanted","enchanting","encouraging","endearing","endorsed","energetic","engaging","engrossing","enhanced","enjoyable","enraptured","enterprising","entertaining","enthralled","enthusiastic","enticing","entranced","entrancing","enviable","envious","equitable","erudite","ethical","euphoric","evaluative","eventful","everlasting","evocative","exalted","exalting","exceeding","excellent","exceptional","excited","exciting","exemplary","exhilarating","expansive","exquisite","exuberant","exultant","fabulous","fair","faithful","famed","famous","fancier","fancy","fantastic","fascinating","fashionable","fast","faster","fastest","faultless","favorable","favored","favorite","fearless","feasible","feisty","felicitous","fertile","fervent","fervid","festive","fiery","fine","finer","finest","firmer","flashy","flatter","flattering","flawless","flexible","flourishing","fluent","fond","foolproof","foremost","formidable","fortuitous","fortunate","fragrant","free","freed","fresh","fresher","freshest","friendly","frugal","fruitful","fun","funny","futuristic","gainful","gallant","galore","generous","genial","gentle","gentlest","genuine","gifted","glad","glamorous","gleeful","glimmering","glistening","glorious","glowing","godlike","gold","golden","good","goodly","gorgeous","graceful","gracious","grand","grateful","gratified","gratifying","great","greatest","guiltless","gutsy","halcyon","hale","hallowed","handier","handsome","handy","happier","happy","hardier","hardy","harmless","harmonious","healthful","healthy","heartening","heartfelt","heartwarming","heavenly","helpful","heroic","hilarious","holy","honest","honorable","honored","hopeful","hospitable","hot","hottest","humane","humble","humorous","humourous","ideal","idolized","idyllic","illuminating","illustrious","imaginative","immaculate","immense","impartial","impassioned","impeccable","important","impressed","impressive","improved","improving","incredible","indebted","indulgent","industrious","inestimable","inexpensive","infallible","influential","ingenious","ingenuous","innocuous","innovative","insightful","inspiring","instructive","instrumental","intelligent","intelligible","interesting","intimate","intricate","intriguing","intuitive","invaluable","inventive","invigorating","invincible","inviolable","inviolate","invulnerable","irresistible","jolly","jovial","joyful","joyous","jubilant","judicious","keen","kindly","laudable","lavish","lawful","leading","lean","legendary","lighter","likable","like","liked","lionhearted","lively","logical","lovable","loved","lovely","loving","loyal","lucid","luckier","luckiest","lucky","lucrative","luminous","lush","lustrous","luxuriant","luxurious","luxury","lyrical","magic","magical","magnanimous","magnificent","majestic","manageable","marvellous","marvelous","masterful","matchless","mature","meaningful","memorable","merciful","meritorious","merry","mesmerized","mesmerizing","meticulous","mighty","miraculous","modern","modest","momentous","monumental","motivated","navigable","neat","neatest","nice","nifty","nimble","noble","noiseless","noteworthy","nourishing","observant","obtainable","optimal","optimistic","opulent","orderly","organized","outstanding","overjoyed","painless","palatial","pampered","panoramic","paramount","passionate","patient","patri","peaceable","peaceful","peerless","peppy","perfect","permissible","personalized","phenomenal","picturesque","playful","pleasant","pleased","pleasing","pleasurable","plentiful","plush","poetic","poignant","poised","polished","polite","popular","portable","posh","positive","powerful","praiseworthy","praising","precious","precise","preeminent","preferable","premier","prestigious","pretty","priceless","principled","privileged","prize","proactive","prodigious","productive","proficient","profound","progressive","prolific","prominent","promised","promising","prompt","proper","propitious","prosperous","protective","proud","proven","prudent","punctual","pure","purposeful","quaint","qualified","quicker","quiet","quieter","radiant","rapid","rapt","rapturous","rational","reachable","readable","ready","realistic","realizable","reasonable","reasoned","receptive","recommended","redeeming","refined","reformed","refreshed","refreshing","regal","rejoicing","relaxed","reliable","remarkable","renewed","renowned","replaceable","reputable","resilient","resolute","resounding","resourceful","respectable","respectful","resplendent","responsive","restful","restored","retractable","reverent","rewarding","rich","righteous","rightful","robust","romantic","roomier","rosy","safe","saintly","salutary","sane","satisfactory","satisfied","satisfying","scenic","seamless","seasoned","secure","selective","sensational","sensible","sensitive","serene","sexy","sharp","sharper","sharpest","shiny","significant","silent","simpler","simplest","simplified","sincere","skilled","skillful","sleek","slick","smart","smarter","smartest","smelly","smiling","smitten","smooth","smoother","smoothest","snappy","snazzy","sociable","soft","softer","solid","soulful","spacious","sparkling","spectacular","speedy","spellbinding","spellbound","spirited","spiritual","splendid","spontaneous","sporty","spotless","sprightly","stable","stainless","stately","statuesque","staunch","steadfast","steadiest","steady","stellar","stimulating","stimulative","streamlined","striking","strong","stronger","strongest","stunned","stunning","stupendous","sturdier","sturdy","stylish","stylized","suave","sublime","subsidized","substantive","succeeding","successful","sufficient","suitable","sumptuous","super","superb","superior","supple","supportive","supreme","surreal","sustainable","swankier","swankiest","swanky","sweeping","sweet","sweetheart","swift","talented","tantalizing","tempting","tenacious","tender","terrific","thankful","thinner","thoughtful","thrifty","thrilled","thrilling","thriving","tidy","timely","titillating","tolerable","top","topnotch","tough","tougher","toughest","tranquil","transparent","trendy","triumphal","triumphant","trusted","trusting","trustworthy","trusty","truthful","twinkly","unabashed","unaffected","unassailable","unbeatable","unbiased","unbound","undamaged","undaunted","undisputable","undisputed","unencumbered","unequivocal","unfettered","unlimited","unmatched","unparalleled","unreal","unrestricted","unrivaled","unselfish","unwavering","upbeat","upscale","usable","useful","valiant","valuable","verifiable","veritable","versatile","vibrant","victorious","viewable","vigilant","virtuous","visionary","vivacious","vivid","warm","warmer","warmhearted","wealthy","welcome","wholesome","wieldy","winning","wise","witty","wonderful","wondrous","workable","worth","worthwhile","worthy","young","youthful","zippy"],animals:["aardvark","albatross","alligator","angelfish","angora","ant","anteater","antelope","armadillo","avocet","baboon","badger","bandicoot","barnacle","barracuda","bat","beagle","bear","beaver","bee","beetle","bird","bison","bloodhound","boar","bobcat","bonobo","buffalo","bulldog","bullfrog","butterfly","buzzard","camel","cat","caterpillar","catfish","cattle","centipede","chameleon","cheetah","chicken","chihuahua","chimpanzee","chin","chinchilla","chipmunk","civet","clam","cockroach","coon","coral","corgi","cougar","cow","coyote","crab","crane","cuttlefish","dachshund","dalmatian","dane","deer","devil","dingo","dodo","dog","dogfish","dollar","dolphin","donkey","dormouse","dragon","dragonfly","duck","dugong","eagle","earwig","eel","elephant","emperor","emu","falcon","ferret","fish","flamingo","flounder","fly","forest","fowl","fox","foxhound","frog","gar","gecko","gerbil","gharial","gibbon","giraffe","goat","goose","gopher","gorilla","grasshopper","greyhound","grouse","guppy","hamster","hare","hedgehog","heron","hippopotamus","hornet","horse","hound","hummingbird","husky","hyena","hyrax","ibis","iguana","impala","insect","jackal","jaguar","jellyfish","kangaroo","kingfisher","kiwi","koala","kudu","labradoodle","ladybird","lemming","lemur","leopard","liger","lion","lionfish","lizard","llama","lobster","lynx","macaque","macaw","magpie","malamute","maltese","mammoth","manatee","mandrill","markhor","marmoset","mastiff","mayfly","meerkat","millipede","mole","mongoose","monkey","monster","moorhen","moose","moth","mouse","mule","newt","nightingale","ocelot","octopus","okapi","orangutan","ostrich","otter","owl","oyster","panda","panther","parrot","peacock","pelican","penguin","pheasant","pig","pike","piranha","platypus","pointer","poodle","porcupine","possum","prawn","puffin","pug","puma","quail","rabbit","raccoon","rat","rattlesnake","ray","reindeer","retriever","rhinoceros","robin","rottweiler","russel","salamander","scorpion","seahorse","seal","shark","sheep","sheepdog","shrew","shrimp","skater","skunk","sloth","slug","snail","snake","snowshoe","spaniel","sparrow","spider","sponge","squid","squirrel","squirt","starfish","stingray","stoat","swan","tapir","tarantula","termite","terrier","tiger","toad","tortoise","toucan","tuatara","turkey","turtle","uakari","urchin","vole","vulture","wallaby","walrus","warthog","wasp","weasel","whale","whippet","wildebeest","wolf","wolfhound","wolverine","wombat","woodlouse","woodpecker","worm","yak","zebra","zebu","zonkey","zorse"]},Zb=e=>e.charAt(0).toUpperCase()+e.slice(1),yf=e=>{const n=e.length*2/3,t=e.substring(0,n),i=e.substring(n),r=Zb(bf.adjectives[parseInt(t,16)%bf.adjectives.length]),a=Zb(bf.animals[parseInt(i,16)%bf.animals.length]);return`${r} ${a}`};const Qb=l.forwardRef(({identity:e,presence:n,onClick:t,classNames:i,...r},a)=>{var d,u,h,v,m;const o=vm(e.identityKey),s=On("identityListItem__label"),f=((d=e.profile)==null?void 0:d.displayName)??yf(e.identityKey.toHex());return l.createElement(Zd.Root,{...r,classNames:le("flex gap-2 pis-3 pie-1 items-center",t&&"cursor-pointer",i),onClick:()=>t==null?void 0:t(),"data-testid":"identity-list-item",labelId:s,ref:a},l.createElement(Dn.Root,{status:n===Wo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:s,hue:((h=(u=e.profile)==null?void 0:u.data)==null?void 0:h.hue)||o.hue},l.createElement(Dn.Frame,{classNames:"place-self-center"},l.createElement(Dn.Fallback,{text:((m=(v=e.profile)==null?void 0:v.data)==null?void 0:m.emoji)||o.emoji})),l.createElement(Dn.Label,{classNames:"text-sm truncate pli-2"},f)))}),yN=({devices:e,onSelect:n})=>{const{t}=fn("os");return e.length>0?l.createElement(Xd,{classNames:"flex flex-col gap-2"},e.map(i=>{var s,f;const r=((s=i.profile)==null?void 0:s.type)||Yi.DeviceType.UNKNOWN,a=(f=i.profile)!=null&&f.label?`${i.profile.label} (${Yi.DeviceType[r]})`:yf(i.deviceKey.toHex()),o={identityKey:i.deviceKey,profile:{displayName:a}};return l.createElement(Qb,{key:i.deviceKey.toHex(),identity:o,presence:i.presence,onClick:n&&(()=>n(i))})})):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(Nn,"text-center is-full")},t("empty device list message")))},wN=({spaceKey:e,includeSelf:n,onSelect:t})=>{const i=Ye.useClient(),r=Wo.useMembers(e),a=l.useMemo(()=>n?r.sort(o=>o.identity.identityKey.equals(i.halo.identity.get().identityKey)?-1:1):r.filter(o=>!o.identity.identityKey.equals(i.halo.identity.get().identityKey)),[r]);return l.createElement(_N,{members:a,onSelect:t})},_N=({members:e,onSelect:n})=>{const{t}=fn("os"),i=e.filter(r=>r.identity);return i.length>0?l.createElement(Xd,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},i.map(r=>l.createElement(Qb,{key:r.identity.identityKey.toHex(),identity:r.identity,presence:r.presence,onClick:n&&(()=>n(r))}))):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(Nn,"text-center is-full mlb-2")},t("empty space members message")))},wf=43200,ey=1440;function ny(e){const n=zn(e),t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+e-+t}function _f(e,n){const t=zn(e),i=zn(n),r=t.getTime()-i.getTime();return r<0?-1:r>0?1:r}function kN(e,n){const t=zn(e),i=zn(n),r=t.getFullYear()-i.getFullYear(),a=t.getMonth()-i.getMonth();return r*12+a}function xN(e){return n=>{const i=(e?Math[e]:Math.trunc)(n);return i===0?0:i}}function EN(e,n){return+zn(e)-+zn(n)}function SN(e){const n=zn(e);return n.setHours(23,59,59,999),n}function CN(e){const n=zn(e),t=n.getMonth();return n.setFullYear(n.getFullYear(),t+1,0),n.setHours(23,59,59,999),n}function $N(e){const n=zn(e);return+SN(n)==+CN(n)}function AN(e,n){const t=zn(e),i=zn(n),r=_f(t,i),a=Math.abs(kN(t,i));let o;if(a<1)o=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-r*a);let s=_f(t,i)===-r;$N(zn(e))&&a===1&&_f(e,i)===1&&(s=!1),o=r*(a-Number(s))}return o===0?0:o}function TN(e,n,t){const i=EN(e,n)/1e3;return xN(t==null?void 0:t.roundingMethod)(i)}function ON(e,n,t){const i=y2(),r=(t==null?void 0:t.locale)??i.locale??Ph,a=2520,o=_f(e,n);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o});let f,d;o>0?(f=zn(n),d=zn(e)):(f=zn(e),d=zn(n));const u=TN(d,f),h=(ny(d)-ny(f))/1e3,v=Math.round((u-h)/60);let m;if(v<2)return t!=null&&t.includeSeconds?u<5?r.formatDistance("lessThanXSeconds",5,s):u<10?r.formatDistance("lessThanXSeconds",10,s):u<20?r.formatDistance("lessThanXSeconds",20,s):u<40?r.formatDistance("halfAMinute",0,s):u<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):v===0?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",v,s);if(v<45)return r.formatDistance("xMinutes",v,s);if(v<90)return r.formatDistance("aboutXHours",1,s);if(v<ey){const g=Math.round(v/60);return r.formatDistance("aboutXHours",g,s)}else{if(v<a)return r.formatDistance("xDays",1,s);if(v<wf){const g=Math.round(v/ey);return r.formatDistance("xDays",g,s)}else if(v<wf*2)return m=Math.round(v/wf),r.formatDistance("aboutXMonths",m,s)}if(m=AN(d,f),m<12){const g=Math.round(v/wf);return r.formatDistance("xMonths",g,s)}else{const g=m%12,b=Math.trunc(m/12);return g<3?r.formatDistance("aboutXYears",b,s):g<9?r.formatDistance("overXYears",b,s):r.formatDistance("almostXYears",b+1,s)}}function PN(e,n){return ON(e,Date.now(),n)}var ty;(function(e){e[e.TRACE=5]="TRACE",e[e.DEBUG=10]="DEBUG",e[e.INFO=11]="INFO",e[e.WARN=12]="WARN",e[e.ERROR=13]="ERROR"})(ty||(ty={}));var iy;(function(e){(function(n){n[n.INCLUSIVE=1]="INCLUSIVE",n[n.EXPLICIT=2]="EXPLICIT"})(e.MatchingOptions||(e.MatchingOptions={}))})(iy||(iy={}));var ry;(function(e){e[e.ACTIVE=0]="ACTIVE",e[e.INACTIVE=1]="INACTIVE"})(ry||(ry={}));var ay;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.TRUNCATE=1]="TRUNCATE",n[n.HUMANIZE=2]="HUMANIZE"})(e.KEY_OPTION||(e.KEY_OPTION={}))})(ay||(ay={}));var oy;(function(e){(function(n){n[n.BROWSER=0]="BROWSER",n[n.SHARED_WORKER=1]="SHARED_WORKER",n[n.NODE=2]="NODE"})(e.PLATFORM_TYPE||(e.PLATFORM_TYPE={}))})(oy||(oy={}));var sy;(function(e){e[e.CURRENT=0]="CURRENT",e[e.TRUSTED=1]="TRUSTED"})(sy||(sy={}));var fy;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(fy||(fy={}));var ly;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(ly||(ly={}));var dy;(function(e){e[e.INACTIVE=2]="INACTIVE",e[e.ACTIVE=6]="ACTIVE",e[e.CLOSED=1]="CLOSED",e[e.CONTROL_ONLY=7]="CONTROL_ONLY",e[e.INITIALIZING=4]="INITIALIZING",e[e.READY=3]="READY",e[e.ERROR=5]="ERROR"})(dy||(dy={}));var uy;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",n[n.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",n[n.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT"})(e.Migration||(e.Migration={}))})(uy||(uy={}));var _e;(function(e){(function(n){n[n.INTERACTIVE=0]="INTERACTIVE",n[n.OFFLINE=1]="OFFLINE",n[n.MULTIUSE=2]="MULTIUSE"})(e.Type||(e.Type={})),function(n){n[n.DEVICE=0]="DEVICE",n[n.SPACE=1]="SPACE"}(e.Kind||(e.Kind={})),function(n){n[n.NONE=0]="NONE",n[n.SHARED_SECRET=1]="SHARED_SECRET"}(e.AuthMethod||(e.AuthMethod={})),function(n){n[n.INIT=0]="INIT",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",n[n.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",n[n.AUTHENTICATING=4]="AUTHENTICATING",n[n.SUCCESS=5]="SUCCESS",n[n.CANCELLED=6]="CANCELLED",n[n.TIMEOUT=7]="TIMEOUT",n[n.ERROR=8]="ERROR",n[n.EXPIRED=9]="EXPIRED"}(e.State||(e.State={}))})(_e||(_e={}));var cy;(function(e){(function(n){n[n.ADDED=0]="ADDED",n[n.REMOVED=1]="REMOVED",n[n.SAVED=2]="SAVED",n[n.LOAD_COMPLETE=3]="LOAD_COMPLETE"})(e.Action||(e.Action={})),function(n){n[n.CREATED=0]="CREATED",n[n.ACCEPTED=1]="ACCEPTED"}(e.Type||(e.Type={}))})(cy||(cy={}));var hy;(function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE"})(hy||(hy={}));var IN=class extends Error{constructor(){super("Context disposed.")}};function FN(e,n,t,i){var r=arguments.length,a=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,t,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(n,t,a):o(n,t))||a);return r>3&&a&&Object.defineProperty(n,t,a),a}var Hu="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MN=300,vy=class I_{constructor({onError:n=r=>{if(!(r instanceof IN))throw this.dispose(),r},attributes:t={},parent:i}={}){this._disposeCallbacks=[],this._isDisposed=!1,this._disposePromise=void 0,this._parent=null,this.maxSafeDisposeCallbacks=MN,this._onError=n,this._attributes=t,i!==void 0&&(this._parent=i)}get disposed(){return this._isDisposed}get disposeCallbacksLength(){return this._disposeCallbacks.length}onDispose(n){return this._isDisposed&&(async()=>{try{await n()}catch(t){We.catch(t,void 0,{F:Hu,L:82,S:this,C:(i,r)=>i(...r)})}})(),this._disposeCallbacks.push(n),this._disposeCallbacks.length>this.maxSafeDisposeCallbacks&&We.warn("Context has a large number of dispose callbacks. This might be a memory leak.",{count:this._disposeCallbacks.length,safeThreshold:this.maxSafeDisposeCallbacks},{F:Hu,L:89,S:this,C:(t,i)=>t(...i)}),()=>{const t=this._disposeCallbacks.indexOf(n);t!==-1&&this._disposeCallbacks.splice(t,1)}}dispose(){if(this._disposePromise)return this._disposePromise;this._isDisposed=!0;let n;this._disposePromise=new Promise(r=>{n=r});const t=[],i=Array.from(this._disposeCallbacks).reverse();for(const r of i)t.push((async()=>{try{await r()}catch(a){We.catch(a,void 0,{F:Hu,L:132,S:this,C:(o,s)=>o(...s)})}})());return this._disposeCallbacks.length=0,Promise.all(t).then(()=>{n()}),this._disposePromise}raise(n){if(!this._isDisposed)try{this._onError(n)}catch(t){Promise.reject(t)}}derive({onError:n,attributes:t}={}){const i=new I_({onError:async a=>{if(!n)this.raise(a);else try{await n(a)}catch{this.raise(a)}},attributes:t}),r=this.onDispose(()=>i.dispose());return i.onDispose(r),i}getAttribute(n){if(n in this._attributes)return this._attributes[n];if(this._parent!==null)return this._parent.getAttribute(n)}};vy=FN([_S("Context")],vy);var kf={};Object.defineProperty(kf,"__esModule",{value:!0}),kf.Observable=void 0;const py=e=>!!Symbol[e],Vu=e=>py(e)?Symbol[e]:"@@"+e,NN=Vu("iterator"),qu=Vu("observable"),my=Vu("species");function xf(e,n){let t=e[n];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function vo(e){let n=e.constructor;return n!==void 0&&(n=n[my],n===null&&(n=void 0)),n!==void 0?n:Sf}function DN(e){return e instanceof Sf}function fa(e){fa.log?fa.log(e):setTimeout(()=>{throw e})}function Ef(e){Promise.resolve().then(()=>{try{e()}catch(n){fa(n)}})}function gy(e){let n=e._cleanup;if(n!==void 0&&(e._cleanup=void 0,!!n))try{if(typeof n=="function")n();else{let t=xf(n,"unsubscribe");t&&t.call(n)}}catch(t){fa(t)}}function Gu(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function LN(e){let n=e._queue;if(n){e._queue=void 0,e._state="ready";for(let t=0;t<n.length&&(by(e,n[t].type,n[t].value),e._state!=="closed");++t);}}function by(e,n,t){e._state="running";let i=e._observer;try{let r=xf(i,n);switch(n){case"next":r&&r.call(i,t);break;case"error":if(Gu(e),r)r.call(i,t);else throw t;break;case"complete":Gu(e),r&&r.call(i);break}}catch(r){fa(r)}e._state==="closed"?gy(e):e._state==="running"&&(e._state="ready")}function Ku(e,n,t){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:n,value:t});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:n,value:t}],Ef(()=>LN(e));return}by(e,n,t)}}class BN{constructor(n,t){this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";let i=this,r={get closed(){return i._state==="closed"},next(a){Ku(i,"next",a)},error(a){Ku(i,"error",a)},complete(){Ku(i,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(a){r.error(a)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Gu(this),gy(this))}}let Sf=class cl{constructor(n){if(!(this instanceof cl))throw new TypeError("Observable cannot be called as a function");if(typeof n!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=n}subscribe(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new BN(n,this._subscriber)}forEach(n){return new Promise((t,i)=>{if(typeof n!="function"){i(new TypeError(n+" is not a function"));return}function r(){a.unsubscribe(),t()}let a=this.subscribe({next(o){try{n(o,r)}catch(s){i(s),a.unsubscribe()}},error:i,complete:t})})}map(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>this.subscribe({next(r){try{r=n(r)}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}filter(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>this.subscribe({next(r){try{if(!n(r))return}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}reduce(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this),i=arguments.length>1,r=!1,o=arguments[1];return new t(s=>this.subscribe({next(f){let d=!r;if(r=!0,!d||i)try{o=n(o,f)}catch(u){return s.error(u)}else o=f},error(f){s.error(f)},complete(){if(!r&&!i)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(o),s.complete()}}))}async all(){let n=[];return await this.forEach(t=>n.push(t)),n}concat(...n){let t=vo(this);return new t(i=>{let r,a=0;function o(s){r=s.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){a===n.length?(r=void 0,i.complete()):o(t.from(n[a++]))}})}return o(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>{let r=[],a=this.subscribe({next(s){if(n)try{s=n(s)}catch(d){return i.error(d)}let f=t.from(s).subscribe({next(d){i.next(d)},error(d){i.error(d)},complete(){let d=r.indexOf(f);d>=0&&r.splice(d,1),o()}});r.push(f)},error(s){i.error(s)},complete(){o()}});function o(){a.closed&&r.length===0&&i.complete()}return()=>{r.forEach(s=>s.unsubscribe()),a.unsubscribe()}})}[qu](){return this}static from(n){let t=typeof this=="function"?this:cl;if(n==null)throw new TypeError(n+" is not an object");let i=xf(n,qu);if(i){let r=i.call(n);if(Object(r)!==r)throw new TypeError(r+" is not an object");return DN(r)&&r.constructor===t?r:new t(a=>r.subscribe(a))}if(py("iterator")&&(i=xf(n,NN),i))return new t(r=>{Ef(()=>{if(!r.closed){for(let a of i.call(n))if(r.next(a),r.closed)return;r.complete()}})});if(Array.isArray(n))return new t(r=>{Ef(()=>{if(!r.closed){for(let a=0;a<n.length;++a)if(r.next(n[a]),r.closed)return;r.complete()}})});throw new TypeError(n+" is not observable")}static of(...n){let t=typeof this=="function"?this:cl;return new t(i=>{Ef(()=>{if(!i.closed){for(let r=0;r<n.length;++r)if(i.next(n[r]),i.closed)return;i.complete()}})})}static get[my](){return this}};kf.Observable=Sf,Object.defineProperty(Sf,Symbol("extensions"),{value:{symbol:qu,hostReportError:fa},configurable:!0});var jN=kf.Observable;const Cf=Er(jN);var yy={exports:{}},Yu={exports:{}},la=typeof Reflect=="object"?Reflect:null,wy=la&&typeof la.apply=="function"?la.apply:function(n,t,i){return Function.prototype.apply.call(n,t,i)},$f;la&&typeof la.ownKeys=="function"?$f=la.ownKeys:Object.getOwnPropertySymbols?$f=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:$f=function(n){return Object.getOwnPropertyNames(n)};function RN(e){console&&console.warn&&console.warn(e)}var _y=Number.isNaN||function(n){return n!==n};function mn(){mn.init.call(this)}Yu.exports=mn,Yu.exports.once=HN,mn.EventEmitter=mn,mn.prototype._events=void 0,mn.prototype._eventsCount=0,mn.prototype._maxListeners=void 0;var ky=10;function Af(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(mn,"defaultMaxListeners",{enumerable:!0,get:function(){return ky},set:function(e){if(typeof e!="number"||e<0||_y(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");ky=e}}),mn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},mn.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||_y(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function xy(e){return e._maxListeners===void 0?mn.defaultMaxListeners:e._maxListeners}mn.prototype.getMaxListeners=function(){return xy(this)},mn.prototype.emit=function(n){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=n==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var f=a[n];if(f===void 0)return!1;if(typeof f=="function")wy(f,this,t);else for(var d=f.length,u=Ay(f,d),i=0;i<d;++i)wy(u[i],this,t);return!0};function Ey(e,n,t,i){var r,a,o;if(Af(t),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",n,t.listener?t.listener:t),a=e._events),o=a[n]),o===void 0)o=a[n]=t,++e._eventsCount;else if(typeof o=="function"?o=a[n]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),r=xy(e),r>0&&o.length>r&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=n,s.count=o.length,RN(s)}return e}mn.prototype.addListener=function(n,t){return Ey(this,n,t,!1)},mn.prototype.on=mn.prototype.addListener,mn.prototype.prependListener=function(n,t){return Ey(this,n,t,!0)};function UN(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Sy(e,n,t){var i={fired:!1,wrapFn:void 0,target:e,type:n,listener:t},r=UN.bind(i);return r.listener=t,i.wrapFn=r,r}mn.prototype.once=function(n,t){return Af(t),this.on(n,Sy(this,n,t)),this},mn.prototype.prependOnceListener=function(n,t){return Af(t),this.prependListener(n,Sy(this,n,t)),this},mn.prototype.removeListener=function(n,t){var i,r,a,o,s;if(Af(t),r=this._events,r===void 0)return this;if(i=r[n],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[n],r.removeListener&&this.emit("removeListener",n,i.listener||t));else if(typeof i!="function"){for(a=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,a=o;break}if(a<0)return this;a===0?i.shift():zN(i,a),i.length===1&&(r[n]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",n,s||t)}return this},mn.prototype.off=mn.prototype.removeListener,mn.prototype.removeAllListeners=function(n){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[n]),this;if(arguments.length===0){var a=Object.keys(i),o;for(r=0;r<a.length;++r)o=a[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[n],typeof t=="function")this.removeListener(n,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(n,t[r]);return this};function Cy(e,n,t){var i=e._events;if(i===void 0)return[];var r=i[n];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?WN(r):Ay(r,r.length)}mn.prototype.listeners=function(n){return Cy(this,n,!0)},mn.prototype.rawListeners=function(n){return Cy(this,n,!1)},mn.listenerCount=function(e,n){return typeof e.listenerCount=="function"?e.listenerCount(n):$y.call(e,n)},mn.prototype.listenerCount=$y;function $y(e){var n=this._events;if(n!==void 0){var t=n[e];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}mn.prototype.eventNames=function(){return this._eventsCount>0?$f(this._events):[]};function Ay(e,n){for(var t=new Array(n),i=0;i<n;++i)t[i]=e[i];return t}function zN(e,n){for(;n+1<e.length;n++)e[n]=e[n+1];e.pop()}function WN(e){for(var n=new Array(e.length),t=0;t<n.length;++t)n[t]=e[t].listener||e[t];return n}function HN(e,n){return new Promise(function(t,i){function r(o){e.removeListener(n,a),i(o)}function a(){typeof e.removeListener=="function"&&e.removeListener("error",r),t([].slice.call(arguments))}Ty(e,n,a,{once:!0}),n!=="error"&&VN(e,r,{once:!0})})}function VN(e,n,t){typeof e.on=="function"&&Ty(e,"error",n,t)}function Ty(e,n,t,i){if(typeof e.on=="function")i.once?e.once(n,t):e.on(n,t);else if(typeof e.addEventListener=="function")e.addEventListener(n,function r(a){i.once&&e.removeEventListener(n,r),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Oy=Yu.exports,Py=Oy.EventEmitter,po={},Tf={};Tf.byteLength=KN,Tf.toByteArray=JN,Tf.fromByteArray=QN;for(var Zt=[],kt=[],qN=typeof Uint8Array<"u"?Uint8Array:Array,Ju="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",da=0,GN=Ju.length;da<GN;++da)Zt[da]=Ju[da],kt[Ju.charCodeAt(da)]=da;kt[45]=62,kt[95]=63;function Iy(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=n);var i=t===n?0:4-t%4;return[t,i]}function KN(e){var n=Iy(e),t=n[0],i=n[1];return(t+i)*3/4-i}function YN(e,n,t){return(n+t)*3/4-t}function JN(e){var n,t=Iy(e),i=t[0],r=t[1],a=new qN(YN(e,i,r)),o=0,s=r>0?i-4:i,f;for(f=0;f<s;f+=4)n=kt[e.charCodeAt(f)]<<18|kt[e.charCodeAt(f+1)]<<12|kt[e.charCodeAt(f+2)]<<6|kt[e.charCodeAt(f+3)],a[o++]=n>>16&255,a[o++]=n>>8&255,a[o++]=n&255;return r===2&&(n=kt[e.charCodeAt(f)]<<2|kt[e.charCodeAt(f+1)]>>4,a[o++]=n&255),r===1&&(n=kt[e.charCodeAt(f)]<<10|kt[e.charCodeAt(f+1)]<<4|kt[e.charCodeAt(f+2)]>>2,a[o++]=n>>8&255,a[o++]=n&255),a}function XN(e){return Zt[e>>18&63]+Zt[e>>12&63]+Zt[e>>6&63]+Zt[e&63]}function ZN(e,n,t){for(var i,r=[],a=n;a<t;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),r.push(XN(i));return r.join("")}function QN(e){for(var n,t=e.length,i=t%3,r=[],a=16383,o=0,s=t-i;o<s;o+=a)r.push(ZN(e,o,o+a>s?s:o+a));return i===1?(n=e[t-1],r.push(Zt[n>>2]+Zt[n<<4&63]+"==")):i===2&&(n=(e[t-2]<<8)+e[t-1],r.push(Zt[n>>10]+Zt[n>>4&63]+Zt[n<<2&63]+"=")),r.join("")}var Xu={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Xu.read=function(e,n,t,i,r){var a,o,s=r*8-i-1,f=(1<<s)-1,d=f>>1,u=-7,h=t?r-1:0,v=t?-1:1,m=e[n+h];for(h+=v,a=m&(1<<-u)-1,m>>=-u,u+=s;u>0;a=a*256+e[n+h],h+=v,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=i;u>0;o=o*256+e[n+h],h+=v,u-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-d}return(m?-1:1)*o*Math.pow(2,a-i)},Xu.write=function(e,n,t,i,r,a){var o,s,f,d=a*8-r-1,u=(1<<d)-1,h=u>>1,v=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:a-1,g=i?1:-1,b=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(s=isNaN(n)?1:0,o=u):(o=Math.floor(Math.log(n)/Math.LN2),n*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+h>=1?n+=v/f:n+=v*Math.pow(2,1-h),n*f>=2&&(o++,f/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(n*f-1)*Math.pow(2,r),o=o+h):(s=n*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[t+m]=s&255,m+=g,s/=256,r-=8);for(o=o<<r|s,d+=r;d>0;e[t+m]=o&255,m+=g,o/=256,d-=8);e[t+m-g]|=b*128};/*!
830
+ `;function mN(e){const n=l.useRef(null),t=l.useRef(null);return t.current&&t.current.update(e),l.useEffect(()=>(t.current=new Wu({...e,ref:n}),()=>{t.current=null}),[]),l.createElement("div",{ref:n})}const gN=({disabled:e,defaultEmoji:n,emoji:t,onChangeEmoji:i,onClickClear:r})=>{const{t:a}=fn("os"),[o]=Th("md",{ssr:!1}),[s,f]=yt({prop:t,onChange:i,defaultProp:n}),[d,u]=l.useState(!1);return l.createElement(l.Fragment,null,l.createElement(Ws.Root,{open:d,onOpenChange:u},l.createElement(Ws.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",classNames:"gap-2 text-2xl plb-1",disabled:e},l.createElement("span",{className:"sr-only"},a("select emoji label")),l.createElement("span",{className:"grow pis-14"},s),l.createElement(Ge.CaretDown,{className:He(4)}))),l.createElement(Ws.Content,{side:"right",sideOffset:o?0:-310,onKeyDownCapture:h=>{h.key==="Escape"&&(h.stopPropagation(),u(!1))}},l.createElement(mN,{data:PM,onEmojiSelect:({native:h})=>{h&&(f(h),u(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0}),l.createElement(Ws.Arrow,null))),l.createElement(_n.Root,null,l.createElement(_n.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",onClick:r,disabled:e},l.createElement("span",{className:"sr-only"},a("clear label")),l.createElement(Ge.ArrowCounterClockwise,null))),l.createElement(_n.Portal,null,l.createElement(_n.Content,{style:{zIndex:70},side:"right"},a("clear label"),l.createElement(_n.Arrow,null)))))},Xb=({hue:e})=>{const{tx:n}=Ie();return l.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12"},l.createElement("rect",{x:0,y:0,width:12,height:12,className:n("hue.fill","select--hue__preview",{hue:e})}))},bN=({disabled:e,hue:n,onChangeHue:t,defaultHue:i,onClickClear:r})=>{const{t:a}=fn("os"),[o,s]=yt({prop:n,onChange:t,defaultProp:i});return l.createElement(l.Fragment,null,l.createElement(ct.Root,{modal:!1},l.createElement(ct.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",classNames:"gap-2 plb-1",disabled:e},l.createElement("span",{className:"sr-only"},a("select hue label")),l.createElement("div",{role:"none",className:"pis-14 grow flex items-center justify-center gap-2"},l.createElement(Xb,{hue:o}),l.createElement("span",null,a(`${o} label`))),l.createElement(Ge.CaretDown,{className:He(4)}))),l.createElement(ct.Content,{side:"right"},l.createElement(ct.Viewport,null,Object.keys(na).map(f=>l.createElement(ct.CheckboxItem,{key:f,checked:f===o,onCheckedChange:()=>s(f)},l.createElement(Xb,{hue:f}),l.createElement("span",{className:"grow"},a(`${f} label`)),l.createElement(ct.ItemIndicator,null,l.createElement(Ge.Check,null))))),l.createElement(ct.Arrow,null))),l.createElement(_n.Root,null,l.createElement(_n.Trigger,{asChild:!0},l.createElement(rt,{variant:"ghost",onClick:r,disabled:e},l.createElement("span",{className:"sr-only"},a("clear label")),l.createElement(Ge.ArrowCounterClockwise,null))),l.createElement(_n.Portal,null,l.createElement(_n.Content,{style:{zIndex:70},side:"right"},a("clear label"),l.createElement(_n.Arrow,null)))))};var bf={adjectives:["abundant","accessible","accomplished","accurate","achievable","adaptable","adaptive","adequate","adjustable","admirable","admiring","adorable","adored","adoring","adroit","adulatory","advanced","advantageous","adventurous","affable","affectionate","affirmative","affluent","affordable","agile","agreeable","alluring","altruistic","amazed","amazing","ambitious","amenable","amiable","amicable","ample","amusing","angelic","appealing","appreciable","appreciated","appreciative","appropriate","ardent","articulate","artistic","assuring","astonished","astonishing","astounded","astounding","athletic","attentive","attractive","audible","auspicious","authentic","autonomous","available","avid","awed","awesome","awestruck","beauteous","beautiful","believable","beloved","beneficent","beneficial","benevolent","blameless","blissful","blithe","bonny","booming","boundless","bountiful","brainiest","brainy","brave","breathtaking","bright","brighter","brightest","brilliant","brisk","brotherly","bullish","buoyant","calm","calming","capable","captivating","carefree","catchy","celebrated","celebratory","champion","charismatic","charitable","charming","chaste","cheaper","cheapest","cheerful","cheery","cherished","chivalrous","classic","classy","clean","cleaner","cleanest","cleanly","clear","cleared","clearer","clever","coherent","cohesive","colorful","comely","comfortable","comforting","comfy","commendable","commodious","compact","compatible","competitive","compliant","conciliatory","concise","confident","congenial","considerate","consistent","constructive","consummate","contrasty","convenient","convincing","cool","coolest","cooperative","correct","courageous","courteous","courtly","cozy","creative","credible","crisp","crisper","cushy","cute","daring","darling","dashing","dauntless","dazzled","dazzling","decent","decisive","dedicated","defeated","deft","delectable","delicate","delicious","delighted","delightful","dependable","deserving","desirable","desirous","detachable","devout","dexterous","dextrous","dignified","diligent","diplomatic","distinctive","diversified","divine","dominated","dumbfounded","durable","dynamic","eager","earnest","eased","easy","easygoing","ebullient","economical","ecstatic","educated","effective","efficacious","efficient","effortless","effusive","elated","elegant","elite","eloquent","eminent","enchanted","enchanting","encouraging","endearing","endorsed","energetic","engaging","engrossing","enhanced","enjoyable","enraptured","enterprising","entertaining","enthralled","enthusiastic","enticing","entranced","entrancing","enviable","envious","equitable","erudite","ethical","euphoric","evaluative","eventful","everlasting","evocative","exalted","exalting","exceeding","excellent","exceptional","excited","exciting","exemplary","exhilarating","expansive","exquisite","exuberant","exultant","fabulous","fair","faithful","famed","famous","fancier","fancy","fantastic","fascinating","fashionable","fast","faster","fastest","faultless","favorable","favored","favorite","fearless","feasible","feisty","felicitous","fertile","fervent","fervid","festive","fiery","fine","finer","finest","firmer","flashy","flatter","flattering","flawless","flexible","flourishing","fluent","fond","foolproof","foremost","formidable","fortuitous","fortunate","fragrant","free","freed","fresh","fresher","freshest","friendly","frugal","fruitful","fun","funny","futuristic","gainful","gallant","galore","generous","genial","gentle","gentlest","genuine","gifted","glad","glamorous","gleeful","glimmering","glistening","glorious","glowing","godlike","gold","golden","good","goodly","gorgeous","graceful","gracious","grand","grateful","gratified","gratifying","great","greatest","guiltless","gutsy","halcyon","hale","hallowed","handier","handsome","handy","happier","happy","hardier","hardy","harmless","harmonious","healthful","healthy","heartening","heartfelt","heartwarming","heavenly","helpful","heroic","hilarious","holy","honest","honorable","honored","hopeful","hospitable","hot","hottest","humane","humble","humorous","humourous","ideal","idolized","idyllic","illuminating","illustrious","imaginative","immaculate","immense","impartial","impassioned","impeccable","important","impressed","impressive","improved","improving","incredible","indebted","indulgent","industrious","inestimable","inexpensive","infallible","influential","ingenious","ingenuous","innocuous","innovative","insightful","inspiring","instructive","instrumental","intelligent","intelligible","interesting","intimate","intricate","intriguing","intuitive","invaluable","inventive","invigorating","invincible","inviolable","inviolate","invulnerable","irresistible","jolly","jovial","joyful","joyous","jubilant","judicious","keen","kindly","laudable","lavish","lawful","leading","lean","legendary","lighter","likable","like","liked","lionhearted","lively","logical","lovable","loved","lovely","loving","loyal","lucid","luckier","luckiest","lucky","lucrative","luminous","lush","lustrous","luxuriant","luxurious","luxury","lyrical","magic","magical","magnanimous","magnificent","majestic","manageable","marvellous","marvelous","masterful","matchless","mature","meaningful","memorable","merciful","meritorious","merry","mesmerized","mesmerizing","meticulous","mighty","miraculous","modern","modest","momentous","monumental","motivated","navigable","neat","neatest","nice","nifty","nimble","noble","noiseless","noteworthy","nourishing","observant","obtainable","optimal","optimistic","opulent","orderly","organized","outstanding","overjoyed","painless","palatial","pampered","panoramic","paramount","passionate","patient","patri","peaceable","peaceful","peerless","peppy","perfect","permissible","personalized","phenomenal","picturesque","playful","pleasant","pleased","pleasing","pleasurable","plentiful","plush","poetic","poignant","poised","polished","polite","popular","portable","posh","positive","powerful","praiseworthy","praising","precious","precise","preeminent","preferable","premier","prestigious","pretty","priceless","principled","privileged","prize","proactive","prodigious","productive","proficient","profound","progressive","prolific","prominent","promised","promising","prompt","proper","propitious","prosperous","protective","proud","proven","prudent","punctual","pure","purposeful","quaint","qualified","quicker","quiet","quieter","radiant","rapid","rapt","rapturous","rational","reachable","readable","ready","realistic","realizable","reasonable","reasoned","receptive","recommended","redeeming","refined","reformed","refreshed","refreshing","regal","rejoicing","relaxed","reliable","remarkable","renewed","renowned","replaceable","reputable","resilient","resolute","resounding","resourceful","respectable","respectful","resplendent","responsive","restful","restored","retractable","reverent","rewarding","rich","righteous","rightful","robust","romantic","roomier","rosy","safe","saintly","salutary","sane","satisfactory","satisfied","satisfying","scenic","seamless","seasoned","secure","selective","sensational","sensible","sensitive","serene","sexy","sharp","sharper","sharpest","shiny","significant","silent","simpler","simplest","simplified","sincere","skilled","skillful","sleek","slick","smart","smarter","smartest","smelly","smiling","smitten","smooth","smoother","smoothest","snappy","snazzy","sociable","soft","softer","solid","soulful","spacious","sparkling","spectacular","speedy","spellbinding","spellbound","spirited","spiritual","splendid","spontaneous","sporty","spotless","sprightly","stable","stainless","stately","statuesque","staunch","steadfast","steadiest","steady","stellar","stimulating","stimulative","streamlined","striking","strong","stronger","strongest","stunned","stunning","stupendous","sturdier","sturdy","stylish","stylized","suave","sublime","subsidized","substantive","succeeding","successful","sufficient","suitable","sumptuous","super","superb","superior","supple","supportive","supreme","surreal","sustainable","swankier","swankiest","swanky","sweeping","sweet","sweetheart","swift","talented","tantalizing","tempting","tenacious","tender","terrific","thankful","thinner","thoughtful","thrifty","thrilled","thrilling","thriving","tidy","timely","titillating","tolerable","top","topnotch","tough","tougher","toughest","tranquil","transparent","trendy","triumphal","triumphant","trusted","trusting","trustworthy","trusty","truthful","twinkly","unabashed","unaffected","unassailable","unbeatable","unbiased","unbound","undamaged","undaunted","undisputable","undisputed","unencumbered","unequivocal","unfettered","unlimited","unmatched","unparalleled","unreal","unrestricted","unrivaled","unselfish","unwavering","upbeat","upscale","usable","useful","valiant","valuable","verifiable","veritable","versatile","vibrant","victorious","viewable","vigilant","virtuous","visionary","vivacious","vivid","warm","warmer","warmhearted","wealthy","welcome","wholesome","wieldy","winning","wise","witty","wonderful","wondrous","workable","worth","worthwhile","worthy","young","youthful","zippy"],animals:["aardvark","albatross","alligator","angelfish","angora","ant","anteater","antelope","armadillo","avocet","baboon","badger","bandicoot","barnacle","barracuda","bat","beagle","bear","beaver","bee","beetle","bird","bison","bloodhound","boar","bobcat","bonobo","buffalo","bulldog","bullfrog","butterfly","buzzard","camel","cat","caterpillar","catfish","cattle","centipede","chameleon","cheetah","chicken","chihuahua","chimpanzee","chin","chinchilla","chipmunk","civet","clam","cockroach","coon","coral","corgi","cougar","cow","coyote","crab","crane","cuttlefish","dachshund","dalmatian","dane","deer","devil","dingo","dodo","dog","dogfish","dollar","dolphin","donkey","dormouse","dragon","dragonfly","duck","dugong","eagle","earwig","eel","elephant","emperor","emu","falcon","ferret","fish","flamingo","flounder","fly","forest","fowl","fox","foxhound","frog","gar","gecko","gerbil","gharial","gibbon","giraffe","goat","goose","gopher","gorilla","grasshopper","greyhound","grouse","guppy","hamster","hare","hedgehog","heron","hippopotamus","hornet","horse","hound","hummingbird","husky","hyena","hyrax","ibis","iguana","impala","insect","jackal","jaguar","jellyfish","kangaroo","kingfisher","kiwi","koala","kudu","labradoodle","ladybird","lemming","lemur","leopard","liger","lion","lionfish","lizard","llama","lobster","lynx","macaque","macaw","magpie","malamute","maltese","mammoth","manatee","mandrill","markhor","marmoset","mastiff","mayfly","meerkat","millipede","mole","mongoose","monkey","monster","moorhen","moose","moth","mouse","mule","newt","nightingale","ocelot","octopus","okapi","orangutan","ostrich","otter","owl","oyster","panda","panther","parrot","peacock","pelican","penguin","pheasant","pig","pike","piranha","platypus","pointer","poodle","porcupine","possum","prawn","puffin","pug","puma","quail","rabbit","raccoon","rat","rattlesnake","ray","reindeer","retriever","rhinoceros","robin","rottweiler","russel","salamander","scorpion","seahorse","seal","shark","sheep","sheepdog","shrew","shrimp","skater","skunk","sloth","slug","snail","snake","snowshoe","spaniel","sparrow","spider","sponge","squid","squirrel","squirt","starfish","stingray","stoat","swan","tapir","tarantula","termite","terrier","tiger","toad","tortoise","toucan","tuatara","turkey","turtle","uakari","urchin","vole","vulture","wallaby","walrus","warthog","wasp","weasel","whale","whippet","wildebeest","wolf","wolfhound","wolverine","wombat","woodlouse","woodpecker","worm","yak","zebra","zebu","zonkey","zorse"]},Zb=e=>e.charAt(0).toUpperCase()+e.slice(1),yf=e=>{const n=e.length*2/3,t=e.substring(0,n),i=e.substring(n),r=Zb(bf.adjectives[parseInt(t,16)%bf.adjectives.length]),a=Zb(bf.animals[parseInt(i,16)%bf.animals.length]);return`${r} ${a}`};const Qb=l.forwardRef(({identity:e,presence:n,onClick:t,classNames:i,...r},a)=>{var d,u,h,v,m;const o=vm(e.identityKey),s=On("identityListItem__label"),f=((d=e.profile)==null?void 0:d.displayName)??yf(e.identityKey.toHex());return l.createElement(Zd.Root,{...r,classNames:le("flex gap-2 pis-3 pie-1 items-center",t&&"cursor-pointer",i),onClick:()=>t==null?void 0:t(),"data-testid":"identity-list-item",labelId:s,ref:a},l.createElement(Dn.Root,{status:n===Wo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:s,hue:((h=(u=e.profile)==null?void 0:u.data)==null?void 0:h.hue)||o.hue},l.createElement(Dn.Frame,{classNames:"place-self-center"},l.createElement(Dn.Fallback,{text:((m=(v=e.profile)==null?void 0:v.data)==null?void 0:m.emoji)||o.emoji})),l.createElement(Dn.Label,{classNames:"text-sm truncate pli-2"},f)))}),yN=({devices:e,onSelect:n})=>{const{t}=fn("os");return e.length>0?l.createElement(Xd,{classNames:"flex flex-col gap-2"},e.map(i=>{var s,f;const r=((s=i.profile)==null?void 0:s.type)||Yi.DeviceType.UNKNOWN,a=(f=i.profile)!=null&&f.label?`${i.profile.label} (${Yi.DeviceType[r]})`:yf(i.deviceKey.toHex()),o={identityKey:i.deviceKey,profile:{displayName:a}};return l.createElement(Qb,{key:i.deviceKey.toHex(),identity:o,presence:i.presence,onClick:n&&(()=>n(i))})})):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(Nn,"text-center is-full")},t("empty device list message")))},wN=({spaceKey:e,includeSelf:n,onSelect:t})=>{const i=Ye.useClient(),r=Wo.useMembers(e),a=l.useMemo(()=>n?r.sort(o=>o.identity.identityKey.equals(i.halo.identity.get().identityKey)?-1:1):r.filter(o=>!o.identity.identityKey.equals(i.halo.identity.get().identityKey)),[r]);return l.createElement(_N,{members:a,onSelect:t})},_N=({members:e,onSelect:n})=>{const{t}=fn("os"),i=e.filter(r=>r.identity);return i.length>0?l.createElement(Xd,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},i.map(r=>l.createElement(Qb,{key:r.identity.identityKey.toHex(),identity:r.identity,presence:r.presence,onClick:n&&(()=>n(r))}))):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(Nn,"text-center is-full mlb-2")},t("empty space members message")))},wf=43200,ey=1440;function ny(e){const n=zn(e),t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+e-+t}function _f(e,n){const t=zn(e),i=zn(n),r=t.getTime()-i.getTime();return r<0?-1:r>0?1:r}function kN(e,n){const t=zn(e),i=zn(n),r=t.getFullYear()-i.getFullYear(),a=t.getMonth()-i.getMonth();return r*12+a}function xN(e){return n=>{const i=(e?Math[e]:Math.trunc)(n);return i===0?0:i}}function EN(e,n){return+zn(e)-+zn(n)}function SN(e){const n=zn(e);return n.setHours(23,59,59,999),n}function CN(e){const n=zn(e),t=n.getMonth();return n.setFullYear(n.getFullYear(),t+1,0),n.setHours(23,59,59,999),n}function $N(e){const n=zn(e);return+SN(n)==+CN(n)}function AN(e,n){const t=zn(e),i=zn(n),r=_f(t,i),a=Math.abs(kN(t,i));let o;if(a<1)o=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-r*a);let s=_f(t,i)===-r;$N(zn(e))&&a===1&&_f(e,i)===1&&(s=!1),o=r*(a-Number(s))}return o===0?0:o}function TN(e,n,t){const i=EN(e,n)/1e3;return xN(t==null?void 0:t.roundingMethod)(i)}function ON(e,n,t){const i=y2(),r=(t==null?void 0:t.locale)??i.locale??Ph,a=2520,o=_f(e,n);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o});let f,d;o>0?(f=zn(n),d=zn(e)):(f=zn(e),d=zn(n));const u=TN(d,f),h=(ny(d)-ny(f))/1e3,v=Math.round((u-h)/60);let m;if(v<2)return t!=null&&t.includeSeconds?u<5?r.formatDistance("lessThanXSeconds",5,s):u<10?r.formatDistance("lessThanXSeconds",10,s):u<20?r.formatDistance("lessThanXSeconds",20,s):u<40?r.formatDistance("halfAMinute",0,s):u<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):v===0?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",v,s);if(v<45)return r.formatDistance("xMinutes",v,s);if(v<90)return r.formatDistance("aboutXHours",1,s);if(v<ey){const g=Math.round(v/60);return r.formatDistance("aboutXHours",g,s)}else{if(v<a)return r.formatDistance("xDays",1,s);if(v<wf){const g=Math.round(v/ey);return r.formatDistance("xDays",g,s)}else if(v<wf*2)return m=Math.round(v/wf),r.formatDistance("aboutXMonths",m,s)}if(m=AN(d,f),m<12){const g=Math.round(v/wf);return r.formatDistance("xMonths",g,s)}else{const g=m%12,b=Math.trunc(m/12);return g<3?r.formatDistance("aboutXYears",b,s):g<9?r.formatDistance("overXYears",b,s):r.formatDistance("almostXYears",b+1,s)}}function PN(e,n){return ON(e,Date.now(),n)}var ty;(function(e){e[e.ACTIVE=0]="ACTIVE",e[e.INACTIVE=1]="INACTIVE"})(ty||(ty={}));var iy;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.TRUNCATE=1]="TRUNCATE",n[n.HUMANIZE=2]="HUMANIZE"})(e.KEY_OPTION||(e.KEY_OPTION={}))})(iy||(iy={}));var ry;(function(e){(function(n){n[n.BROWSER=0]="BROWSER",n[n.SHARED_WORKER=1]="SHARED_WORKER",n[n.NODE=2]="NODE"})(e.PLATFORM_TYPE||(e.PLATFORM_TYPE={}))})(ry||(ry={}));var ay;(function(e){e[e.CURRENT=0]="CURRENT",e[e.TRUSTED=1]="TRUSTED"})(ay||(ay={}));var oy;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(oy||(oy={}));var sy;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(sy||(sy={}));var fy;(function(e){e[e.INACTIVE=2]="INACTIVE",e[e.ACTIVE=6]="ACTIVE",e[e.CLOSED=1]="CLOSED",e[e.CONTROL_ONLY=7]="CONTROL_ONLY",e[e.INITIALIZING=4]="INITIALIZING",e[e.READY=3]="READY",e[e.ERROR=5]="ERROR"})(fy||(fy={}));var ly;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",n[n.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",n[n.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT"})(e.Migration||(e.Migration={}))})(ly||(ly={}));var _e;(function(e){(function(n){n[n.INTERACTIVE=0]="INTERACTIVE",n[n.OFFLINE=1]="OFFLINE",n[n.MULTIUSE=2]="MULTIUSE"})(e.Type||(e.Type={})),function(n){n[n.DEVICE=0]="DEVICE",n[n.SPACE=1]="SPACE"}(e.Kind||(e.Kind={})),function(n){n[n.NONE=0]="NONE",n[n.SHARED_SECRET=1]="SHARED_SECRET"}(e.AuthMethod||(e.AuthMethod={})),function(n){n[n.INIT=0]="INIT",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",n[n.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",n[n.AUTHENTICATING=4]="AUTHENTICATING",n[n.SUCCESS=5]="SUCCESS",n[n.CANCELLED=6]="CANCELLED",n[n.TIMEOUT=7]="TIMEOUT",n[n.ERROR=8]="ERROR",n[n.EXPIRED=9]="EXPIRED"}(e.State||(e.State={}))})(_e||(_e={}));var dy;(function(e){(function(n){n[n.ADDED=0]="ADDED",n[n.REMOVED=1]="REMOVED",n[n.SAVED=2]="SAVED",n[n.LOAD_COMPLETE=3]="LOAD_COMPLETE"})(e.Action||(e.Action={})),function(n){n[n.CREATED=0]="CREATED",n[n.ACCEPTED=1]="ACCEPTED"}(e.Type||(e.Type={}))})(dy||(dy={}));var uy;(function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE"})(uy||(uy={}));var cy;(function(e){e[e.TRACE=5]="TRACE",e[e.DEBUG=10]="DEBUG",e[e.INFO=11]="INFO",e[e.WARN=12]="WARN",e[e.ERROR=13]="ERROR"})(cy||(cy={}));var hy;(function(e){(function(n){n[n.INCLUSIVE=1]="INCLUSIVE",n[n.EXPLICIT=2]="EXPLICIT"})(e.MatchingOptions||(e.MatchingOptions={}))})(hy||(hy={}));var IN=class extends Error{constructor(){super("Context disposed.")}};function FN(e,n,t,i){var r=arguments.length,a=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,t,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(n,t,a):o(n,t))||a);return r>3&&a&&Object.defineProperty(n,t,a),a}var Hu="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MN=300,vy=class I_{constructor({onError:n=r=>{if(!(r instanceof IN))throw this.dispose(),r},attributes:t={},parent:i}={}){this._disposeCallbacks=[],this._isDisposed=!1,this._disposePromise=void 0,this._parent=null,this.maxSafeDisposeCallbacks=MN,this._onError=n,this._attributes=t,i!==void 0&&(this._parent=i)}get disposed(){return this._isDisposed}get disposeCallbacksLength(){return this._disposeCallbacks.length}onDispose(n){return this._isDisposed&&(async()=>{try{await n()}catch(t){We.catch(t,void 0,{F:Hu,L:82,S:this,C:(i,r)=>i(...r)})}})(),this._disposeCallbacks.push(n),this._disposeCallbacks.length>this.maxSafeDisposeCallbacks&&We.warn("Context has a large number of dispose callbacks. This might be a memory leak.",{count:this._disposeCallbacks.length,safeThreshold:this.maxSafeDisposeCallbacks},{F:Hu,L:89,S:this,C:(t,i)=>t(...i)}),()=>{const t=this._disposeCallbacks.indexOf(n);t!==-1&&this._disposeCallbacks.splice(t,1)}}dispose(){if(this._disposePromise)return this._disposePromise;this._isDisposed=!0;let n;this._disposePromise=new Promise(r=>{n=r});const t=[],i=Array.from(this._disposeCallbacks).reverse();for(const r of i)t.push((async()=>{try{await r()}catch(a){We.catch(a,void 0,{F:Hu,L:132,S:this,C:(o,s)=>o(...s)})}})());return this._disposeCallbacks.length=0,Promise.all(t).then(()=>{n()}),this._disposePromise}raise(n){if(!this._isDisposed)try{this._onError(n)}catch(t){Promise.reject(t)}}derive({onError:n,attributes:t}={}){const i=new I_({onError:async a=>{if(!n)this.raise(a);else try{await n(a)}catch{this.raise(a)}},attributes:t}),r=this.onDispose(()=>i.dispose());return i.onDispose(r),i}getAttribute(n){if(n in this._attributes)return this._attributes[n];if(this._parent!==null)return this._parent.getAttribute(n)}};vy=FN([_S("Context")],vy);var kf={};Object.defineProperty(kf,"__esModule",{value:!0}),kf.Observable=void 0;const py=e=>!!Symbol[e],Vu=e=>py(e)?Symbol[e]:"@@"+e,NN=Vu("iterator"),qu=Vu("observable"),my=Vu("species");function xf(e,n){let t=e[n];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function vo(e){let n=e.constructor;return n!==void 0&&(n=n[my],n===null&&(n=void 0)),n!==void 0?n:Sf}function DN(e){return e instanceof Sf}function fa(e){fa.log?fa.log(e):setTimeout(()=>{throw e})}function Ef(e){Promise.resolve().then(()=>{try{e()}catch(n){fa(n)}})}function gy(e){let n=e._cleanup;if(n!==void 0&&(e._cleanup=void 0,!!n))try{if(typeof n=="function")n();else{let t=xf(n,"unsubscribe");t&&t.call(n)}}catch(t){fa(t)}}function Gu(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function LN(e){let n=e._queue;if(n){e._queue=void 0,e._state="ready";for(let t=0;t<n.length&&(by(e,n[t].type,n[t].value),e._state!=="closed");++t);}}function by(e,n,t){e._state="running";let i=e._observer;try{let r=xf(i,n);switch(n){case"next":r&&r.call(i,t);break;case"error":if(Gu(e),r)r.call(i,t);else throw t;break;case"complete":Gu(e),r&&r.call(i);break}}catch(r){fa(r)}e._state==="closed"?gy(e):e._state==="running"&&(e._state="ready")}function Ku(e,n,t){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:n,value:t});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:n,value:t}],Ef(()=>LN(e));return}by(e,n,t)}}class BN{constructor(n,t){this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";let i=this,r={get closed(){return i._state==="closed"},next(a){Ku(i,"next",a)},error(a){Ku(i,"error",a)},complete(){Ku(i,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(a){r.error(a)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Gu(this),gy(this))}}let Sf=class cl{constructor(n){if(!(this instanceof cl))throw new TypeError("Observable cannot be called as a function");if(typeof n!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=n}subscribe(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new BN(n,this._subscriber)}forEach(n){return new Promise((t,i)=>{if(typeof n!="function"){i(new TypeError(n+" is not a function"));return}function r(){a.unsubscribe(),t()}let a=this.subscribe({next(o){try{n(o,r)}catch(s){i(s),a.unsubscribe()}},error:i,complete:t})})}map(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>this.subscribe({next(r){try{r=n(r)}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}filter(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>this.subscribe({next(r){try{if(!n(r))return}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}reduce(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this),i=arguments.length>1,r=!1,o=arguments[1];return new t(s=>this.subscribe({next(f){let d=!r;if(r=!0,!d||i)try{o=n(o,f)}catch(u){return s.error(u)}else o=f},error(f){s.error(f)},complete(){if(!r&&!i)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(o),s.complete()}}))}async all(){let n=[];return await this.forEach(t=>n.push(t)),n}concat(...n){let t=vo(this);return new t(i=>{let r,a=0;function o(s){r=s.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){a===n.length?(r=void 0,i.complete()):o(t.from(n[a++]))}})}return o(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=vo(this);return new t(i=>{let r=[],a=this.subscribe({next(s){if(n)try{s=n(s)}catch(d){return i.error(d)}let f=t.from(s).subscribe({next(d){i.next(d)},error(d){i.error(d)},complete(){let d=r.indexOf(f);d>=0&&r.splice(d,1),o()}});r.push(f)},error(s){i.error(s)},complete(){o()}});function o(){a.closed&&r.length===0&&i.complete()}return()=>{r.forEach(s=>s.unsubscribe()),a.unsubscribe()}})}[qu](){return this}static from(n){let t=typeof this=="function"?this:cl;if(n==null)throw new TypeError(n+" is not an object");let i=xf(n,qu);if(i){let r=i.call(n);if(Object(r)!==r)throw new TypeError(r+" is not an object");return DN(r)&&r.constructor===t?r:new t(a=>r.subscribe(a))}if(py("iterator")&&(i=xf(n,NN),i))return new t(r=>{Ef(()=>{if(!r.closed){for(let a of i.call(n))if(r.next(a),r.closed)return;r.complete()}})});if(Array.isArray(n))return new t(r=>{Ef(()=>{if(!r.closed){for(let a=0;a<n.length;++a)if(r.next(n[a]),r.closed)return;r.complete()}})});throw new TypeError(n+" is not observable")}static of(...n){let t=typeof this=="function"?this:cl;return new t(i=>{Ef(()=>{if(!i.closed){for(let r=0;r<n.length;++r)if(i.next(n[r]),i.closed)return;i.complete()}})})}static get[my](){return this}};kf.Observable=Sf,Object.defineProperty(Sf,Symbol("extensions"),{value:{symbol:qu,hostReportError:fa},configurable:!0});var jN=kf.Observable;const Cf=Er(jN);var yy={exports:{}},Yu={exports:{}},la=typeof Reflect=="object"?Reflect:null,wy=la&&typeof la.apply=="function"?la.apply:function(n,t,i){return Function.prototype.apply.call(n,t,i)},$f;la&&typeof la.ownKeys=="function"?$f=la.ownKeys:Object.getOwnPropertySymbols?$f=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:$f=function(n){return Object.getOwnPropertyNames(n)};function RN(e){console&&console.warn&&console.warn(e)}var _y=Number.isNaN||function(n){return n!==n};function mn(){mn.init.call(this)}Yu.exports=mn,Yu.exports.once=HN,mn.EventEmitter=mn,mn.prototype._events=void 0,mn.prototype._eventsCount=0,mn.prototype._maxListeners=void 0;var ky=10;function Af(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(mn,"defaultMaxListeners",{enumerable:!0,get:function(){return ky},set:function(e){if(typeof e!="number"||e<0||_y(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");ky=e}}),mn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},mn.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||_y(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function xy(e){return e._maxListeners===void 0?mn.defaultMaxListeners:e._maxListeners}mn.prototype.getMaxListeners=function(){return xy(this)},mn.prototype.emit=function(n){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=n==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var f=a[n];if(f===void 0)return!1;if(typeof f=="function")wy(f,this,t);else for(var d=f.length,u=Ay(f,d),i=0;i<d;++i)wy(u[i],this,t);return!0};function Ey(e,n,t,i){var r,a,o;if(Af(t),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",n,t.listener?t.listener:t),a=e._events),o=a[n]),o===void 0)o=a[n]=t,++e._eventsCount;else if(typeof o=="function"?o=a[n]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),r=xy(e),r>0&&o.length>r&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=n,s.count=o.length,RN(s)}return e}mn.prototype.addListener=function(n,t){return Ey(this,n,t,!1)},mn.prototype.on=mn.prototype.addListener,mn.prototype.prependListener=function(n,t){return Ey(this,n,t,!0)};function UN(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Sy(e,n,t){var i={fired:!1,wrapFn:void 0,target:e,type:n,listener:t},r=UN.bind(i);return r.listener=t,i.wrapFn=r,r}mn.prototype.once=function(n,t){return Af(t),this.on(n,Sy(this,n,t)),this},mn.prototype.prependOnceListener=function(n,t){return Af(t),this.prependListener(n,Sy(this,n,t)),this},mn.prototype.removeListener=function(n,t){var i,r,a,o,s;if(Af(t),r=this._events,r===void 0)return this;if(i=r[n],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[n],r.removeListener&&this.emit("removeListener",n,i.listener||t));else if(typeof i!="function"){for(a=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,a=o;break}if(a<0)return this;a===0?i.shift():zN(i,a),i.length===1&&(r[n]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",n,s||t)}return this},mn.prototype.off=mn.prototype.removeListener,mn.prototype.removeAllListeners=function(n){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[n]),this;if(arguments.length===0){var a=Object.keys(i),o;for(r=0;r<a.length;++r)o=a[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[n],typeof t=="function")this.removeListener(n,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(n,t[r]);return this};function Cy(e,n,t){var i=e._events;if(i===void 0)return[];var r=i[n];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?WN(r):Ay(r,r.length)}mn.prototype.listeners=function(n){return Cy(this,n,!0)},mn.prototype.rawListeners=function(n){return Cy(this,n,!1)},mn.listenerCount=function(e,n){return typeof e.listenerCount=="function"?e.listenerCount(n):$y.call(e,n)},mn.prototype.listenerCount=$y;function $y(e){var n=this._events;if(n!==void 0){var t=n[e];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}mn.prototype.eventNames=function(){return this._eventsCount>0?$f(this._events):[]};function Ay(e,n){for(var t=new Array(n),i=0;i<n;++i)t[i]=e[i];return t}function zN(e,n){for(;n+1<e.length;n++)e[n]=e[n+1];e.pop()}function WN(e){for(var n=new Array(e.length),t=0;t<n.length;++t)n[t]=e[t].listener||e[t];return n}function HN(e,n){return new Promise(function(t,i){function r(o){e.removeListener(n,a),i(o)}function a(){typeof e.removeListener=="function"&&e.removeListener("error",r),t([].slice.call(arguments))}Ty(e,n,a,{once:!0}),n!=="error"&&VN(e,r,{once:!0})})}function VN(e,n,t){typeof e.on=="function"&&Ty(e,"error",n,t)}function Ty(e,n,t,i){if(typeof e.on=="function")i.once?e.once(n,t):e.on(n,t);else if(typeof e.addEventListener=="function")e.addEventListener(n,function r(a){i.once&&e.removeEventListener(n,r),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Oy=Yu.exports,Py=Oy.EventEmitter,po={},Tf={};Tf.byteLength=KN,Tf.toByteArray=JN,Tf.fromByteArray=QN;for(var Zt=[],kt=[],qN=typeof Uint8Array<"u"?Uint8Array:Array,Ju="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",da=0,GN=Ju.length;da<GN;++da)Zt[da]=Ju[da],kt[Ju.charCodeAt(da)]=da;kt[45]=62,kt[95]=63;function Iy(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=n);var i=t===n?0:4-t%4;return[t,i]}function KN(e){var n=Iy(e),t=n[0],i=n[1];return(t+i)*3/4-i}function YN(e,n,t){return(n+t)*3/4-t}function JN(e){var n,t=Iy(e),i=t[0],r=t[1],a=new qN(YN(e,i,r)),o=0,s=r>0?i-4:i,f;for(f=0;f<s;f+=4)n=kt[e.charCodeAt(f)]<<18|kt[e.charCodeAt(f+1)]<<12|kt[e.charCodeAt(f+2)]<<6|kt[e.charCodeAt(f+3)],a[o++]=n>>16&255,a[o++]=n>>8&255,a[o++]=n&255;return r===2&&(n=kt[e.charCodeAt(f)]<<2|kt[e.charCodeAt(f+1)]>>4,a[o++]=n&255),r===1&&(n=kt[e.charCodeAt(f)]<<10|kt[e.charCodeAt(f+1)]<<4|kt[e.charCodeAt(f+2)]>>2,a[o++]=n>>8&255,a[o++]=n&255),a}function XN(e){return Zt[e>>18&63]+Zt[e>>12&63]+Zt[e>>6&63]+Zt[e&63]}function ZN(e,n,t){for(var i,r=[],a=n;a<t;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),r.push(XN(i));return r.join("")}function QN(e){for(var n,t=e.length,i=t%3,r=[],a=16383,o=0,s=t-i;o<s;o+=a)r.push(ZN(e,o,o+a>s?s:o+a));return i===1?(n=e[t-1],r.push(Zt[n>>2]+Zt[n<<4&63]+"==")):i===2&&(n=(e[t-2]<<8)+e[t-1],r.push(Zt[n>>10]+Zt[n>>4&63]+Zt[n<<2&63]+"=")),r.join("")}var Xu={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Xu.read=function(e,n,t,i,r){var a,o,s=r*8-i-1,f=(1<<s)-1,d=f>>1,u=-7,h=t?r-1:0,v=t?-1:1,m=e[n+h];for(h+=v,a=m&(1<<-u)-1,m>>=-u,u+=s;u>0;a=a*256+e[n+h],h+=v,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=i;u>0;o=o*256+e[n+h],h+=v,u-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-d}return(m?-1:1)*o*Math.pow(2,a-i)},Xu.write=function(e,n,t,i,r,a){var o,s,f,d=a*8-r-1,u=(1<<d)-1,h=u>>1,v=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:a-1,g=i?1:-1,b=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(s=isNaN(n)?1:0,o=u):(o=Math.floor(Math.log(n)/Math.LN2),n*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+h>=1?n+=v/f:n+=v*Math.pow(2,1-h),n*f>=2&&(o++,f/=2),o+h>=u?(s=0,o=u):o+h>=1?(s=(n*f-1)*Math.pow(2,r),o=o+h):(s=n*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;e[t+m]=s&255,m+=g,s/=256,r-=8);for(o=o<<r|s,d+=r;d>0;e[t+m]=o&255,m+=g,o/=256,d-=8);e[t+m-g]|=b*128};/*!
831
831
  * The buffer module from node.js, for the browser.
832
832
  *
833
833
  * @author Feross Aboukhadijeh <https://feross.org>