@ours.network/cowork 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@ ours-cowork docs
9
9
 
10
10
  `ours-cowork web` starts the daemon if it is absent, waits for the console, and opens `http://127.0.0.1:3052/`. Create a room with a friendly display name first, then add each invitation requirement from its Invite panel. Names are trimmed, normalized to Unicode NFC, and may contain 1–64 Unicode characters excluding control and format characters. Duplicate names are allowed. The Communication view contains the human-readable room chat; operational records remain in Events and the complete ordered stream remains in Archive.
11
11
 
12
- The friendly `room_name` is presentation metadata. The opaque `room_id` remains the stable key for routing, URLs, storage, and identity correlation, and the underlying technical room identity is never renamed. Rooms created before friendly names existed migrate deterministically to `Room <first 8 room_id characters>`.
12
+ The friendly `room_name` is presentation metadata. New rooms announce the technical identity `ours-cowork-room:<initial room_name>`; that authenticated announced name is frozen when the display name later changes. Duplicate display and announced names are allowed because identity CIDs, not names, are the authorization and routing keys. The opaque `room_id` remains the stable key for URLs, storage, and identity correlation. Existing `cowork-room-<room_id>` identities are never renamed or recreated, and rooms created before friendly names existed migrate only their display metadata to `Room <first 8 room_id characters>`.
13
13
 
14
14
  The localhost HTTP console has no authentication. Keep it bound to `127.0.0.1`; do not proxy, forward, or expose the port to other hosts. Room state is refreshed by periodic polling, not pushed to the browser.
15
15
 
package/dist/cli.js CHANGED
@@ -4327,6 +4327,13 @@ var RoomNameSchema = external_exports.string().refine(
4327
4327
  });
4328
4328
  }
4329
4329
  });
4330
+ var ROOM_IDENTITY_PREFIX = "ours-cowork-room:";
4331
+ function roomIdentityName(roomName) {
4332
+ return `${ROOM_IDENTITY_PREFIX}${RoomNameSchema.parse(roomName)}`;
4333
+ }
4334
+ function legacyRoomIdentityName(roomId) {
4335
+ return `cowork-room-${LowerCrockfordUlidSchema.parse(roomId)}`;
4336
+ }
4330
4337
  var RoleSchema = utf8Bounded("role", MAX_ROLE_BYTES);
4331
4338
  var MissionTextSchema = utf8Bounded("mission text", MAX_TEXT_BYTES);
4332
4339
  var MessageTextSchema = utf8Bounded("message text", MAX_TEXT_BYTES);
@@ -4471,8 +4478,9 @@ var RoleBriefingSchema = external_exports.object({
4471
4478
  updated_at: Rfc3339Schema
4472
4479
  }).strict();
4473
4480
  function refineRoomLineage(room, context) {
4474
- const pendingIdentityName = `cowork-room-${room.room_id}`;
4475
- const exactPacketPending = room.state === "provisioning" && room.status === "packet_pending" && room.identity_name === pendingIdentityName && room.invites.length === 0 && room.seats.length === 0 && room.activated_at === void 0 && room.closed_at === void 0;
4481
+ const pendingIdentityName = legacyRoomIdentityName(room.room_id);
4482
+ const currentPendingIdentityName = room.room_name === void 0 ? void 0 : roomIdentityName(room.room_name);
4483
+ const exactPacketPending = room.state === "provisioning" && room.status === "packet_pending" && (room.identity_name === pendingIdentityName || room.identity_name === currentPendingIdentityName) && room.invites.length === 0 && room.seats.length === 0 && room.activated_at === void 0 && room.closed_at === void 0;
4476
4484
  if (room.identity_cid === "" && !exactPacketPending) {
4477
4485
  context.addIssue({
4478
4486
  code: external_exports.ZodIssueCode.custom,
package/dist/daemon.js CHANGED
@@ -4796,9 +4796,16 @@ function isStrictRfc3339(value) {
4796
4796
  function normalizeRoomName(value) {
4797
4797
  return value.trim().normalize("NFC");
4798
4798
  }
4799
+ function roomIdentityName(roomName) {
4800
+ return `${ROOM_IDENTITY_PREFIX}${RoomNameSchema.parse(roomName)}`;
4801
+ }
4802
+ function legacyRoomIdentityName(roomId) {
4803
+ return `cowork-room-${LowerCrockfordUlidSchema.parse(roomId)}`;
4804
+ }
4799
4805
  function refineRoomLineage(room, context) {
4800
- const pendingIdentityName = `cowork-room-${room.room_id}`;
4801
- const exactPacketPending = room.state === "provisioning" && room.status === "packet_pending" && room.identity_name === pendingIdentityName && room.invites.length === 0 && room.seats.length === 0 && room.activated_at === void 0 && room.closed_at === void 0;
4806
+ const pendingIdentityName = legacyRoomIdentityName(room.room_id);
4807
+ const currentPendingIdentityName = room.room_name === void 0 ? void 0 : roomIdentityName(room.room_name);
4808
+ const exactPacketPending = room.state === "provisioning" && room.status === "packet_pending" && (room.identity_name === pendingIdentityName || room.identity_name === currentPendingIdentityName) && room.invites.length === 0 && room.seats.length === 0 && room.activated_at === void 0 && room.closed_at === void 0;
4802
4809
  if (room.identity_cid === "" && !exactPacketPending) {
4803
4810
  context.addIssue({
4804
4811
  code: external_exports.ZodIssueCode.custom,
@@ -4924,7 +4931,7 @@ function refineMessageCategory(message, context) {
4924
4931
  }
4925
4932
  }
4926
4933
  }
4927
- var MAX_TEXT_BYTES, MAX_FILE_BYTES, MAX_HISTORY_PAGE_BYTES, MAX_MANAGEMENT_RESPONSE_BYTES, MAX_FILE_NAME_BYTES, MAX_MIME_BYTES, MAX_ROLE_BYTES, MAX_ROOM_NAME_CHARACTERS, NonEmptyStringSchema, PositiveSafeIntegerSchema, LowerCrockfordUlidSchema, Rfc3339Schema, RoomNameSchema, RoleSchema, MissionTextSchema, MessageTextSchema, FileNameSchema, FileMimeSchema, RoomStateSchema, SeatStateSchema, InviteModeSchema, DEFAULT_ROLE, InviteStateSchema, RelayStatusSchema, SeatV1Schema, SeatSchema, RoomInviteSchema, MissionV1Schema, MissionSchema, RoleBriefingSchema, RoomCommonShape, RoomV1Schema, CurrentRoomSchema, RoomSchema, CreateRoomInputSchema, UpdateRoomInputSchema, RoleBriefingSetInputSchema, RoleBriefingDeleteInputSchema, PostMessageInputSchema, AuthorSnapshotSchema, RecordCommonShape, AppendCommonShape, MembershipNoticeSchema, AuthorAliasSchema, MessageShape, RelayIntentShape, RelayResultStatusSchema, RelayResultShape, FileShape, MembershipIntentShape, MembershipResultShape, CloseNoticeIntentShape, CloseNoticeResultShape, MessageRecordSchema, FileRecordSchema, RelayIntentRecordSchema, RelayResultRecordSchema, MembershipIntentRecordSchema, MembershipResultRecordSchema, CloseNoticeIntentRecordSchema, CloseNoticeResultRecordSchema, RawCommunicationRecordSchema, CommunicationRecordSchema, AppendRecordSchema;
4934
+ var MAX_TEXT_BYTES, MAX_FILE_BYTES, MAX_HISTORY_PAGE_BYTES, MAX_MANAGEMENT_RESPONSE_BYTES, MAX_FILE_NAME_BYTES, MAX_MIME_BYTES, MAX_ROLE_BYTES, MAX_ROOM_NAME_CHARACTERS, NonEmptyStringSchema, PositiveSafeIntegerSchema, LowerCrockfordUlidSchema, Rfc3339Schema, RoomNameSchema, ROOM_IDENTITY_PREFIX, RoleSchema, MissionTextSchema, MessageTextSchema, FileNameSchema, FileMimeSchema, RoomStateSchema, SeatStateSchema, InviteModeSchema, DEFAULT_ROLE, InviteStateSchema, RelayStatusSchema, SeatV1Schema, SeatSchema, RoomInviteSchema, MissionV1Schema, MissionSchema, RoleBriefingSchema, RoomCommonShape, RoomV1Schema, CurrentRoomSchema, RoomSchema, CreateRoomInputSchema, UpdateRoomInputSchema, RoleBriefingSetInputSchema, RoleBriefingDeleteInputSchema, PostMessageInputSchema, AuthorSnapshotSchema, RecordCommonShape, AppendCommonShape, MembershipNoticeSchema, AuthorAliasSchema, MessageShape, RelayIntentShape, RelayResultStatusSchema, RelayResultShape, FileShape, MembershipIntentShape, MembershipResultShape, CloseNoticeIntentShape, CloseNoticeResultShape, MessageRecordSchema, FileRecordSchema, RelayIntentRecordSchema, RelayResultRecordSchema, MembershipIntentRecordSchema, MembershipResultRecordSchema, CloseNoticeIntentRecordSchema, CloseNoticeResultRecordSchema, RawCommunicationRecordSchema, CommunicationRecordSchema, AppendRecordSchema;
4928
4935
  var init_contracts = __esm({
4929
4936
  "src/contracts.ts"() {
4930
4937
  "use strict";
@@ -4956,6 +4963,7 @@ var init_contracts = __esm({
4956
4963
  });
4957
4964
  }
4958
4965
  });
4966
+ ROOM_IDENTITY_PREFIX = "ours-cowork-room:";
4959
4967
  RoleSchema = utf8Bounded("role", MAX_ROLE_BYTES);
4960
4968
  MissionTextSchema = utf8Bounded("mission text", MAX_TEXT_BYTES);
4961
4969
  MessageTextSchema = utf8Bounded("message text", MAX_TEXT_BYTES);
@@ -6730,12 +6738,13 @@ var init_service = __esm({
6730
6738
  async createRoom(input) {
6731
6739
  const settings = CreateRoomInputSchema.parse(input);
6732
6740
  const roomId = LowerCrockfordUlidSchema.parse(this.nextRoomId());
6733
- const identityName = `cowork-room-${roomId}`;
6741
+ const roomName = settings.name ?? defaultRoomName(roomId);
6742
+ const identityName = roomIdentityName(roomName);
6734
6743
  return this.lock(roomId, async () => {
6735
6744
  const provisional = RoomSchema.parse({
6736
6745
  version: 2,
6737
6746
  room_id: roomId,
6738
- room_name: settings.name ?? defaultRoomName(roomId),
6747
+ room_name: roomName,
6739
6748
  identity_name: identityName,
6740
6749
  // PacketRegistry needs the durable room directory to exist first. A
6741
6750
  // valid, explicitly provisional value lets startup resume this exact
@@ -7691,7 +7700,7 @@ var init_service = __esm({
7691
7700
  }
7692
7701
  }
7693
7702
  isPacketPending(room) {
7694
- return room.identity_cid === "" && room.state === "provisioning" && room.status === "packet_pending" && room.identity_name === `cowork-room-${room.room_id}`;
7703
+ return room.identity_cid === "" && room.state === "provisioning" && room.status === "packet_pending" && (room.identity_name === legacyRoomIdentityName(room.room_id) || room.identity_name === roomIdentityName(room.room_name));
7695
7704
  }
7696
7705
  now() {
7697
7706
  return external_exports.string().datetime({ offset: true }).parse(this.nowValue());
@@ -37,4 +37,4 @@ var Kf=Object.defineProperty;var Xf=(o,c,u)=>c in o?Kf(o,c,{enumerable:!0,config
37
37
  `+i[s].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),f}while(1<=s&&0<=d);break}}}finally{ne=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?j(e):""}function ae(e){switch(e.tag){case 5:return j(e.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 2:case 15:return e=re(e.type,!1),e;case 11:return e=re(e.type.render,!1),e;case 1:return e=re(e.type,!0),e;default:return""}}function ie(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Re:return"Fragment";case pe:return"Portal";case te:return"Profiler";case Ee:return"StrictMode";case Te:return"Suspense";case it:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ke:return(e.displayName||"Context")+".Consumer";case Ye:return(e._context.displayName||"Context")+".Provider";case rt:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ot:return t=e.displayName||null,t!==null?t:ie(e.type)||"Memo";case Xe:t=e._payload,e=e._init;try{return ie(e(t))}catch{}}return null}function fe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ie(t);case 8:return t===Ee?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ue(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function se(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _e(e){var t=se(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,l=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,l.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function et(e){e._valueTracker||(e._valueTracker=_e(e))}function mi(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=se(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function lt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Wn(e,t){var n=t.checked;return V({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function wr(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ue(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function xr(e,t){t=t.checked,t!=null&&le(e,"checked",t,!1)}function qn(e,t){xr(e,t);var n=ue(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?It(e,t.type,n):t.hasOwnProperty("defaultValue")&&It(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Sr(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function It(e,t,n){(t!=="number"||lt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Fe=Array.isArray;function Nt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ue(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function en(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(u(91));return V({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ht(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(u(92));if(Fe(n)){if(1<n.length)throw Error(u(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ue(n)}}function Cn(e,t){var n=ue(t.value),r=ue(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function hi(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Se(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function tn(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Se(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var nn,We=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(nn=nn||document.createElement("div"),nn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=nn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},de=["Webkit","ms","Moz","O"];Object.keys(Nn).forEach(function(e){de.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nn[t]=Nn[e]})});function vi(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Nn.hasOwnProperty(e)&&Nn[e]?(""+t).trim():t+"px"}function yi(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=vi(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var Do=V({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function kr(e,t){if(t){if(Do[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(u(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(u(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(u(61))}if(t.style!=null&&typeof t.style!="object")throw Error(u(62))}}function Er(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cr=null;function jr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qn=null,x=null,A=null;function F(e){if(e=Yr(e)){if(typeof Qn!="function")throw Error(u(280));var t=e.stateNode;t&&(t=Ui(t),Qn(e.stateNode,e.type,t))}}function J(e){x?A?A.push(e):A=[e]:x=e}function Y(){if(x){var e=x,t=A;if(A=x=null,F(e),t)for(e=0;e<t.length;e++)F(t[e])}}function me(e,t){return e(t)}function he(){}var mt=!1;function Wt(e,t,n){if(mt)return e(t,n);mt=!0;try{return me(e,t,n)}finally{mt=!1,(x!==null||A!==null)&&(he(),Y())}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=Ui(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(u(231,t,typeof n));return n}var Yn=!1;if(P)try{var Nr={};Object.defineProperty(Nr,"passive",{get:function(){Yn=!0}}),window.addEventListener("test",Nr,Nr),window.removeEventListener("test",Nr,Nr)}catch{Yn=!1}function bc(e,t,n,r,i,l,s,d,f){var w=Array.prototype.slice.call(arguments,3);try{t.apply(n,w)}catch(R){this.onError(R)}}var Rr=!1,gi=null,_i=!1,Io=null,ed={onError:function(e){Rr=!0,gi=e}};function td(e,t,n,r,i,l,s,d,f){Rr=!1,gi=null,bc.apply(ed,arguments)}function nd(e,t,n,r,i,l,s,d,f){if(td.apply(this,arguments),Rr){if(Rr){var w=gi;Rr=!1,gi=null}else throw Error(u(198));_i||(_i=!0,Io=w)}}function Rn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Ds(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Is(e){if(Rn(e)!==e)throw Error(u(188))}function rd(e){var t=e.alternate;if(!t){if(t=Rn(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var l=i.alternate;if(l===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===l.child){for(l=i.child;l;){if(l===n)return Is(i),e;if(l===r)return Is(i),t;l=l.sibling}throw Error(u(188))}if(n.return!==r.return)n=i,r=l;else{for(var s=!1,d=i.child;d;){if(d===n){s=!0,n=i,r=l;break}if(d===r){s=!0,r=i,n=l;break}d=d.sibling}if(!s){for(d=l.child;d;){if(d===n){s=!0,n=l,r=i;break}if(d===r){s=!0,r=l,n=i;break}d=d.sibling}if(!s)throw Error(u(189))}}if(n.alternate!==r)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function Fs(e){return e=rd(e),e!==null?As(e):null}function As(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=As(e);if(t!==null)return t;e=e.sibling}return null}var $s=c.unstable_scheduleCallback,Us=c.unstable_cancelCallback,id=c.unstable_shouldYield,od=c.unstable_requestPaint,Me=c.unstable_now,ld=c.unstable_getCurrentPriorityLevel,Fo=c.unstable_ImmediatePriority,Bs=c.unstable_UserBlockingPriority,wi=c.unstable_NormalPriority,sd=c.unstable_LowPriority,Vs=c.unstable_IdlePriority,xi=null,Ft=null;function ad(e){if(Ft&&typeof Ft.onCommitFiberRoot=="function")try{Ft.onCommitFiberRoot(xi,e,void 0,(e.current.flags&128)===128)}catch{}}var Rt=Math.clz32?Math.clz32:dd,ud=Math.log,cd=Math.LN2;function dd(e){return e>>>=0,e===0?32:31-(ud(e)/cd|0)|0}var Si=64,ki=4194304;function Tr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ei(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,l=e.pingedLanes,s=n&268435455;if(s!==0){var d=s&~i;d!==0?r=Tr(d):(l&=s,l!==0&&(r=Tr(l)))}else s=n&~i,s!==0?r=Tr(s):l!==0&&(r=Tr(l));if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,l=t&-t,i>=l||i===16&&(l&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Rt(t),i=1<<n,r|=e[n],t&=~i;return r}function fd(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,l=e.pendingLanes;0<l;){var s=31-Rt(l),d=1<<s,f=i[s];f===-1?((d&n)===0||(d&r)!==0)&&(i[s]=fd(d,t)):f<=t&&(e.expiredLanes|=d),l&=~d}}function Ao(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Hs(){var e=Si;return Si<<=1,(Si&4194240)===0&&(Si=64),e}function $o(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Pr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rt(t),e[t]=n}function md(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Rt(n),l=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~l}}function Uo(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Rt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var we=0;function Ws(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var qs,Bo,Qs,Ys,Ks,Vo=!1,Ci=[],on=null,ln=null,sn=null,Lr=new Map,zr=new Map,an=[],hd="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Xs(e,t){switch(e){case"focusin":case"focusout":on=null;break;case"dragenter":case"dragleave":ln=null;break;case"mouseover":case"mouseout":sn=null;break;case"pointerover":case"pointerout":Lr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zr.delete(t.pointerId)}}function Or(e,t,n,r,i,l){return e===null||e.nativeEvent!==l?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:l,targetContainers:[i]},t!==null&&(t=Yr(t),t!==null&&Bo(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function vd(e,t,n,r,i){switch(t){case"focusin":return on=Or(on,e,t,n,r,i),!0;case"dragenter":return ln=Or(ln,e,t,n,r,i),!0;case"mouseover":return sn=Or(sn,e,t,n,r,i),!0;case"pointerover":var l=i.pointerId;return Lr.set(l,Or(Lr.get(l)||null,e,t,n,r,i)),!0;case"gotpointercapture":return l=i.pointerId,zr.set(l,Or(zr.get(l)||null,e,t,n,r,i)),!0}return!1}function Gs(e){var t=Tn(e.target);if(t!==null){var n=Rn(t);if(n!==null){if(t=n.tag,t===13){if(t=Ds(n),t!==null){e.blockedOn=t,Ks(e.priority,function(){Qs(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ji(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Wo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Cr=r,n.target.dispatchEvent(r),Cr=null}else return t=Yr(n),t!==null&&Bo(t),e.blockedOn=n,!1;t.shift()}return!0}function Zs(e,t,n){ji(e)&&n.delete(t)}function yd(){Vo=!1,on!==null&&ji(on)&&(on=null),ln!==null&&ji(ln)&&(ln=null),sn!==null&&ji(sn)&&(sn=null),Lr.forEach(Zs),zr.forEach(Zs)}function Mr(e,t){e.blockedOn===t&&(e.blockedOn=null,Vo||(Vo=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,yd)))}function Dr(e){function t(i){return Mr(i,e)}if(0<Ci.length){Mr(Ci[0],e);for(var n=1;n<Ci.length;n++){var r=Ci[n];r.blockedOn===e&&(r.blockedOn=null)}}for(on!==null&&Mr(on,e),ln!==null&&Mr(ln,e),sn!==null&&Mr(sn,e),Lr.forEach(t),zr.forEach(t),n=0;n<an.length;n++)r=an[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<an.length&&(n=an[0],n.blockedOn===null);)Gs(n),n.blockedOn===null&&an.shift()}var Kn=ge.ReactCurrentBatchConfig,Ni=!0;function gd(e,t,n,r){var i=we,l=Kn.transition;Kn.transition=null;try{we=1,Ho(e,t,n,r)}finally{we=i,Kn.transition=l}}function _d(e,t,n,r){var i=we,l=Kn.transition;Kn.transition=null;try{we=4,Ho(e,t,n,r)}finally{we=i,Kn.transition=l}}function Ho(e,t,n,r){if(Ni){var i=Wo(e,t,n,r);if(i===null)sl(e,t,r,Ri,n),Xs(e,r);else if(vd(i,e,t,n,r))r.stopPropagation();else if(Xs(e,r),t&4&&-1<hd.indexOf(e)){for(;i!==null;){var l=Yr(i);if(l!==null&&qs(l),l=Wo(e,t,n,r),l===null&&sl(e,t,r,Ri,n),l===i)break;i=l}i!==null&&r.stopPropagation()}else sl(e,t,r,null,n)}}var Ri=null;function Wo(e,t,n,r){if(Ri=null,e=jr(r),e=Tn(e),e!==null)if(t=Rn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ds(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ri=e,null}function Js(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ld()){case Fo:return 1;case Bs:return 4;case wi:case sd:return 16;case Vs:return 536870912;default:return 16}default:return 16}}var un=null,qo=null,Ti=null;function bs(){if(Ti)return Ti;var e,t=qo,n=t.length,r,i="value"in un?un.value:un.textContent,l=i.length;for(e=0;e<n&&t[e]===i[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===i[l-r];r++);return Ti=i.slice(e,1<r?1-r:void 0)}function Pi(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Li(){return!0}function ea(){return!1}function ht(e){function t(n,r,i,l,s){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=l,this.target=s,this.currentTarget=null;for(var d in e)e.hasOwnProperty(d)&&(n=e[d],this[d]=n?n(l):l[d]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?Li:ea,this.isPropagationStopped=ea,this}return V(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Li)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Li)},persist:function(){},isPersistent:Li}),t}var Xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qo=ht(Xn),Ir=V({},Xn,{view:0,detail:0}),wd=ht(Ir),Yo,Ko,Fr,zi=V({},Ir,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Go,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Fr&&(Fr&&e.type==="mousemove"?(Yo=e.screenX-Fr.screenX,Ko=e.screenY-Fr.screenY):Ko=Yo=0,Fr=e),Yo)},movementY:function(e){return"movementY"in e?e.movementY:Ko}}),ta=ht(zi),xd=V({},zi,{dataTransfer:0}),Sd=ht(xd),kd=V({},Ir,{relatedTarget:0}),Xo=ht(kd),Ed=V({},Xn,{animationName:0,elapsedTime:0,pseudoElement:0}),Cd=ht(Ed),jd=V({},Xn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Nd=ht(jd),Rd=V({},Xn,{data:0}),na=ht(Rd),Td={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pd={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ld={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zd(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ld[e])?!!t[e]:!1}function Go(){return zd}var Od=V({},Ir,{key:function(e){if(e.key){var t=Td[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Pi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Pd[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Go,charCode:function(e){return e.type==="keypress"?Pi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Pi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Md=ht(Od),Dd=V({},zi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ra=ht(Dd),Id=V({},Ir,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Go}),Fd=ht(Id),Ad=V({},Xn,{propertyName:0,elapsedTime:0,pseudoElement:0}),$d=ht(Ad),Ud=V({},zi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Bd=ht(Ud),Vd=[9,13,27,32],Zo=P&&"CompositionEvent"in window,Ar=null;P&&"documentMode"in document&&(Ar=document.documentMode);var Hd=P&&"TextEvent"in window&&!Ar,ia=P&&(!Zo||Ar&&8<Ar&&11>=Ar),oa=" ",la=!1;function sa(e,t){switch(e){case"keyup":return Vd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gn=!1;function Wd(e,t){switch(e){case"compositionend":return aa(t);case"keypress":return t.which!==32?null:(la=!0,oa);case"textInput":return e=t.data,e===oa&&la?null:e;default:return null}}function qd(e,t){if(Gn)return e==="compositionend"||!Zo&&sa(e,t)?(e=bs(),Ti=qo=un=null,Gn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ia&&t.locale!=="ko"?null:t.data;default:return null}}var Qd={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ua(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Qd[e.type]:t==="textarea"}function ca(e,t,n,r){J(r),t=Fi(t,"onChange"),0<t.length&&(n=new Qo("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var $r=null,Ur=null;function Yd(e){Ra(e,0)}function Oi(e){var t=tr(e);if(mi(t))return e}function Kd(e,t){if(e==="change")return t}var da=!1;if(P){var Jo;if(P){var bo="oninput"in document;if(!bo){var fa=document.createElement("div");fa.setAttribute("oninput","return;"),bo=typeof fa.oninput=="function"}Jo=bo}else Jo=!1;da=Jo&&(!document.documentMode||9<document.documentMode)}function pa(){$r&&($r.detachEvent("onpropertychange",ma),Ur=$r=null)}function ma(e){if(e.propertyName==="value"&&Oi(Ur)){var t=[];ca(t,Ur,e,jr(e)),Wt(Yd,t)}}function Xd(e,t,n){e==="focusin"?(pa(),$r=t,Ur=n,$r.attachEvent("onpropertychange",ma)):e==="focusout"&&pa()}function Gd(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Oi(Ur)}function Zd(e,t){if(e==="click")return Oi(t)}function Jd(e,t){if(e==="input"||e==="change")return Oi(t)}function bd(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tt=typeof Object.is=="function"?Object.is:bd;function Br(e,t){if(Tt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!S.call(t,i)||!Tt(e[i],t[i]))return!1}return!0}function ha(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function va(e,t){var n=ha(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ha(n)}}function ya(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ya(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ga(){for(var e=window,t=lt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=lt(e.document)}return t}function el(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ef(e){var t=ga(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ya(n.ownerDocument.documentElement,n)){if(r!==null&&el(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,l=Math.min(r.start,i);r=r.end===void 0?l:Math.min(r.end,i),!e.extend&&l>r&&(i=r,r=l,l=i),i=va(n,l);var s=va(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),l>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var tf=P&&"documentMode"in document&&11>=document.documentMode,Zn=null,tl=null,Vr=null,nl=!1;function _a(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;nl||Zn==null||Zn!==lt(r)||(r=Zn,"selectionStart"in r&&el(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vr&&Br(Vr,r)||(Vr=r,r=Fi(tl,"onSelect"),0<r.length&&(t=new Qo("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Zn)))}function Mi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Jn={animationend:Mi("Animation","AnimationEnd"),animationiteration:Mi("Animation","AnimationIteration"),animationstart:Mi("Animation","AnimationStart"),transitionend:Mi("Transition","TransitionEnd")},rl={},wa={};P&&(wa=document.createElement("div").style,"AnimationEvent"in window||(delete Jn.animationend.animation,delete Jn.animationiteration.animation,delete Jn.animationstart.animation),"TransitionEvent"in window||delete Jn.transitionend.transition);function Di(e){if(rl[e])return rl[e];if(!Jn[e])return e;var t=Jn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in wa)return rl[e]=t[n];return e}var xa=Di("animationend"),Sa=Di("animationiteration"),ka=Di("animationstart"),Ea=Di("transitionend"),Ca=new Map,ja="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function cn(e,t){Ca.set(e,t),y(t,[e])}for(var il=0;il<ja.length;il++){var ol=ja[il],nf=ol.toLowerCase(),rf=ol[0].toUpperCase()+ol.slice(1);cn(nf,"on"+rf)}cn(xa,"onAnimationEnd"),cn(Sa,"onAnimationIteration"),cn(ka,"onAnimationStart"),cn("dblclick","onDoubleClick"),cn("focusin","onFocus"),cn("focusout","onBlur"),cn(Ea,"onTransitionEnd"),k("onMouseEnter",["mouseout","mouseover"]),k("onMouseLeave",["mouseout","mouseover"]),k("onPointerEnter",["pointerout","pointerover"]),k("onPointerLeave",["pointerout","pointerover"]),y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),y("onBeforeInput",["compositionend","keypress","textInput","paste"]),y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),of=new Set("cancel close invalid load scroll toggle".split(" ").concat(Hr));function Na(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,nd(r,t,void 0,e),e.currentTarget=null}function Ra(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var l=void 0;if(t)for(var s=r.length-1;0<=s;s--){var d=r[s],f=d.instance,w=d.currentTarget;if(d=d.listener,f!==l&&i.isPropagationStopped())break e;Na(i,d,w),l=f}else for(s=0;s<r.length;s++){if(d=r[s],f=d.instance,w=d.currentTarget,d=d.listener,f!==l&&i.isPropagationStopped())break e;Na(i,d,w),l=f}}}if(_i)throw e=Io,_i=!1,Io=null,e}function je(e,t){var n=t[pl];n===void 0&&(n=t[pl]=new Set);var r=e+"__bubble";n.has(r)||(Ta(t,e,2,!1),n.add(r))}function ll(e,t,n){var r=0;t&&(r|=4),Ta(n,e,r,t)}var Ii="_reactListening"+Math.random().toString(36).slice(2);function Wr(e){if(!e[Ii]){e[Ii]=!0,_.forEach(function(n){n!=="selectionchange"&&(of.has(n)||ll(n,!1,e),ll(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ii]||(t[Ii]=!0,ll("selectionchange",!1,t))}}function Ta(e,t,n,r){switch(Js(t)){case 1:var i=gd;break;case 4:i=_d;break;default:i=Ho}n=i.bind(null,t,n,e),i=void 0,!Yn||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function sl(e,t,n,r,i){var l=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var d=r.stateNode.containerInfo;if(d===i||d.nodeType===8&&d.parentNode===i)break;if(s===4)for(s=r.return;s!==null;){var f=s.tag;if((f===3||f===4)&&(f=s.stateNode.containerInfo,f===i||f.nodeType===8&&f.parentNode===i))return;s=s.return}for(;d!==null;){if(s=Tn(d),s===null)return;if(f=s.tag,f===5||f===6){r=l=s;continue e}d=d.parentNode}}r=r.return}Wt(function(){var w=l,R=jr(n),T=[];e:{var N=Ca.get(e);if(N!==void 0){var B=Qo,W=e;switch(e){case"keypress":if(Pi(n)===0)break e;case"keydown":case"keyup":B=Md;break;case"focusin":W="focus",B=Xo;break;case"focusout":W="blur",B=Xo;break;case"beforeblur":case"afterblur":B=Xo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":B=ta;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":B=Sd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":B=Fd;break;case xa:case Sa:case ka:B=Cd;break;case Ea:B=$d;break;case"scroll":B=wd;break;case"wheel":B=Bd;break;case"copy":case"cut":case"paste":B=Nd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":B=ra}var Q=(t&4)!==0,De=!Q&&e==="scroll",v=Q?N!==null?N+"Capture":null:N;Q=[];for(var p=w,g;p!==null;){g=p;var M=g.stateNode;if(g.tag===5&&M!==null&&(g=M,v!==null&&(M=rn(p,v),M!=null&&Q.push(qr(p,M,g)))),De)break;p=p.return}0<Q.length&&(N=new B(N,W,null,n,R),T.push({event:N,listeners:Q}))}}if((t&7)===0){e:{if(N=e==="mouseover"||e==="pointerover",B=e==="mouseout"||e==="pointerout",N&&n!==Cr&&(W=n.relatedTarget||n.fromElement)&&(Tn(W)||W[qt]))break e;if((B||N)&&(N=R.window===R?R:(N=R.ownerDocument)?N.defaultView||N.parentWindow:window,B?(W=n.relatedTarget||n.toElement,B=w,W=W?Tn(W):null,W!==null&&(De=Rn(W),W!==De||W.tag!==5&&W.tag!==6)&&(W=null)):(B=null,W=w),B!==W)){if(Q=ta,M="onMouseLeave",v="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(Q=ra,M="onPointerLeave",v="onPointerEnter",p="pointer"),De=B==null?N:tr(B),g=W==null?N:tr(W),N=new Q(M,p+"leave",B,n,R),N.target=De,N.relatedTarget=g,M=null,Tn(R)===w&&(Q=new Q(v,p+"enter",W,n,R),Q.target=g,Q.relatedTarget=De,M=Q),De=M,B&&W)t:{for(Q=B,v=W,p=0,g=Q;g;g=bn(g))p++;for(g=0,M=v;M;M=bn(M))g++;for(;0<p-g;)Q=bn(Q),p--;for(;0<g-p;)v=bn(v),g--;for(;p--;){if(Q===v||v!==null&&Q===v.alternate)break t;Q=bn(Q),v=bn(v)}Q=null}else Q=null;B!==null&&Pa(T,N,B,Q,!1),W!==null&&De!==null&&Pa(T,De,W,Q,!0)}}e:{if(N=w?tr(w):window,B=N.nodeName&&N.nodeName.toLowerCase(),B==="select"||B==="input"&&N.type==="file")var K=Kd;else if(ua(N))if(da)K=Jd;else{K=Gd;var G=Xd}else(B=N.nodeName)&&B.toLowerCase()==="input"&&(N.type==="checkbox"||N.type==="radio")&&(K=Zd);if(K&&(K=K(e,w))){ca(T,K,n,R);break e}G&&G(e,N,w),e==="focusout"&&(G=N._wrapperState)&&G.controlled&&N.type==="number"&&It(N,"number",N.value)}switch(G=w?tr(w):window,e){case"focusin":(ua(G)||G.contentEditable==="true")&&(Zn=G,tl=w,Vr=null);break;case"focusout":Vr=tl=Zn=null;break;case"mousedown":nl=!0;break;case"contextmenu":case"mouseup":case"dragend":nl=!1,_a(T,n,R);break;case"selectionchange":if(tf)break;case"keydown":case"keyup":_a(T,n,R)}var Z;if(Zo)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Gn?sa(e,n)&&(b="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(b="onCompositionStart");b&&(ia&&n.locale!=="ko"&&(Gn||b!=="onCompositionStart"?b==="onCompositionEnd"&&Gn&&(Z=bs()):(un=R,qo="value"in un?un.value:un.textContent,Gn=!0)),G=Fi(w,b),0<G.length&&(b=new na(b,e,null,n,R),T.push({event:b,listeners:G}),Z?b.data=Z:(Z=aa(n),Z!==null&&(b.data=Z)))),(Z=Hd?Wd(e,n):qd(e,n))&&(w=Fi(w,"onBeforeInput"),0<w.length&&(R=new na("onBeforeInput","beforeinput",null,n,R),T.push({event:R,listeners:w}),R.data=Z))}Ra(T,t)})}function qr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Fi(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,l=i.stateNode;i.tag===5&&l!==null&&(i=l,l=rn(e,n),l!=null&&r.unshift(qr(e,l,i)),l=rn(e,t),l!=null&&r.push(qr(e,l,i))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Pa(e,t,n,r,i){for(var l=t._reactName,s=[];n!==null&&n!==r;){var d=n,f=d.alternate,w=d.stateNode;if(f!==null&&f===r)break;d.tag===5&&w!==null&&(d=w,i?(f=rn(n,l),f!=null&&s.unshift(qr(n,f,d))):i||(f=rn(n,l),f!=null&&s.push(qr(n,f,d)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var lf=/\r\n?/g,sf=/\u0000|\uFFFD/g;function La(e){return(typeof e=="string"?e:""+e).replace(lf,`
38
38
  `).replace(sf,"")}function Ai(e,t,n){if(t=La(t),La(e)!==t&&n)throw Error(u(425))}function $i(){}var al=null,ul=null;function cl(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var dl=typeof setTimeout=="function"?setTimeout:void 0,af=typeof clearTimeout=="function"?clearTimeout:void 0,za=typeof Promise=="function"?Promise:void 0,uf=typeof queueMicrotask=="function"?queueMicrotask:typeof za<"u"?function(e){return za.resolve(null).then(e).catch(cf)}:dl;function cf(e){setTimeout(function(){throw e})}function fl(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Dr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Dr(t)}function dn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Oa(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var er=Math.random().toString(36).slice(2),At="__reactFiber$"+er,Qr="__reactProps$"+er,qt="__reactContainer$"+er,pl="__reactEvents$"+er,df="__reactListeners$"+er,ff="__reactHandles$"+er;function Tn(e){var t=e[At];if(t)return t;for(var n=e.parentNode;n;){if(t=n[qt]||n[At]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Oa(e);e!==null;){if(n=e[At])return n;e=Oa(e)}return t}e=n,n=e.parentNode}return null}function Yr(e){return e=e[At]||e[qt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function tr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(u(33))}function Ui(e){return e[Qr]||null}var ml=[],nr=-1;function fn(e){return{current:e}}function Ne(e){0>nr||(e.current=ml[nr],ml[nr]=null,nr--)}function ke(e,t){nr++,ml[nr]=e.current,e.current=t}var pn={},Ge=fn(pn),st=fn(!1),Pn=pn;function rr(e,t){var n=e.type.contextTypes;if(!n)return pn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},l;for(l in n)i[l]=t[l];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function at(e){return e=e.childContextTypes,e!=null}function Bi(){Ne(st),Ne(Ge)}function Ma(e,t,n){if(Ge.current!==pn)throw Error(u(168));ke(Ge,t),ke(st,n)}function Da(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(u(108,fe(e)||"Unknown",i));return V({},n,r)}function Vi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,Pn=Ge.current,ke(Ge,e),ke(st,st.current),!0}function Ia(e,t,n){var r=e.stateNode;if(!r)throw Error(u(169));n?(e=Da(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,Ne(st),Ne(Ge),ke(Ge,e)):Ne(st),ke(st,n)}var Qt=null,Hi=!1,hl=!1;function Fa(e){Qt===null?Qt=[e]:Qt.push(e)}function pf(e){Hi=!0,Fa(e)}function mn(){if(!hl&&Qt!==null){hl=!0;var e=0,t=we;try{var n=Qt;for(we=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qt=null,Hi=!1}catch(i){throw Qt!==null&&(Qt=Qt.slice(e+1)),$s(Fo,mn),i}finally{we=t,hl=!1}}return null}var ir=[],or=0,Wi=null,qi=0,xt=[],St=0,Ln=null,Yt=1,Kt="";function zn(e,t){ir[or++]=qi,ir[or++]=Wi,Wi=e,qi=t}function Aa(e,t,n){xt[St++]=Yt,xt[St++]=Kt,xt[St++]=Ln,Ln=e;var r=Yt;e=Kt;var i=32-Rt(r)-1;r&=~(1<<i),n+=1;var l=32-Rt(t)+i;if(30<l){var s=i-i%5;l=(r&(1<<s)-1).toString(32),r>>=s,i-=s,Yt=1<<32-Rt(t)+i|n<<i|r,Kt=l+e}else Yt=1<<l|n<<i|r,Kt=e}function vl(e){e.return!==null&&(zn(e,1),Aa(e,1,0))}function yl(e){for(;e===Wi;)Wi=ir[--or],ir[or]=null,qi=ir[--or],ir[or]=null;for(;e===Ln;)Ln=xt[--St],xt[St]=null,Kt=xt[--St],xt[St]=null,Yt=xt[--St],xt[St]=null}var vt=null,yt=null,Pe=!1,Pt=null;function $a(e,t){var n=jt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ua(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,vt=e,yt=dn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vt=e,yt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ln!==null?{id:Yt,overflow:Kt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=jt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vt=e,yt=null,!0):!1;default:return!1}}function gl(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _l(e){if(Pe){var t=yt;if(t){var n=t;if(!Ua(e,t)){if(gl(e))throw Error(u(418));t=dn(n.nextSibling);var r=vt;t&&Ua(e,t)?$a(r,n):(e.flags=e.flags&-4097|2,Pe=!1,vt=e)}}else{if(gl(e))throw Error(u(418));e.flags=e.flags&-4097|2,Pe=!1,vt=e}}}function Ba(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vt=e}function Qi(e){if(e!==vt)return!1;if(!Pe)return Ba(e),Pe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!cl(e.type,e.memoizedProps)),t&&(t=yt)){if(gl(e))throw Va(),Error(u(418));for(;t;)$a(e,t),t=dn(t.nextSibling)}if(Ba(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){yt=dn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}yt=null}}else yt=vt?dn(e.stateNode.nextSibling):null;return!0}function Va(){for(var e=yt;e;)e=dn(e.nextSibling)}function lr(){yt=vt=null,Pe=!1}function wl(e){Pt===null?Pt=[e]:Pt.push(e)}var mf=ge.ReactCurrentBatchConfig;function Kr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(u(309));var r=n.stateNode}if(!r)throw Error(u(147,e));var i=r,l=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===l?t.ref:(t=function(s){var d=i.refs;s===null?delete d[l]:d[l]=s},t._stringRef=l,t)}if(typeof e!="string")throw Error(u(284));if(!n._owner)throw Error(u(290,e))}return e}function Yi(e,t){throw e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ha(e){var t=e._init;return t(e._payload)}function Wa(e){function t(v,p){if(e){var g=v.deletions;g===null?(v.deletions=[p],v.flags|=16):g.push(p)}}function n(v,p){if(!e)return null;for(;p!==null;)t(v,p),p=p.sibling;return null}function r(v,p){for(v=new Map;p!==null;)p.key!==null?v.set(p.key,p):v.set(p.index,p),p=p.sibling;return v}function i(v,p){return v=Sn(v,p),v.index=0,v.sibling=null,v}function l(v,p,g){return v.index=g,e?(g=v.alternate,g!==null?(g=g.index,g<p?(v.flags|=2,p):g):(v.flags|=2,p)):(v.flags|=1048576,p)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function d(v,p,g,M){return p===null||p.tag!==6?(p=ds(g,v.mode,M),p.return=v,p):(p=i(p,g),p.return=v,p)}function f(v,p,g,M){var K=g.type;return K===Re?R(v,p,g.props.children,M,g.key):p!==null&&(p.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Xe&&Ha(K)===p.type)?(M=i(p,g.props),M.ref=Kr(v,p,g),M.return=v,M):(M=go(g.type,g.key,g.props,null,v.mode,M),M.ref=Kr(v,p,g),M.return=v,M)}function w(v,p,g,M){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=fs(g,v.mode,M),p.return=v,p):(p=i(p,g.children||[]),p.return=v,p)}function R(v,p,g,M,K){return p===null||p.tag!==7?(p=Un(g,v.mode,M,K),p.return=v,p):(p=i(p,g),p.return=v,p)}function T(v,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=ds(""+p,v.mode,g),p.return=v,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case xe:return g=go(p.type,p.key,p.props,null,v.mode,g),g.ref=Kr(v,null,p),g.return=v,g;case pe:return p=fs(p,v.mode,g),p.return=v,p;case Xe:var M=p._init;return T(v,M(p._payload),g)}if(Fe(p)||X(p))return p=Un(p,v.mode,g,null),p.return=v,p;Yi(v,p)}return null}function N(v,p,g,M){var K=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return K!==null?null:d(v,p,""+g,M);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case xe:return g.key===K?f(v,p,g,M):null;case pe:return g.key===K?w(v,p,g,M):null;case Xe:return K=g._init,N(v,p,K(g._payload),M)}if(Fe(g)||X(g))return K!==null?null:R(v,p,g,M,null);Yi(v,g)}return null}function B(v,p,g,M,K){if(typeof M=="string"&&M!==""||typeof M=="number")return v=v.get(g)||null,d(p,v,""+M,K);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case xe:return v=v.get(M.key===null?g:M.key)||null,f(p,v,M,K);case pe:return v=v.get(M.key===null?g:M.key)||null,w(p,v,M,K);case Xe:var G=M._init;return B(v,p,g,G(M._payload),K)}if(Fe(M)||X(M))return v=v.get(g)||null,R(p,v,M,K,null);Yi(p,M)}return null}function W(v,p,g,M){for(var K=null,G=null,Z=p,b=p=0,He=null;Z!==null&&b<g.length;b++){Z.index>b?(He=Z,Z=null):He=Z.sibling;var ye=N(v,Z,g[b],M);if(ye===null){Z===null&&(Z=He);break}e&&Z&&ye.alternate===null&&t(v,Z),p=l(ye,p,b),G===null?K=ye:G.sibling=ye,G=ye,Z=He}if(b===g.length)return n(v,Z),Pe&&zn(v,b),K;if(Z===null){for(;b<g.length;b++)Z=T(v,g[b],M),Z!==null&&(p=l(Z,p,b),G===null?K=Z:G.sibling=Z,G=Z);return Pe&&zn(v,b),K}for(Z=r(v,Z);b<g.length;b++)He=B(Z,v,b,g[b],M),He!==null&&(e&&He.alternate!==null&&Z.delete(He.key===null?b:He.key),p=l(He,p,b),G===null?K=He:G.sibling=He,G=He);return e&&Z.forEach(function(kn){return t(v,kn)}),Pe&&zn(v,b),K}function Q(v,p,g,M){var K=X(g);if(typeof K!="function")throw Error(u(150));if(g=K.call(g),g==null)throw Error(u(151));for(var G=K=null,Z=p,b=p=0,He=null,ye=g.next();Z!==null&&!ye.done;b++,ye=g.next()){Z.index>b?(He=Z,Z=null):He=Z.sibling;var kn=N(v,Z,ye.value,M);if(kn===null){Z===null&&(Z=He);break}e&&Z&&kn.alternate===null&&t(v,Z),p=l(kn,p,b),G===null?K=kn:G.sibling=kn,G=kn,Z=He}if(ye.done)return n(v,Z),Pe&&zn(v,b),K;if(Z===null){for(;!ye.done;b++,ye=g.next())ye=T(v,ye.value,M),ye!==null&&(p=l(ye,p,b),G===null?K=ye:G.sibling=ye,G=ye);return Pe&&zn(v,b),K}for(Z=r(v,Z);!ye.done;b++,ye=g.next())ye=B(Z,v,b,ye.value,M),ye!==null&&(e&&ye.alternate!==null&&Z.delete(ye.key===null?b:ye.key),p=l(ye,p,b),G===null?K=ye:G.sibling=ye,G=ye);return e&&Z.forEach(function(Yf){return t(v,Yf)}),Pe&&zn(v,b),K}function De(v,p,g,M){if(typeof g=="object"&&g!==null&&g.type===Re&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case xe:e:{for(var K=g.key,G=p;G!==null;){if(G.key===K){if(K=g.type,K===Re){if(G.tag===7){n(v,G.sibling),p=i(G,g.props.children),p.return=v,v=p;break e}}else if(G.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Xe&&Ha(K)===G.type){n(v,G.sibling),p=i(G,g.props),p.ref=Kr(v,G,g),p.return=v,v=p;break e}n(v,G);break}else t(v,G);G=G.sibling}g.type===Re?(p=Un(g.props.children,v.mode,M,g.key),p.return=v,v=p):(M=go(g.type,g.key,g.props,null,v.mode,M),M.ref=Kr(v,p,g),M.return=v,v=M)}return s(v);case pe:e:{for(G=g.key;p!==null;){if(p.key===G)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(v,p.sibling),p=i(p,g.children||[]),p.return=v,v=p;break e}else{n(v,p);break}else t(v,p);p=p.sibling}p=fs(g,v.mode,M),p.return=v,v=p}return s(v);case Xe:return G=g._init,De(v,p,G(g._payload),M)}if(Fe(g))return W(v,p,g,M);if(X(g))return Q(v,p,g,M);Yi(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(v,p.sibling),p=i(p,g),p.return=v,v=p):(n(v,p),p=ds(g,v.mode,M),p.return=v,v=p),s(v)):n(v,p)}return De}var sr=Wa(!0),qa=Wa(!1),Ki=fn(null),Xi=null,ar=null,xl=null;function Sl(){xl=ar=Xi=null}function kl(e){var t=Ki.current;Ne(Ki),e._currentValue=t}function El(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ur(e,t){Xi=e,xl=ar=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ut=!0),e.firstContext=null)}function kt(e){var t=e._currentValue;if(xl!==e)if(e={context:e,memoizedValue:t,next:null},ar===null){if(Xi===null)throw Error(u(308));ar=e,Xi.dependencies={lanes:0,firstContext:e}}else ar=ar.next=e;return t}var On=null;function Cl(e){On===null?On=[e]:On.push(e)}function Qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Cl(t)):(n.next=i.next,i.next=n),t.interleaved=n,Xt(e,r)}function Xt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var hn=!1;function jl(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ya(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Gt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ve&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Xt(e,n)}return i=r.interleaved,i===null?(t.next=t,Cl(r)):(t.next=i.next,i.next=t),r.interleaved=t,Xt(e,n)}function Gi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Uo(e,n)}}function Ka(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};l===null?i=l=s:l=l.next=s,n=n.next}while(n!==null);l===null?i=l=t:l=l.next=t}else i=l=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:l,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Zi(e,t,n,r){var i=e.updateQueue;hn=!1;var l=i.firstBaseUpdate,s=i.lastBaseUpdate,d=i.shared.pending;if(d!==null){i.shared.pending=null;var f=d,w=f.next;f.next=null,s===null?l=w:s.next=w,s=f;var R=e.alternate;R!==null&&(R=R.updateQueue,d=R.lastBaseUpdate,d!==s&&(d===null?R.firstBaseUpdate=w:d.next=w,R.lastBaseUpdate=f))}if(l!==null){var T=i.baseState;s=0,R=w=f=null,d=l;do{var N=d.lane,B=d.eventTime;if((r&N)===N){R!==null&&(R=R.next={eventTime:B,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var W=e,Q=d;switch(N=t,B=n,Q.tag){case 1:if(W=Q.payload,typeof W=="function"){T=W.call(B,T,N);break e}T=W;break e;case 3:W.flags=W.flags&-65537|128;case 0:if(W=Q.payload,N=typeof W=="function"?W.call(B,T,N):W,N==null)break e;T=V({},T,N);break e;case 2:hn=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,N=i.effects,N===null?i.effects=[d]:N.push(d))}else B={eventTime:B,lane:N,tag:d.tag,payload:d.payload,callback:d.callback,next:null},R===null?(w=R=B,f=T):R=R.next=B,s|=N;if(d=d.next,d===null){if(d=i.shared.pending,d===null)break;N=d,d=N.next,N.next=null,i.lastBaseUpdate=N,i.shared.pending=null}}while(!0);if(R===null&&(f=T),i.baseState=f,i.firstBaseUpdate=w,i.lastBaseUpdate=R,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else l===null&&(i.shared.lanes=0);In|=s,e.lanes=s,e.memoizedState=T}}function Xa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(u(191,i));i.call(r)}}}var Xr={},$t=fn(Xr),Gr=fn(Xr),Zr=fn(Xr);function Mn(e){if(e===Xr)throw Error(u(174));return e}function Nl(e,t){switch(ke(Zr,t),ke(Gr,e),ke($t,Xr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:tn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=tn(t,e)}Ne($t),ke($t,t)}function cr(){Ne($t),Ne(Gr),Ne(Zr)}function Ga(e){Mn(Zr.current);var t=Mn($t.current),n=tn(t,e.type);t!==n&&(ke(Gr,e),ke($t,n))}function Rl(e){Gr.current===e&&(Ne($t),Ne(Gr))}var Le=fn(0);function Ji(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Tl=[];function Pl(){for(var e=0;e<Tl.length;e++)Tl[e]._workInProgressVersionPrimary=null;Tl.length=0}var bi=ge.ReactCurrentDispatcher,Ll=ge.ReactCurrentBatchConfig,Dn=0,ze=null,Ae=null,Be=null,eo=!1,Jr=!1,br=0,hf=0;function Ze(){throw Error(u(321))}function zl(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Tt(e[n],t[n]))return!1;return!0}function Ol(e,t,n,r,i,l){if(Dn=l,ze=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bi.current=e===null||e.memoizedState===null?_f:wf,e=n(r,i),Jr){l=0;do{if(Jr=!1,br=0,25<=l)throw Error(u(301));l+=1,Be=Ae=null,t.updateQueue=null,bi.current=xf,e=n(r,i)}while(Jr)}if(bi.current=ro,t=Ae!==null&&Ae.next!==null,Dn=0,Be=Ae=ze=null,eo=!1,t)throw Error(u(300));return e}function Ml(){var e=br!==0;return br=0,e}function Ut(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Be===null?ze.memoizedState=Be=e:Be=Be.next=e,Be}function Et(){if(Ae===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=Ae.next;var t=Be===null?ze.memoizedState:Be.next;if(t!==null)Be=t,Ae=e;else{if(e===null)throw Error(u(310));Ae=e,e={memoizedState:Ae.memoizedState,baseState:Ae.baseState,baseQueue:Ae.baseQueue,queue:Ae.queue,next:null},Be===null?ze.memoizedState=Be=e:Be=Be.next=e}return Be}function ei(e,t){return typeof t=="function"?t(e):t}function Dl(e){var t=Et(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var r=Ae,i=r.baseQueue,l=n.pending;if(l!==null){if(i!==null){var s=i.next;i.next=l.next,l.next=s}r.baseQueue=i=l,n.pending=null}if(i!==null){l=i.next,r=r.baseState;var d=s=null,f=null,w=l;do{var R=w.lane;if((Dn&R)===R)f!==null&&(f=f.next={lane:0,action:w.action,hasEagerState:w.hasEagerState,eagerState:w.eagerState,next:null}),r=w.hasEagerState?w.eagerState:e(r,w.action);else{var T={lane:R,action:w.action,hasEagerState:w.hasEagerState,eagerState:w.eagerState,next:null};f===null?(d=f=T,s=r):f=f.next=T,ze.lanes|=R,In|=R}w=w.next}while(w!==null&&w!==l);f===null?s=r:f.next=d,Tt(r,t.memoizedState)||(ut=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=f,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do l=i.lane,ze.lanes|=l,In|=l,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Il(e){var t=Et(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,l=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do l=e(l,s.action),s=s.next;while(s!==i);Tt(l,t.memoizedState)||(ut=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,r]}function Za(){}function Ja(e,t){var n=ze,r=Et(),i=t(),l=!Tt(r.memoizedState,i);if(l&&(r.memoizedState=i,ut=!0),r=r.queue,Fl(tu.bind(null,n,r,e),[e]),r.getSnapshot!==t||l||Be!==null&&Be.memoizedState.tag&1){if(n.flags|=2048,ti(9,eu.bind(null,n,r,i,t),void 0,null),Ve===null)throw Error(u(349));(Dn&30)!==0||ba(n,t,i)}return i}function ba(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ze.updateQueue,t===null?(t={lastEffect:null,stores:null},ze.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function eu(e,t,n,r){t.value=n,t.getSnapshot=r,nu(t)&&ru(e)}function tu(e,t,n){return n(function(){nu(t)&&ru(e)})}function nu(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tt(e,n)}catch{return!0}}function ru(e){var t=Xt(e,1);t!==null&&Mt(t,e,1,-1)}function iu(e){var t=Ut();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:e},t.queue=e,e=e.dispatch=gf.bind(null,ze,e),[t.memoizedState,e]}function ti(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ze.updateQueue,t===null?(t={lastEffect:null,stores:null},ze.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function ou(){return Et().memoizedState}function to(e,t,n,r){var i=Ut();ze.flags|=e,i.memoizedState=ti(1|t,n,void 0,r===void 0?null:r)}function no(e,t,n,r){var i=Et();r=r===void 0?null:r;var l=void 0;if(Ae!==null){var s=Ae.memoizedState;if(l=s.destroy,r!==null&&zl(r,s.deps)){i.memoizedState=ti(t,n,l,r);return}}ze.flags|=e,i.memoizedState=ti(1|t,n,l,r)}function lu(e,t){return to(8390656,8,e,t)}function Fl(e,t){return no(2048,8,e,t)}function su(e,t){return no(4,2,e,t)}function au(e,t){return no(4,4,e,t)}function uu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cu(e,t,n){return n=n!=null?n.concat([e]):null,no(4,4,uu.bind(null,t,e),n)}function Al(){}function du(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&zl(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fu(e,t){var n=Et();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&zl(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function pu(e,t,n){return(Dn&21)===0?(e.baseState&&(e.baseState=!1,ut=!0),e.memoizedState=n):(Tt(n,t)||(n=Hs(),ze.lanes|=n,In|=n,e.baseState=!0),t)}function vf(e,t){var n=we;we=n!==0&&4>n?n:4,e(!0);var r=Ll.transition;Ll.transition={};try{e(!1),t()}finally{we=n,Ll.transition=r}}function mu(){return Et().memoizedState}function yf(e,t,n){var r=wn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hu(e))vu(t,n);else if(n=Qa(e,t,n,r),n!==null){var i=nt();Mt(n,e,r,i),yu(n,t,r)}}function gf(e,t,n){var r=wn(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hu(e))vu(t,i);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=t.lastRenderedReducer,l!==null))try{var s=t.lastRenderedState,d=l(s,n);if(i.hasEagerState=!0,i.eagerState=d,Tt(d,s)){var f=t.interleaved;f===null?(i.next=i,Cl(t)):(i.next=f.next,f.next=i),t.interleaved=i;return}}catch{}finally{}n=Qa(e,t,i,r),n!==null&&(i=nt(),Mt(n,e,r,i),yu(n,t,r))}}function hu(e){var t=e.alternate;return e===ze||t!==null&&t===ze}function vu(e,t){Jr=eo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yu(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Uo(e,n)}}var ro={readContext:kt,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useInsertionEffect:Ze,useLayoutEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useMutableSource:Ze,useSyncExternalStore:Ze,useId:Ze,unstable_isNewReconciler:!1},_f={readContext:kt,useCallback:function(e,t){return Ut().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:lu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,to(4194308,4,uu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return to(4194308,4,e,t)},useInsertionEffect:function(e,t){return to(4,2,e,t)},useMemo:function(e,t){var n=Ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ut();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=yf.bind(null,ze,e),[r.memoizedState,e]},useRef:function(e){var t=Ut();return e={current:e},t.memoizedState=e},useState:iu,useDebugValue:Al,useDeferredValue:function(e){return Ut().memoizedState=e},useTransition:function(){var e=iu(!1),t=e[0];return e=vf.bind(null,e[1]),Ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ze,i=Ut();if(Pe){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Ve===null)throw Error(u(349));(Dn&30)!==0||ba(r,t,n)}i.memoizedState=n;var l={value:n,getSnapshot:t};return i.queue=l,lu(tu.bind(null,r,l,e),[e]),r.flags|=2048,ti(9,eu.bind(null,r,l,n,t),void 0,null),n},useId:function(){var e=Ut(),t=Ve.identifierPrefix;if(Pe){var n=Kt,r=Yt;n=(r&~(1<<32-Rt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=br++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=hf++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},wf={readContext:kt,useCallback:du,useContext:kt,useEffect:Fl,useImperativeHandle:cu,useInsertionEffect:su,useLayoutEffect:au,useMemo:fu,useReducer:Dl,useRef:ou,useState:function(){return Dl(ei)},useDebugValue:Al,useDeferredValue:function(e){var t=Et();return pu(t,Ae.memoizedState,e)},useTransition:function(){var e=Dl(ei)[0],t=Et().memoizedState;return[e,t]},useMutableSource:Za,useSyncExternalStore:Ja,useId:mu,unstable_isNewReconciler:!1},xf={readContext:kt,useCallback:du,useContext:kt,useEffect:Fl,useImperativeHandle:cu,useInsertionEffect:su,useLayoutEffect:au,useMemo:fu,useReducer:Il,useRef:ou,useState:function(){return Il(ei)},useDebugValue:Al,useDeferredValue:function(e){var t=Et();return Ae===null?t.memoizedState=e:pu(t,Ae.memoizedState,e)},useTransition:function(){var e=Il(ei)[0],t=Et().memoizedState;return[e,t]},useMutableSource:Za,useSyncExternalStore:Ja,useId:mu,unstable_isNewReconciler:!1};function Lt(e,t){if(e&&e.defaultProps){t=V({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function $l(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:V({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var io={isMounted:function(e){return(e=e._reactInternals)?Rn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=nt(),i=wn(e),l=Gt(r,i);l.payload=t,n!=null&&(l.callback=n),t=vn(e,l,i),t!==null&&(Mt(t,e,i,r),Gi(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=nt(),i=wn(e),l=Gt(r,i);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=vn(e,l,i),t!==null&&(Mt(t,e,i,r),Gi(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=nt(),r=wn(e),i=Gt(n,r);i.tag=2,t!=null&&(i.callback=t),t=vn(e,i,r),t!==null&&(Mt(t,e,r,n),Gi(t,e,r))}};function gu(e,t,n,r,i,l,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,l,s):t.prototype&&t.prototype.isPureReactComponent?!Br(n,r)||!Br(i,l):!0}function _u(e,t,n){var r=!1,i=pn,l=t.contextType;return typeof l=="object"&&l!==null?l=kt(l):(i=at(t)?Pn:Ge.current,r=t.contextTypes,l=(r=r!=null)?rr(e,i):pn),t=new t(n,l),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=io,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=l),t}function wu(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&io.enqueueReplaceState(t,t.state,null)}function Ul(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},jl(e);var l=t.contextType;typeof l=="object"&&l!==null?i.context=kt(l):(l=at(t)?Pn:Ge.current,i.context=rr(e,l)),i.state=e.memoizedState,l=t.getDerivedStateFromProps,typeof l=="function"&&($l(e,t,l,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&io.enqueueReplaceState(i,i.state,null),Zi(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function dr(e,t){try{var n="",r=t;do n+=ae(r),r=r.return;while(r);var i=n}catch(l){i=`
39
39
  Error generating stack: `+l.message+`
40
- `+l.stack}return{value:e,source:t,stack:i,digest:null}}function Bl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vl(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Sf=typeof WeakMap=="function"?WeakMap:Map;function xu(e,t,n){n=Gt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fo||(fo=!0,rs=r),Vl(e,t)},n}function Su(e,t,n){n=Gt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Vl(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){Vl(e,t),typeof r!="function"&&(gn===null?gn=new Set([this]):gn.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sf;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=If.bind(null,e,t,n),t.then(e,e))}function Eu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Cu(e,t,n,r,i){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Gt(-1,1),t.tag=2,vn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var kf=ge.ReactCurrentOwner,ut=!1;function tt(e,t,n,r){t.child=e===null?qa(t,null,n,r):sr(t,e.child,n,r)}function ju(e,t,n,r,i){n=n.render;var l=t.ref;return ur(t,i),r=Ol(e,t,n,r,l,i),n=Ml(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Zt(e,t,i)):(Pe&&n&&vl(t),t.flags|=1,tt(e,t,r,i),t.child)}function Nu(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!cs(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Ru(e,t,l,r,i)):(e=go(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,(e.lanes&i)===0){var s=l.memoizedProps;if(n=n.compare,n=n!==null?n:Br,n(s,r)&&e.ref===t.ref)return Zt(e,t,i)}return t.flags|=1,e=Sn(l,r),e.ref=t.ref,e.return=t,t.child=e}function Ru(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(Br(l,r)&&e.ref===t.ref)if(ut=!1,t.pendingProps=r=l,(e.lanes&i)!==0)(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,Zt(e,t,i)}return Hl(e,t,n,r,i)}function Tu(e,t,n){var r=t.pendingProps,i=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ke(pr,gt),gt|=n;else{if((n&1073741824)===0)return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ke(pr,gt),gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,ke(pr,gt),gt|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,ke(pr,gt),gt|=r;return tt(e,t,i,n),t.child}function Pu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hl(e,t,n,r,i){var l=at(n)?Pn:Ge.current;return l=rr(t,l),ur(t,i),n=Ol(e,t,n,r,l,i),r=Ml(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Zt(e,t,i)):(Pe&&r&&vl(t),t.flags|=1,tt(e,t,n,i),t.child)}function Lu(e,t,n,r,i){if(at(n)){var l=!0;Vi(t)}else l=!1;if(ur(t,i),t.stateNode===null)lo(e,t),_u(t,n,r),Ul(t,n,r,i),r=!0;else if(e===null){var s=t.stateNode,d=t.memoizedProps;s.props=d;var f=s.context,w=n.contextType;typeof w=="object"&&w!==null?w=kt(w):(w=at(n)?Pn:Ge.current,w=rr(t,w));var R=n.getDerivedStateFromProps,T=typeof R=="function"||typeof s.getSnapshotBeforeUpdate=="function";T||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==r||f!==w)&&wu(t,s,r,w),hn=!1;var N=t.memoizedState;s.state=N,Zi(t,r,s,i),f=t.memoizedState,d!==r||N!==f||st.current||hn?(typeof R=="function"&&($l(t,n,R,r),f=t.memoizedState),(d=hn||gu(t,n,d,r,N,f,w))?(T||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=f),s.props=r,s.state=f,s.context=w,r=d):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Ya(e,t),d=t.memoizedProps,w=t.type===t.elementType?d:Lt(t.type,d),s.props=w,T=t.pendingProps,N=s.context,f=n.contextType,typeof f=="object"&&f!==null?f=kt(f):(f=at(n)?Pn:Ge.current,f=rr(t,f));var B=n.getDerivedStateFromProps;(R=typeof B=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==T||N!==f)&&wu(t,s,r,f),hn=!1,N=t.memoizedState,s.state=N,Zi(t,r,s,i);var W=t.memoizedState;d!==T||N!==W||st.current||hn?(typeof B=="function"&&($l(t,n,B,r),W=t.memoizedState),(w=hn||gu(t,n,w,r,N,W,f)||!1)?(R||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,W,f),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,W,f)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=W),s.props=r,s.state=W,s.context=f,r=w):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),r=!1)}return Wl(e,t,n,r,l,i)}function Wl(e,t,n,r,i,l){Pu(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return i&&Ia(t,n,!1),Zt(e,t,l);r=t.stateNode,kf.current=t;var d=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=sr(t,e.child,null,l),t.child=sr(t,null,d,l)):tt(e,t,d,l),t.memoizedState=r.state,i&&Ia(t,n,!0),t.child}function zu(e){var t=e.stateNode;t.pendingContext?Ma(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ma(e,t.context,!1),Nl(e,t.containerInfo)}function Ou(e,t,n,r,i){return lr(),wl(i),t.flags|=256,tt(e,t,n,r),t.child}var ql={dehydrated:null,treeContext:null,retryLane:0};function Ql(e){return{baseLanes:e,cachePool:null,transitions:null}}function Mu(e,t,n){var r=t.pendingProps,i=Le.current,l=!1,s=(t.flags&128)!==0,d;if((d=s)||(d=e!==null&&e.memoizedState===null?!1:(i&2)!==0),d?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),ke(Le,i&1),e===null)return _l(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(s=r.children,e=r.fallback,l?(r=t.mode,l=t.child,s={mode:"hidden",children:s},(r&1)===0&&l!==null?(l.childLanes=0,l.pendingProps=s):l=_o(s,r,0,null),e=Un(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ql(n),t.memoizedState=ql,e):Yl(t,s));if(i=e.memoizedState,i!==null&&(d=i.dehydrated,d!==null))return Ef(e,t,s,r,d,i,n);if(l){l=r.fallback,s=t.mode,i=e.child,d=i.sibling;var f={mode:"hidden",children:r.children};return(s&1)===0&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=f,t.deletions=null):(r=Sn(i,f),r.subtreeFlags=i.subtreeFlags&14680064),d!==null?l=Sn(d,l):(l=Un(l,s,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,s=e.child.memoizedState,s=s===null?Ql(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},l.memoizedState=s,l.childLanes=e.childLanes&~n,t.memoizedState=ql,r}return l=e.child,e=l.sibling,r=Sn(l,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Yl(e,t){return t=_o({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function oo(e,t,n,r){return r!==null&&wl(r),sr(t,e.child,null,n),e=Yl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ef(e,t,n,r,i,l,s){if(n)return t.flags&256?(t.flags&=-257,r=Bl(Error(u(422))),oo(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=_o({mode:"visible",children:r.children},i,0,null),l=Un(l,i,s,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,(t.mode&1)!==0&&sr(t,e.child,null,s),t.child.memoizedState=Ql(s),t.memoizedState=ql,l);if((t.mode&1)===0)return oo(e,t,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var d=r.dgst;return r=d,l=Error(u(419)),r=Bl(l,r,void 0),oo(e,t,s,r)}if(d=(s&e.childLanes)!==0,ut||d){if(r=Ve,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=(i&(r.suspendedLanes|s))!==0?0:i,i!==0&&i!==l.retryLane&&(l.retryLane=i,Xt(e,i),Mt(r,e,i,-1))}return us(),r=Bl(Error(u(421))),oo(e,t,s,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Ff.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,yt=dn(i.nextSibling),vt=t,Pe=!0,Pt=null,e!==null&&(xt[St++]=Yt,xt[St++]=Kt,xt[St++]=Ln,Yt=e.id,Kt=e.overflow,Ln=t),t=Yl(t,r.children),t.flags|=4096,t)}function Du(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),El(e.return,t,n)}function Kl(e,t,n,r,i){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=i)}function Iu(e,t,n){var r=t.pendingProps,i=r.revealOrder,l=r.tail;if(tt(e,t,r.children,n),r=Le.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Du(e,n,t);else if(e.tag===19)Du(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ke(Le,r),(t.mode&1)===0)t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ji(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Kl(t,!1,i,n,l);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ji(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Kl(t,!0,n,null,l);break;case"together":Kl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function lo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Zt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),In|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cf(e,t,n){switch(t.tag){case 3:zu(t),lr();break;case 5:Ga(t);break;case 1:at(t.type)&&Vi(t);break;case 4:Nl(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;ke(Ki,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ke(Le,Le.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Mu(e,t,n):(ke(Le,Le.current&1),e=Zt(e,t,n),e!==null?e.sibling:null);ke(Le,Le.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return Iu(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ke(Le,Le.current),r)break;return null;case 22:case 23:return t.lanes=0,Tu(e,t,n)}return Zt(e,t,n)}var Fu,Xl,Au,$u;Fu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Xl=function(){},Au=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Mn($t.current);var l=null;switch(n){case"input":i=Wn(e,i),r=Wn(e,r),l=[];break;case"select":i=V({},i,{value:void 0}),r=V({},r,{value:void 0}),l=[];break;case"textarea":i=en(e,i),r=en(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=$i)}kr(n,r);var s;n=null;for(w in i)if(!r.hasOwnProperty(w)&&i.hasOwnProperty(w)&&i[w]!=null)if(w==="style"){var d=i[w];for(s in d)d.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else w!=="dangerouslySetInnerHTML"&&w!=="children"&&w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(h.hasOwnProperty(w)?l||(l=[]):(l=l||[]).push(w,null));for(w in r){var f=r[w];if(d=i!=null?i[w]:void 0,r.hasOwnProperty(w)&&f!==d&&(f!=null||d!=null))if(w==="style")if(d){for(s in d)!d.hasOwnProperty(s)||f&&f.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in f)f.hasOwnProperty(s)&&d[s]!==f[s]&&(n||(n={}),n[s]=f[s])}else n||(l||(l=[]),l.push(w,n)),n=f;else w==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,d=d?d.__html:void 0,f!=null&&d!==f&&(l=l||[]).push(w,f)):w==="children"?typeof f!="string"&&typeof f!="number"||(l=l||[]).push(w,""+f):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&(h.hasOwnProperty(w)?(f!=null&&w==="onScroll"&&je("scroll",e),l||d===f||(l=[])):(l=l||[]).push(w,f))}n&&(l=l||[]).push("style",n);var w=l;(t.updateQueue=w)&&(t.flags|=4)}},$u=function(e,t,n,r){n!==r&&(t.flags|=4)};function ni(e,t){if(!Pe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function jf(e,t,n){var r=t.pendingProps;switch(yl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return at(t.type)&&Bi(),Je(t),null;case 3:return r=t.stateNode,cr(),Ne(st),Ne(Ge),Pl(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Qi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pt!==null&&(ls(Pt),Pt=null))),Xl(e,t),Je(t),null;case 5:Rl(t);var i=Mn(Zr.current);if(n=t.type,e!==null&&t.stateNode!=null)Au(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(u(166));return Je(t),null}if(e=Mn($t.current),Qi(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[At]=t,r[Qr]=l,e=(t.mode&1)!==0,n){case"dialog":je("cancel",r),je("close",r);break;case"iframe":case"object":case"embed":je("load",r);break;case"video":case"audio":for(i=0;i<Hr.length;i++)je(Hr[i],r);break;case"source":je("error",r);break;case"img":case"image":case"link":je("error",r),je("load",r);break;case"details":je("toggle",r);break;case"input":wr(r,l),je("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},je("invalid",r);break;case"textarea":Ht(r,l),je("invalid",r)}kr(n,l),i=null;for(var s in l)if(l.hasOwnProperty(s)){var d=l[s];s==="children"?typeof d=="string"?r.textContent!==d&&(l.suppressHydrationWarning!==!0&&Ai(r.textContent,d,e),i=["children",d]):typeof d=="number"&&r.textContent!==""+d&&(l.suppressHydrationWarning!==!0&&Ai(r.textContent,d,e),i=["children",""+d]):h.hasOwnProperty(s)&&d!=null&&s==="onScroll"&&je("scroll",r)}switch(n){case"input":et(r),Sr(r,l,!0);break;case"textarea":et(r),hi(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=$i)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Se(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[At]=t,e[Qr]=r,Fu(e,t,!1,!1),t.stateNode=e;e:{switch(s=Er(n,r),n){case"dialog":je("cancel",e),je("close",e),i=r;break;case"iframe":case"object":case"embed":je("load",e),i=r;break;case"video":case"audio":for(i=0;i<Hr.length;i++)je(Hr[i],e);i=r;break;case"source":je("error",e),i=r;break;case"img":case"image":case"link":je("error",e),je("load",e),i=r;break;case"details":je("toggle",e),i=r;break;case"input":wr(e,r),i=Wn(e,r),je("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=V({},r,{value:void 0}),je("invalid",e);break;case"textarea":Ht(e,r),i=en(e,r),je("invalid",e);break;default:i=r}kr(n,i),d=i;for(l in d)if(d.hasOwnProperty(l)){var f=d[l];l==="style"?yi(e,f):l==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,f!=null&&We(e,f)):l==="children"?typeof f=="string"?(n!=="textarea"||f!=="")&&jn(e,f):typeof f=="number"&&jn(e,""+f):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(h.hasOwnProperty(l)?f!=null&&l==="onScroll"&&je("scroll",e):f!=null&&le(e,l,f,s))}switch(n){case"input":et(e),Sr(e,r,!1);break;case"textarea":et(e),hi(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ue(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?Nt(e,!!r.multiple,l,!1):r.defaultValue!=null&&Nt(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=$i)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Je(t),null;case 6:if(e&&t.stateNode!=null)$u(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(u(166));if(n=Mn(Zr.current),Mn($t.current),Qi(t)){if(r=t.stateNode,n=t.memoizedProps,r[At]=t,(l=r.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:Ai(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ai(r.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[At]=t,t.stateNode=r}return Je(t),null;case 13:if(Ne(Le),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Pe&&yt!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Va(),lr(),t.flags|=98560,l=!1;else if(l=Qi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(u(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(u(317));l[At]=t}else lr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),l=!1}else Pt!==null&&(ls(Pt),Pt=null),l=!0;if(!l)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Le.current&1)!==0?$e===0&&($e=3):us())),t.updateQueue!==null&&(t.flags|=4),Je(t),null);case 4:return cr(),Xl(e,t),e===null&&Wr(t.stateNode.containerInfo),Je(t),null;case 10:return kl(t.type._context),Je(t),null;case 17:return at(t.type)&&Bi(),Je(t),null;case 19:if(Ne(Le),l=t.memoizedState,l===null)return Je(t),null;if(r=(t.flags&128)!==0,s=l.rendering,s===null)if(r)ni(l,!1);else{if($e!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Ji(e),s!==null){for(t.flags|=128,ni(l,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)l=n,e=r,l.flags&=14680066,s=l.alternate,s===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,l.type=s.type,e=s.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ke(Le,Le.current&1|2),t.child}e=e.sibling}l.tail!==null&&Me()>mr&&(t.flags|=128,r=!0,ni(l,!1),t.lanes=4194304)}else{if(!r)if(e=Ji(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ni(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Pe)return Je(t),null}else 2*Me()-l.renderingStartTime>mr&&n!==1073741824&&(t.flags|=128,r=!0,ni(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(n=l.last,n!==null?n.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Me(),t.sibling=null,n=Le.current,ke(Le,r?n&1|2:n&1),t):(Je(t),null);case 22:case 23:return as(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(gt&1073741824)!==0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),null;case 24:return null;case 25:return null}throw Error(u(156,t.tag))}function Nf(e,t){switch(yl(t),t.tag){case 1:return at(t.type)&&Bi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cr(),Ne(st),Ne(Ge),Pl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Rl(t),null;case 13:if(Ne(Le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(Le),null;case 4:return cr(),null;case 10:return kl(t.type._context),null;case 22:case 23:return as(),null;case 24:return null;default:return null}}var so=!1,be=!1,Rf=typeof WeakSet=="function"?WeakSet:Set,H=null;function fr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Oe(e,t,r)}else n.current=null}function Gl(e,t,n){try{n()}catch(r){Oe(e,t,r)}}var Uu=!1;function Tf(e,t){if(al=Ni,e=ga(),el(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var s=0,d=-1,f=-1,w=0,R=0,T=e,N=null;t:for(;;){for(var B;T!==n||i!==0&&T.nodeType!==3||(d=s+i),T!==l||r!==0&&T.nodeType!==3||(f=s+r),T.nodeType===3&&(s+=T.nodeValue.length),(B=T.firstChild)!==null;)N=T,T=B;for(;;){if(T===e)break t;if(N===n&&++w===i&&(d=s),N===l&&++R===r&&(f=s),(B=T.nextSibling)!==null)break;T=N,N=T.parentNode}T=B}n=d===-1||f===-1?null:{start:d,end:f}}else n=null}n=n||{start:0,end:0}}else n=null;for(ul={focusedElem:e,selectionRange:n},Ni=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var W=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var Q=W.memoizedProps,De=W.memoizedState,v=t.stateNode,p=v.getSnapshotBeforeUpdate(t.elementType===t.type?Q:Lt(t.type,Q),De);v.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(M){Oe(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return W=Uu,Uu=!1,W}function ri(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var l=i.destroy;i.destroy=void 0,l!==void 0&&Gl(t,n,l)}i=i.next}while(i!==r)}}function ao(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Zl(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Bu(e){var t=e.alternate;t!==null&&(e.alternate=null,Bu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[At],delete t[Qr],delete t[pl],delete t[df],delete t[ff])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Vu(e){return e.tag===5||e.tag===3||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$i));else if(r!==4&&(e=e.child,e!==null))for(Jl(e,t,n),e=e.sibling;e!==null;)Jl(e,t,n),e=e.sibling}function bl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bl(e,t,n),e=e.sibling;e!==null;)bl(e,t,n),e=e.sibling}var qe=null,zt=!1;function yn(e,t,n){for(n=n.child;n!==null;)Wu(e,t,n),n=n.sibling}function Wu(e,t,n){if(Ft&&typeof Ft.onCommitFiberUnmount=="function")try{Ft.onCommitFiberUnmount(xi,n)}catch{}switch(n.tag){case 5:be||fr(n,t);case 6:var r=qe,i=zt;qe=null,yn(e,t,n),qe=r,zt=i,qe!==null&&(zt?(e=qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):qe.removeChild(n.stateNode));break;case 18:qe!==null&&(zt?(e=qe,n=n.stateNode,e.nodeType===8?fl(e.parentNode,n):e.nodeType===1&&fl(e,n),Dr(e)):fl(qe,n.stateNode));break;case 4:r=qe,i=zt,qe=n.stateNode.containerInfo,zt=!0,yn(e,t,n),qe=r,zt=i;break;case 0:case 11:case 14:case 15:if(!be&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,s=l.destroy;l=l.tag,s!==void 0&&((l&2)!==0||(l&4)!==0)&&Gl(n,t,s),i=i.next}while(i!==r)}yn(e,t,n);break;case 1:if(!be&&(fr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(d){Oe(n,t,d)}yn(e,t,n);break;case 21:yn(e,t,n);break;case 22:n.mode&1?(be=(r=be)||n.memoizedState!==null,yn(e,t,n),be=r):yn(e,t,n);break;default:yn(e,t,n)}}function qu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rf),t.forEach(function(r){var i=Af.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ot(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var l=e,s=t,d=s;e:for(;d!==null;){switch(d.tag){case 5:qe=d.stateNode,zt=!1;break e;case 3:qe=d.stateNode.containerInfo,zt=!0;break e;case 4:qe=d.stateNode.containerInfo,zt=!0;break e}d=d.return}if(qe===null)throw Error(u(160));Wu(l,s,i),qe=null,zt=!1;var f=i.alternate;f!==null&&(f.return=null),i.return=null}catch(w){Oe(i,t,w)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Qu(t,e),t=t.sibling}function Qu(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ot(t,e),Bt(e),r&4){try{ri(3,e,e.return),ao(3,e)}catch(Q){Oe(e,e.return,Q)}try{ri(5,e,e.return)}catch(Q){Oe(e,e.return,Q)}}break;case 1:Ot(t,e),Bt(e),r&512&&n!==null&&fr(n,n.return);break;case 5:if(Ot(t,e),Bt(e),r&512&&n!==null&&fr(n,n.return),e.flags&32){var i=e.stateNode;try{jn(i,"")}catch(Q){Oe(e,e.return,Q)}}if(r&4&&(i=e.stateNode,i!=null)){var l=e.memoizedProps,s=n!==null?n.memoizedProps:l,d=e.type,f=e.updateQueue;if(e.updateQueue=null,f!==null)try{d==="input"&&l.type==="radio"&&l.name!=null&&xr(i,l),Er(d,s);var w=Er(d,l);for(s=0;s<f.length;s+=2){var R=f[s],T=f[s+1];R==="style"?yi(i,T):R==="dangerouslySetInnerHTML"?We(i,T):R==="children"?jn(i,T):le(i,R,T,w)}switch(d){case"input":qn(i,l);break;case"textarea":Cn(i,l);break;case"select":var N=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var B=l.value;B!=null?Nt(i,!!l.multiple,B,!1):N!==!!l.multiple&&(l.defaultValue!=null?Nt(i,!!l.multiple,l.defaultValue,!0):Nt(i,!!l.multiple,l.multiple?[]:"",!1))}i[Qr]=l}catch(Q){Oe(e,e.return,Q)}}break;case 6:if(Ot(t,e),Bt(e),r&4){if(e.stateNode===null)throw Error(u(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(Q){Oe(e,e.return,Q)}}break;case 3:if(Ot(t,e),Bt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Dr(t.containerInfo)}catch(Q){Oe(e,e.return,Q)}break;case 4:Ot(t,e),Bt(e);break;case 13:Ot(t,e),Bt(e),i=e.child,i.flags&8192&&(l=i.memoizedState!==null,i.stateNode.isHidden=l,!l||i.alternate!==null&&i.alternate.memoizedState!==null||(ns=Me())),r&4&&qu(e);break;case 22:if(R=n!==null&&n.memoizedState!==null,e.mode&1?(be=(w=be)||R,Ot(t,e),be=w):Ot(t,e),Bt(e),r&8192){if(w=e.memoizedState!==null,(e.stateNode.isHidden=w)&&!R&&(e.mode&1)!==0)for(H=e,R=e.child;R!==null;){for(T=H=R;H!==null;){switch(N=H,B=N.child,N.tag){case 0:case 11:case 14:case 15:ri(4,N,N.return);break;case 1:fr(N,N.return);var W=N.stateNode;if(typeof W.componentWillUnmount=="function"){r=N,n=N.return;try{t=r,W.props=t.memoizedProps,W.state=t.memoizedState,W.componentWillUnmount()}catch(Q){Oe(r,n,Q)}}break;case 5:fr(N,N.return);break;case 22:if(N.memoizedState!==null){Xu(T);continue}}B!==null?(B.return=N,H=B):Xu(T)}R=R.sibling}e:for(R=null,T=e;;){if(T.tag===5){if(R===null){R=T;try{i=T.stateNode,w?(l=i.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(d=T.stateNode,f=T.memoizedProps.style,s=f!=null&&f.hasOwnProperty("display")?f.display:null,d.style.display=vi("display",s))}catch(Q){Oe(e,e.return,Q)}}}else if(T.tag===6){if(R===null)try{T.stateNode.nodeValue=w?"":T.memoizedProps}catch(Q){Oe(e,e.return,Q)}}else if((T.tag!==22&&T.tag!==23||T.memoizedState===null||T===e)&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===e)break e;for(;T.sibling===null;){if(T.return===null||T.return===e)break e;R===T&&(R=null),T=T.return}R===T&&(R=null),T.sibling.return=T.return,T=T.sibling}}break;case 19:Ot(t,e),Bt(e),r&4&&qu(e);break;case 21:break;default:Ot(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Vu(n)){var r=n;break e}n=n.return}throw Error(u(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(jn(i,""),r.flags&=-33);var l=Hu(e);bl(e,l,i);break;case 3:case 4:var s=r.stateNode.containerInfo,d=Hu(e);Jl(e,d,s);break;default:throw Error(u(161))}}catch(f){Oe(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pf(e,t,n){H=e,Yu(e)}function Yu(e,t,n){for(var r=(e.mode&1)!==0;H!==null;){var i=H,l=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||so;if(!s){var d=i.alternate,f=d!==null&&d.memoizedState!==null||be;d=so;var w=be;if(so=s,(be=f)&&!w)for(H=i;H!==null;)s=H,f=s.child,s.tag===22&&s.memoizedState!==null?Gu(i):f!==null?(f.return=s,H=f):Gu(i);for(;l!==null;)H=l,Yu(l),l=l.sibling;H=i,so=d,be=w}Ku(e)}else(i.subtreeFlags&8772)!==0&&l!==null?(l.return=i,H=l):Ku(e)}}function Ku(e){for(;H!==null;){var t=H;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:be||ao(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!be)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Lt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Xa(t,l,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Xa(t,s,n)}break;case 5:var d=t.stateNode;if(n===null&&t.flags&4){n=d;var f=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":f.autoFocus&&n.focus();break;case"img":f.src&&(n.src=f.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var w=t.alternate;if(w!==null){var R=w.memoizedState;if(R!==null){var T=R.dehydrated;T!==null&&Dr(T)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(u(163))}be||t.flags&512&&Zl(t)}catch(N){Oe(t,t.return,N)}}if(t===e){H=null;break}if(n=t.sibling,n!==null){n.return=t.return,H=n;break}H=t.return}}function Xu(e){for(;H!==null;){var t=H;if(t===e){H=null;break}var n=t.sibling;if(n!==null){n.return=t.return,H=n;break}H=t.return}}function Gu(e){for(;H!==null;){var t=H;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ao(4,t)}catch(f){Oe(t,n,f)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(f){Oe(t,i,f)}}var l=t.return;try{Zl(t)}catch(f){Oe(t,l,f)}break;case 5:var s=t.return;try{Zl(t)}catch(f){Oe(t,s,f)}}}catch(f){Oe(t,t.return,f)}if(t===e){H=null;break}var d=t.sibling;if(d!==null){d.return=t.return,H=d;break}H=t.return}}var Lf=Math.ceil,uo=ge.ReactCurrentDispatcher,es=ge.ReactCurrentOwner,Ct=ge.ReactCurrentBatchConfig,ve=0,Ve=null,Ie=null,Qe=0,gt=0,pr=fn(0),$e=0,ii=null,In=0,co=0,ts=0,oi=null,ct=null,ns=0,mr=1/0,Jt=null,fo=!1,rs=null,gn=null,po=!1,_n=null,mo=0,li=0,is=null,ho=-1,vo=0;function nt(){return(ve&6)!==0?Me():ho!==-1?ho:ho=Me()}function wn(e){return(e.mode&1)===0?1:(ve&2)!==0&&Qe!==0?Qe&-Qe:mf.transition!==null?(vo===0&&(vo=Hs()),vo):(e=we,e!==0||(e=window.event,e=e===void 0?16:Js(e.type)),e)}function Mt(e,t,n,r){if(50<li)throw li=0,is=null,Error(u(185));Pr(e,n,r),((ve&2)===0||e!==Ve)&&(e===Ve&&((ve&2)===0&&(co|=n),$e===4&&xn(e,Qe)),dt(e,r),n===1&&ve===0&&(t.mode&1)===0&&(mr=Me()+500,Hi&&mn()))}function dt(e,t){var n=e.callbackNode;pd(e,t);var r=Ei(e,e===Ve?Qe:0);if(r===0)n!==null&&Us(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Us(n),t===1)e.tag===0?pf(Ju.bind(null,e)):Fa(Ju.bind(null,e)),uf(function(){(ve&6)===0&&mn()}),n=null;else{switch(Ws(r)){case 1:n=Fo;break;case 4:n=Bs;break;case 16:n=wi;break;case 536870912:n=Vs;break;default:n=wi}n=lc(n,Zu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Zu(e,t){if(ho=-1,vo=0,(ve&6)!==0)throw Error(u(327));var n=e.callbackNode;if(hr()&&e.callbackNode!==n)return null;var r=Ei(e,e===Ve?Qe:0);if(r===0)return null;if((r&30)!==0||(r&e.expiredLanes)!==0||t)t=yo(e,r);else{t=r;var i=ve;ve|=2;var l=ec();(Ve!==e||Qe!==t)&&(Jt=null,mr=Me()+500,An(e,t));do try{Mf();break}catch(d){bu(e,d)}while(!0);Sl(),uo.current=l,ve=i,Ie!==null?t=0:(Ve=null,Qe=0,t=$e)}if(t!==0){if(t===2&&(i=Ao(e),i!==0&&(r=i,t=os(e,i))),t===1)throw n=ii,An(e,0),xn(e,r),dt(e,Me()),n;if(t===6)xn(e,r);else{if(i=e.current.alternate,(r&30)===0&&!zf(i)&&(t=yo(e,r),t===2&&(l=Ao(e),l!==0&&(r=l,t=os(e,l))),t===1))throw n=ii,An(e,0),xn(e,r),dt(e,Me()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(u(345));case 2:$n(e,ct,Jt);break;case 3:if(xn(e,r),(r&130023424)===r&&(t=ns+500-Me(),10<t)){if(Ei(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){nt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=dl($n.bind(null,e,ct,Jt),t);break}$n(e,ct,Jt);break;case 4:if(xn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-Rt(r);l=1<<s,s=t[s],s>i&&(i=s),r&=~l}if(r=i,r=Me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Lf(r/1960))-r,10<r){e.timeoutHandle=dl($n.bind(null,e,ct,Jt),r);break}$n(e,ct,Jt);break;case 5:$n(e,ct,Jt);break;default:throw Error(u(329))}}}return dt(e,Me()),e.callbackNode===n?Zu.bind(null,e):null}function os(e,t){var n=oi;return e.current.memoizedState.isDehydrated&&(An(e,t).flags|=256),e=yo(e,t),e!==2&&(t=ct,ct=n,t!==null&&ls(t)),e}function ls(e){ct===null?ct=e:ct.push.apply(ct,e)}function zf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],l=i.getSnapshot;i=i.value;try{if(!Tt(l(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xn(e,t){for(t&=~ts,t&=~co,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Rt(t),r=1<<n;e[n]=-1,t&=~r}}function Ju(e){if((ve&6)!==0)throw Error(u(327));hr();var t=Ei(e,0);if((t&1)===0)return dt(e,Me()),null;var n=yo(e,t);if(e.tag!==0&&n===2){var r=Ao(e);r!==0&&(t=r,n=os(e,r))}if(n===1)throw n=ii,An(e,0),xn(e,t),dt(e,Me()),n;if(n===6)throw Error(u(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,$n(e,ct,Jt),dt(e,Me()),null}function ss(e,t){var n=ve;ve|=1;try{return e(t)}finally{ve=n,ve===0&&(mr=Me()+500,Hi&&mn())}}function Fn(e){_n!==null&&_n.tag===0&&(ve&6)===0&&hr();var t=ve;ve|=1;var n=Ct.transition,r=we;try{if(Ct.transition=null,we=1,e)return e()}finally{we=r,Ct.transition=n,ve=t,(ve&6)===0&&mn()}}function as(){gt=pr.current,Ne(pr)}function An(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,af(n)),Ie!==null)for(n=Ie.return;n!==null;){var r=n;switch(yl(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Bi();break;case 3:cr(),Ne(st),Ne(Ge),Pl();break;case 5:Rl(r);break;case 4:cr();break;case 13:Ne(Le);break;case 19:Ne(Le);break;case 10:kl(r.type._context);break;case 22:case 23:as()}n=n.return}if(Ve=e,Ie=e=Sn(e.current,null),Qe=gt=t,$e=0,ii=null,ts=co=In=0,ct=oi=null,On!==null){for(t=0;t<On.length;t++)if(n=On[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,l=n.pending;if(l!==null){var s=l.next;l.next=i,r.next=s}n.pending=r}On=null}return e}function bu(e,t){do{var n=Ie;try{if(Sl(),bi.current=ro,eo){for(var r=ze.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}eo=!1}if(Dn=0,Be=Ae=ze=null,Jr=!1,br=0,es.current=null,n===null||n.return===null){$e=1,ii=t,Ie=null;break}e:{var l=e,s=n.return,d=n,f=t;if(t=Qe,d.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){var w=f,R=d,T=R.tag;if((R.mode&1)===0&&(T===0||T===11||T===15)){var N=R.alternate;N?(R.updateQueue=N.updateQueue,R.memoizedState=N.memoizedState,R.lanes=N.lanes):(R.updateQueue=null,R.memoizedState=null)}var B=Eu(s);if(B!==null){B.flags&=-257,Cu(B,s,d,l,t),B.mode&1&&ku(l,w,t),t=B,f=w;var W=t.updateQueue;if(W===null){var Q=new Set;Q.add(f),t.updateQueue=Q}else W.add(f);break e}else{if((t&1)===0){ku(l,w,t),us();break e}f=Error(u(426))}}else if(Pe&&d.mode&1){var De=Eu(s);if(De!==null){(De.flags&65536)===0&&(De.flags|=256),Cu(De,s,d,l,t),wl(dr(f,d));break e}}l=f=dr(f,d),$e!==4&&($e=2),oi===null?oi=[l]:oi.push(l),l=s;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var v=xu(l,f,t);Ka(l,v);break e;case 1:d=f;var p=l.type,g=l.stateNode;if((l.flags&128)===0&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(gn===null||!gn.has(g)))){l.flags|=65536,t&=-t,l.lanes|=t;var M=Su(l,d,t);Ka(l,M);break e}}l=l.return}while(l!==null)}nc(n)}catch(K){t=K,Ie===n&&n!==null&&(Ie=n=n.return);continue}break}while(!0)}function ec(){var e=uo.current;return uo.current=ro,e===null?ro:e}function us(){($e===0||$e===3||$e===2)&&($e=4),Ve===null||(In&268435455)===0&&(co&268435455)===0||xn(Ve,Qe)}function yo(e,t){var n=ve;ve|=2;var r=ec();(Ve!==e||Qe!==t)&&(Jt=null,An(e,t));do try{Of();break}catch(i){bu(e,i)}while(!0);if(Sl(),ve=n,uo.current=r,Ie!==null)throw Error(u(261));return Ve=null,Qe=0,$e}function Of(){for(;Ie!==null;)tc(Ie)}function Mf(){for(;Ie!==null&&!id();)tc(Ie)}function tc(e){var t=oc(e.alternate,e,gt);e.memoizedProps=e.pendingProps,t===null?nc(e):Ie=t,es.current=null}function nc(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=jf(n,t,gt),n!==null){Ie=n;return}}else{if(n=Nf(n,t),n!==null){n.flags&=32767,Ie=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{$e=6,Ie=null;return}}if(t=t.sibling,t!==null){Ie=t;return}Ie=t=e}while(t!==null);$e===0&&($e=5)}function $n(e,t,n){var r=we,i=Ct.transition;try{Ct.transition=null,we=1,Df(e,t,n,r)}finally{Ct.transition=i,we=r}return null}function Df(e,t,n,r){do hr();while(_n!==null);if((ve&6)!==0)throw Error(u(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(u(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(md(e,l),e===Ve&&(Ie=Ve=null,Qe=0),(n.subtreeFlags&2064)===0&&(n.flags&2064)===0||po||(po=!0,lc(wi,function(){return hr(),null})),l=(n.flags&15990)!==0,(n.subtreeFlags&15990)!==0||l){l=Ct.transition,Ct.transition=null;var s=we;we=1;var d=ve;ve|=4,es.current=null,Tf(e,n),Qu(n,e),ef(ul),Ni=!!al,ul=al=null,e.current=n,Pf(n),od(),ve=d,we=s,Ct.transition=l}else e.current=n;if(po&&(po=!1,_n=e,mo=i),l=e.pendingLanes,l===0&&(gn=null),ad(n.stateNode),dt(e,Me()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(fo)throw fo=!1,e=rs,rs=null,e;return(mo&1)!==0&&e.tag!==0&&hr(),l=e.pendingLanes,(l&1)!==0?e===is?li++:(li=0,is=e):li=0,mn(),null}function hr(){if(_n!==null){var e=Ws(mo),t=Ct.transition,n=we;try{if(Ct.transition=null,we=16>e?16:e,_n===null)var r=!1;else{if(e=_n,_n=null,mo=0,(ve&6)!==0)throw Error(u(331));var i=ve;for(ve|=4,H=e.current;H!==null;){var l=H,s=l.child;if((H.flags&16)!==0){var d=l.deletions;if(d!==null){for(var f=0;f<d.length;f++){var w=d[f];for(H=w;H!==null;){var R=H;switch(R.tag){case 0:case 11:case 15:ri(8,R,l)}var T=R.child;if(T!==null)T.return=R,H=T;else for(;H!==null;){R=H;var N=R.sibling,B=R.return;if(Bu(R),R===w){H=null;break}if(N!==null){N.return=B,H=N;break}H=B}}}var W=l.alternate;if(W!==null){var Q=W.child;if(Q!==null){W.child=null;do{var De=Q.sibling;Q.sibling=null,Q=De}while(Q!==null)}}H=l}}if((l.subtreeFlags&2064)!==0&&s!==null)s.return=l,H=s;else e:for(;H!==null;){if(l=H,(l.flags&2048)!==0)switch(l.tag){case 0:case 11:case 15:ri(9,l,l.return)}var v=l.sibling;if(v!==null){v.return=l.return,H=v;break e}H=l.return}}var p=e.current;for(H=p;H!==null;){s=H;var g=s.child;if((s.subtreeFlags&2064)!==0&&g!==null)g.return=s,H=g;else e:for(s=p;H!==null;){if(d=H,(d.flags&2048)!==0)try{switch(d.tag){case 0:case 11:case 15:ao(9,d)}}catch(K){Oe(d,d.return,K)}if(d===s){H=null;break e}var M=d.sibling;if(M!==null){M.return=d.return,H=M;break e}H=d.return}}if(ve=i,mn(),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(xi,e)}catch{}r=!0}return r}finally{we=n,Ct.transition=t}}return!1}function rc(e,t,n){t=dr(n,t),t=xu(e,t,1),e=vn(e,t,1),t=nt(),e!==null&&(Pr(e,1,t),dt(e,t))}function Oe(e,t,n){if(e.tag===3)rc(e,e,n);else for(;t!==null;){if(t.tag===3){rc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(gn===null||!gn.has(r))){e=dr(n,e),e=Su(t,e,1),t=vn(t,e,1),e=nt(),t!==null&&(Pr(t,1,e),dt(t,e));break}}t=t.return}}function If(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=nt(),e.pingedLanes|=e.suspendedLanes&n,Ve===e&&(Qe&n)===n&&($e===4||$e===3&&(Qe&130023424)===Qe&&500>Me()-ns?An(e,0):ts|=n),dt(e,t)}function ic(e,t){t===0&&((e.mode&1)===0?t=1:(t=ki,ki<<=1,(ki&130023424)===0&&(ki=4194304)));var n=nt();e=Xt(e,t),e!==null&&(Pr(e,t,n),dt(e,n))}function Ff(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ic(e,n)}function Af(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}r!==null&&r.delete(t),ic(e,n)}var oc;oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||st.current)ut=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ut=!1,Cf(e,t,n);ut=(e.flags&131072)!==0}else ut=!1,Pe&&(t.flags&1048576)!==0&&Aa(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lo(e,t),e=t.pendingProps;var i=rr(t,Ge.current);ur(t,n),i=Ol(null,t,r,e,i,n);var l=Ml();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(r)?(l=!0,Vi(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,jl(t),i.updater=io,t.stateNode=i,i._reactInternals=t,Ul(t,r,e,n),t=Wl(null,t,r,!0,l,n)):(t.tag=0,Pe&&l&&vl(t),tt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(lo(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Uf(r),e=Lt(r,e),i){case 0:t=Hl(null,t,r,e,n);break e;case 1:t=Lu(null,t,r,e,n);break e;case 11:t=ju(null,t,r,e,n);break e;case 14:t=Nu(null,t,r,Lt(r.type,e),n);break e}throw Error(u(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Hl(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Lu(e,t,r,i,n);case 3:e:{if(zu(t),e===null)throw Error(u(387));r=t.pendingProps,l=t.memoizedState,i=l.element,Ya(e,t),Zi(t,r,null,n);var s=t.memoizedState;if(r=s.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){i=dr(Error(u(423)),t),t=Ou(e,t,r,n,i);break e}else if(r!==i){i=dr(Error(u(424)),t),t=Ou(e,t,r,n,i);break e}else for(yt=dn(t.stateNode.containerInfo.firstChild),vt=t,Pe=!0,Pt=null,n=qa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===i){t=Zt(e,t,n);break e}tt(e,t,r,n)}t=t.child}return t;case 5:return Ga(t),e===null&&_l(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,s=i.children,cl(r,i)?s=null:l!==null&&cl(r,l)&&(t.flags|=32),Pu(e,t),tt(e,t,s,n),t.child;case 6:return e===null&&_l(t),null;case 13:return Mu(e,t,n);case 4:return Nl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sr(t,null,r,n):tt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),ju(e,t,r,i,n);case 7:return tt(e,t,t.pendingProps,n),t.child;case 8:return tt(e,t,t.pendingProps.children,n),t.child;case 12:return tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,s=i.value,ke(Ki,r._currentValue),r._currentValue=s,l!==null)if(Tt(l.value,s)){if(l.children===i.children&&!st.current){t=Zt(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var d=l.dependencies;if(d!==null){s=l.child;for(var f=d.firstContext;f!==null;){if(f.context===r){if(l.tag===1){f=Gt(-1,n&-n),f.tag=2;var w=l.updateQueue;if(w!==null){w=w.shared;var R=w.pending;R===null?f.next=f:(f.next=R.next,R.next=f),w.pending=f}}l.lanes|=n,f=l.alternate,f!==null&&(f.lanes|=n),El(l.return,n,t),d.lanes|=n;break}f=f.next}}else if(l.tag===10)s=l.type===t.type?null:l.child;else if(l.tag===18){if(s=l.return,s===null)throw Error(u(341));s.lanes|=n,d=s.alternate,d!==null&&(d.lanes|=n),El(s,n,t),s=l.sibling}else s=l.child;if(s!==null)s.return=l;else for(s=l;s!==null;){if(s===t){s=null;break}if(l=s.sibling,l!==null){l.return=s.return,s=l;break}s=s.return}l=s}tt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ur(t,n),i=kt(i),r=r(i),t.flags|=1,tt(e,t,r,n),t.child;case 14:return r=t.type,i=Lt(r,t.pendingProps),i=Lt(r.type,i),Nu(e,t,r,i,n);case 15:return Ru(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),lo(e,t),t.tag=1,at(r)?(e=!0,Vi(t)):e=!1,ur(t,n),_u(t,r,i),Ul(t,r,i,n),Wl(null,t,r,!0,e,n);case 19:return Iu(e,t,n);case 22:return Tu(e,t,n)}throw Error(u(156,t.tag))};function lc(e,t){return $s(e,t)}function $f(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jt(e,t,n,r){return new $f(e,t,n,r)}function cs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Uf(e){if(typeof e=="function")return cs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rt)return 11;if(e===ot)return 14}return 2}function Sn(e,t){var n=e.alternate;return n===null?(n=jt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function go(e,t,n,r,i,l){var s=2;if(r=e,typeof e=="function")cs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Re:return Un(n.children,i,l,t);case Ee:s=8,i|=8;break;case te:return e=jt(12,n,t,i|2),e.elementType=te,e.lanes=l,e;case Te:return e=jt(13,n,t,i),e.elementType=Te,e.lanes=l,e;case it:return e=jt(19,n,t,i),e.elementType=it,e.lanes=l,e;case Ce:return _o(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ye:s=10;break e;case Ke:s=9;break e;case rt:s=11;break e;case ot:s=14;break e;case Xe:s=16,r=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=jt(s,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function Un(e,t,n,r){return e=jt(7,e,r,t),e.lanes=n,e}function _o(e,t,n,r){return e=jt(22,e,r,t),e.elementType=Ce,e.lanes=n,e.stateNode={isHidden:!1},e}function ds(e,t,n){return e=jt(6,e,null,t),e.lanes=n,e}function fs(e,t,n){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bf(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$o(0),this.expirationTimes=$o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$o(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ps(e,t,n,r,i,l,s,d,f){return e=new Bf(e,t,n,d,f),t===1?(t=1,l===!0&&(t|=8)):t=0,l=jt(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jl(l),e}function Vf(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pe,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function sc(e){if(!e)return pn;e=e._reactInternals;e:{if(Rn(e)!==e||e.tag!==1)throw Error(u(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(at(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(u(171))}if(e.tag===1){var n=e.type;if(at(n))return Da(e,n,t)}return t}function ac(e,t,n,r,i,l,s,d,f){return e=ps(n,r,!0,e,i,l,s,d,f),e.context=sc(null),n=e.current,r=nt(),i=wn(n),l=Gt(r,i),l.callback=t??null,vn(n,l,i),e.current.lanes=i,Pr(e,i,r),dt(e,r),e}function wo(e,t,n,r){var i=t.current,l=nt(),s=wn(i);return n=sc(n),t.context===null?t.context=n:t.pendingContext=n,t=Gt(l,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=vn(i,t,s),e!==null&&(Mt(e,i,s,l),Gi(e,i,s)),s}function xo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ms(e,t){uc(e,t),(e=e.alternate)&&uc(e,t)}function Hf(){return null}var cc=typeof reportError=="function"?reportError:function(e){console.error(e)};function hs(e){this._internalRoot=e}So.prototype.render=hs.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));wo(e,t,null,null)},So.prototype.unmount=hs.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fn(function(){wo(null,e,null,null)}),t[qt]=null}};function So(e){this._internalRoot=e}So.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ys();e={blockedOn:null,target:e,priority:t};for(var n=0;n<an.length&&t!==0&&t<an[n].priority;n++);an.splice(n,0,e),n===0&&Gs(e)}};function vs(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ko(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dc(){}function Wf(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var w=xo(s);l.call(w)}}var s=ac(t,r,e,0,null,!1,!1,"",dc);return e._reactRootContainer=s,e[qt]=s.current,Wr(e.nodeType===8?e.parentNode:e),Fn(),s}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var d=r;r=function(){var w=xo(f);d.call(w)}}var f=ps(e,0,!1,null,null,!1,!1,"",dc);return e._reactRootContainer=f,e[qt]=f.current,Wr(e.nodeType===8?e.parentNode:e),Fn(function(){wo(t,f,n,r)}),f}function Eo(e,t,n,r,i){var l=n._reactRootContainer;if(l){var s=l;if(typeof i=="function"){var d=i;i=function(){var f=xo(s);d.call(f)}}wo(t,s,e,i)}else s=Wf(n,t,e,i,r);return xo(s)}qs=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Tr(t.pendingLanes);n!==0&&(Uo(t,n|1),dt(t,Me()),(ve&6)===0&&(mr=Me()+500,mn()))}break;case 13:Fn(function(){var r=Xt(e,1);if(r!==null){var i=nt();Mt(r,e,1,i)}}),ms(e,1)}},Bo=function(e){if(e.tag===13){var t=Xt(e,134217728);if(t!==null){var n=nt();Mt(t,e,134217728,n)}ms(e,134217728)}},Qs=function(e){if(e.tag===13){var t=wn(e),n=Xt(e,t);if(n!==null){var r=nt();Mt(n,e,t,r)}ms(e,t)}},Ys=function(){return we},Ks=function(e,t){var n=we;try{return we=e,t()}finally{we=n}},Qn=function(e,t,n){switch(t){case"input":if(qn(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ui(r);if(!i)throw Error(u(90));mi(r),qn(r,i)}}}break;case"textarea":Cn(e,n);break;case"select":t=n.value,t!=null&&Nt(e,!!n.multiple,t,!1)}},me=ss,he=Fn;var qf={usingClientEntryPoint:!1,Events:[Yr,tr,Ui,J,Y,ss]},si={findFiberByHostInstance:Tn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Qf={bundleType:si.bundleType,version:si.version,rendererPackageName:si.rendererPackageName,rendererConfig:si.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ge.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Fs(e),e===null?null:e.stateNode},findFiberByHostInstance:si.findFiberByHostInstance||Hf,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Co=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Co.isDisabled&&Co.supportsFiber)try{xi=Co.inject(Qf),Ft=Co}catch{}}return ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qf,ft.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vs(t))throw Error(u(200));return Vf(e,t,null,n)},ft.createRoot=function(e,t){if(!vs(e))throw Error(u(299));var n=!1,r="",i=cc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=ps(e,1,!1,null,null,n,!1,r,i),e[qt]=t.current,Wr(e.nodeType===8?e.parentNode:e),new hs(t)},ft.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=Fs(t),e=e===null?null:e.stateNode,e},ft.flushSync=function(e){return Fn(e)},ft.hydrate=function(e,t,n){if(!ko(t))throw Error(u(200));return Eo(null,e,t,!0,n)},ft.hydrateRoot=function(e,t,n){if(!vs(e))throw Error(u(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",s=cc;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=ac(t,null,e,1,n??null,i,!1,l,s),e[qt]=t.current,Wr(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new So(t)},ft.render=function(e,t,n){if(!ko(t))throw Error(u(200));return Eo(null,e,t,!1,n)},ft.unmountComponentAtNode=function(e){if(!ko(e))throw Error(u(40));return e._reactRootContainer?(Fn(function(){Eo(null,null,e,!1,function(){e._reactRootContainer=null,e[qt]=null})}),!0):!1},ft.unstable_batchedUpdates=ss,ft.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ko(n))throw Error(u(200));if(e==null||e._reactInternals===void 0)throw Error(u(38));return Eo(e,t,n,!1,r)},ft.version="18.3.1-next-f1338f8080-20240426",ft}var _c;function Uc(){if(_c)return ws.exports;_c=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(c){console.error(c)}}return o(),ws.exports=tp(),ws.exports}var wc;function np(){if(wc)return jo;wc=1;var o=Uc();return jo.createRoot=o.createRoot,jo.hydrateRoot=o.hydrateRoot,jo}var rp=np();const ip=1e4,op=12e4,lp=new Set(["room.create","room.invite","room.revoke","room.message","room.close","room.recover","room.recover.confirm"]),sp=new Set(["room.list","room.show","room.participants","room.history"]);let ap=0;class _t extends Error{constructor(u,_,h,y){super(_,y);ys(this,"code");ys(this,"outcomeUnknown");this.name="RpcError",this.code=u,this.outcomeUnknown=h}}function up(o){return lp.has(o)?op:ip}async function cp(o,c,u={}){var I,C,U;const _=u.fetch??globalThis.fetch,h=`web-${Date.now().toString(36)}-${(++ap).toString(36)}`,y=!sp.has(o),k=new AbortController;let P=!1;const S=()=>{var z;return k.abort((z=u.signal)==null?void 0:z.reason)};(I=u.signal)==null||I.addEventListener("abort",S,{once:!0}),(C=u.signal)!=null&&C.aborted&&S();const L=setTimeout(()=>{P=!0,k.abort()},u.timeoutMs??up(o));try{const z=await _("/rpc",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({version:1,id:h,method:o,params:c}),signal:k.signal});let q;try{q=await z.json()}catch(D){throw new _t("invalid_response","daemon returned invalid JSON",y,{cause:D})}if(!dp(q,h))throw new _t("invalid_response","daemon returned an invalid or uncorrelated RPC response",y);if("error"in q)throw new _t(q.error.code,q.error.message,!1);if(!z.ok)throw new _t("invalid_response",`daemon returned a result envelope with HTTP ${z.status}`,y);return q.result}catch(z){throw z instanceof _t?z:P?new _t("timeout","daemon did not answer before the RPC deadline",y,{cause:z}):k.signal.aborted?new _t("aborted","RPC request was aborted",y,{cause:z}):new _t("daemon_unavailable","cowork daemon is unavailable",y,{cause:z})}finally{clearTimeout(L),(U=u.signal)==null||U.removeEventListener("abort",S)}}function dp(o,c){if(!xc(o)||o.version!==1||o.id!==c)return!1;const u=Object.keys(o);return"result"in o?!("error"in o)&&u.length===3&&u.every(_=>_==="version"||_==="id"||_==="result"):u.length===3&&u.every(_=>_==="version"||_==="id"||_==="error")&&xc(o.error)&&Object.keys(o.error).length===2&&typeof o.error.code=="string"&&typeof o.error.message=="string"}function xc(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}const Sc=64;function zo(o){return o.trim().normalize("NFC")}function Ls(o){if(/[\p{Cc}\p{Cf}]/u.test(o))return"Name cannot contain control or format characters.";const c=zo(o),u=Array.from(c).length;if(u<1)return"Name is required.";if(u>Sc)return`Name must be at most ${Sc} characters.`}function fp(o){return typeof o=="string"&&o===zo(o)&&Ls(o)===void 0}const pp=new Set(["provisioning","active","closing","closed"]),mp=new Set(["one_time","public"]),hp=new Set(["live","consumed","revoked","replacement_required","receipt_pending"]),vp=new Set(["queued","send_failed","skipped_removed"]),yp=new Set(["queued","send_failed"]),gp=/^[0-7][0-9a-hjkmnp-tv-z]{25}$/,Ro=262144,_p=2*1024*1024,wp=255,xp=255,Oo=256,vr=["version","room_id","seq","record_id","at","kind"],Bc=["version","room_id","room_name","identity_name","identity_cid","mission","state","invites","seats","created_at"],Sp=[...Bc,"role_briefings","anonymous","quiet_membership","membership_epoch"];function ui(o){if(!Dt(o)||o.version!==1&&o.version!==2)return!1;const c=o.version===2;if(!wt(o,c?Sp:Bc,["status","activated_at","closed_at"])||!Vt(o.room_id)||!fp(o.room_name)||!Ue(o.identity_name)||typeof o.identity_cid!="string"||!Pp(o.mission,c)||!pp.has(o.state)||!En(o.status)||!Array.isArray(o.invites)||!o.invites.every(zs)||!Array.isArray(o.seats)||!o.seats.every(y=>Wc(y,c))||!gr(o.created_at)||!To(o.activated_at)||!To(o.closed_at)||c&&(!Lp(o.role_briefings)||typeof o.anonymous!="boolean"||typeof o.quiet_membership!="boolean"||!ci(o.membership_epoch))||new Set(o.invites.map(y=>y.invite_id)).size!==o.invites.length||new Set(o.seats.map(y=>y.identity)).size!==o.seats.length)return!1;if(c){const y=o.seats;if(new Set(y.map(S=>S.participant_id)).size!==y.length)return!1;const k=new Set;for(const S of y){if(o.anonymous?S.alias===void 0:S.alias!==void 0)return!1;if(S.state==="removed"){if(S.removed_at===void 0||S.removed_epoch===void 0||S.removed_epoch>Number(o.membership_epoch))return!1}else if(S.removed_at!==void 0||S.removed_epoch!==void 0||S.bounced_at!==void 0)return!1;if(S.state==="active"&&S.alias!==void 0){if(k.has(S.alias))return!1;k.add(S.alias)}}const P=new Map(y.map(S=>[S.participant_id,S]));for(const S of y){if(S.replaces_seat===void 0)continue;const L=P.get(S.replaces_seat);if(!L||L===S||L.state!=="removed"||L.role!==S.role||o.anonymous&&L.alias!==S.alias)return!1}}const _=o.state==="provisioning"&&o.status==="packet_pending"&&o.identity_name===`cowork-room-${o.room_id}`&&o.invites.length===0&&o.seats.length===0&&o.activated_at===void 0&&o.closed_at===void 0;if(o.identity_cid===""&&!_||o.identity_cid!==""&&o.status==="packet_pending")return!1;const h=new Set;for(const y of o.invites){if(y.recovery_of===void 0)continue;const k=o.invites.find(S=>S.invite_id===y.recovery_of),P=y.state==="receipt_pending"?(k==null?void 0:k.state)==="replacement_required":y.state==="live"||y.state==="consumed"||y.state==="replacement_required"?(k==null?void 0:k.state)==="revoked":y.state==="revoked"?y.recovery_confirmed===!0?(k==null?void 0:k.state)==="revoked":(k==null?void 0:k.state)==="replacement_required"||(k==null?void 0:k.state)==="revoked":!1;if(!k||k.invite_id===y.invite_id||!P||k.mode!==y.mode||k.role!==y.role||k.min_accepts!==y.min_accepts)return!1;if(y.state==="receipt_pending"){if(h.has(y.recovery_of))return!1;h.add(y.recovery_of)}}for(const y of o.invites){const k=new Set([y.invite_id]);let P=y;for(;P.recovery_of!==void 0;){if(k.has(P.recovery_of))return!1;k.add(P.recovery_of);const S=o.invites.find(L=>L.invite_id===P.recovery_of);if(!S)return!1;P=S}}return!0}function kp(o){return Array.isArray(o)&&o.every(ui)}function kc(o){return Array.isArray(o)&&o.every(c=>Wc(c))&&new Set(o.map(c=>c.identity)).size===o.length}function Vc(o){return Dt(o)&&Ue(o.room_id)&&zs(o.invite)&&Ue(o.blob)&&typeof o.reusable=="boolean"&&En(o.recovery_of)}function Ep(o){return Array.isArray(o)&&o.every(Vc)}function Cp(o,c){if(!Vc(o)||o.room_id!==c.room_id||o.invite.mode!==c.mode||o.invite.role!==c.role||o.invite.min_accepts!==c.min_accepts||o.invite.accepted_cids.length!==0||o.invite.state!=="live"||o.invite.recovery_of!==void 0||o.invite.recovery_confirmed!==void 0||o.recovery_of!==void 0||o.reusable!==(c.mode==="public"))throw new Error("daemon returned an invalid invite receipt for this create request");return o}function jp(o,c){Ep(o)||Ec();const u=new Set,_=new Set;for(const h of o){const y=c.invites.find(k=>k.invite_id===h.recovery_of);(h.room_id!==c.room_id||h.recovery_of===void 0||h.invite.recovery_of!==h.recovery_of||h.invite.state!=="receipt_pending"||h.invite.recovery_confirmed!==!1||h.invite.accepted_cids.length!==0||h.reusable!==(h.invite.mode==="public")||!y||y.state!=="replacement_required"||y.mode!==h.invite.mode||y.role!==h.invite.role||y.min_accepts!==h.invite.min_accepts||y.invite_id===h.invite.invite_id||c.invites.some(k=>k.invite_id===h.invite.invite_id)||u.has(h.invite.invite_id)||_.has(h.recovery_of))&&Ec(),u.add(h.invite.invite_id),_.add(h.recovery_of)}return o}function Np(o,c){const u=new Set(["live","consumed","replacement_required","revoked"]);if(!zs(o)||c.recovery_of===void 0||o.invite_id!==c.invite.invite_id||o.recovery_of!==c.recovery_of||o.recovery_confirmed!==!0||!u.has(o.state)||o.mode!==c.invite.mode||o.role!==c.invite.role||o.min_accepts!==c.invite.min_accepts)throw new Error("daemon returned an invalid recovery confirmation for the displayed old/new pointer");return o}function Ec(){throw new Error("daemon returned an invalid recovery receipt for this room state")}function Hc(o){if(!Ip(o))return!1;switch(o.kind){case"message":return wt(o,[...vr,"message_id","author","category","text","recipient_identities"],["source_msg_id","source_wire_id"])&&Vt(o.message_id)&&Cc(o.author)&&(o.category==="briefing"||o.category==="chat")&&bt(o.text,Ro)&&js(o.recipient_identities)&&(o.source_msg_id===void 0||ci(o.source_msg_id))&&En(o.source_wire_id);case"relay_intent":return wt(o,[...vr,"recipient_identity"],["message_id","file_id"])&&jc(o)&&Ue(o.recipient_identity);case"relay_result":return wt(o,[...vr,"intent_record_id","recipient_identity","status"],["message_id","file_id","wire_id","metadata_wire_id"])&&Ue(o.intent_record_id)&&jc(o)&&Ue(o.recipient_identity)&&vp.has(o.status)&&En(o.wire_id)&&En(o.metadata_wire_id);case"file":{const c=Dp(o.data_base64);return wt(o,[...vr,"file_id","author","filename","mime","size","sha256","data_base64","recipient_identities","source_file_id"],["author_alias","source_wire_id"])&&Vt(o.file_id)&&Cc(o.author)&&(o.author_alias===void 0||zp(o.author_alias))&&Op(o.filename)&&Mp(o.mime,xp)&&ci(o.size)&&o.size<=_p&&typeof o.sha256=="string"&&/^[0-9a-f]{64}$/.test(o.sha256)&&c===o.size&&js(o.recipient_identities)&&ci(o.source_file_id)&&En(o.source_wire_id)}case"close_notice_intent":return wt(o,[...vr,"recipient_identity"])&&Ue(o.recipient_identity);case"close_notice_result":return wt(o,[...vr,"intent_record_id","recipient_identity","status","notified","key_material_retained"],["uncertain_after_restart"])&&Ue(o.intent_record_id)&&Ue(o.recipient_identity)&&yp.has(o.status)&&typeof o.notified=="boolean"&&o.key_material_retained===!0&&(o.uncertain_after_restart===void 0||o.uncertain_after_restart===!0);default:return!1}}function Rp(o){return Array.isArray(o)&&o.every(Hc)}function Tp(o){return Dt(o)&&Object.keys(o).length===4&&o.version===1&&Ue(o.room_id)&&o.deleted===!0&&o.scope==="this_host"}function Pp(o,c=!1){return Dt(o)&&wt(o,c?["goal","briefing","briefing_version"]:["goal","briefing"])&&bt(o.goal,Ro)&&bt(o.briefing,Ro)&&(!c||Mo(o.briefing_version))}function Wc(o,c){if(!Dt(o))return!1;const u=c??Object.hasOwn(o,"participant_id");return wt(o,u?["identity","display_name","role","invite_id","accepted_at","participant_id","state"]:["identity","display_name","role","invite_id","accepted_at"],u?["alias","removed_at","removed_epoch","replaces_seat","bounced_at"]:[])?Ue(o.identity)&&Ue(o.display_name)&&bt(o.role,Oo)&&Ue(o.invite_id)&&gr(o.accepted_at)&&(!u||Vt(o.participant_id)&&(o.state==="active"||o.state==="removed")&&En(o.alias)&&To(o.removed_at)&&(o.removed_epoch===void 0||ci(o.removed_epoch))&&(o.replaces_seat===void 0||Vt(o.replaces_seat))&&To(o.bounced_at)):!1}function Lp(o){return Dt(o)&&Object.entries(o).every(([c,u])=>bt(c,Oo)&&Dt(u)&&wt(u,["text","version","updated_at"])&&bt(u.text,Ro)&&Mo(u.version)&&gr(u.updated_at))}function zs(o){if(!Dt(o)||!wt(o,["invite_id","mode","role","min_accepts","accepted_cids","state","created_at"],["recovery_of","recovery_confirmed","replaces_seat"])||!Ue(o.invite_id)||!mp.has(o.mode)||!bt(o.role,Oo)||!Mo(o.min_accepts)||!js(o.accepted_cids)||!hp.has(o.state)||!En(o.recovery_of)||o.recovery_confirmed!==void 0&&typeof o.recovery_confirmed!="boolean"||o.replaces_seat!==void 0&&!Vt(o.replaces_seat)||!gr(o.created_at))return!1;const c=o;return!(c.mode==="one_time"&&c.min_accepts!==1||c.recovery_of===void 0&&c.recovery_confirmed!==void 0||c.recovery_of!==void 0&&c.recovery_confirmed===void 0||c.state==="receipt_pending"&&(c.recovery_of===void 0||c.recovery_confirmed!==!1||c.accepted_cids.length>0)||c.recovery_of!==void 0&&(c.state==="live"||c.state==="consumed"||c.state==="replacement_required")&&c.recovery_confirmed!==!0)}function Cc(o){return Dt(o)&&wt(o,["identity","display_name","role"])&&Ue(o.identity)&&Ue(o.display_name)&&bt(o.role,Oo)}function zp(o){return Dt(o)&&wt(o,["participant_id","alias"])&&Vt(o.participant_id)&&Ue(o.alias)}function jc(o){const c=o.message_id===void 0?!1:Vt(o.message_id),u=o.file_id===void 0?!1:Vt(o.file_id);return c!==u}function Op(o){return bt(o,wp)&&o!=="."&&o!==".."&&!/[\x00/\\]/.test(o)}function Mp(o,c){return typeof o=="string"&&new TextEncoder().encode(o).byteLength<=c}function Dp(o){if(typeof o!="string"||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o))return;if(o.length===0)return 0;const c=o.endsWith("==")?2:o.endsWith("=")?1:0;return o.length/4*3-c}function Ip(o){return Dt(o)&&o.version===1&&Vt(o.room_id)&&Mo(o.seq)&&o.record_id===`${o.room_id}:${o.seq}`&&gr(o.at)&&typeof o.kind=="string"}function wt(o,c,u=[]){const _=new Set([...c,...u]),h=Object.keys(o);return c.every(y=>Object.hasOwn(o,y))&&h.every(y=>_.has(y))}function Vt(o){return typeof o=="string"&&gp.test(o)}function bt(o,c){return typeof o=="string"&&new TextEncoder().encode(o).byteLength>=1&&new TextEncoder().encode(o).byteLength<=c}function js(o){return Fp(o)&&new Set(o).size===o.length}function gr(o){if(typeof o!="string")return!1;const c=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/.exec(o);if(!c)return!1;const[,u,_,h,y,k,P,S,L]=c,I=Number(u),C=Number(_),U=Number(h),z=Number(y),q=Number(k),D=Number(P),O=S===void 0?0:Number(S),oe=L===void 0?0:Number(L);if(C<1||C>12||z>23||q>59||D>59||O>23||oe>59)return!1;const le=[31,I%4===0&&(I%100!==0||I%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return U>=1&&U<=le[C-1]}function To(o){return o===void 0||gr(o)}function Dt(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function Ue(o){return typeof o=="string"&&o.length>0}function En(o){return o===void 0||Ue(o)}function Fp(o){return Array.isArray(o)&&o.every(Ue)}function Mo(o){return Number.isSafeInteger(o)&&Number(o)>0}function ci(o){return Number.isSafeInteger(o)&&Number(o)>=0}const Vn=500;function pi(o,c){const u=new Map;for(const _ of o)u.set(_.seq,_);for(const _ of c)u.set(_.seq,_);return[...u.values()].sort((_,h)=>_.seq-h.seq)}function Ap(o){return pi([],o).filter(c=>c.kind==="message"||c.kind==="file").map(c=>c.kind==="file"?qc(c):c.category==="briefing"?{type:"briefing",seq:c.seq,recordId:c.record_id,at:c.at,author:c.author,text:c.text}:{type:"message",speaker:c.author.role==="room"?"room":"participant",seq:c.seq,recordId:c.record_id,at:c.at,author:c.author,text:c.text})}function $p(o){return pi([],o).filter(c=>c.kind!=="message"&&c.kind!=="file")}function Up(o,c){return pi([],o.filter(u=>u.room_id===c)).filter(u=>u.kind==="file").map(qc)}function Bp(o,c){const u=new Map;for(const _ of Up(o,c)){const h=u.get(_.filename)??[];h.push(_),u.set(_.filename,h)}return[...u.entries()].map(([_,h])=>{const y=h.sort((k,P)=>k.seq-P.seq).map((k,P)=>({...k,version:P+1})).reverse();return{groupId:y[0].fileId,filename:_,latest:y[0],versions:y}}).sort((_,h)=>h.latest.seq-_.latest.seq)}function pt(o,c=!0){if(!c)return ks(!1);switch(o){case"provisioning":return Nc(!1);case"active":return Nc(!0);case"closing":return ks(!1);case"closed":return{...ks(!1),canDelete:!0}}}function Os(o){return o.invites.reduce((c,u)=>u.state==="revoked"?c:c+Math.max(0,u.min_accepts-u.accepted_cids.length),0)}function Vp(o,c=Vn){const u=Math.max(0,Math.floor(c));return o.slice(Math.max(0,o.length-u))}function Ns(o,c,u=Vn){return Math.min(Math.max(0,c),Math.max(0,o)+Math.max(0,u))}function ks(o){return{canEditSettings:o,canCreateInvite:o,canRevokeInvite:o,canRecoverInvite:o,canMessage:o,canClose:o,canDelete:o}}function Nc(o){return{canEditSettings:!0,canCreateInvite:!0,canRevokeInvite:!0,canRecoverInvite:!0,canMessage:o,canClose:!0,canDelete:!1}}function qc(o){return{type:"file",seq:o.seq,recordId:o.record_id,fileId:o.file_id,at:o.at,author:o.author,filename:o.filename,mime:o.mime,size:o.size,sha256:o.sha256,dataBase64:o.data_base64}}var Hp=Uc();const Wp={provisioning:"Provisioning",active:"Active",closing:"Closing",closed:"Closed"};function Ms(o){return o.room_name}function qp({rooms:o,selectedRoomId:c,connected:u,open:_,sheet:h,onClose:y,onCreate:k,onSelect:P}){const S=o.filter(C=>C.state!=="closed"),L=o.filter(C=>C.state==="closed"),I=h&&!_;return a.jsxs("aside",{className:`room-rail${_?" room-rail--open":""}`,"aria-label":"Mission rooms","aria-hidden":I||void 0,hidden:I,children:[a.jsxs("div",{className:"rail-brand",children:[a.jsx("div",{className:"brand-mark","aria-hidden":"true",children:"O"}),a.jsxs("div",{children:[a.jsx("strong",{children:"ours cowork"}),a.jsx("span",{children:"operations console"})]}),a.jsx("button",{className:"icon-button rail-close",type:"button",onClick:y,"aria-label":"Close rooms",children:"×"})]}),a.jsxs("button",{className:"primary-button create-button",type:"button",onClick:C=>k(C.currentTarget),disabled:u!==!0,children:[a.jsx("span",{"aria-hidden":"true",children:"+"})," Create room"]}),a.jsxs("div",{className:`connection-state connection-state--${u===!1?"offline":u?"online":"pending"}`,children:[a.jsx("span",{className:"state-dot","aria-hidden":"true"}),u===!1?"Disconnected":u?"Connected":"Connecting"]}),a.jsx(Rc,{label:"Open rooms",rooms:S,selectedRoomId:c,onSelect:P}),a.jsx(Rc,{label:"Closed rooms",rooms:L,selectedRoomId:c,onSelect:P}),a.jsx("p",{className:"local-boundary",children:"Local daemon · 127.0.0.1"})]})}function Rc({label:o,rooms:c,selectedRoomId:u,onSelect:_}){return a.jsxs("section",{className:"room-group","aria-label":o,children:[a.jsxs("div",{className:"room-group__heading",children:[a.jsx("h2",{children:o}),a.jsx("span",{children:c.length})]}),c.length===0?a.jsxs("p",{className:"empty-group",children:["No ",o.toLowerCase()]}):a.jsx("ul",{className:"room-list",children:c.map(h=>{const y=h.room_id===u;return a.jsx("li",{children:a.jsxs("button",{className:"room-card",type:"button","aria-current":y?"page":void 0,onClick:()=>_(h.room_id),children:[a.jsx("span",{className:"room-card__title",children:Ms(h)}),a.jsxs("span",{className:"room-card__state",children:[a.jsx("span",{className:`lifecycle-dot lifecycle-dot--${h.state}`,"aria-hidden":"true"}),Wp[h.state]]}),a.jsxs("span",{className:"room-card__summary",children:[h.seats.length," accepted · ",Os(h)," needed"]})]})},h.room_id)})})]})}const di=262144;function Qp({open:o,connected:c,restoreFocus:u,fallbackFocus:_,onClose:h,onCreate:y}){const[k,P]=E.useState(""),[S,L]=E.useState(""),[I,C]=E.useState(""),[U,z]=E.useState(!1),[q,D]=E.useState(),O=E.useRef(!1);if(!o)return null;const oe=Ls(k),ee=Tc("Goal",S),le=Tc("Briefing",I);async function ge(xe){if(xe.preventDefault(),!(!c||oe||ee||le||O.current)){O.current=!0,z(!0),D(void 0);try{await y(zo(k),S.trim(),I.trim()),P(""),L(""),C("")}catch(pe){D(pe instanceof _t&&pe.outcomeUnknown?`The create request did not receive a confirmation, so its outcome is unknown. Your fields are retained. ${pe.message}`:pe instanceof Error?pe.message:"Room creation failed.")}finally{O.current=!1,z(!1)}}}return a.jsx(_r,{title:"Create mission room",open:o,restoreFocus:u,fallbackFocus:_,onClose:h,locked:U,children:a.jsxs("form",{className:"dialog-form",onSubmit:ge,children:[a.jsx("p",{className:"dialog-intro",children:"Define the shared objective. Invitation requirements are added after the room is created."}),a.jsx(fi,{label:"Name",value:k,onChange:P,error:oe,autoFocus:!0}),a.jsx(Po,{label:"Goal",value:S,onChange:L,error:ee,rows:3,trimForBytes:!0}),a.jsx(Po,{label:"Briefing",value:I,onChange:C,error:le,rows:6,trimForBytes:!0}),!c&&a.jsx("p",{className:"form-error",role:"status",children:"Create is unavailable because the daemon disconnected. Your fields are retained and no request was sent."}),q&&a.jsx("p",{className:"form-error",role:"alert",children:q}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:h,disabled:U,children:"Cancel"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!c||U||!!(oe||ee||le),children:U?"Creating room…":"Create mission room"})]})]})})}function Yp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onSave:k}){const[P,S]=E.useState(o.room_name),[L,I]=E.useState(o.mission.goal),[C,U]=E.useState(o.mission.briefing),[z,q]=E.useState(o.status??""),[D,O]=E.useState(!1),[oe,ee]=E.useState(),le=E.useRef(!1);if(E.useEffect(()=>{c&&(S(o.room_name),I(o.mission.goal),U(o.mission.briefing),q(o.status??""),ee(void 0))},[c,o.mission.briefing,o.mission.goal,o.room_id,o.room_name,o.status]),!c)return null;const ge=Ls(P),xe=Pc("Goal",L),pe=Pc("Briefing",C),Re=o.status&&!z?"An existing status cannot be cleared.":void 0,Ee={},te=zo(P);te!==o.room_name&&(Ee.name=te),L!==o.mission.goal&&(Ee.goal=L),C!==o.mission.briefing&&(Ee.briefing=C),z!==(o.status??"")&&(Ee.status=z);const Ye=Object.keys(Ee).length>0;async function Ke(rt){if(rt.preventDefault(),!(!u||!_||!Ye||ge||xe||pe||Re||le.current)){le.current=!0,O(!0),ee(void 0);try{await k(Ee)}catch(Te){ee(Te instanceof _t&&Te.outcomeUnknown?`The settings request did not receive a confirmation, so its outcome is unknown. Your fields are retained. ${Te.message}`:Te instanceof Error?Te.message:"Settings update failed.")}finally{le.current=!1,O(!1)}}}return a.jsx(_r,{title:"Room settings",open:c,restoreFocus:h,onClose:y,locked:D,children:a.jsxs("form",{className:"dialog-form",onSubmit:Ke,children:[a.jsx(fi,{label:"Name",value:P,onChange:S,error:ge,autoFocus:!0}),a.jsx(Po,{label:"Goal",value:L,onChange:I,error:xe,rows:3}),a.jsx(Po,{label:"Briefing",value:C,onChange:U,error:pe,rows:5}),a.jsx(fi,{label:"Status (optional)",value:z,onChange:q,error:Re}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Settings are unavailable because the connection or room lifecycle changed. Your fields are retained and no request was sent."}),oe&&a.jsx("p",{className:"form-error",role:"alert",children:oe}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:D,children:"Cancel"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!u||!_||D||!Ye||!!(ge||xe||pe||Re),children:D?"Saving…":"Save settings"})]})]})})}function Kp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onConfirm:k}){const[P,S]=E.useState(""),[L,I]=E.useState(!1),[C,U]=E.useState(),z=E.useRef(!1);if(!c)return null;const q=Ms(o),O=(P===q||P===o.room_id)&&u&&_;async function oe(ee){if(ee.preventDefault(),!(!O||z.current)){z.current=!0,I(!0),U(void 0);try{await k()}catch(le){U(Qc(le,"close","Your confirmation is retained."))}finally{z.current=!1,I(!1)}}}return a.jsx(_r,{title:"Close room",open:c,restoreFocus:h,onClose:y,locked:L,children:a.jsxs("form",{className:"dialog-form",onSubmit:oe,children:[a.jsx("p",{className:"dialog-intro",children:"Closing is forward-only. Live packet state is removed, while the plaintext local archive remains readable on this host."}),a.jsxs("p",{className:"destructive-target",children:["Type ",a.jsx("strong",{children:q})," or the exact room ID ",a.jsx("code",{children:o.room_id})," to continue."]}),a.jsx(fi,{label:"Type room title or ID to close",value:P,onChange:S}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Close is unavailable because the connection or room lifecycle changed. No request was sent."}),C&&a.jsx("p",{className:"form-error",role:"alert",children:C}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:L,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"submit",disabled:!O||L,children:L?"Closing room…":"Close room permanently"})]})]})})}function Xp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onConfirm:k}){const[P,S]=E.useState(""),[L,I]=E.useState(!1),[C,U]=E.useState(),z=E.useRef(!1);if(!c)return null;const D=P===o.room_id&&u&&_;async function O(oe){if(oe.preventDefault(),!(!D||z.current)){z.current=!0,I(!0),U(void 0);try{await k()}catch(ee){U(Qc(ee,"delete","Your confirmation is retained."))}finally{z.current=!1,I(!1)}}}return a.jsx(_r,{title:"Delete room",open:c,restoreFocus:h,onClose:y,locked:L,children:a.jsxs("form",{className:"dialog-form",onSubmit:O,children:[a.jsx("p",{className:"dialog-intro",children:"This deletes the plaintext local archive and room metadata from this host. It does not purge remote copies or backups and does not securely erase storage or keys."}),a.jsxs("p",{className:"destructive-target",children:["Type the exact room ID ",a.jsx("code",{children:o.room_id})," to continue."]}),a.jsx(fi,{label:"Type exact room ID to delete",value:P,onChange:S}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Delete is unavailable because the connection or room lifecycle changed. No request was sent."}),C&&a.jsx("p",{className:"form-error",role:"alert",children:C}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:L,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"submit",disabled:!D||L,children:L?"Deleting room…":"Delete local archive"})]})]})})}function Po({label:o,value:c,onChange:u,error:_,rows:h,autoFocus:y=!1,trimForBytes:k=!1}){const P=E.useId(),S=`${P}-error`;return a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:P,children:o}),a.jsx("textarea",{id:P,value:c,rows:h,onChange:L=>u(L.target.value),"aria-invalid":!!_,"aria-describedby":_?S:void 0,autoFocus:y,"data-autofocus":y?"true":void 0}),_?a.jsx("small",{id:S,className:"field-error",children:_}):a.jsxs("small",{children:[Lo(k?c.trim():c)," / ",di," bytes"]})]})}function fi({label:o,value:c,onChange:u,error:_,autoFocus:h=!1}){const y=E.useId(),k=`${y}-error`;return a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:y,children:o}),a.jsx("input",{id:y,value:c,onChange:P=>u(P.target.value),"aria-invalid":!!_,"aria-describedby":_?k:void 0,autoFocus:h,"data-autofocus":h?"true":void 0}),_&&a.jsx("small",{id:k,className:"field-error",children:_})]})}function _r({title:o,open:c,restoreFocus:u,fallbackFocus:_,onClose:h,locked:y,children:k}){const P=E.useId(),S=E.useRef(null),L=E.useRef(h),I=E.useRef(y);return L.current=h,I.current=y,E.useEffect(()=>{var D;if(!c)return;const C=u??(document.activeElement instanceof HTMLElement?document.activeElement:null),U=S.current,z=()=>[...(U==null?void 0:U.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]];(D=z().find(O=>O.dataset.autofocus==="true")??z()[0])==null||D.focus();const q=O=>{if(O.key==="Escape"&&!I.current){O.preventDefault(),L.current();return}if(O.key!=="Tab")return;const oe=z();if(!oe.length)return;const ee=oe[0],le=oe[oe.length-1];if(!oe.includes(document.activeElement)){O.preventDefault(),(O.shiftKey?le:ee).focus();return}O.shiftKey&&document.activeElement===ee?(O.preventDefault(),le.focus()):!O.shiftKey&&document.activeElement===le&&(O.preventDefault(),ee.focus())};return document.addEventListener("keydown",q),()=>{document.removeEventListener("keydown",q);const O=Lc(C)?C:(_==null?void 0:_())??document.querySelector('[data-modal-fallback="true"]');Lc(O)&&O.focus()}},[_,c,u]),Hp.createPortal(a.jsx("div",{className:"modal-backdrop",onMouseDown:C=>{!y&&C.target===C.currentTarget&&h()},children:a.jsxs("div",{ref:S,className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":P,children:[a.jsxs("header",{children:[a.jsx("h2",{id:P,children:o}),a.jsx("button",{className:"icon-button",type:"button",onClick:h,disabled:y,"aria-label":`Close ${o}`,children:"×"})]}),k]})}),document.body)}function Tc(o,c){const u=c.trim();if(!u)return`${o} is required.`;if(Lo(u)>di)return`${o} must be at most ${di} UTF-8 bytes.`}function Pc(o,c){if(Lo(c)<1)return`${o} is required.`;if(Lo(c)>di)return`${o} must be at most ${di} UTF-8 bytes.`}function Lo(o){return new TextEncoder().encode(o).byteLength}function Lc(o){return!!(o!=null&&o.isConnected&&!o.matches(':disabled, [aria-disabled="true"]')&&!o.closest('[hidden], [aria-hidden="true"]'))}function Qc(o,c,u){return o instanceof _t&&o.outcomeUnknown?`The ${c} request did not receive a confirmation, so its outcome is unknown. ${u} ${o.message}`:o instanceof Error?o.message:`Room ${c} failed.`}function Gp({room:o,connected:c,onCreate:u,onRevoke:_,onRecover:h}){const[y,k]=E.useState(""),[P,S]=E.useState("one_time"),[L,I]=E.useState("1"),[C,U]=E.useState(!1),[z,q]=E.useState(),[D,O]=E.useState(),oe=E.useRef(!1),ee=pt(o.state,c),le=Number(L),ge=new TextEncoder().encode(y.trim()).byteLength,xe=ge<1?"Role is required.":ge>256?"Role must be at most 256 UTF-8 bytes.":void 0,pe=P==="public"&&(!Number.isSafeInteger(le)||le<1)?"Minimum acceptances must be a positive whole number.":void 0;async function Re(te){te.preventDefault(),!(!ee.canCreateInvite||xe||pe||oe.current)&&await Ee(async()=>{await u({mode:P,role:y.trim(),min_accepts:P==="one_time"?1:le}),k("")},"Invite creation")}async function Ee(te,Ye){oe.current=!0,U(!0),q(void 0);try{await te()}catch(Ke){q(Yc(Ke,Ye))}finally{oe.current=!1,U(!1)}}return a.jsxs(a.Fragment,{children:[a.jsxs("form",{className:"invite-form",onSubmit:Re,children:[a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-role",children:"Role"}),a.jsx("input",{id:"invite-role",value:y,onChange:te=>k(te.target.value),"aria-invalid":!!xe}),xe&&a.jsx("small",{className:"field-error",children:xe})]}),a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-mode",children:"Mode"}),a.jsxs("select",{id:"invite-mode",value:P,onChange:te=>S(te.target.value),children:[a.jsx("option",{value:"one_time",children:"One-time"}),a.jsx("option",{value:"public",children:"Public"})]})]}),P==="public"&&a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-minimum",children:"Minimum acceptances"}),a.jsx("input",{id:"invite-minimum",inputMode:"numeric",value:L,onChange:te=>I(te.target.value),"aria-invalid":!!pe}),pe&&a.jsx("small",{className:"field-error",children:pe})]}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!ee.canCreateInvite||C||!!(xe||pe),children:"Create invite"})]}),z&&a.jsx("p",{className:"form-error",role:"alert",children:z}),a.jsx("div",{className:"invite-list",children:o.invites.map(te=>a.jsxs("article",{className:"invite-card",children:[a.jsxs("header",{children:[a.jsx("strong",{children:te.role}),a.jsx("span",{className:`state-text state-text--${te.state}`,children:bp(te.state)})]}),a.jsxs("p",{children:[te.mode==="public"?"Public":"One-time"," · ",te.accepted_cids.length," of ",te.min_accepts," accepted"]}),a.jsx("code",{children:te.invite_id}),te.recovery_of&&a.jsxs("p",{children:["Recovery lineage: ",a.jsx("code",{children:te.recovery_of})," → ",a.jsx("code",{children:te.invite_id})," (",te.recovery_confirmed?"confirmed":"awaiting confirmation",")"]}),a.jsx("button",{className:"quiet-button",type:"button",disabled:!ee.canRevokeInvite||C||!Jp(te),onClick:()=>O(te),children:"Revoke"})]},te.invite_id))}),o.invites.some(te=>te.state==="replacement_required")&&a.jsxs("div",{className:"recovery-callout",children:[a.jsx("p",{children:"The original invite secret is lost and cannot be recovered. Mint replacements, save every returned secret, then confirm each exact old/new pair. Repeating recovery rotates any unconfirmed replacement."}),a.jsx("button",{className:"secondary-button",type:"button",disabled:!ee.canRecoverInvite||C,onClick:()=>{ee.canRecoverInvite&&Ee(h,"Invite recovery")},children:"Recover missing invites"})]}),D&&a.jsx(_r,{title:"Revoke invite",open:!0,onClose:()=>O(void 0),locked:C,children:a.jsxs("div",{className:"dialog-form",children:[a.jsxs("p",{children:["Revoke the ",a.jsx("strong",{children:D.role})," invite ",a.jsx("code",{children:Kc(D.invite_id)}),"? It can no longer admit participants."]}),!ee.canRevokeInvite&&a.jsx("p",{className:"form-error",role:"status",children:"Revocation is unavailable because the connection or room lifecycle changed. No request was sent."}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:()=>O(void 0),disabled:C,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"button",disabled:C||!ee.canRevokeInvite,onClick:()=>{ee.canRevokeInvite&&Ee(async()=>{await _(D.invite_id),O(void 0)},"Invite revocation")},children:"Revoke invite"})]})]})})]})}function Zp({vault:o,connected:c=!0,canConfirm:u=()=>!0,onClose:_,onConfirm:h}){const[y,k]=E.useState(""),[P,S]=E.useState(!1),[L,I]=E.useState(),C=E.useRef(!1);async function U(z){if(!(!c||!u(z)||C.current)){C.current=!0,S(!0),I(void 0);try{await h(z)}catch(q){I(Yc(q,"Recovery confirmation"))}finally{C.current=!1,S(!1)}}}return a.jsx(_r,{title:o.receipts.some(z=>z.recovery_of)?"Recovered invite receipts":"Invite receipt",open:!0,onClose:_,locked:P,children:a.jsxs("div",{className:"dialog-form",children:[a.jsxs("p",{className:"dialog-intro",children:["Room ",a.jsx("code",{children:o.room_id}),". Copy and save ",o.receipts.length===1?"this secret":"every secret"," now. It is not stored by cowork and disappears when this dialog closes."]}),o.receipts.map(z=>a.jsxs("section",{className:"receipt",children:[a.jsxs("p",{children:[a.jsx("strong",{children:z.invite.role})," · ",z.invite.mode==="public"?"Public":"One-time"]}),z.recovery_of&&a.jsxs("p",{children:["Old ",a.jsx("code",{children:z.recovery_of}),a.jsx("br",{}),"New ",a.jsx("code",{children:z.invite.invite_id})]}),a.jsx("pre",{children:z.blob}),a.jsx("button",{className:"secondary-button",type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(z.blob),k(`Copied ${Kc(z.invite.invite_id)}`)}catch{k("Copy failed. Select and copy the secret manually.")}},children:"Copy invite"}),z.recovery_of&&a.jsx("button",{className:"primary-button",type:"button",disabled:P||!c||!u(z),"aria-label":`Confirm ${z.recovery_of} to ${z.invite.invite_id}`,onClick:()=>U(z),children:"Confirm old/new pair"})]},`${z.recovery_of??"new"}:${z.invite.invite_id}`)),o.receipts.some(z=>z.recovery_of&&(!c||!u(z)))&&a.jsx("p",{className:"form-error",role:"status",children:"Recovery confirmation is unavailable because the connection or exact room lineage changed. The receipt is retained and no request was sent."}),L&&a.jsx("p",{className:"form-error",role:"alert",children:L}),a.jsx("p",{role:"status","aria-live":"polite",children:y}),a.jsx("div",{className:"dialog-actions",children:a.jsx("button",{className:"primary-button",type:"button",disabled:P,onClick:_,children:"Done"})})]})})}function Yc(o,c){return o instanceof _t&&o.outcomeUnknown?`${c} has an unknown outcome. The current state is preserved; check refreshed durable state before deciding whether to act again. ${o.message}`:o instanceof Error?o.message:`${c} failed.`}function Jp(o){return o.state==="live"||o.state==="replacement_required"||o.state==="receipt_pending"}function Kc(o){return o.length<=14?o:`${o.slice(0,8)}…${o.slice(-4)}`}function bp(o){return o.replaceAll("_"," ")}function em({room:o,participants:c=[],archiveCount:u=0,connected:_=!1,tab:h,open:y,drawer:k,panelRef:P,onTab:S,onClose:L,onCreateInvite:I=Es,onRevokeInvite:C=Es,onRecoverInvites:U=Es,onRequestClose:z=zc,onRequestDelete:q=zc}){const D=k&&!y;return a.jsxs("aside",{ref:P,className:`room-context${y?" room-context--open":""}`,"aria-label":"Room context","aria-hidden":D||void 0,hidden:D,tabIndex:-1,children:[a.jsxs("header",{className:"context-header",children:[a.jsxs("div",{children:[a.jsx("p",{className:"eyebrow",children:"Room context"}),a.jsx("h2",{children:o?"Mission details":"No room selected"})]}),a.jsx("button",{className:"icon-button context-close",type:"button",onClick:L,"aria-label":"Close context",children:"×"})]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"context-tabs",role:"tablist","aria-label":"Room context views",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":h==="state",onClick:()=>S("state"),children:"State"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="participants",onClick:()=>S("participants"),children:"Participants"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="invite",onClick:()=>S("invite"),children:"Invite"})]}),h==="state"?a.jsx(tm,{room:o,archiveCount:u,connected:_,onRequestClose:z,onRequestDelete:q}):h==="participants"?a.jsx(nm,{room:o,participants:c}):a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"Invites",children:[a.jsxs("div",{className:"setup-callout",children:[a.jsx("span",{"aria-hidden":"true",children:"↗"}),a.jsxs("div",{children:[a.jsx("h3",{children:"Build the room roster"}),a.jsx("p",{children:"Add invitation requirements one at a time. Each confirmed requirement is durable and can be retried independently."})]})]}),a.jsxs("dl",{className:"state-grid state-grid--compact",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"Requirements"}),a.jsx("dd",{children:o.invites.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Still needed"}),a.jsx("dd",{children:Os(o)})]})]}),a.jsx(Gp,{room:o,connected:_,onCreate:I,onRevoke:C,onRecover:U},o.room_id)]})]})]})}function tm({room:o,archiveCount:c,connected:u,onRequestClose:_,onRequestDelete:h}){const y=pt(o.state,u);return a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"State",children:[a.jsxs("dl",{className:"state-grid",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"Lifecycle"}),a.jsx("dd",{className:`state-text state-text--${o.state}`,children:Xc(o.state)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Accepted seats"}),a.jsx("dd",{children:o.seats.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Unmet requirements"}),a.jsx("dd",{children:Os(o)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Archive"}),a.jsxs("dd",{children:[c," records"]})]})]}),a.jsx(yr,{label:"Room name",value:o.room_name}),o.status&&a.jsx(yr,{label:"Status",value:o.status}),a.jsx(yr,{label:"Room ID",value:o.room_id,mono:!0}),a.jsx(yr,{label:"Identity CID",value:o.identity_cid||"Pending",mono:!0}),a.jsx(yr,{label:"Created",value:Rs(o.created_at)}),o.closed_at&&a.jsx(yr,{label:"Closed",value:Rs(o.closed_at)}),a.jsxs("div",{className:"management-actions",children:[y.canClose&&a.jsx("button",{className:"danger-button",type:"button",onClick:k=>_(k.currentTarget),children:"Close room"}),y.canDelete&&a.jsx("button",{className:"danger-button",type:"button",onClick:k=>h(k.currentTarget),children:"Delete room"})]})]})}function nm({room:o,participants:c}){return a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"Participants",children:[a.jsx("p",{className:`state-text state-text--${o.state}`,children:Xc(o.state)}),a.jsxs("p",{children:[c.length," ",c.length===1?"seat":"seats"]}),o.invites.map(u=>a.jsxs("p",{children:[a.jsx("strong",{children:u.role}),": ",u.accepted_cids.length," of ",u.min_accepts," accepted"]},u.invite_id)),a.jsxs("div",{className:"participant-list",children:[c.map(u=>a.jsxs("article",{className:"participant-card",children:[a.jsx("strong",{children:u.display_name}),a.jsx("span",{children:u.role}),a.jsx("code",{className:"mono",children:u.identity}),a.jsxs("small",{children:["via ",u.invite_id," · ",Rs(u.accepted_at)]})]},u.identity)),c.length===0&&a.jsx("p",{className:"context-note",children:"No participants admitted yet."})]})]})}function yr({label:o,value:c,mono:u=!1}){return a.jsxs("div",{className:"detail-row",children:[a.jsx("span",{children:o}),a.jsx("strong",{className:u?"mono":void 0,children:c})]})}function Rs(o){const c=new Date(o);return Number.isNaN(c.valueOf())?o:c.toLocaleString()}function Xc(o){return`${o.charAt(0).toUpperCase()}${o.slice(1).replaceAll("_"," ")}`}async function Es(){throw new Error("Invite management is unavailable.")}function zc(){}function Oc({records:o,mode:c}){const u=E.useMemo(()=>c==="events"?$p(o):pi([],o),[c,o]);return u.length===0?a.jsxs("p",{className:"timeline-empty",children:["No ",c==="events"?"operational events":"archive records"," loaded."]}):a.jsx("ul",{className:"record-list","aria-label":c==="events"?"Operational events":"Complete archive",children:u.map(_=>{const h=rm(_);return a.jsxs("li",{className:"record-row",children:[a.jsxs("header",{children:[a.jsxs("code",{children:["#",_.seq]}),a.jsx("strong",{children:_.kind.replaceAll("_"," ")}),"status"in _&&a.jsx("span",{className:`record-status record-status--${_.status}`,children:_.status}),a.jsx("time",{dateTime:_.at,children:im(_.at)})]}),_.kind==="message"&&a.jsx("p",{children:_.text}),a.jsx("pre",{children:JSON.stringify(h,null,2)})]},_.record_id)})})}function rm(o){const{version:c,room_id:u,seq:_,record_id:h,at:y,text:k,...P}=o.kind==="message"?o:{...o,text:void 0};return Object.fromEntries(Object.entries(P).filter(([,S])=>S!==void 0))}function im(o){const c=new Date(o);return Number.isNaN(c.valueOf())?o:c.toLocaleString()}const Gc="File integrity check failed; download blocked.",om="application/octet-stream";class Hn extends Error{constructor(){super(Gc),this.name="FileIntegrityError"}}async function lm(o){const c=um(o.dataBase64);if(c.byteLength!==o.size)throw new Hn;let u;try{const h=new Uint8Array(c.byteLength);h.set(c),u=await globalThis.crypto.subtle.digest("SHA-256",h.buffer)}catch{throw new Hn}if([...new Uint8Array(u)].map(h=>h.toString(16).padStart(2,"0")).join("")!==o.sha256)throw new Hn;return c}function sm(o){const c=o.replace(/[\\/]/gu,"_").replace(/[\p{Cc}\p{Cf}]/gu,"_").replace(/[ .]+$/gu,u=>"_".repeat(u.length));return c.length>0?c:"download"}async function am(o,c=cm()){const u=await lm(o),_=new Uint8Array(u.byteLength);_.set(u);const h=c.createObjectURL(new Blob([_.buffer],{type:om}));try{const y=c.createAnchor();y.href=h,y.download=sm(o.filename),y.hidden=!0,y.click()}finally{c.schedule(()=>c.revokeObjectURL(h))}}function um(o){if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o))throw new Hn;let c;try{c=atob(o)}catch{throw new Hn}if(btoa(c)!==o)throw new Hn;return Uint8Array.from(c,u=>u.charCodeAt(0))}function cm(){return{createObjectURL:o=>URL.createObjectURL(o),revokeObjectURL:o=>URL.revokeObjectURL(o),createAnchor:()=>document.createElement("a"),schedule:o=>setTimeout(o,0)}}function dm({file:o}){return a.jsxs("article",{className:"file-attachment",children:[a.jsx("div",{className:"file-attachment__glyph","aria-hidden":"true",children:"↓"}),a.jsxs("div",{className:"file-attachment__body",children:[a.jsx("strong",{className:"file-name",dir:"auto",children:o.filename}),a.jsx("span",{children:Ts(o.size)})]}),a.jsx(Zc,{file:o})]})}function Zc({file:o}){const[c,u]=E.useState(!1),[_,h]=E.useState("");async function y(){if(!c){u(!0),h("");try{await am(o)}catch(k){h(k instanceof Hn?Gc:"Download failed.")}finally{u(!1)}}}return a.jsxs("div",{className:"file-download",children:[a.jsx("button",{className:"secondary-button file-download__button",type:"button",disabled:c,"aria-label":`Download ${o.filename}`,onClick:()=>void y(),children:c?"Preparing download":"Download"}),a.jsx("span",{className:"file-download__status",role:"status","aria-live":"polite",children:_})]})}function Ts(o){if(o<1024)return`${o} B`;const c=["KB","MB"];let u=o,_=-1;do u/=1024,_+=1;while(u>=1024&&_<c.length-1);return`${u>=10||Number.isInteger(u)?u.toFixed(0):u.toFixed(1)} ${c[_]}`}function fm({roomId:o,records:c,historyReady:u,visible:_}){const h=E.useMemo(()=>Ap(c),[c]),[y,k]=E.useState(Vn),[P,S]=E.useState(""),L=E.useRef({maxSeq:0,ready:!1});E.useEffect(()=>{k(Vn)},[o]),E.useEffect(()=>{var D,O;const C=((D=h.at(-1))==null?void 0:D.seq)??0,U=L.current;if(U.roomId!==o||!u||!U.ready){L.current={roomId:o,maxSeq:C,ready:u},S("");return}const z=h.filter(oe=>oe.seq>U.maxSeq),q=z.length;L.current={roomId:o,maxSeq:Math.max(U.maxSeq,C),ready:!0},S(_&&q>0?q===1?`1 new ${((O=z[0])==null?void 0:O.type)==="file"?"attachment":"message"}`:`${q} new room items`:"")},[u,o,h,_]);const I=Vp(h,y);return a.jsxs("div",{className:"chat-timeline",children:[h.length===0&&a.jsx("p",{className:"timeline-empty",children:"No archived communication yet."}),h.length>I.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>k(C=>Ns(C,h.length)),children:"Show 500 earlier"}),a.jsx("ul",{className:"chat-list","aria-label":"Room communication",children:I.map(C=>C.type==="briefing"?a.jsxs("li",{className:"chat-row chat-row--briefing",children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:"Mission briefing"}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx("p",{className:"chat-row__text",children:C.text})]},C.recordId):C.type==="file"?a.jsxs("li",{className:"chat-row chat-row--file",children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:C.author.display_name}),a.jsx("span",{children:C.author.role}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx(dm,{file:C})]},C.recordId):a.jsxs("li",{className:`chat-row chat-row--${C.speaker}`,children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:C.author.display_name}),a.jsx("span",{children:C.speaker==="room"?"Room voice":C.author.role}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx("p",{className:"chat-row__text",children:C.text})]},C.recordId))}),a.jsx("p",{className:"visually-hidden",role:"status","aria-label":"New room items","aria-live":"polite","aria-atomic":"true",children:P})]})}function Cs({seq:o,at:c}){const u=new Date(c);return a.jsxs(a.Fragment,{children:[a.jsxs("code",{children:["#",o]}),a.jsx("time",{dateTime:c,children:Number.isNaN(u.valueOf())?c:u.toLocaleString()})]})}function pm({roomId:o,records:c}){const u=E.useMemo(()=>Bp(c,o),[c,o]),[_,h]=E.useState(Vn),[y,k]=E.useState(new Set),[P,S]=E.useState({});if(E.useEffect(()=>{h(Vn),k(new Set),S({})},[o]),u.length===0)return a.jsx("p",{className:"timeline-empty",children:"No archived files yet."});const L=u.slice(0,_);return a.jsxs("div",{className:"files-view",children:[a.jsx("ul",{className:"file-group-list","aria-label":"Room files",children:L.map(I=>{const C=y.has(I.groupId),U=`file-versions-${I.groupId}`,z=P[I.groupId]??Vn,q=I.versions.slice(0,z);return a.jsxs("li",{className:"file-group",children:[a.jsxs("button",{className:"file-group__toggle",type:"button","aria-expanded":C,"aria-controls":U,"aria-label":`${C?"Collapse":"Expand"} versions for ${I.filename}`,onClick:()=>k(D=>{const O=new Set(D);return O.has(I.groupId)?O.delete(I.groupId):O.add(I.groupId),O}),children:[a.jsx("span",{className:"file-group__chevron","aria-hidden":"true",children:"›"}),a.jsx("span",{className:"file-group__title file-name",dir:"auto",children:I.filename}),a.jsxs("span",{className:"file-group__count",children:[I.versions.length," ",I.versions.length===1?"version":"versions"]}),a.jsxs("span",{className:"file-group__latest",children:["Latest: ",I.latest.author.display_name," · ",a.jsx(Mc,{at:I.latest.at})," · ",Ts(I.latest.size)]})]}),C&&a.jsxs("div",{className:"file-version-panel",id:U,children:[a.jsx("ol",{className:"file-version-list","aria-label":`Versions of ${I.filename}`,children:q.map(D=>a.jsxs("li",{className:"file-version",children:[a.jsxs("div",{className:"file-version__details",children:[a.jsxs("strong",{children:["Version ",D.version]}),a.jsxs("span",{children:[D.author.display_name," · ",D.author.role]}),a.jsxs("span",{children:[a.jsx(Mc,{at:D.at})," · ",Ts(D.size)]}),a.jsx("span",{className:"file-version__mime",children:D.mime})]}),a.jsx(Zc,{file:D})]},D.recordId))}),I.versions.length>q.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>S(D=>({...D,[I.groupId]:Ns(z,I.versions.length)})),children:"Show 500 older versions"})]})]},I.latest.recordId)})}),u.length>L.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>h(I=>Ns(I,u.length)),children:"Show 500 earlier"})]})}function Mc({at:o}){const c=new Date(o);return a.jsx("time",{dateTime:o,children:Number.isNaN(c.valueOf())?o:c.toLocaleString()})}const Dc=262144;function mm({roomState:o,connected:c,state:u,onDraftChange:_,onSend:h}){const{draft:y,pending:k,error:P}=u,S=o==="active"&&c,L=hm(y)>Dc?`Message must be at most ${Dc} UTF-8 bytes.`:void 0,I=S&&!k&&y.length>0&&!L;async function C(q){q==null||q.preventDefault(),I&&await h(y)}function U(q){q.key!=="Enter"||q.shiftKey||(q.preventDefault(),C())}const z=c?o!=="active"?`Messaging is unavailable while the room is ${o}.`:void 0:"Disconnected. Drafts remain local until the daemon is available.";return a.jsxs("form",{className:"room-composer",onSubmit:C,children:[a.jsx("label",{className:"visually-hidden",htmlFor:"room-message",children:"Message the room"}),a.jsx("textarea",{id:"room-message",rows:3,value:y,disabled:!S||k,placeholder:"Message as the room identity",onChange:q=>_(q.target.value),onKeyDown:U,"aria-describedby":"composer-help","aria-invalid":!!L}),a.jsxs("div",{className:"composer-footer",children:[a.jsx("small",{id:"composer-help",children:L??z??"Enter to send · Shift+Enter for a new line"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!I,children:k?"Sending…":"Send message"})]}),P&&a.jsx("p",{className:"form-error",role:"alert",children:P})]})}function hm(o){return new TextEncoder().encode(o).byteLength}const Bn=["communication","files","events","archive"];function vm({room:o,records:c=[],historyReady:u=!1,connected:_,visible:h=!0,composerState:y,onComposerDraft:k,onOpenRooms:P,onOpenContext:S,onSettings:L,onSendMessage:I=_m}){const[C,U]=E.useState("communication"),z=E.useRef({});if(!o)return a.jsxs("main",{className:"workspace workspace--empty",children:[a.jsx("button",{className:"icon-button mobile-rooms",type:"button",onClick:P,"aria-label":"Open rooms",children:"☰"}),a.jsxs("div",{className:"empty-workspace",children:[a.jsx("span",{className:"empty-workspace__glyph","aria-hidden":"true",children:"⌁"}),a.jsx("p",{className:"eyebrow",children:"Mission control"}),a.jsx("h1",{children:"Select a room"}),a.jsx("p",{children:"Choose a mission room to inspect its state and coordinate its work."})]})]});const q=pt(o.state,_);return a.jsxs("main",{className:"workspace",children:[a.jsxs("header",{className:"workspace-header",children:[a.jsx("button",{className:"icon-button mobile-rooms",type:"button",onClick:P,"aria-label":"Open rooms",children:"☰"}),a.jsxs("div",{className:"workspace-identity",children:[a.jsx("p",{className:"eyebrow",children:"Mission room"}),a.jsx("h1",{children:Ms(o)})]}),a.jsx("span",{className:`lifecycle-badge lifecycle-badge--${o.state}`,children:gm(o.state)}),a.jsx("button",{className:"secondary-button context-toggle",type:"button",onClick:S,"data-modal-fallback":"true",children:"Context"})]}),a.jsxs("div",{className:"mission-strip",children:[a.jsx("span",{children:"Goal"}),a.jsx("p",{children:o.mission.goal}),a.jsx("button",{className:"quiet-button",type:"button",onClick:D=>L(D.currentTarget),disabled:!q.canEditSettings,children:"Room settings"})]}),a.jsx("nav",{className:"workspace-tabs","aria-label":"Room workspace",role:"tablist",children:Bn.map(D=>a.jsx("button",{ref:O=>{z.current[D]=O??void 0},id:`workspace-tab-${D}`,type:"button",role:"tab","aria-controls":`workspace-panel-${D}`,"aria-selected":C===D,tabIndex:C===D?0:-1,onClick:()=>U(D),onKeyDown:O=>{var ge;const oe=Bn.indexOf(D),ee=O.key==="ArrowRight"?(oe+1)%Bn.length:O.key==="ArrowLeft"?(oe-1+Bn.length)%Bn.length:O.key==="Home"?0:O.key==="End"?Bn.length-1:void 0;if(ee===void 0)return;O.preventDefault();const le=Bn[ee];U(le),(ge=z.current[le])==null||ge.focus()},children:D[0].toUpperCase()+D.slice(1)},D))}),a.jsxs("section",{className:"workspace-content",id:`workspace-panel-${C}`,role:"tabpanel","aria-labelledby":`workspace-tab-${C}`,"aria-label":`${C} panel`,tabIndex:0,children:[C==="communication"&&a.jsx(ym,{room:o,records:c,historyReady:u,connected:_,visible:h,composerState:y??wm,onComposerDraft:k??xm,onSendMessage:I}),C==="files"&&a.jsx(pm,{roomId:o.room_id,records:c}),C==="events"&&a.jsx(Oc,{records:c,mode:"events"}),C==="archive"&&a.jsx(Oc,{records:c,mode:"archive"})]})]})}function ym({room:o,records:c,historyReady:u,connected:_,visible:h,composerState:y,onComposerDraft:k,onSendMessage:P}){const S=c.some(L=>L.kind==="message"&&L.category==="briefing");return a.jsxs("div",{className:"communication-shell",children:[!S&&a.jsxs("article",{className:"briefing-card",children:[a.jsx("p",{className:"eyebrow",children:"Mission briefing"}),a.jsx("p",{children:o.mission.briefing})]}),o.state!=="active"&&a.jsx("p",{className:`lifecycle-separator lifecycle-separator--${o.state}`,children:o.state==="provisioning"?"Room setup in progress · messaging begins after activation":o.state==="closing"?"Room closure in progress · mutations are disabled":"Room closed · read-only local archive"}),a.jsx(fm,{roomId:o.room_id,records:c,historyReady:u,visible:h}),a.jsx(mm,{roomState:o.state,connected:_,state:y,onDraftChange:k,onSend:P})]})}function gm(o){return o==="provisioning"?"Provisioning":o[0].toUpperCase()+o.slice(1)}async function _m(){throw new Error("Room messaging is unavailable.")}const wm={draft:"",pending:!1};function xm(){}function Ic(o){if(!Number.isFinite(o.intervalMs)||o.intervalMs<=0)throw new TypeError("poll interval must be positive");let c=!1,u=0;const _=o.clock??{setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};let h,y;function k(S){if(!c||u!==S||!o.visible())return Promise.resolve();if((y==null?void 0:y.generation)===S)return y.dirty=!0,y.promise;const L={generation:S,controller:new AbortController,dirty:!1,promise:Promise.resolve()};return y=L,L.promise=P(L),L.promise}async function P(S){try{do{S.dirty=!1;try{await o.run(S.controller.signal)}catch(L){if(!c||u!==S.generation||S.controller.signal.aborted)return;throw L}}while(S.dirty&&c&&u===S.generation&&o.visible())}finally{y===S&&(y=void 0)}}return{start(){if(c)return;c=!0;const S=++u;h=_.setInterval(()=>{k(S).catch(()=>{})},o.intervalMs)},refresh(){return k(u)},stop(){if(!c)return;c=!1,u+=1,h!==void 0&&_.clearInterval(h),h=void 0;const S=y;y=void 0,S==null||S.controller.abort()}}}const Sm={call:(o,c,u)=>cp(o,c,{signal:u==null?void 0:u.signal})};function km({rpc:o=Sm,clock:c}){var Qn;const[u,_]=E.useState([]),[h,y]=E.useState(()=>Fc(location.hash)),[k,P]=E.useState(),[S,L]=E.useState([]),[I,C]=E.useState({}),[U,z]=E.useState({}),[q,D]=E.useState({}),[O,oe]=E.useState(null),[ee,le]=E.useState(),[ge,xe]=E.useState(),[pe,Re]=E.useState(!1),[Ee,te]=E.useState(!1),[Ye,Ke]=E.useState(!1),[rt,Te]=E.useState(!1),[it,ot]=E.useState([]),[Xe,Ce]=E.useState("state"),[$,X]=E.useState(!1),[V,m]=E.useState(!1),j=$c("(max-width: 999px)"),ne=$c("(max-width: 759px)"),re=E.useRef(),ae=E.useRef(),ie=E.useRef(0),fe=E.useRef({}),ue=E.useRef({}),se=E.useRef([]),_e=E.useRef(new Set),et=E.useRef(null),mi=E.useRef(),lt=E.useRef(h),Wn=E.useRef(),wr=E.useRef(),xr=E.useRef(),qn=E.useRef(),Sr=E.useRef(null),It=E.useCallback(x=>{et.current=x,oe(x)},[]),Fe=E.useCallback(x=>{x&&_e.current.has(x.room_id)||(mi.current=x,P(x))},[]),Nt=E.useCallback(x=>{const A=x.filter(F=>!_e.current.has(F.room_id));se.current=A,_(A)},[]),en=E.useCallback(x=>{if(_e.current.has(x.room_id))return;const A=se.current.some(F=>F.room_id===x.room_id)?se.current.map(F=>F.room_id===x.room_id?x:F):[...se.current,x];se.current=A,_(A)},[]),Ht=E.useCallback((x,A)=>{if(_e.current.has(x))return;const F=A(ue.current[x]??No);ue.current={...ue.current,[x]:F},D(ue.current)},[]),Cn=E.useCallback(()=>!document.hidden,[]),hi=E.useCallback(()=>Sr.current??void 0,[]),Se=E.useCallback((x,A)=>{const F=x instanceof Error?x.message:"Unexpected daemon error.";xe(A?`${A}: ${F}`:F)},[]),tn=E.useCallback(async(x,A={})=>{var me;if(_e.current.has(x))return;let F=fe.current[x]??[],J=((me=F.at(-1))==null?void 0:me.seq)??0;const Y=()=>{var he;return!((he=A.signal)!=null&&he.aborted)&&!_e.current.has(x)&&(A.generation===void 0||ie.current===A.generation)};for(;Y();){const he=await o.call("room.history",{room_id:x,after:J,limit:200},A.signal?{signal:A.signal}:void 0);if(!Y())return;if(!Rp(he)||he.some((mt,Wt)=>mt.room_id!==x||mt.seq!==J+Wt+1))throw new Error("daemon returned an invalid history page");if(he.length>0){if(!Y())return;F=pi(fe.current[x]??F,he),fe.current={...fe.current,[x]:F},C(fe.current)}if(he.length===0){if(!Y())return;z(mt=>_e.current.has(x)||mt[x]?mt:{...mt,[x]:!0});return}J+=he.length}},[o]);E.useEffect(()=>{const x=Ic({intervalMs:5e3,visible:Cn,clock:c,run:async F=>{const J=lt.current;try{const Y=await o.call("room.list",{},{signal:F});if(!kp(Y))throw new Error("daemon returned an invalid room list");const me=Y.filter(he=>!_e.current.has(he.room_id));Nt(me),It(!0),xe(he=>he!=null&&he.startsWith("Disconnected:")?void 0:he),J&&lt.current===J&&!me.some(he=>he.room_id===J)&&(lt.current=void 0,y(void 0),Fe(void 0),L([]),le(`Room “${J}” is no longer available. No local data was changed.`),location.hash&&history.replaceState(null,"",`${location.pathname}${location.search}#/`))}catch(Y){if(F.aborted)return;It(!1);const me=Y instanceof Error?Y.message:"cowork daemon is unavailable";xe(`Disconnected: ${me}. Loaded room data is preserved.`)}}});re.current=x,x.start(),x.refresh();const A=()=>{document.hidden||x.refresh()};return document.addEventListener("visibilitychange",A),()=>{document.removeEventListener("visibilitychange",A),re.current=void 0,x.stop()}},[c,Nt,o,It,Fe,Cn]),E.useEffect(()=>{const x=()=>{const A=Fc(location.hash),F=A&&!_e.current.has(A)?A:void 0;lt.current=F,y(F),L([]),A&&!F&&history.replaceState(null,"",`${location.pathname}${location.search}#/`)};return window.addEventListener("hashchange",x),()=>window.removeEventListener("hashchange",x)},[]),E.useEffect(()=>{const x=++ie.current;if(!h){Fe(void 0),L([]);return}if(_e.current.has(h)){lt.current=void 0,y(void 0),Fe(void 0),L([]),location.hash&&history.replaceState(null,"",`${location.pathname}${location.search}#/`);return}const A=u.find(Y=>Y.room_id===h);A&&Fe(A);const F=Ic({intervalMs:2e3,visible:Cn,clock:c,run:async Y=>{try{const[me,he,mt]=await Promise.allSettled([o.call("room.show",{room_id:h},{signal:Y}),o.call("room.participants",{room_id:h},{signal:Y}),tn(h,{generation:x,signal:Y})]);if(Y.aborted||ie.current!==x||_e.current.has(h))return;if(me.status==="rejected")throw me.reason;const Wt=me.value;if(!ui(Wt))throw new Error("daemon returned invalid room details");if(ie.current!==x||_e.current.has(h)||Wt.room_id!==h)return;if(Fe(Wt),he.status==="fulfilled"&&kc(he.value)){const rn=he.value;L(Yn=>_e.current.has(h)||ie.current!==x||Em(Yn,rn)?Yn:rn)}he.status==="fulfilled"&&!kc(he.value)?Se(new Error("daemon returned invalid participant details"),"Participant refresh failed"):he.status==="rejected"&&!Y.aborted&&Se(he.reason,"Participant refresh failed"),mt.status==="rejected"&&!Y.aborted&&Se(mt.reason,"History refresh failed"),en(Wt),It(!0)}catch(me){if(Y.aborted||ie.current!==x)return;It(!1),Se(me,"Disconnected")}}});ae.current=F,F.start(),F.refresh();const J=()=>{document.hidden||F.refresh()};return document.addEventListener("visibilitychange",J),()=>{document.removeEventListener("visibilitychange",J),ae.current===F&&(ae.current=void 0),F.stop()}},[c,tn,en,Se,o,h,It,Fe,Cn]);const nn=E.useCallback(x=>{if(_e.current.has(x)){lt.current=void 0,y(void 0),Fe(void 0),L([]),history.replaceState(null,"",`${location.pathname}${location.search}#/`);return}lt.current=x,y(x),L([]),le(void 0),Ke(!1),Te(!1),X(!1);const A=`#/rooms/${encodeURIComponent(x)}`;location.hash!==A&&(location.hash=A)},[Fe]),We=E.useCallback(()=>{var x,A;(x=re.current)==null||x.refresh(),(A=ae.current)==null||A.refresh()},[]),jn=E.useCallback(async(x,A,F)=>{if(et.current!==!0)throw new Error("The daemon is disconnected. Your fields are retained.");try{const J=await o.call("room.create",{name:x,goal:A.trim(),briefing:F.trim()});if(!ui(J))throw new Error("daemon returned invalid created room details");Re(!1),Ce("invite"),m(!0),nn(J.room_id),We()}catch(J){throw Se(J,"Create room failed"),J}},[We,Se,o,nn]),Nn=E.useCallback(async(x,A)=>{if(Object.keys(A).length===0)return;const F=se.current.find(J=>J.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. Your fields are retained.");if(!F||!pt(F.state,!0).canEditSettings)throw new Error("Room settings are unavailable in the current lifecycle. Your fields are retained.");try{const J=await o.call("room.settings",{room_id:x,...A});if(!ui(J)||J.room_id!==x)throw new Error("daemon returned invalid updated room details");te(!1),We()}catch(J){throw Se(J,"Settings update failed"),J}},[We,Se,o]),de=E.useMemo(()=>(k==null?void 0:k.room_id)===h?k:u.find(x=>x.room_id===h),[u,k,h]),vi=E.useCallback(async(x,A)=>{const F=se.current.find(J=>J.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The invite form is retained.");if(!F||!pt(F.state,!0).canCreateInvite)throw new Error("Invites are unavailable in the current room lifecycle. The form is retained.");try{const J={room_id:x,...A},Y=await o.call("room.invite",J),me=Cp(Y,J);ot(he=>[...he,{room_id:x,receipts:[me]}]),We()}catch(J){throw Se(J,"Create invite failed"),J}},[We,Se,o]),yi=E.useCallback(async(x,A)=>{const F=se.current.find(Y=>Y.room_id===x),J=F==null?void 0:F.invites.find(Y=>Y.invite_id===A);if(et.current!==!0)throw new Error("The daemon is disconnected. The revoke confirmation is retained.");if(!F||!pt(F.state,!0).canRevokeInvite||!J||!jm(J.state))throw new Error("This invite can no longer be revoked. The confirmation is retained.");try{const Y=await o.call("room.revoke",{room_id:x,invite_id:A});return We(),Y}catch(Y){throw Se(Y,"Revoke invite failed"),Y}},[We,Se,o]),Do=E.useCallback(async x=>{const A=se.current.find(F=>F.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. Recovery was not started.");if(!A||!pt(A.state,!0).canRecoverInvite||!A.invites.some(F=>F.state==="replacement_required"))throw new Error("Invite recovery is unavailable in the current room state.");try{const F=await o.call("room.recover",{room_id:A.room_id}),J=jp(F,A);J.length>0&&ot(Y=>[...Y,{room_id:A.room_id,receipts:J}]),We()}catch(F){throw Se(F,"Recover invites failed"),F}},[We,Se,o]),kr=E.useCallback(async x=>{if(!x.recovery_of)throw new Error("Recovery receipt has no old invite pointer.");const A=se.current.find(F=>F.room_id===x.room_id);if(et.current!==!0)throw new Error("The daemon is disconnected. The recovery receipt is retained.");if(!A||!Ac(A,x))throw new Error("The exact recovery lineage is no longer confirmable. The receipt is retained.");try{const F=await o.call("room.recover.confirm",{room_id:x.room_id,recovery_of:x.recovery_of,invite_id:x.invite.invite_id});Np(F,x),We()}catch(F){throw Se(F,"Confirm recovery failed"),F}},[We,Se,o]),Er=E.useCallback(async(x,A)=>{const F=ue.current[x]??No;if(F.pending||F.draft!==A)return;const J=se.current.find(Y=>Y.room_id===x);if(et.current!==!0||!J||!pt(J.state,!0).canMessage){Ht(x,Y=>({...Y,error:"Messaging is unavailable because the connection or room lifecycle changed. Your draft is retained."}));return}Ht(x,Y=>({...Y,pending:!0,error:void 0}));try{const Y=await o.call("room.message",{room_id:x,text:A});if(!Hc(Y)||Y.kind!=="message"||Y.room_id!==x||Y.category!=="chat"||Y.text!==A||Y.author.identity!==J.identity_cid||Y.author.display_name!==J.identity_name||Y.author.role!=="room")throw new Error("daemon returned invalid message confirmation");if(_e.current.has(x))return;Ht(x,me=>({draft:me.draft===A?"":me.draft,pending:!1})),tn(x).catch(me=>Se(me,"History refresh failed"))}catch(Y){Ht(x,me=>({...me,pending:!1,error:Cm(Y)}))}},[tn,Se,o,Ht]),Cr=E.useCallback(async x=>{const A=se.current.find(F=>F.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The room was not closed.");if(!A||!pt(A.state,!0).canClose)throw new Error("This room cannot be closed from its current state.");try{const F=await o.call("room.close",{room_id:x});if(!ui(F)||F.room_id!==x||F.state!=="closed")throw new Error("daemon returned invalid closed room details");lt.current===x&&Fe(F),en(F),Ke(!1),We()}catch(F){throw Se(F,"Close room failed"),F}},[We,en,Se,o,Fe]),jr=E.useCallback(async x=>{var F,J;const A=se.current.find(Y=>Y.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The room was not deleted.");if(!A||!pt(A.state,!0).canDelete)throw new Error("Only a closed room can be deleted.");try{const Y=await o.call("room.delete",{room_id:x,confirm:!0});if(!Tp(Y)||Y.room_id!==x)throw new Error("daemon returned invalid deletion confirmation");_e.current.add(x),ie.current+=1,(F=ae.current)==null||F.stop(),Nt(se.current.filter(me=>me.room_id!==x)),Fe(void 0),y(void 0),lt.current=void 0,L([]),fe.current=Object.fromEntries(Object.entries(fe.current).filter(([me])=>me!==x)),C(fe.current),ue.current=Object.fromEntries(Object.entries(ue.current).filter(([me])=>me!==x)),D(ue.current),z(me=>Object.fromEntries(Object.entries(me).filter(([he])=>he!==x))),Te(!1),m(!1),le(`Room “${x}” was deleted from this host. Remote copies and backups were not purged.`),history.replaceState(null,"",`${location.pathname}${location.search}#/`),(J=re.current)==null||J.refresh()}catch(Y){throw Se(Y,"Delete room failed"),Y}},[Nt,Se,o,Fe]);return a.jsxs("div",{className:"cowork-app",children:[a.jsx(qp,{rooms:u,selectedRoomId:h,connected:O,open:$,sheet:ne,onClose:()=>X(!1),onCreate:x=>{Wn.current=x,Re(!0)},onSelect:nn}),a.jsx(vm,{room:de,records:de?I[de.room_id]??[]:[],historyReady:!!(de&&U[de.room_id]),connected:O===!0,visible:!document.hidden,composerState:de?q[de.room_id]??No:No,onComposerDraft:de?x=>Ht(de.room_id,A=>({...A,draft:x})):void 0,onOpenRooms:()=>X(!0),onOpenContext:()=>m(!0),onSettings:x=>{wr.current=x,te(!0)},onSendMessage:de?x=>Er(de.room_id,x):void 0}),a.jsx(em,{room:de,participants:S,archiveCount:de?((Qn=I[de.room_id])==null?void 0:Qn.length)??0:0,connected:O===!0,tab:Xe,open:V,drawer:j,panelRef:Sr,onTab:Ce,onClose:()=>m(!1),onCreateInvite:de?x=>vi(de.room_id,x):void 0,onRevokeInvite:de?x=>yi(de.room_id,x):void 0,onRecoverInvites:de?()=>Do(de.room_id):void 0,onRequestClose:x=>{xr.current=x,Ke(!0)},onRequestDelete:x=>{qn.current=x,Te(!0)}}),(ne&&$||j&&V)&&a.jsx("button",{className:"responsive-scrim",type:"button","aria-label":"Close open panel",onClick:()=>{X(!1),m(!1)}}),O===!1&&a.jsxs("div",{className:"disconnect-banner",role:"status",children:[a.jsx("strong",{children:"Disconnected"}),a.jsx("span",{children:"Loaded data remains visible. Mutations are disabled until the daemon answers."})]}),ge&&a.jsxs("div",{className:"error-banner",role:"alert",children:[a.jsx("span",{children:ge}),a.jsx("button",{type:"button",onClick:()=>xe(void 0),"aria-label":"Dismiss error",children:"×"})]}),ee&&a.jsxs("div",{className:"notice-banner",role:"status",children:[a.jsx("span",{children:ee}),a.jsx("button",{type:"button",onClick:()=>le(void 0),"aria-label":"Dismiss notice",children:"×"})]}),a.jsx(Qp,{open:pe,connected:O===!0,restoreFocus:Wn.current,fallbackFocus:hi,onClose:()=>Re(!1),onCreate:jn}),de&&Ee&&a.jsx(Yp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canEditSettings,restoreFocus:wr.current,onClose:()=>te(!1),onSave:x=>Nn(de.room_id,x)},de.room_id),de&&Ye&&a.jsx(Kp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canClose,restoreFocus:xr.current,onClose:()=>Ke(!1),onConfirm:()=>Cr(de.room_id)},`close:${de.room_id}`),de&&rt&&a.jsx(Xp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canDelete,restoreFocus:qn.current,onClose:()=>Te(!1),onConfirm:()=>jr(de.room_id)},`delete:${de.room_id}`),it[0]&&a.jsx(Zp,{vault:it[0],connected:O===!0,canConfirm:x=>{const A=u.find(F=>F.room_id===x.room_id);return!!(A&&Ac(A,x))},onClose:()=>ot(x=>x.slice(1)),onConfirm:kr})]})}function Fc(o){const c=/^#\/rooms\/([^/?#]+)$/.exec(o);if(c!=null&&c[1])try{return decodeURIComponent(c[1])}catch{return}}function Em(o,c){return o.length===c.length&&o.every((u,_)=>JSON.stringify(u)===JSON.stringify(c[_]))}const No={draft:"",pending:!1};function Cm(o){return o instanceof _t&&o.outcomeUnknown?`The message request did not receive a confirmation, so its outcome is unknown. Your draft is retained. ${o.message}`:o instanceof Error?o.message:"Message send failed."}function jm(o){return o==="live"||o==="replacement_required"||o==="receipt_pending"}function Ac(o,c){if(!pt(o.state,!0).canRecoverInvite||c.recovery_of===void 0)return!1;const u=o.invites.find(h=>h.invite_id===c.recovery_of);if(!u||u.mode!==c.invite.mode||u.role!==c.invite.role||u.min_accepts!==c.invite.min_accepts)return!1;const _=o.invites.find(h=>h.invite_id===c.invite.invite_id);return _?_.recovery_of!==u.invite_id||_.mode!==u.mode||_.role!==u.role||_.min_accepts!==u.min_accepts?!1:_.state==="receipt_pending"?u.state==="replacement_required"&&_.recovery_confirmed===!1&&_.accepted_cids.length===0:u.state==="revoked"&&_.recovery_confirmed===!0&&(_.state==="live"||_.state==="consumed"||_.state==="replacement_required"||_.state==="revoked"):u.state==="replacement_required"}function $c(o){const c=E.useMemo(()=>typeof window.matchMedia=="function"?window.matchMedia(o):void 0,[o]),[u,_]=E.useState(()=>(c==null?void 0:c.matches)??!1);return E.useEffect(()=>{if(!c)return;const h=y=>_(y.matches);return _(c.matches),c.addEventListener("change",h),()=>c.removeEventListener("change",h)},[c]),u}const Jc=document.getElementById("root");if(!Jc)throw new Error("missing root element");rp.createRoot(Jc).render(a.jsx(E.StrictMode,{children:a.jsx(km,{})}));
40
+ `+l.stack}return{value:e,source:t,stack:i,digest:null}}function Bl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vl(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Sf=typeof WeakMap=="function"?WeakMap:Map;function xu(e,t,n){n=Gt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fo||(fo=!0,rs=r),Vl(e,t)},n}function Su(e,t,n){n=Gt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Vl(e,t)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(n.callback=function(){Vl(e,t),typeof r!="function"&&(gn===null?gn=new Set([this]):gn.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ku(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sf;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=If.bind(null,e,t,n),t.then(e,e))}function Eu(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Cu(e,t,n,r,i){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Gt(-1,1),t.tag=2,vn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var kf=ge.ReactCurrentOwner,ut=!1;function tt(e,t,n,r){t.child=e===null?qa(t,null,n,r):sr(t,e.child,n,r)}function ju(e,t,n,r,i){n=n.render;var l=t.ref;return ur(t,i),r=Ol(e,t,n,r,l,i),n=Ml(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Zt(e,t,i)):(Pe&&n&&vl(t),t.flags|=1,tt(e,t,r,i),t.child)}function Nu(e,t,n,r,i){if(e===null){var l=n.type;return typeof l=="function"&&!cs(l)&&l.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=l,Ru(e,t,l,r,i)):(e=go(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,(e.lanes&i)===0){var s=l.memoizedProps;if(n=n.compare,n=n!==null?n:Br,n(s,r)&&e.ref===t.ref)return Zt(e,t,i)}return t.flags|=1,e=Sn(l,r),e.ref=t.ref,e.return=t,t.child=e}function Ru(e,t,n,r,i){if(e!==null){var l=e.memoizedProps;if(Br(l,r)&&e.ref===t.ref)if(ut=!1,t.pendingProps=r=l,(e.lanes&i)!==0)(e.flags&131072)!==0&&(ut=!0);else return t.lanes=e.lanes,Zt(e,t,i)}return Hl(e,t,n,r,i)}function Tu(e,t,n){var r=t.pendingProps,i=r.children,l=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ke(pr,gt),gt|=n;else{if((n&1073741824)===0)return e=l!==null?l.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ke(pr,gt),gt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=l!==null?l.baseLanes:n,ke(pr,gt),gt|=r}else l!==null?(r=l.baseLanes|n,t.memoizedState=null):r=n,ke(pr,gt),gt|=r;return tt(e,t,i,n),t.child}function Pu(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hl(e,t,n,r,i){var l=at(n)?Pn:Ge.current;return l=rr(t,l),ur(t,i),n=Ol(e,t,n,r,l,i),r=Ml(),e!==null&&!ut?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Zt(e,t,i)):(Pe&&r&&vl(t),t.flags|=1,tt(e,t,n,i),t.child)}function Lu(e,t,n,r,i){if(at(n)){var l=!0;Vi(t)}else l=!1;if(ur(t,i),t.stateNode===null)lo(e,t),_u(t,n,r),Ul(t,n,r,i),r=!0;else if(e===null){var s=t.stateNode,d=t.memoizedProps;s.props=d;var f=s.context,w=n.contextType;typeof w=="object"&&w!==null?w=kt(w):(w=at(n)?Pn:Ge.current,w=rr(t,w));var R=n.getDerivedStateFromProps,T=typeof R=="function"||typeof s.getSnapshotBeforeUpdate=="function";T||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==r||f!==w)&&wu(t,s,r,w),hn=!1;var N=t.memoizedState;s.state=N,Zi(t,r,s,i),f=t.memoizedState,d!==r||N!==f||st.current||hn?(typeof R=="function"&&($l(t,n,R,r),f=t.memoizedState),(d=hn||gu(t,n,d,r,N,f,w))?(T||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=f),s.props=r,s.state=f,s.context=w,r=d):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Ya(e,t),d=t.memoizedProps,w=t.type===t.elementType?d:Lt(t.type,d),s.props=w,T=t.pendingProps,N=s.context,f=n.contextType,typeof f=="object"&&f!==null?f=kt(f):(f=at(n)?Pn:Ge.current,f=rr(t,f));var B=n.getDerivedStateFromProps;(R=typeof B=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==T||N!==f)&&wu(t,s,r,f),hn=!1,N=t.memoizedState,s.state=N,Zi(t,r,s,i);var W=t.memoizedState;d!==T||N!==W||st.current||hn?(typeof B=="function"&&($l(t,n,B,r),W=t.memoizedState),(w=hn||gu(t,n,w,r,N,W,f)||!1)?(R||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,W,f),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,W,f)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=W),s.props=r,s.state=W,s.context=f,r=w):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),r=!1)}return Wl(e,t,n,r,l,i)}function Wl(e,t,n,r,i,l){Pu(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return i&&Ia(t,n,!1),Zt(e,t,l);r=t.stateNode,kf.current=t;var d=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=sr(t,e.child,null,l),t.child=sr(t,null,d,l)):tt(e,t,d,l),t.memoizedState=r.state,i&&Ia(t,n,!0),t.child}function zu(e){var t=e.stateNode;t.pendingContext?Ma(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ma(e,t.context,!1),Nl(e,t.containerInfo)}function Ou(e,t,n,r,i){return lr(),wl(i),t.flags|=256,tt(e,t,n,r),t.child}var ql={dehydrated:null,treeContext:null,retryLane:0};function Ql(e){return{baseLanes:e,cachePool:null,transitions:null}}function Mu(e,t,n){var r=t.pendingProps,i=Le.current,l=!1,s=(t.flags&128)!==0,d;if((d=s)||(d=e!==null&&e.memoizedState===null?!1:(i&2)!==0),d?(l=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),ke(Le,i&1),e===null)return _l(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(s=r.children,e=r.fallback,l?(r=t.mode,l=t.child,s={mode:"hidden",children:s},(r&1)===0&&l!==null?(l.childLanes=0,l.pendingProps=s):l=_o(s,r,0,null),e=Un(e,r,n,null),l.return=t,e.return=t,l.sibling=e,t.child=l,t.child.memoizedState=Ql(n),t.memoizedState=ql,e):Yl(t,s));if(i=e.memoizedState,i!==null&&(d=i.dehydrated,d!==null))return Ef(e,t,s,r,d,i,n);if(l){l=r.fallback,s=t.mode,i=e.child,d=i.sibling;var f={mode:"hidden",children:r.children};return(s&1)===0&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=f,t.deletions=null):(r=Sn(i,f),r.subtreeFlags=i.subtreeFlags&14680064),d!==null?l=Sn(d,l):(l=Un(l,s,n,null),l.flags|=2),l.return=t,r.return=t,r.sibling=l,t.child=r,r=l,l=t.child,s=e.child.memoizedState,s=s===null?Ql(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},l.memoizedState=s,l.childLanes=e.childLanes&~n,t.memoizedState=ql,r}return l=e.child,e=l.sibling,r=Sn(l,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Yl(e,t){return t=_o({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function oo(e,t,n,r){return r!==null&&wl(r),sr(t,e.child,null,n),e=Yl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ef(e,t,n,r,i,l,s){if(n)return t.flags&256?(t.flags&=-257,r=Bl(Error(u(422))),oo(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(l=r.fallback,i=t.mode,r=_o({mode:"visible",children:r.children},i,0,null),l=Un(l,i,s,null),l.flags|=2,r.return=t,l.return=t,r.sibling=l,t.child=r,(t.mode&1)!==0&&sr(t,e.child,null,s),t.child.memoizedState=Ql(s),t.memoizedState=ql,l);if((t.mode&1)===0)return oo(e,t,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var d=r.dgst;return r=d,l=Error(u(419)),r=Bl(l,r,void 0),oo(e,t,s,r)}if(d=(s&e.childLanes)!==0,ut||d){if(r=Ve,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=(i&(r.suspendedLanes|s))!==0?0:i,i!==0&&i!==l.retryLane&&(l.retryLane=i,Xt(e,i),Mt(r,e,i,-1))}return us(),r=Bl(Error(u(421))),oo(e,t,s,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=Ff.bind(null,e),i._reactRetry=t,null):(e=l.treeContext,yt=dn(i.nextSibling),vt=t,Pe=!0,Pt=null,e!==null&&(xt[St++]=Yt,xt[St++]=Kt,xt[St++]=Ln,Yt=e.id,Kt=e.overflow,Ln=t),t=Yl(t,r.children),t.flags|=4096,t)}function Du(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),El(e.return,t,n)}function Kl(e,t,n,r,i){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=r,l.tail=n,l.tailMode=i)}function Iu(e,t,n){var r=t.pendingProps,i=r.revealOrder,l=r.tail;if(tt(e,t,r.children,n),r=Le.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Du(e,n,t);else if(e.tag===19)Du(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ke(Le,r),(t.mode&1)===0)t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Ji(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Kl(t,!1,i,n,l);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ji(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Kl(t,!0,n,null,l);break;case"together":Kl(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function lo(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Zt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),In|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cf(e,t,n){switch(t.tag){case 3:zu(t),lr();break;case 5:Ga(t);break;case 1:at(t.type)&&Vi(t);break;case 4:Nl(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;ke(Ki,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ke(Le,Le.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Mu(e,t,n):(ke(Le,Le.current&1),e=Zt(e,t,n),e!==null?e.sibling:null);ke(Le,Le.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return Iu(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ke(Le,Le.current),r)break;return null;case 22:case 23:return t.lanes=0,Tu(e,t,n)}return Zt(e,t,n)}var Fu,Xl,Au,$u;Fu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Xl=function(){},Au=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Mn($t.current);var l=null;switch(n){case"input":i=Wn(e,i),r=Wn(e,r),l=[];break;case"select":i=V({},i,{value:void 0}),r=V({},r,{value:void 0}),l=[];break;case"textarea":i=en(e,i),r=en(e,r),l=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=$i)}kr(n,r);var s;n=null;for(w in i)if(!r.hasOwnProperty(w)&&i.hasOwnProperty(w)&&i[w]!=null)if(w==="style"){var d=i[w];for(s in d)d.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else w!=="dangerouslySetInnerHTML"&&w!=="children"&&w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&w!=="autoFocus"&&(h.hasOwnProperty(w)?l||(l=[]):(l=l||[]).push(w,null));for(w in r){var f=r[w];if(d=i!=null?i[w]:void 0,r.hasOwnProperty(w)&&f!==d&&(f!=null||d!=null))if(w==="style")if(d){for(s in d)!d.hasOwnProperty(s)||f&&f.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in f)f.hasOwnProperty(s)&&d[s]!==f[s]&&(n||(n={}),n[s]=f[s])}else n||(l||(l=[]),l.push(w,n)),n=f;else w==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,d=d?d.__html:void 0,f!=null&&d!==f&&(l=l||[]).push(w,f)):w==="children"?typeof f!="string"&&typeof f!="number"||(l=l||[]).push(w,""+f):w!=="suppressContentEditableWarning"&&w!=="suppressHydrationWarning"&&(h.hasOwnProperty(w)?(f!=null&&w==="onScroll"&&je("scroll",e),l||d===f||(l=[])):(l=l||[]).push(w,f))}n&&(l=l||[]).push("style",n);var w=l;(t.updateQueue=w)&&(t.flags|=4)}},$u=function(e,t,n,r){n!==r&&(t.flags|=4)};function ni(e,t){if(!Pe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function jf(e,t,n){var r=t.pendingProps;switch(yl(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return at(t.type)&&Bi(),Je(t),null;case 3:return r=t.stateNode,cr(),Ne(st),Ne(Ge),Pl(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Qi(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pt!==null&&(ls(Pt),Pt=null))),Xl(e,t),Je(t),null;case 5:Rl(t);var i=Mn(Zr.current);if(n=t.type,e!==null&&t.stateNode!=null)Au(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(u(166));return Je(t),null}if(e=Mn($t.current),Qi(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[At]=t,r[Qr]=l,e=(t.mode&1)!==0,n){case"dialog":je("cancel",r),je("close",r);break;case"iframe":case"object":case"embed":je("load",r);break;case"video":case"audio":for(i=0;i<Hr.length;i++)je(Hr[i],r);break;case"source":je("error",r);break;case"img":case"image":case"link":je("error",r),je("load",r);break;case"details":je("toggle",r);break;case"input":wr(r,l),je("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},je("invalid",r);break;case"textarea":Ht(r,l),je("invalid",r)}kr(n,l),i=null;for(var s in l)if(l.hasOwnProperty(s)){var d=l[s];s==="children"?typeof d=="string"?r.textContent!==d&&(l.suppressHydrationWarning!==!0&&Ai(r.textContent,d,e),i=["children",d]):typeof d=="number"&&r.textContent!==""+d&&(l.suppressHydrationWarning!==!0&&Ai(r.textContent,d,e),i=["children",""+d]):h.hasOwnProperty(s)&&d!=null&&s==="onScroll"&&je("scroll",r)}switch(n){case"input":et(r),Sr(r,l,!0);break;case"textarea":et(r),hi(r);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(r.onclick=$i)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Se(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[At]=t,e[Qr]=r,Fu(e,t,!1,!1),t.stateNode=e;e:{switch(s=Er(n,r),n){case"dialog":je("cancel",e),je("close",e),i=r;break;case"iframe":case"object":case"embed":je("load",e),i=r;break;case"video":case"audio":for(i=0;i<Hr.length;i++)je(Hr[i],e);i=r;break;case"source":je("error",e),i=r;break;case"img":case"image":case"link":je("error",e),je("load",e),i=r;break;case"details":je("toggle",e),i=r;break;case"input":wr(e,r),i=Wn(e,r),je("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=V({},r,{value:void 0}),je("invalid",e);break;case"textarea":Ht(e,r),i=en(e,r),je("invalid",e);break;default:i=r}kr(n,i),d=i;for(l in d)if(d.hasOwnProperty(l)){var f=d[l];l==="style"?yi(e,f):l==="dangerouslySetInnerHTML"?(f=f?f.__html:void 0,f!=null&&We(e,f)):l==="children"?typeof f=="string"?(n!=="textarea"||f!=="")&&jn(e,f):typeof f=="number"&&jn(e,""+f):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(h.hasOwnProperty(l)?f!=null&&l==="onScroll"&&je("scroll",e):f!=null&&le(e,l,f,s))}switch(n){case"input":et(e),Sr(e,r,!1);break;case"textarea":et(e),hi(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ue(r.value));break;case"select":e.multiple=!!r.multiple,l=r.value,l!=null?Nt(e,!!r.multiple,l,!1):r.defaultValue!=null&&Nt(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=$i)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Je(t),null;case 6:if(e&&t.stateNode!=null)$u(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(u(166));if(n=Mn(Zr.current),Mn($t.current),Qi(t)){if(r=t.stateNode,n=t.memoizedProps,r[At]=t,(l=r.nodeValue!==n)&&(e=vt,e!==null))switch(e.tag){case 3:Ai(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ai(r.nodeValue,n,(e.mode&1)!==0)}l&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[At]=t,t.stateNode=r}return Je(t),null;case 13:if(Ne(Le),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Pe&&yt!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Va(),lr(),t.flags|=98560,l=!1;else if(l=Qi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!l)throw Error(u(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(u(317));l[At]=t}else lr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),l=!1}else Pt!==null&&(ls(Pt),Pt=null),l=!0;if(!l)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Le.current&1)!==0?$e===0&&($e=3):us())),t.updateQueue!==null&&(t.flags|=4),Je(t),null);case 4:return cr(),Xl(e,t),e===null&&Wr(t.stateNode.containerInfo),Je(t),null;case 10:return kl(t.type._context),Je(t),null;case 17:return at(t.type)&&Bi(),Je(t),null;case 19:if(Ne(Le),l=t.memoizedState,l===null)return Je(t),null;if(r=(t.flags&128)!==0,s=l.rendering,s===null)if(r)ni(l,!1);else{if($e!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(s=Ji(e),s!==null){for(t.flags|=128,ni(l,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)l=n,e=r,l.flags&=14680066,s=l.alternate,s===null?(l.childLanes=0,l.lanes=e,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,l.type=s.type,e=s.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ke(Le,Le.current&1|2),t.child}e=e.sibling}l.tail!==null&&Me()>mr&&(t.flags|=128,r=!0,ni(l,!1),t.lanes=4194304)}else{if(!r)if(e=Ji(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ni(l,!0),l.tail===null&&l.tailMode==="hidden"&&!s.alternate&&!Pe)return Je(t),null}else 2*Me()-l.renderingStartTime>mr&&n!==1073741824&&(t.flags|=128,r=!0,ni(l,!1),t.lanes=4194304);l.isBackwards?(s.sibling=t.child,t.child=s):(n=l.last,n!==null?n.sibling=s:t.child=s,l.last=s)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Me(),t.sibling=null,n=Le.current,ke(Le,r?n&1|2:n&1),t):(Je(t),null);case 22:case 23:return as(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(gt&1073741824)!==0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),null;case 24:return null;case 25:return null}throw Error(u(156,t.tag))}function Nf(e,t){switch(yl(t),t.tag){case 1:return at(t.type)&&Bi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cr(),Ne(st),Ne(Ge),Pl(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Rl(t),null;case 13:if(Ne(Le),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));lr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(Le),null;case 4:return cr(),null;case 10:return kl(t.type._context),null;case 22:case 23:return as(),null;case 24:return null;default:return null}}var so=!1,be=!1,Rf=typeof WeakSet=="function"?WeakSet:Set,H=null;function fr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Oe(e,t,r)}else n.current=null}function Gl(e,t,n){try{n()}catch(r){Oe(e,t,r)}}var Uu=!1;function Tf(e,t){if(al=Ni,e=ga(),el(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,l=r.focusNode;r=r.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break e}var s=0,d=-1,f=-1,w=0,R=0,T=e,N=null;t:for(;;){for(var B;T!==n||i!==0&&T.nodeType!==3||(d=s+i),T!==l||r!==0&&T.nodeType!==3||(f=s+r),T.nodeType===3&&(s+=T.nodeValue.length),(B=T.firstChild)!==null;)N=T,T=B;for(;;){if(T===e)break t;if(N===n&&++w===i&&(d=s),N===l&&++R===r&&(f=s),(B=T.nextSibling)!==null)break;T=N,N=T.parentNode}T=B}n=d===-1||f===-1?null:{start:d,end:f}}else n=null}n=n||{start:0,end:0}}else n=null;for(ul={focusedElem:e,selectionRange:n},Ni=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var W=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(W!==null){var Q=W.memoizedProps,De=W.memoizedState,v=t.stateNode,p=v.getSnapshotBeforeUpdate(t.elementType===t.type?Q:Lt(t.type,Q),De);v.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(M){Oe(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return W=Uu,Uu=!1,W}function ri(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var l=i.destroy;i.destroy=void 0,l!==void 0&&Gl(t,n,l)}i=i.next}while(i!==r)}}function ao(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Zl(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Bu(e){var t=e.alternate;t!==null&&(e.alternate=null,Bu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[At],delete t[Qr],delete t[pl],delete t[df],delete t[ff])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Vu(e){return e.tag===5||e.tag===3||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Vu(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=$i));else if(r!==4&&(e=e.child,e!==null))for(Jl(e,t,n),e=e.sibling;e!==null;)Jl(e,t,n),e=e.sibling}function bl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bl(e,t,n),e=e.sibling;e!==null;)bl(e,t,n),e=e.sibling}var qe=null,zt=!1;function yn(e,t,n){for(n=n.child;n!==null;)Wu(e,t,n),n=n.sibling}function Wu(e,t,n){if(Ft&&typeof Ft.onCommitFiberUnmount=="function")try{Ft.onCommitFiberUnmount(xi,n)}catch{}switch(n.tag){case 5:be||fr(n,t);case 6:var r=qe,i=zt;qe=null,yn(e,t,n),qe=r,zt=i,qe!==null&&(zt?(e=qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):qe.removeChild(n.stateNode));break;case 18:qe!==null&&(zt?(e=qe,n=n.stateNode,e.nodeType===8?fl(e.parentNode,n):e.nodeType===1&&fl(e,n),Dr(e)):fl(qe,n.stateNode));break;case 4:r=qe,i=zt,qe=n.stateNode.containerInfo,zt=!0,yn(e,t,n),qe=r,zt=i;break;case 0:case 11:case 14:case 15:if(!be&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var l=i,s=l.destroy;l=l.tag,s!==void 0&&((l&2)!==0||(l&4)!==0)&&Gl(n,t,s),i=i.next}while(i!==r)}yn(e,t,n);break;case 1:if(!be&&(fr(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(d){Oe(n,t,d)}yn(e,t,n);break;case 21:yn(e,t,n);break;case 22:n.mode&1?(be=(r=be)||n.memoizedState!==null,yn(e,t,n),be=r):yn(e,t,n);break;default:yn(e,t,n)}}function qu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rf),t.forEach(function(r){var i=Af.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ot(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var l=e,s=t,d=s;e:for(;d!==null;){switch(d.tag){case 5:qe=d.stateNode,zt=!1;break e;case 3:qe=d.stateNode.containerInfo,zt=!0;break e;case 4:qe=d.stateNode.containerInfo,zt=!0;break e}d=d.return}if(qe===null)throw Error(u(160));Wu(l,s,i),qe=null,zt=!1;var f=i.alternate;f!==null&&(f.return=null),i.return=null}catch(w){Oe(i,t,w)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Qu(t,e),t=t.sibling}function Qu(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ot(t,e),Bt(e),r&4){try{ri(3,e,e.return),ao(3,e)}catch(Q){Oe(e,e.return,Q)}try{ri(5,e,e.return)}catch(Q){Oe(e,e.return,Q)}}break;case 1:Ot(t,e),Bt(e),r&512&&n!==null&&fr(n,n.return);break;case 5:if(Ot(t,e),Bt(e),r&512&&n!==null&&fr(n,n.return),e.flags&32){var i=e.stateNode;try{jn(i,"")}catch(Q){Oe(e,e.return,Q)}}if(r&4&&(i=e.stateNode,i!=null)){var l=e.memoizedProps,s=n!==null?n.memoizedProps:l,d=e.type,f=e.updateQueue;if(e.updateQueue=null,f!==null)try{d==="input"&&l.type==="radio"&&l.name!=null&&xr(i,l),Er(d,s);var w=Er(d,l);for(s=0;s<f.length;s+=2){var R=f[s],T=f[s+1];R==="style"?yi(i,T):R==="dangerouslySetInnerHTML"?We(i,T):R==="children"?jn(i,T):le(i,R,T,w)}switch(d){case"input":qn(i,l);break;case"textarea":Cn(i,l);break;case"select":var N=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!l.multiple;var B=l.value;B!=null?Nt(i,!!l.multiple,B,!1):N!==!!l.multiple&&(l.defaultValue!=null?Nt(i,!!l.multiple,l.defaultValue,!0):Nt(i,!!l.multiple,l.multiple?[]:"",!1))}i[Qr]=l}catch(Q){Oe(e,e.return,Q)}}break;case 6:if(Ot(t,e),Bt(e),r&4){if(e.stateNode===null)throw Error(u(162));i=e.stateNode,l=e.memoizedProps;try{i.nodeValue=l}catch(Q){Oe(e,e.return,Q)}}break;case 3:if(Ot(t,e),Bt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Dr(t.containerInfo)}catch(Q){Oe(e,e.return,Q)}break;case 4:Ot(t,e),Bt(e);break;case 13:Ot(t,e),Bt(e),i=e.child,i.flags&8192&&(l=i.memoizedState!==null,i.stateNode.isHidden=l,!l||i.alternate!==null&&i.alternate.memoizedState!==null||(ns=Me())),r&4&&qu(e);break;case 22:if(R=n!==null&&n.memoizedState!==null,e.mode&1?(be=(w=be)||R,Ot(t,e),be=w):Ot(t,e),Bt(e),r&8192){if(w=e.memoizedState!==null,(e.stateNode.isHidden=w)&&!R&&(e.mode&1)!==0)for(H=e,R=e.child;R!==null;){for(T=H=R;H!==null;){switch(N=H,B=N.child,N.tag){case 0:case 11:case 14:case 15:ri(4,N,N.return);break;case 1:fr(N,N.return);var W=N.stateNode;if(typeof W.componentWillUnmount=="function"){r=N,n=N.return;try{t=r,W.props=t.memoizedProps,W.state=t.memoizedState,W.componentWillUnmount()}catch(Q){Oe(r,n,Q)}}break;case 5:fr(N,N.return);break;case 22:if(N.memoizedState!==null){Xu(T);continue}}B!==null?(B.return=N,H=B):Xu(T)}R=R.sibling}e:for(R=null,T=e;;){if(T.tag===5){if(R===null){R=T;try{i=T.stateNode,w?(l=i.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(d=T.stateNode,f=T.memoizedProps.style,s=f!=null&&f.hasOwnProperty("display")?f.display:null,d.style.display=vi("display",s))}catch(Q){Oe(e,e.return,Q)}}}else if(T.tag===6){if(R===null)try{T.stateNode.nodeValue=w?"":T.memoizedProps}catch(Q){Oe(e,e.return,Q)}}else if((T.tag!==22&&T.tag!==23||T.memoizedState===null||T===e)&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===e)break e;for(;T.sibling===null;){if(T.return===null||T.return===e)break e;R===T&&(R=null),T=T.return}R===T&&(R=null),T.sibling.return=T.return,T=T.sibling}}break;case 19:Ot(t,e),Bt(e),r&4&&qu(e);break;case 21:break;default:Ot(t,e),Bt(e)}}function Bt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Vu(n)){var r=n;break e}n=n.return}throw Error(u(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(jn(i,""),r.flags&=-33);var l=Hu(e);bl(e,l,i);break;case 3:case 4:var s=r.stateNode.containerInfo,d=Hu(e);Jl(e,d,s);break;default:throw Error(u(161))}}catch(f){Oe(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pf(e,t,n){H=e,Yu(e)}function Yu(e,t,n){for(var r=(e.mode&1)!==0;H!==null;){var i=H,l=i.child;if(i.tag===22&&r){var s=i.memoizedState!==null||so;if(!s){var d=i.alternate,f=d!==null&&d.memoizedState!==null||be;d=so;var w=be;if(so=s,(be=f)&&!w)for(H=i;H!==null;)s=H,f=s.child,s.tag===22&&s.memoizedState!==null?Gu(i):f!==null?(f.return=s,H=f):Gu(i);for(;l!==null;)H=l,Yu(l),l=l.sibling;H=i,so=d,be=w}Ku(e)}else(i.subtreeFlags&8772)!==0&&l!==null?(l.return=i,H=l):Ku(e)}}function Ku(e){for(;H!==null;){var t=H;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:be||ao(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!be)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Lt(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var l=t.updateQueue;l!==null&&Xa(t,l,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Xa(t,s,n)}break;case 5:var d=t.stateNode;if(n===null&&t.flags&4){n=d;var f=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":f.autoFocus&&n.focus();break;case"img":f.src&&(n.src=f.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var w=t.alternate;if(w!==null){var R=w.memoizedState;if(R!==null){var T=R.dehydrated;T!==null&&Dr(T)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(u(163))}be||t.flags&512&&Zl(t)}catch(N){Oe(t,t.return,N)}}if(t===e){H=null;break}if(n=t.sibling,n!==null){n.return=t.return,H=n;break}H=t.return}}function Xu(e){for(;H!==null;){var t=H;if(t===e){H=null;break}var n=t.sibling;if(n!==null){n.return=t.return,H=n;break}H=t.return}}function Gu(e){for(;H!==null;){var t=H;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ao(4,t)}catch(f){Oe(t,n,f)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(f){Oe(t,i,f)}}var l=t.return;try{Zl(t)}catch(f){Oe(t,l,f)}break;case 5:var s=t.return;try{Zl(t)}catch(f){Oe(t,s,f)}}}catch(f){Oe(t,t.return,f)}if(t===e){H=null;break}var d=t.sibling;if(d!==null){d.return=t.return,H=d;break}H=t.return}}var Lf=Math.ceil,uo=ge.ReactCurrentDispatcher,es=ge.ReactCurrentOwner,Ct=ge.ReactCurrentBatchConfig,ve=0,Ve=null,Ie=null,Qe=0,gt=0,pr=fn(0),$e=0,ii=null,In=0,co=0,ts=0,oi=null,ct=null,ns=0,mr=1/0,Jt=null,fo=!1,rs=null,gn=null,po=!1,_n=null,mo=0,li=0,is=null,ho=-1,vo=0;function nt(){return(ve&6)!==0?Me():ho!==-1?ho:ho=Me()}function wn(e){return(e.mode&1)===0?1:(ve&2)!==0&&Qe!==0?Qe&-Qe:mf.transition!==null?(vo===0&&(vo=Hs()),vo):(e=we,e!==0||(e=window.event,e=e===void 0?16:Js(e.type)),e)}function Mt(e,t,n,r){if(50<li)throw li=0,is=null,Error(u(185));Pr(e,n,r),((ve&2)===0||e!==Ve)&&(e===Ve&&((ve&2)===0&&(co|=n),$e===4&&xn(e,Qe)),dt(e,r),n===1&&ve===0&&(t.mode&1)===0&&(mr=Me()+500,Hi&&mn()))}function dt(e,t){var n=e.callbackNode;pd(e,t);var r=Ei(e,e===Ve?Qe:0);if(r===0)n!==null&&Us(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Us(n),t===1)e.tag===0?pf(Ju.bind(null,e)):Fa(Ju.bind(null,e)),uf(function(){(ve&6)===0&&mn()}),n=null;else{switch(Ws(r)){case 1:n=Fo;break;case 4:n=Bs;break;case 16:n=wi;break;case 536870912:n=Vs;break;default:n=wi}n=lc(n,Zu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Zu(e,t){if(ho=-1,vo=0,(ve&6)!==0)throw Error(u(327));var n=e.callbackNode;if(hr()&&e.callbackNode!==n)return null;var r=Ei(e,e===Ve?Qe:0);if(r===0)return null;if((r&30)!==0||(r&e.expiredLanes)!==0||t)t=yo(e,r);else{t=r;var i=ve;ve|=2;var l=ec();(Ve!==e||Qe!==t)&&(Jt=null,mr=Me()+500,An(e,t));do try{Mf();break}catch(d){bu(e,d)}while(!0);Sl(),uo.current=l,ve=i,Ie!==null?t=0:(Ve=null,Qe=0,t=$e)}if(t!==0){if(t===2&&(i=Ao(e),i!==0&&(r=i,t=os(e,i))),t===1)throw n=ii,An(e,0),xn(e,r),dt(e,Me()),n;if(t===6)xn(e,r);else{if(i=e.current.alternate,(r&30)===0&&!zf(i)&&(t=yo(e,r),t===2&&(l=Ao(e),l!==0&&(r=l,t=os(e,l))),t===1))throw n=ii,An(e,0),xn(e,r),dt(e,Me()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(u(345));case 2:$n(e,ct,Jt);break;case 3:if(xn(e,r),(r&130023424)===r&&(t=ns+500-Me(),10<t)){if(Ei(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){nt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=dl($n.bind(null,e,ct,Jt),t);break}$n(e,ct,Jt);break;case 4:if(xn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var s=31-Rt(r);l=1<<s,s=t[s],s>i&&(i=s),r&=~l}if(r=i,r=Me()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Lf(r/1960))-r,10<r){e.timeoutHandle=dl($n.bind(null,e,ct,Jt),r);break}$n(e,ct,Jt);break;case 5:$n(e,ct,Jt);break;default:throw Error(u(329))}}}return dt(e,Me()),e.callbackNode===n?Zu.bind(null,e):null}function os(e,t){var n=oi;return e.current.memoizedState.isDehydrated&&(An(e,t).flags|=256),e=yo(e,t),e!==2&&(t=ct,ct=n,t!==null&&ls(t)),e}function ls(e){ct===null?ct=e:ct.push.apply(ct,e)}function zf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],l=i.getSnapshot;i=i.value;try{if(!Tt(l(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xn(e,t){for(t&=~ts,t&=~co,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Rt(t),r=1<<n;e[n]=-1,t&=~r}}function Ju(e){if((ve&6)!==0)throw Error(u(327));hr();var t=Ei(e,0);if((t&1)===0)return dt(e,Me()),null;var n=yo(e,t);if(e.tag!==0&&n===2){var r=Ao(e);r!==0&&(t=r,n=os(e,r))}if(n===1)throw n=ii,An(e,0),xn(e,t),dt(e,Me()),n;if(n===6)throw Error(u(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,$n(e,ct,Jt),dt(e,Me()),null}function ss(e,t){var n=ve;ve|=1;try{return e(t)}finally{ve=n,ve===0&&(mr=Me()+500,Hi&&mn())}}function Fn(e){_n!==null&&_n.tag===0&&(ve&6)===0&&hr();var t=ve;ve|=1;var n=Ct.transition,r=we;try{if(Ct.transition=null,we=1,e)return e()}finally{we=r,Ct.transition=n,ve=t,(ve&6)===0&&mn()}}function as(){gt=pr.current,Ne(pr)}function An(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,af(n)),Ie!==null)for(n=Ie.return;n!==null;){var r=n;switch(yl(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Bi();break;case 3:cr(),Ne(st),Ne(Ge),Pl();break;case 5:Rl(r);break;case 4:cr();break;case 13:Ne(Le);break;case 19:Ne(Le);break;case 10:kl(r.type._context);break;case 22:case 23:as()}n=n.return}if(Ve=e,Ie=e=Sn(e.current,null),Qe=gt=t,$e=0,ii=null,ts=co=In=0,ct=oi=null,On!==null){for(t=0;t<On.length;t++)if(n=On[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,l=n.pending;if(l!==null){var s=l.next;l.next=i,r.next=s}n.pending=r}On=null}return e}function bu(e,t){do{var n=Ie;try{if(Sl(),bi.current=ro,eo){for(var r=ze.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}eo=!1}if(Dn=0,Be=Ae=ze=null,Jr=!1,br=0,es.current=null,n===null||n.return===null){$e=1,ii=t,Ie=null;break}e:{var l=e,s=n.return,d=n,f=t;if(t=Qe,d.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){var w=f,R=d,T=R.tag;if((R.mode&1)===0&&(T===0||T===11||T===15)){var N=R.alternate;N?(R.updateQueue=N.updateQueue,R.memoizedState=N.memoizedState,R.lanes=N.lanes):(R.updateQueue=null,R.memoizedState=null)}var B=Eu(s);if(B!==null){B.flags&=-257,Cu(B,s,d,l,t),B.mode&1&&ku(l,w,t),t=B,f=w;var W=t.updateQueue;if(W===null){var Q=new Set;Q.add(f),t.updateQueue=Q}else W.add(f);break e}else{if((t&1)===0){ku(l,w,t),us();break e}f=Error(u(426))}}else if(Pe&&d.mode&1){var De=Eu(s);if(De!==null){(De.flags&65536)===0&&(De.flags|=256),Cu(De,s,d,l,t),wl(dr(f,d));break e}}l=f=dr(f,d),$e!==4&&($e=2),oi===null?oi=[l]:oi.push(l),l=s;do{switch(l.tag){case 3:l.flags|=65536,t&=-t,l.lanes|=t;var v=xu(l,f,t);Ka(l,v);break e;case 1:d=f;var p=l.type,g=l.stateNode;if((l.flags&128)===0&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(gn===null||!gn.has(g)))){l.flags|=65536,t&=-t,l.lanes|=t;var M=Su(l,d,t);Ka(l,M);break e}}l=l.return}while(l!==null)}nc(n)}catch(K){t=K,Ie===n&&n!==null&&(Ie=n=n.return);continue}break}while(!0)}function ec(){var e=uo.current;return uo.current=ro,e===null?ro:e}function us(){($e===0||$e===3||$e===2)&&($e=4),Ve===null||(In&268435455)===0&&(co&268435455)===0||xn(Ve,Qe)}function yo(e,t){var n=ve;ve|=2;var r=ec();(Ve!==e||Qe!==t)&&(Jt=null,An(e,t));do try{Of();break}catch(i){bu(e,i)}while(!0);if(Sl(),ve=n,uo.current=r,Ie!==null)throw Error(u(261));return Ve=null,Qe=0,$e}function Of(){for(;Ie!==null;)tc(Ie)}function Mf(){for(;Ie!==null&&!id();)tc(Ie)}function tc(e){var t=oc(e.alternate,e,gt);e.memoizedProps=e.pendingProps,t===null?nc(e):Ie=t,es.current=null}function nc(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=jf(n,t,gt),n!==null){Ie=n;return}}else{if(n=Nf(n,t),n!==null){n.flags&=32767,Ie=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{$e=6,Ie=null;return}}if(t=t.sibling,t!==null){Ie=t;return}Ie=t=e}while(t!==null);$e===0&&($e=5)}function $n(e,t,n){var r=we,i=Ct.transition;try{Ct.transition=null,we=1,Df(e,t,n,r)}finally{Ct.transition=i,we=r}return null}function Df(e,t,n,r){do hr();while(_n!==null);if((ve&6)!==0)throw Error(u(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(u(177));e.callbackNode=null,e.callbackPriority=0;var l=n.lanes|n.childLanes;if(md(e,l),e===Ve&&(Ie=Ve=null,Qe=0),(n.subtreeFlags&2064)===0&&(n.flags&2064)===0||po||(po=!0,lc(wi,function(){return hr(),null})),l=(n.flags&15990)!==0,(n.subtreeFlags&15990)!==0||l){l=Ct.transition,Ct.transition=null;var s=we;we=1;var d=ve;ve|=4,es.current=null,Tf(e,n),Qu(n,e),ef(ul),Ni=!!al,ul=al=null,e.current=n,Pf(n),od(),ve=d,we=s,Ct.transition=l}else e.current=n;if(po&&(po=!1,_n=e,mo=i),l=e.pendingLanes,l===0&&(gn=null),ad(n.stateNode),dt(e,Me()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(fo)throw fo=!1,e=rs,rs=null,e;return(mo&1)!==0&&e.tag!==0&&hr(),l=e.pendingLanes,(l&1)!==0?e===is?li++:(li=0,is=e):li=0,mn(),null}function hr(){if(_n!==null){var e=Ws(mo),t=Ct.transition,n=we;try{if(Ct.transition=null,we=16>e?16:e,_n===null)var r=!1;else{if(e=_n,_n=null,mo=0,(ve&6)!==0)throw Error(u(331));var i=ve;for(ve|=4,H=e.current;H!==null;){var l=H,s=l.child;if((H.flags&16)!==0){var d=l.deletions;if(d!==null){for(var f=0;f<d.length;f++){var w=d[f];for(H=w;H!==null;){var R=H;switch(R.tag){case 0:case 11:case 15:ri(8,R,l)}var T=R.child;if(T!==null)T.return=R,H=T;else for(;H!==null;){R=H;var N=R.sibling,B=R.return;if(Bu(R),R===w){H=null;break}if(N!==null){N.return=B,H=N;break}H=B}}}var W=l.alternate;if(W!==null){var Q=W.child;if(Q!==null){W.child=null;do{var De=Q.sibling;Q.sibling=null,Q=De}while(Q!==null)}}H=l}}if((l.subtreeFlags&2064)!==0&&s!==null)s.return=l,H=s;else e:for(;H!==null;){if(l=H,(l.flags&2048)!==0)switch(l.tag){case 0:case 11:case 15:ri(9,l,l.return)}var v=l.sibling;if(v!==null){v.return=l.return,H=v;break e}H=l.return}}var p=e.current;for(H=p;H!==null;){s=H;var g=s.child;if((s.subtreeFlags&2064)!==0&&g!==null)g.return=s,H=g;else e:for(s=p;H!==null;){if(d=H,(d.flags&2048)!==0)try{switch(d.tag){case 0:case 11:case 15:ao(9,d)}}catch(K){Oe(d,d.return,K)}if(d===s){H=null;break e}var M=d.sibling;if(M!==null){M.return=d.return,H=M;break e}H=d.return}}if(ve=i,mn(),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(xi,e)}catch{}r=!0}return r}finally{we=n,Ct.transition=t}}return!1}function rc(e,t,n){t=dr(n,t),t=xu(e,t,1),e=vn(e,t,1),t=nt(),e!==null&&(Pr(e,1,t),dt(e,t))}function Oe(e,t,n){if(e.tag===3)rc(e,e,n);else for(;t!==null;){if(t.tag===3){rc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(gn===null||!gn.has(r))){e=dr(n,e),e=Su(t,e,1),t=vn(t,e,1),e=nt(),t!==null&&(Pr(t,1,e),dt(t,e));break}}t=t.return}}function If(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=nt(),e.pingedLanes|=e.suspendedLanes&n,Ve===e&&(Qe&n)===n&&($e===4||$e===3&&(Qe&130023424)===Qe&&500>Me()-ns?An(e,0):ts|=n),dt(e,t)}function ic(e,t){t===0&&((e.mode&1)===0?t=1:(t=ki,ki<<=1,(ki&130023424)===0&&(ki=4194304)));var n=nt();e=Xt(e,t),e!==null&&(Pr(e,t,n),dt(e,n))}function Ff(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ic(e,n)}function Af(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}r!==null&&r.delete(t),ic(e,n)}var oc;oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||st.current)ut=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ut=!1,Cf(e,t,n);ut=(e.flags&131072)!==0}else ut=!1,Pe&&(t.flags&1048576)!==0&&Aa(t,qi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lo(e,t),e=t.pendingProps;var i=rr(t,Ge.current);ur(t,n),i=Ol(null,t,r,e,i,n);var l=Ml();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,at(r)?(l=!0,Vi(t)):l=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,jl(t),i.updater=io,t.stateNode=i,i._reactInternals=t,Ul(t,r,e,n),t=Wl(null,t,r,!0,l,n)):(t.tag=0,Pe&&l&&vl(t),tt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(lo(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=Uf(r),e=Lt(r,e),i){case 0:t=Hl(null,t,r,e,n);break e;case 1:t=Lu(null,t,r,e,n);break e;case 11:t=ju(null,t,r,e,n);break e;case 14:t=Nu(null,t,r,Lt(r.type,e),n);break e}throw Error(u(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Hl(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),Lu(e,t,r,i,n);case 3:e:{if(zu(t),e===null)throw Error(u(387));r=t.pendingProps,l=t.memoizedState,i=l.element,Ya(e,t),Zi(t,r,null,n);var s=t.memoizedState;if(r=s.element,l.isDehydrated)if(l={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=l,t.memoizedState=l,t.flags&256){i=dr(Error(u(423)),t),t=Ou(e,t,r,n,i);break e}else if(r!==i){i=dr(Error(u(424)),t),t=Ou(e,t,r,n,i);break e}else for(yt=dn(t.stateNode.containerInfo.firstChild),vt=t,Pe=!0,Pt=null,n=qa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(lr(),r===i){t=Zt(e,t,n);break e}tt(e,t,r,n)}t=t.child}return t;case 5:return Ga(t),e===null&&_l(t),r=t.type,i=t.pendingProps,l=e!==null?e.memoizedProps:null,s=i.children,cl(r,i)?s=null:l!==null&&cl(r,l)&&(t.flags|=32),Pu(e,t),tt(e,t,s,n),t.child;case 6:return e===null&&_l(t),null;case 13:return Mu(e,t,n);case 4:return Nl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sr(t,null,r,n):tt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),ju(e,t,r,i,n);case 7:return tt(e,t,t.pendingProps,n),t.child;case 8:return tt(e,t,t.pendingProps.children,n),t.child;case 12:return tt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,s=i.value,ke(Ki,r._currentValue),r._currentValue=s,l!==null)if(Tt(l.value,s)){if(l.children===i.children&&!st.current){t=Zt(e,t,n);break e}}else for(l=t.child,l!==null&&(l.return=t);l!==null;){var d=l.dependencies;if(d!==null){s=l.child;for(var f=d.firstContext;f!==null;){if(f.context===r){if(l.tag===1){f=Gt(-1,n&-n),f.tag=2;var w=l.updateQueue;if(w!==null){w=w.shared;var R=w.pending;R===null?f.next=f:(f.next=R.next,R.next=f),w.pending=f}}l.lanes|=n,f=l.alternate,f!==null&&(f.lanes|=n),El(l.return,n,t),d.lanes|=n;break}f=f.next}}else if(l.tag===10)s=l.type===t.type?null:l.child;else if(l.tag===18){if(s=l.return,s===null)throw Error(u(341));s.lanes|=n,d=s.alternate,d!==null&&(d.lanes|=n),El(s,n,t),s=l.sibling}else s=l.child;if(s!==null)s.return=l;else for(s=l;s!==null;){if(s===t){s=null;break}if(l=s.sibling,l!==null){l.return=s.return,s=l;break}s=s.return}l=s}tt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ur(t,n),i=kt(i),r=r(i),t.flags|=1,tt(e,t,r,n),t.child;case 14:return r=t.type,i=Lt(r,t.pendingProps),i=Lt(r.type,i),Nu(e,t,r,i,n);case 15:return Ru(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Lt(r,i),lo(e,t),t.tag=1,at(r)?(e=!0,Vi(t)):e=!1,ur(t,n),_u(t,r,i),Ul(t,r,i,n),Wl(null,t,r,!0,e,n);case 19:return Iu(e,t,n);case 22:return Tu(e,t,n)}throw Error(u(156,t.tag))};function lc(e,t){return $s(e,t)}function $f(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jt(e,t,n,r){return new $f(e,t,n,r)}function cs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Uf(e){if(typeof e=="function")return cs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===rt)return 11;if(e===ot)return 14}return 2}function Sn(e,t){var n=e.alternate;return n===null?(n=jt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function go(e,t,n,r,i,l){var s=2;if(r=e,typeof e=="function")cs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Re:return Un(n.children,i,l,t);case Ee:s=8,i|=8;break;case te:return e=jt(12,n,t,i|2),e.elementType=te,e.lanes=l,e;case Te:return e=jt(13,n,t,i),e.elementType=Te,e.lanes=l,e;case it:return e=jt(19,n,t,i),e.elementType=it,e.lanes=l,e;case Ce:return _o(n,i,l,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ye:s=10;break e;case Ke:s=9;break e;case rt:s=11;break e;case ot:s=14;break e;case Xe:s=16,r=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=jt(s,n,t,i),t.elementType=e,t.type=r,t.lanes=l,t}function Un(e,t,n,r){return e=jt(7,e,r,t),e.lanes=n,e}function _o(e,t,n,r){return e=jt(22,e,r,t),e.elementType=Ce,e.lanes=n,e.stateNode={isHidden:!1},e}function ds(e,t,n){return e=jt(6,e,null,t),e.lanes=n,e}function fs(e,t,n){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Bf(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$o(0),this.expirationTimes=$o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$o(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ps(e,t,n,r,i,l,s,d,f){return e=new Bf(e,t,n,d,f),t===1?(t=1,l===!0&&(t|=8)):t=0,l=jt(3,null,null,t),e.current=l,l.stateNode=e,l.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},jl(l),e}function Vf(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pe,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function sc(e){if(!e)return pn;e=e._reactInternals;e:{if(Rn(e)!==e||e.tag!==1)throw Error(u(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(at(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(u(171))}if(e.tag===1){var n=e.type;if(at(n))return Da(e,n,t)}return t}function ac(e,t,n,r,i,l,s,d,f){return e=ps(n,r,!0,e,i,l,s,d,f),e.context=sc(null),n=e.current,r=nt(),i=wn(n),l=Gt(r,i),l.callback=t??null,vn(n,l,i),e.current.lanes=i,Pr(e,i,r),dt(e,r),e}function wo(e,t,n,r){var i=t.current,l=nt(),s=wn(i);return n=sc(n),t.context===null?t.context=n:t.pendingContext=n,t=Gt(l,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=vn(i,t,s),e!==null&&(Mt(e,i,s,l),Gi(e,i,s)),s}function xo(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ms(e,t){uc(e,t),(e=e.alternate)&&uc(e,t)}function Hf(){return null}var cc=typeof reportError=="function"?reportError:function(e){console.error(e)};function hs(e){this._internalRoot=e}So.prototype.render=hs.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));wo(e,t,null,null)},So.prototype.unmount=hs.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fn(function(){wo(null,e,null,null)}),t[qt]=null}};function So(e){this._internalRoot=e}So.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ys();e={blockedOn:null,target:e,priority:t};for(var n=0;n<an.length&&t!==0&&t<an[n].priority;n++);an.splice(n,0,e),n===0&&Gs(e)}};function vs(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ko(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dc(){}function Wf(e,t,n,r,i){if(i){if(typeof r=="function"){var l=r;r=function(){var w=xo(s);l.call(w)}}var s=ac(t,r,e,0,null,!1,!1,"",dc);return e._reactRootContainer=s,e[qt]=s.current,Wr(e.nodeType===8?e.parentNode:e),Fn(),s}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var d=r;r=function(){var w=xo(f);d.call(w)}}var f=ps(e,0,!1,null,null,!1,!1,"",dc);return e._reactRootContainer=f,e[qt]=f.current,Wr(e.nodeType===8?e.parentNode:e),Fn(function(){wo(t,f,n,r)}),f}function Eo(e,t,n,r,i){var l=n._reactRootContainer;if(l){var s=l;if(typeof i=="function"){var d=i;i=function(){var f=xo(s);d.call(f)}}wo(t,s,e,i)}else s=Wf(n,t,e,i,r);return xo(s)}qs=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Tr(t.pendingLanes);n!==0&&(Uo(t,n|1),dt(t,Me()),(ve&6)===0&&(mr=Me()+500,mn()))}break;case 13:Fn(function(){var r=Xt(e,1);if(r!==null){var i=nt();Mt(r,e,1,i)}}),ms(e,1)}},Bo=function(e){if(e.tag===13){var t=Xt(e,134217728);if(t!==null){var n=nt();Mt(t,e,134217728,n)}ms(e,134217728)}},Qs=function(e){if(e.tag===13){var t=wn(e),n=Xt(e,t);if(n!==null){var r=nt();Mt(n,e,t,r)}ms(e,t)}},Ys=function(){return we},Ks=function(e,t){var n=we;try{return we=e,t()}finally{we=n}},Qn=function(e,t,n){switch(t){case"input":if(qn(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ui(r);if(!i)throw Error(u(90));mi(r),qn(r,i)}}}break;case"textarea":Cn(e,n);break;case"select":t=n.value,t!=null&&Nt(e,!!n.multiple,t,!1)}},me=ss,he=Fn;var qf={usingClientEntryPoint:!1,Events:[Yr,tr,Ui,J,Y,ss]},si={findFiberByHostInstance:Tn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Qf={bundleType:si.bundleType,version:si.version,rendererPackageName:si.rendererPackageName,rendererConfig:si.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ge.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Fs(e),e===null?null:e.stateNode},findFiberByHostInstance:si.findFiberByHostInstance||Hf,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Co=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Co.isDisabled&&Co.supportsFiber)try{xi=Co.inject(Qf),Ft=Co}catch{}}return ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=qf,ft.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vs(t))throw Error(u(200));return Vf(e,t,null,n)},ft.createRoot=function(e,t){if(!vs(e))throw Error(u(299));var n=!1,r="",i=cc;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=ps(e,1,!1,null,null,n,!1,r,i),e[qt]=t.current,Wr(e.nodeType===8?e.parentNode:e),new hs(t)},ft.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=Fs(t),e=e===null?null:e.stateNode,e},ft.flushSync=function(e){return Fn(e)},ft.hydrate=function(e,t,n){if(!ko(t))throw Error(u(200));return Eo(null,e,t,!0,n)},ft.hydrateRoot=function(e,t,n){if(!vs(e))throw Error(u(405));var r=n!=null&&n.hydratedSources||null,i=!1,l="",s=cc;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=ac(t,null,e,1,n??null,i,!1,l,s),e[qt]=t.current,Wr(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new So(t)},ft.render=function(e,t,n){if(!ko(t))throw Error(u(200));return Eo(null,e,t,!1,n)},ft.unmountComponentAtNode=function(e){if(!ko(e))throw Error(u(40));return e._reactRootContainer?(Fn(function(){Eo(null,null,e,!1,function(){e._reactRootContainer=null,e[qt]=null})}),!0):!1},ft.unstable_batchedUpdates=ss,ft.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ko(n))throw Error(u(200));if(e==null||e._reactInternals===void 0)throw Error(u(38));return Eo(e,t,n,!1,r)},ft.version="18.3.1-next-f1338f8080-20240426",ft}var _c;function Uc(){if(_c)return ws.exports;_c=1;function o(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o)}catch(c){console.error(c)}}return o(),ws.exports=tp(),ws.exports}var wc;function np(){if(wc)return jo;wc=1;var o=Uc();return jo.createRoot=o.createRoot,jo.hydrateRoot=o.hydrateRoot,jo}var rp=np();const ip=1e4,op=12e4,lp=new Set(["room.create","room.invite","room.revoke","room.message","room.close","room.recover","room.recover.confirm"]),sp=new Set(["room.list","room.show","room.participants","room.history"]);let ap=0;class _t extends Error{constructor(u,_,h,y){super(_,y);ys(this,"code");ys(this,"outcomeUnknown");this.name="RpcError",this.code=u,this.outcomeUnknown=h}}function up(o){return lp.has(o)?op:ip}async function cp(o,c,u={}){var I,C,U;const _=u.fetch??globalThis.fetch,h=`web-${Date.now().toString(36)}-${(++ap).toString(36)}`,y=!sp.has(o),k=new AbortController;let P=!1;const S=()=>{var z;return k.abort((z=u.signal)==null?void 0:z.reason)};(I=u.signal)==null||I.addEventListener("abort",S,{once:!0}),(C=u.signal)!=null&&C.aborted&&S();const L=setTimeout(()=>{P=!0,k.abort()},u.timeoutMs??up(o));try{const z=await _("/rpc",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify({version:1,id:h,method:o,params:c}),signal:k.signal});let q;try{q=await z.json()}catch(D){throw new _t("invalid_response","daemon returned invalid JSON",y,{cause:D})}if(!dp(q,h))throw new _t("invalid_response","daemon returned an invalid or uncorrelated RPC response",y);if("error"in q)throw new _t(q.error.code,q.error.message,!1);if(!z.ok)throw new _t("invalid_response",`daemon returned a result envelope with HTTP ${z.status}`,y);return q.result}catch(z){throw z instanceof _t?z:P?new _t("timeout","daemon did not answer before the RPC deadline",y,{cause:z}):k.signal.aborted?new _t("aborted","RPC request was aborted",y,{cause:z}):new _t("daemon_unavailable","cowork daemon is unavailable",y,{cause:z})}finally{clearTimeout(L),(U=u.signal)==null||U.removeEventListener("abort",S)}}function dp(o,c){if(!xc(o)||o.version!==1||o.id!==c)return!1;const u=Object.keys(o);return"result"in o?!("error"in o)&&u.length===3&&u.every(_=>_==="version"||_==="id"||_==="result"):u.length===3&&u.every(_=>_==="version"||_==="id"||_==="error")&&xc(o.error)&&Object.keys(o.error).length===2&&typeof o.error.code=="string"&&typeof o.error.message=="string"}function xc(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}const Sc=64;function zo(o){return o.trim().normalize("NFC")}function Ls(o){if(/[\p{Cc}\p{Cf}]/u.test(o))return"Name cannot contain control or format characters.";const c=zo(o),u=Array.from(c).length;if(u<1)return"Name is required.";if(u>Sc)return`Name must be at most ${Sc} characters.`}function fp(o){return typeof o=="string"&&o===zo(o)&&Ls(o)===void 0}const pp=new Set(["provisioning","active","closing","closed"]),mp=new Set(["one_time","public"]),hp=new Set(["live","consumed","revoked","replacement_required","receipt_pending"]),vp=new Set(["queued","send_failed","skipped_removed"]),yp=new Set(["queued","send_failed"]),gp=/^[0-7][0-9a-hjkmnp-tv-z]{25}$/,Ro=262144,_p=2*1024*1024,wp=255,xp=255,Oo=256,vr=["version","room_id","seq","record_id","at","kind"],Bc=["version","room_id","room_name","identity_name","identity_cid","mission","state","invites","seats","created_at"],Sp=[...Bc,"role_briefings","anonymous","quiet_membership","membership_epoch"];function ui(o){if(!Dt(o)||o.version!==1&&o.version!==2)return!1;const c=o.version===2;if(!wt(o,c?Sp:Bc,["status","activated_at","closed_at"])||!Vt(o.room_id)||!fp(o.room_name)||!Ue(o.identity_name)||typeof o.identity_cid!="string"||!Pp(o.mission,c)||!pp.has(o.state)||!En(o.status)||!Array.isArray(o.invites)||!o.invites.every(zs)||!Array.isArray(o.seats)||!o.seats.every(y=>Wc(y,c))||!gr(o.created_at)||!To(o.activated_at)||!To(o.closed_at)||c&&(!Lp(o.role_briefings)||typeof o.anonymous!="boolean"||typeof o.quiet_membership!="boolean"||!ci(o.membership_epoch))||new Set(o.invites.map(y=>y.invite_id)).size!==o.invites.length||new Set(o.seats.map(y=>y.identity)).size!==o.seats.length)return!1;if(c){const y=o.seats;if(new Set(y.map(S=>S.participant_id)).size!==y.length)return!1;const k=new Set;for(const S of y){if(o.anonymous?S.alias===void 0:S.alias!==void 0)return!1;if(S.state==="removed"){if(S.removed_at===void 0||S.removed_epoch===void 0||S.removed_epoch>Number(o.membership_epoch))return!1}else if(S.removed_at!==void 0||S.removed_epoch!==void 0||S.bounced_at!==void 0)return!1;if(S.state==="active"&&S.alias!==void 0){if(k.has(S.alias))return!1;k.add(S.alias)}}const P=new Map(y.map(S=>[S.participant_id,S]));for(const S of y){if(S.replaces_seat===void 0)continue;const L=P.get(S.replaces_seat);if(!L||L===S||L.state!=="removed"||L.role!==S.role||o.anonymous&&L.alias!==S.alias)return!1}}const _=o.state==="provisioning"&&o.status==="packet_pending"&&(o.identity_name===`cowork-room-${o.room_id}`||o.identity_name===`ours-cowork-room:${o.room_name}`)&&o.invites.length===0&&o.seats.length===0&&o.activated_at===void 0&&o.closed_at===void 0;if(o.identity_cid===""&&!_||o.identity_cid!==""&&o.status==="packet_pending")return!1;const h=new Set;for(const y of o.invites){if(y.recovery_of===void 0)continue;const k=o.invites.find(S=>S.invite_id===y.recovery_of),P=y.state==="receipt_pending"?(k==null?void 0:k.state)==="replacement_required":y.state==="live"||y.state==="consumed"||y.state==="replacement_required"?(k==null?void 0:k.state)==="revoked":y.state==="revoked"?y.recovery_confirmed===!0?(k==null?void 0:k.state)==="revoked":(k==null?void 0:k.state)==="replacement_required"||(k==null?void 0:k.state)==="revoked":!1;if(!k||k.invite_id===y.invite_id||!P||k.mode!==y.mode||k.role!==y.role||k.min_accepts!==y.min_accepts)return!1;if(y.state==="receipt_pending"){if(h.has(y.recovery_of))return!1;h.add(y.recovery_of)}}for(const y of o.invites){const k=new Set([y.invite_id]);let P=y;for(;P.recovery_of!==void 0;){if(k.has(P.recovery_of))return!1;k.add(P.recovery_of);const S=o.invites.find(L=>L.invite_id===P.recovery_of);if(!S)return!1;P=S}}return!0}function kp(o){return Array.isArray(o)&&o.every(ui)}function kc(o){return Array.isArray(o)&&o.every(c=>Wc(c))&&new Set(o.map(c=>c.identity)).size===o.length}function Vc(o){return Dt(o)&&Ue(o.room_id)&&zs(o.invite)&&Ue(o.blob)&&typeof o.reusable=="boolean"&&En(o.recovery_of)}function Ep(o){return Array.isArray(o)&&o.every(Vc)}function Cp(o,c){if(!Vc(o)||o.room_id!==c.room_id||o.invite.mode!==c.mode||o.invite.role!==c.role||o.invite.min_accepts!==c.min_accepts||o.invite.accepted_cids.length!==0||o.invite.state!=="live"||o.invite.recovery_of!==void 0||o.invite.recovery_confirmed!==void 0||o.recovery_of!==void 0||o.reusable!==(c.mode==="public"))throw new Error("daemon returned an invalid invite receipt for this create request");return o}function jp(o,c){Ep(o)||Ec();const u=new Set,_=new Set;for(const h of o){const y=c.invites.find(k=>k.invite_id===h.recovery_of);(h.room_id!==c.room_id||h.recovery_of===void 0||h.invite.recovery_of!==h.recovery_of||h.invite.state!=="receipt_pending"||h.invite.recovery_confirmed!==!1||h.invite.accepted_cids.length!==0||h.reusable!==(h.invite.mode==="public")||!y||y.state!=="replacement_required"||y.mode!==h.invite.mode||y.role!==h.invite.role||y.min_accepts!==h.invite.min_accepts||y.invite_id===h.invite.invite_id||c.invites.some(k=>k.invite_id===h.invite.invite_id)||u.has(h.invite.invite_id)||_.has(h.recovery_of))&&Ec(),u.add(h.invite.invite_id),_.add(h.recovery_of)}return o}function Np(o,c){const u=new Set(["live","consumed","replacement_required","revoked"]);if(!zs(o)||c.recovery_of===void 0||o.invite_id!==c.invite.invite_id||o.recovery_of!==c.recovery_of||o.recovery_confirmed!==!0||!u.has(o.state)||o.mode!==c.invite.mode||o.role!==c.invite.role||o.min_accepts!==c.invite.min_accepts)throw new Error("daemon returned an invalid recovery confirmation for the displayed old/new pointer");return o}function Ec(){throw new Error("daemon returned an invalid recovery receipt for this room state")}function Hc(o){if(!Ip(o))return!1;switch(o.kind){case"message":return wt(o,[...vr,"message_id","author","category","text","recipient_identities"],["source_msg_id","source_wire_id"])&&Vt(o.message_id)&&Cc(o.author)&&(o.category==="briefing"||o.category==="chat")&&bt(o.text,Ro)&&js(o.recipient_identities)&&(o.source_msg_id===void 0||ci(o.source_msg_id))&&En(o.source_wire_id);case"relay_intent":return wt(o,[...vr,"recipient_identity"],["message_id","file_id"])&&jc(o)&&Ue(o.recipient_identity);case"relay_result":return wt(o,[...vr,"intent_record_id","recipient_identity","status"],["message_id","file_id","wire_id","metadata_wire_id"])&&Ue(o.intent_record_id)&&jc(o)&&Ue(o.recipient_identity)&&vp.has(o.status)&&En(o.wire_id)&&En(o.metadata_wire_id);case"file":{const c=Dp(o.data_base64);return wt(o,[...vr,"file_id","author","filename","mime","size","sha256","data_base64","recipient_identities","source_file_id"],["author_alias","source_wire_id"])&&Vt(o.file_id)&&Cc(o.author)&&(o.author_alias===void 0||zp(o.author_alias))&&Op(o.filename)&&Mp(o.mime,xp)&&ci(o.size)&&o.size<=_p&&typeof o.sha256=="string"&&/^[0-9a-f]{64}$/.test(o.sha256)&&c===o.size&&js(o.recipient_identities)&&ci(o.source_file_id)&&En(o.source_wire_id)}case"close_notice_intent":return wt(o,[...vr,"recipient_identity"])&&Ue(o.recipient_identity);case"close_notice_result":return wt(o,[...vr,"intent_record_id","recipient_identity","status","notified","key_material_retained"],["uncertain_after_restart"])&&Ue(o.intent_record_id)&&Ue(o.recipient_identity)&&yp.has(o.status)&&typeof o.notified=="boolean"&&o.key_material_retained===!0&&(o.uncertain_after_restart===void 0||o.uncertain_after_restart===!0);default:return!1}}function Rp(o){return Array.isArray(o)&&o.every(Hc)}function Tp(o){return Dt(o)&&Object.keys(o).length===4&&o.version===1&&Ue(o.room_id)&&o.deleted===!0&&o.scope==="this_host"}function Pp(o,c=!1){return Dt(o)&&wt(o,c?["goal","briefing","briefing_version"]:["goal","briefing"])&&bt(o.goal,Ro)&&bt(o.briefing,Ro)&&(!c||Mo(o.briefing_version))}function Wc(o,c){if(!Dt(o))return!1;const u=c??Object.hasOwn(o,"participant_id");return wt(o,u?["identity","display_name","role","invite_id","accepted_at","participant_id","state"]:["identity","display_name","role","invite_id","accepted_at"],u?["alias","removed_at","removed_epoch","replaces_seat","bounced_at"]:[])?Ue(o.identity)&&Ue(o.display_name)&&bt(o.role,Oo)&&Ue(o.invite_id)&&gr(o.accepted_at)&&(!u||Vt(o.participant_id)&&(o.state==="active"||o.state==="removed")&&En(o.alias)&&To(o.removed_at)&&(o.removed_epoch===void 0||ci(o.removed_epoch))&&(o.replaces_seat===void 0||Vt(o.replaces_seat))&&To(o.bounced_at)):!1}function Lp(o){return Dt(o)&&Object.entries(o).every(([c,u])=>bt(c,Oo)&&Dt(u)&&wt(u,["text","version","updated_at"])&&bt(u.text,Ro)&&Mo(u.version)&&gr(u.updated_at))}function zs(o){if(!Dt(o)||!wt(o,["invite_id","mode","role","min_accepts","accepted_cids","state","created_at"],["recovery_of","recovery_confirmed","replaces_seat"])||!Ue(o.invite_id)||!mp.has(o.mode)||!bt(o.role,Oo)||!Mo(o.min_accepts)||!js(o.accepted_cids)||!hp.has(o.state)||!En(o.recovery_of)||o.recovery_confirmed!==void 0&&typeof o.recovery_confirmed!="boolean"||o.replaces_seat!==void 0&&!Vt(o.replaces_seat)||!gr(o.created_at))return!1;const c=o;return!(c.mode==="one_time"&&c.min_accepts!==1||c.recovery_of===void 0&&c.recovery_confirmed!==void 0||c.recovery_of!==void 0&&c.recovery_confirmed===void 0||c.state==="receipt_pending"&&(c.recovery_of===void 0||c.recovery_confirmed!==!1||c.accepted_cids.length>0)||c.recovery_of!==void 0&&(c.state==="live"||c.state==="consumed"||c.state==="replacement_required")&&c.recovery_confirmed!==!0)}function Cc(o){return Dt(o)&&wt(o,["identity","display_name","role"])&&Ue(o.identity)&&Ue(o.display_name)&&bt(o.role,Oo)}function zp(o){return Dt(o)&&wt(o,["participant_id","alias"])&&Vt(o.participant_id)&&Ue(o.alias)}function jc(o){const c=o.message_id===void 0?!1:Vt(o.message_id),u=o.file_id===void 0?!1:Vt(o.file_id);return c!==u}function Op(o){return bt(o,wp)&&o!=="."&&o!==".."&&!/[\x00/\\]/.test(o)}function Mp(o,c){return typeof o=="string"&&new TextEncoder().encode(o).byteLength<=c}function Dp(o){if(typeof o!="string"||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o))return;if(o.length===0)return 0;const c=o.endsWith("==")?2:o.endsWith("=")?1:0;return o.length/4*3-c}function Ip(o){return Dt(o)&&o.version===1&&Vt(o.room_id)&&Mo(o.seq)&&o.record_id===`${o.room_id}:${o.seq}`&&gr(o.at)&&typeof o.kind=="string"}function wt(o,c,u=[]){const _=new Set([...c,...u]),h=Object.keys(o);return c.every(y=>Object.hasOwn(o,y))&&h.every(y=>_.has(y))}function Vt(o){return typeof o=="string"&&gp.test(o)}function bt(o,c){return typeof o=="string"&&new TextEncoder().encode(o).byteLength>=1&&new TextEncoder().encode(o).byteLength<=c}function js(o){return Fp(o)&&new Set(o).size===o.length}function gr(o){if(typeof o!="string")return!1;const c=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/.exec(o);if(!c)return!1;const[,u,_,h,y,k,P,S,L]=c,I=Number(u),C=Number(_),U=Number(h),z=Number(y),q=Number(k),D=Number(P),O=S===void 0?0:Number(S),oe=L===void 0?0:Number(L);if(C<1||C>12||z>23||q>59||D>59||O>23||oe>59)return!1;const le=[31,I%4===0&&(I%100!==0||I%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return U>=1&&U<=le[C-1]}function To(o){return o===void 0||gr(o)}function Dt(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function Ue(o){return typeof o=="string"&&o.length>0}function En(o){return o===void 0||Ue(o)}function Fp(o){return Array.isArray(o)&&o.every(Ue)}function Mo(o){return Number.isSafeInteger(o)&&Number(o)>0}function ci(o){return Number.isSafeInteger(o)&&Number(o)>=0}const Vn=500;function pi(o,c){const u=new Map;for(const _ of o)u.set(_.seq,_);for(const _ of c)u.set(_.seq,_);return[...u.values()].sort((_,h)=>_.seq-h.seq)}function Ap(o){return pi([],o).filter(c=>c.kind==="message"||c.kind==="file").map(c=>c.kind==="file"?qc(c):c.category==="briefing"?{type:"briefing",seq:c.seq,recordId:c.record_id,at:c.at,author:c.author,text:c.text}:{type:"message",speaker:c.author.role==="room"?"room":"participant",seq:c.seq,recordId:c.record_id,at:c.at,author:c.author,text:c.text})}function $p(o){return pi([],o).filter(c=>c.kind!=="message"&&c.kind!=="file")}function Up(o,c){return pi([],o.filter(u=>u.room_id===c)).filter(u=>u.kind==="file").map(qc)}function Bp(o,c){const u=new Map;for(const _ of Up(o,c)){const h=u.get(_.filename)??[];h.push(_),u.set(_.filename,h)}return[...u.entries()].map(([_,h])=>{const y=h.sort((k,P)=>k.seq-P.seq).map((k,P)=>({...k,version:P+1})).reverse();return{groupId:y[0].fileId,filename:_,latest:y[0],versions:y}}).sort((_,h)=>h.latest.seq-_.latest.seq)}function pt(o,c=!0){if(!c)return ks(!1);switch(o){case"provisioning":return Nc(!1);case"active":return Nc(!0);case"closing":return ks(!1);case"closed":return{...ks(!1),canDelete:!0}}}function Os(o){return o.invites.reduce((c,u)=>u.state==="revoked"?c:c+Math.max(0,u.min_accepts-u.accepted_cids.length),0)}function Vp(o,c=Vn){const u=Math.max(0,Math.floor(c));return o.slice(Math.max(0,o.length-u))}function Ns(o,c,u=Vn){return Math.min(Math.max(0,c),Math.max(0,o)+Math.max(0,u))}function ks(o){return{canEditSettings:o,canCreateInvite:o,canRevokeInvite:o,canRecoverInvite:o,canMessage:o,canClose:o,canDelete:o}}function Nc(o){return{canEditSettings:!0,canCreateInvite:!0,canRevokeInvite:!0,canRecoverInvite:!0,canMessage:o,canClose:!0,canDelete:!1}}function qc(o){return{type:"file",seq:o.seq,recordId:o.record_id,fileId:o.file_id,at:o.at,author:o.author,filename:o.filename,mime:o.mime,size:o.size,sha256:o.sha256,dataBase64:o.data_base64}}var Hp=Uc();const Wp={provisioning:"Provisioning",active:"Active",closing:"Closing",closed:"Closed"};function Ms(o){return o.room_name}function qp({rooms:o,selectedRoomId:c,connected:u,open:_,sheet:h,onClose:y,onCreate:k,onSelect:P}){const S=o.filter(C=>C.state!=="closed"),L=o.filter(C=>C.state==="closed"),I=h&&!_;return a.jsxs("aside",{className:`room-rail${_?" room-rail--open":""}`,"aria-label":"Mission rooms","aria-hidden":I||void 0,hidden:I,children:[a.jsxs("div",{className:"rail-brand",children:[a.jsx("div",{className:"brand-mark","aria-hidden":"true",children:"O"}),a.jsxs("div",{children:[a.jsx("strong",{children:"ours cowork"}),a.jsx("span",{children:"operations console"})]}),a.jsx("button",{className:"icon-button rail-close",type:"button",onClick:y,"aria-label":"Close rooms",children:"×"})]}),a.jsxs("button",{className:"primary-button create-button",type:"button",onClick:C=>k(C.currentTarget),disabled:u!==!0,children:[a.jsx("span",{"aria-hidden":"true",children:"+"})," Create room"]}),a.jsxs("div",{className:`connection-state connection-state--${u===!1?"offline":u?"online":"pending"}`,children:[a.jsx("span",{className:"state-dot","aria-hidden":"true"}),u===!1?"Disconnected":u?"Connected":"Connecting"]}),a.jsx(Rc,{label:"Open rooms",rooms:S,selectedRoomId:c,onSelect:P}),a.jsx(Rc,{label:"Closed rooms",rooms:L,selectedRoomId:c,onSelect:P}),a.jsx("p",{className:"local-boundary",children:"Local daemon · 127.0.0.1"})]})}function Rc({label:o,rooms:c,selectedRoomId:u,onSelect:_}){return a.jsxs("section",{className:"room-group","aria-label":o,children:[a.jsxs("div",{className:"room-group__heading",children:[a.jsx("h2",{children:o}),a.jsx("span",{children:c.length})]}),c.length===0?a.jsxs("p",{className:"empty-group",children:["No ",o.toLowerCase()]}):a.jsx("ul",{className:"room-list",children:c.map(h=>{const y=h.room_id===u;return a.jsx("li",{children:a.jsxs("button",{className:"room-card",type:"button","aria-current":y?"page":void 0,onClick:()=>_(h.room_id),children:[a.jsx("span",{className:"room-card__title",children:Ms(h)}),a.jsxs("span",{className:"room-card__state",children:[a.jsx("span",{className:`lifecycle-dot lifecycle-dot--${h.state}`,"aria-hidden":"true"}),Wp[h.state]]}),a.jsxs("span",{className:"room-card__summary",children:[h.seats.length," accepted · ",Os(h)," needed"]})]})},h.room_id)})})]})}const di=262144;function Qp({open:o,connected:c,restoreFocus:u,fallbackFocus:_,onClose:h,onCreate:y}){const[k,P]=E.useState(""),[S,L]=E.useState(""),[I,C]=E.useState(""),[U,z]=E.useState(!1),[q,D]=E.useState(),O=E.useRef(!1);if(!o)return null;const oe=Ls(k),ee=Tc("Goal",S),le=Tc("Briefing",I);async function ge(xe){if(xe.preventDefault(),!(!c||oe||ee||le||O.current)){O.current=!0,z(!0),D(void 0);try{await y(zo(k),S.trim(),I.trim()),P(""),L(""),C("")}catch(pe){D(pe instanceof _t&&pe.outcomeUnknown?`The create request did not receive a confirmation, so its outcome is unknown. Your fields are retained. ${pe.message}`:pe instanceof Error?pe.message:"Room creation failed.")}finally{O.current=!1,z(!1)}}}return a.jsx(_r,{title:"Create mission room",open:o,restoreFocus:u,fallbackFocus:_,onClose:h,locked:U,children:a.jsxs("form",{className:"dialog-form",onSubmit:ge,children:[a.jsx("p",{className:"dialog-intro",children:"Define the shared objective. Invitation requirements are added after the room is created."}),a.jsx(fi,{label:"Name",value:k,onChange:P,error:oe,autoFocus:!0}),a.jsx(Po,{label:"Goal",value:S,onChange:L,error:ee,rows:3,trimForBytes:!0}),a.jsx(Po,{label:"Briefing",value:I,onChange:C,error:le,rows:6,trimForBytes:!0}),!c&&a.jsx("p",{className:"form-error",role:"status",children:"Create is unavailable because the daemon disconnected. Your fields are retained and no request was sent."}),q&&a.jsx("p",{className:"form-error",role:"alert",children:q}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:h,disabled:U,children:"Cancel"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!c||U||!!(oe||ee||le),children:U?"Creating room…":"Create mission room"})]})]})})}function Yp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onSave:k}){const[P,S]=E.useState(o.room_name),[L,I]=E.useState(o.mission.goal),[C,U]=E.useState(o.mission.briefing),[z,q]=E.useState(o.status??""),[D,O]=E.useState(!1),[oe,ee]=E.useState(),le=E.useRef(!1);if(E.useEffect(()=>{c&&(S(o.room_name),I(o.mission.goal),U(o.mission.briefing),q(o.status??""),ee(void 0))},[c,o.mission.briefing,o.mission.goal,o.room_id,o.room_name,o.status]),!c)return null;const ge=Ls(P),xe=Pc("Goal",L),pe=Pc("Briefing",C),Re=o.status&&!z?"An existing status cannot be cleared.":void 0,Ee={},te=zo(P);te!==o.room_name&&(Ee.name=te),L!==o.mission.goal&&(Ee.goal=L),C!==o.mission.briefing&&(Ee.briefing=C),z!==(o.status??"")&&(Ee.status=z);const Ye=Object.keys(Ee).length>0;async function Ke(rt){if(rt.preventDefault(),!(!u||!_||!Ye||ge||xe||pe||Re||le.current)){le.current=!0,O(!0),ee(void 0);try{await k(Ee)}catch(Te){ee(Te instanceof _t&&Te.outcomeUnknown?`The settings request did not receive a confirmation, so its outcome is unknown. Your fields are retained. ${Te.message}`:Te instanceof Error?Te.message:"Settings update failed.")}finally{le.current=!1,O(!1)}}}return a.jsx(_r,{title:"Room settings",open:c,restoreFocus:h,onClose:y,locked:D,children:a.jsxs("form",{className:"dialog-form",onSubmit:Ke,children:[a.jsx(fi,{label:"Name",value:P,onChange:S,error:ge,autoFocus:!0}),a.jsx(Po,{label:"Goal",value:L,onChange:I,error:xe,rows:3}),a.jsx(Po,{label:"Briefing",value:C,onChange:U,error:pe,rows:5}),a.jsx(fi,{label:"Status (optional)",value:z,onChange:q,error:Re}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Settings are unavailable because the connection or room lifecycle changed. Your fields are retained and no request was sent."}),oe&&a.jsx("p",{className:"form-error",role:"alert",children:oe}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:D,children:"Cancel"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!u||!_||D||!Ye||!!(ge||xe||pe||Re),children:D?"Saving…":"Save settings"})]})]})})}function Kp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onConfirm:k}){const[P,S]=E.useState(""),[L,I]=E.useState(!1),[C,U]=E.useState(),z=E.useRef(!1);if(!c)return null;const q=Ms(o),O=(P===q||P===o.room_id)&&u&&_;async function oe(ee){if(ee.preventDefault(),!(!O||z.current)){z.current=!0,I(!0),U(void 0);try{await k()}catch(le){U(Qc(le,"close","Your confirmation is retained."))}finally{z.current=!1,I(!1)}}}return a.jsx(_r,{title:"Close room",open:c,restoreFocus:h,onClose:y,locked:L,children:a.jsxs("form",{className:"dialog-form",onSubmit:oe,children:[a.jsx("p",{className:"dialog-intro",children:"Closing is forward-only. Live packet state is removed, while the plaintext local archive remains readable on this host."}),a.jsxs("p",{className:"destructive-target",children:["Type ",a.jsx("strong",{children:q})," or the exact room ID ",a.jsx("code",{children:o.room_id})," to continue."]}),a.jsx(fi,{label:"Type room title or ID to close",value:P,onChange:S}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Close is unavailable because the connection or room lifecycle changed. No request was sent."}),C&&a.jsx("p",{className:"form-error",role:"alert",children:C}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:L,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"submit",disabled:!O||L,children:L?"Closing room…":"Close room permanently"})]})]})})}function Xp({room:o,open:c,connected:u,capable:_,restoreFocus:h,onClose:y,onConfirm:k}){const[P,S]=E.useState(""),[L,I]=E.useState(!1),[C,U]=E.useState(),z=E.useRef(!1);if(!c)return null;const D=P===o.room_id&&u&&_;async function O(oe){if(oe.preventDefault(),!(!D||z.current)){z.current=!0,I(!0),U(void 0);try{await k()}catch(ee){U(Qc(ee,"delete","Your confirmation is retained."))}finally{z.current=!1,I(!1)}}}return a.jsx(_r,{title:"Delete room",open:c,restoreFocus:h,onClose:y,locked:L,children:a.jsxs("form",{className:"dialog-form",onSubmit:O,children:[a.jsx("p",{className:"dialog-intro",children:"This deletes the plaintext local archive and room metadata from this host. It does not purge remote copies or backups and does not securely erase storage or keys."}),a.jsxs("p",{className:"destructive-target",children:["Type the exact room ID ",a.jsx("code",{children:o.room_id})," to continue."]}),a.jsx(fi,{label:"Type exact room ID to delete",value:P,onChange:S}),(!u||!_)&&a.jsx("p",{className:"form-error",role:"status",children:"Delete is unavailable because the connection or room lifecycle changed. No request was sent."}),C&&a.jsx("p",{className:"form-error",role:"alert",children:C}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:y,disabled:L,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"submit",disabled:!D||L,children:L?"Deleting room…":"Delete local archive"})]})]})})}function Po({label:o,value:c,onChange:u,error:_,rows:h,autoFocus:y=!1,trimForBytes:k=!1}){const P=E.useId(),S=`${P}-error`;return a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:P,children:o}),a.jsx("textarea",{id:P,value:c,rows:h,onChange:L=>u(L.target.value),"aria-invalid":!!_,"aria-describedby":_?S:void 0,autoFocus:y,"data-autofocus":y?"true":void 0}),_?a.jsx("small",{id:S,className:"field-error",children:_}):a.jsxs("small",{children:[Lo(k?c.trim():c)," / ",di," bytes"]})]})}function fi({label:o,value:c,onChange:u,error:_,autoFocus:h=!1}){const y=E.useId(),k=`${y}-error`;return a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:y,children:o}),a.jsx("input",{id:y,value:c,onChange:P=>u(P.target.value),"aria-invalid":!!_,"aria-describedby":_?k:void 0,autoFocus:h,"data-autofocus":h?"true":void 0}),_&&a.jsx("small",{id:k,className:"field-error",children:_})]})}function _r({title:o,open:c,restoreFocus:u,fallbackFocus:_,onClose:h,locked:y,children:k}){const P=E.useId(),S=E.useRef(null),L=E.useRef(h),I=E.useRef(y);return L.current=h,I.current=y,E.useEffect(()=>{var D;if(!c)return;const C=u??(document.activeElement instanceof HTMLElement?document.activeElement:null),U=S.current,z=()=>[...(U==null?void 0:U.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]];(D=z().find(O=>O.dataset.autofocus==="true")??z()[0])==null||D.focus();const q=O=>{if(O.key==="Escape"&&!I.current){O.preventDefault(),L.current();return}if(O.key!=="Tab")return;const oe=z();if(!oe.length)return;const ee=oe[0],le=oe[oe.length-1];if(!oe.includes(document.activeElement)){O.preventDefault(),(O.shiftKey?le:ee).focus();return}O.shiftKey&&document.activeElement===ee?(O.preventDefault(),le.focus()):!O.shiftKey&&document.activeElement===le&&(O.preventDefault(),ee.focus())};return document.addEventListener("keydown",q),()=>{document.removeEventListener("keydown",q);const O=Lc(C)?C:(_==null?void 0:_())??document.querySelector('[data-modal-fallback="true"]');Lc(O)&&O.focus()}},[_,c,u]),Hp.createPortal(a.jsx("div",{className:"modal-backdrop",onMouseDown:C=>{!y&&C.target===C.currentTarget&&h()},children:a.jsxs("div",{ref:S,className:"modal",role:"dialog","aria-modal":"true","aria-labelledby":P,children:[a.jsxs("header",{children:[a.jsx("h2",{id:P,children:o}),a.jsx("button",{className:"icon-button",type:"button",onClick:h,disabled:y,"aria-label":`Close ${o}`,children:"×"})]}),k]})}),document.body)}function Tc(o,c){const u=c.trim();if(!u)return`${o} is required.`;if(Lo(u)>di)return`${o} must be at most ${di} UTF-8 bytes.`}function Pc(o,c){if(Lo(c)<1)return`${o} is required.`;if(Lo(c)>di)return`${o} must be at most ${di} UTF-8 bytes.`}function Lo(o){return new TextEncoder().encode(o).byteLength}function Lc(o){return!!(o!=null&&o.isConnected&&!o.matches(':disabled, [aria-disabled="true"]')&&!o.closest('[hidden], [aria-hidden="true"]'))}function Qc(o,c,u){return o instanceof _t&&o.outcomeUnknown?`The ${c} request did not receive a confirmation, so its outcome is unknown. ${u} ${o.message}`:o instanceof Error?o.message:`Room ${c} failed.`}function Gp({room:o,connected:c,onCreate:u,onRevoke:_,onRecover:h}){const[y,k]=E.useState(""),[P,S]=E.useState("one_time"),[L,I]=E.useState("1"),[C,U]=E.useState(!1),[z,q]=E.useState(),[D,O]=E.useState(),oe=E.useRef(!1),ee=pt(o.state,c),le=Number(L),ge=new TextEncoder().encode(y.trim()).byteLength,xe=ge<1?"Role is required.":ge>256?"Role must be at most 256 UTF-8 bytes.":void 0,pe=P==="public"&&(!Number.isSafeInteger(le)||le<1)?"Minimum acceptances must be a positive whole number.":void 0;async function Re(te){te.preventDefault(),!(!ee.canCreateInvite||xe||pe||oe.current)&&await Ee(async()=>{await u({mode:P,role:y.trim(),min_accepts:P==="one_time"?1:le}),k("")},"Invite creation")}async function Ee(te,Ye){oe.current=!0,U(!0),q(void 0);try{await te()}catch(Ke){q(Yc(Ke,Ye))}finally{oe.current=!1,U(!1)}}return a.jsxs(a.Fragment,{children:[a.jsxs("form",{className:"invite-form",onSubmit:Re,children:[a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-role",children:"Role"}),a.jsx("input",{id:"invite-role",value:y,onChange:te=>k(te.target.value),"aria-invalid":!!xe}),xe&&a.jsx("small",{className:"field-error",children:xe})]}),a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-mode",children:"Mode"}),a.jsxs("select",{id:"invite-mode",value:P,onChange:te=>S(te.target.value),children:[a.jsx("option",{value:"one_time",children:"One-time"}),a.jsx("option",{value:"public",children:"Public"})]})]}),P==="public"&&a.jsxs("div",{className:"field",children:[a.jsx("label",{htmlFor:"invite-minimum",children:"Minimum acceptances"}),a.jsx("input",{id:"invite-minimum",inputMode:"numeric",value:L,onChange:te=>I(te.target.value),"aria-invalid":!!pe}),pe&&a.jsx("small",{className:"field-error",children:pe})]}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!ee.canCreateInvite||C||!!(xe||pe),children:"Create invite"})]}),z&&a.jsx("p",{className:"form-error",role:"alert",children:z}),a.jsx("div",{className:"invite-list",children:o.invites.map(te=>a.jsxs("article",{className:"invite-card",children:[a.jsxs("header",{children:[a.jsx("strong",{children:te.role}),a.jsx("span",{className:`state-text state-text--${te.state}`,children:bp(te.state)})]}),a.jsxs("p",{children:[te.mode==="public"?"Public":"One-time"," · ",te.accepted_cids.length," of ",te.min_accepts," accepted"]}),a.jsx("code",{children:te.invite_id}),te.recovery_of&&a.jsxs("p",{children:["Recovery lineage: ",a.jsx("code",{children:te.recovery_of})," → ",a.jsx("code",{children:te.invite_id})," (",te.recovery_confirmed?"confirmed":"awaiting confirmation",")"]}),a.jsx("button",{className:"quiet-button",type:"button",disabled:!ee.canRevokeInvite||C||!Jp(te),onClick:()=>O(te),children:"Revoke"})]},te.invite_id))}),o.invites.some(te=>te.state==="replacement_required")&&a.jsxs("div",{className:"recovery-callout",children:[a.jsx("p",{children:"The original invite secret is lost and cannot be recovered. Mint replacements, save every returned secret, then confirm each exact old/new pair. Repeating recovery rotates any unconfirmed replacement."}),a.jsx("button",{className:"secondary-button",type:"button",disabled:!ee.canRecoverInvite||C,onClick:()=>{ee.canRecoverInvite&&Ee(h,"Invite recovery")},children:"Recover missing invites"})]}),D&&a.jsx(_r,{title:"Revoke invite",open:!0,onClose:()=>O(void 0),locked:C,children:a.jsxs("div",{className:"dialog-form",children:[a.jsxs("p",{children:["Revoke the ",a.jsx("strong",{children:D.role})," invite ",a.jsx("code",{children:Kc(D.invite_id)}),"? It can no longer admit participants."]}),!ee.canRevokeInvite&&a.jsx("p",{className:"form-error",role:"status",children:"Revocation is unavailable because the connection or room lifecycle changed. No request was sent."}),a.jsxs("div",{className:"dialog-actions",children:[a.jsx("button",{className:"secondary-button",type:"button",onClick:()=>O(void 0),disabled:C,children:"Cancel"}),a.jsx("button",{className:"danger-button",type:"button",disabled:C||!ee.canRevokeInvite,onClick:()=>{ee.canRevokeInvite&&Ee(async()=>{await _(D.invite_id),O(void 0)},"Invite revocation")},children:"Revoke invite"})]})]})})]})}function Zp({vault:o,connected:c=!0,canConfirm:u=()=>!0,onClose:_,onConfirm:h}){const[y,k]=E.useState(""),[P,S]=E.useState(!1),[L,I]=E.useState(),C=E.useRef(!1);async function U(z){if(!(!c||!u(z)||C.current)){C.current=!0,S(!0),I(void 0);try{await h(z)}catch(q){I(Yc(q,"Recovery confirmation"))}finally{C.current=!1,S(!1)}}}return a.jsx(_r,{title:o.receipts.some(z=>z.recovery_of)?"Recovered invite receipts":"Invite receipt",open:!0,onClose:_,locked:P,children:a.jsxs("div",{className:"dialog-form",children:[a.jsxs("p",{className:"dialog-intro",children:["Room ",a.jsx("code",{children:o.room_id}),". Copy and save ",o.receipts.length===1?"this secret":"every secret"," now. It is not stored by cowork and disappears when this dialog closes."]}),o.receipts.map(z=>a.jsxs("section",{className:"receipt",children:[a.jsxs("p",{children:[a.jsx("strong",{children:z.invite.role})," · ",z.invite.mode==="public"?"Public":"One-time"]}),z.recovery_of&&a.jsxs("p",{children:["Old ",a.jsx("code",{children:z.recovery_of}),a.jsx("br",{}),"New ",a.jsx("code",{children:z.invite.invite_id})]}),a.jsx("pre",{children:z.blob}),a.jsx("button",{className:"secondary-button",type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(z.blob),k(`Copied ${Kc(z.invite.invite_id)}`)}catch{k("Copy failed. Select and copy the secret manually.")}},children:"Copy invite"}),z.recovery_of&&a.jsx("button",{className:"primary-button",type:"button",disabled:P||!c||!u(z),"aria-label":`Confirm ${z.recovery_of} to ${z.invite.invite_id}`,onClick:()=>U(z),children:"Confirm old/new pair"})]},`${z.recovery_of??"new"}:${z.invite.invite_id}`)),o.receipts.some(z=>z.recovery_of&&(!c||!u(z)))&&a.jsx("p",{className:"form-error",role:"status",children:"Recovery confirmation is unavailable because the connection or exact room lineage changed. The receipt is retained and no request was sent."}),L&&a.jsx("p",{className:"form-error",role:"alert",children:L}),a.jsx("p",{role:"status","aria-live":"polite",children:y}),a.jsx("div",{className:"dialog-actions",children:a.jsx("button",{className:"primary-button",type:"button",disabled:P,onClick:_,children:"Done"})})]})})}function Yc(o,c){return o instanceof _t&&o.outcomeUnknown?`${c} has an unknown outcome. The current state is preserved; check refreshed durable state before deciding whether to act again. ${o.message}`:o instanceof Error?o.message:`${c} failed.`}function Jp(o){return o.state==="live"||o.state==="replacement_required"||o.state==="receipt_pending"}function Kc(o){return o.length<=14?o:`${o.slice(0,8)}…${o.slice(-4)}`}function bp(o){return o.replaceAll("_"," ")}function em({room:o,participants:c=[],archiveCount:u=0,connected:_=!1,tab:h,open:y,drawer:k,panelRef:P,onTab:S,onClose:L,onCreateInvite:I=Es,onRevokeInvite:C=Es,onRecoverInvites:U=Es,onRequestClose:z=zc,onRequestDelete:q=zc}){const D=k&&!y;return a.jsxs("aside",{ref:P,className:`room-context${y?" room-context--open":""}`,"aria-label":"Room context","aria-hidden":D||void 0,hidden:D,tabIndex:-1,children:[a.jsxs("header",{className:"context-header",children:[a.jsxs("div",{children:[a.jsx("p",{className:"eyebrow",children:"Room context"}),a.jsx("h2",{children:o?"Mission details":"No room selected"})]}),a.jsx("button",{className:"icon-button context-close",type:"button",onClick:L,"aria-label":"Close context",children:"×"})]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"context-tabs",role:"tablist","aria-label":"Room context views",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":h==="state",onClick:()=>S("state"),children:"State"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="participants",onClick:()=>S("participants"),children:"Participants"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="invite",onClick:()=>S("invite"),children:"Invite"})]}),h==="state"?a.jsx(tm,{room:o,archiveCount:u,connected:_,onRequestClose:z,onRequestDelete:q}):h==="participants"?a.jsx(nm,{room:o,participants:c}):a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"Invites",children:[a.jsxs("div",{className:"setup-callout",children:[a.jsx("span",{"aria-hidden":"true",children:"↗"}),a.jsxs("div",{children:[a.jsx("h3",{children:"Build the room roster"}),a.jsx("p",{children:"Add invitation requirements one at a time. Each confirmed requirement is durable and can be retried independently."})]})]}),a.jsxs("dl",{className:"state-grid state-grid--compact",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"Requirements"}),a.jsx("dd",{children:o.invites.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Still needed"}),a.jsx("dd",{children:Os(o)})]})]}),a.jsx(Gp,{room:o,connected:_,onCreate:I,onRevoke:C,onRecover:U},o.room_id)]})]})]})}function tm({room:o,archiveCount:c,connected:u,onRequestClose:_,onRequestDelete:h}){const y=pt(o.state,u);return a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"State",children:[a.jsxs("dl",{className:"state-grid",children:[a.jsxs("div",{children:[a.jsx("dt",{children:"Lifecycle"}),a.jsx("dd",{className:`state-text state-text--${o.state}`,children:Xc(o.state)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Accepted seats"}),a.jsx("dd",{children:o.seats.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Unmet requirements"}),a.jsx("dd",{children:Os(o)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:"Archive"}),a.jsxs("dd",{children:[c," records"]})]})]}),a.jsx(yr,{label:"Room name",value:o.room_name}),o.status&&a.jsx(yr,{label:"Status",value:o.status}),a.jsx(yr,{label:"Room ID",value:o.room_id,mono:!0}),a.jsx(yr,{label:"Identity CID",value:o.identity_cid||"Pending",mono:!0}),a.jsx(yr,{label:"Created",value:Rs(o.created_at)}),o.closed_at&&a.jsx(yr,{label:"Closed",value:Rs(o.closed_at)}),a.jsxs("div",{className:"management-actions",children:[y.canClose&&a.jsx("button",{className:"danger-button",type:"button",onClick:k=>_(k.currentTarget),children:"Close room"}),y.canDelete&&a.jsx("button",{className:"danger-button",type:"button",onClick:k=>h(k.currentTarget),children:"Delete room"})]})]})}function nm({room:o,participants:c}){return a.jsxs("div",{className:"context-body",role:"tabpanel","aria-label":"Participants",children:[a.jsx("p",{className:`state-text state-text--${o.state}`,children:Xc(o.state)}),a.jsxs("p",{children:[c.length," ",c.length===1?"seat":"seats"]}),o.invites.map(u=>a.jsxs("p",{children:[a.jsx("strong",{children:u.role}),": ",u.accepted_cids.length," of ",u.min_accepts," accepted"]},u.invite_id)),a.jsxs("div",{className:"participant-list",children:[c.map(u=>a.jsxs("article",{className:"participant-card",children:[a.jsx("strong",{children:u.display_name}),a.jsx("span",{children:u.role}),a.jsx("code",{className:"mono",children:u.identity}),a.jsxs("small",{children:["via ",u.invite_id," · ",Rs(u.accepted_at)]})]},u.identity)),c.length===0&&a.jsx("p",{className:"context-note",children:"No participants admitted yet."})]})]})}function yr({label:o,value:c,mono:u=!1}){return a.jsxs("div",{className:"detail-row",children:[a.jsx("span",{children:o}),a.jsx("strong",{className:u?"mono":void 0,children:c})]})}function Rs(o){const c=new Date(o);return Number.isNaN(c.valueOf())?o:c.toLocaleString()}function Xc(o){return`${o.charAt(0).toUpperCase()}${o.slice(1).replaceAll("_"," ")}`}async function Es(){throw new Error("Invite management is unavailable.")}function zc(){}function Oc({records:o,mode:c}){const u=E.useMemo(()=>c==="events"?$p(o):pi([],o),[c,o]);return u.length===0?a.jsxs("p",{className:"timeline-empty",children:["No ",c==="events"?"operational events":"archive records"," loaded."]}):a.jsx("ul",{className:"record-list","aria-label":c==="events"?"Operational events":"Complete archive",children:u.map(_=>{const h=rm(_);return a.jsxs("li",{className:"record-row",children:[a.jsxs("header",{children:[a.jsxs("code",{children:["#",_.seq]}),a.jsx("strong",{children:_.kind.replaceAll("_"," ")}),"status"in _&&a.jsx("span",{className:`record-status record-status--${_.status}`,children:_.status}),a.jsx("time",{dateTime:_.at,children:im(_.at)})]}),_.kind==="message"&&a.jsx("p",{children:_.text}),a.jsx("pre",{children:JSON.stringify(h,null,2)})]},_.record_id)})})}function rm(o){const{version:c,room_id:u,seq:_,record_id:h,at:y,text:k,...P}=o.kind==="message"?o:{...o,text:void 0};return Object.fromEntries(Object.entries(P).filter(([,S])=>S!==void 0))}function im(o){const c=new Date(o);return Number.isNaN(c.valueOf())?o:c.toLocaleString()}const Gc="File integrity check failed; download blocked.",om="application/octet-stream";class Hn extends Error{constructor(){super(Gc),this.name="FileIntegrityError"}}async function lm(o){const c=um(o.dataBase64);if(c.byteLength!==o.size)throw new Hn;let u;try{const h=new Uint8Array(c.byteLength);h.set(c),u=await globalThis.crypto.subtle.digest("SHA-256",h.buffer)}catch{throw new Hn}if([...new Uint8Array(u)].map(h=>h.toString(16).padStart(2,"0")).join("")!==o.sha256)throw new Hn;return c}function sm(o){const c=o.replace(/[\\/]/gu,"_").replace(/[\p{Cc}\p{Cf}]/gu,"_").replace(/[ .]+$/gu,u=>"_".repeat(u.length));return c.length>0?c:"download"}async function am(o,c=cm()){const u=await lm(o),_=new Uint8Array(u.byteLength);_.set(u);const h=c.createObjectURL(new Blob([_.buffer],{type:om}));try{const y=c.createAnchor();y.href=h,y.download=sm(o.filename),y.hidden=!0,y.click()}finally{c.schedule(()=>c.revokeObjectURL(h))}}function um(o){if(!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o))throw new Hn;let c;try{c=atob(o)}catch{throw new Hn}if(btoa(c)!==o)throw new Hn;return Uint8Array.from(c,u=>u.charCodeAt(0))}function cm(){return{createObjectURL:o=>URL.createObjectURL(o),revokeObjectURL:o=>URL.revokeObjectURL(o),createAnchor:()=>document.createElement("a"),schedule:o=>setTimeout(o,0)}}function dm({file:o}){return a.jsxs("article",{className:"file-attachment",children:[a.jsx("div",{className:"file-attachment__glyph","aria-hidden":"true",children:"↓"}),a.jsxs("div",{className:"file-attachment__body",children:[a.jsx("strong",{className:"file-name",dir:"auto",children:o.filename}),a.jsx("span",{children:Ts(o.size)})]}),a.jsx(Zc,{file:o})]})}function Zc({file:o}){const[c,u]=E.useState(!1),[_,h]=E.useState("");async function y(){if(!c){u(!0),h("");try{await am(o)}catch(k){h(k instanceof Hn?Gc:"Download failed.")}finally{u(!1)}}}return a.jsxs("div",{className:"file-download",children:[a.jsx("button",{className:"secondary-button file-download__button",type:"button",disabled:c,"aria-label":`Download ${o.filename}`,onClick:()=>void y(),children:c?"Preparing download":"Download"}),a.jsx("span",{className:"file-download__status",role:"status","aria-live":"polite",children:_})]})}function Ts(o){if(o<1024)return`${o} B`;const c=["KB","MB"];let u=o,_=-1;do u/=1024,_+=1;while(u>=1024&&_<c.length-1);return`${u>=10||Number.isInteger(u)?u.toFixed(0):u.toFixed(1)} ${c[_]}`}function fm({roomId:o,records:c,historyReady:u,visible:_}){const h=E.useMemo(()=>Ap(c),[c]),[y,k]=E.useState(Vn),[P,S]=E.useState(""),L=E.useRef({maxSeq:0,ready:!1});E.useEffect(()=>{k(Vn)},[o]),E.useEffect(()=>{var D,O;const C=((D=h.at(-1))==null?void 0:D.seq)??0,U=L.current;if(U.roomId!==o||!u||!U.ready){L.current={roomId:o,maxSeq:C,ready:u},S("");return}const z=h.filter(oe=>oe.seq>U.maxSeq),q=z.length;L.current={roomId:o,maxSeq:Math.max(U.maxSeq,C),ready:!0},S(_&&q>0?q===1?`1 new ${((O=z[0])==null?void 0:O.type)==="file"?"attachment":"message"}`:`${q} new room items`:"")},[u,o,h,_]);const I=Vp(h,y);return a.jsxs("div",{className:"chat-timeline",children:[h.length===0&&a.jsx("p",{className:"timeline-empty",children:"No archived communication yet."}),h.length>I.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>k(C=>Ns(C,h.length)),children:"Show 500 earlier"}),a.jsx("ul",{className:"chat-list","aria-label":"Room communication",children:I.map(C=>C.type==="briefing"?a.jsxs("li",{className:"chat-row chat-row--briefing",children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:"Mission briefing"}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx("p",{className:"chat-row__text",children:C.text})]},C.recordId):C.type==="file"?a.jsxs("li",{className:"chat-row chat-row--file",children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:C.author.display_name}),a.jsx("span",{children:C.author.role}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx(dm,{file:C})]},C.recordId):a.jsxs("li",{className:`chat-row chat-row--${C.speaker}`,children:[a.jsxs("div",{className:"chat-row__meta",children:[a.jsx("strong",{children:C.author.display_name}),a.jsx("span",{children:C.speaker==="room"?"Room voice":C.author.role}),a.jsx(Cs,{seq:C.seq,at:C.at})]}),a.jsx("p",{className:"chat-row__text",children:C.text})]},C.recordId))}),a.jsx("p",{className:"visually-hidden",role:"status","aria-label":"New room items","aria-live":"polite","aria-atomic":"true",children:P})]})}function Cs({seq:o,at:c}){const u=new Date(c);return a.jsxs(a.Fragment,{children:[a.jsxs("code",{children:["#",o]}),a.jsx("time",{dateTime:c,children:Number.isNaN(u.valueOf())?c:u.toLocaleString()})]})}function pm({roomId:o,records:c}){const u=E.useMemo(()=>Bp(c,o),[c,o]),[_,h]=E.useState(Vn),[y,k]=E.useState(new Set),[P,S]=E.useState({});if(E.useEffect(()=>{h(Vn),k(new Set),S({})},[o]),u.length===0)return a.jsx("p",{className:"timeline-empty",children:"No archived files yet."});const L=u.slice(0,_);return a.jsxs("div",{className:"files-view",children:[a.jsx("ul",{className:"file-group-list","aria-label":"Room files",children:L.map(I=>{const C=y.has(I.groupId),U=`file-versions-${I.groupId}`,z=P[I.groupId]??Vn,q=I.versions.slice(0,z);return a.jsxs("li",{className:"file-group",children:[a.jsxs("button",{className:"file-group__toggle",type:"button","aria-expanded":C,"aria-controls":U,"aria-label":`${C?"Collapse":"Expand"} versions for ${I.filename}`,onClick:()=>k(D=>{const O=new Set(D);return O.has(I.groupId)?O.delete(I.groupId):O.add(I.groupId),O}),children:[a.jsx("span",{className:"file-group__chevron","aria-hidden":"true",children:"›"}),a.jsx("span",{className:"file-group__title file-name",dir:"auto",children:I.filename}),a.jsxs("span",{className:"file-group__count",children:[I.versions.length," ",I.versions.length===1?"version":"versions"]}),a.jsxs("span",{className:"file-group__latest",children:["Latest: ",I.latest.author.display_name," · ",a.jsx(Mc,{at:I.latest.at})," · ",Ts(I.latest.size)]})]}),C&&a.jsxs("div",{className:"file-version-panel",id:U,children:[a.jsx("ol",{className:"file-version-list","aria-label":`Versions of ${I.filename}`,children:q.map(D=>a.jsxs("li",{className:"file-version",children:[a.jsxs("div",{className:"file-version__details",children:[a.jsxs("strong",{children:["Version ",D.version]}),a.jsxs("span",{children:[D.author.display_name," · ",D.author.role]}),a.jsxs("span",{children:[a.jsx(Mc,{at:D.at})," · ",Ts(D.size)]}),a.jsx("span",{className:"file-version__mime",children:D.mime})]}),a.jsx(Zc,{file:D})]},D.recordId))}),I.versions.length>q.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>S(D=>({...D,[I.groupId]:Ns(z,I.versions.length)})),children:"Show 500 older versions"})]})]},I.latest.recordId)})}),u.length>L.length&&a.jsx("button",{className:"quiet-button show-earlier",type:"button",onClick:()=>h(I=>Ns(I,u.length)),children:"Show 500 earlier"})]})}function Mc({at:o}){const c=new Date(o);return a.jsx("time",{dateTime:o,children:Number.isNaN(c.valueOf())?o:c.toLocaleString()})}const Dc=262144;function mm({roomState:o,connected:c,state:u,onDraftChange:_,onSend:h}){const{draft:y,pending:k,error:P}=u,S=o==="active"&&c,L=hm(y)>Dc?`Message must be at most ${Dc} UTF-8 bytes.`:void 0,I=S&&!k&&y.length>0&&!L;async function C(q){q==null||q.preventDefault(),I&&await h(y)}function U(q){q.key!=="Enter"||q.shiftKey||(q.preventDefault(),C())}const z=c?o!=="active"?`Messaging is unavailable while the room is ${o}.`:void 0:"Disconnected. Drafts remain local until the daemon is available.";return a.jsxs("form",{className:"room-composer",onSubmit:C,children:[a.jsx("label",{className:"visually-hidden",htmlFor:"room-message",children:"Message the room"}),a.jsx("textarea",{id:"room-message",rows:3,value:y,disabled:!S||k,placeholder:"Message as the room identity",onChange:q=>_(q.target.value),onKeyDown:U,"aria-describedby":"composer-help","aria-invalid":!!L}),a.jsxs("div",{className:"composer-footer",children:[a.jsx("small",{id:"composer-help",children:L??z??"Enter to send · Shift+Enter for a new line"}),a.jsx("button",{className:"primary-button",type:"submit",disabled:!I,children:k?"Sending…":"Send message"})]}),P&&a.jsx("p",{className:"form-error",role:"alert",children:P})]})}function hm(o){return new TextEncoder().encode(o).byteLength}const Bn=["communication","files","events","archive"];function vm({room:o,records:c=[],historyReady:u=!1,connected:_,visible:h=!0,composerState:y,onComposerDraft:k,onOpenRooms:P,onOpenContext:S,onSettings:L,onSendMessage:I=_m}){const[C,U]=E.useState("communication"),z=E.useRef({});if(!o)return a.jsxs("main",{className:"workspace workspace--empty",children:[a.jsx("button",{className:"icon-button mobile-rooms",type:"button",onClick:P,"aria-label":"Open rooms",children:"☰"}),a.jsxs("div",{className:"empty-workspace",children:[a.jsx("span",{className:"empty-workspace__glyph","aria-hidden":"true",children:"⌁"}),a.jsx("p",{className:"eyebrow",children:"Mission control"}),a.jsx("h1",{children:"Select a room"}),a.jsx("p",{children:"Choose a mission room to inspect its state and coordinate its work."})]})]});const q=pt(o.state,_);return a.jsxs("main",{className:"workspace",children:[a.jsxs("header",{className:"workspace-header",children:[a.jsx("button",{className:"icon-button mobile-rooms",type:"button",onClick:P,"aria-label":"Open rooms",children:"☰"}),a.jsxs("div",{className:"workspace-identity",children:[a.jsx("p",{className:"eyebrow",children:"Mission room"}),a.jsx("h1",{children:Ms(o)})]}),a.jsx("span",{className:`lifecycle-badge lifecycle-badge--${o.state}`,children:gm(o.state)}),a.jsx("button",{className:"secondary-button context-toggle",type:"button",onClick:S,"data-modal-fallback":"true",children:"Context"})]}),a.jsxs("div",{className:"mission-strip",children:[a.jsx("span",{children:"Goal"}),a.jsx("p",{children:o.mission.goal}),a.jsx("button",{className:"quiet-button",type:"button",onClick:D=>L(D.currentTarget),disabled:!q.canEditSettings,children:"Room settings"})]}),a.jsx("nav",{className:"workspace-tabs","aria-label":"Room workspace",role:"tablist",children:Bn.map(D=>a.jsx("button",{ref:O=>{z.current[D]=O??void 0},id:`workspace-tab-${D}`,type:"button",role:"tab","aria-controls":`workspace-panel-${D}`,"aria-selected":C===D,tabIndex:C===D?0:-1,onClick:()=>U(D),onKeyDown:O=>{var ge;const oe=Bn.indexOf(D),ee=O.key==="ArrowRight"?(oe+1)%Bn.length:O.key==="ArrowLeft"?(oe-1+Bn.length)%Bn.length:O.key==="Home"?0:O.key==="End"?Bn.length-1:void 0;if(ee===void 0)return;O.preventDefault();const le=Bn[ee];U(le),(ge=z.current[le])==null||ge.focus()},children:D[0].toUpperCase()+D.slice(1)},D))}),a.jsxs("section",{className:"workspace-content",id:`workspace-panel-${C}`,role:"tabpanel","aria-labelledby":`workspace-tab-${C}`,"aria-label":`${C} panel`,tabIndex:0,children:[C==="communication"&&a.jsx(ym,{room:o,records:c,historyReady:u,connected:_,visible:h,composerState:y??wm,onComposerDraft:k??xm,onSendMessage:I}),C==="files"&&a.jsx(pm,{roomId:o.room_id,records:c}),C==="events"&&a.jsx(Oc,{records:c,mode:"events"}),C==="archive"&&a.jsx(Oc,{records:c,mode:"archive"})]})]})}function ym({room:o,records:c,historyReady:u,connected:_,visible:h,composerState:y,onComposerDraft:k,onSendMessage:P}){const S=c.some(L=>L.kind==="message"&&L.category==="briefing");return a.jsxs("div",{className:"communication-shell",children:[!S&&a.jsxs("article",{className:"briefing-card",children:[a.jsx("p",{className:"eyebrow",children:"Mission briefing"}),a.jsx("p",{children:o.mission.briefing})]}),o.state!=="active"&&a.jsx("p",{className:`lifecycle-separator lifecycle-separator--${o.state}`,children:o.state==="provisioning"?"Room setup in progress · messaging begins after activation":o.state==="closing"?"Room closure in progress · mutations are disabled":"Room closed · read-only local archive"}),a.jsx(fm,{roomId:o.room_id,records:c,historyReady:u,visible:h}),a.jsx(mm,{roomState:o.state,connected:_,state:y,onDraftChange:k,onSend:P})]})}function gm(o){return o==="provisioning"?"Provisioning":o[0].toUpperCase()+o.slice(1)}async function _m(){throw new Error("Room messaging is unavailable.")}const wm={draft:"",pending:!1};function xm(){}function Ic(o){if(!Number.isFinite(o.intervalMs)||o.intervalMs<=0)throw new TypeError("poll interval must be positive");let c=!1,u=0;const _=o.clock??{setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};let h,y;function k(S){if(!c||u!==S||!o.visible())return Promise.resolve();if((y==null?void 0:y.generation)===S)return y.dirty=!0,y.promise;const L={generation:S,controller:new AbortController,dirty:!1,promise:Promise.resolve()};return y=L,L.promise=P(L),L.promise}async function P(S){try{do{S.dirty=!1;try{await o.run(S.controller.signal)}catch(L){if(!c||u!==S.generation||S.controller.signal.aborted)return;throw L}}while(S.dirty&&c&&u===S.generation&&o.visible())}finally{y===S&&(y=void 0)}}return{start(){if(c)return;c=!0;const S=++u;h=_.setInterval(()=>{k(S).catch(()=>{})},o.intervalMs)},refresh(){return k(u)},stop(){if(!c)return;c=!1,u+=1,h!==void 0&&_.clearInterval(h),h=void 0;const S=y;y=void 0,S==null||S.controller.abort()}}}const Sm={call:(o,c,u)=>cp(o,c,{signal:u==null?void 0:u.signal})};function km({rpc:o=Sm,clock:c}){var Qn;const[u,_]=E.useState([]),[h,y]=E.useState(()=>Fc(location.hash)),[k,P]=E.useState(),[S,L]=E.useState([]),[I,C]=E.useState({}),[U,z]=E.useState({}),[q,D]=E.useState({}),[O,oe]=E.useState(null),[ee,le]=E.useState(),[ge,xe]=E.useState(),[pe,Re]=E.useState(!1),[Ee,te]=E.useState(!1),[Ye,Ke]=E.useState(!1),[rt,Te]=E.useState(!1),[it,ot]=E.useState([]),[Xe,Ce]=E.useState("state"),[$,X]=E.useState(!1),[V,m]=E.useState(!1),j=$c("(max-width: 999px)"),ne=$c("(max-width: 759px)"),re=E.useRef(),ae=E.useRef(),ie=E.useRef(0),fe=E.useRef({}),ue=E.useRef({}),se=E.useRef([]),_e=E.useRef(new Set),et=E.useRef(null),mi=E.useRef(),lt=E.useRef(h),Wn=E.useRef(),wr=E.useRef(),xr=E.useRef(),qn=E.useRef(),Sr=E.useRef(null),It=E.useCallback(x=>{et.current=x,oe(x)},[]),Fe=E.useCallback(x=>{x&&_e.current.has(x.room_id)||(mi.current=x,P(x))},[]),Nt=E.useCallback(x=>{const A=x.filter(F=>!_e.current.has(F.room_id));se.current=A,_(A)},[]),en=E.useCallback(x=>{if(_e.current.has(x.room_id))return;const A=se.current.some(F=>F.room_id===x.room_id)?se.current.map(F=>F.room_id===x.room_id?x:F):[...se.current,x];se.current=A,_(A)},[]),Ht=E.useCallback((x,A)=>{if(_e.current.has(x))return;const F=A(ue.current[x]??No);ue.current={...ue.current,[x]:F},D(ue.current)},[]),Cn=E.useCallback(()=>!document.hidden,[]),hi=E.useCallback(()=>Sr.current??void 0,[]),Se=E.useCallback((x,A)=>{const F=x instanceof Error?x.message:"Unexpected daemon error.";xe(A?`${A}: ${F}`:F)},[]),tn=E.useCallback(async(x,A={})=>{var me;if(_e.current.has(x))return;let F=fe.current[x]??[],J=((me=F.at(-1))==null?void 0:me.seq)??0;const Y=()=>{var he;return!((he=A.signal)!=null&&he.aborted)&&!_e.current.has(x)&&(A.generation===void 0||ie.current===A.generation)};for(;Y();){const he=await o.call("room.history",{room_id:x,after:J,limit:200},A.signal?{signal:A.signal}:void 0);if(!Y())return;if(!Rp(he)||he.some((mt,Wt)=>mt.room_id!==x||mt.seq!==J+Wt+1))throw new Error("daemon returned an invalid history page");if(he.length>0){if(!Y())return;F=pi(fe.current[x]??F,he),fe.current={...fe.current,[x]:F},C(fe.current)}if(he.length===0){if(!Y())return;z(mt=>_e.current.has(x)||mt[x]?mt:{...mt,[x]:!0});return}J+=he.length}},[o]);E.useEffect(()=>{const x=Ic({intervalMs:5e3,visible:Cn,clock:c,run:async F=>{const J=lt.current;try{const Y=await o.call("room.list",{},{signal:F});if(!kp(Y))throw new Error("daemon returned an invalid room list");const me=Y.filter(he=>!_e.current.has(he.room_id));Nt(me),It(!0),xe(he=>he!=null&&he.startsWith("Disconnected:")?void 0:he),J&&lt.current===J&&!me.some(he=>he.room_id===J)&&(lt.current=void 0,y(void 0),Fe(void 0),L([]),le(`Room “${J}” is no longer available. No local data was changed.`),location.hash&&history.replaceState(null,"",`${location.pathname}${location.search}#/`))}catch(Y){if(F.aborted)return;It(!1);const me=Y instanceof Error?Y.message:"cowork daemon is unavailable";xe(`Disconnected: ${me}. Loaded room data is preserved.`)}}});re.current=x,x.start(),x.refresh();const A=()=>{document.hidden||x.refresh()};return document.addEventListener("visibilitychange",A),()=>{document.removeEventListener("visibilitychange",A),re.current=void 0,x.stop()}},[c,Nt,o,It,Fe,Cn]),E.useEffect(()=>{const x=()=>{const A=Fc(location.hash),F=A&&!_e.current.has(A)?A:void 0;lt.current=F,y(F),L([]),A&&!F&&history.replaceState(null,"",`${location.pathname}${location.search}#/`)};return window.addEventListener("hashchange",x),()=>window.removeEventListener("hashchange",x)},[]),E.useEffect(()=>{const x=++ie.current;if(!h){Fe(void 0),L([]);return}if(_e.current.has(h)){lt.current=void 0,y(void 0),Fe(void 0),L([]),location.hash&&history.replaceState(null,"",`${location.pathname}${location.search}#/`);return}const A=u.find(Y=>Y.room_id===h);A&&Fe(A);const F=Ic({intervalMs:2e3,visible:Cn,clock:c,run:async Y=>{try{const[me,he,mt]=await Promise.allSettled([o.call("room.show",{room_id:h},{signal:Y}),o.call("room.participants",{room_id:h},{signal:Y}),tn(h,{generation:x,signal:Y})]);if(Y.aborted||ie.current!==x||_e.current.has(h))return;if(me.status==="rejected")throw me.reason;const Wt=me.value;if(!ui(Wt))throw new Error("daemon returned invalid room details");if(ie.current!==x||_e.current.has(h)||Wt.room_id!==h)return;if(Fe(Wt),he.status==="fulfilled"&&kc(he.value)){const rn=he.value;L(Yn=>_e.current.has(h)||ie.current!==x||Em(Yn,rn)?Yn:rn)}he.status==="fulfilled"&&!kc(he.value)?Se(new Error("daemon returned invalid participant details"),"Participant refresh failed"):he.status==="rejected"&&!Y.aborted&&Se(he.reason,"Participant refresh failed"),mt.status==="rejected"&&!Y.aborted&&Se(mt.reason,"History refresh failed"),en(Wt),It(!0)}catch(me){if(Y.aborted||ie.current!==x)return;It(!1),Se(me,"Disconnected")}}});ae.current=F,F.start(),F.refresh();const J=()=>{document.hidden||F.refresh()};return document.addEventListener("visibilitychange",J),()=>{document.removeEventListener("visibilitychange",J),ae.current===F&&(ae.current=void 0),F.stop()}},[c,tn,en,Se,o,h,It,Fe,Cn]);const nn=E.useCallback(x=>{if(_e.current.has(x)){lt.current=void 0,y(void 0),Fe(void 0),L([]),history.replaceState(null,"",`${location.pathname}${location.search}#/`);return}lt.current=x,y(x),L([]),le(void 0),Ke(!1),Te(!1),X(!1);const A=`#/rooms/${encodeURIComponent(x)}`;location.hash!==A&&(location.hash=A)},[Fe]),We=E.useCallback(()=>{var x,A;(x=re.current)==null||x.refresh(),(A=ae.current)==null||A.refresh()},[]),jn=E.useCallback(async(x,A,F)=>{if(et.current!==!0)throw new Error("The daemon is disconnected. Your fields are retained.");try{const J=await o.call("room.create",{name:x,goal:A.trim(),briefing:F.trim()});if(!ui(J))throw new Error("daemon returned invalid created room details");Re(!1),Ce("invite"),m(!0),nn(J.room_id),We()}catch(J){throw Se(J,"Create room failed"),J}},[We,Se,o,nn]),Nn=E.useCallback(async(x,A)=>{if(Object.keys(A).length===0)return;const F=se.current.find(J=>J.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. Your fields are retained.");if(!F||!pt(F.state,!0).canEditSettings)throw new Error("Room settings are unavailable in the current lifecycle. Your fields are retained.");try{const J=await o.call("room.settings",{room_id:x,...A});if(!ui(J)||J.room_id!==x)throw new Error("daemon returned invalid updated room details");te(!1),We()}catch(J){throw Se(J,"Settings update failed"),J}},[We,Se,o]),de=E.useMemo(()=>(k==null?void 0:k.room_id)===h?k:u.find(x=>x.room_id===h),[u,k,h]),vi=E.useCallback(async(x,A)=>{const F=se.current.find(J=>J.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The invite form is retained.");if(!F||!pt(F.state,!0).canCreateInvite)throw new Error("Invites are unavailable in the current room lifecycle. The form is retained.");try{const J={room_id:x,...A},Y=await o.call("room.invite",J),me=Cp(Y,J);ot(he=>[...he,{room_id:x,receipts:[me]}]),We()}catch(J){throw Se(J,"Create invite failed"),J}},[We,Se,o]),yi=E.useCallback(async(x,A)=>{const F=se.current.find(Y=>Y.room_id===x),J=F==null?void 0:F.invites.find(Y=>Y.invite_id===A);if(et.current!==!0)throw new Error("The daemon is disconnected. The revoke confirmation is retained.");if(!F||!pt(F.state,!0).canRevokeInvite||!J||!jm(J.state))throw new Error("This invite can no longer be revoked. The confirmation is retained.");try{const Y=await o.call("room.revoke",{room_id:x,invite_id:A});return We(),Y}catch(Y){throw Se(Y,"Revoke invite failed"),Y}},[We,Se,o]),Do=E.useCallback(async x=>{const A=se.current.find(F=>F.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. Recovery was not started.");if(!A||!pt(A.state,!0).canRecoverInvite||!A.invites.some(F=>F.state==="replacement_required"))throw new Error("Invite recovery is unavailable in the current room state.");try{const F=await o.call("room.recover",{room_id:A.room_id}),J=jp(F,A);J.length>0&&ot(Y=>[...Y,{room_id:A.room_id,receipts:J}]),We()}catch(F){throw Se(F,"Recover invites failed"),F}},[We,Se,o]),kr=E.useCallback(async x=>{if(!x.recovery_of)throw new Error("Recovery receipt has no old invite pointer.");const A=se.current.find(F=>F.room_id===x.room_id);if(et.current!==!0)throw new Error("The daemon is disconnected. The recovery receipt is retained.");if(!A||!Ac(A,x))throw new Error("The exact recovery lineage is no longer confirmable. The receipt is retained.");try{const F=await o.call("room.recover.confirm",{room_id:x.room_id,recovery_of:x.recovery_of,invite_id:x.invite.invite_id});Np(F,x),We()}catch(F){throw Se(F,"Confirm recovery failed"),F}},[We,Se,o]),Er=E.useCallback(async(x,A)=>{const F=ue.current[x]??No;if(F.pending||F.draft!==A)return;const J=se.current.find(Y=>Y.room_id===x);if(et.current!==!0||!J||!pt(J.state,!0).canMessage){Ht(x,Y=>({...Y,error:"Messaging is unavailable because the connection or room lifecycle changed. Your draft is retained."}));return}Ht(x,Y=>({...Y,pending:!0,error:void 0}));try{const Y=await o.call("room.message",{room_id:x,text:A});if(!Hc(Y)||Y.kind!=="message"||Y.room_id!==x||Y.category!=="chat"||Y.text!==A||Y.author.identity!==J.identity_cid||Y.author.display_name!==J.identity_name||Y.author.role!=="room")throw new Error("daemon returned invalid message confirmation");if(_e.current.has(x))return;Ht(x,me=>({draft:me.draft===A?"":me.draft,pending:!1})),tn(x).catch(me=>Se(me,"History refresh failed"))}catch(Y){Ht(x,me=>({...me,pending:!1,error:Cm(Y)}))}},[tn,Se,o,Ht]),Cr=E.useCallback(async x=>{const A=se.current.find(F=>F.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The room was not closed.");if(!A||!pt(A.state,!0).canClose)throw new Error("This room cannot be closed from its current state.");try{const F=await o.call("room.close",{room_id:x});if(!ui(F)||F.room_id!==x||F.state!=="closed")throw new Error("daemon returned invalid closed room details");lt.current===x&&Fe(F),en(F),Ke(!1),We()}catch(F){throw Se(F,"Close room failed"),F}},[We,en,Se,o,Fe]),jr=E.useCallback(async x=>{var F,J;const A=se.current.find(Y=>Y.room_id===x);if(et.current!==!0)throw new Error("The daemon is disconnected. The room was not deleted.");if(!A||!pt(A.state,!0).canDelete)throw new Error("Only a closed room can be deleted.");try{const Y=await o.call("room.delete",{room_id:x,confirm:!0});if(!Tp(Y)||Y.room_id!==x)throw new Error("daemon returned invalid deletion confirmation");_e.current.add(x),ie.current+=1,(F=ae.current)==null||F.stop(),Nt(se.current.filter(me=>me.room_id!==x)),Fe(void 0),y(void 0),lt.current=void 0,L([]),fe.current=Object.fromEntries(Object.entries(fe.current).filter(([me])=>me!==x)),C(fe.current),ue.current=Object.fromEntries(Object.entries(ue.current).filter(([me])=>me!==x)),D(ue.current),z(me=>Object.fromEntries(Object.entries(me).filter(([he])=>he!==x))),Te(!1),m(!1),le(`Room “${x}” was deleted from this host. Remote copies and backups were not purged.`),history.replaceState(null,"",`${location.pathname}${location.search}#/`),(J=re.current)==null||J.refresh()}catch(Y){throw Se(Y,"Delete room failed"),Y}},[Nt,Se,o,Fe]);return a.jsxs("div",{className:"cowork-app",children:[a.jsx(qp,{rooms:u,selectedRoomId:h,connected:O,open:$,sheet:ne,onClose:()=>X(!1),onCreate:x=>{Wn.current=x,Re(!0)},onSelect:nn}),a.jsx(vm,{room:de,records:de?I[de.room_id]??[]:[],historyReady:!!(de&&U[de.room_id]),connected:O===!0,visible:!document.hidden,composerState:de?q[de.room_id]??No:No,onComposerDraft:de?x=>Ht(de.room_id,A=>({...A,draft:x})):void 0,onOpenRooms:()=>X(!0),onOpenContext:()=>m(!0),onSettings:x=>{wr.current=x,te(!0)},onSendMessage:de?x=>Er(de.room_id,x):void 0}),a.jsx(em,{room:de,participants:S,archiveCount:de?((Qn=I[de.room_id])==null?void 0:Qn.length)??0:0,connected:O===!0,tab:Xe,open:V,drawer:j,panelRef:Sr,onTab:Ce,onClose:()=>m(!1),onCreateInvite:de?x=>vi(de.room_id,x):void 0,onRevokeInvite:de?x=>yi(de.room_id,x):void 0,onRecoverInvites:de?()=>Do(de.room_id):void 0,onRequestClose:x=>{xr.current=x,Ke(!0)},onRequestDelete:x=>{qn.current=x,Te(!0)}}),(ne&&$||j&&V)&&a.jsx("button",{className:"responsive-scrim",type:"button","aria-label":"Close open panel",onClick:()=>{X(!1),m(!1)}}),O===!1&&a.jsxs("div",{className:"disconnect-banner",role:"status",children:[a.jsx("strong",{children:"Disconnected"}),a.jsx("span",{children:"Loaded data remains visible. Mutations are disabled until the daemon answers."})]}),ge&&a.jsxs("div",{className:"error-banner",role:"alert",children:[a.jsx("span",{children:ge}),a.jsx("button",{type:"button",onClick:()=>xe(void 0),"aria-label":"Dismiss error",children:"×"})]}),ee&&a.jsxs("div",{className:"notice-banner",role:"status",children:[a.jsx("span",{children:ee}),a.jsx("button",{type:"button",onClick:()=>le(void 0),"aria-label":"Dismiss notice",children:"×"})]}),a.jsx(Qp,{open:pe,connected:O===!0,restoreFocus:Wn.current,fallbackFocus:hi,onClose:()=>Re(!1),onCreate:jn}),de&&Ee&&a.jsx(Yp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canEditSettings,restoreFocus:wr.current,onClose:()=>te(!1),onSave:x=>Nn(de.room_id,x)},de.room_id),de&&Ye&&a.jsx(Kp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canClose,restoreFocus:xr.current,onClose:()=>Ke(!1),onConfirm:()=>Cr(de.room_id)},`close:${de.room_id}`),de&&rt&&a.jsx(Xp,{room:de,open:!0,connected:O===!0,capable:pt(de.state,O===!0).canDelete,restoreFocus:qn.current,onClose:()=>Te(!1),onConfirm:()=>jr(de.room_id)},`delete:${de.room_id}`),it[0]&&a.jsx(Zp,{vault:it[0],connected:O===!0,canConfirm:x=>{const A=u.find(F=>F.room_id===x.room_id);return!!(A&&Ac(A,x))},onClose:()=>ot(x=>x.slice(1)),onConfirm:kr})]})}function Fc(o){const c=/^#\/rooms\/([^/?#]+)$/.exec(o);if(c!=null&&c[1])try{return decodeURIComponent(c[1])}catch{return}}function Em(o,c){return o.length===c.length&&o.every((u,_)=>JSON.stringify(u)===JSON.stringify(c[_]))}const No={draft:"",pending:!1};function Cm(o){return o instanceof _t&&o.outcomeUnknown?`The message request did not receive a confirmation, so its outcome is unknown. Your draft is retained. ${o.message}`:o instanceof Error?o.message:"Message send failed."}function jm(o){return o==="live"||o==="replacement_required"||o==="receipt_pending"}function Ac(o,c){if(!pt(o.state,!0).canRecoverInvite||c.recovery_of===void 0)return!1;const u=o.invites.find(h=>h.invite_id===c.recovery_of);if(!u||u.mode!==c.invite.mode||u.role!==c.invite.role||u.min_accepts!==c.invite.min_accepts)return!1;const _=o.invites.find(h=>h.invite_id===c.invite.invite_id);return _?_.recovery_of!==u.invite_id||_.mode!==u.mode||_.role!==u.role||_.min_accepts!==u.min_accepts?!1:_.state==="receipt_pending"?u.state==="replacement_required"&&_.recovery_confirmed===!1&&_.accepted_cids.length===0:u.state==="revoked"&&_.recovery_confirmed===!0&&(_.state==="live"||_.state==="consumed"||_.state==="replacement_required"||_.state==="revoked"):u.state==="replacement_required"}function $c(o){const c=E.useMemo(()=>typeof window.matchMedia=="function"?window.matchMedia(o):void 0,[o]),[u,_]=E.useState(()=>(c==null?void 0:c.matches)??!1);return E.useEffect(()=>{if(!c)return;const h=y=>_(y.matches);return _(c.matches),c.addEventListener("change",h),()=>c.removeEventListener("change",h)},[c]),u}const Jc=document.getElementById("root");if(!Jc)throw new Error("missing root element");rp.createRoot(Jc).render(a.jsx(E.StrictMode,{children:a.jsx(km,{})}));
@@ -10,7 +10,7 @@ ours-cowork room show <room-id>
10
10
 
11
11
  In the web console, choose Create room, enter Name, Goal, and Briefing, and submit once. Names are trimmed and Unicode NFC-normalized, must contain 1–64 Unicode characters, and cannot contain Unicode control or format characters. Duplicate names are allowed. The created room is selected automatically and its Invite panel opens. Add invitation requirements one at a time; the UI does not combine room creation and invites into a fabricated atomic operation.
12
12
 
13
- Update the display name with `ours-cowork room settings <room-id> --name "New name"`; other mutable mission fields use the same `room settings` command. The display name is persisted as `room_name`, while the opaque `room_id` remains the stable routing, URL, storage, and identity-correlation key. The underlying room identity is not renamed. Existing unnamed rooms receive the deterministic display name `Room <first 8 room_id characters>` when loaded. Inspect admitted seats with `room participants`. A room activates only when its recorded invite requirements are satisfied. Roles are display labels; participant identity CIDs, not roles, are authorization keys.
13
+ Update the display name with `ours-cowork room settings <room-id> --name "New name"`; other mutable mission fields use the same `room settings` command. A new room announces `ours-cowork-room:<initial room_name>`. The display name is persisted as mutable `room_name`, while the authenticated announced identity name is intentionally frozen: renaming a room does not change its CID, signing key, contacts, or history. Duplicate names are allowed because identity CIDs, not names, are the authorization and routing keys. The opaque `room_id` remains the stable URL, storage, and identity-correlation key. Existing `cowork-room-<room_id>` identities are retained without renaming; existing unnamed rooms receive only the deterministic display name `Room <first 8 room_id characters>` when loaded. Inspect admitted seats with `room participants`. A room activates only when its recorded invite requirements are satisfied. Roles are display labels; participant identity CIDs, not roles, are authorization keys.
14
14
 
15
15
  Close with `ours-cowork room close <room-id>`. Close is forward-only and removes live room packet state while retaining the local archive. Archive deletion is a separate explicit operation described in the limitations topic.
16
16
 
@@ -5,3 +5,5 @@ Stop the daemon before taking a backup. A live copy can split metadata, append-o
5
5
  Back up the complete state directory as one unit, preserving ownership and file modes. Do not select only `rooms/` or only room JSON files.
6
6
 
7
7
  For restore, stop the daemon, replace the complete state directory with the complete backup, restore its original owner and `0700`/`0600` permissions, and then start the daemon. Do not merge individual room directories from different snapshots. Restore to a compatible package version and verify `ours-cowork status` plus representative `room show` and `room history` calls.
8
+
9
+ Room restore preserves the persisted signing secret, CID, packet state, and exact announced identity name. Current rooms therefore retain the `ours-cowork-room:<initial room_name>` they were created with, even if mutable display metadata was renamed later. Legacy `cowork-room-<room_id>` identities stay legacy; restore never upgrades or recreates them.
@@ -13,3 +13,4 @@
13
13
  - The web console and HTTP room RPC have no authentication. They bind only to `127.0.0.1` and must not be forwarded, proxied, or exposed remotely.
14
14
  - Web updates use periodic polling rather than push. A view can lag daemon state until its next refresh; confirmed mutations trigger an immediate refresh.
15
15
  - Browser state is transient apart from the selected-room URL hash. Invite receipts disappear when closed and are not recoverable from browser storage.
16
+ - Room names are not unique. New rooms announce `ours-cowork-room:<initial room_name>`, but that authenticated identity name is immutable while `room_name` remains editable. Interfaces must distinguish duplicate or renamed rooms by CID/room ID and may use local display aliases; an alias does not change authenticated provenance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ours.network/cowork",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Standalone daemon for durable ours mission rooms.",
5
5
  "type": "module",
6
6
  "license": "FSL-1.1-Apache-2.0",