@dxos/shell 0.5.1-main.ac072cc → 0.5.1-main.accecb9

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.
@@ -840,7 +840,7 @@ button {
840
840
  background-color: #61493f;
841
841
  }
842
842
 
843
- `;function UL(e){const n=l.useRef(null),t=l.useRef(null);return t.current&&t.current.update(e),l.useEffect(()=>(t.current=new Eu({...e,ref:n}),()=>{t.current=null}),[]),l.createElement("div",{ref:n})}const WL=({disabled:e,defaultEmoji:n,emoji:t,onChangeEmoji:i,classNames:r})=>{const{t:a}=vn("os"),[o,s]=kt({prop:t,onChange:i,defaultProp:n}),[f,d]=l.useState(!1),c=l.useRef(!1),[u,h]=l.useState(!1);return l.createElement(Ze.Root,{open:u,onOpenChange:p=>{c.current?(h(!1),c.current=!1):h(p)}},l.createElement(of.Root,{open:f,onOpenChange:p=>{d(p),c.current=!0}},l.createElement(Ze.Trigger,{asChild:!0},l.createElement(of.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:["gap-2 text-2xl plb-1",r],disabled:e},l.createElement("span",{className:"sr-only"},a("select emoji label")),l.createElement(qe.ImageSquare,{className:He(5)})))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},a("select emoji label"),l.createElement(Ze.Arrow,null))),l.createElement(of.Content,{side:"bottom",onKeyDownCapture:p=>{p.key==="Escape"&&(p.stopPropagation(),d(!1),c.current=!0)}},l.createElement(UL,{data:iL,onEmojiSelect:({native:p})=>{p&&(s(p),d(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0}),l.createElement(of.Arrow,null))))},HL=({hue:e})=>{const{tx:n}=Ae();return l.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12"},l.createElement("rect",{x:0,y:0,width:12,height:12,className:n("hue.fill","select--hue__preview",{hue:e})}))},VL=({disabled:e,hue:n,onChangeHue:t,classNames:i,defaultHue:r})=>{const{t:a}=vn("os"),[o,s]=kt({prop:n,onChange:t,defaultProp:r}),[f,d]=l.useState(!1),c=l.useRef(!1),[u,h]=l.useState(!1);return l.createElement(Ze.Root,{open:u,onOpenChange:p=>{c.current?(h(!1),c.current=!1):h(p)}},l.createElement(Dn.Root,{modal:!1,open:f,onOpenChange:p=>{d(p),c.current=!0}},l.createElement(Ze.Trigger,{asChild:!0},l.createElement(Dn.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:le("gap-2 plb-1",i),disabled:e},l.createElement("span",{className:"sr-only"},a("select hue label")),l.createElement(qe.Palette,{className:He(5)})))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},a("select hue label"),l.createElement(Ze.Arrow,null))),l.createElement(Dn.Content,{side:"bottom"},l.createElement(Dn.Viewport,null,Object.keys(aa).map(p=>l.createElement(Dn.CheckboxItem,{key:p,checked:p===o,onCheckedChange:()=>s(p)},l.createElement(HL,{hue:p}),l.createElement("span",{className:"grow"},a(`${p} label`)),l.createElement(Dn.ItemIndicator,null,l.createElement(qe.Check,null))))),l.createElement(Dn.Arrow,null))))};var Mf={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"]},hw=e=>e.charAt(0).toUpperCase()+e.slice(1),Nf=e=>{const n=e.length*2/3,t=e.substring(0,n),i=e.substring(n),r=hw(Mf.adjectives[parseInt(t,16)%Mf.adjectives.length]),a=hw(Mf.animals[parseInt(i,16)%Mf.animals.length]);return`${r} ${a}`};const qL=l.forwardRef(({identity:e,presence:n,onClick:t,classNames:i,...r},a)=>{var d,c,u,h,p;const o=oc(e.identityKey),s=$n("identityListItem__label"),f=((d=e.profile)==null?void 0:d.displayName)??Nf(e.identityKey.toHex());return l.createElement(af.Root,{...r,classNames:le("flex gap-2 pis-3 pie-1 items-center",t&&"cursor-pointer",i),onClick:()=>t==null?void 0:t(),"data-testid":"identity-list-item",labelId:s,ref:a},l.createElement(wn.Root,{status:n===Jo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:s,hue:((u=(c=e.profile)==null?void 0:c.data)==null?void 0:u.hue)||o.hue},l.createElement(wn.Frame,{classNames:"place-self-center"},l.createElement(wn.Fallback,{text:((p=(h=e.profile)==null?void 0:h.data)==null?void 0:p.emoji)||o.emoji})),l.createElement(wn.Label,{classNames:"text-sm truncate pli-2"},f)))}),GL=({spaceKey:e,includeSelf:n,onSelect:t})=>{const i=Re.useClient(),r=Jo.useMembers(e),a=l.useMemo(()=>n?r.sort(o=>o.identity.identityKey.equals(i.halo.identity.get().identityKey)?-1:1):r.filter(o=>!o.identity.identityKey.equals(i.halo.identity.get().identityKey)),[r]);return l.createElement(KL,{members:a,onSelect:t})},KL=({members:e,onSelect:n})=>{const{t}=vn("os"),i=e.filter(r=>r.identity);return i.length>0?l.createElement(Fc,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},i.map(r=>l.createElement(qL,{key:r.identity.identityKey.toHex(),identity:r.identity,presence:r.presence,onClick:n&&(()=>n(r))}))):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(In,"text-center is-full mlb-2")},t("empty space members message")))},_o={weight:"duotone",width:24,height:24,x:8,y:8},YL=l.forwardRef(({device:e,onClickAdd:n,onClickEdit:t,onClickReset:i,onClickJoinExisting:r,classNames:a,...o},s)=>{var p;const{t:f}=vn("os"),d=oc(e.deviceKey),c=$n("identityListItem__label"),u=e.profile?f("device name placeholder",{os:e.profile.os,platform:e.profile.platform}):Nf(e.deviceKey.toHex()),h=e.kind===vt.DeviceKind.CURRENT;return l.createElement(af.Root,{...o,classNames:["flex gap-2 items-center mlb-2",a],"data-testid":`device-list-item${h?"-current":""}`,labelId:c,ref:s},l.createElement(wn.Root,{status:e.presence===vt.Device.PresenceState.ONLINE?"active":"inactive",labelId:c,hue:d.hue,variant:"square"},l.createElement(wn.Frame,{classNames:"place-self-center"},(p=e.profile)!=null&&p.type?e.profile.type===vt.DeviceType.BROWSER?l.createElement(qe.Compass,{..._o}):e.profile.type===vt.DeviceType.NATIVE?l.createElement(qe.Desktop,{..._o}):[vt.DeviceType.AGENT,vt.DeviceType.AGENT_MANAGED].includes(e.profile.type)?l.createElement(qe.Robot,{..._o}):e.profile.type===vt.DeviceType.MOBILE?l.createElement(qe.DeviceMobile,{..._o}):l.createElement(qe.Devices,{..._o}):l.createElement(wn.Fallback,{text:d.emoji})),h&&l.createElement(LO,{color:"primary"},f("current device tag label")),l.createElement(wn.Label,{classNames:"flex-1 text-sm truncate"},u),e.kind===vt.DeviceKind.CURRENT&&l.createElement(Dn.Root,null,l.createElement(Dn.Trigger,{asChild:!0},l.createElement(jn,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${h?"-current":""}.options`},l.createElement("span",{className:"sr-only"},f("more options label")),l.createElement(qe.DotsThree,{className:He(5)}))),l.createElement(Dn.Content,null,l.createElement(Dn.Viewport,null,l.createElement(Dn.Item,{"data-testid":"device-list-item-current.join-existing",onClick:r},l.createElement(qe.Intersect,{className:He(5)}),f("choose join new identity label")),l.createElement(Dn.Item,{"data-testid":"device-list-item-current.reset",onClick:i},l.createElement(qe.Power,{className:He(5)}),f("reset device label")))))))}),JL=({devices:e,onClickAdd:n,onClickEdit:t,onClickReset:i,onClickJoinExisting:r})=>{const{t:a}=vn("os");return l.createElement(l.Fragment,null,l.createElement("h2",{className:le(In,"text-center mbs-4")},a("devices heading")),e.length>0&&l.createElement(Fc,null,e.map(o=>l.createElement(YL,{key:o.deviceKey.toHex(),device:o,onClickEdit:()=>t==null?void 0:t(o),onClickReset:i,onClickJoinExisting:r}))),l.createElement(jn,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3","data-testid":"devices-panel.create-invitation",onClick:n},l.createElement("div",{role:"img",className:le(He(8),"m-1 rounded-sm surface-input grid place-items-center")},l.createElement(qe.Plus,{weight:"light",className:He(6)})),l.createElement("span",{className:"grow font-medium text-start"},a("choose add device label")),l.createElement(qe.CaretRight,{weight:"bold",className:He(4)})))},Df=43200,vw=1440;function pw(e){const n=Wn(e),t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+e-+t}function Lf(e,n){const t=Wn(e),i=Wn(n),r=t.getTime()-i.getTime();return r<0?-1:r>0?1:r}function XL(e,n){const t=Wn(e),i=Wn(n),r=t.getFullYear()-i.getFullYear(),a=t.getMonth()-i.getMonth();return r*12+a}function ZL(e){return n=>{const i=(e?Math[e]:Math.trunc)(n);return i===0?0:i}}function QL(e,n){return+Wn(e)-+Wn(n)}function eB(e){const n=Wn(e);return n.setHours(23,59,59,999),n}function nB(e){const n=Wn(e),t=n.getMonth();return n.setFullYear(n.getFullYear(),t+1,0),n.setHours(23,59,59,999),n}function tB(e){const n=Wn(e);return+eB(n)==+nB(n)}function iB(e,n){const t=Wn(e),i=Wn(n),r=Lf(t,i),a=Math.abs(XL(t,i));let o;if(a<1)o=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-r*a);let s=Lf(t,i)===-r;tB(Wn(e))&&a===1&&Lf(e,i)===1&&(s=!1),o=r*(a-Number(s))}return o===0?0:o}function rB(e,n,t){const i=QL(e,n)/1e3;return ZL(t==null?void 0:t.roundingMethod)(i)}function aB(e,n,t){const i=Nk(),r=(t==null?void 0:t.locale)??i.locale??u1,a=2520,o=Lf(e,n);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o});let f,d;o>0?(f=Wn(n),d=Wn(e)):(f=Wn(e),d=Wn(n));const c=rB(d,f),u=(pw(d)-pw(f))/1e3,h=Math.round((c-u)/60);let p;if(h<2)return t!=null&&t.includeSeconds?c<5?r.formatDistance("lessThanXSeconds",5,s):c<10?r.formatDistance("lessThanXSeconds",10,s):c<20?r.formatDistance("lessThanXSeconds",20,s):c<40?r.formatDistance("halfAMinute",0,s):c<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):h===0?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",h,s);if(h<45)return r.formatDistance("xMinutes",h,s);if(h<90)return r.formatDistance("aboutXHours",1,s);if(h<vw){const g=Math.round(h/60);return r.formatDistance("aboutXHours",g,s)}else{if(h<a)return r.formatDistance("xDays",1,s);if(h<Df){const g=Math.round(h/vw);return r.formatDistance("xDays",g,s)}else if(h<Df*2)return p=Math.round(h/Df),r.formatDistance("aboutXMonths",p,s)}if(p=iB(d,f),p<12){const g=Math.round(h/Df);return r.formatDistance("xMonths",g,s)}else{const g=p%12,b=Math.trunc(p/12);return g<3?r.formatDistance("aboutXYears",b,s):g<9?r.formatDistance("overXYears",b,s):r.formatDistance("almostXYears",b+1,s)}}function oB(e,n){return aB(e,Date.now(),n)}var mw;(function(e){e[e.ACTIVE=0]="ACTIVE",e[e.INACTIVE=1]="INACTIVE"})(mw||(mw={}));var gw;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.TRUNCATE=1]="TRUNCATE",n[n.HUMANIZE=2]="HUMANIZE"})(e.KEY_OPTION||(e.KEY_OPTION={}))})(gw||(gw={}));var bw;(function(e){(function(n){n[n.BROWSER=0]="BROWSER",n[n.SHARED_WORKER=1]="SHARED_WORKER",n[n.NODE=2]="NODE"})(e.PLATFORM_TYPE||(e.PLATFORM_TYPE={}))})(bw||(bw={}));var yw;(function(e){e[e.CURRENT=0]="CURRENT",e[e.TRUSTED=1]="TRUSTED"})(yw||(yw={}));var ww;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(ww||(ww={}));var _w;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(_w||(_w={}));var kw;(function(e){e[e.INACTIVE=2]="INACTIVE",e[e.ACTIVE=6]="ACTIVE",e[e.CLOSED=1]="CLOSED",e[e.CONTROL_ONLY=7]="CONTROL_ONLY",e[e.INITIALIZING=4]="INITIALIZING",e[e.READY=3]="READY",e[e.ERROR=5]="ERROR"})(kw||(kw={}));var xw;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",n[n.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",n[n.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT"})(e.Migration||(e.Migration={}))})(xw||(xw={}));var Se;(function(e){(function(n){n[n.INTERACTIVE=0]="INTERACTIVE",n[n.DELEGATED=1]="DELEGATED",n[n.MULTIUSE=2]="MULTIUSE"})(e.Type||(e.Type={})),function(n){n[n.DEVICE=0]="DEVICE",n[n.SPACE=1]="SPACE"}(e.Kind||(e.Kind={})),function(n){n[n.NONE=0]="NONE",n[n.SHARED_SECRET=1]="SHARED_SECRET",n[n.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}(e.AuthMethod||(e.AuthMethod={})),function(n){n[n.INIT=0]="INIT",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",n[n.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",n[n.AUTHENTICATING=4]="AUTHENTICATING",n[n.SUCCESS=5]="SUCCESS",n[n.CANCELLED=6]="CANCELLED",n[n.TIMEOUT=7]="TIMEOUT",n[n.ERROR=8]="ERROR",n[n.EXPIRED=9]="EXPIRED"}(e.State||(e.State={}))})(Se||(Se={}));var Ew;(function(e){(function(n){n[n.ADDED=0]="ADDED",n[n.REMOVED=1]="REMOVED",n[n.SAVED=2]="SAVED",n[n.LOAD_COMPLETE=3]="LOAD_COMPLETE"})(e.Action||(e.Action={})),function(n){n[n.CREATED=0]="CREATED",n[n.ACCEPTED=1]="ACCEPTED"}(e.Type||(e.Type={}))})(Ew||(Ew={}));var Sw;(function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE"})(Sw||(Sw={}));var Cw;(function(e){e[e.TRACE=5]="TRACE",e[e.DEBUG=10]="DEBUG",e[e.INFO=11]="INFO",e[e.WARN=12]="WARN",e[e.ERROR=13]="ERROR"})(Cw||(Cw={}));var $w;(function(e){(function(n){n[n.INCLUSIVE=1]="INCLUSIVE",n[n.EXPLICIT=2]="EXPLICIT"})(e.MatchingOptions||(e.MatchingOptions={}))})($w||($w={}));var sB=class extends Error{constructor(){super("Context disposed.")}};function fB(e,n,t,i){var r=arguments.length,a=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,t,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(n,t,a):o(n,t))||a);return r>3&&a&&Object.defineProperty(n,t,a),a}var Su="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",lB=300,Tw,Aw,Ow=(Sa=class{constructor({onError:n=r=>{if(!(r instanceof sB))throw this.dispose(),r},attributes:t={},parent:i}={}){this._disposeCallbacks=[],this._isDisposed=!1,this._disposePromise=void 0,this._parent=null,this.maxSafeDisposeCallbacks=lB,this[Tw]="Context",this[Aw]=()=>this.toString(),this._onError=n,this._attributes=t,i!==void 0&&(this._parent=i)}static default(){return new Sa}get disposed(){return this._isDisposed}get disposeCallbacksLength(){return this._disposeCallbacks.length}onDispose(n){return this._isDisposed&&(async()=>{try{await n()}catch(t){Ge.catch(t,void 0,{F:Su,L:88,S:this,C:(i,r)=>i(...r)})}})(),this._disposeCallbacks.push(n),this._disposeCallbacks.length>this.maxSafeDisposeCallbacks&&Ge.warn("Context has a large number of dispose callbacks. This might be a memory leak.",{count:this._disposeCallbacks.length,safeThreshold:this.maxSafeDisposeCallbacks},{F:Su,L:95,S:this,C:(t,i)=>t(...i)}),()=>{const t=this._disposeCallbacks.indexOf(n);t!==-1&&this._disposeCallbacks.splice(t,1)}}async dispose(){if(this._disposePromise)return this._disposePromise;this._isDisposed=!0;let n;this._disposePromise=new Promise(i=>{n=i});const t=Array.from(this._disposeCallbacks).reverse();this._disposeCallbacks.length=0;for(const i of t)try{await i()}catch(r){Ge.catch(r,void 0,{F:Su,L:136,S:this,C:(a,o)=>a(...o)})}n()}raise(n){if(!this._isDisposed)try{this._onError(n)}catch(t){Promise.reject(t)}}derive({onError:n,attributes:t}={}){const i=new Sa({onError:async a=>{if(!n)this.raise(a);else try{await n(a)}catch{this.raise(a)}},attributes:t}),r=this.onDispose(()=>i.dispose());return i.onDispose(r),i}getAttribute(n){if(n in this._attributes)return this._attributes[n];if(this._parent!==null)return this._parent.getAttribute(n)}toString(){return`Context(${this._isDisposed?"disposed":"active"})`}},Tw=Symbol.toStringTag,Aw=Et.custom,Sa);Ow=fB([p$("Context")],Ow);var Pw;(function(e){e.CLOSED="CLOSED",e.OPEN="OPEN",e.ERROR="ERROR"})(Pw||(Pw={}));var Bf={};Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.Observable=void 0;const Iw=e=>!!Symbol[e],Cu=e=>Iw(e)?Symbol[e]:"@@"+e,dB=Cu("iterator"),$u=Cu("observable"),Fw=Cu("species");function jf(e,n){let t=e[n];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ko(e){let n=e.constructor;return n!==void 0&&(n=n[Fw],n===null&&(n=void 0)),n!==void 0?n:zf}function cB(e){return e instanceof zf}function ua(e){ua.log?ua.log(e):setTimeout(()=>{throw e})}function Rf(e){Promise.resolve().then(()=>{try{e()}catch(n){ua(n)}})}function Mw(e){let n=e._cleanup;if(n!==void 0&&(e._cleanup=void 0,!!n))try{if(typeof n=="function")n();else{let t=jf(n,"unsubscribe");t&&t.call(n)}}catch(t){ua(t)}}function Tu(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function uB(e){let n=e._queue;if(n){e._queue=void 0,e._state="ready";for(let t=0;t<n.length&&(Nw(e,n[t].type,n[t].value),e._state!=="closed");++t);}}function Nw(e,n,t){e._state="running";let i=e._observer;try{let r=jf(i,n);switch(n){case"next":r&&r.call(i,t);break;case"error":if(Tu(e),r)r.call(i,t);else throw t;break;case"complete":Tu(e),r&&r.call(i);break}}catch(r){ua(r)}e._state==="closed"?Mw(e):e._state==="running"&&(e._state="ready")}function Au(e,n,t){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:n,value:t});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:n,value:t}],Rf(()=>uB(e));return}Nw(e,n,t)}}class hB{constructor(n,t){this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";let i=this,r={get closed(){return i._state==="closed"},next(a){Au(i,"next",a)},error(a){Au(i,"error",a)},complete(){Au(i,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(a){r.error(a)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Tu(this),Mw(this))}}let zf=class Ol{constructor(n){if(!(this instanceof Ol))throw new TypeError("Observable cannot be called as a function");if(typeof n!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=n}subscribe(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new hB(n,this._subscriber)}forEach(n){return new Promise((t,i)=>{if(typeof n!="function"){i(new TypeError(n+" is not a function"));return}function r(){a.unsubscribe(),t()}let a=this.subscribe({next(o){try{n(o,r)}catch(s){i(s),a.unsubscribe()}},error:i,complete:t})})}map(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>this.subscribe({next(r){try{r=n(r)}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}filter(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>this.subscribe({next(r){try{if(!n(r))return}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}reduce(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this),i=arguments.length>1,r=!1,o=arguments[1];return new t(s=>this.subscribe({next(f){let d=!r;if(r=!0,!d||i)try{o=n(o,f)}catch(c){return s.error(c)}else o=f},error(f){s.error(f)},complete(){if(!r&&!i)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(o),s.complete()}}))}async all(){let n=[];return await this.forEach(t=>n.push(t)),n}concat(...n){let t=ko(this);return new t(i=>{let r,a=0;function o(s){r=s.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){a===n.length?(r=void 0,i.complete()):o(t.from(n[a++]))}})}return o(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>{let r=[],a=this.subscribe({next(s){if(n)try{s=n(s)}catch(d){return i.error(d)}let f=t.from(s).subscribe({next(d){i.next(d)},error(d){i.error(d)},complete(){let d=r.indexOf(f);d>=0&&r.splice(d,1),o()}});r.push(f)},error(s){i.error(s)},complete(){o()}});function o(){a.closed&&r.length===0&&i.complete()}return()=>{r.forEach(s=>s.unsubscribe()),a.unsubscribe()}})}[$u](){return this}static from(n){let t=typeof this=="function"?this:Ol;if(n==null)throw new TypeError(n+" is not an object");let i=jf(n,$u);if(i){let r=i.call(n);if(Object(r)!==r)throw new TypeError(r+" is not an object");return cB(r)&&r.constructor===t?r:new t(a=>r.subscribe(a))}if(Iw("iterator")&&(i=jf(n,dB),i))return new t(r=>{Rf(()=>{if(!r.closed){for(let a of i.call(n))if(r.next(a),r.closed)return;r.complete()}})});if(Array.isArray(n))return new t(r=>{Rf(()=>{if(!r.closed){for(let a=0;a<n.length;++a)if(r.next(n[a]),r.closed)return;r.complete()}})});throw new TypeError(n+" is not observable")}static of(...n){let t=typeof this=="function"?this:Ol;return new t(i=>{Rf(()=>{if(!i.closed){for(let r=0;r<n.length;++r)if(i.next(n[r]),i.closed)return;i.complete()}})})}static get[Fw](){return this}};Bf.Observable=zf,Object.defineProperty(zf,Symbol("extensions"),{value:{symbol:$u,hostReportError:ua},configurable:!0});var vB=Bf.Observable;const Uf=Qi(vB);var Dw={exports:{}},Ou={exports:{}},ha=typeof Reflect=="object"?Reflect:null,Lw=ha&&typeof ha.apply=="function"?ha.apply:function(n,t,i){return Function.prototype.apply.call(n,t,i)},Wf;ha&&typeof ha.ownKeys=="function"?Wf=ha.ownKeys:Object.getOwnPropertySymbols?Wf=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Wf=function(n){return Object.getOwnPropertyNames(n)};function pB(e){console&&console.warn&&console.warn(e)}var Bw=Number.isNaN||function(n){return n!==n};function gn(){gn.init.call(this)}Ou.exports=gn,Ou.exports.once=yB,gn.EventEmitter=gn,gn.prototype._events=void 0,gn.prototype._eventsCount=0,gn.prototype._maxListeners=void 0;var jw=10;function Hf(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(gn,"defaultMaxListeners",{enumerable:!0,get:function(){return jw},set:function(e){if(typeof e!="number"||e<0||Bw(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");jw=e}}),gn.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},gn.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||Bw(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function Rw(e){return e._maxListeners===void 0?gn.defaultMaxListeners:e._maxListeners}gn.prototype.getMaxListeners=function(){return Rw(this)},gn.prototype.emit=function(n){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=n==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var f=a[n];if(f===void 0)return!1;if(typeof f=="function")Lw(f,this,t);else for(var d=f.length,c=Vw(f,d),i=0;i<d;++i)Lw(c[i],this,t);return!0};function zw(e,n,t,i){var r,a,o;if(Hf(t),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",n,t.listener?t.listener:t),a=e._events),o=a[n]),o===void 0)o=a[n]=t,++e._eventsCount;else if(typeof o=="function"?o=a[n]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),r=Rw(e),r>0&&o.length>r&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=n,s.count=o.length,pB(s)}return e}gn.prototype.addListener=function(n,t){return zw(this,n,t,!1)},gn.prototype.on=gn.prototype.addListener,gn.prototype.prependListener=function(n,t){return zw(this,n,t,!0)};function mB(){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 Uw(e,n,t){var i={fired:!1,wrapFn:void 0,target:e,type:n,listener:t},r=mB.bind(i);return r.listener=t,i.wrapFn=r,r}gn.prototype.once=function(n,t){return Hf(t),this.on(n,Uw(this,n,t)),this},gn.prototype.prependOnceListener=function(n,t){return Hf(t),this.prependListener(n,Uw(this,n,t)),this},gn.prototype.removeListener=function(n,t){var i,r,a,o,s;if(Hf(t),r=this._events,r===void 0)return this;if(i=r[n],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[n],r.removeListener&&this.emit("removeListener",n,i.listener||t));else if(typeof i!="function"){for(a=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,a=o;break}if(a<0)return this;a===0?i.shift():gB(i,a),i.length===1&&(r[n]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",n,s||t)}return this},gn.prototype.off=gn.prototype.removeListener,gn.prototype.removeAllListeners=function(n){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[n]),this;if(arguments.length===0){var a=Object.keys(i),o;for(r=0;r<a.length;++r)o=a[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[n],typeof t=="function")this.removeListener(n,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(n,t[r]);return this};function Ww(e,n,t){var i=e._events;if(i===void 0)return[];var r=i[n];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?bB(r):Vw(r,r.length)}gn.prototype.listeners=function(n){return Ww(this,n,!0)},gn.prototype.rawListeners=function(n){return Ww(this,n,!1)},gn.listenerCount=function(e,n){return typeof e.listenerCount=="function"?e.listenerCount(n):Hw.call(e,n)},gn.prototype.listenerCount=Hw;function Hw(e){var n=this._events;if(n!==void 0){var t=n[e];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}gn.prototype.eventNames=function(){return this._eventsCount>0?Wf(this._events):[]};function Vw(e,n){for(var t=new Array(n),i=0;i<n;++i)t[i]=e[i];return t}function gB(e,n){for(;n+1<e.length;n++)e[n]=e[n+1];e.pop()}function bB(e){for(var n=new Array(e.length),t=0;t<n.length;++t)n[t]=e[t].listener||e[t];return n}function yB(e,n){return new Promise(function(t,i){function r(o){e.removeListener(n,a),i(o)}function a(){typeof e.removeListener=="function"&&e.removeListener("error",r),t([].slice.call(arguments))}qw(e,n,a,{once:!0}),n!=="error"&&wB(e,r,{once:!0})})}function wB(e,n,t){typeof e.on=="function"&&qw(e,"error",n,t)}function qw(e,n,t,i){if(typeof e.on=="function")i.once?e.once(n,t):e.on(n,t);else if(typeof e.addEventListener=="function")e.addEventListener(n,function r(a){i.once&&e.removeEventListener(n,r),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Gw=Ou.exports,Kw=Gw.EventEmitter,xo={},Vf={};Vf.byteLength=xB,Vf.toByteArray=SB,Vf.fromByteArray=TB;for(var ni=[],$t=[],_B=typeof Uint8Array<"u"?Uint8Array:Array,Pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",va=0,kB=Pu.length;va<kB;++va)ni[va]=Pu[va],$t[Pu.charCodeAt(va)]=va;$t[45]=62,$t[95]=63;function Yw(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=n);var i=t===n?0:4-t%4;return[t,i]}function xB(e){var n=Yw(e),t=n[0],i=n[1];return(t+i)*3/4-i}function EB(e,n,t){return(n+t)*3/4-t}function SB(e){var n,t=Yw(e),i=t[0],r=t[1],a=new _B(EB(e,i,r)),o=0,s=r>0?i-4:i,f;for(f=0;f<s;f+=4)n=$t[e.charCodeAt(f)]<<18|$t[e.charCodeAt(f+1)]<<12|$t[e.charCodeAt(f+2)]<<6|$t[e.charCodeAt(f+3)],a[o++]=n>>16&255,a[o++]=n>>8&255,a[o++]=n&255;return r===2&&(n=$t[e.charCodeAt(f)]<<2|$t[e.charCodeAt(f+1)]>>4,a[o++]=n&255),r===1&&(n=$t[e.charCodeAt(f)]<<10|$t[e.charCodeAt(f+1)]<<4|$t[e.charCodeAt(f+2)]>>2,a[o++]=n>>8&255,a[o++]=n&255),a}function CB(e){return ni[e>>18&63]+ni[e>>12&63]+ni[e>>6&63]+ni[e&63]}function $B(e,n,t){for(var i,r=[],a=n;a<t;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),r.push(CB(i));return r.join("")}function TB(e){for(var n,t=e.length,i=t%3,r=[],a=16383,o=0,s=t-i;o<s;o+=a)r.push($B(e,o,o+a>s?s:o+a));return i===1?(n=e[t-1],r.push(ni[n>>2]+ni[n<<4&63]+"==")):i===2&&(n=(e[t-2]<<8)+e[t-1],r.push(ni[n>>10]+ni[n>>4&63]+ni[n<<2&63]+"=")),r.join("")}var Iu={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Iu.read=function(e,n,t,i,r){var a,o,s=r*8-i-1,f=(1<<s)-1,d=f>>1,c=-7,u=t?r-1:0,h=t?-1:1,p=e[n+u];for(u+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=a*256+e[n+u],u+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=i;c>0;o=o*256+e[n+u],u+=h,c-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-d}return(p?-1:1)*o*Math.pow(2,a-i)},Iu.write=function(e,n,t,i,r,a){var o,s,f,d=a*8-r-1,c=(1<<d)-1,u=c>>1,h=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:a-1,g=i?1:-1,b=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(s=isNaN(n)?1:0,o=c):(o=Math.floor(Math.log(n)/Math.LN2),n*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+u>=1?n+=h/f:n+=h*Math.pow(2,1-u),n*f>=2&&(o++,f/=2),o+u>=c?(s=0,o=c):o+u>=1?(s=(n*f-1)*Math.pow(2,r),o=o+u):(s=n*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;e[t+p]=s&255,p+=g,s/=256,r-=8);for(o=o<<r|s,d+=r;d>0;e[t+p]=o&255,p+=g,o/=256,d-=8);e[t+p-g]|=b*128};/*!
843
+ `;function UL(e){const n=l.useRef(null),t=l.useRef(null);return t.current&&t.current.update(e),l.useEffect(()=>(t.current=new Eu({...e,ref:n}),()=>{t.current=null}),[]),l.createElement("div",{ref:n})}const WL=({disabled:e,defaultEmoji:n,emoji:t,onChangeEmoji:i,classNames:r})=>{const{t:a}=vn("os"),[o,s]=kt({prop:t,onChange:i,defaultProp:n}),[f,d]=l.useState(!1),c=l.useRef(!1),[u,h]=l.useState(!1);return l.createElement(Ze.Root,{open:u,onOpenChange:p=>{c.current?(h(!1),c.current=!1):h(p)}},l.createElement(of.Root,{open:f,onOpenChange:p=>{d(p),c.current=!0}},l.createElement(Ze.Trigger,{asChild:!0},l.createElement(of.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:["gap-2 text-2xl plb-1",r],disabled:e},l.createElement("span",{className:"sr-only"},a("select emoji label")),l.createElement(qe.ImageSquare,{className:He(5)})))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},a("select emoji label"),l.createElement(Ze.Arrow,null))),l.createElement(of.Content,{side:"bottom",onKeyDownCapture:p=>{p.key==="Escape"&&(p.stopPropagation(),d(!1),c.current=!0)}},l.createElement(UL,{data:iL,onEmojiSelect:({native:p})=>{p&&(s(p),d(!1))},autoFocus:!0,maxFrequentRows:0,noCountryFlags:!0}),l.createElement(of.Arrow,null))))},HL=({hue:e})=>{const{tx:n}=Ae();return l.createElement("svg",{width:12,height:12,viewBox:"0 0 12 12"},l.createElement("rect",{x:0,y:0,width:12,height:12,className:n("hue.fill","select--hue__preview",{hue:e})}))},VL=({disabled:e,hue:n,onChangeHue:t,classNames:i,defaultHue:r})=>{const{t:a}=vn("os"),[o,s]=kt({prop:n,onChange:t,defaultProp:r}),[f,d]=l.useState(!1),c=l.useRef(!1),[u,h]=l.useState(!1);return l.createElement(Ze.Root,{open:u,onOpenChange:p=>{c.current?(h(!1),c.current=!1):h(p)}},l.createElement(Dn.Root,{modal:!1,open:f,onOpenChange:p=>{d(p),c.current=!0}},l.createElement(Ze.Trigger,{asChild:!0},l.createElement(Dn.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:le("gap-2 plb-1",i),disabled:e},l.createElement("span",{className:"sr-only"},a("select hue label")),l.createElement(qe.Palette,{className:He(5)})))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},a("select hue label"),l.createElement(Ze.Arrow,null))),l.createElement(Dn.Content,{side:"bottom"},l.createElement(Dn.Viewport,null,Object.keys(aa).map(p=>l.createElement(Dn.CheckboxItem,{key:p,checked:p===o,onCheckedChange:()=>s(p)},l.createElement(HL,{hue:p}),l.createElement("span",{className:"grow"},a(`${p} label`)),l.createElement(Dn.ItemIndicator,null,l.createElement(qe.Check,null))))),l.createElement(Dn.Arrow,null))))};var Mf={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"]},hw=e=>e.charAt(0).toUpperCase()+e.slice(1),Nf=e=>{const n=e.length*2/3,t=e.substring(0,n),i=e.substring(n),r=hw(Mf.adjectives[parseInt(t,16)%Mf.adjectives.length]),a=hw(Mf.animals[parseInt(i,16)%Mf.animals.length]);return`${r} ${a}`};const qL=l.forwardRef(({identity:e,presence:n,onClick:t,classNames:i,...r},a)=>{var d,c,u,h,p;const o=oc(e.identityKey),s=$n("identityListItem__label"),f=((d=e.profile)==null?void 0:d.displayName)??Nf(e.identityKey.toHex());return l.createElement(af.Root,{...r,classNames:le("flex gap-2 pis-3 pie-1 items-center",t&&"cursor-pointer",i),onClick:()=>t==null?void 0:t(),"data-testid":"identity-list-item",labelId:s,ref:a},l.createElement(wn.Root,{status:n===Jo.SpaceMember.PresenceState.ONLINE?"active":"inactive",labelId:s,hue:((u=(c=e.profile)==null?void 0:c.data)==null?void 0:u.hue)||o.hue},l.createElement(wn.Frame,{classNames:"place-self-center"},l.createElement(wn.Fallback,{text:((p=(h=e.profile)==null?void 0:h.data)==null?void 0:p.emoji)||o.emoji})),l.createElement(wn.Label,{classNames:"text-sm truncate pli-2"},f)))}),GL=({spaceKey:e,includeSelf:n,onSelect:t})=>{const i=Re.useClient(),r=Jo.useMembers(e),a=l.useMemo(()=>n?r.sort(o=>o.identity.identityKey.equals(i.halo.identity.get().identityKey)?-1:1):r.filter(o=>!o.identity.identityKey.equals(i.halo.identity.get().identityKey)),[r]);return l.createElement(KL,{members:a,onSelect:t})},KL=({members:e,onSelect:n})=>{const{t}=vn("os"),i=e.filter(r=>r.identity);return i.length>0?l.createElement(Fc,{classNames:"flex flex-col gap-2","data-testid":"space-members-list"},i.map(r=>l.createElement(qL,{key:r.identity.identityKey.toHex(),identity:r.identity,presence:r.presence,onClick:n&&(()=>n(r))}))):l.createElement("div",{role:"none",className:"grow flex items-center p-2"},l.createElement("p",{className:le(In,"text-center is-full mlb-2")},t("empty space members message")))},_o={weight:"duotone",width:24,height:24,x:8,y:8},YL=l.forwardRef(({device:e,onClickAdd:n,onClickEdit:t,onClickReset:i,onClickJoinExisting:r,classNames:a,...o},s)=>{var p;const{t:f}=vn("os"),d=oc(e.deviceKey),c=$n("identityListItem__label"),u=e.profile?f("device name placeholder",{os:e.profile.os,platform:e.profile.platform}):Nf(e.deviceKey.toHex()),h=e.kind===vt.DeviceKind.CURRENT;return l.createElement(af.Root,{...o,classNames:["flex gap-2 items-center mlb-2",a],"data-testid":`device-list-item${h?"-current":""}`,labelId:c,ref:s},l.createElement(wn.Root,{status:e.presence===vt.Device.PresenceState.ONLINE?"active":"inactive",labelId:c,hue:d.hue,variant:"square"},l.createElement(wn.Frame,{classNames:"place-self-center"},(p=e.profile)!=null&&p.type?e.profile.type===vt.DeviceType.BROWSER?l.createElement(qe.Compass,{..._o}):e.profile.type===vt.DeviceType.NATIVE?l.createElement(qe.Desktop,{..._o}):[vt.DeviceType.AGENT,vt.DeviceType.AGENT_MANAGED].includes(e.profile.type)?l.createElement(qe.Robot,{..._o}):e.profile.type===vt.DeviceType.MOBILE?l.createElement(qe.DeviceMobile,{..._o}):l.createElement(qe.Devices,{..._o}):l.createElement(wn.Fallback,{text:d.emoji})),h&&l.createElement(LO,{color:"primary"},f("current device tag label")),l.createElement(wn.Label,{classNames:"flex-1 text-sm truncate"},u),e.kind===vt.DeviceKind.CURRENT&&l.createElement(Dn.Root,null,l.createElement(Dn.Trigger,{asChild:!0},l.createElement(jn,{variant:"ghost",classNames:"pli-0 is-[--rail-action] bs-[--rail-action]","data-testid":`device-list-item${h?"-current":""}.options`},l.createElement("span",{className:"sr-only"},f("more options label")),l.createElement(qe.DotsThree,{className:He(5)}))),l.createElement(Dn.Content,null,l.createElement(Dn.Viewport,null,l.createElement(Dn.Item,{"data-testid":"device-list-item-current.join-existing",onClick:r},l.createElement(qe.Intersect,{className:He(5)}),f("choose join new identity label")),l.createElement(Dn.Item,{"data-testid":"device-list-item-current.reset",onClick:i},l.createElement(qe.Power,{className:He(5)}),f("reset device label")))))))}),JL=({devices:e,onClickAdd:n,onClickEdit:t,onClickReset:i,onClickJoinExisting:r})=>{const{t:a}=vn("os");return l.createElement(l.Fragment,null,l.createElement("h2",{className:le(In,"text-center mbs-4")},a("devices heading")),e.length>0&&l.createElement(Fc,null,e.map(o=>l.createElement(YL,{key:o.deviceKey.toHex(),device:o,onClickEdit:()=>t==null?void 0:t(o),onClickReset:i,onClickJoinExisting:r}))),l.createElement(jn,{variant:"ghost",classNames:"justify-start gap-2 !pis-0 !pie-3","data-testid":"devices-panel.create-invitation",onClick:n},l.createElement("div",{role:"img",className:le(He(8),"m-1 rounded-sm surface-input grid place-items-center")},l.createElement(qe.Plus,{weight:"light",className:He(6)})),l.createElement("span",{className:"grow font-medium text-start"},a("choose add device label")),l.createElement(qe.CaretRight,{weight:"bold",className:He(4)})))},Df=43200,vw=1440;function pw(e){const n=Wn(e),t=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return t.setUTCFullYear(n.getFullYear()),+e-+t}function Lf(e,n){const t=Wn(e),i=Wn(n),r=t.getTime()-i.getTime();return r<0?-1:r>0?1:r}function XL(e,n){const t=Wn(e),i=Wn(n),r=t.getFullYear()-i.getFullYear(),a=t.getMonth()-i.getMonth();return r*12+a}function ZL(e){return n=>{const i=(e?Math[e]:Math.trunc)(n);return i===0?0:i}}function QL(e,n){return+Wn(e)-+Wn(n)}function eB(e){const n=Wn(e);return n.setHours(23,59,59,999),n}function nB(e){const n=Wn(e),t=n.getMonth();return n.setFullYear(n.getFullYear(),t+1,0),n.setHours(23,59,59,999),n}function tB(e){const n=Wn(e);return+eB(n)==+nB(n)}function iB(e,n){const t=Wn(e),i=Wn(n),r=Lf(t,i),a=Math.abs(XL(t,i));let o;if(a<1)o=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-r*a);let s=Lf(t,i)===-r;tB(Wn(e))&&a===1&&Lf(e,i)===1&&(s=!1),o=r*(a-Number(s))}return o===0?0:o}function rB(e,n,t){const i=QL(e,n)/1e3;return ZL(t==null?void 0:t.roundingMethod)(i)}function aB(e,n,t){const i=Nk(),r=(t==null?void 0:t.locale)??i.locale??u1,a=2520,o=Lf(e,n);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o});let f,d;o>0?(f=Wn(n),d=Wn(e)):(f=Wn(e),d=Wn(n));const c=rB(d,f),u=(pw(d)-pw(f))/1e3,h=Math.round((c-u)/60);let p;if(h<2)return t!=null&&t.includeSeconds?c<5?r.formatDistance("lessThanXSeconds",5,s):c<10?r.formatDistance("lessThanXSeconds",10,s):c<20?r.formatDistance("lessThanXSeconds",20,s):c<40?r.formatDistance("halfAMinute",0,s):c<60?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",1,s):h===0?r.formatDistance("lessThanXMinutes",1,s):r.formatDistance("xMinutes",h,s);if(h<45)return r.formatDistance("xMinutes",h,s);if(h<90)return r.formatDistance("aboutXHours",1,s);if(h<vw){const g=Math.round(h/60);return r.formatDistance("aboutXHours",g,s)}else{if(h<a)return r.formatDistance("xDays",1,s);if(h<Df){const g=Math.round(h/vw);return r.formatDistance("xDays",g,s)}else if(h<Df*2)return p=Math.round(h/Df),r.formatDistance("aboutXMonths",p,s)}if(p=iB(d,f),p<12){const g=Math.round(h/Df);return r.formatDistance("xMonths",g,s)}else{const g=p%12,b=Math.trunc(p/12);return g<3?r.formatDistance("aboutXYears",b,s):g<9?r.formatDistance("overXYears",b,s):r.formatDistance("almostXYears",b+1,s)}}function oB(e,n){return aB(e,Date.now(),n)}var mw;(function(e){e[e.TRACE=5]="TRACE",e[e.DEBUG=10]="DEBUG",e[e.INFO=11]="INFO",e[e.WARN=12]="WARN",e[e.ERROR=13]="ERROR"})(mw||(mw={}));var gw;(function(e){(function(n){n[n.INCLUSIVE=1]="INCLUSIVE",n[n.EXPLICIT=2]="EXPLICIT"})(e.MatchingOptions||(e.MatchingOptions={}))})(gw||(gw={}));var bw;(function(e){e[e.ACTIVE=0]="ACTIVE",e[e.INACTIVE=1]="INACTIVE"})(bw||(bw={}));var yw;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.TRUNCATE=1]="TRUNCATE",n[n.HUMANIZE=2]="HUMANIZE"})(e.KEY_OPTION||(e.KEY_OPTION={}))})(yw||(yw={}));var ww;(function(e){(function(n){n[n.BROWSER=0]="BROWSER",n[n.SHARED_WORKER=1]="SHARED_WORKER",n[n.NODE=2]="NODE"})(e.PLATFORM_TYPE||(e.PLATFORM_TYPE={}))})(ww||(ww={}));var _w;(function(e){e[e.CURRENT=0]="CURRENT",e[e.TRUSTED=1]="TRUSTED"})(_w||(_w={}));var kw;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(kw||(kw={}));var xw;(function(e){(function(n){n[n.OFFLINE=0]="OFFLINE",n[n.ONLINE=1]="ONLINE",n[n.REMOVED=2]="REMOVED"})(e.PresenceState||(e.PresenceState={}))})(xw||(xw={}));var Ew;(function(e){e[e.INACTIVE=2]="INACTIVE",e[e.ACTIVE=6]="ACTIVE",e[e.CLOSED=1]="CLOSED",e[e.CONTROL_ONLY=7]="CONTROL_ONLY",e[e.INITIALIZING=4]="INITIALIZING",e[e.READY=3]="READY",e[e.ERROR=5]="ERROR"})(Ew||(Ew={}));var Sw;(function(e){(function(n){n[n.NONE=0]="NONE",n[n.INIT_AUTOMERGE=1]="INIT_AUTOMERGE",n[n.PRUNE_AUTOMERGE_ROOT_HISTORY=2]="PRUNE_AUTOMERGE_ROOT_HISTORY",n[n.FRAGMENT_AUTOMERGE_ROOT=3]="FRAGMENT_AUTOMERGE_ROOT"})(e.Migration||(e.Migration={}))})(Sw||(Sw={}));var Se;(function(e){(function(n){n[n.INTERACTIVE=0]="INTERACTIVE",n[n.DELEGATED=1]="DELEGATED",n[n.MULTIUSE=2]="MULTIUSE"})(e.Type||(e.Type={})),function(n){n[n.DEVICE=0]="DEVICE",n[n.SPACE=1]="SPACE"}(e.Kind||(e.Kind={})),function(n){n[n.NONE=0]="NONE",n[n.SHARED_SECRET=1]="SHARED_SECRET",n[n.KNOWN_PUBLIC_KEY=2]="KNOWN_PUBLIC_KEY"}(e.AuthMethod||(e.AuthMethod={})),function(n){n[n.INIT=0]="INIT",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED",n[n.READY_FOR_AUTHENTICATION=3]="READY_FOR_AUTHENTICATION",n[n.AUTHENTICATING=4]="AUTHENTICATING",n[n.SUCCESS=5]="SUCCESS",n[n.CANCELLED=6]="CANCELLED",n[n.TIMEOUT=7]="TIMEOUT",n[n.ERROR=8]="ERROR",n[n.EXPIRED=9]="EXPIRED"}(e.State||(e.State={}))})(Se||(Se={}));var Cw;(function(e){(function(n){n[n.ADDED=0]="ADDED",n[n.REMOVED=1]="REMOVED",n[n.SAVED=2]="SAVED",n[n.LOAD_COMPLETE=3]="LOAD_COMPLETE"})(e.Action||(e.Action={})),function(n){n[n.CREATED=0]="CREATED",n[n.ACCEPTED=1]="ACCEPTED"}(e.Type||(e.Type={}))})(Cw||(Cw={}));var $w;(function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE"})($w||($w={}));var sB=class extends Error{constructor(){super("Context disposed.")}};function fB(e,n,t,i){var r=arguments.length,a=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,t,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(n,t,a):o(n,t))||a);return r>3&&a&&Object.defineProperty(n,t,a),a}var Su="/home/runner/work/dxos/dxos/packages/common/context/src/context.ts",lB=300,Tw,Aw,Ow=(Sa=class{constructor({onError:n=r=>{if(!(r instanceof sB))throw this.dispose(),r},attributes:t={},parent:i}={}){this._disposeCallbacks=[],this._isDisposed=!1,this._disposePromise=void 0,this._parent=null,this.maxSafeDisposeCallbacks=lB,this[Tw]="Context",this[Aw]=()=>this.toString(),this._onError=n,this._attributes=t,i!==void 0&&(this._parent=i)}static default(){return new Sa}get disposed(){return this._isDisposed}get disposeCallbacksLength(){return this._disposeCallbacks.length}onDispose(n){return this._isDisposed&&(async()=>{try{await n()}catch(t){Ge.catch(t,void 0,{F:Su,L:88,S:this,C:(i,r)=>i(...r)})}})(),this._disposeCallbacks.push(n),this._disposeCallbacks.length>this.maxSafeDisposeCallbacks&&Ge.warn("Context has a large number of dispose callbacks. This might be a memory leak.",{count:this._disposeCallbacks.length,safeThreshold:this.maxSafeDisposeCallbacks},{F:Su,L:95,S:this,C:(t,i)=>t(...i)}),()=>{const t=this._disposeCallbacks.indexOf(n);t!==-1&&this._disposeCallbacks.splice(t,1)}}async dispose(){if(this._disposePromise)return this._disposePromise;this._isDisposed=!0;let n;this._disposePromise=new Promise(i=>{n=i});const t=Array.from(this._disposeCallbacks).reverse();this._disposeCallbacks.length=0;for(const i of t)try{await i()}catch(r){Ge.catch(r,void 0,{F:Su,L:136,S:this,C:(a,o)=>a(...o)})}n()}raise(n){if(!this._isDisposed)try{this._onError(n)}catch(t){Promise.reject(t)}}derive({onError:n,attributes:t}={}){const i=new Sa({onError:async a=>{if(!n)this.raise(a);else try{await n(a)}catch{this.raise(a)}},attributes:t}),r=this.onDispose(()=>i.dispose());return i.onDispose(r),i}getAttribute(n){if(n in this._attributes)return this._attributes[n];if(this._parent!==null)return this._parent.getAttribute(n)}toString(){return`Context(${this._isDisposed?"disposed":"active"})`}},Tw=Symbol.toStringTag,Aw=Et.custom,Sa);Ow=fB([p$("Context")],Ow);var Pw;(function(e){e.CLOSED="CLOSED",e.OPEN="OPEN",e.ERROR="ERROR"})(Pw||(Pw={}));var Bf={};Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.Observable=void 0;const Iw=e=>!!Symbol[e],Cu=e=>Iw(e)?Symbol[e]:"@@"+e,dB=Cu("iterator"),$u=Cu("observable"),Fw=Cu("species");function jf(e,n){let t=e[n];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ko(e){let n=e.constructor;return n!==void 0&&(n=n[Fw],n===null&&(n=void 0)),n!==void 0?n:zf}function cB(e){return e instanceof zf}function ua(e){ua.log?ua.log(e):setTimeout(()=>{throw e})}function Rf(e){Promise.resolve().then(()=>{try{e()}catch(n){ua(n)}})}function Mw(e){let n=e._cleanup;if(n!==void 0&&(e._cleanup=void 0,!!n))try{if(typeof n=="function")n();else{let t=jf(n,"unsubscribe");t&&t.call(n)}}catch(t){ua(t)}}function Tu(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function uB(e){let n=e._queue;if(n){e._queue=void 0,e._state="ready";for(let t=0;t<n.length&&(Nw(e,n[t].type,n[t].value),e._state!=="closed");++t);}}function Nw(e,n,t){e._state="running";let i=e._observer;try{let r=jf(i,n);switch(n){case"next":r&&r.call(i,t);break;case"error":if(Tu(e),r)r.call(i,t);else throw t;break;case"complete":Tu(e),r&&r.call(i);break}}catch(r){ua(r)}e._state==="closed"?Mw(e):e._state==="running"&&(e._state="ready")}function Au(e,n,t){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:n,value:t});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:n,value:t}],Rf(()=>uB(e));return}Nw(e,n,t)}}class hB{constructor(n,t){this._cleanup=void 0,this._observer=n,this._queue=void 0,this._state="initializing";let i=this,r={get closed(){return i._state==="closed"},next(a){Au(i,"next",a)},error(a){Au(i,"error",a)},complete(){Au(i,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(a){r.error(a)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Tu(this),Mw(this))}}let zf=class Ol{constructor(n){if(!(this instanceof Ol))throw new TypeError("Observable cannot be called as a function");if(typeof n!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=n}subscribe(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new hB(n,this._subscriber)}forEach(n){return new Promise((t,i)=>{if(typeof n!="function"){i(new TypeError(n+" is not a function"));return}function r(){a.unsubscribe(),t()}let a=this.subscribe({next(o){try{n(o,r)}catch(s){i(s),a.unsubscribe()}},error:i,complete:t})})}map(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>this.subscribe({next(r){try{r=n(r)}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}filter(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>this.subscribe({next(r){try{if(!n(r))return}catch(a){return i.error(a)}i.next(r)},error(r){i.error(r)},complete(){i.complete()}}))}reduce(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this),i=arguments.length>1,r=!1,o=arguments[1];return new t(s=>this.subscribe({next(f){let d=!r;if(r=!0,!d||i)try{o=n(o,f)}catch(c){return s.error(c)}else o=f},error(f){s.error(f)},complete(){if(!r&&!i)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(o),s.complete()}}))}async all(){let n=[];return await this.forEach(t=>n.push(t)),n}concat(...n){let t=ko(this);return new t(i=>{let r,a=0;function o(s){r=s.subscribe({next(f){i.next(f)},error(f){i.error(f)},complete(){a===n.length?(r=void 0,i.complete()):o(t.from(n[a++]))}})}return o(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(n){if(typeof n!="function")throw new TypeError(n+" is not a function");let t=ko(this);return new t(i=>{let r=[],a=this.subscribe({next(s){if(n)try{s=n(s)}catch(d){return i.error(d)}let f=t.from(s).subscribe({next(d){i.next(d)},error(d){i.error(d)},complete(){let d=r.indexOf(f);d>=0&&r.splice(d,1),o()}});r.push(f)},error(s){i.error(s)},complete(){o()}});function o(){a.closed&&r.length===0&&i.complete()}return()=>{r.forEach(s=>s.unsubscribe()),a.unsubscribe()}})}[$u](){return this}static from(n){let t=typeof this=="function"?this:Ol;if(n==null)throw new TypeError(n+" is not an object");let i=jf(n,$u);if(i){let r=i.call(n);if(Object(r)!==r)throw new TypeError(r+" is not an object");return cB(r)&&r.constructor===t?r:new t(a=>r.subscribe(a))}if(Iw("iterator")&&(i=jf(n,dB),i))return new t(r=>{Rf(()=>{if(!r.closed){for(let a of i.call(n))if(r.next(a),r.closed)return;r.complete()}})});if(Array.isArray(n))return new t(r=>{Rf(()=>{if(!r.closed){for(let a=0;a<n.length;++a)if(r.next(n[a]),r.closed)return;r.complete()}})});throw new TypeError(n+" is not observable")}static of(...n){let t=typeof this=="function"?this:Ol;return new t(i=>{Rf(()=>{if(!i.closed){for(let r=0;r<n.length;++r)if(i.next(n[r]),i.closed)return;i.complete()}})})}static get[Fw](){return this}};Bf.Observable=zf,Object.defineProperty(zf,Symbol("extensions"),{value:{symbol:$u,hostReportError:ua},configurable:!0});var vB=Bf.Observable;const Uf=Qi(vB);var Dw={exports:{}},Ou={exports:{}},ha=typeof Reflect=="object"?Reflect:null,Lw=ha&&typeof ha.apply=="function"?ha.apply:function(n,t,i){return Function.prototype.apply.call(n,t,i)},Wf;ha&&typeof ha.ownKeys=="function"?Wf=ha.ownKeys:Object.getOwnPropertySymbols?Wf=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Wf=function(n){return Object.getOwnPropertyNames(n)};function pB(e){console&&console.warn&&console.warn(e)}var Bw=Number.isNaN||function(n){return n!==n};function gn(){gn.init.call(this)}Ou.exports=gn,Ou.exports.once=yB,gn.EventEmitter=gn,gn.prototype._events=void 0,gn.prototype._eventsCount=0,gn.prototype._maxListeners=void 0;var jw=10;function Hf(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(gn,"defaultMaxListeners",{enumerable:!0,get:function(){return jw},set:function(e){if(typeof e!="number"||e<0||Bw(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");jw=e}}),gn.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},gn.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||Bw(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function Rw(e){return e._maxListeners===void 0?gn.defaultMaxListeners:e._maxListeners}gn.prototype.getMaxListeners=function(){return Rw(this)},gn.prototype.emit=function(n){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=n==="error",a=this._events;if(a!==void 0)r=r&&a.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var f=a[n];if(f===void 0)return!1;if(typeof f=="function")Lw(f,this,t);else for(var d=f.length,c=Vw(f,d),i=0;i<d;++i)Lw(c[i],this,t);return!0};function zw(e,n,t,i){var r,a,o;if(Hf(t),a=e._events,a===void 0?(a=e._events=Object.create(null),e._eventsCount=0):(a.newListener!==void 0&&(e.emit("newListener",n,t.listener?t.listener:t),a=e._events),o=a[n]),o===void 0)o=a[n]=t,++e._eventsCount;else if(typeof o=="function"?o=a[n]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),r=Rw(e),r>0&&o.length>r&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=n,s.count=o.length,pB(s)}return e}gn.prototype.addListener=function(n,t){return zw(this,n,t,!1)},gn.prototype.on=gn.prototype.addListener,gn.prototype.prependListener=function(n,t){return zw(this,n,t,!0)};function mB(){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 Uw(e,n,t){var i={fired:!1,wrapFn:void 0,target:e,type:n,listener:t},r=mB.bind(i);return r.listener=t,i.wrapFn=r,r}gn.prototype.once=function(n,t){return Hf(t),this.on(n,Uw(this,n,t)),this},gn.prototype.prependOnceListener=function(n,t){return Hf(t),this.prependListener(n,Uw(this,n,t)),this},gn.prototype.removeListener=function(n,t){var i,r,a,o,s;if(Hf(t),r=this._events,r===void 0)return this;if(i=r[n],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[n],r.removeListener&&this.emit("removeListener",n,i.listener||t));else if(typeof i!="function"){for(a=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,a=o;break}if(a<0)return this;a===0?i.shift():gB(i,a),i.length===1&&(r[n]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",n,s||t)}return this},gn.prototype.off=gn.prototype.removeListener,gn.prototype.removeAllListeners=function(n){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[n]),this;if(arguments.length===0){var a=Object.keys(i),o;for(r=0;r<a.length;++r)o=a[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[n],typeof t=="function")this.removeListener(n,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(n,t[r]);return this};function Ww(e,n,t){var i=e._events;if(i===void 0)return[];var r=i[n];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?bB(r):Vw(r,r.length)}gn.prototype.listeners=function(n){return Ww(this,n,!0)},gn.prototype.rawListeners=function(n){return Ww(this,n,!1)},gn.listenerCount=function(e,n){return typeof e.listenerCount=="function"?e.listenerCount(n):Hw.call(e,n)},gn.prototype.listenerCount=Hw;function Hw(e){var n=this._events;if(n!==void 0){var t=n[e];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}gn.prototype.eventNames=function(){return this._eventsCount>0?Wf(this._events):[]};function Vw(e,n){for(var t=new Array(n),i=0;i<n;++i)t[i]=e[i];return t}function gB(e,n){for(;n+1<e.length;n++)e[n]=e[n+1];e.pop()}function bB(e){for(var n=new Array(e.length),t=0;t<n.length;++t)n[t]=e[t].listener||e[t];return n}function yB(e,n){return new Promise(function(t,i){function r(o){e.removeListener(n,a),i(o)}function a(){typeof e.removeListener=="function"&&e.removeListener("error",r),t([].slice.call(arguments))}qw(e,n,a,{once:!0}),n!=="error"&&wB(e,r,{once:!0})})}function wB(e,n,t){typeof e.on=="function"&&qw(e,"error",n,t)}function qw(e,n,t,i){if(typeof e.on=="function")i.once?e.once(n,t):e.on(n,t);else if(typeof e.addEventListener=="function")e.addEventListener(n,function r(a){i.once&&e.removeEventListener(n,r),t(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Gw=Ou.exports,Kw=Gw.EventEmitter,xo={},Vf={};Vf.byteLength=xB,Vf.toByteArray=SB,Vf.fromByteArray=TB;for(var ni=[],$t=[],_B=typeof Uint8Array<"u"?Uint8Array:Array,Pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",va=0,kB=Pu.length;va<kB;++va)ni[va]=Pu[va],$t[Pu.charCodeAt(va)]=va;$t[45]=62,$t[95]=63;function Yw(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=n);var i=t===n?0:4-t%4;return[t,i]}function xB(e){var n=Yw(e),t=n[0],i=n[1];return(t+i)*3/4-i}function EB(e,n,t){return(n+t)*3/4-t}function SB(e){var n,t=Yw(e),i=t[0],r=t[1],a=new _B(EB(e,i,r)),o=0,s=r>0?i-4:i,f;for(f=0;f<s;f+=4)n=$t[e.charCodeAt(f)]<<18|$t[e.charCodeAt(f+1)]<<12|$t[e.charCodeAt(f+2)]<<6|$t[e.charCodeAt(f+3)],a[o++]=n>>16&255,a[o++]=n>>8&255,a[o++]=n&255;return r===2&&(n=$t[e.charCodeAt(f)]<<2|$t[e.charCodeAt(f+1)]>>4,a[o++]=n&255),r===1&&(n=$t[e.charCodeAt(f)]<<10|$t[e.charCodeAt(f+1)]<<4|$t[e.charCodeAt(f+2)]>>2,a[o++]=n>>8&255,a[o++]=n&255),a}function CB(e){return ni[e>>18&63]+ni[e>>12&63]+ni[e>>6&63]+ni[e&63]}function $B(e,n,t){for(var i,r=[],a=n;a<t;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),r.push(CB(i));return r.join("")}function TB(e){for(var n,t=e.length,i=t%3,r=[],a=16383,o=0,s=t-i;o<s;o+=a)r.push($B(e,o,o+a>s?s:o+a));return i===1?(n=e[t-1],r.push(ni[n>>2]+ni[n<<4&63]+"==")):i===2&&(n=(e[t-2]<<8)+e[t-1],r.push(ni[n>>10]+ni[n>>4&63]+ni[n<<2&63]+"=")),r.join("")}var Iu={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Iu.read=function(e,n,t,i,r){var a,o,s=r*8-i-1,f=(1<<s)-1,d=f>>1,c=-7,u=t?r-1:0,h=t?-1:1,p=e[n+u];for(u+=h,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=a*256+e[n+u],u+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=i;c>0;o=o*256+e[n+u],u+=h,c-=8);if(a===0)a=1-d;else{if(a===f)return o?NaN:(p?-1:1)*(1/0);o=o+Math.pow(2,i),a=a-d}return(p?-1:1)*o*Math.pow(2,a-i)},Iu.write=function(e,n,t,i,r,a){var o,s,f,d=a*8-r-1,c=(1<<d)-1,u=c>>1,h=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:a-1,g=i?1:-1,b=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(s=isNaN(n)?1:0,o=c):(o=Math.floor(Math.log(n)/Math.LN2),n*(f=Math.pow(2,-o))<1&&(o--,f*=2),o+u>=1?n+=h/f:n+=h*Math.pow(2,1-u),n*f>=2&&(o++,f/=2),o+u>=c?(s=0,o=c):o+u>=1?(s=(n*f-1)*Math.pow(2,r),o=o+u):(s=n*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;e[t+p]=s&255,p+=g,s/=256,r-=8);for(o=o<<r|s,d+=r;d>0;e[t+p]=o&255,p+=g,o/=256,d-=8);e[t+p-g]|=b*128};/*!
844
844
  * The buffer module from node.js, for the browser.
845
845
  *
846
846
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -943,5 +943,5 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==Fn.Running)throw
943
943
  `).concat(S.message))}if(_&&w){h.target!==void 0&&(f=h.target),s.push.apply(s,Sn([],un(h.actions),!1)),d=h;break}}}catch(S){i={error:S}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(i)throw i.error}}if(d){if(!f.length)return{transitions:[d],exitSet:[],configuration:n.value?[this]:[],source:n,actions:s};var k=Pn(f.map(function(S){return a.getRelativeStateNodes(S,n.historyValue)})),E=!!d.internal;return{transitions:[d],exitSet:E?[]:Pn(f.map(function(S){return a.getPotentiallyReenteringNodes(S)})),configuration:k,source:n,actions:s}}},e.prototype.getPotentiallyReenteringNodes=function(n){if(this.order<n.order)return[this];for(var t=[],i=this,r=n;i&&i!==r;)t.push(i),i=i.parent;return i!==r?[]:(t.push(r),t)},e.prototype.getActions=function(n,t,i,r,a,o,s){var f,d,c,u,h=this,p=o?No([],this.getStateNodes(o.value)):[],g=new Set;try{for(var b=fn(Array.from(n).sort(function(L,N){return L.order-N.order})),w=b.next();!w.done;w=b.next()){var _=w.value;(!Do(p,_)||Do(i.exitSet,_)||_.parent&&g.has(_.parent))&&g.add(_)}}catch(L){f={error:L}}finally{try{w&&!w.done&&(d=b.return)&&d.call(b)}finally{if(f)throw f.error}}try{for(var k=fn(p),E=k.next();!E.done;E=k.next()){var _=E.value;(!Do(n,_)||Do(i.exitSet,_.parent))&&i.exitSet.push(_)}}catch(L){c={error:L}}finally{try{E&&!E.done&&(u=k.return)&&u.call(k)}finally{if(c)throw c.error}}i.exitSet.sort(function(L,N){return N.order-L.order});var S=Array.from(g).sort(function(L,N){return L.order-N.order}),T=new Set(i.exitSet),O=Pn(S.map(function(L){var N=[];if(L.type!=="final")return N;var X=L.parent;if(!X.parent)return N;N.push(sl(L.id,L.doneData),sl(X.id,L.doneData?il(L.doneData,r,a):void 0));var Y=X.parent;return Y.type==="parallel"&&Mo(Y).every(function(ee){return cl(i.configuration,ee)})&&N.push(sl(Y.id)),N})),C=S.map(function(L){var N=L.onEntry,X=L.activities.map(function(Y){return qR(Y)});return{type:"entry",actions:Ki(s?Sn(Sn([],un(N),!1),un(X),!1):Sn(Sn([],un(X),!1),un(N),!1),h.machine.options.actions)}}).concat({type:"state_done",actions:O.map(function(L){return RR(L)})}),P=Array.from(T).map(function(L){return{type:"exit",actions:Ki(Sn(Sn([],un(L.onExit),!1),un(L.activities.map(function(N){return GR(N)})),!1),h.machine.options.actions)}}),F=P.concat({type:"transition",actions:Ki(i.actions,this.machine.options.actions)}).concat(C);if(t){var B=Ki(Pn(Sn([],un(n),!1).sort(function(L,N){return N.order-L.order}).map(function(L){return L.onExit})),this.machine.options.actions).filter(function(L){return!hh(L)});return F.concat({type:"stop",actions:B})}return F},e.prototype.transition=function(n,t,i,r){n===void 0&&(n=this.initialState);var a=Gn(t),o;if(n instanceof At)o=i===void 0?n:this.resolveState(At.from(n,i));else{var s=hn(n)?this.resolve(nl(this.getResolvedPath(n))):this.resolve(n),f=i??this.machine.context;o=this.resolveState(At.from(s,f))}if(!Mn&&a.name===Bo)throw new Error("An event cannot have the wildcard type ('".concat(Bo,"')"));if(this.strict&&!this.events.includes(a.name)&&!IR(a.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(a.name,"'"));var d=this._transition(o.value,o,a)||{transitions:[],configuration:[],exitSet:[],source:o,actions:[]},c=No([],this.getStateNodes(o.value)),u=d.configuration.length?No(c,d.configuration):c;return d.configuration=Sn([],un(u),!1),this.resolveTransition(d,o,o.context,r,a)},e.prototype.resolveRaisedTransition=function(n,t,i,r){var a,o=n.actions;return n=this.transition(n,t,void 0,r),n._event=i,n.event=i.data,(a=n.actions).unshift.apply(a,Sn([],un(o),!1)),n},e.prototype.resolveTransition=function(n,t,i,r,a){var o,s,f,d,c=this;a===void 0&&(a=ya);var u=n.configuration,h=!t||n.transitions.length>0,p=h?n.configuration:t?t.configuration:[],g=cl(p,this),b=h?tz(this.machine,u):void 0,w=t?t.historyValue?t.historyValue:n.source?this.machine.historyValue(t.value):void 0:void 0,_=this.getActions(new Set(p),g,n,i,a,t,r),k=t?we({},t.activities):{};try{for(var E=fn(_),S=E.next();!S.done;S=E.next()){var T=S.value;try{for(var O=(f=void 0,fn(T.actions)),C=O.next();!C.done;C=O.next()){var P=C.value;P.type===oh?k[P.activity.id||P.activity.type]=P:P.type===sh&&(k[P.activity.id||P.activity.type]=!1)}}catch(ie){f={error:ie}}finally{try{C&&!C.done&&(d=O.return)&&d.call(O)}finally{if(f)throw f.error}}}}catch(ie){o={error:ie}}finally{try{S&&!S.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}var F=un(ll(this,t,i,a,_,r,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),B=F[0],L=F[1],N=un(MR(B,hh),2),X=N[0],Y=N[1],ee=B.filter(function(ie){var me;return ie.type===oh&&((me=ie.activity)===null||me===void 0?void 0:me.type)===lh}),re=ee.reduce(function(ie,me){return ie[me.activity.id]=ZR(me.activity,c.machine,L,a),ie},t?we({},t.children):{}),fe=new At({value:b||t.value,context:L,_event:a,_sessionid:t?t._sessionid:null,historyValue:b?w?NR(w,b):void 0:t?t.historyValue:void 0,history:!b||n.source?t:void 0,actions:b?Y:[],activities:b?k:t?t.activities:{},events:[],configuration:p,transitions:n.transitions,children:re,done:g,tags:y_(p),machine:this}),ce=i!==L;fe.changed=a.name===t_||ce;var oe=fe.history;oe&&delete oe.history;var ye=!g&&(this._transient||u.some(function(ie){return ie._transient}));if(!h&&(!ye||a.name===_a))return fe;var se=fe;if(!g)for(ye&&(se=this.resolveRaisedTransition(se,{type:xR},a,r));X.length;){var G=X.shift();se=this.resolveRaisedTransition(se,G._event,a,r)}var J=se.changed||(oe?!!se.actions.length||ce||typeof oe.value!=typeof se.value||!w_(se.value,oe.value):void 0);return se.changed=J,se.history=oe,se},e.prototype.getStateNode=function(n){if(xa(n))return this.machine.getStateNodeById(n);if(!this.states)throw new Error("Unable to retrieve child state '".concat(n,"' from '").concat(this.id,"'; no child states exist."));var t=this.states[n];if(!t)throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return t},e.prototype.getStateNodeById=function(n){var t=xa(n)?n.slice(yh.length):n;if(t===this.id)return this;var i=this.machine.idMap[t];if(!i)throw new Error("Child state node '#".concat(t,"' does not exist on machine '").concat(this.id,"'"));return i},e.prototype.getStateNodeByPath=function(n){if(typeof n=="string"&&xa(n))try{return this.getStateNodeById(n.slice(1))}catch{}for(var t=uh(n,this.delimiter).slice(),i=this;t.length;){var r=t.shift();if(!r.length)break;i=i.getStateNode(r)}return i},e.prototype.resolve=function(n){var t,i=this;if(!n)return this.initialStateValue||ka;switch(this.type){case"parallel":return Po(this.initialStateValue,function(a,o){return a?i.getStateNode(o).resolve(n[o]||a):ka});case"compound":if(hn(n)){var r=this.getStateNode(n);return r.type==="parallel"||r.type==="compound"?(t={},t[n]=r.initialStateValue,t):n}return Object.keys(n).length?Po(n,function(a,o){return a?i.getStateNode(o).resolve(a):ka}):this.initialStateValue||{};default:return n||ka}},e.prototype.getResolvedPath=function(n){if(xa(n)){var t=this.machine.idMap[n.slice(yh.length)];if(!t)throw new Error("Unable to find state node '".concat(n,"'"));return t.path}return uh(n,this.delimiter)},Object.defineProperty(e.prototype,"initialStateValue",{get:function(){var n;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var t;if(this.type==="parallel")t=o_(this.states,function(i){return i.initialStateValue||ka},function(i){return i.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));t=dl(this.states[this.initial])?this.initial:(n={},n[this.initial]=this.states[this.initial].initialStateValue,n)}else t={};return this.__cache.initialStateValue=t,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),e.prototype.getInitialState=function(n,t){this._init();var i=this.getStateNodes(n);return this.resolveTransition({configuration:i,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,t??this.machine.context,void 0)},Object.defineProperty(e.prototype,"initialState",{get:function(){var n=this.initialStateValue;if(!n)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){var n;if(this.type==="history"){var t=this.config;hn(t.target)?n=xa(t.target)?nl(this.machine.getStateNodeById(t.target).path.slice(this.path.length-1)):t.target:n=t.target}return n},enumerable:!1,configurable:!0}),e.prototype.getRelativeStateNodes=function(n,t,i){return i===void 0&&(i=!0),i?n.type==="history"?n.resolveHistory(t):n.initialStateNodes:[n]},Object.defineProperty(e.prototype,"initialStateNodes",{get:function(){var n=this;if(dl(this))return[this];if(this.type==="compound"&&!this.initial)return Mn||qn(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var t=tl(this.initialStateValue);return Pn(t.map(function(i){return n.getFromRelativePath(i)}))},enumerable:!1,configurable:!0}),e.prototype.getFromRelativePath=function(n){if(!n.length)return[this];var t=un(n),i=t[0],r=t.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(i,"' from node with no states"));var a=this.getStateNode(i);if(a.type==="history")return a.resolveHistory();if(!this.states[i])throw new Error("Child state '".concat(i,"' does not exist on '").concat(this.id,"'"));return this.states[i].getFromRelativePath(r)},e.prototype.historyValue=function(n){if(Object.keys(this.states).length)return{current:n||this.initialStateValue,states:o_(this.states,function(t,i){if(!n)return t.historyValue();var r=hn(n)?void 0:n[i];return t.historyValue(r||t.initialStateValue)},function(t){return!t.history})}},e.prototype.resolveHistory=function(n){var t=this;if(this.type!=="history")return[this];var i=this.parent;if(!n){var r=this.target;return r?Pn(tl(r).map(function(o){return i.getFromRelativePath(o)})):i.initialStateNodes}var a=PR(i.path,"states")(n).current;return hn(a)?[i.getStateNode(a)]:Pn(tl(a).map(function(o){return t.history==="deep"?i.getFromRelativePath(o):[i.states[o[0]]]}))},Object.defineProperty(e.prototype,"stateIds",{get:function(){var n=this,t=Pn(Object.keys(this.states).map(function(i){return n.states[i].stateIds}));return[this.id].concat(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"events",{get:function(){var n,t,i,r;if(this.__cache.events)return this.__cache.events;var a=this.states,o=new Set(this.ownEvents);if(a)try{for(var s=fn(Object.keys(a)),f=s.next();!f.done;f=s.next()){var d=f.value,c=a[d];if(c.states)try{for(var u=(i=void 0,fn(c.events)),h=u.next();!h.done;h=u.next()){var p=h.value;o.add("".concat(p))}}catch(g){i={error:g}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}}}catch(g){n={error:g}}finally{try{f&&!f.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ownEvents",{get:function(){var n=new Set(this.transitions.filter(function(t){return!(!t.target&&!t.actions.length&&t.internal)}).map(function(t){return t.eventType}));return Array.from(n)},enumerable:!1,configurable:!0}),e.prototype.resolveTarget=function(n){var t=this;if(n!==void 0)return n.map(function(i){if(!hn(i))return i;var r=i[0]===t.delimiter;if(r&&!t.parent)return t.getStateNodeByPath(i.slice(1));var a=r?t.key+i:i;if(t.parent)try{var o=t.parent.getStateNodeByPath(a);return o}catch(s){throw new Error("Invalid transition definition for state node '".concat(t.id,`':
944
944
  `).concat(s.message))}else return t.getStateNodeByPath(a)})},e.prototype.formatTransition=function(n){var t=this,i=BR(n.target),r="internal"in n?n.internal:i?i.some(function(f){return hn(f)&&f[0]===t.delimiter}):!0,a=this.machine.options.guards,o=this.resolveTarget(i),s=we(we({},n),{actions:Ki(Rt(n.actions)),cond:c_(n.cond,a),target:o,source:this,internal:r,eventType:n.event,toJSON:function(){return we(we({},s),{target:s.target?s.target.map(function(f){return"#".concat(f.id)}):void 0,source:"#".concat(t.id)})}});return s},e.prototype.formatTransitions=function(){var n,t,i=this,r;if(!this.config.on)r=[];else if(Array.isArray(this.config.on))r=this.config.on;else{var a=this.config.on,o=Bo,s=a[o],f=s===void 0?[]:s,d=ah(a,[typeof o=="symbol"?o:o+""]);r=Pn(Object.keys(d).map(function(k){!Mn&&k===_a&&qn(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(i.id,'".'));var E=ba(k,d[k]);return Mn||mz(i,k,E),E}).concat(ba(Bo,f)))}var c=this.config.always?ba("",this.config.always):[],u=this.config.onDone?ba(String(sl(this.id)),this.config.onDone):[];Mn||qn(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var h=Pn(this.invoke.map(function(k){var E=[];return k.onDone&&E.push.apply(E,Sn([],un(ba(String(fl(k.id)),k.onDone)),!1)),k.onError&&E.push.apply(E,Sn([],un(ba(String(Fo(k.id)),k.onError)),!1)),E})),p=this.after,g=Pn(Sn(Sn(Sn(Sn([],un(u),!1),un(h),!1),un(r),!1),un(c),!1).map(function(k){return Rt(k).map(function(E){return i.formatTransition(E)})}));try{for(var b=fn(p),w=b.next();!w.done;w=b.next()){var _=w.value;g.push(_)}}catch(k){n={error:k}}finally{try{w&&!w.done&&(t=b.return)&&t.call(b)}finally{if(n)throw n.error}}return g},e}(),x_=!1;function wh(e,n){return!Mn&&!("predictableActionArguments"in e)&&!x_&&(x_=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new gz(e,n)}var ft=YR,bz=l.useLayoutEffect;function E_(e){var n=de.useRef();return n.current||(n.current={v:e()}),n.current.v}var hl=function(){return hl=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++){n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hl.apply(this,arguments)},yz=function(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)n.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(t[i[r]]=e[i[r]]);return t},wz=function(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a};function _z(e,n){var t=E_(function(){return typeof e=="function"?e():e});if(process.env.NODE_ENV!=="production"&&typeof e!="function"){var i=wz(l.useState(t),1),r=i[0];e!==r&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var a=n.context,o=n.guards,s=n.actions,f=n.activities,d=n.services,c=n.delays;n.state;var u=yz(n,["context","guards","actions","activities","services","delays","state"]),h=E_(function(){var p={context:a,guards:o,actions:s,activities:f,services:d,delays:c},g=t.withConfig(p,function(){return hl(hl({},t.context),a)});return k_(g,u)});return bz(function(){Object.assign(h.machine.options.actions,s),Object.assign(h.machine.options.guards,o),Object.assign(h.machine.options.activities,f),Object.assign(h.machine.options.services,d),Object.assign(h.machine.options.delays,c)},[s,o,f,d,c]),h}function kz(e,n,t){if(e.status===Fn.NotStarted)return!0;var i=t.changed===void 0&&(Object.keys(t.children).length>0||typeof n.changed=="boolean");return!(t.changed||i)}var xz=function(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a};function Ez(e){return e}function _h(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=xz(n,1),r=i[0],a=r===void 0?{}:r,o=_z(e,a),s=l.useCallback(function(){return o.status===Fn.NotStarted?a.state?At.create(a.state):o.machine.initialState:o.getSnapshot()},[o]),f=l.useCallback(function(u,h){return kz(o,u,h)},[o]),d=l.useCallback(function(u){var h=o.subscribe(u).unsubscribe;return h},[o]),c=kR.useSyncExternalStoreWithSelector(d,s,s,Ez,f);return l.useEffect(function(){var u=a.state;return o.start(u?At.create(u):void 0),function(){o.stop(),o.status=Fn.NotStarted}},[]),[c,o.send,o]}const Sz=wh({id:"identity",predictableActionArguments:!0,context:{identity:null,identitySubscribable:null},initial:"choosingAction",invoke:{src:e=>e.identitySubscribable},states:{unknown:{always:[{cond:"initiallyManagingDeviceInvitation",target:"managingDeviceInvitation",actions:"log"},{target:"choosingAction",actions:"log"}]},choosingAction:{},managingDeviceInvitation:{},confirmingResetStorage:{},confirmingJoinNewIdentity:{}},on:{unchooseAction:{target:".choosingAction",actions:["unsetInvitation","log"]},deselectInvitation:{target:".choosingAction",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingDeviceInvitation",actions:["setInvitation","log"]},chooseJoinNewIdentity:{target:".confirmingJoinNewIdentity",actions:"log"},chooseResetStorage:{target:".confirmingResetStorage",actions:"log"}}},{guards:{initiallyManagingDeviceInvitation:({initialDisposition:e},n)=>e==="manage-device-invitation"},actions:{setIdentity:ft({identity:(e,n)=>(n==null?void 0:n.identity)??null}),setInvitation:ft({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:ft({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),Cz=(e,n)=>_h(Sz,{...n,context:{...n==null?void 0:n.context,identity:e.halo.identity.get(),identitySubscribable:e.halo.identity.map(t=>({type:"setIdentity",identity:t}))}}),$z=e=>{const{send:n}=e,t=Re.useClient(),i=vt.useHaloInvitations(),r=Re.useAgentHostingClient(),a=l.useCallback(s=>{const f=xi.InvitationEncoder.encode(s);s.state===Se.State.CONNECTING&&Ge.info(JSON.stringify({invitationCode:f,authCode:s.authCode}))},[]),o=()=>{i.forEach(f=>f.cancel());const s=t.halo.share();process.env.NODE_ENV!=="production"&&s.subscribe(a),n==null||n({type:"selectInvitation",invitation:s})};return l.createElement(Tz,{...e,onCreateInvitationClick:o,agentHostingEnabled:!!r})},Tz=({send:e,onCreateInvitationClick:n,devices:t,onAgentDestroy:i,onAgentCreate:r,agentStatus:a,agentActive:o,agentHostingEnabled:s})=>l.createElement(l.Fragment,null,l.createElement(JL,{devices:t,onClickAdd:n,onClickJoinExisting:()=>e==null?void 0:e({type:"chooseJoinNewIdentity"}),onClickReset:()=>e==null?void 0:e({type:"chooseResetStorage"})}),s&&l.createElement(eL,{agentActive:o,agentStatus:a,onAgentDestroy:i,onAgentCreate:r})),Az=({invitations:e,identity:n})=>{const[t,i]=l.useState(""),[r,a]=l.useState(""),[o,s]=l.useState(!1),f=Re.useAgentHostingClient(),d=Re.useClient();l.useEffect(()=>{(async()=>{if(f){const g=await(f==null?void 0:f.getAgent((n==null?void 0:n.identityKey.truncate())??"foo"));g?(s(!0),a(g)):(s(!1),i("No agent deployed via provider."))}else i("No agent provider configured.")})()},[]);const c=l.useCallback(async p=>{const g=xi.InvitationEncoder.encode(p);if(p.state===Se.State.CONNECTING&&(Ge.info(JSON.stringify({invitationCode:g,authCode:p.authCode})),to(n,"Identity not found"),f))try{const b=await(f==null?void 0:f.createAgent(g,n.identityKey.truncate()));a(b),s(!0),i("")}catch(b){i(`error creating agent: ${b.message}`)}},[]);return{onAgentCreate:async()=>{e.forEach(g=>g.cancel()),d.halo.share({type:Se.Type.INTERACTIVE,authMethod:Se.AuthMethod.NONE,multiUse:!0}).subscribe(c)},onAgentDestroy:async()=>{const p=d.halo.identity.get();to(p,"Identity not found");try{await(f==null?void 0:f.destroyAgent(p.identityKey.truncate())),i("No agent deployed via provider."),a(""),s(!1)}catch(g){i(`error destroying agent: ${g.message}`)}},validationMessage:t,agentStatus:r,agentActive:o}};var S_={exports:{}};(function(e,n){var t=function(){var i=function(T,O){var C=236,P=17,F=T,B=a[O],L=null,N=0,X=null,Y=[],ee={},re=function(j,W){N=F*4+17,L=function(V){for(var I=new Array(V),M=0;M<V;M+=1){I[M]=new Array(V);for(var Z=0;Z<V;Z+=1)I[M][Z]=null}return I}(N),fe(0,0),fe(N-7,0),fe(0,N-7),ye(),oe(),G(j,W),F>=7&&se(j),X==null&&(X=me(F,B,Y)),J(X,W)},fe=function(j,W){for(var V=-1;V<=7;V+=1)if(!(j+V<=-1||N<=j+V))for(var I=-1;I<=7;I+=1)W+I<=-1||N<=W+I||(0<=V&&V<=6&&(I==0||I==6)||0<=I&&I<=6&&(V==0||V==6)||2<=V&&V<=4&&2<=I&&I<=4?L[j+V][W+I]=!0:L[j+V][W+I]=!1)},ce=function(){for(var j=0,W=0,V=0;V<8;V+=1){re(!0,V);var I=s.getLostPoint(ee);(V==0||j>I)&&(j=I,W=V)}return W},oe=function(){for(var j=8;j<N-8;j+=1)L[j][6]==null&&(L[j][6]=j%2==0);for(var W=8;W<N-8;W+=1)L[6][W]==null&&(L[6][W]=W%2==0)},ye=function(){for(var j=s.getPatternPosition(F),W=0;W<j.length;W+=1)for(var V=0;V<j.length;V+=1){var I=j[W],M=j[V];if(L[I][M]==null)for(var Z=-2;Z<=2;Z+=1)for(var te=-2;te<=2;te+=1)Z==-2||Z==2||te==-2||te==2||Z==0&&te==0?L[I+Z][M+te]=!0:L[I+Z][M+te]=!1}},se=function(j){for(var W=s.getBCHTypeNumber(F),V=0;V<18;V+=1){var I=!j&&(W>>V&1)==1;L[Math.floor(V/3)][V%3+N-8-3]=I}for(var V=0;V<18;V+=1){var I=!j&&(W>>V&1)==1;L[V%3+N-8-3][Math.floor(V/3)]=I}},G=function(j,W){for(var V=B<<3|W,I=s.getBCHTypeInfo(V),M=0;M<15;M+=1){var Z=!j&&(I>>M&1)==1;M<6?L[M][8]=Z:M<8?L[M+1][8]=Z:L[N-15+M][8]=Z}for(var M=0;M<15;M+=1){var Z=!j&&(I>>M&1)==1;M<8?L[8][N-M-1]=Z:M<9?L[8][15-M-1+1]=Z:L[8][15-M-1]=Z}L[N-8][8]=!j},J=function(j,W){for(var V=-1,I=N-1,M=7,Z=0,te=s.getMaskFunction(W),he=N-1;he>0;he-=2)for(he==6&&(he-=1);;){for(var ge=0;ge<2;ge+=1)if(L[I][he-ge]==null){var ke=!1;Z<j.length&&(ke=(j[Z]>>>M&1)==1);var xe=te(I,he-ge);xe&&(ke=!ke),L[I][he-ge]=ke,M-=1,M==-1&&(Z+=1,M=7)}if(I+=V,I<0||N<=I){I-=V,V=-V;break}}},ie=function(j,W){for(var V=0,I=0,M=0,Z=new Array(W.length),te=new Array(W.length),he=0;he<W.length;he+=1){var ge=W[he].dataCount,ke=W[he].totalCount-ge;I=Math.max(I,ge),M=Math.max(M,ke),Z[he]=new Array(ge);for(var xe=0;xe<Z[he].length;xe+=1)Z[he][xe]=255&j.getBuffer()[xe+V];V+=ge;var ae=s.getErrorCorrectPolynomial(ke),Ue=d(Z[he],ae.getLength()-1),an=Ue.mod(ae);te[he]=new Array(ae.getLength()-1);for(var xe=0;xe<te[he].length;xe+=1){var Pe=xe+an.getLength()-te[he].length;te[he][xe]=Pe>=0?an.getAt(Pe):0}}for(var Ve=0,xe=0;xe<W.length;xe+=1)Ve+=W[xe].totalCount;for(var _n=new Array(Ve),Ee=0,xe=0;xe<I;xe+=1)for(var he=0;he<W.length;he+=1)xe<Z[he].length&&(_n[Ee]=Z[he][xe],Ee+=1);for(var xe=0;xe<M;xe+=1)for(var he=0;he<W.length;he+=1)xe<te[he].length&&(_n[Ee]=te[he][xe],Ee+=1);return _n},me=function(j,W,V){for(var I=c.getRSBlocks(j,W),M=u(),Z=0;Z<V.length;Z+=1){var te=V[Z];M.put(te.getMode(),4),M.put(te.getLength(),s.getLengthInBits(te.getMode(),j)),te.write(M)}for(var he=0,Z=0;Z<I.length;Z+=1)he+=I[Z].dataCount;if(M.getLengthInBits()>he*8)throw"code length overflow. ("+M.getLengthInBits()+">"+he*8+")";for(M.getLengthInBits()+4<=he*8&&M.put(0,4);M.getLengthInBits()%8!=0;)M.putBit(!1);for(;!(M.getLengthInBits()>=he*8||(M.put(C,8),M.getLengthInBits()>=he*8));)M.put(P,8);return ie(M,I)};ee.addData=function(j,W){W=W||"Byte";var V=null;switch(W){case"Numeric":V=h(j);break;case"Alphanumeric":V=p(j);break;case"Byte":V=g(j);break;case"Kanji":V=b(j);break;default:throw"mode:"+W}Y.push(V),X=null},ee.isDark=function(j,W){if(j<0||N<=j||W<0||N<=W)throw j+","+W;return L[j][W]},ee.getModuleCount=function(){return N},ee.make=function(){if(F<1){for(var j=1;j<40;j++){for(var W=c.getRSBlocks(j,B),V=u(),I=0;I<Y.length;I++){var M=Y[I];V.put(M.getMode(),4),V.put(M.getLength(),s.getLengthInBits(M.getMode(),j)),M.write(V)}for(var Z=0,I=0;I<W.length;I++)Z+=W[I].dataCount;if(V.getLengthInBits()<=Z*8)break}F=j}re(!1,ce())},ee.createTableTag=function(j,W){j=j||2,W=typeof W>"u"?j*4:W;var V="";V+='<table style="',V+=" border-width: 0px; border-style: none;",V+=" border-collapse: collapse;",V+=" padding: 0px; margin: "+W+"px;",V+='">',V+="<tbody>";for(var I=0;I<ee.getModuleCount();I+=1){V+="<tr>";for(var M=0;M<ee.getModuleCount();M+=1)V+='<td style="',V+=" border-width: 0px; border-style: none;",V+=" border-collapse: collapse;",V+=" padding: 0px; margin: 0px;",V+=" width: "+j+"px;",V+=" height: "+j+"px;",V+=" background-color: ",V+=ee.isDark(I,M)?"#000000":"#ffffff",V+=";",V+='"/>';V+="</tr>"}return V+="</tbody>",V+="</table>",V},ee.createSvgTag=function(j,W,V,I){var M={};typeof arguments[0]=="object"&&(M=arguments[0],j=M.cellSize,W=M.margin,V=M.alt,I=M.title),j=j||2,W=typeof W>"u"?j*4:W,V=typeof V=="string"?{text:V}:V||{},V.text=V.text||null,V.id=V.text?V.id||"qrcode-description":null,I=typeof I=="string"?{text:I}:I||{},I.text=I.text||null,I.id=I.text?I.id||"qrcode-title":null;var Z=ee.getModuleCount()*j+W*2,te,he,ge,ke,xe="",ae;for(ae="l"+j+",0 0,"+j+" -"+j+",0 0,-"+j+"z ",xe+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',xe+=M.scalable?"":' width="'+Z+'px" height="'+Z+'px"',xe+=' viewBox="0 0 '+Z+" "+Z+'" ',xe+=' preserveAspectRatio="xMinYMin meet"',xe+=I.text||V.text?' role="img" aria-labelledby="'+H([I.id,V.id].join(" ").trim())+'"':"",xe+=">",xe+=I.text?'<title id="'+H(I.id)+'">'+H(I.text)+"</title>":"",xe+=V.text?'<description id="'+H(V.id)+'">'+H(V.text)+"</description>":"",xe+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',xe+='<path d="',ge=0;ge<ee.getModuleCount();ge+=1)for(ke=ge*j+W,te=0;te<ee.getModuleCount();te+=1)ee.isDark(ge,te)&&(he=te*j+W,xe+="M"+he+","+ke+ae);return xe+='" stroke="transparent" fill="black"/>',xe+="</svg>",xe},ee.createDataURL=function(j,W){j=j||2,W=typeof W>"u"?j*4:W;var V=ee.getModuleCount()*j+W*2,I=W,M=V-W;return S(V,V,function(Z,te){if(I<=Z&&Z<M&&I<=te&&te<M){var he=Math.floor((Z-I)/j),ge=Math.floor((te-I)/j);return ee.isDark(ge,he)?0:1}else return 1})},ee.createImgTag=function(j,W,V){j=j||2,W=typeof W>"u"?j*4:W;var I=ee.getModuleCount()*j+W*2,M="";return M+="<img",M+=' src="',M+=ee.createDataURL(j,W),M+='"',M+=' width="',M+=I,M+='"',M+=' height="',M+=I,M+='"',V&&(M+=' alt="',M+=H(V),M+='"'),M+="/>",M};var H=function(j){for(var W="",V=0;V<j.length;V+=1){var I=j.charAt(V);switch(I){case"<":W+="&lt;";break;case">":W+="&gt;";break;case"&":W+="&amp;";break;case'"':W+="&quot;";break;default:W+=I;break}}return W},K=function(j){var W=1;j=typeof j>"u"?W*2:j;var V=ee.getModuleCount()*W+j*2,I=j,M=V-j,Z,te,he,ge,ke,xe={"██":"█","█ ":"▀"," █":"▄"," ":" "},ae={"██":"▀","█ ":"▀"," █":" "," ":" "},Ue="";for(Z=0;Z<V;Z+=2){for(he=Math.floor((Z-I)/W),ge=Math.floor((Z+1-I)/W),te=0;te<V;te+=1)ke="█",I<=te&&te<M&&I<=Z&&Z<M&&ee.isDark(he,Math.floor((te-I)/W))&&(ke=" "),I<=te&&te<M&&I<=Z+1&&Z+1<M&&ee.isDark(ge,Math.floor((te-I)/W))?ke+=" ":ke+="█",Ue+=j<1&&Z+1>=M?ae[ke]:xe[ke];Ue+=`
945
945
  `}return V%2&&j>0?Ue.substring(0,Ue.length-V-1)+Array(V+1).join("▀"):Ue.substring(0,Ue.length-1)};return ee.createASCII=function(j,W){if(j=j||1,j<2)return K(W);j-=1,W=typeof W>"u"?j*2:W;var V=ee.getModuleCount()*j+W*2,I=W,M=V-W,Z,te,he,ge,ke=Array(j+1).join("██"),xe=Array(j+1).join(" "),ae="",Ue="";for(Z=0;Z<V;Z+=1){for(he=Math.floor((Z-I)/j),Ue="",te=0;te<V;te+=1)ge=1,I<=te&&te<M&&I<=Z&&Z<M&&ee.isDark(he,Math.floor((te-I)/j))&&(ge=0),Ue+=ge?ke:xe;for(he=0;he<j;he+=1)ae+=Ue+`
946
- `}return ae.substring(0,ae.length-1)},ee.renderTo2dContext=function(j,W){W=W||2;for(var V=ee.getModuleCount(),I=0;I<V;I++)for(var M=0;M<V;M++)j.fillStyle=ee.isDark(I,M)?"black":"white",j.fillRect(I*W,M*W,W,W)},ee};i.stringToBytesFuncs={default:function(T){for(var O=[],C=0;C<T.length;C+=1){var P=T.charCodeAt(C);O.push(P&255)}return O}},i.stringToBytes=i.stringToBytesFuncs.default,i.createStringToBytes=function(T,O){var C=function(){for(var F=k(T),B=function(){var oe=F.read();if(oe==-1)throw"eof";return oe},L=0,N={};;){var X=F.read();if(X==-1)break;var Y=B(),ee=B(),re=B(),fe=String.fromCharCode(X<<8|Y),ce=ee<<8|re;N[fe]=ce,L+=1}if(L!=O)throw L+" != "+O;return N}(),P=63;return function(F){for(var B=[],L=0;L<F.length;L+=1){var N=F.charCodeAt(L);if(N<128)B.push(N);else{var X=C[F.charAt(L)];typeof X=="number"?(X&255)==X?B.push(X):(B.push(X>>>8),B.push(X&255)):B.push(P)}}return B}};var r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},a={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var T=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],O=1335,C=7973,P=21522,F={},B=function(L){for(var N=0;L!=0;)N+=1,L>>>=1;return N};return F.getBCHTypeInfo=function(L){for(var N=L<<10;B(N)-B(O)>=0;)N^=O<<B(N)-B(O);return(L<<10|N)^P},F.getBCHTypeNumber=function(L){for(var N=L<<12;B(N)-B(C)>=0;)N^=C<<B(N)-B(C);return L<<12|N},F.getPatternPosition=function(L){return T[L-1]},F.getMaskFunction=function(L){switch(L){case o.PATTERN000:return function(N,X){return(N+X)%2==0};case o.PATTERN001:return function(N,X){return N%2==0};case o.PATTERN010:return function(N,X){return X%3==0};case o.PATTERN011:return function(N,X){return(N+X)%3==0};case o.PATTERN100:return function(N,X){return(Math.floor(N/2)+Math.floor(X/3))%2==0};case o.PATTERN101:return function(N,X){return N*X%2+N*X%3==0};case o.PATTERN110:return function(N,X){return(N*X%2+N*X%3)%2==0};case o.PATTERN111:return function(N,X){return(N*X%3+(N+X)%2)%2==0};default:throw"bad maskPattern:"+L}},F.getErrorCorrectPolynomial=function(L){for(var N=d([1],0),X=0;X<L;X+=1)N=N.multiply(d([1,f.gexp(X)],0));return N},F.getLengthInBits=function(L,N){if(1<=N&&N<10)switch(L){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:return 8;case r.MODE_KANJI:return 8;default:throw"mode:"+L}else if(N<27)switch(L){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw"mode:"+L}else if(N<41)switch(L){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw"mode:"+L}else throw"type:"+N},F.getLostPoint=function(L){for(var N=L.getModuleCount(),X=0,Y=0;Y<N;Y+=1)for(var ee=0;ee<N;ee+=1){for(var re=0,fe=L.isDark(Y,ee),ce=-1;ce<=1;ce+=1)if(!(Y+ce<0||N<=Y+ce))for(var oe=-1;oe<=1;oe+=1)ee+oe<0||N<=ee+oe||ce==0&&oe==0||fe==L.isDark(Y+ce,ee+oe)&&(re+=1);re>5&&(X+=3+re-5)}for(var Y=0;Y<N-1;Y+=1)for(var ee=0;ee<N-1;ee+=1){var ye=0;L.isDark(Y,ee)&&(ye+=1),L.isDark(Y+1,ee)&&(ye+=1),L.isDark(Y,ee+1)&&(ye+=1),L.isDark(Y+1,ee+1)&&(ye+=1),(ye==0||ye==4)&&(X+=3)}for(var Y=0;Y<N;Y+=1)for(var ee=0;ee<N-6;ee+=1)L.isDark(Y,ee)&&!L.isDark(Y,ee+1)&&L.isDark(Y,ee+2)&&L.isDark(Y,ee+3)&&L.isDark(Y,ee+4)&&!L.isDark(Y,ee+5)&&L.isDark(Y,ee+6)&&(X+=40);for(var ee=0;ee<N;ee+=1)for(var Y=0;Y<N-6;Y+=1)L.isDark(Y,ee)&&!L.isDark(Y+1,ee)&&L.isDark(Y+2,ee)&&L.isDark(Y+3,ee)&&L.isDark(Y+4,ee)&&!L.isDark(Y+5,ee)&&L.isDark(Y+6,ee)&&(X+=40);for(var se=0,ee=0;ee<N;ee+=1)for(var Y=0;Y<N;Y+=1)L.isDark(Y,ee)&&(se+=1);var G=Math.abs(100*se/N/N-50)/5;return X+=G*10,X},F}(),f=function(){for(var T=new Array(256),O=new Array(256),C=0;C<8;C+=1)T[C]=1<<C;for(var C=8;C<256;C+=1)T[C]=T[C-4]^T[C-5]^T[C-6]^T[C-8];for(var C=0;C<255;C+=1)O[T[C]]=C;var P={};return P.glog=function(F){if(F<1)throw"glog("+F+")";return O[F]},P.gexp=function(F){for(;F<0;)F+=255;for(;F>=256;)F-=255;return T[F]},P}();function d(T,O){if(typeof T.length>"u")throw T.length+"/"+O;var C=function(){for(var F=0;F<T.length&&T[F]==0;)F+=1;for(var B=new Array(T.length-F+O),L=0;L<T.length-F;L+=1)B[L]=T[L+F];return B}(),P={};return P.getAt=function(F){return C[F]},P.getLength=function(){return C.length},P.multiply=function(F){for(var B=new Array(P.getLength()+F.getLength()-1),L=0;L<P.getLength();L+=1)for(var N=0;N<F.getLength();N+=1)B[L+N]^=f.gexp(f.glog(P.getAt(L))+f.glog(F.getAt(N)));return d(B,0)},P.mod=function(F){if(P.getLength()-F.getLength()<0)return P;for(var B=f.glog(P.getAt(0))-f.glog(F.getAt(0)),L=new Array(P.getLength()),N=0;N<P.getLength();N+=1)L[N]=P.getAt(N);for(var N=0;N<F.getLength();N+=1)L[N]^=f.gexp(f.glog(F.getAt(N))+B);return d(L,0).mod(F)},P}var c=function(){var T=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],O=function(F,B){var L={};return L.totalCount=F,L.dataCount=B,L},C={},P=function(F,B){switch(B){case a.L:return T[(F-1)*4+0];case a.M:return T[(F-1)*4+1];case a.Q:return T[(F-1)*4+2];case a.H:return T[(F-1)*4+3];default:return}};return C.getRSBlocks=function(F,B){var L=P(F,B);if(typeof L>"u")throw"bad rs block @ typeNumber:"+F+"/errorCorrectionLevel:"+B;for(var N=L.length/3,X=[],Y=0;Y<N;Y+=1)for(var ee=L[Y*3+0],re=L[Y*3+1],fe=L[Y*3+2],ce=0;ce<ee;ce+=1)X.push(O(re,fe));return X},C}(),u=function(){var T=[],O=0,C={};return C.getBuffer=function(){return T},C.getAt=function(P){var F=Math.floor(P/8);return(T[F]>>>7-P%8&1)==1},C.put=function(P,F){for(var B=0;B<F;B+=1)C.putBit((P>>>F-B-1&1)==1)},C.getLengthInBits=function(){return O},C.putBit=function(P){var F=Math.floor(O/8);T.length<=F&&T.push(0),P&&(T[F]|=128>>>O%8),O+=1},C},h=function(T){var O=r.MODE_NUMBER,C=T,P={};P.getMode=function(){return O},P.getLength=function(L){return C.length},P.write=function(L){for(var N=C,X=0;X+2<N.length;)L.put(F(N.substring(X,X+3)),10),X+=3;X<N.length&&(N.length-X==1?L.put(F(N.substring(X,X+1)),4):N.length-X==2&&L.put(F(N.substring(X,X+2)),7))};var F=function(L){for(var N=0,X=0;X<L.length;X+=1)N=N*10+B(L.charAt(X));return N},B=function(L){if("0"<=L&&L<="9")return L.charCodeAt(0)-48;throw"illegal char :"+L};return P},p=function(T){var O=r.MODE_ALPHA_NUM,C=T,P={};P.getMode=function(){return O},P.getLength=function(B){return C.length},P.write=function(B){for(var L=C,N=0;N+1<L.length;)B.put(F(L.charAt(N))*45+F(L.charAt(N+1)),11),N+=2;N<L.length&&B.put(F(L.charAt(N)),6)};var F=function(B){if("0"<=B&&B<="9")return B.charCodeAt(0)-48;if("A"<=B&&B<="Z")return B.charCodeAt(0)-65+10;switch(B){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+B}};return P},g=function(T){var O=r.MODE_8BIT_BYTE,C=i.stringToBytes(T),P={};return P.getMode=function(){return O},P.getLength=function(F){return C.length},P.write=function(F){for(var B=0;B<C.length;B+=1)F.put(C[B],8)},P},b=function(T){var O=r.MODE_KANJI,C=i.stringToBytesFuncs.SJIS;if(!C)throw"sjis not supported.";(function(B,L){var N=C(B);if(N.length!=2||(N[0]<<8|N[1])!=L)throw"sjis not supported."})("友",38726);var P=C(T),F={};return F.getMode=function(){return O},F.getLength=function(B){return~~(P.length/2)},F.write=function(B){for(var L=P,N=0;N+1<L.length;){var X=(255&L[N])<<8|255&L[N+1];if(33088<=X&&X<=40956)X-=33088;else if(57408<=X&&X<=60351)X-=49472;else throw"illegal char at "+(N+1)+"/"+X;X=(X>>>8&255)*192+(X&255),B.put(X,13),N+=2}if(N<L.length)throw"illegal char at "+(N+1)},F},w=function(){var T=[],O={};return O.writeByte=function(C){T.push(C&255)},O.writeShort=function(C){O.writeByte(C),O.writeByte(C>>>8)},O.writeBytes=function(C,P,F){P=P||0,F=F||C.length;for(var B=0;B<F;B+=1)O.writeByte(C[B+P])},O.writeString=function(C){for(var P=0;P<C.length;P+=1)O.writeByte(C.charCodeAt(P))},O.toByteArray=function(){return T},O.toString=function(){var C="";C+="[";for(var P=0;P<T.length;P+=1)P>0&&(C+=","),C+=T[P];return C+="]",C},O},_=function(){var T=0,O=0,C=0,P="",F={},B=function(N){P+=String.fromCharCode(L(N&63))},L=function(N){if(!(N<0)){if(N<26)return 65+N;if(N<52)return 97+(N-26);if(N<62)return 48+(N-52);if(N==62)return 43;if(N==63)return 47}throw"n:"+N};return F.writeByte=function(N){for(T=T<<8|N&255,O+=8,C+=1;O>=6;)B(T>>>O-6),O-=6},F.flush=function(){if(O>0&&(B(T<<6-O),T=0,O=0),C%3!=0)for(var N=3-C%3,X=0;X<N;X+=1)P+="="},F.toString=function(){return P},F},k=function(T){var O=T,C=0,P=0,F=0,B={};B.read=function(){for(;F<8;){if(C>=O.length){if(F==0)return-1;throw"unexpected end of file./"+F}var N=O.charAt(C);if(C+=1,N=="=")return F=0,-1;if(N.match(/^\s$/))continue;P=P<<6|L(N.charCodeAt(0)),F+=6}var X=P>>>F-8&255;return F-=8,X};var L=function(N){if(65<=N&&N<=90)return N-65;if(97<=N&&N<=122)return N-97+26;if(48<=N&&N<=57)return N-48+52;if(N==43)return 62;if(N==47)return 63;throw"c:"+N};return B},E=function(T,O){var C=T,P=O,F=new Array(T*O),B={};B.setPixel=function(Y,ee,re){F[ee*C+Y]=re},B.write=function(Y){Y.writeString("GIF87a"),Y.writeShort(C),Y.writeShort(P),Y.writeByte(128),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(255),Y.writeByte(255),Y.writeByte(255),Y.writeString(","),Y.writeShort(0),Y.writeShort(0),Y.writeShort(C),Y.writeShort(P),Y.writeByte(0);var ee=2,re=N(ee);Y.writeByte(ee);for(var fe=0;re.length-fe>255;)Y.writeByte(255),Y.writeBytes(re,fe,255),fe+=255;Y.writeByte(re.length-fe),Y.writeBytes(re,fe,re.length-fe),Y.writeByte(0),Y.writeString(";")};var L=function(Y){var ee=Y,re=0,fe=0,ce={};return ce.write=function(oe,ye){if(oe>>>ye)throw"length over";for(;re+ye>=8;)ee.writeByte(255&(oe<<re|fe)),ye-=8-re,oe>>>=8-re,fe=0,re=0;fe=oe<<re|fe,re=re+ye},ce.flush=function(){re>0&&ee.writeByte(fe)},ce},N=function(Y){for(var ee=1<<Y,re=(1<<Y)+1,fe=Y+1,ce=X(),oe=0;oe<ee;oe+=1)ce.add(String.fromCharCode(oe));ce.add(String.fromCharCode(ee)),ce.add(String.fromCharCode(re));var ye=w(),se=L(ye);se.write(ee,fe);var G=0,J=String.fromCharCode(F[G]);for(G+=1;G<F.length;){var ie=String.fromCharCode(F[G]);G+=1,ce.contains(J+ie)?J=J+ie:(se.write(ce.indexOf(J),fe),ce.size()<4095&&(ce.size()==1<<fe&&(fe+=1),ce.add(J+ie)),J=ie)}return se.write(ce.indexOf(J),fe),se.write(re,fe),se.flush(),ye.toByteArray()},X=function(){var Y={},ee=0,re={};return re.add=function(fe){if(re.contains(fe))throw"dup key:"+fe;Y[fe]=ee,ee+=1},re.size=function(){return ee},re.indexOf=function(fe){return Y[fe]},re.contains=function(fe){return typeof Y[fe]<"u"},re};return B},S=function(T,O,C){for(var P=E(T,O),F=0;F<O;F+=1)for(var B=0;B<T;B+=1)P.setPixel(B,F,C(B,F));var L=w();P.write(L);for(var N=_(),X=L.toByteArray(),Y=0;Y<X.length;Y+=1)N.writeByte(X[Y]);return N.flush(),"data:image/gif;base64,"+N};return i}();(function(){t.stringToBytesFuncs["UTF-8"]=function(i){function r(a){for(var o=[],s=0;s<a.length;s++){var f=a.charCodeAt(s);f<128?o.push(f):f<2048?o.push(192|f>>6,128|f&63):f<55296||f>=57344?o.push(224|f>>12,128|f>>6&63,128|f&63):(s++,f=65536+((f&1023)<<10|a.charCodeAt(s)&1023),o.push(240|f>>18,128|f>>12&63,128|f>>6&63,128|f&63))}return o}return r(i)}})(),function(i){e.exports=i()}(function(){return t})})(S_);var Oz=S_.exports;const kh=Qi(Oz);var Pz=Object.defineProperty,vl=Object.getOwnPropertySymbols,C_=Object.prototype.hasOwnProperty,$_=Object.prototype.propertyIsEnumerable,T_=(e,n,t)=>n in e?Pz(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Iz=(e,n)=>{for(var t in n||(n={}))C_.call(n,t)&&T_(e,t,n[t]);if(vl)for(var t of vl(n))$_.call(n,t)&&T_(e,t,n[t]);return e},Fz=(e,n)=>{var t={};for(var i in e)C_.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&vl)for(var i of vl(e))n.indexOf(i)<0&&$_.call(e,i)&&(t[i]=e[i]);return t},bi=1e3,Mz=/code length overflow/i;kh.stringToBytes=kh.stringToBytesFuncs["UTF-8"];var Nz=(e,n,t)=>{t=Math.max(1,t);for(let i=t;i<=40;i+=1)try{const r=kh(i,n);r.addData(e),r.make();const a=r.getModuleCount();return{text:e,level:n,version:i,moduleCount:a,isDark:(s,f)=>s>=0&&s<a&&f>=0&&f<a&&r.isDark(s,f)}}catch(r){if(!(i<40&&Mz.test(String(r))))throw r}return null},Yi=Math.round,Ea=(e,n)=>`M ${Yi(e)} ${Yi(n)}`,nt=(e,n)=>`L ${Yi(e)} ${Yi(n)}`,Ji=(e,n,t)=>`A ${Yi(t)} ${Yi(t)} 0 0 1 ${Yi(e)} ${Yi(n)}`,Dz=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a?d.push(Ea(e+r,n)):d.push(Ea(e,n)),o?d.push(nt(t-r,n),Ji(t,n+r,r)):d.push(nt(t,n)),s?d.push(nt(t,i-r),Ji(t-r,i,r)):d.push(nt(t,i)),f?d.push(nt(e+r,i),Ji(e,i-r,r)):d.push(nt(e,i)),a?d.push(nt(e,n+r),Ji(e+r,n,r)):d.push(nt(e,n)),d.join(" ")},Lz=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a&&d.push(Ea(e+r,n),nt(e,n),nt(e,n+r),Ji(e+r,n,r)),o&&d.push(Ea(t,n+r),nt(t,n),nt(t-r,n),Ji(t,n+r,r)),s&&d.push(Ea(t-r,i),nt(t,i),nt(t,i-r),Ji(t-r,i,r)),f&&d.push(Ea(e,i-r),nt(e,i),nt(e+r,i),Ji(e,i-r,r)),d.join(" ")},Bz=(e,n,t,i,r)=>{const a=r*t,o=i*t,s=a+t,f=o+t,d=n*.005*t,c=e.isDark,u=i-1,h=i+1,p=r-1,g=r+1,b=c(i,r),w=c(u,p),_=c(u,r),k=c(u,g),E=c(i,g),S=c(h,g),T=c(h,r),O=c(h,p),C=c(i,p);return b?Dz(a,o,s,f,d,!_&&!C,!_&&!E,!T&&!E,!T&&!C):Lz(a,o,s,f,d,_&&C&&w,_&&E&&k,T&&E&&S,T&&C&&O)},jz=(e,n)=>{if(!e)return"";const t=e.moduleCount,i=bi/t,r=[];for(let a=0;a<t;a+=1)for(let o=0;o<t;o+=1)r.push(Bz(e,n,i,a,o));return r.join(" ")},Rz=e=>{var n=e,{color:t="#000",backgroundColor:i,cutout:r=!1,cutoutElement:a,errorCorrectionLevel:o="Q",rounding:s=0,children:f}=n,d=Fz(n,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),c,u;const h=l.useMemo(()=>Nz(f,o,1),[f,o]);if(!h)return null;const p=(c=h==null?void 0:h.moduleCount)!=null?c:1,b=bi/((u=h==null?void 0:h.moduleCount)!=null?u:1)*(Math.floor(p*.18)*2-1)+2,w=(bi-b)/2;return de.createElement("svg",Iz({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${bi} ${bi}`},d),r?de.createElement("mask",{id:"react-qr-rounded__mask"},de.createElement("rect",{x:"0",y:"0",width:bi,height:bi,fill:"#fff"}),de.createElement("rect",{x:w,y:w,width:b,height:b,rx:s,ry:s,fill:"#000"})):null,i?de.createElement("rect",{x:"0",y:"0",width:bi,height:bi,fill:i}):null,de.createElement("path",{fill:t,d:jz(h,s),mask:r?"url(#react-qr-rounded__mask)":void 0}),a?de.createElement("foreignObject",{x:w,y:w,width:b,height:b},de.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",overflow:"hidden",borderRadius:s}},a)):null)};const zz=new Map([[Se.State.ERROR,-3],[Se.State.TIMEOUT,-2],[Se.State.CANCELLED,-1],[Se.State.INIT,0],[Se.State.CONNECTING,1],[Se.State.CONNECTED,2],[Se.State.READY_FOR_AUTHENTICATION,3],[Se.State.AUTHENTICATING,4],[Se.State.SUCCESS,5]]),xh=({children:e,...n})=>l.createElement(bn.View,{...n,classNames:"grow flex flex-col justify-around items-center"},e),A_=({invitationUrl:e,active:n,send:t,status:i,multiUse:r,authCode:a,id:o="0"})=>{const{t:s}=vn("os"),f=$n("invitation-manager__qr-code"),d=r?0:zz.get(i)??0,c=d===3,u=io(o),h=l.useMemo(()=>{switch(!0){case d===5:case d<0:return"showing final";case d===3:return"showing auth code";default:return"showing qr"}},[d]);return l.createElement(l.Fragment,null,l.createElement(bn.Root,{activeView:h,classNames:"grow plb-1"},l.createElement(bn.Views,null,l.createElement(xh,{id:"showing qr",emoji:u},l.createElement("p",{className:"text-sm mlb-1 font-normal text-center"},s(r?"invite many qr label":"invite one qr label")),l.createElement("div",{role:"none",className:le(In,"is-full max-is-[14rem] relative")},l.createElement(Rz,{rounding:100,backgroundColor:"transparent",color:"currentColor",className:le("is-full bs-full p-2",c&&"invisible"),"aria-labelledby":f,errorCorrectionLevel:"Q",cutout:!0},e??"never"),l.createElement(xj,null,l.createElement(qu,{text:u}))),l.createElement("span",{id:f,className:"sr-only"},s("qr label")),l.createElement(nL,{variant:"ghost",value:e??"never"})),l.createElement(xh,{id:"showing auth code"},l.createElement($2,null,s("auth code message")),l.createElement(S2,{code:a,large:!0,classNames:"text-black dark:text-white"}),l.createElement($2,null,"Be sure the other device is showing this symbol:"),u&&l.createElement(qu,{text:u})),l.createElement(xh,{id:"showing final"},d>0?l.createElement(qe.Check,{className:le("m-1.5",He(6))}):l.createElement(qe.X,{className:le("m-1.5",He(6))})))),l.createElement(jt,{classNames:"mbs-4"},l.createElement(Vn,{disabled:!n,onClick:()=>t==null?void 0:t({type:"deselectInvitation"})},s("back label"))))},Eh=({active:e,onCancel:n,onConfirm:t,mode:i})=>{const{t:r}=vn("os"),[a,o]=l.useState(""),[s,f]=l.useState(!1),d=async()=>(f(!0),t==null?void 0:t().then(()=>f(!1),c=>{Ge.catch(c),o(r("failed to reset identity message")),f(!1)}));return l.createElement(Uz,{disabled:!e,pending:s,validationMessage:a,onConfirm:d,onCancel:n,mode:i})},Uz=({disabled:e,pending:n,validationMessage:t,onConfirm:i,onCancel:r,mode:a})=>{const{t:o}=vn("os"),s=o("confirmation value"),[f,d]=l.useState(""),c=a==="join new identity"?"join-new-identity":"reset-storage";return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col gap-2 justify-center"},l.createElement(Dc.Root,{valence:"error"},l.createElement(Dc.Title,null,l.createElement(qe.Warning,{className:le(He(6),"inline mie-2")}),o("sign out chooser title")),l.createElement(Dc.Body,null,o("sign out chooser message"))),l.createElement(Ku,{validationMessage:t,label:l.createElement(gi,{className:"text-start mlb-2"},o(a==="join new identity"?"join new identity input label":"reset storage input label",{confirmationValue:s})),disabled:e,"data-testid":`${c}.reset-identity-input`,placeholder:s,onChange:({target:{value:u}})=>d(u)})),l.createElement(jt,null,r&&l.createElement(Vn,{disabled:e,onClick:r,"data-testid":`${c}.reset-identity-cancel`},o("cancel label")),i&&l.createElement(Vn,{variant:"destructive",disabled:e||n||f!==s,onClick:i,"data-testid":`${c}.reset-identity-confirm`},o(n?"reset in progress label":"reset device label"))))},pl="pbs-1 pbe-3 pli-3",Wz=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.hue)||a$((e==null?void 0:e.identityKey.toHex())??"0")},Hz=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.emoji)||io((e==null?void 0:e.identityKey.toHex())??"0")},Vz=({titleId:e,title:n,identity:t,onDone:i,onUpdateProfile:r,connectionState:a,onChangeConnectionState:o})=>{var C,P;const s=oc(t.identityKey),{t:f}=vn("os"),[d,c]=l.useState(((C=t.profile)==null?void 0:C.displayName)??""),[u,h]=l.useState(Hz(t)),[p,g]=l.useState(Wz(t)),{textValue:b,setTextValue:w}=du(),_=t.identityKey.toHex(),k=b===_,E=async()=>{const F={...d&&{displayName:d},...(u||p)&&{data:{...u&&{emoji:u},...p&&{hue:p}}}};return r==null?void 0:r(F)},S=F=>{h(F),E()},T=F=>{g(F),E()},O=a===Xo.ConnectionState.ONLINE;return l.createElement(Gu,{titleId:e,title:n,corner:l.createElement(C2,{onDone:i})},l.createElement(wn.Root,{size:16,variant:"circle",status:O?"active":"error",hue:p||s.hue},l.createElement(mo.Root,{classNames:"grid grid-cols-[1fr_var(--rail-action)_min-content_var(--rail-action)_1fr] items-center gap-2"},l.createElement(Ze.Root,null,l.createElement(Ze.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:"bs-[--rail-action] is-[--rail-action] justify-self-end",onClick:()=>o==null?void 0:o(O?Xo.ConnectionState.OFFLINE:Xo.ConnectionState.ONLINE)},l.createElement("span",{className:"sr-only"},f(O?"disconnect label":"connect label")),O?l.createElement(qe.PlugsConnected,{className:He(5)}):l.createElement(qe.Plugs,{className:He(5)}))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},f(O?"disconnect label":"connect label"),l.createElement(Ze.Arrow,null)))),l.createElement(WL,{emoji:u,onChangeEmoji:S,classNames:"bs-[--rail-action]"}),l.createElement(wn.Frame,{classNames:"relative z-[2] -mli-4 chromatic-ignore"},l.createElement(wn.Fallback,{text:u||s.emoji})),l.createElement(VL,{hue:p,onChangeHue:T,classNames:"bs-[--rail-action]"}),l.createElement(Ze.Root,null,l.createElement(Ze.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:"bs-[--rail-action] justify-self-start","data-testid":"update-profile-form-copy-key",onClick:()=>w(_)},l.createElement("span",{className:"sr-only"},f(k?"copy success label":"copy self public key label")),l.createElement(qe.CopySimple,{className:He(5)}))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},f(k?"copy success label":"copy self public key label"),l.createElement(Ze.Arrow,null))))),l.createElement(wn.Label,{classNames:"sr-only","data-testid":"identityHeading.displayName"},((P=t.profile)==null?void 0:P.displayName)??Nf(t.identityKey.toHex())),l.createElement(bt.Root,null,l.createElement(bt.Label,{srOnly:!0},f("display name input label")),l.createElement(bt.TextInput,{variant:"subdued","data-testid":"display-name-input",placeholder:f("display name input placeholder"),classNames:"mbs-2 text-center font-light text-xl",value:d,onChange:({target:{value:F}})=>{c(F)},onBlur:E}))))},O_=e=>{const{identity:n,titleId:t,activeView:i,onUpdateProfile:r,onResetStorage:a,onJoinNewIdentity:o,IdentityActionChooser:s=$z,InvitationManager:f=A_,connectionState:d,onChangeConnectionState:c,onDone:u,...h}=e,{t:p}=vn("os"),g=l.useMemo(()=>{switch(i){case"device invitation manager":return p("choose add device label");default:return p("identity heading")}},[i,p]),b=()=>{var w;return(w=h.send)==null?void 0:w.call(h,"unchooseAction")};return l.createElement(po,{density:"fine"},l.createElement(Vz,{identity:n,titleId:t,title:g,onDone:u,onUpdateProfile:r,connectionState:d,onChangeConnectionState:c}),l.createElement(bn.Root,{activeView:i},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"identity action chooser",classNames:pl},l.createElement(s,{active:i==="identity action chooser",...h})),l.createElement(bn.View,{id:"device invitation manager",classNames:pl},l.createElement(f,{active:i==="device invitation manager",...h,invitationUrl:h.createInvitationUrl(h.invitationCode)})),l.createElement(bn.View,{classNames:pl,id:"confirm join new identity"},l.createElement(Eh,{active:i==="confirm join new identity",...h,mode:"join new identity",onConfirm:o,onCancel:b})),l.createElement(bn.View,{classNames:pl,id:"confirm reset storage"},l.createElement(Eh,{active:i==="confirm reset storage",...h,mode:"reset storage",onConfirm:a,onCancel:b})))))},qz=({invitation:e,...n})=>{const t=Vu(e);return l.createElement(O_,{...n,...t})},Gz=({titleId:e,createInvitationUrl:n=r=>r,initialDisposition:t="default",...i})=>{const r=$n("identityPanel__heading",e),a=Re.useClient(),o=vt.useDevices(),s=vt.useIdentity(),f=vt.useHaloInvitations(),d=Az({identity:s,invitations:f});if(!s)return Ge.error("IdentityPanel rendered with no active identity."),null;const[c,u,h]=Cz(a,{context:{initialDisposition:t}}),{swarm:p}=Xo.useNetworkStatus(),g=async k=>a==null?void 0:a.mesh.updateConfig(k);l.useEffect(()=>h.subscribe(E=>{Ge("[state]",E)}).unsubscribe,[h]);const b=l.useMemo(()=>{switch(!0){case c.matches("choosingAction"):return"identity action chooser";case c.matches("managingDeviceInvitation"):return"device invitation manager";case c.matches("confirmingResetStorage"):return"confirm reset storage";case c.matches("confirmingJoinNewIdentity"):return"confirm join new identity";default:return"identity action chooser"}},[c]),_={...i,identity:s,devices:o,activeView:b,send:u,titleId:r,createInvitationUrl:n,onUpdateProfile:async k=>{u({type:"updateProfile"}),await a.halo.updateProfile(k)},connectionState:p,onChangeConnectionState:g,...d};return c.context.invitation?l.createElement(qz,{..._,invitation:c.context.invitation}):l.createElement(O_,{..._})},Kz=l.forwardRef(({mode:e,titleId:n,onExit:t,exitActionParent:i},r)=>{const{t:a}=vn("os"),o=l.createElement(jn,{variant:"ghost",...t&&{onClick:t},classNames:le(In,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},l.createElement(qe.X,{weight:"bold",className:He(4)}),l.createElement("span",{className:"sr-only"},a("exit label")));return l.createElement(Gu,{ref:r,titleId:n,title:a(e==="halo-only"?"selecting identity heading":"joining space heading"),...e==="halo-only"?{titleSrOnly:!0}:{corner:i?l.cloneElement(i,{},o):o},titleSrOnly:e==="halo-only"})}),P_=(e,n)=>(Ge("[subscribing to invitation]",n),{subscribe:(t,i,r)=>n.subscribe(a=>{switch(a.state){case Se.State.CONNECTING:return Ge("[invitation connecting]",{Kind:e,invitation:a}),t({type:`connecting${e}Invitation`,invitation:a});case Se.State.CONNECTED:return Ge("[invitation connected]",{Kind:e,invitation:a}),t({type:`connected${e}Invitation`,invitation:a});case Se.State.READY_FOR_AUTHENTICATION:return Ge("[invitation ready for authentication]",{Kind:e,invitation:a}),t({type:`readyForAuthentication${e}Invitation`,invitation:a});case Se.State.AUTHENTICATING:return Ge("[invitation authenticating]",{Kind:e,invitation:a}),t({type:`authenticating${e}Invitation`,invitation:a});case Se.State.SUCCESS:return Ge("[invitation success]",{Kind:e,invitation:a}),t({type:`success${e}Invitation`,invitation:a}),r==null?void 0:r();case Se.State.CANCELLED:return Ge.warn("[invitation cancelled]",{Kind:e}),t({type:`fail${e}Invitation`,reason:"cancelled"});case Se.State.TIMEOUT:return Ge.error("[invitation timeout]",{Kind:e}),t({type:`fail${e}Invitation`,reason:"timeout"})}},a=>a instanceof Re.AlreadyJoinedError?(Ge("[already joined]",{Kind:e,error:a}),t({type:`success${e}Invitation`,invitation:n.get()}),r==null?void 0:r()):(Ge.error("[invitation errored]",{Kind:e,error:a}),t({type:`fail${e}Invitation`,reason:"error"}),i==null?void 0:i(a)))}),I_=(e,n)=>({initial:`unknown${e}`,states:{[`unknown${e}`]:{always:[{cond:({mode:i})=>i==="halo-only"&&e==="Space",target:"#join.finishingJoiningHalo"},{cond:i=>!!i[e.toLowerCase()].unredeemedCode,target:`acceptingRedeemed${e}Invitation`,actions:[`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]},{target:`inputting${e}InvitationCode`,actions:"log"}]},[`inputting${e}InvitationCode`]:{},[`acceptingRedeemed${e}Invitation`]:{invoke:{src:i=>i[e.toLowerCase()].invitationSubscribable},initial:`unknown${e}Invitation`,states:{[`unknown${e}Invitation`]:{always:[{cond:i=>{var r,a;if(e!=="Space")return!1;{const o=(a=(r=i.space.invitation)==null?void 0:r.spaceKey)==null?void 0:a.toHex(),s=i.space.succeededKeys;return o?!!(s!=null&&s.has(o)):!1}},target:n,actions:"log"},{cond:i=>{const r=i[e.toLowerCase()].invitation;return!r||(r==null?void 0:r.state)===Se.State.CONNECTING},target:`connecting${e}Invitation`,actions:"log"},{target:`inputting${e}VerificationCode`,actions:"log"}]},[`connecting${e}Invitation`]:{},[`inputting${e}VerificationCode`]:{},[`authenticating${e}VerificationCode`]:{on:{[`readyForAuthentication${e}Invitation`]:{target:`authenticationFailing${e}VerificationCode`,actions:["setInvitation","log"]}}},[`authenticationFailing${e}VerificationCode`]:{},[`failing${e}Invitation`]:{},[`success${e}Invitation`]:{}},on:{[`reset${e}Invitation`]:{target:`#join${e==="Halo"?".choosingIdentity":""}.accepting${e}Invitation.unknown${e}`,actions:["resetInvitation","log"]},[`connecting${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`connected${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`readyForAuthentication${e}Invitation`]:{target:`.inputting${e}VerificationCode`,actions:["setInvitation","log"]},[`authenticating${e}Invitation`]:{target:`.authenticating${e}VerificationCode`,actions:["setInvitation","log"]},[`success${e}Invitation`]:{target:n,actions:["setInvitation","log"]},[`fail${e}Invitation`]:{target:`.failing${e}Invitation`,actions:[ft({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],failReason:r.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[ft({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],unredeemedCode:r.code,succeededKeys:r.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),Yz=wh({id:"join",predictableActionArguments:!0,context:{initialDisposition:"default",mode:"default",identity:null,halo:{},space:{}},initial:"unknown",states:{unknown:{always:[{cond:"existingIdentity",target:"resettingIdentity",actions:"log"},{cond:"initiallyAcceptingHaloInvitation",target:"#join.choosingIdentity.acceptingHaloInvitation",actions:"log"},{cond:"noSelectedIdentity",target:"choosingIdentity",actions:"log"},{target:"acceptingSpaceInvitation",actions:"log"}]},choosingIdentity:{initial:"unknownAuthMethod",states:{unknownAuthMethod:{always:[{cond:"hasHaloUnredeemedCode",target:"acceptingHaloInvitation",actions:"log"},{target:"choosingAuthMethod",actions:"log"}]},choosingAuthMethod:{},recoveringIdentity:{},creatingIdentity:{},acceptingHaloInvitation:I_("Halo","#join.acceptingSpaceInvitation"),confirmingAddedIdentity:{}},on:{recoverIdentity:{target:".recoveringIdentity",actions:"log"},createIdentity:{target:".creatingIdentity",actions:"log"},acceptHaloInvitation:{target:".acceptingHaloInvitation",actions:"log"},addIdentity:{target:".confirmingAddedIdentity",actions:"log"},selectIdentity:{target:"acceptingSpaceInvitation",actions:["setIdentity","log"]},deselectAuthMethod:{target:".choosingAuthMethod",actions:"log"}}},resettingIdentity:{},acceptingSpaceInvitation:I_("Space","#join.finishingJoiningSpace"),finishingJoiningSpace:{type:"final"},finishingJoiningHalo:{type:"final"}},on:{resetIdentity:{target:"choosingIdentity",actions:"unsetIdentity"}}},{guards:{existingIdentity:({identity:e,mode:n},t)=>n==="halo-only"&&!!e,noSelectedIdentity:({identity:e},n)=>!e,initiallyAcceptingHaloInvitation:({identity:e,initialDisposition:n},t)=>!e&&n==="accept-halo-invitation",hasHaloUnredeemedCode:({halo:e},n)=>!!e.unredeemedCode,noSpaceInvitation:({space:e},n)=>!e.invitation&&!e.unredeemedCode},actions:{setIdentity:ft({identity:(e,n)=>n.identity}),unsetIdentity:ft({identity:()=>null}),resetInvitation:ft({halo:(e,n)=>n.type!=="resetHaloInvitation"?e.halo:(e.halo.invitationObservable&&e.halo.invitationObservable.cancel(),{...e.halo,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0}),space:(e,n)=>n.type!=="resetSpaceInvitation"?e.space:(e.space.invitationObservable&&e.space.invitationObservable.cancel(),{...e.space,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0})}),setInvitation:ft({halo:(e,n)=>n.type.includes("Halo")?{...e.halo,invitation:n.invitation}:e.halo,space:(e,n)=>n.type.includes("Space")?{...e.space,invitation:n.invitation}:e.space}),log:(e,n)=>{Ge("[transition]",{event:n,haloInvitation:e.halo.invitation,spaceInvitation:e.space.invitation})}}}),F_=(e,n)=>{try{const t=new URLSearchParams(n.substring(n.lastIndexOf("?")));return t.get(`${e}InvitationCode`)??t.get(`${e}Invitation`)??t.get("invitationCode")??t.get("invitation")??n}catch(t){return Ge.catch(t),n}},Jz=(e,n)=>{const t=l.useCallback(({halo:o})=>{if(o.unredeemedCode)try{const s=xi.InvitationEncoder.decode(F_("halo",o.unredeemedCode)),f=e.halo.join(s);return{...o,invitationObservable:f,invitationSubscribable:P_("Halo",f)}}catch(s){return Ge.error("Could not redeem device invitation code",s),o}else return o},[e]),i=l.useCallback(({space:o})=>{if(o.unredeemedCode)try{const s=xi.InvitationEncoder.decode(F_("space",o.unredeemedCode)),f=e.spaces.join(s);return{...o,invitationObservable:f,invitationSubscribable:P_("Space",f)}}catch(s){return Ge.error("Could not redeem space invitation code",s),o}else return o},[e]),r=l.useCallback(({halo:o})=>{var s;return o.unredeemedCode?((s=n==null?void 0:n.onInvalidateInvitationCode)==null||s.call(n,o.unredeemedCode),{...o,unredeemedCode:void 0}):o},[n==null?void 0:n.onInvalidateInvitationCode]),a=l.useCallback(({space:o})=>{var s;return o.unredeemedCode?((s=n==null?void 0:n.onInvalidateInvitationCode)==null||s.call(n,o.unredeemedCode),{...o,unredeemedCode:void 0}):o},[n==null?void 0:n.onInvalidateInvitationCode]);return _h(Yz,{...n,actions:{...n==null?void 0:n.actions,redeemHaloInvitationCode:ft({halo:t}),redeemSpaceInvitationCode:ft({space:i}),invalidateHaloInvitationCode:ft({halo:r}),invalidateSpaceInvitationCode:ft({space:a})}})},Xz=e=>{const n=!e.active,{send:t}=e,{t:i}=vn("os"),r={disabled:n,after:l.createElement(qe.CaretRight,{className:He(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return l.createElement(l.Fragment,null,l.createElement(gi,null,i("addition method chooser title")),l.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},l.createElement(uu,{...r,description:i("create identity description"),before:l.createElement(qe.Plus,{className:He(6)}),onClick:()=>t({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},i("create identity label")),l.createElement(uu,{...r,description:i("join identity description"),before:l.createElement(qe.QrCode,{className:He(6)}),onClick:()=>t({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},i("join identity label")),l.createElement(uu,{...r,disabled:!0,description:i("recover identity description"),before:l.createElement(qe.Textbox,{className:He(6)}),onClick:()=>t({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},i("recover identity label"))))},Zz=e=>{var g,b,w,_,k,E;const{mode:n,addedIdentity:t,active:i,send:r,onDone:a,doneActionParent:o}=e,s=!i,{t:f}=vn("os"),d=(t==null?void 0:t.identityKey.toHex())??"0",c=bg(d),u=$n("identityListItem__label"),h=((g=t==null?void 0:t.profile)==null?void 0:g.displayName)??(t&&Nf(d)),p=l.createElement(Vn,{...a&&{onClick:()=>a(null)},disabled:s,"data-autofocus":"confirmingAddedIdentity","data-testid":"identity-added-done"},l.createElement("span",null,f("done label")));return l.createElement(l.Fragment,null,l.createElement(gi,null,f("identity added label")),l.createElement("div",{role:"none",className:"grow flex flex-col items-center justify-center text-center gap-2"},l.createElement(wn.Root,{status:"active",labelId:u,hue:((w=(b=t==null?void 0:t.profile)==null?void 0:b.data)==null?void 0:w.hue)||c.hue},l.createElement(wn.Frame,null,l.createElement(wn.Fallback,{text:((k=(_=t==null?void 0:t.profile)==null?void 0:_.data)==null?void 0:k.emoji)||c.emoji})),l.createElement(wn.Label,{classNames:le("text-lg truncate",!((E=t==null?void 0:t.profile)!=null&&E.displayName)&&"font-mono")},h))),l.createElement(jt,null,n==="halo-only"?o?l.cloneElement(o,{},p):p:l.createElement(Vn,{variant:"primary",disabled:s||!t,onClick:()=>t&&r({type:"selectIdentity",identity:t}),"data-autofocus":"confirmingAddedIdentity"},f("continue label"))))},Qz=e=>{const{send:n,method:t}=e,i=t==="recover identity",r=Re.useClient(),{t:a}=vn("os"),[o,s]=l.useState(""),f=d=>{r.halo.createIdentity({[i?"seedphrase":"displayName"]:d}).then(c=>{n==null||n({type:"selectIdentity",identity:c})},c=>{Ge.catch(c),s(a(i?"failed to recover identity message":"failed to create identity message"))})};return l.createElement(eU,{...e,onDisplayNameConfirm:f,validationMessage:o})},eU=e=>{const{method:n,send:t,active:i,onDisplayNameConfirm:r,validationMessage:a}=e,o=!i,{t:s}=vn("os"),[f,d]=l.useState(""),c=n==="recover identity";return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(Ku,{validationMessage:a,label:l.createElement(gi,null,s(c?"recover identity input label":"new identity input label")),disabled:o,"data-testid":"identity-input",placeholder:c?"Type your recovery phrase":"Type a display name",onChange:({target:{value:u}})=>d(u)})),l.createElement(jt,null,l.createElement(Vn,{variant:"ghost",disabled:o,onClick:()=>t==null?void 0:t({type:"deselectAuthMethod"}),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-back`},s("back label")),l.createElement(Vn,{variant:"primary",disabled:o,onClick:()=>r==null?void 0:r(f),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},M_=e=>{const{active:n,Kind:t,doneActionParent:i,onDone:r}=e,a=!n,{t:o}=vn("os"),s=l.createElement(Vn,{variant:"primary",onClick:r,disabled:a,"data-autofocus":`success${t}Invitation finishingJoining${t}`,"data-testid":`${t.toLowerCase()}-invitation-accepted-done`},o("done label"));return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement("p",{className:"text-center text-sm font-normal"},o("welcome message"))),l.createElement(jt,null,i?l.cloneElement(i,{},s):s))},nU=e=>{try{const n=new URLSearchParams(e.substring(e.lastIndexOf("?")));return n.get("spaceInvitationCode")??n.get("deviceInvitationCode")??e}catch(n){return Ge.catch(n),e}},N_=e=>{const{Kind:n,active:t,send:i,unredeemedCode:r,onExit:a,exitActionParent:o,onDone:s,doneActionParent:f,succeededKeys:d}=e,c=!t,{t:u}=vn("os"),[h,p]=l.useState(r??"");l.useEffect(()=>{r&&p(r??"")},[r]);const g=()=>{h.trim().length!==0&&i({type:`set${n}InvitationCode`,code:nU(h),...n==="Space"&&{succeededKeys:d}})},b=l.createElement(Vn,{variant:"ghost",disabled:c,...a?{onClick:()=>a()}:{onClick:()=>s==null?void 0:s(null)},"data-testid":"join-exit"},u("cancel label"));return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(Ku,{label:l.createElement(gi,null,u("invitation input label")),placeholder:"Type an invitation code",disabled:c,value:h,onChange:({target:{value:w}})=>p(w),"data-autofocus":`inputting${n}InvitationCode`,"data-testid":`${n.toLowerCase()}-invitation-input`,onKeyUp:({key:w})=>w==="Enter"&&g()})),l.createElement(jt,null,n==="Halo"?l.createElement(Vn,{variant:"ghost",disabled:c,onClick:()=>i({type:"deselectAuthMethod"}),"data-testid":`${n.toLowerCase()}-invitation-input-back`},u("back label")):o?l.cloneElement(o,{},b):f?l.cloneElement(f,{},b):b,l.createElement(Vn,{variant:"primary",disabled:c,onClick:g,"data-testid":`${n.toLowerCase()}-invitation-input-continue`},u("continue label"))))},tU=({invitationState:e,onInvitationCancel:n,active:t,send:i,Kind:r,failReason:a})=>{const{t:o}=vn("os");return a?l.createElement(l.Fragment,null,l.createElement(gi,{className:In},o(a==="timeout"?"timeout status label":a==="cancelled"?"cancelled status label":"error status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(jt,null,l.createElement(Vn,{disabled:!t,onClick:()=>i({type:`reset${r}Invitation`}),"data-testid":"invitation-rescuer-reset"},o("reset label")))):l.createElement(l.Fragment,null,l.createElement(gi,{className:In},o("connecting status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(jt,null,l.createElement(Vn,{disabled:!0,classNames:"order-2","data-testid":"next"},o("next label")),l.createElement(Vn,{disabled:!t,onClick:n,"data-testid":"invitation-rescuer-cancel"},o("cancel label"))))},D_=e=>{const{Kind:n,invitationState:t,active:i,send:r}=e,{t:a}=vn("os");return l.createElement(l.Fragment,null,typeof t>"u"?l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(gi,{className:In},"There was a problem joining the space")),l.createElement(jt,null,l.createElement(Vn,{disabled:!i,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>r({type:`reset${n}Invitation`})},a("reset label")))):l.createElement(tU,{...e}))},L_=6,B_=({failed:e,Kind:n,active:t,pending:i,invitationId:r,onInvitationAuthenticate:a,onInvitationCancel:o})=>{const s=!t||i,{t:f}=vn("os"),d=n.toLowerCase(),[c,u]=l.useState(""),h=({target:{value:p}})=>{var g;u(p),p.length===L_&&((g=document.querySelector(`[data-autofocus-pinlength="${d}"]`))==null||g.focus())};return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},r&&l.createElement(qu,{text:io(r)}),l.createElement(bt.Root,{...e&&{validationValence:"error"}},l.createElement(bt.Label,{asChild:!0},l.createElement(gi,null,f("auth code input label"))),l.createElement(bt.PinInput,{disabled:s,length:L_,onChange:h,inputMode:"numeric",autoComplete:"off",pattern:"\\d*","data-autofocus":`connecting${n}Invitation inputting${n}VerificationCode authenticationFailing${n}VerificationCode authenticating${n}VerificationCode`,"data-prevent-ios-autofocus":!0,"data-testid":`${d}-auth-code-input`,"data-1p-ignore":!0}),e&&l.createElement(bt.DescriptionAndValidation,{classNames:"text-center"},l.createElement(bt.Validation,null,f("failed to authenticate message"))))),l.createElement(jt,null,l.createElement(Vn,{variant:"ghost",disabled:s,onClick:()=>o==null?void 0:o(),"data-testid":`${d}-invitation-authenticator-cancel`},f("cancel label")),l.createElement(Vn,{variant:"primary",disabled:s,onClick:()=>a==null?void 0:a(c),"data-autofocus-pinlength":d,"data-testid":`${d}-invitation-authenticator-next`},f("next label"))))},lt="pbs-1 pbe-3 pli-3",iU=e=>{const{titleId:n,send:t,activeView:i,failed:r,mode:a,unredeemedCodes:o,invitationStates:s,succeededKeys:f,failReasons:d,onExit:c,onHaloDone:u,onSpaceDone:h,exitActionParent:p,doneActionParent:g,onHaloInvitationCancel:b,onSpaceInvitationCancel:w,onHaloInvitationAuthenticate:_,onSpaceInvitationAuthenticate:k,onCancelResetStorage:E,onConfirmResetStorage:S,IdentityInput:T=Qz,ConfirmReset:O=Eh}=e;return l.createElement(po,{density:"fine"},a!=="halo-only"&&l.createElement(Kz,{titleId:n,mode:a,onExit:c,exitActionParent:p}),l.createElement(bn.Root,{focusManaged:!0,activeView:i},l.createElement(bn.Views,null,l.createElement(bn.View,{classNames:lt,id:"addition method chooser"},l.createElement(Xz,{send:t,active:i==="addition method chooser"})),l.createElement(bn.View,{classNames:lt,id:"reset storage confirmation"},l.createElement(O,{send:t,active:i==="reset identity confirmation",onCancel:E,onConfirm:S})),l.createElement(bn.View,{classNames:lt,id:"create identity input"},l.createElement(T,{send:t,method:"create identity",active:i==="create identity input"})),l.createElement(bn.View,{classNames:lt,id:"recover identity input"},l.createElement(T,{send:t,method:"recover identity",active:i==="recover identity input"})),l.createElement(bn.View,{classNames:lt,id:"halo invitation input"},l.createElement(N_,{send:t,Kind:"Halo",active:i==="halo invitation input",...(o==null?void 0:o.Halo)&&{unredeemedCode:o.Halo},...(f==null?void 0:f.Halo)&&{succeededKeys:f.Halo}})),l.createElement(bn.View,{classNames:lt,id:"halo invitation rescuer"},l.createElement(D_,{send:t,Kind:"Halo",active:i==="halo invitation rescuer",invitationState:s==null?void 0:s.Halo,onInvitationCancel:b,failReason:d==null?void 0:d.Halo})),l.createElement(bn.View,{classNames:lt,id:"halo invitation authenticator"},l.createElement(B_,{send:t,Kind:"Halo",active:i==="halo invitation authenticator",onInvitationCancel:b,onInvitationAuthenticate:_,...r.has("Halo")&&{failed:!0}})),l.createElement(bn.View,{classNames:lt,id:"halo invitation accepted"},l.createElement(M_,{send:t,Kind:"Halo",active:i==="halo invitation accepted",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:lt,id:"identity added"},l.createElement(Zz,{send:t,mode:a,active:i==="identity added",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:lt,id:"space invitation input"},l.createElement(N_,{send:t,Kind:"Space",active:i==="space invitation input",...(o==null?void 0:o.Space)&&{unredeemedCode:o.Space},...(f==null?void 0:f.Space)&&{succeededKeys:f.Space},onExit:c,exitActionParent:p})),l.createElement(bn.View,{classNames:lt,id:"space invitation rescuer"},l.createElement(D_,{send:t,Kind:"Space",active:i==="space invitation rescuer",invitationState:s==null?void 0:s.Space,onInvitationCancel:w,failReason:d==null?void 0:d.Space})),l.createElement(bn.View,{classNames:lt,id:"space invitation authenticator"},l.createElement(B_,{send:t,Kind:"Space",active:i==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:k,...r.has("Space")&&{failed:!0}})),l.createElement(bn.View,{classNames:lt,id:"space invitation accepted"},l.createElement(M_,{send:t,Kind:"Space",active:i==="space invitation accepted",doneActionParent:g,onDone:h})))))},rU=({titleId:e,mode:n="default",initialDisposition:t="default",initialInvitationCode:i,exitActionParent:r,onExit:a,doneActionParent:o,onDone:s,onCancelResetStorage:f})=>{const d=Re.useClient(),c=vt.useIdentity(),{hasIosKeyboard:u}=Ae(),h=$n("joinPanel__heading",e),[p,g,b]=Jz(d,{context:{mode:n,initialDisposition:t,identity:c,...i&&{[n==="halo-only"?"halo":"space"]:{unredeemedCode:i}}}});l.useEffect(()=>b.subscribe(L=>{Ge("[state]",L)}).unsubscribe,[b]),l.useEffect(()=>{const B=p.configuration[0].id.split("."),L=B[B.length-1],N=L==="finishingJoining"?"successSpaceInvitation":L,X=document.querySelector(`[data-autofocus~="${N}"]`);X&&!(u&&X.hasAttribute("data-prevent-ios-autofocus"))&&X.focus()},[p.value,u]);const w=l.useMemo(()=>{switch(!0){case p.matches({choosingIdentity:"choosingAuthMethod"}):return"addition method chooser";case p.matches("resettingIdentity"):return"reset identity confirmation";case p.matches({choosingIdentity:"creatingIdentity"}):return"create identity input";case p.matches({choosingIdentity:"recoveringIdentity"}):return"recover identity input";case p.matches({choosingIdentity:{acceptingHaloInvitation:"inputtingHaloInvitationCode"}}):return"halo invitation input";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"connectingHaloInvitation"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"failingHaloInvitation"}}}].some(p.matches):return"halo invitation rescuer";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"inputtingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticatingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}].some(p.matches):return"halo invitation authenticator";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"successHaloInvitation"}}},"finishingJoiningHalo"].some(p.matches):return"halo invitation accepted";case p.matches({choosingIdentity:"confirmingAddedIdentity"}):return"identity added";case p.matches({acceptingSpaceInvitation:"inputtingSpaceInvitationCode"}):return"space invitation input";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"connectingSpaceInvitation"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"failingSpaceInvitation"}}].some(p.matches):return"space invitation rescuer";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"inputtingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticatingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}].some(p.matches):return"space invitation authenticator";case p.matches("finishingJoiningSpace"):return"space invitation accepted";default:return"never"}},[p]),_=l.useMemo(()=>{const B=new Set;switch(!0){case p.matches({choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}):B.add("Halo");break;case p.matches({acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}):B.add("Space");break}return B},[p]),k=l.useMemo(()=>({Halo:p.context.halo.unredeemedCode,Space:p.context.space.unredeemedCode}),[p]),E=Re.useMulticastObservable(d.spaces),S=l.useMemo(()=>({Space:E?new Set(E.map(({key:B})=>B.toHex())):void 0}),[E]),T=l.useMemo(()=>{var B,L;return{Halo:(B=p.context.halo.invitationObservable)==null?void 0:B.get().state,Space:(L=p.context.space.invitationObservable)==null?void 0:L.get().state}},[p]),O=l.useMemo(()=>({Halo:p.context.halo.failReason,Space:p.context.space.failReason}),[p]),C=l.useCallback(()=>{var B,L,N,X;s==null||s({identityKey:((B=p.context.halo.invitation)==null?void 0:B.identityKey)??null,swarmKey:((L=p.context.halo.invitation)==null?void 0:L.swarmKey)??null,spaceKey:((N=p.context.halo.invitation)==null?void 0:N.spaceKey)??null,target:((X=p.context.halo.invitation)==null?void 0:X.target)??null})},[p,s]),P=l.useCallback(()=>{var B,L,N,X;s==null||s({identityKey:((B=p.context.space.invitation)==null?void 0:B.identityKey)??null,swarmKey:((L=p.context.space.invitation)==null?void 0:L.swarmKey)??null,spaceKey:((N=p.context.space.invitation)==null?void 0:N.spaceKey)??null,target:((X=p.context.space.invitation)==null?void 0:X.target)??null})},[p,s]),F=l.useCallback(()=>d.reset().then(()=>{g({type:"resetIdentity"})}),[d,g]);return l.createElement(iU,{titleId:h,mode:n,send:g,activeView:w,failed:_,failReasons:O,pending:["connecting","authenticating"].some(B=>p==null?void 0:p.configuration[0].id.includes(B)),unredeemedCodes:k,invitationStates:T,succeededKeys:S,identity:c,onExit:a,exitActionParent:r,doneActionParent:o,onHaloDone:C,onSpaceDone:P,onHaloInvitationCancel:()=>{var B;return(B=p.context.halo.invitationObservable)==null?void 0:B.cancel()},onSpaceInvitationCancel:()=>{var B;return(B=p.context.space.invitationObservable)==null?void 0:B.cancel()},onHaloInvitationAuthenticate:B=>{var L;return g({type:"authenticateHaloVerificationCode"}),(L=p.context.halo.invitationObservable)==null?void 0:L.authenticate(B)},onSpaceInvitationAuthenticate:B=>{var L;return g({type:"authenticateSpaceVerificationCode"}),(L=p.context.space.invitationObservable)==null?void 0:L.authenticate(B)},onConfirmResetStorage:F,onCancelResetStorage:f})},aU=wh({id:"space",predictableActionArguments:!0,context:{space:null},initial:"managingSpace",states:{managingSpace:{},managingSpaceInvitation:{}},on:{deselectInvitation:{target:".managingSpace",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingSpaceInvitation",actions:["setInvitation","log"]}}},{actions:{setInvitation:ft({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:ft({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),oU=e=>_h(aU,{...e,context:{...e==null?void 0:e.context}}),j_="dxos:react-shell/space-manager/active-action",sU=e=>{const{space:n,target:t}=e,{t:i}=vn("os"),r=Re.useConfig(),a=Jo.useSpaceInvitations(n==null?void 0:n.key),o=l.useCallback(f=>{const d=xi.InvitationEncoder.encode(f);f.state===Se.State.CONNECTING&&Ge.info(JSON.stringify({invitationCode:d,authCode:f.authCode}))},[]),s={inviteOne:{label:i("invite one label"),description:i("invite one description"),icon:qe.UserPlus,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.INTERACTIVE,authMethod:Se.AuthMethod.SHARED_SECRET,multiUse:!1,target:t});f&&((h=(u=(c=r.values.runtime)==null?void 0:c.app)==null?void 0:u.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&f.subscribe(o)},[n])},inviteMany:{label:i("invite many label"),description:i("invite many description"),icon:qe.UsersThree,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.INTERACTIVE,authMethod:Se.AuthMethod.NONE,multiUse:!0,target:t});f&&((h=(u=(c=r.values.runtime)==null?void 0:c.app)==null?void 0:u.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&f.subscribe(o)},[n])}};return l.createElement(fU,{...e,invitations:a,inviteActions:s})},R_="pis-3 pie-1 plb-1 mbe-1 font-medium",fU=e=>{const{active:n,space:t,createInvitationUrl:i,send:r,inviteActions:a,invitations:o,showInactiveInvitations:s,SpaceMemberList:f=GL,InvitationList:d=wj}=e,{t:c}=vn("os"),u=a??{noopInvite:{label:c("create space invitation label"),description:"",icon:qe.Placeholder,onClick:()=>{}}},[h,p]=l.useState(localStorage.getItem(j_)??"inviteOne"),g=w=>{p(w),localStorage.setItem(j_,w)},b=s?o:o==null?void 0:o.filter(w=>![Se.State.CANCELLED].includes(w.get().state));return l.createElement(l.Fragment,null,l.createElement(sf.Root,{classNames:"grow shrink basis-28 -mli-2"},l.createElement(sf.Viewport,{classNames:"is-full pie-2"},!!(b!=null&&b.length)&&l.createElement(l.Fragment,null,l.createElement("h3",{className:le(R_,In)},c("invitation list heading")),l.createElement(d,{className:"mb-2",send:r,invitations:b??[],onClickRemove:w=>w.cancel(),createInvitationUrl:i}),l.createElement("h3",{className:le(R_,In,"mbs-2")},c("space member list heading"))),l.createElement(f,{spaceKey:t.key,includeSelf:!0})),l.createElement(sf.Scrollbar,{orientation:"vertical"},l.createElement(sf.Thumb,null))),l.createElement(jt,null,l.createElement(kj,{disabled:!n,actions:u,activeAction:h,onChangeActiveAction:g,"data-testid":"spaces-panel.create-invitation"})))},lU=({titleId:e,space:n,onDone:t})=>{const{t:i}=vn("os"),r=n.properties.name;return l.createElement(Gu,{titleId:e,title:i("space panel heading"),corner:l.createElement(C2,{"data-testid":"identity-panel-done",onDone:t})},l.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},l.createElement(qe.Planet,{size:32,weight:"light"}),l.createElement("div",{className:"block text-start font-light text-xl"},r??n.key.truncate())))},z_=e=>{const{titleId:n,activeView:t,space:i,target:r,SpaceManager:a=sU,InvitationManager:o=A_,...s}=e;return l.createElement(po,{density:"fine"},l.createElement(lU,{...s,titleId:n,space:i}),l.createElement(bn.Root,{activeView:t},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"space manager",classNames:lt},l.createElement(a,{active:t==="space manager",space:i,target:r,...s})),l.createElement(bn.View,{id:"space invitation manager",classNames:lt},l.createElement(o,{active:t==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},dU=({invitation:e,...n})=>{const t=Vu(e);return l.createElement(z_,{...n,...t,invitationUrl:n.createInvitationUrl(t.invitationCode)})},cU=({titleId:e,createInvitationUrl:n=i=>i,...t})=>{const i=$n("spacePanel__heading",e),[r,a,o]=oU({context:{space:t.space}});l.useEffect(()=>o.subscribe(c=>{Ge("[state]",c)}).unsubscribe,[o]);const s=l.useMemo(()=>{switch(!0){case r.matches("managingSpace"):return"space manager";case r.matches("managingSpaceInvitation"):return"space invitation manager";default:return"never"}},[r]),f={...t,activeView:s,send:a,titleId:i,createInvitationUrl:n};return r.context.invitation?l.createElement(dU,{...f,invitation:r.context.invitation}):l.createElement(z_,{...f})},uU=({titleId:e})=>{const{t:n}=vn("os");return l.createElement("div",{className:"grid place-items-center p-2 gap-2"},l.createElement("p",{id:e,className:"font-medium text-center"},n("resetting message")),l.createElement(OO,{indeterminate:!0},n("resetting message")))},hU=e=>{const n=$n("identityDialog__title",e.title);return l.createElement(st.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(st.Portal,null,l.createElement(st.Overlay,null,l.createElement(st.Content,{"aria-labelledby":n,onOpenAutoFocus:t=>t.preventDefault()},l.createElement(cu,null,l.createElement(Gz,{...e,titleId:n,doneActionParent:l.createElement(st.Close,{asChild:!0})}))))))},U_=e=>{const n=$n("joinDialog__title"),{height:t}=pA();return l.createElement(Zt.Root,{defaultOpen:!0,onOpenChange:i=>{var r;return i||(e.onExit?e.onExit():(r=e.onDone)==null?void 0:r.call(e,null))}},l.createElement(Zt.Portal,null,l.createElement(Zt.Overlay,{classNames:"backdrop-blur",...t&&{style:{blockSize:`${t}px`}}},l.createElement(Zt.Content,{"aria-labelledby":n},l.createElement(rU,{...e,titleId:n,exitActionParent:l.createElement(Zt.Cancel,{asChild:!0}),doneActionParent:l.createElement(Zt.Action,{asChild:!0})})))))};var ml,gl=ki;if(process.env.NODE_ENV==="production")ml=gl.createRoot,gl.hydrateRoot;else{var W_=gl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ml=function(e,n){W_.usingClientEntryPoint=!0;try{return gl.createRoot(e,n)}finally{W_.usingClientEntryPoint=!1}}}var Sh={exports:{}};(function(e,n){(function(t,i){var r="1.0.35",a="",o="?",s="function",f="undefined",d="object",c="string",u="major",h="model",p="name",g="type",b="vendor",w="version",_="architecture",k="console",E="mobile",S="tablet",T="smarttv",O="wearable",C="embedded",P=350,F="Amazon",B="Apple",L="ASUS",N="BlackBerry",X="Browser",Y="Chrome",ee="Edge",re="Firefox",fe="Google",ce="Huawei",oe="LG",ye="Microsoft",se="Motorola",G="Opera",J="Samsung",ie="Sharp",me="Sony",H="Xiaomi",K="Zebra",j="Facebook",W="Chromium OS",V="Mac OS",I=function(Ee,We){var y={};for(var v in Ee)We[v]&&We[v].length%2===0?y[v]=We[v].concat(Ee[v]):y[v]=Ee[v];return y},M=function(Ee){for(var We={},y=0;y<Ee.length;y++)We[Ee[y].toUpperCase()]=Ee[y];return We},Z=function(Ee,We){return typeof Ee===c?te(We).indexOf(te(Ee))!==-1:!1},te=function(Ee){return Ee.toLowerCase()},he=function(Ee){return typeof Ee===c?Ee.replace(/[^\d\.]/g,a).split(".")[0]:i},ge=function(Ee,We){if(typeof Ee===c)return Ee=Ee.replace(/^\s\s*/,a),typeof We===f?Ee:Ee.substring(0,P)},ke=function(Ee,We){for(var y=0,v,m,x,A,D,U;y<We.length&&!D;){var be=We[y],Me=We[y+1];for(v=m=0;v<be.length&&!D&&be[v];)if(D=be[v++].exec(Ee),D)for(x=0;x<Me.length;x++)U=D[++m],A=Me[x],typeof A===d&&A.length>0?A.length===2?typeof A[1]==s?this[A[0]]=A[1].call(this,U):this[A[0]]=A[1]:A.length===3?typeof A[1]===s&&!(A[1].exec&&A[1].test)?this[A[0]]=U?A[1].call(this,U,A[2]):i:this[A[0]]=U?U.replace(A[1],A[2]):i:A.length===4&&(this[A[0]]=U?A[3].call(this,U.replace(A[1],A[2])):i):this[A]=U||i;y+=2}},xe=function(Ee,We){for(var y in We)if(typeof We[y]===d&&We[y].length>0){for(var v=0;v<We[y].length;v++)if(Z(We[y][v],Ee))return y===o?i:y}else if(Z(We[y],Ee))return y===o?i:y;return Ee},ae={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ue={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},an={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[w,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[w,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,w],[/opios[\/ ]+([\w\.]+)/i],[w,[p,G+" Mini"]],[/\bopr\/([\w\.]+)/i],[w,[p,G]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,w],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[w,[p,"UC"+X]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[w,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[w,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[w,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[w,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[w,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+X],w],[/\bfocus\/([\w\.]+)/i],[w,[p,re+" Focus"]],[/\bopt\/([\w\.]+)/i],[w,[p,G+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[w,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[w,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[w,[p,G+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[w,[p,"MIUI "+X]],[/fxios\/([-\w\.]+)/i],[w,[p,re]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+X]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+X],w],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],w],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,w],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,j],w],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,w],[/\bgsa\/([\w\.]+) .*safari\//i],[w,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[w,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[w,[p,Y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,Y+" WebView"],w],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[w,[p,"Android "+X]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,w],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[w,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[w,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[w,xe,ae]],[/(webkit|khtml)\/([\w\.]+)/i],[p,w],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],w],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[w,[p,re+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[p,w],[/(cobalt)\/([\w\.]+)/i],[p,[w,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[_,"amd64"]],[/(ia32(?=;))/i],[[_,te]],[/((?:i[346]|x)86)[;\)]/i],[[_,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[_,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[_,"armhf"]],[/windows (ce|mobile); ppc;/i],[[_,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[_,/ower/,a,te]],[/(sun4\w)[;\)]/i],[[_,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[_,te]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[b,J],[g,S]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[b,J],[g,E]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[b,B],[g,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[b,B],[g,S]],[/(macintosh);/i],[h,[b,B]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[b,ie],[g,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[b,ce],[g,S]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[b,ce],[g,E]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[b,H],[g,E]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[b,H],[g,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[b,"OPPO"],[g,E]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[b,"Vivo"],[g,E]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[b,"Realme"],[g,E]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[b,se],[g,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[b,se],[g,S]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[b,oe],[g,S]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[b,oe],[g,E]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[b,"Lenovo"],[g,S]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[b,"Nokia"],[g,E]],[/(pixel c)\b/i],[h,[b,fe],[g,S]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[b,fe],[g,E]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[b,me],[g,E]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[b,me],[g,S]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[b,"OnePlus"],[g,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[b,F],[g,S]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[b,F],[g,E]],[/(playbook);[-\w\),; ]+(rim)/i],[h,b,[g,S]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[b,N],[g,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[b,L],[g,S]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[b,L],[g,E]],[/(nexus 9)/i],[h,[b,"HTC"],[g,S]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[b,[h,/_/g," "],[g,E]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[b,"Acer"],[g,S]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[b,"Meizu"],[g,E]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[b,h,[g,E]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[b,h,[g,S]],[/(surface duo)/i],[h,[b,ye],[g,S]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[b,"Fairphone"],[g,E]],[/(u304aa)/i],[h,[b,"AT&T"],[g,E]],[/\bsie-(\w*)/i],[h,[b,"Siemens"],[g,E]],[/\b(rct\w+) b/i],[h,[b,"RCA"],[g,S]],[/\b(venue[\d ]{2,7}) b/i],[h,[b,"Dell"],[g,S]],[/\b(q(?:mv|ta)\w+) b/i],[h,[b,"Verizon"],[g,S]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[b,"Barnes & Noble"],[g,S]],[/\b(tm\d{3}\w+) b/i],[h,[b,"NuVision"],[g,S]],[/\b(k88) b/i],[h,[b,"ZTE"],[g,S]],[/\b(nx\d{3}j) b/i],[h,[b,"ZTE"],[g,E]],[/\b(gen\d{3}) b.+49h/i],[h,[b,"Swiss"],[g,E]],[/\b(zur\d{3}) b/i],[h,[b,"Swiss"],[g,S]],[/\b((zeki)?tb.*\b) b/i],[h,[b,"Zeki"],[g,S]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[b,"Dragon Touch"],h,[g,S]],[/\b(ns-?\w{0,9}) b/i],[h,[b,"Insignia"],[g,S]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[b,"NextBook"],[g,S]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[b,"Voice"],h,[g,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[b,"LvTel"],h,[g,E]],[/\b(ph-1) /i],[h,[b,"Essential"],[g,E]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[b,"Envizen"],[g,S]],[/\b(trio[-\w\. ]+) b/i],[h,[b,"MachSpeed"],[g,S]],[/\btu_(1491) b/i],[h,[b,"Rotor"],[g,S]],[/(shield[\w ]+) b/i],[h,[b,"Nvidia"],[g,S]],[/(sprint) (\w+)/i],[b,h,[g,E]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[b,ye],[g,E]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[b,K],[g,S]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[b,K],[g,E]],[/smart-tv.+(samsung)/i],[b,[g,T]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[b,J],[g,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[b,oe],[g,T]],[/(apple) ?tv/i],[b,[h,B+" TV"],[g,T]],[/crkey/i],[[h,Y+"cast"],[b,fe],[g,T]],[/droid.+aft(\w)( bui|\))/i],[h,[b,F],[g,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[b,ie],[g,T]],[/(bravia[\w ]+)( bui|\))/i],[h,[b,me],[g,T]],[/(mitv-\w{5}) bui/i],[h,[b,H],[g,T]],[/Hbbtv.*(technisat) (.*);/i],[b,h,[g,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[b,ge],[h,ge],[g,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[b,h,[g,k]],[/droid.+; (shield) bui/i],[h,[b,"Nvidia"],[g,k]],[/(playstation [345portablevi]+)/i],[h,[b,me],[g,k]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[b,ye],[g,k]],[/((pebble))app/i],[b,h,[g,O]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[b,B],[g,O]],[/droid.+; (glass) \d/i],[h,[b,fe],[g,O]],[/droid.+; (wt63?0{2,3})\)/i],[h,[b,K],[g,O]],[/(quest( 2| pro)?)/i],[h,[b,j],[g,O]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[b,[g,C]],[/(aeobc)\b/i],[h,[b,F],[g,C]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[g,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[g,S]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,S]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,E]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[b,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[w,[p,ee+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[w,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,w],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[w,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,w],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[w,xe,Ue]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[w,xe,Ue]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[w,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,V],[w,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[w,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,w],[/\(bb(10);/i],[w,[p,N]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[w,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[w,[p,re+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[w,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[w,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[w,[p,Y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,W],w],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,w],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],w],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,w]]},Pe=function(Ee,We){if(typeof Ee===d&&(We=Ee,Ee=i),!(this instanceof Pe))return new Pe(Ee,We).getResult();var y=typeof t!==f&&t.navigator?t.navigator:i,v=Ee||(y&&y.userAgent?y.userAgent:a),m=y&&y.userAgentData?y.userAgentData:i,x=We?I(an,We):an,A=y&&y.userAgent==v;return this.getBrowser=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.browser),D[u]=he(D[w]),A&&y&&y.brave&&typeof y.brave.isBrave==s&&(D[p]="Brave"),D},this.getCPU=function(){var D={};return D[_]=i,ke.call(D,v,x.cpu),D},this.getDevice=function(){var D={};return D[b]=i,D[h]=i,D[g]=i,ke.call(D,v,x.device),A&&!D[g]&&m&&m.mobile&&(D[g]=E),A&&D[h]=="Macintosh"&&y&&typeof y.standalone!==f&&y.maxTouchPoints&&y.maxTouchPoints>2&&(D[h]="iPad",D[g]=S),D},this.getEngine=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.engine),D},this.getOS=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.os),A&&!D[p]&&m&&m.platform!="Unknown"&&(D[p]=m.platform.replace(/chrome os/i,W).replace(/macos/i,V)),D},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return v},this.setUA=function(D){return v=typeof D===c&&D.length>P?ge(D,P):D,this},this.setUA(v),this};Pe.VERSION=r,Pe.BROWSER=M([p,w,u]),Pe.CPU=M([_]),Pe.DEVICE=M([h,b,g,k,E,T,S,O,C]),Pe.ENGINE=Pe.OS=M([p,w]),e.exports&&(n=e.exports=Pe),n.UAParser=Pe;var Ve=typeof t!==f&&(t.jQuery||t.Zepto);if(Ve&&!Ve.ua){var _n=new Pe;Ve.ua=_n.getResult(),Ve.ua.get=function(){return _n.getUA()},Ve.ua.set=function(Ee){_n.setUA(Ee);var We=_n.getResult();for(var y in We)Ve.ua[y]=We[y]}}})(typeof window=="object"?window:mn)})(Sh,Sh.exports);var vU=Sh.exports,bl="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",Ch,$h;if(typeof navigator<"u"){const e=new vU.UAParser(navigator.userAgent);Ch=e.getBrowser().name,$h=e.getOS().name}var pU=(e,n,t)=>{if(!e.contentWindow){Ge("IFrame content window missing",{origin:n},{F:bl,L:24,S:void 0,C:(i,r)=>i(...r)});return}Ch==="Chrome"&&$h==="iOS"?e.contentWindow.postMessage(t,n):e.contentWindow.postMessage(t,n,[t.payload])},mU=(e,n)=>{Ch==="Chrome"&&$h==="iOS"?window.parent.postMessage(n,e):window.parent.postMessage(n,e,[n.payload])},H_=({channel:e,iframe:n,origin:t,onOrigin:i})=>({send:async r=>{if(!t){Ge("no origin set",{channel:e},{F:bl,L:62,S:void 0,C:(s,f)=>s(...f)});return}Ge("sending",{channel:e,data:r.length},{F:bl,L:66,S:void 0,C:(s,f)=>s(...f)});const a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),o={channel:e,payload:a};n?pU(n,t,o):mU(t,o)},subscribe:r=>{const a=o=>{if(!n&&o.source!==window.parent)return;if(n&&o.source!==n.contentWindow)return;const f=o.data&&typeof o.data=="object"&&"channel"in o.data&&"payload"in o.data?o.data:void 0;(f==null?void 0:f.channel)===e&&(t||(t=o.origin,i==null||i(t)),Ge("received",f,{F:bl,L:98,S:void 0,C:(d,c)=>d(...c)}),r(new Uint8Array(f.payload)))};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)}});const gU=e=>{const n=$n("spaceDialog__title");return l.createElement(st.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(st.Portal,null,l.createElement(st.Overlay,null,l.createElement(st.Content,{"aria-labelledby":n},l.createElement(cu,null,l.createElement(cU,{...e,titleId:n,doneActionParent:l.createElement(st.Close,{asChild:!0})}))))))},bU=()=>{const e=$n("statusDialog__title");return l.createElement(Zt.Root,{open:!0},l.createElement(Zt.Portal,null,l.createElement(Zt.Overlay,null,l.createElement(Zt.Content,{"aria-labelledby":e},l.createElement(uU,{titleId:e})))))},yU=({runtime:e,origin:n})=>{const[{layout:t,invitationCode:i,spaceKey:r,target:a},o]=l.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),s=Re.useClient(),f=Jo.useSpace(r);switch(l.useEffect(()=>e.layoutUpdate.on(d=>o(d)),[e]),l.useEffect(()=>{if(t===Re.ShellLayout.SPACE&&!f){Ge.warn("No space found for shell space invitations.");const d=setTimeout(async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})});return()=>clearTimeout(d)}},[e,t,f]),t){case Re.ShellLayout.STATUS:return l.createElement(bU,null);case Re.ShellLayout.INITIALIZE_IDENTITY:case Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:return l.createElement(U_,{mode:"halo-only",initialDisposition:t===Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION?"accept-halo-invitation":"default",initialInvitationCode:i,onCancelResetStorage:()=>e.setLayout({layout:Re.ShellLayout.IDENTITY}),onDone:()=>{e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}});case Re.ShellLayout.IDENTITY:case Re.ShellLayout.SHARE_IDENTITY:case Re.ShellLayout.EDIT_PROFILE:return l.createElement(hU,{createInvitationUrl:d=>`${n}?deviceInvitationCode=${d}`,onResetStorage:async()=>(e.setLayout({layout:Re.ShellLayout.STATUS}),await s.reset(),e.setAppContext({display:Re.ShellDisplay.NONE,reload:!0})),onJoinNewIdentity:async()=>(e.setLayout({layout:Re.ShellLayout.STATUS}),await s.reset(),e.setLayout({layout:Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION})),onDone:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})},initialDisposition:t===Re.ShellLayout.SHARE_IDENTITY?"manage-device-invitation":"default"});case Re.ShellLayout.SPACE:return f?l.createElement(gU,{space:f,target:a,createInvitationUrl:d=>`${n}?spaceInvitationCode=${d}`,onDone:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}}):null;case Re.ShellLayout.JOIN_SPACE:return l.createElement(U_,{initialInvitationCode:i,onDone:async d=>{const c=(d==null?void 0:d.target)??void 0;await e.setAppContext({display:Re.ShellDisplay.NONE,spaceKey:(d==null?void 0:d.spaceKey)??void 0,target:c}),e.setLayout({layout:Re.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}});default:return null}},V_={"en-US":Object.freeze(Object.defineProperty({__proto__:null,os:{"manage profile label":"Manage identity","identity offline description":"Offline","sidebar label":"DXOS sidebar","copy invitation code label":"Copy URL","copy success label":"Copied","copy self public key label":"Copy public key","open share panel label":"View QR code","joining space heading":"Joining space","join space heading":"Enter space invitation","halo heading":"Initialize device identity","exit label":"Exit","identity selector title":"Join as","identity radio group title":"Select an identity you’ve associated with this device already","add identity label":"Add","continue label":"Continue","back label":"Back","next label":"Next","close label":"Close","auth choices label":"Choose an identity","create identity label":"Create an identity","create identity description":"Create a new identity.","recover identity label":"Use a seed phrase","recover identity description":"Enter your seed phrase to log in manually.","join identity label":"Use another device","join identity description":"Add this device to an identity you’re already logged into on another device.","deselect identity label":"Back to identities","addition method chooser title":"An identity is required to continue","new identity input label":"Set display name","recover identity input label":"Type or paste your seed phrase","failed to create identity message":"Failed to create an identity.","failed to recover identity message":"Failed to recover an identity from the provided seed phrase.","failed to authenticate message":"Incorrect PIN.","identity added label":"Created identity & added to this device:","join space as identity heading":"<part>as </part><part><icon/><label>{{labelValue}}</label></part>","error status label":"Failed","timeout status label":"Timed out","cancelled status label":"Cancelled","init status label":"Ready to connect","connecting status label":"Connecting…","connected status label":"Enter confirmation PIN","authenticating status label":"Enter confirmation PIN","success status label":"Success","cancel label":"Cancel","done label":"Done","reset label":"Start over","auth code input label":"Enter the verification code","invitation input label":"Paste an invitation code or URL","create device invitation label":"Add device","create space invitation label":"Invite","qr label":"Scan to accept invitation","empty invitations message":"No pending invitations","empty device list message":"No devices authenticated other than this device.","show all spaces label":"All spaces","all spaces label":"All spaces","create space label":"Create a new space","join space label":"Join a space","show current space label":"Current space","view space invitations label":"View space invitations","toggle sidebar label":"Open/close sidebar","open sidebar label":"Open sidebar","close sidebar label":"Close sidebar","welcome message":"Welcome","selecting identity heading":"Selecting identity","devices heading":"Devices","identity heading":"Profile settings","choose add device label":"Add device","choose devices label":"Manage devices","choose profile label":"Edit profile","choose sign out label":"Reset storage","choose join new identity label":"Join existing device","empty space members message":"There is nobody in this space yet.","back to all invitations label":"Back to all invitations","invitation heading":"Invitation","invitation list heading":"Invitations","device invitation list heading":"Pending device invitations","space invitation list heading":"Pending invitations","device list heading":"Devices","space member list heading":"Members","space panel heading":"Space membership","auth code message":"Enter the following auth code on the joining device.","display name input label":"Display name","display name input placeholder":"Enter a display name","invite one label":"Invite one","invite one description":"Only one user may join.","invite one qr label":"Single-use","invite one list item label":"Active single-use invitation","invite many label":"Invite many","invite many description":"Anyone with the link can join.","invite many qr label":"Multiple-use","invite many list item label":"Active multiple-use invitation","invite options label":"Change the active invite option.","reset in progress label":"Resetting...","confirm label":"Confirm","reset storage input label":"This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.","join new identity input label":"In order to join an existing device, storage on this device must be cleared first. Type {{confirmationValue}} to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"CONFIRM","sign out chooser title":"Danger zone","sign out chooser message":"Proceeding with the action below will erase all data on this device.","join new identity label":"Join a new identity","reset device label":"Reset storage","reset device confirm message":"Are you sure you want to reset your device? All data will be lost.","emoji and color label":"Emoji and color","clear label":"Use default","select emoji label":"Choose an emoji to use in your avatar","select hue label":"Choose a hue to use in your avatar","resetting message":"One moment while things are reset…","red label":"Red","orange label":"Orange","amber label":"Amber","yellow label":"Yellow","lime label":"Lime","green label":"Green","emerald label":"Emerald","teal label":"Teal","cyan label":"Cyan","sky label":"Sky","blue label":"Blue","indigo label":"Indigo","violet label":"Violet","purple label":"Purple","fuchsia label":"Fuchsia","pink label":"Pink","rose label":"Rose","current device tag label":"This device","device name placeholder":"{{platform}} on {{os}}","more options label":"More options","disconnect label":"Currently online. Click to go offline.","connect label":"Currently offline. Click to go online.","edit device label":"Edit device name & avatar","agent heading":"Agent","agent message title":"About creating an agent","agent message body":"Creating an agent helps keep your devices and peers in-sync. An agent is like any other device, but since it’s always online your changes will sync even when all your physical devices are asleep.","create agent label":"Start an agent","destroy agent label":"Shut down agent","agent device label":"Your agent","shell fallback title":"Shell failed to connect"}},Symbol.toStringTag,{value:"Module"}))},wU=async(e=new Re.Config)=>{const n=new K_.ShellRuntimeImpl(H_({channel:xi.DEFAULT_SHELL_CHANNEL}));await n.open();try{const t=new Re.ClientServicesProxy(H_({channel:xi.DEFAULT_CLIENT_CHANNEL})),i=new Re.Client({config:e,services:t});await i.initialize(),ml(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(ab,{tx:gy,resourceExtensions:[V_]},l.createElement(Re.ClientContext.Provider,{value:{client:i,status:Re.SystemStatus.ACTIVE}},l.createElement(cu,null,l.createElement(Ze.Provider,null,l.createElement(Re.AgentHostingProvider,null,l.createElement(yU,{runtime:n,origin:location.origin}))))))))}catch{ml(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(ab,{tx:gy,resourceExtensions:[V_]},l.createElement(_U,{onClose:()=>n.setAppContext({display:Re.ShellDisplay.NONE})}))))}},_U=({onClose:e})=>{const{t:n}=vn("os");return l.createElement(st.Root,{modal:!0,open:!0,onOpenChange:()=>e==null?void 0:e()},l.createElement(st.Overlay,null,l.createElement(st.Content,null,l.createElement(st.Title,null,n("shell fallback title")),l.createElement(st.Close,{asChild:!0,onClick:()=>e==null?void 0:e()},l.createElement(jn,{variant:"primary"},n("close label"))))))};l.createContext({}),rt.runShell=wU,Object.defineProperty(rt,Symbol.toStringTag,{value:"Module"})});
946
+ `}return ae.substring(0,ae.length-1)},ee.renderTo2dContext=function(j,W){W=W||2;for(var V=ee.getModuleCount(),I=0;I<V;I++)for(var M=0;M<V;M++)j.fillStyle=ee.isDark(I,M)?"black":"white",j.fillRect(I*W,M*W,W,W)},ee};i.stringToBytesFuncs={default:function(T){for(var O=[],C=0;C<T.length;C+=1){var P=T.charCodeAt(C);O.push(P&255)}return O}},i.stringToBytes=i.stringToBytesFuncs.default,i.createStringToBytes=function(T,O){var C=function(){for(var F=k(T),B=function(){var oe=F.read();if(oe==-1)throw"eof";return oe},L=0,N={};;){var X=F.read();if(X==-1)break;var Y=B(),ee=B(),re=B(),fe=String.fromCharCode(X<<8|Y),ce=ee<<8|re;N[fe]=ce,L+=1}if(L!=O)throw L+" != "+O;return N}(),P=63;return function(F){for(var B=[],L=0;L<F.length;L+=1){var N=F.charCodeAt(L);if(N<128)B.push(N);else{var X=C[F.charAt(L)];typeof X=="number"?(X&255)==X?B.push(X):(B.push(X>>>8),B.push(X&255)):B.push(P)}}return B}};var r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},a={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=function(){var T=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],O=1335,C=7973,P=21522,F={},B=function(L){for(var N=0;L!=0;)N+=1,L>>>=1;return N};return F.getBCHTypeInfo=function(L){for(var N=L<<10;B(N)-B(O)>=0;)N^=O<<B(N)-B(O);return(L<<10|N)^P},F.getBCHTypeNumber=function(L){for(var N=L<<12;B(N)-B(C)>=0;)N^=C<<B(N)-B(C);return L<<12|N},F.getPatternPosition=function(L){return T[L-1]},F.getMaskFunction=function(L){switch(L){case o.PATTERN000:return function(N,X){return(N+X)%2==0};case o.PATTERN001:return function(N,X){return N%2==0};case o.PATTERN010:return function(N,X){return X%3==0};case o.PATTERN011:return function(N,X){return(N+X)%3==0};case o.PATTERN100:return function(N,X){return(Math.floor(N/2)+Math.floor(X/3))%2==0};case o.PATTERN101:return function(N,X){return N*X%2+N*X%3==0};case o.PATTERN110:return function(N,X){return(N*X%2+N*X%3)%2==0};case o.PATTERN111:return function(N,X){return(N*X%3+(N+X)%2)%2==0};default:throw"bad maskPattern:"+L}},F.getErrorCorrectPolynomial=function(L){for(var N=d([1],0),X=0;X<L;X+=1)N=N.multiply(d([1,f.gexp(X)],0));return N},F.getLengthInBits=function(L,N){if(1<=N&&N<10)switch(L){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:return 8;case r.MODE_KANJI:return 8;default:throw"mode:"+L}else if(N<27)switch(L){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw"mode:"+L}else if(N<41)switch(L){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw"mode:"+L}else throw"type:"+N},F.getLostPoint=function(L){for(var N=L.getModuleCount(),X=0,Y=0;Y<N;Y+=1)for(var ee=0;ee<N;ee+=1){for(var re=0,fe=L.isDark(Y,ee),ce=-1;ce<=1;ce+=1)if(!(Y+ce<0||N<=Y+ce))for(var oe=-1;oe<=1;oe+=1)ee+oe<0||N<=ee+oe||ce==0&&oe==0||fe==L.isDark(Y+ce,ee+oe)&&(re+=1);re>5&&(X+=3+re-5)}for(var Y=0;Y<N-1;Y+=1)for(var ee=0;ee<N-1;ee+=1){var ye=0;L.isDark(Y,ee)&&(ye+=1),L.isDark(Y+1,ee)&&(ye+=1),L.isDark(Y,ee+1)&&(ye+=1),L.isDark(Y+1,ee+1)&&(ye+=1),(ye==0||ye==4)&&(X+=3)}for(var Y=0;Y<N;Y+=1)for(var ee=0;ee<N-6;ee+=1)L.isDark(Y,ee)&&!L.isDark(Y,ee+1)&&L.isDark(Y,ee+2)&&L.isDark(Y,ee+3)&&L.isDark(Y,ee+4)&&!L.isDark(Y,ee+5)&&L.isDark(Y,ee+6)&&(X+=40);for(var ee=0;ee<N;ee+=1)for(var Y=0;Y<N-6;Y+=1)L.isDark(Y,ee)&&!L.isDark(Y+1,ee)&&L.isDark(Y+2,ee)&&L.isDark(Y+3,ee)&&L.isDark(Y+4,ee)&&!L.isDark(Y+5,ee)&&L.isDark(Y+6,ee)&&(X+=40);for(var se=0,ee=0;ee<N;ee+=1)for(var Y=0;Y<N;Y+=1)L.isDark(Y,ee)&&(se+=1);var G=Math.abs(100*se/N/N-50)/5;return X+=G*10,X},F}(),f=function(){for(var T=new Array(256),O=new Array(256),C=0;C<8;C+=1)T[C]=1<<C;for(var C=8;C<256;C+=1)T[C]=T[C-4]^T[C-5]^T[C-6]^T[C-8];for(var C=0;C<255;C+=1)O[T[C]]=C;var P={};return P.glog=function(F){if(F<1)throw"glog("+F+")";return O[F]},P.gexp=function(F){for(;F<0;)F+=255;for(;F>=256;)F-=255;return T[F]},P}();function d(T,O){if(typeof T.length>"u")throw T.length+"/"+O;var C=function(){for(var F=0;F<T.length&&T[F]==0;)F+=1;for(var B=new Array(T.length-F+O),L=0;L<T.length-F;L+=1)B[L]=T[L+F];return B}(),P={};return P.getAt=function(F){return C[F]},P.getLength=function(){return C.length},P.multiply=function(F){for(var B=new Array(P.getLength()+F.getLength()-1),L=0;L<P.getLength();L+=1)for(var N=0;N<F.getLength();N+=1)B[L+N]^=f.gexp(f.glog(P.getAt(L))+f.glog(F.getAt(N)));return d(B,0)},P.mod=function(F){if(P.getLength()-F.getLength()<0)return P;for(var B=f.glog(P.getAt(0))-f.glog(F.getAt(0)),L=new Array(P.getLength()),N=0;N<P.getLength();N+=1)L[N]=P.getAt(N);for(var N=0;N<F.getLength();N+=1)L[N]^=f.gexp(f.glog(F.getAt(N))+B);return d(L,0).mod(F)},P}var c=function(){var T=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],O=function(F,B){var L={};return L.totalCount=F,L.dataCount=B,L},C={},P=function(F,B){switch(B){case a.L:return T[(F-1)*4+0];case a.M:return T[(F-1)*4+1];case a.Q:return T[(F-1)*4+2];case a.H:return T[(F-1)*4+3];default:return}};return C.getRSBlocks=function(F,B){var L=P(F,B);if(typeof L>"u")throw"bad rs block @ typeNumber:"+F+"/errorCorrectionLevel:"+B;for(var N=L.length/3,X=[],Y=0;Y<N;Y+=1)for(var ee=L[Y*3+0],re=L[Y*3+1],fe=L[Y*3+2],ce=0;ce<ee;ce+=1)X.push(O(re,fe));return X},C}(),u=function(){var T=[],O=0,C={};return C.getBuffer=function(){return T},C.getAt=function(P){var F=Math.floor(P/8);return(T[F]>>>7-P%8&1)==1},C.put=function(P,F){for(var B=0;B<F;B+=1)C.putBit((P>>>F-B-1&1)==1)},C.getLengthInBits=function(){return O},C.putBit=function(P){var F=Math.floor(O/8);T.length<=F&&T.push(0),P&&(T[F]|=128>>>O%8),O+=1},C},h=function(T){var O=r.MODE_NUMBER,C=T,P={};P.getMode=function(){return O},P.getLength=function(L){return C.length},P.write=function(L){for(var N=C,X=0;X+2<N.length;)L.put(F(N.substring(X,X+3)),10),X+=3;X<N.length&&(N.length-X==1?L.put(F(N.substring(X,X+1)),4):N.length-X==2&&L.put(F(N.substring(X,X+2)),7))};var F=function(L){for(var N=0,X=0;X<L.length;X+=1)N=N*10+B(L.charAt(X));return N},B=function(L){if("0"<=L&&L<="9")return L.charCodeAt(0)-48;throw"illegal char :"+L};return P},p=function(T){var O=r.MODE_ALPHA_NUM,C=T,P={};P.getMode=function(){return O},P.getLength=function(B){return C.length},P.write=function(B){for(var L=C,N=0;N+1<L.length;)B.put(F(L.charAt(N))*45+F(L.charAt(N+1)),11),N+=2;N<L.length&&B.put(F(L.charAt(N)),6)};var F=function(B){if("0"<=B&&B<="9")return B.charCodeAt(0)-48;if("A"<=B&&B<="Z")return B.charCodeAt(0)-65+10;switch(B){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+B}};return P},g=function(T){var O=r.MODE_8BIT_BYTE,C=i.stringToBytes(T),P={};return P.getMode=function(){return O},P.getLength=function(F){return C.length},P.write=function(F){for(var B=0;B<C.length;B+=1)F.put(C[B],8)},P},b=function(T){var O=r.MODE_KANJI,C=i.stringToBytesFuncs.SJIS;if(!C)throw"sjis not supported.";(function(B,L){var N=C(B);if(N.length!=2||(N[0]<<8|N[1])!=L)throw"sjis not supported."})("友",38726);var P=C(T),F={};return F.getMode=function(){return O},F.getLength=function(B){return~~(P.length/2)},F.write=function(B){for(var L=P,N=0;N+1<L.length;){var X=(255&L[N])<<8|255&L[N+1];if(33088<=X&&X<=40956)X-=33088;else if(57408<=X&&X<=60351)X-=49472;else throw"illegal char at "+(N+1)+"/"+X;X=(X>>>8&255)*192+(X&255),B.put(X,13),N+=2}if(N<L.length)throw"illegal char at "+(N+1)},F},w=function(){var T=[],O={};return O.writeByte=function(C){T.push(C&255)},O.writeShort=function(C){O.writeByte(C),O.writeByte(C>>>8)},O.writeBytes=function(C,P,F){P=P||0,F=F||C.length;for(var B=0;B<F;B+=1)O.writeByte(C[B+P])},O.writeString=function(C){for(var P=0;P<C.length;P+=1)O.writeByte(C.charCodeAt(P))},O.toByteArray=function(){return T},O.toString=function(){var C="";C+="[";for(var P=0;P<T.length;P+=1)P>0&&(C+=","),C+=T[P];return C+="]",C},O},_=function(){var T=0,O=0,C=0,P="",F={},B=function(N){P+=String.fromCharCode(L(N&63))},L=function(N){if(!(N<0)){if(N<26)return 65+N;if(N<52)return 97+(N-26);if(N<62)return 48+(N-52);if(N==62)return 43;if(N==63)return 47}throw"n:"+N};return F.writeByte=function(N){for(T=T<<8|N&255,O+=8,C+=1;O>=6;)B(T>>>O-6),O-=6},F.flush=function(){if(O>0&&(B(T<<6-O),T=0,O=0),C%3!=0)for(var N=3-C%3,X=0;X<N;X+=1)P+="="},F.toString=function(){return P},F},k=function(T){var O=T,C=0,P=0,F=0,B={};B.read=function(){for(;F<8;){if(C>=O.length){if(F==0)return-1;throw"unexpected end of file./"+F}var N=O.charAt(C);if(C+=1,N=="=")return F=0,-1;if(N.match(/^\s$/))continue;P=P<<6|L(N.charCodeAt(0)),F+=6}var X=P>>>F-8&255;return F-=8,X};var L=function(N){if(65<=N&&N<=90)return N-65;if(97<=N&&N<=122)return N-97+26;if(48<=N&&N<=57)return N-48+52;if(N==43)return 62;if(N==47)return 63;throw"c:"+N};return B},E=function(T,O){var C=T,P=O,F=new Array(T*O),B={};B.setPixel=function(Y,ee,re){F[ee*C+Y]=re},B.write=function(Y){Y.writeString("GIF87a"),Y.writeShort(C),Y.writeShort(P),Y.writeByte(128),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(0),Y.writeByte(255),Y.writeByte(255),Y.writeByte(255),Y.writeString(","),Y.writeShort(0),Y.writeShort(0),Y.writeShort(C),Y.writeShort(P),Y.writeByte(0);var ee=2,re=N(ee);Y.writeByte(ee);for(var fe=0;re.length-fe>255;)Y.writeByte(255),Y.writeBytes(re,fe,255),fe+=255;Y.writeByte(re.length-fe),Y.writeBytes(re,fe,re.length-fe),Y.writeByte(0),Y.writeString(";")};var L=function(Y){var ee=Y,re=0,fe=0,ce={};return ce.write=function(oe,ye){if(oe>>>ye)throw"length over";for(;re+ye>=8;)ee.writeByte(255&(oe<<re|fe)),ye-=8-re,oe>>>=8-re,fe=0,re=0;fe=oe<<re|fe,re=re+ye},ce.flush=function(){re>0&&ee.writeByte(fe)},ce},N=function(Y){for(var ee=1<<Y,re=(1<<Y)+1,fe=Y+1,ce=X(),oe=0;oe<ee;oe+=1)ce.add(String.fromCharCode(oe));ce.add(String.fromCharCode(ee)),ce.add(String.fromCharCode(re));var ye=w(),se=L(ye);se.write(ee,fe);var G=0,J=String.fromCharCode(F[G]);for(G+=1;G<F.length;){var ie=String.fromCharCode(F[G]);G+=1,ce.contains(J+ie)?J=J+ie:(se.write(ce.indexOf(J),fe),ce.size()<4095&&(ce.size()==1<<fe&&(fe+=1),ce.add(J+ie)),J=ie)}return se.write(ce.indexOf(J),fe),se.write(re,fe),se.flush(),ye.toByteArray()},X=function(){var Y={},ee=0,re={};return re.add=function(fe){if(re.contains(fe))throw"dup key:"+fe;Y[fe]=ee,ee+=1},re.size=function(){return ee},re.indexOf=function(fe){return Y[fe]},re.contains=function(fe){return typeof Y[fe]<"u"},re};return B},S=function(T,O,C){for(var P=E(T,O),F=0;F<O;F+=1)for(var B=0;B<T;B+=1)P.setPixel(B,F,C(B,F));var L=w();P.write(L);for(var N=_(),X=L.toByteArray(),Y=0;Y<X.length;Y+=1)N.writeByte(X[Y]);return N.flush(),"data:image/gif;base64,"+N};return i}();(function(){t.stringToBytesFuncs["UTF-8"]=function(i){function r(a){for(var o=[],s=0;s<a.length;s++){var f=a.charCodeAt(s);f<128?o.push(f):f<2048?o.push(192|f>>6,128|f&63):f<55296||f>=57344?o.push(224|f>>12,128|f>>6&63,128|f&63):(s++,f=65536+((f&1023)<<10|a.charCodeAt(s)&1023),o.push(240|f>>18,128|f>>12&63,128|f>>6&63,128|f&63))}return o}return r(i)}})(),function(i){e.exports=i()}(function(){return t})})(S_);var Oz=S_.exports;const kh=Qi(Oz);var Pz=Object.defineProperty,vl=Object.getOwnPropertySymbols,C_=Object.prototype.hasOwnProperty,$_=Object.prototype.propertyIsEnumerable,T_=(e,n,t)=>n in e?Pz(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Iz=(e,n)=>{for(var t in n||(n={}))C_.call(n,t)&&T_(e,t,n[t]);if(vl)for(var t of vl(n))$_.call(n,t)&&T_(e,t,n[t]);return e},Fz=(e,n)=>{var t={};for(var i in e)C_.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&vl)for(var i of vl(e))n.indexOf(i)<0&&$_.call(e,i)&&(t[i]=e[i]);return t},bi=1e3,Mz=/code length overflow/i;kh.stringToBytes=kh.stringToBytesFuncs["UTF-8"];var Nz=(e,n,t)=>{t=Math.max(1,t);for(let i=t;i<=40;i+=1)try{const r=kh(i,n);r.addData(e),r.make();const a=r.getModuleCount();return{text:e,level:n,version:i,moduleCount:a,isDark:(s,f)=>s>=0&&s<a&&f>=0&&f<a&&r.isDark(s,f)}}catch(r){if(!(i<40&&Mz.test(String(r))))throw r}return null},Yi=Math.round,Ea=(e,n)=>`M ${Yi(e)} ${Yi(n)}`,nt=(e,n)=>`L ${Yi(e)} ${Yi(n)}`,Ji=(e,n,t)=>`A ${Yi(t)} ${Yi(t)} 0 0 1 ${Yi(e)} ${Yi(n)}`,Dz=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a?d.push(Ea(e+r,n)):d.push(Ea(e,n)),o?d.push(nt(t-r,n),Ji(t,n+r,r)):d.push(nt(t,n)),s?d.push(nt(t,i-r),Ji(t-r,i,r)):d.push(nt(t,i)),f?d.push(nt(e+r,i),Ji(e,i-r,r)):d.push(nt(e,i)),a?d.push(nt(e,n+r),Ji(e+r,n,r)):d.push(nt(e,n)),d.join(" ")},Lz=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a&&d.push(Ea(e+r,n),nt(e,n),nt(e,n+r),Ji(e+r,n,r)),o&&d.push(Ea(t,n+r),nt(t,n),nt(t-r,n),Ji(t,n+r,r)),s&&d.push(Ea(t-r,i),nt(t,i),nt(t,i-r),Ji(t-r,i,r)),f&&d.push(Ea(e,i-r),nt(e,i),nt(e+r,i),Ji(e,i-r,r)),d.join(" ")},Bz=(e,n,t,i,r)=>{const a=r*t,o=i*t,s=a+t,f=o+t,d=n*.005*t,c=e.isDark,u=i-1,h=i+1,p=r-1,g=r+1,b=c(i,r),w=c(u,p),_=c(u,r),k=c(u,g),E=c(i,g),S=c(h,g),T=c(h,r),O=c(h,p),C=c(i,p);return b?Dz(a,o,s,f,d,!_&&!C,!_&&!E,!T&&!E,!T&&!C):Lz(a,o,s,f,d,_&&C&&w,_&&E&&k,T&&E&&S,T&&C&&O)},jz=(e,n)=>{if(!e)return"";const t=e.moduleCount,i=bi/t,r=[];for(let a=0;a<t;a+=1)for(let o=0;o<t;o+=1)r.push(Bz(e,n,i,a,o));return r.join(" ")},Rz=e=>{var n=e,{color:t="#000",backgroundColor:i,cutout:r=!1,cutoutElement:a,errorCorrectionLevel:o="Q",rounding:s=0,children:f}=n,d=Fz(n,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),c,u;const h=l.useMemo(()=>Nz(f,o,1),[f,o]);if(!h)return null;const p=(c=h==null?void 0:h.moduleCount)!=null?c:1,b=bi/((u=h==null?void 0:h.moduleCount)!=null?u:1)*(Math.floor(p*.18)*2-1)+2,w=(bi-b)/2;return de.createElement("svg",Iz({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${bi} ${bi}`},d),r?de.createElement("mask",{id:"react-qr-rounded__mask"},de.createElement("rect",{x:"0",y:"0",width:bi,height:bi,fill:"#fff"}),de.createElement("rect",{x:w,y:w,width:b,height:b,rx:s,ry:s,fill:"#000"})):null,i?de.createElement("rect",{x:"0",y:"0",width:bi,height:bi,fill:i}):null,de.createElement("path",{fill:t,d:jz(h,s),mask:r?"url(#react-qr-rounded__mask)":void 0}),a?de.createElement("foreignObject",{x:w,y:w,width:b,height:b},de.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",overflow:"hidden",borderRadius:s}},a)):null)};const zz=new Map([[Se.State.ERROR,-3],[Se.State.TIMEOUT,-2],[Se.State.CANCELLED,-1],[Se.State.INIT,0],[Se.State.CONNECTING,1],[Se.State.CONNECTED,2],[Se.State.READY_FOR_AUTHENTICATION,3],[Se.State.AUTHENTICATING,4],[Se.State.SUCCESS,5]]),xh=({children:e,...n})=>l.createElement(bn.View,{...n,classNames:"grow flex flex-col justify-around items-center"},e),A_=({invitationUrl:e,active:n,send:t,status:i,multiUse:r,authCode:a,id:o="0"})=>{const{t:s}=vn("os"),f=$n("invitation-manager__qr-code"),d=r?0:zz.get(i)??0,c=d===3,u=io(o),h=l.useMemo(()=>{switch(!0){case d===5:case d<0:return"showing final";case d===3:return"showing auth code";default:return"showing qr"}},[d]);return l.createElement(l.Fragment,null,l.createElement(bn.Root,{activeView:h,classNames:"grow plb-1"},l.createElement(bn.Views,null,l.createElement(xh,{id:"showing qr",emoji:u},l.createElement("p",{className:"text-sm mlb-1 font-normal text-center"},s(r?"invite many qr label":"invite one qr label")),l.createElement("div",{role:"none",className:le(In,"is-full max-is-[14rem] relative")},l.createElement(Rz,{rounding:100,backgroundColor:"transparent",color:"currentColor",className:le("is-full bs-full p-2",c&&"invisible"),"aria-labelledby":f,errorCorrectionLevel:"Q",cutout:!0},e??"never"),l.createElement(xj,null,l.createElement(qu,{text:u}))),l.createElement("span",{id:f,className:"sr-only"},s("qr label")),l.createElement(nL,{variant:"ghost",value:e??"never"})),l.createElement(xh,{id:"showing auth code"},l.createElement($2,null,s("auth code message")),l.createElement(S2,{code:a,large:!0,classNames:"text-black dark:text-white"}),l.createElement($2,null,"Be sure the other device is showing this symbol:"),u&&l.createElement(qu,{text:u})),l.createElement(xh,{id:"showing final"},d>0?l.createElement(qe.Check,{className:le("m-1.5",He(6))}):l.createElement(qe.X,{className:le("m-1.5",He(6))})))),l.createElement(jt,{classNames:"mbs-4"},l.createElement(Vn,{disabled:!n,onClick:()=>t==null?void 0:t({type:"deselectInvitation"})},s("back label"))))},Eh=({active:e,onCancel:n,onConfirm:t,mode:i})=>{const{t:r}=vn("os"),[a,o]=l.useState(""),[s,f]=l.useState(!1),d=async()=>(f(!0),t==null?void 0:t().then(()=>f(!1),c=>{Ge.catch(c),o(r("failed to reset identity message")),f(!1)}));return l.createElement(Uz,{disabled:!e,pending:s,validationMessage:a,onConfirm:d,onCancel:n,mode:i})},Uz=({disabled:e,pending:n,validationMessage:t,onConfirm:i,onCancel:r,mode:a})=>{const{t:o}=vn("os"),s=o("confirmation value"),[f,d]=l.useState(""),c=a==="join new identity"?"join-new-identity":"reset-storage";return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col gap-2 justify-center"},l.createElement(Dc.Root,{valence:"error"},l.createElement(Dc.Title,null,l.createElement(qe.Warning,{className:le(He(6),"inline mie-2")}),o("sign out chooser title")),l.createElement(Dc.Body,null,o("sign out chooser message"))),l.createElement(Ku,{validationMessage:t,label:l.createElement(gi,{className:"text-start mlb-2"},o(a==="join new identity"?"join new identity input label":"reset storage input label",{confirmationValue:s})),disabled:e,"data-testid":`${c}.reset-identity-input`,placeholder:s,onChange:({target:{value:u}})=>d(u)})),l.createElement(jt,null,r&&l.createElement(Vn,{disabled:e,onClick:r,"data-testid":`${c}.reset-identity-cancel`},o("cancel label")),i&&l.createElement(Vn,{variant:"destructive",disabled:e||n||f!==s,onClick:i,"data-testid":`${c}.reset-identity-confirm`},o(n?"reset in progress label":"reset device label"))))},pl="pbs-1 pbe-3 pli-3",Wz=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.hue)||a$((e==null?void 0:e.identityKey.toHex())??"0")},Hz=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.emoji)||io((e==null?void 0:e.identityKey.toHex())??"0")},Vz=({titleId:e,title:n,identity:t,onDone:i,onUpdateProfile:r,connectionState:a,onChangeConnectionState:o})=>{var C,P;const s=oc(t.identityKey),{t:f}=vn("os"),[d,c]=l.useState(((C=t.profile)==null?void 0:C.displayName)??""),[u,h]=l.useState(Hz(t)),[p,g]=l.useState(Wz(t)),{textValue:b,setTextValue:w}=du(),_=t.identityKey.toHex(),k=b===_,E=async()=>{const F={...d&&{displayName:d},...(u||p)&&{data:{...u&&{emoji:u},...p&&{hue:p}}}};return r==null?void 0:r(F)},S=F=>{h(F),E()},T=F=>{g(F),E()},O=a===Xo.ConnectionState.ONLINE;return l.createElement(Gu,{titleId:e,title:n,corner:l.createElement(C2,{onDone:i})},l.createElement(wn.Root,{size:16,variant:"circle",status:O?"active":"error",hue:p||s.hue},l.createElement(mo.Root,{classNames:"grid grid-cols-[1fr_var(--rail-action)_min-content_var(--rail-action)_1fr] items-center gap-2"},l.createElement(Ze.Root,null,l.createElement(Ze.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:"bs-[--rail-action] is-[--rail-action] justify-self-end",onClick:()=>o==null?void 0:o(O?Xo.ConnectionState.OFFLINE:Xo.ConnectionState.ONLINE)},l.createElement("span",{className:"sr-only"},f(O?"disconnect label":"connect label")),O?l.createElement(qe.PlugsConnected,{className:He(5)}):l.createElement(qe.Plugs,{className:He(5)}))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},f(O?"disconnect label":"connect label"),l.createElement(Ze.Arrow,null)))),l.createElement(WL,{emoji:u,onChangeEmoji:S,classNames:"bs-[--rail-action]"}),l.createElement(wn.Frame,{classNames:"relative z-[2] -mli-4 chromatic-ignore"},l.createElement(wn.Fallback,{text:u||s.emoji})),l.createElement(VL,{hue:p,onChangeHue:T,classNames:"bs-[--rail-action]"}),l.createElement(Ze.Root,null,l.createElement(Ze.Trigger,{asChild:!0},l.createElement(mo.Button,{classNames:"bs-[--rail-action] justify-self-start","data-testid":"update-profile-form-copy-key",onClick:()=>w(_)},l.createElement("span",{className:"sr-only"},f(k?"copy success label":"copy self public key label")),l.createElement(qe.CopySimple,{className:He(5)}))),l.createElement(Ze.Portal,null,l.createElement(Ze.Content,{side:"bottom",classNames:"z-50"},f(k?"copy success label":"copy self public key label"),l.createElement(Ze.Arrow,null))))),l.createElement(wn.Label,{classNames:"sr-only","data-testid":"identityHeading.displayName"},((P=t.profile)==null?void 0:P.displayName)??Nf(t.identityKey.toHex())),l.createElement(bt.Root,null,l.createElement(bt.Label,{srOnly:!0},f("display name input label")),l.createElement(bt.TextInput,{variant:"subdued","data-testid":"display-name-input",placeholder:f("display name input placeholder"),classNames:"mbs-2 text-center font-light text-xl",value:d,onChange:({target:{value:F}})=>{c(F)},onBlur:E}))))},O_=e=>{const{identity:n,titleId:t,activeView:i,onUpdateProfile:r,onResetStorage:a,onJoinNewIdentity:o,IdentityActionChooser:s=$z,InvitationManager:f=A_,connectionState:d,onChangeConnectionState:c,onDone:u,...h}=e,{t:p}=vn("os"),g=l.useMemo(()=>{switch(i){case"device invitation manager":return p("choose add device label");default:return p("identity heading")}},[i,p]),b=()=>{var w;return(w=h.send)==null?void 0:w.call(h,"unchooseAction")};return l.createElement(po,{density:"fine"},l.createElement(Vz,{identity:n,titleId:t,title:g,onDone:u,onUpdateProfile:r,connectionState:d,onChangeConnectionState:c}),l.createElement(bn.Root,{activeView:i},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"identity action chooser",classNames:pl},l.createElement(s,{active:i==="identity action chooser",...h})),l.createElement(bn.View,{id:"device invitation manager",classNames:pl},l.createElement(f,{active:i==="device invitation manager",...h,invitationUrl:h.createInvitationUrl(h.invitationCode)})),l.createElement(bn.View,{classNames:pl,id:"confirm join new identity"},l.createElement(Eh,{active:i==="confirm join new identity",...h,mode:"join new identity",onConfirm:o,onCancel:b})),l.createElement(bn.View,{classNames:pl,id:"confirm reset storage"},l.createElement(Eh,{active:i==="confirm reset storage",...h,mode:"reset storage",onConfirm:a,onCancel:b})))))},qz=({invitation:e,...n})=>{const t=Vu(e);return l.createElement(O_,{...n,...t})},Gz=({titleId:e,createInvitationUrl:n=r=>r,initialDisposition:t="default",...i})=>{const r=$n("identityPanel__heading",e),a=Re.useClient(),o=vt.useDevices(),s=vt.useIdentity(),f=vt.useHaloInvitations(),d=Az({identity:s,invitations:f});if(!s)return Ge.error("IdentityPanel rendered with no active identity."),null;const[c,u,h]=Cz(a,{context:{initialDisposition:t}}),{swarm:p}=Xo.useNetworkStatus(),g=async k=>a==null?void 0:a.mesh.updateConfig(k);l.useEffect(()=>h.subscribe(E=>{Ge("[state]",E)}).unsubscribe,[h]);const b=l.useMemo(()=>{switch(!0){case c.matches("choosingAction"):return"identity action chooser";case c.matches("managingDeviceInvitation"):return"device invitation manager";case c.matches("confirmingResetStorage"):return"confirm reset storage";case c.matches("confirmingJoinNewIdentity"):return"confirm join new identity";default:return"identity action chooser"}},[c]),_={...i,identity:s,devices:o,activeView:b,send:u,titleId:r,createInvitationUrl:n,onUpdateProfile:async k=>{u({type:"updateProfile"}),await a.halo.updateProfile(k)},connectionState:p,onChangeConnectionState:g,...d};return c.context.invitation?l.createElement(qz,{..._,invitation:c.context.invitation}):l.createElement(O_,{..._})},Kz=l.forwardRef(({mode:e,titleId:n,onExit:t,exitActionParent:i},r)=>{const{t:a}=vn("os"),o=l.createElement(jn,{variant:"ghost",...t&&{onClick:t},classNames:le(In,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},l.createElement(qe.X,{weight:"bold",className:He(4)}),l.createElement("span",{className:"sr-only"},a("exit label")));return l.createElement(Gu,{ref:r,titleId:n,title:a(e==="halo-only"?"selecting identity heading":"joining space heading"),...e==="halo-only"?{titleSrOnly:!0}:{corner:i?l.cloneElement(i,{},o):o},titleSrOnly:e==="halo-only"})}),P_=(e,n)=>(Ge("[subscribing to invitation]",n),{subscribe:(t,i,r)=>n.subscribe(a=>{switch(a.state){case Se.State.CONNECTING:return Ge("[invitation connecting]",{Kind:e,invitation:a}),t({type:`connecting${e}Invitation`,invitation:a});case Se.State.CONNECTED:return Ge("[invitation connected]",{Kind:e,invitation:a}),t({type:`connected${e}Invitation`,invitation:a});case Se.State.READY_FOR_AUTHENTICATION:return Ge("[invitation ready for authentication]",{Kind:e,invitation:a}),t({type:`readyForAuthentication${e}Invitation`,invitation:a});case Se.State.AUTHENTICATING:return Ge("[invitation authenticating]",{Kind:e,invitation:a}),t({type:`authenticating${e}Invitation`,invitation:a});case Se.State.SUCCESS:return Ge("[invitation success]",{Kind:e,invitation:a}),t({type:`success${e}Invitation`,invitation:a}),r==null?void 0:r();case Se.State.CANCELLED:return Ge.warn("[invitation cancelled]",{Kind:e}),t({type:`fail${e}Invitation`,reason:"cancelled"});case Se.State.TIMEOUT:return Ge.error("[invitation timeout]",{Kind:e}),t({type:`fail${e}Invitation`,reason:"timeout"})}},a=>a instanceof Re.AlreadyJoinedError?(Ge("[already joined]",{Kind:e,error:a}),t({type:`success${e}Invitation`,invitation:n.get()}),r==null?void 0:r()):(Ge.error("[invitation errored]",{Kind:e,error:a}),t({type:`fail${e}Invitation`,reason:"error"}),i==null?void 0:i(a)))}),I_=(e,n)=>({initial:`unknown${e}`,states:{[`unknown${e}`]:{always:[{cond:({mode:i})=>i==="halo-only"&&e==="Space",target:"#join.finishingJoiningHalo"},{cond:i=>!!i[e.toLowerCase()].unredeemedCode,target:`acceptingRedeemed${e}Invitation`,actions:[`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]},{target:`inputting${e}InvitationCode`,actions:"log"}]},[`inputting${e}InvitationCode`]:{},[`acceptingRedeemed${e}Invitation`]:{invoke:{src:i=>i[e.toLowerCase()].invitationSubscribable},initial:`unknown${e}Invitation`,states:{[`unknown${e}Invitation`]:{always:[{cond:i=>{var r,a;if(e!=="Space")return!1;{const o=(a=(r=i.space.invitation)==null?void 0:r.spaceKey)==null?void 0:a.toHex(),s=i.space.succeededKeys;return o?!!(s!=null&&s.has(o)):!1}},target:n,actions:"log"},{cond:i=>{const r=i[e.toLowerCase()].invitation;return!r||(r==null?void 0:r.state)===Se.State.CONNECTING},target:`connecting${e}Invitation`,actions:"log"},{target:`inputting${e}VerificationCode`,actions:"log"}]},[`connecting${e}Invitation`]:{},[`inputting${e}VerificationCode`]:{},[`authenticating${e}VerificationCode`]:{on:{[`readyForAuthentication${e}Invitation`]:{target:`authenticationFailing${e}VerificationCode`,actions:["setInvitation","log"]}}},[`authenticationFailing${e}VerificationCode`]:{},[`failing${e}Invitation`]:{},[`success${e}Invitation`]:{}},on:{[`reset${e}Invitation`]:{target:`#join${e==="Halo"?".choosingIdentity":""}.accepting${e}Invitation.unknown${e}`,actions:["resetInvitation","log"]},[`connecting${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`connected${e}Invitation`]:{target:`.connecting${e}Invitation`,actions:["setInvitation","log"]},[`readyForAuthentication${e}Invitation`]:{target:`.inputting${e}VerificationCode`,actions:["setInvitation","log"]},[`authenticating${e}Invitation`]:{target:`.authenticating${e}VerificationCode`,actions:["setInvitation","log"]},[`success${e}Invitation`]:{target:n,actions:["setInvitation","log"]},[`fail${e}Invitation`]:{target:`.failing${e}Invitation`,actions:[ft({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],failReason:r.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[ft({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],unredeemedCode:r.code,succeededKeys:r.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),Yz=wh({id:"join",predictableActionArguments:!0,context:{initialDisposition:"default",mode:"default",identity:null,halo:{},space:{}},initial:"unknown",states:{unknown:{always:[{cond:"existingIdentity",target:"resettingIdentity",actions:"log"},{cond:"initiallyAcceptingHaloInvitation",target:"#join.choosingIdentity.acceptingHaloInvitation",actions:"log"},{cond:"noSelectedIdentity",target:"choosingIdentity",actions:"log"},{target:"acceptingSpaceInvitation",actions:"log"}]},choosingIdentity:{initial:"unknownAuthMethod",states:{unknownAuthMethod:{always:[{cond:"hasHaloUnredeemedCode",target:"acceptingHaloInvitation",actions:"log"},{target:"choosingAuthMethod",actions:"log"}]},choosingAuthMethod:{},recoveringIdentity:{},creatingIdentity:{},acceptingHaloInvitation:I_("Halo","#join.acceptingSpaceInvitation"),confirmingAddedIdentity:{}},on:{recoverIdentity:{target:".recoveringIdentity",actions:"log"},createIdentity:{target:".creatingIdentity",actions:"log"},acceptHaloInvitation:{target:".acceptingHaloInvitation",actions:"log"},addIdentity:{target:".confirmingAddedIdentity",actions:"log"},selectIdentity:{target:"acceptingSpaceInvitation",actions:["setIdentity","log"]},deselectAuthMethod:{target:".choosingAuthMethod",actions:"log"}}},resettingIdentity:{},acceptingSpaceInvitation:I_("Space","#join.finishingJoiningSpace"),finishingJoiningSpace:{type:"final"},finishingJoiningHalo:{type:"final"}},on:{resetIdentity:{target:"choosingIdentity",actions:"unsetIdentity"}}},{guards:{existingIdentity:({identity:e,mode:n},t)=>n==="halo-only"&&!!e,noSelectedIdentity:({identity:e},n)=>!e,initiallyAcceptingHaloInvitation:({identity:e,initialDisposition:n},t)=>!e&&n==="accept-halo-invitation",hasHaloUnredeemedCode:({halo:e},n)=>!!e.unredeemedCode,noSpaceInvitation:({space:e},n)=>!e.invitation&&!e.unredeemedCode},actions:{setIdentity:ft({identity:(e,n)=>n.identity}),unsetIdentity:ft({identity:()=>null}),resetInvitation:ft({halo:(e,n)=>n.type!=="resetHaloInvitation"?e.halo:(e.halo.invitationObservable&&e.halo.invitationObservable.cancel(),{...e.halo,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0}),space:(e,n)=>n.type!=="resetSpaceInvitation"?e.space:(e.space.invitationObservable&&e.space.invitationObservable.cancel(),{...e.space,invitation:void 0,invitationObservable:void 0,invitationSubscribable:void 0})}),setInvitation:ft({halo:(e,n)=>n.type.includes("Halo")?{...e.halo,invitation:n.invitation}:e.halo,space:(e,n)=>n.type.includes("Space")?{...e.space,invitation:n.invitation}:e.space}),log:(e,n)=>{Ge("[transition]",{event:n,haloInvitation:e.halo.invitation,spaceInvitation:e.space.invitation})}}}),F_=(e,n)=>{try{const t=new URLSearchParams(n.substring(n.lastIndexOf("?")));return t.get(`${e}InvitationCode`)??t.get(`${e}Invitation`)??t.get("invitationCode")??t.get("invitation")??n}catch(t){return Ge.catch(t),n}},Jz=(e,n)=>{const t=l.useCallback(({halo:o})=>{if(o.unredeemedCode)try{const s=xi.InvitationEncoder.decode(F_("halo",o.unredeemedCode)),f=e.halo.join(s);return{...o,invitationObservable:f,invitationSubscribable:P_("Halo",f)}}catch(s){return Ge.error("Could not redeem device invitation code",s),o}else return o},[e]),i=l.useCallback(({space:o})=>{if(o.unredeemedCode)try{const s=xi.InvitationEncoder.decode(F_("space",o.unredeemedCode)),f=e.spaces.join(s);return{...o,invitationObservable:f,invitationSubscribable:P_("Space",f)}}catch(s){return Ge.error("Could not redeem space invitation code",s),o}else return o},[e]),r=l.useCallback(({halo:o})=>{var s;return o.unredeemedCode?((s=n==null?void 0:n.onInvalidateInvitationCode)==null||s.call(n,o.unredeemedCode),{...o,unredeemedCode:void 0}):o},[n==null?void 0:n.onInvalidateInvitationCode]),a=l.useCallback(({space:o})=>{var s;return o.unredeemedCode?((s=n==null?void 0:n.onInvalidateInvitationCode)==null||s.call(n,o.unredeemedCode),{...o,unredeemedCode:void 0}):o},[n==null?void 0:n.onInvalidateInvitationCode]);return _h(Yz,{...n,actions:{...n==null?void 0:n.actions,redeemHaloInvitationCode:ft({halo:t}),redeemSpaceInvitationCode:ft({space:i}),invalidateHaloInvitationCode:ft({halo:r}),invalidateSpaceInvitationCode:ft({space:a})}})},Xz=e=>{const n=!e.active,{send:t}=e,{t:i}=vn("os"),r={disabled:n,after:l.createElement(qe.CaretRight,{className:He(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return l.createElement(l.Fragment,null,l.createElement(gi,null,i("addition method chooser title")),l.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},l.createElement(uu,{...r,description:i("create identity description"),before:l.createElement(qe.Plus,{className:He(6)}),onClick:()=>t({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},i("create identity label")),l.createElement(uu,{...r,description:i("join identity description"),before:l.createElement(qe.QrCode,{className:He(6)}),onClick:()=>t({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},i("join identity label")),l.createElement(uu,{...r,disabled:!0,description:i("recover identity description"),before:l.createElement(qe.Textbox,{className:He(6)}),onClick:()=>t({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},i("recover identity label"))))},Zz=e=>{var g,b,w,_,k,E;const{mode:n,addedIdentity:t,active:i,send:r,onDone:a,doneActionParent:o}=e,s=!i,{t:f}=vn("os"),d=(t==null?void 0:t.identityKey.toHex())??"0",c=bg(d),u=$n("identityListItem__label"),h=((g=t==null?void 0:t.profile)==null?void 0:g.displayName)??(t&&Nf(d)),p=l.createElement(Vn,{...a&&{onClick:()=>a(null)},disabled:s,"data-autofocus":"confirmingAddedIdentity","data-testid":"identity-added-done"},l.createElement("span",null,f("done label")));return l.createElement(l.Fragment,null,l.createElement(gi,null,f("identity added label")),l.createElement("div",{role:"none",className:"grow flex flex-col items-center justify-center text-center gap-2"},l.createElement(wn.Root,{status:"active",labelId:u,hue:((w=(b=t==null?void 0:t.profile)==null?void 0:b.data)==null?void 0:w.hue)||c.hue},l.createElement(wn.Frame,null,l.createElement(wn.Fallback,{text:((k=(_=t==null?void 0:t.profile)==null?void 0:_.data)==null?void 0:k.emoji)||c.emoji})),l.createElement(wn.Label,{classNames:le("text-lg truncate",!((E=t==null?void 0:t.profile)!=null&&E.displayName)&&"font-mono")},h))),l.createElement(jt,null,n==="halo-only"?o?l.cloneElement(o,{},p):p:l.createElement(Vn,{variant:"primary",disabled:s||!t,onClick:()=>t&&r({type:"selectIdentity",identity:t}),"data-autofocus":"confirmingAddedIdentity"},f("continue label"))))},Qz=e=>{const{send:n,method:t}=e,i=t==="recover identity",r=Re.useClient(),{t:a}=vn("os"),[o,s]=l.useState(""),f=d=>{r.halo.createIdentity({[i?"seedphrase":"displayName"]:d}).then(c=>{n==null||n({type:"selectIdentity",identity:c})},c=>{Ge.catch(c),s(a(i?"failed to recover identity message":"failed to create identity message"))})};return l.createElement(eU,{...e,onDisplayNameConfirm:f,validationMessage:o})},eU=e=>{const{method:n,send:t,active:i,onDisplayNameConfirm:r,validationMessage:a}=e,o=!i,{t:s}=vn("os"),[f,d]=l.useState(""),c=n==="recover identity";return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(Ku,{validationMessage:a,label:l.createElement(gi,null,s(c?"recover identity input label":"new identity input label")),disabled:o,"data-testid":"identity-input",placeholder:c?"Type your recovery phrase":"Type a display name",onChange:({target:{value:u}})=>d(u)})),l.createElement(jt,null,l.createElement(Vn,{variant:"ghost",disabled:o,onClick:()=>t==null?void 0:t({type:"deselectAuthMethod"}),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-back`},s("back label")),l.createElement(Vn,{variant:"primary",disabled:o,onClick:()=>r==null?void 0:r(f),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},M_=e=>{const{active:n,Kind:t,doneActionParent:i,onDone:r}=e,a=!n,{t:o}=vn("os"),s=l.createElement(Vn,{variant:"primary",onClick:r,disabled:a,"data-autofocus":`success${t}Invitation finishingJoining${t}`,"data-testid":`${t.toLowerCase()}-invitation-accepted-done`},o("done label"));return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement("p",{className:"text-center text-sm font-normal"},o("welcome message"))),l.createElement(jt,null,i?l.cloneElement(i,{},s):s))},nU=e=>{try{const n=new URLSearchParams(e.substring(e.lastIndexOf("?")));return n.get("spaceInvitationCode")??n.get("deviceInvitationCode")??e}catch(n){return Ge.catch(n),e}},N_=e=>{const{Kind:n,active:t,send:i,unredeemedCode:r,onExit:a,exitActionParent:o,onDone:s,doneActionParent:f,succeededKeys:d}=e,c=!t,{t:u}=vn("os"),[h,p]=l.useState(r??"");l.useEffect(()=>{r&&p(r??"")},[r]);const g=()=>{h.trim().length!==0&&i({type:`set${n}InvitationCode`,code:nU(h),...n==="Space"&&{succeededKeys:d}})},b=l.createElement(Vn,{variant:"ghost",disabled:c,...a?{onClick:()=>a()}:{onClick:()=>s==null?void 0:s(null)},"data-testid":"join-exit"},u("cancel label"));return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(Ku,{label:l.createElement(gi,null,u("invitation input label")),placeholder:"Type an invitation code",disabled:c,value:h,onChange:({target:{value:w}})=>p(w),"data-autofocus":`inputting${n}InvitationCode`,"data-testid":`${n.toLowerCase()}-invitation-input`,onKeyUp:({key:w})=>w==="Enter"&&g()})),l.createElement(jt,null,n==="Halo"?l.createElement(Vn,{variant:"ghost",disabled:c,onClick:()=>i({type:"deselectAuthMethod"}),"data-testid":`${n.toLowerCase()}-invitation-input-back`},u("back label")):o?l.cloneElement(o,{},b):f?l.cloneElement(f,{},b):b,l.createElement(Vn,{variant:"primary",disabled:c,onClick:g,"data-testid":`${n.toLowerCase()}-invitation-input-continue`},u("continue label"))))},tU=({invitationState:e,onInvitationCancel:n,active:t,send:i,Kind:r,failReason:a})=>{const{t:o}=vn("os");return a?l.createElement(l.Fragment,null,l.createElement(gi,{className:In},o(a==="timeout"?"timeout status label":a==="cancelled"?"cancelled status label":"error status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(jt,null,l.createElement(Vn,{disabled:!t,onClick:()=>i({type:`reset${r}Invitation`}),"data-testid":"invitation-rescuer-reset"},o("reset label")))):l.createElement(l.Fragment,null,l.createElement(gi,{className:In},o("connecting status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(jt,null,l.createElement(Vn,{disabled:!0,classNames:"order-2","data-testid":"next"},o("next label")),l.createElement(Vn,{disabled:!t,onClick:n,"data-testid":"invitation-rescuer-cancel"},o("cancel label"))))},D_=e=>{const{Kind:n,invitationState:t,active:i,send:r}=e,{t:a}=vn("os");return l.createElement(l.Fragment,null,typeof t>"u"?l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},l.createElement(gi,{className:In},"There was a problem joining the space")),l.createElement(jt,null,l.createElement(Vn,{disabled:!i,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>r({type:`reset${n}Invitation`})},a("reset label")))):l.createElement(tU,{...e}))},L_=6,B_=({failed:e,Kind:n,active:t,pending:i,invitationId:r,onInvitationAuthenticate:a,onInvitationCancel:o})=>{const s=!t||i,{t:f}=vn("os"),d=n.toLowerCase(),[c,u]=l.useState(""),h=({target:{value:p}})=>{var g;u(p),p.length===L_&&((g=document.querySelector(`[data-autofocus-pinlength="${d}"]`))==null||g.focus())};return l.createElement(l.Fragment,null,l.createElement("div",{role:"none",className:"grow flex flex-col justify-center"},r&&l.createElement(qu,{text:io(r)}),l.createElement(bt.Root,{...e&&{validationValence:"error"}},l.createElement(bt.Label,{asChild:!0},l.createElement(gi,null,f("auth code input label"))),l.createElement(bt.PinInput,{disabled:s,length:L_,onChange:h,inputMode:"numeric",autoComplete:"off",pattern:"\\d*","data-autofocus":`connecting${n}Invitation inputting${n}VerificationCode authenticationFailing${n}VerificationCode authenticating${n}VerificationCode`,"data-prevent-ios-autofocus":!0,"data-testid":`${d}-auth-code-input`,"data-1p-ignore":!0}),e&&l.createElement(bt.DescriptionAndValidation,{classNames:"text-center"},l.createElement(bt.Validation,null,f("failed to authenticate message"))))),l.createElement(jt,null,l.createElement(Vn,{variant:"ghost",disabled:s,onClick:()=>o==null?void 0:o(),"data-testid":`${d}-invitation-authenticator-cancel`},f("cancel label")),l.createElement(Vn,{variant:"primary",disabled:s,onClick:()=>a==null?void 0:a(c),"data-autofocus-pinlength":d,"data-testid":`${d}-invitation-authenticator-next`},f("next label"))))},lt="pbs-1 pbe-3 pli-3",iU=e=>{const{titleId:n,send:t,activeView:i,failed:r,mode:a,unredeemedCodes:o,invitationStates:s,succeededKeys:f,failReasons:d,onExit:c,onHaloDone:u,onSpaceDone:h,exitActionParent:p,doneActionParent:g,onHaloInvitationCancel:b,onSpaceInvitationCancel:w,onHaloInvitationAuthenticate:_,onSpaceInvitationAuthenticate:k,onCancelResetStorage:E,onConfirmResetStorage:S,IdentityInput:T=Qz,ConfirmReset:O=Eh}=e;return l.createElement(po,{density:"fine"},a!=="halo-only"&&l.createElement(Kz,{titleId:n,mode:a,onExit:c,exitActionParent:p}),l.createElement(bn.Root,{focusManaged:!0,activeView:i},l.createElement(bn.Views,null,l.createElement(bn.View,{classNames:lt,id:"addition method chooser"},l.createElement(Xz,{send:t,active:i==="addition method chooser"})),l.createElement(bn.View,{classNames:lt,id:"reset storage confirmation"},l.createElement(O,{send:t,active:i==="reset storage confirmation",onCancel:E,onConfirm:S})),l.createElement(bn.View,{classNames:lt,id:"create identity input"},l.createElement(T,{send:t,method:"create identity",active:i==="create identity input"})),l.createElement(bn.View,{classNames:lt,id:"recover identity input"},l.createElement(T,{send:t,method:"recover identity",active:i==="recover identity input"})),l.createElement(bn.View,{classNames:lt,id:"halo invitation input"},l.createElement(N_,{send:t,Kind:"Halo",active:i==="halo invitation input",...(o==null?void 0:o.Halo)&&{unredeemedCode:o.Halo},...(f==null?void 0:f.Halo)&&{succeededKeys:f.Halo}})),l.createElement(bn.View,{classNames:lt,id:"halo invitation rescuer"},l.createElement(D_,{send:t,Kind:"Halo",active:i==="halo invitation rescuer",invitationState:s==null?void 0:s.Halo,onInvitationCancel:b,failReason:d==null?void 0:d.Halo})),l.createElement(bn.View,{classNames:lt,id:"halo invitation authenticator"},l.createElement(B_,{send:t,Kind:"Halo",active:i==="halo invitation authenticator",onInvitationCancel:b,onInvitationAuthenticate:_,...r.has("Halo")&&{failed:!0}})),l.createElement(bn.View,{classNames:lt,id:"halo invitation accepted"},l.createElement(M_,{send:t,Kind:"Halo",active:i==="halo invitation accepted",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:lt,id:"identity added"},l.createElement(Zz,{send:t,mode:a,active:i==="identity added",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:lt,id:"space invitation input"},l.createElement(N_,{send:t,Kind:"Space",active:i==="space invitation input",...(o==null?void 0:o.Space)&&{unredeemedCode:o.Space},...(f==null?void 0:f.Space)&&{succeededKeys:f.Space},onExit:c,exitActionParent:p})),l.createElement(bn.View,{classNames:lt,id:"space invitation rescuer"},l.createElement(D_,{send:t,Kind:"Space",active:i==="space invitation rescuer",invitationState:s==null?void 0:s.Space,onInvitationCancel:w,failReason:d==null?void 0:d.Space})),l.createElement(bn.View,{classNames:lt,id:"space invitation authenticator"},l.createElement(B_,{send:t,Kind:"Space",active:i==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:k,...r.has("Space")&&{failed:!0}})),l.createElement(bn.View,{classNames:lt,id:"space invitation accepted"},l.createElement(M_,{send:t,Kind:"Space",active:i==="space invitation accepted",doneActionParent:g,onDone:h})))))},rU=({titleId:e,mode:n="default",initialDisposition:t="default",initialInvitationCode:i,exitActionParent:r,onExit:a,doneActionParent:o,onDone:s,onCancelResetStorage:f})=>{const d=Re.useClient(),c=vt.useIdentity(),{hasIosKeyboard:u}=Ae(),h=$n("joinPanel__heading",e),[p,g,b]=Jz(d,{context:{mode:n,initialDisposition:t,identity:c,...i&&{[n==="halo-only"?"halo":"space"]:{unredeemedCode:i}}}});l.useEffect(()=>b.subscribe(L=>{Ge("[state]",L)}).unsubscribe,[b]),l.useEffect(()=>{const B=p.configuration[0].id.split("."),L=B[B.length-1],N=L==="finishingJoining"?"successSpaceInvitation":L,X=document.querySelector(`[data-autofocus~="${N}"]`);X&&!(u&&X.hasAttribute("data-prevent-ios-autofocus"))&&X.focus()},[p.value,u]);const w=l.useMemo(()=>{switch(!0){case p.matches({choosingIdentity:"choosingAuthMethod"}):return"addition method chooser";case p.matches("resettingIdentity"):return"reset storage confirmation";case p.matches({choosingIdentity:"creatingIdentity"}):return"create identity input";case p.matches({choosingIdentity:"recoveringIdentity"}):return"recover identity input";case p.matches({choosingIdentity:{acceptingHaloInvitation:"inputtingHaloInvitationCode"}}):return"halo invitation input";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"connectingHaloInvitation"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"failingHaloInvitation"}}}].some(p.matches):return"halo invitation rescuer";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"inputtingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticatingHaloVerificationCode"}}},{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}].some(p.matches):return"halo invitation authenticator";case[{choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"successHaloInvitation"}}},"finishingJoiningHalo"].some(p.matches):return"halo invitation accepted";case p.matches({choosingIdentity:"confirmingAddedIdentity"}):return"identity added";case p.matches({acceptingSpaceInvitation:"inputtingSpaceInvitationCode"}):return"space invitation input";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"connectingSpaceInvitation"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"failingSpaceInvitation"}}].some(p.matches):return"space invitation rescuer";case[{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"inputtingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticatingSpaceVerificationCode"}},{acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}].some(p.matches):return"space invitation authenticator";case p.matches("finishingJoiningSpace"):return"space invitation accepted";default:return"never"}},[p]),_=l.useMemo(()=>{const B=new Set;switch(!0){case p.matches({choosingIdentity:{acceptingHaloInvitation:{acceptingRedeemedHaloInvitation:"authenticationFailingHaloVerificationCode"}}}):B.add("Halo");break;case p.matches({acceptingSpaceInvitation:{acceptingRedeemedSpaceInvitation:"authenticationFailingSpaceVerificationCode"}}):B.add("Space");break}return B},[p]),k=l.useMemo(()=>({Halo:p.context.halo.unredeemedCode,Space:p.context.space.unredeemedCode}),[p]),E=Re.useMulticastObservable(d.spaces),S=l.useMemo(()=>({Space:E?new Set(E.map(({key:B})=>B.toHex())):void 0}),[E]),T=l.useMemo(()=>{var B,L;return{Halo:(B=p.context.halo.invitationObservable)==null?void 0:B.get().state,Space:(L=p.context.space.invitationObservable)==null?void 0:L.get().state}},[p]),O=l.useMemo(()=>({Halo:p.context.halo.failReason,Space:p.context.space.failReason}),[p]),C=l.useCallback(()=>{var B,L,N,X;s==null||s({identityKey:((B=p.context.halo.invitation)==null?void 0:B.identityKey)??null,swarmKey:((L=p.context.halo.invitation)==null?void 0:L.swarmKey)??null,spaceKey:((N=p.context.halo.invitation)==null?void 0:N.spaceKey)??null,target:((X=p.context.halo.invitation)==null?void 0:X.target)??null})},[p,s]),P=l.useCallback(()=>{var B,L,N,X;s==null||s({identityKey:((B=p.context.space.invitation)==null?void 0:B.identityKey)??null,swarmKey:((L=p.context.space.invitation)==null?void 0:L.swarmKey)??null,spaceKey:((N=p.context.space.invitation)==null?void 0:N.spaceKey)??null,target:((X=p.context.space.invitation)==null?void 0:X.target)??null})},[p,s]),F=l.useCallback(()=>d.reset().then(()=>{g({type:"resetIdentity"})}),[d,g]);return l.createElement(iU,{titleId:h,mode:n,send:g,activeView:w,failed:_,failReasons:O,pending:["connecting","authenticating"].some(B=>p==null?void 0:p.configuration[0].id.includes(B)),unredeemedCodes:k,invitationStates:T,succeededKeys:S,identity:c,onExit:a,exitActionParent:r,doneActionParent:o,onHaloDone:C,onSpaceDone:P,onHaloInvitationCancel:()=>{var B;return(B=p.context.halo.invitationObservable)==null?void 0:B.cancel()},onSpaceInvitationCancel:()=>{var B;return(B=p.context.space.invitationObservable)==null?void 0:B.cancel()},onHaloInvitationAuthenticate:B=>{var L;return g({type:"authenticateHaloVerificationCode"}),(L=p.context.halo.invitationObservable)==null?void 0:L.authenticate(B)},onSpaceInvitationAuthenticate:B=>{var L;return g({type:"authenticateSpaceVerificationCode"}),(L=p.context.space.invitationObservable)==null?void 0:L.authenticate(B)},onConfirmResetStorage:F,onCancelResetStorage:f})},aU=wh({id:"space",predictableActionArguments:!0,context:{space:null},initial:"managingSpace",states:{managingSpace:{},managingSpaceInvitation:{}},on:{deselectInvitation:{target:".managingSpace",actions:["unsetInvitation","log"]},selectInvitation:{target:".managingSpaceInvitation",actions:["setInvitation","log"]}}},{actions:{setInvitation:ft({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:ft({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),oU=e=>_h(aU,{...e,context:{...e==null?void 0:e.context}}),j_="dxos:react-shell/space-manager/active-action",sU=e=>{const{space:n,target:t}=e,{t:i}=vn("os"),r=Re.useConfig(),a=Jo.useSpaceInvitations(n==null?void 0:n.key),o=l.useCallback(f=>{const d=xi.InvitationEncoder.encode(f);f.state===Se.State.CONNECTING&&Ge.info(JSON.stringify({invitationCode:d,authCode:f.authCode}))},[]),s={inviteOne:{label:i("invite one label"),description:i("invite one description"),icon:qe.UserPlus,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.INTERACTIVE,authMethod:Se.AuthMethod.SHARED_SECRET,multiUse:!1,target:t});f&&((h=(u=(c=r.values.runtime)==null?void 0:c.app)==null?void 0:u.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&f.subscribe(o)},[n])},inviteMany:{label:i("invite many label"),description:i("invite many description"),icon:qe.UsersThree,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.INTERACTIVE,authMethod:Se.AuthMethod.NONE,multiUse:!0,target:t});f&&((h=(u=(c=r.values.runtime)==null?void 0:c.app)==null?void 0:u.env)==null?void 0:h.DX_ENVIRONMENT)!=="production"&&f.subscribe(o)},[n])}};return l.createElement(fU,{...e,invitations:a,inviteActions:s})},R_="pis-3 pie-1 plb-1 mbe-1 font-medium",fU=e=>{const{active:n,space:t,createInvitationUrl:i,send:r,inviteActions:a,invitations:o,showInactiveInvitations:s,SpaceMemberList:f=GL,InvitationList:d=wj}=e,{t:c}=vn("os"),u=a??{noopInvite:{label:c("create space invitation label"),description:"",icon:qe.Placeholder,onClick:()=>{}}},[h,p]=l.useState(localStorage.getItem(j_)??"inviteOne"),g=w=>{p(w),localStorage.setItem(j_,w)},b=s?o:o==null?void 0:o.filter(w=>![Se.State.CANCELLED].includes(w.get().state));return l.createElement(l.Fragment,null,l.createElement(sf.Root,{classNames:"grow shrink basis-28 -mli-2"},l.createElement(sf.Viewport,{classNames:"is-full pie-2"},!!(b!=null&&b.length)&&l.createElement(l.Fragment,null,l.createElement("h3",{className:le(R_,In)},c("invitation list heading")),l.createElement(d,{className:"mb-2",send:r,invitations:b??[],onClickRemove:w=>w.cancel(),createInvitationUrl:i}),l.createElement("h3",{className:le(R_,In,"mbs-2")},c("space member list heading"))),l.createElement(f,{spaceKey:t.key,includeSelf:!0})),l.createElement(sf.Scrollbar,{orientation:"vertical"},l.createElement(sf.Thumb,null))),l.createElement(jt,null,l.createElement(kj,{disabled:!n,actions:u,activeAction:h,onChangeActiveAction:g,"data-testid":"spaces-panel.create-invitation"})))},lU=({titleId:e,space:n,onDone:t})=>{const{t:i}=vn("os"),r=n.properties.name;return l.createElement(Gu,{titleId:e,title:i("space panel heading"),corner:l.createElement(C2,{"data-testid":"identity-panel-done",onDone:t})},l.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},l.createElement(qe.Planet,{size:32,weight:"light"}),l.createElement("div",{className:"block text-start font-light text-xl"},r??n.key.truncate())))},z_=e=>{const{titleId:n,activeView:t,space:i,target:r,SpaceManager:a=sU,InvitationManager:o=A_,...s}=e;return l.createElement(po,{density:"fine"},l.createElement(lU,{...s,titleId:n,space:i}),l.createElement(bn.Root,{activeView:t},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"space manager",classNames:lt},l.createElement(a,{active:t==="space manager",space:i,target:r,...s})),l.createElement(bn.View,{id:"space invitation manager",classNames:lt},l.createElement(o,{active:t==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},dU=({invitation:e,...n})=>{const t=Vu(e);return l.createElement(z_,{...n,...t,invitationUrl:n.createInvitationUrl(t.invitationCode)})},cU=({titleId:e,createInvitationUrl:n=i=>i,...t})=>{const i=$n("spacePanel__heading",e),[r,a,o]=oU({context:{space:t.space}});l.useEffect(()=>o.subscribe(c=>{Ge("[state]",c)}).unsubscribe,[o]);const s=l.useMemo(()=>{switch(!0){case r.matches("managingSpace"):return"space manager";case r.matches("managingSpaceInvitation"):return"space invitation manager";default:return"never"}},[r]),f={...t,activeView:s,send:a,titleId:i,createInvitationUrl:n};return r.context.invitation?l.createElement(dU,{...f,invitation:r.context.invitation}):l.createElement(z_,{...f})},uU=({titleId:e})=>{const{t:n}=vn("os");return l.createElement("div",{className:"grid place-items-center p-2 gap-2"},l.createElement("p",{id:e,className:"font-medium text-center"},n("resetting message")),l.createElement(OO,{indeterminate:!0},n("resetting message")))},hU=e=>{const n=$n("identityDialog__title",e.title);return l.createElement(st.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(st.Portal,null,l.createElement(st.Overlay,null,l.createElement(st.Content,{"aria-labelledby":n,onOpenAutoFocus:t=>t.preventDefault()},l.createElement(cu,null,l.createElement(Gz,{...e,titleId:n,doneActionParent:l.createElement(st.Close,{asChild:!0})}))))))},U_=e=>{const n=$n("joinDialog__title"),{height:t}=pA();return l.createElement(Zt.Root,{defaultOpen:!0,onOpenChange:i=>{var r;return i||(e.onExit?e.onExit():(r=e.onDone)==null?void 0:r.call(e,null))}},l.createElement(Zt.Portal,null,l.createElement(Zt.Overlay,{classNames:"backdrop-blur",...t&&{style:{blockSize:`${t}px`}}},l.createElement(Zt.Content,{"aria-labelledby":n},l.createElement(rU,{...e,titleId:n,exitActionParent:l.createElement(Zt.Cancel,{asChild:!0}),doneActionParent:l.createElement(Zt.Action,{asChild:!0})})))))};var ml,gl=ki;if(process.env.NODE_ENV==="production")ml=gl.createRoot,gl.hydrateRoot;else{var W_=gl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ml=function(e,n){W_.usingClientEntryPoint=!0;try{return gl.createRoot(e,n)}finally{W_.usingClientEntryPoint=!1}}}var Sh={exports:{}};(function(e,n){(function(t,i){var r="1.0.35",a="",o="?",s="function",f="undefined",d="object",c="string",u="major",h="model",p="name",g="type",b="vendor",w="version",_="architecture",k="console",E="mobile",S="tablet",T="smarttv",O="wearable",C="embedded",P=350,F="Amazon",B="Apple",L="ASUS",N="BlackBerry",X="Browser",Y="Chrome",ee="Edge",re="Firefox",fe="Google",ce="Huawei",oe="LG",ye="Microsoft",se="Motorola",G="Opera",J="Samsung",ie="Sharp",me="Sony",H="Xiaomi",K="Zebra",j="Facebook",W="Chromium OS",V="Mac OS",I=function(Ee,We){var y={};for(var v in Ee)We[v]&&We[v].length%2===0?y[v]=We[v].concat(Ee[v]):y[v]=Ee[v];return y},M=function(Ee){for(var We={},y=0;y<Ee.length;y++)We[Ee[y].toUpperCase()]=Ee[y];return We},Z=function(Ee,We){return typeof Ee===c?te(We).indexOf(te(Ee))!==-1:!1},te=function(Ee){return Ee.toLowerCase()},he=function(Ee){return typeof Ee===c?Ee.replace(/[^\d\.]/g,a).split(".")[0]:i},ge=function(Ee,We){if(typeof Ee===c)return Ee=Ee.replace(/^\s\s*/,a),typeof We===f?Ee:Ee.substring(0,P)},ke=function(Ee,We){for(var y=0,v,m,x,A,D,U;y<We.length&&!D;){var be=We[y],Me=We[y+1];for(v=m=0;v<be.length&&!D&&be[v];)if(D=be[v++].exec(Ee),D)for(x=0;x<Me.length;x++)U=D[++m],A=Me[x],typeof A===d&&A.length>0?A.length===2?typeof A[1]==s?this[A[0]]=A[1].call(this,U):this[A[0]]=A[1]:A.length===3?typeof A[1]===s&&!(A[1].exec&&A[1].test)?this[A[0]]=U?A[1].call(this,U,A[2]):i:this[A[0]]=U?U.replace(A[1],A[2]):i:A.length===4&&(this[A[0]]=U?A[3].call(this,U.replace(A[1],A[2])):i):this[A]=U||i;y+=2}},xe=function(Ee,We){for(var y in We)if(typeof We[y]===d&&We[y].length>0){for(var v=0;v<We[y].length;v++)if(Z(We[y][v],Ee))return y===o?i:y}else if(Z(We[y],Ee))return y===o?i:y;return Ee},ae={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},Ue={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},an={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[w,[p,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[w,[p,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[p,w],[/opios[\/ ]+([\w\.]+)/i],[w,[p,G+" Mini"]],[/\bopr\/([\w\.]+)/i],[w,[p,G]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[p,w],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[w,[p,"UC"+X]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[w,[p,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[w,[p,"WeChat"]],[/konqueror\/([\w\.]+)/i],[w,[p,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[w,[p,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[w,[p,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[p,/(.+)/,"$1 Secure "+X],w],[/\bfocus\/([\w\.]+)/i],[w,[p,re+" Focus"]],[/\bopt\/([\w\.]+)/i],[w,[p,G+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[w,[p,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[w,[p,"Dolphin"]],[/coast\/([\w\.]+)/i],[w,[p,G+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[w,[p,"MIUI "+X]],[/fxios\/([-\w\.]+)/i],[w,[p,re]],[/\bqihu|(qi?ho?o?|360)browser/i],[[p,"360 "+X]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[p,/(.+)/,"$1 "+X],w],[/(comodo_dragon)\/([\w\.]+)/i],[[p,/_/g," "],w],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[p,w],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[p],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[p,j],w],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[p,w],[/\bgsa\/([\w\.]+) .*safari\//i],[w,[p,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[w,[p,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[w,[p,Y+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[p,Y+" WebView"],w],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[w,[p,"Android "+X]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[p,w],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[w,[p,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[w,p],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[p,[w,xe,ae]],[/(webkit|khtml)\/([\w\.]+)/i],[p,w],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[p,"Netscape"],w],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[w,[p,re+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[p,w],[/(cobalt)\/([\w\.]+)/i],[p,[w,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[_,"amd64"]],[/(ia32(?=;))/i],[[_,te]],[/((?:i[346]|x)86)[;\)]/i],[[_,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[_,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[_,"armhf"]],[/windows (ce|mobile); ppc;/i],[[_,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[_,/ower/,a,te]],[/(sun4\w)[;\)]/i],[[_,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[_,te]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[h,[b,J],[g,S]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[h,[b,J],[g,E]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[h,[b,B],[g,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[h,[b,B],[g,S]],[/(macintosh);/i],[h,[b,B]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[h,[b,ie],[g,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[h,[b,ce],[g,S]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[h,[b,ce],[g,E]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[h,/_/g," "],[b,H],[g,E]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[h,/_/g," "],[b,H],[g,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[h,[b,"OPPO"],[g,E]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[h,[b,"Vivo"],[g,E]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[h,[b,"Realme"],[g,E]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[h,[b,se],[g,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[h,[b,se],[g,S]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[h,[b,oe],[g,S]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[h,[b,oe],[g,E]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[h,[b,"Lenovo"],[g,S]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[h,/_/g," "],[b,"Nokia"],[g,E]],[/(pixel c)\b/i],[h,[b,fe],[g,S]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[h,[b,fe],[g,E]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[h,[b,me],[g,E]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[h,"Xperia Tablet"],[b,me],[g,S]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[h,[b,"OnePlus"],[g,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[h,[b,F],[g,S]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[h,/(.+)/g,"Fire Phone $1"],[b,F],[g,E]],[/(playbook);[-\w\),; ]+(rim)/i],[h,b,[g,S]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[h,[b,N],[g,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[h,[b,L],[g,S]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[h,[b,L],[g,E]],[/(nexus 9)/i],[h,[b,"HTC"],[g,S]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[b,[h,/_/g," "],[g,E]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[h,[b,"Acer"],[g,S]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[h,[b,"Meizu"],[g,E]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[b,h,[g,E]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[b,h,[g,S]],[/(surface duo)/i],[h,[b,ye],[g,S]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[h,[b,"Fairphone"],[g,E]],[/(u304aa)/i],[h,[b,"AT&T"],[g,E]],[/\bsie-(\w*)/i],[h,[b,"Siemens"],[g,E]],[/\b(rct\w+) b/i],[h,[b,"RCA"],[g,S]],[/\b(venue[\d ]{2,7}) b/i],[h,[b,"Dell"],[g,S]],[/\b(q(?:mv|ta)\w+) b/i],[h,[b,"Verizon"],[g,S]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[h,[b,"Barnes & Noble"],[g,S]],[/\b(tm\d{3}\w+) b/i],[h,[b,"NuVision"],[g,S]],[/\b(k88) b/i],[h,[b,"ZTE"],[g,S]],[/\b(nx\d{3}j) b/i],[h,[b,"ZTE"],[g,E]],[/\b(gen\d{3}) b.+49h/i],[h,[b,"Swiss"],[g,E]],[/\b(zur\d{3}) b/i],[h,[b,"Swiss"],[g,S]],[/\b((zeki)?tb.*\b) b/i],[h,[b,"Zeki"],[g,S]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[b,"Dragon Touch"],h,[g,S]],[/\b(ns-?\w{0,9}) b/i],[h,[b,"Insignia"],[g,S]],[/\b((nxa|next)-?\w{0,9}) b/i],[h,[b,"NextBook"],[g,S]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[b,"Voice"],h,[g,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[b,"LvTel"],h,[g,E]],[/\b(ph-1) /i],[h,[b,"Essential"],[g,E]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[h,[b,"Envizen"],[g,S]],[/\b(trio[-\w\. ]+) b/i],[h,[b,"MachSpeed"],[g,S]],[/\btu_(1491) b/i],[h,[b,"Rotor"],[g,S]],[/(shield[\w ]+) b/i],[h,[b,"Nvidia"],[g,S]],[/(sprint) (\w+)/i],[b,h,[g,E]],[/(kin\.[onetw]{3})/i],[[h,/\./g," "],[b,ye],[g,E]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[h,[b,K],[g,S]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[h,[b,K],[g,E]],[/smart-tv.+(samsung)/i],[b,[g,T]],[/hbbtv.+maple;(\d+)/i],[[h,/^/,"SmartTV"],[b,J],[g,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[b,oe],[g,T]],[/(apple) ?tv/i],[b,[h,B+" TV"],[g,T]],[/crkey/i],[[h,Y+"cast"],[b,fe],[g,T]],[/droid.+aft(\w)( bui|\))/i],[h,[b,F],[g,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[h,[b,ie],[g,T]],[/(bravia[\w ]+)( bui|\))/i],[h,[b,me],[g,T]],[/(mitv-\w{5}) bui/i],[h,[b,H],[g,T]],[/Hbbtv.*(technisat) (.*);/i],[b,h,[g,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[b,ge],[h,ge],[g,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[g,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[b,h,[g,k]],[/droid.+; (shield) bui/i],[h,[b,"Nvidia"],[g,k]],[/(playstation [345portablevi]+)/i],[h,[b,me],[g,k]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[h,[b,ye],[g,k]],[/((pebble))app/i],[b,h,[g,O]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[h,[b,B],[g,O]],[/droid.+; (glass) \d/i],[h,[b,fe],[g,O]],[/droid.+; (wt63?0{2,3})\)/i],[h,[b,K],[g,O]],[/(quest( 2| pro)?)/i],[h,[b,j],[g,O]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[b,[g,C]],[/(aeobc)\b/i],[h,[b,F],[g,C]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[h,[g,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[h,[g,S]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,S]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,E]],[/(android[-\w\. ]{0,9});.+buil/i],[h,[b,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[w,[p,ee+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[w,[p,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[p,w],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[w,p]],os:[[/microsoft (windows) (vista|xp)/i],[p,w],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[p,[w,xe,Ue]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,"Windows"],[w,xe,Ue]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[w,/_/g,"."],[p,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[p,V],[w,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[w,p],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[p,w],[/\(bb(10);/i],[w,[p,N]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[w,[p,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[w,[p,re+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[w,[p,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[w,[p,"watchOS"]],[/crkey\/([\d\.]+)/i],[w,[p,Y+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[p,W],w],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[p,w],[/(sunos) ?([\w\.\d]*)/i],[[p,"Solaris"],w],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[p,w]]},Pe=function(Ee,We){if(typeof Ee===d&&(We=Ee,Ee=i),!(this instanceof Pe))return new Pe(Ee,We).getResult();var y=typeof t!==f&&t.navigator?t.navigator:i,v=Ee||(y&&y.userAgent?y.userAgent:a),m=y&&y.userAgentData?y.userAgentData:i,x=We?I(an,We):an,A=y&&y.userAgent==v;return this.getBrowser=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.browser),D[u]=he(D[w]),A&&y&&y.brave&&typeof y.brave.isBrave==s&&(D[p]="Brave"),D},this.getCPU=function(){var D={};return D[_]=i,ke.call(D,v,x.cpu),D},this.getDevice=function(){var D={};return D[b]=i,D[h]=i,D[g]=i,ke.call(D,v,x.device),A&&!D[g]&&m&&m.mobile&&(D[g]=E),A&&D[h]=="Macintosh"&&y&&typeof y.standalone!==f&&y.maxTouchPoints&&y.maxTouchPoints>2&&(D[h]="iPad",D[g]=S),D},this.getEngine=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.engine),D},this.getOS=function(){var D={};return D[p]=i,D[w]=i,ke.call(D,v,x.os),A&&!D[p]&&m&&m.platform!="Unknown"&&(D[p]=m.platform.replace(/chrome os/i,W).replace(/macos/i,V)),D},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return v},this.setUA=function(D){return v=typeof D===c&&D.length>P?ge(D,P):D,this},this.setUA(v),this};Pe.VERSION=r,Pe.BROWSER=M([p,w,u]),Pe.CPU=M([_]),Pe.DEVICE=M([h,b,g,k,E,T,S,O,C]),Pe.ENGINE=Pe.OS=M([p,w]),e.exports&&(n=e.exports=Pe),n.UAParser=Pe;var Ve=typeof t!==f&&(t.jQuery||t.Zepto);if(Ve&&!Ve.ua){var _n=new Pe;Ve.ua=_n.getResult(),Ve.ua.get=function(){return _n.getUA()},Ve.ua.set=function(Ee){_n.setUA(Ee);var We=_n.getResult();for(var y in We)Ve.ua[y]=We[y]}}})(typeof window=="object"?window:mn)})(Sh,Sh.exports);var vU=Sh.exports,bl="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",Ch,$h;if(typeof navigator<"u"){const e=new vU.UAParser(navigator.userAgent);Ch=e.getBrowser().name,$h=e.getOS().name}var pU=(e,n,t)=>{if(!e.contentWindow){Ge("IFrame content window missing",{origin:n},{F:bl,L:24,S:void 0,C:(i,r)=>i(...r)});return}Ch==="Chrome"&&$h==="iOS"?e.contentWindow.postMessage(t,n):e.contentWindow.postMessage(t,n,[t.payload])},mU=(e,n)=>{Ch==="Chrome"&&$h==="iOS"?window.parent.postMessage(n,e):window.parent.postMessage(n,e,[n.payload])},H_=({channel:e,iframe:n,origin:t,onOrigin:i})=>({send:async r=>{if(!t){Ge("no origin set",{channel:e},{F:bl,L:62,S:void 0,C:(s,f)=>s(...f)});return}Ge("sending",{channel:e,data:r.length},{F:bl,L:66,S:void 0,C:(s,f)=>s(...f)});const a=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),o={channel:e,payload:a};n?pU(n,t,o):mU(t,o)},subscribe:r=>{const a=o=>{if(!n&&o.source!==window.parent)return;if(n&&o.source!==n.contentWindow)return;const f=o.data&&typeof o.data=="object"&&"channel"in o.data&&"payload"in o.data?o.data:void 0;(f==null?void 0:f.channel)===e&&(t||(t=o.origin,i==null||i(t)),Ge("received",f,{F:bl,L:98,S:void 0,C:(d,c)=>d(...c)}),r(new Uint8Array(f.payload)))};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)}});const gU=e=>{const n=$n("spaceDialog__title");return l.createElement(st.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(st.Portal,null,l.createElement(st.Overlay,null,l.createElement(st.Content,{"aria-labelledby":n},l.createElement(cu,null,l.createElement(cU,{...e,titleId:n,doneActionParent:l.createElement(st.Close,{asChild:!0})}))))))},bU=()=>{const e=$n("statusDialog__title");return l.createElement(Zt.Root,{open:!0},l.createElement(Zt.Portal,null,l.createElement(Zt.Overlay,null,l.createElement(Zt.Content,{"aria-labelledby":e},l.createElement(uU,{titleId:e})))))},yU=({runtime:e,origin:n})=>{const[{layout:t,invitationCode:i,spaceKey:r,target:a},o]=l.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),s=Re.useClient(),f=Jo.useSpace(r);switch(l.useEffect(()=>e.layoutUpdate.on(d=>o(d)),[e]),l.useEffect(()=>{if(t===Re.ShellLayout.SPACE&&!f){Ge.warn("No space found for shell space invitations.");const d=setTimeout(async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})});return()=>clearTimeout(d)}},[e,t,f]),t){case Re.ShellLayout.STATUS:return l.createElement(bU,null);case Re.ShellLayout.INITIALIZE_IDENTITY:case Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:return l.createElement(U_,{mode:"halo-only",initialDisposition:t===Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION?"accept-halo-invitation":"default",initialInvitationCode:i,onCancelResetStorage:()=>e.setLayout({layout:Re.ShellLayout.IDENTITY}),onDone:()=>{e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}});case Re.ShellLayout.IDENTITY:case Re.ShellLayout.SHARE_IDENTITY:case Re.ShellLayout.EDIT_PROFILE:return l.createElement(hU,{createInvitationUrl:d=>`${n}?deviceInvitationCode=${d}`,onResetStorage:async()=>(e.setLayout({layout:Re.ShellLayout.STATUS}),await s.reset(),e.setAppContext({display:Re.ShellDisplay.NONE,reload:!0})),onJoinNewIdentity:async()=>(e.setLayout({layout:Re.ShellLayout.STATUS}),await s.reset(),e.setLayout({layout:Re.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION})),onDone:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})},initialDisposition:t===Re.ShellLayout.SHARE_IDENTITY?"manage-device-invitation":"default"});case Re.ShellLayout.SPACE:return f?l.createElement(gU,{space:f,target:a,createInvitationUrl:d=>`${n}?spaceInvitationCode=${d}`,onDone:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}}):null;case Re.ShellLayout.JOIN_SPACE:return l.createElement(U_,{initialInvitationCode:i,onDone:async d=>{const c=(d==null?void 0:d.target)??void 0;await e.setAppContext({display:Re.ShellDisplay.NONE,spaceKey:(d==null?void 0:d.spaceKey)??void 0,target:c}),e.setLayout({layout:Re.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:Re.ShellDisplay.NONE}),e.setLayout({layout:Re.ShellLayout.DEFAULT})}});default:return null}},V_={"en-US":Object.freeze(Object.defineProperty({__proto__:null,os:{"manage profile label":"Manage identity","identity offline description":"Offline","sidebar label":"DXOS sidebar","copy invitation code label":"Copy URL","copy success label":"Copied","copy self public key label":"Copy public key","open share panel label":"View QR code","joining space heading":"Joining space","join space heading":"Enter space invitation","halo heading":"Initialize device identity","exit label":"Exit","identity selector title":"Join as","identity radio group title":"Select an identity you’ve associated with this device already","add identity label":"Add","continue label":"Continue","back label":"Back","next label":"Next","close label":"Close","auth choices label":"Choose an identity","create identity label":"Create an identity","create identity description":"Create a new identity.","recover identity label":"Use a seed phrase","recover identity description":"Enter your seed phrase to log in manually.","join identity label":"Use another device","join identity description":"Add this device to an identity you’re already logged into on another device.","deselect identity label":"Back to identities","addition method chooser title":"An identity is required to continue","new identity input label":"Set display name","recover identity input label":"Type or paste your seed phrase","failed to create identity message":"Failed to create an identity.","failed to recover identity message":"Failed to recover an identity from the provided seed phrase.","failed to authenticate message":"Incorrect PIN.","identity added label":"Created identity & added to this device:","join space as identity heading":"<part>as </part><part><icon/><label>{{labelValue}}</label></part>","error status label":"Failed","timeout status label":"Timed out","cancelled status label":"Cancelled","init status label":"Ready to connect","connecting status label":"Connecting…","connected status label":"Enter confirmation PIN","authenticating status label":"Enter confirmation PIN","success status label":"Success","cancel label":"Cancel","done label":"Done","reset label":"Start over","auth code input label":"Enter the verification code","invitation input label":"Paste an invitation code or URL","create device invitation label":"Add device","create space invitation label":"Invite","qr label":"Scan to accept invitation","empty invitations message":"No pending invitations","empty device list message":"No devices authenticated other than this device.","show all spaces label":"All spaces","all spaces label":"All spaces","create space label":"Create a new space","join space label":"Join a space","show current space label":"Current space","view space invitations label":"View space invitations","toggle sidebar label":"Open/close sidebar","open sidebar label":"Open sidebar","close sidebar label":"Close sidebar","welcome message":"Welcome","selecting identity heading":"Selecting identity","devices heading":"Devices","identity heading":"Profile settings","choose add device label":"Add device","choose devices label":"Manage devices","choose profile label":"Edit profile","choose sign out label":"Reset storage","choose join new identity label":"Join existing device","empty space members message":"There is nobody in this space yet.","back to all invitations label":"Back to all invitations","invitation heading":"Invitation","invitation list heading":"Invitations","device invitation list heading":"Pending device invitations","space invitation list heading":"Pending invitations","device list heading":"Devices","space member list heading":"Members","space panel heading":"Space membership","auth code message":"Enter the following auth code on the joining device.","display name input label":"Display name","display name input placeholder":"Enter a display name","invite one label":"Invite one","invite one description":"Only one user may join.","invite one qr label":"Single-use","invite one list item label":"Active single-use invitation","invite many label":"Invite many","invite many description":"Anyone with the link can join.","invite many qr label":"Multiple-use","invite many list item label":"Active multiple-use invitation","invite options label":"Change the active invite option.","reset in progress label":"Resetting...","confirm label":"Confirm","reset storage input label":"This will clear this device and all associated data. Type {{confirmationValue}} and confirm to continue.","join new identity input label":"In order to join an existing device, storage on this device must be cleared first. Type {{confirmationValue}} to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"CONFIRM","sign out chooser title":"Danger zone","sign out chooser message":"Proceeding with the action below will erase all data on this device.","join new identity label":"Join a new identity","reset device label":"Reset storage","reset device confirm message":"Are you sure you want to reset your device? All data will be lost.","emoji and color label":"Emoji and color","clear label":"Use default","select emoji label":"Choose an emoji to use in your avatar","select hue label":"Choose a hue to use in your avatar","resetting message":"One moment while things are reset…","red label":"Red","orange label":"Orange","amber label":"Amber","yellow label":"Yellow","lime label":"Lime","green label":"Green","emerald label":"Emerald","teal label":"Teal","cyan label":"Cyan","sky label":"Sky","blue label":"Blue","indigo label":"Indigo","violet label":"Violet","purple label":"Purple","fuchsia label":"Fuchsia","pink label":"Pink","rose label":"Rose","current device tag label":"This device","device name placeholder":"{{platform}} on {{os}}","more options label":"More options","disconnect label":"Currently online. Click to go offline.","connect label":"Currently offline. Click to go online.","edit device label":"Edit device name & avatar","agent heading":"Agent","agent message title":"About creating an agent","agent message body":"Creating an agent helps keep your devices and peers in-sync. An agent is like any other device, but since it’s always online your changes will sync even when all your physical devices are asleep.","create agent label":"Start an agent","destroy agent label":"Shut down agent","agent device label":"Your agent","shell fallback title":"Shell failed to connect"}},Symbol.toStringTag,{value:"Module"}))},wU=async(e=new Re.Config)=>{const n=new K_.ShellRuntimeImpl(H_({channel:xi.DEFAULT_SHELL_CHANNEL}));await n.open();try{const t=new Re.ClientServicesProxy(H_({channel:xi.DEFAULT_CLIENT_CHANNEL})),i=new Re.Client({config:e,services:t});await i.initialize(),ml(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(ab,{tx:gy,resourceExtensions:[V_]},l.createElement(Re.ClientContext.Provider,{value:{client:i,status:Re.SystemStatus.ACTIVE}},l.createElement(cu,null,l.createElement(Ze.Provider,null,l.createElement(Re.AgentHostingProvider,null,l.createElement(yU,{runtime:n,origin:location.origin}))))))))}catch{ml(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(ab,{tx:gy,resourceExtensions:[V_]},l.createElement(_U,{onClose:()=>n.setAppContext({display:Re.ShellDisplay.NONE})}))))}},_U=({onClose:e})=>{const{t:n}=vn("os");return l.createElement(st.Root,{modal:!0,open:!0,onOpenChange:()=>e==null?void 0:e()},l.createElement(st.Overlay,null,l.createElement(st.Content,null,l.createElement(st.Title,null,n("shell fallback title")),l.createElement(st.Close,{asChild:!0,onClick:()=>e==null?void 0:e()},l.createElement(jn,{variant:"primary"},n("close label"))))))};l.createContext({}),rt.runShell=wU,Object.defineProperty(rt,Symbol.toStringTag,{value:"Module"})});
947
947
  //# sourceMappingURL=shell.umd.js.map