@maiaos/node 0.1.0-canary.71 → 0.1.0-canary.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/maia-node-main.mjs +1349 -1349
- package/dist/bin/maia-node-main.mjs.map +2 -2
- package/dist/bin/maia-node.cdx.json +36 -36
- package/dist/bin/maia-node.meta.json +1 -1
- package/dist/bin/maia-node.release.json +14 -14
- package/dist/bin/maia-process-host-linux-x64.build.json +1 -1
- package/dist/bin/maia-web.release.digest.json +1 -1
- package/dist/bin/panel/assets/index-BDCAvLEO.js +30 -0
- package/dist/bin/panel/index.html +1 -1
- package/package.json +5 -5
- package/dist/bin/panel/assets/index-BNBmo2IU.js +0 -30
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},n={pipe(){return t(this,arguments)}},r=function(){function e(){}return e.prototype=n,e}(),i=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},a=e=>e,o=e=>()=>e,s=o(!0),c=o(!1),l=o(void 0),u=l;function d(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function f(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var p=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},m=new WeakSet,h=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),g=0,ee=()=>{g++};function _(e){return typeof e==`string`}function te(e){return typeof e==`number`}function ne(e){return typeof e==`boolean`}function re(e){return typeof e==`symbol`}function ie(e){return _(e)||te(e)||re(e)}function ae(e){return typeof e==`function`}function oe(e){return e!=null}function se(e){return!1}function ce(e){return!0}function le(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ue(e){return typeof e==`object`&&!!e||ae(e)}var de=i(2,(e,t)=>ue(e)&&t in e);function fe(e){return de(e,Symbol.iterator)||_(e)}var pe=`~effect/Hash`,me=e=>{switch(typeof e){case`number`:return ye(e);case`bigint`:return be(e.toString(10));case`string`:return be(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?be(`Invalid Date`):be(e.toISOString());if(e instanceof RegExp)return be(e.toString());{if(m.has(e))return v(e);let t=ke.get(e);if(t!==void 0)return t;if(Ae.has(e))return ee(),be(`[Circular]`);Ae.add(e);let n=g,r;try{r=`~effect/Hash`in e?e[pe]():typeof e==`function`?v(e):e instanceof DataView?we(h(e)):Array.isArray(e)||ArrayBuffer.isView(e)?we(e):e instanceof Map?Te(e):e instanceof Set?De(e):Se(e)}finally{Ae.delete(e)}return n===g&&ke.set(e,r),r}}return _e(he(be(String(e))))},v=e=>(Oe.has(e)||Oe.set(e,_e(Math.random()*4294967296|0)),Oe.get(e)),he=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),ge=i(2,(e,t)=>he(Math.imul(e,2654435761)+Math.imul(t,2246822507))),_e=e=>e&3221225471|e>>>1&1073741824,ve=new DataView(new ArrayBuffer(8)),ye=e=>{let t=e|0;return t===e?_e(t):(ve.setFloat64(0,e===e?e:NaN),_e(ge(ve.getInt32(0),ve.getInt32(4))))},be=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return _e(t)},xe=(e,t)=>{let n=12289;for(let r of t)n^=ge(me(r),me(e[r]));return _e(n)},Se=e=>xe(e,p(e)),Ce=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return _e(r)},we=e=>{let t=6151;for(let n of e)t=ge(t,me(n));return _e(t)},Te=Ce(be(`Map`),([e,t])=>ge(me(e),me(t))),Ee=be(`Set`),De=Ce(Ee,e=>ge(Ee,me(e))),Oe=new WeakMap,ke=new WeakMap,Ae=new WeakSet,je=`~effect/Equal`;function Me(){return arguments.length===1?e=>Ne(e,arguments[0]):Ne(arguments[0],arguments[1])}function Ne(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||m.has(e)||m.has(t)?!1:Pe(e,t):!1}function Pe(e,t){let n=Ie.length;for(let r=n;r-->0;)if(Ie[r]===e&&Le[r]===t)return!0;if(n)return Fe(e,t);let r=Re.get(e);r||Re.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=Fe(e,t)),i}function Fe(e,t){Ie.push(e),Le.push(t);try{return ze(e,t)}finally{Ie.pop(),Le.pop()}}var Ie=[],Le=[],Re=new WeakMap;function ze(e,t){if(me(e)!==me(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=Ke(e);if(n!==Ke(t)||typeof e==`function`&&!n)return!1;if(n)return e[je](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Be(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Ve(h(e),h(t)):Ve(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ue(e,t,We,Ge):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ue(e,t,me,Ne):He(e,t)}function Be(e,t){for(let n=0;n<e.length;n++)if(!Ne(e[n],t[n]))return!1;return!0}function Ve(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function He(e,t){let n=p(e),r=p(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Ne(e[i],t[i]))return!1;return!0}function Ue(e,t,n,r){let i=new Map;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e])}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop();continue outer}}return!1}return!0}var We=e=>me(e[0]),Ge=(e,t)=>Ne(e[0],t[0])&&Ne(e[1],t[1]),Ke=e=>de(e,je),qe=Symbol.for(`~effect/Redactable`),Je=e=>de(e,qe);function Ye(e){return Je(e)?Xe(e):e}function Xe(e){return e[qe](globalThis[`~effect/Fiber/currentFiber`]?.context??$e)}var Ze=`~effect/Fiber/currentFiber`,Qe=new Map,$e={"~effect/Context":{},base:Qe,depth:0,mapUnsafe:Qe,pipe(){return t(this,arguments)}};function et(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return tt;r.add(e);let l;if(qe in e)l=c(Xe(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
2
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=it(e);else if(!t?.ignoreToString&&de(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=at(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${nt(t)}:${c(ot(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${nt(t)}: ${c(ot(e,t),n+1)}`).join(`,
|
|
3
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var tt=`[Circular]`;function nt(e){return typeof e==`string`?JSON.stringify(e):String(e)}function rt(e){return e.map(e=>`[${nt(e)}]`).join(``)}function it(e){try{return e.toISOString()}catch{return`Invalid Date`}}function at(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function ot(e,t){try{return e[t]}catch{return`[property access threw]`}}function st(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=de(r,qe)?Ye(r):Ye(t);if(typeof i==`bigint`)return et(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!de(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),a!==i&&n.push(a),a},t?.space)??`null`}var ct=Symbol.for(`nodejs.util.inspect.custom`),lt=e=>{try{return e=Ye(e),de(e,`toJSON`)&&ae(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(lt):e}catch{return`[toJSON threw]`}},ut=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?st(e,{space:t}):et(e,{space:t})}catch{return String(e)}},dt={toJSON(){return lt(this)},[ct](){return this.toJSON()},toString(){return et(this.toJSON())}},ft=class{[ct](){return this.toJSON()}toString(){return et(this.toJSON())}},pt=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),mt=()=>Error.stackTraceLimit,ht=e=>{pt&&(Error.stackTraceLimit=e)},gt=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},_t=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return mt()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function vt(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function yt(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&vt(e,n,t[n])}var bt=`~effect/Effect`,xt=`~effect/Exit`,St={_A:a,_E:a,_R:a},Ct=`${bt}/identifier`,y=`${bt}/args`,wt=`${bt}/evaluate`,Tt=`${bt}/successCont`,Et=`${bt}/failureCont`,Dt=`${bt}/ensureCont`,Ot=Symbol.for(`effect/Effect/Yield`),kt={pipe(){return t(this,arguments)},toJSON(){return{...this}},toString(){return et(this.toJSON(),{ignoreToString:!0,space:2})},[ct](){return this.toJSON()}},At={[bt]:St,...kt,[Symbol.iterator](){return new gt(this)},toJSON(){return{_id:`Effect`,op:this[Ct],...y in this?{args:this[y]}:void 0}}},jt=e=>de(e,bt),Mt=e=>de(e,xt),Nt=`~effect/Cause`,Pt=`~effect/Cause/Reason`,Ft=e=>de(e,Nt),It=class{constructor(e){this[Nt]=Nt,this.reasons=e}pipe(){return t(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${et(this.reasons)})`}[ct](){return this.toJSON()}[je](e){return Ft(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>Me(t,e.reasons[n]))}[pe](){return we(this.reasons)}},Lt=new WeakMap,Rt=class{[Pt];annotations;_tag;constructor(e,t,n){if(this[Pt]=Pt,this._tag=e,t!==zt&&typeof n==`object`&&n&&t.size>0){let e=Lt.get(n);e&&(t=new Map([...e,...t])),Lt.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return t(this,arguments)}toString(){return et(this)}[ct](){return this.toString()}},zt=new Map,Bt=class extends Rt{constructor(e,t=zt){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${et(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[je](e){return qt(e)&&Me(this.error,e.error)&&Me(this.annotations,e.annotations)}[pe](){return ge(be(this._tag))(ge(me(this.error))(me(this.annotations)))}},Vt=e=>new It(e),Ht=new It([]),Ut=e=>new It([new Bt(e)]),Wt=class extends Rt{constructor(e,t=zt){super(`Die`,t,e),this.defect=e}toString(){return`Die(${et(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[je](e){return Jt(e)&&Me(this.defect,e.defect)&&Me(this.annotations,e.annotations)}[pe](){return ge(be(this._tag))(ge(me(this.defect))(me(this.annotations)))}},Gt=e=>new It([new Wt(e)]),Kt=i(e=>Ft(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new It(e.reasons.map(e=>e.annotate(t,n)))),qt=e=>e._tag===`Fail`,Jt=e=>e._tag===`Die`,Yt=e=>e._tag===`Interrupt`;function Xt(e){return on(`Effect.evaluate: Not implemented`)}var Zt=e=>({...At,[Ct]:e.op,[wt]:e[wt]??Xt,[Tt]:e[Tt],[Et]:e[Et],[Dt]:e[Dt]}),Qt=e=>{let t=Zt(e),n=function(e){this[y]=e};return n.prototype=t,function(e){return new n(e)}},$t=e=>{let t={[xt]:xt,_tag:e.op,get[e.prop](){return this[y]},...Zt(e),toString(){return`${e.op}(${et(this[y])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[y]}},[je](e){return Mt(e)&&e._tag===this._tag&&Me(this[y],e[y])},[pe](){return ge(be(e.op),me(this[y]))}},n=function(e){this[y]=e};return n.prototype=t,function(e){return new n(e)}},en=$t({op:`Success`,prop:`value`,[wt](e){let t=e.getCont(Tt);return t?t[Tt](this[y],e,this):e.yieldWith(this)}}),tn={key:`effect/Cause/StackTrace`},nn={key:`effect/Cause/InterruptorStackTrace`},rn=$t({op:`Failure`,prop:`cause`,[wt](e){let t=this[y],n=!1;e.cache.stackFrame&&(t=Kt(t,{mapUnsafe:new Map([[tn.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(Et);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Et);return r?r[Et](t,e,n?void 0:this):e.yieldWith(n?rn(t):this)}}),an=e=>rn(Ut(e)),on=e=>rn(Gt(e)),sn=Qt({op:`WithFiber`,[wt](e){return this[y](e)}}),cn=function(){class e extends globalThis.Error{}let t=Zt({op:`YieldableError`,[wt](){return an(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),ln=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends cn{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(yt(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),un=e=>{class t extends ln{_tag=e}return t.prototype.name=e,t},dn=`~effect/Cause/NoSuchElementError`,fn=class extends un(`NoSuchElementError`){[dn]=dn;constructor(e){super({message:e})}},pn=`~effect/Cause/Done`,mn=e=>de(e,pn),hn={[pn]:pn,_tag:`Done`,value:void 0},gn=e=>e===void 0?hn:{[pn]:pn,_tag:`Done`,value:e},_n=an(hn),vn=e=>e===void 0?_n:an(gn(e)),yn=e=>Zt({op:e.label,[wt]:e.evaluate}),bn=e=>(t,n)=>t===n||e(t,n),xn=(e,t)=>e===t,Sn=()=>xn;function Cn(e){return bn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function wn(e){return bn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var Tn=`~effect/Option`,En={[Tn]:{_A:e=>e},...kt,[Symbol.iterator](){return new gt(this)}},Dn=Object.defineProperty(Object.assign(Object.create(En),{_tag:`Some`,_op:`Some`,[je](e){return An(e)&&Mn(e)&&Me(this.value,e.value)},[pe](){return ge(me(this._tag))(me(this.value))},toString(){return`some(${et(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:lt(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),On=me(`None`),kn=Object.assign(Object.create(En),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[je](e){return An(e)&&jn(e)},[pe](){return On},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),An=e=>de(e,Tn),jn=e=>e._tag===`None`,Mn=e=>e._tag===`Some`,Nn=Object.create(kn),Pn=function(e){this.value=e};Pn.prototype=Dn;var Fn=e=>new Pn(e),In=`~effect/Result`,Ln={[In]:{_A:e=>e,_E:e=>e},...kt,[Symbol.iterator](){return new gt(this)}},Rn=Object.assign(Object.create(Ln),{_tag:`Success`,_op:`Success`,[je](e){return Bn(e)&&Hn(e)&&Me(this.success,e.success)},[pe](){return ge(me(this._tag))(me(this.success))},toString(){return`success(${et(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:lt(this.success)}}}),zn=Object.assign(Object.create(Ln),{_tag:`Failure`,_op:`Failure`,[je](e){return Bn(e)&&Vn(e)&&Me(this.failure,e.failure)},[pe](){return ge(me(this._tag))(me(this.failure))},toString(){return`failure(${et(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:lt(this.failure)}}}),Bn=e=>de(e,In),Vn=e=>e._tag===`Failure`,Hn=e=>e._tag===`Success`,Un=function(e){this.failure=e};Un.prototype=zn;var Wn=e=>new Un(e),Gn=function(e){this.success=e};Gn.prototype=Rn;var Kn=e=>new Gn(e);function qn(e){return(t,n)=>t===n?0:e(t,n)}var Jn=qn((e,t)=>e<t?-1:1),Yn=qn((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Xn=i(2,(e,t)=>qn((n,r)=>e(t(n),t(r)))),Zn=e=>i(2,(t,n)=>e(t,n)===-1),Qn=e=>i(2,(t,n)=>e(t,n)===1),$n=e=>i(2,(t,n)=>e(t,n)!==1),er=e=>i(2,(t,n)=>e(t,n)!==-1),tr=e=>i(2,(t,n)=>t===n||e(t,n)<1?t:n),nr=()=>Nn,rr=Fn,ir=jn,ar=Mn,or=i(2,(e,{onNone:t,onSome:n})=>ir(e)?t():n(e.value)),sr=i(2,(e,t)=>ir(e)?t():e.value),cr=e=>e==null?nr():rr(e),lr=e=>e===void 0?nr():rr(e),ur=sr(l),dr=e=>(...t)=>{try{return rr(e(...t))}catch{return nr()}},fr=i(2,(e,t)=>ir(e)?nr():rr(t(e.value))),pr=`~effect/Context/Service`,mr=function(){function e(){}let t=e;Object.setPrototypeOf(t,hr);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[_r]=_r,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&gr.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},hr={[pr]:pr,...yn({label:`Service`,evaluate(e){return en(Br(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return Pr(this,e)},use(e){return sn(t=>e(Br(t.context,this)))},useSync(e){return sn(t=>en(e(Br(t.context,this))))}},gr=new Set,_r=`~effect/Context/Reference`,vr=`~effect/Context`,yr=8,br=8,xr=(e,t,n,r)=>{let i=Object.create(Or);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},Sr=(e,t)=>{t&&(Sr(e,t.parent),e.set(t.key,t.value))},Cr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Sr(t,e.overlay),e._flat=t},wr=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Dr(n)},Tr=Symbol(),Er=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Tr:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=br&&(n.base=Cr(n),n.overlay=void 0,n.depth=0),r)},Dr=e=>xr(void 0,e,void 0,0),Or={get mapUnsafe(){return Cr(this)},...kt,[vr]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[je](e){if(!Ar(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!Me(r,n.get(e)))return!1;return!0},[pe](){return ye(this.mapUnsafe.size)}},kr=(e,t)=>e.cacheRoot===t.cacheRoot,Ar=e=>de(e,vr),jr=e=>!!e[_r],Mr=()=>Nr,Nr=Dr(new Map),Pr=(e,t)=>Dr(new Map([[e.key,t]])),Fr=i(3,(e,t,n)=>Ir(e,t.key,n)),Ir=(e,t,n)=>{let r=e,i=gr.has(t)?void 0:r.cacheRoot;if(r.depth>=yr){let e=new Map(r.mapUnsafe);return e.set(t,n),xr(i,e,void 0,0)}return xr(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Lr=i(2,(e,t)=>Rr(e,t.key)),Rr=(e,t)=>{let n=Er(e,t);return n===Tr?void 0:n},zr=i(2,(e,t)=>{let n=Er(e,t.key);if(n===Tr){if(jr(t))return Hr(t);throw Ur(t)}return n}),Br=zr,Vr=`~effect/Context/defaultValue`,Hr=e=>Vr in e?e[Vr]:e[Vr]=e.defaultValue(),Ur=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
4
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
5
|
+
`)}return t},Wr=i(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:wr(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),Gr=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return Dr(t)},Kr=mr,qr=e=>e.length>0,Jr=e=>e>0?Math.floor(e):0,Yr=e=>Math.max(1,Jr(e)),Xr=Kn,Zr=Wn,Qr=e=>{if(ae(e))try{return Xr(e())}catch(e){return Zr(e)}try{return Xr(e.try())}catch(t){return Zr(e.catch(t))}},$r=Vn,ei=Hn,ti=i(2,(e,t)=>$r(e)?Zr(t(e.failure)):e),ni=i(2,(e,{onFailure:t,onSuccess:n})=>$r(e)?t(e.failure):n(e.success)),ri=Cn,ii={[Symbol.iterator](){return ai}},ai={next(){return{done:!0,value:void 0}}},oi=()=>ii,si=i(2,(e,t)=>Object.hasOwn(e,t)),ci=i(2,(e,t)=>{let n={...e};for(let r of li(e))vt(n,r,t(e[r],r));return n}),li=e=>Object.keys(e),ui=e=>i(2,(t,n)=>{for(let r of li(t))if(!si(n,r)||!e(t[r],n[r]))return!1;return!0}),di=e=>{let t=ui(e);return(e,n)=>t(e,n)&&t(n,e)},fi=globalThis.Array,pi=e=>fi.isArray(e)?e:fi.from(e),mi=i(2,(e,t)=>[...e,t]);fi.isArray;var hi=qr,gi=qr,_i=e=>e[e.length-1],vi=()=>[],yi=e=>[e],bi=i(2,(e,t)=>e.map(t)),xi=wn,Si=`~effect/Duration`,Ci=BigInt(0),wi=BigInt(1),Ti=BigInt(2),Ei=BigInt(10),Di=BigInt(1e3),Oi=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),ki=e=>Oi(e*1e6),Ai=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Ei**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Ti>=a?wi:Ci);return r?-s:s},ji=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Mi=e=>{switch(typeof e){case`number`:return Wi(e);case`bigint`:return Ui(e);case`string`:{if(e===`Infinity`)return Vi;if(e===`-Infinity`)return Hi;let t=ji.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return Ui(Ai(r,wi));if(i===`micro`||i===`micros`)return Ui(Ai(r,Di));let a=Number(r);switch(i){case`milli`:case`millis`:return Wi(a);case`second`:case`seconds`:return Gi(a);case`minute`:case`minutes`:return Ki(a);case`hour`:case`hours`:return qi(a);case`day`:case`days`:return Ji(a);case`week`:case`weeks`:return Yi(a)}break}case`object`:{if(e===null)break;if(Si in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(te)?Ni(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Bi:e[0]===-1/0||e[1]===-1/0?Hi:e[0]===1/0||e[1]===1/0?Vi:Ri(Oi(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?Ri(n):Ri(Oi(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return Ni(e)},Ni=e=>{throw Error(`Invalid Input: ${e}`)},Pi={_tag:`Millis`,millis:0},Fi={_tag:`Infinity`},Ii={_tag:`NegativeInfinity`},Li={[Si]:Si,[pe](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?me(Oi(e)):ye(this.value.millis)}case`Nanos`:return me(this.value.nanos);default:return Se(this.value)}},[je](e){return zi(e)&&ra(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[ct](){return this.toJSON()},pipe(){return t(this,arguments)}},Ri=e=>{let t=Object.create(Li);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?Pi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:ki(e)}:e>0?Fi:Ii:e===Ci?Pi:{_tag:`Nanos`,nanos:e},t},zi=e=>de(e,Si),Bi=Ri(0),Vi=Ri(1/0),Hi=Ri(-1/0),Ui=e=>Ri(e),Wi=e=>Ri(e),Gi=e=>Ri(e*1e3),Ki=e=>Ri(e*6e4),qi=e=>Ri(e*36e5),Ji=e=>Ri(e*864e5),Yi=e=>Ri(e*6048e5),Xi=e=>Qi(Mi(e),{onMillis:a,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Zi=e=>{let t=Mi(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return ki(t.value.millis)}},Qi=i(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),$i=i(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Zi(e),t.value.nanos):n.onNanos(e.value.nanos,Zi(t))),ea=qn((e,t)=>$i(e,t,{onMillis:(e,t)=>e<t?-1:+(e>t),onNanos:(e,t)=>e<t?-1:+(e>t),onInfinity:(e,t)=>e.value._tag===t.value._tag?0:e.value._tag===`Infinity`?1:e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`?-1:1})),ta=(e,t)=>$i(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),na=tr(ea),ra=i(2,(e,t)=>ta(e,t)),ia=e=>t=>!$r(e(t)),aa=e=>t=>t.has(e)?Xr(t):Zr(t),oa=i(2,(e,t)=>n=>{let r=e(n);return $r(r)?r:t(r.success)}),sa=Kr(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new fa}),ca=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},la=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},ua=e=>{try{return la(e)}catch{return ca(e)}},da=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},fa=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?ca:ua)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new pa(this.setImmediate)}},pa=class{tasks=new da;running=void 0;setImmediate;constructor(e=ua){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},ma=Kr(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),ha=Kr(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),ga=un,_a=e=>{switch(e){case 16:return ba();case 32:return xa();default:{let t=``;for(let n=e>>>3;n>0;n--)t+=ya();return t}}},b=Uint8Array.from(`0123456789abcdef`,e=>e.charCodeAt(0)),va=()=>Math.random()*4294967296>>>0,ya=()=>{let e=va();return String.fromCharCode(b[e>>>28],b[e>>>24&15],b[e>>>20&15],b[e>>>16&15],b[e>>>12&15],b[e>>>8&15],b[e>>>4&15],b[e&15])},ba=()=>{let e=va(),t=va();return String.fromCharCode(b[e>>>28],b[e>>>24&15],b[e>>>20&15],b[e>>>16&15],b[e>>>12&15],b[e>>>8&15],b[e>>>4&15],b[e&15],b[t>>>28],b[t>>>24&15],b[t>>>20&15],b[t>>>16&15],b[t>>>12&15],b[t>>>8&15],b[t>>>4&15],b[t&15])},xa=()=>{let e=va(),t=va(),n=va(),r=va();return String.fromCharCode(b[e>>>28],b[e>>>24&15],b[e>>>20&15],b[e>>>16&15],b[e>>>12&15],b[e>>>8&15],b[e>>>4&15],b[e&15],b[t>>>28],b[t>>>24&15],b[t>>>20&15],b[t>>>16&15],b[t>>>12&15],b[t>>>8&15],b[t>>>4&15],b[t&15],b[n>>>28],b[n>>>24&15],b[n>>>20&15],b[n>>>16&15],b[n>>>12&15],b[n>>>8&15],b[n>>>4&15],b[n&15],b[r>>>28],b[r>>>24&15],b[r>>>20&15],b[r>>>16&15],b[r>>>12&15],b[r>>>8&15],b[r>>>4&15],b[r&15])},Sa=`effect/Tracer/ParentSpan`,Ca=class extends mr()(Sa,{fiberCached:!0}){},wa=e=>e,Ta=Kr(`effect/Tracer/DisablePropagation`,{defaultValue:c}),Ea=Kr(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),Da=Kr(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),Oa=`effect/Tracer`,ka=wa({span:e=>new Aa(e)}),Aa=class{_tag=`Span`;sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime}}get traceId(){return this._traceId??=ur(this.parent)?.traceId??_a(32)}get spanId(){return this._spanId??=_a(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}},ja=`effect/Metric/FiberRuntimeMetrics`,Ma=Kr(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:l}),Na=Kr(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:s}),Pa=Kr(`effect/References/TracerTimingEnabled`,{defaultValue:s}),Fa=Kr(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),Ia=Kr(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),La=Kr(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Ra=Kr(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),za=Kr(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Ba=Kr(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Va=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=mt();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};ht(3);let n=Error();return ht(t),{...e,captureStackTrace:Ua(()=>n.stack)}},Ha=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
|
|
6
|
+
`);if(i[e]!==void 0)return n=i[e].trim(),n}},Ua=Ha(3),Wa=class extends Rt{constructor(e,t=zt){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[je](e){return Yt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[pe](){return ge(be(`${this._tag}:${this.fiberId}`))(v(this.annotations))}},Ga=e=>new It([new Wa(e)]),Ka=e=>{let t=e.reasons.find(qt);return t?Xr(t):Zr(e)},qa=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Xr(n.error)}return Zr(e)},Ja=e=>e.reasons.some(Jt),Ya=e=>e.reasons.some(Yt),Xa=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Xr(t):Zr(e)},Za=e=>e.reasons.length>0&&e.reasons.every(Yt),Qa=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=me(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>Me(e,i)))continue;else t.push(i);r.push(i)}return r},$a=i(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new It(Qa(e.reasons,t.reasons));return Me(e,n)?e:n}),eo=i(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>qt(e)?(n=!0,new Bt(t(e.error),e.annotations)):e);return n?Vt(r):e}),to=e=>{let t;for(let n of e.reasons){if(n._tag===`Fail`)return n.error;n._tag===`Die`&&(t??=n)}return t===void 0?e.reasons.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`):t.defect},no=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=mt();i!==0&&ht(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(ro(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=co(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(ro(i,r[0].annotations,t))}}finally{i!==0&&ht(i)}return n},ro=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(io(e),{cause:e.cause?ro(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=oo(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?so(e,t):e}n?.includeCauseInStack&&(i.stack=fo(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:st(e):`Unknown error: ${e}`);return i},io=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return st(e)},ao=/\((.*)\)/g,oo=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
7
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?so(a.join(`
|
|
8
|
+
`),n):a.join(`
|
|
9
|
+
`)},so=(e,t)=>{let n=t?.get(tn.key);return n&&(e=`${e}\n${lo(n)}`),e},co=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(nn.key);n.push(` at fiber (${t})`),r&&n.push(lo(r))}return n.join(`
|
|
10
|
+
`)},lo=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(ao),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
11
|
+
`)},uo=e=>no(e).map(fo).join(`
|
|
12
|
+
`),fo=e=>e.cause?`${e.stack} {\n${po(e.cause,` `)}\n}`:e.stack,po=(e,t)=>{let n=e.stack.split(`
|
|
13
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${po(e.cause,`${t} `)}\n${t}}`),r},mo=`~effect/Fiber`,ho={_A:a,_E:a},go={id:0},_o=()=>globalThis[Ze],vo=class{constructor(e,t=!0){this.setContext(e),this.id=++go.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[mo](){return ho}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return Br(this.context,e)}addObserver(e){return this._exit?(e(this._exit),u):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=Ga(e);this.cache.stackFrame&&(n=Kt(n,Pr(tn,this.cache.stackFrame))),t&&(n=Kt(n,t)),this._interruptedCause=this._interruptedCause?$a(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(S(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===Ot)return;let n=So.interruptChildren&&So.interruptChildren(this);if(n!==void 0)return this.evaluate(bs(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=Mr()}runLoop(e){let t=globalThis[Ze];globalThis[Ze]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){this._deferredInterrupt&&(this._deferredInterrupt=!1,i=S(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=bs(No,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[wt](this),i===Ot){let e=this._yielded;if(xt in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return Ot}}}catch(e){return de(i,wt)?this.runLoop(on(e)):on(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Ze]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,bo;for(;;){let t=this._stack.pop();if(!t)return;let n=t[Dt];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&xo-1))return en(e);let t=this.getCont(Tt);return t?t[Tt](e,this):this.yieldWith(en(e))}yieldWith(e){return this._yielded=e,Ot}children(){return this._children??=new Set}pipe(){return t(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&kr(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=yo(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},yo=e=>{let t=Rr(e,Oa);return{scheduler:Br(e,sa),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:Br(e,Na),span:Rr(e,Sa),logLevel:Br(e,Ra),minimumLogLevel:Br(e,za),stackFrame:Br(e,Ma),runtimeMetrics:Rr(e,ja),maxOpsBeforeYield:Br(e,ma),preventYield:Br(e,ha)}},bo={[Tt](e,t){return S(t._interruptedCause)},[Et](e,t){return S(t._interruptedCause)}},xo=32,So={interruptChildren:void 0},Co=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(nn.key,e.cache.stackFrame),Dr(t)},wo=e=>{let t=e;return t._exit?x(t._exit):Wo(n=>t._exit?n(x(t._exit)):jo(e.addObserver(e=>n(x(e)))))},To=e=>Wo(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(x(r))}return a(),jo(()=>i?.())}),Eo=e=>{let t=e;return t._exit?t._exit:Wo(n=>t._exit?n(t._exit):jo(e.addObserver(n)))},Do=e=>sn(t=>Oo(e,t.id)),Oo=i(e=>de(e[0],mo),(e,t,n)=>sn(r=>{let i=Co(r);return i=i&&n?Wr(i,n):i??n,e.interruptUnsafe(t,i),hs(wo(e))})),ko=e=>sn(t=>{let n=Co(t),r=vi();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return hs(To(r))}),x=en,S=rn,Ao=an,jo=Qt({op:`Sync`,[wt](e){let t=this[y](),n=e.getCont(Tt);return n?n[Tt](t,e):e.yieldWith(en(t))}}),Mo=Qt({op:`Suspend`,[wt](e){return this[y]()}}),No=Qt({op:`Yield`,[wt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(As)},this[y]??0),e.yieldWith(()=>{t=!0})}})(0),Po=x(nr()),Fo=e=>Mo(()=>S(e())),Io=e=>on(e),Lo=e=>Mo(()=>Ao(e())),C=x(void 0),Ro=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new au(e,`An error occurred in Effect.try`):e.catch;return Mo(()=>{try{return x(t())}catch(e){return Ao(n(e))}})},zo=e=>Ho(function(t,n){e(n).then(e=>t(x(e)),e=>t(Io(e)))},e.length!==0),Bo=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new au(e,`An error occurred in Effect.tryPromise`):e.catch;return Ho(function(e,r){let i=t=>{try{e(Ao(_t(()=>n(t))))}catch(t){e(Io(t))}};try{t(r).then(t=>e(x(t)),i)}catch(e){i(e)}},t.length!==0)},Vo=e=>sn(t=>e(t.id)),Ho=function(){let e=Zt({op:`Async`,[wt](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(Uo(()=>(t=!0,r?.abort(),i??As))),Ot):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),Uo=Qt({op:`AsyncFinalizer`,[Dt](e){e.interruptible&&(e.interruptible=!1,e._stack.push($c))},[Et](e,t){return Ya(e)?bs(wc(rn(e),this[y]()),()=>S(e)):S(e)}}),Wo=e=>Ho(e,e.length>=2),Go=Wo(u),Ko=(...e)=>{if(e.length===1){let t=e[0];return Mo(()=>es(t()))}let[t,n]=e;return Mo(()=>es(n.call(t.self)))},qo=(e,...t)=>{let n=t.length===0?function(){return Mo(()=>es(e.apply(this,arguments)))}:function(){let n=Mo(()=>es(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Jo(e.length,n)},Jo=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Yo=Ha(2),Xo=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=mt(),i;return r!==0&&(ht(2),i=new globalThis.Error,ht(r)),e?(r,...a)=>Zo(t,r,i,a,e,n):Zo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},Zo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self),s=`${e} (definition)`,c=n?Yo(()=>n.stack):l;return Jo(o.length,function(...t){let n=Mo(()=>{let e=o.apply(this,arguments);return jt(e)?e:es(e)});for(let e=0;e<r.length;e++)n=r[e](n,...t);if(!jt(n))return n;let u=mt(),d;return u!==0&&(ht(2),d=new globalThis.Error,ht(u)),Is(i?Vl(e,a,e=>Hl(n,e)):n,Ma,t=>({name:e,stack:d?Yo(()=>d.stack):l,parent:{name:s,stack:c,parent:t}}))})},Qo=(e,...t)=>Jo(e.length,t.length===0?function(){return $o(()=>e.apply(this,arguments))}:function(){let n=$o(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),$o=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return x(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return Mo(()=>n?(n=!1,bs(r.value,e=>es(t,e))):Mo(()=>es(e())))}}}catch(e){return Io(e)}},es=function(){let e=Zt({op:`Iterator`,[Tt](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return x(r.value);if(!xs(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[wt](e){return this[Tt](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),ts=i(2,(e,t)=>new is(e,as,x(t))),ns=function(e){return e._stack.push(this),this[y]},rs=Zt({op:`OnSuccess`,[wt]:ns}),is=function(e,t,n){this[y]=e,this[Tt]=t,this.payload=n};is.prototype=rs;var as=function(){return this.payload},os=function(e,t){return t.succeedWith(this.payload)},ss=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),cs=function(e,t){let n=this.payload;return t.succeedWith(ss?n(e):_t(()=>n(e)))},ls=function(e){let t=this.payload;return t(e)},us=function(e){let t=this.payload;return new is(t(e),os,e)},ds=function(e){return new is(this.payload,os,e)},fs=e=>ws(e,rr),ps=i(2,(e,t)=>new is(e,jt(t)?as:ls,t)),ms=i(2,(e,t)=>new is(e,jt(t)?ds:us,t)),hs=e=>new is(e,as,As),gs=(e,t)=>sn(n=>{let r=new Set;return Hc(n,()=>r.size===0?void 0:ko(r)),Wo(i=>{let a=pi(e),o=a.length,s=0,c=!1,l=[],u=(e,r,a)=>{if(s++,e._tag===`Failure`){l.push(...e.cause.reasons),s>=o&&i(S(Vt(l)));return}let u=!c;c=!0,i(e),u&&t?.onWinner&&t.onWinner({fiber:r,index:a,parentFiber:n})};for(let e=0;e<o;e++){let t=hl(n,a[e],!0,!0,!1);if(r.add(t),t.addObserver(n=>{r.delete(t),u(n,t,e)}),c)break}})}),_s=(e,t)=>sn(n=>{let r=new Set;return Hc(n,()=>r.size===0?void 0:ko(r)),Wo(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=hl(n,s,!0,!0,!1);r.add(c),c.addObserver(o=>{r.delete(c);let s=!a;a=!0,i(o),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}})}),vs=i(e=>jt(e[1]),(e,t,n)=>gs([e,t],n)),ys=i(e=>jt(e[1]),(e,t,n)=>_s([e,t],n)),bs=i(2,(e,t)=>new is(e,ls,t)),xs=e=>e[xt]!==void 0,Ss=i(2,(e,t)=>xs(e)?e._tag===`Success`?t(e.value):e:bs(e,t)),Cs=e=>bs(e,a),ws=i(2,(e,t)=>new is(e,cs,t)),Ts=i(2,(e,t)=>xs(e)?js(e,t):ws(e,t)),Es=e=>rn(Ga(e)),Ds=e=>e._tag===`Success`,Os=e=>e._tag===`Failure`,ks=e=>e._tag===`Failure`?Xr(e.cause):Zr(e),As=en(void 0),js=i(2,(e,t)=>e._tag===`Success`?en(t(e.value)):e),Ms=i(2,(e,t)=>Ds(e)?t:e),Ns=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?As:rn(Vt(t))},Ps=e=>e,Fs=i(2,(e,t)=>sn(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),Hc(n,()=>{n.setContext(r)}),e)})),Is=i(3,(e,t,n)=>Fs(e,e=>{let r=zr(e,t),i=n(r);return r===i?e:Fr(e,t,i)})),Ls=()=>Rs,Rs=sn(e=>x(e.context)),zs=e=>sn(t=>e(t.context)),Bs=i(2,(e,t)=>xs(e)?e:Fs(e,Wr(t))),Vs=function(){return arguments.length===1?i(2,(e,t)=>Hs(e,arguments[0],t)):i(3,(e,t,n)=>Hs(e,t,n)).apply(this,arguments)},Hs=(e,t,n)=>Fs(e,Fr(t,n)),Us=i(e=>jt(e[0]),(e,t,n)=>ml(e,t,n?e=>Ao(n(e)):()=>Ao(new fn))),Ws=i(e=>jt(e[0]),(e,t)=>ol({while:s,body:o(t?.disableYield?e:bs(e,e=>No)),step:u})),Gs=i(2,(e,t)=>new qs(e,t.length===1?t:e=>t(e))),Ks=Zt({op:`OnFailure`,[wt]:ns}),qs=function(e,t){this[y]=e,this[Et]=t};qs.prototype=Ks;var Js=i(3,(e,t,n)=>Gs(e,e=>{let r=t(e);return $r(r)?S(r.failure):n(r.success,e)})),Ys=i(2,(e,t)=>Js(e,qa,e=>t(e))),Xs=i(2,(e,t)=>Gs(e,e=>ps(t(e),S(e)))),Zs=i(3,(e,t,n)=>Gs(e,e=>{let r=t(e);return $r(r)?S(e):ps(n(r.success,e),S(e))})),Qs=i(2,(e,t)=>Zs(e,qa,e=>t(e))),$s=i(e=>jt(e[0]),(e,t,n,r)=>Gs(e,e=>{let i=qa(e);return $r(i)?S(i.failure):t(i.success)?n(i.success):r?r(i.success):S(e)})),ec=i(2,(e,t)=>Ys(e,e=>Lo(()=>t(e)))),tc=e=>Ys(e,Io),nc=i(e=>jt(e[0]),(e,t)=>{if(!t?.log)return uc(e,{onFailure:e=>C,onSuccess:e=>C});let n=mu(t.log===!0?void 0:t.log);return ac(e,{onFailure(e){let r=Ka(e);return $r(r)?S(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>C})}),rc=i(e=>jt(e[0]),(e,t)=>{if(!t?.log)return ac(e,{onFailure:e=>C,onSuccess:e=>C});let n=mu(t.log===!0?void 0:t.log);return ac(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>C})}),ic=e=>fc(e,{onFailure:Zr,onSuccess:Xr}),ac=i(2,(e,t)=>new sc(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),oc=Zt({op:`OnSuccessAndFailure`,[wt]:ns}),sc=function(e,t,n){this[y]=e,this[Tt]=t,this[Et]=n};sc.prototype=oc;var cc=function(e,t){let n=this.payload;return t.succeedWith(ss?n.onSuccess(e):_t(()=>n.onSuccess(e)))},lc=((e,t)=>{let n=Zt({op:e,[wt]:ns,[Tt]:cc,[Et]:t}),r=function(e,t){this[y]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(qt);if(n===void 0)return S(e);let r=this.payload;return t.succeedWith(ss?r.onFailure(n.error):_t(()=>r.onFailure(n.error)))}),uc=i(2,(e,t)=>ac(e,{onFailure:e=>{let n=e.reasons.find(qt);return n?t.onFailure(n.error):S(e)},onSuccess:t.onSuccess})),dc=i(2,(e,t)=>new lc(e,t)),fc=i(2,(e,t)=>{if(xs(e)){if(e._tag===`Success`)return en(t.onSuccess(e.value));let n=qa(e.cause);return $r(n)?e:en(t.onFailure(n.success))}return dc(e,t)}),pc=e=>xs(e)?en(e):mc(e),mc=Qt({op:`Exit`,[wt](e){return e._stack.push(this),this[y]},[Tt](e,t,n){return t.succeedWith(n??en(e))},[Et](e,t,n){return t.succeedWith(n??rn(e))}}),hc=i(2,(e,t)=>ps(Ql(t),e)),gc=i(2,(e,t)=>bs(_c(e,t.duration),e=>ir(e)?t.orElse():x(e.value))),_c=i(2,(e,t)=>ys(fs(e),ts(Ql(t),nr()))),vc=`~effect/Scope`,yc=`~effect/Scope/Closeable`,bc=mr(`effect/Scope`),xc=(e,t)=>sn(n=>{let r=Sc(e,t);return r===void 0?C:(nl(n),r)}),Sc=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&Ac(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return Cc(n.finalizer,t);let r=n.finalizers;return r.size===1?Cc(r.values().next().value,t):Tc(e,r,t)},Cc=(e,t)=>{try{return e(t)}catch(e){return on(e)}},wc=(e,t)=>Ds(e)?t:Gs(t,t=>S($a(e.cause,t))),Tc=qo(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=_o();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*pc(Cc(s,n))):i.push(hl(o,Cc(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*To(i)),yield*Ns(r)}),Ec=(e,t)=>{let n=Mc(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(kc(e,n,e=>xc(n,e)),n)},Dc=(e,t)=>Mo(()=>e.state._tag===`Closed`?t(e.state.exit):(kc(e,{},t),C)),Oc=(e,t)=>Dc(e,o(t)),kc=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0?r.finalizers.set(t,n):(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n))}},Ac=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=Nc:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=Nc))},jc=e=>Mc(e,void 0),Mc=(e=`sequential`,t)=>({[yc]:yc,[vc]:vc,strategy:e,parent:t,state:Nc}),Nc={_tag:`Empty`},Pc=bc,Fc=Vs(bc),Ic=e=>sn(t=>{let n=t.context,r=jc();return t.setContext(Fr(t.context,bc,r)),Hc(t,e=>(t.setContext(n),Sc(r,e))),e}),Lc=e=>Mo(()=>{let t=jc();return Uc(e(t),e=>Mo(()=>Sc(t,e)??C))}),Rc=(e,t,n)=>zs(r=>il(i=>bs(Pc,a=>ms(n?.interruptible?i(e):e,e=>Dc(a,n=>Bs(t(e,n),r)))))),zc=e=>bs(Pc,t=>zs(n=>Dc(t,t=>Bs(e(t),n)))),Bc=function(){let e=Zt({op:`OnExit`,[wt](e){return e._stack.push(this),this.effect},[Dt](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push($c),e.interruptible=!1)},[Tt](e,t,n){n??=en(e);let r;try{r=this.onExit(n)}catch(e){r=on(e)}return r?bs(r,e=>n):n},[Et](e,t,n){n??=rn(e);let r;try{r=this.onExit(n)}catch(e){r=on(e)}return r?bs(wc(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Vc=(e,t,n)=>new Bc(e,t,n),Hc=(e,t)=>{e._stack.push(new Bc(void 0,t,void 0))},Uc=i(2,Vc),Wc=i(2,(e,t)=>Uc(e,e=>t)),Gc=i(3,(e,t,n)=>Uc(e,e=>{let r=t(e);return $r(r)?C:n(r.success,e)})),Kc=i(2,(e,t)=>Gc(e,ks,t)),qc=i(3,(e,t,n)=>Uc(e,e=>{if(e._tag!==`Failure`)return C;let r=t(e.cause);return $r(r)?C:n(r.success,e.cause)})),Jc=i(2,(e,t)=>qc(Xa,t)(e)),Yc=e=>jo(()=>{let t=Nl(!1),n=!1,r,i=bs(t.await,()=>r);return sn(a=>r===void 0?n?i:(n=!0,Hc(a,e=>jo(()=>{r=e,t.openUnsafe()})),e):r)}),Xc=sn(e=>S(Ga(e.id))),Zc=e=>sn(t=>t.interruptible?(t.interruptible=!1,t._stack.push($c),e):e),Qc=Qt({op:`SetInterruptible`,[Dt](e){if(e.interruptible=this[y],e._interruptedCause&&e.interruptible)return()=>S(e._interruptedCause)}}),$c=Qc(!0),el=Qc(!1),tl=e=>{if(e.interruptible=!0,e._stack.push(el),e._interruptedCause)return S(e._interruptedCause)},nl=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push($c))},rl=e=>sn(t=>t.interruptible?e:tl(t)??e),il=e=>sn(t=>t.interruptible?(t.interruptible=!1,t._stack.push($c),e(rl)):e(a)),al=(e,t)=>fe(e)?t?.mode===`result`?sl(e,ic,t):sl(e,a,t):t?.discard?t.mode===`result`?sl(Object.values(e),ic,t):sl(Object.values(e),a,t):Mo(()=>{let n={};return ts(sl(Object.entries(e),([e,r])=>ws(t?.mode===`result`?ic(r):r,t=>{vt(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),ol=Qt({op:`While`,[Tt](e,t){return this[y].step(e),this[y].while()?(t._stack.push(this),this[y].body()):As},[wt](e){return this[y].while()?(e._stack.push(this),this[y].body()):As}}),sl=i(e=>typeof e[1]==`function`,(e,t,n)=>Mo(()=>{let r=ll(n?.concurrency);if(r===1)return cl(e,t,n);let i=pi(e),a=i.length;if(a===0)return n?.discard?C:x([]);let o=n?.discard?void 0:Array(a),s=pl({f:t,out:o},i,{concurrency:r});return s?ts(s,o):x(o)})),cl=(e,t,n)=>Mo(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return ts(ol({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),ll=e=>e===`unbounded`?1/0:Math.max(1,e??1),ul=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>bs(pc(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??C),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!xs(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},dl=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,p,m=e=>{let t=on(e);return f=t,c=!0,u&&u.size>0?bs(Zc(ko(Array.from(u))),()=>f??t):t},h=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],g=p??t(e,o,a);if(xs(g)){if(f=n(e,o,g,a),f)break}else if(l){p=void 0;let t=hl(l,g,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=Vt(e);f=rn(f._tag===`Failure`?$a(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(f??C)}catch(e){d(m(e))}}),u.size<s)continue;i=!0,a++;return}else return Wo(e=>{l=_o(),u=new Set,p=g,d=e;let t;try{t=h()}catch(t){return e(m(t))}return t?e(t):Mo(()=>(f??=As,bs(u?ko(u):C,()=>f?._tag===`Failure`?f:C)))})}if(c=!0,f){if(u&&u.size>0){let e=Co(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(C);else return As}};return h()}},fl=()=>e=>dl(e),pl=dl({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),ml=i(3,(e,t,n)=>bs(e,e=>t(e)?x(e):n(e))),hl=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new vo(a.context,o);return n?s.evaluate(t):a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0),!r&&!s._exit&&(a.children().add(s),s._parent=a),s},gl=i(e=>jt(e[0]),(e,t,n)=>sn(r=>{let i=hl(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};kc(t,e,()=>Vo(e=>e===i.id?C:Do(i))),i.addObserver(()=>Ac(t,e))}else i.interruptUnsafe(r.id,Co(r))}return x(i)})),_l=e=>(t,n)=>{let r=new vo(n?.scheduler?Fr(e,sa,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},vl=i(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return kc(t,n,()=>Do(e)),e.addObserver(()=>Ac(t,n)),e}),yl=_l(Mr()),bl=e=>{let t=_l(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},xl=bl(Mr()),Sl=e=>{let t=_l(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Cl=Sl(Mr()),wl=e=>{let t=Sl(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw to(e.cause);return e.value})},Tl=wl(Mr()),El=e=>{let t=_l(e);return e=>{if(xs(e))return e;let n=new fa(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??on(new ru(r))}},Dl=El(Mr()),Ol=e=>{let t=El(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw to(n.cause);return n.value}},kl=Ol(Mr()),Al=x(!0),jl=x(!1),Ml=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return Al;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],Al}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](As)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](As)}open=sn(e=>this._isOpen?jl:(this._isOpen=!0,this.scheduleUnsafe(e)));release=sn(e=>this._isOpen?jl:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=Wo(e=>this._isOpen?e(C):(this.waiters.push(e),jo(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=jo(()=>this.closeUnsafe());whenOpen=e=>bs(this.await,()=>e);isOpen(){return this._isOpen}},Nl=e=>new Ml(e??!1),Pl=BigInt(0),Fl={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Pl,endTime:Pl,exit:As},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Il=e=>Object.assign(Object.create(Fl),e),Ll=e=>e?Br(e.annotations,Ta)?e._tag===`Span`?Ll(ur(e.parent)):nr():rr(e):nr(),Rl=(e,t,n)=>{let r=!e.cache.tracerEnabled||n?.annotations&&Br(n.annotations,Ta),i=n?.parent===void 0?n?.root?nr():Ll(e.cache.span):rr(n.parent),a;if(r)a=Il({name:t,parent:i,annotations:Fr(n?.annotations??Mr(),Ta,!0)});else{let r=e.cache.tracer??ka,o=e.getRef(Gl),s=e.getRef(Pa),c=e.getRef(Fa),l=e.getRef(Ia),u=n?.level??e.getRef(Ea),d=n?.links===void 0?l.length===0?[]:l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??Mr(),links:d,startTime:s?o.currentTimeNanosUnsafe():Pl,kind:n?.kind??`internal`,root:n?.root??ir(i),sampled:n?.sampled??(ar(i)&&i.value.sampled===!1?!1:!su(e.getRef(Da),u))});for(let e in c)a.attribute(e,c[e]);if(n?.attributes!==void 0)for(let e in n.attributes)a.attribute(e,n.attributes[e])}return a},zl=(e,t)=>(t=typeof t==`function`?t:l,Is(Ma,n=>({name:e,stack:t,parent:n}))),Bl=(e,t,n,r)=>jo(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Pl,t)}),Vl=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return sn(t=>{let i=Rl(t,e,n),a=t.getRef(Gl),o=t.getRef(Pa);return Hc(t,e=>Bl(i,e,a,o)),r(i)})},Hl=Vs(Ca),Ul=function(){let e=jt(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=a;return t._tag===`Span`&&(n=Va(n),r=zl(t.name,n?.captureStackTrace)),e?Hl(r(arguments[0]),t):e=>Hl(r(e),t)},Wl=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=Va(arguments[2]);if(e){let e=arguments[0];return Vl(t,arguments[2],t=>Ul(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>Vl(t,r?r(...a):i,t=>Ul(e,t,n))},Gl=Kr(`effect/Clock`,{defaultValue:()=>new ql}),Kl=2**31-1,ql=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=jo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Xl()}currentTimeNanos=jo(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return Yl()}monotonicTimeNanos=jo(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Xi(e))}sleepMillis(e){return e<=0?No:Number.isFinite(e)?Wo(t=>{let n=e>Kl?this.sleepMillis(e-Kl):C,r=setTimeout(()=>t(n),Math.min(e,Kl));return jo(()=>clearTimeout(r))}):Go}},Jl=BigInt(1e6),Yl=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*Jl;return e>t&&(t=e),t}}(),Xl=function(){let e=BigInt(1e9),t;return()=>{let n=Yl(),r=BigInt(Date.now())*Jl;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}(),Zl=e=>sn(t=>e(t.getRef(Gl))),Ql=e=>Zl(t=>t.sleep(Mi(e))),$l=Zl(e=>e.currentTimeMillis),eu=`~effect/Cause/IllegalArgumentError`,tu=class extends un(`IllegalArgumentError`){[eu]=eu;constructor(e){super({message:e})}},nu=`~effect/Cause/AsyncFiberError`,ru=class extends un(`AsyncFiberError`){[nu]=nu;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},iu=`~effect/Cause/UnknownError`,au=class extends un(`UnknownError`){[iu]=iu;constructor(e,t){super({message:t,cause:e})}},ou=Kr(`effect/Console`,{defaultValue:()=>globalThis.console}),su=Qn(Xn(Yn,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),cu=Kr(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([_u,vu])}),lu=Kr(`effect/Logger/LogToStderr`,{defaultValue:c}),uu={"~effect/Logger":{_Message:a,_Output:a},pipe(){return t(this,arguments)}},du=e=>{let t=Object.create(uu);return t.log=e,t},fu=e=>e.replace(/[\s="]/g,`_`),pu=(e,t)=>`${fu(e[0])}=${t-e[1]}ms`,mu=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Ft(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Vt(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=Ht),sn(r=>{let i=e??r.cache.logLevel;if(su(r.cache.minimumLogLevel,i))return C;let a=r.getRef(Gl),o=r.getRef(cu);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return C})},hu={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};hu.gray,hu.blue,hu.green,hu.yellow,hu.red,hu.bgBrightRed,hu.black;var gu=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,_u=du(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(uo(e));let o=t.getTime(),s=n.getRef(Ba),c=``;for(let e of s)c+=` ${pu(e,o)}`;let l=n.getRef(La);Object.keys(l).length>0&&a.push(l);let u=n.getRef(ou);(n.getRef(lu)?u.error:u.log)(`[${gu(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),vu=du(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(Gl),a=t.getRef(La),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))vt(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=uo(e)),o.event(ut(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)}),yu=x(void 0),bu=qt,xu=Vt,Su=Gt,Cu=Za,wu=eo,Tu=to,Eu=qa,Du=Ja,Ou=Ya,ku=Xa,Au=mn,ju=vn,Mu=tu,Nu=en,Pu=rn,Fu=an,Iu=As,Lu=Ds,Ru=Os,zu={"~effect/Deferred":{_A:a,_E:a},pipe(){return t(this,arguments)}},Bu=function(){this.resumes=void 0,this.effect=void 0};Bu.prototype=zu;var Vu=()=>new Bu,Hu=e=>Wo(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),jo(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),Uu=i(2,(e,t)=>jo(()=>Wu(e,t))),Wu=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let e=0;e<n.length;e++)n[e](t)}return!0},Gu=i(2,(e,t)=>il(n=>bs(pc(n(e)),e=>Uu(t,e)))),Ku=jc,qu=Fc,Ju=Dc,Yu=Oc,Xu=Ec,Zu=xc,Qu=`~effect/Layer`,$u=`~effect/Layer/MemoMap`,ed=(e,t)=>{let n={observers:0,deferred:Vu(),scope:Ku(),finalizer:r=>Mo(()=>--n.observers>0?C:(e.map.delete(t),Zu(n.scope,r)))};return n},td=(e,t)=>t.state._tag!==`Closed`&&(e.observers++,kc(t,{},e.finalizer),!0),nd={[Qu]:{_ROut:a,_E:a,_RIn:a},pipe(){return t(this,arguments)}},rd=e=>{let t=Object.create(nd);return t.build=e,t},id=e=>rd((t,n)=>{let r=Xu(n);return Uc(e(t,r),e=>e._tag===`Failure`?Zu(r,e):C)}),ad=e=>{let t=id((n,r)=>n.getOrElseMemoize(t,r,e));return t},od=class{get[$u](){return $u}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?(td(n,t),n.deferred.effect??Hu(n.deferred)):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return Mo(()=>{let r;return Vc(Mo(()=>{let i=this.get(e,t);if(i)return i;let a=ed(this,e);return td(a,t)?(r=a.deferred,this.map.set(e,a),n(this,a.scope)):n(this,t)}),e=>{r&&Wu(r,e)})})}},sd=()=>new od,cd=e=>new od(e),ld=class e extends mr()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=Lr(t,e);return n?cd(n):sd()}},ud=i(3,(e,t,n)=>Vs(ws(e.build(t,n),Fr(ld,t)),ld,t)),dd=i(2,(e,t)=>sn(n=>ud(e,ld.forkOrCreate(n.context),t))),fd=function(){return arguments.length===1?e=>pd(Pr(arguments[0],e)):pd(Pr(arguments[0],arguments[1]))},pd=e=>rd(o(x(e))),md=pd(Mr()),hd=function(){return arguments.length===1?e=>gd(()=>Pr(arguments[0],e())):gd(()=>Pr(arguments[0],arguments[1]()))},gd=e=>ad(o(jo(e))),_d=function(){return arguments.length===1?e=>vd(arguments[0],e):vd(arguments[0],arguments[1])},vd=(e,t)=>yd(ws(t,t=>Pr(e,t))),yd=e=>ad((t,n)=>qu(e,n)),bd=(e,t,n)=>{let r=Xu(n,`parallel`);return sl(e,e=>e.build(t,Xu(r,`sequential`)),{concurrency:e.length}).pipe(ws(e=>Gr(...e)))},xd=(...e)=>id((t,n)=>bd(e,t,n)),Sd=(e,t,n)=>id((r,i)=>bs(Array.isArray(t)?bd(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(Bs(t),ws(e=>n(e,t))))),Cd=i(2,(e,t)=>Sd(e,t,a)),wd=Gl,Td=$l,Ed=`~effect/DateTime`,Dd=`~effect/DateTime/TimeZone`,Od={[Ed]:Ed,pipe(){return t(this,arguments)},[ct](){return this.toString()},toJSON(){return Rd(this).toJSON()}},kd={...Od,_tag:`Utc`,[pe](){return ye(this.epochMilliseconds)},[je](e){return jd(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Rd(this).toJSON()})`}};({...Od});var Ad={[Dd]:Dd,[ct](){return this.toString()}};({...Ad}),{...Ad};var jd=e=>de(e,Ed),Md=e=>{let t=Object.create(kd);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Nd=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Mu(`Invalid date`);return Md(t)},Pd=e=>{if(jd(e))return e;if(e instanceof Date)return Nd(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return Nd(new Date(e.epochMilliseconds));let t=new Date(0);return Bd(t,e),Nd(t)}return typeof e==`string`&&!Fd(e)?Nd(new Date(e+`Z`)):Nd(new Date(e))},Fd=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Id=dr(Pd),Ld=ws(Td,Md),Rd=e=>new Date(e.epochMilliseconds),zd=e=>e.epochMilliseconds,Bd=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month===void 0?e.getUTCMonth():t.month-1,t.day??e.getUTCDate()),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},Vd=e=>Rd(e).toISOString();globalThis.String;var Hd=e=>e.trim(),Ud=Kr(`effect/Random`,{defaultValue:()=>({nextIntUnsafe(){return Math.floor(Math.random()*(2**53-1- -(2**53-1)+1))+-(2**53-1)},nextDoubleUnsafe(){return Math.random()}})}),Wd=i(2,(e,t)=>Js(e,Jd,e=>t(e))),Gd=e=>e.reasons.some(Kd),Kd=e=>e._tag===`Fail`&&Au(e.error),qd=e=>{let t,n=!1;for(let r of e.reasons)Kd(r)?t??=r.error:r._tag!==`Interrupt`&&(n=!0);return t===void 0?Zr(e):n?Zr(xu(e.reasons.filter(e=>!Kd(e)))):Xr(t)},Jd=e=>{let t=qd(e);return $r(t)?t:Xr(t.success.value)},Yd=e=>{let t=qd(e);return $r(t)?Pu(t.failure):Nu(t.success.value)},Xd=i(2,(e,t)=>ac(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=qd(e);return $r(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Zd=`~effect/Schedule`,Qd=Kr(`effect/Schedule/CurrentMetadata`,{defaultValue:o({input:void 0,output:void 0,duration:Bi,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),$d={[Zd]:{_Out:a,_In:a,_Env:a},pipe(){return t(this,arguments)}},ef=e=>de(e,Zd),tf=e=>{let t=Object.create($d);return t.step=e,t},nf=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},rf=e=>tf(ws(e,e=>{let t=nf();return(n,r)=>e(t(n,r))})),af=e=>Gs(e.step,e=>x(()=>S(e))),of=e=>Zl(t=>ws(af(e),e=>{let n=nf();return r=>Mo(()=>{let i=t.currentTimeMillisUnsafe();return bs(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,ts(Ql(t),a)})})})),sf=e=>ws(of(e),e=>t=>ws(e(t),e=>e.output)),cf=e=>tf(ws(al(e.map(af)),e=>(t,n)=>bs(sl(e,e=>Xd(e(t,n),{onSuccess:e=>x(e[1]),onDone:()=>yu,onFailure:S})),e=>{let t=lf(e);return t===void 0?ju(Bi):x([t,t])}))),lf=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:na(t,r))}return t},uf=(e,t=2)=>{let n=Xi(Mi(e));return rf(x(e=>{let r=Wi(n*t**(e.attempt-1));return x([r,r])}))},df=e=>tf(ws(af(e),e=>(t,n)=>Xd(e(t,n),{onSuccess:e=>x([n,e[1]]),onFailure:S,onDone:()=>ju(n)}))),ff=e=>{let t=Mi(e);return rf(x(e=>x([e.attempt-1,t])))},pf=i(2,(e,t)=>tf(ws(af(e),e=>{let n=nf();return(r,i)=>bs(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return bs(jt(s)?s:x(s),t=>t?x(e):ju(a))})}))),mf=ff(Bi),hf=(e,t,n)=>Lc(r=>bs(n?.local?ud(t,sd(),r):dd(t,r),t=>Bs(e,t))),gf=i(e=>jt(e[0]),(e,t,n)=>Ar(t)?Bs(e,t):hf(e,Array.isArray(t)?xd(...t):t,n)),_f=i(3,(e,t,n)=>bs(of(t),t=>{let r=Qd.defaultValue();return Ys(Ws(ms(bs(Mo(()=>Vs(e,Qd,r)),t),e=>jo(()=>{r=e})),{disableYield:!0}),e=>mn(e)?x(e.value):n(e,r.attempt===0?nr():rr(r)))})),vf=i(3,(e,t,n)=>bs(of(t),t=>{let r=Qd.defaultValue(),i,a=Ys(Mo(()=>Vs(e,Qd,r)),e=>(i=e,bs(t(e),e=>(r=e,a))));return Wd(a,e=>_t(()=>n(i,e)))})),yf=i(2,(e,t)=>_f(e,typeof t==`function`?t(a):ef(t)?t:Sf(t),Ao)),bf=i(2,(e,t)=>vf(e,typeof t==`function`?t(a):ef(t)?t:Sf(t),Ao)),xf=df(mf),Sf=e=>{let t=e.schedule?df(e.schedule):xf;return e.while&&(t=pf(t,({input:t})=>{let n=e.while(t);return jt(n)?n:x(n)})),e.until&&(t=pf(t,({input:t})=>{let n=e.until(t);return jt(n)?ws(n,e=>!e):x(!n)})),e.times!==void 0&&(t=pf(t,({attempt:t})=>x(t<=e.times))),t},Cf=jt,wf=al,Tf=sl,Ef=ol,Df=zo,Of=Bo,w=x,kf=Mo,T=jo,Af=C,jf=Go,Mf=Ko,E=Ao,Nf=S,Pf=Fo,Ff=Io,If=Ro,Lf=sn,D=bs,Rf=Cs,zf=ps,Bf=ms,Vf=pc,O=ws,Hf=ts,Uf=hs,Wf=Ys,Gf=Gs,Kf=$s,qf=ec,Jf=tc,Yf=Qs,Xf=Xs,Zf=bf,Qf=nc,$f=rc,ep=gc,tp=hc,np=Ql,rp=vs,ip=ys,ap=Us,op=dc,sp=ac,cp=uc,lp=Ls,up=zs,dp=gf,fp=Bs,pp=Ps,mp=Fs,hp=Vs,gp=Ic,_p=Rc,vp=zc,yp=Wc,bp=Kc,xp=Uc,Sp=Yc,Cp=Xc,wp=Jc,Tp=il,Ep=Ws,Dp=yf,Op=Vl,kp=Wl,Ap=Ul,jp=gl,Mp=yl,Np=_l,Pp=bl,Fp=xl,Ip=Tl,Lp=wl,Rp=Cl,zp=Sl,Bp=kl,Vp=Ol,Hp=Dl,Up=El,Wp=qo,Gp=Xo,Kp=mu(`Error`),qp=Ts,Jp=Ss,Yp=Qo,Xp=Ud,Zp=`~effect/BigDecimal`,Qp={[Zp]:Zp,[pe](){let e=om(this);return ge(be(String(e.value)),ye(e.scale))},[je](e){return $p(e)&&tee(this,e)===0},toString(){return`BigDecimal(${nee(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[ct](){return this.toJSON()},pipe(){return t(this,arguments)}},$p=e=>de(e,Zp),em=(e,t)=>{if(!Number.isSafeInteger(t))throw RangeError(`Scale must be a safe integer, got ${t}`);let n=Object.create(Qp);return n.value=e,n.scale=t,n},tm=(e,t)=>{let n=em(e,t);return n.normalized=n,n},nm=BigInt(0),rm=BigInt(1),im=BigInt(10),am=tm(nm,0),om=e=>{if(e.normalized===void 0){if(e.value===nm)e.normalized=am;else{let t=`${e.value}`,n=t.length;for(;t[n-1]===`0`;)n--;e.normalized=tm(BigInt(t.slice(0,n)),e.scale-(t.length-n))}}return e.normalized},sm=100,eee=[rm],cm=(e,t)=>e===t?0:e<t?-1:1,lm=(e,t)=>{let n=`${e.value<nm?-e.value:e.value}`,r=`${t.value<nm?-t.value:t.value}`,i=BigInt(n.length-r.length)-BigInt(e.scale)+BigInt(t.scale);if(i!==nm)return i<nm?-1:1;let a=Math.max(n.length,r.length);return Jn(n.padEnd(a,`0`),r.padEnd(a,`0`))},tee=(e,t)=>{if(e.scale===t.scale)return cm(e.value,t.value);let n=um(e),r=um(t);if(n!==r)return n<r?-1:1;if(n===0)return 0;let i=e.scale-t.scale,a=Math.abs(i);if(a>sm)return n===-1?lm(t,e):lm(e,t);let o=eee[a]??=im**BigInt(a);return i>0?cm(e.value,t.value*o):cm(e.value*o,t.value)},um=e=>e.value===nm?0:e.value<nm?-1:1,nee=e=>{let t=om(e);if(Math.abs(t.scale)>=16)return ree(t);let n=t.value<nm,r=`${n?-t.value:t.value}`,i=t.scale>0?r.padStart(t.scale+1,`0`):r.padEnd(r.length-t.scale,`0`),a=i.length-t.scale,o=t.scale>0?`${i.slice(0,a)}.${i.slice(a)}`:i;return n?`-${o}`:o},ree=e=>{if(iee(e))return`0e+0`;let t=om(e),n=`${t.value}`,r=t.value<nm?2:1,i=n.slice(0,r),a=n.slice(r),o=a.length-t.scale;return`${i}${a===``?``:`.${a}`}e${o>=0?`+`:``}${o}`},iee=e=>e.value===nm,dm=Id,aee=Ld,fm=zd,pm=Vd,mm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,hm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)hm[mm.charCodeAt(e)]=e;hm[61]=0;var gm=`~effect/http/Cookies`,_m=`~effect/http/Cookies/Cookie`,oee={[gm]:gm,...dt,toJSON(){return{_id:`effect/Cookies`,cookies:ci(this.cookies,e=>e.toJSON())}},pipe(){return t(this,arguments)}},vm=e=>{let t=Object.create(oee);return t.cookies=e,t},ym=e=>{let t={};for(let n of e)vt(t,n.name,n);return vm(t)},bm=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=xm(e.trim());t&&n.push(t)}return ym(n)};function xm(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``);if(t.length===0)return;let n=t[0].indexOf(`=`);if(n===-1)return;let r=t[0].slice(0,n);if(!Sm.test(r))return;let i=t[0].slice(n+1),a=wm(i);if(t.length===1)return Object.assign(Object.create(Cm),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=Gi(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`}}}return Object.assign(Object.create(Cm),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var Sm=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Cm={[_m]:_m,...dt,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},wm=e=>{try{return decodeURIComponent(e)}catch{return e}},Tm=new WeakMap,Em=`~effect/Redacted`,see=e=>de(e,Em),Dm=(e,t)=>{let n=Object.create(cee);return t?.label&&(n.label=t.label),Tm.set(n,e),n},cee={[Em]:{_A:e=>e},label:void 0,...kt,toJSON(){return this.toString()},toString(){return`<redacted${_(this.label)?`:`+this.label:``}>`},[pe](){return me(Tm.get(this))},[je](e){return see(e)&&Me(Tm.get(this),Tm.get(e))}},Om=Symbol.for(`~effect/http/Headers`),km=Object.defineProperties(Object.create(null),{[Om]:{value:Om},[qe]:{value(e){return fee(this,Br(e,Lm))}},toJSON:{value(){return Ye(this)}},[je]:{value(e){return jm(this,e)}},[pe]:{value(){return Se(this)}},toString:{value:dt.toString},[ct]:{value:dt[ct]}}),Am=e=>Object.assign(Object.create(km),e),jm=di(Sn()),Mm=Object.create(km),Nm=e=>{if(e===void 0)return Mm;if(Symbol.iterator in e){let t=Object.create(km);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(km);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},lee=e=>Object.setPrototypeOf(e,km),Pm=i(3,(e,t,n)=>{let r=Am(e);return r[t.toLowerCase()]=n,r}),uee=i(2,(e,t)=>Am({...e,...Nm(t)})),dee=i(2,(e,t)=>{let n=Am(e);return Object.assign(n,t),n}),Fm=i(2,(e,t)=>{let n=Am(e);return delete n[t.toLowerCase()],n}),fee=i(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=Dm(e[r]))}else for(let r in e)r.search(t)!==-1&&(n[r]=Dm(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),Im=(e,t)=>{for(let n=0;n<t.length;n++){let r=t[n];if(typeof r==`string`){if(r.toLowerCase()===e.toLowerCase())return!0}else if(e.search(r)!==-1)return!0}return!1},Lm=Kr(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Rm=`~effect/http/UrlParams`,zm=e=>de(e,Rm),Bm={...kt,[Rm]:Rm,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[je](e){return pee(this,e)},[pe](){return we(this.params.flat())}},Vm=e=>{let t=Object.create(Bm);return t.params=e,t},Hm=e=>{if(zm(e))return e;let t=Um(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return Vm(n)},Um=e=>{let t=typeof e[Symbol.iterator]==`function`?pi(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`&&r){let t=Um(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},pee=bn((e,t)=>mee(e.params,t.params)),mee=xi(ri([Sn(),Sn()])),hee=Vm([]),Wm=i(2,(e,t)=>{let n=Hm(t).params.slice(),r=new Set;for(let e=0;e<n.length;e++)r.add(n[e][0]);for(let t=0;t<e.params.length;t++)r.has(e.params[t][0])||n.push(e.params[t]);return Vm(n)});function Gm(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Km(e){return t=>Gm(t)?.[e]}var qm=`~structural`,Jm=`~identifier`,Ym=`~sentinels`,Xm=`~constructor`,Zm=[`title`,`description`,`default`,`examples`,`readOnly`,`writeOnly`,`format`,`contentEncoding`,`contentMediaType`,`contentSchema`],Qm=Km(`identifier`),$m=Km(Jm),eh=d(e=>{let t=Gm(e)?.identifier;return typeof t==`string`?t:e.getExpected(eh)}),th=new Set([Ym,qm,`representation`,`arbitraryConstraint`,`toJsonSchema`,`toCode`,`toEquivalence`,`toFormatter`,`toCodec`,`toCodecJson`,`toCodecStringTree`,`toCodecIso`,`toCodecArbitrary`]),nh=Symbol(),rh=Nu,ih=rh(nh),ah=rh(nh),oh=e=>e===nh?nr():rr(e),sh=e=>e._tag===`None`?ih:rh(e.value),ch=`~effect/SchemaIssue/Issue`;function lh(e){return de(e,ch)&&e[ch]===ch}function uh(e){return Object.hasOwn(e,`input`)}var dh=class{[ch]=ch;constructor(e,t){t?.reportInput===!0&&e!==nh&&(this.input=e)}},gee=class extends dh{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},_ee=class extends dh{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},fh=class extends dh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ph=class extends dh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},mh=class extends dh{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},hh=class extends dh{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},gh=class extends dh{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},_h=class extends dh{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},vh=class extends dh{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},vee=class extends dh{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function yh(e,t,n){if(lh(e))return e;if(typeof e==`string`)return new _h({message:e},t,n);let r=typeof e.issue==`string`?new _h({message:e.issue},t,n):e.issue;return new fh(e.path,r)}function yee(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new _h(void 0,t,n):yh(e,t,n)}function bee(e,t,n,r){return Array.isArray(t)?gi(t)?t.length===1?yh(t[0],n,r):new hh(e,bi(t,e=>yh(e,n,r)),n,r):void 0:yee(t,n,r)}var bh=e=>{let t=Oh(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return wh(eh(e.ast),e);case`InvalidValue`:{let t=Ch(e);if(t!==void 0)return wh(t,e);let n=Sh(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=Sh(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=Sh(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},xh=e=>Oh(e.issue)??Oh(e);function xee(e){return t=>({issues:Th(t,[],e?.leafHook??bh,e?.checkHook??xh)})}function Sh(e){return uh(e)?et(e.input):void 0}function Ch(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function wh(e,t){let n=Sh(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Th(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];if(e.issue._tag!==`InvalidValue`)return Th(e.issue,t,n,r);let a=Ch(e.issue);return[{path:t,message:a===void 0?wh(Eh(e.filter),e):wh(a,e.issue)}]}case`Encoding`:return Th(e.issue,t,n,r);case`Pointer`:return Th(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Th(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Oh(e)??wh(eh(e.ast),e)}]:e.issues.flatMap(e=>Th(e,t,n,r));default:return[{path:t,message:n(e)}]}}function Eh(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Eh(e)).join(` & `)}}function See(){return e=>Dh(e,``)}var Cee=See();function Dh(e,t){let n;switch(e._tag){case`Filter`:{let r=xh(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Dh(e.issue,t);let r=Ch(e.issue);n=r===void 0?wh(Eh(e.filter),e):wh(r,e.issue)}break}case`Encoding`:return Dh(e.issue,t);case`Pointer`:return Dh(e.issue,t+rt(e.path));case`Composite`:case`AnyOf`:if(e._tag===`Composite`||e.issues.length>0)return e.issues.map(e=>Dh(e,t)).join(`
|
|
14
|
+
`);n=Oh(e)??wh(eh(e.ast),e);break;default:n=bh(e)}return t?`${n}\n at ${t}`:n}function Oh(e){if(e._tag===`Pointer`)return;if(e._tag===`Encoding`)return Oh(e.issue);let t=(e._tag===`Filter`?e.filter.annotations:`annotations`in e?e.annotations:e.ast.annotations)?.[e._tag===`MissingKey`?`messageMissingKey`:e._tag===`UnexpectedKey`?`messageUnexpectedKey`:`message`];if(typeof t==`string`)return t}function kh(e){let t;for(let n of e.reasons){if(!bu(n)||!lh(n.error))return;t??=n.error}return t}function Ah(e,t){let n=kh(e);if(n===void 0)throw Error(t,{cause:e});return n}var jh=e=>Object.assign(Object.create(n),e),Mh=jh({_tag:`Passthrough`});function Nh(){return Mh}function Ph(e){return jh({_tag:`Transform`,transform:e})}function Fh(e){return jh({_tag:`TransformEffect`,transform:e})}function Ih(){return Ph(globalThis.String)}function Lh(){return Ph(globalThis.Number)}function Rh(){return Ph(Hd)}function zh(e){return Fh((t,n)=>If({try:()=>JSON.parse(t,e?.reviver),catch:()=>new _h({expected:`a valid JSON string`},t,n)}))}function Bh(e){return Fh((t,n)=>If({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return n},catch:()=>new _h({expected:`a JSON-serializable value`},t,n)}))}var Vh=class extends r{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Vh(this.encode,this.decode)}},Hh=`~effect/SchemaTransformation/Transformation`,Uh=class extends r{[Hh]=Hh;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Uh(this.encode,this.decode)}};function Wh(e){return de(e,Hh)&&e[Hh]===Hh}var wee=e=>Wh(e)?e:new Uh(e.decode,e.encode);function Tee(e){return new Uh(Ph(e.decode),Ph(e.encode))}function Eee(){return new Uh(Rh(),Nh())}var Dee=new Uh(Nh(),Nh());function Gh(){return Dee}var Kh=new Uh(Lh(),Ih());function Oee(e){return new Uh(zh(e??{}),Bh(e))}function qh(e){return t=>t._tag===e}var Jh=qh(`Declaration`),kee=qh(`Never`),Yh=qh(`Literal`),Xh=qh(`UniqueSymbol`),Aee=qh(`Arrays`),jee=qh(`Objects`),Zh=qh(`Suspend`),Qh=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},$h={},eg=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}},tg=`~effect/Schema`,ng=class{[tg]=tg;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},rg=class extends ng{_tag=`Declaration`;typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,i,a,o,s){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o,this.encodingRun=s}getParser(){let e;return(t,n)=>t===nh?ih:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=l_(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new rg(a,r,this.annotations,t,void 0,this.context,n,i)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},ig=new class extends ng{_tag=`Null`;getParser(){return T_(this,null)}getExpected(){return`null`}},Mee=class extends ng{_tag=`Undefined`;getParser(){return T_(this,void 0)}toCodecJson(){return $g(this,[Nee])}getExpected(){return`undefined`}},Nee=new Qh(ig,new Uh(Ph(()=>void 0),Ph(()=>null))),ag=new Mee,Pee=new class extends ng{_tag=`Never`;getParser(){return E_(this,se)}getExpected(){return`never`}},og=new class extends ng{_tag=`Unknown`;getParser(){return E_(this,ce)}getExpected(){return`unknown`}},sg=class extends ng{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${et(e)}`);this.literal=e}getParser(){return T_(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?cg(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:cg(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function cg(e){let t=globalThis.String(e.literal);return $g(e,[new Qh(new sg(t),new Uh(Ph(()=>e.literal),Ph(()=>t)))])}var lg=new class extends ng{_tag=`String`;getParser(){return E_(this,_)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&j_(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Fee=class extends ng{_tag=`Number`;getParser(){return E_(this,te)}matchKey(e,t){return this._match(Zee,e,t)}matchPart(e,t){return this._match(k_,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:j_(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(ug(this.checks,`effect/schema/isFinite`)||ug(this.checks,`effect/schema/isInt`))?this:$g(this,[Jg])}toCodecStringTree(){return this.toCodecJson()===this?$g(this,[$ee]):$g(this,[ete])}getExpected(){return`number`}};function ug(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&ug(e.checks,t))}var dg=new Fee,Iee=new class extends ng{_tag=`Boolean`;getParser(){return E_(this,ne)}getExpected(){return`boolean`}},fg=class extends ng{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=!1;for(let e=0;e<t.length;e++)if(g_(t[e]))c=!0;else if(c)throw Error(`A required element cannot follow an optional element. ts(1257)`);if(c&&n.length>1)throw Error(`A required element cannot follow an optional element. ts(1257)`);for(let e=1;e<n.length;e++)if(g_(n[e]))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e,t=e){let n=this,r,i,a=n.elements.length,o=Math.max(0,n.rest.length-1);function s(e,t){return t<a?r[t]:t>=e?i[t-e+1]:i[0]}let c=e=>{let{input:t,len:r,options:i}=e;if(n.rest.length===0&&r>a)for(let o=a;o<r;o++){let r=new mh(n,t[o],i),a=new fh([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return E(new hh(n,[a],t,i))}return e.issues?E(new hh(n,e.issues,t,i)):rh(e.output)},l=(e,t)=>{let r=e.length,i={ast:n,getParser:s,input:e,len:r,tailThreshold:Math.max(a,r-o),output:new globalThis.Array(r),issues:void 0,options:t},u=n.rest.length===0?a:Math.max(r,a+o),d=t.concurrency===void 0?1:ll(t.concurrency),f=d===1?Ree(i,e,0,u):zee(i,e,{concurrency:d,end:u});if(!f)return c(i);if(xs(f))return Jp(f,()=>c(i));let p=!0;return kf(()=>p?(p=!1,D(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===nh)return ih;try{return Array.isArray(e)?(r||(r=n.elements.map(e=>({ast:e,parser:t(e)})),i=n.rest.map(e=>({ast:e,parser:t(e)}))),l(e,a)):E(new gh(n,e,a))}catch(e){return Ff(e)}}}_rebuild(e,t,n){let r=l_(this.elements,e),i=l_(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new fg(this.isMutable,r,i,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};function Lee(e,t,n,r){if(n._tag===`Failure`)return mg(e,e.ast,r,n);let i=n===ah?t:n[y];if(i!==nh)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(g_(t.ast))return;let n=new fh([r],new ph(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Fu(new hh(e.ast,[n],e.input,e.options))}}var pg={onItem(e,t,n){let r=n<e.len?t:nh;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:Lee},Ree=ul()(pg),zee=fl()(pg),mg=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=kh(r.cause);if(i===void 0)return Pu(wu(r.cause,r=>new hh(t,[new fh([n],r)],e.input,e.options)));let a=new fh([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Fu(new hh(t,[a],e.input,e.options))},hg=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function gg(e,t,n=$h){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(r=>Object.prototype.propertyIsEnumerable.call(e,r)&&t.matchKey(r,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(D_(S_(t)))}var _g=class{name;type;constructor(e,t){this.name=e,this.type=t}};function vg(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(vg);default:return!1}}function yg(e){let t=t_(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(yg);default:return!1}}function Bee(e){return vg(e)&&yg(e)}var bg=class{parameter;type;constructor(e,t){if(!Bee(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,g_(t)&&!w_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},xg=class extends ng{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o}getParser(e,t=e){let n=this,r=n.propertySignatures.length,i=n.indexSignatures.length;if(!r&&!i)return E_(n,oe);let a,o,s=()=>(a||(a=n.propertySignatures.map(e=>({parser:t(e.type),name:e.name,type:e.type})),o=i?n.indexSignatures.map(n=>({is:n,parserKey:e(D_(n.parameter)),parserValue:t(n.type)})):void 0),a),c=()=>{let e=new Set(n.propertySignatures.map(e=>typeof e.name==`number`?globalThis.String(e.name):e.name)),t=(t,i,a,o,s)=>{if(s._tag===`Failure`)return mg(t,n,i,s)??Iu;let c=s===ah?o:s[y];if(a!==nh&&c!==nh){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return Iu;vt(t.out,a,c)}return Iu},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!xs(t))return D(Vf(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return mg(e,n,r,a)??Iu;let o=a===ah?r:a[y],s=e.input[r],l=i.parserValue(s,e.options);return xs(l)?t(e,r,o,s,l):D(Vf(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return xs(a)?t(e,n,n,i,a):D(Vf(a),r=>t(e,n,n,i,r))},u=i?fl()({onItem:(e,[t,n])=>n.is.parameter===lg?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Yp(function*(t,d){if(t===nh)return nh;if(typeof t!=`object`||!t||Array.isArray(t))return yield*E(new gh(n,t,d));s();let f=t,p={},m={ast:n,input:f,out:p,issues:void 0,options:d},h=d.errors===`all`,g=d.onExcessProperty===`error`,ee=d.concurrency===void 0?1:ll(d.concurrency),_=i&&g?n.indexSignatures.map(e=>gg(f,e.parameter,d)):void 0;if(g){let r=_?new Set(e):e;if(_)for(let e of _)for(let t of e)r.add(t);let i=Reflect.ownKeys(f);for(let e=0;e<i.length;e++){let a=i[e];if(!r.has(a)&&Object.prototype.propertyIsEnumerable.call(f,a)){let e=new mh(n,f[a],d),r=new fh([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*E(new hh(n,[r],t,d))}}}if(r){let e=ee===1?wg(m,a):Tg(m,a,{concurrency:ee});e&&(yield*e)}if(i&&ee===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===lg?l:c,r=_?.[e]??(t.is.parameter===lg?Object.keys(f):gg(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!xs(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=vi();for(let t=0;t<i;t++){let n=o[t],r=_?.[t]??(n.is.parameter===lg?Object.keys(f):gg(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:ee});t&&(yield*t)}return m.issues?yield*E(new hh(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return D(Vf(n),n=>{let i=Sg(e,r,n);if(i)return i;let o=()=>rh(e.out),s=wg(e,a.slice(t+1));return s?Jp(s,o):o()})};return(e,t)=>{if(e===nh)return ih;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&ll(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return E(new gh(n,e,t));let r=s(),i=e,a={},o={ast:n,input:i,out:a,issues:void 0,options:t};try{for(let e=0;e<r.length;e++){let n=r[e],s=n.name,c=Lg(i,s),l=c?i[s]:nh,d=n.parser(l,t);if(!xs(d))return u(o,e,d);if(d===ah){c&&vt(a,s,l);continue}let f=Sg(o,n,d);if(f)return f}}catch(e){return Ff(e)}return rh(a)}}_rebuild(e,t,n,r){let i=l_(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new _g(t.name,n)}),a=l_(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new bg(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new xg(i,a,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};function Sg(e,t,n){if(n._tag===`Failure`)return mg(e,e.ast,t.name,n);if(n===ah)return;let r=n[y];if(r!==nh){vt(e.out,t.name,r);return}if(delete e.out[t.name],!g_(t.type)){let n=new fh([t.name],new ph(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Fu(new hh(e.ast,[n],e.input,e.options))}}var Cg={onItem(e,t){if(!Lg(e.input,t.name))return t.parser(nh,e.options);let n=e.input[t.name];return vt(e.out,t.name,n),t.parser(n,e.options)},step:Sg},wg=ul()(Cg),Tg=fl()(Cg);function Eg(e,t){return e?t?[...e,...t]:e:t}function Dg(e,t,n){return new xg(Reflect.ownKeys(e).map(t=>new _g(t,e[t].ast)),[],n,t)}function Og(e){return e.ast}function kg(e,t=void 0){return new fg(!1,e.map(e=>e.ast),[],void 0,t)}function Ag(e,t,n){return new Rg(e.map(Og),t,void 0,n)}var jg=f(e=>{for(;;){if(Zh(e))return og;let t=e.encoding;if(!t)return e.recur?.(jg,a)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==a))return og;e=t[t.length-1].to}});function Mg(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Mg)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Ng(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[Ym];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!g_(t)){if(Yh(t))return[{key:e.name,literal:t.literal}];if(Xh(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!g_(e)){if(Yh(e))return[{key:t,literal:e.literal}];if(Xh(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Ng(jg(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Ng(e.thunk())}}var Pg=new WeakMap,Fg=Object.freeze([]),Ig=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Lg=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Vee(e){let t=Pg.get(e);if(t)return t;let n,r=0,i,a,o=!0,s=[];for(let t=0;t<e.length;t++){let c=e[t],l=jg(c);if(kee(l))continue;if(Yh(l)||Xh(l)){a??=new Map;let e=Yh(l)?l.literal:l.symbol;s[t]=e;let n=a.get(e);n||a.set(e,n=[]),n.push(t)}else o=!1;let u=Ng(l);if(u.length){n??=new Map,r++;for(let{key:e,literal:r}of u){let i=n.get(e);i||n.set(e,i=[new Map,new Set]),i[1].add(t);let a=i[0].get(r);a||i[0].set(r,a=new Set),a.add(t)}}else{i??={};let e=Mg(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Fg);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Fg;else if(n?.size===1&&!i){let[r,[i]]=n.entries().next().value,a=new Map;for(let[e,t]of i)a.set(e,Object.freeze(Array.from(t)));let o=Object.freeze(e.map((e,t)=>t));t=(e,t)=>{if(ue(e)){let n=Lg(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Fg;if(t)return o}return Fg}}else if(n){let e;for(let t of n)(!e||t[1][0].size>e[1][0].size)&&t[1][1].size===r&&(e=t);t=(t,r)=>{let a=Ig(t);if(!ue(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Lg(t,n),u=c?t[n]:void 0;if(c&&(!r||u!==void 0)){let e=i.get(u);if(!e)return l(a);for(let t of e)o.add(t);s=n}}if(s===void 0)for(let[e,[i,a]]of n){let n=Lg(t,e),s=n?t[e]:void 0;if(n&&(!r||s!==void 0)){let e=i.get(s);if(e)for(let t of e)o.add(t)}else if(r)for(let e of a)o.add(e)}for(let[e,[i,a]]of n){if(e===s)continue;let n=Lg(t,e),c=n?t[e]:void 0;if(n&&(!r||c!==void 0)){let e=i.get(c);for(let t of o)a.has(t)&&!e?.has(t)&&o.delete(t)}}return Array.from(o).sort((e,t)=>e-t)}}else t=e=>{let t=l(Ig(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Pg.set(e,t),t}var Rg=class extends ng{_tag=`Union`;types;options;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.options=t,this.encodingChecks=o}getParser(e,t){let n=this,r=t!==void 0,i=[],a=t=>i[t]??=e(n.types[t]),o;return(e,t)=>{if(e===nh)return ih;let i=(o??=Vee(n.types))(e,r);if(i.length===0)return E(new vh(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:xs(r)?zg(n,r.cause,e,t):Hee(n,r,e,t)}return Uee(n,a,i,e,t)}}_rebuild(e,t,n){let r=l_(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Rg(r,this.options,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=S_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Yh);if(t.length>0)return`${Vg(n.isMutable)}[ ${t.map(t=>e(t)+Hg(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Yh(e.type));if(t.length>0)return`{ ${t.map(t=>`${Vg(t.type.context?.isMutable)}${nt(t.name)}${Hg(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function zg(e,t,n,r){let i=kh(t);return i?Fu(new vh(e,[i],n,r)):Pu(t)}function Hee(e,t,n,r){return Gf(t,t=>zg(e,t,n,r))}function Uee(e,t,n,r,i){let a={ast:e,parser:t,input:r,out:void 0,successes:e.options?.mode===`oneOf`?[]:void 0,issues:void 0,options:i},o=Gee(a,n);return o?Wee(o,a):a.out?a.out:E(new vh(e,a.issues??[],r,i))}function Wee(e,t){return Jp(e,e=>t.out===ah?w(t.input):t.out?t.out:E(new vh(t.ast,t.issues??[],t.input,t.options)))}var Gee=ul()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=kh(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Fu(new vee(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Iu}}}),Bg=new Rg([new sg(`Infinity`),new sg(`-Infinity`),new sg(`NaN`)]);function Vg(e){return e?``:`readonly `}function Hg(e){return e?`?`:``}var Ug=class extends r{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new Ug(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Ug(this.run,this.annotations,!0)}and(e,t){return new Wg([this,e],t)}},Wg=class extends r{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Wg(this.checks,{...this.annotations,...e})}and(e,t){return new Wg([this,e],t)}};function Gg(e,t,n=!1){return new Ug((t,n,r)=>bee(n,e(t,n,r),t,r),t,n)}function Kg(e,t){return new Ug((t,n,r)=>e(t)?void 0:new _h(void 0,t,r),t,!0)}function qg(e){return Gg(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitraryConstraint:{number:`finite`},...e})}var Jg=new Qh(new Rg([i_(dg,[qg()]),Bg]),new Uh(Lh(),Ph(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Yg(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Gg(e=>(n.lastIndex=0,n.test(e)),{expected:`a string matching the RegExp ${r.source}`,representation:{id:`effect/schema/isPattern`,payload:r},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[r]},...t})}var Xg=new WeakMap;function Zg(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&Xg.set(n,Qg(e)),n}function Qg(e){let t=Xg.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return Xg.set(e,n),n}function $g(e,t){return e.encoding===t?e:Zg(e,{encoding:t})}function e_(e,t){if(e.context===t)return e;let n=Qg(e);return n.context===t&&n.encoding===e.encoding?n:Zg(e,{context:t})}function t_(e){return e.encoding?t_(e.encoding[e.encoding.length-1].to):e}function n_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return r_(e,mi(e.checks.slice(0,-1),n.annotate(t)))}return Zg(e,{annotations:{...e.annotations,...t}})}function r_(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Zg(e,{checks:t})}function i_(e,t){return r_(e,Eg(e.checks,t))}function a_(e,t){let n=t(e.to);return n===e.to?e:new Qh(n,e.transformation)}function o_(e,t){let n=e,r=n[n.length-1],i=a_(r,t);return i===r?e:mi(e.slice(0,e.length-1),i)}function s_(e){return t=>t.encoding?$g(t,o_(t.encoding,e)):t}function Kee(e,t){return s_(e=>e_(e,t))(e)}function c_(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:$g(r,o_(r.encoding,n))}return e(r)}return f(n)}function qee(e,t,n){let r=new Qh(e,t);return $g(n,n.encoding?[...n.encoding,r]:[r])}function l_(e,t){let n;for(let r=0;r<e.length;r++){let i=e[r],a=t(i);if(n)n[r]=a;else if(a!==i){n=Array(e.length);for(let t=0;t<r;t++)n[t]=e[t];n[r]=a}}return n??e}function Jee(e,t){return e_(e,e.context?new eg(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new eg(!1,!1,void 0,t))}var u_=f(e=>d_(e_(e,e.context?e.context.isOptional===!1?new eg(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new eg(!0,!1)))),d_=s_(u_),f_=d(e=>u_(new Rg([e,ag])));function p_(e,t,n){return qee(e,n,t)}function m_(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:ie(e.literal)&&!t.includes(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.includes(e.symbol)||t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function h_(e,t){let{literals:n,parameters:r}=m_(e);return new xg(n.map(e=>new _g(e,t)),r.map(e=>new bg(e,t)))}function g_(e){return e.context?.isOptional??!1}function __(e){return e.context?.isMutable??!1}function v_(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(v_)}function y_(e){function t(e){return v_(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return hi(n)?n:void 0}function b_(e){let t=!0;function n(e){return t=t&&!e.encoding&&!Zh(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var x_=f(e=>{let t=Qg(e);if(t!==e){let n=x_(t);return n===t&&e.encoding===void 0?e:e_(n,e.context)}let n=`recur`in e?e.recur(x_):e;if(`encodingChecks`in n&&n.encodingChecks){let t=b_(e)?n.encodingChecks:Aee(n)||jee(n)||Jh(n)&&n.typeParameters.length>0?y_(n.encodingChecks):void 0;return Zg(n,{encodingChecks:void 0,checks:Eg(n.checks,t)})}return n}),S_=f(e=>x_(C_(e)));function Yee(e,t){let n=t,r=n.length,i=n[r-1],a=[new Qh(C_($g(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Qh(C_(n[e-1].to),n[e].transformation.flip()));let o=C_(i.to);return o.encoding?$g(o,[...o.encoding,...a]):$g(o,a)}var C_=d(e=>{if(e.encoding)return Yee(e,e.encoding);let t=Qg(e);if(t!==e){let n=C_(t);return n===t?e:e_(n,e.context)}return`flip`in e?e.flip(C_):`recur`in e?e.recur(C_):e});function w_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(w_);default:return!1}}function T_(e,t){let n=t===0?ah:rh(t);return(r,i)=>r===nh?ih:r===t?n:E(new gh(e,r,i))}function E_(e,t){return(n,r)=>n===nh?ih:t(n)?ah:E(new gh(e,n,r))}var D_=c_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(D_)}}),O_=c_(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(O_)}}),Xee=`[\\s\\S]*?`,k_=new globalThis.RegExp(`^${hg}$`),Zee=new globalThis.RegExp(`^(?:${hg}|Infinity|-Infinity|NaN)$`);function Qee(e){return Yg(k_,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:k_.source}),...e})}var A_=i_(lg,[Qee()]),$ee=new Qh(A_,Kh),ete=new Qh(new Rg([A_,Bg]),Kh);function j_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=j_(o.checks,t,n,r,i),n&&(i.errors!==`all`||n[n.length-1].filter.aborted))return n}else{let e=o.run(t,r,i);if(e){let r=new gee(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function tte(e){if(!Jh(e))return;let t=e.annotations?.[Xm];return ae(t)?t(e.typeParameters):void 0}function nte(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function rte(e){return e===void 0||typeof e==`string`}function M_(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function N_(e){return M_(e,nte)}var P_=new rg([],()=>(e,t,n)=>N_(e)?ah:E(new gh(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>ote}),F_=new Qh(P_,Gh()),ite=new Qh(new Rg([new fg(!1,[],[P_]),new xg([],[new bg(lg,P_)])]),Gh());function ate(e){return M_(e,rte)}var ote=new Qh(new rg([],()=>(e,t,n)=>ate(e)?ah:E(new gh(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),Gh()),I_=(e,t,n)=>e===ah?n(t):Jp(e,n);function L_(e){if(e._tag===`Middleware`)return(t,n,r)=>R_(t===ah?e.decode(rh(oh(n)),r):e.decode(qp(t,oh),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===ah?rh(t):e;case`Transform`:{let e=e=>e===nh?ih:rh(t.transform(e));return(t,n)=>I_(t,n,e)}case`TransformOptional`:{let e=e=>sh(t.transform(oh(e)));return(t,n)=>I_(t,n,e)}case`TransformEffect`:return(e,n,r)=>I_(e,n,e=>e===nh?ih:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>I_(e,n,e=>R_(t.transform(oh(e),r)))}}var R_=e=>Jp(e,sh),z_=(e,t,n,r)=>Gf(r,r=>Pf(()=>wu(r,r=>new _ee(e,r,t,n))));function B_(e,t){let n=L_(e.link.transformation),r;return(i,a)=>{if(i===nh)return ih;if(e.isConstructed(i))return ah;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function V_(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==nh&&r!==void 0)return t(r,i);let a=n;if(xs(a)&&a._tag===`Success`){let e=t(a[y],i);return e===ah?a:e}return Jp(z_(e,r,i,a),e=>{let n=t(e,i);return n===ah?rh(e):n})}}function H_(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:V_(e,n)}function U_(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?tte(e):void 0,o=a?B_(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>L_(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);if(u&&!n.disableChecks){if(xs(r)){if(r._tag===`Success`){let i=r===ah?t:r[y];if(t!==nh&&i!==nh){let i=j_(u,t,void 0,e,n);i&&(r=E(new hh(e,i,t,n)))}}}else r=D(r,r=>{if(t!==nh&&r!==nh){let r=j_(u,t,void 0,e,n);if(r)return E(new hh(e,r,t,n))}return w(r)})}if(s&&!n.disableChecks){if(xs(r)){if(r._tag===`Success`){let i=r===ah?t:r[y];if(i===nh)return r;let a=j_(s,i,void 0,e,n);a&&(r=E(new hh(e,a,i,n)))}}else r=D(r,t=>{if(t!==nh){let r=j_(s,t,void 0,e,n);if(r)return E(new hh(e,r,t,n))}return w(t)})}return r},p=i===void 0?f:i(f);return c?(n,r)=>{let i=d??=c.map(e=>t(e.to)),a=n,o=i[i.length-1](n,r);for(let e=c.length-1;e>=0;e--)if(o=l[e](o,a,r),e!==0){let t=i[e-1];o._tag===`Success`?(a=o[y],o=t(a,r)):o=Jp(o,e=>{let n=t(e,r);return n===ah?rh(e):n})}if(o._tag===`Success`){let e=o[y],t=p(e,r);return t===ah?o:t}return o=z_(e,n,r,o),Jp(o,e=>{let t=p(e,r);return t===ah?rh(e):t})}:p}var W_=Symbol(),G_=new WeakMap,K_=e=>X_(e).parser,q_=e=>X_(e).makeEffect,J_=e=>H_(e,q_),Y_=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=U_(this.ast,K_)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=U_(this.ast,q_,J_)}};function X_(e){let t=G_.get(e);if(t!==void 0)return t;let n=new Y_(e);return G_.set(e,n),n}function Z_(e){let t=e.ast,n;return(e,r)=>(n??=ov(fv,x_(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Q_(e){let t=Z_(e);return(e,n)=>{let r=Hp(t(e,n));return Lu(r)?rr(r.value):(Ah(r.cause,`Option adapter can only return none for schema issues`),nr())}}function $_(e){return uv(x_(e.ast))}function ev(e,t){let n=iv(e.ast);return t===void 0?n:(e,r)=>n(e,nv(t,r))}function tv(e,t){return cv(ev(e,t))}var nv=(e,t)=>t?{...e,...t}:e,rv=e=>e===nh?E(new _h):w(e);function iv(e){return ov(dv,e)}function av(e,t){return e===ah?w(t):xs(e)?e[y]===nh?rv(nh):e:Jp(e,rv)}function ov(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??$h);return a===ah?w(r):xs(a)?a[y]===nh?rv(nh):a:Jp(a,rv)}}function sv(e){return(t,n)=>Hp(e(t,n))}function cv(e){let t=sv(e);return(e,n)=>{let r=t(e,n);return Lu(r)?Xr(r.value):Zr(Ah(r.cause,`Result adapter can only return schema issues`))}}function lv(e,t){let n=Hp(e);if(Lu(n))return n.value;let r=Ah(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}function uv(e){let t,n;return(r,i)=>{t??=X_(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??$h,o=t.make;if(o!==void 0&&r!==nh){let e;try{e=o(r,a)}catch(e){throw Ah(Su(e),`Constructor adapter can only throw schema issues`),e}if(e!==W_&&e!==nh)return e}return lv(av((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var dv=e=>X_(e).parser,fv=e=>X_(e).makeEffect,pv=`~effect/Schema/Schema`,mv=Symbol(),hv={[pv]:pv,get make(){let e=$_(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Z_(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Q_(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return t(this,arguments)},annotate(e){return this.rebuild(n_(this.ast,e))},annotateKey(e){return this.rebuild(Jee(this.ast,e))},check(...e){return this.rebuild(i_(this.ast,e))},rebuild(e){return gv(e,this[mv])}};function gv(e,t){function n(){}let r=Object.setPrototypeOf(n,hv);return t&&(Object.hasOwn(t,`name`)||Object.hasOwn(t,`length`)||Object.hasOwn(t,`__proto__`))?Object.defineProperties(r,Object.getOwnPropertyDescriptors({...t})):Object.assign(r,t),r[mv]=t,r.ast=e,r}function _v(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function vv(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function yv(e){return encodeURI(_v(e)).replace(/#/g,`%23`)}function bv(e){if(e.length===0||e===`#`)return``;if(!e.startsWith(`#`))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,`%`).replace(/#/g,`%23`)!==t)return;let e=decodeURIComponent(t);return e.startsWith(`/`)&&!/~(?:[^01]|$)/.test(e)?e:void 0}catch{return}}function xv(e){let t=bv(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split(`/`).map(vv)}function Sv(e){return e.reduce((e,t)=>`${e}/${yv(t)}`,`#`)}var Cv=`http://json-schema.org/draft-07/schema#`;function wv(e,t){return e===t||e===(t.endsWith(`#`)?t.slice(0,-1):`${t}#`)}function ste(e){return{dialect:`draft-07`,...pte(e,Cte)}}function cte(e,t){return n(e,!1,!0);function n(e,r,i=!1){if(!le(e))return e;let a=r||!i&&Av(e.$id),o={};for(let t of Object.keys(e)){let r=e[t],i=r;switch(t){case`$defs`:case`properties`:case`patternProperties`:case`dependentSchemas`:i=Tv(r,e=>n(e,a))??r;break;case`allOf`:case`anyOf`:case`oneOf`:case`prefixItems`:i=Array.isArray(r)?r.map(e=>n(e,a)):r;break;case`not`:case`additionalProperties`:case`propertyNames`:case`unevaluatedProperties`:case`items`:case`contains`:case`unevaluatedItems`:case`if`:case`then`:case`else`:case`contentSchema`:i=n(r,a)}vt(o,t,i)}return t(o,a),o}}function lte(e,t){return cte(e,e=>{ute(e,t)})}function ute(e,t){typeof e.$ref==`string`&&vt(e,`$ref`,t(e.$ref,`$ref`)),typeof e.$dynamicRef==`string`&&vt(e,`$dynamicRef`,t(e.$dynamicRef,`$dynamicRef`))}function Tv(e,t){if(!le(e))return;let n={};for(let r of Object.keys(e))vt(n,r,t(e[r],r));return n}function dte(e,t,n){let r=new Map,i=[],a=Ev;function o(e,n=[],r=[]){return n.length===0&&t?.trackIds&&(a=Ov(le(e)?u(e):void 0,Ev)??Ev),l(e,n,r,{sourceRoot:[],targetRoot:[],uri:a})}function s(){for(let[e,t,n]of i){let i=t,a=Dv(t,n);if(a!==void 0){let e=xv(a.hash);if(a.hash=``,e!==void 0){let n=r.get(kv(a.href,e));n!==void 0&&(i=fte(t,n))}}vt(e,`$ref`,i)}}let c=n(o);return s(),c;function l(n,r,a,o){if(typeof n==`boolean`)return d(r,a,o),t?.booleanAdapter?.(n)??n;if(!le(n))return n;let s=o,c=u(n);if(r.length>0&&t?.trackIds&&Av(c)){let e=Ov(c,o.uri);e!==void 0&&(s={parent:o,sourceRoot:r,targetRoot:a,uri:e})}d(r,a,s);let f=s.uri;return e(n,{isDocumentRoot:r.length===0,schema(e,t,n=t){return l(e,[...r,t],[...a,n],s)},schemaAt(e,t,n){return l(e,[...r,...t],[...a,...n],s)},schemaArray(e,t,n=t){return Array.isArray(e)?e.map((e,i)=>l(e,[...r,t,String(i)],[...a,n,String(i)],s)):e},schemaMap(e,t,n=t){return le(e)?Tv(e,(e,i)=>l(e,[...r,t,i],[...a,n,i],s)):e},reference(e,t){typeof t==`string`?i.push([e,t,f]):vt(e,`$ref`,t)}})}function u(e){return t?.ignoreRefSiblings===!0&&typeof e.$ref==`string`?void 0:e.$id}function d(e,t,n){n.parent!==void 0&&d(e,t,n.parent),r.set(kv(n.uri,e.slice(n.sourceRoot.length)),t.slice(n.targetRoot.length))}}var Ev=`https://effect.invalid/.json-schema/`;function Dv(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function Ov(e,t){if(typeof e!=`string`)return;let n=Dv(e,t);if(n!==void 0)return n.hash=``,n.href}function fte(e,t){let n=e.indexOf(`#`);return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${Sv(t)}`}function kv(e,t){return`${e}\u0000${JSON.stringify(t)}`}function Av(e){return typeof e==`string`&&e.length>0&&e[0]!==`#`}function pte(e,t,n){return dte(t,{...n,trackIds:!0},t=>({schema:t(e.schema),definitions:Tv(e.definitions,(e,n)=>t(e,[`$defs`,n],[`definitions`,n]))}))}var mte=new Set([`properties`,`patternProperties`]),hte=new Set([`allOf`,`anyOf`,`oneOf`]),gte=new Set([`not`,`additionalProperties`,`propertyNames`,`contains`,`if`,`then`,`else`,`contentSchema`]);function _te(e,t,n,r,i,a=mte){let o;if(a.has(t))o=r.schemaMap(n,t);else if(hte.has(t))o=r.schemaArray(n,t);else if(i.has(t))o=r.schema(n,t);else return!1;return vt(e,t,o),!0}var jv=[`$anchor`,`$defs`,`$dynamicAnchor`,`$dynamicRef`,`$vocabulary`,`contentSchema`,`dependentRequired`,`dependentSchemas`,`maxContains`,`minContains`,`prefixItems`,`unevaluatedItems`,`unevaluatedProperties`];[...jv],[...jv];var vte=/^[A-Za-z_][-A-Za-z0-9._]*$/,yte=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Mv(e,t,n){throw Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function bte(e,t,n,r){for(let i of t)Object.hasOwn(e,i)&&Mv(i,n,`it is not active in ${r} but would become active in the target`)}var xte=[`additionalItems`,`definitions`,`dependencies`];function Ste(e,t,n,r,i){n.isDocumentRoot?vt(e,`$schema`,wv(t,`https://json-schema.org/draft/2020-12/schema`)?r:t):wv(t,`https://json-schema.org/draft/2020-12/schema`)||Mv(`$schema`,i,`an embedded resource cannot declare a different dialect`)}function Cte(e,t){bte(e,xte,`Draft-07`,`Draft 2020-12`);let n={},r,i,a;for(let o of Object.keys(e)){let s=e[o];if(!_te(n,o,s,t,gte))switch(o){case`$ref`:r=s;break;case`$schema`:Ste(n,s,t,Cv,`Draft-07`);break;case`$id`:case`$anchor`:break;case`$defs`:vt(n,`definitions`,t.schemaMap(s,o,`definitions`));break;case`prefixItems`:i=s;break;case`items`:a=s;break;case`dependentRequired`:case`dependentSchemas`:case`minContains`:case`maxContains`:break;case`$dynamicRef`:case`$dynamicAnchor`:case`$vocabulary`:case`unevaluatedProperties`:case`unevaluatedItems`:Mv(o,`Draft-07`,`the target dialect has no equivalent`);case`required`:if(Array.isArray(s)&&s.length===0)break;vt(n,o,s);break;default:vt(n,o,s)}}if(wte(n,i,a,t),Object.hasOwn(e,`contains`)){let t=e.minContains,r=e.maxContains;(t!==void 0&&t!==1||r!==void 0)&&Mv(`minContains/maxContains`,`Draft-07`,`contains cardinality cannot be represented`),Object.hasOwn(e,`minContains`)&&vt(n,`minContains`,t)}else Object.hasOwn(e,`minContains`)&&vt(n,`minContains`,e.minContains),Object.hasOwn(e,`maxContains`)&&vt(n,`maxContains`,e.maxContains);return Ete(e,n,t,`draft-07`),Ote(e,n,`$id`,`Draft-07`),Tte(n,r,t),n}function wte(e,t,n,r){if(t===void 0){n!==void 0&&vt(e,`items`,r.schema(n,`items`));return}vt(e,`items`,r.schemaArray(t,`prefixItems`,`items`)),n!==void 0&&vt(e,`additionalItems`,r.schema(n,`items`,`additionalItems`))}function Tte(e,t,n){if(t!==void 0){if(typeof t==`string`&&Object.keys(e).length>0){let r={};n.reference(r,t),Dte(e,r)}else n.reference(e,t)}}function Ete(e,t,n,r){let i=le(e.dependentRequired)?e.dependentRequired:void 0,a=le(e.dependentSchemas)?e.dependentSchemas:void 0;if(i===void 0&&a===void 0)return;let o={},s=new Set([...Object.keys(i??{}),...Object.keys(a??{})]);for(let e of s){let t=i?.[e],s=a?.[e],c=r===`draft-04`&&Array.isArray(t)&&t.length===0;s===void 0?c||vt(o,e,t):t===void 0||c?vt(o,e,n.schemaAt(s,[`dependentSchemas`,e],[`dependencies`,e])):vt(o,e,{allOf:[n.schemaAt(s,[`dependentSchemas`,e],[`dependencies`,e,`allOf`,`0`]),{required:t}]})}Object.keys(o).length>0&&vt(t,`dependencies`,o)}function Dte(e,t){Array.isArray(e.allOf)?e.allOf.push(t):vt(e,`allOf`,[t])}function Ote(e,t,n,r){let i=e.$id,a=e.$anchor;if(a===void 0){i!==void 0&&vt(t,n,i);return}(typeof a!=`string`||!vte.test(a))&&Mv(`$anchor`,r,`the anchor is not valid`),yte.test(a)||Mv(`$anchor`,r,`the anchor cannot be represented as a plain-name fragment identifier`),i===void 0?vt(t,n,`#${a}`):Mv(`$anchor`,r,`it cannot be combined with the schema $id`)}var Nv=c_(e=>{let t=Nte(e,Nv),n=e.context;return t===e||n===void 0?t:Kee(t,kte(n))});function kte(e){return e.constructorDefault===void 0?e:new eg(e.isOptional,e.isMutable,void 0,e.annotations)}function Ate(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function jte(e){return t=>{let n=[...t].sort((t,n)=>e(S_(t))-e(S_(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Mte=jte(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Nte(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!ae(n))return $g(e,[F_]);let r=n(e.typeParameters.map(e=>gv(S_(e))));return r===void 0?e:$g(e,[a_(r,t)])}case`Unknown`:return $g(e,[F_]);case`ObjectKeyword`:return $g(e,[ite]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return Ate(e),e.recur(t,O_);case`Union`:{let n=Mte(e.types);return n===e.types?e.recur(t):new Rg(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}globalThis.RegExp;var Pte=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`);function Pv(e,t){return t.length>0&&(e+=`\n at ${rt(t)}`),Error(e)}function Fv(e){return`#/$defs/${yv(e)}`}var Fte=new Set([...th,Jm,...Zm]);function Iv(e,t){if(e===void 0)return;let n={},r=e.title;typeof r==`string`&&(n.title=r);let i=e.description,a=e.expected;typeof i==`string`?n.description=i:t?.generateDescriptions===!0&&typeof a==`string`&&(n.description=a);let o=e.default;N_(o)&&(n.default=o);let s=e.examples;Array.isArray(s)&&N_(s)&&(n.examples=s);let c=e.readOnly;typeof c==`boolean`&&(n.readOnly=c);let l=e.writeOnly;typeof l==`boolean`&&(n.writeOnly=l);let u=e.format;typeof u==`string`&&(n.format=u);let d=e.contentEncoding;typeof d==`string`&&(n.contentEncoding=d);let f=e.contentMediaType;typeof f==`string`&&(n.contentMediaType=f);let p=e.contentSchema;if(N_(p)&&(n.contentSchema=p),t?.includeAnnotationKey!==void 0)for(let[r,i]of Object.entries(e))!Fte.has(r)&&t.includeAnnotationKey(r)&&N_(i)&&vt(n,r,i);return Object.keys(n).length===0?void 0:n}function Lv(e){let t=e.type===`number`||e.type===`integer`?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){let e=[],r=!1;for(let i of n.allOf){let n=Lv(i);n.type!==void 0&&(r=!0,(t===void 0||n.type===`integer`)&&(t=n.type)),Object.keys(n.schema).length>0&&e.push(n.schema)}if(r){let{allOf:t,...r}=n;n=e.length===0?r:{...r,allOf:e}}}return{type:t,schema:n}}function Ite(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!==`number`)return!1;let t=e.anyOf[1];return t?.type===`string`&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes(`NaN`)&&t.enum.includes(`Infinity`)&&t.enum.includes(`-Infinity`)}var Rv=`|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|`;function zv(e,t){return Object.keys(e).every(e=>t.includes(`|${e}|`))}function Bv(e,t){return typeof e.$ref!=`string`&&t.every(t=>!Object.hasOwn(e,t))}var Vv=`|title|description|default|examples|readOnly|writeOnly|`,Hv=Rv+Vv;function Uv(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let i=e.type===`number`||e.type===`integer`?e.type:void 0,a=Ite(e);if(i!==void 0||a){let r=Lv(t);if(r.type!==void 0){let t=i===`integer`||r.type===`integer`?`integer`:`number`,o={...e,type:t};a&&delete o.anyOf;let s=Object.keys(r.schema);return s.length===0?o:zv(r.schema,Vv)&&Bv(o,s)?{...o,...r.schema}:Uv(o,r.schema,n)}}if(n&&Bv(e,r))return{...e,...t};let o=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...o]}:typeof e.$ref==`string`?{allOf:[e,...o]}:{...e,allOf:o}}function Wv(e,t=new Set){return typeof e==`boolean`?e:t.has(e)?!0:(t.add(e),e.every(e=>Wv(e,t)))}function Gv(e){return Array.isArray(e)}function Kv(e,t,n,r){let i=new Map,a=new Map,o=new WeakMap,s=new Map,c=new Map,l=Object.keys(n);for(let e of l)m(e,[`references`,e]);let u=bi(e,(e,n)=>_(e,t[n],[]));for(let[e,t]of s.values())if(!Wv(e))for(let e of t)Array.isArray(e.oneOf)&&(e.anyOf=e.oneOf,delete e.oneOf);for(let e of l){let t=n[e],r=g(t);if(r===void 0)continue;let o=i.get(e)[0],s=c.get(r),l=s?.find(e=>Me(i.get(e)[0],o));l===void 0?s===void 0?c.set(r,[e]):s.push(e):a.set(e,l)}let d=bi(u,h),f={};for(let e of l)a.has(e)||vt(f,e,h(i.get(e)[0]));return{dialect:`draft-2020-12`,schemas:d,definitions:f};function p(e){return Array.isArray(e.oneOf)&&s.get(e.oneOf)?.[1].push(e),e}function m(e,t){if(!Object.hasOwn(n,e))throw Pv(`Invalid reference ${e}`,[...t,`$ref`]);let r=i.get(e);if(r!==void 0)return r;let a=[{},[]];return i.set(e,a),a[0]=_(n[e],[`references`,e],a[1]),a}function h(e){return lte(e,e=>{let t=bv(e);if(t===void 0){if(/^#(?:\/|%2f)/i.test(e))throw Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(e)}`);return e}if(!t.startsWith(`/$defs/`))return e;let n=t.indexOf(`/`,7),r=a.get(vv(t.slice(7,n<0?void 0:n)));return r===void 0?e:e.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,Fv(r))})}function g(e){if(e._tag===`Reference`)return;let t=e.checks.length===0?e.annotations:e.checks[e.checks.length-1].annotations;return typeof t?.identifier!=`string`&&typeof t?.[`~identifier`]==`string`?t[Jm]:void 0}function ee(e,t,n,i){let a=e.annotations,o=a?.toJsonSchema;if(o!==void 0){let s=o({type:t,schemas:e.representation?.schemas?.map((e,t)=>_(e,[...n,`representation`,`schemas`,t],i))??[]}),c=Gv(s);c&&i.push(!1);let l=c?s[0]:s,u=Iv(a,r),d=u===void 0?l:{...l,...u},f=u===void 0?Rv:Hv;return[d,e._tag===`Filter`&&zv(d,f)&&(u===void 0||zv(u,Vv))?!0:void 0]}if(e._tag===`Filter`){i.push(!1);return}let s=e.checks.flatMap((e,r)=>{let a=ee(e,t,[...n,`checks`,r],i);return a===void 0?[]:[a[0]]});if(s.length===0)return;let c=Iv(a,r),l={allOf:s};return[c===void 0?l:{...l,...c}]}function _(e,t,n){if(e._tag===`Reference`)return n.push(m(e.$ref,t)[1]),{$ref:Fv(e.$ref)};let i=o.get(e);if(i!==void 0)return n.push(i[1]),i[0];let a=[];n.push(a);let s=te(e,t,a),c=Iv(e.annotations,r);c!==void 0&&(s={...s,...c});for(let n=0;n<e.checks.length;n++){let r=typeof s.type==`string`&&qv(s.type)?s.type:void 0,i=ee(e.checks[n],r,[...t,`checks`,n],a);i!==void 0&&(s=Uv(s,...i))}return o.set(e,[s,a]),p(s)}function te(e,t,n){switch(e._tag){case`Any`:case`Unknown`:return{};case`ObjectKeyword`:return{anyOf:[{type:`object`},{type:`array`}]};case`Void`:case`Undefined`:case`Null`:return{type:`null`};case`BigInt`:return{type:`string`,allOf:[{pattern:`^-?\\d+$`}]};case`Symbol`:return{type:`string`,allOf:[{pattern:`^Symbol\\(([\\s\\S]*)\\)$`}]};case`UniqueSymbol`:return globalThis.Symbol.keyFor(e.symbol)===void 0?{not:{}}:{type:`string`,enum:[globalThis.String(e.symbol)]};case`Declaration`:return n.push(!1),{};case`Suspend`:return _(e.thunk,[...t,`thunk`],n);case`Never`:return{not:{}};case`String`:return{type:`string`};case`Number`:return{anyOf:[{type:`number`},{type:`string`,enum:[`NaN`,`Infinity`,`-Infinity`]}]};case`Boolean`:return{type:`boolean`};case`Literal`:{let t=e.literal;return typeof t==`bigint`?{type:`string`,enum:[globalThis.String(t)]}:{type:typeof t,enum:[t]}}case`Enum`:{let n=e.enums.map(([e,n],r)=>{if(typeof n==`number`&&!globalThis.Number.isFinite(n))throw Pv(`Invalid numeric enum value ${globalThis.String(n)}`,[...t,`enums`,r,1]);return{type:typeof n,enum:[n],title:e}});return n.length===0?{not:{}}:{anyOf:n}}case`TemplateLiteral`:return{type:`string`,pattern:`^${e.parts.map(Yv).join(``)}$`};case`Arrays`:{if(e.rest.length>1)throw Pv(`Invalid schema representation document`,[...t,`rest`]);let i={type:`array`},a=e.elements.length,o=e.elements.map((e,i)=>{e.isOptional&&a--;let o=_(e.type,[...t,`elements`,i,`type`],n),s=Iv(e.annotations,r);return s===void 0?o:p(Uv(o,s))});if(o.length>0?(i.prefixItems=o,i.maxItems=e.elements.length,a>0&&(i.minItems=a)):i.items=!1,e.rest.length===1){delete i.maxItems;let r=_(e.rest[0],[...t,`rest`,0],n);Object.keys(r).length>0?i.items=r:delete i.items}return i}case`Objects`:{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return{not:{type:`null`}};let i={type:`object`},a={},o=[];for(let i=0;i<e.propertySignatures.length;i++){let s=e.propertySignatures[i];if(typeof s.name!=`string`)throw Pv(`Invalid schema representation document`,[...t,`propertySignatures`,i,`name`]);let c=s.name,l=_(s.type,[...t,`propertySignatures`,i,`type`],n),u=Iv(s.annotations,r);vt(a,c,u===void 0?l:p(Uv(l,u))),s.isOptional||o.push(c)}e.propertySignatures.length>0&&(i.properties=a),o.length>0&&(i.required=o);let s={},c=[],l=[],u=!1;for(let r=0;r<e.indexSignatures.length;r++){let i=e.indexSignatures[r],a=_(i.type,[...t,`indexSignatures`,r,`type`],n);Me(a,{not:{}})&&(a=!1),l.push(a);let o=ne(i.parameter,[...t,`indexSignatures`,r,`parameter`],new Set);if(o===void 0){u=!0,n.push(!1);continue}if(o.length===0)c.push(a);else for(let e of o){let t=s[e];vt(s,e,t===void 0?a:t===!1||a===!1?!1:p(Uv(t,a)))}}let d=Object.keys(s).length>0;if(d&&(i.patternProperties=s),u&&r?.onExcessProperty===`error`){let r=[];e.propertySignatures.length>0&&r.push({enum:Object.keys(a)});for(let i=0;i<e.indexSignatures.length;i++)r.push(_(e.indexSignatures[i].parameter,[...t,`indexSignatures`,i,`parameter`],n));i.propertyNames=r.length===1?r[0]:{anyOf:r},i.additionalProperties=l.length===1?l[0]:{anyOf:l},c.length>0&&(i.allOf=c.map(e=>({type:`object`,additionalProperties:e})))}else c.length===0?i.additionalProperties=u||r?.onExcessProperty!==`error`:c.length===1&&e.propertySignatures.length===0&&!d?i.additionalProperties=c[0]:c.length>0&&(i.allOf=c.map(e=>({type:`object`,additionalProperties:e})));return typeof i.additionalProperties==`object`&&i.additionalProperties!==null&&Object.keys(i.additionalProperties).length===0&&delete i.additionalProperties,i}case`Union`:{let r=[],i=e.types.map((e,n)=>_(e,[...t,`types`,n],r));if(n.push(r),i.length===0)return{not:{}};let a=e.options?.mode??`anyOf`;if(a===`anyOf`&&i.length>1){let e=Jv(i);if(e!==void 0)return e}return a===`oneOf`&&s.set(i,[r,[]]),{[a]:i}}}}function ne(e,t,r){switch(e._tag){case`Reference`:{if(!Object.hasOwn(n,e.$ref))throw Pv(`Invalid reference ${e.$ref}`,[...t,`$ref`]);if(m(e.$ref,t),r.has(e.$ref))return;let i=new Set(r).add(e.$ref);return ne(n[e.$ref],[`references`,e.$ref],i)}case`String`:{if(e.checks.length===0)return[];if(e.checks.length!==1||e.checks[0]._tag!==`Filter`||e.checks[0].annotations?.toJsonSchema===void 0)return;let n=[],r=_(e,t,n);return Wv(n)&&r.type===`string`&&typeof r.pattern==`string`&&zv(r,`|type|pattern|title|description|default|examples|readOnly|writeOnly|`)?[r.pattern]:void 0}case`TemplateLiteral`:return e.checks.length===0?[`^${e.parts.map(Yv).join(``)}$`]:void 0;case`Union`:{if(e.types.length===0||e.checks.length>0||e.options?.mode===`oneOf`)return;let n=[];for(let i=0;i<e.types.length;i++){let a=ne(e.types[i],[...t,`types`,i],r);if(a===void 0)return;if(a.length===0)return[];n.push(...a)}return n}default:throw Pv(`Invalid schema representation document`,t)}}}function qv(e){return e===`string`||e===`number`||e===`boolean`||e===`array`||e===`object`||e===`null`||e===`integer`}function Jv(e){let t,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;for(let e of r.enum){if(n.includes(e))return;n.push(e)}}return{type:t,enum:n}}function Yv(e){switch(e._tag){case`Literal`:return Pte(globalThis.String(e.literal));case`String`:return Xee;case`Number`:return hg;case`TemplateLiteral`:return e.parts.map(Yv).join(``);case`Union`:return`(?:${e.types.map(Yv).join(`|`)})`;default:throw Pv(`Invalid schema representation document`,[])}}function Xv(e,t){let n=Kv([e.representation],[[`representation`]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var Zv=({identifier:e})=>e;function Qv(e){return e===void 0?void 0:{annotations:e}}function $v(e,t){let{references:n,representations:r}=ey([e],t);return{representation:r[0],references:n}}function ey(e,t){let n={},r=new Map,i=new Set,a=new Map,o=new Set;for(let t of e)f(t);let s=t?.referencePolicy??Zv;for(let e of a.values())for(let t of e.values()){let e=s({ast:t.ast,occurrences:t.occurrences,identifier:t.identifier});e===void 0?t.isRecursive&&(t.reference=c(`${t.ast._tag}_`,t,``)):t.reference=c(e,t,e===t.identifier||!e.endsWith(`_`)?`_`:``)}return{representations:bi(e,e=>m(e)),references:n};function c(e,t,n=`_`){let i=e,a=0;for(;r.has(i);){if(r.get(i)===t)return i;i=`${e}${n}${++a}`}return r.set(i,t),i}function l(e,t,n){let r=t.fallback;return r===void 0?n===t.identifier?e:n_(e,{identifier:n}):$m(e)===r?e:n_(e,{[Jm]:r})}function u(e,t){if(!Object.hasOwn(n,e)&&!i.has(e)){i.add(e);let r=h(t);i.delete(e),vt(n,e,r)}return{_tag:`Reference`,$ref:e}}function d(e){let t=t_(e),n=Qg(t),r=Qm(t),i=r===void 0?(t===e?void 0:Qm(e))??$m(t):void 0;i!==void 0&&(r=`${i}Encoded`);let o=a.get(n);o===void 0&&(o=new Map,a.set(n,o));let s=o.get(r);return s===void 0&&(s={ast:n,identifier:r,fallback:i,occurrences:0,isRecursive:!1,reference:void 0},o.set(r,s)),s}function f(e){let t=d(e),n=t.ast;if(t.occurrences++,o.has(t)){t.isRecursive=!0;return}if(!(t.occurrences>1)){switch(o.add(t),p(n.checks),n._tag){case`Declaration`:case`Arrays`:case`Objects`:case`Union`:n.recur(e=>(f(e),e));break;case`TemplateLiteral`:n.parts.forEach(f);break;case`Suspend`:f(n.thunk())}o.delete(t)}}function p(e){e?.forEach(e=>{e.annotations?.representation?.schemas?.forEach(e=>f(x_(e))),e._tag===`FilterGroup`&&p(e.checks)})}function m(e){let t=d(e),n=t.ast,r=t.reference;return r===void 0?h(n):u(r,t.identifier===void 0?n:l(n,t,r))}function h(e){let t=g(e.checks);switch(e._tag){case`Declaration`:return{_tag:`Declaration`,typeParameters:e.typeParameters.map(e=>m(e)),checks:t,..._(e.annotations)};case`Null`:case`Undefined`:case`Void`:case`Never`:case`Unknown`:case`Any`:case`String`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`ObjectKeyword`:return{_tag:e._tag,checks:t,...Qv(e.annotations)};case`Literal`:return{_tag:`Literal`,literal:e.literal,checks:t,...Qv(e.annotations)};case`UniqueSymbol`:return{_tag:`UniqueSymbol`,symbol:e.symbol,checks:t,...Qv(e.annotations)};case`Enum`:return{_tag:`Enum`,enums:e.enums,checks:t,...Qv(e.annotations)};case`TemplateLiteral`:return{_tag:`TemplateLiteral`,parts:e.parts.map(e=>m(e)),checks:t,...Qv(e.annotations)};case`Arrays`:return{_tag:`Arrays`,elements:e.elements.map(e=>{let t=t_(e),n=t.context?.annotations;return{isOptional:g_(t),type:m(e),...Qv(n)}}),rest:e.rest.map(e=>m(e)),checks:t,...Qv(e.annotations)};case`Objects`:return{_tag:`Objects`,propertySignatures:e.propertySignatures.map(e=>{let t=t_(e.type),n=t.context?.annotations;return{name:e.name,type:m(e.type),isOptional:g_(t),isMutable:__(t),...Qv(n)}}),indexSignatures:e.indexSignatures.map(e=>({parameter:m(e.parameter),type:m(e.type)})),checks:t,...Qv(e.annotations)};case`Union`:return{_tag:`Union`,types:e.types.map(e=>m(e)),...e.options===void 0?{}:{options:e.options},checks:t,...Qv(e.annotations)};case`Suspend`:return{_tag:`Suspend`,checks:[],thunk:m(e.thunk()),...Qv(e.annotations)}}}function g(e){return e?.map(ee)??[]}function ee(e){switch(e._tag){case`Filter`:return{_tag:`Filter`,aborted:e.aborted,...te(e.annotations)};case`FilterGroup`:return{_tag:`FilterGroup`,checks:bi(e.checks,ee),...te(e.annotations)}}}function _(e){if(e===void 0)return;let{representation:t,...n}=e;return{...t===void 0?void 0:{representation:t},...Object.keys(n).length===0?void 0:{annotations:n}}}function te(e){if(e===void 0)return;let{representation:t,...n}=e,r=t===void 0?void 0:t.schemas===void 0?t:{...t,schemas:t.schemas.map(e=>m(x_(e)))};return{...r===void 0?void 0:{representation:r},...Object.keys(n).length===0?void 0:{annotations:n}}}}var ty=i(2,(e,t)=>ry(e,(e,n)=>[Object.hasOwn(t,e)?t[e]:e,n])),ny=e=>e;function ry(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let i=t(r,e[r]);if(i){let[e,t]=i;vt(n,e,t)}}return n}var iy=`~effect/Schema/SchemaError`;function ay(e){return de(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}function oy(){return(e,t,n)=>_y(new rg(e.map(Og),e=>t(e.map(e=>_y(e))),n))}function sy(e,t){return oy()([],()=>(t,n,r)=>e(t)?w(t):E(new gh(n,t,r)),t)}var cy=class extends ga(`SchemaError`){[iy]=iy;constructor(e){let t=mt();ht(0);try{super({issue:e})}finally{ht(t)}}get message(){return Cee(this.issue)}toString(){return`SchemaError(${this.message})`}};function ly(e){return ay(e)}function uy(e){return xs(e)?dy(e):Gf(e,e=>Pf(()=>wu(e,e=>new cy(e))))}function dy(e){return Lu(e)?e:Pu(wu(e.cause,e=>new cy(e)))}function fy(e,t){let n;for(let r of e.reasons){if(!bu(r)||!ly(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function py(e){let t=Hp(e);if(Lu(t))return t.value;throw fy(t.cause,`Sync adapter can only throw schema errors`)}function my(e,t){let n=ev(e,t);return(e,t)=>uy(n(e,t))}function hy(e,t){let n=tv(e,t);return(e,t)=>ti(n(e,t),e=>new cy(e))}function gy(e,t){let n=my(e,t);return(e,t)=>py(n(e,t))}var _y=gv,vy=ny(e=>_y(u_(e.ast),{schema:e})),k=ny(e=>{let t=Lte(e);return _y(f_(e.ast),{schema:t})}),yy=ny(e=>_y(S_(e.ast),{schema:e}));function A(e){let t=_y(new sg(e),{literal:e,transform(n){return t.pipe(Py(A(n),{decode:Ph(()=>n),encode:Ph(()=>e)}))}});return t}var by=_y(Pee),xy=_y(og),Sy=_y(ig),Cy=_y(ag),j=_y(lg),wy=_y(dg),M=_y(Iee);function Ty(e,t){return _y(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Ty(Dg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function N(e){return Ty(Dg(e,void 0),e)}var Ey=e=>typeof e==`symbol`?e:globalThis.String(e);function Dy(e){return function(t){let n={},r=Object.create(null),i=Object.create(null),a=new Set;for(let o of Reflect.ownKeys(t.fields)){let s=yy(t.fields[o]),c=Object.hasOwn(e,o),l=c?e[o]:o,u=Ey(l);if(a.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${nt(l)}`);a.add(u),vt(n,l,s),c&&(r[o]=l,i[l]=o)}return N(n).pipe(Py(t,Tee({decode:ty(i),encode:ty(r)})))}}function Oy(e,t){return _y(h_(e.ast,t.ast),{key:e,value:t})}function ky(e,t){return _y(e,{elements:t,mapElements(e,t){let n=e(this.elements);return ky(kg(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ay(e){return ky(kg(e),e)}var P=ny(e=>_y(new fg(!1,[],[e.ast]),{value:e}));function jy(e,t){return _y(e,{members:t,mapMembers(e,t){let n=e(this.members);return jy(Ag(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function F(e,t){return jy(Ag(e,t,void 0),e)}function I(e){let t=e.map(A);return _y(Ag(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return F(e(this.members))},pick(e){return I(e)},transform(e){return F(t.map((t,n)=>t.transform(e[n])))}})}var My=ny(e=>F([e,Sy])),Lte=ny(e=>F([e,Cy]));function Ny(e,t){return n=>_y(i_(n.ast,[Kg(e,t)]),{schema:n})}function Py(e,t){return n=>_y(p_(n.ast,e.ast,t?wee(t):Gh()),{from:n,to:e})}var L=Gg,Fy=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function Rte(e){let t=new globalThis.RegExp(Fy);return L(e=>e.trim()===e,{expected:`a string with no leading or trailing whitespace`,representation:{id:`effect/schema/isTrimmed`,payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:`Schema.isTrimmed()`}),arbitraryConstraint:{patterns:[{source:Fy,flags:``}]},...e})}function R(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new RegExp(${et(n)})`:`new RegExp(${et(n)}, ${et(r)})`;return Yg(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}function zte(e){let t=Qn(e.order),n=e.formatter??et;return(r,i)=>L(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Bte(e){let t=er(e.order),n=e.formatter??et;return(r,i)=>L(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r},...e.annotate?.(r),...i})}function Vte(e){let t=$n(e.order),n=e.formatter??et;return(r,i)=>L(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,maximum:r},...e.annotate?.(r),...i})}function Hte(e){let t=er(e.order),n=Qn(e.order),r=$n(e.order),i=Zn(e.order),a=e.formatter??et;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return L(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitraryConstraint:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(o),...s})}}function Iy(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${et(e)}`);return e}var Ly=zte({order:Yn,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:Iy(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${et(e)})`})})}),z=Bte({order:Yn,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:Iy(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${et(e)})`})})}),Ry=Vte({order:Yn,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:Iy(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${et(e)})`})})}),B=Hte({order:Yn,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:Iy(e.minimum),maximum:Iy(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${et(e.minimum)}, maximum: ${et(e.maximum)}, exclusiveMinimum: ${et(t)}, exclusiveMaximum: ${et(n)} })`})}}});function zy(e){return L(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>[{type:`integer`},!0],toCode:()=>({runtime:`Schema.isInt()`}),arbitraryConstraint:{number:`integer`},...e})}var V=wy.check(zy());function By(e,t){return e=Vy(e),Ute(e,Math.ceil(e/2),t)}function Ute(e,t,n){return L(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:n})=>n===`string`?e<=1?{minLength:t}:[{minLength:t},!0]:n===`array`?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[qm]:!0,arbitraryConstraint:{minLength:e},...n})}function H(e,t){return e=Vy(e),L(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:`effect/schema/isMaxLength`,payload:{maxLength:e}},toJsonSchema:({type:t})=>t===`string`?e===0?{maxLength:e}:[{maxLength:e},!0]:t===`array`?{maxItems:e}:t===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[qm]:!0,arbitraryConstraint:{maxLength:e},...t})}function U(e,t,n){return e=Vy(e),t=Vy(t),L(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:`effect/schema/isBetweenLength`,payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n===`string`?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n===`array`?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[qm]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...n})}function Vy(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function Wte(e,t){return e=Vy(e),L(t=>Reflect.ownKeys(t).length<=e,{expected:`a value with at most ${e===1?`1 entry`:`${e} entries`}`,representation:{id:`effect/schema/isMaxProperties`,payload:{maxProperties:e}},toJsonSchema:({type:t})=>t===`object`?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[qm]:!0,arbitraryConstraint:{maxProperties:e},...t})}globalThis.RegExp,globalThis.URL;var Gte=j.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function Kte(e,t){return Gte.pipe(Py(e,Oee(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var qte=j.check(Rte()),Jte=j.annotate({expected:`a string that will be decoded as a trimmed string`}).pipe(Py(qte,Eee()));globalThis.Uint8Array;function Yte(e,t){return Xv($v(Nv(e.ast),t),t)}var Xte=wo,Zte=Eo,Qte=Do,Hy=Oo,$te=ko,Uy=vl,Wy=Nl,Gy=`~effect/MutableRef`,ene={[Gy]:Gy,...kt,toJSON(){return{_id:`MutableRef`,current:lt(this.current)}}},Ky=e=>{let t=Object.create(ene);return t.current=e,t},tne=i(2,(e,t)=>(e.current=t,e)),nne=Symbol.for(`effect/MutableList/Empty`),rne=()=>({head:void 0,tail:void 0,length:0}),ine=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},qy=()=>({array:[],mutable:!0,offset:0,next:void 0}),Jy=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=qy(),e.tail=e.tail.next):e.head=e.tail=qy(),e.tail.array.push(t),e.length++},Yy=e=>{e.head=e.tail=void 0,e.length=0},Xy=e=>{if(!e.head)return nne;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:Yy(e):ine(e),t},ane=`~effect/Queue`,one=`~effect/Queue/Enqueue`,sne=`~effect/Queue/Dequeue`,Zy={_A:a,_E:a},cne={[ane]:Zy,[one]:Zy,[sne]:Zy,...kt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:lb(this)}}},Qy=e=>sn(t=>{let n=Object.create(cne);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=rne(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},x(n)}),$y=e=>Qy({capacity:e}),eb=e=>Qy({capacity:e,strategy:`sliding`}),tb=i(2,(e,t)=>Mo(()=>nb(e,t)?db:e.state._tag===`Open`&&e.strategy===`suspend`?vb(e,t):ub)),nb=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(Xy(e.messages),Jy(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(Jy(e.messages,t),mb(e),!0):(Jy(e.messages,t),hb(e),!0):!1,rb=i(2,(e,t)=>jo(()=>ib(e,t))),ib=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Ms(rn(t),fb);return e.state.offers.size===0&&e.messages.length===0?(Cb(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},hb(e),!0)},ab=e=>jo(()=>ob(e)),ob=e=>{if(e.state._tag===`Done`)return!1;Yy(e.messages);let t=e.state.offers;Cb(e,e.state._tag===`Open`?pb:e.state.exit);for(let e of t)bb(e);return!0},sb=e=>Mo(()=>cb(e)??ps(_b(e,()=>gb(e,1)),sb(e))),cb=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=Xy(e.messages);return Sb(e),en(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=xb(e.state.offers);return Sb(e),en(t)}},lb=e=>e.state._tag===`Done`?0:e.messages.length,ub=en(!1),db=en(!0),fb=an(gn()),pb=Es(),mb=e=>{if(e.state._tag!==`Done`&&e.state.takers.size!==0){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(As),e.messages.length===0))break}},hb=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,mb(e)},0))},gb=(e,t)=>e.messages.length>=(e.state._tag===`Closing`?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!==`Done`&&e.state.offers.size>0,_b=(e,t)=>Wo(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(As);let r={ready:t,resume:n};return e.state.takers.add(r),jo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),vb=(e,t)=>Wo(n=>nb(e,t)?n(db):yb(e,{_tag:`Single`,message:t,resume:n})),yb=(e,t)=>{if(e.state._tag!==`Open`)return bb(t);let n=e.state.offers;return n.add(t),jo(()=>{e.state._tag!==`Done`&&(n.delete(t),e.state._tag===`Closing`&&n.size===0&&e.messages.length===0&&Cb(e,e.state.exit))})},bb=e=>e._tag===`Single`?e.resume(ub):e.resume(en(e.remaining.slice(e.offset))),xb=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(db),t.message;let n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(en([]))),n},Sb=e=>{if(e.state._tag===`Done`)return Gd(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(Cb(e,e.state.exit),Gd(e.state.exit.cause));for(let t of e.state.offers){let n=e.capacity-e.messages.length;if(n<=0)break;if(t._tag===`Single`)Jy(e.messages,t.message),e.state.offers.delete(t),t.resume(db);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;Jy(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(en([]))}}return!1},Cb=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e.resume(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},wb=e=>new Eb(e),Tb=(e,t,n)=>Wo(r=>{if(e.free>=t)return r(n);let i=()=>{e.free<t||(e.waiters.delete(i),r(n))};return e.waiters.add(i),jo(()=>{e.waiters.delete(i)})}),Eb=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=Mo(()=>this.free<e?Tb(this,e,t):(this.taken+=e,x(e)));return t}takeIfAvailable(e){return Mo(()=>this.free<e?x(!1):(this.taken+=e,x(!0)))}releaseUnsafe(e,t){return this.taken-=t,this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{for(let e of this.waiters){if(this.free<=0)break;e()}},0),this.free}resize(e){return sn(t=>(this.permits=e,this.free<0||this.releaseUnsafe(t,0),C))}release(e){return sn(t=>x(this.releaseUnsafe(t,e)))}get releaseAll(){return sn(e=>x(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>il(n=>{let r=Mo(()=>this.free<e?bs(n(Tb(this,e,C)),()=>r):(this.taken+=e,Vc(n(t),()=>{this.releaseUnsafe(_o(),e)},!0)));return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>il(n=>this.free<e?Po:(this.taken+=e,Vc(n(fs(t)),()=>{this.releaseUnsafe(_o(),e)},!0)))}},Db=e=>jo(()=>new Eb(e)),Ob=`~effect/Channel`,kb=e=>de(e,Ob),Ab={[Ob]:{_Env:a,_InErr:a,_InElem:a,_OutErr:a,_OutElem:a},pipe(){return t(this,arguments)}},jb=e=>{let t=Object.create(Ab);return t.transform=(t,n)=>Gf(e(t,n),e=>w(Nf(e))),t},Mb=(e,t)=>jb((n,r)=>D(Fb(e)(n,r),e=>t(e,r))),Nb=e=>jb((t,n)=>e),Pb=e=>jb(Wp(function*(t,n){let r=Xu(n),i=e=>Zu(r,Yd(e));return bp(yield*bp(e(t,n,r),i),i)})),Fb=e=>e.transform,Ib=e=>jb((t,n)=>kf(()=>Fb(e())(t,n))),Lb=Nb(w(ju())),Rb=e=>Nb(w(E(e))),zb=e=>Nb(Nf(e)),Bb=e=>jb((t,n)=>Vb({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),Vb=e=>{let t=e.readable.getReader(),n=e.exit??Ky(void 0),r=kf(()=>n.current?n.current:sp(Of({try:()=>t.read(),catch:e.onError}),{onFailure:e=>n.current??Nf(e),onSuccess:({done:e,value:t})=>n.current?n.current:e?ju():w(yi(t))}));return Hf(Yu(e.scope,e.releaseLockOnEnd?T(()=>t.releaseLock()):Df(()=>t.cancel().catch(u))),r)},Hb=i(2,(e,t)=>Mb(e,e=>T(()=>{let n=0;return O(e,e=>t(e,n++))}))),Ub=e=>e===void 0||e!==`unbounded`&&e<=1,Wb=i(e=>kb(e[0]),(e,t,n)=>Ub(n?.concurrency)?Gb(e,t):Kb(e,t,n)),Gb=(e,t)=>jb((n,r)=>{let i=0;return O(Fb(e)(n,r),D(e=>t(e,i++)))}),Kb=(e,t,n)=>Pb(Wp(function*(r,i,a){let s=0,c=yield*Fb(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*$y(0);yield*Yu(a,ab(u));let d=Np(yield*lp()),f=Uy(a);if(n.unordered){let e=wb(l),n=o(e.release(1)),r=sp({onFailure:e=>D(rb(u,e),n),onSuccess:e=>D(tb(u,e),n)});yield*e.take(1).pipe(D(()=>c),D(e=>{let n=s++;return f(d(r(kf(()=>t(e,n))))),Af}),Ep({disableYield:!0}),Gf(t=>e.withPermits(l-1)(rb(u,t))),jp(a))}else{let e=yield*$y(l-2);yield*Yu(a,ab(e)),yield*sb(e).pipe(Rf,D(e=>tb(u,e)),Ep({disableYield:!0}),Gf(e=>rb(u,e)),jp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,ib(u,e.cause))};yield*c.pipe(D(i=>{if(n)return Nf(n);let a=s++,o=d(kf(()=>t(i,a)));return f(o),o.addObserver(r),tb(e,Zte(o))}),Ep({disableYield:!0}),Gf(t=>tb(e,Pu(t)).pipe(zf(rb(e,t)))),jp(a))}return sb(u)})),qb=e=>Mb(e,e=>{let t,n=0;return w(kf(function r(){if(t===void 0)return D(e,e=>{switch(e.length){case 0:return r();case 1:return w(e[0]);default:return t=e,w(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),w(i)}))}),Jb=i(2,(e,t)=>of(typeof t==`function`?t(a):t).pipe(O(t=>{let n=Qd.defaultValue();return Yb(lx(e,Qd,T(()=>n)),e=>t(e).pipe(O(e=>{n=e}),Wd(()=>ju(e))))}),rx)),Yb=(e,t)=>jb((n,r)=>T(()=>{let i,a=()=>{let o=Xu(r);return D(Fb(e)(n,o),e=>(i=Wd(e,e=>Zu(o,Iu).pipe(D(()=>t(e)),D(a))),i))};return kf(()=>i??a())})),Xb=i(2,(e,t)=>Mb(e,e=>w(D(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return gi(i)?w(i):D(e,n)})))),Zb=i(2,(e,t)=>jb((n,r)=>{let i=Xu(r);return O(Fb(e)(n,i),e=>{let a=e.pipe(Gf(e=>{if(Gd(e))return Nf(e);let o=i;return i=Xu(r),Zu(o,Pu(e)).pipe(zf(Fb(t(e))(n,i)),D(e=>(a=e,e)))}));return kf(()=>a)})})),Qb=i(3,(e,t,n)=>Zb(e,e=>{let r=t(e);return $r(r)?zb(r.failure):n(r.success,e)})),$b=i(2,(e,t)=>Qb(e,Eu,e=>t(e))),ex=i(2,(e,t)=>Mb(e,e=>w(Yf(e,e=>Au(e)?Af:Uf(t(e)))))),tx=i(2,(e,t)=>Ib(()=>{let n,r=Qd.defaultValue(),i=ax(lx(e,Qd,T(()=>r)),()=>(n=void 0,Af)),o=typeof t==`function`?t(a):t,s=$b(i,Wp(function*(e){return n||=yield*of(o),r=yield*n(e),s},(e,t)=>Wd(e,()=>w(Rb(t))),rx));return s})),nx=i(e=>kb(e[0])&&kb(e[1]),(e,t,n)=>Pb(Wp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*$y(0);yield*Yu(a,ab(s));let c=0;function l(e,t){if(c++,!Gd(t))return rb(s,t);switch(o){case`both`:return c===2?rb(s,t):Af;case`left`:case`right`:return e===o?rb(s,t):Af;case`either`:return rb(s,t)}}let u=(e,t,n)=>Fb(t)(r,n).pipe(D(e=>e.pipe(D(e=>tb(s,e)),Ep)),bp(t=>zf(Zu(n,Yd(t)),l(e,t))),jp(a));return yield*u(`left`,e,Xu(a)),yield*u(`right`,t,Xu(a)),sb(s)}))),rx=e=>jb((t,n)=>{let r;return w(kf(()=>r||e.pipe(qu(n),D(e=>Fb(e)(t,n)),D(e=>r=e))))}),ix=i(2,(e,t)=>Pb((n,r,i)=>Ju(i,t).pipe(zf(Fb(e)(n,r))))),ax=i(2,(e,t)=>Mb(e,e=>T(()=>{let n=!0,r=Bf(e,e=>(n=!1,t(e)));return kf(()=>n?r:e)}))),ox=i(2,(e,t)=>ix(e,e=>t)),sx=(e,t,n)=>kf(()=>{let r=Ku();return Wd(D(Fb(e)(ju(),r),t),n||w).pipe(xp(e=>Zu(r,e)))}),cx=i(3,(e,t,n)=>jb((r,i)=>O(hp(Fb(e)(r,i),t,n),hp(t,n)))),lx=i(3,(e,t,n)=>jb((r,i)=>D(n,n=>Fb(cx(e,t,n))(r,i)))),ux=i(2,(e,t)=>sx(e,e=>Ep(D(e,t),{disableYield:!0}))),dx=(e,t)=>Fb(e)(ju(),t),fx=`~effect/Stream`,px={_R:a,_E:a,_A:a},mx=function(e){this.channel=e};mx.prototype={[fx]:px,pipe(){return t(this,arguments)}};var hx=e=>new mx(e),gx=`~effect/Sink`,_x={_A:a,_In:a,_L:a,_E:a,_R:a},vx={[gx]:_x,pipe(){return t(this,arguments)}},yx=e=>{let t=Object.create(vx);return t.transform=e,t},bx=e=>{let t=Jr(e);return yx(e=>{let n=[];if(t===0)return w([n]);let r;return e.pipe(D(e=>{if(n.length+e.length<=t)return n.push(...e),n.length===t?ju():Af;for(let i=0;i<e.length;i++)if(n.push(e[i]),n.length===t)return i+1<e.length&&(r=e.slice(i+1)),ju();return Af}),Ep({disableYield:!0}),Wd(()=>w([n,r])))})},xx=`~effect/Stream`,Sx=e=>de(e,xx),Cx=hx,wx=e=>Tx(T(()=>{let t=!0,n=w(yi(void 0)),r=tp(n,e);return kf(()=>t?(t=!1,n):r)})),Tx=e=>Cx(Nb(e)),Ex=(e,t)=>Cx(jb((n,r)=>D(dx(e.channel,r),e=>t(e,r)))),Dx=e=>e.channel,Ox=Cx(Lb),kx=e=>Cx(Ib(()=>e().channel)),Ax=e=>Cx(Rb(e)),jx=e=>Cx(Bb(e)),Mx=e=>Cx(rx(O(e,Dx))),Nx=i(e=>Sx(e[0]),(e,t,n)=>e.channel.pipe(qb,Wb(t,n),Hb(yi),Cx)),Px=i(2,(e,t)=>Cx(Jb(e.channel,t))),lne=i(e=>Sx(e[0])&&Sx(e[1]),(e,t,n)=>Cx(nx(Dx(e),Dx(t),n))),Fx=i(2,(e,t)=>Cx(Xb(Dx(e),t))),une=i(2,(e,t)=>e.channel.pipe(ex(t),Cx)),dne=i(2,(e,t)=>Cx(tx(e.channel,t))),fne=i(2,(e,t)=>Ex(e,Wp(function*(e,n){let r=yield*wd,i=Xi(Mi(t)),a,o,s=1/0,c=Wy(),l=Wy(),u=Wy();yield*e.pipe(c.whenOpen,D(e=>(l.openUnsafe(),a=e,s=r.currentTimeMillisUnsafe()+i,Af)),Ep({disableYield:!0}),bp(e=>(o=e,s=r.currentTimeMillisUnsafe(),l.openUnsafe(),u.openUnsafe(),Af)),jp(n));let d=kf(function e(){let t=r.currentTimeMillisUnsafe();return D(ip(np(s<t?i:Math.min(i,s-t)),u.await),()=>{if(r.currentTimeMillisUnsafe()<s)return e();if(a){l.closeUnsafe(),c.closeUnsafe();let e=w(yi(_i(a)));return a=void 0,e}return o?Nf(o):e()})});return kf(()=>{if(o){if(a){let e=w(yi(_i(a)));return a=void 0,e}return Nf(o)}return c.openUnsafe(),l.whenOpen(d)})}))),pne=i(3,(e,t,n)=>mne(e,bx(Yr(t)),ff(n))),mne=i(3,(e,t,n)=>Cx(Pb(Wp(function*(r,i,a){let o=yield*dx(e.channel,i),s=Wy(!1),c=Symbol(),l=yield*Qy({capacity:0});yield*o.pipe(s.whenOpen,D(e=>(s.closeUnsafe(),tb(l,e))),Ep,Gf(e=>rb(l,e)),jp(a));let u=nr(),d,f=!1,p=yield*sf(n),m=kf(function e(){return D(p(u),()=>f?tb(l,c):e())}).pipe(D(()=>jf),Wd(()=>ju())),h=sb(l).pipe(D(e=>e===c?ju():(f=!0,w(e)))),g=kf(()=>{if(d!==void 0){let e=d;return d=void 0,f=!0,w(e)}return s.openUnsafe(),h}),ee=D(([e,t])=>!f&&l.state._tag===`Done`?ju():(u=rr(e),d=t,w(yi(e))));return kf(()=>l.state._tag===`Done`&&d===void 0?l.state.exit:(f=d!==void 0,w(kf(()=>t.transform(g,a))))).pipe(D(e=>ip(ee(e),m)))})))),hne=i(2,(e,t)=>Cx(ox(e.channel,t))),Ix=i(2,(e,t)=>ux(e.channel,e=>{let n=0;return Ef({while:()=>n<e.length,body:()=>t(e[n++]),step:u})})),gne=i(2,(e,t)=>ux(e.channel,t)),_ne=i(e=>Sx(e[0]),(e,t,n)=>{let r,i,a=Wy(!1);return new ReadableStream({start(n){i=Mp(fp(gne(e,e=>a.whenOpen(T(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Tu(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return Ip(Uf(Qte(i)))}},n?.strategy)}),vne=i(e=>Sx(e[0]),(e,t)=>O(lp(),n=>_ne(e,n,t))),Lx=`~effect/FiberHandle`,yne=e=>de(e,Lx),bne={[Lx]:Lx,...kt,toJSON(){return{_id:`FiberHandle`,state:this.state}}},xne=()=>{let e=Object.create(bne);return e.state={_tag:`Open`,fiber:void 0},e.deferred=Vu(),e},Sne=()=>_p(T(()=>xne()),e=>{let t=e.state;return t._tag===`Closed`?Af:(e.state={_tag:`Closed`},t.fiber?Gu(Uf(Hy(t.fiber,Rx)),e.deferred):Uu(e.deferred,Iu))}),Rx=-1,Cne=ia(oa(ku,aa(Rx))),wne=i(e=>yne(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(Rx);return}if(e.state.fiber!==void 0){if(e.state.fiber===t)return;if(n?.onlyIfMissing===!0){t.interruptUnsafe(Rx);return}e.state.fiber.interruptUnsafe(Rx),e.state.fiber=void 0}e.state.fiber=t,t.addObserver(r=>{e.state._tag===`Open`&&t===e.state.fiber&&(e.state.fiber=void 0),Ru(r)&&(n?.propagateInterruption===!0?!Cne(r.cause):!Cu(r.cause))&&Wu(e.deferred,r)})}),Tne=e=>Tp(t=>{if(e.state._tag===`Closed`||e.state.fiber===void 0)return Af;let n=e.state.fiber;return zf(t(Hy(n,Rx)),T(()=>{e.state._tag===`Open`&&e.state.fiber===n&&(e.state.fiber=void 0)}))}),Ene=function(){let e;return()=>(e===void 0&&(e=Mp(Cp)),e)}(),Dne=function(){let e=arguments[0];if(Cf(arguments[1]))return zx(e,arguments[1],arguments[2]);let t=arguments[1];return n=>zx(e,n,t)},zx=(e,t,n)=>Lf(r=>{if(e.state._tag===`Closed`)return Cp;if(e.state.fiber!==void 0&&n?.onlyIfMissing===!0)return T(Ene);let i=hl(r,t,n?.startImmediately??!0,!0);return wne(e,i,n),w(i)}),Bx=`~effect/FiberSet`,One=e=>de(e,Bx),kne={[Bx]:Bx,[Symbol.iterator](){return this.state._tag===`Closed`?oi():this.state.backing[Symbol.iterator]()},...kt,toJSON(){return{_id:`FiberSet`,state:this.state}}},Ane=(e,t)=>{let n=Object.create(kne);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},jne=()=>_p(T(()=>Ane(new Set,Vu())),e=>kf(()=>{let t=e.state;if(t._tag===`Closed`)return Af;e.state={_tag:`Closed`};let n=t.backing;return $te(n).pipe(Gu(e.deferred))})),Mne=()=>D(jne(),e=>Ine(e)()),Vx=-1,Nne=ia(oa(ku,aa(Vx))),Pne=i(e=>One(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(Vx);return}e.state.backing.has(t)||(e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),Ru(r)&&(n?.propagateInterruption===!0?!Nne(r.cause):!Cu(r.cause))&&Wu(e.deferred,r))}))}),Fne=function(){let e;return()=>(e===void 0&&(e=Mp(Cp)),e)}(),Ine=e=>()=>O(lp(),t=>{let n=Np(t);return(t,r)=>{if(e.state._tag===`Closed`)return Fne();let i=n(t,r);return Pne(e,i,r),i}}),Hx=`~effect/ManagedRuntime`,Lne=(e,t)=>{let n=t?.memoMap??sd(),r=Ku(`sequential`),i=Xu(r,`sequential`),a={onFiberStart:Uy(Xu(r,`parallel`))},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=Lf(t=>(s||=Mp(Bf(ud(e,n,i),e=>T(()=>{l.cachedContext=e})),{...a,scheduler:t.cache.scheduler}),Rf(Xte(s)))),l={[Hx]:Hx,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?Ip(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return Ip(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:kf(()=>(l.contextEffect=Ff(`ManagedRuntime disposed`),l.cachedContext=void 0,Zu(l.scope,Iu))),runFork(e,t){return l.cachedContext===void 0?Mp(Ux(l,e),o(t)):Np(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?Fp(Ux(l,e),o(t)):Pp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Hp(Ux(l,e)):Up(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Bp(Ux(l,e)):Vp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Rp(Ux(l,e),o(t)):zp(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Ip(Ux(l,e),o(t)):Lp(l.cachedContext)(e,o(t))}};return l};function Ux(e,t){return D(e.contextEffect,e=>fp(t,e))}var Rne={"~effect/Ref":{_A:a},...kt,toJSON(){return{_id:`Ref`,ref:this.ref}}},zne=e=>{let t=Object.create(Rne);return t.ref=Ky(e),t},Wx=e=>T(()=>zne(e)),Gx=e=>T(()=>e.ref.current),Kx=i(2,(e,t)=>T(()=>tne(e.ref,t))),Bne=i(2,(e,t)=>T(()=>{let n=e.ref.current;return e.ref.current=t,n})),Vne=i(2,(e,t)=>T(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),Hne=i(2,(e,t)=>T(()=>{e.ref.current=t(e.ref.current)})),Une=i(2,(e,t)=>T(()=>e.ref.current=t(e.ref.current))),qx=Symbol.for(`@maiaos/sdk/MaiaClientError`),W=class e extends Error{code;remoteError;synthetic;constructor(e,t,n){super(t,n),this.name=`MaiaClientError`,this.code=e,this.remoteError=n?.remoteError,this.synthetic=n?.synthetic===!0,Object.defineProperty(this,qx,{value:!0})}static[Symbol.hasInstance](t){return super[Symbol.hasInstance](t)||this===e&&typeof t==`object`&&!!t&&qx in t}},Wne=new Set([`port_lease_conflict`,`revision_conflict`,`storage_conflict`]),Gne=new Set([`port_lease_not_found`,`resource_not_found`]),Kne=new Set([`authentication_failed`,`authorization_failed`,`role_denied`,`terminal_program_not_admitted`]),qne=new Set([`command_not_implemented`,`unsupported_method`]),Jx=(e,t,n)=>({...n===void 0?{}:{code:n},kind:e,retryable:t}),Yx=e=>{let t=e.cause;return typeof t==`object`&&t?Reflect.get(t,`reason`):void 0},Xx=e=>{if(e===`cancelled_before_dispatch`)return Jx(`cancelled`,!0,e);if(e===`deadline_before_dispatch`)return Jx(`offline`,!0,e);if(e===`confirmation_declined`)return Jx(`declined`,!1,`confirmation_declined`);if(e===`confirmation_unavailable`)return Jx(`refused`,!0,`confirmation_unavailable`);if(e===`request_denied`||e===`credential_invalid`)return Jx(`denied`,!1,e)},Jne=e=>Xx(Yx(e))!==void 0,Yne=e=>e.code===`outcome_unknown`?Jx(`outcome_unknown`,!0,e.code):Kne.has(e.code)?Jx(`denied`,!1,e.code):Wne.has(e.code)?Jx(`conflict`,!1,e.code):Gne.has(e.code)?Jx(`not_found`,!1,e.code):qne.has(e.code)?Jx(`unavailable`,!1,e.code):Jx(`refused`,e.retryable,e.code),Xne=new Set([`protocol_incompatible`,`saturated`]),Zne=(e,t)=>({...Yne(e),...t===!1&&Xne.has(e.code)?{message:e.message}:{},...e.resource===void 0?{}:{resource:e.resource},...e.saturation===void 0?{}:{saturation:e.saturation}}),Zx=(e,t)=>Jx(t?`outcome_unknown`:`offline`,!0,e),Qne=(e,t)=>{switch(e.code){case`cancelled`:return Jx(`cancelled`,!0,e.code);case`correlation_mismatch`:case`invalid_response`:return t?Jx(`outcome_unknown`,!0,e.code):Jx(`invalid`,!1,e.code);case`deadline_exceeded`:case`saturated`:return Jx(`offline`,!0,e.code);case`invalid_request`:return Jx(`invalid`,!1,e.code);case`outcome_unknown`:return Jx(`outcome_unknown`,!0,e.code);case`remote_error`:case`transport_failure`:return Zx(e.code,t)}},$ne=(e,t)=>{if(!(e instanceof W))return Zx(`transport_failure`,t);let n=Xx(Yx(e));return n===void 0?e.remoteError===void 0?Qne(e,t):Zne(e.remoteError,e.synthetic):n},Qx=(e,t)=>({_tag:`MaiaError`,...$ne(e,t.mutation),...t.operationId===void 0?{}:{operationId:t.operationId}}),$x={errors:`all`,onExcessProperty:`error`,reportInput:!1},G=e=>{let t=gy(e,$x),n=hy(e,$x);return{parse:t,safeParse:e=>ni(n(e),{onFailure:e=>({error:e,success:!1}),onSuccess:e=>({data:e,success:!0})})}},eS=`maia.protocol/v1alpha1`,ere=[eS],tre=/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u,nre=/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u,rre=/^\p{Cf}$/u,ire=new Set([8204,8205]),are=e=>{let t=e.codePointAt(0)??0;return t<=31||t>=127&&t<=159||t===8232||t===8233||rre.test(e)&&!ire.has(t)},tS=e=>Array.from(e,are).includes(!0),nS=Jte.check(U(1,128),L(e=>Array.from(e,e=>{let t=e.codePointAt(0);return t!==void 0&&t>31&&(t<127||t>159)&&t!==8232&&t!==8233}).every(Boolean),{expected:`a display name without terminal or line controls`})),rS=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/u,K=j.check(U(20,64),R(rS),L(e=>rS.test(e)&&or(dm(e),{onNone:()=>!1,onSome:t=>pm(t).slice(0,19)===e.slice(0,19)}),{expected:`a valid UTC calendar timestamp`})),q=j.check(U(1,19),R(/^(?:0|[1-9]\d*)$/u),L(e=>/^(?:0|[1-9]\d*)$/u.test(e)&&BigInt(e)<=9223372036854775807n,{expected:`a signed 64-bit non-negative revision`})),iS=I(ere),J=j.check(U(1,128),R(tre)),aS=I([`request`,`response`,`event`]),ore=N({correlationId:k(J),kind:aS,messageId:J,payload:xy,protocolVersion:iS}),sre=N({correlationId:k(J),kind:A(`request`),messageId:J,payload:xy,protocolVersion:iS}),cre=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({ok:A(!0),result:xy}),protocolVersion:iS}),oS=j.check(U(1,64),R(nre)),sS={code:oS,resource:k(I([`cpu`,`disk`,`memory`])),saturation:k(I([`admission`,`account`,`host`]))},cS=[L(e=>e.saturation===void 0||e.code===`saturated`,{expected:`a saturation kind only on a saturated error`}),L(e=>e.resource===void 0||e.saturation===`host`,{expected:`a resource only on a host saturation`}),L(e=>e.saturation!==`host`||e.resource!==void 0,{expected:`a resource on every host saturation`})],lS=N({...sS,message:j.check(U(1,1024)),retryable:M}).check(...cS),uS=N({code:oS,message:j.check(U(1,256))}),dS=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({error:lS,ok:A(!1)}),protocolVersion:iS}),fS=J.check(R(/^agent_[a-f0-9]{32}$/u)),pS=N({contentDigest:j.check(R(/^sha256:[a-f0-9]{64}$/u)),key:j.check(U(1,128),R(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/u)),version:j.check(U(1,128),R(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/u))}),Y=N({actorId:J,aggregateRevision:q,commandId:J,createdAt:K,eventCursor:q,method:J,proposedBy:k(J),receiptId:J,schemaVersion:A(1),state:A(`succeeded`),target:N({id:J,type:J}),updatedAt:K}),mS=N({commandId:J}),hS=N({eventsPruned:k(A(!0)),method:A(`receipt.get`),receipt:Y,result:xy}),gS=J,lre=J,ure=e=>{if(e.since===void 0||e.until===void 0)return!0;let t=dm(e.since),n=dm(e.until);return ar(t)&&ar(n)&&fm(t.value)<=fm(n.value)},dre=e=>N({actor:k(J),afterCursor:k(gS),limit:V.check(z(1),Ry(32)),method:k(e),since:k(K),until:k(K)}).check(L(ure,{expected:`an inclusive since/until recorded-at range`})),_S=N({commandId:J,createdAt:K,method:lre,receiptId:J,state:A(`succeeded`),target:N({id:J,type:J})}),vS=N({items:P(_S).check(H(32)),method:A(`receipt.list`),nextCursor:k(gS)}),X={antigravity:`antigravity`,claudeCode:`claude-code`,codex:`codex-cli`,grokCli:`grok-cli`,maiaAgent:`maia-agent`,pi:`pi`},yS=[X.claudeCode,X.codex],fre=[...yS,X.antigravity,X.grokCli,X.maiaAgent,X.pi],bS=[`approvals`,`attachments`,`contextHandoff`,`fork`,`interrupt`,`planMode`,`policyEnforcement`,`queue`,`resume`,`steer`,`streaming`,`toolsAndMcp`,`turnStart`],xS=/^[!-~]+$/u,pre=e=>e===`localhost`||e===`[::1]`||/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/u.test(e),SS=j.check(L(e=>{if(e.length>2048||!xS.test(e)||!URL.canParse(e))return!1;let t=new URL(e),n=t.protocol===`https:`||t.protocol===`http:`&&pre(t.hostname),r=t.pathname===`/`?``:t.pathname;return n&&t.username===``&&t.password===``&&t.search===``&&t.hash===``&&!e.includes(`?`)&&!e.includes(`#`)&&!r.endsWith(`/`)&&!r.endsWith(`/v1`)&&`${t.origin}${r}`===e},{expected:`an https URL, or http to a loopback host, without credentials, query, fragment, trailing slash or trailing /v1`})),mre=j.check(U(8,4096),R(xS)),CS=j.check(H(64),R(/^MAIA_GATEWAY_API_KEY(?:_[A-Z0-9]+)*$/u)),wS=j.check(U(1,256),R(/^[A-Za-z0-9][A-Za-z0-9._:/@-]*$/u)),TS=j.check(U(1,256),R(/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u)),ES=`maia.connection/v1`,DS=I(yS),hre=I([...yS,`gateway`]),gre=I([`maia-managed`,`system-default`]),OS=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),kS=I([`disabled`,`enabled`]),AS=V.check(B({maximum:64,minimum:1})),jS=q.check(R(/^[1-9]\d*$/u)),MS=j.check(U(2,4096),L(e=>!e.includes(`\0`)&&(e.startsWith(`/`)||/^[A-Za-z]:\\/u.test(e)))),_re=F([N({kind:A(`maia-managed`),path:MS}),N({kind:A(`system-default`)})]),NS=e=>j.check(U(1,e)),vre=N({id:j.check(U(1,64),R(/^[a-z0-9][a-z0-9_]*$/u)),kind:I([`session`,`weekly`,`other`]),resetsAt:k(K),usedPercent:wy.check(B({maximum:100,minimum:0})),windowMinutes:k(V.check(B({maximum:527040,minimum:1})))}),yre=N({availableCount:V.check(B({maximum:1e3,minimum:0})),nextCreditId:k(NS(128)),nextExpiresAt:k(K)}),bre=I([`probe_failed`,`signed_out`,`unsupported`]),PS=N({account:k(N({email:k(NS(320)),plan:k(NS(64))})),checkedAt:K,resetCredits:k(yre),unavailable:k(N({message:k(NS(512)),reason:bre})),windows:P(vre).check(H(8))}).check(L(e=>new Set(e.windows.map(e=>e.id)).size===e.windows.length&&(e.unavailable===void 0||e.windows.length===0))),FS=N({configRoot:_re,connectionId:J,createdAt:K,executor:hre,gateway:k(N({baseUrl:SS,keyEnv:k(CS)})),limitedUntil:My(K),maxConcurrentSessions:AS,name:OS,revision:jS,schemaVersion:A(ES),state:kS,updatedAt:K,usage:k(PS)}).check(L(e=>Date.parse(e.updatedAt)>=Date.parse(e.createdAt)),L(e=>e.executor===`gateway`==(e.gateway!==void 0)&&(e.executor!==`gateway`||e.configRoot.kind===`maia-managed`&&e.limitedUntil===null&&e.usage===void 0),{expected:`a gateway record with a base URL and a Maia-managed root, or a vendor account without one`})),IS=N({commandId:J,configRootKind:gre,executor:DS,maxConcurrentSessions:k(AS),name:OS}),LS=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1}))}),RS=N({connectionId:J}),zS=N({commandId:J,connectionId:J,expectedRevision:jS,state:kS}),BS=N({commandId:J,connectionId:J,expectedRevision:jS,maxConcurrentSessions:AS}),VS=N({connectionId:J,refresh:k(M)}),HS=N({commandId:J,connectionId:J,expectedRevision:jS,flow:I([`browser`,`device-code`])}),US=N({apiKey:k(mre),apiKeyEnv:k(CS),baseUrl:SS,commandId:J,maxConcurrentSessions:k(AS),name:OS}).check(L(e=>e.apiKey===void 0!=(e.apiKeyEnv===void 0),{expected:`exactly one of apiKey and apiKeyEnv`})),WS=N({connectionId:J}),xre=F([N({method:A(`connection.create`),parameters:IS}),N({method:A(`connection.list`),parameters:LS}),N({method:A(`connection.show`),parameters:RS}),N({method:A(`connection.state.set`),parameters:zS}),N({method:A(`connection.capacity.set`),parameters:BS}),N({method:A(`connection.usage.show`),parameters:VS}),N({method:A(`connection.login.start`),parameters:HS}),N({method:A(`connection.gateway.create`),parameters:US}),N({method:A(`connection.models.list`),parameters:WS})]),Sre=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),GS=j.check(R(/^sha256:[a-f0-9]{64}$/u)),KS=q.check(R(/^[1-9]\d*$/u)),qS=N({id:J,kind:I([`project`,`workspace`])}),JS=I([`active`,`revoked`]),YS=I([`off`,`rotate`,`single`]),XS=P(J).check(H(32),L(e=>new Set(e).size===e.length,{expected:`unique pool members`})),ZS=e=>e.mode===`off`?e.members.length===0:e.mode===`single`?e.members.length===1:e.members.length>0,QS=e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt),$S=N({connectionId:J,createdAt:K,grantId:J.check(R(/^grant_[a-f0-9]{32}$/u)),revision:KS,schemaVersion:A(ES),scope:qS,state:JS,updatedAt:K}).check(L(QS),L(e=>e.state===`active`==(BigInt(e.revision)%2n==1n),{expected:`an active grant at an odd revision`})),eC=N({createdAt:K,members:XS,mode:YS,poolId:J.check(R(/^pool_[a-f0-9]{32}$/u)),revision:KS,schemaVersion:A(ES),scope:qS,updatedAt:K}).check(L(QS),L(ZS,{expected:`members that fit the mode`})),tC={afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),scope:k(qS)},nC=N({...tC,connectionId:k(J),state:k(JS)}),rC=N(tC),iC=e=>new Set(e).size===e.length,aC=N({items:P($S).check(H(100)),method:A(`connection.grant.list`),nextCursor:k(J)}).check(L(e=>iC(e.items.map(e=>e.grantId))&&(e.nextCursor===void 0||e.items.length>0))),oC=N({items:P(eC).check(H(100)),method:A(`connection.pool.list`),nextCursor:k(J)}).check(L(e=>iC(e.items.map(e=>e.poolId))&&(e.nextCursor===void 0||e.items.length>0))),sC={inputDigest:GS,proof:Sre},cC={actorId:J,expectedRevision:q,expiresAt:K,issuedAt:K,...sC},lC=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),uC={commandId:J,connectionId:J,granted:M,scope:qS},dC={commandId:J,members:XS,mode:YS,scope:qS},fC={actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),expectedRevision:q,inputDigest:GS,receipt:Y},pC=N(uC),mC=N({...uC,expectedRevision:q,...sC}),hC=N(dC).check(L(ZS)),gC=N({...dC,expectedRevision:q,...sC}).check(L(ZS)),_C=N({...uC,...cC,current:k($S),method:A(`connection.grant.set.preview`)}).check(L(lC)),vC=N({...dC,...cC,current:k(eC),method:A(`connection.pool.set.preview`)}).check(L(lC),L(ZS)),yC=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===e.target.type&&e.receipt.target.id===e.target.id&&e.receipt.aggregateRevision===e.record.revision&&e.receipt.createdAt===e.record.updatedAt&&BigInt(e.record.revision)===BigInt(e.expectedRevision)+1n,bC=N({...fC,grant:$S,method:A(`connection.grant.set.confirm`)}).check(L(e=>yC({...e,record:e.grant,target:{id:e.grant.grantId,type:`connection_grant`}}))),xC=N({...fC,method:A(`connection.pool.set.confirm`),pool:eC}).check(L(e=>yC({...e,record:e.pool,target:{id:e.pool.poolId,type:`connection_pool`}}))),Cre=F([N({method:A(`connection.grant.list`),parameters:nC}),N({method:A(`connection.grant.set.preview`),parameters:pC}),N({method:A(`connection.grant.set.confirm`),parameters:mC}),N({method:A(`connection.pool.list`),parameters:rC}),N({method:A(`connection.pool.set.preview`),parameters:hC}),N({method:A(`connection.pool.set.confirm`),parameters:gC})]),wre=F([aC,_C,bC,oC,vC,xC]),SC=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),Tre=N({connection:FS,login:I([`signed-in`,`signed-out`,`unknown`]),models:P(wS).check(H(512))}),Ere=64,CC=N({capabilities:P(I(bS)).check(H(bS.length)),connections:P(Tre).check(H(256)),executor:SC,unavailable:k(N({reason:j.check(U(1,512))}))}),wC=k(M),TC=N({refresh:wC}),EC=N({executor:SC,refresh:wC}),DC=N({executors:P(CC).check(H(Ere)),method:A(`connection.executors.list`)}),OC=N({executor:CC,method:A(`connection.executors.show`)}),Dre=F([N({method:A(`connection.executors.list`),parameters:TC}),N({method:A(`connection.executors.show`),parameters:EC})]),Ore=F([DC,OC]),kC=e=>j.check(U(1,e)),AC={commandId:J,connection:FS,delivery:I([`duplicate`,`new`]),receipt:Y},kre=N({...AC,method:A(`connection.create`)}),Are=N({...AC,keyCustody:I([`kept`,`referenced`,`stored`]),method:A(`connection.gateway.create`)}),jre=N({...AC,expectedRevision:jS,method:A(`connection.state.set`)}),Mre=N({...AC,expectedRevision:jS,method:A(`connection.capacity.set`)}),Nre=N({authUrl:k(kC(2048)),expiresAt:K,loginId:kC(128),userCode:k(kC(64)),verificationUrl:k(kC(2048))}),Pre=N({...AC,expectedRevision:jS,login:Nre,method:A(`connection.login.start`)}),jC=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`connection`&&e.receipt.target.id===e.connection.connectionId&&e.receipt.aggregateRevision===e.connection.revision,MC=e=>BigInt(e.connection.revision)===BigInt(e.expectedRevision)+1n,NC=kre.check(L(e=>jC(e)&&e.connection.revision===`1`)),PC=Are.check(L(e=>jC(e)&&e.connection.revision===`1`&&e.connection.executor===`gateway`)),Fre=N({displayName:k(TS),id:wS}),FC=N({connectionId:J,format:I([`anthropic`,`openai`]),method:A(`connection.models.list`),models:P(Fre).check(H(512)),omitted:V.check(z(0)),truncated:M}).check(L(e=>new Set(e.models.map(e=>e.id)).size===e.models.length)),IC=jre.check(L(e=>jC(e)&&MC(e))),LC=Mre.check(L(e=>jC(e)&&MC(e))),RC=Pre.check(L(e=>jC(e)&&MC(e)&&(e.login.authUrl!==void 0||e.login.userCode!==void 0&&e.login.verificationUrl!==void 0))),zC=N({connection:FS,method:A(`connection.usage.show`)}).check(L(e=>e.connection.usage!==void 0)),BC=N({items:P(FS).check(H(100)),method:A(`connection.list`),nextCursor:k(J)}).check(L(e=>new Set(e.items.map(e=>e.connectionId)).size===e.items.length&&(e.nextCursor===void 0||e.items.length>0))),VC=N({connection:FS,method:A(`connection.show`)}),Ire=F([LC,NC,PC,BC,RC,FC,VC,IC,zC]),HC=j.check(R(/^\d[0-9A-Za-z.+-]{0,63}$/u)),Lre=j.check(R(/^[a-z0-9][a-z0-9._-]{0,63}$/u)),UC=j.check(R(/^[A-Za-z0-9.[\]:-]{1,260}$/u)),WC=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),GC=j.check(R(/^sha256:[a-f0-9]{64}$/u)),KC=I([`custom-endpoint`,`none`,`unknown`,`vendor-login`]),qC=N({credential:I([`env-key`,`helper`]),hint:k(j.check(U(1,2300),R(/^[\u0020-\u007E]+$/u))),host:UC}),JC=F([N({found:A(!1)}),N({found:A(!0),onNodePath:M,path:MS,version:k(HC)})]),Rre=N({connectionId:J,name:OS,state:kS}),YC=I([`notify`,`off`]),XC=N({checkedAt:K,source:A(`npm-registry`),version:HC}),ZC=N({approved:k(N({launchable:I([`unknown`,`yes`]),version:k(HC)})),available:k(XC),policy:YC,proposal:k(N({command:j.check(U(1,200),R(/^[ -~]+$/u)),kind:I([`approve-installed`,`update-available`])}))}).check(L(e=>e.policy===`notify`||e.proposal===void 0,{expected:`no proposal while the policy is off`})),QC=N({accountKind:k(Lre),auth:KC,binary:JC,connection:k(Rre),endpoint:k(qC),executableApproved:M,executor:DS,upkeep:k(ZC),workerPrompt:k(I([`failed`,`inconclusive`,`ok`]))}).check(L(e=>e.auth===`custom-endpoint`==(e.endpoint!==void 0),{expected:`an endpoint exactly for a custom-endpoint CLI`}),L(e=>e.workerPrompt===void 0||e.executor===X.codex&&e.binary.found,{expected:`a worker prompt check for an installed Codex CLI`})),$C=e=>Ay([e,e]),ew=e=>{let t=e.executors??e.items??[];return t[0]?.executor===X.claudeCode&&t[1]?.executor===X.codex},tw=N({upkeep:k(M)}),nw=N({executors:$C(QC),method:A(`connection.detect`)}).check(L(ew)),rw=I([`approval-unavailable`,`auth-unknown`,`env-key-endpoint`,`missing`,`name-taken`,`not-on-node-path`,`settings-endpoint`,`signed-out`]),zre=F([N({action:A(`create`),maxConcurrentSessions:AS,name:OS}),N({action:A(`existing`),connectionId:J,maxConcurrentSessions:AS,name:OS})]),Bre=N({action:I([`approve`,`existing`]),path:MS,version:k(HC)}),Vre=N({auth:KC,connection:k(zre),endpoint:k(qC),executable:k(Bre),executor:DS,reason:k(rw)}).check(L(e=>e.reason===void 0==(e.connection!==void 0&&e.executable!==void 0),{expected:`a planned item or a skip reason`})),iw={commandId:J,maxConcurrentSessions:k(AS)},aw=N(iw),ow=N({...iw,inputDigest:GC,proof:WC}),sw=N({actorId:J,commandId:J,expiresAt:K,inputDigest:GC,issuedAt:K,items:$C(Vre),maxConcurrentSessions:k(AS),method:A(`connection.system.preview`),proof:WC}).check(L(ew),L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),cw=N({approvalReceipt:k(Y),connection:FS,connectionReceipt:k(Y),executor:DS}).check(L(e=>e.connection.executor===e.executor&&e.connection.configRoot.kind===`system-default`&&(e.connectionReceipt===void 0||e.connectionReceipt.target.type===`connection`&&e.connectionReceipt.target.id===e.connection.connectionId))),lw=N({actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),inputDigest:GC,items:P(cw).check(H(2)),method:A(`connection.system.confirm`)}).check(L(e=>new Set(e.items.map(e=>e.executor)).size===e.items.length)),uw={commandId:J,executor:DS,policy:YC},dw=Oy(j,by),fw=N({executors:$C(N({available:k(XC),executor:DS,refreshed:M})),method:A(`connection.upkeep.refresh`)}).check(L(ew)),pw=N(uw),mw=N({...uw,inputDigest:GC,proof:WC}),hw=N({actorId:J,authorizationRevision:V.check(z(1)),commandId:J,current:YC,executor:DS,expiresAt:K,inputDigest:GC,issuedAt:K,method:A(`connection.upkeep.preview`),policy:YC,policyRevision:V.check(z(0)),proof:WC}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),gw=N({actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),executor:DS,inputDigest:GC,method:A(`connection.upkeep.confirm`),policy:YC,policyRevision:V.check(z(1)),receipt:Y}),_w=F([N({method:A(`connection.detect`),parameters:tw}),N({method:A(`connection.upkeep.refresh`),parameters:dw}),N({method:A(`connection.upkeep.preview`),parameters:pw}),N({method:A(`connection.upkeep.confirm`),parameters:mw}),N({method:A(`connection.system.preview`),parameters:aw}),N({method:A(`connection.system.confirm`),parameters:ow})]),vw=F([nw,fw,hw,gw,sw,lw]),yw=F([...xre.members,..._w.members,...Cre.members,...Dre.members]),bw=F([...Ire.members,...vw.members,...wre.members,...Ore.members]),xw=`maia.approval/v1`,Sw=8192,Cw=1024,ww=4096,Tw=new TextEncoder,Ew=9,Dw=10,Ow=13,Hre=31,Ure=127,Wre=159,Gre=e=>Array.from({length:e.length},(e,t)=>t).some(t=>{let n=e.codePointAt(t)??0;return n===Ow?e.codePointAt(t+1)!==Dw:n===Ew||n===Dw?!1:n<=Hre||n>=Ure&&n<=Wre}),Kre=/[\p{Cf}\u2028\u2029]/u,kw=e=>j.check(By(1),L(t=>Tw.encode(t).byteLength<=e&&!Gre(t)&&!Kre.test(t),{expected:`text of at most ${String(e)} UTF-8 bytes`})),Aw=j.check(R(/^sha256:[a-f0-9]{64}$/u)),jw=I([`command`,`file_change`,`question`,`tool`]),qre=I([`approved`,`answered`,`cancelled`,`denied`,`expired`,`pending`]),Jre=I([`answer`,`approve`,`approve_for_session`,`deny`]),Mw=k(P(N({label:kw(240),optionId:j.check(R(/^[a-z][a-z0-9_-]{0,31}$/u))})).check(U(2,8))),Yre=q.check(R(/^[12]$/u)),Xre=N({actorId:J,answer:k(kw(ww)),forSession:k(A(!0)),guardRevision:k(q),reason:k(kw(Cw)),resolvedAt:K}),Nw=({forSessionOffered:e,kind:t,resolution:n,revision:r,status:i})=>i===`pending`?r===`1`&&n===void 0:r!==`2`||n===void 0||n.answer!==void 0!=(i===`answered`)||n.forSession===!0&&(!e||i!==`approved`)?!1:i===`answered`?t===`question`:i!==`approved`||t!==`question`,Pw=N({approvalId:J,createdAt:K,executor:I(fre),expiresAt:K,forSessionOffered:M,kind:jw,options:Mw,reason:k(kw(Cw)),requestDigest:Aw,resolution:k(Xre),revision:Yre,schemaVersion:A(xw),sessionId:J,status:qre,summary:kw(Sw),turnId:J,workspaceId:J}).check(L(e=>Date.parse(e.expiresAt)>Date.parse(e.createdAt)&&(e.options===void 0||e.kind===`question`)&&Nw(e),{expected:`a consistent approval lifecycle`})),Fw=N({approvalId:J,expiresAt:K,kind:jw,options:Mw,summary:k(kw(Sw))}),Iw=N({limit:V.check(B({maximum:50,minimum:1})),pendingOnly:k(M),sessionId:k(J)}),Lw=N({approvalId:J}),Rw={answer:k(kw(ww)),commandId:J,decision:Jre,reason:k(kw(Cw)),requestDigest:Aw},zw=L(e=>e.answer!==void 0==(e.decision===`answer`)&&(e.reason===void 0||e.decision===`deny`),{expected:`an answer only to answer, a reason only to deny`}),Bw=N({approvalId:J,...Rw}).check(zw),Vw=F([N({method:A(`approval.list`),parameters:Iw}),N({method:A(`approval.respond`),parameters:Bw}),N({method:A(`approval.show`),parameters:Lw})]),Hw=N({items:P(Pw).check(H(50)),method:A(`approval.list`)}).check(L(e=>new Set(e.items.map(e=>e.approvalId)).size===e.items.length,{expected:`unique approvals`})),Uw=N({approval:Pw,method:A(`approval.show`)}),Ww=N({approval:Pw,commandId:J,delivery:I([`duplicate`,`new`]),method:A(`approval.respond`),receipt:Y}).check(L(e=>e.approval.status!==`pending`&&e.approval.resolution?.actorId===e.receipt.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`approval`&&e.receipt.target.id===e.approval.approvalId&&e.receipt.aggregateRevision===e.approval.revision,{expected:`a resolved approval bound to its receipt`})),Gw=F([Hw,Ww,Uw]),Kw=4096,qw=4096,Jw=new TextEncoder,Yw=(e,t,n)=>{let r=`\`${t.clientKey}\` on \`${n}\``;if(n===t.clientKey)throw TypeError(`The Task graph contains a self dependency: \`${t.clientKey}\`.`);if(!e.byKey.has(n))throw TypeError(`The Task graph contains a missing dependency: ${r}.`);let i=`${t.clientKey}\0${n}`;if(e.edgeKeys.has(i))throw TypeError(`The Task graph contains a duplicate edge: ${r}.`);e.edgeKeys.add(i);let a=(e.dependentCounts.get(n)??0)+1;if(a>8)throw TypeError(`A Task has too many direct dependents: \`${n}\`.`);e.dependentCounts.set(n,a)},Xw=(e,t)=>{if(t.dependsOn.length>8)throw TypeError(`A Task has too many direct dependencies: \`${t.clientKey}\`.`);return t.dependsOn.reduce((n,r)=>(Yw(e,t,r),n+1),0)},Zw=(e,t)=>{let n={byKey:t,dependentCounts:new Map,edgeKeys:new Set};if(e.reduce((e,t)=>e+Xw(n,t),0)>128)throw TypeError(`The Task graph contains too many dependency edges.`)},Qw=(e,t)=>{if(e.visiting.has(t))throw TypeError(`The Task graph contains a cycle through \`${t}\`.`);let n=e.heights.get(t);if(n!==void 0)return n;let r=e.byKey.get(t);if(r===void 0)throw TypeError(`The Task graph contains a missing Task.`);e.visiting.add(t);let i=1+r.dependsOn.reduce((t,n)=>Math.max(t,Qw(e,n)),0);return e.visiting.delete(t),e.heights.set(t,i),i},$w=(e,t)=>{let n={byKey:t,heights:new Map,visiting:new Set};if(Qw(n,e.rootTaskKey)>8)throw TypeError(`The Task graph exceeds the maximum depth.`);if(n.heights.size!==e.tasks.length)throw TypeError(`Every Task must be reachable from the root Task.`)},eT=e=>{if(e.reduce((e,t)=>e+Jw.encode(t.objective).byteLength,0)>32768)throw TypeError(`The Run objective byte total exceeds 32768 bytes.`)},tT=e=>e.reduce((e,t)=>{if(e.has(t.clientKey))throw TypeError(`The Task graph contains duplicate client keys: \`${t.clientKey}\`.`);return e.set(t.clientKey,t)},new Map),nT=e=>{if(e.tasks.length===0||e.tasks.length>32)throw TypeError(`The Task graph contains an invalid Task count.`);let t=tT(e.tasks),n=t.get(e.rootTaskKey),r=t.get(e.dispatchTaskKey);if(n===void 0||r===void 0)throw TypeError(`The Task graph root and Dispatch Task must exist.`);if(r.dependsOn.length>0)throw TypeError(`The Dispatch Task must be dependency-free.`);Zw(e.tasks,t),$w(e,t),eT(e.tasks)},rT=e=>{let t=tT(e);Zw(e,t);let n={byKey:t,heights:new Map,visiting:new Set};if(e.reduce((e,t)=>Math.max(e,Qw(n,t.clientKey)),0)>8)throw TypeError(`The Task graph exceeds the maximum depth.`)},iT=e=>{if(e.length===0||e.length>32)throw TypeError(`The Task graph contains an invalid Task count.`);rT(e),eT(e)},aT=e=>{try{return iT(e),!0}catch{return!1}},oT=e=>{try{return nT(e),!0}catch{return!1}},sT=`maia.orchestration/v1`,cT=`maia.orchestration-message/v1`,Zre=new TextEncoder,lT=(e,t,n)=>j.check(L(n=>{let r=Zre.encode(n).byteLength;return r>=e&&r<=t},{expected:n})),uT=j.check(U(1,64),R(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u)),dT=lT(1,Kw,`a Task objective encoded as 1 to 4096 UTF-8 bytes`),fT=lT(1,128,`a Message subject encoded as 1 to 128 UTF-8 bytes`),pT=lT(1,qw,`a Message body encoded as 1 to 4096 UTF-8 bytes`),mT=A(1),hT=N({id:J,kind:A(`run`)}),gT=N({id:J,kind:A(`dispatch`)}),_T=F([hT,gT]),vT=N({clientKey:uT,dependsOn:P(uT).check(H(8)),objective:dT}),yT=N({dispatchTaskKey:uT,rootTaskKey:uT,tasks:P(vT).check(By(1),H(32))}),bT={clientKey:uT,createdAt:K,dependencyTaskIds:P(J).check(H(8)),id:J,revision:q,runId:J,schemaVersion:A(sT),state:I([`pending`,`active`,`waiting-question`,`failed`]),updatedAt:K,workspaceId:J},xT=N(bT),ST=N({...bT,objective:dT}),CT=N({coordinator:N({actorId:A(`actor_local_user`),epoch:mT}),createdAt:K,dispatchTaskId:J,id:J,revision:q,rootTaskId:J,schemaVersion:A(sT),state:I([`active`,`waiting-question`,`failed`]),terminalId:J,updatedAt:K,workspaceId:J}),wT=N({createdAt:K,id:J,ordinal:A(1),revision:q,runId:J,schemaVersion:A(sT),state:I([`active`,`waiting-question`,`failed`]),taskId:J,updatedAt:K}),Qre=F([N({code:A(`terminal_containment_unsupported`),platform:I([`darwin`,`linux`])}),N({code:A(`platform_unsupported`),platform:I([`win32`,`other`])})]),TT={attemptId:J,createdAt:K,id:J,revision:q,runId:J,schemaVersion:A(sT),taskId:J,terminalId:J,updatedAt:K},ET=F([N({...TT,state:A(`active`)}),N({...TT,state:A(`waiting-question`)}),N({...TT,failure:Qre,state:A(`failed`)})]),DT=N({contentBytes:q,createdAt:K,deliveryCount:q,headSequence:q,id:J,owner:_T,revision:q,runId:J,schemaVersion:A(sT),updatedAt:K}).check(L(e=>e.owner.kind===`dispatch`||e.owner.id===e.runId,{expected:`a run Mailbox owned by its exact Run`})),OT={body:pT,createdAt:K,digest:j.check(U(64,64),R(/^[a-f0-9]{64}$/u)),id:J,runId:J,schemaVersion:A(cT),sender:N({actorId:A(`actor_local_user`),kind:A(`run-coordinator`),runId:J}),subject:fT},kT=F([N({...OT,recipient:gT,type:A(`dispatch`)}),N({...OT,questionId:J,recipient:hT,type:A(`question`)}),N({...OT,questionId:J,recipient:gT,type:A(`reply`)}),N({...OT,recipient:hT,type:A(`dispatch-settled`)})]).check(L(e=>e.sender.runId===e.runId&&(e.recipient.kind===`dispatch`||e.recipient.id===e.runId),{expected:`a Message whose Run identities are exact`})),AT={attemptCount:V.check(z(0),Ry(65535)),createdAt:K,firstDeliveredAt:k(K),id:J,lastDeliveredAt:k(K),mailboxId:J,message:kT,sequence:q},jT=N({...AT,state:A(`pending`)}),MT=N({...AT,acknowledgedAt:K,acknowledgingActorId:A(`actor_local_user`),state:A(`acknowledged`)}),NT=F([jT,MT]),PT={askMessageId:J,attemptId:J,body:pT,createdAt:K,dispatchId:J,id:J,revision:q,runId:J,schemaVersion:A(sT),subject:fT,taskId:J,updatedAt:K},FT=F([N({...PT,state:A(`open`)}),N({...PT,answer:pT,replyMessageId:J,state:A(`answered`)}),N({...PT,state:A(`cancelled`)})]),IT=N({attempt:wT,dispatch:ET,mailboxes:P(DT).check(U(2,2)),question:k(FT),run:CT,tasks:P(ST).check(By(1),H(32))}),LT=e=>{let t=e.mailboxes.filter(t=>t.runId===e.run.id&&t.owner.kind===`run`&&t.owner.id===e.run.id),n=e.mailboxes.filter(t=>t.runId===e.run.id&&t.owner.kind===`dispatch`&&t.owner.id===e.dispatch.id);return t.length===1&&n.length===1},RT=e=>{let t=new Set(e.tasks.map(e=>e.id));return e.tasks.every(n=>n.runId===e.run.id&&n.workspaceId===e.run.workspaceId&&n.dependencyTaskIds.every(e=>t.has(e)))},zT=e=>oT({dispatchTaskKey:e.run.dispatchTaskId,rootTaskKey:e.run.rootTaskId,tasks:e.tasks.map(e=>({clientKey:e.id,dependsOn:e.dependencyTaskIds,objective:e.objective}))}),BT=e=>new Set(e.tasks.map(e=>e.id)).size===e.tasks.length&&new Set(e.tasks.map(e=>e.clientKey)).size===e.tasks.length&&new Set(e.mailboxes.map(e=>e.id)).size===e.mailboxes.length,VT=(e,t)=>e.question===void 0||e.question.runId===e.run.id&&e.question.taskId===t&&e.question.attemptId===e.attempt.id&&e.question.dispatchId===e.dispatch.id,HT=e=>{let t=e.tasks.find(t=>t.id===e.run.dispatchTaskId),n=e.tasks.find(t=>t.id===e.run.rootTaskId);return t!==void 0&&n!==void 0&&e.attempt.runId===e.run.id&&e.attempt.taskId===t.id&&e.dispatch.runId===e.run.id&&e.dispatch.attemptId===e.attempt.id&&e.dispatch.taskId===t.id&&e.dispatch.terminalId===e.run.terminalId&&zT(e)&&BT(e)&&RT(e)&&VT(e,t.id)&<(e)},UT=(e,t)=>t.every(e=>e===`failed`)&&e.tasks.every(e=>e.state===`failed`)&&e.question?.state!==`open`,WT=(e,t,n)=>t.every(e=>e===`waiting-question`)&&e.tasks.every(e=>e.id===n||e.state===`pending`)&&e.question?.state===`open`,GT=(e,t,n)=>t.every(e=>e===`active`)&&e.tasks.every(e=>e.id===n||e.state===`pending`)&&e.question?.state!==`open`,KT=e=>{let t=e.tasks.find(t=>t.id===e.run.dispatchTaskId);if(t===void 0)return!1;let n=[e.run.state,e.attempt.state,e.dispatch.state,t.state];return e.run.state===`failed`?UT(e,n):e.run.state===`waiting-question`?WT(e,n,t.id):GT(e,n,t.id)},qT=IT.check(L(e=>HT(e)&&KT(e),{expected:`an exact local-v1 orchestration aggregate topology`})),JT=N({commandId:J,expectedRevision:A(`0`),graph:yT,terminalId:J,workspaceId:J}),YT=N({runId:J}),XT=N({afterCursor:q,limit:V.check(z(1),Ry(100)),workspaceId:J}),ZT=N({afterCursor:q,limit:V.check(z(1),Ry(32)),runId:J}),QT=N({runId:J,taskId:J}),$T=N({runId:J}),eE=N({coordinatorEpoch:mT,limit:V.check(z(1),Ry(16)),owner:_T,runId:J}),tE=N({commandId:J,coordinatorEpoch:mT,deliveryId:J,expectedMailboxRevision:q,owner:_T,runId:J}),nE={commandId:J,coordinatorEpoch:mT,dispatchId:J,expectedDispatchRevision:q,expectedRunRevision:q,runId:J},rE=N({...nE,body:pT,subject:fT}),iE=N({...nE,answer:pT,expectedQuestionRevision:q,questionId:J}),aE=N({...nE,expectedQuestionRevision:q,questionId:J}),oE=N(nE),sE=e=>e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.type===e.targetType&&e.receipt.target.id===e.targetId,cE=(e,t)=>e.mailboxId===t.id&&e.message.runId===t.runId&&e.message.recipient.kind===t.owner.kind&&e.message.recipient.id===t.owner.id,lE=e=>{let t=e.ownerKind===`run`?e.aggregate.run.id:e.aggregate.dispatch.id,n=e.aggregate.mailboxes.find(n=>n.owner.kind===e.ownerKind&&n.owner.id===t);return n!==void 0&&e.delivery.message.type===e.messageType&&cE(e.delivery,n)},uE=N({aggregate:qT,delivery:I([`new`,`duplicate`]),initialDelivery:NT,method:A(`run.create`),receipt:Y}).check(L(e=>lE({aggregate:e.aggregate,delivery:e.initialDelivery,messageType:`dispatch`,ownerKind:`dispatch`})&&sE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Run-create Delivery matching its Dispatch Mailbox`})),dE=N({aggregate:qT,method:A(`run.show`)}),fE=N({items:P(CT).check(H(100)),method:A(`run.list`),nextCursor:k(q)}).check(L(e=>e.items.every(t=>t.workspaceId===e.items[0]?.workspaceId),{expected:`Run list items that share one Workspace ID`})),pE=N({items:P(xT).check(H(32)),method:A(`run.task.list`),nextCursor:k(q),runId:J}).check(L(e=>e.items.every(t=>t.runId===e.runId),{expected:`Task list items that share the requested Run ID`})),mE=N({method:A(`run.task.show`),runId:J,task:ST,taskId:J}).check(L(e=>e.task.runId===e.runId&&e.task.id===e.taskId,{expected:`a Task show result whose Task IDs match the requested Run and Task`})),hE=N({dispatch:ET,method:A(`run.dispatch.show`),runId:J}).check(L(e=>e.dispatch.runId===e.runId,{expected:`a Dispatch show result whose Dispatch Run ID matches the requested Run`})),gE=N({items:P(jT).check(H(16)),mailbox:DT,method:A(`run.inbox.check`)}).check(L(e=>e.items.every(t=>cE(t,e.mailbox)),{expected:`inbox-check Deliveries matching the selected Mailbox`})),_E=N({delivery:MT,mailbox:DT,method:A(`run.inbox.ack`),receipt:Y}).check(L(e=>cE(e.delivery,e.mailbox),{expected:`an inbox acknowledgement matching its Mailbox`}),L(e=>sE({method:e.method,receipt:e.receipt,targetId:e.mailbox.id,targetType:`orchestration-mailbox`}),{expected:`an inbox acknowledgement matching its Mailbox`})),vE={aggregate:qT,receipt:Y},yE=N({...vE,delivery:NT,method:A(`run.question.open`)}).check(L(e=>lE({aggregate:e.aggregate,delivery:e.delivery,messageType:`question`,ownerKind:`run`})&&sE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-open Delivery matching the Run Mailbox`})),bE=N({...vE,delivery:NT,method:A(`run.question.reply`)}).check(L(e=>lE({aggregate:e.aggregate,delivery:e.delivery,messageType:`reply`,ownerKind:`dispatch`})&&sE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-reply Delivery matching the Dispatch Mailbox`})),xE=N({...vE,method:A(`run.question.cancel`)}).check(L(e=>sE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-cancel receipt matching its Run`})),SE=N({aggregate:qT,delivery:NT,method:A(`run.dispatch.settle-terminal`),receipt:Y}).check(L(e=>lE({aggregate:e.aggregate,delivery:e.delivery,messageType:`dispatch-settled`,ownerKind:`run`})&&sE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Dispatch settlement matching the Run Mailbox`})),CE=F([N({method:A(`run.create`),parameters:JT}),N({method:A(`run.list`),parameters:XT}),N({method:A(`run.show`),parameters:YT}),N({method:A(`run.task.list`),parameters:ZT}),N({method:A(`run.task.show`),parameters:QT}),N({method:A(`run.dispatch.show`),parameters:$T}),N({method:A(`run.inbox.check`),parameters:eE}),N({method:A(`run.inbox.ack`),parameters:tE}),N({method:A(`run.question.open`),parameters:rE}),N({method:A(`run.question.reply`),parameters:iE}),N({method:A(`run.question.cancel`),parameters:aE}),N({method:A(`run.dispatch.settle-terminal`),parameters:oE})]),wE=F([uE,fE,dE,pE,mE,hE,gE,_E,yE,bE,xE,SE]);G(vT),G(yT),G(ST),G(xT),G(CT),G(wT),G(ET),G(DT),G(kT),G(NT),G(jT),G(MT),G(FT);var TE=G;TE(JT),TE(YT),TE(XT),TE(ZT),TE(QT),TE($T),TE(eE),TE(tE),TE(rE),TE(iE),TE(aE),TE(oE);var EE=TE(uE),DE=TE(dE),OE=TE(fE),kE=TE(pE),AE=TE(mE),jE=TE(hE),ME=TE(gE),NE=TE(_E),PE=TE(yE),FE=TE(bE),IE=TE(xE),$re=TE(SE),LE=`maia.board/v1`,RE=65536,eie=64,tie=128,nie=256,rie=64,iie=new TextEncoder,zE=j.check(U(1,128),R(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*){0,3}$/u)),BE=I([`waiting`,`ready`,`claimed`,`blocked`,`completed`,`failed`,`cancelled`]),VE=N({id:J,kind:I([`person`,`bot`])}),HE=j.check(U(1,rie),R(/^[a-z0-9][a-z0-9._-]*$/u)),UE=F([VE,N({agent:HE,kind:A(`session`),sessionId:k(J),via:VE})]),WE=N({key:j.check(U(1,eie),R(/^[a-z][a-z0-9_.-]*$/u)),value:j.check(H(tie),R(/^[^\p{Cc}]*$/u))}),aie=N({kind:I([`pull_request`,`commit`,`session`,`node`]),target:j.check(U(1,nie),R(/^[^\s\p{Cc}]+$/u))}),GE=j.check(U(1,RE),L(e=>iie.encode(e).byteLength<=65536&&!e.includes(`\0`),{expected:`message text of at most ${String(RE)} UTF-8 bytes without NUL`})),oie=N({createdAt:K,id:J,schemaVersion:A(LE),workspaceId:J}),KE=N({boardId:J,createdAt:K,id:J,path:zE,schemaVersion:A(LE),state:k(BE)}),qE=N({author:k(UE),createdAt:K,id:J,labels:P(WE).check(H(256)),links:P(aie).check(H(40)),schemaVersion:A(LE),text:GE,threadId:J}),sie=N({labels:V.check(B({maximum:256,minimum:1})),links:V.check(B({maximum:40,minimum:1})),messageBytes:V.check(B({maximum:RE,minimum:1}))}),cie=3600,JE=8192,lie=8,uie=new TextEncoder,YE=q.check(R(/^[1-9]\d*$/u)),XE=j.check(U(16,128),R(/^[A-Za-z0-9_-]+$/u)),ZE=j.check(L(e=>{let t=uie.encode(e).byteLength;return t>=1&&t<=8192&&!e.includes(`\0`)},{expected:`text encoded as 1 to ${String(JE)} UTF-8 bytes without NUL`}),H(JE)),QE=P(WE).check(H(256)),$E=P(J).check(H(lie),L(e=>new Set(e).size===e.length,{expected:`task ids named at most once`})),eD=V.check(B({maximum:cie,minimum:30})),tD=N({claimant:UE,claimedAt:K,leaseExpiresAt:K}),nD=N({claimedAt:K,id:J,leaseExpiresAt:K,state:A(`claimed`),title:j.check(U(1,120))}),rD={assignee:k(fS),author:k(UE),claim:k(tD),createdAt:K,id:J,labels:QE,needs:k($E.check(By(1))),ownedBy:I([`board`,`run-ledger`]),path:zE,revision:YE,schemaVersion:A(LE),state:BE,title:j.check(U(1,120)),updatedAt:K,workspaceId:J},iD=e=>e.ownedBy===`run-ledger`?e.claim===void 0:e.state===`claimed`==(e.claim!==void 0),aD=N(rD).check(L(iD,{expected:`a claim exactly on a claimed board task`})),oD=N({...rD,reason:k(ZE),result:k(ZE),text:GE}).check(L(e=>iD(e)&&(e.result===void 0||e.state===`completed`)&&(e.reason===void 0||e.state===`failed`),{expected:`a claim on a claimed task, a result on a completed one and a reason on a failed one`})),sD={as:k(HE)},cD={commandId:J,expectedRevision:YE},lD={...sD,commandId:J,labels:k(QE),path:zE,text:GE,workspaceId:J},uD=N({...lD,needs:k($E)}),dD=N({...sD,commandId:J,expectedRevision:k(YE),labels:k(QE),leaseSeconds:k(eD),path:k(zE),taskId:k(J),workspaceId:k(J)}).check(L(e=>e.taskId===void 0?e.expectedRevision===void 0&&e.workspaceId!==void 0&&e.path!==void 0:e.expectedRevision!==void 0&&e.workspaceId===void 0&&e.path===void 0&&e.labels===void 0,{expected:`taskId with expectedRevision, or workspaceId with path and optional labels`})),fD={...sD,...cD,claimToken:XE,taskId:J},pD=N({...fD,leaseSeconds:k(eD)}),mD=N(fD),hD=N({...fD,result:k(ZE)}),gD=N({...fD,reason:ZE}),_D=N({...sD,...cD,taskId:J}),vD=_D,yD=N({afterCursor:k(J),labels:k(QE),limit:k(V.check(B({maximum:100,minimum:1}))),path:k(zE),projectId:k(J),sessionId:k(J),state:k(BE),workspaceId:k(J)}).check(L(e=>e.workspaceId!==void 0||e.sessionId!==void 0||e.projectId!==void 0,{expected:`a workspaceId, sessionId or projectId`})),bD={afterCursor:k(J),limit:k(V.check(B({maximum:100,minimum:1})))},xD=V.check(z(0)),SD=N({...bD,taskId:J}),CD={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y,task:oD},wD=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`board_task`&&e.receipt.target.id===e.task.id&&e.receipt.aggregateRevision===e.task.revision,TD=(e,t)=>N({...CD,method:A(e)}).check(L(e=>wD(e)&&t(e.task),{expected:`a ${e} result bound to its receipt`})),ED=e=>t=>t.state===e,DD=e=>e.state===`ready`||e.state===`waiting`,OD=TD(`board.task.create`,e=>DD(e)&&e.revision===`1`),kD=N({...CD,claimToken:XE,method:A(`board.task.claim`)}).check(L(e=>wD(e)&&e.task.claim!==void 0,{expected:`a claimed task bound to its receipt`})),AD=TD(`board.task.renew`,ED(`claimed`)),jD=TD(`board.task.release`,ED(`ready`)),MD=TD(`board.task.complete`,ED(`completed`)),ND=TD(`board.task.fail`,ED(`failed`)),PD=TD(`board.task.cancel`,ED(`cancelled`)),FD=TD(`board.task.reopen`,DD),ID=N({items:P(aD).check(H(100)),method:A(`board.task.list`),nextCursor:k(J)}).check(L(e=>e.nextCursor===void 0||e.items.length>0,{expected:`a cursor only after items`})),LD=N({messages:P(qE).check(H(100)),method:A(`board.task.show`),nextCursor:k(J),replyCount:xD,task:oD}).check(L(e=>e.messages.every(t=>t.threadId===e.task.id)&&(e.nextCursor===void 0||e.messages.length>0),{expected:`the task's own messages, and a cursor only after messages`})),RD=(e,t)=>N({method:A(e),parameters:t}),zD=F([RD(`board.task.cancel`,_D),RD(`board.task.claim`,dD),RD(`board.task.complete`,hD),RD(`board.task.create`,uD),RD(`board.task.fail`,gD),RD(`board.task.list`,yD),RD(`board.task.release`,mD),RD(`board.task.renew`,pD),RD(`board.task.reopen`,vD),RD(`board.task.show`,SD)]),BD=F([PD,kD,MD,OD,ND,ID,jD,AD,FD,LD]),VD=N({...sD,assignee:k(fS),commandId:J,expectedRevision:YE,pool:k(A(!0)),taskId:J}).check(L(e=>e.assignee===void 0==(e.pool===!0),{expected:`assignee or pool, exactly one`})),HD=N({...sD,commandId:J,needs:k($E),threadId:J,workspaceId:J}),UD=N({...sD,commandId:J,expectedRevision:YE,needs:$E,taskId:J}),WD=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`board_task`&&e.receipt.target.id===e.task.id&&e.receipt.aggregateRevision===e.task.revision&&(e.task.state===`ready`||e.task.state===`waiting`),GD=(e,t)=>N({commandId:J,delivery:I([`duplicate`,`new`]),method:A(e),receipt:Y,task:oD}).check(L(e=>WD(e)&&t(e),{expected:`a ${e} result bound to its receipt`})),KD=GD(`board.task.assign`,()=>!0),qD=GD(`board.task.promote`,({task:e})=>e.revision===`1`),JD=GD(`board.task.needs.replace`,()=>!0),YD=F([RD(`board.task.assign`,VD),RD(`board.task.needs.replace`,UD),RD(`board.task.promote`,HD)]),XD=F([KD,JD,qD]),ZD=`maia.node-api/v1`,QD=`/api/v1/operations`,$D=`/api/v1/observations`,eO=`POST`,tO=`application/json`,nO=`/panel/session`,rO=`/panel/api/operations`,iO=`x-maia-panel-session`,aO=`coordinator`,oO=1048576,sO=2048,cO=`agents.change.confirm,agents.change.preview,agents.detect,agents.list,agents.show,approval.list,approval.respond,approval.show,board.message.post,board.message.reply,board.path.read,board.task.assign,board.task.cancel,board.task.claim,board.task.complete,board.task.create,board.task.fail,board.task.list,board.task.needs.replace,board.task.plan,board.task.promote,board.task.release,board.task.renew,board.task.reopen,board.task.show,board.thread.show,connection.capacity.set,connection.create,connection.detect,connection.executors.list,connection.executors.show,connection.gateway.create,connection.github.create,connection.github.revoke,connection.github.show,connection.grant.list,connection.grant.set.confirm,connection.grant.set.preview,connection.list,connection.login.start,connection.models.list,connection.pool.list,connection.pool.set.confirm,connection.pool.set.preview,connection.show,connection.state.set,connection.system.confirm,connection.system.preview,connection.upkeep.confirm,connection.upkeep.preview,connection.upkeep.refresh,connection.usage.show,container.create.confirm,container.create.preview,container.index.list,container.list,container.rename.confirm,container.rename.preview,container.show,context.show,discovery.sessions.list,events.read,execution.catalog.get,execution.checkpoint.create,execution.checkpoint.show,execution.command.run,execution.file.read,execution.placement.create,execution.placement.show,execution.relocation.apply,execution.relocation.plan,execution.relocation.reconcile,execution.relocation.show,execution.worktree.create,execution.worktree.import,execution.worktree.reconcile,execution.worktree.remove.apply,execution.worktree.remove.plan,execution.worktree.status,goal.clear,goal.mark,goal.set,goal.show,goal.transition,goal.update,harness.installed.list,hold.list,hold.place.confirm,hold.place.preview,hold.release.confirm,hold.release.preview,inbox.list,inbox.respond,inbox.settle,inbox.show,inbox.snooze,integration.apply.antigravity,integration.apply.claude-code,integration.apply.codex,integration.apply.grok-cli,integration.apply.maia-agent,integration.apply.pi,integration.apply.pi-rpc,integration.plan.antigravity,integration.plan.claude-code,integration.plan.codex,integration.plan.grok-cli,integration.plan.maia-agent,integration.plan.pi,integration.plan.pi-rpc,integration.remove.antigravity,integration.remove.claude-code,integration.remove.codex,integration.remove.grok-cli,integration.remove.maia-agent,integration.remove.pi,integration.remove.pi-rpc,integration.status.antigravity,integration.status.claude-code,integration.status.codex,integration.status.grok-cli,integration.status.maia-agent,integration.status.pi,integration.status.pi-rpc,interaction.cancel,interaction.create,interaction.list,interaction.respond,interaction.show,monitor.bootstrap.create,node.pairing.confirm,node.pairing.preview,node.pairing.redeem,node.pairing.show,node.principal.confirm,node.principal.preview,node.principal.show,node.reach.confirm,node.reach.preview,node.reach.show,node.remote.install.confirm,node.remote.install.preview,node.remote.list,node.remote.register.confirm,node.remote.register.preview,node.remote.remove.confirm,node.remote.remove.preview,node.shutdown,node.status,node.update.apply.confirm,node.update.apply.preview,node.update.check,node.update.pause,node.update.policy.get,node.update.policy.set,node.update.resume,node.update.rollback.confirm,node.update.rollback.preview,node.update.show,node.update.status,port.lease.acquire,port.lease.list,port.lease.release,port.lease.renew,pr.link,pr.status,pr.watch,presentation.catalog.show,presentation.project-list.show,presentation.session-list.show,presentation.workspace-directory.show,project.context.list,project.context.record,project.context.show,project.create.confirm,project.create.preview,project.guard.confirm,project.guard.preview,project.guard.show,project.instructions.change.confirm,project.instructions.change.preview,project.instructions.show,project.knowledge.add.chunk,project.knowledge.add.commit,project.knowledge.add.confirm,project.knowledge.add.preview,project.knowledge.list,project.knowledge.remove.confirm,project.knowledge.remove.preview,project.knowledge.search,project.list,project.register,project.rename.confirm,project.rename.preview,project.show,provider.pool.list,receipt.get,receipt.list,reference.resolve,routine.create.confirm,routine.create.preview,routine.disable.confirm,routine.disable.preview,routine.list,routine.move.confirm,routine.move.preview,routine.pause,routine.resume,routine.run.confirm,routine.run.preview,routine.runs,routine.show,routine.trigger.create.confirm,routine.trigger.create.preview,routine.trigger.disable,routine.trigger.list,routine.update.confirm,routine.update.preview,run.create,run.dispatch.settle-terminal,run.dispatch.show,run.inbox.ack,run.inbox.check,run.ledger.create,run.ledger.list,run.ledger.task.dispatch,run.ledger.task.list,run.ledger.task.settle,run.ledger.task.show,run.list,run.question.cancel,run.question.open,run.question.reply,run.show,run.task.list,run.task.show,runtime.probe,secret.request,secret.set.confirm,secret.set.preview,session.adopt.confirm,session.adopt.preview,session.agent-permission.confirm,session.agent-permission.preview,session.archive,session.command.confirm,session.command.list,session.command.preview,session.command.send,session.create,session.detach.confirm,session.detach.preview,session.diff,session.events.list,session.fork.confirm,session.fork.preview,session.git.status,session.history.read,session.inbox.ack,session.inbox.check,session.list,session.message.send,session.observe,session.pause.confirm,session.pause.preview,session.placement.show,session.rename,session.resume,session.setup.confirm,session.setup.preview,session.show,session.spawn-caps.confirm,session.spawn-caps.preview,session.spawn-caps.show,session.spawn.confirm,session.spawn.preview,session.spawn.record,session.start,session.stop,session.switch.confirm,session.switch.preview,session.wait,skills.sync.confirm,skills.sync.preview,skills.sync.show,team-workspace.bootstrap.apply,team-workspace.bootstrap.preview,terminal.controller.acquire,terminal.controller.release,terminal.controller.renew,terminal.controller.request,terminal.controller.request.show,terminal.create,terminal.events.list,terminal.input.write,terminal.list,terminal.mutation.reconcile,terminal.observer.attach,terminal.observer.check,terminal.observer.detach,terminal.observer.resync,terminal.read,terminal.session.close,terminal.session.delete,terminal.session.resize,terminal.session.restart,terminal.session.signal,terminal.show,turn.attachment.policy,turn.cancel,turn.interrupt,turn.queue.list,turn.send,turn.show,turn.steer.confirm,turn.steer.preview,turn.wait,voice.managed-turn.confirm,voice.managed-turn.preview,voice.orchestrator.context.show,voice.orchestrator.tool.call,voice.pi.relay,voice.pi.relay.preview,voice.pi.relay.reconcile,webhooks.change.confirm,webhooks.change.preview,webhooks.deliveries,webhooks.list,workspace.branches.list,workspace.code-host.show,workspace.context.show,workspace.execution.configure,workspace.execution.show,workspace.list,workspace.membership.attach,workspace.repository.attach,workspace.select,workspace.show`.split(`,`),lO=Object.freeze([`node.status`,`session.list`,`session.show`,`turn.show`,`voice.managed-turn.preview`]),uO=[`node.shutdown`,`node.status`],dO=cO,fO=[`events.watch`,`observe.events`,`session.attach`],pO=new Set(uO),mO=dO.map(e=>({channel:pO.has(e)?`control`:`ordinary`,httpMethod:eO,operationId:e,path:QD,transport:`http`})),hO=fO.map(e=>({operationId:e,path:$D,transport:`websocket`}));Object.freeze([...mO,...hO]);var gO=32,_O=131072,vO=oO-4096,yO=64,bO=new TextEncoder,xO=j.check(U(1,yO),R(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u)),SO=N({assignee:k(fS),key:xO,labels:k(QE),needs:k($E),path:zE,text:GE}),CO=e=>e.reduce((e,t)=>e+bO.encode(t.text).byteLength,0),wO=e=>bO.encode(JSON.stringify(e)).byteLength,TO=N({...sD,commandId:J,tasks:P(SO).check(By(1),H(gO),L(e=>CO(e)<=_O,{expected:`plan texts of at most ${String(_O)} UTF-8 bytes in all`}),L(e=>wO(e)<=vO,{expected:`plan tasks of at most ${String(vO)} UTF-8 bytes as compact JSON`})),workspaceId:J}),EO=N({id:J,key:xO,path:zE,revision:A(`1`),state:I([`ready`,`waiting`])}),DO=N({commandId:J,delivery:I([`duplicate`,`new`]),method:A(`board.task.plan`),receipt:Y,tasks:P(EO).check(By(1),H(gO))}).check(L(e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`board`&&new Set(e.tasks.map(({key:e})=>e)).size===e.tasks.length&&new Set(e.tasks.map(e=>e.id)).size===e.tasks.length,{expected:`a plan's tasks, each once, bound to its board receipt`})),OO=RD(`board.task.plan`,TO),kO=N({author:k(UE),createdAt:K,excerpt:j.check(U(1,120)),id:J,lastActivityAt:K,path:zE,replyCount:xD,schemaVersion:A(LE),state:k(BE),workspaceId:J}),AO=N(lD),jO=N({...sD,commandId:J,labels:k(QE),text:GE,threadId:J}),MO=N({...sD,afterCursor:k(J),limit:k(V.check(B({maximum:100,minimum:1}))),path:zE,workspaceId:J}),NO=N({...sD,...bD,threadId:J}),PO={commandId:J,delivery:I([`duplicate`,`new`]),message:qE,receipt:Y},FO=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`board_thread`&&e.receipt.target.id===e.message.threadId,IO=N({...PO,method:A(`board.message.post`),thread:KE}).check(L(e=>FO(e)&&e.message.id===e.message.threadId&&e.thread.id===e.message.threadId,{expected:`a post result with the thread's root message and its receipt`})),LO=N({...PO,method:A(`board.message.reply`)}).check(L(e=>FO(e)&&e.message.id!==e.message.threadId,{expected:`a reply result with a message after the root and its receipt`})),RO=N({actor:UE,items:P(kO).check(H(100)),method:A(`board.path.read`),nextCursor:k(J)}).check(L(e=>new Set(e.items.map(e=>e.workspaceId)).size<=1&&(e.nextCursor===void 0||e.items.length>0),{expected:`threads of one Workspace and a cursor only after items`})),zO=N({actor:UE,messages:P(qE).check(H(100)),method:A(`board.thread.show`),nextCursor:k(J),task:k(aD),thread:kO}).check(L(e=>e.messages.every(t=>t.threadId===e.thread.id)&&(e.nextCursor===void 0||e.messages.length>0)&&(e.task===void 0?e.thread.state===void 0:e.task.id===e.thread.id&&e.task.state===e.thread.state),{expected:`the thread's own messages, and its task exactly when it has a state`})),BO=F([RD(`board.message.post`,AO),RD(`board.message.reply`,jO),RD(`board.path.read`,MO),RD(`board.thread.show`,NO)]),VO=F([IO,LO,RO,zO]),HO=e=>({parse:e,safeParse(t){try{return{data:e(t),success:!0}}catch(e){return{error:e,success:!1}}}});G(iS),G(J),G(aS),G(ore);var UO=G(sre),WO=G(cre),GO=e=>HO(t=>{let n=UO.parse(t);return{...n,payload:e.parse(n.payload)}}),KO=HO(e=>e),qO=GO(KO),JO=(e=>HO(t=>{let n=WO.parse(t);return{...n,payload:{...n.payload,result:e.parse(n.payload.result)}}}))(KO);G(oS),G(lS);var YO=G(dS),XO=`maia.event.v2`,ZO=65536,QO=/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*){1,4}$/u,$O=9223372036854775807n,ek=e=>/^[0-9]{1,19}$/u.test(e)&&BigInt(e)<=$O,tk=j.check(R(/^[1-9][0-9]{0,18}$/u),L(ek,{expected:`a 64-bit sequence`})),nk=j.check(R(/^(?:0|[1-9][0-9]{0,18})$/u),L(ek,{expected:`a 64-bit sequence`})),rk=32,ik=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},die=(e,t)=>{let{length:n}=e,r=Reflect.ownKeys(e);if(!(Object.getPrototypeOf(e)===Array.prototype&&r.length===n+1&&r.every(e=>e===`length`||typeof e==`string`&&/^(?:0|[1-9][0-9]*)$/u.test(e)&&Number(e)<n)))throw Error(`payload array is not plain`);return Array.from({length:n},(n,r)=>ak(e[r],t+1))},ak=(e,t)=>{if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(t>=rk)throw Error(`payload too deep`);if(Array.isArray(e))return die(e,t);if(!ik(e)||Object.getOwnPropertySymbols(e).length>0)throw Error(`payload is not plain JSON`);return Object.fromEntries(Object.keys(e).map(n=>[n,ak(e[n],t+1)]))},fie=new _h({message:`Expected a plain JSON object`}),pie=xy.pipe(Py(Oy(j,xy),{decode:Fh(e=>If({catch:()=>fie,try:()=>{if(!ik(e))throw Error(`not an object`);return ak(e,0)}})),encode:Nh()})),mie=K.check(R(/\.[0-9]{3}Z$/u)),ok=j.check(R(/^event_[0-7][0-9A-HJKMNP-TV-Z]{25}$/u)),sk=j.check(H(128),R(QO)),hie=tk,ck=nk,gie=N({id:J,seq:tk,type:J}),_ie=N({command:k(J),id:ok,kind:sk,node:J,payload:pie,schemaVersion:A(XO),seq:tk,source:J,subject:gie,ts:mie,v:V.check(B({maximum:65535,minimum:1}))}).check(L(e=>e.kind.split(`.`)[0]===e.source,{expected:`a source equal to the first segment of the kind`}));N({epoch:J,expiresAt:K,filterDigest:j.check(R(/^[a-f0-9]{64}$/u)),node:J,seq:nk});var lk=j.check(R(/^ev1\.[A-Za-z0-9_-]{16,2048}$/u));j.check(R(/^evf1\.[A-Za-z0-9_-]{16,16384}$/u));var vie=F([lk,ok,hie]),yie=N({kinds:k(P(sk).check(By(1),H(16))),limit:k(V.check(B({maximum:100,minimum:1}))),since:k(vie),subject:k(N({id:J,type:J}))}),uk={head:ck,method:A(`events.read`),oldest:ck},bie=F([N({...uk,events:P(_ie),next:lk,status:A(`ok`)}),N({...uk,next:lk,reason:I([`cursor_expired`,`epoch_changed`,`position_ahead`,`position_pruned`]),status:A(`cursor_reset_required`)}),N({method:A(`events.read`),status:A(`invalid_cursor`)})]),xie=N({method:A(`events.read`),parameters:yie}),dk=I([`stopped`,`waiting_approval`,`working`,`idle`]),Sie=N({approvalId:k(J),from:My(dk),to:dk}).check(L(e=>e.to===`waiting_approval`==(e.approvalId!==void 0)),L(e=>e.from!==e.to||e.to===`waiting_approval`)),fk=I([`starting`,`working`,`compacting`,`rate_limited`,`idle`,`question`,`approval`,`error`,`done`,`ended`,`unknown`]),Cie=N({approvalId:k(J),from:My(fk),to:fk}).check(L(e=>(e.to===`question`||e.to===`approval`)==(e.approvalId!==void 0),{expected:`an approval ID with a question or approval status`}),L(e=>e.from!==e.to||e.to===`question`||e.to===`approval`,{expected:`a change of status or of prompt`})),wie=`maia.hold/v1`,pk=J.check(R(/^hold_[a-f0-9]{32}$/u)),mk=pk,hk=q.check(R(/^[1-9]\d*$/u)),Tie=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),gk=j.check(R(/^sha256:[a-f0-9]{64}$/u)),_k=N({id:J,kind:I([`connection`,`project`])}),vk=I([`keep`,`stop`]),yk=I([`active`,`released`]),bk=P(_k).check(By(1),H(64),L(e=>new Set(e.map(e=>`${e.kind}:${e.id}`)).size===e.length,{expected:`unique hold targets`})),xk=e=>new Set(e).size===e.length,Sk=N({createdAt:K,id:mk,reason:nS,revision:hk,running:vk,schemaVersion:A(wie),state:yk,targets:bk,updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt)&&e.state===`active`==(e.revision===`1`))),Ck=N({connectionId:k(J),projectId:J,sessionId:J,state:I([`recovering`,`running`,`starting`])}),Eie=P(Ck).check(H(64),L(e=>xk(e.map(e=>e.sessionId)),{expected:`unique Sessions`})),Die=P(J).check(H(64),L(xk,{expected:`unique Sessions`})),wk=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),state:k(yk)}),Tk=N({items:P(Sk).check(H(100)),method:A(`hold.list`),nextCursor:k(J)}).check(L(e=>xk(e.items.map(e=>e.id)))),Ek={commandId:J,reason:nS,running:vk,targets:bk},Dk={commandId:J,expectedRevision:hk,holdId:mk},Ok={inputDigest:gk,proof:Tie},kk={...Ok,actorId:J,expiresAt:K,issuedAt:K},Ak=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),jk=N(Ek),Mk=N({...Ek,...Ok}),Nk=N(Dk),Pk=N({...Dk,...Ok}),Fk=N({...Ek,...kk,holdId:mk,method:A(`hold.place.preview`),sessions:Eie}).check(L(Ak)),Ik=N({...Dk,...kk,method:A(`hold.release.preview`),targets:bk}).check(L(Ak)),Lk={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),hold:Sk,inputDigest:gk,receipt:Y},Rk=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`hold`&&e.receipt.target.id===e.hold.id&&e.receipt.aggregateRevision===e.hold.revision&&e.receipt.createdAt===e.hold.updatedAt,zk=N({...Lk,method:A(`hold.place.confirm`),stoppedSessionIds:Die}).check(L(e=>Rk(e)&&e.hold.state===`active`&&e.hold.createdAt===e.hold.updatedAt&&(e.hold.running===`stop`||e.stoppedSessionIds.length===0))),Bk=N({...Lk,expectedRevision:hk,method:A(`hold.release.confirm`)}).check(L(e=>Rk(e)&&e.hold.state===`released`&&BigInt(e.hold.revision)===BigInt(e.expectedRevision)+1n)),Oie=F([N({method:A(`hold.list`),parameters:wk}),N({method:A(`hold.place.preview`),parameters:jk}),N({method:A(`hold.place.confirm`),parameters:Mk}),N({method:A(`hold.release.preview`),parameters:Nk}),N({method:A(`hold.release.confirm`),parameters:Pk})]),kie=F([Tk,Fk,zk,Ik,Bk]),Vk=`maia.node.stdio/v1`;oO+65536;var Hk=j.check(U(1,256)),Uk=Oy(j,xy),Wk=e=>Uk.check(L(t=>{let n=t[e];return typeof n==`string`&&n.length>0&&n.length<=256},{expected:`an envelope with a ${e}`})),Gk=N({envelope:Wk(`messageId`),principal:k(A(aO)),type:A(`request`)}),Aie=j.check(R(/^\d{1,4}\.\d{1,4}\.\d{1,4}(?:-nightly\.\d{8}\.\d{1,6}|-canary\.\d{1,6})?$/u)),jie=N({protocol:A(Vk),status:Uk,type:A(`ready`),version:Aie}),Mie=F([Gk,N({envelope:Wk(`messageId`),principal:k(A(aO)),type:A(`subscribe`)}),N({messageId:Hk,type:A(`unsubscribe`)})]),Nie=N({frame:Uk,messageId:Hk,type:A(`item`)}),Pie=F([N({messageId:Hk,reason:I([`completed`,`lost`,`unsubscribed`]),type:A(`end`)}),N({code:j.check(R(/^[a-z][a-z_]{0,63}$/u)),messageId:Hk,reason:A(`failure`),type:A(`end`)})]),Fie=F([jie,N({message:j.check(H(1024)),protocol:A(Vk),reason:I([`credential_unavailable`,`node_unavailable`]),type:A(`unavailable`)}),N({envelope:Wk(`correlationId`),type:A(`response`)}),N({code:j.check(R(/^[a-z][a-z_]{0,63}$/u)),message:j.check(H(1024)),messageId:Hk,remoteError:k(Uk),type:A(`failure`)}),Nie,Pie]),Iie=`maia.remote-node/v1`,Lie=4e3,Rie=/^[a-z0-9][a-z0-9-]{0,62}$/u,zie=/^(?!-)[A-Za-z0-9._@-]{1,253}$/u,Bie=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u,Kk=String.raw`(?!\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}`,Vie=new RegExp(String.raw`^(?:~/|/)${Kk}(?:/${Kk})*$`,`u`),Hie=new RegExp(String.raw`^/${Kk}(?:/${Kk})*$`,`u`),qk=String.raw`(?!\.{1,2}(?:/|$))[A-Za-z0-9._@+-]{1,255}`,Uie=new RegExp(String.raw`^/${qk}(?:/${qk})*$`,`u`),Wie=/^\/[^\p{Cc}]{0,4095}$/u,Gie=/^[a-f0-9]{64}$/u,Kie=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u,Jk=j.check(R(Rie)),Yk=j.check(R(zie)),Xk=j.check(R(Bie)),qie=j.check(H(256),R(Vie)),Zk=j.check(H(512),R(Hie)),Jie=j.check(H(1024),R(Uie)),Qk=j.check(R(Wie)),$k=j.check(R(Gie)),eA=j.check(R(Kie)),Yie=V.check(B({maximum:8,minimum:2})),tA=V.check(B({maximum:Lie,minimum:0})),nA=j.check(R(/^sha256:[a-f0-9]{64}$/u)),rA=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),Xie=q.check(R(/^[1-9]\d*$/u)),iA={claudeBin:k(Zk),codexBin:k(Zk),host:Yk,profile:Xk,root:qie,commandId:J,keep:Yie,name:Jk,nodeRuntime:Qk,release:k(Qk)},aA={commandId:J,host:Yk,launcherPath:k(Zk),name:Jk,profile:k(Xk)},oA={commandId:J,expectedRevision:Xie,name:Jk,purge:M},sA=N({...iA,waitMs:k(tA)}),cA=N({...iA,inputDigest:nA,planDigest:nA,proof:rA,waitMs:k(tA)}),lA=N({includeRemoved:k(M)}),uA=N(aA),dA=N({...aA,inputDigest:nA,planDigest:nA,proof:rA}),fA=N(oA),pA=N({...oA,inputDigest:nA,proof:rA,waitMs:k(tA)}),mA=F([N({method:A(`node.remote.install.preview`),parameters:sA}),N({method:A(`node.remote.install.confirm`),parameters:cA}),N({method:A(`node.remote.list`),parameters:lA}),N({method:A(`node.remote.register.preview`),parameters:uA}),N({method:A(`node.remote.register.confirm`),parameters:dA}),N({method:A(`node.remote.remove.preview`),parameters:fA}),N({method:A(`node.remote.remove.confirm`),parameters:pA})]),hA=j.check(R(/^[a-z0-9][a-z0-9-]{0,31}$/u)),gA=j.check(R(/^[A-Za-z0-9][A-Za-z0-9.+-]{0,63}$/u)),_A=j.check(H(256)),vA=2048,yA=j.check(R(/^[a-z][a-z0-9-]{0,31}$/u)),bA=I([`automatic`,`notify`,`manual`]),xA={revision:q,unreadable:k(A(!0)),value:bA},SA={failed:k(gA),installing:k(gA),name:hA,reachedAt:k(K),repair:k(j.check(H(vA))),rollbackRequested:k(M),version:k(gA),watching:k(gA)},CA=N(SA),wA=F([N({...SA,paused:M,pauseReason:k(_A),state:A(`recorded`)}),N({reason:_A,state:A(`unknown`)})]),TA={commandId:J,from:gA,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),node:hA,proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K},EA={...TA,to:gA},DA=Oy(j,by),OA=N({method:A(`node.update.show`),nodes:P(CA).check(H(64)),paused:M,reason:k(_A),revision:q}),kA=N({available:My(gA),channel:yA,checkedAt:My(K),current:gA,method:A(`node.update.check`),node:My(hA),paused:My(N({reason:k(_A)})),policy:N(xA),requested:My(N({at:K,version:gA})),revision:q,web:My(N({failure:My(N({at:K,attempts:V.check(B({maximum:1e3,minimum:1})),text:_A,version:gA})),live:My(N({at:K,version:gA}))}))}),AA=32,jA=V.check(B({maximum:1e6,minimum:0})),MA=V.check(B({maximum:1440,minimum:0})),NA=N({blocking:P(N({sessionId:J,why:I([`starting`,`stopping`,`recovering`,`waiting-approval`,`turn`])})).check(H(AA)),blockingTotal:jA,idle:M,last:My(N({at:K,outcome:I([`updated`,`failed`,`rolled-back`,`restarted-busy`]),text:k(_A),version:gA})),method:A(`node.update.status`),settings:My(N({busyRestartMinutes:MA,idleWaitMinutes:MA,soakMinutes:MA})),waiting:My(N({since:K,version:gA}))}),PA=N({...xA,method:A(`node.update.policy.get`)}),FA=N({commandId:J,revision:q,value:bA}),IA=N({method:A(`node.update.policy.set`),receiptId:J,replayed:M,revision:q,value:bA}),LA=N({commandId:J,reason:k(_A)}),RA=N({method:A(`node.update.pause`),paused:A(!0),reason:k(_A),receiptId:J,replayed:M,revision:q}),zA=N({commandId:J}),BA=N({method:A(`node.update.resume`),paused:A(!1),receiptId:J,replayed:M,revision:q}),VA=N({commandId:J,node:hA}),HA=N({...TA,method:A(`node.update.rollback.preview`)}),UA=N(TA),WA=N({from:gA,method:A(`node.update.rollback.confirm`),node:hA,receiptId:J,replayed:M,revision:q}),GA=VA,KA=N({...EA,method:A(`node.update.apply.preview`)}),qA=N(EA),JA=N({from:gA,method:A(`node.update.apply.confirm`),node:hA,receiptId:J,replayed:M,revision:q,to:gA}),YA=F([N({method:A(`node.update.show`),parameters:DA}),N({method:A(`node.update.check`),parameters:DA}),N({method:A(`node.update.status`),parameters:DA}),N({method:A(`node.update.policy.get`),parameters:DA}),N({method:A(`node.update.policy.set`),parameters:FA}),N({method:A(`node.update.pause`),parameters:LA}),N({method:A(`node.update.resume`),parameters:zA}),N({method:A(`node.update.rollback.preview`),parameters:VA}),N({method:A(`node.update.rollback.confirm`),parameters:UA}),N({method:A(`node.update.apply.preview`),parameters:GA}),N({method:A(`node.update.apply.confirm`),parameters:qA})]),XA=F([OA,kA,NA,PA,IA,RA,BA,HA,WA,KA,JA]),ZA=e=>j.check(H(e)),QA=j.check(R(/^[a-z][a-z_]{0,63}$/u)),$A=j.check(R(/^sha256:[a-f0-9]{64}$/u)),ej=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),tj=j.check(R(/^maia-node-[A-Za-z0-9][A-Za-z0-9._-]{0,63}\.service$/u)),nj=V.check(z(0)),rj=V.check(B({maximum:8,minimum:2})),ij=I(yS),aj=N({path:Zk,sha256:$k}),oj=N({executor:ij,interpreter:k(aj),path:k(Zk),realPath:k(Jie),reason:k(ZA(512)),sha256:k($k),source:I([`discovered`,`override`]),state:I([`available`,`unavailable`])}),sj=N({code:QA,message:ZA(1024),remedy:k(ZA(1024))}),cj=N({activeRelease:k(eA),arch:ZA(64),distro:ZA(256),home:ZA(512),kernel:ZA(128),landlockAbi:k(nj),linger:ZA(64),os:ZA(64),root:ZA(512),rootState:I([`absent`,`empty`,`foreign`,`maia`,`symlink`]),systemdVersion:k(nj),user:ZA(64)}),lj=N({cli:aj,executorChanges:P(N({executor:ij,from:k(aj),to:k(aj)})).check(H(2)),executors:P(oj).check(H(2)),keep:rj,launcherPath:Zk,maiaVersion:ZA(64),mode:I([`install`,`reinstall`,`upgrade`]),path:ZA(4096),previousRelease:k(eA),profile:Xk,prune:N({releases:P(eA).check(H(16)),runtimes:P(eA).check(H(16))}),releaseId:eA,root:Zk,runtimeId:eA,unitName:tj,uploadBytes:nj}),uj=e=>e.origin===`registered`?e.root===void 0&&e.unitName===void 0:e.root!==void 0&&e.unitName!==void 0,dj=N({createdAt:K,error:k(N({code:QA,message:ZA(2048)})),executors:P(oj).check(H(2)),host:Yk,installedAt:k(K),launcherPath:Zk,maiaVersion:k(ZA(64)),name:Jk,origin:k(A(`registered`)),profile:Xk,releaseId:k(eA),remaining:k(P(ZA(512)).check(H(64))),revision:q,root:k(Zk),schemaVersion:A(Iie),state:I([`installing`,`ready`,`install_failed`,`removing`,`removed`,`remove_failed`]),unitName:k(tj),update:k(wA),updatedAt:K}).check(L(uj)),fj=N({host:Yk,instanceId:J,launcherPath:Zk,maiaVersion:ZA(64),profile:Xk}),pj={host:Yk,profile:Xk},mj={actorId:J,expiresAt:K,inputDigest:$A,issuedAt:K,proof:ej},hj=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),gj=F([N({commandId:J,method:A(`node.remote.install.preview`),state:A(`probing`)}),N({blockers:P(sj).check(By(1),H(32)),commandId:J,facts:cj,method:A(`node.remote.install.preview`),state:A(`blocked`)}),N({...mj,commandId:J,method:A(`node.remote.install.preview`),name:Jk,plan:lj,planDigest:$A,state:A(`ready`)}).check(L(hj))]),_j=N({...mj,commandId:J,method:A(`node.remote.register.preview`),name:Jk,plan:fj,planDigest:$A}).check(L(hj)),vj={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:$A,node:dj,receipt:Y},yj=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`remote_node`&&e.receipt.target.id===e.node.name,bj=N({...vj,method:A(`node.remote.register.confirm`)}).check(L(yj)),xj=N({...vj,method:A(`node.remote.install.confirm`)}).check(L(yj)),Sj=N({local:k(N({update:k(wA)})),method:A(`node.remote.list`),nodes:P(dj).check(H(64))}).check(L(e=>new Set(e.nodes.map(e=>e.name)).size===e.nodes.length)),Cj=N({...mj,...pj,commandId:J,expectedRevision:q,method:A(`node.remote.remove.preview`),name:Jk,origin:k(A(`registered`)),purge:M,root:k(Zk),unitName:k(tj)}).check(L(hj),L(uj)),wj=N({...vj,method:A(`node.remote.remove.confirm`)}).check(L(yj)),Tj=F([gj,xj,Sj,_j,bj,Cj,wj]),Ej=`maia.session-guard/v1`,Dj=I([`orchestrator`,`worker`]),Oj={maxDepth:{maximum:4,minimum:1},maxLeasesPerSession:{maximum:64,minimum:1},maxLiveChildren:{maximum:64,minimum:1},maxMessagesPerMinute:{maximum:600,minimum:1}},kj=N({coordinator:I([`none`,`answer`,`decide`])}),Aj=N({coordinator:k(kj.fields.coordinator)}),jj=e=>V.check(B(e)),Mj=N({maxDepth:jj(Oj.maxDepth),maxLeasesPerSession:jj(Oj.maxLeasesPerSession),maxLiveChildren:jj(Oj.maxLiveChildren),maxMessagesPerMinute:jj(Oj.maxMessagesPerMinute)}),Nj=N({approvalGrants:kj,limits:Mj,projectId:J,revision:q,schemaVersion:A(Ej),source:I([`default`,`project`]),updatedAt:k(K)}).check(L(e=>e.source==="default"?e.revision===`0`&&e.updatedAt===void 0:e.revision!==`0`&&e.updatedAt!==void 0,{expected:`Project guards at revision 0 without updatedAt, or set guards with both`})),Pj=N({projectId:J}),Fj={approvalGrants:k(Aj),commandId:J,expectedRevision:q,limits:Mj,projectId:J},Ij={inputDigest:j.check(R(/^sha256:[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u))},Lj=N(Fj),Rj=N({...Fj,...Ij}),zj=F([N({method:A(`project.guard.show`),parameters:Pj}),N({method:A(`project.guard.preview`),parameters:Lj}),N({method:A(`project.guard.confirm`),parameters:Rj})]),Bj=Ij,Vj=N({guard:Nj,method:A(`project.guard.show`)}),Hj=N({...Bj,actorId:J,approvalGrants:kj,commandId:J,current:Nj,expectedRevision:q,expiresAt:K,issuedAt:K,limits:Mj,method:A(`project.guard.preview`),projectId:J}).check(L(e=>e.current.projectId===e.projectId&&e.current.revision===e.expectedRevision&&Date.parse(e.issuedAt)<Date.parse(e.expiresAt),{expected:`a preview of the Project's current guard, before it expires`})),Uj=N({commandId:J,delivery:I([`duplicate`,`new`]),expectedRevision:q,guard:Nj,inputDigest:Bj.inputDigest,method:A(`project.guard.confirm`),receipt:Y}).check(L(e=>e.guard.source===`project`&&BigInt(e.guard.revision)===BigInt(e.expectedRevision)+1n&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`project_guard`&&e.receipt.target.id===e.guard.projectId&&e.receipt.aggregateRevision===e.guard.revision,{expected:`confirmed Project guards advanced by one revision and bound to their receipt`})),Wj=F([Uj,Hj,Vj]),Gj=16384,Kj=32768,qj=4e3,Jj=[`image/gif`,`image/jpeg`,`image/png`,`image/webp`],Yj=524288,Xj=e=>Math.ceil(e/3)*4,Zj=new TextEncoder,Qj=((e,t)=>j.check(By(1),L(t=>Zj.encode(t).byteLength<=e,{expected:t})))(Gj,`turn input encoded as at most 16384 UTF-8 bytes`),$j=j.check(L(e=>Zj.encode(e).byteLength<=Kj,{expected:`turn response encoded as at most 32768 UTF-8 bytes`})),eM=V.check(z(0)),tM=V.check(z(1)),nM=N({cachedInputTokens:eM,contextTokens:k(eM),contextWindow:k(tM),inputTokens:eM,modelCallCount:k(eM),outputTokens:eM,reasoningOutputTokens:eM,totalTokens:eM}),rM=N({text:Qj,type:A(`text`)}),iM=j.check(U(1,128),L(e=>e!==`.`&&e!==`..`&&!/[/\\]|\p{Cc}/u.test(e),{expected:`a file name with no path separator or control character`})),aM=V.check(B({maximum:Yj,minimum:1})),oM=N({byteLength:aM,mediaType:I(Jj),name:iM,sha256:j.check(R(/^[0-9a-f]{64}$/u))}),sM=N({data:j.check(U(4,Xj(Yj)),R(/^[A-Za-z0-9+/]*={0,2}$/u),L(e=>e.length%4==0,{expected:`base64 text padded to a multiple of 4 characters`})),mediaType:j.check(R(/^[a-z0-9][a-z0-9!#$&^_.+-]{0,126}\/[a-z0-9][a-z0-9!#$&^_.+-]{0,126}$/u)),name:iM}),cM={attachments:k(P(oM).check(By(1),H(4))),createdAt:K,id:J,input:rM,revision:q,schemaVersion:A(1),sessionId:J,sessionRevision:q,updatedAt:K},lM=N({...cM,state:A(`queued`)}),uM=N({...cM,state:A(`dispatching`)}),dM=N({...cM,state:A(`running`)}),fM=N({...cM,responseText:$j,state:A(`completed`),tokenUsage:k(nM)}),pM=N({...cM,failure:k(uS),failureReason:I([`approval_required`,`repository_changed`,`runtime_failed`,`turn_rejected`]),state:A(`failed`)}),mM=N({...cM,failure:k(uS),failureReason:I([`output_limit_exceeded`,`protocol_invalid`,`runtime_exited`,`turn_deadline_exceeded`]),state:A(`outcome-unknown`)}),hM=F([pM.fields.failureReason,mM.fields.failureReason]),gM=F([lM,uM,dM,fM,pM,mM,N({...cM,state:A(`interrupted`)})]),_M=N({commandId:J,expectedRevision:q,turnId:J}),vM=N({attachments:k(P(sM).check(By(1),H(4))),commandId:J,expectedRevision:q,input:rM,sessionId:J}),yM=N({turnId:J}),bM=N({sessionId:J}),xM={commandId:J.check(H(118)),expectedRevision:q,input:rM,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),turnId:J,validUntil:K},SM=N({commandId:xM.commandId,expectedRevision:xM.expectedRevision,input:rM,turnId:xM.turnId}),CM=N(xM),wM=N({delivery:I([`new`,`duplicate`]),method:A(`turn.interrupt`),receipt:Y,turn:gM}),TM=N({delivery:I([`new`,`duplicate`]),method:A(`turn.send`),receipt:Y,turn:gM}),EM=N({method:A(`turn.show`),turn:gM}),DM=N({accepted:M,maxBytes:aM,mediaTypes:P(I(Jj)).check(H(Jj.length)),method:A(`turn.attachment.policy`),sessionId:J}),OM=I([`interrupt-restart`,`native`]),kM=N({...xM,method:A(`turn.steer.preview`),path:OM}),AM=N({delivery:I([`new`,`duplicate`]),method:A(`turn.steer.confirm`),path:OM,receipt:Y,source:gM,turn:gM}),jM=N({mode:I([`all`,`any`]),turnIds:P(J).check(By(1),H(16)),waitMilliseconds:V.check(z(0),Ry(qj))}),MM=I([`queued`,`dispatching`,`running`,`completed`,`failed`,`outcome-unknown`,`interrupted`]),NM=N({failure:k(uS),failureReason:k(I([`approval_required`,`output_limit_exceeded`,`protocol_invalid`,`repository_changed`,`runtime_exited`,`runtime_failed`,`turn_deadline_exceeded`,`turn_rejected`])),id:J,revision:q,sessionId:J,state:MM,updatedAt:K}),PM=N({method:A(`turn.wait`),satisfied:M,turns:P(NM).check(H(16))}),FM=N({commandId:J,expectedRevision:q,turnId:J}),IM=N({delivery:I([`new`,`duplicate`]),method:A(`turn.cancel`),outcome:I([`cancelled`,`already_dispatched`]),receipt:Y,turn:gM}),LM=N({sessionId:J}),RM=N({activeTurn:k(N({id:J,revision:q,state:I([`dispatching`,`running`])})),method:A(`turn.queue.list`),queue:P(N({createdAt:K,id:J,inputPreview:j.check(L(e=>Zj.encode(e).byteLength<=160,{expected:`preview encoded as at most 160 UTF-8 bytes`})),position:V.check(z(1),Ry(8)),revision:q})).check(H(8)),sessionId:J}),zM=F([N({method:A(`turn.attachment.policy`),parameters:bM}),N({method:A(`turn.cancel`),parameters:FM}),N({method:A(`turn.queue.list`),parameters:LM}),N({method:A(`turn.interrupt`),parameters:_M}),N({method:A(`turn.send`),parameters:vM}),N({method:A(`turn.show`),parameters:yM}),N({method:A(`turn.steer.confirm`),parameters:CM}),N({method:A(`turn.steer.preview`),parameters:SM}),N({method:A(`turn.wait`),parameters:jM})]),BM=F([DM,IM,RM,wM,TM,EM,AM,kM,PM]);G(Dj),G(kj),G(Mj),G(Nj),G(Pj),G(Lj),G(Rj);var VM=G(Vj),HM=G(Hj),UM=G(Uj),WM=[`board.message.post`,`board.message.reply`,`board.path.read`,`board.task.claim`,`board.task.complete`,`board.task.create`,`board.task.fail`,`board.task.list`,`board.task.release`,`board.task.renew`,`board.task.show`,`board.thread.show`,`context.show`,`node.status`,`port.lease.acquire`,`port.lease.list`,`port.lease.release`,`port.lease.renew`,`project.knowledge.search`,`secret.request`,`session.inbox.ack`,`session.inbox.check`,`session.list`,`session.message.send`],GM=Object.freeze({orchestrator:Object.freeze([...WM,`approval.list`,`approval.respond`,`approval.show`,`goal.clear`,`goal.mark`,`goal.set`,`goal.show`,`goal.transition`,`goal.update`,`project.guard.show`,`session.create`,`session.show`,`session.start`,`session.stop`,`turn.send`,`turn.show`]),worker:Object.freeze(WM)}),KM=4096,qM=86400,JM=2592e3,YM=49152,XM=[`failed`,`approval_pending`,`question`,`turn_failed`,`stalled`,`settled_unreviewed`],ZM={[X.claudeCode]:[`default`,`acceptEdits`,`plan`,`dontAsk`,`bypassPermissions`],[X.codex]:[`untrusted`,`on-request`,`never`]};new Map(Object.entries(GM));var QM={concurrency:4,depth:3,fanOut:8},$M={concurrency:{maximum:64,minimum:1},depth:{maximum:8,minimum:1},fanOut:{maximum:64,minimum:1}},eN=1e5,tN={id:`node`,type:`session-spawn-caps`},nN={[X.claudeCode]:[`low`,`medium`,`high`,`xhigh`,`max`],[X.codex]:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},rN={[X.claudeCode]:`launch-flag`,[X.codex]:`launch-flag`},iN=e=>Object.hasOwn(rN,e),aN=(e,t)=>Object.hasOwn(e,t)?e[t]??[]:[],oN=e=>aN(nN,e),sN=e=>aN(ZM,e),cN=4e3,lN=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),uN=V.check(z(0)),dN=k(uN),fN=N({sessionIds:k(P(J).check(By(1),H(32))),stallAfterSeconds:k(V.check(z(10),Ry(qM)))}),Zie=N({declinedRequests:uN,eventCount:uN,idleMilliseconds:uN,lastEventAt:k(K),lastEventKind:k(j.check(U(1,128)))}),Qie=N({cpuTimeMilliseconds:dN,processCount:dN,rssBytes:dN,wallTimeMilliseconds:dN}),$ie=N({elapsedMilliseconds:uN,runtimeTurnId:j.check(U(1,256)),startedAt:K,turnId:J}),eae=N({activity:Zie,health:I([`idle`,`stalled`,`working`]),process:k(Qie),runtime:lN,runtimeThreadId:j.check(U(1,256)),startedAt:K,turn:k($ie)}),pN=N({attention:k(I(XM)),runtime:k(eae),sessionId:J}),mN=N({items:P(pN).check(H(64)),method:A(`session.observe`),observedAt:K,stallAfterSeconds:V.check(z(10),Ry(qM))}),hN=j.check(R(/^[a-f0-9]{64}$/u)),gN={commandId:J,globalCursor:q,recordedAt:K,schemaVersion:A(4),sessionCursor:q,sessionId:J},_N=e=>N({...e,turnId:J}),tae=F([N({...gN,eventType:A(`turn.queued`),payload:_N({inputDigest:hN})}),N({...gN,eventType:A(`turn.dispatching`),payload:_N({})}),N({...gN,eventType:A(`turn.started`),payload:_N({})}),N({...gN,eventType:A(`turn.completed`),payload:_N({outputDigest:hN,tokenUsage:k(nM)})}),N({...gN,eventType:A(`turn.interrupted`),payload:_N({})}),N({...gN,eventType:A(`turn.failed`),payload:_N({failure:k(uS),reason:I([`approval_required`,`output_limit_exceeded`,`protocol_invalid`,`repository_changed`,`runtime_exited`,`runtime_failed`,`turn_deadline_exceeded`,`turn_rejected`]),state:I([`failed`,`outcome-unknown`])})})]),vN=J.check(R(/^container_[A-Za-z0-9_-]+$/u)),yN=q.check(R(/^[1-9]\d*$/u)),bN=J,xN=V.check(B({maximum:100,minimum:1})),nae=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),SN=j.check(R(/^sha256:[a-f0-9]{64}$/u)),CN=N({createdAt:K,id:vN,name:nS,revision:yN,schemaVersion:A(`maia.container/v1`),updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt))),wN=N({id:J,name:nS,revision:yN}),TN=N({afterCursor:k(bN),limit:xN}),EN=N({afterCursor:k(bN),containerId:vN,limit:xN}),DN=N({items:P(CN).check(H(100)),method:A(`container.list`),nextCursor:k(bN)}).check(L(e=>new Set(e.items.map(e=>e.id)).size===e.items.length)),ON=N({container:CN,method:A(`container.show`),nextCursor:k(bN),projects:P(wN).check(H(100))}).check(L(e=>new Set(e.projects.map(e=>e.id)).size===e.projects.length)),kN=500,rae=V.check(B({maximum:kN,minimum:1})),iae=N({...wN.fields,path:k(j.check(U(1,4096)))}),aae=N({container:CN,projectCount:V.check(z(0)),projects:P(iae)}).check(L(e=>e.projects.length<=e.projectCount&&new Set(e.projects.map(e=>e.id)).size===e.projects.length)),AN=N({afterCursor:k(bN),limit:rae}),oae=e=>e.reduce((e,t)=>e+Math.max(t.projects.length,1),0),jN=N({items:P(aae),method:A(`container.index.list`),nextCursor:k(bN)}).check(L(e=>oae(e.items)<=kN&&new Set(e.items.map(e=>e.container.id)).size===e.items.length)),MN={commandId:J,name:nS},NN={...MN,containerId:vN,expectedRevision:yN},PN={inputDigest:SN,proof:nae},FN={...PN,actorId:J,expiresAt:K,issuedAt:K},IN=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),LN=N(MN),RN=N(NN),zN=N({...MN,...PN}),BN=N({...NN,...PN}),VN=N({...MN,...FN,containerId:vN,method:A(`container.create.preview`)}).check(L(IN)),HN=N({...NN,...FN,method:A(`container.rename.preview`)}).check(L(IN)),UN={actorId:J,commandId:J,container:CN,delivery:I([`new`,`duplicate`]),inputDigest:SN,receipt:Y},WN=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`container`&&e.receipt.target.id===e.container.id&&e.receipt.aggregateRevision===e.container.revision&&e.receipt.createdAt===e.container.updatedAt,GN=N({...UN,method:A(`container.create.confirm`)}).check(L(e=>WN(e)&&e.container.revision===`1`&&e.container.createdAt===e.container.updatedAt)),KN=N({...UN,expectedRevision:yN,method:A(`container.rename.confirm`)}).check(L(e=>WN(e)&&BigInt(e.container.revision)===BigInt(e.expectedRevision)+1n)),sae=F([N({method:A(`container.list`),parameters:TN}),N({method:A(`container.show`),parameters:EN}),N({method:A(`container.index.list`),parameters:AN}),N({method:A(`container.create.preview`),parameters:LN}),N({method:A(`container.create.confirm`),parameters:zN}),N({method:A(`container.rename.preview`),parameters:RN}),N({method:A(`container.rename.confirm`),parameters:BN})]),cae=F([DN,ON,jN,VN,GN,HN,KN]),qN=16384,lae=524288,JN=1024,uae=[{host:`github.com`,kind:`github`}],dae=new TextEncoder,YN=(e,t)=>j.check(L(t=>t.length>0&&dae.encode(t).byteLength<=e&&!tS(t),{expected:t})),XN=YN(JN,`a branch name of up to 1024 bytes without control characters`),fae=j.check(R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),ZN=YN(JN,`a branch cursor a previous page returned`).check(R(/^refs\/(?:heads|remotes)\//u)),QN=N({afterCursor:k(ZN),kind:k(I([`all`,`local`,`remote`])),limit:V.check(z(1),Ry(100)),query:k(YN(255,`a query of up to 255 bytes without control characters`)),workspaceId:J}),$N=N({items:P(N({committedAt:k(K),current:M,headRevision:fae,kind:I([`local`,`remote`]),name:XN,upstream:k(XN)})).check(H(100)),method:A(`workspace.branches.list`),nextCursor:k(ZN)}),eP=N({workspaceId:J}),tP=N({host:k(YN(255,`a host name of up to 255 bytes`)),kind:I([...uae.map(({kind:e})=>e),`unknown`]),method:A(`workspace.code-host.show`),remote:k(XN),repository:k(YN(1024,`a repository path of up to 1024 bytes`)),workspaceId:J}).check(L(e=>e.kind===`unknown`||e.host!==void 0&&e.repository!==void 0,{expected:`a known code host with its host and repository`})),pae=[N({method:A(`workspace.branches.list`),parameters:QN}),N({method:A(`workspace.code-host.show`),parameters:eP})],mae=[$N,tP],nP=256,hae=256,rP=1024,gae=Math.ceil(lae/3)*4,iP=new TextEncoder,aP=q,oP=aP.check(R(/^[1-9]\d*$/u)),sP=j.check(R(/^sha256:[a-f0-9]{64}$/u)),cP=V.check(z(0)),_ae=/[\p{Cc}\\]/u,vae=e=>e!==``&&e!==`.`&&e!==`..`&&!_ae.test(e),lP=j.check(L(e=>iP.encode(e).byteLength<=nP&&e.split(`/`).every(vae),{expected:`a relative path of at most ${String(nP)} UTF-8 bytes with no empty, dot, dot-dot, backslash or control segment`})),uP=N({bytes:cP,path:lP,sha256:sP}),yae=P(uP).check(By(1),H(rP),L(e=>new Set(e.map(({path:e})=>e)).size===e.length,{expected:`files with unique paths`})),bae=P(lP).check(By(1),H(rP),L(e=>new Set(e).size===e.length,{expected:`unique paths`})),dP=N({...uP.fields,updatedAt:K}),fP={inputDigest:sP,proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},pP={commandId:J,expectedRevision:aP,files:yae,projectId:J},mP={commandId:J,expectedRevision:aP,paths:bae,projectId:J},hP={fileCount:cP,totalBytes:cP},gP=N({projectId:J}),_P=N({...hP,files:P(dP).check(H(256)),inContext:M,method:A(`project.knowledge.list`),projectId:J,revision:aP}),vP=N(pP),yP=N({...pP,...fP}),bP=N({...pP,...hP,...fP,actorId:J,method:A(`project.knowledge.add.preview`),replaced:cP}),xP=N({actorId:J,commandId:J,expectedRevision:aP,inputDigest:sP,method:A(`project.knowledge.add.confirm`),projectId:J,uploadExpiresAt:K}),SP=N({commandId:J,data:j.check(H(gae),R(/^[A-Za-z0-9+/]*={0,2}$/u),L(e=>e.length%4==0,{expected:`padded base64`})),offset:cP,path:lP,projectId:J,sha256:sP}),CP=N({bytes:cP,commandId:J,method:A(`project.knowledge.add.chunk`),offset:cP,path:lP}),wP=N({commandId:J,projectId:J}),TP=(e,t)=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===t&&e.receipt.target.type===`project-knowledge`&&e.receipt.target.id===e.projectId&&e.receipt.aggregateRevision===e.revision&&BigInt(e.revision)===BigInt(e.expectedRevision)+1n,EP={...hP,actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),expectedRevision:aP,projectId:J,receipt:Y,revision:oP},DP=N({...EP,added:cP,method:A(`project.knowledge.add.commit`),replaced:cP}).check(L(e=>TP(e,`project.knowledge.add.commit`),{expected:`a committed upload bound to its Project and receipt`})),OP=N(mP),kP=N({...mP,...fP}),AP=N({...mP,...hP,...fP,actorId:J,method:A(`project.knowledge.remove.preview`)}),jP=N({...EP,inputDigest:sP,method:A(`project.knowledge.remove.confirm`),removed:cP}).check(L(e=>TP(e,`project.knowledge.remove.confirm`),{expected:`a confirmed removal bound to its Project and receipt`})),MP=N({limit:k(V.check(z(1),Ry(20))),projectId:k(J),query:j.check(H(hae))}),NP=N({hits:P(N({path:lP,snippet:j.check(L(e=>iP.encode(e).byteLength<=512,{expected:`a snippet of at most 512 UTF-8 bytes`}))})).check(H(20)),method:A(`project.knowledge.search`),projectId:J,revision:aP}),xae=N({...hP,previousRevision:aP,projectId:J,revision:oP}),Sae=[N({method:A(`project.knowledge.list`),parameters:gP}),N({method:A(`project.knowledge.add.preview`),parameters:vP}),N({method:A(`project.knowledge.add.confirm`),parameters:yP}),N({method:A(`project.knowledge.add.chunk`),parameters:SP}),N({method:A(`project.knowledge.add.commit`),parameters:wP}),N({method:A(`project.knowledge.remove.preview`),parameters:OP}),N({method:A(`project.knowledge.remove.confirm`),parameters:kP}),N({method:A(`project.knowledge.search`),parameters:MP})],Cae=[_P,bP,xP,CP,DP,AP,jP,NP],wae=4096,PP=100,FP=new TextEncoder,IP=q,LP=IP.check(R(/^[1-9]\d*$/u)),RP=j.check(U(1,wae)),zP=j.check(U(40,64),R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),Tae=j.check(H(512),L(e=>Array.from(e,e=>{let t=e.codePointAt(0);return t!==void 0&&t>31&&t!==127}).every(Boolean)&&!e.includes(`\0`),{expected:`a Git branch without control or NUL characters`})),BP=N({createdAt:K,id:J,name:nS,revision:LP,schemaVersion:A(1),updatedAt:K}),VP=N({createdAt:K,id:J,locationId:J,name:nS,projectId:J,revision:LP,schemaVersion:A(1),updatedAt:K,vcs:A(`git`)}),HP=N({createdAt:K,id:J,kind:I([`local-main`,`git-worktree`]),name:nS,projectId:J,revision:LP,schemaVersion:A(1),state:I([`provisioning`,`ready`,`removing`,`failed`]),updatedAt:K}),UP=N({projectId:J,repositoryId:J}),WP=N({...UP.fields,workspaceId:J}),GP=N({...UP.fields,projectRevision:LP,repositoryRevision:LP}),KP=e=>`${e.projectId}\u0000${e.repositoryId}`,Eae=e=>new Set(e.map(e=>e.repositoryId)).size===e.length,qP=N({contextRevision:LP,focus:UP,members:P(GP).check(By(1),H(32)),schemaVersion:A(1),workspaceId:J,workspaceRevision:LP}).check(L(e=>Eae(e.members)&&e.members.filter(t=>KP(t)===KP(e.focus)).length===1,{expected:`unique Workspace repositories containing the exact selected focus`})),JP=N({contextRevision:LP,schemaVersion:A(1),systemPromptInput:qP,updatedAt:K,workspaceId:J,workspaceRevision:LP}).check(L(e=>e.contextRevision===e.systemPromptInput.contextRevision&&e.workspaceId===e.systemPromptInput.workspaceId&&e.workspaceRevision===e.systemPromptInput.workspaceRevision,{expected:`a Workspace context matching its versioned system-prompt input`})),YP=N({baseRevision:zP,branch:Tae,createdAt:K,dirty:M,headRevision:zP,id:J,locationId:J,mode:I([`canonical`,`git-worktree`]),ownership:F([N({cleanup:A(`never`),kind:A(`canonical`)}),N({cleanup:A(`unregister-only`),kind:A(`imported`)}),N({cleanup:A(`plan-required`),creationReceiptId:J,kind:A(`maia-created`)})]),repositoryId:J,revision:LP,role:I([`primary`,`attached`]),schemaVersion:A(1),state:I([`provisioning`,`ready`,`removing`,`failed`]),updatedAt:K,workspaceId:J}),XP=N({afterCursor:k(IP),limit:V.check(z(1),Ry(PP))}),ZP={commandId:J,containerId:vN,expectedContainerRevision:LP,name:nS},QP={commandId:ZP.commandId,containerId:ZP.containerId,expectedRevision:LP,name:nS,projectId:J},$P={inputDigest:j.check(R(/^sha256:[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u))},eF={...$P,actorId:J,expiresAt:K,issuedAt:K},tF=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),nF=N(ZP),rF=N({...ZP,...$P}),iF=N(QP),aF=N({...QP,...$P}),oF=N({...ZP,...eF,method:A(`project.create.preview`),projectId:J}).check(L(tF)),sF=N({...QP,...eF,method:A(`project.rename.preview`)}).check(L(tF)),cF={actorId:J,commandId:J,containerId:ZP.containerId,delivery:I([`new`,`duplicate`]),inputDigest:$P.inputDigest,project:BP,receipt:Y},lF=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`project`&&e.receipt.target.id===e.project.id&&e.receipt.aggregateRevision===e.project.revision&&e.receipt.createdAt===e.project.updatedAt&&Date.parse(e.project.createdAt)<=Date.parse(e.project.updatedAt),uF=N({...cF,containerRevision:LP,expectedContainerRevision:LP,method:A(`project.create.confirm`)}).check(L(e=>lF(e)&&e.project.revision===`1`&&e.project.createdAt===e.project.updatedAt&&BigInt(e.containerRevision)===BigInt(e.expectedContainerRevision)+1n)),dF=N({...cF,expectedRevision:LP,method:A(`project.rename.confirm`)}).check(L(e=>lF(e)&&BigInt(e.project.revision)===BigInt(e.expectedRevision)+1n)),fF=j.check(R(/^sha256:[a-f0-9]{64}$/u)),pF={expected:`instructions text of at most ${String(qN)} UTF-8 bytes`},mF=j.check(H(qN,pF),L(e=>!e.includes(`\0`),{expected:`instructions text without NUL characters`}),L(e=>FP.encode(e).byteLength<=qN,pF)),hF=N({digest:fF,projectId:J,revision:LP,text:mF,updatedAt:K}),gF={commandId:J,expectedRevision:IP,projectId:J,text:mF},_F={inputDigest:fF,proof:$P.proof,validUntil:K},vF=N({projectId:J}),yF=N({instructions:My(hF),method:A(`project.instructions.show`),projectId:J}),bF=N(gF),xF=N({...gF,..._F}),SF=N({...gF,..._F,actorId:J,method:A(`project.instructions.change.preview`)}),CF=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),digest:fF,expectedRevision:IP,inputDigest:fF,method:A(`project.instructions.change.confirm`),projectId:J,receipt:Y,revision:LP}).check(L(e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`project-instructions`&&e.receipt.target.id===e.projectId&&e.receipt.aggregateRevision===e.revision&&BigInt(e.revision)===BigInt(e.expectedRevision)+1n,{expected:`a confirmed change bound to its Project and receipt`})),Dae=N({digest:fF,previousRevision:IP,projectId:J,revision:LP}),wF=N({commandId:J,expectedRevision:A(`0`),name:nS,rootPath:RP}),TF=XP,EF=N({projectId:J}),DF=j.check(L(e=>!e.includes(`\0`)&&FP.encode(e).byteLength>=1&&FP.encode(e).byteLength<=4096,{expected:`a non-NUL project context note encoded as 1 to 4096 UTF-8 bytes`})),OF=N({attribution:A(`user`),body:DF,createdAt:K,id:J,projectId:J,schemaVersion:A(1),sequence:LP}),kF=N({attribution:A(`user`),body:DF,commandId:J,projectId:J}),AF=N({...XP.fields,projectId:J}),jF=N({noteId:J}),MF=N({...XP.fields,projectId:J}),NF=N({workspaceId:J}),PF=Oy(j,by),FF=N({commandId:J,expectedContextRevision:LP,expectedWorkspaceRevision:LP,projectId:J,repositoryId:J,workspaceId:J}),IF=N({commandId:J,expectedActiveContextRevision:LP,expectedActiveWorkspaceId:J,expectedContextRevision:LP,expectedWorkspaceRevision:LP,projectId:J,repositoryId:J,workspaceId:J}),LF=N({commandId:J,expectedRevision:LP,name:nS,rootPath:RP,workspaceId:J}),RF=N({checkout:YP,delivery:I([`new`,`duplicate`]),method:A(`project.register`),project:BP,receipt:Y,repository:VP,workspace:HP}),zF=N({items:P(BP).check(H(PP)),method:A(`project.list`),nextCursor:k(IP)}),BF=N({method:A(`project.show`),project:BP,repositories:P(VP).check(H(PP))}),VF=N({delivery:I([`new`,`duplicate`]),method:A(`project.context.record`),note:OF,receipt:Y}).check(L(e=>e.receipt.method===`project.context.record`&&e.receipt.state===`succeeded`&&e.receipt.target.id===e.note.projectId&&e.receipt.target.type===`project`,{expected:`a project context record receipt matching its project note`})),HF=N({items:P(OF).check(H(PP)),method:A(`project.context.list`),nextCursor:k(IP)}),UF=N({method:A(`project.context.show`),note:OF}),WF=N({items:P(HP).check(H(PP)),method:A(`workspace.list`),nextCursor:k(IP)}),GF=N({checkouts:P(YP).check(H(PP)),method:A(`workspace.show`),workspace:HP}),KF=e=>e.context.workspaceId===e.workspace.id&&e.context.workspaceRevision===e.workspace.revision&&e.context.systemPromptInput.members.some(t=>t.projectId===e.workspace.projectId),qF=(e,t)=>e.receipt.aggregateRevision===e.workspace.revision&&e.receipt.method===t&&e.receipt.state===`succeeded`&&e.receipt.target.id===e.workspace.id&&e.receipt.target.type===`workspace`,JF=N({context:JP,delivery:I([`new`,`duplicate`]),membership:WP,method:A(`workspace.membership.attach`),receipt:Y,workspace:HP}).check(L(e=>KF(e)&&qF(e,`workspace.membership.attach`)&&e.membership.workspaceId===e.workspace.id&&e.context.systemPromptInput.members.some(t=>KP(t)===KP(e.membership)),{expected:`an attached Workspace membership with matching context and receipt`})),YF=N({context:JP,delivery:I([`new`,`duplicate`]),method:A(`workspace.select`),receipt:Y,workspace:HP}).check(L(e=>KF(e)&&qF(e,`workspace.select`),{expected:`a selected Workspace context with a matching receipt`})),XF=N({context:JP,method:A(`workspace.context.show`),workspace:HP}).check(L(KF,{expected:`a Workspace context matching the returned Workspace`})),ZF=N({checkout:YP,delivery:I([`new`,`duplicate`]),method:A(`workspace.repository.attach`),receipt:Y,repository:VP,workspace:HP}),QF=F([N({method:A(`project.create.preview`),parameters:nF}),N({method:A(`project.create.confirm`),parameters:rF}),N({method:A(`project.rename.preview`),parameters:iF}),N({method:A(`project.rename.confirm`),parameters:aF}),...Sae,N({method:A(`project.instructions.change.preview`),parameters:bF}),N({method:A(`project.instructions.change.confirm`),parameters:xF}),N({method:A(`project.instructions.show`),parameters:vF}),N({method:A(`project.context.list`),parameters:AF}),N({method:A(`project.context.record`),parameters:kF}),N({method:A(`project.context.show`),parameters:jF}),N({method:A(`project.register`),parameters:wF}),N({method:A(`project.list`),parameters:TF}),N({method:A(`project.show`),parameters:EF}),N({method:A(`workspace.context.show`),parameters:PF}),N({method:A(`workspace.list`),parameters:MF}),N({method:A(`workspace.membership.attach`),parameters:FF}),N({method:A(`workspace.select`),parameters:IF}),N({method:A(`workspace.show`),parameters:NF}),N({method:A(`workspace.repository.attach`),parameters:LF}),...pae]),$F=F([oF,uF,sF,dF,SF,CF,yF,...Cae,HF,VF,UF,RF,zF,BF,XF,WF,JF,YF,GF,ZF,...mae]),eI=`maia.execution/v1alpha1`,tI=`provider_local_host`,nI=`execution_profile_local_host`,rI=`execution_profile_local_worktree`,iI=`placement_policy_local_default`,aI=`maia.execution-worktree/v1alpha1`,oI=`local-worktree`,sI=1048576,cI=e=>new TextEncoder().encode(e).byteLength,lI=q,uI=j.check(L(e=>/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(e),{expected:`an exact Git object revision`})),dI=j.check(L(e=>/^sha256:[a-f0-9]{64}$/u.test(e),{expected:`a lowercase SHA-256 digest`})),fI=j.check(By(1),L(e=>!e.includes(`\0`)&&cI(e)<=4096&&(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/u.test(e)),{expected:`a bounded absolute worktree path without NUL bytes`})),pI=j.check(U(6,160),L(e=>/^maia\/[A-Za-z0-9][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)*$/u.test(e)&&!e.endsWith(`.lock`),{expected:`a branch 'maia/<name>' of up to 160 bytes: letters, digits, '_', '-' and single inner dots, not ending in '.lock'`})),mI=N({baseRevision:uI,branch:k(pI),commandId:J,expectedProjectRevision:lI,kind:A(`git-worktree`),projectId:J,repositoryId:J}),hI=N({commandId:J,expectedProjectRevision:lI,kind:A(`git-worktree`),projectId:J,repositoryId:J,rootPath:fI}),gI={checkoutId:J,commandId:J,id:J,kind:I([`create`,`import`,`remove`]),repositoryId:J,revision:lI,schemaVersion:A(aI),workspaceId:J,workspaceRevision:lI},_I=N({...gI,cleanup:A(`pending`),state:I([`prepared`,`dispatching`])}),vI=N({...gI,cleanup:A(`clean`),instanceId:k(J),state:A(`succeeded`)}),yI=I([`branch_conflict`,`checkpoint_too_large`,`git_failed`,`identity_changed`,`path_conflict`,`repository_changed`,`worktree_active`,`worktree_dirty`,`worktree_missing`,`worktree_moved`]),bI=F([_I,vI,N({...gI,cleanup:A(`clean`),failure:yI,state:A(`failed`)}),N({...gI,cleanup:A(`unknown`),state:I([`cleanup_unknown`,`outcome_unknown`])})]),xI={checkout:YP,delivery:I([`duplicate`,`new`]),operation:bI,receipt:Y,workspace:HP},SI=(e,t)=>e===`actor_local_user`||t===`execution.worktree.create`&&e.startsWith(`actor_session_`),CI=e=>e.workspace.kind===`git-worktree`&&e.workspace.id===e.operation.workspaceId&&e.checkout.id===e.operation.checkoutId&&e.checkout.mode===`git-worktree`&&e.checkout.repositoryId===e.operation.repositoryId&&e.checkout.workspaceId===e.workspace.id&&e.operation.kind===(e.method===`execution.worktree.create`?`create`:`import`)&&SI(e.receipt.actorId,e.method)&&e.receipt.aggregateRevision===e.operation.workspaceRevision&&e.receipt.commandId===e.operation.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.workspaceId&&e.receipt.target.type===`workspace`,wI=N({...xI,method:A(`execution.worktree.create`)}).check(L(CI,{expected:`an exact receipt-backed worktree creation projection`})),TI=N({...xI,method:A(`execution.worktree.import`)}).check(L(CI,{expected:`an exact receipt-backed worktree import projection`})),EI=N({id:J,profileId:A(rI),providerId:A(tI),revision:lI,schemaVersion:A(eI),state:A(`folder-bound`),trust:A(`trusted_worktree`),workspaceId:J}),DI=N({workspaceId:J}),OI=N({checkout:YP,instance:k(EI),latestOperation:bI,method:A(`execution.worktree.status`),trust:A(`trusted_worktree`),variant:A(oI),workspace:HP}).check(L(e=>e.workspace.kind===`git-worktree`&&e.checkout.id===e.latestOperation.checkoutId&&e.checkout.mode===`git-worktree`&&e.checkout.repositoryId===e.latestOperation.repositoryId&&e.checkout.workspaceId===e.workspace.id&&e.latestOperation.workspaceId===e.workspace.id&&(e.instance===void 0||e.instance.workspaceId===e.workspace.id),{expected:`one correlated trusted-worktree status projection`})),kI=N({commandId:J,expectedOperationRevision:lI,operationId:J}),AI=N({delivery:I([`duplicate`,`new`]),method:A(`execution.worktree.reconcile`),operation:bI,receipt:Y}).check(L(e=>(e.receipt.actorId===`actor_local_user`||e.receipt.actorId.startsWith(`actor_session_`))&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.workspaceId&&e.receipt.target.type===`workspace`,{expected:`a receipt-backed worktree reconciliation projection`})),jI=N({workspaceId:J}),MI=I([`cleanup_not_owned`,`execution_operation_active`,`instance_changed`,`placement_active`,`session_active`,`worktree_dirty`,`worktree_missing`,`worktree_moved`]),NI=N({blockers:P(MI).check(H(16)),checkoutId:J,checkoutRevision:lI,digest:dI,eligible:M,id:J,instanceId:J,instanceRevision:lI,workspaceId:J,workspaceRevision:lI}).check(L(e=>e.eligible===(e.blockers.length===0),{expected:`a removal plan whose eligibility matches its blockers`})),PI=N({method:A(`execution.worktree.remove.plan`),plan:NI}),FI=N({commandId:J,expectedWorkspaceRevision:lI,planDigest:dI,planId:J,workspaceId:J}),II=N({delivery:I([`duplicate`,`new`]),method:A(`execution.worktree.remove.apply`),operation:bI,receipt:Y}).check(L(e=>e.operation.kind===`remove`&&e.receipt.actorId===`actor_local_user`&&e.receipt.aggregateRevision===e.operation.workspaceRevision&&e.receipt.commandId===e.operation.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.workspaceId&&e.receipt.target.type===`workspace`,{expected:`an exact receipt-backed worktree removal projection`})),LI={commandId:J,id:J,instanceId:J,instanceRevision:lI,repositoryId:J,revision:lI,schemaVersion:A(aI),workspaceId:J},RI=F([N({...LI,state:I([`prepared`,`running`])}),N({...LI,checkpointId:J,state:A(`succeeded`)}),N({...LI,failure:I([`checkpoint_too_large`,`identity_changed`,`worktree_dirty`]),state:A(`failed`)}),N({...LI,state:A(`outcome_unknown`)})]),zI=N({byteLength:V.check(z(0),Ry(sI)),contentDigest:dI,createdAt:K,id:J,instanceId:J,kind:A(`clean-git`),repositoryId:J,revision:A(`1`),schemaVersion:A(aI),sourceRevision:uI,workspaceId:J}),BI=N({commandId:J,expectedInstanceRevision:lI,instanceId:J}),VI=N({checkpoint:k(zI),delivery:I([`duplicate`,`new`]),method:A(`execution.checkpoint.create`),operation:RI,receipt:Y}).check(L(e=>e.receipt.actorId===`actor_local_user`&&e.receipt.aggregateRevision===e.operation.instanceRevision&&e.receipt.commandId===e.operation.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.instanceId&&e.receipt.target.type===`execution_instance`&&(e.operation.state===`succeeded`?e.checkpoint?.id===e.operation.checkpointId&&e.checkpoint.instanceId===e.operation.instanceId&&e.checkpoint.repositoryId===e.operation.repositoryId&&e.checkpoint.workspaceId===e.operation.workspaceId:e.checkpoint===void 0),{expected:`an exact receipt-backed clean-Git checkpoint projection`})),HI=N({checkpointId:J}),UI=N({checkpoint:zI,method:A(`execution.checkpoint.show`)}),WI=F([N({method:A(`execution.worktree.create`),parameters:mI}),N({method:A(`execution.worktree.import`),parameters:hI}),N({method:A(`execution.worktree.status`),parameters:DI}),N({method:A(`execution.worktree.reconcile`),parameters:kI}),N({method:A(`execution.worktree.remove.plan`),parameters:jI}),N({method:A(`execution.worktree.remove.apply`),parameters:FI}),N({method:A(`execution.checkpoint.create`),parameters:BI}),N({method:A(`execution.checkpoint.show`),parameters:HI})]),GI=F([wI,TI,OI,AI,PI,II,VI,UI]),KI=new TextEncoder,qI=j.check(By(1),L(e=>KI.encode(e).byteLength<=255&&/^[A-Za-z0-9_][A-Za-z0-9._/@+-]*$/u.test(e)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.includes(`/.`)&&!e.endsWith(`/`)&&!e.endsWith(`.`)&&!e.endsWith(`.lock`),{expected:`a Git branch, tag or commit name of up to 255 bytes without ranges, revision suffixes or a leading dash`})),JI=j.check(L(e=>e.length>0&&KI.encode(e).byteLength<=4096&&!tS(e)&&!e.split(`/`).includes(`..`),{expected:`a path of up to 4096 bytes without control characters or '..' segments`})),YI=j.check(R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),XI=j.check(U(6,160),R(/^maia\/[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),ZI=N({baseRef:qI,branch:k(pI)}),QI=N({digest:j.check(R(/^[a-f0-9]{64}$/u)),name:j.check(R(/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])$/u))}),$I=N({baseRef:qI,baseRevision:YI,branch:XI,setup:I([`none`,`pending`,`succeeded`,`failed`]),skills:k(P(QI).check(H(8))),state:I([`active`,`archived`,`removed`])}),eL=N({baseRef:qI,baseRevision:YI,branch:XI}),tL=j.check(L(e=>e.length>0&&!e.includes(`\0`)&&KI.encode(e).byteLength<=4096,{expected:`a worktree-relative path of up to 4096 bytes`})),nL=V.check(z(0)),rL=N({deletions:k(nL),insertions:k(nL),path:tL,previousPath:k(tL),status:I([`added`,`copied`,`deleted`,`modified`,`renamed`,`type_changed`])}).check(L(e=>e.insertions===void 0==(e.deletions===void 0)&&e.previousPath!==void 0==(e.status===`copied`||e.status===`renamed`),{expected:`both line counts or neither, and a previous path only for a rename or copy`})),iL=N({sessionId:J,stat:k(M)}),aL=N({baseRevision:YI,branch:XI,deletions:nL,files:P(rL).check(H(256)),insertions:nL,method:A(`session.diff`),patch:k(j.check(L(e=>KI.encode(e).byteLength<=YM,{expected:`a patch of up to 48 KiB`}))),patchTruncated:k(A(!0)),sessionId:J,totalFiles:nL}).check(L(e=>e.totalFiles>=e.files.length&&(e.patchTruncated===void 0||e.patch!==void 0),{expected:`a total covering the listed files and a truncation mark only with a patch`})),oL=N({sessionId:J}),sL=V.check(z(0)),cL=j.check(L(e=>e.length>0&&KI.encode(e).byteLength<=1024&&!tS(e),{expected:`a Git name of up to 1024 bytes without control characters`})),lL=N({ahead:k(sL),baseRef:qI,baseRevision:k(YI),behind:k(sL),branch:k(cL),changedFiles:sL,dirty:M,headRevision:YI,method:A(`session.git.status`),observedAt:K,sessionId:J,upstream:k(N({ahead:k(sL),behind:k(sL),name:cL}))}).check(L(e=>e.baseRevision===void 0==(e.ahead===void 0)&&e.ahead===void 0==(e.behind===void 0)&&e.dirty===e.changedFiles>0&&e.upstream?.ahead===void 0==(e.upstream?.behind===void 0),{expected:`ahead and behind with the base revision, both upstream counts or neither, and dirty exactly when files changed`})),uL=j.check(L(e=>e.length>0&&KI.encode(e).byteLength<=2048,{expected:`a summary of 1 to 2048 bytes`})),dL=j.check(L(e=>e.length>0&&!tS(e)&&KI.encode(e).byteLength<=4096,{expected:`a transcript path without control characters, up to 4096 bytes`})),fL=N({commandId:J,expectedRevision:q,sessionId:J,summary:k(uL),transcriptPath:k(dL)}),pL=N({branch:XI,branchRevision:YI,pruneAfter:K,snapshot:I([`clean`,`committed`])}),mL=N({branch:XI,cleanupOperationId:J}),hL=P(I(cO)).check(U(1,32),L(e=>e.every(e=>lO.includes(e)))),gL=hL.check(L(e=>e.every((t,n)=>n===0||(e[n-1]??``)<t))),_L={definitionRef:pS,expectedSessionRevision:q,expectedWorkspaceRevision:q,operationIds:hL,sessionId:J,workspaceId:J},vL=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),yL=j.check(R(/^sha256:[a-f0-9]{64}$/u)),bL=N({..._L,commandId:J}),xL=N({..._L,commandId:J,inputDigest:yL,proof:vL}),SL=N({..._L,actorId:J,commandId:J,expiresAt:K,inputDigest:yL,issuedAt:K,method:A(`session.agent-permission.preview`),operationIds:gL,proof:vL}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),CL=N({..._L,actorId:J,commandId:J,grantedAt:K,inputDigest:yL,operationIds:gL,revision:A(`1`)}),wL=N({delivery:I([`new`,`duplicate`]),grant:CL,method:A(`session.agent-permission.confirm`),receipt:Y}).check(L(e=>e.receipt.state===`succeeded`&&e.receipt.actorId===e.grant.actorId&&e.receipt.commandId===e.grant.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`session-agent-permission`&&e.receipt.target.id===e.grant.sessionId&&e.receipt.aggregateRevision===e.grant.revision)),TL=F([N({method:A(`session.agent-permission.preview`),parameters:bL}),N({method:A(`session.agent-permission.confirm`),parameters:xL})]),EL=F([SL,wL]),DL=100,OL=32,kL=new TextEncoder,AL=(e,t)=>j.check(L(t=>!t.includes(`\0`)&&kL.encode(t).byteLength>=1&&kL.encode(t).byteLength<=e,{expected:t})),jL=AL(128,`a non-NUL subject encoded as 1 to 128 UTF-8 bytes`),ML=AL(KM,`a non-NUL body encoded as 1 to 4096 UTF-8 bytes`),NL=q,PL=j.check(U(1,80),L(e=>e.trim()===e&&!tS(e),{expected:`a one-line title of 1 to 80 characters without surrounding spaces`})),FL=Oy(j.check(R(RegExp(`^[a-z][a-z0-9_-]{0,31}$`,`u`))),j.check(R(RegExp(`^[\\x21-\\x2b\\x2d-\\x7e]{1,64}$`,`u`)))).check(L(e=>Object.keys(e).length<=8,{expected:`at most 8 labels`})),IL=V.check(z(1),Ry(DL)),LL=I([`idle`,`starting`,`running`,`waiting-approval`,`interrupted`,`recovering`,`stopping`,`stopped`,`failed`]),RL={createdAt:K,id:J,projectId:J,revision:NL,state:LL,updatedAt:K,workspaceId:J,workspaceRevision:NL},zL=I(nN[X.codex]),BL=(e,t)=>oN(e).includes(t),VL=I([...ZM[X.claudeCode],...ZM[X.codex]]),HL=(e,t)=>sN(e).includes(t),UL=e=>e.prompt===void 0?!0:e.status===`question`?e.prompt.kind===`question`:e.status===`approval`&&e.prompt.kind!==`question`&&e.prompt.options===void 0,WL=e=>e.heldTasks===void 0||e.heldTaskCount===void 0?e.heldTasks===e.heldTaskCount:e.heldTasks.length===Math.min(e.heldTaskCount,10),GL=N({connectionId:J,effort:k(zL),kind:lN,model:k(wS)}).check(L(e=>e.effort===void 0||BL(e.kind,e.effort),{expected:`an effort level the executor kind supports`})),KL=N({...RL,activity:k(dk),agentDefinitionRef:k(pS),containment:k(A(`none`)),executor:k(GL),failure:k(uS),heldTaskCount:k(V.check(z(0))),heldTasks:k(P(nD).check(H(10))),labels:k(FL),latestTurnId:k(J),latestTurnState:k(MM),parentSessionId:k(J),permission:k(VL),prompt:k(Fw),recovery:k(uS),schemaVersion:A(4),settledReason:k(I([`failed`,`idle`,`stopped`])),status:k(fk),title:k(PL),worktree:k($I)}).check(L(e=>(e.executor===void 0||e.agentDefinitionRef===void 0)&&(e.worktree===void 0||e.executor!==void 0)&&(e.failure===void 0||e.state===`failed`)&&(e.recovery===void 0||e.state===`recovering`)&&UL(e)&&WL(e),{expected:`an executor Session without an Agent definition, a worktree only for an executor Session, a recovery reason only while recovering, a prompt only with its status, and held tasks with their count`})),qL=Oy(j,by),JL=N({adoptedFrom:k(N({nativeId:J,workingDirectory:I([`original`,`relocated`])})),agentDefinitionRef:k(pS),authorizedBy:k(J),containment:k(A(`none`)),cwd:k(JI),executor:k(GL),permission:k(VL),projectId:J,workspaceId:J,workspaceRevision:NL,worktree:k(eL)}),YL=N({executableVersion:j.check(U(1,64))}),XL=(e,t)=>N({commandId:J,eventType:A(e),globalCursor:NL,payload:t,recordedAt:K,schemaVersion:A(4),sessionCursor:NL,sessionId:J}),ZL=XL(`session.created`,JL),QL=XL(`session.start.requested`,qL),$L=XL(`session.runtime.started`,YL),eR=XL(`session.runtime.recovery.requested`,qL),tR=XL(`session.runtime.recovery.updated`,N({recovery:k(uS)})),nR=XL(`session.runtime.resumed`,YL),rR=XL(`session.stopped`,N({holdId:k(pk)})),iR=XL(`session.resume.requested`,qL),aR=F([ZL,QL,$L,eR,tR,nR,XL(`session.runtime.failed`,N({failure:k(uS),reason:I([`activation_failed`,`activation_outcome_unknown`,`runtime_exited`])})),rR,iR,XL(`session.archived`,pL),XL(`session.renamed`,N({title:PL})),XL(`session.worktree.removed`,mL),tae]),oR={commandId:J,expectedRevision:A(`0`),workspaceId:J},sR=e=>e.hostAuthority===void 0?e.permission===void 0:(e.connectionId!==void 0||e.executor!==void 0)&&e.agentId===void 0&&e.definitionRef===void 0&&e.worktree===void 0&&(e.role===void 0||e.role===`orchestrator`&&e.labels?.owner!==void 0)&&(e.permission===void 0||e.executor===void 0||HL(e.executor,e.permission)),cR=N({...oR,agentId:k(fS),connectionId:k(J),cwd:k(JI),definitionRef:k(pS),effort:k(zL),executor:k(lN),hostAuthority:k(A(!0)),labels:k(FL),model:k(wS),permission:k(VL),role:k(Dj),title:k(PL),worktree:k(ZI)}).check(L(e=>(e.agentId===void 0||e.connectionId===void 0&&e.definitionRef===void 0&&e.effort===void 0&&e.executor===void 0&&e.model===void 0)&&(e.definitionRef===void 0||e.connectionId===void 0&&e.executor===void 0)&&(e.model===void 0||e.connectionId!==void 0||e.executor!==void 0&&iN(e.executor))&&(e.effort===void 0||(e.connectionId!==void 0||e.executor!==void 0)&&(e.executor===void 0||BL(e.executor,e.effort)))&&(e.worktree===void 0||e.agentId!==void 0||e.connectionId!==void 0||e.executor!==void 0)&&(e.cwd===void 0||(e.connectionId!==void 0||e.executor!==void 0)&&(e.worktree===void 0||!e.cwd.startsWith(`/`)))&&sR(e),{expected:`an Agent alone, an Agent definition alone, or an executor connection or kind; a model only with a connection or an executor kind that takes one; an effort only for an executor Session, at a level its kind supports; a worktree only for an executor Session or an Agent; a start directory only for an executor Session, relative to the worktree when there is one; host authority only for an executor Session without a worktree or Agent (its one role is orchestrator, with an owner label), and a permission mode only with it, at a value its kind supports`})),lR=N({afterCursor:k(NL),attention:k(M),idleForSeconds:k(V.check(z(0),Ry(JM))),labels:k(FL),limit:k(IL),parentSessionId:k(J),projectId:k(J),settled:k(A(!0)),states:k(P(LL).check(By(1),H(9)))}).check(L(e=>e.idleForSeconds===void 0||e.settled===!0,{expected:`an idle time only with the settled filter`})),uR=N({sessionId:J}),dR=N({activities:k(P(dk).check(By(1),H(4))),sessionId:J,states:k(P(LL).check(By(1),H(9))),waitMilliseconds:V.check(z(0),Ry(cN))}).check(L(e=>e.states!==void 0||e.activities!==void 0,{expected:`states, activities or both to wait for`})),fR=N({afterSessionCursor:NL,limit:V.check(z(1),Ry(OL)),sessionId:J}),pR=N({commandId:J,expectedRevision:NL,sessionId:J}),mR=J.check(H(122)),hR={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},gR={checkpoint:k(YI),commandId:mR,expectedRevision:NL,...hR,sessionId:J,turnId:J},_R=N({commandId:mR,sessionId:J,turnId:k(J)}),vR=N(gR),yR=N({connectionId:k(J),executor:k(lN),model:k(wS)}).check(L(e=>e.connectionId!==void 0||e.executor!==void 0||e.model!==void 0,{expected:`an executor, a connection or a model to switch to`})),bR={commandId:mR,expectedRevision:NL,...hR,sessionId:J,target:yR},xR=N({commandId:bR.commandId,sessionId:J,target:yR}),SR=N(bR),CR=j.check(R(/^[a-f0-9]{64}$/u)),wR={commandId:J,expectedRevision:NL,...hR,sessionId:J,setupDigest:CR},TR=N({command:P(j.check(H(1024))).check(U(1,32)),files:P(N({path:j.check(H(1024)),sha256:CR})).check(H(32))}),ER=N({commandId:J,sessionId:J}),DR=N(wR),OR=e=>V.check(B(e)),kR=N({concurrency:OR($M.concurrency),depth:OR($M.depth),fanOut:OR($M.fanOut)}),AR=N({caps:kR,revision:q,source:I([`default`,`node`]),updatedAt:k(K)}).check(L(e=>e.source==="default"?e.revision===`0`&&e.updatedAt===void 0&&e.caps.concurrency===QM.concurrency&&e.caps.depth===QM.depth&&e.caps.fanOut===QM.fanOut:e.revision!==`0`&&e.updatedAt!==void 0,{expected:`the default caps at revision 0 without updatedAt, or changed caps with both`})),jR=V.check(B({maximum:eN,minimum:0})),MR=N({live:jR,total:jR}).check(L(e=>e.live<=e.total,{expected:`no more live children than children`})),NR=V.check(B({maximum:64,minimum:0})),PR=N({sessionId:k(J)}),FR=N({children:MR,depth:k(NR),role:k(Dj),sessionId:J}),IR=N({caps:AR,method:A(`session.spawn-caps.show`),standing:k(FR)}),LR={caps:kR,commandId:J,expectedRevision:q},RR={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},zR=N(LR),BR=N({...LR,...RR}),VR=N({...LR,...RR,current:AR,method:A(`session.spawn-caps.preview`)}),HR=N({caps:AR,delivery:I([`new`,`duplicate`]),method:A(`session.spawn-caps.confirm`),receipt:Y}).check(L(e=>e.caps.source===`node`&&e.receipt.method===e.method&&e.receipt.target.type===tN.type&&e.receipt.target.id===tN.id&&e.receipt.aggregateRevision===e.caps.revision,{expected:`changed caps under their own receipt`})),UR=F([N({method:A(`session.spawn-caps.show`),parameters:PR}),N({method:A(`session.spawn-caps.preview`),parameters:zR}),N({method:A(`session.spawn-caps.confirm`),parameters:BR})]),WR=F([IR,VR,HR]),GR=N({children:MR,depth:NR,hostAuthority:k(A(!0)),permission:k(VL),role:Dj,sessionId:J}).check(L(e=>e.permission===void 0||e.hostAuthority===!0,{expected:`a permission mode only with host authority`})),KR={commandId:mR,executor:lN,hostAuthority:k(A(!0)),parent:GR,permission:k(VL),workspaceId:J},qR=L(e=>e.permission===void 0||e.hostAuthority===!0&&HL(e.executor,e.permission),{expected:`a permission mode only with host authority, at a value the executor kind supports`}),JR={...KR,expectedRevision:A(`0`),...hR},YR=N(KR).check(qR),XR=N(JR).check(qR),ZR=N({commandId:J,expectedRevision:NL,sessionId:J,title:PL}),QR=pR,$R=N({children:MR,sessionId:J}),ez=N({...pR.fields,parent:k($R)}),tz=N({body:ML,commandId:J,recipientSessionId:J,subject:jL}),nz=N({limit:k(V.check(z(1),Ry(16)))}),rz=N({commandId:J,deliveryId:J,expectedMailboxRevision:NL}),iz=N({contentBytes:NL,createdAt:K,deliveryCount:NL,id:J,revision:NL,schemaVersion:A(1),sessionId:J,updatedAt:K,workspaceId:J}).check(L(e=>BigInt(e.contentBytes)<=1048576n&&BigInt(e.deliveryCount)<=256n,{expected:`a Session mailbox within durable record and byte quotas`})),az=N({body:ML,createdAt:K,digest:j.check(U(64,64),R(/^[a-f0-9]{64}$/u)),id:J,recipientSessionId:J,schemaVersion:A(1),senderSessionId:J,subject:jL,workspaceId:J}).check(L(e=>e.senderSessionId!==e.recipientSessionId,{expected:`a direct Message between distinct Sessions`})),oz={attemptCount:V.check(z(0),Ry(65535)),createdAt:K,firstCheckedAt:k(K),id:J,lastCheckedAt:k(K),mailboxId:J,message:az,sequence:NL},sz=N({...oz,state:A(`pending`)}),cz=N({...oz,acknowledgedAt:K,acknowledgingSessionId:J,state:A(`acknowledged`)}),lz=F([sz,cz]),uz=e=>e.every((t,n)=>e.findIndex(e=>e.id===t.id)===n&&(n===0||BigInt(e[n-1]?.sequence??`0`)<BigInt(t.sequence))),dz=(e,t)=>e.mailboxId===t.id&&e.message.recipientSessionId===t.sessionId&&e.message.workspaceId===t.workspaceId,fz=N({content:A(`untrusted_peer`),deliveries:P(sz).check(H(16)),mailbox:iz,method:A(`session.inbox.check`)}).check(L(e=>uz(e.deliveries)&&e.deliveries.every(t=>dz(t,e.mailbox)),{expected:`pending Session deliveries matching their mailbox`})),pz=N({delivery:I([`new`,`duplicate`]),deliveryId:J,mailboxId:J,message:az,method:A(`session.message.send`),receipt:Y,sequence:NL}).check(L(e=>e.receipt.method===e.method&&e.receipt.target.type===`session-mailbox`&&e.receipt.target.id===e.mailboxId,{expected:`a Session send receipt matching its mailbox`})),mz=N({delivery:I([`new`,`duplicate`]),deliveryRecord:cz,mailboxId:J,mailboxRevision:NL,method:A(`session.inbox.ack`),receipt:Y}).check(L(e=>e.deliveryRecord.mailboxId===e.mailboxId&&e.receipt.aggregateRevision===e.mailboxRevision&&e.receipt.method===e.method&&e.receipt.target.type===`session-mailbox`&&e.receipt.target.id===e.mailboxId,{expected:`an acknowledged Session delivery matching its receipt`})),hz=N({delivery:I([`new`,`duplicate`]),method:A(`session.create`),receipt:Y,session:KL}),gz=N({...gR,method:A(`session.fork.preview`),path:A(`context-handoff`)}),_z={delivery:I([`new`,`duplicate`]),handoff:j,path:A(`context-handoff`),receipt:Y,session:KL,sourceSessionId:J},vz=N({..._z,method:A(`session.fork.confirm`)}),yz=N({...bR,method:A(`session.switch.preview`),path:A(`context-handoff`)}),bz=N({..._z,method:A(`session.switch.confirm`)}),xz=N({...wR,approved:M,method:A(`session.setup.preview`),setup:TR}),Sz=N({delivery:I([`new`,`duplicate`]),method:A(`session.setup.confirm`),receipt:Y,sessionId:J,setupDigest:CR}).check(L(e=>e.receipt.state===`succeeded`&&e.receipt.method===e.method&&e.receipt.target.type===`session`&&e.receipt.target.id===e.sessionId,{expected:`a setup approval matching its receipt`})),Cz=N({...JR,method:A(`session.spawn.preview`)}).check(qR),wz=N({delivery:I([`new`,`duplicate`]),method:A(`session.spawn.confirm`),parentSessionId:J,receipt:Y,session:KL}).check(L(e=>e.receipt.method===`session.create`&&e.receipt.state===`succeeded`&&e.receipt.target.type===`session`&&e.receipt.target.id===e.session.id&&e.session.executor!==void 0&&e.session.parentSessionId===e.parentSessionId,{expected:`a spawned executor Session whose create receipt and parent match`})),Tz=N({attention:k(P(N({attention:I(XM),sessionId:J})).check(H(DL))),items:P(KL).check(H(DL)),method:A(`session.list`),nextCursor:k(NL)}).check(L(e=>{let t=new Set(e.items.map(e=>e.id)),n=(e.attention??[]).map(e=>e.sessionId);return new Set(n).size===n.length&&n.every(e=>t.has(e))},{expected:`attention only for listed Sessions, once each`})),Ez=N({linkedAt:K,node:Jk,observedState:k(LL),orphanedAt:k(K),sessionId:J,state:I([`linked`,`orphaned`])}).check(L(e=>e.state===`orphaned`==(e.orphanedAt!==void 0),{expected:`an orphaned child with the instant it was orphaned, and only then`})),Dz=$M.fanOut.maximum,Oz=N({method:A(`session.show`),remoteChildren:k(P(Ez).check(U(1,Dz))),session:KL}),kz=N({childSessionId:J,commandId:J,node:Jk,outcome:I([`linked`,`orphaned`,`reconciled`]),parentSessionId:J,state:k(LL)}).check(L(e=>e.childSessionId!==e.parentSessionId&&(e.outcome===`reconciled`?e.state!==void 0:e.outcome===`linked`||e.state===void 0),{expected:`a child other than its parent; a state with reconciled, none with orphaned`})),Az=N({child:Ez,delivery:I([`new`,`duplicate`]),method:A(`session.spawn.record`),parentSessionId:J,receipt:Y}).check(L(e=>e.receipt.state===`succeeded`&&e.receipt.method===e.method&&e.receipt.target.type===`session-child`&&e.receipt.target.id===e.child.sessionId,{expected:`a child record under its own receipt`})),jz=N({method:A(`session.spawn.record`),parameters:kz}),Mz=N({method:A(`session.wait`),satisfied:M,session:KL}),Nz=N({headSessionCursor:NL,items:P(aR).check(H(OL)),method:A(`session.events.list`),nextSessionCursor:k(NL),oldestRetainedCursor:k(NL),sessionId:J}),Pz=N({delivery:I([`new`,`duplicate`]),method:A(`session.start`),receipt:Y,session:KL}),Fz=N({delivery:I([`new`,`duplicate`]),method:A(`session.stop`),receipt:Y,session:KL}),Iz=N({delivery:I([`new`,`duplicate`]),method:A(`session.resume`),receipt:Y,session:KL}),Lz=N({delivery:I([`new`,`duplicate`]),method:A(`session.rename`),receipt:Y,session:KL}).check(L(e=>e.receipt.method===e.method&&e.receipt.target.type===`session`&&e.receipt.target.id===e.session.id&&e.session.title!==void 0,{expected:`a titled Session matching its rename receipt`})),Rz=N({archive:k(pL),delivery:I([`new`,`duplicate`]),method:A(`session.archive`),receipt:Y,session:KL,summary:k(uL),transcriptPath:k(dL)}).check(L(({archive:e,receipt:t,session:n})=>t.method===`session.archive`&&t.target.type===`session`&&t.target.id===n.id&&(n.worktree===void 0?e===void 0&&n.state===`stopped`:n.worktree.state!==`active`&&n.worktree.branch===e?.branch),{expected:`an archived coding Session matching its receipt and branch, or a stopped Session without a worktree`})),zz=F([N({method:A(`session.create`),parameters:cR}),N({method:A(`session.list`),parameters:lR}),N({method:A(`session.show`),parameters:uR}),N({method:A(`session.wait`),parameters:dR}),N({method:A(`session.events.list`),parameters:fR}),N({method:A(`session.inbox.ack`),parameters:rz}),N({method:A(`session.inbox.check`),parameters:nz}),N({method:A(`session.message.send`),parameters:tz}),N({method:A(`session.observe`),parameters:fN}),N({method:A(`session.start`),parameters:pR}),N({method:A(`session.stop`),parameters:QR}),N({method:A(`session.resume`),parameters:ez}),N({method:A(`session.diff`),parameters:iL}),N({method:A(`session.git.status`),parameters:oL}),N({method:A(`session.archive`),parameters:fL}),N({method:A(`session.rename`),parameters:ZR}),N({method:A(`session.fork.preview`),parameters:_R}),N({method:A(`session.fork.confirm`),parameters:vR}),N({method:A(`session.switch.preview`),parameters:xR}),N({method:A(`session.switch.confirm`),parameters:SR}),N({method:A(`session.setup.preview`),parameters:ER}),N({method:A(`session.setup.confirm`),parameters:DR}),N({method:A(`session.spawn.preview`),parameters:YR}),N({method:A(`session.spawn.confirm`),parameters:XR})]),Bz=F([hz,mz,fz,Tz,pz,mN,Oz,Mz,Nz,Pz,Fz,Iz,aL,lL,Rz,Lz,gz,vz,yz,bz,xz,Sz,Cz,wz]),Vz=`maia.agent/v1`,Hz=`agent`,Uz=16384,Wz=q.check(R(/^[1-9]\d*$/u)),Gz=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),Kz=j.check(R(/^sha256:[a-f0-9]{64}$/u)),qz=I([...yS,X.maiaAgent,X.pi]),Jz=j.check(U(1,Uz),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=16384)),Yz=(e,t)=>new Set(e.map(t)).size===e.length,Xz=N({accountableActorId:J,connectionId:k(J),effort:k(zL),harness:qz,homeSessionId:k(J),instruction:Jz,managerAgentId:k(fS),model:k(wS),name:nS,placement:A(`local`)}).check(L(e=>(e.model===void 0||e.connectionId!==void 0)&&(e.effort===void 0||BL(e.harness,e.effort)),{expected:`a model only with a Connection; an effort only for a vendor executor, at a level it supports`})),Zz=I([`active`,`disabled`]),Qz=N({contentDigest:Kz,createdAt:K,id:fS,projectId:J,revision:Wz,schemaVersion:A(Vz),spec:Xz,state:Zz,updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt)&&(e.revision!==`1`||e.createdAt===e.updatedAt)&&(e.state!==`disabled`||e.revision!==`1`))),$z=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),projectId:J,state:k(Zz)}),eB=N({items:P(Qz).check(H(100)),method:A(`agents.list`),nextCursor:k(J)}).check(L(e=>Yz(e.items,e=>e.id))),tB=N({agentId:fS,revision:k(Wz)}),nB=N({agent:Qz,method:A(`agents.show`)}),rB=Oy(j,by),iB=I([`failed`,`invalid_output`,`output_too_large`,`timeout`,`unsupported`]),aB=F([N({status:A(`ok`)}),N({reason:iB,status:A(`unavailable`)})]),oB=N({harnesses:P(N({folders:P(N({path:j.check(U(1,512)),scope:A(`user`)})).check(H(8)),found:M,id:I(yS),version:k(j.check(U(1,64)))})).check(H(2)),method:A(`agents.detect`),scopes:N({user:aB})}),sB={agentId:fS,expectedRevision:Wz},cB=F([N({kind:A(`create`),projectId:J,spec:Xz}),N({...sB,kind:A(`revise`),spec:Xz}),N({...sB,kind:A(`disable`)})]),lB={change:cB,commandId:J},uB={inputDigest:Kz,proof:Gz},dB=N(lB),fB=N({...lB,...uB}),pB=N({...lB,...uB,actorId:J,agentId:fS,current:k(Qz),expiresAt:K,issuedAt:K,method:A(`agents.change.preview`)}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt)&&(e.change.kind===`create`?e.current===void 0:e.change.agentId===e.agentId&&e.current?.id===e.agentId&&e.current.revision===e.change.expectedRevision),{expected:`a forward-timed preview of the Agent a change names`})),Oae=e=>e.kind===`disable`==(e.agent.state===`disabled`)&&e.kind===`create`==(e.agent.revision===`1`),mB=N({actorId:J,agent:Qz,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:Kz,kind:I([`create`,`disable`,`revise`]),method:A(`agents.change.confirm`),receipt:Y}).check(L(e=>Oae(e)&&e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`agent`&&e.receipt.target.id===e.agent.id&&e.receipt.aggregateRevision===e.agent.revision&&e.receipt.createdAt===e.agent.updatedAt,{expected:`a confirmed change bound to its Agent and receipt`})),kae=F([N({method:A(`agents.detect`),parameters:rB}),N({method:A(`agents.list`),parameters:$z}),N({method:A(`agents.show`),parameters:tB}),N({method:A(`agents.change.preview`),parameters:dB}),N({method:A(`agents.change.confirm`),parameters:fB})]),Aae=F([oB,eB,nB,pB,mB]);G(Xz),G(Qz);var hB=G(cB);G(rB);var jae=G(oB);G($z);var Mae=G(eB);G(tB);var Nae=G(nB);G(dB);var Pae=G(pB);G(fB);var Fae=G(mB),Iae=Hz,gB=100;G(Pw),G(Fw),G(Iw),G(Lw),G(Bw);var Lae=G(Hw),Rae=G(Uw),zae=G(Ww),Bae=50,_B=G;_B(oie),_B(zE),_B(KE),_B(qE),_B(BE),_B(UE),_B(sie),_B(tD),_B(nD),_B(aD),_B(oD),_B(uD),_B(dD),_B(pD),_B(mD),_B(hD),_B(gD),_B(_D),_B(vD),_B(yD),_B(SD);var Vae=_B(OD),Hae=_B(kD),Uae=_B(AD),Wae=_B(jD),Gae=_B(MD),Kae=_B(ND),qae=_B(PD),Jae=_B(FD),Yae=_B(ID),Xae=_B(LD);_B(SO),_B(TO);var Zae=_B(DO);_B(VD);var Qae=_B(KD);_B(HD);var $ae=_B(qD);_B(UD);var eoe=_B(JD);_B(kO),_B(AO),_B(jO),_B(MO),_B(NO);var toe=_B(IO),noe=_B(LO),roe=_B(RO),ioe=_B(zO);G(Y),G(mS);var aoe=G(hS);G(gS),G(_S);var ooe=G(vS);G(DS),G(FS),G(PS),G(IS),G(LS),G(RS),G(zS),G(BS),G(VS),G(HS);var soe=G(zC),coe=G(RC),loe=G(LC),uoe=G(NC),doe=G(BC),foe=G(VC),poe=G(IC);G(TS),G(wS),G(US);var moe=G(PC);G(WS);var hoe=G(FC);G(QC),G(tw);var goe=G(nw);G(aw);var _oe=G(sw);G(ow);var voe=G(lw);G(dw);var yoe=G(fw);G(pw);var boe=G(hw);G(mw);var xoe=G(gw);G(TC),G(DC),G(EC),G(OC),G(qS),G($S),G(eC),G(nC);var Soe=G(aC);G(pC);var Coe=G(_C);G(mC);var woe=G(bC);G(rC);var Toe=G(oC);G(hC);var Eoe=G(vC);G(gC);var Doe=G(xC);G(CN),G(wN),G(TN);var Ooe=G(DN);G(EN);var koe=G(ON);G(AN);var Aoe=G(jN);G(LN);var joe=G(VN);G(zN);var Moe=G(GN);G(RN);var Noe=G(HN);G(BN);var Poe=G(KN);G(bL),G(xL);var Foe=G(SL),Ioe=G(wL);G(CL),G(KL),G(aR),G(cR),G(lN),G(iz),G(az),G(lz),G(tz),G(nz),G(rz),G(lR),G(uR),G(dR);var Loe=G(Mz);G(fR);var Roe=G(hz),zoe=G(pz),Boe=G(fz),Voe=G(mz),Hoe=G(Tz),Uoe=G(Oz),Woe=G(Nz);G(pR);var Goe=G(Pz);G(qI),G(pI),G($I),G(iL);var Koe=G(aL);G(oL),G(lL),G(fL);var qoe=G(Rz);G(_R),G(gz),G(vR),G(vz),G(ER),G(xz),G(DR),G(Sz),G(YR),G(Cz),G(XR),G(wz),G(xR),G(yz),G(SR),G(bz),G(ZR),G(Lz),G(AR),G(PR),G(IR),G(zR),G(VR),G(BR),G(HR),G(fN),G(pN);var Joe=G(mN),Yoe=N({executor:lN}),vB=wy.check(B({maximum:100,minimum:0})),Xoe=N({diskFreePercent:vB,loadPerCpu:wy.check(z(0)),memoryAvailablePercent:vB,observedAt:K}),yB=wy.check(z(0)),Zoe=N({...sS,measured:k(yB),required:k(yB)}).check(...cS,L(e=>e.measured===void 0==(e.required===void 0),{expected:`a measured reading and its required limit together`}),L(e=>e.measured===void 0||e.code===`saturated`,{expected:`figures only on a saturated refusal`})),Qoe=N({capacity:N({activeSessions:V.check(z(0)),host:k(Xoe),maximumActiveSessions:V.check(B({maximum:64,minimum:1}))}),executor:N({accounts:V.check(z(0)),id:lN,registered:M}),login:I([`signed-in`,`signed-out`,`unknown`]),method:A(`session.placement.show`),ready:M,reason:k(j.check(U(1,2048))),refusal:k(Zoe)}).check(L(e=>e.ready===(e.reason===void 0)&&e.ready===(e.refusal===void 0),{expected:`a reason and a refusal when, and only when, the Node is not ready`})),$oe=N({method:A(`session.placement.show`),parameters:Yoe});G(QR);var ese=G(Fz);G(ez);var tse=G(Iz);G(Ez),G(kz),G(Az);var bB=[`claude`,`codex`],nse=4e3,rse=4096,xB=512,SB=e=>new Set(e).size===e.length,CB=e=>j.check(H(e)),wB=j.check(U(2,rse),R(/^\//u),L(e=>!e.includes(`\0`),{expected:`a path without NUL`})),TB=V.check(z(0)),EB=j.check(R(/^sha256:[a-f0-9]{64}$/u)),DB=I(bB),OB=I(yS),kB=J,AB=P(DB).check(By(1),H(bB.length),L(SB,{expected:`unique sources`})),jB=I([`live`,`ended`,`unknown`]),MB=I([`pid-record`,`no-pid-record`,`recent-activity`,`vendor-active`,`no-process-evidence`]),NB=N({adopted:k(I([`only`,`none`])),cursor:k(j.check(R(/^[A-Za-z0-9_-]{1,1024}$/u))),includeContentFields:k(M),limit:V.check(B({maximum:100,minimum:1})),observed:k(A(`running`)),roots:k(P(wB).check(By(1),H(16))),sinceDays:k(V.check(B({maximum:365,minimum:1}))),sources:AB}),PB=N({branch:k(j.check(U(1,256))),gitCommonDirectory:wB,rootPath:wB}),FB=N({adoptedSessionId:k(J),content:k(N({firstPrompt:k(CB(xB)),preview:k(CB(xB)),title:k(CB(xB))})),createdAt:k(K),cwd:wB,executor:OB,lastActivityAt:K,liveness:jB,livenessEvidence:MB,model:k(j.check(U(1,256))),nativeId:kB,observed:k(I([`not-running`,`running`,`unknown`])),orphaned:M,repository:k(PB),sources:AB}),IB=N({cwd:k(wB),kind:I([`repository`,`directory`,`orphaned`]),lastActivityAt:K,registeredProjectId:k(J),repository:k(PB),sessionCount:TB}),ise=N({code:I([`source_unavailable`,`executable_unauthorized`]),message:CB(256),source:DB}),LB=N({groups:P(IB).check(H(200)),groupsTruncated:M,includesContentFields:M,items:P(FB).check(H(100)),method:A(`discovery.sessions.list`),nextCursor:k(j.check(R(/^[A-Za-z0-9_-]{1,1024}$/u))),since:K,sourceErrors:P(ise).check(H(bB.length)),sources:AB,summary:N({bySource:N({claude:TB,codex:TB}),excluded:N({maiaOwned:TB,outsideRoots:TB,subagent:TB}),orphaned:TB,total:TB}),truncatedSources:k(P(DB).check(H(bB.length),L(SB,{expected:`unique sources`})))}).check(L(e=>e.items.every(t=>t.content===void 0||e.includesContentFields),{expected:`content fields only when requested`})),ase=N({executor:OB,kind:A(`native`),nativeId:kB}),RB=N({limit:V.check(B({maximum:50,minimum:1})),offset:k(V.check(B({maximum:1e6,minimum:0}))),target:F([N({kind:A(`session`),sessionId:J}),ase])}),zB=N({index:TB,role:I([`user`,`assistant`,`tool`]),text:CB(nse),toolName:k(j.check(U(1,128))),truncated:M}),BB=N({executor:OB,messages:P(zB).check(H(50)),method:A(`session.history.read`),nativeId:kB,nextOffset:k(TB),offset:TB}),VB=j.check(R(/^adopt_[A-Za-z0-9_-]{43}$/u)),ose={actorId:J,commandId:J,expiresAt:K,inputDigest:EB,issuedAt:K},sse=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),HB={hostAuthority:k(A(!0)),permission:k(VL)},UB={labels:k(FL),role:k(Dj),title:k(PL)},cse=e=>e.role!==`orchestrator`||e.labels?.owner!==void 0,lse=e=>e.permission===void 0||e.hostAuthority===!0&&HL(e.executor,e.permission),WB=I([`maia`,`external`]),GB=N({attach:k(A(!0)),attestEnded:k(A(!0)),commandId:J,cwd:k(wB),executor:OB,...HB,...UB,nativeId:kB,workspaceId:k(J)}).check(L(lse,{expected:`a permission mode only with host authority, at a value its executor kind supports`}),L(cse,{expected:`an orchestrator with an owner label`})),KB={connectionId:J,executor:OB,nativeId:kB,workingDirectory:wB,workingDirectoryOrigin:I([`original`,`relocated`]),writer:k(WB)},qB=N({...ose,...KB,attestEnded:M,...HB,...UB,lastActivityAt:K,liveness:jB,livenessEvidence:MB,method:A(`session.adopt.preview`),previewId:VB,projectId:J,workspaceId:J}).check(L(sse)),JB=N({alreadyAdopted:N({sessionId:J}),executor:OB,method:A(`session.adopt.preview`),nativeId:kB}),YB=N({inputDigest:k(EB),previewId:VB}),use=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method,XB=N({actorId:J,adoption:N(KB),commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:EB,method:A(`session.adopt.confirm`),receipt:Y,session:KL}).check(L(e=>use(e)&&e.receipt.target.type===`session`&&e.receipt.target.id===e.session.id&&e.session.state===`stopped`&&e.session.executor?.connectionId===e.adoption.connectionId&&e.session.executor.kind===e.adoption.executor)),ZB=N({executor:OB,nativeId:kB,writer:WB}),QB={commandId:J,sessionId:J},$B={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},eV=N(QB),tV=N({...QB,...$B}),nV=N({...QB,...$B,attachment:ZB,method:A(`session.detach.preview`)}),rV=N({attachment:ZB,commandId:J,delivery:I([`new`,`duplicate`]),method:A(`session.detach.confirm`),receipt:Y,sessionId:J}).check(L(e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`session`&&e.receipt.target.id===e.sessionId)),dse=N({holder:WB,nativeId:kB,reason:I([`attach`,`detach`]),runtime:OB,sessionId:J}),fse=F([N({method:A(`discovery.sessions.list`),parameters:NB}),N({method:A(`session.history.read`),parameters:RB}),N({method:A(`session.adopt.preview`),parameters:GB}),N({method:A(`session.adopt.confirm`),parameters:YB}),N({method:A(`session.detach.preview`),parameters:eV}),N({method:A(`session.detach.confirm`),parameters:tV})]),pse=F([LB,BB,qB,JB,XB,nV,rV]);G(NB);var mse=G(LB);G(FB),G(IB),G(RB);var hse=G(BB);G(zB),G(GB);var gse=G(qB),_se=G(JB);G(YB);var vse=G(XB);G(WB),G(eV),G(nV),G(tV),G(rV);var iV=G(dse),aV=131072,oV=1024,yse=1e4,bse=[`active`,`paused`,`blocked`,`done`,`failed`,`cancelled`,`budget`],xse=[`active`,`paused`,`blocked`,`done`,`failed`,`cancelled`],sV=[`turns`],cV=`session-goal`,lV=new TextEncoder,uV=q.check(R(/^[1-9]\d*$/u)),dV=j.check(R(/^sha256:[a-f0-9]{64}$/u)),fV=j.check(U(1,aV),L(e=>e.trim().length>0,{expected:`goal text that is not only whitespace`}),L(e=>lV.encode(e).byteLength<=aV,{expected:`goal text of at most ${String(aV)} UTF-8 bytes`})),pV=e=>j.check(U(1,oV),L(e=>e.trim().length>0&&!tS(e),{expected:`${e} on one line, not only whitespace`}),L(e=>lV.encode(e).byteLength<=oV,{expected:`${e} of at most ${String(oV)} UTF-8 bytes`})),mV=V.check(B({maximum:32,minimum:1})),hV=I(bse),Sse=N({done:My(N({at:K,by:J,evidence:pV(`evidence`)})),line:mV,text:pV(`a definition-of-done line`)}),gV=V.check(B({maximum:yse,minimum:1})),Cse=N({limit:gV,unit:I(sV)}),_V=N({budget:My(N({limit:gV,unit:I(sV),used:V.check(z(0))})),digest:dV,dod:P(Sse).check(H(32),L(e=>e.every(({line:e},t)=>e===t+1),{expected:`definition-of-done lines numbered from 1 in order`})),pausedBy:k(J),revision:uV,sessionId:J,setAt:K,state:hV,text:fV}).check(L(e=>e.pausedBy===void 0||e.state===`paused`,{expected:`a pause marker on a paused goal alone`})),vV=N({budget:k(Cse),commandId:J,dod:k(P(pV(`a definition-of-done line`)).check(U(1,32))),sessionId:J,text:fV}),yV=N({sessionId:J}),bV=N({commandId:J,expectedRevision:uV,sessionId:J,text:fV}),xV=N({commandId:J,expectedRevision:uV,sessionId:J}),SV=N({commandId:J,evidence:pV(`evidence`),expectedRevision:uV,line:mV,sessionId:J}),CV=N({commandId:J,expectedRevision:uV,sessionId:J,state:I(xse)}),wV={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y},wse=N({...wV,goal:_V,method:A(`goal.set`)}),Tse=N({...wV,expectedRevision:uV,goal:_V,method:A(`goal.update`)}),Ese=N({...wV,expectedRevision:uV,goal:_V,method:A(`goal.mark`)}),Dse=N({...wV,expectedRevision:uV,goal:_V,method:A(`goal.transition`)}),Ose=N({...wV,expectedRevision:uV,method:A(`goal.clear`),revision:uV,sessionId:J}),TV=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===e.target.type&&e.receipt.target.id===e.target.id&&e.receipt.aggregateRevision===e.target.revision,EV=e=>BigInt(e.target.revision)===BigInt(e.expectedRevision)+1n,DV=e=>({id:e.goal.sessionId,revision:e.goal.revision,type:cV}),kse=e=>({id:e.sessionId,revision:e.revision,type:cV}),OV=wse.check(L(e=>TV({...e,target:DV(e)}))),kV=L(e=>{let t=DV(e);return TV({...e,target:t})&&EV({...e,target:t})}),AV=P(N({sessionId:J,turnId:J})).check(H(64)),jV={commandId:J.check(H(118)),expectedRevision:uV,sessionId:J},MV={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},NV=N(jV),PV=N({...jV,...MV}),FV=N({...jV,...MV,goal:_V,method:A(`session.pause.preview`),turns:AV}),IV=N({...wV,expectedRevision:uV,goal:_V,interrupted:AV,method:A(`session.pause.confirm`)}).check(kV),LV=Tse.check(kV),RV=Ese.check(kV),zV=Dse.check(kV),BV=Ose.check(L(e=>{let t=kse(e);return TV({...e,target:t})&&EV({...e,target:t})})),VV=N({goal:My(_V),method:A(`goal.show`),revision:My(uV),sessionId:J}).check(L(e=>e.goal===null||e.goal.sessionId===e.sessionId&&e.goal.revision===e.revision,{expected:`the goal of the requested Session at the record's revision`})),Ase=N({change:I([`set`,`updated`,`cleared`,`marked`,`transitioned`]),digest:My(dV),line:k(mV),previousRevision:My(uV),revision:uV,sessionId:J,state:k(hV)}).check(L(e=>e.change===`marked`==(e.line!==void 0)&&e.change===`transitioned`==(e.state!==void 0),{expected:`a line with a mark alone and a state with a transition alone`}),L(e=>e.change===`cleared`==(e.digest===null),{expected:`a digest with every change but a clear`}),L(e=>e.previousRevision===null?e.change===`set`&&e.revision===`1`:BigInt(e.revision)===BigInt(e.previousRevision)+1n,{expected:`a first set at revision 1, or a revision one past the previous one`})),jse=F([N({method:A(`goal.set`),parameters:vV}),N({method:A(`goal.show`),parameters:yV}),N({method:A(`goal.update`),parameters:bV}),N({method:A(`goal.clear`),parameters:xV}),N({method:A(`goal.mark`),parameters:SV}),N({method:A(`goal.transition`),parameters:CV}),N({method:A(`session.pause.preview`),parameters:NV}),N({method:A(`session.pause.confirm`),parameters:PV})]),Mse=F([OV,VV,LV,BV,RV,zV,FV,IV]),HV=[`drift`,`stall`,`waiting`],UV=[`D1`,`S1`,`S2`,`W1`],Nse=N({kind:I(HV),rule:I(UV),sessionId:J}),Pse=cV;G(_V);var Fse=G(Ase),WV=G(Nse);G(vV);var Ise=G(OV);G(yV);var Lse=G(VV);G(bV);var Rse=G(LV);G(xV);var zse=G(BV);G(SV);var Bse=G(RV);G(CV);var Vse=G(zV);G(NV),G(FV),G(PV),G(IV),G(nF);var Hse=G(oF);G(rF);var Use=G(uF);G(iF);var Wse=G(sF);G(aF);var Gse=G(dF);G(BP),G(VP),G(HP),G(YP),G(WP),G(GP),G(qP),G(JP),G(wF),G(TF),G(EF),G(OF),G(kF),G(AF),G(jF),G(PF),G(MF),G(NF),G(FF),G(IF),G(LF);var Kse=G(RF),qse=G(zF),Jse=G(BF),Yse=G(VF),Xse=G(HF),Zse=G(UF),Qse=G(XF),$se=G(WF),ece=G(GF),tce=G(JF),nce=G(YF),rce=G(ZF);G(hF),G(vF);var ice=G(yF);G(bF);var ace=G(SF);G(xF);var oce=G(CF),sce=G(Dae);G(dP),G(gP);var cce=G(_P);G(vP);var lce=G(bP);G(yP);var uce=G(xP);G(SP);var dce=G(CP);G(wP);var fce=G(DP);G(OP);var pce=G(AP);G(kP);var mce=G(jP);G(MP);var hce=G(NP),gce=G(xae);G($N),G(QN),G(tP),G(eP);var _ce=2048,GV=j.check(R(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u)),vce=j.check(U(1,_ce),R(/^(?:[^\p{Cc}]|\n)+$/u)),KV=j.check(R(/^sha256:[a-f0-9]{64}$/u)),qV=N({commandId:J,name:GV}),JV=N({name:GV}),YV=N({commandId:J,expectedRevision:q,expiresAt:K,inputDigest:KV,name:GV,secretValue:vce}),XV=I([`duplicate`,`new`]),ZV=N({commandId:J,delivery:XV,itemId:J,method:A(`secret.request`),name:GV,receipt:Y}).check(L(e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`inbox_item`&&e.receipt.target.id===e.itemId,{expected:`a secret request bound to its receipt`})),QV=N({actorId:J,expectedRevision:A(`0`),expiresAt:K,inputDigest:KV,issuedAt:K,method:A(`secret.set.preview`),name:GV}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),{expected:`a preview that has not expired when issued`})),$V=N({commandId:J,delivery:XV,inputDigest:KV,method:A(`secret.set.confirm`),name:GV,receipt:Y}).check(L(e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`secret`&&e.receipt.target.id===e.name&&e.receipt.aggregateRevision===`1`,{expected:`a stored secret bound to its receipt`})),yce=F([N({method:A(`secret.request`),parameters:qV}),N({method:A(`secret.set.confirm`),parameters:YV}),N({method:A(`secret.set.preview`),parameters:JV})]),bce=F([ZV,$V,QV]),xce=N({itemId:J,name:GV,sessionId:J}),Sce=N({actorId:J,name:GV});G(GV);var Cce=G(xce),wce=G(Sce);G(qV);var Tce=G(ZV);G(JV);var Ece=G(QV);G(YV);var Dce=G($V),eH=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),Oce=N({previousShutdown:I([`clean`,`unclean`])}),kce=N({reason:I([`stop`])}),tH=I([`ok`,`warn`,`refuse`]),nH=wy.check(B({maximum:100,minimum:0})),Ace=N({availablePercent:nH,level:tH,previousLevel:tH,thresholdPercent:nH}),jce=N({droppedSinceLast:k(wy.check(zy(),B({maximum:1e9,minimum:1}))),reasonClass:eH,resourceId:k(J),scope:eH,sessionId:k(J)}),Mce=G(Oce),Nce=G(kce),Pce=G(jce),Fce=G(Ace);G(dk);var Ice=G(Sie);G(fk);var Lce=G(Cie),rH=j.check(U(1,64),R(/^[0-9A-Za-z][0-9A-Za-z._+-]*$/u)),Rce=I([`not_ready`,`session_lost`,`step_failed`]),zce=N({from:rH,to:rH,updateId:J}),Bce=N({to:rH,updateId:J}),Vce=N({from:rH,reason:Rce,to:rH,updateId:J}),Hce=G(zce),Uce=G(Bce),Wce=G(Vce),iH=q.check(R(/^[1-9]\d*$/u)),Gce=new TextEncoder,Kce=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]|\r(?!\n)/u,qce=/[\u0000-\u001F\u007F-\u009F\u2028\u2029]/u,aH=e=>j.check(U(1,e),L(e=>!qce.test(e))),oH=e=>j.check(By(1),L(t=>Gce.encode(t).byteLength<=e&&!Kce.test(t))),sH=oH(4096),cH=aH(240),lH=N({kind:A(`external-cli`)}),uH=K.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u)),dH=I([`pending`,`answered`,`cancelled`,`expired`]),fH=j.check(R(/^[a-z][a-z0-9_-]{0,31}$/u)),pH=P(N({label:aH(80),optionId:fH})).check(U(2,8),L(e=>new Set(e.map(e=>e.optionId)).size===e.length)),mH={body:sH,commandId:J,expectedSessionRevision:iH,expiresAt:k(uH),origin:lH,projectId:J,sessionId:J,subject:cH},Jce=F([N({...mH,kind:A(`question`)}),N({...mH,kind:A(`selection`),options:pH})]),Yce=N({afterCursor:k(J),lifecycleStatus:k(dH),limit:V.check(B({maximum:100,minimum:1})),projectId:J,sessionId:J}),Xce=N({interactionId:J}),hH=F([N({kind:A(`text`),value:oH(16384)}),N({kind:A(`selection`),optionIds:P(fH).check(U(1,8),L(e=>new Set(e).size===e.length))})]),gH={commandId:J,expectedRevision:iH,interactionId:J},Zce=N({...gH,answer:hH}),Qce=N(gH),$ce=F([N({method:A(`interaction.cancel`),parameters:Qce}),N({method:A(`interaction.create`),parameters:Jce}),N({method:A(`interaction.list`),parameters:Yce}),N({method:A(`interaction.respond`),parameters:Zce}),N({method:A(`interaction.show`),parameters:Xce})]),_H=j.check(R(/^sha256:[a-f0-9]{64}$/u)),vH={activationId:Sy,answeredAt:My(uH),answerSchemaDigest:_H,body:sH,createdAt:uH,expiresAt:My(uH),interactionId:J,lifecycleStatus:dH,origin:lH,projectId:J,requestingActorId:J,revision:iH,schemaVersion:A(`maia.interaction/v1`),sessionId:J,subject:cH,wakeDisposition:A(`record-only`)},yH={...vH,kind:A(`question`)},bH={...vH,kind:A(`selection`),options:pH},ele=F([N(yH),N(bH)]),xH=e=>{if(e.expiresAt!==null&&Date.parse(e.expiresAt)<=Date.parse(e.createdAt))return!1;switch(e.lifecycleStatus){case`pending`:return e.revision===`1`&&e.answeredAt===null;case`expired`:return e.revision===`1`&&e.answeredAt===null&&e.expiresAt!==null;case`cancelled`:return e.revision===`2`&&e.answeredAt===null;case`answered`:return e.revision===`2`&&e.answeredAt!==null&&Date.parse(e.answeredAt)>=Date.parse(e.createdAt)&&(e.expiresAt===null||Date.parse(e.answeredAt)<Date.parse(e.expiresAt))}},SH=ele.check(L(xH)),CH={answer:k(hH),respondingActorId:k(J),responseDigest:k(_H)},tle=F([N({...yH,...CH}),N({...bH,...CH})]),nle=e=>{if(e.lifecycleStatus!==`answered`)return e.answer===void 0&&e.respondingActorId===void 0&&e.responseDigest===void 0;if(e.answer===void 0||e.respondingActorId!==e.requestingActorId||e.responseDigest===void 0)return!1;if(e.kind===`question`)return e.answer.kind===`text`;let t=new Set(e.options.map(e=>e.optionId));return e.answer.kind===`selection`&&e.answer.optionIds.every(e=>t.has(e))},wH=tle.check(L(e=>xH(e)&&nle(e))),rle=65536,ile=new TextEncoder,TH=L(e=>ile.encode(JSON.stringify(e)).byteLength<=rle),EH={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:_H,receipt:Y},ale=N({...EH,interaction:SH,method:A(`interaction.create`)}),ole=N({...EH,expectedRevision:iH,interaction:SH,method:A(`interaction.cancel`)}),sle=N({...EH,expectedRevision:iH,interaction:wH,method:A(`interaction.respond`)}),DH=e=>{let{actorId:t,commandId:n,interaction:r,method:i,receipt:a}=e;return t===r.requestingActorId&&a.actorId===t&&a.commandId===n&&a.method===i&&a.target.type===`interaction`&&a.target.id===r.interactionId&&a.aggregateRevision===r.revision&&a.createdAt===a.updatedAt&&Date.parse(a.createdAt)>=Date.parse(r.createdAt)&&(r.expiresAt===null||Date.parse(a.createdAt)<Date.parse(r.expiresAt))},OH=ale.check(L(e=>DH(e)&&e.interaction.lifecycleStatus===`pending`&&e.receipt.createdAt===e.interaction.createdAt),TH),kH=ole.check(L(e=>DH(e)&&e.interaction.lifecycleStatus===`cancelled`&&BigInt(e.interaction.revision)===BigInt(e.expectedRevision)+1n),TH),AH=sle.check(L(e=>DH(e)&&e.interaction.lifecycleStatus===`answered`&&e.receipt.createdAt===e.interaction.answeredAt&&BigInt(e.interaction.revision)===BigInt(e.expectedRevision)+1n),TH),jH=N({items:P(SH).check(H(100)),method:A(`interaction.list`),nextCursor:k(J),projectId:J,sessionId:J}).check(L(e=>new Set(e.items.map(e=>e.interactionId)).size===e.items.length&&e.items.every(t=>t.projectId===e.projectId&&t.sessionId===e.sessionId)&&(e.nextCursor===void 0||e.items.length>0)),TH),MH=N({interaction:wH,method:A(`interaction.show`)}).check(TH),cle=F([OH,jH,MH,AH,kH]),lle=N({approvalId:J,kind:jw,sessionId:J,status:A(`pending`),turnId:J}),ule=N({actorId:J,approvalId:J,guardRevision:k(q),kind:jw,sessionId:J,status:I([`answered`,`approved`,`cancelled`,`denied`,`expired`]),turnId:J}),dle=N({interactionId:J,lifecycleStatus:dH,projectId:J,sessionId:J}),fle=G(lle),ple=G(ule),NH=G(dle),PH=[[`admission`,[`refused`]],[`agent`,[`created`,`disabled`,`revised`]],[`board`,[`message.posted`,`message.replied`,`task.assigned`,`task.cancelled`,`task.claimed`,`task.completed`,`task.created`,`task.failed`,`task.needs.replaced`,`task.planned`,`task.promoted`,`task.readied`,`task.released`,`task.renewed`,`task.reopened`]],[`approval`,[`requested`,`resolved`]],[`connection`,[`created`,`state.changed`,`capacity.changed`,`limit.recorded`,`login.started`,`grant.changed`,`pool.changed`,`github.created`,`github.revoked`]],[`container`,[`created`,`renamed`]],[`delivery`,[`acknowledged`,`acknowledgement-receipt`]],[`dispatch`,[`settled`]],[`execution`,`placement.created,relocation.prepared,relocation.reconciled,worktree.checkpoint.prepared,worktree.checkpoint.running,worktree.checkpoint.succeeded,worktree.checkpoint.failed,worktree.checkpoint.outcome_unknown,command.prepared,command.running,command.succeeded,command.failed,command.outcome_unknown,file.read.prepared,file.read.running,file.read.succeeded,file.read.failed,file.read.outcome_unknown,worktree.reconciled,worktree.create.prepared,worktree.create.dispatching,worktree.create.succeeded,worktree.create.failed,worktree.create.cleanup_unknown,worktree.create.outcome_unknown,worktree.import.prepared,worktree.import.dispatching,worktree.import.succeeded,worktree.import.failed,worktree.import.cleanup_unknown,worktree.import.outcome_unknown,worktree.remove.prepared,worktree.remove.dispatching,worktree.remove.succeeded,worktree.remove.failed,worktree.remove.cleanup_unknown,worktree.remove.outcome_unknown`.split(`,`)],[`drift`,[`raised`,`settled`]],[`goal`,[`changed`]],[`hold`,[`placed`,`released`]],[`inbox`,[`posted`,`settled`,`snoozed`]],[`integration`,[`authorization.applied`,`authorization.revoking`,`authorization.update-policy.set`]],[`interaction`,[`created`,`answered`,`cancelled`]],[`port`,[`lease.acquired`,`lease.renewed`,`lease.released`,`lease.release.repeated`,`lease.expired`]],[`project`,[`created`,`registered`,`renamed`,`guard.changed`,`context.recorded`,`instructions.changed`,`knowledge.changed`]],[`pr`,[`linked`,`status.changed`,`watch.changed`]],[`question`,[`opened`,`answered`,`cancelled`]],[`remote_node`,[`registered`,`installing`,`ready`,`install_failed`,`removing`,`removed`,`remove_failed`]],[`routine`,[`created`,`paused`,`resumed`,`disabled`,`updated`,`moved`,`fire.recorded`,`trigger.created`,`trigger.disabled`]],[`run`,[`created`,`ledger.created`,`ledger.task.dispatched`,`ledger.task.settled`]],[`secret`,[`requested`,`set`]],[`session`,`created,spawned,renamed,stopped,archived,start.requested,resume.requested,runtime.started,runtime.resumed,runtime.failed,runtime.recovery.requested,runtime.recovery.updated,message.sent,inbox.acknowledged,worktree.removed,agent-permission.granted,setup.approved,setup.completed,spawn-caps.changed,child.linked,child.orphaned,child.reconciled,activity.changed,status.changed,attached,detached`.split(`,`)],[`skills`,[`sync.changed`]],[`team-workspace`,[`bootstrapped`]],[`terminal`,[`create.rejected`,`mutation.outcome-unknown`,`create.recorded`,`controller.request.recorded`,`controller.acquire.recorded`,`controller.release.recorded`,`input.write.recorded`,`session.resize.recorded`,`session.signal.recorded`,`session.close.recorded`]],[`turn`,[`queued`,`dispatching`,`started`,`completed`,`failed`,`cancelled`,`cancel.lost`,`interrupted`,`interrupt.prepared`,`interrupt.dispatching`,`interrupt.acknowledged`,`interrupt.outcome-unknown`,`interrupt.settled`,`steered`]],[`node`,[`started`,`stopping`,`pairing.changed`,`principal.changed`,`reach.changed`,`memory.changed`,`update.apply-requested`,`update.paused`,`update.policy-set`,`update.resumed`,`update.rollback-requested`]],[`update`,[`started`,`done`,`rolled_back`]],[`voice`,[`pi.relay.acknowledged`]],[`webhook`,[`added`,`redelivered`,`removed`,`tested`]],[`workspace`,[`selected`,`execution.configured`,`membership.attached`,`repository.attached`]]],FH=256,IH=512,LH=512,mle=512,RH=512,zH=256,BH=512,VH=512,hle=new Map([[`admission.refused`,{maxPayloadBytes:zH,payloadSchema:Pce}],[`approval.requested`,{maxPayloadBytes:VH,payloadSchema:fle}],[`approval.resolved`,{maxPayloadBytes:VH,payloadSchema:ple}],[`drift.raised`,{maxPayloadBytes:LH,payloadSchema:WV}],[`drift.settled`,{maxPayloadBytes:LH,payloadSchema:WV}],[`goal.changed`,{maxPayloadBytes:LH,payloadSchema:Fse}],[`interaction.answered`,{maxPayloadBytes:VH,payloadSchema:NH}],[`interaction.cancelled`,{maxPayloadBytes:VH,payloadSchema:NH}],[`interaction.created`,{maxPayloadBytes:VH,payloadSchema:NH}],[`node.memory.changed`,{maxPayloadBytes:zH,payloadSchema:Fce}],[`node.started`,{maxPayloadBytes:zH,payloadSchema:Mce}],[`node.stopping`,{maxPayloadBytes:zH,payloadSchema:Nce}],[`project.instructions.changed`,{maxPayloadBytes:mle,payloadSchema:sce}],[`project.knowledge.changed`,{maxPayloadBytes:512,payloadSchema:gce}],[`secret.requested`,{maxPayloadBytes:BH,payloadSchema:Cce}],[`secret.set`,{maxPayloadBytes:BH,payloadSchema:wce}],[`session.activity.changed`,{maxPayloadBytes:FH,payloadSchema:Ice}],[`session.attached`,{maxPayloadBytes:IH,payloadSchema:iV}],[`session.detached`,{maxPayloadBytes:IH,payloadSchema:iV}],[`session.status.changed`,{maxPayloadBytes:FH,payloadSchema:Lce}],[`update.done`,{maxPayloadBytes:RH,payloadSchema:Uce}],[`update.rolled_back`,{maxPayloadBytes:RH,payloadSchema:Wce}],[`update.started`,{maxPayloadBytes:RH,payloadSchema:Hce}]]),gle=new Set([`admission.refused`,`approval.requested`,`approval.resolved`,`drift.raised`,`drift.settled`,`goal.changed`,`interaction.answered`,`interaction.cancelled`,`interaction.created`,`node.memory.changed`,`node.started`,`node.stopping`,`session.activity.changed`,`session.status.changed`]),_le=(e,t)=>{let n=`${e}.${t}`;return{exposure:gle.has(n)?`public`:`internal`,kind:n,maxPayloadBytes:ZO,source:e,version:1,...hle.get(n)}},vle=PH.flatMap(([e,t])=>t.map(t=>_le(e,t)));PH.map(([e])=>e);var yle=new Map(vle.map(e=>[e.kind,e])),ble=e=>yle.get(e),xle=65536,Sle=4096,Cle=e=>new TextEncoder().encode(e).byteLength,wle=j.check(By(1),H(Sle),L(e=>{if(e.startsWith(`/`)||e.includes(`\\`)||e.includes(`\0`)||/^[A-Za-z]:/u.test(e)||Cle(e)>4096)return!1;let t=e.split(`/`);return t.length<=128&&t.every(e=>e.length>0&&e!==`.`&&e!==`..`)},{expected:`a bounded portable relative path without empty, dot, dot-dot, backslash, drive, or NUL segments`})),Tle=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},Ele=j.check(L(e=>/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e)&&Tle(e)<=65536,{expected:`base64 file content within 65536 decoded bytes`})),Dle=j.check(R(/^sha256:[0-9a-f]{64}$/u)),HH=N({commandId:J,expectedRevision:q,instanceId:J,relativePath:wle}),UH={commandId:J,id:J,instanceId:J,instanceRevision:q,revision:q,schemaVersion:A(eI)},WH=F([N({...UH,state:I([`prepared`,`running`])}),N({...UH,byteLength:V.check(B({maximum:xle,minimum:0})),bytesBase64:Ele,contentDigest:Dle,state:A(`succeeded`)}),N({...UH,failure:I([`file_changed`,`file_not_found`,`file_not_regular`,`file_too_large`,`path_invalid`]),state:A(`failed`)}),N({...UH,state:A(`outcome_unknown`)})]),GH=N({delivery:I([`duplicate`,`new`]),method:A(`execution.file.read`),operation:WH,receipt:Y}).check(L(e=>e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.type===`execution_instance`&&e.receipt.target.id===e.operation.instanceId&&e.receipt.aggregateRevision===e.operation.instanceRevision&&e.receipt.commandId===e.operation.commandId,{expected:`an exact receipt-backed execution file read projection`})),Ole=4096,kle=65536,Ale=4096,jle=e=>new TextEncoder().encode(e).byteLength,Mle=j.check(By(1),H(Ole),L(e=>!e.includes(`\0`),{expected:`an execution argument without NUL bytes`})),Nle=j.check(By(1),H(Ale),L(e=>!e.includes(`\0`)&&(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/u.test(e)),{expected:`an absolute execution path without NUL bytes`})),Ple=P(Mle).check(H(32),L(e=>e.reduce((e,t)=>e+jle(t),0)<=kle,{expected:`execution arguments within 65536 UTF-8 bytes`})),Fle=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},KH=j.check(L(e=>/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e)&&Fle(e)<=65536,{expected:`base64 execution output within 65536 decoded bytes`})),qH=N({argv:Ple,commandId:J,executable:Nle,expectedRevision:q,instanceId:J}),JH={commandId:J,id:J,instanceId:J,instanceRevision:q,revision:q,schemaVersion:A(eI)},Ile=N({...JH,cleanup:A(`pending`),state:I([`prepared`,`running`])}),Lle=N({code:My(V),signal:My(j.check(By(1),H(64)))}),YH=F([Ile,N({...JH,cleanup:A(`clean`),exit:Lle,state:I([`failed`,`succeeded`]),stderrBase64:KH,stdoutBase64:KH}),N({...JH,cleanup:A(`unknown`),state:A(`outcome_unknown`)})]),XH=N({delivery:I([`duplicate`,`new`]),method:A(`execution.command.run`),operation:YH,receipt:Y}).check(L(e=>e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.type===`execution_instance`&&e.receipt.target.id===e.operation.instanceId&&e.receipt.aggregateRevision===e.operation.instanceRevision&&e.receipt.commandId===e.operation.commandId,{expected:`an exact receipt-backed execution command operation projection`})),Rle=`maia.execution-placement/v1alpha1`,ZH=q,zle=N({reason:A(`local_provider_unbound`),status:A(`unavailable`)}),Ble=N({reason:A(`worker_lease_unimplemented`),status:A(`unavailable`)}),Vle=F([N({id:J,kind:A(`profile`),revision:ZH,source:A(`workspace`)}),N({id:J,kind:A(`policy`),revision:ZH,source:I([`node-default`,`workspace`])})]),QH={authority:zle,createdAt:K,fencingEpoch:ZH,id:J,instanceId:J,instanceRevision:ZH,lease:Ble,profileId:J,profileRevision:ZH,revision:ZH,schemaVersion:A(Rle),selection:Vle,state:A(`current`),updatedAt:K,workspaceId:J,workspaceRevision:ZH},$H=e=>e.selection.kind===`policy`||e.selection.source===`workspace`&&e.selection.id===e.profileId&&e.selection.revision===e.profileRevision,eU=N({...QH,kind:A(`session`),sessionId:J,sessionRevision:ZH}).check(L($H,{expected:`a Session placement with an exact profile selection snapshot`})),tU=N({...QH,attemptId:J,attemptRevision:ZH,kind:A(`attempt`),runId:J,taskId:J}).check(L($H,{expected:`an Attempt placement with an exact profile selection snapshot`})),nU=F([eU,tU]),rU={commandId:J,expectedFencingEpoch:A(`0`),expectedInstanceRevision:ZH,expectedPlacementRevision:A(`0`),expectedWorkspaceRevision:ZH,instanceId:J},iU=N({...rU,expectedSessionRevision:ZH,sessionId:J}),aU=N({...rU,attemptId:J,expectedAttemptRevision:ZH,runId:J,taskId:J}),oU=e=>e.receipt.actorId===`actor_local_user`&&e.receipt.aggregateRevision===e.placement.revision&&e.receipt.method===e.method&&e.receipt.target.id===e.placement.id&&e.receipt.target.type===`execution-placement`,sU=N({delivery:I([`new`,`duplicate`]),method:A(`execution.placement.create`),placement:eU,receipt:Y}).check(L(oU,{expected:`a Session placement receipt matching its immutable placement`})),cU=N({delivery:I([`new`,`duplicate`]),method:A(`execution.placement.create`),placement:tU,receipt:Y}).check(L(oU,{expected:`an Attempt placement receipt matching its immutable placement`})),lU=F([iU,aU]),uU=F([sU,cU]),dU=F([N({kind:A(`session`),ownerId:J}),N({kind:A(`attempt`),ownerId:J})]),fU=N({method:A(`execution.placement.show`),placement:nU}),pU=`maia.execution-relocation/v1alpha1`,Hle=1048576,mU=q,hU=j.check(L(e=>/^sha256:[a-f0-9]{64}$/u.test(e),{expected:`a lowercase SHA-256 digest`})),Ule=j.check(L(e=>/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(e),{expected:`an exact Git object revision`})),gU=I([`runtime_bound`,`session_not_idle`,`source_dirty`,`source_placement_missing`,`target_profile_unsupported`,`turn_active`]),Wle=I([`checkpointing`,`completed`,`creating_standby`,`cutover_committed`,`draining_source`,`failed`,`outcome_unknown`,`prepared`]),_U=N({byteLength:V.check(z(0),Ry(Hle)),contentDigest:hU,createdAt:K,id:J,kind:A(`local-identity`),schemaVersion:A(pU),sourceInstanceId:J,sourceRevision:Ule,targetInstanceId:J,workspaceId:J}),vU={commandId:J,id:J,revision:mU,schemaVersion:A(pU),sessionId:J,sourceInstanceId:J,workspaceId:J},yU=F([N({...vU,cleanup:A(`pending`),phase:I([`checkpointing`,`creating_standby`,`prepared`]),state:I([`dispatching`,`prepared`])}),N({...vU,checkpointId:J,cleanup:A(`clean`),fencingEpoch:mU,phase:I([`completed`,`cutover_committed`,`draining_source`]),placementRevision:mU,state:A(`succeeded`),targetInstanceId:J}),N({...vU,cleanup:A(`clean`),failure:gU,phase:A(`failed`),state:A(`failed`)}),N({...vU,cleanup:A(`unknown`),phase:A(`outcome_unknown`),state:A(`outcome_unknown`)})]),Gle=N({blockers:P(gU).check(H(16)),digest:hU,eligible:M,expectedFencingEpoch:mU,expectedPlacementRevision:mU,expectedSessionRevision:mU,id:J,sessionId:J,sourceInstanceId:J,targetProfileId:A(nI),workspaceId:J}).check(L(e=>e.eligible===(e.blockers.length===0),{expected:`a relocation plan whose eligibility matches its blockers`})),bU=N({expectedFencingEpoch:mU,expectedPlacementRevision:mU,expectedSessionRevision:mU,sessionId:J,targetProfileId:A(nI)}),xU=N({method:A(`execution.relocation.plan`),plan:Gle}),SU=N({commandId:J,expectedFencingEpoch:mU,expectedPlacementRevision:mU,expectedSessionRevision:mU,planDigest:hU,planId:J,sessionId:J}),CU=N({checkpoint:k(_U),delivery:I([`duplicate`,`new`]),method:A(`execution.relocation.apply`),operation:yU,receipt:Y}).check(L(e=>e.receipt.actorId===`actor_local_user`&&e.receipt.commandId===e.operation.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.sessionId&&e.receipt.target.type===`session`&&(e.operation.state===`succeeded`?e.checkpoint?.id===e.operation.checkpointId:e.checkpoint===void 0),{expected:`an exact receipt-backed local relocation projection`})),wU=N({relocationId:J}),TU=N({checkpoint:k(_U),method:A(`execution.relocation.show`),operation:yU}),EU=N({commandId:J,expectedOperationRevision:mU,relocationId:J}),DU=N({delivery:I([`duplicate`,`new`]),method:A(`execution.relocation.reconcile`),operation:yU,receipt:Y}).check(L(e=>e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.id===e.operation.sessionId&&e.receipt.target.type===`session`,{expected:`a receipt-backed relocation reconciliation projection`})),Kle=F([N({method:A(`execution.relocation.apply`),parameters:SU}),N({method:A(`execution.relocation.plan`),parameters:bU}),N({method:A(`execution.relocation.reconcile`),parameters:EU}),N({method:A(`execution.relocation.show`),parameters:wU})]),qle=F([CU,xU,DU,TU]),OU=q,kU=N({binding:A(`unavailable`),builtIn:A(!0),deploymentMode:A(`agentless`),id:A(tI),kind:A(`local-host`),reason:A(`local_provider_unbound`),releaseQualified:A(!1),revision:A(`1`),schemaVersion:A(eI),trust:A(`trusted_host`),unsupportedCapabilities:Ay([A(`isolation`),A(`ports`),A(`snapshots`)])}),AU=N({builtIn:A(!0),id:A(nI),name:A(`Local host`),providerId:A(tI),revision:A(`1`),schemaVersion:A(eI)}),jU=N({builtIn:A(!0),id:A(iI),name:A(`Local default`),profileIds:Ay([A(nI)]),revision:A(`1`),schemaVersion:A(eI)}),MU=F([N({id:J,kind:A(`profile`)}),N({id:J,kind:A(`policy`)})]),NU=N({selection:MU,workspaceId:J,workspaceRevision:OU}),PU=N({reason:A(`local_provider_unbound`),selectedProfileId:J,selection:MU,source:I([`node-default`,`workspace`]),status:A(`unavailable`),workspaceId:J,workspaceRevision:OU}),Jle=Oy(j,by),FU=N({id:J,profileId:A(nI),providerId:A(tI),revision:OU,schemaVersion:A(eI),state:A(`folder-bound`),workspaceId:J}),IU=Jle,LU=N({workspaceId:J}),RU={commandId:J,expectedRevision:OU,workspaceId:J},zU=F([N({...RU,operation:A(`clear`)}),N({...RU,operation:A(`set`),selection:MU})]),BU=N({defaultPolicyId:A(iI),method:A(`execution.catalog.get`),policies:Ay([jU]),profiles:Ay([AU]),providers:Ay([kU])}),Yle=(e,t)=>e.kind===t.kind&&e.id===t.id,Xle=e=>e.kind===`profile`?e.id===nI:e.id===iI,VU=e=>(e.instance===void 0||e.instance.workspaceId===e.workspace.id)&&e.resolution.workspaceId===e.workspace.id&&e.resolution.workspaceRevision===e.workspace.revision&&e.resolution.selectedProfileId===`execution_profile_local_host`&&Xle(e.resolution.selection)&&(e.binding===void 0?e.resolution.source===`node-default`&&e.resolution.selection.kind===`policy`&&e.resolution.selection.id===`placement_policy_local_default`:e.binding.workspaceId===e.workspace.id&&e.binding.workspaceRevision===e.workspace.revision&&e.resolution.source===`workspace`&&Yle(e.binding.selection,e.resolution.selection)),HU=N({binding:k(NU),instance:k(FU),method:A(`workspace.execution.show`),resolution:PU,workspace:HP}).check(L(VU,{expected:`an exact workspace execution projection`})),UU=N({binding:k(NU),delivery:I([`new`,`duplicate`]),method:A(`workspace.execution.configure`),receipt:Y,resolution:PU,workspace:HP}).check(L(e=>VU(e)&&e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.type===`workspace`&&e.receipt.target.id===e.workspace.id&&e.receipt.aggregateRevision===e.workspace.revision,{expected:`an exact receipt-backed workspace execution configuration projection`})),WU=F([N({method:A(`execution.catalog.get`),parameters:IU}),N({method:A(`execution.command.run`),parameters:qH}),N({method:A(`execution.file.read`),parameters:HH}),N({method:A(`execution.placement.create`),parameters:lU}),N({method:A(`execution.placement.show`),parameters:dU}),N({method:A(`workspace.execution.show`),parameters:LU}),N({method:A(`workspace.execution.configure`),parameters:zU})]),GU=F([BU,XH,GH,uU,fU,HU,UU]);G(kU),G(AU),G(jU),G(MU),G(NU),G(PU),G(IU);var KU=G(BU);G(FU),G(LU);var qU=G(HU);G(zU);var JU=G(UU),YU=2**53-1,XU=1e9,ZU=4096,QU=2048,$U=20,eW=q.check(R(/^[1-9]\d*$/u)),tW=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),nW=V.check(B({maximum:YU,minimum:1})),rW=j.check(R(/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?!\.{1,2}$)[A-Za-z0-9._-]{1,100}$/u)),iW=P(j.check(R(/^[A-Za-z0-9][A-Za-z0-9-]{0,38}(?:\[bot\])?$/u))).check(H($U),L(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length,{expected:`allowed authors without duplicates`})),aW=V.check(B({maximum:XU,minimum:1})),oW=j.check(U(1,ZU),R(/^-----BEGIN (?:RSA )?PRIVATE KEY-----[A-Za-z0-9+/=\s]+-----END (?:RSA )?PRIVATE KEY-----\s*$/u)),sW=N({appId:nW,connectionId:J,createdAt:K,installationId:nW,name:tW,revision:eW,state:I([`active`,`revoked`]),updatedAt:K}),cW=N({allowedAuthors:iW,connectionId:k(J),createdAt:K,linkId:J,number:aW,repository:rW,revision:eW,sessionId:J,updatedAt:K,watching:M}),lW=V.check(z(0)),uW=j.check(H(QU),R(/^https:\/\/[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::\d{1,5})?(?:[/?#][!-~]*)?$/u)),dW=N({link:cW,observation:k(N({checks:N({failed:lW,passed:lW,pending:lW}),headSha:j.check(R(/^[0-9a-f]{40,64}$/u)),mergeable:I([`conflicting`,`mergeable`,`unknown`]),observedAt:K,state:I([`closed`,`merged`,`open`]),webUrl:k(uW)})),pollError:k(I([`not_found`,`rate_limited`,`unauthorized`,`unavailable`])),wakes:N({delivered:lW,skipped:lW})}),fW=N({appId:nW,commandId:J,installationId:nW,name:tW,privateKey:oW}),pW=N({connectionId:k(J)}),mW=N({commandId:J,connectionId:J,expectedRevision:eW}),hW=N({commandId:J,connectionId:k(J),number:aW,repository:rW,sessionId:J}),gW=N({sessionId:J}),_W=N({allowedAuthors:iW,commandId:J,expectedRevision:eW,linkId:J,watching:M}),vW={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y},yW=N({...vW,connection:sW,keyCustody:I([`kept`,`stored`]),method:A(`connection.github.create`)}),bW=N({...vW,connection:sW,expectedRevision:eW,method:A(`connection.github.revoke`)}),xW=N({...vW,link:cW,method:A(`pr.link`)}),SW=N({...vW,expectedRevision:eW,link:cW,method:A(`pr.watch`)}),CW=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===e.target.type&&e.receipt.target.id===e.target.id&&e.receipt.aggregateRevision===e.target.revision,wW=e=>BigInt(e.target.revision)===BigInt(e.expectedRevision)+1n,TW=e=>({id:e.connection.connectionId,revision:e.connection.revision,type:`github-connection`}),EW=e=>({id:e.link.linkId,revision:e.link.revision,type:`pr-link`}),DW=yW.check(L(e=>CW({...e,target:TW(e)})&&e.connection.revision===`1`&&e.connection.state===`active`)),OW=bW.check(L(e=>{let t=TW(e);return CW({...e,target:t})&&wW({...e,target:t})&&e.connection.state===`revoked`})),kW=N({connections:P(sW).check(H(100),L(e=>new Set(e.map(e=>e.connectionId)).size===e.length)),method:A(`connection.github.show`)}),AW=xW.check(L(e=>CW({...e,target:EW(e)})&&e.link.revision===`1`&&!e.link.watching)),jW=SW.check(L(e=>{let t=EW(e);return CW({...e,target:t})&&wW({...e,target:t})})),MW=N({method:A(`pr.status`),sessionId:J,statuses:P(dW).check(H(5))}).check(L(e=>e.statuses.every(t=>t.link.sessionId===e.sessionId))),NW=F([N({method:A(`connection.github.create`),parameters:fW}),N({method:A(`connection.github.show`),parameters:pW}),N({method:A(`connection.github.revoke`),parameters:mW}),N({method:A(`pr.link`),parameters:hW}),N({method:A(`pr.status`),parameters:gW}),N({method:A(`pr.watch`),parameters:_W})]),PW=F([DW,kW,OW,AW,MW,jW]);G(sW),G(cW),G(uW),G(fW);var FW=G(DW);G(pW);var IW=G(kW);G(mW);var LW=G(OW);G(hW);var RW=G(AW);G(gW);var zW=G(MW);G(_W);var BW=G(jW),VW=Oy(j,by),HW={authorized:A(!1),selected:A(!1)},UW=(e,t)=>({...HW,displayName:A(t),harnessId:A(e)}),WW=(e,t)=>N({...UW(e,t),detected:A(!1),reason:I([`deadline_exceeded`,`path_invalid`,`path_unsafe`,`permission_denied`]),status:A(`indeterminate`)}),GW=(e,t)=>{let n=UW(e,t);return F([N({...n,detected:A(!0),status:A(`detected`)}),N({...n,detected:A(!1),reason:A(`executable_not_found`),status:A(`not_detected`)}),N({...n,detected:A(!1),reason:A(`platform_unsupported`),status:A(`unsupported`)}),WW(e,t)])},KW=VW,qW=N({items:Ay([GW(`codex`,`Codex`),GW(`cursor`,`Cursor`),GW(`grok`,`Grok`),GW(`mistral-vibe`,`Mistral Vibe`),GW(X.pi,`Pi`)]),method:A(`harness.installed.list`),schemaVersion:A(2)}),JW=N({method:A(`harness.installed.list`),parameters:KW});G(KW);var YW=G(qW);G(_k),G(Sk),G(Ck),G(wk);var XW=G(Tk);G(jk);var ZW=G(Fk);G(Mk);var QW=G(zk);G(Nk);var $W=G(Ik);G(Pk);var eG=G(Bk),tG=`maia.inbox/v1`,nG=`inbox_item`,rG=J.check(R(/^inbox_[a-f0-9]{32}$/u)),iG=I([`approval`,`confirmation`,`failed_turn`,`finished_session`,`goal_drift`,`question`,`secret_request`]),aG=I([`open`,`settled`,`snoozed`]),oG=j.check(R(/^[a-f0-9]{64}$/u)),sG=j.check(R(/^sha256:[a-f0-9]{64}$/u)),cG=N({id:J,type:j.check(R(/^[a-z][a-z_]{0,31}$/u))}),lG={expiresAt:K,input:Oy(j,xy),inputDigest:oG,requestDigest:sG,revision:k(q),targets:P(cG).check(H(16))},uG=j.check(U(1,128)),dG=N({...lG,createdAt:K,itemId:rG,operation:uG,principalId:J,resolution:k(N({actorId:J,executedReceiptId:k(J),resolvedAt:K})),status:I([`confirmed`,`denied`,`expired`,`pending`])}).check(L(e=>Date.parse(e.expiresAt)>Date.parse(e.createdAt)&&(e.status===`confirmed`||e.status===`denied`)==(e.resolution!==void 0)&&e.resolution?.actorId!==e.principalId&&(e.resolution?.executedReceiptId===void 0||e.status===`confirmed`),{expected:`a proposal with a later expiry, resolved by a person other than the bot exactly when confirmed or denied`})),fG=new Set([`failed_turn`,`finished_session`,`goal_drift`]),pG=e=>e===`approval`||e===`question`,mG=N({approvalId:k(J),createdAt:K,itemId:rG,kind:iG,principalId:J,revision:q,schemaVersion:A(tG),secretName:k(GV),sessionId:k(J),snoozedUntil:k(K),state:aG,turnId:k(J),updatedAt:K}).check(L(e=>e.state===`snoozed`==(e.snoozedUntil!==void 0)&&(pG(e.kind)?e.approvalId!==void 0&&e.sessionId!==void 0&&e.turnId!==void 0:e.approvalId===void 0)&&(!fG.has(e.kind)||e.sessionId!==void 0)&&(e.kind===`secret_request`?e.secretName!==void 0&&e.sessionId!==void 0:e.secretName===void 0)&&Date.parse(e.createdAt)<=Date.parse(e.updatedAt),{expected:`a consistent inbox item`})),hG=N({limit:V.check(B({maximum:50,minimum:1})),state:k(aG)}),gG=N({itemId:rG}),_G=N({itemId:rG,...Rw}).check(zw),vG={commandId:J,expectedRevision:q,itemId:rG},yG=N(vG),bG=N({...vG,until:K}),xG=N({items:P(mG).check(H(50)),method:A(`inbox.list`)}).check(L(e=>new Set(e.items.map(e=>e.itemId)).size===e.items.length,{expected:`unique inbox items`})),SG=N({approval:k(Pw),confirmation:k(dG),item:mG,method:A(`inbox.show`)}).check(L(e=>e.approval===void 0==(e.item.approvalId===void 0)&&e.approval?.approvalId===e.item.approvalId&&e.confirmation===void 0==(e.item.kind!==`confirmation`)&&(e.confirmation===void 0||e.confirmation.itemId===e.item.itemId),{expected:`the approval or the proposal the item names`})),CG={commandId:J,delivery:I([`duplicate`,`new`]),item:mG,receipt:Y},wG=(e,t)=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===t.type&&e.receipt.target.id===t.id,TG=F([N({...CG,approval:Pw,method:A(`inbox.respond`)}).check(L(e=>e.approval.status!==`pending`&&e.item.state===`settled`&&e.item.approvalId===e.approval.approvalId&&e.approval.resolution?.actorId===e.receipt.actorId&&e.receipt.aggregateRevision===e.approval.revision&&wG(e,{id:e.approval.approvalId,type:`approval`}),{expected:`a resolved approval bound to its receipt`})),N({...CG,confirmation:dG,executed:k(Y),method:A(`inbox.respond`)}).check(L(e=>e.item.state===`settled`&&e.confirmation.itemId===e.item.itemId&&e.confirmation.resolution?.actorId===e.receipt.actorId&&e.receipt.actorId!==e.confirmation.principalId&&e.executed?.receiptId===e.confirmation.resolution?.executedReceiptId&&wG(e,{id:e.item.itemId,type:`inbox_item`}),{expected:`a decided proposal bound to the person's receipt`}))]),EG=L(e=>wG(e,{id:e.item.itemId,type:nG}),{expected:`an inbox item bound to its receipt`}),DG=N({...CG,method:A(`inbox.settle`)}).check(EG),OG=N({...CG,method:A(`inbox.snooze`)}).check(EG),kG=F([N({method:A(`inbox.list`),parameters:hG}),N({method:A(`inbox.respond`),parameters:_G}),N({method:A(`inbox.settle`),parameters:yG}),N({method:A(`inbox.show`),parameters:gG}),N({method:A(`inbox.snooze`),parameters:bG})]),AG=F([xG,TG,DG,SG,OG]);G(mG),G(dG),G(hG);var jG=G(xG);G(gG);var MG=G(SG);G(_G);var NG=G(TG);G(yG);var PG=G(DG);G(bG);var FG=G(OG),IG=8192,LG=2048,RG=16384,zG=new TextEncoder,BG=(e,t)=>j.check(U(1,e),L(t=>!t.includes(`\0`)&&zG.encode(t).byteLength<=e,{expected:t})),VG=BG(128,`a non-empty integration revision of at most 128 UTF-8 bytes`).check(R(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),HG=BG(96,`a non-empty Pi RPC revision of at most 96 UTF-8 bytes`).check(R(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),UG=j.check(U(1,19),R(/^[1-9]\d*$/u),L(e=>/^[1-9]\d*$/u.test(e)&&BigInt(e)<=9223372036854775807n,{expected:`a positive signed 64-bit authorization revision`})),WG=j.check(U(1,20),R(/^[0-9]+$/u)),GG=j.check(U(1,20),R(/^[0-9]+$/u),L(e=>/^[0-9]+$/u.test(e)&&BigInt(e)<=18446744073709551615n,{expected:`an unsigned 64-bit decimal value`})),KG=N({device:GG,inode:GG,sizeBytes:GG}),qG=j.check(U(64,64),R(/^[0-9a-f]{64}$/u)),JG=BG(4096,`a non-empty absolute executable path of at most 4096 UTF-8 bytes`).check(R(/^\/[^\0]*$/u),L(e=>e===`/`||!e.endsWith(`/`)&&e.slice(1).split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{expected:`a normalized absolute executable path without dot segments`})),YG=JG.check(L(e=>e!==`/`,{expected:`a non-root normalized absolute Pi RPC path`})),XG=F([Ay([A(`codex-probe`)]),Ay([A(`codex-session`)]),Ay([A(`codex-probe`),A(`codex-session`)])]),ZG=Ay([A(`claude-code-session`)]),QG=Ay([A(`maia-agent-session`)]),$G=Ay([A(`pi-session`)]),eK=Ay([A(`antigravity-session`)]),tK=Ay([A(`grok-cli-session`)]),nK=F([Ay([A(`pi-rpc-probe`)]),Ay([A(`pi-rpc-probe`),A(`pi-rpc-session`)])]),rK=I([`arm64`,`x64`]),iK=BG(214,`a Pi package name of at most 214 UTF-8 bytes`).check(R(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u)),aK=BG(128,`a Pi package version of at most 128 UTF-8 bytes`).check(R(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u)),oK=V.check(z(1),Ry(RG)),sK=V.check(z(0),Ry(16)),cK=e=>({integration:A(e),releaseQualified:A(!1),schemaVersion:A(1)}),lK=cK(`codex`),uK=cK(`pi-rpc`),dK=cK(X.claudeCode),fK=cK(X.maiaAgent),pK=cK(X.pi),mK=cK(X.antigravity),hK=cK(X.grokCli),gK={adapterVersion:VG,executableSha256:qG,ownerKinds:XG,planDigest:qG,planId:J,revision:UG,sandboxPolicyRevision:VG,vouchPolicyRevision:VG},_K={...gK,ownerKinds:ZG},vK={...gK,ownerKinds:QG},yK={...gK,ownerKinds:$G},bK={...gK,ownerKinds:eK},xK={...gK,ownerKinds:tK},SK={adapterVersion:HG,conversationPolicyRevision:HG,entryFileIdentity:KG,entrySha256:qG,interpreterArchitecture:rK,interpreterFileIdentity:KG,interpreterSha256:qG,interpreterVersion:A(`24.22.1`),ownerKinds:nK,packageClosureBytes:GG,packageClosureEntries:oK,packageClosureSha256:qG,packageManifestSha256:qG,packageName:iK,packageVersion:aK,planDigest:qG,planId:J,revision:UG,vouchPolicyRevision:HG},CK=e=>{let t=e.activeUnsettledPermits===0,n=e.revokingUnsettledPermits===0;switch(e.authorization.state){case`active`:return e.nextAction===`none`&&n;case`revoking`:return t&&e.nextAction===`wait_for_revocation`;case`replaced`:case`revoked`:return t&&e.nextAction===`plan_and_apply`&&n;case`cleanup_unknown`:return t&&e.nextAction===`inspect_cleanup_unknown`}},wK=e=>e.authorization.state===e.outcome,TK=(e,t)=>N({...e,state:A(t)}),EK=e=>TK(gK,e),DK=e=>TK(SK,e),OK=e=>N({...e,state:I([`active`,`revoking`,`revoked`,`replaced`,`cleanup_unknown`])}).pipe(Ny(e=>!0,{expected:`an integration authorization state`})),kK=OK(gK),AK=OK(SK),jK=OK(_K),MK=e=>N({integration:A(e)}),NK=MK(`codex`),PK=N({commandId:J,planId:J}),FK=PK,IK=MK(`codex`),LK=e=>N({commandId:J,integration:A(e)}),RK=LK(`codex`),zK=MK(`pi-rpc`),BK=PK,VK=MK(`pi-rpc`),HK=LK(`pi-rpc`),UK=MK(X.claudeCode),WK=PK,GK=MK(X.claudeCode),KK=LK(X.claudeCode),qK=MK(X.maiaAgent),JK=PK,YK=MK(X.maiaAgent),XK=LK(X.maiaAgent),ZK=MK(X.pi),QK=PK,$K=MK(X.pi),eq=LK(X.pi),tq=MK(X.antigravity),nq=PK,rq=MK(X.antigravity),iq=LK(X.antigravity),aq=MK(X.grokCli),oq=PK,sq=MK(X.grokCli),cq=LK(X.grokCli),lq=V.check(z(1),Ry(IG)),uq=(e,t,n)=>N({...e,method:A(t),plan:N({createdAt:K,expiresAt:K,integration:A(n.integration),planBytes:lq,planDigest:qG,planId:J,target:n.target})}),dq=N({adapter:A(`codex`),adapterVersion:VG,executableIdentity:N({device:WG,inode:WG,sizeBytes:WG}),executablePath:JG,executableSha256:qG,ownerKinds:XG,sandboxPolicyRevision:VG,vouchPolicyRevision:VG}),fq=uq(lK,`integration.plan.codex`,{integration:`codex`,target:dq}),pq=N({...dq.fields,adapter:A(X.claudeCode),ownerKinds:ZG}),mq=uq(dK,`integration.plan.claude-code`,{integration:X.claudeCode,target:pq}),hq=N({...dq.fields,adapter:A(X.maiaAgent),ownerKinds:QG}),gq=uq(fK,`integration.plan.maia-agent`,{integration:X.maiaAgent,target:hq}),_q=N({...dq.fields,adapter:A(X.pi),ownerKinds:$G}),vq=uq(pK,`integration.plan.pi`,{integration:X.pi,target:_q}),yq=N({...dq.fields,adapter:A(X.antigravity),ownerKinds:eK}),bq=uq(mK,`integration.plan.antigravity`,{integration:X.antigravity,target:yq}),xq=N({...dq.fields,adapter:A(X.grokCli),ownerKinds:tK}),Sq=uq(hK,`integration.plan.grok-cli`,{integration:X.grokCli,target:xq}),Cq=N({identity:KG,path:YG,sha256:qG}),wq=uq(uK,`integration.plan.pi-rpc`,{integration:`pi-rpc`,target:N({adapter:A(`pi-rpc`),adapterVersion:HG,conversationPolicyRevision:HG,entry:Cq,interpreter:N({architecture:rK,identity:KG,path:YG,sha256:qG,version:A(`24.22.1`)}),ownerKinds:nK,packageClosure:N({closureSha256:qG,entryCount:oK,manifestFormat:A(`maia.pi-package-closure/v1`),manifestSha256:qG,packageName:iK,packageRoot:YG,packageVersion:aK,totalBytes:GG}),vouchPolicyRevision:HG})}),Tq=(e,t,n)=>N({...e,authorization:t,delivery:I([`new`,`duplicate`]),method:A(n),outcome:A(`applied`),receipt:Y}),Eq=Tq(lK,EK(`active`),`integration.apply.codex`),Dq=Tq(uK,DK(`active`),`integration.apply.pi-rpc`),Oq=Tq(dK,TK(_K,`active`),`integration.apply.claude-code`),kq=Tq(fK,TK(vK,`active`),`integration.apply.maia-agent`),Aq=Tq(pK,TK(yK,`active`),`integration.apply.pi`),jq=Tq(mK,TK(bK,`active`),`integration.apply.antigravity`),Mq=Tq(hK,TK(xK,`active`),`integration.apply.grok-cli`),Nq=N({authorizationAvailable:A(!1),nextAction:A(`plan_and_apply`),reason:A(`no_authorization`)}),Pq=e=>N({activeUnsettledPermits:sK,authorization:e,authorizationAvailable:A(!0),nextAction:I([`inspect_cleanup_unknown`,`none`,`plan_and_apply`,`wait_for_revocation`]),revokingUnsettledPermits:sK}),Fq=e=>F([Pq(OK(e)).pipe(Ny(e=>CK(e),{expected:`a status item consistent with its authorization state`})),Nq]),Iq=Fq(gK),Lq=Fq(SK),Rq=Fq(_K),zq=Fq(vK),Bq=Fq(yK),Vq=Fq(bK),Hq=Fq(xK),Uq=(e,t,n)=>N({...e,items:Ay([t]),method:A(n.method)}).check(L(e=>zG.encode(JSON.stringify(e)).byteLength<=LG,{expected:n.expected})),Wq=Uq(lK,Iq,{expected:`an integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.codex`}),Gq=Uq(uK,Lq,{expected:`a Pi RPC integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.pi-rpc`}),Kq=Uq(dK,Rq,{expected:`a Claude Code integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.claude-code`}),qq=Uq(fK,zq,{expected:`a maia-agent integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.maia-agent`}),Jq=Uq(pK,Bq,{expected:`a pi integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.pi`}),Yq=Uq(mK,Vq,{expected:`an antigravity integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.antigravity`}),Xq=Uq(hK,Hq,{expected:`a grok-cli integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.grok-cli`}),Zq=(e,t,n)=>N({...e,authorization:t,delivery:I([`new`,`duplicate`]),invalidatedIssuedPermits:sK,method:A(n),outcome:I([`cleanup_unknown`,`revoked`]),receipt:Y,remainingUnsettledPermits:sK}),Qq=(e,t,n)=>Zq(e,OK(t),n).pipe(Ny(e=>wK(e),{expected:`a remove outcome consistent with its authorization state`})),$q=Qq(lK,gK,`integration.remove.codex`),eJ=Qq(uK,SK,`integration.remove.pi-rpc`),tJ=Qq(dK,_K,`integration.remove.claude-code`),nJ=Qq(fK,vK,`integration.remove.maia-agent`),rJ=Qq(pK,yK,`integration.remove.pi`),iJ=Qq(mK,bK,`integration.remove.antigravity`),aJ=Qq(hK,xK,`integration.remove.grok-cli`),oJ=(e,t)=>N({method:A(e),parameters:t}),sJ=F([oJ(`integration.plan.codex`,NK),oJ(`integration.apply.codex`,FK),oJ(`integration.status.codex`,IK),oJ(`integration.remove.codex`,RK),oJ(`integration.plan.pi-rpc`,zK),oJ(`integration.apply.pi-rpc`,BK),oJ(`integration.status.pi-rpc`,VK),oJ(`integration.remove.pi-rpc`,HK),oJ(`integration.plan.claude-code`,UK),oJ(`integration.apply.claude-code`,WK),oJ(`integration.status.claude-code`,GK),oJ(`integration.remove.claude-code`,KK),oJ(`integration.plan.maia-agent`,qK),oJ(`integration.apply.maia-agent`,JK),oJ(`integration.status.maia-agent`,YK),oJ(`integration.remove.maia-agent`,XK),oJ(`integration.plan.pi`,ZK),oJ(`integration.apply.pi`,QK),oJ(`integration.status.pi`,$K),oJ(`integration.remove.pi`,eq),oJ(`integration.plan.antigravity`,tq),oJ(`integration.apply.antigravity`,nq),oJ(`integration.status.antigravity`,rq),oJ(`integration.remove.antigravity`,iq),oJ(`integration.plan.grok-cli`,aq),oJ(`integration.apply.grok-cli`,oq),oJ(`integration.status.grok-cli`,sq),oJ(`integration.remove.grok-cli`,cq)]),cJ=F([fq,Eq,Wq,$q,wq,Dq,Gq,eJ,mq,Oq,Kq,tJ,gq,kq,qq,nJ,vq,Aq,Jq,rJ,bq,jq,Yq,iJ,Sq,Mq,Xq,aJ]);G(jK),G(Rq),G(UK),G(WK),G(GK),G(KK);var lJ=G(mq),uJ=G(Oq),dJ=G(Kq),fJ=G(tJ);G(kK),G(Iq),G(NK),G(FK),G(IK),G(RK);var pJ=G(fq),mJ=G(Eq),hJ=G(Wq),gJ=G($q);G(qK),G(JK),G(YK),G(XK);var _J=G(gq),vJ=G(kq),yJ=G(qq),bJ=G(nJ);G(ZK),G(QK),G($K),G(eq);var xJ=G(vq),SJ=G(Aq),CJ=G(Jq),wJ=G(rJ);G(tq),G(nq),G(rq),G(iq);var TJ=G(bq),EJ=G(jq),DJ=G(Yq),OJ=G(iJ);G(aq),G(oq),G(sq),G(cq);var kJ=G(Sq),AJ=G(Mq),jJ=G(Xq),MJ=G(aJ);G(AK),G(Lq),G(zK),G(BK),G(VK),G(HK);var NJ=G(wq),PJ=G(Dq),FJ=G(Gq),IJ=G(eJ);G(SH),G(wH);var LJ=G(OH),RJ=G(jH),zJ=G(MH),BJ=G(AH),VJ=G(kH),HJ=e=>e.toLowerCase()!==`all`,UJ=e=>new Set(e).size===e.length,WJ=L(HJ,{expected:`an exact target, never the literal all`}),GJ=J.check(H(122)),KJ=N({capabilities:P(j.check(U(1,32),R(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),WJ)).check(U(1,8),L(UJ,{expected:`unique capability codes`})),projectId:GJ.check(WJ)}),qJ=N({audience:GJ,certificateFingerprint:j.check(R(/^sha256:[a-f0-9]{64}$/u)),grants:P(KJ).check(H(16),L(e=>UJ(e.map(e=>e.projectId)),{expected:`at most one grant per Project`})),registrationIncarnation:J,revocationRevision:q}),JJ=16384,YJ=Math.max(...Object.values(GM).map(({length:e})=>e)),XJ=`maia.invocation-context/v1`,ZJ=new TextEncoder,QJ=Oy(j,by),$J=j.check(U(1,64),R(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u)),eY=N({agentId:k(J),attemptId:k(J),cursor:k(J),dispatchId:k(J),instanceId:k(J),mailboxId:k(J),runId:k(J),sessionId:k(J),taskId:k(J),workspaceId:k(J)}),tY=N({actorId:J,allowedActions:P($J).check(H(YJ)),attachmentUsed:M,contextRevision:j.check(U(1,19),R(/^(?:0|[1-9]\d*)$/u)),credential:k(A(`session`)),deviceId:k(J),expiresAt:k(K),issuedAt:k(K),machine:k(qJ),method:A(`context.show`),nodeId:k(J),principal:N({displayName:k(nS),id:J,kind:I([`client`,`session`,`machine`,`person`])}),related:k(eY),role:k(Dj),schemaVersion:A(XJ)}),nY=e=>ZJ.encode(JSON.stringify(e)).byteLength<=JJ,rY=e=>new Set(e.allowedActions).size===e.allowedActions.length,iY=e=>e.principal.kind!==`client`||!e.attachmentUsed&&e.actorId===`actor_local_user`&&e.credential===void 0&&e.role===void 0&&e.deviceId===void 0&&e.expiresAt===void 0&&e.issuedAt===void 0&&e.nodeId===void 0&&e.related===void 0,aY=e=>e.principal.kind!==`session`||(e.credential===`session`?!e.attachmentUsed&&e.actorId===`actor_${e.principal.id}`&&e.role!==void 0:e.attachmentUsed&&e.actorId===`actor_local_user`&&e.role===void 0)&&e.deviceId===void 0&&e.expiresAt!==void 0&&e.issuedAt!==void 0&&e.nodeId===void 0&&e.related?.sessionId===e.principal.id&&e.related.workspaceId!==void 0&&e.related.agentId===void 0&&e.related.attemptId===void 0&&e.related.cursor===void 0&&e.related.dispatchId===void 0&&e.related.instanceId===void 0&&e.related.mailboxId===void 0&&e.related.runId===void 0&&e.related.taskId===void 0,oY=e=>e.principal.kind===`person`?e.principal.displayName!==void 0&&e.principal.id===`actor_local_user`&&e.actorId===`actor_local_user`&&!e.attachmentUsed&&e.credential===void 0&&e.role===void 0&&e.deviceId===void 0&&e.expiresAt===void 0&&e.issuedAt===void 0&&e.nodeId===void 0&&e.related===void 0:e.principal.displayName===void 0,sY=e=>e.principal.kind===`machine`?e.machine!==void 0&&e.actorId===`actor_${e.principal.id}`&&!e.attachmentUsed&&e.allowedActions.length===0&&e.credential===void 0&&e.role===void 0&&e.deviceId===void 0&&e.expiresAt===void 0&&e.issuedAt===void 0&&e.nodeId===void 0&&e.related===void 0:e.machine===void 0,cY=QJ,lY=tY.check(L(rY,{expected:`unique Invocation-context allowed-action codes`}),L(iY,{expected:`a Client Invocation-context projection without attachment, related IDs, or issue/expiry timestamps`}),L(aY,{expected:`a Session Invocation-context projection, by attachment or by its own credential with its role and actor, with Session/Workspace related IDs`}),L(oY,{expected:`a person Invocation-context projection by the paired person's actor ID and display name alone, with no Session or attachment fields`}),L(sY,{expected:`a machine Invocation-context projection by its Execution Node identity and grants alone, with no user, Session or attachment fields`}),L(nY,{expected:`an encoded Invocation-context projection of at most 16384 UTF-8 bytes`})),uY=N({method:A(`context.show`),parameters:cY}),dY=lY;G(cY);var fY=G(lY),pY=G,mY=pY(OA),hY=pY(kA),gY=pY(NA),_Y=pY(PA);pY(FA);var vY=pY(IA);pY(LA);var yY=pY(RA);pY(zA);var bY=pY(BA);pY(VA);var xY=pY(HA);pY(UA);var SY=pY(WA);pY(GA);var CY=pY(KA);pY(qA);var wY=pY(JA),TY=I([`operator`,`reader`]),EY=F([N({kind:A(`create`),role:TY}),N({kind:A(`revoke`),pairingId:J})]),DY=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),OY={change:EY,commandId:J,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K},kY=N({clientId:k(J),createdAt:K,expiresAt:K,pairingId:J,role:TY,state:I([`active`,`expired`,`pending`,`revoked`])}),AY=N({method:A(`node.pairing.show`),pairings:P(kY).check(H(100))}),jY=N({change:EY,commandId:J}),MY=N({...OY,method:A(`node.pairing.preview`)}),NY=N(OY),PY=N({code:k(DY),expiresAt:k(K),method:A(`node.pairing.confirm`),pairingId:J,receiptId:J,replayed:M,revision:q,role:TY,state:I([`pending`,`revoked`])}),FY=N({clientId:J,commandId:J}),IY=N({clientId:J,credential:k(DY),expiresAt:K,method:A(`node.pairing.redeem`),pairingId:J,receiptId:J,replayed:M,role:TY}),LY=F([N({method:A(`node.pairing.show`),parameters:N({})}),N({method:A(`node.pairing.preview`),parameters:jY}),N({method:A(`node.pairing.confirm`),parameters:NY}),N({method:A(`node.pairing.redeem`),parameters:FY})]),RY=F([AY,MY,PY,IY]);G(jY);var zY=G(MY);G(NY);var BY=G(PY);G(FY);var VY=G(IY),HY=G(AY),UY=`maia.port-lease/v1`,WY=V.check(B({maximum:65535,minimum:1024})),GY=j.check(R(/^[a-z0-9][a-z0-9._-]{0,63}$/u)),KY=q.check(R(/^[1-9]\d*$/u)),qY=I([`active`,`expired`,`released`]),JY=I([`owner_missing`,`owner_released`,`session_ended`,`ttl_expired`]),YY=F([N({kind:A(`session`),sessionId:J}),N({kind:A(`principal`),principalId:J})]),XY=P(WY).check(U(1,8),L(e=>new Set(e).size===e.length,{expected:`unique ports`})),ZY=e=>e.state===`active`?e.endReason===void 0:e.state===`expired`?e.endReason===`ttl_expired`:e.endReason!==void 0&&e.endReason!==`ttl_expired`,QY=N({endReason:k(JY),expiresAt:K,grantedAt:K,leaseId:J,owner:YY,ports:XY,purpose:GY,revision:KY,schemaVersion:A(UY),state:qY,updatedAt:K}).check(L(e=>ZY(e)&&Date.parse(e.expiresAt)>Date.parse(e.grantedAt)&&Date.parse(e.updatedAt)>=Date.parse(e.grantedAt),{expected:`a consistent port lease lifecycle`})),$Y=N({commandId:J,count:k(V.check(B({maximum:8,minimum:1}))),preferred:k(WY),purpose:GY,sessionId:k(J)}),eX=N({commandId:J,expectedRevision:KY,leaseId:J}),tX=N({commandId:J,leaseId:J}),nX=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),sessionId:k(J)}),rX=F([N({method:A(`port.lease.acquire`),parameters:$Y}),N({method:A(`port.lease.list`),parameters:nX}),N({method:A(`port.lease.release`),parameters:tX}),N({method:A(`port.lease.renew`),parameters:eX})]),iX={commandId:J,delivery:I([`duplicate`,`new`]),lease:QY,receipt:Y},aX=N({...iX,method:A(`port.lease.acquire`)}),oX=N({...iX,expectedRevision:KY,method:A(`port.lease.renew`)}),sX=N({...iX,method:A(`port.lease.release`)}),cX=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`port_lease`&&e.receipt.target.id===e.lease.leaseId&&e.receipt.aggregateRevision===e.lease.revision,lX=aX.check(L(e=>cX(e)&&e.lease.revision===`1`&&e.lease.state===`active`,{expected:`a new active lease bound to its receipt`})),uX=oX.check(L(e=>cX(e)&&e.lease.state===`active`&&BigInt(e.lease.revision)===BigInt(e.expectedRevision)+1n,{expected:`an active lease advanced by one revision`})),dX=sX.check(L(e=>cX(e)&&e.lease.state!==`active`,{expected:`an ended lease bound to its receipt`})),fX=N({lease:QY,probes:P(N({inUse:M,port:WY}))}).check(L(e=>e.lease.state===`active`&&e.probes.map(e=>e.port).join(`,`)===e.lease.ports.join(`,`),{expected:`one probe per port of an active lease`})),pX=N({end:WY,start:WY}).check(L(e=>e.start<=e.end,{expected:`an ascending port range`})),mX=N({items:P(fX).check(H(100)),method:A(`port.lease.list`),nextCursor:k(J),range:pX}).check(L(e=>new Set(e.items.map(e=>e.lease.leaseId)).size===e.items.length&&(e.nextCursor===void 0||e.items.length>0),{expected:`unique leases and a cursor only after items`})),hX=F([lX,mX,dX,uX]);G(QY),G(YY),G($Y),G(eX),G(tX),G(nX);var gX=G(lX),_X=G(uX),vX=G(dX),yX=G(mX),bX=`maia.presentation.portfolio/v3`,xX=`sha256:59860e3f18670e2692319fcc23b8c65cb38177aef85d8cfcdfd532d64d327824`,SX=j.check(R(/^[1-9][0-9]{0,19}$/u)),CX=J.check(R(/^container_[A-Za-z0-9_-]+$/u)),wX=N({elements:Oy(j,F([N({children:P(j.check(R(/^(projects|project_[0-9]{1,3})$/u))).check(H(100)),props:N({containerId:CX,revision:SX}),type:A(`ProjectList`)}),N({children:Ay([]),props:N({projectId:J,revision:SX}),type:A(`ProjectReference`)})])),root:A(`projects`)}).check(L(e=>{let t=e.elements.projects;if(t?.type!==`ProjectList`)return!1;let n=Object.entries(e.elements);return n.length<=101&&n.length===t.children.length+1&&t.children.every((t,n)=>t===`project_${String(n)}`&&e.elements[t]?.type===`ProjectReference`)})),TX={catalogDigest:A(xX),catalogVersion:A(bX),generation:V.check(B({maximum:2147483647,minimum:0})),viewId:J},EX=N({...TX,page:EN}),DX=N({...TX,authority:A(`operator-local`),membershipCursor:k(J),method:A(`presentation.project-list.show`),nodeInstanceId:J,releaseQualified:A(!1),resources:ON,spec:wX}).check(L(e=>{let t=e.spec.elements.projects;return t?.type!==`ProjectList`||t.props.containerId!==e.resources.container.id||t.props.revision!==e.resources.container.revision||t.children.length!==e.resources.projects.length?!1:e.resources.projects.every((t,n)=>{let r=e.spec.elements[`project_${String(n)}`];return r?.type===`ProjectReference`&&r.props.projectId===t.id&&r.props.revision===t.revision})}),L(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=131072)),OX=q.check(R(/^[1-9][0-9]*$/u)),kX={containerId:J.check(R(/^container_[A-Za-z0-9_-]+$/u)),containerRevision:OX,projectId:J,projectRevision:OX},AX=N({...kX,membershipCursor:k(J)}),jX={catalogDigest:A(xX),catalogVersion:A(bX),generation:V.check(B({maximum:2147483647,minimum:0})),target:AX,viewId:J},MX=N({elements:Oy(j,F([N({children:P(j.check(R(/^(sessions|session_[0-9]{1,3})$/u))).check(H(100)),props:N(kX),type:A(`SessionList`)}),N({children:Ay([]),props:N({revision:OX,sessionId:J}),type:A(`SessionReference`)})])),root:A(`sessions`)}).check(L(e=>{let t=e.elements.sessions;return t?.type===`SessionList`&&Object.keys(e.elements).length===t.children.length+1&&t.children.every((t,n)=>t===`session_${String(n)}`&&e.elements[t]?.type===`SessionReference`)})),NX=N({items:P(pN).check(H(100)),observedAt:mN.fields.observedAt,stallAfterSeconds:mN.fields.stallAfterSeconds}),PX=N({...jX,page:N({...lR.fields,limit:IL})}).check(L(e=>e.page.projectId===e.target.projectId&&e.page.attention===void 0&&e.page.states===void 0)),FX=N({...jX,authority:A(`operator-local`),method:A(`presentation.session-list.show`),nodeInstanceId:J,observations:NX,releaseQualified:A(!1),resources:Tz,spec:MX}).check(L(e=>{let t=e.spec.elements.sessions;return t?.type!==`SessionList`||t.props.containerId!==e.target.containerId||t.props.containerRevision!==e.target.containerRevision||t.props.projectId!==e.target.projectId||t.props.projectRevision!==e.target.projectRevision||t.children.length!==e.resources.items.length||new Set(e.resources.items.map(e=>e.id)).size!==e.resources.items.length?!1:e.resources.items.every((t,n)=>{let r=e.spec.elements[`session_${String(n)}`];return t.projectId===e.target.projectId&&r?.type===`SessionReference`&&r.props.sessionId===t.id&&r.props.revision===t.revision})}),L(e=>e.observations.items.length===e.resources.items.length&&e.observations.items.every((t,n)=>t.sessionId===e.resources.items[n]?.id)),L(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=131072)),IX=A(bX),LX=A(xX),RX=Oy(j,by),zX=V.check(B({maximum:2147483647,minimum:0})),BX=j.check(R(/^(directory|workspace_[0-9]{1,3})$/u)),VX=N({containerId:J.check(R(/^container_[A-Za-z0-9_-]+$/u)),revision:j.check(R(/^[1-9][0-9]{0,19}$/u))}),HX=N({elements:Oy(j,F([N({children:P(BX).check(H(100)),props:RX,type:A(`WorkspaceDirectory`)}),N({children:Ay([]),props:VX,type:A(`WorkspaceReference`)})])),root:A(`directory`)}).check(L(e=>{let t=Object.entries(e.elements),n=e.elements.directory;return t.length>101||n?.type!==`WorkspaceDirectory`||new Set(n.children).size!==n.children.length||t.length!==n.children.length+1?!1:n.children.every((t,n)=>t===`workspace_${String(n)}`&&e.elements[t]?.type===`WorkspaceReference`)})),UX=RX,WX=N({actions:Ay([]),authority:A(`operator-local`),catalogDigest:LX,catalogVersion:IX,components:Ay([A(`WorkspaceDirectory`),A(`WorkspaceReference`),A(`ProjectList`),A(`ProjectReference`),A(`SessionList`),A(`SessionReference`)]),method:A(`presentation.catalog.show`),releaseQualified:A(!1)}),GX=N({catalogDigest:LX,catalogVersion:IX,generation:zX,page:TN,viewId:J}),KX=N({authority:A(`operator-local`),catalogDigest:LX,catalogVersion:IX,generation:zX,method:A(`presentation.workspace-directory.show`),nodeInstanceId:J,releaseQualified:A(!1),resources:DN,spec:HX,viewId:J}).check(L(e=>{let t=e.spec.elements.directory;return t?.type!==`WorkspaceDirectory`||t.children.length!==e.resources.items.length?!1:e.resources.items.every((t,n)=>{let r=e.spec.elements[`workspace_${String(n)}`];return r?.type===`WorkspaceReference`&&r.props.containerId===t.id&&r.props.revision===t.revision})}),L(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=131072)),qX=F([N({method:A(`presentation.session-list.show`),parameters:PX}),N({method:A(`presentation.project-list.show`),parameters:EX}),N({method:A(`presentation.catalog.show`),parameters:UX}),N({method:A(`presentation.workspace-directory.show`),parameters:GX})]),JX=F([FX,DX,WX,KX]),YX=G(PX),XX=G(FX);G(MX);var ZX=G(EX),QX=G(DX);G(wX),G(UX);var $X=G(WX),eZ=G(GX),tZ=G(KX);G(HX);var nZ=I([`operator`,`reader`]),rZ=j.check(R(/^[a-z][a-z0-9-]{0,31}$/u)),iZ=F([N({kind:A(`create`),name:rZ,role:nZ}),N({kind:A(`revoke`),principalId:J})]),aZ=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),oZ={change:iZ,commandId:J,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K},sZ=N({createdAt:K,kind:A(`bot`),name:rZ,principalId:J,revokedAt:k(K),role:nZ,state:I([`active`,`revoked`])}),cZ=N({method:A(`node.principal.show`),principals:P(sZ).check(H(100))}),lZ=N({change:iZ,commandId:J}),uZ=N({...oZ,method:A(`node.principal.preview`)}),dZ=N(oZ),fZ=N({method:A(`node.principal.confirm`),name:rZ,principalId:J,receiptId:J,replayed:M,revision:q,role:nZ,state:I([`active`,`revoked`]),token:k(aZ)}),pZ=F([N({method:A(`node.principal.show`),parameters:N({})}),N({method:A(`node.principal.preview`),parameters:lZ}),N({method:A(`node.principal.confirm`),parameters:dZ})]),mZ=F([cZ,uZ,fZ]),hZ=N({confirmation:N({by:A(`person`),itemId:rG}),operation:uG,preview:N(lG),principalId:J,status:A(`confirmation_required`)});G(lZ);var gZ=G(uZ);G(dZ);var _Z=G(fZ),vZ=G(cZ);G(hZ);var yZ=`maia.provider/v1`,bZ=j.check(U(1,128),R(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),xZ=j.check(U(1,256),R(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u)),SZ=V.check(z(0),Ry(32)),CZ=N({availableCredentialCount:SZ,credentialCount:SZ,default:M,model:xZ,poolId:bZ,providerId:bZ}),wZ=N({method:A(`provider.pool.list`),pools:P(CZ).check(H(16)),releaseQualified:A(!1),schemaVersion:A(yZ)}),TZ=e=>new TextEncoder().encode(JSON.stringify(e)).byteLength,EZ=wZ.check(L(e=>{let t=e.pools.map(e=>e.poolId);return new Set(t).size===t.length&&e.pools.filter(e=>e.default).length<=1&&e.pools.every(e=>e.availableCredentialCount<=e.credentialCount)&&TZ(e)<=16384},{expected:`a bounded provider pool list with unique pool IDs, valid counts, and at most one default`})),DZ=Oy(j,by),OZ=N({method:A(`provider.pool.list`),parameters:DZ});G(CZ),G(DZ);var kZ=G(EZ),AZ=/^(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})\.(0|[1-9]\d{0,2})$/u,jZ=1024,MZ=65535,NZ=e=>e.reduce((e,t)=>e*256+Number(t),0),PZ=[[`10.0.0.0`,8],[`100.64.0.0`,10],[`127.0.0.0`,8],[`172.16.0.0`,12],[`192.168.0.0`,16]].map(([e,t])=>({base:NZ(e.split(`.`)),size:2**(32-t)})),FZ=e=>{let t=AZ.exec(e)?.slice(1);if(t===void 0||t.some(e=>Number(e)>255))return!1;let n=NZ(t);return PZ.some(({base:e,size:t})=>n>=e&&n<e+t)},IZ=e=>FZ(e.address)&&Number.isInteger(e.port)&&e.port>=jZ&&e.port<=MZ,LZ=N({address:j.check(R(/^\d{1,3}(?:\.\d{1,3}){3}$/u)),port:V.check(B({maximum:65535,minimum:1024}))}),RZ=N({bind:k(LZ)}),zZ={code:k(j),state:I([`failed`,`listening`,`off`])},BZ={change:RZ,commandId:J,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K},VZ=N({}),HZ=N({...zZ,bind:k(LZ),method:A(`node.reach.show`),revision:q}),UZ=N({change:RZ,commandId:J}),WZ=N({...BZ,method:A(`node.reach.preview`),transport:k(A(`cleartext-http`))}),GZ=N(BZ),KZ=N({applied:N(zZ),bind:k(LZ),method:A(`node.reach.confirm`),receiptId:J,replayed:M,revision:q}),qZ=F([N({method:A(`node.reach.show`),parameters:VZ}),N({method:A(`node.reach.preview`),parameters:UZ}),N({method:A(`node.reach.confirm`),parameters:GZ})]),JZ=F([HZ,WZ,KZ]);G(UZ);var YZ=G(WZ);G(GZ);var XZ=G(KZ),ZZ=G(HZ),QZ=[`connection`,`container`,`project`,`session`,`workspace`],$Z=[`project`,`workspace`],eQ=new TextEncoder,tQ=I(QZ),nQ=j.check(U(1,256),L(e=>!tS(e),{expected:`a one-line reference`})),rQ=j.check(L(e=>e.startsWith(`/`)&&!tS(e)&&eQ.encode(e).byteLength<=4096,{expected:`an absolute path of at most 4096 bytes`})),iQ=new Set($Z),aQ=new Set([`session`,`workspace`]),oQ=N({kind:tQ,path:k(rQ),projectId:k(J),reference:k(nQ)}).check(L(e=>e.reference===void 0?iQ.has(e.kind)&&e.projectId===void 0:e.path===void 0&&(e.projectId===void 0||aQ.has(e.kind)),{expected:`a reference (narrowed to a Project only for a session or workspace), or no reference and an optional path for a project or workspace`})),sQ=j.check(U(1,256)),cQ=N({id:J,label:k(sQ)}),lQ=I([`id`,`prefix`,`name`,`path`,`selection`]),uQ=F([N({id:J,kind:tQ,label:k(sQ),match:lQ,method:A(`reference.resolve`),outcome:A(`resolved`),projectId:k(J)}),N({candidates:P(cQ).check(By(2),H(8)),kind:tQ,method:A(`reference.resolve`),outcome:A(`ambiguous`)})]),dQ=N({method:A(`reference.resolve`),parameters:oQ}),fQ=uQ,pQ=G;pQ(oj),pQ(sj),pQ(cj),pQ(lj),pQ(dj),pQ(sA);var mQ=pQ(gj);pQ(cA);var hQ=pQ(xj);pQ(fj),pQ(uA);var gQ=pQ(_j);pQ(dA);var _Q=pQ(bj);pQ(lA);var vQ=pQ(Sj);pQ(fA);var yQ=pQ(Cj);pQ(pA);var bQ=pQ(wj);pQ(Gk),pQ(Mie),pQ(Fie);var xQ=`maia.routine/v1`,SQ=527040,CQ=1024,wQ=[`agent_disabled`,`connection_disabled`,`held`,`home_session_unavailable`,`launch_failed`,`outcome_unknown`,`overlap`,`precheck_failed`,`precheck_skipped`,`precheck_timeout`,`precheck_unconfirmed`,`routine_not_active`,`saturated`,`workspace_unavailable`],TQ=`maia.routine-trigger/v1`,EQ=J.check(R(/^routine_[a-f0-9]{32}$/u)),DQ=J.check(R(/^fire_[a-f0-9]{32}$/u)),OQ=q.check(R(/^[1-9]\d*$/u)),kQ=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),AQ=j.check(R(/^sha256:[a-f0-9]{64}$/u)),jQ=j.check(R(/^[0-9A-Za-z*/,-]{1,64}(?: [0-9A-Za-z*/,-]{1,64}){4}$/u)),MQ=j.check(R(/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/u),H(64)),NQ=K.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u)),PQ=N({expression:jQ,timezone:MQ}),FQ=N({at:NQ}),IQ=N({everyMinutes:V.check(B({maximum:SQ,minimum:1})),startsAt:NQ}),LQ=N({event:sk}),RQ=F([PQ,LQ,FQ,IQ]),zQ=N({agentId:k(fS),connectionId:k(J),executor:k(lN),mode:k(I([`new`,`continue`])),model:k(wS),projectId:J,prompt:Qj}).check(L(e=>e.agentId===void 0?e.mode!==`continue`&&(e.connectionId!==void 0||e.executor!==void 0)&&(e.model===void 0||e.connectionId!==void 0):e.connectionId===void 0&&e.executor===void 0&&e.model===void 0,{expected:`an Agent alone, or an executor or a Connection for the Session, a model only with a Connection, and the continue mode only with an Agent`})),BQ=N({command:P(j.check(By(1),H(CQ))).check(By(1),H(32)),timeoutSeconds:V.check(B({maximum:300,minimum:1}))}),VQ=I([`active`,`disabled`,`paused`]),HQ=N({confirmedBy:J,createdAt:K,id:EQ,name:nS,nextFireAt:k(K),precheck:k(N({...BQ.fields,digest:AQ})),revision:OQ,schedule:RQ,schemaVersion:A(xQ),state:VQ,template:zQ,updatedAt:K}).check(L(e=>(e.state===`active`&&!(`event`in e.schedule))==(e.nextFireAt!==void 0)&&!(e.precheck!==void 0&&`event`in e.schedule)&&Date.parse(e.createdAt)<=Date.parse(e.updatedAt),{expected:`a next fire exactly while a time-scheduled routine is active, and none and no precheck for an event routine`})),UQ=e=>e===`overlap`||e===`precheck_skipped`,WQ=N({eventId:k(ok),failure:k(uS),failureReason:k(hM),id:DQ,missed:k(V.check(z(1))),outcome:I([`failed`,`launching`,`skipped`,`started`]),reason:k(I(wQ)),recordedAt:K,routineId:EQ,scheduledAt:K,sessionId:k(J),triggerKind:I([`cron`,`event`,`manual`,`webhook`]),turnId:k(J),turnState:k(I([`completed`,`dispatching`,`failed`,`interrupted`,`outcome-unknown`,`queued`,`running`]))}).check(L(e=>{if((e.triggerKind===`manual`||e.triggerKind===`webhook`)&&e.missed!==void 0||e.triggerKind===`event`!=(e.eventId!==void 0))return!1;switch(e.outcome){case`launching`:return e.reason===void 0&&e.turnId===void 0;case`started`:return e.reason===void 0&&e.sessionId!==void 0&&e.turnId!==void 0;case`skipped`:return UQ(e.reason)&&e.sessionId===void 0;case`failed`:return e.reason!==void 0&&!UQ(e.reason)}},{expected:`a fire whose outcome matches its reason, Session and turn`})),GQ=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),projectId:k(J),state:k(VQ)}),KQ=N({items:P(HQ).check(H(100)),method:A(`routine.list`),nextCursor:k(J)}),qQ=N({routineId:EQ}),JQ=N({fires:P(WQ).check(H(20)),method:A(`routine.show`),routine:HQ}),YQ=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),routineId:k(EQ)}),XQ=N({items:P(WQ).check(H(100)),method:A(`routine.runs`),nextCursor:k(J)}),ZQ={commandId:J,name:nS,paused:k(M),precheck:k(BQ),schedule:RQ,template:zQ},QQ={inputDigest:AQ,proof:kQ},$Q=N(ZQ),e$=N({...ZQ,...QQ}),t$={...QQ,actorId:J,expiresAt:K,issuedAt:K},n$=L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),{expected:`a preview that expires after it was issued`}),r$=N({...ZQ,...t$,method:A(`routine.create.preview`),nextFires:P(K).check(H(3)),precheckDigest:k(AQ),routineId:EQ}).check(n$,L(e=>e.precheck===void 0==(e.precheckDigest===void 0),{expected:`a precheck digest exactly when the routine has a precheck`}),L(e=>`event`in e.schedule==(e.nextFires.length===0),{expected:`one to three next fires for a time schedule and none for an event schedule`})),i$=e=>e.receipt.target.type===`routine`&&e.receipt.target.id===e.routine.id&&e.receipt.aggregateRevision===e.routine.revision,a$=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:AQ,method:A(`routine.create.confirm`),receipt:Y,routine:HQ}).check(L(e=>i$(e)&&e.receipt.method===e.method&&e.routine.revision===`1`,{expected:`a created routine matching its receipt`})),o$={commandId:J,expectedRevision:OQ,routineId:EQ},s$=N(o$),c$=s$,l$=N({...o$,...QQ}),u$=l$,d$=e=>N({...o$,...t$,method:A(e),name:nS}).check(n$),f$=d$(`routine.disable.preview`),p$=d$(`routine.run.preview`),m$=(e,t)=>N({delivery:I([`new`,`duplicate`]),method:A(e),receipt:Y,routine:HQ}).check(L(n=>i$(n)&&n.receipt.method===e&&n.routine.state===t,{expected:`a ${t} routine matching its receipt`})),h$=m$(`routine.pause`,`paused`),g$=m$(`routine.resume`,`active`),_$=m$(`routine.disable.confirm`,`disabled`),v$=N({delivery:I([`new`,`duplicate`]),fire:WQ,method:A(`routine.run.confirm`),receipt:Y}).check(L(({fire:e,receipt:t})=>e.triggerKind===`manual`&&e.outcome===`launching`&&t.method===`routine.run.confirm`&&t.target.type===`routine_fire`&&t.target.id===e.id,{expected:`a launching manual fire matching its receipt`})),y$={...o$,agentId:k(fS),prompt:k(Qj),schedule:k(RQ)},b$=[`agentId`,`prompt`,`schedule`],x$=L(e=>b$.some(t=>e[t]!==void 0),{expected:`at least one of a prompt, a schedule and an Agent`}),S$=N(y$).check(x$),C$=N({...y$,...QQ}).check(x$),w$=N({...y$,...t$,changes:N({agentId:k(N({after:fS,before:fS})),prompt:k(N({after:Qj,before:Qj})),schedule:k(N({after:RQ,before:RQ,nextFireAt:k(K)}))}),method:A(`routine.update.preview`),name:nS}).check(n$,L(e=>b$.every(t=>e[t]===void 0==(e.changes[t]===void 0)),{expected:`one change for each field the update names, and no other`})),T$=N({changed:P(I(b$)).check(By(1),H(b$.length)),delivery:I([`new`,`duplicate`]),method:A(`routine.update.confirm`),receipt:Y,routine:HQ}).check(L(e=>i$(e)&&e.receipt.method===e.method,{expected:`an updated routine matching its receipt`})),E$={...o$,projectId:J},D$=N(E$),O$=N({...E$,...QQ}),k$=N({...E$,...t$,fromProjectId:J,method:A(`routine.move.preview`),moves:N({fires:V.check(z(0)),triggers:V.check(z(0))}),name:nS}).check(n$,L(e=>e.fromProjectId!==e.projectId,{expected:`a destination Project other than the routine's own`})),A$=N({delivery:I([`new`,`duplicate`]),fromProjectId:J,method:A(`routine.move.confirm`),receipt:Y,routine:HQ}).check(L(e=>i$(e)&&e.receipt.method===e.method&&e.routine.template.projectId!==e.fromProjectId,{expected:`a routine moved to another Project, matching its receipt`})),j$=J.check(R(/^trigger_[a-f0-9]{32}$/u)),M$=N({equals:F([j.check(H(128)),V,M]),path:j.check(R(/^[A-Za-z0-9_-]{1,32}(?:\.[A-Za-z0-9_-]{1,32}){0,3}$/u))}),N$=P(M$).check(H(8)),P$=V.check(B({maximum:60,minimum:1})),F$=N({confirmedBy:J,createdAt:K,filters:N$,id:j$,ratePerMinute:P$,revision:OQ,routineId:EQ,schemaVersion:A(TQ),state:I([`active`,`disabled`]),updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt),{expected:`a trigger not updated before it was created`})),I$=N({routineId:EQ}),L$=N({method:A(`routine.trigger.list`),triggers:P(F$).check(H(32))}),R$={commandId:J,filters:N$,ratePerMinute:P$,routineId:EQ},z$=N(R$),B$=N({...R$,...QQ,signingSecret:j.check(R(/^[!-~]{32,256}$/u))}),V$=N({...R$,...t$,method:A(`routine.trigger.create.preview`),triggerId:j$}).check(n$),H$=e=>e.receipt.target.type===`routine_trigger`&&e.receipt.target.id===e.trigger.id&&e.receipt.aggregateRevision===e.trigger.revision,U$=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:AQ,method:A(`routine.trigger.create.confirm`),receipt:Y,trigger:F$}).check(L(e=>H$(e)&&e.receipt.method===e.method&&e.trigger.revision===`1`&&e.trigger.state===`active`,{expected:`a created trigger matching its receipt`})),W$=N({commandId:J,expectedRevision:OQ,triggerId:j$}),G$=N({delivery:I([`new`,`duplicate`]),method:A(`routine.trigger.disable`),receipt:Y,trigger:F$}).check(L(e=>H$(e)&&e.receipt.method===e.method&&e.trigger.state===`disabled`,{expected:`a disabled trigger matching its receipt`})),K$=F([N({method:A(`routine.list`),parameters:GQ}),N({method:A(`routine.show`),parameters:qQ}),N({method:A(`routine.runs`),parameters:YQ}),N({method:A(`routine.create.preview`),parameters:$Q}),N({method:A(`routine.create.confirm`),parameters:e$}),N({method:A(`routine.pause`),parameters:s$}),N({method:A(`routine.resume`),parameters:s$}),N({method:A(`routine.disable.preview`),parameters:c$}),N({method:A(`routine.disable.confirm`),parameters:l$}),N({method:A(`routine.run.preview`),parameters:s$}),N({method:A(`routine.run.confirm`),parameters:u$}),N({method:A(`routine.update.preview`),parameters:S$}),N({method:A(`routine.update.confirm`),parameters:C$}),N({method:A(`routine.move.preview`),parameters:D$}),N({method:A(`routine.move.confirm`),parameters:O$}),N({method:A(`routine.trigger.list`),parameters:I$}),N({method:A(`routine.trigger.create.preview`),parameters:z$}),N({method:A(`routine.trigger.create.confirm`),parameters:B$}),N({method:A(`routine.trigger.disable`),parameters:W$})]),q$=F([KQ,JQ,XQ,r$,a$,h$,g$,f$,_$,p$,v$,w$,T$,k$,A$,L$,V$,U$,G$]);G(HQ),G(WQ),G(RQ),G(PQ),G(LQ),G(FQ),G(IQ),G(zQ),G(GQ);var J$=G(KQ);G(qQ);var Y$=G(JQ);G(YQ);var X$=G(XQ);G($Q);var Z$=G(r$);G(e$);var Q$=G(a$);G(s$);var $$=G(h$),e1=G(g$);G(c$);var t1=G(f$);G(l$);var n1=G(_$),r1=G(p$);G(u$);var i1=G(v$);G(S$);var a1=G(w$);G(C$);var o1=G(T$);G(D$);var Zle=G(k$);G(O$);var Qle=G(A$);G(F$),G(M$),G(I$);var $le=G(L$);G(z$);var eue=G(V$);G(B$);var tue=G(U$);G(W$);var nue=G(G$),s1=`maia.run-ledger/v1`,rue=new TextEncoder,c1=q.check(R(/^[1-9]\d*$/u)),iue=V.check(B({maximum:3,minimum:1})),l1=V.check(B({maximum:32,minimum:0})),u1=j.check(L(e=>{let t=rue.encode(e).byteLength;return t>=1&&t<=8192&&!e.includes(`\0`)},{expected:`evidence encoded as 1 to 8192 UTF-8 bytes without NUL`})),aue=I([`blocked`,`ready`,`active`,`succeeded`,`stopped`]),oue=I([`succeeded`,`failed`]),sue=I([`active`,`succeeded`,`failed`]),d1={createdAt:K,id:J,ordinal:iue,sessionId:J,settledTurnId:k(J),state:sue,turnId:J,updatedAt:K},f1=e=>e.state===`active`?e.settledTurnId===void 0&&e.evidence===void 0:e.settledTurnId!==void 0,p1=N(d1).check(L(f1,{expected:`a settled dispatch that names its settled turn`})),m1=N({...d1,evidence:k(u1)}).check(L(e=>f1(e)&&e.state===`active`==(e.evidence===void 0),{expected:`a settled dispatch with its turn and evidence`})),cue=e=>e.every((t,n)=>t.ordinal===n+1&&(t.state===`failed`||n===e.length-1)),lue=e=>{let t=e.dispatches.at(-1),n=e.dispatches.filter(e=>e.state===`failed`).length;return n!==e.failedDispatches||!cue(e.dispatches)?!1:t?.state===`active`?e.state===`active`:t?.state===`succeeded`?e.state===`succeeded`:n===3?e.state===`stopped`:e.state===`blocked`||e.state===`ready`},h1={clientKey:vT.fields.clientKey,createdAt:K,dependencyTaskIds:P(J).check(H(8)),failedDispatches:V.check(B({maximum:3,minimum:0})),id:J,revision:c1,runId:J,schemaVersion:A(s1),state:aue,updatedAt:K},g1=L(lue,{expected:`a Task whose state matches its dispatches`}),_1=N({...h1,dispatches:P(p1).check(H(3))}).check(g1),v1=N({...h1,dispatches:P(m1).check(H(3)),objective:vT.fields.objective}).check(g1),uue=N({active:l1,blocked:l1,ready:l1,stopped:l1,succeeded:l1}),y1=N({createdAt:K,id:J,schemaVersion:A(s1),state:I([`open`,`blocked`,`succeeded`]),taskCounts:uue,workspaceId:J}).check(L(e=>{let{active:t,blocked:n,ready:r,stopped:i,succeeded:a}=e.taskCounts,o=t+n+r+i+a;return o<1||o>32?!1:a===o?e.state===`succeeded`:r===0&&t===0?e.state===`blocked`:e.state===`open`},{expected:`a Run state that matches its Task counts`})),b1=N({commandId:J,tasks:P(vT).check(U(1,32),L(aT,{expected:`an acyclic Task graph of unique keys within the orchestration bounds`})),workspaceId:J}),x1=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),workspaceId:J}),S1=N({ready:k(A(!0)),runId:J}),C1=N({runId:J,taskId:J}),w1=N({commandId:J,expectedSessionRevision:c1,expectedTaskRevision:c1,runId:J,sessionId:J,taskId:J}),T1=N({commandId:J,evidence:u1,expectedTaskRevision:c1,outcome:oue,runId:J,sessionId:J,taskId:J,turnId:k(J)}),due=F([N({method:A(`run.ledger.create`),parameters:b1}),N({method:A(`run.ledger.list`),parameters:x1}),N({method:A(`run.ledger.task.dispatch`),parameters:w1}),N({method:A(`run.ledger.task.list`),parameters:S1}),N({method:A(`run.ledger.task.settle`),parameters:T1}),N({method:A(`run.ledger.task.show`),parameters:C1})]),E1={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y},D1=(e,t,n)=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===t.type&&e.receipt.target.id===t.id&&e.receipt.aggregateRevision===n,O1=(e,t)=>t.every(t=>t.runId===e.id)&&new Set(t.map(e=>e.id)).size===t.length,k1=N({...E1,method:A(`run.ledger.create`),run:y1,tasks:P(_1).check(U(1,32))}).check(L(e=>D1(e,{id:e.run.id,type:`run_ledger`},`1`)&&O1(e.run,e.tasks)&&e.tasks.every(e=>e.revision===`1`&&e.dispatches.length===0),{expected:`a new Run with undispatched Tasks bound to its receipt`})),A1=N({items:P(y1).check(H(100)),method:A(`run.ledger.list`),nextCursor:k(J)}).check(L(e=>new Set(e.items.map(e=>e.workspaceId)).size<=1&&(e.nextCursor===void 0||e.items.length>0),{expected:`Runs of one Workspace and a cursor only after items`})),j1=N({items:P(_1).check(H(32)),method:A(`run.ledger.task.list`),run:y1}).check(L(e=>O1(e.run,e.items),{expected:`Tasks of the listed Run`})),M1=N({method:A(`run.ledger.task.show`),task:v1}),N1=N({...E1,dispatch:p1,method:A(`run.ledger.task.dispatch`),task:_1,turn:gM}).check(L(e=>D1(e,{id:e.task.id,type:`run_ledger_task`},e.task.revision)&&e.task.state===`active`&&e.task.dispatches.at(-1)?.id===e.dispatch.id&&e.dispatch.state===`active`&&e.dispatch.turnId===e.turn.id&&e.dispatch.sessionId===e.turn.sessionId,{expected:`an active dispatch whose turn and receipt match its Task`})),P1=N({...E1,method:A(`run.ledger.task.settle`),task:v1}).check(L(e=>D1(e,{id:e.task.id,type:`run_ledger_task`},e.task.revision)&&e.task.dispatches.at(-1)?.state!==`active`,{expected:`a settled dispatch bound to its Task receipt`})),fue=F([k1,A1,N1,j1,P1,M1]),F1=G;F1(y1),F1(_1),F1(v1),F1(p1),F1(m1),F1(b1),F1(x1),F1(S1),F1(C1),F1(w1),F1(T1);var pue=F1(k1),mue=F1(A1),hue=F1(j1),gue=F1(M1),_ue=F1(N1),vue=F1(P1),I1=j.check(U(5,64),R(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/u)),L1=V.check(z(0),Ry(5e3)),R1=N({family:j.check(U(1,32)),os:j.check(U(1,32))}),yue=N({adapter:A(`codex-app-server`),method:A(`runtime.probe`),runtime:A(`codex`),schemaVersion:A(1),transport:A(`stdio-jsonl`),executableVersion:k(I1),handshakeMilliseconds:k(L1),platform:k(R1),reason:k(I([`executable_not_found`,`handshake_failed`,`platform_unsupported`,`protocol_invalid`,`unsupported_version`])),status:I([`incompatible`,`ready`,`unavailable`])}).pipe(Ny(e=>{let t=!Object.hasOwn(e,`handshakeMilliseconds`)&&!Object.hasOwn(e,`platform`);switch(e.status){case`unavailable`:return t&&!Object.hasOwn(e,`executableVersion`)&&Object.hasOwn(e,`reason`)&&e.reason===`executable_not_found`;case`incompatible`:return t&&Object.hasOwn(e,`reason`)&&e.reason!==`executable_not_found`;case`ready`:return Object.hasOwn(e,`executableVersion`)&&e.executableVersion!==void 0&&Object.hasOwn(e,`handshakeMilliseconds`)&&e.handshakeMilliseconds!==void 0&&Object.hasOwn(e,`platform`)&&e.platform!==void 0&&!Object.hasOwn(e,`reason`)}},{expected:`a Codex probe result consistent with its status`})),bue={adapter:A(`pi-rpc`),authority:N({modelTurn:A(!1),ownerKind:A(`pi-rpc-probe`),prompt:A(!1),scope:A(`request`),session:A(!1),tools:A(!1),workspace:A(!1)}),method:A(`runtime.probe`),operations:Ay([A(`set_auto_retry`),A(`set_auto_compaction`),A(`get_state`)]),releaseQualified:A(!1),runtime:A(X.pi),schemaVersion:A(1),transport:A(`stdio-jsonl`)},xue=e=>!Object.hasOwn(e,`automaticCompactionEnabled`)&&!Object.hasOwn(e,`automaticRetryEnabled`)&&!Object.hasOwn(e,`handshakeMilliseconds`)&&!Object.hasOwn(e,`platform`),Sue=e=>{let t=xue(e);return e.status===`unavailable`?t&&!Object.hasOwn(e,`executableVersion`)&&Object.hasOwn(e,`reason`)&&(e.reason===`executable_not_found`||e.reason===`integration_not_authorized`):e.status===`incompatible`?t&&Object.hasOwn(e,`reason`)&&e.reason!==`executable_not_found`&&e.reason!==`integration_not_authorized`:e.automaticCompactionEnabled===!1&&e.automaticRetryEnabled===!1&&e.executableVersion!==void 0&&e.handshakeMilliseconds!==void 0&&e.platform!==void 0&&!Object.hasOwn(e,`reason`)},Cue=N({...bue,automaticCompactionEnabled:k(A(!1)),automaticRetryEnabled:k(A(!1)),executableVersion:k(I1),handshakeMilliseconds:k(L1),platform:k(R1),reason:k(I([`automatic_work_disable_failed`,`executable_not_found`,`handshake_failed`,`identity_mismatch`,`integration_not_authorized`,`platform_unsupported`,`protocol_invalid`,`unsupported_version`])),status:I([`incompatible`,`ready`,`unavailable`])}).pipe(Ny(e=>Sue(e),{expected:`a Pi RPC probe result consistent with its status`})),z1=F([N({runtime:A(`codex`)}),N({runtime:A(`pi-rpc`)})]),B1=F([yue,Cue]),wue=N({method:A(`runtime.probe`),parameters:z1});G(z1);var Tue=G(B1),Eue=[`login`,`mcp-servers`,`permissions`,`working-directory`],Due=/^[a-z][a-z0-9-]{0,31}$/u,Oue=new TextEncoder,V1=j.check(R(Due)),kue=j.check(By(1),L(e=>Oue.encode(e).byteLength<=4096&&!tS(e),{expected:`arguments of at most 4096 UTF-8 bytes with no control character`})),Aue=j.check(H(128),R(/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/u)),H1=I([`mutating`,`read-only`]),jue=F([N({class:H1,name:V1}),N({class:A(`refused`),name:V1,operation:k(Aue),reason:I(Eue)})]),Mue=N({sessionId:J}),Nue=N({commands:P(jue).check(H(64)),executor:lN,harnessVersion:k(j.check(U(1,64))),method:A(`session.command.list`),sessionId:J,transport:k(V1)}),U1={arguments:k(kue),command:V1,commandId:J,expectedRevision:q,sessionId:J},W1={...U1,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},Pue=N(U1),Fue=N(U1),Iue=N(W1),Lue=N({...W1,class:H1,method:A(`session.command.preview`)}),G1={delivery:I([`new`,`duplicate`]),receipt:Y,turn:gM},Rue=N({...G1,class:H1,method:A(`session.command.confirm`)}),zue=F([N({...G1,class:A(`read-only`),method:A(`session.command.send`),outcome:A(`sent`)}),N({...W1,class:A(`mutating`),method:A(`session.command.send`),outcome:A(`preview`)})]),Bue=F([N({method:A(`session.command.list`),parameters:Mue}),N({method:A(`session.command.send`),parameters:Pue}),N({method:A(`session.command.preview`),parameters:Fue}),N({method:A(`session.command.confirm`),parameters:Iue})]),Vue=F([Nue,zue,Lue,Rue]),K1={fileBytes:131072,files:192,filesPerSkill:32,setBytes:393216,skills:64},q1=j.check(R(/^[a-z0-9][a-z0-9-]{0,62}$/u)),Hue=j.check(H(96),R(/^[A-Za-z0-9_-][A-Za-z0-9._-]*(?:\/[A-Za-z0-9_-][A-Za-z0-9._-]*){0,3}$/u)),J1=j.check(R(/^sha256:[a-f0-9]{64}$/u)),Y1=N({commit:j.check(R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u))}),Uue=j.check(H(Math.ceil(K1.fileBytes/3)*4)),X1=N({digest:J1,path:Hue}),Z1=N({digest:J1,files:P(X1).check(U(1,K1.filesPerSkill)),name:q1}),Wue=N({digest:J1,skills:P(Z1).check(H(K1.skills)),source:Y1}),Gue=N({...X1.fields,content:Uue}),Kue=N({digest:J1,skills:P(N({...Z1.fields,files:P(Gue).check(U(1,K1.filesPerSkill))})).check(H(K1.skills)),source:Y1}).check(L(e=>{let t=e.skills.flatMap(e=>e.files);return new Set(e.skills.map(e=>e.name)).size===e.skills.length&&e.skills.every(e=>new Set(e.files.map(e=>e.path)).size===e.files.length)&&t.length<=K1.files&&t.reduce((e,t)=>e+t.content.length,0)<=Math.ceil(K1.setBytes/3)*4},{expected:`a set with unique skill names and file paths within the file and size limits`})),Q1=F([N({kind:A(`apply`),set:Kue}),N({kind:A(`rollback`)})]),$1={workspace:q1},que=I([`added`,`edited`,`in_sync`,`missing`]),e0=N($1),t0=N({...$1,method:A(`skills.sync.show`),pin:k(N({...Wue.fields,previousDigest:k(J1)})),revision:q,skills:P(N({localDigest:k(J1),name:q1,pinnedDigest:k(J1),state:que})).check(H(K1.skills*2)),state:I([`drift`,`in_sync`,`unpinned`]),tampered:M}),Jue=N({changes:P(N({action:I([`add`,`remove`,`update`]),name:q1})).check(H(K1.skills*2)),conflicts:P(N({incomingDigest:k(J1),localDigest:k(J1),name:q1,reason:I([`added`,`edited`,`missing`])})).check(H(K1.skills*2)),proposals:P(N({kind:I([`added`,`edited`]),localDigest:J1,name:q1})).check(H(K1.skills*2))}),n0={commandId:J,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K,...$1},r0=N({change:Q1,commandId:J,...$1}),i0=N({...n0,digest:J1,kind:I([`apply`,`rollback`]),method:A(`skills.sync.preview`),plan:Jue}),a0=N({...n0,change:Q1}),o0=N({digest:J1,kind:I([`apply`,`rollback`]),method:A(`skills.sync.confirm`),previousDigest:k(J1),receiptId:J,replayed:M,revision:q,source:Y1,...$1}),Yue=F([N({method:A(`skills.sync.show`),parameters:e0}),N({method:A(`skills.sync.preview`),parameters:r0}),N({method:A(`skills.sync.confirm`),parameters:a0})]),Xue=F([t0,i0,o0]),Zue=G(e0),Que=G(t0);G(r0);var $ue=G(i0);G(a0);var ede=G(o0),s0=`team-workspace.bootstrap.preview`,c0=`team-workspace.bootstrap.apply`,l0=`local-os-profile-owner`,tde=12e4,nde=new TextEncoder,u0=j.check(By(1),L(e=>e.isWellFormed()&&e===e.normalize(`NFC`)&&e===e.trim()&&!tS(e)&&nde.encode(e).byteLength<=160,{expected:`NFC text without control characters or edge whitespace of 1 to 160 UTF-8 bytes`})),d0=j.check(R(/^sha256:[a-f0-9]{64}$/u)),f0=A(1),p0={commandId:J,expectedBootstrapRevision:A(`0`),ownerDisplayName:u0,schemaVersion:f0,workspaceName:u0},m0={clientId:J,deviceId:J,nodeId:J,teamWorkspaceId:J,userId:J},h0=N(p0),g0=N({...p0,inputDigest:d0,previewId:J}),_0=e=>new Set([e.clientId,e.deviceId,e.nodeId,e.previewId,e.teamWorkspaceId,e.userId]).size===6,rde=e=>Date.parse(e.expiresAt)-Date.parse(e.issuedAt)===tde,v0=N({...m0,authoritySource:A(l0),commandId:J,expectedBootstrapRevision:A(`0`),expiresAt:K,inputDigest:d0,issuedAt:K,method:A(s0),nodeEpoch:J,previewId:J,releaseQualified:A(!1),role:A(`owner`),schemaVersion:f0}).check(L(e=>_0(e)&&rde(e),{expected:`six distinct reserved identifiers and a preview that lives two minutes`})),ide=N({...m0,authoritySource:A(l0),bootstrapRevision:A(`1`),commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:d0,method:A(c0),previewId:J,receipt:Y,releaseQualified:A(!1),role:A(`owner`),schemaVersion:f0}),ade=e=>e.receipt.actorId===e.userId&&e.receipt.aggregateRevision===e.bootstrapRevision&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.nodeId&&e.receipt.target.type===`control-node-bootstrap`&&e.receipt.createdAt===e.receipt.updatedAt,y0=ide.check(L(e=>_0(e)&&ade(e),{expected:`six distinct reserved identifiers and the exact Control Node bootstrap receipt`})),ode=F([N({method:A(s0),parameters:h0}),N({method:A(c0),parameters:g0})]),sde=F([v0,y0]);G(h0),G(g0);var cde=G(v0),lde=G(y0),b0=32768,ude=32768,x0=2147483647,S0=2147483647,dde=2147483647,C0=65535,w0=1024,fde=[[`creating`,`running`],[`creating`,`disconnected`],[`running`,`closing`],[`running`,`exited`],[`running`,`disconnected`],[`closing`,`exited`],[`closing`,`disconnected`],[`restarting`,`disconnected`]],T0={from:`creating`,previousCleanup:`pending`,resultingCleanup:`known_identity_members_complete`,to:`exited`},E0={generationOutcomeUnknown:{from:`restarting`,previousCleanup:`known_identity_members_complete`,resultingCleanup:`unknown`,to:`disconnected`},generationStarted:{from:`restarting`,previousCleanup:`known_identity_members_complete`,resultingCleanup:`pending`,to:`running`},stateChanged:[{from:`running`,previousCleanup:`pending`,resultingCleanup:`pending`,to:`restarting`},{from:`exited`,previousCleanup:`known_identity_members_complete`,resultingCleanup:`known_identity_members_complete`,to:`restarting`}]},D0=1e3,O0=3e4,pde=3e4,mde=1e3,hde=3e4,gde=8388608,_de=5e4,vde=786432,yde=`adr-009-local-user-interactive-terminal/v1`,bde=`maia.terminal-session/v1alpha1`,k0=`maia.terminal-observer-event/v1alpha1`,xde=`maia.terminal-mutation/v1alpha1`,Z=(e,t)=>V.check(z(e),Ry(t)),A0={columns:Z(2,500),rows:Z(2,300)},j0={nativeOperationSequence:Z(1,dde)},M0=N(A0),N0=N({assumption:A(`cooperative_unsandboxed_local_user_code_may_include_automation`),hardContainment:A(!1),limits:N({cpuTime:A(`unavailable`),memory:A(`unavailable`),processCount:A(`unavailable`),survivorCleanup:A(`unavailable`),wallTime:A(`cooperative`)}),measurementSources:N({host:A(`process_host`),knownMembers:I([`darwin_descendant_snapshot`,`linux_cgroup`])}),releaseQualified:A(!1),revocationPolicyRevision:A(yde),sourceCandidate:A(!0),tier:A(`local_user_interactive_terminal`)}),P0=N({semantic:A(`known_identity_members`),state:A(`pending`)}),F0=N({semantic:A(`known_identity_members_complete`),state:A(`known_identity_members_complete`),unknownSurvivorExclusion:A(`unavailable`)}),I0=N({reason:I([`cleanup_deadline`,`containment_lost`,`host_failed`,`identity_observation_lost`,`native_acknowledgement_lost`,`node_restarted`]),semantic:A(`known_identity_members`),state:A(`unknown`)}),L0=F([P0,F0,I0]),R0=N({code:k(V.check(z(0),Ry(255))),observedAt:K,signal:k(I([`hangup`,`interrupt`,`kill`,`terminate`,`unknown`]))}),z0={capability:N0,chunkHead:q,createdAt:K,eventHead:q,generation:Z(1,C0),id:J,mutationHead:q,projectId:J,revision:q,schemaVersion:A(bde),updatedAt:K,viewport:M0,workspaceId:J,workspaceRevision:q},B0=e=>N({...z0,cleanup:P0,state:A(e)}),Sde=N({...z0,cleanup:P0,state:A(`closing`)}),Cde=N({...z0,cleanup:F([P0,F0]),state:A(`restarting`)}),wde=N({...z0,cleanup:L0,exit:R0,state:A(`exited`)}),Tde=N({...z0,cleanup:I0,exit:k(R0),state:A(`disconnected`)}),V0=F([B0(`creating`),B0(`running`),Sde,Cde,wde,Tde]),H0=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},U0=e=>new TextEncoder().encode(JSON.stringify(e)).byteLength,W0=(e,t)=>j.check(L(t=>t.length===0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(t)?!1:H0(t)<=e,{expected:t})),G0=W0(ude,`base64 terminal output encoded from at most 32768 bytes`),Ede=W0(b0,`base64 terminal input encoded from at most 32768 bytes`),K0=N({bytesBase64:G0,capability:N0,cursor:q,generation:Z(1,C0),recordedAt:K,schemaVersion:A(k0),terminalId:J}),q0={capability:N0,cursor:q,recordedAt:K,schemaVersion:A(k0),terminalGeneration:Z(1,C0),terminalId:J},Dde=new Set([...fde.map(([e,t])=>`${e}:${t}`),...E0.stateChanged.map(({from:e,to:t})=>`${e}:${t}`)]),Ode=e=>E0.stateChanged.some(t=>e.previousState===t.from&&e.terminal.state===t.to&&e.previousCleanup.state===t.previousCleanup&&e.terminal.cleanup.state===t.resultingCleanup),J0=(e,t)=>e.previousState===t.from&&e.terminal.state===t.to&&e.previousCleanup.state===t.previousCleanup&&e.terminal.cleanup.state===t.resultingCleanup&&e.previousGeneration<65535&&e.terminalGeneration===e.previousGeneration+1,kde=e=>e.terminal.id===e.terminalId&&e.terminal.generation===e.terminalGeneration&&e.terminal.capability.revocationPolicyRevision===e.capability.revocationPolicyRevision&&e.terminal.eventHead===e.cursor&&BigInt(e.terminal.revision)===BigInt(e.previousRevision)+1n,Ade=e=>e.transition===`create-failure-cleanup`&&e.previousState===T0.from&&e.terminal.state===T0.to&&e.terminalGeneration===e.previousGeneration&&e.previousCleanup.state===T0.previousCleanup&&e.terminal.cleanup.state===T0.resultingCleanup,jde=e=>e.transition===`state-changed`&&e.terminalGeneration===e.previousGeneration&&Dde.has(`${e.previousState}:${e.terminal.state}`)&&(e.terminal.state!==`restarting`||Ode(e)),Mde=e=>kde(e)?e.transition===`generation-started`?J0(e,E0.generationStarted):e.transition===`generation-outcome-unknown`?J0(e,E0.generationOutcomeUnknown)&&e.terminal.cleanup.reason===`native_acknowledgement_lost`:Ade(e)||jde(e):!1,Nde=N({...q0,previousCleanup:L0,previousGeneration:Z(1,C0),previousRevision:q,previousState:I([`closing`,`creating`,`disconnected`,`exited`,`restarting`,`running`]),terminal:V0,transition:I([`create-failure-cleanup`,`generation-outcome-unknown`,`generation-started`,`state-changed`]),type:A(`lifecycle-transition`)}).check(L(Mde,{expected:`a lifecycle transition matching its terminal, generation, and prior cleanup`})),Y0=F([N({...q0,bytesBase64:G0,type:A(`output`)}),N({...q0,exit:R0,type:A(`exit`)}),N({...q0,cleanup:L0,type:A(`cleanup`)}),N({...q0,leaseId:J,reason:I([`expired`,`policy`,`released`,`superseded`]),type:A(`controller-revoked`)}),N({...q0,headCursor:q,oldestAvailableCursor:q,reason:I([`backpressure`,`cursor_expired`]),recovery:A(`resync-required`),requestedAfterCursor:k(q),type:A(`gap`)}),Nde]),X0=N({headCursor:q,oldestAvailableCursor:q,retainedBytes:V.check(z(0),Ry(gde)),retainedLines:V.check(z(0),Ry(_de)),tail:P(K0).check(H(256)),terminal:V0}).check(L(e=>e.tail.every(t=>t.terminalId===e.terminal.id)&&e.tail.reduce((e,t)=>e+H0(t.bytesBase64),0)<=524288&&U0(e)<=524288,{expected:`a terminal observer snapshot within its response byte cap`})),Z0={capability:N0,expiresAt:K,id:J,requestedAt:K,terminalGeneration:Z(1,C0),terminalId:J},Q0=F([N({...Z0,position:Z(1,8),state:A(`pending`)}),N({...Z0,state:A(`ready`)}),N({...Z0,reason:I([`expired`,`policy`,`queue_saturated`]),state:A(`denied`)})]),$0={capability:N0,epoch:q,expiresAt:K,id:J,revision:q,terminalGeneration:Z(1,C0),terminalId:J},e2=F([N({...$0,state:A(`active`)}),N({...$0,state:I([`expired`,`released`,`revoked`])})]),t2={commandId:J},n2={terminalId:J},r2={expectedTerminalRevision:q},Pde={controller:N({epoch:q,expiresAt:K,id:J,revision:q,terminalGeneration:Z(1,C0),terminalId:J})},Fde=N({argv:P(j.check(R(/^[^\0]*$/u),L(e=>new TextEncoder().encode(e).byteLength<=w0,{expected:`an argument of at most ${String(w0)} bytes`}))).check(H(32)),name:j.check(R(/^[a-z][a-z0-9-]{0,31}$/u))}),i2=N({...t2,...A0,expectedRevision:A(`0`),mode:A(`interactive`),program:k(Fde),workspaceId:J}),a2=N({afterCursor:k(q),attachId:J,commandId:J,requestedLeaseDurationMs:Z(mde,hde),terminalId:J}),o2=N({afterCursor:q,limit:Z(1,64),observerId:J,terminalId:J,waitMilliseconds:Z(0,pde)}),s2=N({observerId:J,terminalId:J}),c2=N({terminalId:J}),l2=N({controllerRequestId:J,terminalGeneration:Z(1,C0),terminalId:J}),u2=N({...t2,...n2,requestedLeaseDurationMs:Z(D0,O0),terminalGeneration:Z(1,C0)}),d2=N({...t2,...r2,...n2,controllerRequestId:J,terminalGeneration:Z(1,C0)}),f2={...t2,...Pde,...r2,...n2},p2=N({...f2,requestedLeaseDurationMs:Z(D0,O0)}),m2=N(f2),h2=N({...f2,bytesBase64:Ede,inputId:J,inputSequence:Z(1,x0)}),g2=N({...f2,...A0}),_2=N({...f2,signal:I([`hangup`,`interrupt`,`terminate`])}),v2=N(f2),y2=N(f2),b2=N({...t2,...r2,...n2,terminalGeneration:Z(1,C0)}),x2=F([N({...t2,mutationSequence:Z(1,S0),operation:I([`close`,`controller.acquire`,`controller.release`,`controller.renew`,`controller.request`,`create`,`delete`,`resize`,`signal`,`write`]),terminalGeneration:Z(1,C0),...n2}),N({...t2,mutationSequence:Z(1,S0),operation:A(`restart`),plannedTargetTerminalGeneration:Z(1,C0),sourceTerminalGeneration:Z(1,C0),...n2}).check(L(e=>e.sourceTerminalGeneration<65535&&e.plannedTargetTerminalGeneration===e.sourceTerminalGeneration+1,{expected:`a restart reconciliation for the planned next generation`}))]),S2=j.check(U(64,64),R(/^[a-f0-9]{64}$/u)),C2={actorId:A(`actor_local_user`),capability:N0,commandId:J,delivery:I([`duplicate`,`new`]),mutationSequence:Z(1,S0),receiptId:J,recordedAt:K,schemaVersion:A(xde),terminalGeneration:Z(1,C0),terminalId:J,terminalRevision:q},w2=(e,t)=>N({...C2,method:A(e),nativeAcknowledgement:N({fact:A(`not_applicable`)}),operation:A(t)}),T2=N({...C2,method:A(`terminal.session.restart`),nativeAcknowledgement:N({fact:A(`generation_started`),previousCleanup:A(`known_identity_members_complete`)}),operation:A(`restart`),sourceTerminalGeneration:Z(1,C0)}).check(L(e=>e.sourceTerminalGeneration<65535&&e.terminalGeneration===e.sourceTerminalGeneration+1,{expected:`a restart receipt for the exact next generation`})),E2=F([N({...C2,...j0,method:A(`terminal.create`),nativeAcknowledgement:N({fact:A(`generation_started`)}),operation:A(`create`)}),w2(`terminal.controller.request`,`controller.request`),w2(`terminal.controller.acquire`,`controller.acquire`),w2(`terminal.controller.renew`,`controller.renew`),w2(`terminal.controller.release`,`controller.release`),N({...C2,...j0,method:A(`terminal.input.write`),nativeAcknowledgement:N({acceptedBytes:Z(1,b0),byteLength:Z(1,b0),fact:A(`pty_master_all_bytes_accepted`),inputId:J,inputSequence:Z(1,x0),sha256:S2}),operation:A(`write`)}),N({...C2,...j0,method:A(`terminal.session.resize`),nativeAcknowledgement:N({...A0,fact:A(`tiocswinsz_succeeded`)}),operation:A(`resize`)}),N({...C2,...j0,method:A(`terminal.session.signal`),nativeAcknowledgement:N({fact:A(`tiocsig_succeeded`),signal:I([`hangup`,`interrupt`,`terminate`])}),operation:A(`signal`)}),N({...C2,...j0,method:A(`terminal.session.close`),nativeAcknowledgement:N({fact:A(`known_identity_members_complete`),unknownSurvivorExclusion:A(`unavailable`)}),operation:A(`close`)}),T2,w2(`terminal.session.delete`,`delete`)]),D2={capability:N0,commandId:J,mutationSequence:Z(1,S0),outcome:A(`outcome_unknown`),reconciliation:A(`terminal.mutation.reconcile-required`),replay:A(`forbidden`),terminalGeneration:Z(1,C0),terminalId:J},O2=(e,t)=>N({...D2,method:A(e),operation:A(t)}),k2=(e,t)=>N({...D2,...j0,method:A(e),operation:A(t)}),A2=N({...D2,...j0,byteLength:Z(1,b0),inputId:J,inputSequence:Z(1,x0),method:A(`terminal.input.write`),operation:A(`write`),sha256:S2}),j2={capability:N0,commandId:J,method:A(`terminal.session.restart`),mutationSequence:Z(1,S0),operation:A(`restart`),outcome:A(`outcome_unknown`),plannedTargetTerminalGeneration:Z(1,C0),reconciliation:A(`terminal.mutation.reconcile-required`),replay:A(`forbidden`),sourceTerminalGeneration:Z(1,C0),terminal:V0,terminalId:J},M2=F([N({...j2,effectPhase:A(`source-cleanup`),targetAttempt:A(`not-attempted`)}),N({...j2,effectPhase:A(`target-start`),targetAttempt:I([`attempted`,`may-have-been-attempted`])})]).check(L(e=>e.sourceTerminalGeneration<65535&&e.plannedTargetTerminalGeneration===e.sourceTerminalGeneration+1&&e.terminal.id===e.terminalId&&e.terminal.state===`disconnected`&&e.terminal.cleanup.state===`unknown`&&(e.effectPhase===`source-cleanup`?e.terminal.generation===e.sourceTerminalGeneration:e.terminal.generation===e.plannedTargetTerminalGeneration&&e.terminal.cleanup.reason===`native_acknowledgement_lost`),{expected:`a phase-exact unknown restart generation projection`})),Ide=F([k2(`terminal.create`,`create`),O2(`terminal.controller.request`,`controller.request`),O2(`terminal.controller.acquire`,`controller.acquire`),O2(`terminal.controller.renew`,`controller.renew`),O2(`terminal.controller.release`,`controller.release`),A2,k2(`terminal.session.resize`,`resize`),k2(`terminal.session.signal`,`signal`),k2(`terminal.session.close`,`close`),M2,O2(`terminal.session.delete`,`delete`)]),N2=e=>N({...e,outcome:A(`acknowledged`),receipt:E2}),P2=F([N2({accepted:A(!0),delivery:I([`duplicate`,`new`]),method:A(`terminal.create`),terminal:V0}).check(L(e=>e.delivery===e.receipt.delivery&&e.receipt.method===e.method&&e.receipt.operation===`create`&&e.receipt.terminalGeneration===e.terminal.generation&&e.receipt.terminalId===e.terminal.id&&e.receipt.terminalRevision===e.terminal.revision,{expected:`an acknowledged terminal creation matching its receipt`})),k2(`terminal.create`,`create`)]),F2=F([N2({controllerRequest:Q0,method:A(`terminal.controller.request`)}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===`controller.request`&&e.receipt.terminalGeneration===e.controllerRequest.terminalGeneration&&e.receipt.terminalId===e.controllerRequest.terminalId,{expected:`a controller request matching its mutation receipt`})),O2(`terminal.controller.request`,`controller.request`)]),I2=(e,t)=>F([N2({lease:e2,method:A(e)}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===t&&e.receipt.terminalGeneration===e.lease.terminalGeneration&&e.receipt.terminalId===e.lease.terminalId,{expected:`a ${t} lease matching its mutation receipt`})),O2(e,t)]),L2=I2(`terminal.controller.acquire`,`controller.acquire`),R2=I2(`terminal.controller.renew`,`controller.renew`),z2=I2(`terminal.controller.release`,`controller.release`),B2=F([N2({acceptedBytes:Z(1,b0),inputId:J,inputSequence:Z(1,x0),method:A(`terminal.input.write`),terminal:V0}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===`write`&&e.receipt.terminalGeneration===e.terminal.generation&&e.receipt.terminalId===e.terminal.id&&e.receipt.terminalRevision===e.terminal.revision&&e.receipt.nativeAcknowledgement.fact===`pty_master_all_bytes_accepted`&&e.receipt.nativeAcknowledgement.acceptedBytes===e.acceptedBytes&&e.receipt.nativeAcknowledgement.byteLength===e.acceptedBytes&&e.receipt.nativeAcknowledgement.inputId===e.inputId&&e.receipt.nativeAcknowledgement.inputSequence===e.inputSequence,{expected:`a terminal write matching its native acknowledgement`})),A2]),V2=(e,t)=>F([N2({method:A(e),terminal:V0}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===t&&e.receipt.terminalGeneration===e.terminal.generation&&e.receipt.terminalId===e.terminal.id&&e.receipt.terminalRevision===e.terminal.revision,{expected:`a ${t} terminal matching its mutation receipt`})),k2(e,t)]),H2=V2(`terminal.session.resize`,`resize`),U2=V2(`terminal.session.signal`,`signal`),W2=V2(`terminal.session.close`,`close`),G2=F([N2({method:A(`terminal.session.restart`),terminal:V0}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===`restart`&&e.receipt.terminalGeneration===e.terminal.generation&&e.receipt.terminalId===e.terminal.id&&e.receipt.terminalRevision===e.terminal.revision&&e.receipt.sourceTerminalGeneration<65535&&e.terminal.generation===e.receipt.sourceTerminalGeneration+1,{expected:`a restart terminal matching its source and target receipt`})),M2]),K2=F([N2({capability:N0,deletedAt:K,method:A(`terminal.session.delete`),terminalGeneration:Z(1,C0),terminalId:J}).check(L(e=>e.receipt.method===e.method&&e.receipt.operation===`delete`&&e.receipt.terminalGeneration===e.terminalGeneration&&e.receipt.terminalId===e.terminalId,{expected:`a terminal deletion matching its mutation receipt`})),O2(`terminal.session.delete`,`delete`)]),q2=N({attachId:J,capability:N0,delivery:I([`duplicate`,`new`]),expiresAt:K,method:A(`terminal.observer.attach`),observerId:J,renewal:A(`successful-check-renews`),snapshot:X0,terminalGeneration:Z(1,C0)}).check(L(e=>e.attachId===e.observerId&&e.terminalGeneration===e.snapshot.terminal.generation,{expected:`an idempotent observer attachment matching its terminal generation`})),J2=N({capability:N0,events:P(Y0).check(H(64)),headCursor:q,leaseExpiresAt:K,method:A(`terminal.observer.check`),observerId:J,renewal:A(`successful-check-renewed`),terminalGeneration:Z(1,C0),terminalId:J,timedOut:M}).check(L(e=>e.events.every(t=>t.terminalId===e.terminalId&&t.capability.revocationPolicyRevision===e.capability.revocationPolicyRevision)&&!(e.timedOut&&e.events.length>0)&&U0(e)<=524288,{expected:`a terminal observer check within its response byte cap`})),Y2=N({capability:N0,detached:A(!0),method:A(`terminal.observer.detach`),observerId:J,terminalGeneration:Z(1,C0),terminalId:J}),X2=N({method:A(`terminal.observer.resync`),snapshot:X0}),Z2=N({controllerRequest:Q0,method:A(`terminal.controller.request.show`)}),Q2={commandId:J,mutationSequence:Z(1,S0),operation:I([`close`,`controller.acquire`,`controller.release`,`controller.renew`,`controller.request`,`create`,`delete`,`resize`,`signal`,`write`]),originalReplay:A(`forbidden`),terminalGeneration:Z(1,C0),terminalId:J},Lde=F([N({checkedAt:K,...Q2,method:A(`terminal.mutation.reconcile`),next:A(`new-mutation-only`),receipt:E2,state:A(`acknowledged`),terminal:V0}),N({checkedAt:K,...Q2,method:A(`terminal.mutation.reconcile`),next:A(`new-mutation-only`),receipt:A(`not_found`),state:A(`not_found`),terminal:V0}),N({checkedAt:K,...Q2,method:A(`terminal.mutation.reconcile`),next:A(`reconcile-again`),receipt:A(`unknown`),state:A(`still_unknown`),terminal:V0})]).check(L(e=>e.terminal.id===e.terminalId&&e.terminal.generation>=e.terminalGeneration&&(e.state!==`acknowledged`||e.receipt.commandId===e.commandId&&e.receipt.operation===e.operation&&e.receipt.mutationSequence===e.mutationSequence&&e.receipt.terminalGeneration===e.terminalGeneration&&e.receipt.terminalId===e.terminalId),{expected:`an exact terminal mutation reconciliation identity`})),$2={checkedAt:K,commandId:J,method:A(`terminal.mutation.reconcile`),mutationSequence:Z(1,S0),operation:A(`restart`),originalReplay:A(`forbidden`),plannedTargetTerminalGeneration:Z(1,C0),sourceTerminalGeneration:Z(1,C0),terminal:V0,terminalId:J},Rde=F([N({...$2,effectPhase:A(`not-found`),next:A(`new-mutation-only`),receipt:A(`not_found`),state:A(`not_found`),targetAttempt:A(`unknown`)}),N({...$2,effectPhase:A(`target-start`),next:A(`new-mutation-only`),receipt:T2,state:A(`acknowledged`),targetAttempt:A(`attempted`)}),N({...$2,effectPhase:A(`source-cleanup`),next:A(`reconcile-again`),receipt:A(`unknown`),state:A(`still_unknown`),targetAttempt:A(`not-attempted`)}),N({...$2,effectPhase:A(`target-start`),next:A(`reconcile-again`),receipt:A(`unknown`),state:A(`still_unknown`),targetAttempt:I([`attempted`,`may-have-been-attempted`])})]),zde=e=>e.receipt.commandId===e.commandId&&e.receipt.mutationSequence===e.mutationSequence&&e.receipt.sourceTerminalGeneration===e.sourceTerminalGeneration&&e.receipt.terminalGeneration===e.plannedTargetTerminalGeneration&&e.receipt.terminalId===e.terminalId&&e.terminal.generation>=e.plannedTargetTerminalGeneration,Bde=e=>e.terminal.state===`disconnected`?e.effectPhase===`source-cleanup`?e.terminal.generation===e.sourceTerminalGeneration:e.terminal.generation===e.plannedTargetTerminalGeneration&&e.terminal.cleanup.reason===`native_acknowledgement_lost`:!1,e4=F([Lde,Rde.check(L(e=>e.sourceTerminalGeneration>=65535||e.plannedTargetTerminalGeneration!==e.sourceTerminalGeneration+1||e.terminal.id!==e.terminalId?!1:e.state===`acknowledged`?zde(e):e.state===`not_found`?e.terminal.generation>=e.sourceTerminalGeneration:Bde(e),{expected:`a phase-exact restart reconciliation identity`}))]),Vde=F([N({method:A(`terminal.observer.attach`),parameters:a2}),N({method:A(`terminal.observer.check`),parameters:o2}),N({method:A(`terminal.observer.detach`),parameters:s2}),N({method:A(`terminal.observer.resync`),parameters:c2}),N({method:A(`terminal.controller.request`),parameters:u2}),N({method:A(`terminal.controller.request.show`),parameters:l2}),N({method:A(`terminal.controller.acquire`),parameters:d2}),N({method:A(`terminal.controller.renew`),parameters:p2}),N({method:A(`terminal.controller.release`),parameters:m2}),N({method:A(`terminal.input.write`),parameters:h2}),N({method:A(`terminal.session.resize`),parameters:g2}),N({method:A(`terminal.session.signal`),parameters:_2}),N({method:A(`terminal.session.close`),parameters:v2}),N({method:A(`terminal.session.restart`),parameters:y2}),N({method:A(`terminal.session.delete`),parameters:b2}),N({method:A(`terminal.mutation.reconcile`),parameters:x2})]),Hde=F([P2,q2,J2,Y2,X2,F2,Z2,L2,R2,z2,B2,H2,U2,W2,G2,K2,e4]),Ude=32768,Wde=V.check(z(1),Ry(100)),Gde=F([N({code:A(`terminal_containment_unsupported`),platform:I([`darwin`,`linux`])}),N({code:A(`platform_unsupported`),platform:I([`win32`,`other`])})]),Kde=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},t4=e=>new TextEncoder().encode(JSON.stringify(e)).byteLength,n4=L(e=>t4(e)<=vde,{expected:`a terminal result within its encoded response byte cap`}),r4=N({chunkHead:q,createdAt:K,id:J,projectId:J,revision:q,schemaVersion:A(1),state:A(`unavailable`),unavailability:Gde,updatedAt:K,workspaceId:J,workspaceRevision:q}),i4=F([r4,V0]),a4=F([N({commandId:J,eventType:A(`terminal.create.rejected`),globalCursor:q,payload:F([N({code:A(`terminal_containment_unsupported`),platform:I([`darwin`,`linux`]),projectId:J,workspaceId:J,workspaceRevision:q}),N({code:A(`platform_unsupported`),platform:I([`win32`,`other`]),projectId:J,workspaceId:J,workspaceRevision:q})]),recordedAt:K,schemaVersion:A(1),terminalCursor:q,terminalId:J}),Y0]),o4=F([N({bytesBase64:j.check(L(e=>e.length===0||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e)?!1:Kde(e)<=Ude,{expected:`base64 terminal bytes encoded from at most 32768 bytes`})),cursor:q,recordedAt:K,schemaVersion:A(1),terminalId:J}),K0]),s4=F([N({commandId:J,expectedRevision:A(`0`),workspaceId:J}),i2]),c4=N({afterCursor:q,limit:Wde,workspaceId:J}),l4=N({terminalId:J}),u4=N({afterTerminalCursor:q,limit:V.check(z(1),Ry(32)),terminalId:J}),d4=N({afterChunkCursor:q,limit:V.check(z(1),Ry(8)),terminalId:J}),f4=F([N({accepted:A(!1),delivery:I([`new`,`duplicate`]),method:A(`terminal.create`),receipt:Y,terminal:r4}),P2]),p4=N({items:P(i4).check(H(100)),method:A(`terminal.list`),nextCursor:k(q)}).check(n4),m4=N({method:A(`terminal.show`),terminal:i4}).check(n4),h4=N({headTerminalCursor:q,items:P(a4).check(H(32)),method:A(`terminal.events.list`),nextTerminalCursor:k(q),oldestRetainedCursor:k(q),terminalId:J}).check(L(e=>e.items.every(t=>t.terminalId===e.terminalId)&&t4(e)<=786432,{expected:`a terminal event page matching its terminal and response byte cap`})),g4=N({gap:k(N({oldestAvailableCursor:q,reason:A(`cursor_expired`),recovery:A(`resync-required`)})),headChunkCursor:q,items:P(o4).check(H(8)),method:A(`terminal.read`),nextChunkCursor:k(q),terminalId:J}).check(L(e=>e.items.every(t=>t.terminalId===e.terminalId)&&t4(e)<=786432,{expected:`a terminal output page matching its terminal and response byte cap`})),qde=F([N({method:A(`terminal.create`),parameters:s4}),N({method:A(`terminal.list`),parameters:c4}),N({method:A(`terminal.show`),parameters:l4}),N({method:A(`terminal.events.list`),parameters:u4}),N({method:A(`terminal.read`),parameters:d4}),Vde]),Jde=F([f4,p4,m4,h4,g4,Hde]).check(n4);G(i4),G(a4),G(o4),G(s4),G(c4),G(l4),G(u4),G(d4);var Yde=G(f4),Xde=G(p4),Zde=G(m4),Qde=G(h4),$de=G(g4),_4=()=>(e,...t)=>e,v4=G;_4()(v4(M0)),_4()(v4(N0)),_4()(v4(L0)),_4()(v4(V0)),_4()(v4(K0)),_4()(v4(Y0)),_4()(v4(X0)),_4()(v4(Q0)),_4()(v4(e2)),_4()(v4(E2)),_4()(v4(Ide)),_4()(v4(i2)),_4()(v4(P2)),_4()(v4(a2)),_4()(v4(q2)),_4()(v4(o2)),_4()(v4(J2)),_4()(v4(s2)),_4()(v4(Y2)),_4()(v4(c2)),_4()(v4(X2)),_4()(v4(u2));var efe=_4()(v4(F2));_4()(v4(l2));var tfe=_4()(v4(Z2));_4()(v4(d2));var nfe=_4()(v4(L2));_4()(v4(p2)),_4()(v4(R2)),_4()(v4(m2));var rfe=_4()(v4(z2));_4()(v4(h2));var y4=_4()(v4(B2));_4()(v4(g2));var ife=_4()(v4(H2));_4()(v4(_2));var afe=_4()(v4(U2));_4()(v4(v2));var ofe=_4()(v4(W2));_4()(v4(y2)),_4()(v4(G2)),_4()(v4(b2)),_4()(v4(K2)),_4()(v4(x2)),_4()(v4(e4));var sfe=4096,b4=24576,x4=4096,cfe=8192,S4=`maia`,C4=`Route one bounded Maia voice action through the authoritative Maia Node. ask prepares an exact Pi message for trusted on-screen confirmation; status reads one current bounded Node snapshot.`,lfe=`maia.voice-orchestrator-context/v1`,ufe=`maia.voice-orchestrator-call/v1`,dfe=`maia.voice-tool-result/v1`,ffe=`maia.voice-managed-turn/v1`,pfe=new TextEncoder,w4=q.check(R(/^[1-9]\d*$/u)),mfe=j.check(U(1,sfe),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&pfe.encode(e).byteLength<=4096,{expected:`non-empty, non-NUL text encoded within 4096 UTF-8 bytes`})),T4=j.check(U(43,43),R(/^[A-Za-z0-9_-]{43}$/u)),hfe=K,E4={body:mfe,commandId:J,expectedContextRevision:w4,expectedWorkspaceRevision:w4,workspaceId:J},D4=N(E4),O4=N({...E4,proof:T4,sessionId:J}),k4=N({commandId:J}),A4={commandId:J,contextRevision:w4,expiresAt:hfe,releaseQualified:A(!1),schemaVersion:A(2),sessionId:J,workspaceId:J,workspaceRevision:w4},j4=N({...A4,method:A(`voice.pi.relay.preview`),proof:T4}),M4=N({commandId:J,contextRevision:w4,delivery:I([`new`,`duplicate`]),method:A(`voice.pi.relay`),receipt:Y,releaseQualified:A(!1),schemaVersion:A(2),sessionId:J,workspaceId:J,workspaceRevision:w4}).check(L(e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.id===e.sessionId&&e.receipt.target.type===`session`,{expected:`a voice Pi relay result matching its exact Session receipt`})),N4=N({...A4,method:A(`voice.pi.relay.reconcile`),state:I([`previewed`,`expired`,`prepared`,`dispatching`,`acknowledged`,`outcome-unknown`])}),gfe=F([N({method:A(`voice.pi.relay.preview`),parameters:D4}),N({method:A(`voice.pi.relay`),parameters:O4}),N({method:A(`voice.pi.relay.reconcile`),parameters:k4})]),_fe=F([j4,M4,N4]),vfe=G(D4),yfe=G(O4),bfe=G(k4),xfe=G(j4),Sfe=G(M4),Cfe=G(N4),wfe=`maia.hook.v1`,P4=[`admission.refused`,`approval.requested`,`approval.resolved`,`drift.raised`,`drift.settled`,`inbox.item.created`,`inbox.item.settled`,`node.health.changed`,`node.started`,`node.stopping`,`session.adopted`,`session.blocked`,`session.ended`,`session.idle`,`session.runtime.failed`,`session.started`,`session.turn.completed`,`session.turn.failed`,`session.working`,`update.done`,`webhook.test`],F4=I(P4),I4=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),L4=e=>j.check(U(1,e),R(/^[^\p{Cc}\p{Cs}]*$/u)),Tfe=N({adoptedFrom:k(J),approvalId:k(J),approvalKind:k(jw),driftKind:k(I(HV)),driftRule:k(I(UV)),droppedSinceLast:k(wy.check(zy(),B({maximum:1e9,minimum:1}))),failureClass:k(I4),itemId:k(J),itemKind:k(I4),previousShutdown:k(I([`clean`,`unclean`])),reason:k(I([`archived`,`stop`,`stopped`])),reasonClass:k(I4),resumed:k(M),scope:k(I4),to:k(L4(64)),turnId:k(J),updateId:k(J)}),Efe=N({labels:k(Oy(L4(32),L4(128)).check(Wte(8))),node:k(J),projectId:k(J),sessionId:k(J)}),R4=new Map([[`approval.requested`,[`approvalId`,`approvalKind`]],[`approval.resolved`,[`approvalId`,`approvalKind`,`to`]],[`drift.raised`,[`driftKind`,`driftRule`]],[`drift.settled`,[`driftKind`,`driftRule`]],[`inbox.item.created`,[`itemId`,`itemKind`]],[`inbox.item.settled`,[`itemId`,`itemKind`,`to`]],[`node.health.changed`,[`scope`,`to`]]]),Dfe=new Set([`drift.raised`,`drift.settled`]),Ofe=N({context:Efe,deliveryId:J,event:N({data:Tfe,id:J,kind:F4,ts:K}),sample:M,schemaVersion:A(wfe)}).check(L(e=>(R4.get(e.event.kind)??[]).every(t=>e.event.data[t]!==void 0),{expected:`the ID and kind fields this hook event carries`}),L(e=>!Dfe.has(e.event.kind)||e.context.labels===void 0&&Object.keys(e.event.data).length===(R4.get(e.event.kind)??[]).length,{expected:`a goal-drift hook of its state and rule alone, with no label`}),L(e=>e.sample===(e.event.kind===`webhook.test`)&&new TextEncoder().encode(JSON.stringify(e)).byteLength<=8192)),kfe=`MAIA_WEBHOOK_SECRET_`,Afe=`maia.webhook/v1`,z4=q.check(R(/^[1-9]\d*$/u)),jfe=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),B4=j.check(R(/^sha256:[a-f0-9]{64}$/u)),V4=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),Mfe=j.check(U(8,2048),L(e=>{try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&t.username===``&&t.password===``&&t.hostname!==``}catch{return!1}},{expected:`an http(s) URL without credentials`})),Nfe=j.check(R(RegExp(`^${kfe}[A-Z0-9_]{1,43}$`,`u`))),Pfe=j.check(R(/^[A-Z][A-Z0-9_]{0,63}$/u)),Ffe=N({key:j.check(R(/^(label\.[a-z0-9][a-z0-9_.-]{0,31}|project|node)$/u)),value:j.check(U(1,256),R(/^[^\p{Cc}]*$/u))}),H4={allowPrivate:M,events:P(F4).check(U(1,P4.length),L(e=>new Set(e).size===e.length)),filters:P(Ffe).check(H(8),L(e=>new Set(e.map(e=>e.key)).size===e.length)),url:Mfe},U4=N({...H4,secretEnv:Nfe}),W4=N({...H4,secretEnv:Pfe}),G4=N({actorId:J,createdAt:K,droppedParked:V.check(z(0)),gapOldest:k(j),gapResets:V.check(z(0)),id:J,lastErrorClass:k(V4),revision:z4,schemaVersion:A(Afe),spec:W4,state:I([`active`,`removed`]),updatedAt:K}),Ife=I([`dead`,`delivered`,`denied`,`expired`,`in_flight`,`pending`,`retry`]),K4=N({attempts:V.check(B({maximum:10,minimum:0})),createdAt:K,errorClass:k(V4),eventId:J,id:J,kind:F4,nextAttemptAt:k(K),state:Ife,updatedAt:K,webhookId:J}),q4={afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1}))},J4=N(q4),Y4=N({items:P(G4).check(H(100)),method:A(`webhooks.list`),nextCursor:k(J)}),X4=N({...q4,failedOnly:k(M),webhookId:k(J)}),Z4=N({items:P(K4).check(H(100)),method:A(`webhooks.deliveries`),nextCursor:k(J)}),Q4={expectedRevision:z4,webhookId:J},$4=F([N({kind:A(`add`),spec:U4}),N({...Q4,kind:A(`remove`)}),N({...Q4,kind:A(`test`)}),N({deliveryId:J,expectedRevision:z4,kind:A(`redeliver`)})]),e3={change:$4,commandId:J},t3={inputDigest:B4,proof:jfe},n3=N(e3),r3=N({...e3,...t3}),i3=N({...e3,...t3,actorId:J,current:k(G4),deletesDeliveries:k(V.check(z(0))),expiresAt:K,issuedAt:K,method:A(`webhooks.change.preview`),webhookId:J}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt)&&(e.change.kind===`add`?e.current===void 0:(e.change.kind===`redeliver`||e.change.webhookId===e.webhookId)&&e.current?.id===e.webhookId&&e.current.revision===e.change.expectedRevision),{expected:`a forward-timed preview of the webhook a change names`})),a3=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),deliveryId:k(J),inputDigest:B4,kind:I([`add`,`redeliver`,`remove`,`test`]),method:A(`webhooks.change.confirm`),receipt:Y,webhook:G4}).check(L(e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`webhook`&&e.receipt.target.id===e.webhook.id&&e.receipt.aggregateRevision===e.webhook.revision&&e.receipt.createdAt===e.webhook.updatedAt,{expected:`a confirmed change bound to its webhook and receipt`})),Lfe=F([N({method:A(`webhooks.list`),parameters:J4}),N({method:A(`webhooks.deliveries`),parameters:X4}),N({method:A(`webhooks.change.preview`),parameters:n3}),N({method:A(`webhooks.change.confirm`),parameters:r3})]),Rfe=F([Y4,Z4,i3,a3]);G(J4);var zfe=G(Y4);G(X4);var Bfe=G(Z4);G(n3);var Vfe=G(i3);G(r3);var Hfe=G(a3);G(U4),G(W4),G(G4),G(K4);var o3=G($4);G(Ofe);var s3=q.check(R(/^[1-9]\d*$/u)),c3=j.check(R(/^[a-f0-9]{64}$/u)),l3=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),u3=j.check(U(1,4096),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=4096)),d3={expectedSessionRevision:s3,projectId:J,scopeId:J,sessionId:J,systemPromptSha256:j.check(R(/^sha256:[a-f0-9]{64}$/u)),toolCallId:J,utterance:u3},f3=N(d3),p3=N({...d3,confirmation:N({action:A(`turn.send`),commandId:J,inputDigest:c3,proof:l3,sessionId:J})}),m3=N({commandId:J,contextRevision:s3,expectedSessionRevision:s3,expiresAt:K,inputDigest:c3,kind:A(`confirmation-required`),method:A(`voice.managed-turn.preview`),projectId:J,proof:l3,releaseQualified:A(!1),schemaVersion:A(ffe),sessionId:J,target:A(`pi-managed`),turnInput:u3,voiceSessionId:J,workspaceId:J,workspaceRevision:s3}),Ufe=F([N({method:A(`voice.managed-turn.preview`),parameters:f3}),N({method:A(`voice.managed-turn.confirm`),parameters:p3})]),h3=new TextEncoder,Wfe=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0,g3=(e,t)=>{try{let n=JSON.stringify(e);return n!==void 0&&h3.encode(n).byteLength<=t}catch{return!1}},_3=q.check(R(/^[1-9]\d*$/u)),Gfe=j.check(U(71,71),R(/^sha256:[a-f0-9]{64}$/u)),v3=j.check(U(1,4096),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&h3.encode(e).byteLength<=4096,{expected:`non-empty, non-NUL text encoded within 4096 UTF-8 bytes`})),y3=F([N({action:A(`ask`),utterance:v3}),N({action:A(`status`)})]),Kfe=N({args:y3,toolCallId:J,toolName:A(S4)}),b3=ste(Yte(N({action:I([`ask`,`status`]),utterance:vy(v3)}),{onExcessProperty:`error`})),x3={...b3.schema,...Object.keys(b3.definitions).length===0?{}:{definitions:b3.definitions}},S3=(e,t)=>{if(e===t)return!0;if(Array.isArray(t))return Array.isArray(e)&&e.length===t.length&&t.every((t,n)=>S3(e[n],t));if(typeof t!=`object`||!t||typeof e!=`object`||!e||Array.isArray(e))return!1;let n=Object.keys(t);return Object.keys(e).length===n.length&&n.every(n=>Object.hasOwn(e,n)&&S3(Reflect.get(e,n),Reflect.get(t,n)))},C3=N({description:A(C4),name:A(S4),parameters:Oy(j,xy).check(L(e=>S3(e,x3),{expected:`the canonical Maia voice tool parameter schema`})),type:A(`function`)}),w3={releaseQualified:A(!1),schemaVersion:A(dfe)},T3=j.check(U(1,256),L(e=>h3.encode(e).byteLength<=256,{expected:`a safe message encoded within 256 UTF-8 bytes`})),E3=F([N({action:A(`status`),authority:A(`managed-maia-agent`),data:F([N({status:I([`no-managed-turn`,`unknown`])}),N({result:N({phase:I([`queued`,`dispatching`,`running`,`completed`,`failed`,`interrupted`,`outcome-unknown`]),reason:k(T3),text:k(j.check(L(e=>h3.encode(e).byteLength<=2048,{expected:`agent output within 2048 UTF-8 bytes`}))),truncated:M}),sessionId:J,status:A(`ok`),turnId:J})]),error:Sy,interaction:Sy,receipt:Sy,releaseQualified:A(!1),schemaVersion:A(`maia.voice-managed-status-result/v1`),status:A(`managed-status`)}).check(L(e=>g3(e,x4),{expected:`managed status within the voice tool output byte bound`})),N({action:A(`ask`),authority:A(`managed-maia-agent`),error:Sy,interaction:N({applyMethod:A(`voice.managed-turn.confirm`),commandId:J,expectedSessionRevision:_3,expiresAt:j.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/u)),requiresTrustedGesture:A(!0),sessionId:J}),receipt:Sy,releaseQualified:A(!1),schemaVersion:A(`maia.voice-managed-preview-result/v1`),status:A(`awaiting-confirmation`)}),N({...w3,action:A(`ask`),error:Sy,interaction:N({applyMethod:A(`voice.pi.relay`),kind:A(`confirmation-required`),previewId:J,requiresTrustedGesture:A(!0)}),receipt:Sy,status:A(`confirmation-required`)}),N({...w3,action:A(`status`),data:N({lifecycle:I([`starting`,`ready`,`draining`,`stopped`,`failed`]),method:A(`node.status`),processResources:N({activeTrees:V.check(z(0),Ry(128)),admissionState:I([`available`,`degraded`,`pressured`,`saturated`,`unavailable`]),cleanupUnknownTrees:V.check(z(0),Ry(128)),nextStep:I([`close_idle_terminal`,`inspect_cleanup_unknown`,`inspect_observed_pressure`,`none`,`run_node_in_delegated_cgroup`,`upgrade_kernel`,`verify_native_host`]),pressure:I([`admission_degraded`,`cgroup_delegation_unavailable`,`cleanup_unknown`,`healthy`,`landlock_scoped_unavailable`,`observed_pressure`,`warning`])}),storageIntegrity:I([`ok`,`unavailable`])}),error:Sy,interaction:Sy,receipt:Sy,status:A(`ok`)}),N({...w3,action:I([`ask`,`status`,`unknown`]),error:N({code:I([`bridge_unavailable`,`call_conflict`,`capacity_exceeded`,`invalid_input`,`scope_stale`]),message:T3}),interaction:Sy,receipt:Sy,status:A(`rejected`)})]),D3=sy(Wfe,{description:`an exact empty object`}),O3=N({call:xy,scopeId:J}).check(L(e=>g3(e,cfe),{expected:`a bounded Maia voice tool request`})),qfe=N({contextRevision:_3,id:J,workspaceId:J,workspaceRevision:_3}),k3=N({method:A(`voice.orchestrator.context.show`),releaseQualified:A(!1),schemaVersion:A(lfe),scope:qfe,systemPrompt:j.check(U(1,b4)),systemPromptSha256:Gfe,systemPromptVersion:V.check(z(1),Ry(65535)),tools:Ay([C3])}).check(L(e=>g3(e,b4),{expected:`a bounded Maia voice orchestrator context`})),A3=N({interaction:F([Sy,N({body:v3,confirmation:j4,kind:A(`confirmation-required`)})]),method:A(`voice.orchestrator.tool.call`),modelResult:E3,releaseQualified:A(!1),schemaVersion:A(ufe),scopeId:J}).check(L(e=>e.modelResult.status===`confirmation-required`?e.interaction!==null&&e.interaction.kind===`confirmation-required`&&e.interaction.confirmation.commandId===e.modelResult.interaction.previewId&&e.interaction.confirmation.workspaceId.length>0:e.interaction===null,{expected:`a proof-free model result matching its exact client confirmation`}),L(e=>g3(e.modelResult,x4),{expected:`a bounded Maia voice model result`})),Jfe=F([Ufe,F([N({method:A(`voice.orchestrator.context.show`),parameters:D3}),N({method:A(`voice.orchestrator.tool.call`),parameters:O3})]),gfe]),Yfe=F([m3,k3,A3,_fe]),j3=`agents.change.confirm,approval.respond,board.message.post,board.message.reply,board.task.assign,board.task.cancel,board.task.claim,board.task.complete,board.task.create,board.task.fail,board.task.needs.replace,board.task.plan,board.task.promote,board.task.release,board.task.renew,board.task.reopen,connection.capacity.set,connection.create,connection.gateway.create,connection.github.create,connection.github.revoke,connection.grant.set.confirm,connection.login.start,connection.pool.set.confirm,connection.state.set,connection.upkeep.confirm,container.create.confirm,container.rename.confirm,execution.checkpoint.create,execution.command.run,execution.file.read,execution.placement.create,execution.relocation.apply,execution.relocation.reconcile,execution.worktree.create,execution.worktree.import,execution.worktree.reconcile,execution.worktree.remove.apply,goal.clear,goal.mark,goal.set,goal.transition,goal.update,hold.place.confirm,hold.release.confirm,inbox.respond,inbox.settle,inbox.snooze,integration.apply.antigravity,integration.apply.claude-code,integration.apply.codex,integration.apply.grok-cli,integration.apply.maia-agent,integration.apply.pi,integration.apply.pi-rpc,integration.remove.antigravity,integration.remove.claude-code,integration.remove.codex,integration.remove.grok-cli,integration.remove.maia-agent,integration.remove.pi,integration.remove.pi-rpc,interaction.cancel,interaction.create,interaction.respond,node.pairing.confirm,node.pairing.redeem,node.principal.confirm,node.reach.confirm,node.remote.install.confirm,node.remote.register.confirm,node.remote.remove.confirm,node.update.apply.confirm,node.update.pause,node.update.policy.set,node.update.resume,node.update.rollback.confirm,port.lease.acquire,port.lease.release,port.lease.renew,pr.link,pr.watch,project.context.record,project.create.confirm,project.guard.confirm,project.instructions.change.confirm,project.knowledge.add.commit,project.knowledge.remove.confirm,project.register,project.rename.confirm,routine.create.confirm,routine.disable.confirm,routine.move.confirm,routine.pause,routine.resume,routine.run.confirm,routine.trigger.create.confirm,routine.trigger.disable,routine.update.confirm,run.create,run.dispatch.settle-terminal,run.inbox.ack,run.ledger.create,run.ledger.task.dispatch,run.ledger.task.settle,run.question.cancel,run.question.open,run.question.reply,secret.request,secret.set.confirm,session.adopt.confirm,session.agent-permission.confirm,session.archive,session.create,session.detach.confirm,session.inbox.ack,session.message.send,session.pause.confirm,session.rename,session.resume,session.setup.confirm,session.spawn-caps.confirm,session.spawn.record,session.start,session.stop,skills.sync.confirm,team-workspace.bootstrap.apply,terminal.controller.acquire,terminal.controller.release,terminal.controller.renew,terminal.controller.request,terminal.create,terminal.input.write,terminal.mutation.reconcile,terminal.observer.attach,terminal.observer.detach,terminal.session.close,terminal.session.delete,terminal.session.resize,terminal.session.restart,terminal.session.signal,turn.cancel,turn.interrupt,turn.send,voice.pi.relay,webhooks.change.confirm,workspace.execution.configure,workspace.membership.attach,workspace.repository.attach,workspace.select`.split(`,`);cO.filter(e=>!j3.includes(e));var M3=I([`starting`,`ready`,`draining`,`stopped`,`failed`]),Xfe=I([`deadline_exceeded`,`outcome_unknown`,`saturated`]),N3=Oy(j,by),P3=dre(I(j3)),F3=F([qX,WU,Kle,WI,sJ,$ce,Vw,uY,JW,N({method:A(`node.status`),parameters:N3}),N({method:A(`node.shutdown`),parameters:N3}),N({method:A(`monitor.bootstrap.create`),parameters:N3}),N({method:A(`receipt.get`),parameters:mS}),N({method:A(`receipt.list`),parameters:P3}),CE,rX,xie,LY,pZ,NW,zD,OO,YD,BO,jse,Bue,YA,qZ,dQ,mA,K$,due,zj,QF,OZ,wue,yce,zz,$oe,TL,UR,jz,yw,sae,Oie,kG,kae,Lfe,fse,Yue,ode,qde,zM,Jfe]),Zfe=N({correlationId:k(J),kind:A(`request`),messageId:J,payload:F3,protocolVersion:iS}),I3=j.check(U(43,43),R(/^[A-Za-z0-9_-]+$/u)),Qfe=N({credential:j.check(U(43,43),R(/^[A-Za-z0-9_-]{43}$/u)),scheme:A(`maia.invocation-attachment/v1`)}),L3=j.check(U(20,64)),R3=N({instanceId:J,lifecycle:M3,pid:V.check(Ly(0)),profile:J,startedAt:L3}),z3=V.check(z(0),Ry(128)),$fe=F([N({hardLimitEnforcement:A(`enforced`),metricSampling:A(`host_sampled`),mode:A(`hard_containment`),observedPressureTermination:A(`disabled`),releaseQualified:A(!1),sourceCandidate:A(!0)}),N({hardLimitEnforcement:A(`unavailable`),metricSampling:A(`host_sampled`),mode:A(`macos_cooperative`),observedPressureTermination:A(`disabled`),releaseQualified:A(!1),sourceCandidate:A(!0)}),N({hardLimitEnforcement:A(`unavailable`),metricSampling:A(`unavailable`),mode:A(`unavailable`),observedPressureTermination:A(`disabled`),releaseQualified:A(!1),sourceCandidate:A(!1)})]),epe=V.check(z(0),Ry(2**53-1)),B3=N({availableTrees:z3,budget:I([`declared_per_tree_limit`,`unavailable_not_declared`]),maximumValue:k(epe),state:I([`available`,`partial`,`unavailable`]),unavailableTrees:z3,warningTrees:z3}),tpe=N({cpuTimeMilliseconds:B3,fileDescriptorCount:B3,ioReadBytes:B3,ioWriteBytes:B3,observedPeakRssBytes:B3,processCount:B3,rssBytes:B3,treeCount:z3}),npe=N({activeTrees:z3,admission:N({availableTrees:z3,capacity:z3,queuedSpawns:A(0),state:I([`available`,`degraded`,`pressured`,`saturated`,`unavailable`]),usedTrees:z3}),capability:$fe,cleanupUnknownTrees:z3,fencedTrees:z3,nextStep:I([`close_idle_terminal`,`inspect_cleanup_unknown`,`inspect_observed_pressure`,`none`,`run_node_in_delegated_cgroup`,`upgrade_kernel`,`verify_native_host`]),observations:tpe,pressure:I([`admission_degraded`,`cgroup_delegation_unavailable`,`cleanup_unknown`,`healthy`,`landlock_scoped_unavailable`,`observed_pressure`,`warning`]),supervision:N({trackedTrees:z3,watcherFibers:z3})}),rpe=(e,t)=>{let n=`partial`;return e.availableTrees===0?n=`unavailable`:e.unavailableTrees===0&&(n=`available`),e.availableTrees+e.unavailableTrees===t&&e.warningTrees<=e.availableTrees&&e.availableTrees===0==(e.maximumValue===void 0)&&e.state===n},ipe=e=>e.pressure===`cgroup_delegation_unavailable`==(e.nextStep===`run_node_in_delegated_cgroup`)&&e.pressure===`landlock_scoped_unavailable`==(e.nextStep===`upgrade_kernel`)&&(e.pressure!==`cgroup_delegation_unavailable`&&e.pressure!==`landlock_scoped_unavailable`||e.capability.mode===`unavailable`&&e.admission.state===`unavailable`),ape=npe.check(L(e=>{let t=[e.observations.cpuTimeMilliseconds,e.observations.fileDescriptorCount,e.observations.ioReadBytes,e.observations.ioWriteBytes,e.observations.observedPeakRssBytes,e.observations.processCount,e.observations.rssBytes];return e.admission.usedTrees+e.admission.availableTrees===e.admission.capacity&&e.supervision.trackedTrees<=e.admission.usedTrees&&e.activeTrees+e.cleanupUnknownTrees===e.supervision.trackedTrees&&e.fencedTrees<=e.cleanupUnknownTrees&&e.supervision.watcherFibers<=e.supervision.trackedTrees&&e.observations.treeCount===e.supervision.trackedTrees&&ipe(e)&&t.every(t=>rpe(t,e.observations.treeCount))},{expected:`a consistent bounded process-resource health projection`})),ope=N({bubblewrap:I([`found`,`missing`]),socat:I([`found`,`missing`]),userNamespaces:I([`allowed`,`no_nesting`,`restricted`])}),V3=wy.check(B({maximum:100,minimum:0})),spe=N({diskFreePercent:V3,loadPerCpu:wy.check(z(0)),memoryAvailablePercent:V3,observedAt:L3}),cpe=N({checkpointBlocked:k(M),excessBytes:V.check(z(0)),oldestAgeMs:k(V.check(z(0)))}),H3=N({...R3.fields,admissionCaps:k(N({defaultAccountSessions:V.check(B({maximum:64,minimum:1})),maximumActiveSessions:V.check(B({maximum:64,minimum:1}))})),executorHost:k(ope),headlessApprovals:k(I([`off`,`on`])),host:k(spe),hostAuthority:k(I([`disabled`,`enabled`])),method:A(`node.status`),processResources:ape,storage:N({events:k(cpe),integrity:I([`ok`,`unavailable`]),journalMode:A(`wal`),schemaTag:j.check(U(20,64),R(/^maia\.node-storage\/v[1-9]\d*$/u)),schemaVersion:V.check(Ly(0),Ry(65535))}),version:k(j.check(U(1,64)))}),U3=N({accepted:A(!0),method:A(`node.shutdown`)}),W3=N({expiresAt:L3,instanceId:J,method:A(`monitor.bootstrap.create`),url:j.check(R(/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/#bootstrap=[A-Za-z0-9_-]{43}$/u))}),G3=F([JX,GU,qle,GI,cJ,cle,Gw,dY,qW,H3,U3,W3,hS,vS,wE,hX,bie,RY,mZ,PW,BD,DO,XD,VO,Mse,Vue,XA,JZ,fQ,Tj,q$,fue,Wj,$F,EZ,B1,bce,Bz,Qoe,EL,WR,Az,bw,cae,kie,AG,Aae,Rfe,pse,Xue,sde,Jde,BM,Yfe]),K3=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({ok:A(!0),result:G3}),protocolVersion:iS}),lpe=F([K3,dS]),upe=Oy(j,by),dpe=j.check(U(20,64)),q3=j.check(U(71,71),R(/^sha256:[a-f0-9]{64}$/u)),J3=j.check(U(48,sO),R(/^scur_[A-Za-z0-9_-]+$/u)),Y3=j.check(U(18,32),R(/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}$/u),L(e=>{let t=Number(e.slice(e.lastIndexOf(`:`)+1));return Number.isSafeInteger(t)&&t>=1&&t<=65535},{expected:`an exact IPv4-loopback HTTP origin with a valid port`})),X3=N({scheme:A(`maia.node.bearer/v1`),token:I3}),Z3=/^http:\/\/((?:\d{1,3}\.){3}\d{1,3}):([1-9]\d{0,4})$/u,fpe=j.check(U(20,28),R(Z3),L(e=>{let[,t=``,n=``]=Z3.exec(e)??[];return IZ({address:t,port:Number(n)})},{expected:`an HTTP origin on a private IPv4 address with a port from 1024 to 65535`})),Q3={observationPath:A($D),operationPath:A(QD),transport:A(`http-websocket`)},$3=N({...Q3,origin:Y3}),ppe=N({...Q3,origin:F([Y3,fpe])}),mpe=N({...R3.fields,endpoint:$3,kind:A(`maia.node-api.ready`),lifecycle:A(`ready`),protocolVersion:iS,schemaVersion:A(ZD)}),hpe=N({...R3.fields,credentialPath:j.check(U(1,4096)),descriptorVersion:A(1),endpoint:$3,kind:A(`maia.node-api.connection`),lifecycle:A(`ready`),lifecycleOwner:A(`desktop`),protocolVersion:iS,schemaVersion:A(ZD)}),e6=F([N({instanceId:J,kind:A(`node`)}),N({aggregateId:J,aggregateType:J,kind:A(`aggregate`)})]),gpe=P(e6).check(U(1,16),L(e=>new Set(e.map(e=>JSON.stringify(e))).size===e.length,{expected:`unique exact observation scopes`})),_pe=N({authentication:X3,kind:A(`subscribe`),messageId:J,operationId:A(`observe.events`),parameters:N({afterCursor:k(J3),maxBatchRecords:V.check(Ly(0),Ry(64)),scopes:gpe}),protocolVersion:iS,schemaVersion:A(ZD)}),t6=N({aggregateId:J,aggregateType:J,revision:q}),n6=N({aggregateId:J,aggregateRevision:q,aggregateType:J,eventCursor:q,eventType:J,recordedAt:dpe,schemaVersion:A(`maia.node-observation/v1`)}),r6=N({coverage:I([`complete`,`filtered`]),cursor:J3,eventCursor:q,instanceId:J,policyRevision:q,principalId:J,scopeDigest:q3}),i6={correlationId:J,operationId:A(`observe.events`),protocolVersion:iS,schemaVersion:A(ZD),sequence:q,streamId:J},vpe=F([N({...i6,checkpoint:r6,data:N({aggregates:P(t6).check(H(256))}),kind:A(`snapshot`),sequence:A(`0`),terminal:A(!1)}),N({...i6,checkpoint:r6,data:N({records:P(n6).check(U(1,64))}),kind:A(`event`),terminal:A(!1)}),N({...i6,checkpoint:r6,data:upe,kind:A(`heartbeat`),terminal:A(!1)}),N({...i6,checkpoint:r6,data:N({headEventCursor:q,oldestAvailableEventCursor:q,reason:I([`backpressure`,`cursor_expired`]),recovery:A(`resubscribe-without-cursor`)}),kind:A(`gap`),terminal:A(!0)}),N({...i6,data:N({current:N({instanceId:J,policyRevision:q,principalId:J,scopeDigest:q3}),reason:I([`cursor_invalid`,`epoch_changed`,`policy_changed`,`policy_revoked`,`principal_changed`,`scope_changed`]),recovery:A(`reauthenticate-and-resnapshot`)}),kind:A(`reset`),terminal:A(!0)}),N({...i6,data:N({error:lS}),kind:A(`error`),terminal:A(!0)}),N({...i6,checkpoint:r6,data:N({reason:I([`client_closed`,`completed`,`server_shutdown`])}),kind:A(`summary`),terminal:A(!0)})]);G(M3);var ype=G(Xfe),a6=G(F3),bpe=new Set(uO);new Set(cO.filter(e=>!bpe.has(e))),G(Zfe),G(I3),G(Qfe);var xpe=G(H3),Spe=G(U3),Cpe=G(W3),wpe=G(G3);G(K3),G(lpe),G(X3),G(ppe),G($3),G(mpe),G(hpe),G(e6),G(_pe),G(t6),G(n6),G(r6),G(vpe),G(P3),G(oM),G(sM),G(bM);var Tpe=G(DM);G(FM);var Epe=G(IM);G(LM);var Dpe=G(RM);G(gM),G(rM),G(nM),G(_M),G(vM),G(yM);var Ope=G(wM),o6=G(TM),kpe=G(EM);G(SM),G(kM),G(CM),G(AM),G(jM);var Ape=G(PM),jpe=new WeakMap,Mpe=`A session.resume carries a parent claim that resumeSupervised did not make for it.`,s6=(e,t)=>typeof e==`object`&&e?Reflect.get(e,t):void 0,Npe=(e,t)=>{let n=s6(e,`parameters`);if(s6(e,`method`)!==`session.resume`||s6(n,`parent`)===void 0)return!0;let r=s6(s6(t,`parameters`),`parent`);return typeof r==`object`&&!!r&&jpe.get(r)===s6(n,`sessionId`)},Ppe=(e,t)=>{if(e instanceof W)return e;let n=t?.aborted??!1;return new W(n?`cancelled`:`transport_failure`,n?`The Maia request was cancelled.`:`The Maia transport request failed.`,{cause:e})},c6=e=>({request:(t,n)=>Of({catch:e=>Ppe(e,n?.signal),try:()=>e.request(t,n)})}),Fpe=e=>If({catch:e=>new W(`invalid_request`,`The Maia request failed runtime validation.`,{cause:e}),try:()=>{let t={kind:`request`,messageId:e.messageId,payload:e.inputSchema.parse(e.payload),protocolVersion:eS};return qO.parse(t),t}}).pipe(ap(({payload:t})=>Npe(t,e.payload),()=>new W(`invalid_request`,Mpe))),l6=(e,t)=>e.correlationId===t?Af:E(new W(`correlation_mismatch`,`The Maia response did not match the request message.`)),Ipe=(e,t)=>{let n=YO.safeParse(e);if(!n.success)return Af;let{error:r}=n.data.payload;return l6(n.data,t).pipe(zf(kf(()=>{let e=ype.safeParse(r.code);return E(new W(e.success?e.data:`remote_error`,r.message,{remoteError:r}))})))},Lpe=(e,t)=>If({catch:e=>new W(`invalid_response`,`The Maia response envelope failed runtime validation.`,{cause:e}),try:()=>JO.parse(e)}).pipe(Bf(e=>l6(e,t)),O(e=>e.payload.result)),Rpe=(e,t)=>If({catch:e=>new W(`invalid_response`,`The Maia response payload failed runtime validation.`,{cause:e}),try:()=>e.parse(t)}),zpe=()=>new W(`cancelled`,`The Maia request was cancelled.`),u6=(e,t)=>Mf(function*(){let n=yield*Fpe(t),{messageId:r,outputSchema:i,signal:a}=t;if(a?.aborted===!0)return yield*E(zpe());let o=yield*e.request(n,a===void 0?void 0:{signal:a});return yield*Ipe(o,r),yield*Rpe(i,yield*Lpe(o,r))}),Bpe=(e,t=!0)=>(n,r,{messageId:i,signal:a})=>u6(e,{inputSchema:t?a6:{parse:()=>n},messageId:i,outputSchema:r,payload:n,signal:a}),Vpe=(e,t)=>e instanceof W&&!Jne(e)&&(e.code===`invalid_response`||e.code===`correlation_mismatch`||e.code===`transport_failure`||e.code===`cancelled`&&!t)?new W(`outcome_unknown`,`The mutation result could not be verified. Reconcile the original command ID.`):e,d6=(e,t)=>kf(()=>{let n=t.signal?.aborted??!1;return qf(e,e=>Vpe(e,n))}),f6=e=>kf(()=>{try{return e()}catch(e){return e instanceof W?E(e):Ff(e)}}),Hpe=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>Ip(t(...e))])),Upe=e=>{let t=c6(e);return{request:e=>Ip(u6(t,e))}},p6=`~effect/http/HttpBody`,m6=`~effect/http/HttpBody/HttpBodyError`,Wpe=class extends ga(`HttpBodyError`){[m6]=m6},h6=class{[p6];constructor(){this[p6]=p6}[ct](){return this.toJSON()}toString(){return et(this,{ignoreToString:!0})}},Gpe=new class extends h6{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},g6=class extends h6{_tag=`Uint8Array`;contentType;contentLength;text;_body;constructor(e,t,n,r){super(),this._body=e,this.text=r,this.contentType=t,this.contentLength=n}get body(){return this._body??=Kpe(this.text)}toJSON(){return{_id:`effect/HttpBody`,_tag:`Uint8Array`,body:this.contentType.startsWith(`text/`)||this.contentType.endsWith(`json`)?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},_6=new TextEncoder,v6=globalThis.Buffer,Kpe=v6===void 0?e=>_6.encode(e):e=>v6.from(e,`utf8`),y6=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),v6!==void 0)return new g6(void 0,t??`text/plain`,v6.byteLength(e,`utf8`),e);let n=_6.encode(e);return new g6(n,t??`text/plain`,n.length,e)},qpe=(e,t)=>If({try:()=>y6(JSON.stringify(e),t??`application/json`),catch:e=>new Wpe({reason:{_tag:`JsonError`},cause:e})}),b6=`~effect/http/HttpClientError`,x6=class extends ga(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[b6]=b6;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},S6=e=>e.endsWith(`Error`)?e.slice(0,-5):e,C6=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,Jpe=class extends ga(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return C6(S6(this._tag),this.description,this.methodAndUrl)}},Ype=class extends ga(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return C6(S6(this._tag),this.description,this.methodAndUrl)}},w6=class extends ga(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return C6(S6(this._tag),this.description,e)}},Xpe=class extends ga(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return C6(S6(this._tag),this.description,e)}},Zpe=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],Qpe=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?Fm(Fm(e,`content-type`),`content-length`):(e=t.contentType===void 0?Fm(e,`content-type`):Pm(e,`content-type`,t.contentType),t.contentLength===void 0?Fm(e,`content-length`):Pm(e,`content-length`,t.contentLength.toString())),$pe=class extends ga(`UrlError`){},T6=(e,t,n)=>Qr({try:()=>{let r=new URL(e,eme());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,i)}return n!==void 0&&(r.hash=n),r},catch:e=>new $pe({cause:e})}),eme=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},E6=`~effect/http/HttpClientRequest`,tme=e=>de(e,E6),nme={[E6]:E6,...dt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:Ye(this.headers),body:this.body.toJSON()}},pipe(){return t(this,arguments)}};function D6(e,t,n,r,i,a){let o=Object.create(nme);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var rme=D6(`GET`,``,hee,nr(),Mm,Gpe),O6=e=>(t,n)=>ame(rme,{method:e,url:t,...n??void 0}),k6=O6(`POST`),ime=O6(`DELETE`),ame=i(2,(e,t)=>{let n=e;return t.method&&(n=ome(n,t.method)),t.url&&(n=lme(n,t.url)),t.headers&&(n=A6(n,t.headers)),t.urlParams&&(n=ume(n,t.urlParams)),t.hash&&(n=dme(n,t.hash)),t.body&&(n=M6(n,t.body)),t.accept&&(n=j6(n,t.accept)),t.acceptJson&&(n=cme(n)),n}),ome=i(2,(e,t)=>D6(t,e.url,e.urlParams,e.hash,e.headers,e.body)),sme=i(3,(e,t,n)=>D6(e.method,e.url,e.urlParams,e.hash,Pm(e.headers,t,n),e.body)),A6=i(2,(e,t)=>D6(e.method,e.url,e.urlParams,e.hash,uee(e.headers,t),e.body)),j6=i(2,(e,t)=>sme(e,`Accept`,t)),cme=j6(`application/json`),lme=i(2,(e,t)=>{if(typeof t==`string`)return D6(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=Hm(n.searchParams),i=cr(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,D6(e.method,n.toString(),r,i,e.headers,e.body)}),ume=i(2,(e,t)=>D6(e.method,e.url,Wm(e.urlParams,t),e.hash,e.headers,e.body)),dme=i(2,(e,t)=>D6(e.method,e.url,e.urlParams,rr(t),e.headers,e.body)),M6=i(2,(e,t)=>D6(e.method,e.url,e.urlParams,e.hash,Qpe(e.headers,t),t)),fme=i(e=>tme(e[0]),(e,t,n)=>M6(e,y6(t,n))),pme=i(2,(e,t)=>O(qpe(t),t=>M6(e,t)));function mme(e){let t=T6(e.url,e.urlParams,ur(e.hash));return ei(t)?rr(t.success):nr()}var N6=`~effect/http/HttpIncomingMessage`,hme=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Bp(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Bp(e.text)}catch{}let i={...t,headers:Ye(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},P6=`~effect/http/HttpClientResponse`,gme=(e,t)=>new _me(e,t),_me=class extends ft{[N6];[P6];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[N6]=N6,this[P6]=P6}toJSON(){return hme(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get url(){if(this.source.url)return this.source.url.split(`#`)[0];let e=mme(this.request);return ir(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Nm(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=bm(this.source.headers.getSetCookie())}get remoteAddress(){return nr()}get stream(){return this.source.body?jx({evaluate:()=>this.source.body,onError:e=>new x6({reason:new w6({request:this.request,response:this,cause:e})})}):Ax(new x6({reason:new Xpe({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return D(this.text,e=>If({try:()=>e===``?null:JSON.parse(e),catch:e=>new x6({reason:new w6({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=O(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return D(this.text,e=>If({try:()=>Hm(new URLSearchParams(e)),catch:e=>new x6({reason:new w6({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Of({try:()=>this.source.formData(),catch:e=>new x6({reason:new w6({request:this.request,response:this,cause:e})})}).pipe(Sp,Bp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Of({try:()=>this.source.arrayBuffer(),catch:e=>new x6({reason:new w6({request:this.request,response:this,cause:e})})}).pipe(Sp,Bp),this.arrayBufferBody}pipe(){return t(this,arguments)}},vme=e=>lee({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${or(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),F6=`~effect/http/HttpClient`,I6=mr(`effect/HttpClient`),yme=i(2,(e,t)=>L6(n=>t(e.postprocess(n)),e.preprocess)),L6=(e,t)=>{let n=Object.create(bme);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},bme={[F6]:F6,pipe(){return t(this,arguments)},...dt,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(Zpe.map(([e,t])=>[t,function(t,n){return this.execute(O6(e)(t,n))}]))},xme=e=>L6(t=>D(t,t=>Lf(n=>{let r=Dme.get(t),i=r??new AbortController,a=T6(t.url,t.urlParams,ur(t.hash));if($r(a))return E(new x6({reason:new Ype({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(Ta)||n.getRef(Sme)(t)){let a=e(t,o,i.signal,n);return r?a:Tp(e=>sp(e(a),{onSuccess(e){return R6.register(e,i),w(new z6(e,i))},onFailure(e){return Ou(e)&&i.abort(),Nf(e)}}))}return Op(n.getRef(Tme)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method),a.attribute(`server.address`,o.origin),o.port!==``&&a.attribute(`server.port`,+o.port),a.attribute(`url.full`,o.toString()),a.attribute(`url.path`,o.pathname),a.attribute(`url.scheme`,o.protocol.slice(0,-1));let s=o.search.slice(1);s!==``&&a.attribute(`url.query`,s);let c=n.getRef(Lm),l=n.getRef(Cme);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,Im(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(wme)?A6(t,vme(a)):t,Tp(s=>s(e(t,o,i.signal,n)).pipe(Ap(a,{captureStackTrace:!1}),sp({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);for(let t in e.headers)l(t,`response`)&&a.attribute(`http.response.header.${t}`,Im(t,c)?`<redacted>`:e.headers[t]);return r?w(e):(R6.register(e,i),w(new z6(e,i)))},onFailure(e){return!r&&Ou(e)&&i.abort(),Nf(e)}})))})})),w),Sme=Kr(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>c}),Cme=Kr(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>s}),wme=Kr(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:s}),Tme=Kr(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),Eme=e=>_d(I6)(up(t=>O(e,e=>yme(e,mp(e=>Wr(t,e)))))),R6=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),Dme=new WeakMap,z6=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[P6]=P6;[N6]=N6;applyInterrupt(e){return kf(()=>(R6.unregister(this.original),wp(e,()=>T(()=>{this.controller.abort()}))))}get request(){return this.original.request}get url(){return this.original.url}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return kx(()=>(R6.unregister(this.original),hne(this.original.stream,T(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[ct](){return this.original[ct]()}pipe(){return t(this,arguments)}},B6=Kr(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),V6=class extends mr()(`effect/http/FetchHttpClient/RequestInit`){},H6=Eme(w(xme((e,t,n,r)=>{let i=r.getRef(B6),a=Lr(r.context,V6)??{},o=a.headers?dee(Nm(a.headers),e.headers):e.headers;o[`content-length`]&&(o=Fm(o,`content-length`));let s=r=>O(Of({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:n}),catch:t=>new x6({reason:new Jpe({request:e,cause:t})})}),t=>gme(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return D(vne(e.body.stream),s)}return s(void 0)}))),Ome={cache:`no-store`,credentials:`same-origin`,redirect:`error`,referrerPolicy:`no-referrer`},U6=e=>(e===void 0?H6:H6.pipe(Cd(fd(B6,e)))).pipe(Cd(fd(V6,Ome))),W6=(e,t)=>new W(`transport_failure`,e,{cause:t}),G6=e=>or(e,{onNone:()=>({}),onSome:e=>({[iO]:e})}),kme=(e,t,n)=>If({catch:e=>W6(`The Maia Node API request failed runtime validation.`,e),try:()=>JSON.stringify(qO.parse(n))}).pipe(O(n=>k6(`${e}${rO}`).pipe(A6(G6(t)),fme(n,tO)))),Ame=e=>{let t=JO.safeParse(e);return t.success?t.data:YO.parse(e)},jme=e=>e.json.pipe(D(e=>If(()=>Ame(e))),qf(e=>new W(`invalid_response`,`The Maia Node API response failed runtime validation.`,{cause:e}))),Mme=`30 seconds`,K6=e=>e.pipe(ep({duration:Mme,orElse:()=>E(new W(`outcome_unknown`,`The Maia Node API request outcome is unknown.`))})),Nme=401,Pme=(e,t)=>Mf(function*(){let n=yield*I6,r=yield*kme(e.origin,cr(e.session?.()),t),i=yield*n.execute(r).pipe(qf(e=>W6(`The Maia Node API request failed.`,e)));return i.status===Nme&&(yield*T(()=>e.onSignedOut?.())),yield*jme(i)}).pipe(gp,K6),Fme=(e,t)=>Pme(e,t).pipe(dp(U6(e.fetch))),Ime=(e,t)=>e instanceof W?e:t?.aborted===!0?new W(`cancelled`,`The Maia Node API request was cancelled.`,{cause:e}):new W(`transport_failure`,`The Maia Node API transport failed.`,{cause:e}),Lme=e=>({request:(t,n)=>{let r=n?.signal;return Ip(Fme(e,t),r===void 0?void 0:{signal:r}).catch(e=>{throw Ime(e,r)})}});G(WH),G(HH);var Rme=G(GH);G(YH),G(qH);var zme=G(XH);G(eU),G(tU),G(nU),G(lU);var Bme=G(uU);G(dU);var Vme=G(fU);G(iU),G(aU),G(sU),G(cU),G(gU),G(Wle),G(_U),G(yU),G(bU);var Hme=G(xU);G(SU);var Ume=G(CU);G(wU);var Wme=G(TU);G(EU);var Gme=G(DU);G(EI),G(bI),G(yI),G(mI);var Kme=G(wI);G(hI);var qme=G(TI);G(DI);var Jme=G(OI);G(kI);var Yme=G(AI);G(jI);var Xme=G(PI);G(MI),G(FI);var Zme=G(II);G(RI),G(zI),G(BI);var Qme=G(VI);G(HI);var $me=G(UI);G(WI),G(GI);var q6=(e,t)=>{let n=[...new Set(t.operationIds)].sort();if(e.commandId!==t.commandId||e.sessionId!==t.sessionId||e.workspaceId!==t.workspaceId||e.expectedSessionRevision!==t.expectedSessionRevision||e.expectedWorkspaceRevision!==t.expectedWorkspaceRevision||e.definitionRef.key!==t.definitionRef.key||e.definitionRef.version!==t.definitionRef.version||e.definitionRef.contentDigest!==t.definitionRef.contentDigest||e.operationIds.length!==n.length||e.operationIds.some((e,t)=>e!==n[t]))throw new W(`invalid_response`,`The Agent permission response did not match the request.`);return e},ehe=(e,t)=>{let n=Ioe.parse(e);if(q6(n.grant,t),n.grant.inputDigest!==t.inputDigest)throw new W(`invalid_response`,`The Agent permission digest did not match the request.`);return n},the=e=>({confirmAgentPermission:(t,n)=>e({method:`session.agent-permission.confirm`,parameters:t},{parse:e=>ehe(e,t)},n),previewAgentPermission:(t,n)=>e({method:`session.agent-permission.preview`,parameters:t},{parse:e=>q6(Foe.parse(e),t)},n)}),J6=e=>{if(!e)throw new W(`invalid_response`,`The Agent response did not match the request.`)},Y6=e=>JSON.stringify(e,(e,t)=>typeof t!=`object`||!t||Array.isArray(t)?t:Object.fromEntries(Object.entries(t).toSorted(([e],[t])=>e.localeCompare(t)))),nhe=(e,t)=>Y6(e)===Y6(hB.parse(t)),rhe=(e,t)=>{let n=Mae.parse(e);return J6(n.items.length<=t.limit&&n.items.every(e=>e.projectId===t.projectId&&(t.state===void 0||e.state===t.state))),n},ihe=(e,t)=>{let n=Nae.parse(e);return J6(n.agent.id===t.agentId&&(t.revision===void 0||n.agent.revision===t.revision)),n},ahe=(e,t)=>{let n=Pae.parse(e);return J6(n.commandId===t.commandId&&nhe(n.change,t.change)),n},ohe=(e,t)=>e.kind===t.kind?t.kind===`create`?e.agent.projectId===t.projectId&&Y6(e.agent.spec)===Y6(t.spec):e.agent.id===t.agentId&&BigInt(e.agent.revision)===BigInt(t.expectedRevision)+1n&&(t.kind===`disable`||Y6(e.agent.spec)===Y6(t.spec)):!1,she=(e,t)=>{let n=Fae.parse(e);return J6(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&ohe(n,hB.parse(t.change))),n},che=e=>({confirmAgentChange:(t,n)=>d6(e({method:`agents.change.confirm`,parameters:t},{parse:e=>she(e,t)},n),n),previewAgentChange:(t,n)=>e({method:`agents.change.preview`,parameters:t},{parse:e=>ahe(e,t)},n)}),lhe=e=>({...che(e),detectAgents:(t,n)=>e({method:`agents.detect`,parameters:t},{parse:e=>jae.parse(e)},n),listAgents:(t,n)=>e({method:`agents.list`,parameters:t},{parse:e=>rhe(e,t)},n),showAgent:(t,n)=>e({method:`agents.show`,parameters:t},{parse:e=>ihe(e,t)},n)}),X6=e=>{if(!e)throw new W(`invalid_response`,`The approval response did not match the request.`)},uhe=(e,t)=>{let n=Lae.parse(e);return X6(n.items.length<=t.limit&&n.items.every(e=>(t.sessionId===void 0||e.sessionId===t.sessionId)&&(t.pendingOnly===!1||e.status===`pending`))),n},dhe=(e,t)=>{let n=Rae.parse(e);return X6(n.approval.approvalId===t.approvalId),n},Z6=(e,t,n)=>t.decision===`answer`?e===`answered`:t.decision===`deny`?e===`denied`:e===`approved`&&n===(t.decision===`approve_for_session`),fhe=(e,t)=>{let n=zae.parse(e),{approval:r,commandId:i}=n;return X6(i===t.commandId&&r.approvalId===t.approvalId&&r.requestDigest===t.requestDigest&&Z6(r.status,t,r.resolution?.forSession===!0)),n},phe=e=>({listApprovals:(t,n)=>e({method:`approval.list`,parameters:t},{parse:e=>uhe(e,t)},n),respondToApproval:(t,n)=>d6(e({method:`approval.respond`,parameters:t},{parse:e=>fhe(e,t)},n),n),showApproval:(t,n)=>e({method:`approval.show`,parameters:t},{parse:e=>dhe(e,t)},n)}),Q6=e=>{if(!e)throw new W(`invalid_response`,`The board response did not match the request.`)},$6=(e,t)=>BigInt(e.revision)===BigInt(t)+1n,e8=(e,t)=>e===t||e.startsWith(`${t}/`),t8=(e,t)=>(e??[]).join(`
|
|
15
|
+
`)===(t??[]).join(`
|
|
16
|
+
`),mhe=(e,t)=>{let n=Vae.parse(e);return Q6(n.commandId===t.commandId&&n.task.workspaceId===t.workspaceId&&n.task.path===t.path&&n.task.text===t.text&&t8(n.task.needs,t.needs)),n},hhe=(e,t)=>{let n=Zae.parse(e);return Q6(n.commandId===t.commandId&&n.tasks.length===t.tasks.length&&n.tasks.every((e,n)=>e.key===t.tasks[n]?.key&&e.path===t.tasks[n].path)),n},ghe=(e,t)=>{let n=e.claim?.claimant;return n!==void 0&&(t===void 0||n.kind===`session`&&n.agent===t)},_he=(e,t)=>{let n=Hae.parse(e),{commandId:r,task:i}=n,a=t.taskId===void 0?i.workspaceId===t.workspaceId&&e8(i.path,t.path??``):i.id===t.taskId&&$6(i,t.expectedRevision??`0`);return Q6(r===t.commandId&&a&&ghe(i,t.as)),n},n8=e=>(t,n)=>{let r=e.parse(t);return Q6(r.commandId===n.commandId&&r.task.id===n.taskId&&$6(r.task,n.expectedRevision)),r},vhe=n8(Uae),yhe=n8(Wae),bhe=n8(Gae),xhe=n8(Kae),She=n8(qae),Che=n8(Jae),whe=(e,t)=>{let n=n8(Qae)(e,t);return Q6(n.task.assignee===t.assignee),n},The=(e,t)=>{let n=$ae.parse(e);return Q6(n.commandId===t.commandId&&n.task.id===t.threadId&&n.task.workspaceId===t.workspaceId&&t8(n.task.needs,t.needs)),n},Ehe=(e,t)=>{let n=n8(eoe)(e,t);return Q6(t8(n.task.needs,t.needs)),n},Dhe=(e,{projectId:t,sessionId:n})=>{if(t===void 0&&n===void 0)return!0;let r=e.claim?.claimant;return r?.kind===`session`&&r.sessionId!==void 0&&(n===void 0||r.sessionId===n)},Ohe=(e,t)=>{let n=Yae.parse(e);return Q6(n.items.length<=(t.limit??n.items.length)&&n.items.every(e=>(t.workspaceId===void 0||e.workspaceId===t.workspaceId)&&(t.state===void 0||e.state===t.state)&&(t.path===void 0||e8(e.path,t.path))&&Dhe(e,t))),n},khe=(e,t)=>{let n=Xae.parse(e);return Q6(n.task.id===t.taskId&&n.messages.length<=(t.limit??n.messages.length)),n},r8=(e,t)=>t===void 0||e?.kind===`session`&&e.agent===t,Ahe=(e,t)=>{let n=toe.parse(e);return Q6(n.commandId===t.commandId&&n.thread.path===t.path&&n.message.text===t.text&&r8(n.message.author,t.as)),n},jhe=(e,t)=>{let n=noe.parse(e);return Q6(n.commandId===t.commandId&&n.message.threadId===t.threadId&&n.message.text===t.text&&r8(n.message.author,t.as)),n},Mhe=(e,t)=>{let n=roe.parse(e);return Q6(n.items.length<=(t.limit??n.items.length)&&r8(n.actor,t.as)&&n.items.every(e=>e.workspaceId===t.workspaceId&&e8(e.path,t.path))),n},Nhe=(e,t)=>{let n=ioe.parse(e);return Q6(n.thread.id===t.threadId&&n.messages.length<=(t.limit??n.messages.length)&&r8(n.actor,t.as)),n},Phe=e=>({postBoardMessage:(t,n)=>e({method:`board.message.post`,parameters:t},{parse:e=>Ahe(e,t)},n),replyToBoardMessage:(t,n)=>e({method:`board.message.reply`,parameters:t},{parse:e=>jhe(e,t)},n)}),Fhe=e=>({readBoardPath:(t,n)=>e({method:`board.path.read`,parameters:t},{parse:e=>Mhe(e,t)},n),showBoardThread:(t,n)=>e({method:`board.thread.show`,parameters:t},{parse:e=>Nhe(e,t)},n)}),Ihe=e=>({claimBoardTask:(t,n)=>e({method:`board.task.claim`,parameters:t},{parse:e=>_he(e,t)},n),createBoardTask:(t,n)=>e({method:`board.task.create`,parameters:t},{parse:e=>mhe(e,t)},n),planBoardTasks:(t,n)=>e({method:`board.task.plan`,parameters:t},{parse:e=>hhe(e,t)},n)}),Lhe=e=>({completeBoardTask:(t,n)=>e({method:`board.task.complete`,parameters:t},{parse:e=>bhe(e,t)},n),failBoardTask:(t,n)=>e({method:`board.task.fail`,parameters:t},{parse:e=>xhe(e,t)},n),...Rhe(e)}),Rhe=e=>({releaseBoardTask:(t,n)=>e({method:`board.task.release`,parameters:t},{parse:e=>yhe(e,t)},n),renewBoardTask:(t,n)=>e({method:`board.task.renew`,parameters:t},{parse:e=>vhe(e,t)},n)}),zhe=e=>({cancelBoardTask:(t,n)=>e({method:`board.task.cancel`,parameters:t},{parse:e=>She(e,t)},n),reopenBoardTask:(t,n)=>e({method:`board.task.reopen`,parameters:t},{parse:e=>Che(e,t)},n)}),Bhe=e=>({assignBoardTask:(t,n)=>e({method:`board.task.assign`,parameters:t},{parse:e=>whe(e,t)},n),promoteBoardThread:(t,n)=>e({method:`board.task.promote`,parameters:t},{parse:e=>The(e,t)},n),replaceBoardTaskNeeds:(t,n)=>e({method:`board.task.needs.replace`,parameters:t},{parse:e=>Ehe(e,t)},n)}),Vhe=e=>{let t=(t,n,r)=>d6(e(t,n,r),r);return{...Ihe(t),...Lhe(t),...zhe(t),...Bhe(t),...Phe(t),...Fhe(e),listBoardTasks:(t,n)=>e({method:`board.task.list`,parameters:t},{parse:e=>Ohe(e,t)},n),showBoardTask:(t,n)=>e({method:`board.task.show`,parameters:t},{parse:e=>khe(e,t)},n)}},i8=[[`session.fork.preview`,`none`],[`session.fork.confirm`,`command-id`],[`session.switch.preview`,`none`],[`session.switch.confirm`,`command-id`],[`session.placement.show`,`none`],[`session.setup.preview`,`none`],[`session.setup.confirm`,`command-id`],[`session.rename`,`command-id`],[`session.git.status`,`none`],[`turn.steer.preview`,`none`],[`turn.steer.confirm`,`command-id`],[`session.spawn.preview`,`none`],[`session.spawn.confirm`,`command-id`],[`session.spawn.record`,`command-id`],[`session.spawn-caps.show`,`none`],[`session.spawn-caps.preview`,`none`],[`session.spawn-caps.confirm`,`command-id`],[`workspace.branches.list`,`none`],[`workspace.code-host.show`,`none`],[`connection.executors.list`,`none`],[`connection.executors.show`,`none`],[`session.detach.preview`,`none`],[`session.detach.confirm`,`command-id`],[`reference.resolve`,`none`],[`events.read`,`none`],[`session.pause.preview`,`none`],[`session.pause.confirm`,`command-id`],[`session.command.list`,`none`],[`session.command.send`,`command-id`],[`session.command.preview`,`none`],[`session.command.confirm`,`command-id`]];i8.map(([e])=>e);var Hhe=(e,t)=>e.method===t,a8=(e,t)=>typeof e==`object`&&e?Reflect.get(e,t):void 0,Uhe=(e,t)=>e===tN.type?tN.id:e===Pse?a8(t,`sessionId`):e===`session-child`?a8(t,`childSessionId`):void 0,Whe=(e,t,n)=>{let r=a8(t,`commandId`);if(r===void 0)return!0;let i=a8(n,`receipt`);if(i===void 0)return a8(n,`commandId`)===r;let a=a8(i,`target`),o=a8(a,`type`);if(typeof o!=`string`)return!1;let s=a8(i,`method`)===e?a8(t,`${o}Id`)??Uhe(o,t):a8(a8(n,o),`id`);return a8(i,`commandId`)===r&&typeof s==`string`&&a8(a,`id`)===s},Ghe=({idempotency:e,method:t,parameters:n},r)=>{let i=wpe.parse(r);if(Hhe(i,t)&&(e!==`command-id`||Whe(t,n,i)))return i;throw new W(`invalid_response`,`The ${t} response did not match the request.`)},o8=(e,t)=>new W(`invalid_request`,`The Maia request for ${e} failed runtime validation.`,{cause:t}),Khe=e=>({call:(t,n,r)=>{let i=i8.find(([e])=>e===t)?.[1],a=a6.safeParse({method:t,parameters:n});if(!a.success)return E(o8(t,a.error));if(i===void 0)return E(o8(t));let o=e(a.data,{parse:e=>Ghe({idempotency:i,method:t,parameters:n},e)},r);return i===`command-id`?d6(o,r):o}}),s8=e=>{if(!e)throw new W(`invalid_response`,`The connection response did not match the request.`)},qhe=(e,t)=>{let n=uoe.parse(e),r=n.connection;return s8(n.commandId===t.commandId&&r.name===t.name&&r.executor===t.executor&&r.configRoot.kind===t.configRootKind&&(t.maxConcurrentSessions===void 0||r.maxConcurrentSessions===t.maxConcurrentSessions)),n},Jhe=(e,t)=>{let n=moe.parse(e),r=n.connection;return s8(n.commandId===t.commandId&&r.name===t.name&&r.gateway?.baseUrl===t.baseUrl&&r.gateway.keyEnv===t.apiKeyEnv&&n.keyCustody===`referenced`==(t.apiKeyEnv!==void 0)&&(t.maxConcurrentSessions===void 0||r.maxConcurrentSessions===t.maxConcurrentSessions)),n},Yhe=(e,t)=>{let n=hoe.parse(e);return s8(n.connectionId===t.connectionId),n},Xhe=(e,t)=>{let n=doe.parse(e);return s8(n.items.length<=t.limit&&(n.nextCursor===void 0||n.nextCursor!==t.afterCursor)),n},Zhe=(e,t)=>{let n=foe.parse(e);return s8(n.connection.connectionId===t.connectionId),n},Qhe=(e,t)=>{let n=poe.parse(e);return s8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision&&n.connection.state===t.state),n},$he=(e,t)=>{let n=loe.parse(e);return s8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision&&n.connection.maxConcurrentSessions===t.maxConcurrentSessions),n},ege=(e,t)=>{let n=soe.parse(e);return s8(n.connection.connectionId===t.connectionId),n},tge=(e,t)=>e.commandId===t.commandId&&e.connection.connectionId===t.connectionId&&e.expectedRevision===t.expectedRevision,nge=(e,t)=>{let n=coe.parse(e);return s8(tge(n,t)&&t.flow===`browser`==(n.login.authUrl!==void 0)),n},rge=(e,t)=>{let n=_oe.parse(e);return s8(n.commandId===t.commandId),n},ige=(e,t)=>{let n=voe.parse(e);return s8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest),n},age=(e,t)=>{let n=boe.parse(e);return s8(n.commandId===t.commandId&&n.executor===t.executor&&n.policy===t.policy),n},oge=(e,t)=>{let n=xoe.parse(e);return s8(n.commandId===t.commandId&&n.executor===t.executor&&n.inputDigest===t.inputDigest&&n.policy===t.policy),n},sge=(e,t)=>({confirmConnectionUpkeep:(e,n)=>t({method:`connection.upkeep.confirm`,parameters:e},{parse:t=>oge(t,e)},n),previewConnectionUpkeep:(t,n)=>e({method:`connection.upkeep.preview`,parameters:t},{parse:e=>age(e,t)},n),refreshConnectionUpkeep:(t,n)=>e({method:`connection.upkeep.refresh`,parameters:t},{parse:e=>yoe.parse(e)},n)}),cge=(e,t)=>({confirmSystemConnections:(e,n)=>t({method:`connection.system.confirm`,parameters:e},{parse:t=>ige(t,e)},n),detectConnections:(t,n)=>e({method:`connection.detect`,parameters:t},{parse:e=>goe.parse(e)},n),previewSystemConnections:(t,n)=>e({method:`connection.system.preview`,parameters:t},{parse:e=>rge(e,t)},n)}),lge=e=>({listConnections:(t,n)=>e({method:`connection.list`,parameters:t},{parse:e=>Xhe(e,t)},n),showConnection:(t,n)=>e({method:`connection.show`,parameters:t},{parse:e=>Zhe(e,t)},n),showConnectionUsage:(t,n)=>e({method:`connection.usage.show`,parameters:t},{parse:e=>ege(e,t)},n)}),uge=e=>({createConnection:(t,n)=>e({method:`connection.create`,parameters:t},{parse:e=>qhe(e,t)},n),setConnectionCapacity:(t,n)=>e({method:`connection.capacity.set`,parameters:t},{parse:e=>$he(e,t)},n),setConnectionState:(t,n)=>e({method:`connection.state.set`,parameters:t},{parse:e=>Qhe(e,t)},n)}),dge=e=>({startConnectionLogin:(t,n)=>e({method:`connection.login.start`,parameters:t},{parse:e=>nge(e,t)},n)}),fge=(e,t)=>({createGatewayConnection:(e,n)=>t({method:`connection.gateway.create`,parameters:e},{parse:t=>Jhe(t,e)},n),listConnectionModels:(t,n)=>e({method:`connection.models.list`,parameters:t},{parse:e=>Yhe(e,t)},n)}),c8=(e,t)=>e.kind===t.kind&&e.id===t.id,l8=(e,t)=>{let n=t.toSorted();return e.length===t.length&&e.toSorted().every((e,t)=>e===n[t])},u8=(e,t)=>e.items.length<=t.limit&&(e.nextCursor===void 0||e.nextCursor!==t.afterCursor)&&e.items.every(e=>t.scope===void 0||c8(e.scope,t.scope)),pge=(e,t)=>{let n=Soe.parse(e);return s8(u8(n,t)&&n.items.every(e=>(t.connectionId===void 0||e.connectionId===t.connectionId)&&(t.state===void 0||e.state===t.state))),n},mge=(e,t)=>{let n=Coe.parse(e);return s8(n.commandId===t.commandId&&n.connectionId===t.connectionId&&n.granted===t.granted&&c8(n.scope,t.scope)),n},hge=(e,t)=>{let n=woe.parse(e);return s8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.expectedRevision===t.expectedRevision&&n.grant.connectionId===t.connectionId&&c8(n.grant.scope,t.scope)&&n.grant.state===`active`===t.granted),n},gge=(e,t)=>{let n=Toe.parse(e);return s8(u8(n,t)),n},_ge=(e,t)=>{let n=Eoe.parse(e);return s8(n.commandId===t.commandId&&n.mode===t.mode&&l8(n.members,t.members)&&c8(n.scope,t.scope)),n},vge=(e,t)=>{let n=Doe.parse(e);return s8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.expectedRevision===t.expectedRevision&&n.pool.mode===t.mode&&l8(n.pool.members,t.members)&&c8(n.pool.scope,t.scope)),n},yge=(e,t)=>({confirmConnectionGrant:(e,n)=>t({method:`connection.grant.set.confirm`,parameters:e},{parse:t=>hge(t,e)},n),listConnectionGrants:(t,n)=>e({method:`connection.grant.list`,parameters:t},{parse:e=>pge(e,t)},n),previewConnectionGrant:(t,n)=>e({method:`connection.grant.set.preview`,parameters:t},{parse:e=>mge(e,t)},n)}),bge=(e,t)=>({confirmConnectionPool:(e,n)=>t({method:`connection.pool.set.confirm`,parameters:e},{parse:t=>vge(t,e)},n),listConnectionPools:(t,n)=>e({method:`connection.pool.list`,parameters:t},{parse:e=>gge(e,t)},n),previewConnectionPool:(t,n)=>e({method:`connection.pool.set.preview`,parameters:t},{parse:e=>_ge(e,t)},n)}),xge=e=>{let t=(t,n,r)=>d6(e(t,n,r),r);return{...yge(e,t),...bge(e,t),...lge(e),...uge(t),...dge(t),...fge(e,t),...cge(e,t),...sge(e,t)}},d8=e=>{if(!e)throw new W(`invalid_response`,`The container response did not match the request.`)},f8=(e,t)=>{d8(e.commandId===t.commandId&&e.name===t.name.trim())},p8=(e,t)=>{d8(e.commandId===t.commandId&&e.inputDigest===t.inputDigest&&e.container.name===t.name.trim())},Sge=(e,t)=>{let n=Moe.parse(e);return p8(n,t),n},Cge=(e,t)=>{let n=Poe.parse(e);return p8(n,t),d8(n.container.id===t.containerId&&n.expectedRevision===t.expectedRevision),n},wge=(e,t)=>{let n=joe.parse(e);return f8(n,t),n},Tge=(e,t)=>{let n=Noe.parse(e);return f8(n,t),d8(n.containerId===t.containerId&&n.expectedRevision===t.expectedRevision),n},Ege=(e,t)=>{let n=Ooe.parse(e);return d8(n.items.length<=t.limit),n},Dge=(e,t)=>{let n=Aoe.parse(e);return d8(n.items.reduce((e,t)=>e+Math.max(t.projects.length,1),0)<=t.limit),n},Oge=(e,t)=>{let n=koe.parse(e);return d8(n.container.id===t.containerId&&n.projects.length<=t.limit),n},kge=e=>({confirmContainerCreate:(t,n)=>e({method:`container.create.confirm`,parameters:t},{parse:e=>Sge(e,t)},n),confirmContainerRename:(t,n)=>e({method:`container.rename.confirm`,parameters:t},{parse:e=>Cge(e,t)},n)}),Age=e=>({listContainerIndex:(t,n)=>e({method:`container.index.list`,parameters:t},{parse:e=>Dge(e,t)},n),listContainers:(t,n)=>e({method:`container.list`,parameters:t},{parse:e=>Ege(e,t)},n)}),jge=e=>({previewContainerCreate:(t,n)=>e({method:`container.create.preview`,parameters:t},{parse:e=>wge(e,t)},n),previewContainerRename:(t,n)=>e({method:`container.rename.preview`,parameters:t},{parse:e=>Tge(e,t)},n)}),Mge=e=>({showContainer:(t,n)=>e({method:`container.show`,parameters:t},{parse:e=>Oge(e,t)},n)}),Nge=e=>({...kge(e),...jge(e),...Age(e),...Mge(e)}),m8=e=>{if(!e)throw new W(`invalid_response`,`The discovery response did not match the request.`)},Pge=(e,{adopted:t,observed:n})=>(t===void 0||e.adoptedSessionId!==void 0==(t===`only`))&&(n===void 0||e.observed===n),Fge=(e,t)=>{let n=mse.parse(e);return m8(n.items.length<=t.limit&&n.includesContentFields===(t.includeContentFields===!0)&&n.items.every(e=>e.sources.every(e=>t.sources.includes(e))&&Pge(e,t))&&(n.truncatedSources??[]).every(e=>t.sources.includes(e))),n},Ige=(e,t)=>{let n=hse.parse(e),r=t.target;return m8(n.messages.length<=t.limit&&n.offset===(t.offset??0)&&(r.kind===`session`||n.executor===r.executor&&n.nativeId===r.nativeId)),n},Lge=(e,t)=>JSON.stringify(Object.entries(e??{}).toSorted())===JSON.stringify(Object.entries(t??{}).toSorted()),Rge=(e,t)=>e.commandId===t.commandId&&e.executor===t.executor&&e.nativeId===t.nativeId&&(t.workspaceId===void 0||e.workspaceId===t.workspaceId)&&(e.writer!==`external`||t.attach===!0)&&e.attestEnded===(t.attestEnded===!0)&&e.role===t.role&&(t.title===void 0||e.title===t.title)&&Lge(e.labels,t.labels),zge=(e,t)=>{if(typeof e==`object`&&e&&`alreadyAdopted`in e){let n=_se.parse(e);return m8(n.executor===t.executor&&n.nativeId===t.nativeId),n}let n=gse.parse(e);return m8(Rge(n,t)),n},Bge=e=>(t,n)=>d6(e({method:`session.adopt.confirm`,parameters:t},{parse:e=>vse.parse(e)},n),n),Vge=e=>({confirmSessionAdopt:Bge(e),listDiscoveredSessions:(t,n)=>e({method:`discovery.sessions.list`,parameters:t},{parse:e=>Fge(e,t)},n),previewSessionAdopt:(t,n)=>e({method:`session.adopt.preview`,parameters:t},{parse:e=>zge(e,t)},n),readSessionHistory:(t,n)=>e({method:`session.history.read`,parameters:t},{parse:e=>Ige(e,t)},n)}),Hge=e=>({applyExecutionRelocation:(t,n)=>e({method:`execution.relocation.apply`,parameters:t},Ume,n),planExecutionRelocation:(t,n)=>e({method:`execution.relocation.plan`,parameters:t},Hme,n),reconcileExecutionRelocation:(t,n)=>e({method:`execution.relocation.reconcile`,parameters:t},Gme,n),showExecutionRelocation:(t,n)=>e({method:`execution.relocation.show`,parameters:t},Wme,n)}),h8=e=>{if(!e)throw new W(`invalid_response`,`The GitHub response did not match the request.`)},g8=e=>e.map(e=>e.toLowerCase()).toSorted(),Uge=(e,t)=>{let n=FW.parse(e);return h8(n.commandId===t.commandId&&n.connection.name===t.name&&n.connection.appId===t.appId&&n.connection.installationId===t.installationId),n},Wge=(e,t)=>{let n=IW.parse(e);return h8(t.connectionId===void 0||n.connections.length<=1&&n.connections.every(({connectionId:e})=>e===t.connectionId)),n},Gge=(e,t)=>{let n=LW.parse(e);return h8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision),n},Kge=(e,t)=>{let n=RW.parse(e);return h8(n.commandId===t.commandId&&n.link.connectionId===t.connectionId&&n.link.sessionId===t.sessionId&&n.link.number===t.number&&n.link.repository.toLowerCase()===t.repository.toLowerCase()),n},qge=(e,t)=>{let n=zW.parse(e);return h8(n.sessionId===t.sessionId),n},Jge=(e,t)=>{let n=BW.parse(e);return h8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.link.linkId===t.linkId&&n.link.watching===t.watching&&g8(n.link.allowedAuthors).join(`,`)===g8(t.allowedAuthors).join(`,`)),n},Yge=e=>({createGithubConnection:(t,n)=>d6(e({method:`connection.github.create`,parameters:t},{parse:e=>Uge(e,t)},n),n),revokeGithubConnection:(t,n)=>d6(e({method:`connection.github.revoke`,parameters:t},{parse:e=>Gge(e,t)},n),n)}),Xge=e=>({linkPullRequest:(t,n)=>d6(e({method:`pr.link`,parameters:t},{parse:e=>Kge(e,t)},n),n),showPullRequestStatus:(t,n)=>e({method:`pr.status`,parameters:t},{parse:e=>qge(e,t)},n)}),Zge=e=>({...Yge(e),...Xge(e),showGithubConnections:(t,n)=>e({method:`connection.github.show`,parameters:t},{parse:e=>Wge(e,t)},n),watchPullRequest:(t,n)=>d6(e({method:`pr.watch`,parameters:t},{parse:e=>Jge(e,t)},n),n)}),_8=e=>{if(!e)throw new W(`invalid_response`,`The goal response did not match the request.`)},Qge=(e,t)=>{let n=Ise.parse(e);return _8(n.commandId===t.commandId&&n.goal.sessionId===t.sessionId&&n.goal.text===t.text&&n.goal.dod.length===(t.dod?.length??0)),n},$ge=(e,t)=>{let n=Bse.parse(e);return _8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.dod[t.line-1]?.done?.evidence===t.evidence),n},e_e=(e,t)=>{let n=Vse.parse(e);return _8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.state===t.state),n},t_e=(e,t)=>{let n=Lse.parse(e);return _8(n.sessionId===t.sessionId),n},n_e=(e,t)=>{let n=Rse.parse(e);return _8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.text===t.text),n},r_e=(e,t)=>{let n=zse.parse(e);return _8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.sessionId===t.sessionId),n},i_e=e=>(t,n)=>d6(e({method:`goal.clear`,parameters:t},{parse:e=>r_e(e,t)},n),n),a_e=e=>(t,n)=>d6(e({method:`goal.mark`,parameters:t},{parse:e=>$ge(e,t)},n),n),o_e=e=>(t,n)=>d6(e({method:`goal.transition`,parameters:t},{parse:e=>e_e(e,t)},n),n),s_e=e=>(t,n)=>d6(e({method:`goal.set`,parameters:t},{parse:e=>Qge(e,t)},n),n),c_e=e=>(t,n)=>d6(e({method:`goal.update`,parameters:t},{parse:e=>n_e(e,t)},n),n),l_e=e=>({clearGoal:i_e(e),markGoal:a_e(e),setGoal:s_e(e),showGoal:(t,n)=>e({method:`goal.show`,parameters:t},{parse:e=>t_e(e,t)},n),transitionGoal:o_e(e),updateGoal:c_e(e)}),v8=e=>{if(!e)throw new W(`invalid_response`,`The hold response did not match the request.`)},y8=e=>e.map(e=>`${e.kind}:${e.id}`).toSorted().join(`
|
|
17
|
+
`),b8=(e,t)=>e.commandId===t.commandId&&e.reason===t.reason.trim()&&e.running===t.running&&y8(e.targets)===y8(t.targets),u_e=(e,t)=>{let n=ZW.parse(e);return v8(b8(n,t)),n},d_e=(e,t)=>{let n=QW.parse(e);return v8(n.inputDigest===t.inputDigest&&b8({...n.hold,commandId:n.commandId},t)),n},f_e=(e,t)=>{let n=$W.parse(e);return v8(n.commandId===t.commandId&&n.holdId===t.holdId&&n.expectedRevision===t.expectedRevision),n},p_e=(e,t)=>{let n=eG.parse(e);return v8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.hold.id===t.holdId&&n.expectedRevision===t.expectedRevision),n},m_e=(e,t)=>{let n=XW.parse(e);return v8(n.items.length<=t.limit&&n.items.every(e=>t.state===void 0||e.state===t.state)),n},h_e=e=>({confirmHoldPlace:(t,n)=>d6(e({method:`hold.place.confirm`,parameters:t},{parse:e=>d_e(e,t)},n),n),previewHoldPlace:(t,n)=>e({method:`hold.place.preview`,parameters:t},{parse:e=>u_e(e,t)},n)}),g_e=e=>({confirmHoldRelease:(t,n)=>d6(e({method:`hold.release.confirm`,parameters:t},{parse:e=>p_e(e,t)},n),n),previewHoldRelease:(t,n)=>e({method:`hold.release.preview`,parameters:t},{parse:e=>f_e(e,t)},n)}),__e=e=>({...h_e(e),...g_e(e),listHolds:(t,n)=>e({method:`hold.list`,parameters:t},{parse:e=>m_e(e,t)},n)}),x8=e=>{if(!e)throw new W(`invalid_response`,`The inbox response did not match the request.`)},v_e=(e,t)=>{let n=jG.parse(e),r=t.state??`open`;return x8(n.items.length<=t.limit&&n.items.every(e=>e.state===r)),n},y_e=(e,t)=>{let n=MG.parse(e);return x8(n.item.itemId===t.itemId),n},b_e=(e,t)=>{if(`approval`in e){let{approval:n}=e;return n.requestDigest===t.requestDigest&&Z6(n.status,t,n.resolution?.forSession===!0)}let{confirmation:n}=e;return n.requestDigest===t.requestDigest&&n.status===(t.decision===`approve`?`confirmed`:`denied`)},x_e=(e,t)=>{let n=NG.parse(e);return x8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&b_e(n,t)),n},S_e=(e,t)=>{let n=PG.parse(e);return x8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&n.item.state===`settled`),n},C_e=(e,t)=>{let n=FG.parse(e);return x8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&n.item.state===`snoozed`&&n.item.snoozedUntil===t.until),n},w_e=e=>({listInbox:(t,n)=>e({method:`inbox.list`,parameters:t},{parse:e=>v_e(e,t)},n),showInboxItem:(t,n)=>e({method:`inbox.show`,parameters:t},{parse:e=>y_e(e,t)},n)}),T_e=e=>({respondToInboxItem:(t,n)=>d6(e({method:`inbox.respond`,parameters:t},{parse:e=>x_e(e,t)},n),n)}),E_e=e=>({settleInboxItem:(t,n)=>d6(e({method:`inbox.settle`,parameters:t},{parse:e=>S_e(e,t)},n),n),snoozeInboxItem:(t,n)=>d6(e({method:`inbox.snooze`,parameters:t},{parse:e=>C_e(e,t)},n),n)}),D_e=e=>({...w_e(e),...T_e(e),...E_e(e)}),S8=e=>{if(!e)throw new W(`invalid_response`,`The interaction response did not match the request.`)},O_e=(e,t)=>e?.kind===`text`&&t.kind===`text`?e.value===t.value:e?.kind===`selection`&&t.kind===`selection`&&e.optionIds.length===t.optionIds.length&&e.optionIds.every((e,n)=>e===t.optionIds[n]),k_e=(e,t)=>{let n=LJ.parse(e),r=n.interaction;return S8(n.commandId===t.commandId&&r.projectId===t.projectId&&r.sessionId===t.sessionId&&r.kind===t.kind&&r.subject===t.subject&&r.body===t.body&&(t.expiresAt===void 0?r.expiresAt===null:r.expiresAt===t.expiresAt)),r.kind===`selection`&&t.kind===`selection`&&S8(r.options.length===t.options.length&&r.options.every((e,n)=>e.optionId===t.options[n]?.optionId&&e.label===t.options[n]?.label)),n},A_e=(e,t)=>{let n=RJ.parse(e);return S8(n.projectId===t.projectId&&n.sessionId===t.sessionId&&n.items.length<=t.limit&&(t.lifecycleStatus===void 0||n.items.every(e=>e.lifecycleStatus===t.lifecycleStatus))&&(n.nextCursor===void 0||n.nextCursor!==t.afterCursor)),n},j_e=(e,t)=>{let n=zJ.parse(e);return S8(n.interaction.interactionId===t.interactionId),n},M_e=(e,t)=>{let n=BJ.parse(e);return S8(n.commandId===t.commandId&&n.interaction.interactionId===t.interactionId&&n.expectedRevision===t.expectedRevision&&O_e(n.interaction.answer,t.answer)),n},N_e=(e,t)=>{let n=VJ.parse(e);return S8(n.commandId===t.commandId&&n.interaction.interactionId===t.interactionId&&n.expectedRevision===t.expectedRevision),n},P_e=e=>({listInteractions:(t,n)=>e({method:`interaction.list`,parameters:t},{parse:e=>A_e(e,t)},n),showInteraction:(t,n)=>e({method:`interaction.show`,parameters:t},{parse:e=>j_e(e,t)},n)}),F_e=e=>({cancelInteraction:(t,n)=>e({method:`interaction.cancel`,parameters:t},{parse:e=>N_e(e,t)},n),createInteraction:(t,n)=>e({method:`interaction.create`,parameters:t},{parse:e=>k_e(e,t)},n),respondToInteraction:(t,n)=>e({method:`interaction.respond`,parameters:t},{parse:e=>M_e(e,t)},n)}),I_e=e=>({...P_e(e),...F_e((t,n,r)=>d6(e(t,n,r),r))}),C8=e=>{if(!e)throw new W(`invalid_response`,`The update response did not match the request.`)},L_e=(e,t)=>{let n=yY.parse(e);return C8(n.reason===t.reason),n},R_e=(e,t)=>{let n=vY.parse(e);return C8(n.value===t.value&&BigInt(n.revision)===BigInt(t.revision)+1n),n},z_e=(e,t)=>{let n=xY.parse(e);return C8(n.commandId===t.commandId&&n.node===t.node),n},B_e=(e,t)=>{let n=SY.parse(e);return C8(n.node===t.node&&n.from===t.from&&BigInt(n.revision)===BigInt(t.revision)+1n),n},V_e=(e,t)=>{let n=CY.parse(e);return C8(n.commandId===t.commandId&&n.node===t.node),n},H_e=(e,t)=>{let n=wY.parse(e);return C8(n.node===t.node&&n.from===t.from&&n.to===t.to&&BigInt(n.revision)===BigInt(t.revision)+1n),n},U_e=e=>({confirmNodeUpdateApply:(t,n)=>d6(e({method:`node.update.apply.confirm`,parameters:t},{parse:e=>H_e(e,t)},n),n),previewNodeUpdateApply:(t,n)=>e({method:`node.update.apply.preview`,parameters:t},{parse:e=>V_e(e,t)},n)}),W_e=e=>({confirmNodeUpdateRollback:(t,n)=>d6(e({method:`node.update.rollback.confirm`,parameters:t},{parse:e=>B_e(e,t)},n),n),previewNodeUpdateRollback:(t,n)=>e({method:`node.update.rollback.preview`,parameters:t},{parse:e=>z_e(e,t)},n),showNodeUpdate:t=>e({method:`node.update.show`,parameters:{}},mY,t)}),G_e=e=>({pauseNodeUpdate:(t,n)=>d6(e({method:`node.update.pause`,parameters:t},{parse:e=>L_e(e,t)},n),n),resumeNodeUpdate:(t,n)=>d6(e({method:`node.update.resume`,parameters:t},bY,n),n)}),K_e=e=>({checkNodeUpdate:t=>e({method:`node.update.check`,parameters:{}},hY,t),getNodeUpdatePolicy:t=>e({method:`node.update.policy.get`,parameters:{}},_Y,t),setNodeUpdatePolicy:(t,n)=>d6(e({method:`node.update.policy.set`,parameters:t},{parse:e=>R_e(e,t)},n),n)}),q_e=e=>({...U_e(e),...G_e(e),...K_e(e),...W_e(e),showNodeUpdateStatus:t=>e({method:`node.update.status`,parameters:{}},gY,t)}),J_e=(e,t)=>e.kind===`create`?t.kind===`create`&&e.role===t.role:t.kind===`revoke`&&e.pairingId===t.pairingId,w8=e=>{if(!e)throw new W(`invalid_response`,`The pairing response did not match the request.`)},Y_e=(e,t)=>{let n=zY.parse(e);return w8(n.commandId===t.commandId&&J_e(n.change,t.change)),n},X_e=(e,t)=>{let n=BY.parse(e),{change:r,revision:i}=t;return w8(BigInt(n.revision)===BigInt(i)+1n&&(r.kind===`create`?n.role===r.role&&n.state===`pending`:n.pairingId===r.pairingId&&n.state===`revoked`)),n},Z_e=(e,t)=>{let n=VY.parse(e);return w8(n.clientId===t.clientId),n},Q_e=e=>({confirmPairing:(t,n)=>d6(e({method:`node.pairing.confirm`,parameters:t},{parse:e=>X_e(e,t)},n),n),previewPairing:(t,n)=>e({method:`node.pairing.preview`,parameters:t},{parse:e=>Y_e(e,t)},n),showPairings:t=>e({method:`node.pairing.show`,parameters:{}},HY,t)}),$_e=e=>({...Q_e(e),redeemPairing:(t,n)=>d6(e({method:`node.pairing.redeem`,parameters:t},{parse:e=>Z_e(e,t)},n),n)}),T8=e=>{if(!e)throw new W(`invalid_response`,`The port lease response did not match the request.`)},E8=(e,t)=>t===void 0?e.kind===`principal`:e.kind===`session`&&e.sessionId===t,eve=(e,t)=>{let n=gX.parse(e);return T8(n.commandId===t.commandId&&n.lease.purpose===t.purpose&&n.lease.ports.length===(t.count??1)&&E8(n.lease.owner,t.sessionId)),n},tve=(e,t)=>{let n=_X.parse(e);return T8(n.commandId===t.commandId&&n.lease.leaseId===t.leaseId&&n.expectedRevision===t.expectedRevision),n},nve=(e,t)=>{let n=vX.parse(e);return T8(n.commandId===t.commandId&&n.lease.leaseId===t.leaseId),n},rve=(e,t)=>{let n=yX.parse(e),{afterCursor:r,limit:i,sessionId:a}=t;return T8(n.items.length<=i&&(n.nextCursor===void 0||n.nextCursor!==r)&&(a===void 0||n.items.every(e=>E8(e.lease.owner,a)))),n},ive=e=>({acquirePortLease:(t,n)=>e({method:`port.lease.acquire`,parameters:t},{parse:e=>eve(e,t)},n),releasePortLease:(t,n)=>e({method:`port.lease.release`,parameters:t},{parse:e=>nve(e,t)},n),renewPortLease:(t,n)=>e({method:`port.lease.renew`,parameters:t},{parse:e=>tve(e,t)},n)}),ave=e=>({...ive((t,n,r)=>d6(e(t,n,r),r)),listPortLeases:(t,n)=>e({method:`port.lease.list`,parameters:t},{parse:e=>rve(e,t)},n)}),ove=(e,t)=>{let n=QX.parse(e);if(n.catalogDigest!==t.catalogDigest||n.catalogVersion!==t.catalogVersion||n.viewId!==t.viewId||n.generation!==t.generation||n.resources.container.id!==t.page.containerId||n.membershipCursor!==t.page.afterCursor||n.resources.projects.length>t.page.limit)throw new W(`invalid_response`,`The Project presentation did not match the requested view.`);return n},sve=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The Project presentation request failed runtime validation.`),try:()=>ZX.parse(t)}),i={...r,page:{...r.page}};return yield*e({method:`presentation.project-list.show`,parameters:r},{parse:e=>ove(e,i)},n)}).pipe(kp(`PresentationClient.requestProjectList`)),cve=(e,t)=>{let n=XX.parse(e),r=n.target;if(n.catalogDigest!==t.catalogDigest||n.catalogVersion!==t.catalogVersion||n.viewId!==t.viewId||n.generation!==t.generation||r.containerId!==t.target.containerId||r.containerRevision!==t.target.containerRevision||r.projectId!==t.target.projectId||r.projectRevision!==t.target.projectRevision||r.membershipCursor!==t.target.membershipCursor||n.resources.items.length>t.page.limit)throw new W(`invalid_response`,`The Session presentation did not match the requested view.`);return n},lve=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The Session presentation request failed runtime validation.`),try:()=>YX.parse(t)}),i={...r,page:{...r.page},target:{...r.target}};return yield*e({method:`presentation.session-list.show`,parameters:r},{parse:e=>cve(e,i)},n)}).pipe(kp(`PresentationClient.requestSessionList`)),uve=(e,t)=>{let n=tZ.parse(e);if(n.catalogDigest!==t.catalogDigest||n.catalogVersion!==t.catalogVersion||n.viewId!==t.viewId||n.generation!==t.generation||n.resources.items.length>t.page.limit)throw new W(`invalid_response`,`The presentation response did not match the requested view.`);return n},dve=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The presentation request failed runtime validation.`),try:()=>eZ.parse(t)}),i={...r,page:{...r.page}};return yield*e({method:`presentation.workspace-directory.show`,parameters:r},{parse:e=>uve(e,i)},n)}).pipe(kp(`PresentationClient.requestDirectory`)),fve=e=>({showPresentationCatalog:(t,n)=>e({method:`presentation.catalog.show`,parameters:t},$X,n),showProjectList:(t,n)=>sve(e,t,n),showSessionList:(t,n)=>lve(e,t,n),showWorkspaceDirectory:(t,n)=>dve(e,t,n)}),pve=(e,t)=>e.kind===`create`?t.kind===`create`&&e.name===t.name&&e.role===t.role:t.kind===`revoke`&&e.principalId===t.principalId,D8=e=>{if(!e)throw new W(`invalid_response`,`The principal response did not match the request.`)},mve=(e,t)=>{let n=gZ.parse(e);return D8(n.commandId===t.commandId&&pve(n.change,t.change)),n},hve=(e,t)=>{let n=_Z.parse(e),{change:r,revision:i}=t;return D8(BigInt(n.revision)===BigInt(i)+1n&&(r.kind===`create`?n.name===r.name&&n.role===r.role&&n.state===`active`:n.principalId===r.principalId&&n.state===`revoked`)),n},gve=e=>({confirmPrincipal:(t,n)=>d6(e({method:`node.principal.confirm`,parameters:t},{parse:e=>hve(e,t)},n),n),previewPrincipal:(t,n)=>e({method:`node.principal.preview`,parameters:t},{parse:e=>mve(e,t)},n),showPrincipals:t=>e({method:`node.principal.show`,parameters:{}},vZ,t)}),O8=e=>{if(!e)throw new W(`invalid_response`,`The Project guard response did not match the request.`)},k8=(e,t)=>e.maxDepth===t.maxDepth&&e.maxLeasesPerSession===t.maxLeasesPerSession&&e.maxLiveChildren===t.maxLiveChildren&&e.maxMessagesPerMinute===t.maxMessagesPerMinute,A8=(e,t)=>(e?.coordinator??t.coordinator)===t.coordinator,_ve=(e,t)=>{let n=VM.parse(e);return O8(n.guard.projectId===t.projectId),n},vve=(e,t)=>{let n=HM.parse(e);return O8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&k8(n.limits,t.limits)&&A8(t.approvalGrants,n.approvalGrants)),n},yve=(e,t)=>{let n=UM.parse(e);return O8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.guard.projectId===t.projectId&&k8(n.guard.limits,t.limits)&&A8(t.approvalGrants,n.guard.approvalGrants)),n},bve=e=>({confirmProjectGuard:(t,n)=>d6(e({method:`project.guard.confirm`,parameters:t},{parse:e=>yve(e,t)},n),n),previewProjectGuard:(t,n)=>e({method:`project.guard.preview`,parameters:t},{parse:e=>vve(e,t)},n),showProjectGuard:(t,n)=>e({method:`project.guard.show`,parameters:t},{parse:e=>_ve(e,t)},n)}),j8=e=>{if(!e)throw new W(`invalid_response`,`The Project knowledge response did not match the request.`)},xve=(e,t)=>e.length===t.length&&e.every((e,n)=>e.path===t[n]?.path&&e.bytes===t[n].bytes&&e.sha256===t[n].sha256),Sve=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),Cve=e=>e.length/4*3-(e.length-e.replace(/=+$/u,``).length),wve=(e,t)=>{let n=cce.parse(e);return j8(n.projectId===t.projectId),n},Tve=(e,t)=>{let n=hce.parse(e);return j8((t.projectId===void 0||n.projectId===t.projectId)&&(t.limit===void 0||n.hits.length<=t.limit)),n},Eve=(e,t)=>{let n=lce.parse(e);return j8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&xve(n.files,t.files)),n},Dve=(e,t)=>{let n=uce.parse(e);return j8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.projectId===t.projectId),n},Ove=(e,t)=>{let n=dce.parse(e);return j8(n.commandId===t.commandId&&n.path===t.path&&n.offset===t.offset&&n.bytes===Cve(t.data)),n},kve=(e,t)=>{let n=fce.parse(e);return j8(n.commandId===t.commandId&&n.projectId===t.projectId),n},Ave=(e,t)=>{let n=pce.parse(e);return j8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&Sve(n.paths,t.paths)),n},jve=(e,t)=>{let n=mce.parse(e);return j8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.projectId===t.projectId&&n.removed<=t.paths.length),n},Mve=e=>({listProjectKnowledge:(t,n)=>e({method:`project.knowledge.list`,parameters:t},{parse:e=>wve(e,t)},n),searchProjectKnowledge:(t,n)=>e({method:`project.knowledge.search`,parameters:t},{parse:e=>Tve(e,t)},n)}),Nve=e=>({confirmProjectKnowledgeAdd:(t,n)=>d6(e({method:`project.knowledge.add.confirm`,parameters:t},{parse:e=>Dve(e,t)},n),n),previewProjectKnowledgeAdd:(t,n)=>e({method:`project.knowledge.add.preview`,parameters:t},{parse:e=>Eve(e,t)},n)}),Pve=e=>({commitProjectKnowledgeAdd:(t,n)=>d6(e({method:`project.knowledge.add.commit`,parameters:t},{parse:e=>kve(e,t)},n),n),sendProjectKnowledgeChunk:(t,n)=>e({method:`project.knowledge.add.chunk`,parameters:t},{parse:e=>Ove(e,t)},n)}),Fve=e=>({confirmProjectKnowledgeRemove:(t,n)=>d6(e({method:`project.knowledge.remove.confirm`,parameters:t},{parse:e=>jve(e,t)},n),n),previewProjectKnowledgeRemove:(t,n)=>e({method:`project.knowledge.remove.preview`,parameters:t},{parse:e=>Ave(e,t)},n)}),Ive=e=>({...Mve(e),...Nve(e),...Pve(e),...Fve(e)}),M8=(e,t,n)=>n?w(t):f6(e.invalidResponse),Lve=(e,t,n)=>e.request({method:`workspace.membership.attach`,parameters:t},tce,n).pipe(D(n=>M8(e,n,n.receipt.commandId===t.commandId&&n.workspace.id===t.workspaceId&&n.membership.workspaceId===t.workspaceId&&n.membership.projectId===t.projectId&&n.membership.repositoryId===t.repositoryId))),Rve=(e,t,n)=>e.request({method:`workspace.select`,parameters:t},nce,n).pipe(D(n=>M8(e,n,n.receipt.commandId===t.commandId&&n.workspace.id===t.workspaceId&&n.context.systemPromptInput.focus.projectId===t.projectId&&n.context.systemPromptInput.focus.repositoryId===t.repositoryId))),zve=(e,t,n)=>e.request({method:`project.context.record`,parameters:t},Yse,n).pipe(D(n=>M8(e,n,n.receipt.commandId===t.commandId&&n.note.body===t.body&&n.note.projectId===t.projectId&&n.note.attribution===t.attribution))),Bve=e=>({listProjects:(t,n)=>e.request({method:`project.list`,parameters:t},qse,n),registerProject:(t,n)=>e.request({method:`project.register`,parameters:t},Kse,n),showProject:(t,n)=>e.request({method:`project.show`,parameters:t},Jse,n)}),Vve=e=>({listProjectContext:(t,n)=>e.request({method:`project.context.list`,parameters:t},Xse,n),recordProjectContext:(t,n)=>zve(e,t,n),showProjectContext:(t,n)=>e.request({method:`project.context.show`,parameters:t},Zse,n)}),Hve=e=>({listWorkspaces:(t,n)=>e({method:`workspace.list`,parameters:t},$se,n),showWorkspace:(t,n)=>e({method:`workspace.show`,parameters:t},ece,n),showWorkspaceContext:(t,n)=>e({method:`workspace.context.show`,parameters:t},Qse,n)}),Uve=e=>({attachWorkspaceMembership:(t,n)=>Lve(e,t,n),attachWorkspaceRepository:(t,n)=>e.request({method:`workspace.repository.attach`,parameters:t},rce,n),selectWorkspace:(t,n)=>Rve(e,t,n)}),Wve=e=>({previewProjectCreate:(t,n)=>e.request({method:`project.create.preview`,parameters:t},{parse:n=>{let r=Hse.parse(n);return r.commandId===t.commandId&&r.name===t.name.trim()&&r.containerId===t.containerId&&r.expectedContainerRevision===t.expectedContainerRevision?r:e.invalidResponse()}},n)}),Gve=e=>({previewProjectRename:(t,n)=>e.request({method:`project.rename.preview`,parameters:t},{parse:n=>{let r=Wse.parse(n);return r.commandId===t.commandId&&r.name===t.name.trim()&&r.containerId===t.containerId&&r.projectId===t.projectId&&r.expectedRevision===t.expectedRevision?r:e.invalidResponse()}},n)}),Kve=e=>({confirmProjectCreate:(t,n)=>e.request({method:`project.create.confirm`,parameters:t},{parse:n=>{let r=Use.parse(n);return r.commandId===t.commandId&&r.project.name===t.name.trim()&&r.inputDigest===t.inputDigest&&r.containerId===t.containerId&&r.expectedContainerRevision===t.expectedContainerRevision?r:e.invalidResponse()}},n)}),qve=e=>({confirmProjectRename:(t,n)=>e.request({method:`project.rename.confirm`,parameters:t},{parse:n=>{let r=Gse.parse(n);return r.commandId===t.commandId&&r.project.name===t.name.trim()&&r.inputDigest===t.inputDigest&&r.containerId===t.containerId&&r.project.id===t.projectId&&r.expectedRevision===t.expectedRevision?r:e.invalidResponse()}},n)}),Jve=e=>({previewProjectInstructionsChange:(t,n)=>e.request({method:`project.instructions.change.preview`,parameters:t},ace,n).pipe(D(n=>M8(e,n,n.commandId===t.commandId&&n.projectId===t.projectId&&n.expectedRevision===t.expectedRevision&&n.text===t.text)))}),Yve=e=>({showProjectInstructions:(t,n)=>e.request({method:`project.instructions.show`,parameters:t},ice,n).pipe(D(n=>M8(e,n,n.projectId===t.projectId&&(n.instructions===null||n.instructions.projectId===t.projectId))))}),Xve=e=>({confirmProjectInstructionsChange:(t,n)=>e.request({method:`project.instructions.change.confirm`,parameters:t},{parse:n=>{let r=oce.parse(n);return r.commandId===t.commandId&&r.projectId===t.projectId&&r.expectedRevision===t.expectedRevision&&r.inputDigest===t.inputDigest?r:e.invalidResponse()}},n)}),Zve=e=>({invalidResponse:e.invalidResponse,request:(t,n,r)=>d6(e.request(t,n,r),r)}),Qve=(e,t)=>{let n={invalidResponse:t,request:e},r=Zve(n);return{...Wve(n),...Gve(n),...Kve(r),...qve(r),...Jve(n),...Yve(n),...Xve(r),...Bve(n),...Vve(n),...Hve(e),...Uve(n)}},$ve=e=>({listProviderPools:(t,n)=>e({method:`provider.pool.list`,parameters:t},kZ,n)}),N8=(e,t)=>e?.address===t?.address&&e?.port===t?.port,P8=e=>{if(!e)throw new W(`invalid_response`,`The reach response did not match the request.`)},eye=(e,t)=>{let n=XZ.parse(e);return P8(N8(n.bind,t.change.bind)&&BigInt(n.revision)===BigInt(t.revision)+1n),n},tye=(e,t)=>{let n=YZ.parse(e);return P8(n.commandId===t.commandId&&N8(n.change.bind,t.change.bind)&&(n.change.bind===void 0||n.transport===`cleartext-http`)),n},nye=e=>({confirmReach:(t,n)=>d6(e({method:`node.reach.confirm`,parameters:t},{parse:e=>eye(e,t)},n),n),previewReach:(t,n)=>e({method:`node.reach.preview`,parameters:t},{parse:e=>tye(e,t)},n),showReach:t=>e({method:`node.reach.show`,parameters:{}},ZZ,t)}),F8=e=>{if(!e)throw new W(`invalid_response`,`The remote Node response did not match the request.`)},rye=(e,t)=>{let n=mQ.parse(e);return F8(n.commandId===t.commandId&&(n.state!==`ready`||n.name===t.name&&n.plan.profile===t.profile&&n.plan.keep===t.keep)),n},I8=(e,t)=>e.name===t.name,iye=(e,t)=>{let n=hQ.parse(e);return F8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&I8(n.node,t)&&n.node.host===t.host&&n.node.profile===t.profile),n},aye=(e,t)=>{let n=yQ.parse(e);return F8(n.commandId===t.commandId&&n.name===t.name&&n.purge===t.purge&&n.expectedRevision===t.expectedRevision),n},oye=(e,t)=>{let n=bQ.parse(e);return F8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&I8(n.node,t)),n},L8=(e,t)=>e.host===t.host&&(t.launcherPath===void 0||e.launcherPath===t.launcherPath),sye=(e,t)=>{let n=gQ.parse(e);return F8(n.commandId===t.commandId&&n.name===t.name&&L8(n.plan,t)&&(t.profile===void 0||n.plan.profile===t.profile)),n},cye=(e,t)=>{let n=_Q.parse(e);return F8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&I8(n.node,t)&&n.node.origin===`registered`&&L8(n.node,t)),n},lye=e=>({confirmRemoteNodeRegister:(t,n)=>e({method:`node.remote.register.confirm`,parameters:t},{parse:e=>cye(e,t)},n),previewRemoteNodeRegister:(t,n)=>e({method:`node.remote.register.preview`,parameters:t},{parse:e=>sye(e,t)},n)}),uye=e=>({listRemoteNodes:(t,n)=>e({method:`node.remote.list`,parameters:t},vQ,n)}),dye=e=>({confirmRemoteNodeInstall:(t,n)=>e({method:`node.remote.install.confirm`,parameters:t},{parse:e=>iye(e,t)},n),previewRemoteNodeInstall:(t,n)=>e({method:`node.remote.install.preview`,parameters:t},{parse:e=>rye(e,t)},n)}),fye=e=>({confirmRemoteNodeRemove:(t,n)=>e({method:`node.remote.remove.confirm`,parameters:t},{parse:e=>oye(e,t)},n),previewRemoteNodeRemove:(t,n)=>e({method:`node.remote.remove.preview`,parameters:t},{parse:e=>aye(e,t)},n)}),pye=e=>({...uye(e),...dye(e),...lye(e),...fye(e)}),R8=e=>{if(!e)throw new W(`invalid_response`,`The routine response did not match the request.`)},z8=({precheck:e})=>e===void 0?void 0:{command:e.command,timeoutSeconds:e.timeoutSeconds},B8=(e,t)=>e.commandId===t.commandId&&e.name===t.name&&JSON.stringify(z8(e))===JSON.stringify(z8(t))&&JSON.stringify(e.schedule)===JSON.stringify(t.schedule)&&e.template.projectId===t.template.projectId,mye=(e,t)=>{let n=Z$.parse(e);return R8(B8(n,t)),n},hye=(e,t)=>{let n=Q$.parse(e);return R8(n.inputDigest===t.inputDigest&&B8({...n.routine,commandId:n.commandId},t)),n},gye=(e,t)=>{let n=J$.parse(e);return R8(n.items.length<=t.limit&&n.items.every(e=>(t.state===void 0||e.state===t.state)&&(t.projectId===void 0||e.template.projectId===t.projectId))),n},_ye=(e,t)=>{let n=X$.parse(e);return R8(n.items.length<=t.limit&&n.items.every(e=>t.routineId===void 0||e.routineId===t.routineId)),n},vye=(e,t)=>{let n=Y$.parse(e);return R8(n.routine.id===t.routineId&&n.fires.every(e=>e.routineId===t.routineId)),n},V8=e=>(t,n)=>{let r=e.parse(t);return R8(r.commandId===n.commandId&&r.expectedRevision===n.expectedRevision&&r.routineId===n.routineId),r},yye=V8(t1),bye=V8(r1),xye=(e,t)=>{let n=i1.parse(e);return R8(n.fire.routineId===t.routineId&&n.receipt.commandId===t.commandId),n},H8=e=>(t,n)=>{let r=e.parse(t);return R8(r.routine.id===n.routineId&&r.receipt.commandId===n.commandId),r},Sye=V8(a1),Cye=H8(o1),wye=V8(Zle),Tye=H8(Qle),Eye=(e,t)=>{let n=Sye(e,t);return R8(n.agentId===t.agentId&&n.prompt===t.prompt&&JSON.stringify(n.schedule)===JSON.stringify(t.schedule)),n},Dye=(e,t)=>{let n=Cye(e,t),{schedule:r,template:i}=n.routine;return R8([[`agentId`,t.agentId,i.agentId],[`prompt`,t.prompt,i.prompt],[`schedule`,JSON.stringify(t.schedule),JSON.stringify(r)]].every(([e,t,r])=>t===void 0?!n.changed.includes(e):t===r&&n.changed.includes(e))),n},Oye=(e,t)=>{let n=wye(e,t);return R8(n.projectId===t.projectId),n},kye=(e,t)=>{let n=Tye(e,t);return R8(n.routine.template.projectId===t.projectId),n},Aye=(e,t)=>e.length===t.length&&e.every((e,n)=>e.path===t[n]?.path&&e.equals===t[n]?.equals),U8=(e,t)=>e.commandId===t.commandId&&e.routineId===t.routineId&&e.ratePerMinute===t.ratePerMinute&&Aye(e.filters,t.filters),jye=(e,t)=>{let n=eue.parse(e);return R8(U8(n,t)),n},Mye=(e,t)=>{let n=tue.parse(e);return R8(n.inputDigest===t.inputDigest&&n.receipt.commandId===t.commandId&&U8({...n.trigger,commandId:n.commandId},t)),n},Nye=(e,t)=>{let n=$le.parse(e);return R8(n.triggers.every(e=>e.routineId===t.routineId)),n},Pye=(e,t)=>{let n=nue.parse(e);return R8(n.trigger.id===t.triggerId&&n.receipt.commandId===t.commandId),n},W8=(e,t,n)=>(r,i)=>e(t(r),{parse:e=>n(e,r)},i),G8=(e,t,n)=>(r,i)=>d6(W8(e,t,n)(r,i),i),K8={create:e=>({method:`routine.create.confirm`,parameters:e}),createPreview:e=>({method:`routine.create.preview`,parameters:e}),disable:e=>({method:`routine.disable.confirm`,parameters:e}),disablePreview:e=>({method:`routine.disable.preview`,parameters:e}),list:e=>({method:`routine.list`,parameters:e}),move:e=>({method:`routine.move.confirm`,parameters:e}),movePreview:e=>({method:`routine.move.preview`,parameters:e}),pause:e=>({method:`routine.pause`,parameters:e}),resume:e=>({method:`routine.resume`,parameters:e}),run:e=>({method:`routine.run.confirm`,parameters:e}),runPreview:e=>({method:`routine.run.preview`,parameters:e}),runs:e=>({method:`routine.runs`,parameters:e}),show:e=>({method:`routine.show`,parameters:e}),triggerCreate:e=>({method:`routine.trigger.create.confirm`,parameters:e}),triggerCreatePreview:e=>({method:`routine.trigger.create.preview`,parameters:e}),triggerDisable:e=>({method:`routine.trigger.disable`,parameters:e}),triggerList:e=>({method:`routine.trigger.list`,parameters:e}),update:e=>({method:`routine.update.confirm`,parameters:e}),updatePreview:e=>({method:`routine.update.preview`,parameters:e})},Fye=H8(n1),Iye=H8($$),Lye=H8(e1),Rye=e=>({confirmRoutineTriggerCreate:G8(e,K8.triggerCreate,Mye),disableRoutineTrigger:G8(e,K8.triggerDisable,Pye),listRoutineTriggers:W8(e,K8.triggerList,Nye),previewRoutineTriggerCreate:W8(e,K8.triggerCreatePreview,jye)}),zye=e=>({confirmRoutineMove:G8(e,K8.move,kye),confirmRoutineUpdate:G8(e,K8.update,Dye),previewRoutineMove:W8(e,K8.movePreview,Oye),previewRoutineUpdate:W8(e,K8.updatePreview,Eye)}),Bye=e=>({...zye(e),...Rye(e),confirmRoutineCreate:G8(e,K8.create,hye),confirmRoutineDisable:G8(e,K8.disable,Fye),confirmRoutineRun:G8(e,K8.run,xye),listRoutineRuns:W8(e,K8.runs,_ye),listRoutines:W8(e,K8.list,gye),pauseRoutine:G8(e,K8.pause,Iye),previewRoutineCreate:W8(e,K8.createPreview,mye),previewRoutineDisable:W8(e,K8.disablePreview,yye),previewRoutineRun:W8(e,K8.runPreview,bye),resumeRoutine:G8(e,K8.resume,Lye),showRoutine:W8(e,K8.show,vye)}),q8=e=>{if(!e)throw new W(`invalid_response`,`The Run ledger response did not match the request.`)},Vye=(e,t)=>{let n=pue.parse(e);return q8(n.commandId===t.commandId&&n.run.workspaceId===t.workspaceId&&n.tasks.map(e=>e.clientKey).join(`
|
|
18
|
+
`)===t.tasks.map(e=>e.clientKey).join(`
|
|
19
|
+
`)),n},Hye=(e,t)=>{let n=_ue.parse(e);return q8(n.commandId===t.commandId&&n.task.runId===t.runId&&n.task.id===t.taskId&&n.dispatch.sessionId===t.sessionId&&BigInt(n.task.revision)===BigInt(t.expectedTaskRevision)+1n),n},Uye=(e,t)=>{let n=vue.parse(e),r=n.task.dispatches.at(-1);return q8(n.commandId===t.commandId&&n.task.runId===t.runId&&n.task.id===t.taskId&&r?.sessionId===t.sessionId&&r.state===t.outcome&&r.evidence===t.evidence&&(t.turnId===void 0||r.settledTurnId===t.turnId)&&BigInt(n.task.revision)===BigInt(t.expectedTaskRevision)+1n),n},Wye=(e,t)=>{let n=mue.parse(e);return q8(n.items.length<=t.limit&&n.items.every(e=>e.workspaceId===t.workspaceId)&&(n.nextCursor===void 0||n.nextCursor!==t.afterCursor)),n},Gye=(e,t)=>{let n=hue.parse(e);return q8(n.run.id===t.runId&&(t.ready!==!0||n.items.every(e=>e.state===`ready`))),n},Kye=(e,t)=>{let n=gue.parse(e);return q8(n.task.runId===t.runId&&n.task.id===t.taskId),n},qye=e=>({createRunLedger:(t,n)=>e({method:`run.ledger.create`,parameters:t},{parse:e=>Vye(e,t)},n),dispatchRunLedgerTask:(t,n)=>e({method:`run.ledger.task.dispatch`,parameters:t},{parse:e=>Hye(e,t)},n),settleRunLedgerTask:(t,n)=>e({method:`run.ledger.task.settle`,parameters:t},{parse:e=>Uye(e,t)},n)}),Jye=e=>({...qye((t,n,r)=>d6(e(t,n,r),r)),listRunLedgers:(t,n)=>e({method:`run.ledger.list`,parameters:t},{parse:e=>Wye(e,t)},n),listRunLedgerTasks:(t,n)=>e({method:`run.ledger.task.list`,parameters:t},{parse:e=>Gye(e,t)},n),showRunLedgerTask:(t,n)=>e({method:`run.ledger.task.show`,parameters:t},{parse:e=>Kye(e,t)},n)}),J8=e=>{if(!e)throw new W(`invalid_response`,`The secret response did not match the request.`)},Yye=(e,t)=>{let n=Tce.parse(e);return J8(n.commandId===t.commandId&&n.name===t.name),n},Xye=(e,t)=>{let n=Ece.parse(e);return J8(n.name===t.name),n},Zye=(e,t)=>{let n=Dce.parse(e);return J8(n.commandId===t.commandId&&n.name===t.name&&n.inputDigest===t.inputDigest),n},Qye=e=>({confirmSecretSet:(t,n)=>d6(e({method:`secret.set.confirm`,parameters:t},{parse:e=>Zye(e,t)},n),n),previewSecretSet:(t,n)=>e({method:`secret.set.preview`,parameters:t},{parse:e=>Xye(e,t)},n),requestSecret:(t,n)=>d6(e({method:`secret.request`,parameters:t},{parse:e=>Yye(e,t)},n),n)}),$ye=e=>({acknowledgeSessionDelivery:(t,n)=>e({method:`session.inbox.ack`,parameters:t},Voe,n),checkSessionInbox:(t,n)=>e({method:`session.inbox.check`,parameters:t},Boe,n),sendSessionMessage:(t,n)=>e({method:`session.message.send`,parameters:t},zoe,n)}),Y8=(e,t)=>t.workspace===e.workspace&&t.kind===e.change.kind&&(e.change.kind===`rollback`||t.digest===e.change.set.digest),X8=e=>{if(!e)throw new W(`invalid_response`,`The skills sync response did not match the request.`)},ebe=(e,t)=>{let n=ede.parse(e);return X8(Y8(t,n)&&BigInt(n.revision)===BigInt(t.revision)+1n),n},tbe=(e,t)=>{let n=$ue.parse(e);return X8(Y8(t,n)&&n.commandId===t.commandId&&n.workspace===t.workspace),n},nbe=e=>({confirmSkillsSync:(t,n)=>d6(e({method:`skills.sync.confirm`,parameters:t},{parse:e=>ebe(e,t)},n),n),previewSkillsSync:(t,n)=>e({method:`skills.sync.preview`,parameters:t},{parse:e=>tbe(e,t)},n),showSkillsSync:(t,n)=>e({method:`skills.sync.show`,parameters:t},Que,n)}),Z8=e=>{if(!e)throw new W(`invalid_response`,`The Team Workspace bootstrap response did not match the request.`)},rbe=(e,t)=>{let n=cde.parse(e);return Z8(n.commandId===t.commandId&&n.expectedBootstrapRevision===t.expectedBootstrapRevision),n},ibe=(e,t)=>{let n=lde.parse(e);return Z8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.previewId===t.previewId),n},abe=e=>({applyTeamWorkspaceBootstrap:(t,n)=>d6(e({method:`team-workspace.bootstrap.apply`,parameters:t},{parse:e=>ibe(e,t)},n),n),previewTeamWorkspaceBootstrap:(t,n)=>e({method:`team-workspace.bootstrap.preview`,parameters:t},{parse:e=>rbe(e,t)},n)});G(y3);var obe=G(Kfe);G(E3),G(C3);var sbe=Object.freeze({description:C4,name:S4,parameters:Object.freeze(x3),type:`function`});Object.freeze([sbe]);var cbe=G(D3),lbe=G(k3),ube=G(O3),dbe=G(A3),fbe=G(f3),pbe=G(p3),mbe=G(m3),Q8={orchestratorContextParameters:cbe.parse,orchestratorContextResult:lbe.parse,orchestratorToolParameters:ube.parse,orchestratorToolResult:dbe.parse,previewParameters:vfe.parse,previewResult:xfe.parse,reconcileParameters:bfe.parse,reconcileResult:Cfe.parse,relayParameters:yfe.parse,relayResult:Sfe.parse,toolCall:obe.parse},$8=()=>new W(`invalid_response`,`The managed voice response did not match the request.`),e5=(e,t)=>If({catch:()=>new W(`invalid_request`,`The managed voice request is invalid.`),try:()=>e.parse(t)}),t5=e=>e instanceof W?e:$8(),hbe=(e,t)=>e.turn.sessionId===t.sessionId&&e.receipt.commandId===t.confirmation.commandId&&e.receipt.method===`turn.send`&&e.receipt.target.id===e.turn.id&&e.receipt.target.type===`turn`,gbe=(e,t)=>e.sessionId===t.sessionId&&e.projectId===t.projectId&&e.voiceSessionId===t.scopeId&&e.expectedSessionRevision===t.expectedSessionRevision&&e.turnInput===t.utterance.trim(),_be=(e,t,n)=>Mf(function*(){let r=yield*e5(pbe,t),i=yield*e({method:`voice.managed-turn.confirm`,parameters:r},o6,n).pipe(qf(t5));return hbe(i,r)?i:yield*E($8())}),vbe=(e,t,n)=>Mf(function*(){let r=yield*e5(fbe,t),i=yield*e({method:`voice.managed-turn.preview`,parameters:r},mbe,n).pipe(qf(t5));return gbe(i,r)?i:yield*E($8())}),ybe=e=>({confirmVoiceManagedTurn:(t,n)=>_be(e,t,n),previewVoiceManagedTurn:(t,n)=>vbe(e,t,n)}),n5=(e,t,n)=>n?w(t):f6(e.invalidResponse),bbe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay.preview`,parameters:Q8.previewParameters(t)},{parse:e=>Q8.previewResult(e)},n)).pipe(D(n=>n5(e,n,n.commandId===t.commandId&&n.workspaceId===t.workspaceId&&n.workspaceRevision===t.expectedWorkspaceRevision&&n.contextRevision===t.expectedContextRevision))),xbe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay.reconcile`,parameters:Q8.reconcileParameters(t)},{parse:e=>Q8.reconcileResult(e)},n)).pipe(D(n=>n5(e,n,n.commandId===t.commandId))),Sbe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay`,parameters:Q8.relayParameters(t)},{parse:e=>Q8.relayResult(e)},n)).pipe(D(n=>n5(e,n,n.commandId===t.commandId&&n.workspaceId===t.workspaceId&&n.sessionId===t.sessionId&&n.workspaceRevision===t.expectedWorkspaceRevision&&n.contextRevision===t.expectedContextRevision))),Cbe=(e,t)=>{let n={invalidResponse:t,request:e};return{previewVoiceToPi:(e,t)=>bbe(n,e,t),reconcileVoiceToPi:(e,t)=>xbe(n,e,t),relayVoiceToPi:(e,t)=>Sbe(n,e,t)}},r5=e=>{if(!e)throw new W(`invalid_response`,`The webhook response did not match the request.`)},i5=e=>JSON.stringify(e,(e,t)=>typeof t!=`object`||!t||Array.isArray(t)?t:Object.fromEntries(Object.entries(t).toSorted(([e],[t])=>e.localeCompare(t)))),wbe=(e,t)=>{let n=Vfe.parse(e);return r5(n.commandId===t.commandId&&i5(n.change)===i5(o3.parse(t.change))),n},Tbe=(e,t)=>i5(e)===i5(t),Ebe=(e,t)=>{let n=Hfe.parse(e),r=o3.parse(t.change);return r5(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.kind===r.kind&&(r.kind===`add`?n.webhook.revision===`1`&&n.webhook.state===`active`&&Tbe(n.webhook.spec,r.spec):(r.kind===`redeliver`||n.webhook.id===r.webhookId)&&BigInt(n.webhook.revision)===BigInt(r.expectedRevision)+1n)),n},a5=(e,t)=>(r5(e.items.length<=t.limit),e),Dbe=e=>({listWebhookDeliveries:(t,n)=>e({method:`webhooks.deliveries`,parameters:t},{parse:e=>a5(Bfe.parse(e),t)},n),listWebhooks:(t,n)=>e({method:`webhooks.list`,parameters:t},{parse:e=>a5(zfe.parse(e),t)},n)}),Obe=e=>({...Dbe(e),confirmWebhookChange:(t,n)=>d6(e({method:`webhooks.change.confirm`,parameters:t},{parse:e=>Ebe(e,t)},n),n),previewWebhookChange:(t,n)=>e({method:`webhooks.change.preview`,parameters:t},{parse:e=>wbe(e,t)},n)}),kbe=e=>({showCurrentContext:(t,n)=>e({method:`context.show`,parameters:t},fY,n)}),Abe=e=>({createMonitorBootstrap:t=>e({method:`monitor.bootstrap.create`,parameters:{}},Cpe,t),shutdown:t=>e({method:`node.shutdown`,parameters:{}},Spe,t),status:t=>e({method:`node.status`,parameters:{}},xpe,t)}),jbe=e=>({configureWorkspaceExecution:(t,n)=>e({method:`workspace.execution.configure`,parameters:t},JU,n),readExecutionCatalog:(t,n)=>e({method:`execution.catalog.get`,parameters:t},KU,n),showWorkspaceExecution:(t,n)=>e({method:`workspace.execution.show`,parameters:t},qU,n)}),Mbe=(e,t)=>t.kind===`session`?e.placement.kind===`session`&&e.placement.sessionId===t.ownerId:e.placement.kind===`attempt`&&e.placement.attemptId===t.ownerId,o5=(e,t)=>Mbe(e,t)?w(e):E(new W(`invalid_response`,`The execution placement response owner did not match the request.`)),Nbe=(e,t)=>{let n=e.placement;return(`sessionId`in t?n.kind===`session`&&n.sessionRevision===t.expectedSessionRevision:n.kind===`attempt`&&n.attemptRevision===t.expectedAttemptRevision)&&n.instanceId===t.instanceId&&n.instanceRevision===t.expectedInstanceRevision&&n.workspaceRevision===t.expectedWorkspaceRevision},Pbe=(e,t)=>o5(e,`sessionId`in t?{kind:`session`,ownerId:t.sessionId}:{kind:`attempt`,ownerId:t.attemptId}).pipe(ap(e=>Nbe(e,t),()=>new W(`invalid_response`,`The execution placement response snapshots did not match the request.`))),Fbe=e=>({createExecutionPlacement:(t,n)=>e({method:`execution.placement.create`,parameters:t},Bme,n).pipe(D(e=>Pbe(e,t))),showExecutionPlacement:(t,n)=>e({method:`execution.placement.show`,parameters:t},Vme,n).pipe(D(e=>o5(e,t)))}),Ibe=e=>({readExecutionFile:(t,n)=>e({method:`execution.file.read`,parameters:t},Rme,n),runExecutionCommand:(t,n)=>e({method:`execution.command.run`,parameters:t},zme,n)}),s5=(e,t)=>t?w(e):E(new W(`invalid_response`,`The execution worktree response did not match the request.`)),c5=(e,t)=>s5(e,e.operation.commandId===t.commandId&&e.operation.repositoryId===t.repositoryId),Lbe=(e,t,n)=>e({method:`execution.worktree.reconcile`,parameters:t},Yme,n).pipe(D(e=>s5(e,e.operation.id===t.operationId&&e.receipt.commandId===t.commandId))),Rbe=(e,t,n)=>e({method:`execution.worktree.remove.apply`,parameters:t},Zme,n).pipe(D(e=>s5(e,e.operation.workspaceId===t.workspaceId&&e.receipt.commandId===t.commandId))),zbe=e=>({createExecutionWorktree:(t,n)=>e({method:`execution.worktree.create`,parameters:t},Kme,n).pipe(D(e=>c5(e,t))),importExecutionWorktree:(t,n)=>e({method:`execution.worktree.import`,parameters:t},qme,n).pipe(D(e=>c5(e,t)))}),Bbe=e=>({reconcileExecutionWorktree:(t,n)=>Lbe(e,t,n),removeExecutionWorktree:(t,n)=>Rbe(e,t,n)}),Vbe=e=>({planExecutionWorktreeRemove:(t,n)=>e({method:`execution.worktree.remove.plan`,parameters:t},Xme,n).pipe(D(e=>s5(e,e.plan.workspaceId===t.workspaceId))),showExecutionWorktreeStatus:(t,n)=>e({method:`execution.worktree.status`,parameters:t},Jme,n).pipe(D(e=>s5(e,e.workspace.id===t.workspaceId)))}),Hbe=e=>({showExecutionCheckpoint:(t,n)=>e({method:`execution.checkpoint.show`,parameters:t},$me,n).pipe(D(e=>s5(e,e.checkpoint.id===t.checkpointId)))}),Ube=e=>({createExecutionCheckpoint:(t,n)=>e({method:`execution.checkpoint.create`,parameters:t},Qme,n).pipe(D(e=>s5(e,e.operation.commandId===t.commandId&&e.operation.instanceId===t.instanceId)))}),Wbe=e=>({...jbe(e),...Ube(e),...Hbe(e),...Ibe(e),...Fbe(e),...zbe(e),...Vbe(e),...Bbe(e)}),Gbe=e=>({getReceipt:(t,n)=>e({method:`receipt.get`,parameters:t},aoe,n),listReceipts:(t,n)=>e({method:`receipt.list`,parameters:t},ooe,n)}),Kbe=e=>({applyClaudeCodeIntegration:(t,n)=>e({method:`integration.apply.claude-code`,parameters:t},uJ,n),applyCodexIntegration:(t,n)=>e({method:`integration.apply.codex`,parameters:t},mJ,n),applyPiRpcIntegration:(t,n)=>e({method:`integration.apply.pi-rpc`,parameters:t},PJ,n)}),qbe=e=>({removeClaudeCodeIntegration:(t,n)=>e({method:`integration.remove.claude-code`,parameters:t},fJ,n),removeCodexIntegration:(t,n)=>e({method:`integration.remove.codex`,parameters:t},gJ,n),removePiRpcIntegration:(t,n)=>e({method:`integration.remove.pi-rpc`,parameters:t},IJ,n)}),Jbe=e=>({planClaudeCodeIntegration:(t,n)=>e({method:`integration.plan.claude-code`,parameters:t},lJ,n),planCodexIntegration:(t,n)=>e({method:`integration.plan.codex`,parameters:t},pJ,n),planPiRpcIntegration:(t,n)=>e({method:`integration.plan.pi-rpc`,parameters:t},NJ,n)}),Ybe=e=>({statusClaudeCodeIntegration:(t,n)=>e({method:`integration.status.claude-code`,parameters:t},dJ,n),statusCodexIntegration:(t,n)=>e({method:`integration.status.codex`,parameters:t},hJ,n),statusPiRpcIntegration:(t,n)=>e({method:`integration.status.pi-rpc`,parameters:t},FJ,n)}),Xbe=e=>({applyMaiaAgentIntegration:(t,n)=>e({method:`integration.apply.maia-agent`,parameters:t},vJ,n),removeMaiaAgentIntegration:(t,n)=>e({method:`integration.remove.maia-agent`,parameters:t},bJ,n)}),Zbe=e=>({planMaiaAgentIntegration:(t,n)=>e({method:`integration.plan.maia-agent`,parameters:t},_J,n),statusMaiaAgentIntegration:(t,n)=>e({method:`integration.status.maia-agent`,parameters:t},yJ,n)}),Qbe=e=>({applyPiIntegration:(t,n)=>e({method:`integration.apply.pi`,parameters:t},SJ,n),removePiIntegration:(t,n)=>e({method:`integration.remove.pi`,parameters:t},wJ,n)}),$be=e=>({planPiIntegration:(t,n)=>e({method:`integration.plan.pi`,parameters:t},xJ,n),statusPiIntegration:(t,n)=>e({method:`integration.status.pi`,parameters:t},CJ,n)}),exe=e=>({applyAntigravityIntegration:(t,n)=>e({method:`integration.apply.antigravity`,parameters:t},EJ,n),removeAntigravityIntegration:(t,n)=>e({method:`integration.remove.antigravity`,parameters:t},OJ,n)}),txe=e=>({planAntigravityIntegration:(t,n)=>e({method:`integration.plan.antigravity`,parameters:t},TJ,n),statusAntigravityIntegration:(t,n)=>e({method:`integration.status.antigravity`,parameters:t},DJ,n)}),nxe=e=>({applyGrokCliIntegration:(t,n)=>e({method:`integration.apply.grok-cli`,parameters:t},AJ,n),removeGrokCliIntegration:(t,n)=>e({method:`integration.remove.grok-cli`,parameters:t},MJ,n)}),rxe=e=>({planGrokCliIntegration:(t,n)=>e({method:`integration.plan.grok-cli`,parameters:t},kJ,n),statusGrokCliIntegration:(t,n)=>e({method:`integration.status.grok-cli`,parameters:t},jJ,n)}),ixe=e=>({...exe(e),...txe(e),...nxe(e),...rxe(e),...Kbe(e),...Jbe(e),...qbe(e),...Ybe(e),...Xbe(e),...Zbe(e),...Qbe(e),...$be(e)}),axe=e=>({listInstalledHarnesses:(t,n)=>e({method:`harness.installed.list`,parameters:t},YW,n),probeRuntime:(t,n)=>e({method:`runtime.probe`,parameters:t},Tue,n)}),oxe=e=>({createSession:(t,n)=>e({method:`session.create`,parameters:t},Roe,n),startSession:(t,n)=>e({method:`session.start`,parameters:t},Goe,n)}),sxe=e=>({archiveSession:(t,n)=>e({method:`session.archive`,parameters:t},qoe,n),diffSession:(t,n)=>e({method:`session.diff`,parameters:t},Koe,n),resumeSession:(t,n)=>e({method:`session.resume`,parameters:t},tse,n),stopSession:(t,n)=>e({method:`session.stop`,parameters:t},ese,n)}),cxe=e=>({listSessionEvents:(t,n)=>e({method:`session.events.list`,parameters:t},Woe,n),listSessions:(t,n)=>e({method:`session.list`,parameters:t},Hoe,n),observeSessions:(t,n)=>e({method:`session.observe`,parameters:t},Joe,n),showSession:(t,n)=>e({method:`session.show`,parameters:t},Uoe,n)}),lxe=e=>({waitSession:(t,n)=>e({method:`session.wait`,parameters:t},Loe,n)}),uxe=e=>({cancelTurn:(t,n)=>e({method:`turn.cancel`,parameters:t},Epe,n),listTurnQueue:(t,n)=>e({method:`turn.queue.list`,parameters:t},Dpe,n)}),dxe=e=>({showTurnAttachmentPolicy:(t,n)=>e({method:`turn.attachment.policy`,parameters:t},Tpe,n)}),fxe=e=>({interruptTurn:(t,n)=>e({method:`turn.interrupt`,parameters:t},Ope,n),sendTurn:(t,n)=>e({method:`turn.send`,parameters:t},o6,n),showTurn:(t,n)=>e({method:`turn.show`,parameters:t},kpe,n),waitTurns:(t,n)=>e({method:`turn.wait`,parameters:t},Ape,n)}),pxe=e=>({acquireTerminalController:(t,n)=>e({method:`terminal.controller.acquire`,parameters:t},nfe,n),releaseTerminalController:(t,n)=>e({method:`terminal.controller.release`,parameters:t},rfe,n),requestTerminalController:(t,n)=>e({method:`terminal.controller.request`,parameters:t},efe,n)}),mxe=e=>({closeTerminal:(t,n)=>e({method:`terminal.session.close`,parameters:t},ofe,n),resizeTerminal:(t,n)=>e({method:`terminal.session.resize`,parameters:t},ife,n),signalTerminal:(t,n)=>e({method:`terminal.session.signal`,parameters:t},afe,n)}),hxe=e=>({writeTerminalInput:(t,n)=>e({method:`terminal.input.write`,parameters:t},y4,n)}),gxe=e=>({createTerminal:(t,n)=>e({method:`terminal.create`,parameters:t},Yde,n)}),_xe=e=>({listTerminalEvents:(t,n)=>e({method:`terminal.events.list`,parameters:t},Qde,n),listTerminals:(t,n)=>e({method:`terminal.list`,parameters:t},Xde,n),showTerminal:(t,n)=>e({method:`terminal.show`,parameters:t},Zde,n)}),vxe=e=>({showTerminalControllerRequest:(t,n)=>e({method:`terminal.controller.request.show`,parameters:t},tfe,n)}),yxe=e=>({readTerminal:(t,n)=>e({method:`terminal.read`,parameters:t},$de,n)}),bxe=e=>({createOrchestrationRun:(t,n)=>e({method:`run.create`,parameters:t},EE,n),listOrchestrationRuns:(t,n)=>e({method:`run.list`,parameters:t},OE,n),showOrchestrationRun:(t,n)=>e({method:`run.show`,parameters:t},DE,n)}),xxe=e=>({listOrchestrationTasks:(t,n)=>e({method:`run.task.list`,parameters:t},kE,n),showOrchestrationTask:(t,n)=>e({method:`run.task.show`,parameters:t},AE,n)}),Sxe=e=>({acknowledgeOrchestrationDelivery:(t,n)=>e({method:`run.inbox.ack`,parameters:t},NE,n),checkOrchestrationInbox:(t,n)=>e({method:`run.inbox.check`,parameters:t},ME,n)}),Cxe=e=>({cancelOrchestrationQuestion:(t,n)=>e({method:`run.question.cancel`,parameters:t},IE,n),openOrchestrationQuestion:(t,n)=>e({method:`run.question.open`,parameters:t},PE,n),replyOrchestrationQuestion:(t,n)=>e({method:`run.question.reply`,parameters:t},FE,n)}),wxe=e=>({settleOrchestrationDispatchTerminal:(t,n)=>e({method:`run.dispatch.settle-terminal`,parameters:t},$re,n)}),Txe=e=>({showOrchestrationDispatch:(t,n)=>e({method:`run.dispatch.show`,parameters:t},jE,n)}),Exe=()=>{throw new W(`invalid_response`,`The Workspace response did not match the request.`)},Dxe=()=>{throw new W(`invalid_response`,`The Pi voice relay response did not match the request.`)},Oxe=e=>({...oxe(e),...sxe(e),...cxe(e),...lxe(e),...$ye(e)}),kxe=e=>({...xge(e),...Qve(e,Exe),...Nge(e),...fve(e)}),Axe=e=>({...ave(e),...pye(e),...$ve(e)}),jxe=e=>({...the(e),...phe(e),...bve(e),...Ive(e),...__e(e),...D_e(e),...Vge(e),...abe(e),...lhe(e),...Bye(e),...Obe(e),...$_e(e),...gve(e),...Zge(e),...Vhe(e),...l_e(e),...nye(e),...q_e(e),...nbe(e),...Qye(e)}),Mxe=e=>({...Jye(e),...Sxe(e),...Cxe(e),...bxe(e),...xxe(e),...Txe(e),...wxe(e)}),Nxe=e=>({...Wbe(e),...Hge(e),...ixe(e),...I_e(e),...kbe(e),...Abe(e),...Mxe(e),...kxe(e),...Axe(e),...Gbe(e),...axe(e),...Oxe(e),...jxe(e),...pxe(e),...vxe(e),...gxe(e),...mxe(e),..._xe(e),...yxe(e),...hxe(e),...fxe(e),...dxe(e),...uxe(e),...Cbe(e,Dxe),...ybe(e),...Khe(e)}),Pxe=e=>Nxe(Bpe(c6(e))),l5=`maia.panel.session`,Fxe=`code`,u5=e=>{let t=new URLSearchParams(e.replace(/^#/u,``)).get(Fxe);return t===null||t===``?void 0:t},Ixe=e=>{let t=e.replaceAll(/\s/gu,``),n=t.indexOf(`#`);return n===-1?t===``?void 0:t:u5(t.slice(n))},d5=e=>{try{return cr(e?.getItem(l5))}catch{return nr()}},Lxe=(e,t)=>T(()=>{try{e?.setItem(l5,t)}catch{}}),f5=e=>{try{e?.removeItem(l5)}catch{}},Rxe=N({session:j}),zxe=(e,t)=>Mf(function*(){let n=yield*I6,r=yield*k6(`${e.location.origin}${nO}`).pipe(pme({code:t})),i=yield*n.execute(r);return i.status===200?(yield*i.json.pipe(D(my(Rxe)))).session:yield*E(`refused`)}).pipe(gp,dp(U6(e.fetch))),Bxe=(e,t)=>Mf(function*(){let n=yield*(yield*I6).execute(ime(`${e.location.origin}${nO}`).pipe(A6(G6(t))));return n.status>=200&&n.status<300?`confirmed`:`unconfirmed`}).pipe(gp,K6,dp(U6(e.fetch))),Vxe=(e,t=Af)=>kf(()=>{let n=d5(e.storage);return f5(e.storage),$f(t).pipe(zf(Bxe(e,n)),Wf(()=>w(`unconfirmed`)))}),p5=(e,t)=>zxe(e,t).pipe(D(t=>Lxe(e.storage,t)),Hf(`signed-in`),Wf(()=>T(()=>(f5(e.storage),`refused`)))),Hxe=e=>Mf(function*(){let{hash:t,pathname:n,search:r}=e.location,i=u5(t);return i===void 0?ir(d5(e.storage))?`signed-out`:`signed-in`:(yield*T(()=>{e.replaceAddress(`${n}${r}`)}),yield*p5(e,i))}),Uxe=(e,t,n)=>Mf(function*(){yield*T(()=>{e.set(`starting`)});let r=Ixe(n),i=r===void 0?`refused`:yield*p5(t,r);yield*T(()=>{e.set(i)})}),Wxe=(e,t,n)=>Vxe(t,n).pipe(Bf(()=>T(()=>{e.set(`signed-out`)}))),Gxe=()=>{let e=`starting`,t=new Set;return{current:()=>e,set:n=>{n!==e&&(e=n,t.forEach(e=>{e()}))},subscribe:e=>(t.add(e),()=>{t.delete(e)})}},Kxe=e=>Hpe(Pxe(e)),qxe=e=>e.filter(e=>e.state===`ready`).toSorted((e,t)=>Number(t.kind===`local-main`)-Number(e.kind===`local-main`)||e.name.localeCompare(t.name));new TextEncoder;var Jxe=32,Yxe=12,Xxe=16,Zxe=(e,t)=>e===Yxe?4:e===Xxe?8+t%4:t,Qxe=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20)].join(`-`),$xe=O(pp(Xp),e=>Qxe(Array.from({length:Jxe},(t,n)=>Zxe(n,Math.floor(e.nextDoubleUnsafe()*16)).toString(16)).join(``))),eSe=D(pp(class extends Kr(`@maiaos/client-core/IdGenerator`,{defaultValue:()=>({uuid:$xe})}){}),e=>e.uuid),m5=e=>O(eSe,t=>`${e}_${t.replaceAll(`-`,``)}`),h5=class extends ga(`NodeStatusClientError`){operation=`node.status`},tSe=e=>({instanceId:e.instanceId,lifecycle:e.lifecycle,processResources:{activeTrees:e.processResources.activeTrees,admission:e.processResources.admission,cleanupUnknownTrees:e.processResources.cleanupUnknownTrees,nextStep:e.processResources.nextStep,pressure:e.processResources.pressure},profile:e.profile,startedAt:e.startedAt,storage:e.storage}),nSe=e=>{if(e.cause===null||typeof e.cause!=`object`)return;let t=Reflect.get(e.cause,`reason`);if(t!==void 0)return t;let n=Reflect.get(e.cause,`cause`);return typeof n==`object`&&n?Reflect.get(n,`reason`):void 0},rSe=e=>{if(!(e instanceof W))return`offline`;let t=nSe(e);return t===`bounds_exceeded`||t===`saturated`?`bounds_exceeded`:t===`cancelled_before_dispatch`||e.code===`cancelled`?`cancelled`:t===`deadline_before_dispatch`||t===`outcome_unknown`?`timed_out`:t===`credential_invalid`||t===`discovery_invalid`||t===`endpoint_invalid`||t===`platform_unsupported`||t===`request_denied`?`denied`:t===`response_invalid`||e.code===`invalid_request`||e.code===`invalid_response`?`protocol_rejected`:`offline`},iSe=e=>m5(`desktop_node_status`).pipe(D(t=>Of({catch:e=>new h5({message:`The local Maia node status request failed.`,reason:rSe(e)}),try:n=>e.status({messageId:t,signal:n})})),O(tSe),ep({duration:5500,orElse:()=>E(new h5({message:`The local Maia node status request timed out.`,reason:`timed_out`}))})),g5=e=>({read:()=>iSe(e)}),_5=(e,t)=>Kx(e.state,t).pipe(zf(T(()=>{e.emit(t)}))),v5=(e,t)=>Mf(function*(){(yield*Gx(e.closed))||(yield*Gx(e.state))!==t||(yield*T(()=>{e.emit(t)}))}),y5=(e,t)=>e.gate.withPermits(1)(Mf(function*(){if(yield*Gx(e.closed))return nr();let n=yield*Gx(e.state);if(n.generation!==t.generation)return nr();let r=t.page===void 0||e.profile.merge===void 0?t:{...t,page:e.profile.merge(t.page,n.page)};return yield*Kx(e.state,r),rr(r)})).pipe(D(or({onNone:()=>Af,onSome:t=>v5(e,t)}))),aSe=(e,t)=>e.gate.withPermits(1)(Mf(function*(){if(yield*Gx(e.closed))return nr();let n=yield*Gx(e.state);if(n.page===void 0)return nr();let r=t(n.page);if(r===n.page)return nr();let i={...n,page:r};return yield*Kx(e.state,i),rr(i)})).pipe(D(or({onNone:()=>Af,onSome:t=>v5(e,t)}))),b5=e=>Mf(function*(){yield*Kx(e.closed,!0),yield*_5(e,{generation:(yield*Gx(e.state)).generation,reason:`invalid`,status:`error`}),yield*Tne(e.request)}),oSe=(e,t)=>e.profile.read(t).pipe(cp({onFailure:n=>y5(e,{generation:t.generation,reason:n.reason,status:`error`}),onSuccess:n=>y5(e,{generation:t.generation,page:n,status:`ready`})})),sSe=(e,t)=>({generation:e,...t===void 0?{}:{page:t},status:`loading`}),x5=(e,t)=>Mf(function*(){let n=yield*Gx(e.state);if(n.generation>=2147483647)return yield*b5(e);let r=n.generation+1;yield*Kx(e.cursor,lr(t.afterCursor));let i=sSe(r,t.keep);yield*t.quiet===!0?Kx(e.state,i):_5(e,i),!(yield*Gx(e.closed))&&(yield*Dne(e.request,oSe(e,{generation:r,viewId:e.viewId,...t.afterCursor===void 0?{}:{afterCursor:t.afterCursor}})))}),S5=(e,t={})=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){(yield*Gx(e.closed))||(yield*x5(e,t))})).pipe(Uf),cSe=e=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){if(yield*Gx(e.closed))return;let t=yield*Gx(e.state);if(t.status!==`ready`||t.page===void 0)return;let n=ur(yield*Gx(e.cursor));yield*x5(e,{...n===void 0?{}:{afterCursor:n},keep:t.page})})).pipe(Uf),lSe=(e,t,n)=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){if(yield*Gx(e.closed))return;let r=yield*Gx(e.state);if(r.status!==`ready`||r.generation!==t.generation||r.page===void 0)return;let i=e.profile.selected(r.page,t);ir(i)||(yield*T(()=>{n(i.value)}))})).pipe(Uf),uSe=(e,t)=>({load:t=>S5(e,t===void 0?{}:{afterCursor:t}),loadQuietly:S5(e,{quiet:!0}),patch:t=>aSe(e,t),read:Gx(e.state),refresh:cSe(e),revoke:b5(e),run:e=>{t(e)},select:(t,n)=>lSe(e,t,n)}),dSe=(e,t)=>Mf(function*(){let n={closed:yield*Wx(!1),cursor:yield*Wx(nr()),emit:t,gate:yield*Db(1),profile:e,request:yield*Sne(),state:yield*Wx({generation:0,status:`loading`}),viewId:yield*e.identifier},r=yield*Mne();return yield*vp(()=>Kx(n.closed,!0)),uSe(n,r)}),C5=class extends ga(`PresentationError`){constructor(e){super({message:`Workspace directory ${e}.`,reason:e})}};fd(class extends mr()(`@maiaos/client-core/PresentationApi`){},{directory:()=>E(new C5(`unavailable`)),identifier:E(new C5(`unavailable`)),projects:()=>E(new C5(`unavailable`)),sessions:()=>E(new C5(`unavailable`))});var w5=class extends mr()(`@maiaos/client-core/NodeChanges`){};fd(w5,{watch:()=>Ox});var fSe=`session`,T5=Gi(2),pSe=Gi(2),mSe=Wi(150),hSe=e=>e.kind===`resync`||e.aggregateTypes.includes(fSe),gSe=e=>e.page?.observations.items.some(e=>e.runtime?.turn)??!1,_Se=e=>Mf(function*(){(yield*e.read).status===`error`&&(yield*e.load());let t=yield*e.read.pipe(Dp({schedule:ff(Wi(200)),until:({page:e,status:t})=>e!==void 0||t===`error`}));return t.page===void 0?yield*new C5(t.reason??`unavailable`):t.page.nodeInstanceId});Gp(`Presentation.watchSessionList`)(function*(e){let t=yield*w5;yield*lne(Mx(O(_Se(e),e=>t.watch(e))).pipe(Fx(hSe),une(()=>e.refresh),dne(ff(T5)),Px(ff(T5))),wx(pSe).pipe(Nx(()=>e.read),Fx(gSe))).pipe(fne(mSe),Ix(()=>e.refresh))});var E5=(e,t)=>{if(e===void 0)return!0;let n=BigInt(t.revision),r=BigInt(e.revision);return n>r||n===r&&t.seq>e.seq},vSe=(e,t,n)=>{let r=e.rows.get(t);return r!==void 0&&BigInt(r.revision)>=BigInt(n)},D5=(e,t,n)=>e===void 0||n===void 0?t:{...t,record:n(e.record,t.record)},ySe=(e,t=500)=>{let n=e.held.reduce((e,t)=>E5(e.get(t.id),t)?e.set(t.id,t):e,new Map);return{instanceId:e.instanceId,rows:new Map([...n].slice(0,t)),seq:e.seq,truncated:e.more||n.size>t}},O5=(e,t,n={})=>{let r=e.rows.get(t.id);return E5(r,t)?r===void 0&&e.rows.size>=(n.cap??500)?e.truncated?e:{...e,truncated:!0}:{...e,rows:new Map(e.rows).set(t.id,D5(r,t,n.carry))}:e},bSe=(e,t,n)=>{let r=e.rows.get(t);if(r===void 0||r.seq>=n)return e;let i=new Map(e.rows);return i.delete(t),{...e,rows:i}},xSe=(e,t,n={})=>{if(e===void 0)return t;if(e.instanceId!==t.instanceId)return{...t,reload:`instance-changed`};let r=new Map([...t.rows].map(([t,r])=>{let i=e.rows.get(t);return[t,i!==void 0&&!E5(i,r)?i:D5(i,r,n.carry)]})),i=[...e.rows.values()].filter(e=>!r.has(e.id)&&e.seq>t.seq).reduce((e,t)=>O5(e,t,n),{...t,rows:r});return t.reload===void 0?i:{...i,reload:t.reload}},k5=100,A5=(e,t)=>t===void 0?{records:e}:{nextCursor:t,records:e},j5=(e,t,n)=>{let{api:r,kind:i,seq:a}=e,o=n===void 0?{limit:k5}:{afterCursor:n,limit:k5};return i.list(r,o).pipe(D(n=>{let r=[...t,...n.records.map(e=>({id:i.id(e),record:e,revision:i.revision(e),seq:a}))];return n.nextCursor===void 0||r.length>=500?w({held:r,more:n.nextCursor!==void 0}):j5(e,r,n.nextCursor)}))},SSe=e=>Mf(function*(){let t=yield*e.api.instance,{held:n,more:r}=yield*j5(e,[]);return ySe({held:n,instanceId:t,more:r,seq:e.seq})}),M5=class extends mr()(`@maiaos/client-core/RecordsApi`){},N5=e=>{if(e instanceof C5)return e;let{kind:t}=Qx(e,{mutation:!1});return t===`unavailable`||t===`denied`||t===`invalid`?new C5(t):new C5(t===`conflict`||t===`not_found`?`scope_mismatch`:`offline`)},CSe=e=>Qx(e,{mutation:!1}).kind===`not_found`,P5=e=>D(m5(`records`),t=>Of({catch:e=>e,try:n=>e({messageId:t,signal:n})})).pipe(ep({duration:`5500 millis`,orElse:()=>E(new C5(`offline`))})),F5=e=>P5(e).pipe(qf(N5)),I5=e=>P5(e).pipe(O(rr),Kf(CSe,()=>w(nr())),qf(N5)),wSe=({client:e,instance:t})=>fd(M5,{instance:t,listAgents:t=>F5(n=>e.listAgents({...t},n)),listInteractions:t=>F5(n=>e.listInteractions({...t},n)),listRoutines:t=>F5(n=>e.listRoutines({...t},n)),showAgent:t=>I5(n=>e.showAgent({agentId:t},n)),showInteraction:t=>I5(n=>e.showInteraction({interactionId:t},n)),showRoutine:t=>I5(n=>e.showRoutine({routineId:t},n))}),TSe=e=>e===`denied`||e===`unavailable`?e:`offline`,L5=({generation:e,page:t,reason:n,status:r})=>{if(r===`error`){let t=n??`offline`;return{capability:TSe(t),generation:e,reason:t}}return t===void 0?{capability:`loading`,generation:e}:{capability:`available`,generation:e,records:[...t.rows.values()].map(e=>e.record),refreshing:r===`loading`,...t.reload===void 0?{}:{reloaded:!0,reloadReason:t.reload},truncated:t.truncated}},ESe=Wi(150),DSe=64,OSe=Gi(2),kSe=cf([uf(Gi(2)),ff(Gi(30))]),ASe=(e,t)=>t.some(t=>t.kind===`records`&&t.aggregateTypes.includes(e)),jSe=(e,t)=>t.some(t=>t.kind===`resync`||t.changed===void 0&&t.aggregateTypes.includes(e)),MSe=(e,t,n)=>[...new Set(n.flatMap(n=>n.kind===`records`?(n.changed??[]).filter(n=>n.type===e&&!vSe(t,n.id,n.revision)).map(e=>e.id):[]))],NSe=(e,t)=>Mf(function*(){let{aggregateType:n}=e;if(jSe(n,t))return yield*e.reload(`resync`);let r=yield*e.known;if(ir(r))return yield*ASe(n,t)?e.reload(`resync`):Af;let i=MSe(n,r.value,t);if(i.length>DSe)return yield*e.reload(`resync`);i.length>0&&!(yield*e.reread(i))&&(yield*e.reload(`resync`))}),PSe=e=>Mf(function*(){let t=yield*w5,n=yield*e.instance,r=yield*e.known;(ir(r)||r.value.instanceId!==n)&&(yield*e.reload()),yield*t.watch(n).pipe(pne(512,ESe),Ix(t=>NSe(e,t)))}).pipe(Yf(()=>e.reload(`subscription-lost`))),FSe=e=>PSe(e).pipe(Zf(kSe),Dp(ff(OSe)),Qf),ISe=4,LSe=Wi(100),R5=e=>Une(e,e=>e+1),RSe=({api:e,kind:t,order:n,pending:r})=>Mf(function*(){let i=yield*Bne(r,nr()),a=yield*SSe({api:e,kind:t,seq:yield*R5(n)}).pipe(xp(e=>Lu(e)?Af:Hne(r,e=>ar(e)?e:i)));return ar(i)?{...a,reload:i.value}:a}),zSe=(e,t,{id:n,seq:r,shown:i})=>{if(ir(i))return bSe(e,n,r);let a=i.value;return t.inScope(a)?O5(e,{id:n,record:a,revision:t.revision(a),seq:r},{carry:t.carry}):e},BSe=({api:e,kind:t,order:n},r,i)=>Mf(function*(){let a=yield*R5(n),o=yield*t.show(e,i);return yield*r.patch(e=>zSe(e,t,{id:i,seq:a,shown:o})),!0}).pipe(Wf(()=>w(!1))),z5=e=>e.read.pipe(Dp({schedule:ff(LSe),until:e=>e.status!==`loading`})),VSe=({pending:e},t)=>n=>Mf(function*(){n!==void 0&&(yield*Kx(e,rr(n))),yield*(yield*z5(t)).status===`ready`?t.refresh:t.loadQuietly,yield*z5(t)}),HSe=(e,t)=>{let n=n=>Tf(n,n=>BSe(e,t,n),{concurrency:ISe}).pipe(O(e=>e.every(Boolean))),r=VSe(e,t);return{load:t.load(),read:O(t.read,L5),refresh:t.refresh,reload:r,reread:n,watch:FSe({aggregateType:e.kind.aggregateType,instance:e.api.instance,known:O(z5(t),({page:e})=>lr(e)),reload:r,reread:n})}},B5=(e,t)=>Mf(function*(){let n={api:yield*M5,kind:e,order:yield*Wx(0),pending:yield*Wx(nr())};return HSe(n,yield*dSe({identifier:w(`records`),merge:(t,n)=>xSe(n,t,{carry:e.carry}),read:()=>RSe(n),selected:()=>nr()},e=>{t(L5(e))}).pipe(Jf))}),USe=({projectId:e})=>({aggregateType:Iae,id:e=>e.id,inScope:t=>t.projectId===e,list:(t,n)=>t.listAgents({...n,projectId:e}).pipe(O(e=>A5(e.items,e.nextCursor))),revision:e=>e.revision,show:(e,t)=>e.showAgent(t).pipe(O(fr(e=>e.agent)))}),WSe=(e,t)=>B5(USe(e),t),GSe=`interaction`,KSe=e=>{let{answer:t,respondingActorId:n,responseDigest:r,...i}=e;return i},qSe=({projectId:e,sessionId:t})=>({aggregateType:GSe,id:e=>e.interactionId,inScope:n=>n.projectId===e&&n.sessionId===t,list:(n,r)=>n.listInteractions({...r,projectId:e,sessionId:t}).pipe(O(e=>A5(e.items,e.nextCursor))),revision:e=>e.revision,show:(e,t)=>e.showInteraction(t).pipe(O(fr(e=>KSe(e.interaction))))}),JSe=(e,t)=>B5(qSe(e),t),YSe=`routine`,XSe=(e,t)=>t.fires===void 0&&e.fires!==void 0?{...t,fires:e.fires}:t,ZSe=e=>(t,n)=>t.listRoutines({...n,...e===void 0?{}:{projectId:e}}).pipe(O(e=>A5(e.items.map(e=>({routine:e})),e.nextCursor))),QSe=(e,t)=>e.showRoutine(t).pipe(O(fr(({fires:e,routine:t})=>({fires:e,routine:t})))),$Se=({projectId:e})=>({aggregateType:YSe,carry:XSe,id:({routine:e})=>e.id,inScope:({routine:t})=>e===void 0||t.template.projectId===e,list:ZSe(e),revision:({routine:e})=>e.revision,show:QSe}),eCe=(e,t)=>B5($Se(e),t),tCe={agents:[`agents.list`,`agents.show`],interactions:[`interaction.list`,`interaction.show`],routines:[`routine.list`,`routine.show`]},nCe=(e,t=[])=>{let n=tCe[e],r=`The Node must serve ${n[0]} and ${n[1]}.`;return{operations:n,references:t,surface:e,text:t.length===0?r:`${r} Tracked in ${t.join(`, `)}.`}},rCe=e=>{let{kind:t}=Qx(e,{mutation:!1});return t===`denied`||t===`not_found`||t===`unavailable`?t:`offline`},iCe=`protocol_incompatible`,aCe=e=>{let t=YO.safeParse(e);return t.success&&t.data.payload.error.code===iCe},oCe=(e,t)=>({request:(n,r)=>e.request(n,r).then(e=>(aCe(e)&&t(),e))}),V5=100,H5=e=>P5(e).pipe(qf(rCe)),sCe=e=>g5(e).read().pipe(O(({profile:e})=>e)),cCe=e=>g5(e).read().pipe(O(({instanceId:e})=>e),qf(({reason:e})=>new C5(e===`denied`?`denied`:`offline`))),U5=e=>H5(e).pipe(O(({items:e})=>e)),lCe=e=>({method:t,parameters:n,result:r},{messageId:i,signal:a})=>{let o={method:t,parameters:n};return e.request({inputSchema:{parse:()=>o},messageId:i,outputSchema:{parse:gy(r)},payload:o,signal:a})},uCe=(e,t)=>{let n=oCe(e,t);return{client:Kxe(n),request:lCe(Upe(n))}},dCe=e=>({layer:wSe({client:e,instance:cCe(e)}),projects:U5(t=>e.listProjects({limit:V5},t)),sessions:t=>U5(n=>e.listSessions({limit:V5,projectId:t},n))}),fCe=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),pCe=e(((e,t)=>{t.exports=fCe()})),mCe=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,ee={};function _(e,t,n){this.props=e,this.context=t,this.refs=ee,this.updater=n||h}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function te(){}te.prototype=_.prototype;function ne(e,t,n){this.props=e,this.context=t,this.refs=ee,this.updater=n||h}var re=ne.prototype=new te;re.constructor=ne,g(re,_.prototype),re.isPureReactComponent=!0;var ie=Array.isArray;function ae(){}var oe={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function ce(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function le(e,t){return ce(e.type,t,e.props)}function ue(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function de(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var fe=/\/+/g;function pe(e,t){return typeof e==`object`&&e&&e.key!=null?de(``+e.key):t.toString(36)}function me(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ae,ae):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function v(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,v(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+pe(e,0):a,ie(o)?(i=``,c!=null&&(i=c.replace(fe,`$&/`)+`/`),v(o,r,i,``,function(e){return e})):o!=null&&(ue(o)&&(o=le(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(fe,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ie(e))for(var u=0;u<e.length;u++)a=e[u],s=l+pe(a,u),c+=v(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+pe(a,u++),c+=v(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return v(me(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function he(e,t,n){if(e==null)return e;var r=[],i=0;return v(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ge(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var _e=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ve={map:he,forEach:function(e,t,n){he(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return he(e,function(){t++}),t},toArray:function(e){return he(e,function(e){return e})||[]},only:function(e){if(!ue(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ve,e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=ne,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=oe,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return oe.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!se.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return ce(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)se.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return ce(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=ue,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ge}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=oe.T,n={};oe.T=n;try{var r=e(),i=oe.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ae,_e)}catch(e){_e(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),oe.T=t}},e.unstable_useCacheRefresh=function(){return oe.H.useCacheRefresh()},e.use=function(e){return oe.H.use(e)},e.useActionState=function(e,t,n){return oe.H.useActionState(e,t,n)},e.useCallback=function(e,t){return oe.H.useCallback(e,t)},e.useContext=function(e){return oe.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return oe.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return oe.H.useEffect(e,t)},e.useEffectEvent=function(e){return oe.H.useEffectEvent(e)},e.useId=function(){return oe.H.useId()},e.useImperativeHandle=function(e,t,n){return oe.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return oe.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return oe.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return oe.H.useMemo(e,t)},e.useOptimistic=function(e,t){return oe.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return oe.H.useReducer(e,t,n)},e.useRef=function(e){return oe.H.useRef(e)},e.useState=function(e){return oe.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return oe.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return oe.H.useTransition()},e.version=`19.2.3`})),W5=e(((e,t)=>{t.exports=mCe()})),hCe=Lne(md),gCe=e=>Xf(e,e=>Du(e)?Kp(`A web UI program died.`,e):Af),G5=e=>{let t=hCe.runCallback(gCe(e));return()=>{t()}},Q=W5(),_Ce=(e,t)=>{let[n,r]=(0,Q.useState)();return(0,Q.useEffect)(()=>G5(sCe(e).pipe(D(t=>T(()=>{r({client:e,name:t})})),Qf)),[e]),n?.client===e?n.name:t},$=pCe(),vCe={},K5=(0,Q.createContext)(void 0),yCe=({children:e,value:t})=>(0,$.jsx)(K5,{value:t,children:e}),bCe=({children:e,identity:t,references:n=vCe,transport:r})=>{let[i,a]=(0,Q.useState)(!1),o=(0,Q.useMemo)(()=>uCe(r,()=>{a(!0)}),[r]),s=(0,Q.useMemo)(()=>dCe(o.client),[o]),c=_Ce(o.client,t.label),l=(0,Q.useMemo)(()=>({client:o.client,identity:{label:c},reads:s,references:n,request:o.request,skewed:i}),[o,c,s,n,i]);return(0,$.jsx)(yCe,{value:l,children:e})},q5=()=>{let e=(0,Q.useContext)(K5);if(e===void 0)throw Error(`Render the Maia screens inside <MaiaHost>.`);return e},xCe={"instance-changed":`The Node restarted, so the list was read again.`,resync:`The list was read again to catch up with the Node.`,"subscription-lost":`The live feed dropped, so the list was read again.`},J5=({what:e})=>(0,$.jsxs)(`p`,{className:`notice`,"data-state":`loading`,role:`status`,children:[`Loading `,e,`…`]}),Y5=({fault:e,unavailable:t})=>e===`unavailable`?(0,$.jsxs)(`div`,{className:`notice`,"data-state":`unavailable`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`Not on this Node yet`}),(0,$.jsx)(`p`,{children:t})]}):e===`denied`?(0,$.jsxs)(`div`,{className:`notice`,"data-state":`denied`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`Not allowed`}),(0,$.jsx)(`p`,{children:`This session may not read this list from the Node.`})]}):e===`not_found`?(0,$.jsxs)(`div`,{className:`notice`,"data-state":`not_found`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`Not found`}),(0,$.jsx)(`p`,{children:`The Node holds no such record. It may have been removed.`})]}):(0,$.jsxs)(`div`,{className:`notice`,"data-state":`offline`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`Node not answering`}),(0,$.jsx)(`p`,{children:`The list returns when the Node answers.`})]}),SCe=({reason:e})=>(0,$.jsx)(`p`,{className:`notice`,"data-state":`reloaded`,role:`status`,children:xCe[e]}),CCe=({label:e,limit:t})=>(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the first `,t,` `,e,`. The Node holds more.`]}),X5=({children:e,label:t,state:n,surface:r})=>{let{references:i}=q5();return n.capability===`loading`?(0,$.jsx)(J5,{what:t}):n.capability===`available`?(0,$.jsxs)(`div`,{"aria-busy":n.refreshing,children:[n.reloaded===!0&&n.reloadReason!==void 0&&(0,$.jsx)(SCe,{reason:n.reloadReason}),n.truncated?(0,$.jsx)(CCe,{label:t,limit:500}):null,e(n)]}):(0,$.jsx)(Y5,{fault:n.capability,unavailable:nCe(r,i[r]).text})},wCe={capability:`loading`,generation:0},TCe=Gi(30),ECe=(e,t)=>zf(t,np(TCe).pipe(zf(e.reload()),zf(t),Ep)),DCe=(e,t)=>Mf(function*(){let n=yield*e.make(t);yield*n.load,yield*ECe(n,e.beside?.(n)??Af)}).pipe(gp),Z5=e=>{let{reads:t}=q5(),[n,r]=(0,Q.useState)(wCe);return(0,Q.useEffect)(()=>G5(DCe(e,r).pipe(dp(t.layer))),[t,e]),n},Q5=e=>Z5((0,Q.useMemo)(()=>({make:t=>WSe({projectId:e},t)}),[e])),OCe=(e,t)=>Z5((0,Q.useMemo)(()=>({make:n=>JSe({projectId:e,sessionId:t},n)}),[e,t])),kCe={status:`loading`},$5=e=>{let[t,n]=(0,Q.useState)(kCe);return(0,Q.useEffect)(()=>G5(e.pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{n(e)})))),[e]),t},ACe=50,jCe=Wi(100),MCe={beside:e=>e.read.pipe(Dp({schedule:ff(jCe),until:({capability:e})=>e!==`loading`}),D(t=>t.capability===`available`?e.reread(t.records.slice(0,ACe).map(({routine:e})=>e.id)):Af),Uf),make:e=>eCe({},e)},e7=()=>Z5(MCe),NCe=16,t7=({summary:e,title:t})=>(0,$.jsxs)(`header`,{className:`screen-heading`,children:[(0,$.jsx)(`h1`,{children:t}),(0,$.jsx)(`p`,{className:`lede`,children:e})]}),n7=({items:e})=>(0,$.jsx)(`dl`,{className:`meta`,children:e.map(([e,t])=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:e}),(0,$.jsx)(`dd`,{children:t})]},e))}),r7=({iso:e})=>(0,$.jsx)(`time`,{dateTime:e,children:e.endsWith(`Z`)?`${e.slice(0,NCe).replace(`T`,` `)} UTC`:e}),PCe=e=>[...e.flat().reduce((e,t)=>e.set(t.id,t),new Map).values()],i7=({choices:e,label:t,onChange:n,value:r})=>(0,$.jsxs)(`label`,{className:`scope-choice`,children:[(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(`select`,{onChange:e=>{n(e.currentTarget.value)},value:r,children:e.map(({id:e,label:t})=>(0,$.jsx)(`option`,{value:e,children:t},e))})]}),a7=({children:e,noun:t})=>{let{reads:n}=q5(),r=$5(n.projects),[i,a]=(0,Q.useState)();if(r.status===`loading`)return(0,$.jsx)(J5,{what:`Projects`});if(r.status!==`ready`)return(0,$.jsx)(Y5,{fault:r.status,unavailable:`The Node must serve project.list.`});let[o]=r.value;if(o===void 0)return(0,$.jsxs)(`p`,{className:`empty`,children:[`No Projects on this Node yet. `,t,` belong to a Project.`]});let s=r.value.find(({id:e})=>e===i)??o;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`scope`,children:(0,$.jsx)(i7,{choices:r.value.map(({id:e,name:t})=>({id:e,label:t})),label:`Project`,onChange:a,value:s.id})}),e(s.id)]})},FCe=({children:e,projectId:t})=>{let{reads:n}=q5(),r=$5((0,Q.useMemo)(()=>n.sessions(t),[n,t])),[i,a]=(0,Q.useState)();if(r.status===`loading`)return(0,$.jsx)(J5,{what:`Sessions`});if(r.status!==`ready`)return(0,$.jsx)(Y5,{fault:r.status,unavailable:`The Node must serve session.list.`});let[o]=r.value;if(o===void 0)return(0,$.jsx)(`p`,{className:`empty`,children:`No Sessions in this Project yet. Interactions belong to a Session.`});let s=r.value.find(({id:e})=>e===i)??o;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`scope`,children:(0,$.jsx)(i7,{choices:r.value.map(({id:e,state:t,title:n})=>({id:e,label:`${n??e} · ${t}`})),label:`Session`,onChange:a,value:s.id})}),e(s.id)]})},ICe={cpu:`CPU`,disk:`disk space`,memory:`memory`},o7=e=>e.saturation===`account`?`This account is at its Session limit or its vendor limit, so nothing ran. Try again once a Session ends or the limit resets.`:`The Node's machine is low on ${e.resource===void 0?`disk space, memory or CPU`:ICe[e.resource]}, so nothing ran. Try again once it has room.`,LCe=new Set([`path_invalid`,`repository_invalid`,`routine_event_unknown`,`routine_interval_too_short`,`routine_schedule_invalid`]),s7=(e,t)=>t===void 0?{reason:e}:{code:t,reason:e},c7=e=>s7(`unknown`,e),l7=(e,t)=>t===void 0?{code:e,reason:`invalid`}:{code:e,message:t,reason:`invalid`},RCe=(e,t)=>e!==void 0&&LCe.has(e)?l7(e,t):c7(e),zCe=e=>{if(!(e instanceof W))return c7();let{code:t,kind:n,message:r,resource:i,retryable:a,saturation:o}=Qx(e,{mutation:!0});if(o===`account`||o===`host`)return i===void 0?{reason:`busy`,saturation:o}:{reason:`busy`,resource:i,saturation:o};switch(n){case`denied`:return{reason:n};case`unavailable`:return s7(n,t);case`conflict`:case`not_found`:return{reason:`conflict`};case`offline`:case`outcome_unknown`:return{reason:`offline`};case`invalid`:return t===void 0?c7():l7(t,r);case`refused`:return a?{reason:`offline`}:RCe(t,r);case`cancelled`:case`declined`:return c7(t)}},u7=e=>({...e,status:`failed`}),BCe=`30 seconds`,VCe={reason:`offline`},d7=e=>O(m5(`command`),t=>({commandId:t,input:e})),HCe=(e,t)=>D(m5(`panel`),n=>Of({catch:zCe,try:r=>t({commandId:e,options:{messageId:n,signal:r}})})).pipe(ep({duration:BCe,orElse:()=>E(VCe)})),f7=(e,t)=>op(HCe(e,t),{onFailure:e=>({failure:e,ok:!1}),onSuccess:e=>({ok:!0,value:e})}),UCe=e=>e.ok?{receipt:e.value,status:`done`}:u7(e.failure),WCe=(e,t,n)=>T(()=>{n({attempt:t,state:{status:`running`}})}).pipe(D(()=>f7(t.commandId,n=>e(t.input,n))),D(e=>T(()=>{n({attempt:t,state:UCe(e)})}))),p7=()=>{let e=(0,Q.useRef)(!1);return{busy:()=>e.current,launch:t=>{e.current||(e.current=!0,G5(yp(t,T(()=>{e.current=!1}))))}}},m7={state:{status:`idle`}},h7=e=>{let[t,n]=(0,Q.useState)(m7),{attempt:r,state:i}=t,a=p7(),o=t=>WCe(e,t,n);return{reset:()=>{a.busy()||n(m7)},retry:()=>{r!==void 0&&i.status===`failed`&&a.launch(o(r))},start:e=>{a.launch(D(d7(e),o))},state:i}},GCe=e=>O(d7(e),e=>({attempt:e,stage:`preview`})),KCe=e=>e.stage===`preview`?{status:`previewing`}:{preview:e.preview,status:`confirming`},qCe=(e,t)=>O(f7(t.commandId,n=>e.preview(t.input,n)),e=>e.ok?{held:{attempt:t,preview:e.value,stage:`confirm`},state:{preview:e.value,status:`previewed`}}:{held:{attempt:t,stage:`preview`},state:{...u7(e.failure),stage:`preview`}}),JCe=(e,t,n)=>O(f7(t.commandId,r=>e.confirm(t.input,n,r)),e=>{if(e.ok)return{state:{receipt:e.value,status:`done`}};let r={...u7(e.failure),stage:`confirm`};return e.failure.reason===`offline`?{held:{attempt:t,preview:n,stage:`confirm`},state:{...r,preview:n}}:{held:{attempt:t,stage:`preview`},state:r}}),YCe=(e,t)=>t.stage===`preview`?qCe(e,t.attempt):JCe(e,t.attempt,t.preview),XCe=(e,t,n)=>T(()=>{n({held:t,state:KCe(t)})}).pipe(D(()=>YCe(e,t)),D(e=>T(()=>{n(e)}))),g7={state:{status:`idle`}},_7=e=>{let[t,n]=(0,Q.useState)(g7),{held:r,state:i}=t,a=p7(),o=t=>XCe(e,t,n);return{confirm:()=>{r?.stage===`confirm`&&i.status===`previewed`&&a.launch(o(r))},reset:()=>{a.busy()||n(g7)},retry:()=>{r!==void 0&&i.status===`failed`&&a.launch(o(r))},start:e=>{a.launch(D(GCe(e),o))},state:i}},ZCe=e=>{let t=e.trim();return t===``?{decision:`deny`}:{decision:`deny`,reason:t}},QCe=e=>{let t=e.trim();return t===``?void 0:{answer:t,decision:`answer`}},$Ce=e=>(t,{commandId:n,options:r})=>e.respondToApproval({...t,commandId:n},r),v7=e=>{switch(e){case`command`:return`Command`;case`file_change`:return`File change`;case`question`:return`Question`;case`tool`:return`Tool call`}},y7={answered:`Answered`,approved:`Approved`,cancelled:`Cancelled`,denied:`Denied`,expired:`Expired`,pending:`Waiting`},ewe=new Map([[`approval_closed`,`This request was already answered or closed, so your answer was not recorded. It is read again below.`],[`approval_expired`,`This request expired and the Node denied it for the worker, so your answer was not recorded. It is read again below.`],[`approval_request_changed`,`This request is no longer the one you read, so your answer was not recorded. It is read again below.`]]),b7=e=>e===void 0?void 0:ewe.get(e),twe=e=>e.reason===`conflict`||e.reason===`unknown`&&b7(e.code)!==void 0,nwe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return`This request is gone or has changed on the Node, so your answer was not recorded. It is read again below.`;case`denied`:return`This session may not answer requests on this Node.`;case`invalid`:return`The Node did not accept the text. It may be too long, or hold characters the Node does not allow.`;case`offline`:return`The Node did not answer. Your answer may or may not be recorded: retry sends the same answer again, and the Node records it once.`;case`unavailable`:return`This Node does not take answers to requests yet.`;case`unknown`:return b7(e.code)??`The Node could not record your answer.`}},rwe=({busy:e,forSessionOffered:t,onChoose:n})=>(0,$.jsxs)(`div`,{className:`inbox-actions`,children:[(0,$.jsx)(`button`,{disabled:e,onClick:()=>{n({decision:`approve`})},type:`button`,children:`Approve`}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{disabled:e,onClick:()=>{n({decision:`approve_for_session`})},type:`button`,children:`Approve for this Session`}),(0,$.jsx)(`p`,{className:`inbox-hint`,children:`Approve for this Session lets the worker repeat this kind of request for the rest of the Session.`})]}):null]}),iwe=(e,t)=>QCe(e===void 0?t:e.find(({optionId:e})=>e===t)?.label??``),awe=({busy:e,onChoose:t,options:n})=>{let r=(0,Q.useId)(),[i,a]=(0,Q.useState)(``),o=iwe(n,i);return(0,$.jsxs)(`form`,{className:`inbox-form`,onSubmit:e=>{e.preventDefault(),o!==void 0&&t(o)},children:[n===void 0?(0,$.jsxs)(`div`,{className:`inbox-field`,children:[(0,$.jsx)(`label`,{htmlFor:r,children:`Your answer`}),(0,$.jsx)(`textarea`,{id:r,onChange:e=>{a(e.currentTarget.value)},rows:3,value:i})]}):(0,$.jsxs)(`fieldset`,{className:`inbox-options`,children:[(0,$.jsx)(`legend`,{children:`Your answer`}),n.map(({label:e,optionId:t})=>(0,$.jsxs)(`label`,{className:`inbox-option`,children:[(0,$.jsx)(`input`,{checked:i===t,name:r,onChange:()=>{a(t)},type:`radio`,value:t}),e]},t))]}),(0,$.jsx)(`div`,{className:`inbox-actions`,children:(0,$.jsx)(`button`,{disabled:e||o===void 0,type:`submit`,children:`Send answer`})})]})},owe=({busy:e,onChoose:t})=>{let n=(0,Q.useId)(),[r,i]=(0,Q.useState)(``);return(0,$.jsxs)(`form`,{className:`inbox-form`,onSubmit:e=>{e.preventDefault(),t(ZCe(r))},children:[(0,$.jsxs)(`div`,{className:`inbox-field`,children:[(0,$.jsx)(`label`,{htmlFor:n,children:`Reason for denying (optional)`}),(0,$.jsx)(`input`,{id:n,onChange:e=>{i(e.currentTarget.value)},type:`text`,value:r})]}),(0,$.jsx)(`div`,{className:`inbox-actions`,children:(0,$.jsx)(`button`,{disabled:e,type:`submit`,children:`Deny`})})]})},swe=e=>{switch(e.status){case`done`:return`${y7[e.receipt.approval.status]}.${e.receipt.delivery===`duplicate`?` The Node had already recorded this answer.`:``}`;case`failed`:return nwe(e);case`idle`:return``;case`running`:return`Sending your answer…`}},cwe=({approval:e,onChoose:t,onRetry:n,state:r})=>{let i=r.status===`running`;return(0,$.jsxs)(`div`,{className:`inbox-answer`,children:[e.status===`pending`?(0,$.jsxs)($.Fragment,{children:[e.kind===`question`?(0,$.jsx)(awe,{busy:i,onChoose:t,options:e.options}):(0,$.jsx)(rwe,{busy:i,forSessionOffered:e.forSessionOffered,onChoose:t}),(0,$.jsx)(owe,{busy:i,onChoose:t})]}):null,r.status===`failed`&&r.reason===`offline`?(0,$.jsx)(`div`,{className:`inbox-actions`,children:(0,$.jsx)(`button`,{onClick:n,type:`button`,children:`Retry answer`})}):null,(0,$.jsx)(`p`,{className:`inbox-status`,"data-status":r.status,role:`status`,children:swe(r)})]})},x7=e=>{let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{e&&t.current?.focus()},[e]),t},lwe=new Map,uwe=4,dwe=({agentDefinitionRef:e,title:t})=>({...e===void 0?{}:{agent:e.key},...t===void 0?{}:{title:t}}),fwe=(e,t)=>Tf(t,t=>H5(n=>e.showSession({sessionId:t},n)).pipe(O(({session:e})=>[[e.id,dwe(e)]]),Wf(()=>w([]))),{concurrency:uwe}).pipe(O(e=>new Map(e.flat()))),pwe=e=>e===``?[]:e.split(` `),mwe=e=>[...new Set(e.map(({sessionId:e})=>e))].toSorted(),hwe=e=>{let{client:t}=q5(),n=e.join(` `),r=$5((0,Q.useMemo)(()=>fwe(t,pwe(n)),[t,n]));return r.status===`ready`?r.value:lwe},S7=(e,t)=>e.get(t)?.title??t,C7={status:`loading`},gwe=(e,t)=>H5(n=>e.showApproval({approvalId:t},n)).pipe(op({onFailure:e=>({status:e}),onSuccess:({approval:e})=>({status:`ready`,value:e})})),_we=(e,t,n)=>T(()=>{n.emit(C7)}).pipe(zf(gwe(e,t).pipe(D(e=>T(()=>{n.emit(e)})),zf(sb(n.wakeups)),Ep))),vwe=e=>{let{client:t}=q5(),[n,r]=(0,Q.useState)(C7),i=(0,Q.useMemo)(()=>Bp(eb(1)),[]);return(0,Q.useEffect)(()=>G5(_we(t,e,{emit:r,wakeups:i})),[e,t,i]),{reload:(0,Q.useCallback)(()=>{nb(i,`wake`)},[i]),state:n}},w7=(e,t)=>t===void 0?[]:[[e,t]],ywe=(e,t)=>[[`From`,S7(t,e.sessionId)],...w7(`Agent`,t.get(e.sessionId)?.agent),[`Runs on`,e.executor],[`Asked`,(0,$.jsx)(r7,{iso:e.createdAt},`asked`)],[`Expires`,(0,$.jsx)(r7,{iso:e.expiresAt},`expires`)],...w7(`Worker's reason`,e.reason)],bwe=e=>e===`node`?`The Node`:e,xwe=({resolution:e,status:t})=>e===void 0?[]:[[`Outcome`,y7[t]],[`Decided by`,bwe(e.actorId)],[`Decided`,(0,$.jsx)(r7,{iso:e.resolvedAt},`decided`)],...w7(`Applies to`,e.forSession===!0?`The rest of this Session`:void 0),...w7(`Reason`,e.reason),...w7(`Answer`,e.answer)],Swe=({approval:e,children:t,focusHeading:n=!1,labels:r})=>{let i=x7(n);return(0,$.jsxs)(`section`,{"aria-label":`Request`,className:`inbox-detail`,children:[(0,$.jsxs)(`header`,{className:`inbox-header`,children:[(0,$.jsx)(`h2`,{ref:i,tabIndex:-1,children:v7(e.kind)}),(0,$.jsx)(`p`,{className:`inbox-state`,"data-state":e.status,children:y7[e.status]})]}),(0,$.jsx)(n7,{items:ywe(e,r)}),(0,$.jsx)(`h3`,{children:`What it asks`}),(0,$.jsx)(`pre`,{className:`inbox-request`,children:e.summary}),e.status===`pending`?null:(0,$.jsx)(n7,{items:xwe(e)}),t]})},Cwe=({children:e,state:t})=>t.status===`loading`?(0,$.jsx)(J5,{what:`request`}):t.status===`not_found`?(0,$.jsxs)(`div`,{className:`notice`,"data-state":`not_found`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`Not found`}),(0,$.jsx)(`p`,{children:`The Node holds no such request any more.`})]}):t.status===`ready`?e(t.value):(0,$.jsx)(Y5,{fault:t.status,unavailable:`The Node must serve approval.show.`}),wwe=({approvalId:e,focusHeading:t=!1,labels:n,onAnswered:r})=>{let{client:i}=q5(),{reload:a,state:o}=vwe(e),s=h7($Ce(i)),c=s.state;return(0,Q.useEffect)(()=>{c.status===`done`&&r(),c.status===`failed`&&twe(c)&&(a(),r())},[c,r,a]),(0,$.jsx)(Cwe,{state:o,children:e=>{let r=c.status===`done`?c.receipt.approval:e;return(0,$.jsx)(Swe,{approval:r,focusHeading:t,labels:n,children:(0,$.jsx)(cwe,{approval:r,onChoose:e=>{s.start({...e,approvalId:r.approvalId,requestDigest:r.requestDigest})},onRetry:()=>{s.retry()},state:c})})}})},Twe=`A request waits in the Inbox`,Ewe=e=>({options:{data:{approvalId:e},tag:e},title:Twe}),T7=class extends mr()(`maia/web-ui/BrowserNotifications`){},Dwe=({api:e,focus:t})=>(n,r)=>If({catch:()=>`refused`,try:()=>{if(e?.permission!==`granted`)return;let{options:i,title:a}=Ewe(n),o=new e(a,i);o.addEventListener(`click`,()=>{t(),o.close(),r()})}}).pipe(Qf),Owe=e=>{let{api:t}=e,n=T(()=>t?.permission??`unsupported`);return{permission:n,request:t===void 0?n:Of({catch:()=>`refused`,try:()=>t.requestPermission()}).pipe(Qf,zf(n)),show:Dwe(e)}},kwe=hd(T7,()=>Owe({...typeof Notification>`u`?{}:{api:Notification},focus:()=>{window.focus()}})),E7=e=>G5(dp(e,kwe)),Awe=D(pp(T7),e=>e.permission),jwe=D(pp(T7),e=>e.request),Mwe={ids:new Set,seeded:!1},Nwe=Mf(function*(){let e=yield*Wx(Mwe);return(t,n)=>Vne(e,({ids:e,seeded:n})=>[n?t.filter(({approvalId:t})=>!e.has(t)):[],{ids:new Set([...e,...t.map(({approvalId:e})=>e)]),seeded:!0}]).pipe(D(e=>Tf(e,e=>D(pp(T7),t=>t.show(e.approvalId,()=>{n(e)})),{discard:!0})))}),Pwe=(e,t)=>{let n=(0,Q.useMemo)(()=>Bp(Nwe),[]);(0,Q.useEffect)(()=>e===void 0?void 0:E7(n(e,t)),[n,e,t])},Fwe=()=>{let[e,t]=(0,Q.useState)(`unsupported`);return(0,Q.useEffect)(()=>E7(Awe.pipe(O(e=>{t(e)}))),[]),{turnOn:(0,Q.useCallback)(()=>{E7(jwe.pipe(O(e=>{t(e)})))},[]),value:e}},Iwe=({onTurnOn:e,permission:t})=>t==="default"?(0,$.jsxs)(`p`,{className:`inbox-notify`,children:[(0,$.jsx)(`button`,{onClick:e,type:`button`,children:`Turn on notifications`}),(0,$.jsx)(`span`,{className:`inbox-hint`,children:`A notification tells you that a request waits. It never says what it asks.`})]}):t===`denied`?(0,$.jsx)(`p`,{className:`inbox-notify inbox-hint`,children:`Notifications are off in your browser's settings. Turn them on there to hear of a new request.`}):null,Lwe=()=>{let{turnOn:e,value:t}=Fwe();return(0,$.jsx)(Iwe,{onTurnOn:e,permission:t})},D7=Bae,O7={status:`loading`},Rwe=(e,t)=>H5(t=>e.listApprovals({limit:D7,pendingOnly:!0},t)).pipe(op({onFailure:e=>t===void 0?{status:e}:{status:`ready`,value:{...t,stale:e}},onSuccess:({items:e})=>({status:`ready`,value:{items:e,truncated:e.length>=D7}})})),k7=(e,t,n)=>Rwe(e,n).pipe(D(n=>T(()=>{t.emit(n)}).pipe(zf(rp(np(Gi(10)),sb(t.wakeups))),zf(()=>k7(e,t,n.status===`ready`?n.value:void 0))))),zwe=(e,t)=>T(()=>{t.emit(O7)}).pipe(zf(k7(e,t))),Bwe=()=>{let{client:e}=q5(),[t,n]=(0,Q.useState)(O7),r=(0,Q.useMemo)(()=>Bp(eb(1)),[]);return(0,Q.useEffect)(()=>G5(zwe(e,{emit:n,wakeups:r})),[e,r]),{refresh:(0,Q.useCallback)(()=>{nb(r,`wake`)},[r]),state:t}},A7=`inbox`,j7=(0,Q.createContext)(void 0),Vwe=({children:e,value:t})=>(0,$.jsx)(j7,{value:t,children:e}),Hwe=({children:e,navigate:t})=>{let{refresh:n,state:r}=Bwe(),[i,a]=(0,Q.useState)(),o=(0,Q.useCallback)(e=>{a(e),t(A7)},[t]);Pwe(r.status===`ready`?r.value.items:void 0,o);let s=(0,Q.useCallback)(()=>{a(void 0)},[]),c=(0,Q.useMemo)(()=>({refresh:n,...i===void 0?{}:{requested:i},settleRequest:s,state:r}),[n,i,s,r]);return(0,$.jsx)(Vwe,{value:c,children:e})},Uwe=()=>{let e=(0,Q.useContext)(j7);if(e===void 0)throw Error(`Render the Inbox inside <InboxWatch>.`);return e},Wwe={denied:`The Node refused the latest read, so this list may be out of date.`,not_found:`The Node no longer holds this list, so it may be out of date.`,offline:`The Node did not answer the latest read, so this list may be out of date.`,unavailable:`The Node no longer serves this list, so it may be out of date.`},Gwe=({approval:e,focus:t,labels:n,onSelect:r,selected:i})=>{let a=x7(t);return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{"aria-current":i?`true`:void 0,className:`inbox-row`,onClick:()=>{r(e)},ref:a,type:`button`,children:[(0,$.jsxs)(`span`,{className:`inbox-row-head`,children:[(0,$.jsx)(`span`,{className:`inbox-row-kind`,children:v7(e.kind)}),(0,$.jsx)(`span`,{className:`inbox-state`,"data-state":e.status,children:y7[e.status]})]}),(0,$.jsx)(`span`,{className:`inbox-row-summary`,children:e.summary}),(0,$.jsxs)(`span`,{className:`inbox-row-fact`,children:[`From `,S7(n,e.sessionId),` (`,e.executor,`)`]}),(0,$.jsxs)(`span`,{className:`inbox-row-fact`,children:[`Asked `,(0,$.jsx)(r7,{iso:e.createdAt})]})]})})},Kwe=({focusId:e,labels:t,onSelect:n,selectedId:r,state:i})=>{if(i.status===`loading`)return(0,$.jsx)(J5,{what:`requests`});if(i.status!==`ready`)return(0,$.jsx)(Y5,{fault:i.status,unavailable:`The Node must serve approval.list.`});let{items:a,stale:o,truncated:s}=i.value;return(0,$.jsxs)($.Fragment,{children:[o===void 0?null:(0,$.jsx)(`p`,{className:`notice`,"data-state":`offline`,role:`status`,children:Wwe[o]}),s?(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the newest `,D7,` requests. The Node may hold more.`]}):null,a.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`Nothing waiting.`}):(0,$.jsx)(`ul`,{"aria-label":`Requests waiting`,className:`inbox-list`,children:a.map(i=>(0,$.jsx)(Gwe,{approval:i,focus:i.approvalId===e,labels:t,onSelect:n,selected:i.approvalId===r},i.approvalId))})]})},qwe=[],Jwe=[{id:A7,label:`Inbox`,screen:()=>{let{refresh:e,requested:t,settleRequest:n,state:r}=Uwe(),[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(),c=r.status===`ready`?r.value.items:qwe;t!==void 0&&t!==i&&(s(void 0),a(t)),(0,Q.useEffect)(()=>{t!==void 0&&n()},[t,n]);let l=hwe(mwe(i===void 0?c:[...c,i]));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`What the workers of this Node wait on a person for, read again every 10 seconds.`,title:`Inbox`}),(0,$.jsx)(Lwe,{}),(0,$.jsxs)(`div`,{className:`inbox-layout`,"data-view":i===void 0?`list`:`detail`,children:[(0,$.jsx)(`div`,{className:`inbox-list-pane`,children:(0,$.jsx)(Kwe,{labels:l,onSelect:e=>{s(void 0),a(e)},state:r,...o===void 0?{}:{focusId:o},...i===void 0?{}:{selectedId:i.approvalId}})}),(0,$.jsx)(`div`,{className:`inbox-detail-pane`,children:i===void 0?(0,$.jsx)(`p`,{className:`empty`,children:`Choose a request to read it.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`inbox-back`,onClick:()=>{s(i.approvalId),a(void 0)},type:`button`,children:`Back to Inbox`}),(0,$.jsx)(wwe,{approvalId:i.approvalId,focusHeading:!0,labels:l,onAnswered:e},i.approvalId)]})})]})]})}}],Ywe=({agent:e})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:e.spec.name}),(0,$.jsx)(n7,{items:[[`State`,e.state],[`Harness`,e.spec.harness],[`Placement`,e.spec.placement],[`Updated`,(0,$.jsx)(r7,{iso:e.updatedAt},`updated`)]]}),(0,$.jsx)(`p`,{className:`excerpt`,children:e.spec.instruction})]}),Xwe=({records:e})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Agents in this Project yet.`}):(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(Ywe,{agent:e},e.id))}),Zwe=({state:e})=>(0,$.jsx)(X5,{label:`agents`,state:e,surface:`agents`,children:Xwe}),Qwe=({projectId:e})=>(0,$.jsx)(Zwe,{state:Q5(e)}),$we=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The Agents of a Project, as the Node holds them.`,title:`Agents`}),(0,$.jsx)(a7,{noun:`Agents`,children:e=>(0,$.jsx)(Qwe,{projectId:e},e)})]}),eTe=({interaction:e})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:e.subject}),(0,$.jsx)(n7,{items:[[`Status`,e.lifecycleStatus],[`Kind`,e.kind],[`Opened`,(0,$.jsx)(r7,{iso:e.createdAt},`opened`)]]}),(0,$.jsx)(`p`,{className:`excerpt`,children:e.body})]}),tTe=({records:e})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Interactions in this Session yet.`}):(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(eTe,{interaction:e},e.interactionId))}),nTe=({state:e})=>(0,$.jsx)(X5,{label:`interactions`,state:e,surface:`interactions`,children:tTe}),rTe=({projectId:e,sessionId:t})=>(0,$.jsx)(nTe,{state:OCe(e,t)}),iTe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The questions and approvals of a Session, as the Node holds them.`,title:`Interactions`}),(0,$.jsx)(a7,{noun:`Interactions`,children:e=>(0,$.jsx)(FCe,{projectId:e,children:t=>(0,$.jsx)(rTe,{projectId:e,sessionId:t},t)},e)})]}),aTe=3,oTe={status:`idle`},M7={pause:`Pause`,resume:`Resume`},N7=new Map,P7=e=>`event`in e?`On event ${e.event}`:`at`in e?`Once at ${e.at}`:`everyMinutes`in e?`Every ${String(e.everyMinutes)} min from ${e.startsAt}`:`${e.expression} (${e.timezone})`,sTe=({agentId:e,executor:t})=>t===void 0&&e!==void 0?[]:[[`Executor`,t??`Not set`]],cTe=({agentId:e},t)=>e===void 0?`None`:t.get(e)??e,lTe=({mode:e,sessionId:t})=>{switch(e){case`continue`:return`Agent's home Session`;case`session`:return t===void 0?`A named Session`:`Session ${t}`;case`new`:case void 0:return`New Session per run`}},uTe=e=>{switch(e){case`target_archived`:return`Its target Session is archived.`;case`target_missing`:return`Its target Session is gone.`;default:return e}},dTe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return`Changed on the Node; reload and try again.`;case`denied`:return`This session may not change Routines.`;case`offline`:return`The Node did not answer. The change may have applied; check the list before trying again.`;case`unavailable`:return`This Node does not offer this change yet.`;case`invalid`:case`unknown`:return`The Node could not make this change.`}},fTe=({fires:e})=>e===void 0?(0,$.jsx)(`p`,{className:`excerpt`,children:`Runs not loaded yet.`}):e.length===0?(0,$.jsx)(`p`,{className:`excerpt`,children:`No runs yet.`}):(0,$.jsx)(`ol`,{"aria-label":`Latest runs`,className:`runs`,children:e.slice(0,aTe).map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:e.outcome}),` `,(0,$.jsx)(`span`,{children:e.triggerKind}),` `,(0,$.jsx)(r7,{iso:e.recordedAt})]},e.id))}),pTe=({nextFireAt:e})=>e===void 0?[]:[[`Next fire`,(0,$.jsx)(r7,{iso:e},`next`)]],mTe=({pausedReason:e,state:t})=>t===`paused`&&e!==void 0?[[`Paused because`,uTe(e)]]:[],hTe=(e,t)=>[[`State`,e.state],...mTe(e),[`Schedule`,P7(e.schedule)],...pTe(e),[`Agent`,cTe(e.template,t)],[`Target`,lTe(e.template)],...sTe(e.template)],gTe=e=>{switch(e.status){case`done`:return e.receipt.routine.state===`paused`?`Paused.`:`Resumed.`;case`failed`:return dTe(e);case`running`:return`Sending the change…`;case`idle`:return``}},_Te=(e,{revision:t})=>e.status===`done`&&BigInt(e.receipt.routine.revision)<BigInt(t),vTe=({name:e,onChange:t,running:n,state:r})=>{if(r===`disabled`)return null;let i=r===`active`?`pause`:`resume`;return(0,$.jsx)(`button`,{"aria-label":`${M7[i]} ${e}`,disabled:n,onClick:()=>{t(i)},type:`button`,children:M7[i]})},yTe=({agentNames:e=N7,fires:t,onChange:n,routine:r,state:i})=>{let a=_Te(i,r)?oTe:i;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:r.name}),(0,$.jsx)(n7,{items:hTe(r,e)}),(0,$.jsx)(fTe,{fires:t}),(0,$.jsxs)(`div`,{className:`routine-actions`,children:[(0,$.jsx)(vTe,{name:r.name,onChange:n,running:i.status===`running`,state:r.state}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`routine-status`,"data-status":a.status,role:`status`,children:gTe(a)})]})]})},F7=[X.claudeCode,X.codex],I7=128,bTe=/^[0-9A-Za-z*/,-]{1,64}(?: [0-9A-Za-z*/,-]{1,64}){4}$/u,L7=/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/u,xTe=64,STe=()=>{let{timeZone:e}=new Intl.DateTimeFormat().resolvedOptions();return L7.test(e)?e:`UTC`},R7=()=>({agentId:``,eventKind:``,executor:X.claudeCode,expression:``,mode:`new`,name:``,paused:!1,prompt:``,scheduleKind:`cron`,timezone:STe()}),CTe=e=>e===``?`Enter a name.`:e.length>I7?`Use at most ${I7} characters.`:void 0,wTe=e=>e===``?`Enter a prompt.`:void 0,TTe=e=>F7.includes(e)?void 0:`Choose an executor.`,ETe=e=>bTe.test(e)?void 0:`Enter five fields separated by spaces, such as 0 9 * * 1-5.`,DTe=e=>e.length<=xTe&&L7.test(e)?void 0:`Enter a time zone name, such as Europe/Paris or UTC.`,OTe=e=>e===``?`Enter an event kind, such as session.stopped.`:ble(e)===void 0?`Unknown event kind. Use a kind the Node records, such as session.stopped.`:void 0,kTe=e=>e.trim().replaceAll(/\s+/gu,` `),ATe=e=>({...e,eventKind:e.eventKind.trim(),expression:kTe(e.expression),name:e.name.trim(),prompt:e.prompt.trim(),timezone:e.timezone.trim()}),jTe=e=>e.scheduleKind===`cron`?[[`expression`,ETe(e.expression)],[`timezone`,DTe(e.timezone)]]:[[`eventKind`,OTe(e.eventKind)]],MTe=e=>e.agentId===``?[[`executor`,TTe(e.executor)]]:[],NTe=e=>[[`name`,CTe(e.name)],...MTe(e),[`prompt`,wTe(e.prompt)],...jTe(e)],PTe=e=>e[1]!==void 0,FTe=e=>e.scheduleKind===`cron`?{expression:e.expression,timezone:e.timezone}:{event:e.eventKind},ITe=(e,t)=>e.agentId===``?{executor:e.executor,projectId:t,prompt:e.prompt}:{agentId:e.agentId,mode:e.mode,projectId:t,prompt:e.prompt},LTe=(e,t)=>t.includes(e.agentId)?e:{...e,agentId:``},RTe=(e,t)=>{let n=ATe(e),r=Object.fromEntries(NTe(n).filter(PTe));return Object.keys(r).length>0?{errors:r,ok:!1}:{draft:{name:n.name,...n.paused?{paused:!0}:{},schedule:FTe(n),template:ITe(n,t)},ok:!0}},zTe=F([N({expression:j,timezone:j}),N({event:j}),N({at:j}),N({everyMinutes:wy,startsAt:j})]),BTe=N({items:P(N({eventId:k(j),failureReason:k(j),id:j,missed:k(wy),outcome:I([`failed`,`launching`,`skipped`,`started`]),reason:k(j),recordedAt:j,routineId:j,scheduledAt:j,sessionId:k(j),triggerKind:I([`cron`,`event`,`manual`,`webhook`]),turnId:k(j),turnState:k(j)})),method:A(`routine.runs`),nextCursor:k(j)}),VTe=(e,t,n)=>e({method:`routine.runs`,parameters:t,result:BTe},n),HTe=N({expiresAt:j,inputDigest:j,method:A(`routine.create.preview`),name:j,nextFires:P(j),proof:j,routineId:j,schedule:zTe}),UTe=N({delivery:I([`new`,`duplicate`]),method:A(`routine.create.confirm`),routine:N({id:j,name:j,state:I([`active`,`disabled`,`paused`])})}),WTe=(e,t,n)=>e({method:`routine.create.preview`,parameters:{...t,commandId:n.commandId},result:HTe},n.options),GTe=(e,{draft:t,preview:n},r)=>e({method:`routine.create.confirm`,parameters:{...t,commandId:r.commandId,inputDigest:n.inputDigest,proof:n.proof},result:UTe},r.options),KTe=[{kind:`cron`,label:`Cron`},{kind:`event`,label:`Event`}],qTe=[{label:`New Session per run`,mode:`new`},{label:`Agent's home Session`,mode:`continue`}],JTe={agents:[],failed:!1},YTe={},z7=`Fix the marked fields, then preview again.`,B7={agent_disabled:`This Agent is disabled. Choose another Agent, or enable it first.`,home_session_unavailable:`This Agent has no home Session yet. Choose New Session per run, or start the Agent first.`,routine_event_unknown:`The Node does not know this event kind. Use a kind it records, such as session.stopped.`,routine_interval_too_short:`The schedule fires more often than every 15 minutes. Choose a longer interval.`,routine_limit_reached:`This Project holds as many live Routines as it may. Disable one, then try again.`,routine_schedule_invalid:`The Node does not accept this schedule. Check the expression, time zone or event kind.`},XTe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return e.stage===`confirm`?`The preview expired or the Project changed. Preview again.`:`The Project changed or is gone. Pick it again, then preview.`;case`denied`:return`This session may not create Routines.`;case`invalid`:return B7[e.code]??`The Node refused this Routine. Check its fields.`;case`offline`:return e.stage===`confirm`?`The Node did not answer, so the Routine may already exist. Try again to find out.`:`The Node did not answer. Try again.`;case`unavailable`:return`This Node does not offer Routine creation yet.`;case`unknown`:return(e.code===void 0?void 0:B7[e.code])??`The Node could not create the Routine.`}},V7=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,ZTe=(e,t)=>{switch(e.status){case`confirming`:return`Creating the Routine…`;case`done`:return`Created ${e.receipt.routine.name} (${e.receipt.routine.state})`;case`failed`:return t?z7:XTe(e);case`idle`:return t?z7:``;case`previewed`:return`Preview ready. Review it, then create the Routine.`;case`previewing`:return`Asking the Node for a preview…`}},QTe=()=>{let{activeElement:e,body:t}=document;return e===null||e===t||e.matches(`:disabled`)},H7=e=>{let t=(0,Q.useRef)(null),n=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{n.current!==e&&(n.current=e,QTe()&&t.current?.focus())},[e]),(0,Q.useCallback)(e=>{t.current=e},[])},U7=e=>({confirm:(t,n,r)=>GTe(e,{draft:t,preview:n},r),preview:(t,n)=>WTe(e,t,n)}),W7=({children:e,error:t,hint:n,id:r,label:i})=>{let a=[n===void 0?void 0:`${r}-hint`,t===void 0?void 0:`${r}-error`].filter(e=>e!==void 0);return(0,$.jsxs)(`div`,{className:`routine-field`,children:[(0,$.jsx)(`label`,{htmlFor:r,children:i}),e({...a.length===0?{}:{"aria-describedby":a.join(` `)},"aria-invalid":t!==void 0,id:r}),n===void 0?null:(0,$.jsx)(`p`,{className:`routine-hint`,id:`${r}-hint`,children:n}),t===void 0?null:(0,$.jsx)(`p`,{className:`routine-error`,id:`${r}-error`,children:t})]})},G7=({error:e,hint:t,id:n,inputRef:r,label:i,onChange:a,value:o})=>(0,$.jsx)(W7,{error:e,hint:t,id:n,label:i,children:e=>(0,$.jsx)(`input`,{...e,autoComplete:`off`,onChange:e=>{a(e.currentTarget.value)},ref:r,required:!0,type:`text`,value:o})}),$Te=({errors:e,form:t,onChange:n})=>t.scheduleKind===`cron`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G7,{error:e.expression,hint:`Five fields: minute, hour, day, month, weekday. For example 0 9 * * 1-5.`,id:`routine-expression`,label:`Cron expression`,onChange:e=>{n({expression:e})},value:t.expression}),(0,$.jsx)(G7,{error:e.timezone,hint:`An IANA time zone name, such as Europe/Paris or UTC.`,id:`routine-timezone`,label:`Time zone`,onChange:e=>{n({timezone:e})},value:t.timezone})]}):(0,$.jsx)(G7,{error:e.eventKind,hint:`The kind of event that fires the Routine each time the Node records one, such as session.stopped.`,id:`routine-event-kind`,label:`Event kind`,onChange:e=>{n({eventKind:e})},value:t.eventKind}),eEe=({onChange:e,value:t})=>(0,$.jsxs)(`fieldset`,{className:`routine-group`,children:[(0,$.jsx)(`legend`,{children:`Schedule`}),KTe.map(({kind:n,label:r})=>(0,$.jsxs)(`label`,{className:`routine-choice`,children:[(0,$.jsx)(`input`,{checked:t===n,name:`routine-schedule-kind`,onChange:()=>{e({scheduleKind:n})},type:`radio`,value:n}),(0,$.jsx)(`span`,{children:r})]},n))]}),tEe=({error:e,onChange:t,value:n})=>(0,$.jsx)(W7,{error:e,id:`routine-executor`,label:`Executor`,children:e=>(0,$.jsx)(`select`,{...e,onChange:e=>{t({executor:e.currentTarget.value})},value:n,children:F7.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})}),nEe=({agents:e,onChange:t,value:n})=>(0,$.jsx)(W7,{hint:e.failed?`The Agents of this Project could not be read.`:void 0,id:`routine-agent`,label:`Owning Agent`,children:r=>(0,$.jsxs)(`select`,{...r,onChange:e=>{t({agentId:e.currentTarget.value})},value:n,children:[(0,$.jsx)(`option`,{value:``,children:`No Agent (runs an executor)`}),e.agents.map(({id:e,name:t})=>(0,$.jsx)(`option`,{value:e,children:t},e))]})}),rEe=({onChange:e,value:t})=>(0,$.jsxs)(`fieldset`,{className:`routine-group`,children:[(0,$.jsx)(`legend`,{children:`Target`}),qTe.map(({label:n,mode:r})=>(0,$.jsxs)(`label`,{className:`routine-choice`,children:[(0,$.jsx)(`input`,{checked:t===r,name:`routine-target`,onChange:()=>{e({mode:r})},type:`radio`,value:r}),(0,$.jsx)(`span`,{children:n})]},r))]}),iEe=({agents:e,errors:t,form:n,onChange:r})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(nEe,{agents:e,onChange:r,value:n.agentId}),n.agentId===``?(0,$.jsx)(tEe,{error:t.executor,onChange:r,value:n.executor}):(0,$.jsx)(rEe,{onChange:r,value:n.mode})]}),aEe=({error:e,onChange:t,value:n})=>(0,$.jsx)(W7,{error:e,id:`routine-prompt`,label:`Prompt`,children:e=>(0,$.jsx)(`textarea`,{...e,onChange:e=>{t({prompt:e.currentTarget.value})},required:!0,rows:6,value:n})}),oEe=({agents:e,busy:t,errors:n,focusRef:r,form:i,onChange:a,onPreview:o})=>(0,$.jsxs)(`form`,{className:`routine-form`,noValidate:!0,onSubmit:e=>{e.preventDefault(),o()},children:[(0,$.jsxs)(`fieldset`,{className:`routine-group`,disabled:t,children:[(0,$.jsx)(`legend`,{className:`visually-hidden`,children:`Routine details`}),(0,$.jsx)(G7,{error:n.name,id:`routine-name`,inputRef:r,label:`Name`,onChange:e=>{a({name:e})},value:i.name}),(0,$.jsx)(iEe,{agents:e,errors:n,form:i,onChange:a}),(0,$.jsx)(aEe,{error:n.prompt,onChange:a,value:i.prompt}),(0,$.jsx)(eEe,{onChange:a,value:i.scheduleKind}),(0,$.jsx)($Te,{errors:n,form:i,onChange:a}),(0,$.jsxs)(`label`,{className:`routine-choice`,children:[(0,$.jsx)(`input`,{checked:i.paused,onChange:e=>{a({paused:e.currentTarget.checked})},type:`checkbox`}),(0,$.jsx)(`span`,{children:`Create paused`})]})]}),(0,$.jsx)(`div`,{className:`routine-actions`,children:(0,$.jsx)(`button`,{disabled:t,type:`submit`,children:`Preview`})})]}),sEe=({preview:e})=>{let{schedule:t}=e;return`event`in t?`Fires on each ${t.event} event`:P7(t)},cEe=({preview:e})=>`event`in e.schedule?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h3`,{children:`Next fires`}),e.nextFires.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`The Node lists no upcoming fire.`}):(0,$.jsx)(`ol`,{"aria-label":`Next fires`,className:`runs`,children:e.nextFires.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(r7,{iso:e})},e))})]}),lEe=({focusRef:e,onBack:t,onConfirm:n,onRetry:r,preview:i,state:a})=>{let o=a.status===`confirming`;return(0,$.jsxs)(`section`,{"aria-labelledby":`routine-preview-title`,className:`routine-preview`,children:[(0,$.jsx)(`h2`,{id:`routine-preview-title`,ref:e,tabIndex:-1,children:`Preview`}),(0,$.jsx)(n7,{items:[[`Name`,i.name],[`Routine ID`,i.routineId],[`Schedule`,(0,$.jsx)(sEe,{preview:i},`schedule`)],[`Expires`,(0,$.jsx)(r7,{iso:i.expiresAt},`expires`)]]}),(0,$.jsx)(cEe,{preview:i}),(0,$.jsxs)(`div`,{className:`routine-actions`,children:[a.status===`failed`?(0,$.jsx)(`button`,{onClick:r,type:`button`,children:`Try again`}):(0,$.jsx)(`button`,{disabled:o,onClick:n,type:`button`,children:`Create routine`}),(0,$.jsx)(`button`,{disabled:o,onClick:t,type:`button`,children:`Back to edit`})]})]})},K7=e=>e.status===`done`?`done`:V7(e)===void 0?`form`:`preview`,uEe=e=>e.status===`failed`?`${K7(e)} failed`:K7(e),dEe=({agents:e,errors:t,focusRef:n,form:r,onAnother:i,onBack:a,onChange:o,onConfirm:s,onPreview:c,onRetry:l,state:u})=>{let d=V7(u);return u.status===`done`?(0,$.jsx)(`div`,{className:`routine-actions`,children:(0,$.jsx)(`button`,{onClick:i,ref:n,type:`button`,children:`Create another`})}):d===void 0?(0,$.jsx)(oEe,{agents:e,busy:u.status===`previewing`,errors:t,focusRef:n,form:r,onChange:o,onPreview:c}):(0,$.jsx)(lEe,{focusRef:n,onBack:a,onConfirm:s,onRetry:l,preview:d,state:u})},fEe=e=>{let t=H7(uEe(e.state));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(dEe,{...e,focusRef:t}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`routine-status`,"data-status":e.state.status,role:`status`,children:ZTe(e.state,Object.keys(e.errors).length>0)})]})},pEe=(e,t)=>H5(n=>e.listAgents({limit:gB,projectId:t},n)).pipe(O(({items:e})=>({agents:e.filter(({state:e})=>e===`active`).map(({id:e,spec:t})=>({id:e,name:t.name})),failed:!1,projectId:t})),Wf(()=>w({agents:[],failed:!0,projectId:t}))),mEe=e=>{let{client:t}=q5(),n=$5((0,Q.useMemo)(()=>pEe(t,e),[t,e]));return n.status===`ready`&&n.value.projectId===e?n.value:JTe},hEe=({projectId:e})=>{let{request:t}=q5(),n=_7(U7(t)),[r,i]=(0,Q.useState)(R7),[a,o]=(0,Q.useState)(!1),s=mEe(e),c=LTe(r,s.agents.map(({id:e})=>e)),l=RTe(c,e);return(0,$.jsx)(fEe,{agents:s,errors:a&&!l.ok?l.errors:YTe,form:c,onAnother:()=>{n.reset(),i(R7()),o(!1)},onBack:()=>{n.reset()},onChange:e=>{i(t=>({...t,...e}))},onConfirm:()=>{n.confirm()},onPreview:()=>{o(!0),l.ok&&n.start(l.draft)},onRetry:()=>{n.retry()},state:n.state})},gEe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`Preview a Routine on this Node, then create it.`,title:`New routine`}),(0,$.jsx)(a7,{noun:`Routines`,children:e=>(0,$.jsx)(hEe,{projectId:e})})]}),q7=`vllnt.routine/v1`,_Ee=`Europe/Paris`,vEe=65536,J7=(e,t)=>E({code:e,message:t}),Y7=e=>J7(`file_invalid`,e),yEe=/^\p{Cf}$/u,bEe=new Set([8204,8205]),xEe=e=>{let t=e.codePointAt(0)??0;return t<=31||t>=127&&t<=159||t===8232||t===8233||yEe.test(e)&&!bEe.has(t)},X7=e=>Array.from(e,e=>xEe(e)?`�`:e).join(``),SEe=/^(?:[01]\d|2[0-3]):[0-5]\d$/u,CEe=N({argv:P(j).check(By(1)),name:j,timeoutS:k(wy)}).pipe(Dy({timeoutS:`timeout_s`})),wEe=N({baseUrl:k(j),cli:I([`claude`,`codex`]),effort:j,keyFile:j,model:j,timeoutS:k(wy)}).pipe(Dy({baseUrl:`base_url`,keyFile:`key_file`,timeoutS:`timeout_s`})),TEe=N({event:k(j),everyMinutes:k(V.check(B({maximum:1440,minimum:5}))),times:k(P(j.check(R(SEe))).check(By(1))),timezone:k(j)}).pipe(Dy({everyMinutes:`every_minutes`})),EEe=N({enabled:k(M),engine:wEe,gate:k(xy),goal:j,host:j,id:j.check(R(/^[a-z0-9-]{2,48}$/u)),maia:k(xy),output:k(xy),owner:k(xy),promptFile:j.check(R(/^(?!\.\.?$)[^/\\]+$/u)),schedule:TEe,schema:A(q7),tools:k(N({agent:k(P(xy)),collect:k(P(CEe)),mcp:k(P(xy))}))}).pipe(Dy({promptFile:`prompt_file`})),DEe=my(Kte(xy)),OEe=my(EEe,{onExcessProperty:`error`}),kEe=xee({checkHook:()=>`invalid value`,leafHook:({_tag:e})=>e}),AEe=({issues:e})=>e.slice(0,3).map(({message:e,path:t=[]})=>[...t.map(e=>String(typeof e==`object`?e.key:e)),e].join(` `)).map(X7).join(`; `),jEe=e=>D(Wf(DEe(e),()=>Y7(`The file is not valid JSON.`)),e=>Wf(OEe(e),({issue:e})=>Y7(`The file is not a ${q7} routine: ${AEe(kEe(e))}.`))),MEe=`.json`,NEe=(e,t)=>{let{id:n,schedule:r,tools:i}=e;return n===t?[r.event,r.everyMinutes,r.times].filter(e=>e!==void 0).length===1?(i?.agent?.length??0)+(i?.mcp?.length??0)>0?J7(`tools_unsupported`,`Maia grants no per-routine agent or mcp tools; the executor and Agent policy govern them.`):w(e):Y7(`The schedule must give exactly one of times, every_minutes or event.`):Y7(`The routine id must equal the file name ${X7(t)}.`)},PEe=(e,t)=>D(jEe(e),e=>NEe(e,t.endsWith(MEe)?t.slice(0,-5):t)),Z7=e=>[...new Set(e)].sort((e,t)=>e-t),FEe=e=>{let t=Z7(e.map(e=>Number(e.slice(0,2)))),n=Z7(e.map(e=>Number(e.slice(3))));return n.length===1||t.length===1?`${n.join(`,`)} ${t.join(`,`)} * * *`:void 0},IEe=e=>{if(e<60)return 60%e==0?`*/${String(e)} * * * *`:void 0;if(e%60!=0||1440%e!=0)return;let t=e/60;return t===24?`0 0 * * *`:`0 */${String(t)} * * *`},LEe=({everyMinutes:e,times:t})=>t===void 0?e===void 0?void 0:IEe(e):FEe(t),REe=e=>{let{event:t,timezone:n=_Ee}=e;if(t!==void 0)return w({event:t});let r=LEe(e);return r===void 0?J7(`schedule_unsupported`,`The schedule is not one cron expression: times must share a minute or an hour, and every_minutes must divide 60 or be whole hours dividing 24.`):w({expression:r,timezone:n})},Q7=({tools:e})=>e?.collect??[],zEe=(e,t)=>{let n=Q7(e);return[e.goal,t.trimEnd(),n.length===0?``:[`Before you answer, run these read-only commands and use their output:`,...n.map(({argv:e,name:t})=>`- ${X7(t)}: ${X7(e.join(` `))}`)].join(`
|
|
20
|
+
`)].filter(e=>e!==``).join(`
|
|
21
|
+
|
|
22
|
+
`)},BEe=e=>[[!0,`engine.model`],[!0,`engine.effort`],[e.engine.timeoutS!==void 0,`engine.timeout_s`],[e.gate!==void 0,`gate`],[e.output!==void 0,`output`],[e.owner!==void 0,`owner`],[e.maia!==void 0,`maia`]].flatMap(([e,t])=>e?[t]:[]),VEe=e=>{let t=new TextEncoder().encode(e).length;return t>16384?J7(`prompt_too_large`,`The prompt is ${String(t)} bytes; a turn takes at most ${String(Gj)}.`):Af},HEe=(e,t,{projectId:n})=>Mf(function*(){let r=zEe(e,t);yield*VEe(r);let i=yield*REe(e.schedule);return{collect:Q7(e).length,draft:{name:e.id,...e.enabled===!1?{paused:!0}:{},schedule:i,template:{executor:e.engine.cli===`claude`?X.claudeCode:X.codex,projectId:n,prompt:r}},host:e.host,ignored:BEe(e)}}),$7=`.json`,UEe=[`active`,`paused`],e9=`unreadable`,WEe=e=>e.size>65536?E(e9):Of({catch:()=>e9,try:()=>e.text()}),GEe=e=>op(WEe(e),{onFailure:()=>({name:e.name}),onSuccess:t=>({name:e.name,text:t})}),KEe=e=>wf(e.map(GEe)),qEe=(e,t)=>e===`any`||e===t?Af:J7(`host_mismatch`,`Runs on host ${X7(e)}; import it on that Node or set host to any.`),JEe=e=>e.endsWith($7)?e.slice(0,-5):e,YEe=({chosen:e,file:t,index:n},{nodeLabel:r,projectId:i})=>Mf(function*(){if(n>=50)return yield*J7(`file_invalid`,`An import takes at most 50 routine files; import the rest in another batch.`);if(t.text===void 0)return yield*J7(`file_invalid`,`The file must be UTF-8 text of at most ${String(vEe)} bytes.`);let a=yield*PEe(t.text,t.name),o=e.find(({name:e})=>e===a.promptFile)?.text;if(o===void 0)return yield*J7(`prompt_missing`,`The prompt file ${X7(a.promptFile)} is not among the selected files, or cannot be read.`);let s=yield*HEe(a,o,{projectId:i});return yield*qEe(s.host,r),s}),XEe=(e,t)=>op(YEe(e,t),{onFailure:t=>({file:e.file.name,kind:`refused`,name:JEe(e.file.name),refusal:t}),onSuccess:t=>({file:e.file.name,kind:`ready`,mapped:t,name:t.draft.name})}),ZEe=(e,t)=>wf(e.filter(({name:e})=>e.endsWith($7)).map((n,r)=>XEe({chosen:e,file:n,index:r},t))),t9=(e,t)=>[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>e[n]===t[n]),QEe=(e,t)=>t9(e.schedule,t.schedule)&&t9({...e.template,mode:e.template.mode??`new`},{...t.template,mode:`new`}),$Ee=(e,t)=>H5(n=>e.listRoutines({...t,limit:100},n)).pipe(O(({items:e})=>e)),eDe=(e,t)=>wf(UEe.map(n=>$Ee(e,{projectId:t,state:n}))).pipe(O(e=>new Map(e.flat().map(e=>[e.name,e])))),n9=new Map([[`internal_error`,`The Node failed while importing.`],[`routine_event_unknown`,`The Node does not know this event.`],[`routine_interval_too_short`,`The schedule fires more often than the Node allows.`],[`routine_schedule_invalid`,`The Node does not accept this schedule.`],[`storage_failed`,`The Node could not store the Routine.`]]),tDe=(e,t)=>{switch(t.reason){case`busy`:return o7(t);case`conflict`:return`${e} changed, is gone, or its preview expired. Import it again.`;case`denied`:return`This session may not import ${e}.`;case`invalid`:return n9.get(t.code)??t.message??`The Node refused ${e}.`;case`offline`:return`The Node did not answer, so ${e} may or may not be imported. Retrying is safe.`;case`unavailable`:return`Not on this Node yet: it does not offer routine import.`;case`unknown`:return(t.code===void 0?void 0:n9.get(t.code))??`The Node could not import ${e}.`}},nDe=(e,t)=>{switch(t.status){case`confirming`:return`Importing ${e}…`;case`done`:return`Imported ${t.receipt.routine.name} (${t.receipt.routine.state})`;case`failed`:return tDe(e,t);case`idle`:return``;case`previewed`:return`Preview ready for ${e}. Check the next fires, then confirm.`;case`previewing`:return`Previewing ${e}…`}},rDe=({preview:e})=>`event`in e.schedule?(0,$.jsxs)(`p`,{className:`excerpt`,children:[`Fires each time the Node journals a `,e.schedule.event,` event.`]}):(0,$.jsx)(`ol`,{"aria-label":`Next fires`,className:`runs`,children:e.nextFires.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(r7,{iso:e})},e))}),iDe=(e,{confirm:t,retry:n,start:r,state:i})=>{let{name:a}=e;if(i.status!==`done`){if(i.status===`previewed`||i.status===`confirming`)return{disabled:i.status===`confirming`,handleClick:t,label:`Confirm import of ${a}`};if(i.status===`failed`&&i.reason===`offline`)return{disabled:!1,handleClick:n,label:`Retry import of ${a}`};if(i.status!==`failed`||i.reason!==`denied`&&i.reason!==`unavailable`)return{disabled:i.status===`previewing`,handleClick:()=>{r(e)},label:`Import ${a}`}}},aDe=({draft:e,handle:t})=>{let n=H7(t.state.status),r=iDe(e,t);return(0,$.jsxs)($.Fragment,{children:[t.state.status===`previewed`||t.state.status===`confirming`?(0,$.jsx)(rDe,{preview:t.state.preview}):null,(0,$.jsxs)(`div`,{className:`routine-actions`,children:[r===void 0?null:(0,$.jsx)(`button`,{disabled:r.disabled,onClick:r.handleClick,ref:n,type:`button`,children:r.label}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`routine-status`,"data-status":t.state.status,ref:r===void 0?n:void 0,role:`status`,tabIndex:r===void 0?-1:void 0,children:nDe(e.name,t.state)})]})]})},oDe=({draft:e})=>{let{request:t}=q5(),n=_7(U7(t));return(0,$.jsx)(aDe,{draft:e,handle:n})},sDe=({draft:e,live:t})=>{let n=t.get(e.name);return n===void 0?(0,$.jsx)(oDe,{draft:e}):QEe(n,e)?(0,$.jsx)(`p`,{className:`excerpt`,"data-state":`skipped`,children:`Already on this Node (unchanged)`}):(0,$.jsx)(`p`,{className:`notice`,"data-state":`conflict`,children:`A different Routine named ${e.name} is on this Node; disable it, then import again.`})},cDe=({entry:e,live:t})=>{if(e.kind===`refused`)return(0,$.jsxs)(`p`,{className:`notice`,"data-state":`refused`,children:[`Cannot import (`,e.refusal.code,`): `,e.refusal.message]});let{collect:n,draft:r,host:i,ignored:a}=e.mapped,o=n===0?[]:[[`Collect commands`,String(n)]],s=[[`Schedule`,P7(r.schedule)],[`Executor`,r.template.executor??`Default`],[`State`,r.paused===!0?`Paused`:`Active`],[`Host`,i],[`Ignored`,a.join(`, `)],...o];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n7,{items:s}),(0,$.jsx)(sDe,{draft:r,live:t})]})},lDe=({entries:e,live:t})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`Select at least one routine .json file.`}):(0,$.jsx)(`ul`,{"aria-label":`Import plan`,className:`records`,children:e.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:e.file}),(0,$.jsx)(cDe,{entry:e,live:t})]},e.file))}),uDe=({files:e,projectId:t})=>{let{client:n,identity:r}=q5(),{label:i}=r,a=(0,Q.useMemo)(()=>D(KEe(e),e=>ZEe(e,{nodeLabel:i,projectId:t})),[e,i,t]),o=(0,Q.useMemo)(()=>eDe(n,t),[n,t]),s=$5(a),c=$5(o);return c.status===`loading`||s.status===`loading`?(0,$.jsx)(J5,{what:`the selected files`}):c.status===`ready`?s.status===`ready`?(0,$.jsx)(lDe,{entries:s.value,live:c.value}):(0,$.jsx)(J5,{what:`the selected files`}):(0,$.jsx)(Y5,{fault:c.status,unavailable:`The Node must serve routine.list.`})},dDe=(e,t)=>({files:t,number:e.number+1}),fDe={files:[],number:0},pDe=({projectId:e})=>{let[t,n]=(0,Q.useState)(fDe),r=(0,Q.useId)();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`scope`,children:(0,$.jsxs)(`div`,{className:`routine-import routine-form`,children:[(0,$.jsxs)(`label`,{className:`routine-field`,children:[(0,$.jsx)(`span`,{children:`Routine files`}),(0,$.jsx)(`input`,{accept:`.json,.md,.txt`,"aria-describedby":r,multiple:!0,onChange:e=>{let t=[...e.currentTarget.files??[]];n(e=>dDe(e,t))},type:`file`})]}),(0,$.jsx)(`p`,{className:`routine-hint`,id:r,children:`Select each routine .json file and the prompt files it names. Each file is read in this browser; a routine goes to the Node when you start its import.`})]})}),t.files.length>0&&(0,$.jsx)(uDe,{files:t.files,projectId:e},t.number)]})},mDe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`Bring routine files into a Project on this Node.`,title:`Import routines`}),(0,$.jsx)(a7,{noun:`Routines`,children:e=>(0,$.jsx)(pDe,{projectId:e},e)})]}),hDe=(e,t)=>BigInt(e.revision)>BigInt(t.revision),gDe=()=>{let{client:e}=q5();return h7(({action:t,expectedRevision:n,routineId:r},{commandId:i,options:a})=>{let o={commandId:i,expectedRevision:n,routineId:r};return t===`pause`?e.pauseRoutine(o,a):e.resumeRoutine(o,a)})},_De=(e,t)=>{let[n,r]=(0,Q.useState)();return t.status===`done`&&t.receipt.routine!==n&&r(t.receipt.routine),n!==void 0&&hDe(n,e)?n:e},r9=e=>[...new Set(e)].toSorted(),vDe=e=>{let t=e.flatMap(({routine:{template:e}})=>e.agentId===void 0?[]:[{agentId:e.agentId,projectId:e.projectId}]);return{agentIds:r9(t.map(({agentId:e})=>e)),projectIds:r9(t.map(({projectId:e})=>e))}},yDe=(e,{agentIds:t,projectIds:n})=>wf(n.map(n=>H5(t=>e.listAgents({limit:gB,projectId:n},t)).pipe(O(({items:e})=>e.filter(({id:e})=>t.includes(e)).map(e=>[e.id,e.spec.name])),Wf(()=>w([]))))).pipe(O(e=>new Map(e.flat()))),i9=e=>e===``?[]:e.split(` `),bDe=e=>{let{client:t}=q5(),n=vDe(e),r=n.agentIds.join(` `),i=n.projectIds.join(` `),a=$5((0,Q.useMemo)(()=>yDe(t,{agentIds:i9(r),projectIds:i9(i)}),[r,t,i]));return a.status===`ready`?a.value:N7},xDe=({agentNames:e,record:t})=>{let{start:n,state:r}=gDe(),i=_De(t.routine,r);return(0,$.jsx)(yTe,{agentNames:e,fires:t.fires,onChange:e=>{n({action:e,expectedRevision:i.revision,routineId:i.id})},routine:i,state:r})},SDe=({records:e})=>{let t=bDe(e);return(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(xDe,{agentNames:t,record:e},e.routine.id))})},CDe=({records:e})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Routines on this Node yet.`}):(0,$.jsx)(SDe,{records:e}),wDe=({state:e})=>(0,$.jsx)(X5,{label:`routines`,state:e,surface:`routines`,children:CDe}),TDe=()=>{let e=e7();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The Routines of this Node, when each runs next and its latest runs.`,title:`Routines`}),(0,$.jsx)(wDe,{state:e})]})},a9={status:`loading`},EDe=e=>{let{code:t,kind:n}=Qx(e,{mutation:!1});return n===`unavailable`||t===`frame_invalid`?`unavailable`:n===`denied`?`denied`:`offline`},DDe=(e,t)=>P5(n=>VTe(e,t===void 0?{limit:50}:{limit:50,routineId:t},n)).pipe(qf(EDe),D(e=>aee.pipe(O(t=>({items:e.items,truncated:e.nextCursor!==void 0,updatedAt:pm(t)}))))),ODe=(e,t,n)=>T(()=>{n(a9)}).pipe(zf(DDe(e,t).pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{n(e)})),zf(np(Gi(10))),Ep))),kDe=e=>{let{request:t}=q5(),[n,r]=(0,Q.useState)(a9);return(0,Q.useEffect)(()=>G5(ODe(t,e,r)),[t,e]),n},o9=``,ADe=11,jDe=19,s9=(e,t)=>t===void 0?[]:[[e,String(t)]],MDe=e=>[[`Outcome`,e.outcome],[`Trigger`,e.triggerKind],...s9(`Turn`,e.turnState),...s9(`Reason`,e.reason),...s9(`Failure`,e.failureReason),...s9(`Missed slots`,e.missed),[`Scheduled`,(0,$.jsx)(r7,{iso:e.scheduledAt},`scheduled`)],[`Recorded`,(0,$.jsx)(r7,{iso:e.recordedAt},`recorded`)],...s9(`Session`,e.sessionId)],NDe=({name:e,run:t})=>(0,$.jsxs)(`li`,{className:`run`,"data-outcome":t.outcome,children:[(0,$.jsx)(`p`,{className:`run-routine`,children:e}),(0,$.jsx)(n7,{items:MDe(t)})]}),PDe=({choices:e,onChange:t,value:n})=>(0,$.jsx)(`div`,{className:`scope`,children:(0,$.jsxs)(`label`,{className:`scope-choice`,children:[(0,$.jsx)(`span`,{children:`Routine`}),(0,$.jsxs)(`select`,{onChange:e=>{t(e.currentTarget.value)},value:n,children:[(0,$.jsx)(`option`,{value:o9,children:`All Routines`}),e.map(({id:e,name:t})=>(0,$.jsx)(`option`,{value:e,children:t},e))]})]})}),FDe=({state:e})=>(0,$.jsx)(`p`,{className:`runs-status`,children:e.status===`ready`?`Updated ${e.value.updatedAt.slice(ADe,jDe)} UTC`:``}),IDe=({choices:e,state:t})=>{if(t.status===`loading`)return(0,$.jsx)(J5,{what:`runs`});if(t.status!==`ready`)return(0,$.jsx)(Y5,{fault:t.status,unavailable:`The Node must serve routine.runs.`});let{items:n,truncated:r}=t.value,i=new Map(e.map(({id:e,name:t})=>[e,t]));return(0,$.jsxs)($.Fragment,{children:[r?(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the newest `,50,` runs. The Node holds more.`]}):null,n.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No runs yet.`}):(0,$.jsx)(`ul`,{className:`run-list`,children:n.map(e=>(0,$.jsx)(NDe,{name:i.get(e.routineId)??e.routineId,run:e},e.id))})]})},LDe=({choices:e,onFilter:t,routineId:n,state:r})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(PDe,{choices:e,onChange:t,value:n}),(0,$.jsx)(FDe,{state:r}),(0,$.jsx)(IDe,{choices:e,state:r})]}),RDe=[{id:`routines`,label:`Routines`,screen:TDe},{id:`routine-runs`,label:`Runs`,screen:()=>{let[e,t]=(0,Q.useState)(o9),n=e7(),r=kDe(e===o9?void 0:e),i=n.capability===`available`?n.records.map(({routine:{id:e,name:t}})=>({id:e,name:t})):[];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The newest runs of the Routines on this Node, read again every 10 seconds.`,title:`Runs`}),(0,$.jsx)(LDe,{choices:i,onFilter:t,routineId:e,state:r})]})}},{id:`routine-new`,label:`New routine`,screen:gEe},{id:`import-routines`,label:`Import`,screen:mDe}],zDe=3,BDe=({record:e})=>{let{fires:t}=e;return t===void 0?(0,$.jsx)(`p`,{className:`excerpt`,children:`Runs not loaded yet.`}):t.length===0?(0,$.jsx)(`p`,{className:`excerpt`,children:`No runs yet.`}):(0,$.jsx)(`ol`,{"aria-label":`Latest runs`,className:`runs`,children:t.slice(0,zDe).map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:e.outcome}),` `,(0,$.jsx)(`span`,{children:e.triggerKind}),` `,(0,$.jsx)(r7,{iso:e.recordedAt})]},e.id))})},VDe=({record:e})=>{let{routine:t}=e;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:t.name}),(0,$.jsx)(n7,{items:[[`State`,t.state],[`Schedule`,P7(t.schedule)],[`Executor`,t.template.executor]]}),(0,$.jsx)(BDe,{record:e})]})},HDe=({records:e})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Routines on this Node yet.`}):(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(VDe,{record:e},e.routine.id))}),UDe=({state:e})=>(0,$.jsx)(X5,{label:`routines`,state:e,surface:`routines`,children:HDe}),WDe=()=>(0,$.jsx)(UDe,{state:e7()}),GDe=[{id:`agents`,label:`Agents`,screen:$we},{id:`routines`,label:`Routines`,screen:()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The Routines of this Node and their latest runs.`,title:`Routines`}),(0,$.jsx)(WDe,{})]})},{id:`interactions`,label:`Interactions`,screen:iTe}],KDe=131072,qDe=(e,t,n)=>e.showGoal({sessionId:t},n),JDe=(e,{change:t,sessionId:n},{commandId:r,options:i})=>{switch(t.kind){case`set`:return e.setGoal({commandId:r,sessionId:n,text:t.text},i);case`update`:return e.updateGoal({commandId:r,expectedRevision:t.expectedRevision,sessionId:n,text:t.text},i);case`clear`:return e.clearGoal({commandId:r,expectedRevision:t.expectedRevision,sessionId:n},i)}},YDe=(e,t)=>H5(n=>qDe(e,t,n)),c9=(e,t)=>e===null?{kind:`set`,text:t}:{expectedRevision:e.revision,kind:`update`,text:t},l9=e=>{if(e.trim()===``)return`Enter the goal text.`;let t=new TextEncoder().encode(e).byteLength;return t>131072?`The goal is ${String(t)} bytes. The limit is ${String(KDe)}.`:void 0},XDe={status:`loading`},ZDe=e=>{let[t,n]=(0,Q.useState)(e),[r,i]=(0,Q.useState)(0);return e!==t&&(n(e),e.status===`done`&&i(r+1)),r},QDe=(e,t)=>{let{client:n}=q5(),[r,i]=(0,Q.useState)();return(0,Q.useEffect)(()=>G5(YDe(n,e).pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{i({goal:e,round:t})})))),[n,t,e]),r?.round===t?r.goal:XDe},$De=e=>{let{client:t}=q5(),n=h7((n,r)=>JDe(t,{change:n,sessionId:e},r)),[r,i]=(0,Q.useState)(0);return{change:n,goal:QDe(e,ZDe(n.state)+r),reload:()=>{i(r+1)}}},eOe={"goal.clear":`Goal cleared.`,"goal.set":`Goal set.`,"goal.update":`Goal updated.`},tOe={denied:`Not allowed`,not_found:`Not found`,offline:`Node not answering`,unavailable:`Not on this Node yet`},nOe={denied:`This session may not read this Session's goal.`,not_found:`The Node holds no goal for this Session.`,offline:`The goal returns when the Node answers.`,unavailable:`This Node does not keep Session goals yet.`},rOe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return`The goal changed elsewhere. Reload it, then try again.`;case`denied`:return`This session may not change the goal.`;case`invalid`:case`unknown`:return e.code===`frame_invalid`?`The Node refused this goal text. It must not be empty and must fit the limit.`:`The Node could not change the goal.`;case`offline`:return`The Node did not answer, so the change may have applied. Try again to find out.`;case`unavailable`:return`This Session's executor does not take a goal.`}},iOe=e=>{switch(e.status){case`done`:return eOe[e.receipt.method];case`failed`:return rOe(e);case`idle`:return``;case`running`:return`Saving the goal…`}},aOe=({fault:e,onReload:t})=>(0,$.jsxs)(`div`,{className:`notice`,"data-state":e,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:tOe[e]}),(0,$.jsx)(`p`,{children:nOe[e]}),e===`offline`?(0,$.jsx)(`button`,{onClick:t,type:`button`,children:`Reload goal`}):null]}),u9=({action:e,busy:t,initial:n,onCancel:r,onSubmit:i})=>{let a=(0,Q.useId)(),[o,s]=(0,Q.useState)(n),[c,l]=(0,Q.useState)(!1),u=c?l9(o):void 0;return(0,$.jsxs)(`form`,{className:`goal-form`,noValidate:!0,onSubmit:e=>{e.preventDefault(),l(!0),l9(o)===void 0&&i(o)},children:[(0,$.jsxs)(`div`,{className:`goal-field`,children:[(0,$.jsx)(`label`,{htmlFor:a,children:`Goal`}),(0,$.jsx)(`textarea`,{"aria-describedby":u===void 0?void 0:`${a}-error`,"aria-invalid":u!==void 0,disabled:t,id:a,onChange:e=>{s(e.currentTarget.value)},rows:5,value:o}),u===void 0?null:(0,$.jsx)(`p`,{className:`goal-error`,id:`${a}-error`,role:`alert`,children:u})]}),(0,$.jsxs)(`div`,{className:`goal-actions`,children:[(0,$.jsx)(`button`,{disabled:t,type:`submit`,children:e}),r===void 0?null:(0,$.jsx)(`button`,{disabled:t,onClick:r,type:`button`,children:`Cancel`})]})]})},oOe=({busy:e,onClear:t,onKeep:n})=>(0,$.jsxs)(`div`,{"aria-label":`Confirm clearing the goal`,className:`goal-actions`,role:`group`,children:[(0,$.jsx)(`p`,{children:`Clear this goal?`}),(0,$.jsx)(`button`,{disabled:e,onClick:t,type:`button`,children:`Confirm clear`}),(0,$.jsx)(`button`,{disabled:e,onClick:n,type:`button`,children:`Keep goal`})]}),sOe=({busy:e,onMode:t})=>(0,$.jsxs)(`div`,{className:`goal-actions`,children:[(0,$.jsx)(`button`,{disabled:e,onClick:()=>{t(`edit`)},type:`button`,children:`Edit goal`}),(0,$.jsx)(`button`,{disabled:e,onClick:()=>{t(`clear`)},type:`button`,children:`Clear goal`})]}),cOe=({busy:e,goal:t,mode:n,onChange:r,onMode:i})=>n===`edit`?(0,$.jsx)(u9,{action:`Update goal`,busy:e,initial:t.text,onCancel:()=>{i(`view`)},onSubmit:e=>{r(c9(t,e))}}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`goal-text`,children:t.text}),(0,$.jsx)(n7,{items:[[`Revision`,t.revision],[`Set`,(0,$.jsx)(r7,{iso:t.setAt},`set`)]]}),n===`clear`?(0,$.jsx)(oOe,{busy:e,onClear:()=>{r({expectedRevision:t.revision,kind:`clear`})},onKeep:()=>{i(`view`)}}):(0,$.jsx)(sOe,{busy:e,onMode:i})]}),lOe=({change:e,onReload:t,onRetry:n})=>e.status===`failed`?e.reason===`conflict`?(0,$.jsx)(`button`,{onClick:t,type:`button`,children:`Reload goal`}):e.reason===`offline`?(0,$.jsx)(`button`,{onClick:n,type:`button`,children:`Try again`}):null:null,uOe=({change:e,goal:t,mode:n,onChange:r,onMode:i,onReload:a})=>{if(t.status===`loading`)return(0,$.jsx)(J5,{what:`goal`});if(t.status!==`ready`)return(0,$.jsx)(aOe,{fault:t.status,onReload:a});let o=e.status===`running`,s=t.value.goal;return s===null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`empty`,children:`No goal`}),(0,$.jsx)(u9,{action:`Set goal`,busy:o,initial:``,onSubmit:e=>{r(c9(s,e))}})]}):(0,$.jsx)(cOe,{busy:o,goal:s,mode:e.status===`done`?`view`:n,onChange:r,onMode:i})},dOe=e=>(0,$.jsxs)(`section`,{className:`goal`,children:[(0,$.jsx)(`h2`,{children:`Goal`}),(0,$.jsx)(uOe,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`goal-status`,"data-status":e.change.status,role:`status`,children:iOe(e.change)}),(0,$.jsx)(lOe,{change:e.change,onReload:e.onReload,onRetry:e.onRetry})]}),fOe=({sessionId:e})=>{let{change:t,goal:n,reload:r}=$De(e),[i,a]=(0,Q.useState)(`view`);return(0,$.jsx)(dOe,{change:t.state,goal:n,mode:i,onChange:e=>{t.start(e)},onMode:e=>{t.reset(),a(e)},onReload:()=>{t.reset(),a(`view`),r()},onRetry:()=>{t.retry()}})},pOe=({sessionId:e})=>(0,$.jsx)(fOe,{sessionId:e},e),mOe=e=>({confirm:(t,n,{commandId:r,options:i})=>e.call(`turn.steer.confirm`,{commandId:r,expectedRevision:n.expectedRevision,input:n.input,inputDigest:n.inputDigest,proof:n.proof,turnId:n.turnId,validUntil:n.validUntil},i),preview:({sessionRevision:t,text:n,turnId:r},{commandId:i,options:a})=>e.call(`turn.steer.preview`,{commandId:i,expectedRevision:t,input:{text:n,type:`text`},turnId:r},a)}),d9=e=>{if(e.trim()===``)return`Enter what to tell the running turn.`;let t=new TextEncoder().encode(e).byteLength;return t>16384?`The steer is ${String(t)} bytes. The limit is ${String(Gj)}.`:void 0},hOe={"interrupt-restart":`Warning: this executor cannot take input mid-turn. Confirming interrupts the running turn and its in-flight work is discarded. Your text then runs as the next turn.`,native:`Delivered into the running turn.`},gOe={"interrupt-restart":`The running turn was interrupted and its in-flight work discarded. Your text runs as the next turn.`,native:`Delivered into the running turn.`},_Oe={duplicate:`Duplicate: the Node had already taken this steer`,new:`New`},vOe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return e.stage===`confirm`?`The steer was not sent: the preview expired, the turn is no longer running, or the Session changed. Preview again.`:`The turn is no longer running, or the Session changed since this page read it. Wait for the Session to update, then preview again.`;case`denied`:return`This session may not steer a turn.`;case`invalid`:case`unknown`:return`The Node could not take the steer.`;case`offline`:return e.stage===`confirm`?`The Node did not answer, so the steer may already have been sent. Try again to find out.`:`The Node did not answer. Try again.`;case`unavailable`:return`This Node, or this Session's executor, cannot take a steer.`}},yOe=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,bOe=e=>{switch(e.status){case`confirming`:return`Sending the steer…`;case`done`:return gOe[e.receipt.path];case`failed`:return vOe(e);case`idle`:return``;case`previewed`:return`Preview ready. Read the path, then confirm the steer.`;case`previewing`:return`Asking the Node for a preview…`}},xOe=({onBack:e,onConfirm:t,onRetry:n,preview:r,state:i})=>{let a=i.status===`confirming`;return(0,$.jsxs)(`section`,{"aria-label":`Steer preview`,className:`steer-preview`,children:[(0,$.jsx)(n7,{items:[[`Turn`,r.turnId],[`Valid until`,(0,$.jsx)(r7,{iso:r.validUntil},`until`)]]}),(0,$.jsx)(`p`,{className:`steer-text`,children:r.input.text}),(0,$.jsx)(`p`,{className:`steer-path`,"data-path":r.path,children:hOe[r.path]}),(0,$.jsxs)(`div`,{className:`steer-actions`,children:[i.status===`failed`?(0,$.jsx)(`button`,{onClick:n,type:`button`,children:`Try again`}):(0,$.jsx)(`button`,{disabled:a,onClick:t,type:`button`,children:`Confirm steer`}),(0,$.jsx)(`button`,{disabled:a,onClick:e,type:`button`,children:`Edit steer`})]})]})},SOe=({busy:e,initial:t,onPreview:n})=>{let r=(0,Q.useId)(),[i,a]=(0,Q.useState)(t),[o,s]=(0,Q.useState)(!1),c=o?d9(i):void 0;return(0,$.jsxs)(`form`,{className:`steer-form`,noValidate:!0,onSubmit:e=>{e.preventDefault(),s(!0),d9(i)===void 0&&n(i)},children:[(0,$.jsxs)(`div`,{className:`steer-field`,children:[(0,$.jsx)(`label`,{htmlFor:r,children:`Steer the running turn`}),(0,$.jsx)(`textarea`,{"aria-describedby":c===void 0?void 0:`${r}-error`,"aria-invalid":c!==void 0,disabled:e,id:r,onChange:e=>{a(e.currentTarget.value)},rows:3,value:i}),c===void 0?null:(0,$.jsx)(`p`,{className:`steer-error`,id:`${r}-error`,role:`alert`,children:c})]}),(0,$.jsx)(`div`,{className:`steer-actions`,children:(0,$.jsx)(`button`,{disabled:e,type:`submit`,children:`Preview steer`})})]})},COe=({onAgain:e,result:t})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(n7,{items:[[`Delivery`,_Oe[t.delivery]],[`Turn`,t.turn.id]]}),(0,$.jsx)(`div`,{className:`steer-actions`,children:(0,$.jsx)(`button`,{onClick:e,type:`button`,children:`Steer again`})})]}),wOe=({initial:e,onAgain:t,onBack:n,onConfirm:r,onPreview:i,onRetry:a,state:o})=>{let s=yOe(o);return o.status===`done`?(0,$.jsx)(COe,{onAgain:t,result:o.receipt}):s===void 0?(0,$.jsx)(SOe,{busy:o.status===`previewing`,initial:e,onPreview:i}):(0,$.jsx)(xOe,{onBack:n,onConfirm:r,onRetry:a,preview:s,state:o})},TOe=e=>(0,$.jsxs)(`section`,{className:`steer`,children:[(0,$.jsx)(wOe,{...e}),(0,$.jsx)(`p`,{className:`steer-status`,"data-status":e.state.status,role:`status`,children:bOe(e.state)})]}),EOe=(e,t,n)=>e.status===`idle`?t:n,DOe=({onDone:e,sessionRevision:t,turnId:n})=>{let{client:r}=q5(),i=_7(mOe(r)),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)();(0,Q.useEffect)(()=>{i.state.status===`done`&&e()},[e,i.state]);let l=EOe(i.state,n,s);return l===void 0?null:(0,$.jsx)(TOe,{initial:a,onAgain:()=>{i.reset(),o(``)},onBack:()=>{i.reset()},onConfirm:()=>{i.confirm()},onPreview:e=>{c(l),o(e),i.start({sessionRevision:t,text:e,turnId:l})},onRetry:()=>{i.retry()},state:i.state})},OOe=({onDone:e,sessionId:t,sessionRevision:n,turnId:r})=>(0,$.jsx)(DOe,{onDone:e,sessionRevision:n,...r===void 0?{}:{turnId:r}},t),kOe=(e,t)=>({expectedRevision:n,text:r},{commandId:i,options:a})=>e.sendTurn({commandId:i,expectedRevision:n,input:{text:r,type:`text`},sessionId:t},a),AOe={turn_queue_full:`The Session already holds as many turns as it may. Wait for one to finish, then send again.`},jOe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return`The Session changed before the message arrived. It is read again every 2 seconds; send the message again.`;case`denied`:return`This session may not send messages.`;case`invalid`:return`The Node refused this message.`;case`offline`:return`The Node did not answer. The message may have been sent: check the transcript, or retry the same send.`;case`unavailable`:return`This Node does not accept messages yet.`;case`unknown`:return(e.code===void 0?void 0:AOe[e.code])??`The Node could not take the message.`}},MOe=(e,t,n)=>{switch(e.status){case`done`:return`Sent.`;case`failed`:return jOe(e);case`idle`:return t?``:`This Session is ${n}. It takes messages while it runs.`;case`running`:return`Sending the message…`}},NOe=new TextEncoder,f9=e=>e.status===`failed`&&e.reason===`offline`,POe=({accepting:e,id:t,onRetry:n,sessionState:r,state:i})=>(0,$.jsxs)($.Fragment,{children:[f9(i)?(0,$.jsx)(`button`,{onClick:n,type:`button`,children:`Retry send`}):null,(0,$.jsx)(`p`,{className:`composer-status`,"data-status":i.status,id:t,role:`status`,children:MOe(i,e,r)})]}),FOe=({accepting:e,draft:t,onDraft:n,onRetry:r,onSend:i,sessionState:a,state:o})=>{let s=(0,Q.useId)(),c=o.status===`running`,l=NOe.encode(t).byteLength>Gj;return(0,$.jsxs)(`form`,{className:`composer`,onSubmit:e=>{e.preventDefault(),i()},children:[(0,$.jsx)(`label`,{htmlFor:s,children:`Message`}),(0,$.jsx)(`textarea`,{"aria-describedby":`${s}-status`,"aria-invalid":l,id:s,onChange:e=>{n(e.currentTarget.value)},rows:3,value:t}),l?(0,$.jsxs)(`p`,{className:`composer-error`,children:[`The message is longer than `,Gj,` bytes.`]}):null,(0,$.jsxs)(`div`,{className:`composer-actions`,children:[(0,$.jsx)(`button`,{disabled:c||f9(o)||!e||l||t.trim().length===0,type:`submit`,children:`Send`}),(0,$.jsx)(POe,{accepting:e,id:`${s}-status`,onRetry:r,sessionState:a,state:o})]})]})},IOe=(e,t)=>e===t?``:e,LOe=({refresh:e,runningTurnId:t,session:n})=>{let{client:r}=q5(),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(),{retry:u,start:d,state:f}=h7(kOe(r,n.id));return(0,Q.useEffect)(()=>{f.status===`done`&&e()},[e,f]),f.status===`done`&&f.receipt!==c&&(l(f.receipt),a(IOe(i,o))),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(FOe,{accepting:n.state===`running`,draft:i,onDraft:a,onRetry:u,onSend:()=>{s(i),d({expectedRevision:n.revision,text:i})},sessionState:n.state,state:f}),(0,$.jsxs)(`div`,{className:`composer-steer`,children:[t===void 0?null:(0,$.jsx)(`p`,{className:`composer-note`,children:`A turn is running. A message you send waits behind it; steer changes the running turn now.`}),(0,$.jsx)(OOe,{onDone:e,sessionId:n.id,sessionRevision:n.revision,...t===void 0?{}:{turnId:t}})]})]})},p9=`board.tasks.list`,ROe=N({items:P(N({claim:N({leaseExpiresAt:j.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/u),L(e=>!Number.isNaN(Date.parse(e)),{expected:`a valid ISO time`}))}),holderSessionId:j,id:j,state:I([`waiting`,`ready`,`claimed`,`blocked`,`completed`,`failed`,`cancelled`]),title:j})),method:A(p9)}),zOe=(e,t)=>({status:`ready`,value:{asOf:t,byHolder:Map.groupBy(e,({holderSessionId:e})=>e)}}),m9=`${p9} is not on this Node.`,BOe=e=>{throw e instanceof W&&e.remoteError?.code===`frame_invalid`?new W(`remote_error`,m9,{cause:e,remoteError:{code:`unsupported_method`,message:m9,retryable:!1},synthetic:!0}):e},VOe=(e,t,n)=>e({method:p9,parameters:{held:!0,projectId:t},result:ROe},n).catch(BOe),HOe=(e,t)=>H5(n=>VOe(e,t,n)).pipe(cp({onFailure:e=>w({status:e}),onSuccess:({items:e})=>Td.pipe(O(t=>zOe(e,t)))})),h9=(e,t)=>e.status===`ready`?{asOf:e.value.asOf,items:e.value.byHolder.get(t)??[],status:`ready`}:{status:e.status},UOe=(e,t)=>Date.parse(e.claim.leaseExpiresAt)<=t,g9={denied:`Tasks unavailable`,not_found:`Tasks unavailable`,offline:`Tasks unavailable`,unavailable:`Tasks: not on this Node yet`},_9=({state:e})=>(0,$.jsx)(`span`,{className:`task-state`,"data-state":e,children:e}),WOe=e=>`${String(e)} ${e===1?`task`:`tasks`} held`,GOe=({sessionId:e,tasks:t})=>{let n=h9(t,e);if(n.status!==`ready`)return(0,$.jsx)(`span`,{className:`session-row-fact`,"data-state":n.status,children:g9[n.status]});if(n.items.length===0)return(0,$.jsx)(`span`,{className:`session-row-fact`,children:`No tasks held`});let r=n.items.length-3;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`session-row-fact`,children:WOe(n.items.length)}),n.items.slice(0,3).map(({id:e,state:t,title:n})=>(0,$.jsxs)(`span`,{className:`session-row-task`,children:[(0,$.jsx)(`span`,{className:`session-row-task-title`,children:n}),(0,$.jsx)(_9,{state:t})]},e)),r>0?(0,$.jsxs)(`span`,{className:`session-row-fact`,children:[`+`,r,` more`]}):null]})},KOe=({asOf:e,task:t})=>UOe(t,e)?`Lease expired`:(0,$.jsxs)($.Fragment,{children:[`Lease until `,(0,$.jsx)(r7,{iso:t.claim.leaseExpiresAt})]}),qOe=({tasks:e})=>e.status===`ready`?e.items.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No tasks held`}):(0,$.jsx)(`ul`,{"aria-label":`Held tasks`,className:`task-list`,children:e.items.map(t=>(0,$.jsxs)(`li`,{className:`task`,children:[(0,$.jsx)(`span`,{className:`task-title`,children:t.title}),(0,$.jsx)(_9,{state:t.state}),(0,$.jsxs)(`span`,{className:`task-fact`,children:[`Task `,(0,$.jsx)(`code`,{children:t.id})]}),(0,$.jsx)(`span`,{className:`task-fact`,children:(0,$.jsx)(KOe,{asOf:e.asOf,task:t})})]},t.id))}):(0,$.jsx)(`p`,{className:`notice`,"data-state":e.status,role:`status`,children:g9[e.status]}),JOe=({sessionId:e,tasks:t})=>(0,$.jsxs)(`section`,{className:`session-tasks`,children:[(0,$.jsx)(`h2`,{children:`Held tasks`}),(0,$.jsx)(qOe,{tasks:h9(t,e)})]}),YOe={completed:`Completed`,dispatching:`Starting`,failed:`Failed`,interrupted:`Interrupted`,"outcome-unknown":`Outcome unknown`,queued:`Queued`,running:`Running`},v9={approval_required:`an approval was required`,output_limit_exceeded:`the output grew past its limit`,protocol_invalid:`the runtime sent a message the Node could not read`,repository_changed:`the repository changed under the turn`,runtime_exited:`the runtime exited`,runtime_failed:`the runtime failed`,turn_deadline_exceeded:`the turn ran past its deadline`,turn_rejected:`the turn was rejected`},XOe=(e,t)=>{switch(e){case`denied`:return`This session may no longer read ${t}. Showing the last read.`;case`not_found`:return`The Node no longer holds ${t}. Showing the last read.`;case`offline`:return`The Node did not answer. Showing the last read.`;case`unavailable`:return`The Node no longer serves ${t}. Showing the last read.`}},y9=({fault:e,what:t})=>(0,$.jsx)(`p`,{className:`notice`,"data-state":`offline`,role:`status`,children:XOe(e,t)}),ZOe=e=>{switch(e.state){case`completed`:return e.responseText===``?`The turn finished without a response.`:void 0;case`dispatching`:return`The turn is starting.`;case`failed`:return`The turn failed: ${v9[e.failureReason]}.${e.failure===void 0?``:` ${e.failure.message}`}`;case`interrupted`:return`The turn was interrupted before it finished.`;case`outcome-unknown`:return`The Node cannot tell whether the turn finished: ${v9[e.failureReason]}.${e.failure===void 0?``:` ${e.failure.message}`}`;case`queued`:return`The turn waits behind other turns.`;case`running`:return`The agent is working…`}},QOe=({turn:e})=>{let t=ZOe(e);return(0,$.jsxs)(`div`,{className:`turn-response`,children:[(0,$.jsx)(`p`,{className:`turn-author`,children:`Agent`}),e.state===`completed`?null:(0,$.jsx)(`p`,{className:`turn-badge`,"data-state":e.state,children:YOe[e.state]}),e.state===`completed`&&e.responseText!==``?(0,$.jsx)(`p`,{className:`turn-text`,children:e.responseText}):null,t===void 0?null:(0,$.jsx)(`p`,{className:`turn-note`,children:t})]})},$Oe=({turn:e})=>e.state===`unavailable`?(0,$.jsx)(`li`,{className:`turn`,"data-state":`unavailable`,children:(0,$.jsx)(`div`,{className:`turn-response`,children:(0,$.jsx)(`p`,{className:`turn-note`,children:`Turn text unavailable`})})}):(0,$.jsxs)(`li`,{className:`turn`,"data-state":e.state,children:[(0,$.jsxs)(`div`,{className:`turn-message`,children:[(0,$.jsxs)(`p`,{className:`turn-author`,children:[`You `,(0,$.jsx)(r7,{iso:e.createdAt})]}),(0,$.jsx)(`p`,{className:`turn-text`,children:e.input.text})]}),(0,$.jsx)(QOe,{turn:e})]}),eke=({snapshot:{partial:e,pruned:t,stale:n,total:r,turns:i}})=>(0,$.jsxs)(`div`,{className:`transcript`,children:[e===void 0?null:(0,$.jsx)(`p`,{className:`notice`,"data-state":`reading`,role:`status`,children:`Still reading the events of this Session. Newer turns follow.`}),t?(0,$.jsx)(`p`,{className:`notice`,"data-state":`pruned`,role:`status`,children:`The Node pruned older events, so earlier turns are not shown.`}):null,r>i.length?(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the latest `,i.length,` of `,r,` turns.`]}):null,n===void 0?null:(0,$.jsx)(y9,{fault:n,what:`this Session`}),(0,$.jsx)(`div`,{"aria-label":`Transcript`,role:`log`,children:i.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No messages in this Session yet.`}):(0,$.jsx)(`ol`,{className:`turns`,children:i.map(e=>(0,$.jsx)($Oe,{turn:e},e.id))})})]}),b9=(e,t)=>e===`denied`||e===`unavailable`?30:t,tke=32,nke=4,x9={status:`loading`},rke={cursor:`0`,due:new Set,ids:[],pruned:!1,turns:new Map},ike=e=>`turnId`in e.payload?[e.payload.turnId]:[],ake=(e,t)=>{let n=t.items.flatMap(ike);return{...e,cursor:t.nextSessionCursor??t.items.at(-1)?.sessionCursor??e.cursor,due:new Set([...e.due,...n]),ids:[...new Set([...e.ids,...n])],pruned:e.pruned||t.oldestRetainedCursor!==void 0}},S9=e=>new Map(e.map(e=>[e.id,e])),oke=(e,t)=>Tf(t,t=>H5(n=>e.showTurn({turnId:t},n)).pipe(op({onFailure:()=>[],onSuccess:({turn:e})=>[e]})),{concurrency:nke}).pipe(O(e=>S9(e.flat()))),ske={partial:!0},C9=({ids:e})=>e.slice(-50),cke=(e,t)=>{let n=C9(e);return{...e,due:new Set(n.filter(n=>e.due.has(n)&&!t.has(n))),turns:S9(n.flatMap(n=>{let r=t.get(n)??e.turns.get(n);return r===void 0?[]:[r]}))}},lke=e=>C9(e).map(t=>e.turns.get(t)??{id:t,state:`unavailable`}),uke=(e,t,n)=>{let r=lke(t),i=n?void 0:r.findLast(({state:e})=>e===`running`)?.id;return{...n?ske:{},pruned:t.pruned,...i===void 0?{}:{runningTurnId:i},session:e,total:t.ids.length,turns:r}},dke=(e,t)=>Mf(function*(){let n=yield*Gx(e.known),r=cke(n,yield*oke(e.client,C9(n).filter(e=>n.due.has(e))));yield*Kx(e.known,r);let{session:i}=yield*H5(t=>e.client.showSession({sessionId:e.sessionId},t)),a=uke(i,r,t);yield*Kx(e.known,{...r,shown:a}),yield*T(()=>{e.emit({status:`ready`,value:a})})}),w9=e=>Mf(function*(){let t=yield*Gx(e.known),n=yield*H5(n=>e.client.listSessionEvents({afterSessionCursor:t.cursor,limit:tke,sessionId:e.sessionId},n));yield*Kx(e.known,ake(t,n));let r=n.nextSessionCursor!==void 0;(!r||t.shown===void 0)&&(yield*dke(e,r)),r&&(yield*w9(e))}),fke=e=>w9(e).pipe(cp({onFailure:t=>Gx(e.known).pipe(D(({shown:n})=>T(()=>{e.emit(n===void 0?{status:t}:{status:`ready`,value:{...n,stale:t}})})),Hf(b9(t,2))),onSuccess:()=>w(2)})),pke=e=>fke(e).pipe(D(t=>rp(np(Gi(t)),sb(e.wakeups))),Ep),mke=(e,t,n)=>T(()=>{n.emit(x9)}).pipe(zf(Wx(rke)),D(r=>pke({...n,client:e,known:r,sessionId:t}))),hke=e=>{let{client:t}=q5(),[n,r]=(0,Q.useState)(x9),i=(0,Q.useMemo)(()=>Bp(eb(1)),[]);return(0,Q.useEffect)(()=>G5(mke(t,e,{emit:r,wakeups:i})),[t,e,i]),{refresh:(0,Q.useCallback)(()=>{nb(i,`wake`)},[i]),state:n}},gke=7,T9=({agentDefinitionRef:e,executor:t})=>t===void 0?e===void 0?`Not set`:`Agent ${e.key}`:t.model===void 0?t.kind:`${t.kind} (${t.model})`,_ke=({worktree:e})=>e===void 0?[]:[[`Branch`,(0,$.jsx)(`code`,{children:e.branch},`branch`)],[`Base`,(0,$.jsxs)(`code`,{children:[e.baseRef,` @`,` `,e.baseRevision.slice(0,gke)]},`base`)],[`Worktree`,e.state]],vke=({failure:e})=>e===void 0?[]:[[`Failure`,e.message]],yke=e=>[[`Runs on`,T9(e)],..._ke(e),...vke(e),[`Updated`,(0,$.jsx)(r7,{iso:e.updatedAt},`updated`)]],E9=e=>{let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{e&&t.current?.focus()},[e]),t},bke=({focus:e,session:t})=>{let n=E9(e);return(0,$.jsxs)(`header`,{className:`session-header`,children:[(0,$.jsxs)(`div`,{className:`session-title`,children:[(0,$.jsx)(`h2`,{ref:n,tabIndex:-1,children:t.title??t.id}),(0,$.jsx)(`p`,{className:`session-state`,"data-state":t.state,children:t.state})]}),(0,$.jsx)(n7,{items:yke(t)})]})},xke=({focusHeading:e=!1,refresh:t,sessionId:n,state:r,tasks:i})=>{if(r.status===`loading`)return(0,$.jsx)(J5,{what:`Session`});if(r.status!==`ready`)return(0,$.jsx)(Y5,{fault:r.status,unavailable:`The Node must serve session.show, session.events.list and turn.show.`});let{runningTurnId:a,session:o}=r.value;return(0,$.jsxs)(`section`,{"aria-label":`Session`,className:`session-detail`,children:[(0,$.jsx)(bke,{focus:e,session:o}),(0,$.jsx)(pOe,{sessionId:n}),i===void 0?null:(0,$.jsx)(JOe,{sessionId:n,tasks:i}),(0,$.jsx)(eke,{snapshot:r.value}),(0,$.jsx)(LOe,{refresh:t,...a===void 0?{}:{runningTurnId:a},session:o})]})},D9=({focusHeading:e=!1,sessionId:t,tasks:n})=>{let{refresh:r,state:i}=hke(t);return(0,$.jsx)(xke,{focusHeading:e,refresh:r,sessionId:t,state:i,...n===void 0?{}:{tasks:n}})},O9={status:`loading`},k9=(e,t)=>wf([H5(t=>e.host.client.listSessions({limit:100,projectId:e.projectId},t)),HOe(e.host.request,e.projectId)],{concurrency:`unbounded`}).pipe(op({onFailure:e=>({fault:e,...t===void 0?{}:{kept:t},state:t===void 0?{status:e}:{status:`ready`,value:{...t,stale:e}}}),onSuccess:([{items:e,nextCursor:t},n])=>{let r={items:e,tasks:n,truncated:t!==void 0};return{kept:r,state:{status:`ready`,value:r}}}}),D(({fault:t,kept:n,state:r})=>T(()=>{e.emit(r)}).pipe(zf(np(Gi(b9(t,10)))),zf(()=>k9(e,n))))),Ske=(e,t,n)=>T(()=>{n(O9)}).pipe(zf(k9({emit:n,host:e,projectId:t}))),Cke=e=>{let{client:t,request:n}=q5(),[r,i]=(0,Q.useState)(O9);return(0,Q.useEffect)(()=>G5(Ske({client:t,request:n},e,i)),[t,e,n]),r},wke=({focus:e,onSelect:t,selected:n,session:r,tasks:i})=>{let a=E9(e);return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{"aria-current":n?`true`:void 0,className:`session-row`,onClick:()=>{t(r.id)},ref:a,type:`button`,children:[(0,$.jsx)(`span`,{className:`session-row-title`,children:r.title??r.id}),(0,$.jsx)(`span`,{className:`session-state`,"data-state":r.state,children:r.state}),(0,$.jsx)(`span`,{className:`session-row-fact`,children:T9(r)}),r.worktree===void 0?null:(0,$.jsxs)(`span`,{className:`session-row-fact`,children:[`Branch `,(0,$.jsx)(`code`,{children:r.worktree.branch})]}),(0,$.jsxs)(`span`,{className:`session-row-fact`,children:[`Updated `,(0,$.jsx)(r7,{iso:r.updatedAt})]}),(0,$.jsx)(GOe,{sessionId:r.id,tasks:i})]})})},Tke=({focusId:e,onSelect:t,selectedId:n,state:r})=>{if(r.status===`loading`)return(0,$.jsx)(J5,{what:`Sessions`});if(r.status!==`ready`)return(0,$.jsx)(Y5,{fault:r.status,unavailable:`The Node must serve session.list.`});let{items:i,stale:a,tasks:o,truncated:s}=r.value;return(0,$.jsxs)($.Fragment,{children:[a===void 0?null:(0,$.jsx)(y9,{fault:a,what:`the Sessions list`}),s?(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the first `,100,` Sessions. The Node holds more.`]}):null,i.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Sessions in this Project yet.`}):(0,$.jsx)(`ul`,{"aria-label":`Sessions`,className:`session-list`,children:i.map(r=>(0,$.jsx)(wke,{focus:r.id===e,onSelect:t,selected:r.id===n,session:r,tasks:o},r.id))})]})},Eke=({projectId:e})=>{let t=Cke(e),[n,r]=(0,Q.useState)(),[i,a]=(0,Q.useState)();return(0,$.jsxs)(`div`,{className:`sessions-layout`,"data-view":n===void 0?`list`:`detail`,children:[(0,$.jsx)(`div`,{className:`sessions-list-pane`,children:(0,$.jsx)(Tke,{onSelect:e=>{a(void 0),r(e)},state:t,...i===void 0?{}:{focusId:i},...n===void 0?{}:{selectedId:n}})}),(0,$.jsx)(`div`,{className:`sessions-detail-pane`,children:n===void 0?(0,$.jsx)(`p`,{className:`empty`,children:`Choose a Session to read it.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`sessions-back`,onClick:()=>{a(n),r(void 0)},type:`button`,children:`Back to Sessions`}),(0,$.jsx)(D9,{focusHeading:!0,sessionId:n,...t.status===`ready`?{tasks:t.value.tasks}:{}},n)]})})]})},Dke=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The Sessions of a Project: their state and branch, and each one's live transcript.`,title:`Sessions`}),(0,$.jsx)(a7,{noun:`Sessions`,children:e=>(0,$.jsx)(Eke,{projectId:e},e)})]}),Oke=100,kke=e=>({agentId:t,agentName:n,workspaceId:r},{commandId:i,options:a})=>e.createSession({agentId:t,commandId:i,expectedRevision:`0`,workspaceId:r},a).then(({session:e})=>({agentName:n,commandId:i,session:e})),Ake=e=>({commandId:t,session:n},{options:r})=>e.startSession({commandId:`${t}.start`,expectedRevision:n.revision,sessionId:n.id},r),jke=(e,t)=>H5(n=>e.listWorkspaces({afterCursor:`0`,limit:Oke,projectId:t},n)).pipe(O(({items:e})=>qxe(e)[0])),Mke=e=>{let{client:t}=q5();return $5((0,Q.useMemo)(()=>jke(t,e),[t,e]))},Nke=e=>{switch(e.status){case`denied`:return`This session may not read the Workspaces of this Project, so Chat is off.`;case`loading`:return;case`not_found`:return`The Node holds no record of the Workspaces of this Project, so Chat is off.`;case`offline`:return`The Node did not answer when asked for the Workspaces of this Project, so Chat is off.`;case`ready`:return e.value===void 0?`This Project has no ready Workspace to run a Session in, so Chat is off.`:void 0;case`unavailable`:return`This Node does not list Workspaces yet, so Chat is off.`}},Pke=(e,t)=>{if(e.status===`idle`)return{step:`idle`};if(e.status===`running`)return{step:`creating`};if(e.status===`failed`)return{failure:e,stage:`create`,step:`failed`};let n=e.receipt;return t.status===`failed`?{created:n,failure:t,stage:`start`,step:`failed`}:{created:n,step:t.status===`done`?`started`:`starting`}},Fke=({step:e})=>e===`creating`||e===`starting`,Ike=e=>`created`in e,Lke=()=>{let{client:e}=q5(),t=h7(kke(e)),n=h7(Ake(e)),r=Pke(t.state,n.state),i=r.step===`starting`&&n.state.status===`idle`?r.created:void 0,a=(0,Q.useEffectEvent)(e=>{n.start(e)});return(0,Q.useEffect)(()=>{i!==void 0&&a(i)},[i]),{begin:t.start,reset:()=>{t.reset(),n.reset()},retry:()=>{t.state.status===`failed`?t.retry():n.retry()},state:r}},Rke=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return`The Agent or its Workspace changed or is gone. Wait for the list to update, then try Chat again.`;case`denied`:return`This session may not create Sessions.`;case`invalid`:return`The Node refused to create a Session for this Agent.`;case`offline`:return`The Node did not answer, so the Session may already exist. Try again to find out.`;case`unavailable`:return`This Node does not offer Sessions yet.`;case`unknown`:return`The Node could not create a Session for this Agent.`}},zke=e=>{let t=`The Session was created but is not running.`;switch(e.reason){case`busy`:return`${t} ${o7(e)}`;case`conflict`:return`${t} It changed before it could start. Open it to see where it stands.`;case`denied`:return`${t} This session may not start Sessions.`;case`invalid`:return`${t} The Node refused to start it.`;case`offline`:return`${t} The Node did not answer, so it may be running already. Start it again to find out.`;case`unavailable`:return`${t} This Node does not start Sessions yet.`;case`unknown`:return`${t} The Node could not start it.`}},Bke=e=>{switch(e.step){case`creating`:return`Creating a Session…`;case`failed`:return e.stage===`create`?Rke(e.failure):zke(e.failure);case`idle`:case`started`:return``;case`starting`:return`Starting the Session…`}},Vke=({onOpen:e,onRetry:t,state:n})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{"aria-live":`polite`,className:`agent-status`,"data-status":n.step,role:`status`,children:Bke(n)}),n.step===`failed`&&n.failure.reason===`offline`?(0,$.jsx)(`button`,{onClick:t,type:`button`,children:n.stage===`create`?`Try again`:`Start again`}):null,n.step===`failed`&&n.stage===`start`?(0,$.jsx)(`button`,{onClick:()=>{e(n.created)},type:`button`,children:`Open Session`}):null]}),A9=({onBack:e,sessionId:t,title:n})=>(0,$.jsxs)(`section`,{"aria-labelledby":`agent-session-title`,className:`agent-session`,children:[(0,$.jsxs)(`div`,{className:`agent-session-bar`,children:[(0,$.jsx)(`button`,{onClick:e,type:`button`,children:`Back to Agents`}),(0,$.jsx)(`h2`,{id:`agent-session-title`,children:n})]}),(0,$.jsx)(D9,{sessionId:t})]}),j9=[...yS,X.maiaAgent,X.pi],M9=16384,N9=128,Hke=/[\p{Cc}\p{Zl}\p{Zp}]/u,Uke=()=>({harness:X.claudeCode,instruction:``,name:``}),Wke=({harness:e,instruction:t,name:n})=>({harness:e,instruction:t,name:n}),P9=e=>new TextEncoder().encode(e).byteLength,Gke=e=>e===``?`Enter a name.`:e.length>N9?`Use at most ${String(N9)} characters.`:Hke.test(e)?`Remove line breaks and control characters.`:void 0,Kke=e=>{if(e.trim()===``)return`Enter an instruction.`;if(e.includes(`\0`))return`Remove NUL characters.`;let t=P9(e);return t>16384?`Use at most ${String(M9)} bytes. This one is ${String(t)}.`:void 0},qke=(e,t)=>t?.effort!==void 0&&!oN(e).includes(t.effort)?`This Agent's ${t.effort} effort does not fit ${e}. Choose a harness that supports it.`:void 0,Jke=e=>e[1]!==void 0,Yke=(e,t)=>[[`name`,Gke(e.name)],[`instruction`,Kke(e.instruction)],[`harness`,qke(e.harness,t)]],Xke=(e,t)=>e.kind===`create`?{kind:`create`,projectId:e.projectId,spec:t}:{agentId:e.agent.id,expectedRevision:e.agent.revision,kind:`revise`,spec:t},Zke=(e,t)=>{let{actorId:n,target:r}=t,i=r.kind===`revise`?r.agent.spec:void 0,a={...e,name:e.name.trim()},o=Object.fromEntries(Yke(a,i).filter(Jke));return Object.keys(o).length>0?{errors:o,ok:!1}:{change:Xke(r,{...i,accountableActorId:n,harness:a.harness,instruction:a.instruction,name:a.name,placement:`local`}),ok:!0}},Qke=[[`Name`,({name:e})=>e],[`Harness`,({harness:e})=>e],[`Instruction`,({instruction:e})=>e],[`Accountable`,({accountableActorId:e})=>e]],$ke=({change:e,current:t})=>e.kind===`disable`?[]:Qke.map(([n,r])=>{let i=r(e.spec);if(t===void 0)return{changed:!0,label:n,next:i};let a=r(t.spec);return{changed:a!==i,current:a,label:n,next:i}}),eAe={},F9=`Fix the marked fields, then preview again.`,I9={configuration_invalid:`The Node refused these settings. Check that the harness is set up on this Node, then preview again.`},tAe={denied:`This session may not read who it acts as, so it cannot change Agents.`,not_found:`The Node holds no record of who this session acts as, so Agents cannot be changed here.`,offline:`The Node did not say who this session acts as. Agents can be changed when it answers.`,unavailable:`This Node does not say who a session acts as (context.show), so Agents cannot be changed here yet.`},nAe=(e,t)=>{switch(t.reason){case`busy`:return o7(t);case`conflict`:return t.stage===`confirm`?`The preview expired or the Agent changed. Preview again.`:e===`create`?`The Project is gone. Go back to Agents and pick it again.`:`The Agent changed or is disabled. Go back to Agents and open it again.`;case`denied`:return e===`create`?`This session may not create Agents.`:`This session may not change Agents.`;case`invalid`:return I9[t.code]??`The Node refused this Agent. Check its fields.`;case`offline`:return t.stage===`preview`?`The Node did not answer. Try again.`:e===`create`?`The Node did not answer, so the Agent may already exist. Try again to find out.`:`The Node did not answer, so the change may already be saved. Try again to find out.`;case`unavailable`:return`This Node does not offer Agent changes yet.`;case`unknown`:return(t.code===void 0?void 0:I9[t.code])??`The Node could not save the Agent.`}},rAe=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,iAe=(e,t,n)=>{switch(t.status){case`confirming`:return e===`create`?`Creating the Agent…`:`Saving the changes…`;case`done`:{let{name:n}=t.receipt.agent.spec;return e===`create`?`Created ${n}.`:`Saved ${n} as revision ${t.receipt.agent.revision}.`}case`failed`:return n?F9:nAe(e,t);case`idle`:return n?F9:``;case`previewed`:return e===`create`?`Preview ready. Review it, then create the Agent.`:`Preview ready. Review it, then save the changes.`;case`previewing`:return`Asking the Node for a preview…`}},aAe=e=>({confirm:(t,n,{commandId:r,options:i})=>e.confirmAgentChange({change:n.change,commandId:r,inputDigest:n.inputDigest,proof:n.proof},i),preview:(t,{commandId:n,options:r})=>e.previewAgentChange({change:t,commandId:n},r)}),L9=e=>{e?.focus()},R9=(e,t,n)=>{let r=[n===void 0?void 0:`${e}-hint`,t===void 0?void 0:`${e}-error`].filter(e=>e!==void 0);return{"aria-describedby":r.length===0?void 0:r.join(` `),"aria-invalid":t!==void 0,id:e}},z9=({children:e,error:t,hint:n,id:r,label:i})=>(0,$.jsxs)(`div`,{className:`persona-field`,children:[(0,$.jsx)(`label`,{htmlFor:r,children:i}),e,n===void 0?null:(0,$.jsx)(`p`,{className:`persona-hint`,id:`${r}-hint`,children:n}),t===void 0?null:(0,$.jsx)(`p`,{className:`persona-error`,id:`${r}-error`,children:t})]}),oAe=({errors:e,form:t,onChange:n})=>{let r=`${String(P9(t.instruction))} of ${String(M9)} bytes.`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(z9,{error:e.name,id:`persona-name`,label:`Name`,children:(0,$.jsx)(`input`,{...R9(`persona-name`,e.name),autoComplete:`off`,onChange:e=>{n({name:e.currentTarget.value})},ref:L9,required:!0,type:`text`,value:t.name})}),(0,$.jsx)(z9,{error:e.instruction,hint:r,id:`persona-instruction`,label:`Instruction`,children:(0,$.jsx)(`textarea`,{...R9(`persona-instruction`,e.instruction,r),onChange:e=>{n({instruction:e.currentTarget.value})},required:!0,rows:10,value:t.instruction})}),(0,$.jsx)(z9,{error:e.harness,id:`persona-harness`,label:`Harness`,children:(0,$.jsx)(`select`,{...R9(`persona-harness`,e.harness),onChange:e=>{let t=j9.find(t=>t===e.currentTarget.value);t!==void 0&&n({harness:t})},value:t.harness,children:j9.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})})]})},sAe=({busy:e,errors:t,form:n,onCancel:r,onChange:i,onPreview:a})=>(0,$.jsxs)(`form`,{className:`persona-form`,noValidate:!0,onSubmit:e=>{e.preventDefault(),a()},children:[(0,$.jsxs)(`fieldset`,{className:`persona-group`,disabled:e,children:[(0,$.jsx)(`legend`,{className:`visually-hidden`,children:`Persona`}),(0,$.jsx)(oAe,{errors:t,form:n,onChange:i})]}),(0,$.jsxs)(`div`,{className:`persona-actions`,children:[(0,$.jsx)(`button`,{disabled:e,type:`submit`,children:`Preview`}),(0,$.jsx)(`button`,{disabled:e,onClick:r,type:`button`,children:`Cancel`})]})]}),B9=({label:e,text:t})=>(0,$.jsxs)(`div`,{className:`persona-value`,children:[(0,$.jsx)(`span`,{className:`persona-value-label`,children:e}),(0,$.jsx)(`pre`,{className:`persona-text`,children:t})]}),cAe=({rows:e})=>(0,$.jsx)(`ul`,{"aria-label":`Changes`,className:`persona-changes`,children:e.map(({changed:e,current:t,label:n,next:r})=>(0,$.jsxs)(`li`,{"data-changed":e,children:[(0,$.jsx)(`p`,{className:`persona-field-name`,children:n}),e&&t!==void 0?(0,$.jsx)(B9,{label:`Current`,text:t}):null,(0,$.jsx)(B9,{label:e?`New`:`Unchanged`,text:r})]},n))}),lAe=({mode:e,onBack:t,onConfirm:n,onRetry:r,preview:i,state:a})=>{let o=a.status===`confirming`;return(0,$.jsxs)(`section`,{"aria-labelledby":`persona-preview-title`,className:`persona-preview`,children:[(0,$.jsx)(`h3`,{id:`persona-preview-title`,ref:L9,tabIndex:-1,children:`Preview`}),(0,$.jsx)(n7,{items:[[`Agent ID`,i.agentId],...i.current===void 0?[]:[[`Revision`,i.current.revision]],[`Expires`,(0,$.jsx)(r7,{iso:i.expiresAt},`expires`)]]}),(0,$.jsx)(cAe,{rows:$ke(i)}),(0,$.jsxs)(`div`,{className:`persona-actions`,children:[a.status===`failed`?(0,$.jsx)(`button`,{onClick:r,type:`button`,children:`Try again`}):(0,$.jsx)(`button`,{disabled:o,onClick:n,type:`button`,children:e===`create`?`Create Agent`:`Save changes`}),(0,$.jsx)(`button`,{disabled:o,onClick:t,type:`button`,children:`Back to edit`})]})]})},uAe=({errors:e,form:t,mode:n,onBack:r,onChange:i,onClose:a,onConfirm:o,onPreview:s,onRetry:c,state:l})=>{let u=rAe(l);return l.status===`done`?(0,$.jsx)(`div`,{className:`persona-actions`,children:(0,$.jsx)(`button`,{onClick:a,type:`button`,children:`Back to Agents`})}):u===void 0?(0,$.jsx)(sAe,{busy:l.status===`previewing`,errors:e,form:t,onCancel:a,onChange:i,onPreview:s}):(0,$.jsx)(lAe,{mode:n,onBack:r,onConfirm:o,onRetry:c,preview:u,state:l})},dAe=e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(uAe,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`persona-status`,"data-status":e.state.status,role:`status`,children:iAe(e.mode,e.state,Object.keys(e.errors).length>0)})]}),fAe=({actorId:e,onClose:t,target:n})=>{let{client:r}=q5(),i=_7(aAe(r)),[a,o]=(0,Q.useState)(()=>n.kind===`revise`?Wke(n.agent.spec):Uke()),[s,c]=(0,Q.useState)(!1),l=Zke(a,{actorId:e,target:n});return(0,$.jsxs)(`section`,{"aria-labelledby":`persona-title`,className:`persona`,children:[(0,$.jsx)(`h2`,{id:`persona-title`,children:n.kind===`create`?`New Agent`:`Edit persona of ${n.agent.spec.name}`}),(0,$.jsx)(dAe,{errors:s&&!l.ok?l.errors:eAe,form:a,mode:n.kind,onBack:()=>{i.reset()},onChange:e=>{o(t=>({...t,...e}))},onClose:t,onConfirm:()=>{i.confirm()},onPreview:()=>{c(!0),l.ok&&i.start(l.change)},onRetry:()=>{i.retry()},state:i.state})]})},pAe=e=>H5(t=>e.showCurrentContext({},t)).pipe(O(({actorId:e})=>e)),mAe=({fault:e,onClose:t})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`notice`,"data-state":e,role:`status`,children:tAe[e]}),(0,$.jsx)(`button`,{onClick:t,type:`button`,children:`Back to Agents`})]}),hAe=({onClose:e,target:t})=>{let{client:n}=q5(),r=$5((0,Q.useMemo)(()=>pAe(n),[n]));return r.status===`loading`?(0,$.jsx)(J5,{what:`your identity`}):r.status===`ready`?(0,$.jsx)(fAe,{actorId:r.value,onClose:e,target:t}):(0,$.jsx)(mAe,{fault:r.status,onClose:e})},V9={kind:`list`},gAe=({agent:e,busy:t,canChat:n,onChat:r,onEdit:i})=>{let{spec:a,state:o,updatedAt:s}=e,{harness:c,homeSessionId:l,instruction:u,name:d,placement:f}=a,p=l!==void 0;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:d}),(0,$.jsx)(n7,{items:[[`State`,o],[`Harness`,c],[`Placement`,f],[`Updated`,(0,$.jsx)(r7,{iso:s},`updated`)]]}),(0,$.jsx)(`p`,{className:`excerpt`,children:u}),o===`active`?(0,$.jsxs)(`div`,{className:`agent-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`Edit persona of ${d}`,disabled:t,onClick:()=>{i(e)},type:`button`,children:`Edit persona`}),(0,$.jsx)(`button`,{"aria-label":p?`Open home Session of ${d}`:`Chat with ${d}`,disabled:t||!(p||n),onClick:()=>{r(e)},type:`button`,children:p?`Open home Session`:`Chat`})]}):null]})},_Ae=({records:e,...t})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Agents in this Project yet.`}):(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(gAe,{agent:e,...t},e.id))}),vAe=({state:e,...t})=>(0,$.jsx)(X5,{label:`agents`,state:e,surface:`agents`,children:({records:e})=>(0,$.jsx)(_Ae,{records:e,...t})}),yAe=({onCreate:e,projectId:t,...n})=>{let r=Q5(t);return(0,$.jsxs)($.Fragment,{children:[r.capability===`available`?(0,$.jsx)(`div`,{className:`agent-toolbar`,children:(0,$.jsx)(`button`,{disabled:n.busy,onClick:e,type:`button`,children:`New Agent`})}):null,(0,$.jsx)(vAe,{state:r,...n})]})},bAe=({chat:e,onView:t,projectId:n,workspace:r})=>{let i=r.status===`ready`?r.value?.id:void 0,a=Nke(r);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Vke,{onOpen:({agentName:n,session:r})=>{e.reset(),t({kind:`session`,sessionId:r.id,title:`Chat with ${n}`})},onRetry:()=>{e.retry()},state:e.state}),a===void 0?null:(0,$.jsx)(`p`,{className:`notice`,"data-state":`unavailable`,role:`status`,children:a}),(0,$.jsx)(yAe,{busy:Fke(e.state),canChat:i!==void 0&&!Ike(e.state),onChat:({id:n,spec:r})=>{r.homeSessionId===void 0?i!==void 0&&e.begin({agentId:n,agentName:r.name,workspaceId:i}):t({kind:`session`,sessionId:r.homeSessionId,title:`${r.name}: home Session`})},onCreate:()=>{t({kind:`editor`,target:{kind:`create`,projectId:n}})},onEdit:e=>{t({kind:`editor`,target:{agent:e,kind:`revise`}})},projectId:n})]})},xAe=({projectId:e})=>{let t=Lke(),n=Mke(e),[r,i]=(0,Q.useState)(V9);return t.state.step===`started`?(0,$.jsx)(A9,{onBack:()=>{t.reset()},sessionId:t.state.created.session.id,title:`Chat with ${t.state.created.agentName}`}):r.kind===`session`?(0,$.jsx)(A9,{onBack:()=>{i(V9)},sessionId:r.sessionId,title:r.title}):r.kind===`editor`?(0,$.jsx)(hAe,{onClose:()=>{i(V9)},target:r.target}):(0,$.jsx)(bAe,{chat:t,onView:e=>{i(e)},projectId:e,workspace:n})},SAe=[{id:`agents`,label:`Agents`,screen:()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The Agents of a Project, as the Node holds them.`,title:`Agents`}),(0,$.jsx)(a7,{noun:`Agents`,children:e=>(0,$.jsx)(xAe,{projectId:e},e)})]})},{id:`sessions`,label:`Sessions`,screen:Dke}],CAe=12,H9={added:{detail:`This Node's folder holds a skill the pin does not.`,label:`Added here`},edited:{detail:`This Node's folder differs from the pin.`,label:`Edited here`},in_sync:{detail:`This Node's folder matches the pin.`,label:`In sync`},missing:{detail:`The pin holds this skill, and this Node's folder does not.`,label:`Missing here`}},U9=e=>e.slice(0,19),wAe=e=>e.slice(0,CAe),W9=e=>Zue.safeParse({workspace:e}).success,TAe=e=>{let t=new Map((e.pin?.skills??[]).map(({files:e,name:t})=>[t,e]));return e.skills.map(e=>({...e,files:t.get(e.name)??[]}))},EAe=e=>e.filter(({state:e})=>e!==`in_sync`),G9=e=>`${String(e)} ${e===1?`skill`:`skills`}`,DAe=(e,t)=>{if(e.pin===void 0)return t.length===0?`No skills set is pinned for this Workspace yet.`:`No skills set is pinned for this Workspace yet. This Node's folder holds ${G9(t.length)}.`;if(t.length===0)return`The pinned set holds no skills.`;let n=EAe(t).length;return n===0?`Every skill matches the pin.`:`Differs from the pin: ${String(n)} of ${G9(t.length)}.`},OAe={add:`Add`,remove:`Remove`,update:`Update`},kAe=({incomingDigest:e,reason:t})=>{let n=H9[t].label;return e===void 0?`${n}. The earlier set does not hold it, so the rollback would remove it.`:t===`missing`?`${n}. The earlier set holds it.`:`${n}. The earlier set holds a different version.`},K9=e=>e===void 0?`None`:U9(e),AAe=({files:e})=>e.length===0?null:(0,$.jsxs)(`details`,{className:`skill-files`,children:[(0,$.jsxs)(`summary`,{children:[String(e.length),` pinned `,e.length===1?`file`:`files`]}),(0,$.jsx)(`ul`,{children:e.map(({digest:e,path:t})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`code`,{children:t}),` `,(0,$.jsx)(`span`,{children:U9(e)})]},t))})]}),jAe=({row:e})=>{let{detail:t,label:n}=H9[e.state];return(0,$.jsxs)(`li`,{"data-state":e.state,children:[(0,$.jsx)(`h3`,{className:`skill-name`,children:e.name}),(0,$.jsxs)(`p`,{children:[(0,$.jsxs)(`strong`,{className:`skill-state`,children:[n,`.`]}),` `,t]}),(0,$.jsx)(n7,{items:[[`Pinned`,K9(e.pinnedDigest)],[`On this Node`,K9(e.localDigest)]]}),(0,$.jsx)(AAe,{files:e.files})]})},MAe=({pin:e,revision:t})=>e===void 0?[]:[[`Set`,U9(e.digest)],[`Source commit`,wAe(e.source.commit)],[`Revision`,t]],NAe=({shown:e})=>{let t=TAe(e),n=MAe(e);return(0,$.jsxs)(`section`,{"aria-labelledby":`skills-set-title`,className:`skills-set`,children:[(0,$.jsxs)(`h2`,{id:`skills-set-title`,children:[`Skills of `,e.workspace]}),n.length===0?null:(0,$.jsx)(n7,{items:n}),e.tampered?(0,$.jsxs)(`div`,{className:`notice`,"data-state":`tampered`,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:`The recorded pin does not hold`}),(0,$.jsx)(`p`,{children:`It no longer matches its own digests, so this Node does not build on it. Every skill reads as added.`})]}):null,(0,$.jsx)(`p`,{className:`skills-standing`,"data-standing":e.state,children:DAe(e,t)}),t.length===0?null:(0,$.jsx)(`ul`,{"aria-label":`Skills`,className:`records skill-list`,children:t.map(e=>(0,$.jsx)(jAe,{row:e},e.name))})]})},PAe={kind:`rollback`},FAe=(e,t)=>H5(n=>e.showSkillsSync({workspace:t},n)),IAe=(e,t)=>({confirm:(n,r,{commandId:i,options:a})=>e.confirmSkillsSync({change:n,commandId:i,inputDigest:r.inputDigest,proof:r.proof,revision:r.revision,validUntil:r.validUntil,workspace:t},a),preview:(n,{commandId:r,options:i})=>e.previewSkillsSync({change:n,commandId:r,workspace:t},i)}),LAe=new Map([[`configuration_conflict`,`A local skill edit appeared since the preview. The Node kept it and restored nothing. Preview again.`],[`configuration_invalid`,`This Workspace has no earlier set to restore.`],[`storage_corrupt`,`The earlier set no longer matches its digests, so the Node will not restore it.`]]),RAe=e=>{switch(e.reason){case`busy`:return o7(e);case`conflict`:return e.stage===`confirm`?`The Workspace's pin changed since the preview, or the preview expired. Preview again.`:`The Workspace changed. Read it again, then preview.`;case`denied`:return`This session may not roll back skills.`;case`invalid`:case`unknown`:return(e.code===void 0?void 0:LAe.get(e.code))??`The Node refused the rollback.`;case`offline`:return e.stage===`preview`?`The Node did not answer. Try again.`:`The Node did not answer, so the rollback may already be recorded. Try again to find out.`;case`unavailable`:return`This Node does not offer skills sync (skills.sync.preview and skills.sync.confirm) yet.`}},zAe=e=>{e?.focus()},BAe=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,VAe=e=>{switch(e.status){case`confirming`:return`Restoring the earlier set…`;case`done`:return`Restored ${U9(e.receipt.digest)} as revision ${e.receipt.revision}. Receipt ${e.receipt.receiptId}.`;case`failed`:return RAe(e);case`idle`:return``;case`previewed`:return`Preview ready. Review it before you confirm.`;case`previewing`:return`Asking the Node for a preview…`}},HAe=({conflicts:e})=>e.length>0,UAe=({changes:e,conflicts:t})=>e.length===0?t.length>0?null:(0,$.jsx)(`p`,{className:`empty`,children:`No skill changes: this Node's folder already holds the earlier set.`}):(0,$.jsx)(`ul`,{"aria-label":`Changes`,className:`skills-changes`,children:e.map(({action:e,name:t})=>(0,$.jsxs)(`li`,{children:[OAe[e],` `,(0,$.jsx)(`strong`,{children:t})]},t))}),WAe=({conflicts:e})=>e.length===0?null:(0,$.jsxs)(`div`,{className:`notice`,"data-state":`blocked`,children:[(0,$.jsxs)(`p`,{className:`notice-title`,children:[`Local edits block this rollback (`,G9(e.length),`)`]}),(0,$.jsx)(`p`,{children:`The Node never overwrites a local edit: it refuses to confirm while any remain, and restores nothing. Put each folder back in line on this Node, then preview again.`}),(0,$.jsx)(`ul`,{"aria-label":`Local edits`,className:`skills-conflicts`,children:e.map(e=>(0,$.jsxs)(`li`,{"data-reason":e.reason,children:[(0,$.jsx)(`strong`,{children:e.name}),`: `,kAe(e)]},e.name))})]}),GAe=({onConfirm:e,onPreview:t,onRetry:n,plan:r,state:i})=>{if(i.status===`failed`)return(0,$.jsx)(`button`,{onClick:n,type:`button`,children:`Try again`});let a=i.status===`confirming`;return HAe(r)?(0,$.jsx)(`button`,{disabled:a,onClick:t,type:`button`,children:`Preview again`}):(0,$.jsx)(`button`,{disabled:a,onClick:e,type:`button`,children:`Confirm rollback`})},KAe=({onClose:e,preview:t,state:n,...r})=>(0,$.jsxs)(`section`,{"aria-labelledby":`skills-preview-title`,className:`skills-preview`,children:[(0,$.jsx)(`h3`,{id:`skills-preview-title`,ref:zAe,tabIndex:-1,children:`Rollback preview`}),(0,$.jsx)(n7,{items:[[`Restores`,U9(t.digest)],[`Revision`,t.revision],[`Expires`,(0,$.jsx)(r7,{iso:t.validUntil},`expires`)]]}),(0,$.jsx)(WAe,{conflicts:t.plan.conflicts}),(0,$.jsx)(UAe,{changes:t.plan.changes,conflicts:t.plan.conflicts}),(0,$.jsxs)(`div`,{className:`skills-actions`,children:[(0,$.jsx)(GAe,{plan:t.plan,state:n,...r}),(0,$.jsx)(`button`,{disabled:n.status===`confirming`,onClick:e,type:`button`,children:`Close preview`})]})]}),qAe=({onPreview:e,previousDigest:t,state:n,...r})=>{let i=BAe(n);return t===void 0?(0,$.jsx)(`p`,{className:`empty`,children:`This Workspace has no earlier set to restore.`}):i===void 0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[`Restores the set this Workspace pinned before its current one (`,U9(t),`).`]}),(0,$.jsx)(`div`,{className:`skills-actions`,children:(0,$.jsx)(`button`,{disabled:n.status===`previewing`,onClick:e,type:`button`,children:`Preview rollback`})})]}):(0,$.jsx)(KAe,{onPreview:e,preview:i,state:n,...r})},JAe=e=>(0,$.jsxs)(`section`,{"aria-labelledby":`skills-rollback-title`,className:`skills-rollback`,children:[(0,$.jsx)(`h2`,{id:`skills-rollback-title`,children:`Roll back`}),(0,$.jsx)(qAe,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`skills-status`,"data-status":e.state.status,role:`status`,children:VAe(e.state)})]}),YAe=()=>(0,$.jsxs)(`section`,{"aria-labelledby":`skills-steps-title`,className:`skills-steps`,children:[(0,$.jsx)(`h2`,{id:`skills-steps-title`,children:`Not available in this panel`}),(0,$.jsxs)(`ul`,{className:`records`,children:[(0,$.jsxs)(`li`,{"data-state":`unavailable`,children:[(0,$.jsx)(`h3`,{className:`skill-name`,children:`Sync a new set`}),(0,$.jsx)(`p`,{children:`Not on this panel yet. A sync sends the files of a Git commit to the Node (skills.sync.preview with an apply change), and a browser cannot read a Git commit. It needs the CLI projection of skills sync, which is not built yet, or a Node that reads the set itself.`})]}),(0,$.jsxs)(`li`,{"data-state":`unavailable`,children:[(0,$.jsx)(`h3`,{className:`skill-name`,children:`Attach a skill to an Agent`}),(0,$.jsx)(`p`,{children:`Not on this Node yet. It needs a skills list on the Agent spec (SKL-1e).`})]})]})]}),XAe={status:`loading`},ZAe=(e,t)=>{let{client:n}=q5(),[r,i]=(0,Q.useState)();return(0,Q.useEffect)(()=>G5(FAe(n,e).pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{i({loaded:e,round:t})})))),[n,t,e]),r?.round===t?r.loaded:XAe},QAe=`A Workspace key is lowercase letters, digits and hyphens, starts with a letter or digit, and holds at most 63 characters.`,$Ae=({onShow:e})=>{let[t,n]=(0,Q.useState)(``),[r,i]=(0,Q.useState)(!1),a=t.trim(),o=r&&!W9(a);return(0,$.jsxs)(`form`,{className:`skills-form`,noValidate:!0,onSubmit:t=>{t.preventDefault(),i(!0),W9(a)&&e(a)},children:[(0,$.jsxs)(`div`,{className:`skills-field`,children:[(0,$.jsx)(`label`,{htmlFor:`skills-workspace`,children:`Workspace key`}),(0,$.jsx)(`input`,{"aria-describedby":`skills-workspace-hint${o?` skills-workspace-error`:``}`,"aria-invalid":o,autoComplete:`off`,id:`skills-workspace`,onChange:e=>{n(e.currentTarget.value)},type:`text`,value:t}),(0,$.jsx)(`p`,{className:`skills-hint`,id:`skills-workspace-hint`,children:`The key the set was synced under. The Node lists no keys yet.`}),o?(0,$.jsx)(`p`,{className:`skills-error`,id:`skills-workspace-error`,children:QAe}):null]}),(0,$.jsx)(`button`,{type:`submit`,children:`Read skills`})]})},eje=({workspace:e})=>{let{client:t}=q5(),{confirm:n,reset:r,retry:i,start:a,state:o}=_7((0,Q.useMemo)(()=>IAe(t,e),[t,e])),s=ZAe(e,o.status===`done`?o.receipt.receiptId:``);return s.status===`loading`?(0,$.jsx)(J5,{what:`skills`}):s.status===`ready`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(NAe,{shown:s.value}),(0,$.jsx)(JAe,{onClose:()=>{r()},onConfirm:()=>{n()},onPreview:()=>{a(PAe)},onRetry:()=>{i()},previousDigest:s.value.pin?.previousDigest,state:o})]}):(0,$.jsx)(Y5,{fault:s.status,unavailable:`The Node must serve skills.sync.show, skills.sync.preview and skills.sync.confirm.`})},q9=PCe([GDe,RDe,SAe,Jwe,[{id:`skills`,label:`Skills`,screen:()=>{let[e,t]=(0,Q.useState)();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{summary:`The skills set a Workspace pins on this Node, and how this Node's skill folders compare with it.`,title:`Skills`}),(0,$.jsx)($Ae,{onShow:e=>{t(t=>({reads:(t?.reads??0)+1,workspace:e}))}}),e===void 0?(0,$.jsx)(`p`,{className:`empty`,children:`Enter a Workspace key to read its skills set.`}):(0,$.jsx)(eje,{workspace:e.workspace},`${e.workspace}:${String(e.reads)}`),(0,$.jsx)(YAe,{})]})}}]]),tje=({current:e,id:t,onChoose:n,open:r})=>(0,$.jsx)(`nav`,{"aria-label":`Primary`,className:`shell-nav`,"data-open":r,id:t,children:(0,$.jsx)(`ul`,{children:q9.map(t=>(0,$.jsx)(`li`,{children:(0,$.jsx)(`a`,{"aria-current":e===t.id?`page`:void 0,href:`?screen=${t.id}`,onClick:e=>{e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.preventDefault(),n(t.id))},children:t.label})},t.id))})}),nje=({onPress:e,running:t})=>(0,$.jsx)(`button`,{disabled:t,onClick:e,type:`button`,children:`Sign out`}),rje=({signOut:e})=>{let{start:t,state:n}=h7(e);return(0,$.jsx)(nje,{onPress:()=>{t()},running:n.status===`running`})},ije=T(()=>{window.location.reload()}),aje=()=>(0,$.jsxs)(`section`,{className:`notice notice-skew`,"data-state":`skew`,children:[(0,$.jsx)(`h1`,{children:`Reload to update`}),(0,$.jsx)(`p`,{children:`This page and the Node no longer speak the same version. Reload the page to load the version the Node serves now.`}),(0,$.jsx)(`button`,{onClick:()=>{G5(ije)},type:`button`,children:`Reload now`})]}),J9=`agents`,oje=e=>{let t=new URLSearchParams(e).get(`screen`);return q9.find(({id:e})=>e===t)?.id??J9},sje=e=>(window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}),cje=()=>oje(window.location.search),lje=()=>J9,uje=e=>T(()=>{window.history.pushState(void 0,``,`?screen=${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}),dje=e=>{G5(uje(e))},fje=()=>({navigate:dje,screen:(0,Q.useSyncExternalStore)(sje,cje,lje)}),pje=({id:e})=>{let t=q9.find(t=>t.id===e);if(t===void 0)return null;let{screen:n}=t;return(0,$.jsx)(n,{})},mje=({signOut:e})=>{let{identity:t,skewed:n}=q5(),{navigate:r,screen:i}=fje(),[a,o]=(0,Q.useState)(!1),s=(0,Q.useId)();return(0,$.jsxs)(`div`,{className:`maia-panel`,children:[(0,$.jsxs)(`header`,{className:`shell-header`,children:[(0,$.jsx)(`p`,{className:`brand`,children:`Maia`}),(0,$.jsxs)(`p`,{className:`node-identity`,children:[(0,$.jsx)(`span`,{className:`visually-hidden`,children:`Node: `}),t.label]}),(0,$.jsx)(`button`,{"aria-controls":s,"aria-expanded":a,className:`nav-toggle`,onClick:()=>{o(!a)},type:`button`,children:`Menu`}),e===void 0?null:(0,$.jsx)(rje,{signOut:e})]}),(0,$.jsx)(tje,{current:i,id:s,onChoose:e=>{o(!1),r(e)},open:a}),(0,$.jsx)(`main`,{className:`shell-main`,id:`main`,tabIndex:-1,children:n?(0,$.jsx)(aje,{}):(0,$.jsx)(Hwe,{navigate:r,children:(0,$.jsx)(pje,{id:i})})})]})},hje=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,ee=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,te=typeof setImmediate<`u`?setImmediate:null;function ne(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function re(e){if(h=!1,ne(e),!m){if(n(c)!==null)m=!0,ie||(ie=!0,ue());else{var t=n(l);t!==null&&pe(re,t.startTime-e)}}}var ie=!1,ae=-1,oe=5,se=-1;function ce(){return g?!0:!(e.unstable_now()-se<oe)}function le(){if(g=!1,ie){var t=e.unstable_now();se=t;var i=!0;try{a:{m=!1,h&&(h=!1,_(ae),ae=-1),p=!0;var a=f;try{b:{for(ne(t),d=n(c);d!==null&&!(d.expirationTime>t&&ce());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,ne(t),i=!0;break b}d===n(c)&&r(c),ne(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&pe(re,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ue():ie=!1}}}var ue;if(typeof te==`function`)ue=function(){te(le)};else if(typeof MessageChannel<`u`){var de=new MessageChannel,fe=de.port2;de.port1.onmessage=le,ue=function(){fe.postMessage(null)}}else ue=function(){ee(le,0)};function pe(t,n){ae=ee(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):oe=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(ae),ae=-1):h=!0,pe(re,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ie||(ie=!0,ue()))),r},e.unstable_shouldYield=ce,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),gje=e(((e,t)=>{t.exports=hje()})),_je=e((e=>{var t=W5();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.3`})),vje=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_je()})),yje=e((e=>{var t=gje(),n=W5(),r=vje();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),ee=Symbol.for(`react.strict_mode`),_=Symbol.for(`react.profiler`),te=Symbol.for(`react.consumer`),ne=Symbol.for(`react.context`),re=Symbol.for(`react.forward_ref`),ie=Symbol.for(`react.suspense`),ae=Symbol.for(`react.suspense_list`),oe=Symbol.for(`react.memo`),se=Symbol.for(`react.lazy`),ce=Symbol.for(`react.activity`),le=Symbol.for(`react.memo_cache_sentinel`),ue=Symbol.iterator;function de(e){return typeof e!=`object`||!e?null:(e=ue&&e[ue]||e[`@@iterator`],typeof e==`function`?e:null)}var fe=Symbol.for(`react.client.reference`);function pe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===fe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case _:return`Profiler`;case ee:return`StrictMode`;case ie:return`Suspense`;case ae:return`SuspenseList`;case ce:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case ne:return e.displayName||`Context`;case te:return(e._context.displayName||`Context`)+`.Consumer`;case re:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case oe:return t=e.displayName||null,t===null?pe(e.type)||`Memo`:t;case se:t=e._payload,e=e._init;try{return pe(e(t))}catch{}}return null}var me=Array.isArray,v=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={pending:!1,data:null,method:null,action:null},_e=[],ve=-1;function ye(e){return{current:e}}function be(e){0>ve||(e.current=_e[ve],_e[ve]=null,ve--)}function xe(e,t){ve++,_e[ve]=e.current,e.current=t}var Se=ye(null),Ce=ye(null),we=ye(null),Te=ye(null);function Ee(e,t){switch(xe(we,t),xe(Ce,e),xe(Se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?hf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=hf(t),e=gf(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}be(Se),xe(Se,e)}function De(){be(Se),be(Ce),be(we)}function Oe(e){e.memoizedState!==null&&xe(Te,e);var t=Se.current,n=gf(t,e.type);t!==n&&(xe(Ce,e),xe(Se,n))}function ke(e){Ce.current===e&&(be(Se),be(Ce)),Te.current===e&&(be(Te),bp._currentValue=ge)}var Ae,je;function Me(e){if(Ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ae=t&&t[1]||``,je=-1<e.stack.indexOf(`
|
|
23
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
24
|
+
`+Ae+e+je}var Ne=!1;function Pe(e,t){if(!e||Ne)return``;Ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
25
|
+
`),l=s.split(`
|
|
26
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
27
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ne=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Me(n):``}function Fe(e,t){switch(e.tag){case 26:case 27:case 5:return Me(e.type);case 16:return Me(`Lazy`);case 13:return e.child!==t&&t!==null?Me(`Suspense Fallback`):Me(`Suspense`);case 19:return Me(`SuspenseList`);case 0:case 15:return Pe(e.type,!1);case 11:return Pe(e.type.render,!1);case 1:return Pe(e.type,!0);case 31:return Me(`Activity`);default:return``}}function Ie(e){try{var t=``,n=null;do t+=Fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
28
|
+
Error generating stack: `+e.message+`
|
|
29
|
+
`+e.stack}}var Le=Object.prototype.hasOwnProperty,Re=t.unstable_scheduleCallback,ze=t.unstable_cancelCallback,Be=t.unstable_shouldYield,Ve=t.unstable_requestPaint,He=t.unstable_now,Ue=t.unstable_getCurrentPriorityLevel,We=t.unstable_ImmediatePriority,Ge=t.unstable_UserBlockingPriority,Ke=t.unstable_NormalPriority,qe=t.unstable_LowPriority,Je=t.unstable_IdlePriority,Ye=t.log,Xe=t.unstable_setDisableYieldValue,Ze=null,Qe=null;function $e(e){if(typeof Ye==`function`&&Xe(e),Qe&&typeof Qe.setStrictMode==`function`)try{Qe.setStrictMode(Ze,e)}catch{}}var et=Math.clz32?Math.clz32:rt,tt=Math.log,nt=Math.LN2;function rt(e){return e>>>=0,e===0?32:31-(tt(e)/nt|0)|0}var it=256,at=262144,ot=4194304;function st(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ct(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=st(n))):i=st(o):i=st(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=st(n))):i=st(o)):i=st(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function lt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ut(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dt(){var e=ot;return ot<<=1,!(ot&62914560)&&(ot=4194304),e}function ft(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function pt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-et(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&ht(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function ht(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-et(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function gt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-et(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function _t(e,t){var n=t&-t;return n=n&42?1:vt(n),(n&(e.suspendedLanes|t))===0?n:0}function vt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function yt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function bt(){var e=he.p;return e===0?(e=window.event,e===void 0?32:Ip(e.type)):e}function xt(e,t){var n=he.p;try{return he.p=e,t()}finally{he.p=n}}var St=Math.random().toString(36).slice(2),Ct=`__reactFiber$`+St,y=`__reactProps$`+St,wt=`__reactContainer$`+St,Tt=`__reactEvents$`+St,Et=`__reactListeners$`+St,Dt=`__reactHandles$`+St,Ot=`__reactResources$`+St,kt=`__reactMarker$`+St;function At(e){delete e[Ct],delete e[y],delete e[Tt],delete e[Et],delete e[Dt]}function jt(e){var t=e[Ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[wt]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ff(e);e!==null;){if(n=e[Ct])return n;e=Ff(e)}return t}e=n,n=e.parentNode}return null}function Mt(e){if(e=e[Ct]||e[wt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Nt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Pt(e){var t=e[Ot];return t||=e[Ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ft(e){e[kt]=!0}var It=new Set,Lt={};function Rt(e,t){zt(e,t),zt(e+`Capture`,t)}function zt(e,t){for(Lt[e]=t,e=0;e<t.length;e++)It.add(t[e])}var Bt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Vt={},Ht={};function Ut(e){return Le.call(Ht,e)?!0:Le.call(Vt,e)?!1:Bt.test(e)?Ht[e]=!0:(Vt[e]=!0,!1)}function Wt(e,t,n){if(Ut(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Gt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function qt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Yt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Xt(e){if(!e._valueTracker){var t=Jt(e)?`checked`:`value`;e._valueTracker=Yt(e,t,``+e[t])}}function Zt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Jt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Qt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var $t=/[\n"\\]/g;function en(e){return e.replace($t,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function tn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+qt(t)):e.value!==``+qt(t)&&(e.value=``+qt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):rn(e,o,qt(n)):rn(e,o,qt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+qt(s):e.removeAttribute(`name`)}function nn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Xt(e);return}n=n==null?``:``+qt(n),t=t==null?n:``+qt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Xt(e)}function rn(e,t,n){t===`number`&&Qt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function an(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=``+qt(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 on(e,t,n){if(t!=null&&(t=``+qt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+qt(n)}function sn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(me(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=qt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Xt(e)}function cn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ln=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function un(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||ln.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function dn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&un(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&un(e,o,t[o])}function fn(e){if(e.indexOf(`-`)===-1)return!1;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 pn=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),mn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function hn(e){return mn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function gn(){}var _n=null;function vn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yn=null,bn=null;function xn(e){var t=Mt(e);if(t&&(e=t.stateNode)){var n=e[y]||null;a:switch(e=t.stateNode,t.type){case`input`:if(tn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+en(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[y]||null;if(!a)throw Error(i(90));tn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Zt(r)}break a;case`textarea`:on(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&an(e,!!n.multiple,t,!1)}}}var Sn=!1;function Cn(e,t,n){if(Sn)return e(t,n);Sn=!0;try{return e(t)}finally{if(Sn=!1,(yn!==null||bn!==null)&&(Wu(),yn&&(t=yn,e=bn,bn=yn=null,xn(t),e)))for(t=0;t<e.length;t++)xn(e[t])}}function wn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[y]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Tn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,En=!1;if(Tn)try{var Dn={};Object.defineProperty(Dn,"passive",{get:function(){En=!0}}),window.addEventListener(`test`,Dn,Dn),window.removeEventListener(`test`,Dn,Dn)}catch{En=!1}var On=null,kn=null,An=null;function jn(){if(An)return An;var e,t=kn,n=t.length,r,i=`value`in On?On.value:On.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return An=i.slice(e,1<r?1-r:void 0)}function Mn(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 Nn(){return!0}function Pn(){return!1}function Fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Nn:Pn,this.isPropagationStopped=Pn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Nn)},persist:function(){},isPersistent:Nn}),t}var In={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ln=Fn(In),Rn=f({},In,{view:0,detail:0}),zn=Fn(Rn),Bn,Vn,Hn,Un=f({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:er,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!==Hn&&(Hn&&e.type===`mousemove`?(Bn=e.screenX-Hn.screenX,Vn=e.screenY-Hn.screenY):Vn=Bn=0,Hn=e),Bn)},movementY:function(e){return`movementY`in e?e.movementY:Vn}}),Wn=Fn(Un),Gn=Fn(f({},Un,{dataTransfer:0})),Kn=Fn(f({},Rn,{relatedTarget:0})),qn=Fn(f({},In,{animationName:0,elapsedTime:0,pseudoElement:0})),Jn=Fn(f({},In,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Yn=Fn(f({},In,{data:0})),Xn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Zn={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`},Qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function $n(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Qn[e])?!!t[e]:!1}function er(){return $n}var tr=Fn(f({},Rn,{key:function(e){if(e.key){var t=Xn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Zn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:er,charCode:function(e){return e.type===`keypress`?Mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),nr=Fn(f({},Un,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),rr=Fn(f({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:er})),ir=Fn(f({},In,{propertyName:0,elapsedTime:0,pseudoElement:0})),ar=Fn(f({},Un,{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})),or=Fn(f({},In,{newState:0,oldState:0})),sr=[9,13,27,32],cr=Tn&&`CompositionEvent`in window,lr=null;Tn&&`documentMode`in document&&(lr=document.documentMode);var ur=Tn&&`TextEvent`in window&&!lr,dr=Tn&&(!cr||lr&&8<lr&&11>=lr),fr=` `,pr=!1;function mr(e,t){switch(e){case`keyup`:return sr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function hr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var gr=!1;function _r(e,t){switch(e){case`compositionend`:return hr(t);case`keypress`:return t.which===32?(pr=!0,fr):null;case`textInput`:return e=t.data,e===fr&&pr?null:e;default:return null}}function vr(e,t){if(gr)return e===`compositionend`||!cr&&mr(e,t)?(e=jn(),An=kn=On=null,gr=!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 dr&&t.locale!==`ko`?null:t.data;default:return null}}var yr={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 br(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!yr[e.type]:t===`textarea`}function xr(e,t,n,r){yn?bn?bn.push(r):bn=[r]:yn=r,t=Qd(t,`onChange`),0<t.length&&(n=new Ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Sr=null,Cr=null;function wr(e){Wd(e,0)}function Tr(e){if(Zt(Nt(e)))return e}function Er(e,t){if(e===`change`)return t}var Dr=!1;if(Tn){var Or;if(Tn){var kr=`oninput`in document;if(!kr){var Ar=document.createElement(`div`);Ar.setAttribute(`oninput`,`return;`),kr=typeof Ar.oninput==`function`}Or=kr}else Or=!1;Dr=Or&&(!document.documentMode||9<document.documentMode)}function jr(){Sr&&(Sr.detachEvent(`onpropertychange`,Mr),Cr=Sr=null)}function Mr(e){if(e.propertyName===`value`&&Tr(Cr)){var t=[];xr(t,Cr,e,vn(e)),Cn(wr,t)}}function Nr(e,t,n){e===`focusin`?(jr(),Sr=t,Cr=n,Sr.attachEvent(`onpropertychange`,Mr)):e===`focusout`&&jr()}function Pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Tr(Cr)}function Fr(e,t){if(e===`click`)return Tr(t)}function Ir(e,t){if(e===`input`||e===`change`)return Tr(t)}function Lr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Rr=typeof Object.is==`function`?Object.is:Lr;function zr(e,t){if(Rr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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(!Le.call(t,i)||!Rr(e[i],t[i]))return!1}return!0}function Br(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Vr(e,t){var n=Br(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Br(n)}}function Hr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Hr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ur(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Qt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Qt(e.document)}return t}function Wr(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`)}var Gr=Tn&&`documentMode`in document&&11>=document.documentMode,Kr=null,qr=null,Jr=null,Yr=!1;function Xr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Yr||Kr==null||Kr!==Qt(r)||(r=Kr,`selectionStart`in r&&Wr(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}),Jr&&zr(Jr,r)||(Jr=r,r=Qd(qr,`onSelect`),0<r.length&&(t=new Ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Kr)))}function Zr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Qr={animationend:Zr(`Animation`,`AnimationEnd`),animationiteration:Zr(`Animation`,`AnimationIteration`),animationstart:Zr(`Animation`,`AnimationStart`),transitionrun:Zr(`Transition`,`TransitionRun`),transitionstart:Zr(`Transition`,`TransitionStart`),transitioncancel:Zr(`Transition`,`TransitionCancel`),transitionend:Zr(`Transition`,`TransitionEnd`)},$r={},ei={};Tn&&(ei=document.createElement(`div`).style,`AnimationEvent`in window||(delete Qr.animationend.animation,delete Qr.animationiteration.animation,delete Qr.animationstart.animation),`TransitionEvent`in window||delete Qr.transitionend.transition);function ti(e){if($r[e])return $r[e];if(!Qr[e])return e;var t=Qr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ei)return $r[e]=t[n];return e}var ni=ti(`animationend`),ri=ti(`animationiteration`),ii=ti(`animationstart`),ai=ti(`transitionrun`),oi=ti(`transitionstart`),si=ti(`transitioncancel`),ci=ti(`transitionend`),li=new Map,ui=`abort auxClick beforeToggle 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(` `);ui.push(`scrollEnd`);function di(e,t){li.set(e,t),Rt(t,[e])}var fi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},pi=[],mi=0,hi=0;function gi(){for(var e=mi,t=hi=mi=0;t<e;){var n=pi[t];pi[t++]=null;var r=pi[t];pi[t++]=null;var i=pi[t];pi[t++]=null;var a=pi[t];if(pi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&bi(n,i,a)}}function _i(e,t,n,r){pi[mi++]=e,pi[mi++]=t,pi[mi++]=n,pi[mi++]=r,hi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function vi(e,t,n,r){return _i(e,t,n,r),xi(e)}function yi(e,t){return _i(e,null,null,t),xi(e)}function bi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-et(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function xi(e){if(50<Fu)throw Fu=0,Iu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Si={};function Ci(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.refCleanup=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 wi(e,t,n,r){return new Ci(e,t,n,r)}function Ti(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ei(e,t){var n=e.alternate;return n===null?(n=wi(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&65011712,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.refCleanup=e.refCleanup,n}function Di(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Ti(e)&&(s=1);else if(typeof e==`string`)s=dp(e,n,Se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ce:return e=wi(31,n,t,a),e.elementType=ce,e.lanes=o,e;case g:return ki(n.children,a,o,t);case ee:s=8,a|=24;break;case _:return e=wi(12,n,t,a|2),e.elementType=_,e.lanes=o,e;case ie:return e=wi(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=wi(19,n,t,a),e.elementType=ae,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case ne:s=10;break a;case te:s=9;break a;case re:s=11;break a;case oe:s=14;break a;case se:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=wi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ki(e,t,n,r){return e=wi(7,e,r,t),e.lanes=n,e}function Ai(e,t,n){return e=wi(6,e,null,t),e.lanes=n,e}function ji(e){var t=wi(18,null,null,0);return t.stateNode=e,t}function Mi(e,t,n){return t=wi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ni=new WeakMap;function Pi(e,t){if(typeof e==`object`&&e){var n=Ni.get(e);return n===void 0?(t={value:e,source:t,stack:Ie(t)},Ni.set(e,t),t):n}return{value:e,source:t,stack:Ie(t)}}var Fi=[],Ii=0,Li=null,Ri=0,zi=[],Bi=0,Vi=null,Hi=1,Ui=``;function Wi(e,t){Fi[Ii++]=Ri,Fi[Ii++]=Li,Li=e,Ri=t}function Gi(e,t,n){zi[Bi++]=Hi,zi[Bi++]=Ui,zi[Bi++]=Vi,Vi=e;var r=Hi;e=Ui;var i=32-et(r)-1;r&=~(1<<i),n+=1;var a=32-et(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Hi=1<<32-et(t)+i|n<<i|r,Ui=a+e}else Hi=1<<a|n<<i|r,Ui=e}function Ki(e){e.return!==null&&(Wi(e,1),Gi(e,1,0))}function qi(e){for(;e===Li;)Li=Fi[--Ii],Fi[Ii]=null,Ri=Fi[--Ii],Fi[Ii]=null;for(;e===Vi;)Vi=zi[--Bi],zi[Bi]=null,Ui=zi[--Bi],zi[Bi]=null,Hi=zi[--Bi],zi[Bi]=null}function Ji(e,t){zi[Bi++]=Hi,zi[Bi++]=Ui,zi[Bi++]=Vi,Hi=t.id,Ui=t.overflow,Vi=e}var Yi=null,Xi=null,Zi=!1,Qi=null,$i=!1,ea=Error(i(519));function ta(e){throw sa(Pi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ea}function na(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ct]=e,t[y]=r,n){case`dialog`:Gd(`cancel`,t),Gd(`close`,t);break;case`iframe`:case`object`:case`embed`:Gd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Hd.length;n++)Gd(Hd[n],t);break;case`source`:Gd(`error`,t);break;case`img`:case`image`:case`link`:Gd(`error`,t),Gd(`load`,t);break;case`details`:Gd(`toggle`,t);break;case`input`:Gd(`invalid`,t),nn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Gd(`invalid`,t);break;case`textarea`:Gd(`invalid`,t),sn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||af(t.textContent,n)?(r.popover!=null&&(Gd(`beforetoggle`,t),Gd(`toggle`,t)),r.onScroll!=null&&Gd(`scroll`,t),r.onScrollEnd!=null&&Gd(`scrollend`,t),r.onClick!=null&&(t.onclick=gn),t=!0):t=!1,t||ta(e,!0)}function ra(e){for(Yi=e.return;Yi;)switch(Yi.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:Yi=Yi.return}}function ia(e){if(e!==Yi)return!1;if(!Zi)return ra(e),Zi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||_f(e.type,e.memoizedProps)),n=!n),n&&Xi&&ta(e),ra(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=Pf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=Pf(e)}else t===27?(t=Xi,Tf(e.type)?(e=Nf,Nf=null,Xi=e):Xi=t):Xi=Yi?E(e.stateNode.nextSibling):null;return!0}function aa(){Xi=Yi=null,Zi=!1}function oa(){var e=Qi;return e!==null&&(xu===null?xu=e:xu.push.apply(xu,e),Qi=null),e}function sa(e){Qi===null?Qi=[e]:Qi.push(e)}var ca=ye(null),la=null,ua=null;function da(e,t,n){xe(ca,t._currentValue),t._currentValue=n}function fa(e){e._currentValue=ca.current,be(ca)}function pa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ma(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),pa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),pa(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ha(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Rr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Te.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[bp]:e.push(bp))}a=a.return}e!==null&&ma(t,e,n,r),t.flags|=262144}function ga(e){for(e=e.firstContext;e!==null;){if(!Rr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function _a(e){la=e,ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function b(e){return ya(la,e)}function va(e,t){return la===null&&_a(e),ya(e,t)}function ya(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ua===null){if(e===null)throw Error(i(308));ua=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ua=ua.next=t;return n}var ba=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},xa=t.unstable_scheduleCallback,Sa=t.unstable_NormalPriority,Ca={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wa(){return{controller:new ba,data:new Map,refCount:0}}function Ta(e){e.refCount--,e.refCount===0&&xa(Sa,function(){e.controller.abort()})}var Ea=null,Da=0,Oa=0,ka=null;function Aa(e,t){if(Ea===null){var n=Ea=[];Da=0,Oa=Id(),ka={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Da++,t.then(ja,ja),t}function ja(){if(--Da===0&&Ea!==null){ka!==null&&(ka.status=`fulfilled`);var e=Ea;Ea=null,Oa=0,ka=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ma(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Na=v.S;v.S=function(e,t){wu=He(),typeof t==`object`&&t&&typeof t.then==`function`&&Aa(e,t),Na!==null&&Na(e,t)};var Pa=ye(null);function Fa(){var e=Pa.current;return e===null?au.pooledCache:e}function Ia(e,t){t===null?xe(Pa,Pa.current):xe(Pa,t.pool)}function La(){var e=Fa();return e===null?null:{parent:Ca._currentValue,pool:e}}var Ra=Error(i(460)),za=Error(i(474)),Ba=Error(i(542)),Va={then:function(){}};function Ha(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ua(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(gn,gn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,qa(e),e;default:if(typeof t.status==`string`)t.then(gn,gn);else{if(e=au,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,qa(e),e}throw Ga=t,Ra}}function Wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ga=e,Ra):e}}var Ga=null;function Ka(){if(Ga===null)throw Error(i(459));var e=Ga;return Ga=null,e}function qa(e){if(e===Ra||e===Ba)throw Error(i(483))}var Ja=null,Ya=0;function Xa(e){var t=Ya;return Ya+=1,Ja===null&&(Ja=[]),Ua(Ja,e,t)}function Za(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Qa(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function $a(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Ei(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ai(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===se&&Wa(i)===t.type)?(t=a(t,n.props),Za(t,n),t.return=e,t):(t=Oi(n.type,n.key,n.props,null,e.mode,r),Za(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Mi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ki(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=Oi(t.type,t.key,t.props,null,e.mode,n),Za(n,t),n.return=e,n;case h:return t=Mi(t,e.mode,n),t.return=e,t;case se:return t=Wa(t),f(e,t,n)}if(me(t)||de(t))return t=ki(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Xa(t),n);if(t.$$typeof===ne)return f(e,va(e,t),n);Qa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case se:return n=Wa(n),p(e,t,n,r)}if(me(n)||de(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Xa(n),r);if(n.$$typeof===ne)return p(e,t,va(e,n),r);Qa(e,n)}return null}function ee(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case se:return r=Wa(r),ee(e,t,n,r,i)}if(me(r)||de(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return ee(e,t,n,Xa(r),i);if(r.$$typeof===ne)return ee(e,t,n,va(t,r),i);Qa(t,r)}return null}function _(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Zi&&Wi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Zi&&Wi(i,m),l}for(d=r(d);m<s.length;m++)h=ee(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Zi&&Wi(i,m),l}function te(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,_=c.next();m!==null&&!_.done;h++,_=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var te=p(a,m,_.value,l);if(te===null){m===null&&(m=g);break}e&&m&&te.alternate===null&&t(a,m),s=o(te,s,h),d===null?u=te:d.sibling=te,d=te,m=g}if(_.done)return n(a,m),Zi&&Wi(a,h),u;if(m===null){for(;!_.done;h++,_=c.next())_=f(a,_.value,l),_!==null&&(s=o(_,s,h),d===null?u=_:d.sibling=_,d=_);return Zi&&Wi(a,h),u}for(m=r(m);!_.done;h++,_=c.next())_=ee(m,a,h,_.value,l),_!==null&&(e&&_.alternate!==null&&m.delete(_.key===null?h:_.key),s=o(_,s,h),d===null?u=_:d.sibling=_,d=_);return e&&m.forEach(function(e){return t(a,e)}),Zi&&Wi(a,h),u}function re(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===se&&Wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Za(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=ki(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Oi(o.type,o.key,o.props,null,e.mode,c),Za(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Mi(o,e.mode,c),c.return=e,e=c}return s(e);case se:return o=Wa(o),re(e,r,o,c)}if(me(o))return _(e,r,o,c);if(de(o)){if(l=de(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),te(e,r,o,c)}if(typeof o.then==`function`)return re(e,r,Xa(o),c);if(o.$$typeof===ne)return re(e,r,va(e,o),c);Qa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ai(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ya=0;var i=re(e,t,n,r);return Ja=null,i}catch(t){if(t===Ra||t===Ba)throw t;var a=wi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var eo=$a(!0),to=$a(!1),no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ao(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function oo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,iu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=xi(e),bi(e,null,n),t}return _i(e,r,t,n),xi(e)}function so(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gt(e,n)}}function co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var lo=!1;function uo(){if(lo){var e=ka;if(e!==null)throw e}}function fo(e,t,n,r){lo=!1;var i=e.updateQueue;no=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(su&p)===p:(r&p)===p){p!==0&&p===Oa&&(lo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var ee=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(ee,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(ee,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:no=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),hu|=o,e.lanes=o,e.memoizedState=d}}function po(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function mo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)po(n[e],t)}var ho=ye(null),go=ye(0);function _o(e,t){e=pu,xe(go,e),xe(ho,t),pu=e|t.baseLanes}function vo(){xe(go,pu),xe(ho,ho.current)}function yo(){pu=go.current,be(ho),be(go)}var bo=ye(null),xo=null;function So(e){var t=e.alternate;xe(Do,Do.current&1),xe(bo,e),xo===null&&(t===null||ho.current!==null||t.memoizedState!==null)&&(xo=e)}function Co(e){xe(Do,Do.current),xe(bo,e),xo===null&&(xo=e)}function wo(e){e.tag===22?(xe(Do,Do.current),xe(bo,e),xo===null&&(xo=e)):To(e)}function To(){xe(Do,Do.current),xe(bo,bo.current)}function Eo(e){be(bo),xo===e&&(xo=null),be(Do)}var Do=ye(0);function Oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Af(n)||jf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)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 ko=0,x=null,S=null,Ao=null,jo=!1,Mo=!1,No=!1,Po=0,Fo=0,Io=null,Lo=0;function C(){throw Error(i(321))}function Ro(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Rr(e[n],t[n]))return!1;return!0}function zo(e,t,n,r,i,a){return ko=a,x=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,v.H=e===null||e.memoizedState===null?nc:rc,No=!1,a=n(r,i),No=!1,Mo&&(a=Vo(t,n,r,i)),Bo(e),a}function Bo(e){v.H=tc;var t=S!==null&&S.next!==null;if(ko=0,Ao=S=x=null,jo=!1,Fo=0,Io=null,t)throw Error(i(300));e===null||bc||(e=e.dependencies,e!==null&&ga(e)&&(bc=!0))}function Vo(e,t,n,r){x=e;var a=0;do{if(Mo&&(Io=null),Fo=0,Mo=!1,25<=a)throw Error(i(301));if(a+=1,Ao=S=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}v.H=ic,o=t(n,r)}while(Mo);return o}function Ho(){var e=v.H,t=e.useState()[0];return t=typeof t.then==`function`?Yo(t):t,e=e.useState()[0],(S===null?null:S.memoizedState)!==e&&(x.flags|=1024),t}function Uo(){var e=Po!==0;return Po=0,e}function Wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Go(e){if(jo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}jo=!1}ko=0,Ao=S=x=null,Mo=!1,Fo=Po=0,Io=null}function Ko(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ao===null?x.memoizedState=Ao=e:Ao=Ao.next=e,Ao}function qo(){if(S===null){var e=x.alternate;e=e===null?null:e.memoizedState}else e=S.next;var t=Ao===null?x.memoizedState:Ao.next;if(t!==null)Ao=t,S=e;else{if(e===null)throw x.alternate===null?Error(i(467)):Error(i(310));S=e,e={memoizedState:S.memoizedState,baseState:S.baseState,baseQueue:S.baseQueue,queue:S.queue,next:null},Ao===null?x.memoizedState=Ao=e:Ao=Ao.next=e}return Ao}function Jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Yo(e){var t=Fo;return Fo+=1,Io===null&&(Io=[]),e=Ua(Io,e,t),t=x,(Ao===null?t.memoizedState:Ao.next)===null&&(t=t.alternate,v.H=t===null||t.memoizedState===null?nc:rc),e}function Xo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Yo(e);if(e.$$typeof===ne)return b(e)}throw Error(i(438,String(e)))}function Zo(e){var t=null,n=x.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=x.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Jo(),x.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=le;return t.index++,n}function Qo(e,t){return typeof t==`function`?t(e):t}function $o(e){return es(qo(),S,e)}function es(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ko&f)===f:(su&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Oa&&(d=!0);else if((ko&p)===p){u=u.next,p===Oa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,x.lanes|=p,hu|=p;f=u.action,No&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,x.lanes|=f,hu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Rr(o,e.memoizedState)&&(bc=!0,d&&(n=ka,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ts(e){var t=qo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Rr(o,t.memoizedState)||(bc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ns(e,t,n){var r=x,a=qo(),o=Zi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Rr((S||a).memoizedState,n);if(s&&(a.memoizedState=n,bc=!0),a=a.queue,Ds(as.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||Ao!==null&&Ao.memoizedState.tag&1){if(r.flags|=2048,Ss(9,{destroy:void 0},is.bind(null,r,a,n,t),null),au===null)throw Error(i(349));o||ko&127||rs(r,t,n)}return n}function rs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=x.updateQueue,t===null?(t=Jo(),x.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function is(e,t,n,r){t.value=n,t.getSnapshot=r,os(t)&&ss(e)}function as(e,t,n){return n(function(){os(t)&&ss(e)})}function os(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rr(e,n)}catch{return!0}}function ss(e){var t=yi(e,2);t!==null&&zu(t,e,2)}function cs(e){var t=Ko();if(typeof e==`function`){var n=e;if(e=n(),No){$e(!0);try{n()}finally{$e(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:e},t}function ls(e,t,n,r){return e.baseState=n,es(e,S,typeof r==`function`?r:Qo)}function us(e,t,n,r,a){if(Qs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};v.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=v.T,o={};v.T=o;try{var s=n(i,r),c=v.S;c!==null&&c(o,s),fs(e,t,s)}catch(n){ms(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),v.T=a}}else try{a=n(i,r),fs(e,t,a)}catch(n){ms(e,t,n)}}function fs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ps(e,t,n)},function(n){return ms(e,t,n)}):ps(e,t,n)}function ps(e,t,n){t.status=`fulfilled`,t.value=n,hs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ds(e,n)))}function ms(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,hs(t),t=t.next;while(t!==r)}e.action=null}function hs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function gs(e,t){return t}function _s(e,t){if(Zi){var n=au.formState;if(n!==null){a:{var r=x;if(Zi){if(Xi){b:{for(var i=Xi,a=$i;i.nodeType!==8;){if(!a){i=null;break b}if(i=E(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Xi=E(i.nextSibling),r=i.data===`F!`;break a}}ta(r)}r=!1}r&&(t=n[0])}}return n=Ko(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gs,lastRenderedState:t},n.queue=r,n=Ys.bind(null,x,r),r.dispatch=n,r=cs(!1),a=Zs.bind(null,x,!1,r.queue),r=Ko(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=us.bind(null,x,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function vs(e){return ys(qo(),S,e)}function ys(e,t,n){if(t=es(e,t,gs)[0],e=$o(Qo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Yo(t)}catch(e){throw e===Ra?Ba:e}else r=t;t=qo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(x.flags|=2048,Ss(9,{destroy:void 0},bs.bind(null,i,n),null)),[r,a,e]}function bs(e,t){e.action=t}function xs(e){var t=qo(),n=S;if(n!==null)return ys(t,n,e);qo(),t=t.memoizedState,n=qo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ss(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=x.updateQueue,t===null&&(t=Jo(),x.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Cs(){return qo().memoizedState}function ws(e,t,n,r){var i=Ko();x.flags|=e,i.memoizedState=Ss(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ts(e,t,n,r){var i=qo();r=r===void 0?null:r;var a=i.memoizedState.inst;S!==null&&r!==null&&Ro(r,S.memoizedState.deps)?i.memoizedState=Ss(t,a,n,r):(x.flags|=e,i.memoizedState=Ss(1|t,a,n,r))}function Es(e,t){ws(8390656,8,e,t)}function Ds(e,t){Ts(2048,8,e,t)}function Os(e){x.flags|=4;var t=x.updateQueue;if(t===null)t=Jo(),x.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ks(e){var t=qo().memoizedState;return Os({ref:t,nextImpl:e}),function(){if(iu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function As(e,t){return Ts(4,2,e,t)}function js(e,t){return Ts(4,4,e,t)}function Ms(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ns(e,t,n){n=n==null?null:n.concat([e]),Ts(4,4,Ms.bind(null,t,e),n)}function Ps(){}function Fs(e,t){var n=qo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ro(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Is(e,t){var n=qo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ro(t,r[1]))return r[0];if(r=e(),No){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r}function Ls(e,t,n){return n===void 0||ko&1073741824&&!(su&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ru(),x.lanes|=e,hu|=e,n)}function Rs(e,t,n,r){return Rr(n,t)?n:ho.current===null?!(ko&42)||ko&1073741824&&!(su&261930)?(bc=!0,e.memoizedState=n):(e=Ru(),x.lanes|=e,hu|=e,t):(e=Ls(e,n,r),Rr(e,t)||(bc=!0),e)}function zs(e,t,n,r,i){var a=he.p;he.p=a!==0&&8>a?a:8;var o=v.T,s={};v.T=s,Zs(e,!1,t,n);try{var c=i(),l=v.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Xs(e,t,Ma(c,r),Lu(e)):Xs(e,t,r,Lu(e))}catch(n){Xs(e,t,{then:function(){},status:`rejected`,reason:n},Lu())}finally{he.p=a,o!==null&&s.types!==null&&(o.types=s.types),v.T=o}}function Bs(){}function Vs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Hs(e).queue;zs(e,a,t,ge,n===null?Bs:function(){return Us(e),n(r)})}function Hs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:ge},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Us(e){var t=Hs(e);t.next===null&&(t=e.alternate.memoizedState),Xs(e,t.next.queue,{},Lu())}function Ws(){return b(bp)}function Gs(){return qo().memoizedState}function Ks(){return qo().memoizedState}function qs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Lu();e=ao(n);var r=oo(t,e,n);r!==null&&(zu(r,t,n),so(r,t,n)),t={cache:wa()},e.payload=t;return}t=t.return}}function Js(e,t,n){var r=Lu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Qs(e)?$s(t,n):(n=vi(e,t,n,r),n!==null&&(zu(n,e,r),ec(n,t,r)))}function Ys(e,t,n){Xs(e,t,n,Lu())}function Xs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qs(e))$s(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Rr(s,o))return _i(e,t,i,0),au===null&&gi(),!1}catch{}if(n=vi(e,t,i,r),n!==null)return zu(n,e,r),ec(n,t,r),!0}return!1}function Zs(e,t,n,r){if(r={lane:2,revertLane:Id(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Qs(e)){if(t)throw Error(i(479))}else t=vi(e,n,r,2),t!==null&&zu(t,e,2)}function Qs(e){var t=e.alternate;return e===x||t!==null&&t===x}function $s(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ec(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gt(e,n)}}var tc={readContext:b,use:Xo,useCallback:C,useContext:C,useEffect:C,useImperativeHandle:C,useLayoutEffect:C,useInsertionEffect:C,useMemo:C,useReducer:C,useRef:C,useState:C,useDebugValue:C,useDeferredValue:C,useTransition:C,useSyncExternalStore:C,useId:C,useHostTransitionStatus:C,useFormState:C,useActionState:C,useOptimistic:C,useMemoCache:C,useCacheRefresh:C};tc.useEffectEvent=C;var nc={readContext:b,use:Xo,useCallback:function(e,t){return Ko().memoizedState=[e,t===void 0?null:t],e},useContext:b,useEffect:Es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ws(4194308,4,Ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ws(4194308,4,e,t)},useInsertionEffect:function(e,t){ws(4,2,e,t)},useMemo:function(e,t){var n=Ko();t=t===void 0?null:t;var r=e();if(No){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ko();if(n!==void 0){var i=n(t);if(No){$e(!0);try{n(t)}finally{$e(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Js.bind(null,x,e),[r.memoizedState,e]},useRef:function(e){var t=Ko();return e={current:e},t.memoizedState=e},useState:function(e){e=cs(e);var t=e.queue,n=Ys.bind(null,x,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ps,useDeferredValue:function(e,t){return Ls(Ko(),e,t)},useTransition:function(){var e=cs(!1);return e=zs.bind(null,x,e.queue,!0,!1),Ko().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=x,a=Ko();if(Zi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),au===null)throw Error(i(349));su&127||rs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Es(as.bind(null,r,o,e),[e]),r.flags|=2048,Ss(9,{destroy:void 0},is.bind(null,r,o,n,t),null),n},useId:function(){var e=Ko(),t=au.identifierPrefix;if(Zi){var n=Ui,r=Hi;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Lo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ws,useFormState:_s,useActionState:_s,useOptimistic:function(e){var t=Ko();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Zs.bind(null,x,!0,n),n.dispatch=t,[e,t]},useMemoCache:Zo,useCacheRefresh:function(){return Ko().memoizedState=qs.bind(null,x)},useEffectEvent:function(e){var t=Ko(),n={impl:e};return t.memoizedState=n,function(){if(iu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},rc={readContext:b,use:Xo,useCallback:Fs,useContext:b,useEffect:Ds,useImperativeHandle:Ns,useInsertionEffect:As,useLayoutEffect:js,useMemo:Is,useReducer:$o,useRef:Cs,useState:function(){return $o(Qo)},useDebugValue:Ps,useDeferredValue:function(e,t){return Rs(qo(),S.memoizedState,e,t)},useTransition:function(){var e=$o(Qo)[0],t=qo().memoizedState;return[typeof e==`boolean`?e:Yo(e),t]},useSyncExternalStore:ns,useId:Gs,useHostTransitionStatus:Ws,useFormState:vs,useActionState:vs,useOptimistic:function(e,t){return ls(qo(),S,e,t)},useMemoCache:Zo,useCacheRefresh:Ks};rc.useEffectEvent=ks;var ic={readContext:b,use:Xo,useCallback:Fs,useContext:b,useEffect:Ds,useImperativeHandle:Ns,useInsertionEffect:As,useLayoutEffect:js,useMemo:Is,useReducer:ts,useRef:Cs,useState:function(){return ts(Qo)},useDebugValue:Ps,useDeferredValue:function(e,t){var n=qo();return S===null?Ls(n,e,t):Rs(n,S.memoizedState,e,t)},useTransition:function(){var e=ts(Qo)[0],t=qo().memoizedState;return[typeof e==`boolean`?e:Yo(e),t]},useSyncExternalStore:ns,useId:Gs,useHostTransitionStatus:Ws,useFormState:xs,useActionState:xs,useOptimistic:function(e,t){var n=qo();return S===null?(n.baseState=e,[e,n.queue.dispatch]):ls(n,S,e,t)},useMemoCache:Zo,useCacheRefresh:Ks};ic.useEffectEvent=ks;function ac(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var oc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Lu(),i=ao(r);i.payload=t,n!=null&&(i.callback=n),t=oo(e,i,r),t!==null&&(zu(t,e,r),so(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Lu(),i=ao(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=oo(e,i,r),t!==null&&(zu(t,e,r),so(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Lu(),r=ao(n);r.tag=2,t!=null&&(r.callback=t),t=oo(e,r,n),t!==null&&(zu(t,e,n),so(t,e,n))}};function sc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!zr(n,r)||!zr(i,a):!0}function cc(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&&oc.enqueueReplaceState(t,t.state,null)}function lc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function uc(e){fi(e)}function dc(e){console.error(e)}function fc(e){fi(e)}function pc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function mc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function hc(e,t,n){return n=ao(n),n.tag=3,n.payload={element:null},n.callback=function(){pc(e,t)},n}function gc(e){return e=ao(e),e.tag=3,e}function _c(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){mc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){mc(t,n,r),typeof i!=`function`&&(Du===null?Du=new Set([this]):Du.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function vc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ha(t,n,a,!0),n=bo.current,n!==null){switch(n.tag){case 31:case 13:return xo===null?Zu():n.alternate===null&&mu===0&&(mu=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),gd(e,r,a)),!1;case 22:return n.flags|=65536,r===Va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),gd(e,r,a)),!1}throw Error(i(435,n.tag))}return gd(e,r,a),Zu(),!1}if(Zi)return t=bo.current,t===null?(r!==ea&&(t=Error(i(423),{cause:r}),sa(Pi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Pi(r,n),a=hc(e.stateNode,r,a),co(e,a),mu!==4&&(mu=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ea&&(e=Error(i(422),{cause:r}),sa(Pi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Pi(o,n),bu===null?bu=[o]:bu.push(o),mu!==4&&(mu=2),t===null)return!0;r=Pi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=hc(n.stateNode,r,e),co(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Du===null||!Du.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=gc(a),_c(a,e,n,r),co(n,a),!1}n=n.return}while(n!==null);return!1}var yc=Error(i(461)),bc=!1;function xc(e,t,n,r){t.child=e===null?to(t,null,n,r):eo(t,e.child,n,r)}function Sc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return _a(t),r=zo(e,t,n,o,a,i),s=Uo(),e!==null&&!bc?(Wo(e,t,i),Kc(e,t,i)):(Zi&&s&&Ki(t),t.flags|=1,xc(e,t,r,i),t.child)}function Cc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Ti(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,wc(e,t,a,r,i)):(e=Oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!qc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?zr:n,n(o,r)&&e.ref===t.ref)return Kc(e,t,i)}return t.flags|=1,e=Ei(a,r),e.ref=t.ref,e.return=t,t.child=e}function wc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(zr(a,r)&&e.ref===t.ref){if(bc=!1,t.pendingProps=r=a,qc(e,i))e.flags&131072&&(bc=!0);else return t.lanes=e.lanes,Kc(e,t,i)}}return Mc(e,t,n,r,i)}function Tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ia(t,a===null?null:a.cachePool),a===null?vo():_o(t,a),wo(t);else return r=t.lanes=536870912,Dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ia(t,null),vo(),To(t)):(Ia(t,a.cachePool),_o(t,a),To(t),t.memoizedState=null);return xc(e,t,i,n),t.child}function Ec(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Dc(e,t,n,r,i){var a=Fa();return a=a===null?null:{parent:Ca._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ia(t,null),vo(),wo(t),e!==null&&ha(e,t,r,!0),t.childLanes=i,null}function Oc(e,t){return t=Vc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function kc(e,t,n){return eo(t,e.child,null,n),e=Oc(t,t.pendingProps),e.flags|=2,Eo(t),t.memoizedState=null,e}function Ac(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Zi){if(r.mode===`hidden`)return e=Oc(t,r),t.lanes=536870912,Ec(null,e);if(Co(t),(e=Xi)?(e=T(e,$i),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vi===null?null:{id:Hi,overflow:Ui},retryLane:536870912,hydrationErrors:null},n=ji(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return t.lanes=536870912,null}return Oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Co(t),a){if(t.flags&256)t.flags&=-257,t=kc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(bc||ha(e,t,n,!1),a=(n&e.childLanes)!==0,bc||a){if(r=au,r!==null&&(s=_t(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,yi(e,s),zu(r,e,s),yc;Zu(),t=kc(e,t,n)}else e=o.treeContext,Xi=E(s.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Oc(t,r),t.flags|=4096;return t}return e=Ei(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function jc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Mc(e,t,n,r,i){return _a(t),n=zo(e,t,n,r,void 0,i),r=Uo(),e!==null&&!bc?(Wo(e,t,i),Kc(e,t,i)):(Zi&&r&&Ki(t),t.flags|=1,xc(e,t,n,i),t.child)}function Nc(e,t,n,r,i,a){return _a(t),t.updateQueue=null,n=Vo(t,r,n,i),Bo(e),r=Uo(),e!==null&&!bc?(Wo(e,t,a),Kc(e,t,a)):(Zi&&r&&Ki(t),t.flags|=1,xc(e,t,n,a),t.child)}function Pc(e,t,n,r,i){if(_a(t),t.stateNode===null){var a=Si,o=n.contextType;typeof o==`object`&&o&&(a=b(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=oc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ro(t),o=n.contextType,a.context=typeof o==`object`&&o?b(o):Si,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(ac(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&oc.enqueueReplaceState(a,a.state,null),fo(t,r,a,i),uo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=lc(n,s);a.props=c;var l=a.context,u=n.contextType;o=Si,typeof u==`object`&&u&&(o=b(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&cc(t,a,r,o),no=!1;var f=t.memoizedState;a.state=f,fo(t,r,a,i),uo(),l=t.memoizedState,s||f!==l||no?(typeof d==`function`&&(ac(t,n,d,r),l=t.memoizedState),(c=no||sc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,io(e,t),o=t.memoizedProps,u=lc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Si,typeof l==`object`&&l&&(c=b(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&cc(t,a,r,c),no=!1,f=t.memoizedState,a.state=f,fo(t,r,a,i),uo();var p=t.memoizedState;o!==d||f!==p||no||e!==null&&e.dependencies!==null&&ga(e.dependencies)?(typeof s==`function`&&(ac(t,n,s,r),p=t.memoizedState),(u=no||sc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ga(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,jc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=eo(t,e.child,null,i),t.child=eo(t,null,n,i)):xc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Kc(e,t,i),e}function Fc(e,t,n,r){return aa(),t.flags|=256,xc(e,t,n,r),t.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Lc(e){return{baseLanes:e,cachePool:La()}}function Rc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=vu),e}function zc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(Do.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Zi){if(a?So(t):To(t),(e=Xi)?(e=T(e,$i),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Vi===null?null:{id:Hi,overflow:Ui},retryLane:536870912,hydrationErrors:null},n=ji(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return jf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(To(t),a=t.mode,c=Vc({mode:`hidden`,children:c},a),r=ki(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Lc(n),r.childLanes=Rc(e,s,n),t.memoizedState=Ic,Ec(null,r)):(So(t),Bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(So(t),t.flags&=-257,t=Hc(e,t,n)):t.memoizedState===null?(To(t),c=r.fallback,a=t.mode,r=Vc({mode:`visible`,children:r.children},a),c=ki(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,eo(t,e.child,null,n),r=t.child,r.memoizedState=Lc(n),r.childLanes=Rc(e,s,n),t.memoizedState=Ic,t=Ec(null,r)):(To(t),t.child=e.child,t.flags|=128,t=null);else if(So(t),jf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,sa({value:r,source:null,stack:null}),t=Hc(e,t,n)}else if(bc||ha(e,t,n,!1),s=(n&e.childLanes)!==0,bc||s){if(s=au,s!==null&&(r=_t(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,yi(e,r),zu(s,e,r),yc;Af(c)||Zu(),t=Hc(e,t,n)}else Af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Xi=E(c.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Bc(t,r.children),t.flags|=4096);return t}return a?(To(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=Ei(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ki(c,a,n,null),c.flags|=2):c=Ei(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,Ec(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Lc(n):(a=c.cachePool,a===null?a=La():(l=Ca._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Rc(e,s,n),t.memoizedState=Ic,Ec(e.child,r)):(So(t),n=e.child,e=n.sibling,n=Ei(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Bc(e,t){return t=Vc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Vc(e,t){return e=wi(22,e,null,t),e.lanes=0,e}function Hc(e,t,n){return eo(t,e.child,null,n),e=Bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Uc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pa(e.return,t,n)}function Wc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Gc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Do.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,xe(Do,o),xc(e,t,r,n),r=Zi?Ri:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Uc(e,n,t);else if(e.tag===19)Uc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Wc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Wc(t,!0,n,null,a,r);break;case`together`:Wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Kc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),hu|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ha(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Ei(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ei(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function qc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ga(e)))}function Jc(e,t,n){switch(t.tag){case 3:Ee(t,t.stateNode.containerInfo),da(t,Ca,e.memoizedState.cache),aa();break;case 27:case 5:Oe(t);break;case 4:Ee(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Co(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(So(t),e=Kc(e,t,n),e===null?null:e.sibling):zc(e,t,n):(So(t),t.flags|=128,null);So(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(ha(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Gc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),xe(Do,Do.current),r)break;return null;case 22:return t.lanes=0,Tc(e,t,n,t.pendingProps);case 24:da(t,Ca,e.memoizedState.cache)}return Kc(e,t,n)}function Yc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)bc=!0;else{if(!qc(e,n)&&!(t.flags&128))return bc=!1,Jc(e,t,n);bc=!!(e.flags&131072)}}else bc=!1,Zi&&t.flags&1048576&&Gi(t,Ri,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Wa(t.elementType),t.type=e,typeof e==`function`)Ti(e)?(r=lc(e,r),t.tag=1,t=Pc(null,t,e,r,n)):(t.tag=0,t=Mc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===re){t.tag=11,t=Sc(null,t,e,r,n);break a}if(a===oe){t.tag=14,t=Cc(null,t,e,r,n);break a}}throw t=pe(e)||e,Error(i(306,t,``))}}return t;case 0:return Mc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=lc(r,t.pendingProps),Pc(e,t,r,a,n);case 3:a:{if(Ee(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,io(e,t),fo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,da(t,Ca,r),r!==o.cache&&ma(t,[Ca],n,!0),uo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Fc(e,t,r,n);break a}if(r!==a){a=Pi(Error(i(424)),t),sa(a),t=Fc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Xi=E(e.firstChild),Yi=t,Zi=!0,Qi=null,$i=!0,n=to(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(aa(),r===a){t=Kc(e,t,n);break a}xc(e,t,r,n)}t=t.child}return t;case 26:return jc(e,t),e===null?(n=Zf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Zi||(n=t.type,e=t.pendingProps,r=mf(we.current).createElement(n),r[Ct]=t,r[y]=e,cf(r,n,e),Ft(r),t.stateNode=r):t.memoizedState=Zf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&Zi&&(r=t.stateNode=If(t.type,t.pendingProps,we.current),Yi=t,$i=!0,a=Xi,Tf(t.type)?(Nf=a,Xi=E(r.firstChild)):Xi=a),xc(e,t,t.pendingProps.children,n),jc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Zi&&((a=r=Xi)&&(r=w(r,t.type,t.pendingProps,$i),r===null?a=!1:(t.stateNode=r,Yi=t,Xi=E(r.firstChild),$i=!1,a=!0)),a||ta(t)),Oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,_f(a,o)?r=null:s!==null&&_f(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=zo(e,t,Ho,null,null,n),bp._currentValue=a),jc(e,t),xc(e,t,r,n),t.child;case 6:return e===null&&Zi&&((e=n=Xi)&&(n=kf(n,t.pendingProps,$i),n===null?e=!1:(t.stateNode=n,Yi=t,Xi=null,e=!0)),e||ta(t)),null;case 13:return zc(e,t,n);case 4:return Ee(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=eo(t,null,r,n):xc(e,t,r,n),t.child;case 11:return Sc(e,t,t.type,t.pendingProps,n);case 7:return xc(e,t,t.pendingProps,n),t.child;case 8:return xc(e,t,t.pendingProps.children,n),t.child;case 12:return xc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,da(t,t.type,r.value),xc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,_a(t),a=b(a),r=r(a),t.flags|=1,xc(e,t,r,n),t.child;case 14:return Cc(e,t,t.type,t.pendingProps,n);case 15:return wc(e,t,t.type,t.pendingProps,n);case 19:return Gc(e,t,n);case 31:return Ac(e,t,n);case 22:return Tc(e,t,n,t.pendingProps);case 24:return _a(t),r=b(Ca),e===null?(a=Fa(),a===null&&(a=au,o=wa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ro(t),da(t,Ca,a)):((e.lanes&n)!==0&&(io(e,t),fo(t,null,null,n),uo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,da(t,Ca,r),r!==a.cache&&ma(t,[Ca],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),da(t,Ca,r))),xc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Xc(e){e.flags|=4}function Zc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ju())e.flags|=8192;else throw Ga=Va,za}}else e.flags&=-16777217}function Qc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!fp(t)){if(Ju())e.flags|=8192;else throw Ga=Va,za}}function $c(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:dt(),e.lanes|=t,yu|=t)}function el(e,t){if(!Zi)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 tl(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&65011712,r|=i.flags&65011712,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 nl(e,t,n){var r=t.pendingProps;switch(qi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tl(t),null;case 1:return tl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),fa(Ca),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ia(t)?Xc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,oa())),tl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Xc(t),o===null?(tl(t),Zc(t,a,null,r,n)):(tl(t),Qc(t,o))):o?o===e.memoizedState?(tl(t),t.flags&=-16777217):(Xc(t),tl(t),Qc(t,o)):(e=e.memoizedProps,e!==r&&Xc(t),tl(t),Zc(t,a,e,r,n)),null;case 27:if(ke(t),n=we.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Xc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return tl(t),null}e=Se.current,ia(t)?na(t,e):(e=If(a,r,n),t.stateNode=e,Xc(t))}return tl(t),null;case 5:if(ke(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Xc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return tl(t),null}if(o=Se.current,ia(t))na(t,o);else{var s=mf(we.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Ct]=t,o[y]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(cf(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Xc(t)}}return tl(t),Zc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Xc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=we.current,ia(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Yi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||af(e.nodeValue,n)),e||ta(t,!0)}else e=mf(e).createTextNode(r),e[Ct]=t,t.stateNode=e}return tl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ia(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Ct]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;tl(t),e=!1}else n=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Eo(t),t):(Eo(t),null);if(t.flags&128)throw Error(i(558))}return tl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ia(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Ct]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;tl(t),a=!1}else a=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Eo(t),t):(Eo(t),null)}return Eo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),$c(t,t.updateQueue),tl(t),null);case 4:return De(),e===null&&Jd(t.stateNode.containerInfo),tl(t),null;case 10:return fa(t.type),tl(t),null;case 19:if(be(Do),r=t.memoizedState,r===null)return tl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)el(r,!1);else{if(mu!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Oo(e),o!==null){for(t.flags|=128,el(r,!1),e=o.updateQueue,t.updateQueue=e,$c(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Di(n,e),n=n.sibling;return xe(Do,Do.current&1|2),Zi&&Wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&He()>Tu&&(t.flags|=128,a=!0,el(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,$c(t,e),el(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Zi)return tl(t),null}else 2*He()-r.renderingStartTime>Tu&&n!==536870912&&(t.flags|=128,a=!0,el(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(tl(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=He(),e.sibling=null,n=Do.current,xe(Do,a?n&1|2:n&1),Zi&&Wi(t,r.treeForkCount),e);case 22:case 23:return Eo(t),yo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(tl(t),t.subtreeFlags&6&&(t.flags|=8192)):tl(t),n=t.updateQueue,n!==null&&$c(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&be(Pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fa(Ca),tl(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function rl(e,t){switch(qi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(Ca),De(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(Eo(t),t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Eo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return be(Do),null;case 4:return De(),null;case 10:return fa(t.type),null;case 22:case 23:return Eo(t),yo(),e!==null&&be(Pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(Ca),null;case 25:return null;default:return null}}function il(e,t){switch(qi(t),t.tag){case 3:fa(Ca),De();break;case 26:case 27:case 5:ke(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Eo(t);break;case 13:Eo(t);break;case 19:be(Do);break;case 10:fa(t.type);break;case 22:case 23:Eo(t),yo(),e!==null&&be(Pa);break;case 24:fa(Ca)}}function al(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){hd(t,t.return,e)}}function ol(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){hd(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){hd(t,t.return,e)}}function sl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{mo(t,n)}catch(t){hd(e,e.return,t)}}}function cl(e,t,n){n.props=lc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){hd(e,t,n)}}function ll(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){hd(e,t,n)}}function ul(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){hd(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){hd(e,t,n)}else n.current=null}}function dl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){hd(e,e.return,t)}}function fl(e,t,n){try{var r=e.stateNode;lf(r,e.type,n,t),r[y]=t}catch(t){hd(e,e.return,t)}}function pl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Tf(e.type)||e.tag===4}function ml(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||pl(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.tag===27&&Tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function hl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gn));else if(r!==4&&(r===27&&Tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(hl(e,t,n),e=e.sibling;e!==null;)hl(e,t,n),e=e.sibling}function gl(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&&(r===27&&Tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(gl(e,t,n),e=e.sibling;e!==null;)gl(e,t,n),e=e.sibling}function _l(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);cf(t,r,n),t[Ct]=e,t[y]=n}catch(t){hd(e,e.return,t)}}var vl=!1,yl=!1,bl=!1,xl=typeof WeakSet==`function`?WeakSet:Set,Sl=null;function Cl(e,t){if(e=e.containerInfo,ff=kp,e=Ur(e),Wr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(pf={focusedElem:e,selectionRange:n},kp=!1,Sl=t;Sl!==null;)if(t=Sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Sl=e;else for(;Sl!==null;){switch(t=Sl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=lc(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){hd(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Of(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:Of(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Sl=e;break}Sl=t.return}}function wl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:zl(e,n),r&4&&al(5,n);break;case 1:if(zl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){hd(n,n.return,e)}else{var i=lc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){hd(n,n.return,e)}}}r&64&&sl(n),r&512&&ll(n,n.return);break;case 3:if(zl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{mo(e,t)}catch(e){hd(n,n.return,e)}}break;case 27:t===null&&r&4&&_l(n);case 26:case 5:zl(e,n),t===null&&r&4&&dl(n),r&512&&ll(n,n.return);break;case 12:zl(e,n);break;case 31:zl(e,n),r&4&&Al(e,n);break;case 13:zl(e,n),r&4&&jl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=yd.bind(null,n),Mf(e,n))));break;case 22:if(r=n.memoizedState!==null||vl,!r){t=t!==null&&t.memoizedState!==null||yl,i=vl;var a=yl;vl=r,(yl=t)&&!a?Vl(e,n,!!(n.subtreeFlags&8772)):zl(e,n),vl=i,yl=a}break;case 30:break;default:zl(e,n)}}function Tl(e){var t=e.alternate;t!==null&&(e.alternate=null,Tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&At(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var El=null,Dl=!1;function Ol(e,t,n){for(n=n.child;n!==null;)kl(e,t,n),n=n.sibling}function kl(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount==`function`)try{Qe.onCommitFiberUnmount(Ze,n)}catch{}switch(n.tag){case 26:yl||ul(n,t),Ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:yl||ul(n,t);var r=El,i=Dl;Tf(n.type)&&(El=n.stateNode,Dl=!1),Ol(e,t,n),Lf(n.stateNode),El=r,Dl=i;break;case 5:yl||ul(n,t);case 6:if(r=El,i=Dl,El=null,Ol(e,t,n),El=r,Dl=i,El!==null){if(Dl)try{(El.nodeType===9?El.body:El.nodeName===`HTML`?El.ownerDocument.body:El).removeChild(n.stateNode)}catch(e){hd(n,t,e)}else try{El.removeChild(n.stateNode)}catch(e){hd(n,t,e)}}break;case 18:El!==null&&(Dl?(e=El,Ef(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),tm(e)):Ef(El,n.stateNode));break;case 4:r=El,i=Dl,El=n.stateNode.containerInfo,Dl=!0,Ol(e,t,n),El=r,Dl=i;break;case 0:case 11:case 14:case 15:ol(2,n,t),yl||ol(4,n,t),Ol(e,t,n);break;case 1:yl||(ul(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&cl(n,t,r)),Ol(e,t,n);break;case 21:Ol(e,t,n);break;case 22:yl=(r=yl)||n.memoizedState!==null,Ol(e,t,n),yl=r;break;default:Ol(e,t,n)}}function Al(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{tm(e)}catch(e){hd(t,t.return,e)}}}function jl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{tm(e)}catch(e){hd(t,t.return,e)}}function Ml(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new xl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new xl),t;default:throw Error(i(435,e.tag))}}function Nl(e,t){var n=Ml(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=bd.bind(null,e,t);t.then(r,r)}})}function Pl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Tf(c.type)){El=c.stateNode,Dl=!1;break a}break;case 5:El=c.stateNode,Dl=!1;break a;case 3:case 4:El=c.stateNode.containerInfo,Dl=!0;break a}c=c.return}if(El===null)throw Error(i(160));kl(o,s,a),El=null,Dl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Il(t,e),t=t.sibling}var Fl=null;function Il(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pl(t,e),Ll(e),r&4&&(ol(3,e,e.return),al(3,e),ol(5,e,e.return));break;case 1:Pl(t,e),Ll(e),r&512&&(yl||n===null||ul(n,n.return)),r&64&&vl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=Fl;if(Pl(t,e),Ll(e),r&512&&(yl||n===null||ul(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[kt]||o[Ct]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),cf(o,r,n),o[Ct]=e,Ft(o),r=o;break a;case`link`:var s=lp(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),cf(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=lp(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),cf(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[Ct]=e,Ft(o),r=o}e.stateNode=r}else up(a,e.type,e.stateNode)}else e.stateNode=ip(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&fl(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?up(a,e.type,e.stateNode):ip(a,r,e.memoizedProps))}break;case 27:Pl(t,e),Ll(e),r&512&&(yl||n===null||ul(n,n.return)),n!==null&&r&4&&fl(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Pl(t,e),Ll(e),r&512&&(yl||n===null||ul(n,n.return)),e.flags&32){a=e.stateNode;try{cn(a,``)}catch(t){hd(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,fl(e,a,n===null?a:n.memoizedProps)),r&1024&&(bl=!0);break;case 6:if(Pl(t,e),Ll(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){hd(e,e.return,t)}}break;case 3:if(cp=null,a=Fl,Fl=zf(t.containerInfo),Pl(t,e),Fl=a,Ll(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{tm(t.containerInfo)}catch(t){hd(e,e.return,t)}bl&&(bl=!1,Rl(e));break;case 4:r=Fl,Fl=zf(e.stateNode.containerInfo),Pl(t,e),Ll(e),Fl=r;break;case 12:Pl(t,e),Ll(e);break;case 31:Pl(t,e),Ll(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 13:Pl(t,e),Ll(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Cu=He()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=vl,d=yl;if(vl=u||a,yl=d||l,Pl(t,e),yl=d,vl=u,Ll(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||vl||yl||Bl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){hd(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){hd(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?Df(m,!0):Df(l.stateNode,!1)}catch(e){hd(l,l.return,e)}}}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 a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,Nl(e,n))));break;case 19:Pl(t,e),Ll(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Nl(e,r)));break;case 30:break;case 21:break;default:Pl(t,e),Ll(e)}}function Ll(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(pl(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;gl(e,ml(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(cn(o,``),n.flags&=-33),gl(e,ml(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;hl(e,ml(e),s);break;default:throw Error(i(161))}}catch(t){hd(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function zl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)wl(e,t.alternate,t),t=t.sibling}function Bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ol(4,t,t.return),Bl(t);break;case 1:ul(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&cl(t,t.return,n),Bl(t);break;case 27:Lf(t.stateNode);case 26:case 5:ul(t,t.return),Bl(t);break;case 22:t.memoizedState===null&&Bl(t);break;case 30:Bl(t);break;default:Bl(t)}e=e.sibling}}function Vl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Vl(i,a,n),al(4,a);break;case 1:if(Vl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){hd(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)po(c[i],s)}catch(e){hd(r,r.return,e)}}n&&o&64&&sl(a),ll(a,a.return);break;case 27:_l(a);case 26:case 5:Vl(i,a,n),n&&r===null&&o&4&&dl(a),ll(a,a.return);break;case 12:Vl(i,a,n);break;case 31:Vl(i,a,n),n&&o&4&&Al(i,a);break;case 13:Vl(i,a,n),n&&o&4&&jl(i,a);break;case 22:a.memoizedState===null&&Vl(i,a,n),ll(a,a.return);break;case 30:break;default:Vl(i,a,n)}t=t.sibling}}function Hl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ta(n))}function Ul(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ta(e))}function Wl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Gl(e,t,n,r),t=t.sibling}function Gl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Wl(e,t,n,r),i&2048&&al(9,t);break;case 1:Wl(e,t,n,r);break;case 3:Wl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ta(e)));break;case 12:if(i&2048){Wl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){hd(t,t.return,e)}}else Wl(e,t,n,r);break;case 31:Wl(e,t,n,r);break;case 13:Wl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Wl(e,t,n,r):(a._visibility|=2,Kl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?Wl(e,t,n,r):ql(e,t),i&2048&&Hl(o,t);break;case 24:Wl(e,t,n,r),i&2048&&Ul(t.alternate,t);break;default:Wl(e,t,n,r)}}function Kl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Kl(a,o,s,c,i),al(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Kl(a,o,s,c,i)):u._visibility&2?Kl(a,o,s,c,i):ql(a,o),i&&l&2048&&Hl(o.alternate,o);break;case 24:Kl(a,o,s,c,i),i&&l&2048&&Ul(o.alternate,o);break;default:Kl(a,o,s,c,i)}t=t.sibling}}function ql(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:ql(n,r),i&2048&&Hl(r.alternate,r);break;case 24:ql(n,r),i&2048&&Ul(r.alternate,r);break;default:ql(n,r)}t=t.sibling}}var Jl=8192;function Yl(e,t,n){if(e.subtreeFlags&Jl)for(e=e.child;e!==null;)Xl(e,t,n),e=e.sibling}function Xl(e,t,n){switch(e.tag){case 26:Yl(e,t,n),e.flags&Jl&&e.memoizedState!==null&&pp(n,Fl,e.memoizedState,e.memoizedProps);break;case 5:Yl(e,t,n);break;case 3:case 4:var r=Fl;Fl=zf(e.stateNode.containerInfo),Yl(e,t,n),Fl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Jl,Jl=16777216,Yl(e,t,n),Jl=r):Yl(e,t,n));break;default:Yl(e,t,n)}}function Zl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ql(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Sl=r,tu(r,e)}Zl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$l(e),e=e.sibling}function $l(e){switch(e.tag){case 0:case 11:case 15:Ql(e),e.flags&2048&&ol(9,e,e.return);break;case 3:Ql(e);break;case 12:Ql(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,eu(e)):Ql(e);break;default:Ql(e)}}function eu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Sl=r,tu(r,e)}Zl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ol(8,t,t.return),eu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,eu(t));break;default:eu(t)}e=e.sibling}}function tu(e,t){for(;Sl!==null;){var n=Sl;switch(n.tag){case 0:case 11:case 15:ol(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Sl=r;else a:for(n=e;Sl!==null;){r=Sl;var i=r.sibling,a=r.return;if(Tl(r),r===n){Sl=null;break a}if(i!==null){i.return=a,Sl=i;break a}Sl=a}}}var nu={getCacheForType:function(e){var t=b(Ca),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return b(Ca).controller.signal}},ru=typeof WeakMap==`function`?WeakMap:Map,iu=0,au=null,ou=null,su=0,cu=0,lu=null,uu=!1,du=!1,fu=!1,pu=0,mu=0,hu=0,gu=0,_u=0,vu=0,yu=0,bu=null,xu=null,Su=!1,Cu=0,wu=0,Tu=1/0,Eu=null,Du=null,Ou=0,ku=null,Au=null,ju=0,Mu=0,Nu=null,Pu=null,Fu=0,Iu=null;function Lu(){return iu&2&&su!==0?su&-su:v.T===null?bt():Id()}function Ru(){if(vu===0){if(!(su&536870912)||Zi){var e=at;at<<=1,!(at&3932160)&&(at=262144),vu=e}else vu=536870912}return e=bo.current,e!==null&&(e.flags|=32),vu}function zu(e,t,n){(e===au&&(cu===2||cu===9)||e.cancelPendingCommit!==null)&&(Ku(e,0),Uu(e,su,vu,!1)),pt(e,n),(!(iu&2)||e!==au)&&(e===au&&(!(iu&2)&&(gu|=n),mu===4&&Uu(e,su,vu,!1)),Od(e))}function Bu(e,t,n){if(iu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||lt(e,t),a=r?ed(e,t):Qu(e,t,!0),o=r;do{if(a===0){du&&!r&&Uu(e,t,0,!1);break}if(n=e.current.alternate,o&&!Hu(n)){a=Qu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=bu;var l=c.current.memoizedState.isDehydrated;if(l&&(Ku(c,s).flags|=256),s=Qu(c,s,!1),s!==2){if(fu&&!l){c.errorRecoveryDisabledLanes|=o,gu|=o,a=4;break a}o=xu,xu=a,o!==null&&(xu===null?xu=o:xu.push.apply(xu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ku(e,0),Uu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Uu(r,t,vu,!uu);break a;case 2:xu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Cu+300-He(),10<a)){if(Uu(r,t,vu,!uu),ct(r,0,!0)!==0)break a;ju=t,r.timeoutHandle=bf(Vu.bind(null,r,n,xu,Eu,Su,t,vu,gu,yu,uu,o,`Throttled`,-0,0),a);break a}Vu(r,n,xu,Eu,Su,t,vu,gu,yu,uu,o,null,-0,0)}break}while(1);Od(e)}function Vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gn},Xl(t,a,d);var m=(a&62914560)===a?Cu-He():(a&4194048)===a?wu-He():0;if(m=hp(d,m),m!==null){ju=a,e.cancelPendingCommit=m(sd.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Uu(e,a,o,!l);return}}sd(e,t,a,n,r,i,o,s,c)}function Hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Rr(a(),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 Uu(e,t,n,r){t&=~_u,t&=~gu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-et(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&ht(e,n,t)}function Wu(){return iu&6?!0:(kd(0,!1),!1)}function Gu(){if(ou!==null){if(cu===0)var e=ou.return;else e=ou,ua=la=null,Go(e),Ja=null,Ya=0,e=ou;for(;e!==null;)il(e.alternate,e),e=e.return;ou=null}}function Ku(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,xf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ju=0,Gu(),au=e,ou=n=Ei(e.current,null),su=t,cu=0,lu=null,uu=!1,du=lt(e,t),fu=!1,yu=vu=_u=gu=hu=mu=0,xu=bu=null,Su=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-et(r),a=1<<i;t|=e[i],r&=~a}return pu=t,gi(),n}function qu(e,t){x=null,v.H=tc,t===Ra||t===Ba?(t=Ka(),cu=3):t===za?(t=Ka(),cu=4):cu=t===yc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,lu=t,ou===null&&(mu=1,pc(e,Pi(t,e.current)))}function Ju(){var e=bo.current;return e===null?!0:(su&4194048)===su?xo===null:(su&62914560)===su||su&536870912?e===xo:!1}function Yu(){var e=v.H;return v.H=tc,e===null?tc:e}function Xu(){var e=v.A;return v.A=nu,e}function Zu(){mu=4,uu||(su&4194048)!==su&&bo.current!==null||(du=!0),!(hu&134217727)&&!(gu&134217727)||au===null||Uu(au,su,vu,!1)}function Qu(e,t,n){var r=iu;iu|=2;var i=Yu(),a=Xu();(au!==e||su!==t)&&(Eu=null,Ku(e,t)),t=!1;var o=mu;a:do try{if(cu!==0&&ou!==null){var s=ou,c=lu;switch(cu){case 8:Gu(),o=6;break a;case 3:case 2:case 9:case 6:bo.current===null&&(t=!0);var l=cu;if(cu=0,lu=null,id(e,s,c,l),n&&du){o=0;break a}break;default:l=cu,cu=0,lu=null,id(e,s,c,l)}}$u(),o=mu;break}catch(t){qu(e,t)}while(1);return t&&e.shellSuspendCounter++,ua=la=null,iu=r,v.H=i,v.A=a,ou===null&&(au=null,su=0,gi()),o}function $u(){for(;ou!==null;)nd(ou)}function ed(e,t){var n=iu;iu|=2;var r=Yu(),a=Xu();au!==e||su!==t?(Eu=null,Tu=He()+500,Ku(e,t)):du=lt(e,t);a:do try{if(cu!==0&&ou!==null){t=ou;var o=lu;b:switch(cu){case 1:cu=0,lu=null,id(e,t,o,1);break;case 2:case 9:if(Ha(o)){cu=0,lu=null,rd(t);break}t=function(){cu!==2&&cu!==9||au!==e||(cu=7),Od(e)},o.then(t,t);break a;case 3:cu=7;break a;case 4:cu=5;break a;case 7:Ha(o)?(cu=0,lu=null,rd(t)):(cu=0,lu=null,id(e,t,o,7));break;case 5:var s=null;switch(ou.tag){case 26:s=ou.memoizedState;case 5:case 27:var c=ou;if(s?fp(s):c.stateNode.complete){cu=0,lu=null;var l=c.sibling;if(l!==null)ou=l;else{var u=c.return;u===null?ou=null:(ou=u,ad(u))}break b}}cu=0,lu=null,id(e,t,o,5);break;case 6:cu=0,lu=null,id(e,t,o,6);break;case 8:Gu(),mu=6;break a;default:throw Error(i(462))}}td();break}catch(t){qu(e,t)}while(1);return ua=la=null,v.H=r,v.A=a,iu=n,ou===null?(au=null,su=0,gi(),mu):0}function td(){for(;ou!==null&&!Be();)nd(ou)}function nd(e){var t=Yc(e.alternate,e,pu);e.memoizedProps=e.pendingProps,t===null?ad(e):ou=t}function rd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Nc(n,t,t.pendingProps,t.type,void 0,su);break;case 11:t=Nc(n,t,t.pendingProps,t.type.render,t.ref,su);break;case 5:Go(t);default:il(n,t),t=ou=Di(t,pu),t=Yc(n,t,pu)}e.memoizedProps=e.pendingProps,t===null?ad(e):ou=t}function id(e,t,n,r){ua=la=null,Go(t),Ja=null,Ya=0;var i=t.return;try{if(vc(e,i,t,n,su)){mu=1,pc(e,Pi(n,e.current)),ou=null;return}}catch(t){if(i!==null)throw ou=i,t;mu=1,pc(e,Pi(n,e.current)),ou=null;return}t.flags&32768?(Zi||r===1?e=!0:du||su&536870912?e=!1:(uu=e=!0,(r===2||r===9||r===3||r===6)&&(r=bo.current,r!==null&&r.tag===13&&(r.flags|=16384))),od(t,e)):ad(t)}function ad(e){var t=e;do{if(t.flags&32768){od(t,uu);return}e=t.return;var n=nl(t.alternate,t,pu);if(n!==null){ou=n;return}if(t=t.sibling,t!==null){ou=t;return}ou=t=e}while(t!==null);mu===0&&(mu=5)}function od(e,t){do{var n=rl(e.alternate,e);if(n!==null){n.flags&=32767,ou=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ou=e;return}ou=e=n}while(e!==null);mu=6,ou=null}function sd(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do fd();while(Ou!==0);if(iu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=hi,mt(e,n,o,s,c,l),e===au&&(ou=au=null,su=0),Au=t,ku=e,ju=n,Mu=o,Nu=a,Pu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,xd(Ke,function(){return pd(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=v.T,v.T=null,a=he.p,he.p=2,s=iu,iu|=4;try{Cl(e,t,n)}finally{iu=s,he.p=a,v.T=r}}Ou=1,cd(),ld(),ud()}}function cd(){if(Ou===1){Ou=0;var e=ku,t=Au,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=v.T,v.T=null;var r=he.p;he.p=2;var i=iu;iu|=4;try{Il(t,e);var a=pf,o=Ur(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Hr(s.ownerDocument.documentElement,s)){if(c!==null&&Wr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var ee=Vr(s,h),_=Vr(s,g);if(ee&&_&&(p.rangeCount!==1||p.anchorNode!==ee.node||p.anchorOffset!==ee.offset||p.focusNode!==_.node||p.focusOffset!==_.offset)){var te=d.createRange();te.setStart(ee.node,ee.offset),p.removeAllRanges(),h>g?(p.addRange(te),p.extend(_.node,_.offset)):(te.setEnd(_.node,_.offset),p.addRange(te))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var ne=d[s];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}kp=!!ff,pf=ff=null}finally{iu=i,he.p=r,v.T=n}}e.current=t,Ou=2}}function ld(){if(Ou===2){Ou=0;var e=ku,t=Au,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=v.T,v.T=null;var r=he.p;he.p=2;var i=iu;iu|=4;try{wl(e,t.alternate,t)}finally{iu=i,he.p=r,v.T=n}}Ou=3}}function ud(){if(Ou===4||Ou===3){Ou=0,Ve();var e=ku,t=Au,n=ju,r=Pu;t.subtreeFlags&10256||t.flags&10256?Ou=5:(Ou=0,Au=ku=null,dd(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Du=null),yt(n),t=t.stateNode,Qe&&typeof Qe.onCommitFiberRoot==`function`)try{Qe.onCommitFiberRoot(Ze,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=v.T,i=he.p,he.p=2,v.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{v.T=t,he.p=i}}ju&3&&fd(),Od(e),i=e.pendingLanes,n&261930&&i&42?e===Iu?Fu++:(Fu=0,Iu=e):Fu=0,kd(0,!1)}}function dd(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ta(t)))}function fd(){return cd(),ld(),ud(),pd()}function pd(){if(Ou!==5)return!1;var e=ku,t=Mu;Mu=0;var n=yt(ju),r=v.T,a=he.p;try{he.p=32>n?32:n,v.T=null,n=Nu,Nu=null;var o=ku,s=ju;if(Ou=0,Au=ku=null,ju=0,iu&6)throw Error(i(331));var c=iu;if(iu|=4,$l(o.current),Gl(o,o.current,s,n),iu=c,kd(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot==`function`)try{Qe.onPostCommitFiberRoot(Ze,o)}catch{}return!0}finally{he.p=a,v.T=r,dd(e,t)}}function md(e,t,n){t=Pi(n,t),t=hc(e.stateNode,t,2),e=oo(e,t,2),e!==null&&(pt(e,2),Od(e))}function hd(e,t,n){if(e.tag===3)md(e,e,n);else for(;t!==null;){if(t.tag===3){md(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Du===null||!Du.has(r))){e=Pi(n,e),n=gc(2),r=oo(t,n,2),r!==null&&(_c(n,r,t,e),pt(r,2),Od(r));break}}t=t.return}}function gd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ru;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)||(fu=!0,i.add(n),e=_d.bind(null,e,t,n),t.then(e,e))}function _d(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,au===e&&(su&n)===n&&(mu===4||mu===3&&(su&62914560)===su&&300>He()-Cu?!(iu&2)&&Ku(e,0):_u|=n,yu===su&&(yu=0)),Od(e)}function vd(e,t){t===0&&(t=dt()),e=yi(e,t),e!==null&&(pt(e,t),Od(e))}function yd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vd(e,n)}function bd(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),vd(e,n)}function xd(e,t){return Re(e,t)}var Sd=null,Cd=null,wd=!1,Td=!1,Ed=!1,Dd=0;function Od(e){e!==Cd&&e.next===null&&(Cd===null?Sd=Cd=e:Cd=Cd.next=e),Td=!0,wd||(wd=!0,Fd())}function kd(e,t){if(!Ed&&Td){Ed=!0;do for(var n=!1,r=Sd;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-et(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Pd(r,a))}else a=su,a=ct(r,r===au?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||lt(r,a)||(n=!0,Pd(r,a))}r=r.next}while(n);Ed=!1}}function Ad(){jd()}function jd(){Td=wd=!1;var e=0;Dd!==0&&yf()&&(e=Dd);for(var t=He(),n=null,r=Sd;r!==null;){var i=r.next,a=Md(r,t);a===0?(r.next=null,n===null?Sd=i:n.next=i,i===null&&(Cd=n)):(n=r,(e!==0||a&3)&&(Td=!0)),r=i}Ou!==0&&Ou!==5||kd(e,!1),Dd!==0&&(Dd=0)}function Md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-et(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ut(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=au,n=su,n=ct(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(cu===2||cu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ze(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||lt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ze(r),yt(n)){case 2:case 8:n=Ge;break;case 32:n=Ke;break;case 268435456:n=Je;break;default:n=Ke}return r=Nd.bind(null,e),n=Re(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ze(r),e.callbackPriority=2,e.callbackNode=null,2}function Nd(e,t){if(Ou!==0&&Ou!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(fd()&&e.callbackNode!==n)return null;var r=su;return r=ct(e,e===au?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Bu(e,r,t),Md(e,He()),e.callbackNode!=null&&e.callbackNode===n?Nd.bind(null,e):null)}function Pd(e,t){if(fd())return null;Bu(e,t,!0)}function Fd(){Cf(function(){iu&6?Re(We,Ad):jd()})}function Id(){if(Dd===0){var e=Oa;e===0&&(e=it,it<<=1,!(it&261888)&&(it=256)),Dd=e}return Dd}function Ld(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:hn(``+e)}function Rd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function zd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ld((i[y]||null).action),o=r.submitter;o&&(t=(t=o[y]||null)?Ld(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Ln(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Dd!==0){var e=o?Rd(i,o):new FormData(i);Vs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Rd(i,o):new FormData(i),Vs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Bd=0;Bd<ui.length;Bd++){var Vd=ui[Bd];di(Vd.toLowerCase(),`on`+(Vd[0].toUpperCase()+Vd.slice(1)))}di(ni,`onAnimationEnd`),di(ri,`onAnimationIteration`),di(ii,`onAnimationStart`),di(`dblclick`,`onDoubleClick`),di(`focusin`,`onFocus`),di(`focusout`,`onBlur`),di(ai,`onTransitionRun`),di(oi,`onTransitionStart`),di(si,`onTransitionCancel`),di(ci,`onTransitionEnd`),zt(`onMouseEnter`,[`mouseout`,`mouseover`]),zt(`onMouseLeave`,[`mouseout`,`mouseover`]),zt(`onPointerEnter`,[`pointerout`,`pointerover`]),zt(`onPointerLeave`,[`pointerout`,`pointerover`]),Rt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Rt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Rt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Rt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Rt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Rt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Hd=`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(` `),Ud=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Hd));function Wd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){fi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){fi(e)}i.currentTarget=null,a=c}}}}function Gd(e,t){var n=t[Tt];n===void 0&&(n=t[Tt]=new Set);var r=e+`__bubble`;n.has(r)||(Yd(t,e,2,!1),n.add(r))}function Kd(e,t,n){var r=0;t&&(r|=4),Yd(n,e,r,t)}var qd=`_reactListening`+Math.random().toString(36).slice(2);function Jd(e){if(!e[qd]){e[qd]=!0,It.forEach(function(t){t!==`selectionchange`&&(Ud.has(t)||Kd(t,!1,e),Kd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qd]||(t[qd]=!0,Kd(`selectionchange`,!1,t))}}function Yd(e,t,n,r){switch(Ip(t)){case 2:var i=Ap;break;case 8:i=jp;break;default:i=Mp}n=i.bind(null,t,n,e),i=void 0,!En||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Xd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=jt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Cn(function(){var r=a,i=vn(n),s=[];a:{var c=li.get(e);if(c!==void 0){var l=Ln,u=e;switch(e){case`keypress`:if(Mn(n)===0)break a;case`keydown`:case`keyup`:l=tr;break;case`focusin`:u=`focus`,l=Kn;break;case`focusout`:u=`blur`,l=Kn;break;case`beforeblur`:case`afterblur`:l=Kn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Gn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=rr;break;case ni:case ri:case ii:l=qn;break;case ci:l=ir;break;case`scroll`:case`scrollend`:l=zn;break;case`wheel`:l=ar;break;case`copy`:case`cut`:case`paste`:l=Jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=nr;break;case`toggle`:case`beforetoggle`:l=or}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=wn(m,p),g!=null&&d.push(Zd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==_n&&(u=n.relatedTarget||n.fromElement)&&(jt(u)||u[wt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?jt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=nr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:Nt(l),h=u==null?c:Nt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,jt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=$d,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var ee=m;ee;ee=d(ee))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&ef(s,c,l,d,!1),u!==null&&f!==null&&ef(s,f,u,d,!0)}}a:{if(c=r?Nt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Er;else if(br(c)){if(Dr)_=Ir;else{_=Pr;var te=Nr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&fn(r.elementType)&&(_=Er):_=Fr;if(_&&=_(e,r)){xr(s,_,n,i);break a}te&&te(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&rn(c,`number`,c.value)}switch(te=r?Nt(r):window,e){case`focusin`:(br(te)||te.contentEditable===`true`)&&(Kr=te,qr=r,Jr=null);break;case`focusout`:Jr=qr=Kr=null;break;case`mousedown`:Yr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Yr=!1,Xr(s,n,i);break;case`selectionchange`:if(Gr)break;case`keydown`:case`keyup`:Xr(s,n,i)}var ne;if(cr)b:{switch(e){case`compositionstart`:var re=`onCompositionStart`;break b;case`compositionend`:re=`onCompositionEnd`;break b;case`compositionupdate`:re=`onCompositionUpdate`;break b}re=void 0}else gr?mr(e,n)&&(re=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(re=`onCompositionStart`);re&&(dr&&n.locale!==`ko`&&(gr||re!==`onCompositionStart`?re===`onCompositionEnd`&&gr&&(ne=jn()):(On=i,kn=`value`in On?On.value:On.textContent,gr=!0)),te=Qd(r,re),0<te.length&&(re=new Yn(re,e,null,n,i),s.push({event:re,listeners:te}),ne?re.data=ne:(ne=hr(n),ne!==null&&(re.data=ne)))),(ne=ur?_r(e,n):vr(e,n))&&(re=Qd(r,`onBeforeInput`),0<re.length&&(te=new Yn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:te,listeners:re}),te.data=ne)),zd(s,e,r,n,i)}Wd(s,t)})}function Zd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=wn(e,n),i!=null&&r.unshift(Zd(e,i,a)),i=wn(e,t),i!=null&&r.push(Zd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function $d(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ef(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=wn(n,a),l!=null&&o.unshift(Zd(n,l,c))):i||(l=wn(n,a),l!=null&&o.push(Zd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var tf=/\r\n?/g,nf=/\u0000|\uFFFD/g;function rf(e){return(typeof e==`string`?e:``+e).replace(tf,`
|
|
30
|
+
`).replace(nf,``)}function af(e,t){return t=rf(t),rf(e)===t}function of(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||cn(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&cn(e,``+r);break;case`className`:Gt(e,`class`,r);break;case`tabIndex`:Gt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Gt(e,n,r);break;case`style`:dn(e,r,o);break;case`data`:if(t!==`object`){Gt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=hn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&of(e,t,`name`,a.name,a,null),of(e,t,`formEncType`,a.formEncType,a,null),of(e,t,`formMethod`,a.formMethod,a,null),of(e,t,`formTarget`,a.formTarget,a,null)):(of(e,t,`encType`,a.encType,a,null),of(e,t,`method`,a.method,a,null),of(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=hn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=gn);break;case`onScroll`:r!=null&&Gd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Gd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=hn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Gd(`beforetoggle`,e),Gd(`toggle`,e),Wt(e,`popover`,r);break;case`xlinkActuate`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Wt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=pn.get(n)||n,Wt(e,n,r))}}function sf(e,t,n,r,a,o){switch(n){case`style`:dn(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?cn(e,r):(typeof r==`number`||typeof r==`bigint`)&&cn(e,``+r);break;case`onScroll`:r!=null&&Gd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Gd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=gn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Lt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[y]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Wt(e,n,r)}}}function cf(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Gd(`error`,e),Gd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:of(e,t,o,s,n,null)}}a&&of(e,t,`srcSet`,n.srcSet,n,null),r&&of(e,t,`src`,n.src,n,null);return;case`input`:Gd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:of(e,t,r,d,n,null)}}nn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Gd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:of(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&an(e,!!r,n,!0):an(e,!!r,t,!1);return;case`textarea`:for(s in Gd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:of(e,t,s,c,n,null)}sn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:of(e,t,l,r,n,null)}return;case`dialog`:Gd(`beforetoggle`,e),Gd(`toggle`,e),Gd(`cancel`,e),Gd(`close`,e);break;case`iframe`:case`object`:Gd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Hd.length;r++)Gd(Hd[r],e);break;case`image`:Gd(`error`,e),Gd(`load`,e);break;case`details`:Gd(`toggle`,e);break;case`embed`:case`source`:case`link`:Gd(`error`,e),Gd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:of(e,t,u,r,n,null)}return;default:if(fn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&sf(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&of(e,t,c,r,n,null))}function lf(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||of(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&of(e,t,p,m,r,f)}}tn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||of(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&of(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?an(e,!!n,n?[]:``,!1):an(e,!!n,t,!0)):an(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:of(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&of(e,t,s,a,r,o)}on(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:of(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:of(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&of(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:of(e,t,u,p,r,m)}return;default:if(fn(t)){for(var ee in n)p=n[ee],n.hasOwnProperty(ee)&&p!==void 0&&!r.hasOwnProperty(ee)&&sf(e,t,ee,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||sf(e,t,d,p,r,m);return}}for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!=null&&!r.hasOwnProperty(_)&&of(e,t,_,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||of(e,t,f,p,r,m)}function uf(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function df(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&uf(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&uf(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var ff=null,pf=null;function mf(e){return e.nodeType===9?e:e.ownerDocument}function hf(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function gf(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function _f(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vf=null;function yf(){var e=window.event;return e&&e.type===`popstate`?e!==vf&&(vf=e,!0):(vf=null,!1)}var bf=typeof setTimeout==`function`?setTimeout:void 0,xf=typeof clearTimeout==`function`?clearTimeout:void 0,Sf=typeof Promise==`function`?Promise:void 0,Cf=typeof queueMicrotask==`function`?queueMicrotask:Sf===void 0?bf:function(e){return Sf.resolve(null).then(e).catch(wf)};function wf(e){setTimeout(function(){throw e})}function Tf(e){return e===`head`}function Ef(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===`/$`||n===`/&`){if(r===0){e.removeChild(i),tm(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Lf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Lf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[kt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Lf(e.ownerDocument.body)}n=i}while(n);tm(t)}function Df(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Of(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:Of(n),At(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function w(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[kt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=E(e.nextSibling),e===null)break}return null}function kf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=E(e.nextSibling),e===null))return null;return e}function T(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=E(e.nextSibling),e===null))return null;return e}function Af(e){return e.data===`$?`||e.data===`$~`}function jf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Mf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function E(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Nf=null;function Pf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return E(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Ff(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function If(e,t,n){switch(t=mf(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Lf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);At(e)}var D=new Map,Rf=new Set;function zf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Bf=he.d;he.d={f:Vf,r:O,D:Wf,C:Gf,L:Kf,m:qf,X:Yf,S:Jf,M:Xf};function Vf(){var e=Bf.f(),t=Wu();return e||t}function O(e){var t=Mt(e);t!==null&&t.tag===5&&t.type===`form`?Us(t):Bf.r(e)}var Hf=typeof document>`u`?null:document;function Uf(e,t,n){var r=Hf;if(r&&typeof t==`string`&&t){var i=en(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Rf.has(i)||(Rf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),cf(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function Wf(e){Bf.D(e),Uf(`dns-prefetch`,e,null)}function Gf(e,t){Bf.C(e,t),Uf(`preconnect`,e,t)}function Kf(e,t,n){Bf.L(e,t,n);var r=Hf;if(r&&e&&t){var i=`link[rel="preload"][as="`+en(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+en(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+en(n.imageSizes)+`"]`)):i+=`[href="`+en(e)+`"]`;var a=i;switch(t){case`style`:a=Qf(e);break;case`script`:a=np(e)}D.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),D.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector($f(a))||t===`script`&&r.querySelector(rp(a))||(t=r.createElement(`link`),cf(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function qf(e,t){Bf.m(e,t);var n=Hf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+en(r)+`"][href="`+en(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=np(e)}if(!D.has(a)&&(e=f({rel:`modulepreload`,href:e},t),D.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(rp(a)))return}r=n.createElement(`link`),cf(r,`link`,e),Ft(r),n.head.appendChild(r)}}}function Jf(e,t,n){Bf.S(e,t,n);var r=Hf;if(r&&e){var i=Pt(r).hoistableStyles,a=Qf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector($f(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=D.get(a))&&op(e,n);var c=o=r.createElement(`link`);Ft(c),cf(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,ap(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Yf(e,t){Bf.X(e,t);var n=Hf;if(n&&e){var r=Pt(n).hoistableScripts,i=np(e),a=r.get(i);a||(a=n.querySelector(rp(i)),a||(e=f({src:e,async:!0},t),(t=D.get(i))&&sp(e,t),a=n.createElement(`script`),Ft(a),cf(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Xf(e,t){Bf.M(e,t);var n=Hf;if(n&&e){var r=Pt(n).hoistableScripts,i=np(e),a=r.get(i);a||(a=n.querySelector(rp(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=D.get(i))&&sp(e,t),a=n.createElement(`script`),Ft(a),cf(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Zf(e,t,n,r){var a=(a=we.current)?zf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Qf(n.href),n=Pt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Qf(n.href);var o=Pt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector($f(e)))&&!o._p&&(s.instance=o,s.state.loading=5),D.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},D.set(e,n),o||tp(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=np(n),n=Pt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Qf(e){return`href="`+en(e)+`"`}function $f(e){return`link[rel="stylesheet"][`+e+`]`}function ep(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function tp(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),cf(t,`link`,n),Ft(t),e.head.appendChild(t))}function np(e){return`[src="`+en(e)+`"]`}function rp(e){return`script[async]`+e}function ip(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+en(n.href)+`"]`);if(r)return t.instance=r,Ft(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ft(r),cf(r,`style`,a),ap(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Qf(n.href);var o=e.querySelector($f(a));if(o)return t.state.loading|=4,t.instance=o,Ft(o),o;r=ep(n),(a=D.get(a))&&op(r,a),o=(e.ownerDocument||e).createElement(`link`),Ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),cf(o,`link`,r),t.state.loading|=4,ap(o,n.precedence,e),t.instance=o;case`script`:return o=np(n.src),(a=e.querySelector(rp(o)))?(t.instance=a,Ft(a),a):(r=n,(a=D.get(o))&&(r=f({},n),sp(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ft(a),cf(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,ap(r,n.precedence,e));return t.instance}function ap(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function op(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function sp(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var cp=null;function lp(e,t,n){if(cp===null){var r=new Map,i=cp=new Map;i.set(n,r)}else i=cp,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[kt]||a[Ct]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function up(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function dp(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function fp(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function pp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Qf(r.href),a=t.querySelector($f(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=gp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ft(a);return}a=t.ownerDocument||t,r=ep(r),(i=D.get(i))&&op(r,i),a=a.createElement(`link`),Ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),cf(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=gp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var mp=0;function hp(e,t){return e.stylesheets&&e.count===0&&vp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&vp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&mp===0&&(mp=62500*df());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&vp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>mp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function gp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)vp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var _p=null;function vp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,_p=new Map,t.forEach(yp,e),_p=null,gp.call(e))}function yp(e,t){if(!(t.state.loading&4)){var n=_p.get(e);if(n)var r=n.get(null);else{n=new Map,_p.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=gp.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var bp={$$typeof:ne,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function xp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ft(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ft(0),this.hiddenUpdates=ft(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Sp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new xp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=wi(3,null,null,t),e.current=a,a.stateNode=e,t=wa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ro(a),e}function Cp(e){return e?(e=Si,e):Si}function wp(e,t,n,r,i,a){i=Cp(i),r.context===null?r.context=i:r.pendingContext=i,r=ao(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=oo(e,r,t),n!==null&&(zu(n,e,t),so(n,e,t))}function Tp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ep(e,t){Tp(e,t),(e=e.alternate)&&Tp(e,t)}function Dp(e){if(e.tag===13||e.tag===31){var t=yi(e,67108864);t!==null&&zu(t,e,67108864),Ep(e,67108864)}}function Op(e){if(e.tag===13||e.tag===31){var t=Lu();t=vt(t);var n=yi(e,t);n!==null&&zu(n,e,t),Ep(e,t)}}var kp=!0;function Ap(e,t,n,r){var i=v.T;v.T=null;var a=he.p;try{he.p=2,Mp(e,t,n,r)}finally{he.p=a,v.T=i}}function jp(e,t,n,r){var i=v.T;v.T=null;var a=he.p;try{he.p=8,Mp(e,t,n,r)}finally{he.p=a,v.T=i}}function Mp(e,t,n,r){if(kp){var i=Np(r);if(i===null)Xd(e,t,r,Pp,n),Gp(e,r);else if(qp(i,e,t,n,r))r.stopPropagation();else if(Gp(e,r),t&4&&-1<Wp.indexOf(e)){for(;i!==null;){var a=Mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=st(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-et(o);s.entanglements[1]|=c,o&=~c}Od(a),!(iu&6)&&(Tu=He()+500,kd(0,!1))}}break;case 31:case 13:s=yi(a,2),s!==null&&zu(s,a,2),Wu(),Ep(a,2)}if(a=Np(r),a===null&&Xd(e,t,r,Pp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Xd(e,t,r,null,n)}}function Np(e){return e=vn(e),Fp(e)}var Pp=null;function Fp(e){if(Pp=null,e=jt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 Pp=e,null}function Ip(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ue()){case We:return 2;case Ge:return 8;case Ke:case qe:return 32;case Je:return 268435456;default:return 32}default:return 32}}var Lp=!1,Rp=null,zp=null,Bp=null,Vp=new Map,Hp=new Map,Up=[],Wp=`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`.split(` `);function Gp(e,t){switch(e){case`focusin`:case`focusout`:Rp=null;break;case`dragenter`:case`dragleave`:zp=null;break;case`mouseover`:case`mouseout`:Bp=null;break;case`pointerover`:case`pointerout`:Vp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Hp.delete(t.pointerId)}}function Kp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Mt(t),t!==null&&Dp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function qp(e,t,n,r,i){switch(t){case`focusin`:return Rp=Kp(Rp,e,t,n,r,i),!0;case`dragenter`:return zp=Kp(zp,e,t,n,r,i),!0;case`mouseover`:return Bp=Kp(Bp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Vp.set(a,Kp(Vp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Hp.set(a,Kp(Hp.get(a)||null,e,t,n,r,i)),!0}return!1}function Jp(e){var t=jt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,xt(e.priority,function(){Op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,xt(e.priority,function(){Op(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 Yp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Np(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);_n=r,n.target.dispatchEvent(r),_n=null}else return t=Mt(n),t!==null&&Dp(t),e.blockedOn=n,!1;t.shift()}return!0}function Xp(e,t,n){Yp(e)&&n.delete(t)}function Zp(){Lp=!1,Rp!==null&&Yp(Rp)&&(Rp=null),zp!==null&&Yp(zp)&&(zp=null),Bp!==null&&Yp(Bp)&&(Bp=null),Vp.forEach(Xp),Hp.forEach(Xp)}function Qp(e,n){e.blockedOn===n&&(e.blockedOn=null,Lp||(Lp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Zp)))}var $p=null;function em(e){$p!==e&&($p=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){$p===e&&($p=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Fp(r||n)===null)continue;break}var a=Mt(n);a!==null&&(e.splice(t,3),t-=3,Vs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function tm(e){function t(t){return Qp(t,e)}Rp!==null&&Qp(Rp,e),zp!==null&&Qp(zp,e),Bp!==null&&Qp(Bp,e),Vp.forEach(t),Hp.forEach(t);for(var n=0;n<Up.length;n++){var r=Up[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Up.length&&(n=Up[0],n.blockedOn===null);)Jp(n),n.blockedOn===null&&Up.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[y]||null;if(typeof a==`function`)o||em(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[y]||null)s=o.formAction;else if(Fp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),em(n)}}}function nm(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function rm(e){this._internalRoot=e}im.prototype.render=rm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;wp(n,Lu(),e,t,null,null)},im.prototype.unmount=rm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wp(e.current,2,null,e,null,null),Wu(),t[wt]=null}};function im(e){this._internalRoot=e}im.prototype.unstable_scheduleHydration=function(e){if(e){var t=bt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Up.length&&t!==0&&t<Up[n].priority;n++);Up.splice(n,0,e),n===0&&Jp(e)}};var am=n.version;if(am!==`19.2.3`)throw Error(i(527,am,`19.2.3`));he.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var om={bundleType:0,version:`19.2.3`,rendererPackageName:`react-dom`,currentDispatcherRef:v,reconcilerVersion:`19.2.3`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var sm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sm.isDisabled&&sm.supportsFiber)try{Ze=sm.inject(om),Qe=sm}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=uc,s=dc,c=fc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Sp(e,1,!1,null,null,n,r,null,o,s,c,nm),e[wt]=t.current,Jd(e),new rm(t)}})),bje=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=yje()}))(),xje=({errorId:e,onSubmit:t})=>{let[n,r]=(0,Q.useState)(``),i=(0,Q.useId)();return(0,$.jsxs)(`form`,{className:`sign-in-form`,onSubmit:e=>{e.preventDefault(),t(n),r(``)},children:[(0,$.jsxs)(`p`,{children:[`Paste the sign-in link that `,(0,$.jsx)(`code`,{children:`maia panel open`}),` printed.`]}),(0,$.jsx)(`label`,{htmlFor:i,children:`Sign-in link or code`}),(0,$.jsx)(`input`,{"aria-describedby":e,"aria-invalid":e!==void 0||void 0,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,id:i,onChange:e=>{r(e.target.value)},required:!0,spellCheck:!1,type:`text`,value:n}),(0,$.jsx)(`button`,{type:`submit`,children:`Sign in`})]})},Sje={refused:`The Node did not accept this sign-in link. A link works once, and only for a short time.`,"signed-out":`This page has no session with the Node, or its session ended.`,starting:`Signing in to this Node…`},Cje=`Revocation unconfirmed: this page is signed out, but the Node did not confirm it ended the session. The Node ends it when it expires.`,wje=({onSubmit:e,state:t,unconfirmed:n})=>{let r=(0,Q.useId)();return(0,$.jsx)(`main`,{className:`shell-main sign-in-page`,id:`main`,children:(0,$.jsxs)(`section`,{className:`notice`,"data-state":t,children:[(0,$.jsx)(`h1`,{children:t===`starting`?`Signing in`:`Sign in again`}),(0,$.jsx)(`p`,{id:r,role:t===`refused`?`alert`:void 0,children:Sje[t]},t),t===`signed-out`&&n?(0,$.jsx)(`p`,{role:`status`,children:Cje}):null,t===`starting`?null:(0,$.jsx)(xje,{onSubmit:e,...t===`refused`?{errorId:r}:{}})]})})},Tje=()=>{},Eje={current:()=>!1,subscribe:()=>Tje},Dje=({children:e,onSubmit:t,status:n,unconfirmedSignOut:r=Eje})=>{let i=(0,Q.useSyncExternalStore)(n.subscribe,n.current,n.current),a=(0,Q.useSyncExternalStore)(r.subscribe,r.current,r.current);return i===`signed-in`?e:(0,$.jsx)(wje,{onSubmit:t,state:i,unconfirmed:a})},Oje={agents:[`#386`],routines:[`#386`]},Y9=document.querySelector(`#root`);if(!(Y9 instanceof HTMLElement))throw TypeError(`The panel page has no #root element.`);var X9=(()=>{try{return window.sessionStorage}catch{return}})(),Z9=Gxe(),kje=Lme({onSignedOut:()=>{f5(X9),Z9.set(`signed-out`)},origin:window.location.origin,session:()=>ur(d5(X9))}),Q9={location:window.location,...X9===void 0?{}:{storage:X9}},$9=(()=>{let e=!1,t=new Set,n=n=>{n!==e&&(e=n,t.forEach(e=>{e()}))};return Z9.subscribe(()=>{Z9.current()===`signed-in`&&n(!1)}),{current:()=>e,set:n,subscribe:e=>(t.add(e),()=>{t.delete(e)})}})();(0,bje.createRoot)(Y9).render((0,$.jsx)(Dje,{onSubmit:e=>{Mp(Uxe(Z9,Q9,e))},status:Z9,unconfirmedSignOut:$9,children:(0,$.jsx)(bCe,{identity:{label:`This Node`},references:Oje,transport:kje,children:(0,$.jsx)(mje,{signOut:()=>Ip(Wxe(Z9,Q9).pipe(O(e=>{$9.set(e===`unconfirmed`)})))})})})),Mp(Hxe({...Q9,replaceAddress:e=>{window.history.replaceState(window.history.state,``,e)}}).pipe(O(e=>{Z9.set(e)})));
|