@dxos/shell 0.6.12-main.7907542 → 0.6.12-main.c1d977f
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/bundle/shell.mjs +10 -10
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +1 -1
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/package.json +24 -24
package/dist/bundle/shell.umd.js
CHANGED
|
@@ -918,7 +918,7 @@ button {
|
|
|
918
918
|
background-color: #61493f;
|
|
919
919
|
}
|
|
920
920
|
|
|
921
|
-
`;function $e5534fc185f7111e$export$2e2bcd8739ae039($){const _=React.useRef(null),I=React.useRef(null);return I.current&&I.current.update($),React.useEffect(()=>(I.current=new $efa000751917694d$export$2e2bcd8739ae039({...$,ref:_}),()=>{I.current=null}),[]),React.createElement("div",{ref:_})}const EmojiPickerToolbarButton=({disabled:$,defaultEmoji:_,emoji:I,onChangeEmoji:j,classNames:U})=>{const{t:q}=useTranslation("os"),{themeMode:G}=useThemeContext(),[K,J]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:I,onChange:j,defaultProp:_}),[Y,X]=React.useState(!1),Z=React.useRef(!1),[Q,ee]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Q,onOpenChange:ne=>{Z.current?(ee(!1),Z.current=!1):ee(ne)}},React.createElement(Popover.Root,{open:Y,onOpenChange:ne=>{X(ne),Z.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Popover.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:["gap-2 text-2xl plb-1",U],disabled:$},React.createElement("span",{className:"sr-only"},q("select emoji label")),React.createElement(react.UserCircle,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select emoji label"),React.createElement(Tooltip.Arrow,null))),React.createElement(Popover.Content,{side:"bottom",onKeyDownCapture:ne=>{ne.key==="Escape"&&(ne.stopPropagation(),X(!1),Z.current=!0)}},React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039,{data:emojiData,onEmojiSelect:({native:ne})=>{ne&&(J(ne),X(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0,theme:G}),React.createElement(Popover.Arrow,null))))},HuePreview=({hue:$})=>{const{tx:_}=useThemeContext(),I=20;return React.createElement("svg",{width:I,height:I,viewBox:`0 0 ${I} ${I}`},React.createElement("rect",{x:0,y:0,width:I,height:I,className:_("hue.fill","select--hue__preview",{hue:$})}))},hueTokens=Object.keys(hueTokenThemes).slice(0,16),HuePickerToolbarButton=({disabled:$,hue:_,onChangeHue:I,classNames:j,defaultHue:U})=>{const{t:q}=useTranslation("os"),[G,K]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:_,onChange:I,defaultProp:U}),[J,Y]=React.useState(!1),X=React.useRef(!1),[Z,Q]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Z,onOpenChange:ee=>{X.current?(Q(!1),X.current=!1):Q(ee)}},React.createElement(DropdownMenu2.Root,{modal:!1,open:J,onOpenChange:ee=>{Y(ee),X.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:mx("gap-2 plb-1",j),disabled:$},React.createElement("span",{className:"sr-only"},q("select hue label")),React.createElement(react.Palette,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select hue label"),React.createElement(Tooltip.Arrow,null))),React.createElement(DropdownMenu2.Content,{side:"bottom",classNames:"!w-40"},React.createElement(DropdownMenu2.Viewport,{classNames:"grid grid-cols-4"},hueTokens.map(ee=>React.createElement(DropdownMenu2.CheckboxItem,{key:ee,checked:ee===G,onCheckedChange:()=>K(ee),classNames:"px-0 py-2 items-center justify-center"},React.createElement(HuePreview,{hue:ee})))))))};var data={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"]},capitalize=$=>$.charAt(0).toUpperCase()+$.slice(1),generateName=$=>{const _=$.length*2/3,I=$.substring(0,_),j=$.substring(_),U=capitalize(data.adjectives[parseInt(I,16)%data.adjectives.length]),q=capitalize(data.animals[parseInt(j,16)%data.animals.length]);return`${U} ${q}`};const IdentityListItem=React.forwardRef(({identity:$,presence:_,onClick:I,classNames:j,...U},q)=>{var Y,X,Z,Q,ee;const G=keyToFallback($.identityKey),K=useId$1("identityListItem__label"),J=((Y=$.profile)==null?void 0:Y.displayName)??generateName($.identityKey.toHex());return React.createElement(ListItem.Root,{...U,classNames:mx("flex gap-2 pis-3 pie-1 items-center",I&&"cursor-pointer",j),onClick:()=>I==null?void 0:I(),"data-testid":"identity-list-item",labelId:K,ref:q},React.createElement(Avatar.Root,{status:_===echo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:K,hue:((Z=(X=$.profile)==null?void 0:X.data)==null?void 0:Z.hue)||G.hue},React.createElement(Avatar.Frame,{classNames:"place-self-center"},React.createElement(Avatar.Fallback,{text:((ee=(Q=$.profile)==null?void 0:Q.data)==null?void 0:ee.emoji)||G.emoji})),React.createElement(Avatar.Label,{classNames:"text-sm truncate pli-2"},J)))}),SpaceMemberList=({spaceKey:$,includeSelf:_,onSelect:I})=>{const j=reactClient.useClient(),U=echo.useMembers($),q=React.useMemo(()=>_?U.sort(G=>G.identity.identityKey.equals(j.halo.identity.get().identityKey)?-1:1):U.filter(G=>!G.identity.identityKey.equals(j.halo.identity.get().identityKey)),[U]);return React.createElement(SpaceMemberListImpl,{members:q,onSelect:I})},SpaceMemberListImpl=({members:$,onSelect:_})=>{const{t:I}=useTranslation("os"),j=$.filter(U=>U.identity);return j.length>0?React.createElement(List,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},j.map(U=>React.createElement(IdentityListItem,{key:U.identity.identityKey.toHex(),identity:U.identity,presence:U.presence,onClick:_&&(()=>_(U))}))):React.createElement("div",{role:"none",className:"grow flex items-center p-2"},React.createElement("p",{className:mx(descriptionText,"text-center is-full mlb-2")},I("empty space members message")))},iconProps={weight:"duotone",width:24,height:24,x:8,y:8},DeviceListItem=React.forwardRef(({device:$,onClickAdd:_,onClickEdit:I,onClickReset:j,onClickJoinExisting:U,classNames:q,connectionState:G,onAgentDestroy:K,...J},Y)=>{var re,ae;const{t:X}=useTranslation("os"),Z=keyToFallback($.deviceKey),Q=useId$1("identityListItem__label"),ee=$.profile?X("device name placeholder",{os:$.profile.os,platform:$.profile.platform}):generateName($.deviceKey.toHex()),ne=$.kind===halo.DeviceKind.CURRENT;return React.createElement(ListItem.Root,{...J,classNames:["flex gap-2 items-center mlb-2",q],"data-testid":`device-list-item${ne?"-current":""}`,labelId:Q,ref:Y},React.createElement(Avatar.Root,{status:ne&&G===mesh.ConnectionState.OFFLINE?"error":$.presence===halo.Device.PresenceState.ONLINE?"active":"inactive",labelId:Q,hue:Z.hue,variant:"square"},React.createElement(Avatar.Frame,{classNames:"place-self-center"},(re=$.profile)!=null&&re.type?$.profile.type===halo.DeviceType.AGENT_MANAGED?React.createElement(react.Database,{...iconProps}):$.profile.type===halo.DeviceType.BROWSER?React.createElement(react.Compass,{...iconProps}):$.profile.type===halo.DeviceType.NATIVE?React.createElement(react.Desktop,{...iconProps}):[halo.DeviceType.AGENT,halo.DeviceType.AGENT_MANAGED].includes($.profile.type)?React.createElement(react.Robot,{...iconProps}):$.profile.type===halo.DeviceType.MOBILE?React.createElement(react.DeviceMobile,{...iconProps}):React.createElement(react.Devices,{...iconProps}):React.createElement(Avatar.Fallback,{text:Z.emoji})),React.createElement(Avatar.Label,{classNames:"flex-1 text-sm truncate"},ee),ne&&React.createElement(Tag,{color:"primary"},X("current device tag label")),((ae=$.profile)==null?void 0:ae.type)===halo.DeviceType.AGENT_MANAGED?React.createElement(Tooltip.Root,null,React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":"agent.destroy",onClick:K},React.createElement("span",{className:"sr-only"},X("destroy agent label")),React.createElement(react.Power,{className:getSize(5)}))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},X("destroy agent label")))):$.kind===halo.DeviceKind.CURRENT&&React.createElement(DropdownMenu2.Root,null,React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${ne?"-current":""}.options`},React.createElement("span",{className:"sr-only"},X("more options label")),React.createElement(react.DotsThree,{className:getSize(5)}))),React.createElement(DropdownMenu2.Content,null,React.createElement(DropdownMenu2.Viewport,null,React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.join-existing",onClick:U},React.createElement(react.ShareFat,{className:getSize(5)}),X("choose join new identity label")),React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.reset",onClick:j},React.createElement(react.Power,{className:getSize(5)}),X("reset device label")))))))}),DeviceList=({devices:$,connectionState:_,onClickAdd:I,onClickEdit:j,onClickReset:U,onClickJoinExisting:q,onAgentDestroy:G})=>{const{t:K}=useTranslation("os");return React.createElement(React.Fragment,null,React.createElement("h2",{className:mx(descriptionText,"text-center mbs-4")},K("devices heading")),$.length>0&&React.createElement(List,null,$.map(J=>React.createElement(DeviceListItem,{key:J.deviceKey.toHex(),device:J,onClickEdit:()=>j==null?void 0:j(J),onClickReset:U,onClickJoinExisting:q,connectionState:_,onAgentDestroy:G}))),React.createElement(Button,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3 is-full","data-testid":"devices-panel.create-invitation",onClick:I},React.createElement("div",{role:"img",className:mx(getSize(8),"m-1 rounded-sm bg-input grid place-items-center")},React.createElement(react.Plus,{weight:"light",className:getSize(6)})),React.createElement("span",{className:"grow font-medium text-start"},K("choose add device label")),React.createElement(react.CaretRight,{weight:"bold",className:getSize(4)})))},minutesInMonth=43200,minutesInDay=1440;function getTimezoneOffsetInMilliseconds($){const _=toDate($),I=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()));return I.setUTCFullYear(_.getFullYear()),+$-+I}function compareAsc($,_){const I=toDate($),j=toDate(_),U=I.getTime()-j.getTime();return U<0?-1:U>0?1:U}function differenceInCalendarMonths($,_){const I=toDate($),j=toDate(_),U=I.getFullYear()-j.getFullYear(),q=I.getMonth()-j.getMonth();return U*12+q}function getRoundingMethod($){return _=>{const j=($?Math[$]:Math.trunc)(_);return j===0?0:j}}function differenceInMilliseconds($,_){return+toDate($)-+toDate(_)}function endOfDay($){const _=toDate($);return _.setHours(23,59,59,999),_}function endOfMonth($){const _=toDate($),I=_.getMonth();return _.setFullYear(_.getFullYear(),I+1,0),_.setHours(23,59,59,999),_}function isLastDayOfMonth($){const _=toDate($);return+endOfDay(_)==+endOfMonth(_)}function differenceInMonths($,_){const I=toDate($),j=toDate(_),U=compareAsc(I,j),q=Math.abs(differenceInCalendarMonths(I,j));let G;if(q<1)G=0;else{I.getMonth()===1&&I.getDate()>27&&I.setDate(30),I.setMonth(I.getMonth()-U*q);let K=compareAsc(I,j)===-U;isLastDayOfMonth(toDate($))&&q===1&&compareAsc($,j)===1&&(K=!1),G=U*(q-Number(K))}return G===0?0:G}function differenceInSeconds($,_,I){const j=differenceInMilliseconds($,_)/1e3;return getRoundingMethod(I==null?void 0:I.roundingMethod)(j)}function formatDistance($,_,I){const j=getDefaultOptions(),U=(I==null?void 0:I.locale)??j.locale??enUS$1,q=2520,G=compareAsc($,_);if(isNaN(G))throw new RangeError("Invalid time value");const K=Object.assign({},I,{addSuffix:I==null?void 0:I.addSuffix,comparison:G});let J,Y;G>0?(J=toDate(_),Y=toDate($)):(J=toDate($),Y=toDate(_));const X=differenceInSeconds(Y,J),Z=(getTimezoneOffsetInMilliseconds(Y)-getTimezoneOffsetInMilliseconds(J))/1e3,Q=Math.round((X-Z)/60);let ee;if(Q<2)return I!=null&&I.includeSeconds?X<5?U.formatDistance("lessThanXSeconds",5,K):X<10?U.formatDistance("lessThanXSeconds",10,K):X<20?U.formatDistance("lessThanXSeconds",20,K):X<40?U.formatDistance("halfAMinute",0,K):X<60?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",1,K):Q===0?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",Q,K);if(Q<45)return U.formatDistance("xMinutes",Q,K);if(Q<90)return U.formatDistance("aboutXHours",1,K);if(Q<minutesInDay){const ne=Math.round(Q/60);return U.formatDistance("aboutXHours",ne,K)}else{if(Q<q)return U.formatDistance("xDays",1,K);if(Q<minutesInMonth){const ne=Math.round(Q/minutesInDay);return U.formatDistance("xDays",ne,K)}else if(Q<minutesInMonth*2)return ee=Math.round(Q/minutesInMonth),U.formatDistance("aboutXMonths",ee,K)}if(ee=differenceInMonths(Y,J),ee<12){const ne=Math.round(Q/minutesInMonth);return U.formatDistance("xMonths",ne,K)}else{const ne=ee%12,re=Math.trunc(ee/12);return ne<3?U.formatDistance("aboutXYears",re,K):ne<9?U.formatDistance("overXYears",re,K):U.formatDistance("almostXYears",re+1,K)}}function formatDistanceToNow($,_){return formatDistance($,Date.now(),_)}var SpaceState;(function($){$[$.INVALID=0]="INVALID",$[$.SPACE_INACTIVE=2]="SPACE_INACTIVE",$[$.SPACE_ACTIVE=6]="SPACE_ACTIVE",$[$.SPACE_CLOSED=1]="SPACE_CLOSED",$[$.SPACE_CONTROL_ONLY=7]="SPACE_CONTROL_ONLY",$[$.SPACE_INITIALIZING=4]="SPACE_INITIALIZING",$[$.SPACE_READY=3]="SPACE_READY",$[$.SPACE_ERROR=5]="SPACE_ERROR",$[$.SPACE_REQUIRES_MIGRATION=8]="SPACE_REQUIRES_MIGRATION"})(SpaceState||(SpaceState={}));var Invitation;(function($){(function(_){_[_.INTERACTIVE=0]="INTERACTIVE",_[_.DELEGATED=1]="DELEGATED",_[_.MULTIUSE=2]="MULTIUSE"})($.Type||($.Type={})),function(_){_[_.DEVICE=0]="DEVICE",_[_.SPACE=1]="SPACE"}($.Kind||($.Kind={})),function(_){_[_.NONE=0]="NONE",_[_.SHARED_SECRET=1]="SHARED_SECRET",_[_.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}($.AuthMethod||($.AuthMethod={})),function(_){_[_.INIT=0]="INIT",_[_.CONNECTING=1]="CONNECTING",_[_.CONNECTED=2]="CONNECTED",_[_.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",_[_.AUTHENTICATING=4]="AUTHENTICATING",_[_.SUCCESS=5]="SUCCESS",_[_.CANCELLED=6]="CANCELLED",_[_.TIMEOUT=7]="TIMEOUT",_[_.ERROR=8]="ERROR",_[_.EXPIRED=9]="EXPIRED"}($.State||($.State={}))})(Invitation||(Invitation={}));var LogLevel;(function($){$[$.NONE=0]="NONE",$[$.TRACE=5]="TRACE",$[$.DEBUG=10]="DEBUG",$[$.INFO=11]="INFO",$[$.WARN=12]="WARN",$[$.ERROR=13]="ERROR"})(LogLevel||(LogLevel={}));var QueryLogsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INCLUSIVE=1]="INCLUSIVE",_[_.EXPLICIT=2]="EXPLICIT"})($.MatchingOptions||($.MatchingOptions={}))})(QueryLogsRequest||(QueryLogsRequest={}));var SystemStatus;(function($){$[$.ACTIVE=0]="ACTIVE",$[$.INACTIVE=1]="INACTIVE"})(SystemStatus||(SystemStatus={}));var GetDiagnosticsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.TRUNCATE=1]="TRUNCATE",_[_.HUMANIZE=2]="HUMANIZE"})($.KEY_OPTION||($.KEY_OPTION={}))})(GetDiagnosticsRequest||(GetDiagnosticsRequest={}));var Platform;(function($){(function(_){_[_.BROWSER=0]="BROWSER",_[_.SHARED_WORKER=1]="SHARED_WORKER",_[_.NODE=2]="NODE"})($.PLATFORM_TYPE||($.PLATFORM_TYPE={}))})(Platform||(Platform={}));var DeviceKind;(function($){$[$.CURRENT=0]="CURRENT",$[$.TRUSTED=1]="TRUSTED"})(DeviceKind||(DeviceKind={}));var Device;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE",_[_.REMOVED=2]="REMOVED"})($.PresenceState||($.PresenceState={}))})(Device||(Device={}));var SpaceMember;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE"})($.PresenceState||($.PresenceState={}))})(SpaceMember||(SpaceMember={}));var CreateEpochRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",_[_.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",_[_.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT",_[_.REPLACE_AUTOMERGE_ROOT=4]="REPLACE_AUTOMERGE_ROOT",_[_.MIGRATE_REFERENCES_TO_DXN=5]="MIGRATE_REFERENCES_TO_DXN"})($.Migration||($.Migration={}))})(CreateEpochRequest||(CreateEpochRequest={}));var QueryInvitationsResponse;(function($){(function(_){_[_.ADDED=0]="ADDED",_[_.REMOVED=1]="REMOVED",_[_.SAVED=2]="SAVED",_[_.LOAD_COMPLETE=3]="LOAD_COMPLETE"})($.Action||($.Action={})),function(_){_[_.CREATED=0]="CREATED",_[_.ACCEPTED=1]="ACCEPTED"}($.Type||($.Type={}))})(QueryInvitationsResponse||(QueryInvitationsResponse={}));var ConnectionState;(function($){$[$.OFFLINE=0]="OFFLINE",$[$.ONLINE=1]="ONLINE"})(ConnectionState||(ConnectionState={}));var ContextDisposedError=class extends Error{constructor(){super("Context disposed.")}};function _ts_decorate$1($,_,I,j){var U=arguments.length,q=U<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,I):j,G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,_,I,j);else for(var K=$.length-1;K>=0;K--)(G=$[K])&&(q=(U<3?G(q):U>3?G(_,I,q):G(_,I))||q);return U>3&&q&&Object.defineProperty(_,I,q),q}var __dxlog_file$6="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MAX_SAFE_DISPOSE_CALLBACKS=300,DEFAULT_ERROR_HANDLER=($,_)=>{if(!($ instanceof ContextDisposedError))throw _.dispose(),$},CONTEXT_FLAG_IS_DISPOSED=1,CONTEXT_FLAG_LEAK_DETECTED=2,_a$1,_b,Context=(un=class{constructor(_={},I){Zt(this,Kt);Zt(this,Jt);Zt(this,an);Zt(this,ln);Zt(this,yn);Zt(this,On);Zt(this,Yt);Zt(this,dn);Vt(this,Jt,[]),Vt(this,an,void 0),Vt(this,ln,void 0),Vt(this,Yt,0),Vt(this,dn,void 0),this.maxSafeDisposeCallbacks=MAX_SAFE_DISPOSE_CALLBACKS,this[_b]="Context",this[_a$1]=()=>this.toString(),Vt(this,an,getContextName(_,I)),Vt(this,ln,_.parent),Vt(this,yn,_.attributes??{}),Vt(this,On,_.onError??DEFAULT_ERROR_HANDLER)}static default(){return new un}get disposed(){return kt(this,Kt,Wn)}get disposeCallbacksLength(){return kt(this,Jt).length}onDispose(_){if(kt(this,Kt,Wn)&&(async()=>{try{await _()}catch(I){log$2.catch(I,{context:kt(this,an)},{F:__dxlog_file$6,L:119,S:this,C:(j,U)=>j(...U)})}})(),kt(this,Jt).push(_),kt(this,Jt).length>this.maxSafeDisposeCallbacks&&!kt(this,Kt,jr)){Vt(this,Kt,!0,Ur);const I=new StackTrace().getStackArray(1)[0].trim();log$2.warn("Context has a large number of dispose callbacks (this might be a memory leak).",{context:kt(this,an),callSite:I,count:kt(this,Jt).length},{F:__dxlog_file$6,L:128,S:this,C:(j,U)=>j(...U)})}return()=>{const I=kt(this,Jt).indexOf(_);I!==-1&&kt(this,Jt).splice(I,1)}}async dispose(_=!1){if(kt(this,dn))return kt(this,dn);Vt(this,Kt,!0,Br);let I;const j=new Promise(J=>{I=J});Vt(this,dn,j);const U=Array.from(kt(this,Jt)).reverse();kt(this,Jt).length=0;let q=0,G=!0;const K=[];for(const J of U)try{await J(),q++}catch(Y){G=!1,_?K.push(Y):log$2.catch(Y,{context:kt(this,an),callback:q,count:U.length},{F:__dxlog_file$6,L:188,S:this,C:(X,Z)=>X(...Z)})}if(K.length>0)throw new AggregateError(K);return I(G),G}raise(_){if(!kt(this,Kt,Wn))try{kt(this,On).call(this,_,this)}catch(I){Promise.reject(I)}}derive({onError:_,attributes:I}={}){const j=new un({onError:async q=>{if(!_)this.raise(q);else try{await _(q,this)}catch{this.raise(q)}},attributes:I}),U=this.onDispose(()=>j.dispose());return j.onDispose(U),j}getAttribute(_){if(_ in kt(this,yn))return kt(this,yn)[_];if(kt(this,ln))return kt(this,ln).getAttribute(_)}toString(){return`Context(${kt(this,Kt,Wn)?"disposed":"active"})`}async[(_b=Symbol.toStringTag,_a$1=export_inspect.custom,Symbol.asyncDispose)](){await this.dispose()}},Jt=new WeakMap,an=new WeakMap,ln=new WeakMap,yn=new WeakMap,On=new WeakMap,Yt=new WeakMap,dn=new WeakMap,Kt=new WeakSet,Wn=function(){return!!(kt(this,Yt)&CONTEXT_FLAG_IS_DISPOSED)},Br=function(_){Vt(this,Yt,_?kt(this,Yt)|CONTEXT_FLAG_IS_DISPOSED:kt(this,Yt)&~CONTEXT_FLAG_IS_DISPOSED)},jr=function(){return!!(kt(this,Yt)&CONTEXT_FLAG_LEAK_DETECTED)},Ur=function(_){Vt(this,Yt,_?kt(this,Yt)|CONTEXT_FLAG_LEAK_DETECTED:kt(this,Yt)&~CONTEXT_FLAG_LEAK_DETECTED)},un);Context=_ts_decorate$1([safeInstanceof("Context")],Context);var getContextName=($,_)=>{var I;if($.name)return $.name;if((I=_==null?void 0:_.F)!=null&&I.length){const j=_==null?void 0:_.F.split("/");return`${j[j.length-1]}#${(_==null?void 0:_.L)??0}`}},LifecycleState;(function($){$.CLOSED="CLOSED",$.OPEN="OPEN",$.ERROR="ERROR"})(LifecycleState||(LifecycleState={}));var Observable$2={};Object.defineProperty(Observable$2,"__esModule",{value:!0}),Observable$2.Observable=void 0;const hasSymbol=$=>!!Symbol[$],getSymbol=$=>hasSymbol($)?Symbol[$]:"@@"+$,SymbolIterator=getSymbol("iterator"),SymbolObservable=getSymbol("observable"),SymbolSpecies=getSymbol("species");function getMethod($,_){let I=$[_];if(I!=null){if(typeof I!="function")throw new TypeError(I+" is not a function");return I}}function getSpecies($){let _=$.constructor;return _!==void 0&&(_=_[SymbolSpecies],_===null&&(_=void 0)),_!==void 0?_:Observable$1}function isObservable$1($){return $ instanceof Observable$1}function hostReportError($){hostReportError.log?hostReportError.log($):setTimeout(()=>{throw $})}function enqueue($){Promise.resolve().then(()=>{try{$()}catch(_){hostReportError(_)}})}function cleanupSubscription($){let _=$._cleanup;if(_!==void 0&&($._cleanup=void 0,!!_))try{if(typeof _=="function")_();else{let I=getMethod(_,"unsubscribe");I&&I.call(_)}}catch(I){hostReportError(I)}}function closeSubscription($){$._observer=void 0,$._queue=void 0,$._state="closed"}function flushSubscription($){let _=$._queue;if(_){$._queue=void 0,$._state="ready";for(let I=0;I<_.length&&(notifySubscription($,_[I].type,_[I].value),$._state!=="closed");++I);}}function notifySubscription($,_,I){$._state="running";let j=$._observer;try{let U=getMethod(j,_);switch(_){case"next":U&&U.call(j,I);break;case"error":if(closeSubscription($),U)U.call(j,I);else throw I;break;case"complete":closeSubscription($),U&&U.call(j);break}}catch(U){hostReportError(U)}$._state==="closed"?cleanupSubscription($):$._state==="running"&&($._state="ready")}function onNotify($,_,I){if($._state!=="closed"){if($._state==="buffering"){$._queue.push({type:_,value:I});return}if($._state!=="ready"){$._state="buffering",$._queue=[{type:_,value:I}],enqueue(()=>flushSubscription($));return}notifySubscription($,_,I)}}class Subscription{constructor(_,I){this._cleanup=void 0,this._observer=_,this._queue=void 0,this._state="initializing";let j=this,U={get closed(){return j._state==="closed"},next(q){onNotify(j,"next",q)},error(q){onNotify(j,"error",q)},complete(){onNotify(j,"complete")}};try{this._cleanup=I.call(void 0,U)}catch(q){U.error(q)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(closeSubscription(this),cleanupSubscription(this))}}let Observable$1=class nr{constructor(_){if(!(this instanceof nr))throw new TypeError("Observable cannot be called as a function");if(typeof _!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=_}subscribe(_){return(typeof _!="object"||_===null)&&(_={next:_,error:arguments[1],complete:arguments[2]}),new Subscription(_,this._subscriber)}forEach(_){return new Promise((I,j)=>{if(typeof _!="function"){j(new TypeError(_+" is not a function"));return}function U(){q.unsubscribe(),I()}let q=this.subscribe({next(G){try{_(G,U)}catch(K){j(K),q.unsubscribe()}},error:j,complete:I})})}map(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{U=_(U)}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}filter(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{if(!_(U))return}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}reduce(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this),j=arguments.length>1,U=!1,G=arguments[1];return new I(K=>this.subscribe({next(J){let Y=!U;if(U=!0,!Y||j)try{G=_(G,J)}catch(X){return K.error(X)}else G=J},error(J){K.error(J)},complete(){if(!U&&!j)return K.error(new TypeError("Cannot reduce an empty sequence"));K.next(G),K.complete()}}))}async all(){let _=[];return await this.forEach(I=>_.push(I)),_}concat(..._){let I=getSpecies(this);return new I(j=>{let U,q=0;function G(K){U=K.subscribe({next(J){j.next(J)},error(J){j.error(J)},complete(){q===_.length?(U=void 0,j.complete()):G(I.from(_[q++]))}})}return G(this),()=>{U&&(U.unsubscribe(),U=void 0)}})}flatMap(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>{let U=[],q=this.subscribe({next(K){if(_)try{K=_(K)}catch(Y){return j.error(Y)}let J=I.from(K).subscribe({next(Y){j.next(Y)},error(Y){j.error(Y)},complete(){let Y=U.indexOf(J);Y>=0&&U.splice(Y,1),G()}});U.push(J)},error(K){j.error(K)},complete(){G()}});function G(){q.closed&&U.length===0&&j.complete()}return()=>{U.forEach(K=>K.unsubscribe()),q.unsubscribe()}})}[SymbolObservable](){return this}static from(_){let I=typeof this=="function"?this:nr;if(_==null)throw new TypeError(_+" is not an object");let j=getMethod(_,SymbolObservable);if(j){let U=j.call(_);if(Object(U)!==U)throw new TypeError(U+" is not an object");return isObservable$1(U)&&U.constructor===I?U:new I(q=>U.subscribe(q))}if(hasSymbol("iterator")&&(j=getMethod(_,SymbolIterator),j))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q of j.call(_))if(U.next(q),U.closed)return;U.complete()}})});if(Array.isArray(_))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q=0;q<_.length;++q)if(U.next(_[q]),U.closed)return;U.complete()}})});throw new TypeError(_+" is not observable")}static of(..._){let I=typeof this=="function"?this:nr;return new I(j=>{enqueue(()=>{if(!j.closed){for(let U=0;U<_.length;++U)if(j.next(_[U]),j.closed)return;j.complete()}})})}static get[SymbolSpecies](){return this}};Observable$2.Observable=Observable$1,Object.defineProperty(Observable$1,Symbol("extensions"),{value:{symbol:SymbolObservable,hostReportError},configurable:!0});var zenObservable=Observable$2.Observable;const Observable=getDefaultExportFromCjs(zenObservable);var readableBrowser={exports:{}},events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(_,I,j){return Function.prototype.apply.call(_,I,j)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(_){return Object.getOwnPropertyNames(_).concat(Object.getOwnPropertySymbols(_))}:ReflectOwnKeys=function(_){return Object.getOwnPropertyNames(_)};function ProcessEmitWarning($){console&&console.warn&&console.warn($)}var NumberIsNaN=Number.isNaN||function(_){return _!==_};function EventEmitter$1(){EventEmitter$1.init.call(this)}events.exports=EventEmitter$1,events.exports.once=once$2,EventEmitter$1.EventEmitter=EventEmitter$1,EventEmitter$1.prototype._events=void 0,EventEmitter$1.prototype._eventsCount=0,EventEmitter$1.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener($){if(typeof $!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof $)}Object.defineProperty(EventEmitter$1,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function($){if(typeof $!="number"||$<0||NumberIsNaN($))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+$+".");defaultMaxListeners=$}}),EventEmitter$1.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},EventEmitter$1.prototype.setMaxListeners=function(_){if(typeof _!="number"||_<0||NumberIsNaN(_))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+_+".");return this._maxListeners=_,this};function _getMaxListeners($){return $._maxListeners===void 0?EventEmitter$1.defaultMaxListeners:$._maxListeners}EventEmitter$1.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter$1.prototype.emit=function(_){for(var I=[],j=1;j<arguments.length;j++)I.push(arguments[j]);var U=_==="error",q=this._events;if(q!==void 0)U=U&&q.error===void 0;else if(!U)return!1;if(U){var G;if(I.length>0&&(G=I[0]),G instanceof Error)throw G;var K=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw K.context=G,K}var J=q[_];if(J===void 0)return!1;if(typeof J=="function")ReflectApply(J,this,I);else for(var Y=J.length,X=arrayClone(J,Y),j=0;j<Y;++j)ReflectApply(X[j],this,I);return!0};function _addListener($,_,I,j){var U,q,G;if(checkListener(I),q=$._events,q===void 0?(q=$._events=Object.create(null),$._eventsCount=0):(q.newListener!==void 0&&($.emit("newListener",_,I.listener?I.listener:I),q=$._events),G=q[_]),G===void 0)G=q[_]=I,++$._eventsCount;else if(typeof G=="function"?G=q[_]=j?[I,G]:[G,I]:j?G.unshift(I):G.push(I),U=_getMaxListeners($),U>0&&G.length>U&&!G.warned){G.warned=!0;var K=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");K.name="MaxListenersExceededWarning",K.emitter=$,K.type=_,K.count=G.length,ProcessEmitWarning(K)}return $}EventEmitter$1.prototype.addListener=function(_,I){return _addListener(this,_,I,!1)},EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener,EventEmitter$1.prototype.prependListener=function(_,I){return _addListener(this,_,I,!0)};function onceWrapper(){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 _onceWrap($,_,I){var j={fired:!1,wrapFn:void 0,target:$,type:_,listener:I},U=onceWrapper.bind(j);return U.listener=I,j.wrapFn=U,U}EventEmitter$1.prototype.once=function(_,I){return checkListener(I),this.on(_,_onceWrap(this,_,I)),this},EventEmitter$1.prototype.prependOnceListener=function(_,I){return checkListener(I),this.prependListener(_,_onceWrap(this,_,I)),this},EventEmitter$1.prototype.removeListener=function(_,I){var j,U,q,G,K;if(checkListener(I),U=this._events,U===void 0)return this;if(j=U[_],j===void 0)return this;if(j===I||j.listener===I)--this._eventsCount===0?this._events=Object.create(null):(delete U[_],U.removeListener&&this.emit("removeListener",_,j.listener||I));else if(typeof j!="function"){for(q=-1,G=j.length-1;G>=0;G--)if(j[G]===I||j[G].listener===I){K=j[G].listener,q=G;break}if(q<0)return this;q===0?j.shift():spliceOne(j,q),j.length===1&&(U[_]=j[0]),U.removeListener!==void 0&&this.emit("removeListener",_,K||I)}return this},EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener,EventEmitter$1.prototype.removeAllListeners=function(_){var I,j,U;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[_]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[_]),this;if(arguments.length===0){var q=Object.keys(j),G;for(U=0;U<q.length;++U)G=q[U],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(I=j[_],typeof I=="function")this.removeListener(_,I);else if(I!==void 0)for(U=I.length-1;U>=0;U--)this.removeListener(_,I[U]);return this};function _listeners($,_,I){var j=$._events;if(j===void 0)return[];var U=j[_];return U===void 0?[]:typeof U=="function"?I?[U.listener||U]:[U]:I?unwrapListeners(U):arrayClone(U,U.length)}EventEmitter$1.prototype.listeners=function(_){return _listeners(this,_,!0)},EventEmitter$1.prototype.rawListeners=function(_){return _listeners(this,_,!1)},EventEmitter$1.listenerCount=function($,_){return typeof $.listenerCount=="function"?$.listenerCount(_):listenerCount.call($,_)},EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount($){var _=this._events;if(_!==void 0){var I=_[$];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}EventEmitter$1.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone($,_){for(var I=new Array(_),j=0;j<_;++j)I[j]=$[j];return I}function spliceOne($,_){for(;_+1<$.length;_++)$[_]=$[_+1];$.pop()}function unwrapListeners($){for(var _=new Array($.length),I=0;I<_.length;++I)_[I]=$[I].listener||$[I];return _}function once$2($,_){return new Promise(function(I,j){function U(G){$.removeListener(_,q),j(G)}function q(){typeof $.removeListener=="function"&&$.removeListener("error",U),I([].slice.call(arguments))}eventTargetAgnosticAddListener($,_,q,{once:!0}),_!=="error"&&addErrorHandlerIfEventEmitter($,U,{once:!0})})}function addErrorHandlerIfEventEmitter($,_,I){typeof $.on=="function"&&eventTargetAgnosticAddListener($,"error",_,I)}function eventTargetAgnosticAddListener($,_,I,j){if(typeof $.on=="function")j.once?$.once(_,I):$.on(_,I);else if(typeof $.addEventListener=="function")$.addEventListener(_,function U(q){j.once&&$.removeEventListener(_,U),I(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof $)}var eventsExports=events.exports,streamBrowser=eventsExports.EventEmitter,buffer={},base64Js={};base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i$1=0,len=code.length;i$1<len;++i$1)lookup[i$1]=code[i$1],revLookup[code.charCodeAt(i$1)]=i$1;revLookup[45]=62,revLookup[95]=63;function getLens($){var _=$.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=$.indexOf("=");I===-1&&(I=_);var j=I===_?0:4-I%4;return[I,j]}function byteLength($){var _=getLens($),I=_[0],j=_[1];return(I+j)*3/4-j}function _byteLength($,_,I){return(_+I)*3/4-I}function toByteArray($){var _,I=getLens($),j=I[0],U=I[1],q=new Arr(_byteLength($,j,U)),G=0,K=U>0?j-4:j,J;for(J=0;J<K;J+=4)_=revLookup[$.charCodeAt(J)]<<18|revLookup[$.charCodeAt(J+1)]<<12|revLookup[$.charCodeAt(J+2)]<<6|revLookup[$.charCodeAt(J+3)],q[G++]=_>>16&255,q[G++]=_>>8&255,q[G++]=_&255;return U===2&&(_=revLookup[$.charCodeAt(J)]<<2|revLookup[$.charCodeAt(J+1)]>>4,q[G++]=_&255),U===1&&(_=revLookup[$.charCodeAt(J)]<<10|revLookup[$.charCodeAt(J+1)]<<4|revLookup[$.charCodeAt(J+2)]>>2,q[G++]=_>>8&255,q[G++]=_&255),q}function tripletToBase64($){return lookup[$>>18&63]+lookup[$>>12&63]+lookup[$>>6&63]+lookup[$&63]}function encodeChunk($,_,I){for(var j,U=[],q=_;q<I;q+=3)j=($[q]<<16&16711680)+($[q+1]<<8&65280)+($[q+2]&255),U.push(tripletToBase64(j));return U.join("")}function fromByteArray($){for(var _,I=$.length,j=I%3,U=[],q=16383,G=0,K=I-j;G<K;G+=q)U.push(encodeChunk($,G,G+q>K?K:G+q));return j===1?(_=$[I-1],U.push(lookup[_>>2]+lookup[_<<4&63]+"==")):j===2&&(_=($[I-2]<<8)+$[I-1],U.push(lookup[_>>10]+lookup[_>>4&63]+lookup[_<<2&63]+"=")),U.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function($,_,I,j,U){var q,G,K=U*8-j-1,J=(1<<K)-1,Y=J>>1,X=-7,Z=I?U-1:0,Q=I?-1:1,ee=$[_+Z];for(Z+=Q,q=ee&(1<<-X)-1,ee>>=-X,X+=K;X>0;q=q*256+$[_+Z],Z+=Q,X-=8);for(G=q&(1<<-X)-1,q>>=-X,X+=j;X>0;G=G*256+$[_+Z],Z+=Q,X-=8);if(q===0)q=1-Y;else{if(q===J)return G?NaN:(ee?-1:1)*(1/0);G=G+Math.pow(2,j),q=q-Y}return(ee?-1:1)*G*Math.pow(2,q-j)},ieee754.write=function($,_,I,j,U,q){var G,K,J,Y=q*8-U-1,X=(1<<Y)-1,Z=X>>1,Q=U===23?Math.pow(2,-24)-Math.pow(2,-77):0,ee=j?0:q-1,ne=j?1:-1,re=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(K=isNaN(_)?1:0,G=X):(G=Math.floor(Math.log(_)/Math.LN2),_*(J=Math.pow(2,-G))<1&&(G--,J*=2),G+Z>=1?_+=Q/J:_+=Q*Math.pow(2,1-Z),_*J>=2&&(G++,J/=2),G+Z>=X?(K=0,G=X):G+Z>=1?(K=(_*J-1)*Math.pow(2,U),G=G+Z):(K=_*Math.pow(2,Z-1)*Math.pow(2,U),G=0));U>=8;$[I+ee]=K&255,ee+=ne,K/=256,U-=8);for(G=G<<U|K,Y+=U;Y>0;$[I+ee]=G&255,ee+=ne,G/=256,Y-=8);$[I+ee-ne]|=re*128};/*!
|
|
921
|
+
`;function $e5534fc185f7111e$export$2e2bcd8739ae039($){const _=React.useRef(null),I=React.useRef(null);return I.current&&I.current.update($),React.useEffect(()=>(I.current=new $efa000751917694d$export$2e2bcd8739ae039({...$,ref:_}),()=>{I.current=null}),[]),React.createElement("div",{ref:_})}const EmojiPickerToolbarButton=({disabled:$,defaultEmoji:_,emoji:I,onChangeEmoji:j,classNames:U})=>{const{t:q}=useTranslation("os"),{themeMode:G}=useThemeContext(),[K,J]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:I,onChange:j,defaultProp:_}),[Y,X]=React.useState(!1),Z=React.useRef(!1),[Q,ee]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Q,onOpenChange:ne=>{Z.current?(ee(!1),Z.current=!1):ee(ne)}},React.createElement(Popover.Root,{open:Y,onOpenChange:ne=>{X(ne),Z.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Popover.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:["gap-2 text-2xl plb-1",U],disabled:$},React.createElement("span",{className:"sr-only"},q("select emoji label")),React.createElement(react.UserCircle,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select emoji label"),React.createElement(Tooltip.Arrow,null))),React.createElement(Popover.Content,{side:"bottom",onKeyDownCapture:ne=>{ne.key==="Escape"&&(ne.stopPropagation(),X(!1),Z.current=!0)}},React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039,{data:emojiData,onEmojiSelect:({native:ne})=>{ne&&(J(ne),X(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0,theme:G}),React.createElement(Popover.Arrow,null))))},HuePreview=({hue:$})=>{const{tx:_}=useThemeContext(),I=20;return React.createElement("svg",{width:I,height:I,viewBox:`0 0 ${I} ${I}`},React.createElement("rect",{x:0,y:0,width:I,height:I,className:_("hue.fill","select--hue__preview",{hue:$})}))},hueTokens=Object.keys(hueTokenThemes).slice(0,16),HuePickerToolbarButton=({disabled:$,hue:_,onChangeHue:I,classNames:j,defaultHue:U})=>{const{t:q}=useTranslation("os"),[G,K]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:_,onChange:I,defaultProp:U}),[J,Y]=React.useState(!1),X=React.useRef(!1),[Z,Q]=React.useState(!1);return React.createElement(Tooltip.Root,{open:Z,onOpenChange:ee=>{X.current?(Q(!1),X.current=!1):Q(ee)}},React.createElement(DropdownMenu2.Root,{modal:!1,open:J,onOpenChange:ee=>{Y(ee),X.current=!0}},React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Toolbar.Button,{classNames:mx("gap-2 plb-1",j),disabled:$},React.createElement("span",{className:"sr-only"},q("select hue label")),React.createElement(react.Palette,{className:getSize(5)})))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},q("select hue label"),React.createElement(Tooltip.Arrow,null))),React.createElement(DropdownMenu2.Content,{side:"bottom",classNames:"!w-40"},React.createElement(DropdownMenu2.Viewport,{classNames:"grid grid-cols-4"},hueTokens.map(ee=>React.createElement(DropdownMenu2.CheckboxItem,{key:ee,checked:ee===G,onCheckedChange:()=>K(ee),classNames:"px-0 py-2 items-center justify-center"},React.createElement(HuePreview,{hue:ee})))))))};var data={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"]},capitalize=$=>$.charAt(0).toUpperCase()+$.slice(1),generateName=$=>{const _=$.length*2/3,I=$.substring(0,_),j=$.substring(_),U=capitalize(data.adjectives[parseInt(I,16)%data.adjectives.length]),q=capitalize(data.animals[parseInt(j,16)%data.animals.length]);return`${U} ${q}`};const IdentityListItem=React.forwardRef(({identity:$,presence:_,onClick:I,classNames:j,...U},q)=>{var Y,X,Z,Q,ee;const G=keyToFallback($.identityKey),K=useId$1("identityListItem__label"),J=((Y=$.profile)==null?void 0:Y.displayName)??generateName($.identityKey.toHex());return React.createElement(ListItem.Root,{...U,classNames:mx("flex gap-2 pis-3 pie-1 items-center",I&&"cursor-pointer",j),onClick:()=>I==null?void 0:I(),"data-testid":"identity-list-item",labelId:K,ref:q},React.createElement(Avatar.Root,{status:_===echo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:K,hue:((Z=(X=$.profile)==null?void 0:X.data)==null?void 0:Z.hue)||G.hue},React.createElement(Avatar.Frame,{classNames:"place-self-center"},React.createElement(Avatar.Fallback,{text:((ee=(Q=$.profile)==null?void 0:Q.data)==null?void 0:ee.emoji)||G.emoji})),React.createElement(Avatar.Label,{classNames:"text-sm truncate pli-2"},J)))}),SpaceMemberList=({spaceKey:$,includeSelf:_,onSelect:I})=>{const j=reactClient.useClient(),U=echo.useMembers($),q=React.useMemo(()=>_?U.sort(G=>G.identity.identityKey.equals(j.halo.identity.get().identityKey)?-1:1):U.filter(G=>!G.identity.identityKey.equals(j.halo.identity.get().identityKey)),[U]);return React.createElement(SpaceMemberListImpl,{members:q,onSelect:I})},SpaceMemberListImpl=({members:$,onSelect:_})=>{const{t:I}=useTranslation("os"),j=$.filter(U=>U.identity);return j.length>0?React.createElement(List,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},j.map(U=>React.createElement(IdentityListItem,{key:U.identity.identityKey.toHex(),identity:U.identity,presence:U.presence,onClick:_&&(()=>_(U))}))):React.createElement("div",{role:"none",className:"grow flex items-center p-2"},React.createElement("p",{className:mx(descriptionText,"text-center is-full mlb-2")},I("empty space members message")))},iconProps={weight:"duotone",width:24,height:24,x:8,y:8},DeviceListItem=React.forwardRef(({device:$,onClickAdd:_,onClickEdit:I,onClickReset:j,onClickJoinExisting:U,classNames:q,connectionState:G,onAgentDestroy:K,...J},Y)=>{var re,ae;const{t:X}=useTranslation("os"),Z=keyToFallback($.deviceKey),Q=useId$1("identityListItem__label"),ee=$.profile?X("device name placeholder",{os:$.profile.os,platform:$.profile.platform}):generateName($.deviceKey.toHex()),ne=$.kind===halo.DeviceKind.CURRENT;return React.createElement(ListItem.Root,{...J,classNames:["flex gap-2 items-center mlb-2",q],"data-testid":`device-list-item${ne?"-current":""}`,labelId:Q,ref:Y},React.createElement(Avatar.Root,{status:ne&&G===mesh.ConnectionState.OFFLINE?"error":$.presence===halo.Device.PresenceState.ONLINE?"active":"inactive",labelId:Q,hue:Z.hue,variant:"square"},React.createElement(Avatar.Frame,{classNames:"place-self-center"},(re=$.profile)!=null&&re.type?$.profile.type===halo.DeviceType.AGENT_MANAGED?React.createElement(react.Database,{...iconProps}):$.profile.type===halo.DeviceType.BROWSER?React.createElement(react.Compass,{...iconProps}):$.profile.type===halo.DeviceType.NATIVE?React.createElement(react.Desktop,{...iconProps}):[halo.DeviceType.AGENT,halo.DeviceType.AGENT_MANAGED].includes($.profile.type)?React.createElement(react.Robot,{...iconProps}):$.profile.type===halo.DeviceType.MOBILE?React.createElement(react.DeviceMobile,{...iconProps}):React.createElement(react.Devices,{...iconProps}):React.createElement(Avatar.Fallback,{text:Z.emoji})),React.createElement(Avatar.Label,{classNames:"flex-1 text-sm truncate"},ee),ne&&React.createElement(Tag,{color:"primary"},X("current device tag label")),((ae=$.profile)==null?void 0:ae.type)===halo.DeviceType.AGENT_MANAGED?React.createElement(Tooltip.Root,null,React.createElement(Tooltip.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":"agent.destroy",onClick:K},React.createElement("span",{className:"sr-only"},X("destroy agent label")),React.createElement(react.Power,{className:getSize(5)}))),React.createElement(Tooltip.Portal,null,React.createElement(Tooltip.Content,{side:"bottom",classNames:"z-50"},X("destroy agent label")))):$.kind===halo.DeviceKind.CURRENT&&React.createElement(DropdownMenu2.Root,null,React.createElement(DropdownMenu2.Trigger,{asChild:!0},React.createElement(Button,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${ne?"-current":""}.options`},React.createElement("span",{className:"sr-only"},X("more options label")),React.createElement(react.DotsThree,{className:getSize(5)}))),React.createElement(DropdownMenu2.Content,null,React.createElement(DropdownMenu2.Viewport,null,React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.join-existing",onClick:U},React.createElement(react.ShareFat,{className:getSize(5)}),X("choose join new identity label")),React.createElement(DropdownMenu2.Item,{"data-testid":"device-list-item-current.reset",onClick:j},React.createElement(react.Power,{className:getSize(5)}),X("reset device label")))))))}),DeviceList=({devices:$,connectionState:_,onClickAdd:I,onClickEdit:j,onClickReset:U,onClickJoinExisting:q,onAgentDestroy:G})=>{const{t:K}=useTranslation("os");return React.createElement(React.Fragment,null,React.createElement("h2",{className:mx(descriptionText,"text-center mbs-4")},K("devices heading")),$.length>0&&React.createElement(List,null,$.map(J=>React.createElement(DeviceListItem,{key:J.deviceKey.toHex(),device:J,onClickEdit:()=>j==null?void 0:j(J),onClickReset:U,onClickJoinExisting:q,connectionState:_,onAgentDestroy:G}))),React.createElement(Button,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3 is-full","data-testid":"devices-panel.create-invitation",onClick:I},React.createElement("div",{role:"img",className:mx(getSize(8),"m-1 rounded-sm bg-input grid place-items-center")},React.createElement(react.Plus,{weight:"light",className:getSize(6)})),React.createElement("span",{className:"grow font-medium text-start"},K("choose add device label")),React.createElement(react.CaretRight,{weight:"bold",className:getSize(4)})))},minutesInMonth=43200,minutesInDay=1440;function getTimezoneOffsetInMilliseconds($){const _=toDate($),I=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()));return I.setUTCFullYear(_.getFullYear()),+$-+I}function compareAsc($,_){const I=toDate($),j=toDate(_),U=I.getTime()-j.getTime();return U<0?-1:U>0?1:U}function differenceInCalendarMonths($,_){const I=toDate($),j=toDate(_),U=I.getFullYear()-j.getFullYear(),q=I.getMonth()-j.getMonth();return U*12+q}function getRoundingMethod($){return _=>{const j=($?Math[$]:Math.trunc)(_);return j===0?0:j}}function differenceInMilliseconds($,_){return+toDate($)-+toDate(_)}function endOfDay($){const _=toDate($);return _.setHours(23,59,59,999),_}function endOfMonth($){const _=toDate($),I=_.getMonth();return _.setFullYear(_.getFullYear(),I+1,0),_.setHours(23,59,59,999),_}function isLastDayOfMonth($){const _=toDate($);return+endOfDay(_)==+endOfMonth(_)}function differenceInMonths($,_){const I=toDate($),j=toDate(_),U=compareAsc(I,j),q=Math.abs(differenceInCalendarMonths(I,j));let G;if(q<1)G=0;else{I.getMonth()===1&&I.getDate()>27&&I.setDate(30),I.setMonth(I.getMonth()-U*q);let K=compareAsc(I,j)===-U;isLastDayOfMonth(toDate($))&&q===1&&compareAsc($,j)===1&&(K=!1),G=U*(q-Number(K))}return G===0?0:G}function differenceInSeconds($,_,I){const j=differenceInMilliseconds($,_)/1e3;return getRoundingMethod(I==null?void 0:I.roundingMethod)(j)}function formatDistance($,_,I){const j=getDefaultOptions(),U=(I==null?void 0:I.locale)??j.locale??enUS$1,q=2520,G=compareAsc($,_);if(isNaN(G))throw new RangeError("Invalid time value");const K=Object.assign({},I,{addSuffix:I==null?void 0:I.addSuffix,comparison:G});let J,Y;G>0?(J=toDate(_),Y=toDate($)):(J=toDate($),Y=toDate(_));const X=differenceInSeconds(Y,J),Z=(getTimezoneOffsetInMilliseconds(Y)-getTimezoneOffsetInMilliseconds(J))/1e3,Q=Math.round((X-Z)/60);let ee;if(Q<2)return I!=null&&I.includeSeconds?X<5?U.formatDistance("lessThanXSeconds",5,K):X<10?U.formatDistance("lessThanXSeconds",10,K):X<20?U.formatDistance("lessThanXSeconds",20,K):X<40?U.formatDistance("halfAMinute",0,K):X<60?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",1,K):Q===0?U.formatDistance("lessThanXMinutes",1,K):U.formatDistance("xMinutes",Q,K);if(Q<45)return U.formatDistance("xMinutes",Q,K);if(Q<90)return U.formatDistance("aboutXHours",1,K);if(Q<minutesInDay){const ne=Math.round(Q/60);return U.formatDistance("aboutXHours",ne,K)}else{if(Q<q)return U.formatDistance("xDays",1,K);if(Q<minutesInMonth){const ne=Math.round(Q/minutesInDay);return U.formatDistance("xDays",ne,K)}else if(Q<minutesInMonth*2)return ee=Math.round(Q/minutesInMonth),U.formatDistance("aboutXMonths",ee,K)}if(ee=differenceInMonths(Y,J),ee<12){const ne=Math.round(Q/minutesInMonth);return U.formatDistance("xMonths",ne,K)}else{const ne=ee%12,re=Math.trunc(ee/12);return ne<3?U.formatDistance("aboutXYears",re,K):ne<9?U.formatDistance("overXYears",re,K):U.formatDistance("almostXYears",re+1,K)}}function formatDistanceToNow($,_){return formatDistance($,Date.now(),_)}var LogLevel;(function($){$[$.NONE=0]="NONE",$[$.TRACE=5]="TRACE",$[$.DEBUG=10]="DEBUG",$[$.INFO=11]="INFO",$[$.WARN=12]="WARN",$[$.ERROR=13]="ERROR"})(LogLevel||(LogLevel={}));var QueryLogsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INCLUSIVE=1]="INCLUSIVE",_[_.EXPLICIT=2]="EXPLICIT"})($.MatchingOptions||($.MatchingOptions={}))})(QueryLogsRequest||(QueryLogsRequest={}));var SpaceState;(function($){$[$.INVALID=0]="INVALID",$[$.SPACE_INACTIVE=2]="SPACE_INACTIVE",$[$.SPACE_ACTIVE=6]="SPACE_ACTIVE",$[$.SPACE_CLOSED=1]="SPACE_CLOSED",$[$.SPACE_CONTROL_ONLY=7]="SPACE_CONTROL_ONLY",$[$.SPACE_INITIALIZING=4]="SPACE_INITIALIZING",$[$.SPACE_READY=3]="SPACE_READY",$[$.SPACE_ERROR=5]="SPACE_ERROR",$[$.SPACE_REQUIRES_MIGRATION=8]="SPACE_REQUIRES_MIGRATION"})(SpaceState||(SpaceState={}));var Invitation;(function($){(function(_){_[_.INTERACTIVE=0]="INTERACTIVE",_[_.DELEGATED=1]="DELEGATED",_[_.MULTIUSE=2]="MULTIUSE"})($.Type||($.Type={})),function(_){_[_.DEVICE=0]="DEVICE",_[_.SPACE=1]="SPACE"}($.Kind||($.Kind={})),function(_){_[_.NONE=0]="NONE",_[_.SHARED_SECRET=1]="SHARED_SECRET",_[_.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}($.AuthMethod||($.AuthMethod={})),function(_){_[_.INIT=0]="INIT",_[_.CONNECTING=1]="CONNECTING",_[_.CONNECTED=2]="CONNECTED",_[_.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",_[_.AUTHENTICATING=4]="AUTHENTICATING",_[_.SUCCESS=5]="SUCCESS",_[_.CANCELLED=6]="CANCELLED",_[_.TIMEOUT=7]="TIMEOUT",_[_.ERROR=8]="ERROR",_[_.EXPIRED=9]="EXPIRED"}($.State||($.State={}))})(Invitation||(Invitation={}));var SystemStatus;(function($){$[$.ACTIVE=0]="ACTIVE",$[$.INACTIVE=1]="INACTIVE"})(SystemStatus||(SystemStatus={}));var GetDiagnosticsRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.TRUNCATE=1]="TRUNCATE",_[_.HUMANIZE=2]="HUMANIZE"})($.KEY_OPTION||($.KEY_OPTION={}))})(GetDiagnosticsRequest||(GetDiagnosticsRequest={}));var Platform;(function($){(function(_){_[_.BROWSER=0]="BROWSER",_[_.SHARED_WORKER=1]="SHARED_WORKER",_[_.NODE=2]="NODE"})($.PLATFORM_TYPE||($.PLATFORM_TYPE={}))})(Platform||(Platform={}));var DeviceKind;(function($){$[$.CURRENT=0]="CURRENT",$[$.TRUSTED=1]="TRUSTED"})(DeviceKind||(DeviceKind={}));var Device;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE",_[_.REMOVED=2]="REMOVED"})($.PresenceState||($.PresenceState={}))})(Device||(Device={}));var SpaceMember;(function($){(function(_){_[_.OFFLINE=0]="OFFLINE",_[_.ONLINE=1]="ONLINE"})($.PresenceState||($.PresenceState={}))})(SpaceMember||(SpaceMember={}));var CreateEpochRequest;(function($){(function(_){_[_.NONE=0]="NONE",_[_.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",_[_.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",_[_.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT",_[_.REPLACE_AUTOMERGE_ROOT=4]="REPLACE_AUTOMERGE_ROOT",_[_.MIGRATE_REFERENCES_TO_DXN=5]="MIGRATE_REFERENCES_TO_DXN"})($.Migration||($.Migration={}))})(CreateEpochRequest||(CreateEpochRequest={}));var QueryInvitationsResponse;(function($){(function(_){_[_.ADDED=0]="ADDED",_[_.REMOVED=1]="REMOVED",_[_.SAVED=2]="SAVED",_[_.LOAD_COMPLETE=3]="LOAD_COMPLETE"})($.Action||($.Action={})),function(_){_[_.CREATED=0]="CREATED",_[_.ACCEPTED=1]="ACCEPTED"}($.Type||($.Type={}))})(QueryInvitationsResponse||(QueryInvitationsResponse={}));var ConnectionState;(function($){$[$.OFFLINE=0]="OFFLINE",$[$.ONLINE=1]="ONLINE"})(ConnectionState||(ConnectionState={}));var ContextDisposedError=class extends Error{constructor(){super("Context disposed.")}};function _ts_decorate$1($,_,I,j){var U=arguments.length,q=U<3?_:j===null?j=Object.getOwnPropertyDescriptor(_,I):j,G;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,_,I,j);else for(var K=$.length-1;K>=0;K--)(G=$[K])&&(q=(U<3?G(q):U>3?G(_,I,q):G(_,I))||q);return U>3&&q&&Object.defineProperty(_,I,q),q}var __dxlog_file$6="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",MAX_SAFE_DISPOSE_CALLBACKS=300,DEFAULT_ERROR_HANDLER=($,_)=>{if(!($ instanceof ContextDisposedError))throw _.dispose(),$},CONTEXT_FLAG_IS_DISPOSED=1,CONTEXT_FLAG_LEAK_DETECTED=2,_a$1,_b,Context=(un=class{constructor(_={},I){Zt(this,Kt);Zt(this,Jt);Zt(this,an);Zt(this,ln);Zt(this,yn);Zt(this,On);Zt(this,Yt);Zt(this,dn);Vt(this,Jt,[]),Vt(this,an,void 0),Vt(this,ln,void 0),Vt(this,Yt,0),Vt(this,dn,void 0),this.maxSafeDisposeCallbacks=MAX_SAFE_DISPOSE_CALLBACKS,this[_b]="Context",this[_a$1]=()=>this.toString(),Vt(this,an,getContextName(_,I)),Vt(this,ln,_.parent),Vt(this,yn,_.attributes??{}),Vt(this,On,_.onError??DEFAULT_ERROR_HANDLER)}static default(){return new un}get disposed(){return kt(this,Kt,Wn)}get disposeCallbacksLength(){return kt(this,Jt).length}onDispose(_){if(kt(this,Kt,Wn)&&(async()=>{try{await _()}catch(I){log$2.catch(I,{context:kt(this,an)},{F:__dxlog_file$6,L:119,S:this,C:(j,U)=>j(...U)})}})(),kt(this,Jt).push(_),kt(this,Jt).length>this.maxSafeDisposeCallbacks&&!kt(this,Kt,jr)){Vt(this,Kt,!0,Ur);const I=new StackTrace().getStackArray(1)[0].trim();log$2.warn("Context has a large number of dispose callbacks (this might be a memory leak).",{context:kt(this,an),callSite:I,count:kt(this,Jt).length},{F:__dxlog_file$6,L:128,S:this,C:(j,U)=>j(...U)})}return()=>{const I=kt(this,Jt).indexOf(_);I!==-1&&kt(this,Jt).splice(I,1)}}async dispose(_=!1){if(kt(this,dn))return kt(this,dn);Vt(this,Kt,!0,Br);let I;const j=new Promise(J=>{I=J});Vt(this,dn,j);const U=Array.from(kt(this,Jt)).reverse();kt(this,Jt).length=0;let q=0,G=!0;const K=[];for(const J of U)try{await J(),q++}catch(Y){G=!1,_?K.push(Y):log$2.catch(Y,{context:kt(this,an),callback:q,count:U.length},{F:__dxlog_file$6,L:188,S:this,C:(X,Z)=>X(...Z)})}if(K.length>0)throw new AggregateError(K);return I(G),G}raise(_){if(!kt(this,Kt,Wn))try{kt(this,On).call(this,_,this)}catch(I){Promise.reject(I)}}derive({onError:_,attributes:I}={}){const j=new un({onError:async q=>{if(!_)this.raise(q);else try{await _(q,this)}catch{this.raise(q)}},attributes:I}),U=this.onDispose(()=>j.dispose());return j.onDispose(U),j}getAttribute(_){if(_ in kt(this,yn))return kt(this,yn)[_];if(kt(this,ln))return kt(this,ln).getAttribute(_)}toString(){return`Context(${kt(this,Kt,Wn)?"disposed":"active"})`}async[(_b=Symbol.toStringTag,_a$1=export_inspect.custom,Symbol.asyncDispose)](){await this.dispose()}},Jt=new WeakMap,an=new WeakMap,ln=new WeakMap,yn=new WeakMap,On=new WeakMap,Yt=new WeakMap,dn=new WeakMap,Kt=new WeakSet,Wn=function(){return!!(kt(this,Yt)&CONTEXT_FLAG_IS_DISPOSED)},Br=function(_){Vt(this,Yt,_?kt(this,Yt)|CONTEXT_FLAG_IS_DISPOSED:kt(this,Yt)&~CONTEXT_FLAG_IS_DISPOSED)},jr=function(){return!!(kt(this,Yt)&CONTEXT_FLAG_LEAK_DETECTED)},Ur=function(_){Vt(this,Yt,_?kt(this,Yt)|CONTEXT_FLAG_LEAK_DETECTED:kt(this,Yt)&~CONTEXT_FLAG_LEAK_DETECTED)},un);Context=_ts_decorate$1([safeInstanceof("Context")],Context);var getContextName=($,_)=>{var I;if($.name)return $.name;if((I=_==null?void 0:_.F)!=null&&I.length){const j=_==null?void 0:_.F.split("/");return`${j[j.length-1]}#${(_==null?void 0:_.L)??0}`}},LifecycleState;(function($){$.CLOSED="CLOSED",$.OPEN="OPEN",$.ERROR="ERROR"})(LifecycleState||(LifecycleState={}));var Observable$2={};Object.defineProperty(Observable$2,"__esModule",{value:!0}),Observable$2.Observable=void 0;const hasSymbol=$=>!!Symbol[$],getSymbol=$=>hasSymbol($)?Symbol[$]:"@@"+$,SymbolIterator=getSymbol("iterator"),SymbolObservable=getSymbol("observable"),SymbolSpecies=getSymbol("species");function getMethod($,_){let I=$[_];if(I!=null){if(typeof I!="function")throw new TypeError(I+" is not a function");return I}}function getSpecies($){let _=$.constructor;return _!==void 0&&(_=_[SymbolSpecies],_===null&&(_=void 0)),_!==void 0?_:Observable$1}function isObservable$1($){return $ instanceof Observable$1}function hostReportError($){hostReportError.log?hostReportError.log($):setTimeout(()=>{throw $})}function enqueue($){Promise.resolve().then(()=>{try{$()}catch(_){hostReportError(_)}})}function cleanupSubscription($){let _=$._cleanup;if(_!==void 0&&($._cleanup=void 0,!!_))try{if(typeof _=="function")_();else{let I=getMethod(_,"unsubscribe");I&&I.call(_)}}catch(I){hostReportError(I)}}function closeSubscription($){$._observer=void 0,$._queue=void 0,$._state="closed"}function flushSubscription($){let _=$._queue;if(_){$._queue=void 0,$._state="ready";for(let I=0;I<_.length&&(notifySubscription($,_[I].type,_[I].value),$._state!=="closed");++I);}}function notifySubscription($,_,I){$._state="running";let j=$._observer;try{let U=getMethod(j,_);switch(_){case"next":U&&U.call(j,I);break;case"error":if(closeSubscription($),U)U.call(j,I);else throw I;break;case"complete":closeSubscription($),U&&U.call(j);break}}catch(U){hostReportError(U)}$._state==="closed"?cleanupSubscription($):$._state==="running"&&($._state="ready")}function onNotify($,_,I){if($._state!=="closed"){if($._state==="buffering"){$._queue.push({type:_,value:I});return}if($._state!=="ready"){$._state="buffering",$._queue=[{type:_,value:I}],enqueue(()=>flushSubscription($));return}notifySubscription($,_,I)}}class Subscription{constructor(_,I){this._cleanup=void 0,this._observer=_,this._queue=void 0,this._state="initializing";let j=this,U={get closed(){return j._state==="closed"},next(q){onNotify(j,"next",q)},error(q){onNotify(j,"error",q)},complete(){onNotify(j,"complete")}};try{this._cleanup=I.call(void 0,U)}catch(q){U.error(q)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(closeSubscription(this),cleanupSubscription(this))}}let Observable$1=class nr{constructor(_){if(!(this instanceof nr))throw new TypeError("Observable cannot be called as a function");if(typeof _!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=_}subscribe(_){return(typeof _!="object"||_===null)&&(_={next:_,error:arguments[1],complete:arguments[2]}),new Subscription(_,this._subscriber)}forEach(_){return new Promise((I,j)=>{if(typeof _!="function"){j(new TypeError(_+" is not a function"));return}function U(){q.unsubscribe(),I()}let q=this.subscribe({next(G){try{_(G,U)}catch(K){j(K),q.unsubscribe()}},error:j,complete:I})})}map(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{U=_(U)}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}filter(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>this.subscribe({next(U){try{if(!_(U))return}catch(q){return j.error(q)}j.next(U)},error(U){j.error(U)},complete(){j.complete()}}))}reduce(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this),j=arguments.length>1,U=!1,G=arguments[1];return new I(K=>this.subscribe({next(J){let Y=!U;if(U=!0,!Y||j)try{G=_(G,J)}catch(X){return K.error(X)}else G=J},error(J){K.error(J)},complete(){if(!U&&!j)return K.error(new TypeError("Cannot reduce an empty sequence"));K.next(G),K.complete()}}))}async all(){let _=[];return await this.forEach(I=>_.push(I)),_}concat(..._){let I=getSpecies(this);return new I(j=>{let U,q=0;function G(K){U=K.subscribe({next(J){j.next(J)},error(J){j.error(J)},complete(){q===_.length?(U=void 0,j.complete()):G(I.from(_[q++]))}})}return G(this),()=>{U&&(U.unsubscribe(),U=void 0)}})}flatMap(_){if(typeof _!="function")throw new TypeError(_+" is not a function");let I=getSpecies(this);return new I(j=>{let U=[],q=this.subscribe({next(K){if(_)try{K=_(K)}catch(Y){return j.error(Y)}let J=I.from(K).subscribe({next(Y){j.next(Y)},error(Y){j.error(Y)},complete(){let Y=U.indexOf(J);Y>=0&&U.splice(Y,1),G()}});U.push(J)},error(K){j.error(K)},complete(){G()}});function G(){q.closed&&U.length===0&&j.complete()}return()=>{U.forEach(K=>K.unsubscribe()),q.unsubscribe()}})}[SymbolObservable](){return this}static from(_){let I=typeof this=="function"?this:nr;if(_==null)throw new TypeError(_+" is not an object");let j=getMethod(_,SymbolObservable);if(j){let U=j.call(_);if(Object(U)!==U)throw new TypeError(U+" is not an object");return isObservable$1(U)&&U.constructor===I?U:new I(q=>U.subscribe(q))}if(hasSymbol("iterator")&&(j=getMethod(_,SymbolIterator),j))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q of j.call(_))if(U.next(q),U.closed)return;U.complete()}})});if(Array.isArray(_))return new I(U=>{enqueue(()=>{if(!U.closed){for(let q=0;q<_.length;++q)if(U.next(_[q]),U.closed)return;U.complete()}})});throw new TypeError(_+" is not observable")}static of(..._){let I=typeof this=="function"?this:nr;return new I(j=>{enqueue(()=>{if(!j.closed){for(let U=0;U<_.length;++U)if(j.next(_[U]),j.closed)return;j.complete()}})})}static get[SymbolSpecies](){return this}};Observable$2.Observable=Observable$1,Object.defineProperty(Observable$1,Symbol("extensions"),{value:{symbol:SymbolObservable,hostReportError},configurable:!0});var zenObservable=Observable$2.Observable;const Observable=getDefaultExportFromCjs(zenObservable);var readableBrowser={exports:{}},events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function(_,I,j){return Function.prototype.apply.call(_,I,j)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(_){return Object.getOwnPropertyNames(_).concat(Object.getOwnPropertySymbols(_))}:ReflectOwnKeys=function(_){return Object.getOwnPropertyNames(_)};function ProcessEmitWarning($){console&&console.warn&&console.warn($)}var NumberIsNaN=Number.isNaN||function(_){return _!==_};function EventEmitter$1(){EventEmitter$1.init.call(this)}events.exports=EventEmitter$1,events.exports.once=once$2,EventEmitter$1.EventEmitter=EventEmitter$1,EventEmitter$1.prototype._events=void 0,EventEmitter$1.prototype._eventsCount=0,EventEmitter$1.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener($){if(typeof $!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof $)}Object.defineProperty(EventEmitter$1,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function($){if(typeof $!="number"||$<0||NumberIsNaN($))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+$+".");defaultMaxListeners=$}}),EventEmitter$1.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},EventEmitter$1.prototype.setMaxListeners=function(_){if(typeof _!="number"||_<0||NumberIsNaN(_))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+_+".");return this._maxListeners=_,this};function _getMaxListeners($){return $._maxListeners===void 0?EventEmitter$1.defaultMaxListeners:$._maxListeners}EventEmitter$1.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter$1.prototype.emit=function(_){for(var I=[],j=1;j<arguments.length;j++)I.push(arguments[j]);var U=_==="error",q=this._events;if(q!==void 0)U=U&&q.error===void 0;else if(!U)return!1;if(U){var G;if(I.length>0&&(G=I[0]),G instanceof Error)throw G;var K=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw K.context=G,K}var J=q[_];if(J===void 0)return!1;if(typeof J=="function")ReflectApply(J,this,I);else for(var Y=J.length,X=arrayClone(J,Y),j=0;j<Y;++j)ReflectApply(X[j],this,I);return!0};function _addListener($,_,I,j){var U,q,G;if(checkListener(I),q=$._events,q===void 0?(q=$._events=Object.create(null),$._eventsCount=0):(q.newListener!==void 0&&($.emit("newListener",_,I.listener?I.listener:I),q=$._events),G=q[_]),G===void 0)G=q[_]=I,++$._eventsCount;else if(typeof G=="function"?G=q[_]=j?[I,G]:[G,I]:j?G.unshift(I):G.push(I),U=_getMaxListeners($),U>0&&G.length>U&&!G.warned){G.warned=!0;var K=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");K.name="MaxListenersExceededWarning",K.emitter=$,K.type=_,K.count=G.length,ProcessEmitWarning(K)}return $}EventEmitter$1.prototype.addListener=function(_,I){return _addListener(this,_,I,!1)},EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener,EventEmitter$1.prototype.prependListener=function(_,I){return _addListener(this,_,I,!0)};function onceWrapper(){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 _onceWrap($,_,I){var j={fired:!1,wrapFn:void 0,target:$,type:_,listener:I},U=onceWrapper.bind(j);return U.listener=I,j.wrapFn=U,U}EventEmitter$1.prototype.once=function(_,I){return checkListener(I),this.on(_,_onceWrap(this,_,I)),this},EventEmitter$1.prototype.prependOnceListener=function(_,I){return checkListener(I),this.prependListener(_,_onceWrap(this,_,I)),this},EventEmitter$1.prototype.removeListener=function(_,I){var j,U,q,G,K;if(checkListener(I),U=this._events,U===void 0)return this;if(j=U[_],j===void 0)return this;if(j===I||j.listener===I)--this._eventsCount===0?this._events=Object.create(null):(delete U[_],U.removeListener&&this.emit("removeListener",_,j.listener||I));else if(typeof j!="function"){for(q=-1,G=j.length-1;G>=0;G--)if(j[G]===I||j[G].listener===I){K=j[G].listener,q=G;break}if(q<0)return this;q===0?j.shift():spliceOne(j,q),j.length===1&&(U[_]=j[0]),U.removeListener!==void 0&&this.emit("removeListener",_,K||I)}return this},EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener,EventEmitter$1.prototype.removeAllListeners=function(_){var I,j,U;if(j=this._events,j===void 0)return this;if(j.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):j[_]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[_]),this;if(arguments.length===0){var q=Object.keys(j),G;for(U=0;U<q.length;++U)G=q[U],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(I=j[_],typeof I=="function")this.removeListener(_,I);else if(I!==void 0)for(U=I.length-1;U>=0;U--)this.removeListener(_,I[U]);return this};function _listeners($,_,I){var j=$._events;if(j===void 0)return[];var U=j[_];return U===void 0?[]:typeof U=="function"?I?[U.listener||U]:[U]:I?unwrapListeners(U):arrayClone(U,U.length)}EventEmitter$1.prototype.listeners=function(_){return _listeners(this,_,!0)},EventEmitter$1.prototype.rawListeners=function(_){return _listeners(this,_,!1)},EventEmitter$1.listenerCount=function($,_){return typeof $.listenerCount=="function"?$.listenerCount(_):listenerCount.call($,_)},EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount($){var _=this._events;if(_!==void 0){var I=_[$];if(typeof I=="function")return 1;if(I!==void 0)return I.length}return 0}EventEmitter$1.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone($,_){for(var I=new Array(_),j=0;j<_;++j)I[j]=$[j];return I}function spliceOne($,_){for(;_+1<$.length;_++)$[_]=$[_+1];$.pop()}function unwrapListeners($){for(var _=new Array($.length),I=0;I<_.length;++I)_[I]=$[I].listener||$[I];return _}function once$2($,_){return new Promise(function(I,j){function U(G){$.removeListener(_,q),j(G)}function q(){typeof $.removeListener=="function"&&$.removeListener("error",U),I([].slice.call(arguments))}eventTargetAgnosticAddListener($,_,q,{once:!0}),_!=="error"&&addErrorHandlerIfEventEmitter($,U,{once:!0})})}function addErrorHandlerIfEventEmitter($,_,I){typeof $.on=="function"&&eventTargetAgnosticAddListener($,"error",_,I)}function eventTargetAgnosticAddListener($,_,I,j){if(typeof $.on=="function")j.once?$.once(_,I):$.on(_,I);else if(typeof $.addEventListener=="function")$.addEventListener(_,function U(q){j.once&&$.removeEventListener(_,U),I(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof $)}var eventsExports=events.exports,streamBrowser=eventsExports.EventEmitter,buffer={},base64Js={};base64Js.byteLength=byteLength,base64Js.toByteArray=toByteArray,base64Js.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i$1=0,len=code.length;i$1<len;++i$1)lookup[i$1]=code[i$1],revLookup[code.charCodeAt(i$1)]=i$1;revLookup[45]=62,revLookup[95]=63;function getLens($){var _=$.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=$.indexOf("=");I===-1&&(I=_);var j=I===_?0:4-I%4;return[I,j]}function byteLength($){var _=getLens($),I=_[0],j=_[1];return(I+j)*3/4-j}function _byteLength($,_,I){return(_+I)*3/4-I}function toByteArray($){var _,I=getLens($),j=I[0],U=I[1],q=new Arr(_byteLength($,j,U)),G=0,K=U>0?j-4:j,J;for(J=0;J<K;J+=4)_=revLookup[$.charCodeAt(J)]<<18|revLookup[$.charCodeAt(J+1)]<<12|revLookup[$.charCodeAt(J+2)]<<6|revLookup[$.charCodeAt(J+3)],q[G++]=_>>16&255,q[G++]=_>>8&255,q[G++]=_&255;return U===2&&(_=revLookup[$.charCodeAt(J)]<<2|revLookup[$.charCodeAt(J+1)]>>4,q[G++]=_&255),U===1&&(_=revLookup[$.charCodeAt(J)]<<10|revLookup[$.charCodeAt(J+1)]<<4|revLookup[$.charCodeAt(J+2)]>>2,q[G++]=_>>8&255,q[G++]=_&255),q}function tripletToBase64($){return lookup[$>>18&63]+lookup[$>>12&63]+lookup[$>>6&63]+lookup[$&63]}function encodeChunk($,_,I){for(var j,U=[],q=_;q<I;q+=3)j=($[q]<<16&16711680)+($[q+1]<<8&65280)+($[q+2]&255),U.push(tripletToBase64(j));return U.join("")}function fromByteArray($){for(var _,I=$.length,j=I%3,U=[],q=16383,G=0,K=I-j;G<K;G+=q)U.push(encodeChunk($,G,G+q>K?K:G+q));return j===1?(_=$[I-1],U.push(lookup[_>>2]+lookup[_<<4&63]+"==")):j===2&&(_=($[I-2]<<8)+$[I-1],U.push(lookup[_>>10]+lookup[_>>4&63]+lookup[_<<2&63]+"=")),U.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function($,_,I,j,U){var q,G,K=U*8-j-1,J=(1<<K)-1,Y=J>>1,X=-7,Z=I?U-1:0,Q=I?-1:1,ee=$[_+Z];for(Z+=Q,q=ee&(1<<-X)-1,ee>>=-X,X+=K;X>0;q=q*256+$[_+Z],Z+=Q,X-=8);for(G=q&(1<<-X)-1,q>>=-X,X+=j;X>0;G=G*256+$[_+Z],Z+=Q,X-=8);if(q===0)q=1-Y;else{if(q===J)return G?NaN:(ee?-1:1)*(1/0);G=G+Math.pow(2,j),q=q-Y}return(ee?-1:1)*G*Math.pow(2,q-j)},ieee754.write=function($,_,I,j,U,q){var G,K,J,Y=q*8-U-1,X=(1<<Y)-1,Z=X>>1,Q=U===23?Math.pow(2,-24)-Math.pow(2,-77):0,ee=j?0:q-1,ne=j?1:-1,re=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(K=isNaN(_)?1:0,G=X):(G=Math.floor(Math.log(_)/Math.LN2),_*(J=Math.pow(2,-G))<1&&(G--,J*=2),G+Z>=1?_+=Q/J:_+=Q*Math.pow(2,1-Z),_*J>=2&&(G++,J/=2),G+Z>=X?(K=0,G=X):G+Z>=1?(K=(_*J-1)*Math.pow(2,U),G=G+Z):(K=_*Math.pow(2,Z-1)*Math.pow(2,U),G=0));U>=8;$[I+ee]=K&255,ee+=ne,K/=256,U-=8);for(G=G<<U|K,Y+=U;Y>0;$[I+ee]=G&255,ee+=ne,G/=256,Y-=8);$[I+ee-ne]|=re*128};/*!
|
|
922
922
|
* The buffer module from node.js, for the browser.
|
|
923
923
|
*
|
|
924
924
|
* @author Feross Aboukhadijeh <https://feross.org>
|