@dxos/shell 0.5.1-next.5a770e3 → 0.5.1-next.638da00

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.
@@ -943,5 +943,5 @@ Event: `).concat(JSON.stringify(event)));else if(this.status!==Mn.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=In(f.map(function(S){return a.getRelativeStateNodes(S,n.historyValue)})),E=!!d.internal;return{transitions:[d],exitSet:E?[]:In(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?Do([],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;(!Lo(p,_)||Lo(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;(!Lo(n,_)||Lo(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=In(S.map(function(L){var N=[];if(L.type!=="final")return N;var X=L.parent;if(!X.parent)return N;N.push(fl(L.id,L.doneData),fl(X.id,L.doneData?rl(L.doneData,r,a):void 0));var Y=X.parent;return Y.type==="parallel"&&No(Y).every(function(ee){return ul(i.configuration,ee)})&&N.push(fl(Y.id)),N})),C=S.map(function(L){var N=L.onEntry,X=L.activities.map(function(Y){return YR(Y)});return{type:"entry",actions:Yi(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 WR(L)})}),P=Array.from(T).map(function(L){return{type:"exit",actions:Yi(Sn(Sn([],un(L.onExit),!1),un(L.activities.map(function(N){return JR(N)})),!1),h.machine.options.actions)}}),F=P.concat({type:"transition",actions:Yi(i.actions,this.machine.options.actions)}).concat(C);if(t){var B=Yi(In(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!ph(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=Kn(t),o;if(n instanceof Ot)o=i===void 0?n:this.resolveState(Ot.from(n,i));else{var s=hn(n)?this.resolve(tl(this.getResolvedPath(n))):this.resolve(n),f=i??this.machine.context;o=this.resolveState(Ot.from(s,f))}if(!Nn&&a.name===jo)throw new Error("An event cannot have the wildcard type ('".concat(jo,"')"));if(this.strict&&!this.events.includes(a.name)&&!NR(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=Do([],this.getStateNodes(o.value)),u=d.configuration.length?Do(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=wa);var u=n.configuration,h=!t||n.transitions.length>0,p=h?n.configuration:t?t.configuration:[],g=ul(p,this),b=h?aU(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===fh?k[P.activity.id||P.activity.type]=P:P.type===lh&&(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(dl(this,t,i,a,_,r,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),B=F[0],L=F[1],N=un(LR(B,ph),2),X=N[0],Y=N[1],ee=B.filter(function(ie){var me;return ie.type===fh&&((me=ie.activity)===null||me===void 0?void 0:me.type)===ch}),re=ee.reduce(function(ie,me){return ie[me.activity.id]=nU(me.activity,c.machine,L,a),ie},t?we({},t.children):{}),fe=new Ot({value:b||t.value,context:L,_event:a,_sessionid:t?t._sessionid:null,historyValue:b?w?BR(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:__(p),machine:this}),ce=i!==L;fe.changed=a.name===r_||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===ka))return fe;var se=fe;if(!g)for(ye&&(se=this.resolveRaisedTransition(se,{type:CR},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||!k_(se.value,oe.value):void 0);return se.changed=J,se.history=oe,se},e.prototype.getStateNode=function(n){if(Ea(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=Ea(n)?n.slice(_h.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"&&Ea(n))try{return this.getStateNodeById(n.slice(1))}catch{}for(var t=vh(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||xa;switch(this.type){case"parallel":return Io(this.initialStateValue,function(a,o){return a?i.getStateNode(o).resolve(n[o]||a):xa});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?Io(n,function(a,o){return a?i.getStateNode(o).resolve(a):xa}):this.initialStateValue||{};default:return n||xa}},e.prototype.getResolvedPath=function(n){if(Ea(n)){var t=this.machine.idMap[n.slice(_h.length)];if(!t)throw new Error("Unable to find state node '".concat(n,"'"));return t.path}return vh(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=f_(this.states,function(i){return i.initialStateValue||xa},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=cl(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=Ea(t.target)?tl(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(cl(this))return[this];if(this.type==="compound"&&!this.initial)return Nn||Gn(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var t=il(this.initialStateValue);return In(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:f_(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?In(il(r).map(function(o){return i.getFromRelativePath(o)})):i.initialStateNodes}var a=MR(i.path,"states")(n).current;return hn(a)?[i.getStateNode(a)]:In(il(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=In(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=UR(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:Yi(Ut(n.actions)),cond:h_(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=jo,s=a[o],f=s===void 0?[]:s,d=sh(a,[typeof o=="symbol"?o:o+""]);r=In(Object.keys(d).map(function(k){!Nn&&k===ka&&Gn(!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=ya(k,d[k]);return Nn||yU(i,k,E),E}).concat(ya(jo,f)))}var c=this.config.always?ya("",this.config.always):[],u=this.config.onDone?ya(String(fl(this.id)),this.config.onDone):[];Nn||Gn(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var h=In(this.invoke.map(function(k){var E=[];return k.onDone&&E.push.apply(E,Sn([],un(ya(String(ll(k.id)),k.onDone)),!1)),k.onError&&E.push.apply(E,Sn([],un(ya(String(Mo(k.id)),k.onError)),!1)),E})),p=this.after,g=In(Sn(Sn(Sn(Sn([],un(u),!1),un(h),!1),un(r),!1),un(c),!1).map(function(k){return Ut(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}(),S_=!1;function kh(e,n){return!Nn&&!("predictableActionArguments"in e)&&!S_&&(S_=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new wU(e,n)}var lt=ZR,_U=l.useLayoutEffect;function C_(e){var n=de.useRef();return n.current||(n.current={v:e()}),n.current.v}var vl=function(){return vl=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},vl.apply(this,arguments)},kU=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},xU=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 EU(e,n){var t=C_(function(){return typeof e=="function"?e():e});if(process.env.NODE_ENV!=="production"&&typeof e!="function"){var i=xU(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=kU(n,["context","guards","actions","activities","services","delays","state"]),h=C_(function(){var p={context:a,guards:o,actions:s,activities:f,services:d,delays:c},g=t.withConfig(p,function(){return vl(vl({},t.context),a)});return E_(g,u)});return _U(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 SU(e,n,t){if(e.status===Mn.NotStarted)return!0;var i=t.changed===void 0&&(Object.keys(t.children).length>0||typeof n.changed=="boolean");return!(t.changed||i)}var CU=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 $U(e){return e}function xh(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=CU(n,1),r=i[0],a=r===void 0?{}:r,o=EU(e,a),s=l.useCallback(function(){return o.status===Mn.NotStarted?a.state?Ot.create(a.state):o.machine.initialState:o.getSnapshot()},[o]),f=l.useCallback(function(u,h){return SU(o,u,h)},[o]),d=l.useCallback(function(u){var h=o.subscribe(u).unsubscribe;return h},[o]),c=SR.useSyncExternalStoreWithSelector(d,s,s,$U,f);return l.useEffect(function(){var u=a.state;return o.start(u?Ot.create(u):void 0),function(){o.stop(),o.status=Mn.NotStarted}},[]),[c,o.send,o]}const TU=kh({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:lt({identity:(e,n)=>(n==null?void 0:n.identity)??null}),setInvitation:lt({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:lt({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),AU=(e,n)=>xh(TU,{...n,context:{...n==null?void 0:n.context,identity:e.halo.identity.get(),identitySubscribable:e.halo.identity.map(t=>({type:"setIdentity",identity:t}))}}),OU=e=>{const{send:n}=e,t=je.useClient(),i=pt.useHaloInvitations(),r=je.useAgentHostingClient(),a=l.useCallback(s=>{const f=Ei.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(PU,{...e,onCreateInvitationClick:o,agentHostingEnabled:!!r})},PU=({send:e,onCreateInvitationClick:n,devices:t,onAgentDestroy:i,onAgentCreate:r,agentStatus:a,agentActive:o,agentHostingEnabled:s})=>l.createElement(l.Fragment,null,l.createElement(QL,{devices:t,onClickAdd:n,onClickJoinExisting:()=>e==null?void 0:e({type:"chooseJoinNewIdentity"}),onClickReset:()=>e==null?void 0:e({type:"chooseResetStorage"})}),s&&l.createElement(iL,{agentActive:o,agentStatus:a,onAgentDestroy:i,onAgentCreate:r})),IU=({invitations:e,identity:n})=>{const[t,i]=l.useState(""),[r,a]=l.useState(""),[o,s]=l.useState(!1),f=je.useAgentHostingClient(),d=je.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=Ei.InvitationEncoder.encode(p);if(p.state===Se.State.CONNECTING&&(Ge.info(JSON.stringify({invitationCode:g,authCode:p.authCode})),io(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();io(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 $_={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 Oe=xe+an.getLength()-te[he].length;te[he][xe]=Oe>=0?an.getAt(Oe):0}}for(var He=0,xe=0;xe<W.length;xe+=1)He+=W[xe].totalCount;for(var _n=new Array(He),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})})($_);var FU=$_.exports;const Eh=er(FU);var MU=Object.defineProperty,pl=Object.getOwnPropertySymbols,T_=Object.prototype.hasOwnProperty,A_=Object.prototype.propertyIsEnumerable,O_=(e,n,t)=>n in e?MU(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,NU=(e,n)=>{for(var t in n||(n={}))T_.call(n,t)&&O_(e,t,n[t]);if(pl)for(var t of pl(n))A_.call(n,t)&&O_(e,t,n[t]);return e},DU=(e,n)=>{var t={};for(var i in e)T_.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&pl)for(var i of pl(e))n.indexOf(i)<0&&A_.call(e,i)&&(t[i]=e[i]);return t},yi=1e3,LU=/code length overflow/i;Eh.stringToBytes=Eh.stringToBytesFuncs["UTF-8"];var BU=(e,n,t)=>{t=Math.max(1,t);for(let i=t;i<=40;i+=1)try{const r=Eh(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&&LU.test(String(r))))throw r}return null},Ji=Math.round,Sa=(e,n)=>`M ${Ji(e)} ${Ji(n)}`,tt=(e,n)=>`L ${Ji(e)} ${Ji(n)}`,Xi=(e,n,t)=>`A ${Ji(t)} ${Ji(t)} 0 0 1 ${Ji(e)} ${Ji(n)}`,jU=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a?d.push(Sa(e+r,n)):d.push(Sa(e,n)),o?d.push(tt(t-r,n),Xi(t,n+r,r)):d.push(tt(t,n)),s?d.push(tt(t,i-r),Xi(t-r,i,r)):d.push(tt(t,i)),f?d.push(tt(e+r,i),Xi(e,i-r,r)):d.push(tt(e,i)),a?d.push(tt(e,n+r),Xi(e+r,n,r)):d.push(tt(e,n)),d.join(" ")},RU=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a&&d.push(Sa(e+r,n),tt(e,n),tt(e,n+r),Xi(e+r,n,r)),o&&d.push(Sa(t,n+r),tt(t,n),tt(t-r,n),Xi(t,n+r,r)),s&&d.push(Sa(t-r,i),tt(t,i),tt(t,i-r),Xi(t-r,i,r)),f&&d.push(Sa(e,i-r),tt(e,i),tt(e+r,i),Xi(e,i-r,r)),d.join(" ")},UU=(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?jU(a,o,s,f,d,!_&&!C,!_&&!E,!T&&!E,!T&&!C):RU(a,o,s,f,d,_&&C&&w,_&&E&&k,T&&E&&S,T&&C&&O)},zU=(e,n)=>{if(!e)return"";const t=e.moduleCount,i=yi/t,r=[];for(let a=0;a<t;a+=1)for(let o=0;o<t;o+=1)r.push(UU(e,n,i,a,o));return r.join(" ")},WU=e=>{var n=e,{color:t="#000",backgroundColor:i,cutout:r=!1,cutoutElement:a,errorCorrectionLevel:o="Q",rounding:s=0,children:f}=n,d=DU(n,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),c,u;const h=l.useMemo(()=>BU(f,o,1),[f,o]);if(!h)return null;const p=(c=h==null?void 0:h.moduleCount)!=null?c:1,b=yi/((u=h==null?void 0:h.moduleCount)!=null?u:1)*(Math.floor(p*.18)*2-1)+2,w=(yi-b)/2;return de.createElement("svg",NU({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${yi} ${yi}`},d),r?de.createElement("mask",{id:"react-qr-rounded__mask"},de.createElement("rect",{x:"0",y:"0",width:yi,height:yi,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:yi,height:yi,fill:i}):null,de.createElement("path",{fill:t,d:zU(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 HU=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]]),Sh=({children:e,...n})=>l.createElement(bn.View,{...n,classNames:"grow flex flex-col justify-around items-center"},e),P_=({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:HU.get(i)??0,c=d===3,u=ro(o),h=l.useMemo(()=>{if(r)return"showing qr";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(Sh,{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(Fn,"is-full max-is-[14rem] relative")},l.createElement(WU,{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(Cj,null,l.createElement(Ku,{text:u}))),l.createElement("span",{id:f,className:"sr-only"},s("qr label")),l.createElement(rL,{variant:"ghost",value:e??"never"})),l.createElement(Sh,{id:"showing auth code"},l.createElement(A2,null,s("auth code message")),l.createElement($2,{code:a,large:!0,classNames:"text-black dark:text-white"}),l.createElement(A2,null,"Be sure the other device is showing this symbol:"),u&&l.createElement(Ku,{text:u})),l.createElement(Sh,{id:"showing final"},d>0?l.createElement(Ve.Check,{className:le("m-1.5",We(6))}):l.createElement(Ve.X,{className:le("m-1.5",We(6))})))),l.createElement(Rt,{classNames:"mbs-4"},l.createElement(qn,{disabled:!n,onClick:()=>t==null?void 0:t({type:"deselectInvitation"})},s("back label"))))},Ch=({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(VU,{disabled:!e,pending:s,validationMessage:a,onConfirm:d,onCancel:n,mode:i})},VU=({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(Bc.Root,{valence:"error"},l.createElement(Bc.Title,null,l.createElement(Ve.Warning,{className:le(We(6),"inline mie-2")}),o("sign out chooser title")),l.createElement(Bc.Body,null,o("sign out chooser message"))),l.createElement(Ju,{validationMessage:t,label:l.createElement(bi,{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:o("confirmation placeholder",{confirmationValue:s}),onChange:({target:{value:u}})=>d(u)})),l.createElement(Rt,null,r&&l.createElement(qn,{disabled:e,onClick:r,"data-testid":`${c}.reset-identity-cancel`},o("cancel label")),i&&l.createElement(qn,{variant:"destructive",disabled:e||n||f!==s,onClick:i,"data-testid":`${c}.reset-identity-confirm`},o(n?"reset in progress label":"reset device label"))))},ml="pbs-1 pbe-3 pli-3",qU=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.hue)||f$((e==null?void 0:e.identityKey.toHex())??"0")},GU=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.emoji)||ro((e==null?void 0:e.identityKey.toHex())??"0")},KU=({titleId:e,title:n,identity:t,onDone:i,onUpdateProfile:r,connectionState:a,onChangeConnectionState:o})=>{var C,P;const s=fc(t.identityKey),{t:f}=vn("os"),[d,c]=l.useState(((C=t.profile)==null?void 0:C.displayName)??""),[u,h]=l.useState(GU(t)),[p,g]=l.useState(qU(t)),{textValue:b,setTextValue:w}=uu(),_=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===Zo.ConnectionState.ONLINE;return l.createElement(Yu,{titleId:e,title:n,corner:l.createElement(T2,{onDone:i})},l.createElement(wn.Root,{size:16,variant:"circle",status:O?"active":"error",hue:p||s.hue},l.createElement(go.Root,{classNames:"grid grid-cols-[1fr_var(--rail-action)_min-content_var(--rail-action)_1fr] items-center gap-2"},l.createElement(Qe.Root,null,l.createElement(Qe.Trigger,{asChild:!0},l.createElement(go.Button,{classNames:"bs-[--rail-action] is-[--rail-action] justify-self-end",onClick:()=>o==null?void 0:o(O?Zo.ConnectionState.OFFLINE:Zo.ConnectionState.ONLINE)},l.createElement("span",{className:"sr-only"},f(O?"disconnect label":"connect label")),O?l.createElement(Ve.PlugsConnected,{className:We(5)}):l.createElement(Ve.Plugs,{className:We(5)}))),l.createElement(Qe.Portal,null,l.createElement(Qe.Content,{side:"bottom",classNames:"z-50"},f(O?"disconnect label":"connect label"),l.createElement(Qe.Arrow,null)))),l.createElement(qL,{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(KL,{hue:p,onChangeHue:T,classNames:"bs-[--rail-action]"}),l.createElement(Qe.Root,null,l.createElement(Qe.Trigger,{asChild:!0},l.createElement(go.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(Ve.CopySimple,{className:We(5)}))),l.createElement(Qe.Portal,null,l.createElement(Qe.Content,{side:"bottom",classNames:"z-50"},f(k?"copy success label":"copy self public key label"),l.createElement(Qe.Arrow,null))))),l.createElement(wn.Label,{classNames:"sr-only","data-testid":"identityHeading.displayName"},((P=t.profile)==null?void 0:P.displayName)??Df(t.identityKey.toHex())),l.createElement(yt.Root,null,l.createElement(yt.Label,{srOnly:!0},f("display name input label")),l.createElement(yt.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}))))},I_=e=>{const{identity:n,titleId:t,activeView:i,onUpdateProfile:r,onResetStorage:a,onJoinNewIdentity:o,IdentityActionChooser:s=OU,InvitationManager:f=P_,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(mo,{density:"fine"},l.createElement(KU,{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:ml},l.createElement(s,{active:i==="identity action chooser",...h})),l.createElement(bn.View,{id:"device invitation manager",classNames:ml},l.createElement(f,{active:i==="device invitation manager",...h,invitationUrl:h.createInvitationUrl(h.invitationCode)})),l.createElement(bn.View,{classNames:ml,id:"confirm join new identity"},l.createElement(Ch,{active:i==="confirm join new identity",...h,mode:"join new identity",onConfirm:o,onCancel:b})),l.createElement(bn.View,{classNames:ml,id:"confirm reset storage"},l.createElement(Ch,{active:i==="confirm reset storage",...h,mode:"reset storage",onConfirm:a,onCancel:b})))))},YU=({invitation:e,...n})=>{const t=Gu(e);return l.createElement(I_,{...n,...t})},JU=({titleId:e,createInvitationUrl:n=r=>r,initialDisposition:t="default",...i})=>{const r=$n("identityPanel__heading",e),a=je.useClient(),o=pt.useDevices(),s=pt.useIdentity(),f=pt.useHaloInvitations(),d=IU({identity:s,invitations:f});if(!s)return Ge.error("IdentityPanel rendered with no active identity."),null;const[c,u,h]=AU(a,{context:{initialDisposition:t}}),{swarm:p}=Zo.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(YU,{..._,invitation:c.context.invitation}):l.createElement(I_,{..._})},XU=l.forwardRef(({mode:e,titleId:n,onExit:t,exitActionParent:i},r)=>{const{t:a}=vn("os"),o=l.createElement(Rn,{variant:"ghost",...t&&{onClick:t},classNames:le(Fn,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},l.createElement(Ve.X,{weight:"bold",className:We(4)}),l.createElement("span",{className:"sr-only"},a("exit label")));return l.createElement(Yu,{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"})}),F_=(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 je.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)))}),M_=(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:[lt({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],failReason:r.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[lt({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],unredeemedCode:r.code,succeededKeys:r.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),ZU=kh({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:M_("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:M_("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:lt({identity:(e,n)=>n.identity}),unsetIdentity:lt({identity:()=>null}),resetInvitation:lt({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:lt({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})}}}),N_=(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}},QU=(e,n)=>{const t=l.useCallback(({halo:o})=>{if(o.unredeemedCode)try{const s=Ei.InvitationEncoder.decode(N_("halo",o.unredeemedCode)),f=e.halo.join(s);return{...o,invitationObservable:f,invitationSubscribable:F_("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=Ei.InvitationEncoder.decode(N_("space",o.unredeemedCode)),f=e.spaces.join(s);return{...o,invitationObservable:f,invitationSubscribable:F_("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 xh(ZU,{...n,actions:{...n==null?void 0:n.actions,redeemHaloInvitationCode:lt({halo:t}),redeemSpaceInvitationCode:lt({space:i}),invalidateHaloInvitationCode:lt({halo:r}),invalidateSpaceInvitationCode:lt({space:a})}})},ez=e=>{const n=!e.active,{send:t}=e,{t:i}=vn("os"),r={disabled:n,after:l.createElement(Ve.CaretRight,{className:We(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return l.createElement(l.Fragment,null,l.createElement(bi,null,i("addition method chooser title")),l.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},l.createElement(vu,{...r,description:i("create identity description"),before:l.createElement(Ve.Plus,{className:We(6)}),onClick:()=>t({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},i("create identity label")),l.createElement(vu,{...r,description:i("join identity description"),before:l.createElement(Ve.QrCode,{className:We(6)}),onClick:()=>t({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},i("join identity label")),l.createElement(vu,{...r,disabled:!0,description:i("recover identity description"),before:l.createElement(Ve.Textbox,{className:We(6)}),onClick:()=>t({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},i("recover identity label"))))},nz=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=wg(d),u=$n("identityListItem__label"),h=((g=t==null?void 0:t.profile)==null?void 0:g.displayName)??(t&&Df(d)),p=l.createElement(qn,{...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(bi,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(Rt,null,n==="halo-only"?o?l.cloneElement(o,{},p):p:l.createElement(qn,{variant:"primary",disabled:s||!t,onClick:()=>t&&r({type:"selectIdentity",identity:t}),"data-autofocus":"confirmingAddedIdentity"},f("continue label"))))},tz=e=>{const{send:n,method:t}=e,i=t==="recover identity",r=je.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(iz,{...e,onDisplayNameConfirm:f,validationMessage:o})},iz=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(Ju,{validationMessage:a,label:l.createElement(bi,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(Rt,null,l.createElement(qn,{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(qn,{variant:"primary",disabled:o,onClick:()=>r==null?void 0:r(f),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},D_=e=>{const{active:n,Kind:t,doneActionParent:i,onDone:r}=e,a=!n,{t:o}=vn("os"),s=l.createElement(qn,{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(Rt,null,i?l.cloneElement(i,{},s):s))},rz=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}},L_=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:rz(h),...n==="Space"&&{succeededKeys:d}})},b=l.createElement(qn,{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(Ju,{label:l.createElement(bi,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(Rt,null,n==="Halo"?l.createElement(qn,{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(qn,{variant:"primary",disabled:c,onClick:g,"data-testid":`${n.toLowerCase()}-invitation-input-continue`},u("continue label"))))},az=({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(bi,{className:Fn},o(a==="timeout"?"timeout status label":a==="cancelled"?"cancelled status label":"error status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(Rt,null,l.createElement(qn,{disabled:!t,onClick:()=>i({type:`reset${r}Invitation`}),"data-testid":"invitation-rescuer-reset"},o("reset label")))):l.createElement(l.Fragment,null,l.createElement(bi,{className:Fn},o("connecting status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(Rt,null,l.createElement(qn,{disabled:!0,classNames:"order-2","data-testid":"next"},o("next label")),l.createElement(qn,{disabled:!t,onClick:n,"data-testid":"invitation-rescuer-cancel"},o("cancel label"))))},B_=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(bi,{className:Fn},"There was a problem joining the space")),l.createElement(Rt,null,l.createElement(qn,{disabled:!i,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>r({type:`reset${n}Invitation`})},a("reset label")))):l.createElement(az,{...e}))},j_=6,R_=({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===j_&&((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(Ku,{text:ro(r)}),l.createElement(yt.Root,{...e&&{validationValence:"error"}},l.createElement(yt.Label,{asChild:!0},l.createElement(bi,null,f("auth code input label"))),l.createElement(yt.PinInput,{disabled:s,length:j_,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(yt.DescriptionAndValidation,{classNames:"text-center"},l.createElement(yt.Validation,null,f("failed to authenticate message"))))),l.createElement(Rt,null,l.createElement(qn,{variant:"ghost",disabled:s,onClick:()=>o==null?void 0:o(),"data-testid":`${d}-invitation-authenticator-cancel`},f("cancel label")),l.createElement(qn,{variant:"primary",disabled:s,onClick:()=>a==null?void 0:a(c),"data-autofocus-pinlength":d,"data-testid":`${d}-invitation-authenticator-next`},f("next label"))))},dt="pbs-1 pbe-3 pli-3",oz=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=tz,ConfirmReset:O=Ch}=e;return l.createElement(mo,{density:"fine"},a!=="halo-only"&&l.createElement(XU,{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:dt,id:"addition method chooser"},l.createElement(ez,{send:t,active:i==="addition method chooser"})),l.createElement(bn.View,{classNames:dt,id:"reset storage confirmation"},l.createElement(O,{send:t,active:i==="reset storage confirmation",onCancel:E,onConfirm:S})),l.createElement(bn.View,{classNames:dt,id:"create identity input"},l.createElement(T,{send:t,method:"create identity",active:i==="create identity input"})),l.createElement(bn.View,{classNames:dt,id:"recover identity input"},l.createElement(T,{send:t,method:"recover identity",active:i==="recover identity input"})),l.createElement(bn.View,{classNames:dt,id:"halo invitation input"},l.createElement(L_,{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:dt,id:"halo invitation rescuer"},l.createElement(B_,{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:dt,id:"halo invitation authenticator"},l.createElement(R_,{send:t,Kind:"Halo",active:i==="halo invitation authenticator",onInvitationCancel:b,onInvitationAuthenticate:_,...r.has("Halo")&&{failed:!0}})),l.createElement(bn.View,{classNames:dt,id:"halo invitation accepted"},l.createElement(D_,{send:t,Kind:"Halo",active:i==="halo invitation accepted",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:dt,id:"identity added"},l.createElement(nz,{send:t,mode:a,active:i==="identity added",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:dt,id:"space invitation input"},l.createElement(L_,{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:dt,id:"space invitation rescuer"},l.createElement(B_,{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:dt,id:"space invitation authenticator"},l.createElement(R_,{send:t,Kind:"Space",active:i==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:k,...r.has("Space")&&{failed:!0}})),l.createElement(bn.View,{classNames:dt,id:"space invitation accepted"},l.createElement(D_,{send:t,Kind:"Space",active:i==="space invitation accepted",doneActionParent:g,onDone:h})))))},sz=({titleId:e,mode:n="default",initialDisposition:t="default",initialInvitationCode:i,exitActionParent:r,onExit:a,doneActionParent:o,onDone:s,onCancelResetStorage:f})=>{const d=je.useClient(),c=pt.useIdentity(),{hasIosKeyboard:u}=Te(),h=$n("joinPanel__heading",e),[p,g,b]=QU(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=je.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(oz,{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})},fz=kh({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:lt({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:lt({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),lz=e=>xh(fz,{...e,context:{...e==null?void 0:e.context}}),U_="dxos:react-shell/space-manager/active-action",dz=e=>{const{space:n,target:t}=e,{t:i}=vn("os"),r=je.useConfig(),a=Xo.useSpaceInvitations(n==null?void 0:n.key),o=l.useCallback(f=>{const d=Ei.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:Ve.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:Ve.UsersThree,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.DELEGATED,authMethod:Se.AuthMethod.KNOWN_PUBLIC_KEY,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(cz,{...e,invitations:a,inviteActions:s})},z_="pis-3 pie-1 plb-1 mbe-1 font-medium",cz=e=>{const{active:n,space:t,createInvitationUrl:i,send:r,inviteActions:a,invitations:o,showInactiveInvitations:s,SpaceMemberList:f=JL,InvitationList:d=xj}=e,{t:c}=vn("os"),u=a??{noopInvite:{label:c("create space invitation label"),description:"",icon:Ve.Placeholder,onClick:()=>{}}},[h,p]=l.useState(localStorage.getItem(U_)??"inviteOne"),g=w=>{p(w),localStorage.setItem(U_,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(ff.Root,{classNames:"grow shrink basis-28 -mli-2"},l.createElement(ff.Viewport,{classNames:"is-full pie-2"},!!(b!=null&&b.length)&&l.createElement(l.Fragment,null,l.createElement("h3",{className:le(z_,Fn)},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(z_,Fn,"mbs-2")},c("space member list heading"))),l.createElement(f,{spaceKey:t.key,includeSelf:!0})),l.createElement(ff.Scrollbar,{orientation:"vertical"},l.createElement(ff.Thumb,null))),l.createElement(Rt,null,l.createElement(Sj,{disabled:!n,actions:u,activeAction:h,onChangeActiveAction:g,"data-testid":"spaces-panel.create-invitation"})))},uz=({titleId:e,space:n,onDone:t})=>{const{t:i}=vn("os"),r=n.properties.name;return l.createElement(Yu,{titleId:e,title:i("space panel heading"),corner:l.createElement(T2,{"data-testid":"identity-panel-done",onDone:t})},l.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},l.createElement(Ve.Planet,{size:32,weight:"light"}),l.createElement("div",{className:"block text-start font-light text-xl"},r??n.key.truncate())))},W_=e=>{const{titleId:n,activeView:t,space:i,target:r,SpaceManager:a=dz,InvitationManager:o=P_,...s}=e;return l.createElement(mo,{density:"fine"},l.createElement(uz,{...s,titleId:n,space:i}),l.createElement(bn.Root,{activeView:t},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"space manager",classNames:dt},l.createElement(a,{active:t==="space manager",space:i,target:r,...s})),l.createElement(bn.View,{id:"space invitation manager",classNames:dt},l.createElement(o,{active:t==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},hz=({invitation:e,...n})=>{const t=Gu(e);return l.createElement(W_,{...n,...t,invitationUrl:n.createInvitationUrl(t.invitationCode)})},vz=({titleId:e,createInvitationUrl:n=i=>i,...t})=>{const i=$n("spacePanel__heading",e),[r,a,o]=lz({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(hz,{...f,invitation:r.context.invitation}):l.createElement(W_,{...f})},pz=({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(FO,{indeterminate:!0},n("resetting message")))},mz=e=>{const n=$n("identityDialog__title",e.title);return l.createElement(ft.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(ft.Portal,null,l.createElement(ft.Overlay,null,l.createElement(ft.Content,{"aria-labelledby":n,onOpenAutoFocus:t=>t.preventDefault()},l.createElement(hu,null,l.createElement(JU,{...e,titleId:n,doneActionParent:l.createElement(ft.Close,{asChild:!0})}))))))},H_=e=>{const n=$n("joinDialog__title"),{height:t}=bA();return l.createElement(Qt.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(Qt.Portal,null,l.createElement(Qt.Overlay,{classNames:"backdrop-blur",...t&&{style:{blockSize:`${t}px`}}},l.createElement(Qt.Content,{"aria-labelledby":n},l.createElement(sz,{...e,titleId:n,exitActionParent:l.createElement(Qt.Cancel,{asChild:!0}),doneActionParent:l.createElement(Qt.Action,{asChild:!0})})))))};var gl,bl=xi;if(process.env.NODE_ENV==="production")gl=bl.createRoot,bl.hydrateRoot;else{var V_=bl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gl=function(e,n){V_.usingClientEntryPoint=!0;try{return bl.createRoot(e,n)}finally{V_.usingClientEntryPoint=!1}}}var $h={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,ze){var y={};for(var v in Ee)ze[v]&&ze[v].length%2===0?y[v]=ze[v].concat(Ee[v]):y[v]=Ee[v];return y},M=function(Ee){for(var ze={},y=0;y<Ee.length;y++)ze[Ee[y].toUpperCase()]=Ee[y];return ze},Z=function(Ee,ze){return typeof Ee===c?te(ze).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,ze){if(typeof Ee===c)return Ee=Ee.replace(/^\s\s*/,a),typeof ze===f?Ee:Ee.substring(0,P)},ke=function(Ee,ze){for(var y=0,v,m,x,A,D,z;y<ze.length&&!D;){var be=ze[y],Fe=ze[y+1];for(v=m=0;v<be.length&&!D&&be[v];)if(D=be[v++].exec(Ee),D)for(x=0;x<Fe.length;x++)z=D[++m],A=Fe[x],typeof A===d&&A.length>0?A.length===2?typeof A[1]==s?this[A[0]]=A[1].call(this,z):this[A[0]]=A[1]:A.length===3?typeof A[1]===s&&!(A[1].exec&&A[1].test)?this[A[0]]=z?A[1].call(this,z,A[2]):i:this[A[0]]=z?z.replace(A[1],A[2]):i:A.length===4&&(this[A[0]]=z?A[3].call(this,z.replace(A[1],A[2])):i):this[A]=z||i;y+=2}},xe=function(Ee,ze){for(var y in ze)if(typeof ze[y]===d&&ze[y].length>0){for(var v=0;v<ze[y].length;v++)if(Z(ze[y][v],Ee))return y===o?i:y}else if(Z(ze[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]]},Oe=function(Ee,ze){if(typeof Ee===d&&(ze=Ee,Ee=i),!(this instanceof Oe))return new Oe(Ee,ze).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=ze?I(an,ze):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};Oe.VERSION=r,Oe.BROWSER=M([p,w,u]),Oe.CPU=M([_]),Oe.DEVICE=M([h,b,g,k,E,T,S,O,C]),Oe.ENGINE=Oe.OS=M([p,w]),e.exports&&(n=e.exports=Oe),n.UAParser=Oe;var He=typeof t!==f&&(t.jQuery||t.Zepto);if(He&&!He.ua){var _n=new Oe;He.ua=_n.getResult(),He.ua.get=function(){return _n.getUA()},He.ua.set=function(Ee){_n.setUA(Ee);var ze=_n.getResult();for(var y in ze)He.ua[y]=ze[y]}}})(typeof window=="object"?window:mn)})($h,$h.exports);var gz=$h.exports,yl="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",Th,Ah;if(typeof navigator<"u"){const e=new gz.UAParser(navigator.userAgent);Th=e.getBrowser().name,Ah=e.getOS().name}var bz=(e,n,t)=>{if(!e.contentWindow){Ge("IFrame content window missing",{origin:n},{F:yl,L:24,S:void 0,C:(i,r)=>i(...r)});return}Th==="Chrome"&&Ah==="iOS"?e.contentWindow.postMessage(t,n):e.contentWindow.postMessage(t,n,[t.payload])},yz=(e,n)=>{Th==="Chrome"&&Ah==="iOS"?window.parent.postMessage(n,e):window.parent.postMessage(n,e,[n.payload])},q_=({channel:e,iframe:n,origin:t,onOrigin:i})=>({send:async r=>{if(!t){Ge("no origin set",{channel:e},{F:yl,L:62,S:void 0,C:(s,f)=>s(...f)});return}Ge("sending",{channel:e,data:r.length},{F:yl,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?bz(n,t,o):yz(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:yl,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 wz=e=>{const n=$n("spaceDialog__title");return l.createElement(ft.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(ft.Portal,null,l.createElement(ft.Overlay,null,l.createElement(ft.Content,{"aria-labelledby":n},l.createElement(hu,null,l.createElement(vz,{...e,titleId:n,doneActionParent:l.createElement(ft.Close,{asChild:!0})}))))))},_z=()=>{const e=$n("statusDialog__title");return l.createElement(Qt.Root,{open:!0},l.createElement(Qt.Portal,null,l.createElement(Qt.Overlay,null,l.createElement(Qt.Content,{"aria-labelledby":e},l.createElement(pz,{titleId:e})))))},kz=({runtime:e})=>{const[{layout:n,invitationCode:t,spaceKey:i,target:r},a]=l.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),[{invitationUrl:o,deviceInvitationParam:s,spaceInvitationParam:f},d]=l.useState({invitationUrl:e.invitationUrl,deviceInvitationParam:e.deviceInvitationParam,spaceInvitationParam:e.spaceInvitationParam}),c=je.useClient(),u=Xo.useSpace(i),h=g=>{const b=new URL(o);return b.searchParams.set(s,g),b.toString()},p=g=>{const b=new URL(o);return b.searchParams.set(f,g),b.toString()};switch(l.useEffect(()=>{const g=e.layoutUpdate.on(w=>a(w)),b=e.invitationUrlUpdate.on(w=>d(w));return()=>{g(),b()}},[e]),l.useEffect(()=>{if(n===je.ShellLayout.SPACE&&!u){Ge.warn("No space found for shell space invitations.");const g=setTimeout(async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})});return()=>clearTimeout(g)}},[e,n,u]),n){case je.ShellLayout.STATUS:return l.createElement(_z,null);case je.ShellLayout.INITIALIZE_IDENTITY:case je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:return l.createElement(H_,{mode:"halo-only",initialDisposition:n===je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION?"accept-halo-invitation":"default",initialInvitationCode:t,onCancelResetStorage:()=>e.setLayout({layout:je.ShellLayout.IDENTITY}),onDone:()=>{e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}});case je.ShellLayout.IDENTITY:case je.ShellLayout.SHARE_IDENTITY:case je.ShellLayout.EDIT_PROFILE:return l.createElement(mz,{createInvitationUrl:h,onResetStorage:async()=>(e.setLayout({layout:je.ShellLayout.STATUS}),await c.reset(),e.setAppContext({display:je.ShellDisplay.NONE,reload:!0})),onJoinNewIdentity:async()=>(e.setLayout({layout:je.ShellLayout.STATUS}),await c.reset(),e.setLayout({layout:je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION})),onDone:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})},initialDisposition:n===je.ShellLayout.SHARE_IDENTITY?"manage-device-invitation":"default"});case je.ShellLayout.SPACE:return u?l.createElement(wz,{space:u,target:r,createInvitationUrl:p,onDone:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}}):null;case je.ShellLayout.JOIN_SPACE:return l.createElement(H_,{initialInvitationCode:t,onDone:async g=>{const b=(g==null?void 0:g.target)??void 0;await e.setAppContext({display:je.ShellDisplay.NONE,spaceKey:(g==null?void 0:g.spaceKey)??void 0,target:b}),e.setLayout({layout:je.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}});default:return null}},G_={"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":"Single-use invitation","invite one description":"Only one user may join.","invite one qr label":"Single-use invitation","invite one list item label":"Active single-use invitation","invite many label":"Multi-use invitation","invite many description":"Anyone with the link can join.","invite many qr label":"Multi-use invitation","invite many list item label":"Active multi-use invitation","invite options label":"Change the active invite option.","reset in progress label":"Resetting...","confirm label":"Confirm","reset storage input label":"WARNING: This will delete all data on this device. Type {{confirmationValue}} to continue.","join new identity input label":"WARNING: To join an existing device all data on this device will be deleted. Type {{confirmationValue}} to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"RESET","confirmation placeholder":"Enter {{confirmationValue}} to continue.","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 the device is 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"}))},xz=async(e=new je.Config)=>{const n=new X_.ShellRuntimeImpl(q_({channel:Ei.DEFAULT_SHELL_CHANNEL}));await n.open();try{const t=new je.ClientServicesProxy(q_({channel:Ei.DEFAULT_CLIENT_CHANNEL})),i=new je.Client({config:e,services:t});await i.initialize(),gl(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(sb,{tx:yy,resourceExtensions:[G_]},l.createElement(je.ClientContext.Provider,{value:{client:i,status:je.SystemStatus.ACTIVE}},l.createElement(hu,null,l.createElement(Qe.Provider,null,l.createElement(je.AgentHostingProvider,null,l.createElement(kz,{runtime:n}))))))))}catch{gl(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(sb,{tx:yy,resourceExtensions:[G_]},l.createElement(Ez,{onClose:()=>n.setAppContext({display:je.ShellDisplay.NONE})}))))}},Ez=({onClose:e})=>{const{t:n}=vn("os");return l.createElement(ft.Root,{modal:!0,open:!0,onOpenChange:()=>e==null?void 0:e()},l.createElement(ft.Overlay,null,l.createElement(ft.Content,null,l.createElement(ft.Title,null,n("shell fallback title")),l.createElement(ft.Close,{asChild:!0,onClick:()=>e==null?void 0:e()},l.createElement(Rn,{variant:"primary"},n("close label"))))))};l.createContext({}),at.runShell=xz,Object.defineProperty(at,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})})($_);var FU=$_.exports;const Eh=er(FU);var MU=Object.defineProperty,pl=Object.getOwnPropertySymbols,T_=Object.prototype.hasOwnProperty,A_=Object.prototype.propertyIsEnumerable,O_=(e,n,t)=>n in e?MU(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,NU=(e,n)=>{for(var t in n||(n={}))T_.call(n,t)&&O_(e,t,n[t]);if(pl)for(var t of pl(n))A_.call(n,t)&&O_(e,t,n[t]);return e},DU=(e,n)=>{var t={};for(var i in e)T_.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(e!=null&&pl)for(var i of pl(e))n.indexOf(i)<0&&A_.call(e,i)&&(t[i]=e[i]);return t},yi=1e3,LU=/code length overflow/i;Eh.stringToBytes=Eh.stringToBytesFuncs["UTF-8"];var BU=(e,n,t)=>{t=Math.max(1,t);for(let i=t;i<=40;i+=1)try{const r=Eh(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&&LU.test(String(r))))throw r}return null},Ji=Math.round,Sa=(e,n)=>`M ${Ji(e)} ${Ji(n)}`,tt=(e,n)=>`L ${Ji(e)} ${Ji(n)}`,Xi=(e,n,t)=>`A ${Ji(t)} ${Ji(t)} 0 0 1 ${Ji(e)} ${Ji(n)}`,jU=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a?d.push(Sa(e+r,n)):d.push(Sa(e,n)),o?d.push(tt(t-r,n),Xi(t,n+r,r)):d.push(tt(t,n)),s?d.push(tt(t,i-r),Xi(t-r,i,r)):d.push(tt(t,i)),f?d.push(tt(e+r,i),Xi(e,i-r,r)):d.push(tt(e,i)),a?d.push(tt(e,n+r),Xi(e+r,n,r)):d.push(tt(e,n)),d.join(" ")},RU=(e,n,t,i,r,a,o,s,f)=>{const d=[];return a&&d.push(Sa(e+r,n),tt(e,n),tt(e,n+r),Xi(e+r,n,r)),o&&d.push(Sa(t,n+r),tt(t,n),tt(t-r,n),Xi(t,n+r,r)),s&&d.push(Sa(t-r,i),tt(t,i),tt(t,i-r),Xi(t-r,i,r)),f&&d.push(Sa(e,i-r),tt(e,i),tt(e+r,i),Xi(e,i-r,r)),d.join(" ")},UU=(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?jU(a,o,s,f,d,!_&&!C,!_&&!E,!T&&!E,!T&&!C):RU(a,o,s,f,d,_&&C&&w,_&&E&&k,T&&E&&S,T&&C&&O)},zU=(e,n)=>{if(!e)return"";const t=e.moduleCount,i=yi/t,r=[];for(let a=0;a<t;a+=1)for(let o=0;o<t;o+=1)r.push(UU(e,n,i,a,o));return r.join(" ")},WU=e=>{var n=e,{color:t="#000",backgroundColor:i,cutout:r=!1,cutoutElement:a,errorCorrectionLevel:o="Q",rounding:s=0,children:f}=n,d=DU(n,["color","backgroundColor","cutout","cutoutElement","errorCorrectionLevel","rounding","children"]),c,u;const h=l.useMemo(()=>BU(f,o,1),[f,o]);if(!h)return null;const p=(c=h==null?void 0:h.moduleCount)!=null?c:1,b=yi/((u=h==null?void 0:h.moduleCount)!=null?u:1)*(Math.floor(p*.18)*2-1)+2,w=(yi-b)/2;return de.createElement("svg",NU({xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${yi} ${yi}`},d),r?de.createElement("mask",{id:"react-qr-rounded__mask"},de.createElement("rect",{x:"0",y:"0",width:yi,height:yi,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:yi,height:yi,fill:i}):null,de.createElement("path",{fill:t,d:zU(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 HU=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]]),Sh=({children:e,...n})=>l.createElement(bn.View,{...n,classNames:"grow flex flex-col justify-around items-center"},e),P_=({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:HU.get(i)??0,c=d===3,u=ro(o),h=l.useMemo(()=>{if(r)return"showing qr";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(Sh,{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(Fn,"is-full max-is-[14rem] relative")},l.createElement(WU,{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(Cj,null,l.createElement(Ku,{text:u}))),l.createElement("span",{id:f,className:"sr-only"},s("qr label")),l.createElement(rL,{variant:"ghost",value:e??"never"})),l.createElement(Sh,{id:"showing auth code"},l.createElement(A2,null,s("auth code message")),l.createElement($2,{code:a,large:!0,classNames:"text-black dark:text-white"}),l.createElement(A2,null,"Be sure the other device is showing this symbol:"),u&&l.createElement(Ku,{text:u})),l.createElement(Sh,{id:"showing final"},d>0?l.createElement(Ve.Check,{className:le("m-1.5",We(6))}):l.createElement(Ve.X,{className:le("m-1.5",We(6))})))),l.createElement(Rt,{classNames:"mbs-4"},l.createElement(qn,{disabled:!n,onClick:()=>t==null?void 0:t({type:"deselectInvitation"})},s("back label"))))},Ch=({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(VU,{disabled:!e,pending:s,validationMessage:a,onConfirm:d,onCancel:n,mode:i})},VU=({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(Bc.Root,{valence:"error"},l.createElement(Bc.Title,null,l.createElement(Ve.Warning,{className:le(We(6),"inline mie-2")}),o("sign out chooser title")),l.createElement(Bc.Body,null,o("sign out chooser message"))),l.createElement(Ju,{validationMessage:t,label:l.createElement(bi,{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:o("confirmation placeholder",{confirmationValue:s}),onChange:({target:{value:u}})=>d(u)})),l.createElement(Rt,null,r&&l.createElement(qn,{disabled:e,onClick:r,"data-testid":`${c}.reset-identity-cancel`},o("cancel label")),i&&l.createElement(qn,{variant:"destructive",disabled:e||n||f!==s,onClick:i,"data-testid":`${c}.reset-identity-confirm`},o(n?"reset in progress label":"reset device label"))))},ml="pbs-1 pbe-3 pli-3",qU=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.hue)||f$((e==null?void 0:e.identityKey.toHex())??"0")},GU=e=>{var n,t;return((t=(n=e==null?void 0:e.profile)==null?void 0:n.data)==null?void 0:t.emoji)||ro((e==null?void 0:e.identityKey.toHex())??"0")},KU=({titleId:e,title:n,identity:t,onDone:i,onUpdateProfile:r,connectionState:a,onChangeConnectionState:o})=>{var C,P;const s=fc(t.identityKey),{t:f}=vn("os"),[d,c]=l.useState(((C=t.profile)==null?void 0:C.displayName)??""),[u,h]=l.useState(GU(t)),[p,g]=l.useState(qU(t)),{textValue:b,setTextValue:w}=uu(),_=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===Zo.ConnectionState.ONLINE;return l.createElement(Yu,{titleId:e,title:n,corner:l.createElement(T2,{onDone:i})},l.createElement(wn.Root,{size:16,variant:"circle",status:O?"active":"error",hue:p||s.hue},l.createElement(go.Root,{classNames:"grid grid-cols-[1fr_var(--rail-action)_min-content_var(--rail-action)_1fr] items-center gap-2"},l.createElement(Qe.Root,null,l.createElement(Qe.Trigger,{asChild:!0},l.createElement(go.Button,{classNames:"bs-[--rail-action] is-[--rail-action] justify-self-end",onClick:()=>o==null?void 0:o(O?Zo.ConnectionState.OFFLINE:Zo.ConnectionState.ONLINE)},l.createElement("span",{className:"sr-only"},f(O?"disconnect label":"connect label")),O?l.createElement(Ve.PlugsConnected,{className:We(5)}):l.createElement(Ve.Plugs,{className:We(5)}))),l.createElement(Qe.Portal,null,l.createElement(Qe.Content,{side:"bottom",classNames:"z-50"},f(O?"disconnect label":"connect label"),l.createElement(Qe.Arrow,null)))),l.createElement(qL,{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(KL,{hue:p,onChangeHue:T,classNames:"bs-[--rail-action]"}),l.createElement(Qe.Root,null,l.createElement(Qe.Trigger,{asChild:!0},l.createElement(go.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(Ve.CopySimple,{className:We(5)}))),l.createElement(Qe.Portal,null,l.createElement(Qe.Content,{side:"bottom",classNames:"z-50"},f(k?"copy success label":"copy self public key label"),l.createElement(Qe.Arrow,null))))),l.createElement(wn.Label,{classNames:"sr-only","data-testid":"identityHeading.displayName"},((P=t.profile)==null?void 0:P.displayName)??Df(t.identityKey.toHex())),l.createElement(yt.Root,null,l.createElement(yt.Label,{srOnly:!0},f("display name input label")),l.createElement(yt.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}))))},I_=e=>{const{identity:n,titleId:t,activeView:i,onUpdateProfile:r,onResetStorage:a,onJoinNewIdentity:o,IdentityActionChooser:s=OU,InvitationManager:f=P_,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(mo,{density:"fine"},l.createElement(KU,{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:ml},l.createElement(s,{active:i==="identity action chooser",...h})),l.createElement(bn.View,{id:"device invitation manager",classNames:ml},l.createElement(f,{active:i==="device invitation manager",...h,invitationUrl:h.createInvitationUrl(h.invitationCode)})),l.createElement(bn.View,{classNames:ml,id:"confirm join new identity"},l.createElement(Ch,{active:i==="confirm join new identity",...h,mode:"join new identity",onConfirm:o,onCancel:b})),l.createElement(bn.View,{classNames:ml,id:"confirm reset storage"},l.createElement(Ch,{active:i==="confirm reset storage",...h,mode:"reset storage",onConfirm:a,onCancel:b})))))},YU=({invitation:e,...n})=>{const t=Gu(e);return l.createElement(I_,{...n,...t})},JU=({titleId:e,createInvitationUrl:n=r=>r,initialDisposition:t="default",...i})=>{const r=$n("identityPanel__heading",e),a=je.useClient(),o=pt.useDevices(),s=pt.useIdentity(),f=pt.useHaloInvitations(),d=IU({identity:s,invitations:f});if(!s)return Ge.error("IdentityPanel rendered with no active identity."),null;const[c,u,h]=AU(a,{context:{initialDisposition:t}}),{swarm:p}=Zo.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(YU,{..._,invitation:c.context.invitation}):l.createElement(I_,{..._})},XU=l.forwardRef(({mode:e,titleId:n,onExit:t,exitActionParent:i},r)=>{const{t:a}=vn("os"),o=l.createElement(Rn,{variant:"ghost",...t&&{onClick:t},classNames:le(Fn,"plb-0 pli-2 absolute block-start-0 inline-end-0 z-[1]"),"data-testid":"join-exit"},l.createElement(Ve.X,{weight:"bold",className:We(4)}),l.createElement("span",{className:"sr-only"},a("exit label")));return l.createElement(Yu,{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"})}),F_=(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 je.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)))}),M_=(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:[lt({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],failReason:r.reason})}),"log"]}}}},on:{[`set${e}InvitationCode`]:{target:`.acceptingRedeemed${e}Invitation`,actions:[lt({[e.toLowerCase()]:(i,r)=>({...i[e.toLowerCase()],unredeemedCode:r.code,succeededKeys:r.succeededKeys})}),`redeem${e}InvitationCode`,`invalidate${e}InvitationCode`,"log"]}}}),ZU=kh({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:M_("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:M_("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:lt({identity:(e,n)=>n.identity}),unsetIdentity:lt({identity:()=>null}),resetInvitation:lt({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:lt({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})}}}),N_=(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}},QU=(e,n)=>{const t=l.useCallback(({halo:o})=>{if(o.unredeemedCode)try{const s=Ei.InvitationEncoder.decode(N_("halo",o.unredeemedCode)),f=e.halo.join(s);return{...o,invitationObservable:f,invitationSubscribable:F_("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=Ei.InvitationEncoder.decode(N_("space",o.unredeemedCode)),f=e.spaces.join(s);return{...o,invitationObservable:f,invitationSubscribable:F_("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 xh(ZU,{...n,actions:{...n==null?void 0:n.actions,redeemHaloInvitationCode:lt({halo:t}),redeemSpaceInvitationCode:lt({space:i}),invalidateHaloInvitationCode:lt({halo:r}),invalidateSpaceInvitationCode:lt({space:a})}})},ez=e=>{const n=!e.active,{send:t}=e,{t:i}=vn("os"),r={disabled:n,after:l.createElement(Ve.CaretRight,{className:We(4),weight:"bold"}),slots:{label:{className:"text-sm"}}};return l.createElement(l.Fragment,null,l.createElement(bi,null,i("addition method chooser title")),l.createElement("div",{role:"none",className:"flex flex-col gap-1 grow"},l.createElement(vu,{...r,description:i("create identity description"),before:l.createElement(Ve.Plus,{className:We(6)}),onClick:()=>t({type:"createIdentity"}),"data-autofocus":"choosingAuthMethod","data-testid":"identity-chooser.create-identity"},i("create identity label")),l.createElement(vu,{...r,description:i("join identity description"),before:l.createElement(Ve.QrCode,{className:We(6)}),onClick:()=>t({type:"acceptHaloInvitation"}),"data-testid":"identity-chooser.join-identity"},i("join identity label")),l.createElement(vu,{...r,disabled:!0,description:i("recover identity description"),before:l.createElement(Ve.Textbox,{className:We(6)}),onClick:()=>t({type:"recoverIdentity"}),"data-testid":"identity-chooser.recover-identity"},i("recover identity label"))))},nz=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=wg(d),u=$n("identityListItem__label"),h=((g=t==null?void 0:t.profile)==null?void 0:g.displayName)??(t&&Df(d)),p=l.createElement(qn,{...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(bi,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(Rt,null,n==="halo-only"?o?l.cloneElement(o,{},p):p:l.createElement(qn,{variant:"primary",disabled:s||!t,onClick:()=>t&&r({type:"selectIdentity",identity:t}),"data-autofocus":"confirmingAddedIdentity"},f("continue label"))))},tz=e=>{const{send:n,method:t}=e,i=t==="recover identity",r=je.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(iz,{...e,onDisplayNameConfirm:f,validationMessage:o})},iz=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(Ju,{validationMessage:a,label:l.createElement(bi,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(Rt,null,l.createElement(qn,{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(qn,{variant:"primary",disabled:o,onClick:()=>r==null?void 0:r(f),"data-testid":`${n==="recover identity"?"recover":"create"}-identity-input-continue`},s("continue label"))))},D_=e=>{const{active:n,Kind:t,doneActionParent:i,onDone:r}=e,a=!n,{t:o}=vn("os"),s=l.createElement(qn,{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(Rt,null,i?l.cloneElement(i,{},s):s))},rz=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}},L_=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:rz(h),...n==="Space"&&{succeededKeys:d}})},b=l.createElement(qn,{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(Ju,{label:l.createElement(bi,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(Rt,null,n==="Halo"?l.createElement(qn,{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(qn,{variant:"primary",disabled:c,onClick:g,"data-testid":`${n.toLowerCase()}-invitation-input-continue`},u("continue label"))))},az=({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(bi,{className:Fn},o(a==="timeout"?"timeout status label":a==="cancelled"?"cancelled status label":"error status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(Rt,null,l.createElement(qn,{disabled:!t,onClick:()=>i({type:`reset${r}Invitation`}),"data-testid":"invitation-rescuer-reset"},o("reset label")))):l.createElement(l.Fragment,null,l.createElement(bi,{className:Fn},o("connecting status label")),l.createElement("div",{role:"none",className:"grow"}),l.createElement(Rt,null,l.createElement(qn,{disabled:!0,classNames:"order-2","data-testid":"next"},o("next label")),l.createElement(qn,{disabled:!t,onClick:n,"data-testid":"invitation-rescuer-cancel"},o("cancel label"))))},B_=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(bi,{className:Fn},"There was a problem joining the space")),l.createElement(Rt,null,l.createElement(qn,{disabled:!i,"data-testid":"invitation-rescuer-blank-reset",onClick:()=>r({type:`reset${n}Invitation`})},a("reset label")))):l.createElement(az,{...e}))},j_=6,R_=({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===j_&&((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(Ku,{text:ro(r)}),l.createElement(yt.Root,{...e&&{validationValence:"error"}},l.createElement(yt.Label,{asChild:!0},l.createElement(bi,null,f("auth code input label"))),l.createElement(yt.PinInput,{disabled:s,length:j_,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(yt.DescriptionAndValidation,{classNames:"text-center"},l.createElement(yt.Validation,null,f("failed to authenticate message"))))),l.createElement(Rt,null,l.createElement(qn,{variant:"ghost",disabled:s,onClick:()=>o==null?void 0:o(),"data-testid":`${d}-invitation-authenticator-cancel`},f("cancel label")),l.createElement(qn,{variant:"primary",disabled:s,onClick:()=>a==null?void 0:a(c),"data-autofocus-pinlength":d,"data-testid":`${d}-invitation-authenticator-next`},f("next label"))))},dt="pbs-1 pbe-3 pli-3",oz=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=tz,ConfirmReset:O=Ch}=e;return l.createElement(mo,{density:"fine"},a!=="halo-only"&&l.createElement(XU,{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:dt,id:"addition method chooser"},l.createElement(ez,{send:t,active:i==="addition method chooser"})),l.createElement(bn.View,{classNames:dt,id:"reset storage confirmation"},l.createElement(O,{send:t,active:i==="reset storage confirmation",onCancel:E,onConfirm:S})),l.createElement(bn.View,{classNames:dt,id:"create identity input"},l.createElement(T,{send:t,method:"create identity",active:i==="create identity input"})),l.createElement(bn.View,{classNames:dt,id:"recover identity input"},l.createElement(T,{send:t,method:"recover identity",active:i==="recover identity input"})),l.createElement(bn.View,{classNames:dt,id:"halo invitation input"},l.createElement(L_,{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:dt,id:"halo invitation rescuer"},l.createElement(B_,{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:dt,id:"halo invitation authenticator"},l.createElement(R_,{send:t,Kind:"Halo",active:i==="halo invitation authenticator",onInvitationCancel:b,onInvitationAuthenticate:_,...r.has("Halo")&&{failed:!0}})),l.createElement(bn.View,{classNames:dt,id:"halo invitation accepted"},l.createElement(D_,{send:t,Kind:"Halo",active:i==="halo invitation accepted",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:dt,id:"identity added"},l.createElement(nz,{send:t,mode:a,active:i==="identity added",doneActionParent:g,onDone:u})),l.createElement(bn.View,{classNames:dt,id:"space invitation input"},l.createElement(L_,{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:dt,id:"space invitation rescuer"},l.createElement(B_,{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:dt,id:"space invitation authenticator"},l.createElement(R_,{send:t,Kind:"Space",active:i==="space invitation authenticator",onInvitationCancel:w,onInvitationAuthenticate:k,...r.has("Space")&&{failed:!0}})),l.createElement(bn.View,{classNames:dt,id:"space invitation accepted"},l.createElement(D_,{send:t,Kind:"Space",active:i==="space invitation accepted",doneActionParent:g,onDone:h})))))},sz=({titleId:e,mode:n="default",initialDisposition:t="default",initialInvitationCode:i,exitActionParent:r,onExit:a,doneActionParent:o,onDone:s,onCancelResetStorage:f})=>{const d=je.useClient(),c=pt.useIdentity(),{hasIosKeyboard:u}=Te(),h=$n("joinPanel__heading",e),[p,g,b]=QU(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=je.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(oz,{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})},fz=kh({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:lt({invitation:(e,n)=>(n==null?void 0:n.invitation)??null}),unsetInvitation:lt({invitation:()=>{}}),log:(e,n)=>{Ge("[transition]",{event:n,context:e})}}}),lz=e=>xh(fz,{...e,context:{...e==null?void 0:e.context}}),U_="dxos:react-shell/space-manager/active-action",dz=e=>{const{space:n,target:t}=e,{t:i}=vn("os"),r=je.useConfig(),a=Xo.useSpaceInvitations(n==null?void 0:n.key),o=l.useCallback(f=>{const d=Ei.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:Ve.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:Ve.UsersThree,onClick:l.useCallback(()=>{var d,c,u,h;const f=(d=n.share)==null?void 0:d.call(n,{type:Se.Type.DELEGATED,authMethod:Se.AuthMethod.KNOWN_PUBLIC_KEY,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(cz,{...e,invitations:a,inviteActions:s})},z_="pis-3 pie-1 plb-1 mbe-1 font-medium",cz=e=>{const{active:n,space:t,createInvitationUrl:i,send:r,inviteActions:a,invitations:o,showInactiveInvitations:s,SpaceMemberList:f=JL,InvitationList:d=xj}=e,{t:c}=vn("os"),u=a??{noopInvite:{label:c("create space invitation label"),description:"",icon:Ve.Placeholder,onClick:()=>{}}},[h,p]=l.useState(localStorage.getItem(U_)??"inviteOne"),g=w=>{p(w),localStorage.setItem(U_,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(ff.Root,{classNames:"grow shrink basis-28 -mli-2"},l.createElement(ff.Viewport,{classNames:"is-full pie-2"},!!(b!=null&&b.length)&&l.createElement(l.Fragment,null,l.createElement("h3",{className:le(z_,Fn)},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(z_,Fn,"mbs-2")},c("space member list heading"))),l.createElement(f,{spaceKey:t.key,includeSelf:!0})),l.createElement(ff.Scrollbar,{orientation:"vertical"},l.createElement(ff.Thumb,null))),l.createElement(Rt,null,l.createElement(Sj,{disabled:!n,actions:u,activeAction:h,onChangeActiveAction:g,"data-testid":"spaces-panel.create-invitation"})))},uz=({titleId:e,space:n,onDone:t})=>{const{t:i}=vn("os"),r=n.properties.name;return l.createElement(Yu,{titleId:e,title:i("space panel heading"),corner:l.createElement(T2,{"data-testid":"identity-panel-done",onDone:t})},l.createElement("div",{role:"none",className:"flex gap-4 items-center justify-center mlb-4"},l.createElement(Ve.Planet,{size:32,weight:"light"}),l.createElement("div",{className:"block text-start font-light text-xl"},r??n.key.truncate())))},W_=e=>{const{titleId:n,activeView:t,space:i,target:r,SpaceManager:a=dz,InvitationManager:o=P_,...s}=e;return l.createElement(mo,{density:"fine"},l.createElement(uz,{...s,titleId:n,space:i}),l.createElement(bn.Root,{activeView:t},l.createElement(bn.Views,null,l.createElement(bn.View,{id:"space manager",classNames:dt},l.createElement(a,{active:t==="space manager",space:i,target:r,...s})),l.createElement(bn.View,{id:"space invitation manager",classNames:dt},l.createElement(o,{active:t==="space invitation manager",...s,invitationUrl:e.invitationUrl})))))},hz=({invitation:e,...n})=>{const t=Gu(e);return l.createElement(W_,{...n,...t,invitationUrl:n.createInvitationUrl(t.invitationCode)})},vz=({titleId:e,createInvitationUrl:n=i=>i,...t})=>{const i=$n("spacePanel__heading",e),[r,a,o]=lz({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(hz,{...f,invitation:r.context.invitation}):l.createElement(W_,{...f})},pz=({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(FO,{indeterminate:!0},n("resetting message")))},mz=e=>{const n=$n("identityDialog__title",e.title);return l.createElement(ft.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(ft.Portal,null,l.createElement(ft.Overlay,null,l.createElement(ft.Content,{"aria-labelledby":n,onOpenAutoFocus:t=>t.preventDefault()},l.createElement(hu,null,l.createElement(JU,{...e,titleId:n,doneActionParent:l.createElement(ft.Close,{asChild:!0})}))))))},H_=e=>{const n=$n("joinDialog__title"),{height:t}=bA();return l.createElement(Qt.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(Qt.Portal,null,l.createElement(Qt.Overlay,{classNames:"backdrop-blur",...t&&{style:{blockSize:`${t}px`}}},l.createElement(Qt.Content,{"aria-labelledby":n},l.createElement(sz,{...e,titleId:n,exitActionParent:l.createElement(Qt.Cancel,{asChild:!0}),doneActionParent:l.createElement(Qt.Action,{asChild:!0})})))))};var gl,bl=xi;if(process.env.NODE_ENV==="production")gl=bl.createRoot,bl.hydrateRoot;else{var V_=bl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;gl=function(e,n){V_.usingClientEntryPoint=!0;try{return bl.createRoot(e,n)}finally{V_.usingClientEntryPoint=!1}}}var $h={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,ze){var y={};for(var v in Ee)ze[v]&&ze[v].length%2===0?y[v]=ze[v].concat(Ee[v]):y[v]=Ee[v];return y},M=function(Ee){for(var ze={},y=0;y<Ee.length;y++)ze[Ee[y].toUpperCase()]=Ee[y];return ze},Z=function(Ee,ze){return typeof Ee===c?te(ze).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,ze){if(typeof Ee===c)return Ee=Ee.replace(/^\s\s*/,a),typeof ze===f?Ee:Ee.substring(0,P)},ke=function(Ee,ze){for(var y=0,v,m,x,A,D,z;y<ze.length&&!D;){var be=ze[y],Fe=ze[y+1];for(v=m=0;v<be.length&&!D&&be[v];)if(D=be[v++].exec(Ee),D)for(x=0;x<Fe.length;x++)z=D[++m],A=Fe[x],typeof A===d&&A.length>0?A.length===2?typeof A[1]==s?this[A[0]]=A[1].call(this,z):this[A[0]]=A[1]:A.length===3?typeof A[1]===s&&!(A[1].exec&&A[1].test)?this[A[0]]=z?A[1].call(this,z,A[2]):i:this[A[0]]=z?z.replace(A[1],A[2]):i:A.length===4&&(this[A[0]]=z?A[3].call(this,z.replace(A[1],A[2])):i):this[A]=z||i;y+=2}},xe=function(Ee,ze){for(var y in ze)if(typeof ze[y]===d&&ze[y].length>0){for(var v=0;v<ze[y].length;v++)if(Z(ze[y][v],Ee))return y===o?i:y}else if(Z(ze[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]]},Oe=function(Ee,ze){if(typeof Ee===d&&(ze=Ee,Ee=i),!(this instanceof Oe))return new Oe(Ee,ze).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=ze?I(an,ze):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};Oe.VERSION=r,Oe.BROWSER=M([p,w,u]),Oe.CPU=M([_]),Oe.DEVICE=M([h,b,g,k,E,T,S,O,C]),Oe.ENGINE=Oe.OS=M([p,w]),e.exports&&(n=e.exports=Oe),n.UAParser=Oe;var He=typeof t!==f&&(t.jQuery||t.Zepto);if(He&&!He.ua){var _n=new Oe;He.ua=_n.getResult(),He.ua.get=function(){return _n.getUA()},He.ua.set=function(Ee){_n.setUA(Ee);var ze=_n.getResult();for(var y in ze)He.ua[y]=ze[y]}}})(typeof window=="object"?window:mn)})($h,$h.exports);var gz=$h.exports,yl="/home/runner/work/dxos/dxos/packages/core/mesh/rpc-tunnel/src/ports/iframe.ts",Th,Ah;if(typeof navigator<"u"){const e=new gz.UAParser(navigator.userAgent);Th=e.getBrowser().name,Ah=e.getOS().name}var bz=(e,n,t)=>{if(!e.contentWindow){Ge("IFrame content window missing",{origin:n},{F:yl,L:24,S:void 0,C:(i,r)=>i(...r)});return}Th==="Chrome"&&Ah==="iOS"?e.contentWindow.postMessage(t,n):e.contentWindow.postMessage(t,n,[t.payload])},yz=(e,n)=>{Th==="Chrome"&&Ah==="iOS"?window.parent.postMessage(n,e):window.parent.postMessage(n,e,[n.payload])},q_=({channel:e,iframe:n,origin:t,onOrigin:i})=>({send:async r=>{if(!t){Ge("no origin set",{channel:e},{F:yl,L:62,S:void 0,C:(s,f)=>s(...f)});return}Ge("sending",{channel:e,data:r.length},{F:yl,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?bz(n,t,o):yz(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:yl,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 wz=e=>{const n=$n("spaceDialog__title");return l.createElement(ft.Root,{defaultOpen:!0,onOpenChange:t=>{var i;return t||((i=e.onDone)==null?void 0:i.call(e))}},l.createElement(ft.Portal,null,l.createElement(ft.Overlay,null,l.createElement(ft.Content,{"aria-labelledby":n},l.createElement(hu,null,l.createElement(vz,{...e,titleId:n,doneActionParent:l.createElement(ft.Close,{asChild:!0})}))))))},_z=()=>{const e=$n("statusDialog__title");return l.createElement(Qt.Root,{open:!0},l.createElement(Qt.Portal,null,l.createElement(Qt.Overlay,null,l.createElement(Qt.Content,{"aria-labelledby":e},l.createElement(pz,{titleId:e})))))},kz=({runtime:e})=>{const[{layout:n,invitationCode:t,spaceKey:i,target:r},a]=l.useState({layout:e.layout,invitationCode:e.invitationCode,spaceKey:e.spaceKey,target:e.target}),[{invitationUrl:o,deviceInvitationParam:s,spaceInvitationParam:f},d]=l.useState({invitationUrl:e.invitationUrl,deviceInvitationParam:e.deviceInvitationParam,spaceInvitationParam:e.spaceInvitationParam}),c=je.useClient(),u=Xo.useSpace(i),h=g=>{const b=new URL(o);return b.searchParams.set(s,g),b.toString()},p=g=>{const b=new URL(o);return b.searchParams.set(f,g),b.toString()};switch(l.useEffect(()=>{const g=e.layoutUpdate.on(w=>a(w)),b=e.invitationUrlUpdate.on(w=>d(w));return()=>{g(),b()}},[e]),l.useEffect(()=>{if(n===je.ShellLayout.SPACE&&!u){Ge.warn("No space found for shell space invitations.");const g=setTimeout(async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})});return()=>clearTimeout(g)}},[e,n,u]),n){case je.ShellLayout.STATUS:return l.createElement(_z,null);case je.ShellLayout.INITIALIZE_IDENTITY:case je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION:return l.createElement(H_,{mode:"halo-only",initialDisposition:n===je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION?"accept-halo-invitation":"default",initialInvitationCode:t,onCancelResetStorage:()=>e.setLayout({layout:je.ShellLayout.IDENTITY}),onDone:()=>{e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}});case je.ShellLayout.IDENTITY:case je.ShellLayout.SHARE_IDENTITY:case je.ShellLayout.EDIT_PROFILE:return l.createElement(mz,{createInvitationUrl:h,onResetStorage:async()=>(e.setLayout({layout:je.ShellLayout.STATUS}),await c.reset(),e.setAppContext({display:je.ShellDisplay.NONE,reload:!0})),onJoinNewIdentity:async()=>(e.setLayout({layout:je.ShellLayout.STATUS}),await c.reset(),e.setLayout({layout:je.ShellLayout.INITIALIZE_IDENTITY_FROM_INVITATION})),onDone:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})},initialDisposition:n===je.ShellLayout.SHARE_IDENTITY?"manage-device-invitation":"default"});case je.ShellLayout.SPACE:return u?l.createElement(wz,{space:u,target:r,createInvitationUrl:p,onDone:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}}):null;case je.ShellLayout.JOIN_SPACE:return l.createElement(H_,{initialInvitationCode:t,onDone:async g=>{const b=(g==null?void 0:g.target)??void 0;await e.setAppContext({display:je.ShellDisplay.NONE,spaceKey:(g==null?void 0:g.spaceKey)??void 0,target:b}),e.setLayout({layout:je.ShellLayout.DEFAULT})},onExit:async()=>{await e.setAppContext({display:je.ShellDisplay.NONE}),e.setLayout({layout:je.ShellLayout.DEFAULT})}});default:return null}},G_={"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":"Single-use invitation","invite one description":"Only one user may join.","invite one qr label":"Single-use invitation","invite one list item label":"Active single-use invitation","invite many label":"Standing invitation","invite many description":"Anyone with the link can join.","invite many qr label":"Standing invitation","invite many list item label":"Active standing invitation","invite options label":"Change the active invite option.","reset in progress label":"Resetting...","confirm label":"Confirm","reset storage input label":"WARNING: This will delete all data on this device. Type {{confirmationValue}} to continue.","join new identity input label":"WARNING: To join an existing device all data on this device will be deleted. Type {{confirmationValue}} to continue.","failed to reset identity message":"Failed to reset identity.","confirmation value":"RESET","confirmation placeholder":"Enter {{confirmationValue}} to continue.","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 the device is 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"}))},xz=async(e=new je.Config)=>{const n=new X_.ShellRuntimeImpl(q_({channel:Ei.DEFAULT_SHELL_CHANNEL}));await n.open();try{const t=new je.ClientServicesProxy(q_({channel:Ei.DEFAULT_CLIENT_CHANNEL})),i=new je.Client({config:e,services:t});await i.initialize(),gl(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(sb,{tx:yy,resourceExtensions:[G_]},l.createElement(je.ClientContext.Provider,{value:{client:i,status:je.SystemStatus.ACTIVE}},l.createElement(hu,null,l.createElement(Qe.Provider,null,l.createElement(je.AgentHostingProvider,null,l.createElement(kz,{runtime:n}))))))))}catch{gl(document.getElementById("root")).render(l.createElement(l.StrictMode,null,l.createElement(sb,{tx:yy,resourceExtensions:[G_]},l.createElement(Ez,{onClose:()=>n.setAppContext({display:je.ShellDisplay.NONE})}))))}},Ez=({onClose:e})=>{const{t:n}=vn("os");return l.createElement(ft.Root,{modal:!0,open:!0,onOpenChange:()=>e==null?void 0:e()},l.createElement(ft.Overlay,null,l.createElement(ft.Content,null,l.createElement(ft.Title,null,n("shell fallback title")),l.createElement(ft.Close,{asChild:!0,onClick:()=>e==null?void 0:e()},l.createElement(Rn,{variant:"primary"},n("close label"))))))};l.createContext({}),at.runShell=xz,Object.defineProperty(at,Symbol.toStringTag,{value:"Module"})});
947
947
  //# sourceMappingURL=shell.umd.js.map