@maiaos/node 0.1.0-canary.7 → 0.1.0-canary.71
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/LICENSE +21 -0
- package/README.md +27 -14
- package/dist/bin/maia-node-main.mjs +11895 -0
- package/dist/bin/maia-node-main.mjs.map +6 -0
- package/dist/bin/maia-node.NOTICES.txt +375 -13
- package/dist/bin/maia-node.cdx.json +308 -92
- package/dist/bin/maia-node.meta.json +1 -1
- package/dist/bin/maia-node.mjs +67 -9009
- package/dist/bin/maia-node.release.json +44 -42
- package/dist/bin/maia-process-host-linux-x64 +0 -0
- package/dist/bin/maia-process-host-linux-x64.build.json +6 -6
- package/dist/bin/maia-web.release.digest.json +1 -0
- package/dist/bin/panel/assets/index-BNBmo2IU.js +30 -0
- package/dist/bin/panel/assets/index-JMSUmGQv.css +1 -0
- package/dist/bin/panel/index.html +14 -0
- package/package.json +10 -9
- package/dist/bin/maia-node.mjs.map +0 -6
- package/dist/bin/maia-process-host-darwin-arm64 +0 -0
- package/dist/bin/maia-process-host-darwin-arm64.build.json +0 -59
|
@@ -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)&&um(this,e)===0},toString(){return`BigDecimal(${tee(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`))},um=(e,t)=>{if(e.scale===t.scale)return cm(e.value,t.value);let n=dm(e),r=dm(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)},dm=e=>e.value===nm?0:e.value<nm?-1:1,tee=e=>{let t=om(e);if(Math.abs(t.scale)>=16)return fm(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},fm=e=>{if(pm(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}`},pm=e=>e.value===nm,mm=Id,nee=Ld,hm=zd,gm=Vd,_m=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,vm=new Uint8Array(123).fill(255);for(let e=0;e<64;e++)vm[_m.charCodeAt(e)]=e;vm[61]=0;var ym=`~effect/http/Cookies`,bm=`~effect/http/Cookies/Cookie`,xm={[ym]:ym,...dt,toJSON(){return{_id:`effect/Cookies`,cookies:ci(this.cookies,e=>e.toJSON())}},pipe(){return t(this,arguments)}},Sm=e=>{let t=Object.create(xm);return t.cookies=e,t},Cm=e=>{let t={};for(let n of e)vt(t,n.name,n);return Sm(t)},ree=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=iee(e.trim());t&&n.push(t)}return Cm(n)};function iee(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(!aee.test(r))return;let i=t[0].slice(n+1),a=oee(i);if(t.length===1)return Object.assign(Object.create(wm),{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(wm),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var aee=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,wm={[bm]:bm,...dt,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},oee=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(Om);return t?.label&&(n.label=t.label),Tm.set(n,e),n},Om={[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))}},km=Symbol.for(`~effect/http/Headers`),Am=Object.defineProperties(Object.create(null),{[km]:{value:km},[qe]:{value(e){return uee(this,Br(e,zm))}},toJSON:{value(){return Ye(this)}},[je]:{value(e){return Mm(this,e)}},[pe]:{value(){return Se(this)}},toString:{value:dt.toString},[ct]:{value:dt[ct]}}),jm=e=>Object.assign(Object.create(Am),e),Mm=di(Sn()),Nm=Object.create(Am),Pm=e=>{if(e===void 0)return Nm;if(Symbol.iterator in e){let t=Object.create(Am);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(Am);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},Fm=e=>Object.setPrototypeOf(e,Am),Im=i(3,(e,t,n)=>{let r=jm(e);return r[t.toLowerCase()]=n,r}),cee=i(2,(e,t)=>jm({...e,...Pm(t)})),lee=i(2,(e,t)=>{let n=jm(e);return Object.assign(n,t),n}),Lm=i(2,(e,t)=>{let n=jm(e);return delete n[t.toLowerCase()],n}),uee=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}),Rm=(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},zm=Kr(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),Bm=`~effect/http/UrlParams`,dee=e=>de(e,Bm),fee={...kt,[Bm]:Bm,[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(fee);return t.params=e,t},Hm=e=>{if(dee(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([]),gee=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 Wm(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Gm(e){return t=>Wm(t)?.[e]}var Km=`~structural`,qm=`~identifier`,Jm=`~sentinels`,Ym=`~constructor`,Xm=[`title`,`description`,`default`,`examples`,`readOnly`,`writeOnly`,`format`,`contentEncoding`,`contentMediaType`,`contentSchema`],Zm=Gm(`identifier`),Qm=Gm(qm),$m=d(e=>{let t=Wm(e)?.identifier;return typeof t==`string`?t:e.getExpected($m)}),eh=new Set([Jm,Km,`representation`,`arbitraryConstraint`,`toJsonSchema`,`toCode`,`toEquivalence`,`toFormatter`,`toCodec`,`toCodecJson`,`toCodecStringTree`,`toCodecIso`,`toCodecArbitrary`]),th=Symbol(),nh=Nu,rh=nh(th),ih=nh(th),ah=e=>e===th?nr():rr(e),oh=e=>e._tag===`None`?rh:nh(e.value),sh=`~effect/SchemaIssue/Issue`;function ch(e){return de(e,sh)&&e[sh]===sh}function _ee(e){return Object.hasOwn(e,`input`)}var lh=class{[sh]=sh;constructor(e,t){t?.reportInput===!0&&e!==th&&(this.input=e)}},vee=class extends lh{_tag=`Filter`;filter;issue;constructor(e,t,n,r){super(n,r),this.filter=e,this.issue=t}},yee=class extends lh{_tag=`Encoding`;ast;issue;constructor(e,t,n,r){super(n,r),this.ast=e,this.issue=t}},uh=class extends lh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},dh=class extends lh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},fh=class extends lh{_tag=`UnexpectedKey`;ast;constructor(e,t,n){super(t,n),this.ast=e}},ph=class extends lh{_tag=`Composite`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},mh=class extends lh{_tag=`InvalidType`;ast;constructor(e,t,n){super(t,n),this.ast=e}},hh=class extends lh{_tag=`InvalidValue`;annotations;constructor(e,t,n){super(t,n),this.annotations=e}},gh=class extends lh{_tag=`AnyOf`;ast;issues;constructor(e,t,n,r){super(n,r),this.ast=e,this.issues=t}},bee=class extends lh{_tag=`OneOf`;ast;successes;constructor(e,t,n,r){super(n,r),this.ast=e,this.successes=t}};function _h(e,t,n){if(ch(e))return e;if(typeof e==`string`)return new hh({message:e},t,n);let r=typeof e.issue==`string`?new hh({message:e.issue},t,n):e.issue;return new uh(e.path,r)}function xee(e,t,n){if(e!==void 0)return typeof e==`boolean`?e?void 0:new hh(void 0,t,n):_h(e,t,n)}function See(e,t,n,r){return Array.isArray(t)?gi(t)?t.length===1?_h(t[0],n,r):new ph(e,bi(t,e=>_h(e,n,r)),n,r):void 0:xee(t,n,r)}var vh=e=>{let t=Oh(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Sh($m(e.ast),e);case`InvalidValue`:{let t=xh(e);if(t!==void 0)return Sh(t,e);let n=bh(e);return n===void 0?`Expected a valid value`:`Invalid data ${n}`}case`MissingKey`:return`Missing key`;case`UnexpectedKey`:{let t=bh(e);return t===void 0?`Expected no excess property`:`Unexpected key with value ${t}`}case`Forbidden`:return`Forbidden operation`;case`OneOf`:{let t=bh(e);return t===void 0?`Expected exactly one member to match`:`Expected exactly one member to match the input ${t}`}}},yh=e=>Oh(e.issue)??Oh(e);function Cee(e){return t=>({issues:Ch(t,[],e?.leafHook??vh,e?.checkHook??yh)})}function bh(e){return _ee(e)?et(e.input):void 0}function xh(e){let t=e.annotations?.expected;return typeof t==`string`?t:void 0}function Sh(e,t){let n=bh(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function Ch(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 Ch(e.issue,t,n,r);let a=xh(e.issue);return[{path:t,message:a===void 0?Sh(wh(e.filter),e):Sh(a,e.issue)}]}case`Encoding`:return Ch(e.issue,t,n,r);case`Pointer`:return Ch(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Ch(e,t,n,r));case`AnyOf`:return e.issues.length===0?[{path:t,message:Oh(e)??Sh($m(e.ast),e)}]:e.issues.flatMap(e=>Ch(e,t,n,r));default:return[{path:t,message:n(e)}]}}function wh(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=>wh(e)).join(` & `)}}function Th(){return e=>Dh(e,``)}var Eh=Th();function Dh(e,t){let n;switch(e._tag){case`Filter`:{let r=yh(e);if(r!==void 0)n=r;else{if(e.issue._tag!==`InvalidValue`)return Dh(e.issue,t);let r=xh(e.issue);n=r===void 0?Sh(wh(e.filter),e):Sh(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)??Sh($m(e.ast),e);break;default:n=vh(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)||!ch(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 hh({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 hh({expected:`a JSON-serializable value`},t,n)}))}var wee=class extends r{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new wee(this.encode,this.decode)}},Vh=`~effect/SchemaTransformation/Transformation`,Hh=class extends r{[Vh]=Vh;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Hh(this.encode,this.decode)}};function Tee(e){return de(e,Vh)&&e[Vh]===Vh}var Eee=e=>Tee(e)?e:new Hh(e.decode,e.encode);function Dee(e){return new Hh(Ph(e.decode),Ph(e.encode))}function Oee(){return new Hh(Rh(),Nh())}var kee=new Hh(Nh(),Nh());function Uh(){return kee}var Wh=new Hh(Lh(),Ih());function Aee(e){return new Hh(zh(e??{}),Bh(e))}function Gh(e){return t=>t._tag===e}var Kh=Gh(`Declaration`),jee=Gh(`Never`),qh=Gh(`Literal`),Jh=Gh(`UniqueSymbol`),Mee=Gh(`Arrays`),Nee=Gh(`Objects`),Yh=Gh(`Suspend`),Xh=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Zh={},Qh=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}},$h=`~effect/Schema`,eg=class{[$h]=$h;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}>`}},tg=class extends eg{_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===th?rh:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,r,i){let a=s_(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new tg(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>`}},ng=new class extends eg{_tag=`Null`;getParser(){return h_(this,null)}getExpected(){return`null`}},Pee=class extends eg{_tag=`Undefined`;getParser(){return h_(this,void 0)}toCodecJson(){return Zg(this,[Fee])}getExpected(){return`undefined`}},Fee=new Xh(ng,new Hh(Ph(()=>void 0),Ph(()=>null))),rg=new Pee,Iee=new class extends eg{_tag=`Never`;getParser(){return g_(this,se)}getExpected(){return`never`}},ig=new class extends eg{_tag=`Unknown`;getParser(){return g_(this,ce)}getExpected(){return`unknown`}},ag=class extends eg{_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 h_(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?og(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:og(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function og(e){let t=globalThis.String(e.literal);return Zg(e,[new Xh(new ag(t),new Hh(Ph(()=>e.literal),Ph(()=>t)))])}var sg=new class extends eg{_tag=`String`;getParser(){return g_(this,_)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&x_(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},Lee=class extends eg{_tag=`Number`;getParser(){return g_(this,te)}matchKey(e,t){return this._match(ste,e,t)}matchPart(e,t){return this._match(y_,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:x_(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(cg(this.checks,`effect/schema/isFinite`)||cg(this.checks,`effect/schema/isInt`))?this:Zg(this,[qee])}toCodecStringTree(){return this.toCodecJson()===this?Zg(this,[lte]):Zg(this,[ute])}getExpected(){return`number`}};function cg(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&cg(e.checks,t))}var lg=new Lee,Ree=new class extends eg{_tag=`Boolean`;getParser(){return g_(this,ne)}getExpected(){return`boolean`}},ug=class extends eg{_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(l_(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(l_(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 fh(n,t[o],i),a=new uh([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return E(new ph(n,[a],t,i))}return e.issues?E(new ph(n,e.issues,t,i)):nh(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?fg(i,e,0,u):pg(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===th)return rh;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 mh(n,e,a))}catch(e){return Ff(e)}}}_rebuild(e,t,n){let r=s_(this.elements,e),i=s_(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new ug(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 zee(e,t,n,r){if(n._tag===`Failure`)return mg(e,e.ast,r,n);let i=n===ih?t:n[y];if(i!==th)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(l_(t.ast))return;let n=new uh([r],new dh(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Fu(new ph(e.ast,[n],e.input,e.options))}}var dg={onItem(e,t,n){let r=n<e.len?t:th;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:zee},fg=ul()(dg),pg=fl()(dg),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 ph(t,[new uh([n],r)],e.input,e.options)));let a=new uh([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Fu(new ph(t,[a],e.input,e.options))},hg=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function gg(e,t,n=Zh){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(__(f_(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=$g(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 bg(e){return vg(e)&&yg(e)}var xg=class{parameter;type;constructor(e,t){if(!bg(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,l_(t)&&!m_(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Sg=class extends eg{_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 g_(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(__(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===ih?o:s[y];if(a!==th&&c!==th){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===ih?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===sg?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===th)return th;if(typeof t!=`object`||!t||Array.isArray(t))return yield*E(new mh(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 fh(n,f[a],d),r=new uh([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*E(new ph(n,[r],t,d))}}}if(r){let e=ee===1?Tg(m,a):Eg(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===sg?l:c,r=_?.[e]??(t.is.parameter===sg?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===sg?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 ph(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=Cg(e,r,n);if(i)return i;let o=()=>nh(e.out),s=Tg(e,a.slice(t+1));return s?Jp(s,o):o()})};return(e,t)=>{if(e===th)return rh;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 mh(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=Rg(i,s),l=c?i[s]:th,d=n.parser(l,t);if(!xs(d))return u(o,e,d);if(d===ih){c&&vt(a,s,l);continue}let f=Cg(o,n,d);if(f)return f}}catch(e){return Ff(e)}return nh(a)}}_rebuild(e,t,n,r){let i=s_(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new _g(t.name,n)}),a=s_(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new xg(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new Sg(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 Cg(e,t,n){if(n._tag===`Failure`)return mg(e,e.ast,t.name,n);if(n===ih)return;let r=n[y];if(r!==th){vt(e.out,t.name,r);return}if(delete e.out[t.name],!l_(t.type)){let n=new uh([t.name],new dh(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Fu(new ph(e.ast,[n],e.input,e.options))}}var wg={onItem(e,t){if(!Rg(e.input,t.name))return t.parser(th,e.options);let n=e.input[t.name];return vt(e.out,t.name,n),t.parser(n,e.options)},step:Cg},Tg=ul()(wg),Eg=fl()(wg);function Dg(e,t){return e?t?[...e,...t]:e:t}function Og(e,t,n){return new Sg(Reflect.ownKeys(e).map(t=>new _g(t,e[t].ast)),[],n,t)}function kg(e){return e.ast}function Ag(e,t=void 0){return new ug(!1,e.map(e=>e.ast),[],void 0,t)}function jg(e,t,n){return new zg(e.map(kg),t,void 0,n)}var Mg=f(e=>{for(;;){if(Yh(e))return ig;let t=e.encoding;if(!t)return e.recur?.(Mg,a)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==a))return ig;e=t[t.length-1].to}});function Ng(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(Ng)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Pg(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[Jm];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!l_(t)){if(qh(t))return[{key:e.name,literal:t.literal}];if(Jh(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!l_(e)){if(qh(e))return[{key:t,literal:e.literal}];if(Jh(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Pg(Mg(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Pg(e.thunk())}}var Fg=new WeakMap,Ig=Object.freeze([]),Lg=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Rg=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Bee(e){let t=Fg.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=Mg(c);if(jee(l))continue;if(qh(l)||Jh(l)){a??=new Map;let e=qh(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=Pg(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=Ng(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Ig);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Ig;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=Rg(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Ig;if(t)return o}return Ig}}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=Lg(t);if(!ue(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Rg(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=Rg(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=Rg(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(Lg(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Fg.set(e,t),t}var zg=class extends eg{_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===th)return rh;let i=(o??=Bee(n.types))(e,r);if(i.length===0)return E(new gh(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:xs(r)?Bg(n,r.cause,e,t):Vee(n,r,e,t)}return Hee(n,a,i,e,t)}}_rebuild(e,t,n){let r=s_(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new zg(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=f_(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(qh);if(t.length>0)return`${Hg(n.isMutable)}[ ${t.map(t=>e(t)+Ug(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>qh(e.type));if(t.length>0)return`{ ${t.map(t=>`${Hg(t.type.context?.isMutable)}${nt(t.name)}${Ug(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Bg(e,t,n,r){let i=kh(t);return i?Fu(new gh(e,[i],n,r)):Pu(t)}function Vee(e,t,n,r){return Gf(t,t=>Bg(e,t,n,r))}function Hee(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=Wee(a,n);return o?Uee(o,a):a.out?a.out:E(new gh(e,a.issues??[],r,i))}function Uee(e,t){return Jp(e,e=>t.out===ih?w(t.input):t.out?t.out:E(new gh(t.ast,t.issues??[],t.input,t.options)))}var Wee=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 bee(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Iu}}}),Vg=new zg([new ag(`Infinity`),new ag(`-Infinity`),new ag(`NaN`)]);function Hg(e){return e?``:`readonly `}function Ug(e){return e?`?`:``}var Wg=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 Wg(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Wg(this.run,this.annotations,!0)}and(e,t){return new Gg([this,e],t)}},Gg=class extends r{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Gg(this.checks,{...this.annotations,...e})}and(e,t){return new Gg([this,e],t)}};function Kg(e,t,n=!1){return new Wg((t,n,r)=>See(n,e(t,n,r),t,r),t,n)}function Gee(e,t){return new Wg((t,n,r)=>e(t)?void 0:new hh(void 0,t,r),t,!0)}function Kee(e){return Kg(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 qee=new Xh(new zg([n_(lg,[Kee()]),Vg]),new Hh(Lh(),Ph(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function qg(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Kg(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 Jg=new WeakMap;function Yg(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&Jg.set(n,Xg(e)),n}function Xg(e){let t=Jg.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 Jg.set(e,n),n}function Zg(e,t){return e.encoding===t?e:Yg(e,{encoding:t})}function Qg(e,t){if(e.context===t)return e;let n=Xg(e);return n.context===t&&n.encoding===e.encoding?n:Yg(e,{context:t})}function $g(e){return e.encoding?$g(e.encoding[e.encoding.length-1].to):e}function e_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return t_(e,mi(e.checks.slice(0,-1),n.annotate(t)))}return Yg(e,{annotations:{...e.annotations,...t}})}function t_(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:Yg(e,{checks:t})}function n_(e,t){return t_(e,Dg(e.checks,t))}function r_(e,t){let n=t(e.to);return n===e.to?e:new Xh(n,e.transformation)}function i_(e,t){let n=e,r=n[n.length-1],i=r_(r,t);return i===r?e:mi(e.slice(0,e.length-1),i)}function a_(e){return t=>t.encoding?Zg(t,i_(t.encoding,e)):t}function Jee(e,t){return a_(e=>Qg(e,t))(e)}function o_(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:Zg(r,i_(r.encoding,n))}return e(r)}return f(n)}function Yee(e,t,n){let r=new Xh(e,t);return Zg(n,n.encoding?[...n.encoding,r]:[r])}function s_(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 Xee(e,t){return Qg(e,e.context?new Qh(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Qh(!1,!1,void 0,t))}var c_=f(e=>Zee(Qg(e,e.context?e.context.isOptional===!1?new Qh(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Qh(!0,!1)))),Zee=a_(c_),Qee=d(e=>c_(new zg([e,rg])));function $ee(e,t,n){return Yee(e,n,t)}function ete(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 tte(e,t){let{literals:n,parameters:r}=ete(e);return new Sg(n.map(e=>new _g(e,t)),r.map(e=>new xg(e,t)))}function l_(e){return e.context?.isOptional??!1}function nte(e){return e.context?.isMutable??!1}function u_(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(u_)}function rte(e){function t(e){return u_(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return hi(n)?n:void 0}function ite(e){let t=!0;function n(e){return t=t&&!e.encoding&&!Yh(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var d_=f(e=>{let t=Xg(e);if(t!==e){let n=d_(t);return n===t&&e.encoding===void 0?e:Qg(n,e.context)}let n=`recur`in e?e.recur(d_):e;if(`encodingChecks`in n&&n.encodingChecks){let t=ite(e)?n.encodingChecks:Mee(n)||Nee(n)||Kh(n)&&n.typeParameters.length>0?rte(n.encodingChecks):void 0;return Yg(n,{encodingChecks:void 0,checks:Dg(n.checks,t)})}return n}),f_=f(e=>d_(p_(e)));function ate(e,t){let n=t,r=n.length,i=n[r-1],a=[new Xh(p_(Zg(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Xh(p_(n[e-1].to),n[e].transformation.flip()));let o=p_(i.to);return o.encoding?Zg(o,[...o.encoding,...a]):Zg(o,a)}var p_=d(e=>{if(e.encoding)return ate(e,e.encoding);let t=Xg(e);if(t!==e){let n=p_(t);return n===t?e:Qg(n,e.context)}return`flip`in e?e.flip(p_):`recur`in e?e.recur(p_):e});function m_(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(m_);default:return!1}}function h_(e,t){let n=t===0?ih:nh(t);return(r,i)=>r===th?rh:r===t?n:E(new mh(e,r,i))}function g_(e,t){return(n,r)=>n===th?rh:t(n)?ih:E(new mh(e,n,r))}var __=o_(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(__)}}),v_=o_(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(v_)}}),ote=`[\\s\\S]*?`,y_=new globalThis.RegExp(`^${hg}$`),ste=new globalThis.RegExp(`^(?:${hg}|Infinity|-Infinity|NaN)$`);function cte(e){return qg(y_,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:y_.source}),...e})}var b_=n_(sg,[cte()]),lte=new Xh(b_,Wh),ute=new Xh(new zg([b_,Vg]),Wh);function x_(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=x_(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 vee(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function S_(e){if(!Kh(e))return;let t=e.annotations?.[Ym];return ae(t)?t(e.typeParameters):void 0}function C_(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function w_(e){return e===void 0||typeof e==`string`}function T_(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 E_(e){return T_(e,C_)}var D_=new tg([],()=>(e,t,n)=>E_(e)?ih:E(new mh(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>j_}),O_=new Xh(D_,Uh()),k_=new Xh(new zg([new ug(!1,[],[D_]),new Sg([],[new xg(sg,D_)])]),Uh());function A_(e){return T_(e,w_)}var j_=new Xh(new tg([],()=>(e,t,n)=>A_(e)?ih:E(new mh(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),Uh()),M_=(e,t,n)=>e===ih?n(t):Jp(e,n);function N_(e){if(e._tag===`Middleware`)return(t,n,r)=>P_(t===ih?e.decode(nh(ah(n)),r):e.decode(qp(t,ah),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===ih?nh(t):e;case`Transform`:{let e=e=>e===th?rh:nh(t.transform(e));return(t,n)=>M_(t,n,e)}case`TransformOptional`:{let e=e=>oh(t.transform(ah(e)));return(t,n)=>M_(t,n,e)}case`TransformEffect`:return(e,n,r)=>M_(e,n,e=>e===th?rh:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>M_(e,n,e=>P_(t.transform(ah(e),r)))}}var P_=e=>Jp(e,oh),F_=(e,t,n,r)=>Gf(r,r=>Pf(()=>wu(r,r=>new yee(e,r,t,n))));function I_(e,t){let n=N_(e.link.transformation),r;return(i,a)=>{if(i===th)return rh;if(e.isConstructed(i))return ih;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function L_(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==th&&r!==void 0)return t(r,i);let a=n;if(xs(a)&&a._tag===`Success`){let e=t(a[y],i);return e===ih?a:e}return Jp(F_(e,r,i,a),e=>{let n=t(e,i);return n===ih?nh(e):n})}}function R_(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:L_(e,n)}function z_(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?S_(e):void 0,o=a?I_(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>N_(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===ih?t:r[y];if(t!==th&&i!==th){let i=x_(u,t,void 0,e,n);i&&(r=E(new ph(e,i,t,n)))}}}else r=D(r,r=>{if(t!==th&&r!==th){let r=x_(u,t,void 0,e,n);if(r)return E(new ph(e,r,t,n))}return w(r)})}if(s&&!n.disableChecks){if(xs(r)){if(r._tag===`Success`){let i=r===ih?t:r[y];if(i===th)return r;let a=x_(s,i,void 0,e,n);a&&(r=E(new ph(e,a,i,n)))}}else r=D(r,t=>{if(t!==th){let r=x_(s,t,void 0,e,n);if(r)return E(new ph(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===ih?nh(e):n})}if(o._tag===`Success`){let e=o[y],t=p(e,r);return t===ih?o:t}return o=F_(e,n,r,o),Jp(o,e=>{let t=p(e,r);return t===ih?nh(e):t})}:p}var B_=Symbol(),V_=new WeakMap,H_=e=>K_(e).parser,U_=e=>K_(e).makeEffect,W_=e=>R_(e,U_),G_=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=z_(this.ast,H_)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=z_(this.ast,U_,W_)}};function K_(e){let t=V_.get(e);if(t!==void 0)return t;let n=new G_(e);return V_.set(e,n),n}function q_(e){let t=e.ast,n;return(e,r)=>(n??=nv(cv,d_(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function J_(e){let t=q_(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 Y_(e){return ov(d_(e.ast))}function X_(e,t){let n=ev(e.ast);return t===void 0?n:(e,r)=>n(e,Q_(t,r))}function Z_(e,t){return iv(X_(e,t))}var Q_=(e,t)=>t?{...e,...t}:e,$_=e=>e===th?E(new hh):w(e);function ev(e){return nv(sv,e)}function tv(e,t){return e===ih?w(t):xs(e)?e[y]===th?$_(th):e:Jp(e,$_)}function nv(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??Zh);return a===ih?w(r):xs(a)?a[y]===th?$_(th):a:Jp(a,$_)}}function rv(e){return(t,n)=>Hp(e(t,n))}function iv(e){let t=rv(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 av(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 ov(e){let t,n;return(r,i)=>{t??=K_(e);let a=i?.disableChecks?i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i?.parseOptions??Zh,o=t.make;if(o!==void 0&&r!==th){let e;try{e=o(r,a)}catch(e){throw Ah(Su(e),`Constructor adapter can only throw schema issues`),e}if(e!==B_&&e!==th)return e}return av(tv((n??=t.makeEffect)(r,a),r),`Constructor adapter can only throw schema issues`)}}var sv=e=>K_(e).parser,cv=e=>K_(e).makeEffect,lv=`~effect/Schema/Schema`,uv=Symbol(),dv={[lv]:lv,get make(){let e=Y_(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=q_(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=J_(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return t(this,arguments)},annotate(e){return this.rebuild(e_(this.ast,e))},annotateKey(e){return this.rebuild(Xee(this.ast,e))},check(...e){return this.rebuild(n_(this.ast,e))},rebuild(e){return fv(e,this[uv])}};function fv(e,t){function n(){}let r=Object.setPrototypeOf(n,dv);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[uv]=t,r.ast=e,r}function pv(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function mv(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function hv(e){return encodeURI(pv(e)).replace(/#/g,`%23`)}function gv(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 _v(e){let t=gv(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split(`/`).map(mv)}function vv(e){return e.reduce((e,t)=>`${e}/${hv(t)}`,`#`)}var yv=`http://json-schema.org/draft-07/schema#`;function bv(e,t){return e===t||e===(t.endsWith(`#`)?t.slice(0,-1):`${t}#`)}function xv(e){return{dialect:`draft-07`,...mte(e,wte)}}function Sv(e,t){return n(e,!1,!0);function n(e,r,i=!1){if(!le(e))return e;let a=r||!i&&kv(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=wv(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 Cv(e,t){return Sv(e,e=>{dte(e,t)})}function dte(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 wv(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 fte(e,t,n){let r=new Map,i=[],a=Tv;function o(e,n=[],r=[]){return n.length===0&&t?.trackIds&&(a=Dv(le(e)?u(e):void 0,Tv)??Tv),l(e,n,r,{sourceRoot:[],targetRoot:[],uri:a})}function s(){for(let[e,t,n]of i){let i=t,a=Ev(t,n);if(a!==void 0){let e=_v(a.hash);if(a.hash=``,e!==void 0){let n=r.get(Ov(a.href,e));n!==void 0&&(i=pte(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&&kv(c)){let e=Dv(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)?wv(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(Ov(n.uri,e.slice(n.sourceRoot.length)),t.slice(n.targetRoot.length))}}var Tv=`https://effect.invalid/.json-schema/`;function Ev(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function Dv(e,t){if(typeof e!=`string`)return;let n=Ev(e,t);if(n!==void 0)return n.hash=``,n.href}function pte(e,t){let n=e.indexOf(`#`);return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${vv(t)}`}function Ov(e,t){return`${e}\u0000${JSON.stringify(t)}`}function kv(e){return typeof e==`string`&&e.length>0&&e[0]!==`#`}function mte(e,t,n){return fte(t,{...n,trackIds:!0},t=>({schema:t(e.schema),definitions:wv(e.definitions,(e,n)=>t(e,[`$defs`,n],[`definitions`,n]))}))}var hte=new Set([`properties`,`patternProperties`]),gte=new Set([`allOf`,`anyOf`,`oneOf`]),_te=new Set([`not`,`additionalProperties`,`propertyNames`,`contains`,`if`,`then`,`else`,`contentSchema`]);function vte(e,t,n,r,i,a=hte){let o;if(a.has(t))o=r.schemaMap(n,t);else if(gte.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 Av=[`$anchor`,`$defs`,`$dynamicAnchor`,`$dynamicRef`,`$vocabulary`,`contentSchema`,`dependentRequired`,`dependentSchemas`,`maxContains`,`minContains`,`prefixItems`,`unevaluatedItems`,`unevaluatedProperties`];[...Av],[...Av];var yte=/^[A-Za-z_][-A-Za-z0-9._]*$/,bte=/^[A-Za-z][-A-Za-z0-9._:]*$/;function jv(e,t,n){throw Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function xte(e,t,n,r){for(let i of t)Object.hasOwn(e,i)&&jv(i,n,`it is not active in ${r} but would become active in the target`)}var Ste=[`additionalItems`,`definitions`,`dependencies`];function Cte(e,t,n,r,i){n.isDocumentRoot?vt(e,`$schema`,bv(t,`https://json-schema.org/draft/2020-12/schema`)?r:t):bv(t,`https://json-schema.org/draft/2020-12/schema`)||jv(`$schema`,i,`an embedded resource cannot declare a different dialect`)}function wte(e,t){xte(e,Ste,`Draft-07`,`Draft 2020-12`);let n={},r,i,a;for(let o of Object.keys(e)){let s=e[o];if(!vte(n,o,s,t,_te))switch(o){case`$ref`:r=s;break;case`$schema`:Cte(n,s,t,yv,`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`:jv(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(Tte(n,i,a,t),Object.hasOwn(e,`contains`)){let t=e.minContains,r=e.maxContains;(t!==void 0&&t!==1||r!==void 0)&&jv(`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 Dte(e,n,t,`draft-07`),kte(e,n,`$id`,`Draft-07`),Ete(n,r,t),n}function Tte(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 Ete(e,t,n){if(t!==void 0){if(typeof t==`string`&&Object.keys(e).length>0){let r={};n.reference(r,t),Ote(e,r)}else n.reference(e,t)}}function Dte(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 Ote(e,t){Array.isArray(e.allOf)?e.allOf.push(t):vt(e,`allOf`,[t])}function kte(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`||!yte.test(a))&&jv(`$anchor`,r,`the anchor is not valid`),bte.test(a)||jv(`$anchor`,r,`the anchor cannot be represented as a plain-name fragment identifier`),i===void 0?vt(t,n,`#${a}`):jv(`$anchor`,r,`it cannot be combined with the schema $id`)}var Mv=o_(e=>{let t=Pte(e,Mv),n=e.context;return t===e||n===void 0?t:Jee(t,Ate(n))});function Ate(e){return e.constructorDefault===void 0?e:new Qh(e.isOptional,e.isMutable,void 0,e.annotations)}function jte(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function Mte(e){return t=>{let n=[...t].sort((t,n)=>e(f_(t))-e(f_(n)));return n.some((e,n)=>e!==t[n])?n:t}}var Nte=Mte(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Pte(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!ae(n))return Zg(e,[O_]);let r=n(e.typeParameters.map(e=>fv(f_(e))));return r===void 0?e:Zg(e,[r_(r,t)])}case`Unknown`:return Zg(e,[O_]);case`ObjectKeyword`:return Zg(e,[k_]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return jte(e),e.recur(t,v_);case`Union`:{let n=Nte(e.types);return n===e.types?e.recur(t):new zg(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 Fte=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`);function Nv(e,t){return t.length>0&&(e+=`\n at ${rt(t)}`),Error(e)}function Pv(e){return`#/$defs/${hv(e)}`}var Ite=new Set([...eh,qm,...Xm]);function Fv(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;E_(o)&&(n.default=o);let s=e.examples;Array.isArray(s)&&E_(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(E_(p)&&(n.contentSchema=p),t?.includeAnnotationKey!==void 0)for(let[r,i]of Object.entries(e))!Ite.has(r)&&t.includeAnnotationKey(r)&&E_(i)&&vt(n,r,i);return Object.keys(n).length===0?void 0:n}function Iv(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=Iv(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 Lte(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 Lv=`|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|`;function Rv(e,t){return Object.keys(e).every(e=>t.includes(`|${e}|`))}function zv(e,t){return typeof e.$ref!=`string`&&t.every(t=>!Object.hasOwn(e,t))}var Bv=`|title|description|default|examples|readOnly|writeOnly|`,Rte=Lv+Bv;function Vv(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=Lte(e);if(i!==void 0||a){let r=Iv(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:Rv(r.schema,Bv)&&zv(o,s)?{...o,...r.schema}:Vv(o,r.schema,n)}}if(n&&zv(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 Hv(e,t=new Set){return typeof e==`boolean`?e:t.has(e)?!0:(t.add(e),e.every(e=>Hv(e,t)))}function zte(e){return Array.isArray(e)}function Bte(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(!Hv(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 Nv(`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 Cv(e,e=>{let t=gv(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(mv(t.slice(7,n<0?void 0:n)));return r===void 0?e:e.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,Pv(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[qm]: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=zte(s);c&&i.push(!1);let l=c?s[0]:s,u=Fv(a,r),d=u===void 0?l:{...l,...u},f=u===void 0?Lv:Rte;return[d,e._tag===`Filter`&&Rv(d,f)&&(u===void 0||Rv(u,Bv))?!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=Fv(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:Pv(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=Fv(e.annotations,r);c!==void 0&&(s={...s,...c});for(let n=0;n<e.checks.length;n++){let r=typeof s.type==`string`&&Vte(s.type)?s.type:void 0,i=ee(e.checks[n],r,[...t,`checks`,n],a);i!==void 0&&(s=Vv(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 Nv(`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(Uv).join(``)}$`};case`Arrays`:{if(e.rest.length>1)throw Nv(`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=Fv(e.annotations,r);return s===void 0?o:p(Vv(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 Nv(`Invalid schema representation document`,[...t,`propertySignatures`,i,`name`]);let c=s.name,l=_(s.type,[...t,`propertySignatures`,i,`type`],n),u=Fv(s.annotations,r);vt(a,c,u===void 0?l:p(Vv(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(Vv(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=Hte(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 Nv(`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 Hv(n)&&r.type===`string`&&typeof r.pattern==`string`&&Rv(r,`|type|pattern|title|description|default|examples|readOnly|writeOnly|`)?[r.pattern]:void 0}case`TemplateLiteral`:return e.checks.length===0?[`^${e.parts.map(Uv).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 Nv(`Invalid schema representation document`,t)}}}function Vte(e){return e===`string`||e===`number`||e===`boolean`||e===`array`||e===`object`||e===`null`||e===`integer`}function Hte(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 Uv(e){switch(e._tag){case`Literal`:return Fte(globalThis.String(e.literal));case`String`:return ote;case`Number`:return hg;case`TemplateLiteral`:return e.parts.map(Uv).join(``);case`Union`:return`(?:${e.types.map(Uv).join(`|`)})`;default:throw Nv(`Invalid schema representation document`,[])}}function Ute(e,t){let n=Bte([e.representation],[[`representation`]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var Wte=({identifier:e})=>e;function Wv(e){return e===void 0?void 0:{annotations:e}}function Gte(e,t){let{references:n,representations:r}=Kte([e],t);return{representation:r[0],references:n}}function Kte(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??Wte;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:e_(e,{identifier:n}):Qm(e)===r?e:e_(e,{[qm]: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=$g(e),n=Xg(t),r=Zm(t),i=r===void 0?(t===e?void 0:Zm(e))??Qm(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(d_(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,...Wv(e.annotations)};case`Literal`:return{_tag:`Literal`,literal:e.literal,checks:t,...Wv(e.annotations)};case`UniqueSymbol`:return{_tag:`UniqueSymbol`,symbol:e.symbol,checks:t,...Wv(e.annotations)};case`Enum`:return{_tag:`Enum`,enums:e.enums,checks:t,...Wv(e.annotations)};case`TemplateLiteral`:return{_tag:`TemplateLiteral`,parts:e.parts.map(e=>m(e)),checks:t,...Wv(e.annotations)};case`Arrays`:return{_tag:`Arrays`,elements:e.elements.map(e=>{let t=$g(e),n=t.context?.annotations;return{isOptional:l_(t),type:m(e),...Wv(n)}}),rest:e.rest.map(e=>m(e)),checks:t,...Wv(e.annotations)};case`Objects`:return{_tag:`Objects`,propertySignatures:e.propertySignatures.map(e=>{let t=$g(e.type),n=t.context?.annotations;return{name:e.name,type:m(e.type),isOptional:l_(t),isMutable:nte(t),...Wv(n)}}),indexSignatures:e.indexSignatures.map(e=>({parameter:m(e.parameter),type:m(e.type)})),checks:t,...Wv(e.annotations)};case`Union`:return{_tag:`Union`,types:e.types.map(e=>m(e)),...e.options===void 0?{}:{options:e.options},checks:t,...Wv(e.annotations)};case`Suspend`:return{_tag:`Suspend`,checks:[],thunk:m(e.thunk()),...Wv(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(d_(e)))};return{...r===void 0?void 0:{representation:r},...Object.keys(n).length===0?void 0:{annotations:n}}}}var Gv=i(2,(e,t)=>qte(e,(e,n)=>[Object.hasOwn(t,e)?t[e]:e,n])),Kv=e=>e;function qte(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 qv=`~effect/Schema/SchemaError`;function Jte(e){return de(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}function Yte(){return(e,t,n)=>Zv(new tg(e.map(kg),e=>t(e.map(e=>Zv(e))),n))}function Xte(e,t){return Yte()([],()=>(t,n,r)=>e(t)?w(t):E(new mh(n,t,r)),t)}var Jv=class extends ga(`SchemaError`){[qv]=qv;constructor(e){let t=mt();ht(0);try{super({issue:e})}finally{ht(t)}}get message(){return Eh(this.issue)}toString(){return`SchemaError(${this.message})`}};function Zte(e){return Jte(e)}function Qte(e){return xs(e)?$te(e):Gf(e,e=>Pf(()=>wu(e,e=>new Jv(e))))}function $te(e){return Lu(e)?e:Pu(wu(e.cause,e=>new Jv(e)))}function ene(e,t){let n;for(let r of e.reasons){if(!bu(r)||!Zte(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 tne(e){let t=Hp(e);if(Lu(t))return t.value;throw ene(t.cause,`Sync adapter can only throw schema errors`)}function Yv(e,t){let n=X_(e,t);return(e,t)=>Qte(n(e,t))}function nne(e,t){let n=Z_(e,t);return(e,t)=>ti(n(e,t),e=>new Jv(e))}function Xv(e,t){let n=Yv(e,t);return(e,t)=>tne(n(e,t))}var Zv=fv,rne=Kv(e=>Zv(c_(e.ast),{schema:e})),k=Kv(e=>{let t=sne(e);return Zv(Qee(e.ast),{schema:t})}),ine=Kv(e=>Zv(f_(e.ast),{schema:e}));function A(e){let t=Zv(new ag(e),{literal:e,transform(n){return t.pipe(uy(A(n),{decode:Ph(()=>n),encode:Ph(()=>e)}))}});return t}var Qv=Zv(Iee),$v=Zv(ig),ey=Zv(ng),ane=Zv(rg),j=Zv(sg),ty=Zv(lg),M=Zv(Ree);function ny(e,t){return Zv(e,{fields:t,mapFields(e,t){let n=e(this.fields);return ny(Og(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function N(e){return ny(Og(e,void 0),e)}var one=e=>typeof e==`symbol`?e:globalThis.String(e);function ry(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=ine(t.fields[o]),c=Object.hasOwn(e,o),l=c?e[o]:o,u=one(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(uy(t,Dee({decode:Gv(i),encode:Gv(r)})))}}function iy(e,t){return Zv(tte(e.ast,t.ast),{key:e,value:t})}function ay(e,t){return Zv(e,{elements:t,mapElements(e,t){let n=e(this.elements);return ay(Ag(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function oy(e){return ay(Ag(e),e)}var P=Kv(e=>Zv(new ug(!1,[],[e.ast]),{value:e}));function sy(e,t){return Zv(e,{members:t,mapMembers(e,t){let n=e(this.members);return sy(jg(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function F(e,t){return sy(jg(e,t,void 0),e)}function I(e){let t=e.map(A);return Zv(jg(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 cy=Kv(e=>F([e,ey])),sne=Kv(e=>F([e,ane]));function ly(e,t){return n=>Zv(n_(n.ast,[Gee(e,t)]),{schema:n})}function uy(e,t){return n=>Zv($ee(n.ast,e.ast,t?Eee(t):Uh()),{from:n,to:e})}var L=Kg,dy=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function cne(e){let t=new globalThis.RegExp(dy);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:dy,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 qg(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}function lne(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 une(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 dne(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 fne(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 fy(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${et(e)}`);return e}var py=lne({order:Yn,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:fy(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${et(e)})`})})}),z=une({order:Yn,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:fy(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${et(e)})`})})}),my=dne({order:Yn,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:fy(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${et(e)})`})})}),B=fne({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:fy(e.minimum),maximum:fy(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 hy(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=ty.check(hy());function gy(e,t){return e=_y(e),pne(e,Math.ceil(e/2),t)}function pne(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})`}),[Km]:!0,arbitraryConstraint:{minLength:e},...n})}function H(e,t){return e=_y(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})`}),[Km]:!0,arbitraryConstraint:{maxLength:e},...t})}function U(e,t,n){return e=_y(e),t=_y(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})`}),[Km]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...n})}function _y(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function mne(e,t){return e=_y(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})`}),[Km]:!0,arbitraryConstraint:{maxProperties:e},...t})}globalThis.RegExp,globalThis.URL;var hne=j.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`});function gne(e,t){return hne.pipe(uy(e,Aee(t)))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var _ne=j.check(cne()),vne=j.annotate({expected:`a string that will be decoded as a trimmed string`}).pipe(uy(_ne,Oee()));globalThis.Uint8Array;function yne(e,t){return Ute(Gte(Mv(e.ast),t),t)}var bne=wo,xne=Eo,Sne=Do,vy=Oo,Cne=ko,yy=vl,by=Nl,xy=`~effect/MutableRef`,Sy={[xy]:xy,...kt,toJSON(){return{_id:`MutableRef`,current:lt(this.current)}}},Cy=e=>{let t=Object.create(Sy);return t.current=e,t},wy=i(2,(e,t)=>(e.current=t,e)),Ty=Symbol.for(`effect/MutableList/Empty`),Ey=()=>({head:void 0,tail:void 0,length:0}),Dy=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})},Oy=()=>({array:[],mutable:!0,offset:0,next:void 0}),ky=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=Oy(),e.tail=e.tail.next):e.head=e.tail=Oy(),e.tail.array.push(t),e.length++},Ay=e=>{e.head=e.tail=void 0,e.length=0},jy=e=>{if(!e.head)return Ty;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:Ay(e):Dy(e),t},My=`~effect/Queue`,Ny=`~effect/Queue/Enqueue`,Py=`~effect/Queue/Dequeue`,Fy={_A:a,_E:a},Iy={[My]:Fy,[Ny]:Fy,[Py]:Fy,...kt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:Jy(this)}}},Ly=e=>sn(t=>{let n=Object.create(Iy);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=Ey(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},x(n)}),Ry=e=>Ly({capacity:e}),zy=e=>Ly({capacity:e,strategy:`sliding`}),By=i(2,(e,t)=>Mo(()=>Vy(e,t)?Xy:e.state._tag===`Open`&&e.strategy===`suspend`?rb(e,t):Yy)),Vy=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(jy(e.messages),ky(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(ky(e.messages,t),$y(e),!0):(ky(e.messages,t),eb(e),!0):!1,Hy=i(2,(e,t)=>jo(()=>Uy(e,t))),Uy=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Ms(rn(t),Zy);return e.state.offers.size===0&&e.messages.length===0?(cb(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},eb(e),!0)},Wy=e=>jo(()=>Gy(e)),Gy=e=>{if(e.state._tag===`Done`)return!1;Ay(e.messages);let t=e.state.offers;cb(e,e.state._tag===`Open`?Qy:e.state.exit);for(let e of t)ab(e);return!0},Ky=e=>Mo(()=>qy(e)??ps(nb(e,()=>tb(e,1)),Ky(e))),qy=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=jy(e.messages);return sb(e),en(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=ob(e.state.offers);return sb(e),en(t)}},Jy=e=>e.state._tag===`Done`?0:e.messages.length,Yy=en(!1),Xy=en(!0),Zy=an(gn()),Qy=Es(),$y=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}},eb=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,$y(e)},0))},tb=(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,nb=(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)})}),rb=(e,t)=>Wo(n=>Vy(e,t)?n(Xy):ib(e,{_tag:`Single`,message:t,resume:n})),ib=(e,t)=>{if(e.state._tag!==`Open`)return ab(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))})},ab=e=>e._tag===`Single`?e.resume(Yy):e.resume(en(e.remaining.slice(e.offset))),ob=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(Xy),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`)ky(e.messages,t.message),e.state.offers.delete(t),t.resume(Xy);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;ky(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()},lb=e=>new db(e),ub=(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)})}),db=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?ub(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(ub(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)))}},fb=e=>jo(()=>new db(e)),pb=`~effect/Channel`,mb=e=>de(e,pb),hb={[pb]:{_Env:a,_InErr:a,_InElem:a,_OutErr:a,_OutElem:a},pipe(){return t(this,arguments)}},gb=e=>{let t=Object.create(hb);return t.transform=(t,n)=>Gf(e(t,n),e=>w(Nf(e))),t},_b=(e,t)=>gb((n,r)=>D(bb(e)(n,r),e=>t(e,r))),vb=e=>gb((t,n)=>e),yb=e=>gb(Wp(function*(t,n){let r=Xu(n),i=e=>Zu(r,Yd(e));return bp(yield*bp(e(t,n,r),i),i)})),bb=e=>e.transform,xb=e=>gb((t,n)=>kf(()=>bb(e())(t,n))),Sb=vb(w(ju())),Cb=e=>vb(w(E(e))),wb=e=>vb(Nf(e)),Tb=e=>gb((t,n)=>Eb({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),Eb=e=>{let t=e.readable.getReader(),n=e.exit??Cy(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)},Db=i(2,(e,t)=>_b(e,e=>T(()=>{let n=0;return O(e,e=>t(e,n++))}))),Ob=e=>e===void 0||e!==`unbounded`&&e<=1,kb=i(e=>mb(e[0]),(e,t,n)=>Ob(n?.concurrency)?Ab(e,t):jb(e,t,n)),Ab=(e,t)=>gb((n,r)=>{let i=0;return O(bb(e)(n,r),D(e=>t(e,i++)))}),jb=(e,t,n)=>yb(Wp(function*(r,i,a){let s=0,c=yield*bb(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:n.concurrency,u=yield*Ry(0);yield*Yu(a,Wy(u));let d=Np(yield*lp()),f=yy(a);if(n.unordered){let e=lb(l),n=o(e.release(1)),r=sp({onFailure:e=>D(Hy(u,e),n),onSuccess:e=>D(By(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)(Hy(u,t))),jp(a))}else{let e=yield*Ry(l-2);yield*Yu(a,Wy(e)),yield*Ky(e).pipe(Rf,D(e=>By(u,e)),Ep({disableYield:!0}),Gf(e=>Hy(u,e)),jp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,Uy(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),By(e,xne(o))}),Ep({disableYield:!0}),Gf(t=>By(e,Pu(t)).pipe(zf(Hy(e,t)))),jp(a))}return Ky(u)})),Mb=e=>_b(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)}))}),Nb=i(2,(e,t)=>of(typeof t==`function`?t(a):t).pipe(O(t=>{let n=Qd.defaultValue();return Pb(Jb(e,Qd,T(()=>n)),e=>t(e).pipe(O(e=>{n=e}),Wd(()=>ju(e))))}),Hb)),Pb=(e,t)=>gb((n,r)=>T(()=>{let i,a=()=>{let o=Xu(r);return D(bb(e)(n,o),e=>(i=Wd(e,e=>Zu(o,Iu).pipe(D(()=>t(e)),D(a))),i))};return kf(()=>i??a())})),Fb=i(2,(e,t)=>_b(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)})))),Ib=i(2,(e,t)=>gb((n,r)=>{let i=Xu(r);return O(bb(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(bb(t(e))(n,i)),D(e=>(a=e,e)))}));return kf(()=>a)})})),Lb=i(3,(e,t,n)=>Ib(e,e=>{let r=t(e);return $r(r)?wb(r.failure):n(r.success,e)})),Rb=i(2,(e,t)=>Lb(e,Eu,e=>t(e))),zb=i(2,(e,t)=>_b(e,e=>w(Yf(e,e=>Au(e)?Af:Uf(t(e)))))),Bb=i(2,(e,t)=>xb(()=>{let n,r=Qd.defaultValue(),i=Wb(Jb(e,Qd,T(()=>r)),()=>(n=void 0,Af)),o=typeof t==`function`?t(a):t,s=Rb(i,Wp(function*(e){return n||=yield*of(o),r=yield*n(e),s},(e,t)=>Wd(e,()=>w(Cb(t))),Hb));return s})),Vb=i(e=>mb(e[0])&&mb(e[1]),(e,t,n)=>yb(Wp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*Ry(0);yield*Yu(a,Wy(s));let c=0;function l(e,t){if(c++,!Gd(t))return Hy(s,t);switch(o){case`both`:return c===2?Hy(s,t):Af;case`left`:case`right`:return e===o?Hy(s,t):Af;case`either`:return Hy(s,t)}}let u=(e,t,n)=>bb(t)(r,n).pipe(D(e=>e.pipe(D(e=>By(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)),Ky(s)}))),Hb=e=>gb((t,n)=>{let r;return w(kf(()=>r||e.pipe(qu(n),D(e=>bb(e)(t,n)),D(e=>r=e))))}),Ub=i(2,(e,t)=>yb((n,r,i)=>Ju(i,t).pipe(zf(bb(e)(n,r))))),Wb=i(2,(e,t)=>_b(e,e=>T(()=>{let n=!0,r=Bf(e,e=>(n=!1,t(e)));return kf(()=>n?r:e)}))),Gb=i(2,(e,t)=>Ub(e,e=>t)),Kb=(e,t,n)=>kf(()=>{let r=Ku();return Wd(D(bb(e)(ju(),r),t),n||w).pipe(xp(e=>Zu(r,e)))}),qb=i(3,(e,t,n)=>gb((r,i)=>O(hp(bb(e)(r,i),t,n),hp(t,n)))),Jb=i(3,(e,t,n)=>gb((r,i)=>D(n,n=>bb(qb(e,t,n))(r,i)))),Yb=i(2,(e,t)=>Kb(e,e=>Ep(D(e,t),{disableYield:!0}))),Xb=(e,t)=>bb(e)(ju(),t),Zb=`~effect/Stream`,Qb={_R:a,_E:a,_A:a},$b=function(e){this.channel=e};$b.prototype={[Zb]:Qb,pipe(){return t(this,arguments)}};var ex=e=>new $b(e),tx=`~effect/Sink`,nx={_A:a,_In:a,_L:a,_E:a,_R:a},rx={[tx]:nx,pipe(){return t(this,arguments)}},ix=e=>{let t=Object.create(rx);return t.transform=e,t},ax=e=>{let t=Jr(e);return ix(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])))})},ox=`~effect/Stream`,sx=e=>de(e,ox),cx=ex,lx=e=>ux(T(()=>{let t=!0,n=w(yi(void 0)),r=tp(n,e);return kf(()=>t?(t=!1,n):r)})),ux=e=>cx(vb(e)),dx=(e,t)=>cx(gb((n,r)=>D(Xb(e.channel,r),e=>t(e,r)))),fx=e=>e.channel,px=cx(Sb),mx=e=>cx(xb(()=>e().channel)),hx=e=>cx(Cb(e)),gx=e=>cx(Tb(e)),_x=e=>cx(Hb(O(e,fx))),vx=i(e=>sx(e[0]),(e,t,n)=>e.channel.pipe(Mb,kb(t,n),Db(yi),cx)),yx=i(2,(e,t)=>cx(Nb(e.channel,t))),bx=i(e=>sx(e[0])&&sx(e[1]),(e,t,n)=>cx(Vb(fx(e),fx(t),n))),xx=i(2,(e,t)=>cx(Fb(fx(e),t))),Sx=i(2,(e,t)=>e.channel.pipe(zb(t),cx)),Cx=i(2,(e,t)=>cx(Bb(e.channel,t))),wx=i(2,(e,t)=>dx(e,Wp(function*(e,n){let r=yield*wd,i=Xi(Mi(t)),a,o,s=1/0,c=by(),l=by(),u=by();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)})}))),Tx=i(3,(e,t,n)=>Ex(e,ax(Yr(t)),ff(n))),Ex=i(3,(e,t,n)=>cx(yb(Wp(function*(r,i,a){let o=yield*Xb(e.channel,i),s=by(!1),c=Symbol(),l=yield*Ly({capacity:0});yield*o.pipe(s.whenOpen,D(e=>(s.closeUnsafe(),By(l,e))),Ep,Gf(e=>Hy(l,e)),jp(a));let u=nr(),d,f=!1,p=yield*sf(n),m=kf(function e(){return D(p(u),()=>f?By(l,c):e())}).pipe(D(()=>jf),Wd(()=>ju())),h=Ky(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)))})))),Dx=i(2,(e,t)=>cx(Gb(e.channel,t))),Ox=i(2,(e,t)=>Yb(e.channel,e=>{let n=0;return Ef({while:()=>n<e.length,body:()=>t(e[n++]),step:u})})),kx=i(2,(e,t)=>Yb(e.channel,t)),Ax=i(e=>sx(e[0]),(e,t,n)=>{let r,i,a=by(!1);return new ReadableStream({start(n){i=Mp(fp(kx(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(Sne(i)))}},n?.strategy)}),jx=i(e=>sx(e[0]),(e,t)=>O(lp(),n=>Ax(e,n,t))),Mx=`~effect/FiberHandle`,Nx=e=>de(e,Mx),Px={[Mx]:Mx,...kt,toJSON(){return{_id:`FiberHandle`,state:this.state}}},Fx=()=>{let e=Object.create(Px);return e.state={_tag:`Open`,fiber:void 0},e.deferred=Vu(),e},Ix=()=>_p(T(()=>Fx()),e=>{let t=e.state;return t._tag===`Closed`?Af:(e.state={_tag:`Closed`},t.fiber?Gu(Uf(vy(t.fiber,Lx)),e.deferred):Uu(e.deferred,Iu))}),Lx=-1,Rx=ia(oa(ku,aa(Lx))),zx=i(e=>Nx(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(Lx);return}if(e.state.fiber!==void 0){if(e.state.fiber===t)return;if(n?.onlyIfMissing===!0){t.interruptUnsafe(Lx);return}e.state.fiber.interruptUnsafe(Lx),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?!Rx(r.cause):!Cu(r.cause))&&Wu(e.deferred,r)})}),Bx=e=>Tp(t=>{if(e.state._tag===`Closed`||e.state.fiber===void 0)return Af;let n=e.state.fiber;return zf(t(vy(n,Lx)),T(()=>{e.state._tag===`Open`&&e.state.fiber===n&&(e.state.fiber=void 0)}))}),Vx=function(){let e;return()=>(e===void 0&&(e=Mp(Cp)),e)}(),Hx=function(){let e=arguments[0];if(Cf(arguments[1]))return Ux(e,arguments[1],arguments[2]);let t=arguments[1];return n=>Ux(e,n,t)},Ux=(e,t,n)=>Lf(r=>{if(e.state._tag===`Closed`)return Cp;if(e.state.fiber!==void 0&&n?.onlyIfMissing===!0)return T(Vx);let i=hl(r,t,n?.startImmediately??!0,!0);return zx(e,i,n),w(i)}),Wx=`~effect/FiberSet`,Gx=e=>de(e,Wx),Kx={[Wx]:Wx,[Symbol.iterator](){return this.state._tag===`Closed`?oi():this.state.backing[Symbol.iterator]()},...kt,toJSON(){return{_id:`FiberSet`,state:this.state}}},qx=(e,t)=>{let n=Object.create(Kx);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},Jx=()=>_p(T(()=>qx(new Set,Vu())),e=>kf(()=>{let t=e.state;if(t._tag===`Closed`)return Af;e.state={_tag:`Closed`};let n=t.backing;return Cne(n).pipe(Gu(e.deferred))})),Yx=()=>D(Jx(),e=>eS(e)()),Xx=-1,Zx=ia(oa(ku,aa(Xx))),Qx=i(e=>Gx(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(Xx);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?!Zx(r.cause):!Cu(r.cause))&&Wu(e.deferred,r))}))}),$x=function(){let e;return()=>(e===void 0&&(e=Mp(Cp)),e)}(),eS=e=>()=>O(lp(),t=>{let n=Np(t);return(t,r)=>{if(e.state._tag===`Closed`)return $x();let i=n(t,r);return Qx(e,i,r),i}}),tS=`~effect/ManagedRuntime`,nS=(e,t)=>{let n=t?.memoMap??sd(),r=Ku(`sequential`),i=Xu(r,`sequential`),a={onFiberStart:yy(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(bne(s)))),l={[tS]:tS,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(rS(l,e),o(t)):Np(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?Fp(rS(l,e),o(t)):Pp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Hp(rS(l,e)):Up(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Bp(rS(l,e)):Vp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Rp(rS(l,e),o(t)):zp(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Ip(rS(l,e),o(t)):Lp(l.cachedContext)(e,o(t))}};return l};function rS(e,t){return D(e.contextEffect,e=>fp(t,e))}var iS={"~effect/Ref":{_A:a},...kt,toJSON(){return{_id:`Ref`,ref:this.ref}}},aS=e=>{let t=Object.create(iS);return t.ref=Cy(e),t},oS=e=>T(()=>aS(e)),sS=e=>T(()=>e.ref.current),cS=i(2,(e,t)=>T(()=>wy(e.ref,t))),lS=i(2,(e,t)=>T(()=>{let n=e.ref.current;return e.ref.current=t,n})),uS=i(2,(e,t)=>T(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),dS=i(2,(e,t)=>T(()=>{e.ref.current=t(e.ref.current)})),fS=i(2,(e,t)=>T(()=>e.ref.current=t(e.ref.current))),pS=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,pS,{value:!0})}static[Symbol.hasInstance](t){return super[Symbol.hasInstance](t)||this===e&&typeof t==`object`&&!!t&&pS in t}},mS=new Set([`port_lease_conflict`,`revision_conflict`,`storage_conflict`]),hS=new Set([`port_lease_not_found`,`resource_not_found`]),gS=new Set([`authentication_failed`,`authorization_failed`,`role_denied`,`terminal_program_not_admitted`]),wne=new Set([`command_not_implemented`,`unsupported_method`]),_S=(e,t,n)=>({...n===void 0?{}:{code:n},kind:e,retryable:t}),vS=e=>{let t=e.cause;return typeof t==`object`&&t?Reflect.get(t,`reason`):void 0},yS=e=>{if(e===`cancelled_before_dispatch`)return _S(`cancelled`,!0,e);if(e===`deadline_before_dispatch`)return _S(`offline`,!0,e);if(e===`confirmation_declined`)return _S(`declined`,!1,`confirmation_declined`);if(e===`confirmation_unavailable`)return _S(`refused`,!0,`confirmation_unavailable`);if(e===`request_denied`||e===`credential_invalid`)return _S(`denied`,!1,e)},Tne=e=>yS(vS(e))!==void 0,Ene=e=>e.code===`outcome_unknown`?_S(`outcome_unknown`,!0,e.code):gS.has(e.code)?_S(`denied`,!1,e.code):mS.has(e.code)?_S(`conflict`,!1,e.code):hS.has(e.code)?_S(`not_found`,!1,e.code):wne.has(e.code)?_S(`unavailable`,!1,e.code):_S(`refused`,e.retryable,e.code),Dne=new Set([`protocol_incompatible`,`saturated`]),One=(e,t)=>({...Ene(e),...t===!1&&Dne.has(e.code)?{message:e.message}:{},...e.resource===void 0?{}:{resource:e.resource},...e.saturation===void 0?{}:{saturation:e.saturation}}),bS=(e,t)=>_S(t?`outcome_unknown`:`offline`,!0,e),kne=(e,t)=>{switch(e.code){case`cancelled`:return _S(`cancelled`,!0,e.code);case`correlation_mismatch`:case`invalid_response`:return t?_S(`outcome_unknown`,!0,e.code):_S(`invalid`,!1,e.code);case`deadline_exceeded`:case`saturated`:return _S(`offline`,!0,e.code);case`invalid_request`:return _S(`invalid`,!1,e.code);case`outcome_unknown`:return _S(`outcome_unknown`,!0,e.code);case`remote_error`:case`transport_failure`:return bS(e.code,t)}},Ane=(e,t)=>{if(!(e instanceof W))return bS(`transport_failure`,t);let n=yS(vS(e));return n===void 0?e.remoteError===void 0?kne(e,t):One(e.remoteError,e.synthetic):n},xS=(e,t)=>({_tag:`MaiaError`,...Ane(e,t.mutation),...t.operationId===void 0?{}:{operationId:t.operationId}}),SS={errors:`all`,onExcessProperty:`error`,reportInput:!1},G=e=>{let t=Xv(e,SS),n=nne(e,SS);return{parse:t,safeParse:e=>ni(n(e),{onFailure:e=>({error:e,success:!1}),onSuccess:e=>({data:e,success:!0})})}},CS=`maia.protocol/v1alpha1`,jne=[CS],Mne=/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u,Nne=/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u,Pne=/^\p{Cf}$/u,Fne=new Set([8204,8205]),Ine=e=>{let t=e.codePointAt(0)??0;return t<=31||t>=127&&t<=159||t===8232||t===8233||Pne.test(e)&&!Fne.has(t)},wS=e=>Array.from(e,Ine).includes(!0),TS=vne.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`})),ES=/^\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(ES),L(e=>ES.test(e)&&or(mm(e),{onNone:()=>!1,onSome:t=>gm(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`})),DS=I(jne),J=j.check(U(1,128),R(Mne)),OS=I([`request`,`response`,`event`]),Lne=N({correlationId:k(J),kind:OS,messageId:J,payload:$v,protocolVersion:DS}),Rne=N({correlationId:k(J),kind:A(`request`),messageId:J,payload:$v,protocolVersion:DS}),zne=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({ok:A(!0),result:$v}),protocolVersion:DS}),kS=j.check(U(1,64),R(Nne)),AS={code:kS,resource:k(I([`cpu`,`disk`,`memory`])),saturation:k(I([`admission`,`account`,`host`]))},jS=[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`})],MS=N({...AS,message:j.check(U(1,1024)),retryable:M}).check(...jS),NS=N({code:kS,message:j.check(U(1,256))}),PS=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({error:MS,ok:A(!1)}),protocolVersion:DS}),FS=J.check(R(/^agent_[a-f0-9]{32}$/u)),IS=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}),LS=N({commandId:J}),RS=N({eventsPruned:k(A(!0)),method:A(`receipt.get`),receipt:Y,result:$v}),zS=J,Bne=J,Vne=e=>{if(e.since===void 0||e.until===void 0)return!0;let t=mm(e.since),n=mm(e.until);return ar(t)&&ar(n)&&hm(t.value)<=hm(n.value)},Hne=e=>N({actor:k(J),afterCursor:k(zS),limit:V.check(z(1),my(32)),method:k(e),since:k(K),until:k(K)}).check(L(Vne,{expected:`an inclusive since/until recorded-at range`})),BS=N({commandId:J,createdAt:K,method:Bne,receiptId:J,state:A(`succeeded`),target:N({id:J,type:J})}),VS=N({items:P(BS).check(H(32)),method:A(`receipt.list`),nextCursor:k(zS)}),X={antigravity:`antigravity`,claudeCode:`claude-code`,codex:`codex-cli`,maiaAgent:`maia-agent`,pi:`pi`},HS=[X.claudeCode,X.codex],Une=[...HS,X.antigravity,X.maiaAgent,X.pi],US=[`approvals`,`attachments`,`contextHandoff`,`fork`,`interrupt`,`planMode`,`policyEnforcement`,`queue`,`resume`,`steer`,`streaming`,`toolsAndMcp`,`turnStart`],WS=/^[!-~]+$/u,Wne=e=>e===`localhost`||e===`[::1]`||/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/u.test(e),GS=j.check(L(e=>{if(e.length>2048||!WS.test(e)||!URL.canParse(e))return!1;let t=new URL(e),n=t.protocol===`https:`||t.protocol===`http:`&&Wne(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`})),Gne=j.check(U(8,4096),R(WS)),KS=j.check(H(64),R(/^MAIA_GATEWAY_API_KEY(?:_[A-Z0-9]+)*$/u)),qS=j.check(U(1,256),R(/^[A-Za-z0-9][A-Za-z0-9._:/@-]*$/u)),JS=j.check(U(1,256),R(/^[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u)),YS=`maia.connection/v1`,XS=I(HS),Kne=I([...HS,`gateway`]),qne=I([`maia-managed`,`system-default`]),ZS=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),QS=I([`disabled`,`enabled`]),$S=V.check(B({maximum:64,minimum:1})),eC=q.check(R(/^[1-9]\d*$/u)),tC=j.check(U(2,4096),L(e=>!e.includes(`\0`)&&(e.startsWith(`/`)||/^[A-Za-z]:\\/u.test(e)))),Jne=F([N({kind:A(`maia-managed`),path:tC}),N({kind:A(`system-default`)})]),nC=e=>j.check(U(1,e)),Yne=N({id:j.check(U(1,64),R(/^[a-z0-9][a-z0-9_]*$/u)),kind:I([`session`,`weekly`,`other`]),resetsAt:k(K),usedPercent:ty.check(B({maximum:100,minimum:0})),windowMinutes:k(V.check(B({maximum:527040,minimum:1})))}),Xne=N({availableCount:V.check(B({maximum:1e3,minimum:0})),nextCreditId:k(nC(128)),nextExpiresAt:k(K)}),Zne=I([`probe_failed`,`signed_out`,`unsupported`]),rC=N({account:k(N({email:k(nC(320)),plan:k(nC(64))})),checkedAt:K,resetCredits:k(Xne),unavailable:k(N({message:k(nC(512)),reason:Zne})),windows:P(Yne).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))),iC=N({configRoot:Jne,connectionId:J,createdAt:K,executor:Kne,gateway:k(N({baseUrl:GS,keyEnv:k(KS)})),limitedUntil:cy(K),maxConcurrentSessions:$S,name:ZS,revision:eC,schemaVersion:A(YS),state:QS,updatedAt:K,usage:k(rC)}).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`})),aC=N({commandId:J,configRootKind:qne,executor:XS,maxConcurrentSessions:k($S),name:ZS}),oC=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1}))}),sC=N({connectionId:J}),cC=N({commandId:J,connectionId:J,expectedRevision:eC,state:QS}),lC=N({commandId:J,connectionId:J,expectedRevision:eC,maxConcurrentSessions:$S}),uC=N({connectionId:J,refresh:k(M)}),dC=N({commandId:J,connectionId:J,expectedRevision:eC,flow:I([`browser`,`device-code`])}),fC=N({apiKey:k(Gne),apiKeyEnv:k(KS),baseUrl:GS,commandId:J,maxConcurrentSessions:k($S),name:ZS}).check(L(e=>e.apiKey===void 0!=(e.apiKeyEnv===void 0),{expected:`exactly one of apiKey and apiKeyEnv`})),pC=N({connectionId:J}),Qne=F([N({method:A(`connection.create`),parameters:aC}),N({method:A(`connection.list`),parameters:oC}),N({method:A(`connection.show`),parameters:sC}),N({method:A(`connection.state.set`),parameters:cC}),N({method:A(`connection.capacity.set`),parameters:lC}),N({method:A(`connection.usage.show`),parameters:uC}),N({method:A(`connection.login.start`),parameters:dC}),N({method:A(`connection.gateway.create`),parameters:fC}),N({method:A(`connection.models.list`),parameters:pC})]),$ne=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),mC=j.check(R(/^sha256:[a-f0-9]{64}$/u)),hC=q.check(R(/^[1-9]\d*$/u)),gC=N({id:J,kind:I([`project`,`workspace`])}),_C=I([`active`,`revoked`]),vC=I([`off`,`rotate`,`single`]),yC=P(J).check(H(32),L(e=>new Set(e).size===e.length,{expected:`unique pool members`})),bC=e=>e.mode===`off`?e.members.length===0:e.mode===`single`?e.members.length===1:e.members.length>0,xC=e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt),SC=N({connectionId:J,createdAt:K,grantId:J.check(R(/^grant_[a-f0-9]{32}$/u)),revision:hC,schemaVersion:A(YS),scope:gC,state:_C,updatedAt:K}).check(L(xC),L(e=>e.state===`active`==(BigInt(e.revision)%2n==1n),{expected:`an active grant at an odd revision`})),CC=N({createdAt:K,members:yC,mode:vC,poolId:J.check(R(/^pool_[a-f0-9]{32}$/u)),revision:hC,schemaVersion:A(YS),scope:gC,updatedAt:K}).check(L(xC),L(bC,{expected:`members that fit the mode`})),wC={afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),scope:k(gC)},TC=N({...wC,connectionId:k(J),state:k(_C)}),EC=N(wC),DC=e=>new Set(e).size===e.length,OC=N({items:P(SC).check(H(100)),method:A(`connection.grant.list`),nextCursor:k(J)}).check(L(e=>DC(e.items.map(e=>e.grantId))&&(e.nextCursor===void 0||e.items.length>0))),kC=N({items:P(CC).check(H(100)),method:A(`connection.pool.list`),nextCursor:k(J)}).check(L(e=>DC(e.items.map(e=>e.poolId))&&(e.nextCursor===void 0||e.items.length>0))),AC={inputDigest:mC,proof:$ne},jC={actorId:J,expectedRevision:q,expiresAt:K,issuedAt:K,...AC},MC=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),NC={commandId:J,connectionId:J,granted:M,scope:gC},PC={commandId:J,members:yC,mode:vC,scope:gC},FC={actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),expectedRevision:q,inputDigest:mC,receipt:Y},IC=N(NC),LC=N({...NC,expectedRevision:q,...AC}),RC=N(PC).check(L(bC)),zC=N({...PC,expectedRevision:q,...AC}).check(L(bC)),BC=N({...NC,...jC,current:k(SC),method:A(`connection.grant.set.preview`)}).check(L(MC)),VC=N({...PC,...jC,current:k(CC),method:A(`connection.pool.set.preview`)}).check(L(MC),L(bC)),HC=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,UC=N({...FC,grant:SC,method:A(`connection.grant.set.confirm`)}).check(L(e=>HC({...e,record:e.grant,target:{id:e.grant.grantId,type:`connection_grant`}}))),WC=N({...FC,method:A(`connection.pool.set.confirm`),pool:CC}).check(L(e=>HC({...e,record:e.pool,target:{id:e.pool.poolId,type:`connection_pool`}}))),ere=F([N({method:A(`connection.grant.list`),parameters:TC}),N({method:A(`connection.grant.set.preview`),parameters:IC}),N({method:A(`connection.grant.set.confirm`),parameters:LC}),N({method:A(`connection.pool.list`),parameters:EC}),N({method:A(`connection.pool.set.preview`),parameters:RC}),N({method:A(`connection.pool.set.confirm`),parameters:zC})]),tre=F([OC,BC,UC,kC,VC,WC]),GC=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),nre=N({connection:iC,login:I([`signed-in`,`signed-out`,`unknown`]),models:P(qS).check(H(512))}),rre=64,KC=N({capabilities:P(I(US)).check(H(US.length)),connections:P(nre).check(H(256)),executor:GC,unavailable:k(N({reason:j.check(U(1,512))}))}),qC=k(M),JC=N({refresh:qC}),YC=N({executor:GC,refresh:qC}),XC=N({executors:P(KC).check(H(rre)),method:A(`connection.executors.list`)}),ZC=N({executor:KC,method:A(`connection.executors.show`)}),ire=F([N({method:A(`connection.executors.list`),parameters:JC}),N({method:A(`connection.executors.show`),parameters:YC})]),are=F([XC,ZC]),QC=e=>j.check(U(1,e)),$C={commandId:J,connection:iC,delivery:I([`duplicate`,`new`]),receipt:Y},ore=N({...$C,method:A(`connection.create`)}),sre=N({...$C,keyCustody:I([`kept`,`referenced`,`stored`]),method:A(`connection.gateway.create`)}),cre=N({...$C,expectedRevision:eC,method:A(`connection.state.set`)}),lre=N({...$C,expectedRevision:eC,method:A(`connection.capacity.set`)}),ure=N({authUrl:k(QC(2048)),expiresAt:K,loginId:QC(128),userCode:k(QC(64)),verificationUrl:k(QC(2048))}),dre=N({...$C,expectedRevision:eC,login:ure,method:A(`connection.login.start`)}),ew=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,tw=e=>BigInt(e.connection.revision)===BigInt(e.expectedRevision)+1n,nw=ore.check(L(e=>ew(e)&&e.connection.revision===`1`)),rw=sre.check(L(e=>ew(e)&&e.connection.revision===`1`&&e.connection.executor===`gateway`)),fre=N({displayName:k(JS),id:qS}),iw=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)),aw=cre.check(L(e=>ew(e)&&tw(e))),ow=lre.check(L(e=>ew(e)&&tw(e))),sw=dre.check(L(e=>ew(e)&&tw(e)&&(e.login.authUrl!==void 0||e.login.userCode!==void 0&&e.login.verificationUrl!==void 0))),cw=N({connection:iC,method:A(`connection.usage.show`)}).check(L(e=>e.connection.usage!==void 0)),lw=N({items:P(iC).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))),uw=N({connection:iC,method:A(`connection.show`)}),pre=F([ow,nw,rw,lw,sw,iw,uw,aw,cw]),dw=j.check(R(/^\d[0-9A-Za-z.+-]{0,63}$/u)),mre=j.check(R(/^[a-z0-9][a-z0-9._-]{0,63}$/u)),hre=j.check(R(/^[A-Za-z0-9.[\]:-]{1,260}$/u)),fw=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),pw=j.check(R(/^sha256:[a-f0-9]{64}$/u)),mw=I([`custom-endpoint`,`none`,`unknown`,`vendor-login`]),hw=N({credential:I([`env-key`,`helper`]),hint:k(j.check(U(1,2300),R(/^[\u0020-\u007E]+$/u))),host:hre}),gre=F([N({found:A(!1)}),N({found:A(!0),onNodePath:M,path:tC,version:k(dw)})]),_re=N({connectionId:J,name:ZS,state:QS}),gw=I([`notify`,`off`]),_w=N({checkedAt:K,source:A(`npm-registry`),version:dw}),vre=N({approved:k(N({launchable:I([`unknown`,`yes`]),version:k(dw)})),available:k(_w),policy:gw,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`})),vw=N({accountKind:k(mre),auth:mw,binary:gre,connection:k(_re),endpoint:k(hw),executableApproved:M,executor:XS,upkeep:k(vre),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`})),yw=e=>oy([e,e]),bw=e=>{let t=e.executors??e.items??[];return t[0]?.executor===X.claudeCode&&t[1]?.executor===X.codex},xw=N({upkeep:k(M)}),Sw=N({executors:yw(vw),method:A(`connection.detect`)}).check(L(bw)),yre=I([`approval-unavailable`,`auth-unknown`,`env-key-endpoint`,`missing`,`name-taken`,`not-on-node-path`,`settings-endpoint`,`signed-out`]),bre=F([N({action:A(`create`),maxConcurrentSessions:$S,name:ZS}),N({action:A(`existing`),connectionId:J,maxConcurrentSessions:$S,name:ZS})]),xre=N({action:I([`approve`,`existing`]),path:tC,version:k(dw)}),Sre=N({auth:mw,connection:k(bre),endpoint:k(hw),executable:k(xre),executor:XS,reason:k(yre)}).check(L(e=>e.reason===void 0==(e.connection!==void 0&&e.executable!==void 0),{expected:`a planned item or a skip reason`})),Cw={commandId:J,maxConcurrentSessions:k($S)},ww=N(Cw),Tw=N({...Cw,inputDigest:pw,proof:fw}),Ew=N({actorId:J,commandId:J,expiresAt:K,inputDigest:pw,issuedAt:K,items:yw(Sre),maxConcurrentSessions:k($S),method:A(`connection.system.preview`),proof:fw}).check(L(bw),L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),Cre=N({approvalReceipt:k(Y),connection:iC,connectionReceipt:k(Y),executor:XS}).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))),Dw=N({actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),inputDigest:pw,items:P(Cre).check(H(2)),method:A(`connection.system.confirm`)}).check(L(e=>new Set(e.items.map(e=>e.executor)).size===e.items.length)),Ow={commandId:J,executor:XS,policy:gw},kw=iy(j,Qv),Aw=N({executors:yw(N({available:k(_w),executor:XS,refreshed:M})),method:A(`connection.upkeep.refresh`)}).check(L(bw)),jw=N(Ow),Mw=N({...Ow,inputDigest:pw,proof:fw}),Nw=N({actorId:J,authorizationRevision:V.check(z(1)),commandId:J,current:gw,executor:XS,expiresAt:K,inputDigest:pw,issuedAt:K,method:A(`connection.upkeep.preview`),policy:gw,policyRevision:V.check(z(0)),proof:fw}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),Pw=N({actorId:J,commandId:J,delivery:I([`duplicate`,`new`]),executor:XS,inputDigest:pw,method:A(`connection.upkeep.confirm`),policy:gw,policyRevision:V.check(z(1)),receipt:Y}),wre=F([N({method:A(`connection.detect`),parameters:xw}),N({method:A(`connection.upkeep.refresh`),parameters:kw}),N({method:A(`connection.upkeep.preview`),parameters:jw}),N({method:A(`connection.upkeep.confirm`),parameters:Mw}),N({method:A(`connection.system.preview`),parameters:ww}),N({method:A(`connection.system.confirm`),parameters:Tw})]),Tre=F([Sw,Aw,Nw,Pw,Ew,Dw]),Ere=F([...Qne.members,...wre.members,...ere.members,...ire.members]),Dre=F([...pre.members,...Tre.members,...tre.members,...are.members]),Ore=`maia.approval/v1`,Fw=8192,Iw=1024,Lw=4096,Rw=new TextEncoder,zw=9,Bw=10,Vw=13,Hw=31,Uw=127,Ww=159,Gw=e=>Array.from({length:e.length},(e,t)=>t).some(t=>{let n=e.codePointAt(t)??0;return n===Vw?e.codePointAt(t+1)!==Bw:n===zw||n===Bw?!1:n<=Hw||n>=Uw&&n<=Ww}),Kw=/[\p{Cf}\u2028\u2029]/u,qw=e=>j.check(gy(1),L(t=>Rw.encode(t).byteLength<=e&&!Gw(t)&&!Kw.test(t),{expected:`text of at most ${String(e)} UTF-8 bytes`})),Jw=j.check(R(/^sha256:[a-f0-9]{64}$/u)),Yw=I([`command`,`file_change`,`question`,`tool`]),Xw=I([`approved`,`answered`,`cancelled`,`denied`,`expired`,`pending`]),Zw=I([`answer`,`approve`,`approve_for_session`,`deny`]),Qw=k(P(N({label:qw(240),optionId:j.check(R(/^[a-z][a-z0-9_-]{0,31}$/u))})).check(U(2,8))),$w=q.check(R(/^[12]$/u)),eT=N({actorId:J,answer:k(qw(Lw)),forSession:k(A(!0)),guardRevision:k(q),reason:k(qw(Iw)),resolvedAt:K}),tT=({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`,nT=N({approvalId:J,createdAt:K,executor:I(Une),expiresAt:K,forSessionOffered:M,kind:Yw,options:Qw,reason:k(qw(Iw)),requestDigest:Jw,resolution:k(eT),revision:$w,schemaVersion:A(Ore),sessionId:J,status:Xw,summary:qw(Fw),turnId:J,workspaceId:J}).check(L(e=>Date.parse(e.expiresAt)>Date.parse(e.createdAt)&&(e.options===void 0||e.kind===`question`)&&tT(e),{expected:`a consistent approval lifecycle`})),rT=N({approvalId:J,expiresAt:K,kind:Yw,options:Qw,summary:k(qw(Fw))}),iT=N({limit:V.check(B({maximum:50,minimum:1})),pendingOnly:k(M),sessionId:k(J)}),aT=N({approvalId:J}),oT={answer:k(qw(Lw)),commandId:J,decision:Zw,reason:k(qw(Iw)),requestDigest:Jw},sT=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`}),cT=N({approvalId:J,...oT}).check(sT),lT=F([N({method:A(`approval.list`),parameters:iT}),N({method:A(`approval.respond`),parameters:cT}),N({method:A(`approval.show`),parameters:aT})]),uT=N({items:P(nT).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`})),dT=N({approval:nT,method:A(`approval.show`)}),fT=N({approval:nT,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`})),pT=F([uT,fT,dT]),mT=4096,hT=4096,gT=new TextEncoder,_T=(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)},vT=(e,t)=>{if(t.dependsOn.length>8)throw TypeError(`A Task has too many direct dependencies: \`${t.clientKey}\`.`);return t.dependsOn.reduce((n,r)=>(_T(e,t,r),n+1),0)},yT=(e,t)=>{let n={byKey:t,dependentCounts:new Map,edgeKeys:new Set};if(e.reduce((e,t)=>e+vT(n,t),0)>128)throw TypeError(`The Task graph contains too many dependency edges.`)},bT=(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,bT(e,n)),0);return e.visiting.delete(t),e.heights.set(t,i),i},xT=(e,t)=>{let n={byKey:t,heights:new Map,visiting:new Set};if(bT(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.`)},ST=e=>{if(e.reduce((e,t)=>e+gT.encode(t.objective).byteLength,0)>32768)throw TypeError(`The Run objective byte total exceeds 32768 bytes.`)},CT=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),wT=e=>{if(e.tasks.length===0||e.tasks.length>32)throw TypeError(`The Task graph contains an invalid Task count.`);let t=CT(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.`);yT(e.tasks,t),xT(e,t),ST(e.tasks)},TT=e=>{let t=CT(e);yT(e,t);let n={byKey:t,heights:new Map,visiting:new Set};if(e.reduce((e,t)=>Math.max(e,bT(n,t.clientKey)),0)>8)throw TypeError(`The Task graph exceeds the maximum depth.`)},ET=e=>{if(e.length===0||e.length>32)throw TypeError(`The Task graph contains an invalid Task count.`);TT(e),ST(e)},DT=e=>{try{return ET(e),!0}catch{return!1}},OT=e=>{try{return wT(e),!0}catch{return!1}},kT=`maia.orchestration/v1`,AT=`maia.orchestration-message/v1`,jT=new TextEncoder,MT=(e,t,n)=>j.check(L(n=>{let r=jT.encode(n).byteLength;return r>=e&&r<=t},{expected:n})),NT=j.check(U(1,64),R(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u)),PT=MT(1,mT,`a Task objective encoded as 1 to 4096 UTF-8 bytes`),FT=MT(1,128,`a Message subject encoded as 1 to 128 UTF-8 bytes`),IT=MT(1,hT,`a Message body encoded as 1 to 4096 UTF-8 bytes`),LT=A(1),RT=N({id:J,kind:A(`run`)}),zT=N({id:J,kind:A(`dispatch`)}),BT=F([RT,zT]),VT=N({clientKey:NT,dependsOn:P(NT).check(H(8)),objective:PT}),HT=N({dispatchTaskKey:NT,rootTaskKey:NT,tasks:P(VT).check(gy(1),H(32))}),UT={clientKey:NT,createdAt:K,dependencyTaskIds:P(J).check(H(8)),id:J,revision:q,runId:J,schemaVersion:A(kT),state:I([`pending`,`active`,`waiting-question`,`failed`]),updatedAt:K,workspaceId:J},WT=N(UT),GT=N({...UT,objective:PT}),KT=N({coordinator:N({actorId:A(`actor_local_user`),epoch:LT}),createdAt:K,dispatchTaskId:J,id:J,revision:q,rootTaskId:J,schemaVersion:A(kT),state:I([`active`,`waiting-question`,`failed`]),terminalId:J,updatedAt:K,workspaceId:J}),qT=N({createdAt:K,id:J,ordinal:A(1),revision:q,runId:J,schemaVersion:A(kT),state:I([`active`,`waiting-question`,`failed`]),taskId:J,updatedAt:K}),JT=F([N({code:A(`terminal_containment_unsupported`),platform:I([`darwin`,`linux`])}),N({code:A(`platform_unsupported`),platform:I([`win32`,`other`])})]),YT={attemptId:J,createdAt:K,id:J,revision:q,runId:J,schemaVersion:A(kT),taskId:J,terminalId:J,updatedAt:K},XT=F([N({...YT,state:A(`active`)}),N({...YT,state:A(`waiting-question`)}),N({...YT,failure:JT,state:A(`failed`)})]),ZT=N({contentBytes:q,createdAt:K,deliveryCount:q,headSequence:q,id:J,owner:BT,revision:q,runId:J,schemaVersion:A(kT),updatedAt:K}).check(L(e=>e.owner.kind===`dispatch`||e.owner.id===e.runId,{expected:`a run Mailbox owned by its exact Run`})),QT={body:IT,createdAt:K,digest:j.check(U(64,64),R(/^[a-f0-9]{64}$/u)),id:J,runId:J,schemaVersion:A(AT),sender:N({actorId:A(`actor_local_user`),kind:A(`run-coordinator`),runId:J}),subject:FT},$T=F([N({...QT,recipient:zT,type:A(`dispatch`)}),N({...QT,questionId:J,recipient:RT,type:A(`question`)}),N({...QT,questionId:J,recipient:zT,type:A(`reply`)}),N({...QT,recipient:RT,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`})),eE={attemptCount:V.check(z(0),my(65535)),createdAt:K,firstDeliveredAt:k(K),id:J,lastDeliveredAt:k(K),mailboxId:J,message:$T,sequence:q},tE=N({...eE,state:A(`pending`)}),nE=N({...eE,acknowledgedAt:K,acknowledgingActorId:A(`actor_local_user`),state:A(`acknowledged`)}),rE=F([tE,nE]),iE={askMessageId:J,attemptId:J,body:IT,createdAt:K,dispatchId:J,id:J,revision:q,runId:J,schemaVersion:A(kT),subject:FT,taskId:J,updatedAt:K},aE=F([N({...iE,state:A(`open`)}),N({...iE,answer:IT,replyMessageId:J,state:A(`answered`)}),N({...iE,state:A(`cancelled`)})]),oE=N({attempt:qT,dispatch:XT,mailboxes:P(ZT).check(U(2,2)),question:k(aE),run:KT,tasks:P(GT).check(gy(1),H(32))}),sE=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},cE=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)))},lE=e=>OT({dispatchTaskKey:e.run.dispatchTaskId,rootTaskKey:e.run.rootTaskId,tasks:e.tasks.map(e=>({clientKey:e.id,dependsOn:e.dependencyTaskIds,objective:e.objective}))}),uE=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,dE=(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,fE=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&&lE(e)&&uE(e)&&cE(e)&&dE(e,t.id)&&sE(e)},pE=(e,t)=>t.every(e=>e===`failed`)&&e.tasks.every(e=>e.state===`failed`)&&e.question?.state!==`open`,mE=(e,t,n)=>t.every(e=>e===`waiting-question`)&&e.tasks.every(e=>e.id===n||e.state===`pending`)&&e.question?.state===`open`,hE=(e,t,n)=>t.every(e=>e===`active`)&&e.tasks.every(e=>e.id===n||e.state===`pending`)&&e.question?.state!==`open`,gE=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`?pE(e,n):e.run.state===`waiting-question`?mE(e,n,t.id):hE(e,n,t.id)},_E=oE.check(L(e=>fE(e)&&gE(e),{expected:`an exact local-v1 orchestration aggregate topology`})),vE=N({commandId:J,expectedRevision:A(`0`),graph:HT,terminalId:J,workspaceId:J}),yE=N({runId:J}),bE=N({afterCursor:q,limit:V.check(z(1),my(100)),workspaceId:J}),xE=N({afterCursor:q,limit:V.check(z(1),my(32)),runId:J}),SE=N({runId:J,taskId:J}),CE=N({runId:J}),wE=N({coordinatorEpoch:LT,limit:V.check(z(1),my(16)),owner:BT,runId:J}),TE=N({commandId:J,coordinatorEpoch:LT,deliveryId:J,expectedMailboxRevision:q,owner:BT,runId:J}),EE={commandId:J,coordinatorEpoch:LT,dispatchId:J,expectedDispatchRevision:q,expectedRunRevision:q,runId:J},DE=N({...EE,body:IT,subject:FT}),OE=N({...EE,answer:IT,expectedQuestionRevision:q,questionId:J}),kE=N({...EE,expectedQuestionRevision:q,questionId:J}),AE=N(EE),jE=e=>e.receipt.actorId===`actor_local_user`&&e.receipt.method===e.method&&e.receipt.target.type===e.targetType&&e.receipt.target.id===e.targetId,ME=(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,NE=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&&ME(e.delivery,n)},PE=N({aggregate:_E,delivery:I([`new`,`duplicate`]),initialDelivery:rE,method:A(`run.create`),receipt:Y}).check(L(e=>NE({aggregate:e.aggregate,delivery:e.initialDelivery,messageType:`dispatch`,ownerKind:`dispatch`})&&jE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Run-create Delivery matching its Dispatch Mailbox`})),FE=N({aggregate:_E,method:A(`run.show`)}),IE=N({items:P(KT).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`})),LE=N({items:P(WT).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`})),RE=N({method:A(`run.task.show`),runId:J,task:GT,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`})),zE=N({dispatch:XT,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`})),BE=N({items:P(tE).check(H(16)),mailbox:ZT,method:A(`run.inbox.check`)}).check(L(e=>e.items.every(t=>ME(t,e.mailbox)),{expected:`inbox-check Deliveries matching the selected Mailbox`})),VE=N({delivery:nE,mailbox:ZT,method:A(`run.inbox.ack`),receipt:Y}).check(L(e=>ME(e.delivery,e.mailbox),{expected:`an inbox acknowledgement matching its Mailbox`}),L(e=>jE({method:e.method,receipt:e.receipt,targetId:e.mailbox.id,targetType:`orchestration-mailbox`}),{expected:`an inbox acknowledgement matching its Mailbox`})),HE={aggregate:_E,receipt:Y},UE=N({...HE,delivery:rE,method:A(`run.question.open`)}).check(L(e=>NE({aggregate:e.aggregate,delivery:e.delivery,messageType:`question`,ownerKind:`run`})&&jE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-open Delivery matching the Run Mailbox`})),WE=N({...HE,delivery:rE,method:A(`run.question.reply`)}).check(L(e=>NE({aggregate:e.aggregate,delivery:e.delivery,messageType:`reply`,ownerKind:`dispatch`})&&jE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-reply Delivery matching the Dispatch Mailbox`})),GE=N({...HE,method:A(`run.question.cancel`)}).check(L(e=>jE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Question-cancel receipt matching its Run`})),KE=N({aggregate:_E,delivery:rE,method:A(`run.dispatch.settle-terminal`),receipt:Y}).check(L(e=>NE({aggregate:e.aggregate,delivery:e.delivery,messageType:`dispatch-settled`,ownerKind:`run`})&&jE({method:e.method,receipt:e.receipt,targetId:e.aggregate.run.id,targetType:`orchestration-run`}),{expected:`a Dispatch settlement matching the Run Mailbox`})),qE=F([N({method:A(`run.create`),parameters:vE}),N({method:A(`run.list`),parameters:bE}),N({method:A(`run.show`),parameters:yE}),N({method:A(`run.task.list`),parameters:xE}),N({method:A(`run.task.show`),parameters:SE}),N({method:A(`run.dispatch.show`),parameters:CE}),N({method:A(`run.inbox.check`),parameters:wE}),N({method:A(`run.inbox.ack`),parameters:TE}),N({method:A(`run.question.open`),parameters:DE}),N({method:A(`run.question.reply`),parameters:OE}),N({method:A(`run.question.cancel`),parameters:kE}),N({method:A(`run.dispatch.settle-terminal`),parameters:AE})]),JE=F([PE,IE,FE,LE,RE,zE,BE,VE,UE,WE,GE,KE]);G(VT),G(HT),G(GT),G(WT),G(KT),G(qT),G(XT),G(ZT),G($T),G(rE),G(tE),G(nE),G(aE);var YE=G;YE(vE),YE(yE),YE(bE),YE(xE),YE(SE),YE(CE),YE(wE),YE(TE),YE(DE),YE(OE),YE(kE),YE(AE);var XE=YE(PE),ZE=YE(FE),QE=YE(IE),$E=YE(LE),eD=YE(RE),tD=YE(zE),nD=YE(BE),rD=YE(VE),iD=YE(UE),aD=YE(WE),oD=YE(GE),sD=YE(KE),cD=`maia.board/v1`,lD=65536,uD=64,dD=128,fD=256,pD=64,mD=new TextEncoder,hD=j.check(U(1,128),R(/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*){0,3}$/u)),gD=I([`waiting`,`ready`,`claimed`,`blocked`,`completed`,`failed`,`cancelled`]),_D=N({id:J,kind:I([`person`,`bot`])}),vD=j.check(U(1,pD),R(/^[a-z0-9][a-z0-9._-]*$/u)),yD=F([_D,N({agent:vD,kind:A(`session`),sessionId:k(J),via:_D})]),bD=N({key:j.check(U(1,uD),R(/^[a-z][a-z0-9_.-]*$/u)),value:j.check(H(dD),R(/^[^\p{Cc}]*$/u))}),xD=N({kind:I([`pull_request`,`commit`,`session`,`node`]),target:j.check(U(1,fD),R(/^[^\s\p{Cc}]+$/u))}),SD=j.check(U(1,lD),L(e=>mD.encode(e).byteLength<=65536&&!e.includes(`\0`),{expected:`message text of at most ${String(lD)} UTF-8 bytes without NUL`})),CD=N({createdAt:K,id:J,schemaVersion:A(cD),workspaceId:J}),wD=N({boardId:J,createdAt:K,id:J,path:hD,schemaVersion:A(cD),state:k(gD)}),TD=N({author:k(yD),createdAt:K,id:J,labels:P(bD).check(H(256)),links:P(xD).check(H(40)),schemaVersion:A(cD),text:SD,threadId:J}),ED=N({labels:V.check(B({maximum:256,minimum:1})),links:V.check(B({maximum:40,minimum:1})),messageBytes:V.check(B({maximum:lD,minimum:1}))}),DD=3600,OD=8192,kD=8,AD=new TextEncoder,jD=q.check(R(/^[1-9]\d*$/u)),MD=j.check(U(16,128),R(/^[A-Za-z0-9_-]+$/u)),ND=j.check(L(e=>{let t=AD.encode(e).byteLength;return t>=1&&t<=8192&&!e.includes(`\0`)},{expected:`text encoded as 1 to ${String(OD)} UTF-8 bytes without NUL`}),H(OD)),PD=P(bD).check(H(256)),FD=P(J).check(H(kD),L(e=>new Set(e).size===e.length,{expected:`task ids named at most once`})),ID=V.check(B({maximum:DD,minimum:30})),LD=N({claimant:yD,claimedAt:K,leaseExpiresAt:K}),RD=N({claimedAt:K,id:J,leaseExpiresAt:K,state:A(`claimed`),title:j.check(U(1,120))}),zD={assignee:k(FS),author:k(yD),claim:k(LD),createdAt:K,id:J,labels:PD,needs:k(FD.check(gy(1))),ownedBy:I([`board`,`run-ledger`]),path:hD,revision:jD,schemaVersion:A(cD),state:gD,title:j.check(U(1,120)),updatedAt:K,workspaceId:J},BD=e=>e.ownedBy===`run-ledger`?e.claim===void 0:e.state===`claimed`==(e.claim!==void 0),VD=N(zD).check(L(BD,{expected:`a claim exactly on a claimed board task`})),HD=N({...zD,reason:k(ND),result:k(ND),text:SD}).check(L(e=>BD(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`})),UD={as:k(vD)},WD={commandId:J,expectedRevision:jD},GD={...UD,commandId:J,labels:k(PD),path:hD,text:SD,workspaceId:J},KD=N({...GD,needs:k(FD)}),qD=N({...UD,commandId:J,expectedRevision:k(jD),labels:k(PD),leaseSeconds:k(ID),path:k(hD),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`})),JD={...UD,...WD,claimToken:MD,taskId:J},YD=N({...JD,leaseSeconds:k(ID)}),XD=N(JD),ZD=N({...JD,result:k(ND)}),QD=N({...JD,reason:ND}),$D=N({...UD,...WD,taskId:J}),eO=$D,tO=N({afterCursor:k(J),labels:k(PD),limit:k(V.check(B({maximum:100,minimum:1}))),path:k(hD),projectId:k(J),sessionId:k(J),state:k(gD),workspaceId:k(J)}).check(L(e=>e.workspaceId!==void 0||e.sessionId!==void 0||e.projectId!==void 0,{expected:`a workspaceId, sessionId or projectId`})),nO={afterCursor:k(J),limit:k(V.check(B({maximum:100,minimum:1})))},rO=V.check(z(0)),iO=N({...nO,taskId:J}),aO={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y,task:HD},oO=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,sO=(e,t)=>N({...aO,method:A(e)}).check(L(e=>oO(e)&&t(e.task),{expected:`a ${e} result bound to its receipt`})),cO=e=>t=>t.state===e,lO=e=>e.state===`ready`||e.state===`waiting`,uO=sO(`board.task.create`,e=>lO(e)&&e.revision===`1`),dO=N({...aO,claimToken:MD,method:A(`board.task.claim`)}).check(L(e=>oO(e)&&e.task.claim!==void 0,{expected:`a claimed task bound to its receipt`})),fO=sO(`board.task.renew`,cO(`claimed`)),pO=sO(`board.task.release`,cO(`ready`)),mO=sO(`board.task.complete`,cO(`completed`)),hO=sO(`board.task.fail`,cO(`failed`)),gO=sO(`board.task.cancel`,cO(`cancelled`)),_O=sO(`board.task.reopen`,lO),vO=N({items:P(VD).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`})),yO=N({messages:P(TD).check(H(100)),method:A(`board.task.show`),nextCursor:k(J),replyCount:rO,task:HD}).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`})),bO=(e,t)=>N({method:A(e),parameters:t}),xO=F([bO(`board.task.cancel`,$D),bO(`board.task.claim`,qD),bO(`board.task.complete`,ZD),bO(`board.task.create`,KD),bO(`board.task.fail`,QD),bO(`board.task.list`,tO),bO(`board.task.release`,XD),bO(`board.task.renew`,YD),bO(`board.task.reopen`,eO),bO(`board.task.show`,iO)]),SO=F([gO,dO,mO,uO,hO,vO,pO,fO,_O,yO]),CO=N({...UD,assignee:k(FS),commandId:J,expectedRevision:jD,pool:k(A(!0)),taskId:J}).check(L(e=>e.assignee===void 0==(e.pool===!0),{expected:`assignee or pool, exactly one`})),wO=N({...UD,commandId:J,needs:k(FD),threadId:J,workspaceId:J}),TO=N({...UD,commandId:J,expectedRevision:jD,needs:FD,taskId:J}),EO=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`),DO=(e,t)=>N({commandId:J,delivery:I([`duplicate`,`new`]),method:A(e),receipt:Y,task:HD}).check(L(e=>EO(e)&&t(e),{expected:`a ${e} result bound to its receipt`})),OO=DO(`board.task.assign`,()=>!0),kO=DO(`board.task.promote`,({task:e})=>e.revision===`1`),AO=DO(`board.task.needs.replace`,()=>!0),jO=F([bO(`board.task.assign`,CO),bO(`board.task.needs.replace`,TO),bO(`board.task.promote`,wO)]),MO=F([OO,AO,kO]),NO=`maia.node-api/v1`,PO=`/api/v1/operations`,FO=`/api/v1/observations`,IO=`POST`,LO=`application/json`,RO=`/panel/session`,zO=`/panel/api/operations`,BO=`x-maia-panel-session`,VO=`coordinator`,HO=1048576,UO=2048,WO=`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.maia-agent,integration.apply.pi,integration.apply.pi-rpc,integration.plan.antigravity,integration.plan.claude-code,integration.plan.codex,integration.plan.maia-agent,integration.plan.pi,integration.plan.pi-rpc,integration.remove.antigravity,integration.remove.claude-code,integration.remove.codex,integration.remove.maia-agent,integration.remove.pi,integration.remove.pi-rpc,integration.status.antigravity,integration.status.claude-code,integration.status.codex,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(`,`),GO=Object.freeze([`node.status`,`session.list`,`session.show`,`turn.show`,`voice.managed-turn.preview`]),KO=[`node.shutdown`,`node.status`],qO=WO,JO=[`events.watch`,`observe.events`,`session.attach`],YO=new Set(KO),XO=qO.map(e=>({channel:YO.has(e)?`control`:`ordinary`,httpMethod:IO,operationId:e,path:PO,transport:`http`})),ZO=JO.map(e=>({operationId:e,path:FO,transport:`websocket`}));Object.freeze([...XO,...ZO]);var QO=32,$O=131072,ek=HO-4096,tk=64,nk=new TextEncoder,rk=j.check(U(1,tk),R(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u)),ik=N({assignee:k(FS),key:rk,labels:k(PD),needs:k(FD),path:hD,text:SD}),ak=e=>e.reduce((e,t)=>e+nk.encode(t.text).byteLength,0),ok=e=>nk.encode(JSON.stringify(e)).byteLength,sk=N({...UD,commandId:J,tasks:P(ik).check(gy(1),H(QO),L(e=>ak(e)<=$O,{expected:`plan texts of at most ${String($O)} UTF-8 bytes in all`}),L(e=>ok(e)<=ek,{expected:`plan tasks of at most ${String(ek)} UTF-8 bytes as compact JSON`})),workspaceId:J}),ck=N({id:J,key:rk,path:hD,revision:A(`1`),state:I([`ready`,`waiting`])}),lk=N({commandId:J,delivery:I([`duplicate`,`new`]),method:A(`board.task.plan`),receipt:Y,tasks:P(ck).check(gy(1),H(QO))}).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`})),uk=bO(`board.task.plan`,sk),dk=N({author:k(yD),createdAt:K,excerpt:j.check(U(1,120)),id:J,lastActivityAt:K,path:hD,replyCount:rO,schemaVersion:A(cD),state:k(gD),workspaceId:J}),fk=N(GD),pk=N({...UD,commandId:J,labels:k(PD),text:SD,threadId:J}),mk=N({...UD,afterCursor:k(J),limit:k(V.check(B({maximum:100,minimum:1}))),path:hD,workspaceId:J}),hk=N({...UD,...nO,threadId:J}),gk={commandId:J,delivery:I([`duplicate`,`new`]),message:TD,receipt:Y},_k=e=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===`board_thread`&&e.receipt.target.id===e.message.threadId,vk=N({...gk,method:A(`board.message.post`),thread:wD}).check(L(e=>_k(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`})),yk=N({...gk,method:A(`board.message.reply`)}).check(L(e=>_k(e)&&e.message.id!==e.message.threadId,{expected:`a reply result with a message after the root and its receipt`})),bk=N({actor:yD,items:P(dk).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`})),xk=N({actor:yD,messages:P(TD).check(H(100)),method:A(`board.thread.show`),nextCursor:k(J),task:k(VD),thread:dk}).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`})),kre=F([bO(`board.message.post`,fk),bO(`board.message.reply`,pk),bO(`board.path.read`,mk),bO(`board.thread.show`,hk)]),Are=F([vk,yk,bk,xk]),Sk=e=>({parse:e,safeParse(t){try{return{data:e(t),success:!0}}catch(e){return{error:e,success:!1}}}});G(DS),G(J),G(OS),G(Lne);var jre=G(Rne),Mre=G(zne),Nre=e=>Sk(t=>{let n=jre.parse(t);return{...n,payload:e.parse(n.payload)}}),Ck=Sk(e=>e),wk=Nre(Ck),Tk=(e=>Sk(t=>{let n=Mre.parse(t);return{...n,payload:{...n.payload,result:e.parse(n.payload.result)}}}))(Ck);G(kS),G(MS);var Ek=G(PS),Pre=`maia.event.v2`,Fre=65536,Ire=/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*){1,4}$/u,Lre=9223372036854775807n,Dk=e=>/^[0-9]{1,19}$/u.test(e)&&BigInt(e)<=Lre,Ok=j.check(R(/^[1-9][0-9]{0,18}$/u),L(Dk,{expected:`a 64-bit sequence`})),kk=j.check(R(/^(?:0|[1-9][0-9]{0,18})$/u),L(Dk,{expected:`a 64-bit sequence`})),Rre=32,Ak=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},zre=(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)=>jk(e[r],t+1))},jk=(e,t)=>{if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return e;if(t>=Rre)throw Error(`payload too deep`);if(Array.isArray(e))return zre(e,t);if(!Ak(e)||Object.getOwnPropertySymbols(e).length>0)throw Error(`payload is not plain JSON`);return Object.fromEntries(Object.keys(e).map(n=>[n,jk(e[n],t+1)]))},Bre=new hh({message:`Expected a plain JSON object`}),Vre=$v.pipe(uy(iy(j,$v),{decode:Fh(e=>If({catch:()=>Bre,try:()=>{if(!Ak(e))throw Error(`not an object`);return jk(e,0)}})),encode:Nh()})),Hre=K.check(R(/\.[0-9]{3}Z$/u)),Mk=j.check(R(/^event_[0-7][0-9A-HJKMNP-TV-Z]{25}$/u)),Nk=j.check(H(128),R(Ire)),Ure=Ok,Pk=kk,Wre=N({id:J,seq:Ok,type:J}),Gre=N({command:k(J),id:Mk,kind:Nk,node:J,payload:Vre,schemaVersion:A(Pre),seq:Ok,source:J,subject:Wre,ts:Hre,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:kk});var Fk=j.check(R(/^ev1\.[A-Za-z0-9_-]{16,2048}$/u));j.check(R(/^evf1\.[A-Za-z0-9_-]{16,16384}$/u));var Kre=F([Fk,Mk,Ure]),qre=N({kinds:k(P(Nk).check(gy(1),H(16))),limit:k(V.check(B({maximum:100,minimum:1}))),since:k(Kre),subject:k(N({id:J,type:J}))}),Ik={head:Pk,method:A(`events.read`),oldest:Pk},Jre=F([N({...Ik,events:P(Gre),next:Fk,status:A(`ok`)}),N({...Ik,next:Fk,reason:I([`cursor_expired`,`epoch_changed`,`position_ahead`,`position_pruned`]),status:A(`cursor_reset_required`)}),N({method:A(`events.read`),status:A(`invalid_cursor`)})]),Yre=N({method:A(`events.read`),parameters:qre}),Lk=I([`stopped`,`waiting_approval`,`working`,`idle`]),Xre=N({approvalId:k(J),from:cy(Lk),to:Lk}).check(L(e=>e.to===`waiting_approval`==(e.approvalId!==void 0)),L(e=>e.from!==e.to||e.to===`waiting_approval`)),Rk=I([`starting`,`working`,`compacting`,`rate_limited`,`idle`,`question`,`approval`,`error`,`done`,`ended`,`unknown`]),Zre=N({approvalId:k(J),from:cy(Rk),to:Rk}).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`})),Qre=`maia.hold/v1`,zk=J.check(R(/^hold_[a-f0-9]{32}$/u)),Bk=zk,Vk=q.check(R(/^[1-9]\d*$/u)),$re=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),Hk=j.check(R(/^sha256:[a-f0-9]{64}$/u)),Uk=N({id:J,kind:I([`connection`,`project`])}),Wk=I([`keep`,`stop`]),Gk=I([`active`,`released`]),Kk=P(Uk).check(gy(1),H(64),L(e=>new Set(e.map(e=>`${e.kind}:${e.id}`)).size===e.length,{expected:`unique hold targets`})),qk=e=>new Set(e).size===e.length,Jk=N({createdAt:K,id:Bk,reason:TS,revision:Vk,running:Wk,schemaVersion:A(Qre),state:Gk,targets:Kk,updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt)&&e.state===`active`==(e.revision===`1`))),Yk=N({connectionId:k(J),projectId:J,sessionId:J,state:I([`recovering`,`running`,`starting`])}),eie=P(Yk).check(H(64),L(e=>qk(e.map(e=>e.sessionId)),{expected:`unique Sessions`})),tie=P(J).check(H(64),L(qk,{expected:`unique Sessions`})),Xk=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),state:k(Gk)}),Zk=N({items:P(Jk).check(H(100)),method:A(`hold.list`),nextCursor:k(J)}).check(L(e=>qk(e.items.map(e=>e.id)))),Qk={commandId:J,reason:TS,running:Wk,targets:Kk},$k={commandId:J,expectedRevision:Vk,holdId:Bk},eA={inputDigest:Hk,proof:$re},tA={...eA,actorId:J,expiresAt:K,issuedAt:K},nA=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),rA=N(Qk),iA=N({...Qk,...eA}),aA=N($k),oA=N({...$k,...eA}),sA=N({...Qk,...tA,holdId:Bk,method:A(`hold.place.preview`),sessions:eie}).check(L(nA)),cA=N({...$k,...tA,method:A(`hold.release.preview`),targets:Kk}).check(L(nA)),lA={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),hold:Jk,inputDigest:Hk,receipt:Y},uA=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,dA=N({...lA,method:A(`hold.place.confirm`),stoppedSessionIds:tie}).check(L(e=>uA(e)&&e.hold.state===`active`&&e.hold.createdAt===e.hold.updatedAt&&(e.hold.running===`stop`||e.stoppedSessionIds.length===0))),fA=N({...lA,expectedRevision:Vk,method:A(`hold.release.confirm`)}).check(L(e=>uA(e)&&e.hold.state===`released`&&BigInt(e.hold.revision)===BigInt(e.expectedRevision)+1n)),nie=F([N({method:A(`hold.list`),parameters:Xk}),N({method:A(`hold.place.preview`),parameters:rA}),N({method:A(`hold.place.confirm`),parameters:iA}),N({method:A(`hold.release.preview`),parameters:aA}),N({method:A(`hold.release.confirm`),parameters:oA})]),rie=F([Zk,sA,dA,cA,fA]),pA=`maia.node.stdio/v1`;HO+65536;var mA=j.check(U(1,256)),hA=iy(j,$v),gA=e=>hA.check(L(t=>{let n=t[e];return typeof n==`string`&&n.length>0&&n.length<=256},{expected:`an envelope with a ${e}`})),_A=N({envelope:gA(`messageId`),principal:k(A(VO)),type:A(`request`)}),iie=j.check(R(/^\d{1,4}\.\d{1,4}\.\d{1,4}(?:-nightly\.\d{8}\.\d{1,6}|-canary\.\d{1,6})?$/u)),aie=N({protocol:A(pA),status:hA,type:A(`ready`),version:iie}),oie=F([_A,N({envelope:gA(`messageId`),principal:k(A(VO)),type:A(`subscribe`)}),N({messageId:mA,type:A(`unsubscribe`)})]),sie=N({frame:hA,messageId:mA,type:A(`item`)}),cie=F([N({messageId:mA,reason:I([`completed`,`lost`,`unsubscribed`]),type:A(`end`)}),N({code:j.check(R(/^[a-z][a-z_]{0,63}$/u)),messageId:mA,reason:A(`failure`),type:A(`end`)})]),lie=F([aie,N({message:j.check(H(1024)),protocol:A(pA),reason:I([`credential_unavailable`,`node_unavailable`]),type:A(`unavailable`)}),N({envelope:gA(`correlationId`),type:A(`response`)}),N({code:j.check(R(/^[a-z][a-z_]{0,63}$/u)),message:j.check(H(1024)),messageId:mA,remoteError:k(hA),type:A(`failure`)}),sie,cie]),uie=`maia.remote-node/v1`,die=4e3,fie=/^[a-z0-9][a-z0-9-]{0,62}$/u,pie=/^(?!-)[A-Za-z0-9._@-]{1,253}$/u,mie=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u,vA=String.raw`(?!\.{1,2}(?:/|$))[A-Za-z0-9._-]{1,128}`,hie=new RegExp(String.raw`^(?:~/|/)${vA}(?:/${vA})*$`,`u`),gie=new RegExp(String.raw`^/${vA}(?:/${vA})*$`,`u`),yA=String.raw`(?!\.{1,2}(?:/|$))[A-Za-z0-9._@+-]{1,255}`,_ie=new RegExp(String.raw`^/${yA}(?:/${yA})*$`,`u`),vie=/^\/[^\p{Cc}]{0,4095}$/u,yie=/^[a-f0-9]{64}$/u,bie=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u,bA=j.check(R(fie)),xA=j.check(R(pie)),SA=j.check(R(mie)),xie=j.check(H(256),R(hie)),CA=j.check(H(512),R(gie)),Sie=j.check(H(1024),R(_ie)),wA=j.check(R(vie)),TA=j.check(R(yie)),EA=j.check(R(bie)),Cie=V.check(B({maximum:8,minimum:2})),DA=V.check(B({maximum:die,minimum:0})),OA=j.check(R(/^sha256:[a-f0-9]{64}$/u)),kA=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),wie=q.check(R(/^[1-9]\d*$/u)),AA={claudeBin:k(CA),codexBin:k(CA),host:xA,profile:SA,root:xie,commandId:J,keep:Cie,name:bA,nodeRuntime:wA,release:k(wA)},jA={commandId:J,host:xA,launcherPath:k(CA),name:bA,profile:k(SA)},MA={commandId:J,expectedRevision:wie,name:bA,purge:M},NA=N({...AA,waitMs:k(DA)}),PA=N({...AA,inputDigest:OA,planDigest:OA,proof:kA,waitMs:k(DA)}),FA=N({includeRemoved:k(M)}),IA=N(jA),LA=N({...jA,inputDigest:OA,planDigest:OA,proof:kA}),RA=N(MA),zA=N({...MA,inputDigest:OA,proof:kA,waitMs:k(DA)}),Tie=F([N({method:A(`node.remote.install.preview`),parameters:NA}),N({method:A(`node.remote.install.confirm`),parameters:PA}),N({method:A(`node.remote.list`),parameters:FA}),N({method:A(`node.remote.register.preview`),parameters:IA}),N({method:A(`node.remote.register.confirm`),parameters:LA}),N({method:A(`node.remote.remove.preview`),parameters:RA}),N({method:A(`node.remote.remove.confirm`),parameters:zA})]),BA=j.check(R(/^[a-z0-9][a-z0-9-]{0,31}$/u)),VA=j.check(R(/^[A-Za-z0-9][A-Za-z0-9.+-]{0,63}$/u)),HA=j.check(H(256)),Eie=2048,Die=j.check(R(/^[a-z][a-z0-9-]{0,31}$/u)),UA=I([`automatic`,`notify`,`manual`]),WA={revision:q,unreadable:k(A(!0)),value:UA},GA={failed:k(VA),installing:k(VA),name:BA,reachedAt:k(K),repair:k(j.check(H(Eie))),rollbackRequested:k(M),version:k(VA),watching:k(VA)},Oie=N(GA),KA=F([N({...GA,paused:M,pauseReason:k(HA),state:A(`recorded`)}),N({reason:HA,state:A(`unknown`)})]),qA={commandId:J,from:VA,inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),node:BA,proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),revision:q,validUntil:K},JA={...qA,to:VA},YA=iy(j,Qv),XA=N({method:A(`node.update.show`),nodes:P(Oie).check(H(64)),paused:M,reason:k(HA),revision:q}),ZA=N({available:cy(VA),channel:Die,checkedAt:cy(K),current:VA,method:A(`node.update.check`),node:cy(BA),paused:cy(N({reason:k(HA)})),policy:N(WA),requested:cy(N({at:K,version:VA})),revision:q,web:cy(N({failure:cy(N({at:K,attempts:V.check(B({maximum:1e3,minimum:1})),text:HA,version:VA})),live:cy(N({at:K,version:VA}))}))}),kie=32,Aie=V.check(B({maximum:1e6,minimum:0})),QA=V.check(B({maximum:1440,minimum:0})),$A=N({blocking:P(N({sessionId:J,why:I([`starting`,`stopping`,`recovering`,`waiting-approval`,`turn`])})).check(H(kie)),blockingTotal:Aie,idle:M,last:cy(N({at:K,outcome:I([`updated`,`failed`,`rolled-back`,`restarted-busy`]),text:k(HA),version:VA})),method:A(`node.update.status`),settings:cy(N({busyRestartMinutes:QA,idleWaitMinutes:QA,soakMinutes:QA})),waiting:cy(N({since:K,version:VA}))}),ej=N({...WA,method:A(`node.update.policy.get`)}),tj=N({commandId:J,revision:q,value:UA}),nj=N({method:A(`node.update.policy.set`),receiptId:J,replayed:M,revision:q,value:UA}),rj=N({commandId:J,reason:k(HA)}),ij=N({method:A(`node.update.pause`),paused:A(!0),reason:k(HA),receiptId:J,replayed:M,revision:q}),aj=N({commandId:J}),oj=N({method:A(`node.update.resume`),paused:A(!1),receiptId:J,replayed:M,revision:q}),sj=N({commandId:J,node:BA}),cj=N({...qA,method:A(`node.update.rollback.preview`)}),lj=N(qA),uj=N({from:VA,method:A(`node.update.rollback.confirm`),node:BA,receiptId:J,replayed:M,revision:q}),dj=sj,fj=N({...JA,method:A(`node.update.apply.preview`)}),pj=N(JA),mj=N({from:VA,method:A(`node.update.apply.confirm`),node:BA,receiptId:J,replayed:M,revision:q,to:VA}),jie=F([N({method:A(`node.update.show`),parameters:YA}),N({method:A(`node.update.check`),parameters:YA}),N({method:A(`node.update.status`),parameters:YA}),N({method:A(`node.update.policy.get`),parameters:YA}),N({method:A(`node.update.policy.set`),parameters:tj}),N({method:A(`node.update.pause`),parameters:rj}),N({method:A(`node.update.resume`),parameters:aj}),N({method:A(`node.update.rollback.preview`),parameters:sj}),N({method:A(`node.update.rollback.confirm`),parameters:lj}),N({method:A(`node.update.apply.preview`),parameters:dj}),N({method:A(`node.update.apply.confirm`),parameters:pj})]),Mie=F([XA,ZA,$A,ej,nj,ij,oj,cj,uj,fj,mj]),hj=e=>j.check(H(e)),gj=j.check(R(/^[a-z][a-z_]{0,63}$/u)),_j=j.check(R(/^sha256:[a-f0-9]{64}$/u)),Nie=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),vj=j.check(R(/^maia-node-[A-Za-z0-9][A-Za-z0-9._-]{0,63}\.service$/u)),yj=V.check(z(0)),Pie=V.check(B({maximum:8,minimum:2})),bj=I(HS),xj=N({path:CA,sha256:TA}),Sj=N({executor:bj,interpreter:k(xj),path:k(CA),realPath:k(Sie),reason:k(hj(512)),sha256:k(TA),source:I([`discovered`,`override`]),state:I([`available`,`unavailable`])}),Cj=N({code:gj,message:hj(1024),remedy:k(hj(1024))}),wj=N({activeRelease:k(EA),arch:hj(64),distro:hj(256),home:hj(512),kernel:hj(128),landlockAbi:k(yj),linger:hj(64),os:hj(64),root:hj(512),rootState:I([`absent`,`empty`,`foreign`,`maia`,`symlink`]),systemdVersion:k(yj),user:hj(64)}),Tj=N({cli:xj,executorChanges:P(N({executor:bj,from:k(xj),to:k(xj)})).check(H(2)),executors:P(Sj).check(H(2)),keep:Pie,launcherPath:CA,maiaVersion:hj(64),mode:I([`install`,`reinstall`,`upgrade`]),path:hj(4096),previousRelease:k(EA),profile:SA,prune:N({releases:P(EA).check(H(16)),runtimes:P(EA).check(H(16))}),releaseId:EA,root:CA,runtimeId:EA,unitName:vj,uploadBytes:yj}),Ej=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:gj,message:hj(2048)})),executors:P(Sj).check(H(2)),host:xA,installedAt:k(K),launcherPath:CA,maiaVersion:k(hj(64)),name:bA,origin:k(A(`registered`)),profile:SA,releaseId:k(EA),remaining:k(P(hj(512)).check(H(64))),revision:q,root:k(CA),schemaVersion:A(uie),state:I([`installing`,`ready`,`install_failed`,`removing`,`removed`,`remove_failed`]),unitName:k(vj),update:k(KA),updatedAt:K}).check(L(Ej)),Oj=N({host:xA,instanceId:J,launcherPath:CA,maiaVersion:hj(64),profile:SA}),Fie={host:xA,profile:SA},kj={actorId:J,expiresAt:K,inputDigest:_j,issuedAt:K,proof:Nie},Aj=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),jj=F([N({commandId:J,method:A(`node.remote.install.preview`),state:A(`probing`)}),N({blockers:P(Cj).check(gy(1),H(32)),commandId:J,facts:wj,method:A(`node.remote.install.preview`),state:A(`blocked`)}),N({...kj,commandId:J,method:A(`node.remote.install.preview`),name:bA,plan:Tj,planDigest:_j,state:A(`ready`)}).check(L(Aj))]),Mj=N({...kj,commandId:J,method:A(`node.remote.register.preview`),name:bA,plan:Oj,planDigest:_j}).check(L(Aj)),Nj={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:_j,node:Dj,receipt:Y},Pj=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,Fj=N({...Nj,method:A(`node.remote.register.confirm`)}).check(L(Pj)),Ij=N({...Nj,method:A(`node.remote.install.confirm`)}).check(L(Pj)),Lj=N({local:k(N({update:k(KA)})),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)),Rj=N({...kj,...Fie,commandId:J,expectedRevision:q,method:A(`node.remote.remove.preview`),name:bA,origin:k(A(`registered`)),purge:M,root:k(CA),unitName:k(vj)}).check(L(Aj),L(Ej)),zj=N({...Nj,method:A(`node.remote.remove.confirm`)}).check(L(Pj)),Iie=F([jj,Ij,Lj,Mj,Fj,Rj,zj]),Lie=`maia.session-guard/v1`,Bj=I([`orchestrator`,`worker`]),Vj={maxDepth:{maximum:4,minimum:1},maxLeasesPerSession:{maximum:64,minimum:1},maxLiveChildren:{maximum:64,minimum:1},maxMessagesPerMinute:{maximum:600,minimum:1}},Hj=N({coordinator:I([`none`,`answer`,`decide`])}),Rie=N({coordinator:k(Hj.fields.coordinator)}),Uj=e=>V.check(B(e)),Wj=N({maxDepth:Uj(Vj.maxDepth),maxLeasesPerSession:Uj(Vj.maxLeasesPerSession),maxLiveChildren:Uj(Vj.maxLiveChildren),maxMessagesPerMinute:Uj(Vj.maxMessagesPerMinute)}),Gj=N({approvalGrants:Hj,limits:Wj,projectId:J,revision:q,schemaVersion:A(Lie),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`})),Kj=N({projectId:J}),qj={approvalGrants:k(Rie),commandId:J,expectedRevision:q,limits:Wj,projectId:J},Jj={inputDigest:j.check(R(/^sha256:[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u))},Yj=N(qj),Xj=N({...qj,...Jj}),zie=F([N({method:A(`project.guard.show`),parameters:Kj}),N({method:A(`project.guard.preview`),parameters:Yj}),N({method:A(`project.guard.confirm`),parameters:Xj})]),Zj=Jj,Qj=N({guard:Gj,method:A(`project.guard.show`)}),$j=N({...Zj,actorId:J,approvalGrants:Hj,commandId:J,current:Gj,expectedRevision:q,expiresAt:K,issuedAt:K,limits:Wj,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`})),eM=N({commandId:J,delivery:I([`duplicate`,`new`]),expectedRevision:q,guard:Gj,inputDigest:Zj.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`})),Bie=F([eM,$j,Qj]),tM=16384,Vie=32768,Hie=4e3,nM=[`image/gif`,`image/jpeg`,`image/png`,`image/webp`],rM=524288,Uie=e=>Math.ceil(e/3)*4,iM=new TextEncoder,aM=((e,t)=>j.check(gy(1),L(t=>iM.encode(t).byteLength<=e,{expected:t})))(tM,`turn input encoded as at most 16384 UTF-8 bytes`),Wie=j.check(L(e=>iM.encode(e).byteLength<=Vie,{expected:`turn response encoded as at most 32768 UTF-8 bytes`})),oM=V.check(z(0)),Gie=V.check(z(1)),sM=N({cachedInputTokens:oM,contextTokens:k(oM),contextWindow:k(Gie),inputTokens:oM,modelCallCount:k(oM),outputTokens:oM,reasoningOutputTokens:oM,totalTokens:oM}),cM=N({text:aM,type:A(`text`)}),lM=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`})),uM=V.check(B({maximum:rM,minimum:1})),dM=N({byteLength:uM,mediaType:I(nM),name:lM,sha256:j.check(R(/^[0-9a-f]{64}$/u))}),fM=N({data:j.check(U(4,Uie(rM)),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:lM}),pM={attachments:k(P(dM).check(gy(1),H(4))),createdAt:K,id:J,input:cM,revision:q,schemaVersion:A(1),sessionId:J,sessionRevision:q,updatedAt:K},Kie=N({...pM,state:A(`queued`)}),qie=N({...pM,state:A(`dispatching`)}),Jie=N({...pM,state:A(`running`)}),Yie=N({...pM,responseText:Wie,state:A(`completed`),tokenUsage:k(sM)}),mM=N({...pM,failure:k(NS),failureReason:I([`approval_required`,`repository_changed`,`runtime_failed`,`turn_rejected`]),state:A(`failed`)}),hM=N({...pM,failure:k(NS),failureReason:I([`output_limit_exceeded`,`protocol_invalid`,`runtime_exited`,`turn_deadline_exceeded`]),state:A(`outcome-unknown`)}),Xie=F([mM.fields.failureReason,hM.fields.failureReason]),gM=F([Kie,qie,Jie,Yie,mM,hM,N({...pM,state:A(`interrupted`)})]),_M=N({commandId:J,expectedRevision:q,turnId:J}),vM=N({attachments:k(P(fM).check(gy(1),H(4))),commandId:J,expectedRevision:q,input:cM,sessionId:J}),yM=N({turnId:J}),bM=N({sessionId:J}),xM={commandId:J.check(H(118)),expectedRevision:q,input:cM,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:cM,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:uM,mediaTypes:P(I(nM)).check(H(nM.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(gy(1),H(16)),waitMilliseconds:V.check(z(0),my(Hie))}),MM=I([`queued`,`dispatching`,`running`,`completed`,`failed`,`outcome-unknown`,`interrupted`]),Zie=N({failure:k(NS),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}),NM=N({method:A(`turn.wait`),satisfied:M,turns:P(Zie).check(H(16))}),PM=N({commandId:J,expectedRevision:q,turnId:J}),FM=N({delivery:I([`new`,`duplicate`]),method:A(`turn.cancel`),outcome:I([`cancelled`,`already_dispatched`]),receipt:Y,turn:gM}),IM=N({sessionId:J}),LM=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=>iM.encode(e).byteLength<=160,{expected:`preview encoded as at most 160 UTF-8 bytes`})),position:V.check(z(1),my(8)),revision:q})).check(H(8)),sessionId:J}),Qie=F([N({method:A(`turn.attachment.policy`),parameters:bM}),N({method:A(`turn.cancel`),parameters:PM}),N({method:A(`turn.queue.list`),parameters:IM}),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})]),$ie=F([DM,FM,LM,wM,TM,EM,AM,kM,NM]);G(Bj),G(Hj),G(Wj),G(Gj),G(Kj),G(Yj),G(Xj);var eae=G(Qj),tae=G($j),nae=G(eM),RM=[`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`],zM=Object.freeze({orchestrator:Object.freeze([...RM,`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(RM)}),BM=4096,VM=86400,HM=2592e3,UM=49152,WM=[`failed`,`approval_pending`,`question`,`turn_failed`,`stalled`,`settled_unreviewed`],GM={[X.claudeCode]:[`default`,`acceptEdits`,`plan`,`dontAsk`,`bypassPermissions`],[X.codex]:[`untrusted`,`on-request`,`never`]};new Map(Object.entries(zM));var KM={concurrency:4,depth:3,fanOut:8},qM={concurrency:{maximum:64,minimum:1},depth:{maximum:8,minimum:1},fanOut:{maximum:64,minimum:1}},JM=1e5,YM={id:`node`,type:`session-spawn-caps`},XM={[X.claudeCode]:[`low`,`medium`,`high`,`xhigh`,`max`],[X.codex]:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},ZM={[X.claudeCode]:`launch-flag`,[X.codex]:`launch-flag`},QM=e=>Object.hasOwn(ZM,e),$M=(e,t)=>Object.hasOwn(e,t)?e[t]??[]:[],eN=e=>$M(XM,e),tN=e=>$M(GM,e),nN=4e3,rN=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),iN=V.check(z(0)),aN=k(iN),oN=N({sessionIds:k(P(J).check(gy(1),H(32))),stallAfterSeconds:k(V.check(z(10),my(VM)))}),sN=N({declinedRequests:iN,eventCount:iN,idleMilliseconds:iN,lastEventAt:k(K),lastEventKind:k(j.check(U(1,128)))}),cN=N({cpuTimeMilliseconds:aN,processCount:aN,rssBytes:aN,wallTimeMilliseconds:aN}),lN=N({elapsedMilliseconds:iN,runtimeTurnId:j.check(U(1,256)),startedAt:K,turnId:J}),uN=N({activity:sN,health:I([`idle`,`stalled`,`working`]),process:k(cN),runtime:rN,runtimeThreadId:j.check(U(1,256)),startedAt:K,turn:k(lN)}),dN=N({attention:k(I(WM)),runtime:k(uN),sessionId:J}),fN=N({items:P(dN).check(H(64)),method:A(`session.observe`),observedAt:K,stallAfterSeconds:V.check(z(10),my(VM))}),pN=j.check(R(/^[a-f0-9]{64}$/u)),mN={commandId:J,globalCursor:q,recordedAt:K,schemaVersion:A(4),sessionCursor:q,sessionId:J},hN=e=>N({...e,turnId:J}),gN=F([N({...mN,eventType:A(`turn.queued`),payload:hN({inputDigest:pN})}),N({...mN,eventType:A(`turn.dispatching`),payload:hN({})}),N({...mN,eventType:A(`turn.started`),payload:hN({})}),N({...mN,eventType:A(`turn.completed`),payload:hN({outputDigest:pN,tokenUsage:k(sM)})}),N({...mN,eventType:A(`turn.interrupted`),payload:hN({})}),N({...mN,eventType:A(`turn.failed`),payload:hN({failure:k(NS),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`])})})]),_N=J.check(R(/^container_[A-Za-z0-9_-]+$/u)),vN=q.check(R(/^[1-9]\d*$/u)),yN=J,bN=V.check(B({maximum:100,minimum:1})),xN=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),SN=j.check(R(/^sha256:[a-f0-9]{64}$/u)),CN=N({createdAt:K,id:_N,name:TS,revision:vN,schemaVersion:A(`maia.container/v1`),updatedAt:K}).check(L(e=>Date.parse(e.createdAt)<=Date.parse(e.updatedAt))),wN=N({id:J,name:TS,revision:vN}),TN=N({afterCursor:k(yN),limit:bN}),EN=N({afterCursor:k(yN),containerId:_N,limit:bN}),DN=N({items:P(CN).check(H(100)),method:A(`container.list`),nextCursor:k(yN)}).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(yN),projects:P(wN).check(H(100))}).check(L(e=>new Set(e.projects.map(e=>e.id)).size===e.projects.length)),kN=500,AN=V.check(B({maximum:kN,minimum:1})),jN=N({...wN.fields,path:k(j.check(U(1,4096)))}),MN=N({container:CN,projectCount:V.check(z(0)),projects:P(jN)}).check(L(e=>e.projects.length<=e.projectCount&&new Set(e.projects.map(e=>e.id)).size===e.projects.length)),NN=N({afterCursor:k(yN),limit:AN}),PN=e=>e.reduce((e,t)=>e+Math.max(t.projects.length,1),0),FN=N({items:P(MN),method:A(`container.index.list`),nextCursor:k(yN)}).check(L(e=>PN(e.items)<=kN&&new Set(e.items.map(e=>e.container.id)).size===e.items.length)),IN={commandId:J,name:TS},LN={...IN,containerId:_N,expectedRevision:vN},RN={inputDigest:SN,proof:xN},zN={...RN,actorId:J,expiresAt:K,issuedAt:K},BN=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),VN=N(IN),HN=N(LN),UN=N({...IN,...RN}),WN=N({...LN,...RN}),GN=N({...IN,...zN,containerId:_N,method:A(`container.create.preview`)}).check(L(BN)),KN=N({...LN,...zN,method:A(`container.rename.preview`)}).check(L(BN)),qN={actorId:J,commandId:J,container:CN,delivery:I([`new`,`duplicate`]),inputDigest:SN,receipt:Y},JN=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,YN=N({...qN,method:A(`container.create.confirm`)}).check(L(e=>JN(e)&&e.container.revision===`1`&&e.container.createdAt===e.container.updatedAt)),XN=N({...qN,expectedRevision:vN,method:A(`container.rename.confirm`)}).check(L(e=>JN(e)&&BigInt(e.container.revision)===BigInt(e.expectedRevision)+1n)),ZN=F([N({method:A(`container.list`),parameters:TN}),N({method:A(`container.show`),parameters:EN}),N({method:A(`container.index.list`),parameters:NN}),N({method:A(`container.create.preview`),parameters:VN}),N({method:A(`container.create.confirm`),parameters:UN}),N({method:A(`container.rename.preview`),parameters:HN}),N({method:A(`container.rename.confirm`),parameters:WN})]),QN=F([DN,ON,FN,GN,YN,KN,XN]),$N=16384,eP=524288,tP=1024,nP=[{host:`github.com`,kind:`github`}],rP=new TextEncoder,iP=(e,t)=>j.check(L(t=>t.length>0&&rP.encode(t).byteLength<=e&&!wS(t),{expected:t})),aP=iP(tP,`a branch name of up to 1024 bytes without control characters`),oP=j.check(R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),sP=iP(tP,`a branch cursor a previous page returned`).check(R(/^refs\/(?:heads|remotes)\//u)),cP=N({afterCursor:k(sP),kind:k(I([`all`,`local`,`remote`])),limit:V.check(z(1),my(100)),query:k(iP(255,`a query of up to 255 bytes without control characters`)),workspaceId:J}),lP=N({items:P(N({committedAt:k(K),current:M,headRevision:oP,kind:I([`local`,`remote`]),name:aP,upstream:k(aP)})).check(H(100)),method:A(`workspace.branches.list`),nextCursor:k(sP)}),uP=N({workspaceId:J}),dP=N({host:k(iP(255,`a host name of up to 255 bytes`)),kind:I([...nP.map(({kind:e})=>e),`unknown`]),method:A(`workspace.code-host.show`),remote:k(aP),repository:k(iP(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`})),fP=[N({method:A(`workspace.branches.list`),parameters:cP}),N({method:A(`workspace.code-host.show`),parameters:uP})],pP=[lP,dP],mP=256,hP=256,gP=1024,_P=Math.ceil(eP/3)*4,vP=new TextEncoder,yP=q,bP=yP.check(R(/^[1-9]\d*$/u)),xP=j.check(R(/^sha256:[a-f0-9]{64}$/u)),SP=V.check(z(0)),CP=/[\p{Cc}\\]/u,wP=e=>e!==``&&e!==`.`&&e!==`..`&&!CP.test(e),TP=j.check(L(e=>vP.encode(e).byteLength<=mP&&e.split(`/`).every(wP),{expected:`a relative path of at most ${String(mP)} UTF-8 bytes with no empty, dot, dot-dot, backslash or control segment`})),EP=N({bytes:SP,path:TP,sha256:xP}),DP=P(EP).check(gy(1),H(gP),L(e=>new Set(e.map(({path:e})=>e)).size===e.length,{expected:`files with unique paths`})),OP=P(TP).check(gy(1),H(gP),L(e=>new Set(e).size===e.length,{expected:`unique paths`})),kP=N({...EP.fields,updatedAt:K}),AP={inputDigest:xP,proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},jP={commandId:J,expectedRevision:yP,files:DP,projectId:J},MP={commandId:J,expectedRevision:yP,paths:OP,projectId:J},NP={fileCount:SP,totalBytes:SP},PP=N({projectId:J}),FP=N({...NP,files:P(kP).check(H(256)),inContext:M,method:A(`project.knowledge.list`),projectId:J,revision:yP}),IP=N(jP),LP=N({...jP,...AP}),RP=N({...jP,...NP,...AP,actorId:J,method:A(`project.knowledge.add.preview`),replaced:SP}),zP=N({actorId:J,commandId:J,expectedRevision:yP,inputDigest:xP,method:A(`project.knowledge.add.confirm`),projectId:J,uploadExpiresAt:K}),BP=N({commandId:J,data:j.check(H(_P),R(/^[A-Za-z0-9+/]*={0,2}$/u),L(e=>e.length%4==0,{expected:`padded base64`})),offset:SP,path:TP,projectId:J,sha256:xP}),VP=N({bytes:SP,commandId:J,method:A(`project.knowledge.add.chunk`),offset:SP,path:TP}),HP=N({commandId:J,projectId:J}),UP=(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,WP={...NP,actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),expectedRevision:yP,projectId:J,receipt:Y,revision:bP},GP=N({...WP,added:SP,method:A(`project.knowledge.add.commit`),replaced:SP}).check(L(e=>UP(e,`project.knowledge.add.commit`),{expected:`a committed upload bound to its Project and receipt`})),KP=N(MP),qP=N({...MP,...AP}),JP=N({...MP,...NP,...AP,actorId:J,method:A(`project.knowledge.remove.preview`)}),YP=N({...WP,inputDigest:xP,method:A(`project.knowledge.remove.confirm`),removed:SP}).check(L(e=>UP(e,`project.knowledge.remove.confirm`),{expected:`a confirmed removal bound to its Project and receipt`})),XP=N({limit:k(V.check(z(1),my(20))),projectId:k(J),query:j.check(H(hP))}),ZP=N({hits:P(N({path:TP,snippet:j.check(L(e=>vP.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:yP}),QP=N({...NP,previousRevision:yP,projectId:J,revision:bP}),$P=[N({method:A(`project.knowledge.list`),parameters:PP}),N({method:A(`project.knowledge.add.preview`),parameters:IP}),N({method:A(`project.knowledge.add.confirm`),parameters:LP}),N({method:A(`project.knowledge.add.chunk`),parameters:BP}),N({method:A(`project.knowledge.add.commit`),parameters:HP}),N({method:A(`project.knowledge.remove.preview`),parameters:KP}),N({method:A(`project.knowledge.remove.confirm`),parameters:qP}),N({method:A(`project.knowledge.search`),parameters:XP})],eF=[FP,RP,zP,VP,GP,JP,YP,ZP],tF=4096,nF=100,rF=new TextEncoder,iF=q,aF=iF.check(R(/^[1-9]\d*$/u)),oF=j.check(U(1,tF)),sF=j.check(U(40,64),R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),cF=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`})),lF=N({createdAt:K,id:J,name:TS,revision:aF,schemaVersion:A(1),updatedAt:K}),uF=N({createdAt:K,id:J,locationId:J,name:TS,projectId:J,revision:aF,schemaVersion:A(1),updatedAt:K,vcs:A(`git`)}),dF=N({createdAt:K,id:J,kind:I([`local-main`,`git-worktree`]),name:TS,projectId:J,revision:aF,schemaVersion:A(1),state:I([`provisioning`,`ready`,`removing`,`failed`]),updatedAt:K}),fF=N({projectId:J,repositoryId:J}),pF=N({...fF.fields,workspaceId:J}),mF=N({...fF.fields,projectRevision:aF,repositoryRevision:aF}),hF=e=>`${e.projectId}\u0000${e.repositoryId}`,gF=e=>new Set(e.map(e=>e.repositoryId)).size===e.length,_F=N({contextRevision:aF,focus:fF,members:P(mF).check(gy(1),H(32)),schemaVersion:A(1),workspaceId:J,workspaceRevision:aF}).check(L(e=>gF(e.members)&&e.members.filter(t=>hF(t)===hF(e.focus)).length===1,{expected:`unique Workspace repositories containing the exact selected focus`})),vF=N({contextRevision:aF,schemaVersion:A(1),systemPromptInput:_F,updatedAt:K,workspaceId:J,workspaceRevision:aF}).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`})),yF=N({baseRevision:sF,branch:cF,createdAt:K,dirty:M,headRevision:sF,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:aF,role:I([`primary`,`attached`]),schemaVersion:A(1),state:I([`provisioning`,`ready`,`removing`,`failed`]),updatedAt:K,workspaceId:J}),bF=N({afterCursor:k(iF),limit:V.check(z(1),my(nF))}),xF={commandId:J,containerId:_N,expectedContainerRevision:aF,name:TS},SF={commandId:xF.commandId,containerId:xF.containerId,expectedRevision:aF,name:TS,projectId:J},CF={inputDigest:j.check(R(/^sha256:[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u))},wF={...CF,actorId:J,expiresAt:K,issuedAt:K},TF=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),EF=N(xF),DF=N({...xF,...CF}),OF=N(SF),kF=N({...SF,...CF}),AF=N({...xF,...wF,method:A(`project.create.preview`),projectId:J}).check(L(TF)),jF=N({...SF,...wF,method:A(`project.rename.preview`)}).check(L(TF)),MF={actorId:J,commandId:J,containerId:xF.containerId,delivery:I([`new`,`duplicate`]),inputDigest:CF.inputDigest,project:lF,receipt:Y},NF=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),PF=N({...MF,containerRevision:aF,expectedContainerRevision:aF,method:A(`project.create.confirm`)}).check(L(e=>NF(e)&&e.project.revision===`1`&&e.project.createdAt===e.project.updatedAt&&BigInt(e.containerRevision)===BigInt(e.expectedContainerRevision)+1n)),FF=N({...MF,expectedRevision:aF,method:A(`project.rename.confirm`)}).check(L(e=>NF(e)&&BigInt(e.project.revision)===BigInt(e.expectedRevision)+1n)),IF=j.check(R(/^sha256:[a-f0-9]{64}$/u)),LF={expected:`instructions text of at most ${String($N)} UTF-8 bytes`},RF=j.check(H($N,LF),L(e=>!e.includes(`\0`),{expected:`instructions text without NUL characters`}),L(e=>rF.encode(e).byteLength<=$N,LF)),zF=N({digest:IF,projectId:J,revision:aF,text:RF,updatedAt:K}),BF={commandId:J,expectedRevision:iF,projectId:J,text:RF},VF={inputDigest:IF,proof:CF.proof,validUntil:K},HF=N({projectId:J}),UF=N({instructions:cy(zF),method:A(`project.instructions.show`),projectId:J}),WF=N(BF),GF=N({...BF,...VF}),KF=N({...BF,...VF,actorId:J,method:A(`project.instructions.change.preview`)}),qF=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),digest:IF,expectedRevision:iF,inputDigest:IF,method:A(`project.instructions.change.confirm`),projectId:J,receipt:Y,revision:aF}).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`})),JF=N({digest:IF,previousRevision:iF,projectId:J,revision:aF}),YF=N({commandId:J,expectedRevision:A(`0`),name:TS,rootPath:oF}),XF=bF,ZF=N({projectId:J}),QF=j.check(L(e=>!e.includes(`\0`)&&rF.encode(e).byteLength>=1&&rF.encode(e).byteLength<=4096,{expected:`a non-NUL project context note encoded as 1 to 4096 UTF-8 bytes`})),$F=N({attribution:A(`user`),body:QF,createdAt:K,id:J,projectId:J,schemaVersion:A(1),sequence:aF}),eI=N({attribution:A(`user`),body:QF,commandId:J,projectId:J}),tI=N({...bF.fields,projectId:J}),nI=N({noteId:J}),rI=N({...bF.fields,projectId:J}),iI=N({workspaceId:J}),aI=iy(j,Qv),oI=N({commandId:J,expectedContextRevision:aF,expectedWorkspaceRevision:aF,projectId:J,repositoryId:J,workspaceId:J}),sI=N({commandId:J,expectedActiveContextRevision:aF,expectedActiveWorkspaceId:J,expectedContextRevision:aF,expectedWorkspaceRevision:aF,projectId:J,repositoryId:J,workspaceId:J}),cI=N({commandId:J,expectedRevision:aF,name:TS,rootPath:oF,workspaceId:J}),lI=N({checkout:yF,delivery:I([`new`,`duplicate`]),method:A(`project.register`),project:lF,receipt:Y,repository:uF,workspace:dF}),uI=N({items:P(lF).check(H(nF)),method:A(`project.list`),nextCursor:k(iF)}),dI=N({method:A(`project.show`),project:lF,repositories:P(uF).check(H(nF))}),fI=N({delivery:I([`new`,`duplicate`]),method:A(`project.context.record`),note:$F,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`})),pI=N({items:P($F).check(H(nF)),method:A(`project.context.list`),nextCursor:k(iF)}),mI=N({method:A(`project.context.show`),note:$F}),hI=N({items:P(dF).check(H(nF)),method:A(`workspace.list`),nextCursor:k(iF)}),gI=N({checkouts:P(yF).check(H(nF)),method:A(`workspace.show`),workspace:dF}),_I=e=>e.context.workspaceId===e.workspace.id&&e.context.workspaceRevision===e.workspace.revision&&e.context.systemPromptInput.members.some(t=>t.projectId===e.workspace.projectId),vI=(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`,yI=N({context:vF,delivery:I([`new`,`duplicate`]),membership:pF,method:A(`workspace.membership.attach`),receipt:Y,workspace:dF}).check(L(e=>_I(e)&&vI(e,`workspace.membership.attach`)&&e.membership.workspaceId===e.workspace.id&&e.context.systemPromptInput.members.some(t=>hF(t)===hF(e.membership)),{expected:`an attached Workspace membership with matching context and receipt`})),bI=N({context:vF,delivery:I([`new`,`duplicate`]),method:A(`workspace.select`),receipt:Y,workspace:dF}).check(L(e=>_I(e)&&vI(e,`workspace.select`),{expected:`a selected Workspace context with a matching receipt`})),xI=N({context:vF,method:A(`workspace.context.show`),workspace:dF}).check(L(_I,{expected:`a Workspace context matching the returned Workspace`})),SI=N({checkout:yF,delivery:I([`new`,`duplicate`]),method:A(`workspace.repository.attach`),receipt:Y,repository:uF,workspace:dF}),CI=F([N({method:A(`project.create.preview`),parameters:EF}),N({method:A(`project.create.confirm`),parameters:DF}),N({method:A(`project.rename.preview`),parameters:OF}),N({method:A(`project.rename.confirm`),parameters:kF}),...$P,N({method:A(`project.instructions.change.preview`),parameters:WF}),N({method:A(`project.instructions.change.confirm`),parameters:GF}),N({method:A(`project.instructions.show`),parameters:HF}),N({method:A(`project.context.list`),parameters:tI}),N({method:A(`project.context.record`),parameters:eI}),N({method:A(`project.context.show`),parameters:nI}),N({method:A(`project.register`),parameters:YF}),N({method:A(`project.list`),parameters:XF}),N({method:A(`project.show`),parameters:ZF}),N({method:A(`workspace.context.show`),parameters:aI}),N({method:A(`workspace.list`),parameters:rI}),N({method:A(`workspace.membership.attach`),parameters:oI}),N({method:A(`workspace.select`),parameters:sI}),N({method:A(`workspace.show`),parameters:iI}),N({method:A(`workspace.repository.attach`),parameters:cI}),...fP]),wI=F([AF,PF,jF,FF,KF,qF,UF,...eF,pI,fI,mI,lI,uI,dI,xI,hI,yI,bI,gI,SI,...pP]),TI=`maia.execution/v1alpha1`,EI=`provider_local_host`,DI=`execution_profile_local_host`,OI=`execution_profile_local_worktree`,kI=`placement_policy_local_default`,AI=`maia.execution-worktree/v1alpha1`,jI=`local-worktree`,MI=1048576,NI=e=>new TextEncoder().encode(e).byteLength,PI=q,FI=j.check(L(e=>/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(e),{expected:`an exact Git object revision`})),II=j.check(L(e=>/^sha256:[a-f0-9]{64}$/u.test(e),{expected:`a lowercase SHA-256 digest`})),LI=j.check(gy(1),L(e=>!e.includes(`\0`)&&NI(e)<=4096&&(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/u.test(e)),{expected:`a bounded absolute worktree path without NUL bytes`})),RI=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'`})),zI=N({baseRevision:FI,branch:k(RI),commandId:J,expectedProjectRevision:PI,kind:A(`git-worktree`),projectId:J,repositoryId:J}),BI=N({commandId:J,expectedProjectRevision:PI,kind:A(`git-worktree`),projectId:J,repositoryId:J,rootPath:LI}),VI={checkoutId:J,commandId:J,id:J,kind:I([`create`,`import`,`remove`]),repositoryId:J,revision:PI,schemaVersion:A(AI),workspaceId:J,workspaceRevision:PI},HI=N({...VI,cleanup:A(`pending`),state:I([`prepared`,`dispatching`])}),UI=N({...VI,cleanup:A(`clean`),instanceId:k(J),state:A(`succeeded`)}),WI=I([`branch_conflict`,`checkpoint_too_large`,`git_failed`,`identity_changed`,`path_conflict`,`repository_changed`,`worktree_active`,`worktree_dirty`,`worktree_missing`,`worktree_moved`]),GI=F([HI,UI,N({...VI,cleanup:A(`clean`),failure:WI,state:A(`failed`)}),N({...VI,cleanup:A(`unknown`),state:I([`cleanup_unknown`,`outcome_unknown`])})]),KI={checkout:yF,delivery:I([`duplicate`,`new`]),operation:GI,receipt:Y,workspace:dF},qI=(e,t)=>e===`actor_local_user`||t===`execution.worktree.create`&&e.startsWith(`actor_session_`),JI=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`)&&qI(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`,YI=N({...KI,method:A(`execution.worktree.create`)}).check(L(JI,{expected:`an exact receipt-backed worktree creation projection`})),XI=N({...KI,method:A(`execution.worktree.import`)}).check(L(JI,{expected:`an exact receipt-backed worktree import projection`})),ZI=N({id:J,profileId:A(OI),providerId:A(EI),revision:PI,schemaVersion:A(TI),state:A(`folder-bound`),trust:A(`trusted_worktree`),workspaceId:J}),QI=N({workspaceId:J}),$I=N({checkout:yF,instance:k(ZI),latestOperation:GI,method:A(`execution.worktree.status`),trust:A(`trusted_worktree`),variant:A(jI),workspace:dF}).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`})),eL=N({commandId:J,expectedOperationRevision:PI,operationId:J}),tL=N({delivery:I([`duplicate`,`new`]),method:A(`execution.worktree.reconcile`),operation:GI,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`})),nL=N({workspaceId:J}),rL=I([`cleanup_not_owned`,`execution_operation_active`,`instance_changed`,`placement_active`,`session_active`,`worktree_dirty`,`worktree_missing`,`worktree_moved`]),iL=N({blockers:P(rL).check(H(16)),checkoutId:J,checkoutRevision:PI,digest:II,eligible:M,id:J,instanceId:J,instanceRevision:PI,workspaceId:J,workspaceRevision:PI}).check(L(e=>e.eligible===(e.blockers.length===0),{expected:`a removal plan whose eligibility matches its blockers`})),aL=N({method:A(`execution.worktree.remove.plan`),plan:iL}),oL=N({commandId:J,expectedWorkspaceRevision:PI,planDigest:II,planId:J,workspaceId:J}),sL=N({delivery:I([`duplicate`,`new`]),method:A(`execution.worktree.remove.apply`),operation:GI,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`})),cL={commandId:J,id:J,instanceId:J,instanceRevision:PI,repositoryId:J,revision:PI,schemaVersion:A(AI),workspaceId:J},lL=F([N({...cL,state:I([`prepared`,`running`])}),N({...cL,checkpointId:J,state:A(`succeeded`)}),N({...cL,failure:I([`checkpoint_too_large`,`identity_changed`,`worktree_dirty`]),state:A(`failed`)}),N({...cL,state:A(`outcome_unknown`)})]),uL=N({byteLength:V.check(z(0),my(MI)),contentDigest:II,createdAt:K,id:J,instanceId:J,kind:A(`clean-git`),repositoryId:J,revision:A(`1`),schemaVersion:A(AI),sourceRevision:FI,workspaceId:J}),dL=N({commandId:J,expectedInstanceRevision:PI,instanceId:J}),fL=N({checkpoint:k(uL),delivery:I([`duplicate`,`new`]),method:A(`execution.checkpoint.create`),operation:lL,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`})),pL=N({checkpointId:J}),mL=N({checkpoint:uL,method:A(`execution.checkpoint.show`)}),hL=F([N({method:A(`execution.worktree.create`),parameters:zI}),N({method:A(`execution.worktree.import`),parameters:BI}),N({method:A(`execution.worktree.status`),parameters:QI}),N({method:A(`execution.worktree.reconcile`),parameters:eL}),N({method:A(`execution.worktree.remove.plan`),parameters:nL}),N({method:A(`execution.worktree.remove.apply`),parameters:oL}),N({method:A(`execution.checkpoint.create`),parameters:dL}),N({method:A(`execution.checkpoint.show`),parameters:pL})]),gL=F([YI,XI,$I,tL,aL,sL,fL,mL]),_L=new TextEncoder,vL=j.check(gy(1),L(e=>_L.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`})),yL=j.check(L(e=>e.length>0&&_L.encode(e).byteLength<=4096&&!wS(e)&&!e.split(`/`).includes(`..`),{expected:`a path of up to 4096 bytes without control characters or '..' segments`})),bL=j.check(R(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u)),xL=j.check(U(6,160),R(/^maia\/[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),SL=N({baseRef:vL,branch:k(RI)}),CL=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))}),wL=N({baseRef:vL,baseRevision:bL,branch:xL,setup:I([`none`,`pending`,`succeeded`,`failed`]),skills:k(P(CL).check(H(8))),state:I([`active`,`archived`,`removed`])}),TL=N({baseRef:vL,baseRevision:bL,branch:xL}),EL=j.check(L(e=>e.length>0&&!e.includes(`\0`)&&_L.encode(e).byteLength<=4096,{expected:`a worktree-relative path of up to 4096 bytes`})),DL=V.check(z(0)),OL=N({deletions:k(DL),insertions:k(DL),path:EL,previousPath:k(EL),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`})),kL=N({sessionId:J,stat:k(M)}),AL=N({baseRevision:bL,branch:xL,deletions:DL,files:P(OL).check(H(256)),insertions:DL,method:A(`session.diff`),patch:k(j.check(L(e=>_L.encode(e).byteLength<=UM,{expected:`a patch of up to 48 KiB`}))),patchTruncated:k(A(!0)),sessionId:J,totalFiles:DL}).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`})),jL=N({sessionId:J}),ML=V.check(z(0)),NL=j.check(L(e=>e.length>0&&_L.encode(e).byteLength<=1024&&!wS(e),{expected:`a Git name of up to 1024 bytes without control characters`})),PL=N({ahead:k(ML),baseRef:vL,baseRevision:k(bL),behind:k(ML),branch:k(NL),changedFiles:ML,dirty:M,headRevision:bL,method:A(`session.git.status`),observedAt:K,sessionId:J,upstream:k(N({ahead:k(ML),behind:k(ML),name:NL}))}).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`})),FL=j.check(L(e=>e.length>0&&_L.encode(e).byteLength<=2048,{expected:`a summary of 1 to 2048 bytes`})),IL=j.check(L(e=>e.length>0&&!wS(e)&&_L.encode(e).byteLength<=4096,{expected:`a transcript path without control characters, up to 4096 bytes`})),LL=N({commandId:J,expectedRevision:q,sessionId:J,summary:k(FL),transcriptPath:k(IL)}),RL=N({branch:xL,branchRevision:bL,pruneAfter:K,snapshot:I([`clean`,`committed`])}),zL=N({branch:xL,cleanupOperationId:J}),BL=P(I(WO)).check(U(1,32),L(e=>e.every(e=>GO.includes(e)))),VL=BL.check(L(e=>e.every((t,n)=>n===0||(e[n-1]??``)<t))),HL={definitionRef:IS,expectedSessionRevision:q,expectedWorkspaceRevision:q,operationIds:BL,sessionId:J,workspaceId:J},UL=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),WL=j.check(R(/^sha256:[a-f0-9]{64}$/u)),GL=N({...HL,commandId:J}),KL=N({...HL,commandId:J,inputDigest:WL,proof:UL}),qL=N({...HL,actorId:J,commandId:J,expiresAt:K,inputDigest:WL,issuedAt:K,method:A(`session.agent-permission.preview`),operationIds:VL,proof:UL}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt))),JL=N({...HL,actorId:J,commandId:J,grantedAt:K,inputDigest:WL,operationIds:VL,revision:A(`1`)}),YL=N({delivery:I([`new`,`duplicate`]),grant:JL,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)),XL=F([N({method:A(`session.agent-permission.preview`),parameters:GL}),N({method:A(`session.agent-permission.confirm`),parameters:KL})]),ZL=F([qL,YL]),QL=100,$L=32,eR=new TextEncoder,tR=(e,t)=>j.check(L(t=>!t.includes(`\0`)&&eR.encode(t).byteLength>=1&&eR.encode(t).byteLength<=e,{expected:t})),nR=tR(128,`a non-NUL subject encoded as 1 to 128 UTF-8 bytes`),rR=tR(BM,`a non-NUL body encoded as 1 to 4096 UTF-8 bytes`),iR=q,aR=j.check(U(1,80),L(e=>e.trim()===e&&!wS(e),{expected:`a one-line title of 1 to 80 characters without surrounding spaces`})),oR=iy(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`})),sR=V.check(z(1),my(QL)),cR=I([`idle`,`starting`,`running`,`waiting-approval`,`interrupted`,`recovering`,`stopping`,`stopped`,`failed`]),lR={createdAt:K,id:J,projectId:J,revision:iR,state:cR,updatedAt:K,workspaceId:J,workspaceRevision:iR},uR=I(XM[X.codex]),dR=(e,t)=>eN(e).includes(t),fR=I([...GM[X.claudeCode],...GM[X.codex]]),pR=(e,t)=>tN(e).includes(t),mR=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,hR=e=>e.heldTasks===void 0||e.heldTaskCount===void 0?e.heldTasks===e.heldTaskCount:e.heldTasks.length===Math.min(e.heldTaskCount,10),gR=N({connectionId:J,effort:k(uR),kind:rN,model:k(qS)}).check(L(e=>e.effort===void 0||dR(e.kind,e.effort),{expected:`an effort level the executor kind supports`})),_R=N({...lR,activity:k(Lk),agentDefinitionRef:k(IS),containment:k(A(`none`)),executor:k(gR),failure:k(NS),heldTaskCount:k(V.check(z(0))),heldTasks:k(P(RD).check(H(10))),labels:k(oR),latestTurnId:k(J),latestTurnState:k(MM),parentSessionId:k(J),permission:k(fR),prompt:k(rT),recovery:k(NS),schemaVersion:A(4),settledReason:k(I([`failed`,`idle`,`stopped`])),status:k(Rk),title:k(aR),worktree:k(wL)}).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`)&&mR(e)&&hR(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`})),vR=iy(j,Qv),yR=N({adoptedFrom:k(N({nativeId:J,workingDirectory:I([`original`,`relocated`])})),agentDefinitionRef:k(IS),authorizedBy:k(J),containment:k(A(`none`)),cwd:k(yL),executor:k(gR),permission:k(fR),projectId:J,workspaceId:J,workspaceRevision:iR,worktree:k(TL)}),bR=N({executableVersion:j.check(U(1,64))}),xR=(e,t)=>N({commandId:J,eventType:A(e),globalCursor:iR,payload:t,recordedAt:K,schemaVersion:A(4),sessionCursor:iR,sessionId:J}),SR=xR(`session.created`,yR),CR=xR(`session.start.requested`,vR),wR=xR(`session.runtime.started`,bR),TR=xR(`session.runtime.recovery.requested`,vR),ER=xR(`session.runtime.recovery.updated`,N({recovery:k(NS)})),DR=xR(`session.runtime.resumed`,bR),OR=xR(`session.stopped`,N({holdId:k(zk)})),kR=xR(`session.resume.requested`,vR),AR=F([SR,CR,wR,TR,ER,DR,xR(`session.runtime.failed`,N({failure:k(NS),reason:I([`activation_failed`,`activation_outcome_unknown`,`runtime_exited`])})),OR,kR,xR(`session.archived`,RL),xR(`session.renamed`,N({title:aR})),xR(`session.worktree.removed`,zL),gN]),jR={commandId:J,expectedRevision:A(`0`),workspaceId:J},MR=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||pR(e.executor,e.permission)),NR=N({...jR,agentId:k(FS),connectionId:k(J),cwd:k(yL),definitionRef:k(IS),effort:k(uR),executor:k(rN),hostAuthority:k(A(!0)),labels:k(oR),model:k(qS),permission:k(fR),role:k(Bj),title:k(aR),worktree:k(SL)}).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&&QM(e.executor))&&(e.effort===void 0||(e.connectionId!==void 0||e.executor!==void 0)&&(e.executor===void 0||dR(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(`/`)))&&MR(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`})),PR=N({afterCursor:k(iR),attention:k(M),idleForSeconds:k(V.check(z(0),my(HM))),labels:k(oR),limit:k(sR),parentSessionId:k(J),projectId:k(J),settled:k(A(!0)),states:k(P(cR).check(gy(1),H(9)))}).check(L(e=>e.idleForSeconds===void 0||e.settled===!0,{expected:`an idle time only with the settled filter`})),FR=N({sessionId:J}),IR=N({activities:k(P(Lk).check(gy(1),H(4))),sessionId:J,states:k(P(cR).check(gy(1),H(9))),waitMilliseconds:V.check(z(0),my(nN))}).check(L(e=>e.states!==void 0||e.activities!==void 0,{expected:`states, activities or both to wait for`})),LR=N({afterSessionCursor:iR,limit:V.check(z(1),my($L)),sessionId:J}),RR=N({commandId:J,expectedRevision:iR,sessionId:J}),zR=J.check(H(122)),BR={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},VR={checkpoint:k(bL),commandId:zR,expectedRevision:iR,...BR,sessionId:J,turnId:J},HR=N({commandId:zR,sessionId:J,turnId:k(J)}),UR=N(VR),WR=N({connectionId:k(J),executor:k(rN),model:k(qS)}).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`})),GR={commandId:zR,expectedRevision:iR,...BR,sessionId:J,target:WR},KR=N({commandId:GR.commandId,sessionId:J,target:WR}),qR=N(GR),JR=j.check(R(/^[a-f0-9]{64}$/u)),YR={commandId:J,expectedRevision:iR,...BR,sessionId:J,setupDigest:JR},rae=N({command:P(j.check(H(1024))).check(U(1,32)),files:P(N({path:j.check(H(1024)),sha256:JR})).check(H(32))}),XR=N({commandId:J,sessionId:J}),ZR=N(YR),QR=e=>V.check(B(e)),$R=N({concurrency:QR(qM.concurrency),depth:QR(qM.depth),fanOut:QR(qM.fanOut)}),ez=N({caps:$R,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===KM.concurrency&&e.caps.depth===KM.depth&&e.caps.fanOut===KM.fanOut:e.revision!==`0`&&e.updatedAt!==void 0,{expected:`the default caps at revision 0 without updatedAt, or changed caps with both`})),tz=V.check(B({maximum:JM,minimum:0})),nz=N({live:tz,total:tz}).check(L(e=>e.live<=e.total,{expected:`no more live children than children`})),rz=V.check(B({maximum:64,minimum:0})),iz=N({sessionId:k(J)}),iae=N({children:nz,depth:k(rz),role:k(Bj),sessionId:J}),az=N({caps:ez,method:A(`session.spawn-caps.show`),standing:k(iae)}),oz={caps:$R,commandId:J,expectedRevision:q},sz={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},cz=N(oz),lz=N({...oz,...sz}),uz=N({...oz,...sz,current:ez,method:A(`session.spawn-caps.preview`)}),dz=N({caps:ez,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===YM.type&&e.receipt.target.id===YM.id&&e.receipt.aggregateRevision===e.caps.revision,{expected:`changed caps under their own receipt`})),aae=F([N({method:A(`session.spawn-caps.show`),parameters:iz}),N({method:A(`session.spawn-caps.preview`),parameters:cz}),N({method:A(`session.spawn-caps.confirm`),parameters:lz})]),oae=F([az,uz,dz]),sae=N({children:nz,depth:rz,hostAuthority:k(A(!0)),permission:k(fR),role:Bj,sessionId:J}).check(L(e=>e.permission===void 0||e.hostAuthority===!0,{expected:`a permission mode only with host authority`})),fz={commandId:zR,executor:rN,hostAuthority:k(A(!0)),parent:sae,permission:k(fR),workspaceId:J},pz=L(e=>e.permission===void 0||e.hostAuthority===!0&&pR(e.executor,e.permission),{expected:`a permission mode only with host authority, at a value the executor kind supports`}),mz={...fz,expectedRevision:A(`0`),...BR},hz=N(fz).check(pz),gz=N(mz).check(pz),_z=N({commandId:J,expectedRevision:iR,sessionId:J,title:aR}),vz=RR,cae=N({children:nz,sessionId:J}),yz=N({...RR.fields,parent:k(cae)}),bz=N({body:rR,commandId:J,recipientSessionId:J,subject:nR}),xz=N({limit:k(V.check(z(1),my(16)))}),Sz=N({commandId:J,deliveryId:J,expectedMailboxRevision:iR}),Cz=N({contentBytes:iR,createdAt:K,deliveryCount:iR,id:J,revision:iR,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`})),wz=N({body:rR,createdAt:K,digest:j.check(U(64,64),R(/^[a-f0-9]{64}$/u)),id:J,recipientSessionId:J,schemaVersion:A(1),senderSessionId:J,subject:nR,workspaceId:J}).check(L(e=>e.senderSessionId!==e.recipientSessionId,{expected:`a direct Message between distinct Sessions`})),Tz={attemptCount:V.check(z(0),my(65535)),createdAt:K,firstCheckedAt:k(K),id:J,lastCheckedAt:k(K),mailboxId:J,message:wz,sequence:iR},Ez=N({...Tz,state:A(`pending`)}),Dz=N({...Tz,acknowledgedAt:K,acknowledgingSessionId:J,state:A(`acknowledged`)}),lae=F([Ez,Dz]),uae=e=>e.every((t,n)=>e.findIndex(e=>e.id===t.id)===n&&(n===0||BigInt(e[n-1]?.sequence??`0`)<BigInt(t.sequence))),dae=(e,t)=>e.mailboxId===t.id&&e.message.recipientSessionId===t.sessionId&&e.message.workspaceId===t.workspaceId,Oz=N({content:A(`untrusted_peer`),deliveries:P(Ez).check(H(16)),mailbox:Cz,method:A(`session.inbox.check`)}).check(L(e=>uae(e.deliveries)&&e.deliveries.every(t=>dae(t,e.mailbox)),{expected:`pending Session deliveries matching their mailbox`})),kz=N({delivery:I([`new`,`duplicate`]),deliveryId:J,mailboxId:J,message:wz,method:A(`session.message.send`),receipt:Y,sequence:iR}).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`})),Az=N({delivery:I([`new`,`duplicate`]),deliveryRecord:Dz,mailboxId:J,mailboxRevision:iR,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`})),jz=N({delivery:I([`new`,`duplicate`]),method:A(`session.create`),receipt:Y,session:_R}),Mz=N({...VR,method:A(`session.fork.preview`),path:A(`context-handoff`)}),Nz={delivery:I([`new`,`duplicate`]),handoff:j,path:A(`context-handoff`),receipt:Y,session:_R,sourceSessionId:J},Pz=N({...Nz,method:A(`session.fork.confirm`)}),Fz=N({...GR,method:A(`session.switch.preview`),path:A(`context-handoff`)}),Iz=N({...Nz,method:A(`session.switch.confirm`)}),Lz=N({...YR,approved:M,method:A(`session.setup.preview`),setup:rae}),Rz=N({delivery:I([`new`,`duplicate`]),method:A(`session.setup.confirm`),receipt:Y,sessionId:J,setupDigest:JR}).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`})),zz=N({...mz,method:A(`session.spawn.preview`)}).check(pz),Bz=N({delivery:I([`new`,`duplicate`]),method:A(`session.spawn.confirm`),parentSessionId:J,receipt:Y,session:_R}).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`})),Vz=N({attention:k(P(N({attention:I(WM),sessionId:J})).check(H(QL))),items:P(_R).check(H(QL)),method:A(`session.list`),nextCursor:k(iR)}).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`})),Hz=N({linkedAt:K,node:bA,observedState:k(cR),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`})),fae=qM.fanOut.maximum,Uz=N({method:A(`session.show`),remoteChildren:k(P(Hz).check(U(1,fae))),session:_R}),Wz=N({childSessionId:J,commandId:J,node:bA,outcome:I([`linked`,`orphaned`,`reconciled`]),parentSessionId:J,state:k(cR)}).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`})),Gz=N({child:Hz,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`})),pae=N({method:A(`session.spawn.record`),parameters:Wz}),Kz=N({method:A(`session.wait`),satisfied:M,session:_R}),qz=N({headSessionCursor:iR,items:P(AR).check(H($L)),method:A(`session.events.list`),nextSessionCursor:k(iR),oldestRetainedCursor:k(iR),sessionId:J}),Jz=N({delivery:I([`new`,`duplicate`]),method:A(`session.start`),receipt:Y,session:_R}),Yz=N({delivery:I([`new`,`duplicate`]),method:A(`session.stop`),receipt:Y,session:_R}),Xz=N({delivery:I([`new`,`duplicate`]),method:A(`session.resume`),receipt:Y,session:_R}),Zz=N({delivery:I([`new`,`duplicate`]),method:A(`session.rename`),receipt:Y,session:_R}).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`})),Qz=N({archive:k(RL),delivery:I([`new`,`duplicate`]),method:A(`session.archive`),receipt:Y,session:_R,summary:k(FL),transcriptPath:k(IL)}).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`})),mae=F([N({method:A(`session.create`),parameters:NR}),N({method:A(`session.list`),parameters:PR}),N({method:A(`session.show`),parameters:FR}),N({method:A(`session.wait`),parameters:IR}),N({method:A(`session.events.list`),parameters:LR}),N({method:A(`session.inbox.ack`),parameters:Sz}),N({method:A(`session.inbox.check`),parameters:xz}),N({method:A(`session.message.send`),parameters:bz}),N({method:A(`session.observe`),parameters:oN}),N({method:A(`session.start`),parameters:RR}),N({method:A(`session.stop`),parameters:vz}),N({method:A(`session.resume`),parameters:yz}),N({method:A(`session.diff`),parameters:kL}),N({method:A(`session.git.status`),parameters:jL}),N({method:A(`session.archive`),parameters:LL}),N({method:A(`session.rename`),parameters:_z}),N({method:A(`session.fork.preview`),parameters:HR}),N({method:A(`session.fork.confirm`),parameters:UR}),N({method:A(`session.switch.preview`),parameters:KR}),N({method:A(`session.switch.confirm`),parameters:qR}),N({method:A(`session.setup.preview`),parameters:XR}),N({method:A(`session.setup.confirm`),parameters:ZR}),N({method:A(`session.spawn.preview`),parameters:hz}),N({method:A(`session.spawn.confirm`),parameters:gz})]),hae=F([jz,Az,Oz,Vz,kz,fN,Uz,Kz,qz,Jz,Yz,Xz,AL,PL,Qz,Zz,Mz,Pz,Fz,Iz,Lz,Rz,zz,Bz]),gae=`maia.agent/v1`,_ae=`agent`,vae=16384,$z=q.check(R(/^[1-9]\d*$/u)),yae=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),eB=j.check(R(/^sha256:[a-f0-9]{64}$/u)),bae=I([...HS,X.maiaAgent,X.pi]),xae=j.check(U(1,vae),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=16384)),Sae=(e,t)=>new Set(e.map(t)).size===e.length,tB=N({accountableActorId:J,connectionId:k(J),effort:k(uR),harness:bae,homeSessionId:k(J),instruction:xae,managerAgentId:k(FS),model:k(qS),name:TS,placement:A(`local`)}).check(L(e=>(e.model===void 0||e.connectionId!==void 0)&&(e.effort===void 0||dR(e.harness,e.effort)),{expected:`a model only with a Connection; an effort only for a vendor executor, at a level it supports`})),nB=I([`active`,`disabled`]),rB=N({contentDigest:eB,createdAt:K,id:FS,projectId:J,revision:$z,schemaVersion:A(gae),spec:tB,state:nB,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`))),iB=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),projectId:J,state:k(nB)}),aB=N({items:P(rB).check(H(100)),method:A(`agents.list`),nextCursor:k(J)}).check(L(e=>Sae(e.items,e=>e.id))),oB=N({agentId:FS,revision:k($z)}),sB=N({agent:rB,method:A(`agents.show`)}),cB=iy(j,Qv),Cae=I([`failed`,`invalid_output`,`output_too_large`,`timeout`,`unsupported`]),wae=F([N({status:A(`ok`)}),N({reason:Cae,status:A(`unavailable`)})]),lB=N({harnesses:P(N({folders:P(N({path:j.check(U(1,512)),scope:A(`user`)})).check(H(8)),found:M,id:I(HS),version:k(j.check(U(1,64)))})).check(H(2)),method:A(`agents.detect`),scopes:N({user:wae})}),uB={agentId:FS,expectedRevision:$z},dB=F([N({kind:A(`create`),projectId:J,spec:tB}),N({...uB,kind:A(`revise`),spec:tB}),N({...uB,kind:A(`disable`)})]),fB={change:dB,commandId:J},pB={inputDigest:eB,proof:yae},mB=N(fB),hB=N({...fB,...pB}),gB=N({...fB,...pB,actorId:J,agentId:FS,current:k(rB),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`})),Tae=e=>e.kind===`disable`==(e.agent.state===`disabled`)&&e.kind===`create`==(e.agent.revision===`1`),_B=N({actorId:J,agent:rB,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:eB,kind:I([`create`,`disable`,`revise`]),method:A(`agents.change.confirm`),receipt:Y}).check(L(e=>Tae(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`})),Eae=F([N({method:A(`agents.detect`),parameters:cB}),N({method:A(`agents.list`),parameters:iB}),N({method:A(`agents.show`),parameters:oB}),N({method:A(`agents.change.preview`),parameters:mB}),N({method:A(`agents.change.confirm`),parameters:hB})]),Dae=F([lB,aB,sB,gB,_B]);G(tB),G(rB);var vB=G(dB);G(cB);var Oae=G(lB);G(iB);var kae=G(aB);G(oB);var Aae=G(sB);G(mB);var jae=G(gB);G(hB);var Mae=G(_B),Nae=_ae,yB=100;G(nT),G(rT),G(iT),G(aT),G(cT);var Pae=G(uT),Fae=G(dT),Iae=G(fT),Lae=50,bB=G;bB(CD),bB(hD),bB(wD),bB(TD),bB(gD),bB(yD),bB(ED),bB(LD),bB(RD),bB(VD),bB(HD),bB(KD),bB(qD),bB(YD),bB(XD),bB(ZD),bB(QD),bB($D),bB(eO),bB(tO),bB(iO);var Rae=bB(uO),zae=bB(dO),Bae=bB(fO),Vae=bB(pO),Hae=bB(mO),Uae=bB(hO),Wae=bB(gO),Gae=bB(_O),Kae=bB(vO),qae=bB(yO);bB(ik),bB(sk);var Jae=bB(lk);bB(CO);var Yae=bB(OO);bB(wO);var Xae=bB(kO);bB(TO);var Zae=bB(AO);bB(dk),bB(fk),bB(pk),bB(mk),bB(hk);var Qae=bB(vk),$ae=bB(yk),eoe=bB(bk),toe=bB(xk);G(Y),G(LS);var noe=G(RS);G(zS),G(BS);var roe=G(VS);G(XS),G(iC),G(rC),G(aC),G(oC),G(sC),G(cC),G(lC),G(uC),G(dC);var ioe=G(cw),aoe=G(sw),ooe=G(ow),soe=G(nw),coe=G(lw),loe=G(uw),uoe=G(aw);G(JS),G(qS),G(fC);var doe=G(rw);G(pC);var foe=G(iw);G(vw),G(xw);var poe=G(Sw);G(ww);var moe=G(Ew);G(Tw);var hoe=G(Dw);G(kw);var goe=G(Aw);G(jw);var _oe=G(Nw);G(Mw);var voe=G(Pw);G(JC),G(XC),G(YC),G(ZC),G(gC),G(SC),G(CC),G(TC);var yoe=G(OC);G(IC);var boe=G(BC);G(LC);var xoe=G(UC);G(EC);var Soe=G(kC);G(RC);var Coe=G(VC);G(zC);var woe=G(WC);G(CN),G(wN),G(TN);var Toe=G(DN);G(EN);var Eoe=G(ON);G(NN);var Doe=G(FN);G(VN);var Ooe=G(GN);G(UN);var koe=G(YN);G(HN);var Aoe=G(KN);G(WN);var joe=G(XN);G(GL),G(KL);var Moe=G(qL),Noe=G(YL);G(JL),G(_R),G(AR),G(NR),G(rN),G(Cz),G(wz),G(lae),G(bz),G(xz),G(Sz),G(PR),G(FR),G(IR);var Poe=G(Kz);G(LR);var Foe=G(jz),Ioe=G(kz),Loe=G(Oz),Roe=G(Az),zoe=G(Vz),Boe=G(Uz),Voe=G(qz);G(RR);var Hoe=G(Jz);G(vL),G(RI),G(wL),G(kL);var Uoe=G(AL);G(jL),G(PL),G(LL);var Woe=G(Qz);G(HR),G(Mz),G(UR),G(Pz),G(XR),G(Lz),G(ZR),G(Rz),G(hz),G(zz),G(gz),G(Bz),G(KR),G(Fz),G(qR),G(Iz),G(_z),G(Zz),G(ez),G(iz),G(az),G(cz),G(uz),G(lz),G(dz),G(oN),G(dN);var Goe=G(fN),Koe=N({executor:rN}),xB=ty.check(B({maximum:100,minimum:0})),qoe=N({diskFreePercent:xB,loadPerCpu:ty.check(z(0)),memoryAvailablePercent:xB,observedAt:K}),SB=ty.check(z(0)),Joe=N({...AS,measured:k(SB),required:k(SB)}).check(...jS,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`})),Yoe=N({capacity:N({activeSessions:V.check(z(0)),host:k(qoe),maximumActiveSessions:V.check(B({maximum:64,minimum:1}))}),executor:N({accounts:V.check(z(0)),id:rN,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(Joe)}).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`})),Xoe=N({method:A(`session.placement.show`),parameters:Koe});G(vz);var Zoe=G(Yz);G(yz);var Qoe=G(Xz);G(Hz),G(Wz),G(Gz);var CB=[`claude`,`codex`],$oe=4e3,ese=4096,wB=512,TB=e=>new Set(e).size===e.length,EB=e=>j.check(H(e)),DB=j.check(U(2,ese),R(/^\//u),L(e=>!e.includes(`\0`),{expected:`a path without NUL`})),OB=V.check(z(0)),kB=j.check(R(/^sha256:[a-f0-9]{64}$/u)),AB=I(CB),jB=I(HS),MB=J,NB=P(AB).check(gy(1),H(CB.length),L(TB,{expected:`unique sources`})),PB=I([`live`,`ended`,`unknown`]),FB=I([`pid-record`,`no-pid-record`,`recent-activity`,`vendor-active`,`no-process-evidence`]),IB=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(DB).check(gy(1),H(16))),sinceDays:k(V.check(B({maximum:365,minimum:1}))),sources:NB}),LB=N({branch:k(j.check(U(1,256))),gitCommonDirectory:DB,rootPath:DB}),RB=N({adoptedSessionId:k(J),content:k(N({firstPrompt:k(EB(wB)),preview:k(EB(wB)),title:k(EB(wB))})),createdAt:k(K),cwd:DB,executor:jB,lastActivityAt:K,liveness:PB,livenessEvidence:FB,model:k(j.check(U(1,256))),nativeId:MB,observed:k(I([`not-running`,`running`,`unknown`])),orphaned:M,repository:k(LB),sources:NB}),zB=N({cwd:k(DB),kind:I([`repository`,`directory`,`orphaned`]),lastActivityAt:K,registeredProjectId:k(J),repository:k(LB),sessionCount:OB}),tse=N({code:I([`source_unavailable`,`executable_unauthorized`]),message:EB(256),source:AB}),BB=N({groups:P(zB).check(H(200)),groupsTruncated:M,includesContentFields:M,items:P(RB).check(H(100)),method:A(`discovery.sessions.list`),nextCursor:k(j.check(R(/^[A-Za-z0-9_-]{1,1024}$/u))),since:K,sourceErrors:P(tse).check(H(CB.length)),sources:NB,summary:N({bySource:N({claude:OB,codex:OB}),excluded:N({maiaOwned:OB,outsideRoots:OB,subagent:OB}),orphaned:OB,total:OB}),truncatedSources:k(P(AB).check(H(CB.length),L(TB,{expected:`unique sources`})))}).check(L(e=>e.items.every(t=>t.content===void 0||e.includesContentFields),{expected:`content fields only when requested`})),nse=N({executor:jB,kind:A(`native`),nativeId:MB}),VB=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}),nse])}),HB=N({index:OB,role:I([`user`,`assistant`,`tool`]),text:EB($oe),toolName:k(j.check(U(1,128))),truncated:M}),UB=N({executor:jB,messages:P(HB).check(H(50)),method:A(`session.history.read`),nativeId:MB,nextOffset:k(OB),offset:OB}),WB=j.check(R(/^adopt_[A-Za-z0-9_-]{43}$/u)),rse={actorId:J,commandId:J,expiresAt:K,inputDigest:kB,issuedAt:K},ise=e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),GB={hostAuthority:k(A(!0)),permission:k(fR)},KB={labels:k(oR),role:k(Bj),title:k(aR)},ase=e=>e.role!==`orchestrator`||e.labels?.owner!==void 0,ose=e=>e.permission===void 0||e.hostAuthority===!0&&pR(e.executor,e.permission),qB=I([`maia`,`external`]),JB=N({attach:k(A(!0)),attestEnded:k(A(!0)),commandId:J,cwd:k(DB),executor:jB,...GB,...KB,nativeId:MB,workspaceId:k(J)}).check(L(ose,{expected:`a permission mode only with host authority, at a value its executor kind supports`}),L(ase,{expected:`an orchestrator with an owner label`})),YB={connectionId:J,executor:jB,nativeId:MB,workingDirectory:DB,workingDirectoryOrigin:I([`original`,`relocated`]),writer:k(qB)},XB=N({...rse,...YB,attestEnded:M,...GB,...KB,lastActivityAt:K,liveness:PB,livenessEvidence:FB,method:A(`session.adopt.preview`),previewId:WB,projectId:J,workspaceId:J}).check(L(ise)),ZB=N({alreadyAdopted:N({sessionId:J}),executor:jB,method:A(`session.adopt.preview`),nativeId:MB}),QB=N({inputDigest:k(kB),previewId:WB}),sse=e=>e.receipt.actorId===e.actorId&&e.receipt.commandId===e.commandId&&e.receipt.method===e.method,$B=N({actorId:J,adoption:N(YB),commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:kB,method:A(`session.adopt.confirm`),receipt:Y,session:_R}).check(L(e=>sse(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)),eV=N({executor:jB,nativeId:MB,writer:qB}),tV={commandId:J,sessionId:J},nV={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},rV=N(tV),iV=N({...tV,...nV}),aV=N({...tV,...nV,attachment:eV,method:A(`session.detach.preview`)}),oV=N({attachment:eV,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)),cse=N({holder:qB,nativeId:MB,reason:I([`attach`,`detach`]),runtime:jB,sessionId:J}),lse=F([N({method:A(`discovery.sessions.list`),parameters:IB}),N({method:A(`session.history.read`),parameters:VB}),N({method:A(`session.adopt.preview`),parameters:JB}),N({method:A(`session.adopt.confirm`),parameters:QB}),N({method:A(`session.detach.preview`),parameters:rV}),N({method:A(`session.detach.confirm`),parameters:iV})]),use=F([BB,UB,XB,ZB,$B,aV,oV]);G(IB);var dse=G(BB);G(RB),G(zB),G(VB);var fse=G(UB);G(HB),G(JB);var pse=G(XB),mse=G(ZB);G(QB);var hse=G($B);G(qB),G(rV),G(aV),G(iV),G(oV);var sV=G(cse),cV=131072,lV=1024,gse=1e4,_se=[`active`,`paused`,`blocked`,`done`,`failed`,`cancelled`,`budget`],vse=[`active`,`paused`,`blocked`,`done`,`failed`,`cancelled`],uV=[`turns`],dV=`session-goal`,fV=new TextEncoder,pV=q.check(R(/^[1-9]\d*$/u)),mV=j.check(R(/^sha256:[a-f0-9]{64}$/u)),hV=j.check(U(1,cV),L(e=>e.trim().length>0,{expected:`goal text that is not only whitespace`}),L(e=>fV.encode(e).byteLength<=cV,{expected:`goal text of at most ${String(cV)} UTF-8 bytes`})),gV=e=>j.check(U(1,lV),L(e=>e.trim().length>0&&!wS(e),{expected:`${e} on one line, not only whitespace`}),L(e=>fV.encode(e).byteLength<=lV,{expected:`${e} of at most ${String(lV)} UTF-8 bytes`})),_V=V.check(B({maximum:32,minimum:1})),vV=I(_se),yse=N({done:cy(N({at:K,by:J,evidence:gV(`evidence`)})),line:_V,text:gV(`a definition-of-done line`)}),yV=V.check(B({maximum:gse,minimum:1})),bse=N({limit:yV,unit:I(uV)}),bV=N({budget:cy(N({limit:yV,unit:I(uV),used:V.check(z(0))})),digest:mV,dod:P(yse).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:pV,sessionId:J,setAt:K,state:vV,text:hV}).check(L(e=>e.pausedBy===void 0||e.state===`paused`,{expected:`a pause marker on a paused goal alone`})),xV=N({budget:k(bse),commandId:J,dod:k(P(gV(`a definition-of-done line`)).check(U(1,32))),sessionId:J,text:hV}),SV=N({sessionId:J}),CV=N({commandId:J,expectedRevision:pV,sessionId:J,text:hV}),wV=N({commandId:J,expectedRevision:pV,sessionId:J}),TV=N({commandId:J,evidence:gV(`evidence`),expectedRevision:pV,line:_V,sessionId:J}),EV=N({commandId:J,expectedRevision:pV,sessionId:J,state:I(vse)}),DV={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y},xse=N({...DV,goal:bV,method:A(`goal.set`)}),Sse=N({...DV,expectedRevision:pV,goal:bV,method:A(`goal.update`)}),Cse=N({...DV,expectedRevision:pV,goal:bV,method:A(`goal.mark`)}),wse=N({...DV,expectedRevision:pV,goal:bV,method:A(`goal.transition`)}),Tse=N({...DV,expectedRevision:pV,method:A(`goal.clear`),revision:pV,sessionId:J}),OV=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,kV=e=>BigInt(e.target.revision)===BigInt(e.expectedRevision)+1n,AV=e=>({id:e.goal.sessionId,revision:e.goal.revision,type:dV}),Ese=e=>({id:e.sessionId,revision:e.revision,type:dV}),jV=xse.check(L(e=>OV({...e,target:AV(e)}))),MV=L(e=>{let t=AV(e);return OV({...e,target:t})&&kV({...e,target:t})}),NV=P(N({sessionId:J,turnId:J})).check(H(64)),PV={commandId:J.check(H(118)),expectedRevision:pV,sessionId:J},FV={inputDigest:j.check(R(/^[a-f0-9]{64}$/u)),proof:j.check(R(/^[A-Za-z0-9_-]{43}$/u)),validUntil:K},IV=N(PV),LV=N({...PV,...FV}),RV=N({...PV,...FV,goal:bV,method:A(`session.pause.preview`),turns:NV}),zV=N({...DV,expectedRevision:pV,goal:bV,interrupted:NV,method:A(`session.pause.confirm`)}).check(MV),BV=Sse.check(MV),VV=Cse.check(MV),HV=wse.check(MV),UV=Tse.check(L(e=>{let t=Ese(e);return OV({...e,target:t})&&kV({...e,target:t})})),WV=N({goal:cy(bV),method:A(`goal.show`),revision:cy(pV),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`})),Dse=N({change:I([`set`,`updated`,`cleared`,`marked`,`transitioned`]),digest:cy(mV),line:k(_V),previousRevision:cy(pV),revision:pV,sessionId:J,state:k(vV)}).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`})),Ose=F([N({method:A(`goal.set`),parameters:xV}),N({method:A(`goal.show`),parameters:SV}),N({method:A(`goal.update`),parameters:CV}),N({method:A(`goal.clear`),parameters:wV}),N({method:A(`goal.mark`),parameters:TV}),N({method:A(`goal.transition`),parameters:EV}),N({method:A(`session.pause.preview`),parameters:IV}),N({method:A(`session.pause.confirm`),parameters:LV})]),kse=F([jV,WV,BV,UV,VV,HV,RV,zV]),GV=[`drift`,`stall`,`waiting`],KV=[`D1`,`S1`,`S2`,`W1`],Ase=N({kind:I(GV),rule:I(KV),sessionId:J}),jse=dV;G(bV);var Mse=G(Dse),qV=G(Ase);G(xV);var Nse=G(jV);G(SV);var Pse=G(WV);G(CV);var Fse=G(BV);G(wV);var Ise=G(UV);G(TV);var Lse=G(VV);G(EV);var Rse=G(HV);G(IV),G(RV),G(LV),G(zV),G(EF);var zse=G(AF);G(DF);var Bse=G(PF);G(OF);var Vse=G(jF);G(kF);var Hse=G(FF);G(lF),G(uF),G(dF),G(yF),G(pF),G(mF),G(_F),G(vF),G(YF),G(XF),G(ZF),G($F),G(eI),G(tI),G(nI),G(aI),G(rI),G(iI),G(oI),G(sI),G(cI);var Use=G(lI),Wse=G(uI),Gse=G(dI),Kse=G(fI),qse=G(pI),Jse=G(mI),Yse=G(xI),Xse=G(hI),Zse=G(gI),Qse=G(yI),$se=G(bI),ece=G(SI);G(zF),G(HF);var tce=G(UF);G(WF);var nce=G(KF);G(GF);var rce=G(qF),ice=G(JF);G(kP),G(PP);var ace=G(FP);G(IP);var oce=G(RP);G(LP);var sce=G(zP);G(BP);var cce=G(VP);G(HP);var lce=G(GP);G(KP);var uce=G(JP);G(qP);var dce=G(YP);G(XP);var fce=G(ZP),pce=G(QP);G(lP),G(cP),G(dP),G(uP);var mce=2048,JV=j.check(R(/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/u)),hce=j.check(U(1,mce),R(/^(?:[^\p{Cc}]|\n)+$/u)),YV=j.check(R(/^sha256:[a-f0-9]{64}$/u)),XV=N({commandId:J,name:JV}),ZV=N({name:JV}),QV=N({commandId:J,expectedRevision:q,expiresAt:K,inputDigest:YV,name:JV,secretValue:hce}),$V=I([`duplicate`,`new`]),eH=N({commandId:J,delivery:$V,itemId:J,method:A(`secret.request`),name:JV,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`})),tH=N({actorId:J,expectedRevision:A(`0`),expiresAt:K,inputDigest:YV,issuedAt:K,method:A(`secret.set.preview`),name:JV}).check(L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),{expected:`a preview that has not expired when issued`})),nH=N({commandId:J,delivery:$V,inputDigest:YV,method:A(`secret.set.confirm`),name:JV,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`})),gce=F([N({method:A(`secret.request`),parameters:XV}),N({method:A(`secret.set.confirm`),parameters:QV}),N({method:A(`secret.set.preview`),parameters:ZV})]),_ce=F([eH,nH,tH]),vce=N({itemId:J,name:JV,sessionId:J}),yce=N({actorId:J,name:JV});G(JV);var bce=G(vce),xce=G(yce);G(XV);var Sce=G(eH);G(ZV);var Cce=G(tH);G(QV);var wce=G(nH),rH=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),Tce=N({previousShutdown:I([`clean`,`unclean`])}),Ece=N({reason:I([`stop`])}),iH=I([`ok`,`warn`,`refuse`]),aH=ty.check(B({maximum:100,minimum:0})),Dce=N({availablePercent:aH,level:iH,previousLevel:iH,thresholdPercent:aH}),Oce=N({droppedSinceLast:k(ty.check(hy(),B({maximum:1e9,minimum:1}))),reasonClass:rH,resourceId:k(J),scope:rH,sessionId:k(J)}),kce=G(Tce),Ace=G(Ece),jce=G(Oce),Mce=G(Dce);G(Lk);var Nce=G(Xre);G(Rk);var Pce=G(Zre),oH=j.check(U(1,64),R(/^[0-9A-Za-z][0-9A-Za-z._+-]*$/u)),Fce=I([`not_ready`,`session_lost`,`step_failed`]),Ice=N({from:oH,to:oH,updateId:J}),Lce=N({to:oH,updateId:J}),Rce=N({from:oH,reason:Fce,to:oH,updateId:J}),zce=G(Ice),Bce=G(Lce),Vce=G(Rce),sH=q.check(R(/^[1-9]\d*$/u)),Hce=new TextEncoder,Uce=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]|\r(?!\n)/u,Wce=/[\u0000-\u001F\u007F-\u009F\u2028\u2029]/u,cH=e=>j.check(U(1,e),L(e=>!Wce.test(e))),lH=e=>j.check(gy(1),L(t=>Hce.encode(t).byteLength<=e&&!Uce.test(t))),uH=lH(4096),dH=cH(240),fH=N({kind:A(`external-cli`)}),pH=K.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u)),mH=I([`pending`,`answered`,`cancelled`,`expired`]),hH=j.check(R(/^[a-z][a-z0-9_-]{0,31}$/u)),gH=P(N({label:cH(80),optionId:hH})).check(U(2,8),L(e=>new Set(e.map(e=>e.optionId)).size===e.length)),_H={body:uH,commandId:J,expectedSessionRevision:sH,expiresAt:k(pH),origin:fH,projectId:J,sessionId:J,subject:dH},Gce=F([N({..._H,kind:A(`question`)}),N({..._H,kind:A(`selection`),options:gH})]),Kce=N({afterCursor:k(J),lifecycleStatus:k(mH),limit:V.check(B({maximum:100,minimum:1})),projectId:J,sessionId:J}),qce=N({interactionId:J}),vH=F([N({kind:A(`text`),value:lH(16384)}),N({kind:A(`selection`),optionIds:P(hH).check(U(1,8),L(e=>new Set(e).size===e.length))})]),yH={commandId:J,expectedRevision:sH,interactionId:J},Jce=N({...yH,answer:vH}),Yce=N(yH),Xce=F([N({method:A(`interaction.cancel`),parameters:Yce}),N({method:A(`interaction.create`),parameters:Gce}),N({method:A(`interaction.list`),parameters:Kce}),N({method:A(`interaction.respond`),parameters:Jce}),N({method:A(`interaction.show`),parameters:qce})]),bH=j.check(R(/^sha256:[a-f0-9]{64}$/u)),xH={activationId:ey,answeredAt:cy(pH),answerSchemaDigest:bH,body:uH,createdAt:pH,expiresAt:cy(pH),interactionId:J,lifecycleStatus:mH,origin:fH,projectId:J,requestingActorId:J,revision:sH,schemaVersion:A(`maia.interaction/v1`),sessionId:J,subject:dH,wakeDisposition:A(`record-only`)},SH={...xH,kind:A(`question`)},CH={...xH,kind:A(`selection`),options:gH},Zce=F([N(SH),N(CH)]),wH=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))}},TH=Zce.check(L(wH)),EH={answer:k(vH),respondingActorId:k(J),responseDigest:k(bH)},Qce=F([N({...SH,...EH}),N({...CH,...EH})]),$ce=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))},DH=Qce.check(L(e=>wH(e)&&$ce(e))),ele=65536,tle=new TextEncoder,OH=L(e=>tle.encode(JSON.stringify(e)).byteLength<=ele),kH={actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:bH,receipt:Y},nle=N({...kH,interaction:TH,method:A(`interaction.create`)}),rle=N({...kH,expectedRevision:sH,interaction:TH,method:A(`interaction.cancel`)}),ile=N({...kH,expectedRevision:sH,interaction:DH,method:A(`interaction.respond`)}),AH=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))},jH=nle.check(L(e=>AH(e)&&e.interaction.lifecycleStatus===`pending`&&e.receipt.createdAt===e.interaction.createdAt),OH),MH=rle.check(L(e=>AH(e)&&e.interaction.lifecycleStatus===`cancelled`&&BigInt(e.interaction.revision)===BigInt(e.expectedRevision)+1n),OH),NH=ile.check(L(e=>AH(e)&&e.interaction.lifecycleStatus===`answered`&&e.receipt.createdAt===e.interaction.answeredAt&&BigInt(e.interaction.revision)===BigInt(e.expectedRevision)+1n),OH),PH=N({items:P(TH).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)),OH),FH=N({interaction:DH,method:A(`interaction.show`)}).check(OH),ale=F([jH,PH,FH,NH,MH]),ole=N({approvalId:J,kind:Yw,sessionId:J,status:A(`pending`),turnId:J}),sle=N({actorId:J,approvalId:J,guardRevision:k(q),kind:Yw,sessionId:J,status:I([`answered`,`approved`,`cancelled`,`denied`,`expired`]),turnId:J}),cle=N({interactionId:J,lifecycleStatus:mH,projectId:J,sessionId:J}),lle=G(ole),ule=G(sle),IH=G(cle),LH=[[`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`]]],RH=256,zH=512,BH=512,dle=512,VH=512,HH=256,UH=512,WH=512,fle=new Map([[`admission.refused`,{maxPayloadBytes:HH,payloadSchema:jce}],[`approval.requested`,{maxPayloadBytes:WH,payloadSchema:lle}],[`approval.resolved`,{maxPayloadBytes:WH,payloadSchema:ule}],[`drift.raised`,{maxPayloadBytes:BH,payloadSchema:qV}],[`drift.settled`,{maxPayloadBytes:BH,payloadSchema:qV}],[`goal.changed`,{maxPayloadBytes:BH,payloadSchema:Mse}],[`interaction.answered`,{maxPayloadBytes:WH,payloadSchema:IH}],[`interaction.cancelled`,{maxPayloadBytes:WH,payloadSchema:IH}],[`interaction.created`,{maxPayloadBytes:WH,payloadSchema:IH}],[`node.memory.changed`,{maxPayloadBytes:HH,payloadSchema:Mce}],[`node.started`,{maxPayloadBytes:HH,payloadSchema:kce}],[`node.stopping`,{maxPayloadBytes:HH,payloadSchema:Ace}],[`project.instructions.changed`,{maxPayloadBytes:dle,payloadSchema:ice}],[`project.knowledge.changed`,{maxPayloadBytes:512,payloadSchema:pce}],[`secret.requested`,{maxPayloadBytes:UH,payloadSchema:bce}],[`secret.set`,{maxPayloadBytes:UH,payloadSchema:xce}],[`session.activity.changed`,{maxPayloadBytes:RH,payloadSchema:Nce}],[`session.attached`,{maxPayloadBytes:zH,payloadSchema:sV}],[`session.detached`,{maxPayloadBytes:zH,payloadSchema:sV}],[`session.status.changed`,{maxPayloadBytes:RH,payloadSchema:Pce}],[`update.done`,{maxPayloadBytes:VH,payloadSchema:Bce}],[`update.rolled_back`,{maxPayloadBytes:VH,payloadSchema:Vce}],[`update.started`,{maxPayloadBytes:VH,payloadSchema:zce}]]),ple=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`]),mle=(e,t)=>{let n=`${e}.${t}`;return{exposure:ple.has(n)?`public`:`internal`,kind:n,maxPayloadBytes:Fre,source:e,version:1,...fle.get(n)}},hle=LH.flatMap(([e,t])=>t.map(t=>mle(e,t)));LH.map(([e])=>e);var gle=new Map(hle.map(e=>[e.kind,e])),_le=e=>gle.get(e),vle=65536,yle=4096,ble=e=>new TextEncoder().encode(e).byteLength,xle=j.check(gy(1),H(yle),L(e=>{if(e.startsWith(`/`)||e.includes(`\\`)||e.includes(`\0`)||/^[A-Za-z]:/u.test(e)||ble(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`})),Sle=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},Cle=j.check(L(e=>/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e)&&Sle(e)<=65536,{expected:`base64 file content within 65536 decoded bytes`})),wle=j.check(R(/^sha256:[0-9a-f]{64}$/u)),GH=N({commandId:J,expectedRevision:q,instanceId:J,relativePath:xle}),KH={commandId:J,id:J,instanceId:J,instanceRevision:q,revision:q,schemaVersion:A(TI)},qH=F([N({...KH,state:I([`prepared`,`running`])}),N({...KH,byteLength:V.check(B({maximum:vle,minimum:0})),bytesBase64:Cle,contentDigest:wle,state:A(`succeeded`)}),N({...KH,failure:I([`file_changed`,`file_not_found`,`file_not_regular`,`file_too_large`,`path_invalid`]),state:A(`failed`)}),N({...KH,state:A(`outcome_unknown`)})]),JH=N({delivery:I([`duplicate`,`new`]),method:A(`execution.file.read`),operation:qH,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`})),Tle=4096,Ele=65536,Dle=4096,Ole=e=>new TextEncoder().encode(e).byteLength,kle=j.check(gy(1),H(Tle),L(e=>!e.includes(`\0`),{expected:`an execution argument without NUL bytes`})),Ale=j.check(gy(1),H(Dle),L(e=>!e.includes(`\0`)&&(e.startsWith(`/`)||/^[A-Za-z]:[\\/]/u.test(e)),{expected:`an absolute execution path without NUL bytes`})),jle=P(kle).check(H(32),L(e=>e.reduce((e,t)=>e+Ole(t),0)<=Ele,{expected:`execution arguments within 65536 UTF-8 bytes`})),Mle=e=>{let t=0;return e.endsWith(`==`)?t=2:e.endsWith(`=`)&&(t=1),e.length/4*3-t},YH=j.check(L(e=>/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e)&&Mle(e)<=65536,{expected:`base64 execution output within 65536 decoded bytes`})),XH=N({argv:jle,commandId:J,executable:Ale,expectedRevision:q,instanceId:J}),ZH={commandId:J,id:J,instanceId:J,instanceRevision:q,revision:q,schemaVersion:A(TI)},Nle=N({...ZH,cleanup:A(`pending`),state:I([`prepared`,`running`])}),Ple=N({code:cy(V),signal:cy(j.check(gy(1),H(64)))}),QH=F([Nle,N({...ZH,cleanup:A(`clean`),exit:Ple,state:I([`failed`,`succeeded`]),stderrBase64:YH,stdoutBase64:YH}),N({...ZH,cleanup:A(`unknown`),state:A(`outcome_unknown`)})]),$H=N({delivery:I([`duplicate`,`new`]),method:A(`execution.command.run`),operation:QH,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`})),Fle=`maia.execution-placement/v1alpha1`,eU=q,Ile=N({reason:A(`local_provider_unbound`),status:A(`unavailable`)}),Lle=N({reason:A(`worker_lease_unimplemented`),status:A(`unavailable`)}),Rle=F([N({id:J,kind:A(`profile`),revision:eU,source:A(`workspace`)}),N({id:J,kind:A(`policy`),revision:eU,source:I([`node-default`,`workspace`])})]),tU={authority:Ile,createdAt:K,fencingEpoch:eU,id:J,instanceId:J,instanceRevision:eU,lease:Lle,profileId:J,profileRevision:eU,revision:eU,schemaVersion:A(Fle),selection:Rle,state:A(`current`),updatedAt:K,workspaceId:J,workspaceRevision:eU},nU=e=>e.selection.kind===`policy`||e.selection.source===`workspace`&&e.selection.id===e.profileId&&e.selection.revision===e.profileRevision,rU=N({...tU,kind:A(`session`),sessionId:J,sessionRevision:eU}).check(L(nU,{expected:`a Session placement with an exact profile selection snapshot`})),iU=N({...tU,attemptId:J,attemptRevision:eU,kind:A(`attempt`),runId:J,taskId:J}).check(L(nU,{expected:`an Attempt placement with an exact profile selection snapshot`})),aU=F([rU,iU]),oU={commandId:J,expectedFencingEpoch:A(`0`),expectedInstanceRevision:eU,expectedPlacementRevision:A(`0`),expectedWorkspaceRevision:eU,instanceId:J},sU=N({...oU,expectedSessionRevision:eU,sessionId:J}),cU=N({...oU,attemptId:J,expectedAttemptRevision:eU,runId:J,taskId:J}),lU=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`,uU=N({delivery:I([`new`,`duplicate`]),method:A(`execution.placement.create`),placement:rU,receipt:Y}).check(L(lU,{expected:`a Session placement receipt matching its immutable placement`})),dU=N({delivery:I([`new`,`duplicate`]),method:A(`execution.placement.create`),placement:iU,receipt:Y}).check(L(lU,{expected:`an Attempt placement receipt matching its immutable placement`})),fU=F([sU,cU]),pU=F([uU,dU]),mU=F([N({kind:A(`session`),ownerId:J}),N({kind:A(`attempt`),ownerId:J})]),hU=N({method:A(`execution.placement.show`),placement:aU}),gU=`maia.execution-relocation/v1alpha1`,zle=1048576,_U=q,vU=j.check(L(e=>/^sha256:[a-f0-9]{64}$/u.test(e),{expected:`a lowercase SHA-256 digest`})),Ble=j.check(L(e=>/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(e),{expected:`an exact Git object revision`})),yU=I([`runtime_bound`,`session_not_idle`,`source_dirty`,`source_placement_missing`,`target_profile_unsupported`,`turn_active`]),Vle=I([`checkpointing`,`completed`,`creating_standby`,`cutover_committed`,`draining_source`,`failed`,`outcome_unknown`,`prepared`]),bU=N({byteLength:V.check(z(0),my(zle)),contentDigest:vU,createdAt:K,id:J,kind:A(`local-identity`),schemaVersion:A(gU),sourceInstanceId:J,sourceRevision:Ble,targetInstanceId:J,workspaceId:J}),xU={commandId:J,id:J,revision:_U,schemaVersion:A(gU),sessionId:J,sourceInstanceId:J,workspaceId:J},SU=F([N({...xU,cleanup:A(`pending`),phase:I([`checkpointing`,`creating_standby`,`prepared`]),state:I([`dispatching`,`prepared`])}),N({...xU,checkpointId:J,cleanup:A(`clean`),fencingEpoch:_U,phase:I([`completed`,`cutover_committed`,`draining_source`]),placementRevision:_U,state:A(`succeeded`),targetInstanceId:J}),N({...xU,cleanup:A(`clean`),failure:yU,phase:A(`failed`),state:A(`failed`)}),N({...xU,cleanup:A(`unknown`),phase:A(`outcome_unknown`),state:A(`outcome_unknown`)})]),Hle=N({blockers:P(yU).check(H(16)),digest:vU,eligible:M,expectedFencingEpoch:_U,expectedPlacementRevision:_U,expectedSessionRevision:_U,id:J,sessionId:J,sourceInstanceId:J,targetProfileId:A(DI),workspaceId:J}).check(L(e=>e.eligible===(e.blockers.length===0),{expected:`a relocation plan whose eligibility matches its blockers`})),CU=N({expectedFencingEpoch:_U,expectedPlacementRevision:_U,expectedSessionRevision:_U,sessionId:J,targetProfileId:A(DI)}),wU=N({method:A(`execution.relocation.plan`),plan:Hle}),TU=N({commandId:J,expectedFencingEpoch:_U,expectedPlacementRevision:_U,expectedSessionRevision:_U,planDigest:vU,planId:J,sessionId:J}),EU=N({checkpoint:k(bU),delivery:I([`duplicate`,`new`]),method:A(`execution.relocation.apply`),operation:SU,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`})),DU=N({relocationId:J}),OU=N({checkpoint:k(bU),method:A(`execution.relocation.show`),operation:SU}),kU=N({commandId:J,expectedOperationRevision:_U,relocationId:J}),AU=N({delivery:I([`duplicate`,`new`]),method:A(`execution.relocation.reconcile`),operation:SU,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`})),Ule=F([N({method:A(`execution.relocation.apply`),parameters:TU}),N({method:A(`execution.relocation.plan`),parameters:CU}),N({method:A(`execution.relocation.reconcile`),parameters:kU}),N({method:A(`execution.relocation.show`),parameters:DU})]),Wle=F([EU,wU,AU,OU]),jU=q,MU=N({binding:A(`unavailable`),builtIn:A(!0),deploymentMode:A(`agentless`),id:A(EI),kind:A(`local-host`),reason:A(`local_provider_unbound`),releaseQualified:A(!1),revision:A(`1`),schemaVersion:A(TI),trust:A(`trusted_host`),unsupportedCapabilities:oy([A(`isolation`),A(`ports`),A(`snapshots`)])}),NU=N({builtIn:A(!0),id:A(DI),name:A(`Local host`),providerId:A(EI),revision:A(`1`),schemaVersion:A(TI)}),PU=N({builtIn:A(!0),id:A(kI),name:A(`Local default`),profileIds:oy([A(DI)]),revision:A(`1`),schemaVersion:A(TI)}),FU=F([N({id:J,kind:A(`profile`)}),N({id:J,kind:A(`policy`)})]),IU=N({selection:FU,workspaceId:J,workspaceRevision:jU}),LU=N({reason:A(`local_provider_unbound`),selectedProfileId:J,selection:FU,source:I([`node-default`,`workspace`]),status:A(`unavailable`),workspaceId:J,workspaceRevision:jU}),RU=iy(j,Qv),zU=N({id:J,profileId:A(DI),providerId:A(EI),revision:jU,schemaVersion:A(TI),state:A(`folder-bound`),workspaceId:J}),BU=RU,VU=N({workspaceId:J}),HU={commandId:J,expectedRevision:jU,workspaceId:J},UU=F([N({...HU,operation:A(`clear`)}),N({...HU,operation:A(`set`),selection:FU})]),WU=N({defaultPolicyId:A(kI),method:A(`execution.catalog.get`),policies:oy([PU]),profiles:oy([NU]),providers:oy([MU])}),GU=(e,t)=>e.kind===t.kind&&e.id===t.id,KU=e=>e.kind===`profile`?e.id===DI:e.id===kI,qU=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`&&KU(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`&&GU(e.binding.selection,e.resolution.selection)),JU=N({binding:k(IU),instance:k(zU),method:A(`workspace.execution.show`),resolution:LU,workspace:dF}).check(L(qU,{expected:`an exact workspace execution projection`})),YU=N({binding:k(IU),delivery:I([`new`,`duplicate`]),method:A(`workspace.execution.configure`),receipt:Y,resolution:LU,workspace:dF}).check(L(e=>qU(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`})),XU=F([N({method:A(`execution.catalog.get`),parameters:BU}),N({method:A(`execution.command.run`),parameters:XH}),N({method:A(`execution.file.read`),parameters:GH}),N({method:A(`execution.placement.create`),parameters:fU}),N({method:A(`execution.placement.show`),parameters:mU}),N({method:A(`workspace.execution.show`),parameters:VU}),N({method:A(`workspace.execution.configure`),parameters:UU})]),ZU=F([WU,$H,JH,pU,hU,JU,YU]);G(MU),G(NU),G(PU),G(FU),G(IU),G(LU),G(BU);var QU=G(WU);G(zU),G(VU);var $U=G(JU);G(UU);var eW=G(YU),tW=2**53-1,nW=1e9,rW=4096,iW=2048,aW=20,oW=q.check(R(/^[1-9]\d*$/u)),sW=j.check(R(/^[a-z][a-z0-9-]{0,62}$/u)),cW=V.check(B({maximum:tW,minimum:1})),lW=j.check(R(/^[A-Za-z0-9][A-Za-z0-9-]{0,38}\/(?!\.{1,2}$)[A-Za-z0-9._-]{1,100}$/u)),uW=P(j.check(R(/^[A-Za-z0-9][A-Za-z0-9-]{0,38}(?:\[bot\])?$/u))).check(H(aW),L(e=>new Set(e.map(e=>e.toLowerCase())).size===e.length,{expected:`allowed authors without duplicates`})),dW=V.check(B({maximum:nW,minimum:1})),fW=j.check(U(1,rW),R(/^-----BEGIN (?:RSA )?PRIVATE KEY-----[A-Za-z0-9+/=\s]+-----END (?:RSA )?PRIVATE KEY-----\s*$/u)),pW=N({appId:cW,connectionId:J,createdAt:K,installationId:cW,name:sW,revision:oW,state:I([`active`,`revoked`]),updatedAt:K}),mW=N({allowedAuthors:uW,connectionId:k(J),createdAt:K,linkId:J,number:dW,repository:lW,revision:oW,sessionId:J,updatedAt:K,watching:M}),hW=V.check(z(0)),gW=j.check(H(iW),R(/^https:\/\/[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::\d{1,5})?(?:[/?#][!-~]*)?$/u)),_W=N({link:mW,observation:k(N({checks:N({failed:hW,passed:hW,pending:hW}),headSha:j.check(R(/^[0-9a-f]{40,64}$/u)),mergeable:I([`conflicting`,`mergeable`,`unknown`]),observedAt:K,state:I([`closed`,`merged`,`open`]),webUrl:k(gW)})),pollError:k(I([`not_found`,`rate_limited`,`unauthorized`,`unavailable`])),wakes:N({delivered:hW,skipped:hW})}),vW=N({appId:cW,commandId:J,installationId:cW,name:sW,privateKey:fW}),yW=N({connectionId:k(J)}),bW=N({commandId:J,connectionId:J,expectedRevision:oW}),xW=N({commandId:J,connectionId:k(J),number:dW,repository:lW,sessionId:J}),SW=N({sessionId:J}),CW=N({allowedAuthors:uW,commandId:J,expectedRevision:oW,linkId:J,watching:M}),wW={commandId:J,delivery:I([`duplicate`,`new`]),receipt:Y},TW=N({...wW,connection:pW,keyCustody:I([`kept`,`stored`]),method:A(`connection.github.create`)}),EW=N({...wW,connection:pW,expectedRevision:oW,method:A(`connection.github.revoke`)}),DW=N({...wW,link:mW,method:A(`pr.link`)}),OW=N({...wW,expectedRevision:oW,link:mW,method:A(`pr.watch`)}),kW=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,AW=e=>BigInt(e.target.revision)===BigInt(e.expectedRevision)+1n,jW=e=>({id:e.connection.connectionId,revision:e.connection.revision,type:`github-connection`}),MW=e=>({id:e.link.linkId,revision:e.link.revision,type:`pr-link`}),NW=TW.check(L(e=>kW({...e,target:jW(e)})&&e.connection.revision===`1`&&e.connection.state===`active`)),PW=EW.check(L(e=>{let t=jW(e);return kW({...e,target:t})&&AW({...e,target:t})&&e.connection.state===`revoked`})),FW=N({connections:P(pW).check(H(100),L(e=>new Set(e.map(e=>e.connectionId)).size===e.length)),method:A(`connection.github.show`)}),IW=DW.check(L(e=>kW({...e,target:MW(e)})&&e.link.revision===`1`&&!e.link.watching)),LW=OW.check(L(e=>{let t=MW(e);return kW({...e,target:t})&&AW({...e,target:t})})),RW=N({method:A(`pr.status`),sessionId:J,statuses:P(_W).check(H(5))}).check(L(e=>e.statuses.every(t=>t.link.sessionId===e.sessionId))),zW=F([N({method:A(`connection.github.create`),parameters:vW}),N({method:A(`connection.github.show`),parameters:yW}),N({method:A(`connection.github.revoke`),parameters:bW}),N({method:A(`pr.link`),parameters:xW}),N({method:A(`pr.status`),parameters:SW}),N({method:A(`pr.watch`),parameters:CW})]),BW=F([NW,FW,PW,IW,RW,LW]);G(pW),G(mW),G(gW),G(vW);var VW=G(NW);G(yW);var HW=G(FW);G(bW);var UW=G(PW);G(xW);var WW=G(IW);G(SW);var GW=G(RW);G(CW);var KW=G(LW),qW=iy(j,Qv),JW={authorized:A(!1),selected:A(!1)},YW=(e,t)=>({...JW,displayName:A(t),harnessId:A(e)}),XW=(e,t)=>N({...YW(e,t),detected:A(!1),reason:I([`deadline_exceeded`,`path_invalid`,`path_unsafe`,`permission_denied`]),status:A(`indeterminate`)}),ZW=(e,t)=>{let n=YW(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`)}),XW(e,t)])},QW=qW,$W=N({items:oy([ZW(`codex`,`Codex`),ZW(`cursor`,`Cursor`),ZW(`grok`,`Grok`),ZW(`mistral-vibe`,`Mistral Vibe`),ZW(X.pi,`Pi`)]),method:A(`harness.installed.list`),schemaVersion:A(2)}),eG=N({method:A(`harness.installed.list`),parameters:QW});G(QW);var tG=G($W);G(Uk),G(Jk),G(Yk),G(Xk);var nG=G(Zk);G(rA);var rG=G(sA);G(iA);var iG=G(dA);G(aA);var aG=G(cA);G(oA);var oG=G(fA),sG=`maia.inbox/v1`,cG=`inbox_item`,lG=J.check(R(/^inbox_[a-f0-9]{32}$/u)),uG=I([`approval`,`confirmation`,`failed_turn`,`finished_session`,`goal_drift`,`question`,`secret_request`]),dG=I([`open`,`settled`,`snoozed`]),fG=j.check(R(/^[a-f0-9]{64}$/u)),pG=j.check(R(/^sha256:[a-f0-9]{64}$/u)),mG=N({id:J,type:j.check(R(/^[a-z][a-z_]{0,31}$/u))}),hG={expiresAt:K,input:iy(j,$v),inputDigest:fG,requestDigest:pG,revision:k(q),targets:P(mG).check(H(16))},gG=j.check(U(1,128)),_G=N({...hG,createdAt:K,itemId:lG,operation:gG,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`})),vG=new Set([`failed_turn`,`finished_session`,`goal_drift`]),yG=e=>e===`approval`||e===`question`,bG=N({approvalId:k(J),createdAt:K,itemId:lG,kind:uG,principalId:J,revision:q,schemaVersion:A(sG),secretName:k(JV),sessionId:k(J),snoozedUntil:k(K),state:dG,turnId:k(J),updatedAt:K}).check(L(e=>e.state===`snoozed`==(e.snoozedUntil!==void 0)&&(yG(e.kind)?e.approvalId!==void 0&&e.sessionId!==void 0&&e.turnId!==void 0:e.approvalId===void 0)&&(!vG.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`})),xG=N({limit:V.check(B({maximum:50,minimum:1})),state:k(dG)}),SG=N({itemId:lG}),CG=N({itemId:lG,...oT}).check(sT),wG={commandId:J,expectedRevision:q,itemId:lG},TG=N(wG),EG=N({...wG,until:K}),DG=N({items:P(bG).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`})),OG=N({approval:k(nT),confirmation:k(_G),item:bG,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`})),kG={commandId:J,delivery:I([`duplicate`,`new`]),item:bG,receipt:Y},AG=(e,t)=>e.receipt.commandId===e.commandId&&e.receipt.method===e.method&&e.receipt.target.type===t.type&&e.receipt.target.id===t.id,jG=F([N({...kG,approval:nT,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&&AG(e,{id:e.approval.approvalId,type:`approval`}),{expected:`a resolved approval bound to its receipt`})),N({...kG,confirmation:_G,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&&AG(e,{id:e.item.itemId,type:`inbox_item`}),{expected:`a decided proposal bound to the person's receipt`}))]),MG=L(e=>AG(e,{id:e.item.itemId,type:cG}),{expected:`an inbox item bound to its receipt`}),NG=N({...kG,method:A(`inbox.settle`)}).check(MG),PG=N({...kG,method:A(`inbox.snooze`)}).check(MG),FG=F([N({method:A(`inbox.list`),parameters:xG}),N({method:A(`inbox.respond`),parameters:CG}),N({method:A(`inbox.settle`),parameters:TG}),N({method:A(`inbox.show`),parameters:SG}),N({method:A(`inbox.snooze`),parameters:EG})]),IG=F([DG,jG,NG,OG,PG]);G(bG),G(_G),G(xG);var LG=G(DG);G(SG);var RG=G(OG);G(CG);var zG=G(jG);G(TG);var BG=G(NG);G(EG);var VG=G(PG),HG=8192,UG=2048,WG=16384,GG=new TextEncoder,KG=(e,t)=>j.check(U(1,e),L(t=>!t.includes(`\0`)&&GG.encode(t).byteLength<=e,{expected:t})),qG=KG(128,`a non-empty integration revision of at most 128 UTF-8 bytes`).check(R(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),JG=KG(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)),YG=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`})),XG=j.check(U(1,20),R(/^[0-9]+$/u)),ZG=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`})),QG=N({device:ZG,inode:ZG,sizeBytes:ZG}),$G=j.check(U(64,64),R(/^[0-9a-f]{64}$/u)),eK=KG(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`})),tK=eK.check(L(e=>e!==`/`,{expected:`a non-root normalized absolute Pi RPC path`})),nK=F([oy([A(`codex-probe`)]),oy([A(`codex-session`)]),oy([A(`codex-probe`),A(`codex-session`)])]),rK=oy([A(`claude-code-session`)]),iK=oy([A(`maia-agent-session`)]),aK=oy([A(`pi-session`)]),oK=oy([A(`antigravity-session`)]),sK=F([oy([A(`pi-rpc-probe`)]),oy([A(`pi-rpc-probe`),A(`pi-rpc-session`)])]),cK=I([`arm64`,`x64`]),lK=KG(214,`a Pi package name of at most 214 UTF-8 bytes`).check(R(/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/u)),uK=KG(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)),dK=V.check(z(1),my(WG)),fK=V.check(z(0),my(16)),pK=e=>({integration:A(e),releaseQualified:A(!1),schemaVersion:A(1)}),mK=pK(`codex`),hK=pK(`pi-rpc`),gK=pK(X.claudeCode),_K=pK(X.maiaAgent),vK=pK(X.pi),yK=pK(X.antigravity),bK={adapterVersion:qG,executableSha256:$G,ownerKinds:nK,planDigest:$G,planId:J,revision:YG,sandboxPolicyRevision:qG,vouchPolicyRevision:qG},xK={...bK,ownerKinds:rK},SK={...bK,ownerKinds:iK},CK={...bK,ownerKinds:aK},wK={...bK,ownerKinds:oK},TK={adapterVersion:JG,conversationPolicyRevision:JG,entryFileIdentity:QG,entrySha256:$G,interpreterArchitecture:cK,interpreterFileIdentity:QG,interpreterSha256:$G,interpreterVersion:A(`24.22.1`),ownerKinds:sK,packageClosureBytes:ZG,packageClosureEntries:dK,packageClosureSha256:$G,packageManifestSha256:$G,packageName:lK,packageVersion:uK,planDigest:$G,planId:J,revision:YG,vouchPolicyRevision:JG},EK=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`}},DK=e=>e.authorization.state===e.outcome,OK=(e,t)=>N({...e,state:A(t)}),kK=e=>OK(bK,e),AK=e=>OK(TK,e),jK=e=>N({...e,state:I([`active`,`revoking`,`revoked`,`replaced`,`cleanup_unknown`])}).pipe(ly(e=>!0,{expected:`an integration authorization state`})),MK=jK(bK),NK=jK(TK),PK=jK(xK),FK=e=>N({integration:A(e)}),IK=FK(`codex`),LK=N({commandId:J,planId:J}),RK=LK,zK=FK(`codex`),BK=e=>N({commandId:J,integration:A(e)}),VK=BK(`codex`),HK=FK(`pi-rpc`),UK=LK,WK=FK(`pi-rpc`),GK=BK(`pi-rpc`),KK=FK(X.claudeCode),qK=LK,JK=FK(X.claudeCode),YK=BK(X.claudeCode),XK=FK(X.maiaAgent),ZK=LK,QK=FK(X.maiaAgent),$K=BK(X.maiaAgent),eq=FK(X.pi),tq=LK,nq=FK(X.pi),rq=BK(X.pi),iq=FK(X.antigravity),aq=LK,oq=FK(X.antigravity),sq=BK(X.antigravity),cq=V.check(z(1),my(HG)),lq=(e,t,n)=>N({...e,method:A(t),plan:N({createdAt:K,expiresAt:K,integration:A(n.integration),planBytes:cq,planDigest:$G,planId:J,target:n.target})}),uq=N({adapter:A(`codex`),adapterVersion:qG,executableIdentity:N({device:XG,inode:XG,sizeBytes:XG}),executablePath:eK,executableSha256:$G,ownerKinds:nK,sandboxPolicyRevision:qG,vouchPolicyRevision:qG}),dq=lq(mK,`integration.plan.codex`,{integration:`codex`,target:uq}),fq=N({...uq.fields,adapter:A(X.claudeCode),ownerKinds:rK}),pq=lq(gK,`integration.plan.claude-code`,{integration:X.claudeCode,target:fq}),mq=N({...uq.fields,adapter:A(X.maiaAgent),ownerKinds:iK}),hq=lq(_K,`integration.plan.maia-agent`,{integration:X.maiaAgent,target:mq}),gq=N({...uq.fields,adapter:A(X.pi),ownerKinds:aK}),_q=lq(vK,`integration.plan.pi`,{integration:X.pi,target:gq}),vq=N({...uq.fields,adapter:A(X.antigravity),ownerKinds:oK}),yq=lq(yK,`integration.plan.antigravity`,{integration:X.antigravity,target:vq}),bq=N({identity:QG,path:tK,sha256:$G}),xq=lq(hK,`integration.plan.pi-rpc`,{integration:`pi-rpc`,target:N({adapter:A(`pi-rpc`),adapterVersion:JG,conversationPolicyRevision:JG,entry:bq,interpreter:N({architecture:cK,identity:QG,path:tK,sha256:$G,version:A(`24.22.1`)}),ownerKinds:sK,packageClosure:N({closureSha256:$G,entryCount:dK,manifestFormat:A(`maia.pi-package-closure/v1`),manifestSha256:$G,packageName:lK,packageRoot:tK,packageVersion:uK,totalBytes:ZG}),vouchPolicyRevision:JG})}),Sq=(e,t,n)=>N({...e,authorization:t,delivery:I([`new`,`duplicate`]),method:A(n),outcome:A(`applied`),receipt:Y}),Cq=Sq(mK,kK(`active`),`integration.apply.codex`),wq=Sq(hK,AK(`active`),`integration.apply.pi-rpc`),Tq=Sq(gK,OK(xK,`active`),`integration.apply.claude-code`),Eq=Sq(_K,OK(SK,`active`),`integration.apply.maia-agent`),Dq=Sq(vK,OK(CK,`active`),`integration.apply.pi`),Oq=Sq(yK,OK(wK,`active`),`integration.apply.antigravity`),kq=N({authorizationAvailable:A(!1),nextAction:A(`plan_and_apply`),reason:A(`no_authorization`)}),Aq=e=>N({activeUnsettledPermits:fK,authorization:e,authorizationAvailable:A(!0),nextAction:I([`inspect_cleanup_unknown`,`none`,`plan_and_apply`,`wait_for_revocation`]),revokingUnsettledPermits:fK}),jq=e=>F([Aq(jK(e)).pipe(ly(e=>EK(e),{expected:`a status item consistent with its authorization state`})),kq]),Mq=jq(bK),Nq=jq(TK),Pq=jq(xK),Fq=jq(SK),Iq=jq(CK),Lq=jq(wK),Rq=(e,t,n)=>N({...e,items:oy([t]),method:A(n.method)}).check(L(e=>GG.encode(JSON.stringify(e)).byteLength<=UG,{expected:n.expected})),zq=Rq(mK,Mq,{expected:`an integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.codex`}),Bq=Rq(hK,Nq,{expected:`a Pi RPC integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.pi-rpc`}),Vq=Rq(gK,Pq,{expected:`a Claude Code integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.claude-code`}),Hq=Rq(_K,Fq,{expected:`a maia-agent integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.maia-agent`}),Uq=Rq(vK,Iq,{expected:`a pi integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.pi`}),Wq=Rq(yK,Lq,{expected:`an antigravity integration authorization status result of at most 2048 UTF-8 bytes`,method:`integration.status.antigravity`}),Gq=(e,t,n)=>N({...e,authorization:t,delivery:I([`new`,`duplicate`]),invalidatedIssuedPermits:fK,method:A(n),outcome:I([`cleanup_unknown`,`revoked`]),receipt:Y,remainingUnsettledPermits:fK}),Kq=(e,t,n)=>Gq(e,jK(t),n).pipe(ly(e=>DK(e),{expected:`a remove outcome consistent with its authorization state`})),qq=Kq(mK,bK,`integration.remove.codex`),Jq=Kq(hK,TK,`integration.remove.pi-rpc`),Yq=Kq(gK,xK,`integration.remove.claude-code`),Xq=Kq(_K,SK,`integration.remove.maia-agent`),Zq=Kq(vK,CK,`integration.remove.pi`),Qq=Kq(yK,wK,`integration.remove.antigravity`),$q=(e,t)=>N({method:A(e),parameters:t}),eJ=F([$q(`integration.plan.codex`,IK),$q(`integration.apply.codex`,RK),$q(`integration.status.codex`,zK),$q(`integration.remove.codex`,VK),$q(`integration.plan.pi-rpc`,HK),$q(`integration.apply.pi-rpc`,UK),$q(`integration.status.pi-rpc`,WK),$q(`integration.remove.pi-rpc`,GK),$q(`integration.plan.claude-code`,KK),$q(`integration.apply.claude-code`,qK),$q(`integration.status.claude-code`,JK),$q(`integration.remove.claude-code`,YK),$q(`integration.plan.maia-agent`,XK),$q(`integration.apply.maia-agent`,ZK),$q(`integration.status.maia-agent`,QK),$q(`integration.remove.maia-agent`,$K),$q(`integration.plan.pi`,eq),$q(`integration.apply.pi`,tq),$q(`integration.status.pi`,nq),$q(`integration.remove.pi`,rq),$q(`integration.plan.antigravity`,iq),$q(`integration.apply.antigravity`,aq),$q(`integration.status.antigravity`,oq),$q(`integration.remove.antigravity`,sq)]),tJ=F([dq,Cq,zq,qq,xq,wq,Bq,Jq,pq,Tq,Vq,Yq,hq,Eq,Hq,Xq,_q,Dq,Uq,Zq,yq,Oq,Wq,Qq]);G(PK),G(Pq),G(KK),G(qK),G(JK),G(YK);var nJ=G(pq),rJ=G(Tq),iJ=G(Vq),aJ=G(Yq);G(MK),G(Mq),G(IK),G(RK),G(zK),G(VK);var oJ=G(dq),sJ=G(Cq),cJ=G(zq),lJ=G(qq);G(XK),G(ZK),G(QK),G($K);var uJ=G(hq),dJ=G(Eq),fJ=G(Hq),pJ=G(Xq);G(eq),G(tq),G(nq),G(rq);var mJ=G(_q),hJ=G(Dq),gJ=G(Uq),_J=G(Zq);G(iq),G(aq),G(oq),G(sq);var vJ=G(yq),yJ=G(Oq),bJ=G(Wq),xJ=G(Qq);G(NK),G(Nq),G(HK),G(UK),G(WK),G(GK);var SJ=G(xq),CJ=G(wq),wJ=G(Bq),TJ=G(Jq);G(TH),G(DH);var EJ=G(jH),DJ=G(PH),OJ=G(FH),kJ=G(NH),AJ=G(MH),jJ=e=>e.toLowerCase()!==`all`,MJ=e=>new Set(e).size===e.length,NJ=L(jJ,{expected:`an exact target, never the literal all`}),PJ=J.check(H(122)),FJ=N({capabilities:P(j.check(U(1,32),R(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),NJ)).check(U(1,8),L(MJ,{expected:`unique capability codes`})),projectId:PJ.check(NJ)}),IJ=N({audience:PJ,certificateFingerprint:j.check(R(/^sha256:[a-f0-9]{64}$/u)),grants:P(FJ).check(H(16),L(e=>MJ(e.map(e=>e.projectId)),{expected:`at most one grant per Project`})),registrationIncarnation:J,revocationRevision:q}),LJ=16384,RJ=Math.max(...Object.values(zM).map(({length:e})=>e)),zJ=`maia.invocation-context/v1`,BJ=new TextEncoder,VJ=iy(j,Qv),HJ=j.check(U(1,64),R(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u)),UJ=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)}),WJ=N({actorId:J,allowedActions:P(HJ).check(H(RJ)),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(IJ),method:A(`context.show`),nodeId:k(J),principal:N({displayName:k(TS),id:J,kind:I([`client`,`session`,`machine`,`person`])}),related:k(UJ),role:k(Bj),schemaVersion:A(zJ)}),GJ=e=>BJ.encode(JSON.stringify(e)).byteLength<=LJ,KJ=e=>new Set(e.allowedActions).size===e.allowedActions.length,qJ=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,JJ=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,YJ=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,XJ=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,ZJ=VJ,QJ=WJ.check(L(KJ,{expected:`unique Invocation-context allowed-action codes`}),L(qJ,{expected:`a Client Invocation-context projection without attachment, related IDs, or issue/expiry timestamps`}),L(JJ,{expected:`a Session Invocation-context projection, by attachment or by its own credential with its role and actor, with Session/Workspace related IDs`}),L(YJ,{expected:`a person Invocation-context projection by the paired person's actor ID and display name alone, with no Session or attachment fields`}),L(XJ,{expected:`a machine Invocation-context projection by its Execution Node identity and grants alone, with no user, Session or attachment fields`}),L(GJ,{expected:`an encoded Invocation-context projection of at most 16384 UTF-8 bytes`})),$J=N({method:A(`context.show`),parameters:ZJ}),eY=QJ;G(ZJ);var tY=G(QJ),nY=G,rY=nY(XA),iY=nY(ZA),aY=nY($A),oY=nY(ej);nY(tj);var sY=nY(nj);nY(rj);var cY=nY(ij);nY(aj);var lY=nY(oj);nY(sj);var uY=nY(cj);nY(lj);var dY=nY(uj);nY(dj);var fY=nY(fj);nY(pj);var pY=nY(mj),mY=I([`operator`,`reader`]),hY=F([N({kind:A(`create`),role:mY}),N({kind:A(`revoke`),pairingId:J})]),gY=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),_Y={change:hY,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},vY=N({clientId:k(J),createdAt:K,expiresAt:K,pairingId:J,role:mY,state:I([`active`,`expired`,`pending`,`revoked`])}),yY=N({method:A(`node.pairing.show`),pairings:P(vY).check(H(100))}),bY=N({change:hY,commandId:J}),xY=N({..._Y,method:A(`node.pairing.preview`)}),SY=N(_Y),CY=N({code:k(gY),expiresAt:k(K),method:A(`node.pairing.confirm`),pairingId:J,receiptId:J,replayed:M,revision:q,role:mY,state:I([`pending`,`revoked`])}),wY=N({clientId:J,commandId:J}),TY=N({clientId:J,credential:k(gY),expiresAt:K,method:A(`node.pairing.redeem`),pairingId:J,receiptId:J,replayed:M,role:mY}),EY=F([N({method:A(`node.pairing.show`),parameters:N({})}),N({method:A(`node.pairing.preview`),parameters:bY}),N({method:A(`node.pairing.confirm`),parameters:SY}),N({method:A(`node.pairing.redeem`),parameters:wY})]),DY=F([yY,xY,CY,TY]);G(bY);var OY=G(xY);G(SY);var kY=G(CY);G(wY);var AY=G(TY),jY=G(yY),MY=`maia.port-lease/v1`,NY=V.check(B({maximum:65535,minimum:1024})),PY=j.check(R(/^[a-z0-9][a-z0-9._-]{0,63}$/u)),FY=q.check(R(/^[1-9]\d*$/u)),IY=I([`active`,`expired`,`released`]),LY=I([`owner_missing`,`owner_released`,`session_ended`,`ttl_expired`]),RY=F([N({kind:A(`session`),sessionId:J}),N({kind:A(`principal`),principalId:J})]),zY=P(NY).check(U(1,8),L(e=>new Set(e).size===e.length,{expected:`unique ports`})),BY=e=>e.state===`active`?e.endReason===void 0:e.state===`expired`?e.endReason===`ttl_expired`:e.endReason!==void 0&&e.endReason!==`ttl_expired`,VY=N({endReason:k(LY),expiresAt:K,grantedAt:K,leaseId:J,owner:RY,ports:zY,purpose:PY,revision:FY,schemaVersion:A(MY),state:IY,updatedAt:K}).check(L(e=>BY(e)&&Date.parse(e.expiresAt)>Date.parse(e.grantedAt)&&Date.parse(e.updatedAt)>=Date.parse(e.grantedAt),{expected:`a consistent port lease lifecycle`})),HY=N({commandId:J,count:k(V.check(B({maximum:8,minimum:1}))),preferred:k(NY),purpose:PY,sessionId:k(J)}),UY=N({commandId:J,expectedRevision:FY,leaseId:J}),WY=N({commandId:J,leaseId:J}),GY=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),sessionId:k(J)}),KY=F([N({method:A(`port.lease.acquire`),parameters:HY}),N({method:A(`port.lease.list`),parameters:GY}),N({method:A(`port.lease.release`),parameters:WY}),N({method:A(`port.lease.renew`),parameters:UY})]),qY={commandId:J,delivery:I([`duplicate`,`new`]),lease:VY,receipt:Y},JY=N({...qY,method:A(`port.lease.acquire`)}),YY=N({...qY,expectedRevision:FY,method:A(`port.lease.renew`)}),XY=N({...qY,method:A(`port.lease.release`)}),ZY=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,QY=JY.check(L(e=>ZY(e)&&e.lease.revision===`1`&&e.lease.state===`active`,{expected:`a new active lease bound to its receipt`})),$Y=YY.check(L(e=>ZY(e)&&e.lease.state===`active`&&BigInt(e.lease.revision)===BigInt(e.expectedRevision)+1n,{expected:`an active lease advanced by one revision`})),eX=XY.check(L(e=>ZY(e)&&e.lease.state!==`active`,{expected:`an ended lease bound to its receipt`})),tX=N({lease:VY,probes:P(N({inUse:M,port:NY}))}).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`})),nX=N({end:NY,start:NY}).check(L(e=>e.start<=e.end,{expected:`an ascending port range`})),rX=N({items:P(tX).check(H(100)),method:A(`port.lease.list`),nextCursor:k(J),range:nX}).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`})),iX=F([QY,rX,eX,$Y]);G(VY),G(RY),G(HY),G(UY),G(WY),G(GY);var aX=G(QY),oX=G($Y),sX=G(eX),cX=G(rX),lX=`maia.presentation.portfolio/v3`,uX=`sha256:59860e3f18670e2692319fcc23b8c65cb38177aef85d8cfcdfd532d64d327824`,dX=j.check(R(/^[1-9][0-9]{0,19}$/u)),fX=J.check(R(/^container_[A-Za-z0-9_-]+$/u)),pX=N({elements:iy(j,F([N({children:P(j.check(R(/^(projects|project_[0-9]{1,3})$/u))).check(H(100)),props:N({containerId:fX,revision:dX}),type:A(`ProjectList`)}),N({children:oy([]),props:N({projectId:J,revision:dX}),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`)})),mX={catalogDigest:A(uX),catalogVersion:A(lX),generation:V.check(B({maximum:2147483647,minimum:0})),viewId:J},hX=N({...mX,page:EN}),gX=N({...mX,authority:A(`operator-local`),membershipCursor:k(J),method:A(`presentation.project-list.show`),nodeInstanceId:J,releaseQualified:A(!1),resources:ON,spec:pX}).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)),_X=q.check(R(/^[1-9][0-9]*$/u)),vX={containerId:J.check(R(/^container_[A-Za-z0-9_-]+$/u)),containerRevision:_X,projectId:J,projectRevision:_X},yX=N({...vX,membershipCursor:k(J)}),bX={catalogDigest:A(uX),catalogVersion:A(lX),generation:V.check(B({maximum:2147483647,minimum:0})),target:yX,viewId:J},xX=N({elements:iy(j,F([N({children:P(j.check(R(/^(sessions|session_[0-9]{1,3})$/u))).check(H(100)),props:N(vX),type:A(`SessionList`)}),N({children:oy([]),props:N({revision:_X,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`)})),SX=N({items:P(dN).check(H(100)),observedAt:fN.fields.observedAt,stallAfterSeconds:fN.fields.stallAfterSeconds}),CX=N({...bX,page:N({...PR.fields,limit:sR})}).check(L(e=>e.page.projectId===e.target.projectId&&e.page.attention===void 0&&e.page.states===void 0)),wX=N({...bX,authority:A(`operator-local`),method:A(`presentation.session-list.show`),nodeInstanceId:J,observations:SX,releaseQualified:A(!1),resources:Vz,spec:xX}).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)),TX=A(lX),EX=A(uX),DX=iy(j,Qv),OX=V.check(B({maximum:2147483647,minimum:0})),kX=j.check(R(/^(directory|workspace_[0-9]{1,3})$/u)),AX=N({containerId:J.check(R(/^container_[A-Za-z0-9_-]+$/u)),revision:j.check(R(/^[1-9][0-9]{0,19}$/u))}),jX=N({elements:iy(j,F([N({children:P(kX).check(H(100)),props:DX,type:A(`WorkspaceDirectory`)}),N({children:oy([]),props:AX,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`)})),MX=DX,NX=N({actions:oy([]),authority:A(`operator-local`),catalogDigest:EX,catalogVersion:TX,components:oy([A(`WorkspaceDirectory`),A(`WorkspaceReference`),A(`ProjectList`),A(`ProjectReference`),A(`SessionList`),A(`SessionReference`)]),method:A(`presentation.catalog.show`),releaseQualified:A(!1)}),PX=N({catalogDigest:EX,catalogVersion:TX,generation:OX,page:TN,viewId:J}),FX=N({authority:A(`operator-local`),catalogDigest:EX,catalogVersion:TX,generation:OX,method:A(`presentation.workspace-directory.show`),nodeInstanceId:J,releaseQualified:A(!1),resources:DN,spec:jX,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)),IX=F([N({method:A(`presentation.session-list.show`),parameters:CX}),N({method:A(`presentation.project-list.show`),parameters:hX}),N({method:A(`presentation.catalog.show`),parameters:MX}),N({method:A(`presentation.workspace-directory.show`),parameters:PX})]),LX=F([wX,gX,NX,FX]),RX=G(CX),zX=G(wX);G(xX);var BX=G(hX),VX=G(gX);G(pX),G(MX);var HX=G(NX),UX=G(PX),WX=G(FX);G(jX);var GX=I([`operator`,`reader`]),KX=j.check(R(/^[a-z][a-z0-9-]{0,31}$/u)),qX=F([N({kind:A(`create`),name:KX,role:GX}),N({kind:A(`revoke`),principalId:J})]),JX=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),YX={change:qX,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},XX=N({createdAt:K,kind:A(`bot`),name:KX,principalId:J,revokedAt:k(K),role:GX,state:I([`active`,`revoked`])}),ZX=N({method:A(`node.principal.show`),principals:P(XX).check(H(100))}),QX=N({change:qX,commandId:J}),$X=N({...YX,method:A(`node.principal.preview`)}),eZ=N(YX),tZ=N({method:A(`node.principal.confirm`),name:KX,principalId:J,receiptId:J,replayed:M,revision:q,role:GX,state:I([`active`,`revoked`]),token:k(JX)}),nZ=F([N({method:A(`node.principal.show`),parameters:N({})}),N({method:A(`node.principal.preview`),parameters:QX}),N({method:A(`node.principal.confirm`),parameters:eZ})]),rZ=F([ZX,$X,tZ]),iZ=N({confirmation:N({by:A(`person`),itemId:lG}),operation:gG,preview:N(hG),principalId:J,status:A(`confirmation_required`)});G(QX);var aZ=G($X);G(eZ);var oZ=G(tZ),sZ=G(ZX);G(iZ);var cZ=`maia.provider/v1`,lZ=j.check(U(1,128),R(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u)),uZ=j.check(U(1,256),R(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/u)),dZ=V.check(z(0),my(32)),fZ=N({availableCredentialCount:dZ,credentialCount:dZ,default:M,model:uZ,poolId:lZ,providerId:lZ}),pZ=N({method:A(`provider.pool.list`),pools:P(fZ).check(H(16)),releaseQualified:A(!1),schemaVersion:A(cZ)}),mZ=e=>new TextEncoder().encode(JSON.stringify(e)).byteLength,hZ=pZ.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)&&mZ(e)<=16384},{expected:`a bounded provider pool list with unique pool IDs, valid counts, and at most one default`})),gZ=iy(j,Qv),_Z=N({method:A(`provider.pool.list`),parameters:gZ});G(fZ),G(gZ);var vZ=G(hZ),yZ=/^(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,bZ=1024,xZ=65535,SZ=e=>e.reduce((e,t)=>e*256+Number(t),0),CZ=[[`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:SZ(e.split(`.`)),size:2**(32-t)})),wZ=e=>{let t=yZ.exec(e)?.slice(1);if(t===void 0||t.some(e=>Number(e)>255))return!1;let n=SZ(t);return CZ.some(({base:e,size:t})=>n>=e&&n<e+t)},TZ=e=>wZ(e.address)&&Number.isInteger(e.port)&&e.port>=bZ&&e.port<=xZ,EZ=N({address:j.check(R(/^\d{1,3}(?:\.\d{1,3}){3}$/u)),port:V.check(B({maximum:65535,minimum:1024}))}),DZ=N({bind:k(EZ)}),OZ={code:k(j),state:I([`failed`,`listening`,`off`])},kZ={change:DZ,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},AZ=N({}),jZ=N({...OZ,bind:k(EZ),method:A(`node.reach.show`),revision:q}),MZ=N({change:DZ,commandId:J}),NZ=N({...kZ,method:A(`node.reach.preview`),transport:k(A(`cleartext-http`))}),PZ=N(kZ),FZ=N({applied:N(OZ),bind:k(EZ),method:A(`node.reach.confirm`),receiptId:J,replayed:M,revision:q}),IZ=F([N({method:A(`node.reach.show`),parameters:AZ}),N({method:A(`node.reach.preview`),parameters:MZ}),N({method:A(`node.reach.confirm`),parameters:PZ})]),LZ=F([jZ,NZ,FZ]);G(MZ);var RZ=G(NZ);G(PZ);var zZ=G(FZ),BZ=G(jZ),VZ=[`connection`,`container`,`project`,`session`,`workspace`],HZ=[`project`,`workspace`],UZ=new TextEncoder,WZ=I(VZ),GZ=j.check(U(1,256),L(e=>!wS(e),{expected:`a one-line reference`})),KZ=j.check(L(e=>e.startsWith(`/`)&&!wS(e)&&UZ.encode(e).byteLength<=4096,{expected:`an absolute path of at most 4096 bytes`})),qZ=new Set(HZ),JZ=new Set([`session`,`workspace`]),YZ=N({kind:WZ,path:k(KZ),projectId:k(J),reference:k(GZ)}).check(L(e=>e.reference===void 0?qZ.has(e.kind)&&e.projectId===void 0:e.path===void 0&&(e.projectId===void 0||JZ.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`})),XZ=j.check(U(1,256)),ZZ=N({id:J,label:k(XZ)}),QZ=I([`id`,`prefix`,`name`,`path`,`selection`]),$Z=F([N({id:J,kind:WZ,label:k(XZ),match:QZ,method:A(`reference.resolve`),outcome:A(`resolved`),projectId:k(J)}),N({candidates:P(ZZ).check(gy(2),H(8)),kind:WZ,method:A(`reference.resolve`),outcome:A(`ambiguous`)})]),eQ=N({method:A(`reference.resolve`),parameters:YZ}),tQ=$Z,nQ=G;nQ(Sj),nQ(Cj),nQ(wj),nQ(Tj),nQ(Dj),nQ(NA);var rQ=nQ(jj);nQ(PA);var iQ=nQ(Ij);nQ(Oj),nQ(IA);var aQ=nQ(Mj);nQ(LA);var oQ=nQ(Fj);nQ(FA);var sQ=nQ(Lj);nQ(RA);var cQ=nQ(Rj);nQ(zA);var lQ=nQ(zj);nQ(_A),nQ(oie),nQ(lie);var uQ=`maia.routine/v1`,dQ=527040,fQ=1024,pQ=[`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`],mQ=`maia.routine-trigger/v1`,hQ=J.check(R(/^routine_[a-f0-9]{32}$/u)),gQ=J.check(R(/^fire_[a-f0-9]{32}$/u)),_Q=q.check(R(/^[1-9]\d*$/u)),vQ=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),yQ=j.check(R(/^sha256:[a-f0-9]{64}$/u)),bQ=j.check(R(/^[0-9A-Za-z*/,-]{1,64}(?: [0-9A-Za-z*/,-]{1,64}){4}$/u)),xQ=j.check(R(/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/u),H(64)),SQ=K.check(R(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u)),CQ=N({expression:bQ,timezone:xQ}),wQ=N({at:SQ}),TQ=N({everyMinutes:V.check(B({maximum:dQ,minimum:1})),startsAt:SQ}),EQ=N({event:Nk}),DQ=F([CQ,EQ,wQ,TQ]),OQ=N({agentId:k(FS),connectionId:k(J),executor:k(rN),mode:k(I([`new`,`continue`])),model:k(qS),projectId:J,prompt:aM}).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`})),kQ=N({command:P(j.check(gy(1),H(fQ))).check(gy(1),H(32)),timeoutSeconds:V.check(B({maximum:300,minimum:1}))}),AQ=I([`active`,`disabled`,`paused`]),jQ=N({confirmedBy:J,createdAt:K,id:hQ,name:TS,nextFireAt:k(K),precheck:k(N({...kQ.fields,digest:yQ})),revision:_Q,schedule:DQ,schemaVersion:A(uQ),state:AQ,template:OQ,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`})),MQ=e=>e===`overlap`||e===`precheck_skipped`,NQ=N({eventId:k(Mk),failure:k(NS),failureReason:k(Xie),id:gQ,missed:k(V.check(z(1))),outcome:I([`failed`,`launching`,`skipped`,`started`]),reason:k(I(pQ)),recordedAt:K,routineId:hQ,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 MQ(e.reason)&&e.sessionId===void 0;case`failed`:return e.reason!==void 0&&!MQ(e.reason)}},{expected:`a fire whose outcome matches its reason, Session and turn`})),PQ=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),projectId:k(J),state:k(AQ)}),FQ=N({items:P(jQ).check(H(100)),method:A(`routine.list`),nextCursor:k(J)}),IQ=N({routineId:hQ}),LQ=N({fires:P(NQ).check(H(20)),method:A(`routine.show`),routine:jQ}),RQ=N({afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1})),routineId:k(hQ)}),zQ=N({items:P(NQ).check(H(100)),method:A(`routine.runs`),nextCursor:k(J)}),BQ={commandId:J,name:TS,paused:k(M),precheck:k(kQ),schedule:DQ,template:OQ},VQ={inputDigest:yQ,proof:vQ},HQ=N(BQ),UQ=N({...BQ,...VQ}),WQ={...VQ,actorId:J,expiresAt:K,issuedAt:K},GQ=L(e=>Date.parse(e.issuedAt)<Date.parse(e.expiresAt),{expected:`a preview that expires after it was issued`}),KQ=N({...BQ,...WQ,method:A(`routine.create.preview`),nextFires:P(K).check(H(3)),precheckDigest:k(yQ),routineId:hQ}).check(GQ,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`})),qQ=e=>e.receipt.target.type===`routine`&&e.receipt.target.id===e.routine.id&&e.receipt.aggregateRevision===e.routine.revision,JQ=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:yQ,method:A(`routine.create.confirm`),receipt:Y,routine:jQ}).check(L(e=>qQ(e)&&e.receipt.method===e.method&&e.routine.revision===`1`,{expected:`a created routine matching its receipt`})),YQ={commandId:J,expectedRevision:_Q,routineId:hQ},XQ=N(YQ),ZQ=XQ,QQ=N({...YQ,...VQ}),$Q=QQ,e$=e=>N({...YQ,...WQ,method:A(e),name:TS}).check(GQ),t$=e$(`routine.disable.preview`),n$=e$(`routine.run.preview`),r$=(e,t)=>N({delivery:I([`new`,`duplicate`]),method:A(e),receipt:Y,routine:jQ}).check(L(n=>qQ(n)&&n.receipt.method===e&&n.routine.state===t,{expected:`a ${t} routine matching its receipt`})),i$=r$(`routine.pause`,`paused`),a$=r$(`routine.resume`,`active`),o$=r$(`routine.disable.confirm`,`disabled`),s$=N({delivery:I([`new`,`duplicate`]),fire:NQ,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`})),c$={...YQ,agentId:k(FS),prompt:k(aM),schedule:k(DQ)},l$=[`agentId`,`prompt`,`schedule`],u$=L(e=>l$.some(t=>e[t]!==void 0),{expected:`at least one of a prompt, a schedule and an Agent`}),d$=N(c$).check(u$),f$=N({...c$,...VQ}).check(u$),p$=N({...c$,...WQ,changes:N({agentId:k(N({after:FS,before:FS})),prompt:k(N({after:aM,before:aM})),schedule:k(N({after:DQ,before:DQ,nextFireAt:k(K)}))}),method:A(`routine.update.preview`),name:TS}).check(GQ,L(e=>l$.every(t=>e[t]===void 0==(e.changes[t]===void 0)),{expected:`one change for each field the update names, and no other`})),m$=N({changed:P(I(l$)).check(gy(1),H(l$.length)),delivery:I([`new`,`duplicate`]),method:A(`routine.update.confirm`),receipt:Y,routine:jQ}).check(L(e=>qQ(e)&&e.receipt.method===e.method,{expected:`an updated routine matching its receipt`})),h$={...YQ,projectId:J},g$=N(h$),_$=N({...h$,...VQ}),v$=N({...h$,...WQ,fromProjectId:J,method:A(`routine.move.preview`),moves:N({fires:V.check(z(0)),triggers:V.check(z(0))}),name:TS}).check(GQ,L(e=>e.fromProjectId!==e.projectId,{expected:`a destination Project other than the routine's own`})),y$=N({delivery:I([`new`,`duplicate`]),fromProjectId:J,method:A(`routine.move.confirm`),receipt:Y,routine:jQ}).check(L(e=>qQ(e)&&e.receipt.method===e.method&&e.routine.template.projectId!==e.fromProjectId,{expected:`a routine moved to another Project, matching its receipt`})),b$=J.check(R(/^trigger_[a-f0-9]{32}$/u)),x$=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))}),S$=P(x$).check(H(8)),C$=V.check(B({maximum:60,minimum:1})),w$=N({confirmedBy:J,createdAt:K,filters:S$,id:b$,ratePerMinute:C$,revision:_Q,routineId:hQ,schemaVersion:A(mQ),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`})),T$=N({routineId:hQ}),E$=N({method:A(`routine.trigger.list`),triggers:P(w$).check(H(32))}),D$={commandId:J,filters:S$,ratePerMinute:C$,routineId:hQ},O$=N(D$),k$=N({...D$,...VQ,signingSecret:j.check(R(/^[!-~]{32,256}$/u))}),A$=N({...D$,...WQ,method:A(`routine.trigger.create.preview`),triggerId:b$}).check(GQ),j$=e=>e.receipt.target.type===`routine_trigger`&&e.receipt.target.id===e.trigger.id&&e.receipt.aggregateRevision===e.trigger.revision,M$=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),inputDigest:yQ,method:A(`routine.trigger.create.confirm`),receipt:Y,trigger:w$}).check(L(e=>j$(e)&&e.receipt.method===e.method&&e.trigger.revision===`1`&&e.trigger.state===`active`,{expected:`a created trigger matching its receipt`})),N$=N({commandId:J,expectedRevision:_Q,triggerId:b$}),P$=N({delivery:I([`new`,`duplicate`]),method:A(`routine.trigger.disable`),receipt:Y,trigger:w$}).check(L(e=>j$(e)&&e.receipt.method===e.method&&e.trigger.state===`disabled`,{expected:`a disabled trigger matching its receipt`})),F$=F([N({method:A(`routine.list`),parameters:PQ}),N({method:A(`routine.show`),parameters:IQ}),N({method:A(`routine.runs`),parameters:RQ}),N({method:A(`routine.create.preview`),parameters:HQ}),N({method:A(`routine.create.confirm`),parameters:UQ}),N({method:A(`routine.pause`),parameters:XQ}),N({method:A(`routine.resume`),parameters:XQ}),N({method:A(`routine.disable.preview`),parameters:ZQ}),N({method:A(`routine.disable.confirm`),parameters:QQ}),N({method:A(`routine.run.preview`),parameters:XQ}),N({method:A(`routine.run.confirm`),parameters:$Q}),N({method:A(`routine.update.preview`),parameters:d$}),N({method:A(`routine.update.confirm`),parameters:f$}),N({method:A(`routine.move.preview`),parameters:g$}),N({method:A(`routine.move.confirm`),parameters:_$}),N({method:A(`routine.trigger.list`),parameters:T$}),N({method:A(`routine.trigger.create.preview`),parameters:O$}),N({method:A(`routine.trigger.create.confirm`),parameters:k$}),N({method:A(`routine.trigger.disable`),parameters:N$})]),I$=F([FQ,LQ,zQ,KQ,JQ,i$,a$,t$,o$,n$,s$,p$,m$,v$,y$,E$,A$,M$,P$]);G(jQ),G(NQ),G(DQ),G(CQ),G(EQ),G(wQ),G(TQ),G(OQ),G(PQ);var L$=G(FQ);G(IQ);var R$=G(LQ);G(RQ);var z$=G(zQ);G(HQ);var B$=G(KQ);G(UQ);var V$=G(JQ);G(XQ);var H$=G(i$),U$=G(a$);G(ZQ);var W$=G(t$);G(QQ);var G$=G(o$),K$=G(n$);G($Q);var q$=G(s$);G(d$);var J$=G(p$);G(f$);var Y$=G(m$);G(g$);var X$=G(v$);G(_$);var Z$=G(y$);G(w$),G(x$),G(T$);var Q$=G(E$);G(O$);var $$=G(A$);G(k$);var e1=G(M$);G(N$);var t1=G(P$),n1=`maia.run-ledger/v1`,r1=new TextEncoder,i1=q.check(R(/^[1-9]\d*$/u)),a1=V.check(B({maximum:3,minimum:1})),o1=V.check(B({maximum:32,minimum:0})),s1=j.check(L(e=>{let t=r1.encode(e).byteLength;return t>=1&&t<=8192&&!e.includes(`\0`)},{expected:`evidence encoded as 1 to 8192 UTF-8 bytes without NUL`})),c1=I([`blocked`,`ready`,`active`,`succeeded`,`stopped`]),l1=I([`succeeded`,`failed`]),u1=I([`active`,`succeeded`,`failed`]),d1={createdAt:K,id:J,ordinal:a1,sessionId:J,settledTurnId:k(J),state:u1,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(s1)}).check(L(e=>f1(e)&&e.state===`active`==(e.evidence===void 0),{expected:`a settled dispatch with its turn and evidence`})),Gle=e=>e.every((t,n)=>t.ordinal===n+1&&(t.state===`failed`||n===e.length-1)),Kle=e=>{let t=e.dispatches.at(-1),n=e.dispatches.filter(e=>e.state===`failed`).length;return n!==e.failedDispatches||!Gle(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:i1,runId:J,schemaVersion:A(n1),state:c1,updatedAt:K},g1=L(Kle,{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),qle=N({active:o1,blocked:o1,ready:o1,stopped:o1,succeeded:o1}),y1=N({createdAt:K,id:J,schemaVersion:A(n1),state:I([`open`,`blocked`,`succeeded`]),taskCounts:qle,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(DT,{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:i1,expectedTaskRevision:i1,runId:J,sessionId:J,taskId:J}),T1=N({commandId:J,evidence:s1,expectedTaskRevision:i1,outcome:l1,runId:J,sessionId:J,taskId:J,turnId:k(J)}),Jle=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`})),Yle=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 Xle=F1(k1),Zle=F1(A1),Qle=F1(j1),$le=F1(M1),eue=F1(N1),tue=F1(P1),I1=j.check(U(5,64),R(/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/u)),L1=V.check(z(0),my(5e3)),R1=N({family:j.check(U(1,32)),os:j.check(U(1,32))}),nue=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(ly(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`})),rue={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:oy([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`)},iue=e=>!Object.hasOwn(e,`automaticCompactionEnabled`)&&!Object.hasOwn(e,`automaticRetryEnabled`)&&!Object.hasOwn(e,`handshakeMilliseconds`)&&!Object.hasOwn(e,`platform`),aue=e=>{let t=iue(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`)},oue=N({...rue,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(ly(e=>aue(e),{expected:`a Pi RPC probe result consistent with its status`})),z1=F([N({runtime:A(`codex`)}),N({runtime:A(`pi-rpc`)})]),B1=F([nue,oue]),sue=N({method:A(`runtime.probe`),parameters:z1});G(z1);var cue=G(B1),lue=[`login`,`mcp-servers`,`permissions`,`working-directory`],uue=/^[a-z][a-z0-9-]{0,31}$/u,due=new TextEncoder,V1=j.check(R(uue)),fue=j.check(gy(1),L(e=>due.encode(e).byteLength<=4096&&!wS(e),{expected:`arguments of at most 4096 UTF-8 bytes with no control character`})),pue=j.check(H(128),R(/^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/u)),H1=I([`mutating`,`read-only`]),mue=F([N({class:H1,name:V1}),N({class:A(`refused`),name:V1,operation:k(pue),reason:I(lue)})]),hue=N({sessionId:J}),gue=N({commands:P(mue).check(H(64)),executor:rN,harnessVersion:k(j.check(U(1,64))),method:A(`session.command.list`),sessionId:J,transport:k(V1)}),U1={arguments:k(fue),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},_ue=N(U1),vue=N(U1),yue=N(W1),bue=N({...W1,class:H1,method:A(`session.command.preview`)}),G1={delivery:I([`new`,`duplicate`]),receipt:Y,turn:gM},xue=N({...G1,class:H1,method:A(`session.command.confirm`)}),Sue=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`)})]),Cue=F([N({method:A(`session.command.list`),parameters:hue}),N({method:A(`session.command.send`),parameters:_ue}),N({method:A(`session.command.preview`),parameters:vue}),N({method:A(`session.command.confirm`),parameters:yue})]),wue=F([gue,Sue,bue,xue]),K1={fileBytes:131072,files:192,filesPerSkill:32,setBytes:393216,skills:64},q1=j.check(R(/^[a-z0-9][a-z0-9-]{0,62}$/u)),Tue=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))}),Eue=j.check(H(Math.ceil(K1.fileBytes/3)*4)),X1=N({digest:J1,path:Tue}),Z1=N({digest:J1,files:P(X1).check(U(1,K1.filesPerSkill)),name:q1}),Due=N({digest:J1,skills:P(Z1).check(H(K1.skills)),source:Y1}),Oue=N({...X1.fields,content:Eue}),kue=N({digest:J1,skills:P(N({...Z1.fields,files:P(Oue).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},Aue=I([`added`,`edited`,`in_sync`,`missing`]),e0=N($1),t0=N({...$1,method:A(`skills.sync.show`),pin:k(N({...Due.fields,previousDigest:k(J1)})),revision:q,skills:P(N({localDigest:k(J1),name:q1,pinnedDigest:k(J1),state:Aue})).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}),Mue=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})]),Nue=F([t0,i0,o0]),Pue=G(e0),Fue=G(t0);G(r0);var Iue=G(i0);G(a0);var Lue=G(o0),s0=`team-workspace.bootstrap.preview`,c0=`team-workspace.bootstrap.apply`,l0=`local-os-profile-owner`,Rue=12e4,zue=new TextEncoder,u0=j.check(gy(1),L(e=>e.isWellFormed()&&e===e.normalize(`NFC`)&&e===e.trim()&&!wS(e)&&zue.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,Bue=e=>Date.parse(e.expiresAt)-Date.parse(e.issuedAt)===Rue,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)&&Bue(e),{expected:`six distinct reserved identifiers and a preview that lives two minutes`})),Vue=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}),Hue=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=Vue.check(L(e=>_0(e)&&Hue(e),{expected:`six distinct reserved identifiers and the exact Control Node bootstrap receipt`})),Uue=F([N({method:A(s0),parameters:h0}),N({method:A(c0),parameters:g0})]),Wue=F([v0,y0]);G(h0),G(g0);var Gue=G(v0),Kue=G(y0),b0=32768,que=32768,x0=2147483647,S0=2147483647,Jue=2147483647,C0=65535,w0=1024,Yue=[[`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,Xue=3e4,Zue=1e3,Que=3e4,$ue=8388608,ede=5e4,tde=786432,nde=`adr-009-local-user-interactive-terminal/v1`,rde=`maia.terminal-session/v1alpha1`,k0=`maia.terminal-observer-event/v1alpha1`,ide=`maia.terminal-mutation/v1alpha1`,Z=(e,t)=>V.check(z(e),my(t)),A0={columns:Z(2,500),rows:Z(2,300)},j0={nativeOperationSequence:Z(1,Jue)},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(nde),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),my(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(rde),updatedAt:K,viewport:M0,workspaceId:J,workspaceRevision:q},B0=e=>N({...z0,cleanup:P0,state:A(e)}),ade=N({...z0,cleanup:P0,state:A(`closing`)}),ode=N({...z0,cleanup:F([P0,F0]),state:A(`restarting`)}),sde=N({...z0,cleanup:L0,exit:R0,state:A(`exited`)}),cde=N({...z0,cleanup:I0,exit:k(R0),state:A(`disconnected`)}),V0=F([B0(`creating`),B0(`running`),ade,ode,sde,cde]),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(que,`base64 terminal output encoded from at most 32768 bytes`),lde=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},ude=new Set([...Yue.map(([e,t])=>`${e}:${t}`),...E0.stateChanged.map(({from:e,to:t})=>`${e}:${t}`)]),dde=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,fde=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,pde=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,mde=e=>e.transition===`state-changed`&&e.terminalGeneration===e.previousGeneration&&ude.has(`${e.previousState}:${e.terminal.state}`)&&(e.terminal.state!==`restarting`||dde(e)),hde=e=>fde(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`:pde(e)||mde(e):!1,gde=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(hde,{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`)}),gde]),X0=N({headCursor:q,oldestAvailableCursor:q,retainedBytes:V.check(z(0),my($ue)),retainedLines:V.check(z(0),my(ede)),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},_de={controller:N({epoch:q,expiresAt:K,id:J,revision:q,terminalGeneration:Z(1,C0),terminalId:J})},vde=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(vde),workspaceId:J}),a2=N({afterCursor:k(q),attachId:J,commandId:J,requestedLeaseDurationMs:Z(Zue,Que),terminalId:J}),o2=N({afterCursor:q,limit:Z(1,64),observerId:J,terminalId:J,waitMilliseconds:Z(0,Xue)}),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,..._de,...r2,...n2},p2=N({...f2,requestedLeaseDurationMs:Z(D0,O0)}),m2=N(f2),h2=N({...f2,bytesBase64:lde,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(ide),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`})),yde=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},bde=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},xde=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`])})]),Sde=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,Cde=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([bde,xde.check(L(e=>e.sourceTerminalGeneration>=65535||e.plannedTargetTerminalGeneration!==e.sourceTerminalGeneration+1||e.terminal.id!==e.terminalId?!1:e.state===`acknowledged`?Sde(e):e.state===`not_found`?e.terminal.generation>=e.sourceTerminalGeneration:Cde(e),{expected:`a phase-exact restart reconciliation identity`}))]),wde=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})]),Tde=F([P2,q2,J2,Y2,X2,F2,Z2,L2,R2,z2,B2,H2,U2,W2,G2,K2,e4]),Ede=32768,Dde=V.check(z(1),my(100)),Ode=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)<=tde,{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:Ode,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)<=Ede,{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:Dde,workspaceId:J}),l4=N({terminalId:J}),u4=N({afterTerminalCursor:q,limit:V.check(z(1),my(32)),terminalId:J}),d4=N({afterChunkCursor:q,limit:V.check(z(1),my(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`})),Ade=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}),wde]),jde=F([f4,p4,m4,h4,g4,Tde]).check(n4);G(i4),G(a4),G(o4),G(s4),G(c4),G(l4),G(u4),G(d4);var Mde=G(f4),Nde=G(p4),Pde=G(m4),Fde=G(h4),Ide=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(yde)),_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 Lde=_4()(v4(F2));_4()(v4(l2));var Rde=_4()(v4(Z2));_4()(v4(d2));var zde=_4()(v4(L2));_4()(v4(p2)),_4()(v4(R2)),_4()(v4(m2));var Bde=_4()(v4(z2));_4()(v4(h2));var Vde=_4()(v4(B2));_4()(v4(g2));var Hde=_4()(v4(H2));_4()(v4(_2));var Ude=_4()(v4(U2));_4()(v4(v2));var Wde=_4()(v4(W2));_4()(v4(y2)),_4()(v4(G2)),_4()(v4(b2)),_4()(v4(K2)),_4()(v4(x2)),_4()(v4(e4));var Gde=4096,y4=24576,b4=4096,Kde=8192,x4=`maia`,S4=`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.`,qde=`maia.voice-orchestrator-context/v1`,Jde=`maia.voice-orchestrator-call/v1`,Yde=`maia.voice-tool-result/v1`,Xde=`maia.voice-managed-turn/v1`,Zde=new TextEncoder,C4=q.check(R(/^[1-9]\d*$/u)),Qde=j.check(U(1,Gde),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&Zde.encode(e).byteLength<=4096,{expected:`non-empty, non-NUL text encoded within 4096 UTF-8 bytes`})),w4=j.check(U(43,43),R(/^[A-Za-z0-9_-]{43}$/u)),$de=K,T4={body:Qde,commandId:J,expectedContextRevision:C4,expectedWorkspaceRevision:C4,workspaceId:J},E4=N(T4),D4=N({...T4,proof:w4,sessionId:J}),O4=N({commandId:J}),k4={commandId:J,contextRevision:C4,expiresAt:$de,releaseQualified:A(!1),schemaVersion:A(2),sessionId:J,workspaceId:J,workspaceRevision:C4},A4=N({...k4,method:A(`voice.pi.relay.preview`),proof:w4}),j4=N({commandId:J,contextRevision:C4,delivery:I([`new`,`duplicate`]),method:A(`voice.pi.relay`),receipt:Y,releaseQualified:A(!1),schemaVersion:A(2),sessionId:J,workspaceId:J,workspaceRevision:C4}).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`})),M4=N({...k4,method:A(`voice.pi.relay.reconcile`),state:I([`previewed`,`expired`,`prepared`,`dispatching`,`acknowledged`,`outcome-unknown`])}),efe=F([N({method:A(`voice.pi.relay.preview`),parameters:E4}),N({method:A(`voice.pi.relay`),parameters:D4}),N({method:A(`voice.pi.relay.reconcile`),parameters:O4})]),tfe=F([A4,j4,M4]),nfe=G(E4),rfe=G(D4),ife=G(O4),afe=G(A4),ofe=G(j4),sfe=G(M4),cfe=`maia.hook.v1`,N4=[`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`],P4=I(N4),F4=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),I4=e=>j.check(U(1,e),R(/^[^\p{Cc}\p{Cs}]*$/u)),lfe=N({adoptedFrom:k(J),approvalId:k(J),approvalKind:k(Yw),driftKind:k(I(GV)),driftRule:k(I(KV)),droppedSinceLast:k(ty.check(hy(),B({maximum:1e9,minimum:1}))),failureClass:k(F4),itemId:k(J),itemKind:k(F4),previousShutdown:k(I([`clean`,`unclean`])),reason:k(I([`archived`,`stop`,`stopped`])),reasonClass:k(F4),resumed:k(M),scope:k(F4),to:k(I4(64)),turnId:k(J),updateId:k(J)}),ufe=N({labels:k(iy(I4(32),I4(128)).check(mne(8))),node:k(J),projectId:k(J),sessionId:k(J)}),L4=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`]),ffe=N({context:ufe,deliveryId:J,event:N({data:lfe,id:J,kind:P4,ts:K}),sample:M,schemaVersion:A(cfe)}).check(L(e=>(L4.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===(L4.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)),pfe=`MAIA_WEBHOOK_SECRET_`,mfe=`maia.webhook/v1`,R4=q.check(R(/^[1-9]\d*$/u)),hfe=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),z4=j.check(R(/^sha256:[a-f0-9]{64}$/u)),B4=j.check(U(1,64),R(/^[a-z][a-z0-9_.-]*$/u)),gfe=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`})),_fe=j.check(R(RegExp(`^${pfe}[A-Z0-9_]{1,43}$`,`u`))),vfe=j.check(R(/^[A-Z][A-Z0-9_]{0,63}$/u)),yfe=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))}),V4={allowPrivate:M,events:P(P4).check(U(1,N4.length),L(e=>new Set(e).size===e.length)),filters:P(yfe).check(H(8),L(e=>new Set(e.map(e=>e.key)).size===e.length)),url:gfe},H4=N({...V4,secretEnv:_fe}),U4=N({...V4,secretEnv:vfe}),W4=N({actorId:J,createdAt:K,droppedParked:V.check(z(0)),gapOldest:k(j),gapResets:V.check(z(0)),id:J,lastErrorClass:k(B4),revision:R4,schemaVersion:A(mfe),spec:U4,state:I([`active`,`removed`]),updatedAt:K}),bfe=I([`dead`,`delivered`,`denied`,`expired`,`in_flight`,`pending`,`retry`]),G4=N({attempts:V.check(B({maximum:10,minimum:0})),createdAt:K,errorClass:k(B4),eventId:J,id:J,kind:P4,nextAttemptAt:k(K),state:bfe,updatedAt:K,webhookId:J}),K4={afterCursor:k(J),limit:V.check(B({maximum:100,minimum:1}))},q4=N(K4),J4=N({items:P(W4).check(H(100)),method:A(`webhooks.list`),nextCursor:k(J)}),Y4=N({...K4,failedOnly:k(M),webhookId:k(J)}),X4=N({items:P(G4).check(H(100)),method:A(`webhooks.deliveries`),nextCursor:k(J)}),Z4={expectedRevision:R4,webhookId:J},Q4=F([N({kind:A(`add`),spec:H4}),N({...Z4,kind:A(`remove`)}),N({...Z4,kind:A(`test`)}),N({deliveryId:J,expectedRevision:R4,kind:A(`redeliver`)})]),$4={change:Q4,commandId:J},e3={inputDigest:z4,proof:hfe},t3=N($4),n3=N({...$4,...e3}),r3=N({...$4,...e3,actorId:J,current:k(W4),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`})),i3=N({actorId:J,commandId:J,delivery:I([`new`,`duplicate`]),deliveryId:k(J),inputDigest:z4,kind:I([`add`,`redeliver`,`remove`,`test`]),method:A(`webhooks.change.confirm`),receipt:Y,webhook:W4}).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`})),xfe=F([N({method:A(`webhooks.list`),parameters:q4}),N({method:A(`webhooks.deliveries`),parameters:Y4}),N({method:A(`webhooks.change.preview`),parameters:t3}),N({method:A(`webhooks.change.confirm`),parameters:n3})]),Sfe=F([J4,X4,r3,i3]);G(q4);var Cfe=G(J4);G(Y4);var wfe=G(X4);G(t3);var Tfe=G(r3);G(n3);var Efe=G(i3);G(H4),G(U4),G(W4),G(G4);var a3=G(Q4);G(ffe);var o3=q.check(R(/^[1-9]\d*$/u)),s3=j.check(R(/^[a-f0-9]{64}$/u)),c3=j.check(R(/^[A-Za-z0-9_-]{43}$/u)),l3=j.check(U(1,4096),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&new TextEncoder().encode(e).byteLength<=4096)),u3={expectedSessionRevision:o3,projectId:J,scopeId:J,sessionId:J,systemPromptSha256:j.check(R(/^sha256:[a-f0-9]{64}$/u)),toolCallId:J,utterance:l3},d3=N(u3),f3=N({...u3,confirmation:N({action:A(`turn.send`),commandId:J,inputDigest:s3,proof:c3,sessionId:J})}),p3=N({commandId:J,contextRevision:o3,expectedSessionRevision:o3,expiresAt:K,inputDigest:s3,kind:A(`confirmation-required`),method:A(`voice.managed-turn.preview`),projectId:J,proof:c3,releaseQualified:A(!1),schemaVersion:A(Xde),sessionId:J,target:A(`pi-managed`),turnInput:l3,voiceSessionId:J,workspaceId:J,workspaceRevision:o3}),Dfe=F([N({method:A(`voice.managed-turn.preview`),parameters:d3}),N({method:A(`voice.managed-turn.confirm`),parameters:f3})]),m3=new TextEncoder,Ofe=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0,h3=(e,t)=>{try{let n=JSON.stringify(e);return n!==void 0&&m3.encode(n).byteLength<=t}catch{return!1}},g3=q.check(R(/^[1-9]\d*$/u)),kfe=j.check(U(71,71),R(/^sha256:[a-f0-9]{64}$/u)),_3=j.check(U(1,4096),R(/^[^\0]*$/u),L(e=>e.trim().length>0&&m3.encode(e).byteLength<=4096,{expected:`non-empty, non-NUL text encoded within 4096 UTF-8 bytes`})),v3=F([N({action:A(`ask`),utterance:_3}),N({action:A(`status`)})]),Afe=N({args:v3,toolCallId:J,toolName:A(x4)}),y3=xv(yne(N({action:I([`ask`,`status`]),utterance:rne(_3)}),{onExcessProperty:`error`})),b3={...y3.schema,...Object.keys(y3.definitions).length===0?{}:{definitions:y3.definitions}},x3=(e,t)=>{if(e===t)return!0;if(Array.isArray(t))return Array.isArray(e)&&e.length===t.length&&t.every((t,n)=>x3(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)&&x3(Reflect.get(e,n),Reflect.get(t,n)))},S3=N({description:A(S4),name:A(x4),parameters:iy(j,$v).check(L(e=>x3(e,b3),{expected:`the canonical Maia voice tool parameter schema`})),type:A(`function`)}),C3={releaseQualified:A(!1),schemaVersion:A(Yde)},w3=j.check(U(1,256),L(e=>m3.encode(e).byteLength<=256,{expected:`a safe message encoded within 256 UTF-8 bytes`})),T3=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(w3),text:k(j.check(L(e=>m3.encode(e).byteLength<=2048,{expected:`agent output within 2048 UTF-8 bytes`}))),truncated:M}),sessionId:J,status:A(`ok`),turnId:J})]),error:ey,interaction:ey,receipt:ey,releaseQualified:A(!1),schemaVersion:A(`maia.voice-managed-status-result/v1`),status:A(`managed-status`)}).check(L(e=>h3(e,b4),{expected:`managed status within the voice tool output byte bound`})),N({action:A(`ask`),authority:A(`managed-maia-agent`),error:ey,interaction:N({applyMethod:A(`voice.managed-turn.confirm`),commandId:J,expectedSessionRevision:g3,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:ey,releaseQualified:A(!1),schemaVersion:A(`maia.voice-managed-preview-result/v1`),status:A(`awaiting-confirmation`)}),N({...C3,action:A(`ask`),error:ey,interaction:N({applyMethod:A(`voice.pi.relay`),kind:A(`confirmation-required`),previewId:J,requiresTrustedGesture:A(!0)}),receipt:ey,status:A(`confirmation-required`)}),N({...C3,action:A(`status`),data:N({lifecycle:I([`starting`,`ready`,`draining`,`stopped`,`failed`]),method:A(`node.status`),processResources:N({activeTrees:V.check(z(0),my(128)),admissionState:I([`available`,`degraded`,`pressured`,`saturated`,`unavailable`]),cleanupUnknownTrees:V.check(z(0),my(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:ey,interaction:ey,receipt:ey,status:A(`ok`)}),N({...C3,action:I([`ask`,`status`,`unknown`]),error:N({code:I([`bridge_unavailable`,`call_conflict`,`capacity_exceeded`,`invalid_input`,`scope_stale`]),message:w3}),interaction:ey,receipt:ey,status:A(`rejected`)})]),E3=Xte(Ofe,{description:`an exact empty object`}),D3=N({call:$v,scopeId:J}).check(L(e=>h3(e,Kde),{expected:`a bounded Maia voice tool request`})),jfe=N({contextRevision:g3,id:J,workspaceId:J,workspaceRevision:g3}),O3=N({method:A(`voice.orchestrator.context.show`),releaseQualified:A(!1),schemaVersion:A(qde),scope:jfe,systemPrompt:j.check(U(1,y4)),systemPromptSha256:kfe,systemPromptVersion:V.check(z(1),my(65535)),tools:oy([S3])}).check(L(e=>h3(e,y4),{expected:`a bounded Maia voice orchestrator context`})),k3=N({interaction:F([ey,N({body:_3,confirmation:A4,kind:A(`confirmation-required`)})]),method:A(`voice.orchestrator.tool.call`),modelResult:T3,releaseQualified:A(!1),schemaVersion:A(Jde),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=>h3(e.modelResult,b4),{expected:`a bounded Maia voice model result`})),Mfe=F([Dfe,F([N({method:A(`voice.orchestrator.context.show`),parameters:E3}),N({method:A(`voice.orchestrator.tool.call`),parameters:D3})]),efe]),Nfe=F([p3,O3,k3,tfe]),A3=`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.maia-agent,integration.apply.pi,integration.apply.pi-rpc,integration.remove.antigravity,integration.remove.claude-code,integration.remove.codex,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(`,`);WO.filter(e=>!A3.includes(e));var j3=I([`starting`,`ready`,`draining`,`stopped`,`failed`]),Pfe=I([`deadline_exceeded`,`outcome_unknown`,`saturated`]),M3=iy(j,Qv),N3=Hne(I(A3)),P3=F([IX,XU,Ule,hL,eJ,Xce,lT,$J,eG,N({method:A(`node.status`),parameters:M3}),N({method:A(`node.shutdown`),parameters:M3}),N({method:A(`monitor.bootstrap.create`),parameters:M3}),N({method:A(`receipt.get`),parameters:LS}),N({method:A(`receipt.list`),parameters:N3}),qE,KY,Yre,EY,nZ,zW,xO,uk,jO,kre,Ose,Cue,jie,IZ,eQ,Tie,F$,Jle,zie,CI,_Z,sue,gce,mae,Xoe,XL,aae,pae,Ere,ZN,nie,FG,Eae,xfe,lse,Mue,Uue,Ade,Qie,Mfe]),Ffe=N({correlationId:k(J),kind:A(`request`),messageId:J,payload:P3,protocolVersion:DS}),F3=j.check(U(43,43),R(/^[A-Za-z0-9_-]+$/u)),Ife=N({credential:j.check(U(43,43),R(/^[A-Za-z0-9_-]{43}$/u)),scheme:A(`maia.invocation-attachment/v1`)}),I3=j.check(U(20,64)),L3=N({instanceId:J,lifecycle:j3,pid:V.check(py(0)),profile:J,startedAt:I3}),R3=V.check(z(0),my(128)),Lfe=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)})]),Rfe=V.check(z(0),my(2**53-1)),z3=N({availableTrees:R3,budget:I([`declared_per_tree_limit`,`unavailable_not_declared`]),maximumValue:k(Rfe),state:I([`available`,`partial`,`unavailable`]),unavailableTrees:R3,warningTrees:R3}),zfe=N({cpuTimeMilliseconds:z3,fileDescriptorCount:z3,ioReadBytes:z3,ioWriteBytes:z3,observedPeakRssBytes:z3,processCount:z3,rssBytes:z3,treeCount:R3}),Bfe=N({activeTrees:R3,admission:N({availableTrees:R3,capacity:R3,queuedSpawns:A(0),state:I([`available`,`degraded`,`pressured`,`saturated`,`unavailable`]),usedTrees:R3}),capability:Lfe,cleanupUnknownTrees:R3,fencedTrees:R3,nextStep:I([`close_idle_terminal`,`inspect_cleanup_unknown`,`inspect_observed_pressure`,`none`,`run_node_in_delegated_cgroup`,`upgrade_kernel`,`verify_native_host`]),observations:zfe,pressure:I([`admission_degraded`,`cgroup_delegation_unavailable`,`cleanup_unknown`,`healthy`,`landlock_scoped_unavailable`,`observed_pressure`,`warning`]),supervision:N({trackedTrees:R3,watcherFibers:R3})}),Vfe=(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},Hfe=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`),Ufe=Bfe.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&&Hfe(e)&&t.every(t=>Vfe(t,e.observations.treeCount))},{expected:`a consistent bounded process-resource health projection`})),Wfe=N({bubblewrap:I([`found`,`missing`]),socat:I([`found`,`missing`]),userNamespaces:I([`allowed`,`no_nesting`,`restricted`])}),B3=ty.check(B({maximum:100,minimum:0})),Gfe=N({diskFreePercent:B3,loadPerCpu:ty.check(z(0)),memoryAvailablePercent:B3,observedAt:I3}),Kfe=N({checkpointBlocked:k(M),excessBytes:V.check(z(0)),oldestAgeMs:k(V.check(z(0)))}),V3=N({...L3.fields,admissionCaps:k(N({defaultAccountSessions:V.check(B({maximum:64,minimum:1})),maximumActiveSessions:V.check(B({maximum:64,minimum:1}))})),executorHost:k(Wfe),headlessApprovals:k(I([`off`,`on`])),host:k(Gfe),hostAuthority:k(I([`disabled`,`enabled`])),method:A(`node.status`),processResources:Ufe,storage:N({events:k(Kfe),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(py(0),my(65535))}),version:k(j.check(U(1,64)))}),H3=N({accepted:A(!0),method:A(`node.shutdown`)}),U3=N({expiresAt:I3,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))}),W3=F([LX,ZU,Wle,gL,tJ,ale,pT,eY,$W,V3,H3,U3,RS,VS,JE,iX,Jre,DY,rZ,BW,SO,lk,MO,Are,kse,wue,Mie,LZ,tQ,Iie,I$,Yle,Bie,wI,hZ,B1,_ce,hae,Yoe,ZL,oae,Gz,Dre,QN,rie,IG,Dae,Sfe,use,Nue,Wue,jde,$ie,Nfe]),G3=N({correlationId:k(J),kind:A(`response`),messageId:J,payload:N({ok:A(!0),result:W3}),protocolVersion:DS}),qfe=F([G3,PS]),Jfe=iy(j,Qv),Yfe=j.check(U(20,64)),K3=j.check(U(71,71),R(/^sha256:[a-f0-9]{64}$/u)),q3=j.check(U(48,UO),R(/^scur_[A-Za-z0-9_-]+$/u)),J3=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`})),Y3=N({scheme:A(`maia.node.bearer/v1`),token:F3}),X3=/^http:\/\/((?:\d{1,3}\.){3}\d{1,3}):([1-9]\d{0,4})$/u,Xfe=j.check(U(20,28),R(X3),L(e=>{let[,t=``,n=``]=X3.exec(e)??[];return TZ({address:t,port:Number(n)})},{expected:`an HTTP origin on a private IPv4 address with a port from 1024 to 65535`})),Z3={observationPath:A(FO),operationPath:A(PO),transport:A(`http-websocket`)},Q3=N({...Z3,origin:J3}),Zfe=N({...Z3,origin:F([J3,Xfe])}),Qfe=N({...L3.fields,endpoint:Q3,kind:A(`maia.node-api.ready`),lifecycle:A(`ready`),protocolVersion:DS,schemaVersion:A(NO)}),$fe=N({...L3.fields,credentialPath:j.check(U(1,4096)),descriptorVersion:A(1),endpoint:Q3,kind:A(`maia.node-api.connection`),lifecycle:A(`ready`),lifecycleOwner:A(`desktop`),protocolVersion:DS,schemaVersion:A(NO)}),$3=F([N({instanceId:J,kind:A(`node`)}),N({aggregateId:J,aggregateType:J,kind:A(`aggregate`)})]),epe=P($3).check(U(1,16),L(e=>new Set(e.map(e=>JSON.stringify(e))).size===e.length,{expected:`unique exact observation scopes`})),tpe=N({authentication:Y3,kind:A(`subscribe`),messageId:J,operationId:A(`observe.events`),parameters:N({afterCursor:k(q3),maxBatchRecords:V.check(py(0),my(64)),scopes:epe}),protocolVersion:DS,schemaVersion:A(NO)}),e6=N({aggregateId:J,aggregateType:J,revision:q}),t6=N({aggregateId:J,aggregateRevision:q,aggregateType:J,eventCursor:q,eventType:J,recordedAt:Yfe,schemaVersion:A(`maia.node-observation/v1`)}),n6=N({coverage:I([`complete`,`filtered`]),cursor:q3,eventCursor:q,instanceId:J,policyRevision:q,principalId:J,scopeDigest:K3}),r6={correlationId:J,operationId:A(`observe.events`),protocolVersion:DS,schemaVersion:A(NO),sequence:q,streamId:J},npe=F([N({...r6,checkpoint:n6,data:N({aggregates:P(e6).check(H(256))}),kind:A(`snapshot`),sequence:A(`0`),terminal:A(!1)}),N({...r6,checkpoint:n6,data:N({records:P(t6).check(U(1,64))}),kind:A(`event`),terminal:A(!1)}),N({...r6,checkpoint:n6,data:Jfe,kind:A(`heartbeat`),terminal:A(!1)}),N({...r6,checkpoint:n6,data:N({headEventCursor:q,oldestAvailableEventCursor:q,reason:I([`backpressure`,`cursor_expired`]),recovery:A(`resubscribe-without-cursor`)}),kind:A(`gap`),terminal:A(!0)}),N({...r6,data:N({current:N({instanceId:J,policyRevision:q,principalId:J,scopeDigest:K3}),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({...r6,data:N({error:MS}),kind:A(`error`),terminal:A(!0)}),N({...r6,checkpoint:n6,data:N({reason:I([`client_closed`,`completed`,`server_shutdown`])}),kind:A(`summary`),terminal:A(!0)})]);G(j3);var rpe=G(Pfe),i6=G(P3),ipe=new Set(KO);new Set(WO.filter(e=>!ipe.has(e))),G(Ffe),G(F3),G(Ife);var ape=G(V3),ope=G(H3),spe=G(U3),cpe=G(W3);G(G3),G(qfe),G(Y3),G(Zfe),G(Q3),G(Qfe),G($fe),G($3),G(tpe),G(e6),G(t6),G(n6),G(npe),G(N3),G(dM),G(fM),G(bM);var lpe=G(DM);G(PM);var upe=G(FM);G(IM);var dpe=G(LM);G(gM),G(cM),G(sM),G(_M),G(vM),G(yM);var fpe=G(wM),a6=G(TM),ppe=G(EM);G(SM),G(kM),G(CM),G(AM),G(jM);var mpe=G(NM),hpe=new WeakMap,gpe=`A session.resume carries a parent claim that resumeSupervised did not make for it.`,o6=(e,t)=>typeof e==`object`&&e?Reflect.get(e,t):void 0,_pe=(e,t)=>{let n=o6(e,`parameters`);if(o6(e,`method`)!==`session.resume`||o6(n,`parent`)===void 0)return!0;let r=o6(o6(t,`parameters`),`parent`);return typeof r==`object`&&!!r&&hpe.get(r)===o6(n,`sessionId`)},vpe=(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})},s6=e=>({request:(t,n)=>Of({catch:e=>vpe(e,n?.signal),try:()=>e.request(t,n)})}),ype=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:CS};return wk.parse(t),t}}).pipe(ap(({payload:t})=>_pe(t,e.payload),()=>new W(`invalid_request`,gpe))),c6=(e,t)=>e.correlationId===t?Af:E(new W(`correlation_mismatch`,`The Maia response did not match the request message.`)),bpe=(e,t)=>{let n=Ek.safeParse(e);if(!n.success)return Af;let{error:r}=n.data.payload;return c6(n.data,t).pipe(zf(kf(()=>{let e=rpe.safeParse(r.code);return E(new W(e.success?e.data:`remote_error`,r.message,{remoteError:r}))})))},xpe=(e,t)=>If({catch:e=>new W(`invalid_response`,`The Maia response envelope failed runtime validation.`,{cause:e}),try:()=>Tk.parse(e)}).pipe(Bf(e=>c6(e,t)),O(e=>e.payload.result)),Spe=(e,t)=>If({catch:e=>new W(`invalid_response`,`The Maia response payload failed runtime validation.`,{cause:e}),try:()=>e.parse(t)}),Cpe=()=>new W(`cancelled`,`The Maia request was cancelled.`),l6=(e,t)=>Mf(function*(){let n=yield*ype(t),{messageId:r,outputSchema:i,signal:a}=t;if(a?.aborted===!0)return yield*E(Cpe());let o=yield*e.request(n,a===void 0?void 0:{signal:a});return yield*bpe(o,r),yield*Spe(i,yield*xpe(o,r))}),wpe=(e,t=!0)=>(n,r,{messageId:i,signal:a})=>l6(e,{inputSchema:t?i6:{parse:()=>n},messageId:i,outputSchema:r,payload:n,signal:a}),Tpe=(e,t)=>e instanceof W&&!Tne(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,u6=(e,t)=>kf(()=>{let n=t.signal?.aborted??!1;return qf(e,e=>Tpe(e,n))}),d6=e=>kf(()=>{try{return e()}catch(e){return e instanceof W?E(e):Ff(e)}}),Epe=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>Ip(t(...e))])),Dpe=e=>{let t=s6(e);return{request:e=>Ip(l6(t,e))}},f6=`~effect/http/HttpBody`,p6=`~effect/http/HttpBody/HttpBodyError`,Ope=class extends ga(`HttpBodyError`){[p6]=p6},m6=class{[f6];constructor(){this[f6]=f6}[ct](){return this.toJSON()}toString(){return et(this,{ignoreToString:!0})}},kpe=new class extends m6{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},h6=class extends m6{_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??=Ape(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}}},g6=new TextEncoder,_6=globalThis.Buffer,Ape=_6===void 0?e=>g6.encode(e):e=>_6.from(e,`utf8`),v6=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),_6!==void 0)return new h6(void 0,t??`text/plain`,_6.byteLength(e,`utf8`),e);let n=g6.encode(e);return new h6(n,t??`text/plain`,n.length,e)},jpe=(e,t)=>If({try:()=>v6(JSON.stringify(e),t??`application/json`),catch:e=>new Ope({reason:{_tag:`JsonError`},cause:e})}),y6=`~effect/http/HttpClientError`,b6=class extends ga(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[y6]=y6;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},x6=e=>e.endsWith(`Error`)?e.slice(0,-5):e,S6=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,Mpe=class extends ga(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return S6(x6(this._tag),this.description,this.methodAndUrl)}},Npe=class extends ga(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return S6(x6(this._tag),this.description,this.methodAndUrl)}},C6=class extends ga(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return S6(x6(this._tag),this.description,e)}},Ppe=class extends ga(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return S6(x6(this._tag),this.description,e)}},Fpe=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],Ipe=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?Lm(Lm(e,`content-type`),`content-length`):(e=t.contentType===void 0?Lm(e,`content-type`):Im(e,`content-type`,t.contentType),t.contentLength===void 0?Lm(e,`content-length`):Im(e,`content-length`,t.contentLength.toString())),Lpe=class extends ga(`UrlError`){},w6=(e,t,n)=>Qr({try:()=>{let r=new URL(e,Rpe());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 Lpe({cause:e})}),Rpe=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},T6=`~effect/http/HttpClientRequest`,zpe=e=>de(e,T6),Bpe={[T6]:T6,...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 E6(e,t,n,r,i,a){let o=Object.create(Bpe);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var Vpe=E6(`GET`,``,hee,nr(),Nm,kpe),D6=e=>(t,n)=>Upe(Vpe,{method:e,url:t,...n??void 0}),O6=D6(`POST`),Hpe=D6(`DELETE`),Upe=i(2,(e,t)=>{let n=e;return t.method&&(n=Wpe(n,t.method)),t.url&&(n=qpe(n,t.url)),t.headers&&(n=k6(n,t.headers)),t.urlParams&&(n=Jpe(n,t.urlParams)),t.hash&&(n=Ype(n,t.hash)),t.body&&(n=j6(n,t.body)),t.accept&&(n=A6(n,t.accept)),t.acceptJson&&(n=Kpe(n)),n}),Wpe=i(2,(e,t)=>E6(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Gpe=i(3,(e,t,n)=>E6(e.method,e.url,e.urlParams,e.hash,Im(e.headers,t,n),e.body)),k6=i(2,(e,t)=>E6(e.method,e.url,e.urlParams,e.hash,cee(e.headers,t),e.body)),A6=i(2,(e,t)=>Gpe(e,`Accept`,t)),Kpe=A6(`application/json`),qpe=i(2,(e,t)=>{if(typeof t==`string`)return E6(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=``,E6(e.method,n.toString(),r,i,e.headers,e.body)}),Jpe=i(2,(e,t)=>E6(e.method,e.url,gee(e.urlParams,t),e.hash,e.headers,e.body)),Ype=i(2,(e,t)=>E6(e.method,e.url,e.urlParams,rr(t),e.headers,e.body)),j6=i(2,(e,t)=>E6(e.method,e.url,e.urlParams,e.hash,Ipe(e.headers,t),t)),Xpe=i(e=>zpe(e[0]),(e,t,n)=>j6(e,v6(t,n))),Zpe=i(2,(e,t)=>O(jpe(t),t=>j6(e,t)));function Qpe(e){let t=w6(e.url,e.urlParams,ur(e.hash));return ei(t)?rr(t.success):nr()}var M6=`~effect/http/HttpIncomingMessage`,$pe=(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},N6=`~effect/http/HttpClientResponse`,eme=(e,t)=>new tme(e,t),tme=class extends ft{[M6];[N6];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[M6]=M6,this[N6]=N6}toJSON(){return $pe(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=Qpe(this.request);return ir(e)?``:(e.value.hash=``,e.value.href)}get headers(){return Pm(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=ree(this.source.headers.getSetCookie())}get remoteAddress(){return nr()}get stream(){return this.source.body?gx({evaluate:()=>this.source.body,onError:e=>new b6({reason:new C6({request:this.request,response:this,cause:e})})}):hx(new b6({reason:new Ppe({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 b6({reason:new C6({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 b6({reason:new C6({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=Of({try:()=>this.source.formData(),catch:e=>new b6({reason:new C6({request:this.request,response:this,cause:e})})}).pipe(Sp,Bp)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=Of({try:()=>this.source.arrayBuffer(),catch:e=>new b6({reason:new C6({request:this.request,response:this,cause:e})})}).pipe(Sp,Bp),this.arrayBufferBody}pipe(){return t(this,arguments)}},nme=e=>Fm({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`}`}),P6=`~effect/http/HttpClient`,F6=mr(`effect/HttpClient`),rme=i(2,(e,t)=>I6(n=>t(e.postprocess(n)),e.preprocess)),I6=(e,t)=>{let n=Object.create(ime);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},ime={[P6]:P6,pipe(){return t(this,arguments)},...dt,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(Fpe.map(([e,t])=>[t,function(t,n){return this.execute(D6(e)(t,n))}]))},ame=e=>I6(t=>D(t,t=>Lf(n=>{let r=dme.get(t),i=r??new AbortController,a=w6(t.url,t.urlParams,ur(t.hash));if($r(a))return E(new b6({reason:new Npe({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(Ta)||n.getRef(ome)(t)){let a=e(t,o,i.signal,n);return r?a:Tp(e=>sp(e(a),{onSuccess(e){return L6.register(e,i),w(new R6(e,i))},onFailure(e){return Ou(e)&&i.abort(),Nf(e)}}))}return Op(n.getRef(lme)(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(zm),l=n.getRef(sme);for(let e in t.headers)l(e,`request`)&&a.attribute(`http.request.header.${e}`,Rm(e,c)?`<redacted>`:t.headers[e]);return t=n.getRef(cme)?k6(t,nme(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}`,Rm(t,c)?`<redacted>`:e.headers[t]);return r?w(e):(L6.register(e,i),w(new R6(e,i)))},onFailure(e){return!r&&Ou(e)&&i.abort(),Nf(e)}})))})})),w),ome=Kr(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>c}),sme=Kr(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>s}),cme=Kr(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:s}),lme=Kr(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),ume=e=>_d(F6)(up(t=>O(e,e=>rme(e,mp(e=>Wr(t,e)))))),L6=(()=>{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,R6=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[N6]=N6;[M6]=M6;applyInterrupt(e){return kf(()=>(L6.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 mx(()=>(L6.unregister(this.original),Dx(this.original.stream,T(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[ct](){return this.original[ct]()}pipe(){return t(this,arguments)}},z6=Kr(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),B6=class extends mr()(`effect/http/FetchHttpClient/RequestInit`){},V6=ume(w(ame((e,t,n,r)=>{let i=r.getRef(z6),a=Lr(r.context,B6)??{},o=a.headers?lee(Pm(a.headers),e.headers):e.headers;o[`content-length`]&&(o=Lm(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 b6({reason:new Mpe({request:e,cause:t})})}),t=>eme(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(jx(e.body.stream),s)}return s(void 0)}))),fme={cache:`no-store`,credentials:`same-origin`,redirect:`error`,referrerPolicy:`no-referrer`},H6=e=>(e===void 0?V6:V6.pipe(Cd(fd(z6,e)))).pipe(Cd(fd(B6,fme))),U6=(e,t)=>new W(`transport_failure`,e,{cause:t}),W6=e=>or(e,{onNone:()=>({}),onSome:e=>({[BO]:e})}),pme=(e,t,n)=>If({catch:e=>U6(`The Maia Node API request failed runtime validation.`,e),try:()=>JSON.stringify(wk.parse(n))}).pipe(O(n=>O6(`${e}${zO}`).pipe(k6(W6(t)),Xpe(n,LO)))),mme=e=>{let t=Tk.safeParse(e);return t.success?t.data:Ek.parse(e)},hme=e=>e.json.pipe(D(e=>If(()=>mme(e))),qf(e=>new W(`invalid_response`,`The Maia Node API response failed runtime validation.`,{cause:e}))),gme=`30 seconds`,G6=e=>e.pipe(ep({duration:gme,orElse:()=>E(new W(`outcome_unknown`,`The Maia Node API request outcome is unknown.`))})),_me=401,vme=(e,t)=>Mf(function*(){let n=yield*F6,r=yield*pme(e.origin,cr(e.session?.()),t),i=yield*n.execute(r).pipe(qf(e=>U6(`The Maia Node API request failed.`,e)));return i.status===_me&&(yield*T(()=>e.onSignedOut?.())),yield*hme(i)}).pipe(gp,G6),yme=(e,t)=>vme(e,t).pipe(dp(H6(e.fetch))),bme=(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}),xme=e=>({request:(t,n)=>{let r=n?.signal;return Ip(yme(e,t),r===void 0?void 0:{signal:r}).catch(e=>{throw bme(e,r)})}});G(qH),G(GH);var Sme=G(JH);G(QH),G(XH);var Cme=G($H);G(rU),G(iU),G(aU),G(fU);var wme=G(pU);G(mU);var Tme=G(hU);G(sU),G(cU),G(uU),G(dU),G(yU),G(Vle),G(bU),G(SU),G(CU);var Eme=G(wU);G(TU);var Dme=G(EU);G(DU);var Ome=G(OU);G(kU);var kme=G(AU);G(ZI),G(GI),G(WI),G(zI);var Ame=G(YI);G(BI);var jme=G(XI);G(QI);var Mme=G($I);G(eL);var Nme=G(tL);G(nL);var Pme=G(aL);G(rL),G(oL);var Fme=G(sL);G(lL),G(uL),G(dL);var Ime=G(fL);G(pL);var Lme=G(mL);G(hL),G(gL);var K6=(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},Rme=(e,t)=>{let n=Noe.parse(e);if(K6(n.grant,t),n.grant.inputDigest!==t.inputDigest)throw new W(`invalid_response`,`The Agent permission digest did not match the request.`);return n},zme=e=>({confirmAgentPermission:(t,n)=>e({method:`session.agent-permission.confirm`,parameters:t},{parse:e=>Rme(e,t)},n),previewAgentPermission:(t,n)=>e({method:`session.agent-permission.preview`,parameters:t},{parse:e=>K6(Moe.parse(e),t)},n)}),q6=e=>{if(!e)throw new W(`invalid_response`,`The Agent response did not match the request.`)},J6=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)))),Bme=(e,t)=>J6(e)===J6(vB.parse(t)),Vme=(e,t)=>{let n=kae.parse(e);return q6(n.items.length<=t.limit&&n.items.every(e=>e.projectId===t.projectId&&(t.state===void 0||e.state===t.state))),n},Hme=(e,t)=>{let n=Aae.parse(e);return q6(n.agent.id===t.agentId&&(t.revision===void 0||n.agent.revision===t.revision)),n},Ume=(e,t)=>{let n=jae.parse(e);return q6(n.commandId===t.commandId&&Bme(n.change,t.change)),n},Wme=(e,t)=>e.kind===t.kind?t.kind===`create`?e.agent.projectId===t.projectId&&J6(e.agent.spec)===J6(t.spec):e.agent.id===t.agentId&&BigInt(e.agent.revision)===BigInt(t.expectedRevision)+1n&&(t.kind===`disable`||J6(e.agent.spec)===J6(t.spec)):!1,Gme=(e,t)=>{let n=Mae.parse(e);return q6(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&Wme(n,vB.parse(t.change))),n},Kme=e=>({confirmAgentChange:(t,n)=>u6(e({method:`agents.change.confirm`,parameters:t},{parse:e=>Gme(e,t)},n),n),previewAgentChange:(t,n)=>e({method:`agents.change.preview`,parameters:t},{parse:e=>Ume(e,t)},n)}),qme=e=>({...Kme(e),detectAgents:(t,n)=>e({method:`agents.detect`,parameters:t},{parse:e=>Oae.parse(e)},n),listAgents:(t,n)=>e({method:`agents.list`,parameters:t},{parse:e=>Vme(e,t)},n),showAgent:(t,n)=>e({method:`agents.show`,parameters:t},{parse:e=>Hme(e,t)},n)}),Y6=e=>{if(!e)throw new W(`invalid_response`,`The approval response did not match the request.`)},Jme=(e,t)=>{let n=Pae.parse(e);return Y6(n.items.length<=t.limit&&n.items.every(e=>(t.sessionId===void 0||e.sessionId===t.sessionId)&&(t.pendingOnly===!1||e.status===`pending`))),n},Yme=(e,t)=>{let n=Fae.parse(e);return Y6(n.approval.approvalId===t.approvalId),n},X6=(e,t,n)=>t.decision===`answer`?e===`answered`:t.decision===`deny`?e===`denied`:e===`approved`&&n===(t.decision===`approve_for_session`),Xme=(e,t)=>{let n=Iae.parse(e),{approval:r,commandId:i}=n;return Y6(i===t.commandId&&r.approvalId===t.approvalId&&r.requestDigest===t.requestDigest&&X6(r.status,t,r.resolution?.forSession===!0)),n},Zme=e=>({listApprovals:(t,n)=>e({method:`approval.list`,parameters:t},{parse:e=>Jme(e,t)},n),respondToApproval:(t,n)=>u6(e({method:`approval.respond`,parameters:t},{parse:e=>Xme(e,t)},n),n),showApproval:(t,n)=>e({method:`approval.show`,parameters:t},{parse:e=>Yme(e,t)},n)}),Z6=e=>{if(!e)throw new W(`invalid_response`,`The board response did not match the request.`)},Q6=(e,t)=>BigInt(e.revision)===BigInt(t)+1n,$6=(e,t)=>e===t||e.startsWith(`${t}/`),e8=(e,t)=>(e??[]).join(`
|
|
15
|
+
`)===(t??[]).join(`
|
|
16
|
+
`),Qme=(e,t)=>{let n=Rae.parse(e);return Z6(n.commandId===t.commandId&&n.task.workspaceId===t.workspaceId&&n.task.path===t.path&&n.task.text===t.text&&e8(n.task.needs,t.needs)),n},$me=(e,t)=>{let n=Jae.parse(e);return Z6(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},ehe=(e,t)=>{let n=e.claim?.claimant;return n!==void 0&&(t===void 0||n.kind===`session`&&n.agent===t)},the=(e,t)=>{let n=zae.parse(e),{commandId:r,task:i}=n,a=t.taskId===void 0?i.workspaceId===t.workspaceId&&$6(i.path,t.path??``):i.id===t.taskId&&Q6(i,t.expectedRevision??`0`);return Z6(r===t.commandId&&a&&ehe(i,t.as)),n},t8=e=>(t,n)=>{let r=e.parse(t);return Z6(r.commandId===n.commandId&&r.task.id===n.taskId&&Q6(r.task,n.expectedRevision)),r},nhe=t8(Bae),rhe=t8(Vae),ihe=t8(Hae),ahe=t8(Uae),ohe=t8(Wae),she=t8(Gae),che=(e,t)=>{let n=t8(Yae)(e,t);return Z6(n.task.assignee===t.assignee),n},lhe=(e,t)=>{let n=Xae.parse(e);return Z6(n.commandId===t.commandId&&n.task.id===t.threadId&&n.task.workspaceId===t.workspaceId&&e8(n.task.needs,t.needs)),n},uhe=(e,t)=>{let n=t8(Zae)(e,t);return Z6(e8(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)},fhe=(e,t)=>{let n=Kae.parse(e);return Z6(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||$6(e.path,t.path))&&dhe(e,t))),n},phe=(e,t)=>{let n=qae.parse(e);return Z6(n.task.id===t.taskId&&n.messages.length<=(t.limit??n.messages.length)),n},n8=(e,t)=>t===void 0||e?.kind===`session`&&e.agent===t,mhe=(e,t)=>{let n=Qae.parse(e);return Z6(n.commandId===t.commandId&&n.thread.path===t.path&&n.message.text===t.text&&n8(n.message.author,t.as)),n},hhe=(e,t)=>{let n=$ae.parse(e);return Z6(n.commandId===t.commandId&&n.message.threadId===t.threadId&&n.message.text===t.text&&n8(n.message.author,t.as)),n},ghe=(e,t)=>{let n=eoe.parse(e);return Z6(n.items.length<=(t.limit??n.items.length)&&n8(n.actor,t.as)&&n.items.every(e=>e.workspaceId===t.workspaceId&&$6(e.path,t.path))),n},_he=(e,t)=>{let n=toe.parse(e);return Z6(n.thread.id===t.threadId&&n.messages.length<=(t.limit??n.messages.length)&&n8(n.actor,t.as)),n},vhe=e=>({postBoardMessage:(t,n)=>e({method:`board.message.post`,parameters:t},{parse:e=>mhe(e,t)},n),replyToBoardMessage:(t,n)=>e({method:`board.message.reply`,parameters:t},{parse:e=>hhe(e,t)},n)}),yhe=e=>({readBoardPath:(t,n)=>e({method:`board.path.read`,parameters:t},{parse:e=>ghe(e,t)},n),showBoardThread:(t,n)=>e({method:`board.thread.show`,parameters:t},{parse:e=>_he(e,t)},n)}),bhe=e=>({claimBoardTask:(t,n)=>e({method:`board.task.claim`,parameters:t},{parse:e=>the(e,t)},n),createBoardTask:(t,n)=>e({method:`board.task.create`,parameters:t},{parse:e=>Qme(e,t)},n),planBoardTasks:(t,n)=>e({method:`board.task.plan`,parameters:t},{parse:e=>$me(e,t)},n)}),xhe=e=>({completeBoardTask:(t,n)=>e({method:`board.task.complete`,parameters:t},{parse:e=>ihe(e,t)},n),failBoardTask:(t,n)=>e({method:`board.task.fail`,parameters:t},{parse:e=>ahe(e,t)},n),...She(e)}),She=e=>({releaseBoardTask:(t,n)=>e({method:`board.task.release`,parameters:t},{parse:e=>rhe(e,t)},n),renewBoardTask:(t,n)=>e({method:`board.task.renew`,parameters:t},{parse:e=>nhe(e,t)},n)}),Che=e=>({cancelBoardTask:(t,n)=>e({method:`board.task.cancel`,parameters:t},{parse:e=>ohe(e,t)},n),reopenBoardTask:(t,n)=>e({method:`board.task.reopen`,parameters:t},{parse:e=>she(e,t)},n)}),whe=e=>({assignBoardTask:(t,n)=>e({method:`board.task.assign`,parameters:t},{parse:e=>che(e,t)},n),promoteBoardThread:(t,n)=>e({method:`board.task.promote`,parameters:t},{parse:e=>lhe(e,t)},n),replaceBoardTaskNeeds:(t,n)=>e({method:`board.task.needs.replace`,parameters:t},{parse:e=>uhe(e,t)},n)}),The=e=>{let t=(t,n,r)=>u6(e(t,n,r),r);return{...bhe(t),...xhe(t),...Che(t),...whe(t),...vhe(t),...yhe(e),listBoardTasks:(t,n)=>e({method:`board.task.list`,parameters:t},{parse:e=>fhe(e,t)},n),showBoardTask:(t,n)=>e({method:`board.task.show`,parameters:t},{parse:e=>phe(e,t)},n)}},r8=[[`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`]];r8.map(([e])=>e);var Ehe=(e,t)=>e.method===t,i8=(e,t)=>typeof e==`object`&&e?Reflect.get(e,t):void 0,Dhe=(e,t)=>e===YM.type?YM.id:e===jse?i8(t,`sessionId`):e===`session-child`?i8(t,`childSessionId`):void 0,Ohe=(e,t,n)=>{let r=i8(t,`commandId`);if(r===void 0)return!0;let i=i8(n,`receipt`);if(i===void 0)return i8(n,`commandId`)===r;let a=i8(i,`target`),o=i8(a,`type`);if(typeof o!=`string`)return!1;let s=i8(i,`method`)===e?i8(t,`${o}Id`)??Dhe(o,t):i8(i8(n,o),`id`);return i8(i,`commandId`)===r&&typeof s==`string`&&i8(a,`id`)===s},khe=({idempotency:e,method:t,parameters:n},r)=>{let i=cpe.parse(r);if(Ehe(i,t)&&(e!==`command-id`||Ohe(t,n,i)))return i;throw new W(`invalid_response`,`The ${t} response did not match the request.`)},a8=(e,t)=>new W(`invalid_request`,`The Maia request for ${e} failed runtime validation.`,{cause:t}),Ahe=e=>({call:(t,n,r)=>{let i=r8.find(([e])=>e===t)?.[1],a=i6.safeParse({method:t,parameters:n});if(!a.success)return E(a8(t,a.error));if(i===void 0)return E(a8(t));let o=e(a.data,{parse:e=>khe({idempotency:i,method:t,parameters:n},e)},r);return i===`command-id`?u6(o,r):o}}),o8=e=>{if(!e)throw new W(`invalid_response`,`The connection response did not match the request.`)},jhe=(e,t)=>{let n=soe.parse(e),r=n.connection;return o8(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},Mhe=(e,t)=>{let n=doe.parse(e),r=n.connection;return o8(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},Nhe=(e,t)=>{let n=foe.parse(e);return o8(n.connectionId===t.connectionId),n},Phe=(e,t)=>{let n=coe.parse(e);return o8(n.items.length<=t.limit&&(n.nextCursor===void 0||n.nextCursor!==t.afterCursor)),n},Fhe=(e,t)=>{let n=loe.parse(e);return o8(n.connection.connectionId===t.connectionId),n},Ihe=(e,t)=>{let n=uoe.parse(e);return o8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision&&n.connection.state===t.state),n},Lhe=(e,t)=>{let n=ooe.parse(e);return o8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision&&n.connection.maxConcurrentSessions===t.maxConcurrentSessions),n},Rhe=(e,t)=>{let n=ioe.parse(e);return o8(n.connection.connectionId===t.connectionId),n},zhe=(e,t)=>e.commandId===t.commandId&&e.connection.connectionId===t.connectionId&&e.expectedRevision===t.expectedRevision,Bhe=(e,t)=>{let n=aoe.parse(e);return o8(zhe(n,t)&&t.flow===`browser`==(n.login.authUrl!==void 0)),n},Vhe=(e,t)=>{let n=moe.parse(e);return o8(n.commandId===t.commandId),n},Hhe=(e,t)=>{let n=hoe.parse(e);return o8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest),n},Uhe=(e,t)=>{let n=_oe.parse(e);return o8(n.commandId===t.commandId&&n.executor===t.executor&&n.policy===t.policy),n},Whe=(e,t)=>{let n=voe.parse(e);return o8(n.commandId===t.commandId&&n.executor===t.executor&&n.inputDigest===t.inputDigest&&n.policy===t.policy),n},Ghe=(e,t)=>({confirmConnectionUpkeep:(e,n)=>t({method:`connection.upkeep.confirm`,parameters:e},{parse:t=>Whe(t,e)},n),previewConnectionUpkeep:(t,n)=>e({method:`connection.upkeep.preview`,parameters:t},{parse:e=>Uhe(e,t)},n),refreshConnectionUpkeep:(t,n)=>e({method:`connection.upkeep.refresh`,parameters:t},{parse:e=>goe.parse(e)},n)}),Khe=(e,t)=>({confirmSystemConnections:(e,n)=>t({method:`connection.system.confirm`,parameters:e},{parse:t=>Hhe(t,e)},n),detectConnections:(t,n)=>e({method:`connection.detect`,parameters:t},{parse:e=>poe.parse(e)},n),previewSystemConnections:(t,n)=>e({method:`connection.system.preview`,parameters:t},{parse:e=>Vhe(e,t)},n)}),qhe=e=>({listConnections:(t,n)=>e({method:`connection.list`,parameters:t},{parse:e=>Phe(e,t)},n),showConnection:(t,n)=>e({method:`connection.show`,parameters:t},{parse:e=>Fhe(e,t)},n),showConnectionUsage:(t,n)=>e({method:`connection.usage.show`,parameters:t},{parse:e=>Rhe(e,t)},n)}),Jhe=e=>({createConnection:(t,n)=>e({method:`connection.create`,parameters:t},{parse:e=>jhe(e,t)},n),setConnectionCapacity:(t,n)=>e({method:`connection.capacity.set`,parameters:t},{parse:e=>Lhe(e,t)},n),setConnectionState:(t,n)=>e({method:`connection.state.set`,parameters:t},{parse:e=>Ihe(e,t)},n)}),Yhe=e=>({startConnectionLogin:(t,n)=>e({method:`connection.login.start`,parameters:t},{parse:e=>Bhe(e,t)},n)}),Xhe=(e,t)=>({createGatewayConnection:(e,n)=>t({method:`connection.gateway.create`,parameters:e},{parse:t=>Mhe(t,e)},n),listConnectionModels:(t,n)=>e({method:`connection.models.list`,parameters:t},{parse:e=>Nhe(e,t)},n)}),s8=(e,t)=>e.kind===t.kind&&e.id===t.id,c8=(e,t)=>{let n=t.toSorted();return e.length===t.length&&e.toSorted().every((e,t)=>e===n[t])},l8=(e,t)=>e.items.length<=t.limit&&(e.nextCursor===void 0||e.nextCursor!==t.afterCursor)&&e.items.every(e=>t.scope===void 0||s8(e.scope,t.scope)),Zhe=(e,t)=>{let n=yoe.parse(e);return o8(l8(n,t)&&n.items.every(e=>(t.connectionId===void 0||e.connectionId===t.connectionId)&&(t.state===void 0||e.state===t.state))),n},Qhe=(e,t)=>{let n=boe.parse(e);return o8(n.commandId===t.commandId&&n.connectionId===t.connectionId&&n.granted===t.granted&&s8(n.scope,t.scope)),n},$he=(e,t)=>{let n=xoe.parse(e);return o8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.expectedRevision===t.expectedRevision&&n.grant.connectionId===t.connectionId&&s8(n.grant.scope,t.scope)&&n.grant.state===`active`===t.granted),n},ege=(e,t)=>{let n=Soe.parse(e);return o8(l8(n,t)),n},tge=(e,t)=>{let n=Coe.parse(e);return o8(n.commandId===t.commandId&&n.mode===t.mode&&c8(n.members,t.members)&&s8(n.scope,t.scope)),n},nge=(e,t)=>{let n=woe.parse(e);return o8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.expectedRevision===t.expectedRevision&&n.pool.mode===t.mode&&c8(n.pool.members,t.members)&&s8(n.pool.scope,t.scope)),n},rge=(e,t)=>({confirmConnectionGrant:(e,n)=>t({method:`connection.grant.set.confirm`,parameters:e},{parse:t=>$he(t,e)},n),listConnectionGrants:(t,n)=>e({method:`connection.grant.list`,parameters:t},{parse:e=>Zhe(e,t)},n),previewConnectionGrant:(t,n)=>e({method:`connection.grant.set.preview`,parameters:t},{parse:e=>Qhe(e,t)},n)}),ige=(e,t)=>({confirmConnectionPool:(e,n)=>t({method:`connection.pool.set.confirm`,parameters:e},{parse:t=>nge(t,e)},n),listConnectionPools:(t,n)=>e({method:`connection.pool.list`,parameters:t},{parse:e=>ege(e,t)},n),previewConnectionPool:(t,n)=>e({method:`connection.pool.set.preview`,parameters:t},{parse:e=>tge(e,t)},n)}),age=e=>{let t=(t,n,r)=>u6(e(t,n,r),r);return{...rge(e,t),...ige(e,t),...qhe(e),...Jhe(t),...Yhe(t),...Xhe(e,t),...Khe(e,t),...Ghe(e,t)}},u8=e=>{if(!e)throw new W(`invalid_response`,`The container response did not match the request.`)},d8=(e,t)=>{u8(e.commandId===t.commandId&&e.name===t.name.trim())},f8=(e,t)=>{u8(e.commandId===t.commandId&&e.inputDigest===t.inputDigest&&e.container.name===t.name.trim())},oge=(e,t)=>{let n=koe.parse(e);return f8(n,t),n},sge=(e,t)=>{let n=joe.parse(e);return f8(n,t),u8(n.container.id===t.containerId&&n.expectedRevision===t.expectedRevision),n},cge=(e,t)=>{let n=Ooe.parse(e);return d8(n,t),n},lge=(e,t)=>{let n=Aoe.parse(e);return d8(n,t),u8(n.containerId===t.containerId&&n.expectedRevision===t.expectedRevision),n},uge=(e,t)=>{let n=Toe.parse(e);return u8(n.items.length<=t.limit),n},dge=(e,t)=>{let n=Doe.parse(e);return u8(n.items.reduce((e,t)=>e+Math.max(t.projects.length,1),0)<=t.limit),n},fge=(e,t)=>{let n=Eoe.parse(e);return u8(n.container.id===t.containerId&&n.projects.length<=t.limit),n},pge=e=>({confirmContainerCreate:(t,n)=>e({method:`container.create.confirm`,parameters:t},{parse:e=>oge(e,t)},n),confirmContainerRename:(t,n)=>e({method:`container.rename.confirm`,parameters:t},{parse:e=>sge(e,t)},n)}),mge=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=>uge(e,t)},n)}),hge=e=>({previewContainerCreate:(t,n)=>e({method:`container.create.preview`,parameters:t},{parse:e=>cge(e,t)},n),previewContainerRename:(t,n)=>e({method:`container.rename.preview`,parameters:t},{parse:e=>lge(e,t)},n)}),gge=e=>({showContainer:(t,n)=>e({method:`container.show`,parameters:t},{parse:e=>fge(e,t)},n)}),_ge=e=>({...pge(e),...hge(e),...mge(e),...gge(e)}),p8=e=>{if(!e)throw new W(`invalid_response`,`The discovery response did not match the request.`)},vge=(e,{adopted:t,observed:n})=>(t===void 0||e.adoptedSessionId!==void 0==(t===`only`))&&(n===void 0||e.observed===n),yge=(e,t)=>{let n=dse.parse(e);return p8(n.items.length<=t.limit&&n.includesContentFields===(t.includeContentFields===!0)&&n.items.every(e=>e.sources.every(e=>t.sources.includes(e))&&vge(e,t))&&(n.truncatedSources??[]).every(e=>t.sources.includes(e))),n},bge=(e,t)=>{let n=fse.parse(e),r=t.target;return p8(n.messages.length<=t.limit&&n.offset===(t.offset??0)&&(r.kind===`session`||n.executor===r.executor&&n.nativeId===r.nativeId)),n},xge=(e,t)=>JSON.stringify(Object.entries(e??{}).toSorted())===JSON.stringify(Object.entries(t??{}).toSorted()),Sge=(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)&&xge(e.labels,t.labels),Cge=(e,t)=>{if(typeof e==`object`&&e&&`alreadyAdopted`in e){let n=mse.parse(e);return p8(n.executor===t.executor&&n.nativeId===t.nativeId),n}let n=pse.parse(e);return p8(Sge(n,t)),n},wge=e=>(t,n)=>u6(e({method:`session.adopt.confirm`,parameters:t},{parse:e=>hse.parse(e)},n),n),Tge=e=>({confirmSessionAdopt:wge(e),listDiscoveredSessions:(t,n)=>e({method:`discovery.sessions.list`,parameters:t},{parse:e=>yge(e,t)},n),previewSessionAdopt:(t,n)=>e({method:`session.adopt.preview`,parameters:t},{parse:e=>Cge(e,t)},n),readSessionHistory:(t,n)=>e({method:`session.history.read`,parameters:t},{parse:e=>bge(e,t)},n)}),Ege=e=>({applyExecutionRelocation:(t,n)=>e({method:`execution.relocation.apply`,parameters:t},Dme,n),planExecutionRelocation:(t,n)=>e({method:`execution.relocation.plan`,parameters:t},Eme,n),reconcileExecutionRelocation:(t,n)=>e({method:`execution.relocation.reconcile`,parameters:t},kme,n),showExecutionRelocation:(t,n)=>e({method:`execution.relocation.show`,parameters:t},Ome,n)}),m8=e=>{if(!e)throw new W(`invalid_response`,`The GitHub response did not match the request.`)},h8=e=>e.map(e=>e.toLowerCase()).toSorted(),Dge=(e,t)=>{let n=VW.parse(e);return m8(n.commandId===t.commandId&&n.connection.name===t.name&&n.connection.appId===t.appId&&n.connection.installationId===t.installationId),n},Oge=(e,t)=>{let n=HW.parse(e);return m8(t.connectionId===void 0||n.connections.length<=1&&n.connections.every(({connectionId:e})=>e===t.connectionId)),n},kge=(e,t)=>{let n=UW.parse(e);return m8(n.commandId===t.commandId&&n.connection.connectionId===t.connectionId&&n.expectedRevision===t.expectedRevision),n},Age=(e,t)=>{let n=WW.parse(e);return m8(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},jge=(e,t)=>{let n=GW.parse(e);return m8(n.sessionId===t.sessionId),n},Mge=(e,t)=>{let n=KW.parse(e);return m8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.link.linkId===t.linkId&&n.link.watching===t.watching&&h8(n.link.allowedAuthors).join(`,`)===h8(t.allowedAuthors).join(`,`)),n},Nge=e=>({createGithubConnection:(t,n)=>u6(e({method:`connection.github.create`,parameters:t},{parse:e=>Dge(e,t)},n),n),revokeGithubConnection:(t,n)=>u6(e({method:`connection.github.revoke`,parameters:t},{parse:e=>kge(e,t)},n),n)}),Pge=e=>({linkPullRequest:(t,n)=>u6(e({method:`pr.link`,parameters:t},{parse:e=>Age(e,t)},n),n),showPullRequestStatus:(t,n)=>e({method:`pr.status`,parameters:t},{parse:e=>jge(e,t)},n)}),Fge=e=>({...Nge(e),...Pge(e),showGithubConnections:(t,n)=>e({method:`connection.github.show`,parameters:t},{parse:e=>Oge(e,t)},n),watchPullRequest:(t,n)=>u6(e({method:`pr.watch`,parameters:t},{parse:e=>Mge(e,t)},n),n)}),g8=e=>{if(!e)throw new W(`invalid_response`,`The goal response did not match the request.`)},Ige=(e,t)=>{let n=Nse.parse(e);return g8(n.commandId===t.commandId&&n.goal.sessionId===t.sessionId&&n.goal.text===t.text&&n.goal.dod.length===(t.dod?.length??0)),n},Lge=(e,t)=>{let n=Lse.parse(e);return g8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.dod[t.line-1]?.done?.evidence===t.evidence),n},Rge=(e,t)=>{let n=Rse.parse(e);return g8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.state===t.state),n},zge=(e,t)=>{let n=Pse.parse(e);return g8(n.sessionId===t.sessionId),n},Bge=(e,t)=>{let n=Fse.parse(e);return g8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.goal.sessionId===t.sessionId&&n.goal.text===t.text),n},Vge=(e,t)=>{let n=Ise.parse(e);return g8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.sessionId===t.sessionId),n},Hge=e=>(t,n)=>u6(e({method:`goal.clear`,parameters:t},{parse:e=>Vge(e,t)},n),n),Uge=e=>(t,n)=>u6(e({method:`goal.mark`,parameters:t},{parse:e=>Lge(e,t)},n),n),Wge=e=>(t,n)=>u6(e({method:`goal.transition`,parameters:t},{parse:e=>Rge(e,t)},n),n),Gge=e=>(t,n)=>u6(e({method:`goal.set`,parameters:t},{parse:e=>Ige(e,t)},n),n),Kge=e=>(t,n)=>u6(e({method:`goal.update`,parameters:t},{parse:e=>Bge(e,t)},n),n),qge=e=>({clearGoal:Hge(e),markGoal:Uge(e),setGoal:Gge(e),showGoal:(t,n)=>e({method:`goal.show`,parameters:t},{parse:e=>zge(e,t)},n),transitionGoal:Wge(e),updateGoal:Kge(e)}),_8=e=>{if(!e)throw new W(`invalid_response`,`The hold response did not match the request.`)},v8=e=>e.map(e=>`${e.kind}:${e.id}`).toSorted().join(`
|
|
17
|
+
`),y8=(e,t)=>e.commandId===t.commandId&&e.reason===t.reason.trim()&&e.running===t.running&&v8(e.targets)===v8(t.targets),Jge=(e,t)=>{let n=rG.parse(e);return _8(y8(n,t)),n},Yge=(e,t)=>{let n=iG.parse(e);return _8(n.inputDigest===t.inputDigest&&y8({...n.hold,commandId:n.commandId},t)),n},Xge=(e,t)=>{let n=aG.parse(e);return _8(n.commandId===t.commandId&&n.holdId===t.holdId&&n.expectedRevision===t.expectedRevision),n},Zge=(e,t)=>{let n=oG.parse(e);return _8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.hold.id===t.holdId&&n.expectedRevision===t.expectedRevision),n},Qge=(e,t)=>{let n=nG.parse(e);return _8(n.items.length<=t.limit&&n.items.every(e=>t.state===void 0||e.state===t.state)),n},$ge=e=>({confirmHoldPlace:(t,n)=>u6(e({method:`hold.place.confirm`,parameters:t},{parse:e=>Yge(e,t)},n),n),previewHoldPlace:(t,n)=>e({method:`hold.place.preview`,parameters:t},{parse:e=>Jge(e,t)},n)}),e_e=e=>({confirmHoldRelease:(t,n)=>u6(e({method:`hold.release.confirm`,parameters:t},{parse:e=>Zge(e,t)},n),n),previewHoldRelease:(t,n)=>e({method:`hold.release.preview`,parameters:t},{parse:e=>Xge(e,t)},n)}),t_e=e=>({...$ge(e),...e_e(e),listHolds:(t,n)=>e({method:`hold.list`,parameters:t},{parse:e=>Qge(e,t)},n)}),b8=e=>{if(!e)throw new W(`invalid_response`,`The inbox response did not match the request.`)},n_e=(e,t)=>{let n=LG.parse(e),r=t.state??`open`;return b8(n.items.length<=t.limit&&n.items.every(e=>e.state===r)),n},r_e=(e,t)=>{let n=RG.parse(e);return b8(n.item.itemId===t.itemId),n},i_e=(e,t)=>{if(`approval`in e){let{approval:n}=e;return n.requestDigest===t.requestDigest&&X6(n.status,t,n.resolution?.forSession===!0)}let{confirmation:n}=e;return n.requestDigest===t.requestDigest&&n.status===(t.decision===`approve`?`confirmed`:`denied`)},a_e=(e,t)=>{let n=zG.parse(e);return b8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&i_e(n,t)),n},o_e=(e,t)=>{let n=BG.parse(e);return b8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&n.item.state===`settled`),n},s_e=(e,t)=>{let n=VG.parse(e);return b8(n.commandId===t.commandId&&n.item.itemId===t.itemId&&n.item.state===`snoozed`&&n.item.snoozedUntil===t.until),n},c_e=e=>({listInbox:(t,n)=>e({method:`inbox.list`,parameters:t},{parse:e=>n_e(e,t)},n),showInboxItem:(t,n)=>e({method:`inbox.show`,parameters:t},{parse:e=>r_e(e,t)},n)}),l_e=e=>({respondToInboxItem:(t,n)=>u6(e({method:`inbox.respond`,parameters:t},{parse:e=>a_e(e,t)},n),n)}),u_e=e=>({settleInboxItem:(t,n)=>u6(e({method:`inbox.settle`,parameters:t},{parse:e=>o_e(e,t)},n),n),snoozeInboxItem:(t,n)=>u6(e({method:`inbox.snooze`,parameters:t},{parse:e=>s_e(e,t)},n),n)}),d_e=e=>({...c_e(e),...l_e(e),...u_e(e)}),x8=e=>{if(!e)throw new W(`invalid_response`,`The interaction response did not match the request.`)},f_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]),p_e=(e,t)=>{let n=EJ.parse(e),r=n.interaction;return x8(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`&&x8(r.options.length===t.options.length&&r.options.every((e,n)=>e.optionId===t.options[n]?.optionId&&e.label===t.options[n]?.label)),n},m_e=(e,t)=>{let n=DJ.parse(e);return x8(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},h_e=(e,t)=>{let n=OJ.parse(e);return x8(n.interaction.interactionId===t.interactionId),n},g_e=(e,t)=>{let n=kJ.parse(e);return x8(n.commandId===t.commandId&&n.interaction.interactionId===t.interactionId&&n.expectedRevision===t.expectedRevision&&f_e(n.interaction.answer,t.answer)),n},__e=(e,t)=>{let n=AJ.parse(e);return x8(n.commandId===t.commandId&&n.interaction.interactionId===t.interactionId&&n.expectedRevision===t.expectedRevision),n},v_e=e=>({listInteractions:(t,n)=>e({method:`interaction.list`,parameters:t},{parse:e=>m_e(e,t)},n),showInteraction:(t,n)=>e({method:`interaction.show`,parameters:t},{parse:e=>h_e(e,t)},n)}),y_e=e=>({cancelInteraction:(t,n)=>e({method:`interaction.cancel`,parameters:t},{parse:e=>__e(e,t)},n),createInteraction:(t,n)=>e({method:`interaction.create`,parameters:t},{parse:e=>p_e(e,t)},n),respondToInteraction:(t,n)=>e({method:`interaction.respond`,parameters:t},{parse:e=>g_e(e,t)},n)}),b_e=e=>({...v_e(e),...y_e((t,n,r)=>u6(e(t,n,r),r))}),S8=e=>{if(!e)throw new W(`invalid_response`,`The update response did not match the request.`)},x_e=(e,t)=>{let n=cY.parse(e);return S8(n.reason===t.reason),n},S_e=(e,t)=>{let n=sY.parse(e);return S8(n.value===t.value&&BigInt(n.revision)===BigInt(t.revision)+1n),n},C_e=(e,t)=>{let n=uY.parse(e);return S8(n.commandId===t.commandId&&n.node===t.node),n},w_e=(e,t)=>{let n=dY.parse(e);return S8(n.node===t.node&&n.from===t.from&&BigInt(n.revision)===BigInt(t.revision)+1n),n},T_e=(e,t)=>{let n=fY.parse(e);return S8(n.commandId===t.commandId&&n.node===t.node),n},E_e=(e,t)=>{let n=pY.parse(e);return S8(n.node===t.node&&n.from===t.from&&n.to===t.to&&BigInt(n.revision)===BigInt(t.revision)+1n),n},D_e=e=>({confirmNodeUpdateApply:(t,n)=>u6(e({method:`node.update.apply.confirm`,parameters:t},{parse:e=>E_e(e,t)},n),n),previewNodeUpdateApply:(t,n)=>e({method:`node.update.apply.preview`,parameters:t},{parse:e=>T_e(e,t)},n)}),O_e=e=>({confirmNodeUpdateRollback:(t,n)=>u6(e({method:`node.update.rollback.confirm`,parameters:t},{parse:e=>w_e(e,t)},n),n),previewNodeUpdateRollback:(t,n)=>e({method:`node.update.rollback.preview`,parameters:t},{parse:e=>C_e(e,t)},n),showNodeUpdate:t=>e({method:`node.update.show`,parameters:{}},rY,t)}),k_e=e=>({pauseNodeUpdate:(t,n)=>u6(e({method:`node.update.pause`,parameters:t},{parse:e=>x_e(e,t)},n),n),resumeNodeUpdate:(t,n)=>u6(e({method:`node.update.resume`,parameters:t},lY,n),n)}),A_e=e=>({checkNodeUpdate:t=>e({method:`node.update.check`,parameters:{}},iY,t),getNodeUpdatePolicy:t=>e({method:`node.update.policy.get`,parameters:{}},oY,t),setNodeUpdatePolicy:(t,n)=>u6(e({method:`node.update.policy.set`,parameters:t},{parse:e=>S_e(e,t)},n),n)}),j_e=e=>({...D_e(e),...k_e(e),...A_e(e),...O_e(e),showNodeUpdateStatus:t=>e({method:`node.update.status`,parameters:{}},aY,t)}),M_e=(e,t)=>e.kind===`create`?t.kind===`create`&&e.role===t.role:t.kind===`revoke`&&e.pairingId===t.pairingId,C8=e=>{if(!e)throw new W(`invalid_response`,`The pairing response did not match the request.`)},N_e=(e,t)=>{let n=OY.parse(e);return C8(n.commandId===t.commandId&&M_e(n.change,t.change)),n},P_e=(e,t)=>{let n=kY.parse(e),{change:r,revision:i}=t;return C8(BigInt(n.revision)===BigInt(i)+1n&&(r.kind===`create`?n.role===r.role&&n.state===`pending`:n.pairingId===r.pairingId&&n.state===`revoked`)),n},F_e=(e,t)=>{let n=AY.parse(e);return C8(n.clientId===t.clientId),n},I_e=e=>({confirmPairing:(t,n)=>u6(e({method:`node.pairing.confirm`,parameters:t},{parse:e=>P_e(e,t)},n),n),previewPairing:(t,n)=>e({method:`node.pairing.preview`,parameters:t},{parse:e=>N_e(e,t)},n),showPairings:t=>e({method:`node.pairing.show`,parameters:{}},jY,t)}),L_e=e=>({...I_e(e),redeemPairing:(t,n)=>u6(e({method:`node.pairing.redeem`,parameters:t},{parse:e=>F_e(e,t)},n),n)}),w8=e=>{if(!e)throw new W(`invalid_response`,`The port lease response did not match the request.`)},T8=(e,t)=>t===void 0?e.kind===`principal`:e.kind===`session`&&e.sessionId===t,R_e=(e,t)=>{let n=aX.parse(e);return w8(n.commandId===t.commandId&&n.lease.purpose===t.purpose&&n.lease.ports.length===(t.count??1)&&T8(n.lease.owner,t.sessionId)),n},z_e=(e,t)=>{let n=oX.parse(e);return w8(n.commandId===t.commandId&&n.lease.leaseId===t.leaseId&&n.expectedRevision===t.expectedRevision),n},B_e=(e,t)=>{let n=sX.parse(e);return w8(n.commandId===t.commandId&&n.lease.leaseId===t.leaseId),n},V_e=(e,t)=>{let n=cX.parse(e),{afterCursor:r,limit:i,sessionId:a}=t;return w8(n.items.length<=i&&(n.nextCursor===void 0||n.nextCursor!==r)&&(a===void 0||n.items.every(e=>T8(e.lease.owner,a)))),n},H_e=e=>({acquirePortLease:(t,n)=>e({method:`port.lease.acquire`,parameters:t},{parse:e=>R_e(e,t)},n),releasePortLease:(t,n)=>e({method:`port.lease.release`,parameters:t},{parse:e=>B_e(e,t)},n),renewPortLease:(t,n)=>e({method:`port.lease.renew`,parameters:t},{parse:e=>z_e(e,t)},n)}),U_e=e=>({...H_e((t,n,r)=>u6(e(t,n,r),r)),listPortLeases:(t,n)=>e({method:`port.lease.list`,parameters:t},{parse:e=>V_e(e,t)},n)}),W_e=(e,t)=>{let n=VX.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},G_e=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The Project presentation request failed runtime validation.`),try:()=>BX.parse(t)}),i={...r,page:{...r.page}};return yield*e({method:`presentation.project-list.show`,parameters:r},{parse:e=>W_e(e,i)},n)}).pipe(kp(`PresentationClient.requestProjectList`)),K_e=(e,t)=>{let n=zX.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},q_e=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The Session presentation request failed runtime validation.`),try:()=>RX.parse(t)}),i={...r,page:{...r.page},target:{...r.target}};return yield*e({method:`presentation.session-list.show`,parameters:r},{parse:e=>K_e(e,i)},n)}).pipe(kp(`PresentationClient.requestSessionList`)),J_e=(e,t)=>{let n=WX.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},Y_e=(e,t,n)=>Mf(function*(){let r=yield*If({catch:()=>new W(`invalid_request`,`The presentation request failed runtime validation.`),try:()=>UX.parse(t)}),i={...r,page:{...r.page}};return yield*e({method:`presentation.workspace-directory.show`,parameters:r},{parse:e=>J_e(e,i)},n)}).pipe(kp(`PresentationClient.requestDirectory`)),X_e=e=>({showPresentationCatalog:(t,n)=>e({method:`presentation.catalog.show`,parameters:t},HX,n),showProjectList:(t,n)=>G_e(e,t,n),showSessionList:(t,n)=>q_e(e,t,n),showWorkspaceDirectory:(t,n)=>Y_e(e,t,n)}),Z_e=(e,t)=>e.kind===`create`?t.kind===`create`&&e.name===t.name&&e.role===t.role:t.kind===`revoke`&&e.principalId===t.principalId,E8=e=>{if(!e)throw new W(`invalid_response`,`The principal response did not match the request.`)},Q_e=(e,t)=>{let n=aZ.parse(e);return E8(n.commandId===t.commandId&&Z_e(n.change,t.change)),n},$_e=(e,t)=>{let n=oZ.parse(e),{change:r,revision:i}=t;return E8(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},eve=e=>({confirmPrincipal:(t,n)=>u6(e({method:`node.principal.confirm`,parameters:t},{parse:e=>$_e(e,t)},n),n),previewPrincipal:(t,n)=>e({method:`node.principal.preview`,parameters:t},{parse:e=>Q_e(e,t)},n),showPrincipals:t=>e({method:`node.principal.show`,parameters:{}},sZ,t)}),D8=e=>{if(!e)throw new W(`invalid_response`,`The Project guard response did not match the request.`)},O8=(e,t)=>e.maxDepth===t.maxDepth&&e.maxLeasesPerSession===t.maxLeasesPerSession&&e.maxLiveChildren===t.maxLiveChildren&&e.maxMessagesPerMinute===t.maxMessagesPerMinute,k8=(e,t)=>(e?.coordinator??t.coordinator)===t.coordinator,tve=(e,t)=>{let n=eae.parse(e);return D8(n.guard.projectId===t.projectId),n},nve=(e,t)=>{let n=tae.parse(e);return D8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&O8(n.limits,t.limits)&&k8(t.approvalGrants,n.approvalGrants)),n},rve=(e,t)=>{let n=nae.parse(e);return D8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.guard.projectId===t.projectId&&O8(n.guard.limits,t.limits)&&k8(t.approvalGrants,n.guard.approvalGrants)),n},ive=e=>({confirmProjectGuard:(t,n)=>u6(e({method:`project.guard.confirm`,parameters:t},{parse:e=>rve(e,t)},n),n),previewProjectGuard:(t,n)=>e({method:`project.guard.preview`,parameters:t},{parse:e=>nve(e,t)},n),showProjectGuard:(t,n)=>e({method:`project.guard.show`,parameters:t},{parse:e=>tve(e,t)},n)}),A8=e=>{if(!e)throw new W(`invalid_response`,`The Project knowledge response did not match the request.`)},ave=(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),ove=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),sve=e=>e.length/4*3-(e.length-e.replace(/=+$/u,``).length),cve=(e,t)=>{let n=ace.parse(e);return A8(n.projectId===t.projectId),n},lve=(e,t)=>{let n=fce.parse(e);return A8((t.projectId===void 0||n.projectId===t.projectId)&&(t.limit===void 0||n.hits.length<=t.limit)),n},uve=(e,t)=>{let n=oce.parse(e);return A8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&ave(n.files,t.files)),n},dve=(e,t)=>{let n=sce.parse(e);return A8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.projectId===t.projectId),n},fve=(e,t)=>{let n=cce.parse(e);return A8(n.commandId===t.commandId&&n.path===t.path&&n.offset===t.offset&&n.bytes===sve(t.data)),n},pve=(e,t)=>{let n=lce.parse(e);return A8(n.commandId===t.commandId&&n.projectId===t.projectId),n},mve=(e,t)=>{let n=uce.parse(e);return A8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.projectId===t.projectId&&ove(n.paths,t.paths)),n},hve=(e,t)=>{let n=dce.parse(e);return A8(n.commandId===t.commandId&&n.expectedRevision===t.expectedRevision&&n.inputDigest===t.inputDigest&&n.projectId===t.projectId&&n.removed<=t.paths.length),n},gve=e=>({listProjectKnowledge:(t,n)=>e({method:`project.knowledge.list`,parameters:t},{parse:e=>cve(e,t)},n),searchProjectKnowledge:(t,n)=>e({method:`project.knowledge.search`,parameters:t},{parse:e=>lve(e,t)},n)}),_ve=e=>({confirmProjectKnowledgeAdd:(t,n)=>u6(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=>uve(e,t)},n)}),vve=e=>({commitProjectKnowledgeAdd:(t,n)=>u6(e({method:`project.knowledge.add.commit`,parameters:t},{parse:e=>pve(e,t)},n),n),sendProjectKnowledgeChunk:(t,n)=>e({method:`project.knowledge.add.chunk`,parameters:t},{parse:e=>fve(e,t)},n)}),yve=e=>({confirmProjectKnowledgeRemove:(t,n)=>u6(e({method:`project.knowledge.remove.confirm`,parameters:t},{parse:e=>hve(e,t)},n),n),previewProjectKnowledgeRemove:(t,n)=>e({method:`project.knowledge.remove.preview`,parameters:t},{parse:e=>mve(e,t)},n)}),bve=e=>({...gve(e),..._ve(e),...vve(e),...yve(e)}),j8=(e,t,n)=>n?w(t):d6(e.invalidResponse),xve=(e,t,n)=>e.request({method:`workspace.membership.attach`,parameters:t},Qse,n).pipe(D(n=>j8(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))),Sve=(e,t,n)=>e.request({method:`workspace.select`,parameters:t},$se,n).pipe(D(n=>j8(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))),Cve=(e,t,n)=>e.request({method:`project.context.record`,parameters:t},Kse,n).pipe(D(n=>j8(e,n,n.receipt.commandId===t.commandId&&n.note.body===t.body&&n.note.projectId===t.projectId&&n.note.attribution===t.attribution))),wve=e=>({listProjects:(t,n)=>e.request({method:`project.list`,parameters:t},Wse,n),registerProject:(t,n)=>e.request({method:`project.register`,parameters:t},Use,n),showProject:(t,n)=>e.request({method:`project.show`,parameters:t},Gse,n)}),Tve=e=>({listProjectContext:(t,n)=>e.request({method:`project.context.list`,parameters:t},qse,n),recordProjectContext:(t,n)=>Cve(e,t,n),showProjectContext:(t,n)=>e.request({method:`project.context.show`,parameters:t},Jse,n)}),Eve=e=>({listWorkspaces:(t,n)=>e({method:`workspace.list`,parameters:t},Xse,n),showWorkspace:(t,n)=>e({method:`workspace.show`,parameters:t},Zse,n),showWorkspaceContext:(t,n)=>e({method:`workspace.context.show`,parameters:t},Yse,n)}),Dve=e=>({attachWorkspaceMembership:(t,n)=>xve(e,t,n),attachWorkspaceRepository:(t,n)=>e.request({method:`workspace.repository.attach`,parameters:t},ece,n),selectWorkspace:(t,n)=>Sve(e,t,n)}),Ove=e=>({previewProjectCreate:(t,n)=>e.request({method:`project.create.preview`,parameters:t},{parse:n=>{let r=zse.parse(n);return r.commandId===t.commandId&&r.name===t.name.trim()&&r.containerId===t.containerId&&r.expectedContainerRevision===t.expectedContainerRevision?r:e.invalidResponse()}},n)}),kve=e=>({previewProjectRename:(t,n)=>e.request({method:`project.rename.preview`,parameters:t},{parse:n=>{let r=Vse.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)}),Ave=e=>({confirmProjectCreate:(t,n)=>e.request({method:`project.create.confirm`,parameters:t},{parse:n=>{let r=Bse.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)}),jve=e=>({confirmProjectRename:(t,n)=>e.request({method:`project.rename.confirm`,parameters:t},{parse:n=>{let r=Hse.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)}),Mve=e=>({previewProjectInstructionsChange:(t,n)=>e.request({method:`project.instructions.change.preview`,parameters:t},nce,n).pipe(D(n=>j8(e,n,n.commandId===t.commandId&&n.projectId===t.projectId&&n.expectedRevision===t.expectedRevision&&n.text===t.text)))}),Nve=e=>({showProjectInstructions:(t,n)=>e.request({method:`project.instructions.show`,parameters:t},tce,n).pipe(D(n=>j8(e,n,n.projectId===t.projectId&&(n.instructions===null||n.instructions.projectId===t.projectId))))}),Pve=e=>({confirmProjectInstructionsChange:(t,n)=>e.request({method:`project.instructions.change.confirm`,parameters:t},{parse:n=>{let r=rce.parse(n);return r.commandId===t.commandId&&r.projectId===t.projectId&&r.expectedRevision===t.expectedRevision&&r.inputDigest===t.inputDigest?r:e.invalidResponse()}},n)}),Fve=e=>({invalidResponse:e.invalidResponse,request:(t,n,r)=>u6(e.request(t,n,r),r)}),Ive=(e,t)=>{let n={invalidResponse:t,request:e},r=Fve(n);return{...Ove(n),...kve(n),...Ave(r),...jve(r),...Mve(n),...Nve(n),...Pve(r),...wve(n),...Tve(n),...Eve(e),...Dve(n)}},Lve=e=>({listProviderPools:(t,n)=>e({method:`provider.pool.list`,parameters:t},vZ,n)}),M8=(e,t)=>e?.address===t?.address&&e?.port===t?.port,N8=e=>{if(!e)throw new W(`invalid_response`,`The reach response did not match the request.`)},Rve=(e,t)=>{let n=zZ.parse(e);return N8(M8(n.bind,t.change.bind)&&BigInt(n.revision)===BigInt(t.revision)+1n),n},zve=(e,t)=>{let n=RZ.parse(e);return N8(n.commandId===t.commandId&&M8(n.change.bind,t.change.bind)&&(n.change.bind===void 0||n.transport===`cleartext-http`)),n},Bve=e=>({confirmReach:(t,n)=>u6(e({method:`node.reach.confirm`,parameters:t},{parse:e=>Rve(e,t)},n),n),previewReach:(t,n)=>e({method:`node.reach.preview`,parameters:t},{parse:e=>zve(e,t)},n),showReach:t=>e({method:`node.reach.show`,parameters:{}},BZ,t)}),P8=e=>{if(!e)throw new W(`invalid_response`,`The remote Node response did not match the request.`)},Vve=(e,t)=>{let n=rQ.parse(e);return P8(n.commandId===t.commandId&&(n.state!==`ready`||n.name===t.name&&n.plan.profile===t.profile&&n.plan.keep===t.keep)),n},F8=(e,t)=>e.name===t.name,Hve=(e,t)=>{let n=iQ.parse(e);return P8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&F8(n.node,t)&&n.node.host===t.host&&n.node.profile===t.profile),n},Uve=(e,t)=>{let n=cQ.parse(e);return P8(n.commandId===t.commandId&&n.name===t.name&&n.purge===t.purge&&n.expectedRevision===t.expectedRevision),n},Wve=(e,t)=>{let n=lQ.parse(e);return P8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&F8(n.node,t)),n},I8=(e,t)=>e.host===t.host&&(t.launcherPath===void 0||e.launcherPath===t.launcherPath),Gve=(e,t)=>{let n=aQ.parse(e);return P8(n.commandId===t.commandId&&n.name===t.name&&I8(n.plan,t)&&(t.profile===void 0||n.plan.profile===t.profile)),n},Kve=(e,t)=>{let n=oQ.parse(e);return P8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&F8(n.node,t)&&n.node.origin===`registered`&&I8(n.node,t)),n},qve=e=>({confirmRemoteNodeRegister:(t,n)=>e({method:`node.remote.register.confirm`,parameters:t},{parse:e=>Kve(e,t)},n),previewRemoteNodeRegister:(t,n)=>e({method:`node.remote.register.preview`,parameters:t},{parse:e=>Gve(e,t)},n)}),Jve=e=>({listRemoteNodes:(t,n)=>e({method:`node.remote.list`,parameters:t},sQ,n)}),Yve=e=>({confirmRemoteNodeInstall:(t,n)=>e({method:`node.remote.install.confirm`,parameters:t},{parse:e=>Hve(e,t)},n),previewRemoteNodeInstall:(t,n)=>e({method:`node.remote.install.preview`,parameters:t},{parse:e=>Vve(e,t)},n)}),Xve=e=>({confirmRemoteNodeRemove:(t,n)=>e({method:`node.remote.remove.confirm`,parameters:t},{parse:e=>Wve(e,t)},n),previewRemoteNodeRemove:(t,n)=>e({method:`node.remote.remove.preview`,parameters:t},{parse:e=>Uve(e,t)},n)}),Zve=e=>({...Jve(e),...Yve(e),...qve(e),...Xve(e)}),L8=e=>{if(!e)throw new W(`invalid_response`,`The routine response did not match the request.`)},R8=({precheck:e})=>e===void 0?void 0:{command:e.command,timeoutSeconds:e.timeoutSeconds},z8=(e,t)=>e.commandId===t.commandId&&e.name===t.name&&JSON.stringify(R8(e))===JSON.stringify(R8(t))&&JSON.stringify(e.schedule)===JSON.stringify(t.schedule)&&e.template.projectId===t.template.projectId,Qve=(e,t)=>{let n=B$.parse(e);return L8(z8(n,t)),n},$ve=(e,t)=>{let n=V$.parse(e);return L8(n.inputDigest===t.inputDigest&&z8({...n.routine,commandId:n.commandId},t)),n},eye=(e,t)=>{let n=L$.parse(e);return L8(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},tye=(e,t)=>{let n=z$.parse(e);return L8(n.items.length<=t.limit&&n.items.every(e=>t.routineId===void 0||e.routineId===t.routineId)),n},nye=(e,t)=>{let n=R$.parse(e);return L8(n.routine.id===t.routineId&&n.fires.every(e=>e.routineId===t.routineId)),n},B8=e=>(t,n)=>{let r=e.parse(t);return L8(r.commandId===n.commandId&&r.expectedRevision===n.expectedRevision&&r.routineId===n.routineId),r},rye=B8(W$),iye=B8(K$),aye=(e,t)=>{let n=q$.parse(e);return L8(n.fire.routineId===t.routineId&&n.receipt.commandId===t.commandId),n},V8=e=>(t,n)=>{let r=e.parse(t);return L8(r.routine.id===n.routineId&&r.receipt.commandId===n.commandId),r},oye=B8(J$),sye=V8(Y$),cye=B8(X$),lye=V8(Z$),uye=(e,t)=>{let n=oye(e,t);return L8(n.agentId===t.agentId&&n.prompt===t.prompt&&JSON.stringify(n.schedule)===JSON.stringify(t.schedule)),n},dye=(e,t)=>{let n=sye(e,t),{schedule:r,template:i}=n.routine;return L8([[`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},fye=(e,t)=>{let n=cye(e,t);return L8(n.projectId===t.projectId),n},pye=(e,t)=>{let n=lye(e,t);return L8(n.routine.template.projectId===t.projectId),n},mye=(e,t)=>e.length===t.length&&e.every((e,n)=>e.path===t[n]?.path&&e.equals===t[n]?.equals),H8=(e,t)=>e.commandId===t.commandId&&e.routineId===t.routineId&&e.ratePerMinute===t.ratePerMinute&&mye(e.filters,t.filters),hye=(e,t)=>{let n=$$.parse(e);return L8(H8(n,t)),n},gye=(e,t)=>{let n=e1.parse(e);return L8(n.inputDigest===t.inputDigest&&n.receipt.commandId===t.commandId&&H8({...n.trigger,commandId:n.commandId},t)),n},_ye=(e,t)=>{let n=Q$.parse(e);return L8(n.triggers.every(e=>e.routineId===t.routineId)),n},vye=(e,t)=>{let n=t1.parse(e);return L8(n.trigger.id===t.triggerId&&n.receipt.commandId===t.commandId),n},U8=(e,t,n)=>(r,i)=>e(t(r),{parse:e=>n(e,r)},i),W8=(e,t,n)=>(r,i)=>u6(U8(e,t,n)(r,i),i),G8={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})},yye=V8(G$),bye=V8(H$),xye=V8(U$),Sye=e=>({confirmRoutineTriggerCreate:W8(e,G8.triggerCreate,gye),disableRoutineTrigger:W8(e,G8.triggerDisable,vye),listRoutineTriggers:U8(e,G8.triggerList,_ye),previewRoutineTriggerCreate:U8(e,G8.triggerCreatePreview,hye)}),Cye=e=>({confirmRoutineMove:W8(e,G8.move,pye),confirmRoutineUpdate:W8(e,G8.update,dye),previewRoutineMove:U8(e,G8.movePreview,fye),previewRoutineUpdate:U8(e,G8.updatePreview,uye)}),wye=e=>({...Cye(e),...Sye(e),confirmRoutineCreate:W8(e,G8.create,$ve),confirmRoutineDisable:W8(e,G8.disable,yye),confirmRoutineRun:W8(e,G8.run,aye),listRoutineRuns:U8(e,G8.runs,tye),listRoutines:U8(e,G8.list,eye),pauseRoutine:W8(e,G8.pause,bye),previewRoutineCreate:U8(e,G8.createPreview,Qve),previewRoutineDisable:U8(e,G8.disablePreview,rye),previewRoutineRun:U8(e,G8.runPreview,iye),resumeRoutine:W8(e,G8.resume,xye),showRoutine:U8(e,G8.show,nye)}),K8=e=>{if(!e)throw new W(`invalid_response`,`The Run ledger response did not match the request.`)},Tye=(e,t)=>{let n=Xle.parse(e);return K8(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},Eye=(e,t)=>{let n=eue.parse(e);return K8(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},Dye=(e,t)=>{let n=tue.parse(e),r=n.task.dispatches.at(-1);return K8(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},Oye=(e,t)=>{let n=Zle.parse(e);return K8(n.items.length<=t.limit&&n.items.every(e=>e.workspaceId===t.workspaceId)&&(n.nextCursor===void 0||n.nextCursor!==t.afterCursor)),n},kye=(e,t)=>{let n=Qle.parse(e);return K8(n.run.id===t.runId&&(t.ready!==!0||n.items.every(e=>e.state===`ready`))),n},Aye=(e,t)=>{let n=$le.parse(e);return K8(n.task.runId===t.runId&&n.task.id===t.taskId),n},jye=e=>({createRunLedger:(t,n)=>e({method:`run.ledger.create`,parameters:t},{parse:e=>Tye(e,t)},n),dispatchRunLedgerTask:(t,n)=>e({method:`run.ledger.task.dispatch`,parameters:t},{parse:e=>Eye(e,t)},n),settleRunLedgerTask:(t,n)=>e({method:`run.ledger.task.settle`,parameters:t},{parse:e=>Dye(e,t)},n)}),Mye=e=>({...jye((t,n,r)=>u6(e(t,n,r),r)),listRunLedgers:(t,n)=>e({method:`run.ledger.list`,parameters:t},{parse:e=>Oye(e,t)},n),listRunLedgerTasks:(t,n)=>e({method:`run.ledger.task.list`,parameters:t},{parse:e=>kye(e,t)},n),showRunLedgerTask:(t,n)=>e({method:`run.ledger.task.show`,parameters:t},{parse:e=>Aye(e,t)},n)}),q8=e=>{if(!e)throw new W(`invalid_response`,`The secret response did not match the request.`)},Nye=(e,t)=>{let n=Sce.parse(e);return q8(n.commandId===t.commandId&&n.name===t.name),n},Pye=(e,t)=>{let n=Cce.parse(e);return q8(n.name===t.name),n},Fye=(e,t)=>{let n=wce.parse(e);return q8(n.commandId===t.commandId&&n.name===t.name&&n.inputDigest===t.inputDigest),n},Iye=e=>({confirmSecretSet:(t,n)=>u6(e({method:`secret.set.confirm`,parameters:t},{parse:e=>Fye(e,t)},n),n),previewSecretSet:(t,n)=>e({method:`secret.set.preview`,parameters:t},{parse:e=>Pye(e,t)},n),requestSecret:(t,n)=>u6(e({method:`secret.request`,parameters:t},{parse:e=>Nye(e,t)},n),n)}),Lye=e=>({acknowledgeSessionDelivery:(t,n)=>e({method:`session.inbox.ack`,parameters:t},Roe,n),checkSessionInbox:(t,n)=>e({method:`session.inbox.check`,parameters:t},Loe,n),sendSessionMessage:(t,n)=>e({method:`session.message.send`,parameters:t},Ioe,n)}),J8=(e,t)=>t.workspace===e.workspace&&t.kind===e.change.kind&&(e.change.kind===`rollback`||t.digest===e.change.set.digest),Y8=e=>{if(!e)throw new W(`invalid_response`,`The skills sync response did not match the request.`)},Rye=(e,t)=>{let n=Lue.parse(e);return Y8(J8(t,n)&&BigInt(n.revision)===BigInt(t.revision)+1n),n},zye=(e,t)=>{let n=Iue.parse(e);return Y8(J8(t,n)&&n.commandId===t.commandId&&n.workspace===t.workspace),n},Bye=e=>({confirmSkillsSync:(t,n)=>u6(e({method:`skills.sync.confirm`,parameters:t},{parse:e=>Rye(e,t)},n),n),previewSkillsSync:(t,n)=>e({method:`skills.sync.preview`,parameters:t},{parse:e=>zye(e,t)},n),showSkillsSync:(t,n)=>e({method:`skills.sync.show`,parameters:t},Fue,n)}),X8=e=>{if(!e)throw new W(`invalid_response`,`The Team Workspace bootstrap response did not match the request.`)},Vye=(e,t)=>{let n=Gue.parse(e);return X8(n.commandId===t.commandId&&n.expectedBootstrapRevision===t.expectedBootstrapRevision),n},Hye=(e,t)=>{let n=Kue.parse(e);return X8(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.previewId===t.previewId),n},Uye=e=>({applyTeamWorkspaceBootstrap:(t,n)=>u6(e({method:`team-workspace.bootstrap.apply`,parameters:t},{parse:e=>Hye(e,t)},n),n),previewTeamWorkspaceBootstrap:(t,n)=>e({method:`team-workspace.bootstrap.preview`,parameters:t},{parse:e=>Vye(e,t)},n)});G(v3);var Wye=G(Afe);G(T3),G(S3);var Gye=Object.freeze({description:S4,name:x4,parameters:Object.freeze(b3),type:`function`});Object.freeze([Gye]);var Kye=G(E3),qye=G(O3),Jye=G(D3),Yye=G(k3),Xye=G(d3),Zye=G(f3),Qye=G(p3),Z8={orchestratorContextParameters:Kye.parse,orchestratorContextResult:qye.parse,orchestratorToolParameters:Jye.parse,orchestratorToolResult:Yye.parse,previewParameters:nfe.parse,previewResult:afe.parse,reconcileParameters:ife.parse,reconcileResult:sfe.parse,relayParameters:rfe.parse,relayResult:ofe.parse,toolCall:Wye.parse},Q8=()=>new W(`invalid_response`,`The managed voice response did not match the request.`),$8=(e,t)=>If({catch:()=>new W(`invalid_request`,`The managed voice request is invalid.`),try:()=>e.parse(t)}),e5=e=>e instanceof W?e:Q8(),$ye=(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`,ebe=(e,t)=>e.sessionId===t.sessionId&&e.projectId===t.projectId&&e.voiceSessionId===t.scopeId&&e.expectedSessionRevision===t.expectedSessionRevision&&e.turnInput===t.utterance.trim(),tbe=(e,t,n)=>Mf(function*(){let r=yield*$8(Zye,t),i=yield*e({method:`voice.managed-turn.confirm`,parameters:r},a6,n).pipe(qf(e5));return $ye(i,r)?i:yield*E(Q8())}),nbe=(e,t,n)=>Mf(function*(){let r=yield*$8(Xye,t),i=yield*e({method:`voice.managed-turn.preview`,parameters:r},Qye,n).pipe(qf(e5));return ebe(i,r)?i:yield*E(Q8())}),rbe=e=>({confirmVoiceManagedTurn:(t,n)=>tbe(e,t,n),previewVoiceManagedTurn:(t,n)=>nbe(e,t,n)}),t5=(e,t,n)=>n?w(t):d6(e.invalidResponse),ibe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay.preview`,parameters:Z8.previewParameters(t)},{parse:e=>Z8.previewResult(e)},n)).pipe(D(n=>t5(e,n,n.commandId===t.commandId&&n.workspaceId===t.workspaceId&&n.workspaceRevision===t.expectedWorkspaceRevision&&n.contextRevision===t.expectedContextRevision))),abe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay.reconcile`,parameters:Z8.reconcileParameters(t)},{parse:e=>Z8.reconcileResult(e)},n)).pipe(D(n=>t5(e,n,n.commandId===t.commandId))),obe=(e,t,n)=>kf(()=>e.request({method:`voice.pi.relay`,parameters:Z8.relayParameters(t)},{parse:e=>Z8.relayResult(e)},n)).pipe(D(n=>t5(e,n,n.commandId===t.commandId&&n.workspaceId===t.workspaceId&&n.sessionId===t.sessionId&&n.workspaceRevision===t.expectedWorkspaceRevision&&n.contextRevision===t.expectedContextRevision))),sbe=(e,t)=>{let n={invalidResponse:t,request:e};return{previewVoiceToPi:(e,t)=>ibe(n,e,t),reconcileVoiceToPi:(e,t)=>abe(n,e,t),relayVoiceToPi:(e,t)=>obe(n,e,t)}},n5=e=>{if(!e)throw new W(`invalid_response`,`The webhook response did not match the request.`)},r5=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)))),cbe=(e,t)=>{let n=Tfe.parse(e);return n5(n.commandId===t.commandId&&r5(n.change)===r5(a3.parse(t.change))),n},lbe=(e,t)=>r5(e)===r5(t),ube=(e,t)=>{let n=Efe.parse(e),r=a3.parse(t.change);return n5(n.commandId===t.commandId&&n.inputDigest===t.inputDigest&&n.kind===r.kind&&(r.kind===`add`?n.webhook.revision===`1`&&n.webhook.state===`active`&&lbe(n.webhook.spec,r.spec):(r.kind===`redeliver`||n.webhook.id===r.webhookId)&&BigInt(n.webhook.revision)===BigInt(r.expectedRevision)+1n)),n},i5=(e,t)=>(n5(e.items.length<=t.limit),e),dbe=e=>({listWebhookDeliveries:(t,n)=>e({method:`webhooks.deliveries`,parameters:t},{parse:e=>i5(wfe.parse(e),t)},n),listWebhooks:(t,n)=>e({method:`webhooks.list`,parameters:t},{parse:e=>i5(Cfe.parse(e),t)},n)}),fbe=e=>({...dbe(e),confirmWebhookChange:(t,n)=>u6(e({method:`webhooks.change.confirm`,parameters:t},{parse:e=>ube(e,t)},n),n),previewWebhookChange:(t,n)=>e({method:`webhooks.change.preview`,parameters:t},{parse:e=>cbe(e,t)},n)}),pbe=e=>({showCurrentContext:(t,n)=>e({method:`context.show`,parameters:t},tY,n)}),mbe=e=>({createMonitorBootstrap:t=>e({method:`monitor.bootstrap.create`,parameters:{}},spe,t),shutdown:t=>e({method:`node.shutdown`,parameters:{}},ope,t),status:t=>e({method:`node.status`,parameters:{}},ape,t)}),hbe=e=>({configureWorkspaceExecution:(t,n)=>e({method:`workspace.execution.configure`,parameters:t},eW,n),readExecutionCatalog:(t,n)=>e({method:`execution.catalog.get`,parameters:t},QU,n),showWorkspaceExecution:(t,n)=>e({method:`workspace.execution.show`,parameters:t},$U,n)}),gbe=(e,t)=>t.kind===`session`?e.placement.kind===`session`&&e.placement.sessionId===t.ownerId:e.placement.kind===`attempt`&&e.placement.attemptId===t.ownerId,a5=(e,t)=>gbe(e,t)?w(e):E(new W(`invalid_response`,`The execution placement response owner did not match the request.`)),_be=(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},vbe=(e,t)=>a5(e,`sessionId`in t?{kind:`session`,ownerId:t.sessionId}:{kind:`attempt`,ownerId:t.attemptId}).pipe(ap(e=>_be(e,t),()=>new W(`invalid_response`,`The execution placement response snapshots did not match the request.`))),ybe=e=>({createExecutionPlacement:(t,n)=>e({method:`execution.placement.create`,parameters:t},wme,n).pipe(D(e=>vbe(e,t))),showExecutionPlacement:(t,n)=>e({method:`execution.placement.show`,parameters:t},Tme,n).pipe(D(e=>a5(e,t)))}),bbe=e=>({readExecutionFile:(t,n)=>e({method:`execution.file.read`,parameters:t},Sme,n),runExecutionCommand:(t,n)=>e({method:`execution.command.run`,parameters:t},Cme,n)}),o5=(e,t)=>t?w(e):E(new W(`invalid_response`,`The execution worktree response did not match the request.`)),s5=(e,t)=>o5(e,e.operation.commandId===t.commandId&&e.operation.repositoryId===t.repositoryId),xbe=(e,t,n)=>e({method:`execution.worktree.reconcile`,parameters:t},Nme,n).pipe(D(e=>o5(e,e.operation.id===t.operationId&&e.receipt.commandId===t.commandId))),Sbe=(e,t,n)=>e({method:`execution.worktree.remove.apply`,parameters:t},Fme,n).pipe(D(e=>o5(e,e.operation.workspaceId===t.workspaceId&&e.receipt.commandId===t.commandId))),Cbe=e=>({createExecutionWorktree:(t,n)=>e({method:`execution.worktree.create`,parameters:t},Ame,n).pipe(D(e=>s5(e,t))),importExecutionWorktree:(t,n)=>e({method:`execution.worktree.import`,parameters:t},jme,n).pipe(D(e=>s5(e,t)))}),wbe=e=>({reconcileExecutionWorktree:(t,n)=>xbe(e,t,n),removeExecutionWorktree:(t,n)=>Sbe(e,t,n)}),Tbe=e=>({planExecutionWorktreeRemove:(t,n)=>e({method:`execution.worktree.remove.plan`,parameters:t},Pme,n).pipe(D(e=>o5(e,e.plan.workspaceId===t.workspaceId))),showExecutionWorktreeStatus:(t,n)=>e({method:`execution.worktree.status`,parameters:t},Mme,n).pipe(D(e=>o5(e,e.workspace.id===t.workspaceId)))}),Ebe=e=>({showExecutionCheckpoint:(t,n)=>e({method:`execution.checkpoint.show`,parameters:t},Lme,n).pipe(D(e=>o5(e,e.checkpoint.id===t.checkpointId)))}),Dbe=e=>({createExecutionCheckpoint:(t,n)=>e({method:`execution.checkpoint.create`,parameters:t},Ime,n).pipe(D(e=>o5(e,e.operation.commandId===t.commandId&&e.operation.instanceId===t.instanceId)))}),Obe=e=>({...hbe(e),...Dbe(e),...Ebe(e),...bbe(e),...ybe(e),...Cbe(e),...Tbe(e),...wbe(e)}),kbe=e=>({getReceipt:(t,n)=>e({method:`receipt.get`,parameters:t},noe,n),listReceipts:(t,n)=>e({method:`receipt.list`,parameters:t},roe,n)}),Abe=e=>({applyClaudeCodeIntegration:(t,n)=>e({method:`integration.apply.claude-code`,parameters:t},rJ,n),applyCodexIntegration:(t,n)=>e({method:`integration.apply.codex`,parameters:t},sJ,n),applyPiRpcIntegration:(t,n)=>e({method:`integration.apply.pi-rpc`,parameters:t},CJ,n)}),jbe=e=>({removeClaudeCodeIntegration:(t,n)=>e({method:`integration.remove.claude-code`,parameters:t},aJ,n),removeCodexIntegration:(t,n)=>e({method:`integration.remove.codex`,parameters:t},lJ,n),removePiRpcIntegration:(t,n)=>e({method:`integration.remove.pi-rpc`,parameters:t},TJ,n)}),Mbe=e=>({planClaudeCodeIntegration:(t,n)=>e({method:`integration.plan.claude-code`,parameters:t},nJ,n),planCodexIntegration:(t,n)=>e({method:`integration.plan.codex`,parameters:t},oJ,n),planPiRpcIntegration:(t,n)=>e({method:`integration.plan.pi-rpc`,parameters:t},SJ,n)}),Nbe=e=>({statusClaudeCodeIntegration:(t,n)=>e({method:`integration.status.claude-code`,parameters:t},iJ,n),statusCodexIntegration:(t,n)=>e({method:`integration.status.codex`,parameters:t},cJ,n),statusPiRpcIntegration:(t,n)=>e({method:`integration.status.pi-rpc`,parameters:t},wJ,n)}),Pbe=e=>({applyMaiaAgentIntegration:(t,n)=>e({method:`integration.apply.maia-agent`,parameters:t},dJ,n),removeMaiaAgentIntegration:(t,n)=>e({method:`integration.remove.maia-agent`,parameters:t},pJ,n)}),Fbe=e=>({planMaiaAgentIntegration:(t,n)=>e({method:`integration.plan.maia-agent`,parameters:t},uJ,n),statusMaiaAgentIntegration:(t,n)=>e({method:`integration.status.maia-agent`,parameters:t},fJ,n)}),Ibe=e=>({applyPiIntegration:(t,n)=>e({method:`integration.apply.pi`,parameters:t},hJ,n),removePiIntegration:(t,n)=>e({method:`integration.remove.pi`,parameters:t},_J,n)}),Lbe=e=>({planPiIntegration:(t,n)=>e({method:`integration.plan.pi`,parameters:t},mJ,n),statusPiIntegration:(t,n)=>e({method:`integration.status.pi`,parameters:t},gJ,n)}),Rbe=e=>({applyAntigravityIntegration:(t,n)=>e({method:`integration.apply.antigravity`,parameters:t},yJ,n),removeAntigravityIntegration:(t,n)=>e({method:`integration.remove.antigravity`,parameters:t},xJ,n)}),zbe=e=>({planAntigravityIntegration:(t,n)=>e({method:`integration.plan.antigravity`,parameters:t},vJ,n),statusAntigravityIntegration:(t,n)=>e({method:`integration.status.antigravity`,parameters:t},bJ,n)}),Bbe=e=>({...Rbe(e),...zbe(e),...Abe(e),...Mbe(e),...jbe(e),...Nbe(e),...Pbe(e),...Fbe(e),...Ibe(e),...Lbe(e)}),Vbe=e=>({listInstalledHarnesses:(t,n)=>e({method:`harness.installed.list`,parameters:t},tG,n),probeRuntime:(t,n)=>e({method:`runtime.probe`,parameters:t},cue,n)}),Hbe=e=>({createSession:(t,n)=>e({method:`session.create`,parameters:t},Foe,n),startSession:(t,n)=>e({method:`session.start`,parameters:t},Hoe,n)}),Ube=e=>({archiveSession:(t,n)=>e({method:`session.archive`,parameters:t},Woe,n),diffSession:(t,n)=>e({method:`session.diff`,parameters:t},Uoe,n),resumeSession:(t,n)=>e({method:`session.resume`,parameters:t},Qoe,n),stopSession:(t,n)=>e({method:`session.stop`,parameters:t},Zoe,n)}),Wbe=e=>({listSessionEvents:(t,n)=>e({method:`session.events.list`,parameters:t},Voe,n),listSessions:(t,n)=>e({method:`session.list`,parameters:t},zoe,n),observeSessions:(t,n)=>e({method:`session.observe`,parameters:t},Goe,n),showSession:(t,n)=>e({method:`session.show`,parameters:t},Boe,n)}),Gbe=e=>({waitSession:(t,n)=>e({method:`session.wait`,parameters:t},Poe,n)}),Kbe=e=>({cancelTurn:(t,n)=>e({method:`turn.cancel`,parameters:t},upe,n),listTurnQueue:(t,n)=>e({method:`turn.queue.list`,parameters:t},dpe,n)}),qbe=e=>({showTurnAttachmentPolicy:(t,n)=>e({method:`turn.attachment.policy`,parameters:t},lpe,n)}),Jbe=e=>({interruptTurn:(t,n)=>e({method:`turn.interrupt`,parameters:t},fpe,n),sendTurn:(t,n)=>e({method:`turn.send`,parameters:t},a6,n),showTurn:(t,n)=>e({method:`turn.show`,parameters:t},ppe,n),waitTurns:(t,n)=>e({method:`turn.wait`,parameters:t},mpe,n)}),Ybe=e=>({acquireTerminalController:(t,n)=>e({method:`terminal.controller.acquire`,parameters:t},zde,n),releaseTerminalController:(t,n)=>e({method:`terminal.controller.release`,parameters:t},Bde,n),requestTerminalController:(t,n)=>e({method:`terminal.controller.request`,parameters:t},Lde,n)}),Xbe=e=>({closeTerminal:(t,n)=>e({method:`terminal.session.close`,parameters:t},Wde,n),resizeTerminal:(t,n)=>e({method:`terminal.session.resize`,parameters:t},Hde,n),signalTerminal:(t,n)=>e({method:`terminal.session.signal`,parameters:t},Ude,n)}),Zbe=e=>({writeTerminalInput:(t,n)=>e({method:`terminal.input.write`,parameters:t},Vde,n)}),Qbe=e=>({createTerminal:(t,n)=>e({method:`terminal.create`,parameters:t},Mde,n)}),$be=e=>({listTerminalEvents:(t,n)=>e({method:`terminal.events.list`,parameters:t},Fde,n),listTerminals:(t,n)=>e({method:`terminal.list`,parameters:t},Nde,n),showTerminal:(t,n)=>e({method:`terminal.show`,parameters:t},Pde,n)}),exe=e=>({showTerminalControllerRequest:(t,n)=>e({method:`terminal.controller.request.show`,parameters:t},Rde,n)}),txe=e=>({readTerminal:(t,n)=>e({method:`terminal.read`,parameters:t},Ide,n)}),nxe=e=>({createOrchestrationRun:(t,n)=>e({method:`run.create`,parameters:t},XE,n),listOrchestrationRuns:(t,n)=>e({method:`run.list`,parameters:t},QE,n),showOrchestrationRun:(t,n)=>e({method:`run.show`,parameters:t},ZE,n)}),rxe=e=>({listOrchestrationTasks:(t,n)=>e({method:`run.task.list`,parameters:t},$E,n),showOrchestrationTask:(t,n)=>e({method:`run.task.show`,parameters:t},eD,n)}),ixe=e=>({acknowledgeOrchestrationDelivery:(t,n)=>e({method:`run.inbox.ack`,parameters:t},rD,n),checkOrchestrationInbox:(t,n)=>e({method:`run.inbox.check`,parameters:t},nD,n)}),axe=e=>({cancelOrchestrationQuestion:(t,n)=>e({method:`run.question.cancel`,parameters:t},oD,n),openOrchestrationQuestion:(t,n)=>e({method:`run.question.open`,parameters:t},iD,n),replyOrchestrationQuestion:(t,n)=>e({method:`run.question.reply`,parameters:t},aD,n)}),oxe=e=>({settleOrchestrationDispatchTerminal:(t,n)=>e({method:`run.dispatch.settle-terminal`,parameters:t},sD,n)}),sxe=e=>({showOrchestrationDispatch:(t,n)=>e({method:`run.dispatch.show`,parameters:t},tD,n)}),cxe=()=>{throw new W(`invalid_response`,`The Workspace response did not match the request.`)},lxe=()=>{throw new W(`invalid_response`,`The Pi voice relay response did not match the request.`)},uxe=e=>({...Hbe(e),...Ube(e),...Wbe(e),...Gbe(e),...Lye(e)}),dxe=e=>({...age(e),...Ive(e,cxe),..._ge(e),...X_e(e)}),fxe=e=>({...U_e(e),...Zve(e),...Lve(e)}),pxe=e=>({...zme(e),...Zme(e),...ive(e),...bve(e),...t_e(e),...d_e(e),...Tge(e),...Uye(e),...qme(e),...wye(e),...fbe(e),...L_e(e),...eve(e),...Fge(e),...The(e),...qge(e),...Bve(e),...j_e(e),...Bye(e),...Iye(e)}),mxe=e=>({...Mye(e),...ixe(e),...axe(e),...nxe(e),...rxe(e),...sxe(e),...oxe(e)}),hxe=e=>({...Obe(e),...Ege(e),...Bbe(e),...b_e(e),...pbe(e),...mbe(e),...mxe(e),...dxe(e),...fxe(e),...kbe(e),...Vbe(e),...uxe(e),...pxe(e),...Ybe(e),...exe(e),...Qbe(e),...Xbe(e),...$be(e),...txe(e),...Zbe(e),...Jbe(e),...qbe(e),...Kbe(e),...sbe(e,lxe),...rbe(e),...Ahe(e)}),gxe=e=>hxe(wpe(s6(e))),c5=`maia.panel.session`,_xe=`code`,l5=e=>{let t=new URLSearchParams(e.replace(/^#/u,``)).get(_xe);return t===null||t===``?void 0:t},vxe=e=>{let t=e.replaceAll(/\s/gu,``),n=t.indexOf(`#`);return n===-1?t===``?void 0:t:l5(t.slice(n))},u5=e=>{try{return cr(e?.getItem(c5))}catch{return nr()}},yxe=(e,t)=>T(()=>{try{e?.setItem(c5,t)}catch{}}),d5=e=>{try{e?.removeItem(c5)}catch{}},bxe=N({session:j}),xxe=(e,t)=>Mf(function*(){let n=yield*F6,r=yield*O6(`${e.location.origin}${RO}`).pipe(Zpe({code:t})),i=yield*n.execute(r);return i.status===200?(yield*i.json.pipe(D(Yv(bxe)))).session:yield*E(`refused`)}).pipe(gp,dp(H6(e.fetch))),Sxe=(e,t)=>Mf(function*(){let n=yield*(yield*F6).execute(Hpe(`${e.location.origin}${RO}`).pipe(k6(W6(t))));return n.status>=200&&n.status<300?`confirmed`:`unconfirmed`}).pipe(gp,G6,dp(H6(e.fetch))),Cxe=(e,t=Af)=>kf(()=>{let n=u5(e.storage);return d5(e.storage),$f(t).pipe(zf(Sxe(e,n)),Wf(()=>w(`unconfirmed`)))}),f5=(e,t)=>xxe(e,t).pipe(D(t=>yxe(e.storage,t)),Hf(`signed-in`),Wf(()=>T(()=>(d5(e.storage),`refused`)))),wxe=e=>Mf(function*(){let{hash:t,pathname:n,search:r}=e.location,i=l5(t);return i===void 0?ir(u5(e.storage))?`signed-out`:`signed-in`:(yield*T(()=>{e.replaceAddress(`${n}${r}`)}),yield*f5(e,i))}),Txe=(e,t,n)=>Mf(function*(){yield*T(()=>{e.set(`starting`)});let r=vxe(n),i=r===void 0?`refused`:yield*f5(t,r);yield*T(()=>{e.set(i)})}),Exe=(e,t,n)=>Cxe(t,n).pipe(Bf(()=>T(()=>{e.set(`signed-out`)}))),Dxe=()=>{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)})}},Oxe=e=>Epe(gxe(e)),kxe=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 Axe=32,jxe=12,Mxe=16,Nxe=(e,t)=>e===jxe?4:e===Mxe?8+t%4:t,Pxe=e=>[e.slice(0,8),e.slice(8,12),e.slice(12,16),e.slice(16,20),e.slice(20)].join(`-`),Fxe=O(pp(Xp),e=>Pxe(Array.from({length:Axe},(t,n)=>Nxe(n,Math.floor(e.nextDoubleUnsafe()*16)).toString(16)).join(``))),Ixe=D(pp(class extends Kr(`@maiaos/client-core/IdGenerator`,{defaultValue:()=>({uuid:Fxe})}){}),e=>e.uuid),p5=e=>O(Ixe,t=>`${e}_${t.replaceAll(`-`,``)}`),m5=class extends ga(`NodeStatusClientError`){operation=`node.status`},Lxe=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}),Rxe=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},zxe=e=>{if(!(e instanceof W))return`offline`;let t=Rxe(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`},Bxe=e=>p5(`desktop_node_status`).pipe(D(t=>Of({catch:e=>new m5({message:`The local Maia node status request failed.`,reason:zxe(e)}),try:n=>e.status({messageId:t,signal:n})})),O(Lxe),ep({duration:5500,orElse:()=>E(new m5({message:`The local Maia node status request timed out.`,reason:`timed_out`}))})),h5=e=>({read:()=>Bxe(e)}),g5=(e,t)=>cS(e.state,t).pipe(zf(T(()=>{e.emit(t)}))),_5=(e,t)=>Mf(function*(){(yield*sS(e.closed))||(yield*sS(e.state))!==t||(yield*T(()=>{e.emit(t)}))}),v5=(e,t)=>e.gate.withPermits(1)(Mf(function*(){if(yield*sS(e.closed))return nr();let n=yield*sS(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*cS(e.state,r),rr(r)})).pipe(D(or({onNone:()=>Af,onSome:t=>_5(e,t)}))),Vxe=(e,t)=>e.gate.withPermits(1)(Mf(function*(){if(yield*sS(e.closed))return nr();let n=yield*sS(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*cS(e.state,i),rr(i)})).pipe(D(or({onNone:()=>Af,onSome:t=>_5(e,t)}))),y5=e=>Mf(function*(){yield*cS(e.closed,!0),yield*g5(e,{generation:(yield*sS(e.state)).generation,reason:`invalid`,status:`error`}),yield*Bx(e.request)}),Hxe=(e,t)=>e.profile.read(t).pipe(cp({onFailure:n=>v5(e,{generation:t.generation,reason:n.reason,status:`error`}),onSuccess:n=>v5(e,{generation:t.generation,page:n,status:`ready`})})),Uxe=(e,t)=>({generation:e,...t===void 0?{}:{page:t},status:`loading`}),b5=(e,t)=>Mf(function*(){let n=yield*sS(e.state);if(n.generation>=2147483647)return yield*y5(e);let r=n.generation+1;yield*cS(e.cursor,lr(t.afterCursor));let i=Uxe(r,t.keep);yield*t.quiet===!0?cS(e.state,i):g5(e,i),!(yield*sS(e.closed))&&(yield*Hx(e.request,Hxe(e,{generation:r,viewId:e.viewId,...t.afterCursor===void 0?{}:{afterCursor:t.afterCursor}})))}),x5=(e,t={})=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){(yield*sS(e.closed))||(yield*b5(e,t))})).pipe(Uf),Wxe=e=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){if(yield*sS(e.closed))return;let t=yield*sS(e.state);if(t.status!==`ready`||t.page===void 0)return;let n=ur(yield*sS(e.cursor));yield*b5(e,{...n===void 0?{}:{afterCursor:n},keep:t.page})})).pipe(Uf),Gxe=(e,t,n)=>e.gate.withPermitsIfAvailable(1)(Mf(function*(){if(yield*sS(e.closed))return;let r=yield*sS(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),Kxe=(e,t)=>({load:t=>x5(e,t===void 0?{}:{afterCursor:t}),loadQuietly:x5(e,{quiet:!0}),patch:t=>Vxe(e,t),read:sS(e.state),refresh:Wxe(e),revoke:y5(e),run:e=>{t(e)},select:(t,n)=>Gxe(e,t,n)}),qxe=(e,t)=>Mf(function*(){let n={closed:yield*oS(!1),cursor:yield*oS(nr()),emit:t,gate:yield*fb(1),profile:e,request:yield*Ix(),state:yield*oS({generation:0,status:`loading`}),viewId:yield*e.identifier},r=yield*Yx();return yield*vp(()=>cS(n.closed,!0)),Kxe(n,r)}),S5=class extends ga(`PresentationError`){constructor(e){super({message:`Workspace directory ${e}.`,reason:e})}};fd(class extends mr()(`@maiaos/client-core/PresentationApi`){},{directory:()=>E(new S5(`unavailable`)),identifier:E(new S5(`unavailable`)),projects:()=>E(new S5(`unavailable`)),sessions:()=>E(new S5(`unavailable`))});var C5=class extends mr()(`@maiaos/client-core/NodeChanges`){};fd(C5,{watch:()=>px});var Jxe=`session`,w5=Gi(2),Yxe=Gi(2),Xxe=Wi(150),Zxe=e=>e.kind===`resync`||e.aggregateTypes.includes(Jxe),Qxe=e=>e.page?.observations.items.some(e=>e.runtime?.turn)??!1,$xe=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 S5(t.reason??`unavailable`):t.page.nodeInstanceId});Gp(`Presentation.watchSessionList`)(function*(e){let t=yield*C5;yield*bx(_x(O($xe(e),e=>t.watch(e))).pipe(xx(Zxe),Sx(()=>e.refresh),Cx(ff(w5)),yx(ff(w5))),lx(Yxe).pipe(vx(()=>e.read),xx(Qxe))).pipe(wx(Xxe),Ox(()=>e.refresh))});var T5=(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},eSe=(e,t,n)=>{let r=e.rows.get(t);return r!==void 0&&BigInt(r.revision)>=BigInt(n)},E5=(e,t,n)=>e===void 0||n===void 0?t:{...t,record:n(e.record,t.record)},tSe=(e,t=500)=>{let n=e.held.reduce((e,t)=>T5(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}},D5=(e,t,n={})=>{let r=e.rows.get(t.id);return T5(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,E5(r,t,n.carry))}:e},nSe=(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}},rSe=(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&&!T5(i,r)?i:E5(i,r,n.carry)]})),i=[...e.rows.values()].filter(e=>!r.has(e.id)&&e.seq>t.seq).reduce((e,t)=>D5(e,t,n),{...t,rows:r});return t.reload===void 0?i:{...i,reload:t.reload}},O5=100,k5=(e,t)=>t===void 0?{records:e}:{nextCursor:t,records:e},A5=(e,t,n)=>{let{api:r,kind:i,seq:a}=e,o=n===void 0?{limit:O5}:{afterCursor:n,limit:O5};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}):A5(e,r,n.nextCursor)}))},iSe=e=>Mf(function*(){let t=yield*e.api.instance,{held:n,more:r}=yield*A5(e,[]);return tSe({held:n,instanceId:t,more:r,seq:e.seq})}),j5=class extends mr()(`@maiaos/client-core/RecordsApi`){},M5=e=>{if(e instanceof S5)return e;let{kind:t}=xS(e,{mutation:!1});return t===`unavailable`||t===`denied`||t===`invalid`?new S5(t):new S5(t===`conflict`||t===`not_found`?`scope_mismatch`:`offline`)},aSe=e=>xS(e,{mutation:!1}).kind===`not_found`,N5=e=>D(p5(`records`),t=>Of({catch:e=>e,try:n=>e({messageId:t,signal:n})})).pipe(ep({duration:`5500 millis`,orElse:()=>E(new S5(`offline`))})),P5=e=>N5(e).pipe(qf(M5)),F5=e=>N5(e).pipe(O(rr),Kf(aSe,()=>w(nr())),qf(M5)),oSe=({client:e,instance:t})=>fd(j5,{instance:t,listAgents:t=>P5(n=>e.listAgents({...t},n)),listInteractions:t=>P5(n=>e.listInteractions({...t},n)),listRoutines:t=>P5(n=>e.listRoutines({...t},n)),showAgent:t=>F5(n=>e.showAgent({agentId:t},n)),showInteraction:t=>F5(n=>e.showInteraction({interactionId:t},n)),showRoutine:t=>F5(n=>e.showRoutine({routineId:t},n))}),sSe=e=>e===`denied`||e===`unavailable`?e:`offline`,I5=({generation:e,page:t,reason:n,status:r})=>{if(r===`error`){let t=n??`offline`;return{capability:sSe(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}},cSe=Wi(150),lSe=64,uSe=Gi(2),dSe=cf([uf(Gi(2)),ff(Gi(30))]),fSe=(e,t)=>t.some(t=>t.kind===`records`&&t.aggregateTypes.includes(e)),pSe=(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&&!eSe(t,n.id,n.revision)).map(e=>e.id):[]))],hSe=(e,t)=>Mf(function*(){let{aggregateType:n}=e;if(pSe(n,t))return yield*e.reload(`resync`);let r=yield*e.known;if(ir(r))return yield*fSe(n,t)?e.reload(`resync`):Af;let i=mSe(n,r.value,t);if(i.length>lSe)return yield*e.reload(`resync`);i.length>0&&!(yield*e.reread(i))&&(yield*e.reload(`resync`))}),gSe=e=>Mf(function*(){let t=yield*C5,n=yield*e.instance,r=yield*e.known;(ir(r)||r.value.instanceId!==n)&&(yield*e.reload()),yield*t.watch(n).pipe(Tx(512,cSe),Ox(t=>hSe(e,t)))}).pipe(Yf(()=>e.reload(`subscription-lost`))),_Se=e=>gSe(e).pipe(Zf(dSe),Dp(ff(uSe)),Qf),vSe=4,ySe=Wi(100),L5=e=>fS(e,e=>e+1),bSe=({api:e,kind:t,order:n,pending:r})=>Mf(function*(){let i=yield*lS(r,nr()),a=yield*iSe({api:e,kind:t,seq:yield*L5(n)}).pipe(xp(e=>Lu(e)?Af:dS(r,e=>ar(e)?e:i)));return ar(i)?{...a,reload:i.value}:a}),xSe=(e,t,{id:n,seq:r,shown:i})=>{if(ir(i))return nSe(e,n,r);let a=i.value;return t.inScope(a)?D5(e,{id:n,record:a,revision:t.revision(a),seq:r},{carry:t.carry}):e},SSe=({api:e,kind:t,order:n},r,i)=>Mf(function*(){let a=yield*L5(n),o=yield*t.show(e,i);return yield*r.patch(e=>xSe(e,t,{id:i,seq:a,shown:o})),!0}).pipe(Wf(()=>w(!1))),R5=e=>e.read.pipe(Dp({schedule:ff(ySe),until:e=>e.status!==`loading`})),CSe=({pending:e},t)=>n=>Mf(function*(){n!==void 0&&(yield*cS(e,rr(n))),yield*(yield*R5(t)).status===`ready`?t.refresh:t.loadQuietly,yield*R5(t)}),wSe=(e,t)=>{let n=n=>Tf(n,n=>SSe(e,t,n),{concurrency:vSe}).pipe(O(e=>e.every(Boolean))),r=CSe(e,t);return{load:t.load(),read:O(t.read,I5),refresh:t.refresh,reload:r,reread:n,watch:_Se({aggregateType:e.kind.aggregateType,instance:e.api.instance,known:O(R5(t),({page:e})=>lr(e)),reload:r,reread:n})}},z5=(e,t)=>Mf(function*(){let n={api:yield*j5,kind:e,order:yield*oS(0),pending:yield*oS(nr())};return wSe(n,yield*qxe({identifier:w(`records`),merge:(t,n)=>rSe(n,t,{carry:e.carry}),read:()=>bSe(n),selected:()=>nr()},e=>{t(I5(e))}).pipe(Jf))}),TSe=({projectId:e})=>({aggregateType:Nae,id:e=>e.id,inScope:t=>t.projectId===e,list:(t,n)=>t.listAgents({...n,projectId:e}).pipe(O(e=>k5(e.items,e.nextCursor))),revision:e=>e.revision,show:(e,t)=>e.showAgent(t).pipe(O(fr(e=>e.agent)))}),ESe=(e,t)=>z5(TSe(e),t),DSe=`interaction`,OSe=e=>{let{answer:t,respondingActorId:n,responseDigest:r,...i}=e;return i},kSe=({projectId:e,sessionId:t})=>({aggregateType:DSe,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=>k5(e.items,e.nextCursor))),revision:e=>e.revision,show:(e,t)=>e.showInteraction(t).pipe(O(fr(e=>OSe(e.interaction))))}),ASe=(e,t)=>z5(kSe(e),t),jSe=`routine`,MSe=(e,t)=>t.fires===void 0&&e.fires!==void 0?{...t,fires:e.fires}:t,NSe=e=>(t,n)=>t.listRoutines({...n,...e===void 0?{}:{projectId:e}}).pipe(O(e=>k5(e.items.map(e=>({routine:e})),e.nextCursor))),PSe=(e,t)=>e.showRoutine(t).pipe(O(fr(({fires:e,routine:t})=>({fires:e,routine:t})))),FSe=({projectId:e})=>({aggregateType:jSe,carry:MSe,id:({routine:e})=>e.id,inScope:({routine:t})=>e===void 0||t.template.projectId===e,list:NSe(e),revision:({routine:e})=>e.revision,show:PSe}),ISe=(e,t)=>z5(FSe(e),t),LSe={agents:[`agents.list`,`agents.show`],interactions:[`interaction.list`,`interaction.show`],routines:[`routine.list`,`routine.show`]},RSe=(e,t=[])=>{let n=LSe[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(`, `)}.`}},zSe=e=>{let{kind:t}=xS(e,{mutation:!1});return t===`denied`||t===`not_found`||t===`unavailable`?t:`offline`},BSe=`protocol_incompatible`,VSe=e=>{let t=Ek.safeParse(e);return t.success&&t.data.payload.error.code===BSe},HSe=(e,t)=>({request:(n,r)=>e.request(n,r).then(e=>(VSe(e)&&t(),e))}),B5=100,V5=e=>N5(e).pipe(qf(zSe)),USe=e=>h5(e).read().pipe(O(({profile:e})=>e)),WSe=e=>h5(e).read().pipe(O(({instanceId:e})=>e),qf(({reason:e})=>new S5(e===`denied`?`denied`:`offline`))),H5=e=>V5(e).pipe(O(({items:e})=>e)),GSe=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:Xv(r)},payload:o,signal:a})},KSe=(e,t)=>{let n=HSe(e,t);return{client:Oxe(n),request:GSe(Dpe(n))}},qSe=e=>({layer:oSe({client:e,instance:WSe(e)}),projects:H5(t=>e.listProjects({limit:B5},t)),sessions:t=>H5(n=>e.listSessions({limit:B5,projectId:t},n))}),JSe=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})),YSe=e(((e,t)=>{t.exports=JSe()})),XSe=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`})),U5=e(((e,t)=>{t.exports=XSe()})),ZSe=nS(md),QSe=e=>Xf(e,e=>Du(e)?Kp(`A web UI program died.`,e):Af),W5=e=>{let t=ZSe.runCallback(QSe(e));return()=>{t()}},Q=U5(),$Se=(e,t)=>{let[n,r]=(0,Q.useState)();return(0,Q.useEffect)(()=>W5(USe(e).pipe(D(t=>T(()=>{r({client:e,name:t})})),Qf)),[e]),n?.client===e?n.name:t},$=YSe(),eCe={},G5=(0,Q.createContext)(void 0),tCe=({children:e,value:t})=>(0,$.jsx)(G5,{value:t,children:e}),nCe=({children:e,identity:t,references:n=eCe,transport:r})=>{let[i,a]=(0,Q.useState)(!1),o=(0,Q.useMemo)(()=>KSe(r,()=>{a(!0)}),[r]),s=(0,Q.useMemo)(()=>qSe(o.client),[o]),c=$Se(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)(tCe,{value:l,children:e})},K5=()=>{let e=(0,Q.useContext)(G5);if(e===void 0)throw Error(`Render the Maia screens inside <MaiaHost>.`);return e},rCe={"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.`},q5=({what:e})=>(0,$.jsxs)(`p`,{className:`notice`,"data-state":`loading`,role:`status`,children:[`Loading `,e,`…`]}),J5=({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.`})]}),iCe=({reason:e})=>(0,$.jsx)(`p`,{className:`notice`,"data-state":`reloaded`,role:`status`,children:rCe[e]}),aCe=({label:e,limit:t})=>(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the first `,t,` `,e,`. The Node holds more.`]}),Y5=({children:e,label:t,state:n,surface:r})=>{let{references:i}=K5();return n.capability===`loading`?(0,$.jsx)(q5,{what:t}):n.capability===`available`?(0,$.jsxs)(`div`,{"aria-busy":n.refreshing,children:[n.reloaded===!0&&n.reloadReason!==void 0&&(0,$.jsx)(iCe,{reason:n.reloadReason}),n.truncated?(0,$.jsx)(aCe,{label:t,limit:500}):null,e(n)]}):(0,$.jsx)(J5,{fault:n.capability,unavailable:RSe(r,i[r]).text})},oCe={capability:`loading`,generation:0},sCe=Gi(30),cCe=(e,t)=>zf(t,np(sCe).pipe(zf(e.reload()),zf(t),Ep)),lCe=(e,t)=>Mf(function*(){let n=yield*e.make(t);yield*n.load,yield*cCe(n,e.beside?.(n)??Af)}).pipe(gp),X5=e=>{let{reads:t}=K5(),[n,r]=(0,Q.useState)(oCe);return(0,Q.useEffect)(()=>W5(lCe(e,r).pipe(dp(t.layer))),[t,e]),n},Z5=e=>X5((0,Q.useMemo)(()=>({make:t=>ESe({projectId:e},t)}),[e])),uCe=(e,t)=>X5((0,Q.useMemo)(()=>({make:n=>ASe({projectId:e,sessionId:t},n)}),[e,t])),dCe={status:`loading`},Q5=e=>{let[t,n]=(0,Q.useState)(dCe);return(0,Q.useEffect)(()=>W5(e.pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{n(e)})))),[e]),t},fCe=50,pCe=Wi(100),mCe={beside:e=>e.read.pipe(Dp({schedule:ff(pCe),until:({capability:e})=>e!==`loading`}),D(t=>t.capability===`available`?e.reread(t.records.slice(0,fCe).map(({routine:e})=>e.id)):Af),Uf),make:e=>ISe({},e)},$5=()=>X5(mCe),hCe=16,e7=({summary:e,title:t})=>(0,$.jsxs)(`header`,{className:`screen-heading`,children:[(0,$.jsx)(`h1`,{children:t}),(0,$.jsx)(`p`,{className:`lede`,children:e})]}),t7=({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))}),n7=({iso:e})=>(0,$.jsx)(`time`,{dateTime:e,children:e.endsWith(`Z`)?`${e.slice(0,hCe).replace(`T`,` `)} UTC`:e}),gCe=e=>[...e.flat().reduce((e,t)=>e.set(t.id,t),new Map).values()],r7=({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))})]}),i7=({children:e,noun:t})=>{let{reads:n}=K5(),r=Q5(n.projects),[i,a]=(0,Q.useState)();if(r.status===`loading`)return(0,$.jsx)(q5,{what:`Projects`});if(r.status!==`ready`)return(0,$.jsx)(J5,{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)(r7,{choices:r.value.map(({id:e,name:t})=>({id:e,label:t})),label:`Project`,onChange:a,value:s.id})}),e(s.id)]})},_Ce=({children:e,projectId:t})=>{let{reads:n}=K5(),r=Q5((0,Q.useMemo)(()=>n.sessions(t),[n,t])),[i,a]=(0,Q.useState)();if(r.status===`loading`)return(0,$.jsx)(q5,{what:`Sessions`});if(r.status!==`ready`)return(0,$.jsx)(J5,{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)(r7,{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)]})},vCe={cpu:`CPU`,disk:`disk space`,memory:`memory`},a7=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`:vCe[e.resource]}, so nothing ran. Try again once it has room.`,yCe=new Set([`path_invalid`,`repository_invalid`,`routine_event_unknown`,`routine_interval_too_short`,`routine_schedule_invalid`]),o7=(e,t)=>t===void 0?{reason:e}:{code:t,reason:e},s7=e=>o7(`unknown`,e),c7=(e,t)=>t===void 0?{code:e,reason:`invalid`}:{code:e,message:t,reason:`invalid`},bCe=(e,t)=>e!==void 0&&yCe.has(e)?c7(e,t):s7(e),xCe=e=>{if(!(e instanceof W))return s7();let{code:t,kind:n,message:r,resource:i,retryable:a,saturation:o}=xS(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 o7(n,t);case`conflict`:case`not_found`:return{reason:`conflict`};case`offline`:case`outcome_unknown`:return{reason:`offline`};case`invalid`:return t===void 0?s7():c7(t,r);case`refused`:return a?{reason:`offline`}:bCe(t,r);case`cancelled`:case`declined`:return s7(t)}},l7=e=>({...e,status:`failed`}),SCe=`30 seconds`,CCe={reason:`offline`},u7=e=>O(p5(`command`),t=>({commandId:t,input:e})),wCe=(e,t)=>D(p5(`panel`),n=>Of({catch:xCe,try:r=>t({commandId:e,options:{messageId:n,signal:r}})})).pipe(ep({duration:SCe,orElse:()=>E(CCe)})),d7=(e,t)=>op(wCe(e,t),{onFailure:e=>({failure:e,ok:!1}),onSuccess:e=>({ok:!0,value:e})}),TCe=e=>e.ok?{receipt:e.value,status:`done`}:l7(e.failure),ECe=(e,t,n)=>T(()=>{n({attempt:t,state:{status:`running`}})}).pipe(D(()=>d7(t.commandId,n=>e(t.input,n))),D(e=>T(()=>{n({attempt:t,state:TCe(e)})}))),f7=()=>{let e=(0,Q.useRef)(!1);return{busy:()=>e.current,launch:t=>{e.current||(e.current=!0,W5(yp(t,T(()=>{e.current=!1}))))}}},p7={state:{status:`idle`}},m7=e=>{let[t,n]=(0,Q.useState)(p7),{attempt:r,state:i}=t,a=f7(),o=t=>ECe(e,t,n);return{reset:()=>{a.busy()||n(p7)},retry:()=>{r!==void 0&&i.status===`failed`&&a.launch(o(r))},start:e=>{a.launch(D(u7(e),o))},state:i}},DCe=e=>O(u7(e),e=>({attempt:e,stage:`preview`})),OCe=e=>e.stage===`preview`?{status:`previewing`}:{preview:e.preview,status:`confirming`},kCe=(e,t)=>O(d7(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:{...l7(e.failure),stage:`preview`}}),ACe=(e,t,n)=>O(d7(t.commandId,r=>e.confirm(t.input,n,r)),e=>{if(e.ok)return{state:{receipt:e.value,status:`done`}};let r={...l7(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}}),jCe=(e,t)=>t.stage===`preview`?kCe(e,t.attempt):ACe(e,t.attempt,t.preview),MCe=(e,t,n)=>T(()=>{n({held:t,state:OCe(t)})}).pipe(D(()=>jCe(e,t)),D(e=>T(()=>{n(e)}))),h7={state:{status:`idle`}},g7=e=>{let[t,n]=(0,Q.useState)(h7),{held:r,state:i}=t,a=f7(),o=t=>MCe(e,t,n);return{confirm:()=>{r?.stage===`confirm`&&i.status===`previewed`&&a.launch(o(r))},reset:()=>{a.busy()||n(h7)},retry:()=>{r!==void 0&&i.status===`failed`&&a.launch(o(r))},start:e=>{a.launch(D(DCe(e),o))},state:i}},NCe=e=>{let t=e.trim();return t===``?{decision:`deny`}:{decision:`deny`,reason:t}},PCe=e=>{let t=e.trim();return t===``?void 0:{answer:t,decision:`answer`}},FCe=e=>(t,{commandId:n,options:r})=>e.respondToApproval({...t,commandId:n},r),_7=e=>{switch(e){case`command`:return`Command`;case`file_change`:return`File change`;case`question`:return`Question`;case`tool`:return`Tool call`}},v7={answered:`Answered`,approved:`Approved`,cancelled:`Cancelled`,denied:`Denied`,expired:`Expired`,pending:`Waiting`},ICe=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.`]]),y7=e=>e===void 0?void 0:ICe.get(e),LCe=e=>e.reason===`conflict`||e.reason===`unknown`&&y7(e.code)!==void 0,RCe=e=>{switch(e.reason){case`busy`:return a7(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 y7(e.code)??`The Node could not record your answer.`}},zCe=({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]}),BCe=(e,t)=>PCe(e===void 0?t:e.find(({optionId:e})=>e===t)?.label??``),VCe=({busy:e,onChoose:t,options:n})=>{let r=(0,Q.useId)(),[i,a]=(0,Q.useState)(``),o=BCe(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`})})]})},HCe=({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(NCe(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`})})]})},UCe=e=>{switch(e.status){case`done`:return`${v7[e.receipt.approval.status]}.${e.receipt.delivery===`duplicate`?` The Node had already recorded this answer.`:``}`;case`failed`:return RCe(e);case`idle`:return``;case`running`:return`Sending your answer…`}},WCe=({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)(VCe,{busy:i,onChoose:t,options:e.options}):(0,$.jsx)(zCe,{busy:i,forSessionOffered:e.forSessionOffered,onChoose:t}),(0,$.jsx)(HCe,{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:UCe(r)})]})},b7=e=>{let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{e&&t.current?.focus()},[e]),t},GCe=new Map,KCe=4,qCe=({agentDefinitionRef:e,title:t})=>({...e===void 0?{}:{agent:e.key},...t===void 0?{}:{title:t}}),JCe=(e,t)=>Tf(t,t=>V5(n=>e.showSession({sessionId:t},n)).pipe(O(({session:e})=>[[e.id,qCe(e)]]),Wf(()=>w([]))),{concurrency:KCe}).pipe(O(e=>new Map(e.flat()))),YCe=e=>e===``?[]:e.split(` `),XCe=e=>[...new Set(e.map(({sessionId:e})=>e))].toSorted(),ZCe=e=>{let{client:t}=K5(),n=e.join(` `),r=Q5((0,Q.useMemo)(()=>JCe(t,YCe(n)),[t,n]));return r.status===`ready`?r.value:GCe},x7=(e,t)=>e.get(t)?.title??t,S7={status:`loading`},QCe=(e,t)=>V5(n=>e.showApproval({approvalId:t},n)).pipe(op({onFailure:e=>({status:e}),onSuccess:({approval:e})=>({status:`ready`,value:e})})),$Ce=(e,t,n)=>T(()=>{n.emit(S7)}).pipe(zf(QCe(e,t).pipe(D(e=>T(()=>{n.emit(e)})),zf(Ky(n.wakeups)),Ep))),ewe=e=>{let{client:t}=K5(),[n,r]=(0,Q.useState)(S7),i=(0,Q.useMemo)(()=>Bp(zy(1)),[]);return(0,Q.useEffect)(()=>W5($Ce(t,e,{emit:r,wakeups:i})),[e,t,i]),{reload:(0,Q.useCallback)(()=>{Vy(i,`wake`)},[i]),state:n}},C7=(e,t)=>t===void 0?[]:[[e,t]],twe=(e,t)=>[[`From`,x7(t,e.sessionId)],...C7(`Agent`,t.get(e.sessionId)?.agent),[`Runs on`,e.executor],[`Asked`,(0,$.jsx)(n7,{iso:e.createdAt},`asked`)],[`Expires`,(0,$.jsx)(n7,{iso:e.expiresAt},`expires`)],...C7(`Worker's reason`,e.reason)],nwe=e=>e===`node`?`The Node`:e,rwe=({resolution:e,status:t})=>e===void 0?[]:[[`Outcome`,v7[t]],[`Decided by`,nwe(e.actorId)],[`Decided`,(0,$.jsx)(n7,{iso:e.resolvedAt},`decided`)],...C7(`Applies to`,e.forSession===!0?`The rest of this Session`:void 0),...C7(`Reason`,e.reason),...C7(`Answer`,e.answer)],iwe=({approval:e,children:t,focusHeading:n=!1,labels:r})=>{let i=b7(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:_7(e.kind)}),(0,$.jsx)(`p`,{className:`inbox-state`,"data-state":e.status,children:v7[e.status]})]}),(0,$.jsx)(t7,{items:twe(e,r)}),(0,$.jsx)(`h3`,{children:`What it asks`}),(0,$.jsx)(`pre`,{className:`inbox-request`,children:e.summary}),e.status===`pending`?null:(0,$.jsx)(t7,{items:rwe(e)}),t]})},awe=({children:e,state:t})=>t.status===`loading`?(0,$.jsx)(q5,{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)(J5,{fault:t.status,unavailable:`The Node must serve approval.show.`}),owe=({approvalId:e,focusHeading:t=!1,labels:n,onAnswered:r})=>{let{client:i}=K5(),{reload:a,state:o}=ewe(e),s=m7(FCe(i)),c=s.state;return(0,Q.useEffect)(()=>{c.status===`done`&&r(),c.status===`failed`&&LCe(c)&&(a(),r())},[c,r,a]),(0,$.jsx)(awe,{state:o,children:e=>{let r=c.status===`done`?c.receipt.approval:e;return(0,$.jsx)(iwe,{approval:r,focusHeading:t,labels:n,children:(0,$.jsx)(WCe,{approval:r,onChoose:e=>{s.start({...e,approvalId:r.approvalId,requestDigest:r.requestDigest})},onRetry:()=>{s.retry()},state:c})})}})},swe=`A request waits in the Inbox`,cwe=e=>({options:{data:{approvalId:e},tag:e},title:swe}),w7=class extends mr()(`maia/web-ui/BrowserNotifications`){},lwe=({api:e,focus:t})=>(n,r)=>If({catch:()=>`refused`,try:()=>{if(e?.permission!==`granted`)return;let{options:i,title:a}=cwe(n),o=new e(a,i);o.addEventListener(`click`,()=>{t(),o.close(),r()})}}).pipe(Qf),uwe=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:lwe(e)}},dwe=hd(w7,()=>uwe({...typeof Notification>`u`?{}:{api:Notification},focus:()=>{window.focus()}})),T7=e=>W5(dp(e,dwe)),fwe=D(pp(w7),e=>e.permission),pwe=D(pp(w7),e=>e.request),mwe={ids:new Set,seeded:!1},hwe=Mf(function*(){let e=yield*oS(mwe);return(t,n)=>uS(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(w7),t=>t.show(e.approvalId,()=>{n(e)})),{discard:!0})))}),gwe=(e,t)=>{let n=(0,Q.useMemo)(()=>Bp(hwe),[]);(0,Q.useEffect)(()=>e===void 0?void 0:T7(n(e,t)),[n,e,t])},_we=()=>{let[e,t]=(0,Q.useState)(`unsupported`);return(0,Q.useEffect)(()=>T7(fwe.pipe(O(e=>{t(e)}))),[]),{turnOn:(0,Q.useCallback)(()=>{T7(pwe.pipe(O(e=>{t(e)})))},[]),value:e}},vwe=({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,ywe=()=>{let{turnOn:e,value:t}=_we();return(0,$.jsx)(vwe,{onTurnOn:e,permission:t})},E7=Lae,D7={status:`loading`},bwe=(e,t)=>V5(t=>e.listApprovals({limit:E7,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>=E7}})})),O7=(e,t,n)=>bwe(e,n).pipe(D(n=>T(()=>{t.emit(n)}).pipe(zf(rp(np(Gi(10)),Ky(t.wakeups))),zf(()=>O7(e,t,n.status===`ready`?n.value:void 0))))),xwe=(e,t)=>T(()=>{t.emit(D7)}).pipe(zf(O7(e,t))),Swe=()=>{let{client:e}=K5(),[t,n]=(0,Q.useState)(D7),r=(0,Q.useMemo)(()=>Bp(zy(1)),[]);return(0,Q.useEffect)(()=>W5(xwe(e,{emit:n,wakeups:r})),[e,r]),{refresh:(0,Q.useCallback)(()=>{Vy(r,`wake`)},[r]),state:t}},k7=`inbox`,A7=(0,Q.createContext)(void 0),Cwe=({children:e,value:t})=>(0,$.jsx)(A7,{value:t,children:e}),wwe=({children:e,navigate:t})=>{let{refresh:n,state:r}=Swe(),[i,a]=(0,Q.useState)(),o=(0,Q.useCallback)(e=>{a(e),t(k7)},[t]);gwe(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)(Cwe,{value:c,children:e})},Twe=()=>{let e=(0,Q.useContext)(A7);if(e===void 0)throw Error(`Render the Inbox inside <InboxWatch>.`);return e},Ewe={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.`},Dwe=({approval:e,focus:t,labels:n,onSelect:r,selected:i})=>{let a=b7(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:_7(e.kind)}),(0,$.jsx)(`span`,{className:`inbox-state`,"data-state":e.status,children:v7[e.status]})]}),(0,$.jsx)(`span`,{className:`inbox-row-summary`,children:e.summary}),(0,$.jsxs)(`span`,{className:`inbox-row-fact`,children:[`From `,x7(n,e.sessionId),` (`,e.executor,`)`]}),(0,$.jsxs)(`span`,{className:`inbox-row-fact`,children:[`Asked `,(0,$.jsx)(n7,{iso:e.createdAt})]})]})})},Owe=({focusId:e,labels:t,onSelect:n,selectedId:r,state:i})=>{if(i.status===`loading`)return(0,$.jsx)(q5,{what:`requests`});if(i.status!==`ready`)return(0,$.jsx)(J5,{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:Ewe[o]}),s?(0,$.jsxs)(`p`,{className:`notice`,"data-state":`truncated`,role:`status`,children:[`Showing the newest `,E7,` 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)(Dwe,{approval:i,focus:i.approvalId===e,labels:t,onSelect:n,selected:i.approvalId===r},i.approvalId))})]})},kwe=[],Awe=[{id:k7,label:`Inbox`,screen:()=>{let{refresh:e,requested:t,settleRequest:n,state:r}=Twe(),[i,a]=(0,Q.useState)(),[o,s]=(0,Q.useState)(),c=r.status===`ready`?r.value.items:kwe;t!==void 0&&t!==i&&(s(void 0),a(t)),(0,Q.useEffect)(()=>{t!==void 0&&n()},[t,n]);let l=ZCe(XCe(i===void 0?c:[...c,i]));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`What the workers of this Node wait on a person for, read again every 10 seconds.`,title:`Inbox`}),(0,$.jsx)(ywe,{}),(0,$.jsxs)(`div`,{className:`inbox-layout`,"data-view":i===void 0?`list`:`detail`,children:[(0,$.jsx)(`div`,{className:`inbox-list-pane`,children:(0,$.jsx)(Owe,{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)(owe,{approvalId:i.approvalId,focusHeading:!0,labels:l,onAnswered:e},i.approvalId)]})})]})]})}}],jwe=({agent:e})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:e.spec.name}),(0,$.jsx)(t7,{items:[[`State`,e.state],[`Harness`,e.spec.harness],[`Placement`,e.spec.placement],[`Updated`,(0,$.jsx)(n7,{iso:e.updatedAt},`updated`)]]}),(0,$.jsx)(`p`,{className:`excerpt`,children:e.spec.instruction})]}),Mwe=({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)(jwe,{agent:e},e.id))}),Nwe=({state:e})=>(0,$.jsx)(Y5,{label:`agents`,state:e,surface:`agents`,children:Mwe}),Pwe=({projectId:e})=>(0,$.jsx)(Nwe,{state:Z5(e)}),Fwe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The Agents of a Project, as the Node holds them.`,title:`Agents`}),(0,$.jsx)(i7,{noun:`Agents`,children:e=>(0,$.jsx)(Pwe,{projectId:e},e)})]}),Iwe=({interaction:e})=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:e.subject}),(0,$.jsx)(t7,{items:[[`Status`,e.lifecycleStatus],[`Kind`,e.kind],[`Opened`,(0,$.jsx)(n7,{iso:e.createdAt},`opened`)]]}),(0,$.jsx)(`p`,{className:`excerpt`,children:e.body})]}),Lwe=({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)(Iwe,{interaction:e},e.interactionId))}),Rwe=({state:e})=>(0,$.jsx)(Y5,{label:`interactions`,state:e,surface:`interactions`,children:Lwe}),zwe=({projectId:e,sessionId:t})=>(0,$.jsx)(Rwe,{state:uCe(e,t)}),Bwe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The questions and approvals of a Session, as the Node holds them.`,title:`Interactions`}),(0,$.jsx)(i7,{noun:`Interactions`,children:e=>(0,$.jsx)(_Ce,{projectId:e,children:t=>(0,$.jsx)(zwe,{projectId:e,sessionId:t},t)},e)})]}),Vwe=3,Hwe={status:`idle`},j7={pause:`Pause`,resume:`Resume`},M7=new Map,N7=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})`,Uwe=({agentId:e,executor:t})=>t===void 0&&e!==void 0?[]:[[`Executor`,t??`Not set`]],Wwe=({agentId:e},t)=>e===void 0?`None`:t.get(e)??e,Gwe=({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`}},Kwe=e=>{switch(e){case`target_archived`:return`Its target Session is archived.`;case`target_missing`:return`Its target Session is gone.`;default:return e}},qwe=e=>{switch(e.reason){case`busy`:return a7(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.`}},Jwe=({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,Vwe).map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:e.outcome}),` `,(0,$.jsx)(`span`,{children:e.triggerKind}),` `,(0,$.jsx)(n7,{iso:e.recordedAt})]},e.id))}),Ywe=({nextFireAt:e})=>e===void 0?[]:[[`Next fire`,(0,$.jsx)(n7,{iso:e},`next`)]],Xwe=({pausedReason:e,state:t})=>t===`paused`&&e!==void 0?[[`Paused because`,Kwe(e)]]:[],Zwe=(e,t)=>[[`State`,e.state],...Xwe(e),[`Schedule`,N7(e.schedule)],...Ywe(e),[`Agent`,Wwe(e.template,t)],[`Target`,Gwe(e.template)],...Uwe(e.template)],Qwe=e=>{switch(e.status){case`done`:return e.receipt.routine.state===`paused`?`Paused.`:`Resumed.`;case`failed`:return qwe(e);case`running`:return`Sending the change…`;case`idle`:return``}},$we=(e,{revision:t})=>e.status===`done`&&BigInt(e.receipt.routine.revision)<BigInt(t),eTe=({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":`${j7[i]} ${e}`,disabled:n,onClick:()=>{t(i)},type:`button`,children:j7[i]})},tTe=({agentNames:e=M7,fires:t,onChange:n,routine:r,state:i})=>{let a=$we(i,r)?Hwe:i;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:r.name}),(0,$.jsx)(t7,{items:Zwe(r,e)}),(0,$.jsx)(Jwe,{fires:t}),(0,$.jsxs)(`div`,{className:`routine-actions`,children:[(0,$.jsx)(eTe,{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:Qwe(a)})]})]})},P7=[X.claudeCode,X.codex],F7=128,nTe=/^[0-9A-Za-z*/,-]{1,64}(?: [0-9A-Za-z*/,-]{1,64}){4}$/u,I7=/^[A-Za-z][A-Za-z0-9_+-]*(?:\/[A-Za-z0-9_+-]+){0,2}$/u,rTe=64,iTe=()=>{let{timeZone:e}=new Intl.DateTimeFormat().resolvedOptions();return I7.test(e)?e:`UTC`},L7=()=>({agentId:``,eventKind:``,executor:X.claudeCode,expression:``,mode:`new`,name:``,paused:!1,prompt:``,scheduleKind:`cron`,timezone:iTe()}),aTe=e=>e===``?`Enter a name.`:e.length>F7?`Use at most ${F7} characters.`:void 0,oTe=e=>e===``?`Enter a prompt.`:void 0,sTe=e=>P7.includes(e)?void 0:`Choose an executor.`,cTe=e=>nTe.test(e)?void 0:`Enter five fields separated by spaces, such as 0 9 * * 1-5.`,lTe=e=>e.length<=rTe&&I7.test(e)?void 0:`Enter a time zone name, such as Europe/Paris or UTC.`,uTe=e=>e===``?`Enter an event kind, such as session.stopped.`:_le(e)===void 0?`Unknown event kind. Use a kind the Node records, such as session.stopped.`:void 0,dTe=e=>e.trim().replaceAll(/\s+/gu,` `),fTe=e=>({...e,eventKind:e.eventKind.trim(),expression:dTe(e.expression),name:e.name.trim(),prompt:e.prompt.trim(),timezone:e.timezone.trim()}),pTe=e=>e.scheduleKind===`cron`?[[`expression`,cTe(e.expression)],[`timezone`,lTe(e.timezone)]]:[[`eventKind`,uTe(e.eventKind)]],mTe=e=>e.agentId===``?[[`executor`,sTe(e.executor)]]:[],hTe=e=>[[`name`,aTe(e.name)],...mTe(e),[`prompt`,oTe(e.prompt)],...pTe(e)],gTe=e=>e[1]!==void 0,_Te=e=>e.scheduleKind===`cron`?{expression:e.expression,timezone:e.timezone}:{event:e.eventKind},vTe=(e,t)=>e.agentId===``?{executor:e.executor,projectId:t,prompt:e.prompt}:{agentId:e.agentId,mode:e.mode,projectId:t,prompt:e.prompt},yTe=(e,t)=>t.includes(e.agentId)?e:{...e,agentId:``},bTe=(e,t)=>{let n=fTe(e),r=Object.fromEntries(hTe(n).filter(gTe));return Object.keys(r).length>0?{errors:r,ok:!1}:{draft:{name:n.name,...n.paused?{paused:!0}:{},schedule:_Te(n),template:vTe(n,t)},ok:!0}},xTe=F([N({expression:j,timezone:j}),N({event:j}),N({at:j}),N({everyMinutes:ty,startsAt:j})]),STe=N({items:P(N({eventId:k(j),failureReason:k(j),id:j,missed:k(ty),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)}),CTe=(e,t,n)=>e({method:`routine.runs`,parameters:t,result:STe},n),wTe=N({expiresAt:j,inputDigest:j,method:A(`routine.create.preview`),name:j,nextFires:P(j),proof:j,routineId:j,schedule:xTe}),TTe=N({delivery:I([`new`,`duplicate`]),method:A(`routine.create.confirm`),routine:N({id:j,name:j,state:I([`active`,`disabled`,`paused`])})}),ETe=(e,t,n)=>e({method:`routine.create.preview`,parameters:{...t,commandId:n.commandId},result:wTe},n.options),DTe=(e,{draft:t,preview:n},r)=>e({method:`routine.create.confirm`,parameters:{...t,commandId:r.commandId,inputDigest:n.inputDigest,proof:n.proof},result:TTe},r.options),OTe=[{kind:`cron`,label:`Cron`},{kind:`event`,label:`Event`}],kTe=[{label:`New Session per run`,mode:`new`},{label:`Agent's home Session`,mode:`continue`}],ATe={agents:[],failed:!1},jTe={},R7=`Fix the marked fields, then preview again.`,z7={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.`},MTe=e=>{switch(e.reason){case`busy`:return a7(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 z7[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:z7[e.code])??`The Node could not create the Routine.`}},B7=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,NTe=(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?R7:MTe(e);case`idle`:return t?R7:``;case`previewed`:return`Preview ready. Review it, then create the Routine.`;case`previewing`:return`Asking the Node for a preview…`}},PTe=()=>{let{activeElement:e,body:t}=document;return e===null||e===t||e.matches(`:disabled`)},V7=e=>{let t=(0,Q.useRef)(null),n=(0,Q.useRef)(e);return(0,Q.useEffect)(()=>{n.current!==e&&(n.current=e,PTe()&&t.current?.focus())},[e]),(0,Q.useCallback)(e=>{t.current=e},[])},H7=e=>({confirm:(t,n,r)=>DTe(e,{draft:t,preview:n},r),preview:(t,n)=>ETe(e,t,n)}),U7=({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})]})},W7=({error:e,hint:t,id:n,inputRef:r,label:i,onChange:a,value:o})=>(0,$.jsx)(U7,{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})}),FTe=({errors:e,form:t,onChange:n})=>t.scheduleKind===`cron`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(W7,{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)(W7,{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)(W7,{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}),ITe=({onChange:e,value:t})=>(0,$.jsxs)(`fieldset`,{className:`routine-group`,children:[(0,$.jsx)(`legend`,{children:`Schedule`}),OTe.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))]}),LTe=({error:e,onChange:t,value:n})=>(0,$.jsx)(U7,{error:e,id:`routine-executor`,label:`Executor`,children:e=>(0,$.jsx)(`select`,{...e,onChange:e=>{t({executor:e.currentTarget.value})},value:n,children:P7.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})}),RTe=({agents:e,onChange:t,value:n})=>(0,$.jsx)(U7,{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))]})}),zTe=({onChange:e,value:t})=>(0,$.jsxs)(`fieldset`,{className:`routine-group`,children:[(0,$.jsx)(`legend`,{children:`Target`}),kTe.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))]}),BTe=({agents:e,errors:t,form:n,onChange:r})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(RTe,{agents:e,onChange:r,value:n.agentId}),n.agentId===``?(0,$.jsx)(LTe,{error:t.executor,onChange:r,value:n.executor}):(0,$.jsx)(zTe,{onChange:r,value:n.mode})]}),VTe=({error:e,onChange:t,value:n})=>(0,$.jsx)(U7,{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})}),HTe=({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)(W7,{error:n.name,id:`routine-name`,inputRef:r,label:`Name`,onChange:e=>{a({name:e})},value:i.name}),(0,$.jsx)(BTe,{agents:e,errors:n,form:i,onChange:a}),(0,$.jsx)(VTe,{error:n.prompt,onChange:a,value:i.prompt}),(0,$.jsx)(ITe,{onChange:a,value:i.scheduleKind}),(0,$.jsx)(FTe,{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`})})]}),UTe=({preview:e})=>{let{schedule:t}=e;return`event`in t?`Fires on each ${t.event} event`:N7(t)},WTe=({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)(n7,{iso:e})},e))})]}),GTe=({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)(t7,{items:[[`Name`,i.name],[`Routine ID`,i.routineId],[`Schedule`,(0,$.jsx)(UTe,{preview:i},`schedule`)],[`Expires`,(0,$.jsx)(n7,{iso:i.expiresAt},`expires`)]]}),(0,$.jsx)(WTe,{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`})]})]})},G7=e=>e.status===`done`?`done`:B7(e)===void 0?`form`:`preview`,KTe=e=>e.status===`failed`?`${G7(e)} failed`:G7(e),qTe=({agents:e,errors:t,focusRef:n,form:r,onAnother:i,onBack:a,onChange:o,onConfirm:s,onPreview:c,onRetry:l,state:u})=>{let d=B7(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)(HTe,{agents:e,busy:u.status===`previewing`,errors:t,focusRef:n,form:r,onChange:o,onPreview:c}):(0,$.jsx)(GTe,{focusRef:n,onBack:a,onConfirm:s,onRetry:l,preview:d,state:u})},JTe=e=>{let t=V7(KTe(e.state));return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(qTe,{...e,focusRef:t}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`routine-status`,"data-status":e.state.status,role:`status`,children:NTe(e.state,Object.keys(e.errors).length>0)})]})},YTe=(e,t)=>V5(n=>e.listAgents({limit:yB,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}))),XTe=e=>{let{client:t}=K5(),n=Q5((0,Q.useMemo)(()=>YTe(t,e),[t,e]));return n.status===`ready`&&n.value.projectId===e?n.value:ATe},ZTe=({projectId:e})=>{let{request:t}=K5(),n=g7(H7(t)),[r,i]=(0,Q.useState)(L7),[a,o]=(0,Q.useState)(!1),s=XTe(e),c=yTe(r,s.agents.map(({id:e})=>e)),l=bTe(c,e);return(0,$.jsx)(JTe,{agents:s,errors:a&&!l.ok?l.errors:jTe,form:c,onAnother:()=>{n.reset(),i(L7()),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})},QTe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`Preview a Routine on this Node, then create it.`,title:`New routine`}),(0,$.jsx)(i7,{noun:`Routines`,children:e=>(0,$.jsx)(ZTe,{projectId:e})})]}),K7=`vllnt.routine/v1`,$Te=`Europe/Paris`,eEe=65536,q7=(e,t)=>E({code:e,message:t}),J7=e=>q7(`file_invalid`,e),tEe=/^\p{Cf}$/u,nEe=new Set([8204,8205]),rEe=e=>{let t=e.codePointAt(0)??0;return t<=31||t>=127&&t<=159||t===8232||t===8233||tEe.test(e)&&!nEe.has(t)},Y7=e=>Array.from(e,e=>rEe(e)?`�`:e).join(``),iEe=/^(?:[01]\d|2[0-3]):[0-5]\d$/u,aEe=N({argv:P(j).check(gy(1)),name:j,timeoutS:k(ty)}).pipe(ry({timeoutS:`timeout_s`})),oEe=N({baseUrl:k(j),cli:I([`claude`,`codex`]),effort:j,keyFile:j,model:j,timeoutS:k(ty)}).pipe(ry({baseUrl:`base_url`,keyFile:`key_file`,timeoutS:`timeout_s`})),sEe=N({event:k(j),everyMinutes:k(V.check(B({maximum:1440,minimum:5}))),times:k(P(j.check(R(iEe))).check(gy(1))),timezone:k(j)}).pipe(ry({everyMinutes:`every_minutes`})),cEe=N({enabled:k(M),engine:oEe,gate:k($v),goal:j,host:j,id:j.check(R(/^[a-z0-9-]{2,48}$/u)),maia:k($v),output:k($v),owner:k($v),promptFile:j.check(R(/^(?!\.\.?$)[^/\\]+$/u)),schedule:sEe,schema:A(K7),tools:k(N({agent:k(P($v)),collect:k(P(aEe)),mcp:k(P($v))}))}).pipe(ry({promptFile:`prompt_file`})),lEe=Yv(gne($v)),uEe=Yv(cEe,{onExcessProperty:`error`}),dEe=Cee({checkHook:()=>`invalid value`,leafHook:({_tag:e})=>e}),fEe=({issues:e})=>e.slice(0,3).map(({message:e,path:t=[]})=>[...t.map(e=>String(typeof e==`object`?e.key:e)),e].join(` `)).map(Y7).join(`; `),pEe=e=>D(Wf(lEe(e),()=>J7(`The file is not valid JSON.`)),e=>Wf(uEe(e),({issue:e})=>J7(`The file is not a ${K7} routine: ${fEe(dEe(e))}.`))),mEe=`.json`,hEe=(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?q7(`tools_unsupported`,`Maia grants no per-routine agent or mcp tools; the executor and Agent policy govern them.`):w(e):J7(`The schedule must give exactly one of times, every_minutes or event.`):J7(`The routine id must equal the file name ${Y7(t)}.`)},gEe=(e,t)=>D(pEe(e),e=>hEe(e,t.endsWith(mEe)?t.slice(0,-5):t)),X7=e=>[...new Set(e)].sort((e,t)=>e-t),_Ee=e=>{let t=X7(e.map(e=>Number(e.slice(0,2)))),n=X7(e.map(e=>Number(e.slice(3))));return n.length===1||t.length===1?`${n.join(`,`)} ${t.join(`,`)} * * *`:void 0},vEe=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)} * * *`},yEe=({everyMinutes:e,times:t})=>t===void 0?e===void 0?void 0:vEe(e):_Ee(t),bEe=e=>{let{event:t,timezone:n=$Te}=e;if(t!==void 0)return w({event:t});let r=yEe(e);return r===void 0?q7(`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})},Z7=({tools:e})=>e?.collect??[],xEe=(e,t)=>{let n=Z7(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})=>`- ${Y7(t)}: ${Y7(e.join(` `))}`)].join(`
|
|
20
|
+
`)].filter(e=>e!==``).join(`
|
|
21
|
+
|
|
22
|
+
`)},SEe=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]:[]),CEe=e=>{let t=new TextEncoder().encode(e).length;return t>16384?q7(`prompt_too_large`,`The prompt is ${String(t)} bytes; a turn takes at most ${String(tM)}.`):Af},wEe=(e,t,{projectId:n})=>Mf(function*(){let r=xEe(e,t);yield*CEe(r);let i=yield*bEe(e.schedule);return{collect:Z7(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:SEe(e)}}),Q7=`.json`,TEe=[`active`,`paused`],$7=`unreadable`,EEe=e=>e.size>65536?E($7):Of({catch:()=>$7,try:()=>e.text()}),DEe=e=>op(EEe(e),{onFailure:()=>({name:e.name}),onSuccess:t=>({name:e.name,text:t})}),OEe=e=>wf(e.map(DEe)),kEe=(e,t)=>e===`any`||e===t?Af:q7(`host_mismatch`,`Runs on host ${Y7(e)}; import it on that Node or set host to any.`),AEe=e=>e.endsWith(Q7)?e.slice(0,-5):e,jEe=({chosen:e,file:t,index:n},{nodeLabel:r,projectId:i})=>Mf(function*(){if(n>=50)return yield*q7(`file_invalid`,`An import takes at most 50 routine files; import the rest in another batch.`);if(t.text===void 0)return yield*q7(`file_invalid`,`The file must be UTF-8 text of at most ${String(eEe)} bytes.`);let a=yield*gEe(t.text,t.name),o=e.find(({name:e})=>e===a.promptFile)?.text;if(o===void 0)return yield*q7(`prompt_missing`,`The prompt file ${Y7(a.promptFile)} is not among the selected files, or cannot be read.`);let s=yield*wEe(a,o,{projectId:i});return yield*kEe(s.host,r),s}),MEe=(e,t)=>op(jEe(e,t),{onFailure:t=>({file:e.file.name,kind:`refused`,name:AEe(e.file.name),refusal:t}),onSuccess:t=>({file:e.file.name,kind:`ready`,mapped:t,name:t.draft.name})}),NEe=(e,t)=>wf(e.filter(({name:e})=>e.endsWith(Q7)).map((n,r)=>MEe({chosen:e,file:n,index:r},t))),e9=(e,t)=>[...new Set([...Object.keys(e),...Object.keys(t)])].every(n=>e[n]===t[n]),PEe=(e,t)=>e9(e.schedule,t.schedule)&&e9({...e.template,mode:e.template.mode??`new`},{...t.template,mode:`new`}),FEe=(e,t)=>V5(n=>e.listRoutines({...t,limit:100},n)).pipe(O(({items:e})=>e)),IEe=(e,t)=>wf(TEe.map(n=>FEe(e,{projectId:t,state:n}))).pipe(O(e=>new Map(e.flat().map(e=>[e.name,e])))),t9=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.`]]),LEe=(e,t)=>{switch(t.reason){case`busy`:return a7(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 t9.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:t9.get(t.code))??`The Node could not import ${e}.`}},REe=(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 LEe(e,t);case`idle`:return``;case`previewed`:return`Preview ready for ${e}. Check the next fires, then confirm.`;case`previewing`:return`Previewing ${e}…`}},zEe=({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)(n7,{iso:e})},e))}),BEe=(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}`}}},VEe=({draft:e,handle:t})=>{let n=V7(t.state.status),r=BEe(e,t);return(0,$.jsxs)($.Fragment,{children:[t.state.status===`previewed`||t.state.status===`confirming`?(0,$.jsx)(zEe,{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:REe(e.name,t.state)})]})]})},HEe=({draft:e})=>{let{request:t}=K5(),n=g7(H7(t));return(0,$.jsx)(VEe,{draft:e,handle:n})},UEe=({draft:e,live:t})=>{let n=t.get(e.name);return n===void 0?(0,$.jsx)(HEe,{draft:e}):PEe(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.`})},WEe=({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`,N7(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)(t7,{items:s}),(0,$.jsx)(UEe,{draft:r,live:t})]})},GEe=({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)(WEe,{entry:e,live:t})]},e.file))}),KEe=({files:e,projectId:t})=>{let{client:n,identity:r}=K5(),{label:i}=r,a=(0,Q.useMemo)(()=>D(OEe(e),e=>NEe(e,{nodeLabel:i,projectId:t})),[e,i,t]),o=(0,Q.useMemo)(()=>IEe(n,t),[n,t]),s=Q5(a),c=Q5(o);return c.status===`loading`||s.status===`loading`?(0,$.jsx)(q5,{what:`the selected files`}):c.status===`ready`?s.status===`ready`?(0,$.jsx)(GEe,{entries:s.value,live:c.value}):(0,$.jsx)(q5,{what:`the selected files`}):(0,$.jsx)(J5,{fault:c.status,unavailable:`The Node must serve routine.list.`})},qEe=(e,t)=>({files:t,number:e.number+1}),JEe={files:[],number:0},YEe=({projectId:e})=>{let[t,n]=(0,Q.useState)(JEe),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=>qEe(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)(KEe,{files:t.files,projectId:e},t.number)]})},XEe=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`Bring routine files into a Project on this Node.`,title:`Import routines`}),(0,$.jsx)(i7,{noun:`Routines`,children:e=>(0,$.jsx)(YEe,{projectId:e},e)})]}),ZEe=(e,t)=>BigInt(e.revision)>BigInt(t.revision),n9=()=>{let{client:e}=K5();return m7(({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)})},QEe=(e,t)=>{let[n,r]=(0,Q.useState)();return t.status===`done`&&t.receipt.routine!==n&&r(t.receipt.routine),n!==void 0&&ZEe(n,e)?n:e},r9=e=>[...new Set(e)].toSorted(),$Ee=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))}},eDe=(e,{agentIds:t,projectIds:n})=>wf(n.map(n=>V5(t=>e.listAgents({limit:yB,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(` `),tDe=e=>{let{client:t}=K5(),n=$Ee(e),r=n.agentIds.join(` `),i=n.projectIds.join(` `),a=Q5((0,Q.useMemo)(()=>eDe(t,{agentIds:i9(r),projectIds:i9(i)}),[r,t,i]));return a.status===`ready`?a.value:M7},nDe=({agentNames:e,record:t})=>{let{start:n,state:r}=n9(),i=QEe(t.routine,r);return(0,$.jsx)(tTe,{agentNames:e,fires:t.fires,onChange:e=>{n({action:e,expectedRevision:i.revision,routineId:i.id})},routine:i,state:r})},rDe=({records:e})=>{let t=tDe(e);return(0,$.jsx)(`ul`,{className:`records`,children:e.map(e=>(0,$.jsx)(nDe,{agentNames:t,record:e},e.routine.id))})},iDe=({records:e})=>e.length===0?(0,$.jsx)(`p`,{className:`empty`,children:`No Routines on this Node yet.`}):(0,$.jsx)(rDe,{records:e}),aDe=({state:e})=>(0,$.jsx)(Y5,{label:`routines`,state:e,surface:`routines`,children:iDe}),oDe=()=>{let e=$5();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The Routines of this Node, when each runs next and its latest runs.`,title:`Routines`}),(0,$.jsx)(aDe,{state:e})]})},a9={status:`loading`},sDe=e=>{let{code:t,kind:n}=xS(e,{mutation:!1});return n===`unavailable`||t===`frame_invalid`?`unavailable`:n===`denied`?`denied`:`offline`},cDe=(e,t)=>N5(n=>CTe(e,t===void 0?{limit:50}:{limit:50,routineId:t},n)).pipe(qf(sDe),D(e=>nee.pipe(O(t=>({items:e.items,truncated:e.nextCursor!==void 0,updatedAt:gm(t)}))))),lDe=(e,t,n)=>T(()=>{n(a9)}).pipe(zf(cDe(e,t).pipe(op({onFailure:e=>({status:e}),onSuccess:e=>({status:`ready`,value:e})}),D(e=>T(()=>{n(e)})),zf(np(Gi(10))),Ep))),uDe=e=>{let{request:t}=K5(),[n,r]=(0,Q.useState)(a9);return(0,Q.useEffect)(()=>W5(lDe(t,e,r)),[t,e]),n},o9=``,dDe=11,fDe=19,s9=(e,t)=>t===void 0?[]:[[e,String(t)]],pDe=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)(n7,{iso:e.scheduledAt},`scheduled`)],[`Recorded`,(0,$.jsx)(n7,{iso:e.recordedAt},`recorded`)],...s9(`Session`,e.sessionId)],mDe=({name:e,run:t})=>(0,$.jsxs)(`li`,{className:`run`,"data-outcome":t.outcome,children:[(0,$.jsx)(`p`,{className:`run-routine`,children:e}),(0,$.jsx)(t7,{items:pDe(t)})]}),hDe=({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))]})]})}),gDe=({state:e})=>(0,$.jsx)(`p`,{className:`runs-status`,children:e.status===`ready`?`Updated ${e.value.updatedAt.slice(dDe,fDe)} UTC`:``}),_De=({choices:e,state:t})=>{if(t.status===`loading`)return(0,$.jsx)(q5,{what:`runs`});if(t.status!==`ready`)return(0,$.jsx)(J5,{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)(mDe,{name:i.get(e.routineId)??e.routineId,run:e},e.id))})]})},vDe=({choices:e,onFilter:t,routineId:n,state:r})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(hDe,{choices:e,onChange:t,value:n}),(0,$.jsx)(gDe,{state:r}),(0,$.jsx)(_De,{choices:e,state:r})]}),yDe=[{id:`routines`,label:`Routines`,screen:oDe},{id:`routine-runs`,label:`Runs`,screen:()=>{let[e,t]=(0,Q.useState)(o9),n=$5(),r=uDe(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)(e7,{summary:`The newest runs of the Routines on this Node, read again every 10 seconds.`,title:`Runs`}),(0,$.jsx)(vDe,{choices:i,onFilter:t,routineId:e,state:r})]})}},{id:`routine-new`,label:`New routine`,screen:QTe},{id:`import-routines`,label:`Import`,screen:XEe}],bDe=3,xDe=({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,bDe).map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:e.outcome}),` `,(0,$.jsx)(`span`,{children:e.triggerKind}),` `,(0,$.jsx)(n7,{iso:e.recordedAt})]},e.id))})},SDe=({record:e})=>{let{routine:t}=e;return(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`h2`,{children:t.name}),(0,$.jsx)(t7,{items:[[`State`,t.state],[`Schedule`,N7(t.schedule)],[`Executor`,t.template.executor]]}),(0,$.jsx)(xDe,{record:e})]})},CDe=({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)(SDe,{record:e},e.routine.id))}),wDe=({state:e})=>(0,$.jsx)(Y5,{label:`routines`,state:e,surface:`routines`,children:CDe}),TDe=()=>(0,$.jsx)(wDe,{state:$5()}),EDe=[{id:`agents`,label:`Agents`,screen:Fwe},{id:`routines`,label:`Routines`,screen:()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The Routines of this Node and their latest runs.`,title:`Routines`}),(0,$.jsx)(TDe,{})]})},{id:`interactions`,label:`Interactions`,screen:Bwe}],DDe=131072,ODe=(e,t,n)=>e.showGoal({sessionId:t},n),kDe=(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)}},ADe=(e,t)=>V5(n=>ODe(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(DDe)}.`:void 0},jDe={status:`loading`},MDe=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},NDe=(e,t)=>{let{client:n}=K5(),[r,i]=(0,Q.useState)();return(0,Q.useEffect)(()=>W5(ADe(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:jDe},PDe=e=>{let{client:t}=K5(),n=m7((n,r)=>kDe(t,{change:n,sessionId:e},r)),[r,i]=(0,Q.useState)(0);return{change:n,goal:NDe(e,MDe(n.state)+r),reload:()=>{i(r+1)}}},FDe={"goal.clear":`Goal cleared.`,"goal.set":`Goal set.`,"goal.update":`Goal updated.`},IDe={denied:`Not allowed`,not_found:`Not found`,offline:`Node not answering`,unavailable:`Not on this Node yet`},LDe={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.`},RDe=e=>{switch(e.reason){case`busy`:return a7(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.`}},zDe=e=>{switch(e.status){case`done`:return FDe[e.receipt.method];case`failed`:return RDe(e);case`idle`:return``;case`running`:return`Saving the goal…`}},BDe=({fault:e,onReload:t})=>(0,$.jsxs)(`div`,{className:`notice`,"data-state":e,role:`status`,children:[(0,$.jsx)(`p`,{className:`notice-title`,children:IDe[e]}),(0,$.jsx)(`p`,{children:LDe[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`})]})]})},VDe=({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`})]}),HDe=({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`})]}),UDe=({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)(t7,{items:[[`Revision`,t.revision],[`Set`,(0,$.jsx)(n7,{iso:t.setAt},`set`)]]}),n===`clear`?(0,$.jsx)(VDe,{busy:e,onClear:()=>{r({expectedRevision:t.revision,kind:`clear`})},onKeep:()=>{i(`view`)}}):(0,$.jsx)(HDe,{busy:e,onMode:i})]}),WDe=({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,GDe=({change:e,goal:t,mode:n,onChange:r,onMode:i,onReload:a})=>{if(t.status===`loading`)return(0,$.jsx)(q5,{what:`goal`});if(t.status!==`ready`)return(0,$.jsx)(BDe,{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)(UDe,{busy:o,goal:s,mode:e.status===`done`?`view`:n,onChange:r,onMode:i})},KDe=e=>(0,$.jsxs)(`section`,{className:`goal`,children:[(0,$.jsx)(`h2`,{children:`Goal`}),(0,$.jsx)(GDe,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`goal-status`,"data-status":e.change.status,role:`status`,children:zDe(e.change)}),(0,$.jsx)(WDe,{change:e.change,onReload:e.onReload,onRetry:e.onRetry})]}),qDe=({sessionId:e})=>{let{change:t,goal:n,reload:r}=PDe(e),[i,a]=(0,Q.useState)(`view`);return(0,$.jsx)(KDe,{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()}})},JDe=({sessionId:e})=>(0,$.jsx)(qDe,{sessionId:e},e),YDe=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(tM)}.`:void 0},XDe={"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.`},ZDe={"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.`},QDe={duplicate:`Duplicate: the Node had already taken this steer`,new:`New`},$De=e=>{switch(e.reason){case`busy`:return a7(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.`}},eOe=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,tOe=e=>{switch(e.status){case`confirming`:return`Sending the steer…`;case`done`:return ZDe[e.receipt.path];case`failed`:return $De(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…`}},nOe=({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)(t7,{items:[[`Turn`,r.turnId],[`Valid until`,(0,$.jsx)(n7,{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:XDe[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`})]})]})},rOe=({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`})})]})},iOe=({onAgain:e,result:t})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(t7,{items:[[`Delivery`,QDe[t.delivery]],[`Turn`,t.turn.id]]}),(0,$.jsx)(`div`,{className:`steer-actions`,children:(0,$.jsx)(`button`,{onClick:e,type:`button`,children:`Steer again`})})]}),aOe=({initial:e,onAgain:t,onBack:n,onConfirm:r,onPreview:i,onRetry:a,state:o})=>{let s=eOe(o);return o.status===`done`?(0,$.jsx)(iOe,{onAgain:t,result:o.receipt}):s===void 0?(0,$.jsx)(rOe,{busy:o.status===`previewing`,initial:e,onPreview:i}):(0,$.jsx)(nOe,{onBack:n,onConfirm:r,onRetry:a,preview:s,state:o})},oOe=e=>(0,$.jsxs)(`section`,{className:`steer`,children:[(0,$.jsx)(aOe,{...e}),(0,$.jsx)(`p`,{className:`steer-status`,"data-status":e.state.status,role:`status`,children:tOe(e.state)})]}),sOe=(e,t,n)=>e.status===`idle`?t:n,cOe=({onDone:e,sessionRevision:t,turnId:n})=>{let{client:r}=K5(),i=g7(YDe(r)),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)();(0,Q.useEffect)(()=>{i.state.status===`done`&&e()},[e,i.state]);let l=sOe(i.state,n,s);return l===void 0?null:(0,$.jsx)(oOe,{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})},lOe=({onDone:e,sessionId:t,sessionRevision:n,turnId:r})=>(0,$.jsx)(cOe,{onDone:e,sessionRevision:n,...r===void 0?{}:{turnId:r}},t),uOe=(e,t)=>({expectedRevision:n,text:r},{commandId:i,options:a})=>e.sendTurn({commandId:i,expectedRevision:n,input:{text:r,type:`text`},sessionId:t},a),dOe={turn_queue_full:`The Session already holds as many turns as it may. Wait for one to finish, then send again.`},fOe=e=>{switch(e.reason){case`busy`:return a7(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:dOe[e.code])??`The Node could not take the message.`}},pOe=(e,t,n)=>{switch(e.status){case`done`:return`Sent.`;case`failed`:return fOe(e);case`idle`:return t?``:`This Session is ${n}. It takes messages while it runs.`;case`running`:return`Sending the message…`}},mOe=new TextEncoder,f9=e=>e.status===`failed`&&e.reason===`offline`,hOe=({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:pOe(i,e,r)})]}),gOe=({accepting:e,draft:t,onDraft:n,onRetry:r,onSend:i,sessionState:a,state:o})=>{let s=(0,Q.useId)(),c=o.status===`running`,l=mOe.encode(t).byteLength>tM;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 `,tM,` 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)(hOe,{accepting:e,id:`${s}-status`,onRetry:r,sessionState:a,state:o})]})]})},_Oe=(e,t)=>e===t?``:e,vOe=({refresh:e,runningTurnId:t,session:n})=>{let{client:r}=K5(),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(),{retry:u,start:d,state:f}=m7(uOe(r,n.id));return(0,Q.useEffect)(()=>{f.status===`done`&&e()},[e,f]),f.status===`done`&&f.receipt!==c&&(l(f.receipt),a(_Oe(i,o))),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(gOe,{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)(lOe,{onDone:e,sessionId:n.id,sessionRevision:n.revision,...t===void 0?{}:{turnId:t}})]})]})},p9=`board.tasks.list`,yOe=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)}),bOe=(e,t)=>({status:`ready`,value:{asOf:t,byHolder:Map.groupBy(e,({holderSessionId:e})=>e)}}),m9=`${p9} is not on this Node.`,xOe=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},SOe=(e,t,n)=>e({method:p9,parameters:{held:!0,projectId:t},result:yOe},n).catch(xOe),COe=(e,t)=>V5(n=>SOe(e,t,n)).pipe(cp({onFailure:e=>w({status:e}),onSuccess:({items:e})=>Td.pipe(O(t=>bOe(e,t)))})),h9=(e,t)=>e.status===`ready`?{asOf:e.value.asOf,items:e.value.byHolder.get(t)??[],status:`ready`}:{status:e.status},wOe=(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}),TOe=e=>`${String(e)} ${e===1?`task`:`tasks`} held`,EOe=({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:TOe(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]})},DOe=({asOf:e,task:t})=>wOe(t,e)?`Lease expired`:(0,$.jsxs)($.Fragment,{children:[`Lease until `,(0,$.jsx)(n7,{iso:t.claim.leaseExpiresAt})]}),OOe=({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)(DOe,{asOf:e.asOf,task:t})})]},t.id))}):(0,$.jsx)(`p`,{className:`notice`,"data-state":e.status,role:`status`,children:g9[e.status]}),kOe=({sessionId:e,tasks:t})=>(0,$.jsxs)(`section`,{className:`session-tasks`,children:[(0,$.jsx)(`h2`,{children:`Held tasks`}),(0,$.jsx)(OOe,{tasks:h9(t,e)})]}),AOe={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`},jOe=(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:jOe(e,t)}),MOe=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…`}},NOe=({turn:e})=>{let t=MOe(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:AOe[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})]})},POe=({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)(n7,{iso:e.createdAt})]}),(0,$.jsx)(`p`,{className:`turn-text`,children:e.input.text})]}),(0,$.jsx)(NOe,{turn:e})]}),FOe=({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)(POe,{turn:e},e.id))})})]}),b9=(e,t)=>e===`denied`||e===`unavailable`?30:t,IOe=32,LOe=4,x9={status:`loading`},ROe={cursor:`0`,due:new Set,ids:[],pruned:!1,turns:new Map},zOe=e=>`turnId`in e.payload?[e.payload.turnId]:[],BOe=(e,t)=>{let n=t.items.flatMap(zOe);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])),VOe=(e,t)=>Tf(t,t=>V5(n=>e.showTurn({turnId:t},n)).pipe(op({onFailure:()=>[],onSuccess:({turn:e})=>[e]})),{concurrency:LOe}).pipe(O(e=>S9(e.flat()))),HOe={partial:!0},C9=({ids:e})=>e.slice(-50),UOe=(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]}))}},WOe=e=>C9(e).map(t=>e.turns.get(t)??{id:t,state:`unavailable`}),GOe=(e,t,n)=>{let r=WOe(t),i=n?void 0:r.findLast(({state:e})=>e===`running`)?.id;return{...n?HOe:{},pruned:t.pruned,...i===void 0?{}:{runningTurnId:i},session:e,total:t.ids.length,turns:r}},KOe=(e,t)=>Mf(function*(){let n=yield*sS(e.known),r=UOe(n,yield*VOe(e.client,C9(n).filter(e=>n.due.has(e))));yield*cS(e.known,r);let{session:i}=yield*V5(t=>e.client.showSession({sessionId:e.sessionId},t)),a=GOe(i,r,t);yield*cS(e.known,{...r,shown:a}),yield*T(()=>{e.emit({status:`ready`,value:a})})}),w9=e=>Mf(function*(){let t=yield*sS(e.known),n=yield*V5(n=>e.client.listSessionEvents({afterSessionCursor:t.cursor,limit:IOe,sessionId:e.sessionId},n));yield*cS(e.known,BOe(t,n));let r=n.nextSessionCursor!==void 0;(!r||t.shown===void 0)&&(yield*KOe(e,r)),r&&(yield*w9(e))}),qOe=e=>w9(e).pipe(cp({onFailure:t=>sS(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)})),JOe=e=>qOe(e).pipe(D(t=>rp(np(Gi(t)),Ky(e.wakeups))),Ep),YOe=(e,t,n)=>T(()=>{n.emit(x9)}).pipe(zf(oS(ROe)),D(r=>JOe({...n,client:e,known:r,sessionId:t}))),XOe=e=>{let{client:t}=K5(),[n,r]=(0,Q.useState)(x9),i=(0,Q.useMemo)(()=>Bp(zy(1)),[]);return(0,Q.useEffect)(()=>W5(YOe(t,e,{emit:r,wakeups:i})),[t,e,i]),{refresh:(0,Q.useCallback)(()=>{Vy(i,`wake`)},[i]),state:n}},ZOe=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})`,QOe=({worktree:e})=>e===void 0?[]:[[`Branch`,(0,$.jsx)(`code`,{children:e.branch},`branch`)],[`Base`,(0,$.jsxs)(`code`,{children:[e.baseRef,` @`,` `,e.baseRevision.slice(0,ZOe)]},`base`)],[`Worktree`,e.state]],$Oe=({failure:e})=>e===void 0?[]:[[`Failure`,e.message]],eke=e=>[[`Runs on`,T9(e)],...QOe(e),...$Oe(e),[`Updated`,(0,$.jsx)(n7,{iso:e.updatedAt},`updated`)]],E9=e=>{let t=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{e&&t.current?.focus()},[e]),t},tke=({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)(t7,{items:eke(t)})]})},nke=({focusHeading:e=!1,refresh:t,sessionId:n,state:r,tasks:i})=>{if(r.status===`loading`)return(0,$.jsx)(q5,{what:`Session`});if(r.status!==`ready`)return(0,$.jsx)(J5,{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)(tke,{focus:e,session:o}),(0,$.jsx)(JDe,{sessionId:n}),i===void 0?null:(0,$.jsx)(kOe,{sessionId:n,tasks:i}),(0,$.jsx)(FOe,{snapshot:r.value}),(0,$.jsx)(vOe,{refresh:t,...a===void 0?{}:{runningTurnId:a},session:o})]})},D9=({focusHeading:e=!1,sessionId:t,tasks:n})=>{let{refresh:r,state:i}=XOe(t);return(0,$.jsx)(nke,{focusHeading:e,refresh:r,sessionId:t,state:i,...n===void 0?{}:{tasks:n}})},O9={status:`loading`},k9=(e,t)=>wf([V5(t=>e.host.client.listSessions({limit:100,projectId:e.projectId},t)),COe(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))))),rke=(e,t,n)=>T(()=>{n(O9)}).pipe(zf(k9({emit:n,host:e,projectId:t}))),ike=e=>{let{client:t,request:n}=K5(),[r,i]=(0,Q.useState)(O9);return(0,Q.useEffect)(()=>W5(rke({client:t,request:n},e,i)),[t,e,n]),r},ake=({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)(n7,{iso:r.updatedAt})]}),(0,$.jsx)(EOe,{sessionId:r.id,tasks:i})]})})},oke=({focusId:e,onSelect:t,selectedId:n,state:r})=>{if(r.status===`loading`)return(0,$.jsx)(q5,{what:`Sessions`});if(r.status!==`ready`)return(0,$.jsx)(J5,{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)(ake,{focus:r.id===e,onSelect:t,selected:r.id===n,session:r,tasks:o},r.id))})]})},ske=({projectId:e})=>{let t=ike(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)(oke,{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)]})})]})},cke=()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The Sessions of a Project: their state and branch, and each one's live transcript.`,title:`Sessions`}),(0,$.jsx)(i7,{noun:`Sessions`,children:e=>(0,$.jsx)(ske,{projectId:e},e)})]}),lke=100,uke=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})),dke=e=>({commandId:t,session:n},{options:r})=>e.startSession({commandId:`${t}.start`,expectedRevision:n.revision,sessionId:n.id},r),fke=(e,t)=>V5(n=>e.listWorkspaces({afterCursor:`0`,limit:lke,projectId:t},n)).pipe(O(({items:e})=>kxe(e)[0])),pke=e=>{let{client:t}=K5();return Q5((0,Q.useMemo)(()=>fke(t,e),[t,e]))},mke=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.`}},hke=(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`}},gke=({step:e})=>e===`creating`||e===`starting`,_ke=e=>`created`in e,vke=()=>{let{client:e}=K5(),t=m7(uke(e)),n=m7(dke(e)),r=hke(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}},yke=e=>{switch(e.reason){case`busy`:return a7(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.`}},bke=e=>{let t=`The Session was created but is not running.`;switch(e.reason){case`busy`:return`${t} ${a7(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.`}},xke=e=>{switch(e.step){case`creating`:return`Creating a Session…`;case`failed`:return e.stage===`create`?yke(e.failure):bke(e.failure);case`idle`:case`started`:return``;case`starting`:return`Starting the Session…`}},Ske=({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:xke(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=[...HS,X.maiaAgent,X.pi],M9=16384,N9=128,Cke=/[\p{Cc}\p{Zl}\p{Zp}]/u,wke=()=>({harness:X.claudeCode,instruction:``,name:``}),Tke=({harness:e,instruction:t,name:n})=>({harness:e,instruction:t,name:n}),P9=e=>new TextEncoder().encode(e).byteLength,Eke=e=>e===``?`Enter a name.`:e.length>N9?`Use at most ${String(N9)} characters.`:Cke.test(e)?`Remove line breaks and control characters.`:void 0,Dke=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},Oke=(e,t)=>t?.effort!==void 0&&!eN(e).includes(t.effort)?`This Agent's ${t.effort} effort does not fit ${e}. Choose a harness that supports it.`:void 0,kke=e=>e[1]!==void 0,Ake=(e,t)=>[[`name`,Eke(e.name)],[`instruction`,Dke(e.instruction)],[`harness`,Oke(e.harness,t)]],jke=(e,t)=>e.kind===`create`?{kind:`create`,projectId:e.projectId,spec:t}:{agentId:e.agent.id,expectedRevision:e.agent.revision,kind:`revise`,spec:t},Mke=(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(Ake(a,i).filter(kke));return Object.keys(o).length>0?{errors:o,ok:!1}:{change:jke(r,{...i,accountableActorId:n,harness:a.harness,instruction:a.instruction,name:a.name,placement:`local`}),ok:!0}},Nke=[[`Name`,({name:e})=>e],[`Harness`,({harness:e})=>e],[`Instruction`,({instruction:e})=>e],[`Accountable`,({accountableActorId:e})=>e]],Pke=({change:e,current:t})=>e.kind===`disable`?[]:Nke.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}}),Fke={},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.`},Ike={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.`},Lke=(e,t)=>{switch(t.reason){case`busy`:return a7(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.`}},Rke=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,zke=(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:Lke(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…`}},Bke=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})]}),Vke=({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))})})]})},Hke=({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)(Vke,{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})]}),Uke=({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))}),Wke=({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)(t7,{items:[[`Agent ID`,i.agentId],...i.current===void 0?[]:[[`Revision`,i.current.revision]],[`Expires`,(0,$.jsx)(n7,{iso:i.expiresAt},`expires`)]]}),(0,$.jsx)(Uke,{rows:Pke(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`})]})]})},Gke=({errors:e,form:t,mode:n,onBack:r,onChange:i,onClose:a,onConfirm:o,onPreview:s,onRetry:c,state:l})=>{let u=Rke(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)(Hke,{busy:l.status===`previewing`,errors:e,form:t,onCancel:a,onChange:i,onPreview:s}):(0,$.jsx)(Wke,{mode:n,onBack:r,onConfirm:o,onRetry:c,preview:u,state:l})},Kke=e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gke,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`persona-status`,"data-status":e.state.status,role:`status`,children:zke(e.mode,e.state,Object.keys(e.errors).length>0)})]}),qke=({actorId:e,onClose:t,target:n})=>{let{client:r}=K5(),i=g7(Bke(r)),[a,o]=(0,Q.useState)(()=>n.kind===`revise`?Tke(n.agent.spec):wke()),[s,c]=(0,Q.useState)(!1),l=Mke(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)(Kke,{errors:s&&!l.ok?l.errors:Fke,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})]})},Jke=e=>V5(t=>e.showCurrentContext({},t)).pipe(O(({actorId:e})=>e)),Yke=({fault:e,onClose:t})=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`notice`,"data-state":e,role:`status`,children:Ike[e]}),(0,$.jsx)(`button`,{onClick:t,type:`button`,children:`Back to Agents`})]}),Xke=({onClose:e,target:t})=>{let{client:n}=K5(),r=Q5((0,Q.useMemo)(()=>Jke(n),[n]));return r.status===`loading`?(0,$.jsx)(q5,{what:`your identity`}):r.status===`ready`?(0,$.jsx)(qke,{actorId:r.value,onClose:e,target:t}):(0,$.jsx)(Yke,{fault:r.status,onClose:e})},V9={kind:`list`},Zke=({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)(t7,{items:[[`State`,o],[`Harness`,c],[`Placement`,f],[`Updated`,(0,$.jsx)(n7,{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]})},Qke=({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)(Zke,{agent:e,...t},e.id))}),$ke=({state:e,...t})=>(0,$.jsx)(Y5,{label:`agents`,state:e,surface:`agents`,children:({records:e})=>(0,$.jsx)(Qke,{records:e,...t})}),eAe=({onCreate:e,projectId:t,...n})=>{let r=Z5(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)($ke,{state:r,...n})]})},tAe=({chat:e,onView:t,projectId:n,workspace:r})=>{let i=r.status===`ready`?r.value?.id:void 0,a=mke(r);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ske,{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)(eAe,{busy:gke(e.state),canChat:i!==void 0&&!_ke(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})]})},nAe=({projectId:e})=>{let t=vke(),n=pke(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)(Xke,{onClose:()=>{i(V9)},target:r.target}):(0,$.jsx)(tAe,{chat:t,onView:e=>{i(e)},projectId:e,workspace:n})},rAe=[{id:`agents`,label:`Agents`,screen:()=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The Agents of a Project, as the Node holds them.`,title:`Agents`}),(0,$.jsx)(i7,{noun:`Agents`,children:e=>(0,$.jsx)(nAe,{projectId:e},e)})]})},{id:`sessions`,label:`Sessions`,screen:cke}],iAe=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),aAe=e=>e.slice(0,iAe),W9=e=>Pue.safeParse({workspace:e}).success,oAe=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)??[]}))},sAe=e=>e.filter(({state:e})=>e!==`in_sync`),G9=e=>`${String(e)} ${e===1?`skill`:`skills`}`,cAe=(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=sAe(t).length;return n===0?`Every skill matches the pin.`:`Differs from the pin: ${String(n)} of ${G9(t.length)}.`},lAe={add:`Add`,remove:`Remove`,update:`Update`},uAe=({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),dAe=({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))})]}),fAe=({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)(t7,{items:[[`Pinned`,K9(e.pinnedDigest)],[`On this Node`,K9(e.localDigest)]]}),(0,$.jsx)(dAe,{files:e.files})]})},pAe=({pin:e,revision:t})=>e===void 0?[]:[[`Set`,U9(e.digest)],[`Source commit`,aAe(e.source.commit)],[`Revision`,t]],mAe=({shown:e})=>{let t=oAe(e),n=pAe(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)(t7,{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:cAe(e,t)}),t.length===0?null:(0,$.jsx)(`ul`,{"aria-label":`Skills`,className:`records skill-list`,children:t.map(e=>(0,$.jsx)(fAe,{row:e},e.name))})]})},hAe={kind:`rollback`},gAe=(e,t)=>V5(n=>e.showSkillsSync({workspace:t},n)),_Ae=(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)}),vAe=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.`]]),yAe=e=>{switch(e.reason){case`busy`:return a7(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:vAe.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.`}},bAe=e=>{e?.focus()},xAe=e=>e.status===`previewed`||e.status===`confirming`||e.status===`failed`?e.preview:void 0,SAe=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 yAe(e);case`idle`:return``;case`previewed`:return`Preview ready. Review it before you confirm.`;case`previewing`:return`Asking the Node for a preview…`}},CAe=({conflicts:e})=>e.length>0,wAe=({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:[lAe[e],` `,(0,$.jsx)(`strong`,{children:t})]},t))}),TAe=({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}),`: `,uAe(e)]},e.name))})]}),EAe=({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 CAe(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`})},DAe=({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:bAe,tabIndex:-1,children:`Rollback preview`}),(0,$.jsx)(t7,{items:[[`Restores`,U9(t.digest)],[`Revision`,t.revision],[`Expires`,(0,$.jsx)(n7,{iso:t.validUntil},`expires`)]]}),(0,$.jsx)(TAe,{conflicts:t.plan.conflicts}),(0,$.jsx)(wAe,{changes:t.plan.changes,conflicts:t.plan.conflicts}),(0,$.jsxs)(`div`,{className:`skills-actions`,children:[(0,$.jsx)(EAe,{plan:t.plan,state:n,...r}),(0,$.jsx)(`button`,{disabled:n.status===`confirming`,onClick:e,type:`button`,children:`Close preview`})]})]}),OAe=({onPreview:e,previousDigest:t,state:n,...r})=>{let i=xAe(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)(DAe,{onPreview:e,preview:i,state:n,...r})},kAe=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)(OAe,{...e}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`skills-status`,"data-status":e.state.status,role:`status`,children:SAe(e.state)})]}),AAe=()=>(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).`})]})]})]}),jAe={status:`loading`},MAe=(e,t)=>{let{client:n}=K5(),[r,i]=(0,Q.useState)();return(0,Q.useEffect)(()=>W5(gAe(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:jAe},NAe=`A Workspace key is lowercase letters, digits and hyphens, starts with a letter or digit, and holds at most 63 characters.`,PAe=({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:NAe}):null]}),(0,$.jsx)(`button`,{type:`submit`,children:`Read skills`})]})},FAe=({workspace:e})=>{let{client:t}=K5(),{confirm:n,reset:r,retry:i,start:a,state:o}=g7((0,Q.useMemo)(()=>_Ae(t,e),[t,e])),s=MAe(e,o.status===`done`?o.receipt.receiptId:``);return s.status===`loading`?(0,$.jsx)(q5,{what:`skills`}):s.status===`ready`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mAe,{shown:s.value}),(0,$.jsx)(kAe,{onClose:()=>{r()},onConfirm:()=>{n()},onPreview:()=>{a(hAe)},onRetry:()=>{i()},previousDigest:s.value.pin?.previousDigest,state:o})]}):(0,$.jsx)(J5,{fault:s.status,unavailable:`The Node must serve skills.sync.show, skills.sync.preview and skills.sync.confirm.`})},q9=gCe([EDe,yDe,rAe,Awe,[{id:`skills`,label:`Skills`,screen:()=>{let[e,t]=(0,Q.useState)();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(e7,{summary:`The skills set a Workspace pins on this Node, and how this Node's skill folders compare with it.`,title:`Skills`}),(0,$.jsx)(PAe,{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)(FAe,{workspace:e.workspace},`${e.workspace}:${String(e.reads)}`),(0,$.jsx)(AAe,{})]})}}]]),IAe=({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))})}),LAe=({onPress:e,running:t})=>(0,$.jsx)(`button`,{disabled:t,onClick:e,type:`button`,children:`Sign out`}),RAe=({signOut:e})=>{let{start:t,state:n}=m7(e);return(0,$.jsx)(LAe,{onPress:()=>{t()},running:n.status===`running`})},zAe=T(()=>{window.location.reload()}),BAe=()=>(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:()=>{W5(zAe)},type:`button`,children:`Reload now`})]}),J9=`agents`,VAe=e=>{let t=new URLSearchParams(e).get(`screen`);return q9.find(({id:e})=>e===t)?.id??J9},HAe=e=>(window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}),UAe=()=>VAe(window.location.search),WAe=()=>J9,GAe=e=>T(()=>{window.history.pushState(void 0,``,`?screen=${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}),KAe=e=>{W5(GAe(e))},qAe=()=>({navigate:KAe,screen:(0,Q.useSyncExternalStore)(HAe,UAe,WAe)}),JAe=({id:e})=>{let t=q9.find(t=>t.id===e);if(t===void 0)return null;let{screen:n}=t;return(0,$.jsx)(n,{})},YAe=({signOut:e})=>{let{identity:t,skewed:n}=K5(),{navigate:r,screen:i}=qAe(),[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)(RAe,{signOut:e})]}),(0,$.jsx)(IAe,{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)(BAe,{}):(0,$.jsx)(wwe,{navigate:r,children:(0,$.jsx)(JAe,{id:i})})})]})},XAe=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}}}})),ZAe=e(((e,t)=>{t.exports=XAe()})),QAe=e((e=>{var t=U5();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`})),$Ae=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=QAe()})),eje=e((e=>{var t=ZAe(),n=U5(),r=$Ae();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)}})),tje=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=eje()}))(),nje=({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`})]})},rje={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…`},ije=`Revocation unconfirmed: this page is signed out, but the Node did not confirm it ended the session. The Node ends it when it expires.`,aje=({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:rje[t]},t),t===`signed-out`&&n?(0,$.jsx)(`p`,{role:`status`,children:ije}):null,t===`starting`?null:(0,$.jsx)(nje,{onSubmit:e,...t===`refused`?{errorId:r}:{}})]})})},oje=()=>{},sje={current:()=>!1,subscribe:()=>oje},cje=({children:e,onSubmit:t,status:n,unconfirmedSignOut:r=sje})=>{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)(aje,{onSubmit:t,state:i,unconfirmed:a})},lje={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=Dxe(),uje=xme({onSignedOut:()=>{d5(X9),Z9.set(`signed-out`)},origin:window.location.origin,session:()=>ur(u5(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,tje.createRoot)(Y9).render((0,$.jsx)(cje,{onSubmit:e=>{Mp(Txe(Z9,Q9,e))},status:Z9,unconfirmedSignOut:$9,children:(0,$.jsx)(nCe,{identity:{label:`This Node`},references:lje,transport:uje,children:(0,$.jsx)(YAe,{signOut:()=>Ip(Exe(Z9,Q9).pipe(O(e=>{$9.set(e===`unconfirmed`)})))})})})),Mp(wxe({...Q9,replaceAddress:e=>{window.history.replaceState(window.history.state,``,e)}}).pipe(O(e=>{Z9.set(e)})));
|