@fabiofiorita/porcelain 0.82.2 → 0.82.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/server/src/cli/main.mjs +145 -71
- package/web/dist/assets/_-CjuX8204.js +1 -0
- package/web/dist/assets/_paired-CsufHhzG.js +1 -0
- package/web/dist/assets/{_paired-CqcR1ikJ.js → _paired-DGwd1y4R.js} +1 -1
- package/web/dist/assets/_paired-Uw-2dNDo.js +1 -0
- package/web/dist/assets/{_paired--LzhIV8q.js → _paired-dxbWzSKv.js} +1 -1
- package/web/dist/assets/{_section-C3rzCQs1.js → _section-BVyF13W-.js} +1 -1
- package/web/dist/assets/_worktreeId-CHJpLdGv.js +1 -0
- package/web/dist/assets/_worktreeId-CsufHhzG.js +1 -0
- package/web/dist/assets/_worktreeId-Uw-2dNDo.js +1 -0
- package/web/dist/assets/{_worktreeId-BDJbQ5Cn.js → _worktreeId-jnE7LHzn.js} +1 -1
- package/web/dist/assets/{access-WT1uwdZk.js → access-Be5-I3uN.js} +1 -1
- package/web/dist/assets/connected-workspace-bG1owcgt.js +1 -0
- package/web/dist/assets/{desktop-actions-WJQHB849.js → desktop-actions-BF1FmtLQ.js} +22 -22
- package/web/dist/assets/{edit-file-CG3WhqLS.js → edit-file-C2FNFMOI.js} +1 -1
- package/web/dist/assets/{file-editor-DGtg0rP2.js → file-editor-oLgfLZbs.js} +1 -1
- package/web/dist/assets/index-HBCxqMtr.css +2 -0
- package/web/dist/assets/{index-Bk8Ig0Ne.js → index-jwdWY-Oe.js} +3 -3
- package/web/dist/assets/{lazyRouteComponent-DpO3HGey.js → lazyRouteComponent-jhdvs2sU.js} +1 -1
- package/web/dist/assets/{pair-CqLMCfsc.js → pair-FC2KSEZT.js} +1 -1
- package/web/dist/assets/pair-Uw-2dNDo.js +1 -0
- package/web/dist/assets/{settings-page-RYnO3e6i.js → settings-page-_25QMUsD.js} +108 -108
- package/web/dist/assets/{useMatch-Dht53RCg.js → useMatch-BNfVF2UU.js} +1 -1
- package/web/dist/assets/useRouterState-GOqQRnzK.js +1 -0
- package/web/dist/assets/{workspace-error-CIsCnenX.js → workspace-error-BtARcbMJ.js} +1 -1
- package/web/dist/assets/{workspace-pending-oH5nDvO6.js → workspace-pending-CF3GKXTj.js} +1 -1
- package/web/dist/index.html +8 -8
- package/web/dist/assets/_-b1prKmSp.js +0 -1
- package/web/dist/assets/_paired-B07BAuB3.js +0 -1
- package/web/dist/assets/_paired-D-U8zru5.js +0 -1
- package/web/dist/assets/_worktreeId-B07BAuB3.js +0 -1
- package/web/dist/assets/_worktreeId-D-U8zru5.js +0 -1
- package/web/dist/assets/_worktreeId-D1NaqSVx.js +0 -1
- package/web/dist/assets/connected-workspace-DcS6e5zB.js +0 -1
- package/web/dist/assets/index-BoONRxa4.css +0 -2
- package/web/dist/assets/pair-D-U8zru5.js +0 -1
- package/web/dist/assets/useRouterState-DCsGUMtp.js +0 -1
|
@@ -14,4 +14,4 @@ import{r as e,t}from"./rolldown-runtime-XKyaHtl9.js";var n=(e,t)=>{switch(t.leng
|
|
|
14
14
|
`);r=n??ay(e)??Qv(xv(e.ast),e);break;default:r=n??qv(e)}return t?`${r}\n at ${t}`:r}function ay(e){if(e._tag===`Pointer`||e._tag===`Composite`)return;if(e._tag===`Encoding`)return ay(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 oy(e){let t;for(let n of e.reasons){if(!pu(n)||!kv(n.error))return;t??=n.error}return t}function sy(e,t){let n=oy(e);if(n===void 0)throw Error(t,{cause:e});return n}var cy=e=>Object.assign(Object.create(r),e);function ly(e){return _y((t,n)=>U(e(t,n)))}function uy(e){return ly((t,n)=>{let r={message:e(t)};return Yn(t)?new Vv(r,t.value,n):new Vv(r)})}var dy=uy(()=>`Encoding is not supported`),fy=cy({_tag:`Passthrough`});function py(){return fy}function my(e){return cy({_tag:`Transform`,transform:e})}function hy(e){return cy({_tag:`TransformEffect`,transform:e})}function gy(e){return cy({_tag:`TransformOptional`,transform:e})}function _y(e){return cy({_tag:`TransformOptionalEffect`,transform:e})}function vy(){return gy(()=>Kn())}function yy(e){return _y(t=>{let n=lr(t,k);return Yn(n)?B(n):qm(e,qn)})}function by(){return my(globalThis.String)}function xy(){return my(globalThis.Number)}function Sy(){return my(Lf)}function Cy(e){return hy((t,n)=>bp({try:()=>JSON.parse(t,e?.reviver),catch:()=>new zv({expected:`a valid JSON string`},t,n)}))}function wy(e){return hy((t,n)=>bp({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 zv({expected:`a JSON-serializable value`},t,n)}))}function Ty(){return my(Zh)}function Ey(){return hy((e,t)=>Jm(cne(Qh(e)),()=>new zv({expected:`a valid Base64 string`},e,t)))}var Dy=Symbol.for(`~effect/Schema/content`);function Oy(e,t){return Object.defineProperty(e,Dy,{value:t}),e}var ky=class extends i{_tag=`Middleware`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new ky(this.encode,this.decode)}},Ay=`~effect/SchemaTransformation/Transformation`,jy=class extends i{[Ay]=Ay;_tag=`Transformation`;decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new jy(this.encode,this.decode)}};function My(e){return F(e,Ay)&&e[Ay]===Ay}var Ny=e=>My(e)?e:new jy(e.decode,e.encode);function Py(e){return new jy(hy(e.decode),hy(e.encode))}function Fy(e){return new jy(my(e.decode),my(e.encode))}function Iy(){return new jy(Sy(),py())}var Ly=new jy(py(),py());function Ry(){return Ly}var zy=new jy(xy(),by()),By=e=>N(e)&&typeof e.message==`string`,Vy=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:Gy(e.cause)}):Error(e.message);return typeof e.name==`string`&&e.name!==`Error`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t},Hy=e=>{try{let t=Qe(e);return t===void 0?Ge(e):JSON.parse(t)}catch{return Ge(e)}},Uy=(e,t,n)=>{let r={name:e.name,message:typeof e.message==`string`?e.message:``};return t?.includeStack&&typeof e.stack==`string`&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},Wy=e=>{let t=new WeakSet,n=r=>{if(L(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=Uy(r,e,n);return t.delete(r),i}return Hy(r)};return n},Gy=e=>By(e)?Vy(e):e,Ky=e=>Fy({decode:Gy,encode:Wy(e)}),qy=Py({decode:(e,t)=>URL.canParse(e)?B(new URL(e)):U(new zv({expected:`a valid URL string`},e,t)),encode:e=>B(e.href)}),Jy=new jy(Ey(),Ty());function Yy(e){return new jy(Cy(e??{}),Oy(wy(e),{mediaType:`application/json`,preserveSchema:e?.reviver===void 0&&e?.replacer===void 0}))}function Xy(e){return t=>t._tag===e}var Zy=Xy(`Declaration`),fne=Xy(`Null`),Qy=Xy(`Void`),pne=Xy(`Never`),$y=Xy(`Literal`),eb=Xy(`UniqueSymbol`),mne=Xy(`Arrays`),tb=Xy(`Objects`),nb=Xy(`Union`),rb=Xy(`Suspend`),ib=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},ab={},ob=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}},sb=`~effect/Schema`,cb=class{[sb]=sb;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}>`}},lb=class extends cb{_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)=>{if(t===Sv)return wv;e??=this.run(this.typeParameters);try{return e(t,this,n)}catch(e){return yp(e)}}}_rebuild(e,t,n,r,i){let a=_x(this.typeParameters,e);return a===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&i===this.encodingRun?this:new lb(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>`}},ub=new class extends cb{_tag=`Null`;getParser(){return Dx(this,null)}getExpected(){return`null`}},hne=class extends cb{_tag=`Undefined`;getParser(){return Dx(this,void 0)}toCodecJson(){return ox(this,[db])}getExpected(){return`undefined`}},db=new ib(ub,new jy(my(()=>void 0),my(()=>null))),fb=new hne,gne=new class extends cb{_tag=`Void`;getParser(){let e=Cv(void 0);return t=>t===Sv?wv:e}toCodecJson(){return ox(this,[db])}getExpected(){return`void`}},pb=class extends cb{_tag=`Never`;getParser(){return Ox(this,j)}getExpected(){return`never`}},_ne=new pb,mb=new class extends cb{_tag=`Unknown`;getParser(){return Ox(this,M)}getExpected(){return`unknown`}},hb=class extends cb{_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 ${Ge(e)}`);this.literal=e}getParser(){return Dx(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?gb(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:gb(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function gb(e){let t=globalThis.String(e.literal);return ox(e,[new ib(new hb(t),new jy(my(()=>e.literal),my(()=>t)))])}var _b=new class extends cb{_tag=`String`;getParser(){return Ox(this,C)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Nx(n,e,void 0,this,t)?void 0:e}getExpected(){return`string`}},vne=class extends cb{_tag=`Number`;getParser(){return Ox(this,w)}matchKey(e,t){return this._match(Vne,e,t)}matchPart(e,t){return this._match(jx,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);return n.disableChecks||!this.checks?r:Nx(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){return this.checks&&(vb(this.checks,`effect/schema/isFinite`)||vb(this.checks,`effect/schema/isInt`))?this:ox(this,[kne])}toCodecStringTree(){return this.toCodecJson()===this?ox(this,[Une]):ox(this,[Wne])}getExpected(){return`number`}};function vb(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&vb(e.checks,t))}var yb=new vne,yne=new class extends cb{_tag=`Boolean`;getParser(){return Ox(this,T)}getExpected(){return`boolean`}},bb=class extends cb{_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(Sx(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(Sx(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 Iv(n,t[o],i),a=new Pv([o],r);if(i.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return U(new Lv(n,[a],t,i))}return e.issues?U(new Lv(n,e.issues,t,i)):Cv(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:[],issues:void 0,options:t},u=n.rest.length===0?a:Math.max(r,a+o),d=t.concurrency===void 0?1:$c(t.concurrency),f=d===1?xne(i,e,0,u):Sne(i,e,{concurrency:d,end:u});if(!f)return c(i);if(ys(f))return Xm(f,()=>c(i));let p=!0;return fp(()=>p?(p=!1,Cp(f,()=>c(i))):l(e,t))};return(e,a)=>{if(e===Sv)return wv;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)):U(new Rv(n,e,a))}catch(e){return yp(e)}}}_rebuild(e,t,n){let r=_x(this.elements,e),i=_x(this.rest,e);return r===this.elements&&i===this.rest&&t===this.checks&&n===this.encodingChecks?this:new bb(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 bne(e,t,n,r){if(n._tag===`Failure`)return Sb(e,e.ast,r,n);let i=n===Tv?t:n[vt];if(i!==Sv)e.output[r]=i;else{let t=e.getParser(e.tailThreshold,r);if(Sx(t.ast))return;let n=new Pv([r],new Fv(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Pu(new Lv(e.ast,[n],e.input,e.options))}}var xb={onItem(e,t,n){let r=n<e.len?t:Sv;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step:bne},xne=el()(xb),Sne=nl()(xb),Sb=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=oy(r.cause);if(i===void 0)return Nu(Su(r.cause,r=>new Lv(t,[new Pv([n],r)],e.input,e.options)));let a=new Pv([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Pu(new Lv(t,[a],e.input,e.options))},Cb=`[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[Ee][+-]?\\d+)?`;function wb(e,t,n=ab){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(kx(Tx(t)))}var Tb=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Eb(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(Eb);default:return!1}}function Db(e){let t=cx(e);switch(t._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return t.types.every(Db);default:return!1}}function Cne(e){return Eb(e)&&Db(e)}var Ob=class{parameter;type;constructor(e,t){if(!Cne(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Sx(t)||t.encoding!==void 0&&Sx(Tx(t)))throw Error("Cannot use `Schema.optionalKey` or `Schema.optional` with index signatures. Index signatures already allow keys to be absent; use `Schema.UndefinedOr` to allow `undefined` values.")}},kb=class extends cb{_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 Ox(n,A);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(kx(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 Sb(t,n,i,s)??Iu;let c=s===Tv?o:s[vt];if(a!==Sv&&c!==Sv){if(r&&(e.has(i)||e.has(typeof a==`number`?globalThis.String(a):a)))return Iu;ft(t.out,a,c)}return Iu},c=(e,r,i,a)=>{if(!a){let t=i.parserKey(r,e.options);if(!ys(t))return Cp(Dp(t),t=>c(e,r,i,t));a=t}if(a._tag===`Failure`)return Sb(e,n,r,a)??Iu;let o=a===Tv?r:a[vt],s=e.input[r],l=i.parserValue(s,e.options);return ys(l)?t(e,r,o,s,l):Cp(Dp(l),n=>t(e,r,o,s,n))},l=(e,n,r)=>{let i=e.input[n],a=r.parserValue(i,e.options);return ys(a)?t(e,n,n,i,a):Cp(Dp(a),r=>t(e,n,n,i,r))},u=i?nl()({onItem:(e,[t,n])=>n.is.parameter===_b?l(e,t,n):c(e,t,n),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Qm(function*(t,d){if(t===Sv)return Sv;if(typeof t!=`object`||!t||Array.isArray(t))return yield*U(new Rv(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`,_=d.concurrency===void 0?1:$c(d.concurrency),v=i&&g?n.indexSignatures.map(e=>wb(f,e.parameter,d)):void 0;if(g){let r=v?new Set(e):e;if(v)for(let e of v)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 Iv(n,f[a],d),r=new Pv([a],e);if(h){m.issues?m.issues.push(r):m.issues=[r];continue}return yield*U(new Lv(n,[r],t,d))}}}if(r){let e=_===1?Mb(m,a):wne(m,a,{concurrency:_});e&&(yield*e)}if(i&&_===1)for(let e=0;e<i;e++){let t=o[e],n=t.is.parameter===_b?l:c,r=v?.[e]??(t.is.parameter===_b?Object.keys(f):wb(f,t.is.parameter,d));for(let e=0;e<r.length;e++){let i=n(m,r[e],t);if(!ys(i))yield*i;else if(i._tag===`Failure`)return yield*i}}else if(u){let e=pi();for(let t=0;t<i;t++){let n=o[t],r=v?.[t]??(n.is.parameter===_b?Object.keys(f):wb(f,n.is.parameter,d));for(let t=0;t<r.length;t++)e.push([r[t],n])}let t=u(m,e,{concurrency:_});t&&(yield*t)}return m.issues?yield*U(new Lv(n,m.issues,t,d)):p})};if(i)return c();let l,u=(e,t,n)=>{let r=a[t];return Cp(Dp(n),n=>{let i={...e,out:{...e.out}},o=Ab(i,r,n);if(o)return o;let s=()=>Cv(i.out),c=Mb(i,a.slice(t+1));return c?Xm(c,s):s()})};return(e,t)=>{if(e===Sv)return wv;if(t.errors===`all`||t.onExcessProperty!==void 0||t.concurrency!==void 0&&$c(t.concurrency)!==1)return(l??=c())(e,t);if(typeof e!=`object`||!e||Array.isArray(e))return U(new Rv(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=Wb(i,s),l=c?i[s]:Sv,d=n.parser(l,t);if(!ys(d))return u(o,e,d);if(d===Tv){c&&ft(a,s,l);continue}let f=Ab(o,n,d);if(f)return f}}catch(e){return yp(e)}return Cv(a)}}_rebuild(e,t,n,r){let i=_x(this.propertySignatures,t=>{let n=e(t.type);return n===t.type?t:new Tb(t.name,n)}),a=_x(this.indexSignatures,n=>{let r=t(n.parameter),i=e(n.type);return r===n.parameter&&i===n.type?n:new Ob(r,i)});return i===this.propertySignatures&&a===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new kb(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 Ab(e,t,n){if(n._tag===`Failure`)return Sb(e,e.ast,t.name,n);if(n===Tv)return;let r=n[vt];if(r!==Sv)ft(e.out,t.name,r);else if(delete e.out[t.name],!Sx(t.type)){let n=new Pv([t.name],new Fv(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Pu(new Lv(e.ast,[n],e.input,e.options))}}var jb={onItem(e,t){if(!Wb(e.input,t.name))return t.parser(Sv,e.options);let n=e.input[t.name];return ft(e.out,t.name,n),t.parser(n,e.options)},step:Ab},Mb=el()(jb),wne=nl()(jb);function Nb(e,t){return e?t?[...e,...t]:e:t}function Pb(e,t,n){return new kb(Reflect.ownKeys(e).map(t=>new Tb(t,e[t].ast)),[],n,t)}function Fb(e){return e.ast}function Ib(e,t=void 0){return new bb(!1,e.map(e=>e.ast),[],void 0,t)}function Lb(e,t,n){return new Gb(e.map(Fb),t,void 0,n)}var Rb=h(e=>{for(;;){if(rb(e))return mb;let t=e.encoding;if(!t)return e.recur?.(Rb,o)??e;if(t.some(e=>e.transformation._tag===`Middleware`&&e.transformation.decode!==o))return mb;e=t[t.length-1].to}});function zb(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(zb)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Bb(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[yv];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Sx(t)){if($y(t))return[{key:e.name,literal:t.literal}];if(eb(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>{if(!Sx(e)){if($y(e))return[{key:t,literal:e.literal}];if(eb(e))return[{key:t,literal:e.symbol}]}return[]});case`Union`:{if(e.types.length===0)return[];let t=e.types.map(e=>Bb(Rb(e)));return t[0].filter(e=>t.every(t=>t.some(t=>t.key===e.key&&t.literal===e.literal)))}case`Suspend`:return Bb(e.thunk())}}var Vb=new WeakMap,Hb=Object.freeze([]),Ub=e=>e===null?`null`:Array.isArray(e)?`array`:typeof e,Wb=(e,t)=>t===`__proto__`?Object.hasOwn(e,t):t in e;function Tne(e){let t=Vb.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=Rb(c);if(pne(l))continue;if($y(l)||eb(l)){a??=new Map;let e=$y(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=Bb(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=zb(l);for(let n of e)(i[n]??=[]).push(t)}}let c={},l=e=>c[e]??=Object.freeze(i?.[e]??Hb);if(o&&a)a.forEach(Object.freeze),t=e=>a.get(e)??Hb;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(P(e)){let n=Wb(e,r)?e[r]:void 0;if(n!==void 0)return a.get(n)??Hb;if(t)return o}return Hb}}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=Ub(t);if(!P(t))return l(a);let o=new Set(i?.[a]),s;if(e){let[n,[i]]=e,c=Wb(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=Wb(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=Wb(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(Ub(e));return a?t.filter(t=>s[t]===void 0||s[t]===e):t};return Vb.set(e,t),t}var Gb=class extends cb{_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===Sv)return wv;let i=(o??=Tne(n.types))(e,r);if(i.length===0)return U(new Hv(n,[],e,t));if(i.length===1){let r=a(i[0])(e,t);return r._tag===`Success`?r:ys(r)?Kb(n,r.cause,e,t):Ene(n,r,e,t)}return qb(n,a,i,e,t)}}_rebuild(e,t,n){let r=_x(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Gb(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=Tx(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter($y);if(t.length>0)return`${Xb(n.isMutable)}[ ${t.map(t=>e(t)+Zb(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>$y(e.type));if(t.length>0)return`{ ${t.map(t=>`${Xb(t.type.context?.isMutable)}${qe(t.name)}${Zb(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};function Kb(e,t,n,r){let i=oy(t);return i?Pu(new Hv(e,[i],n,r)):Nu(t)}function Ene(e,t,n,r){return Pp(t,t=>Kb(e,t,n,r))}function qb(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=Dne(a,n);if(!o)return a.out?a.out:U(new Hv(e,a.issues??[],r,i));if(ys(o))return Jb(o,a);let s=!0;return fp(()=>s?(s=!1,Jb(o,a)):qb(e,t,n,r,i))}function Jb(e,t){return Xm(e,e=>t.out===Tv?B(t.input):t.out?t.out:U(new Hv(t.ast,t.issues??[],t.input,t.options)))}var Dne=el()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=oy(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]),Pu(new Uv(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Iu}}}),Yb=new Gb([new hb(`Infinity`),new hb(`-Infinity`),new hb(`NaN`)]);function Xb(e){return e?``:`readonly `}function Zb(e){return e?`?`:``}var Qb=class extends i{_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 Qb(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Qb(this.run,this.annotations,!0)}and(e,t){return new $b([this,e],t)}},$b=class extends i{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new $b(this.checks,{...this.annotations,...e})}and(e,t){return new $b([this,e],t)}};function ex(e,t,n=!1){return new Qb((t,n,r)=>Kv(n,e(t,n,r),t,r),t,n)}function One(e){return ex(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 tx=dx(yb,[One()]),kne=new ib(new Gb([tx,Yb]),new jy(xy(),my(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function nx(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return ex(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 rx=new WeakMap;function ix(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(e=>e===`context`||e===`encoding`)&&rx.set(n,ax(e)),n}function ax(e){let t=rx.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 rx.set(e,n),n}function ox(e,t){return e.encoding===t?e:ix(e,{encoding:t})}function sx(e,t){if(e.context===t)return e;let n=ax(e);return n.context===t&&n.encoding===e.encoding?n:ix(e,{context:t})}function cx(e){return e.encoding?cx(e.encoding[e.encoding.length-1].to):e}function lx(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return ux(e,li(e.checks.slice(0,-1),n.annotate(t)))}return ix(e,{annotations:{...e.annotations,...t}})}function ux(e,t){if(e._tag===`Suspend`&&t)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:ix(e,{checks:t})}function dx(e,t){return ux(e,Nb(e.checks,t))}function fx(e,t){let n=t(e.to);return n===e.to?e:new ib(n,e.transformation)}function px(e,t){let n=e,r=n[n.length-1],i=fx(r,t);return i===r?e:li(e.slice(0,e.length-1),i)}function mx(e){return t=>t.encoding?ox(t,px(t.encoding,e)):t}function Ane(e,t){return mx(e=>sx(e,t))(e)}function hx(e,t){function n(r){if(r.encoding){let e=r.encoding[r.encoding.length-1];return t?.stopAt?.(e)?r:ox(r,px(r.encoding,n))}return e(r)}return h(n)}function jne(e,t){return gx(e,t,wx(e))}function gx(e,t,n){let r=new ib(e,t);return ox(n,n.encoding?[...n.encoding,r]:[r])}function _x(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 vx(e,t){return sx(e,e.context?new ob(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new ob(!1,!1,void 0,t))}var yx=h(e=>Mne(sx(e,e.context?e.context.isOptional===!1?new ob(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new ob(!0,!1)))),Mne=mx(yx),Nne=m(e=>yx(new Gb([e,fb]))),bx=h(e=>Pne(sx(e,e.context?e.context.isMutable===!1?new ob(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new ob(!1,!0)))),Pne=mx(bx);function Fne(e,t){return sx(e,e.context?new ob(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new ob(!1,!1,t))}function xx(e,t,n){return gx(e,n,t)}function Ine(e){let t=[],n=[];function r(e){t.includes(e)||t.push(e)}function i(e){switch(e._tag){case`Literal`:D(e.literal)&&r(e.literal);return;case`UniqueSymbol`:r(e.symbol);return;case`Enum`:for(let[,t]of e.enums)r(t);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)i(e.types[t]);return;default:n.push(e)}}return i(e),{literals:t,parameters:n}}function Lne(e,t){let{literals:n,parameters:r}=Ine(e);return new kb(n.map(e=>new Tb(e,t)),r.map(e=>new Ob(e,t)))}function Sx(e){return e.context?.isOptional??!1}function Cx(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(Cx)}function Rne(e){function t(e){return Cx(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return di(n)?n:void 0}function zne(e){let t=!0;function n(e){return t=t&&!e.encoding&&!rb(e),t&&`recur`in e&&e.recur(n),e}return`recur`in e&&e.recur(n),t}var wx=h(e=>{let t=ax(e);if(t!==e){let n=wx(t);return n===t&&e.encoding===void 0?e:sx(n,e.context)}let n=`recur`in e?e.recur(wx):e;if(`encodingChecks`in n&&n.encodingChecks){let t=zne(e)?n.encodingChecks:mne(n)||tb(n)||Zy(n)&&n.typeParameters.length>0?Rne(n.encodingChecks):void 0;return ix(n,{encodingChecks:void 0,checks:Nb(n.checks,t)})}return n}),Tx=h(e=>wx(Ex(e)));function Bne(e,t){let n=t,r=n.length,i=n[r-1],a=[new ib(Ex(ox(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new ib(Ex(n[e-1].to),n[e].transformation.flip()));let o=Ex(i.to);return o.encoding?ox(o,[...o.encoding,...a]):ox(o,a)}var Ex=m(e=>{if(e.encoding)return Bne(e,e.encoding);let t=ax(e);if(t!==e){let n=Ex(t);return n===t?e:sx(n,e.context)}return`flip`in e?e.flip(Ex):`recur`in e?e.recur(Ex):e});function Dx(e,t){let n=t===0?Tv:Cv(t);return(r,i)=>r===Sv?wv:r===t?n:U(new Rv(e,r,i))}function Ox(e,t){return(n,r)=>n===Sv?wv:t(n)?Tv:U(new Rv(e,n,r))}var kx=hx(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(kx)}}),Ax=hx(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Ax)}}),jx=new globalThis.RegExp(`^${Cb}$`),Vne=new globalThis.RegExp(`^(?:${Cb}|Infinity|-Infinity|NaN)$`);function Hne(e){return nx(jx,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:jx.source}),...e})}var Mx=dx(_b,[Hne()]),Une=new ib(Mx,zy),Wne=new ib(new Gb([Mx,Yb]),zy);function Nx(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`){if(n=Nx(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 Mv(o,e,t,i);if(n?n.push(r):n=[r],i.errors!==`all`||o.aborted)return n}}}return n}function Px(e){if(!Zy(e))return;let t=e.annotations?.[bv];return O(t)?t(e.typeParameters):void 0}var Fx=_v;function Gne(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function Kne(e){return e===void 0||typeof e==`string`}function Ix(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 qne(e){return Ix(e,Gne)}var Lx=new lb([],()=>(e,t,n)=>qne(e)?Tv:U(new Rv(t,e,n)),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>zx}),Rx=new ib(Lx,Ry()),Jne=new ib(new Gb([new bb(!1,[],[Lx]),new kb([],[new Ob(_b,Lx)])]),Ry());function Yne(e){return Ix(e,Kne)}var zx=new ib(new lb([],()=>(e,t,n)=>Yne(e)?Tv:U(new Rv(t,e,n)),{expected:`StringTree`,toCodecStringTree:()=>void 0}),Ry()),Bx=(e,t,n)=>e===Tv?n(t):Xm(e,n);function Vx(e){let t=Xne(e);return(e,n,r)=>{try{return t(e,n,r)}catch(e){return yp(e)}}}function Xne(e){if(e._tag===`Middleware`)return(t,n,r)=>Hx(t===Tv?e.decode(Cv(Ev(n)),r):e.decode(qm(t,Ev),r));let t=e.decode;switch(t._tag){case`Passthrough`:return(e,t)=>e===Tv?Cv(t):e;case`Transform`:{let e=e=>e===Sv?wv:Cv(t.transform(e));return(t,n)=>Bx(t,n,e)}case`TransformOptional`:{let e=e=>Dv(t.transform(Ev(e)));return(t,n)=>Bx(t,n,e)}case`TransformEffect`:return(e,n,r)=>Bx(e,n,e=>e===Sv?wv:t.transform(e,r));case`TransformOptionalEffect`:return(e,n,r)=>Bx(e,n,e=>Hx(t.transform(Ev(e),r)))}}var Hx=e=>Xm(e,Dv),Ux=(e,t,n,r)=>Pp(r,r=>vp(()=>Su(r,r=>new Nv(e,r,t,n))));function Zne(e,t){let n=Vx(e.link.transformation),r;return(i,a)=>{if(i===Sv)return wv;if(e.isConstructed(i))return Tv;let o=(r??=t(e.link.to))(i,a);return n(o,i,a)}}function Qne(e,t){let n=e.context.constructorDefault;return(r,i)=>{if(r!==Sv&&r!==void 0)return t(r,i);let a=n;if(ys(a)&&a._tag===`Success`){let e=t(a[vt],i);return e===Tv?a:e}return Xm(Ux(e,r,i,a),e=>{let n=t(e,i);return n===Tv?Cv(e):n})}}function $ne(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:Qne(e,n)}function Wx(e,t,n,r,i){if(e._tag===`Declaration`)for(let n of e.typeParameters)t(n);let a=n?Px(e):void 0,o=a?Zne(a,t):r??e.getParser(t,n),s=e.checks,c=e.encoding,l=c?.map(e=>Vx(e.transformation)),u=e.encodingChecks;if(!c&&!s&&!u)return o;let d,f=(t,n)=>{let r=o(t,n);try{if(u&&!n.disableChecks){if(ys(r)){if(r._tag===`Success`){let i=r===Tv?t:r[vt];if(t!==Sv&&i!==Sv){let i=Nx(u,t,void 0,e,n);i&&(r=U(new Lv(e,i,t,n)))}}}else r=Cp(r,r=>{if(t!==Sv&&r!==Sv){let r=Nx(u,t,void 0,e,n);if(r)return U(new Lv(e,r,t,n))}return B(r)})}if(s&&!n.disableChecks){if(ys(r)){if(r._tag===`Success`){let i=r===Tv?t:r[vt];if(i===Sv)return r;let a=Nx(s,i,void 0,e,n);a&&(r=U(new Lv(e,a,i,n)))}}else r=Cp(r,t=>{if(t!==Sv){let r=Nx(s,t,void 0,e,n);if(r)return U(new Lv(e,r,t,n))}return B(t)})}return r}catch(e){return yp(e)}},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[vt],o=t(a,r)):o=Xm(o,e=>{let n=t(e,r);return n===Tv?Cv(e):n})}if(o._tag===`Success`){let e=o[vt],t=p(e,r);return t===Tv?o:t}return o=Ux(e,n,r,o),Xm(o,e=>{let t=p(e,r);return t===Tv?Cv(e):t})}:p}var ere=Symbol(),Gx=new WeakMap,tre=e=>qx(e).parser,Kx=e=>qx(e).makeEffect,nre=e=>$ne(e,Kx),rre=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=Wx(this.ast,tre)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=Wx(this.ast,Kx,nre)}};function qx(e){let t=Gx.get(e);if(t!==void 0)return t;let n=new rre(e);return Gx.set(e,n),n}function Jx(e){let t=e.ast,n;return(e,r)=>(n??=eS(yre,wx(t)))(e,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Yx(e){let t=Jx(e);return(e,n)=>{let r=Bm(t(e,n));return Lu(r)?qn(r.value):(sy(r.cause,`Option adapter can only return none for schema issues`),Kn())}}function ire(e){return gre(wx(e.ast))}function are(e){return sre(e.ast)}function ore(e){{let t=tS($x(e));return e=>{let n=t(e,ab);return Lu(n)?!0:(sy(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}}function sre(e){let t=wx(e),n=e=>(n=ore(t),n(e));return e=>n(e)}function cre(e){let t=$x(e);return(e,n)=>{let r=Bm(t(e,n));if(!Lu(r))return sy(r.cause,`Issue adapter can only return schema issues`)}}function Xx(e,t){let n=$x(e.ast);return t===void 0?n:(e,r)=>n(e,Zx(t,r))}function lre(e,t){return pre(Xx(e,t))}function ure(e,t){return mre(Xx(e,t))}function dre(e,t){let n=$x(Ex(e.ast));return t===void 0?n:(e,r)=>n(e,Zx(t,r))}var Zx=(e,t)=>t?{...e,...t}:e,Qx=e=>e===Sv?U(new zv):B(e);function $x(e){return eS(vre,e)}function fre(e,t){return e===Tv?B(t):ys(e)?e[`~effect/Effect/args`]===Sv?Qx(Sv):e:Xm(e,Qx)}function eS(e,t){let n;return(r,i)=>{let a=(n??=e(t))(r,i??ab);return a===Tv?B(r):ys(a)?a[`~effect/Effect/args`]===Sv?Qx(Sv):a:Xm(a,Qx)}}function tS(e){return(t,n)=>Bm(e(t,n))}function pre(e){let t=tS(e);return(e,n)=>{let r=t(e,n);return Lu(r)?qn(r.value):(sy(r.cause,`Option adapter can only return none for schema issues`),Kn())}}function mre(e){let t=tS(e);return(e,n)=>{let r=t(e,n);return Lu(r)?Ur(r.value):Wr(sy(r.cause,`Result adapter can only return schema issues`))}}function hre(e,t){let n=Bm(e);if(Lu(n))return n.value;let r=sy(n.cause,t);throw Error(`Schema validation failed`,{cause:r})}var nS=`Constructor adapter can only throw schema issues`;function rS(e){throw Error(nS,{cause:gu(e)})}function gre(e){let t;return(n,r)=>iS(t??=qx(e),n,r)}function iS(e,t,n){let r=n?.disableChecks?n.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions??ab,i=e.make;if(i!==void 0&&t!==Sv){let e;try{e=i(t,r)}catch(e){rS(e)}if(e!==ere&&e!==Sv)return e}return hre(fre(e.makeEffect(t,r),t),nS)}function _re(e,t,n,r){let i=qx(e),a=Px(e);if(a===void 0||i.make!==void 0||i.compiledMakeEffect!==void 0)return iS(i,t,n);if(a.isConstructed(t))return t;let o=iS((i.resolve??qx)(a.link.to),t,n);try{return r(o)}catch(e){rS(e)}}var vre=e=>qx(e).parser,yre=e=>qx(e).makeEffect,aS=`~effect/Schema/Schema`,oS=Symbol(),bre={[aS]:aS,get make(){let e=ire(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=Jx(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=Yx(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return n(this,arguments)},annotate(e){return this.rebuild(lx(this.ast,e))},annotateKey(e){return this.rebuild(vx(this.ast,e))},check(...e){return this.rebuild(dx(this.ast,e))},rebuild(e){return sS(e,this[oS])}};function sS(e,t){function n(){}let r=Object.setPrototypeOf(n,bre);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[oS]=t,r.ast=e,r}function xre(e){return sS(Sre(e.ast),{schema:e})}var Sre=cS(wre);function cS(e,t){let n=m(t=>{let n=sx(t,void 0),i=e(n,r);return i===n?null:i}),r=hx(e=>{let t=n(ax(e));if(t===null)return e;let r=sx(t,e.context);return e.context===void 0?r:Ane(r,Cre(e.context))},t);return r}function Cre(e){return e.constructorDefault===void 0?e:new ob(e.isOptional,e.isMutable,void 0,e.annotations)}function lS(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function uS(e){return t=>{let n=[...t].sort((t,n)=>e(Tx(t))-e(Tx(n)));return n.some((e,n)=>e!==t[n])?n:t}}var dS=uS(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function wre(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!O(n))return ox(e,[Rx]);let r=n(e.typeParameters.map(e=>sS(Tx(e))));return r===void 0?e:ox(e,[fx(r,t)])}case`Unknown`:return ox(e,[Rx]);case`ObjectKeyword`:return ox(e,[Jne]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return lS(e),e.recur(t,Ax);case`Union`:{let n=dS(e.types);return n===e.types?e.recur(t):new Gb(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}function Tre(e){return sS(Ore(e.ast),{schema:e})}var fS=uS(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function pS(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>sS(t(Tx(e)))),i=e.annotations?.toCodecStringTree;if(O(i)){let n=i(r);return n===void 0?e:ox(e,[fx(n,t)])}let a=e.annotations?.toCodecJson,o=O(a)?a(r):void 0,s=o===void 0?e.annotations?.toCodec:void 0,c=o??(O(s)?s(r):void 0);return c===void 0?n(e):ox(e,[fx(c,t)])}case`Null`:return ox(e,[mS]);case`Boolean`:return ox(e,[Ere]);case`Unknown`:case`ObjectKeyword`:return ox(e,[zx]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return lS(e),e.recur(t,Ax);case`Union`:{let n=fS(e.types);return n===e.types?e.recur(t):new Gb(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}var mS=new ib(new hb(`null`),new jy(my(()=>null),my(()=>`null`))),Ere=new ib(new Gb([new hb(`true`),new hb(`false`)]),new jy(my(e=>e===`true`),by())),Dre=new jy(my(e=>typeof e==`string`?[e]:e),py()),Ore=cS((e,t)=>pS(e,t,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})}),{stopAt:e=>e.transformation===Dre});function hS(e){return Lu(e)?e.value:{issues:[{message:Ite(e.cause)}]}}function gS(e,t){let n=Xx(e),r={errors:`all`,...t?.parseOptions},i=Yv(t);return _S(e,{validate:e=>{let t=new xa(`sync`),a=Am(Xp(n(e,r),{onFailure:i,onSuccess:e=>({value:e})}),{scheduler:t});a.currentDispatcher?.flush();let o=a.pollUnsafe();return o?hS(o):new Promise(e=>{a.addObserver(t=>{e(hS(t))})})}})}function _S(e,t){let n={version:1,vendor:`effect`,...Object.hasOwn(e,`~standard`)?e[`~standard`]:void 0,...t},r=typeof e==`function`?Function.prototype.bind.call(e,void 0):Object.create(Object.getPrototypeOf(e));return Object.defineProperties(r,{...Object.getOwnPropertyDescriptors(e),ast:{value:e.ast,enumerable:!0,configurable:!0},"~standard":{value:n,writable:!0,enumerable:!0,configurable:!0}})}var vS=e=>e,yS=a(2,(e,t)=>bS(e,(e,n)=>[e,t(n)]));function bS(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;ft(n,e,t)}}return n}var xS=`~effect/Schema/SchemaError`;function SS(e){return F(e,`~effect/Schema/SchemaError`)&&e[`~effect/Schema/SchemaError`]===`~effect/Schema/SchemaError`}({...at}),{...at},{...at},{...at},{...at},{...at},{...at},{...at};var CS=aS;function wS(){return(e,t,n)=>BS(new lb(e.map(Fb),e=>t(e.map(e=>BS(e))),n))}function TS(e,t){return wS()([],()=>(t,n,r)=>e(t)?B(t):U(new Rv(n,t,r)),t)}var ES=class extends Da(`SchemaError`){[xS]=xS;constructor(e){let t=ct();lt(0);try{super({issue:e})}finally{lt(t)}}get message(){return ry(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[nt](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function DS(e){return SS(e)}function OS(e){return ys(e)?kS(e):Pp(e,e=>vp(()=>Su(e,e=>new ES(e))))}function kS(e){return Lu(e)?e:Nu(Su(e.cause,e=>new ES(e)))}function kre(e,t){let n;for(let r of e.reasons){if(!pu(r)||!DS(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 AS(e){let t=Bm(e);if(Lu(t))return t.value;throw kre(t.cause,`Sync adapter can only throw schema errors`)}function jS(e,t){return gS(e,t)}var Are=are;function MS(e,t){let n=Xx(e,t);return(e,t)=>OS(n(e,t))}var NS=MS,jre=lre;function PS(e,t){let n=ure(e,t);return(e,t)=>Jr(n(e,t),e=>new ES(e))}function FS(e,t){let n=MS(e,t);return(e,t)=>AS(n(e,t))}var Mre=FS;function IS(e,t){let n=dre(e,t);return(e,t)=>OS(n(e,t))}var LS=IS;function RS(e,t){let n=IS(e,t);return(e,t)=>AS(n(e,t))}var zS=RS,BS=sS;function VS(e){return F(e,CS)&&e[CS]===CS}var HS=vS(e=>BS(yx(e.ast),{schema:e})),W=vS(e=>{let t=cC(e);return BS(Nne(e.ast),{schema:t})}),US=vS(e=>BS(bx(e.ast),{schema:e})),WS=vS(e=>BS(wx(e.ast),{schema:e})),GS=vS(e=>BS(Tx(e.ast),{schema:e}));function G(e){let t=BS(new hb(e),{literal:e,transform(n){return t.pipe(pC(G(n),{decode:my(()=>n),encode:my(()=>e)}))}});return t}var KS=BS(_ne),qS=BS(mb),JS=BS(ub),YS=BS(fb),K=BS(_b),XS=BS(yb),ZS=BS(yne),QS=BS(gne);function $S(e,t){return BS(e,{fields:t,mapFields(e,t){let n=e(this.fields);return $S(Pb(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function q(e){return $S(Pb(e,void 0),e)}function eC(e,t){return BS(Lne(e.ast,t.ast),{key:e,value:t})}function tC(e,t){return BS(e,{elements:t,mapElements(e,t){let n=e(this.elements);return tC(Ib(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function nC(e){return tC(Ib(e),e)}var J=vS(e=>BS(new bb(!1,[],[e.ast]),{value:e})),rC=vS(e=>BS(new bb(!1,[e.ast],[e.ast]),{value:e}));function iC(e,t){return BS(e,{members:t,mapMembers(e,t){let n=e(this.members);return iC(Lb(n,this.ast.options,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function aC(e,t){return iC(Lb(e,t,void 0),e)}function oC(e){let t=e.map(G);return BS(Lb(t,void 0,void 0),{literals:e,members:t,mapMembers(e){return aC(e(this.members))},pick(e){return oC(e)},transform(e){return aC(t.map((t,n)=>t.transform(e[n])))}})}var sC=vS(e=>aC([e,JS])),cC=vS(e=>aC([e,YS]));function lC(e){return t=>BS(t.ast,{schema:t,identifier:e})}function uC(e){return t=>BS(jne(t.ast,new ky(e,o)),{schema:t})}function dC(e){return fC(e)}function fC(e){return t=>uC(Zm(e))(t)}function pC(e,t){return n=>BS(xx(n.ast,e.ast,t?Ny(t):Ry()),{from:n,to:e})}function Nre(){return(e,t)=>gC()(e,{decode:t,encode:dy})}function Pre(e){return t=>pC(WS(t),e)(t)}function Fre(e){return t=>BS(Fne(t.ast,e),{schema:t})}function Ire(e){return ys(e)&&e._tag===`Success`?e:Pp(e,e=>vp(()=>Su(e,e=>e.issue)))}function Lre(e,t){let n=t?.encodingStrategy===`omit`?vy():py();return t=>HS(GS(t)).pipe(pC(t,{decode:yy(Ire(e)),encode:n}))}function mC(e){return G(e).pipe(Fre(B(e)))}function Rre(e,t){return q({_tag:mC(e),...t})}function hC(e,t){return TS(t=>t instanceof e,t)}function gC(){return(e,t)=>new ib(e.ast,Ny(t))}var _C=ex,vC=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function zre(e){let t=new globalThis.RegExp(vC);return _C(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:vC,flags:``}]},...e})}function yC(e,t){let n=e.source,r=e.flags,i=/^[dg]*uy?$/.test(r),a=r===``?`new globalThis.RegExp(${Ge(n)})`:`new globalThis.RegExp(${Ge(n)}, ${Ge(r)})`;return nx(e,{toJsonSchema:()=>i?{pattern:r.endsWith(`y`)?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${a})`}),...t})}var Bre=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function bC(e,t){let n=Bre(e);return yC(n,{expected:e?`a UUID v${e}`:`a UUID`,representation:{id:`effect/schema/isUUID`,payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:`uuid`}),toCode:()=>({runtime:e===void 0?`Schema.isUUID()`:`Schema.isUUID(${e})`}),...t})}var xC=BS(tx);function Vre(e){let t=Un(e.order),n=e.formatter??Ge;return(r,i)=>_C(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...i})}function Hre(e){let t=Gn(e.order),n=e.formatter??Ge;return(r,i)=>_C(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 Ure(e){let t=Wn(e.order),n=e.formatter??Ge;return(r,i)=>_C(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 Wre(e){let t=Gn(e.order),n=Un(e.order),r=Wn(e.order),i=see(e.order),a=e.formatter??Ge;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return _C(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 SC(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ge(e)}`);return e}var CC=Vre({order:Vn,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:SC(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ge(e)})`})})}),wC=Hre({order:Vn,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:SC(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ge(e)})`})})}),TC=Ure({order:Vn,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:SC(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ge(e)})`})})}),EC=Wre({order:Vn,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:SC(e.minimum),maximum:SC(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ge(e.minimum)}, maximum: ${Ge(e.maximum)}, exclusiveMinimum: ${Ge(t)}, exclusiveMaximum: ${Ge(n)} })`})}}});function DC(e){return _C(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`,minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:`Schema.isInt()`}),arbitraryConstraint:{number:`integer`},...e})}var OC=XS.check(DC());function kC(e,t){return e=MC(e),AC(e,Math.ceil(e/2),t)}function AC(e,t,n){return _C(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})`}),[vv]:!0,arbitraryConstraint:{minLength:e},...n})}function Gre(e){return AC(1,1,e)}function jC(e,t){return e=MC(e),_C(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})`}),[vv]:!0,arbitraryConstraint:{maxLength:e},...t})}function MC(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function NC(e,t){return e=MC(e),_C(t=>Reflect.ownKeys(t).length>=e,{expected:`a value with at least ${e===1?`1 entry`:`${e} entries`}`,representation:{id:`effect/schema/isMinProperties`,payload:{minProperties:e}},toJsonSchema:({type:t})=>t===`object`?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[vv]:!0,arbitraryConstraint:{minProperties:e},...t})}function PC(e,t){let n=GS(e),r=cre(n.ast);return _C((e,t,n)=>{let i=Reflect.ownKeys(e),a=[];for(let e of i){let t=r(e,n);if(t!==void 0&&(a.push(new Pv([e],t)),n.errors===`first`))break}return!di(a)||new Lv(t,a,e,n)},{expected:`an object with property names matching the schema`,representation:{id:`effect/schema/isPropertyNames`,payload:null,schemas:[n.ast]},toJsonSchema:({schemas:e,type:t})=>t===`object`?{propertyNames:e[0]}:[{propertyNames:e[0]},!0],toCode:({schemas:e})=>({runtime:`Schema.isPropertyNames(${e[0].runtime})`}),[vv]:!0,...t})}var FC=K.check(Gre()),IC=e=>+(e?.includeStack===!0)|(e?.excludeCause===!0?2:0),LC=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},RC=[];function zC(e){let t=IC(e),n=RC[t];if(n!==void 0)return n;let r=xw.pipe(pC(qS,Ky(LC(t))));return RC[t]=r,r}globalThis.RegExp;var BC=K.annotate({expected:`a string that will be decoded as a URL`}),VC=hC(globalThis.URL,{representation:{id:`effect/schema/URL`,payload:null},toCode:()=>({runtime:`Schema.URL`,Type:`globalThis.URL`}),expected:`URL`,toCodecJson:()=>gC()(BC,qy)}),HC=BC.pipe(pC(VC,qy)),UC=K.annotate({expected:`a string that will be decoded as JSON`});function WC(e,t){return UC.pipe(pC(e,Yy(t)))}var GC=WC(qS);globalThis.File,globalThis.URLSearchParams;var KC=K.annotate({expected:`a string that will be decoded as a number`}).pipe(pC(XS,zy)),qC=K.annotate({expected:`a string that will be decoded as a finite number`}).pipe(pC(xC,zy)),JC=K.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),YC=hC(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>gC()(JC,Jy)});function XC(e,t){return BS(wS()([e,t],([e,t])=>(n,r,i)=>{if(!fu(n))return U(new Rv(r,n,i));switch(n._tag){case`Fail`:return Ym(Xx(e)(n.error,i),{onSuccess:vu,onFailure:e=>Bv(r,`error`,e,n,i)});case`Die`:return Ym(Xx(t)(n.defect,i),{onSuccess:yu,onFailure:e=>Bv(r,`defect`,e,n,i)});case`Interrupt`:return B(n)}},{representation:{id:`effect/schema/CauseReason`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.CauseReason(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Failure<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause.Failure`,toCodec:([e,t])=>gC()(aC([q({_tag:G(`Fail`),error:e}),q({_tag:G(`Die`),defect:t}),q({_tag:G(`Interrupt`),fiberId:cC(xC)})]),Fy({decode:e=>{switch(e._tag){case`Fail`:return vu(e.error);case`Die`:return yu(e.defect);case`Interrupt`:return bu(e.fiberId)}},encode:e=>{switch(e._tag){case`Fail`:return{_tag:`Fail`,error:e.error};case`Die`:return{_tag:`Die`,defect:e.defect};case`Interrupt`:return{_tag:`Interrupt`,fiberId:e.fiberId}}}}))}).ast,{error:e,defect:t})}function ZC(e,t){return BS(wS()([e,t],([e,t])=>{let n=J(XC(e,t));return(e,t,r)=>du(e)?Ym(Xx(n)(e.reasons,r),{onSuccess:mu,onFailure:n=>Bv(t,`reasons`,n,e,r)}):U(new Rv(t,e,r))},{representation:{id:`effect/schema/Cause`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Cause(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Cause<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause`,toCodec:([e,t])=>gC()(J(XC(e,t)),Fy({decode:mu,encode:({reasons:e})=>e}))}).ast,{error:e,defect:t})}var QC=Py({decode:(e,t)=>Xn(pg(e),{onNone:()=>U(new zv({expected:`a valid UTC DateTime string`},e,t)),onSome:e=>B(gg(e))}),encode:e=>B(Sg(e))}),$C=-864e13,ew=864e13;function tw(e,t,n){let r=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+ +(e.exclusiveMinimum===!0)),i=Math.min(n,e?.maximum===void 0?n:e.maximum.epochMilliseconds-+(e.exclusiveMaximum===!0));return r<=i?[r,i]:[t,n]}function nw(e,t){return OC.check(EC({minimum:e,maximum:t}))}var rw=TS(e=>ug(e)&&dg(e),{representation:{id:`effect/schema/DateTimeUtc`,payload:null},toCode:()=>({runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclarations:[`import * as DateTime from "effect/DateTime"`]}),expected:`DateTime.Utc`,toCodecArbitrary:({constraint:e})=>{let[t,n]=tw(e,$C,ew);return Nre()(nw(t,n),my(fg))},toCodecJson:()=>gC()(K,QC),toFormatter:()=>e=>e.toString()}),iw=K.annotate({expected:`a string that will be decoded as a DateTime.Utc`}).pipe(pC(rw,QC));function aw(e,t,n){return BS(wS()([e,t,n],([e,t,n])=>{let r=ZC(t,n);return(t,n,i)=>{if(!ju(t))return U(new Rv(n,t,i));switch(t._tag){case`Success`:return Ym(Xx(e)(t.value,i),{onSuccess:Mu,onFailure:e=>Bv(n,`value`,e,t,i)});case`Failure`:return Ym(Xx(r)(t.cause,i),{onSuccess:Nu,onFailure:e=>Bv(n,`cause`,e,t,i)})}}},{representation:{id:`effect/schema/Exit`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Exit(${e[0].runtime}, ${e[1].runtime}, ${e[2].runtime})`,Type:`Exit.Exit<${e[0].Type}, ${e[1].Type}, ${e[2].Type}>`,importDeclarations:[`import * as Exit from "effect/Exit"`]}),expected:`Exit`,toCodec:([e,t,n])=>gC()(aC([q({_tag:G(`Success`),value:e}),q({_tag:G(`Failure`),cause:ZC(t,n)})]),Fy({decode:e=>e._tag===`Success`?Mu(e.value):Nu(e.cause),encode:e=>Lu(e)?{_tag:`Success`,value:e.value}:{_tag:`Failure`,cause:e.cause}}))}).ast,{value:e,error:t,defect:n})}var ow=TS(G_,{representation:{id:`effect/http/UrlParams`,payload:null},toCode:()=>({runtime:`Schema.UrlParams`,Type:`UrlParams.UrlParams`,importDeclarations:[`import * as UrlParams from "effect/http/UrlParams"`]}),expected:`UrlParams`,toEquivalence:()=>Z_,toCodec:()=>gC()(J(nC([K,K])),Fy({decode:q_,encode:e=>e.params.map(([e,t])=>[e,V_(t)])}))}).pipe(pC(eC(K,aC([K,rC(K)])),Fy({decode:iv,encode:J_})));function sw(e,t){let n=typeof t?.label==`string`?t.label:void 0,r=t?.disallowJsonEncode===!0,i=n===void 0?r?{disallowJsonEncode:!0}:void 0:r?{label:n,disallowJsonEncode:!0}:{label:n},a=n===void 0?void 0:Xx(G(n));return BS(wS()([e],([e])=>(t,n,r)=>S_(t)?Xm(a===void 0?pp:Jm(a(t.label,r),e=>new Pv([`label`],e)),()=>Ym(Xx(e)(T_(t),r),{onSuccess:e=>C_(e,{label:t.label}),onFailure:()=>new Lv(n,[new Pv([`value`],new zv(void 0,t,r))],t,r)})):U(new Rv(n,t,r)),{representation:{id:`effect/schema/Redacted`,payload:i??null},toCode:({typeParameters:e})=>({runtime:i===void 0?`Schema.Redacted(${e[0].runtime})`:`Schema.Redacted(${e[0].runtime}, ${Ge(i)})`,Type:`Redacted.Redacted<${e[0].Type}>`,importDeclarations:[`import * as Redacted from "effect/Redacted"`]}),expected:`Redacted`,toCodecJson:([e])=>gC()(e,{decode:my(e=>C_(e,{label:n})),encode:r?uy(e=>`Cannot serialize Redacted`+(Yn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):my(T_)}),toEquivalence:([e])=>E_(e)}).ast,{value:e})}function cw(e,t){return pC(sw(WS(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:my(e=>C_(e,{label:t?.label})),encode:t?.disallowEncode?uy(e=>`Cannot encode Redacted`+(Yn(e)&&typeof e.value.label==`string`?` with label: "${e.value.label}"`:``)):my(T_)})(e)}var lw=globalThis.Symbol.for(`immer-draftable`),uw={};function dw(e,t,r,i,a){let o=hw(r,t,i),s=mw(t),c=class extends e{constructor(...[e,t]){let n=t?.[`~payload`],i=n?.token===uw?n.value:r.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:uw,value:i}})}static[CS]=CS;get[s](){return s}static[lw]=!0;static identifier=t;static fields=r.fields;static get ast(){return o(this).ast}static pipe(){return n(this,arguments)}static rebuild(e){return o(this).rebuild(e)}static make(e,t){return _re(wx(o(this).ast),e??{},t,e=>fw(this,e))}static makeOption(e,t){return Yx(o(this))(e??{},t)}static makeEffect(e,t){return o(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(lx(this.ast,e))}static annotateKey(e){return this.rebuild(vx(this.ast,e))}static check(...e){return this.rebuild(dx(this.ast,e))}static extend(e){return(t,n)=>{let i=gw(t)?t:q(t),o={...r.fields,...i.fields},s=Pb(o,r.ast.checks,{identifier:e});return dw(this,e,$S(dx(s,i.ast.checks),o),n,a)}}static mapFields(e,t){return r.mapFields(e,t)}};return a!==void 0&&Object.assign(c.prototype,a(t)),c}function fw(e,t){return new e(t,{"~payload":{token:uw,value:t}})}function pw(e){return new jy(my(t=>fw(e,t)),py())}function mw(e){return`~effect/Schema/Class/${e}`}function hw(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=mw(t),o=e=>e instanceof i||F(e,a),s=pw(i);return r=pC(BS(new lb([e.ast],()=>(e,t,n)=>o(e)?B(e):U(new Rv(t,e,n)),{identifier:t,[bv]:([e])=>({isConstructed:o,link:new ib(e,s)}),toCodec:([e])=>new ib(e.ast,s),toEquivalence:([e])=>e,toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[yv]:Bb(e.ast),...n})),s)(e)}}function gw(e){return VS(e)}var _w=e=>(t,n)=>dw(Ta,e,gw(t)?t:q(t),n,e=>({toString(){return`${e}(${Ge({...this})})`}})),vw=e=>(t,n)=>dw(on,e,gw(t)?t:q(t),n,e=>({name:e})),Y=e=>(t,n,r)=>{let i=gw(n)?n.mapFields(e=>({_tag:mC(t),...e}),{unsafePreserveChecks:!0}):Rre(t,n);return vw(e??t)(i,r)},yw=xre,bw=Tre,xw=BS(lx(Lx,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})})),Sw=`~effect/reactivity/AsyncResult`,Cw=e=>F(e,Sw),ww={[Sw]:{E:o,A:o},pipe(){return n(this,arguments)},[ye](e){if(!Cw(e)||this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return be(this.value,e.value);case`Failure`:return be(this.cause,e.cause)}},[ee](){let e=ce(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:re(e)(this._tag===`Success`?z(this.value):z(this.cause))}},Tw=e=>e.waiting,Ew=(e,t)=>e._tag===`Success`?Mw(e.value):Fw(e.cause,{previous:t}),Dw=e=>e._tag===`None`?Aw(!0):Lw(e.value),Ow=e=>e._tag===`Initial`,kw=e=>e._tag!==`Initial`,Aw=(e=!1)=>{let t=Object.create(ww);return t._tag=`Initial`,t.waiting=e,t},jw=e=>e._tag===`Success`,Mw=(e,t)=>{let n=Object.create(ww);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},Nw=e=>e._tag===`Failure`,Pw=(e,t)=>{let n=Object.create(ww);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??Kn(),n.waiting=t?.waiting??!1,n},Fw=(e,t)=>Pw(e,{previousSuccess:ar(t.previous,e=>jw(e)?qn(e):Nw(e)?e.previousSuccess:Kn()),waiting:t.waiting}),Iw=(e,t)=>Fw(hu(e),t),Lw=a(e=>Cw(e[0]),(e,t)=>{if(e.waiting)return t?.touch?Rw(e):e;let n=Object.assign(Object.create(ww),e);return n.waiting=!0,t?.touch&&jw(n)&&(n.timestamp=Date.now()),n}),Rw=e=>jw(e)?Mw(e.value,{waiting:e.waiting}):e,zw=a(2,(e,t)=>e._tag===`Failure`?Fw(e.cause,{previous:t,waiting:e.waiting}):e),Bw=e=>e._tag===`Success`?qn(e.value):e._tag===`Failure`?ir(e.previousSuccess,e=>e.value):Kn(),Vw=e=>nr(Bw(e),()=>new Du(`AsyncResult.getOrThrow: no value found`)),Hw=e=>{switch(e._tag){case`Success`:return Mu(e.value);case`Failure`:return Nu(e.cause);default:return Pu(new Du)}},Uw=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return Pw(e.cause,{previousSuccess:ir(e.previousSuccess,e=>Mw(t(e.value),e)),waiting:e.waiting});case`Success`:return Mw(t(e.value),e)}}),Ww=a(2,(e,t)=>{switch(e._tag){case`Initial`:return e;case`Failure`:return Pw(e.cause,{previousSuccess:ar(e.previousSuccess,e=>{let n=t(e.value,e);return jw(n)?qn(n):Kn()}),waiting:e.waiting});case`Success`:return t(e.value,e)}}),Gw=bo,Kw=So,qw=Co,Jw=wo,Yw=Eo,Xw=fo,Zw=ll,Qw=wl,$w=Tl,eT=`~effect/MutableRef`,tT={[eT]:eT,...wt,toJSON(){return{_id:`MutableRef`,current:rt(this.current)}}},nT=e=>{let t=Object.create(tT);return t.current=e,t},rT=a(2,(e,t)=>(e.current=t,e)),iT=Symbol.for(`effect/MutableList/Empty`),aT=()=>({head:void 0,tail:void 0,length:0}),oT=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})},sT=()=>({array:[],mutable:!0,offset:0,next:void 0}),cT=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=sT(),e.tail=e.tail.next):e.head=e.tail=sT(),e.tail.array.push(t),e.length++},lT=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.tail||=e.head,e.length++},uT=(e,t)=>dT(e,Array.from(t),!0),dT=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},fT=e=>{e.head=e.tail=void 0,e.length=0},pT=(e,t)=>{if(t=Hr(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return fT(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i.offset===i.array.length&&i.next?i.next:i,e.length-=t,e.length===0?fT(e):oT(e),n;i=i.next}return fT(e),n},mT=e=>pT(e,e.length),hT=e=>{if(!e.head)return iT;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:fT(e):oT(e),t},gT=(e,t)=>{let n=[],r=e.head,i=0;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],i++)&&n.push(r.array[e]);r=r.next}n.length===0?fT(e):(e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length)},_T=(e,t)=>gT(e,e=>e!==t),vT=`~effect/PubSub`,yT=`~effect/PubSub/Subscription`,bT=e=>V(()=>iie(e.atomicPubSub(),new Map,nd(),Qw(!1),nT(!1),e.strategy(),nT(Kn()))),xT=e=>bT({atomicPubSub:()=>Kre(e),strategy:()=>new aie}),Kre=e=>{let t=e?.replay;return new eie(t&&t>0?new cie(Math.ceil(t)):void 0)},ST=a(2,(e,t)=>e.shutdownFlag.current||Yn(e.ended.current)?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),qre=e=>bm(em(t=>{let n=Nr(t,ed),r=sd(e.scope),i=$re(e.pubsub,e.subscribers,e.strategy,e.ended);return ad(r,Jre(i)).pipe(Tp(id(n,e=>cd(r,e))),kp(i))})),Jre=e=>bm(Sp(t=>(rT(e.shutdownFlag,!0),sp(mT(e.pollers),e=>qu(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(Ep(()=>V(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.replayWindow.close(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),Yp(e.shutdownHook.open),jp)))),Yre=e=>fp(function t(n){if(e.shutdownFlag.current)return _m;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?B(e.replayWindow.takeAll().concat(r)):di(r)?B(r):Cp(Xre(e),e=>t([e]))}),Xre=e=>hp(t=>{if(e.shutdownFlag.current)return t(_m);if(Yn(e.ended.current)){let n=e.pollers.length===0?e.subscription.poll():iT;return n===iT?t(B(e.ended.current.value)):(e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),t(B(n)))}let n=Vu(),r=e.subscribers.get(e.subscription);return r||(r=new Set,e.subscribers.set(e.subscription,r)),r.add(e.pollers),cT(e.pollers,n),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),n.effect?t(n.effect):(n.resumes=[t],V(()=>_T(e.pollers,n)))}),CT=Symbol.for(`effect/PubSub/AbsentValue`),Zre=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},Qre=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},$re=(e,t,n,r)=>new nie(e,t,e.subscribe(),aT(),Qw(!1),nT(!1),n,e.replayWindow(),r),eie=class{publisherHead={value:CT,replayIndex:void 0,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=2**53-1;replayBuffer;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new lie(this.replayBuffer):uie}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.replayBuffer?.offer(e),n=this.publisherTail.subscribers;if(n!==0){let r={value:e,replayIndex:t,subscribers:n,next:null};this.publisherTail.next=r,this.publisherTail=this.publisherTail.next,this.publisherIndex+=1}return!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else this.replayBuffer&&this.replayBuffer.offerAll(e);return[]}slide(){if(this.publisherHead!==this.publisherTail){let e=this.publisherHead.next,t=e.value;this.publisherHead=this.publisherHead.next,this.publisherHead.value=CT,this.subscribersIndex+=1,this.replayBuffer?.slide(t,e.replayIndex)}}subscribe(){return this.publisherTail.subscribers+=1,new tie(this,this.publisherTail,this.publisherIndex,!1)}},tie=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,n,r){this.self=e,this.subscriberHead=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;for(;t;)this.subscriberHead===this.self.publisherTail?t=!1:this.subscriberHead.next.value===CT?(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1):(e=!1,t=!1);return e}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return iT;let e=!0,t=iT;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==CT&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=CT,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){e=Hr(e);let t=[],n=0;for(;n!==e;){let r=this.poll();r===iT?n=e:(t.push(r),n+=1)}return t}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,--this.self.publisherTail.subscribers;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==CT&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=CT,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},nie=class{[yT]={_A:o};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;ended;constructor(e,t,n,r,i,a,o,s,c){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s,this.ended=c}pipe(){return n(this,arguments)}},rie=class{[vT]={_A:o};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;ended;constructor(e,t,n,r,i,a,o){this.pubsub=e,this.subscribers=t,this.scope=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=a,this.ended=o}pipe(){return n(this,arguments)}},iie=(e,t,n,r,i,a,o)=>new rie(e,t,n,r,i,a,o),aie=class{get shutdown(){return pp}handleSurplus(e,t,n,r){return B(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return oie(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return sie(this,e,t)}},oie=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=hT(i);if(o===iT)Qre(n,r,i),i.length===0?a=!1:Zre(n,r,i);else{let a=r.poll();a===iT?lT(i,o):(Xu(o,Mu(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},sie=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)},cie=class{capacity;head={value:CT,index:0,next:null};tail=this.head;slideValues=[];size=0;index=0;publisherIndex=0;constructor(e){this.capacity=e}slide(e,t){this.slideValues[this.index%this.capacity]={value:e,index:t},this.index++}offer(e){let t=this.publisherIndex++;if(this.tail.value=e,this.tail.index=t,this.tail.next={value:CT,index:0,next:null},this.tail=this.tail.next,this.size===this.capacity){let e=this.head;this.head=e.next,e.next=null,e.value=CT}else this.size+=1;return t}offerAll(e){for(let t of e)this.offer(t)}},lie=class{buffer;values;index=0;remaining;slideIndex;newestIndex=-1;constructor(e){this.buffer=e,this.remaining=e.size,this.slideIndex=e.index,this.values=Array(this.remaining);let t=e.head;for(let e=0;e<this.remaining;e++)this.values[e]=t.value,this.newestIndex=t.index,t=t.next}close(){this.values.length=0,this.remaining=0}sync(){let e=this.buffer.index-this.slideIndex;if(e===0||this.remaining===0)return;let t=Math.min(e,this.buffer.capacity),n=this.buffer.index-t;for(let e=0;e<t;e++){let t=this.buffer.slideValues[(n+e)%this.buffer.capacity];t.index>this.newestIndex&&(this.index=(this.index+1)%this.values.length,this.values[(this.index+this.remaining-1)%this.values.length]=t.value,this.newestIndex=t.index)}this.slideIndex=this.buffer.index}take(){if(this.remaining===0)return;this.sync();let e=this.values[this.index];return this.values[this.index]=CT,this.index=(this.index+1)%this.values.length,this.remaining--,this.remaining===0&&this.close(),e}takeN(e){e=Hr(e);let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++)n[e]=this.take();return n}takeAll(){return this.takeN(this.remaining)}},uie={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[],close:()=>void 0},die=`~effect/Queue`,fie=`~effect/Queue/Enqueue`,pie=`~effect/Queue/Dequeue`,wT={_A:o,_E:o},mie={[die]:wT,[fie]:wT,[pie]:wT,...wt,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:vie(this)}}},TT=e=>an(t=>{let n=Object.create(mie);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=aT(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},Do(n)}),ET=e=>TT({capacity:e}),DT=e=>TT({capacity:e,strategy:`sliding`}),OT=a(2,(e,t)=>jo(()=>kT(e,t)?zT:e.state._tag===`Open`&&e.strategy===`suspend`?Sie(e,t):RT)),kT=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(hT(e.messages),cT(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0&&(cT(e.messages,t),BT(e),!0):(cT(e.messages,t),VT(e),!0):!1,hie=a(2,(e,t)=>Uo(n=>{let r=gie(e,t);return r.length===0||e.strategy===`dropping`?n(Qt(r)):GT(e,{_tag:`Array`,remaining:r,offset:0,resume:n})})),gie=(e,t)=>{if(e.state._tag!==`Open`)return si(t);if(e.capacity===1/0||e.strategy===`sliding`)return uT(e.messages,t),e.strategy===`sliding`&&pT(e.messages,e.messages.length-e.capacity),VT(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return si(t);let r=[],i=0;for(let a of t)i<n?cT(e.messages,a):r.push(a),i++;return VT(e),r},AT=a(2,(e,t)=>Ao(()=>jT(e,t))),jT=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=Is(tn(t),yie);return e.state.offers.size===0&&e.messages.length===0?(YT(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},VT(e),!0)},MT=e=>AT(e,Vt(pn())),NT=e=>Ao(()=>PT(e)),PT=e=>{if(e.state._tag===`Done`)return!1;fT(e.messages);let t=e.state.offers;YT(e,e.state._tag===`Open`?bie:e.state.exit);for(let e of t)KT(e);return!0},FT=e=>IT(e,1,1/0),IT=a(3,(e,t,n)=>(t=Hr(t),n=Hr(n),HT(()=>xie(e,t,n)??ps(WT(e,()=>UT(e,t)),IT(e,t,n))))),LT=e=>HT(()=>_ie(e)??ps(WT(e,()=>UT(e,1)),LT(e))),_ie=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=hT(e.messages);return JT(e),Qt(t)}if(e.capacity<=0&&e.state.offers.size>0){let t=qT(e.state.offers);return JT(e),Qt(t)}},vie=e=>e.state._tag===`Done`?0:e.messages.length,RT=Qt(!1),zT=Qt(!0),yie=nn(pn()),bie=Ds(),BT=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(Ms),e.messages.length===0))break}},VT=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,BT(e)},0))},xie=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Qt([]);if(!UT(e,t))return;let r=e.messages.length>0?pT(e.messages,n):[qT(e.state.offers)];return JT(e),Qt(r)},HT=Xt({op:`QueueTake`,[yt](e){let t=this[vt]();return Dt(t)?t[yt](e):t}}),UT=(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,WT=(e,t)=>Uo(n=>{if(e.state._tag===`Done`)return n(e.state.exit);if(t())return n(Ms);let r={ready:t,resume:n};return e.state.takers.add(r),Ao(()=>{e.state._tag!==`Done`&&e.state.takers.delete(r)})}),Sie=(e,t)=>Uo(n=>kT(e,t)?n(zT):GT(e,{_tag:`Single`,message:t,resume:n})),GT=(e,t)=>{if(e.state._tag!==`Open`)return KT(t);let n=e.state.offers;return n.add(t),Ao(()=>{e.state._tag!==`Done`&&(n.delete(t),e.state._tag===`Closing`&&n.size===0&&e.messages.length===0&&YT(e,e.state.exit))})},KT=e=>e._tag===`Single`?e.resume(RT):e.resume(Qt(e.remaining.slice(e.offset))),qT=e=>{let t=e.values().next().value;if(t._tag===`Single`)return e.delete(t),t.resume(zT),t.message;let n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Qt([]))),n},JT=e=>{if(e.state._tag===`Done`)return zf(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0&&(YT(e,e.state.exit),zf(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`)cT(e.messages,t.message),e.state.offers.delete(t),t.resume(zT);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;cT(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(Qt([]))}let r=e.state;if(r._tag===`Done`)return zf(r.exit.cause)}return!1},YT=(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()},XT=e=>new $T(e),ZT=e=>{for(let t of e.waiters)if(t.permits<=e.free)return t},QT=(e,t,n,r=o)=>an(i=>{if(e.free>=t&&ZT(e)===void 0)return e.taken+=t,n();let a={permits:t,resume:void 0},o=()=>{e.waiters.delete(a)&&e.releaseUnsafe(i,0)};e.waiters.add(a),Vc(i,o);let s=vs(r(Uo(t=>{ZT(e)===a?t(Lo):a.resume=t})),()=>ZT(e)===a?(e.taken+=t,o(),n()):s);return s}),$T=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){return QT(this,e,()=>Do(e))}takeScoped(e){return Jc(t=>vs(Lc,n=>QT(this,e,()=>jc(n,this.release(e)),t)))}takeIfAvailable(e){return jo(()=>this.free<e?Do(!1):(this.taken+=e,Do(!0)))}releaseUnsafe(e,t){return this.taken-=t,this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.free;for(let t of Array.from(this.waiters)){if(!this.waiters.has(t)||t.permits>e)continue;e-=t.permits;let n=t.resume;t.resume=void 0,n?.(Lo)}},0),this.free}resize(e){return an(t=>(this.permits=e,this.free<0||this.releaseUnsafe(t,0),Lo))}release(e){return an(t=>Do(this.releaseUnsafe(t,e)))}get releaseAll(){return an(e=>Do(this.releaseUnsafe(e,this.taken)))}withPermits(e){return t=>Jc(n=>QT(this,e,()=>Bc(n(t),()=>{this.releaseUnsafe(fo(),e)},!0),n))}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>Jc(n=>this.free<e?Po:(this.taken+=e,Bc(n(fs(t)),()=>{this.releaseUnsafe(fo(),e)},!0)))}},eE=e=>Ao(()=>new $T(e)),tE=(e,t)=>t?e.withPermit(t):e.withPermit,nE=`~effect/Channel`,rE=e=>F(e,nE),Cie={[nE]:{_Env:o,_InErr:o,_InElem:o,_OutErr:o,_OutElem:o},pipe(){return n(this,arguments)}},iE=e=>{let t=Object.create(Cie);return t.transform=(t,n)=>Pp(e(t,n),e=>B(_p(e))),t},aE=(e,t)=>iE((n,r)=>Cp(cE(e)(n,r),e=>t(e,r))),oE=e=>iE((t,n)=>e),sE=e=>iE(Hm(function*(t,n){let r=sd(n),i=e=>cd(r,Uf(e));return pm(yield*pm(e(t,n,r),i),i)})),cE=e=>e.transform,wie=(e,t,n)=>TT({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(Ep(t=>ad(e,NT(t))),Ep(n=>rd(t(n),e).pipe(Pp(e=>AT(n,e)),Dm(e,{startImmediately:!0})))),Tie=(e,t)=>iE((n,r)=>Op(wie(r,e,t),FT)),lE=e=>iE((t,n)=>fp(()=>cE(e())(t,n))),Eie=e=>oE(V(()=>{let t=e();return fp(()=>{let e=t.next();return e.done?ku(e.value):B(e.value)})})),Die=e=>oE(V(()=>{let t=0;return fp(()=>t>=e.length?ku():B(e[t++]))})),uE=e=>mE(B(e)),dE=oE(B(ku())),Oie=oE(B(gp)),fE=e=>oE(B(U(e))),pE=e=>oE(_p(e)),kie=e=>pE(gu(e)),mE=e=>oE(V(()=>{let t=!1;return fp(()=>t?ku():(t=!0,e))})),Aie=e=>oE(B(FT(e))),jie=e=>oE(B(ym(Yre(e),()=>ku()))),Mie=e=>BE(Op(qre(e),jie)),Nie=e=>iE((t,n)=>Pie({scope:n,readable:e.evaluate(),onError:e.onError,releaseLockOnEnd:e.releaseLockOnEnd})),Pie=e=>{let t=e.readable.getReader(),n=e.exit??nT(void 0),r=fp(()=>n.current?n.current:Zp(up({try:()=>t.read(),catch:e.onError}),{onFailure:e=>n.current??_p(e),onSuccess:({done:e,value:t})=>n.current?n.current:e?ku():B(mi(t))}));return kp(ad(e.scope,e.releaseLockOnEnd?V(()=>t.releaseLock()):lp(()=>t.cancel().catch(e=>t.closed.then(()=>Promise.reject(e),d))).pipe(fm(V(()=>t.releaseLock())))),r)},hE=a(2,(e,t)=>aE(e,e=>V(()=>{let n=0;return Op(e,e=>t(e,n++))}))),Fie=a(2,(e,t)=>aE(e,e=>B(Rf(e,e=>Cp(t(e),ku))))),gE=e=>e===void 0||e!==`unbounded`&&e<=1,_E=a(e=>rE(e[0]),(e,t,n)=>gE(n?.concurrency)?vE(e,t):yE(e,t,n)),vE=(e,t)=>iE((n,r)=>{let i=0;return Op(cE(e)(n,r),Cp(e=>t(e,i++)))}),yE=(e,t,n)=>sE(Hm(function*(r,i,a){let o=0,c=yield*cE(e)(r,i),l=n.concurrency===`unbounded`?2**53-1:Math.min(n.concurrency,2**53-1),u=yield*ET(0);yield*ad(a,NT(u));let d=jm(yield*$p()),f=Zw(a);if(n.unordered){let e=XT(l),n=s(e.release(1)),r=Zp({onFailure:e=>Cp(AT(u,e),n),onSuccess:e=>Cp(OT(u,e),n)});yield*e.take(1).pipe(Cp(()=>c),Cp(e=>{let n=o++;return f(d(r(fp(()=>t(e,n))))),pp}),Sm({disableYield:!0}),Pp(t=>e.withPermits(l-1)(AT(u,t))),Dm(a))}else{let e=yield*ET(l-2);yield*ad(a,NT(e)),yield*LT(e).pipe(wp,Cp(e=>OT(u,e)),Sm({disableYield:!0}),Pp(e=>AT(u,e)),Dm(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,jT(u,e.cause))};yield*c.pipe(Cp(i=>{if(n)return _p(n);let a=o++,s=d(fp(()=>t(i,a)));return f(s),s.addObserver(r),OT(e,Kw(s))}),Sm({disableYield:!0}),Pp(t=>OT(e,Nu(t)).pipe(Tp(AT(e,t)))),Dm(a))}return LT(u)})),bE=a(e=>rE(e[0]),(e,t,n)=>gE(n?.concurrency)?xE(e,t):SE(e,t,n)),xE=(e,t)=>iE((n,r)=>Op(cE(e)(n,r),e=>{let i,a,o=Cp(e,e=>(a??=sd(r),Xm(cE(t(e))(n,a),e=>(i=s(e),i)))),s=Rf(e=>{if(i=void 0,a.state._tag===`Empty`)return o;let t=cd(a,Iu);return a=void 0,Cp(t,()=>o)});return fp(()=>i??o)})),SE=(e,t,n)=>e.pipe(hE(t),IE(n)),CE=e=>bE(e,o),wE=e=>aE(e,e=>{let t,n=0;return B(fp(function r(){if(t===void 0)return Cp(e,e=>{switch(e.length){case 0:return r();case 1:return B(e[0]);default:return t=e,B(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),B(i)}))}),TE=e=>aE(e,e=>B(Sm(e,{disableYield:!0}))),EE=a(2,(e,t)=>Xf(typeof t==`function`?t(o):t).pipe(Op(t=>{let n=Gf.defaultValue();return DE(JE(e,Gf,V(()=>n)),e=>Ru(e)?_p(e.cause):t(e.value).pipe(Op(e=>{n=e}),Rf(()=>ku(e.value))))}),BE)),DE=(e,t)=>iE((n,r)=>V(()=>{let i,a=()=>{let o=sd(r);return Cp(cE(e)(n,o),e=>(i=Pp(e,e=>{let n=Uf(e);return cd(o,n).pipe(Cp(()=>t(n,r)),Cp(a))}),i))};return fp(()=>i??a())})),OE=a(2,(e,t)=>iE((n,r)=>Op(cE(e)(n,r),e=>Cp(e,function n(r){return t(r)?B(r):Cp(e,n)})))),kE=a(2,(e,t)=>aE(e,e=>B(Cp(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return fi(i)?B(i):Cp(e,n)})))),AE=a(2,(e,t)=>iE((n,r)=>{let i=sd(r);return Op(cE(e)(n,i),e=>{let a=e.pipe(Pp(e=>{if(zf(e))return _p(e);let o=i;return i=sd(r),cd(o,Nu(e)).pipe(Tp(cE(t(e))(n,i)),Cp(e=>(a=e,e)))}));return fp(()=>a)})})),jE=a(3,(e,t,n)=>AE(e,e=>{let r=t(e);return Kr(r)?pE(r.failure):n(r.success,e)})),ME=a(2,(e,t)=>jE(e,Ya,e=>t(e))),NE=a(e=>rE(e[0]),(e,t,n,r)=>ME(e,e=>t(e)?n(e):r?r(e):fE(e))),PE=a(2,(e,t)=>aE(e,e=>B(Fp(e,e=>Ou(e)?e:t(e))))),FE=a(e=>rE(e[0]),(e,t,n)=>e.pipe(hE(t),IE({...n,concurrency:n?.concurrency??1,switch:!0}))),IE=a(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>sE(Hm(function*(i,a,o){let s=n===`unbounded`?2**53-1:Math.max(1,n),c=r?void 0:XT(s),l=yield*$w(!0),u=new Map,d=yield*ET(t);yield*ad(o,NT(d));let f=yield*cE(e)(i,a);return yield*H(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*Em(f),yield*Jp(c.take(1),Tp(Kw(e),gp))));let t=e===void 0?yield*f:yield*Kw(e),n=sd(o),r=yield*cE(t)(i,n);for(;u.size>=s;){let[e,t]=Zr(u);u.delete(e),u.size===0&&(yield*l.open),yield*Jw(e),yield*Vp(cd(t,Fu()))}let a=yield*r.pipe(Ep(()=>xp),Cp(e=>OT(d,e)),Sm({disableYield:!0}),pm(Hm(function*(e){let t=Uf(e),r=yield*Dp(cd(n,t));if(!u.has(a))return;let i=zu([t,r]);Ru(i)&&(yield*AT(d,i.cause)),u.delete(a),c&&(yield*c.release(1)),u.size===0&&(yield*l.open)})),Em);l.closeUnsafe(),u.set(a,n)}}).pipe(Pp(e=>qr(Vf(e))?l.whenOpen(AT(d,e)):AT(d,e)),Dm(o)),LT(d)}))),LE=a(e=>rE(e[0])&&rE(e[1]),(e,t,n)=>sE(Hm(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*ET(0);yield*ad(a,NT(s));let c=0;function l(e,t){if(c++,!zf(t))return AT(s,t);switch(o){case`both`:return c===2?AT(s,t):pp;case`left`:case`right`:return e===o?AT(s,t):pp;case`either`:return AT(s,t)}}let u=(e,t,n)=>cE(t)(r,n).pipe(Cp(e=>e.pipe(Cp(e=>OT(s,e)),Sm)),pm(t=>mm(Uf(t),e=>cd(n,e)).pipe(Zp({onFailure:t=>l(e,t),onSuccess:()=>l(e,t)}))),Dm(a));return yield*u(`left`,e,sd(a)),yield*u(`right`,t,sd(a)),LT(s)}))),RE=(e,t)=>iE((n,r)=>V(()=>{let r=new TextDecoder(e,t),i={stream:!0},a=n.pipe(Op(hi(e=>r.decode(e,i))),Rf(e=>{a=ku(e);let t=r.decode();return t.length>0?B(mi(t)):a}));return fp(()=>a)})),zE=a(2,(e,t)=>iE((n,r)=>Cp(cE(e)(n,r),e=>cE(t)(e,r)))),BE=e=>iE((t,n)=>{let r;return B(fp(()=>r||e.pipe(rd(n),Cp(e=>cE(e)(t,n)),Cp(e=>r=e))))}),VE=a(2,(e,t)=>LE(e,oE(B(Cp(t,ku))),{haltStrategy:`either`})),HE=a(2,(e,t)=>sE((n,r,i)=>id(i,t).pipe(Tp(cE(e)(n,r))))),UE=a(2,(e,t)=>aE(e,e=>B(Rf(e,e=>Cp(t,()=>ku(e)))))),WE=a(2,(e,t)=>HE(e,e=>t)),GE=(e,t,n)=>fp(()=>{let r=nd();return Rf(Cp(cE(e)(ku(),r),t),n||B).pipe(hm(e=>cd(r,e)))}),KE=a(2,(e,t)=>iE((n,r)=>Op(nm(cE(e)(n,r),t),nm(t)))),qE=a(3,(e,t,n)=>iE((r,i)=>Op(am(cE(e)(r,i),t,n),am(t,n)))),JE=a(3,(e,t,n)=>iE((r,i)=>Cp(n,n=>cE(qE(e,t,n))(r,i)))),YE=a(2,(e,t)=>GE(e,e=>Sm(Cp(e,t),{disableYield:!0}))),XE=e=>Op(QE(e,()=>({bytes:0,arrays:[]}),(e,t)=>{for(let n=0;n<t.length;n++)e.bytes+=t[n].length,e.arrays.push(t[n]);return e}),({arrays:e,bytes:t})=>{let n=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}),ZE=e=>fp(()=>{let t=Kn();return GE(e,e=>e.pipe(Ap,Cp(e=>(t=e,ku()))),()=>B(t))}),QE=a(3,(e,t,n)=>fp(()=>{let r=t();return GE(e,e=>cp({while:c,body:()=>e,step:e=>{r=n(r,e)}}),()=>B(r))})),$E=Hm(function*(e){let t=XT(1),n=yield*$p(),r=Nr(n,ed);return(yield*cE(e)(ku(),r)).pipe(nm(n),t.withPermits(1))},Pp(e=>B(_p(e)))),eD=(e,t)=>cE(e)(ku(),t),tD=`~effect/Stream`,nD={_R:o,_E:o,_A:o},rD=function(e){this.channel=e};rD.prototype={[tD]:nD,pipe(){return n(this,arguments)}};var iD=e=>new rD(e),aD=`~effect/RcMap`,oD=e=>({[aD]:aD,lookup:e.lookup,context:e.context,scope:e.scope,idleTimeToLive:e.idleTimeToLive,capacity:e.capacity,state:{_tag:`Open`,map:$f()},pipe(){return n(this,arguments)}}),sD=e=>Sp(t=>{let n=t.context,r=Nr(n,ed),i=oD({lookup:e.lookup,context:n,scope:r,idleTimeToLive:typeof e.idleTimeToLive==`function`?p(e.idleTimeToLive,Ni):s(Ni(e.idleTimeToLive??Ui)),capacity:Math.max(e.capacity??1/0,0)});return kp(id(r,()=>{if(i.state._tag===`Closed`)return pp;let e=i.state.map;return i.state={_tag:`Closed`},sp(e,([,e])=>Dp(uD(e))).pipe(Ep(()=>V(()=>{sne(e)})),Cp(zu))}),i)}),cD=a(2,(e,t)=>xm(n=>{if(e.state._tag===`Closed`)return _m;let r=e.state,i=Xw(),a=ep(r.map,t),o;if(a._tag===`Some`)o=a.value,o.refCount++;else if(Number.isFinite(e.capacity)&&ip(e.state.map)>=e.capacity)return U(new Rte(`RcMap attempted to exceed capacity of ${e.capacity}`));else{o={deferred:Vu(),scope:nd(),idleTimeToLive:e.idleTimeToLive(t),finalizer:void 0,fiber:void 0,expiresAt:0,refCount:1},o.finalizer=dD(e,t,o),np(r.map,t,o);let n=new Map(e.context.mapUnsafe);i.context.mapUnsafe.forEach((e,t)=>{n.set(t,e)}),n.set(ed.key,o.scope);let a=br(n);fp(()=>e.lookup(t)).pipe(jm(a),Zw(o.scope)).addObserver(n=>{Bte(n)&&lD(e,t,o,a),Xu(o.deferred,n)})}return ad(Mr(i.context,ed),o.finalizer).pipe(Tp(n(Uu(o.deferred))))})),lD=(e,t,n,r)=>{if(e.state._tag===`Closed`)return;let i=ep(e.state.map,t);i._tag!==`None`&&i.value===n&&(rp(e.state.map,t),n.refCount>0||uD(n).pipe(Vp({log:`Unhandled`,message:`Unhandled error in RcMap finalizer`}),jm(r),Zw(e.scope)))},uD=e=>e.fiber?Jw(e.fiber).pipe(Tp(cd(e.scope,Iu))):cd(e.scope,Iu),dD=(e,t,n)=>Sp(r=>{if(n.refCount--,n.refCount>0)return pp;if(e.state._tag===`Closed`)return uD(n);let i=ep(e.state.map,t);if(i._tag===`None`||i.value!==n)return uD(n);if(Hi(n.idleTimeToLive))return rp(e.state.map,t),uD(n);if(!Vi(n.idleTimeToLive))return pp;let a=r.getRef(Bd);return n.expiresAt=a.currentTimeMillisUnsafe()+Qi(n.idleTimeToLive),n.fiber||=xm(function r(i){let o=a.currentTimeMillisUnsafe(),s=n.expiresAt-o;if(s<=0){if(e.state._tag===`Closed`||n.refCount>0)return pp;let r=ep(e.state.map,t);return r._tag===`None`||r.value!==n?pp:(rp(e.state.map,t),Vp(cd(n.scope,Iu),{log:`Unhandled`,message:`Unhandled error in RcMap finalizer`}))}return Cp(i(a.sleep(qi(s))),()=>r(i))}).pipe(fm(V(()=>{n.fiber=void 0})),jm(r.context),Zw(e.scope)),pp}),fD=`~effect/Stream`,pD=e=>F(e,fD),mD=iD,hD=e=>mD(mE(Op(e,mi))),gD=e=>mD(oE(e)),_D=(e,t)=>mD(iE((n,r)=>Cp(eD(e.channel,r),e=>t(e,r)))),vD=e=>e.channel,yD=(e,t)=>mD(Tie(e,t)),bD=mD(dE),xD=e=>mD(uE(mi(e))),SD=(...e)=>DD(e),CD=e=>{let t=mD(lE(()=>e().channel));return wD.set(t,e),t},wD=new WeakMap,TD=e=>mD(fE(e)),ED=e=>mD(kie(e)),DD=e=>fi(e)?mD(uE(e)):bD,OD=e=>mD(Aie(e)),kD=e=>mD(Mie(e)),AD=e=>mD(Nie(e)),jD=(e,t)=>gD(V(()=>{let n=e,r=!1;return fp(function e(){return r?ku():Cp(t(n),([t,i])=>(Jn(i)?r=!0:n=i.value,fi(t)?B(t):e()))})})),MD=mD(Oie),ND=e=>mD(BE(Op(e,vD))),PD=a(2,(e,t)=>CD(()=>{let n=0;return mD(hE(e.channel,hi(e=>t(e,n++))))})),FD=a(e=>pD(e[0]),(e,t,n)=>e.channel.pipe(wE,_E(t,n),hE(mi),mD)),ID=a(2,(e,t)=>mD(_E(e.channel,t))),LD=a(e=>pD(e[0]),(e,t,n)=>e.channel.pipe(wE,FE(e=>t(e).channel,n),mD)),RD=e=>mD(TE(e.channel)),zD=a(2,(e,t)=>mD(EE(e.channel,t))),BD=a(2,(e,t)=>{let n=mD(CE(Eie(()=>HD(e,t))));return VD.set(n,[e,t]),n}),VD=new WeakMap;function*HD(e,t){let n=[t,e];for(;n.length>0;){let e=n.pop(),t=VD.get(e);if(t!==void 0){n.push(t[1],t[0]);continue}let r=wD.get(e);if(r===void 0)yield e.channel;else{try{n.push(r())}catch(e){n.push(ED(e))}yield dE}}}var UD=a(e=>pD(e[0])&&pD(e[1]),(e,t,n)=>mD(LE(vD(e),vD(t),n))),WD=(...e)=>mD(lE(()=>{let t=[],n=new Set,r=Qw(),i=Qw();return IE(Die(e.map((a,o)=>a.channel.pipe(wE,_E(i=>(t[o]=i,n.has(o)?B(mi(t.slice())):(n.add(o),n.size<e.length?r.await:kp(r.open,mi(t.slice()))))),OE(k),Fie(()=>n.has(o)?pp:i.open)))),{concurrency:`unbounded`,bufferSize:0}).pipe(VE(i.await))})),GD=a(3,(e,t,n)=>PD(WD(e,t),([e,t])=>n(e,t))),KD=a(2,(e,t)=>mD(kE(vD(e),t))),qD=a(e=>pD(e[0]),(e,t,n,r)=>mD(NE(vD(e),t,e=>n(e).channel,r&&(e=>r(e).channel)))),JD=a(2,(e,t)=>mD(PE(e.channel,t))),YD=a(e=>pD(e[0]),(e,t,n)=>_D(e,(e,r)=>V(()=>{let r=0,i=!1;return Cp(fp(()=>i?ku():e),e=>{let a=e.findIndex(e=>t(e,r++));if(a>=0){i=!0;let t=e.slice(0,n?.excludeLast?a:a+1);return fi(t)?B(t):ku()}return B(e)})}))),XD=a(2,(e,t)=>mD(zE(e.channel,t))),ZD=a(e=>pD(e[0]),(e,t)=>e.channel.pipe(zE(RE(t?.encoding)),mD)),QD=a(2,(e,t)=>mD(VE(e.channel,t))),$D=a(2,(e,t)=>mD(UE(e.channel,t))),eO=a(2,(e,t)=>mD(WE(e.channel,t))),tO=a(2,(e,t)=>mD(KE(e.channel,t))),nO=e=>Op(ZE(e.channel),ir(mee(0))),rO=a(2,(e,t)=>YE(e.channel,e=>{let n=0;return cp({while:()=>n<e.length,body:()=>t(e[n++]),step:d})})),iO=a(2,(e,t)=>YE(e.channel,t)),aO=e=>$E(e.channel),oO=e=>Op(XE(e.channel),e=>e.buffer),sO=a(e=>pD(e[0]),(e,t,n)=>{let r,i,a=!1,o=Qw(!1),s=n?.signal,c=()=>i.interruptUnsafe();return new ReadableStream({start(n){i=Am(nm(YE(aE(e.channel,e=>B(o.whenOpen(e))),e=>V(()=>{o.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0})),t)),i.addObserver(e=>{s?.removeEventListener(`abort`,c),a||(e._tag===`Failure`&&s?.aborted!==!0?n.error(wu(e.cause)):n.close())}),s!==void 0&&i.pollUnsafe()===void 0&&(s.aborted?c():s.addEventListener(`abort`,c,{once:!0}))},pull(){return new Promise(e=>{r=e,o.openUnsafe()})},cancel(){if(i)return a=!0,Pm(jp(Jw(i)))}},n?.strategy)}),cO=a(e=>pD(e[0]),(e,t)=>Op($p(),n=>sO(e,n,t))),lO=`~effect/reactivity/Reactivity`,uO=dr(`effect/reactivity/Reactivity`),dO=V(()=>{let e=new Map,t=t=>{let n=new Set;for(let r of t)e.get(r)?.forEach(e=>{n.has(e)||(n.add(e),e())})},n=e=>{let n=new Set;_O(e,e=>n.add(e)),t(n)},r=e=>em(t=>{let r=Ar(t,fO);return r?_O(e,e=>{r.add(e)}):n(e),pp}),i=(e,t)=>Ep(t,r(e)),a=(t,n)=>{let r=[];return _O(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i!==void 0&&(i.delete(n),i.size===0&&e.delete(r[t]))}}},o=(e,t)=>H(function*(){let n=yield*$p(),r=Nr(n,ed),i=yield*TT(),o=p(jm(n),Zw(r)),s=!1,c=!1,l=!1,u=e=>{e._tag===`Failure`?(l=!0,c=!1,s=!1,f(),jT(i,e.cause)):(kT(i,e.value),c?(c=!1,o(t).addObserver(u)):s=!1)};function d(){l||(s?c=!0:(s=!0,o(t).addObserver(u)))}let f=a(e,d);return yield*ad(r,V(f)),d(),i}),s=(e,t)=>o(e,t).pipe(Op(OD),ND),c=e=>fp(()=>{let n=new Set;return e.pipe(am(fO,n),hm(e=>V(()=>t(n))))});return uO.of({[lO]:lO,mutation:i,query:o,stream:s,invalidateUnsafe:n,invalidate:r,registerUnsafe:a,withBatch:c})}),fO=class extends dr()(`effect/reactivity/Reactivity/PendingInvalidation`){},pO=a(2,(e,t)=>uO.use(n=>n.mutation(t,e))),mO=e=>uO.use(t=>t.invalidate(e)),hO=kd(uO)(dO);function gO(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return z(e)}}var _O=(e,t)=>{if(Array.isArray(e))for(let n=0;n<e.length;n++)t(gO(e[n]));else for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${gO(r[e])}`)}},vO=a(2,(e,t)=>e===void 0?void 0:t(e)),yO=a(2,(e,{onDefined:t,onUndefined:n})=>e===void 0?n():t(e)),bO=`~effect/persistence/KeyValueStore`,xO=`~effect/persistence/KeyValueStore/KeyValueStoreError`,SO=class extends Da(`KeyValueStoreError`){[xO]=xO},CO=dr(`effect/persistence/KeyValueStore`),wO=e=>CO.of({[bO]:bO,has:t=>Op(e.get(t),k),isEmpty:Op(e.size,e=>e===0),clearPrefix:t=>t.length===0?e.clear:Cp(e.keys,n=>sp(n,n=>n.startsWith(t)?e.remove(n):pp,{discard:!0})),modify:(t,n)=>Cp(e.get(t),r=>{if(r===void 0)return mp;let i=n(r);return kp(e.set(t,i),i)}),modifyUint8Array:(t,n)=>Cp(e.getUint8Array(t),r=>{if(r===void 0)return mp;let i=n(r);return kp(e.set(t,i),i)}),...e}),TO=e=>{let t=new TextEncoder;return wO({...e,getUint8Array:n=>e.get(n).pipe(Op(vO(e=>Yr(Qh(e),{onFailure:()=>t.encode(e),onSuccess:o})))),set:(t,n)=>typeof n==`string`?e.set(t,n):fp(()=>e.set(t,Zh(n)))})},EO=`~effect/persistence/KeyValueStore/SchemaStore`,DO=(e,t)=>{let n=WC(yw(t)),r=NS(n),i=LS(n),a=t=>Cp(e.get(t),yO({onUndefined:()=>dp,onDefined:e=>Ap(r(e))})),o=(t,n)=>Cp(i(n),n=>e.set(t,n)),s=(e,t)=>Cp(a(e),n=>{if(Jn(n))return dp;let r=t(n.value);return kp(o(e,r),qn(r))});return{[EO]:EO,get:a,set:o,modify:s,remove:e.remove,clear:e.clear,size:e.size,keys:e.keys,has:e.has,isEmpty:e.isEmpty}},OO=e=>Dd(CO)(()=>{let t=e();return TO({get:e=>bp({try:()=>t.getItem(e)??void 0,catch:t=>new SO({key:e,method:`get`,message:`Unable to get item with key ${e}`,cause:t})}),set:(e,n)=>bp({try:()=>t.setItem(e,n),catch:t=>new SO({key:e,method:`set`,message:`Unable to set item with key ${e}`,cause:t})}),remove:e=>bp({try:()=>t.removeItem(e),catch:t=>new SO({key:e,method:`remove`,message:`Unable to remove item with key ${e}`,cause:t})}),clear:bp({try:()=>t.clear(),catch:e=>new SO({method:`clear`,message:`Unable to clear storage`,cause:e})}),clearPrefix:e=>bp({try:()=>{let n=[];for(let r=0;r<t.length;r++){let i=t.key(r);i!==null&&i.startsWith(e)&&n.push(i)}for(let e of n)t.removeItem(e)},catch:t=>new SO({key:e,method:`clearPrefix`,message:`Unable to clear items with prefix ${e}`,cause:t})}),size:bp({try:()=>t.length,catch:e=>new SO({method:`size`,message:`Unable to get size`,cause:e})}),keys:bp({try:()=>{let e=[];for(let n=0;n<t.length;n++){let r=t.key(n);r!==null&&e.push(r)}return e},catch:e=>new SO({method:`keys`,message:`Unable to get keys`,cause:e})})})}),kO=`~effect/SubscriptionRef`,AO=e=>F(e,kO),jO={...wt,[kO]:{_A:o},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},MO=e=>Op(xT({replay:1}),t=>{let n=Object.create(jO);return n.semaphore=XT(1),n.value=e,n.pubsub=t,ST(n.pubsub,e),n}),NO=e=>kD(e.pubsub),PO=e=>V(()=>e.value),FO=(e,t)=>{e.value=t,ST(e.pubsub,t)},IO=a(2,(e,t)=>e.semaphore.withPermit(V(()=>{let[n,r]=t(e.value);return FO(e,r),n}))),LO=a(2,(e,t)=>e.semaphore.withPermit(V(()=>FO(e,t)))),RO=a(2,(e,t)=>e.semaphore.withPermit(V(()=>FO(e,t(e.value))))),zO=(e,t)=>!Cw(e)||!Cw(t)?!0:Ow(t)?Ow(e):jw(e)&&jw(t)?t.timestamp>=e.timestamp:!0,BO=`~effect/reactivity/AtomRegistry`,VO=e=>F(e,BO),HO=e=>new QO(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),UO=dr(BO),WO=a(2,(e,t)=>yD(n=>fp(()=>ad(Mr(Xw().context,ed),V(e.subscribe(t,e=>kT(n,e),{immediate:!0})))))),GO=a(e=>VO(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return hp(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(Hw(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(Hw(e)),a())});return V(a)})}),KO={immediate:!0},qO=e=>{e()},JO={};function YO(e,t){let n=JO;for(let r of e)try{t(r)}catch(e){n===JO&&(n=e)}if(n!==JO)throw n}var XO=`~effect-atom/atom/Atom/Serializable`,ZO=e=>XO in e?e[XO].key:e,QO=class{[BO];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[BO]=BO,this.scheduler=new xa(`sync`,t),this.schedulerAsync=new xa(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,this.timeoutResolution=n===void 0&&r!==void 0?Math.round(r/2):n??1e3,e!==void 0)for(let[t,n,r]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n,r?.skipInitialRun)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);if(n?.immediate)t(r.value());else try{r.value()}catch(e){if((r.state&$O.waitingForValue)===0)throw e}let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,d,KO)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=ZO(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[XO],a;try{a=i.decode(r)}catch(e){if(DS(e))return n;throw e}let o=e;for(;o.initialValueTarget;)o=o.initialValueTarget;let s=o===e?n:this.ensureNode(o);zO(s._value,a)&&s.setInitialValue(a,i.skipInitialRun)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new tk(this,e)}invalidateAtom=e=>{let t=this.ensureNode(e);t.skipInitialRun=!1,t.invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get(ZO(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete(ZO(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete(ZO(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),YO(t,this.removeIdleNode)}removeIdleNode=e=>{if(this.nodeTimeoutBucket.delete(e),e.canBeRemoved){this.nodes.delete(ZO(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL;try{e.remove()}finally{this.#e=null}}};reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear();let e=Array.from(this.nodes.values());this.nodes.clear();for(let t of e)t.state=ek.removed;YO(e,this.destroyNode)}destroyNode=e=>{e.remove(),this.onNodeRemoved?.(e)};dispose(){this.disposed=!0,this.reset()}},$O={alive:1,initialized:2,waitingForValue:4},ek={uninitialized:$O.alive|$O.waitingForValue,stale:$O.alive|$O.initialized|$O.waitingForValue,valid:$O.alive|$O.initialized,removed:0},tk=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new ak(e,this)}registry;atom;state=ek.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;skipInitialRun=!1;keptParents;invalidatedDuringBuild=!1;failed=!1;parents=new Set;children=new Set;listeners=new Set;observedChildren=0;currentState(){switch(this.state){case ek.uninitialized:return`uninitialized`;case ek.stale:return`stale`;case ek.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}get building(){return this.lifetime!==void 0&&this.lifetime.reads!==void 0}get isObserved(){return!this.atom.lazy||this.listeners.size>0||this.observedChildren>0}childObserved(e){let t=this.isObserved;this.observedChildren+=e,t!==this.isObserved&&this.observedChanged(e)}observedChanged(e){for(let t of this.parents)t.childObserved(e)}_value=void 0;value(){for(;(this.state&$O.waitingForValue)!==0;)this.build();return this._value}build(){let e=ik(this);try{this.disposeLifetime()}catch(t){e.failure=t}this.invalidatedDuringBuild=!1,this.lifetime=e;let t,n=!1;try{t=this.atom.read(e),n=!0}finally{let t=e.reads;e.reads=void 0,this.lifetime===e&&(this.dropUnread(t),n||this.fail())}if(this.lifetime===e&&(this.state&$O.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.skipInitialRun&&(this.keptParents=Array.from(this.parents,e=>[e,e.lifetime])),this.failed=!1,this.state=ek.valid):this.setValue(t)),e.failure!==JO)throw e.failure}fail(){this.failed=!0;try{this.invalidateChildren()}catch{}}readTracked(e,t){let n=this.registry.ensureNode(e);this.parents.has(n)||(this.parents.add(n),n.children.add(this),this.isObserved&&n.childObserved(1));try{return n.value()}catch(e){if(t.reads===void 0||n.state!==ek.valid)throw e;return t.failure===JO&&(t.failure=e),n._value}finally{t.reads!==void 0&&!t.disposed&&t.reads.add(n)}}dropUnread(e){if(e.size===this.parents.size)return;let t=this.isObserved;for(let n of this.parents)e.has(n)||(this.parents.delete(n),n.children.delete(this),t&&n.childObserved(-1),n.canBeRemoved&&this.registry.scheduleNodeRemoval(n))}valueOption(){return(this.state&$O.initialized)===0?Kn():qn(this._value)}setInitialValue(e,t=!1){(this.state&$O.initialized)===0?(this.preserveInitialValueOnBuild=!0,this.skipInitialRun=t,this.state=ek.stale,this._value=e,this.listeners.size>0&&this.announce()):this.setValue(e)}setValue(e){let t=this.failed;this.failed=!1;let n=(this.state&$O.initialized)!==0;if(this.state=ek.valid,n&&this.atom.equals(this._value,e)){t&&this.invalidateChildren();return}this._value=e;let r=JO;try{(n||t)&&this.invalidateChildren()}catch(e){r=e}if(this.listeners.size>0)try{this.announce()}catch(e){r===JO&&(r=e)}if(r!==JO)throw r}announce(){sk.phase===ok.collect?sk.notify.add(this):this.notify()}invalidate(){if(this.state===ek.valid){this.state=ek.stale;try{this.disposeLifetime()}finally{this.propagate()}}else this.building&&sk.phase!==ok.collect?this.build():this.propagate()}propagate(){sk.phase===ok.collect?(this.building&&(this.invalidatedDuringBuild=!0),sk.stale.push(this)):this.isObserved?this.value():this.invalidateChildren()}invalidateChildren(){if(this.children.size===0)return;let e=JO;for(let t of Array.from(this.children))if(t.affectedBy(this))try{t.invalidate()}catch(t){e===JO&&(e=t)}if(e!==JO)throw e}affectedBy(e){if(this.state===ek.valid)return!0;let t=this.lifetime?.reads;return t===void 0?this.isObserved&&e.state===ek.valid:t.has(e)}notify(){sk.phase===ok.commit&&sk.notify.delete(this),YO(this.listeners,qO)}disposeLifetime(){let e=this.lifetime;e!==void 0&&(this.lifetime=void 0,e.dispose())}remove(){let e=this.isObserved;this.state=ek.removed,this.listeners.clear();try{this.disposeLifetime()}finally{let t=Array.from(this.parents);this.parents.clear(),YO(t,t=>{t.children.delete(this),e&&t.childObserved(-1),t.canBeRemoved&&this.registry.removeNode(t)})}}subscribe(e){let t=this.isObserved;return this.listeners.add(e),t||this.observedChanged(1),()=>{this.listeners.delete(e)&&!this.isObserved&&this.observedChanged(-1)}}},nk=e=>{let t=e,n=t.node;if(!n.skipInitialRun)return!1;let r=n.keptParents;return n.skipInitialRun=!1,n.keptParents=void 0,!t.isFn&&!Ow(n._value)&&(r===void 0||r.every(([e,t])=>e.lifetime===t))},rk={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){return this.disposed?this.node.registry.get(e):this.node.readTracked(e,this)},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return gp;switch(n._tag){case`Initial`:return gp;case`Failure`:return Nu(n.cause);case`Success`:return B(n.value)}},resultOnce(e,t){return hp(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(Hw(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(Hw(e)))},{immediate:!1});return V(i)})},setResult(e,t){return this.disposed?gp:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?gp:B(t.value)},someOnce(e){return hp(t=>{let n=this.once(e);if(Yn(n))return t(B(n.value));let r=this.node.registry.subscribe(e,e=>{Jn(e)||(r(),t(B(e.value)))},{immediate:!1});return V(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?Kn():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?bD:yD(n=>V(()=>{this.subscribe(e,e=>kT(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(KD(kw),FD(e=>e._tag===`Success`?B(e.value):_p(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0,YO(e.reverse(),qO)}},ik=e=>{function t(n){return t.disposed||t.isFn?e.registry.get(n):e.readTracked(n,t)}return Object.setPrototypeOf(t,rk),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t.reads=new Set,t.failure=JO,t},ak=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},ok={disabled:0,collect:1,commit:2},sk={phase:ok.disabled,depth:0,stale:[],notify:new Set};function ck(e){let t=sk.phase;sk.phase=ok.collect,sk.depth++;let n=JO;try{e()}catch(e){n=e}if(sk.depth===1){let{notify:e,stale:t}=sk,r=0;do{for(sk.phase=ok.collect;r<t.length;r++)try{lk(t[r])}catch(e){n===JO&&(n=e)}sk.phase=ok.commit;for(let t of e)try{t.notify()}catch(e){n===JO&&(n=e)}}while(r<t.length);sk.stale=[],e.clear()}if(sk.depth--,sk.phase=t,n!==JO)throw n}function lk(e){if(e.state===ek.valid){if(!e.invalidatedDuringBuild)return;e.invalidatedDuringBuild=!1,e.state=ek.stale,e.disposeLifetime()}e.value()}var uk=`~effect/reactivity/Atom`,dk=e=>F(e,uk),fk=`~effect/reactivity/Atom/Writable`,pk=a(2,(e,t)=>{let n=Ni(t),r=Vi(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Qi(n):void 0})}),mk=pk(0),hk={[uk]:uk,equals:Object.is,...wt,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},gk={...hk,atom(e,t){let n=wk(e,t);return bk(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):zw(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>_k(this,e,t):_k(this,e,t)},pull(e,t){let n=mk(Dk(0));return Kk(n,bk(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?kk(r,Gk(r,n,e,t),Aw(!0),a.value):zw(a,i)}))},subscriptionRef(e){return Lk(mk(bk(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return zw(r,n);let i=typeof e==`function`?e(t):e;return AO(i)?i:kk(t,i,Aw(!0),r.value)})),(e,t)=>Ik(e,t,Vw(e(this))))}},_k=(e,t,n)=>{let[r,i,a]=Wk(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return ap(i)?pO(i,n.reactivityKeys):$D(i,mO(n.reactivityKeys))}:t,n);return xk(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):zw(i,n)},i)},vk={...hk,[fk]:fk},yk=e=>fk in e,bk=(e,t)=>{let n=Object.create(hk);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},xk=(e,t,n)=>{let r=Object.create(vk);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function Sk(e,t){e.setSelf(t)}var Ck=(e,t)=>{let n=wk(e,t);return`~effect/reactivity/Atom`in n?n:bk(n)},wk=(e,t)=>{if(typeof e==`function`&&!ap(e)&&!pD(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:Tk in i?Ok(e,i,t,r):Ek in i?Pk(e,i,t,r):i;default:return i}}}return ap(e)?function(n,r){return Ok(n,e,t,r)}:pD(e)?function(n,r){return Pk(n,e,t,r)}:Dk(e)},Tk=`~effect/Effect`,Ek=`~effect/Stream`,Dk=e=>xk(function(t){return e},Sk),Ok=(e,t,n,r)=>kk(e,t,n?.initialValue===void 0?Aw():Mw(n.initialValue),r,n?.uninterruptible);function kk(e,t,n,r=Tr(),i=!1){let a=e.self();if(a._tag===`Some`&&nk(e))return a.value;let o=typeof r==`function`?r:s(r),c=nd();e.addFinalizer(()=>{jm(o())(Ak(c))});let l,u=!1,d=jk(o().pipe(Or(ed,c),Or(UO,e.registry),Or(ga,e.registry.scheduler)),t,function(t){u?e.setSelf(Ew(t,e.self())):l=Ew(t,a)},i);return u=!0,d!==void 0&&e.addFinalizer(d),l===void 0?a._tag===`Some`?Dw(a):Lw(n):l}var Ak=e=>Pp(cd(e,Iu),e=>xu(e)?pp:Vp(_p(e),{log:`Unhandled`,message:`Unhandled error in atom finalizer`}));function jk(e,t,n,r=!1){if(ju(t)){n(t);return}let i=jm(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}function Mk(e){let t=e?.memoMap??mk(Ck(()=>vd())),n=e=>dk(t)?e(t):t,r=hO;function i(e){let t=Object.create(gk);t.keepAlive=!1,t.lazy=!0,t.refresh=void 0,t.factory=i;let a=Jk(bk(typeof e==`function`?e:()=>e));return t.layer=a,t.read=function(e){let t=Rd(e(a),r),i=Tr();return kk(e,Cp(om,r=>Op(xd(t,n(e),r),e=>(i=e,e))),Aw(),()=>i,!0)},t}i.memoMap=t,i.addGlobalLayer=e=>{r=Rd(r,Ld(e,hO))};let a=mk(Ck(e=>em(t=>xd(hO,n(e),Nr(t,ed))).pipe(Op(Nr(uO)))));return i.withReactivity=e=>t=>Yk(t,n=>{let r=Vw(n(a));return n.addFinalizer(r.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),i}var Nk=Mk();Nk.withReactivity;var Pk=(e,t,n,r)=>Fk(e,t,n?.initialValue===void 0?Aw():Mw(n.initialValue),r);function Fk(e,t,n,r=Tr()){let i=e.self();if(i._tag===`Some`&&nk(e))return i.value;r=Or(r,UO,e.registry);let a=cm(n=>Cp(eD(t.channel,n),t=>cp({while:c,body:()=>t,step(t){e.setSelf(Mw(hee(t),{waiting:!0}))}}))).pipe(Pp(t=>(zf(t)?f(e.self(),ar(Bw),Xn({onNone:()=>e.setSelf(Iw(new Du,{previous:e.self()})),onSome:t=>e.setSelf(Mw(t))})):e.setSelf(Fw(t,{previous:e.self()})),pp))),o=jk(r.pipe(Or(UO,e.registry),Or(ga,e.registry.scheduler)),a,d,!1);return o!==void 0&&e.addFinalizer(o),i._tag===`Some`?Dw(i):Lw(n)}var Ik=(e,t,n=Tr())=>AO(t)?(e.addFinalizer(NO(t).pipe(iO(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return pp}),Mm(n))),zm(n)(PO(t))):t._tag===`Success`?Fk(e,NO(t.value),Aw(!0),n):t,Lk=(e,t)=>{function n(t,n){let r=t.get(e);AO(r)?Rm(LO(r,n)):jw(r)&&Rm(LO(r.value,n))}return xk(n=>{let r=n(e);return AO(r)||jw(r)?t(n,r):r},n)},Rk=function(...e){return e.length===0?zk:zk(...e)},zk=(e,t)=>{let n=mk(Dk([0,void 0])),r=t?.initialValue!==void 0;return xk(function(i){i.isFn=!0;let[a,o]=i.get(n);return a===0?r?t.initialValue:Kn():r?e(o,i):qn(e(o,i))},function(e,t){rA(()=>{e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})})},Bk=Symbol.for(`effect/reactivity/atom/Atom/Reset`),Vk=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`),Hk=function(...e){return e.length===0?Uk:Uk(...e)},Uk=(e,t)=>{let[n,r]=Wk(e,t);return xk(n,r)};function Wk(e,t){let n=mk(Dk([0,void 0])),r=t?.initialValue===void 0?Aw():Mw(t.initialValue),i=t?.concurrent?mk(bk(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===Vk)return Fw(_u(),{previous:t.self()});let l=e(c,t);return Tk in l?(o&&(l=Cp(km(l,{startImmediately:!0}),e=>{o.add(e);let t=Array.from(o);return e.addObserver(()=>o.delete(e)),Op(qw(t),e=>e[0])})),kk(t,l,r,a,!1)):Fk(t,l,r,a)}function o(e,t){rA(()=>{t===Bk?e.set(n,[0,void 0]):t===Vk?e.set(n,[e.get(n)[0]+1,Vk]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var Gk=(e,t,n,r)=>Cp(aO(typeof n==`function`?n(e):n),n=>{let i=Xw().context,a=pi(),o=Zp(n,{onFailure(e){return zf(e)?fi(a)?B({done:!0,items:a}):U(new Du(`Atom.pull: no items`)):_p(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=ui(a,e),a=t),B({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(Dw(e.self()));let t;t=jk(i,o,n=>{t&&s.delete(t);let r=Ew(n,e.self()),i=s.size>0;e.setSelf(i?Lw(r):r)}),t&&s.add(t)}),o}),Kk=(e,t)=>xk(t.read,function(t,n){t.set(e,t.get(e)+1)}),X=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=$f();return function(n){let r=ep(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return np(t,n,i),i}}:e=>{let t=$f(),n=new FinalizationRegistry(e=>{let n=ep(t,e);n._tag===`Some`&&n.value.deref()===void 0&&rp(t,e)});return function(r){let i=ep(t,r).pipe(or(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return np(t,r,new WeakRef(a)),n.register(a,r),a}},qk=a(2,(e,t)=>{function n(n){let r=n(e);return r._tag===`Initial`?Lw(n(t)):r}return yk(e)?xk(n,function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):bk(n,e.refresh??function(t){t(e)})}),Jk=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),Yk=a(e=>dk(e[0]),(e,t,n)=>{let r=mk(yk(e)?xk(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):bk(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=Xk(n.initialValueTarget)),r}),Xk=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},Zk=a(2,(e,t)=>Yk(e,n=>t(n(e)))),Qk=a(2,(e,t)=>{let n=Qi(Ni(t.staleTime));return Yk(e,r=>{let i=r.once(e);if(r.subscribe(e,e=>{r.setSelf(e)}),t.revalidateOnFocus&&t.focusSignal&&(r.once(t.focusSignal),r.subscribe(t.focusSignal,t.revalidateOnFocus===`always`?()=>r.refresh(e):()=>{tA(r.once(e),n)&&r.refresh(e)})),Jn(r.self())&&t.revalidateOnMount===!1)return i;if(tA(i,n)){let t=!0;r.addFinalizer(()=>{t=!1}),r.registry.schedulerAsync.makeDispatcher().scheduleTask(()=>{t&&tA(r.once(e),n)&&r.refresh(e)},0)}return i},{initialValueTarget:e})}),$k=e=>e._tag===`Success`?qn(e.timestamp):e._tag===`Failure`?ir(e.previousSuccess,e=>e.timestamp):Kn(),eA=(e,t,n)=>n-e<t,tA=(e,t)=>{if(e.waiting)return!1;let n=er($k(e));return n===void 0?e._tag!==`Initial`:!eA(n,t,Date.now())},nA=e=>{let t=0,n=mk(Dk([t,void 0]));return xk(t=>{let r=t.once(e),i=!1;t.subscribe(e,e=>{if(r=e,a.size>0)return;if(i=!1,!Cw(e))return t.setSelf(e);let n=er(t.self());switch(e._tag){case`Initial`:Ow(n)&&t.setSelf(e);return;case`Success`:jw(n)?!e.waiting&&e.timestamp>=n.timestamp&&t.setSelf(e):t.setSelf(e);return;case`Failure`:return t.setSelf(e)}});let a=new Set,o=new Set;return t.subscribe(n,([,n])=>{if(a.has(n))return;a.add(n);let s;s=t.registry.subscribe(n,c=>{if(jw(c)&&c.waiting)return t.setSelf(c.value);a.delete(n),s&&(o.delete(s),s()),!i&&!Nw(c)&&(i=!0),a.size===0&&(i?(i=!1,t.refresh(e)):t.setSelf(r))},{immediate:!0}),a.has(n)?o.add(s):s()}),t.addFinalizer(()=>{for(let e of o)e();a.clear(),o.clear()}),r},(e,r)=>e.set(n,[++t,r]),t=>t(e))},rA=ck,iA=(e=>t=>Yk(t,n=>(n.once(e),n.subscribe(e,e=>n.refresh(t)),n.subscribe(t,e=>n.setSelf(e)),n.once(t)),{initialValueTarget:t}))(bk(e=>{if(typeof window>`u`)return 0;let t=0;function n(){document.visibilityState===`visible`&&e.setSelf(++t)}return window.addEventListener(`visibilitychange`,n),e.addFinalizer(()=>{window.removeEventListener(`visibilitychange`,n)}),t})),aA=e=>{let t=e.runtime.fn(t=>CO.use(n=>DO(n,e.schema).set(e.key,t))),n=e.runtime.atom(CO.use(t=>DO(t,e.schema).get(e.key)));return xk(e.mode===`async`?r=>{r.mount(t);let i=Uw(Zn(()=>{let n=e.defaultValue();return r.set(t,n),n}));return r.subscribe(n,e=>r.setSelf(i(e))),i(r.once(n))}:r=>(r.mount(t),r.subscribe(n,n=>{if(jw(n)){if(Yn(n.value))r.setSelf(n.value.value);else{let n=Zn(r.self(),e.defaultValue);r.setSelf(n),r.set(t,n)}}},{immediate:!0}),Zn(r.self(),e.defaultValue)),(n,r)=>{n.set(t,r),n.setSelf(e.mode===`async`?Mw(r):r)})},oA=`~effect-atom/atom/Atom/ServerValue`,sA=a(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[oA](e=>t.get(e)):t.get(e)),cA=(e,t)=>()=>{let n=NS(rC(e),t);return iE((e,t)=>B(Cp(e,e=>n(e))))},lA=`~effect/encoding/Ndjson/NdjsonError`,uA=new TextEncoder,dA=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),fA=class extends Da(`NdjsonError`){[lA]=lA;get message(){return this.kind}},pA=e=>F(e,lA),mA=()=>iE((e,t)=>B(Cp(e,e=>{try{return B(mi(e.map(e=>{let t=JSON.stringify(e);if(t===void 0)throw TypeError(`Value cannot be represented as JSON`);return t}).join(`
|
|
15
15
|
`)+`
|
|
16
16
|
`))}catch(e){return U(new fA({kind:`Pack`,cause:e}))}}))),hA=()=>hE(mA(),hi(e=>uA.encode(e))),gA=(e,t,n)=>{let r,i,a=(e,t)=>(r=t,di(e)?B(e):t===void 0?void 0:U(t)),o=fp(()=>r===void 0?i===void 0?Wf(e,{onSuccess:e=>{let n=[];return a(n,t(e,n))??o},onFailure:_p,onDone:e=>{i={leftover:e};let t=[];return a(t,n(t))??ku(e)}}):ku(i.leftover):U(r));return o},_A=(e,t,n,r)=>{if(!(n&&/^[ \t]*$/.test(e)))try{t.push(JSON.parse(e))}catch(e){return new fA({kind:`Unpack`,reason:`InvalidJson`,unterminated:r,cause:e})}},vA=10,yA=13,bA=new Uint8Array,xA=e=>iE((t,n)=>V(()=>{let n=e?.ignoreEmptyLines===!0,r=e?.maxLineBytes??1/0,i=new TextDecoder(`utf-8`,{fatal:!0}),a=[],o=0,s=!1,c=(e,t,n)=>{if(o===0)return e.subarray(t,n);let r=new Uint8Array(o+n-t),i=0;for(let e of a)r.set(e,i),i+=e.length;return r.set(e.subarray(t,n),i),a=[],o=0,r},l=(e,t,r)=>{let a;try{a=i.decode(e)}catch(e){return new fA({kind:`Unpack`,reason:`InvalidUtf8`,unterminated:r,cause:e})}let o=i!==dA;if(i=dA,!(o&&r&&a.length===0))return _A(a,t,n,r)};return gA(t,(e,t)=>{for(let n of e){let e=0;for(let i=0;i<n.length;i++){let a=n[i];if(a===vA||a===yA){if(a===vA&&s)e=i+1;else{let r=l(c(n,e,i),t,!1);if(r!==void 0)return r;e=i+1}s=a===yA}else if(s=!1,o+i+1-e>r)return new fA({kind:`Unpack`,reason:`LineTooLarge`,unterminated:!1,cause:RangeError(`NDJSON line exceeds maxLineBytes of ${r}`)})}e<n.length&&(a.push(n.slice(e)),o+=n.length-e)}},e=>o===0?void 0:l(c(bA,0,0),e,!0))})),SA=`~effect/encoding/Sse/SseError`,CA=class extends Da(`EventTooLarge`){get message(){return`Pending SSE event exceeded the maximum size of ${this.maxEventSize}`}},wA=class extends Da(`SseError`){[SA]=SA;get message(){return this.reason.message}},TA=10485760,EA=e=>iE((t,n)=>V(()=>{let n=[],r,i=OA(e=>{e._tag===`Retry`?r=e:n.push(e)},e),a=Cp(t,e=>{for(let t=0;t<e.length;t++){let n=i.feed(e[t]);if(n!==void 0)return U(n)}return pp});return fp(function e(){if(di(n)){let e=n;return n=[],B(e)}return r?U(r):Cp(a,e)})})),DA=(e,t,n)=>zE(EA(t),cA(NA.pipe(pC(e,PA)),n)());function OA(e,t){let n=t?.maxEventSize??TA,r=t?.dispatchEmptyNamedEvents===!0,i,a,o,s,c=0,l,u,d;return f(),{feed:p,reset:f};function f(){c++,i=!0,a=[],o=0,s=!1,l=void 0,u=void 0,d=``}function p(e){if(e.length===0)return;i&&e.startsWith(kA)&&(e=e.slice(kA.length)),i=!1;let t=e.length,r=c,l=0;for(;l<t;){if(s&&(s=!1,e.charCodeAt(l)===AA)){++l;continue}let n=l;for(;n<t;){let t=e.charCodeAt(n);if(t===jA||t===AA)break;++n}if(n===t){a.push(e.slice(l)),o+=t-l;break}s=e.charCodeAt(n)===jA;let i=e.slice(l,n);if(a.length>0&&(a.push(i),i=a.join(``),a=[],o=0),m(i),c!==r)return;l=n+1}if(o+d.length>n){let e=new wA({reason:new CA({maxEventSize:n})});return f(),e}}function m(t){if(t.length===0){let t=u!==void 0&&u!==``,n=u||`message`,i=d;u=void 0,d=``,(i.length>0||r&&t)&&e({_tag:`Event`,id:l,event:n,data:i.slice(0,-1)});return}let n=t.indexOf(`:`),i=t,a=``;n>=0&&(i=t.slice(0,n),a=t.slice(t.charCodeAt(n+1)===MA?n+2:n+1)),i===`data`?d+=a+`
|
|
17
|
-
`:i===`event`?u=a:i===`id`&&!a.includes(`\0`)?l=a:i===`retry`&&/^\d+$/.test(a)&&e(new IA({duration:qi(parseInt(a,10)),lastEventId:l}))}}var kA=``,AA=10,jA=13,MA=32,NA=q({_tag:mC(`Event`),id:cC(K),event:K,data:K}),PA=Fy({decode:e=>e.id===void 0?{event:e.event,data:e.data}:{id:e.id,event:e.event,data:e.data},encode:e=>({_tag:`Event`,id:e.id,event:e.event??`message`,data:e.data})}),FA=`~effect/encoding/Sse/Retry`,IA=class e extends Ea(`Retry`){[FA]=FA;static is(e){return F(e,FA)}static filter(t){return e.is(t)?Ur(t):Wr(t)}},LA=`~effect/http/HttpBody`,RA=e=>F(e,LA),zA=class{[LA];constructor(){this[LA]=LA}[nt](){return this.toJSON()}toString(){return Ge(this,{ignoreToString:!0})}},BA=new class extends zA{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},VA=class extends zA{_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??=GA(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}}},HA=(e,t)=>new VA(e,t??`application/octet-stream`,e.length),UA=new TextEncoder,WA=globalThis.Buffer,GA=WA===void 0?e=>UA.encode(e):e=>WA.from(e,`utf8`),KA=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),WA!==void 0)return new VA(void 0,t??`text/plain`,WA.byteLength(e,`utf8`),e);let n=UA.encode(e);return new VA(n,t??`text/plain`,n.length,e)},qA=(e,t)=>KA(rv(J_(e)),t??`application/x-www-form-urlencoded`),JA=class extends zA{_tag=`FormData`;contentType=void 0;contentLength=void 0;formData;constructor(e){super(),this.formData=e}toJSON(){return{_id:`effect/HttpBody`,_tag:`FormData`,formData:this.formData}}},YA=e=>new JA(e),XA=class extends zA{_tag=`Stream`;stream;contentType;contentLength;constructor(e,t,n){super(),this.stream=e,this.contentType=t,this.contentLength=n}toJSON(){return{_id:`effect/HttpBody`,_tag:`Stream`,contentType:this.contentType,contentLength:this.contentLength}}},ZA=(e,t,n)=>new XA(e,t??`application/octet-stream`,n),QA={"~effect/Ref":{_A:o},...wt,toJSON(){return{_id:`Ref`,ref:this.ref}}},$A=e=>{let t=Object.create(QA);return t.ref=nT(e),t},ej=e=>V(()=>$A(e)),tj=e=>V(()=>e.ref.current),nj=a(2,(e,t)=>V(()=>rT(e.ref,t))),rj=a(2,(e,t)=>V(()=>{let n=e.ref.current;return e.ref.current=t,n})),ij=a(2,(e,t)=>V(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),aj=a(2,(e,t)=>V(()=>{e.ref.current=t(e.ref.current)})),oj=`~effect/http/HttpClientError`,sj=e=>F(e,oj),cj=class extends Da(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[oj]=oj;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},lj=e=>e.endsWith(`Error`)?e.slice(0,-5):e,uj=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,dj=e=>`${e.method} ${sv(e.url)}`,fj=(e,t)=>({...t,request:{_id:`HttpClientRequest`,method:e.request.method,url:sv(e.request.url)},...`response`in e?{response:{_id:`HttpClientResponse`,status:e.response.status}}:void 0}),pj=class extends Da(`TransportError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},mj=class extends Da(`EncodeError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},hj=class extends Da(`InvalidUrlError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},gj=class extends Da(`StatusCodeError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},_j=class extends Da(`DecodeError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},vj=class extends Da(`EmptyBodyError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},yj=class e extends vw(oj)({_tag:mC(`HttpError`),kind:oC([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:W(zC())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}};function bj(e){return e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`}var xj=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],Sj=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?L_(L_(e,`content-type`),`content-length`):(e=t.contentType===void 0?L_(e,`content-type`):P_(e,`content-type`,t.contentType),Cj(e,t)),Cj=(e,t)=>{let n=t._tag===`Empty`||t._tag===`FormData`?void 0:t.contentLength;return n===void 0?L_(e,`content-length`):P_(e,`content-length`,n.toString())},wj=class extends Da(`UrlError`){},Tj=(e,t,n)=>Gr({try:()=>{let r=new URL(e,Ej());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,V_(i))}return n!==void 0&&(r.hash=n),r},catch:e=>new wj({cause:e})}),Ej=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0){let e=location.origin+location.pathname;try{return new URL(e).href}catch{return}}},Dj=`~effect/http/HttpClientRequest`,Oj={[Dj]:Dj,...at,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:sv(this.url),urlParams:this.urlParams,hash:this.hash,headers:Be(this.headers),body:this.body.toJSON()}},pipe(){return n(this,arguments)}};function kj(e,t,n,r,i,a){let o=Object.create(Oj);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var Aj=kj(`GET`,``,$_,Kn(),j_,BA),jj=e=>(t,n)=>Nj(Aj,{method:e,url:t,...n??void 0}),Mj=jj(`GET`),Nj=a(2,(e,t)=>{let n=e;return t.method&&(n=Pj(n,t.method)),t.url&&(n=Bj(n,t.url)),t.headers&&(n=Ij(n,t.headers)),t.urlParams&&(n=Uj(n,t.urlParams)),t.hash&&(n=Gj(n,t.hash)),t.body&&(n=Kj(n,t.body)),t.accept&&(n=Lj(n,t.accept)),t.acceptJson&&(n=Rj(n)),n}),Pj=a(2,(e,t)=>kj(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Fj=a(3,(e,t,n)=>kj(e.method,e.url,e.urlParams,e.hash,P_(e.headers,t,n),e.body)),Ij=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,F_(e.headers,t),e.body)),Lj=a(2,(e,t)=>Fj(e,`Accept`,t)),Rj=Lj(`application/json`),zj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,P_(P_(e.headers,`connection`,`Upgrade`),`upgrade`,t),e.body)),Bj=a(2,(e,t)=>{if(typeof t==`string`)return kj(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=J_(n.searchParams),i=$n(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,kj(e.method,n.toString(),r,i,e.headers,e.body)}),Vj=a(2,(e,t)=>t===``?e:kj(e.method,Hj(t,e.url),e.urlParams,e.hash,e.headers,e.body)),Hj=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},Uj=a(2,(e,t)=>kj(e.method,e.url,tv(e.urlParams,t),e.hash,e.headers,e.body)),Wj=a(2,(e,t)=>kj(e.method,e.url,nv(e.urlParams,t),e.hash,e.headers,e.body)),Gj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,qn(t),e.headers,e.body)),Kj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,Sj(e.headers,t),t)),qj=a(2,(e,t)=>Kj(e,YA(t)));function Jj(e){let t=Tj(e.url,e.urlParams,er(e.hash));return qr(t)?qn(t.success):Kn()}var Yj=`~effect/http/HttpIncomingMessage`,Xj=(e,t)=>({...t,headers:Be(e.headers),remoteAddress:e.remoteAddress}),Zj=`~effect/http/HttpClientResponse/WebSource`,Qj=e=>e[Zj]?.(),$j=`~effect/http/HttpClientResponse`,eM=(e,t)=>new tM(e,t),tM=class extends ot{[Yj];[$j];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[Yj]=Yj,this[$j]=$j}toJSON(){return Xj(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=Jj(this.request);return Jn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return M_(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=f_(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return Kn()}[Zj](){return this.source}get stream(){return this.source.body?AD({evaluate:()=>this.source.body,onError:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}):TD(new cj({reason:new vj({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Cp(this.text,e=>bp({try:()=>e===``?null:JSON.parse(e),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Op(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Cp(this.arrayBuffer,e=>bp({try:()=>J_(U_(e)),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=up({try:()=>this.source.formData(),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}).pipe(gm,Rm)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=up({try:()=>this.source.arrayBuffer(),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}).pipe(gm,Rm),this.arrayBufferBody}get upgrade(){return U(new cj({reason:new gj({request:this.request,response:this,description:`fetch cannot hand over the connection of an HTTP upgrade`})}))}pipe(){return n(this,arguments)}},nM=e=>N_({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Xn(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId.padStart(32,`0`)}-${e.spanId}-${e.sampled?`01`:`00`}`}),rM={"http:":80,"https:":443,"ws:":80,"wss:":443},iM=(e,t,n)=>{let r=sv(t.search,n).slice(1);if(e.attribute(`url.full`,sv(t.href,n)),e.attribute(`url.path`,t.pathname),r!==``&&e.attribute(`url.query`,r),e.attribute(`url.scheme`,t.protocol.slice(0,-1)),t.hostname!==``){e.attribute(`server.address`,t.hostname.startsWith(`[`)?t.hostname.slice(1,-1):t.hostname);let n=t.port===``?rM[t.protocol]:Number(t.port);n!==void 0&&e.attribute(`server.port`,n)}},aM=(e,t)=>{let n=e.params.filter(([,e])=>typeof e!=`string`).map(([e])=>e);return n.length===0?t:[...t,...new URLSearchParams(n.map(e=>[e,``])).keys()]},oM=(e,t,n,r,i)=>{for(let a in n)r(a,t)&&e.attribute(`http.${t}.header.${a}`,z_(a,i)?`<redacted>`:n[a])},sM=`~effect/http/HttpClient`,cM=dr(`effect/HttpClient`),lM=a(2,(e,t)=>uM(n=>t(e.postprocess(n)),e.preprocess)),uM=(e,t)=>{let n=Object.create(dM);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},dM={[sM]:sM,pipe(){return n(this,arguments)},...at,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(xj.map(([e,t])=>[t,function(t,n){return this.execute(jj(e)(t,n))}]))},fM=e=>uM(t=>Cp(t,t=>Sp(n=>{let r=xM.get(t),i=r??new AbortController,a=Tj(t.url,t.urlParams,er(t.hash));if(Kr(a))return U(new cj({reason:new hj({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(za)||n.getRef(hM)(t)){let a=e(t,o,i.signal,n);return r?Op(a,e=>CM(e,i,!0)):xm(e=>Zp(e(a),{onSuccess(e){return B(CM(e,i,!1))},onFailure(e){return Eu(e)&&i.abort(),_p(e)}}))}return wm(n.getRef(vM)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method);let s=n.getRef(B_);iM(a,o,aM(t.urlParams,n.getRef(hv)));let c=n.getRef(gM);return oM(a,`request`,t.headers,c,s),t=n.getRef(_M)?Ij(t,nM(a)):t,xm(l=>l(e(t,o,i.signal,n)).pipe(Tm(a,{captureStackTrace:!1}),Zp({onSuccess:e=>(a.attribute(`http.response.status_code`,e.status),oM(a,`response`,e.headers,c,s),e.status>=400&&e.status<600&&(a.attribute(`error.type`,String(e.status)),pM(n,a,t,e)),B(CM(e,i,r!==void 0))),onFailure(e){return!r&&Eu(e)&&i.abort(),_p(e)}})))})})),B),pM=(e,t,n,r)=>{let i=ct();lt(0);let a;try{a=Pu(new cj({reason:new gj({request:n,response:r})}))}finally{lt(i)}t.end(e.getRef($u)?e.getRef(Bd).currentTimeNanosUnsafe():BigInt(0),a)},mM=a(2,(e,t)=>uM(e.postprocess,n=>Op(e.preprocess(n),t))),hM=Br(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),gM=Br(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>l}),_M=Br(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),vM=Br(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>e.method}),yM=e=>kd(cM)(em(t=>Op(e,e=>lM(e,im(e=>Rr(t,e)))))),bM=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{try{e.abort()}catch{}});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new WeakMap;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))}}})(),xM=new WeakMap,SM=new WeakMap,CM=(e,t,n)=>(n||(bM.register(e,t),e=new wM(e,t)),SM.set(e,t),e),wM=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[$j]=$j;[Yj]=Yj;applyInterrupt(e){return fp(()=>(bM.unregister(this.original),ym(e,()=>V(()=>{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 upgrade(){return this.applyInterrupt(this.original.upgrade)}[Zj](){let e=Qj(this.original);return e!==void 0&&bM.unregister(this.original),e}get stream(){return CD(()=>(bM.unregister(this.original),eO(this.original.stream,V(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[nt](){return this.original[nt]()}pipe(){return n(this,arguments)}};function TM(e,t){let n=1;for(;t<e.length;)if(t++,e[t]===`\\`)t++;else if(e[t]===`)`?n--:e[t]===`(`&&n++,!n)return t;throw TypeError(`Invalid regexp expression in "`+e+`"`)}var EM=`~effect/socket/Socket`,DM=e=>F(e,EM),OM=dr(`effect/socket/Socket`),kM=e=>OM.of({[EM]:EM,reader:e.reader,writer:e.writer}),AM=new TextEncoder,jM=`~effect/socket/Socket/CloseEvent`,MM=e=>F(e,jM),NM=`~effect/socket/Socket/SocketError`,PM=e=>F(e,NM),FM=class extends vw(`effect/socket/Socket/SocketReadError`)({_tag:mC(`SocketReadError`),cause:zC()}){message=`An error occurred during Read`},IM=class extends vw(`effect/socket/Socket/SocketWriteError`)({_tag:mC(`SocketWriteError`),cause:zC()}){message=`An error occurred during Write`},LM=class extends vw(`effect/socket/Socket/SocketOpenError`)({_tag:mC(`SocketOpenError`),kind:oC([`Unknown`,`Timeout`]),cause:zC()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},RM=class e extends vw(`effect/socket/Socket/SocketUpgradeError`)({_tag:mC(`SocketUpgradeError`),cause:W(zC())}){static unsupported=()=>U(new VM({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},zM=class extends vw(`effect/socket/Socket/SocketCloseError`)({_tag:mC(`SocketCloseError`),code:OC,closeReason:W(K)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},BM=aC([FM,IM,LM,RM,zM]),VM=class extends Y(NM)(`SocketError`,{_tag:mC(`SocketError`),reason:BM}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[NM]=NM;static is(e){return PM(e)}message=this.reason.message},HM=(e,t)=>new VM({reason:new zM({code:e,closeReason:t})}),UM=class extends dr()(`@effect/platform/Socket/WebSocketConstructor`){},WM=(e,t)=>UM.use(n=>KM(lm((typeof e==`string`?B(e):e).pipe(Op(e=>n(e,t?.headers===void 0?t?.protocols:{protocols:t.protocols,headers:t.headers}))),e=>V(()=>e.close(1e3))),t)),GM=e=>`pause`in e&&typeof e.pause==`function`,KM=(e,t)=>Sp(n=>{let r,i=Qw(!1),a=n.context,o=H(function*(){let n=yield*om,a=yield*rd(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=GM(a),s=t?.highWaterMark??(o?qM:void 0),c=a.readyState===1,l=o&&`isPaused`in a&&a.isPaused===!0,u=[],f=0,p,m,h;function g(){o&&!l&&(a.pause(),l=!0)}function _(){o&&l&&(a.resume(),l=!1)}function v(){let e=u;return u=[],f=0,p===void 0&&_(),e}function y(){if(m===void 0||u.length===0)return;let e=m;m=void 0,e(B(v()))}function b(e){u.push(e),s!==void 0&&(f+=typeof e==`string`?AM.encode(e).byteLength:e.byteLength),m!==void 0&&y(),o&&f>=s?g():!o&&!m&&s!==void 0&&f>s&&x(new VM({reason:new FM({cause:Error(`Socket highWaterMark of ${s} bytes exceeded`)})}))}function x(e){if(p===void 0&&(p=e),h!==void 0){let{cleanup:e,resume:t}=h;h=void 0,e(),t(U(p))}if(m!==void 0){let e=m;m=void 0,e(u.length>0?B(v()):U(p))}}function S(e){let t=e.data;typeof Blob<`u`&&t instanceof Blob?t.arrayBuffer().then(e=>b(new Uint8Array(e)),e=>{x(new VM({reason:new FM({cause:e})}))}):b(t instanceof ArrayBuffer?new Uint8Array(t):t)}function C(e){x(new VM({reason:c?new FM({cause:e}):new LM({kind:`Unknown`,cause:e})}))}function w(e){x(HM(typeof e.code==`number`?e.code:1006,e.reason))}return a.addEventListener(`message`,S),a.addEventListener(`error`,C,{once:!0}),a.addEventListener(`close`,w,{once:!0}),yield*ad(n,V(()=>{if(x(HM(1006)),a.removeEventListener(`message`,S),a.addEventListener(`error`,d),a.removeEventListener(`error`,C),a.removeEventListener(`close`,w),o)try{_()}catch{}i.closeUnsafe(),r=void 0})),a.readyState>=2?yield*U(p??HM(1006)):(c||=(yield*hp(e=>{let t=()=>{h?.resume===e&&(h=void 0,a.removeEventListener(`open`,t),e(pp))},n=()=>a.removeEventListener(`open`,t);return h={resume:e,cleanup:n},a.addEventListener(`open`,t,{once:!0}),V(()=>{h?.resume===e&&(h=void 0),n()})}).pipe(Gp({duration:t?.openTimeout??1e4,orElse:()=>U(new VM({reason:new LM({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),p===void 0&&f<s&&_(),r=a,i.openUnsafe(),{pull:hp(e=>u.length>0?e(B(v())):p===void 0?(m=e,V(()=>{m===e&&(m=void 0)})):e(U(p))),upgrade:RM.unsupported})}).pipe(im(e=>Rr(a,e))),s=e=>fp(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return MM(e)?t.close(e.code,e.reason):t.send(e),pp}catch(e){return U(new VM({reason:new IM({cause:e})}))}}),c=e=>fp(()=>{let t=r;if(t===void 0)return i.whenOpen(c(e));try{for(let n=0;n<e.length;n++)t.send(e[n]);return pp}catch(e){return U(new VM({reason:new IM({cause:e})}))}});return B(kM({reader:o,writer:B({write:s,writeAll:c})}))}),qM=65536,JM=dr(`effect/http/HttpEffect/CurrentRequestState`),YM=e=>Sp(t=>{let n=Ar(t.context,JM);return n!==void 0&&(n.loggerDisabled=!0),e}),XM=dr(`effect/http/HttpRouter`),ZM=e=>e.endsWith(`/`)?e.slice(0,-1):e,QM=a(2,(e,t)=>(t=ZM(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),$M=`~effect/http/HttpRouter/Middleware`,Iie=function(){return arguments.length===0?eN:eN(arguments[0],arguments[1])},eN=(e,t)=>t?.global?Md(H(function*(){let t=yield*XM,n=ap(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new Rie(ap(e)?jd(Op(e,e=>br(new Map([[tN,e]])))):Td(br(new Map([[tN,e]])))),Lie=0,tN=`effect/http/HttpRouter/MiddlewareFn`,Rie=class e{[$M]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++Lie}`;this.layer=jd(H({self:this},function*(){let e=yield*$p(),t=[jr(e,tN)];if(this.dependencies){let n=yield*bd,r=Nr(e,ed),i=yield*xd(this.dependencies,n,r);t.push(...zie(i))}return br(new Map([[n,t]]))})).pipe(Ld(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?Rd(this.dependencies,t.layer):t.layer)}},nN=new WeakMap,zie=e=>{let t=nN.get(e);if(t)return t;let n=pi(),r=0;for(let[t,i]of e.mapUnsafe)t.startsWith(`effect/http/HttpRouter/Middleware-`)&&(n.push(i),i.length>r&&(r=i.length));if(n.length===0)t=[];else{let e=new Set;for(let t=r-1;t>=0;t--)for(let r of n)t<r.length&&e.add(r[t]);t=si(e).reverse()}return nN.set(e,t),t};Iie(YM).layer;var Bie={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511},rN=e=>Bie[e];function iN(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var Vie=`~effect/http-api/HttpApiSchema/Stream`;function aN(e){let t=typeof e==`string`?rN(e):e;return e=>xN(e.ast)===void 0?e.annotateKey({httpApiStatus:t}):e.annotate({httpApiStatus:t})}var Hie=(e=>QS.pipe(aN(e)))(204);function oN(e){return t=>QS.pipe(pC(WS(t),Fy({decode:e.decode,encode:d})))}var sN=e=>VS(e)&&F(e,Vie),cN=e=>sN(e)&&e._tag===`StreamSse`,lN=e=>sN(e)&&e._tag===`StreamUint8Array`,uN=e=>sN(e)&&e._tag===`StreamNdjson`,dN=`~effect/http-api/HttpApiSchema/Upgrade`,Uie=TS(DM).pipe(aN(101)),Wie=(e,t)=>BS(Uie.ast,{[dN]:dN,protocol:e,headers:t}),fN=e=>VS(e)&&F(e,dN),pN=`~effect/http-api/HttpApiSchema/WithHeaders`,mN=`~effect/http-api/HttpApiSchema/WithHeadersValue`,hN=e=>({[mN]:mN,body:e.body,headers:e.headers}),gN=e=>VS(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function Gie(e,t,n){return BS(e.ast,{[pN]:pN,schema:t,headers:n})}function _N(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??Kie(t._tag)}})}function Kie(e){switch(e){case`Multipart`:return`multipart/form-data`;case`Json`:return`application/json`;case`FormUrlEncoded`:return`application/x-www-form-urlencoded`;case`Uint8Array`:return`application/octet-stream`;case`Text`:return`text/plain`}}function qie(e){return t=>_N(t,{_tag:`FormUrlEncoded`,...e})}function Jie(e){return t=>_N(t,{_tag:`Uint8Array`,...e})}var vN=e=>{if(Qy(e)||Qy(Tx(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&Qy(t)},yN=Fx(`~httpApiEncoding`),bN=Fx(`~httpApiWithHeaders`);function xN(e){if(e.checks)for(let t=e.checks.length-1;t>=0;t--){let n=e.checks[t];if(n.annotations&&`httpApiStatus`in n.annotations)return n.annotations;if(n._tag===`FilterGroup`){let e=xN(n);if(e!==void 0)return e}}let t=e.annotations;return t&&`httpApiStatus`in t?t:void 0}function SN(e){let t=xN(e);return t===void 0?e.context?.annotations?.httpApiStatus:t.httpApiStatus}var CN={_tag:`Json`,contentType:`application/json`},Yie={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function Xie(e){return yN(e)??CN}function wN(e,t){return yN(e)||(bj(t)?CN:Yie)}function TN(e){let t=Xie(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function EN(e){return SN(e)??200}function DN(e){return gN(e)?SN(e.ast)??EN(e.schema.ast):EN(e.ast)}function ON(e){return gN(e)&&yN(e.ast)===void 0?TN(e.schema.ast):TN(e.ast)}function kN(e){return SN(e)??500}function AN(e){return gN(e)?SN(e.ast)??kN(e.schema.ast):kN(e.ast)}function jN(e){let t=bw(e);return t.rebuild(NN(t.ast))}var Zie=new jy(py(),gy(lr(k))),MN=m(e=>{if(e._tag===`Undefined`)return new pb(e.annotations,void 0,void 0,e.context);if(e._tag===`Suspend`)return e.recur(MN);if(e._tag!==`Union`)return e;let t=_x(e.types,MN);if(t===e.types)return e;let n=t.filter(e=>e._tag!==`Never`);return n.length===1&&e.checks===void 0&&e.annotations===void 0?sx(n[0],e.context):new Gb(n,e.options,e.annotations,e.checks,void 0,e.context)}),NN=hx(e=>{if(e._tag===`Union`||e._tag===`Suspend`)return e.recur(NN);if(e._tag!==`Objects`)return e;let t=_x(e.propertySignatures,e=>{let t=Tx(e.type);if(!Sx(t))return e;let n=MN(t);return n===t?e:new Tb(e.name,xx(n,e.type,Zie))});return t===e.propertySignatures?e:new kb(t,e.indexSignatures,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}),PN=`~effect/http-api/HttpApiEndpoint`;function Qie(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function $ie(e){let t=Array.from(e.success);return di(t)?t:[Hie]}function eae(e){let t=new Set(e.error),n=e.disableCodecs?o:BN;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var tae={[PN]:PN,pipe(){return n(this,arguments)},prefix(e){return IN({...FN(this),path:QM(this.path,e)})},middleware(e){return IN({...FN(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return IN({...FN(this),annotations:Or(this.annotations,e,t)})},annotateMerge(e){return IN({...FN(this),annotations:Rr(this.annotations,e)})}},FN=e=>({identifier:e.identifier,path:e.path,method:e.method,params:e.params,query:e.query,headers:e.headers,payload:e.payload,success:e.success,error:e.error,annotations:e.annotations,middlewares:e.middlewares,disableCodecs:e.disableCodecs});function IN(e){function t(){}return Object.setPrototypeOf(t,tae),Object.assign(t,e)}var LN=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:jN,s=nae(r?.payload,e,i);return IN({identifier:t,path:n,method:e,params:RN(r?.params,a),query:RN(r?.query,a),headers:RN(r?.headers,a),payload:s,success:rae(r?.success,e,s,i),error:iae(r?.error,i),annotations:Tr(),middlewares:new Set,disableCodecs:i})};function RN(e,t){if(e!==void 0)return VS(e)?t(e):t(q(e))}function nae(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:VS(e)?[e]:[q(e).pipe(qie())],a=n?o:lae,s=!1;for(let e of i){if(sN(e)){if(cN(e))throw Error(`StreamSse is response-only and cannot be used as a payload`);if(!bj(t))throw Error(`${t} endpoints cannot declare a streaming payload`);if(s)throw Error(`Multiple streaming payloads are not supported`);s=!0;for(let t of e.contentTypes){let n=iN(t);if(r.has(n))throw Error(`Cannot combine buffered and streaming payloads for content-type: ${t}`);r.set(n,{encoding:{_tag:`Stream`,contentType:t},schemas:[e]})}continue}let n=wN(e.ast,t),i=iN(n.contentType),o=r.get(i);if(o){if(o.encoding._tag===`Stream`)throw Error(`Cannot combine buffered and streaming payloads for content-type: ${n.contentType}`);if(o.encoding._tag!==n._tag)throw Error(`Multiple payload encodings for content-type: ${n.contentType}`);if(o.encoding._tag===`Multipart`)throw Error(`Multiple multipart payloads for content-type: ${n.contentType}`);o.schemas.push(a(e,t))}else r.set(i,{encoding:n,schemas:[a(e,t)]})}return r}var zN=`effect/http-api/stream/failure`;function rae(e,t,n,r){if(e===void 0)return new Set;let i=ci(e);return aae(i,t,n),new Set(r?i:i.map(BN))}var BN=m(e=>sN(e)?e:fN(e)?e.headers===void 0?e:Wie(e.protocol,jN(e.headers)):gN(e)?Gie(e,sN(e.schema)?e.schema:GN(e.schema,ON(e)),jN(e.headers)):cae(e));function iae(e,t){if(e===void 0)return new Set;let n=ci(e);for(let e of n){let t=gN(e)?e.schema:e;if(sN(t))throw Error(`Streaming schemas are not supported in error responses`);if(fN(t))throw Error(`Upgrade schemas are not supported in error responses`)}return HN(n,AN),new Set(t?n:n.map(BN))}function aae(e,t,n){let r=e.filter(fN);if(r.length>1)throw Error(`Cannot declare more than one upgrade`);let i=r.length===1;if(i){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare an upgrade`);for(let{encoding:e}of n.values())if(e._tag===`Stream`||e._tag===`Multipart`&&e.mode===`stream`)throw Error(`Upgrade endpoints cannot declare a streaming payload`)}let a=!1,o=new Map;for(let n of e){if(fN(n))continue;let e=gN(n)?n.schema:n,r=DN(n);if(i&&r===101)throw Error(`Cannot combine an upgrade with another success response for status: 101`);if(sN(e)){if(i)throw Error(`Cannot combine an upgrade with a streaming success response`);if(oae(e,t),a)throw Error(`Multiple streaming success responses are not supported`);a=!0;let n=VN(o,r);if(n.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${r}`);for(let t of e.contentTypes)if(n.bufferedContentTypes.has(iN(t)))throw Error(`Cannot combine buffered and streaming success responses for status ${r} and content-type: ${t}`);o.set(r,{...n,stream:e})}else{let t=VN(o,r),i=vN(e.ast);if(t.stream!==void 0){if(i)throw Error(`Cannot combine no-content and streaming success responses for status: ${r}`);let e=ON(n),a=iN(e.contentType);if(t.stream.contentTypes.some(e=>iN(e)===a))throw Error(`Cannot combine buffered and streaming success responses for status ${r} and content-type: ${e.contentType}`)}i||t.bufferedContentTypes.add(iN(ON(n).contentType)),t.noContent=t.noContent||i}}HN(e,DN)}function VN(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function HN(e,t){let n=new Map;for(let r of e){let e=t(r),i=bN(r.ast),a=gN(r)?r.schema:i?.body??r,o=vN(a.ast)?``:iN(sN(a)?a.contentType:ON(r).contentType),s=n.get(e);s===void 0&&(s={headerContentType:void 0,plainContentTypes:new Set},n.set(e,s));let c=()=>Error(`Cannot combine a response with headers with another response for status ${e} and content-type: ${o||`<no content>`}`);if(gN(r)||i!==void 0){if(s.headerContentType!==void 0)throw Error(`Cannot declare multiple responses with headers for status ${e}`);if(s.plainContentTypes.has(o))throw c();s.headerContentType=o}else{if(s.headerContentType===o)throw c();s.plainContentTypes.add(o)}}}function oae(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(cN(e)&&sae(e.events.ast))throw Error(`SSE event name is reserved: ${zN}`)}function sae(e){return UN(Tx(e),new Set)}function UN(e,t){if(t.has(e))return!1;if(t.add(e),nb(e))return e.types.some(e=>UN(e,t));if(rb(e))return UN(e.thunk(),t);if(!tb(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&WN(n.type,t)}function WN(e,t){if(t.has(e))return!1;t.add(e);let n=Tx(e);return n===e?$y(e)?e.literal===zN:nb(e)?e.types.some(e=>WN(e,t)):rb(e)?WN(e.thunk(),t):!1:WN(n,t)}function cae(e){let t=TN(e.ast),n=bN(e.ast);return n===void 0?GN(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:GN(n.body,t),headersCodec:jN(n.headers)}})}function GN(e,t){switch(t._tag){case`Json`:return yw(e);case`FormUrlEncoded`:return bw(e);case`Text`:case`Uint8Array`:return e}}function lae(e,t){if(!bj(t))return jN(e);switch(wN(e.ast,t)._tag){case`Json`:return yw(e);case`FormUrlEncoded`:return bw(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var KN=LN(`GET`),qN=LN(`POST`),JN=LN(`PUT`),YN=LN(`PATCH`),XN=LN(`DELETE`),ZN=`~effect/http-api/HttpApi`,uae={[ZN]:ZN,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)ft(t,n.identifier,n);return $N({...QN(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];ft(t,n,r.annotateMerge(Rr(e.annotations,r.annotations)))}return $N({...QN(this),groups:t})},prefix(e){return $N({...QN(this),groups:ni(this.groups,t=>t.prefix(e))})},middleware(e){return $N({...QN(this),groups:ni(this.groups,t=>t.middleware(e))})},annotate(e,t){return $N({...QN(this),annotations:Or(this.annotations,e,t)})},annotateMerge(e){return $N({...QN(this),annotations:Rr(this.annotations,e)})}},QN=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),$N=e=>{function t(){}return Object.setPrototypeOf(t,uae),Object.assign(t,e)},dae=e=>$N({identifier:e,groups:{},annotations:Tr()}),eP=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=Rr(e.annotations,r.annotations);t.onGroup({group:r,mergedAnnotations:n});let i=Object.values(r.endpoints);for(let e of i)(!t.predicate||t.predicate({endpoint:e,group:r}))&&t.onEndpoint({group:r,endpoint:e,middleware:e.middlewares,mergedAnnotations:Rr(n,e.annotations),successes:tP($ie(e),DN),errors:tP(eae(e),AN)})}},tP=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){let r=gN(e)?e.schema:e;if(sN(r)||fN(r))return;let i=t(e),a=n.get(i);a===void 0?n.set(i,[e]):a.push(e)}},fae=class extends dr()(`effect/http-api/HttpApi/ParseOptions`){},nP=class extends dr()(`effect/http-api/HttpApi/ParamsParseOptions`){},rP=class extends dr()(`effect/http-api/HttpApi/QueryParseOptions`){},pae=class extends dr()(`effect/http-api/HttpApi/HeadersParseOptions`){},iP=class extends dr()(`effect/http-api/HttpApi/PayloadParseOptions`){},mae=class extends dr()(`effect/http-api/HttpApi/SuccessParseOptions`){},hae=class extends dr()(`effect/http-api/HttpApi/ErrorParseOptions`){},aP=e=>{let t=Ar(e,fae);return{params:Ar(e,nP)??t,query:Ar(e,rP)??t,headers:Ar(e,pae)??t,payload:Ar(e,iP)??t,success:Ar(e,mae)??t,error:Ar(e,hae)??t}},gae=new Set;function _ae(e){if(e===void 0)return gae;let t=cx(e.ast);return tb(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}function vae(e,t,n){let r=/::|:(\w+)/g,i=``,a=0;for(let o=r.exec(e);o!==null;o=r.exec(e)){let s=o[1];if(s===void 0||t!==void 0&&!t.has(s))continue;let c=r.lastIndex;e[c]===`(`&&(c=TM(e,c)+1);let l=e[c]===`?`;l&&c++;let u=n(s,l),d=o.index;u===void 0&&e[d-1]===`/`&&d--,i+=e.slice(a,d)+(u??``),r.lastIndex=c,a=c}return i+e.slice(a)}var oP=`~effect/http-api/HttpApiClient/Upgraded`,yae=(e,t)=>H(function*(){let n=yield*$p(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:mM(Vj(t.baseUrl.toString())));function i(e,t,a,o,s){if(s===-1)return r.execute(a);let c=n.mapUnsafe.get(o[s]);return c===void 0?i(e,t,a,o,s-1):c({endpoint:t,group:e,request:a,next(n){return i(e,t,n,o,s-1)}})}eP(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,mergedAnnotations:a}=e,o=aP(a),s=lP(r.path,r.params),c=gP(r),l=Cae(e),u=vO(r.params,e=>IS(e,o.params)),d=[],f;for(let e of Qie(r))lN(e)||uN(e)?f=e:d.push(e);let p=vO(f,e=>({contentType:e.contentType,encode:Iae(e,o.payload)})),m=di(d)?IS(bj(r.method)?Lae(d,r.method):aC(d),o.payload):void 0,h=vO(r.headers,e=>IS(e,o.headers)),g=vO(r.query,e=>IS(e,o.query)),_=Array.from(e.middleware,e=>`${e.key}/Client`),v=Hm(function*(e){let a=jj(r.method)(r.path);if(e!==void 0){if(u!==void 0){let t=yield*u(e.params);a=Bj(a,s(t))}if(p!==void 0&&pD(e.payload)){let t=yield*$p();a=Kj(a,ZA(tO(p.encode(e.payload),t),p.contentType))}else if(m!==void 0){if(bj(r.method)){if(e.payload instanceof FormData)a=qj(a,e.payload);else{let t=yield*m(e.payload);a=Kj(a,t)}}else{let t=yield*m(e.payload);a=Wj(a,t)}}else if(p!==void 0)return yield*new ES(new zv({message:`Expected a Stream payload`},e.payload));if(h!==void 0){let t=yield*h(e.headers);a=Ij(a,t)}if(g!==void 0){let t=yield*g(e.query);a=Wj(a,t)}}c!==void 0&&(a=zj(a,c.protocol));let o=yield*i(n,r,a,_,_.length-1);if(e?.responseMode===`response-only`)return o;let d=l(o,e?.sseOptions),f=yield*t.transformResponse===void 0?d:t.transformResponse(d);return e?.responseMode===`decoded-and-response`?[f,o]:f});t.onEndpoint({...e,endpointFn:v})}})}),sP=(e,t)=>Cp(cM,n=>bae(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),bae=(e,t)=>{let n={};return yae(e,{...t,onGroup({group:e}){e.topLevel||ft(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){ft(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(kp(n))},cP=(e,t)=>{let n={};return eP(e,{onGroup({group:e}){e.topLevel||ft(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=aP(i),o=lP(r.path,r.params),s=r.params===void 0?void 0:zS(r.params,a.params),c=r.query===void 0?void 0:zS(r.query,a.query);ft(e.topLevel?n:n[e.identifier],r.identifier,e=>{let n=e?.params,i=n===void 0?r.path:o(s===void 0?n:s(n)),a=e?.query===void 0?void 0:c===void 0?e.query:c(e.query),l=a===void 0?$_:J_(a);if(t?.baseUrl===void 0){let e=rv(l);return e===``?i:`${i}?${e}`}let u=new URL(Vj(Mj(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,V_(t));return u.toString()})}}),n},lP=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=_ae(t);return t=>vae(e,n,(e,n)=>{let r=t[e];if(r===`.`||r===`..`)throw Error(`Invalid path parameter: ${e}`);if(r!==void 0)return encodeURIComponent(r);if(!n)throw Error(`Missing path parameter: ${e}`)})};function uP(e,t,n){let r=e.some(e=>gN(e)||bN(e.ast)!==void 0),i=MS(r?aC(e.map(e=>Sae(e,t,n))):Nae(e),t);return e=>Cp(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var xae=q({body:qS,headers:qS});function Sae(e,t,n){let r=bN(e.ast),i=r===void 0?gN(e)?{body:e.schema,headers:e.headers,toValue:hN}:{body:e,headers:qS,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=MS(bP(i.body).pipe(pC(i.body)),t),o=MS(i.headers,n);return xae.pipe(pC(gN(e)?e:WS(e),Py({decode:e=>op({body:a(e.body),headers:o(e.headers)}).pipe(Op(i.toValue),Fp(e=>e.issue)),encode:(e,t)=>U(new Vv({message:`Decode only schema`},e,t))})))}var Cae=e=>{let{endpoint:t,errors:n,successes:r,mergedAnnotations:i}=e,a=aP(i),o={orElse:Pae},s=new Map;for(let[e,t]of n.entries()){let n=pP(t);for(let[t,r]of n.entries())dP(s,e,t,uP(r,a.error,a.headers))}for(let[e,t]of s.entries()){let n=fP(t);o[e]=e=>Cp(Pp(n(e),t=>_p(Cu(hu(new cj({reason:new gj({request:e.request,response:e})})),t))),U)}let c=new Map;for(let[e,t]of r.entries()){let n=pP(t);for(let[t,r]of n.entries())dP(c,e,t,uP(r,a.success,a.headers))}for(let e of Tae(t)){let t=hP(e)?e.schema:e,n=DN(e),r=Eae(e,a.success,a.headers);for(let e of t.contentTypes)dP(c,n,e,r)}for(let[e,t]of c.entries())o[e]=fP(t);let l=gP(t);if(l!==void 0){let e=l.headers===void 0?B:MS(l.headers,a.headers);o[101]=t=>xm(n=>Cp(t.upgrade,r=>n(e(t.headers)).pipe(Op(e=>({[oP]:oP,headers:e,socket:r})),pm(()=>Bp(sm(r.reader))))))}return(e,t)=>(o[e.status]??o.orElse)(e,t)};function dP(e,t,n,r){let i=iN(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function fP(e){let t=e[0];return t!==void 0&&e.every(e=>e.decode===t.decode)?t.decode:(t,n)=>{let r=iN(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?wae(t,r,e):i.decode(t,n)}}function pP(e){let t=new Map;for(let n of e){let e=vN((gN(n)?n.schema:n).ast)?``:iN(ON(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function wae(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return U(new cj({reason:new _j({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var mP=`effect/http-api/stream/failure`,hP=e=>gN(e);function gP(e){for(let t of e.success)if(fN(t))return t}function Tae(e){let t=[];for(let n of e.success)sN(gN(n)?n.schema:n)&&t.push(n);return t}function Eae(e,t,n){let r=hP(e),i=Dae(r?e.schema:e,t),a=(e,t)=>Op($p(),n=>tO(i(e,t),n));if(!r)return a;let o=MS(e.headers,n);return(e,t)=>Cp(o(e.headers),n=>Op(a(e,t),e=>hN({body:e,headers:n})))}function Dae(e,t){if(lN(e))return e=>e.stream;if(uN(e)){let n=MS(yw(e.schema),t),r=Dh(e.maxElementBytes);return e=>e.stream.pipe(XD(xA({ignoreEmptyLines:!0,maxLineBytes:r})),JD(t=>pA(t)?t.reason===`LineTooLarge`?new cj({reason:new _j({request:e.request,response:e,description:`NDJSON line exceeds maxElementBytes of ${r} bytes`})}):kae(t):t),FD(e=>n(e)))}let n=Aae(e,t);return(t,r)=>jae(t.stream,e,n(r))}var Oae=e=>pA(e)&&e.kind===`Pack`,kae=e=>new ES(new zv({message:e.reason===`InvalidUtf8`?`Expected valid UTF-8`:e.unterminated?`Expected a valid JSON line, got an unterminated final line`:`Expected a valid JSON line`}));function Aae(e,t){let n=aC([q({id:W(K),event:G(mP),data:WC(yw(ZC(e.error,zC())))}),e.events]),r=DA(n,void 0,t);return e=>e===void 0?r:DA(n,e,t)}function jae(e,t,n){let r=_D(e.pipe(ZD,XD(n)),e=>V(()=>{let t;return fp(()=>t===void 0?Cp(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===mP&&du(r.data)){if(n===0)return _p(r.data);t=r.data,e=e.slice(0,n);break}}return B(e)}):_p(t))}));return t.sseMode===`data`?PD(r,e=>e.data):r}var _P=hC(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),Mae=_P.pipe(pC(YC,Fy({decode(e){return new Uint8Array(e)},encode(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}}))),vP=_P.pipe(pC(K,Fy({decode(e){return new TextDecoder().decode(e)},encode(e){let t=new TextEncoder().encode(e);return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}}))),yP=vP.pipe(pC(aC([G(``).pipe(pC(YS,Fy({decode:()=>void 0,encode:()=>``}))),GC])));function Nae(e){return aC(e.map(t));function t(e){return bP(e).pipe(pC(e))}}function bP(e){switch(TN(e.ast)._tag){case`Json`:return fne(Tx(e.ast))?yP.pipe(pC(qS,Fy({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):yP;case`FormUrlEncoded`:return vP.pipe(pC(ow,Fy({decode:e=>J_(new URLSearchParams(e)),encode:rv})));case`Uint8Array`:return Mae;case`Text`:return vP}}var Pae=e=>U(new cj({reason:new _j({request:e.request,response:e,description:`undeclared status code`})})),Fae=TS(RA);function Iae(e,t){if(lN(e))return e=>e;let n=IS(rC(yw(e.schema)),t);return e=>e.pipe(ID(e=>n(e)),XD(hA()),qD(Oae,ED))}function Lae(e,t){return aC(e.map(e=>Rae(e,t)))}var xP=new WeakMap;function Rae(e,t){let n=e.ast,r=xP.get(n);if(r!==void 0)return r;let i=wN(n,t),a=Fae.pipe(pC(e,Py({decode(e,t){return U(new Vv({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return U(new Vv({message:`Payload must be a FormData`},e,t));case`Json`:try{return B(KA(JSON.stringify(e),i.contentType))}catch{return U(new zv({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?B(KA(e,i.contentType)):U(new zv({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?B(qA(J_(e),i.contentType)):U(new zv({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?B(HA(e,i.contentType)):U(new zv({message:`Expected a Uint8Array`},e,t))}}})));return xP.set(n,a),a}var SP=`~effect/reactivity/AtomRef`,CP=e=>new Bae(e),wP={count:0,generate(){return`AtomRef-${this.count++}`}},zae=class{[SP];key=wP.generate();value;constructor(e){this[SP]=SP,this.value=e}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}listeners=null;notify(e){let t=this.listeners;for(;t!==null;)t.f(e),t=t.next}subscribe(e){let t={f:e,prev:null,next:this.listeners};return this.listeners&&(this.listeners.prev=t),this.listeners=t,()=>{this.listeners===t&&(this.listeners=t.next),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)}}map(e){return new TP(this,e)}},Bae=class extends zae{prop(e){return new Vae(this,e)}set(e){return be(e,this.value)||(this.value=e,this.notify(e)),this}update(e){return this.set(e(this.value))}},TP=class e{[SP];key=wP.generate();parent;transform;constructor(e,t){this[SP]=SP,this.parent=e,this.transform=t}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.transform(this.parent.value)}subscribe(e){let t=this.transform(this.parent.value);return this.parent.subscribe(n=>{let r=this.transform(n);be(r,t)||(t=r,e(r))})}map(t){return new e(this,t)}},Vae=class e{[SP];key=wP.generate();previous;parent;_prop;constructor(e,t){this[SP]=SP,this.parent=e,this._prop=t,this.previous=e.value[t]}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.parent.value&&this._prop in this.parent.value&&(this.previous=this.parent.value[this._prop]),this.previous}subscribe(e){let t=this.value;return this.parent.subscribe(n=>{if(!n||!(this._prop in n))return;let r=n[this._prop];be(r,t)||(t=r,e(r))})}map(e){return new TP(this,e)}prop(t){return new e(this,t)}set(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e,this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e});return this}update(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e(this.parent.value[this._prop]),this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e(this.parent.value[this._prop])});return this}},EP=class extends dr()(`effect/workers/Transferable/Collector`){},Hae=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return EP.of({addAllUnsafe:t,addAll:e=>V(()=>t(e)),readUnsafe:n,read:V(n),clearUnsafe:r,clear:V(r)})},Uae=aC([class extends vw(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:mC(`WorkerSpawnError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerSendError`)({_tag:mC(`WorkerSendError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:mC(`WorkerReceiveError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:mC(`WorkerUnknownError`),message:K,cause:W(zC())}){}]),DP=(e,t)=>e===void 0?t:`${e}.${t}`,OP=(e,t)=>({"rpc.system.name":`effect_rpc`,"rpc.method":e,...t}),Wae=`~effect/PrimaryKey`,kP=`~effect/rpc/RpcSchema/StreamSchema`;function AP(e){return F(e,kP)}function jP(e){return AP(e)?qn({success:e.success,error:e.error}):Kn()}var Gae=TS(pD);function Kae(e,t){return BS(Gae.ast,{[kP]:kP,success:e,error:t})}var MP=`~effect/rpc/Rpc`,qae={[MP]:MP,pipe(){return n(this,arguments)},setSuccess(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return NP({_tag:this._tag,payloadSchema:VS(e)?e:q(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return NP({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Or(this.annotations,e,t)})},annotateMerge(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Rr(this.annotations,e)})}},NP=e=>{function t(){}return Object.setPrototypeOf(t,qae),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},PP=(e,t)=>{let n=t?.success??QS,r=t?.error??KS,i=t?.defect??zC(),a;return a=t?.primaryKey?class extends _w(`effect/rpc/Rpc/${e}`)(t.payload){[Wae](){return t.primaryKey(this)}}:VS(t?.payload)?t?.payload:t?.payload?q(t?.payload):QS,NP({_tag:e,payloadSchema:a,successSchema:t?.stream?Kae(n,r):n,errorSchema:t?.stream?KS:r,defectSchema:i,annotations:Tr(),middlewares:new Set})},FP=new WeakMap,Jae=e=>{if(FP.has(e))return FP.get(e);let t=e,n=new Set([t.errorSchema]),r=jP(t.successSchema);Yn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=aw(Yn(r)?QS:t.successSchema,aC([...n]),t.defectSchema);return FP.set(e,i),i},Yae=Br(`effect/rpc/Rpc/ParseOptions`,{defaultValue:()=>ab}),Xae=`~effect/rpc/Rpc/Wrapper`,Zae=e=>Xae in e,IP=`~effect/rpc/RpcClientError`,LP=class extends vw(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:mC(`RpcClientDefect`),message:K,cause:zC()}){},RP=class extends vw(IP)({_tag:mC(`RpcClientError`),reason:aC([Uae,BM,yj,LP])}){[IP]=IP;get message(){return`${this.reason._tag}: ${this.reason.message}`}},zP=e=>e,Qae={_tag:`Ping`},$ae=yw,eoe,toe=e=>(eoe??=new TextDecoder).decode(e),BP=class extends dr()(`effect/rpc/RpcSerialization`){},noe=BP.of({contentType:`application/json`,includesFraming:!1,codecFor:$ae,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:toe(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),roe=e=>fp(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>em(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),pp});return Op(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return H(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*nm(fp(()=>i(e)),t)}return yield*hm(gp,()=>(t.delete(e),r.delete(e),pp))})}}))}),ioe=0,aoe=Hm(function*(e,t){let n=t.spanPrefix,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>ioe++),s=yield*$p(),c=Nr(s,ed),l=new Map,u=!1;yield*ad(c,Sp(e=>(u=!0,d(Fu(e.id)))));let d=Hm(function*(e){let t=Array.from(l.values());l.clear();for(let n of t)n._tag===`Queue`?yield*e._tag===`Success`?MT(n.queue):AT(n.queue,e.cause):n.resume(e)},bm),f=e=>{let r=AP(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?M_(s.headers):j_,l=s?.context??Tr();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):wm(DP(n,e._tag),{kind:`client`,attributes:OP(e._tag,t.spanAttributes)},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:ND(Op(u,OD))}},p=(e,n,r,i,s,c,d)=>Sp(f=>{if(u)return _m;let p=a(),m=n(e=>t.onFromClient({message:e,context:c}),{_tag:`Request`,id:p,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:I_(f.getRef(VP),s),...d?{discard:!0}:{}}),h;return ym(hp(t=>{let n=!1,i={_tag:`Effect`,rpc:e,context:c,resume(e){d&&e._tag===`Success`?(n=!0,h?.pollUnsafe()&&t(Iu)):(t(e),h&&!h.pollUnsafe()&&f.currentDispatcher.scheduleTask(()=>{h.interruptUnsafe(f.id)},0))}};l.set(p,i),h=m.pipe(r?Tm(r,{captureStackTrace:!1}):o,jm(f.context)),h.addObserver(e=>{if(e._tag===`Failure`)return l.delete(p),t(e);if(n)return t(Iu)})}),e=>(l.delete(p),Tp(Jw(h),g(p,Array.from(e),c))))}),m=Hm(function*(e,r,s,c,d,f){if(u)return yield*_m;let p=i?void 0:yield*Cm(DP(n,e._tag),{kind:`client`,attributes:OP(e._tag,t.spanAttributes)}),m=Xw(),h=a(),_=Mr(m.context,ed),v=yield*ET(d);return yield*id(_,e=>(PT(v),l.has(h)?(l.delete(h),g(h,Ru(e)?Array.from(Pte(e.cause)):[],f)):pp)),l.set(h,{_tag:`Queue`,rpc:e,queue:v,scope:_,context:f}),yield*r(e=>t.onFromClient({message:e,context:f}),{_tag:`Request`,id:h,tag:e._tag,payload:s,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:I_(m.getRef(VP),c)}).pipe(p?Tm(p,{captureStackTrace:!1}):o,pm(e=>(xu(e)||l.delete(h),AT(v,e))),vm,Dm(_,{startImmediately:!0})),v}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=jr(s,`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r)=>hp(i=>{let a=Xw();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r}).pipe(Up(1e3),jm(a.context)).addObserver(()=>{i(pp)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=l.get(n);return!i||i._tag!==`Queue`?pp:hie(i.queue,e.values).pipe(r?Cp(n=>n.length>0?pp:t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context})):o,Pp(e=>AT(i.queue,e)))}case`Exit`:{let t=e.requestId,n=l.get(t);return n?(l.delete(t),n._tag===`Effect`?(n.resume(e.exit),pp):e.exit._tag===`Success`?MT(n.queue):AT(n.queue,e.exit.cause)):pp}case`Defect`:return d(zte(e.defect));case`ClientEnd`:return pp}},v;if(t.flatten){let t=new Map;v=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else v={},e.requests.forEach(e=>{ft(v,e._tag,f(e))});return{client:v,write:_}}),ooe=0,soe=Hm(function*(e,t){let n=ooe++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*HP,c=coe(r),l=Mre(r(zC())),u=new Map,d=Vu(),f=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):pp,{client:p,write:m}=yield*aoe(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Hae():void 0,o=Xw(),l={rpc:r,context:i?Or(o.context,EP,i):o.context,schemas:c(r),discard:t.discard===!0};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(nm(l.context),Ip,Cp(e=>Ju(d)?(u.delete(t.id),_m):a(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},i&&i.readUnsafe())),pm(e=>xu(e)?pp:V(()=>u.delete(t.id))))}case`Ack`:return u.get(t.requestId)?a(n,{_tag:`Ack`,requestId:t.requestId}):pp;case`Interrupt`:return f(t.requestId);case`Eof`:return pp}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=zP(e.requestId),n=u.get(t);if(!n||Jn(n.schemas.decodeChunk))return pp;let r=n.schemas.decodeChunk.value;return xm(i=>i(r(e.values).pipe(nm(n.context),Ip,Cp(e=>m({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(pm(e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:Nu(e)}).pipe(Tp(Eu(e)?pp:Jp(Bp(f(t)),Uu(d))))),dne(e=>!Eu(e),()=>pp)))}case`Exit`:{let t=zP(e.requestId),n=u.get(t);return n?(u.delete(t),n.discard&&e.exit._tag===`Success`?m({_tag:`Exit`,clientId:0,requestId:t,exit:Iu}):(n.discard?n.schemas.decodeDiscardExit:n.schemas.decodeExit)(e.exit).pipe(nm(n.context),Ip,Zp({onSuccess:e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:Nu(e)})}))):pp}case`Defect`:return u.clear(),m({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=Pu(e.error),n=e.requestIds===void 0?Array.from(u.keys()):e.requestIds.map(zP).filter(e=>u.has(e));for(let e of n)u.delete(e);return sp(n,e=>m({_tag:`Exit`,clientId:0,requestId:e,exit:t})).pipe(bm)}default:return pp}}).pipe(Pp(Gm),vm,Om),yield*dm(()=>Yu(d,void 0)),p}),coe=e=>{let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=jP(n.successSchema),a=Nr(n.annotations,Yae),o=Jae(n),s;return r={decodeChunk:ir(i,t=>MS(e(rC(t.success)),a)),encodePayload:LS(e(n.payloadSchema),a),decodeExit:MS(e(o),a),decodeDiscardExit:t=>(s??=MS(e(aw(QS,o.error,o.defect)),a))(t)},t.set(n,r),r}},VP=Br(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>j_}),HP=class extends dr()(`effect/rpc/RpcClient/Protocol`){static make=roe},loe=e=>HP.make(Hm(function*(t,n){let r=yield*OM,i=yield*BP,a=yield*rm(foe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*doe(fp(()=>c.write(l.encode(Qae))),e),f=Vp(e?.onPingTimeout??pp,{log:!0,message:`RpcClient onPingTimeout hook failed`}),p,m=e=>{let r=sp(Array.from(n),n=>t(n,e));return e._tag!==`Defect`&&e._tag!==`ClientProtocolError`?r:(s.clear(),bm(r))},h=e=>(p=e,m({_tag:`ClientProtocolError`,error:e})),g=e=>{try{let n=l.decode(e);if(n.length===0)return pp;u.onFrame();let r=0;return cp({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return pp;if(Object.hasOwn(e,`requestId`)){let n=e.requestId,r=s.get(n);if(r!==void 0)return e._tag===`Exit`&&s.delete(n),t(r,e)}return m(e)},step:d})}catch(e){return m({_tag:`ClientProtocolError`,error:new RP({reason:new LP({message:`Error decoding message`,cause:e})})})}};yield*fp(()=>{l=i.makeUnsafe(),u.reset();let e=!1;return H(function*(){let{pull:t}=yield*r.reader;for(p=void 0,e=!0,Yn(a)&&(yield*a.value.onConnect);;){let e=yield*t;for(let t=0;t<e.length;t++)yield*g(e[t])}}).pipe(sm,Jp(u.timeout),Tp(()=>e?f:pp),Tp(()=>U(new VM({reason:new FM({cause:Error(`ping timeout`)})}))))}).pipe(Yn(a)?fm(a.value.onDisconnect):o,Rp(t=>{let n=Nte(t),r=qr(n),i=new RP({reason:r?n.success.reason:new LP({message:`Unknown socket error`,cause:wu(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??pp).pipe(Vp({log:!0,message:`RpcClient onTransientError hook failed`})):h(i)}),zp(e?.retryPolicy??uoe,e=>h(new RP({reason:e.reason}))),Km({module:`RpcClient`,method:`makeProtocolSocket`}),Om);let _=e=>fp(()=>{let t=l.encode(e);return t===void 0?pp:Ip(c.write(t))});return{send(e,t){return p?U(p):(t._tag===`Interrupt`&&s.delete(t.requestId),t._tag===`Request`?(s.set(t.id,e),pm(_(t),()=>V(()=>s.delete(t.id)))):_(t))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),uoe=Wte([Kte(500,1.5),Zf(5e3)]),doe=Hm(function*(e,t){let n=yield*Bd,r=t?.pingInterval??`5 seconds`,i=Qi(t?.pingTimeout??r),a=n.currentTimeMillisUnsafe(),o=!1,s=Qw(),c=()=>{a=n.currentTimeMillisUnsafe(),o=!1};return yield*fp(()=>o&&n.currentTimeMillisUnsafe()-a>i?s.open:(o=!0,e)).pipe(Kp(r),Bp,Sm,vm,Om),{timeout:s.await,reset:()=>{c(),s.closeUnsafe()},onFrame:c}}),foe=class extends dr()(`effect/rpc/RpcClient/ConnectionHooks`){},poe=t((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,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(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+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(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 I=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)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.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)!T.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 E(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)T.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 E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),UP=t(((e,t)=>{t.exports=poe()})),Z=e(UP(),1),moe=Z.use,WP=Z.useLayoutEffect;function hoe(e,t,n){Z.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function goe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function GP(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function KP(e){return e[e.length-1]}function qP(e,t){return typeof e==`function`?e(t):e}var JP=Object.prototype.hasOwnProperty,_oe=Object.prototype.propertyIsEnumerable;function voe(e){for(let t in e)if(JP.call(e,t))return!0;return!1}var yoe=()=>Object.create(null),boe=(e,t)=>YP(e,t,yoe);function YP(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=$P(e)&&$P(i);if(!a&&!(ZP(e)&&ZP(i)))return i;let o=a?e:XP(e);if(!o)return i;let s=a?i:XP(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:JP.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=YP(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function XP(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!_oe.call(e,r))return!1;t.push(r)}return t}function ZP(e){if(!QP(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!QP(n)||!n.hasOwnProperty(`isPrototypeOf`))}function QP(e){return Object.prototype.toString.call(e)===`[object Object]`}function $P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eF(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!eF(e[r],t[r],n))return!1;return!0}if(ZP(e)&&ZP(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!eF(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!eF(e[o],t[o],n)))return!1;return i===a}return!1}function xoe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Soe=/[\x00-\x1f\x7f"<>`{}]/g;function Coe(e){return e.replace(Soe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function tF(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Coe(t)}var woe=[`http:`,`https:`,`mailto:`,`tel:`];function nF(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Toe(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=tF(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=tF(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Eoe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Doe(e,t){if(e===t)return!0;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 rF(){throw Error(`Invariant failed`)}function iF(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var aF=4,oF=5;function sF(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function cF(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=sF(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=uF(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=Ooe(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=uF(r);e.kind=oF,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=uF(r);e.kind=aF,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)cF(e,t,r,c,i,a,o,s)}function lF(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function uF(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ooe(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function koe(e,t){let n=uF(`/`),r=new Uint16Array(6),i=[];for(let t of e)cF(!1,r,t,1,n,0,i);for(let e of i)e.sort(lF);t.masksTree=n,t.flatCache=iF(1e3)}function Aoe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=dF(e,t.masksTree);return t.flatCache.set(e,r),r}function joe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=uF(`/`),cF(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),dF(r,o,n)}function Moe(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=dF(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=pF(a.route)),t.matchCache.set(r,a),a}function Noe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Poe(e,t=!1,n){let r=uF(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;cF(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&rF(),o[e.id]=e,c!==0&&e.path){let t=Noe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(lF);return{processedTree:{segmentTree:r,singleCache:iF(1e3),matchCache:iF(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function dF(e,t,n=!1){let r=e.split(`/`),i=Ioe(e,r,t,n);if(!i)return null;let[a]=fF(e,r,i);return{route:i.node.route,rawParams:a}}function fF(e,t,n){let r=Foe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===aF)break;if(u.kind===oF){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length;if(e.charCodeAt(t)===123){let n=u.suffix.length,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length,r=u.suffix.length,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function pF(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Foe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ioe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!KP(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!gF(l,n))continue;if(i.parse){if(!hF(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==aF&&gF(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===aF||i.kind===2)&&gF(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(hF(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Loe(f,o))return n;gF(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+mF(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+mF(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+mF(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+mF(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function mF(e,t){return 2**(e-t-1)}function Loe(e,t){return e===2**(t-1)-1}function hF(e,t,n){let r,i;try{[r,i]=fF(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function gF(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===aF)>(e.node.kind===aF)||t.node.kind===aF==(e.node.kind===aF)&&t.node.depth>e.node.depth)))}function Roe(e){return _F(e.filter(e=>e!==void 0).join(`/`))}function _F(e){return e.replace(/\/{2,}/g,`/`)}function vF(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function yF(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function zoe(e){return yF(vF(e))}function bF(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Boe(e,t,n){return bF(e,n)===bF(t,n)}function Voe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=_F(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=_F(e)),o=e.split(`/`);o.length>1&&KP(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(KP(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?_F(s):s)||`/`;return a&&r&&r.set(a,c),c}function Hoe(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function xF(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>SF(e,n)).join(`/`):SF(r,n):r}function Uoe({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=sF(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0)l+=`/`+e.substring(r,o);else if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=xF(`_splat`,t,n);l+=`/`+u+f+d}else if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=xF(s,t,n)??`undefined`;l+=`/`+u+f+d}else if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=xF(i,t,n)??``;l+=`/`+u+f+d}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function SF(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Woe=`Error preloading route! ☝️`,Goe=t((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})),CF=t(((e,t)=>{t.exports=Goe()})),Q=CF();function Koe({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:wF()?e:t})}function wF(){return Z.useSyncExternalStore(qoe,()=>!0,()=>!1)}function qoe(){return()=>{}}var TF=Z.createContext(null);function EF(e){return Z.useContext(TF)}var Joe=t((e=>{var t=UP();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),DF=t(((e,t)=>{t.exports=Joe()})),Yoe=t((e=>{var t=UP(),n=DF();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),OF=t(((e,t)=>{t.exports=Yoe()})),kF=OF();function Xoe(e,t){return e===t}function AF(e,t,n=Xoe){let r=(0,Z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,Z.useCallback)(()=>e?.get(),[e]);return(0,kF.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function jF(e){let t=EF();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Zoe(e){let t=EF(),n=jF(),r=Z.useRef(null);return WP(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function MF(e){let t=Z.useRef(e);return eF(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Qoe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function $oe(e,t,n){if(e?.external)return nF(e.href,n)?void 0:e.href;if(!ose(t)&&GP(t))return nF(t,n)?void 0:t}function ese(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Boe(e.pathname,t.pathname,r))return!1}else{let n=bF(e.pathname,r),i=bF(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!eF(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function tse(e,t){let n=EF(),r=goe(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:I,...L}=e,R=s,ee=wF(),z=MF(e.search),te=MF(e.params),ne=MF(o),re=Z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,z,te,e.state,e.mask,e.unsafeRelative]),ie=Z.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...re}),r=ase(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=$oe(r,R,n.protocolAllowlist);return[r?.href,i,ese(e,t,ne,n.basepath,ee,i!==void 0)]},[ne,v,ee,re,n,R]),[ae,oe,se]=AF(n.stores.location,ie,Qoe),ce=se?qP(i,{})??nse:NF,le=se?NF:qP(a,{})??NF,ue=[b,ce.className,le.className].filter(Boolean).join(` `),de=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},fe=Z.useRef(!1),pe=e.reloadDocument||oe||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=Z.useCallback(()=>{n.preloadRoute(re).catch(e=>{console.warn(e),console.warn(Woe)})},[n,re]),ge=Z.useCallback(e=>{e?e.isIntersecting??pe===`intent`?me?PF.has(r)||PF.set(r,setTimeout(()=>{PF.delete(r),he()},me)):he():e.isIntersecting===!1&&FF(r):FF(r)},[he,r,pe,me]);hoe(r,ge,pe!==`viewport`),Z.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;v||e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||r&&r!==`_self`||e.button!==0||(e.preventDefault(),n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(oe)return{...L,ref:r,href:oe,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&FF(r)};return{...L,...ce,...le,href:ae,ref:r,onClick:IF([x,_e]),onBlur:IF([S,ye]),onFocus:IF([C,ge]),onMouseEnter:IF([w,ge]),onMouseLeave:IF([T,ye]),onTouchStart:IF([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&rse,...se&&ise}}var NF={},nse={className:`active`},rse={role:`link`,"aria-disabled":!0},ise={"data-status":`active`,"aria-current":`page`},PF=new WeakMap,FF=e=>{clearTimeout(PF.get(e)),PF.delete(e)},IF=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ase(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ose(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var LF=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=tse(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return Z.createElement(`a`,t,o)}return Z.createElement(n,a,o)}),sse=e=>e,RF=t((e=>{var t=UP();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.8`})),zF=t(((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=RF()})),BF=t((e=>{var t=UP().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),VF=t(((e,t)=>{t.exports=BF()})),HF=t((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,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(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 x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){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,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(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`):w=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?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),UF=e(t(((e,t)=>{t.exports=HF()}))(),1);function WF(e){let t=UF.unstable_scheduleCallback(4,e);return()=>UF.unstable_cancelCallback(t)}var GF=Z.createContext(HO({scheduleTask:WF,defaultIdleTTL:400})),KF=new WeakMap,qF=0,JF=new Set;function YF(e){qF++;try{return e()}finally{qF--}}function XF(e){if(qF===0)return e();JF.size===0&&queueMicrotask(ZF),JF.add(e)}function ZF(){for(let e of JF)JF.delete(e),e()}function QF(e,t){let n=KF.get(e);n===void 0&&(n=new WeakMap,KF.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=0,a,o={subscribe(n){i++;let r=e.subscribe(t,()=>XF(n));return()=>{i--,JF.delete(n),r()}},snapshot(){return YF(()=>e.get(t))},getServerSnapshot(){return(i===0||a===void 0)&&(a={value:YF(()=>sA(t,e))}),a.value}};return n.set(t,o),o}function $F(e,t){let n=QF(e,t);return Z.useEffect(ZF),Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}function eI(e,t,n){let r=QF(e,t),i=Z.useMemo(()=>{let e;return t=>(e!==void 0&&Object.is(e.source,t)||(e={source:t,value:n(t)}),e.value)},[n]);return Z.useEffect(ZF),Z.useSyncExternalStore(r.subscribe,()=>i(r.snapshot()),()=>i(r.getServerSnapshot()))}var tI=(e,t)=>{let n=Z.useContext(GF);return t?eI(n,e,t):$F(n,e)};function nI(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function rI(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Im(GO(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(iI):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var iI=e=>{if(Lu(e))return e.value;throw wu(e.cause)},aI=e=>{nI(Z.useContext(GF),e)},oI=(e,t)=>{let n=Z.useContext(GF);return nI(n,e),rI(n,e,t)},sI=e=>{let t=Z.useContext(GF);return nI(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},cI=(e,t)=>{let n=Z.useContext(GF);return[$F(n,e),rI(n,e,t)]},lI={suspendOnWaiting:new WeakMap,default:new WeakMap};function uI(e,t,n){let r=n?lI.suspendOnWaiting:lI.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0&&(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a)),a}function dI(e,t,n){let r=$F(e,t);if(r._tag===`Initial`||n&&r.waiting)throw uI(e,t,n);return r}var fI=(e,t)=>{let n=dI(Z.useContext(GF),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw wu(n.cause);return n},pI=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},mI=DF();function hI(){}var gI=Object.freeze([]),_I=Object.freeze({});function vI(e){Z.useEffect(e,gI)}var yI={};function bI(e,t){let n=Z.useRef(yI);return n.current===yI&&(n.current=e(t)),n}var xI=typeof document<`u`?Z.useLayoutEffect:()=>{},SI=e(zF(),1);function CI(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var wI=CI(`https://base-ui.com/production-error`,`Base UI`),TI=19;function EI(e){return TI>=e}var DI=[],OI=void 0;function kI(){return OI}function AI(e){DI.push(e)}function jI(e){let t=(t,n)=>{let r=bI(NI).current,i;try{OI=r;for(let e of DI)e.before(r);i=e(t,n);for(let e of DI)e.after(r);r.didInitialize=!0}finally{OI=void 0}return i};return t.displayName=e.displayName||e.name,t}function MI(e){return Z.forwardRef(jI(e))}function NI(){return{didInitialize:!1}}var PI=EI(19)?LI:RI;function FI(e,t,n,r,i){return PI(e,t,n,r,i)}function II(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,mI.useSyncExternalStore)(e.subscribe,a,a)}AI({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,mI.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function LI(e,t,n,r,i){let a=kI();if(!a)return II(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],s.store===e&&s.selector===t&&Object.is(s.a1,n)&&Object.is(s.a2,r)&&Object.is(s.a3,i)||(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function RI(e,t,n,r,i){return(0,kF.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var zI=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return FI(this,e,t,n,r)}},BI={...Z},VI=BI.useInsertionEffect,HI=VI&&VI!==BI.useLayoutEffect?VI:e=>e();function UI(e){let t=bI(WI).current;return t.next=e,HI(t.effect),t.trampoline}function WI(){let e={next:void 0,callback:GI,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function GI(){}var KI=class extends zI{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;xI(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;xI(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;xI(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;xI(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Z.useDebugValue(e),FI(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=UI(t??hI);this.context[e]=n}useStateSetter(e){let t=Z.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function qI(){return typeof window<`u`}function JI(e){return ZI(e)?(e.nodeName||``).toLowerCase():`#document`}function YI(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function XI(e){return((ZI(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ZI(e){return qI()?e instanceof Node||e instanceof YI(e).Node:!1}function QI(e){return qI()?e instanceof Element||e instanceof YI(e).Element:!1}function $I(e){return qI()?e instanceof HTMLElement||e instanceof YI(e).HTMLElement:!1}function eL(e){return!qI()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof YI(e).ShadowRoot}function tL(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=fL(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function nL(e){return/^(table|td|th)$/.test(JI(e))}function rL(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var iL=/transform|translate|scale|rotate|perspective|filter/,aL=/paint|layout|strict|content/,oL=e=>!!e&&e!==`none`,sL;function cL(e){let t=QI(e)?fL(e):e;return oL(t.transform)||oL(t.translate)||oL(t.scale)||oL(t.rotate)||oL(t.perspective)||!uL()&&(oL(t.backdropFilter)||oL(t.filter))||iL.test(t.willChange||``)||aL.test(t.contain||``)}function lL(e){let t=mL(e);for(;$I(t)&&!dL(t);){if(cL(t))return t;if(rL(t))return null;t=mL(t)}return null}function uL(){return sL??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),sL}function dL(e){return/^(html|body|#document)$/.test(JI(e))}function fL(e){return YI(e).getComputedStyle(e)}function pL(e){return QI(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mL(e){if(JI(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||eL(e)&&e.host||XI(e);return eL(t)?t.host:t}function hL(e){let t=mL(e);return dL(t)?(e.ownerDocument||e).body:$I(t)&&tL(t)?t:hL(t)}function gL(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=hL(e),i=r===e.ownerDocument?.body,a=YI(r);if(i){let e=_L(a);return t.concat(a,a.visualViewport||[],tL(r)?r:[],e&&n?gL(e):[])}return t.concat(r,gL(r,[],n))}function _L(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vL(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function yL(e){return e?.ownerDocument||document}function bL(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var xL=null;globalThis.requestAnimationFrame;var SL=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},CL=class e{static create(){return new e}static request(e){return SL.request(e)}static cancel(e){return SL.cancel(e)}currentId=xL;request(e){this.cancel(),this.currentId=SL.request(()=>{this.currentId=xL,e()})}cancel=()=>{this.currentId!==xL&&(SL.cancel(this.currentId),this.currentId=xL)};disposeEffect=()=>this.cancel};function wL(){let e=bI(CL.create).current;return vI(e.disposeEffect),e}var TL=0,EL=class e{static create(){return new e}currentId=TL;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=TL,t()},e)}isStarted(){return this.currentId!==TL}clear=()=>{this.currentId!==TL&&(clearTimeout(this.currentId),this.currentId=TL)};disposeEffect=()=>this.clear};function DL(){let e=bI(EL.create).current;return vI(e.disposeEffect),e}function OL(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:kL,platform:AL,maxTouchPoints:jL}=OL(),ML=kL.toLowerCase(),NL=AL.toLowerCase(),PL=/^i(os$|p)/.test(NL)||NL===`macintel`&&jL>1,FL=`android`,IL=NL===FL||ML.includes(FL),LL=!PL&&NL.startsWith(`mac`);NL.startsWith(`win`),!IL&&/^(linux|chrome os)/.test(NL);var RL=LL||PL,zL=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!zL&&ML.includes(`firefox`),!zL&&ML.includes(`chrom`);var BL=RL,VL=/jsdom|happydom/.test(ML);function HL(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function UL(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&eL(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function WL(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var GL=`data-base-ui-focusable`,KL=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,qL=`ArrowLeft`,JL=`ArrowRight`,YL=`ArrowUp`,XL=`ArrowDown`,ZL=`data-starting-style`,QL=`data-ending-style`,$L={[ZL]:``},eR={[QL]:``},tR={transitionStatus(e){return e===`starting`?$L:e===`ending`?eR:null}},nR=`data-open`,rR=`data-closed`,iR=`data-anchor-hidden`,aR=`data-popup-open`,oR=`data-pressed`,sR={[aR]:``},cR={[aR]:``,[oR]:``},lR={[nR]:``},uR={[rR]:``},dR={[iR]:``},fR={open(e){return e?sR:null}},pR={open(e){return e?cR:null}},mR={open(e){return e?lR:uR},anchorHidden(e){return e?dR:null}},hR={...mR,...tR},gR=`data-trigger-disabled`;function _R(e,t){if(!QI(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(gR);for(let[,e]of t.entries())if(UL(e,n))return!e.hasAttribute(gR);return!1}function vR(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function yR(e){return e.matches(`html,body`)}function bR(e){return $I(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function xR(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${KL}`)!=null}function SR(e){return e?e.getAttribute(`role`)===`combobox`&&bR(e):!1}function CR(e){if(!e||VL)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function wR(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function TR(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...TR(e,t.id,n)])}function ER(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function DR(e){e.preventDefault(),e.stopPropagation()}function OR(e){return`nativeEvent`in e}function kR(e){return e.pointerType===``&&e.isTrusted?!0:IL&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function AR(e){return VL?!1:!IL&&e.width===0&&e.height===0||IL&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function jR(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function MR(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var NR=Math.min,PR=Math.max,FR=Math.round,IR=Math.floor,LR=e=>({x:e,y:e}),RR={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function zR(e,t,n){return PR(e,NR(t,n))}function BR(e,t){return typeof e==`function`?e(t):e}function VR(e){return e.split(`-`)[0]}function HR(e){return e.split(`-`)[1]}function UR(e){return e===`x`?`y`:`x`}function WR(e){return e===`y`?`height`:`width`}function GR(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function KR(e){return UR(GR(e))}function qR(e,t,n){n===void 0&&(n=!1);let r=HR(e),i=KR(e),a=WR(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=nz(o)),[o,nz(o)]}function JR(e){let t=nz(e);return[YR(e),t,YR(t)]}function YR(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var XR=[`left`,`right`],ZR=[`right`,`left`],QR=[`top`,`bottom`],$R=[`bottom`,`top`];function ez(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ZR:XR:t?XR:ZR;case`left`:case`right`:return t?QR:$R;default:return[]}}function tz(e,t,n,r){let i=HR(e),a=ez(VR(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(YR)))),a}function nz(e){let t=VR(e);return RR[t]+e.slice(t.length)}function rz(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function iz(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rz(e)}function az(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function oz(e,t){return t<0||t>=e.length}function sz(e,t){return lz(e.current,{disabledIndices:t})}function cz(e,t){return lz(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function lz(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&uz(e,a,r));return a}function uz(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!fz(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function dz(e){return e.visibility===`hidden`||e.visibility===`collapse`}function fz(e,t=e?fL(e):null){return!e||!e.isConnected||!t||dz(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var pz=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function mz(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return eL(n)?n.host:null}function hz(e){for(let t of Array.from(e.children))if(JI(t)===`summary`)return t;return null}function gz(e,t){let n=hz(t);return!!n&&(e===n||UL(n,e))}function _z(e){let t=e?JI(e):``;return e!=null&&e.matches(pz)&&(t!==`summary`||e.parentElement!=null&&JI(e.parentElement)===`details`&&hz(e.parentElement)===e)&&(t!==`details`||hz(e)==null)&&(t!==`input`||e.type!==`hidden`)}function vz(e){if(!_z(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=mz(t)){let n=t!==e,r=JI(t)===`slot`;if(t.hasAttribute(`inert`)||n&&JI(t)===`details`&&!t.open&&!gz(e,t)||t.hasAttribute(`hidden`)||!r&&!yz(t,n))return!1}return!0}function yz(e,t){let n=fL(e);return t?n.display!==`none`:fz(e,n)}function bz(e){let t=e.tabIndex;if(t<0){let t=JI(e);if(t===`details`||t===`audio`||t===`video`||$I(e)&&e.isContentEditable)return 0}return t}function xz(e){if(JI(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Sz(e,t){let n=xz(e);if(!n)return!0;let r=t.find(e=>{let t=xz(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=xz(e);return t?.name===n.name&&t.form===n.form})===n}function Cz(e){if($I(e)&&JI(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return $I(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wz(e,t){Cz(e).forEach(e=>{_z(e)&&t.push(e),wz(e,t)})}function Tz(e,t,n){Cz(e).forEach(e=>{$I(e)&&e.matches(t)&&n.push(e),Tz(e,t,n)})}function Ez(e){return vz(e)&&bz(e)>=0}function Dz(e){let t=[];return wz(e,t),t.filter(vz)}function Oz(e){let t=Dz(e);return t.filter(e=>bz(e)>=0&&Sz(e,t))}function kz(e,t){let n=Oz(e),r=n.length;if(r===0)return;let i=HL(yL(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Az(e){return kz(yL(e).body,1)||e}function jz(e){return kz(yL(e).body,-1)||e}function Mz(e,t){if(!e)return null;let n=Oz(yL(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Nz(e){return Mz(e,1)}function Pz(e){return Mz(e,-1)}function Fz(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!UL(n,r)}function Iz(e){Oz(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Lz(e){let t=[];Tz(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Rz={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},zz={...Rz,position:`fixed`,top:0,left:0},Bz={...Rz,position:`absolute`},Vz=Z.forwardRef(function(e,t){let[n,r]=Z.useState();xI(()=>{BL&&zL&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:zz,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function Hz(e,t,n,r){let i=bI(Wz).current;return Gz(i,e,t,n,r)&&qz(i,[e,t,n,r]),i.callback}function Uz(e){let t=bI(Wz).current;return Kz(t,e)&&qz(t,e),t.callback}function Wz(){return{callback:null,cleanup:null,refs:[]}}function Gz(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Kz(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function qz(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null:n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function Jz(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(EI(19)?n?.ref:t.ref)??null}function Yz(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Xz(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Zz(e,t){return typeof e==`function`?e(t):e}function Qz(e,t){return typeof e==`function`?e(t):e}var $z={};function eB(e,t,n,r,i){if(!n&&!r&&!i&&!e)return nB(t);let a=nB(e);return t&&(a=rB(a,t)),n&&(a=rB(a,n)),r&&(a=rB(a,r)),i&&(a=rB(a,i)),a}function tB(e){if(e.length===0)return $z;if(e.length===1)return nB(e[0]);let t=nB(e[0]);for(let n=1;n<e.length;n+=1)t=rB(t,e[n]);return t}function nB(e){return sB(e)?{...cB(e,$z)}:iB(e)}function rB(e,t){return sB(t)?cB(t,e):aB(e,t)}function iB(e){let t={...e};for(let e in t){let n=t[e];oB(e,n)&&(t[e]=uB(n))}return t}function aB(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Yz(e.style,r);break;case`className`:e[n]=fB(e.className,r);break;default:e[n]=oB(n,r)?lB(e[n],r):r}}return e}function oB(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function sB(e){return typeof e==`function`}function cB(e,t){return sB(e)?e(t):e??$z}function lB(e,t){return t?e?(...n)=>{let r=n[0];if(pB(r)){let i=r;dB(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:uB(t):e}function uB(e){return e&&((...t)=>{let n=t[0];return pB(n)&&dB(n),e(...t)})}function dB(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function fB(e,t){return t?e?t+` `+e:t:e}function pB(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function mB(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=vB(r));let i=hB(t,n,r);if(n.enabled===!1)return null;let a=n.state??_I;return yB(e,r,i,a)}function hB(e,t,n){let{className:r,style:i}=e,{state:a=_I,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Zz(r,a):void 0,d=l?Qz(i,a):void 0,f=l?Xz(a,c):_I,p=l&&s?gB(s):void 0,m=l?Yz(f,p)??{}:_I;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Uz([m.ref,Jz(n),...o]):Hz(m.ref,Jz(n),o):Hz(null,null)),l?(u!==void 0&&(m.className=fB(m.className,u)),d!==void 0&&(m.style=Yz(m.style,d)),m):_I}function gB(e){return Array.isArray(e)?tB(e):eB(void 0,e)}var _B=Symbol.for(`react.lazy`);function vB(e){if(e?.$$typeof!==_B)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function yB(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=eB(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return bB(e,n);throw Error(wI(8))}function bB(e,t){return e===`button`?(0,Z.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,Z.createElement)(`img`,{alt:``,...t,key:t.key}):Z.createElement(e,t)}function xB(e){return EI(19)?e:e?`true`:void 0}function SB(e){return e==null?e:`current`in e?e.current:e}var CB=null;function wB(e){if(!CB){let e=[];CB=e,queueMicrotask(()=>{CB=null,SI.flushSync(()=>{for(let t of e)t()})})}CB.push(e)}function TB(e,t=!1,n=!1){let r=wL();return UI((i,a=null)=>{r.cancel();let o=SB(e);if(o==null)return;let s=o,c=()=>{n?wB(()=>{a?.aborted||i()}):SI.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{a?.aborted||(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=ZL;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}else r.request(l)})}function EB(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=UI(a),s=TB(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var DB={style:{transition:`none`}},OB=`data-base-ui-click-trigger`,kB=`data-base-ui-swipe-ignore`,AB=`data-swipe-ignore`,jB=`[${kB}]`,MB=`[${AB}]`,NB={fallbackAxisSide:`none`},PB={fallbackAxisSide:`end`},FB={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function IB(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var LB=0;function RB(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(LB+=1,r(`${t}-${LB}`))},[n,t]),i}var zB=BI.useId;function BB(e,t){if(zB!==void 0){let n=zB();return e??(t?`${t}-${n}`:n)}return RB(e,t)}var VB=Z.createContext(void 0);function HB(e=!1){let t=Z.useContext(VB);if(t===void 0&&!e)throw Error(wI(16));return t}function UB(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function WB(e,t,{detail:n=0}={}){e.dispatchEvent(new(YI(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function GB(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=HB(!0),c=a??s!==void 0,{props:l}=UB({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;KB(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return xI(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return eB({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(dB(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=KB(r),s=!i&&qB(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),WB(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),WB(r,e)))},onKeyUp(e){t||(dB(e),a?.(e),e.target===e.currentTarget&&i&&c&&KB(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),WB(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:UI(e=>{o.current=e,u()})}}function KB(e){return $I(e)&&e.tagName===`BUTTON`}function qB(e){return $I(e)&&e.tagName===`A`&&!!e.href}var JB=`none`,YB=`trigger-press`,XB=`trigger-hover`,ZB=`trigger-focus`,QB=`outside-press`,$B=`item-press`,eV=`close-press`,tV=`focus-out`,nV=`escape-key`,rV=`list-navigation`,iV=`cancel-open`,aV=`sibling-open`,oV=`disabled`,sV=`missing`,cV=`initial`,lV=`imperative-action`,uV=`window-resize`;function dV(e,t,n,r){let i=!1,a=!1,o=r??_I;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function fV(e){return`data-base-ui-${e}`}var pV=Z.createContext(null),mV=()=>Z.useContext(pV),hV=fV(`portal`);function gV(e={}){let{ref:t,container:n,componentProps:r=_I,elementProps:i}=e,a=BB(),o=mV()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=UI(e=>{e!==null&&u(e)}),f=Z.useRef(null);xI(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(ZI(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=mB(`div`,r,{ref:[t,d],props:[{id:a,[hV]:``},i]}),m=s&&p?SI.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var _V=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=gV({container:o,ref:t,componentProps:e,elementProps:c}),f=Z.useRef(null),p=Z.useRef(null),m=Z.useRef(null),h=Z.useRef(null),[g,_]=Z.useState(null),v=Z.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;Z.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Fz(e)&&(e.type===`focusin`?v.current&&=(Lz(l),!1):(Iz(l),v.current=!0))}return vL(bL(l,`focusin`,e,!0),bL(l,`focusout`,e,!0))},[l,y]),xI(()=>{l&&b===!0&&v.current&&(Lz(l),v.current=!1)},[b,l]);let S=Z.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Q.jsxs)(Z.Fragment,{children:[d,(0,Q.jsxs)(pV.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(Vz,{"data-type":`outside`,ref:f,onFocus:e=>{Fz(e,l)?m.current?.focus():jz(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:FB}),l&&SI.createPortal(a,l),x&&l&&(0,Q.jsx)(Vz,{"data-type":`outside`,ref:p,onFocus:e=>{Fz(e,l)?h.current?.focus():(Az(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,dV(`focus-out`,e.nativeEvent)))}})]})]})}),vV=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=gV({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&SI.createPortal(n,c)]})});function yV(e){let t=bI(bV,e).current;return t.next=e,xI(t.effect),t}function bV(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function xV(e,t){return t!=null&&!jR(t)?0:typeof e==`function`?e():e}function SV(e,t,n){let r=xV(e,n);return typeof r==`number`?r:r?.[t]}function CV(e){return typeof e==`function`?e():e}function wV(e,t){return t||e===`click`||e===`mousedown`}function TV(e){return e?.includes(`mouse`)&&e!==`mousedown`}var EV=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new EL,currentIdRef:{current:null},currentContextRef:{current:null}});function DV(e,t){e.current=t.current}function OV(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=DL();return xI(()=>{a.current=n,o.current?i.current={open:SV(i.current,`open`),close:SV(n,`close`)}:i.current=n},[n,o,i,a]),(0,Q.jsx)(EV.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function kV(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Z.useContext(EV),[f,p]=Z.useState(!1),m=Z.useRef(n);return xI(()=>{m.current=n},[n]),xI(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),xI(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:SV(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,dV(JB))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),xI(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,DV(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}var AV=0;function jV(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(AV);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),hI;let o=requestAnimationFrame(a);return AV=o,()=>{AV===o&&(cancelAnimationFrame(o),AV=0)}}var MV={inert:new WeakMap,"aria-hidden":new WeakMap},NV=`data-base-ui-inert`,PV={inert:new WeakSet,"aria-hidden":new WeakSet},FV=new WeakMap,IV=0;function LV(e){return PV[e]}function RV(e){return e?eL(e)?e.host:RV(e.parentNode):null}var zV=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=RV(t);return e.contains(n)?n:null}).filter(e=>e!=null),BV=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},VV=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{JI(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function HV(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=zV(t,e),l=i?VV(t,BV(c),new Set(c)):[],u=[],d=[];if(a){let e=MV[a],n=LV(a);s=n,o=e;let r=zV(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);VV(t,BV(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(FV.get(e)||0)+1;FV.set(e,t),d.push(e),t===1&&e.setAttribute(NV,``)}),IV+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(FV.get(e)||0)-1;FV.set(e,t),t||e.removeAttribute(NV)}),--IV,IV||(MV.inert=new WeakMap,MV[`aria-hidden`]=new WeakMap,PV.inert=new WeakSet,PV[`aria-hidden`]=new WeakSet,FV=new WeakMap)}}function UV(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=yL(e[0]).body;return HV(e,a,n,r,{mark:i})}function WV(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var GV=class{nodesRef={current:[]};events=WV();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},KV=Z.createContext(null),qV=Z.createContext(null),JV=()=>Z.useContext(KV)?.id||null,YV=e=>{let t=Z.useContext(qV);return e??t};function XV(e){let t=BB(),n=YV(e),r=JV();return xI(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function ZV(e){let{children:t,id:n}=e,r=JV();return(0,Q.jsx)(KV.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function QV(e){let{children:t,externalTree:n}=e,r=bI(()=>n??new GV).current;return(0,Q.jsx)(qV.Provider,{value:r,children:t})}function $V(e,t){let n=YI(WL(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var eH=20,tH=[];function nH(){tH=tH.filter(e=>e.deref()?.isConnected)}function rH(e){nH(),e&&JI(e)!==`body`&&(tH.push(new WeakRef(e)),tH.length>eH&&(tH=tH.slice(-20)))}function iH(){return nH(),tH[tH.length-1]?.deref()}function aH(e){return e?Ez(e)?e:Oz(e)[0]||e:null}function oH(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Dz(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Ez(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function sH(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=UI(()=>b.current.floatingContext?.nodeId),S=i===!1,C=SR(_)&&S,w=yV(i),T=yV(a),E=yV(l),D=yV(g),O=YV(p),k=mV(),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef(null),P=Z.useRef(``),F=Z.useRef(``),I=Z.useRef(null),L=Z.useRef(null),R=Hz(I,f,k?.beforeInsideRef),ee=Hz(L,k?.afterInsideRef),z=DL(),te=DL(),ne=wL(),re=k!=null,ie=wR(v),ae=UI((e=ie)=>e?Oz(e):[]),oe=UI(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&UL(ie,HL(yL(ie)))&&ae().length===0&&!C&&DR(e)}return bL(yL(ie),`keydown`,e)},[r,ie,s,C,ae]),Z.useEffect(()=>{if(r||!g)return;let e=yL(ie);function t(){M.current=!1}function n(e){let t=WL(e),n=oe(),r=UL(v,t)||UL(_,t)||UL(k?.portalNode,t)||n.some(e=>e===t||UL(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,te.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return vL(bL(e,`pointerdown`,n,!0),bL(e,`pointerup`,t,!0),bL(e,`pointercancel`,t,!0),bL(e,`keydown`,i,!0),t)},[r,v,_,ie,g,k,te,oe]),Z.useEffect(()=>{if(r||!c)return;let e=yL(ie);function t(){j.current=!0,te.start(0,()=>{j.current=!1})}function n(e){let t=WL(e);Ez(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=WL(t);s&&n==null&&i!=null&&UL(v,i)&&rH(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(fV(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,SB(d),SB(u)].includes(n),p=!(UL(_,n)||UL(v,n)||UL(n,v)||UL(k?.portalNode,n)||l.some(e=>e===n||UL(e,n))||c.hasMatchingElement(e=>UL(e,n))||f||O&&(TR(O.nodesRef.current,a).find(e=>UL(e.context?.elements.floating,n)||UL(e.context?.elements.domReference,n))||ER(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,wR(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ie&&oH(ie),o&&r!==_&&!fz(i)&&HL(e)===e.body){if($I(ie)&&(ie.focus(),o===`popup`)){ne.request(()=>{ie.focus()});return}let e=ae(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ie;$I(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!s)&&n&&p&&!j.current&&(C||n!==iH())&&(A.current=!0,h.setOpen(!1,dV(tV,t)))})}function a(){M.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let l=$I(_)?_:null;if(v||l)return vL(l&&bL(l,`focusout`,i),l&&bL(l,`pointerdown`,t),v&&bL(v,`focusin`,n),v&&bL(v,`focusout`,i),v&&k&&bL(v,`focusout`,a,!0))},[r,_,v,ie,s,O,k,h,c,o,ae,C,x,b,z,te,ne,u,d,oe]),Z.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${fV(`portal`)}]`)||[]),t=(O?ER(O.nodesRef.current,x()):[]).find(e=>SR(e.context?.elements.domReference||null))?.context?.elements.domReference,n=UV([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe(),t,SB(d),SB(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=UV([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,oe]),xI(()=>{if(!g||r||!$I(ie))return;P.current=``,F.current=``;let e=yL(ie),t=HL(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||UL(ie,t))return;let i=null,a=()=>(i??=ae(ie),i[0]||ie),o;o=r===!0||r===null?a():SB(r),o||=a();let s=UL(ie,HL(e));jV(o,{preventScroll:o===ie,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=HL(e);return!(t!==o&&UL(ie,t))}})})},[r,g,ie,ae,w,E,D]),xI(()=>{if(r||!ie)return;let e=yL(ie),t=HL(e),n=E.current==null;rH(t);function i(e){if(e.open||(P.current=$V(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(kR(e.nativeEvent)||AR(e.nativeEvent))A.current=!1;else{let e=!1;yL(ie).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&JI(t)!==`body`?t:null,s=n?o||a:a||o;return s||=iH()||null,typeof i==`boolean`?s:SB(i)||s||null}return()=>{y.off(`openchange`,i);let t=HL(e),n=oe(),r=UL(v,t)||n.some(e=>e===t||UL(e,t))||O&&TR(O.nodesRef.current,x(),!1).some(e=>UL(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=aH(c),i=typeof o!=`boolean`;if(o&&!A.current&&$I(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,ie,T,E,y,O,_,x,oe]),xI(()=>{if(!zL||g||!v)return;let e=HL(yL(v));$I(e)&&bR(e)&&UL(v,e)&&e.blur()},[g,v]),xI(()=>{if(!r&&k)return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),xI(()=>{if(!r&&ie)return oH(ie),()=>{queueMicrotask(nH)}},[r,ie]);let se=!r&&(!s||!C)&&(re||s);return(0,Q.jsxs)(Z.Fragment,{children:[se&&(0,Q.jsx)(Vz,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ae();jV(e[e.length-1])}else k?.portalNode&&(A.current=!1,Fz(e,k.portalNode)?Az(_)?.focus():SB(d??k.beforeOutsideRef)?.focus())}}),n,se&&(0,Q.jsx)(Vz,{"data-type":`inside`,ref:ee,onFocus:e=>{s?jV(ae()[0]):k?.portalNode&&(c&&(A.current=!0),Fz(e,k.portalNode)?jz(_)?.focus():SB(u??k.afterOutsideRef)?.focus())}})]})}function cH(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=YB}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=wL(),p=DL(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=dV(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=jR(e.pointerType,!0)&&AR(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||jR(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=WL(o);if(bR(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;r===`mousedown`&&i?d.current=void 0:jR(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Z.useMemo(()=>n?{reference:m}:_I,[n,m])}function lH(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function uH(e){return e!=null&&e.clientX!=null}function dH(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Z.useRef(!1),u=Z.useRef(null),[d,f]=Z.useState(),[p,m]=Z.useState([]),h=UI(e=>{i.set(`positionReference`,e)}),g=UI((e,t,n)=>{l.current||(!c.current.openEvent||uH(c.current.openEvent))&&i.set(`positionReference`,lH(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=UI(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=jR(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=YI(o);function r(t){let n=WL(t);UL(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||uH(c.current.openEvent)?u.current=bL(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Z.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Z.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Z.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Z.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Z.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function fH(){return!1}function pH(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mH(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=fH,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=YV(c),h=UI(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=UI(()=>a),{escapeKey:y,outsidePress:b}=pH(s),x=Z.useRef(!1),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(``),D=Z.useRef(null),O=DL(),k=DL(),A=UI(()=>{k.clear(),f.current.insideReactTree=!1}),j=UI(e=>{let t=f.current.floatingContext?.nodeId;return(m?TR(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=UI(e=>vR(e,l.select(`floatingElement`))||vR(e,l.select(`domReferenceElement`))),N=UI(e=>{o()&&l.setOpen(!1,dV(YB,e.nativeEvent))}),P=UI(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=dV(nV,OR(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=UI(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=UI(e=>{if(!u||!n||e.button!==0)return;let t=WL(e.nativeEvent);UL(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=UI(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});Z.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),Z.useEffect(()=>{if(!u||!n)return u||(w.current=!1),A;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new EL,t=new EL,i=yL(d);function a(){e.clear(),T.current=!0}function o(){e.start(zL?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=f.current.floatingContext?.nodeId,n=m&&TR(m.nodesRef.current,t).some(t=>vR(e,t.context?.elements.floating));return M(e)||n}function N(e){if(h(e)){e.type!==`click`&&!M(e)&&(t.clear(),C.current=!1),A();return}if(f.current.insideReactTree){A();return}let n=WL(e),r=`[${fV(`inert`)}]`,i=QI(n)?n.getRootNode():null,a=Array.from((eL(i)?i:yL(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>UL(e,n))))return;let s=QI(n)?n:null;for(;s&&!dL(s);){let e=mL(s);if(dL(e)||!QI(e))break;s=e}if(!(a.length&&QI(n)&&!yR(n)&&!UL(n,l.select(`floatingElement`))&&a.every(e=>!UL(s,e)))){if($I(n)&&!(`touches`in e)){let t=dL(n),r=fL(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!k(e)){if(p()===`intentional`){if(e.detail!==0&&!kR(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(l.setOpen(!1,dV(QB,e)),A())}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=WL(e);if(!n)return;let r=bL(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function ee(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;c(),p()===`intentional`&&(e.type===`pointercancel`?n&&s():k(e)||(n?s():(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())))}function te(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function ie(e){L(e,re)}let ae=vL(r&&vL(bL(i,`keydown`,P),bL(i,`compositionstart`,a),bL(i,`compositionend`,o)),_&&vL(bL(i,`click`,ee,!0),bL(i,`pointerdown`,ee,!0),bL(i,`pointerup`,z,!0),bL(i,`pointercancel`,z,!0),bL(i,`mousedown`,ee,!0),bL(i,`mouseup`,z,!0),bL(i,`touchstart`,R,{capture:!0,passive:!0}),bL(i,`touchmove`,ne,{capture:!0,passive:!0}),bL(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{ae(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=Z.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=Z.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return Z.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function hH(e,t,n){let{reference:r,floating:i}=e,a=GR(t),o=KR(t),s=WR(o),c=VR(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=HR(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function gH(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=BR(t,e),p=iz(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=az(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=az(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var _H=50,vH=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:gH},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hH(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<_H&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hH(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yH=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=BR(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=VR(r),_=GR(o),v=VR(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[nz(o)]:JR(o)),x=p!==`none`;!d&&x&&b.push(...tz(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=qR(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===GR(t)||T.every(e=>GR(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=GR(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},bH=new Set([`left`,`top`]);async function xH(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=VR(n),s=HR(n),c=GR(n)===`y`,l=bH.has(o)?-1:1,u=a&&c?-1:1,d=BR(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var SH=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await xH(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},CH=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=BR(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=GR(i),p=UR(f),m=u[p],h=u[f],g=(e,t)=>zR(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},wH=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=BR(e,t),u={x:n,y:r},d=GR(i),f=UR(d),p=u[f],m=u[d],h=BR(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=bH.has(VR(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},TH=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=BR(e,t),c=await i.detectOverflow(t,s),l=VR(n),u=HR(n),d=GR(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=NR(p-c[m],g),y=NR(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*PR(c.left,c.right):S=p-2*PR(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function EH(e){let t=fL(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$I(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=FR(n)!==a||FR(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function DH(e){return QI(e)?e:e.contextElement}function OH(e){let t=DH(e);if(!$I(t))return LR(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=EH(t),o=(a?FR(n.width):n.width)/r,s=(a?FR(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var kH=LR(0);function AH(e){let t=YI(e);return!uL()||!t.visualViewport?kH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jH(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===YI(e)}function MH(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=DH(e),o=LR(1);t&&(r?QI(r)&&(o=OH(r)):o=OH(e));let s=jH(a,n,r)?AH(a):LR(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=YI(a),t=QI(r)?YI(r):r,n=e,i=_L(n);for(;i&&t!==n;){let e=OH(i),t=i.getBoundingClientRect(),r=fL(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=YI(i),i=_L(n)}}return az({width:u,height:d,x:c,y:l})}function NH(e,t){let n=pL(e).scrollLeft;return t?t.left+n:MH(XI(e)).left+n}function PH(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-NH(e,n),y:n.top+t.scrollTop}}function FH(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=XI(r),s=t?rL(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=LR(1),u=LR(0),d=$I(r);if((d||!a)&&((JI(r)!==`body`||tL(o))&&(c=pL(r)),d)){let e=MH(r);l=OH(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?PH(o,c):LR(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function IH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function LH(e){let t=pL(e),n=e.ownerDocument.body,r=PR(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=PR(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+NH(e),o=-t.scrollTop;return fL(n).direction===`rtl`&&(a+=PR(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var RH=25;function zH(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=YI(e),a=XI(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!uL()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(NH(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=RH&&(s-=o)}return{width:s,height:c,x:l,y:u}}function BH(e,t){let n=MH(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=OH(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function VH(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=zH(e,n,t);else if(t===`document`)r=LH(XI(e));else if(QI(t))r=BH(t,n);else{let n=AH(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return az(r)}function HH(e,t){let n=t.get(e);if(n)return n;let r=gL(e,[],!1).filter(e=>QI(e)&&JI(e)!==`body`),i=null,a=fL(e).position===`fixed`,o=a?mL(e):e;for(;QI(o)&&!dL(o);){let e=fL(o),t=cL(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=mL(o)}return t.set(e,r),r}function UH(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rL(t)?[]:HH(t,this._c):[].concat(n),r],o=VH(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=VH(t,a[e],i);s=PR(n.top,s),c=NR(n.right,c),l=NR(n.bottom,l),u=PR(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function WH(e){let{width:t,height:n}=EH(e);return{width:t,height:n}}function GH(e,t,n){let r=$I(t),i=XI(t),a=n===`fixed`,o=MH(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=LR(0);if((r||!a)&&((JI(t)!==`body`||tL(i))&&(s=pL(t)),r)){let e=MH(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=NH(i));let l=i&&!r&&!a?PH(i,s):LR(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function KH(e){return fL(e).position===`static`}function qH(e,t){if(!$I(e)||fL(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return XI(e)===n&&(n=n.ownerDocument.body),n}function JH(e,t){let n=YI(e);if(rL(e))return n;if(!$I(e)){let t=mL(e);for(;t&&!dL(t);){if(QI(t)&&!KH(t))return t;t=mL(t)}return n}let r=qH(e,t);for(;r&&nL(r)&&KH(r);)r=qH(r,t);return r&&dL(r)&&KH(r)&&!cL(r)?n:r||lL(e)||n}var YH=async function(e){let t=this.getOffsetParent||JH,n=this.getDimensions,r=await n(e.floating);return{reference:GH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XH(e){return fL(e).direction===`rtl`}var ZH={convertOffsetParentRelativeRectToViewportRelativeRect:FH,getDocumentElement:XI,getClippingRect:UH,getOffsetParent:JH,getElementRects:YH,getClientRects:IH,getDimensions:WH,getScale:OH,isElement:QI,isRTL:XH};function QH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $H(e,t,n){let r=null,i,a=XI(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=IR(d),h=IR(a.clientWidth-(u+f)),g=IR(a.clientHeight-(d+p)),_=IR(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:PR(0,NR(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!QH(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=YI(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function eU(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=DH(e),u=i||a?[...l?gL(l):[],...t?gL(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$H(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?MH(e):null;c&&g();function g(){let t=MH(e);h&&!QH(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tU=SH,nU=CH,rU=yH,iU=TH,aU=wH,oU=(e,t,n)=>{let r=new Map,i=n??{},a={...ZH,...i.platform,_c:r};return vH(e,t,{...i,platform:a})},sU=typeof document<`u`?Z.useLayoutEffect:function(){};function cU(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cU(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!cU(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function lU(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uU(e,t){let n=lU(e);return Math.round(t*n)/n}function dU(e){let t=Z.useRef(e);return sU(()=>{t.current=e}),t}function fU(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);cU(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=dU(c),D=dU(i),O=dU(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),oU(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!cU(w.current,t)&&(w.current=t,SI.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);sU(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);sU(()=>(A.current=!0,()=>{A.current=!1}),[]),sU(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=uU(M.floating,u.x),r=uU(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...lU(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var pU=(e,t)=>{let n=tU(e);return{name:n.name,fn:n.fn,options:[e,t]}},mU=(e,t)=>{let n=nU(e);return{name:n.name,fn:n.fn,options:[e,t]}},hU=(e,t)=>({fn:aU(e).fn,options:[e,t]}),gU=(e,t)=>{let n=rU(e);return{name:n.name,fn:n.fn,options:[e,t]}},_U=(e,t)=>{let n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},vU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},yU=class extends KI{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:WV(),nested:n,triggerElements:i},vU),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&MR(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function bU(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Z.useRef(null);r===void 0&&f.current===null&&(f.current=new yU({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),xI(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};QI(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function xU(e,t=!1,n=!1,r=!1){let[i,a]=Z.useState(e&&t?`idle`:void 0),[o,s]=Z.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),xI(()=>{if(!e&&o&&i!==`ending`&&n){let e=CL.request(()=>{a(`ending`)});return()=>{CL.cancel(e)}}},[e,o,i,n]),xI(()=>{if(!e||t)return;let n=CL.request(()=>{a(void 0)});return()=>{CL.cancel(n)}},[t,e]),xI(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=CL.request(()=>{a(`idle`)});return()=>{CL.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var SU={tabIndex:-1,[GL]:``};function CU(e){return t=>t!==`touch`||e.current}function wU(e,t=!1){let n=BB(),r=JV()!=null,i=bI(()=>e(n,r)).current;return bU({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function TU({handle:e,store:t}){return xI(()=>e.attachStore(t),[e,t]),null}function EU(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function DU(e,t){let n=Z.useRef(null);return UI(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),EU(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),EU(t))})}function OU(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function kU(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function AU(e,t,n,r={}){let i=n.reason,a=i===XB,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=kU(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=OU(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?SI.flushSync(l):l()}function jU(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=DU(e,n),o=UI(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=UI(e=>{a(e),e&&o(e)});return xI(()=>(s(t.current),()=>s(null)),[s,t,n,e]),xI(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function MU(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);xI(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=dV(JB);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function NU(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=xU(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=UI(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return EB({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function PU(e,t){e.useSyncedValues(t),xI(()=>()=>{e.update({activeTriggerProps:_I,inactiveTriggerProps:_I,popupProps:_I})},[e])}function FU(e,t){xI(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),xI(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var IU=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function LU(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new yU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:_I,inactiveTriggerProps:_I,popupProps:_I}}var RU=e=>e.triggerIdProp??e.activeTriggerId,zU=e=>e.openProp??e.open,BU=e=>(e.popupElement?.id??e.floatingId)||void 0;function VU(e,t){return t!==void 0&&zU(e)&&RU(e)===t}function HU(e,t){return VU(e,t)?!0:t!==void 0&&zU(e)&&RU(e)==null&&e.triggerCount===1}var UU={open:zU,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:RU,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:BU,isTriggerActive:(e,t)=>t!==void 0&&RU(e)===t,isOpenedByTrigger:(e,t)=>VU(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&RU(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>HU(e,t)?BU(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function WU(e){let t=Z.useCallback(t=>e===void 0?hI:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,mI.useSyncExternalStore)(t,n,()=>e?.serverStore)}function GU(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=BB(),a=JV()!=null,o=bI(()=>new yU({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new IU,floatingId:i,syncOnly:!1,nested:a})).current;return xI(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=QI(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function KU(e){return qU(e,e.rootContext)}function qU(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=YV(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=fU({...e,elements:{..._,...l&&{reference:l}}}),y=QI(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=QI(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(QI(e)||e===null)&&(h.current=e,f(e)),(QI(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!QI(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return xI(()=>{o&&(h.current=o)},[o]),xI(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var JU=LL&&zL;function YU(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=DL();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=YI(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&$I(e)&&e===HL(yL(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return vL(bL(t,`blur`,r),JU&&bL(t,`keydown`,a,!0),JU&&bL(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);QI(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=WL(t.nativeEvent);if(QI(a)){if(JU&&!t.relatedTarget){if(!l.current&&!bR(a))return}else if(!CR(a))return}let o=_R(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;i.select(`open`)&&o||p===0||p===void 0?i.setOpen(!0,dV(ZB,d,f)):u.start(p,()=>{s.current||i.setOpen(!0,dV(ZB,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=QI(n)&&n.hasAttribute(fV(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=HL(yL(e));!n&&t===e||UL(o.current.floatingContext?.refs.floating.current,t)||UL(e,t)||a||_R(n??t,i.context.triggerElements)||i.setOpen(!1,dV(ZB,r))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var XU=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new EL,this.restTimeout=new EL,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ZU=new WeakMap;function QU(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ZU.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ZU.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $U(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ZU.get(n);a&&a!==e&&QU(a),QU(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ZU.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function eW(e){let t=e.context.dataRef.current,n=bI(()=>t.hoverInteractionState??XU.create()).current;return t.hoverInteractionState||=n,vI(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tW(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=YV(),d=JV(),f=eW(a),p=DL(),m=UI(()=>wV(l.current.openEvent?.type,f.interactedInside)),h=UI(()=>TV(l.current.openEvent?.type)),g=UI(()=>{QU(f)});xI(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),xI(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&QI(c)&&s){let e=c,t=s,n=yL(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return $U(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&TR(u.nodesRef.current,d).length>0)}function t(e){let t=SV(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,dV(XB,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=WL(e);xR(t)?f.interactedInside=t?.closest(`[aria-haspopup]`)!=null:f.interactedInside=!1}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(_R(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;u&&r&&QI(o)&&TR(u.nodesRef.current,r,!1).some(e=>UL(e.context?.elements.floating,o))||(f.handler?f.handler(n):(g(),h()&&!m()&&t(n)))}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,dV(XB,t)),u.events.emit(`floating.closed`,t)})}let y=s;return vL(y&&bL(y,`mouseenter`,c),y&&bL(y,`mouseleave`,_),y&&bL(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var nW={current:null};function rW(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=nW,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=YV(l),y=eW(h),b=Z.useRef(!1),x=yV(i),S=yV(r),C=yV(o),w=yV(n),T=yV(p),E=yV(f),D=UI(()=>wV(g.current.openEvent?.type,y.interactedInside)),O=UI(()=>T.current?.()!==!1),k=UI((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!UL(e,t);if(!QI(n))return!1;let i=n;return r.hasMatchingElement(e=>UL(e,i))&&(!e||!UL(e,i))}),A=UI(()=>{y.handler&&=(yL(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=UI(()=>{QU(y)});return u&&(y.handleCloseOptions=i?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===XB,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=SV(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,dV(XB,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,dV(XB,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!QI(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!jR(y.pointerType))return;let t=CV(C.current),n=SV(S.current,`open`,y.pointerType),r=WL(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(QI(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(UL(e,r)){s=e;break}}QI(i)&&QI(o)&&!h.context.triggerElements.hasElement(i)&&UL(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&QI(s)&&QI(o)&&UL(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;m?O()&&h.setOpen(!0,dV(XB,e,s)):p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,dV(XB,e,s))}):g&&O()&&h.setOpen(!0,dV(XB,e,s)))}function i(t){if(D()){j();return}A();let n=yL(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!_R(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t)}else y.pointerType===`touch`&&UL(h.select(`floatingElement`),t.relatedTarget)||e(t)}}function o(e){UL(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?bL(t,`mouseout`,o):void 0;return s?vL(bL(t,`mousemove`,r,{once:!0}),bL(t,`mouseenter`,r),bL(t,`mouseleave`,i),l):vL(bL(t,`mouseenter`,r),bL(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!jR(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;$U(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=CV(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,dV(XB,t,n))}y.pointerType===`touch`?SI.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var iW=`Escape`;function aW(e){return zL&&e.movementX===0&&e.movementY===0}function oW(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function sW(e,t){return oW(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function cW(e,t,n){return oW(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function lW(e,t,n){return oW(t,n?e===qL:e===JL,e===XL)}function uW(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===iW:oW(t,n?e===JL:e===qL,e===YL)}function dW(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=wR(T),k=SR(E),A=yV(O),j=JV(),M=YV(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),L=UI(e=>{i(P.current===-1?null:P.current,e)}),R=Z.useRef(!!T),ee=Z.useRef(w),z=Z.useRef(!1),te=Z.useRef(!1),ne=Z.useRef(null),re=yV(h),ie=yV(w),ae=yV(o),oe=yV(y),se=wL(),ce=wL(),le=UI(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):ne.current=jV(e,{sync:z.current,preventScroll:!0})}let t=n.current[P.current],r=te.current;t&&e(t),(z.current?e=>e():e=>se.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),he&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});xI(()=>{D.current.orientation=g},[D,g]),xI(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(te.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),xI(()=>{if(a){if(!w)z.current=!1;else if(T){if(r==null){if(z.current=!1,ae.current!=null)return;if(R.current&&(P.current=-1,le()),(!ee.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ce.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||cW(F.current,g,u)||l?sz(n):cz(n),F.current=null,L())};t()}}else oz(n.current,r)||(P.current=r,le(),te.current=!1)}}},[a,w,T,r,ae,l,n,g,u,L,le,ce]),xI(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=HL(yL(E??t??null)),r=e.some(e=>e.context&&UL(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),xI(()=>{ee.current=w,R.current=!!T}),xI(()=>{w||(F.current=null,N.current=f)},[w,f]);let ue=r!=null,de=UI(e=>{if(!ie.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),fe=UI(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),pe=UI(()=>sz(n,re.current)),me=UI(e=>{if(I.current=!1,z.current=!0,e.which===229||!ie.current&&e.currentTarget===A.current)return;if(l&&uW(e.key,g,u,S)){sW(e.key,fe())||DR(e),C.setOpen(!1,dV(rV,e.nativeEvent)),$I(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=sz(n,h),i=cz(n,h);if(k||(e.key===`Home`&&(DR(e),P.current=r,L(e)),e.key===`End`&&(DR(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(sW(e.key,g)){if(DR(e),w&&!d&&HL(e.currentTarget.ownerDocument)===e.currentTarget){P.current=cW(e.key,g,u)?r:i,L(e);return}cW(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(z.current=!1,P.current=r):P.current=lz(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,lz(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(z.current=!1,P.current=i):P.current=lz(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,lz(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),oz(n.current,P.current)&&(P.current=-1),L(e)}}),he=Z.useMemo(()=>({onFocus(e){z.current=!0,de(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){aW(e)||(z.current=!0,te.current=!1,p&&de(e))},onPointerLeave(e){if(!ie.current||!I.current||e.pointerType===`touch`)return;z.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&oe.current&&(ne.current?.(),ne.current=null,P.current=-1,L(e),!d)){let e=A.current,t=HL(yL(e));e&&UL(e,t)&&e.focus({preventScroll:!0})}}}),[de,ie,A,p,n,L,oe,d]),ge=Z.useMemo(()=>d&&w&&ue&&{"aria-activedescendant":`${v}-${r}`},[d,w,ue,v,r]),_e=Z.useMemo(()=>({...k?{}:ge,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=WL(e.nativeEvent);if(t&&!UL(A.current,t))return;DR(e),C.setOpen(!1,dV(tV,e.nativeEvent)),$I(E)&&E.focus()}else me(e)},onPointerMove(e){aW(e)||(I.current=!0)}}),[ge,me,A,k,C,w,d,E]),ve=Z.useMemo(()=>{function e(e){C.setOpen(!0,dV(rV,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&kR(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&AR(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=lW(t.key,fe(),u),a=sW(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return me(t);if(n||m||!r){if(o){let e=sW(t.key,fe());F.current=l&&e?null:t.key}l?i&&(DR(t),n?(P.current=pe(),L(t)):e(t)):a&&(ae.current!=null&&(P.current=ae.current),DR(t),!n&&m?e(t):me(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[me,f,pe,l,L,C,m,g,fe,u,ae,d]),ye=Z.useMemo(()=>({...ge,...ve}),[ge,ve]);return Z.useMemo(()=>a?{reference:ye,floating:_e,item:he,trigger:ve}:{},[a,ye,_e,ve,he])}function fW(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=DL(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=UI(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!fz(n)||n?.matches(`:disabled`)?!1:o==null||!uz(gI,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(DR(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(DR(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=UI(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);UL(n,t)||UL(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});xI(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var pW=.1,mW=pW*pW,hW=.5;function gW(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function _W(e,t,n,r,i,a,o,s,c,l){let u=!1;return gW(e,t,n,r,i,a)&&(u=!u),gW(e,t,i,a,o,s)&&(u=!u),gW(e,t,o,s,c,l)&&(u=!u),gW(e,t,c,l,n,r)&&(u=!u),u}function vW(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function yW(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function bW(e={}){let{blockPointerEvents:t=!1}=e,n=new EL,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*mW;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=WL(r),g=r.type===`mouseleave`,_=UL(u,h),v=UL(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&QI(r.relatedTarget)&&UL(u,r.relatedTarget))return;function y(){return!!(s&&TR(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=yW(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=yW(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=yW(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=yW(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!vW(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?hW/2:hW*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+hW+1,o=C||T?S.bottom-hW:S.top,s=C?T?S.bottom-hW:S.top:S.bottom-hW;M=_W(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?hW/2:hW*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-hW,o=C||T?S.top+hW:S.bottom,s=C?T?S.top+hW:S.bottom:S.top+hW;M=_W(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?hW/2:hW*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+hW+1,o=w||E?S.right-hW:S.left,s=w?E?S.right-hW:S.left:S.right-hW;M=_W(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?hW/2:hW*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-hW,o=w||E?S.left+hW:S.right,s=w?E?S.left+hW:S.right:S.left+hW;M=_W(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var xW=Z.createContext(void 0);function SW(){return Z.useContext(xW)?.direction??`ltr`}var CW=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=BR(e,t)||{};if(l==null)return{};let f=iz(u),p={x:n,y:r},m=KR(i),h=WR(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];w&&await o.isElement?.(C)||(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=zR(k,j,A),N=!c.arrow&&HR(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),wW=(e,t)=>{let{name:n,fn:r}=CW(e);return{name:n,fn:r,options:[e,t]}},TW={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},EW={sideX:`left`,sideY:`top`},DW=`--available-width`,OW=`--available-height`,kW=`--anchor-width`,AW=`--anchor-height`,jW=`--transform-origin`,MW=DW,NW=OW;function PW(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function FW(e,t,n){let{rects:r,placement:i}=e;return{side:PW(t,VR(i),n),align:HR(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function IW(e){return LW(e,KU)}function LW(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Z.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=UI(A),M=A?j:n,N=yV(n),P=yV(g),F=SW()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let ee=+(i===`bottom`),z=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},ie=Z.useRef(null),ae=yV(a),oe=yV(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(pU(e=>{let t=FW(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,F,i]));let ue=E===`none`&&T!==`shift`,de=!ue&&(u||O||T===`shift`),fe=T===`none`?null:gU({...re,padding:{top:R.top+1+ee,right:R.right+1+ne,bottom:R.bottom+1+z,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),pe=ue?null:mU({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:hU(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=GR(VR(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[re,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?le.push(pe,fe):le.push(fe,pe),le.push(_U({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(MW,`${t}px`),i.setProperty(NW,`${n}px`);let a=YI(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(kW,`${u}px`),i.setProperty(AW,`${d}px`)}}),wW(e=>({element:ie.current||yL(e.elements.floating).createElement(`div`),padding:ie.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=VR(r),u=HR(r),d=GR(l)===`y`,f=ie.current,p=typeof a==`function`?a(FW(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(jW,d?`${m} ${h}`:`${h} ${m}`),{}}},TW,b),xI(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>eU(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||EW,De=Ce?r:`fixed`,Oe=Z.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[MW]=`100vw`,e[NW]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=Z.useRef(null);xI(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(RW(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&RW(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,M,N]),Z.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return eU(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=VR(xe),je=PW(i,Ae,F),Me=HR(xe)||`center`,Ne=!!ye.hide?.referenceHidden;xI(()=>{x&&g&&Ce&&Ae!==I&&w(Ae)},[x,g,Ce,Ae,I]);let Pe=Z.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ie,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ie,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function RW(e){return e!=null&&`current`in e}function zW(e){return e===`starting`?DB:_I}function BW(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),mB(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},zW(r),i],stateAttributesMapping:mR})}var VW=VF(),HW=48,UW=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-HW-t;return n},WW=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},GW=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-HW;n+=i>>>1^-(i&1),t[r]=n}return t},KW=384,qW=[],JW=WW(UW(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),YW=WW(UW(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),XW=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,ZW=(()=>{let e=JW.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=JW[n];i<JW[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(JW[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=JW[i];a<JW[i+1];a++)n[r++]=e,e+=t[e]}return n})(),QW=UW(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),$W=WW(UW(`123333359346463635126536711576`)),eG=UW(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),tG=UW(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),nG=GW(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),rG=(()=>{let e=new Int32Array(319).fill(-1),t=GW(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=GW(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),iG=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),aG=GW(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),oG=GW(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),sG=GW(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),cG=new Int32Array(995),lG=new Int32Array(995),uG=new Int32Array(995),dG=``,fG=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<aG.length;r++)for(let i of iG[sG[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),fG[a*2]=dG.length,fG[a*2+1]=i.length,dG+=i),cG[n]=aG[r],lG[n]=oG[r],uG[n]=a,n++}}var pG=GW(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),mG=WW(UW(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),hG=GW(`24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222`),gG=UW(`ij`),_G=UW(``),vG=UW(`1`),yG={GROUP_COUNT:KW,customValidatorNames:qW,edgeStart:JW,labelStart:YW,labelText:XW,edgeTarget:ZW,nodeGroup:QW,nodeVlist:rG,vlistPat:$W,vlistOps:eG,vlistRef:tG,vlistGroup:nG,litAnchor:cG,litGroup:lG,litPool:uG,poolOffsets:fG,poolText:dG,adjGid:pG,adjStart:mG,adjTgt:hG,patGid:gG,patTgt:_G,postfixLookupGroups:vG,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},bG=`line`in Error(),xG=-1,SG=-1,CG=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},wG=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15},TG=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(CG(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(CG(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},ee=n.cacheSize??8192,z=n.prefix??e.prefix??``,te=z===``?``:z+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,se=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=0,le=-1,ue=-1,de=-1,fe=-1,pe=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,me=e=>/\s/.test(String.fromCharCode(e)),he=(e,t,n)=>{if(ce=0,le=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ce=1;else if(r===40&&i===41)ce=2;else return;de=t+1,fe=n-1;let a=t+1;if(pe(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!pe(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(le=t+1,ue=a,de=a+1)}},ge=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},_e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ye=e=>!!e&&!Number.isNaN(Number(e)),be=(e,t,n)=>{if(n-t<11||!ge(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&ge(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ge(e,t+10,t+18,`-normal/`)},xe=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Se=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),Ce=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],we=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(ce!==xe[i])return!1;if(le>=0){for(let e of Se[i])if(ge(t,le,ue,e))return!0;return!1}switch(Ce[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(de,fe);return ie.test(e)&&!ae.test(e)}case 3:return ye(t.slice(de,fe));case 4:return se.test(t.slice(de,fe));default:return oe.test(t.slice(de,fe))}}switch(e){case 0:return!0;case 1:return ce===0;case 2:return ce===1;case 3:return ce===2;case 4:return _e.test(t.slice(n,r));case 5:return ye(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ye(t.slice(n,r-1));case 8:return ve.test(t.slice(n,r));default:return be(t,n,r)}},Te=new Set(typeof E==`string`?E.split(` `):E),Ee=(e,t,n,r,i,a)=>{let o=CG(t,n,r)^(i?2654435769:0),s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},De=new Map,Oe=new Map,ke=2,Ae=4096,je=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Te.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Oe.get(s);return c===void 0&&Oe.set(s,c=ke++),c},Me=new Map,Ne=r,Pe=r+4096,Fe=()=>Ne++,Ie=2097152,Le=8192,Re=new Int32Array(Le),ze=Array(Le).fill(null),Be=new Int32Array(Le),Ve=new Int32Array(Le),He=new Uint8Array(Le),Ue=0,We=(e,t,n,r,i,a,o,s)=>{let c=e;if(ze[e]!==null){if(ze[e|1]===null)c=e|1;else if(!(Ue++&3))c=e|Ue>>2&1;else return}ze[c]=t.slice(n,r),Re[c]=i,Be[c]=a,Ve[c]=o,He[c]=s},Ge=()=>ze.fill(null),Ke=256,qe=[new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke)],[Je,Ye,Xe,Ze]=qe,Qe=new Uint8Array(Ke),$e=new Uint8Array(Ke),et=()=>{Ke*=2,qe=qe.map(e=>{let t=new Int32Array(Ke);return t.set(e),t}),[Je,Ye,Xe,Ze]=qe;let e=new Uint8Array(Ke);e.set(Qe),Qe=e,$e=new Uint8Array(Ke)},tt=64,nt=new Int32Array(tt),rt=new Int32Array(tt),it=new Int32Array(r),at=2048,ot=21,st=new Float64Array(at),ct=new Int32Array(at),lt=0,ut=(e,t)=>{if(e===0&&t<r)return it[t]===lt?1:(it[t]=lt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>ot;for(;ct[i]===lt;){if(st[i]===n)return 1;i=i+1&at-1}return st[i]=n,ct[i]=lt,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?xG:Ee(Me,e,t+1,r,0,Fe)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=rt[t];if(r>n)continue;let i=nt[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;he(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(we(d[t],e,r,n))return p[h+t]}return xG},ft=e=>{let t=e.length,n=0,c=0,u=!1;(ke>Ae||De.size>Ae)&&(De=new Map,Oe=new Map,ke=2,Ge()),Ne>Pe&&(Me=new Map,Ne=r,Ge());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&me(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&me(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ke&&et();let _=n++;Je[_]=p,Ye[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15,y=v&8190;{let t=-1;if(Re[y]===v&&ze[y]!==null&&ze[y].length===g?t=y:Re[y|1]===v&&ze[y|1]!==null&&ze[y|1].length===g&&(t=y|1),t>=0){let n=ze[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Xe[_]=Be[t],Ze[_]=Ve[t],Qe[_]=He[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Xe[_]=xG,We(y,e,p,h,v,xG,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(nt[0]=0,rt[0]=M,R=1);let ee=SG,z=0;for(let t=M;t<D;t++)if(t===A&&(ee=F<I?SG:P,z=R),P!==SG){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=SG;else{let e=i[P],t=i[P+1],c=SG;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===tt){tt*=2;let e=new Int32Array(tt);e.set(nt),nt=e;let t=new Int32Array(tt);t.set(rt),rt=t}nt[R]=r,rt[R]=t+2,R++}}A===D&&(ee=F<I?SG:P,z=R);let re=F<I?SG:P,ie,ae=!1;if(A>=0){if(ae=!0,ie=dt(e,E,A,ee,z),ie!==xG&&ie<r&&j[ie]){let t=dt(e,E,D,re,R);t!==xG&&t!==ie&&(ie=t,ae=!1)}else ie===xG&&(ie=dt(e,E,D,re,R),ae=!1)}else ie=dt(e,E,D,re,R);let oe=0,se=0;ie===xG?Xe[_]=xG:(se=+!!ae,oe=b>=C?+!!O:Ee(De,e,b,C,+!!O,e=>je(e,O)),Xe[_]=ie,Qe[_]=se,Ze[_]=oe),We(y,e,p,h,v,ie,oe,se)}if(n===0)return``;if(n===1)return Je[0]===0&&Ye[0]===t?e:e.slice(Je[0],Ye[0]);if(n*k>at){for(;n*k>at;)at<<=1,ot--;st=new Float64Array(at),ct=new Int32Array(at)}if(ke>=Ie||Ne>=Ie)throw Error(`cn: too many distinct classes in one merge`);lt=lt+1|0,lt===0&&(it.fill(0),ct.fill(0),lt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Xe[e];if(t===xG){$e[e]=1;continue}let n=Ze[e];if(ut(n,t)===1)$e[e]=0,f=!0;else if($e[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if(Qe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!$e[m]){m++;continue}let t=Je[m],r=Ye[m],i=m+1;for(;i<n&&$e[i]&&Je[i]===r+1&&e.charCodeAt(r)===32;)r=Ye[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=wG(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>ee&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=wG(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>ee&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=wG(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=ee===0?ft:bG?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt(OG.apply(null,arguments))},mergeString:Dt,seenBefore:ee===0?()=>!1:Et,mergeUncached:ft}},EG=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:EG(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},DG=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:EG(i,t);a&&(n&&(n+=` `),n+=a)}return n},OG=function(){return DG(arguments,!1)},kG=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=EG(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(EG(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},AG=TG(yG),jG=kG(AG.mergeString,AG);AG.merge;var MG=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=GB({disabled:i,focusableWhenDisabled:a,native:o});return mB(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function NG(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=NG(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function PG(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=NG(e))&&(r&&(r+=` `),r+=t);return r}var FG=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,IG=PG,LG=(e,t)=>n=>{if(t?.variants==null)return IG(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=FG(t)||FG(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return IG(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},RG=LG(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5`,sm:`h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4`,icon:`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-xs":`size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5`,"icon-sm":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-lg":`size-8 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`,size:`default`}});function zG({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(MG,{"data-slot":`button`,className:jG(RG({variant:t,size:n,className:e})),...r})}var BG=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function VG(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:BG(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var HG=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},UG=e=>{let t=HG(e);return t.charAt(0).toUpperCase()+t.slice(1)},WG=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),GG={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function KG(e){return e!=null}function qG(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??GG.width,a=e.size??e.height??GG.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?WG(...c):WG(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??GG[`stroke-width`])*Number(e.size??e.width??GG.width)/Number(t.size??t.width??GG.width):t.strokeWidth??GG[`stroke-width`];return[`svg`,{...Object.entries(GG).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&KG(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&KG(t.width)&&{[r(`width`)]:t.width},...`height`in t&&KG(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function JG(e,t={}){return qG(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var YG=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},XG=(0,Z.createContext)({}),ZG=()=>(0,Z.useContext)(XG),QG=(0,Z.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=ZG()??{},y=!!c||YG(d),[b,x,S=[]]=JG(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:WG(v,s),hasA11yProp:y,attributes:d});return(0,Z.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $G(e,t=[],n=[]){let r=typeof e==`string`?VG(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(QG,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=UG(r.name)),i}var eK={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};eK.node;var tK=$G(eK),nK={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};nK.node;var rK=$G(nK),iK={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};iK.node;var aK=$G(iK),oK={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};oK.node;var sK=$G(oK),cK={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};cK.node;var lK=$G(cK),uK={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};uK.node;var dK=$G(uK),fK={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};fK.node;var pK=$G(fK),mK={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};mK.node;var hK=$G(mK),gK={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};gK.node;var _K=$G(gK),vK={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};vK.node;var yK=$G(vK),bK={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};bK.node;var xK=$G(bK),SK={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};SK.node;var CK=$G(SK),wK={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};wK.node;var TK=$G(wK),EK={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};EK.node;var DK=$G(EK),OK={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};OK.node;var kK=$G(OK),AK={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};AK.node;var jK=$G(AK),MK={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};MK.node;var NK=$G(MK),PK={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};PK.node;var FK=$G(PK),IK={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};IK.node;var LK=$G(IK),RK={name:`server-off`,size:24,node:[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};RK.node;var zK=$G(RK),BK={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};BK.node;var VK=$G(BK),HK={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};HK.node;var UK=$G(HK),WK={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};WK.node;var GK=$G(WK),KK={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};KK.node;var qK=$G(KK),JK={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};JK.node;var YK=$G(JK),XK={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};XK.node;var ZK=$G(XK),QK=Z.createContext(void 0);function $K(e){let t=Z.useContext(QK);if(t===void 0&&!e)throw Error(wI(72));return t}var eq=class extends KI{setState(e){}update(e){}set(e,t){}notifyAll(){}},tq={...UU,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},nq=class extends KI{constructor(e,t,n){let r=new IU;super(rq(e,r,t,n),iq(r),tq)}setOpen=(e,t)=>{AU(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,dV(YB,e))}};function rq(e,t,n,r=!1){return{...LU(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function iq(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var aq=jI(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=wU((e,t)=>new nq({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),MU(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=NU(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);xI(()=>{m&&t&&p.setOpen(!1,dV(oV))},[m,t,p]),xI(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),xI(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,dV(lV))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(QK.Provider,{value:p,children:[l&&(0,Q.jsx)(TU,{handle:l,store:p}),T&&(0,Q.jsx)(oq,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function oq({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=mH(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=dH(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>eB(a.reference,i.reference),[a.reference,i.reference]);return PU(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??_I}),null}function sq(e){return BB(e,`base-ui`)}var cq=Z.createContext(void 0);function lq(){return Z.useContext(cq)}var uq=`data-base-ui-tooltip-trigger`;function dq(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(QI(n))return n}}let t=e.target;return QI(t)?t:null}function fq(e){let t=e;for(;t;){let e=t.closest(`[${uq}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&QI(n.host)?n.host:null}return null}var pq=MI(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=$K(!0),m=WU(a)??p;if(!m)throw Error(wI(82));let h=sq(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Z.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=jU(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=lq(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=kV(v,{open:_}),O=eW(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=yV(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=DL(),I=Z.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=fq(e);return n!==null&&n!==t&&UL(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=rW(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?bW():null,restMs:L,delay(){return u==null&&D?{close:SV(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=YU(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=dq(e),r=ee(n),i=y.current,a=i&&n&&UL(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,dV(XB,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&jR(I.current)){let t=()=>{P.current||j.current||m.select(`open`)||m.setOpen(!0,dV(XB,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},re=m.useState(`triggerProps`,S);return mB(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,S||M!==`none`?re:void 0,{onMouseOver(e){ne(e.nativeEvent)},onFocus(e){R(dq(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[gR]:A?``:void 0,[uq]:A?void 0:``},f],stateAttributesMapping:fR})}),mq=Z.createContext(void 0);function hq(){let e=Z.useContext(mq);if(e===void 0)throw Error(wI(70));return e}var gq=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return $K().useState(`mounted`)||n?(0,Q.jsx)(mq.Provider,{value:n,children:(0,Q.jsx)(vV,{ref:t,...r})}):null}),_q=Z.createContext(void 0);function vq(){let e=Z.useContext(_q);if(e===void 0)throw Error(wI(71));return e}var yq=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=PB,style:g,..._}=e,v=$K(),y=hq(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=IW({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=BW(e,Z.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Q.jsx)(_q.Provider,{value:D,children:O})}),bq=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=$K(),{side:s,align:c}=vq(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);EB({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tW(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return mB(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[SU,f,zW(d),a],stateAttributesMapping:hR})}),xq=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=$K(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=vq();return mB(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:mR})}),Sq=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(cq.Provider,{value:t,children:(0,Q.jsx)(OV,{delay:i,timeoutMs:r,children:e.children})})};function Cq(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function wq({delay:e=0,...t}){return(0,Q.jsx)(Sq,{"data-slot":`tooltip-provider`,delay:e,...t})}function Tq({...e}){return(0,Q.jsx)(aq,{"data-slot":`tooltip`,...e})}function Eq({...e}){return(0,Q.jsx)(pq,{"data-slot":`tooltip-trigger`,...e})}function Dq({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(gq,{children:(0,Q.jsx)(yq,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(bq,{"data-slot":`tooltip-content`,className:jG(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,Q.jsx)(xq,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Oq=new Set;function kq(e){return Oq.add(e),()=>Oq.delete(e)}function Aq(e){for(let t of[...Oq])t(e)}function jq(e,t,n=!0){let r=()=>Aq({title:`Copied ${t}`,...n?{description:e}:{},type:`success`}),i=()=>Aq({title:`Could not copy ${t}`,...n?{description:e}:{},type:`error`});window.isSecureContext&&navigator.clipboard!==null&&navigator.clipboard!==void 0?navigator.clipboard.writeText(e).then(r,()=>{Mq(e)?r():i()}):Mq(e)?r():i()}function Mq(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var Nq=X(e=>Ck(t=>{window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`visibilitychange`,e),t.addFinalizer(()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`visibilitychange`,e)})}));function Pq(e){let t=(0,VW.c)(2),n;t[0]===e?n=t[1]:(n=Nq(e),t[0]=e,t[1]=n),aI(n)}var Fq=`~effect/Cache`,Iq=(e,t)=>Us(n=>{let r=Object.create(Rq);return r.lookup=t=>zs(e(t),e=>Rr(n,e)),r.map=nne(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>Ni(t.timeToLive(e,n)):zq,Do(r)}),Lq=e=>Iq(e.lookup,{...e,timeToLive:e.timeToLive===void 0?zq:()=>e.timeToLive}),Rq={...wt,[Fq]:Fq,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},zq=(e,t)=>Wi,Bq=a(2,(e,t)=>an(n=>{let r=ep(e.map,t);if(Yn(r)&&(rp(e.map,t),!Uq(r.value,n)))return np(e.map,t,r.value),r.value.await(n);let i=new Vq(n,e.lookup(t));i.onInterrupt=()=>Hq(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,js(r)){Hq(e,t,i);return}let o=e.timeToLive(r,t);Hi(o)?(a=!0,Hq(e,t,i)):Vi(o)&&(i.expiresAt=n.getRef(Pl).currentTimeMillisUnsafe()+Qi(o))});let o=i.fiber.pollUnsafe();return a||o!==void 0&&js(o)||np(e.map,t,i),Number.isFinite(e.capacity)&&Wq(e),i.await(n)})),Vq=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=il(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(e){return e===void 0?an(e=>this.await(e)):this.fiber.pollUnsafe()||(this.awaiters++,Vc(e,()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?Lo:(this.onInterrupt?.(),wo(this.fiber)))),So(this.fiber))}},Hq=(e,t,n)=>{let r=ep(e.map,t);Yn(r)&&r.value===n&&rp(e.map,t)},Uq=(e,t)=>e.expiresAt!==void 0&&t.getRef(Pl).currentTimeMillisUnsafe()>=e.expiresAt,Wq=e=>{let t=ip(e.map)-e.capacity;if(!(t<=0)){for(let[n]of e.map)if(rp(e.map,n),t--,t===0)return}},Gq=a(2,(e,t)=>Ao(()=>{rp(e.map,t)})),Kq=`~effect/FiberMap`,qq=e=>F(e,Kq),Jq={[Kq]:Kq,[Symbol.iterator](){return this.state._tag===`Closed`?ei():this.state.backing[Symbol.iterator]()},...wt,toJSON(){return{_id:`FiberMap`,state:this.state}}},Yq=(e,t)=>{let n=Object.create(Jq);return n.state={_tag:`Open`,backing:e,fibers:new Set},n.deferred=t,n},Xq=()=>lm(V(()=>Yq($f(),Vu())),e=>fp(()=>{let t=e.state;return t._tag===`Closed`?pp:(e.state={_tag:`Closed`},Yw(t.fibers).pipe(Zu(e.deferred)))})),Zq=-1,Qq=fa(ma(Fte,pa(Zq))),$q=a(e=>qq(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(Zq);return}let i=ep(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(Zq);return}}np(e.state.backing,t,n),e.state.fibers.add(n),i._tag===`Some`&&i.value.interruptUnsafe(Zq),n.addObserver(i=>{if(e.state._tag===`Closed`)return;e.state.fibers.delete(n);let a=ep(e.state.backing,t);Yn(a)&&n===a.value&&rp(e.state.backing,t),Ru(i)&&(r?.propagateInterruption===!0?!Qq(i.cause):!xu(i.cause))&&Xu(e.deferred,i)})}),eJ=a(2,(e,t)=>e.state._tag!==`Closed`&&ane(e.state.backing,t)),tJ=function(){let e;return()=>(e===void 0&&(e=Am(_m)),e)}(),nJ=e=>()=>Op($p(),t=>{let n=jm(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&eJ(e,t))return tJ();let a=n(r,i);return $q(e,t,a,i),a}}),rJ=`~effect/ManagedRuntime`,iJ=Br(`effect/ManagedRuntime/DisposingRuntimes`,{defaultValue:()=>new Set}),aJ=(e,t)=>{let n=t?.memoMap??vd(),r=nd(`sequential`),i=sd(r,`sequential`),a=sd(r,`parallel`),o=new WeakSet,s=new WeakSet,c={onFiberStart(e){o.add(e),s.has(e)||Zw(e,a)}},l=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{c.onFiberStart(t),e.onFiberStart(t)}:c.onFiberStart}:c,u,d,f=Sp(t=>(u||=Am(Ep(xd(e,n,i),e=>V(()=>{p.cachedContext=e})),{scheduler:t.cache.scheduler,onFiberStart(e){o.add(e),Zw(e,a)}}),wp(Gw(u)))),p={[rJ]:rJ,memoMap:n,scope:r,contextEffect:f,cachedContext:void 0,context(){return p.cachedContext===void 0?Pm(p.contextEffect):Promise.resolve(p.cachedContext)},dispose(){return Pm(p.disposeEffect)},[Symbol.asyncDispose](){return p.dispose()},disposeEffect:Sp(e=>{if(d!==void 0){if(e.getRef(iJ).has(p))return pp;for(let t=e;t;t=t._parent)if(o.has(t))return pp;return Uu(d)}Kc(e);let t=d=Vu();for(let t=e;t;t=t._parent)s.add(t),Nc(a,t);return p.contextEffect=yp(`ManagedRuntime disposed`),p.cachedContext=void 0,cd(p.scope,Iu).pipe(am(iJ,new Set(e.getRef(iJ)).add(p)),fm(Wu(t,Iu)))}),runFork(e,t){return p.cachedContext===void 0?Am(oJ(p,e),l(t)):jm(p.cachedContext)(e,l(t))},runCallback(e,t){return p.cachedContext===void 0?Nm(oJ(p,e),l(t)):Mm(p.cachedContext)(e,l(t))},runSyncExit(e){return p.cachedContext===void 0?Bm(oJ(p,e)):Vm(p.cachedContext)(e)},runSync(e){return p.cachedContext===void 0?Rm(oJ(p,e)):zm(p.cachedContext)(e)},runPromiseExit(e,t){return p.cachedContext===void 0?Im(oJ(p,e),l(t)):Lm(p.cachedContext)(e,l(t))},runPromise(e,t){return p.cachedContext===void 0?Pm(oJ(p,e),l(t)):Fm(p.cachedContext)(e,l(t))}};return p};function oJ(e,t){return Cp(e.contextEffect,e=>nm(t,e))}var sJ=`~effect/SynchronizedRef`,cJ={...wt,[sJ]:sJ,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},lJ=e=>{let t=Object.create(cJ);return t.semaphore=XT(1),t.backing=$A(e),t},uJ=e=>V(()=>lJ(e)),dJ=e=>e.backing.ref.current,fJ=a(2,(e,t)=>e.semaphore.withPermit(ij(e.backing,t))),pJ=a(2,(e,t)=>e.semaphore.withPermit(fp(()=>Op(t(dJ(e)),([t,n])=>(e.backing.ref.current=n,t))))),mJ=a(2,(e,t)=>e.semaphore.withPermit(nj(e.backing,t))),hJ=a(2,(e,t)=>e.semaphore.withPermit(aj(e.backing,t))),gJ=class extends dr()(`@porcelain/client/EnvironmentStorage`){},_J=class extends dr()(`@porcelain/client/AccessPlatform`){},vJ=class extends Y()(`WriteNotSentError`,{cause:qS}){get message(){return`An earlier change failed, so this one was not sent.`}},yJ=class extends dr()(`@porcelain/client/WriteQueue`){static make=H(function*(){let e=yield*eE(1),t=yield*ej({pending:0,failure:Kn()});return{enqueue:n=>xm(r=>H(function*(){return yield*aj(t,e=>({...e,pending:e.pending+1})),yield*xp,yield*e.withPermit(H(function*(){let e=yield*tj(t),i=yield*Dp(r(Yn(e.failure)?U(new vJ({cause:e.failure.value})):n));return yield*aj(t,e=>{let t=e.pending-1,n=Ru(i)?wu(i.cause):void 0;return{pending:t,failure:t===0?Kn():Qn(e.failure,()=>Ru(i)?qn(n instanceof vJ?n.cause:n):Kn())}}),yield*Lu(i)?B(i.value):_p(i.cause)}))}))}})},bJ=class e extends dr()(`@porcelain/client/WriteQueues`){static layer=kd(e,H(function*(){let e=yield*sD({lookup:e=>H(function*(){return{scope:yield*od(yield*ed,`parallel`),queue:yield*yJ.make}}),idleTimeToLive:0});return{run:(t,n)=>sm(H(function*(){let{scope:r,queue:i}=yield*cD(e,JSON.stringify(t)),a=yield*Dm(i.enqueue(n),r,{startImmediately:!0});return yield*Kw(a).pipe(fm(Jw(a)))}))}}))},xJ=class extends Y()(`ConnectionError`,{message:K,cause:HS(qS)}){},SJ=Um(`persistedState`)(function*(e){let t=CP({...e.initial,status:`loading`,error:void 0}),n=yield*yJ.make;return{state:t,load:()=>n.enqueue(H(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(Qp({onSuccess:e=>V(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),bm)})),write:r=>n.enqueue(H(function*(){if(t.value.status!==`ready`)return yield*U(new xJ({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe(Fp(({cause:t})=>new xJ({message:e.messages.writeFailed,cause:t})),Lp(()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Ep(()=>V(()=>t.update(e=>({...e,...n})))),bm)}))}}),CJ=1024;1024*CJ;var wJ=16*CJ,TJ=2e3,EJ=2e3,DJ=4096,OJ=1e3,kJ=1e4,AJ=kJ,jJ=1024,MJ=5e4,NJ=oC([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),PJ=q({statusCode:XS.check(DC()).check(wC(400)).check(TC(599)),error:K,message:K,code:W(NJ)}),FJ=K.check(_C(e=>qr(PS(HC)(e)),{expected:`an absolute URL`})),IJ=K.check(yC(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),_C(e=>{let t=PS(iw)(e);return qr(t)&&Cg(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),LJ=K.check(bC()),RJ=K.check(yC(RegExp(`^[0-9a-f]{32}$`)));function zJ(e){return sC(e).pipe(pC(cC(WS(e)),Fy({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var BJ=q({worktreeId:RJ}),VJ=`~effect/http-api/HttpApiMiddleware`,HJ=`~effect/http-api/HttpApiMiddleware/Security`,UJ=()=>(e,t)=>{let n=ct(),r;n!==0&&(lt(2),r=new globalThis.Error,lt(n));class i extends dr()(e){}let a=i;if(Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[VJ]=VJ,a.error=WJ(t?.error),a.requiredForClient=t?.requiredForClient??!1,t?.security!==void 0){if(Object.keys(t.security).length===0)throw Error(`HttpApiMiddleware.Service: security object must not be empty`);a[HJ]=HJ,a.security=t.security}return a};function WJ(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var GJ=`~effect/http-api/HttpApiGroup`,KJ={[GJ]:GJ,add(...e){let t={...this.endpoints};for(let n of e)ft(t,n.identifier,n);return JJ({...qJ(this),endpoints:t})},prefix(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.prefix(e))})},middleware(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return JJ({...qJ(this),annotations:Rr(this.annotations,e)})},annotate(e,t){return JJ({...qJ(this),annotations:Or(this.annotations,e,t)})},annotateEndpointsMerge(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return JJ({...qJ(this),endpoints:ni(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},qJ=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),JJ=e=>{function t(){}return Object.setPrototypeOf(t,KJ),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},YJ=(e,t)=>JJ({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:Tr()}),XJ=aC([q({kind:G(`owner`)}),q({kind:G(`device`),deviceId:K.check(bC())})]),ZJ=`/open/pair`,QJ=`/pair`;function $J(e){return e.replace(/\/$/,``)===ZJ}function eY(e){let t=t=>[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...t?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return e.appOrigin===void 0?`${e.addresses[0]??``}${QJ}#${t(e.addresses.length>1)}`:`${e.appOrigin}${ZJ}#${t(!0)}`}function tY(e){let t=e.indexOf(`#`);if(t===-1)return;let n=e.slice(0,t),r;try{r=new Map(e.slice(t+1).split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]}))}catch{return}let i=(r.get(`a`)??``).split(`,`).filter(e=>e!==``),a={code:r.get(`c`)??``,environmentId:r.get(`e`)??``};if(n.endsWith(`/open/pair`))return i.length===0?void 0:{...a,addresses:i,appOrigin:n.slice(0,-10)};if(n.endsWith(QJ))return{...a,addresses:i.length===0?[n.slice(0,-5)]:i}}var nY=K,rY=q({addresses:J(K),code:K,environmentId:K,appOrigin:W(K)}),iY=nY.pipe(pC(rY,Py({decode:e=>{let t=tY(e);return t===void 0?U(new zv({message:`Expected a Porcelain pairing link`})):B(t)},encode:e=>B(eY(e))}))),aY=q({code:K.check(kC(1)).check(jC(200)),platform:K.check(kC(1)).check(jC(120)),label:W(K.check(kC(1)).check(jC(80)))}),oY=q({device:q({id:K,label:K,platform:K,createdAt:K}),credential:W(K)}),sY=q({id:K,label:K,addresses:J(K),createdAt:K,expiresAt:K,trusted:ZS,canManageSharing:W(ZS)}),cY=oC([`loopback`,`lan`,`tailnet`,`tunnel`]),lY=q({id:K,label:K,platform:K,createdAt:K,lastSeenAt:K,lastSeenAddress:W(K),route:cY,routeInferred:W(ZS),trusted:ZS,canManageSharing:W(ZS),canEditWaysIn:ZS,current:W(ZS)}),uY=q({canEditIdentity:W(ZS),grants:J(sY),devices:J(lY)}),dY=q({labels:J(K.check(kC(1)).check(jC(80))).check(kC(1)).check(jC(20)),addresses:J(FJ).check(kC(1)).check(jC(10)),trusted:W(ZS),canManageSharing:W(ZS)}),fY=q({grants:J(q({grant:sY,code:K,link:iY}))}),pY=q({id:K.check(kC(1))}),mY=q({revoked:ZS,kind:W(oC([`grant`,`device`]))}),hY=q({id:K.check(kC(1)),trusted:ZS}),gY=q({id:K,trusted:ZS}),_Y=q({id:K.check(kC(1)),allowed:ZS}),vY=q({id:K,allowed:ZS}),yY=q({id:K.check(kC(1)),allowed:ZS}),bY=q({id:K,allowed:ZS}),xY=YS;q({route:cY,local:ZS}),dr()(`@porcelain/http/RequestConnection`);var SY=class extends UJ()(`@porcelain/http/ClientRequest`){};dr()(`@porcelain/http/RequestCaller`);var CY=class extends UJ()(`@porcelain/http/PairedRequest`){},wY=oC([`low`,`medium`,`high`,`xhigh`,`max`]),TY=oC([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]),EY=TY,DY=K,OY=aC([q({provider:G(`claude`),model:DY,effort:wY}),q({provider:G(`codex`),model:DY,effort:TY})]),kY=q({provider:oC([`claude`,`codex`]),model:DY,label:K,efforts:J(EY),defaultEffort:EY}),AY=q({kind:oC([`signed_out`,`agent_not_installed`,`timed_out`,`unusable_output`,`other`]),message:K}),jY=q({outcome:oC([`needs_you`,`worth_knowing`,`nothing`]),title:K,summary:K,growth:J(q({change:oC([`added`,`changed`,`removed`]),what:K,note:K})),stops:J(q({title:K,explanation:K,attention:W(q({kind:oC([`tradeoff`,`contract`,`product`,`risk`,`accessibility`]),note:K,question:K})),excerpts:J(q({path:K,side:oC([`new`,`old`]),start:OC,end:OC,caption:K})),evidence:J(q({assetId:K,shows:K})),files:J(q({path:K,note:K}))})),onlyInTranscript:J(q({point:K,answer:K})),stillUnclear:J(K),checks:W(K)}),MY=q({id:K,projectId:K,worktreeId:K,pullRequestNumber:W(OC),pullRequestRepository:W(q({owner:K,repo:K})),evidenceUnavailable:W(oC([`head_mismatch`,`github_account`,`github_unavailable`])),baseOid:K,headOid:K,contentTreeOid:K,baseRef:K,includesUncommitted:ZS,branch:W(K),writer:OY,sessionId:W(K),createdAt:K,state:aC([q({status:G(`queued`)}),q({status:G(`running`)}),q({status:G(`ready`),content:jY,writtenAt:K,durationMs:XS,costUsd:W(XS)}),q({status:G(`failed`),failure:AY})])});q({run:MY,worktreePath:K,patch:K,omittedFiles:W(J(K)),files:J(q({path:K,oldPath:W(K),hunks:J(q({oldStart:OC,oldEnd:OC,newStart:OC,newEnd:OC}))}))});var NY=q({mode:oC([`manual`,`automatic`]),writer:W(OY)}),PY=aC([q({status:G(`answering`)}),q({status:G(`answered`),text:K,answeredAt:K,durationMs:XS,costUsd:W(XS)}),q({status:G(`failed`),failure:AY})]),FY=aC([q({status:G(`none`)}),q({status:G(`saved`)}),q({status:G(`posted`),url:K,postedAt:K})]),IY=class extends Y()(`WalkthroughFailedError`,{...AY.fields}){},LY=class extends Y()(`WalkthroughAssetNotFoundError`,{}){get message(){return`Walkthrough evidence asset not found`}},RY=class extends Y()(`WalkthroughMessageNotFoundError`,{}){get message(){return`Walkthrough message not found`}},zY=class extends Y()(`WalkthroughTargetNotFoundError`,{}){get message(){return`Finished walkthrough or step not found`}},BY=class extends Y()(`WalkthroughPostFailedError`,{message:K}){},VY=class extends Y()(`WalkthroughRepositoryChangedError`,{message:K}){},HY={onExcessProperty:`error`},UY=dae(`porcelain`).annotate(nP,HY).annotate(rP,HY).annotate(iP,HY),WY=class extends Y()(`InvalidLineRangeError`,{}){get message(){return`The line range ends before it starts`}},GY=class extends Y()(`WorktreeChangedError`,{}){get message(){return`Worktree changed during inspection`}},KY=class extends Y()(`WorktreeNotFoundError`,{}){get message(){return`Worktree not found`}},qY=class extends Y()(`RepositoryUnavailableError`,{}){get message(){return`Repository could not be inspected`}},JY=class extends Y()(`FilePreferenceLimitError`,{}){get message(){return`File preference limit reached`}},YY=class extends Y()(`FolderNotFoundError`,{}){get message(){return`Path not found`}},XY=class extends Y()(`FolderNotReadableError`,{}){get message(){return`Path could not be read`}};Y()(`NoWorktreeAtPathError`,{});var ZY=class extends Y()(`ProjectNotFoundError`,{}){get message(){return`Project not found`}},QY=class extends Y()(`UnsupportedFolderNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},$Y=class extends Y()(`WorktreeUnavailableError`,{}){get message(){return`Worktree is unavailable`}},eX=class extends Y()(`BranchArchiveRefusedError`,{message:K}){},tX=Br(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),nX=Br(`effect/http/FetchHttpClient/StreamBodyFallback`,{defaultValue:()=>`error`}),rX=class extends dr()(`effect/http/FetchHttpClient/RequestInit`){},iX,aX=()=>{try{let e=!1,t=new ReadableStream,n=new Request(`https://example.com`,{method:`POST`,body:t,get duplex(){return e=!0,`half`}});return(e||n.body===t)&&!n.headers.has(`Content-Type`)}catch{return!1}},oX=yM(B(fM((e,t,n,r)=>{if(e.headers.upgrade!==void 0)return U(new cj({reason:new pj({request:e,description:`fetch cannot send an HTTP upgrade request`})}));let i=r.getRef(tX),a=Ar(r.context,rX)??{},o=a.headers?I_(M_(a.headers),e.headers):e.headers;o[`content-length`]&&(o=L_(o,`content-length`));let s,c=V(()=>s?.abort()),l=r=>Op(up({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:s?AbortSignal.any([n,s.signal]):n}),catch:t=>new cj({reason:new pj({request:e,cause:t})})}),t=>{let n=eM(e,t);return s?(t.body===null&&s.abort(),Object.create(n,{...Object.fromEntries([`arrayBuffer`,`text`,`json`,`formData`,`urlParamsBody`].map(e=>[e,{get:()=>fm(n[e],c)}])),stream:{get:()=>eO(n.stream,c)}})):n}).pipe(pm(()=>c));switch(e.body._tag){case`Raw`:case`Uint8Array`:return l(e.body.body);case`FormData`:return l(e.body.formData);case`Stream`:if(iX??=aX(),iX){s=new AbortController;let t=AbortSignal.any([n,s.signal]),r=hp(e=>{let n=()=>e(_m);if(t.aborted)n();else return t.addEventListener(`abort`,n,{once:!0}),V(()=>t.removeEventListener(`abort`,n))});return Cp(cO(QD(e.body.stream,r)),l)}return r.getRef(nX)===`error`?U(new cj({reason:new mj({request:e,description:`Streaming request bodies are not supported in this runtime`})})):oO(e.body.stream).pipe(Fp(t=>new cj({reason:new mj({request:e,cause:t})})),Cp(l))}return l(void 0)}))),sX={BadRequest:`Bad Request`,Unauthorized:`Unauthorized`,Forbidden:`Forbidden`,PayloadTooLarge:`Payload Too Large`,TooManyRequests:`Too Many Requests`,BadGateway:`Bad Gateway`,ServiceUnavailable:`Service Unavailable`,NotFound:`Not Found`,Conflict:`Conflict`,UnprocessableEntity:`Unprocessable Entity`},cX=class extends Y()(`HttpFailureMessage`,{name:K,message:K}){};function $(e,t,n={}){let r=typeof n.message==`object`?void 0:n.message??new e().message,i={statusCode:rN(t),error:sX[t],...n.code===void 0?{}:{code:n.code}};return q({statusCode:G(i.statusCode),error:G(i.error),message:r===void 0?K:G(r),code:HS(n.code===void 0?KS:G(n.code))}).pipe(pC(TS(t=>t instanceof e||t instanceof cX&&t.name===e.name),Fy({decode:t=>r===void 0?new cX({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),aN(t))}var lX=[$(GY,`Conflict`,{code:`worktree_changed`,message:`Refresh status and retry inspection`}),$(KY,`NotFound`),$(ZY,`NotFound`),$($Y,`UnprocessableEntity`,{message:`Repository could not be inspected`})];Y()(`GitActionRejectedError`,{reason:oC([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`]),detail:W(K),cause:W(qS)}),Y()(`RepositoryIdentityMismatchError`,{});var uX=class extends Error{name=`GitError`},dX=class extends uX{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},fX=class extends uX{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},pX=class extends uX{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},mX=class extends uX{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},hX=class extends uX{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},gX=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},_X=class extends uX{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},vX=class extends uX{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},yX=class extends uX{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},bX=class extends uX{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},xX=class extends uX{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:K,args:J(K),exitCode:cC(XS),stderr:K,cause:W(qS)}),Y()(`GitFilesystemError`,{cause:qS}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var SX=[$(dX,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(fX,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(pX,`BadRequest`),$(mX,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(hX,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(gX,`ServiceUnavailable`,{message:`Operation unavailable`}),$(_X,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(vX,`BadGateway`,{message:`Git produced output that could not be read`}),$(yX,`BadGateway`,{message:`Git produced output that could not be read`}),$(bX,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(xX,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(qY,`UnprocessableEntity`,{message:`Repository could not be inspected`})],CX=8e3,wX=aC([q({kind:G(`walkthrough`)}),q({kind:G(`stop`),title:K.check(kC(1))})]),TX=q({...BJ.fields,runId:K.check(kC(1))}),EX=q({...TX.fields,messageId:K.check(kC(1))}),DX=q({writer:W(OY),anchor:wX,text:K.check(zre(),kC(1),jC(CX))}),OX=q({saved:ZS}),kX={messageId:W(K.check(kC(1)))},AX=q({...PY.members[1].fields,costUsd:zJ(XS)}),jX=q({runId:K,anchor:wX,messages:J(aC([q({author:G(`developer`),id:K,text:K,createdAt:K,post:FY}),q({author:G(`agent`),id:K,replyTo:K,createdAt:K,state:aC([q({status:G(`answering`)}),AX,q({status:G(`failed`),failure:AY})])})]))}),MX=q({runId:zJ(K),pullRequestNumber:zJ(OC),conversations:J(jX)}),NX=q({outcome:aC([q({status:G(`nothing`)}),q({status:G(`posted`),url:K,notPosted:J(K)}),q({status:G(`brief`),text:K})]),view:MX}),PX=q({text:zJ(K)}),FX=q({...jY.fields,checks:zJ(K),stops:J(q({...jY.fields.stops.value.fields,attention:zJ(q({kind:oC([`tradeoff`,`contract`,`product`,`risk`,`accessibility`]),note:K,question:K}))}))}),IX=q({status:G(`ready`),content:FX,writtenAt:K,durationMs:XS,costUsd:zJ(XS)}),LX=q({...MY.fields,contentTreeOid:K,baseRef:K,includesUncommitted:ZS,pullRequestNumber:zJ(OC),sessionId:zJ(K),state:aC([q({status:G(`queued`)}),q({status:G(`running`)}),IX,MY.fields.state.members[3]])}),RX=q({...BJ.fields,runId:K,assetId:K}),zX=q({base:W(K),pullRequestNumber:W(OC.check(CC(0))),writer:W(OY)}),BX=q({walkthrough:zJ(LX),attempt:W(LX),outOfDate:ZS}),VX=q({writer:OY,models:J(kY)}),HX=class extends UY.add(YJ(`walkthroughs`).add(KN(`readWalkthroughWriterSettings`,`/api/walkthrough-settings`,{disableCodecs:!0,success:VX}),JN(`saveDefaultWalkthroughWriter`,`/api/walkthrough-settings`,{disableCodecs:!0,payload:OY,success:OY}),qN(`startWalkthrough`,`/api/worktrees/:worktreeId/walkthrough`,{disableCodecs:!0,params:BJ,payload:zX,success:LX,error:[...lX,...SX,$(IY,`UnprocessableEntity`,{message:{fromError:!0}})]}),KN(`readWalkthrough`,`/api/worktrees/:worktreeId/walkthrough`,{disableCodecs:!0,params:BJ,success:BX,error:[...lX,...SX]}),KN(`readWalkthroughAsset`,`/api/worktrees/:worktreeId/walkthrough/:runId/assets/:assetId`,{disableCodecs:!0,params:RX,success:YC.pipe(Jie()),error:[...lX,$(LY,`NotFound`)]}),KN(`listWalkthroughConversations`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations`,{disableCodecs:!0,params:TX,success:MX,error:[...lX,$(zY,`NotFound`)]}),qN(`addWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages`,{disableCodecs:!0,params:TX,payload:DX,success:MX,error:[...lX,$(zY,`NotFound`)]}),qN(`retryWalkthroughAnswer`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/retry`,{disableCodecs:!0,params:EX,success:MX,error:[...lX,$(zY,`NotFound`),$(RY,`NotFound`)]}),JN(`saveWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/saved`,{disableCodecs:!0,params:EX,payload:OX,success:MX,error:[...lX,$(zY,`NotFound`),$(RY,`NotFound`)]}),qN(`postWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/post`,{disableCodecs:!0,params:EX,success:NX,error:[...lX,$(zY,`NotFound`),$(RY,`NotFound`),$(BY,`BadGateway`,{message:{fromError:!0}}),$(VY,`Conflict`,{message:{fromError:!0}})]}),qN(`postSavedWalkthroughMessages`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/post-saved`,{disableCodecs:!0,params:TX,success:NX,error:[...lX,$(zY,`NotFound`),$(RY,`NotFound`),$(BY,`BadGateway`,{message:{fromError:!0}}),$(VY,`Conflict`,{message:{fromError:!0}})]}),KN(`readWalkthroughBrief`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/brief`,{disableCodecs:!0,params:TX,query:kX,success:PX,error:[...lX,$(zY,`NotFound`),$(RY,`NotFound`)]})).middleware(CY)){},UX=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},WX=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},GX=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},KX=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var qX=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},JX=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},YX=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},XX=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},ZX=class extends Y()(`NoLocalNetworkError`,{}){get message(){return`This computer is not on a local network right now, so there is no network to share on.`}},QX=class extends Y()(`UnidentifiedLocalNetworkError`,{}){get message(){return`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known. Try again in a moment.`}},$X=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},eZ=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},tZ=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},nZ=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},rZ=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},iZ=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},aZ=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},oZ=class extends Y()(`WaysInPermissionRequiredError`,{}){get message(){return`An owner must let this device edit ways in on the computer that runs Porcelain before it can see or change them`}},sZ=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},cZ=class extends Y()(`RemoteRouteInUseError`,{}){get message(){return`This device is connected through this way in, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}},lZ=class extends Y()(`ReviewGitSettingsTrustRequiredError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can change Reviews & Git settings`}},uZ=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},dZ=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},fZ=class extends Y()(`PushRegistrationDeviceRequiredError`,{}){get message(){return`Notifications are registered by a paired device`}},pZ=$(KX,`ServiceUnavailable`,{message:`Operation unavailable`}),mZ=q({pullStrategy:oC([`merge`,`rebase`]),collapseSpecs:ZS,archiveDeleteWorktree:ZS,archiveDeleteLocalBranch:ZS,archiveDeleteRemoteBranch:ZS}),hZ=oC([`desktop`,`laptop`,`server`,`cloud`]),gZ=KS,_Z=oC([`ios`,`android`]),vZ=q({name:K,custom:ZS,icon:HS(hZ)}),yZ=q({environmentId:K,name:K,version:zJ(K),protocol:XS.check(DC()).check(CC(0))}),bZ=q({name:sC(K.pipe(Pre(Iy())).check(kC(1)).check(jC(64)).check(_C(e=>!/\p{Cc}/u.test(e))))}),xZ=vZ,SZ=q({icon:sC(hZ)}),CZ=vZ,wZ=q({status:G(`ok`),environmentId:K}),TZ={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return EZ({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return EZ({requests:t,annotations:br(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return EZ({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return EZ({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return H(function*(){let n=yield*$p(),r=ap(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),br(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return EZ({requests:t,annotations:this.annotations})},toLayer(e){return jd(this.toHandlers(e))},of:o,toLayerHandler(e,t){let n=this;return jd(H(function*(){let r=yield*$p(),i=ap(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),br(a)}))},accessHandler(e){return em(t=>{let n=this.requests.get(e),{handler:r,context:i}=jr(t,n.key);return B((e,t)=>{t.rpc=n;let a=r(e,t),o=Zae(a)?a.value:a;return ap(o)?tm(o,i):tO(o,i)})})},annotate(e,t){return EZ({requests:this.requests,annotations:Or(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(Dr(e,t))},annotateMerge(e){return EZ({requests:this.requests,annotations:Rr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(Rr(e,r.annotations)));return EZ({requests:t,annotations:this.annotations})}},EZ=e=>Object.assign(function(){},TZ,{requests:e.requests,annotations:e.annotations}),DZ=(...e)=>EZ({requests:new Map(e.map(e=>[e._tag,e])),annotations:Tr()}),OZ=`(?:[0-9a-f]{40}|[0-9a-f]{64})`,kZ=K.check(yC(RegExp(`^${OZ}$`))),AZ=K.check(yC(RegExp(`^${OZ}(?:,${OZ})*$`))),jZ=oC([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),MZ=q({requestId:K.check(bC()),projectId:K.check(bC()),worktreeId:RJ,action:jZ,state:oC([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:W(oC([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`])),message:W(K),progress:J(K),result:W(q({headOid:W(kZ),trackingOid:W(kZ),sourceOid:W(kZ),destinationRef:W(K),stashOid:W(kZ),stashRetained:W(ZS),restoreStashOid:W(kZ),restoreIndex:W(ZS),branch:W(K)})),acceptedAt:IJ,finishedAt:W(IJ)}),NZ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function PZ(e,t){return e.length>0&&e.length<=t&&!e.includes(`\0`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)&&!NZ.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`)}var FZ=K.check(kC(1)).check(jC(DJ)).check(_C(e=>PZ(e,DJ),{expected:`Expected a normalized relative path`})),IZ=q({projects:J(K.check(bC())).check(jC(128)),worktrees:J(q({projectId:K.check(bC()),worktreeId:RJ,paths:J(FZ).check(jC(64))})).check(jC(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),LZ=DZ(PP(`notices`,{success:aC([q({type:G(`ready`)}),q({type:G(`subscribed`)}),q({type:G(`heartbeat`)}),q({type:G(`inventory`)}),q({type:G(`walkthrough`),change:oC([`run`,`conversations`]),projectId:K,worktreeId:RJ}),q({type:G(`git-action`),projectId:K.check(bC()),worktreeId:RJ,receipt:MZ}),q({type:G(`project`),projectId:K.check(bC()),change:oC([`files`,`preferences`])}),q({type:G(`worktree`),projectId:K.check(bC()),worktreeId:RJ,change:oC([`files`,`git`,`reviewed`])})]),stream:!0}),PP(`follow`,{payload:IZ})),RZ=q({ticket:K,expiresAt:K}),zZ=q({ticket:W(K)}),BZ=YS,VZ=q({address:K,dataDirectory:K,pid:XS.check(DC()).check(CC(0))}),HZ=q({token:K.check(kC(1)).check(jC(256)),platform:_Z,kinds:J(gZ).check(jC(2))}),UZ=q({kinds:J(gZ)}),WZ=YS,GZ=aC([q({kind:G(`off`)}),q({kind:G(`starting`)}),q({kind:G(`on`),urls:J(K)}),q({kind:G(`paused`)}),q({kind:G(`failed`),reason:oC([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),KZ=q({interfaceName:K,subnet:K,gateway:K,gatewayHardware:W(K)}),qZ=q({enabled:ZS,status:GZ}),JZ=K.check(yC(/^[a-f0-9]{64}$/)).pipe(lC(`WaysInFingerprint`)),YZ=oC([`lan`,`tailnet`,`cloudflare`]),XZ=q({routes:q({lan:qZ,tailnet:qZ,cloudflare:qZ}),lanNetwork:W(KZ),localNetwork:W(KZ),tailnetHostname:W(K),tailnetTarget:W(K),cloudflareHostname:W(K),serviceUrl:K,editing:q({fingerprint:JZ,protectedRoute:W(YZ)})}),ZZ=q({expected:JZ,change:q({lan:W(ZS),tailnet:W(ZS),tailnetHostname:W(K.check(kC(1)).check(jC(253))),cloudflare:W(ZS),cloudflareHostname:W(K.check(kC(1)).check(jC(253)))}).check(_C(e=>Object.keys(e).length>0))}),QZ=XZ,$Z=OC.check(CC(0)).check(TC(2**53-1)),eQ=q({kind:G(`configured`),revision:$Z,settings:mZ}),tQ=aC([q({kind:G(`unconfigured`)}),eQ]),nQ=aC([q({kind:G(`initialize`),settings:mZ}),q({kind:G(`change`),change:mZ.mapFields(yS(HS)).check(NC(1))})]),rQ=eQ,iQ=q({from:K,target:K,stage:oC([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:zJ(K)}),aQ=q({managed:ZS,version:zJ(K),latest:zJ(K),available:ZS,running:ZS,last:zJ(iQ),canUpdate:ZS}),oQ=q({version:K.check(kC(1)).check(jC(128))}),sQ=aQ,cQ=$(UX,`BadRequest`),lQ=YJ(`publicAccess`).add(KN(`readHealth`,`/health`,{disableCodecs:!0,success:wZ,error:pZ}),KN(`readEnvironment`,`/environment`,{disableCodecs:!0,success:yZ,error:pZ})),uQ=YJ(`browserAccess`).add(XN(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:xY.pipe(oN({decode:()=>void 0}),aN(`NoContent`))})),dQ=YJ(`pairing`).add(qN(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:aY,success:oY,error:[cQ,$(GX,`Unauthorized`)]})).middleware(SY),fQ=YJ(`session`).add(KN(`readSession`,`/session`,{disableCodecs:!0,success:XJ}),qN(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:RZ,error:[$(nZ,`Forbidden`),$(rZ,`TooManyRequests`)]})).middleware(CY).middleware(SY),pQ=$(fZ,`Forbidden`),mQ=YJ(`pushRegistration`).add(JN(`setPushRegistration`,`/push-registration`,{disableCodecs:!0,payload:HZ,success:UZ,error:pQ}),XN(`clearPushRegistration`,`/push-registration`,{disableCodecs:!0,success:WZ.pipe(oN({decode:()=>void 0}),aN(`NoContent`)),error:pQ})).middleware(CY).middleware(SY),hQ=YJ(`serviceUpdates`).add(KN(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:aQ}),qN(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:oQ,success:sQ.pipe(aN(`Accepted`)),error:[$(aZ,`Forbidden`),$($X,`Conflict`),$(tZ,`Conflict`),$(eZ,`Conflict`)]})).middleware(CY).middleware(SY),gQ=YJ(`reviewGitSettings`).add(KN(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:tQ}),YN(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:nQ,success:rQ,error:[$(lZ,`Forbidden`),$(uZ,`Conflict`)]})).middleware(CY).middleware(SY),_Q=$(dZ,`Forbidden`),vQ=YJ(`administration`).add(KN(`listAccess`,`/access`,{disableCodecs:!0,success:uY,error:_Q}),qN(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:dY,success:fY,error:[_Q,pZ,cQ,$(WX,`BadRequest`)]}),qN(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:pY,success:mY,error:_Q}),qN(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:hY,success:gY,error:[_Q,$(iZ,`NotFound`)]}),qN(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:yY,success:bY,error:[_Q,$(iZ,`NotFound`)]}),qN(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:_Y,success:vY,error:[_Q,$(iZ,`NotFound`)]})).middleware(CY).middleware(SY),yQ=$(oZ,`Forbidden`),bQ=YJ(`remoteAccess`).add(KN(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:XZ,error:yQ}),YN(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:ZZ,success:QZ,error:[yQ,$(sZ,`Conflict`),$(cZ,`Conflict`),$(YX,`BadRequest`),$(qX,`BadRequest`),$(XX,`BadRequest`),$(JX,`BadRequest`),$(ZX,`Conflict`),$(QX,`Conflict`)]})).middleware(CY).middleware(SY),xQ=YJ(`environmentLabel`).add(JN(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:bZ,success:xZ})).add(JN(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:SZ,success:CZ})).middleware(CY),SQ=YJ(`ownerStatus`).add(KN(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:VZ})).middleware(CY);UY.add(lQ).prefix(`/api`),UY.add(uQ).prefix(`/api`);var CQ=class extends UY.add(dQ).prefix(`/api`){};UY.add(fQ).prefix(`/api`),UY.add(mQ).prefix(`/api`),UY.add(hQ).prefix(`/api`),UY.add(bQ).prefix(`/api`),UY.add(gQ).prefix(`/api`),UY.add(vQ).prefix(`/api`),UY.add(xQ).prefix(`/api`),UY.add(vQ,bQ,SQ);var wQ=class extends UY.add(lQ,uQ,dQ,fQ,mQ,hQ,bQ,gQ,vQ,xQ).prefix(`/api`){},TQ=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},EQ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},DQ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},OQ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},kQ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},AQ=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},jQ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},MQ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},NQ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},PQ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},FQ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},IQ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},LQ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},RQ=$(jQ,`BadRequest`,{message:`Invalid request`}),zQ=$(MQ,`NotFound`),BQ=$(TQ,`Conflict`,{code:`content_changed`}),VQ=$(kQ,`Conflict`),HQ=$(NQ,`UnprocessableEntity`),UQ=$(IQ,`UnprocessableEntity`),WQ=$(OQ,`UnprocessableEntity`),GQ=$(EQ,`UnprocessableEntity`),KQ=$(PQ,`UnprocessableEntity`),qQ=$(FQ,`UnprocessableEntity`),JQ=$(LQ,`UnprocessableEntity`,{code:`unsupported_text`}),YQ=$(AQ,`UnprocessableEntity`,{code:`file_too_large`}),XQ=$(DQ,`UnprocessableEntity`),ZQ=[...lX,zQ,HQ,BQ],QQ=[...ZQ,JQ,YQ],$Q=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},e$=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},t$=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},n$=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},r$=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},i$=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},a$=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},o$=K.check(kC(1)).check(jC(jJ)).check(yC(/^refs\/(?:heads|remotes)\/\S+$/u)),s$=K.check(yC(/^[a-f0-9]{64}$/)),c$=aC([q({kind:G(`text`),patch:K}),q({kind:G(`binary`)}),q({kind:G(`metadata-only`),patch:K}),q({kind:G(`omitted`),reason:oC([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),l$=q({ref:K,oid:kZ}),u$=q({path:K,oldPath:zJ(K),newPath:zJ(K),status:oC([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:W(kZ),newOid:W(kZ),oldMode:K,newMode:K,fingerprint:s$}),d$=q({base:W(o$)}),f$=q({worktreeId:RJ,head:q({oid:kZ,branch:zJ(K)}),base:zJ(l$),mergeBaseOid:zJ(kZ),commits:XS.check(DC()).check(wC(0)),files:J(u$).check(jC(kJ))}),p$=q({baseOid:kZ,headOid:kZ,paths:J(J(K).check(kC(1)).check(jC(2))).check(kC(1)).check(jC(200))}),m$=q({diffs:J(q({paths:J(K),content:c$}))}),h$=q({defaultRef:zJ(K),bases:J(q({ref:K,name:K,remote:ZS})).check(jC(500))}),g$=q({additions:OC,deletions:OC,binaryFiles:OC}),_$={DD:`both-deleted`,AU:`added-by-us`,UD:`deleted-by-them`,UA:`added-by-them`,DU:`deleted-by-us`,AA:`both-added`,UU:`both-modified`},v$={"both-deleted":`DD`,"added-by-us":`AU`,"deleted-by-them":`UD`,"added-by-them":`UA`,"deleted-by-us":`DU`,"both-added":`AA`,"both-modified":`UU`},y$=oC([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),b$=oC([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),x$=y$.pipe(pC(b$,Fy({decode:e=>_$[e],encode:e=>v$[e]}))),S$=q({scope:oC([`staged`,`unstaged`]),oldPath:zJ(FZ),newPath:zJ(FZ)}),C$=aC([q({scope:oC([`staged`,`unstaged`]),kind:oC([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:zJ(FZ),newPath:zJ(FZ),oldMode:K.check(yC(/^[0-7]{6}$/)),newMode:K.check(yC(/^[0-7]{6}$/)),oldOid:zJ(kZ),newOid:zJ(kZ),supported:ZS}),q({scope:G(`untracked`),path:FZ}),q({scope:G(`unmerged`),path:FZ,conflict:x$})]),w$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:s$,branch:W(q({name:zJ(K),upstream:zJ(K),ahead:XS.check(DC()).check(wC(0)),behind:XS.check(DC()).check(wC(0)),remoteName:zJ(K),sourceRef:zJ(K),upstreamOid:zJ(kZ),stashes:J(q({oid:kZ,message:K})),discarded:J(q({oid:kZ,path:FZ,kind:oC([`hunk`,`rename`])})).check(jC(50))})),consistency:G(`best-effort`),headOid:zJ(kZ),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(kZ),headCommit:zJ(q({subject:K,body:W(K)})),changes:J(C$).check(jC(TJ))}),T$=q({environmentId:K.check(bC()),worktreeId:RJ,...g$.fields,additions:g$.fields.additions.check(wC(0)),deletions:g$.fields.deletions.check(wC(0)),binaryFiles:g$.fields.binaryFiles.check(wC(0))}),E$=q({path:FZ,fingerprint:zJ(s$),comparisons:J(C$).check(kC(1))}),D$=q({name:zJ(K),upstream:zJ(K),ahead:XS.check(DC()).check(wC(0)),behind:XS.check(DC()).check(wC(0))}),O$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:s$,headOid:zJ(kZ),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(kZ),branch:zJ(D$),interrupted:W(q({requestId:K.check(bC()),action:jZ})),changes:J(E$).check(jC(TJ))}),k$=q({expectedStatusToken:s$,expectedFiles:J(q({path:FZ,fingerprint:zJ(s$)})).check(kC(1)).check(jC(200)),selections:J(S$).check(kC(1)).check(jC(200))}),A$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:s$,diffs:J(q({selection:S$,content:c$}))}),j$=q({path:FZ,from:KC.check(DC()).check(wC(1)),to:KC.check(DC()).check(wC(1)),at:oC([`head`,`worktree`])}),M$=q({environmentId:K.check(bC()),worktreeId:RJ,at:oC([`head`,`worktree`]),path:FZ,from:XS.check(DC()).check(wC(0)),to:XS.check(DC()).check(wC(0)),lines:J(K)}),N$=AZ,P$=J(kZ),F$=N$.pipe(pC(P$,Fy({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),I$=q({limit:W(KC.check(DC()).check(wC(1)).check(TC(100))),after:W(F$),tip:W(kZ)}),L$=aC([q({kind:G(`attached`),ref:K}),q({kind:G(`detached`)}),q({kind:G(`unborn`),ref:K})]),R$=aC([q({kind:oC([`local-branch`,`remote-branch`,`tag`]),name:K}),q({kind:G(`head`),name:G(`HEAD`)})]),z$=q({oid:kZ,parentOids:J(kZ),author:q({name:K,timestamp:K}),subject:K,subjectTruncated:ZS,body:zJ(K),bodyTruncated:ZS,refs:J(R$)}),B$=q({snapshot:zJ(q({tipOid:zJ(kZ),head:L$})),commits:J(z$).check(jC(100)),nextAfter:zJ(J(kZ).check(jC(100))),tip:zJ(kZ),boundary:zJ(oC([`shallow`,`wide`])),restarted:ZS}),V$=q({tip:kZ,offset:OC.check(wC(1)).check(TC(2**53-1-100-1))}),H$=q({path:FZ,after:W(WC(V$)),limit:W(KC.check(DC()).check(wC(1)).check(TC(100)))}),U$=q({commits:J(q({commit:z$,path:K,previousPath:zJ(K),status:oC([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(jC(100)),nextAfter:zJ(V$),tip:zJ(kZ),boundary:zJ(G(`shallow`)),restarted:ZS}),W$=aC([q({kind:G(`parent`),parentNumber:XS.check(DC()).check(CC(0)),baseOid:kZ}),q({kind:G(`empty-tree`)})]),G$=q({oldPath:zJ(K),newPath:zJ(K),status:oC([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:K,newMode:K}),K$=q({worktreeId:RJ,oid:kZ}),q$=q({parent:W(KC.check(DC()).check(wC(1)).check(TC(OJ)))}),J$=q({commit:z$,comparison:W$,files:J(G$).check(jC(kJ))}),Y$=q({worktreeId:RJ,oid:kZ}),X$=q({parent:W(XS.check(DC()).check(wC(1)).check(TC(OJ))),paths:J(J(K).check(kC(1)).check(jC(2))).check(kC(1)).check(jC(200))}),Z$=q({commitOid:kZ,diffs:J(q({paths:J(K),content:c$}))}),Q$=class extends UY.add(YJ(`changes`).add(KN(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:BJ,success:T$,error:[pZ,...lX,...SX]}),KN(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:BJ,success:h$,error:[...lX,...SX]}),KN(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:BJ,query:I$.fields,success:B$,error:[...lX,...SX]}),KN(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:BJ,query:H$.fields,success:U$,error:[...lX,...SX]}),KN(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:BJ,query:d$.fields,success:f$,error:[...lX,...SX,$($Q,`NotFound`),$(i$,`Conflict`),$(a$,`Conflict`)]}),qN(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:BJ,payload:p$,success:m$,error:[...lX,...SX,$(e$,`NotFound`),$(t$,`UnprocessableEntity`)]}),qN(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:BJ,payload:k$,success:A$,error:[pZ,...lX,...SX,$(n$,`BadRequest`,{message:`Invalid request`}),$(r$,`BadRequest`,{message:`Invalid request`}),$(t$,`UnprocessableEntity`)]}),KN(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:BJ,query:j$.fields,success:M$,error:[pZ,...QQ,$(WY,`BadRequest`,{message:`Invalid request`})]}),KN(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:BJ,success:O$,error:[pZ,...lX,...SX]}),qN(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:Y$,payload:X$,success:Z$,error:[...lX,...SX,$(e$,`NotFound`)]}),KN(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:K$,query:q$.fields,success:J$,error:[...lX,...SX,$(e$,`NotFound`)]}),KN(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:BJ,success:w$,error:[pZ,...lX,...SX]})).middleware(CY)){};function $$(e){return new TextEncoder().encode(e).byteLength}var e1=aC([G(``),FZ]),t1=K.check(_C(e=>e.length<=1048576&&!e.includes(`\0`)&&$$(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),n1=q({path:e1}),r1=jS(q({worktreeId:RJ,path:K,entries:J(q({name:K,kind:oC([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:W(ZS),target:W(K)}))})),i1=jS(q({worktreeId:RJ,paths:J(K).check(jC(MJ))})),a1=q({path:FZ}),o1=jS(q({worktreeId:RJ,path:K,encoding:G(`utf-8`),byteLength:OC.check(wC(0)),text:K,contentFingerprint:W(s$)})),s1=aC([q({kind:G(`write`),path:FZ,text:t1,expectedFingerprint:s$}),q({kind:G(`create`),path:FZ,entryKind:oC([`file`,`directory`])}),q({kind:G(`move`),path:FZ,destination:FZ}),q({kind:G(`trash`),path:FZ}),q({kind:G(`copy`),path:FZ,destination:FZ})]),c1=jS(q({path:K,contentFingerprint:W(s$)})),l1=q({path:FZ}),u1=jS(q({path:K,mediaType:K,base64:K})),d1=q({document:FZ,paths:J(K.check(jC(DJ))).check(kC(1),jC(64))}),f1=jS(q({assets:J(aC([q({kind:G(`asset`),path:K,mediaType:K,base64:K}),q({kind:G(`unavailable`),path:K})]))})),p1=class extends UY.add(YJ(`files`).add(KN(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:BJ,query:n1.fields,success:r1,error:[...ZQ,UQ,WQ]}),KN(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:BJ,success:i1,error:[...lX,WQ]}),KN(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:BJ,query:a1.fields,success:o1,error:[...ZQ,JQ,YQ]}),KN(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:BJ,query:l1.fields,success:u1,error:[...ZQ,qQ,YQ]}),qN(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:BJ,payload:d1,success:f1,error:lX}),qN(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:BJ,payload:s1,success:c1,error:[...ZQ,JQ,VQ,GQ,KQ,YQ,XQ,RQ]})).middleware(CY)){},m1=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},h1=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},g1=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},_1=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},v1=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},y1=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},b1=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},x1=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},S1=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},C1=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},w1=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},T1=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},E1=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},D1=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},O1=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},k1=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},A1=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},j1=class extends Y()(`WorktreeCleanupRefusedError`,{message:K}){},M1=J(q({id:K,label:K})),N1=q({mode:oC([`message`,`groups`]),model:K.check(kC(1)).check(jC(160)),expectedStatusToken:s$,paths:J(FZ).check(kC(1)).check(jC(TJ))}),P1=q({groups:J(q({message:K.check(kC(1)).check(jC(wJ)),paths:J(FZ).check(kC(1)).check(jC(TJ))})).check(kC(1)).check(jC(20)),expectedFiles:J(q({path:FZ,fingerprint:s$})).check(jC(TJ))}),F1=K.check(kC(1)).check(jC(wJ)).check(_C(e=>e.trim().length>0&&!e.includes(`\0`)&&$$(e)<=16384)),I1=K.check(jC(jJ)).check(yC(/^refs\/heads\/[\s\S]/u)).check(_C(e=>!e.includes(`\0`))),L1=K.check(yC(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),R1=q({path:FZ,fingerprint:s$}),z1=q({worktreeId:RJ,requestId:K.check(bC())}),B1=aC([q({action:G(`switch`),targetRef:I1}),q({action:G(`fetch`),remoteName:L1,sourceRef:I1}),q({action:G(`pull`),remoteName:L1,sourceRef:I1,strategy:W(oC([`ff-only`,`merge`,`rebase`]))}),q({action:G(`push`),remoteName:L1,destinationRef:I1,allowCreate:ZS}),q({action:G(`commit`),message:F1,paths:J(FZ).check(jC(TJ))}),q({action:G(`amend`),message:F1,paths:J(FZ).check(jC(TJ))}),q({action:G(`stash-create`),message:F1,includeUntracked:ZS}),q({action:oC([`stash-apply`,`stash-pop`]),stashOid:kZ,restoreIndex:ZS.pipe(Lre(B(!1)))}),q({action:G(`discard`),path:FZ,hunk:W(q({scope:oC([`staged`,`unstaged`]),startLine:XS.check(DC()).check(CC(0)),endLine:XS.check(DC()).check(CC(0))}))})]),V1=q({headOid:zJ(kZ),branch:zJ(K),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(kZ),upstreamOid:W(sC(kZ)),files:W(J(R1).check(jC(TJ)))}),H1=q({requestId:K.check(bC()),input:B1,expected:V1}),U1=MZ,W1=aC([MZ,PJ]),G1=z1,K1=MZ,q1=z1,J1=q({dismissed:G(!0)}),Y1=$(T1,`Conflict`,{message:`Git action request does not match its receipt`}),X1=$(w1,`NotFound`),Z1=[$(E1,`BadRequest`,{message:`Invalid request`}),$(x1,`BadRequest`,{message:`Invalid request`}),$(D1,`BadRequest`,{message:`Invalid request`}),$(S1,`BadRequest`,{message:`Invalid request`}),$(C1,`BadRequest`,{message:`Invalid request`}),$(b1,`BadRequest`,{message:`Invalid request`}),$(O1,`BadRequest`,{message:`Invalid request`}),$(k1,`BadRequest`,{message:`Invalid request`})],Q1=[$(m1,`UnprocessableEntity`),$(h1,`UnprocessableEntity`),$(g1,`UnprocessableEntity`),$(_1,`UnprocessableEntity`),$(v1,`UnprocessableEntity`),$(y1,`UnprocessableEntity`),$(A1,`UnprocessableEntity`)],$1=class extends UY.add(YJ(`gitActions`).add(XN(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:q1,success:J1,error:[...lX,X1,Y1]}),qN(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:BJ,payload:N1,success:P1,error:[...lX,...SX,...Q1]}),KN(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:M1}),KN(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:G1,success:K1,error:[...lX,X1]}),qN(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:BJ,payload:H1,success:[U1,U1.pipe(aN(202)),W1.pipe(aN(409)),W1.pipe(aN(503))],error:[...lX,Y1,...Z1]})).middleware(CY)){};q({address:K,dataDirectory:K,pid:OC}),q({path:US(K),fingerprint:US(aC([K,YS]))});var e0=q({deleteWorktree:ZS,deleteLocalBranch:ZS,deleteRemoteBranch:ZS}),t0=q({worktreePath:W(K),detachWorktreePath:W(K),localBranch:W(K),remoteBranch:W(K),remoteBranchNote:W(K),mainCheckout:ZS,dirty:ZS,unpushed:ZS,fingerprint:K}),n0=q({options:e0,confirmation:W(q({plan:t0,discardChanges:ZS}))}),r0=n0,i0=q({deleted:ZS,plan:t0}),a0=K.check(_C(e=>PZ(e,DJ),{expected:`a normalized relative path`})),o0=jS(q({preferences:J(q({path:a0,pinned:ZS,hidden:ZS}))})),s0=q({path:a0,flag:oC([`pinned`,`hidden`]),value:ZS}),c0=o0,l0=oC([`moved`,`missing`,`permission`,`git-failed`]),u0=n0,d0=q({archived:ZS,plan:t0}),f0=K.check(kC(1),jC(DJ),_C(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),p0={id:LJ,name:K,worktrees:J(q({id:RJ,path:K,main:ZS,branch:zJ(K),headCommittedAt:HS(IJ),walkthroughTitle:HS(K),pullRequestTitle:HS(K),available:ZS})),walkthroughSettings:HS(NY)},m0=aC([q({...p0,available:G(!0),unavailableReason:HS(KS)}),q({...p0,available:G(!1),unavailableReason:HS(l0)})]),h0=q({projectId:LJ}),g0=h0,_0=h0,v0=h0,y0=jS(q({environmentId:LJ,environment:vZ,projects:J(m0)})),b0=q({path:f0}),x0=jS(m0),S0=q({deleted:ZS}),C0=q({path:HS(f0)}),w0=jS(q({path:K,parent:zJ(K),directories:J(q({name:K,path:K})),repository:ZS,truncated:ZS})),T0=jS(q({name:K.pipe(pC(K.check(kC(1),jC(100),_C(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),Fy({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:HY}),E0=q({id:LJ,name:K}),D0=$(ZY,`NotFound`),O0=class extends UY.add(YJ(`projects`).add(qN(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:BJ,payload:r0,success:i0,error:[...lX,$(j1,`Conflict`,{message:{fromError:!0}})]}),KN(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:C0.fields,success:w0,error:[$(YY,`NotFound`),$(XY,`UnprocessableEntity`),$(QY,`UnprocessableEntity`)]}),KN(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:y0,error:pZ}),qN(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:y0,error:pZ}),KN(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:_0,success:o0,error:D0}),qN(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:b0,success:x0,error:[D0,$(qY,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),XN(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:g0,success:S0,error:D0}),JN(`saveWalkthroughSettings`,`/api/projects/:projectId/walkthrough-settings`,{disableCodecs:!0,params:h0,payload:NY,success:NY,error:D0}),YN(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:h0,payload:T0,success:E0,error:D0}),JN(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:v0,payload:s0,success:c0,error:[D0,$(JY,`Conflict`,{message:`File preference limit reached`})]})).middleware(CY)){};Y()(`GitHubPullRequestNotFoundError`,{});var k0=oC([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),A0=q({kind:G(`unavailable`),reason:k0}),j0=q({account:K,source:oC([`detected`,`overridden`])}),M0=q({repository:W(K),accounts:J(K),choice:W(j0),override:W(K),unavailable:W(A0)}),N0=sC(q({login:K,avatarUrl:W(K)})),P0=q({hasNextPage:ZS}),F0=aC([q({__typename:G(`CheckRun`),name:K,status:K,conclusion:sC(K),detailsUrl:sC(K),startedAt:W(sC(K)),completedAt:W(sC(K))}),q({__typename:G(`StatusContext`),context:K,state:K,targetUrl:sC(K)})]),I0=q({number:OC,title:K,url:K,state:oC([`OPEN`,`CLOSED`,`MERGED`]),isDraft:ZS,author:N0,headRefName:K,baseRefName:K,updatedAt:K,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:K}))})}))})}),L0=q({id:K,author:N0,createdAt:K,body:K,url:K});q({...I0.fields,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:K,contexts:q({nodes:J(F0),pageInfo:P0})}))})}))}),body:K,bodyHTML:W(K),createdAt:W(K),baseRefName:K,headRefOid:K,headRepository:W(sC(q({url:K}))),mergeable:K,labels:q({nodes:J(q({name:K,color:K})),pageInfo:P0}),comments:q({nodes:J(L0),pageInfo:P0}),reviews:q({nodes:J(q({id:K,author:N0,submittedAt:sC(K),createdAt:W(K),body:K,url:K,state:K,comments:q({nodes:J(q({...L0.fields,path:K,diffHunk:W(K),line:sC(OC),originalLine:sC(OC)})),pageInfo:P0})})),pageInfo:P0})});var R0=q({name:K,status:K,conclusion:W(K),detailsUrl:W(K),durationMs:W(OC)}),z0=q({number:OC,title:K,url:K,state:oC([`open`,`closed`,`merged`]),draft:ZS,author:W(K),headBranch:K,baseBranch:K,updatedAt:K,checksSummary:W(K),checksTruncated:ZS}),B0=q({id:K,kind:oC([`comment`,`review`,`review-comment`]),author:W(K),time:K,body:K,url:K,reviewState:W(K),authorAvatarUrl:W(K),reviewId:W(K),diffHunk:W(K),path:W(K),line:W(OC),originalLine:W(OC)}),V0=q({...z0.fields,description:K,createdAt:W(K),authorAvatarUrl:W(K),baseBranch:K,headSha:K,headRepository:W(K),mergeable:K,labels:J(q({name:K,color:K})),checks:J(R0),timeline:J(B0),truncated:ZS});q({number:OC,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:oC([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var H0=oC([`passed`,`running`,`failed`,`none`]);Y()(`GitHubReadError`,{reason:k0});var U0=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},W0=q({path:FZ,fingerprint:s$,reviewedAt:IJ}),G0=oC([`worktree`,`branch`]),K0={scope:G(`branch`),base:o$},q0=q({scope:W(G0),branch:W(o$)}),J0=q({worktreeId:RJ,marks:J(W0).check(jC(AJ))}),Y0={path:FZ,reviewed:G(!0),fingerprint:s$},X0=aC([q({...Y0,scope:W(G(`worktree`))}),q({...Y0,...K0})]),Z0=J0,Q0={files:J(q({path:FZ,fingerprint:s$})).check(kC(1)).check(jC(EJ))},$0=aC([q({...Q0,scope:W(G(`worktree`))}),q({...Q0,...K0})]),e2=q({...J0.fields,marked:J(FZ).check(jC(EJ)),conflicts:J(q({path:FZ,reason:oC([`stale`,`missing`])})).check(jC(EJ))}),t2=q({path:FZ,scope:W(G0),branch:W(o$)}),n2=J0,r2=q({paths:J(FZ).check(kC(1)).check(jC(EJ)),scope:W(G0),branch:W(o$)}),i2=J0,a2=class extends UY.add(YJ(`reviewedFiles`).add(KN(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,query:q0.fields,success:J0,error:[...lX]}),JN(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,payload:X0,success:Z0,error:[...lX,...SX,$(U0,`Conflict`),$($Q,`NotFound`),$(i$,`Conflict`),$(a$,`Conflict`)]}),JN(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:BJ,payload:$0,success:e2,error:[...lX,...SX,$(U0,`Conflict`),$($Q,`NotFound`),$(i$,`Conflict`),$(a$,`Conflict`)]}),XN(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,query:t2.fields,success:n2,error:lX}),XN(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:BJ,payload:r2,success:i2,error:lX})).middleware(CY)){},o2=aC([q({kind:G(`available`),account:K,pullRequest:V0}),A0]),s2=aC([q({kind:G(`available`),account:K,pullRequests:J(z0),truncated:ZS,recentlyClosedSince:K}),A0]),c2=q({account:zJ(K.check(yC(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});q({override:HS(c2)});var l2=aC([q({kind:G(`available`),number:OC,checks:H0}),A0]),u2=q({projectId:K}),d2=q({projectId:K,number:KC.check(DC(),CC(0))}),f2=class extends UY.add(YJ(`pullRequests`).add(KN(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:u2,success:s2,error:[$(ZY,`NotFound`)]}),KN(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:u2,success:M0,error:[$(ZY,`NotFound`)]}),JN(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:u2,payload:c2,success:M0,error:[$(ZY,`NotFound`)]}),KN(`readProjectPullRequest`,`/api/projects/:projectId/pull-requests/:number`,{disableCodecs:!0,params:d2,success:o2,error:[$(ZY,`NotFound`)]}),KN(`readProjectPullChecks`,`/api/projects/:projectId/pull-requests/:number/checks`,{disableCodecs:!0,params:d2,success:l2,error:[$(ZY,`NotFound`)]}),qN(`archivePullRequest`,`/api/projects/:projectId/pull-requests/:number/archive`,{disableCodecs:!0,params:d2,payload:u0,success:d0,error:[$(ZY,`NotFound`),$(eX,`Conflict`,{message:{fromError:!0}})]})).middleware(CY)){},p2=class extends UY.addHttpApi(HX).addHttpApi(wQ).addHttpApi(O0).addHttpApi(p1).addHttpApi(Q$).addHttpApi(a2).addHttpApi(f2).addHttpApi($1){},m2=q({address:K,credential:cw(K),deviceId:W(K)}),h2=q({...m2.fields,environmentId:K,name:K,alternateRoutes:W(J(m2)),operationIdentity:W(K)});function g2({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function _2(e){return[g2(e),...(e.alternateRoutes??[]).map(g2)]}function v2(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function y2(e,t){let[n,...r]=t;if(!n)throw Error(`A saved environment needs at least one connection.`);return{environmentId:e.environmentId,name:e.name,...g2(n),...v2(e)?{operationIdentity:v2(e)}:{},...r.length?{alternateRoutes:r.map(g2)}:{}}}function b2(e){let t=URL.parse(e)?.hostname??``;return t.endsWith(`.ts.net`)?`Tailscale`:/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t)?`LAN`:`Network`}function x2(e){return JSON.stringify(zS(J(h2))(e))}function S2(e,t){if(t===void 0)return{kind:`checking`};if(t.kind===`reconnecting`)return{kind:`reconnecting`};if(t.kind===`foreign`)return{kind:`other-server`};if(t.kind===`unauthorized`)return{kind:`needs-pairing`};if(t.kind===`unreachable`)return{kind:`offline`};let{environment:n}=t;return n.environmentId===e.environmentId?n.protocol===3?{kind:`online`,name:n.name,version:n.version}:{kind:`incompatible`}:{kind:`other-server`}}function C2(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function w2(e){if(!e||typeof e!=`object`)return;let t=C2(e,`address`),n=C2(e,`credential`),r=C2(e,`deviceId`);return t&&n?{address:t,credential:C_(n),...r?{deviceId:r}:{}}:void 0}function T2(e){if(!e||typeof e!=`object`)return[];let t=C2(e,`environmentId`),n=C2(e,`name`),r=w2(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...C2(e,`operationIdentity`)?{operationIdentity:C2(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=w2(e);return t?[t]:[]})}:{}}]:[]}function E2(e){return Array.isArray(e)?e.flatMap(T2):[]}function D2(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=_2(t),i=_2(n).map(e=>r.find(t=>t.address===e.address)??e);return i.push(...r.filter(e=>!i.some(t=>t.address===e.address))),[...e.filter(e=>e.environmentId!==t.environmentId),y2({...n,name:t.name},i)]}var O2=E_((e,t)=>e===t);function k2(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&O2(e.credential,t.credential)&&e.deviceId===t.deviceId&&(e.alternateRoutes??[]).length===(t.alternateRoutes??[]).length&&(e.alternateRoutes??[]).every((e,n)=>{let r=t.alternateRoutes?.[n];return r!==void 0&&e.address===r.address&&e.deviceId===r.deviceId&&O2(e.credential,r.credential)})}function A2(e){switch(e.kind){case`checking`:return`Checking`;case`reconnecting`:return`Reconnecting`;case`online`:return`Online`;case`offline`:return`Offline`;case`needs-pairing`:return`Needs pairing`;case`other-server`:return`Another server`;case`incompatible`:return`Update needed`}}function j2(e){switch(e.kind){case`offline`:return`It did not answer. Check that it runs and that this device reaches its address.`;case`needs-pairing`:return`It no longer accepts this app. Run porcelain pair on it and add the new link.`;case`other-server`:return`Another Porcelain answers at this address now, so this app stays away from it.`;case`incompatible`:return`It runs a Porcelain this app cannot talk to. Update both to the same version.`;default:return}}var M2=class e extends dr()(`@porcelain/client/AccessStore`){static layer=kd(e,H(function*(){let e=yield*gJ,t=yield*SJ({initial:{remotes:[],missingCredentials:[]},read:e.read,write:e.write,messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}});return{state:t.state,load:t.load,save:Um(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=_2(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return B({remotes:D2(t.remotes,i),missingCredentials:t.missingCredentials.flatMap(t=>{if(t.environmentId!==e.environmentId)return[t];let n=t.routes.filter(e=>!r.some(t=>t.address===e.address));return n.length?[{...t,routes:n}]:[]})})})),route:Um(`AccessStore.route`)(e=>t.write(({remotes:t,missingCredentials:n})=>H(function*(){let r=t.find(t=>t.environmentId===e.environmentId);if(!r)return yield*U(new xJ({message:`That environment is no longer saved.`}));let i=_2(r),a=i.find(t=>t.address===e.address);if(!a)return yield*U(new xJ({message:`That connection is no longer saved.`}));let o=i.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!o.length)return yield*U(new xJ({message:`Forget the environment to remove its last connection.`}));let s=y2(r,e.kind===`prefer`?[a,...o]:o);return{missingCredentials:n,remotes:t.map(t=>t.environmentId===e.environmentId?s:t)}}))),forget:Um(`AccessStore.forget`)(e=>t.write(t=>B({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},N2=class extends dr()(`@porcelain/client/ConnectionFactory`){},P2=class extends dr()(`@porcelain/client/RemoteConnectionFactory`){},F2=class e extends dr()(`@porcelain/client/AccessSession`){static layer=kd(e,H(function*(){let e=yield*N2,t=yield*ed,n,r=CP({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Um(`AccessSession.beginConnection`)((i=!1)=>V(()=>{if(i&&r.value.generation!==0)return null;let a=r.value.generation;return Um(`AccessSession.completeConnection`)(function*(i){if(a!==r.value.generation)return!1;let o=JSON.stringify(i.principal),s=r.value.connection?.environmentId===i.inventory.environmentId&&r.value.writerIdentity===o,c=n,l=r.value.connection;if(s||(c=yield*od(t,`sequential`),l=yield*e.local(i).pipe(am(ed,c))),a!==r.value.generation)return!s&&c&&(yield*cd(c,Iu)),!1;let u=n;return n=c,r.update(e=>({...e,connection:l,writerIdentity:o,generation:a+1})),u&&u!==n&&(yield*cd(u,Iu)),!0},bm)})),clear:Um(`AccessSession.clear`)(function*(){let e=n;n=void 0,r.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*cd(e,Iu))},bm)}}))},I2=class e extends dr()(`@porcelain/client/RemoteConnections`){static layer=kd(e,H(function*(){let e=yield*P2,t=yield*ed,n=yield*eE(1),r=[],i=CP([]);return{state:i,synchronize:Um(`RemoteConnections.synchronize`)(a=>H(function*(){let n=yield*sp(a,n=>H(function*(){let i=r.find(e=>k2(e.remote,n));if(i)return{...i,remote:n};let a=yield*od(t,`sequential`);return{remote:n,connection:yield*e.open(n).pipe(am(ed,a)),scope:a}})),o=r.filter(e=>!n.some(t=>t.scope===e.scope));r=n,i.set(n.map(({remote:e,connection:t})=>({remote:e,connection:t}))),yield*sp(o,e=>cd(e.scope,Iu),{discard:!0})}).pipe(tE(n),bm))}}))},L2=Md(H(function*(){let e=yield*M2,t=yield*I2;yield*t.synchronize(e.state.value.remotes),yield*yD(Um(`RemoteConnections.subscribe`)(function*(t){yield*lm(V(()=>e.state.subscribe(({remotes:e})=>{kT(t,e)})),e=>V(e))})).pipe(rO(t.synchronize),Om({startImmediately:!0}))}));function R2(e,t,n){return(r,i)=>{let a=new URL(r,e),o=new Headers(i?.headers);return t&&a.pathname!==`/api/health`&&o.set(`authorization`,`Bearer ${T_(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var z2=class extends Y()(`RequestError`,{status:XS,message:K,code:PJ.fields.code}){};function B2(e){return kd(cM,Op(cM,e=>e.pipe(mM(Vj(`http://porcelain.invalid`)),lM(am(_M,!1))))).pipe(Ld(zd(oX).pipe(Ld(Fd(wd(tX,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),wd(rX,{redirect:`error`,cache:`no-store`}))))))}function V2(e){let t=e.response;return t===void 0?B(new xJ({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Op(Hp(t.json,()=>void 0),e=>{let n=PS(PJ)(e);return new z2({status:t.status,message:qr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function H2(e){return Mp(e,e=>sj(e)?Cp(V2(e),U):U(e))}function U2(e,t){return t(H2(e))}var W2=class extends dr()(`@porcelain/client/PairingPlatform`){},G2=class extends UY.add(YJ(`live`).add(KN(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:zZ.fields,success:BZ.pipe(oN({decode:()=>void 0}),aN(`SwitchingProtocols`))})).middleware(CY)){};function K2(e){let t;try{t=new URL(e.trim())}catch{return}return t.protocol===`http:`||t.protocol===`https:`?t.origin:void 0}function q2(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=J2(t.hash);if(!n)return;if(t.pathname===`/pair`)return{address:t.origin,...n};if(!$J(t.pathname))return;let[r=``]=(new URLSearchParams(t.hash.replace(/^#/,``)).get(`a`)??``).split(`,`),i=K2(r);return i===void 0?void 0:{address:i,...n}}function J2(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var cse=3e3,lse=8e3,use=1e4,Y2=1e4,dse=1e4,fse=1e3,pse=1e3,mse=1e3,hse=3e4,X2=2500,gse=5e3,Z2=6e4,Q2=X(e=>CP(void 0)),_se=X(e=>Mk()),vse=sP(p2),$2=class e extends dr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>Ld(kd(e,vse),B2(t)))},yse=X(e=>Nk($2.layer(e)));function bse(e,t){return Nw(t)?{kind:`offline`}:S2(e,er(Bw(t)))}function e4(e,t){return H(function*(){let e=yield*$2,n=yield*H2(e.publicAccess.readEnvironment()).pipe(Np(`ConnectionError`,t=>H2(e.session.readSession()).pipe(Tp(U(t)))));return n.environmentId===t&&n.protocol===3&&(yield*H2(e.session.readSession())),{kind:`described`,environment:n}}).pipe(tm($2.layer(e)),Mp(e=>B(e instanceof z2&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),Wp(gse),Op(e=>Zn(e,()=>({kind:`unreachable`}))))}function t4(e,t){Q2(e.send).set({remote:t,revision:Symbol()})}var n4=Um(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=R2(e.address,e.credential,n);return yield*H(function*(){return(yield*H2((yield*$2).publicAccess.readHealth())).environmentId===t?yield*e4(r,t):{kind:`foreign`}}).pipe(tm($2.layer(r)),Mp(()=>B({kind:`unreachable`})))}),xse=Um(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of _2(t)){let i=yield*n4(r,t.environmentId,e.send).pipe(Wp(X2),Op(e=>Zn(e,()=>({kind:`unreachable`}))));if(S2(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),Sse=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return _se(e)(Ed).atom(()=>{let i=!1,a=!1,o=!1,s,c=yD(e=>H(function*(){let s=t=>{t&&(o=t===`suspend`);let n=!o&&(r?.isActive()??!0),s=n&&!a;a=n,n&&!s&&i||kT(e,n)};yield*lm(V(()=>{let e=r?.subscribe(s),i=Q2(n).subscribe(()=>{let e=Q2(n).value;e&&k2(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>V(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=H(function*(){i=!0;let n=yield*xse(e,t);return s=n,n}).pipe(fm(V(()=>{i=!1})));return c.pipe(LD(e=>e?CD(()=>s?.kind===`unreachable`?BD(SD({kind:`reconnecting`}),hD(l)):hD(l)).pipe(zD(Zf(hse))):MD))}).pipe(pk(0))});function Cse(e,t){return Sse({platform:e,remote:t})}var wse=X(({platform:e,remote:t,connection:n})=>bk(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=bse(t,r(Cse(e,t)));return i?.value===`connected`?a.kind===`online`?a:{kind:`online`,name:t.name}:i?.value===`unauthorized`?{kind:`needs-pairing`}:a.kind===`other-server`||a.kind===`incompatible`?a:i?.value===`reconnecting`?{kind:`reconnecting`}:i?.value===`connecting`?a.kind===`offline`?a:{kind:`checking`}:a}));function r4(e,t,n){return wse({platform:e,remote:t,connection:n})}function i4(e){return e instanceof z2?!0:e instanceof xJ?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function Tse(e,t,n){return H(function*(){let r=q2(t);if(!r)return yield*U(new xJ({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new xJ({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=R2(r.address,void 0,e.send);if((yield*H2(H(function*(){return yield*(yield*$2).publicAccess.readHealth()}).pipe(tm($2.layer(i))))).environmentId!==r.environmentId)return yield*U(new xJ({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*H2(H(function*(){return yield*(yield*$2).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(tm($2.layer(i)))).pipe(Fp(e=>i4(e)?new xJ({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof xJ?new xJ({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*U(new xJ({message:`The remote paired but sent no credential.`}));let o=C_(a.credential),s=S2(r,yield*e4(R2(r.address,o,e.send),r.environmentId));return s.kind===`online`?{environmentId:r.environmentId,address:r.address,name:s.name,credential:o,deviceId:a.device.id}:yield*U(new xJ({message:s.kind===`other-server`?`Another Porcelain answered at that address than the one that made the link.`:s.kind===`incompatible`?`That Porcelain runs a version this app cannot talk to. Update both to the same version.`:`The remote paired but did not answer afterwards. Try again.`}))})}var Ese=Um(`Environments.pairAndSave`)(function*(e,t){let n=yield*M2,r=yield*_J;if(n.state.value.status!==`ready`)return yield*U(new xJ({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===q2(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===q2(e)?.address))return yield*U(new xJ({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*Tse(r,e,t);return yield*n.save(a),a}),Dse=Um(`BrowserSession.pair`)(function*(e){let t=yield*W2,n=yield*$2;if((yield*H2(n.publicAccess.readHealth()).pipe(Fp(e=>!(e instanceof xJ)&&!(e instanceof z2)&&e._tag!==`MissingEnvironmentIdentityError`?new xJ({message:`That address answered, but it is not a Porcelain server.`}):new xJ({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*U(new xJ({message:`This link was made for a different Porcelain installation.`}));let r=yield*H2(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe(Fp(e=>i4(e)?new xJ({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*H2(n.projects.readInventory()).pipe(Fp(e=>e instanceof z2?new xJ({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),Ose=X(({transport:e,platform:t})=>Nk(Fd($2.layer(e),wd(W2,t))).fn(e=>Dse(e))),a4=X(e=>{class t extends dr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(kd(t,Op(sP(p2),t=>({request:(n,r)=>U2(n(t),t=>e.request(t,r))}))).pipe(Ld(B2(e.transport))))}return t}),o4=Um(`Client.requestApi`)(function*(e,t){return yield*(yield*a4(e)).request(t)}),s4=X(e=>e.atoms(t=>Fd(t(a4(e).runtime.layer),jd(e.runtime.contextEffect)))),c4=class e extends dr()(`@porcelain/client/AccessSnapshots`){static layer=kd(e,H(function*(){return{sharing:yield*ej(Kn()),remote:yield*ej(Kn()),update:yield*ej(Kn())}}))},l4=X(e=>e.atoms(t=>Rd(c4.layer,t(s4(e).layer))));function kse(){return new xJ({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function u4(e,t=!0){return fp(()=>e.isClosed()?_m:d4(t))}function d4(e=!0){return e?pp:U(kse())}function Ase(e){return e instanceof GY}var f4=[`lan`,`tailnet`,`cloudflare`],p4={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},jse={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},m4={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function Mse(e){return`This device is connected through ${p4[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var Nse=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,Pse=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,Fse=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function Ise(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||Pse.test(n)||Fse.test(n)}function Lse(e){return e.route!==`loopback`||e.canEditWaysIn}function Rse(e,t=[]){return Ise(e,t)?`Use the computer running Porcelain to manage ways in, or pair over the local network or an existing encrypted route.`:`Turn on Manage sharing for this device in Computers → Devices, from a computer with sharing access.`}function h4(e){return`${e.subnet} on ${e.interfaceName}`}function g4(e){let{lan:t}=e.routes,n=e.localNetwork,r=e.lanNetwork,i=`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known.`;return t.enabled?t.status.kind===`paused`?n?n.gatewayHardware?r?h4(r)===h4(n)?`Paused on this network. It looks like ${h4(r)}, but its router is another one, so this is another network; turn it on for this network to listen here.`:`Paused on this network. It was turned on for ${h4(r)}, and listens again there, or here once you turn it on for this network.`:`Paused on this network. It was turned on before Porcelain kept the network it was turned on for; turn it on for this network to listen here.`:`Paused. ${i}`:r?`Paused: this computer is not on a local network. Porcelain listens again when it is back on ${h4(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${h4(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${h4(n)} only, and pauses on any other network.`:`${i} Try again in a moment.`:`This computer is not on a local network right now.`}function zse(e){return e?f4.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function Bse(e){return e===void 0?[]:f4.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function Vse(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,address:t.link.addresses[0],link:eY(t.link),expiresAt:t.grant.expiresAt}:null}function Hse(e){return`tailscale serve --bg --https=443 ${e}`}var Use={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function Wse(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return Use[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var Gse={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function _4(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function Kse(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function qse(e,t,n){let r=_4(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function Jse(e,t,n){let r=_4(e,t),i=n??r,a=i.trim();return{...Gse[t],value:i,canSave:a!==``&&a!==r,save:qse(e,t,a),failed:Kse(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function Yse(e,t){let n=`Your devices may reach that program instead of Porcelain: run tailscale serve --https=443 off now, then turn Tailscale off and on here to pick a free port and run the new command Porcelain names.`;switch(t){case`address-in-use`:return e===`tailnet`?`Another program already listens on the port Tailscale forwards to. ${n}`:`Another program already listens on this port.`;case`address-unavailable`:return e===`tailnet`?`Porcelain could not open the local listener Tailscale forwards to. ${n}`:`This computer could not listen at its address.`;case`unreachable`:return e===`tailnet`?`Nothing answered at this Tailscale name yet. Check that you ran the command below, that Tailscale is connected on this computer and uses MagicDNS, and that MagicDNS and HTTPS Certificates are on in the Tailscale admin console. Porcelain keeps checking.`:`Nothing answered at this hostname. Check that cloudflared is running and routes it here.`;case`other-server`:return e===`tailnet`?`Another server answered at this Tailscale name. Run the command below so Tailscale forwards to this Porcelain; Porcelain keeps checking.`:`Another server answered at this hostname.`}}function v4(e){return jw(e)?e.value:void 0}function Xse(e,t,n){return H(function*(){let r=yield*Dp(n.pipe(Ep(()=>u4(e))));if(Ru(r)&&Eu(r.cause))return yield*_m;if(Lu(r))yield*nj(t,qn(r.value));else{let e=er(Tu(r.cause));e instanceof z2&&e.status===401&&(yield*nj(t,Kn()))}return Ew(r,ir(yield*tj(t),Mw))})}function y4(e,t,n,r){let i=e.atom(e=>{let i=ar(e.self(),Bw);return ND(Op(r,e=>BD(xD(Dw(i)),hD(t).pipe(zD(Zf(n)),YD(t=>!e(er(Bw(t))))))))}).pipe(Zk(e=>Ww(e,e=>e)));return nA(i).pipe(Yk((e,t)=>{let n=e(t);return e(i).waiting?Dw(qn(n)):n}),pk(0))}function b4(e,t,n){return Cp(c4,r=>Xse(e,t(r),n))}function x4(e){return e.pipe(Mp(e=>e instanceof z2&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?B(null):U(e)))}var S4=X(e=>y4(l4(e),b4(e,e=>e.sharing,x4(o4(e,e=>e.administration.listAccess()))),mse,B(()=>!0))),C4=X(e=>y4(l4(e),b4(e,e=>e.remote,x4(o4(e,e=>e.remoteAccess.readRemoteAccess()))),fse,B(zse))),w4=X(e=>y4(l4(e),b4(e,e=>e.update,o4(e,e=>e.serviceUpdates.readServiceUpdate())),pse,H(function*(){let e=er(yield*tj((yield*c4).update)),t=e?.running?e.last?.target:void 0;return e=>e?.managed===!0?e.running?(t=e.last?.target,!0):t!==void 0&&e.last?.stage===`updated`&&e.last.target===t&&e.version===e.last.from&&e.version!==t:!1})));function Zse(e){return H(function*(){let t=yield*a4(e),n=yield*bJ,r=yield*c4,i=yield*UO;function a(t,r){return n.run([t],H(function*(){yield*u4(e);let t=yield*r;return yield*u4(e),t}))}function o(t){return V(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return um(V(()=>{let t=i.mount(e),n=Ck(Mw(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Ep(n=>H(function*(){yield*nj(t,qn(n)),i.set(e,Mw(Mw(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>V(()=>{i.set(e,Lu(n)?Mw(Mw(n.value)):Pw(n.cause)),t()}))}return{issue:n=>a(`paired-access`,t.request(e=>e.administration.issuePairing({payload:{labels:[n.label],addresses:n.addresses,...n.trusted?{trusted:!0}:{},canManageSharing:n.canManageSharing===!0}})).pipe(Ep(()=>o(S4(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(fm(o(S4(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(fm(o(S4(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(fm(o(S4(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(fm(o(S4(e))))),setRemote:n=>a(`remote-access`,s(C4(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Ep(()=>u4(e)),Lp(()=>o(C4(e)))))),startUpdate:n=>a(`service-update`,s(w4(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Ep(()=>u4(e)),Lp(()=>o(w4(e))))))}})}var T4=class e extends dr()(`@porcelain/client/AccessCommands`){static layer(t){return kd(e,Zse(t))}},E4=X(e=>e.atoms(t=>Rd(T4.layer(e),t(l4(e).layer)))),Qse=X(e=>E4(e).fn(e=>T4.use(t=>t.issue(e)).pipe(Op(Vse)),{concurrent:!0})),$se=X(({connection:e,id:t})=>E4(e).fn(()=>T4.use(e=>e.revoke(t)),{concurrent:!0})),ece=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),tce=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),nce=X(e=>E4(e).fn(e=>T4.use(t=>t.setRemote(e)),{concurrent:!0})),rce=X(e=>E4(e).fn(e=>T4.use(t=>t.startUpdate(e)),{concurrent:!0})),ice=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),D4={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>D4.withIdentity(D4.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[D4.environment(e.environmentId),D4.review(e.environmentId,t),D4.reviewSurface(e.environmentId,t,n.slice(0,1)),D4.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>D4.withIdentity(D4.inventory(e.environmentId),e),projectPullRequests:(e,t)=>[`project-pull-requests`,e,...t?[t]:[]],environment:e=>[`environment`,e],reviewGitSettings:e=>[`review-git-settings`,e],filePreferences:(e,t)=>[`review`,e,t,`file-preferences`],inventory:e=>[`inventory`,e],worktreeInventory:e=>[`worktree-inventory`,e],reviewProject:(e,t)=>[`review`,e,t],review:(e,t)=>[...D4.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[...D4.review(e,t),...n]},O4=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),k4=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function A4(e,t,n,r=Kn(),i=[t,D4.environment(e.environmentId)]){return H(function*(){let a=yield*bJ,o=yield*uO,s=yield*MO({epoch:0,result:Xn(r,{onNone:()=>Aw(),onSome:e=>Mw(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*PO(s)).epoch;yield*RO(s,e=>({...e,result:Lw(e.result)}));let i=yield*Dp(t.pipe(Ep(()=>u4(e))));yield*RO(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:Ew(i,qn(e.result))}:e)});function l(n,r){return a.run(D4.withIdentity(t,e),H(function*(){yield*u4(e),yield*RO(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*u4(e),yield*RO(s,e=>({epoch:e.epoch+1,result:Xn(r(Bw(e.result),t),{onNone:()=>e.result,onSome:e=>Mw(e)})})),t}).pipe(fm(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*RO(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:UD(NO(s).pipe(PD(e=>e.result)),o.stream(i,c()).pipe(RD))}})}var j4=Br(`@porcelain/client/InventorySeed`,{defaultValue:()=>Kn()}),M4=class e extends dr()(`@porcelain/client/InventoryState`){static layer(t){return kd(e,H(function*(){let e=yield*j4,n=yield*a4(t),r=e=>u4(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*A4(t,D4.inventory(t.environmentId),i.pipe(Ep(r)),e,[D4.inventory(t.environmentId),D4.environment(t.environmentId),D4.worktreeInventory(t.environmentId)]);function o(e,t){return a.confirm(e,(e,n)=>ir(e,e=>t(e,n)))}return{stream:a.stream,confirm:o,refresh:()=>a.refresh(n.request(e=>e.projects.refreshInventory()).pipe(Np(`RequestError`,e=>e.status===404?i:U(e)),Ep(r)))}}))}},N4=X(e=>e.atoms(t=>Rd(M4.layer(e),t(s4(e).layer))));function P4(e){return X(t=>N4(t).fn(n=>H(function*(){let r=yield*a4(t);return yield*(yield*M4).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var ace=P4((e,t)=>e.renameEnvironment({payload:{name:t}})),oce=P4((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),sce=Um(`BrowserSession.restore`)(function*(){let e=yield*$2;return{principal:yield*H2(e.session.readSession()),inventory:yield*H2(e.projects.readInventory())}},Mp(e=>e instanceof z2&&e.status===401?B(null):U(e instanceof z2||DS(e)?new xJ({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),cce=X(e=>yse(e).atom(sce())),F4=`Save or discard unsaved file drafts before disconnecting.`;function I4(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`RequestError`||`_tag`in e)?e.message:`Could not connect to the environment. Try again.`}var L4=class extends dr()(`@porcelain/client/FileDraftWriter`){},lce=Br(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:qi(cse),diskNotice:qi(lse)})}),R4=class e extends dr()(`@porcelain/client/FileDraft`){static layer(t,n){return kd(e,H(function*(){let e=yield*L4,r=yield*lce,i=CP({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=CP(!1),o=CP(null),s=yield*uJ(void 0),c=yield*eE(1),l=yield*ej(void 0),u=yield*uJ(new Map),d=CP(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof TQ,m=H(function*(){let e=yield*rj(l,void 0);e&&(yield*Jw(e))}),h=e=>{i.value.owner===e&&f({owner:null})},g=e=>{let t=new Set(i.value.diskChanged);t.delete(e),f({diskChanged:t})},_=Um(`FileDraft.forgetDiskChange`)(function*(e){let t=yield*fJ(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*Jw(t)),g(e)}),v=Um(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*pJ(s,t=>t?B([Kw(t),t]):a.value||p()?B([B(!1),void 0]):i.value.text===i.value.savedText?B([B(!0),void 0]):(f({saving:!0,error:null}),Op(Dm(H(function*(){for(;i.value.text!==i.value.savedText;){let t=i.value.text,n=yield*e.write(t,i.value.fingerprint);o.set(n),f({savedText:t,fingerprint:n})}return!0}).pipe(Pp(e=>V(()=>(f({error:wu(e)}),!1))),fm(xp.pipe(Tp(mJ(s,void 0)),Tp(V(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[Kw(e),e])))});return yield*ad(n,V(()=>{a.set(!0),d.set(new Map)})),{state:i,get blocked(){return p()},claim(e){return a.value||i.value.owner!==null&&i.value.owner!==e?!1:(f({owner:e}),!0)},release:h,attachEditor:e=>{a.value||d.update(t=>new Map(t).set(e,Symbol(e)))},finishEditing:Um(`FileDraft.finishEditing`)(function*(e,t,n=()=>{}){let r=d.value.get(e);r&&(yield*xp,a.value||d.value.get(e)!==r||(d.update(t=>{let n=new Map(t);return n.delete(e),n}),n(),h(e),(i.value.saving||!i.value.error)&&(yield*v()),i.value.text!==i.value.savedText&&t()))}),noticeDiskChange:Um(`FileDraft.noticeDiskChange`)(function*(e,t){yield*pJ(u,s=>{if(a.value||i.value.saving||i.value.owner!==null||s.has(e)||o.value===t)return B([void 0,s]);f({diskChanged:new Set([...i.value.diskChanged,e])});let c;return Op(Dm(qp(r.diskNotice).pipe(Tp(hJ(u,t=>{if(t.get(e)!==c)return t;let n=new Map(t);return n.delete(e),g(e),n}))),n,{startImmediately:!0}),t=>(c=t,[void 0,new Map(s).set(e,t)]))})}),forgetDiskChange:_,change:Um(`FileDraft.change`)(function*(e){a.value||i.value.text===e||(f({text:e}),yield*c.withPermit(H(function*(){if(yield*m,a.value)return;let e=yield*Dm(qp(r.autosave).pipe(Tp(nj(l,void 0)),Tp(v()),jp),n,{startImmediately:!0});yield*nj(l,e)})))}),reset:Um(`FileDraft.reset`)(function*(e,t){yield*c.withPermit(H(function*(){a.value||i.value.saving||(yield*m,f({text:e,savedText:e,fingerprint:t,error:null}))}))}),refresh:Um(`FileDraft.refresh`)(function*(e,t){yield*c.withPermit(V(()=>{let n=i.value;a.value||!t||n.saving||n.text!==n.savedText||n.fingerprint===t||f({text:e,savedText:e,fingerprint:t,error:null})}))}),save:v,dispose:()=>fp(()=>(a.set(!0),cd(n,Iu)))}}))}},z4=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,B4=class e extends dr()(`@porcelain/client/FileDrafts`){static layer=kd(e,H(function*(){let e=yield*om,t=CP(new Map),n=CP(new Map),r=e=>t.value.get(e)??new Map,i=(e,n)=>t.update(t=>{let r=new Map(t);return n.size?r.set(e,n):r.delete(e),r});return{entries:e=>new Map([...r(e.environmentId)].map(([e,t])=>[e,t.draft])),retain:Um(`FileDrafts.retain`)(function*(t){let n=z4(t.scope,t.path),a=r(t.environmentId).get(n);if(a)return yield*a.draft.refresh(t.text,t.fingerprint),a.draft;let o=yield*od(e),s=CP(t.path),c=Nr(yield*Sd(R4.layer(t,o).pipe(Ld(wd(L4,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(am(ed,o)),R4);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*ad(o,V(()=>i(t.environmentId,new Map([...r(t.environmentId)].filter(([,e])=>e.scope!==o))))),c}),adopt:e=>{n.update(t=>new Map(t).set(e.environmentId,e))},connection:e=>n.value.get(e.environmentId)??e,hasUnsaved:e=>e.some(e=>[...r(e).values()].some(({draft:e})=>e.state.value.saving||e.state.value.text!==e.state.value.savedText)),hasUnsavedWorktree:(e,t)=>[...r(e)].some(([e,{draft:n}])=>e.startsWith(z4(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save:Um(`FileDrafts.save`)(function*(e){for(let{draft:t}of r(e).values())if(!(yield*t.save()))return!1;return!0}),drop:Um(`FileDrafts.drop`)(function*(e){let t=[...r(e).values()];i(e,new Map),n.update(t=>{let n=new Map(t);return n.delete(e),n}),yield*sp(t,e=>cd(e.scope,Iu),{concurrency:`unbounded`,discard:!0})}),relocate:Um(`FileDrafts.relocate`)(function*(e,t,n,a){let o=r(e),s=new Map(o),c=[],l=z4(a,n.path);for(let e of t){let t=o.get(e);if(t){if(s.delete(e),n.kind===`move`){let r=`${n.destination}${e.slice(l.length)}`;t.path.set(r),s.set(z4(a,r),t)}else c.push(t)}}i(e,s),yield*sp(c,e=>cd(e.scope,Iu),{concurrency:`unbounded`,discard:!0})})}}))},V4=X(e=>e.atoms(B4.layer)),uce=X(e=>V4(e).atom(B4)),dce=X(e=>e.atoms(t=>Fd(t(a4(e).runtime.layer),B4.layer)).fn(Um(`BrowserSession.disconnect`)(function*(){let t=yield*B4,n=yield*a4(e);if(!(yield*t.save(e.environmentId)))return yield*U(new xJ({message:F4}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},Fp(e=>e instanceof xJ?e:new xJ({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),fce=Um(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*F2,a=yield*i.beginConnection(),o=yield*um(V(()=>e.set(t,n)),()=>GO(e,t,{suspendOnWaiting:!0}),()=>V(()=>e.set(t,Vk))).pipe(Gp({duration:r,orElse:()=>_m}),Pp(e=>U(new xJ({message:I4(wu(e)),cause:wu(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new xJ({message:`Could not connect to the environment. Try again.`}))}),pce=Um(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*F2;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);Nw(i)&&!i.waiting&&e.refresh(t);let a=yield*GO(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),H4=class e extends dr()(`@porcelain/client/EnvironmentMutations`){static layer=kd(e,H(function*(){let e=yield*eE(1),t=CP(0);return{pendingSelections:t,run:(n,r)=>um(V(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>V(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},U4=class extends dr()(`@porcelain/client/WorkspaceSelectionCleanup`){},mce=H(function*(){let e=yield*M2,t=yield*_J,n=yield*H4,r=yield*B4,i=yield*U4;return{read:Um(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Um(`Environments.pair`)(r=>n.run(`access`,H(function*(){return r.localEnvironmentId&&q2(r.value)?.environmentId===r.localEnvironmentId?yield*U(new xJ({message:`That link is for this computer.`})):yield*Ese(r.value,r.environmentId).pipe(am(M2,e),am(_J,t))}))),route:Um(`Environments.route`)(t=>n.run(`access`,H(function*(){if(!(yield*r.save(t.environmentId)))return yield*U(new xJ({message:F4}));yield*e.route(t)}))),forget:Um(`Environments.forget`)(t=>n.run(`selection`,H(function*(){if(!(yield*r.save(t)))return yield*U(new xJ({message:F4}));yield*H(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(bm)})))}}),W4=class e extends dr()(`@porcelain/client/EnvironmentCommands`){static layer=kd(e,mce)};function G4(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function hce(e,t){return t.running||e.some(G4)}function K4(e){if(e.kind===`mac-app`)return G4(e)?e.latest:void 0;let{state:t}=e;return G4(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function gce(e){if(e.state.managed&&!e.state.canUpdate)return{label:`Needs trust`,deviceId:e.deviceId,hint:e.deviceId?`Run porcelain trust ${e.deviceId} on that computer, or allow it in the Mac app → Computers → This computer → Devices`:`Find this device’s id with porcelain devices on that computer, then run porcelain trust <id>, or allow it in the Mac app → Computers → This computer → Devices`}}function _ce(e){let t=new Set;for(let n of e)K4(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function vce(e){let t=e.entries.findIndex(e=>e.status===`updating`);return{total:e.entries.length,current:t<0?void 0:t+1,label:t<0?void 0:`Updating ${t+1} of ${e.entries.length}`}}var q4=Ck({running:!1,entries:[]}).pipe(Jk),J4=class extends Y()(`SettingsUpdateError`,{message:K}){},yce=Um(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=rce(e.connection),i=n.mount(r);yield*dm(()=>V(i)),n.set(r,t),yield*GO(n,r,{suspendOnWaiting:!0});let a=yield*WO(n,w4(e.connection)).pipe(PD(e=>{if(Nw(e)){let t=wu(e.cause);return t instanceof z2&&(t.status===401||t.status===403)?qn({status:`failed`,message:`Could not confirm the update: access to this computer was denied (${t.status}). Pair or trust this device again.`}):Kn()}if(!jw(e))return Kn();let n=e.value;return n.managed?n.running?Kn():n.version===t?qn({status:`updated`}):n.last?.target===t&&n.last.stage===`failed`?qn({status:`failed`,message:n.last.reason??`The updater gave no reason.`}):Kn():qn({status:`failed`,message:`This computer no longer runs the managed service.`})}),KD(Yn),PD(e=>e.value),nO);if(Jn(a))return yield*new J4({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new J4({message:a.value.message})}),bce=Hk((e,t)=>H(function*(){let n=t.registry;if(n.get(q4).running)return;let r=[],i=new Set;for(let t of e){let e=K4(t),n=`${t.kind}:${t.id}`;e===void 0||i.has(n)||(i.add(n),r.push({target:t,version:e}))}if(r.sort((e,t)=>Number(e.target.kind===`mac-app`)-Number(t.target.kind===`mac-app`)),r.length===0)return;let a=r.map(({target:e,version:t})=>({id:e.id,name:e.name,kind:e.kind,version:t,status:`queued`})),o=e=>n.set(q4,{running:e,entries:a});o(!0),yield*H(function*(){for(let[e,{target:t,version:i}]of r.entries()){a=a.map((t,n)=>n===e?{...t,status:`updating`}:t),o(!0);let r=yield*Dp(yce(t,i,n).pipe(sm)),s=Ru(r)?wu(r.cause):void 0;a=a.map((t,n)=>n===e?Lu(r)?{...t,status:`updated`}:{...t,status:`failed`,message:s instanceof Error?s.message:`The update failed.`}:t),o(!0)}}).pipe(fm(V(()=>{a=a.map(e=>e.status===`queued`||e.status===`updating`?{...e,status:`failed`,message:`The update was interrupted.`}:e),o(!1)})))}),{concurrent:!0}).pipe(Jk),Y4=cP(G2).live.liveUpdates,xce=cP(CQ).pairing.redeemPairing,X4=new Set;function Sce(e){return X4.add(e),()=>X4.delete(e)}function Z4(){for(let e of[...X4])e()}function Q4(e,t={}){return async(n,r)=>{let i=new Headers(r?.headers);i.delete(`authorization`),i.set(`x-porcelain-browser`,`1`);let a=await e(n,{...r,headers:i,credentials:`same-origin`});return a.status===401&&n!==xce()&&t.reportUnauthorized!==!1&&Z4(),a}}var $4=X(e=>N4(e).atom(ND(Op(M4,e=>e.stream))).pipe(Zk(e=>Ww(e,e=>e)),pk(0)));X(e=>bk(t=>e.map(e=>({connection:e,result:t($4(e))}))));var Cce=class extends dr()(`@porcelain/client/ProjectSelectionStorage`){},e3=class e extends dr()(`@porcelain/client/ProjectSelectionStore`){static layer=kd(e,H(function*(){let e=yield*Cce,t=yield*SJ({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:Um(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>B({currentEnvironmentId:e,selections:t}))),selectWorkspace:Um(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>B({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Um(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>B({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))},t3={projects:void 0,environments:void 0};function n3(e,t,n){return(n.projects===void 0||n.projects.includes(e))&&(n.environments===void 0||n.environments.includes(t))}function wce(e,t){return Number(t.main)-Number(e.main)||Number(t.headCommittedAt!==void 0)-Number(e.headCommittedAt!==void 0)||(t.headCommittedAt??``).localeCompare(e.headCommittedAt??``)||e.name.localeCompare(t.name)||e.key.localeCompare(t.key)}function r3(e){return e.state===`loading`?`Reading changes…`:e.state===`unavailable`?`Changes unavailable`:e.count===0?`Working tree clean`:`${e.count} ${e.count===1?`file`:`files`} changed`}function Tce(e){return e.state===`unavailable`?`—`:e.state===`available`&&e.count===0?``:r3(e)}function Ece(e){return e?e.state===`available`?{passed:`Checks passed`,running:`Checks running`,failed:`Checks failed`,none:`No checks`}[e.result]:e.state===`loading`?`Checks loading`:`Checks unavailable`:`Checks loading`}function Dce(e,t){return!t||e.environmentId!==t.environmentId?!1:e.worktreeId===t.worktreeId}function Oce(e,t){let n=[e.name,e.displayTitle??``,e.branch,e.path,e.projectName,e.environmentName,e.pullRequest.state===`available`?e.pullRequest.number:void 0].filter(e=>e!==void 0).join(` `).toLocaleLowerCase();return t.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function kce(e,t){return[{key:`environments`,label:`Environments`,options:[...new Map(e.map(e=>[e.environmentId,{id:e.environmentId,label:e.environmentName,icon:e.environmentIcon}])).values()]},{key:`projects`,label:`Projects`,options:e.map(e=>({id:e.key,label:`${e.name} · ${e.environmentName}`}))}].map(({key:e,label:n,options:r})=>{let i=t[e]??r.map(e=>e.id);return{key:e,label:n,items:r.map(e=>({...e,checked:i.includes(e.id),next:i.includes(e.id)?i.filter(t=>t!==e.id):[...i,e.id]}))}})}function Ace(e,t){let n=new Map(e.map(e=>[e.environmentId,{...e,failures:e.failures.filter(({entry:e})=>!t.recoveredKeys.includes(e.key)&&(!t.environments.includes(e.environmentId)||t.inventoryKeys.includes(e.key)))}]));for(let e of t.issues){let t=n.get(e.environmentId),r=new Map((t?.failures??[]).map(e=>[e.entry.key,e]));for(let t of e.failures)r.set(t.entry.key,t);n.set(e.environmentId,{...e,dismissed:t?.dismissed??!1,failures:[...r.values()]})}let r=[...n.values()].filter(e=>e.failures.length>0);return JSON.stringify(r)===JSON.stringify(e)?e:r}var i3=Ck({query:``,filter:t3,expanded:{}}).pipe(Jk),a3=Ck([]).pipe(Jk);function jce(e){return H(function*(){let t=yield*a4(e),n=yield*M4,r=yield*B4;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),saveDefaultWriter:e=>n.confirm(t.request(t=>t.walkthroughs.saveDefaultWalkthroughWriter({payload:e})),e=>e),saveWalkthroughSettings:e=>n.confirm(t.request(t=>t.projects.saveWalkthroughSettings({params:{projectId:e.projectId},payload:{mode:e.mode,writer:e.writer}})),(t,n)=>({...t,projects:t.projects.map(t=>t.id===e.projectId?{...t,walkthroughSettings:n}:t)})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(H(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*U(new xJ({message:`Save or discard unsaved file drafts before removing this project.`}));return yield*t.request(e=>e.projects.removeProject({params:{projectId:i}}))}),e=>({...e,projects:e.projects.filter(e=>e.id!==i)}))}})}var o3=class extends dr()(`@porcelain/client/ProjectCommands`){},s3=X(e=>e.atoms(t=>Rd(kd(o3,jce(e)),Fd(t(N4(e).layer),B4.layer)))),Mce=X(e=>s3(e).fn(e=>o3.use(t=>t.register(e)),{concurrent:!0})),Nce=X(e=>s3(e).fn(e=>o3.use(t=>t.rename(e)),{concurrent:!0})),Pce=X(e=>s3(e).fn(e=>o3.use(t=>t.remove(e)),{concurrent:!0})),c3=X(e=>N4(e).fn(e=>M4.use(e=>e.refresh()),{concurrent:!0})),Fce=X(e=>xk(t=>e.map(e=>t(c3(e))),(t,n)=>{for(let n of e)t.set(c3(n),void 0)})),Ice=X(e=>s3(e).fn(e=>o3.use(t=>t.saveWalkthroughSettings(e)),{concurrent:!0})),Lce=X(e=>s3(e).fn(e=>o3.use(t=>t.saveDefaultWriter(e)))),l3=class e extends dr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return kd(e,H(function*(){let e=yield*a4(t);return yield*A4(t,D4.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},u3=X(({connection:e,projectId:t})=>e.atoms(n=>Rd(l3.layer(e,t),n(s4(e).layer)))),Rce=X(({connection:e,projectId:t})=>u3({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*a4(e);return yield*(yield*l3).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>qn(t))}),{concurrent:!0})),d3=class e extends dr()(`@porcelain/client/ReadSubscriptions`){static layer=kd(e,H(function*(){let e=yield*MO(r_());return{snapshot:PO(e),changes:NO(e),retain:Um(`ReadSubscriptions.retain`)(function*(t){yield*lm(H(function*(){let n=Symbol();return yield*RO(e,i_(n,t)),n}),t=>RO(e,o_(t)))})}}))};function f3(e,t,n,r,i,a=[]){let o=m3(e,t,n,i.atom(i=>H(function*(){yield*(yield*d3).retain({...t,paths:a,surface:String(n[0]),settled:GO(i.registry,o,{suspendOnWaiting:!0}).pipe(Bp,jp)});let s=yield*r;return yield*u4(e),s})));return o}function p3(e){let t=Ck(Aw()).pipe(Jk),n=e.pipe(qk(t));return Yk(n,r=>{let i=r(e);return jw(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(pk(0))}function zce(e,t,n,r,i){let a=m3(e,t,n,i.pull(e=>ND(H(function*(){return yield*(yield*d3).retain({...t,paths:[],surface:String(n[0]),settled:GO(e.registry,a,{suspendOnWaiting:!0}).pipe(Bp,jp)}),typeof r==`function`?r(e):r}))));return a}function m3(e,t,n,r){return r.pipe(e.atoms.withReactivity(D4.worktreeReads(e,t,n)),pk(0))}function Bce(e,t,n,r){let i=r.atom(r=>ND(H(function*(){return yield*(yield*d3).retain({...e,paths:[],surface:t,settled:GO(r.registry,i,{suspendOnWaiting:!0}).pipe(Bp,jp)}),(yield*n).stream}))).pipe(Zk(e=>Ww(e,e=>e)),pk(0));return i}function h3(e,t,n,r=()=>!0,i=[]){return f3(e.connection,e.scope,t,o4(e.connection,n).pipe(Ep(t=>u4(e.connection,r(t)))),s4(e.connection),i)}var Vce=X(e=>u3(e).atom(ND(Op(l3,e=>e.stream))).pipe(Zk(e=>Ww(e,e=>e)),pk(0),p3)),Hce=X(({connection:e,path:t})=>s4(e).atom(H(function*(){return yield*(yield*a4(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function Uce(e,t){return Hce({connection:e,path:t})}q({currentEnvironmentId:W(LJ),selections:eC(K,q({projectId:LJ,worktreeId:RJ})).check(PC(LJ))});var Wce=H(function*(){let e=yield*M2,t=yield*e3,n=yield*H4;return{pending:n.pendingSelections,execute:Um(`WorkspaceSelection.execute`)(r=>n.run(`selection`,H(function*(){if(r.kind===`read`){if(yield*t.load(),e.state.value.status!==`ready`||t.state.value.status!==`ready`)return;let n=new Set(e.state.value.remotes.map(e=>e.environmentId)),r=new Set(Object.keys(t.state.value.selections));t.state.value.currentEnvironmentId&&r.add(t.state.value.currentEnvironmentId);for(let e of r)n.has(e)||(yield*t.forgetEnvironment(e))}else{if(e.state.value.status!==`ready`||!e.state.value.remotes.some(e=>e.environmentId===r.environmentId))return yield*U(new xJ({message:`That environment is no longer paired. Open the workspace picker again.`}));r.kind===`environment`?yield*t.selectEnvironment(r.environmentId):yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)}})))}});(class e extends dr()(`@porcelain/client/ProjectSelectionCommands`){static layer=kd(e,Wce)});var Gce=X(e=>Hk((t,n)=>H(function*(){let r=yield*n.setResult(Mce(e),t.path.trim()),i=r.worktrees.find(e=>e.available);t.complete(),i&&(yield*t.select({remote:t.remote,projectId:r.id,worktreeId:i.id}))})));kd(U4,Op(e3,e=>({forgetEnvironment:e.forgetEnvironment})));var g3=Um(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*o4(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*u4(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),Kce=X(e=>f3(e.connection,e.scope,[`changes`],g3(e),s4(e.connection)).pipe(p3)),_3=Um(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*o4(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*u4(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),v3=X(e=>f3(e.connection,e.scope,[`git-status`],_3(e),s4(e.connection)).pipe(p3));function y3(e,t,n=()=>!0){return s4(e.connection).atom(H(function*(){let r=yield*o4(e.connection,t);return yield*u4(e.connection,n(r)),r})).pipe(e.connection.atoms.withReactivity([D4.environment(e.connection.environmentId),D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId,e.projectId)]),pk(0))}var qce=X(e=>y3(e,t=>t.pullRequests.readProjectPullRequest({params:{projectId:e.projectId,number:e.number}}),t=>t.kind!==`available`||t.pullRequest.number===e.number)),b3=X(e=>y3(e,t=>t.pullRequests.readProjectPullChecks({params:{projectId:e.projectId,number:e.number}}),t=>t.kind!==`available`||t.number===e.number).pipe(p3)),x3=X(e=>y3(e,t=>t.pullRequests.listProjectPullRequests({params:{projectId:e.projectId}}))),Jce=X(e=>y3(e,t=>t.pullRequests.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe(p3));function S3(e){return e??`Detached HEAD`}function Yce(e,t){for(let n of e.projects){let e=n.worktrees.find(e=>e.id===t);if(e)return{worktree:e,projectId:n.id}}}function Xce(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function Zce(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function Qce(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}var $ce=hZ.literals,C3={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},w3=`desktop`;function T3(e){return e.icon??w3}function ele(e){return e===w3?null:e}function tle(e){let{project:t,connection:n,environmentName:r}=e;return t.worktrees.map(e=>{let i=e.walkthroughTitle||e.pullRequestTitle;return{key:`${n.environmentId}/${t.id}/${e.id}`,kind:`worktree`,environmentId:n.environmentId,environmentName:r,projectId:t.id,projectName:t.name,worktreeId:e.id,path:e.path,name:e.branch??e.path.split(`/`).filter(Boolean).at(-1)??e.path,displayTitle:i===e.branch?void 0:i,branch:S3(e.branch),main:e.main,...e.headCommittedAt?{headCommittedAt:e.headCommittedAt}:{},detached:!e.branch,available:t.available&&e.available,pullRequest:{state:`loading`},changes:{state:t.available&&e.available?`loading`:`unavailable`}}}).sort(wce)}var nle=X(e=>bk(t=>{let n=t($4(e.connection)),r=er(Bw(n)),i=r?.projects.find(t=>t.id===e.projectId);if(!r||!i)return{entries:[],messages:[]};let a=Nw(n)?{...i,available:!1}:i,o=tle({...e,project:a,environmentName:r.environment.name}),s=t(x3(e)),c=er(Bw(s)),l=er(t.self());for(let e of o)if(Nw(s)||c?.kind===`unavailable`){let t=l?.entries.find(t=>t.key===e.key&&t.branch===e.branch)?.pullRequest;e.pullRequest=t?.state===`available`?{state:`available`,number:t.number}:{state:`unavailable`}}else if(c?.kind===`available`){let t=c.pullRequests.find(t=>t.headBranch===e.branch);e.pullRequest=t?{state:`available`,number:t.number}:{state:`none`}}return{entries:o,messages:Nw(s)?[`Pull requests for ${a.name} could not be read.`]:[]}}).pipe(pk(0))),rle=X(e=>bk(t=>{let n=t(nle(e)),r=[];return{entries:n.entries.map(n=>{let i={...n};if(i.available&&i.worktreeId){let n=t(v3({connection:e.connection,scope:{projectId:i.projectId,worktreeId:i.worktreeId}})),a=er(Bw(n));Nw(n)&&r.push({entry:i,detail:er(Tu(n.cause))?.message}),i.changes=Nw(n)?{state:`unavailable`}:a?{state:`available`,count:new Set(a.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}return i}),messages:n.messages,statusFailures:r,loading:!1}}).pipe(pk(0)));function ile(e,t){let n=t.map(t=>{let n=e($4(t));return{connection:t,result:n,inventory:er(Bw(n))}});return{reads:n,loading:n.some(({result:e})=>Ow(e)),messages:n.flatMap(({result:e,inventory:t})=>Nw(e)?[`${t?.environment.name??`Computer`}: projects could not be read.`]:[])}}function ale(e){return bk(t=>{let n=t(i3),r=n.query,i=[],a=[],o=[],s=[],c=ile(t,e),l=[...c.messages],u=!1;for(let{connection:e,result:t,inventory:a}of c.reads){jw(t)&&o.push(e.environmentId);for(let o of a?.projects??[]){let s=Nw(t)?{...o,available:!1}:o,c=`${e.environmentId}/${s.id}`;i.push({key:c,connection:e,project:s,environmentName:a.environment.name,environmentIcon:T3(a.environment),expanded:r.trim().length>0||n.expanded[c]!==!1,entries:[]})}}i.sort((e,t)=>e.project.name.localeCompare(t.project.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key));let d=kce(i.map(e=>({key:e.key,name:e.project.name,environmentId:e.connection.environmentId,environmentName:e.environmentName,environmentIcon:e.environmentIcon})),n.filter),f=[];for(let e of i){if(!n3(e.key,e.connection.environmentId,n.filter))continue;if(!e.expanded){f.push(e);continue}let i=t(rle({connection:e.connection,projectId:e.project.id}));if(u||=i.loading,a.push(...i.entries),l.push(...i.messages),i.statusFailures.length>0){let t=s.find(t=>t.connection.environmentId===e.connection.environmentId);t?t.failures.push(...i.statusFailures):s.push({connection:e.connection,environmentName:e.environmentName,failures:[...i.statusFailures]})}let o=i.entries.filter(e=>Oce(e,r)).map(e=>({...e,pullRequest:{...e.pullRequest},changes:{...e.changes}}));for(let n of o)if(n.pullRequest.state===`available`){let r=t(b3({connection:e.connection,projectId:n.projectId,number:n.pullRequest.number})),i=er(Bw(r));n.pullRequest.checks={state:`loading`},Nw(r)||i&&(i.kind!==`available`||i.number!==n.pullRequest.number)?n.pullRequest.checks={state:`unavailable`}:i?.kind===`available`&&(n.pullRequest.checks={state:`available`,result:i.checks})}o.length===0&&r.trim()||f.push({...e,entries:o})}let p=t.once(a3),m=Ace(p,{issues:s.map(({connection:e,environmentName:t,failures:n})=>({environmentId:e.environmentId,environmentName:t,failures:n})),recoveredKeys:a.filter(e=>e.changes.state===`available`).map(e=>e.key),inventoryKeys:i.flatMap(e=>e.project.worktrees.map(t=>`${e.connection.environmentId}/${e.project.id}/${t.id}`)),environments:o});return m!==p&&t.set(a3,m),{projects:f,allProjects:i,statusIssues:t(a3),filters:d,loading:c.loading||u,messages:[...new Set(l)]}})}var ole=X(e=>ale(e)),E3=class extends dr()(`@porcelain/client/OperationStore`){},D3=class extends dr()(`@porcelain/client/OperationStorage`){},O3=WC(J(q({requestId:H1.fields.requestId,projectId:K.check(kC(1)),worktreeId:BJ.fields.worktreeId,request:H1}).check(_C(e=>e.requestId===e.request.requestId))));function k3(e){return e.state!==`running`}var A3=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),sle=kd(E3,H(function*(){let e=yield*D3,t=yield*eE(1),n=yield*MO(0),r=yield*e.read().pipe(Cp(e=>MS(O3)(e??`[]`)),lne),i=CP({operations:qr(r)?new Map(r.success.map(e=>[A3(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Kr(r)?new xJ({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=Um(`OperationStore.publish`)(function*(e){i.set(e),yield*RO(n,e=>e+1)});yield*dm(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=Um(`OperationStore.persist`)(function*(t){if(i.value.restorationError)return yield*U(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!k3(e.receipt)).map(({receipt:e,...t})=>t),r=yield*LS(O3)(n).pipe(Fp(e=>new xJ({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe(Fp(({cause:e})=>new xJ({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),s=e=>t.withPermit(H(function*(){return i.value.closed?yield*_m:yield*e().pipe(bm)}));return{state:i,set:Um(`OperationStore.set`)((e,t)=>s(()=>H(function*(){let n=new Map(i.value.operations);t?n.set(e,t):n.delete(e),yield*o(n)}))),accept:Um(`OperationStore.accept`)(e=>s(()=>H(function*(){let t=A3(e,e.action),n=i.value.operations.get(t);if(!n||n.requestId!==e.requestId||n.receipt&&k3(n.receipt))return!1;let r=new Map(i.value.operations);return r.set(t,{...n,receipt:e}),yield*o(r),!0}))),wait:Um(`OperationStore.wait`)(function*(e,t){return yield*Xn(yield*NO(n).pipe(FD(()=>H(function*(){let n=i.value.operations.get(e);return yield*d4(!i.value.closed&&n?.requestId===t),n?.receipt&&k3(n.receipt)?qn(n.receipt):Kn()})),KD(Yn),PD(e=>e.value),nO),{onSome:B,onNone:()=>d4(!1).pipe(Tp(gp))})})}})),cle=X(({connection:e,scope:t})=>e.operations.state.map(({operations:e})=>{let n=e.get(A3(t,`switch`));return{unresolved:!(!n||n.receipt&&k3(n.receipt))}}));function j3(e,t,n){e.set(a3,e(a3).flatMap(e=>{if(e.environmentId!==t)return[e];let r=n(e.failures);return r.length>0?[{...e,failures:r}]:[]}))}var lle=X(e=>Hk(Um(`WorktreeNavigator.refresh`)(function*(t,n){if(t){let r=e.find(e=>e.environmentId===t.environmentId),i=n(a3).find(e=>e.environmentId===t.environmentId);if(!r||!i)return;yield*n.setResult(c3(r),void 0);let a=yield*n.result($4(r),{suspendOnWaiting:!0}),o=i.failures.filter(({entry:e})=>a.projects.some(t=>t.id===e.projectId&&t.available&&t.worktrees.some(t=>t.id===e.worktreeId&&t.available))),s=o.map(({entry:e})=>e.key);j3(n,t.environmentId,e=>e.filter(({entry:e})=>s.includes(e.key))),yield*sp(o,e=>{let i=e.entry;if(!i.worktreeId)return pp;let a=v3({connection:r,scope:{projectId:i.projectId,worktreeId:i.worktreeId}});return n.refresh(a),n.result(a,{suspendOnWaiting:!0}).pipe(Xp({onSuccess:()=>j3(n,t.environmentId,e=>e.filter(e=>e.entry.key!==i.key)),onFailure:e=>j3(n,t.environmentId,t=>t.map(t=>t.entry.key===i.key?{...t,detail:e.message}:t))}))},{concurrency:`unbounded`});return}yield*sp(e,e=>n.setResult(c3(e),void 0),{concurrency:`unbounded`});let r=n(i3),i=e.flatMap(e=>(er(Bw(n($4(e))))?.projects??[]).map(t=>({connection:e,project:t,key:`${e.environmentId}/${t.id}`})));for(let e of i){if(!n3(e.key,e.connection.environmentId,r.filter))continue;let t=x3({connection:e.connection,projectId:e.project.id});if(!r.query.trim()&&r.expanded[e.key]===!1&&!n.registry.getNodes().has(t))continue;let i=er(Bw(n(t)));n.refresh(t);for(let t of i?.kind===`available`?i.pullRequests:[])n.refresh(b3({connection:e.connection,projectId:e.project.id,number:t.number}));for(let t of e.project.worktrees)e.project.available&&t.available&&n.refresh(v3({connection:e.connection,scope:{projectId:e.project.id,worktreeId:t.id}}))}}))),M3=[`walkthrough`,`walkthrough-conversations`],ule={files:[`walkthrough`],git:M3,reviewed:[`reviewed`]};function dle(e){return e.type===`walkthrough`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(e.change===`run`?[`walkthrough`,`walkthrough-conversations`]:[`walkthrough-conversations`])}:e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(ule[e.change])}:null}function fle(e){return e.action===`fetch`||e.action===`push`?null:{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(M3)}}var N3=[`branch`,`branch-bases`,`history`];function ple(e){if(e.type===`ready`||e.type===`subscribed`||e.type===`heartbeat`||e.type===`git-action`||e.type===`inventory`||e.type===`project`)return;let t=new Set(dle(e)?.surfaces);if(e.change===`files`)for(let e of O4)t.add(e);if(e.change===`git`)for(let e of[...k4,...N3])t.add(e);return{scope:e,surfaces:t}}function P3(e,t){let n=ple(t);return n?[...n.surfaces].map(t=>D4.reviewSurface(e,n.scope,[t])):[]}function mle(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[...k4,...O4],...N3,...fle(e)?.surfaces??[]])}function F3(e,t){let n=mle(t);return n?[...n].map(n=>D4.reviewSurface(e,t,[n])):[]}var hle=class extends Ta{},I3=class e extends dr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return kd(e,H(function*(){let e=yield*om,n=yield*uO,r=yield*d3,i=yield*Lq({capacity:1/0,timeToLive:Wi,lookup:a=>H(function*(){let o=new Set(F3(t.environmentId,a).map(e=>String(e[4]))),s=[...a_(yield*r.snapshot)].filter(e=>e.projectId===a.projectId&&e.worktreeId===a.worktreeId).filter(e=>o.has(e.surface)),c=yield*Dm(H(function*(){n.invalidateUnsafe([D4.worktreeInventory(t.environmentId),D4.projectPullRequests(t.environmentId,a.projectId),...F3(t.environmentId,a)]),yield*sp(s,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Dm(Gw(c).pipe(Tp(Gq(i,a))),e),c})});return{refresh:Um(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new hle({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*Bq(i,t);n.pollUnsafe()&&(yield*Gq(i,t)),yield*Kw(n)})}}))}},L3=X(e=>e.atoms(t=>Rd(I3.layer(e),t(s4(e).layer))));function R3(e,t){return H(function*(){let n=yield*(yield*a4(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*u4(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var z3=class extends Y()(`GitOperationStateError`,{reason:oC([`pending`,`missing`,`mismatch`,`receipt-unavailable`])}){get message(){switch(this.reason){case`pending`:return`Check the existing receipt before starting another operation.`;case`missing`:return`No operation to recover`;case`mismatch`:return`Action mismatch`;case`receipt-unavailable`:return`The operation receipt is unavailable. Inspect the current Git state in your terminal before taking another action. This operation was not submitted again.`}}},gle=Um(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*a4(e),i=yield*E3,a=yield*Uh,o=yield*I3,s=yield*eE(1),c=A3(t,n),l=Um(`GitActionController.accept`)(function*(t){yield*u4(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*u4(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=Um(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*u4(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*U(new z2({status:o.statusCode,message:o.message}))});return{execute:Um(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*u4(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!k3(o.receipt)))return yield*U(new z3({reason:`pending`}));if(r.input.action!==n)return yield*U(new z3({reason:`mismatch`}));let s={input:r.input,expected:r.expected,requestId:yield*a.uuidV4()};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),r.onRecorded?.(s),s}));return yield*u(o)}))}),recover:Um(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*u4(e);let t=i.state.value.operations.get(c);if(!t)return yield*U(new z3({reason:`missing`}));let r=yield*R3(e,t).pipe(Np(`GitActionNotFoundError`,()=>U(new z3({reason:`receipt-unavailable`}))),Fp(e=>e instanceof z2&&e.status===404?new z3({reason:`receipt-unavailable`}):e));return yield*u4(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Um(`GitActionController.startNew`)(function*(){return yield*s.withPermit(H(function*(){let e=i.state.value.operations.get(c)?.receipt;return!e||!k3(e)?!1:(yield*i.set(c,null),!0)}))})}}),B3=class e extends dr()(`@porcelain/client/GitActionController`){static layer(t){return kd(e,gle(t))}},V3=X(e=>e.connection.atoms(t=>Rd(B3.layer(e),Pd(t(L3(e.connection).layer),jd(e.connection.runtime.contextEffect))))),H3=X(e=>V3(e).fn(e=>B3.use(t=>t.execute(e)),{concurrent:!0})),U3=X(e=>V3(e).fn(e=>B3.use(e=>e.recover()),{concurrent:!0})),_le=X(e=>V3(e).fn(e=>B3.use(e=>e.startNew())));function vle(e,t){let n=H3(e),r=U3(e),i=_le(e),a=()=>{t.set(n,Bk),t.set(r,Bk)};return{run:Um(`GitActions.run`)(function*(e,r,i){return t.set(n,{input:e,expected:r,onRecorded:i}),yield*GO(t,n,{suspendOnWaiting:!0})}),recover:Um(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*GO(t,r,{suspendOnWaiting:!0})}),startNew:Um(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*GO(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var W3=X(e=>Ck(H(function*(){return vle(e,yield*UO)}))),G3=Um(`Projects.branchSwitchCommands`)(function*(e){return yield*GO(yield*UO,W3({...e,action:`switch`}),{suspendOnWaiting:!0})}),K3=X(e=>e.atoms(t=>Fd(t(s4(e).layer),B4.layer))),q3=Um(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*B4).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new xJ({message:`Save or discard unsaved file drafts before changing this worktree.`})}),yle=X(e=>K3(e.connection).fn(Um(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*q3(e));let n=yield*o4(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*u4(e.connection),n.deleted&&(yield*mO([D4.inventory(e.connection.environmentId),D4.worktreeInventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId)])),n}))),ble=X(e=>K3(e.connection).fn(Um(`Projects.switchWorktreeBranch`)(function*(t){yield*q3(e);let n=yield*G3(e),r=yield*_3(e);return yield*n.startNew(),yield*n.run({action:`switch`,targetRef:t},{headOid:r.headOid,branch:r.branch?.name,inProgress:r.inProgress,mergeHeadOid:r.mergeHeadOid})}))),xle=X(e=>K3(e.connection).fn(Um(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*q3(e),yield*(yield*G3(e)).recover()}))),Sle=X(e=>s4(e).atom(o4(e,e=>e.walkthroughs.readWalkthroughWriterSettings())).pipe(e.atoms.withReactivity([D4.inventory(e.environmentId)]),pk(0))),Cle=X(e=>s4(e.connection).fn(Um(`Reviews.setGitHubAccount`)(function*(t){let n=yield*o4(e.connection,n=>n.pullRequests.setProjectGitHubAccount({params:{projectId:e.projectId},payload:t}));return yield*mO([D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId)]),n}))),wle=X(e=>s4(e.connection).fn(Um(`Projects.archivePullRequest`)(function*(t){let n=yield*o4(e.connection,n=>n.pullRequests.archivePullRequest({params:{projectId:e.projectId,number:e.number},payload:t}));return yield*mO([D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId,e.projectId)]),n}))),Tle=1.5,Ele=29360128,Dle=1e4,Ole=8192,kle=80,Ale=64,jle=1e4,J3=15e3,Mle=2166136261,Nle=16777619;function Ple(e,t){if(!e.running)return null;let n=e.last?.target??e.latest??`the new version`;return t||e.last?.stage===`restarting`?`Restarting Porcelain on ${n}. This page reconnects when it is back.`:e.last?.stage===`installing`?`Installing ${n}…`:`Downloading ${n}…`}function Fle(e){let{last:t}=e;return e.running||t==null?null:t.stage===`updated`&&t.target===e.version?{kind:`updated`,from:t.from,target:t.target}:t.stage===`failed`?{kind:`failed`,target:t.target,reason:t.reason??`The updater gave no reason.`}:null}function Y3(e,t,n=`${t}s`){return e===1?t:n}function X3(e,t,n=`${t}s`){return`${e} ${Y3(e,t,n)}`}function Z3(e){if(!e.startsWith(`Mozilla/`))return e||`Unknown platform`;let t=/Edg(?:e|A|iOS)?\//.test(e)?`Edge`:/(?:Firefox|FxiOS)\//.test(e)?`Firefox`:/(?:Chrome|CriOS)\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:`Browser`,n=/iPad/.test(e)?`iPadOS`:/iPhone|iPod/.test(e)?`iOS`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Macintosh|Mac OS X/.test(e)?`macOS`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:void 0;return n?`${t} on ${n}`:t}function Ile(e){let t=Z3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var Lle=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function Rle(e,t){let n=f4.filter(t=>e.routes[t].status.kind===`on`).map(e=>p4[e]);return[n.length===0?`No way in on`:Lle.format(n),X3(t,`device`)].join(` · `)}function zle(e,t,n){let r=nd(),{timeoutMs:i,...a}=e,o=aJ(Pd(zd(bJ.layer),hO,zd(d3.layer),n),{memoMap:t}),s=Mk({memoMap:o.memoMap}),c=!1,l=Rm(gm(fp(()=>(c=!0,cd(r,Iu).pipe(fm(o.disposeEffect)))).pipe(bm))),u=()=>(c=!0,Pm(l));return{connection:Ie({runtime:o,atoms:s,scope:r,isClosed:()=>c||r.state._tag===`Closed`,close:u,...a,request:Um(`Connection.request`)(function*(e,t){if(c)return yield*_m;let n=yield*(t?um(Dm(e,t),Kw,Jw):e).pipe(Gp({duration:i,orElse:()=>_m}),Dm(r));return yield*Kw(n).pipe(fm(Jw(n)),Cp(e=>c?_m:B(e)))})}),close:u,closeEffect:l}}var Ble=X(e=>e.atoms(Ed).fn(t=>H(function*(){(yield*uO).invalidateUnsafe([D4.review(e.environmentId,t)])})));function Vle(e){return()=>void 0}function Hle(e){return()=>void 0}function Ule(e){}function Wle(){return()=>void 0}var Q3=class e extends dr()(`@porcelain/web/DesktopHost`){static layer=Dd(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Um(`Desktop.pickProject`)(function*(e){return yield*U(new xJ({message:`The native project picker is unavailable for this computer.`}))}),checkUpdate:H(function*(){return Kn()}),installUpdate:fp(()=>U(new xJ({message:`The native app updater is unavailable.`}))),updateStates:xD({status:`idle`})}))},Gle=X(e=>Ck(t=>{t.addFinalizer(Hle(e))})),$3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=Vle(e),n=()=>e();return window.addEventListener(`focus`,n),window.addEventListener(`online`,n),window.addEventListener(`offline`,n),document.addEventListener(`visibilitychange`,n),()=>{t(),window.removeEventListener(`focus`,n),window.removeEventListener(`online`,n),window.removeEventListener(`offline`,n),document.removeEventListener(`visibilitychange`,n)}}};function e6(e){return e.kind===`online`?`secondary`:e.kind===`checking`?`outline`:`destructive`}var Kle=gJ.of({read:()=>up({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:E2(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new Au(e)}),write:({remotes:e})=>up({try:async()=>{let t=x2(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new Au(e)})});function qle(e,t,n){let r=new Map;for(let t of[...e.state.value.operations.values()])t.receipt&&k3(t.receipt)||r.set(JSON.stringify([t.projectId,t.worktreeId]),{projectId:t.projectId,worktreeId:t.worktreeId,paths:new Set});for(let e of n){let t=JSON.stringify([e.projectId,e.worktreeId]),n=r.get(t)??{projectId:e.projectId,worktreeId:e.worktreeId,paths:new Set};for(let t of e.paths)t!==``&&n.paths.add(t);r.set(t,n)}return{projects:t?.projects.map(e=>e.id).slice(0,128)??[],worktrees:[...r.values()].slice(0,32).map(e=>({projectId:e.projectId,worktreeId:e.worktreeId,paths:[...e.paths].slice(0,64)}))}}var Jle=Um(`Live.connect`)(function*(e,t){let n=yield*UO,r=yield*d3,i=yield*E3,a=yield*I3,o=yield*uO,s=yield*lm(od(e.scope,`sequential`),e=>cd(e,Iu)),c=yield*nJ(yield*Xq().pipe(am(ed,s)))(),l=yield*$p(),u=Um(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*a.refresh(t.receipt);if(t.type===`ready`)return yield*o.invalidate([D4.environment(e.environmentId)]);t.type===`inventory`&&(yield*o.invalidate([D4.inventory(e.environmentId),D4.reviewGitSettings(e.environmentId)])),t.type===`worktree`&&(yield*o.invalidate([D4.worktreeInventory(e.environmentId),...t.change===`git`?[D4.projectPullRequests(e.environmentId,t.projectId)]:[]])),t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([D4.filePreferences(e.environmentId,t.projectId)])),yield*o.invalidate(P3(e.environmentId,t))}),d=()=>{for(let t of i.state.value.operations.values())t.receipt&&k3(t.receipt)||c(Symbol(),H(function*(){let n=yield*R3(e,{...t}).pipe(nm(l));yield*u4(e),yield*a.refresh(n),yield*i.accept(n)}).pipe(Bp,jp))},f=yield*e.liveUpdates.connect({onNotice:t=>{e.isClosed()||s.state._tag===`Closed`||(t.type===`inventory`&&e.onStatusChange?.(),t.type===`ready`&&d(),c(Symbol(),H(function*(){yield*u(t),t.type===`git-action`&&!e.isClosed()&&s.state._tag!==`Closed`&&(yield*i.accept(t.receipt))}).pipe(Pp(()=>V(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),jp)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&e.onStatusChange?.()},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([D4.inventory(e.environmentId)])))}}).pipe(am(ed,s)),p=``,m=H(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=qle(i,er(Bw(n.get($4(e)))),a_(yield*r.snapshot)),a=JSON.stringify(t);a!==p&&(p=a,f.subscribe(t))}),h=()=>{!e.isClosed()&&s.state._tag!==`Closed`&&c(`subscription`,Tp(xp,m),{onlyIfMissing:!0})};yield*lm(V(()=>n.subscribe($4(e),h)),e=>V(e)).pipe(am(ed,s)),yield*lm(V(()=>i.state.subscribe(h)),e=>V(()=>e?.())).pipe(am(ed,s)),c(Symbol(),rO(r.changes,()=>V(h))),h()}),Yle=X(e=>e.atoms(t=>Pd(t(N4(e).layer),t(L3(e).layer),jd(e.runtime.contextEffect)))),Xle=X(({connection:e,onUnauthorized:t})=>Yle(e).atom(Jle(e,t)).pipe(pk(0))),Zle=Ck(Mw(void 0)),Qle=()=>CP(`idle`);function $le(e){return e instanceof z2?e.status===401:e instanceof RP||PM(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function t6(e,t=Tr(),n){let r=Qle();return{state:r,connect:Um(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*ej({projects:[],worktrees:[]}),c=yield*Bd,l=yield*DT(1),u=!1,d=LT(l);if(n?.activity){let e=n.activity,t=e.isActive(),r=!1,i=c.monotonicTimeNanosUnsafe();yield*lm(V(()=>e.subscribe(n=>{n&&(r=n===`suspend`);let a=!r&&e.isActive(),o=c.monotonicTimeNanosUnsafe();!a&&t&&(i=o),u||=n===`resume`,a&&(u||=!t&&o-i>=BigInt(3e4)*1000000n,kT(l,void 0)),t=a})),e=>V(e))}let f=yield*DT(1),p=0,m=500,h=sm(H(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*Hu(),o=yield*Hu(),c=yield*Hu(),l=yield*loe({retryPolicy:Xte.pipe(Zte(),qte(({input:e})=>Gu(c,e)),Jte({times:0}))}).pipe(am(OM,t),am(BP,noe)),h=yield*soe(LZ,{disableTracing:!0}).pipe(am(HP,l)),g=(yield*eE(1)).withPermit(Cp(tj(s),e=>h.follow(e))),_=h.notices(void 0).pipe(rO(e=>H(function*(){e.type===`ready`?yield*Yu(o,void 0):i(e)}))),v=H(function*(){yield*Uu(o),yield*g,p>0&&a(),p+=1,m=500,r.set(`connected`),yield*Yu(n,void 0),i({type:`ready`})}).pipe(Up(Y2),Tp(gp));yield*op([_,Uu(n).pipe(Tp(Sm(LT(f).pipe(Tp(g))))),Sm(H(function*(){yield*d,yield*Uu(n);let e=u;u=!1,yield*g.pipe(Up(dse)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(Jp(Uu(c)))})),g=sm(H(function*(){for(yield*dm(()=>V(()=>r.set(`idle`)).pipe(Tp(NT(f)),Tp(NT(l))));;){let e=yield*Dp(h);if(Ru(e)&&$le(wu(e.cause))&&!(yield*n?.recoverUnauthorized?.()??B(!1)))return r.set(`unauthorized`),o(),yield*gp;r.set(p===0?`connecting`:`reconnecting`),yield*qp(m).pipe(Jp(d)),m=Math.min(m*2,use)}}));return yield*xp.pipe(Tp(g),nm(t),Pp(e=>Eu(e)?pp:Gm(`Live updates stopped unexpectedly`)),Om),{subscribe(e){f.state._tag!==`Done`&&(Rm(nj(s,e)),kT(f,void 0))}}})}}function eue(e,t,n=Rm(Bd)){let r=CP(void 0),i=_2(e),a=new Set,o=()=>{a.clear(),r.set(void 0)},s=e=>{a.add(e.address),r.value?.address===e.address&&r.set(void 0)},c=XT(1),l=Um(`RemoteRoute.select`)((n=!1)=>H(function*(){if(n&&o(),r.value)return r.value;i.every(e=>a.has(e.address))&&a.clear();let s=0;for(let n of i){if(a.has(n.address))continue;let i=yield*n4(n,e.environmentId,t).pipe(Wp(X2));if(Yn(i)&&S2(e,i.value).kind===`online`)return r.set(n),n;Yn(i)&&i.value.kind===`unauthorized`&&s++}return a.clear(),s===i.length?yield*U(new z2({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new xJ({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(tE(c))),u=e=>R2(e.address,e.credential,t);return{active:r,reset:o,failed:s,select:l,transport:async(e,t)=>{let r={...t?.signal?{signal:t.signal}:{}},a=await Pm(l().pipe(am(Bd,n)),r),o=t?.method===void 0||t.method===`GET`||t.method===`HEAD`,c=async n=>{try{let r=await u(n)(e,t);return r.status===401&&s(n),r}catch(e){throw t?.signal?.aborted||s(n),e}},d;try{d=await c(a)}catch(e){if(!o||t?.signal?.aborted||i.length===1)throw e;let s=await Pm(l().pipe(am(Bd,n)),r);if(s.address===a.address)throw e;return c(s)}if(d.status!==401||!o||i.length===1)return d;let f=await Pm(l().pipe(une,am(Bd,n)),r);return Yn(f)&&f.value.address!==a.address?c(f.value):d},transportFor:u}}function tue(e,t,n,r,i){return t6(H(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*dm(e=>V(()=>{Ru(e)&&!Eu(e.cause)&&r.failed(i)}))),yield*H(function*(){let{ticket:a}=yield*H(function*(){return yield*H2((yield*$2).session.issueLiveTicket())}).pipe(tm($2.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${Y4({query:{ticket:a}})}`)}).pipe(Up(Y2))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(Xp({onSuccess:()=>!0,onFailure:e=>!(e instanceof z2&&e.status===401)}))}:{}})}function n6(e,t,n){let{connection:r}=zle(e,n,Fd(zd(sle),B4.layer).pipe(Rd(t))),i=Ie({...r,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:r.runtime.runSync(E3)});return r.runtime.runSync(B4).adopt(i),i}function nue(e,t,n){let r=eue({...e,name:``},e.send),i=r.transport;return n6({environmentId:e.environmentId,address:e.address,transport:i,cacheIdentity:[e.address,e.deviceId??``],activeRoute:r.active,liveUpdates:tue(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function r6(e){return WM(e).pipe(am(UM,e=>new WebSocket(e)))}function rue(e){return t6(r6(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${Y4({query:{}})}`),void 0,{activity:e})}function iue(e){return e instanceof LQ?`This file is binary or uses an unsupported text encoding.`:e instanceof AQ?`This file is too large to display as text.`:null}var aue=X(({connection:e,scope:t,path:n})=>h3({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe(Mp(e=>{let t=iue(e);return t?B({kind:`unreadable`,reason:t}):U(e)})),e=>`reason`in e||e.worktreeId===t.worktreeId&&e.path===n,[n])),i6=X(({connection:e,scope:t,path:n})=>h3({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe(p3));function a6({connection:e,scope:t,paths:n}){return n.map(n=>i6({connection:e,scope:t,path:n}))}var oue=X(e=>Ck(t=>a6(e).map(e=>t(e)))),sue=X(e=>Rk((t,n)=>{for(let t of a6(e))n.refresh(t)})),cue=X(e=>h3(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),lue=X(({connection:e,scope:t,path:n})=>f3(e,t,[`asset`,n],H(function*(){return yield*(yield*a4(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),s4(e),[n]));function uue(e,t,n){let r=e===`file`?`untitled`:`new-folder`,i=n=>`${t}${n}${e===`directory`?`/`:``}`;if(!n(i(r)))return i(r);let a=2;for(;n(i(`${r}-${a}`));)a+=1;return i(`${r}-${a}`)}function due(e,t){let n=e.lastIndexOf(`/`)+1,r=e.slice(n),i=r.lastIndexOf(`.`),a=i>0?r.slice(0,i):r,o=i>0?r.slice(i):``,s=t=>`${e.slice(0,n)}${a} copy${t}${o}`;if(!t(s(``)))return s(``);let c=2;for(;t(s(` ${c}`));)c+=1;return s(` ${c}`)}function fue(e){return e.filter(t=>!e.some(e=>e!==t&&e.endsWith(`/`)&&t.startsWith(e)))}function pue(e,t){return!e.some(e=>e.endsWith(`/`)&&t.startsWith(e))}function o6(e){return e.replace(/\/$/,``).split(`/`).at(-1)??e}function mue(e){return e.filter(e=>e.endsWith(`/`))}function hue(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function gue(e){let t=[];return e.folder&&!e.link&&(t.push({id:`new-file`,label:`New file`}),t.push({id:`new-folder`,label:`New folder`})),e.link||t.push({id:`rename`,label:`Rename`}),e.openable&&!e.folder&&!e.link&&t.push({id:`duplicate`,label:`Duplicate`}),e.openable&&(t.push(e.changed?{id:`open-diff`,label:`Open diff`}:{id:`open`,label:`Open`}),e.openToSideLabel!==void 0&&t.push({id:`open-to-side`,label:e.openToSideLabel}),e.changed&&t.push({id:`open-file`,label:`Open file`}),!e.folder&&!e.link&&t.push({id:`timeline`,label:`Show timeline`})),e.pinned!==void 0&&t.push({id:`pin`,label:`${e.pinned?`Unpin`:`Pin`} ${e.folder?`folder`:`file`}`}),t.push({id:`hide`,label:e.hiddenEntry===null?e.folder?`Hide folder`:`Hide file`:e.ownHidden?e.folder?`Show folder`:`Show file`:`Show ${e.hiddenName}`}),t.push({id:`copy-relative`,label:`Copy relative path`}),t.push({id:`copy-full`,label:`Copy full path`}),t.push({id:`trash`,label:`Move to trash`}),t}function _ue(e,t){return gue({...t,folder:e?.kind===`directory`,link:e?.kind===`symlink`||e?.kind===`submodule`,openable:e?.kind===`file`})}var s6=class e extends dr()(`@porcelain/client/FileEdits`){static layer(t,n){return kd(e,H(function*(){let e=yield*a4(t),r=yield*B4,i=yield*uO;return{execute:Um(`Files.edit`)(function*(a){let o=`${JSON.stringify([n.projectId,n.worktreeId])}/`,s=a.kind===`move`||a.kind===`trash`?[...r.entries(t)].filter(([e])=>e===`${o}${a.path}`||e.startsWith(`${o}${a.path}/`)):[];return yield*t.request(um(V(Symbol),i=>xm(o=>H(function*(){if(yield*o(u4(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*U(new xJ({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!e.claim(i))return yield*U(new xJ({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!(yield*o(e.save())))return yield*U(new xJ({message:`Save or discard the unsaved draft before moving this entry.`}));let c={worktreeId:n.worktreeId},l=yield*o(e.request(e=>{switch(a.kind){case`write`:return e.files.editFile({params:c,payload:a});case`create`:return e.files.editFile({params:c,payload:a});case`move`:return e.files.editFile({params:c,payload:a});case`copy`:return e.files.editFile({params:c,payload:a});case`trash`:return e.files.editFile({params:c,payload:a})}}));return yield*u4(t,l.path===(a.kind===`move`||a.kind===`copy`?a.destination:a.path)),(a.kind===`move`||a.kind===`trash`)&&(yield*r.relocate(t.environmentId,s.map(([e])=>e),a,n)),l})),e=>H(function*(){for(let[,t]of s)t.release(e);t.isClosed()||(yield*i.invalidate(P3(t.environmentId,{type:`worktree`,...n,change:`files`})))})))})}}))}},c6=X(({connection:e,scope:t})=>e.atoms(n=>Rd(s6.layer(e,t),Fd(n(s4(e).layer),B4.layer)))),vue=X(e=>c6(e).fn(e=>s6.use(t=>t.execute(e)),{concurrent:!0})),yue=X(e=>V4(e.connection).atom(H(function*(){let t=yield*B4,n=yield*UO;return yield*t.retain({...e,environmentId:e.connection.environmentId,writer:{write:({path:r,text:i,expectedFingerprint:a})=>{let o=c6({connection:t.connection(e.connection),scope:e.scope});return um(V(()=>n.mount(o)),()=>H(function*(){let e=yield*Nr(yield*GO(n,o),s6).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*U(new xJ({message:`The server did not confirm the saved version.`}))}),e=>V(e))}}})}))),bue=Um(`Files.moveEntries`)(function*(e,t,n){for(let r of fue(e)){let e=`${t}${o6(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),xue=Um(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),l6=X(e=>{class t extends dr()(`@porcelain/client/PreviewAssets`){static layer=kd(t,H(function*(){let t=yield*a4(e);return{read:Um(`PreviewAssets.read`)(function*(n,r,i){let a=yield*t.request(e=>e.files.readPreviewAssets({params:{worktreeId:n.worktreeId},payload:{document:r,paths:[...i]}}));return yield*u4(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),Sue=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},u6=class extends dr()(`@porcelain/client/HtmlPreviewPlatform`){},Cue=X(({connection:e,platform:t})=>e.atoms(n=>Rd(Fd(l6(e).layer,t),n(s4(e).layer)))),wue=X(({connection:e,scope:t,path:n,html:r,platform:i})=>f3(e,t,[`html-preview`,n,r],H(function*(){let i=yield*u6,a=yield*l6(e);return yield*i.render(r,n,e=>a.read(t,n,e))}),Cue({connection:e,platform:i}),[n]));function Tue(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var Eue=Um(`HtmlPreview.collectAssets`)(function*(e,t,n){let r=new Map,i=0,a=e;for(let e=0;e<8;e+=1){let e=[...new Set(a)].filter(e=>!r.has(e));if(e.length===0)return r;let o=64-r.size;if(o<=0){for(let t of e)r.set(t,null);return r}let s=e.slice(0,o);for(let t of e.slice(o))r.set(t,null);let c=yield*t(s),l=[];for(let e of s){let t=c.get(e)??null;t===null?r.set(e,null):(i+=t.base64.length,i>29360128?r.set(e,null):(r.set(e,t),t.mediaType===`text/css`&&l.push(...n(Tue(t),e))))}a=l}return r}),Due=X(e=>s4(e).atom(o4(e,e=>e.gitActions.listCommitModels())).pipe(pk(Z2),Qk({staleTime:Z2,revalidateOnFocus:!1})));function Oue(e){return Due(e)}var d6=X(({connection:e,scope:t})=>s4(e).fn(Um(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*a4(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*u4(e),i}),{concurrent:!0})),kue=X(({connection:e,scope:t})=>s4(e).fn(Um(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*a4(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*u4(e),yield*mO([D4.reviewSurface(e.environmentId,t,[`changes`])])}))),Aue=X(e=>Ck(H(function*(){let t=yield*UO,n=d6(e);return Um(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*GO(t,n,{suspendOnWaiting:!0})})})));function f6(e,t=[],n,r=t.length>0){let i=new Set(t);return{headOid:e.headOid??void 0,inProgress:e.inProgress??void 0,mergeHeadOid:e.mergeHeadOid??void 0,branch:e.branch?.name??void 0,...n===void 0?{}:{upstreamOid:n},...r?{files:(e.files??[]).flatMap(e=>i.has(e.path)&&e.fingerprint!==null&&e.fingerprint!==void 0?[{path:e.path,fingerprint:e.fingerprint}]:[])}:{}}}var p6=e=>![`succeeded`,`no-change`].includes(e.state),m6=e=>e.message??(e.reason?e.reason.replaceAll(`_`,` `).toLowerCase():`Git ${e.state}`),h6=e=>e.state===`rejected`&&e.reason===`CHANGED_SINCE_LOOKED`;function g6(e){return e instanceof Error?e.message:`Git could not complete this action. Check the current state and try again.`}var _6=e=>t=>V(()=>{Eu(t)||e.setError(wu(t))}),jue=Um(`CommitForm.generate`)(function*(e,t,n=e.paths){let{model:r,working:i,setBusy:a,setError:o,generator:s,status:c,setDrafted:l,setDone:u,setActiveGroup:d,setMessage:f,setGroups:p}=e;if(!r||!n.length||i)return;a(!0),o(null),yield*dm(()=>V(()=>a(!1)));let m=yield*s.submit({mode:t,model:r,paths:n,expectedStatusToken:c.statusToken});l(t,m.expectedFiles),u(new Set),d(null),t===`message`?(f(m.groups[0]?.message??``),p(null)):p(m.groups.map(t=>({...t,id:e.createId()})))},sm,(e,t)=>e.pipe(Pp(_6(t)))),Mue=Um(`CommitForm.commit`)(function*(e){let{working:t,uncertain:n,setBusy:r,setError:i,currentMessage:a,mode:o,commitAction:s,paths:c,status:l,groups:u,done:d,ownHead:f,onBusy:p,setActiveGroup:m,git:h,setOwnHead:g,setDone:_}=e;if(t||n||(r(!0),i(null),yield*dm(()=>V(()=>r(!1))),o===`groups`&&!u?.length))return;let v=s===`amend`?[{id:`single`,message:a,paths:c}]:o===`groups`&&u?u.filter(e=>!d.has(e.id)):[{id:`single`,message:a,paths:c}],y=f??l.headOid??null;p(!0),yield*dm(()=>V(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*U(new Au(void 0,`Give every commit a message and at least one file.`));m(e.id);let t=yield*h.run({action:s,message:e.message,paths:e.paths},f6({...l,headOid:y},l.inProgress===`merge`?l.files?.map(e=>e.path)??[]:e.paths,void 0,!0));if(p6(t))return yield*U(new Au(void 0,m6(t)));t.result?.headOid&&(y=t.result.headOid,g(y)),_(t=>new Set([...t,e.id])),m(null)}},sm,(e,t)=>e.pipe(Pp(_6(t)))),Nue=Um(`CommitForm.lookAgain`)(function*(e){let{onLookAgain:t,working:n,setBusy:r,setError:i,git:a,setOwnHead:o}=e;t&&!n&&(r(!0),i(null),yield*dm(()=>V(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},sm,(e,t)=>e.pipe(Pp(_6(t)))),Pue=Um(`CommitForm.recover`)(function*(e){let{setError:t,git:n,activeGroup:r,setDone:i,setActiveGroup:a,setOwnHead:o}=e;t(null);let s=yield*n.recover();r&&[`succeeded`,`no-change`].includes(s.state)&&(s.result?.headOid&&o(s.result.headOid),i(e=>new Set([...e,r])),a(null))},(e,t)=>e.pipe(Pp(_6(t))));function v6(e){return{statusToken:e.statusToken,inProgress:e.inProgress,mergeHeadOid:e.mergeHeadOid,headOid:e.headOid,branch:e.branch,changes:e.changes.flatMap(e=>e.comparisons),files:e.changes.map(({path:e,fingerprint:t})=>({path:e,fingerprint:t}))}}function Fue(e,t){return e==null?t:t==null||t.name!==e.name||t.upstream!==e.upstream?e:{...t,name:e.name,upstream:e.upstream,ahead:e.ahead,behind:e.behind}}function y6(e){return e.branch??null}function b6(e){return e.changes.some(e=>e.scope===`unmerged`)}function Iue(e,t){let n=y6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;if(t.inProgress===`merge`&&!t.mergeHeadOid)return`Finish this merge in a terminal.`;switch(e){case`switch`:return t.changes.length?`Commit or stash local changes before switching branches.`:null;case`commit`:return b6(t)&&t.inProgress!==`merge`?`Resolve the conflicts before committing.`:null;case`amend`:return b6(t)?`Resolve the conflicts before amending.`:t.headOid===null||t.headOid===void 0?`There is no commit to amend.`:null;case`push`:return n?n.name===null||n.name===void 0?`Detached HEAD: check out a branch before pushing.`:n.behind>0?`Pull the upstream changes before pushing.`:n.ahead>0||n.upstream===null||n.upstream===void 0?null:`No local commits to push.`:null;case`pull`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to pull from.`:t.changes.length?`Commit or stash local changes before pulling.`:n?.name===null?`Detached HEAD: check out a branch before pulling.`:null;case`fetch`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to fetch.`:null;case`stash-create`:return null;case`stash-apply`:case`stash-pop`:return n?.stashes&&n.stashes.length===0?`No stash is available.`:null;case`discard`:return null}}function Lue(e,t){let n=y6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;switch(e){case`switch`:return null;case`commit`:return t.changes.length?null:`Nothing to commit.`;case`amend`:return t.changes.length?`Choose which changed files to add to the last commit.`:`Change the last commit message.`;case`push`:return n==null?`Enter the configured remote and full branch ref.`:null;case`pull`:case`fetch`:return n==null?`Enter the configured remote and full branch ref.`:null;case`stash-create`:return t.changes.length===0?`Nothing changed; the server will report no change.`:null;case`stash-apply`:case`stash-pop`:return n?.stashes===null||n?.stashes===void 0?`Enter a full stash object ID.`:null;case`discard`:return null}}function Rue(e,t){let n=y6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function zue(e){if(e.inProgress===`rebase`||e.inProgress===`merge`&&!e.mergeHeadOid)return{kind:`hint`,label:`Git recovery`,hint:`Finish or abort this operation in a terminal.`};if(e.inProgress===`merge`||e.changes.length>0)return{kind:`commit`,label:`Commit`};let t=y6(e);return t==null?{kind:`hint`,label:`Commit`,hint:`Nothing to commit. Choose a Git action to continue.`}:t.name===null||t.name===void 0?{kind:`hint`,label:`Commit`,hint:`Detached HEAD: check out a branch before pushing.`}:t.behind>0?{kind:`run`,action:`pull`,label:`Pull`}:t.ahead>0?{kind:`run`,action:`push`,label:`Push`}:(t.stashes?.length??0)>0?{kind:`stash`,label:`Apply stash`}:{kind:`hint`,label:`Commit`,hint:`Nothing to commit, pull or push.`}}var x6=Um(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(Op(e=>p6(e)?m6(e):null),Mp(e=>B(g6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),Bue=Um(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(Op(v6),Mp(t=>V(()=>(n({title:`Could not restore ${e}`,description:g6(t),type:`error`}),null))));if(!c)return;let l=c.files?.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0).map(e=>e.path)??[];r(s),yield*x6(i,{stashOid:a,restoreIndex:o},f6(c,l,void 0,!0),n,{restored:`Restored ${e}`,failed:`Could not restore ${e}`})});function Vue(e,t){let{what:n,notify:r,close:i}=e;if(p6(t))return{text:m6(t),moved:h6(t)};i();let a=t.result?.restoreStashOid;if(t.state===`no-change`)return r({title:`Nothing to discard`,description:`${n} already matches the last commit.`,type:`info`}),null;let o=t.result?.restoreIndex??!1,s=r({title:`Discarded ${n}`,type:`success`,timeout:e.restoreTimeoutMs,...a?{actionProps:{children:`Restore`,onClick:()=>e.run(Bue(e,a,o,s))}}:{}});return null}var Hue=Um(`Discard.finish`)(function*(e,t){return Vue(t,yield*e)});function Uue(e){return e===`fetch`||e===`pull`||e===`push`}function Wue(e,t,n){return e?n&&(e.branch?.name!==t?.name||e.branch?.upstream!==t?.upstream)?{ready:!1,reason:`The branch target changed. Review it and try again.`}:{ready:!0,looked:e}:{ready:!1,reason:`The branch target is still loading. Try again.`}}function Gue(e,t,n){if(!t?.name)throw Error(`Check out a branch before using the remote.`);if(e===`fetch`||e===`pull`){if(!t?.upstream||!t.remoteName||!t.sourceRef)throw Error(`Configure an upstream branch first.`);let r=`${t.remoteName}/`;if(!t.upstream.startsWith(r)||t.sourceRef!==`refs/heads/${t.upstream.slice(r.length)}`)throw Error(`The configured upstream changed. Review it and try again.`);return e===`fetch`?{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef}:{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef,strategy:n}}let r=t.sourceRef??`refs/heads/${t.name}`;return{action:e,remoteName:t.remoteName??`origin`,destinationRef:r,allowCreate:t?.upstream===null||t?.upstream===void 0}}var S6=e=>e===`fetch`?`Fetch`:e===`pull`?`Pull`:`Push`;function C6(e,t){let n=S6(e);return{title:t.state===`interrupted`?`${n} outcome not confirmed`:t.state===`conflicted`?`${n} needs conflict resolution`:t.state===`rejected`?`${n} did not run`:t.state===`running`?`${n} in progress`:n,description:m6(t),type:t.state===`succeeded`||t.state===`no-change`?`success`:t.state===`running`?`info`:`error`}}var Kue=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,w6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function que(e,t){if(e.kind===`hint`)return e.hint;if(e.kind===`commit`)return`Commit ${w6(t.changes.length,`changed file`)}`;let n=y6(t);if(e.kind===`stash`){let e=n?.stashes?.[0]?.message;return e?`Apply the stash “${e}”`:`Apply the latest stash`}let r=n?.upstream??`the configured remote`;return e.action===`pull`?`Pull from ${r}`:`Push ${w6(n?.ahead??0,`commit`)} to ${r}`}var Jue=Um(`GitMenu.runNetwork`)(function*(e,t,n,r){let{details:i}=e,a=e.onResult,o=S6(n);if(n===`pull`&&e.pull.kind===`blocked`){a({title:`${o} did not run`,description:e.pull.reason,type:`error`});return}let s=jw(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=Wue(s??(yield*i.read()),r,c);if(!l.ready){a({title:`${o} did not run`,description:l.reason,type:`error`});return}let{looked:u}=l,d=yield*bp({try:()=>Gue(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`),catch:e=>new Au(e,g6(e))});a(C6(n,yield*um(V(()=>e.onProgress(!0)),()=>t.run(d,f6(u,[],u.branch?.upstreamOid??null)),()=>V(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.onResult({title:`${S6(r)} outcome not confirmed`,description:g6(e),type:`error`}))))),Yue=Um(`GitMenu.recoverNetwork`)(function*(e,t,n){let r=yield*t.recover();e.onResult(C6(n,r))},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.onResult({title:`${S6(r)} outcome not confirmed`,description:g6(e),type:`error`}))))),Xue=Um(`GitMenu.restoreDiscarded`)(function*(e,t,n){let{details:r,notify:i}=e,a=n.kind===`rename`?`rename of ${n.path}`:`hunk of ${n.path}`,o=er(Bw(r.result));(!o||Nw(r.result))&&(e.enableDetails(),o=yield*r.read()),yield*x6(t,{stashOid:n.oid,restoreIndex:n.kind===`rename`},f6(o,[n.path],void 0,!0),i,{restored:`Restored the discarded ${a}`,failed:`Could not restore the discarded ${a}`})},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.notify({title:`Could not restore the discarded ${r.kind===`rename`?`rename of ${r.path}`:`hunk of ${r.path}`}`,description:g6(e),type:`error`}))))),Zue=Um(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),Que=Um(`GitActions.refreshLook`)(function*(e,t){t(v6(yield*e))});X(e=>Ck(null).pipe(Jk));function T6(e){return D3.of({read:()=>bp(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>bp(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>bp(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var E6=Xh;function $ue(e){if(!e)throw Error(`A connected environment is required`);return e}var D6={name:()=>typeof navigator>`u`?`Browser`:Z3(navigator.userAgent).slice(0,120)||`Browser`,send:fetch,statusActivity:$3};function ede(e,t){return n6({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:J3},Fd(E6,wd(D3,T6(t.operationsKey))),A6.memoMap)}var O6=CP(void 0);function tde({inventory:e,principal:t}){O6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=ede(e.environmentId,{address:window.location.href,transport:Q4(fetch),liveUpdates:rue($3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(wd(j4,qn(e))),r}function nde(e){return nue({...e,send:fetch,...D6.statusActivity?{activity:D6.statusActivity}:{},socket:r6,onStatusChange:()=>t4(D6,e),timeoutMs:J3},Fd(E6,wd(D3,T6(v2(e)?`porcelain-git-requests:${v2(e)}`:void 0))),A6.memoMap)}var rde=Pd(Fd(M2.layer,H4.layer).pipe(Ld(wd(gJ,Kle))),wd(_J,D6),B4.layer,wd(N2,{local:e=>lm(V(()=>tde(e)),e=>lp(()=>e.close()))}),wd(P2,{open:e=>lm(V(()=>nde(e)),e=>lp(()=>e.close()))}),wd(U4,{forgetEnvironment:()=>pp})),k6=L2.pipe(Rd(Pd(W4.layer,F2.layer,I2.layer).pipe(Rd(rde)))),A6=aJ(k6),j6=Mk({memoMap:A6.memoMap})(k6),ide=A6.runSync(M2),M6=A6.runSync(F2),N6=A6.runSync(I2),P6=N6.state,ade=j6.atom(H(function*(){yield*(yield*W4).read()}));function ode(){tI(ade)}function F6(){return pI(ide.state)}function I6(){return pI(M6.state).connection}function sde(){return pI(N6.state)}function L6(e){let t=(0,VW.c)(5),n=pI(N6.state),r;if(t[0]!==e||t[1]!==n){let i;t[3]===e?i=t[4]:(i=t=>t.remote.environmentId===e,t[3]=e,t[4]=i),r=n.find(i),t[0]=e,t[1]=n,t[2]=r}else r=t[2];return r}function R6(e){let t=(0,VW.c)(6),n=I6();if(e){let n;return t[0]===e?n=t[1]:(n={connection:e},t[0]=e,t[1]=n),n}let r;t[2]===n?r=t[3]:(r=$ue(n),t[2]=n,t[3]=r);let i;return t[4]===r?i=t[5]:(i={connection:r},t[4]=r,t[5]=i),i}var cde=Ose({transport:Q4(fetch),platform:D6});function lde(e,t,n){return A6.runPromise(fce(e,cde,t,J3),{signal:n})}var ude=X(e=>Ck(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),n(),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),dde=cce(Q4(fetch,{reportUnauthorized:!1}));function fde(e){return A6.runPromise(pce(e,dde))}var pde=Ck(e=>{e.addFinalizer(Sce(()=>{A6.runFork(M6.clear())}))});function mde(){return aI(pde),Z4}function z6(e){let t=(0,VW.c)(3),n=L6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=r4(D6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],tI(r)}function hde(e){let t=(0,VW.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=jG(`shrink-0`,n),t[0]=n,t[1]=r);let i,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`21`,height:`21`,rx:`4.5`}),a=(0,Q.jsx)(`path`,{d:`M12 3v5.5q0 .5-.5 .5h-2q-.5 0-.5 .5V11q0 .5.5 .5H12v2q0 .5.5 .5h2q.5 0 .5 .5V16q0 .5-.5 .5H12V21`}),t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`g`,{fill:`currentColor`,stroke:`none`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`6.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`11.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`16.5`,r:`1.25`})]}),t[4]=o):o=t[4];let s;return t[5]===r?s=t[6]:(s=(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:r,children:[i,a,o]}),t[5]=r,t[6]=s),s}function B6(e){let t=(0,VW.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(hde,{className:`size-6`}),i=(0,Q.jsx)(`h1`,{className:`text-lg font-medium tracking-tight`,children:`Porcelain`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 px-6 md:px-8`,children:[r,i,(0,Q.jsxs)(`a`,{href:`https://porcelain.fabiofiorita.com/install`,target:`_blank`,rel:`noreferrer`,className:`ml-auto inline-flex items-center gap-1 rounded-md p-1 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`Install guide`,` `,(0,Q.jsx)(tK,{"aria-hidden":`true`,className:`size-3.5`})]})]}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,Q.jsxs)(`div`,{className:`pairing-page flex min-h-svh flex-col bg-background`,children:[a,(0,Q.jsx)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col px-6 pb-7 pt-10 md:px-14 md:pt-14`,children:n})]}),t[3]=n,t[4]=o),o}var gde=`a[href], button, summary, [role="button"], [role="link"]:not([aria-disabled="true"]), [role="tab"], [role="option"], [role="checkbox"], [role="radio"], [role="switch"], [role^="menuitem"], [tabindex]:not([tabindex="-1"]), [data-truncated]`;function V6(e,t){return e===`start`?(0,Q.jsx)(`bdi`,{dir:`ltr`,children:t}):t}function _de(e,t){if(t===1)return e.scrollWidth>e.clientWidth;let n=e.clientHeight,r=e.style.webkitLineClamp;try{return e.style.webkitLineClamp=`unset`,e.clientHeight>n}finally{e.style.webkitLineClamp=r}}function H6(e){let t=(0,VW.c)(39),{text:n,children:r,className:i,render:a,renderTrigger:o,propagateEscape:s,lines:c,disclose:l,cut:u}=e,d=s!==void 0&&s,f=c===void 0?1:c,p=l===void 0?`clipped`:l,m=u===void 0?`end`:u,h=(0,Z.useId)(),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(!1),w;t[0]!==g||t[1]!==p||t[2]!==n?(w=n.trim()!==``&&(g||p===`always`),t[0]=g,t[1]=p,t[2]=n,t[3]=w):w=t[3];let T=w,E=o!==void 0,D;t[4]!==h||t[5]!==f||t[6]!==d||t[7]!==E?(D=()=>e=>{if(!e)return;let t=()=>[e,...e.querySelectorAll(`[data-truncated]`)].filter(e=>e.getAttribute(`data-truncated`)===h),n=E?null:e.parentElement?.closest(gde)??null,r=!0,i=()=>{r&&_(t().some(e=>_de(e,f)))},a=()=>{n?.matches(`:focus-visible`)&&!n.hasAttribute(`data-clipped`)&&n.querySelector(`[data-clipped]`)===e&&C(!0)},o=()=>C(!1),s=t=>{t.key===`Escape`&&e.hasAttribute(`data-popup-open`)&&(C(!1),x(!1),d||t.stopPropagation())};y(n!==null),i();let c=new ResizeObserver(i);for(let e of t())c.observe(e);let l=new MutationObserver(i);return l.observe(e,{characterData:!0,childList:!0,subtree:!0}),document.fonts.ready.then(i),n?.addEventListener(`focus`,a),n?.addEventListener(`blur`,o),n?.addEventListener(`keydown`,s),()=>{r=!1,c.disconnect(),l.disconnect(),n?.removeEventListener(`focus`,a),n?.removeEventListener(`blur`,o),n?.removeEventListener(`keydown`,s)}},t[4]=h,t[5]=f,t[6]=d,t[7]=E,t[8]=D):D=t[8];let[O]=(0,Z.useState)(D),k=!E&&!v,A;t[9]===h?A=t[10]:(A=(e,t,n)=>{let r=n===void 0?`end`:n;return(0,Q.jsx)(`span`,{dir:r===`start`?`rtl`:void 0,className:jG(`min-w-0 truncate`,r===`start`&&`text-left`,t),"data-truncated":h,children:V6(r,e)})},t[9]=h,t[10]=A);let j=A,M;t[11]===a?M=t[12]:(M=a??(0,Q.jsx)(`span`,{}),t[11]=a,t[12]=M);let N=M,P;if(t[13]!==r||t[14]!==i||t[15]!==j||t[16]!==m||t[17]!==T||t[18]!==N||t[19]!==h||t[20]!==f||t[21]!==a?.props.className||t[22]!==o||t[23]!==k||t[24]!==n||t[25]!==E){let e=(0,Z.cloneElement)(N,{tabIndex:k&&T?0:void 0,dir:m===`start`?`rtl`:void 0,"aria-label":k?n:void 0,"data-truncated":h,"data-clipped":!E&&T?``:void 0,className:jG(`relative min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,f===3?`line-clamp-3 whitespace-normal`:`truncate`,m===`start`&&`text-left`,a?.props.className,i)},V6(m,r??n));P=o?.(e,j)??e,t[13]=r,t[14]=i,t[15]=j,t[16]=m,t[17]=T,t[18]=N,t[19]=h,t[20]=f,t[21]=a?.props.className,t[22]=o,t[23]=k,t[24]=n,t[25]=E,t[26]=P}else P=t[26];let F=P,I=!T,L=T&&(b||S),R;t[27]===d?R=t[28]:(R=(e,t)=>{x(e),e||C(!1),d&&t.reason===`escape-key`&&t.allowPropagation()},t[27]=d,t[28]=R);let ee;t[29]===F?ee=t[30]:(ee=(0,Q.jsx)(Eq,{ref:O,render:F,children:F.props.children}),t[29]=F,t[30]=ee);let z;t[31]===n?z=t[32]:(z=(0,Q.jsx)(Dq,{role:`tooltip`,className:`wrap-anywhere`,children:n}),t[31]=n,t[32]=z);let te;return t[33]!==I||t[34]!==L||t[35]!==R||t[36]!==ee||t[37]!==z?(te=(0,Q.jsxs)(Tq,{disabled:I,disableHoverablePopup:!0,open:L,onOpenChange:R,children:[ee,z]}),t[33]=I,t[34]=L,t[35]=R,t[36]=ee,t[37]=z,t[38]=te):te=t[38],te}function U6({className:e,...t}){return(0,Q.jsx)(kK,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:jG(`size-4 animate-spin`,e),...t})}function W6(){return typeof window>`u`?`http://127.0.0.1:3000`:window.location.origin}function G6(e){let t=(0,VW.c)(56),{reason:n,pending:r}=e,i=r!==void 0&&r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=W6(),t[0]=a):a=t[0];let o=`porcelain pair "This browser" --address ${a}`,s=`This browser cannot open your worktrees yet`,c=`On your computer, run this`;n&&(s=`That link did not let this browser in`,c=`On your computer, run it again`),i&&(s=`Checking the link with your computer`,c=`Ran porcelain pair on your computer`);let l=i?`bg-brand-soft text-brand`:`bg-foreground text-background`,u;t[1]===l?u=t[2]:(u=jG(`inline-flex items-center gap-1 rounded-full px-2 py-1 text-xs font-medium`,l),t[1]=l,t[2]=u);let d;t[3]===i?d=t[4]:(d=i&&(0,Q.jsx)(U6,{className:`size-3`}),t[3]=i,t[4]=d);let f=i?`Pairing`:`Not paired`,p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,Q.jsxs)(`span`,{className:u,children:[d,f]}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==p?(m=(0,Q.jsxs)(`p`,{role:`status`,className:`flex w-fit max-w-full flex-wrap items-center gap-2 rounded-full border bg-background p-1 pr-3 text-ui text-muted-foreground`,children:[p,s]}),t[9]=s,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`text-4xl font-semibold leading-none tracking-tighter md:text-6xl`,children:[(0,Q.jsx)(`h2`,{"aria-label":`This browser is not paired`,className:`text-title-dim`,children:`This browser is not paired.`}),(0,Q.jsx)(`p`,{children:`Pair it from your computer.`})]}),(0,Q.jsx)(`p`,{className:`max-w-xl text-lg leading-relaxed text-muted-foreground`,children:`Porcelain runs on the computer where your agents work, and this browser reads from it. That computer prints a link to let it in.`})]}),t[12]=h):h=t[12];let g=!i,_;t[13]===c?_=t[14]:(_=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:c}),t[13]=c,t[14]=_);let v;t[15]!==i||t[16]!==n?(v=!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`my-3 flex min-w-0 items-center gap-3 rounded-full border bg-muted py-1 pl-4 pr-1 text-ui`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`$`}),(0,Q.jsx)(H6,{text:o,render:(0,Q.jsx)(`code`,{}),className:`flex-1`}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>jq(o,`the command`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{children:`Copy the command`})]})]}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n?`Same command, a new link. `:``,`It prints a link that works once, for 15 minutes.`]})]}),t[15]=i,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==i||t[19]!==g||t[20]!==_||t[21]!==v?(y=(0,Q.jsxs)(K6,{number:1,current:g,done:i,children:[_,v]}),t[18]=i,t[19]=g,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b=!!n,x=i?`Checking the link`:`Open the link it prints, here`,S;t[23]===x?S=t[24]:(S=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:x}),t[23]=x,t[24]=S);let C=n?`alert`:void 0,w=n?`text-destructive`:`text-muted-foreground`,T;t[25]===w?T=t[26]:(T=jG(`mt-1 text-ui leading-relaxed [overflow-wrap:anywhere]`,w),t[25]=w,t[26]=T);let E;t[27]!==i||t[28]!==n?(E=n??(i?`Checking that the link belongs to this Porcelain installation.`:(0,Q.jsxs)(Q.Fragment,{children:[`Its Porcelain page continues here, at`,` `,(0,Q.jsxs)(`code`,{children:[W6(),`/pair`]}),`. On a phone, scan the QR code it prints.`]})),t[27]=i,t[28]=n,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,Q.jsx)(`p`,{role:C,className:T,children:E}),t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==i||t[35]!==b||t[36]!==S||t[37]!==D?(O=(0,Q.jsxs)(K6,{number:2,current:i,failed:b,children:[S,D]}),t[34]=i,t[35]=b,t[36]=S,t[37]=D,t[38]=O):O=t[38];let k;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:`Read what your agents changed`}),t[39]=k):k=t[39];let A;t[40]===i?A=t[41]:(A=!i&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`This browser stays paired until you revoke it.`}),t[40]=i,t[41]=A);let j;t[42]===A?j=t[43]:(j=(0,Q.jsxs)(K6,{number:3,children:[k,A]}),t[42]=A,t[43]=j);let M;t[44]!==y||t[45]!==O||t[46]!==j?(M=(0,Q.jsxs)(`ol`,{"aria-label":`How pairing works`,className:`flex max-w-3xl flex-col`,children:[y,O,j]}),t[44]=y,t[45]=O,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i?N=t[49]:(N=!1,t[48]=i,t[49]=N);let P;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[50]=P):P=t[50];let F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(`p`,{className:`mt-auto border-t pt-4 text-ui text-muted-foreground`,children:[`Revoke this browser at any time with `,P,` and`,` `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),t[51]=F):F=t[51];let I;return t[52]!==M||t[53]!==N||t[54]!==m?(I=(0,Q.jsxs)(`section`,{className:`flex w-full min-w-0 flex-1 flex-col gap-8`,children:[m,h,M,N,F]}),t[52]=M,t[53]=N,t[54]=m,t[55]=I):I=t[55],I}function K6(e){let t=(0,VW.c)(19),{number:n,current:r,done:i,failed:a,children:o}=e,s=r!==void 0&&r,c=i!==void 0&&i,l=a!==void 0&&a,u=``,d=n;if(l){u=`, failed`;let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ZK,{className:`size-3`}),t[0]=e):e=t[0],d=e}if(c){u=`, done`;let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(rK,{className:`size-3`}),t[1]=e):e=t[1],d=e}s&&(u=`, current`);let f;t[2]===n?f=t[3]:(f=n!==3&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1 left-3 top-8 border-l`}),t[2]=n,t[3]=f);let p=s?`step`:void 0,m=`Step ${n}${u}`,h=s&&`border-brand text-brand ring-4 ring-brand-soft`,g=c&&`border-brand bg-brand text-brand-foreground`,_=l&&`border-destructive text-destructive`,v;t[4]!==h||t[5]!==g||t[6]!==_?(v=jG(`relative flex size-6 shrink-0 items-center justify-center rounded-full border bg-background text-xs tabular-nums text-muted-foreground`,h,g,_),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y;t[8]!==d||t[9]!==v||t[10]!==p||t[11]!==m?(y=(0,Q.jsx)(`span`,{"aria-current":p,"aria-label":m,className:v,children:d}),t[8]=d,t[9]=v,t[10]=p,t[11]=m,t[12]=y):y=t[12];let b;t[13]===o?b=t[14]:(b=(0,Q.jsx)(`div`,{className:`min-w-0`,children:o}),t[13]=o,t[14]=b);let x;return t[15]!==y||t[16]!==b||t[17]!==f?(x=(0,Q.jsxs)(`li`,{className:`relative grid grid-cols-[auto_minmax(0,1fr)] gap-4 pb-8 last:pb-0`,children:[f,y,b]}),t[15]=y,t[16]=b,t[17]=f,t[18]=x):x=t[18],x}function vde(e){let t=(0,VW.c)(3),{reason:n}=e,r=!n,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(B6,{children:(0,Q.jsx)(G6,{reason:n,pending:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function q6({className:e,...t}){return(0,Q.jsx)(`label`,{"data-slot":`label`,className:jG(`flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var J6=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return mB(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function yde({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(J6,{"data-slot":`separator`,orientation:t,className:jG(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function Y6({className:e,...t}){return(0,Q.jsx)(`fieldset`,{"data-slot":`field-set`,className:jG(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function X6({className:e,variant:t=`legend`,...n}){return(0,Q.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:jG(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}var bde=LG(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Z6({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:jG(bde({orientation:t}),e),...n})}function xde({className:e,...t}){return(0,Q.jsx)(q6,{"data-slot":`field-label`,className:jG(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-2 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/30 *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function Q6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`field-description`,className:jG(`text-left text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Sde({className:e,children:t,errors:n,...r}){let i=(0,Z.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,Q.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:jG(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function $6(e){return mB(e.defaultTagName??`div`,e,e)}function e8({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:jG(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Cde=LG(`group/item flex w-full flex-wrap items-center rounded-md border text-xs/relaxed transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2.5 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function t8({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return $6({defaultTagName:`div`,props:eB({className:jG(Cde({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var wde=LG(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-8 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function n8({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:jG(wde({variant:t,className:e})),...n})}function r8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:jG(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function i8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-title`,className:jG(`line-clamp-1 flex w-fit items-center gap-2 text-xs/relaxed leading-snug font-medium underline-offset-4`,e),...t})}function a8({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`item-description`,className:jG(`line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function o8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-actions`,className:jG(`flex items-center gap-2`,e),...t})}function s8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:jG(`flex basis-full items-center justify-between gap-2`,e),...t})}var Tde=LG(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2 py-1.5 text-left text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function c8({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:jG(Tde({variant:t}),e),...n})}function l8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:jG(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function u8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-description`,className:jG(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}var Ede=LG(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,warn:`border-warn-border bg-warn-soft text-warn [a]:hover:bg-warn-soft/80`,brand:`bg-brand text-brand-foreground [a]:hover:bg-brand/80`,"brand-soft":`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,open:`bg-add-bg text-add-fg [a]:hover:bg-add-bg/80`,draft:`bg-muted text-muted-foreground [a]:hover:bg-muted/80`,merged:`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,closed:`bg-del-bg text-del-fg [a]:hover:bg-del-bg/80`}},defaultVariants:{variant:`default`}});function d8({className:e,variant:t=`default`,render:n,...r}){return $6({defaultTagName:`span`,props:eB({className:jG(Ede({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function f8(e){let t=(0,VW.c)(17),{section:n,title:r,lead:i,status:a,action:o,children:s}=e,c;t[0]===a?c=t[1]:(c=a&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex h-5.5 min-w-0 items-center gap-2 text-ui leading-4.5`,children:a}),t[0]=a,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Q.jsxs)(`span`,{className:`text-title-dim`,children:[n,`.`]}),t[2]=n,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,Q.jsxs)(`h1`,{className:`min-w-0 text-4xl font-semibold tracking-title wrap-anywhere`,children:[l,` `,r]}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[u,o]}),t[7]=o,t[8]=u,t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=(0,Q.jsx)(`p`,{className:`mt-3 max-w-160 text-base tracking-lead text-foreground-2`,children:i}),t[10]=i,t[11]=f);let p;return t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[c,d,f,s]}),t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function p8(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=S4(e),t[0]=e,t[1]=n),tI(n)}function m8(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=C4(e),t[0]=e,t[1]=n),tI(n)}function Dde(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=w4(e),t[0]=e,t[1]=n),tI(n)}var Ode=X(e=>j6.fn((t,n)=>H(function*(){yield*n.setResult(dce(e),void 0),yield*(yield*F2).clear()})));function kde(e){let t=(0,VW.c)(8),n;t[0]===e?n=t[1]:(n=Ode(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promiseExit`},t[2]=r):r=t[2];let[i,a]=cI(n,r),o;t[3]===a?o=t[4]:(o=()=>{a()},t[3]=a,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s={result:i,submit:o},t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function Ade(e){let t=(0,VW.c)(17),{computer:n}=e,{connection:r}=R6(),{result:i,submit:a}=kde(r),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:`text-sm leading-5 font-medium`,children:`Disconnect this browser`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,(0,Q.jsxs)(`p`,{className:`mt-0.5 text-ui leading-4.5 text-muted-foreground`,children:[`Ends its session on `,n,`. Pair it again with a new link.`]})]}),t[1]=n,t[2]=s);let c;t[3]===i.waiting?c=t[4]:(c=i.waiting?(0,Q.jsx)(U6,{}):(0,Q.jsx)(YK,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`shrink-0 self-start sm:self-auto`,"aria-label":`Disconnect this browser`,disabled:i.waiting,onClick:a,children:[c,`Disconnect`]}),t[5]=i.waiting,t[6]=a,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,Q.jsxs)(`div`,{className:`settings-danger flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=Nw(i)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.cause))})}),t[12]=i,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}var h8=Nk(Q3.layer),g8=h8.atom(H(function*(){let e=yield*Q3;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),_8=h8.atom(H(function*(){return yield*(yield*Q3).checkUpdate})).pipe(Jk),v8=h8.atom(ND(H(function*(){return(yield*Q3).updateStates}))).pipe(pk(0));function y8(){let e=(0,VW.c)(2),t=tI(v8),n;return e[0]===t?n=e[1]:(n=Zn(Bw(t),jde),e[0]=t,e[1]=n),n}function jde(){return{status:`idle`}}function Mde(){return tI(g8)}var Nde=`data-valid`,Pde=`data-invalid`,Fde={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ide={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},b8={valid(e){return e===null?null:e?{[Nde]:``}:{[Pde]:``}}},Lde={invalid:void 0,name:void 0,validityData:{state:Fde,errors:[],error:``,value:``,initialValue:null},setValidityData:hI,disabled:void 0,setTouched:hI,setDirty:hI,setFilled:hI,setFocused:hI,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Ide,registerFieldControl:hI,validation:{getValidationProps:(e,t=_I)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:hI,getInputControl:()=>null,commit:async()=>{},change:hI}},Rde=Z.createContext(Lde);function x8(e=!0){let t=Z.useContext(Rde);if(t.setValidityData===hI&&!e)throw Error(wI(28));return t}var zde=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:hI,validationMode:`onSubmit`,submitCountRef:{current:0}});function S8(){return Z.useContext(zde)}var Bde=Z.createContext({controlId:void 0,registerControlId:hI,resetControlId:hI,labelId:void 0,setLabelId:hI,messageIds:[],setMessageIds:hI,getDescriptionProps:e=>e});function C8(){return Z.useContext(Bde)}function w8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=sq(i?`${i}-label`:void 0),c=e??t??a;return xI(()=>{let i=e||t||!r?void 0:Vde(n.current,s);a!==i&&o(i)}),c}function Vde(e,t){let n=Hde(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Hde(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function T8(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=C8(),o=sq(),s=bI(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=UI(()=>{c.current&&i!==hI&&(c.current=!1,i(s.current,void 0))});return xI(()=>{if(!n||i===hI){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),xI(()=>u,[u]),(n?r:void 0)??t??o}function E8({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i&&e!==void 0?e:a,Z.useCallback(e=>{i||o(e)},[])]}function D8(e,t,n,r,i=!0,a){let{registerFieldControl:o}=x8(),s=bI(()=>Symbol());xI(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),xI(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function O8(e,t){let n=Z.useRef(e),r=UI(t);xI(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var Ude=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=x8(),{clearErrors:C,elementRef:w,submitCountRef:T}=S8(),E=h||s,D=m??a,O={...p,disabled:E},{labelId:k}=C8(),A=T8({id:i}),[j]=E8({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=N==null?void 0:String(N),F=UI(()=>S.inputRef.current?.value);D8(S.inputRef,A,P,F,!E,a),xI(()=>{let e=P??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[P,S.inputRef,b]),O8(P,()=>{P!==void 0&&(C(D),_(P!==(v.initialValue??``)),S.change(P))});let I=Z.useRef(null),L=DL();return xI(()=>{u&&I.current===HL(yL(I.current))&&y(!0)},[u,y]),mB(`input`,e,{ref:[t,I],state:O,props:[{id:A,disabled:E,name:D,ref:S.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=dV(JB,e.nativeEvent);c?.(t,n),M||(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;L.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:b8})}),Wde=Z.forwardRef(function(e,t){return(0,Q.jsx)(Ude,{ref:t,...e})});function k8({className:e,type:t,...n}){return(0,Q.jsx)(Wde,{type:t,"data-slot":`input`,className:jG(`h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function A8(e){e.catch(()=>void 0)}function j8(e,t){e.preventDefault(),A8(t())}function Gde(e){let t=(0,VW.c)(3),n;t[0]===e?n=t[1]:(n=Qse(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],cI(n,r)}function Kde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=$se({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function qde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=ece({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function Jde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=tce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function Yde(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=nce(e),t[0]=e,t[1]=n),cI(n)}function Xde(e){let t=(0,VW.c)(3),n;t[0]===e?n=t[1]:(n=ace(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],cI(n,r)}function Zde(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=oce(e),t[0]=e,t[1]=n),cI(n)}function Qde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=ice({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function $de(e){let t=(0,VW.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(efe),[c,l]=Xde(n),u=a??(r.custom?r.name:``),d;t[0]===u?d=t[1]:(d=u.trim(),t[0]=u,t[1]=d);let f=d,p=r.custom?f===r.name:f===``,m;t[2]!==f||t[3]!==l?(m=e=>j8(e,async()=>l(f===``?null:f)),t[2]=f,t[3]=l,t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(q6,{htmlFor:`environment-name`,children:`Name of this computer`}),t[5]=h):h=t[5];let g;t[6]===i?g=t[7]:(g=e=>{e.key===`Escape`&&i()},t[6]=i,t[7]=g);let _=r.custom?`Host name`:r.name,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[8]=v):v=t[8];let y;t[9]!==g||t[10]!==_||t[11]!==u?(y=(0,Q.jsx)(k8,{ref:s,id:`environment-name`,className:`min-w-0 flex-1`,onKeyDown:g,placeholder:_,maxLength:Ale,value:u,onChange:v}),t[9]=g,t[10]=_,t[11]=u,t[12]=y):y=t[12];let b=p||c.waiting,x=c.waiting?`Saving…`:`Save`,S;t[13]!==b||t[14]!==x?(S=(0,Q.jsx)(zG,{type:`submit`,variant:`outline`,disabled:b,children:x}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===i?C=t[17]:(C=(0,Q.jsx)(zG,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),t[16]=i,t[17]=C);let w;t[18]!==S||t[19]!==C||t[20]!==y?(w=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[y,S,C]}),t[18]=S,t[19]=C,t[20]=y,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(Q6,{children:`Paired devices show it so you know where they are connected. Leave it empty to use the host name.`}),t[22]=T):T=t[22];let E;t[23]===w?E=t[24]:(E=(0,Q.jsxs)(Z6,{children:[h,w,T]}),t[23]=w,t[24]=E);let D;t[25]===c?D=t[26]:(D=Nw(c)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(c.cause))})}),t[25]=c,t[26]=D);let O;return t[27]!==E||t[28]!==D||t[29]!==m?(O=(0,Q.jsxs)(`form`,{className:`flex max-w-160 flex-col gap-2`,onSubmit:m,children:[E,D]}),t[27]=E,t[28]=D,t[29]=m,t[30]=O):O=t[30],O}function efe(){return tfe}function tfe(e){return e?.focus()}var M8=Z.createContext(void 0);function N8(e){let t=Z.useContext(M8);if(t===void 0&&!e)throw Error(wI(33));return t}var P8=Z.createContext(void 0);function F8(e){let t=Z.useContext(P8);if(t===void 0&&!e)throw Error(wI(36));return t}var I8=Z.createContext(void 0);function L8(e=!0){let t=Z.useContext(I8);if(t===void 0&&!e)throw Error(wI(25));return t}var R8=Z.createContext(void 0);function nfe(){let e=Z.useContext(R8);if(e===void 0)throw Error(wI(30));return e}function rfe(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=L8(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:$B})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!LL&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&WB(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var z8={type:`regular-item`};function B8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=GB({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=rfe({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>eB(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Hz(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var V8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ife(){return Z.useContext(V8)}function H8(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=ife(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return xI(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var afe=`data-checked`,ofe=`data-unchecked`,U8={checked(e){return e?{[afe]:``}:{[ofe]:``}},...tR},sfe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=H8({guess:!0,label:a}),h=N8(!0),g=sq(i),{store:_}=F8(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=E8({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=B8({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:z8}),E=Z.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=dV($B,e.nativeEvent,void 0,{preventUnmountOnClose:hI});d?.(!S,t),t.isCanceled||C(e=>!e)}let O=mB(`div`,e,{state:E,stateAttributesMapping:U8,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,Q.jsx)(R8.Provider,{value:E,children:O})}),cfe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=nfe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=xU(s.checked);return EB({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),mB(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:U8,props:{"aria-hidden":!0,...o},enabled:a||u})}),W8=Z.createContext(void 0);function lfe(){let e=Z.useContext(W8);if(e===void 0)throw Error(wI(31));return e}var G8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(void 0),c=mB(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(W8.Provider,{value:s,children:c})}),ufe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=sq(a),c=lfe();return xI(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),mB(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),K8=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=H8({guess:!0,label:a}),f=N8(!0),p=sq(i),{store:m}=F8(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=B8({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:z8});return mB(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),dfe=Z.createContext(void 0);function q8(e){let t=Z.useContext(dfe);if(t===void 0&&!e)throw Error(wI(69));return t}var J8=`ArrowUp`,Y8=`ArrowDown`,X8=`ArrowLeft`,Z8=`ArrowRight`,Q8=`Home`,$8=new Set([J8,Y8,X8,Z8,Q8,`End`]),ffe=[`Shift`,`Control`,`Alt`,`Meta`];function pfe(e){return $I(e)&&e.tagName===`INPUT`}function mfe(e){return!!(pfe(e)&&e.selectionStart!=null||$I(e)&&e.tagName===`TEXTAREA`)}function hfe(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=e5(e,t,`left`),a=t5(e),o=t5(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=e5(e,t,`top`),r=t5(e),i=t5(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function e5(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function t5(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var n5=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=F8(),{side:c,align:l}=N8(),u=q8(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;EB({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,dV(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),tW(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=mB(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:hR,props:[p,{onKeyDown(e){u&&$8.has(e.key)&&e.stopPropagation()}},zW(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(sH,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),r5=Z.createContext(void 0);function gfe(){let e=Z.useContext(r5);if(e===void 0)throw Error(wI(32));return e}var i5=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=F8();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Q.jsx)(r5.Provider,{value:n,children:(0,Q.jsx)(_V,{ref:t,...r,portalOwnerRole:o})})});function a5(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=UI(i),[,o]=Z.useState(!1),s=bI(vfe).current,c=bI(_fe).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=UI(()=>{u.current||(u.current=!0,o(e=>!e))}),m=UI((e,t)=>{c.set(e,t),p()}),h=UI(e=>{c.delete(e),p()}),g=UI(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!xfe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&o5(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=bfe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=UI(()=>{let[e,t]=yfe(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});xI(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),xI(()=>{u.current&&v()}),xI(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=UI(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(V8.Provider,{value:b,children:t})}function _fe(){return new Map}function vfe(){return new Set}function yfe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>o5(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function bfe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function xfe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function o5(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var s5=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),c5={},l5={},u5=``;function d5(e,t){return tL(e)?e:t}function f5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(d5(t,n)).overflowY)}function Sfe(e){if(typeof document>`u`)return!1;let t=yL(e);return YI(t).innerWidth-t.documentElement.clientWidth>0}function Cfe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=yL(e),n=t.documentElement,r=t.body,i=d5(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function wfe(e){let t=yL(e),n=t.documentElement,r=t.body,i=d5(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Tfe(e){let t=yL(e),n=t.documentElement,r=t.body,i=YI(n),a=0,o=0,s=!1,c=CL.create();if(zL&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,c5={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},u5=n.style.scrollBehavior,l5={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=d5(n,r);s=Cfe(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,c5),Object.assign(r.style,l5),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=u5)}function d(){u(),c.request(l)}l();let f=bL(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Efe=new class{lockCount=0;restore=null;timeoutLock=EL.create();timeoutUnlock=EL.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=yL(e),n=t.documentElement,r=t.body,i=YI(n);if(f5(i,n,r)){let t=new i.MutationObserver(()=>{f5(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=PL||!Sfe(e);this.restore=a?wfe(e):Tfe(e)}};function p5(e=!0,t=null){xI(()=>{if(e)return Efe.acquire(t)},[e,t])}var Dfe=20;function m5(e,t,n,r){let[i,a]=Z.useState(!1);xI(()=>{if(!e||!t||n==null){a(!1);return}let r=yL(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Dfe)},[e,t,n]),p5(e&&(!t||i),r)}var h5=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=NB,style:g,..._}=e,{store:v}=F8(),y=gfe(),b=L8(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Z.useRef(null),R=TB(A),ee=n,z=c,te=l,ne=s,re=h;x.type===`context-menu`&&(ee=n??x.context?.anchor,ne??=`start`,!o&&ne!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let ie=o,ae=ne;x.type===`menu`?(ie??=`inline-end`,ae??=`start`,re=e.collisionAvoidance??PB):x.type===`menubar`&&(ie??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ae??=`start`);let oe=x.type===`context-menu`,se=IW({anchor:ee,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:ie,sideOffset:z,align:ae,alignOffset:te,arrowPadding:oe?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:re,shift:oe?{crossAxis:!(`side`in re&&re.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,dV(aV)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,dV(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ce=DL();Z.useEffect(()=>{T||ce.clear()},[T,ce]),Z.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ce.isStarted()||ce.start(e,()=>{v.setOpen(!1,dV(aV))}):v.setOpen(!1,dV(aV))}else ce.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ce]),Z.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),xI(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let le={open:T,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:x.type===`menu`,instant:j},ue=x.type===`menubar`&&x.context.modal;m5(T&&(ue||E&&N!==`trigger-hover`),D===`touch`,A,O);let de=BW(e,le,{styles:se.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),fe=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),pe=null;return x.type===`menubar`?pe=x.context.contentElement:x.type===void 0&&(pe=O),(0,Q.jsxs)(M8.Provider,{value:se,children:[fe&&(0,Q.jsx)(s5,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:xB(!T),cutout:pe}),(0,Q.jsx)(ZV,{id:P,children:(0,Q.jsx)(a5,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),g5=Z.createContext(void 0);function Ofe(){let e=Z.useContext(g5);if(e===void 0)throw Error(wI(34));return e}var kfe=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Z.useState(void 0),[p,m]=E8({controlled:i,default:a,name:`MenuRadioGroup`}),h=UI((e,t)=>{o?.(e,t),t.isCanceled||m(e)}),g=mB(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Z.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,Q.jsx)(W8.Provider,{value:f,children:(0,Q.jsx)(g5.Provider,{value:_,children:g})})})),_5=Z.createContext(void 0);function Afe(){let e=Z.useContext(_5);if(e===void 0)throw Error(wI(35));return e}var jfe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=H8({guess:!0,label:a}),p=N8(!0),m=sq(i),{store:h}=F8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Ofe(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=B8({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:z8}),E=Z.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=dV($B,e.nativeEvent,void 0,{preventUnmountOnClose:hI});y(l,t)}let O=mB(`div`,e,{state:E,stateAttributesMapping:U8,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,Q.jsx)(_5.Provider,{value:E,children:O})}),Mfe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Afe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=xU(s.checked);return EB({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),mB(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:U8,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),Nfe=Z.createContext(null);function v5(e){let t=Z.useContext(Nfe);if(t===null&&!e)throw Error(wI(5));return t}function Pfe(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function y5(e,t){let{onClick:n,onPointerDown:r}=Pfe(UI((n,r)=>{(typeof e==`function`?e():e)||t(r||(PL?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function b5(e){let[t,n]=Z.useState(null),r=y5(e,n);return O8(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Ffe={...UU,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Ife=class extends KI{constructor(e,t,n=!1){let r=new IU,i=Rfe(r,t,n,e);super(i,Lfe(r),Ffe),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef}else e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function Lfe(e){return{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Rfe(e,t,n=!1,r){return{...LU(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new GV,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:_I,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var zfe=Z.createContext(void 0);function Bfe(){return Z.useContext(zfe)}var x5=jI(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=L8(!0),_=F8(!0),v=v5(!0),y=Bfe(),b=Z.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=BB(),S=BB(),C=JV(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=bI(()=>T?w?.state.instantType:void 0).current,D=Vfe({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=XV(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),ee=D.useState(`floatingParentNodeId`),z=Z.useRef(null),te=Z.useRef(I.type!==`context-menu`),ne=DL(),re=Z.useRef(!0),ie=DL(),ae=ee!=null,{openMethod:oe,triggerProps:se}=b5(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:oe,rootId:x}),MU(D);let{forceUnmount:ce,transitionStatus:le}=NU(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),ue=TB(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(le!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return ue(e,t.signal),()=>{t.abort()}},[E,A,le,ue,D]),xI(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),Z.useEffect(()=>{A||(z.current=null),I.type===`context-menu`&&(A?ne.start(500,()=>{te.current=!0}):(ne.clear(),te.current=!1))},[ne,A,I.type]),xI(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let de=UI((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=kU(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!re.current)return;e&&n===`trigger-focus`?(re.current=!1,ie.start(300,()=>{re.current=!0})):(re.current=!0,ie.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);z.current=t.event;let c=OU(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),fe=bU({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:de}),pe=fe.context.events;xI(()=>{let e=({open:e,eventDetails:t})=>de(e,t);return pe.on(`setOpen`,e),()=>{pe?.off(`setOpen`,e)}},[pe,de]);let me=Z.useCallback(()=>{D.setOpen(!1,dV(lV))},[D]);Z.useImperativeHandle(u,()=>({unmount:ce,close:me}),[ce,me]);let he;I.type===`context-menu`&&(he=I.context),Z.useImperativeHandle(he?.positionerRef,()=>M,[M]),Z.useImperativeHandle(he?.actionsRef,()=>({setOpen:de}),[de]);let ge=mH(fe,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||z.current?.type===`contextmenu`||te.current},externalTree:ae?O:void 0}),_e=SW(),ve=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),ye=dW(fe,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:_e===`rtl`,disabledIndices:gI,onNavigate:ve,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:ae?O:void 0,focusItemOnHover:h}),be=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),xe=fW(fe,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:be}),Se=Z.useMemo(()=>{let e=eB(xe.reference,ye.reference,ge.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,xe.reference,ye.reference,ge.reference,se,A]),Ce=Z.useMemo(()=>{let e=eB(ye.trigger,ge.trigger,se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ye.trigger,ge.trigger,se]);bI(()=>(D.update({inactiveTriggerProps:Ce}),null)),PU(D,{floatingRootContext:fe,activeTriggerProps:Se,inactiveTriggerProps:Ce,popupProps:Z.useMemo(()=>eB(SU,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},xe.floating,ye.floating,ge.floating),[j,S,l,I.type,D,xe.floating,ye.floating,ge.floating]),itemProps:ye.item??_I});let we=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Te=(0,Q.jsxs)(P8.Provider,{value:we,children:[f&&(0,Q.jsx)(TU,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(QV,{externalTree:O,children:Te}):Te});function Vfe(e,t,n){return bI(()=>new Ife(e,t,n)).current}var S5=5;function C5(e,t){let n=Hfe(t);return e.clientX>=n.left-S5&&e.clientX<=n.right+S5&&e.clientY>=n.top-S5&&e.clientY<=n.bottom+S5}function Hfe(e){let t=e.getBoundingClientRect(),n=YI(e);if(VL)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function w5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=HB(),{ref:i,index:a}=H8(e),o=n===a,s=Z.useRef(null),c=Hz(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Ufe(e){let{render:t,className:n,style:r,state:i=_I,props:a=gI,refs:o=gI,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=w5({metadata:s});return mB(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function T5(e){if($I(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!dL(e))return T5(mL(e))}function E5(e,t){let n=Z.useRef(null);function r(t){SI.flushSync(()=>{e.setOpen(!1,dV(tV,t.nativeEvent,t.currentTarget))}),Pz(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Fz(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{SI.flushSync(()=>{e.setOpen(!1,dV(tV,n.nativeEvent,n.currentTarget))});let i=Nz(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&UL(r,i);){let e=i;if(i=Az(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Wfe(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,yL(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:_I,[t,n,r])}var Gfe=MI(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=F8(!0),h=WU(d)??m?.store;if(!h)throw Error(wI(85));let g=sq(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=qfe(),C=HB(!0),w=YV(),T=Z.useMemo(()=>w??new GV,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=jU(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:XV(T),floatingParentNodeId:JV(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=GB({disabled:A,native:o});Z.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Z.useRef(null),P=DL(),F=UI(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;UL(N.current,t)||UL(h.select(`positionerElement`),t)||t===N.current||t!=null&&T5(t)===h.select(`rootId`)||C5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:iV})});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&yL(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=rW(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:bW({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Kfe(y,h.select(`lastOpenChangeReason`)),ee=cH(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=YU(v,{enabled:!A&&I}),te=Wfe({open:y,enabled:O,mouseDownAction:`open`}),ne=Z.useMemo(()=>eB(z.reference,ee.reference),[z.reference,ee.reference]),re=h.useState(`triggerProps`,D),{preFocusGuardRef:ie,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:oe}=E5(h,x),se={disabled:A,open:y},ce=[N,t,M,E,x],le=[ne,L??_I,re,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),yL(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},te,p,j],ue=mB(`button`,e,{enabled:!O,stateAttributesMapping:pR,state:se,ref:ce,props:le});return O?(0,Q.jsx)(Ufe,{tag:`button`,render:n,className:r,style:i,state:se,refs:ce,props:le,stateAttributesMapping:pR}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Vz,{ref:ie,onFocus:ae},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:ue},g),(0,Q.jsx)(Vz,{ref:h.context.triggerFocusTargetRef,onFocus:oe},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:ue},g)});function Kfe(e,t){let n=DL(),[r,i]=Z.useState(!1);return xI(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function qfe(){let e=v5(!0);return Z.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function D5(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function O5({...e}){return(0,Q.jsx)(x5,{"data-slot":`dropdown-menu`,...e})}function k5({...e}){return(0,Q.jsx)(Gfe,{"data-slot":`dropdown-menu-trigger`,...e})}function A5({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,Q.jsx)(i5,{children:(0,Q.jsx)(h5,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Q.jsx)(n5,{"data-slot":`dropdown-menu-content`,className:jG(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),...a})})})}function j5({...e}){return(0,Q.jsx)(G8,{"data-slot":`dropdown-menu-group`,...e})}function M5({className:e,inset:t,...n}){return(0,Q.jsx)(ufe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:jG(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function Jfe({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(K8,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:jG(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Yfe({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(sfe,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:jG(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),checked:n,...i,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,Q.jsx)(cfe,{children:(0,Q.jsx)(rK,{})})}),t]})}function Xfe({...e}){return(0,Q.jsx)(kfe,{"data-slot":`dropdown-menu-radio-group`,...e})}function Zfe({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(jfe,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:jG(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Q.jsx)(Mfe,{children:(0,Q.jsx)(rK,{})})}),t]})}function Qfe({className:e,...t}){return(0,Q.jsx)(J6,{"data-slot":`dropdown-menu-separator`,className:jG(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var $fe={desktop:NK,laptop:TK,server:VK,cloud:hK};function N5(e){let t=(0,VW.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=$fe[n],a;return t[3]!==i||t[4]!==r?(a=(0,Q.jsx)(i,{...r}),t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function epe(e){let t=(0,VW.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${C3[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(zG,{variant:`ghost`,size:`sm`,disabled:r,"aria-label":a}),t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(N5,{icon:n}),t[3]=n,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,Q.jsxs)(k5,{render:o,children:[s,`Icon`]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(M5,{children:`Icon of this computer`}),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=e=>i(e),t[9]=i,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=$ce.map(tpe),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==u?(f=(0,Q.jsx)(A5,{align:`end`,className:`w-44`,children:(0,Q.jsxs)(j5,{children:[l,(0,Q.jsx)(Xfe,{value:n,onValueChange:u,children:d})]})}),t[12]=n,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==c||t[16]!==f?(p=(0,Q.jsxs)(O5,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function tpe(e){return(0,Q.jsxs)(Zfe,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(N5,{icon:e}),C3[e]]},e)}function P5(e){switch(e.status){case`checking`:return`Checking for a new version…`;case`downloading`:return`Downloading ${e.version}…`;case`ready`:return`${e.version} is ready; the app restarts to finish.`;case`installing`:return`Installing ${e.version}; the app restarts in a moment.`;default:return}}function npe(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var rpe=Nk(Q3.layer).atom(Op(Q3,e=>t=>e.installUpdate.pipe(Fp(e=>new J4({message:e.message}))))),ipe=Ck(e=>{e.addFinalizer(M6.state.subscribe(()=>e.refreshSelf())),e.addFinalizer(P6.subscribe(()=>e.refreshSelf()));let t=[],n=[],r=!1,i=M6.state.value.connection,a=er(Bw(e(g8)));if(i&&a){if(a.isDesktopShell){let i=e(_8),a=er(sr(Bw(i))),o=er(Bw(e(v8)));r||=i.waiting;let s=L5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=er(Bw(e(rpe)));a&&c&&t.push({current:a.current,checking:i.waiting,error:L5(o,i),note:o?npe(o):void 0,target:{kind:`mac-app`,id:`mac-app`,name:`Mac app`,available:jw(i)&&o?.status===`available`&&!i.waiting,latest:o&&`version`in o?o.version:void 0,update:c}})}else{let a=e(w4(i));r||=a.waiting,Nw(a)&&n.push({id:i.environmentId,name:`This computer`,message:I4(wu(a.cause))});let o=v4(a),s=er(Bw(e($4(i))));o&&t.push({current:o.version,target:{kind:`service`,id:i.environmentId,name:s?.environment.name??`This computer`,connection:i,state:o,deviceId:O6.value}})}}for(let{remote:i,connection:a}of P6.value){a.activeRoute&&e.addFinalizer(a.activeRoute.subscribe(()=>e.refreshSelf()));let o=e(r4(D6,i,a));if(o.kind!==`online`)continue;let s=e(w4(a));r||=s.waiting,Nw(s)&&n.push({id:i.environmentId,name:o.name,message:I4(wu(s.cause))});let c=v4(s);c&&t.push({current:c.version,target:{kind:`service`,id:i.environmentId,name:o.name,connection:a,state:c,deviceId:a.activeRoute?.value?.deviceId??i.deviceId}})}return{rows:t,failures:n,checking:r}}),F5=Rk((e,t)=>{let n=M6.state.value.connection,r=er(Bw(t(g8)));e===`retry`&&r?.isDesktopShell&&!t(_8).waiting&&t.refresh(_8);let i=new Set([...n&&!r?.isDesktopShell?[n]:[],...P6.value.map(({connection:e})=>e)]);for(let e of i){let n=w4(e);t(n).waiting||t.refresh(n)}}),ape=Ck(e=>{jw(e(g8))&&e.set(F5,`entry`)}).pipe(pk(0));function ope(){aI(ape)}function I5(){let e=(0,VW.c)(11),{rows:t,failures:n,checking:r}=tI(ipe),i=oI(F5),a=tI(q4),[o,s]=cI(bce),c;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o||e[5]!==t||e[6]!==s){let l=t.map(spe),u,d;e[8]===i?(u=e[9],d=e[10]):(u=()=>i(`entry`),d=()=>i(`retry`),e[8]=i,e[9]=u,e[10]=d),c={rows:t,failures:n,checking:r,refresh:u,retry:d,batch:a,result:o,run:s,targets:l,count:_ce(l)},e[0]=a,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=t,e[6]=s,e[7]=c}else c=e[7];return c}function spe(e){return e.target}function L5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&Nw(t))return I4(wu(t.cause))}function cpe(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=E8({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=xU(a,!0,!0),u=sq(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=UI(e=>{let t=!a,n=dV(YB,e.nativeEvent);r(t,n),n.isCanceled||o(t)});return Z.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var R5=Z.createContext(void 0);function z5(){let e=Z.useContext(R5);if(e===void 0)throw Error(wI(15));return e}var lpe=`data-open`,upe=`data-closed`,dpe=ZL,fpe=`data-panel-open`,ppe={[lpe]:``},mpe={[upe]:``},hpe={open(e){return e?{[fpe]:``}:null}},B5={open(e){return e?ppe:mpe},...tR},gpe=Z.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=UI(o),d=cpe({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=Z.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=Z.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=mB(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:B5});return(0,Q.jsx)(R5.Provider,{value:p,children:m})}),_pe={...hpe,...tR},vpe=Z.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=z5(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=GB({disabled:c,focusableWhenDisabled:!0,native:u});return mB(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:_pe})}),V5={height:void 0,width:void 0};function ype(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=Z.useRef(null),f=Z.useRef(null),[p,m]=Z.useState(V5),h=Z.useRef(V5),g=Z.useRef(!1),_=Z.useRef(s),v=Z.useRef(!1),[y,b]=Z.useState(!1),x=Z.useRef(null),S=Hz(t,d),C=yV(s),w=TB(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=UI((e,t=!0)=>{t&&(h.current=e),m(e)}),j=UI(()=>{x.current?.(),x.current=null}),M=UI(e=>{j(),x.current=()=>{x.current=null,e()}}),N=UI(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});xI(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),xI(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=bpe(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=H5(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(H5(e)),b(!0);return}if(t===`css-transition`){let t=xpe(e);if(A(H5(e)),!n)return t;let r=W5(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(H5(e));let r=W5(e,`animation-name`,`none`);if(!n){r();return}let i=W5(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(V5,!1),c(!1);return}A(H5(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=H5(e);n.height>0||n.width>0?(A(n),t===`css-animation`&&W5(e,`animation-name`,`none`)()):c(!1)},[a,s,j,A,c,M,D,u]),EB({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(V5,!1)}}),Z.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(V5,!1))}return t=CL.request(()=>{w(n,e.signal)}),()=>{CL.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),xI(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),Z.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=dV(JB,e);o(!0,t),t.isCanceled||(g.current=!0,l(!0))}return bL(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[dpe]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function H5(e){return{height:e.scrollHeight,width:e.scrollWidth}}function bpe(e,t){let n=YI(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&U5(n.animationDuration),i=U5(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function U5(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function W5(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function xpe(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=CL.request(n);return()=>{CL.cancel(r),n()}}var Spe=`--collapsible-panel-height`,Cpe=`--collapsible-panel-width`,wpe=Z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=z5(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;xI(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=ype({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=Qz(s,k),j=mB(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[Spe]:S===void 0?`auto`:`${S}px`,[Cpe]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:B5});return E?j:null});function G5({...e}){return(0,Q.jsx)(gpe,{"data-slot":`collapsible`,...e})}function K5({...e}){return(0,Q.jsx)(vpe,{"data-slot":`collapsible-trigger`,...e})}function q5({...e}){return(0,Q.jsx)(wpe,{"data-slot":`collapsible-content`,...e})}function J5(e){let t=(0,VW.c)(86),{row:n,showName:r,prominent:i}=e,a=r!==void 0&&r,o=i!==void 0&&i,{target:s,current:c}=n,{batch:l,run:u}=I5(),d=y8(),f=I6(),p;if(t[0]!==l.entries||t[1]!==s.id||t[2]!==s.kind){let e;t[4]!==s.id||t[5]!==s.kind?(e=e=>e.id===s.id&&e.kind===s.kind,t[4]=s.id,t[5]=s.kind,t[6]=e):e=t[6],p=l.entries.find(e),t[0]=l.entries,t[1]=s.id,t[2]=s.kind,t[3]=p}else p=t[3];let m=p,h=K4(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?gce(s):void 0,t[7]=s,t[8]=g);let _=g,v;t[9]!==d||t[10]!==s.kind||t[11]!==s.state?(v=s.kind===`service`?Ple(s.state,!1):P5(d),t[9]=d,t[10]=s.kind,t[11]=s.state,t[12]=v):v=t[12];let y=v;n.checking&&(y=`Checking for a new version…`);let b;t[13]!==s.kind||t[14]!==s.state?(b=s.kind===`service`?Fle(s.state):void 0,t[13]=s.kind,t[14]=s.state,t[15]=b):b=t[15];let x=b,S=s.kind===`service`?s.state.latest:s.latest,C=l.running&&(m?.status===`updating`||m?.status===`queued`),w;if(C||y){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[16]=e):e=t[16];let n=y??(m?.status===`queued`?`Queued`:`Updating…`),r;t[17]===n?r=t[18]:(r=(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs leading-4`,children:[e,n]}),t[17]=n,t[18]=r),w=r}else if(h){let e=s.kind===`mac-app`?`Restart to update`:`Update ${s.name}`,n;t[19]!==u||t[20]!==s?(n=()=>u([s]),t[19]=u,t[20]=s,t[21]=n):n=t[21];let r=s.kind===`mac-app`?`Restart to update`:`Update`,i;t[22]!==l.running||t[23]!==e||t[24]!==n||t[25]!==r?(i=(0,Q.jsx)(zG,{size:`sm`,"aria-label":e,disabled:l.running,onClick:n,children:r}),t[22]=l.running,t[23]=e,t[24]=n,t[25]=r,t[26]=i):i=t[26],w=i}else if(_&&s.kind===`service`&&s.state.available){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)(jK,{}),`Needs trust`]}),t[27]=e):e=t[27],w=e}else{let e=n.note??(S?`Up to date`:`Latest version unavailable`);s.kind===`service`&&!s.state.managed&&(e=`Managed on that computer`);let r;t[28]!==e||t[29]!==n.error?(r=!n.error&&(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:e}),t[28]=e,t[29]=n.error,t[30]=r):r=t[30],w=r}let T=`${s.name} update`,E=o?`gap-x-6 gap-y-3`:`gap-3`,D;t[31]===E?D=t[32]:(D=jG(`flex flex-wrap items-center justify-between`,E),t[31]=E,t[32]=D);let O;t[33]!==a||t[34]!==s.name?(O=a&&(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:s.name}),t[33]=a,t[34]=s.name,t[35]=O):O=t[35];let k=o?`text-sm leading-5 font-medium`:`text-xs leading-4 text-muted-foreground`,A;t[36]===k?A=t[37]:(A=jG(`tabular-nums`,k),t[36]=k,t[37]=A);let j=c??`Development build`,M;t[38]===j?M=t[39]:(M=(0,Q.jsx)(`span`,{children:j}),t[38]=j,t[39]=M);let N;t[40]!==S||t[41]!==s?(N=G4(s)&&S&&(0,Q.jsxs)(Q.Fragment,{children:[` → `,S]}),t[40]=S,t[41]=s,t[42]=N):N=t[42];let P;t[43]!==A||t[44]!==M||t[45]!==N?(P=(0,Q.jsxs)(`p`,{className:A,children:[M,N]}),t[43]=A,t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;t[47]!==O||t[48]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,P]}),t[47]=O,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==w||t[51]!==F||t[52]!==D?(I=(0,Q.jsxs)(`div`,{className:D,children:[F,w]}),t[50]=w,t[51]=F,t[52]=D,t[53]=I):I=t[53];let L;t[54]!==s.kind||t[55]!==s.state||t[56]!==_?(L=_&&s.kind===`service`&&s.state.available&&(0,Q.jsx)(q5,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:_.hint}),_.deviceId&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`break-all`,children:_.deviceId}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>jq(_.deviceId??``,`device ID`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy device ID`})]})]})]})}),t[54]=s.kind,t[55]=s.state,t[56]=_,t[57]=L):L=t[57];let R;t[58]===n.error?R=t[59]:(R=n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:n.error}),t[58]=n.error,t[59]=R);let ee;t[60]===m?ee=t[61]:(ee=m?.status===`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m.message}),t[60]=m,t[61]=ee);let z;t[62]!==m?.status||t[63]!==x||t[64]!==C?(z=!C&&x?.kind===`failed`&&m?.status!==`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:x.reason}),t[62]=m?.status,t[63]=x,t[64]=C,t[65]=z):z=t[65];let te;t[66]===m?te=t[67]:(te=m?.status===`updated`&&(0,Q.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Updated to `,m.version,`.`]}),t[66]=m,t[67]=te);let ne;t[68]!==m?.status||t[69]!==f?.environmentId||t[70]!==s.id||t[71]!==s.kind?(ne=m?.status===`updated`&&s.kind===`service`&&f?.environmentId===s.id&&(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,className:`self-start`,onClick:Tpe,children:`Reload`}),t[68]=m?.status,t[69]=f?.environmentId,t[70]=s.id,t[71]=s.kind,t[72]=ne):ne=t[72];let re;t[73]!==s.kind||t[74]!==s.state?(re=s.kind===`service`&&!s.state.managed&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This computer runs outside the installed service. Update it with npm, then run porcelain service update.`}),t[73]=s.kind,t[74]=s.state,t[75]=re):re=t[75];let ie;return t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==ee||t[80]!==z||t[81]!==te||t[82]!==ne||t[83]!==re||t[84]!==T?(ie=(0,Q.jsx)(G5,{children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,role:`group`,"aria-label":T,children:[I,L,R,ee,z,te,ne,re]})}),t[76]=I,t[77]=L,t[78]=R,t[79]=ee,t[80]=z,t[81]=te,t[82]=ne,t[83]=re,t[84]=T,t[85]=ie):ie=t[85],ie}function Tpe(){return window.location.reload()}function Y5(e){let t=(0,VW.c)(19),{connection:n,prominent:r}=e,{rows:i}=I5(),a;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n,t[4]=e),a=i.find(e),t[0]=n,t[1]=i,t[2]=a}else a=t[2];let o=a,s=Dde(n),c;t[5]===n?c=t[6]:(c=w4(n),t[5]=n,t[6]=c);let l=sI(c);if(o){let e;return t[7]!==r||t[8]!==o?(e=(0,Q.jsx)(J5,{row:o,prominent:r}),t[7]=r,t[8]=o,t[9]=e):e=t[9],e}if(Nw(s)){let e;t[10]===s.cause?e=t[11]:(e=I4(wu(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:s.waiting,onClick:l,children:`Try again`}),t[12]=l,t[13]=s.waiting,t[14]=n):n=t[14];let r;return t[15]!==e||t[16]!==n?(r=(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsxs)(u8,{children:[e,n]})}),t[15]=e,t[16]=n,t[17]=r):r=t[17],r}let u;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(U6,{}),t[18]=u):u=t[18],u}function Epe(e){let t=(0,VW.c)(3),{prominent:n}=e,r=n!==void 0&&n,i=I6(),a;return t[0]!==i||t[1]!==r?(a=i&&(0,Q.jsx)(Y5,{connection:i,prominent:r}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function Dpe(e){let t=(0,VW.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Y5,{connection:n,prominent:!0}),t[0]=n,t[1]=r),r}function Ope(e){let t=(0,VW.c)(7),{prominent:n}=e,r=n!==void 0&&n,{rows:i,checking:a}=I5(),o;t[0]===i?o=t[1]:(o=i.find(kpe),t[0]=i,t[1]=o);let s=o;if(s){let e;return t[2]!==r||t[3]!==s?(e=(0,Q.jsx)(J5,{row:s,prominent:r}),t[2]=r,t[3]=s,t[4]=e):e=t[4],e}let c;return t[5]===a?c=t[6]:(c=a?(0,Q.jsx)(U6,{}):null,t[5]=a,t[6]=c),c}function kpe(e){let{target:t}=e;return t.kind===`mac-app`}var X5=Z.createContext(void 0);function Ape(){let e=Z.useContext(X5);if(e===void 0)throw Error(wI(63));return e}var jpe=`data-checked`,Mpe=`data-unchecked`,Z5={...b8,checked(e){return e?{[jpe]:``}:{[Mpe]:``}}},Npe=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=S8(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=x8(),{labelId:j}=C8(),M=O||m,N=k??l,P=Z.useRef(null),F=Hz(P,c,A.inputRef),I=Z.useRef(null),L=sq(),R=T8({id:s}),ee=u?void 0:R,[z,te]=E8({controlled:n,default:!!i,name:`Switch`,state:`checked`});D8(I,L,z,void 0,!M,l),xI(()=>{T(z)},[z,T]),O8(z,()=>{b(N),C(z!==w.initialValue),A.change(z)});let{getButtonProps:ne,buttonRef:re}=GB({disabled:M,native:u}),ie=w8(a,j,P,!u,ee),ae={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&WB(t,e)}},oe={...A.getValidationProps(M),checked:z,disabled:M,form:o,id:ee,name:N,required:p,style:N?Bz:zz,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=dV(JB,e.nativeEvent);d?.(t,n),n.isCanceled||te(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?_I:{value:_}},se=Z.useMemo(()=>({...x,checked:z,disabled:M,readOnly:f,required:p}),[x,z,M,f,p]),ce=mB(`span`,e,{state:se,ref:[t,I,re],props:[ae,y,ne,e=>A.getValidationProps(M,e)],stateAttributesMapping:Z5});return(0,Q.jsxs)(X5.Provider,{value:se,children:[ce,!z&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),Ppe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return mB(`span`,e,{state:Ape(),ref:t,stateAttributesMapping:Z5,props:a})});function Q5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Npe,{"data-slot":`switch`,"data-size":t,className:jG(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,Q.jsx)(Ppe,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function Fpe(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}var $5=Z.createContext(void 0),e7=Z.createContext(void 0),t7=Z.createContext(void 0);function n7(){let e=Z.useContext($5);if(e===void 0)throw Error(wI(60));return e}function r7(){let e=Z.useContext(e7);if(e===void 0)throw Error(wI(101));return e}function i7(){let e=Z.useContext(t7);if(e===void 0)throw Error(wI(61));return e}function Ipe(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var a7=(e,t)=>Object.is(e,t);function o7(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Lpe(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Ipe(e,t,(e,t)=>o7(e,t,n)):e!==t}function s7(e,t,n){return e?e.some(e=>e!==void 0&&o7(t,e,n)):!1}function c7(e,t,n){return e?e.findIndex(e=>e!==void 0&&o7(e,t,n)):-1}function Rpe(e,t){if(t!==a7)return n=>s7(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function l7(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Rpe(t,n)):c7(e,t,n);return i===-1?null:i}function zpe(e,t,n,r,i,a){return s7(r,t,i)?a!=null&&e>a&&s7(r,n[a],i)?a:e:e===a?l7(n,r,i,!0):a}function Bpe(e,t,n){return e.filter(e=>!o7(t,e,n))}function u7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vpe(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function d7(e){return Vpe(e?.[0])}function Hpe(e){return d7(e)?e.flatMap(e=>e.items):e}function Upe(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(d7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function f7(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return u7(e)}function p7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?u7(e.value):u7(e)}function m7(e,t,n){function r(){return f7(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Hpe(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Wpe(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:m7(r,t,n)},i)),e),[])}var Gpe={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:p7(t,r)!==``},hasNullItemLabel:(e,t)=>t?Upe(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>o7(t,e,n)):o7(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function h7(e,t){return Math.max(0,e-t)}function g7(e,t){if(t<=0)return 0;let n=IB(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Kpe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=a7,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=S8(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=x8(),F=T8({id:t}),I=M||d,L=j??c,[R,ee]=E8({controlled:n,default:y?r??gI:r,name:`Select`,state:`value`}),[z,te]=E8({controlled:a,default:o,name:`Select`,state:`open`}),ne=Z.useRef([]),re=Z.useRef([]),ie=Z.useRef(null),ae=Z.useRef(null),oe=Z.useRef(0),se=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),de=Z.useRef(null),fe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=Z.useRef(!1),me=Z.useRef(R),{mounted:he,setMounted:ge,transitionStatus:_e}=xU(z),{openMethod:ve,triggerProps:ye}=b5(z),be=bI(()=>new KI({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:he,transitionStatus:_e,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:_I,triggerProps:_I,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:hI,setOpen:hI,handleScrollArrowVisibility:hI,onOpenChangeComplete:hI,listRef:ne,popupRef:ie,scrollHandlerRef:ae,scrollArrowsMountedCountRef:oe,valueRef:se,valuesRef:ce,labelsRef:re,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},Gpe)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=Cq(ve),Ee=ve??Te,De=Z.useMemo(()=>y?``:p7(R,x),[y,R,x]),Oe=Z.useMemo(()=>y&&Array.isArray(R)?R.map(e=>p7(e,x)):p7(R,x),[y,R,x]);D8(yV(Ce),F,R,UI(()=>Oe),!I,c);let ke=y?Array.isArray(R)&&R.length>0:R!=null&&De!==``;xI(()=>{A(ke)},[ke,A]),xI(function(){let e=l7(ce.current,R,S,y);e===null&&(de.current=null),z||be.set(`selectedIndex`,e)},[y,z,R,S,be]),O8(R,()=>{T(L),E(Lpe(R,k.initialValue,S)),N.change(R)});let Ae=UI((e,t)=>{s?.(e,t),t.isCanceled||(te(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),je=UI(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});EB({enabled:!h,open:z,ref:ie,onComplete(){z||je()}}),Z.useImperativeHandle(h,()=>({unmount:je}),[je]);let Me=UI((e,t)=>{i?.(e,t),t.isCanceled||ee(e)}),Ne=UI(e=>{let t=h7(e.scrollHeight,e.clientHeight),n=g7(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=GU({open:z,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=cH(Pe,{enabled:!I,event:`mousedown`}),Ie=mH(Pe),Le=dW(Pe,{enabled:!I,listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:gI,onNavigate(e){(e!==null||z)&&be.set(`activeIndex`,e)},focusItemOnHover:C}),Re=fW(Pe,{enabled:!I&&(z||!f&&!y),listRef:re,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>D5(ne.current[e]),onMatch(e){z?be.set(`activeIndex`,e):Me(ce.current[e],dV(JB))},onTyping(e){le.current=e}}),ze=Z.useMemo(()=>eB(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=Z.useMemo(()=>eB(SU,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??_I;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,_),Fpe(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:z,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ee});let He=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Ve}),[I,f,p,y,C,Ve]),Ue=Hz(g,N.inputRef),We=y?void 0:L,Ge=Z.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=p7(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,Q.jsxs)($5.Provider,{value:be,children:[(0,Q.jsx)(e7.Provider,{value:He,children:(0,Q.jsx)(t7.Provider,{value:Pe,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=dV(JB,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>p7(t,x).toLowerCase()===e||f7(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=re.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&We==null?`${F}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:I,required:p&&!(y&&ke),readOnly:f,ref:Ue,style:L?Bz:zz,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function qpe(e,t){return e??t}var Jpe=`data-popup-side`,Ype=400,Xpe={...pR,...b8,popupSide:e=>e?{[Jpe]:e}:null,value:()=>null},Zpe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=x8(),{labelId:h}=C8(),g=n7(),{readOnly:_,required:v,disabled:y}=r7(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=qpe(h,k);T8({id:i});let P=yV(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:L}=GB({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),ee=DL(),z=DL(),te=DL();Z.useEffect(()=>{if(x)return te.start(Ype,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[x,g,z,te]);let ne=eB(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??wR(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,dV(JB,e.nativeEvent)),ee.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){UL(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=yL(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;UL(F.current,t)||UL(P.current,t)||C5(e,F.current)||g.context.setOpen(!1,dV(iV,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),re=f.getValidationProps(b,ne);re.role=`combobox`;let ie={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return mB(`button`,e,{ref:[t,F,L,R],state:ie,stateAttributesMapping:Xpe,props:re})}),Qpe={value:()=>null},$pe=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=n7(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?Wpe(l,u,d):m7(l,u,d)),mB(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:Qpe})}),eme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return mB(`span`,e,{state:{open:n7().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:fR})}),tme=Z.forwardRef(function(e,t){let n=n7(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(_V,{ref:t,...e}):null}),_7=Z.createContext(void 0);function v7(){let e=Z.useContext(_7);if(!e)throw Error(wI(59));return e}function y7(e,t){e&&Object.assign(e.style,t)}var b7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},nme={position:`fixed`},rme=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=NB,style:_,...v}=e,y=n7(),b=i7(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=Z.useRef(null),j=Z.useRef(null),[M,N]=Z.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),Z.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),m5((P||C)&&x,T===`touch`,E,D);let F=IW({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?nme:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};xI(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=BW(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=UI(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=dV(JB);if(t!==0&&!y.state.multiple&&w!==null&&c7(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&c7(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>c7(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};y7(E,e),y7(y.context.popupRef.current,e)}}),ne=Z.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,Q.jsx)(a5,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,Q.jsxs)(_7.Provider,{value:ne,children:[S&&C&&(0,Q.jsx)(s5,{inert:xB(!x),cutout:D}),ee]})})}),x7=`base-ui-disable-scrollbar`,S7={className:x7,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:x7,precedence:`base-ui:low`,children:`.${x7}{scrollbar-width:none}.${x7}::-webkit-scrollbar{display:none}`})}},ime=Z.createContext(void 0),ame={disableStyleElements:!1};function C7(){return Z.useContext(ime)??ame}var w7=`--transform-origin`,ome={...mR,...tR},sme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=n7(),{multiple:c,readOnly:l,highlightItemOnHover:u}=r7(),d=i7(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=v7(),_=q8(!0)!=null,v=SW(),{nonce:y,disableStyleElements:b}=C7(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef({}),N=wL(),P=UI(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=D7(O),i=O7(O.getBoundingClientRect().height,`y`,r),a=yL(O),o=YI(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=T7(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=E7(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=IB(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=IB(g,0,E7(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});Z.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),EB({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};xI(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),xI(()=>{S||m||(j.current=!1,A.current=!1,y7(O,M.current))},[S,m,O]),xI(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(w7),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=cme(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=YI(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=yL(D),c=D7(D),l=k7(D.getBoundingClientRect(),c),d=k7(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=T7(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=k7(n.getBoundingClientRect(),c);T=k7(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${IB(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=E7(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&zL;if(z||te){y7(O,M.current),g(!1);return}let ne=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=E7(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=IB(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(w7,`50% ${i}%`)}(ne===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),Z.useEffect(()=>{if(!m||!O||!S)return;let e=YI(O);function t(e){s.context.setOpen(!1,dV(uV,e))}return bL(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&$8.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:b7},className:!k&&m?S7.className:void 0},L=mB(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:ome,props:[T,I,zW(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&S7.getElement(y),(0,Q.jsx)(sH,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function T7(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function E7(e){return h7(e.scrollHeight,e.clientHeight)}function D7(e){return ZH.getScale(e)}function O7(e,t,n){return e/n[t]}function k7(e,t){return az({x:O7(e.x,`x`,t),y:O7(e.y,`y`,t),width:O7(e.width,`x`,t),height:O7(e.height,`y`,t)})}var A7=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function cme(e){let{style:t}=e,n={};for(let[e,r]of A7)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of A7){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var lme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=n7(),{multiple:s,readOnly:c}=r7(),{alignItemWithTriggerActive:l}=v7(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:b7},className:u&&d!==`touch`?S7.className:void 0};return mB(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),j7=Z.createContext(void 0);function M7(){let e=Z.useContext(j7);if(!e)throw Error(wI(57));return e}var ume=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=H8({guess:!0,label:o,textRef:u}),f=n7(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=r7(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=Z.useRef(null);xI(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),xI(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=zpe(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&o7(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Z.useRef(`mouse`),E=Z.useRef(!1),{getButtonProps:D,buttonRef:O}=GB({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?Bpe(n,a,S):[...n,a];f.context.setValue(r,dV($B,e))}else f.context.setValue(a,dV($B,e)),f.context.setOpen(!1,dV($B,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&kR(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,_||i||A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=mB(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Z.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,Q.jsx)(j7.Provider,{value:P,children:N})})),dme=Z.forwardRef(function(e,t){let{selected:n}=M7();return e.keepMounted||n?(0,Q.jsx)(fme,{...e,ref:t}):null}),fme=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=M7(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=xU(s),d=mB(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:tR});return EB({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),pme=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=M7(),a=n7(),{render:o,className:s,style:c,...l}=e;return mB(`div`,e,{ref:[Z.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),N7=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=n7(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=v7(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=DL(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=xU(g);xI(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),EB({open:g,ref:v,onComplete(){g||x(!1)}});let S=mB(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=h7(e.scrollHeight,e.clientHeight),r=g7(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=mme(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:tR});return y||o?S:null});function mme(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?g7(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?g7(l.offsetTop+l.offsetHeight-r+i,a):a}var hme=Z.forwardRef(function(e,t){return(0,Q.jsx)(N7,{...e,ref:t,direction:`down`})}),gme=Z.forwardRef(function(e,t){return(0,Q.jsx)(N7,{...e,ref:t,direction:`up`})}),P7=Z.createContext(void 0);function _me(){let e=Z.useContext(P7);if(e===void 0)throw Error(wI(56));return e}var vme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=mB(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(P7.Provider,{value:c,children:l})}),yme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=_me(),c=sq(a);return xI(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),mB(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),F7=Kpe;function bme({className:e,...t}){return(0,Q.jsx)(vme,{"data-slot":`select-group`,className:jG(`scroll-my-1 p-1`,e),...t})}function I7({className:e,...t}){return(0,Q.jsx)($pe,{"data-slot":`select-value`,className:jG(`flex flex-1 text-left`,e),...t})}function L7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Zpe,{"data-slot":`select-trigger`,"data-size":t,className:jG(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[n,(0,Q.jsx)(eme,{render:(0,Q.jsx)(aK,{className:`pointer-events-none size-3.5 text-muted-foreground`})})]})}function R7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(tme,{children:(0,Q.jsx)(rme,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(sme,{"data-slot":`select-content`,"data-align-trigger":o,className:jG(`isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...s,children:[(0,Q.jsx)(Sme,{}),(0,Q.jsx)(lme,{children:t}),(0,Q.jsx)(Cme,{})]})})})}function xme({className:e,...t}){return(0,Q.jsx)(yme,{"data-slot":`select-label`,className:jG(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function z7({className:e,children:t,...n}){return(0,Q.jsxs)(ume,{"data-slot":`select-item`,className:jG(`relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)(pme,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(dme,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(rK,{className:`pointer-events-none`})})]})}function Sme({className:e,...t}){return(0,Q.jsx)(gme,{"data-slot":`select-scroll-up-button`,className:jG(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(sK,{})})}function Cme({className:e,...t}){return(0,Q.jsx)(hme,{"data-slot":`select-scroll-down-button`,className:jG(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(aK,{})})}var B7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(B7||{}),wme=[0,1],V7=[1,0],H7=[2,3],U7=[3,2],Tme={L:wme,M:V7,Q:H7,H:U7},Eme=/^\d*$/,Dme=/^[A-Z0-9 $%*+./:-]*$/,W7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,G7=1,K7=40,q7=3,Ome=3,J7=40,kme=10,Y7=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],X7=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Ame=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<G7||e>K7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,B7.Timing),this.setFunctionModule(e,6,e%2==0,B7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Q7(r,e));this.setFunctionModule(8,7,Q7(r,6)),this.setFunctionModule(8,8,Q7(r,7)),this.setFunctionModule(7,8,Q7(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Q7(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Q7(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Q7(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Q7(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,B7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,B7.Alignment)}setFunctionModule(e,t,n,r=B7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==a9(t,n))throw RangeError(`Invalid argument`);let r=X7[n[0]][t],i=Y7[n[0]][t],a=Math.floor(i9(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=zme(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Bme(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(i9(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Q7(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=q7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*J7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*J7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=q7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*J7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*J7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Ome)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*kme,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Z7(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Q7(e,t){return!!(e>>>t&1)}var $7=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},jme=[1,10,12,14],Mme=[2,9,11,13],Nme=[4,8,16,16];function e9(e,t){return e[Math.floor((t+7)/17)+1]}function t9(e){let t=[];for(let n of e)Z7(n,8,t);return new $7(Nme,e.length,t)}function Pme(e){if(!n9(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Z7(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new $7(jme,e.length,t)}function Fme(e){if(!r9(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=W7.indexOf(e.charAt(n))*45;r+=W7.indexOf(e.charAt(n+1)),Z7(r,11,t)}return n<e.length&&Z7(W7.indexOf(e.charAt(n)),6,t),new $7(Mme,e.length,t)}function Ime(e){return e===``?[]:n9(e)?[Pme(e)]:r9(e)?[Fme(e)]:[t9(Rme(e))]}function n9(e){return Eme.test(e)}function r9(e){return Dme.test(e)}function Lme(e,t){let n=0;for(let r of e){let e=e9(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Rme(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function i9(e){if(e<G7||e>K7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function a9(e,t){return Math.floor(i9(e)/8)-Y7[t[0]][e]*X7[t[0]][e]}function zme(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=o9(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=o9(n,2)}return t}function Bme(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=o9(t,e))}return n}function o9(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Vme(e,t,n=1,r=40,i=-1,a=!0){if(!(G7<=n&&n<=r&&r<=K7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=a9(o,t)*8,i=Lme(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[V7,H7,U7])a&&s<=a9(o,e)*8&&(t=e);let c=[];for(let t of e){Z7(t.mode[0],4,c),Z7(t.numChars,e9(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=a9(o,t)*8;Z7(0,Math.min(4,l-c.length),c),Z7(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Z7(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Ame(o,t,u,i)}function Hme(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Ime(e):Array.isArray(e)?[t9(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Vme(c,Tme[n],i,a,o,r),u=Ume({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Ume(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=B7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function Wme(e){let t=(0,VW.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=Hme(n,{ecc:`M`,border:2});r=e,i=a.flatMap(Gme).join(``),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a=i,o=r*2,s=`0 0 ${r} ${r}`,c;t[3]===a?c=t[4]:(c=(0,Q.jsx)(`path`,{d:a,fill:`currentColor`}),t[3]=a,t[4]=c);let l;return t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`Pairing QR code`,width:o,height:o,viewBox:s,shapeRendering:`crispEdges`,className:`shrink-0 rounded-sm bg-white text-black`,children:c}),t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function Gme(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function Kme(e){let t=(0,VW.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=Bse(r),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!0),[p,m]=(0,Z.useState)(!0),[h,g]=Gde(n),_=p8(n),v;t[0]!==_||t[1]!==h?(v=jw(h)&&jw(_)&&_.value?.grants.some(e=>e.id===h.value?.id)===!0?h.value:null,t[0]=_,t[1]=h,t[2]=v):v=t[2];let y=v,b=o.find(e=>{let{url:t}=e;return t===l})??o[0],x=y&&o.find(e=>{let{url:t}=e;return t===y.address})?.route;if(b===void 0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in above to pair a device.`}),t[3]=e):e=t[3],e}let S=e=>j8(e,async()=>g({label:s.trim(),addresses:[b.url],trusted:d,canManageSharing:p})),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(q6,{htmlFor:`pairing-label`,children:`Device name`}),t[4]=C):C=t[4];let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>c(e.target.value),t[5]=w):w=t[5];let T;t[6]===s?T=t[7]:(T=(0,Q.jsxs)(Z6,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsx)(k8,{id:`pairing-label`,placeholder:`My phone`,maxLength:kle,value:s,onChange:w})]}),t[6]=s,t[7]=T);let E=o.length>1&&(0,Q.jsxs)(Z6,{className:`min-w-0`,children:[(0,Q.jsx)(q6,{htmlFor:`pairing-address`,children:`Opens through`}),(0,Q.jsxs)(F7,{items:o.map(Jme),disabled:a,value:b.url,onValueChange:e=>{e&&u(e)},children:[(0,Q.jsx)(L7,{id:`pairing-address`,"aria-describedby":`pairing-address-url`,className:`w-full`,children:(0,Q.jsx)(I7,{children:p4[b.route]})}),(0,Q.jsx)(R7,{children:o.map(qme)})]}),(0,Q.jsx)(`p`,{id:`pairing-address-url`,className:`text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:b.url})]}),D;t[8]!==a||t[9]!==h.waiting||t[10]!==s?(D=a||h.waiting||s.trim()===``,t[8]=a,t[9]=h.waiting,t[10]=s,t[11]=D):D=t[11];let O;t[12]===h.waiting?O=t[13]:(O=h.waiting?(0,Q.jsx)(U6,{}):(0,Q.jsx)(DK,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(zG,{type:`submit`,size:`sm`,className:`shrink-0`,disabled:D,children:[O,`Create pairing link`]}),t[14]=D,t[15]=O,t[16]=k):k=t[16];let A;t[17]!==T||t[18]!==E||t[19]!==k||t[20]!==S?(A=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:S,children:[T,E,k]}),t[17]=T,t[18]=E,t[19]=k,t[20]=S,t[21]=A):A=t[21];let j;t[22]!==a||t[23]!==p||t[24]!==m?(j=(0,Q.jsx)(Q5,{id:`pairing-management`,checked:p,disabled:a,onCheckedChange:m}),t[22]=a,t[23]=p,t[24]=m,t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(q6,{htmlFor:`pairing-management`,children:`Can manage sharing`}),t[26]=M):M=t[26];let N;t[27]===j?N=t[28]:(N=(0,Q.jsxs)(Z6,{orientation:`horizontal`,children:[j,M]}),t[27]=j,t[28]=N);let P;t[29]!==a||t[30]!==f||t[31]!==d?(P=(0,Q.jsx)(Q5,{id:`pairing-trusted`,checked:d,disabled:a,onCheckedChange:f}),t[29]=a,t[30]=f,t[31]=d,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(q6,{htmlFor:`pairing-trusted`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`The paired device can update Porcelain`}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`Can update Porcelain`})]}),t[33]=F):F=t[33];let I;t[34]===P?I=t[35]:(I=(0,Q.jsxs)(Z6,{orientation:`horizontal`,children:[P,F]}),t[34]=P,t[35]=I);let L=p4[b.route],R;t[36]===L?R=t[37]:(R=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Uses `,L,`. Pair again to add another way in.`]}),t[36]=L,t[37]=R);let ee;t[38]===h?ee=t[39]:(ee=Nw(h)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(h.cause))})}),t[38]=h,t[39]=ee);let z;t[40]!==y||t[41]!==x?(z=y&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg bg-white p-1 inset-ring inset-ring-border`,children:(0,Q.jsx)(Wme,{link:y.link})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-20 flex-col gap-1 pt-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-ui leading-4.5 font-medium`,children:[`Scan on `,y.label]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Works once, until`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:new Date(y.expiresAt).toLocaleTimeString()}),x&&(0,Q.jsxs)(Q.Fragment,{children:[`, through `,p4[x]]}),`.`]})]})]}),(0,Q.jsx)(`p`,{"aria-label":`Pairing link`,className:`font-mono text-2xs leading-4 break-all text-muted-foreground`,children:y.link}),(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>jq(y?.link??``,`pairing link`),children:[(0,Q.jsx)(_K,{}),`Copy link`]})]}),t[40]=y,t[41]=x,t[42]=z):z=t[42];let te;return t[43]!==A||t[44]!==N||t[45]!==I||t[46]!==R||t[47]!==ee||t[48]!==z?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A,N,I,R,ee,z]}),t[43]=A,t[44]=N,t[45]=I,t[46]=R,t[47]=ee,t[48]=z,t[49]=te):te=t[49],te}function qme(e){let{route:t,url:n}=e;return(0,Q.jsx)(z7,{value:n,children:(0,Q.jsx)(`span`,{className:`mr-4 min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:`${p4[t]} · ${n}`})},n)}function Jme(e){let{route:t,url:n}=e;return{value:n,label:`${p4[t]} · ${n}`}}var Yme=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=hg()){let n=fg(e),r=bg(n,t),[i,a]=r?[t,n]:[n,t],o=yg(i,a),s=Qi(o),c=vg(),l=(s+xg(_g(a,c))-xg(_g(i,c)))/Qi(Zi(1)),u,d;return s<Qi(Yi(1))?(u=`second`,d=Math.round($i(o))):s<Qi(Xi(1))?(u=`minute`,d=Math.round(ea(o))):s<Qi(Zi(1))?(u=`hour`,d=Math.round(ta(o))):l<30?(u=`day`,d=Math.round(l)):l<365?(d=Math.round(l/30),u=d===12?`year`:`month`,u===`year`&&(d=1)):(u=`year`,d=Math.round(l/365)),Yme.format(r?d:-d,u)}var Xme={phone:(0,Q.jsx)(GK,{"aria-hidden":!0}),tablet:(0,Q.jsx)(qK,{"aria-hidden":!0}),browser:(0,Q.jsx)(yK,{"aria-hidden":!0})};function Zme(e){let t=(0,VW.c)(22),{connection:n,access:r,disabled:i}=e,a=i!==void 0&&i,o=r,s;if(t[0]!==o.devices||t[1]!==n||t[2]!==a){let e;t[4]!==n||t[5]!==a?(e=e=>(0,Q.jsxs)(t8,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(n8,{variant:`icon`,children:Xme[Ile(e.platform)]}),(0,Q.jsxs)(r8,{className:`basis-48`,children:[(0,Q.jsxs)(i8,{className:`flex-wrap`,children:[e.label,e.current&&(0,Q.jsx)(d8,{variant:`secondary`,children:`This device`}),(0,Q.jsx)(d8,{variant:`outline`,children:m4[e.route]})]}),(0,Q.jsxs)(a8,{children:[`Last seen `,s9(e.lastSeenAt),` ·`,` `,Z3(e.platform)]}),e.routeInferred&&(0,Q.jsxs)(a8,{children:[`Paired before each device was tied to one way in, so it now works only through `,m4[e.route],`, where it was last seen. Pair it again to use another way in.`]})]}),(0,Q.jsxs)(o8,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[auto_auto] items-center gap-x-2 gap-y-1.5`,children:[(0,Q.jsx)(ehe,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(Qme,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&Lse(e)&&(0,Q.jsx)($me,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canEditWaysIn})]}),!e.current&&(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!1})]})]},e.id),t[4]=n,t[5]=a,t[6]=e):e=t[6],s=o.devices.map(e),t[0]=o.devices,t[1]=n,t[2]=a,t[3]=s}else s=t[3];let c;if(t[7]!==o.grants||t[8]!==n||t[9]!==a){let e;t[11]!==n||t[12]!==a?(e=e=>(0,Q.jsxs)(t8,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(n8,{variant:`icon`,children:(0,Q.jsx)(DK,{"aria-hidden":!0})}),(0,Q.jsxs)(r8,{className:`min-w-0`,children:[(0,Q.jsxs)(i8,{children:[e.label,(0,Q.jsx)(d8,{variant:`outline`,children:`Pending link`})]}),(0,Q.jsxs)(a8,{children:[`Works once, until`,` `,new Date(e.expiresAt).toLocaleTimeString()]})]}),(0,Q.jsx)(o8,{children:(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!0})})]},e.id),t[11]=n,t[12]=a,t[13]=e):e=t[13],c=o.grants.map(e),t[7]=o.grants,t[8]=n,t[9]=a,t[10]=c}else c=t[10];let l;t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(e8,{role:`list`,"aria-label":`Paired devices and links`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16];let u;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Each device has separate access. Revoking signs it out.`}),t[17]=u):u=t[17];let d;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:`About device permissions`}),t[18]=d):d=t[18];let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(G5,{children:[d,(0,Q.jsx)(q5,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Sharing managers can pair devices, revoke access and configure ways in. Update permission is separate. Each credential works only through the way in it paired over. Pair again to add another way in.`})})]}),t[19]=f):f=t[19];let p;return t[20]===l?p=t[21]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,u,f]}),t[20]=l,t[21]=p),p}function Qme(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=qde(n,r),l=`${i} can update Porcelain`,u;return t[0]!==o||t[1]!==c||t[2]!==s||t[3]!==l||t[4]!==a?(u=(0,Q.jsx)(c9,{caption:`Can update`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=o,t[1]=c,t[2]=s,t[3]=l,t[4]=a,t[5]=u):u=t[5],u}function $me(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Jde(n,r),l=`${i} can edit ways in`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Can edit ways in`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}function c9(e){let t=(0,VW.c)(13),{caption:n,name:r,checked:i,result:a,disabled:o,onChange:s}=e,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=c);let l=o||a.waiting,u;t[2]!==i||t[3]!==r||t[4]!==s||t[5]!==l?(u=(0,Q.jsx)(Q5,{"aria-label":r,checked:i,disabled:l,onCheckedChange:s}),t[2]=i,t[3]=r,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]===a?d=t[8]:(d=Nw(a)&&(0,Q.jsx)(c8,{variant:`destructive`,className:`col-span-2`,children:(0,Q.jsx)(u8,{children:I4(wu(a.cause))})}),t[7]=a,t[8]=d);let f;return t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function l9(e){let t=(0,VW.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=Kde(n,r),u=a?`Cancel the link for ${i}`:`Revoke ${i}`,d=s||c.waiting,f;t[0]===l?f=t[1]:(f=()=>l(),t[0]=l,t[1]=f);let p=a?`Cancel`:`Revoke`,m;t[2]!==u||t[3]!==d||t[4]!==f||t[5]!==p?(m=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,className:`ml-1`,"aria-label":u,disabled:d,onClick:f,children:p}),t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===c?h=t[8]:(h=Nw(c)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(c.cause))})}),t[7]=c,t[8]=h);let g;return t[9]!==m||t[10]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[m,h]}),t[9]=m,t[10]=h,t[11]=g):g=t[11],g}function ehe(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Qde(n,r),l=`${i} can manage sharing`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Manage sharing`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}var u9={lan:void 0,tailnet:`Encrypted, from anywhere`,cloudflare:`Encrypted, from anywhere`};function the(e){let t=(0,VW.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=Wse(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a;if(o===null)return null;if(i.kind===`off`||i.kind===`starting`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[3]=e):e=t[3];let n;return t[4]===o?n=t[5]:(n=(0,Q.jsxs)(d8,{variant:`outline`,children:[e,o]}),t[4]=o,t[5]=n),n}if(i.kind===`paused`){let e;return t[6]===o?e=t[7]:(e=(0,Q.jsx)(d8,{variant:`outline`,children:o}),t[6]=o,t[7]=e),e}if(i.kind===`failed`){let e;return t[8]===o?e=t[9]:(e=(0,Q.jsx)(d8,{variant:`destructive`,children:o}),t[8]=o,t[9]=e),e}let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-add-fg`}),t[10]=s):s=t[10];let c;return t[11]===o?c=t[12]:(c=(0,Q.jsxs)(d8,{variant:`secondary`,children:[s,o]}),t[11]=o,t[12]=c),c}function nhe(e){let t=(0,VW.c)(14),{name:n,route:r,note:i}=e,{status:a}=r;if(a.kind===`failed`){let e;t[0]!==n||t[1]!==a.reason?(e=Yse(n,a.reason),t[0]=n,t[1]=a.reason,t[2]=e):e=t[2];let r;return t[3]===e?r=t[4]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[3]=e,t[4]=r),r}if(a.kind!==`on`||a.urls.length===0){let e=jse[n],r;return t[5]===e?r=t[6]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[5]=e,t[6]=r),r}let o;if(t[7]!==n||t[8]!==i||t[9]!==a.urls){let e;t[11]!==n||t[12]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs leading-4.5 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1`,children:[(0,Q.jsx)(H6,{className:`font-mono text-foreground-2`,text:e}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>jq(e,`address`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy ${e}`})]})]}),(i??u9[n])&&(0,Q.jsx)(`span`,{children:i??u9[n]})]},e),t[11]=n,t[12]=i,t[13]=e):e=t[13],o=a.urls.map(e),t[7]=n,t[8]=i,t[9]=a.urls,t[10]=o}else o=t[10];return o}function d9(e){let t=(0,VW.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=p4[n],[d,f]=(0,Z.useState)(!1),p=n!==`lan`||r.status.kind!==`on`,m=d||(s?.open??!1),h;t[0]!==n||t[1]!==r?(h=(0,Q.jsx)(the,{name:n,route:r}),t[0]=n,t[1]=r,t[2]=h):h=t[2];let g;t[3]===p?g=t[4]:(g=!p&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-xs leading-4 font-medium text-warn`,children:[(0,Q.jsx)(UK,{"aria-hidden":!0,className:`size-3.5`}),`Not encrypted`]}),t[3]=p,t[4]=g);let _;t[5]!==h||t[6]!==g||t[7]!==u?(_=(0,Q.jsxs)(i8,{className:`flex-wrap`,children:[u,h,g]}),t[5]=h,t[6]=g,t[7]=u,t[8]=_):_=t[8];let v;t[9]!==n||t[10]!==c||t[11]!==r?(v=(0,Q.jsx)(nhe,{name:n,route:r,note:c}),t[9]=n,t[10]=c,t[11]=r,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,Q.jsxs)(r8,{children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]!==a||t[17]!==s||t[18]!==u?(b=s&&!a&&(0,Q.jsxs)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:s.configured?`ghost`:`outline`,"aria-label":s.configured?`${u} setup`:`Set up ${u}`,className:`group/setup`}),children:[s.configured?`Setup`:`Set up`,s.configured&&(0,Q.jsx)(aK,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground transition-transform group-data-panel-open/setup:rotate-180`})]}),t[16]=a,t[17]=s,t[18]=u,t[19]=b):b=t[19];let x=i||a,S;t[20]===o?S=t[21]:(S=e=>o(e),t[20]=o,t[21]=S);let C;t[22]!==r.enabled||t[23]!==x||t[24]!==S||t[25]!==u?(C=(0,Q.jsx)(Q5,{"aria-label":u,checked:r.enabled,disabled:x,onCheckedChange:S}),t[22]=r.enabled,t[23]=x,t[24]=S,t[25]=u,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==b?(w=(0,Q.jsxs)(o8,{children:[b,C]}),t[27]=C,t[28]=b,t[29]=w):w=t[29];let T;t[30]!==l||t[31]!==a||t[32]!==n||t[33]!==s?(T=a?(0,Q.jsx)(s8,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:Mse(n)})}):l&&(s?(0,Q.jsx)(q5,{className:`basis-full`,children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:l})}):(0,Q.jsx)(s8,{children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:l})})),t[30]=l,t[31]=a,t[32]=n,t[33]=s,t[34]=T):T=t[34];let E;return t[35]!==m||t[36]!==w||t[37]!==T||t[38]!==y?(E=(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(G5,{open:m,onOpenChange:f,className:`contents`,children:[y,w,T]})}),t[35]=m,t[36]=w,t[37]=T,t[38]=y,t[39]=E):E=t[39],E}function rhe(e){let t=(0,VW.c)(26),{remote:n,disabled:r,onTurnOn:i}=e,{lan:a}=n.routes,o=n.localNetwork,s=a.enabled&&a.status.kind===`paused`,c;t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==s?(c=s&&o&&(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,h4(o)]}),t[0]=r,t[1]=o,t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==a.status.kind||t[7]!==s||t[8]!==n?(l=a.status.kind!==`on`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:s||!o?g4(n):`Uses ${h4(o)}.`}),t[5]=o,t[6]=a.status.kind,t[7]=s,t[8]=n,t[9]=l):l=t[9];let u,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-6.5 -left-6.5 hidden size-1.5 rounded-full bg-warn lg:block`}),d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7.25 -left-5 hidden h-px w-5 bg-warn-border lg:block`}),t[10]=u,t[11]=d):(u=t[10],d=t[11]);let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(l8,{children:[(0,Q.jsx)(UK,{"aria-hidden":!0}),`Not encrypted`]}),t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{children:`Devices on this network can read the connection.`}),t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=g4(n),t[15]=n,t[16]=h);let g;t[17]===h?g=t[18]:(g=(0,Q.jsx)(`p`,{children:h}),t[17]=h,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`p`,{children:Nse}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,Q.jsxs)(`div`,{className:`settings-margin-note lg:absolute lg:top-0 lg:left-full lg:ml-8 lg:w-62`,children:[u,d,(0,Q.jsxs)(c8,{role:`note`,"aria-label":`Local network warning`,children:[f,(0,Q.jsxs)(u8,{children:[p,(0,Q.jsxs)(G5,{children:[m,(0,Q.jsxs)(q5,{children:[g,_]})]})]})]})]}),t[20]=g,t[21]=v);let y;return t[22]!==c||t[23]!==v||t[24]!==l?(y=(0,Q.jsxs)(Q.Fragment,{children:[c,l,v]}),t[22]=c,t[23]=v,t[24]=l,t[25]=y):y=t[25],y}function f9(e){let t=(0,VW.c)(26),{route:n,remote:r,disabled:i,onChange:a}=e,[o,s]=(0,Z.useState)(null),c;t[0]!==o||t[1]!==r||t[2]!==n?(c=Jse(r,n,o),t[0]=o,t[1]=r,t[2]=n,t[3]=c):c=t[3];let l=c,u;t[4]!==l.save||t[5]!==a?(u=e=>j8(e,async()=>{a(l.save),s(null)}),t[4]=l.save,t[5]=a,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>s(e.target.value),t[7]=d):d=t[7];let f;t[8]!==i||t[9]!==l.label||t[10]!==l.placeholder||t[11]!==l.value?(f=(0,Q.jsx)(k8,{"aria-label":l.label,placeholder:l.placeholder,value:l.value,disabled:i,onChange:d}),t[8]=i,t[9]=l.label,t[10]=l.placeholder,t[11]=l.value,t[12]=f):f=t[12];let p=i||!l.canSave,m;t[13]!==l.saveLabel||t[14]!==p?(m=(0,Q.jsx)(zG,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:p,children:l.saveLabel}),t[13]=l.saveLabel,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==l.check||t[18]!==l.failed||t[19]!==a?(h=l.failed&&(0,Q.jsx)(zG,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:i,onClick:()=>a(l.check),children:`Check again`}),t[16]=i,t[17]=l.check,t[18]=l.failed,t[19]=a,t[20]=h):h=t[20];let g;return t[21]!==u||t[22]!==f||t[23]!==m||t[24]!==h?(g=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:u,children:[f,m,h]}),t[21]=u,t[22]=f,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function ihe(e){let t=(0,VW.c)(18),{remote:n,disabled:r,onChange:i}=e,a=n.routes.tailnet,o;t[0]===n.tailnetTarget?o=t[1]:(o=n.tailnetTarget===void 0?void 0:Hse(n.tailnetTarget),t[0]=n.tailnetTarget,t[1]=o);let s=o,c;t[2]!==r||t[3]!==i||t[4]!==n?(c=(0,Q.jsx)(f9,{route:`tailnet`,remote:n,disabled:r,onChange:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;t[6]===n.tailnetHostname?l=t[7]:(l=n.tailnetHostname===void 0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this computer’s name on your tailnet, as tailscale status or the Tailscale admin console shows it, to turn this on. Porcelain then names the one command to run.`}),t[6]=n.tailnetHostname,t[7]=l);let u;t[8]!==n.tailnetHostname||t[9]!==a?(u=n.tailnetHostname!==void 0&&!a.enabled&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If you set up tailscale serve for Porcelain, remove it with tailscale serve --https=443 off, or Tailscale keeps forwarding to a port Porcelain no longer holds.`}),t[8]=n.tailnetHostname,t[9]=a,t[10]=u):u=t[10];let d;t[11]===s?d=t[12]:(d=s!==void 0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run this once on this computer. Tailscale keeps it across restarts; remove it with tailscale serve --https=443 off.`}),(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(H6,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,render:(0,Q.jsx)(`code`,{}),text:s}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>jq(s,`command`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy the tailscale serve command`})]})]})]}),t[11]=s,t[12]=d);let f;return t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l,u,d]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function ahe(e){let t=(0,VW.c)(9),{remote:n,disabled:r,onChange:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(f9,{route:`cloudflare`,remote:n,disabled:r,onChange:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===n.serviceUrl?o=t[5]:(o=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`In Cloudflare, publish this hostname from your tunnel to`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.serviceUrl}),`, and run cloudflared on this computer as a service. Porcelain answers to the hostname only while this is on.`]}),t[4]=n.serviceUrl,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function ohe(e){let t=(0,VW.c)(63),{connection:n,remote:r}=e,[i,a]=Yde(n),o=i.waiting,s;t[0]===r.editing.protectedRoute?s=t[1]:(s=e=>r.editing.protectedRoute===e,t[0]=r.editing.protectedRoute,t[1]=s);let c=s,l;t[2]!==r.editing.fingerprint||t[3]!==a?(l=e=>a({expected:r.editing.fingerprint,change:e}),t[2]=r.editing.fingerprint,t[3]=a,t[4]=l):l=t[4];let u=l,d=r.routes.lan,f;t[5]===r?f=t[6]:(f=g4(r),t[5]=r,t[6]=f);let p=c(`lan`),m=o||!r.routes.lan.enabled&&r.localNetwork===void 0,h;t[7]===u?h=t[8]:(h=e=>u({lan:e}),t[7]=u,t[8]=h);let g;t[9]===u?g=t[10]:(g=()=>u({lan:!0}),t[9]=u,t[10]=g);let _;t[11]!==o||t[12]!==r||t[13]!==g?(_=(0,Q.jsx)(rhe,{remote:r,disabled:o,onTurnOn:g}),t[11]=o,t[12]=r,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==r.routes.lan||t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==_?(v=(0,Q.jsx)(d9,{name:`lan`,route:d,note:f,connectedThrough:p,disabled:m,onChange:h,children:_}),t[15]=r.routes.lan,t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=_,t[21]=v):v=t[21];let y=r.routes.tailnet,b=r.tailnetHostname!==void 0,x=r.routes.tailnet.status.kind===`failed`,S;t[22]!==b||t[23]!==x?(S={configured:b,open:x},t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=c(`tailnet`),w=o||r.tailnetHostname===void 0,T;t[25]===u?T=t[26]:(T=e=>u({tailnet:e}),t[25]=u,t[26]=T);let E;t[27]!==o||t[28]!==r||t[29]!==u?(E=(0,Q.jsx)(ihe,{remote:r,disabled:o,onChange:u}),t[27]=o,t[28]=r,t[29]=u,t[30]=E):E=t[30];let D;t[31]!==r.routes.tailnet||t[32]!==S||t[33]!==C||t[34]!==w||t[35]!==T||t[36]!==E?(D=(0,Q.jsx)(d9,{name:`tailnet`,route:y,setup:S,connectedThrough:C,disabled:w,onChange:T,children:E}),t[31]=r.routes.tailnet,t[32]=S,t[33]=C,t[34]=w,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O=r.routes.cloudflare,k=r.cloudflareHostname!==void 0,A=r.routes.cloudflare.status.kind===`failed`,j;t[38]!==k||t[39]!==A?(j={configured:k,open:A},t[38]=k,t[39]=A,t[40]=j):j=t[40];let M=c(`cloudflare`),N=o||r.cloudflareHostname===void 0,P;t[41]===u?P=t[42]:(P=e=>u({cloudflare:e}),t[41]=u,t[42]=P);let F;t[43]!==o||t[44]!==r||t[45]!==u?(F=(0,Q.jsx)(ahe,{remote:r,disabled:o,onChange:u}),t[43]=o,t[44]=r,t[45]=u,t[46]=F):F=t[46];let I;t[47]!==r.routes.cloudflare||t[48]!==j||t[49]!==M||t[50]!==N||t[51]!==P||t[52]!==F?(I=(0,Q.jsx)(d9,{name:`cloudflare`,route:O,setup:j,connectedThrough:M,disabled:N,onChange:P,children:F}),t[47]=r.routes.cloudflare,t[48]=j,t[49]=M,t[50]=N,t[51]=P,t[52]=F,t[53]=I):I=t[53];let L;t[54]!==v||t[55]!==D||t[56]!==I?(L=(0,Q.jsxs)(e8,{children:[v,D,I]}),t[54]=v,t[55]=D,t[56]=I,t[57]=L):L=t[57];let R;t[58]===i?R=t[59]:(R=Nw(i)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.cause))})}),t[58]=i,t[59]=R);let ee;return t[60]!==L||t[61]!==R?(ee=(0,Q.jsxs)(Q.Fragment,{children:[L,R]}),t[60]=L,t[61]=R,t[62]=ee):ee=t[62],ee}function p9(e){let t=(0,VW.c)(14),{connection:n,children:r}=e,i=m8(n),a,o;if(t[0]!==r||t[1]!==n||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=er(Bw(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=Rse(n.address),t[5]=n.address,t[6]=e);let r;t[7]===e?r=t[8]:(r=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),t[7]=e,t[8]=r),o=r;break bb0}if(Nw(i)){let e;t[9]===i.cause?e=t[10]:(e=I4(wu(i.cause)),t[9]=i.cause,t[10]=e);let n;t[11]===e?n=t[12]:(n=(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:e})}),t[11]=e,t[12]=n),o=n;break bb0}if(!e){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[13]=e):e=t[13],o=e;break bb0}a=r(e)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o}else a=t[3],o=t[4];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function m9(e){let t=(0,VW.c)(6),{connection:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(X6,{variant:`label`,children:`Ways in`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=e=>(0,Q.jsx)(ohe,{connection:n,remote:e}),t[1]=n,t[2]=i);let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsxs)(Y6,{id:`ways-in`,className:`relative`,children:[r,(0,Q.jsx)(p9,{connection:n,children:i})]}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function she(e){let t=(0,VW.c)(5),{connection:n,children:r}=e,i=p8(n),a,o;if(t[0]!==i||t[1]!==r){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=er(Bw(i));if(e===null){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This device cannot manage sharing. Allow it from a device with sharing access.`}),t[4]=e):e=t[4],o=e;break bb0}let n=Nw(i)?I4(wu(i.cause)):void 0;if(!e){o=n?(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:n})}):(0,Q.jsx)(U6,{});break bb0}a=r(e,n)}t[0]=i,t[1]=r,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function h9(e){let t=(0,VW.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=er(Bw(Mde()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(Ope,{prominent:r}),t[0]=r,t[1]=e),e}if(i===!1){let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(Epe,{prominent:r}),t[2]=r,t[3]=e),e}let a;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(U6,{}),t[4]=a):a=t[4],a}function che(e){let t=(0,VW.c)(45),{environment:n}=e,{connection:r}=R6(),i=er(Bw(p8(r)))?.canEditIdentity===!0,a=`${n.custom}:${n.name}`,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u;if(t[0]!==r.address){let e=new URL(r.address);u=/^https?:$/.test(e.protocol)?e.origin:void 0,t[0]=r.address,t[1]=u}else u=t[1];let d=u,f=o===a,[p,m]=Zde(r),h,g,_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-add-fg`}),g=(0,Q.jsx)(`span`,{children:`Online`}),_=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),v=(0,Q.jsx)(d8,{variant:`secondary`,children:`This computer`}),t[2]=h,t[3]=g,t[4]=_,t[5]=v):(h=t[2],g=t[3],_=t[4],v=t[5]);let y;t[6]===d?y=t[7]:(y=d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),(0,Q.jsx)(H6,{text:d,className:`font-mono text-xs text-muted-foreground`})]}),t[6]=d,t[7]=y);let b;t[8]===y?b=t[9]:(b=(0,Q.jsxs)(Q.Fragment,{children:[h,g,_,v,y]}),t[8]=y,t[9]=b);let x;t[10]!==i||t[11]!==n||t[12]!==p||t[13]!==a||t[14]!==f||t[15]!==c||t[16]!==m?(x=i&&!f&&(0,Q.jsxs)(`span`,{className:`mt-1 flex items-center gap-1 text-muted-foreground`,children:[(0,Q.jsx)(epe,{icon:T3(n),pending:p.waiting,onChange:e=>m(ele(e))}),(0,Q.jsxs)(zG,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(LK,{}),`Rename`]})]}),t[10]=i,t[11]=n,t[12]=p,t[13]=a,t[14]=f,t[15]=c,t[16]=m,t[17]=x):x=t[17];let S;t[18]!==i||t[19]!==p?(S=i&&Nw(p)&&(0,Q.jsx)(c8,{variant:`destructive`,className:`mt-4 max-w-160`,children:(0,Q.jsx)(u8,{children:I4(wu(p.cause))})}),t[18]=i,t[19]=p,t[20]=S):S=t[20];let C;t[21]!==i||t[22]!==r||t[23]!==n||t[24]!==f?(C=i&&f&&(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)($de,{connection:r,environment:n,onCancel:()=>s(null)})}),t[21]=i,t[22]=r,t[23]=n,t[24]=f,t[25]=C):C=t[25];let w;t[26]!==n.name||t[27]!==C||t[28]!==b||t[29]!==x||t[30]!==S?(w=(0,Q.jsxs)(f8,{section:`Computers`,title:n.name,lead:`Manage connections and device access.`,status:b,action:x,children:[S,C]}),t[26]=n.name,t[27]=C,t[28]=b,t[29]=x,t[30]=S,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(e8,{"aria-label":`Version`,children:(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(h9,{prominent:!0})})})}),t[32]=T):T=t[32];let E,D;t[33]===r?(E=t[34],D=t[35]):(E=(0,Q.jsx)(m9,{connection:r}),D=(0,Q.jsx)(g9,{connection:r}),t[33]=r,t[34]=E,t[35]=D);let O;t[36]===n.name?O=t[37]:(O=(0,Q.jsxs)(Y6,{children:[(0,Q.jsx)(X6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`This browser`}),(0,Q.jsx)(d8,{variant:`outline`,children:`Shown in a browser tab`})]})}),(0,Q.jsx)(e8,{children:(0,Q.jsx)(t8,{children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(Ade,{computer:n.name})})})})]}),t[36]=n.name,t[37]=O);let k;t[38]!==E||t[39]!==D||t[40]!==O?(k=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[T,E,D,O]}),t[38]=E,t[39]=D,t[40]=O,t[41]=k):k=t[41];let A;return t[42]!==w||t[43]!==k?(A=(0,Q.jsxs)(Q.Fragment,{children:[w,k]}),t[42]=w,t[43]=k,t[44]=A):A=t[44],A}function g9(e){let t=(0,VW.c)(6),{connection:n}=e,r=er(Bw(p8(n))),i;t[0]!==n||t[1]!==r?(i=(e,t)=>(0,Q.jsx)(p9,{connection:n,children:i=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Y6,{id:`devices`,className:`min-w-0`,disabled:t!==void 0,children:[(0,Q.jsx)(X6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Devices`,r&&(0,Q.jsx)(`span`,{className:`tabular-nums`,children:r.devices.length})]})}),t&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:t})}),(0,Q.jsx)(Zme,{connection:n,access:e,disabled:t!==void 0})]}),(0,Q.jsxs)(`aside`,{"aria-label":`Pair a device`,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border bg-card p-3 shadow-pop lg:col-start-2 lg:row-span-2 lg:row-start-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-ui leading-4.5 font-semibold`,children:`Pair a device`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.25 text-muted-foreground`,children:`A link works once, for a few minutes.`})]}),(0,Q.jsx)(Y6,{className:`contents`,disabled:t!==void 0,children:(0,Q.jsx)(Kme,{connection:n,remote:i,disabled:t!==void 0})})]})]})}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsx)(she,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var lhe=X(e=>j6.fn(e=>H(function*(){let t=yield*(yield*W4).pair({value:e,localEnvironmentId:M6.state.value.connection?.environmentId}).pipe(Up(J3));return t4(D6,t),t}))),uhe=X(e=>j6.fn(t=>H(function*(){yield*(yield*W4).forget(e.environmentId)}))),dhe=j6.fn(e=>H(function*(){yield*(yield*W4).read()}));function fhe(e){let t=(0,VW.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=lhe(n),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},t[2]=a):a=t[2];let[o,s]=cI(i,a),c=oI(i),l;t[3]!==e||t[4]!==s?(l=async t=>{Lu(await s(t))&&e()},t[3]=e,t[4]=s,t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=()=>c(Bk),t[6]=c,t[7]=u);let d;return t[8]!==o||t[9]!==l||t[10]!==u?(d={result:o,submit:l,reset:u},t[8]=o,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function phe(e,t){let n=(0,VW.c)(9),r;n[0]===e?r=n[1]:(r=uhe(e),n[0]=e,n[1]=r);let i;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[2]=i):i=n[2];let[a,o]=cI(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{Lu(await o(void 0))&&t()},n[3]=t,n[4]=o,n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==s?(c={result:a,submit:s},n[6]=a,n[7]=s,n[8]=c):c=n[8],c}function mhe(){let e=(0,VW.c)(5),[t,n]=cI(dhe),r;e[0]===n?r=e[1]:(r=()=>n(void 0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i={result:t,read:r},e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function hhe(e){let t=(0,VW.c)(31),{remote:n,onOpen:r,showUpdates:i}=e,a=z6(n),o=a.kind===`online`?a.name:n.name,{rows:s}=I5(),c;if(t[0]!==n.environmentId||t[1]!==s){let e;t[3]===n.environmentId?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n.environmentId,t[4]=e),c=s.find(e),t[0]=n.environmentId,t[1]=s,t[2]=c}else c=t[2];let l=c,u=`Open ${o}`,d;t[5]!==r||t[6]!==n.environmentId?(d=()=>r(n.environmentId),t[5]=r,t[6]=n.environmentId,t[7]=d):d=t[7];let f=a.kind,p;t[8]===a?p=t[9]:(p=A2(a),t[8]=a,t[9]=p);let m;t[10]===n.address?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`font-mono`,children:n.address}),t[10]=n.address,t[11]=m);let h;t[12]===n.environmentId?h=t[13]:(h=n.environmentId.slice(0,8),t[12]=n.environmentId,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Q.jsx)(`span`,{className:`font-mono`,children:h}),t[14]=h,t[15]=g);let _;t[16]!==p||t[17]!==m||t[18]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[p,` ·`,` `,m,` ·`,` `,g]}),t[16]=p,t[17]=m,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==a.kind||t[22]!==l?(v=i&&(l?(0,Q.jsx)(J5,{row:l}):a.kind===`offline`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:`Version unavailable while offline`})),t[20]=i,t[21]=a.kind,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==o||t[25]!==a.kind||t[26]!==v||t[27]!==u||t[28]!==d||t[29]!==_?(y=(0,Q.jsx)(y9,{name:o,label:o,openLabel:u,onOpen:d,status:f,description:_,update:v}),t[24]=o,t[25]=a.kind,t[26]=v,t[27]=u,t[28]=d,t[29]=_,t[30]=y):y=t[30],y}function ghe(){let e=(0,VW.c)(27),[t,n]=(0,Z.useState)(``),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>n(``),e[0]=r):r=e[0];let i=fhe(r),{status:a}=F6(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-ui leading-5 text-foreground-2`,children:[`On the other computer, run`,` `,(0,Q.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-px font-mono text-xs leading-4.5 font-medium text-foreground inset-ring inset-ring-border`,children:`porcelain pair`}),` `,`and paste the link it prints. This device keeps its own credential for that computer.`]}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>j8(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 font-mono`,children:(0,Q.jsx)(k8,{"aria-label":`Pairing link`,placeholder:`https://porcelain.fabiofiorita.com/open/pair#c=…`,value:t,disabled:c,onChange:l})}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(zG,{type:`submit`,className:`shrink-0`,disabled:d,children:f}),e[15]=d,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==s||e[19]!==u||e[20]!==p?(m=(0,Q.jsxs)(`form`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,onSubmit:s,children:[u,p]}),e[18]=s,e[19]=u,e[20]=p,e[21]=m):m=e[21];let h;e[22]===i.result?h=e[23]:(h=Nw(i.result)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.result.cause))})}),e[22]=i.result,e[23]=h);let g;return e[24]!==h||e[25]!==m?(g=(0,Q.jsx)(t8,{children:(0,Q.jsxs)(r8,{children:[o,m,h]})}),e[24]=h,e[25]=m,e[26]=g):g=e[26],g}function _he(e){let{connection:t}=e,n=er(Bw(m8(t))),r=er(Bw(p8(t)));return n&&r?`Online · ${Rle(n,r.devices.length)}`:`Online · Connected computer`}function vhe(e){let t=(0,VW.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=R6(),{remotes:o,error:s}=F6(),c=mhe();ope();let{targets:l,count:u,batch:d,run:f,retry:p,checking:m}=I5(),h=y8(),g;t[0]===h?g=t[1]:(g=P5(h),t[0]=h,t[1]=g);let _=g!==void 0,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(f8,{section:`Settings`,title:`Computers`,lead:`Manage your paired computers.`,children:(0,Q.jsxs)(`p`,{className:`mt-3.5 flex max-w-160 items-start gap-2 text-ui leading-5 text-muted-foreground`,children:[(0,Q.jsx)(yK,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0`}),`Browser tabs each connect to one computer.`]})}),t[2]=v):v=t[2];let y;t[3]!==c||t[4]!==s?(y=s!==void 0&&(0,Q.jsxs)(c8,{variant:`destructive`,children:[(0,Q.jsx)(CK,{}),(0,Q.jsx)(l8,{children:`Saved computers could not be read`}),(0,Q.jsxs)(u8,{children:[`Porcelain keeps them as they are and saves no change over them. Allow Porcelain to read its saved credentials, then try again.`,` `,s,(0,Q.jsx)(zG,{variant:`outline`,disabled:c.result.waiting,onClick:()=>c.read(),children:`Read saved computers`})]})]}),t[3]=c,t[4]=s,t[5]=y):y=t[5];let b=o.length+1,x;t[6]===b?x=t[7]:(x=(0,Q.jsxs)(`h2`,{id:`computers-heading`,className:`flex items-center gap-1 text-xs leading-4 font-medium text-muted-foreground`,children:[`Computers`,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:b})]}),t[6]=b,t[7]=x);let S=d.running||m||_,C;t[8]!==p||t[9]!==S?(C=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:S,onClick:p,children:`Check for updates`}),t[8]=p,t[9]=S,t[10]=C):C=t[10];let w=d.running||u===0,T;t[11]!==f||t[12]!==l?(T=()=>f(l),t[11]=f,t[12]=l,t[13]=T):T=t[13];let E;t[14]!==u||t[15]!==T||t[16]!==w?(E=(0,Q.jsxs)(zG,{size:`sm`,disabled:w,onClick:T,children:[`Update all (`,u,`)`]}),t[14]=u,t[15]=T,t[16]=w,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==C?(D=(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,E]}),t[18]=E,t[19]=C,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==x?(O=(0,Q.jsxs)(`div`,{className:`mb-1.5 flex min-h-7 items-center justify-between gap-2`,children:[x,D]}),t[21]=D,t[22]=x,t[23]=O):O=t[23];let k=`This computer: ${n.name}`,A=`Open This computer: ${n.name}`,j;t[24]===r?j=t[25]:(j=()=>r(`this-computer`),t[24]=r,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(d8,{variant:`secondary`,children:`This computer`}),t[26]=M):M=t[26];let N;t[27]===a?N=t[28]:(N=(0,Q.jsx)(_he,{connection:a}),t[27]=a,t[28]=N);let P;t[29]===i?P=t[30]:(P=i&&(0,Q.jsx)(h9,{}),t[29]=i,t[30]=P);let F;t[31]!==n.name||t[32]!==k||t[33]!==A||t[34]!==j||t[35]!==N||t[36]!==P?(F=(0,Q.jsx)(y9,{name:n.name,label:k,openLabel:A,onOpen:j,status:`online`,badge:M,description:N,update:P}),t[31]=n.name,t[32]=k,t[33]=A,t[34]=j,t[35]=N,t[36]=P,t[37]=F):F=t[37];let I;if(t[38]!==r||t[39]!==o||t[40]!==i){let e;t[42]!==r||t[43]!==i?(e=e=>(0,Q.jsx)(hhe,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(yhe).map(e),t[38]=r,t[39]=o,t[40]=i,t[41]=I}else I=t[41];let L;t[45]!==F||t[46]!==I?(L=(0,Q.jsxs)(e8,{"aria-label":`Computers`,children:[F,I]}),t[45]=F,t[46]=I,t[47]=L):L=t[47];let R;t[48]!==O||t[49]!==L?(R=(0,Q.jsxs)(`section`,{"aria-labelledby":`computers-heading`,className:`@container flex min-w-0 flex-col gap-2`,children:[O,L]}),t[48]=O,t[49]=L,t[50]=R):R=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(X6,{variant:`label`,children:`Add computer`}),t[51]=ee):ee=t[51];let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsxs)(Y6,{children:[ee,(0,Q.jsx)(e8,{children:(0,Q.jsx)(ghe,{})})]}),t[52]=z):z=t[52];let te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(te={section:`computers`,environmentId:`this-computer`},t[53]=te):te=t[53];let ne;t[54]===n.name?ne=t[55]:(ne=(0,Q.jsxs)(`p`,{className:`-mt-3.5 text-ui leading-5 text-muted-foreground`,children:[`To pair a phone, tablet or browser with this computer, open`,` `,(0,Q.jsxs)(LF,{to:`/settings/$section/$environmentId`,params:te,hash:`devices`,className:`rounded-sm font-medium text-foreground underline underline-offset-3 outline-none focus-visible:ring-3 focus-visible:ring-ring/30`,children:[n.name,` › Devices`]}),`.`]}),t[54]=n.name,t[55]=ne);let re;return t[56]!==R||t[57]!==ne||t[58]!==y?(re=(0,Q.jsxs)(Q.Fragment,{children:[v,y,R,z,ne]}),t[56]=R,t[57]=ne,t[58]=y,t[59]=re):re=t[59],re}function yhe(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(dK,{"aria-hidden":!0,strokeWidth:3.5,className:`size-2.5 text-border-strong`});function v9(e){return(0,Q.jsx)(`span`,{"aria-hidden":!0,className:jG(`size-2 rounded-full`,e)})}var bhe={online:v9(`bg-add-fg`),checking:_9,reconnecting:_9,offline:_9,"needs-pairing":v9(`bg-destructive`),"other-server":v9(`bg-destructive`),incompatible:v9(`bg-warn`)};function y9(e){let t=(0,VW.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=bhe[a],d;t[0]===u?d=t[1]:(d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex h-5 w-4 items-center justify-center self-start`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==i?(f=e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,onClick:l,className:`flex min-w-0 rounded-sm text-left outline-none after:absolute after:inset-0 focus-visible:ring-3 focus-visible:ring-ring/30`,children:e}),t[2]=l,t[3]=i,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==f?(p=(0,Q.jsx)(H6,{text:n,className:`text-sm leading-5 font-medium`,renderTrigger:f}),t[5]=n,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[p,o]}),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.5 text-muted-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`min-w-0 self-start`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c&&(0,Q.jsx)(`div`,{className:`relative col-span-2 col-start-2 row-start-2 min-w-0 @2xl:col-span-1 @2xl:col-start-3 @2xl:row-start-1 @2xl:max-w-80`,children:c}),t[16]=c,t[17]=_);let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(lK,{"aria-hidden":!0,className:`col-start-3 row-start-1 size-4 justify-self-center text-muted-foreground @2xl:col-start-4`}),t[18]=v):v=t[18];let y;return t[19]!==r||t[20]!==d||t[21]!==g||t[22]!==_?(y=(0,Q.jsxs)(t8,{role:`listitem`,"aria-label":r,className:`relative grid grid-cols-[--spacing(4)_minmax(0,1fr)_--spacing(7)] @2xl:grid-cols-[--spacing(4)_minmax(0,1fr)_auto_--spacing(7)]`,children:[d,g,_,v]}),t[19]=r,t[20]=d,t[21]=g,t[22]=_,t[23]=y):y=t[23],y}function b9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:jG(`animate-pulse rounded-md bg-muted`,e),...t})}function x9(e){let t=(0,VW.c)(18),{title:n,description:r,icon:i,children:a,role:o}=e,s;t[0]===i?s=t[1]:(s=i??(0,Q.jsx)(xK,{}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground [&>svg]:size-4`,children:s}),t[2]=s,t[3]=c);let l;t[4]===n?l=t[5]:(l=(0,Q.jsx)(`h2`,{className:`min-w-0 text-base font-semibold wrap-anywhere`,children:n}),t[4]=n,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,Q.jsx)(`div`,{className:`text-ui leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:r}),t[9]=r,t[10]=d);let f;t[11]===a?f=t[12]:(f=a&&(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}),t[11]=a,t[12]=f);let p;return t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,Q.jsxs)(`section`,{"data-slot":`state-notice`,role:o,className:`flex w-full min-w-0 max-w-xl flex-col gap-3 p-6 text-left`,children:[u,d,f]}),t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function xhe(e){let t=(0,VW.c)(14),{label:n,caption:r}=e,i=r===void 0||r,a;t[0]!==i||t[1]!==n?(a=i&&(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(U6,{"aria-hidden":`true`,className:`size-3.5`}),` `,n,`…`]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o,s,c,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b9,{className:`h-5 w-2/3`}),s=(0,Q.jsx)(b9,{className:`h-4 w-full`}),c=(0,Q.jsx)(b9,{className:`h-4 w-4/5`}),l=(0,Q.jsx)(b9,{className:`h-4 w-1/2`}),t[3]=o,t[4]=s,t[5]=c,t[6]=l):(o=t[3],s=t[4],c=t[5],l=t[6]);let u;t[7]!==i||t[8]!==n?(u=!i&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[n,`…`]}),t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==n||t[11]!==a||t[12]!==u?(d=(0,Q.jsxs)(`div`,{role:`status`,"aria-label":n,className:`flex w-full min-w-0 flex-1 flex-col gap-3 bg-background p-6`,children:[a,o,s,c,l,u]}),t[10]=n,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function She(e){let t=(0,VW.c)(10),{description:n,onRetry:r,onBack:i,title:a}=e,o=a===void 0?`Could not display`:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pK,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(zG,{variant:`outline`,onClick:r,children:`Try again`}),t[1]=r,t[2]=c);let l;t[3]===i?l=t[4]:(l=i&&(0,Q.jsx)(zG,{variant:`ghost`,onClick:i,children:`Back to workspace`}),t[3]=i,t[4]=l);let u;return t[5]!==n||t[6]!==c||t[7]!==l||t[8]!==o?(u=(0,Q.jsxs)(x9,{role:`alert`,title:o,description:n,icon:s,children:[c,l]}),t[5]=n,t[6]=c,t[7]=l,t[8]=o,t[9]=u):u=t[9],u}function Che(e){let t=(0,VW.c)(16),{name:n,status:r,onOpenRemotes:i}=e;if(r.kind===`online`)return null;let a=r.kind===`checking`||r.kind===`reconnecting`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(zK,{}),t[0]=o):o=t[0];let s=o;if(r.kind===`needs-pairing`){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(DK,{}),t[1]=e):e=t[1],s=e}if(a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[2]=e):e=t[2],s=e}let c=s,l;t[3]!==n||t[4]!==r?(l=r.kind===`offline`?`${n} is offline`:`${n}: ${A2(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=j2(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(zG,{variant:`outline`,onClick:i,children:`Computer settings`}),t[8]=i,t[9]=a,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Q.jsx)(x9,{role:`status`,icon:c,title:l,description:u,children:d}),t[11]=s,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function whe(e){let t=(0,VW.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=_2(n);i=Y6,t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(X6,{variant:`label`,children:`Saved connections`}),t[5]=o):o=t[5],r=e8,a=e.map(The),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[6]!==r||t[7]!==a?(s=(0,Q.jsx)(r,{children:a}),t[6]=r,t[7]=a,t[8]=s):s=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The addresses this app tries, in order, to reach that computer.`}),t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==s?(l=(0,Q.jsxs)(i,{children:[o,s,c]}),t[10]=i,t[11]=o,t[12]=s,t[13]=l):l=t[13],l}function The(e){let{address:t}=e;return(0,Q.jsxs)(t8,{children:[(0,Q.jsxs)(r8,{children:[(0,Q.jsx)(i8,{children:b2(t)}),(0,Q.jsx)(a8,{className:`break-all`,children:t})]}),(0,Q.jsx)(o8,{children:(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>jq(t,`address`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function Ehe(e){let t=(0,VW.c)(2),{remote:n}=e,r=z6(n),i=r.kind===`online`?r.name:n.name,a;return t[0]===i?a=t[1]:(a=(0,Q.jsx)(H6,{text:i,className:`block min-w-0`}),t[0]=i,t[1]=a),a}function Dhe(e){let t=(0,VW.c)(13),{environmentId:n,onForgotten:r}=e,{remotes:i,status:a,error:o}=F6(),s;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),s=i.find(e),t[0]=n,t[1]=i,t[2]=s}else s=t[2];let c=s;if(!c){let e=a===`ready`?`Computer unavailable`:void 0,n=a===`ready`?`This computer is no longer saved on this app. Return to Computers to add it again.`:o??`Reading saved remote computers…`,r;t[5]===n?r=t[6]:(r=(0,Q.jsx)(u8,{children:n}),t[5]=n,t[6]=r);let i;return t[7]!==e||t[8]!==r?(i=(0,Q.jsx)(c8,{"data-unavailable-page":e,children:r}),t[7]=e,t[8]=r,t[9]=i):i=t[9],i}let l;return t[10]!==r||t[11]!==c?(l=(0,Q.jsx)(Ohe,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function Ohe(e){let t=(0,VW.c)(76),{remote:n,onForgotten:r}=e,i=z6(n),a=L6(n.environmentId),o=phe(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=j2(i),t[0]=i,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(X6,{variant:`label`,children:`Overview`}),t[2]=d):d=t[2];let f;t[3]===c?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`min-w-0`,children:c}),t[3]=c,t[4]=f);let p;t[5]===i?p=t[6]:(p=e6(i),t[5]=i,t[6]=p);let m;t[7]===i?m=t[8]:(m=A2(i),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(d8,{variant:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==f||t[13]!==h?(g=(0,Q.jsxs)(i8,{className:`min-w-0 flex-wrap`,children:[f,` `,h]}),t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=u&&(0,Q.jsx)(a8,{children:u}),t[15]=u,t[16]=_);let v;t[17]===s?v=t[18]:(v=!s&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Saved details · Stale. This computer has not been verified online.`}),t[17]=s,t[18]=v);let y;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{variant:`ghost`,size:`sm`}),children:`Details`}),t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Address`}),t[20]=b):b=t[20];let x;t[21]===n.address?x=t[22]:(x=(0,Q.jsxs)(`div`,{children:[b,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.address})]}),t[21]=n.address,t[22]=x);let S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Computer ID`}),t[23]=S):S=t[23];let C;t[24]===n.environmentId?C=t[25]:(C=(0,Q.jsxs)(`div`,{children:[S,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.environmentId})]}),t[24]=n.environmentId,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Porcelain version`}),t[26]=w):w=t[26];let T=s?i.version??`Not reported`:`Unavailable while this computer is not online`,E;t[27]===T?E=t[28]:(E=(0,Q.jsxs)(`div`,{children:[w,(0,Q.jsx)(`dd`,{children:T})]}),t[27]=T,t[28]=E);let D;t[29]===n.deviceId?D=t[30]:(D=n.deviceId&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`This app’s device ID`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.deviceId})]}),t[29]=n.deviceId,t[30]=D);let O;t[31]!==x||t[32]!==C||t[33]!==E||t[34]!==D?(O=(0,Q.jsxs)(G5,{children:[y,(0,Q.jsx)(q5,{children:(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[x,C,E,D]})})]}),t[31]=x,t[32]=C,t[33]=E,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==g||t[38]!==_||t[39]!==v?(k=(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[g,_,v,O]})}),t[36]=O,t[37]=g,t[38]=_,t[39]=v,t[40]=k):k=t[40];let A;t[41]!==a||t[42]!==s?(A=s&&a&&(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(Dpe,{connection:a.connection})})}),t[41]=a,t[42]=s,t[43]=A):A=t[43];let j;t[44]!==k||t[45]!==A?(j=(0,Q.jsxs)(Y6,{className:`lg:col-span-2`,children:[d,(0,Q.jsxs)(e8,{children:[k,A]})]}),t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s?(M=s&&a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(m9,{connection:a.connection}),(0,Q.jsx)(g9,{connection:a.connection})]}),t[47]=a,t[48]=s,t[49]=M):M=t[49];let N;t[50]===n?N=t[51]:(N=(0,Q.jsx)(whe,{remote:n}),t[50]=n,t[51]=N);let P;t[52]===s?P=t[53]:(P=!s&&(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[(0,Q.jsx)(i8,{children:`Pair again`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On this computer, run porcelain pair. Return to Computers and add the new link to replace this app’s saved connection.`})]})}),t[52]=s,t[53]=P);let F;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(X6,{variant:`label`,children:`Danger zone`}),t[54]=F):F=t[54];let I;t[55]===c?I=t[56]:(I=(0,Q.jsxs)(i8,{children:[`Forget `,c]}),t[55]=c,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer from this app. Other devices keep their access.`}),t[57]=L):L=t[57];let R;t[58]===o?R=t[59]:(R=()=>void o.submit(),t[58]=o,t[59]=R);let ee=o.result.waiting?`Forgetting…`:`Forget on this app`,z;t[60]!==o.result.waiting||t[61]!==R||t[62]!==ee?(z=(0,Q.jsx)(zG,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:R,children:ee}),t[60]=o.result.waiting,t[61]=R,t[62]=ee,t[63]=z):z=t[63];let te;t[64]===o.result?te=t[65]:(te=Nw(o.result)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(o.result.cause))})}),t[64]=o.result,t[65]=te);let ne;t[66]!==I||t[67]!==z||t[68]!==te?(ne=(0,Q.jsxs)(Y6,{children:[F,(0,Q.jsx)(`div`,{className:`rounded-2xl border border-destructive/30`,children:(0,Q.jsx)(e8,{children:(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[I,L,z,te]})})})})]}),t[66]=I,t[67]=z,t[68]=te,t[69]=ne):ne=t[69];let re;return t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==P||t[74]!==ne?(re=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[j,M,N,P,ne]}),t[70]=j,t[71]=M,t[72]=N,t[73]=P,t[74]=ne,t[75]=re):re=t[75],re}var khe=Ck(e=>e.registry),S9=X(e=>Ck(t=>{let n=window.matchMedia(e),r=()=>t.setSelf(n.matches);return n.addEventListener(`change`,r),t.addFinalizer(()=>n.removeEventListener(`change`,r)),n.matches})),Ahe=Ck(()=>{let e=document.title,t=new Map;return n=>{let r=Symbol();return t.set(r,n),document.title=n,()=>{t.delete(r),document.title=[...t.values()].at(-1)??e}}}),jhe=X(e=>Ck(t=>{t.addFinalizer(t(Ahe)(e))}));function C9(){let e=(0,VW.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],tI(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(wI(27));return t}var E9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=T9(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return mB(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:hR,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),D9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=T9(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=GB({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,dV(eV,e.nativeEvent))}return mB(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),O9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=sq(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),mB(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function Mhe(){let e=Z.useContext(k9);if(e===void 0)throw Error(wI(26));return e}var Nhe=`--nested-dialogs`,Phe=`data-nested-dialog-open`,Fhe={...mR,...tR,nestedDialogOpen(e){return e?{[Phe]:``}:null}},A9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=T9(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Mhe(),EB({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?CU(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=mB(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...SU,hidden:!m,onKeyDown(e){$8.has(e.key)&&e.stopPropagation()},style:{[Nhe]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Fhe});return(0,Q.jsx)(sH,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),j9=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=T9(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(k9.Provider,{value:n,children:(0,Q.jsxs)(_V,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(s5,{ref:i.context.internalBackdropRef,inert:xB(!s)}),e.children]})}):null});function Ihe({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=mH(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=WL(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||UL(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return p5(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),xI(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),PU(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...UU,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},Lhe=class extends KI{constructor(e,t,n){let r=new IU,i=N9(e,r,t,n);super(i,P9(r),M9)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled||(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(OU(this.state,e,t.trigger)))}};function Rhe(){let e=new IU;return new eq(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...LU(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function P9(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function F9(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=T9(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=wU((e,t)=>new Lhe({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);FU(b,x),MU(b);let{forceUnmount:w}=NU(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,dV(lV))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(TU,{handle:u,store:b}),T&&(0,Q.jsx)(Ihe,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=jI(function(e){return F9(`dialog`,e)}),L9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=sq(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),mB(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function zhe({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function Bhe({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:jG(`fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function z9({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(zhe,{children:[(0,Q.jsx)(Bhe,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:jG(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,Q.jsxs)(D9,{"data-slot":`sheet-close`,render:(0,Q.jsx)(zG,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(ZK,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:jG(`flex flex-col gap-1.5 p-6`,e),...t})}function V9({className:e,...t}){return(0,Q.jsx)(L9,{"data-slot":`sheet-title`,className:jG(`font-heading text-sm font-medium text-foreground`,e),...t})}function H9({className:e,...t}){return(0,Q.jsx)(O9,{"data-slot":`sheet-description`,className:jG(`text-xs/relaxed text-muted-foreground`,e),...t})}var Vhe=`sidebar_state`,Hhe=604800,Uhe=`16rem`,Whe=`18rem`,Ghe=`3rem`,Khe=`b`,U9=Z.createContext(null);function W9(){let e=Z.useContext(U9);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function qhe({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=C9(),[c,l]=Z.useState(!1),[u,d]=Z.useState(e),f=t??u,p=Z.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Vhe}=${t}; path=/; max-age=${Hhe}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===Khe&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=Z.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,Q.jsx)(U9.Provider,{value:g,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Uhe,"--sidebar-width-icon":Ghe,...i},className:jG(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Jhe({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=W9();return n===`none`?(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:jG(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,Q.jsx)(R9,{open:l,onOpenChange:u,...o,children:(0,Q.jsxs)(z9,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Whe},side:e,children:[(0,Q.jsxs)(B9,{className:`sr-only`,children:[(0,Q.jsx)(V9,{children:`Sidebar`}),(0,Q.jsx)(H9,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:jG(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:jG(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Yhe({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(zG,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:jG(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(FK,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Xhe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:jG(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function Zhe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:jG(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function Qhe({className:e,render:t,...n}){return $6({defaultTagName:`button`,props:eB({className:jG(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-action`,sidebar:`group-action`}})}function $he({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:jG(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function ege({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:jG(`group/menu-item relative`,e),...t})}var G9=Z.createContext(void 0);function K9(e){let t=Z.useContext(G9);if(t===void 0&&!e)throw Error(wI(47));return t}var tge={...UU,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},nge=class extends KI{constructor(e,t,n){let r=new IU;super(rge(e,r,t,n),ige(r),tge)}setOpen=(e,t)=>{let n=t.reason===XB,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=kU(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=OU(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),SI.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function rge(e,t,n,r=!1){let i={...LU(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function ige(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new EL,triggerElements:e}}var q9=jI(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=oge(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),FU(u,d),MU(u);let{forceUnmount:m}=NU(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,dV(lV))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(TU,{handle:s,store:u}),h&&(0,Q.jsx)(sge,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function age(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(QV,{children:(0,Q.jsx)(q9,{props:e})})}function oge(e,t){let n=wU((e,n)=>new nge(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function sge({store:e,modal:t}){let n=mH(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return PU(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var cge=MI(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=K9(!0),h=WU(s)??m;if(!h)throw Error(wI(74));let g=sq(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=jU(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=rW(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:bW(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=cH(v,{stickIfOpen:T}),A=y5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=GB({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?pR.open(e):fR.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=E5(h,x),R=mB(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[OB]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),ee=(0,Q.jsx)(Z.Fragment,{children:R},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Vz,{ref:F,onFocus:I}),ee,(0,Q.jsx)(Vz,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):ee}),J9=Z.createContext(void 0);function lge(){let e=Z.useContext(J9);if(e===void 0)throw Error(wI(45));return e}var uge=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return K9().useState(`mounted`)||n?(0,Q.jsx)(J9.Provider,{value:n,children:(0,Q.jsx)(_V,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function dge(){let e=Z.useContext(Y9);if(!e)throw Error(wI(46));return e}var fge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=PB,..._}=e,v=K9(),y=lge(),b=XV(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=TB(O),P=IW({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);xI(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;m5(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=BW(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(Y9.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(s5,{inert:xB(!C),cutout:T}),(0,Q.jsx)(ZV,{id:b,children:R})]})}),pge=Z.createContext(void 0);function mge(){let[e,t]=Z.useState(0),n=UI(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var hge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=dge(),u=q8(!0)!=null,{context:d,hasClosePart:f}=mge(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);EB({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),tW(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?CU(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=mB(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...SU,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&$8.has(e.key)&&e.stopPropagation()}},zW(g),s],stateAttributesMapping:hR});return(0,Q.jsx)(sH,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:$I(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(pge.Provider,{value:d,children:M})})}),gge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=sq(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),mB(`h2`,e,{ref:t,props:[{id:s},a]})}),_ge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=sq(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),mB(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(age,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(cge,{"data-slot":`popover-trigger`,...e})}function Q9({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,Q.jsx)(uge,{children:(0,Q.jsx)(fge,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(hge,{"data-slot":`popover-content`,className:jG(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function vge({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:jG(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(gge,{"data-slot":`popover-title`,className:jG(`text-sm font-medium`,e),...t})}function yge({className:e,...t}){return(0,Q.jsx)(_ge,{"data-slot":`popover-description`,className:jG(`text-muted-foreground`,e),...t})}function bge(e){let t=(0,VW.c)(84),{fallbackFocus:n}=e,{rows:r,targets:i,count:a,batch:o,run:s,failures:c,checking:l,refresh:u,retry:d}=I5(),f=jF(),{setOpenMobile:p}=W9(),[m,h]=(0,Z.useState)(!1),g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[0]!==o||t[1]!==l||t[2]!==c||t[3]!==n||t[4]!==m||t[5]!==u||t[6]!==d||t[7]!==r||t[8]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(wge),a=r.filter(t=>e.includes(t)||o.entries.some(e=>e.id===t.target.id&&e.kind===t.target.kind)),s;t[24]===o?s=t[25]:(s=vce(o),t[24]=o,t[25]=s);let f=s;v=f.label?`${f.label}…`:`Preparing updates…`;let p;t[26]!==o||t[27]!==i?(p=hce(i,o),t[26]=o,t[27]=i,t[28]=p):p=t[28];let j=p,M=`Updates available`;if(!j&&o.entries.length===0&&(M=`No updates available`),c.length>0&&(M=`Could not check for updates`),!j&&!m){S=null;break bb0}_=X9,A=m,t[29]===u?b=t[30]:(b=e=>{h(e),e&&u()},t[29]=u,t[30]=b);let N=!j&&`invisible`,P;t[31]===N?P=t[32]:(P=jG(N),t[31]=N,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(d8,{render:(0,Q.jsx)(`button`,{type:`button`})}),t[33]=F):F=t[33];let I=o.running?`Updating…`:`Update`;t[34]!==P||t[35]!==I?(x=(0,Q.jsx)(`span`,{className:`inline-flex [--primary:var(--brand-soft)] [--primary-foreground:var(--brand)]`,children:(0,Q.jsx)(Z9,{className:P,render:F,children:I})}),t[34]=P,t[35]=I,t[36]=x):x=t[36],g=Q9,w=`top`,T=`end`,E=`max-h-(--available-height) w-88 max-w-[calc(100vw-1rem)] overflow-y-auto`,t[37]!==n||t[38]!==j?(D=j?!0:()=>n.element,t[37]=n,t[38]=j,t[39]=D):D=t[39],t[40]===M?O=t[41]:(O=(0,Q.jsx)($9,{children:M}),t[40]=M,t[41]=O),t[42]!==l||t[43]!==c||t[44]!==d?(k=c.length>0&&(0,Q.jsxs)(c8,{variant:`destructive`,children:[(0,Q.jsx)(l8,{children:`The update check failed`}),(0,Q.jsxs)(u8,{children:[c.map(Cge),(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:l,onClick:d,children:`Try again`})]})]}),t[42]=l,t[43]=c,t[44]=d,t[45]=k):k=t[45],y=`flex max-h-[60svh] flex-col divide-y overflow-y-auto`,C=a.map(Sge)}t[0]=o,t[1]=l,t[2]=c,t[3]=n,t[4]=m,t[5]=u,t[6]=d,t[7]=r,t[8]=i,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let j;if(t[46]!==o.entries||t[47]!==r){let e;t[49]===r?e=t[50]:(e=e=>!r.some(t=>{let{target:n}=t;return n.id===e.id&&n.kind===e.kind}),t[49]=r,t[50]=e),j=o.entries.filter(e).map(xge),t[46]=o.entries,t[47]=r,t[48]=j}else j=t[48];let M;t[51]!==y||t[52]!==j||t[53]!==C?(M=(0,Q.jsxs)(`div`,{className:y,children:[C,j]}),t[51]=y,t[52]=j,t[53]=C,t[54]=M):M=t[54];let N;t[55]!==f||t[56]!==p?(N=(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`,onClick:()=>{h(!1),p(!1),f({to:`/settings/$section`,params:{section:`computers`}})},children:`Manage computers`}),t[55]=f,t[56]=p,t[57]=N):N=t[57];let P=o.running||a===0,F;t[58]!==s||t[59]!==i?(F=()=>s(i),t[58]=s,t[59]=i,t[60]=F):F=t[60];let I=o.running?v:`Update all (${a})`,L;t[61]!==P||t[62]!==F||t[63]!==I?(L=(0,Q.jsx)(zG,{size:`sm`,disabled:P,"aria-live":`polite`,onClick:F,children:I}),t[61]=P,t[62]=F,t[63]=I,t[64]=L):L=t[64];let R;t[65]!==N||t[66]!==L?(R=(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t pt-3`,children:[N,L]}),t[65]=N,t[66]=L,t[67]=R):R=t[67];let ee;t[68]!==g||t[69]!==M||t[70]!==R||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O||t[76]!==k?(ee=(0,Q.jsxs)(g,{side:w,align:T,className:E,finalFocus:D,children:[O,k,M,R]}),t[68]=g,t[69]=M,t[70]=R,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=k,t[77]=ee):ee=t[77];let z;return t[78]!==_||t[79]!==b||t[80]!==x||t[81]!==ee||t[82]!==A?(z=(0,Q.jsxs)(_,{open:A,onOpenChange:b,children:[x,ee]}),t[78]=_,t[79]=b,t[80]=x,t[81]=ee,t[82]=A,t[83]=z):z=t[83],z}function xge(e){return(0,Q.jsxs)(`div`,{className:`py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,Q.jsx)(`p`,{role:e.status===`failed`?`alert`:`status`,className:`text-xs text-muted-foreground`,children:Tge(e)})]},`${e.kind}:${e.id}`)}function Sge(e){return(0,Q.jsx)(`div`,{className:`py-3`,children:(0,Q.jsx)(J5,{row:e,showName:!0})},`${e.target.kind}:${e.target.id}`)}function Cge(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function wge(e){let{target:t}=e;return G4(t)}function Tge(e){return e.status===`failed`?e.message:e.status===`updated`?`Updated to ${e.version}.`:e.status===`queued`?`Queued`:`Updating to ${e.version}…`}export{S7 as $,xB as $a,up as $c,T0 as $i,h6 as $n,TF as $o,H3 as $r,mO as $s,u8 as $t,E9 as A,RG as Aa,bC as Ac,Lce as Ai,L6 as An,xI as Ao,e6 as Ar,moe as As,hfe as At,xhe as B,cV as Ba,U as Bc,uce as Bi,que as Bn,oI as Bo,Dle as Br,Ck as Bs,k8 as Bt,I9 as C,lK as Ca,pC as Cc,f3 as Ci,z6 as Cn,bL as Co,cue as Cr,voe as Cs,X8 as Ct,A9 as D,tK as Da,EC as Dc,c3 as Di,ude as Dn,KI as Do,aue as Dr,KP as Ds,Q8 as Dt,j9 as E,rK as Ea,Are as Ec,Fce as Ei,lde as En,YI as Eo,sue as Er,xoe as Es,$8 as Et,Ehe as F,vV as Fa,Sg as Fc,Tce as Fi,Yue as Fn,hI as Fo,Ble as Fr,X as Fs,L8 as Ft,F7 as G,WB as Ga,Bp as Gc,u4 as Gi,zue as Gn,zF as Go,wle as Gr,pk as Gs,w8 as Gt,vhe as H,JB as Ha,Um as Hc,A4 as Hi,y6 as Hn,tI as Ho,Ele as Hr,bk as Hs,D8 as Ht,Dhe as I,dV as Ia,mg as Ic,r3 as Ii,Xue as In,cI as Io,X3 as Ir,Hk as Is,P8 as It,z7 as J,BB as Ja,Pm as Jc,a4 as Ji,Rue as Jn,Zoe as Jo,yle as Jr,PO as Js,x8 as Jt,R7 as K,VB as Ka,Op as Kc,Ase as Ki,Fue as Kn,LF as Ko,Cle as Kr,HO as Ks,C8 as Kt,Che as L,iV as La,lm as Lc,Ece as Li,Jue as Ln,aI as Lo,Y3 as Lr,Rk as Ls,F8 as Lt,khe as M,jG as Ma,Fy as Mc,i3 as Mi,ode as Mn,vI as Mo,Wle as Mr,UP as Ms,G8 as Mt,jhe as N,SW as Na,py as Nc,a3 as Ni,Zue as Nn,gI as No,Gle as Nr,CP as Ns,H8 as Nt,O9 as O,$G as Oa,DC as Oc,Pce as Oi,R6 as On,UI as Oo,Zle as Or,boe as Os,ffe as Ot,S9 as P,xU as Pa,my as Pc,t3 as Pi,Que as Pn,_I as Po,Ule as Pr,Bk as Ps,I8 as Pt,C7 as Q,EB as Qa,Ep as Qc,A2 as Qi,Pue as Qn,EF as Qo,U3 as Qr,OO as Qs,c8 as Qt,She as R,oV as Ra,Pp as Rc,Dce as Ri,Uue as Rn,pI as Ro,Mle as Rr,Jk as Rs,A8 as Rt,L9 as S,_K as Sa,dC as Sc,zce as Si,B6 as Sn,DL as So,lue as Sr,qP as Ss,Y8 as St,Rhe as T,aK as Ta,FS as Tc,Rce as Ti,fde as Tn,vL as To,i6 as Tr,nF as Ts,J8 as Tt,che as U,YB as Ua,sp as Uc,D4 as Ui,Iue as Un,GF as Uo,Tle as Ur,iA as Us,E8 as Ut,b9 as V,sV as Va,Cp as Vc,I4 as Vi,Hue as Vn,fI as Vo,jle as Vr,Zk as Vs,O8 as Vt,s9 as W,GB as Wa,H as Wc,w4 as Wi,Lue as Wn,VF as Wo,Ole as Wr,Nk as Ws,T8 as Wt,L7 as X,jB as Xa,B as Xc,J2 as Xi,jue as Xn,AF as Xo,ble as Xr,IO as Xs,f8 as Xt,xme as Y,IB as Ya,sm as Yc,o4 as Yi,Mue as Yn,jF as Yo,xle as Yr,MO as Ys,b8 as Yt,I7 as Z,MB as Za,V as Zc,j2 as Zi,Nue as Zn,OF as Zo,W3 as Zr,RO as Zs,d8 as Zt,R9 as _,LK as _a,sC as _c,Gce as _i,Yn as _l,q6 as _n,HL as _o,due as _r,woe as _s,x5 as _t,vge as a,SJ as aa,Aw as ac,Xce as ai,td as al,e8 as an,Bz as ao,Aue as ar,Voe as as,N5 as at,B9 as b,kK as ba,q as bc,h3 as bi,qn as bl,U6 as bn,zL as bo,uue as br,eF as bs,i5 as bt,Jhe as c,jq as ca,jw as cc,Yce as ci,Iu as cl,$6 as cn,sz as co,wue as cr,yF as cs,A5 as ct,Qhe as d,Dq as da,Bw as dc,qce as di,dr as dl,Sde as dn,DR as do,xue as dr,Moe as ds,M5 as dt,FZ as ea,PD as ec,lle as ei,xm as el,l8 as en,mB as eo,f6 as er,Koe as es,g7 as et,$he as f,wq as fa,J as fc,x3 as fi,lee as fl,xde as fn,CR as fo,vue as fr,joe as fs,Qfe as ft,W9 as g,VK as ga,FC as gc,_3 as gi,Jn as gl,J6 as gn,ZL as go,mue as gr,rF as gs,w5 as gt,Yhe as h,ZK as ha,oC as hc,v3 as hi,er as hl,yde as hn,QL as ho,pue as hr,iF as hs,T5 as ht,yge as i,EJ as ia,Ww as ic,ole as ii,cd as il,a8 as in,zz as io,d6 as ir,Roe as is,K5 as it,C9 as j,LG as ja,W as jc,Ice as ji,sde as jn,bI as jo,Q3 as jr,WP as js,K8 as jt,D9 as k,zG as ka,jC as kc,Nce as ki,I6 as kn,wI as ko,Xle as kr,YP as ks,mfe as kt,Xhe as l,kq as la,Tw as lc,S3 as li,Au as ll,Z6 as ln,oz as lo,u6 as lr,pF as ls,j5 as lt,qhe as m,sq as ma,qC as mc,g3 as mi,rr as ml,Y6 as mn,tR as mo,yue as mr,Poe as ms,D5 as mt,X9 as n,OY as na,ND as nc,k3 as ni,Rd as nl,o8 as nn,Hz as no,p6 as nr,Hoe as ns,G5 as nt,$9 as o,xJ as oa,Nw as oc,Zce as oi,Ru as ol,n8 as on,lz as oo,Oue as or,zoe as os,O5 as ot,ege as p,Eq as pa,ZS as pc,Kce as pi,Zn as pl,X6 as pn,pR as po,bue as pr,koe as ps,k5 as pt,bme as q,HB as qa,Am as qc,s4 as qi,v6 as qn,sse as qo,Sle as qr,NO as qs,S8 as qt,Q9 as r,wJ as ra,GD as rc,A3 as ri,wd as rl,r8 as rn,Vz as ro,kue as rr,Uoe as rs,q5 as rt,Z9 as s,Pq as sa,Ow as sc,Qce as si,Lu as sl,i8 as sn,cz as so,Eue as sr,vF as ss,Yfe as st,bge as t,mZ as ta,jD as tc,cle as ti,kd as tl,t8 as tn,eB as to,g6 as tr,CF as ts,Q5 as tt,Zhe as u,Tq as ua,Uw as uc,Jce as ui,wu as ul,Q6 as un,uz as uo,Sue as ur,Aoe as us,Jfe as ut,z9 as v,NK as va,eC as vc,Uce as vi,ir as vl,vde as vn,UL as vo,o6 as vr,Doe as vs,h5 as vt,F9 as w,sK as wa,jre as wc,Bce as wi,mde as wn,yL as wo,oue as wr,GP as ws,Z8 as wt,V9 as x,xK as xa,qS as xc,p3 as xi,cr as xl,H6 as xn,EL as xo,hue as xr,Eoe as xs,n5 as xt,H9 as y,jK as ya,K as yc,Vce as yi,Kn as yl,G6 as yn,WL as yo,_ue as yr,Toe as ys,a5 as yt,x9 as z,lV as za,fm as zc,$4 as zi,Kue as zn,sI as zo,Nle as zr,aA as zs,j8 as zt};
|
|
17
|
+
`:i===`event`?u=a:i===`id`&&!a.includes(`\0`)?l=a:i===`retry`&&/^\d+$/.test(a)&&e(new IA({duration:qi(parseInt(a,10)),lastEventId:l}))}}var kA=``,AA=10,jA=13,MA=32,NA=q({_tag:mC(`Event`),id:cC(K),event:K,data:K}),PA=Fy({decode:e=>e.id===void 0?{event:e.event,data:e.data}:{id:e.id,event:e.event,data:e.data},encode:e=>({_tag:`Event`,id:e.id,event:e.event??`message`,data:e.data})}),FA=`~effect/encoding/Sse/Retry`,IA=class e extends Ea(`Retry`){[FA]=FA;static is(e){return F(e,FA)}static filter(t){return e.is(t)?Ur(t):Wr(t)}},LA=`~effect/http/HttpBody`,RA=e=>F(e,LA),zA=class{[LA];constructor(){this[LA]=LA}[nt](){return this.toJSON()}toString(){return Ge(this,{ignoreToString:!0})}},BA=new class extends zA{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},VA=class extends zA{_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??=GA(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}}},HA=(e,t)=>new VA(e,t??`application/octet-stream`,e.length),UA=new TextEncoder,WA=globalThis.Buffer,GA=WA===void 0?e=>UA.encode(e):e=>WA.from(e,`utf8`),KA=(e,t)=>{if(typeof e!=`string`&&(e=e===void 0?``:String(e)),WA!==void 0)return new VA(void 0,t??`text/plain`,WA.byteLength(e,`utf8`),e);let n=UA.encode(e);return new VA(n,t??`text/plain`,n.length,e)},qA=(e,t)=>KA(rv(J_(e)),t??`application/x-www-form-urlencoded`),JA=class extends zA{_tag=`FormData`;contentType=void 0;contentLength=void 0;formData;constructor(e){super(),this.formData=e}toJSON(){return{_id:`effect/HttpBody`,_tag:`FormData`,formData:this.formData}}},YA=e=>new JA(e),XA=class extends zA{_tag=`Stream`;stream;contentType;contentLength;constructor(e,t,n){super(),this.stream=e,this.contentType=t,this.contentLength=n}toJSON(){return{_id:`effect/HttpBody`,_tag:`Stream`,contentType:this.contentType,contentLength:this.contentLength}}},ZA=(e,t,n)=>new XA(e,t??`application/octet-stream`,n),QA={"~effect/Ref":{_A:o},...wt,toJSON(){return{_id:`Ref`,ref:this.ref}}},$A=e=>{let t=Object.create(QA);return t.ref=nT(e),t},ej=e=>V(()=>$A(e)),tj=e=>V(()=>e.ref.current),nj=a(2,(e,t)=>V(()=>rT(e.ref,t))),rj=a(2,(e,t)=>V(()=>{let n=e.ref.current;return e.ref.current=t,n})),ij=a(2,(e,t)=>V(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),aj=a(2,(e,t)=>V(()=>{e.ref.current=t(e.ref.current)})),oj=`~effect/http/HttpClientError`,sj=e=>F(e,oj),cj=class extends Da(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[oj]=oj;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},lj=e=>e.endsWith(`Error`)?e.slice(0,-5):e,uj=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,dj=e=>`${e.method} ${sv(e.url)}`,fj=(e,t)=>({...t,request:{_id:`HttpClientRequest`,method:e.request.method,url:sv(e.request.url)},...`response`in e?{response:{_id:`HttpClientResponse`,status:e.response.status}}:void 0}),pj=class extends Da(`TransportError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},mj=class extends Da(`EncodeError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},hj=class extends Da(`InvalidUrlError`){get methodAndUrl(){return dj(this.request)}get message(){return uj(lj(this._tag),this.description,this.methodAndUrl)}toJSON(){return fj(this,super.toJSON())}},gj=class extends Da(`StatusCodeError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},_j=class extends Da(`DecodeError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},vj=class extends Da(`EmptyBodyError`){get methodAndUrl(){return dj(this.request)}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return uj(lj(this._tag),this.description,e)}toJSON(){return fj(this,super.toJSON())}},yj=class e extends vw(oj)({_tag:mC(`HttpError`),kind:oC([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:W(zC())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}};function bj(e){return e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`}var xj=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`],[`QUERY`,`query`]],Sj=(e,t)=>t._tag===`Empty`||t._tag===`FormData`?L_(L_(e,`content-type`),`content-length`):(e=t.contentType===void 0?L_(e,`content-type`):P_(e,`content-type`,t.contentType),Cj(e,t)),Cj=(e,t)=>{let n=t._tag===`Empty`||t._tag===`FormData`?void 0:t.contentLength;return n===void 0?L_(e,`content-length`):P_(e,`content-length`,n.toString())},wj=class extends Da(`UrlError`){},Tj=(e,t,n)=>Gr({try:()=>{let r=new URL(e,Ej());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,V_(i))}return n!==void 0&&(r.hash=n),r},catch:e=>new wj({cause:e})}),Ej=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0){let e=location.origin+location.pathname;try{return new URL(e).href}catch{return}}},Dj=`~effect/http/HttpClientRequest`,Oj={[Dj]:Dj,...at,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:sv(this.url),urlParams:this.urlParams,hash:this.hash,headers:Be(this.headers),body:this.body.toJSON()}},pipe(){return n(this,arguments)}};function kj(e,t,n,r,i,a){let o=Object.create(Oj);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var Aj=kj(`GET`,``,$_,Kn(),j_,BA),jj=e=>(t,n)=>Nj(Aj,{method:e,url:t,...n??void 0}),Mj=jj(`GET`),Nj=a(2,(e,t)=>{let n=e;return t.method&&(n=Pj(n,t.method)),t.url&&(n=Bj(n,t.url)),t.headers&&(n=Ij(n,t.headers)),t.urlParams&&(n=Uj(n,t.urlParams)),t.hash&&(n=Gj(n,t.hash)),t.body&&(n=Kj(n,t.body)),t.accept&&(n=Lj(n,t.accept)),t.acceptJson&&(n=Rj(n)),n}),Pj=a(2,(e,t)=>kj(t,e.url,e.urlParams,e.hash,e.headers,e.body)),Fj=a(3,(e,t,n)=>kj(e.method,e.url,e.urlParams,e.hash,P_(e.headers,t,n),e.body)),Ij=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,F_(e.headers,t),e.body)),Lj=a(2,(e,t)=>Fj(e,`Accept`,t)),Rj=Lj(`application/json`),zj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,P_(P_(e.headers,`connection`,`Upgrade`),`upgrade`,t),e.body)),Bj=a(2,(e,t)=>{if(typeof t==`string`)return kj(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=J_(n.searchParams),i=$n(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,kj(e.method,n.toString(),r,i,e.headers,e.body)}),Vj=a(2,(e,t)=>t===``?e:kj(e.method,Hj(t,e.url),e.urlParams,e.hash,e.headers,e.body)),Hj=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},Uj=a(2,(e,t)=>kj(e.method,e.url,tv(e.urlParams,t),e.hash,e.headers,e.body)),Wj=a(2,(e,t)=>kj(e.method,e.url,nv(e.urlParams,t),e.hash,e.headers,e.body)),Gj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,qn(t),e.headers,e.body)),Kj=a(2,(e,t)=>kj(e.method,e.url,e.urlParams,e.hash,Sj(e.headers,t),t)),qj=a(2,(e,t)=>Kj(e,YA(t)));function Jj(e){let t=Tj(e.url,e.urlParams,er(e.hash));return qr(t)?qn(t.success):Kn()}var Yj=`~effect/http/HttpIncomingMessage`,Xj=(e,t)=>({...t,headers:Be(e.headers),remoteAddress:e.remoteAddress}),Zj=`~effect/http/HttpClientResponse/WebSource`,Qj=e=>e[Zj]?.(),$j=`~effect/http/HttpClientResponse`,eM=(e,t)=>new tM(e,t),tM=class extends ot{[Yj];[$j];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[Yj]=Yj,this[$j]=$j}toJSON(){return Xj(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=Jj(this.request);return Jn(e)?``:(e.value.hash=``,e.value.href)}get headers(){return M_(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=f_(this.source.headers.getSetCookie?.()??[])}get remoteAddress(){return Kn()}[Zj](){return this.source}get stream(){return this.source.body?AD({evaluate:()=>this.source.body,onError:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}):TD(new cj({reason:new vj({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return Cp(this.text,e=>bp({try:()=>e===``?null:JSON.parse(e),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody??=Op(this.arrayBuffer,e=>new TextDecoder().decode(e))}get urlParamsBody(){return Cp(this.arrayBuffer,e=>bp({try:()=>J_(U_(e)),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=up({try:()=>this.source.formData(),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}).pipe(gm,Rm)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody||=up({try:()=>this.source.arrayBuffer(),catch:e=>new cj({reason:new _j({request:this.request,response:this,cause:e})})}).pipe(gm,Rm),this.arrayBufferBody}get upgrade(){return U(new cj({reason:new gj({request:this.request,response:this,description:`fetch cannot hand over the connection of an HTTP upgrade`})}))}pipe(){return n(this,arguments)}},nM=e=>N_({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${Xn(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId.padStart(32,`0`)}-${e.spanId}-${e.sampled?`01`:`00`}`}),rM={"http:":80,"https:":443,"ws:":80,"wss:":443},iM=(e,t,n)=>{let r=sv(t.search,n).slice(1);if(e.attribute(`url.full`,sv(t.href,n)),e.attribute(`url.path`,t.pathname),r!==``&&e.attribute(`url.query`,r),e.attribute(`url.scheme`,t.protocol.slice(0,-1)),t.hostname!==``){e.attribute(`server.address`,t.hostname.startsWith(`[`)?t.hostname.slice(1,-1):t.hostname);let n=t.port===``?rM[t.protocol]:Number(t.port);n!==void 0&&e.attribute(`server.port`,n)}},aM=(e,t)=>{let n=e.params.filter(([,e])=>typeof e!=`string`).map(([e])=>e);return n.length===0?t:[...t,...new URLSearchParams(n.map(e=>[e,``])).keys()]},oM=(e,t,n,r,i)=>{for(let a in n)r(a,t)&&e.attribute(`http.${t}.header.${a}`,z_(a,i)?`<redacted>`:n[a])},sM=`~effect/http/HttpClient`,cM=dr(`effect/HttpClient`),lM=a(2,(e,t)=>uM(n=>t(e.postprocess(n)),e.preprocess)),uM=(e,t)=>{let n=Object.create(dM);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},dM={[sM]:sM,pipe(){return n(this,arguments)},...at,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(xj.map(([e,t])=>[t,function(t,n){return this.execute(jj(e)(t,n))}]))},fM=e=>uM(t=>Cp(t,t=>Sp(n=>{let r=xM.get(t),i=r??new AbortController,a=Tj(t.url,t.urlParams,er(t.hash));if(Kr(a))return U(new cj({reason:new hj({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(za)||n.getRef(hM)(t)){let a=e(t,o,i.signal,n);return r?Op(a,e=>CM(e,i,!0)):xm(e=>Zp(e(a),{onSuccess(e){return B(CM(e,i,!1))},onFailure(e){return Eu(e)&&i.abort(),_p(e)}}))}return wm(n.getRef(vM)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method);let s=n.getRef(B_);iM(a,o,aM(t.urlParams,n.getRef(hv)));let c=n.getRef(gM);return oM(a,`request`,t.headers,c,s),t=n.getRef(_M)?Ij(t,nM(a)):t,xm(l=>l(e(t,o,i.signal,n)).pipe(Tm(a,{captureStackTrace:!1}),Zp({onSuccess:e=>(a.attribute(`http.response.status_code`,e.status),oM(a,`response`,e.headers,c,s),e.status>=400&&e.status<600&&(a.attribute(`error.type`,String(e.status)),pM(n,a,t,e)),B(CM(e,i,r!==void 0))),onFailure(e){return!r&&Eu(e)&&i.abort(),_p(e)}})))})})),B),pM=(e,t,n,r)=>{let i=ct();lt(0);let a;try{a=Pu(new cj({reason:new gj({request:n,response:r})}))}finally{lt(i)}t.end(e.getRef($u)?e.getRef(Bd).currentTimeNanosUnsafe():BigInt(0),a)},mM=a(2,(e,t)=>uM(e.postprocess,n=>Op(e.preprocess(n),t))),hM=Br(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>l}),gM=Br(`effect/http/HttpClient/TracerHeaderFilter`,{defaultValue:()=>l}),_M=Br(`effect/http/HttpClient/TracerPropagationEnabled`,{defaultValue:c}),vM=Br(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>e.method}),yM=e=>kd(cM)(em(t=>Op(e,e=>lM(e,im(e=>Rr(t,e)))))),bM=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{try{e.abort()}catch{}});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new WeakMap;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))}}})(),xM=new WeakMap,SM=new WeakMap,CM=(e,t,n)=>(n||(bM.register(e,t),e=new wM(e,t)),SM.set(e,t),e),wM=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[$j]=$j;[Yj]=Yj;applyInterrupt(e){return fp(()=>(bM.unregister(this.original),ym(e,()=>V(()=>{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 upgrade(){return this.applyInterrupt(this.original.upgrade)}[Zj](){let e=Qj(this.original);return e!==void 0&&bM.unregister(this.original),e}get stream(){return CD(()=>(bM.unregister(this.original),eO(this.original.stream,V(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[nt](){return this.original[nt]()}pipe(){return n(this,arguments)}};function TM(e,t){let n=1;for(;t<e.length;)if(t++,e[t]===`\\`)t++;else if(e[t]===`)`?n--:e[t]===`(`&&n++,!n)return t;throw TypeError(`Invalid regexp expression in "`+e+`"`)}var EM=`~effect/socket/Socket`,DM=e=>F(e,EM),OM=dr(`effect/socket/Socket`),kM=e=>OM.of({[EM]:EM,reader:e.reader,writer:e.writer}),AM=new TextEncoder,jM=`~effect/socket/Socket/CloseEvent`,MM=e=>F(e,jM),NM=`~effect/socket/Socket/SocketError`,PM=e=>F(e,NM),FM=class extends vw(`effect/socket/Socket/SocketReadError`)({_tag:mC(`SocketReadError`),cause:zC()}){message=`An error occurred during Read`},IM=class extends vw(`effect/socket/Socket/SocketWriteError`)({_tag:mC(`SocketWriteError`),cause:zC()}){message=`An error occurred during Write`},LM=class extends vw(`effect/socket/Socket/SocketOpenError`)({_tag:mC(`SocketOpenError`),kind:oC([`Unknown`,`Timeout`]),cause:zC()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},RM=class e extends vw(`effect/socket/Socket/SocketUpgradeError`)({_tag:mC(`SocketUpgradeError`),cause:W(zC())}){static unsupported=()=>U(new VM({reason:new e({})}));get message(){return this.cause===void 0?`Socket does not support TLS upgrade`:`An error occurred during TLS upgrade`}},zM=class extends vw(`effect/socket/Socket/SocketCloseError`)({_tag:mC(`SocketCloseError`),code:OC,closeReason:W(K)}){get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},BM=aC([FM,IM,LM,RM,zM]),VM=class extends Y(NM)(`SocketError`,{_tag:mC(`SocketError`),reason:BM}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[NM]=NM;static is(e){return PM(e)}message=this.reason.message},HM=(e,t)=>new VM({reason:new zM({code:e,closeReason:t})}),UM=class extends dr()(`@effect/platform/Socket/WebSocketConstructor`){},WM=(e,t)=>UM.use(n=>KM(lm((typeof e==`string`?B(e):e).pipe(Op(e=>n(e,t?.headers===void 0?t?.protocols:{protocols:t.protocols,headers:t.headers}))),e=>V(()=>e.close(1e3))),t)),GM=e=>`pause`in e&&typeof e.pause==`function`,KM=(e,t)=>Sp(n=>{let r,i=Qw(!1),a=n.context,o=H(function*(){let n=yield*om,a=yield*rd(e,n);`binaryType`in a&&(a.binaryType=`arraybuffer`);let o=GM(a),s=t?.highWaterMark??(o?qM:void 0),c=a.readyState===1,l=o&&`isPaused`in a&&a.isPaused===!0,u=[],f=0,p,m,h;function g(){o&&!l&&(a.pause(),l=!0)}function _(){o&&l&&(a.resume(),l=!1)}function v(){let e=u;return u=[],f=0,p===void 0&&_(),e}function y(){if(m===void 0||u.length===0)return;let e=m;m=void 0,e(B(v()))}function b(e){u.push(e),s!==void 0&&(f+=typeof e==`string`?AM.encode(e).byteLength:e.byteLength),m!==void 0&&y(),o&&f>=s?g():!o&&!m&&s!==void 0&&f>s&&x(new VM({reason:new FM({cause:Error(`Socket highWaterMark of ${s} bytes exceeded`)})}))}function x(e){if(p===void 0&&(p=e),h!==void 0){let{cleanup:e,resume:t}=h;h=void 0,e(),t(U(p))}if(m!==void 0){let e=m;m=void 0,e(u.length>0?B(v()):U(p))}}function S(e){let t=e.data;typeof Blob<`u`&&t instanceof Blob?t.arrayBuffer().then(e=>b(new Uint8Array(e)),e=>{x(new VM({reason:new FM({cause:e})}))}):b(t instanceof ArrayBuffer?new Uint8Array(t):t)}function C(e){x(new VM({reason:c?new FM({cause:e}):new LM({kind:`Unknown`,cause:e})}))}function w(e){x(HM(typeof e.code==`number`?e.code:1006,e.reason))}return a.addEventListener(`message`,S),a.addEventListener(`error`,C,{once:!0}),a.addEventListener(`close`,w,{once:!0}),yield*ad(n,V(()=>{if(x(HM(1006)),a.removeEventListener(`message`,S),a.addEventListener(`error`,d),a.removeEventListener(`error`,C),a.removeEventListener(`close`,w),o)try{_()}catch{}i.closeUnsafe(),r=void 0})),a.readyState>=2?yield*U(p??HM(1006)):(c||=(yield*hp(e=>{let t=()=>{h?.resume===e&&(h=void 0,a.removeEventListener(`open`,t),e(pp))},n=()=>a.removeEventListener(`open`,t);return h={resume:e,cleanup:n},a.addEventListener(`open`,t,{once:!0}),V(()=>{h?.resume===e&&(h=void 0),n()})}).pipe(Gp({duration:t?.openTimeout??1e4,orElse:()=>U(new VM({reason:new LM({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))})),!0),p===void 0&&f<s&&_(),r=a,i.openUnsafe(),{pull:hp(e=>u.length>0?e(B(v())):p===void 0?(m=e,V(()=>{m===e&&(m=void 0)})):e(U(p))),upgrade:RM.unsupported})}).pipe(im(e=>Rr(a,e))),s=e=>fp(()=>{let t=r;if(t===void 0)return i.whenOpen(s(e));try{return MM(e)?t.close(e.code,e.reason):t.send(e),pp}catch(e){return U(new VM({reason:new IM({cause:e})}))}}),c=e=>fp(()=>{let t=r;if(t===void 0)return i.whenOpen(c(e));try{for(let n=0;n<e.length;n++)t.send(e[n]);return pp}catch(e){return U(new VM({reason:new IM({cause:e})}))}});return B(kM({reader:o,writer:B({write:s,writeAll:c})}))}),qM=65536,JM=dr(`effect/http/HttpEffect/CurrentRequestState`),YM=e=>Sp(t=>{let n=Ar(t.context,JM);return n!==void 0&&(n.loggerDisabled=!0),e}),XM=dr(`effect/http/HttpRouter`),ZM=e=>e.endsWith(`/`)?e.slice(0,-1):e,QM=a(2,(e,t)=>(t=ZM(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),$M=`~effect/http/HttpRouter/Middleware`,Iie=function(){return arguments.length===0?eN:eN(arguments[0],arguments[1])},eN=(e,t)=>t?.global?Md(H(function*(){let t=yield*XM,n=ap(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new Rie(ap(e)?jd(Op(e,e=>br(new Map([[tN,e]])))):Td(br(new Map([[tN,e]])))),Lie=0,tN=`effect/http/HttpRouter/MiddlewareFn`,Rie=class e{[$M]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++Lie}`;this.layer=jd(H({self:this},function*(){let e=yield*$p(),t=[jr(e,tN)];if(this.dependencies){let n=yield*bd,r=Nr(e,ed),i=yield*xd(this.dependencies,n,r);t.push(...zie(i))}return br(new Map([[n,t]]))})).pipe(Ld(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?Rd(this.dependencies,t.layer):t.layer)}},nN=new WeakMap,zie=e=>{let t=nN.get(e);if(t)return t;let n=pi(),r=0;for(let[t,i]of e.mapUnsafe)t.startsWith(`effect/http/HttpRouter/Middleware-`)&&(n.push(i),i.length>r&&(r=i.length));if(n.length===0)t=[];else{let e=new Set;for(let t=r-1;t>=0;t--)for(let r of n)t<r.length&&e.add(r[t]);t=si(e).reverse()}return nN.set(e,t),t};Iie(YM).layer;var Bie={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511},rN=e=>Bie[e];function iN(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var Vie=`~effect/http-api/HttpApiSchema/Stream`;function aN(e){let t=typeof e==`string`?rN(e):e;return e=>xN(e.ast)===void 0?e.annotateKey({httpApiStatus:t}):e.annotate({httpApiStatus:t})}var Hie=(e=>QS.pipe(aN(e)))(204);function oN(e){return t=>QS.pipe(pC(WS(t),Fy({decode:e.decode,encode:d})))}var sN=e=>VS(e)&&F(e,Vie),cN=e=>sN(e)&&e._tag===`StreamSse`,lN=e=>sN(e)&&e._tag===`StreamUint8Array`,uN=e=>sN(e)&&e._tag===`StreamNdjson`,dN=`~effect/http-api/HttpApiSchema/Upgrade`,Uie=TS(DM).pipe(aN(101)),Wie=(e,t)=>BS(Uie.ast,{[dN]:dN,protocol:e,headers:t}),fN=e=>VS(e)&&F(e,dN),pN=`~effect/http-api/HttpApiSchema/WithHeaders`,mN=`~effect/http-api/HttpApiSchema/WithHeadersValue`,hN=e=>({[mN]:mN,body:e.body,headers:e.headers}),gN=e=>VS(e)&&F(e,`~effect/http-api/HttpApiSchema/WithHeaders`);function Gie(e,t,n){return BS(e.ast,{[pN]:pN,schema:t,headers:n})}function _N(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??Kie(t._tag)}})}function Kie(e){switch(e){case`Multipart`:return`multipart/form-data`;case`Json`:return`application/json`;case`FormUrlEncoded`:return`application/x-www-form-urlencoded`;case`Uint8Array`:return`application/octet-stream`;case`Text`:return`text/plain`}}function qie(e){return t=>_N(t,{_tag:`FormUrlEncoded`,...e})}function Jie(e){return t=>_N(t,{_tag:`Uint8Array`,...e})}var vN=e=>{if(Qy(e)||Qy(Tx(e)))return!0;let t=e.encoding?.[0].to;return t!==void 0&&Qy(t)},yN=Fx(`~httpApiEncoding`),bN=Fx(`~httpApiWithHeaders`);function xN(e){if(e.checks)for(let t=e.checks.length-1;t>=0;t--){let n=e.checks[t];if(n.annotations&&`httpApiStatus`in n.annotations)return n.annotations;if(n._tag===`FilterGroup`){let e=xN(n);if(e!==void 0)return e}}let t=e.annotations;return t&&`httpApiStatus`in t?t:void 0}function SN(e){let t=xN(e);return t===void 0?e.context?.annotations?.httpApiStatus:t.httpApiStatus}var CN={_tag:`Json`,contentType:`application/json`},Yie={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function Xie(e){return yN(e)??CN}function wN(e,t){return yN(e)||(bj(t)?CN:Yie)}function TN(e){let t=Xie(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function EN(e){return SN(e)??200}function DN(e){return gN(e)?SN(e.ast)??EN(e.schema.ast):EN(e.ast)}function ON(e){return gN(e)&&yN(e.ast)===void 0?TN(e.schema.ast):TN(e.ast)}function kN(e){return SN(e)??500}function AN(e){return gN(e)?SN(e.ast)??kN(e.schema.ast):kN(e.ast)}function jN(e){let t=bw(e);return t.rebuild(NN(t.ast))}var Zie=new jy(py(),gy(lr(k))),MN=m(e=>{if(e._tag===`Undefined`)return new pb(e.annotations,void 0,void 0,e.context);if(e._tag===`Suspend`)return e.recur(MN);if(e._tag!==`Union`)return e;let t=_x(e.types,MN);if(t===e.types)return e;let n=t.filter(e=>e._tag!==`Never`);return n.length===1&&e.checks===void 0&&e.annotations===void 0?sx(n[0],e.context):new Gb(n,e.options,e.annotations,e.checks,void 0,e.context)}),NN=hx(e=>{if(e._tag===`Union`||e._tag===`Suspend`)return e.recur(NN);if(e._tag!==`Objects`)return e;let t=_x(e.propertySignatures,e=>{let t=Tx(e.type);if(!Sx(t))return e;let n=MN(t);return n===t?e:new Tb(e.name,xx(n,e.type,Zie))});return t===e.propertySignatures?e:new kb(t,e.indexSignatures,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}),PN=`~effect/http-api/HttpApiEndpoint`;function Qie(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function $ie(e){let t=Array.from(e.success);return di(t)?t:[Hie]}function eae(e){let t=new Set(e.error),n=e.disableCodecs?o:BN;for(let r of e.middlewares){let e=r;for(let r of e.error)t.add(n(r))}return Array.from(t)}var tae={[PN]:PN,pipe(){return n(this,arguments)},prefix(e){return IN({...FN(this),path:QM(this.path,e)})},middleware(e){return IN({...FN(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return IN({...FN(this),annotations:Or(this.annotations,e,t)})},annotateMerge(e){return IN({...FN(this),annotations:Rr(this.annotations,e)})}},FN=e=>({identifier:e.identifier,path:e.path,method:e.method,params:e.params,query:e.query,headers:e.headers,payload:e.payload,success:e.success,error:e.error,annotations:e.annotations,middlewares:e.middlewares,disableCodecs:e.disableCodecs});function IN(e){function t(){}return Object.setPrototypeOf(t,tae),Object.assign(t,e)}var LN=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?o:jN,s=nae(r?.payload,e,i);return IN({identifier:t,path:n,method:e,params:RN(r?.params,a),query:RN(r?.query,a),headers:RN(r?.headers,a),payload:s,success:rae(r?.success,e,s,i),error:iae(r?.error,i),annotations:Tr(),middlewares:new Set,disableCodecs:i})};function RN(e,t){if(e!==void 0)return VS(e)?t(e):t(q(e))}function nae(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:VS(e)?[e]:[q(e).pipe(qie())],a=n?o:lae,s=!1;for(let e of i){if(sN(e)){if(cN(e))throw Error(`StreamSse is response-only and cannot be used as a payload`);if(!bj(t))throw Error(`${t} endpoints cannot declare a streaming payload`);if(s)throw Error(`Multiple streaming payloads are not supported`);s=!0;for(let t of e.contentTypes){let n=iN(t);if(r.has(n))throw Error(`Cannot combine buffered and streaming payloads for content-type: ${t}`);r.set(n,{encoding:{_tag:`Stream`,contentType:t},schemas:[e]})}continue}let n=wN(e.ast,t),i=iN(n.contentType),o=r.get(i);if(o){if(o.encoding._tag===`Stream`)throw Error(`Cannot combine buffered and streaming payloads for content-type: ${n.contentType}`);if(o.encoding._tag!==n._tag)throw Error(`Multiple payload encodings for content-type: ${n.contentType}`);if(o.encoding._tag===`Multipart`)throw Error(`Multiple multipart payloads for content-type: ${n.contentType}`);o.schemas.push(a(e,t))}else r.set(i,{encoding:n,schemas:[a(e,t)]})}return r}var zN=`effect/http-api/stream/failure`;function rae(e,t,n,r){if(e===void 0)return new Set;let i=ci(e);return aae(i,t,n),new Set(r?i:i.map(BN))}var BN=m(e=>sN(e)?e:fN(e)?e.headers===void 0?e:Wie(e.protocol,jN(e.headers)):gN(e)?Gie(e,sN(e.schema)?e.schema:GN(e.schema,ON(e)),jN(e.headers)):cae(e));function iae(e,t){if(e===void 0)return new Set;let n=ci(e);for(let e of n){let t=gN(e)?e.schema:e;if(sN(t))throw Error(`Streaming schemas are not supported in error responses`);if(fN(t))throw Error(`Upgrade schemas are not supported in error responses`)}return HN(n,AN),new Set(t?n:n.map(BN))}function aae(e,t,n){let r=e.filter(fN);if(r.length>1)throw Error(`Cannot declare more than one upgrade`);let i=r.length===1;if(i){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare an upgrade`);for(let{encoding:e}of n.values())if(e._tag===`Stream`||e._tag===`Multipart`&&e.mode===`stream`)throw Error(`Upgrade endpoints cannot declare a streaming payload`)}let a=!1,o=new Map;for(let n of e){if(fN(n))continue;let e=gN(n)?n.schema:n,r=DN(n);if(i&&r===101)throw Error(`Cannot combine an upgrade with another success response for status: 101`);if(sN(e)){if(i)throw Error(`Cannot combine an upgrade with a streaming success response`);if(oae(e,t),a)throw Error(`Multiple streaming success responses are not supported`);a=!0;let n=VN(o,r);if(n.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${r}`);for(let t of e.contentTypes)if(n.bufferedContentTypes.has(iN(t)))throw Error(`Cannot combine buffered and streaming success responses for status ${r} and content-type: ${t}`);o.set(r,{...n,stream:e})}else{let t=VN(o,r),i=vN(e.ast);if(t.stream!==void 0){if(i)throw Error(`Cannot combine no-content and streaming success responses for status: ${r}`);let e=ON(n),a=iN(e.contentType);if(t.stream.contentTypes.some(e=>iN(e)===a))throw Error(`Cannot combine buffered and streaming success responses for status ${r} and content-type: ${e.contentType}`)}i||t.bufferedContentTypes.add(iN(ON(n).contentType)),t.noContent=t.noContent||i}}HN(e,DN)}function VN(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function HN(e,t){let n=new Map;for(let r of e){let e=t(r),i=bN(r.ast),a=gN(r)?r.schema:i?.body??r,o=vN(a.ast)?``:iN(sN(a)?a.contentType:ON(r).contentType),s=n.get(e);s===void 0&&(s={headerContentType:void 0,plainContentTypes:new Set},n.set(e,s));let c=()=>Error(`Cannot combine a response with headers with another response for status ${e} and content-type: ${o||`<no content>`}`);if(gN(r)||i!==void 0){if(s.headerContentType!==void 0)throw Error(`Cannot declare multiple responses with headers for status ${e}`);if(s.plainContentTypes.has(o))throw c();s.headerContentType=o}else{if(s.headerContentType===o)throw c();s.plainContentTypes.add(o)}}}function oae(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(cN(e)&&sae(e.events.ast))throw Error(`SSE event name is reserved: ${zN}`)}function sae(e){return UN(Tx(e),new Set)}function UN(e,t){if(t.has(e))return!1;if(t.add(e),nb(e))return e.types.some(e=>UN(e,t));if(rb(e))return UN(e.thunk(),t);if(!tb(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&WN(n.type,t)}function WN(e,t){if(t.has(e))return!1;t.add(e);let n=Tx(e);return n===e?$y(e)?e.literal===zN:nb(e)?e.types.some(e=>WN(e,t)):rb(e)?WN(e.thunk(),t):!1:WN(n,t)}function cae(e){let t=TN(e.ast),n=bN(e.ast);return n===void 0?GN(e,t):e.annotate({"~httpApiWithHeaders":{...n,bodyCodec:GN(n.body,t),headersCodec:jN(n.headers)}})}function GN(e,t){switch(t._tag){case`Json`:return yw(e);case`FormUrlEncoded`:return bw(e);case`Text`:case`Uint8Array`:return e}}function lae(e,t){if(!bj(t))return jN(e);switch(wN(e.ast,t)._tag){case`Json`:return yw(e);case`FormUrlEncoded`:return bw(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var KN=LN(`GET`),qN=LN(`POST`),JN=LN(`PUT`),YN=LN(`PATCH`),XN=LN(`DELETE`),ZN=`~effect/http-api/HttpApi`,uae={[ZN]:ZN,pipe(){return n(this,arguments)},add(...e){let t={...this.groups};for(let n of e)ft(t,n.identifier,n);return $N({...QN(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];ft(t,n,r.annotateMerge(Rr(e.annotations,r.annotations)))}return $N({...QN(this),groups:t})},prefix(e){return $N({...QN(this),groups:ni(this.groups,t=>t.prefix(e))})},middleware(e){return $N({...QN(this),groups:ni(this.groups,t=>t.middleware(e))})},annotate(e,t){return $N({...QN(this),annotations:Or(this.annotations,e,t)})},annotateMerge(e){return $N({...QN(this),annotations:Rr(this.annotations,e)})}},QN=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),$N=e=>{function t(){}return Object.setPrototypeOf(t,uae),Object.assign(t,e)},dae=e=>$N({identifier:e,groups:{},annotations:Tr()}),eP=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=Rr(e.annotations,r.annotations);t.onGroup({group:r,mergedAnnotations:n});let i=Object.values(r.endpoints);for(let e of i)(!t.predicate||t.predicate({endpoint:e,group:r}))&&t.onEndpoint({group:r,endpoint:e,middleware:e.middlewares,mergedAnnotations:Rr(n,e.annotations),successes:tP($ie(e),DN),errors:tP(eae(e),AN)})}},tP=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){let r=gN(e)?e.schema:e;if(sN(r)||fN(r))return;let i=t(e),a=n.get(i);a===void 0?n.set(i,[e]):a.push(e)}},fae=class extends dr()(`effect/http-api/HttpApi/ParseOptions`){},nP=class extends dr()(`effect/http-api/HttpApi/ParamsParseOptions`){},rP=class extends dr()(`effect/http-api/HttpApi/QueryParseOptions`){},pae=class extends dr()(`effect/http-api/HttpApi/HeadersParseOptions`){},iP=class extends dr()(`effect/http-api/HttpApi/PayloadParseOptions`){},mae=class extends dr()(`effect/http-api/HttpApi/SuccessParseOptions`){},hae=class extends dr()(`effect/http-api/HttpApi/ErrorParseOptions`){},aP=e=>{let t=Ar(e,fae);return{params:Ar(e,nP)??t,query:Ar(e,rP)??t,headers:Ar(e,pae)??t,payload:Ar(e,iP)??t,success:Ar(e,mae)??t,error:Ar(e,hae)??t}},gae=new Set;function _ae(e){if(e===void 0)return gae;let t=cx(e.ast);return tb(t)&&t.indexSignatures.length===0?new Set(t.propertySignatures.map(e=>String(e.name))):void 0}function vae(e,t,n){let r=/::|:(\w+)/g,i=``,a=0;for(let o=r.exec(e);o!==null;o=r.exec(e)){let s=o[1];if(s===void 0||t!==void 0&&!t.has(s))continue;let c=r.lastIndex;e[c]===`(`&&(c=TM(e,c)+1);let l=e[c]===`?`;l&&c++;let u=n(s,l),d=o.index;u===void 0&&e[d-1]===`/`&&d--,i+=e.slice(a,d)+(u??``),r.lastIndex=c,a=c}return i+e.slice(a)}var oP=`~effect/http-api/HttpApiClient/Upgraded`,yae=(e,t)=>H(function*(){let n=yield*$p(),r=t.httpClient.pipe(t?.baseUrl===void 0?o:mM(Vj(t.baseUrl.toString())));function i(e,t,a,o,s){if(s===-1)return r.execute(a);let c=n.mapUnsafe.get(o[s]);return c===void 0?i(e,t,a,o,s-1):c({endpoint:t,group:e,request:a,next(n){return i(e,t,n,o,s-1)}})}eP(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,mergedAnnotations:a}=e,o=aP(a),s=lP(r.path,r.params),c=gP(r),l=Cae(e),u=vO(r.params,e=>IS(e,o.params)),d=[],f;for(let e of Qie(r))lN(e)||uN(e)?f=e:d.push(e);let p=vO(f,e=>({contentType:e.contentType,encode:Iae(e,o.payload)})),m=di(d)?IS(bj(r.method)?Lae(d,r.method):aC(d),o.payload):void 0,h=vO(r.headers,e=>IS(e,o.headers)),g=vO(r.query,e=>IS(e,o.query)),_=Array.from(e.middleware,e=>`${e.key}/Client`),v=Hm(function*(e){let a=jj(r.method)(r.path);if(e!==void 0){if(u!==void 0){let t=yield*u(e.params);a=Bj(a,s(t))}if(p!==void 0&&pD(e.payload)){let t=yield*$p();a=Kj(a,ZA(tO(p.encode(e.payload),t),p.contentType))}else if(m!==void 0){if(bj(r.method)){if(e.payload instanceof FormData)a=qj(a,e.payload);else{let t=yield*m(e.payload);a=Kj(a,t)}}else{let t=yield*m(e.payload);a=Wj(a,t)}}else if(p!==void 0)return yield*new ES(new zv({message:`Expected a Stream payload`},e.payload));if(h!==void 0){let t=yield*h(e.headers);a=Ij(a,t)}if(g!==void 0){let t=yield*g(e.query);a=Wj(a,t)}}c!==void 0&&(a=zj(a,c.protocol));let o=yield*i(n,r,a,_,_.length-1);if(e?.responseMode===`response-only`)return o;let d=l(o,e?.sseOptions),f=yield*t.transformResponse===void 0?d:t.transformResponse(d);return e?.responseMode===`decoded-and-response`?[f,o]:f});t.onEndpoint({...e,endpointFn:v})}})}),sP=(e,t)=>Cp(cM,n=>bae(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),bae=(e,t)=>{let n={};return yae(e,{...t,onGroup({group:e}){e.topLevel||ft(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){ft(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(kp(n))},cP=(e,t)=>{let n={};return eP(e,{onGroup({group:e}){e.topLevel||ft(n,e.identifier,{})},onEndpoint({group:e,endpoint:r,mergedAnnotations:i}){let a=aP(i),o=lP(r.path,r.params),s=r.params===void 0?void 0:zS(r.params,a.params),c=r.query===void 0?void 0:zS(r.query,a.query);ft(e.topLevel?n:n[e.identifier],r.identifier,e=>{let n=e?.params,i=n===void 0?r.path:o(s===void 0?n:s(n)),a=e?.query===void 0?void 0:c===void 0?e.query:c(e.query),l=a===void 0?$_:J_(a);if(t?.baseUrl===void 0){let e=rv(l);return e===``?i:`${i}?${e}`}let u=new URL(Vj(Mj(i),t.baseUrl.toString()).url);for(let[e,t]of l.params)t!==void 0&&u.searchParams.append(e,V_(t));return u.toString()})}}),n},lP=(e,t)=>{if(t===void 0||!e.includes(`:`))return t=>e;let n=_ae(t);return t=>vae(e,n,(e,n)=>{let r=t[e];if(r===`.`||r===`..`)throw Error(`Invalid path parameter: ${e}`);if(r!==void 0)return encodeURIComponent(r);if(!n)throw Error(`Missing path parameter: ${e}`)})};function uP(e,t,n){let r=e.some(e=>gN(e)||bN(e.ast)!==void 0),i=MS(r?aC(e.map(e=>Sae(e,t,n))):Nae(e),t);return e=>Cp(e.arrayBuffer,r?t=>i({body:t,headers:e.headers}):i)}var xae=q({body:qS,headers:qS});function Sae(e,t,n){let r=bN(e.ast),i=r===void 0?gN(e)?{body:e.schema,headers:e.headers,toValue:hN}:{body:e,headers:qS,toValue:e=>e.body}:{body:r.bodyCodec,headers:r.headersCodec,toValue:r.transformation.decode},a=MS(bP(i.body).pipe(pC(i.body)),t),o=MS(i.headers,n);return xae.pipe(pC(gN(e)?e:WS(e),Py({decode:e=>op({body:a(e.body),headers:o(e.headers)}).pipe(Op(i.toValue),Fp(e=>e.issue)),encode:(e,t)=>U(new Vv({message:`Decode only schema`},e,t))})))}var Cae=e=>{let{endpoint:t,errors:n,successes:r,mergedAnnotations:i}=e,a=aP(i),o={orElse:Pae},s=new Map;for(let[e,t]of n.entries()){let n=pP(t);for(let[t,r]of n.entries())dP(s,e,t,uP(r,a.error,a.headers))}for(let[e,t]of s.entries()){let n=fP(t);o[e]=e=>Cp(Pp(n(e),t=>_p(Cu(hu(new cj({reason:new gj({request:e.request,response:e})})),t))),U)}let c=new Map;for(let[e,t]of r.entries()){let n=pP(t);for(let[t,r]of n.entries())dP(c,e,t,uP(r,a.success,a.headers))}for(let e of Tae(t)){let t=hP(e)?e.schema:e,n=DN(e),r=Eae(e,a.success,a.headers);for(let e of t.contentTypes)dP(c,n,e,r)}for(let[e,t]of c.entries())o[e]=fP(t);let l=gP(t);if(l!==void 0){let e=l.headers===void 0?B:MS(l.headers,a.headers);o[101]=t=>xm(n=>Cp(t.upgrade,r=>n(e(t.headers)).pipe(Op(e=>({[oP]:oP,headers:e,socket:r})),pm(()=>Bp(sm(r.reader))))))}return(e,t)=>(o[e.status]??o.orElse)(e,t)};function dP(e,t,n,r){let i=iN(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function fP(e){let t=e[0];return t!==void 0&&e.every(e=>e.decode===t.decode)?t.decode:(t,n)=>{let r=iN(t.headers[`content-type`]??``),i=e.find(e=>e.contentType===r);return i===void 0?wae(t,r,e):i.decode(t,n)}}function pP(e){let t=new Map;for(let n of e){let e=vN((gN(n)?n.schema:n).ast)?``:iN(ON(n).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function wae(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return U(new cj({reason:new _j({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var mP=`effect/http-api/stream/failure`,hP=e=>gN(e);function gP(e){for(let t of e.success)if(fN(t))return t}function Tae(e){let t=[];for(let n of e.success)sN(gN(n)?n.schema:n)&&t.push(n);return t}function Eae(e,t,n){let r=hP(e),i=Dae(r?e.schema:e,t),a=(e,t)=>Op($p(),n=>tO(i(e,t),n));if(!r)return a;let o=MS(e.headers,n);return(e,t)=>Cp(o(e.headers),n=>Op(a(e,t),e=>hN({body:e,headers:n})))}function Dae(e,t){if(lN(e))return e=>e.stream;if(uN(e)){let n=MS(yw(e.schema),t),r=Dh(e.maxElementBytes);return e=>e.stream.pipe(XD(xA({ignoreEmptyLines:!0,maxLineBytes:r})),JD(t=>pA(t)?t.reason===`LineTooLarge`?new cj({reason:new _j({request:e.request,response:e,description:`NDJSON line exceeds maxElementBytes of ${r} bytes`})}):kae(t):t),FD(e=>n(e)))}let n=Aae(e,t);return(t,r)=>jae(t.stream,e,n(r))}var Oae=e=>pA(e)&&e.kind===`Pack`,kae=e=>new ES(new zv({message:e.reason===`InvalidUtf8`?`Expected valid UTF-8`:e.unterminated?`Expected a valid JSON line, got an unterminated final line`:`Expected a valid JSON line`}));function Aae(e,t){let n=aC([q({id:W(K),event:G(mP),data:WC(yw(ZC(e.error,zC())))}),e.events]),r=DA(n,void 0,t);return e=>e===void 0?r:DA(n,e,t)}function jae(e,t,n){let r=_D(e.pipe(ZD,XD(n)),e=>V(()=>{let t;return fp(()=>t===void 0?Cp(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===mP&&du(r.data)){if(n===0)return _p(r.data);t=r.data,e=e.slice(0,n);break}}return B(e)}):_p(t))}));return t.sseMode===`data`?PD(r,e=>e.data):r}var _P=hC(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),Mae=_P.pipe(pC(YC,Fy({decode(e){return new Uint8Array(e)},encode(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}}))),vP=_P.pipe(pC(K,Fy({decode(e){return new TextDecoder().decode(e)},encode(e){let t=new TextEncoder().encode(e);return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}}))),yP=vP.pipe(pC(aC([G(``).pipe(pC(YS,Fy({decode:()=>void 0,encode:()=>``}))),GC])));function Nae(e){return aC(e.map(t));function t(e){return bP(e).pipe(pC(e))}}function bP(e){switch(TN(e.ast)._tag){case`Json`:return fne(Tx(e.ast))?yP.pipe(pC(qS,Fy({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}))):yP;case`FormUrlEncoded`:return vP.pipe(pC(ow,Fy({decode:e=>J_(new URLSearchParams(e)),encode:rv})));case`Uint8Array`:return Mae;case`Text`:return vP}}var Pae=e=>U(new cj({reason:new _j({request:e.request,response:e,description:`undeclared status code`})})),Fae=TS(RA);function Iae(e,t){if(lN(e))return e=>e;let n=IS(rC(yw(e.schema)),t);return e=>e.pipe(ID(e=>n(e)),XD(hA()),qD(Oae,ED))}function Lae(e,t){return aC(e.map(e=>Rae(e,t)))}var xP=new WeakMap;function Rae(e,t){let n=e.ast,r=xP.get(n);if(r!==void 0)return r;let i=wN(n,t),a=Fae.pipe(pC(e,Py({decode(e,t){return U(new Vv({message:`Encode only schema`},e,t))},encode(e,t){switch(i._tag){case`Multipart`:return U(new Vv({message:`Payload must be a FormData`},e,t));case`Json`:try{return B(KA(JSON.stringify(e),i.contentType))}catch{return U(new zv({expected:`a JSON-serializable request body`},e,t))}case`Text`:return typeof e==`string`?B(KA(e,i.contentType)):U(new zv({message:`Expected a string`},e,t));case`FormUrlEncoded`:return N(e)?B(qA(J_(e),i.contentType)):U(new zv({message:`Expected a record`},e,t));case`Uint8Array`:return e instanceof Uint8Array?B(HA(e,i.contentType)):U(new zv({message:`Expected a Uint8Array`},e,t))}}})));return xP.set(n,a),a}var SP=`~effect/reactivity/AtomRef`,CP=e=>new Bae(e),wP={count:0,generate(){return`AtomRef-${this.count++}`}},zae=class{[SP];key=wP.generate();value;constructor(e){this[SP]=SP,this.value=e}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}listeners=null;notify(e){let t=this.listeners;for(;t!==null;)t.f(e),t=t.next}subscribe(e){let t={f:e,prev:null,next:this.listeners};return this.listeners&&(this.listeners.prev=t),this.listeners=t,()=>{this.listeners===t&&(this.listeners=t.next),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)}}map(e){return new TP(this,e)}},Bae=class extends zae{prop(e){return new Vae(this,e)}set(e){return be(e,this.value)||(this.value=e,this.notify(e)),this}update(e){return this.set(e(this.value))}},TP=class e{[SP];key=wP.generate();parent;transform;constructor(e,t){this[SP]=SP,this.parent=e,this.transform=t}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.transform(this.parent.value)}subscribe(e){let t=this.transform(this.parent.value);return this.parent.subscribe(n=>{let r=this.transform(n);be(r,t)||(t=r,e(r))})}map(t){return new e(this,t)}},Vae=class e{[SP];key=wP.generate();previous;parent;_prop;constructor(e,t){this[SP]=SP,this.parent=e,this._prop=t,this.previous=e.value[t]}[ye](e){return be(this.value,e.value)}[ee](){return z(this.value)}get value(){return this.parent.value&&this._prop in this.parent.value&&(this.previous=this.parent.value[this._prop]),this.previous}subscribe(e){let t=this.value;return this.parent.subscribe(n=>{if(!n||!(this._prop in n))return;let r=n[this._prop];be(r,t)||(t=r,e(r))})}map(e){return new TP(this,e)}prop(t){return new e(this,t)}set(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e,this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e});return this}update(e){if(Array.isArray(this.parent.value)){let t=this.parent.value.slice();t[this._prop]=e(this.parent.value[this._prop]),this.parent.set(t)}else this.parent.set({...this.parent.value,[this._prop]:e(this.parent.value[this._prop])});return this}},EP=class extends dr()(`effect/workers/Transferable/Collector`){},Hae=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return EP.of({addAllUnsafe:t,addAll:e=>V(()=>t(e)),readUnsafe:n,read:V(n),clearUnsafe:r,clear:V(r)})},Uae=aC([class extends vw(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:mC(`WorkerSpawnError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerSendError`)({_tag:mC(`WorkerSendError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:mC(`WorkerReceiveError`),message:K,cause:W(zC())}){},class extends vw(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:mC(`WorkerUnknownError`),message:K,cause:W(zC())}){}]),DP=(e,t)=>e===void 0?t:`${e}.${t}`,OP=(e,t)=>({"rpc.system.name":`effect_rpc`,"rpc.method":e,...t}),Wae=`~effect/PrimaryKey`,kP=`~effect/rpc/RpcSchema/StreamSchema`;function AP(e){return F(e,kP)}function jP(e){return AP(e)?qn({success:e.success,error:e.error}):Kn()}var Gae=TS(pD);function Kae(e,t){return BS(Gae.ast,{[kP]:kP,success:e,error:t})}var MP=`~effect/rpc/Rpc`,qae={[MP]:MP,pipe(){return n(this,arguments)},setSuccess(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return NP({_tag:this._tag,payloadSchema:VS(e)?e:q(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return NP({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Or(this.annotations,e,t)})},annotateMerge(e){return NP({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Rr(this.annotations,e)})}},NP=e=>{function t(){}return Object.setPrototypeOf(t,qae),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},PP=(e,t)=>{let n=t?.success??QS,r=t?.error??KS,i=t?.defect??zC(),a;return a=t?.primaryKey?class extends _w(`effect/rpc/Rpc/${e}`)(t.payload){[Wae](){return t.primaryKey(this)}}:VS(t?.payload)?t?.payload:t?.payload?q(t?.payload):QS,NP({_tag:e,payloadSchema:a,successSchema:t?.stream?Kae(n,r):n,errorSchema:t?.stream?KS:r,defectSchema:i,annotations:Tr(),middlewares:new Set})},FP=new WeakMap,Jae=e=>{if(FP.has(e))return FP.get(e);let t=e,n=new Set([t.errorSchema]),r=jP(t.successSchema);Yn(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=aw(Yn(r)?QS:t.successSchema,aC([...n]),t.defectSchema);return FP.set(e,i),i},Yae=Br(`effect/rpc/Rpc/ParseOptions`,{defaultValue:()=>ab}),Xae=`~effect/rpc/Rpc/Wrapper`,Zae=e=>Xae in e,IP=`~effect/rpc/RpcClientError`,LP=class extends vw(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:mC(`RpcClientDefect`),message:K,cause:zC()}){},RP=class extends vw(IP)({_tag:mC(`RpcClientError`),reason:aC([Uae,BM,yj,LP])}){[IP]=IP;get message(){return`${this.reason._tag}: ${this.reason.message}`}},zP=e=>e,Qae={_tag:`Ping`},$ae=yw,eoe,toe=e=>(eoe??=new TextDecoder).decode(e),BP=class extends dr()(`effect/rpc/RpcSerialization`){},noe=BP.of({contentType:`application/json`,includesFraming:!1,codecFor:$ae,makeUnsafe:()=>({decode:e=>{let t=JSON.parse(typeof e==`string`?e:toe(e));return Array.isArray(t)?t:[t]},encode:e=>JSON.stringify(e)})}),roe=e=>fp(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>em(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),pp});return Op(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return H(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*nm(fp(()=>i(e)),t)}return yield*hm(gp,()=>(t.delete(e),r.delete(e),pp))})}}))}),ioe=0,aoe=Hm(function*(e,t){let n=t.spanPrefix,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>ioe++),s=yield*$p(),c=Nr(s,ed),l=new Map,u=!1;yield*ad(c,Sp(e=>(u=!0,d(Fu(e.id)))));let d=Hm(function*(e){let t=Array.from(l.values());l.clear();for(let n of t)n._tag===`Queue`?yield*e._tag===`Success`?MT(n.queue):AT(n.queue,e.cause):n.resume(e)},bm),f=e=>{let r=AP(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?M_(s.headers):j_,l=s?.context??Tr();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):wm(DP(n,e._tag),{kind:`client`,attributes:OP(e._tag,t.spanAttributes)},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:ND(Op(u,OD))}},p=(e,n,r,i,s,c,d)=>Sp(f=>{if(u)return _m;let p=a(),m=n(e=>t.onFromClient({message:e,context:c}),{_tag:`Request`,id:p,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:I_(f.getRef(VP),s),...d?{discard:!0}:{}}),h;return ym(hp(t=>{let n=!1,i={_tag:`Effect`,rpc:e,context:c,resume(e){d&&e._tag===`Success`?(n=!0,h?.pollUnsafe()&&t(Iu)):(t(e),h&&!h.pollUnsafe()&&f.currentDispatcher.scheduleTask(()=>{h.interruptUnsafe(f.id)},0))}};l.set(p,i),h=m.pipe(r?Tm(r,{captureStackTrace:!1}):o,jm(f.context)),h.addObserver(e=>{if(e._tag===`Failure`)return l.delete(p),t(e);if(n)return t(Iu)})}),e=>(l.delete(p),Tp(Jw(h),g(p,Array.from(e),c))))}),m=Hm(function*(e,r,s,c,d,f){if(u)return yield*_m;let p=i?void 0:yield*Cm(DP(n,e._tag),{kind:`client`,attributes:OP(e._tag,t.spanAttributes)}),m=Xw(),h=a(),_=Mr(m.context,ed),v=yield*ET(d);return yield*id(_,e=>(PT(v),l.has(h)?(l.delete(h),g(h,Ru(e)?Array.from(Pte(e.cause)):[],f)):pp)),l.set(h,{_tag:`Queue`,rpc:e,queue:v,scope:_,context:f}),yield*r(e=>t.onFromClient({message:e,context:f}),{_tag:`Request`,id:h,tag:e._tag,payload:s,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:I_(m.getRef(VP),c)}).pipe(p?Tm(p,{captureStackTrace:!1}):o,pm(e=>(xu(e)||l.delete(h),AT(v,e))),vm,Dm(_,{startImmediately:!0})),v}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=jr(s,`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r)=>hp(i=>{let a=Xw();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r}).pipe(Up(1e3),jm(a.context)).addObserver(()=>{i(pp)})}),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=l.get(n);return!i||i._tag!==`Queue`?pp:hie(i.queue,e.values).pipe(r?Cp(n=>n.length>0?pp:t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context})):o,Pp(e=>AT(i.queue,e)))}case`Exit`:{let t=e.requestId,n=l.get(t);return n?(l.delete(t),n._tag===`Effect`?(n.resume(e.exit),pp):e.exit._tag===`Success`?MT(n.queue):AT(n.queue,e.exit.cause)):pp}case`Defect`:return d(zte(e.defect));case`ClientEnd`:return pp}},v;if(t.flatten){let t=new Map;v=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else v={},e.requests.forEach(e=>{ft(v,e._tag,f(e))});return{client:v,write:_}}),ooe=0,soe=Hm(function*(e,t){let n=ooe++,{codecFor:r,run:i,send:a,supportsAck:o,supportsTransferables:s}=yield*HP,c=coe(r),l=Mre(r(zC())),u=new Map,d=Vu(),f=e=>u.has(e)?(u.delete(e),a(n,{_tag:`Interrupt`,requestId:e})):pp,{client:p,write:m}=yield*aoe(e,{...t,supportsAck:o,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),i=s?Hae():void 0,o=Xw(),l={rpc:r,context:i?Or(o.context,EP,i):o.context,schemas:c(r),discard:t.discard===!0};return u.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(nm(l.context),Ip,Cp(e=>Ju(d)?(u.delete(t.id),_m):a(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},i&&i.readUnsafe())),pm(e=>xu(e)?pp:V(()=>u.delete(t.id))))}case`Ack`:return u.get(t.requestId)?a(n,{_tag:`Ack`,requestId:t.requestId}):pp;case`Interrupt`:return f(t.requestId);case`Eof`:return pp}}});return yield*i(n,e=>{switch(e._tag){case`Chunk`:{let t=zP(e.requestId),n=u.get(t);if(!n||Jn(n.schemas.decodeChunk))return pp;let r=n.schemas.decodeChunk.value;return xm(i=>i(r(e.values).pipe(nm(n.context),Ip,Cp(e=>m({_tag:`Chunk`,clientId:0,requestId:t,values:e})))).pipe(pm(e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:Nu(e)}).pipe(Tp(Eu(e)?pp:Jp(Bp(f(t)),Uu(d))))),dne(e=>!Eu(e),()=>pp)))}case`Exit`:{let t=zP(e.requestId),n=u.get(t);return n?(u.delete(t),n.discard&&e.exit._tag===`Success`?m({_tag:`Exit`,clientId:0,requestId:t,exit:Iu}):(n.discard?n.schemas.decodeDiscardExit:n.schemas.decodeExit)(e.exit).pipe(nm(n.context),Ip,Zp({onSuccess:e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>m({_tag:`Exit`,clientId:0,requestId:t,exit:Nu(e)})}))):pp}case`Defect`:return u.clear(),m({_tag:`Defect`,clientId:0,defect:l(e.defect)});case`ClientProtocolError`:{let t=Pu(e.error),n=e.requestIds===void 0?Array.from(u.keys()):e.requestIds.map(zP).filter(e=>u.has(e));for(let e of n)u.delete(e);return sp(n,e=>m({_tag:`Exit`,clientId:0,requestId:e,exit:t})).pipe(bm)}default:return pp}}).pipe(Pp(Gm),vm,Om),yield*dm(()=>Yu(d,void 0)),p}),coe=e=>{let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=jP(n.successSchema),a=Nr(n.annotations,Yae),o=Jae(n),s;return r={decodeChunk:ir(i,t=>MS(e(rC(t.success)),a)),encodePayload:LS(e(n.payloadSchema),a),decodeExit:MS(e(o),a),decodeDiscardExit:t=>(s??=MS(e(aw(QS,o.error,o.defect)),a))(t)},t.set(n,r),r}},VP=Br(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>j_}),HP=class extends dr()(`effect/rpc/RpcClient/Protocol`){static make=roe},loe=e=>HP.make(Hm(function*(t,n){let r=yield*OM,i=yield*BP,a=yield*rm(foe),s=new Map,c=yield*r.writer,l=i.makeUnsafe(),u=yield*doe(fp(()=>c.write(l.encode(Qae))),e),f=Vp(e?.onPingTimeout??pp,{log:!0,message:`RpcClient onPingTimeout hook failed`}),p,m=e=>{let r=sp(Array.from(n),n=>t(n,e));return e._tag!==`Defect`&&e._tag!==`ClientProtocolError`?r:(s.clear(),bm(r))},h=e=>(p=e,m({_tag:`ClientProtocolError`,error:e})),g=e=>{try{let n=l.decode(e);if(n.length===0)return pp;u.onFrame();let r=0;return cp({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return pp;if(Object.hasOwn(e,`requestId`)){let n=e.requestId,r=s.get(n);if(r!==void 0)return e._tag===`Exit`&&s.delete(n),t(r,e)}return m(e)},step:d})}catch(e){return m({_tag:`ClientProtocolError`,error:new RP({reason:new LP({message:`Error decoding message`,cause:e})})})}};yield*fp(()=>{l=i.makeUnsafe(),u.reset();let e=!1;return H(function*(){let{pull:t}=yield*r.reader;for(p=void 0,e=!0,Yn(a)&&(yield*a.value.onConnect);;){let e=yield*t;for(let t=0;t<e.length;t++)yield*g(e[t])}}).pipe(sm,Jp(u.timeout),Tp(()=>e?f:pp),Tp(()=>U(new VM({reason:new FM({cause:Error(`ping timeout`)})}))))}).pipe(Yn(a)?fm(a.value.onDisconnect):o,Rp(t=>{let n=Nte(t),r=qr(n),i=new RP({reason:r?n.success.reason:new LP({message:`Unknown socket error`,cause:wu(t)})});return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?(e.onTransientError?.(i)??pp).pipe(Vp({log:!0,message:`RpcClient onTransientError hook failed`})):h(i)}),zp(e?.retryPolicy??uoe,e=>h(new RP({reason:e.reason}))),Km({module:`RpcClient`,method:`makeProtocolSocket`}),Om);let _=e=>fp(()=>{let t=l.encode(e);return t===void 0?pp:Ip(c.write(t))});return{send(e,t){return p?U(p):(t._tag===`Interrupt`&&s.delete(t.requestId),t._tag===`Request`?(s.set(t.id,e),pm(_(t),()=>V(()=>s.delete(t.id)))):_(t))},supportsAck:!0,supportsTransferables:!1,codecFor:i.codecFor}})),uoe=Wte([Kte(500,1.5),Zf(5e3)]),doe=Hm(function*(e,t){let n=yield*Bd,r=t?.pingInterval??`5 seconds`,i=Qi(t?.pingTimeout??r),a=n.currentTimeMillisUnsafe(),o=!1,s=Qw(),c=()=>{a=n.currentTimeMillisUnsafe(),o=!1};return yield*fp(()=>o&&n.currentTimeMillisUnsafe()-a>i?s.open:(o=!0,e)).pipe(Kp(r),Bp,Sm,vm,Om),{timeout:s.await,reset:()=>{c(),s.closeUnsafe()},onFrame:c}}),foe=class extends dr()(`effect/rpc/RpcClient/ConnectionHooks`){},poe=t((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,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(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+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(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 I=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)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.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)!T.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 E(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)T.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 E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),UP=t(((e,t)=>{t.exports=poe()})),Z=e(UP(),1),moe=Z.use,WP=Z.useLayoutEffect;function hoe(e,t,n){Z.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function goe(e){let t=Z.useRef(null);return Z.useImperativeHandle(e,()=>t.current,[]),t}function GP(e){if(URL.canParse)return URL.canParse(e);try{return new URL(e),!0}catch{return!1}}function KP(e){return e[e.length-1]}function qP(e,t){return typeof e==`function`?e(t):e}var JP=Object.prototype.hasOwnProperty,_oe=Object.prototype.propertyIsEnumerable;function voe(e){for(let t in e)if(JP.call(e,t))return!0;return!1}var yoe=()=>Object.create(null),boe=(e,t)=>YP(e,t,yoe);function YP(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=$P(e)&&$P(i);if(!a&&!(ZP(e)&&ZP(i)))return i;let o=a?e:XP(e);if(!o)return i;let s=a?i:XP(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:JP.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=YP(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function XP(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!_oe.call(e,r))return!1;t.push(r)}return t}function ZP(e){if(!QP(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!QP(n)||!n.hasOwnProperty(`isPrototypeOf`))}function QP(e){return Object.prototype.toString.call(e)===`[object Object]`}function $P(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function eF(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!eF(e[r],t[r],n))return!1;return!0}if(ZP(e)&&ZP(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!eF(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!eF(e[o],t[o],n)))return!1;return i===a}return!1}function xoe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var Soe=/[\x00-\x1f\x7f"<>`{}]/g;function Coe(e){return e.replace(Soe,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function tF(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Coe(t)}var woe=[`http:`,`https:`,`mailto:`,`tel:`];function nF(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Toe(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=tF(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=tF(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Eoe(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Doe(e,t){if(e===t)return!0;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 rF(){throw Error(`Invariant failed`)}function iF(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var aF=4,oF=5;function sF(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function cF(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=sF(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=uF(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=Ooe(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=uF(r);e.kind=oF,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=uF(r);e.kind=aF,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)cF(e,t,r,c,i,a,o,s)}function lF(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function uF(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Ooe(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function koe(e,t){let n=uF(`/`),r=new Uint16Array(6),i=[];for(let t of e)cF(!1,r,t,1,n,0,i);for(let e of i)e.sort(lF);t.masksTree=n,t.flatCache=iF(1e3)}function Aoe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=dF(e,t.masksTree);return t.flatCache.set(e,r),r}function joe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=uF(`/`),cF(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),dF(r,o,n)}function Moe(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=dF(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=pF(a.route)),t.matchCache.set(r,a),a}function Noe(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Poe(e,t=!1,n){let r=uF(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;cF(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&rF(),o[e.id]=e,c!==0&&e.path){let t=Noe(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(lF);return{processedTree:{segmentTree:r,singleCache:iF(1e3),matchCache:iF(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function dF(e,t,n=!1){let r=e.split(`/`),i=Ioe(e,r,t,n);if(!i)return null;let[a]=fF(e,r,i);return{route:i.node.route,rawParams:a}}function fF(e,t,n){let r=Foe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===aF)break;if(u.kind===oF){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length;if(e.charCodeAt(t)===123){let n=u.suffix.length,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix.length,r=u.suffix.length,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+t.prefix.length,e.length-t.suffix.length),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function pF(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Foe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ioe(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!KP(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!gF(l,n))continue;if(i.parse){if(!hF(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==aF&&gF(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===aF||i.kind===2)&&gF(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(hF(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Loe(f,o))return n;gF(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!r||!_&&(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)){if(a){if(_)continue;let e=t.slice(u).join(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+mF(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&e.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+mF(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+mF(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+mF(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function mF(e,t){return 2**(e-t-1)}function Loe(e,t){return e===2**(t-1)-1}function hF(e,t,n){let r,i;try{[r,i]=fF(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function gF(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===aF)>(e.node.kind===aF)||t.node.kind===aF==(e.node.kind===aF)&&t.node.depth>e.node.depth)))}function Roe(e){return _F(e.filter(e=>e!==void 0).join(`/`))}function _F(e){return e.replace(/\/{2,}/g,`/`)}function vF(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function yF(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function zoe(e){return yF(vF(e))}function bF(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Boe(e,t,n){return bF(e,n)===bF(t,n)}function Voe({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=_F(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=_F(e)),o=e.split(`/`);o.length>1&&KP(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(KP(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?_F(s):s)||`/`;return a&&r&&r.set(a,c),c}function Hoe(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function xF(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>SF(e,n)).join(`/`):SF(r,n):r}function Uoe({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=sF(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0)l+=`/`+e.substring(r,o);else if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=xF(`_splat`,t,n);l+=`/`+u+f+d}else if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=xF(s,t,n)??`undefined`;l+=`/`+u+f+d}else if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=xF(i,t,n)??``;l+=`/`+u+f+d}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function SF(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Woe=`Error preloading route! ☝️`,Goe=t((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})),CF=t(((e,t)=>{t.exports=Goe()})),Q=CF();function Koe({children:e,fallback:t=null}){return(0,Q.jsx)(Z.Fragment,{children:wF()?e:t})}function wF(){return Z.useSyncExternalStore(qoe,()=>!0,()=>!1)}function qoe(){return()=>{}}var TF=Z.createContext(null);function EF(e){return Z.useContext(TF)}var Joe=t((e=>{var t=UP();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),DF=t(((e,t)=>{t.exports=Joe()})),Yoe=t((e=>{var t=UP(),n=DF();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),OF=t(((e,t)=>{t.exports=Yoe()})),kF=OF();function Xoe(e,t){return e===t}function AF(e,t,n=Xoe){let r=(0,Z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,Z.useCallback)(()=>e?.get(),[e]);return(0,kF.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function jF(e){let t=EF();return Z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Zoe(e){let t=EF(),n=jF(),r=Z.useRef(null);return WP(()=>{r.current!==e&&(n(e),r.current=e)},[t,e,n]),null}function MF(e){let t=Z.useRef(e);return eF(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Qoe(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function $oe(e,t,n){if(e?.external)return nF(e.href,n)?void 0:e.href;if(!ose(t)&&GP(t))return nF(t,n)?void 0:t}function ese(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Boe(e.pathname,t.pathname,r))return!1}else{let n=bF(e.pathname,r),i=bF(t.pathname,r);if(!n.startsWith(i)||n.length!==i.length&&n[i.length]!==`/`)return!1}return(n?.includeSearch??!0)&&!eF(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function tse(e,t){let n=EF(),r=goe(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:I,...L}=e,R=s,ee=wF(),z=MF(e.search),te=MF(e.params),ne=MF(o),re=Z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,z,te,e.state,e.mask,e.unsafeRelative]),ie=Z.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...re}),r=ase(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,v),i=$oe(r,R,n.protocolAllowlist);return[r?.href,i,ese(e,t,ne,n.basepath,ee,i!==void 0)]},[ne,v,ee,re,n,R]),[ae,oe,se]=AF(n.stores.location,ie,Qoe),ce=se?qP(i,{})??nse:NF,le=se?NF:qP(a,{})??NF,ue=[b,ce.className,le.className].filter(Boolean).join(` `),de=(y||ce.style||le.style)&&{...y,...ce.style,...le.style},fe=Z.useRef(!1),pe=e.reloadDocument||oe||v?!1:c??n.options.defaultPreload,me=l??n.options.defaultPreloadDelay??0,he=Z.useCallback(()=>{n.preloadRoute(re).catch(e=>{console.warn(e),console.warn(Woe)})},[n,re]),ge=Z.useCallback(e=>{e?e.isIntersecting??pe===`intent`?me?PF.has(r)||PF.set(r,setTimeout(()=>{PF.delete(r),he()},me)):he():e.isIntersecting===!1&&FF(r):FF(r)},[he,r,pe,me]);hoe(r,ge,pe!==`viewport`),Z.useEffect(()=>{fe.current||pe===`render`&&(he(),fe.current=!0)},[he,pe]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;v||e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||r&&r!==`_self`||e.button!==0||(e.preventDefault(),n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D}))};if(oe)return{...L,ref:r,href:oe,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=()=>{pe===`intent`&&he()},ye=()=>{pe===`intent`&&FF(r)};return{...L,...ce,...le,href:ae,ref:r,onClick:IF([x,_e]),onBlur:IF([S,ye]),onFocus:IF([C,ge]),onMouseEnter:IF([w,ge]),onMouseLeave:IF([T,ye]),onTouchStart:IF([E,ve]),disabled:!!v,target:_,...de&&{style:de},...ue&&{className:ue},...v&&rse,...se&&ise}}var NF={},nse={className:`active`},rse={role:`link`,"aria-disabled":!0},ise={"data-status":`active`,"aria-current":`page`},PF=new WeakMap,FF=e=>{clearTimeout(PF.get(e)),PF.delete(e)},IF=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ase(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ose(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var LF=Z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=tse(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return Z.createElement(`a`,t,o)}return Z.createElement(n,a,o)}),sse=e=>e,RF=t((e=>{var t=UP();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.8`})),zF=t(((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=RF()})),BF=t((e=>{var t=UP().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),VF=t(((e,t)=>{t.exports=BF()})),HF=t((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,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(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 x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){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,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(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`):w=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?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),UF=e(t(((e,t)=>{t.exports=HF()}))(),1);function WF(e){let t=UF.unstable_scheduleCallback(4,e);return()=>UF.unstable_cancelCallback(t)}var GF=Z.createContext(HO({scheduleTask:WF,defaultIdleTTL:400})),KF=new WeakMap,qF=0,JF=new Set;function YF(e){qF++;try{return e()}finally{qF--}}function XF(e){if(qF===0)return e();JF.size===0&&queueMicrotask(ZF),JF.add(e)}function ZF(){for(let e of JF)JF.delete(e),e()}function QF(e,t){let n=KF.get(e);n===void 0&&(n=new WeakMap,KF.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=0,a,o={subscribe(n){i++;let r=e.subscribe(t,()=>XF(n));return()=>{i--,JF.delete(n),r()}},snapshot(){return YF(()=>e.get(t))},getServerSnapshot(){return(i===0||a===void 0)&&(a={value:YF(()=>sA(t,e))}),a.value}};return n.set(t,o),o}function $F(e,t){let n=QF(e,t);return Z.useEffect(ZF),Z.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}function eI(e,t,n){let r=QF(e,t),i=Z.useMemo(()=>{let e;return t=>(e!==void 0&&Object.is(e.source,t)||(e={source:t,value:n(t)}),e.value)},[n]);return Z.useEffect(ZF),Z.useSyncExternalStore(r.subscribe,()=>i(r.snapshot()),()=>i(r.getServerSnapshot()))}var tI=(e,t)=>{let n=Z.useContext(GF);return t?eI(n,e,t):$F(n,e)};function nI(e,t){Z.useEffect(()=>e.mount(t),[t,e])}function rI(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?Z.useCallback(r=>{e.set(t,r);let i=Im(GO(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(iI):i},[e,t,n.mode]):Z.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var iI=e=>{if(Lu(e))return e.value;throw wu(e.cause)},aI=e=>{nI(Z.useContext(GF),e)},oI=(e,t)=>{let n=Z.useContext(GF);return nI(n,e),rI(n,e,t)},sI=e=>{let t=Z.useContext(GF);return nI(t,e),Z.useCallback(()=>{t.refresh(e)},[t,e])},cI=(e,t)=>{let n=Z.useContext(GF);return[$F(n,e),rI(n,e,t)]},lI={suspendOnWaiting:new WeakMap,default:new WeakMap};function uI(e,t,n){let r=n?lI.suspendOnWaiting:lI.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0&&(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a)),a}function dI(e,t,n){let r=$F(e,t);if(r._tag===`Initial`||n&&r.waiting)throw uI(e,t,n);return r}var fI=(e,t)=>{let n=dI(Z.useContext(GF),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw wu(n.cause);return n},pI=e=>{let[,t]=Z.useReducer(e=>e+1,0);return Z.useEffect(()=>e.subscribe(t),[e]),e.value},mI=DF();function hI(){}var gI=Object.freeze([]),_I=Object.freeze({});function vI(e){Z.useEffect(e,gI)}var yI={};function bI(e,t){let n=Z.useRef(yI);return n.current===yI&&(n.current=e(t)),n}var xI=typeof document<`u`?Z.useLayoutEffect:()=>{},SI=e(zF(),1);function CI(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var wI=CI(`https://base-ui.com/production-error`,`Base UI`),TI=19;function EI(e){return TI>=e}var DI=[],OI=void 0;function kI(){return OI}function AI(e){DI.push(e)}function jI(e){let t=(t,n)=>{let r=bI(NI).current,i;try{OI=r;for(let e of DI)e.before(r);i=e(t,n);for(let e of DI)e.after(r);r.didInitialize=!0}finally{OI=void 0}return i};return t.displayName=e.displayName||e.name,t}function MI(e){return Z.forwardRef(jI(e))}function NI(){return{didInitialize:!1}}var PI=EI(19)?LI:RI;function FI(e,t,n,r,i){return PI(e,t,n,r,i)}function II(e,t,n,r,i){let a=Z.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,mI.useSyncExternalStore)(e.subscribe,a,a)}AI({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,mI.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function LI(e,t,n,r,i){let a=kI();if(!a)return II(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],s.store===e&&s.selector===t&&Object.is(s.a1,n)&&Object.is(s.a2,r)&&Object.is(s.a3,i)||(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function RI(e,t,n,r,i){return(0,kF.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var zI=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return FI(this,e,t,n,r)}},BI={...Z},VI=BI.useInsertionEffect,HI=VI&&VI!==BI.useLayoutEffect?VI:e=>e();function UI(e){let t=bI(WI).current;return t.next=e,HI(t.effect),t.trampoline}function WI(){let e={next:void 0,callback:GI,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function GI(){}var KI=class extends zI{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Z.useDebugValue(e);let n=this;xI(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;xI(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;xI(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Z.useDebugValue(e);let n=this,r=t!==void 0;xI(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Z.useDebugValue(e),FI(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Z.useDebugValue(e);let n=UI(t??hI);this.context[e]=n}useStateSetter(e){let t=Z.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function qI(){return typeof window<`u`}function JI(e){return ZI(e)?(e.nodeName||``).toLowerCase():`#document`}function YI(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function XI(e){return((ZI(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ZI(e){return qI()?e instanceof Node||e instanceof YI(e).Node:!1}function QI(e){return qI()?e instanceof Element||e instanceof YI(e).Element:!1}function $I(e){return qI()?e instanceof HTMLElement||e instanceof YI(e).HTMLElement:!1}function eL(e){return!qI()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof YI(e).ShadowRoot}function tL(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=fL(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function nL(e){return/^(table|td|th)$/.test(JI(e))}function rL(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var iL=/transform|translate|scale|rotate|perspective|filter/,aL=/paint|layout|strict|content/,oL=e=>!!e&&e!==`none`,sL;function cL(e){let t=QI(e)?fL(e):e;return oL(t.transform)||oL(t.translate)||oL(t.scale)||oL(t.rotate)||oL(t.perspective)||!uL()&&(oL(t.backdropFilter)||oL(t.filter))||iL.test(t.willChange||``)||aL.test(t.contain||``)}function lL(e){let t=mL(e);for(;$I(t)&&!dL(t);){if(cL(t))return t;if(rL(t))return null;t=mL(t)}return null}function uL(){return sL??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),sL}function dL(e){return/^(html|body|#document)$/.test(JI(e))}function fL(e){return YI(e).getComputedStyle(e)}function pL(e){return QI(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mL(e){if(JI(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||eL(e)&&e.host||XI(e);return eL(t)?t.host:t}function hL(e){let t=mL(e);return dL(t)?(e.ownerDocument||e).body:$I(t)&&tL(t)?t:hL(t)}function gL(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=hL(e),i=r===e.ownerDocument?.body,a=YI(r);if(i){let e=_L(a);return t.concat(a,a.visualViewport||[],tL(r)?r:[],e&&n?gL(e):[])}return t.concat(r,gL(r,[],n))}function _L(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vL(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function yL(e){return e?.ownerDocument||document}function bL(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var xL=null;globalThis.requestAnimationFrame;var SL=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},CL=class e{static create(){return new e}static request(e){return SL.request(e)}static cancel(e){return SL.cancel(e)}currentId=xL;request(e){this.cancel(),this.currentId=SL.request(()=>{this.currentId=xL,e()})}cancel=()=>{this.currentId!==xL&&(SL.cancel(this.currentId),this.currentId=xL)};disposeEffect=()=>this.cancel};function wL(){let e=bI(CL.create).current;return vI(e.disposeEffect),e}var TL=0,EL=class e{static create(){return new e}currentId=TL;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=TL,t()},e)}isStarted(){return this.currentId!==TL}clear=()=>{this.currentId!==TL&&(clearTimeout(this.currentId),this.currentId=TL)};disposeEffect=()=>this.clear};function DL(){let e=bI(EL.create).current;return vI(e.disposeEffect),e}function OL(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:kL,platform:AL,maxTouchPoints:jL}=OL(),ML=kL.toLowerCase(),NL=AL.toLowerCase(),PL=/^i(os$|p)/.test(NL)||NL===`macintel`&&jL>1,FL=`android`,IL=NL===FL||ML.includes(FL),LL=!PL&&NL.startsWith(`mac`);NL.startsWith(`win`),!IL&&/^(linux|chrome os)/.test(NL);var RL=LL||PL,zL=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!zL&&ML.includes(`firefox`),!zL&&ML.includes(`chrom`);var BL=RL,VL=/jsdom|happydom/.test(ML);function HL(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function UL(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&eL(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function WL(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var GL=`data-base-ui-focusable`,KL=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,qL=`ArrowLeft`,JL=`ArrowRight`,YL=`ArrowUp`,XL=`ArrowDown`,ZL=`data-starting-style`,QL=`data-ending-style`,$L={[ZL]:``},eR={[QL]:``},tR={transitionStatus(e){return e===`starting`?$L:e===`ending`?eR:null}},nR=`data-open`,rR=`data-closed`,iR=`data-anchor-hidden`,aR=`data-popup-open`,oR=`data-pressed`,sR={[aR]:``},cR={[aR]:``,[oR]:``},lR={[nR]:``},uR={[rR]:``},dR={[iR]:``},fR={open(e){return e?sR:null}},pR={open(e){return e?cR:null}},mR={open(e){return e?lR:uR},anchorHidden(e){return e?dR:null}},hR={...mR,...tR},gR=`data-trigger-disabled`;function _R(e,t){if(!QI(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(gR);for(let[,e]of t.entries())if(UL(e,n))return!e.hasAttribute(gR);return!1}function vR(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function yR(e){return e.matches(`html,body`)}function bR(e){return $I(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function xR(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${KL}`)!=null}function SR(e){return e?e.getAttribute(`role`)===`combobox`&&bR(e):!1}function CR(e){if(!e||VL)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function wR(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function TR(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...TR(e,t.id,n)])}function ER(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function DR(e){e.preventDefault(),e.stopPropagation()}function OR(e){return`nativeEvent`in e}function kR(e){return e.pointerType===``&&e.isTrusted?!0:IL&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function AR(e){return VL?!1:!IL&&e.width===0&&e.height===0||IL&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function jR(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function MR(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var NR=Math.min,PR=Math.max,FR=Math.round,IR=Math.floor,LR=e=>({x:e,y:e}),RR={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function zR(e,t,n){return PR(e,NR(t,n))}function BR(e,t){return typeof e==`function`?e(t):e}function VR(e){return e.split(`-`)[0]}function HR(e){return e.split(`-`)[1]}function UR(e){return e===`x`?`y`:`x`}function WR(e){return e===`y`?`height`:`width`}function GR(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function KR(e){return UR(GR(e))}function qR(e,t,n){n===void 0&&(n=!1);let r=HR(e),i=KR(e),a=WR(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=nz(o)),[o,nz(o)]}function JR(e){let t=nz(e);return[YR(e),t,YR(t)]}function YR(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var XR=[`left`,`right`],ZR=[`right`,`left`],QR=[`top`,`bottom`],$R=[`bottom`,`top`];function ez(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ZR:XR:t?XR:ZR;case`left`:case`right`:return t?QR:$R;default:return[]}}function tz(e,t,n,r){let i=HR(e),a=ez(VR(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(YR)))),a}function nz(e){let t=VR(e);return RR[t]+e.slice(t.length)}function rz(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function iz(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:rz(e)}function az(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function oz(e,t){return t<0||t>=e.length}function sz(e,t){return lz(e.current,{disabledIndices:t})}function cz(e,t){return lz(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function lz(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&uz(e,a,r));return a}function uz(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!fz(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function dz(e){return e.visibility===`hidden`||e.visibility===`collapse`}function fz(e,t=e?fL(e):null){return!e||!e.isConnected||!t||dz(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var pz=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function mz(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return eL(n)?n.host:null}function hz(e){for(let t of Array.from(e.children))if(JI(t)===`summary`)return t;return null}function gz(e,t){let n=hz(t);return!!n&&(e===n||UL(n,e))}function _z(e){let t=e?JI(e):``;return e!=null&&e.matches(pz)&&(t!==`summary`||e.parentElement!=null&&JI(e.parentElement)===`details`&&hz(e.parentElement)===e)&&(t!==`details`||hz(e)==null)&&(t!==`input`||e.type!==`hidden`)}function vz(e){if(!_z(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=mz(t)){let n=t!==e,r=JI(t)===`slot`;if(t.hasAttribute(`inert`)||n&&JI(t)===`details`&&!t.open&&!gz(e,t)||t.hasAttribute(`hidden`)||!r&&!yz(t,n))return!1}return!0}function yz(e,t){let n=fL(e);return t?n.display!==`none`:fz(e,n)}function bz(e){let t=e.tabIndex;if(t<0){let t=JI(e);if(t===`details`||t===`audio`||t===`video`||$I(e)&&e.isContentEditable)return 0}return t}function xz(e){if(JI(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Sz(e,t){let n=xz(e);if(!n)return!0;let r=t.find(e=>{let t=xz(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=xz(e);return t?.name===n.name&&t.form===n.form})===n}function Cz(e){if($I(e)&&JI(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return $I(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wz(e,t){Cz(e).forEach(e=>{_z(e)&&t.push(e),wz(e,t)})}function Tz(e,t,n){Cz(e).forEach(e=>{$I(e)&&e.matches(t)&&n.push(e),Tz(e,t,n)})}function Ez(e){return vz(e)&&bz(e)>=0}function Dz(e){let t=[];return wz(e,t),t.filter(vz)}function Oz(e){let t=Dz(e);return t.filter(e=>bz(e)>=0&&Sz(e,t))}function kz(e,t){let n=Oz(e),r=n.length;if(r===0)return;let i=HL(yL(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Az(e){return kz(yL(e).body,1)||e}function jz(e){return kz(yL(e).body,-1)||e}function Mz(e,t){if(!e)return null;let n=Oz(yL(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function Nz(e){return Mz(e,1)}function Pz(e){return Mz(e,-1)}function Fz(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!UL(n,r)}function Iz(e){Oz(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Lz(e){let t=[];Tz(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Rz={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},zz={...Rz,position:`fixed`,top:0,left:0},Bz={...Rz,position:`absolute`},Vz=Z.forwardRef(function(e,t){let[n,r]=Z.useState();xI(()=>{BL&&zL&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,Q.jsx)(`span`,{...e,ref:t,style:zz,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})});function Hz(e,t,n,r){let i=bI(Wz).current;return Gz(i,e,t,n,r)&&qz(i,[e,t,n,r]),i.callback}function Uz(e){let t=bI(Wz).current;return Kz(t,e)&&qz(t,e),t.callback}function Wz(){return{callback:null,cleanup:null,refs:[]}}function Gz(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Kz(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function qz(e,t){e.refs=t,e.callback=t.every(e=>e==null)?null:n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}function Jz(e){if(!Z.isValidElement(e))return null;let t=e,n=t.props;return(EI(19)?n?.ref:t.ref)??null}function Yz(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Xz(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e)}else i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Zz(e,t){return typeof e==`function`?e(t):e}function Qz(e,t){return typeof e==`function`?e(t):e}var $z={};function eB(e,t,n,r,i){if(!n&&!r&&!i&&!e)return nB(t);let a=nB(e);return t&&(a=rB(a,t)),n&&(a=rB(a,n)),r&&(a=rB(a,r)),i&&(a=rB(a,i)),a}function tB(e){if(e.length===0)return $z;if(e.length===1)return nB(e[0]);let t=nB(e[0]);for(let n=1;n<e.length;n+=1)t=rB(t,e[n]);return t}function nB(e){return sB(e)?{...cB(e,$z)}:iB(e)}function rB(e,t){return sB(t)?cB(t,e):aB(e,t)}function iB(e){let t={...e};for(let e in t){let n=t[e];oB(e,n)&&(t[e]=uB(n))}return t}function aB(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Yz(e.style,r);break;case`className`:e[n]=fB(e.className,r);break;default:e[n]=oB(n,r)?lB(e[n],r):r}}return e}function oB(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function sB(e){return typeof e==`function`}function cB(e,t){return sB(e)?e(t):e??$z}function lB(e,t){return t?e?(...n)=>{let r=n[0];if(pB(r)){let i=r;dB(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:uB(t):e}function uB(e){return e&&((...t)=>{let n=t[0];return pB(n)&&dB(n),e(...t)})}function dB(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function fB(e,t){return t?e?t+` `+e:t:e}function pB(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function mB(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=vB(r));let i=hB(t,n,r);if(n.enabled===!1)return null;let a=n.state??_I;return yB(e,r,i,a)}function hB(e,t,n){let{className:r,style:i}=e,{state:a=_I,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Zz(r,a):void 0,d=l?Qz(i,a):void 0,f=l?Xz(a,c):_I,p=l&&s?gB(s):void 0,m=l?Yz(f,p)??{}:_I;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Uz([m.ref,Jz(n),...o]):Hz(m.ref,Jz(n),o):Hz(null,null)),l?(u!==void 0&&(m.className=fB(m.className,u)),d!==void 0&&(m.style=Yz(m.style,d)),m):_I}function gB(e){return Array.isArray(e)?tB(e):eB(void 0,e)}var _B=Symbol.for(`react.lazy`);function vB(e){if(e?.$$typeof!==_B)return e;let t=Z.Children.toArray(e)[0];return Z.isValidElement(t)?t:e}function yB(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=eB(n,t.props);return e.ref=n.ref,Z.cloneElement(t,e)}if(e&&typeof e==`string`)return bB(e,n);throw Error(wI(8))}function bB(e,t){return e===`button`?(0,Z.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,Z.createElement)(`img`,{alt:``,...t,key:t.key}):Z.createElement(e,t)}function xB(e){return EI(19)?e:e?`true`:void 0}function SB(e){return e==null?e:`current`in e?e.current:e}var CB=null;function wB(e){if(!CB){let e=[];CB=e,queueMicrotask(()=>{CB=null,SI.flushSync(()=>{for(let t of e)t()})})}CB.push(e)}function TB(e,t=!1,n=!1){let r=wL();return UI((i,a=null)=>{r.cancel();let o=SB(e);if(o==null)return;let s=o,c=()=>{n?wB(()=>{a?.aborted||i()}):SI.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()},()=>{a?.aborted||(s.getAnimations().some(e=>e.pending||e.playState!==`finished`)?l():c())})}if(t){let e=ZL;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}else r.request(l)})}function EB(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=UI(a),s=TB(r,n,i);Z.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}var DB={style:{transition:`none`}},OB=`data-base-ui-click-trigger`,kB=`data-base-ui-swipe-ignore`,AB=`data-swipe-ignore`,jB=`[${kB}]`,MB=`[${AB}]`,NB={fallbackAxisSide:`none`},PB={fallbackAxisSide:`end`},FB={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0};function IB(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var LB=0;function RB(e,t=`mui`){let[n,r]=Z.useState(e),i=e||n;return Z.useEffect(()=>{n??(LB+=1,r(`${t}-${LB}`))},[n,t]),i}var zB=BI.useId;function BB(e,t){if(zB!==void 0){let n=zB();return e??(t?`${t}-${n}`:n)}return RB(e,t)}var VB=Z.createContext(void 0);function HB(e=!1){let t=Z.useContext(VB);if(t===void 0&&!e)throw Error(wI(16));return t}function UB(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:Z.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function WB(e,t,{detail:n=0}={}){e.dispatchEvent(new(YI(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function GB(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=Z.useRef(null),s=HB(!0),c=a??s!==void 0,{props:l}=UB({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=Z.useCallback(()=>{let e=o.current;KB(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return xI(u,[u]),{getButtonProps:Z.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return eB({onClick(e){t?e.preventDefault():n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(dB(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=KB(r),s=!i&&qB(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),WB(r,e))}else!l||i||!d&&!u?n&&s&&d&&e.preventDefault():e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),WB(r,e)))},onKeyUp(e){t||(dB(e),a?.(e),e.target===e.currentTarget&&i&&c&&KB(e.currentTarget)&&e.key===` `?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||e.defaultPrevented||e.key!==` `||(e.preventBaseUIHandler(),WB(e.currentTarget,e)))},onPointerDown(e){t?e.preventDefault():s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:UI(e=>{o.current=e,u()})}}function KB(e){return $I(e)&&e.tagName===`BUTTON`}function qB(e){return $I(e)&&e.tagName===`A`&&!!e.href}var JB=`none`,YB=`trigger-press`,XB=`trigger-hover`,ZB=`trigger-focus`,QB=`outside-press`,$B=`item-press`,eV=`close-press`,tV=`focus-out`,nV=`escape-key`,rV=`list-navigation`,iV=`cancel-open`,aV=`sibling-open`,oV=`disabled`,sV=`missing`,cV=`initial`,lV=`imperative-action`,uV=`window-resize`;function dV(e,t,n,r){let i=!1,a=!1,o=r??_I;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function fV(e){return`data-base-ui-${e}`}var pV=Z.createContext(null),mV=()=>Z.useContext(pV),hV=fV(`portal`);function gV(e={}){let{ref:t,container:n,componentProps:r=_I,elementProps:i}=e,a=BB(),o=mV()?.portalNode,[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=UI(e=>{e!==null&&u(e)}),f=Z.useRef(null);xI(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(ZI(n)?n:n.current))??o??document.body;e==null?f.current&&(f.current=null,u(null),c(null)):f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=mB(`div`,r,{ref:[t,d],props:[{id:a,[hV]:``},i]}),m=s&&p?SI.createPortal(p,s):null;return{node:l,nodeId:Z.isValidElement(p)?p.props.id:void 0,subtree:m}}var _V=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=gV({container:o,ref:t,componentProps:e,elementProps:c}),f=Z.useRef(null),p=Z.useRef(null),m=Z.useRef(null),h=Z.useRef(null),[g,_]=Z.useState(null),v=Z.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;Z.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&Fz(e)&&(e.type===`focusin`?v.current&&=(Lz(l),!1):(Iz(l),v.current=!0))}return vL(bL(l,`focusin`,e,!0),bL(l,`focusout`,e,!0))},[l,y]),xI(()=>{l&&b===!0&&v.current&&(Lz(l),v.current=!1)},[b,l]);let S=Z.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,Q.jsxs)(Z.Fragment,{children:[d,(0,Q.jsxs)(pV.Provider,{value:S,children:[x&&l&&(0,Q.jsx)(Vz,{"data-type":`outside`,ref:f,onFocus:e=>{Fz(e,l)?m.current?.focus():jz(g?g.domReference:null)?.focus()}}),x&&l&&(0,Q.jsx)(`span`,{role:s,"aria-owns":u,style:FB}),l&&SI.createPortal(a,l),x&&l&&(0,Q.jsx)(Vz,{"data-type":`outside`,ref:p,onFocus:e=>{Fz(e,l)?h.current?.focus():(Az(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,dV(`focus-out`,e.nativeEvent)))}})]})]})}),vV=Z.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=gV({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,Q.jsxs)(Z.Fragment,{children:[l,c&&SI.createPortal(n,c)]})});function yV(e){let t=bI(bV,e).current;return t.next=e,xI(t.effect),t}function bV(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function xV(e,t){return t!=null&&!jR(t)?0:typeof e==`function`?e():e}function SV(e,t,n){let r=xV(e,n);return typeof r==`number`?r:r?.[t]}function CV(e){return typeof e==`function`?e():e}function wV(e,t){return t||e===`click`||e===`mousedown`}function TV(e){return e?.includes(`mouse`)&&e!==`mousedown`}var EV=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new EL,currentIdRef:{current:null},currentContextRef:{current:null}});function DV(e,t){e.current=t.current}function OV(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=DL();return xI(()=>{a.current=n,o.current?i.current={open:SV(i.current,`open`),close:SV(n,`close`)}:i.current=n},[n,o,i,a]),(0,Q.jsx)(EV.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function kV(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Z.useContext(EV),[f,p]=Z.useState(!1),m=Z.useRef(n);return xI(()=>{m.current=n},[n]),xI(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),xI(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:SV(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,dV(JB))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),xI(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,DV(o,c),d.clear()}},[l,a,o,i,c,d]),Z.useMemo(()=>({activeIdRef:a,hasProvider:u,delayRef:o,isInstantPhase:f}),[a,u,o,f])}var AV=0;function jV(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(AV);function a(){(!i||i())&&e?.focus({preventScroll:n})}if(r)return a(),hI;let o=requestAnimationFrame(a);return AV=o,()=>{AV===o&&(cancelAnimationFrame(o),AV=0)}}var MV={inert:new WeakMap,"aria-hidden":new WeakMap},NV=`data-base-ui-inert`,PV={inert:new WeakSet,"aria-hidden":new WeakSet},FV=new WeakMap,IV=0;function LV(e){return PV[e]}function RV(e){return e?eL(e)?e.host:RV(e.parentNode):null}var zV=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=RV(t);return e.contains(n)?n:null}).filter(e=>e!=null),BV=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},VV=(e,t,n)=>{let r=[],i=e=>{e&&!n.has(e)&&Array.from(e.children).forEach(e=>{JI(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function HV(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=zV(t,e),l=i?VV(t,BV(c),new Set(c)):[],u=[],d=[];if(a){let e=MV[a],n=LV(a);s=n,o=e;let r=zV(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);VV(t,BV(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(FV.get(e)||0)+1;FV.set(e,t),d.push(e),t===1&&e.setAttribute(NV,``)}),IV+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(FV.get(e)||0)-1;FV.set(e,t),t||e.removeAttribute(NV)}),--IV,IV||(MV.inert=new WeakMap,MV[`aria-hidden`]=new WeakMap,PV.inert=new WeakSet,PV[`aria-hidden`]=new WeakSet,FV=new WeakMap)}}function UV(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=yL(e[0]).body;return HV(e,a,n,r,{mark:i})}function WV(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var GV=class{nodesRef={current:[]};events=WV();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},KV=Z.createContext(null),qV=Z.createContext(null),JV=()=>Z.useContext(KV)?.id||null,YV=e=>{let t=Z.useContext(qV);return e??t};function XV(e){let t=BB(),n=YV(e),r=JV();return xI(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function ZV(e){let{children:t,id:n}=e,r=JV();return(0,Q.jsx)(KV.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function QV(e){let{children:t,externalTree:n}=e,r=bI(()=>n??new GV).current;return(0,Q.jsx)(qV.Provider,{value:r,children:t})}function $V(e,t){let n=YI(WL(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var eH=20,tH=[];function nH(){tH=tH.filter(e=>e.deref()?.isConnected)}function rH(e){nH(),e&&JI(e)!==`body`&&(tH.push(new WeakRef(e)),tH.length>eH&&(tH=tH.slice(-20)))}function iH(){return nH(),tH[tH.length-1]?.deref()}function aH(e){return e?Ez(e)?e:Oz(e)[0]||e:null}function oH(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Dz(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Ez(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function sH(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=UI(()=>b.current.floatingContext?.nodeId),S=i===!1,C=SR(_)&&S,w=yV(i),T=yV(a),E=yV(l),D=yV(g),O=YV(p),k=mV(),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef(!1),N=Z.useRef(null),P=Z.useRef(``),F=Z.useRef(``),I=Z.useRef(null),L=Z.useRef(null),R=Hz(I,f,k?.beforeInsideRef),ee=Hz(L,k?.afterInsideRef),z=DL(),te=DL(),ne=wL(),re=k!=null,ie=wR(v),ae=UI((e=ie)=>e?Oz(e):[]),oe=UI(()=>m?.().filter(e=>e!=null)??[]);Z.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&UL(ie,HL(yL(ie)))&&ae().length===0&&!C&&DR(e)}return bL(yL(ie),`keydown`,e)},[r,ie,s,C,ae]),Z.useEffect(()=>{if(r||!g)return;let e=yL(ie);function t(){M.current=!1}function n(e){let t=WL(e),n=oe(),r=UL(v,t)||UL(_,t)||UL(k?.portalNode,t)||n.some(e=>e===t||UL(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,te.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return vL(bL(e,`pointerdown`,n,!0),bL(e,`pointerup`,t,!0),bL(e,`pointercancel`,t,!0),bL(e,`keydown`,i,!0),t)},[r,v,_,ie,g,k,te,oe]),Z.useEffect(()=>{if(r||!c)return;let e=yL(ie);function t(){j.current=!0,te.start(0,()=>{j.current=!1})}function n(e){let t=WL(e);Ez(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=WL(t);s&&n==null&&i!=null&&UL(v,i)&&rH(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=oe(),f=n?.hasAttribute(fV(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,SB(d),SB(u)].includes(n),p=!(UL(_,n)||UL(v,n)||UL(n,v)||UL(k?.portalNode,n)||l.some(e=>e===n||UL(e,n))||c.hasMatchingElement(e=>UL(e,n))||f||O&&(TR(O.nodesRef.current,a).find(e=>UL(e.context?.elements.floating,n)||UL(e.context?.elements.domReference,n))||ER(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,wR(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&ie&&oH(ie),o&&r!==_&&!fz(i)&&HL(e)===e.body){if($I(ie)&&(ie.focus(),o===`popup`)){ne.request(()=>{ie.focus()});return}let e=ae(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||ie;$I(n)&&n.focus()}b.current.insideReactTree?b.current.insideReactTree=!1:(C||!s)&&n&&p&&!j.current&&(C||n!==iH())&&(A.current=!0,h.setOpen(!1,dV(tV,t)))})}function a(){M.current||(b.current.insideReactTree=!0,z.start(0,()=>{b.current.insideReactTree=!1}))}let l=$I(_)?_:null;if(v||l)return vL(l&&bL(l,`focusout`,i),l&&bL(l,`pointerdown`,t),v&&bL(v,`focusin`,n),v&&bL(v,`focusout`,i),v&&k&&bL(v,`focusout`,a,!0))},[r,_,v,ie,s,O,k,h,c,o,ae,C,x,b,z,te,ne,u,d,oe]),Z.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${fV(`portal`)}]`)||[]),t=(O?ER(O.nodesRef.current,x()):[]).find(e=>SR(e.context?.elements.domReference||null))?.context?.elements.domReference,n=UV([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...oe(),t,SB(d),SB(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=UV([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,oe]),xI(()=>{if(!g||r||!$I(ie))return;P.current=``,F.current=``;let e=yL(ie),t=HL(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||UL(ie,t))return;let i=null,a=()=>(i??=ae(ie),i[0]||ie),o;o=r===!0||r===null?a():SB(r),o||=a();let s=UL(ie,HL(e));jV(o,{preventScroll:o===ie,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=HL(e);return!(t!==o&&UL(ie,t))}})})},[r,g,ie,ae,w,E,D]),xI(()=>{if(r||!ie)return;let e=yL(ie),t=HL(e),n=E.current==null;rH(t);function i(e){if(e.open||(P.current=$V(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(kR(e.nativeEvent)||AR(e.nativeEvent))A.current=!1;else{let e=!1;yL(ie).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&JI(t)!==`body`?t:null,s=n?o||a:a||o;return s||=iH()||null,typeof i==`boolean`?s:SB(i)||s||null}return()=>{y.off(`openchange`,i);let t=HL(e),n=oe(),r=UL(v,t)||n.some(e=>e===t||UL(e,t))||O&&TR(O.nodesRef.current,x(),!1).some(e=>UL(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=aH(c),i=typeof o!=`boolean`;if(o&&!A.current&&$I(n)&&(i||n===t||t===e.body||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,ie,T,E,y,O,_,x,oe]),xI(()=>{if(!zL||g||!v)return;let e=HL(yL(v));$I(e)&&bR(e)&&UL(v,e)&&e.blur()},[g,v]),xI(()=>{if(!r&&k)return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),xI(()=>{if(!r&&ie)return oH(ie),()=>{queueMicrotask(nH)}},[r,ie]);let se=!r&&(!s||!C)&&(re||s);return(0,Q.jsxs)(Z.Fragment,{children:[se&&(0,Q.jsx)(Vz,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=ae();jV(e[e.length-1])}else k?.portalNode&&(A.current=!1,Fz(e,k.portalNode)?Az(_)?.focus():SB(d??k.beforeOutsideRef)?.focus())}}),n,se&&(0,Q.jsx)(Vz,{"data-type":`inside`,ref:ee,onFocus:e=>{s?jV(ae()[0]):k?.portalNode&&(c&&(A.current=!0),Fz(e,k.portalNode)?jz(_)?.focus():SB(u??k.afterOutsideRef)?.focus())}})]})}function cH(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=YB}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Z.useRef(void 0),f=wL(),p=DL(),m=Z.useMemo(()=>{function e(e,t,n,r){let i=dV(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=jR(e.pointerType,!0)&&AR(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||jR(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=WL(o);if(bR(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;r===`mousedown`&&i?d.current=void 0:jR(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Z.useMemo(()=>n?{reference:m}:_I,[n,m])}function lH(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function uH(e){return e!=null&&e.clientX!=null}function dH(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Z.useRef(!1),u=Z.useRef(null),[d,f]=Z.useState(),[p,m]=Z.useState([]),h=UI(e=>{i.set(`positionReference`,e)}),g=UI((e,t,n)=>{l.current||(!c.current.openEvent||uH(c.current.openEvent))&&i.set(`positionReference`,lH(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=UI(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=jR(d)?o:a;Z.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=YI(o);function r(t){let n=WL(t);UL(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||uH(c.current.openEvent)?u.current=bL(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Z.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Z.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Z.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Z.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Z.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function fH(){return!1}function pH(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mH(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=fH,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f,events:p}=l.context,m=YV(c),h=UI(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=UI(()=>a),{escapeKey:y,outsidePress:b}=pH(s),x=Z.useRef(!1),S=Z.useRef(!1),C=Z.useRef(!1),w=Z.useRef(!1),T=Z.useRef(!1),E=Z.useRef(``),D=Z.useRef(null),O=DL(),k=DL(),A=UI(()=>{k.clear(),f.current.insideReactTree=!1}),j=UI(e=>{let t=f.current.floatingContext?.nodeId;return(m?TR(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=UI(e=>vR(e,l.select(`floatingElement`))||vR(e,l.select(`domReferenceElement`))),N=UI(e=>{o()&&l.setOpen(!1,dV(YB,e.nativeEvent))}),P=UI(e=>{if(!u||!n||!r||e.key!==`Escape`||T.current||!y&&j(`__escapeKeyBubbles`))return;let t=dV(nV,OR(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),F=UI(()=>{f.current.insideReactTree=!0,k.start(0,A)}),I=UI(e=>{if(!u||!n||e.button!==0)return;let t=WL(e.nativeEvent);UL(l.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),L=UI(e=>{u&&n&&(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});Z.useEffect(()=>{function e(e){e.open||(w.current=!1)}return p.on(`openchange`,e),()=>{p.off(`openchange`,e)}},[p]),Z.useEffect(()=>{if(!u||!n)return u||(w.current=!1),A;f.current.__escapeKeyBubbles=y,f.current.__outsidePressBubbles=b;let e=new EL,t=new EL,i=yL(d);function a(){e.clear(),T.current=!0}function o(){e.start(zL?5:0,()=>{T.current=!1})}function s(){C.current=!0,t.start(0,()=>{C.current=!1})}function c(){x.current=!1,S.current=!1}function p(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function h(e){let t=p();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function k(e){let t=f.current.floatingContext?.nodeId,n=m&&TR(m.nodesRef.current,t).some(t=>vR(e,t.context?.elements.floating));return M(e)||n}function N(e){if(h(e)){e.type!==`click`&&!M(e)&&(t.clear(),C.current=!1),A();return}if(f.current.insideReactTree){A();return}let n=WL(e),r=`[${fV(`inert`)}]`,i=QI(n)?n.getRootNode():null,a=Array.from((eL(i)?i:yL(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>UL(e,n))))return;let s=QI(n)?n:null;for(;s&&!dL(s);){let e=mL(s);if(dL(e)||!QI(e))break;s=e}if(!(a.length&&QI(n)&&!yR(n)&&!UL(n,l.select(`floatingElement`))&&a.every(e=>!UL(s,e)))){if($I(n)&&!(`touches`in e)){let t=dL(n),r=fL(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!k(e)){if(p()===`intentional`){if(e.detail!==0&&!kR(e)&&!w.current)return;if(C.current){t.clear(),C.current=!1;return}}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(l.setOpen(!1,dV(QB,e)),A())}}}function F(e){p()===`sloppy`&&e.pointerType!==`touch`&&l.select(`open`)&&n&&!M(e)&&N(e)}function I(e){if(p()!==`sloppy`||!l.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=WL(e);if(!n)return;let r=bL(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,I)}function ee(e){O.clear(),e.type===`pointerdown`&&(e.button===0&&(w.current=!0),E.current=e.pointerType),(e.type!==`mousedown`||!D.current||D.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function z(e){if(e.type===`pointercancel`&&(w.current=!1),!x.current)return;let n=S.current;c(),p()===`intentional`&&(e.type===`pointercancel`?n&&s():k(e)||(n?s():(typeof g!=`function`||g(e))&&(t.clear(),C.current=!0,A())))}function te(e){if(p()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(N(e),O.clear(),D.current=null)}function ne(e){L(e,te)}function re(e){p()===`sloppy`&&D.current&&!M(e)&&(D.current.dismissOnTouchEnd&&N(e),O.clear(),D.current=null)}function ie(e){L(e,re)}let ae=vL(r&&vL(bL(i,`keydown`,P),bL(i,`compositionstart`,a),bL(i,`compositionend`,o)),_&&vL(bL(i,`click`,ee,!0),bL(i,`pointerdown`,ee,!0),bL(i,`pointerup`,z,!0),bL(i,`pointercancel`,z,!0),bL(i,`mousedown`,ee,!0),bL(i,`mouseup`,z,!0),bL(i,`touchstart`,R,{capture:!0,passive:!0}),bL(i,`touchmove`,ne,{capture:!0,passive:!0}),bL(i,`touchend`,ie,{capture:!0,passive:!0})));return()=>{ae(),e.clear(),t.clear(),c(),C.current=!1,A()}},[f,d,r,_,g,u,n,y,b,P,A,v,j,M,m,l,O]);let R=Z.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),ee=Z.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return Z.useMemo(()=>n?{reference:R,floating:ee,trigger:R}:{},[n,R,ee])}function hH(e,t,n){let{reference:r,floating:i}=e,a=GR(t),o=KR(t),s=WR(o),c=VR(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=HR(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function gH(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=BR(t,e),p=iz(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=az(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=az(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var _H=50,vH=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:gH},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hH(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<_H&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hH(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yH=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=BR(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=VR(r),_=GR(o),v=VR(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[nz(o)]:JR(o)),x=p!==`none`;!d&&x&&b.push(...tz(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=qR(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===GR(t)||T.every(e=>GR(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=GR(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},bH=new Set([`left`,`top`]);async function xH(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=VR(n),s=HR(n),c=GR(n)===`y`,l=bH.has(o)?-1:1,u=a&&c?-1:1,d=BR(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var SH=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await xH(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},CH=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=BR(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=GR(i),p=UR(f),m=u[p],h=u[f],g=(e,t)=>zR(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},wH=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=BR(e,t),u={x:n,y:r},d=GR(i),f=UR(d),p=u[f],m=u[d],h=BR(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=bH.has(VR(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},TH=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=BR(e,t),c=await i.detectOverflow(t,s),l=VR(n),u=HR(n),d=GR(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=NR(p-c[m],g),y=NR(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*PR(c.left,c.right):S=p-2*PR(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function EH(e){let t=fL(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$I(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=FR(n)!==a||FR(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function DH(e){return QI(e)?e:e.contextElement}function OH(e){let t=DH(e);if(!$I(t))return LR(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=EH(t),o=(a?FR(n.width):n.width)/r,s=(a?FR(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}var kH=LR(0);function AH(e){let t=YI(e);return!uL()||!t.visualViewport?kH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jH(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===YI(e)}function MH(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=DH(e),o=LR(1);t&&(r?QI(r)&&(o=OH(r)):o=OH(e));let s=jH(a,n,r)?AH(a):LR(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=YI(a),t=QI(r)?YI(r):r,n=e,i=_L(n);for(;i&&t!==n;){let e=OH(i),t=i.getBoundingClientRect(),r=fL(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=YI(i),i=_L(n)}}return az({width:u,height:d,x:c,y:l})}function NH(e,t){let n=pL(e).scrollLeft;return t?t.left+n:MH(XI(e)).left+n}function PH(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-NH(e,n),y:n.top+t.scrollTop}}function FH(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=XI(r),s=t?rL(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=LR(1),u=LR(0),d=$I(r);if((d||!a)&&((JI(r)!==`body`||tL(o))&&(c=pL(r)),d)){let e=MH(r);l=OH(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?PH(o,c):LR(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function IH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function LH(e){let t=pL(e),n=e.ownerDocument.body,r=PR(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=PR(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+NH(e),o=-t.scrollTop;return fL(n).direction===`rtl`&&(a+=PR(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var RH=25;function zH(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=YI(e),a=XI(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!uL()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(NH(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=RH&&(s-=o)}return{width:s,height:c,x:l,y:u}}function BH(e,t){let n=MH(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=OH(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function VH(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=zH(e,n,t);else if(t===`document`)r=LH(XI(e));else if(QI(t))r=BH(t,n);else{let n=AH(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return az(r)}function HH(e,t){let n=t.get(e);if(n)return n;let r=gL(e,[],!1).filter(e=>QI(e)&&JI(e)!==`body`),i=null,a=fL(e).position===`fixed`,o=a?mL(e):e;for(;QI(o)&&!dL(o);){let e=fL(o),t=cL(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=mL(o)}return t.set(e,r),r}function UH(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?rL(t)?[]:HH(t,this._c):[].concat(n),r],o=VH(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=VH(t,a[e],i);s=PR(n.top,s),c=NR(n.right,c),l=NR(n.bottom,l),u=PR(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function WH(e){let{width:t,height:n}=EH(e);return{width:t,height:n}}function GH(e,t,n){let r=$I(t),i=XI(t),a=n===`fixed`,o=MH(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=LR(0);if((r||!a)&&((JI(t)!==`body`||tL(i))&&(s=pL(t)),r)){let e=MH(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=NH(i));let l=i&&!r&&!a?PH(i,s):LR(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function KH(e){return fL(e).position===`static`}function qH(e,t){if(!$I(e)||fL(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return XI(e)===n&&(n=n.ownerDocument.body),n}function JH(e,t){let n=YI(e);if(rL(e))return n;if(!$I(e)){let t=mL(e);for(;t&&!dL(t);){if(QI(t)&&!KH(t))return t;t=mL(t)}return n}let r=qH(e,t);for(;r&&nL(r)&&KH(r);)r=qH(r,t);return r&&dL(r)&&KH(r)&&!cL(r)?n:r||lL(e)||n}var YH=async function(e){let t=this.getOffsetParent||JH,n=this.getDimensions,r=await n(e.floating);return{reference:GH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function XH(e){return fL(e).direction===`rtl`}var ZH={convertOffsetParentRelativeRectToViewportRelativeRect:FH,getDocumentElement:XI,getClippingRect:UH,getOffsetParent:JH,getElementRects:YH,getClientRects:IH,getDimensions:WH,getScale:OH,isElement:QI,isRTL:XH};function QH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $H(e,t,n){let r=null,i,a=XI(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=IR(d),h=IR(a.clientWidth-(u+f)),g=IR(a.clientHeight-(d+p)),_=IR(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:PR(0,NR(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!QH(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=YI(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function eU(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=DH(e),u=i||a?[...l?gL(l):[],...t?gL(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?$H(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?MH(e):null;c&&g();function g(){let t=MH(e);h&&!QH(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var tU=SH,nU=CH,rU=yH,iU=TH,aU=wH,oU=(e,t,n)=>{let r=new Map,i=n??{},a={...ZH,...i.platform,_c:r};return vH(e,t,{...i,platform:a})},sU=typeof document<`u`?Z.useLayoutEffect:function(){};function cU(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cU(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!cU(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function lU(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function uU(e,t){let n=lU(e);return Math.round(t*n)/n}function dU(e){let t=Z.useRef(e);return sU(()=>{t.current=e}),t}function fU(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Z.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Z.useState(r);cU(f,r)||p(r);let[m,h]=Z.useState(null),[g,_]=Z.useState(null),v=Z.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Z.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Z.useRef(null),C=Z.useRef(null),w=Z.useRef(u),T=c!=null,E=dU(c),D=dU(i),O=dU(l),k=Z.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),oU(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!cU(w.current,t)&&(w.current=t,SI.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);sU(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Z.useRef(!1);sU(()=>(A.current=!0,()=>{A.current=!1}),[]),sU(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Z.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Z.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Z.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=uU(M.floating,u.x),r=uU(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...lU(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Z.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var pU=(e,t)=>{let n=tU(e);return{name:n.name,fn:n.fn,options:[e,t]}},mU=(e,t)=>{let n=nU(e);return{name:n.name,fn:n.fn,options:[e,t]}},hU=(e,t)=>({fn:aU(e).fn,options:[e,t]}),gU=(e,t)=>{let n=rU(e);return{name:n.name,fn:n.fn,options:[e,t]}},_U=(e,t)=>{let n=iU(e);return{name:n.name,fn:n.fn,options:[e,t]}},vU={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},yU=class extends KI{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:WV(),nested:n,triggerElements:i},vU),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&MR(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{this.syncOnly||this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function bU(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Z.useRef(null);r===void 0&&f.current===null&&(f.current=new yU({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),xI(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};QI(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function xU(e,t=!1,n=!1,r=!1){let[i,a]=Z.useState(e&&t?`idle`:void 0),[o,s]=Z.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),xI(()=>{if(!e&&o&&i!==`ending`&&n){let e=CL.request(()=>{a(`ending`)});return()=>{CL.cancel(e)}}},[e,o,i,n]),xI(()=>{if(!e||t)return;let n=CL.request(()=>{a(void 0)});return()=>{CL.cancel(n)}},[t,e]),xI(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=CL.request(()=>{a(`idle`)});return()=>{CL.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}var SU={tabIndex:-1,[GL]:``};function CU(e){return t=>t!==`touch`||e.current}function wU(e,t=!1){let n=BB(),r=JV()!=null,i=bI(()=>e(n,r)).current;return bU({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function TU({handle:e,store:t}){return xI(()=>e.attachStore(t),[e,t]),null}function EU(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function DU(e,t){let n=Z.useRef(null);return UI(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),EU(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),EU(t))})}function OU(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s}}function kU(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function AU(e,t,n,r={}){let i=n.reason,a=i===XB,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=kU(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i=OU(e.state,t,n.trigger,c()),l={...r.extraState,...i};o?l.instantType=`focus`:s?l.instantType=`dismiss`:a&&(l.instantType=void 0),e.update(l)};a?SI.flushSync(l):l()}function jU(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=DU(e,n),o=UI(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e)}else if(a==null&&i){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=UI(e=>{a(e),e&&o(e)});return xI(()=>(s(t.current),()=>s(null)),[s,t,n,e]),xI(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function MU(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Z.useRef(null),i=e.useState(`open`);xI(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=dV(JB);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function NU(e,t,n,r){let{mounted:i,setMounted:a,transitionStatus:o}=xU(e,!1,!1,r),s=t.useState(`preventUnmountingOnClose`),c=!e&&s;t.useSyncedValues({mounted:i,transitionStatus:o,preventUnmountingOnClose:c});let l=UI(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return EB({enabled:i&&!e&&!c,open:e,ref:t.context.popupRef,onComplete(){e||l()}}),{forceUnmount:l,transitionStatus:o}}function PU(e,t){e.useSyncedValues(t),xI(()=>()=>{e.update({activeTriggerProps:_I,inactiveTriggerProps:_I,popupProps:_I})},[e])}function FU(e,t){xI(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),xI(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var IU=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function LU(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new yU({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:_I,inactiveTriggerProps:_I,popupProps:_I}}var RU=e=>e.triggerIdProp??e.activeTriggerId,zU=e=>e.openProp??e.open,BU=e=>(e.popupElement?.id??e.floatingId)||void 0;function VU(e,t){return t!==void 0&&zU(e)&&RU(e)===t}function HU(e,t){return VU(e,t)?!0:t!==void 0&&zU(e)&&RU(e)==null&&e.triggerCount===1}var UU={open:zU,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:RU,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:BU,isTriggerActive:(e,t)=>t!==void 0&&RU(e)===t,isOpenedByTrigger:(e,t)=>VU(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&RU(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>HU(e,t)?BU(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function WU(e){let t=Z.useCallback(t=>e===void 0?hI:e.subscribeStore(t),[e]),n=Z.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,mI.useSyncExternalStore)(t,n,()=>e?.serverStore)}function GU(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=BB(),a=JV()!=null,o=bI(()=>new yU({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new IU,floatingId:i,syncOnly:!1,nested:a})).current;return xI(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=QI(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function KU(e){return qU(e,e.rootContext)}function qU(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Z.useState(null),[d,f]=Z.useState(void 0),[p,m]=Z.useState(void 0),h=Z.useRef(null),g=YV(r),_=Z.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=fU({...e,elements:{..._,...l&&{reference:l}}}),y=QI(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Z.useCallback(e=>{let t=QI(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Z.useCallback(e=>{(QI(e)||e===null)&&(h.current=e,f(e)),(QI(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!QI(e))&&v.refs.setReference(e)},[v.refs,f]),C=Z.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Z.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Z.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Z.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return xI(()=>{o&&(h.current=o)},[o]),xI(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Z.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var JU=LL&&zL;function YU(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=DL();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=YI(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&$I(e)&&e===HL(yL(e))&&(s.current=!0,c.current=e)}function a(){l.current=!0}function o(){l.current=!1}return vL(bL(t,`blur`,r),JU&&bL(t,`keydown`,a,!0),JU&&bL(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);QI(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=WL(t.nativeEvent);if(QI(a)){if(JU&&!t.relatedTarget){if(!l.current&&!bR(a))return}else if(!CR(a))return}let o=_R(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;i.select(`open`)&&o||p===0||p===void 0?i.setOpen(!0,dV(ZB,d,f)):u.start(p,()=>{s.current||i.setOpen(!0,dV(ZB,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=QI(n)&&n.hasAttribute(fV(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=HL(yL(e));!n&&t===e||UL(o.current.floatingContext?.refs.floating.current,t)||UL(e,t)||a||_R(n??t,i.context.triggerElements)||i.setOpen(!1,dV(ZB,r))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var XU=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new EL,this.restTimeout=new EL,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},ZU=new WeakMap;function QU(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&ZU.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),ZU.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $U(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=ZU.get(n);a&&a!==e&&QU(a),QU(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,ZU.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function eW(e){let t=e.context.dataRef.current,n=bI(()=>t.hoverInteractionState??XU.create()).current;return t.hoverInteractionState||=n,vI(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tW(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=YV(),d=JV(),f=eW(a),p=DL(),m=UI(()=>wV(l.current.openEvent?.type,f.interactedInside)),h=UI(()=>TV(l.current.openEvent?.type)),g=UI(()=>{QU(f)});xI(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Z.useEffect(()=>g,[g]),xI(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&QI(c)&&s){let e=c,t=s,n=yL(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return $U(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&TR(u.nodesRef.current,d).length>0)}function t(e){let t=SV(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,dV(XB,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=WL(e);xR(t)?f.interactedInside=t?.closest(`[aria-haspopup]`)!=null:f.interactedInside=!1}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(_R(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;u&&r&&QI(o)&&TR(u.nodesRef.current,r,!1).some(e=>UL(e.context?.elements.floating,o))||(f.handler?f.handler(n):(g(),h()&&!m()&&t(n)))}function v(t){u&&d&&!e()&&p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,dV(XB,t)),u.events.emit(`floating.closed`,t)})}let y=s;return vL(y&&bL(y,`mouseenter`,c),y&&bL(y,`mouseleave`,_),y&&bL(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var nW={current:null};function rW(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=nW,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=YV(l),y=eW(h),b=Z.useRef(!1),x=yV(i),S=yV(r),C=yV(o),w=yV(n),T=yV(p),E=yV(f),D=UI(()=>wV(g.current.openEvent?.type,y.interactedInside)),O=UI(()=>T.current?.()!==!1),k=UI((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!UL(e,t);if(!QI(n))return!1;let i=n;return r.hasMatchingElement(e=>UL(e,i))&&(!e||!UL(e,i))}),A=UI(()=>{y.handler&&=(yL(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=UI(()=>{QU(y)});return u&&(y.handleCloseOptions=i?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===XB,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=SV(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,dV(XB,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,dV(XB,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!QI(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!jR(y.pointerType))return;let t=CV(C.current),n=SV(S.current,`open`,y.pointerType),r=WL(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(QI(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(UL(e,r)){s=e;break}}QI(i)&&QI(o)&&!h.context.triggerElements.hasElement(i)&&UL(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&QI(s)&&QI(o)&&UL(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;m?O()&&h.setOpen(!0,dV(XB,e,s)):p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,dV(XB,e,s))}):g&&O()&&h.setOpen(!0,dV(XB,e,s)))}function i(t){if(D()){j();return}A();let n=yL(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!_R(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t)}else y.pointerType===`touch`&&UL(h.select(`floatingElement`),t.relatedTarget)||e(t)}}function o(e){UL(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?bL(t,`mouseout`,o):void 0;return s?vL(bL(t,`mousemove`,r,{once:!0}),bL(t,`mouseenter`,r),bL(t,`mouseleave`,i),l):vL(bL(t,`mouseenter`,r),bL(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!jR(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;$U(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=CV(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,dV(XB,t,n))}y.pointerType===`touch`?SI.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var iW=`Escape`;function aW(e){return zL&&e.movementX===0&&e.movementY===0}function oW(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function sW(e,t){return oW(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function cW(e,t,n){return oW(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function lW(e,t,n){return oW(t,n?e===qL:e===JL,e===XL)}function uW(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===iW:oW(t,n?e===JL:e===qL,e===YL)}function dW(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=wR(T),k=SR(E),A=yV(O),j=JV(),M=YV(b),N=Z.useRef(f),P=Z.useRef(o??-1),F=Z.useRef(null),I=Z.useRef(!0),L=UI(e=>{i(P.current===-1?null:P.current,e)}),R=Z.useRef(!!T),ee=Z.useRef(w),z=Z.useRef(!1),te=Z.useRef(!1),ne=Z.useRef(null),re=yV(h),ie=yV(w),ae=yV(o),oe=yV(y),se=wL(),ce=wL(),le=UI(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):ne.current=jV(e,{sync:z.current,preventScroll:!0})}let t=n.current[P.current],r=te.current;t&&e(t),(z.current?e=>e():e=>se.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),he&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});xI(()=>{D.current.orientation=g},[D,g]),xI(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(te.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),xI(()=>{if(a){if(!w)z.current=!1;else if(T){if(r==null){if(z.current=!1,ae.current!=null)return;if(R.current&&(P.current=-1,le()),(!ee.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ce.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||cW(F.current,g,u)||l?sz(n):cz(n),F.current=null,L())};t()}}else oz(n.current,r)||(P.current=r,le(),te.current=!1)}}},[a,w,T,r,ae,l,n,g,u,L,le,ce]),xI(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=HL(yL(E??t??null)),r=e.some(e=>e.context&&UL(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),xI(()=>{ee.current=w,R.current=!!T}),xI(()=>{w||(F.current=null,N.current=f)},[w,f]);let ue=r!=null,de=UI(e=>{if(!ie.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),fe=UI(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),pe=UI(()=>sz(n,re.current)),me=UI(e=>{if(I.current=!1,z.current=!0,e.which===229||!ie.current&&e.currentTarget===A.current)return;if(l&&uW(e.key,g,u,S)){sW(e.key,fe())||DR(e),C.setOpen(!1,dV(rV,e.nativeEvent)),$I(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=sz(n,h),i=cz(n,h);if(k||(e.key===`Home`&&(DR(e),P.current=r,L(e)),e.key===`End`&&(DR(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(sW(e.key,g)){if(DR(e),w&&!d&&HL(e.currentTarget.ownerDocument)===e.currentTarget){P.current=cW(e.key,g,u)?r:i,L(e);return}cW(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(z.current=!1,P.current=r):P.current=lz(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,lz(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(z.current=!1,P.current=i):P.current=lz(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,lz(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),oz(n.current,P.current)&&(P.current=-1),L(e)}}),he=Z.useMemo(()=>({onFocus(e){z.current=!0,de(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){aW(e)||(z.current=!0,te.current=!1,p&&de(e))},onPointerLeave(e){if(!ie.current||!I.current||e.pointerType===`touch`)return;z.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&oe.current&&(ne.current?.(),ne.current=null,P.current=-1,L(e),!d)){let e=A.current,t=HL(yL(e));e&&UL(e,t)&&e.focus({preventScroll:!0})}}}),[de,ie,A,p,n,L,oe,d]),ge=Z.useMemo(()=>d&&w&&ue&&{"aria-activedescendant":`${v}-${r}`},[d,w,ue,v,r]),_e=Z.useMemo(()=>({...k?{}:ge,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=WL(e.nativeEvent);if(t&&!UL(A.current,t))return;DR(e),C.setOpen(!1,dV(tV,e.nativeEvent)),$I(E)&&E.focus()}else me(e)},onPointerMove(e){aW(e)||(I.current=!0)}}),[ge,me,A,k,C,w,d,E]),ve=Z.useMemo(()=>{function e(e){C.setOpen(!0,dV(rV,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&kR(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&AR(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=lW(t.key,fe(),u),a=sW(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return me(t);if(n||m||!r){if(o){let e=sW(t.key,fe());F.current=l&&e?null:t.key}l?i&&(DR(t),n?(P.current=pe(),L(t)):e(t)):a&&(ae.current!=null&&(P.current=ae.current),DR(t),!n&&m?e(t):me(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[me,f,pe,l,L,C,m,g,fe,u,ae,d]),ye=Z.useMemo(()=>({...ge,...ve}),[ge,ve]);return Z.useMemo(()=>a?{reference:ye,floating:_e,item:he,trigger:ve}:{},[a,ye,_e,ve,he])}function fW(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=DL(),m=Z.useRef(``),h=Z.useRef(u??i??-1),g=Z.useRef(null),_=UI(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!fz(n)||n?.matches(`:disabled`)?!1:o==null||!uz(gI,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(DR(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(DR(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=UI(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);UL(n,t)||UL(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});xI(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Z.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Z.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var pW=.1,mW=pW*pW,hW=.5;function gW(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function _W(e,t,n,r,i,a,o,s,c,l){let u=!1;return gW(e,t,n,r,i,a)&&(u=!u),gW(e,t,i,a,o,s)&&(u=!u),gW(e,t,o,s,c,l)&&(u=!u),gW(e,t,c,l,n,r)&&(u=!u),u}function vW(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function yW(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function bW(e={}){let{blockPointerEvents:t=!1}=e,n=new EL,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*mW;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=WL(r),g=r.type===`mouseleave`,_=UL(u,h),v=UL(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&QI(r.relatedTarget)&&UL(u,r.relatedTarget))return;function y(){return!!(s&&TR(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=yW(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=yW(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=yW(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=yW(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!vW(d,f,x)||!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?hW/2:hW*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+hW+1,o=C||T?S.bottom-hW:S.top,s=C?T?S.bottom-hW:S.top:S.bottom-hW;M=_W(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?hW/2:hW*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-hW,o=C||T?S.top+hW:S.bottom,s=C?T?S.top+hW:S.bottom:S.top+hW;M=_W(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?hW/2:hW*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+hW+1,o=w||E?S.right-hW:S.left,s=w?E?S.right-hW:S.left:S.right-hW;M=_W(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?hW/2:hW*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-hW,o=w||E?S.left+hW:S.right,s=w?E?S.left+hW:S.right:S.left+hW;M=_W(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var xW=Z.createContext(void 0);function SW(){return Z.useContext(xW)?.direction??`ltr`}var CW=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=BR(e,t)||{};if(l==null)return{};let f=iz(u),p={x:n,y:r},m=KR(i),h=WR(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];w&&await o.isElement?.(C)||(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=zR(k,j,A),N=!c.arrow&&HR(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),wW=(e,t)=>{let{name:n,fn:r}=CW(e);return{name:n,fn:r,options:[e,t]}},TW={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},EW={sideX:`left`,sideY:`top`},DW=`--available-width`,OW=`--available-height`,kW=`--anchor-width`,AW=`--anchor-height`,jW=`--transform-origin`,MW=DW,NW=OW;function PW(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function FW(e,t,n){let{rects:r,placement:i}=e;return{side:PW(t,VR(i),n),align:HR(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function IW(e){return LW(e,KU)}function LW(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Z.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=UI(A),M=A?j:n,N=yV(n),P=yV(g),F=SW()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let ee=+(i===`bottom`),z=+(i===`top`),te=+(i===`right`),ne=+(i===`left`),re={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},ie=Z.useRef(null),ae=yV(a),oe=yV(s),se=typeof a==`function`?0:a,ce=typeof s==`function`?0:s,le=[];p&&le.push(p),le.push(pU(e=>{let t=FW(e,i,F),n=typeof ae.current==`function`?ae.current(t):ae.current,r=typeof oe.current==`function`?oe.current(t):oe.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[se,ce,F,i]));let ue=E===`none`&&T!==`shift`,de=!ue&&(u||O||T===`shift`),fe=T===`none`?null:gU({...re,padding:{top:R.top+1+ee,right:R.right+1+ne,bottom:R.bottom+1+z,left:R.left+1+te},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),pe=ue?null:mU({...re,rootBoundary:k,mainAxis:E!==`none`,crossAxis:de,limiter:u||O?void 0:hU(e=>{if(!ie.current)return{};let{width:t,height:n}=ie.current.getBoundingClientRect(),r=GR(VR(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[re,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?le.push(pe,fe):le.push(fe,pe),le.push(_U({...re,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(MW,`${t}px`),i.setProperty(NW,`${n}px`);let a=YI(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(kW,`${u}px`),i.setProperty(AW,`${d}px`)}}),wW(e=>({element:ie.current||yL(e.elements.floating).createElement(`div`),padding:ie.current?d:0,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=VR(r),u=HR(r),d=GR(l)===`y`,f=ie.current,p=typeof a==`function`?a(FW(e,i,F)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return de&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(jW,d?`${m} ${h}`:`${h} ${m}`),{}}},TW,b),xI(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let me=Z.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:he,elements:ge,x:_e,y:ve,middlewareData:ye,update:be,placement:xe,context:Se,isPositioned:Ce,floatingStyles:we}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:le,strategy:r,whileElementsMounted:m?void 0:(...e)=>eU(...e,me),nodeId:y,externalTree:S}),{sideX:Te,sideY:Ee}=ye.adaptiveOrigin||EW,De=Ce?r:`fixed`,Oe=Z.useMemo(()=>{let e;return e=Ce?b?{position:De,[Te]:_e,[Ee]:ve}:{...we,position:De}:{position:De,top:0,left:0},e[MW]=`100vw`,e[NW]=`100vh`,Ce||(e.opacity=0),e},[b,De,Te,_e,Ee,ve,we,Ce]),ke=Z.useRef(null);xI(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(RW(t)?t.current:t)||null;n!==ke.current&&(he.setPositionReference(n),ke.current=n)},[g,he,M,N]),Z.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&RW(e)&&e.current!==ke.current&&(he.setPositionReference(e.current),ke.current=e.current)},[g,he,M,N]),Z.useEffect(()=>{if(m&&g&&ge.reference&&ge.floating)return eU(ge.reference,ge.floating,be,me)},[m,g,ge,be,me]);let Ae=VR(xe),je=PW(i,Ae,F),Me=HR(xe)||`center`,Ne=!!ye.hide?.referenceHidden;xI(()=>{x&&g&&Ce&&Ae!==I&&w(Ae)},[x,g,Ce,Ae,I]);let Pe=Z.useMemo(()=>({position:`absolute`,top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Fe=ye.arrow?.centerOffset!==0;return Z.useMemo(()=>({positionerStyles:Oe,arrowStyles:Pe,arrowRef:ie,arrowUncentered:Fe,side:je,align:Me,physicalSide:Ae,anchorHidden:Ne,refs:he,context:Se,isPositioned:Ce,update:be}),[Oe,Pe,ie,Fe,je,Me,Ae,Ne,he,Se,Ce,be])}function RW(e){return e!=null&&`current`in e}function zW(e){return e===`starting`?DB:_I}function BW(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),mB(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},zW(r),i],stateAttributesMapping:mR})}var VW=VF(),HW=48,UW=(e,t=0)=>{let n=new Int32Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r)-HW-t;return n},WW=e=>{let t=new Int32Array(e.length+1);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t},GW=e=>{let t=new Int32Array(e.length),n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r)-HW;n+=i>>>1^-(i&1),t[r]=n}return t},KW=384,qW=[],JW=WW(UW(`E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010`)),YW=WW(UW(`:11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3`)),XW=`@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom`,ZW=(()=>{let e=JW.length-1,t=new Int32Array(e);for(let n=e-1;n>=0;n--){let e=1,r=n+1;for(let i=JW[n];i<JW[n+1];i++)e+=t[r],r+=t[r];t[n]=e}let n=new Int32Array(JW[e]),r=0;for(let i=0;i<e;i++){let e=i+1;for(let a=JW[i];a<JW[i+1];a++)n[r++]=e,e+=t[e]}return n})(),QW=UW(`02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000
ŏ0000000ŏ00000000000000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000`,1),$W=WW(UW(`123333359346463635126536711576`)),eG=UW(`93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0328432553;D>E?3257D>032585:0325B:;0328B:032`),tG=UW(`012113445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EEJ4444::EE4444441691;644444114244444:;K6666555555555555555999666664444444444444444444444226?6:66644L9M?D:111::::6DE199`),nG=GW(`020200202020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200`),rG=(()=>{let e=new Int32Array(319).fill(-1),t=GW(`02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222`),n=GW(`02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222`);for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e})(),iG=`container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top| bounce none ping pulse spin| auto square video| auto fr max min px|none | auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform`.split(`|`).map(e=>{let t=e.split(` `),n=t.shift();for(let e=0;e<t.length;e++)t[e]=n+t[e];return t}),aG=GW(`0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422`),oG=GW(`ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622`),sG=GW(`02222222222222222222222222222222222222222222222222222222222222222202022222222222EH2200IL021042222Y\\222IL0cf2e10j2222U00X202[^2y0000120|{~22
:22|22222222222G000qOVI00000}2>40000B00000I¨©000¬00000000000000021M®00°000000000000000000000222HGHa1º222¿2À2222ÉÌ000°2±`),cG=new Int32Array(995),lG=new Int32Array(995),uG=new Int32Array(995),dG=``,fG=new Int32Array(1038);{let e=new Map,t=0,n=0;for(let r=0;r<aG.length;r++)for(let i of iG[sG[r]]){let a=e.get(i);a===void 0&&(a=t++,e.set(i,a),fG[a*2]=dG.length,fG[a*2+1]=i.length,dG+=i),cG[n]=aG[r],lG[n]=oG[r],uG[n]=a,n++}}var pG=GW(`0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p`),mG=WW(UW(`1::24444432:442:44:44>222222:44:4421322511111311111114`)),hG=GW(`24A;33N=C@H4A;33N=C@<27;83:;8393NQ:3NQʰ222ˉºŴŽ2R2=18cƴÅŇ=cĞÛC1ƈǝȈ:ħ25=11D3A@4=<1;1DEr25;11B3?<6;:371BCn9@7=<8192>2E121@9@EHE@9>2T25511<398454131<=V25511<398454131<=ƧNž2Đå242L222290000f22500ɛ000ǘ222`),gG=UW(`ij`),_G=UW(``),vG=UW(`1`),yG={GROUP_COUNT:KW,customValidatorNames:qW,edgeStart:JW,labelStart:YW,labelText:XW,edgeTarget:ZW,nodeGroup:QW,nodeVlist:rG,vlistPat:$W,vlistOps:eG,vlistRef:tG,vlistGroup:nG,litAnchor:cG,litGroup:lG,litPool:uG,poolOffsets:fG,poolText:dG,adjGid:pG,adjStart:mG,adjTgt:hG,patGid:gG,patTgt:_G,postfixLookupGroups:vG,orderSensitiveModifiers:`* ** after backdrop before details-content file first-letter first-line marker placeholder selection`},bG=`line`in Error(),xG=-1,SG=-1,CG=(e,t,n)=>{let r=2166136261;for(let i=t;i<n;i++)r=Math.imul(r^e.charCodeAt(i),16777619);return r},wG=(e,t,n)=>{let r=n-t,i=Math.imul(r,2654435761)^e.charCodeAt(t);if(r>3){let a=r>>2,o=r>>1;i=Math.imul(i^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+a),2246822507),i=Math.imul(i^e.charCodeAt(t+o)<<8^e.charCodeAt(t+o+a)<<16^e.charCodeAt(n-3),3266489909),i^=e.charCodeAt(n-2)<<8^e.charCodeAt(n-1)<<16;for(let r=t+3,a=n-4;r<t+8&&r<a;r++,a--)i=Math.imul(i^e.charCodeAt(r)^e.charCodeAt(a)<<8,16777619)}return i^i>>>15},TG=(e,t,n={})=>{let{GROUP_COUNT:r,edgeStart:i,labelStart:a,labelText:o,edgeTarget:s,nodeGroup:c,nodeVlist:l,vlistPat:u,vlistOps:d,vlistRef:f,vlistGroup:p,litAnchor:m,litGroup:h,litPool:g,poolOffsets:_,poolText:v,adjGid:y,adjStart:b,adjTgt:x,patGid:S,patTgt:C,postfixLookupGroups:w,customValidatorNames:T,orderSensitiveModifiers:E}=e,D=new Int32Array(r).fill(-1);for(let e=0;e<y.length;e++)D[y[e]]=e;let O=0;for(let e=0;e+1<b.length;e++){let t=b[e+1]-b[e];t>O&&(O=t)}let k=32;for(;k<2*(1+O+S.length);)k<<=1;let A=new Int32Array(f.length+1);for(let e=0;e<f.length;e++)A[e+1]=A[e]+u[f[e]+1]-u[f[e]];let j=new Uint8Array(r);for(let e=0;e<w.length;e++)j[w[e]]=1;let M=i.length-1,N=new Uint8Array(M),P=0,F=!0;for(let e=0;e<m.length;e++){N[m[e]]=1;let t=_[g[e]*2+1];t>P&&(P=t);let n=v.charCodeAt(_[g[e]*2]);(n===91||n===40)&&(F=!1)}let I=1;for(;I<m.length*2;)I<<=1;let L=new Int32Array(I).fill(-1);for(let e=0;e<m.length;e++){let t=_[g[e]*2],n=(CG(v,t,t+_[g[e]*2+1])^Math.imul(m[e],2654435761)|0)&I-1;for(;L[n]!==-1;)n=n+1&I-1;L[n]=e}let R=(e,t,n,r)=>{let i=(CG(t,n,r)^Math.imul(e,2654435761)|0)&I-1,a=r-n;for(;;){let r=L[i];if(r===-1)return-1;if(m[r]===e&&_[g[r]*2+1]===a){let e=_[g[r]*2],i=!0;for(let r=0;r<a;r++)if(v.charCodeAt(e+r)!==t.charCodeAt(n+r)){i=!1;break}if(i)return h[r]}i=i+1&I-1}},ee=n.cacheSize??8192,z=n.prefix??e.prefix??``,te=z===``?``:z+`:`,ne=te.length,re=(T??[]).map(e=>{let n=t&&t[e];if(!n)throw Error(`cn: missing validator `+e);return n}),ie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,se=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=0,le=-1,ue=-1,de=-1,fe=-1,pe=e=>e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||e===95,me=e=>/\s/.test(String.fromCharCode(e)),he=(e,t,n)=>{if(ce=0,le=-1,n-t<3)return;let r=e.charCodeAt(t),i=e.charCodeAt(n-1);if(r===91&&i===93)ce=1;else if(r===40&&i===41)ce=2;else return;de=t+1,fe=n-1;let a=t+1;if(pe(e.charCodeAt(a))){for(a++;a<n-1;){let t=e.charCodeAt(a);if(!pe(t)&&t!==45)break;a++}a<n-2&&e.charCodeAt(a)===58&&(le=t+1,ue=a,de=a+1)}},ge=(e,t,n,r)=>{if(n-t!==r.length)return!1;for(let n=0;n<r.length;n++)if(e.charCodeAt(t+n)!==r.charCodeAt(n))return!1;return!0},_e=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ve=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ye=e=>!!e&&!Number.isNaN(Number(e)),be=(e,t,n)=>{if(n-t<11||!ge(e,t,t+10,`@container`))return!1;if(e.charCodeAt(t+10)===47)return n-t>=12;let r=e.charCodeAt(t+11);return r===115&&n-t>=17&&ge(e,t+10,t+16,`-size/`)||r===110&&n-t>=19&&ge(e,t+10,t+18,`-normal/`)},xe=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Se=`length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight`.split(`|`).map(e=>e.split(` `)),Ce=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],we=(e,t,n,r)=>{if(e>=10){if(e>=25)return re[e-25](t.slice(n,r));let i=e-10;if(ce!==xe[i])return!1;if(le>=0){for(let e of Se[i])if(ge(t,le,ue,e))return!0;return!1}switch(Ce[i]){case 0:return!1;case 1:return!0;case 2:{let e=t.slice(de,fe);return ie.test(e)&&!ae.test(e)}case 3:return ye(t.slice(de,fe));case 4:return se.test(t.slice(de,fe));default:return oe.test(t.slice(de,fe))}}switch(e){case 0:return!0;case 1:return ce===0;case 2:return ce===1;case 3:return ce===2;case 4:return _e.test(t.slice(n,r));case 5:return ye(t.slice(n,r));case 6:{let e=t.slice(n,r);return!!e&&Number.isInteger(Number(e))}case 7:return r>n&&t.charCodeAt(r-1)===37&&ye(t.slice(n,r-1));case 8:return ve.test(t.slice(n,r));default:return be(t,n,r)}},Te=new Set(typeof E==`string`?E.split(` `):E),Ee=(e,t,n,r,i,a)=>{let o=CG(t,n,r)^(i?2654435769:0),s=e.get(o);if(s!==void 0)outer:for(let e=0;e<s.length;e++){let a=s[e];if(a.imp===i&&a.k.length===r-n){for(let e=0;e<a.k.length;e++)if(a.k.charCodeAt(e)!==t.charCodeAt(n+e))continue outer;return a.id}}else e.set(o,s=[]);let c=t.slice(n,r),l=a(c);return s.push({k:c,imp:i,id:l}),l},De=new Map,Oe=new Map,ke=2,Ae=4096,je=(e,t)=>{let n=[],r=0,i=0,a=0;for(let t=0;t<e.length;t++){let o=e.charCodeAt(t);r===0&&i===0&&o===58?(n.push(e.slice(a,t)),a=t+1):o===91?r++:o===93?r--:o===40?i++:o===41&&i--}n.push(e.slice(a));let o=n[0];if(n.length>1){let e=[],t=[];for(let r of n)r.charCodeAt(0)===91||Te.has(r)?(t.length&&(e.push(...t.sort()),t=[]),e.push(r)):t.push(r);t.length&&e.push(...t.sort()),o=e.join(`:`)}let s=t?o+` !`:o,c=Oe.get(s);return c===void 0&&Oe.set(s,c=ke++),c},Me=new Map,Ne=r,Pe=r+4096,Fe=()=>Ne++,Ie=2097152,Le=8192,Re=new Int32Array(Le),ze=Array(Le).fill(null),Be=new Int32Array(Le),Ve=new Int32Array(Le),He=new Uint8Array(Le),Ue=0,We=(e,t,n,r,i,a,o,s)=>{let c=e;if(ze[e]!==null){if(ze[e|1]===null)c=e|1;else if(!(Ue++&3))c=e|Ue>>2&1;else return}ze[c]=t.slice(n,r),Re[c]=i,Be[c]=a,Ve[c]=o,He[c]=s},Ge=()=>ze.fill(null),Ke=256,qe=[new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke),new Int32Array(Ke)],[Je,Ye,Xe,Ze]=qe,Qe=new Uint8Array(Ke),$e=new Uint8Array(Ke),et=()=>{Ke*=2,qe=qe.map(e=>{let t=new Int32Array(Ke);return t.set(e),t}),[Je,Ye,Xe,Ze]=qe;let e=new Uint8Array(Ke);e.set(Qe),Qe=e,$e=new Uint8Array(Ke)},tt=64,nt=new Int32Array(tt),rt=new Int32Array(tt),it=new Int32Array(r),at=2048,ot=21,st=new Float64Array(at),ct=new Int32Array(at),lt=0,ut=(e,t)=>{if(e===0&&t<r)return it[t]===lt?1:(it[t]=lt,0);let n=e*2097152+t+1,i=Math.imul(n,2654435761)>>>ot;for(;ct[i]===lt;){if(st[i]===n)return 1;i=i+1&at-1}return st[i]=n,ct[i]=lt,0},dt=(e,t,n,r,i)=>{if(n-t>=2&&e.charCodeAt(t)===91&&e.charCodeAt(n-1)===93){let r=-1;for(let i=t+1;i<n-1;i++)if(e.charCodeAt(i)===58){r=i;break}return r===-1||r===t+1?xG:Ee(Me,e,t+1,r,0,Fe)}if(r>=0&&c[r]>=0)return c[r];for(let t=i-1;t>=0;t--){let r=rt[t];if(r>n)continue;let i=nt[t],a=n-r;if(N[i]===1&&a>0&&a<=P){let t=e.charCodeAt(r);if(F===!1||t!==91&&t!==40){let t=R(i,e,r,n);if(t>=0)return t}}let o=l[i];if(o<0)continue;let s=f[o],c=u[s],m=u[s+1];if(c===m)continue;he(e,r,n);let h=A[o]-c;for(let t=c;t<m;t++)if(we(d[t],e,r,n))return p[h+t]}return xG},ft=e=>{let t=e.length,n=0,c=0,u=!1;(ke>Ae||De.size>Ae)&&(De=new Map,Oe=new Map,ke=2,Ge()),Ne>Pe&&(Me=new Map,Ne=r,Ge());let d=0;for(;d<t;){let f=e.charCodeAt(d);if(f===32||f>=9&&f<=13||f>=160&&me(f)){f!==32&&(u=!0),d++;continue}let p=d,m=0;for(;d<t;){if(f=e.charCodeAt(d),f<=32){if(f===32)break;if(f>=9&&f<=13){u=!0;break}}else if(f>=160&&me(f)){u=!0;break}m=Math.imul(m^f,16777619),d++}let h=d,g=h-p;n===Ke&&et();let _=n++;Je[_]=p,Ye[_]=h,c+=g,m^=Math.imul(g,2654435761);let v=m^m>>>15,y=v&8190;{let t=-1;if(Re[y]===v&&ze[y]!==null&&ze[y].length===g?t=y:Re[y|1]===v&&ze[y|1]!==null&&ze[y|1].length===g&&(t=y|1),t>=0){let n=ze[t],r=!0;for(let t=0;t<g;t++)if(n.charCodeAt(t)!==e.charCodeAt(p+t)){r=!1;break}if(r){Xe[_]=Be[t],Ze[_]=Ve[t],Qe[_]=He[t];continue}}}let b=p;if(ne!==0){if(h-p<=ne||!e.startsWith(te,p)){Xe[_]=xG,We(y,e,p,h,v,xG,0,0);continue}b=p+ne}let x=0,S=0,C=-1,w=-1;for(let t=b;t<h;t++){let n=e.charCodeAt(t);if(x===0&&S===0){if(n===58){C=t;continue}if(n===47){w=t;continue}}n===91?x++:n===93?x--:n===40?S++:n===41&&S--}let T=C>=b?C+1:b,E=T,D=h,O=!1,k=0;D>E&&e.charCodeAt(D-1)===33?(O=!0,D--):D>E&&e.charCodeAt(E)===33&&(O=!0,E++,k=1);let A=-1;w>T&&(A=w+k,A>=D&&(A=-1));let M=E;D-E>1&&e.charCodeAt(E)===45&&(M=E+1);let P=0,F=0,I=0,L=-1,R=0;(l[0]>=0||N[0]===1)&&(nt[0]=0,rt[0]=M,R=1);let ee=SG,z=0;for(let t=M;t<D;t++)if(t===A&&(ee=F<I?SG:P,z=R),P!==SG){let n=e.charCodeAt(t),r=-1;if(F<I)o.charCodeAt(F)===n?(F++,F===I&&(r=P=L)):P=SG;else{let e=i[P],t=i[P+1],c=SG;for(let i=e;i<t;i++){let e=a[i];if(o.charCodeAt(e)===n){a[i+1]-e===1?r=c=s[i]:(F=e+1,I=a[i+1],L=s[i],c=P);break}}P=c}if(r>=0&&(l[r]>=0||N[r]===1)&&t+1<D&&e.charCodeAt(t+1)===45){if(R===tt){tt*=2;let e=new Int32Array(tt);e.set(nt),nt=e;let t=new Int32Array(tt);t.set(rt),rt=t}nt[R]=r,rt[R]=t+2,R++}}A===D&&(ee=F<I?SG:P,z=R);let re=F<I?SG:P,ie,ae=!1;if(A>=0){if(ae=!0,ie=dt(e,E,A,ee,z),ie!==xG&&ie<r&&j[ie]){let t=dt(e,E,D,re,R);t!==xG&&t!==ie&&(ie=t,ae=!1)}else ie===xG&&(ie=dt(e,E,D,re,R),ae=!1)}else ie=dt(e,E,D,re,R);let oe=0,se=0;ie===xG?Xe[_]=xG:(se=+!!ae,oe=b>=C?+!!O:Ee(De,e,b,C,+!!O,e=>je(e,O)),Xe[_]=ie,Qe[_]=se,Ze[_]=oe),We(y,e,p,h,v,ie,oe,se)}if(n===0)return``;if(n===1)return Je[0]===0&&Ye[0]===t?e:e.slice(Je[0],Ye[0]);if(n*k>at){for(;n*k>at;)at<<=1,ot--;st=new Float64Array(at),ct=new Int32Array(at)}if(ke>=Ie||Ne>=Ie)throw Error(`cn: too many distinct classes in one merge`);lt=lt+1|0,lt===0&&(it.fill(0),ct.fill(0),lt=1);let f=!1;for(let e=n-1;e>=0;e--){let t=Xe[e];if(t===xG){$e[e]=1;continue}let n=Ze[e];if(ut(n,t)===1)$e[e]=0,f=!0;else if($e[e]=1,t<r){let r=D[t];if(r>=0)for(let e=b[r];e<b[r+1];e++)ut(n,x[e]);if(Qe[e]&1)for(let e=0;e<S.length;e++)S[e]===t&&ut(n,C[e])}}if(!f&&!u&&t===c+n-1)return e;let p=``,m=0;for(;m<n;){if(!$e[m]){m++;continue}let t=Je[m],r=Ye[m],i=m+1;for(;i<n&&$e[i]&&Je[i]===r+1&&e.charCodeAt(r)===32;)r=Ye[i],i++;p.length>0&&(p+=` `),p+=e.slice(t,r),m=i}return p},pt=16384,mt=new Int32Array(pt*2),ht=0,gt=1,_t=Object.create(null),vt=Object.create(null),yt=new Map,bt=new Map,xt=0,St=0,Ct=()=>{ht^=pt,gt=gt+1|0,St=0},wt=e=>{let t=_t[e];if(t!==void 0)return t;let n=wG(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=vt[e],t!==void 0)?(_t[e]=t,t):(t=ft(e),i?(_t[e]=t,++xt>ee&&(xt=0,vt=_t,_t=Object.create(null),Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Tt=e=>{let t=yt.get(e);if(t!==void 0)return t;let n=wG(e,0,e.length),r=(n&16383)+ht,i=mt[r]===(n^gt)||mt[r^pt]===(n^gt-1);return i&&(t=bt.get(e),t!==void 0)?(yt.set(e,t),t):(t=ft(e),i?(yt.set(e,t),++xt>ee&&(xt=0,bt=yt,yt=new Map,Ct())):(mt[r]=n^gt,++St>pt&&Ct()),t)},Et=e=>{let t=wG(e,0,e.length),n=(t&16383)+ht;return mt[n]===(t^gt)||mt[n^pt]===(t^gt-1)||(mt[n]=t^gt,++St>pt&&Ct(),!1)},Dt=ee===0?ft:bG?e=>{let t=yt.get(e);return t===void 0?Tt(e):t}:wt;return{merge:function(){return arguments.length===1&&typeof arguments[0]==`string`?Dt(arguments[0]):Dt(OG.apply(null,arguments))},mergeString:Dt,seenBefore:ee===0?()=>!1:Et,mergeUncached:ft}},EG=(e,t)=>{if(!e)return``;if(typeof e==`string`)return e;let n=``;if(typeof e.length==`number`&&(!t||Array.isArray(e))){let r=e;for(let e=0;e<r.length;e++){let i=r[e];if(!i)continue;let a=typeof i==`string`?i:EG(i,t);a&&(n&&(n+=` `),n+=a)}return n}if(t){if(typeof e==`number`)return``+e;if(typeof e==`object`)for(let t in e)e[t]&&(n&&(n+=` `),n+=t)}return n},DG=(e,t)=>{let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(!i)continue;let a=typeof i==`string`?i:EG(i,t);a&&(n&&(n+=` `),n+=a)}return n},OG=function(){return DG(arguments,!1)},kG=(e,t)=>{let n=t===void 0?()=>!0:t.seenBefore,r=t===void 0?e:t.mergeUncached,i=new Map,a=new Map,o=0,s=null,c=(e,t,n,r)=>{let i=0;if(t){if(t!==e.a0)return!1;i=1}if(n){if(n!==(i===0?e.a0:e.a1))return!1;i++}if(r){if(r!==(i===0?e.a0:i===1?e.a1:e.a2))return!1;i++}return i===e.t},l=(e,t)=>{let n=e.a,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i){if(i!==n[r])return!1;r++}}return r===e.t},u=(t,c)=>{let u=t.length,d=s===null?null:s.n;if(!c){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let f=``,p=-1,m=0,h=!1;for(let e=0;e<u;e++){let n=t[e];if(n){if(typeof n!=`string`){if(n=t[e]=EG(n,!0),!n)continue;h=!0}p<0&&(f=n,p=e),m++}}if(m===0)return``;if(m===1)return e(f);if(h){if(d!==null&&l(d,t))return s=d,d.r;if(s!==null&&s!==d&&l(s,t))return s.r}let g=i.get(f);g===void 0&&(g=a.get(f),g!==void 0&&i.set(f,g));let _=null;if(g!==void 0)outer:for(let e=0;e<g.length;e++){let n=g[e];if(n.t!==m)continue;let r=n.a,i=1;for(let e=p+1;e<u;e++){let n=t[e];if(n&&n!==r[i++])continue outer}_=n;break}if(_===null){let s=f,c=[f];for(let e=p+1;e<u;e++){let n=t[e];n&&(s+=` `+n,c.push(n))}if(!n(s))return r(s);_={r:e(s),t:c.length,a0:c[0],a1:c[1],a2:c[2]??``,a:c,n:null},g===void 0&&i.set(f,g=[]),g.length>=256&&g.shift(),g.push(_),++o>1e3&&(o=0,a=i,i=new Map)}return s!==null&&s!==_&&(s.n=_),s=_,_.r},d=t=>Array.isArray(t)?u(t.slice(),!1):e(EG(t,!0));return function(t,n,r){let i=arguments.length;if((i|1)==3){let e=s;if(e!==null){let i=e.n;if(i!==null&&c(i,t,n,r))return s=i,i.r;if(e!==i&&c(e,t,n,r))return e.r}return u([t,n,r],!0)}if(i===1)return typeof t==`string`?e(t):d(t);let a=s;if(a!==null){let e=a.n;if(e!==null){let t=e.a,n=0,r=!0;for(let e=0;e<i;e++){let i=arguments[e];if(i){if(i!==t[n]){r=!1;break}n++}}if(r&&n===e.t)return s=e,e.r}if(a!==e){let e=a.a,t=0,n=!0;for(let r=0;r<i;r++){let i=arguments[r];if(i){if(i!==e[t]){n=!1;break}t++}}if(n&&t===a.t)return a.r}}let o=[];for(let e=0;e<i;e++)o.push(arguments[e]);return u(o,!0)}},AG=TG(yG),jG=kG(AG.mergeString,AG);AG.merge;var MG=Z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=GB({disabled:i,focusableWhenDisabled:a,native:o});return mB(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function NG(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=NG(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function PG(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=NG(e))&&(r&&(r+=` `),r+=t);return r}var FG=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,IG=PG,LG=(e,t)=>n=>{if(t?.variants==null)return IG(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=FG(t)||FG(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return IG(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},RG=LG(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,xs:`h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5`,sm:`h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,lg:`h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4`,icon:`size-7 [&_svg:not([class*='size-'])]:size-3.5`,"icon-xs":`size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5`,"icon-sm":`size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-lg":`size-8 [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`,size:`default`}});function zG({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Q.jsx)(MG,{"data-slot":`button`,className:jG(RG({variant:t,size:n,className:e})),...r})}var BG=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function VG(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:BG(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var HG=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},UG=e=>{let t=HG(e);return t.charAt(0).toUpperCase()+t.slice(1)},WG=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),GG={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function KG(e){return e!=null}function qG(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??GG.width,a=e.size??e.height??GG.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?WG(...c):WG(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??GG[`stroke-width`])*Number(e.size??e.width??GG.width)/Number(t.size??t.width??GG.width):t.strokeWidth??GG[`stroke-width`];return[`svg`,{...Object.entries(GG).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&KG(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&KG(t.width)&&{[r(`width`)]:t.width},...`height`in t&&KG(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function JG(e,t={}){return qG(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var YG=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},XG=(0,Z.createContext)({}),ZG=()=>(0,Z.useContext)(XG),QG=(0,Z.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=ZG()??{},y=!!c||YG(d),[b,x,S=[]]=JG(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:WG(v,s),hasA11yProp:y,attributes:d});return(0,Z.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,Z.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function $G(e,t=[],n=[]){let r=typeof e==`string`?VG(e,t,n):e,i=(0,Z.forwardRef)(({className:e,...t},n)=>(0,Z.createElement)(QG,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=UG(r.name)),i}var eK={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};eK.node;var tK=$G(eK),nK={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};nK.node;var rK=$G(nK),iK={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};iK.node;var aK=$G(iK),oK={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};oK.node;var sK=$G(oK),cK={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};cK.node;var lK=$G(cK),uK={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};uK.node;var dK=$G(uK),fK={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};fK.node;var pK=$G(fK),mK={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};mK.node;var hK=$G(mK),gK={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};gK.node;var _K=$G(gK),vK={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};vK.node;var yK=$G(vK),bK={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};bK.node;var xK=$G(bK),SK={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};SK.node;var CK=$G(SK),wK={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};wK.node;var TK=$G(wK),EK={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};EK.node;var DK=$G(EK),OK={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};OK.node;var kK=$G(OK),AK={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};AK.node;var jK=$G(AK),MK={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};MK.node;var NK=$G(MK),PK={name:`panel-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]],aliases:[`sidebar`]};PK.node;var FK=$G(PK),IK={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};IK.node;var LK=$G(IK),RK={name:`server-off`,size:24,node:[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};RK.node;var zK=$G(RK),BK={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};BK.node;var VK=$G(BK),HK={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};HK.node;var UK=$G(HK),WK={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};WK.node;var GK=$G(WK),KK={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};KK.node;var qK=$G(KK),JK={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};JK.node;var YK=$G(JK),XK={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};XK.node;var ZK=$G(XK),QK=Z.createContext(void 0);function $K(e){let t=Z.useContext(QK);if(t===void 0&&!e)throw Error(wI(72));return t}var eq=class extends KI{setState(e){}update(e){}set(e,t){}notifyAll(){}},tq={...UU,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},nq=class extends KI{constructor(e,t,n){let r=new IU;super(rq(e,r,t,n),iq(r),tq)}setOpen=(e,t)=>{AU(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,dV(YB,e))}};function rq(e,t,n,r=!1){return{...LU(t,n,r),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function iq(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var aq=jI(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=wU((e,t)=>new nq({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),MU(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=NU(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Z.useRef(null);xI(()=>{m&&t&&p.setOpen(!1,dV(oV))},[m,t,p]),xI(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),xI(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Z.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,dV(lV))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,Q.jsxs)(QK.Provider,{value:p,children:[l&&(0,Q.jsx)(TU,{handle:l,store:p}),T&&(0,Q.jsx)(oq,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function oq({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=mH(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=dH(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Z.useMemo(()=>eB(a.reference,i.reference),[a.reference,i.reference]);return PU(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??_I}),null}function sq(e){return BB(e,`base-ui`)}var cq=Z.createContext(void 0);function lq(){return Z.useContext(cq)}var uq=`data-base-ui-tooltip-trigger`;function dq(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(QI(n))return n}}let t=e.target;return QI(t)?t:null}function fq(e){let t=e;for(;t;){let e=t.closest(`[${uq}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&QI(n.host)?n.host:null}return null}var pq=MI(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=$K(!0),m=WU(a)??p;if(!m)throw Error(wI(82));let h=sq(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Z.useRef(null),b=u??0,{registerTrigger:x,isMountedByThisTrigger:S}=jU(h,y,m,{payload:o,closeOnClick:l,closeDelay:b}),C=lq(),{activeIdRef:w,delayRef:T,isInstantPhase:E,hasProvider:D}=kV(v,{open:_}),O=eW(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=yV(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Z.useRef(!1),F=DL(),I=Z.useRef(void 0);function L(){return D&&w.current!=null?0:c??C??600}function R(e){let t=y.current;if(!t||!e)return!1;let n=fq(e);return n!==null&&n!==t&&UL(t,n)}function ee(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let z=rW(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?bW():null,restMs:L,delay(){return u==null&&D?{close:SV(T.current,`close`)}:{close:b}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),te=YU(v,{enabled:!A}).reference,ne=e=>{let t=P.current,n=dq(e),r=ee(n),i=y.current,a=i&&n&&UL(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`)m.setOpen(!1,dV(XB,e));else if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&jR(I.current)){let t=()=>{P.current||j.current||m.select(`open`)||m.setOpen(!0,dV(XB,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},re=m.useState(`triggerProps`,S);return mB(`button`,e,{state:{open:_},ref:[t,x,y],props:[z,te,S||M!==`none`?re:void 0,{onMouseOver(e){ne(e.nativeEvent)},onFocus(e){R(dq(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[gR]:A?``:void 0,[uq]:A?void 0:``},f],stateAttributesMapping:fR})}),mq=Z.createContext(void 0);function hq(){let e=Z.useContext(mq);if(e===void 0)throw Error(wI(70));return e}var gq=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return $K().useState(`mounted`)||n?(0,Q.jsx)(mq.Provider,{value:n,children:(0,Q.jsx)(vV,{ref:t,...r})}):null}),_q=Z.createContext(void 0);function vq(){let e=Z.useContext(_q);if(e===void 0)throw Error(wI(71));return e}var yq=Z.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=PB,style:g,..._}=e,v=$K(),y=hq(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=IW({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=BW(e,Z.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,Q.jsx)(_q.Provider,{value:D,children:O})}),bq=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=$K(),{side:s,align:c}=vq(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);EB({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),tW(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return mB(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[SU,f,zW(d),a],stateAttributesMapping:hR})}),xq=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=$K(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=vq();return mB(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:mR})}),Sq=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Z.useMemo(()=>({open:t,close:n}),[t,n]);return(0,Q.jsx)(cq.Provider,{value:t,children:(0,Q.jsx)(OV,{delay:i,timeoutMs:r,children:e.children})})};function Cq(e){let[t,n]=Z.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function wq({delay:e=0,...t}){return(0,Q.jsx)(Sq,{"data-slot":`tooltip-provider`,delay:e,...t})}function Tq({...e}){return(0,Q.jsx)(aq,{"data-slot":`tooltip`,...e})}function Eq({...e}){return(0,Q.jsx)(pq,{"data-slot":`tooltip-trigger`,...e})}function Dq({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,Q.jsx)(gq,{children:(0,Q.jsx)(yq,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,Q.jsxs)(bq,{"data-slot":`tooltip-content`,className:jG(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,Q.jsx)(xq,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Oq=new Set;function kq(e){return Oq.add(e),()=>Oq.delete(e)}function Aq(e){for(let t of[...Oq])t(e)}function jq(e,t,n=!0){let r=()=>Aq({title:`Copied ${t}`,...n?{description:e}:{},type:`success`}),i=()=>Aq({title:`Could not copy ${t}`,...n?{description:e}:{},type:`error`});window.isSecureContext&&navigator.clipboard!==null&&navigator.clipboard!==void 0?navigator.clipboard.writeText(e).then(r,()=>{Mq(e)?r():i()}):Mq(e)?r():i()}function Mq(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.append(t),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var Nq=X(e=>Ck(t=>{window.addEventListener(`focus`,e),window.addEventListener(`online`,e),window.addEventListener(`visibilitychange`,e),t.addFinalizer(()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`online`,e),window.removeEventListener(`visibilitychange`,e)})}));function Pq(e){let t=(0,VW.c)(2),n;t[0]===e?n=t[1]:(n=Nq(e),t[0]=e,t[1]=n),aI(n)}var Fq=`~effect/Cache`,Iq=(e,t)=>Us(n=>{let r=Object.create(Rq);return r.lookup=t=>zs(e(t),e=>Rr(n,e)),r.map=nne(),r.capacity=t.capacity,r.timeToLive=t.timeToLive?(e,n)=>Ni(t.timeToLive(e,n)):zq,Do(r)}),Lq=e=>Iq(e.lookup,{...e,timeToLive:e.timeToLive===void 0?zq:()=>e.timeToLive}),Rq={...wt,[Fq]:Fq,toJSON(){return{_id:`Cache`,capacity:this.capacity,map:this.map}}},zq=(e,t)=>Wi,Bq=a(2,(e,t)=>an(n=>{let r=ep(e.map,t);if(Yn(r)&&(rp(e.map,t),!Uq(r.value,n)))return np(e.map,t,r.value),r.value.await(n);let i=new Vq(n,e.lookup(t));i.onInterrupt=()=>Hq(e,t,i);let a=!1;i.fiber.addObserver(r=>{if(i.onInterrupt=void 0,js(r)){Hq(e,t,i);return}let o=e.timeToLive(r,t);Hi(o)?(a=!0,Hq(e,t,i)):Vi(o)&&(i.expiresAt=n.getRef(Pl).currentTimeMillisUnsafe()+Qi(o))});let o=i.fiber.pollUnsafe();return a||o!==void 0&&js(o)||np(e.map,t,i),Number.isFinite(e.capacity)&&Wq(e),i.await(n)})),Vq=class{expiresAt;awaiters;fiber;onInterrupt;constructor(e,t){this.fiber=il(e,t,!0,!0),this.awaiters=0,this.expiresAt=void 0}await(e){return e===void 0?an(e=>this.await(e)):this.fiber.pollUnsafe()||(this.awaiters++,Vc(e,()=>(this.awaiters--,this.awaiters>0||this.fiber.pollUnsafe()?Lo:(this.onInterrupt?.(),wo(this.fiber)))),So(this.fiber))}},Hq=(e,t,n)=>{let r=ep(e.map,t);Yn(r)&&r.value===n&&rp(e.map,t)},Uq=(e,t)=>e.expiresAt!==void 0&&t.getRef(Pl).currentTimeMillisUnsafe()>=e.expiresAt,Wq=e=>{let t=ip(e.map)-e.capacity;if(!(t<=0)){for(let[n]of e.map)if(rp(e.map,n),t--,t===0)return}},Gq=a(2,(e,t)=>Ao(()=>{rp(e.map,t)})),Kq=`~effect/FiberMap`,qq=e=>F(e,Kq),Jq={[Kq]:Kq,[Symbol.iterator](){return this.state._tag===`Closed`?ei():this.state.backing[Symbol.iterator]()},...wt,toJSON(){return{_id:`FiberMap`,state:this.state}}},Yq=(e,t)=>{let n=Object.create(Jq);return n.state={_tag:`Open`,backing:e,fibers:new Set},n.deferred=t,n},Xq=()=>lm(V(()=>Yq($f(),Vu())),e=>fp(()=>{let t=e.state;return t._tag===`Closed`?pp:(e.state={_tag:`Closed`},Yw(t.fibers).pipe(Zu(e.deferred)))})),Zq=-1,Qq=fa(ma(Fte,pa(Zq))),$q=a(e=>qq(e[0]),(e,t,n,r)=>{if(e.state._tag===`Closed`){n.interruptUnsafe(Zq);return}let i=ep(e.state.backing,t);if(i._tag===`Some`){if(i.value===n)return;if(r?.onlyIfMissing===!0){n.interruptUnsafe(Zq);return}}np(e.state.backing,t,n),e.state.fibers.add(n),i._tag===`Some`&&i.value.interruptUnsafe(Zq),n.addObserver(i=>{if(e.state._tag===`Closed`)return;e.state.fibers.delete(n);let a=ep(e.state.backing,t);Yn(a)&&n===a.value&&rp(e.state.backing,t),Ru(i)&&(r?.propagateInterruption===!0?!Qq(i.cause):!xu(i.cause))&&Xu(e.deferred,i)})}),eJ=a(2,(e,t)=>e.state._tag!==`Closed`&&ane(e.state.backing,t)),tJ=function(){let e;return()=>(e===void 0&&(e=Am(_m)),e)}(),nJ=e=>()=>Op($p(),t=>{let n=jm(t);return(t,r,i)=>{if(e.state._tag===`Closed`||i?.onlyIfMissing===!0&&eJ(e,t))return tJ();let a=n(r,i);return $q(e,t,a,i),a}}),rJ=`~effect/ManagedRuntime`,iJ=Br(`effect/ManagedRuntime/DisposingRuntimes`,{defaultValue:()=>new Set}),aJ=(e,t)=>{let n=t?.memoMap??vd(),r=nd(`sequential`),i=sd(r,`sequential`),a=sd(r,`parallel`),o=new WeakSet,s=new WeakSet,c={onFiberStart(e){o.add(e),s.has(e)||Zw(e,a)}},l=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{c.onFiberStart(t),e.onFiberStart(t)}:c.onFiberStart}:c,u,d,f=Sp(t=>(u||=Am(Ep(xd(e,n,i),e=>V(()=>{p.cachedContext=e})),{scheduler:t.cache.scheduler,onFiberStart(e){o.add(e),Zw(e,a)}}),wp(Gw(u)))),p={[rJ]:rJ,memoMap:n,scope:r,contextEffect:f,cachedContext:void 0,context(){return p.cachedContext===void 0?Pm(p.contextEffect):Promise.resolve(p.cachedContext)},dispose(){return Pm(p.disposeEffect)},[Symbol.asyncDispose](){return p.dispose()},disposeEffect:Sp(e=>{if(d!==void 0){if(e.getRef(iJ).has(p))return pp;for(let t=e;t;t=t._parent)if(o.has(t))return pp;return Uu(d)}Kc(e);let t=d=Vu();for(let t=e;t;t=t._parent)s.add(t),Nc(a,t);return p.contextEffect=yp(`ManagedRuntime disposed`),p.cachedContext=void 0,cd(p.scope,Iu).pipe(am(iJ,new Set(e.getRef(iJ)).add(p)),fm(Wu(t,Iu)))}),runFork(e,t){return p.cachedContext===void 0?Am(oJ(p,e),l(t)):jm(p.cachedContext)(e,l(t))},runCallback(e,t){return p.cachedContext===void 0?Nm(oJ(p,e),l(t)):Mm(p.cachedContext)(e,l(t))},runSyncExit(e){return p.cachedContext===void 0?Bm(oJ(p,e)):Vm(p.cachedContext)(e)},runSync(e){return p.cachedContext===void 0?Rm(oJ(p,e)):zm(p.cachedContext)(e)},runPromiseExit(e,t){return p.cachedContext===void 0?Im(oJ(p,e),l(t)):Lm(p.cachedContext)(e,l(t))},runPromise(e,t){return p.cachedContext===void 0?Pm(oJ(p,e),l(t)):Fm(p.cachedContext)(e,l(t))}};return p};function oJ(e,t){return Cp(e.contextEffect,e=>nm(t,e))}var sJ=`~effect/SynchronizedRef`,cJ={...wt,[sJ]:sJ,toJSON(){return{_id:`SynchronizedRef`,value:this.backing.ref.current}}},lJ=e=>{let t=Object.create(cJ);return t.semaphore=XT(1),t.backing=$A(e),t},uJ=e=>V(()=>lJ(e)),dJ=e=>e.backing.ref.current,fJ=a(2,(e,t)=>e.semaphore.withPermit(ij(e.backing,t))),pJ=a(2,(e,t)=>e.semaphore.withPermit(fp(()=>Op(t(dJ(e)),([t,n])=>(e.backing.ref.current=n,t))))),mJ=a(2,(e,t)=>e.semaphore.withPermit(nj(e.backing,t))),hJ=a(2,(e,t)=>e.semaphore.withPermit(aj(e.backing,t))),gJ=class extends dr()(`@porcelain/client/EnvironmentStorage`){},_J=class extends dr()(`@porcelain/client/AccessPlatform`){},vJ=class extends Y()(`WriteNotSentError`,{cause:qS}){get message(){return`An earlier change failed, so this one was not sent.`}},yJ=class extends dr()(`@porcelain/client/WriteQueue`){static make=H(function*(){let e=yield*eE(1),t=yield*ej({pending:0,failure:Kn()});return{enqueue:n=>xm(r=>H(function*(){return yield*aj(t,e=>({...e,pending:e.pending+1})),yield*xp,yield*e.withPermit(H(function*(){let e=yield*tj(t),i=yield*Dp(r(Yn(e.failure)?U(new vJ({cause:e.failure.value})):n));return yield*aj(t,e=>{let t=e.pending-1,n=Ru(i)?wu(i.cause):void 0;return{pending:t,failure:t===0?Kn():Qn(e.failure,()=>Ru(i)?qn(n instanceof vJ?n.cause:n):Kn())}}),yield*Lu(i)?B(i.value):_p(i.cause)}))}))}})},bJ=class e extends dr()(`@porcelain/client/WriteQueues`){static layer=kd(e,H(function*(){let e=yield*sD({lookup:e=>H(function*(){return{scope:yield*od(yield*ed,`parallel`),queue:yield*yJ.make}}),idleTimeToLive:0});return{run:(t,n)=>sm(H(function*(){let{scope:r,queue:i}=yield*cD(e,JSON.stringify(t)),a=yield*Dm(i.enqueue(n),r,{startImmediately:!0});return yield*Kw(a).pipe(fm(Jw(a)))}))}}))},xJ=class extends Y()(`ConnectionError`,{message:K,cause:HS(qS)}){},SJ=Um(`persistedState`)(function*(e){let t=CP({...e.initial,status:`loading`,error:void 0}),n=yield*yJ.make;return{state:t,load:()=>n.enqueue(H(function*(){t.update(e=>({...e,status:`loading`,error:void 0})),yield*e.read().pipe(Qp({onSuccess:e=>V(()=>t.set({...e,status:`ready`,error:void 0})),onFailure:()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.readFailed})))}),bm)})),write:r=>n.enqueue(H(function*(){if(t.value.status!==`ready`)return yield*U(new xJ({message:e.messages.beforeRead}));let n=yield*r(t.value);yield*e.write(n).pipe(Fp(({cause:t})=>new xJ({message:e.messages.writeFailed,cause:t})),Lp(()=>V(()=>t.update(t=>({...t,status:`unreadable`,error:e.messages.writeFailed})))),Ep(()=>V(()=>t.update(e=>({...e,...n})))),bm)}))}}),CJ=1024;1024*CJ;var wJ=16*CJ,TJ=2e3,EJ=2e3,DJ=4096,OJ=1e3,kJ=1e4,AJ=kJ,jJ=1024,MJ=5e4,NJ=oC([`content_changed`,`file_too_large`,`unsupported_text`,`worktree_changed`]),PJ=q({statusCode:XS.check(DC()).check(wC(400)).check(TC(599)),error:K,message:K,code:W(NJ)}),FJ=K.check(_C(e=>qr(PS(HC)(e)),{expected:`an absolute URL`})),IJ=K.check(yC(/^\d{4}-\d{2}-\d{2}T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?Z$/),_C(e=>{let t=PS(iw)(e);return qr(t)&&Cg(t.success)===e.split(`T`)[0]},{expected:`a valid UTC timestamp`})),LJ=K.check(bC()),RJ=K.check(yC(RegExp(`^[0-9a-f]{32}$`)));function zJ(e){return sC(e).pipe(pC(cC(WS(e)),Fy({decode:e=>e===null?void 0:e,encode:e=>e===void 0?null:e})))}var BJ=q({worktreeId:RJ}),VJ=`~effect/http-api/HttpApiMiddleware`,HJ=`~effect/http-api/HttpApiMiddleware/Security`,UJ=()=>(e,t)=>{let n=ct(),r;n!==0&&(lt(2),r=new globalThis.Error,lt(n));class i extends dr()(e){}let a=i;if(Object.defineProperty(i,"stack",{get(){return r?.stack}}),a[VJ]=VJ,a.error=WJ(t?.error),a.requiredForClient=t?.requiredForClient??!1,t?.security!==void 0){if(Object.keys(t.security).length===0)throw Error(`HttpApiMiddleware.Service: security object must not be empty`);a[HJ]=HJ,a.security=t.security}return a};function WJ(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var GJ=`~effect/http-api/HttpApiGroup`,KJ={[GJ]:GJ,add(...e){let t={...this.endpoints};for(let n of e)ft(t,n.identifier,n);return JJ({...qJ(this),endpoints:t})},prefix(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.prefix(e))})},middleware(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return JJ({...qJ(this),annotations:Rr(this.annotations,e)})},annotate(e,t){return JJ({...qJ(this),annotations:Or(this.annotations,e,t)})},annotateEndpointsMerge(e){return JJ({...qJ(this),endpoints:ni(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return JJ({...qJ(this),endpoints:ni(this.endpoints,n=>n.annotate(e,t))})},pipe(){return n(this,arguments)}},qJ=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),JJ=e=>{function t(){}return Object.setPrototypeOf(t,KJ),t.key=`effect/http-api/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},YJ=(e,t)=>JJ({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:Tr()}),XJ=aC([q({kind:G(`owner`)}),q({kind:G(`device`),deviceId:K.check(bC())})]),ZJ=`/open/pair`,QJ=`/pair`;function $J(e){return e.replace(/\/$/,``)===ZJ}function eY(e){let t=t=>[`c=${encodeURIComponent(e.code)}`,`e=${encodeURIComponent(e.environmentId)}`,...t?[`a=${encodeURIComponent(e.addresses.join(`,`))}`]:[]].join(`&`);return e.appOrigin===void 0?`${e.addresses[0]??``}${QJ}#${t(e.addresses.length>1)}`:`${e.appOrigin}${ZJ}#${t(!0)}`}function tY(e){let t=e.indexOf(`#`);if(t===-1)return;let n=e.slice(0,t),r;try{r=new Map(e.slice(t+1).split(`&`).map(e=>{let[t=``,n=``]=e.split(`=`);return[t,decodeURIComponent(n)]}))}catch{return}let i=(r.get(`a`)??``).split(`,`).filter(e=>e!==``),a={code:r.get(`c`)??``,environmentId:r.get(`e`)??``};if(n.endsWith(`/open/pair`))return i.length===0?void 0:{...a,addresses:i,appOrigin:n.slice(0,-10)};if(n.endsWith(QJ))return{...a,addresses:i.length===0?[n.slice(0,-5)]:i}}var nY=K,rY=q({addresses:J(K),code:K,environmentId:K,appOrigin:W(K)}),iY=nY.pipe(pC(rY,Py({decode:e=>{let t=tY(e);return t===void 0?U(new zv({message:`Expected a Porcelain pairing link`})):B(t)},encode:e=>B(eY(e))}))),aY=q({code:K.check(kC(1)).check(jC(200)),platform:K.check(kC(1)).check(jC(120)),label:W(K.check(kC(1)).check(jC(80)))}),oY=q({device:q({id:K,label:K,platform:K,createdAt:K}),credential:W(K)}),sY=q({id:K,label:K,addresses:J(K),createdAt:K,expiresAt:K,trusted:ZS,canManageSharing:W(ZS)}),cY=oC([`loopback`,`lan`,`tailnet`,`tunnel`]),lY=q({id:K,label:K,platform:K,createdAt:K,lastSeenAt:K,lastSeenAddress:W(K),route:cY,routeInferred:W(ZS),trusted:ZS,canManageSharing:W(ZS),canEditWaysIn:ZS,current:W(ZS)}),uY=q({canEditIdentity:W(ZS),grants:J(sY),devices:J(lY)}),dY=q({labels:J(K.check(kC(1)).check(jC(80))).check(kC(1)).check(jC(20)),addresses:J(FJ).check(kC(1)).check(jC(10)),trusted:W(ZS),canManageSharing:W(ZS)}),fY=q({grants:J(q({grant:sY,code:K,link:iY}))}),pY=q({id:K.check(kC(1))}),mY=q({revoked:ZS,kind:W(oC([`grant`,`device`]))}),hY=q({id:K.check(kC(1)),trusted:ZS}),gY=q({id:K,trusted:ZS}),_Y=q({id:K.check(kC(1)),allowed:ZS}),vY=q({id:K,allowed:ZS}),yY=q({id:K.check(kC(1)),allowed:ZS}),bY=q({id:K,allowed:ZS}),xY=YS;q({route:cY,local:ZS}),dr()(`@porcelain/http/RequestConnection`);var SY=class extends UJ()(`@porcelain/http/ClientRequest`){};dr()(`@porcelain/http/RequestCaller`);var CY=class extends UJ()(`@porcelain/http/PairedRequest`){},wY=oC([`low`,`medium`,`high`,`xhigh`,`max`]),TY=oC([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]),EY=TY,DY=K,OY=aC([q({provider:G(`claude`),model:DY,effort:wY}),q({provider:G(`codex`),model:DY,effort:TY})]),kY=q({provider:oC([`claude`,`codex`]),model:DY,label:K,efforts:J(EY),defaultEffort:EY}),AY=q({kind:oC([`signed_out`,`agent_not_installed`,`timed_out`,`unusable_output`,`other`]),message:K}),jY=q({outcome:oC([`needs_you`,`worth_knowing`,`nothing`]),title:K,summary:K,growth:J(q({change:oC([`added`,`changed`,`removed`]),what:K,note:K})),stops:J(q({title:K,explanation:K,attention:W(q({kind:oC([`tradeoff`,`contract`,`product`,`risk`,`accessibility`]),note:K,question:K})),excerpts:J(q({path:K,side:oC([`new`,`old`]),start:OC,end:OC,caption:K})),evidence:J(q({assetId:K,shows:K})),files:J(q({path:K,note:K}))})),onlyInTranscript:J(q({point:K,answer:K})),stillUnclear:J(K),checks:W(K)}),MY=q({stage:oC([`queued`,`evidence`,`transcript`,`writing`,`validating`,`ready`,`failed`]),at:K,message:K}),NY=oC([`current`,`changed`,`unknown`]),PY=q({id:K,projectId:K,worktreeId:K,pullRequestNumber:W(OC),pullRequestRepository:W(q({owner:K,repo:K})),evidenceUnavailable:W(oC([`head_mismatch`,`github_account`,`github_unavailable`])),baseOid:K,headOid:K,contentTreeOid:K,baseRef:K,includesUncommitted:ZS,branch:W(K),writer:OY,sessionId:W(K),createdAt:K,progress:W(J(MY)),state:aC([q({status:G(`queued`)}),q({status:G(`running`)}),q({status:G(`ready`),content:jY,writtenAt:K,durationMs:XS,costUsd:W(XS)}),q({status:G(`failed`),failure:AY})])});q({run:PY,worktreePath:K,patch:K,omittedFiles:W(J(K)),files:J(q({path:K,oldPath:W(K),hunks:J(q({oldStart:OC,oldEnd:OC,newStart:OC,newEnd:OC}))}))});var FY=q({mode:oC([`manual`,`automatic`]),writer:W(OY)}),IY=aC([q({status:G(`answering`)}),q({status:G(`answered`),text:K,answeredAt:K,durationMs:XS,costUsd:W(XS)}),q({status:G(`failed`),failure:AY})]),LY=aC([q({status:G(`none`)}),q({status:G(`saved`)}),q({status:G(`posted`),url:K,postedAt:K})]),RY=class extends Y()(`WalkthroughFailedError`,{...AY.fields}){},zY=class extends Y()(`WalkthroughAssetNotFoundError`,{}){get message(){return`Walkthrough evidence asset not found`}},BY=class extends Y()(`WalkthroughMessageNotFoundError`,{}){get message(){return`Walkthrough message not found`}},VY=class extends Y()(`WalkthroughTargetNotFoundError`,{}){get message(){return`Finished walkthrough or step not found`}},HY=class extends Y()(`WalkthroughPostFailedError`,{message:K}){},UY=class extends Y()(`WalkthroughRepositoryChangedError`,{message:K}){},WY={onExcessProperty:`error`},GY=dae(`porcelain`).annotate(nP,WY).annotate(rP,WY).annotate(iP,WY),KY=class extends Y()(`InvalidLineRangeError`,{}){get message(){return`The line range ends before it starts`}},qY=class extends Y()(`WorktreeChangedError`,{}){get message(){return`Worktree changed during inspection`}},JY=class extends Y()(`WorktreeNotFoundError`,{}){get message(){return`Worktree not found`}},YY=class extends Y()(`RepositoryUnavailableError`,{}){get message(){return`Repository could not be inspected`}},XY=class extends Y()(`FilePreferenceLimitError`,{}){get message(){return`File preference limit reached`}},ZY=class extends Y()(`FolderNotFoundError`,{}){get message(){return`Path not found`}},QY=class extends Y()(`FolderNotReadableError`,{}){get message(){return`Path could not be read`}};Y()(`NoWorktreeAtPathError`,{});var $Y=class extends Y()(`ProjectNotFoundError`,{}){get message(){return`Project not found`}},eX=class extends Y()(`UnsupportedFolderNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},tX=class extends Y()(`WorktreeUnavailableError`,{}){get message(){return`Worktree is unavailable`}},nX=class extends Y()(`BranchArchiveRefusedError`,{message:K}){},rX=Br(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),iX=Br(`effect/http/FetchHttpClient/StreamBodyFallback`,{defaultValue:()=>`error`}),aX=class extends dr()(`effect/http/FetchHttpClient/RequestInit`){},oX,sX=()=>{try{let e=!1,t=new ReadableStream,n=new Request(`https://example.com`,{method:`POST`,body:t,get duplex(){return e=!0,`half`}});return(e||n.body===t)&&!n.headers.has(`Content-Type`)}catch{return!1}},cX=yM(B(fM((e,t,n,r)=>{if(e.headers.upgrade!==void 0)return U(new cj({reason:new pj({request:e,description:`fetch cannot send an HTTP upgrade request`})}));let i=r.getRef(rX),a=Ar(r.context,aX)??{},o=a.headers?I_(M_(a.headers),e.headers):e.headers;o[`content-length`]&&(o=L_(o,`content-length`));let s,c=V(()=>s?.abort()),l=r=>Op(up({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:typeof ReadableStream<`u`&&r instanceof ReadableStream?`half`:void 0,signal:s?AbortSignal.any([n,s.signal]):n}),catch:t=>new cj({reason:new pj({request:e,cause:t})})}),t=>{let n=eM(e,t);return s?(t.body===null&&s.abort(),Object.create(n,{...Object.fromEntries([`arrayBuffer`,`text`,`json`,`formData`,`urlParamsBody`].map(e=>[e,{get:()=>fm(n[e],c)}])),stream:{get:()=>eO(n.stream,c)}})):n}).pipe(pm(()=>c));switch(e.body._tag){case`Raw`:case`Uint8Array`:return l(e.body.body);case`FormData`:return l(e.body.formData);case`Stream`:if(oX??=sX(),oX){s=new AbortController;let t=AbortSignal.any([n,s.signal]),r=hp(e=>{let n=()=>e(_m);if(t.aborted)n();else return t.addEventListener(`abort`,n,{once:!0}),V(()=>t.removeEventListener(`abort`,n))});return Cp(cO(QD(e.body.stream,r)),l)}return r.getRef(iX)===`error`?U(new cj({reason:new mj({request:e,description:`Streaming request bodies are not supported in this runtime`})})):oO(e.body.stream).pipe(Fp(t=>new cj({reason:new mj({request:e,cause:t})})),Cp(l))}return l(void 0)}))),lX={BadRequest:`Bad Request`,Unauthorized:`Unauthorized`,Forbidden:`Forbidden`,PayloadTooLarge:`Payload Too Large`,TooManyRequests:`Too Many Requests`,BadGateway:`Bad Gateway`,ServiceUnavailable:`Service Unavailable`,NotFound:`Not Found`,Conflict:`Conflict`,UnprocessableEntity:`Unprocessable Entity`},uX=class extends Y()(`HttpFailureMessage`,{name:K,message:K}){};function $(e,t,n={}){let r=typeof n.message==`object`?void 0:n.message??new e().message,i={statusCode:rN(t),error:lX[t],...n.code===void 0?{}:{code:n.code}};return q({statusCode:G(i.statusCode),error:G(i.error),message:r===void 0?K:G(r),code:HS(n.code===void 0?KS:G(n.code))}).pipe(pC(TS(t=>t instanceof e||t instanceof uX&&t.name===e.name),Fy({decode:t=>r===void 0?new uX({name:e.name,message:t.message}):new e,encode:e=>({...i,message:r??e.message})})),aN(t))}var dX=[$(qY,`Conflict`,{code:`worktree_changed`,message:`Refresh status and retry inspection`}),$(JY,`NotFound`),$($Y,`NotFound`),$(tX,`UnprocessableEntity`,{message:`Repository could not be inspected`})];Y()(`GitActionRejectedError`,{reason:oC([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`]),detail:W(K),cause:W(qS)}),Y()(`RepositoryIdentityMismatchError`,{});var fX=class extends Error{name=`GitError`},pX=class extends fX{name=`HistorySnapshotUnavailableError`;constructor(e){super(`History snapshot is unavailable`,e)}},mX=class extends fX{name=`HistoryWorktreeUnavailableError`;constructor(e){super(`Worktree is unavailable`,e)}},hX=class extends fX{name=`InvalidHistoryRequestError`;constructor(e){super(`Invalid history request`,e)}},gX=class extends fX{name=`ReadLimitExceededError`;constructor(e){super(`History read exceeds its limit`,e)}},_X=class extends fX{name=`UnsupportedHistoryDataError`;constructor(e){super(`History contains unsupported data`,e)}},vX=class extends Y()(`GitTimeoutError`,{}){get message(){return`Git command exceeded its deadline`}},yX=class extends fX{name=`InspectionLimitError`;constructor(e){super(`Git inspection exceeds its limit`,e)}},bX=class extends fX{name=`InvalidGitDiffError`;constructor(){super(`Invalid Git diff output`)}},xX=class extends fX{name=`InvalidGitStatusError`;constructor(){super(`Invalid Git status output`)}},SX=class extends fX{name=`UnsupportedGitFiltersError`;constructor(){super(`Git conversion filters are unsupported for worktree inspection`)}},CX=class extends fX{name=`UnsupportedPathEncodingError`;constructor(e){super(`Git paths require valid UTF-8`,e)}};Y()(`GitCommandError`,{checkout:K,args:J(K),exitCode:cC(XS),stderr:K,cause:W(qS)}),Y()(`GitFilesystemError`,{cause:qS}),Y()(`UnsupportedFilesystemIdentityError`,{}),Y()(`UnsupportedRepositoryError`,{});var wX=[$(pX,`UnprocessableEntity`,{message:`History snapshot is unavailable; start a new listing`}),$(mX,`UnprocessableEntity`,{message:`Worktree is unavailable`}),$(hX,`BadRequest`),$(gX,`UnprocessableEntity`,{message:`History read exceeds its limit`}),$(_X,`UnprocessableEntity`,{message:`History contains unsupported data`}),$(vX,`ServiceUnavailable`,{message:`Operation unavailable`}),$(yX,`PayloadTooLarge`,{message:`Git inspection exceeds its limit`}),$(bX,`BadGateway`,{message:`Git produced output that could not be read`}),$(xX,`BadGateway`,{message:`Git produced output that could not be read`}),$(SX,`UnprocessableEntity`,{message:`Git conversion filters are unsupported for worktree inspection`}),$(CX,`UnprocessableEntity`,{message:`Git paths require valid UTF-8`}),$(YY,`UnprocessableEntity`,{message:`Repository could not be inspected`})],TX=8e3,EX=aC([q({kind:G(`walkthrough`)}),q({kind:G(`stop`),title:K.check(kC(1))})]),DX=q({...BJ.fields,runId:K.check(kC(1))}),OX=q({...DX.fields,messageId:K.check(kC(1))}),kX=q({writer:W(OY),anchor:EX,text:K.check(zre(),kC(1),jC(TX))}),AX=q({saved:ZS}),jX={messageId:W(K.check(kC(1)))},MX=q({...IY.members[1].fields,costUsd:zJ(XS)}),NX=q({runId:K,anchor:EX,messages:J(aC([q({author:G(`developer`),id:K,text:K,createdAt:K,post:LY}),q({author:G(`agent`),id:K,replyTo:K,createdAt:K,state:aC([q({status:G(`answering`)}),MX,q({status:G(`failed`),failure:AY})])})]))}),PX=q({runId:zJ(K),pullRequestNumber:zJ(OC),conversations:J(NX)}),FX=q({outcome:aC([q({status:G(`nothing`)}),q({status:G(`posted`),url:K,notPosted:J(K)}),q({status:G(`brief`),text:K})]),view:PX}),IX=q({text:zJ(K)}),LX=q({...jY.fields,checks:zJ(K),stops:J(q({...jY.fields.stops.value.fields,attention:zJ(q({kind:oC([`tradeoff`,`contract`,`product`,`risk`,`accessibility`]),note:K,question:K}))}))}),RX=q({status:G(`ready`),content:LX,writtenAt:K,durationMs:XS,costUsd:zJ(XS)}),zX=q({...PY.fields,contentTreeOid:K,baseRef:K,includesUncommitted:ZS,pullRequestNumber:zJ(OC),sessionId:zJ(K),state:aC([q({status:G(`queued`)}),q({status:G(`running`)}),RX,PY.fields.state.members[3]])}),BX=q({...BJ.fields,runId:K,assetId:K}),VX=q({base:W(K),pullRequestNumber:W(OC.check(CC(0))),writer:W(OY)}),HX=q({walkthrough:zJ(zX),attempt:W(zX),freshness:NY}),UX=q({writer:OY,models:J(kY)}),WX=class extends GY.add(YJ(`walkthroughs`).add(KN(`readWalkthroughWriterSettings`,`/api/walkthrough-settings`,{disableCodecs:!0,success:UX}),JN(`saveDefaultWalkthroughWriter`,`/api/walkthrough-settings`,{disableCodecs:!0,payload:OY,success:OY}),qN(`startWalkthrough`,`/api/worktrees/:worktreeId/walkthrough`,{disableCodecs:!0,params:BJ,payload:VX,success:zX,error:[...dX,...wX,$(RY,`UnprocessableEntity`,{message:{fromError:!0}})]}),KN(`readWalkthrough`,`/api/worktrees/:worktreeId/walkthrough`,{disableCodecs:!0,params:BJ,success:HX,error:[...dX,...wX]}),KN(`readWalkthroughAsset`,`/api/worktrees/:worktreeId/walkthrough/:runId/assets/:assetId`,{disableCodecs:!0,params:BX,success:YC.pipe(Jie()),error:[...dX,$(zY,`NotFound`)]}),KN(`listWalkthroughConversations`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations`,{disableCodecs:!0,params:DX,success:PX,error:[...dX,$(VY,`NotFound`)]}),qN(`addWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages`,{disableCodecs:!0,params:DX,payload:kX,success:PX,error:[...dX,$(VY,`NotFound`)]}),qN(`retryWalkthroughAnswer`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/retry`,{disableCodecs:!0,params:OX,success:PX,error:[...dX,$(VY,`NotFound`),$(BY,`NotFound`)]}),JN(`saveWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/saved`,{disableCodecs:!0,params:OX,payload:AX,success:PX,error:[...dX,$(VY,`NotFound`),$(BY,`NotFound`)]}),qN(`postWalkthroughMessage`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/messages/:messageId/post`,{disableCodecs:!0,params:OX,success:FX,error:[...dX,$(VY,`NotFound`),$(BY,`NotFound`),$(HY,`BadGateway`,{message:{fromError:!0}}),$(UY,`Conflict`,{message:{fromError:!0}})]}),qN(`postSavedWalkthroughMessages`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/post-saved`,{disableCodecs:!0,params:DX,success:FX,error:[...dX,$(VY,`NotFound`),$(BY,`NotFound`),$(HY,`BadGateway`,{message:{fromError:!0}}),$(UY,`Conflict`,{message:{fromError:!0}})]}),KN(`readWalkthroughBrief`,`/api/worktrees/:worktreeId/walkthrough/:runId/conversations/brief`,{disableCodecs:!0,params:DX,query:jX,success:IX,error:[...dX,$(VY,`NotFound`),$(BY,`NotFound`)]})).middleware(CY)){},GX=class extends Y()(`InvalidDeviceDetailsError`,{}){get message(){return`The device name or platform is missing, too long, or contains control characters.`}},KX=class extends Y()(`InvalidPairingAddressError`,{}){get message(){return`This server does not answer at that address, so a link aimed there would not reach it.`}},qX=class extends Y()(`InvalidPairingError`,{}){get message(){return`This pairing link is not valid.`}},JX=class extends Y()(`MissingEnvironmentIdentityError`,{}){get message(){return`This server has no environment identity.`}};Y()(`TooManyPairingAttemptsError`,{});var YX=class extends Y()(`InvalidTunnelHostnameError`,{}){get message(){return`Enter the public hostname your Cloudflare tunnel serves, such as porcelain.example.com.`}},XX=class extends Y()(`MissingTunnelHostnameError`,{}){get message(){return`Cloudflare needs the public hostname your tunnel serves.`}},ZX=class extends Y()(`InvalidTailnetHostnameError`,{}){get message(){return`Enter this computer's Tailscale name, such as laptop.tail1234.ts.net.`}},QX=class extends Y()(`MissingTailnetHostnameError`,{}){get message(){return`Tailscale needs this computer's Tailscale name.`}},$X=class extends Y()(`NoLocalNetworkError`,{}){get message(){return`This computer is not on a local network right now, so there is no network to share on.`}},eZ=class extends Y()(`UnidentifiedLocalNetworkError`,{}){get message(){return`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known. Try again in a moment.`}},tZ=class extends Y()(`ServiceNotManagedError`,{}){get message(){return`Porcelain is not running as the installed service, so it cannot update itself`}},nZ=class extends Y()(`ServiceUpdateNotOfferedError`,{}){get message(){return`That version is not the newer version this server offers`}},rZ=class extends Y()(`ServiceUpdateRunningError`,{}){get message(){return`An update is already running`}},iZ=class extends Y()(`DeviceViewerRequiredError`,{}){get message(){return`A live ticket is issued to a paired device`}},aZ=class extends Y()(`TooManyLiveTicketsError`,{}){get message(){return`Too many live tickets are waiting to be used. Try again shortly.`}},oZ=class extends Y()(`DeviceNotFoundError`,{}){get message(){return`Device not found`}},sZ=class extends Y()(`UntrustedDeviceError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can update Porcelain`}},cZ=class extends Y()(`WaysInPermissionRequiredError`,{}){get message(){return`An owner must let this device edit ways in on the computer that runs Porcelain before it can see or change them`}},lZ=class extends Y()(`WaysInChangedError`,{}){get message(){return`The ways in changed since you last looked. Check them again, then save your change.`}},uZ=class extends Y()(`RemoteRouteInUseError`,{}){get message(){return`This device is connected through this way in, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}},dZ=class extends Y()(`ReviewGitSettingsTrustRequiredError`,{}){get message(){return`An owner must trust this device on the computer that runs Porcelain before it can change Reviews & Git settings`}},fZ=class extends Y()(`ReviewGitSettingsNotConfiguredError`,{}){get message(){return`Choose Reviews & Git settings for this computer before changing one of them`}},pZ=class extends Y()(`SharingManagementRequiredError`,{}){get message(){return`This device cannot manage sharing. Allow it from a device with sharing access.`}},mZ=class extends Y()(`PushRegistrationDeviceRequiredError`,{}){get message(){return`Notifications are registered by a paired device`}},hZ=$(JX,`ServiceUnavailable`,{message:`Operation unavailable`}),gZ=q({pullStrategy:oC([`merge`,`rebase`]),collapseSpecs:ZS,archiveDeleteWorktree:ZS,archiveDeleteLocalBranch:ZS,archiveDeleteRemoteBranch:ZS}),_Z=oC([`desktop`,`laptop`,`server`,`cloud`]),vZ=KS,yZ=oC([`ios`,`android`]),bZ=q({name:K,custom:ZS,icon:HS(_Z)}),xZ=q({environmentId:K,name:K,version:zJ(K),protocol:XS.check(DC()).check(CC(0))}),SZ=q({name:sC(K.pipe(Pre(Iy())).check(kC(1)).check(jC(64)).check(_C(e=>!/\p{Cc}/u.test(e))))}),CZ=bZ,wZ=q({icon:sC(_Z)}),TZ=bZ,EZ=q({status:G(`ok`),environmentId:K}),DZ={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return OZ({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return OZ({requests:t,annotations:br(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return OZ({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return OZ({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return H(function*(){let n=yield*$p(),r=ap(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),br(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return OZ({requests:t,annotations:this.annotations})},toLayer(e){return jd(this.toHandlers(e))},of:o,toLayerHandler(e,t){let n=this;return jd(H(function*(){let r=yield*$p(),i=ap(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),br(a)}))},accessHandler(e){return em(t=>{let n=this.requests.get(e),{handler:r,context:i}=jr(t,n.key);return B((e,t)=>{t.rpc=n;let a=r(e,t),o=Zae(a)?a.value:a;return ap(o)?tm(o,i):tO(o,i)})})},annotate(e,t){return OZ({requests:this.requests,annotations:Or(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(Dr(e,t))},annotateMerge(e){return OZ({requests:this.requests,annotations:Rr(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(Rr(e,r.annotations)));return OZ({requests:t,annotations:this.annotations})}},OZ=e=>Object.assign(function(){},DZ,{requests:e.requests,annotations:e.annotations}),kZ=(...e)=>OZ({requests:new Map(e.map(e=>[e._tag,e])),annotations:Tr()}),AZ=`(?:[0-9a-f]{40}|[0-9a-f]{64})`,jZ=K.check(yC(RegExp(`^${AZ}$`))),MZ=K.check(yC(RegExp(`^${AZ}(?:,${AZ})*$`))),NZ=oC([`switch`,`fetch`,`pull`,`push`,`commit`,`amend`,`stash-create`,`stash-apply`,`stash-pop`,`discard`]),PZ=q({requestId:K.check(bC()),projectId:K.check(bC()),worktreeId:RJ,action:NZ,state:oC([`running`,`succeeded`,`no-change`,`rejected`,`conflicted`,`interrupted`]),reason:W(oC([`CHANGED_SINCE_LOOKED`,`STALE_PREPARATION`,`REQUEST_MISMATCH`,`CHECKOUT_BUSY`,`UNSUPPORTED_CONFIGURATION`,`NON_FAST_FORWARD`,`GIT_REJECTED`,`DEADLINE_EXCEEDED`,`OUTCOME_UNKNOWN`,`PROCESS_GROUP_UNCONFIRMED`])),message:W(K),progress:J(K),result:W(q({headOid:W(jZ),trackingOid:W(jZ),sourceOid:W(jZ),destinationRef:W(K),stashOid:W(jZ),stashRetained:W(ZS),restoreStashOid:W(jZ),restoreIndex:W(ZS),branch:W(K)})),acceptedAt:IJ,finishedAt:W(IJ)}),FZ=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/u;function IZ(e,t){return e.length>0&&e.length<=t&&!e.includes(`\0`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)&&!FZ.test(e)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&e.toLowerCase()!==`.git`)}var LZ=K.check(kC(1)).check(jC(DJ)).check(_C(e=>IZ(e,DJ),{expected:`Expected a normalized relative path`})),RZ=q({projects:J(K.check(bC())).check(jC(128)),worktrees:J(q({projectId:K.check(bC()),worktreeId:RJ,paths:J(LZ).check(jC(64))})).check(jC(32))}).annotate({parseOptions:{onExcessProperty:`error`}}),zZ=kZ(PP(`notices`,{success:aC([q({type:G(`ready`)}),q({type:G(`subscribed`)}),q({type:G(`heartbeat`)}),q({type:G(`inventory`)}),q({type:G(`walkthrough`),change:oC([`run`,`conversations`]),projectId:K,worktreeId:RJ}),q({type:G(`git-action`),projectId:K.check(bC()),worktreeId:RJ,receipt:PZ}),q({type:G(`project`),projectId:K.check(bC()),change:oC([`files`,`preferences`])}),q({type:G(`worktree`),projectId:K.check(bC()),worktreeId:RJ,change:oC([`files`,`git`,`reviewed`])})]),stream:!0}),PP(`follow`,{payload:RZ})),BZ=q({ticket:K,expiresAt:K}),VZ=q({ticket:W(K)}),HZ=YS,UZ=q({address:K,dataDirectory:K,pid:XS.check(DC()).check(CC(0))}),WZ=q({token:K.check(kC(1)).check(jC(256)),platform:yZ,kinds:J(vZ).check(jC(2))}),GZ=q({kinds:J(vZ)}),KZ=YS,qZ=aC([q({kind:G(`off`)}),q({kind:G(`starting`)}),q({kind:G(`on`),urls:J(K)}),q({kind:G(`paused`)}),q({kind:G(`failed`),reason:oC([`address-in-use`,`address-unavailable`,`unreachable`,`other-server`])})]),JZ=q({interfaceName:K,subnet:K,gateway:K,gatewayHardware:W(K)}),YZ=q({enabled:ZS,status:qZ}),XZ=K.check(yC(/^[a-f0-9]{64}$/)).pipe(lC(`WaysInFingerprint`)),ZZ=oC([`lan`,`tailnet`,`cloudflare`]),QZ=q({routes:q({lan:YZ,tailnet:YZ,cloudflare:YZ}),lanNetwork:W(JZ),localNetwork:W(JZ),tailnetHostname:W(K),tailnetTarget:W(K),cloudflareHostname:W(K),serviceUrl:K,editing:q({fingerprint:XZ,protectedRoute:W(ZZ)})}),$Z=q({expected:XZ,change:q({lan:W(ZS),tailnet:W(ZS),tailnetHostname:W(K.check(kC(1)).check(jC(253))),cloudflare:W(ZS),cloudflareHostname:W(K.check(kC(1)).check(jC(253)))}).check(_C(e=>Object.keys(e).length>0))}),eQ=QZ,tQ=OC.check(CC(0)).check(TC(2**53-1)),nQ=q({kind:G(`configured`),revision:tQ,settings:gZ}),rQ=aC([q({kind:G(`unconfigured`)}),nQ]),iQ=aC([q({kind:G(`initialize`),settings:gZ}),q({kind:G(`change`),change:gZ.mapFields(yS(HS)).check(NC(1))})]),aQ=nQ,oQ=q({from:K,target:K,stage:oC([`downloading`,`installing`,`restarting`,`updated`,`failed`]),reason:zJ(K)}),sQ=q({managed:ZS,version:zJ(K),latest:zJ(K),available:ZS,running:ZS,last:zJ(oQ),canUpdate:ZS}),cQ=q({version:K.check(kC(1)).check(jC(128))}),lQ=sQ,uQ=$(GX,`BadRequest`),dQ=YJ(`publicAccess`).add(KN(`readHealth`,`/health`,{disableCodecs:!0,success:EZ,error:hZ}),KN(`readEnvironment`,`/environment`,{disableCodecs:!0,success:xZ,error:hZ})),fQ=YJ(`browserAccess`).add(XN(`clearBrowserSession`,`/session`,{disableCodecs:!0,success:xY.pipe(oN({decode:()=>void 0}),aN(`NoContent`))})),pQ=YJ(`pairing`).add(qN(`redeemPairing`,`/pair`,{disableCodecs:!0,payload:aY,success:oY,error:[uQ,$(qX,`Unauthorized`)]})).middleware(SY),mQ=YJ(`session`).add(KN(`readSession`,`/session`,{disableCodecs:!0,success:XJ}),qN(`issueLiveTicket`,`/live/tickets`,{disableCodecs:!0,success:BZ,error:[$(iZ,`Forbidden`),$(aZ,`TooManyRequests`)]})).middleware(CY).middleware(SY),hQ=$(mZ,`Forbidden`),gQ=YJ(`pushRegistration`).add(JN(`setPushRegistration`,`/push-registration`,{disableCodecs:!0,payload:WZ,success:GZ,error:hQ}),XN(`clearPushRegistration`,`/push-registration`,{disableCodecs:!0,success:KZ.pipe(oN({decode:()=>void 0}),aN(`NoContent`)),error:hQ})).middleware(CY).middleware(SY),_Q=YJ(`serviceUpdates`).add(KN(`readServiceUpdate`,`/service/update`,{disableCodecs:!0,success:sQ}),qN(`startServiceUpdate`,`/service/update`,{disableCodecs:!0,payload:cQ,success:lQ.pipe(aN(`Accepted`)),error:[$(sZ,`Forbidden`),$(tZ,`Conflict`),$(rZ,`Conflict`),$(nZ,`Conflict`)]})).middleware(CY).middleware(SY),vQ=YJ(`reviewGitSettings`).add(KN(`readReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,success:rQ}),YN(`saveReviewGitSettings`,`/review-git-settings`,{disableCodecs:!0,payload:iQ,success:aQ,error:[$(dZ,`Forbidden`),$(fZ,`Conflict`)]})).middleware(CY).middleware(SY),yQ=$(pZ,`Forbidden`),bQ=YJ(`administration`).add(KN(`listAccess`,`/access`,{disableCodecs:!0,success:uY,error:yQ}),qN(`issuePairing`,`/pairings`,{disableCodecs:!0,payload:dY,success:fY,error:[yQ,hZ,uQ,$(KX,`BadRequest`)]}),qN(`revokeAccess`,`/access/revoke`,{disableCodecs:!0,payload:pY,success:mY,error:yQ}),qN(`setDeviceTrust`,`/access/trust`,{disableCodecs:!0,payload:hY,success:gY,error:[yQ,$(oZ,`NotFound`)]}),qN(`setManagementPermission`,`/access/management-permission`,{disableCodecs:!0,payload:yY,success:bY,error:[yQ,$(oZ,`NotFound`)]}),qN(`setWaysInPermission`,`/access/ways-in-permission`,{disableCodecs:!0,payload:_Y,success:vY,error:[yQ,$(oZ,`NotFound`)]})).middleware(CY).middleware(SY),xQ=$(cZ,`Forbidden`),SQ=YJ(`remoteAccess`).add(KN(`readRemoteAccess`,`/remote-access`,{disableCodecs:!0,success:QZ,error:xQ}),YN(`setRemoteAccess`,`/remote-access`,{disableCodecs:!0,payload:$Z,success:eQ,error:[xQ,$(lZ,`Conflict`),$(uZ,`Conflict`),$(ZX,`BadRequest`),$(YX,`BadRequest`),$(QX,`BadRequest`),$(XX,`BadRequest`),$($X,`Conflict`),$(eZ,`Conflict`)]})).middleware(CY).middleware(SY),CQ=YJ(`environmentLabel`).add(JN(`renameEnvironment`,`/environment/name`,{disableCodecs:!0,payload:SZ,success:CZ})).add(JN(`setEnvironmentIcon`,`/environment/icon`,{disableCodecs:!0,payload:wZ,success:TZ})).middleware(CY),wQ=YJ(`ownerStatus`).add(KN(`readOwnerStatus`,`/status`,{disableCodecs:!0,success:UZ})).middleware(CY);GY.add(dQ).prefix(`/api`),GY.add(fQ).prefix(`/api`);var TQ=class extends GY.add(pQ).prefix(`/api`){};GY.add(mQ).prefix(`/api`),GY.add(gQ).prefix(`/api`),GY.add(_Q).prefix(`/api`),GY.add(SQ).prefix(`/api`),GY.add(vQ).prefix(`/api`),GY.add(bQ).prefix(`/api`),GY.add(CQ).prefix(`/api`),GY.add(bQ,SQ,wQ);var EQ=class extends GY.add(dQ,fQ,pQ,mQ,gQ,_Q,SQ,vQ,bQ,CQ).prefix(`/api`){},DQ=class extends Y()(`ContentChangedError`,{}){get message(){return`Content changed; retry the operation`}},OQ=class extends Y()(`CrossDeviceMoveError`,{}){get message(){return`Destination is on another filesystem; nothing was moved`}},kQ=class extends Y()(`DiskFullError`,{}){get message(){return`There is not enough space on the disk`}},AQ=class extends Y()(`DirectoryTooLargeError`,{}){get message(){return`Directory exceeds the listing limit`}},jQ=class extends Y()(`EntryExistsError`,{}){get message(){return`An entry already exists at that path`}},MQ=class extends Y()(`FileTooLargeError`,{}){get message(){return`File exceeds the read limit`}},NQ=class extends Y()(`InvalidMoveError`,{}){get message(){return`An entry cannot be moved onto or into itself`}},PQ=class extends Y()(`PathNotFoundError`,{}){get message(){return`Path not found`}},FQ=class extends Y()(`PathNotReadableError`,{}){get message(){return`Path could not be read`}},IQ=class extends Y()(`TrashUnavailableError`,{}){get message(){return`This machine has no trash; nothing was deleted`}},LQ=class extends Y()(`UnsupportedAssetTypeError`,{}){get message(){return`File type cannot be previewed`}},RQ=class extends Y()(`UnsupportedEntryNameError`,{}){get message(){return`Directory contains a name that is not supported UTF-8`}},zQ=class extends Y()(`UnsupportedTextError`,{}){get message(){return`File is not supported UTF-8 text`}},BQ=$(NQ,`BadRequest`,{message:`Invalid request`}),VQ=$(PQ,`NotFound`),HQ=$(DQ,`Conflict`,{code:`content_changed`}),UQ=$(jQ,`Conflict`),WQ=$(FQ,`UnprocessableEntity`),GQ=$(RQ,`UnprocessableEntity`),KQ=$(AQ,`UnprocessableEntity`),qQ=$(OQ,`UnprocessableEntity`),JQ=$(IQ,`UnprocessableEntity`),YQ=$(LQ,`UnprocessableEntity`),XQ=$(zQ,`UnprocessableEntity`,{code:`unsupported_text`}),ZQ=$(MQ,`UnprocessableEntity`,{code:`file_too_large`}),QQ=$(kQ,`UnprocessableEntity`),$Q=[...dX,VQ,WQ,HQ],e$=[...$Q,XQ,ZQ],t$=class extends Y()(`BranchBaseNotFoundError`,{}){get message(){return`Base branch not found`}},n$=class extends Y()(`CommitNotFoundError`,{}){get message(){return`Commit not found`}},r$=class extends Y()(`IncompleteDiffReadError`,{}){get message(){return`Diff read returned fewer results than requested`}},i$=class extends Y()(`SelectionMismatchError`,{}){get message(){return`Selections must cover exactly the expected files`}},a$=class extends Y()(`UnnamedDiffSelectionError`,{}){get message(){return`A diff selection names neither an old nor a new path`}},o$=class extends Y()(`UnbornBranchError`,{}){get message(){return`The branch has no commits yet`}},s$=class extends Y()(`UnrelatedBranchError`,{}){get message(){return`The branch shares no history with its base`}},c$=K.check(kC(1)).check(jC(jJ)).check(yC(/^refs\/(?:heads|remotes)\/\S+$/u)),l$=K.check(yC(/^[a-f0-9]{64}$/)),u$=aC([q({kind:G(`text`),patch:K}),q({kind:G(`binary`)}),q({kind:G(`metadata-only`),patch:K}),q({kind:G(`omitted`),reason:oC([`size-limit`,`unsupported-encoding`,`unsupported-submodule`])})]),d$=q({ref:K,oid:jZ}),f$=q({path:K,oldPath:zJ(K),newPath:zJ(K),status:oC([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldOid:W(jZ),newOid:W(jZ),oldMode:K,newMode:K,fingerprint:l$}),p$=q({base:W(c$)}),m$=q({worktreeId:RJ,head:q({oid:jZ,branch:zJ(K)}),base:zJ(d$),mergeBaseOid:zJ(jZ),commits:XS.check(DC()).check(wC(0)),files:J(f$).check(jC(kJ))}),h$=q({baseOid:jZ,headOid:jZ,paths:J(J(K).check(kC(1)).check(jC(2))).check(kC(1)).check(jC(200))}),g$=q({diffs:J(q({paths:J(K),content:u$}))}),_$=q({defaultRef:zJ(K),bases:J(q({ref:K,name:K,remote:ZS})).check(jC(500))}),v$=q({additions:OC,deletions:OC,binaryFiles:OC}),y$={DD:`both-deleted`,AU:`added-by-us`,UD:`deleted-by-them`,UA:`added-by-them`,DU:`deleted-by-us`,AA:`both-added`,UU:`both-modified`},b$={"both-deleted":`DD`,"added-by-us":`AU`,"deleted-by-them":`UD`,"added-by-them":`UA`,"deleted-by-us":`DU`,"both-added":`AA`,"both-modified":`UU`},x$=oC([`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`]),S$=oC([`both-deleted`,`added-by-us`,`deleted-by-them`,`added-by-them`,`deleted-by-us`,`both-added`,`both-modified`]),C$=x$.pipe(pC(S$,Fy({decode:e=>y$[e],encode:e=>b$[e]}))),w$=q({scope:oC([`staged`,`unstaged`]),oldPath:zJ(LZ),newPath:zJ(LZ)}),T$=aC([q({scope:oC([`staged`,`unstaged`]),kind:oC([`added`,`modified`,`deleted`,`renamed`,`type-changed`]),oldPath:zJ(LZ),newPath:zJ(LZ),oldMode:K.check(yC(/^[0-7]{6}$/)),newMode:K.check(yC(/^[0-7]{6}$/)),oldOid:zJ(jZ),newOid:zJ(jZ),supported:ZS}),q({scope:G(`untracked`),path:LZ}),q({scope:G(`unmerged`),path:LZ,conflict:C$})]),E$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:l$,branch:W(q({name:zJ(K),upstream:zJ(K),ahead:XS.check(DC()).check(wC(0)),behind:XS.check(DC()).check(wC(0)),remoteName:zJ(K),sourceRef:zJ(K),upstreamOid:zJ(jZ),stashes:J(q({oid:jZ,message:K})),discarded:J(q({oid:jZ,path:LZ,kind:oC([`hunk`,`rename`])})).check(jC(50))})),consistency:G(`best-effort`),headOid:zJ(jZ),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(jZ),headCommit:zJ(q({subject:K,body:W(K)})),changes:J(T$).check(jC(TJ))}),D$=q({environmentId:K.check(bC()),worktreeId:RJ,...v$.fields,additions:v$.fields.additions.check(wC(0)),deletions:v$.fields.deletions.check(wC(0)),binaryFiles:v$.fields.binaryFiles.check(wC(0))}),O$=q({path:LZ,fingerprint:zJ(l$),comparisons:J(T$).check(kC(1))}),k$=q({name:zJ(K),upstream:zJ(K),ahead:XS.check(DC()).check(wC(0)),behind:XS.check(DC()).check(wC(0))}),A$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:l$,headOid:zJ(jZ),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(jZ),branch:zJ(k$),interrupted:W(q({requestId:K.check(bC()),action:NZ})),changes:J(O$).check(jC(TJ))}),j$=q({expectedStatusToken:l$,expectedFiles:J(q({path:LZ,fingerprint:zJ(l$)})).check(kC(1)).check(jC(200)),selections:J(w$).check(kC(1)).check(jC(200))}),M$=q({environmentId:K.check(bC()),worktreeId:RJ,statusToken:l$,diffs:J(q({selection:w$,content:u$}))}),N$=q({path:LZ,from:KC.check(DC()).check(wC(1)),to:KC.check(DC()).check(wC(1)),at:oC([`head`,`worktree`])}),P$=q({environmentId:K.check(bC()),worktreeId:RJ,at:oC([`head`,`worktree`]),path:LZ,from:XS.check(DC()).check(wC(0)),to:XS.check(DC()).check(wC(0)),lines:J(K)}),F$=MZ,I$=J(jZ),L$=F$.pipe(pC(I$,Fy({decode:e=>e.split(`,`),encode:e=>e.join(`,`)}))),R$=q({limit:W(KC.check(DC()).check(wC(1)).check(TC(100))),after:W(L$),tip:W(jZ)}),z$=aC([q({kind:G(`attached`),ref:K}),q({kind:G(`detached`)}),q({kind:G(`unborn`),ref:K})]),B$=aC([q({kind:oC([`local-branch`,`remote-branch`,`tag`]),name:K}),q({kind:G(`head`),name:G(`HEAD`)})]),V$=q({oid:jZ,parentOids:J(jZ),author:q({name:K,timestamp:K}),subject:K,subjectTruncated:ZS,body:zJ(K),bodyTruncated:ZS,refs:J(B$)}),H$=q({snapshot:zJ(q({tipOid:zJ(jZ),head:z$})),commits:J(V$).check(jC(100)),nextAfter:zJ(J(jZ).check(jC(100))),tip:zJ(jZ),boundary:zJ(oC([`shallow`,`wide`])),restarted:ZS}),U$=q({tip:jZ,offset:OC.check(wC(1)).check(TC(2**53-1-100-1))}),W$=q({path:LZ,after:W(WC(U$)),limit:W(KC.check(DC()).check(wC(1)).check(TC(100)))}),G$=q({commits:J(q({commit:V$,path:K,previousPath:zJ(K),status:oC([`added`,`modified`,`deleted`,`renamed`,`type-changed`])})).check(jC(100)),nextAfter:zJ(U$),tip:zJ(jZ),boundary:zJ(G(`shallow`)),restarted:ZS}),K$=aC([q({kind:G(`parent`),parentNumber:XS.check(DC()).check(CC(0)),baseOid:jZ}),q({kind:G(`empty-tree`)})]),q$=q({oldPath:zJ(K),newPath:zJ(K),status:oC([`added`,`deleted`,`modified`,`renamed`,`type-changed`]),oldMode:K,newMode:K}),J$=q({worktreeId:RJ,oid:jZ}),Y$=q({parent:W(KC.check(DC()).check(wC(1)).check(TC(OJ)))}),X$=q({commit:V$,comparison:K$,files:J(q$).check(jC(kJ))}),Z$=q({worktreeId:RJ,oid:jZ}),Q$=q({parent:W(XS.check(DC()).check(wC(1)).check(TC(OJ))),paths:J(J(K).check(kC(1)).check(jC(2))).check(kC(1)).check(jC(200))}),$$=q({commitOid:jZ,diffs:J(q({paths:J(K),content:u$}))}),e1=class extends GY.add(YJ(`changes`).add(KN(`readWorktreeSummary`,`/api/worktrees/:worktreeId/summary`,{disableCodecs:!0,params:BJ,success:D$,error:[hZ,...dX,...wX]}),KN(`listBranchBases`,`/api/worktrees/:worktreeId/branch-bases`,{disableCodecs:!0,params:BJ,success:_$,error:[...dX,...wX]}),KN(`listCommits`,`/api/worktrees/:worktreeId/commits`,{disableCodecs:!0,params:BJ,query:R$.fields,success:H$,error:[...dX,...wX]}),KN(`listFileCommits`,`/api/worktrees/:worktreeId/file-commits`,{disableCodecs:!0,params:BJ,query:W$.fields,success:G$,error:[...dX,...wX]}),KN(`readBranchChanges`,`/api/worktrees/:worktreeId/branch-changes`,{disableCodecs:!0,params:BJ,query:p$.fields,success:m$,error:[...dX,...wX,$(t$,`NotFound`),$(o$,`Conflict`),$(s$,`Conflict`)]}),qN(`readBranchDiffs`,`/api/worktrees/:worktreeId/branch-changes/diffs`,{disableCodecs:!0,params:BJ,payload:h$,success:g$,error:[...dX,...wX,$(n$,`NotFound`),$(r$,`UnprocessableEntity`)]}),qN(`readChangeDiffs`,`/api/worktrees/:worktreeId/changes/diffs`,{disableCodecs:!0,params:BJ,payload:j$,success:M$,error:[hZ,...dX,...wX,$(i$,`BadRequest`,{message:`Invalid request`}),$(a$,`BadRequest`,{message:`Invalid request`}),$(r$,`UnprocessableEntity`)]}),KN(`readChangeLines`,`/api/worktrees/:worktreeId/changes/lines`,{disableCodecs:!0,params:BJ,query:N$.fields,success:P$,error:[hZ,...e$,$(KY,`BadRequest`,{message:`Invalid request`})]}),KN(`readChanges`,`/api/worktrees/:worktreeId/changes`,{disableCodecs:!0,params:BJ,success:A$,error:[hZ,...dX,...wX]}),qN(`readCommitDiffs`,`/api/worktrees/:worktreeId/commits/:oid/diffs`,{disableCodecs:!0,params:Z$,payload:Q$,success:$$,error:[...dX,...wX,$(n$,`NotFound`)]}),KN(`readCommitFiles`,`/api/worktrees/:worktreeId/commits/:oid/files`,{disableCodecs:!0,params:J$,query:Y$.fields,success:X$,error:[...dX,...wX,$(n$,`NotFound`)]}),KN(`readGitStatus`,`/api/worktrees/:worktreeId/git/status`,{disableCodecs:!0,params:BJ,success:E$,error:[hZ,...dX,...wX]})).middleware(CY)){};function t1(e){return new TextEncoder().encode(e).byteLength}var n1=aC([G(``),LZ]),r1=K.check(_C(e=>e.length<=1048576&&!e.includes(`\0`)&&t1(e)<=1048576,{expected:`UTF-8 text without NUL within the write limit`})),i1=q({path:n1}),a1=jS(q({worktreeId:RJ,path:K,entries:J(q({name:K,kind:oC([`file`,`directory`,`symlink`,`submodule`,`other`]),ignored:W(ZS),target:W(K)}))})),o1=jS(q({worktreeId:RJ,paths:J(K).check(jC(MJ))})),s1=q({path:LZ}),c1=jS(q({worktreeId:RJ,path:K,encoding:G(`utf-8`),byteLength:OC.check(wC(0)),text:K,contentFingerprint:W(l$)})),l1=aC([q({kind:G(`write`),path:LZ,text:r1,expectedFingerprint:l$}),q({kind:G(`create`),path:LZ,entryKind:oC([`file`,`directory`])}),q({kind:G(`move`),path:LZ,destination:LZ}),q({kind:G(`trash`),path:LZ}),q({kind:G(`copy`),path:LZ,destination:LZ})]),u1=jS(q({path:K,contentFingerprint:W(l$)})),d1=q({path:LZ}),f1=jS(q({path:K,mediaType:K,base64:K})),p1=q({document:LZ,paths:J(K.check(jC(DJ))).check(kC(1),jC(64))}),m1=jS(q({assets:J(aC([q({kind:G(`asset`),path:K,mediaType:K,base64:K}),q({kind:G(`unavailable`),path:K})]))})),h1=class extends GY.add(YJ(`files`).add(KN(`listDirectory`,`/api/worktrees/:worktreeId/directory`,{disableCodecs:!0,params:BJ,query:i1.fields,success:a1,error:[...$Q,GQ,KQ]}),KN(`listWorktreePaths`,`/api/worktrees/:worktreeId/paths`,{disableCodecs:!0,params:BJ,success:o1,error:[...dX,KQ]}),KN(`readTextFile`,`/api/worktrees/:worktreeId/text`,{disableCodecs:!0,params:BJ,query:s1.fields,success:c1,error:[...$Q,XQ,ZQ]}),KN(`readFileAsset`,`/api/worktrees/:worktreeId/asset`,{disableCodecs:!0,params:BJ,query:d1.fields,success:f1,error:[...$Q,YQ,ZQ]}),qN(`readPreviewAssets`,`/api/worktrees/:worktreeId/preview-assets`,{disableCodecs:!0,params:BJ,payload:p1,success:m1,error:dX}),qN(`editFile`,`/api/worktrees/:worktreeId/files`,{disableCodecs:!0,params:BJ,payload:l1,success:u1,error:[...$Q,XQ,UQ,qQ,JQ,ZQ,QQ,BQ]})).middleware(CY)){},g1=class extends Y()(`CommitDraftSelectionError`,{}){get message(){return`Select readable changed files to generate a commit draft.`}},_1=class extends Y()(`CommitDraftTooLargeError`,{}){get message(){return`Select fewer files to generate a commit draft.`}},v1=class extends Y()(`CommitGenerationFailedError`,{}){get message(){return`Commit generation failed.`}},y1=class extends Y()(`CommitGroupsMismatchError`,{}){get message(){return`The generated draft did not cover the selected files. Generate again or write the message manually.`}},b1=class extends Y()(`CommitToolFailedError`,{}){get message(){return`Commit generation failed. Check that the selected CLI is up to date and signed in.`}},x1=class extends Y()(`CommitToolMissingError`,{}){get message(){return`The selected coding CLI is not installed.`}},S1=class extends Y()(`DiscardExpectationMismatchError`,{}){get message(){return`A discard expects exactly the discarded path`}},C1=class extends Y()(`DuplicateExpectedFileError`,{}){get message(){return`Each expected file may appear only once`}},w1=class extends Y()(`EmptyCommitSelectionError`,{}){get message(){return`Select at least one path to commit`}},T1=class extends Y()(`ExpectedFilesMismatchError`,{}){get message(){return`The expected files do not match the selected paths`}},E1=class extends Y()(`GitActionNotFoundError`,{}){get message(){return`Git action receipt not found`}},D1=class extends Y()(`GitActionReceiptMismatchError`,{}){get message(){return`Git action receipt does not match this request`}},O1=class extends Y()(`InvalidHunkRangeError`,{}){get message(){return`The hunk ends before it starts`}},k1=class extends Y()(`MergeExpectationMismatchError`,{}){get message(){return`A merge in progress and its merge head must be expected together`}},A1=class extends Y()(`MissingExpectedFilesError`,{}){get message(){return`This action needs the files the client expects`}},j1=class extends Y()(`MissingUpstreamExpectationError`,{}){get message(){return`This action needs the upstream the client expects`}},M1=class extends Y()(`UnsupportedCommitModelError`,{}){get message(){return`Unsupported commit model.`}},N1=class extends Y()(`WorktreeCleanupRefusedError`,{message:K}){},P1=J(q({id:K,label:K})),F1=q({mode:oC([`message`,`groups`]),model:K.check(kC(1)).check(jC(160)),expectedStatusToken:l$,paths:J(LZ).check(kC(1)).check(jC(TJ))}),I1=q({groups:J(q({message:K.check(kC(1)).check(jC(wJ)),paths:J(LZ).check(kC(1)).check(jC(TJ))})).check(kC(1)).check(jC(20)),expectedFiles:J(q({path:LZ,fingerprint:l$})).check(jC(TJ))}),L1=K.check(kC(1)).check(jC(wJ)).check(_C(e=>e.trim().length>0&&!e.includes(`\0`)&&t1(e)<=16384)),R1=K.check(jC(jJ)).check(yC(/^refs\/heads\/[\s\S]/u)).check(_C(e=>!e.includes(`\0`))),z1=K.check(yC(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/)),B1=q({path:LZ,fingerprint:l$}),V1=q({worktreeId:RJ,requestId:K.check(bC())}),H1=aC([q({action:G(`switch`),targetRef:R1}),q({action:G(`fetch`),remoteName:z1,sourceRef:R1}),q({action:G(`pull`),remoteName:z1,sourceRef:R1,strategy:W(oC([`ff-only`,`merge`,`rebase`]))}),q({action:G(`push`),remoteName:z1,destinationRef:R1,allowCreate:ZS}),q({action:G(`commit`),message:L1,paths:J(LZ).check(jC(TJ))}),q({action:G(`amend`),message:L1,paths:J(LZ).check(jC(TJ))}),q({action:G(`stash-create`),message:L1,includeUntracked:ZS}),q({action:oC([`stash-apply`,`stash-pop`]),stashOid:jZ,restoreIndex:ZS.pipe(Lre(B(!1)))}),q({action:G(`discard`),path:LZ,hunk:W(q({scope:oC([`staged`,`unstaged`]),startLine:XS.check(DC()).check(CC(0)),endLine:XS.check(DC()).check(CC(0))}))})]),U1=q({headOid:zJ(jZ),branch:zJ(K),inProgress:zJ(oC([`merge`,`rebase`])),mergeHeadOid:zJ(jZ),upstreamOid:W(sC(jZ)),files:W(J(B1).check(jC(TJ)))}),W1=q({requestId:K.check(bC()),input:H1,expected:U1}),G1=PZ,K1=aC([PZ,PJ]),q1=V1,J1=PZ,Y1=V1,X1=q({dismissed:G(!0)}),Z1=$(D1,`Conflict`,{message:`Git action request does not match its receipt`}),Q1=$(E1,`NotFound`),$1=[$(O1,`BadRequest`,{message:`Invalid request`}),$(C1,`BadRequest`,{message:`Invalid request`}),$(k1,`BadRequest`,{message:`Invalid request`}),$(w1,`BadRequest`,{message:`Invalid request`}),$(T1,`BadRequest`,{message:`Invalid request`}),$(S1,`BadRequest`,{message:`Invalid request`}),$(A1,`BadRequest`,{message:`Invalid request`}),$(j1,`BadRequest`,{message:`Invalid request`})],e0=[$(g1,`UnprocessableEntity`),$(_1,`UnprocessableEntity`),$(v1,`UnprocessableEntity`),$(y1,`UnprocessableEntity`),$(b1,`UnprocessableEntity`),$(x1,`UnprocessableEntity`),$(M1,`UnprocessableEntity`)],t0=class extends GY.add(YJ(`gitActions`).add(XN(`dismissInterruptedGitAction`,`/api/worktrees/:worktreeId/git/interrupted/:requestId`,{disableCodecs:!0,params:Y1,success:X1,error:[...dX,Q1,Z1]}),qN(`generateCommitDraft`,`/api/worktrees/:worktreeId/git/commit-draft`,{disableCodecs:!0,params:BJ,payload:F1,success:I1,error:[...dX,...wX,...e0]}),KN(`listCommitModels`,`/api/git/commit-models`,{disableCodecs:!0,success:P1}),KN(`readGitActionReceipt`,`/api/worktrees/:worktreeId/git/receipts/:requestId`,{disableCodecs:!0,params:q1,success:J1,error:[...dX,Q1]}),qN(`runGitAction`,`/api/worktrees/:worktreeId/git/actions`,{disableCodecs:!0,params:BJ,payload:W1,success:[G1,G1.pipe(aN(202)),K1.pipe(aN(409)),K1.pipe(aN(503))],error:[...dX,Z1,...$1]})).middleware(CY)){};q({address:K,dataDirectory:K,pid:OC}),q({path:US(K),fingerprint:US(aC([K,YS]))});var n0=q({deleteWorktree:ZS,deleteLocalBranch:ZS,deleteRemoteBranch:ZS}),r0=q({worktreePath:W(K),detachWorktreePath:W(K),localBranch:W(K),remoteBranch:W(K),remoteBranchNote:W(K),mainCheckout:ZS,dirty:ZS,unpushed:ZS,fingerprint:K}),i0=q({options:n0,confirmation:W(q({plan:r0,discardChanges:ZS}))}),a0=i0,o0=q({deleted:ZS,plan:r0}),s0=K.check(_C(e=>IZ(e,DJ),{expected:`a normalized relative path`})),c0=jS(q({preferences:J(q({path:s0,pinned:ZS,hidden:ZS}))})),l0=q({path:s0,flag:oC([`pinned`,`hidden`]),value:ZS}),u0=c0,d0=oC([`moved`,`missing`,`permission`,`git-failed`]),f0=i0,p0=q({archived:ZS,plan:r0}),m0=K.check(kC(1),jC(DJ),_C(e=>e.startsWith(`/`)&&!e.includes(`\0`),{expected:`an absolute path without NUL`})),h0={id:LJ,name:K,worktrees:J(q({id:RJ,path:K,main:ZS,branch:zJ(K),headCommittedAt:HS(IJ),walkthroughTitle:HS(K),pullRequestTitle:HS(K),available:ZS})),walkthroughSettings:HS(FY)},g0=aC([q({...h0,available:G(!0),unavailableReason:HS(KS)}),q({...h0,available:G(!1),unavailableReason:HS(d0)})]),_0=q({projectId:LJ}),v0=_0,y0=_0,b0=_0,x0=jS(q({environmentId:LJ,environment:bZ,projects:J(g0)})),S0=q({path:m0}),C0=jS(g0),w0=q({deleted:ZS}),T0=q({path:HS(m0)}),E0=jS(q({path:K,parent:zJ(K),directories:J(q({name:K,path:K})),repository:ZS,truncated:ZS})),D0=jS(q({name:K.pipe(pC(K.check(kC(1),jC(100),_C(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{expected:`a name without control characters`})),Fy({decode:e=>e.trim(),encode:e=>e})))}),{parseOptions:WY}),O0=q({id:LJ,name:K}),k0=$($Y,`NotFound`),A0=class extends GY.add(YJ(`projects`).add(qN(`deleteWorktree`,`/api/worktrees/:worktreeId/delete`,{disableCodecs:!0,params:BJ,payload:a0,success:o0,error:[...dX,$(N1,`Conflict`,{message:{fromError:!0}})]}),KN(`browseProjectFolders`,`/api/projects/folders`,{disableCodecs:!0,query:T0.fields,success:E0,error:[$(ZY,`NotFound`),$(QY,`UnprocessableEntity`),$(eX,`UnprocessableEntity`)]}),KN(`readInventory`,`/api/inventory`,{disableCodecs:!0,success:x0,error:hZ}),qN(`refreshInventory`,`/api/inventory/refresh`,{disableCodecs:!0,success:x0,error:hZ}),KN(`listFilePreferences`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:y0,success:c0,error:k0}),qN(`registerProject`,`/api/projects`,{disableCodecs:!0,payload:S0,success:C0,error:[k0,$(YY,`UnprocessableEntity`,{message:`Repository could not be inspected`})]}),XN(`removeProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:v0,success:w0,error:k0}),JN(`saveWalkthroughSettings`,`/api/projects/:projectId/walkthrough-settings`,{disableCodecs:!0,params:_0,payload:FY,success:FY,error:k0}),YN(`renameProject`,`/api/projects/:projectId`,{disableCodecs:!0,params:_0,payload:D0,success:O0,error:k0}),JN(`setFilePreference`,`/api/projects/:projectId/file-preferences`,{disableCodecs:!0,params:b0,payload:l0,success:u0,error:[k0,$(XY,`Conflict`,{message:`File preference limit reached`})]})).middleware(CY)){};Y()(`GitHubPullRequestNotFoundError`,{});var j0=oC([`gh-not-installed`,`no-accounts`,`no-access`,`not-github`,`rate-limited`,`offline`,`invalid-response`,`pull-request-not-found`]),M0=q({kind:G(`unavailable`),reason:j0}),N0=q({account:K,source:oC([`detected`,`overridden`])}),P0=q({repository:W(K),accounts:J(K),choice:W(N0),override:W(K),unavailable:W(M0)}),F0=sC(q({login:K,avatarUrl:W(K)})),I0=q({hasNextPage:ZS}),L0=aC([q({__typename:G(`CheckRun`),name:K,status:K,conclusion:sC(K),detailsUrl:sC(K),startedAt:W(sC(K)),completedAt:W(sC(K))}),q({__typename:G(`StatusContext`),context:K,state:K,targetUrl:sC(K)})]),R0=q({number:OC,title:K,url:K,state:oC([`OPEN`,`CLOSED`,`MERGED`]),isDraft:ZS,author:F0,headRefName:K,baseRefName:K,updatedAt:K,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:K}))})}))})}),z0=q({id:K,author:F0,createdAt:K,body:K,url:K});q({...R0.fields,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:K,contexts:q({nodes:J(L0),pageInfo:I0})}))})}))}),body:K,bodyHTML:W(K),createdAt:W(K),baseRefName:K,headRefOid:K,headRepository:W(sC(q({url:K}))),mergeable:K,labels:q({nodes:J(q({name:K,color:K})),pageInfo:I0}),comments:q({nodes:J(z0),pageInfo:I0}),reviews:q({nodes:J(q({id:K,author:F0,submittedAt:sC(K),createdAt:W(K),body:K,url:K,state:K,comments:q({nodes:J(q({...z0.fields,path:K,diffHunk:W(K),line:sC(OC),originalLine:sC(OC)})),pageInfo:I0})})),pageInfo:I0})});var B0=q({name:K,status:K,conclusion:W(K),detailsUrl:W(K),durationMs:W(OC)}),V0=q({number:OC,title:K,url:K,state:oC([`open`,`closed`,`merged`]),draft:ZS,author:W(K),headBranch:K,baseBranch:K,updatedAt:K,checksSummary:W(K),checksTruncated:ZS}),H0=q({id:K,kind:oC([`comment`,`review`,`review-comment`]),author:W(K),time:K,body:K,url:K,reviewState:W(K),authorAvatarUrl:W(K),reviewId:W(K),diffHunk:W(K),path:W(K),line:W(OC),originalLine:W(OC)}),U0=q({...V0.fields,description:K,createdAt:W(K),authorAvatarUrl:W(K),baseBranch:K,headSha:K,headRepository:W(K),mergeable:K,labels:J(q({name:K,color:K})),checks:J(B0),timeline:J(H0),truncated:ZS});q({number:OC,commits:q({nodes:J(q({commit:q({statusCheckRollup:sC(q({state:oC([`SUCCESS`,`PENDING`,`EXPECTED`,`FAILURE`,`ERROR`])}))})}))})});var W0=oC([`passed`,`running`,`failed`,`none`]);Y()(`GitHubReadError`,{reason:j0});var G0=class extends Y()(`ReviewedMarkConflictError`,{}){get message(){return`The reviewed mark is based on a version that has changed`}},K0=q({path:LZ,fingerprint:l$,reviewedAt:IJ}),q0=oC([`worktree`,`branch`]),J0={scope:G(`branch`),base:c$},Y0=q({scope:W(q0),branch:W(c$)}),X0=q({worktreeId:RJ,marks:J(K0).check(jC(AJ))}),Z0={path:LZ,reviewed:G(!0),fingerprint:l$},Q0=aC([q({...Z0,scope:W(G(`worktree`))}),q({...Z0,...J0})]),$0=X0,e2={files:J(q({path:LZ,fingerprint:l$})).check(kC(1)).check(jC(EJ))},t2=aC([q({...e2,scope:W(G(`worktree`))}),q({...e2,...J0})]),n2=q({...X0.fields,marked:J(LZ).check(jC(EJ)),conflicts:J(q({path:LZ,reason:oC([`stale`,`missing`])})).check(jC(EJ))}),r2=q({path:LZ,scope:W(q0),branch:W(c$)}),i2=X0,a2=q({paths:J(LZ).check(kC(1)).check(jC(EJ)),scope:W(q0),branch:W(c$)}),o2=X0,s2=class extends GY.add(YJ(`reviewedFiles`).add(KN(`listReviewedFiles`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,query:Y0.fields,success:X0,error:[...dX]}),JN(`setReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,payload:Q0,success:$0,error:[...dX,...wX,$(G0,`Conflict`),$(t$,`NotFound`),$(o$,`Conflict`),$(s$,`Conflict`)]}),JN(`setReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:BJ,payload:t2,success:n2,error:[...dX,...wX,$(G0,`Conflict`),$(t$,`NotFound`),$(o$,`Conflict`),$(s$,`Conflict`)]}),XN(`removeReviewedFile`,`/api/worktrees/:worktreeId/reviewed`,{disableCodecs:!0,params:BJ,query:r2.fields,success:i2,error:dX}),XN(`removeReviewedFiles`,`/api/worktrees/:worktreeId/reviewed-bulk`,{disableCodecs:!0,params:BJ,payload:a2,success:o2,error:dX})).middleware(CY)){},c2=aC([q({kind:G(`available`),account:K,pullRequest:U0}),M0]),l2=aC([q({kind:G(`available`),account:K,pullRequests:J(V0),truncated:ZS,recentlyClosedSince:K}),M0]),u2=q({account:zJ(K.check(yC(/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$/)))});q({override:HS(u2)});var d2=aC([q({kind:G(`available`),number:OC,checks:W0}),M0]),f2=q({projectId:K}),p2=q({projectId:K,number:KC.check(DC(),CC(0))}),m2=class extends GY.add(YJ(`pullRequests`).add(KN(`listProjectPullRequests`,`/api/projects/:projectId/pull-requests`,{disableCodecs:!0,params:f2,success:l2,error:[$($Y,`NotFound`)]}),KN(`readProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:f2,success:P0,error:[$($Y,`NotFound`)]}),JN(`setProjectGitHubAccount`,`/api/projects/:projectId/github-account`,{disableCodecs:!0,params:f2,payload:u2,success:P0,error:[$($Y,`NotFound`)]}),KN(`readProjectPullRequest`,`/api/projects/:projectId/pull-requests/:number`,{disableCodecs:!0,params:p2,success:c2,error:[$($Y,`NotFound`)]}),KN(`readProjectPullChecks`,`/api/projects/:projectId/pull-requests/:number/checks`,{disableCodecs:!0,params:p2,success:d2,error:[$($Y,`NotFound`)]}),qN(`archivePullRequest`,`/api/projects/:projectId/pull-requests/:number/archive`,{disableCodecs:!0,params:p2,payload:f0,success:p0,error:[$($Y,`NotFound`),$(nX,`Conflict`,{message:{fromError:!0}})]})).middleware(CY)){},h2=class extends GY.addHttpApi(WX).addHttpApi(EQ).addHttpApi(A0).addHttpApi(h1).addHttpApi(e1).addHttpApi(s2).addHttpApi(m2).addHttpApi(t0){},g2=q({address:K,credential:cw(K),deviceId:W(K)}),_2=q({...g2.fields,environmentId:K,name:K,alternateRoutes:W(J(g2)),operationIdentity:W(K)});function v2({address:e,credential:t,deviceId:n}){return{address:e,credential:t,...n?{deviceId:n}:{}}}function y2(e){return[v2(e),...(e.alternateRoutes??[]).map(v2)]}function b2(e){return e.operationIdentity??(e.deviceId?JSON.stringify([e.environmentId,e.address,e.deviceId]):void 0)}function x2(e,t){let[n,...r]=t;if(!n)throw Error(`A saved environment needs at least one connection.`);return{environmentId:e.environmentId,name:e.name,...v2(n),...b2(e)?{operationIdentity:b2(e)}:{},...r.length?{alternateRoutes:r.map(v2)}:{}}}function S2(e){let t=URL.parse(e)?.hostname??``;return t.endsWith(`.ts.net`)?`Tailscale`:/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t)?`LAN`:`Network`}function C2(e){return JSON.stringify(zS(J(_2))(e))}function w2(e,t){if(t===void 0)return{kind:`checking`};if(t.kind===`reconnecting`)return{kind:`reconnecting`};if(t.kind===`foreign`)return{kind:`other-server`};if(t.kind===`unauthorized`)return{kind:`needs-pairing`};if(t.kind===`unreachable`)return{kind:`offline`};let{environment:n}=t;return n.environmentId===e.environmentId?n.protocol===4?{kind:`online`,name:n.name,version:n.version}:{kind:`incompatible`}:{kind:`other-server`}}function T2(e,t){let n=Reflect.get(e,t);return typeof n==`string`?n:void 0}function E2(e){if(!e||typeof e!=`object`)return;let t=T2(e,`address`),n=T2(e,`credential`),r=T2(e,`deviceId`);return t&&n?{address:t,credential:C_(n),...r?{deviceId:r}:{}}:void 0}function D2(e){if(!e||typeof e!=`object`)return[];let t=T2(e,`environmentId`),n=T2(e,`name`),r=E2(e),i=Reflect.get(e,`alternateRoutes`);return t&&n!==void 0&&r?[{environmentId:t,name:n,...r,...T2(e,`operationIdentity`)?{operationIdentity:T2(e,`operationIdentity`)}:{},...Array.isArray(i)?{alternateRoutes:i.flatMap(e=>{let t=E2(e);return t?[t]:[]})}:{}}]:[]}function O2(e){return Array.isArray(e)?e.flatMap(D2):[]}function k2(e,t){let n=e.find(e=>e.environmentId===t.environmentId);if(!n)return[...e,t];let r=y2(t),i=y2(n).map(e=>r.find(t=>t.address===e.address)??e);return i.push(...r.filter(e=>!i.some(t=>t.address===e.address))),[...e.filter(e=>e.environmentId!==t.environmentId),x2({...n,name:t.name},i)]}var A2=E_((e,t)=>e===t);function j2(e,t){return e.environmentId===t.environmentId&&e.address===t.address&&A2(e.credential,t.credential)&&e.deviceId===t.deviceId&&(e.alternateRoutes??[]).length===(t.alternateRoutes??[]).length&&(e.alternateRoutes??[]).every((e,n)=>{let r=t.alternateRoutes?.[n];return r!==void 0&&e.address===r.address&&e.deviceId===r.deviceId&&A2(e.credential,r.credential)})}function M2(e){switch(e.kind){case`checking`:return`Checking`;case`reconnecting`:return`Reconnecting`;case`online`:return`Online`;case`offline`:return`Offline`;case`needs-pairing`:return`Needs pairing`;case`other-server`:return`Another server`;case`incompatible`:return`Update needed`}}function N2(e){switch(e.kind){case`offline`:return`It did not answer. Check that it runs and that this device reaches its address.`;case`needs-pairing`:return`It no longer accepts this app. Run porcelain pair on it and add the new link.`;case`other-server`:return`Another Porcelain answers at this address now, so this app stays away from it.`;case`incompatible`:return`It runs a Porcelain this app cannot talk to. Update both to the same version.`;default:return}}var P2=class e extends dr()(`@porcelain/client/AccessStore`){static layer=kd(e,H(function*(){let e=yield*gJ,t=yield*SJ({initial:{remotes:[],missingCredentials:[]},read:e.read,write:e.write,messages:{beforeRead:`Saved environments must be read before changing them.`,readFailed:`Saved environments could not be read. Try reading them again.`,writeFailed:`The saved environments could not be updated. Read them again before making changes.`}});return{state:t.state,load:t.load,save:Um(`AccessStore.save`)(e=>t.write(t=>{let n=t.missingCredentials.find(t=>t.environmentId===e.environmentId),r=y2(e),i=n?.operationIdentity?{...e,operationIdentity:n.operationIdentity}:e;return B({remotes:k2(t.remotes,i),missingCredentials:t.missingCredentials.flatMap(t=>{if(t.environmentId!==e.environmentId)return[t];let n=t.routes.filter(e=>!r.some(t=>t.address===e.address));return n.length?[{...t,routes:n}]:[]})})})),route:Um(`AccessStore.route`)(e=>t.write(({remotes:t,missingCredentials:n})=>H(function*(){let r=t.find(t=>t.environmentId===e.environmentId);if(!r)return yield*U(new xJ({message:`That environment is no longer saved.`}));let i=y2(r),a=i.find(t=>t.address===e.address);if(!a)return yield*U(new xJ({message:`That connection is no longer saved.`}));let o=i.filter(t=>t.address!==e.address);if(e.kind===`remove`&&!o.length)return yield*U(new xJ({message:`Forget the environment to remove its last connection.`}));let s=x2(r,e.kind===`prefer`?[a,...o]:o);return{missingCredentials:n,remotes:t.map(t=>t.environmentId===e.environmentId?s:t)}}))),forget:Um(`AccessStore.forget`)(e=>t.write(t=>B({remotes:t.remotes.filter(t=>t.environmentId!==e),missingCredentials:t.missingCredentials.filter(t=>t.environmentId!==e)})))}}))},F2=class extends dr()(`@porcelain/client/ConnectionFactory`){},I2=class extends dr()(`@porcelain/client/RemoteConnectionFactory`){},L2=class e extends dr()(`@porcelain/client/AccessSession`){static layer=kd(e,H(function*(){let e=yield*F2,t=yield*ed,n,r=CP({connection:null,generation:0,writerIdentity:void 0});return{state:r,beginConnection:Um(`AccessSession.beginConnection`)((i=!1)=>V(()=>{if(i&&r.value.generation!==0)return null;let a=r.value.generation;return Um(`AccessSession.completeConnection`)(function*(i){if(a!==r.value.generation)return!1;let o=JSON.stringify(i.principal),s=r.value.connection?.environmentId===i.inventory.environmentId&&r.value.writerIdentity===o,c=n,l=r.value.connection;if(s||(c=yield*od(t,`sequential`),l=yield*e.local(i).pipe(am(ed,c))),a!==r.value.generation)return!s&&c&&(yield*cd(c,Iu)),!1;let u=n;return n=c,r.update(e=>({...e,connection:l,writerIdentity:o,generation:a+1})),u&&u!==n&&(yield*cd(u,Iu)),!0},bm)})),clear:Um(`AccessSession.clear`)(function*(){let e=n;n=void 0,r.update(e=>({...e,connection:null,writerIdentity:void 0,generation:e.generation+1})),e&&(yield*cd(e,Iu))},bm)}}))},R2=class e extends dr()(`@porcelain/client/RemoteConnections`){static layer=kd(e,H(function*(){let e=yield*I2,t=yield*ed,n=yield*eE(1),r=[],i=CP([]);return{state:i,synchronize:Um(`RemoteConnections.synchronize`)(a=>H(function*(){let n=yield*sp(a,n=>H(function*(){let i=r.find(e=>j2(e.remote,n));if(i)return{...i,remote:n};let a=yield*od(t,`sequential`);return{remote:n,connection:yield*e.open(n).pipe(am(ed,a)),scope:a}})),o=r.filter(e=>!n.some(t=>t.scope===e.scope));r=n,i.set(n.map(({remote:e,connection:t})=>({remote:e,connection:t}))),yield*sp(o,e=>cd(e.scope,Iu),{discard:!0})}).pipe(tE(n),bm))}}))},z2=Md(H(function*(){let e=yield*P2,t=yield*R2;yield*t.synchronize(e.state.value.remotes),yield*yD(Um(`RemoteConnections.subscribe`)(function*(t){yield*lm(V(()=>e.state.subscribe(({remotes:e})=>{kT(t,e)})),e=>V(e))})).pipe(rO(t.synchronize),Om({startImmediately:!0}))}));function B2(e,t,n){return(r,i)=>{let a=new URL(r,e),o=new Headers(i?.headers);return t&&a.pathname!==`/api/health`&&o.set(`authorization`,`Bearer ${T_(t)}`),n(a,{...i,headers:o,mode:`cors`,credentials:`omit`,redirect:`error`,cache:`no-store`})}}var V2=class extends Y()(`RequestError`,{status:XS,message:K,code:PJ.fields.code}){};function H2(e){return kd(cM,Op(cM,e=>e.pipe(mM(Vj(`http://porcelain.invalid`)),lM(am(_M,!1))))).pipe(Ld(zd(cX).pipe(Ld(Fd(wd(rX,(t,n)=>t instanceof URL?e(`${t.pathname}${t.search}`,n):Promise.reject(TypeError(`FetchHttpClient sends every request as a parsed URL.`))),wd(aX,{redirect:`error`,cache:`no-store`}))))))}function U2(e){let t=e.response;return t===void 0?B(new xJ({message:`Could not reach Porcelain. Try again.`,cause:e.reason._tag===`TransportError`?e.reason.cause:e})):Op(Hp(t.json,()=>void 0),e=>{let n=PS(PJ)(e);return new V2({status:t.status,message:qr(n)?n.success.message:`Request failed (${t.status})`,code:void 0})})}function W2(e){return Mp(e,e=>sj(e)?Cp(U2(e),U):U(e))}function G2(e,t){return t(W2(e))}var K2=class extends dr()(`@porcelain/client/PairingPlatform`){},cse=class extends GY.add(YJ(`live`).add(KN(`liveUpdates`,`/api/live`,{disableCodecs:!0,query:VZ.fields,success:HZ.pipe(oN({decode:()=>void 0}),aN(`SwitchingProtocols`))})).middleware(CY)){};function lse(e){let t;try{t=new URL(e.trim())}catch{return}return t.protocol===`http:`||t.protocol===`https:`?t.origin:void 0}function q2(e){let t;try{t=new URL(e.trim())}catch{return}if(t.protocol!==`http:`&&t.protocol!==`https:`)return;let n=J2(t.hash);if(!n)return;if(t.pathname===`/pair`)return{address:t.origin,...n};if(!$J(t.pathname))return;let[r=``]=(new URLSearchParams(t.hash.replace(/^#/,``)).get(`a`)??``).split(`,`),i=lse(r);return i===void 0?void 0:{address:i,...n}}function J2(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`c`),r=t.get(`e`);return n&&r?{code:n,environmentId:r}:null}var use=3e3,dse=8e3,fse=1e4,Y2=1e4,pse=1e4,mse=1e3,hse=1e3,gse=1e3,_se=3e4,X2=2500,vse=5e3,Z2=6e4,Q2=X(e=>CP(void 0)),yse=X(e=>Mk()),bse=sP(h2),$2=class e extends dr()(`@porcelain/client/BootstrapClient`){static layer=X(t=>Ld(kd(e,bse),H2(t)))},xse=X(e=>Nk($2.layer(e)));function Sse(e,t){return Nw(t)?{kind:`offline`}:w2(e,er(Bw(t)))}function e4(e,t){return H(function*(){let e=yield*$2,n=yield*W2(e.publicAccess.readEnvironment()).pipe(Np(`ConnectionError`,t=>W2(e.session.readSession()).pipe(Tp(U(t)))));return n.environmentId===t&&n.protocol===4&&(yield*W2(e.session.readSession())),{kind:`described`,environment:n}}).pipe(tm($2.layer(e)),Mp(e=>B(e instanceof V2&&e.status===401?{kind:`unauthorized`}:{kind:`unreachable`})),Wp(vse),Op(e=>Zn(e,()=>({kind:`unreachable`}))))}function t4(e,t){Q2(e.send).set({remote:t,revision:Symbol()})}var n4=Um(`Environments.readVerifiedRoute`)(function*(e,t,n){let r=B2(e.address,e.credential,n);return yield*H(function*(){return(yield*W2((yield*$2).publicAccess.readHealth())).environmentId===t?yield*e4(r,t):{kind:`foreign`}}).pipe(tm($2.layer(r)),Mp(()=>B({kind:`unreachable`})))}),Cse=Um(`Environments.readRoutes`)(function*(e,t){let n={kind:`unreachable`};for(let r of y2(t)){let i=yield*n4(r,t.environmentId,e.send).pipe(Wp(X2),Op(e=>Zn(e,()=>({kind:`unreachable`}))));if(w2(t,i).kind===`online`)return i;i.kind!==`unreachable`&&(n=i)}return n}),wse=X(({platform:e,remote:t})=>{let{send:n,statusActivity:r}=e;return yse(e)(Ed).atom(()=>{let i=!1,a=!1,o=!1,s,c=yD(e=>H(function*(){let s=t=>{t&&(o=t===`suspend`);let n=!o&&(r?.isActive()??!0),s=n&&!a;a=n,n&&!s&&i||kT(e,n)};yield*lm(V(()=>{let e=r?.subscribe(s),i=Q2(n).subscribe(()=>{let e=Q2(n).value;e&&j2(e.remote,t)&&s()});return()=>{e?.(),i?.()}}),e=>V(e)),s()}),{bufferSize:1,strategy:`sliding`}),l=H(function*(){i=!0;let n=yield*Cse(e,t);return s=n,n}).pipe(fm(V(()=>{i=!1})));return c.pipe(LD(e=>e?CD(()=>s?.kind===`unreachable`?BD(SD({kind:`reconnecting`}),hD(l)):hD(l)).pipe(zD(Zf(_se))):MD))}).pipe(pk(0))});function Tse(e,t){return wse({platform:e,remote:t})}var Ese=X(({platform:e,remote:t,connection:n})=>bk(r=>{let i=n?.liveUpdates.state;i&&r.addFinalizer(i.subscribe(()=>r.refreshSelf()));let a=Sse(t,r(Tse(e,t)));return i?.value===`connected`?a.kind===`online`?a:{kind:`online`,name:t.name}:i?.value===`unauthorized`?{kind:`needs-pairing`}:a.kind===`other-server`||a.kind===`incompatible`?a:i?.value===`reconnecting`?{kind:`reconnecting`}:i?.value===`connecting`?a.kind===`offline`?a:{kind:`checking`}:a}));function r4(e,t,n){return Ese({platform:e,remote:t,connection:n})}function i4(e){return e instanceof V2?!0:e instanceof xJ?!1:e._tag===`InvalidPairingError`||e._tag===`InvalidDeviceDetailsError`}function Dse(e,t,n){return H(function*(){let r=q2(t);if(!r)return yield*U(new xJ({message:`Paste the whole link porcelain pair printed, starting with http.`}));if(n&&r.environmentId!==n)return yield*U(new xJ({message:`That pairing link belongs to another computer. Add it as a separate environment.`}));let i=B2(r.address,void 0,e.send);if((yield*W2(H(function*(){return yield*(yield*$2).publicAccess.readHealth()}).pipe(tm($2.layer(i))))).environmentId!==r.environmentId)return yield*U(new xJ({message:`Another Porcelain answered at that address than the one that made the link.`}));let a=yield*W2(H(function*(){return yield*(yield*$2).pairing.redeemPairing({payload:{code:r.code,platform:e.name()}})}).pipe(tm($2.layer(i)))).pipe(Fp(e=>i4(e)?new xJ({message:`That link was not accepted. It works once, for a few minutes; run porcelain pair again.`}):e instanceof xJ?new xJ({message:`Could not reach ${r.address}. Check that Porcelain runs there and that this device reaches it.`,cause:e.cause}):e));if(!a.credential)return yield*U(new xJ({message:`The remote paired but sent no credential.`}));let o=C_(a.credential),s=w2(r,yield*e4(B2(r.address,o,e.send),r.environmentId));return s.kind===`online`?{environmentId:r.environmentId,address:r.address,name:s.name,credential:o,deviceId:a.device.id}:yield*U(new xJ({message:s.kind===`other-server`?`Another Porcelain answered at that address than the one that made the link.`:s.kind===`incompatible`?`That Porcelain runs a version this app cannot talk to. Update both to the same version.`:`The remote paired but did not answer afterwards. Try again.`}))})}var Ose=Um(`Environments.pairAndSave`)(function*(e,t){let n=yield*P2,r=yield*_J;if(n.state.value.status!==`ready`)return yield*U(new xJ({message:`Read saved environments before pairing.`}));let i=n.state.value.missingCredentials.find(t=>t.environmentId===q2(e)?.environmentId);if(i&&!i.routes.some(t=>t.address===q2(e)?.address))return yield*U(new xJ({message:`Use a pairing link for the connection whose credential is missing.`}));let a=yield*Dse(r,e,t);return yield*n.save(a),a}),kse=Um(`BrowserSession.pair`)(function*(e){let t=yield*K2,n=yield*$2;if((yield*W2(n.publicAccess.readHealth()).pipe(Fp(e=>!(e instanceof xJ)&&!(e instanceof V2)&&e._tag!==`MissingEnvironmentIdentityError`?new xJ({message:`That address answered, but it is not a Porcelain server.`}):new xJ({message:`Could not reach Porcelain. Check that the server is running, then open the link again.`,cause:e})))).environmentId!==e.environmentId)return yield*U(new xJ({message:`This link was made for a different Porcelain installation.`}));let r=yield*W2(n.pairing.redeemPairing({payload:{code:e.code,platform:t.name()}})).pipe(Fp(e=>i4(e)?new xJ({message:`This pairing link is not usable. Ask for a new one.`}):e));return{inventory:yield*W2(n.projects.readInventory()).pipe(Fp(e=>e instanceof V2?new xJ({message:`Pairing succeeded but the workspace could not be loaded. Reload the page.`}):e)),principal:{kind:`device`,deviceId:r.device.id}}}),Ase=X(({transport:e,platform:t})=>Nk(Fd($2.layer(e),wd(K2,t))).fn(e=>kse(e))),a4=X(e=>{class t extends dr()(`@porcelain/client/HttpClient`){static runtime=e.atoms(kd(t,Op(sP(h2),t=>({request:(n,r)=>G2(n(t),t=>e.request(t,r))}))).pipe(Ld(H2(e.transport))))}return t}),o4=Um(`Client.requestApi`)(function*(e,t){return yield*(yield*a4(e)).request(t)}),s4=X(e=>e.atoms(t=>Fd(t(a4(e).runtime.layer),jd(e.runtime.contextEffect)))),c4=class e extends dr()(`@porcelain/client/AccessSnapshots`){static layer=kd(e,H(function*(){return{sharing:yield*ej(Kn()),remote:yield*ej(Kn()),update:yield*ej(Kn())}}))},l4=X(e=>e.atoms(t=>Rd(c4.layer,t(s4(e).layer))));function jse(){return new xJ({message:`The connected context changed. Reopen Porcelain to continue safely.`})}function u4(e,t=!0){return fp(()=>e.isClosed()?_m:d4(t))}function d4(e=!0){return e?pp:U(jse())}function Mse(e){return e instanceof qY}var f4=[`lan`,`tailnet`,`cloudflare`],p4={lan:`Local network`,tailnet:`Tailscale`,cloudflare:`Cloudflare tunnel`},Nse={lan:`Devices on this network.`,tailnet:`Encrypted access through your Tailscale network.`,cloudflare:`HTTPS through your existing tunnel.`},m4={loopback:`This computer`,lan:`Local network`,tailnet:`Tailscale`,tunnel:`Cloudflare tunnel`};function Pse(e){return`This device is connected through ${p4[e]}, so it cannot change it. Change it on the computer that runs Porcelain, or from a device connected another way.`}var Fse=`Anyone on the same network can read what Porcelain shows and the device credentials it sends. For an encrypted connection, use Tailscale.`,Ise=/^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/,Lse=/^::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}$/;function Rse(e,t){let n=new URL(e).hostname.replace(/^\[|\]$/g,``).replace(/\.$/,``);return n===`localhost`||n.endsWith(`.localhost`)||n===`::1`||t.includes(n)||Ise.test(n)||Lse.test(n)}function zse(e){return e.route!==`loopback`||e.canEditWaysIn}function Bse(e,t=[]){return Rse(e,t)?`Use the computer running Porcelain to manage ways in, or pair over the local network or an existing encrypted route.`:`Turn on Manage sharing for this device in Computers → Devices, from a computer with sharing access.`}function h4(e){return`${e.subnet} on ${e.interfaceName}`}function g4(e){let{lan:t}=e.routes,n=e.localNetwork,r=e.lanNetwork,i=`Porcelain cannot tell this network from another one yet, because the hardware address of its router is not known.`;return t.enabled?t.status.kind===`paused`?n?n.gatewayHardware?r?h4(r)===h4(n)?`Paused on this network. It looks like ${h4(r)}, but its router is another one, so this is another network; turn it on for this network to listen here.`:`Paused on this network. It was turned on for ${h4(r)}, and listens again there, or here once you turn it on for this network.`:`Paused on this network. It was turned on before Porcelain kept the network it was turned on for; turn it on for this network to listen here.`:`Paused. ${i}`:r?`Paused: this computer is not on a local network. Porcelain listens again when it is back on ${h4(r)}.`:`Paused: this computer is not on a local network.`:r?`Listening on ${h4(r)} only.`:`Listening on this network only.`:n?n.gatewayHardware?`Turning it on listens on ${h4(n)} only, and pauses on any other network.`:`${i} Try again in a moment.`:`This computer is not on a local network right now.`}function Vse(e){return e?f4.some(t=>{let n=e.routes[t];return n.enabled?n.status.kind===`starting`||n.status.kind===`off`:n.status.kind!==`off`}):!1}function Hse(e){return e===void 0?[]:f4.flatMap(t=>{let{status:n}=e.routes[t];return n.kind===`on`?n.urls.map(e=>({route:t,url:e})):[]})}function Use(e){let[t]=e.grants;return t?{id:t.grant.id,label:t.grant.label,address:t.link.addresses[0],link:eY(t.link),expiresAt:t.grant.expiresAt}:null}function Wse(e){return`tailscale serve --bg --https=443 ${e}`}var Gse={lan:`Starting`,tailnet:`Checking the Tailscale name`,cloudflare:`Checking the tunnel`};function Kse(e,t){switch(t.status.kind){case`off`:return t.enabled?`Starting`:null;case`starting`:return Gse[e];case`paused`:return`Paused on this network`;case`failed`:return`Failed`;case`on`:return t.enabled?`On`:`Stopping`}}var qse={tailnet:{label:`Tailscale name`,saveLabel:`Save name`,placeholder:`laptop.tail1234.ts.net`},cloudflare:{label:`Public hostname`,saveLabel:`Save hostname`,placeholder:`porcelain.example.com`}};function _4(e,t){return(t===`tailnet`?e.tailnetHostname:e.cloudflareHostname)??``}function Jse(e,t){let{enabled:n,status:r}=e.routes[t];return n&&r.kind===`failed`}function Yse(e,t,n){let r=_4(e,t)===``;return t===`tailnet`?{tailnetHostname:n,...r?{tailnet:!0}:{}}:{cloudflareHostname:n,...r?{cloudflare:!0}:{}}}function Xse(e,t,n){let r=_4(e,t),i=n??r,a=i.trim();return{...qse[t],value:i,canSave:a!==``&&a!==r,save:Yse(e,t,a),failed:Jse(e,t),check:t===`tailnet`?{tailnet:!0}:{cloudflare:!0}}}function Zse(e,t){let n=`Your devices may reach that program instead of Porcelain: run tailscale serve --https=443 off now, then turn Tailscale off and on here to pick a free port and run the new command Porcelain names.`;switch(t){case`address-in-use`:return e===`tailnet`?`Another program already listens on the port Tailscale forwards to. ${n}`:`Another program already listens on this port.`;case`address-unavailable`:return e===`tailnet`?`Porcelain could not open the local listener Tailscale forwards to. ${n}`:`This computer could not listen at its address.`;case`unreachable`:return e===`tailnet`?`Nothing answered at this Tailscale name yet. Check that you ran the command below, that Tailscale is connected on this computer and uses MagicDNS, and that MagicDNS and HTTPS Certificates are on in the Tailscale admin console. Porcelain keeps checking.`:`Nothing answered at this hostname. Check that cloudflared is running and routes it here.`;case`other-server`:return e===`tailnet`?`Another server answered at this Tailscale name. Run the command below so Tailscale forwards to this Porcelain; Porcelain keeps checking.`:`Another server answered at this hostname.`}}function v4(e){return jw(e)?e.value:void 0}function Qse(e,t,n){return H(function*(){let r=yield*Dp(n.pipe(Ep(()=>u4(e))));if(Ru(r)&&Eu(r.cause))return yield*_m;if(Lu(r))yield*nj(t,qn(r.value));else{let e=er(Tu(r.cause));e instanceof V2&&e.status===401&&(yield*nj(t,Kn()))}return Ew(r,ir(yield*tj(t),Mw))})}function y4(e,t,n,r){let i=e.atom(e=>{let i=ar(e.self(),Bw);return ND(Op(r,e=>BD(xD(Dw(i)),hD(t).pipe(zD(Zf(n)),YD(t=>!e(er(Bw(t))))))))}).pipe(Zk(e=>Ww(e,e=>e)));return nA(i).pipe(Yk((e,t)=>{let n=e(t);return e(i).waiting?Dw(qn(n)):n}),pk(0))}function b4(e,t,n){return Cp(c4,r=>Qse(e,t(r),n))}function x4(e){return e.pipe(Mp(e=>e instanceof V2&&e.status===403||I(e,`WaysInPermissionRequiredError`)||I(e,`SharingManagementRequiredError`)?B(null):U(e)))}var S4=X(e=>y4(l4(e),b4(e,e=>e.sharing,x4(o4(e,e=>e.administration.listAccess()))),gse,B(()=>!0))),C4=X(e=>y4(l4(e),b4(e,e=>e.remote,x4(o4(e,e=>e.remoteAccess.readRemoteAccess()))),mse,B(Vse))),w4=X(e=>y4(l4(e),b4(e,e=>e.update,o4(e,e=>e.serviceUpdates.readServiceUpdate())),hse,H(function*(){let e=er(yield*tj((yield*c4).update)),t=e?.running?e.last?.target:void 0;return e=>e?.managed===!0?e.running?(t=e.last?.target,!0):t!==void 0&&e.last?.stage===`updated`&&e.last.target===t&&e.version===e.last.from&&e.version!==t:!1})));function $se(e){return H(function*(){let t=yield*a4(e),n=yield*bJ,r=yield*c4,i=yield*UO;function a(t,r){return n.run([t],H(function*(){yield*u4(e);let t=yield*r;return yield*u4(e),t}))}function o(t){return V(()=>{e.isClosed()||i.refresh(t)})}function s(e,t,n){return um(V(()=>{let t=i.mount(e),n=Ck(Mw(i.get(e),{waiting:!0}));return i.set(e,n),{transition:n,unmount:t}}),({transition:e})=>n.pipe(Ep(n=>H(function*(){yield*nj(t,qn(n)),i.set(e,Mw(Mw(n),{waiting:!0}))}))),({transition:e,unmount:t},n)=>V(()=>{i.set(e,Lu(n)?Mw(Mw(n.value)):Pw(n.cause)),t()}))}return{issue:n=>a(`paired-access`,t.request(e=>e.administration.issuePairing({payload:{labels:[n.label],addresses:n.addresses,...n.trusted?{trusted:!0}:{},canManageSharing:n.canManageSharing===!0}})).pipe(Ep(()=>o(S4(e))))),revoke:n=>a(`paired-access`,t.request(e=>e.administration.revokeAccess({payload:{id:n}})).pipe(fm(o(S4(e))))),trust:n=>a(`paired-access`,t.request(e=>e.administration.setDeviceTrust({payload:n})).pipe(fm(o(S4(e))))),allowManagement:n=>a(`paired-access`,t.request(e=>e.administration.setManagementPermission({payload:n})).pipe(fm(o(S4(e))))),allowWaysIn:n=>a(`paired-access`,t.request(e=>e.administration.setWaysInPermission({payload:n})).pipe(fm(o(S4(e))))),setRemote:n=>a(`remote-access`,s(C4(e),r.remote,t.request(e=>e.remoteAccess.setRemoteAccess({payload:n})).pipe(Ep(()=>u4(e)),Lp(()=>o(C4(e)))))),startUpdate:n=>a(`service-update`,s(w4(e),r.update,t.request(e=>e.serviceUpdates.startServiceUpdate({payload:{version:n}})).pipe(Ep(()=>u4(e)),Lp(()=>o(w4(e))))))}})}var T4=class e extends dr()(`@porcelain/client/AccessCommands`){static layer(t){return kd(e,$se(t))}},E4=X(e=>e.atoms(t=>Rd(T4.layer(e),t(l4(e).layer)))),ece=X(e=>E4(e).fn(e=>T4.use(t=>t.issue(e)).pipe(Op(Use)),{concurrent:!0})),tce=X(({connection:e,id:t})=>E4(e).fn(()=>T4.use(e=>e.revoke(t)),{concurrent:!0})),nce=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.trust({id:t,trusted:e})),{concurrent:!0})),rce=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.allowWaysIn({id:t,allowed:e})),{concurrent:!0})),ice=X(e=>E4(e).fn(e=>T4.use(t=>t.setRemote(e)),{concurrent:!0})),ace=X(e=>E4(e).fn(e=>T4.use(t=>t.startUpdate(e)),{concurrent:!0})),oce=X(({connection:e,id:t})=>E4(e).fn(e=>T4.use(n=>n.allowManagement({id:t,allowed:e})),{concurrent:!0})),D4={withIdentity:(e,t)=>[...e,...t.cacheIdentity??[]],worktreeSurface:(e,t,n)=>D4.withIdentity(D4.reviewSurface(e.environmentId,t,n),e),worktreeReads:(e,t,n)=>[D4.environment(e.environmentId),D4.review(e.environmentId,t),D4.reviewSurface(e.environmentId,t,n.slice(0,1)),D4.reviewSurface(e.environmentId,t,n)],connectedInventory:e=>D4.withIdentity(D4.inventory(e.environmentId),e),projectPullRequests:(e,t)=>[`project-pull-requests`,e,...t?[t]:[]],environment:e=>[`environment`,e],reviewGitSettings:e=>[`review-git-settings`,e],filePreferences:(e,t)=>[`review`,e,t,`file-preferences`],inventory:e=>[`inventory`,e],worktreeInventory:e=>[`worktree-inventory`,e],reviewProject:(e,t)=>[`review`,e,t],review:(e,t)=>[...D4.reviewProject(e,t.projectId),t.worktreeId],reviewSurface:(e,t,n)=>[...D4.review(e,t),...n]},O4=new Set([`changes`,`directory`,`text`,`paths`,`git-status`,`asset`,`html-preview`,`step-lines`]),k4=new Set([`changes`,`git-status`,`paths`,`step-lines`]);function A4(e,t,n,r=Kn(),i=[t,D4.environment(e.environmentId)]){return H(function*(){let a=yield*bJ,o=yield*uO,s=yield*MO({epoch:0,result:Xn(r,{onNone:()=>Aw(),onSome:e=>Mw(e)})}),c=(t=n,r=!1)=>H(function*(){let n=(yield*PO(s)).epoch;yield*RO(s,e=>({...e,result:Lw(e.result)}));let i=yield*Dp(t.pipe(Ep(()=>u4(e))));yield*RO(s,e=>e.epoch===n?{...e,epoch:e.epoch+ +!!r,result:Ew(i,qn(e.result))}:e)});function l(n,r){return a.run(D4.withIdentity(t,e),H(function*(){yield*u4(e),yield*RO(s,e=>({...e,epoch:e.epoch+1}));let t=yield*n;return yield*u4(e),yield*RO(s,e=>({epoch:e.epoch+1,result:Xn(r(Bw(e.result),t),{onNone:()=>e.result,onSome:e=>Mw(e)})})),t}).pipe(fm(o.invalidate([t]))))}return{confirm:l,refresh:e=>H(function*(){yield*RO(s,e=>({...e,epoch:e.epoch+1})),yield*c(e,!0)}),stream:UD(NO(s).pipe(PD(e=>e.result)),o.stream(i,c()).pipe(RD))}})}var j4=Br(`@porcelain/client/InventorySeed`,{defaultValue:()=>Kn()}),M4=class e extends dr()(`@porcelain/client/InventoryState`){static layer(t){return kd(e,H(function*(){let e=yield*j4,n=yield*a4(t),r=e=>u4(t,e.environmentId===t.environmentId),i=n.request(e=>e.projects.readInventory()),a=yield*A4(t,D4.inventory(t.environmentId),i.pipe(Ep(r)),e,[D4.inventory(t.environmentId),D4.environment(t.environmentId),D4.worktreeInventory(t.environmentId)]);function o(e,t){return a.confirm(e,(e,n)=>ir(e,e=>t(e,n)))}return{stream:a.stream,confirm:o,refresh:()=>a.refresh(n.request(e=>e.projects.refreshInventory()).pipe(Np(`RequestError`,e=>e.status===404?i:U(e)),Ep(r)))}}))}},N4=X(e=>e.atoms(t=>Rd(M4.layer(e),t(s4(e).layer))));function P4(e){return X(t=>N4(t).fn(n=>H(function*(){let r=yield*a4(t);return yield*(yield*M4).confirm(r.request(t=>e(t.environmentLabel,n)),(e,t)=>({...e,environment:t}))}),{concurrent:!0}))}var sce=P4((e,t)=>e.renameEnvironment({payload:{name:t}})),cce=P4((e,t)=>e.setEnvironmentIcon({payload:{icon:t}})),lce=Um(`BrowserSession.restore`)(function*(){let e=yield*$2;return{principal:yield*W2(e.session.readSession()),inventory:yield*W2(e.projects.readInventory())}},Mp(e=>e instanceof V2&&e.status===401?B(null):U(e instanceof V2||DS(e)?new xJ({message:`Could not reach Porcelain to restore this browser session.`,cause:e}):e))),uce=X(e=>xse(e).atom(lce())),F4=`Save or discard unsaved file drafts before disconnecting.`;function I4(e){return e instanceof Error&&(e.name===`ConnectionError`||e.name===`RequestError`||`_tag`in e)?e.message:`Could not connect to the environment. Try again.`}var L4=class extends dr()(`@porcelain/client/FileDraftWriter`){},dce=Br(`@porcelain/client/FileDraftTiming`,{defaultValue:()=>({autosave:qi(use),diskNotice:qi(dse)})}),R4=class e extends dr()(`@porcelain/client/FileDraft`){static layer(t,n){return kd(e,H(function*(){let e=yield*L4,r=yield*dce,i=CP({text:t.text,savedText:t.text,fingerprint:t.fingerprint,saving:!1,owner:null,error:null,diskChanged:new Set}),a=CP(!1),o=CP(null),s=yield*uJ(void 0),c=yield*eE(1),l=yield*ej(void 0),u=yield*uJ(new Map),d=CP(new Map),f=e=>i.update(t=>({...t,...e})),p=()=>e.isBlockedError?e.isBlockedError(i.value.error):i.value.error instanceof DQ,m=H(function*(){let e=yield*rj(l,void 0);e&&(yield*Jw(e))}),h=e=>{i.value.owner===e&&f({owner:null})},g=e=>{let t=new Set(i.value.diskChanged);t.delete(e),f({diskChanged:t})},_=Um(`FileDraft.forgetDiskChange`)(function*(e){let t=yield*fJ(u,t=>{let n=new Map(t);return n.delete(e),[t.get(e),n]});t&&(yield*Jw(t)),g(e)}),v=Um(`FileDraft.save`)(function*(){return yield*c.withPermit(m),yield*yield*pJ(s,t=>t?B([Kw(t),t]):a.value||p()?B([B(!1),void 0]):i.value.text===i.value.savedText?B([B(!0),void 0]):(f({saving:!0,error:null}),Op(Dm(H(function*(){for(;i.value.text!==i.value.savedText;){let t=i.value.text,n=yield*e.write(t,i.value.fingerprint);o.set(n),f({savedText:t,fingerprint:n})}return!0}).pipe(Pp(e=>V(()=>(f({error:wu(e)}),!1))),fm(xp.pipe(Tp(mJ(s,void 0)),Tp(V(()=>f({saving:!1})))))),n,{startImmediately:!0}),e=>[Kw(e),e])))});return yield*ad(n,V(()=>{a.set(!0),d.set(new Map)})),{state:i,get blocked(){return p()},claim(e){return a.value||i.value.owner!==null&&i.value.owner!==e?!1:(f({owner:e}),!0)},release:h,attachEditor:e=>{a.value||d.update(t=>new Map(t).set(e,Symbol(e)))},finishEditing:Um(`FileDraft.finishEditing`)(function*(e,t,n=()=>{}){let r=d.value.get(e);r&&(yield*xp,a.value||d.value.get(e)!==r||(d.update(t=>{let n=new Map(t);return n.delete(e),n}),n(),h(e),(i.value.saving||!i.value.error)&&(yield*v()),i.value.text!==i.value.savedText&&t()))}),noticeDiskChange:Um(`FileDraft.noticeDiskChange`)(function*(e,t){yield*pJ(u,s=>{if(a.value||i.value.saving||i.value.owner!==null||s.has(e)||o.value===t)return B([void 0,s]);f({diskChanged:new Set([...i.value.diskChanged,e])});let c;return Op(Dm(qp(r.diskNotice).pipe(Tp(hJ(u,t=>{if(t.get(e)!==c)return t;let n=new Map(t);return n.delete(e),g(e),n}))),n,{startImmediately:!0}),t=>(c=t,[void 0,new Map(s).set(e,t)]))})}),forgetDiskChange:_,change:Um(`FileDraft.change`)(function*(e){a.value||i.value.text===e||(f({text:e}),yield*c.withPermit(H(function*(){if(yield*m,a.value)return;let e=yield*Dm(qp(r.autosave).pipe(Tp(nj(l,void 0)),Tp(v()),jp),n,{startImmediately:!0});yield*nj(l,e)})))}),reset:Um(`FileDraft.reset`)(function*(e,t){yield*c.withPermit(H(function*(){a.value||i.value.saving||(yield*m,f({text:e,savedText:e,fingerprint:t,error:null}))}))}),refresh:Um(`FileDraft.refresh`)(function*(e,t){yield*c.withPermit(V(()=>{let n=i.value;a.value||!t||n.saving||n.text!==n.savedText||n.fingerprint===t||f({text:e,savedText:e,fingerprint:t,error:null})}))}),save:v,dispose:()=>fp(()=>(a.set(!0),cd(n,Iu)))}}))}},z4=(e,t)=>`${JSON.stringify([e.projectId,e.worktreeId])}/${t}`,B4=class e extends dr()(`@porcelain/client/FileDrafts`){static layer=kd(e,H(function*(){let e=yield*om,t=CP(new Map),n=CP(new Map),r=e=>t.value.get(e)??new Map,i=(e,n)=>t.update(t=>{let r=new Map(t);return n.size?r.set(e,n):r.delete(e),r});return{entries:e=>new Map([...r(e.environmentId)].map(([e,t])=>[e,t.draft])),retain:Um(`FileDrafts.retain`)(function*(t){let n=z4(t.scope,t.path),a=r(t.environmentId).get(n);if(a)return yield*a.draft.refresh(t.text,t.fingerprint),a.draft;let o=yield*od(e),s=CP(t.path),c=Nr(yield*Sd(R4.layer(t,o).pipe(Ld(wd(L4,{...t.writer,write:(e,n)=>t.writer.write({path:s.value,text:e,expectedFingerprint:n})})))).pipe(am(ed,o)),R4);return i(t.environmentId,new Map(r(t.environmentId)).set(n,{scope:o,draft:c,path:s})),yield*ad(o,V(()=>i(t.environmentId,new Map([...r(t.environmentId)].filter(([,e])=>e.scope!==o))))),c}),adopt:e=>{n.update(t=>new Map(t).set(e.environmentId,e))},connection:e=>n.value.get(e.environmentId)??e,hasUnsaved:e=>e.some(e=>[...r(e).values()].some(({draft:e})=>e.state.value.saving||e.state.value.text!==e.state.value.savedText)),hasUnsavedWorktree:(e,t)=>[...r(e)].some(([e,{draft:n}])=>e.startsWith(z4(t,``))&&(n.state.value.saving||n.state.value.text!==n.state.value.savedText||n.blocked)),save:Um(`FileDrafts.save`)(function*(e){for(let{draft:t}of r(e).values())if(!(yield*t.save()))return!1;return!0}),drop:Um(`FileDrafts.drop`)(function*(e){let t=[...r(e).values()];i(e,new Map),n.update(t=>{let n=new Map(t);return n.delete(e),n}),yield*sp(t,e=>cd(e.scope,Iu),{concurrency:`unbounded`,discard:!0})}),relocate:Um(`FileDrafts.relocate`)(function*(e,t,n,a){let o=r(e),s=new Map(o),c=[],l=z4(a,n.path);for(let e of t){let t=o.get(e);if(t){if(s.delete(e),n.kind===`move`){let r=`${n.destination}${e.slice(l.length)}`;t.path.set(r),s.set(z4(a,r),t)}else c.push(t)}}i(e,s),yield*sp(c,e=>cd(e.scope,Iu),{concurrency:`unbounded`,discard:!0})})}}))},V4=X(e=>e.atoms(B4.layer)),fce=X(e=>V4(e).atom(B4)),pce=X(e=>e.atoms(t=>Fd(t(a4(e).runtime.layer),B4.layer)).fn(Um(`BrowserSession.disconnect`)(function*(){let t=yield*B4,n=yield*a4(e);if(!(yield*t.save(e.environmentId)))return yield*U(new xJ({message:F4}));yield*n.request(e=>e.browserAccess.clearBrowserSession())},Fp(e=>e instanceof xJ?e:new xJ({message:`Could not disconnect. Check the connection and try again.`,cause:e}))))),mce=Um(`BrowserSession.connect`)(function*(e,t,n,r){let i=yield*L2,a=yield*i.beginConnection(),o=yield*um(V(()=>e.set(t,n)),()=>GO(e,t,{suspendOnWaiting:!0}),()=>V(()=>e.set(t,Vk))).pipe(Gp({duration:r,orElse:()=>_m}),Pp(e=>U(new xJ({message:I4(wu(e)),cause:wu(e)}))));if(a&&(yield*a(o)),i.state.value.connection?.environmentId!==o.inventory.environmentId)return yield*U(new xJ({message:`Could not connect to the environment. Try again.`}))}),hce=Um(`BrowserSession.restoreConnection`)(function*(e,t){let n=yield*L2;if(n.state.value.connection)return!0;let r=yield*n.beginConnection(!0);if(!r)return!1;let i=e.get(t);Nw(i)&&!i.waiting&&e.refresh(t);let a=yield*GO(e,t,{suspendOnWaiting:!0});return a!==null&&(yield*r(a),n.state.value.connection!==null)}),H4=class e extends dr()(`@porcelain/client/EnvironmentMutations`){static layer=kd(e,H(function*(){let e=yield*eE(1),t=CP(0);return{pendingSelections:t,run:(n,r)=>um(V(()=>{n===`selection`&&t.update(e=>e+1)}),()=>e.withPermit(r),()=>V(()=>{n===`selection`&&t.update(e=>e-1)}))}}))},U4=class extends dr()(`@porcelain/client/WorkspaceSelectionCleanup`){},gce=H(function*(){let e=yield*P2,t=yield*_J,n=yield*H4,r=yield*B4,i=yield*U4;return{read:Um(`Environments.read`)(()=>n.run(`access`,e.load())),pair:Um(`Environments.pair`)(r=>n.run(`access`,H(function*(){return r.localEnvironmentId&&q2(r.value)?.environmentId===r.localEnvironmentId?yield*U(new xJ({message:`That link is for this computer.`})):yield*Ose(r.value,r.environmentId).pipe(am(P2,e),am(_J,t))}))),route:Um(`Environments.route`)(t=>n.run(`access`,H(function*(){if(!(yield*r.save(t.environmentId)))return yield*U(new xJ({message:F4}));yield*e.route(t)}))),forget:Um(`Environments.forget`)(t=>n.run(`selection`,H(function*(){if(!(yield*r.save(t)))return yield*U(new xJ({message:F4}));yield*H(function*(){yield*e.forget(t),yield*i.forgetEnvironment(t),yield*r.drop(t)}).pipe(bm)})))}}),W4=class e extends dr()(`@porcelain/client/EnvironmentCommands`){static layer=kd(e,gce)};function G4(e){return e.kind===`service`?e.state.managed&&e.state.available&&e.state.latest!==void 0:e.available&&e.latest!==void 0}function _ce(e,t){return t.running||e.some(G4)}function K4(e){if(e.kind===`mac-app`)return G4(e)?e.latest:void 0;let{state:t}=e;return G4(e)&&t.managed&&t.canUpdate&&!t.running?t.latest:void 0}function vce(e){if(e.state.managed&&!e.state.canUpdate)return{label:`Needs trust`,deviceId:e.deviceId,hint:e.deviceId?`Run porcelain trust ${e.deviceId} on that computer, or allow it in the Mac app → Computers → This computer → Devices`:`Find this device’s id with porcelain devices on that computer, then run porcelain trust <id>, or allow it in the Mac app → Computers → This computer → Devices`}}function yce(e){let t=new Set;for(let n of e)K4(n)!==void 0&&t.add(`${n.kind}:${n.id}`);return t.size}function bce(e){let t=e.entries.findIndex(e=>e.status===`updating`);return{total:e.entries.length,current:t<0?void 0:t+1,label:t<0?void 0:`Updating ${t+1} of ${e.entries.length}`}}var q4=Ck({running:!1,entries:[]}).pipe(Jk),J4=class extends Y()(`SettingsUpdateError`,{message:K}){},xce=Um(`updateSettingsTarget`)(function*(e,t,n){if(e.kind===`mac-app`)return yield*e.update(t);let r=ace(e.connection),i=n.mount(r);yield*dm(()=>V(i)),n.set(r,t),yield*GO(n,r,{suspendOnWaiting:!0});let a=yield*WO(n,w4(e.connection)).pipe(PD(e=>{if(Nw(e)){let t=wu(e.cause);return t instanceof V2&&(t.status===401||t.status===403)?qn({status:`failed`,message:`Could not confirm the update: access to this computer was denied (${t.status}). Pair or trust this device again.`}):Kn()}if(!jw(e))return Kn();let n=e.value;return n.managed?n.running?Kn():n.version===t?qn({status:`updated`}):n.last?.target===t&&n.last.stage===`failed`?qn({status:`failed`,message:n.last.reason??`The updater gave no reason.`}):Kn():qn({status:`failed`,message:`This computer no longer runs the managed service.`})}),KD(Yn),PD(e=>e.value),nO);if(Jn(a))return yield*new J4({message:`The update stopped before completion.`});if(a.value.status===`failed`)return yield*new J4({message:a.value.message})}),Sce=Hk((e,t)=>H(function*(){let n=t.registry;if(n.get(q4).running)return;let r=[],i=new Set;for(let t of e){let e=K4(t),n=`${t.kind}:${t.id}`;e===void 0||i.has(n)||(i.add(n),r.push({target:t,version:e}))}if(r.sort((e,t)=>Number(e.target.kind===`mac-app`)-Number(t.target.kind===`mac-app`)),r.length===0)return;let a=r.map(({target:e,version:t})=>({id:e.id,name:e.name,kind:e.kind,version:t,status:`queued`})),o=e=>n.set(q4,{running:e,entries:a});o(!0),yield*H(function*(){for(let[e,{target:t,version:i}]of r.entries()){a=a.map((t,n)=>n===e?{...t,status:`updating`}:t),o(!0);let r=yield*Dp(xce(t,i,n).pipe(sm)),s=Ru(r)?wu(r.cause):void 0;a=a.map((t,n)=>n===e?Lu(r)?{...t,status:`updated`}:{...t,status:`failed`,message:s instanceof Error?s.message:`The update failed.`}:t),o(!0)}}).pipe(fm(V(()=>{a=a.map(e=>e.status===`queued`||e.status===`updating`?{...e,status:`failed`,message:`The update was interrupted.`}:e),o(!1)})))}),{concurrent:!0}).pipe(Jk),Y4=cP(cse).live.liveUpdates,Cce=cP(TQ).pairing.redeemPairing,X4=new Set;function wce(e){return X4.add(e),()=>X4.delete(e)}function Z4(){for(let e of[...X4])e()}function Q4(e,t={}){return async(n,r)=>{let i=new Headers(r?.headers);i.delete(`authorization`),i.set(`x-porcelain-browser`,`1`);let a=await e(n,{...r,headers:i,credentials:`same-origin`});return a.status===401&&n!==Cce()&&t.reportUnauthorized!==!1&&Z4(),a}}var $4=X(e=>N4(e).atom(ND(Op(M4,e=>e.stream))).pipe(Zk(e=>Ww(e,e=>e)),pk(0)));X(e=>bk(t=>e.map(e=>({connection:e,result:t($4(e))}))));var Tce=class extends dr()(`@porcelain/client/ProjectSelectionStorage`){},e3=class e extends dr()(`@porcelain/client/ProjectSelectionStore`){static layer=kd(e,H(function*(){let e=yield*Tce,t=yield*SJ({initial:{currentEnvironmentId:void 0,selections:{}},read:e.read,write:e.write,messages:{beforeRead:`Saved workspace selections must be read before changing them.`,readFailed:`Saved workspace selections could not be read. Try reading them again.`,writeFailed:`Saved workspace selections could not be updated. Read them again before making changes.`}}),n=t.write;return{state:t.state,load:t.load,selectEnvironment:Um(`ProjectSelectionStore.selectEnvironment`)(e=>n(({selections:t})=>B({currentEnvironmentId:e,selections:t}))),selectWorkspace:Um(`ProjectSelectionStore.selectWorkspace`)((e,t,r)=>n(({selections:n})=>B({currentEnvironmentId:e,selections:{...n,[e]:{projectId:t,worktreeId:r}}}))),forgetEnvironment:Um(`ProjectSelectionStore.forgetEnvironment`)(e=>n(({currentEnvironmentId:t,selections:n})=>B({currentEnvironmentId:t===e?void 0:t,selections:Object.fromEntries(Object.entries(n).filter(([t])=>t!==e))})))}}))},t3={projects:void 0,environments:void 0};function n3(e,t,n){return(n.projects===void 0||n.projects.includes(e))&&(n.environments===void 0||n.environments.includes(t))}function Ece(e,t){return Number(t.main)-Number(e.main)||Number(t.headCommittedAt!==void 0)-Number(e.headCommittedAt!==void 0)||(t.headCommittedAt??``).localeCompare(e.headCommittedAt??``)||e.name.localeCompare(t.name)||e.key.localeCompare(t.key)}function r3(e){return e.state===`loading`?`Reading changes…`:e.state===`unavailable`?`Changes unavailable`:e.count===0?`Working tree clean`:`${e.count} ${e.count===1?`file`:`files`} changed`}function Dce(e){return e.state===`unavailable`?`—`:e.state===`available`&&e.count===0?``:r3(e)}function Oce(e){return e?e.state===`available`?{passed:`Checks passed`,running:`Checks running`,failed:`Checks failed`,none:`No checks`}[e.result]:e.state===`loading`?`Checks loading`:`Checks unavailable`:`Checks loading`}function kce(e,t){return!t||e.environmentId!==t.environmentId?!1:e.worktreeId===t.worktreeId}function Ace(e,t){let n=[e.name,e.displayTitle??``,e.branch,e.path,e.projectName,e.environmentName,e.pullRequest.state===`available`?e.pullRequest.number:void 0].filter(e=>e!==void 0).join(` `).toLocaleLowerCase();return t.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean).every(e=>n.includes(e))}function jce(e,t){return[{key:`environments`,label:`Environments`,options:[...new Map(e.map(e=>[e.environmentId,{id:e.environmentId,label:e.environmentName,icon:e.environmentIcon}])).values()]},{key:`projects`,label:`Projects`,options:e.map(e=>({id:e.key,label:`${e.name} · ${e.environmentName}`}))}].map(({key:e,label:n,options:r})=>{let i=t[e]??r.map(e=>e.id);return{key:e,label:n,items:r.map(e=>({...e,checked:i.includes(e.id),next:i.includes(e.id)?i.filter(t=>t!==e.id):[...i,e.id]}))}})}function Mce(e,t){let n=new Map(e.map(e=>[e.environmentId,{...e,failures:e.failures.filter(({entry:e})=>!t.recoveredKeys.includes(e.key)&&(!t.environments.includes(e.environmentId)||t.inventoryKeys.includes(e.key)))}]));for(let e of t.issues){let t=n.get(e.environmentId),r=new Map((t?.failures??[]).map(e=>[e.entry.key,e]));for(let t of e.failures)r.set(t.entry.key,t);n.set(e.environmentId,{...e,dismissed:t?.dismissed??!1,failures:[...r.values()]})}let r=[...n.values()].filter(e=>e.failures.length>0);return JSON.stringify(r)===JSON.stringify(e)?e:r}var i3=Ck({query:``,filter:t3,expanded:{}}).pipe(Jk),a3=Ck([]).pipe(Jk);function Nce(e){return H(function*(){let t=yield*a4(e),n=yield*M4,r=yield*B4;return{register:e=>n.confirm(t.request(t=>t.projects.registerProject({payload:{path:e}})),(e,t)=>({...e,projects:e.projects.some(e=>e.id===t.id)?e.projects.map(e=>e.id===t.id?t:e):[...e.projects,t]})),saveDefaultWriter:e=>n.confirm(t.request(t=>t.walkthroughs.saveDefaultWalkthroughWriter({payload:e})),e=>e),saveWalkthroughSettings:e=>n.confirm(t.request(t=>t.projects.saveWalkthroughSettings({params:{projectId:e.projectId},payload:{mode:e.mode,writer:e.writer}})),(t,n)=>({...t,projects:t.projects.map(t=>t.id===e.projectId?{...t,walkthroughSettings:n}:t)})),rename:e=>n.confirm(t.request(t=>t.projects.renameProject({params:{projectId:e.projectId},payload:{name:e.name}})),(e,t)=>({...e,projects:e.projects.map(e=>e.id===t.id?{...e,name:t.name}:e)})),remove:i=>n.confirm(H(function*(){let n=`[${JSON.stringify(i)},`;for(let[t,i]of r.entries(e))if(t.startsWith(n)&&!(yield*i.save()))return yield*U(new xJ({message:`Save or discard unsaved file drafts before removing this project.`}));return yield*t.request(e=>e.projects.removeProject({params:{projectId:i}}))}),e=>({...e,projects:e.projects.filter(e=>e.id!==i)}))}})}var o3=class extends dr()(`@porcelain/client/ProjectCommands`){},s3=X(e=>e.atoms(t=>Rd(kd(o3,Nce(e)),Fd(t(N4(e).layer),B4.layer)))),Pce=X(e=>s3(e).fn(e=>o3.use(t=>t.register(e)),{concurrent:!0})),Fce=X(e=>s3(e).fn(e=>o3.use(t=>t.rename(e)),{concurrent:!0})),Ice=X(e=>s3(e).fn(e=>o3.use(t=>t.remove(e)),{concurrent:!0})),c3=X(e=>N4(e).fn(e=>M4.use(e=>e.refresh()),{concurrent:!0})),Lce=X(e=>xk(t=>e.map(e=>t(c3(e))),(t,n)=>{for(let n of e)t.set(c3(n),void 0)})),Rce=X(e=>s3(e).fn(e=>o3.use(t=>t.saveWalkthroughSettings(e)),{concurrent:!0})),zce=X(e=>s3(e).fn(e=>o3.use(t=>t.saveDefaultWriter(e)))),l3=class e extends dr()(`@porcelain/client/FilePreferencesState`){static layer(t,n){return kd(e,H(function*(){let e=yield*a4(t);return yield*A4(t,D4.filePreferences(t.environmentId,n),e.request(e=>e.projects.listFilePreferences({params:{projectId:n}})))}))}},u3=X(({connection:e,projectId:t})=>e.atoms(n=>Rd(l3.layer(e,t),n(s4(e).layer)))),Bce=X(({connection:e,projectId:t})=>u3({connection:e,projectId:t}).fn(n=>H(function*(){let r=yield*a4(e);return yield*(yield*l3).confirm(r.request(e=>e.projects.setFilePreference({params:{projectId:t},payload:n})),(e,t)=>qn(t))}),{concurrent:!0})),d3=class e extends dr()(`@porcelain/client/ReadSubscriptions`){static layer=kd(e,H(function*(){let e=yield*MO(r_());return{snapshot:PO(e),changes:NO(e),retain:Um(`ReadSubscriptions.retain`)(function*(t){yield*lm(H(function*(){let n=Symbol();return yield*RO(e,i_(n,t)),n}),t=>RO(e,o_(t)))})}}))};function f3(e,t,n,r,i,a=[]){let o=m3(e,t,n,i.atom(i=>H(function*(){yield*(yield*d3).retain({...t,paths:a,surface:String(n[0]),settled:GO(i.registry,o,{suspendOnWaiting:!0}).pipe(Bp,jp)});let s=yield*r;return yield*u4(e),s})));return o}function p3(e){let t=Ck(Aw()).pipe(Jk),n=e.pipe(qk(t));return Yk(n,r=>{let i=r(e);return jw(i)&&r.once(t)!==i&&r.set(t,i),r(n)}).pipe(pk(0))}function Vce(e,t,n,r,i){let a=m3(e,t,n,i.pull(e=>ND(H(function*(){return yield*(yield*d3).retain({...t,paths:[],surface:String(n[0]),settled:GO(e.registry,a,{suspendOnWaiting:!0}).pipe(Bp,jp)}),typeof r==`function`?r(e):r}))));return a}function m3(e,t,n,r){return r.pipe(e.atoms.withReactivity(D4.worktreeReads(e,t,n)),pk(0))}function Hce(e,t,n,r){let i=r.atom(r=>ND(H(function*(){return yield*(yield*d3).retain({...e,paths:[],surface:t,settled:GO(r.registry,i,{suspendOnWaiting:!0}).pipe(Bp,jp)}),(yield*n).stream}))).pipe(Zk(e=>Ww(e,e=>e)),pk(0));return i}function h3(e,t,n,r=()=>!0,i=[]){return f3(e.connection,e.scope,t,o4(e.connection,n).pipe(Ep(t=>u4(e.connection,r(t)))),s4(e.connection),i)}var Uce=X(e=>u3(e).atom(ND(Op(l3,e=>e.stream))).pipe(Zk(e=>Ww(e,e=>e)),pk(0),p3)),Wce=X(({connection:e,path:t})=>s4(e).atom(H(function*(){return yield*(yield*a4(e)).request(e=>e.projects.browseProjectFolders({query:t===void 0?{}:{path:t}}))})));function Gce(e,t){return Wce({connection:e,path:t})}q({currentEnvironmentId:W(LJ),selections:eC(K,q({projectId:LJ,worktreeId:RJ})).check(PC(LJ))});var Kce=H(function*(){let e=yield*P2,t=yield*e3,n=yield*H4;return{pending:n.pendingSelections,execute:Um(`WorkspaceSelection.execute`)(r=>n.run(`selection`,H(function*(){if(r.kind===`read`){if(yield*t.load(),e.state.value.status!==`ready`||t.state.value.status!==`ready`)return;let n=new Set(e.state.value.remotes.map(e=>e.environmentId)),r=new Set(Object.keys(t.state.value.selections));t.state.value.currentEnvironmentId&&r.add(t.state.value.currentEnvironmentId);for(let e of r)n.has(e)||(yield*t.forgetEnvironment(e))}else{if(e.state.value.status!==`ready`||!e.state.value.remotes.some(e=>e.environmentId===r.environmentId))return yield*U(new xJ({message:`That environment is no longer paired. Open the workspace picker again.`}));r.kind===`environment`?yield*t.selectEnvironment(r.environmentId):yield*t.selectWorkspace(r.environmentId,r.projectId,r.worktreeId)}})))}});(class e extends dr()(`@porcelain/client/ProjectSelectionCommands`){static layer=kd(e,Kce)});var qce=X(e=>Hk((t,n)=>H(function*(){let r=yield*n.setResult(Pce(e),t.path.trim()),i=r.worktrees.find(e=>e.available);t.complete(),i&&(yield*t.select({remote:t.remote,projectId:r.id,worktreeId:i.id}))})));kd(U4,Op(e3,e=>({forgetEnvironment:e.forgetEnvironment})));var g3=Um(`Changes.readSnapshot`)(function*({connection:e,scope:t}){let n=yield*o4(e,e=>e.changes.readChanges({params:{worktreeId:t.worktreeId}}));return yield*u4(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),Jce=X(e=>f3(e.connection,e.scope,[`changes`],g3(e),s4(e.connection)).pipe(p3)),_3=Um(`Changes.readGitStatusSnapshot`)(function*({connection:e,scope:t}){let n=yield*o4(e,e=>e.changes.readGitStatus({params:{worktreeId:t.worktreeId}}));return yield*u4(e,n.environmentId===e.environmentId&&n.worktreeId===t.worktreeId),n}),v3=X(e=>f3(e.connection,e.scope,[`git-status`],_3(e),s4(e.connection)).pipe(p3));function y3(e,t,n=()=>!0){return s4(e.connection).atom(H(function*(){let r=yield*o4(e.connection,t);return yield*u4(e.connection,n(r)),r})).pipe(e.connection.atoms.withReactivity([D4.environment(e.connection.environmentId),D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId,e.projectId)]),pk(0))}var Yce=X(e=>y3(e,t=>t.pullRequests.readProjectPullRequest({params:{projectId:e.projectId,number:e.number}}),t=>t.kind!==`available`||t.pullRequest.number===e.number)),b3=X(e=>y3(e,t=>t.pullRequests.readProjectPullChecks({params:{projectId:e.projectId,number:e.number}}),t=>t.kind!==`available`||t.number===e.number).pipe(p3)),x3=X(e=>y3(e,t=>t.pullRequests.listProjectPullRequests({params:{projectId:e.projectId}}))),Xce=X(e=>y3(e,t=>t.pullRequests.readProjectGitHubAccount({params:{projectId:e.projectId}})).pipe(p3));function S3(e){return e??`Detached HEAD`}function Zce(e,t){for(let n of e.projects){let e=n.worktrees.find(e=>e.id===t);if(e)return{worktree:e,projectId:n.id}}}function Qce(e){let t=e.projects.flatMap(e=>e.worktrees);return t.find(e=>e.available&&!e.main)??t.find(e=>e.available)}function $ce(e){return e.worktrees.find(e=>e.main)?.path??e.worktrees[0]?.path??``}function ele(e){switch(e.unavailableReason){case`moved`:return`Porcelain doesn't recognise this repository as the one it registered. Remove the project and add it again.`;case`missing`:return`The repository folder is missing.`;case`permission`:return`Porcelain cannot read this repository because access is denied.`;case`git-failed`:return`Git could not read this repository.`;default:return`Porcelain can't reach this repository right now.`}}var tle=_Z.literals,C3={desktop:`Desktop`,laptop:`Laptop`,server:`Server`,cloud:`Cloud`},w3=`desktop`;function T3(e){return e.icon??w3}function nle(e){return e===w3?null:e}function rle(e){let{project:t,connection:n,environmentName:r}=e;return t.worktrees.map(e=>{let i=e.walkthroughTitle||e.pullRequestTitle;return{key:`${n.environmentId}/${t.id}/${e.id}`,kind:`worktree`,environmentId:n.environmentId,environmentName:r,projectId:t.id,projectName:t.name,worktreeId:e.id,path:e.path,name:e.branch??e.path.split(`/`).filter(Boolean).at(-1)??e.path,displayTitle:i===e.branch?void 0:i,branch:S3(e.branch),main:e.main,...e.headCommittedAt?{headCommittedAt:e.headCommittedAt}:{},detached:!e.branch,available:t.available&&e.available,pullRequest:{state:`loading`},changes:{state:t.available&&e.available?`loading`:`unavailable`}}}).sort(Ece)}var ile=X(e=>bk(t=>{let n=t($4(e.connection)),r=er(Bw(n)),i=r?.projects.find(t=>t.id===e.projectId);if(!r||!i)return{entries:[],messages:[]};let a=Nw(n)?{...i,available:!1}:i,o=rle({...e,project:a,environmentName:r.environment.name}),s=t(x3(e)),c=er(Bw(s)),l=er(t.self());for(let e of o)if(Nw(s)||c?.kind===`unavailable`){let t=l?.entries.find(t=>t.key===e.key&&t.branch===e.branch)?.pullRequest;e.pullRequest=t?.state===`available`?{state:`available`,number:t.number}:{state:`unavailable`}}else if(c?.kind===`available`){let t=c.pullRequests.find(t=>t.headBranch===e.branch);e.pullRequest=t?{state:`available`,number:t.number}:{state:`none`}}return{entries:o,messages:Nw(s)?[`Pull requests for ${a.name} could not be read.`]:[]}}).pipe(pk(0))),ale=X(e=>bk(t=>{let n=t(ile(e)),r=[];return{entries:n.entries.map(n=>{let i={...n};if(i.available&&i.worktreeId){let n=t(v3({connection:e.connection,scope:{projectId:i.projectId,worktreeId:i.worktreeId}})),a=er(Bw(n));Nw(n)&&r.push({entry:i,detail:er(Tu(n.cause))?.message}),i.changes=Nw(n)?{state:`unavailable`}:a?{state:`available`,count:new Set(a.changes.map(e=>e.scope===`untracked`||e.scope===`unmerged`?e.path:e.newPath??e.oldPath)).size}:{state:`loading`}}return i}),messages:n.messages,statusFailures:r,loading:!1}}).pipe(pk(0)));function ole(e,t){let n=t.map(t=>{let n=e($4(t));return{connection:t,result:n,inventory:er(Bw(n))}});return{reads:n,loading:n.some(({result:e})=>Ow(e)),messages:n.flatMap(({result:e,inventory:t})=>Nw(e)?[`${t?.environment.name??`Computer`}: projects could not be read.`]:[])}}function sle(e){return bk(t=>{let n=t(i3),r=n.query,i=[],a=[],o=[],s=[],c=ole(t,e),l=[...c.messages],u=!1;for(let{connection:e,result:t,inventory:a}of c.reads){jw(t)&&o.push(e.environmentId);for(let o of a?.projects??[]){let s=Nw(t)?{...o,available:!1}:o,c=`${e.environmentId}/${s.id}`;i.push({key:c,connection:e,project:s,environmentName:a.environment.name,environmentIcon:T3(a.environment),expanded:r.trim().length>0||n.expanded[c]!==!1,entries:[]})}}i.sort((e,t)=>e.project.name.localeCompare(t.project.name)||e.environmentName.localeCompare(t.environmentName)||e.key.localeCompare(t.key));let d=jce(i.map(e=>({key:e.key,name:e.project.name,environmentId:e.connection.environmentId,environmentName:e.environmentName,environmentIcon:e.environmentIcon})),n.filter),f=[];for(let e of i){if(!n3(e.key,e.connection.environmentId,n.filter))continue;if(!e.expanded){f.push(e);continue}let i=t(ale({connection:e.connection,projectId:e.project.id}));if(u||=i.loading,a.push(...i.entries),l.push(...i.messages),i.statusFailures.length>0){let t=s.find(t=>t.connection.environmentId===e.connection.environmentId);t?t.failures.push(...i.statusFailures):s.push({connection:e.connection,environmentName:e.environmentName,failures:[...i.statusFailures]})}let o=i.entries.filter(e=>Ace(e,r)).map(e=>({...e,pullRequest:{...e.pullRequest},changes:{...e.changes}}));for(let n of o)if(n.pullRequest.state===`available`){let r=t(b3({connection:e.connection,projectId:n.projectId,number:n.pullRequest.number})),i=er(Bw(r));n.pullRequest.checks={state:`loading`},Nw(r)||i&&(i.kind!==`available`||i.number!==n.pullRequest.number)?n.pullRequest.checks={state:`unavailable`}:i?.kind===`available`&&(n.pullRequest.checks={state:`available`,result:i.checks})}o.length===0&&r.trim()||f.push({...e,entries:o})}let p=t.once(a3),m=Mce(p,{issues:s.map(({connection:e,environmentName:t,failures:n})=>({environmentId:e.environmentId,environmentName:t,failures:n})),recoveredKeys:a.filter(e=>e.changes.state===`available`).map(e=>e.key),inventoryKeys:i.flatMap(e=>e.project.worktrees.map(t=>`${e.connection.environmentId}/${e.project.id}/${t.id}`)),environments:o});return m!==p&&t.set(a3,m),{projects:f,allProjects:i,statusIssues:t(a3),filters:d,loading:c.loading||u,messages:[...new Set(l)]}})}var cle=X(e=>sle(e)),E3=class extends dr()(`@porcelain/client/OperationStore`){},D3=class extends dr()(`@porcelain/client/OperationStorage`){},O3=WC(J(q({requestId:W1.fields.requestId,projectId:K.check(kC(1)),worktreeId:BJ.fields.worktreeId,request:W1}).check(_C(e=>e.requestId===e.request.requestId))));function k3(e){return e.state!==`running`}var A3=(e,t)=>JSON.stringify([e.projectId,e.worktreeId,t]),lle=kd(E3,H(function*(){let e=yield*D3,t=yield*eE(1),n=yield*MO(0),r=yield*e.read().pipe(Cp(e=>MS(O3)(e??`[]`)),lne),i=CP({operations:qr(r)?new Map(r.success.map(e=>[A3(e,e.request.input.action),e])):new Map,closed:!1,restorationError:Kr(r)?new xJ({message:`Could not restore pending Git operations. Check the previous operation before starting another.`,cause:r.failure}):void 0}),a=Um(`OperationStore.publish`)(function*(e){i.set(e),yield*RO(n,e=>e+1)});yield*dm(()=>t.withPermit(a({...i.value,operations:new Map,closed:!0})));let o=Um(`OperationStore.persist`)(function*(t){if(i.value.restorationError)return yield*U(i.value.restorationError);let n=[...t.values()].filter(e=>!e.receipt||!k3(e.receipt)).map(({receipt:e,...t})=>t),r=yield*LS(O3)(n).pipe(Fp(e=>new xJ({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e})));yield*(n.length?e.write(r):e.clear()).pipe(Fp(({cause:e})=>new xJ({message:`Could not save the Git operation. Check device storage before trying again.`,cause:e}))),yield*a({...i.value,operations:t})}),s=e=>t.withPermit(H(function*(){return i.value.closed?yield*_m:yield*e().pipe(bm)}));return{state:i,set:Um(`OperationStore.set`)((e,t)=>s(()=>H(function*(){let n=new Map(i.value.operations);t?n.set(e,t):n.delete(e),yield*o(n)}))),accept:Um(`OperationStore.accept`)(e=>s(()=>H(function*(){let t=A3(e,e.action),n=i.value.operations.get(t);if(!n||n.requestId!==e.requestId||n.receipt&&k3(n.receipt))return!1;let r=new Map(i.value.operations);return r.set(t,{...n,receipt:e}),yield*o(r),!0}))),wait:Um(`OperationStore.wait`)(function*(e,t){return yield*Xn(yield*NO(n).pipe(FD(()=>H(function*(){let n=i.value.operations.get(e);return yield*d4(!i.value.closed&&n?.requestId===t),n?.receipt&&k3(n.receipt)?qn(n.receipt):Kn()})),KD(Yn),PD(e=>e.value),nO),{onSome:B,onNone:()=>d4(!1).pipe(Tp(gp))})})}})),ule=X(({connection:e,scope:t})=>e.operations.state.map(({operations:e})=>{let n=e.get(A3(t,`switch`));return{unresolved:!(!n||n.receipt&&k3(n.receipt))}}));function j3(e,t,n){e.set(a3,e(a3).flatMap(e=>{if(e.environmentId!==t)return[e];let r=n(e.failures);return r.length>0?[{...e,failures:r}]:[]}))}var dle=X(e=>Hk(Um(`WorktreeNavigator.refresh`)(function*(t,n){if(t){let r=e.find(e=>e.environmentId===t.environmentId),i=n(a3).find(e=>e.environmentId===t.environmentId);if(!r||!i)return;yield*n.setResult(c3(r),void 0);let a=yield*n.result($4(r),{suspendOnWaiting:!0}),o=i.failures.filter(({entry:e})=>a.projects.some(t=>t.id===e.projectId&&t.available&&t.worktrees.some(t=>t.id===e.worktreeId&&t.available))),s=o.map(({entry:e})=>e.key);j3(n,t.environmentId,e=>e.filter(({entry:e})=>s.includes(e.key))),yield*sp(o,e=>{let i=e.entry;if(!i.worktreeId)return pp;let a=v3({connection:r,scope:{projectId:i.projectId,worktreeId:i.worktreeId}});return n.refresh(a),n.result(a,{suspendOnWaiting:!0}).pipe(Xp({onSuccess:()=>j3(n,t.environmentId,e=>e.filter(e=>e.entry.key!==i.key)),onFailure:e=>j3(n,t.environmentId,t=>t.map(t=>t.entry.key===i.key?{...t,detail:e.message}:t))}))},{concurrency:`unbounded`});return}yield*sp(e,e=>n.setResult(c3(e),void 0),{concurrency:`unbounded`});let r=n(i3),i=e.flatMap(e=>(er(Bw(n($4(e))))?.projects??[]).map(t=>({connection:e,project:t,key:`${e.environmentId}/${t.id}`})));for(let e of i){if(!n3(e.key,e.connection.environmentId,r.filter))continue;let t=x3({connection:e.connection,projectId:e.project.id});if(!r.query.trim()&&r.expanded[e.key]===!1&&!n.registry.getNodes().has(t))continue;let i=er(Bw(n(t)));n.refresh(t);for(let t of i?.kind===`available`?i.pullRequests:[])n.refresh(b3({connection:e.connection,projectId:e.project.id,number:t.number}));for(let t of e.project.worktrees)e.project.available&&t.available&&n.refresh(v3({connection:e.connection,scope:{projectId:e.project.id,worktreeId:t.id}}))}}))),M3=[`walkthrough`,`walkthrough-conversations`],fle={files:[`walkthrough`],git:M3,reviewed:[`reviewed`]};function ple(e){return e.type===`walkthrough`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(e.change===`run`?[`walkthrough`,`walkthrough-conversations`]:[`walkthrough-conversations`])}:e.type===`worktree`?{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(fle[e.change])}:null}function mle(e){return e.action===`fetch`||e.action===`push`?null:{scope:{projectId:e.projectId,worktreeId:e.worktreeId},surfaces:new Set(M3)}}var N3=[`branch`,`branch-bases`,`history`];function hle(e){if(e.type===`ready`||e.type===`subscribed`||e.type===`heartbeat`||e.type===`git-action`||e.type===`inventory`||e.type===`project`)return;let t=new Set(ple(e)?.surfaces);if(e.change===`files`)for(let e of O4)t.add(e);if(e.change===`git`)for(let e of[...k4,...N3])t.add(e);return{scope:e,surfaces:t}}function P3(e,t){let n=hle(t);return n?[...n.surfaces].map(t=>D4.reviewSurface(e,n.scope,[t])):[]}function gle(e){if(e.state!==`running`&&e.state!==`rejected`&&e.state!==`no-change`)return new Set([...e.action===`fetch`||e.action===`push`?[`git-status`,`changes`]:[...k4,...O4],...N3,...mle(e)?.surfaces??[]])}function F3(e,t){let n=gle(t);return n?[...n].map(n=>D4.reviewSurface(e,t,[n])):[]}var _le=class extends Ta{},I3=class e extends dr()(`@porcelain/client/GitReceiptRefresh`){static layer(t){return kd(e,H(function*(){let e=yield*om,n=yield*uO,r=yield*d3,i=yield*Lq({capacity:1/0,timeToLive:Wi,lookup:a=>H(function*(){let o=new Set(F3(t.environmentId,a).map(e=>String(e[4]))),s=[...a_(yield*r.snapshot)].filter(e=>e.projectId===a.projectId&&e.worktreeId===a.worktreeId).filter(e=>o.has(e.surface)),c=yield*Dm(H(function*(){n.invalidateUnsafe([D4.worktreeInventory(t.environmentId),D4.projectPullRequests(t.environmentId,a.projectId),...F3(t.environmentId,a)]),yield*sp(s,e=>e.settled,{concurrency:`unbounded`,discard:!0})}),e);return yield*Dm(Gw(c).pipe(Tp(Gq(i,a))),e),c})});return{refresh:Um(`GitReceiptRefresh.refresh`)(function*(e){if(e.state===`running`||e.state===`rejected`||e.state===`no-change`)return;let t=new _le({projectId:e.projectId,worktreeId:e.worktreeId,requestId:e.requestId,action:e.action,state:e.state}),n=yield*Bq(i,t);n.pollUnsafe()&&(yield*Gq(i,t)),yield*Kw(n)})}}))}},L3=X(e=>e.atoms(t=>Rd(I3.layer(e),t(s4(e).layer))));function R3(e,t){return H(function*(){let n=yield*(yield*a4(e)).request(e=>e.gitActions.readGitActionReceipt({params:{worktreeId:t.worktreeId,requestId:t.requestId}}));return yield*u4(e,n.projectId===t.projectId&&n.worktreeId===t.worktreeId&&n.requestId===t.requestId),n})}var z3=class extends Y()(`GitOperationStateError`,{reason:oC([`pending`,`missing`,`mismatch`,`receipt-unavailable`])}){get message(){switch(this.reason){case`pending`:return`Check the existing receipt before starting another operation.`;case`missing`:return`No operation to recover`;case`mismatch`:return`Action mismatch`;case`receipt-unavailable`:return`The operation receipt is unavailable. Inspect the current Git state in your terminal before taking another action. This operation was not submitted again.`}}},vle=Um(`GitActionController.make`)(function*({connection:e,scope:t,action:n}){let r=yield*a4(e),i=yield*E3,a=yield*Uh,o=yield*I3,s=yield*eE(1),c=A3(t,n),l=Um(`GitActionController.accept`)(function*(t){yield*u4(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*o.refresh(t),yield*u4(e,t.requestId===i.state.value.operations.get(c)?.requestId),yield*i.accept(t)}),u=Um(`GitActionController.send`)(function*(a){let o=yield*r.request(e=>e.gitActions.runGitAction({params:{worktreeId:t.worktreeId},payload:a}));return`requestId`in o?(yield*u4(e,o.projectId===t.projectId&&o.worktreeId===t.worktreeId&&o.requestId===a.requestId&&o.action===n),yield*l(o),yield*i.wait(c,a.requestId)):yield*U(new V2({status:o.statusCode,message:o.message}))});return{execute:Um(`GitActionController.execute`)(function*(r){return yield*e.request(H(function*(){let o=yield*s.withPermit(H(function*(){yield*u4(e);let o=i.state.value.operations.get(c);if(o&&(!o.receipt||!k3(o.receipt)))return yield*U(new z3({reason:`pending`}));if(r.input.action!==n)return yield*U(new z3({reason:`mismatch`}));let s={input:r.input,expected:r.expected,requestId:yield*a.uuidV4()};return yield*i.set(c,{...t,requestId:s.requestId,request:s}),r.onRecorded?.(s),s}));return yield*u(o)}))}),recover:Um(`GitActionController.recover`)(function*(){return yield*e.request(H(function*(){yield*u4(e);let t=i.state.value.operations.get(c);if(!t)return yield*U(new z3({reason:`missing`}));let r=yield*R3(e,t).pipe(Np(`GitActionNotFoundError`,()=>U(new z3({reason:`receipt-unavailable`}))),Fp(e=>e instanceof V2&&e.status===404?new z3({reason:`receipt-unavailable`}):e));return yield*u4(e,r.action===n),yield*l(r),yield*i.wait(c,t.requestId)}))}),startNew:Um(`GitActionController.startNew`)(function*(){return yield*s.withPermit(H(function*(){let e=i.state.value.operations.get(c)?.receipt;return!e||!k3(e)?!1:(yield*i.set(c,null),!0)}))})}}),B3=class e extends dr()(`@porcelain/client/GitActionController`){static layer(t){return kd(e,vle(t))}},V3=X(e=>e.connection.atoms(t=>Rd(B3.layer(e),Pd(t(L3(e.connection).layer),jd(e.connection.runtime.contextEffect))))),H3=X(e=>V3(e).fn(e=>B3.use(t=>t.execute(e)),{concurrent:!0})),U3=X(e=>V3(e).fn(e=>B3.use(e=>e.recover()),{concurrent:!0})),yle=X(e=>V3(e).fn(e=>B3.use(e=>e.startNew())));function ble(e,t){let n=H3(e),r=U3(e),i=yle(e),a=()=>{t.set(n,Bk),t.set(r,Bk)};return{run:Um(`GitActions.run`)(function*(e,r,i){return t.set(n,{input:e,expected:r,onRecorded:i}),yield*GO(t,n,{suspendOnWaiting:!0})}),recover:Um(`GitActions.recover`)(function*(){return t.set(r,void 0),yield*GO(t,r,{suspendOnWaiting:!0})}),startNew:Um(`GitActions.startNew`)(function*(){t.set(i,void 0),(yield*GO(t,i,{suspendOnWaiting:!0}))&&a()}),reset:a}}var W3=X(e=>Ck(H(function*(){return ble(e,yield*UO)}))),G3=Um(`Projects.branchSwitchCommands`)(function*(e){return yield*GO(yield*UO,W3({...e,action:`switch`}),{suspendOnWaiting:!0})}),K3=X(e=>e.atoms(t=>Fd(t(s4(e).layer),B4.layer))),q3=Um(`Projects.requireSavedWorktreeDrafts`)(function*(e){if((yield*B4).hasUnsavedWorktree(e.connection.environmentId,e.scope))return yield*new xJ({message:`Save or discard unsaved file drafts before changing this worktree.`})}),xle=X(e=>K3(e.connection).fn(Um(`Projects.deleteWorktree`)(function*(t){t.confirmation&&(yield*q3(e));let n=yield*o4(e.connection,n=>n.projects.deleteWorktree({params:{worktreeId:e.scope.worktreeId},payload:t}));return yield*u4(e.connection),n.deleted&&(yield*mO([D4.inventory(e.connection.environmentId),D4.worktreeInventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId)])),n}))),Sle=X(e=>K3(e.connection).fn(Um(`Projects.switchWorktreeBranch`)(function*(t){yield*q3(e);let n=yield*G3(e),r=yield*_3(e);return yield*n.startNew(),yield*n.run({action:`switch`,targetRef:t},{headOid:r.headOid,branch:r.branch?.name,inProgress:r.inProgress,mergeHeadOid:r.mergeHeadOid})}))),Cle=X(e=>K3(e.connection).fn(Um(`Projects.recoverWorktreeBranchSwitch`)(function*(t){return yield*q3(e),yield*(yield*G3(e)).recover()}))),wle=X(e=>s4(e).atom(o4(e,e=>e.walkthroughs.readWalkthroughWriterSettings())).pipe(e.atoms.withReactivity([D4.inventory(e.environmentId)]),pk(0))),Tle=X(e=>s4(e.connection).fn(Um(`Reviews.setGitHubAccount`)(function*(t){let n=yield*o4(e.connection,n=>n.pullRequests.setProjectGitHubAccount({params:{projectId:e.projectId},payload:t}));return yield*mO([D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId)]),n}))),Ele=X(e=>s4(e.connection).fn(Um(`Projects.archivePullRequest`)(function*(t){let n=yield*o4(e.connection,n=>n.pullRequests.archivePullRequest({params:{projectId:e.projectId,number:e.number},payload:t}));return yield*mO([D4.inventory(e.connection.environmentId),D4.projectPullRequests(e.connection.environmentId,e.projectId)]),n}))),Dle=1.5,Ole=29360128,kle=1e4,Ale=8192,jle=80,Mle=64,Nle=1e4,J3=15e3,Ple=2166136261,Fle=16777619;function Ile(e,t){if(!e.running)return null;let n=e.last?.target??e.latest??`the new version`;return t||e.last?.stage===`restarting`?`Restarting Porcelain on ${n}. This page reconnects when it is back.`:e.last?.stage===`installing`?`Installing ${n}…`:`Downloading ${n}…`}function Lle(e){let{last:t}=e;return e.running||t==null?null:t.stage===`updated`&&t.target===e.version?{kind:`updated`,from:t.from,target:t.target}:t.stage===`failed`?{kind:`failed`,target:t.target,reason:t.reason??`The updater gave no reason.`}:null}function Y3(e,t,n=`${t}s`){return e===1?t:n}function X3(e,t,n=`${t}s`){return`${e} ${Y3(e,t,n)}`}function Z3(e){if(!e.startsWith(`Mozilla/`))return e||`Unknown platform`;let t=/Edg(?:e|A|iOS)?\//.test(e)?`Edge`:/(?:Firefox|FxiOS)\//.test(e)?`Firefox`:/(?:Chrome|CriOS)\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:`Browser`,n=/iPad/.test(e)?`iPadOS`:/iPhone|iPod/.test(e)?`iOS`:/Android/.test(e)?`Android`:/Windows/.test(e)?`Windows`:/Macintosh|Mac OS X/.test(e)?`macOS`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:void 0;return n?`${t} on ${n}`:t}function Rle(e){let t=Z3(e);return t.startsWith(`iPadOS`)?`tablet`:/^(?:iOS|Android|Mobile)\b/.test(t)?`phone`:`browser`}var zle=new Intl.ListFormat(`en-GB`,{type:`conjunction`});function Ble(e,t){let n=f4.filter(t=>e.routes[t].status.kind===`on`).map(e=>p4[e]);return[n.length===0?`No way in on`:zle.format(n),X3(t,`device`)].join(` · `)}function Vle(e,t,n){let r=nd(),{timeoutMs:i,...a}=e,o=aJ(Pd(zd(bJ.layer),hO,zd(d3.layer),n),{memoMap:t}),s=Mk({memoMap:o.memoMap}),c=!1,l=Rm(gm(fp(()=>(c=!0,cd(r,Iu).pipe(fm(o.disposeEffect)))).pipe(bm))),u=()=>(c=!0,Pm(l));return{connection:Ie({runtime:o,atoms:s,scope:r,isClosed:()=>c||r.state._tag===`Closed`,close:u,...a,request:Um(`Connection.request`)(function*(e,t){if(c)return yield*_m;let n=yield*(t?um(Dm(e,t),Kw,Jw):e).pipe(Gp({duration:i,orElse:()=>_m}),Dm(r));return yield*Kw(n).pipe(fm(Jw(n)),Cp(e=>c?_m:B(e)))})}),close:u,closeEffect:l}}var Hle=X(e=>e.atoms(Ed).fn(t=>H(function*(){(yield*uO).invalidateUnsafe([D4.review(e.environmentId,t)])})));function Ule(e){return()=>void 0}function Wle(e){return()=>void 0}function Gle(e){}function Kle(){return()=>void 0}var Q3=class e extends dr()(`@porcelain/web/DesktopHost`){static layer=Dd(e,()=>({isDesktopShell:!1,hasAppUpdateFeed:!1,canPickProject:e=>!1,pickProject:Um(`Desktop.pickProject`)(function*(e){return yield*U(new xJ({message:`The native project picker is unavailable for this computer.`}))}),checkUpdate:H(function*(){return Kn()}),installUpdate:fp(()=>U(new xJ({message:`The native app updater is unavailable.`}))),updateStates:xD({status:`idle`})}))},qle=X(e=>Ck(t=>{t.addFinalizer(Wle(e))})),$3={isActive:()=>document.visibilityState!==`hidden`&&!0,subscribe:e=>{let t=Ule(e),n=()=>e();return window.addEventListener(`focus`,n),window.addEventListener(`online`,n),window.addEventListener(`offline`,n),document.addEventListener(`visibilitychange`,n),()=>{t(),window.removeEventListener(`focus`,n),window.removeEventListener(`online`,n),window.removeEventListener(`offline`,n),document.removeEventListener(`visibilitychange`,n)}}};function e6(e){return e.kind===`online`?`secondary`:e.kind===`checking`?`outline`:`destructive`}var Jle=gJ.of({read:()=>up({try:async()=>{{let e=localStorage.getItem(`porcelain.remotes`);return{remotes:e===null?[]:O2(JSON.parse(e)),missingCredentials:[]}}},catch:e=>new Au(e)}),write:({remotes:e})=>up({try:async()=>{let t=C2(e);localStorage.setItem(`porcelain.remotes`,t)},catch:e=>new Au(e)})});function Yle(e,t,n){let r=new Map;for(let t of[...e.state.value.operations.values()])t.receipt&&k3(t.receipt)||r.set(JSON.stringify([t.projectId,t.worktreeId]),{projectId:t.projectId,worktreeId:t.worktreeId,paths:new Set});for(let e of n){let t=JSON.stringify([e.projectId,e.worktreeId]),n=r.get(t)??{projectId:e.projectId,worktreeId:e.worktreeId,paths:new Set};for(let t of e.paths)t!==``&&n.paths.add(t);r.set(t,n)}return{projects:t?.projects.map(e=>e.id).slice(0,128)??[],worktrees:[...r.values()].slice(0,32).map(e=>({projectId:e.projectId,worktreeId:e.worktreeId,paths:[...e.paths].slice(0,64)}))}}var Xle=Um(`Live.connect`)(function*(e,t){let n=yield*UO,r=yield*d3,i=yield*E3,a=yield*I3,o=yield*uO,s=yield*lm(od(e.scope,`sequential`),e=>cd(e,Iu)),c=yield*nJ(yield*Xq().pipe(am(ed,s)))(),l=yield*$p(),u=Um(`Live.applyNotice`)(function*(t){if(t.type===`git-action`)return yield*a.refresh(t.receipt);if(t.type===`ready`)return yield*o.invalidate([D4.environment(e.environmentId)]);t.type===`inventory`&&(yield*o.invalidate([D4.inventory(e.environmentId),D4.reviewGitSettings(e.environmentId)])),t.type===`worktree`&&(yield*o.invalidate([D4.worktreeInventory(e.environmentId),...t.change===`git`?[D4.projectPullRequests(e.environmentId,t.projectId)]:[]])),t.type===`project`&&t.change===`preferences`&&(yield*o.invalidate([D4.filePreferences(e.environmentId,t.projectId)])),yield*o.invalidate(P3(e.environmentId,t))}),d=()=>{for(let t of i.state.value.operations.values())t.receipt&&k3(t.receipt)||c(Symbol(),H(function*(){let n=yield*R3(e,{...t}).pipe(nm(l));yield*u4(e),yield*a.refresh(n),yield*i.accept(n)}).pipe(Bp,jp))},f=yield*e.liveUpdates.connect({onNotice:t=>{e.isClosed()||s.state._tag===`Closed`||(t.type===`inventory`&&e.onStatusChange?.(),t.type===`ready`&&d(),c(Symbol(),H(function*(){yield*u(t),t.type===`git-action`&&!e.isClosed()&&s.state._tag!==`Closed`&&(yield*i.accept(t.receipt))}).pipe(Pp(()=>V(()=>{!e.isClosed()&&s.state._tag!==`Closed`&&d()})),jp)))},onReconnect:()=>{!e.isClosed()&&s.state._tag!==`Closed`&&e.onStatusChange?.()},onUnauthorized:()=>{e.isClosed()||s.state._tag===`Closed`||(e.onStatusChange?.(),t?t():c(Symbol(),o.invalidate([D4.inventory(e.environmentId)])))}}).pipe(am(ed,s)),p=``,m=H(function*(){if(e.isClosed()||s.state._tag===`Closed`)return;let t=Yle(i,er(Bw(n.get($4(e)))),a_(yield*r.snapshot)),a=JSON.stringify(t);a!==p&&(p=a,f.subscribe(t))}),h=()=>{!e.isClosed()&&s.state._tag!==`Closed`&&c(`subscription`,Tp(xp,m),{onlyIfMissing:!0})};yield*lm(V(()=>n.subscribe($4(e),h)),e=>V(e)).pipe(am(ed,s)),yield*lm(V(()=>i.state.subscribe(h)),e=>V(()=>e?.())).pipe(am(ed,s)),c(Symbol(),rO(r.changes,()=>V(h))),h()}),Zle=X(e=>e.atoms(t=>Pd(t(N4(e).layer),t(L3(e).layer),jd(e.runtime.contextEffect)))),Qle=X(({connection:e,onUnauthorized:t})=>Zle(e).atom(Xle(e,t)).pipe(pk(0))),$le=Ck(Mw(void 0)),eue=()=>CP(`idle`);function tue(e){return e instanceof V2?e.status===401:e instanceof RP||PM(e)?e.reason._tag===`SocketCloseError`&&e.reason.code===4001:!1}function t6(e,t=Tr(),n){let r=eue();return{state:r,connect:Um(`LiveUpdates.connect`)(function*({onNotice:i,onReconnect:a,onUnauthorized:o}){let s=yield*ej({projects:[],worktrees:[]}),c=yield*Bd,l=yield*DT(1),u=!1,d=LT(l);if(n?.activity){let e=n.activity,t=e.isActive(),r=!1,i=c.monotonicTimeNanosUnsafe();yield*lm(V(()=>e.subscribe(n=>{n&&(r=n===`suspend`);let a=!r&&e.isActive(),o=c.monotonicTimeNanosUnsafe();!a&&t&&(i=o),u||=n===`resume`,a&&(u||=!t&&o-i>=BigInt(3e4)*1000000n,kT(l,void 0)),t=a})),e=>V(e))}let f=yield*DT(1),p=0,m=500,h=sm(H(function*(){r.set(p===0?`connecting`:`reconnecting`);let t=yield*e,n=yield*Hu(),o=yield*Hu(),c=yield*Hu(),l=yield*loe({retryPolicy:Xte.pipe(Zte(),qte(({input:e})=>Gu(c,e)),Jte({times:0}))}).pipe(am(OM,t),am(BP,noe)),h=yield*soe(zZ,{disableTracing:!0}).pipe(am(HP,l)),g=(yield*eE(1)).withPermit(Cp(tj(s),e=>h.follow(e))),_=h.notices(void 0).pipe(rO(e=>H(function*(){e.type===`ready`?yield*Yu(o,void 0):i(e)}))),v=H(function*(){yield*Uu(o),yield*g,p>0&&a(),p+=1,m=500,r.set(`connected`),yield*Yu(n,void 0),i({type:`ready`})}).pipe(Up(Y2),Tp(gp));yield*op([_,Uu(n).pipe(Tp(Sm(LT(f).pipe(Tp(g))))),Sm(H(function*(){yield*d,yield*Uu(n);let e=u;u=!1,yield*g.pipe(Up(pse)),e&&(a(),i({type:`ready`}))})),v],{concurrency:`unbounded`}).pipe(Jp(Uu(c)))})),g=sm(H(function*(){for(yield*dm(()=>V(()=>r.set(`idle`)).pipe(Tp(NT(f)),Tp(NT(l))));;){let e=yield*Dp(h);if(Ru(e)&&tue(wu(e.cause))&&!(yield*n?.recoverUnauthorized?.()??B(!1)))return r.set(`unauthorized`),o(),yield*gp;r.set(p===0?`connecting`:`reconnecting`),yield*qp(m).pipe(Jp(d)),m=Math.min(m*2,fse)}}));return yield*xp.pipe(Tp(g),nm(t),Pp(e=>Eu(e)?pp:Gm(`Live updates stopped unexpectedly`)),Om),{subscribe(e){f.state._tag!==`Done`&&(Rm(nj(s,e)),kT(f,void 0))}}})}}function nue(e,t,n=Rm(Bd)){let r=CP(void 0),i=y2(e),a=new Set,o=()=>{a.clear(),r.set(void 0)},s=e=>{a.add(e.address),r.value?.address===e.address&&r.set(void 0)},c=XT(1),l=Um(`RemoteRoute.select`)((n=!1)=>H(function*(){if(n&&o(),r.value)return r.value;i.every(e=>a.has(e.address))&&a.clear();let s=0;for(let n of i){if(a.has(n.address))continue;let i=yield*n4(n,e.environmentId,t).pipe(Wp(X2));if(Yn(i)&&w2(e,i.value).kind===`online`)return r.set(n),n;Yn(i)&&i.value.kind===`unauthorized`&&s++}return a.clear(),s===i.length?yield*U(new V2({status:401,message:`This computer no longer accepts the saved connections. Pair it again.`})):yield*U(new xJ({message:`None of this computer’s saved connections could be reached and authorized.`}))}).pipe(tE(c))),u=e=>B2(e.address,e.credential,t);return{active:r,reset:o,failed:s,select:l,transport:async(e,t)=>{let r={...t?.signal?{signal:t.signal}:{}},a=await Pm(l().pipe(am(Bd,n)),r),o=t?.method===void 0||t.method===`GET`||t.method===`HEAD`,c=async n=>{try{let r=await u(n)(e,t);return r.status===401&&s(n),r}catch(e){throw t?.signal?.aborted||s(n),e}},d;try{d=await c(a)}catch(e){if(!o||t?.signal?.aborted||i.length===1)throw e;let s=await Pm(l().pipe(am(Bd,n)),r);if(s.address===a.address)throw e;return c(s)}if(d.status!==401||!o||i.length===1)return d;let f=await Pm(l().pipe(une,am(Bd,n)),r);return Yn(f)&&f.value.address!==a.address?c(f.value):d},transportFor:u}}function rue(e,t,n,r,i){return t6(H(function*(){let i=r?yield*r.select():void 0;return i&&r&&(yield*dm(e=>V(()=>{Ru(e)&&!Eu(e.cause)&&r.failed(i)}))),yield*H(function*(){let{ticket:a}=yield*H(function*(){return yield*W2((yield*$2).session.issueLiveTicket())}).pipe(tm($2.layer(i&&r?r.transportFor(i):t))),o=new URL(i?.address??e);return yield*n(`${o.protocol===`https:`?`wss:`:`ws:`}//${o.host}${Y4({query:{ticket:a}})}`)}).pipe(Up(Y2))}),void 0,{...i?{activity:i}:{},...r?{recoverUnauthorized:()=>r.select().pipe(Xp({onSuccess:()=>!0,onFailure:e=>!(e instanceof V2&&e.status===401)}))}:{}})}function n6(e,t,n){let{connection:r}=Vle(e,n,Fd(zd(lle),B4.layer).pipe(Rd(t))),i=Ie({...r,get address(){return e.activeRoute?.value?.address??e.address},...e.activeRoute?{activeRoute:e.activeRoute}:{},liveUpdates:e.liveUpdates,...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},operations:r.runtime.runSync(E3)});return r.runtime.runSync(B4).adopt(i),i}function iue(e,t,n){let r=nue({...e,name:``},e.send),i=r.transport;return n6({environmentId:e.environmentId,address:e.address,transport:i,cacheIdentity:[e.address,e.deviceId??``],activeRoute:r.active,liveUpdates:rue(e.address,i,e.socket,r,e.activity),...e.onStatusChange?{onStatusChange:e.onStatusChange}:{},timeoutMs:e.timeoutMs},t,n)}function r6(e){return WM(e).pipe(am(UM,e=>new WebSocket(e)))}function aue(e){return t6(r6(`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}${Y4({query:{}})}`),void 0,{activity:e})}function oue(e){return e instanceof zQ?`This file is binary or uses an unsupported text encoding.`:e instanceof MQ?`This file is too large to display as text.`:null}var sue=X(({connection:e,scope:t,path:n})=>h3({connection:e,scope:t},[`text`,n],e=>e.files.readTextFile({params:{worktreeId:t.worktreeId},query:{path:n}}).pipe(Mp(e=>{let t=oue(e);return t?B({kind:`unreadable`,reason:t}):U(e)})),e=>`reason`in e||e.worktreeId===t.worktreeId&&e.path===n,[n])),i6=X(({connection:e,scope:t,path:n})=>h3({connection:e,scope:t},[`directory`,n],e=>e.files.listDirectory({params:{worktreeId:t.worktreeId},query:{path:n}}),e=>e.worktreeId===t.worktreeId,[n]).pipe(p3));function a6({connection:e,scope:t,paths:n}){return n.map(n=>i6({connection:e,scope:t,path:n}))}var cue=X(e=>Ck(t=>a6(e).map(e=>t(e)))),lue=X(e=>Rk((t,n)=>{for(let t of a6(e))n.refresh(t)})),uue=X(e=>h3(e,[`paths`],t=>t.files.listWorktreePaths({params:{worktreeId:e.scope.worktreeId}}),t=>t.worktreeId===e.scope.worktreeId)),due=X(({connection:e,scope:t,path:n})=>f3(e,t,[`asset`,n],H(function*(){return yield*(yield*a4(e)).request(e=>e.files.readFileAsset({params:{worktreeId:t.worktreeId},query:{path:n}}))}),s4(e),[n]));function fue(e,t,n){let r=e===`file`?`untitled`:`new-folder`,i=n=>`${t}${n}${e===`directory`?`/`:``}`;if(!n(i(r)))return i(r);let a=2;for(;n(i(`${r}-${a}`));)a+=1;return i(`${r}-${a}`)}function pue(e,t){let n=e.lastIndexOf(`/`)+1,r=e.slice(n),i=r.lastIndexOf(`.`),a=i>0?r.slice(0,i):r,o=i>0?r.slice(i):``,s=t=>`${e.slice(0,n)}${a} copy${t}${o}`;if(!t(s(``)))return s(``);let c=2;for(;t(s(` ${c}`));)c+=1;return s(` ${c}`)}function mue(e){return e.filter(t=>!e.some(e=>e!==t&&e.endsWith(`/`)&&t.startsWith(e)))}function hue(e,t){return!e.some(e=>e.endsWith(`/`)&&t.startsWith(e))}function o6(e){return e.replace(/\/$/,``).split(`/`).at(-1)??e}function gue(e){return e.filter(e=>e.endsWith(`/`))}function _ue(e){return e.split(`/`).slice(0,-1).map((e,t,n)=>`${n.slice(0,t+1).join(`/`)}/`)}function vue(e){let t=[];return e.folder&&!e.link&&(t.push({id:`new-file`,label:`New file`}),t.push({id:`new-folder`,label:`New folder`})),e.link||t.push({id:`rename`,label:`Rename`}),e.openable&&!e.folder&&!e.link&&t.push({id:`duplicate`,label:`Duplicate`}),e.openable&&(t.push(e.changed?{id:`open-diff`,label:`Open diff`}:{id:`open`,label:`Open`}),e.openToSideLabel!==void 0&&t.push({id:`open-to-side`,label:e.openToSideLabel}),e.changed&&t.push({id:`open-file`,label:`Open file`}),!e.folder&&!e.link&&t.push({id:`timeline`,label:`Show timeline`})),e.pinned!==void 0&&t.push({id:`pin`,label:`${e.pinned?`Unpin`:`Pin`} ${e.folder?`folder`:`file`}`}),t.push({id:`hide`,label:e.hiddenEntry===null?e.folder?`Hide folder`:`Hide file`:e.ownHidden?e.folder?`Show folder`:`Show file`:`Show ${e.hiddenName}`}),t.push({id:`copy-relative`,label:`Copy relative path`}),t.push({id:`copy-full`,label:`Copy full path`}),t.push({id:`trash`,label:`Move to trash`}),t}function yue(e,t){return vue({...t,folder:e?.kind===`directory`,link:e?.kind===`symlink`||e?.kind===`submodule`,openable:e?.kind===`file`})}var s6=class e extends dr()(`@porcelain/client/FileEdits`){static layer(t,n){return kd(e,H(function*(){let e=yield*a4(t),r=yield*B4,i=yield*uO;return{execute:Um(`Files.edit`)(function*(a){let o=`${JSON.stringify([n.projectId,n.worktreeId])}/`,s=a.kind===`move`||a.kind===`trash`?[...r.entries(t)].filter(([e])=>e===`${o}${a.path}`||e.startsWith(`${o}${a.path}/`)):[];return yield*t.request(um(V(Symbol),i=>xm(o=>H(function*(){if(yield*o(u4(t)),s.some(([,e])=>e.state.value.owner!==null))return yield*U(new xJ({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!e.claim(i))return yield*U(new xJ({message:`Finish editing this file or its open children before moving this entry.`}));for(let[,e]of s)if(!(yield*o(e.save())))return yield*U(new xJ({message:`Save or discard the unsaved draft before moving this entry.`}));let c={worktreeId:n.worktreeId},l=yield*o(e.request(e=>{switch(a.kind){case`write`:return e.files.editFile({params:c,payload:a});case`create`:return e.files.editFile({params:c,payload:a});case`move`:return e.files.editFile({params:c,payload:a});case`copy`:return e.files.editFile({params:c,payload:a});case`trash`:return e.files.editFile({params:c,payload:a})}}));return yield*u4(t,l.path===(a.kind===`move`||a.kind===`copy`?a.destination:a.path)),(a.kind===`move`||a.kind===`trash`)&&(yield*r.relocate(t.environmentId,s.map(([e])=>e),a,n)),l})),e=>H(function*(){for(let[,t]of s)t.release(e);t.isClosed()||(yield*i.invalidate(P3(t.environmentId,{type:`worktree`,...n,change:`files`})))})))})}}))}},c6=X(({connection:e,scope:t})=>e.atoms(n=>Rd(s6.layer(e,t),Fd(n(s4(e).layer),B4.layer)))),bue=X(e=>c6(e).fn(e=>s6.use(t=>t.execute(e)),{concurrent:!0})),xue=X(e=>V4(e.connection).atom(H(function*(){let t=yield*B4,n=yield*UO;return yield*t.retain({...e,environmentId:e.connection.environmentId,writer:{write:({path:r,text:i,expectedFingerprint:a})=>{let o=c6({connection:t.connection(e.connection),scope:e.scope});return um(V(()=>n.mount(o)),()=>H(function*(){let e=yield*Nr(yield*GO(n,o),s6).execute({kind:`write`,path:r,text:i,expectedFingerprint:a});return e.contentFingerprint?e.contentFingerprint:yield*U(new xJ({message:`The server did not confirm the saved version.`}))}),e=>V(e))}}})}))),Sue=Um(`Files.moveEntries`)(function*(e,t,n){for(let r of mue(e)){let e=`${t}${o6(r)}`;r.replace(/\/$/,``)!==e.replace(/\/$/,``)&&(yield*n(r,e))}}),Cue=Um(`Files.completeDraft`)(function*(e,t){(yield*e.save())&&t()}),l6=X(e=>{class t extends dr()(`@porcelain/client/PreviewAssets`){static layer=kd(t,H(function*(){let t=yield*a4(e);return{read:Um(`PreviewAssets.read`)(function*(n,r,i){let a=yield*t.request(e=>e.files.readPreviewAssets({params:{worktreeId:n.worktreeId},payload:{document:r,paths:[...i]}}));return yield*u4(e),new Map(a.assets.map(e=>[e.path,e.kind===`asset`?e:null]))})}}))}return t}),wue=class extends Y()(`HtmlPreviewUnavailable`,{}){get message(){return`Could not prepare the HTML preview. Try again.`}},u6=class extends dr()(`@porcelain/client/HtmlPreviewPlatform`){},Tue=X(({connection:e,platform:t})=>e.atoms(n=>Rd(Fd(l6(e).layer,t),n(s4(e).layer)))),Eue=X(({connection:e,scope:t,path:n,html:r,platform:i})=>f3(e,t,[`html-preview`,n,r],H(function*(){let i=yield*u6,a=yield*l6(e);return yield*i.render(r,n,e=>a.read(t,n,e))}),Tue({connection:e,platform:i}),[n]));function Due(e){return new TextDecoder().decode(Uint8Array.from(atob(e.base64),e=>e.charCodeAt(0)))}var Oue=Um(`HtmlPreview.collectAssets`)(function*(e,t,n){let r=new Map,i=0,a=e;for(let e=0;e<8;e+=1){let e=[...new Set(a)].filter(e=>!r.has(e));if(e.length===0)return r;let o=64-r.size;if(o<=0){for(let t of e)r.set(t,null);return r}let s=e.slice(0,o);for(let t of e.slice(o))r.set(t,null);let c=yield*t(s),l=[];for(let e of s){let t=c.get(e)??null;t===null?r.set(e,null):(i+=t.base64.length,i>29360128?r.set(e,null):(r.set(e,t),t.mediaType===`text/css`&&l.push(...n(Due(t),e))))}a=l}return r}),kue=X(e=>s4(e).atom(o4(e,e=>e.gitActions.listCommitModels())).pipe(pk(Z2),Qk({staleTime:Z2,revalidateOnFocus:!1})));function Aue(e){return kue(e)}var d6=X(({connection:e,scope:t})=>s4(e).fn(Um(`GitActions.generateCommitDraft`)(function*({lifetime:n,...r}){let i=yield*(yield*a4(e)).request(e=>e.gitActions.generateCommitDraft({params:{worktreeId:t.worktreeId},payload:r}),n);return yield*u4(e),i}),{concurrent:!0})),jue=X(({connection:e,scope:t})=>s4(e).fn(Um(`GitActions.dismissInterrupted`)(function*(n){yield*(yield*a4(e)).request(e=>e.gitActions.dismissInterruptedGitAction({params:{worktreeId:t.worktreeId,requestId:n}})),yield*u4(e),yield*mO([D4.reviewSurface(e.environmentId,t,[`changes`])])}))),Mue=X(e=>Ck(H(function*(){let t=yield*UO,n=d6(e);return Um(`CommitDraft.submit`)(function*(e,r){return t.set(n,{...e,lifetime:r}),yield*GO(t,n,{suspendOnWaiting:!0})})})));function f6(e,t=[],n,r=t.length>0){let i=new Set(t);return{headOid:e.headOid??void 0,inProgress:e.inProgress??void 0,mergeHeadOid:e.mergeHeadOid??void 0,branch:e.branch?.name??void 0,...n===void 0?{}:{upstreamOid:n},...r?{files:(e.files??[]).flatMap(e=>i.has(e.path)&&e.fingerprint!==null&&e.fingerprint!==void 0?[{path:e.path,fingerprint:e.fingerprint}]:[])}:{}}}var p6=e=>![`succeeded`,`no-change`].includes(e.state),m6=e=>e.message??(e.reason?e.reason.replaceAll(`_`,` `).toLowerCase():`Git ${e.state}`),h6=e=>e.state===`rejected`&&e.reason===`CHANGED_SINCE_LOOKED`;function g6(e){return e instanceof Error?e.message:`Git could not complete this action. Check the current state and try again.`}var _6=e=>t=>V(()=>{Eu(t)||e.setError(wu(t))}),Nue=Um(`CommitForm.generate`)(function*(e,t,n=e.paths){let{model:r,working:i,setBusy:a,setError:o,generator:s,status:c,setDrafted:l,setDone:u,setActiveGroup:d,setMessage:f,setGroups:p}=e;if(!r||!n.length||i)return;a(!0),o(null),yield*dm(()=>V(()=>a(!1)));let m=yield*s.submit({mode:t,model:r,paths:n,expectedStatusToken:c.statusToken});l(t,m.expectedFiles),u(new Set),d(null),t===`message`?(f(m.groups[0]?.message??``),p(null)):p(m.groups.map(t=>({...t,id:e.createId()})))},sm,(e,t)=>e.pipe(Pp(_6(t)))),Pue=Um(`CommitForm.commit`)(function*(e){let{working:t,uncertain:n,setBusy:r,setError:i,currentMessage:a,mode:o,commitAction:s,paths:c,status:l,groups:u,done:d,ownHead:f,onBusy:p,setActiveGroup:m,git:h,setOwnHead:g,setDone:_}=e;if(t||n||(r(!0),i(null),yield*dm(()=>V(()=>r(!1))),o===`groups`&&!u?.length))return;let v=s===`amend`?[{id:`single`,message:a,paths:c}]:o===`groups`&&u?u.filter(e=>!d.has(e.id)):[{id:`single`,message:a,paths:c}],y=f??l.headOid??null;p(!0),yield*dm(()=>V(()=>p(!1)));for(let e of v){if(!e.message.trim()||s!==`amend`&&l.inProgress!==`merge`&&!e.paths.length)return yield*U(new Au(void 0,`Give every commit a message and at least one file.`));m(e.id);let t=yield*h.run({action:s,message:e.message,paths:e.paths},f6({...l,headOid:y},l.inProgress===`merge`?l.files?.map(e=>e.path)??[]:e.paths,void 0,!0));if(p6(t))return yield*U(new Au(void 0,m6(t)));t.result?.headOid&&(y=t.result.headOid,g(y)),_(t=>new Set([...t,e.id])),m(null)}},sm,(e,t)=>e.pipe(Pp(_6(t)))),Fue=Um(`CommitForm.lookAgain`)(function*(e){let{onLookAgain:t,working:n,setBusy:r,setError:i,git:a,setOwnHead:o}=e;t&&!n&&(r(!0),i(null),yield*dm(()=>V(()=>r(!1))),yield*t,yield*a.startNew(),o(null))},sm,(e,t)=>e.pipe(Pp(_6(t)))),Iue=Um(`CommitForm.recover`)(function*(e){let{setError:t,git:n,activeGroup:r,setDone:i,setActiveGroup:a,setOwnHead:o}=e;t(null);let s=yield*n.recover();r&&[`succeeded`,`no-change`].includes(s.state)&&(s.result?.headOid&&o(s.result.headOid),i(e=>new Set([...e,r])),a(null))},(e,t)=>e.pipe(Pp(_6(t))));function v6(e){return{statusToken:e.statusToken,inProgress:e.inProgress,mergeHeadOid:e.mergeHeadOid,headOid:e.headOid,branch:e.branch,changes:e.changes.flatMap(e=>e.comparisons),files:e.changes.map(({path:e,fingerprint:t})=>({path:e,fingerprint:t}))}}function Lue(e,t){return e==null?t:t==null||t.name!==e.name||t.upstream!==e.upstream?e:{...t,name:e.name,upstream:e.upstream,ahead:e.ahead,behind:e.behind}}function y6(e){return e.branch??null}function b6(e){return e.changes.some(e=>e.scope===`unmerged`)}function Rue(e,t){let n=y6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;if(t.inProgress===`merge`&&!t.mergeHeadOid)return`Finish this merge in a terminal.`;switch(e){case`switch`:return t.changes.length?`Commit or stash local changes before switching branches.`:null;case`commit`:return b6(t)&&t.inProgress!==`merge`?`Resolve the conflicts before committing.`:null;case`amend`:return b6(t)?`Resolve the conflicts before amending.`:t.headOid===null||t.headOid===void 0?`There is no commit to amend.`:null;case`push`:return n?n.name===null||n.name===void 0?`Detached HEAD: check out a branch before pushing.`:n.behind>0?`Pull the upstream changes before pushing.`:n.ahead>0||n.upstream===null||n.upstream===void 0?null:`No local commits to push.`:null;case`pull`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to pull from.`:t.changes.length?`Commit or stash local changes before pulling.`:n?.name===null?`Detached HEAD: check out a branch before pulling.`:null;case`fetch`:return n?.upstream===null||n?.upstream===void 0?`No upstream branch to fetch.`:null;case`stash-create`:return null;case`stash-apply`:case`stash-pop`:return n?.stashes&&n.stashes.length===0?`No stash is available.`:null;case`discard`:return null}}function zue(e,t){let n=y6(t);if(t.inProgress===`rebase`)return`Continue or abort the rebase in a terminal.`;if(t.inProgress===`merge`&&e!==`commit`)return`Finish or abort the merge first.`;switch(e){case`switch`:return null;case`commit`:return t.changes.length?null:`Nothing to commit.`;case`amend`:return t.changes.length?`Choose which changed files to add to the last commit.`:`Change the last commit message.`;case`push`:return n==null?`Enter the configured remote and full branch ref.`:null;case`pull`:case`fetch`:return n==null?`Enter the configured remote and full branch ref.`:null;case`stash-create`:return t.changes.length===0?`Nothing changed; the server will report no change.`:null;case`stash-apply`:case`stash-pop`:return n?.stashes===null||n?.stashes===void 0?`Enter a full stash object ID.`:null;case`discard`:return null}}function Bue(e,t){let n=y6(t);return e.kind!==`run`||n==null?null:e.action===`pull`?n.behind:n.ahead}function Vue(e){if(e.inProgress===`rebase`||e.inProgress===`merge`&&!e.mergeHeadOid)return{kind:`hint`,label:`Git recovery`,hint:`Finish or abort this operation in a terminal.`};if(e.inProgress===`merge`||e.changes.length>0)return{kind:`commit`,label:`Commit`};let t=y6(e);return t==null?{kind:`hint`,label:`Commit`,hint:`Nothing to commit. Choose a Git action to continue.`}:t.name===null||t.name===void 0?{kind:`hint`,label:`Commit`,hint:`Detached HEAD: check out a branch before pushing.`}:t.behind>0?{kind:`run`,action:`pull`,label:`Pull`}:t.ahead>0?{kind:`run`,action:`push`,label:`Push`}:(t.stashes?.length??0)>0?{kind:`stash`,label:`Apply stash`}:{kind:`hint`,label:`Commit`,hint:`Nothing to commit, pull or push.`}}var x6=Um(`GitActions.restoreStash`)(function*(e,t,n,r,i){let a=yield*e.run({action:`stash-apply`,...t},n).pipe(Op(e=>p6(e)?m6(e):null),Mp(e=>B(g6(e))));r(a===null?{title:i.restored,type:`success`}:{title:i.failed,description:a,type:`error`})}),Hue=Um(`Discard.restore`)(function*({what:e,readChanges:t,notify:n,dismissNotice:r,restore:i},a,o,s){let c=yield*t().pipe(Op(v6),Mp(t=>V(()=>(n({title:`Could not restore ${e}`,description:g6(t),type:`error`}),null))));if(!c)return;let l=c.files?.filter(e=>e.fingerprint!==null&&e.fingerprint!==void 0).map(e=>e.path)??[];r(s),yield*x6(i,{stashOid:a,restoreIndex:o},f6(c,l,void 0,!0),n,{restored:`Restored ${e}`,failed:`Could not restore ${e}`})});function Uue(e,t){let{what:n,notify:r,close:i}=e;if(p6(t))return{text:m6(t),moved:h6(t)};i();let a=t.result?.restoreStashOid;if(t.state===`no-change`)return r({title:`Nothing to discard`,description:`${n} already matches the last commit.`,type:`info`}),null;let o=t.result?.restoreIndex??!1,s=r({title:`Discarded ${n}`,type:`success`,timeout:e.restoreTimeoutMs,...a?{actionProps:{children:`Restore`,onClick:()=>e.run(Hue(e,a,o,s))}}:{}});return null}var Wue=Um(`Discard.finish`)(function*(e,t){return Uue(t,yield*e)});function Gue(e){return e===`fetch`||e===`pull`||e===`push`}function Kue(e,t,n){return e?n&&(e.branch?.name!==t?.name||e.branch?.upstream!==t?.upstream)?{ready:!1,reason:`The branch target changed. Review it and try again.`}:{ready:!0,looked:e}:{ready:!1,reason:`The branch target is still loading. Try again.`}}function que(e,t,n){if(!t?.name)throw Error(`Check out a branch before using the remote.`);if(e===`fetch`||e===`pull`){if(!t?.upstream||!t.remoteName||!t.sourceRef)throw Error(`Configure an upstream branch first.`);let r=`${t.remoteName}/`;if(!t.upstream.startsWith(r)||t.sourceRef!==`refs/heads/${t.upstream.slice(r.length)}`)throw Error(`The configured upstream changed. Review it and try again.`);return e===`fetch`?{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef}:{action:e,remoteName:t.remoteName,sourceRef:t.sourceRef,strategy:n}}let r=t.sourceRef??`refs/heads/${t.name}`;return{action:e,remoteName:t.remoteName??`origin`,destinationRef:r,allowCreate:t?.upstream===null||t?.upstream===void 0}}var S6=e=>e===`fetch`?`Fetch`:e===`pull`?`Pull`:`Push`;function C6(e,t){let n=S6(e);return{title:t.state===`interrupted`?`${n} outcome not confirmed`:t.state===`conflicted`?`${n} needs conflict resolution`:t.state===`rejected`?`${n} did not run`:t.state===`running`?`${n} in progress`:n,description:m6(t),type:t.state===`succeeded`||t.state===`no-change`?`success`:t.state===`running`?`info`:`error`}}var Jue=e=>e===`fetch`?`Fetching`:e===`pull`?`Pulling`:`Pushing`,w6=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Yue(e,t){if(e.kind===`hint`)return e.hint;if(e.kind===`commit`)return`Commit ${w6(t.changes.length,`changed file`)}`;let n=y6(t);if(e.kind===`stash`){let e=n?.stashes?.[0]?.message;return e?`Apply the stash “${e}”`:`Apply the latest stash`}let r=n?.upstream??`the configured remote`;return e.action===`pull`?`Pull from ${r}`:`Push ${w6(n?.ahead??0,`commit`)} to ${r}`}var Xue=Um(`GitMenu.runNetwork`)(function*(e,t,n,r){let{details:i}=e,a=e.onResult,o=S6(n);if(n===`pull`&&e.pull.kind===`blocked`){a({title:`${o} did not run`,description:e.pull.reason,type:`error`});return}let s=jw(i.result)?i.result.value:void 0,c=!s;c&&e.enableDetails();let l=Kue(s??(yield*i.read()),r,c);if(!l.ready){a({title:`${o} did not run`,description:l.reason,type:`error`});return}let{looked:u}=l,d=yield*bp({try:()=>que(n,u.branch,e.pull.kind===`ready`?e.pull.strategy:`merge`),catch:e=>new Au(e,g6(e))});a(C6(n,yield*um(V(()=>e.onProgress(!0)),()=>t.run(d,f6(u,[],u.branch?.upstreamOid??null)),()=>V(()=>e.onProgress(!1)))))},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.onResult({title:`${S6(r)} outcome not confirmed`,description:g6(e),type:`error`}))))),Zue=Um(`GitMenu.recoverNetwork`)(function*(e,t,n){let r=yield*t.recover();e.onResult(C6(n,r))},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.onResult({title:`${S6(r)} outcome not confirmed`,description:g6(e),type:`error`}))))),Que=Um(`GitMenu.restoreDiscarded`)(function*(e,t,n){let{details:r,notify:i}=e,a=n.kind===`rename`?`rename of ${n.path}`:`hunk of ${n.path}`,o=er(Bw(r.result));(!o||Nw(r.result))&&(e.enableDetails(),o=yield*r.read()),yield*x6(t,{stashOid:n.oid,restoreIndex:n.kind===`rename`},f6(o,[n.path],void 0,!0),i,{restored:`Restored the discarded ${a}`,failed:`Could not restore the discarded ${a}`})},(e,t,n,r)=>e.pipe(Mp(e=>V(()=>t.notify({title:`Could not restore the discarded ${r.kind===`rename`?`rename of ${r.path}`:`hunk of ${r.path}`}`,description:g6(e),type:`error`}))))),$ue=Um(`GitActions.lookAgain`)(function*(e,t){yield*e,yield*t}),ede=Um(`GitActions.refreshLook`)(function*(e,t){t(v6(yield*e))});X(e=>Ck(null).pipe(Jk));function T6(e){return D3.of({read:()=>bp(()=>{if(!e)throw Error(`Pair this environment again to identify its pending Git operations.`);return window.sessionStorage.getItem(e)}),write:t=>bp(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.setItem(e,t)}),clear:()=>bp(()=>{if(!e)throw Error(`Pending Git operations require an identified connection.`);window.sessionStorage.removeItem(e)})})}var E6=Xh;function tde(e){if(!e)throw Error(`A connected environment is required`);return e}var D6={name:()=>typeof navigator>`u`?`Browser`:Z3(navigator.userAgent).slice(0,120)||`Browser`,send:fetch,statusActivity:$3};function nde(e,t){return n6({environmentId:e,address:t.address,transport:t.transport,liveUpdates:t.liveUpdates,timeoutMs:J3},Fd(E6,wd(D3,T6(t.operationsKey))),A6.memoMap)}var O6=CP(void 0);function rde({inventory:e,principal:t}){O6.set(t.kind===`device`?t.deviceId:void 0);let n=t.kind===`owner`?`owner`:t.deviceId,r=nde(e.environmentId,{address:window.location.href,transport:Q4(fetch),liveUpdates:aue($3),operationsKey:`porcelain-git-requests:${JSON.stringify([e.environmentId,t.kind,n])}`});return r.atoms.addGlobalLayer(wd(j4,qn(e))),r}function ide(e){return iue({...e,send:fetch,...D6.statusActivity?{activity:D6.statusActivity}:{},socket:r6,onStatusChange:()=>t4(D6,e),timeoutMs:J3},Fd(E6,wd(D3,T6(b2(e)?`porcelain-git-requests:${b2(e)}`:void 0))),A6.memoMap)}var ade=Pd(Fd(P2.layer,H4.layer).pipe(Ld(wd(gJ,Jle))),wd(_J,D6),B4.layer,wd(F2,{local:e=>lm(V(()=>rde(e)),e=>lp(()=>e.close()))}),wd(I2,{open:e=>lm(V(()=>ide(e)),e=>lp(()=>e.close()))}),wd(U4,{forgetEnvironment:()=>pp})),k6=z2.pipe(Rd(Pd(W4.layer,L2.layer,R2.layer).pipe(Rd(ade)))),A6=aJ(k6),j6=Mk({memoMap:A6.memoMap})(k6),ode=A6.runSync(P2),M6=A6.runSync(L2),N6=A6.runSync(R2),P6=N6.state,sde=j6.atom(H(function*(){yield*(yield*W4).read()}));function cde(){tI(sde)}function F6(){return pI(ode.state)}function I6(){return pI(M6.state).connection}function lde(){return pI(N6.state)}function L6(e){let t=(0,VW.c)(5),n=pI(N6.state),r;if(t[0]!==e||t[1]!==n){let i;t[3]===e?i=t[4]:(i=t=>t.remote.environmentId===e,t[3]=e,t[4]=i),r=n.find(i),t[0]=e,t[1]=n,t[2]=r}else r=t[2];return r}function R6(e){let t=(0,VW.c)(6),n=I6();if(e){let n;return t[0]===e?n=t[1]:(n={connection:e},t[0]=e,t[1]=n),n}let r;t[2]===n?r=t[3]:(r=tde(n),t[2]=n,t[3]=r);let i;return t[4]===r?i=t[5]:(i={connection:r},t[4]=r,t[5]=i),i}var ude=Ase({transport:Q4(fetch),platform:D6});function dde(e,t,n){return A6.runPromise(mce(e,ude,t,J3),{signal:n})}var fde=X(e=>Ck(t=>{let n=()=>{window.location.hash&&e()};window.addEventListener(`hashchange`,n),n(),t.addFinalizer(()=>window.removeEventListener(`hashchange`,n))})),pde=uce(Q4(fetch,{reportUnauthorized:!1}));function mde(e){return A6.runPromise(hce(e,pde))}var hde=Ck(e=>{e.addFinalizer(wce(()=>{A6.runFork(M6.clear())}))});function gde(){return aI(hde),Z4}function z6(e){let t=(0,VW.c)(3),n=L6(e.environmentId)?.connection,r;return t[0]!==e||t[1]!==n?(r=r4(D6,e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],tI(r)}function _de(e){let t=(0,VW.c)(7),{className:n}=e,r;t[0]===n?r=t[1]:(r=jG(`shrink-0`,n),t[0]=n,t[1]=r);let i,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`21`,height:`21`,rx:`4.5`}),a=(0,Q.jsx)(`path`,{d:`M12 3v5.5q0 .5-.5 .5h-2q-.5 0-.5 .5V11q0 .5.5 .5H12v2q0 .5.5 .5h2q.5 0 .5 .5V16q0 .5-.5 .5H12V21`}),t[2]=i,t[3]=a):(i=t[2],a=t[3]);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`g`,{fill:`currentColor`,stroke:`none`,children:[(0,Q.jsx)(`circle`,{cx:`12`,cy:`6.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`11.5`,r:`1.25`}),(0,Q.jsx)(`circle`,{cx:`12`,cy:`16.5`,r:`1.25`})]}),t[4]=o):o=t[4];let s;return t[5]===r?s=t[6]:(s=(0,Q.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:r,children:[i,a,o]}),t[5]=r,t[6]=s),s}function B6(e){let t=(0,VW.c)(5),{children:n}=e,r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(_de,{className:`size-6`}),i=(0,Q.jsx)(`h1`,{className:`text-lg font-medium tracking-tight`,children:`Porcelain`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 px-6 md:px-8`,children:[r,i,(0,Q.jsxs)(`a`,{href:`https://porcelain.fabiofiorita.com/install`,target:`_blank`,rel:`noreferrer`,className:`ml-auto inline-flex items-center gap-1 rounded-md p-1 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[`Install guide`,` `,(0,Q.jsx)(tK,{"aria-hidden":`true`,className:`size-3.5`})]})]}),t[2]=a):a=t[2];let o;return t[3]===n?o=t[4]:(o=(0,Q.jsxs)(`div`,{className:`pairing-page flex min-h-svh flex-col bg-background`,children:[a,(0,Q.jsx)(`main`,{className:`mx-auto flex w-full max-w-7xl flex-1 flex-col px-6 pb-7 pt-10 md:px-14 md:pt-14`,children:n})]}),t[3]=n,t[4]=o),o}var vde=`a[href], button, summary, [role="button"], [role="link"]:not([aria-disabled="true"]), [role="tab"], [role="option"], [role="checkbox"], [role="radio"], [role="switch"], [role^="menuitem"], [tabindex]:not([tabindex="-1"]), [data-truncated]`;function V6(e,t){return e===`start`?(0,Q.jsx)(`bdi`,{dir:`ltr`,children:t}):t}function yde(e,t){if(t===1)return e.scrollWidth>e.clientWidth;let n=e.clientHeight,r=e.style.webkitLineClamp;try{return e.style.webkitLineClamp=`unset`,e.clientHeight>n}finally{e.style.webkitLineClamp=r}}function H6(e){let t=(0,VW.c)(39),{text:n,children:r,className:i,render:a,renderTrigger:o,propagateEscape:s,lines:c,disclose:l,cut:u}=e,d=s!==void 0&&s,f=c===void 0?1:c,p=l===void 0?`clipped`:l,m=u===void 0?`end`:u,h=(0,Z.useId)(),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(!1),w;t[0]!==g||t[1]!==p||t[2]!==n?(w=n.trim()!==``&&(g||p===`always`),t[0]=g,t[1]=p,t[2]=n,t[3]=w):w=t[3];let T=w,E=o!==void 0,D;t[4]!==h||t[5]!==f||t[6]!==d||t[7]!==E?(D=()=>e=>{if(!e)return;let t=()=>[e,...e.querySelectorAll(`[data-truncated]`)].filter(e=>e.getAttribute(`data-truncated`)===h),n=E?null:e.parentElement?.closest(vde)??null,r=!0,i=()=>{r&&_(t().some(e=>yde(e,f)))},a=()=>{n?.matches(`:focus-visible`)&&!n.hasAttribute(`data-clipped`)&&n.querySelector(`[data-clipped]`)===e&&C(!0)},o=()=>C(!1),s=t=>{t.key===`Escape`&&e.hasAttribute(`data-popup-open`)&&(C(!1),x(!1),d||t.stopPropagation())};y(n!==null),i();let c=new ResizeObserver(i);for(let e of t())c.observe(e);let l=new MutationObserver(i);return l.observe(e,{characterData:!0,childList:!0,subtree:!0}),document.fonts.ready.then(i),n?.addEventListener(`focus`,a),n?.addEventListener(`blur`,o),n?.addEventListener(`keydown`,s),()=>{r=!1,c.disconnect(),l.disconnect(),n?.removeEventListener(`focus`,a),n?.removeEventListener(`blur`,o),n?.removeEventListener(`keydown`,s)}},t[4]=h,t[5]=f,t[6]=d,t[7]=E,t[8]=D):D=t[8];let[O]=(0,Z.useState)(D),k=!E&&!v,A;t[9]===h?A=t[10]:(A=(e,t,n)=>{let r=n===void 0?`end`:n;return(0,Q.jsx)(`span`,{dir:r===`start`?`rtl`:void 0,className:jG(`min-w-0 truncate`,r===`start`&&`text-left`,t),"data-truncated":h,children:V6(r,e)})},t[9]=h,t[10]=A);let j=A,M;t[11]===a?M=t[12]:(M=a??(0,Q.jsx)(`span`,{}),t[11]=a,t[12]=M);let N=M,P;if(t[13]!==r||t[14]!==i||t[15]!==j||t[16]!==m||t[17]!==T||t[18]!==N||t[19]!==h||t[20]!==f||t[21]!==a?.props.className||t[22]!==o||t[23]!==k||t[24]!==n||t[25]!==E){let e=(0,Z.cloneElement)(N,{tabIndex:k&&T?0:void 0,dir:m===`start`?`rtl`:void 0,"aria-label":k?n:void 0,"data-truncated":h,"data-clipped":!E&&T?``:void 0,className:jG(`relative min-w-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,f===3?`line-clamp-3 whitespace-normal`:`truncate`,m===`start`&&`text-left`,a?.props.className,i)},V6(m,r??n));P=o?.(e,j)??e,t[13]=r,t[14]=i,t[15]=j,t[16]=m,t[17]=T,t[18]=N,t[19]=h,t[20]=f,t[21]=a?.props.className,t[22]=o,t[23]=k,t[24]=n,t[25]=E,t[26]=P}else P=t[26];let F=P,I=!T,L=T&&(b||S),R;t[27]===d?R=t[28]:(R=(e,t)=>{x(e),e||C(!1),d&&t.reason===`escape-key`&&t.allowPropagation()},t[27]=d,t[28]=R);let ee;t[29]===F?ee=t[30]:(ee=(0,Q.jsx)(Eq,{ref:O,render:F,children:F.props.children}),t[29]=F,t[30]=ee);let z;t[31]===n?z=t[32]:(z=(0,Q.jsx)(Dq,{role:`tooltip`,className:`wrap-anywhere`,children:n}),t[31]=n,t[32]=z);let te;return t[33]!==I||t[34]!==L||t[35]!==R||t[36]!==ee||t[37]!==z?(te=(0,Q.jsxs)(Tq,{disabled:I,disableHoverablePopup:!0,open:L,onOpenChange:R,children:[ee,z]}),t[33]=I,t[34]=L,t[35]=R,t[36]=ee,t[37]=z,t[38]=te):te=t[38],te}function U6({className:e,...t}){return(0,Q.jsx)(kK,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:jG(`size-4 animate-spin`,e),...t})}function W6(){return typeof window>`u`?`http://127.0.0.1:3000`:window.location.origin}function G6(e){let t=(0,VW.c)(56),{reason:n,pending:r}=e,i=r!==void 0&&r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=W6(),t[0]=a):a=t[0];let o=`porcelain pair "This browser" --address ${a}`,s=`This browser cannot open your worktrees yet`,c=`On your computer, run this`;n&&(s=`That link did not let this browser in`,c=`On your computer, run it again`),i&&(s=`Checking the link with your computer`,c=`Ran porcelain pair on your computer`);let l=i?`bg-brand-soft text-brand`:`bg-foreground text-background`,u;t[1]===l?u=t[2]:(u=jG(`inline-flex items-center gap-1 rounded-full px-2 py-1 text-xs font-medium`,l),t[1]=l,t[2]=u);let d;t[3]===i?d=t[4]:(d=i&&(0,Q.jsx)(U6,{className:`size-3`}),t[3]=i,t[4]=d);let f=i?`Pairing`:`Not paired`,p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,Q.jsxs)(`span`,{className:u,children:[d,f]}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==p?(m=(0,Q.jsxs)(`p`,{role:`status`,className:`flex w-fit max-w-full flex-wrap items-center gap-2 rounded-full border bg-background p-1 pr-3 text-ui text-muted-foreground`,children:[p,s]}),t[9]=s,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,Q.jsxs)(`div`,{className:`text-4xl font-semibold leading-none tracking-tighter md:text-6xl`,children:[(0,Q.jsx)(`h2`,{"aria-label":`This browser is not paired`,className:`text-title-dim`,children:`This browser is not paired.`}),(0,Q.jsx)(`p`,{children:`Pair it from your computer.`})]}),(0,Q.jsx)(`p`,{className:`max-w-xl text-lg leading-relaxed text-muted-foreground`,children:`Porcelain runs on the computer where your agents work, and this browser reads from it. That computer prints a link to let it in.`})]}),t[12]=h):h=t[12];let g=!i,_;t[13]===c?_=t[14]:(_=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:c}),t[13]=c,t[14]=_);let v;t[15]!==i||t[16]!==n?(v=!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`my-3 flex min-w-0 items-center gap-3 rounded-full border bg-muted py-1 pl-4 pr-1 text-ui`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`$`}),(0,Q.jsx)(H6,{text:o,render:(0,Q.jsx)(`code`,{}),className:`flex-1`}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{variant:`ghost`,size:`icon-sm`,"aria-label":`Copy the command`,onClick:()=>jq(o,`the command`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{children:`Copy the command`})]})]}),(0,Q.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[n?`Same command, a new link. `:``,`It prints a link that works once, for 15 minutes.`]})]}),t[15]=i,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==i||t[19]!==g||t[20]!==_||t[21]!==v?(y=(0,Q.jsxs)(K6,{number:1,current:g,done:i,children:[_,v]}),t[18]=i,t[19]=g,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b=!!n,x=i?`Checking the link`:`Open the link it prints, here`,S;t[23]===x?S=t[24]:(S=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:x}),t[23]=x,t[24]=S);let C=n?`alert`:void 0,w=n?`text-destructive`:`text-muted-foreground`,T;t[25]===w?T=t[26]:(T=jG(`mt-1 text-ui leading-relaxed [overflow-wrap:anywhere]`,w),t[25]=w,t[26]=T);let E;t[27]!==i||t[28]!==n?(E=n??(i?`Checking that the link belongs to this Porcelain installation.`:(0,Q.jsxs)(Q.Fragment,{children:[`Its Porcelain page continues here, at`,` `,(0,Q.jsxs)(`code`,{children:[W6(),`/pair`]}),`. On a phone, scan the QR code it prints.`]})),t[27]=i,t[28]=n,t[29]=E):E=t[29];let D;t[30]!==C||t[31]!==T||t[32]!==E?(D=(0,Q.jsx)(`p`,{role:C,className:T,children:E}),t[30]=C,t[31]=T,t[32]=E,t[33]=D):D=t[33];let O;t[34]!==i||t[35]!==b||t[36]!==S||t[37]!==D?(O=(0,Q.jsxs)(K6,{number:2,current:i,failed:b,children:[S,D]}),t[34]=i,t[35]=b,t[36]=S,t[37]=D,t[38]=O):O=t[38];let k;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`h3`,{className:`font-semibold`,children:`Read what your agents changed`}),t[39]=k):k=t[39];let A;t[40]===i?A=t[41]:(A=!i&&(0,Q.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`This browser stays paired until you revoke it.`}),t[40]=i,t[41]=A);let j;t[42]===A?j=t[43]:(j=(0,Q.jsxs)(K6,{number:3,children:[k,A]}),t[42]=A,t[43]=j);let M;t[44]!==y||t[45]!==O||t[46]!==j?(M=(0,Q.jsxs)(`ol`,{"aria-label":`How pairing works`,className:`flex max-w-3xl flex-col`,children:[y,O,j]}),t[44]=y,t[45]=O,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i?N=t[49]:(N=!1,t[48]=i,t[49]=N);let P;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`code`,{children:`porcelain devices`}),t[50]=P):P=t[50];let F;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(`p`,{className:`mt-auto border-t pt-4 text-ui text-muted-foreground`,children:[`Revoke this browser at any time with `,P,` and`,` `,(0,Q.jsx)(`code`,{children:`porcelain revoke`}),`.`]}),t[51]=F):F=t[51];let I;return t[52]!==M||t[53]!==N||t[54]!==m?(I=(0,Q.jsxs)(`section`,{className:`flex w-full min-w-0 flex-1 flex-col gap-8`,children:[m,h,M,N,F]}),t[52]=M,t[53]=N,t[54]=m,t[55]=I):I=t[55],I}function K6(e){let t=(0,VW.c)(19),{number:n,current:r,done:i,failed:a,children:o}=e,s=r!==void 0&&r,c=i!==void 0&&i,l=a!==void 0&&a,u=``,d=n;if(l){u=`, failed`;let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(ZK,{className:`size-3`}),t[0]=e):e=t[0],d=e}if(c){u=`, done`;let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(rK,{className:`size-3`}),t[1]=e):e=t[1],d=e}s&&(u=`, current`);let f;t[2]===n?f=t[3]:(f=n!==3&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1 left-3 top-8 border-l`}),t[2]=n,t[3]=f);let p=s?`step`:void 0,m=`Step ${n}${u}`,h=s&&`border-brand text-brand ring-4 ring-brand-soft`,g=c&&`border-brand bg-brand text-brand-foreground`,_=l&&`border-destructive text-destructive`,v;t[4]!==h||t[5]!==g||t[6]!==_?(v=jG(`relative flex size-6 shrink-0 items-center justify-center rounded-full border bg-background text-xs tabular-nums text-muted-foreground`,h,g,_),t[4]=h,t[5]=g,t[6]=_,t[7]=v):v=t[7];let y;t[8]!==d||t[9]!==v||t[10]!==p||t[11]!==m?(y=(0,Q.jsx)(`span`,{"aria-current":p,"aria-label":m,className:v,children:d}),t[8]=d,t[9]=v,t[10]=p,t[11]=m,t[12]=y):y=t[12];let b;t[13]===o?b=t[14]:(b=(0,Q.jsx)(`div`,{className:`min-w-0`,children:o}),t[13]=o,t[14]=b);let x;return t[15]!==y||t[16]!==b||t[17]!==f?(x=(0,Q.jsxs)(`li`,{className:`relative grid grid-cols-[auto_minmax(0,1fr)] gap-4 pb-8 last:pb-0`,children:[f,y,b]}),t[15]=y,t[16]=b,t[17]=f,t[18]=x):x=t[18],x}function bde(e){let t=(0,VW.c)(3),{reason:n}=e,r=!n,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(B6,{children:(0,Q.jsx)(G6,{reason:n,pending:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function q6({className:e,...t}){return(0,Q.jsx)(`label`,{"data-slot":`label`,className:jG(`flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var J6=Z.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return mB(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function xde({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(J6,{"data-slot":`separator`,orientation:t,className:jG(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function Y6({className:e,...t}){return(0,Q.jsx)(`fieldset`,{"data-slot":`field-set`,className:jG(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function X6({className:e,variant:t=`legend`,...n}){return(0,Q.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:jG(`mb-2 font-medium data-[variant=label]:text-xs/relaxed data-[variant=legend]:text-sm`,e),...n})}var Sde=LG(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function Z6({className:e,orientation:t=`vertical`,...n}){return(0,Q.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:jG(Sde({orientation:t}),e),...n})}function Cde({className:e,...t}){return(0,Q.jsx)(q6,{"data-slot":`field-label`,className:jG(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-2 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/30 *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function Q6({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`field-description`,className:jG(`text-left text-xs/relaxed leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function wde({className:e,children:t,errors:n,...r}){let i=(0,Z.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,Q.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,Q.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,Q.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:jG(`text-xs/relaxed font-normal text-destructive`,e),...r,children:i}):null}function $6(e){return mB(e.defaultTagName??`div`,e,e)}function e8({className:e,...t}){return(0,Q.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:jG(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}var Tde=LG(`group/item flex w-full flex-wrap items-center rounded-md border text-xs/relaxed transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2.5 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function t8({className:e,variant:t=`default`,size:n=`default`,render:r,...i}){return $6({defaultTagName:`div`,props:eB({className:jG(Tde({variant:t,size:n,className:e}))},i),render:r,state:{slot:`item`,variant:t,size:n}})}var Ede=LG(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-8 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function n8({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:jG(Ede({variant:t,className:e})),...n})}function r8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-content`,className:jG(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0.5 [&+[data-slot=item-content]]:flex-none`,e),...t})}function i8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-title`,className:jG(`line-clamp-1 flex w-fit items-center gap-2 text-xs/relaxed leading-snug font-medium underline-offset-4`,e),...t})}function a8({className:e,...t}){return(0,Q.jsx)(`p`,{"data-slot":`item-description`,className:jG(`line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function o8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-actions`,className:jG(`flex items-center gap-2`,e),...t})}function s8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`item-footer`,className:jG(`flex basis-full items-center justify-between gap-2`,e),...t})}var Dde=LG(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2 py-1.5 text-left text-xs/relaxed has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function c8({className:e,variant:t,...n}){return(0,Q.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:jG(Dde({variant:t}),e),...n})}function l8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-title`,className:jG(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function u8({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-description`,className:jG(`text-xs/relaxed text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}var Ode=LG(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,warn:`border-warn-border bg-warn-soft text-warn [a]:hover:bg-warn-soft/80`,brand:`bg-brand text-brand-foreground [a]:hover:bg-brand/80`,"brand-soft":`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,open:`bg-add-bg text-add-fg [a]:hover:bg-add-bg/80`,draft:`bg-muted text-muted-foreground [a]:hover:bg-muted/80`,merged:`bg-brand-soft text-brand [a]:hover:bg-brand-soft/80`,closed:`bg-del-bg text-del-fg [a]:hover:bg-del-bg/80`}},defaultVariants:{variant:`default`}});function d8({className:e,variant:t=`default`,render:n,...r}){return $6({defaultTagName:`span`,props:eB({className:jG(Ode({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function f8(e){let t=(0,VW.c)(17),{section:n,title:r,lead:i,status:a,action:o,children:s}=e,c;t[0]===a?c=t[1]:(c=a&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex h-5.5 min-w-0 items-center gap-2 text-ui leading-4.5`,children:a}),t[0]=a,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,Q.jsxs)(`span`,{className:`text-title-dim`,children:[n,`.`]}),t[2]=n,t[3]=l);let u;t[4]!==l||t[5]!==r?(u=(0,Q.jsxs)(`h1`,{className:`min-w-0 text-4xl font-semibold tracking-title wrap-anywhere`,children:[l,` `,r]}),t[4]=l,t[5]=r,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==u?(d=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[u,o]}),t[7]=o,t[8]=u,t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=(0,Q.jsx)(`p`,{className:`mt-3 max-w-160 text-base tracking-lead text-foreground-2`,children:i}),t[10]=i,t[11]=f);let p;return t[12]!==s||t[13]!==c||t[14]!==d||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[c,d,f,s]}),t[12]=s,t[13]=c,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function p8(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=S4(e),t[0]=e,t[1]=n),tI(n)}function m8(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=C4(e),t[0]=e,t[1]=n),tI(n)}function kde(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=w4(e),t[0]=e,t[1]=n),tI(n)}var Ade=X(e=>j6.fn((t,n)=>H(function*(){yield*n.setResult(pce(e),void 0),yield*(yield*L2).clear()})));function jde(e){let t=(0,VW.c)(8),n;t[0]===e?n=t[1]:(n=Ade(e),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promiseExit`},t[2]=r):r=t[2];let[i,a]=cI(n,r),o;t[3]===a?o=t[4]:(o=()=>{a()},t[3]=a,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s={result:i,submit:o},t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function Mde(e){let t=(0,VW.c)(17),{computer:n}=e,{connection:r}=R6(),{result:i,submit:a}=jde(r),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:`text-sm leading-5 font-medium`,children:`Disconnect this browser`}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,(0,Q.jsxs)(`p`,{className:`mt-0.5 text-ui leading-4.5 text-muted-foreground`,children:[`Ends its session on `,n,`. Pair it again with a new link.`]})]}),t[1]=n,t[2]=s);let c;t[3]===i.waiting?c=t[4]:(c=i.waiting?(0,Q.jsx)(U6,{}):(0,Q.jsx)(YK,{}),t[3]=i.waiting,t[4]=c);let l;t[5]!==i.waiting||t[6]!==a||t[7]!==c?(l=(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`shrink-0 self-start sm:self-auto`,"aria-label":`Disconnect this browser`,disabled:i.waiting,onClick:a,children:[c,`Disconnect`]}),t[5]=i.waiting,t[6]=a,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,Q.jsxs)(`div`,{className:`settings-danger flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=Nw(i)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.cause))})}),t[12]=i,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}var h8=Nk(Q3.layer),g8=h8.atom(H(function*(){let e=yield*Q3;return{isDesktopShell:e.isDesktopShell,hasAppUpdateFeed:e.hasAppUpdateFeed}})),_8=h8.atom(H(function*(){return yield*(yield*Q3).checkUpdate})).pipe(Jk),v8=h8.atom(ND(H(function*(){return(yield*Q3).updateStates}))).pipe(pk(0));function y8(){let e=(0,VW.c)(2),t=tI(v8),n;return e[0]===t?n=e[1]:(n=Zn(Bw(t),Nde),e[0]=t,e[1]=n),n}function Nde(){return{status:`idle`}}function Pde(){return tI(g8)}var Fde=`data-valid`,Ide=`data-invalid`,Lde={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rde={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},b8={valid(e){return e===null?null:e?{[Fde]:``}:{[Ide]:``}}},zde={invalid:void 0,name:void 0,validityData:{state:Lde,errors:[],error:``,value:``,initialValue:null},setValidityData:hI,disabled:void 0,setTouched:hI,setDirty:hI,setFilled:hI,setFocused:hI,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Rde,registerFieldControl:hI,validation:{getValidationProps:(e,t=_I)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:hI,getInputControl:()=>null,commit:async()=>{},change:hI}},Bde=Z.createContext(zde);function x8(e=!0){let t=Z.useContext(Bde);if(t.setValidityData===hI&&!e)throw Error(wI(28));return t}var Vde=Z.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:hI,validationMode:`onSubmit`,submitCountRef:{current:0}});function S8(){return Z.useContext(Vde)}var Hde=Z.createContext({controlId:void 0,registerControlId:hI,resetControlId:hI,labelId:void 0,setLabelId:hI,messageIds:[],setMessageIds:hI,getDescriptionProps:e=>e});function C8(){return Z.useContext(Hde)}function w8(e,t,n,r=!0,i){let[a,o]=Z.useState(),s=sq(i?`${i}-label`:void 0),c=e??t??a;return xI(()=>{let i=e||t||!r?void 0:Ude(n.current,s);a!==i&&o(i)}),c}function Ude(e,t){let n=Wde(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Wde(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function T8(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=C8(),o=sq(),s=bI(()=>Symbol()),c=Z.useRef(!1),l=Z.useRef(!1),u=UI(()=>{c.current&&i!==hI&&(c.current=!1,i(s.current,void 0))});return xI(()=>{if(!n||i===hI){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}e===void 0?u():(c.current=!0,i(s.current,e))},[t,n,i,a,o,s,u]),xI(()=>u,[u]),(n?r:void 0)??t??o}function E8({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Z.useRef(e!==void 0),[a,o]=Z.useState(t);return[i&&e!==void 0?e:a,Z.useCallback(e=>{i||o(e)},[])]}function D8(e,t,n,r,i=!0,a){let{registerFieldControl:o}=x8(),s=bI(()=>Symbol());xI(()=>{let c=s.current;i?o(c,{controlRef:e,getValue:r,id:t,name:a,value:n}):o(c,void 0)},[e,i,r,t,a,o,s,n]),xI(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}function O8(e,t){let n=Z.useRef(e),r=UI(t);xI(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}var Gde=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=x8(),{clearErrors:C,elementRef:w,submitCountRef:T}=S8(),E=h||s,D=m??a,O={...p,disabled:E},{labelId:k}=C8(),A=T8({id:i}),[j]=E8({controlled:o,default:l,name:`FieldControl`,state:`value`}),M=o!==void 0,N=M?j:void 0,P=N==null?void 0:String(N),F=UI(()=>S.inputRef.current?.value);D8(S.inputRef,A,P,F,!E,a),xI(()=>{let e=P??S.inputRef.current?.value;e!==void 0&&b(e!==``)},[P,S.inputRef,b]),O8(P,()=>{P!==void 0&&(C(D),_(P!==(v.initialValue??``)),S.change(P))});let I=Z.useRef(null),L=DL();return xI(()=>{u&&I.current===HL(yL(I.current))&&y(!0)},[u,y]),mB(`input`,e,{ref:[t,I],state:O,props:[{id:A,disabled:E,name:D,ref:S.inputRef,"aria-labelledby":k,autoFocus:u,...M?{value:N}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=dV(JB,e.nativeEvent);c?.(t,n),M||(_(t!==(v.initialValue??``)),b(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(C(D),S.change(t)))},onFocus(){y(!0)},onBlur(e){if(g(!0),y(!1),x===`onBlur`){let t=e.currentTarget.value;S.commit(t),M&&queueMicrotask(()=>{let e=S.inputRef.current?.value;e!==void 0&&e!==t&&e!==(v.initialValue??``)&&S.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){g(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===w.current&&!e.defaultPrevented){let t=e.currentTarget,n=T.current;L.start(0,()=>{T.current===n&&S.commit(t.value)})}else S.commit(t)}}},f,e=>S.getValidationProps(E,e)],stateAttributesMapping:b8})}),Kde=Z.forwardRef(function(e,t){return(0,Q.jsx)(Gde,{ref:t,...e})});function k8({className:e,type:t,...n}){return(0,Q.jsx)(Kde,{type:t,"data-slot":`input`,className:jG(`h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function A8(e){e.catch(()=>void 0)}function j8(e,t){e.preventDefault(),A8(t())}function qde(e){let t=(0,VW.c)(3),n;t[0]===e?n=t[1]:(n=ece(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],cI(n,r)}function Jde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=tce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function Yde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=nce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function Xde(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=rce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function Zde(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=ice(e),t[0]=e,t[1]=n),cI(n)}function Qde(e){let t=(0,VW.c)(3),n;t[0]===e?n=t[1]:(n=sce(e),t[0]=e,t[1]=n);let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={mode:`promise`},t[2]=r):r=t[2],cI(n,r)}function $de(e){let t=(0,VW.c)(2),n;return t[0]===e?n=t[1]:(n=cce(e),t[0]=e,t[1]=n),cI(n)}function efe(e,t){let n=(0,VW.c)(3),r;return n[0]!==e||n[1]!==t?(r=oce({connection:e,id:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],cI(r)}function tfe(e){let t=(0,VW.c)(31),{connection:n,environment:r,onCancel:i}=e,[a,o]=(0,Z.useState)(null),[s]=(0,Z.useState)(nfe),[c,l]=Qde(n),u=a??(r.custom?r.name:``),d;t[0]===u?d=t[1]:(d=u.trim(),t[0]=u,t[1]=d);let f=d,p=r.custom?f===r.name:f===``,m;t[2]!==f||t[3]!==l?(m=e=>j8(e,async()=>l(f===``?null:f)),t[2]=f,t[3]=l,t[4]=m):m=t[4];let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(q6,{htmlFor:`environment-name`,children:`Name of this computer`}),t[5]=h):h=t[5];let g;t[6]===i?g=t[7]:(g=e=>{e.key===`Escape`&&i()},t[6]=i,t[7]=g);let _=r.custom?`Host name`:r.name,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[8]=v):v=t[8];let y;t[9]!==g||t[10]!==_||t[11]!==u?(y=(0,Q.jsx)(k8,{ref:s,id:`environment-name`,className:`min-w-0 flex-1`,onKeyDown:g,placeholder:_,maxLength:Mle,value:u,onChange:v}),t[9]=g,t[10]=_,t[11]=u,t[12]=y):y=t[12];let b=p||c.waiting,x=c.waiting?`Saving…`:`Save`,S;t[13]!==b||t[14]!==x?(S=(0,Q.jsx)(zG,{type:`submit`,variant:`outline`,disabled:b,children:x}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===i?C=t[17]:(C=(0,Q.jsx)(zG,{type:`button`,variant:`ghost`,onClick:i,children:`Cancel`}),t[16]=i,t[17]=C);let w;t[18]!==S||t[19]!==C||t[20]!==y?(w=(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[y,S,C]}),t[18]=S,t[19]=C,t[20]=y,t[21]=w):w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(Q6,{children:`Paired devices show it so you know where they are connected. Leave it empty to use the host name.`}),t[22]=T):T=t[22];let E;t[23]===w?E=t[24]:(E=(0,Q.jsxs)(Z6,{children:[h,w,T]}),t[23]=w,t[24]=E);let D;t[25]===c?D=t[26]:(D=Nw(c)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(c.cause))})}),t[25]=c,t[26]=D);let O;return t[27]!==E||t[28]!==D||t[29]!==m?(O=(0,Q.jsxs)(`form`,{className:`flex max-w-160 flex-col gap-2`,onSubmit:m,children:[E,D]}),t[27]=E,t[28]=D,t[29]=m,t[30]=O):O=t[30],O}function nfe(){return rfe}function rfe(e){return e?.focus()}var M8=Z.createContext(void 0);function N8(e){let t=Z.useContext(M8);if(t===void 0&&!e)throw Error(wI(33));return t}var P8=Z.createContext(void 0);function F8(e){let t=Z.useContext(P8);if(t===void 0&&!e)throw Error(wI(36));return t}var I8=Z.createContext(void 0);function L8(e=!0){let t=Z.useContext(I8);if(t===void 0&&!e)throw Error(wI(25));return t}var R8=Z.createContext(void 0);function ife(){let e=Z.useContext(R8);if(e===void 0)throw Error(wI(30));return e}function afe(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=L8(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:$B})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!LL&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&WB(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var z8={type:`regular-item`};function B8(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Z.useRef(null),{getButtonProps:d,buttonRef:f}=GB({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=afe({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Z.useCallback(e=>eB(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Hz(u,f);return Z.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var V8=Z.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function ofe(){return Z.useContext(V8)}function H8(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=ofe(),u=Z.useRef(-1),[d,f]=Z.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Z.useRef(null),h=Z.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return xI(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var sfe=`data-checked`,cfe=`data-unchecked`,U8={checked(e){return e?{[sfe]:``}:{[cfe]:``}},...tR},lfe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=H8({guess:!0,label:a}),h=N8(!0),g=sq(i),{store:_}=F8(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=E8({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=B8({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:z8}),E=Z.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function D(e){let t=dV($B,e.nativeEvent,void 0,{preventUnmountOnClose:hI});d?.(!S,t),t.isCanceled||C(e=>!e)}let O=mB(`div`,e,{state:E,stateAttributesMapping:U8,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:D},p,w],ref:[T,t,m.ref]});return(0,Q.jsx)(R8.Provider,{value:E,children:O})}),ufe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=ife(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=xU(s.checked);return EB({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),mB(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:U8,props:{"aria-hidden":!0,...o},enabled:a||u})}),W8=Z.createContext(void 0);function dfe(){let e=Z.useContext(W8);if(e===void 0)throw Error(wI(31));return e}var G8=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(void 0),c=mB(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,Q.jsx)(W8.Provider,{value:s,children:c})}),ffe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=sq(a),c=dfe();return xI(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),mB(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),K8=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=H8({guess:!0,label:a}),f=N8(!0),p=sq(i),{store:m}=F8(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=B8({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:z8});return mB(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),pfe=Z.createContext(void 0);function q8(e){let t=Z.useContext(pfe);if(t===void 0&&!e)throw Error(wI(69));return t}var J8=`ArrowUp`,Y8=`ArrowDown`,X8=`ArrowLeft`,Z8=`ArrowRight`,Q8=`Home`,$8=new Set([J8,Y8,X8,Z8,Q8,`End`]),mfe=[`Shift`,`Control`,`Alt`,`Meta`];function hfe(e){return $I(e)&&e.tagName===`INPUT`}function gfe(e){return!!(hfe(e)&&e.selectionStart!=null||$I(e)&&e.tagName===`TEXTAREA`)}function _fe(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=e5(e,t,`left`),a=t5(e),o=t5(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=e5(e,t,`top`),r=t5(e),i=t5(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function e5(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function t5(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var n5=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=F8(),{side:c,align:l}=N8(),u=q8(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;EB({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){s.setOpen(!1,dV(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),tW(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=mB(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:hR,props:[p,{onKeyDown(e){u&&$8.has(e.key)&&e.stopPropagation()}},zW(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,Q.jsx)(sH,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),r5=Z.createContext(void 0);function vfe(){let e=Z.useContext(r5);if(e===void 0)throw Error(wI(32));return e}var i5=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=F8();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,Q.jsx)(r5.Provider,{value:n,children:(0,Q.jsx)(_V,{ref:t,...r,portalOwnerRole:o})})});function a5(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=UI(i),[,o]=Z.useState(!1),s=bI(bfe).current,c=bI(yfe).current,l=Z.useRef(0),u=Z.useRef(!0),d=Z.useRef(null),f=Z.useRef(null),p=UI(()=>{u.current||(u.current=!0,o(e=>!e))}),m=UI((e,t)=>{c.set(e,t),p()}),h=UI(e=>{c.delete(e),p()}),g=UI(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Cfe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&o5(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Sfe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=UI(()=>{let[e,t]=xfe(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});xI(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),xI(()=>{u.current&&v()}),xI(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=UI(e=>(s.add(e),()=>{s.delete(e)})),b=Z.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,Q.jsx)(V8.Provider,{value:b,children:t})}function yfe(){return new Map}function bfe(){return new Set}function xfe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>o5(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Sfe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Cfe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function o5(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var s5=Z.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,Q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),c5={},l5={},u5=``;function d5(e,t){return tL(e)?e:t}function f5(e,t,n){return/hidden|clip/.test(e.getComputedStyle(d5(t,n)).overflowY)}function wfe(e){if(typeof document>`u`)return!1;let t=yL(e);return YI(t).innerWidth-t.documentElement.clientWidth>0}function Tfe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=yL(e),n=t.documentElement,r=t.body,i=d5(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Efe(e){let t=yL(e),n=t.documentElement,r=t.body,i=d5(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function Dfe(e){let t=yL(e),n=t.documentElement,r=t.body,i=YI(n),a=0,o=0,s=!1,c=CL.create();if(zL&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,c5={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},u5=n.style.scrollBehavior,l5={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=d5(n,r);s=Tfe(e),s?(n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`):(Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`)}function u(){Object.assign(n.style,c5),Object.assign(r.style,l5),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=u5)}function d(){u(),c.request(l)}l();let f=bL(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Ofe=new class{lockCount=0;restore=null;timeoutLock=EL.create();timeoutUnlock=EL.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=yL(e),n=t.documentElement,r=t.body,i=YI(n);if(f5(i,n,r)){let t=new i.MutationObserver(()=>{f5(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=PL||!wfe(e);this.restore=a?Efe(e):Dfe(e)}};function p5(e=!0,t=null){xI(()=>{if(e)return Ofe.acquire(t)},[e,t])}var kfe=20;function m5(e,t,n,r){let[i,a]=Z.useState(!1);xI(()=>{if(!e||!t||n==null){a(!1);return}let r=yL(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-kfe)},[e,t,n]),p5(e&&(!t||i),r)}var h5=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=NB,style:g,..._}=e,{store:v}=F8(),y=vfe(),b=L8(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Z.useRef(null),R=TB(A),ee=n,z=c,te=l,ne=s,re=h;x.type===`context-menu`&&(ee=n??x.context?.anchor,ne??=`start`,!o&&ne!==`center`&&(te=e.alignOffset??2,z=e.sideOffset??-5));let ie=o,ae=ne;x.type===`menu`?(ie??=`inline-end`,ae??=`start`,re=e.collisionAvoidance??PB):x.type===`menubar`&&(ie??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ae??=`start`);let oe=x.type===`context-menu`,se=IW({anchor:ee,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:ie,sideOffset:z,align:ae,alignOffset:te,arrowPadding:oe?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:re,shift:oe?{crossAxis:!(`side`in re&&re.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,dV(aV)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,dV(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ce=DL();Z.useEffect(()=>{T||ce.clear()},[T,ce]),Z.useEffect(()=>{function e(e){if(T&&e.nodeId===v.select(`floatingParentNodeId`)){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?ce.isStarted()||ce.start(e,()=>{v.setOpen(!1,dV(aV))}):v.setOpen(!1,dV(aV))}else ce.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,ce]),Z.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),xI(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let le={open:T,side:se.side,align:se.align,anchorHidden:se.anchorHidden,nested:x.type===`menu`,instant:j},ue=x.type===`menubar`&&x.context.modal;m5(T&&(ue||E&&N!==`trigger-hover`),D===`touch`,A,O);let de=BW(e,le,{styles:se.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),fe=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),pe=null;return x.type===`menubar`?pe=x.context.contentElement:x.type===void 0&&(pe=O),(0,Q.jsxs)(M8.Provider,{value:se,children:[fe&&(0,Q.jsx)(s5,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:xB(!T),cutout:pe}),(0,Q.jsx)(ZV,{id:P,children:(0,Q.jsx)(a5,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:de})})]})}),g5=Z.createContext(void 0);function Afe(){let e=Z.useContext(g5);if(e===void 0)throw Error(wI(34));return e}var jfe=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Z.useState(void 0),[p,m]=E8({controlled:i,default:a,name:`MenuRadioGroup`}),h=UI((e,t)=>{o?.(e,t),t.isCanceled||m(e)}),g=mB(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Z.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,Q.jsx)(W8.Provider,{value:f,children:(0,Q.jsx)(g5.Provider,{value:_,children:g})})})),_5=Z.createContext(void 0);function Mfe(){let e=Z.useContext(_5);if(e===void 0)throw Error(wI(35));return e}var Nfe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=H8({guess:!0,label:a}),p=N8(!0),m=sq(i),{store:h}=F8(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Afe(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=B8({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:z8}),E=Z.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=dV($B,e.nativeEvent,void 0,{preventUnmountOnClose:hI});y(l,t)}let O=mB(`div`,e,{state:E,stateAttributesMapping:U8,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,Q.jsx)(_5.Provider,{value:E,children:O})}),Pfe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Mfe(),c=Z.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=xU(s.checked);return EB({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),mB(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:U8,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),Ffe=Z.createContext(null);function v5(e){let t=Z.useContext(Ffe);if(t===null&&!e)throw Error(wI(5));return t}function Ife(e){let t=Z.useRef(``),n=Z.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Z.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function y5(e,t){let{onClick:n,onPointerDown:r}=Ife(UI((n,r)=>{(typeof e==`function`?e():e)||t(r||(PL?`touch`:``))}));return Z.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function b5(e){let[t,n]=Z.useState(null),r=y5(e,n);return O8(e,t=>{t&&!e&&n(null)}),Z.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Lfe={...UU,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},Rfe=class extends KI{constructor(e,t,n=!1){let r=new IU,i=Bfe(r,t,n,e);super(i,zfe(r),Lfe),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef}else e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function zfe(e){return{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Bfe(e,t,n=!1,r){return{...LU(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new GV,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:_I,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Vfe=Z.createContext(void 0);function Hfe(){return Z.useContext(Vfe)}var x5=jI(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=L8(!0),_=F8(!0),v=v5(!0),y=Hfe(),b=Z.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=BB(),S=BB(),C=JV(),w=b.type===`menu`?b.store:void 0,T=(n??a)&&w?.state.transitionStatus===`starting`,E=bI(()=>T?w?.state.instantType:void 0).current,D=Ufe({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b,disabled:o,highlightItemOnHover:h,modal:b.type===void 0?s:void 0,rootId:x,instantType:E},S,C!=null);D.useControlledProp(`openProp`,n),D.useControlledProp(`triggerIdProp`,p),D.useContextCallback(`onOpenChangeComplete`,i);let O=D.useState(`floatingTreeRoot`),k=XV(O),A=D.useState(`open`),j=D.useState(`activeTriggerElement`),M=D.useState(`positionerElement`),N=D.useState(`hoverEnabled`),P=D.useState(`disabled`),F=D.useState(`lastOpenChangeReason`),I=D.useState(`parent`),L=D.useState(`activeIndex`),R=D.useState(`payload`),ee=D.useState(`floatingParentNodeId`),z=Z.useRef(null),te=Z.useRef(I.type!==`context-menu`),ne=DL(),re=Z.useRef(!0),ie=DL(),ae=ee!=null,{openMethod:oe,triggerProps:se}=b5(A);D.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:I.type===void 0?s:void 0,openMethod:oe,rootId:x}),MU(D);let{forceUnmount:ce,transitionStatus:le}=NU(A,D,()=>{D.set(`allowMouseEnter`,!1)},T),ue=TB(D.context.popupRef);Z.useEffect(()=>{if(E===void 0)return;let e=()=>{D.state.instantType===E&&D.set(`instantType`,void 0)};if(!A){e();return}if(le!==void 0)return;if(D.context.popupRef.current==null){e();return}let t=new AbortController;return ue(e,t.signal),()=>{t.abort()}},[E,A,le,ue,D]),xI(()=>{g&&!_?D.update({parent:{type:`context-menu`,context:g},floatingNodeId:k,floatingParentNodeId:C}):_&&D.update({floatingNodeId:k,floatingParentNodeId:C})},[g,_,k,C,D]),Z.useEffect(()=>{A||(z.current=null),I.type===`context-menu`&&(A?ne.start(500,()=>{te.current=!0}):(ne.clear(),te.current=!1))},[ne,A,I.type]),xI(()=>{!A&&!N&&D.set(`hoverEnabled`,!0)},[A,N,D]);let de=UI((e,t)=>{let n=t.reason;if(!e&&!D.select(`open`)||A===e&&t.trigger===j&&F===n)return;let i=kU(t);if(!e&&t.trigger==null&&(t.trigger=j??void 0),r?.(e,t),t.isCanceled)return;D.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!re.current)return;e&&n===`trigger-focus`?(re.current=!1,ie.start(300,()=>{re.current=!0})):(re.current=!0,ie.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);z.current=t.event;let c=OU(D.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=I.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,D.update(c)}),fe=bU({popupStore:D,floatingRootContext:D.state.floatingRootContext,floatingId:S,nested:C!=null,onOpenChange:de}),pe=fe.context.events;xI(()=>{let e=({open:e,eventDetails:t})=>de(e,t);return pe.on(`setOpen`,e),()=>{pe?.off(`setOpen`,e)}},[pe,de]);let me=Z.useCallback(()=>{D.setOpen(!1,dV(lV))},[D]);Z.useImperativeHandle(u,()=>({unmount:ce,close:me}),[ce,me]);let he;I.type===`context-menu`&&(he=I.context),Z.useImperativeHandle(he?.positionerRef,()=>M,[M]),Z.useImperativeHandle(he?.actionsRef,()=>({setOpen:de}),[de]);let ge=mH(fe,{enabled:!P,bubbles:{escapeKey:d&&I.type===`menu`},outsidePress(){return I.type!==`context-menu`||z.current?.type===`contextmenu`||te.current},externalTree:ae?O:void 0}),_e=SW(),ve=Z.useCallback(e=>{D.select(`activeIndex`)!==e&&D.set(`activeIndex`,e)},[D]),ye=dW(fe,{enabled:!P,listRef:D.context.itemDomElements,activeIndex:L,nested:I.type!==void 0,loopFocus:c,orientation:l,parentOrientation:I.type===`menubar`?I.context.orientation:void 0,rtl:_e===`rtl`,disabledIndices:gI,onNavigate:ve,openOnArrowKeyDown:I.type!==`context-menu`,externalTree:ae?O:void 0,focusItemOnHover:h}),be=Z.useCallback(e=>{D.context.typingRef.current=e},[D]),xe=fW(fe,{enabled:!P,listRef:D.context.itemLabels,elementsRef:D.context.itemDomElements,activeIndex:L,resetMs:500,onMatch:e=>{A&&e!==L&&D.set(`activeIndex`,e)},onTyping:be}),Se=Z.useMemo(()=>{let e=eB(xe.reference,ye.reference,ge.reference,{onMouseMove(){D.set(`allowMouseEnter`,!0)}},se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=A,e},[D,xe.reference,ye.reference,ge.reference,se,A]),Ce=Z.useMemo(()=>{let e=eB(ye.trigger,ge.trigger,se);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ye.trigger,ge.trigger,se]);bI(()=>(D.update({inactiveTriggerProps:Ce}),null)),PU(D,{floatingRootContext:fe,activeTriggerProps:Se,inactiveTriggerProps:Ce,popupProps:Z.useMemo(()=>eB(SU,{id:S,role:`menu`,"aria-orientation":l===`horizontal`?`horizontal`:void 0,"aria-labelledby":j?.id,onMouseMove(){D.set(`allowMouseEnter`,!0),I.type===`menu`&&D.set(`hoverEnabled`,!1)},onClick(){D.select(`hoverEnabled`)&&D.set(`hoverEnabled`,!1)},onKeyDown(e){let t=D.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},xe.floating,ye.floating,ge.floating),[j,S,l,I.type,D,xe.floating,ye.floating,ge.floating]),itemProps:ye.item??_I});let we=Z.useMemo(()=>({store:D,parent:b}),[D,b]),Te=(0,Q.jsxs)(P8.Provider,{value:we,children:[f&&(0,Q.jsx)(TU,{handle:f,store:D}),typeof t==`function`?t({payload:R}):t]});return I.type===void 0||I.type===`context-menu`?(0,Q.jsx)(QV,{externalTree:O,children:Te}):Te});function Ufe(e,t,n){return bI(()=>new Rfe(e,t,n)).current}var S5=5;function C5(e,t){let n=Wfe(t);return e.clientX>=n.left-S5&&e.clientX<=n.right+S5&&e.clientY>=n.top-S5&&e.clientY<=n.bottom+S5}function Wfe(e){let t=e.getBoundingClientRect(),n=YI(e);if(VL)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function w5(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=HB(),{ref:i,index:a}=H8(e),o=n===a,s=Z.useRef(null),c=Hz(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Gfe(e){let{render:t,className:n,style:r,state:i=_I,props:a=gI,refs:o=gI,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=w5({metadata:s});return mB(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function T5(e){if($I(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!dL(e))return T5(mL(e))}function E5(e,t){let n=Z.useRef(null);function r(t){SI.flushSync(()=>{e.setOpen(!1,dV(tV,t.nativeEvent,t.currentTarget))}),Pz(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&Fz(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{SI.flushSync(()=>{e.setOpen(!1,dV(tV,n.nativeEvent,n.currentTarget))});let i=Nz(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&UL(r,i);){let e=i;if(i=Az(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Kfe(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,yL(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:_I,[t,n,r])}var qfe=MI(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=F8(!0),h=WU(d)??m?.store;if(!h)throw Error(wI(85));let g=sq(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),S=Yfe(),C=HB(!0),w=YV(),T=Z.useMemo(()=>w??new GV,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=jU(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:XV(T),floatingParentNodeId:JV(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=GB({disabled:A,native:o});Z.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Z.useRef(null),P=DL(),F=UI(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;UL(N.current,t)||UL(h.select(`positionerElement`),t)||t===N.current||t!=null&&T5(t)===h.select(`rootId`)||C5(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:iV})});Z.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&yL(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=rW(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:bW({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Jfe(y,h.select(`lastOpenChangeReason`)),ee=cH(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),z=YU(v,{enabled:!A&&I}),te=Kfe({open:y,enabled:O,mouseDownAction:`open`}),ne=Z.useMemo(()=>eB(z.reference,ee.reference),[z.reference,ee.reference]),re=h.useState(`triggerProps`,D),{preFocusGuardRef:ie,handlePreFocusGuardFocus:ae,handleFocusTargetFocus:oe}=E5(h,x),se={disabled:A,open:y},ce=[N,t,M,E,x],le=[ne,L??_I,re,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),yL(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},te,p,j],ue=mB(`button`,e,{enabled:!O,stateAttributesMapping:pR,state:se,ref:ce,props:le});return O?(0,Q.jsx)(Gfe,{tag:`button`,render:n,className:r,style:i,state:se,refs:ce,props:le,stateAttributesMapping:pR}):y?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Vz,{ref:ie,onFocus:ae},`${g}-pre-focus-guard`),(0,Q.jsx)(Z.Fragment,{children:ue},g),(0,Q.jsx)(Vz,{ref:h.context.triggerFocusTargetRef,onFocus:oe},`${g}-post-focus-guard`)]}):(0,Q.jsx)(Z.Fragment,{children:ue},g)});function Jfe(e,t){let n=DL(),[r,i]=Z.useState(!1);return xI(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Yfe(){let e=v5(!0);return Z.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function D5(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function O5({...e}){return(0,Q.jsx)(x5,{"data-slot":`dropdown-menu`,...e})}function k5({...e}){return(0,Q.jsx)(qfe,{"data-slot":`dropdown-menu-trigger`,...e})}function A5({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,Q.jsx)(i5,{children:(0,Q.jsx)(h5,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,Q.jsx)(n5,{"data-slot":`dropdown-menu-content`,className:jG(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,i),...a})})})}function j5({...e}){return(0,Q.jsx)(G8,{"data-slot":`dropdown-menu-group`,...e})}function M5({className:e,inset:t,...n}){return(0,Q.jsx)(ffe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:jG(`px-2 py-1.5 text-xs text-muted-foreground data-inset:pl-7.5`,e),...n})}function Xfe({className:e,inset:t,variant:n=`default`,...r}){return(0,Q.jsx)(K8,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:jG(`group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Zfe({className:e,children:t,checked:n,inset:r,...i}){return(0,Q.jsxs)(lfe,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:jG(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),checked:n,...i,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,Q.jsx)(ufe,{children:(0,Q.jsx)(rK,{})})}),t]})}function Qfe({...e}){return(0,Q.jsx)(jfe,{"data-slot":`dropdown-menu-radio-group`,...e})}function $fe({className:e,children:t,inset:n,...r}){return(0,Q.jsxs)(Nfe,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:jG(`relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,Q.jsx)(Pfe,{children:(0,Q.jsx)(rK,{})})}),t]})}function epe({className:e,...t}){return(0,Q.jsx)(J6,{"data-slot":`dropdown-menu-separator`,className:jG(`-mx-1 my-1 h-px bg-border/50`,e),...t})}var tpe={desktop:NK,laptop:TK,server:VK,cloud:hK};function N5(e){let t=(0,VW.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({icon:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=tpe[n],a;return t[3]!==i||t[4]!==r?(a=(0,Q.jsx)(i,{...r}),t[3]=i,t[4]=r,t[5]=a):a=t[5],a}function npe(e){let t=(0,VW.c)(18),{icon:n,pending:r,onChange:i}=e,a=`Icon: ${C3[n]}`,o;t[0]!==r||t[1]!==a?(o=(0,Q.jsx)(zG,{variant:`ghost`,size:`sm`,disabled:r,"aria-label":a}),t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Q.jsx)(N5,{icon:n}),t[3]=n,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,Q.jsxs)(k5,{render:o,children:[s,`Icon`]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(M5,{children:`Icon of this computer`}),t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=e=>i(e),t[9]=i,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=tle.map(rpe),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==u?(f=(0,Q.jsx)(A5,{align:`end`,className:`w-44`,children:(0,Q.jsxs)(j5,{children:[l,(0,Q.jsx)(Qfe,{value:n,onValueChange:u,children:d})]})}),t[12]=n,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==c||t[16]!==f?(p=(0,Q.jsxs)(O5,{children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17],p}function rpe(e){return(0,Q.jsxs)($fe,{value:e,className:`cursor-pointer`,children:[(0,Q.jsx)(N5,{icon:e}),C3[e]]},e)}function P5(e){switch(e.status){case`checking`:return`Checking for a new version…`;case`downloading`:return`Downloading ${e.version}…`;case`ready`:return`${e.version} is ready; the app restarts to finish.`;case`installing`:return`Installing ${e.version}; the app restarts in a moment.`;default:return}}function ipe(e){return e.status===`unavailable`?`This build updates by reinstalling; there is no update feed yet.`:`Up to date`}var ape=Nk(Q3.layer).atom(Op(Q3,e=>t=>e.installUpdate.pipe(Fp(e=>new J4({message:e.message}))))),ope=Ck(e=>{e.addFinalizer(M6.state.subscribe(()=>e.refreshSelf())),e.addFinalizer(P6.subscribe(()=>e.refreshSelf()));let t=[],n=[],r=!1,i=M6.state.value.connection,a=er(Bw(e(g8)));if(i&&a){if(a.isDesktopShell){let i=e(_8),a=er(sr(Bw(i))),o=er(Bw(e(v8)));r||=i.waiting;let s=L5(o,i);s&&n.push({id:`mac-app`,name:`Mac app`,message:s});let c=er(Bw(e(ape)));a&&c&&t.push({current:a.current,checking:i.waiting,error:L5(o,i),note:o?ipe(o):void 0,target:{kind:`mac-app`,id:`mac-app`,name:`Mac app`,available:jw(i)&&o?.status===`available`&&!i.waiting,latest:o&&`version`in o?o.version:void 0,update:c}})}else{let a=e(w4(i));r||=a.waiting,Nw(a)&&n.push({id:i.environmentId,name:`This computer`,message:I4(wu(a.cause))});let o=v4(a),s=er(Bw(e($4(i))));o&&t.push({current:o.version,target:{kind:`service`,id:i.environmentId,name:s?.environment.name??`This computer`,connection:i,state:o,deviceId:O6.value}})}}for(let{remote:i,connection:a}of P6.value){a.activeRoute&&e.addFinalizer(a.activeRoute.subscribe(()=>e.refreshSelf()));let o=e(r4(D6,i,a));if(o.kind!==`online`)continue;let s=e(w4(a));r||=s.waiting,Nw(s)&&n.push({id:i.environmentId,name:o.name,message:I4(wu(s.cause))});let c=v4(s);c&&t.push({current:c.version,target:{kind:`service`,id:i.environmentId,name:o.name,connection:a,state:c,deviceId:a.activeRoute?.value?.deviceId??i.deviceId}})}return{rows:t,failures:n,checking:r}}),F5=Rk((e,t)=>{let n=M6.state.value.connection,r=er(Bw(t(g8)));e===`retry`&&r?.isDesktopShell&&!t(_8).waiting&&t.refresh(_8);let i=new Set([...n&&!r?.isDesktopShell?[n]:[],...P6.value.map(({connection:e})=>e)]);for(let e of i){let n=w4(e);t(n).waiting||t.refresh(n)}}),spe=Ck(e=>{jw(e(g8))&&e.set(F5,`entry`)}).pipe(pk(0));function cpe(){aI(spe)}function I5(){let e=(0,VW.c)(11),{rows:t,failures:n,checking:r}=tI(ope),i=oI(F5),a=tI(q4),[o,s]=cI(Sce),c;if(e[0]!==a||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o||e[5]!==t||e[6]!==s){let l=t.map(lpe),u,d;e[8]===i?(u=e[9],d=e[10]):(u=()=>i(`entry`),d=()=>i(`retry`),e[8]=i,e[9]=u,e[10]=d),c={rows:t,failures:n,checking:r,refresh:u,retry:d,batch:a,result:o,run:s,targets:l,count:yce(l)},e[0]=a,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=t,e[6]=s,e[7]=c}else c=e[7];return c}function lpe(e){return e.target}function L5(e,t){if(e?.status===`error`)return e.message;if(!t.waiting&&Nw(t))return I4(wu(t.cause))}function upe(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=E8({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=xU(a,!0,!0),u=sq(),[d,f]=Z.useState(),p=d===null?void 0:d??u,m=UI(e=>{let t=!a,n=dV(YB,e.nativeEvent);r(t,n),n.isCanceled||o(t)});return Z.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:m,mounted:s,open:a,panelId:p,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,m,s,a,p,c,o,f,l])}var R5=Z.createContext(void 0);function z5(){let e=Z.useContext(R5);if(e===void 0)throw Error(wI(15));return e}var dpe=`data-open`,fpe=`data-closed`,ppe=ZL,mpe=`data-panel-open`,hpe={[dpe]:``},gpe={[fpe]:``},_pe={open(e){return e?{[mpe]:``}:null}},B5={open(e){return e?hpe:gpe},...tR},vpe=Z.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=UI(o),d=upe({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=Z.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=Z.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=mB(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:B5});return(0,Q.jsx)(R5.Provider,{value:p,children:m})}),ype={..._pe,...tR},bpe=Z.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=z5(),{className:s,disabled:c=o,render:l,nativeButton:u=!0,style:d,...f}=e,{getButtonProps:p,buttonRef:m}=GB({disabled:c,focusableWhenDisabled:!0,native:u});return mB(`button`,e,{state:a,ref:[t,m],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},f,p],stateAttributesMapping:ype})}),V5={height:void 0,width:void 0};function xpe(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:o,open:s,setMounted:c,setOpen:l,transitionStatus:u}=e,d=Z.useRef(null),f=Z.useRef(null),[p,m]=Z.useState(V5),h=Z.useRef(V5),g=Z.useRef(!1),_=Z.useRef(s),v=Z.useRef(!1),[y,b]=Z.useState(!1),x=Z.useRef(null),S=Hz(t,d),C=yV(s),w=TB(d),T=!s&&!a,E=y?`idle`:u,D=s&&(_.current||v.current),O=!s&&a&&f.current===`css-animation`&&p.height===void 0&&p.width===void 0?h.current:p,k=n&&T&&f.current!==`css-animation`,A=UI((e,t=!0)=>{t&&(h.current=e),m(e)}),j=UI(()=>{x.current?.(),x.current=null}),M=UI(e=>{j(),x.current=()=>{x.current=null,e()}}),N=UI(()=>{s&&a&&f.current===`css-animation`&&(v.current=!0)});xI(()=>{y&&u!==`starting`&&b(!1)},[y,u]),Z.useEffect(()=>()=>{N(),j()},[N,j]),xI(()=>{let e=d.current;if(!e)return;!s&&x.current&&j();let t=Spe(e,D);if(f.current=t,s&&u===`idle`&&_.current&&t===`css-animation`){h.current=H5(e);return}if(s&&u===`starting`){let n=g.current;if(g.current=!1,t===`none`){A(H5(e)),b(!0);return}if(t===`css-transition`){let t=Cpe(e);if(A(H5(e)),!n)return t;let r=W5(e,`transition-duration`,`0s`);return M(r),b(!0),t}A(H5(e));let r=W5(e,`animation-name`,`none`);if(!n){r();return}let i=W5(e,`animation-duration`,`0s`);r(),M(i),b(!0);return}if(!s&&a&&(u===`idle`||u===`starting`)){if(_.current=!1,v.current=!1,t===`none`){A(V5,!1),c(!1);return}A(H5(e));return}if(u!==`ending`)return;if(t===`none`){c(!1);return}let n=H5(e);n.height>0||n.width>0?(A(n),t===`css-animation`&&W5(e,`animation-name`,`none`)()):c(!1)},[a,s,j,A,c,M,D,u]),EB({enabled:s&&a&&E===`idle`,open:!0,ref:d,onComplete(){s&&A(V5,!1)}}),Z.useEffect(()=>{if(s||!a||E!==`ending`||!d.current)return;let e=new AbortController,t=-1;function n(){C.current||(c(!1),A(V5,!1))}return t=CL.request(()=>{w(n,e.signal)}),()=>{CL.cancel(t),e.abort()}},[C,a,s,E,w,A,c]),xI(()=>{let e=d.current;e&&n&&T&&e.setAttribute(`hidden`,`until-found`)},[T,n]),Z.useEffect(function(){let e=d.current;if(!e)return;function t(e){let t=dV(JB,e);o(!0,t),t.isCanceled||(g.current=!0,l(!0))}return bL(e,`beforematch`,t)},[o,l]);let P=i||n||a||s;return{height:O.height,props:{...k?{[ppe]:``}:void 0,hidden:T,id:r},ref:S,shouldPreventOpenAnimation:D,shouldRender:P,transitionStatus:E,width:O.width}}function H5(e){return{height:e.scrollHeight,width:e.scrollWidth}}function Spe(e,t){let n=YI(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&U5(n.animationDuration),i=U5(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function U5(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function W5(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function Cpe(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=CL.request(n);return()=>{CL.cancel(r),n()}}var wpe=`--collapsible-panel-height`,Tpe=`--collapsible-panel-width`,Epe=Z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{defaultPanelId:l,mounted:u,onOpenChange:d,open:f,setMounted:p,setPanelIdState:m,setOpen:h,state:g,transitionStatus:_}=z5(),v=r??!1,y=i??!1,b=o||void 0,x=b??l;xI(()=>(m(e=>b??(e===null?void 0:e)),()=>{m(e=>e===b?null:e)}),[b,m]);let{height:S,props:C,ref:w,shouldPreventOpenAnimation:T,shouldRender:E,transitionStatus:D,width:O}=xpe({externalRef:t,hiddenUntilFound:v,id:x,keepMounted:y,mounted:u,onOpenChange:d,open:f,setMounted:p,setOpen:h,transitionStatus:_}),k={...g,transitionStatus:D},A=Qz(s,k),j=mB(`div`,{...e,style:void 0},{state:k,ref:w,props:[C,{style:{[wpe]:S===void 0?`auto`:`${S}px`,[Tpe]:O===void 0?`auto`:`${O}px`}},c,A?{style:A}:void 0,T?{style:{animationName:`none`}}:void 0],stateAttributesMapping:B5});return E?j:null});function G5({...e}){return(0,Q.jsx)(vpe,{"data-slot":`collapsible`,...e})}function K5({...e}){return(0,Q.jsx)(bpe,{"data-slot":`collapsible-trigger`,...e})}function q5({...e}){return(0,Q.jsx)(Epe,{"data-slot":`collapsible-content`,...e})}function J5(e){let t=(0,VW.c)(86),{row:n,showName:r,prominent:i}=e,a=r!==void 0&&r,o=i!==void 0&&i,{target:s,current:c}=n,{batch:l,run:u}=I5(),d=y8(),f=I6(),p;if(t[0]!==l.entries||t[1]!==s.id||t[2]!==s.kind){let e;t[4]!==s.id||t[5]!==s.kind?(e=e=>e.id===s.id&&e.kind===s.kind,t[4]=s.id,t[5]=s.kind,t[6]=e):e=t[6],p=l.entries.find(e),t[0]=l.entries,t[1]=s.id,t[2]=s.kind,t[3]=p}else p=t[3];let m=p,h=K4(s),g;t[7]===s?g=t[8]:(g=s.kind===`service`?vce(s):void 0,t[7]=s,t[8]=g);let _=g,v;t[9]!==d||t[10]!==s.kind||t[11]!==s.state?(v=s.kind===`service`?Ile(s.state,!1):P5(d),t[9]=d,t[10]=s.kind,t[11]=s.state,t[12]=v):v=t[12];let y=v;n.checking&&(y=`Checking for a new version…`);let b;t[13]!==s.kind||t[14]!==s.state?(b=s.kind===`service`?Lle(s.state):void 0,t[13]=s.kind,t[14]=s.state,t[15]=b):b=t[15];let x=b,S=s.kind===`service`?s.state.latest:s.latest,C=l.running&&(m?.status===`updating`||m?.status===`queued`),w;if(C||y){let e;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[16]=e):e=t[16];let n=y??(m?.status===`queued`?`Queued`:`Updating…`),r;t[17]===n?r=t[18]:(r=(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-xs leading-4`,children:[e,n]}),t[17]=n,t[18]=r),w=r}else if(h){let e=s.kind===`mac-app`?`Restart to update`:`Update ${s.name}`,n;t[19]!==u||t[20]!==s?(n=()=>u([s]),t[19]=u,t[20]=s,t[21]=n):n=t[21];let r=s.kind===`mac-app`?`Restart to update`:`Update`,i;t[22]!==l.running||t[23]!==e||t[24]!==n||t[25]!==r?(i=(0,Q.jsx)(zG,{size:`sm`,"aria-label":e,disabled:l.running,onClick:n,children:r}),t[22]=l.running,t[23]=e,t[24]=n,t[25]=r,t[26]=i):i=t[26],w=i}else if(_&&s.kind===`service`&&s.state.available){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:[(0,Q.jsx)(jK,{}),`Needs trust`]}),t[27]=e):e=t[27],w=e}else{let e=n.note??(S?`Up to date`:`Latest version unavailable`);s.kind===`service`&&!s.state.managed&&(e=`Managed on that computer`);let r;t[28]!==e||t[29]!==n.error?(r=!n.error&&(0,Q.jsx)(`span`,{className:`text-xs leading-4 text-muted-foreground`,children:e}),t[28]=e,t[29]=n.error,t[30]=r):r=t[30],w=r}let T=`${s.name} update`,E=o?`gap-x-6 gap-y-3`:`gap-3`,D;t[31]===E?D=t[32]:(D=jG(`flex flex-wrap items-center justify-between`,E),t[31]=E,t[32]=D);let O;t[33]!==a||t[34]!==s.name?(O=a&&(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:s.name}),t[33]=a,t[34]=s.name,t[35]=O):O=t[35];let k=o?`text-sm leading-5 font-medium`:`text-xs leading-4 text-muted-foreground`,A;t[36]===k?A=t[37]:(A=jG(`tabular-nums`,k),t[36]=k,t[37]=A);let j=c??`Development build`,M;t[38]===j?M=t[39]:(M=(0,Q.jsx)(`span`,{children:j}),t[38]=j,t[39]=M);let N;t[40]!==S||t[41]!==s?(N=G4(s)&&S&&(0,Q.jsxs)(Q.Fragment,{children:[` → `,S]}),t[40]=S,t[41]=s,t[42]=N):N=t[42];let P;t[43]!==A||t[44]!==M||t[45]!==N?(P=(0,Q.jsxs)(`p`,{className:A,children:[M,N]}),t[43]=A,t[44]=M,t[45]=N,t[46]=P):P=t[46];let F;t[47]!==O||t[48]!==P?(F=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[O,P]}),t[47]=O,t[48]=P,t[49]=F):F=t[49];let I;t[50]!==w||t[51]!==F||t[52]!==D?(I=(0,Q.jsxs)(`div`,{className:D,children:[F,w]}),t[50]=w,t[51]=F,t[52]=D,t[53]=I):I=t[53];let L;t[54]!==s.kind||t[55]!==s.state||t[56]!==_?(L=_&&s.kind===`service`&&s.state.available&&(0,Q.jsx)(q5,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{children:_.hint}),_.deviceId&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`code`,{className:`break-all`,children:_.deviceId}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy device ID`,onClick:()=>jq(_.deviceId??``,`device ID`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy device ID`})]})]})]})}),t[54]=s.kind,t[55]=s.state,t[56]=_,t[57]=L):L=t[57];let R;t[58]===n.error?R=t[59]:(R=n.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:n.error}),t[58]=n.error,t[59]=R);let ee;t[60]===m?ee=t[61]:(ee=m?.status===`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m.message}),t[60]=m,t[61]=ee);let z;t[62]!==m?.status||t[63]!==x||t[64]!==C?(z=!C&&x?.kind===`failed`&&m?.status!==`failed`&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:x.reason}),t[62]=m?.status,t[63]=x,t[64]=C,t[65]=z):z=t[65];let te;t[66]===m?te=t[67]:(te=m?.status===`updated`&&(0,Q.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[`Updated to `,m.version,`.`]}),t[66]=m,t[67]=te);let ne;t[68]!==m?.status||t[69]!==f?.environmentId||t[70]!==s.id||t[71]!==s.kind?(ne=m?.status===`updated`&&s.kind===`service`&&f?.environmentId===s.id&&(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,className:`self-start`,onClick:Dpe,children:`Reload`}),t[68]=m?.status,t[69]=f?.environmentId,t[70]=s.id,t[71]=s.kind,t[72]=ne):ne=t[72];let re;t[73]!==s.kind||t[74]!==s.state?(re=s.kind===`service`&&!s.state.managed&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This computer runs outside the installed service. Update it with npm, then run porcelain service update.`}),t[73]=s.kind,t[74]=s.state,t[75]=re):re=t[75];let ie;return t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==ee||t[80]!==z||t[81]!==te||t[82]!==ne||t[83]!==re||t[84]!==T?(ie=(0,Q.jsx)(G5,{children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,role:`group`,"aria-label":T,children:[I,L,R,ee,z,te,ne,re]})}),t[76]=I,t[77]=L,t[78]=R,t[79]=ee,t[80]=z,t[81]=te,t[82]=ne,t[83]=re,t[84]=T,t[85]=ie):ie=t[85],ie}function Dpe(){return window.location.reload()}function Y5(e){let t=(0,VW.c)(19),{connection:n,prominent:r}=e,{rows:i}=I5(),a;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n,t[4]=e),a=i.find(e),t[0]=n,t[1]=i,t[2]=a}else a=t[2];let o=a,s=kde(n),c;t[5]===n?c=t[6]:(c=w4(n),t[5]=n,t[6]=c);let l=sI(c);if(o){let e;return t[7]!==r||t[8]!==o?(e=(0,Q.jsx)(J5,{row:o,prominent:r}),t[7]=r,t[8]=o,t[9]=e):e=t[9],e}if(Nw(s)){let e;t[10]===s.cause?e=t[11]:(e=I4(wu(s.cause)),t[10]=s.cause,t[11]=e);let n;t[12]!==l||t[13]!==s.waiting?(n=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:s.waiting,onClick:l,children:`Try again`}),t[12]=l,t[13]=s.waiting,t[14]=n):n=t[14];let r;return t[15]!==e||t[16]!==n?(r=(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsxs)(u8,{children:[e,n]})}),t[15]=e,t[16]=n,t[17]=r):r=t[17],r}let u;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(U6,{}),t[18]=u):u=t[18],u}function Ope(e){let t=(0,VW.c)(3),{prominent:n}=e,r=n!==void 0&&n,i=I6(),a;return t[0]!==i||t[1]!==r?(a=i&&(0,Q.jsx)(Y5,{connection:i,prominent:r}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function kpe(e){let t=(0,VW.c)(2),{connection:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(Y5,{connection:n,prominent:!0}),t[0]=n,t[1]=r),r}function Ape(e){let t=(0,VW.c)(7),{prominent:n}=e,r=n!==void 0&&n,{rows:i,checking:a}=I5(),o;t[0]===i?o=t[1]:(o=i.find(jpe),t[0]=i,t[1]=o);let s=o;if(s){let e;return t[2]!==r||t[3]!==s?(e=(0,Q.jsx)(J5,{row:s,prominent:r}),t[2]=r,t[3]=s,t[4]=e):e=t[4],e}let c;return t[5]===a?c=t[6]:(c=a?(0,Q.jsx)(U6,{}):null,t[5]=a,t[6]=c),c}function jpe(e){let{target:t}=e;return t.kind===`mac-app`}var X5=Z.createContext(void 0);function Mpe(){let e=Z.useContext(X5);if(e===void 0)throw Error(wI(63));return e}var Npe=`data-checked`,Ppe=`data-unchecked`,Z5={...b8,checked(e){return e?{[Npe]:``}:{[Ppe]:``}}},Fpe=Z.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...y}=e,{clearErrors:b}=S8(),{state:x,setTouched:S,setDirty:C,validityData:w,setFilled:T,setFocused:E,validationMode:D,disabled:O,name:k,validation:A}=x8(),{labelId:j}=C8(),M=O||m,N=k??l,P=Z.useRef(null),F=Hz(P,c,A.inputRef),I=Z.useRef(null),L=sq(),R=T8({id:s}),ee=u?void 0:R,[z,te]=E8({controlled:n,default:!!i,name:`Switch`,state:`checked`});D8(I,L,z,void 0,!M,l),xI(()=>{T(z)},[z,T]),O8(z,()=>{b(N),C(z!==w.initialValue),A.change(z)});let{getButtonProps:ne,buttonRef:re}=GB({disabled:M,native:u}),ie=w8(a,j,P,!u,ee),ae={id:u?R:L,role:`switch`,"aria-checked":z,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ie,onFocus(){M||E(!0)},onBlur(){let e=P.current;e&&!M&&(S(!0),E(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){if(f||M)return;e.preventDefault();let t=P.current;t&&WB(t,e)}},oe={...A.getValidationProps(M),checked:z,disabled:M,form:o,id:ee,name:N,required:p,style:N?Bz:zz,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=dV(JB,e.nativeEvent);d?.(t,n),n.isCanceled||te(t)},onClick(e){e.stopPropagation()},onFocus(){I.current?.focus()},..._===void 0?_I:{value:_}},se=Z.useMemo(()=>({...x,checked:z,disabled:M,readOnly:f,required:p}),[x,z,M,f,p]),ce=mB(`span`,e,{state:se,ref:[t,I,re],props:[ae,y,ne,e=>A.getValidationProps(M,e)],stateAttributesMapping:Z5});return(0,Q.jsxs)(X5.Provider,{value:se,children:[ce,!z&&N&&g!==void 0&&(0,Q.jsx)(`input`,{type:`hidden`,form:o,name:N,value:g,disabled:M}),(0,Q.jsx)(`input`,{...oe,suppressHydrationWarning:!0})]})}),Ipe=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return mB(`span`,e,{state:Mpe(),ref:t,stateAttributesMapping:Z5,props:a})});function Q5({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Fpe,{"data-slot":`switch`,"data-size":t,className:jG(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,Q.jsx)(Ipe,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}function Lpe(e){let t=Z.useRef(!0);t.current&&(t.current=!1,e())}var $5=Z.createContext(void 0),e7=Z.createContext(void 0),t7=Z.createContext(void 0);function n7(){let e=Z.useContext($5);if(e===void 0)throw Error(wI(60));return e}function r7(){let e=Z.useContext(e7);if(e===void 0)throw Error(wI(101));return e}function i7(){let e=Z.useContext(t7);if(e===void 0)throw Error(wI(61));return e}function Rpe(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var a7=(e,t)=>Object.is(e,t);function o7(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function zpe(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Rpe(e,t,(e,t)=>o7(e,t,n)):e!==t}function s7(e,t,n){return e?e.some(e=>e!==void 0&&o7(t,e,n)):!1}function c7(e,t,n){return e?e.findIndex(e=>e!==void 0&&o7(e,t,n)):-1}function Bpe(e,t){if(t!==a7)return n=>s7(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function l7(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(Bpe(t,n)):c7(e,t,n);return i===-1?null:i}function Vpe(e,t,n,r,i,a){return s7(r,t,i)?a!=null&&e>a&&s7(r,n[a],i)?a:e:e===a?l7(n,r,i,!0):a}function Hpe(e,t,n){return e.filter(e=>!o7(t,e,n))}function u7(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Upe(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function d7(e){return Upe(e?.[0])}function Wpe(e){return d7(e)?e.flatMap(e=>e.items):e}function Gpe(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(d7(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function f7(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return u7(e)}function p7(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?u7(e.value):u7(e)}function m7(e,t,n){function r(){return f7(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=Wpe(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Kpe(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Q.jsx)(Z.Fragment,{children:m7(r,t,n)},i)),e),[])}var qpe={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:p7(t,r)!==``},hasNullItemLabel:(e,t)=>t?Gpe(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>o7(t,e,n)):o7(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function h7(e,t){return Math.max(0,e-t)}function g7(e,t){if(t<=0)return 0;let n=IB(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Jpe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=a7,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=S8(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=x8(),F=T8({id:t}),I=M||d,L=j??c,[R,ee]=E8({controlled:n,default:y?r??gI:r,name:`Select`,state:`value`}),[z,te]=E8({controlled:a,default:o,name:`Select`,state:`open`}),ne=Z.useRef([]),re=Z.useRef([]),ie=Z.useRef(null),ae=Z.useRef(null),oe=Z.useRef(0),se=Z.useRef(null),ce=Z.useRef([]),le=Z.useRef(!1),ue=Z.useRef(null),de=Z.useRef(null),fe=Z.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),pe=Z.useRef(!1),me=Z.useRef(R),{mounted:he,setMounted:ge,transitionStatus:_e}=xU(z),{openMethod:ve,triggerProps:ye}=b5(z),be=bI(()=>new KI({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:z,mounted:he,transitionStatus:_e,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:_I,triggerProps:_I,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:hI,setOpen:hI,handleScrollArrowVisibility:hI,onOpenChangeComplete:hI,listRef:ne,popupRef:ie,scrollHandlerRef:ae,scrollArrowsMountedCountRef:oe,valueRef:se,valuesRef:ce,labelsRef:re,typingRef:le,selectionRef:fe,firstItemTextRef:ue,selectedItemTextRef:de,alignItemWithTriggerActiveRef:pe,initialValueRef:me},qpe)).current,xe=be.useState(`activeIndex`),Se=be.useState(`selectedIndex`),Ce=be.useState(`triggerElement`),we=be.useState(`positionerElement`),Te=Cq(ve),Ee=ve??Te,De=Z.useMemo(()=>y?``:p7(R,x),[y,R,x]),Oe=Z.useMemo(()=>y&&Array.isArray(R)?R.map(e=>p7(e,x)):p7(R,x),[y,R,x]);D8(yV(Ce),F,R,UI(()=>Oe),!I,c);let ke=y?Array.isArray(R)&&R.length>0:R!=null&&De!==``;xI(()=>{A(ke)},[ke,A]),xI(function(){let e=l7(ce.current,R,S,y);e===null&&(de.current=null),z||be.set(`selectedIndex`,e)},[y,z,R,S,be]),O8(R,()=>{T(L),E(zpe(R,k.initialValue,S)),N.change(R)});let Ae=UI((e,t)=>{s?.(e,t),t.isCanceled||(te(e),e||t.reason!==`focus-out`&&t.reason!==`outside-press`||(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),je=UI(()=>{ge(!1),be.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});EB({enabled:!h,open:z,ref:ie,onComplete(){z||je()}}),Z.useImperativeHandle(h,()=>({unmount:je}),[je]);let Me=UI((e,t)=>{i?.(e,t),t.isCanceled||ee(e)}),Ne=UI(e=>{let t=h7(e.scrollHeight,e.clientHeight),n=g7(e.scrollTop,t),r=n>0,i=n<t;be.set(`scrollUpArrowVisible`,r),be.set(`scrollDownArrowVisible`,i)}),Pe=GU({open:z,onOpenChange:Ae,elements:{reference:Ce,floating:we}}),Fe=cH(Pe,{enabled:!I,event:`mousedown`}),Ie=mH(Pe),Le=dW(Pe,{enabled:!I,listRef:ne,activeIndex:xe,selectedIndex:Se,disabledIndices:gI,onNavigate(e){(e!==null||z)&&be.set(`activeIndex`,e)},focusItemOnHover:C}),Re=fW(Pe,{enabled:!I&&(z||!f&&!y),listRef:re,activeIndex:xe,selectedIndex:Se,disabledIndices:e=>D5(ne.current[e]),onMatch(e){z?be.set(`activeIndex`,e):Me(ce.current[e],dV(JB))},onTyping(e){le.current=e}}),ze=Z.useMemo(()=>eB(Re.reference,Le.reference,Ie.reference,Fe.reference,ye),[Fe.reference,Re.reference,Le.reference,Ie.reference,ye]),Be=Z.useMemo(()=>eB(SU,Re.floating,Le.floating,Ie.floating),[Re.floating,Le.floating,Ie.floating]),Ve=Le.item??_I;be.useContextCallback(`setValue`,Me),be.useContextCallback(`setOpen`,Ae),be.useContextCallback(`handleScrollArrowVisibility`,Ne),be.useContextCallback(`onOpenChangeComplete`,_),Lpe(()=>{be.update({popupProps:Be,triggerProps:ze})}),be.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:z,mounted:he,transitionStatus:_e,popupProps:Be,triggerProps:ze,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ee});let He=Z.useMemo(()=>({disabled:I,readOnly:f,required:p,multiple:y,highlightItemOnHover:C,itemProps:Ve}),[I,f,p,y,C,Ve]),Ue=Hz(g,N.inputRef),We=y?void 0:L,Ge=Z.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=p7(e,x);return(0,Q.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,Q.jsxs)($5.Provider,{value:be,children:[(0,Q.jsx)(e7.Provider,{value:He,children:(0,Q.jsx)(t7.Provider,{value:Pe,children:w})}),(0,Q.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){be.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=dV(JB,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=ce.current.findIndex(t=>p7(t,x).toLowerCase()===e||f7(t,b).toLowerCase()===e);r===-1&&(r=ce.current.findIndex((t,n)=>{let r=re.current[n];return r!=null&&r.toLowerCase()===e}));let i=ce.current[r];i!=null&&Me(i,n)}be.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&We==null?`${F}-hidden-input`:void 0,form:l,name:We,autoComplete:u,value:De,disabled:I,required:p&&!(y&&ke),readOnly:f,ref:Ue,style:L?Bz:zz,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ge]})}function Ype(e,t){return e??t}var Xpe=`data-popup-side`,Zpe=400,Qpe={...pR,...b8,popupSide:e=>e?{[Xpe]:e}:null,value:()=>null},$pe=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,validation:f,state:p,disabled:m}=x8(),{labelId:h}=C8(),g=n7(),{readOnly:_,required:v,disabled:y}=r7(),b=m||y||a,x=g.useState(`open`),S=g.useState(`mounted`),C=g.useState(`value`),w=g.useState(`triggerProps`),T=g.useState(`positionerElement`),E=g.useState(`listElement`),D=g.useState(`popupSide`),O=g.useState(`id`),k=g.useState(`labelId`),A=g.useState(`hasSelectedValue`),j=S&&T?D:null,M=i??O,N=Ype(h,k);T8({id:i});let P=yV(T),F=Z.useRef(null),{getButtonProps:I,buttonRef:L}=GB({disabled:b,native:o}),R=g.useStateSetter(`triggerElement`),ee=DL(),z=DL(),te=DL();Z.useEffect(()=>{if(x)return te.start(Zpe,()=>{g.context.selectionRef.current.allowUnselectedMouseUp=!0,g.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};g.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},z.clear()},[x,g,z,te]);let ne=eB(w,{id:M,role:`combobox`,"aria-expanded":x,"aria-haspopup":`listbox`,"aria-controls":x?E?.id??wR(T)?.id:void 0,"aria-labelledby":N,"aria-readonly":_||void 0,"aria-required":v||void 0,tabIndex:b?-1:0,onFocus(e){u(!0),x&&g.context.alignItemWithTriggerActiveRef.current&&g.context.setOpen(!1,dV(JB,e.nativeEvent)),ee.start(0,()=>{g.set(`forceMount`,!0)})},onBlur(e){UL(T,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&f.commit(C))},onMouseDown(e){if(x)return;let t=yL(e.currentTarget);function n(e){if(!F.current)return;let t=e.target;UL(F.current,t)||UL(P.current,t)||C5(e,F.current)||g.context.setOpen(!1,dV(iV,e))}z.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,I),re=f.getValidationProps(b,ne);re.role=`combobox`;let ie={...p,open:x,disabled:b,value:C,readOnly:_,popupSide:j,placeholder:!A};return mB(`button`,e,{ref:[t,F,L,R],state:ie,stateAttributesMapping:Qpe,props:re})}),eme={value:()=>null},tme=Z.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,c=n7(),l=c.useState(`value`),u=c.useState(`items`),d=c.useState(`itemToStringLabel`),f=c.useState(`hasSelectedValue`),p=!f&&a!=null&&i==null,m=c.useState(`hasNullItemLabel`,p),h={value:l,placeholder:!f},g=null;return g=typeof i==`function`?i(l):i??(p&&!m?a:Array.isArray(l)?Kpe(l,u,d):m7(l,u,d)),mB(`span`,e,{state:h,ref:[t,c.context.valueRef],props:[{children:g},s],stateAttributesMapping:eme})}),nme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return mB(`span`,e,{state:{open:n7().useState(`open`)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:fR})}),rme=Z.forwardRef(function(e,t){let n=n7(),r=n.useState(`mounted`),i=n.useState(`forceMount`);return r||i?(0,Q.jsx)(_V,{ref:t,...e}):null}),_7=Z.createContext(void 0);function v7(){let e=Z.useContext(_7);if(!e)throw Error(wI(59));return e}function y7(e,t){e&&Object.assign(e.style,t)}var b7={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},ime={position:`fixed`},ame=Z.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=NB,style:_,...v}=e,y=n7(),b=i7(),x=y.useState(`open`),S=y.useState(`mounted`),C=y.useState(`modal`),w=y.useState(`value`),T=y.useState(`openMethod`),E=y.useState(`positionerElement`),D=y.useState(`triggerElement`),O=y.useState(`isItemEqualToValue`),k=y.useState(`transitionStatus`),A=Z.useRef(null),j=Z.useRef(null),[M,N]=Z.useState(h),P=S&&M&&T!==`touch`;!S&&M!==h&&N(h),Z.useImperativeHandle(y.context.alignItemWithTriggerActiveRef,()=>P),m5((P||C)&&x,T===`touch`,E,D);let F=IW({anchor:n,floatingRootContext:b,positionMethod:a,mounted:S,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??P,collisionAvoidance:g,keepMounted:!0}),I=P?`none`:F.side,L=P?ime:F.positionerStyles,R={open:x,side:I,align:F.align,anchorHidden:F.anchorHidden};xI(()=>{y.set(`popupSide`,F.side)},[y,F.side]);let ee=BW(e,R,{styles:L,transitionStatus:k,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!S,inert:!x}),z=Z.useRef(0),te=UI(e=>{if(y.context.valuesRef.current.length===0)return;let t=z.current;z.current=e.size;let n=dV(JB);if(t!==0&&!y.state.multiple&&w!==null&&c7(y.context.valuesRef.current,w,O)===-1){let e=y.context.initialValueRef.current,t=e!=null&&c7(y.context.valuesRef.current,e,O)!==-1?e:null;y.context.setValue(t,n),t===null&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(w)){let e=w.filter(e=>c7(y.context.valuesRef.current,e,O)!==-1);e.length!==w.length&&(y.context.setValue(e,n),e.length===0&&(y.set(`selectedIndex`,null),y.context.selectedItemTextRef.current=null))}if(x&&P){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};y7(E,e),y7(y.context.popupRef.current,e)}}),ne=Z.useMemo(()=>({...F,side:I,alignItemWithTriggerActive:P,setControlledAlignItemWithTrigger:N,scrollUpArrowRef:A,scrollDownArrowRef:j}),[F,I,P,N]);return(0,Q.jsx)(a5,{elementsRef:y.context.listRef,labelsRef:y.context.labelsRef,onMapChange:te,children:(0,Q.jsxs)(_7.Provider,{value:ne,children:[S&&C&&(0,Q.jsx)(s5,{inert:xB(!x),cutout:D}),ee]})})}),x7=`base-ui-disable-scrollbar`,S7={className:x7,getElement(e){return(0,Q.jsx)(`style`,{nonce:e,href:x7,precedence:`base-ui:low`,children:`.${x7}{scrollbar-width:none}.${x7}::-webkit-scrollbar{display:none}`})}},ome=Z.createContext(void 0),sme={disableStyleElements:!1};function C7(){return Z.useContext(ome)??sme}var w7=`--transform-origin`,cme={...mR,...tR},lme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,s=n7(),{multiple:c,readOnly:l,highlightItemOnHover:u}=r7(),d=i7(),{side:f,align:p,alignItemWithTriggerActive:m,isPositioned:h,setControlledAlignItemWithTrigger:g}=v7(),_=q8(!0)!=null,v=SW(),{nonce:y,disableStyleElements:b}=C7(),x=s.useState(`id`),S=s.useState(`open`),C=s.useState(`openMethod`),w=s.useState(`mounted`),T=s.useState(`popupProps`),E=s.useState(`transitionStatus`),D=s.useState(`triggerElement`),O=s.useState(`positionerElement`),k=s.useState(`listElement`),A=Z.useRef(!1),j=Z.useRef(!1),M=Z.useRef({}),N=wL(),P=UI(e=>{if(!O||!s.context.popupRef.current||!j.current)return;let t=O.style.top===`0px`,n=O.style.bottom===`0px`;if(A.current||!m||!t&&!n){s.context.handleScrollArrowVisibility(e);return}let r=D7(O),i=O7(O.getBoundingClientRect().height,`y`,r),a=yL(O),o=YI(O),c=o.getComputedStyle(O),l=parseFloat(c.marginTop),u=parseFloat(c.marginBottom),d=T7(o.getComputedStyle(s.context.popupRef.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,h=E7(e),g=null,_=e=>{O.style.height=`${e}px`},v=t?h-p:p,y=Math.min(i+v,f);if(v<=1){let n=IB(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?h:0,f-(i+n)<=1&&(A.current=!0),s.context.handleScrollArrowVisibility(e);return}f-y>1?g=t?1/0:0:n&&p<h&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=IB(g,0,E7(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(A.current=!0),s.context.handleScrollArrowVisibility(e)});Z.useImperativeHandle(s.context.scrollHandlerRef,()=>P,[P]),EB({open:S,ref:s.context.popupRef,onComplete(){S&&s.context.onOpenChangeComplete(!0)}});let F={open:S,transitionStatus:E,side:f,align:p};xI(()=>{O&&s.context.popupRef.current&&!Object.keys(M.current).length&&(M.current={top:O.style.top||`0`,left:O.style.left||`0`,right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[s,O]),xI(()=>{S||m||(j.current=!1,A.current=!1,y7(O,M.current))},[S,m,O]),xI(()=>{let e=s.context.popupRef.current;if(!S||!D||!O||!e||m&&!h||s.state.transitionStatus===`ending`)return;if(j.current=!0,e.style.removeProperty(w7),!m){N.request(()=>s.context.handleScrollArrowVisibility(k||e));return}let t=ume(e);try{let t=s.context.selectedItemTextRef.current;t?.isConnected||(t=!s.select(`hasSelectedValue`)&&s.context.firstItemTextRef.current?.isConnected?s.context.firstItemTextRef.current:null);let n=s.context.valueRef.current,r=YI(O),i=r.getComputedStyle(O),a=r.getComputedStyle(e),o=yL(D),c=D7(D),l=k7(D.getBoundingClientRect(),c),d=k7(O.getBoundingClientRect(),c),f=l.height,p=k||e,m=p.scrollHeight,h=parseFloat(a.borderBottomWidth),_=parseFloat(i.marginTop)||10,y=parseFloat(i.marginBottom)||10,b=parseFloat(i.minHeight)||100,x=T7(a),S=o.documentElement.clientHeight-_-y,C=o.documentElement.clientWidth,w=S-l.bottom+f,T,E=v===`rtl`?l.right-d.width:l.left,j=0;if(t&&n){let e=k7(n.getBoundingClientRect(),c);T=k7(t.getBoundingClientRect(),c),E=d.left+(v===`rtl`?e.right-T.right:e.left-T.left);let r=e.top-l.top+e.height/2;j=T.top-d.top+T.height/2-r}let N=w+j+y+h,P=Math.min(S,N),F=S-_-y,I=N-P,L=C-5;O.style.left=`${IB(E,5,L-d.width)}px`,O.style.height=`${P}px`,O.style.maxHeight=`none`,O.style.marginTop=`${_}px`,O.style.marginBottom=`${y}px`,e.style.height=`100%`;let R=E7(p),ee=I>=R-1;ee&&(P=Math.min(S,d.height)-(I-R));let z=l.top<20||l.bottom>S-20||Math.ceil(P)+1<Math.min(m,b),te=(r.visualViewport?.scale??1)!==1&&zL;if(z||te){y7(O,M.current),g(!1);return}let ne=Math.max(b,P);if(ee){let e=Math.max(0,S-N);O.style.top=d.height>=F?`0`:`${e}px`,O.style.height=`${P}px`,p.scrollTop=E7(p)}else O.style.bottom=`0`,p.scrollTop=I;if(T){let t=d.top,n=d.height,r=T.top+T.height/2,i=IB(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(w7,`50% ${i}%`)}(ne===S||P>=x)&&(A.current=!0),s.context.handleScrollArrowVisibility(p),u&&s.state.selectedIndex===null&&s.state.activeIndex===null&&s.context.listRef.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,S,O,D,m,g,N,k,u,v,h]),Z.useEffect(()=>{if(!m||!O||!S)return;let e=YI(O);function t(e){s.context.setOpen(!1,dV(uV,e))}return bL(e,`resize`,t)},[s,m,O,S]);let I={...k?{role:`presentation`}:{role:`listbox`,"aria-multiselectable":c||void 0,"aria-readonly":l||void 0,id:`${x}-list`},onKeyDown(e){_&&$8.has(e.key)&&e.stopPropagation()},onScroll(e){k||P(e.currentTarget)},...m&&{style:k?{height:`100%`}:b7},className:!k&&m?S7.className:void 0},L=mB(`div`,e,{ref:[t,s.context.popupRef],state:F,stateAttributesMapping:cme,props:[T,I,zW(E),o]});return(0,Q.jsxs)(Z.Fragment,{children:[!b&&S7.getElement(y),(0,Q.jsx)(sH,{context:d,modal:!1,disabled:!w,openInteractionType:C,returnFocus:a,restoreFocus:!0,children:L})]})});function T7(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function E7(e){return h7(e.scrollHeight,e.clientHeight)}function D7(e){return ZH.getScale(e)}function O7(e,t,n){return e/n[t]}function k7(e,t){return az({x:O7(e.x,`x`,t),y:O7(e.y,`y`,t),width:O7(e.width,`x`,t),height:O7(e.height,`y`,t)})}var A7=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function ume(e){let{style:t}=e,n={};for(let[e,r]of A7)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of A7){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var dme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=n7(),{multiple:s,readOnly:c}=r7(),{alignItemWithTriggerActive:l}=v7(),u=o.useState(`hasScrollArrows`),d=o.useState(`openMethod`),f={id:`${o.useState(`id`)}-list`,role:`listbox`,"aria-multiselectable":s||void 0,"aria-readonly":c||void 0,onScroll(e){o.context.scrollHandlerRef.current?.(e.currentTarget)},...l&&{style:b7},className:u&&d!==`touch`?S7.className:void 0};return mB(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})}),j7=Z.createContext(void 0);function M7(){let e=Z.useContext(j7);if(!e)throw Error(wI(57));return e}var fme=Z.memo(Z.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Z.useRef(null),d=H8({guess:!0,label:o,textRef:u}),f=n7(),{itemProps:p,multiple:m,disabled:h,readOnly:g}=r7(),_=h||s,v=f.useState(`isActive`,d.index),y=f.useState(`open`),b=f.useState(`isSelected`,a),x=f.useState(`isSelectedByFocus`,d.index),S=f.useState(`isItemEqualToValue`),C=d.index,w=Z.useRef(null);xI(()=>{let e=f.context.valuesRef.current;return e[C]=a,()=>{delete e[C]}},[C,a,f]),xI(()=>{let e=f.state.value,t=f.state.selectedIndex,n=t,r;m&&Array.isArray(e)?(n=Vpe(C,a,f.context.valuesRef.current,e,S,t),r=n===C,C===t&&!r&&(f.context.selectedItemTextRef.current=null)):(r=e!==void 0&&o7(a,e,S),r&&(n=C)),f.set(`selectedIndex`,n),r&&u.current&&(f.context.selectedItemTextRef.current=u.current)},[C,m,S,f,a]);let T=Z.useRef(`mouse`),E=Z.useRef(!1),{getButtonProps:D,buttonRef:O}=GB({disabled:_,focusableWhenDisabled:!0,native:c,composite:!0}),k={disabled:_,selected:b,highlighted:v};function A(e){if(h||g)return;let t=f.state.value;if(m){let n=Array.isArray(t)?t:[],r=b?Hpe(n,a,S):[...n,a];f.context.setValue(r,dV($B,e))}else f.context.setValue(a,dV($B,e)),f.context.setOpen(!1,dV($B,e))}function j(){f.context.selectionRef.current.dragY=0}let M={role:`option`,"aria-selected":b,tabIndex:y&&v?0:-1,onKeyDown(e){f.set(`activeIndex`,C),e.key===` `&&f.context.typingRef.current&&e.preventDefault()},onClick(e){let t=T.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&kR(e.nativeEvent)&&(n!==void 0||v),i=t&&!r&&!E.current;E.current=!1,_||i||A(e.nativeEvent)},onPointerEnter(e){T.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=f.context.selectionRef.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){T.current=e.pointerType,E.current=!0,j()},onMouseUp(){if(j(),_||T.current===`touch`||E.current)return;let e=!f.context.selectionRef.current.allowSelectedMouseUp&&b,t=!f.context.selectionRef.current.allowUnselectedMouseUp&&!b;e||t||(E.current=!0,w.current?.click(),E.current=!1)}},N=mB(`div`,e,{ref:[O,t,d.ref,w],state:k,props:[p,M,l,D]}),P=Z.useMemo(()=>({selected:b,index:C,textRef:u,selectedByFocus:x}),[b,C,u,x]);return(0,Q.jsx)(j7.Provider,{value:P,children:N})})),pme=Z.forwardRef(function(e,t){let{selected:n}=M7();return e.keepMounted||n?(0,Q.jsx)(mme,{...e,ref:t}):null}),mme=Z.memo(Z.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=M7(),c=Z.useRef(null),{transitionStatus:l,setMounted:u}=xU(s),d=mB(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:tR});return EB({batch:!0,enabled:!s,open:s,ref:c,onComplete(){s||u(!1)}}),d})),hme=Z.memo(Z.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=M7(),a=n7(),{render:o,className:s,style:c,...l}=e;return mB(`div`,e,{ref:[Z.useCallback(e=>{e&&(n===0&&(a.context.firstItemTextRef.current=e),i&&(a.context.selectedItemTextRef.current=e))},[a,n,i]),t,r],props:l})})),N7=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,l=n7(),{side:u,scrollDownArrowRef:d,scrollUpArrowRef:f}=v7(),p=c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,m=l.useState(p),h=l.useState(`openMethod`),g=m&&h!==`touch`,_=DL(),v=c?f:d,{mounted:y,transitionStatus:b,setMounted:x}=xU(g);xI(()=>(l.context.scrollArrowsMountedCountRef.current+=1,l.set(`hasScrollArrows`,!0),()=>{l.context.scrollArrowsMountedCountRef.current=Math.max(0,l.context.scrollArrowsMountedCountRef.current-1),l.context.scrollArrowsMountedCountRef.current===0&&l.set(`hasScrollArrows`,!1)}),[l]),EB({open:g,ref:v,onComplete(){g||x(!1)}});let S=mB(`div`,e,{ref:[t,v],state:{direction:a,visible:g,side:u,transitionStatus:b},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||_.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??l.context.popupRef.current;if(!e)return;l.set(`activeIndex`,null),l.context.handleScrollArrowVisibility(e);let n=h7(e.scrollHeight,e.clientHeight),r=g7(e.scrollTop,n),i=r===(c?0:n),a=l.context.listRef.current;if(r!==e.scrollTop&&(e.scrollTop=r),i)_.clear();else{if(a.length>0){let t=v.current?.offsetHeight||0;e.scrollTop=gme(a,c,r,e.clientHeight,t,n)}_.start(40,t)}}_.start(40,t)},onMouseLeave(){_.clear()}},s],stateAttributesMapping:tR});return y||o?S:null});function gme(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?g7(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?g7(l.offsetTop+l.offsetHeight-r+i,a):a}var _me=Z.forwardRef(function(e,t){return(0,Q.jsx)(N7,{...e,ref:t,direction:`down`})}),vme=Z.forwardRef(function(e,t){return(0,Q.jsx)(N7,{...e,ref:t,direction:`up`})}),P7=Z.createContext(void 0);function yme(){let e=Z.useContext(P7);if(e===void 0)throw Error(wI(56));return e}var bme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Z.useState(),c=Z.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=mB(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,Q.jsx)(P7.Provider,{value:c,children:l})}),xme=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=yme(),c=sq(a);return xI(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),mB(`div`,e,{ref:t,props:[{id:c,"aria-hidden":!0},o]})}),F7=Jpe;function Sme({className:e,...t}){return(0,Q.jsx)(bme,{"data-slot":`select-group`,className:jG(`scroll-my-1 p-1`,e),...t})}function I7({className:e,...t}){return(0,Q.jsx)(tme,{"data-slot":`select-value`,className:jG(`flex flex-1 text-left`,e),...t})}function L7({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)($pe,{"data-slot":`select-trigger`,"data-size":t,className:jG(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,e),...r,children:[n,(0,Q.jsx)(nme,{render:(0,Q.jsx)(aK,{className:`pointer-events-none size-3.5 text-muted-foreground`})})]})}function R7({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,Q.jsx)(rme,{children:(0,Q.jsx)(ame,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,Q.jsxs)(lme,{"data-slot":`select-content`,"data-align-trigger":o,className:jG(`isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 animate-none! relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!`,e),...s,children:[(0,Q.jsx)(wme,{}),(0,Q.jsx)(dme,{children:t}),(0,Q.jsx)(Tme,{})]})})})}function Cme({className:e,...t}){return(0,Q.jsx)(xme,{"data-slot":`select-label`,className:jG(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}function z7({className:e,children:t,...n}){return(0,Q.jsxs)(fme,{"data-slot":`select-item`,className:jG(`relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,Q.jsx)(hme,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,Q.jsx)(pme,{render:(0,Q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`}),children:(0,Q.jsx)(rK,{className:`pointer-events-none`})})]})}function wme({className:e,...t}){return(0,Q.jsx)(vme,{"data-slot":`select-scroll-up-button`,className:jG(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(sK,{})})}function Tme({className:e,...t}){return(0,Q.jsx)(_me,{"data-slot":`select-scroll-down-button`,className:jG(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5`,e),...t,children:(0,Q.jsx)(aK,{})})}var B7=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(B7||{}),Eme=[0,1],V7=[1,0],H7=[2,3],U7=[3,2],Dme={L:Eme,M:V7,Q:H7,H:U7},Ome=/^\d*$/,kme=/^[A-Z0-9 $%*+./:-]*$/,W7=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,G7=1,K7=40,q7=3,Ame=3,J7=40,jme=10,Y7=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],X7=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Mme=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<G7||e>K7)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,B7.Timing),this.setFunctionModule(e,6,e%2==0,B7.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,Q7(r,e));this.setFunctionModule(8,7,Q7(r,6)),this.setFunctionModule(8,8,Q7(r,7)),this.setFunctionModule(7,8,Q7(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,Q7(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,Q7(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,Q7(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=Q7(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,B7.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,B7.Alignment)}setFunctionModule(e,t,n,r=B7.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==a9(t,n))throw RangeError(`Invalid argument`);let r=X7[n[0]][t],i=Y7[n[0]][t],a=Math.floor(i9(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=Vme(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Hme(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(i9(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=Q7(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=q7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*J7),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*J7}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=q7:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*J7),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*J7}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=Ame)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*jme,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Z7(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function Q7(e,t){return!!(e>>>t&1)}var $7=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},Nme=[1,10,12,14],Pme=[2,9,11,13],Fme=[4,8,16,16];function e9(e,t){return e[Math.floor((t+7)/17)+1]}function t9(e){let t=[];for(let n of e)Z7(n,8,t);return new $7(Fme,e.length,t)}function Ime(e){if(!n9(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Z7(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new $7(Nme,e.length,t)}function Lme(e){if(!r9(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=W7.indexOf(e.charAt(n))*45;r+=W7.indexOf(e.charAt(n+1)),Z7(r,11,t)}return n<e.length&&Z7(W7.indexOf(e.charAt(n)),6,t),new $7(Pme,e.length,t)}function Rme(e){return e===``?[]:n9(e)?[Ime(e)]:r9(e)?[Lme(e)]:[t9(Bme(e))]}function n9(e){return Ome.test(e)}function r9(e){return kme.test(e)}function zme(e,t){let n=0;for(let r of e){let e=e9(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function Bme(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function i9(e){if(e<G7||e>K7)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function a9(e,t){return Math.floor(i9(e)/8)-Y7[t[0]][e]*X7[t[0]][e]}function Vme(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=o9(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=o9(n,2)}return t}function Hme(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=o9(t,e))}return n}function o9(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Ume(e,t,n=1,r=40,i=-1,a=!0){if(!(G7<=n&&n<=r&&r<=K7)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=a9(o,t)*8,i=zme(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[V7,H7,U7])a&&s<=a9(o,e)*8&&(t=e);let c=[];for(let t of e){Z7(t.mode[0],4,c),Z7(t.numChars,e9(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=a9(o,t)*8;Z7(0,Math.min(4,l-c.length),c),Z7(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Z7(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new Mme(o,t,u,i)}function Wme(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?Rme(e):Array.isArray(e)?[t9(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Ume(c,Dme[n],i,a,o,r),u=Gme({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Gme(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=B7.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function Kme(e){let t=(0,VW.c)(9),{link:n}=e,r,i;if(t[0]!==n){let{size:e,data:a}=Wme(n,{ecc:`M`,border:2});r=e,i=a.flatMap(qme).join(``),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a=i,o=r*2,s=`0 0 ${r} ${r}`,c;t[3]===a?c=t[4]:(c=(0,Q.jsx)(`path`,{d:a,fill:`currentColor`}),t[3]=a,t[4]=c);let l;return t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,Q.jsx)(`svg`,{role:`img`,"aria-label":`Pairing QR code`,width:o,height:o,viewBox:s,shapeRendering:`crispEdges`,className:`shrink-0 rounded-sm bg-white text-black`,children:c}),t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function qme(e,t){return e.flatMap((e,n)=>e?[`M${n} ${t}h1v1h-1z`]:[])}function Jme(e){let t=(0,VW.c)(50),{connection:n,remote:r,disabled:i}=e,a=i!==void 0&&i,o=Hse(r),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(!0),[p,m]=(0,Z.useState)(!0),[h,g]=qde(n),_=p8(n),v;t[0]!==_||t[1]!==h?(v=jw(h)&&jw(_)&&_.value?.grants.some(e=>e.id===h.value?.id)===!0?h.value:null,t[0]=_,t[1]=h,t[2]=v):v=t[2];let y=v,b=o.find(e=>{let{url:t}=e;return t===l})??o[0],x=y&&o.find(e=>{let{url:t}=e;return t===y.address})?.route;if(b===void 0){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Turn on a way in above to pair a device.`}),t[3]=e):e=t[3],e}let S=e=>j8(e,async()=>g({label:s.trim(),addresses:[b.url],trusted:d,canManageSharing:p})),C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(q6,{htmlFor:`pairing-label`,children:`Device name`}),t[4]=C):C=t[4];let w;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>c(e.target.value),t[5]=w):w=t[5];let T;t[6]===s?T=t[7]:(T=(0,Q.jsxs)(Z6,{className:`min-w-0 flex-1`,children:[C,(0,Q.jsx)(k8,{id:`pairing-label`,placeholder:`My phone`,maxLength:jle,value:s,onChange:w})]}),t[6]=s,t[7]=T);let E=o.length>1&&(0,Q.jsxs)(Z6,{className:`min-w-0`,children:[(0,Q.jsx)(q6,{htmlFor:`pairing-address`,children:`Opens through`}),(0,Q.jsxs)(F7,{items:o.map(Xme),disabled:a,value:b.url,onValueChange:e=>{e&&u(e)},children:[(0,Q.jsx)(L7,{id:`pairing-address`,"aria-describedby":`pairing-address-url`,className:`w-full`,children:(0,Q.jsx)(I7,{children:p4[b.route]})}),(0,Q.jsx)(R7,{children:o.map(Yme)})]}),(0,Q.jsx)(`p`,{id:`pairing-address-url`,className:`text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:b.url})]}),D;t[8]!==a||t[9]!==h.waiting||t[10]!==s?(D=a||h.waiting||s.trim()===``,t[8]=a,t[9]=h.waiting,t[10]=s,t[11]=D):D=t[11];let O;t[12]===h.waiting?O=t[13]:(O=h.waiting?(0,Q.jsx)(U6,{}):(0,Q.jsx)(DK,{}),t[12]=h.waiting,t[13]=O);let k;t[14]!==D||t[15]!==O?(k=(0,Q.jsxs)(zG,{type:`submit`,size:`sm`,className:`shrink-0`,disabled:D,children:[O,`Create pairing link`]}),t[14]=D,t[15]=O,t[16]=k):k=t[16];let A;t[17]!==T||t[18]!==E||t[19]!==k||t[20]!==S?(A=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:S,children:[T,E,k]}),t[17]=T,t[18]=E,t[19]=k,t[20]=S,t[21]=A):A=t[21];let j;t[22]!==a||t[23]!==p||t[24]!==m?(j=(0,Q.jsx)(Q5,{id:`pairing-management`,checked:p,disabled:a,onCheckedChange:m}),t[22]=a,t[23]=p,t[24]=m,t[25]=j):j=t[25];let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(q6,{htmlFor:`pairing-management`,children:`Can manage sharing`}),t[26]=M):M=t[26];let N;t[27]===j?N=t[28]:(N=(0,Q.jsxs)(Z6,{orientation:`horizontal`,children:[j,M]}),t[27]=j,t[28]=N);let P;t[29]!==a||t[30]!==f||t[31]!==d?(P=(0,Q.jsx)(Q5,{id:`pairing-trusted`,checked:d,disabled:a,onCheckedChange:f}),t[29]=a,t[30]=f,t[31]=d,t[32]=P):P=t[32];let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsxs)(q6,{htmlFor:`pairing-trusted`,children:[(0,Q.jsx)(`span`,{className:`sr-only`,children:`The paired device can update Porcelain`}),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`Can update Porcelain`})]}),t[33]=F):F=t[33];let I;t[34]===P?I=t[35]:(I=(0,Q.jsxs)(Z6,{orientation:`horizontal`,children:[P,F]}),t[34]=P,t[35]=I);let L=p4[b.route],R;t[36]===L?R=t[37]:(R=(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Uses `,L,`. Pair again to add another way in.`]}),t[36]=L,t[37]=R);let ee;t[38]===h?ee=t[39]:(ee=Nw(h)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(h.cause))})}),t[38]=h,t[39]=ee);let z;t[40]!==y||t[41]!==x?(z=y&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg bg-white p-1 inset-ring inset-ring-border`,children:(0,Q.jsx)(Kme,{link:y.link})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 basis-20 flex-col gap-1 pt-0.5`,children:[(0,Q.jsxs)(`p`,{className:`text-ui leading-4.5 font-medium`,children:[`Scan on `,y.label]}),(0,Q.jsxs)(`p`,{className:`text-xs leading-4.25 text-muted-foreground`,children:[`Works once, until`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:new Date(y.expiresAt).toLocaleTimeString()}),x&&(0,Q.jsxs)(Q.Fragment,{children:[`, through `,p4[x]]}),`.`]})]})]}),(0,Q.jsx)(`p`,{"aria-label":`Pairing link`,className:`font-mono text-2xs leading-4 break-all text-muted-foreground`,children:y.link}),(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>jq(y?.link??``,`pairing link`),children:[(0,Q.jsx)(_K,{}),`Copy link`]})]}),t[40]=y,t[41]=x,t[42]=z):z=t[42];let te;return t[43]!==A||t[44]!==N||t[45]!==I||t[46]!==R||t[47]!==ee||t[48]!==z?(te=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[A,N,I,R,ee,z]}),t[43]=A,t[44]=N,t[45]=I,t[46]=R,t[47]=ee,t[48]=z,t[49]=te):te=t[49],te}function Yme(e){let{route:t,url:n}=e;return(0,Q.jsx)(z7,{value:n,children:(0,Q.jsx)(`span`,{className:`mr-4 min-w-0 whitespace-normal [overflow-wrap:anywhere]`,children:`${p4[t]} · ${n}`})},n)}function Xme(e){let{route:t,url:n}=e;return{value:n,label:`${p4[t]} · ${n}`}}var Zme=new Intl.RelativeTimeFormat(`en`,{numeric:`always`});function s9(e,t=hg()){let n=fg(e),r=bg(n,t),[i,a]=r?[t,n]:[n,t],o=yg(i,a),s=Qi(o),c=vg(),l=(s+xg(_g(a,c))-xg(_g(i,c)))/Qi(Zi(1)),u,d;return s<Qi(Yi(1))?(u=`second`,d=Math.round($i(o))):s<Qi(Xi(1))?(u=`minute`,d=Math.round(ea(o))):s<Qi(Zi(1))?(u=`hour`,d=Math.round(ta(o))):l<30?(u=`day`,d=Math.round(l)):l<365?(d=Math.round(l/30),u=d===12?`year`:`month`,u===`year`&&(d=1)):(u=`year`,d=Math.round(l/365)),Zme.format(r?d:-d,u)}var Qme={phone:(0,Q.jsx)(GK,{"aria-hidden":!0}),tablet:(0,Q.jsx)(qK,{"aria-hidden":!0}),browser:(0,Q.jsx)(yK,{"aria-hidden":!0})};function $me(e){let t=(0,VW.c)(22),{connection:n,access:r,disabled:i}=e,a=i!==void 0&&i,o=r,s;if(t[0]!==o.devices||t[1]!==n||t[2]!==a){let e;t[4]!==n||t[5]!==a?(e=e=>(0,Q.jsxs)(t8,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(n8,{variant:`icon`,children:Qme[Rle(e.platform)]}),(0,Q.jsxs)(r8,{className:`basis-48`,children:[(0,Q.jsxs)(i8,{className:`flex-wrap`,children:[e.label,e.current&&(0,Q.jsx)(d8,{variant:`secondary`,children:`This device`}),(0,Q.jsx)(d8,{variant:`outline`,children:m4[e.route]})]}),(0,Q.jsxs)(a8,{children:[`Last seen `,s9(e.lastSeenAt),` ·`,` `,Z3(e.platform)]}),e.routeInferred&&(0,Q.jsxs)(a8,{children:[`Paired before each device was tied to one way in, so it now works only through `,m4[e.route],`, where it was last seen. Pair it again to use another way in.`]})]}),(0,Q.jsxs)(o8,{className:`flex-wrap`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[auto_auto] items-center gap-x-2 gap-y-1.5`,children:[(0,Q.jsx)(nhe,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canManageSharing===!0}),(0,Q.jsx)(ehe,{disabled:a,connection:n,id:e.id,label:e.label,trusted:e.trusted}),!e.canManageSharing&&zse(e)&&(0,Q.jsx)(the,{disabled:a,connection:n,id:e.id,label:e.label,allowed:e.canEditWaysIn})]}),!e.current&&(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!1})]})]},e.id),t[4]=n,t[5]=a,t[6]=e):e=t[6],s=o.devices.map(e),t[0]=o.devices,t[1]=n,t[2]=a,t[3]=s}else s=t[3];let c;if(t[7]!==o.grants||t[8]!==n||t[9]!==a){let e;t[11]!==n||t[12]!==a?(e=e=>(0,Q.jsxs)(t8,{variant:`outline`,size:`sm`,role:`listitem`,"aria-label":e.label,children:[(0,Q.jsx)(n8,{variant:`icon`,children:(0,Q.jsx)(DK,{"aria-hidden":!0})}),(0,Q.jsxs)(r8,{className:`min-w-0`,children:[(0,Q.jsxs)(i8,{children:[e.label,(0,Q.jsx)(d8,{variant:`outline`,children:`Pending link`})]}),(0,Q.jsxs)(a8,{children:[`Works once, until`,` `,new Date(e.expiresAt).toLocaleTimeString()]})]}),(0,Q.jsx)(o8,{children:(0,Q.jsx)(l9,{disabled:a,connection:n,id:e.id,label:e.label,cancelLink:!0})})]},e.id),t[11]=n,t[12]=a,t[13]=e):e=t[13],c=o.grants.map(e),t[7]=o.grants,t[8]=n,t[9]=a,t[10]=c}else c=t[10];let l;t[14]!==s||t[15]!==c?(l=(0,Q.jsxs)(e8,{role:`list`,"aria-label":`Paired devices and links`,children:[s,c]}),t[14]=s,t[15]=c,t[16]=l):l=t[16];let u;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Each device has separate access. Revoking signs it out.`}),t[17]=u):u=t[17];let d;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:`About device permissions`}),t[18]=d):d=t[18];let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(G5,{children:[d,(0,Q.jsx)(q5,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:`Sharing managers can pair devices, revoke access and configure ways in. Update permission is separate. Each credential works only through the way in it paired over. Pair again to add another way in.`})})]}),t[19]=f):f=t[19];let p;return t[20]===l?p=t[21]:(p=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[l,u,f]}),t[20]=l,t[21]=p),p}function ehe(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,trusted:a,disabled:o}=e,[s,c]=Yde(n,r),l=`${i} can update Porcelain`,u;return t[0]!==o||t[1]!==c||t[2]!==s||t[3]!==l||t[4]!==a?(u=(0,Q.jsx)(c9,{caption:`Can update`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=o,t[1]=c,t[2]=s,t[3]=l,t[4]=a,t[5]=u):u=t[5],u}function the(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=Xde(n,r),l=`${i} can edit ways in`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Can edit ways in`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}function c9(e){let t=(0,VW.c)(13),{caption:n,name:r,checked:i,result:a,disabled:o,onChange:s}=e,c;t[0]===n?c=t[1]:(c=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-xs text-muted-foreground`,children:n}),t[0]=n,t[1]=c);let l=o||a.waiting,u;t[2]!==i||t[3]!==r||t[4]!==s||t[5]!==l?(u=(0,Q.jsx)(Q5,{"aria-label":r,checked:i,disabled:l,onCheckedChange:s}),t[2]=i,t[3]=r,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]===a?d=t[8]:(d=Nw(a)&&(0,Q.jsx)(c8,{variant:`destructive`,className:`col-span-2`,children:(0,Q.jsx)(u8,{children:I4(wu(a.cause))})}),t[7]=a,t[8]=d);let f;return t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function l9(e){let t=(0,VW.c)(12),{connection:n,id:r,label:i,cancelLink:a,disabled:o}=e,s=o!==void 0&&o,[c,l]=Jde(n,r),u=a?`Cancel the link for ${i}`:`Revoke ${i}`,d=s||c.waiting,f;t[0]===l?f=t[1]:(f=()=>l(),t[0]=l,t[1]=f);let p=a?`Cancel`:`Revoke`,m;t[2]!==u||t[3]!==d||t[4]!==f||t[5]!==p?(m=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,className:`ml-1`,"aria-label":u,disabled:d,onClick:f,children:p}),t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===c?h=t[8]:(h=Nw(c)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(c.cause))})}),t[7]=c,t[8]=h);let g;return t[9]!==m||t[10]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[m,h]}),t[9]=m,t[10]=h,t[11]=g):g=t[11],g}function nhe(e){let t=(0,VW.c)(6),{connection:n,id:r,label:i,allowed:a,disabled:o}=e,[s,c]=efe(n,r),l=`${i} can manage sharing`,u;return t[0]!==a||t[1]!==o||t[2]!==c||t[3]!==s||t[4]!==l?(u=(0,Q.jsx)(c9,{caption:`Manage sharing`,name:l,checked:a,result:s,disabled:o,onChange:c}),t[0]=a,t[1]=o,t[2]=c,t[3]=s,t[4]=l,t[5]=u):u=t[5],u}var u9={lan:void 0,tailnet:`Encrypted, from anywhere`,cloudflare:`Encrypted, from anywhere`};function rhe(e){let t=(0,VW.c)(13),{name:n,route:r}=e,{status:i}=r,a;t[0]!==n||t[1]!==r?(a=Kse(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a;if(o===null)return null;if(i.kind===`off`||i.kind===`starting`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[3]=e):e=t[3];let n;return t[4]===o?n=t[5]:(n=(0,Q.jsxs)(d8,{variant:`outline`,children:[e,o]}),t[4]=o,t[5]=n),n}if(i.kind===`paused`){let e;return t[6]===o?e=t[7]:(e=(0,Q.jsx)(d8,{variant:`outline`,children:o}),t[6]=o,t[7]=e),e}if(i.kind===`failed`){let e;return t[8]===o?e=t[9]:(e=(0,Q.jsx)(d8,{variant:`destructive`,children:o}),t[8]=o,t[9]=e),e}let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-add-fg`}),t[10]=s):s=t[10];let c;return t[11]===o?c=t[12]:(c=(0,Q.jsxs)(d8,{variant:`secondary`,children:[s,o]}),t[11]=o,t[12]=c),c}function ihe(e){let t=(0,VW.c)(14),{name:n,route:r,note:i}=e,{status:a}=r;if(a.kind===`failed`){let e;t[0]!==n||t[1]!==a.reason?(e=Zse(n,a.reason),t[0]=n,t[1]=a.reason,t[2]=e):e=t[2];let r;return t[3]===e?r=t[4]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[3]=e,t[4]=r),r}if(a.kind!==`on`||a.urls.length===0){let e=Nse[n],r;return t[5]===e?r=t[6]:(r=(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:e}),t[5]=e,t[6]=r),r}let o;if(t[7]!==n||t[8]!==i||t[9]!==a.urls){let e;t[11]!==n||t[12]!==i?(e=e=>(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs leading-4.5 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1`,children:[(0,Q.jsx)(H6,{className:`font-mono text-foreground-2`,text:e}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,className:`size-5`,"aria-label":`Copy ${e}`,onClick:()=>jq(e,`address`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy ${e}`})]})]}),(i??u9[n])&&(0,Q.jsx)(`span`,{children:i??u9[n]})]},e),t[11]=n,t[12]=i,t[13]=e):e=t[13],o=a.urls.map(e),t[7]=n,t[8]=i,t[9]=a.urls,t[10]=o}else o=t[10];return o}function d9(e){let t=(0,VW.c)(40),{name:n,route:r,disabled:i,connectedThrough:a,onChange:o,setup:s,note:c,children:l}=e,u=p4[n],[d,f]=(0,Z.useState)(!1),p=n!==`lan`||r.status.kind!==`on`,m=d||(s?.open??!1),h;t[0]!==n||t[1]!==r?(h=(0,Q.jsx)(rhe,{name:n,route:r}),t[0]=n,t[1]=r,t[2]=h):h=t[2];let g;t[3]===p?g=t[4]:(g=!p&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-xs leading-4 font-medium text-warn`,children:[(0,Q.jsx)(UK,{"aria-hidden":!0,className:`size-3.5`}),`Not encrypted`]}),t[3]=p,t[4]=g);let _;t[5]!==h||t[6]!==g||t[7]!==u?(_=(0,Q.jsxs)(i8,{className:`flex-wrap`,children:[u,h,g]}),t[5]=h,t[6]=g,t[7]=u,t[8]=_):_=t[8];let v;t[9]!==n||t[10]!==c||t[11]!==r?(v=(0,Q.jsx)(ihe,{name:n,route:r,note:c}),t[9]=n,t[10]=c,t[11]=r,t[12]=v):v=t[12];let y;t[13]!==_||t[14]!==v?(y=(0,Q.jsxs)(r8,{children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]!==a||t[17]!==s||t[18]!==u?(b=s&&!a&&(0,Q.jsxs)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:s.configured?`ghost`:`outline`,"aria-label":s.configured?`${u} setup`:`Set up ${u}`,className:`group/setup`}),children:[s.configured?`Setup`:`Set up`,s.configured&&(0,Q.jsx)(aK,{"aria-hidden":!0,className:`size-3.5 text-muted-foreground transition-transform group-data-panel-open/setup:rotate-180`})]}),t[16]=a,t[17]=s,t[18]=u,t[19]=b):b=t[19];let x=i||a,S;t[20]===o?S=t[21]:(S=e=>o(e),t[20]=o,t[21]=S);let C;t[22]!==r.enabled||t[23]!==x||t[24]!==S||t[25]!==u?(C=(0,Q.jsx)(Q5,{"aria-label":u,checked:r.enabled,disabled:x,onCheckedChange:S}),t[22]=r.enabled,t[23]=x,t[24]=S,t[25]=u,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==b?(w=(0,Q.jsxs)(o8,{children:[b,C]}),t[27]=C,t[28]=b,t[29]=w):w=t[29];let T;t[30]!==l||t[31]!==a||t[32]!==n||t[33]!==s?(T=a?(0,Q.jsx)(s8,{children:(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:Pse(n)})}):l&&(s?(0,Q.jsx)(q5,{className:`basis-full`,children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:l})}):(0,Q.jsx)(s8,{children:(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:l})})),t[30]=l,t[31]=a,t[32]=n,t[33]=s,t[34]=T):T=t[34];let E;return t[35]!==m||t[36]!==w||t[37]!==T||t[38]!==y?(E=(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(G5,{open:m,onOpenChange:f,className:`contents`,children:[y,w,T]})}),t[35]=m,t[36]=w,t[37]=T,t[38]=y,t[39]=E):E=t[39],E}function ahe(e){let t=(0,VW.c)(26),{remote:n,disabled:r,onTurnOn:i}=e,{lan:a}=n.routes,o=n.localNetwork,s=a.enabled&&a.status.kind===`paused`,c;t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==s?(c=s&&o&&(0,Q.jsxs)(zG,{variant:`outline`,size:`sm`,className:`self-start`,disabled:r,onClick:i,children:[`Turn on for `,h4(o)]}),t[0]=r,t[1]=o,t[2]=i,t[3]=s,t[4]=c):c=t[4];let l;t[5]!==o||t[6]!==a.status.kind||t[7]!==s||t[8]!==n?(l=a.status.kind!==`on`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4.5 text-muted-foreground`,children:s||!o?g4(n):`Uses ${h4(o)}.`}),t[5]=o,t[6]=a.status.kind,t[7]=s,t[8]=n,t[9]=l):l=t[9];let u,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-6.5 -left-6.5 hidden size-1.5 rounded-full bg-warn lg:block`}),d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-7.25 -left-5 hidden h-px w-5 bg-warn-border lg:block`}),t[10]=u,t[11]=d):(u=t[10],d=t[11]);let f;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(l8,{children:[(0,Q.jsx)(UK,{"aria-hidden":!0}),`Not encrypted`]}),t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{children:`Devices on this network can read the connection.`}),t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`}),children:`Details`}),t[14]=m):m=t[14];let h;t[15]===n?h=t[16]:(h=g4(n),t[15]=n,t[16]=h);let g;t[17]===h?g=t[18]:(g=(0,Q.jsx)(`p`,{children:h}),t[17]=h,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(`p`,{children:Fse}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,Q.jsxs)(`div`,{className:`settings-margin-note lg:absolute lg:top-0 lg:left-full lg:ml-8 lg:w-62`,children:[u,d,(0,Q.jsxs)(c8,{role:`note`,"aria-label":`Local network warning`,children:[f,(0,Q.jsxs)(u8,{children:[p,(0,Q.jsxs)(G5,{children:[m,(0,Q.jsxs)(q5,{children:[g,_]})]})]})]})]}),t[20]=g,t[21]=v);let y;return t[22]!==c||t[23]!==v||t[24]!==l?(y=(0,Q.jsxs)(Q.Fragment,{children:[c,l,v]}),t[22]=c,t[23]=v,t[24]=l,t[25]=y):y=t[25],y}function f9(e){let t=(0,VW.c)(26),{route:n,remote:r,disabled:i,onChange:a}=e,[o,s]=(0,Z.useState)(null),c;t[0]!==o||t[1]!==r||t[2]!==n?(c=Xse(r,n,o),t[0]=o,t[1]=r,t[2]=n,t[3]=c):c=t[3];let l=c,u;t[4]!==l.save||t[5]!==a?(u=e=>j8(e,async()=>{a(l.save),s(null)}),t[4]=l.save,t[5]=a,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>s(e.target.value),t[7]=d):d=t[7];let f;t[8]!==i||t[9]!==l.label||t[10]!==l.placeholder||t[11]!==l.value?(f=(0,Q.jsx)(k8,{"aria-label":l.label,placeholder:l.placeholder,value:l.value,disabled:i,onChange:d}),t[8]=i,t[9]=l.label,t[10]=l.placeholder,t[11]=l.value,t[12]=f):f=t[12];let p=i||!l.canSave,m;t[13]!==l.saveLabel||t[14]!==p?(m=(0,Q.jsx)(zG,{type:`submit`,variant:`outline`,className:`shrink-0`,disabled:p,children:l.saveLabel}),t[13]=l.saveLabel,t[14]=p,t[15]=m):m=t[15];let h;t[16]!==i||t[17]!==l.check||t[18]!==l.failed||t[19]!==a?(h=l.failed&&(0,Q.jsx)(zG,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:i,onClick:()=>a(l.check),children:`Check again`}),t[16]=i,t[17]=l.check,t[18]=l.failed,t[19]=a,t[20]=h):h=t[20];let g;return t[21]!==u||t[22]!==f||t[23]!==m||t[24]!==h?(g=(0,Q.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:u,children:[f,m,h]}),t[21]=u,t[22]=f,t[23]=m,t[24]=h,t[25]=g):g=t[25],g}function ohe(e){let t=(0,VW.c)(18),{remote:n,disabled:r,onChange:i}=e,a=n.routes.tailnet,o;t[0]===n.tailnetTarget?o=t[1]:(o=n.tailnetTarget===void 0?void 0:Wse(n.tailnetTarget),t[0]=n.tailnetTarget,t[1]=o);let s=o,c;t[2]!==r||t[3]!==i||t[4]!==n?(c=(0,Q.jsx)(f9,{route:`tailnet`,remote:n,disabled:r,onChange:i}),t[2]=r,t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;t[6]===n.tailnetHostname?l=t[7]:(l=n.tailnetHostname===void 0&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Save this computer’s name on your tailnet, as tailscale status or the Tailscale admin console shows it, to turn this on. Porcelain then names the one command to run.`}),t[6]=n.tailnetHostname,t[7]=l);let u;t[8]!==n.tailnetHostname||t[9]!==a?(u=n.tailnetHostname!==void 0&&!a.enabled&&(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`If you set up tailscale serve for Porcelain, remove it with tailscale serve --https=443 off, or Tailscale keeps forwarding to a port Porcelain no longer holds.`}),t[8]=n.tailnetHostname,t[9]=a,t[10]=u):u=t[10];let d;t[11]===s?d=t[12]:(d=s!==void 0&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Run this once on this computer. Tailscale keeps it across restarts; remove it with tailscale serve --https=443 off.`}),(0,Q.jsxs)(`div`,{className:`flex max-w-full items-center gap-1`,children:[(0,Q.jsx)(H6,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,render:(0,Q.jsx)(`code`,{}),text:s}),(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-xs`,variant:`ghost`,"aria-label":`Copy the tailscale serve command`,onClick:()=>jq(s,`command`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy the tailscale serve command`})]})]})]}),t[11]=s,t[12]=d);let f;return t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l,u,d]}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function she(e){let t=(0,VW.c)(9),{remote:n,disabled:r,onChange:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(f9,{route:`cloudflare`,remote:n,disabled:r,onChange:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===n.serviceUrl?o=t[5]:(o=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`In Cloudflare, publish this hostname from your tunnel to`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n.serviceUrl}),`, and run cloudflared on this computer as a service. Porcelain answers to the hostname only while this is on.`]}),t[4]=n.serviceUrl,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function che(e){let t=(0,VW.c)(63),{connection:n,remote:r}=e,[i,a]=Zde(n),o=i.waiting,s;t[0]===r.editing.protectedRoute?s=t[1]:(s=e=>r.editing.protectedRoute===e,t[0]=r.editing.protectedRoute,t[1]=s);let c=s,l;t[2]!==r.editing.fingerprint||t[3]!==a?(l=e=>a({expected:r.editing.fingerprint,change:e}),t[2]=r.editing.fingerprint,t[3]=a,t[4]=l):l=t[4];let u=l,d=r.routes.lan,f;t[5]===r?f=t[6]:(f=g4(r),t[5]=r,t[6]=f);let p=c(`lan`),m=o||!r.routes.lan.enabled&&r.localNetwork===void 0,h;t[7]===u?h=t[8]:(h=e=>u({lan:e}),t[7]=u,t[8]=h);let g;t[9]===u?g=t[10]:(g=()=>u({lan:!0}),t[9]=u,t[10]=g);let _;t[11]!==o||t[12]!==r||t[13]!==g?(_=(0,Q.jsx)(ahe,{remote:r,disabled:o,onTurnOn:g}),t[11]=o,t[12]=r,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==r.routes.lan||t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==_?(v=(0,Q.jsx)(d9,{name:`lan`,route:d,note:f,connectedThrough:p,disabled:m,onChange:h,children:_}),t[15]=r.routes.lan,t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=_,t[21]=v):v=t[21];let y=r.routes.tailnet,b=r.tailnetHostname!==void 0,x=r.routes.tailnet.status.kind===`failed`,S;t[22]!==b||t[23]!==x?(S={configured:b,open:x},t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=c(`tailnet`),w=o||r.tailnetHostname===void 0,T;t[25]===u?T=t[26]:(T=e=>u({tailnet:e}),t[25]=u,t[26]=T);let E;t[27]!==o||t[28]!==r||t[29]!==u?(E=(0,Q.jsx)(ohe,{remote:r,disabled:o,onChange:u}),t[27]=o,t[28]=r,t[29]=u,t[30]=E):E=t[30];let D;t[31]!==r.routes.tailnet||t[32]!==S||t[33]!==C||t[34]!==w||t[35]!==T||t[36]!==E?(D=(0,Q.jsx)(d9,{name:`tailnet`,route:y,setup:S,connectedThrough:C,disabled:w,onChange:T,children:E}),t[31]=r.routes.tailnet,t[32]=S,t[33]=C,t[34]=w,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O=r.routes.cloudflare,k=r.cloudflareHostname!==void 0,A=r.routes.cloudflare.status.kind===`failed`,j;t[38]!==k||t[39]!==A?(j={configured:k,open:A},t[38]=k,t[39]=A,t[40]=j):j=t[40];let M=c(`cloudflare`),N=o||r.cloudflareHostname===void 0,P;t[41]===u?P=t[42]:(P=e=>u({cloudflare:e}),t[41]=u,t[42]=P);let F;t[43]!==o||t[44]!==r||t[45]!==u?(F=(0,Q.jsx)(she,{remote:r,disabled:o,onChange:u}),t[43]=o,t[44]=r,t[45]=u,t[46]=F):F=t[46];let I;t[47]!==r.routes.cloudflare||t[48]!==j||t[49]!==M||t[50]!==N||t[51]!==P||t[52]!==F?(I=(0,Q.jsx)(d9,{name:`cloudflare`,route:O,setup:j,connectedThrough:M,disabled:N,onChange:P,children:F}),t[47]=r.routes.cloudflare,t[48]=j,t[49]=M,t[50]=N,t[51]=P,t[52]=F,t[53]=I):I=t[53];let L;t[54]!==v||t[55]!==D||t[56]!==I?(L=(0,Q.jsxs)(e8,{children:[v,D,I]}),t[54]=v,t[55]=D,t[56]=I,t[57]=L):L=t[57];let R;t[58]===i?R=t[59]:(R=Nw(i)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.cause))})}),t[58]=i,t[59]=R);let ee;return t[60]!==L||t[61]!==R?(ee=(0,Q.jsxs)(Q.Fragment,{children:[L,R]}),t[60]=L,t[61]=R,t[62]=ee):ee=t[62],ee}function p9(e){let t=(0,VW.c)(14),{connection:n,children:r}=e,i=m8(n),a,o;if(t[0]!==r||t[1]!==n||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=er(Bw(i));if(e===null){let e;t[5]===n.address?e=t[6]:(e=Bse(n.address),t[5]=n.address,t[6]=e);let r;t[7]===e?r=t[8]:(r=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e}),t[7]=e,t[8]=r),o=r;break bb0}if(Nw(i)){let e;t[9]===i.cause?e=t[10]:(e=I4(wu(i.cause)),t[9]=i.cause,t[10]=e);let n;t[11]===e?n=t[12]:(n=(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:e})}),t[11]=e,t[12]=n),o=n;break bb0}if(!e){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[13]=e):e=t[13],o=e;break bb0}a=r(e)}t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o}else a=t[3],o=t[4];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function m9(e){let t=(0,VW.c)(6),{connection:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(X6,{variant:`label`,children:`Ways in`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=e=>(0,Q.jsx)(che,{connection:n,remote:e}),t[1]=n,t[2]=i);let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsxs)(Y6,{id:`ways-in`,className:`relative`,children:[r,(0,Q.jsx)(p9,{connection:n,children:i})]}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function lhe(e){let t=(0,VW.c)(5),{connection:n,children:r}=e,i=p8(n),a,o;if(t[0]!==i||t[1]!==r){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=er(Bw(i));if(e===null){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This device cannot manage sharing. Allow it from a device with sharing access.`}),t[4]=e):e=t[4],o=e;break bb0}let n=Nw(i)?I4(wu(i.cause)):void 0;if(!e){o=n?(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:n})}):(0,Q.jsx)(U6,{});break bb0}a=r(e,n)}t[0]=i,t[1]=r,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function h9(e){let t=(0,VW.c)(5),{prominent:n}=e,r=n!==void 0&&n,i=er(Bw(Pde()))?.isDesktopShell;if(i===!0){let e;return t[0]===r?e=t[1]:(e=(0,Q.jsx)(Ape,{prominent:r}),t[0]=r,t[1]=e),e}if(i===!1){let e;return t[2]===r?e=t[3]:(e=(0,Q.jsx)(Ope,{prominent:r}),t[2]=r,t[3]=e),e}let a;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(U6,{}),t[4]=a):a=t[4],a}function uhe(e){let t=(0,VW.c)(45),{environment:n}=e,{connection:r}=R6(),i=er(Bw(p8(r)))?.canEditIdentity===!0,a=`${n.custom}:${n.name}`,[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),u;if(t[0]!==r.address){let e=new URL(r.address);u=/^https?:$/.test(e.protocol)?e.origin:void 0,t[0]=r.address,t[1]=u}else u=t[1];let d=u,f=o===a,[p,m]=$de(r),h,g,_,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full bg-add-fg`}),g=(0,Q.jsx)(`span`,{children:`Online`}),_=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),v=(0,Q.jsx)(d8,{variant:`secondary`,children:`This computer`}),t[2]=h,t[3]=g,t[4]=_,t[5]=v):(h=t[2],g=t[3],_=t[4],v=t[5]);let y;t[6]===d?y=t[7]:(y=d&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`text-muted-foreground`,children:`·`}),(0,Q.jsx)(H6,{text:d,className:`font-mono text-xs text-muted-foreground`})]}),t[6]=d,t[7]=y);let b;t[8]===y?b=t[9]:(b=(0,Q.jsxs)(Q.Fragment,{children:[h,g,_,v,y]}),t[8]=y,t[9]=b);let x;t[10]!==i||t[11]!==n||t[12]!==p||t[13]!==a||t[14]!==f||t[15]!==c||t[16]!==m?(x=i&&!f&&(0,Q.jsxs)(`span`,{className:`mt-1 flex items-center gap-1 text-muted-foreground`,children:[(0,Q.jsx)(npe,{icon:T3(n),pending:p.waiting,onChange:e=>m(nle(e))}),(0,Q.jsxs)(zG,{variant:`ghost`,size:`sm`,ref:c?e=>{e&&(e.focus(),l(!1))}:void 0,onClick:()=>{l(!0),s(a)},children:[(0,Q.jsx)(LK,{}),`Rename`]})]}),t[10]=i,t[11]=n,t[12]=p,t[13]=a,t[14]=f,t[15]=c,t[16]=m,t[17]=x):x=t[17];let S;t[18]!==i||t[19]!==p?(S=i&&Nw(p)&&(0,Q.jsx)(c8,{variant:`destructive`,className:`mt-4 max-w-160`,children:(0,Q.jsx)(u8,{children:I4(wu(p.cause))})}),t[18]=i,t[19]=p,t[20]=S):S=t[20];let C;t[21]!==i||t[22]!==r||t[23]!==n||t[24]!==f?(C=i&&f&&(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(tfe,{connection:r,environment:n,onCancel:()=>s(null)})}),t[21]=i,t[22]=r,t[23]=n,t[24]=f,t[25]=C):C=t[25];let w;t[26]!==n.name||t[27]!==C||t[28]!==b||t[29]!==x||t[30]!==S?(w=(0,Q.jsxs)(f8,{section:`Computers`,title:n.name,lead:`Manage connections and device access.`,status:b,action:x,children:[S,C]}),t[26]=n.name,t[27]=C,t[28]=b,t[29]=x,t[30]=S,t[31]=w):w=t[31];let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(e8,{"aria-label":`Version`,children:(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(h9,{prominent:!0})})})}),t[32]=T):T=t[32];let E,D;t[33]===r?(E=t[34],D=t[35]):(E=(0,Q.jsx)(m9,{connection:r}),D=(0,Q.jsx)(g9,{connection:r}),t[33]=r,t[34]=E,t[35]=D);let O;t[36]===n.name?O=t[37]:(O=(0,Q.jsxs)(Y6,{children:[(0,Q.jsx)(X6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{children:`This browser`}),(0,Q.jsx)(d8,{variant:`outline`,children:`Shown in a browser tab`})]})}),(0,Q.jsx)(e8,{children:(0,Q.jsx)(t8,{children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(Mde,{computer:n.name})})})})]}),t[36]=n.name,t[37]=O);let k;t[38]!==E||t[39]!==D||t[40]!==O?(k=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[T,E,D,O]}),t[38]=E,t[39]=D,t[40]=O,t[41]=k):k=t[41];let A;return t[42]!==w||t[43]!==k?(A=(0,Q.jsxs)(Q.Fragment,{children:[w,k]}),t[42]=w,t[43]=k,t[44]=A):A=t[44],A}function g9(e){let t=(0,VW.c)(6),{connection:n}=e,r=er(Bw(p8(n))),i;t[0]!==n||t[1]!==r?(i=(e,t)=>(0,Q.jsx)(p9,{connection:n,children:i=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Y6,{id:`devices`,className:`min-w-0`,disabled:t!==void 0,children:[(0,Q.jsx)(X6,{variant:`label`,children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Devices`,r&&(0,Q.jsx)(`span`,{className:`tabular-nums`,children:r.devices.length})]})}),t&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:t})}),(0,Q.jsx)($me,{connection:n,access:e,disabled:t!==void 0})]}),(0,Q.jsxs)(`aside`,{"aria-label":`Pair a device`,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border bg-card p-3 shadow-pop lg:col-start-2 lg:row-span-2 lg:row-start-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-ui leading-4.5 font-semibold`,children:`Pair a device`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.25 text-muted-foreground`,children:`A link works once, for a few minutes.`})]}),(0,Q.jsx)(Y6,{className:`contents`,disabled:t!==void 0,children:(0,Q.jsx)(Jme,{connection:n,remote:i,disabled:t!==void 0})})]})]})}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]!==n||t[4]!==i?(a=(0,Q.jsx)(lhe,{connection:n,children:i}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}var dhe=X(e=>j6.fn(e=>H(function*(){let t=yield*(yield*W4).pair({value:e,localEnvironmentId:M6.state.value.connection?.environmentId}).pipe(Up(J3));return t4(D6,t),t}))),fhe=X(e=>j6.fn(t=>H(function*(){yield*(yield*W4).forget(e.environmentId)}))),phe=j6.fn(e=>H(function*(){yield*(yield*W4).read()}));function mhe(e){let t=(0,VW.c)(12),[n]=(0,Z.useState)(Symbol),r;t[0]===n?r=t[1]:(r=dhe(n),t[0]=n,t[1]=r);let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={mode:`promiseExit`},t[2]=a):a=t[2];let[o,s]=cI(i,a),c=oI(i),l;t[3]!==e||t[4]!==s?(l=async t=>{Lu(await s(t))&&e()},t[3]=e,t[4]=s,t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=()=>c(Bk),t[6]=c,t[7]=u);let d;return t[8]!==o||t[9]!==l||t[10]!==u?(d={result:o,submit:l,reset:u},t[8]=o,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function hhe(e,t){let n=(0,VW.c)(9),r;n[0]===e?r=n[1]:(r=fhe(e),n[0]=e,n[1]=r);let i;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={mode:`promiseExit`},n[2]=i):i=n[2];let[a,o]=cI(r,i),s;n[3]!==t||n[4]!==o?(s=async()=>{Lu(await o(void 0))&&t()},n[3]=t,n[4]=o,n[5]=s):s=n[5];let c;return n[6]!==a||n[7]!==s?(c={result:a,submit:s},n[6]=a,n[7]=s,n[8]=c):c=n[8],c}function ghe(){let e=(0,VW.c)(5),[t,n]=cI(phe),r;e[0]===n?r=e[1]:(r=()=>n(void 0),e[0]=n,e[1]=r);let i;return e[2]!==t||e[3]!==r?(i={result:t,read:r},e[2]=t,e[3]=r,e[4]=i):i=e[4],i}function _he(e){let t=(0,VW.c)(31),{remote:n,onOpen:r,showUpdates:i}=e,a=z6(n),o=a.kind===`online`?a.name:n.name,{rows:s}=I5(),c;if(t[0]!==n.environmentId||t[1]!==s){let e;t[3]===n.environmentId?e=t[4]:(e=e=>{let{target:t}=e;return t.kind===`service`&&t.id===n.environmentId},t[3]=n.environmentId,t[4]=e),c=s.find(e),t[0]=n.environmentId,t[1]=s,t[2]=c}else c=t[2];let l=c,u=`Open ${o}`,d;t[5]!==r||t[6]!==n.environmentId?(d=()=>r(n.environmentId),t[5]=r,t[6]=n.environmentId,t[7]=d):d=t[7];let f=a.kind,p;t[8]===a?p=t[9]:(p=M2(a),t[8]=a,t[9]=p);let m;t[10]===n.address?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`font-mono`,children:n.address}),t[10]=n.address,t[11]=m);let h;t[12]===n.environmentId?h=t[13]:(h=n.environmentId.slice(0,8),t[12]=n.environmentId,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,Q.jsx)(`span`,{className:`font-mono`,children:h}),t[14]=h,t[15]=g);let _;t[16]!==p||t[17]!==m||t[18]!==g?(_=(0,Q.jsxs)(Q.Fragment,{children:[p,` ·`,` `,m,` ·`,` `,g]}),t[16]=p,t[17]=m,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==a.kind||t[22]!==l?(v=i&&(l?(0,Q.jsx)(J5,{row:l}):a.kind===`offline`&&(0,Q.jsx)(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:`Version unavailable while offline`})),t[20]=i,t[21]=a.kind,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==o||t[25]!==a.kind||t[26]!==v||t[27]!==u||t[28]!==d||t[29]!==_?(y=(0,Q.jsx)(y9,{name:o,label:o,openLabel:u,onOpen:d,status:f,description:_,update:v}),t[24]=o,t[25]=a.kind,t[26]=v,t[27]=u,t[28]=d,t[29]=_,t[30]=y):y=t[30],y}function vhe(){let e=(0,VW.c)(27),[t,n]=(0,Z.useState)(``),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>n(``),e[0]=r):r=e[0];let i=mhe(r),{status:a}=F6(),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(`p`,{className:`text-ui leading-5 text-foreground-2`,children:[`On the other computer, run`,` `,(0,Q.jsx)(`code`,{className:`rounded-sm bg-muted px-1.5 py-px font-mono text-xs leading-4.5 font-medium text-foreground inset-ring inset-ring-border`,children:`porcelain pair`}),` `,`and paste the link it prints. This device keeps its own credential for that computer.`]}),e[1]=o):o=e[1];let s;e[2]!==i||e[3]!==t?(s=e=>j8(e,()=>i.submit(t)),e[2]=i,e[3]=t,e[4]=s):s=e[4];let c=i.result.waiting||a!==`ready`,l;e[5]===i?l=e[6]:(l=e=>{i.reset(),n(e.target.value)},e[5]=i,e[6]=l);let u;e[7]!==t||e[8]!==c||e[9]!==l?(u=(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 font-mono`,children:(0,Q.jsx)(k8,{"aria-label":`Pairing link`,placeholder:`https://porcelain.fabiofiorita.com/open/pair#c=…`,value:t,disabled:c,onChange:l})}),e[7]=t,e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;e[11]!==i.result.waiting||e[12]!==t||e[13]!==a?(d=i.result.waiting||a!==`ready`||t.trim()===``,e[11]=i.result.waiting,e[12]=t,e[13]=a,e[14]=d):d=e[14];let f=i.result.waiting?`Pairing…`:`Add`,p;e[15]!==d||e[16]!==f?(p=(0,Q.jsx)(zG,{type:`submit`,className:`shrink-0`,disabled:d,children:f}),e[15]=d,e[16]=f,e[17]=p):p=e[17];let m;e[18]!==s||e[19]!==u||e[20]!==p?(m=(0,Q.jsxs)(`form`,{className:`mt-2.5 flex flex-col gap-2 sm:flex-row`,onSubmit:s,children:[u,p]}),e[18]=s,e[19]=u,e[20]=p,e[21]=m):m=e[21];let h;e[22]===i.result?h=e[23]:(h=Nw(i.result)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(i.result.cause))})}),e[22]=i.result,e[23]=h);let g;return e[24]!==h||e[25]!==m?(g=(0,Q.jsx)(t8,{children:(0,Q.jsxs)(r8,{children:[o,m,h]})}),e[24]=h,e[25]=m,e[26]=g):g=e[26],g}function yhe(e){let{connection:t}=e,n=er(Bw(m8(t))),r=er(Bw(p8(t)));return n&&r?`Online · ${Ble(n,r.devices.length)}`:`Online · Connected computer`}function bhe(e){let t=(0,VW.c)(60),{environment:n,onOpen:r,showUpdates:i}=e,{connection:a}=R6(),{remotes:o,error:s}=F6(),c=ghe();cpe();let{targets:l,count:u,batch:d,run:f,retry:p,checking:m}=I5(),h=y8(),g;t[0]===h?g=t[1]:(g=P5(h),t[0]=h,t[1]=g);let _=g!==void 0,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(f8,{section:`Settings`,title:`Computers`,lead:`Manage your paired computers.`,children:(0,Q.jsxs)(`p`,{className:`mt-3.5 flex max-w-160 items-start gap-2 text-ui leading-5 text-muted-foreground`,children:[(0,Q.jsx)(yK,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0`}),`Browser tabs each connect to one computer.`]})}),t[2]=v):v=t[2];let y;t[3]!==c||t[4]!==s?(y=s!==void 0&&(0,Q.jsxs)(c8,{variant:`destructive`,children:[(0,Q.jsx)(CK,{}),(0,Q.jsx)(l8,{children:`Saved computers could not be read`}),(0,Q.jsxs)(u8,{children:[`Porcelain keeps them as they are and saves no change over them. Allow Porcelain to read its saved credentials, then try again.`,` `,s,(0,Q.jsx)(zG,{variant:`outline`,disabled:c.result.waiting,onClick:()=>c.read(),children:`Read saved computers`})]})]}),t[3]=c,t[4]=s,t[5]=y):y=t[5];let b=o.length+1,x;t[6]===b?x=t[7]:(x=(0,Q.jsxs)(`h2`,{id:`computers-heading`,className:`flex items-center gap-1 text-xs leading-4 font-medium text-muted-foreground`,children:[`Computers`,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:b})]}),t[6]=b,t[7]=x);let S=d.running||m||_,C;t[8]!==p||t[9]!==S?(C=(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:S,onClick:p,children:`Check for updates`}),t[8]=p,t[9]=S,t[10]=C):C=t[10];let w=d.running||u===0,T;t[11]!==f||t[12]!==l?(T=()=>f(l),t[11]=f,t[12]=l,t[13]=T):T=t[13];let E;t[14]!==u||t[15]!==T||t[16]!==w?(E=(0,Q.jsxs)(zG,{size:`sm`,disabled:w,onClick:T,children:[`Update all (`,u,`)`]}),t[14]=u,t[15]=T,t[16]=w,t[17]=E):E=t[17];let D;t[18]!==E||t[19]!==C?(D=(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[C,E]}),t[18]=E,t[19]=C,t[20]=D):D=t[20];let O;t[21]!==D||t[22]!==x?(O=(0,Q.jsxs)(`div`,{className:`mb-1.5 flex min-h-7 items-center justify-between gap-2`,children:[x,D]}),t[21]=D,t[22]=x,t[23]=O):O=t[23];let k=`This computer: ${n.name}`,A=`Open This computer: ${n.name}`,j;t[24]===r?j=t[25]:(j=()=>r(`this-computer`),t[24]=r,t[25]=j);let M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(d8,{variant:`secondary`,children:`This computer`}),t[26]=M):M=t[26];let N;t[27]===a?N=t[28]:(N=(0,Q.jsx)(yhe,{connection:a}),t[27]=a,t[28]=N);let P;t[29]===i?P=t[30]:(P=i&&(0,Q.jsx)(h9,{}),t[29]=i,t[30]=P);let F;t[31]!==n.name||t[32]!==k||t[33]!==A||t[34]!==j||t[35]!==N||t[36]!==P?(F=(0,Q.jsx)(y9,{name:n.name,label:k,openLabel:A,onOpen:j,status:`online`,badge:M,description:N,update:P}),t[31]=n.name,t[32]=k,t[33]=A,t[34]=j,t[35]=N,t[36]=P,t[37]=F):F=t[37];let I;if(t[38]!==r||t[39]!==o||t[40]!==i){let e;t[42]!==r||t[43]!==i?(e=e=>(0,Q.jsx)(_he,{remote:e,showUpdates:i,onOpen:r},e.environmentId),t[42]=r,t[43]=i,t[44]=e):e=t[44],I=[...o].sort(xhe).map(e),t[38]=r,t[39]=o,t[40]=i,t[41]=I}else I=t[41];let L;t[45]!==F||t[46]!==I?(L=(0,Q.jsxs)(e8,{"aria-label":`Computers`,children:[F,I]}),t[45]=F,t[46]=I,t[47]=L):L=t[47];let R;t[48]!==O||t[49]!==L?(R=(0,Q.jsxs)(`section`,{"aria-labelledby":`computers-heading`,className:`@container flex min-w-0 flex-col gap-2`,children:[O,L]}),t[48]=O,t[49]=L,t[50]=R):R=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(X6,{variant:`label`,children:`Add computer`}),t[51]=ee):ee=t[51];let z;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsxs)(Y6,{children:[ee,(0,Q.jsx)(e8,{children:(0,Q.jsx)(vhe,{})})]}),t[52]=z):z=t[52];let te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(te={section:`computers`,environmentId:`this-computer`},t[53]=te):te=t[53];let ne;t[54]===n.name?ne=t[55]:(ne=(0,Q.jsxs)(`p`,{className:`-mt-3.5 text-ui leading-5 text-muted-foreground`,children:[`To pair a phone, tablet or browser with this computer, open`,` `,(0,Q.jsxs)(LF,{to:`/settings/$section/$environmentId`,params:te,hash:`devices`,className:`rounded-sm font-medium text-foreground underline underline-offset-3 outline-none focus-visible:ring-3 focus-visible:ring-ring/30`,children:[n.name,` › Devices`]}),`.`]}),t[54]=n.name,t[55]=ne);let re;return t[56]!==R||t[57]!==ne||t[58]!==y?(re=(0,Q.jsxs)(Q.Fragment,{children:[v,y,R,z,ne]}),t[56]=R,t[57]=ne,t[58]=y,t[59]=re):re=t[59],re}function xhe(e,t){return e.name.localeCompare(t.name)||e.environmentId.localeCompare(t.environmentId)}var _9=(0,Q.jsx)(dK,{"aria-hidden":!0,strokeWidth:3.5,className:`size-2.5 text-border-strong`});function v9(e){return(0,Q.jsx)(`span`,{"aria-hidden":!0,className:jG(`size-2 rounded-full`,e)})}var She={online:v9(`bg-add-fg`),checking:_9,reconnecting:_9,offline:_9,"needs-pairing":v9(`bg-destructive`),"other-server":v9(`bg-destructive`),incompatible:v9(`bg-warn`)};function y9(e){let t=(0,VW.c)(24),{name:n,label:r,openLabel:i,status:a,badge:o,description:s,update:c,onOpen:l}=e,u=She[a],d;t[0]===u?d=t[1]:(d=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`flex h-5 w-4 items-center justify-center self-start`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==l||t[3]!==i?(f=e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,onClick:l,className:`flex min-w-0 rounded-sm text-left outline-none after:absolute after:inset-0 focus-visible:ring-3 focus-visible:ring-ring/30`,children:e}),t[2]=l,t[3]=i,t[4]=f):f=t[4];let p;t[5]!==n||t[6]!==f?(p=(0,Q.jsx)(H6,{text:n,className:`text-sm leading-5 font-medium`,renderTrigger:f}),t[5]=n,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==o||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[p,o]}),t[8]=o,t[9]=p,t[10]=m):m=t[10];let h;t[11]===s?h=t[12]:(h=(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs leading-4.5 text-muted-foreground`,children:s}),t[11]=s,t[12]=h);let g;t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`min-w-0 self-start`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15];let _;t[16]===c?_=t[17]:(_=c&&(0,Q.jsx)(`div`,{className:`relative col-span-2 col-start-2 row-start-2 min-w-0 @2xl:col-span-1 @2xl:col-start-3 @2xl:row-start-1 @2xl:max-w-80`,children:c}),t[16]=c,t[17]=_);let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(lK,{"aria-hidden":!0,className:`col-start-3 row-start-1 size-4 justify-self-center text-muted-foreground @2xl:col-start-4`}),t[18]=v):v=t[18];let y;return t[19]!==r||t[20]!==d||t[21]!==g||t[22]!==_?(y=(0,Q.jsxs)(t8,{role:`listitem`,"aria-label":r,className:`relative grid grid-cols-[--spacing(4)_minmax(0,1fr)_--spacing(7)] @2xl:grid-cols-[--spacing(4)_minmax(0,1fr)_auto_--spacing(7)]`,children:[d,g,_,v]}),t[19]=r,t[20]=d,t[21]=g,t[22]=_,t[23]=y):y=t[23],y}function b9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:jG(`animate-pulse rounded-md bg-muted`,e),...t})}function x9(e){let t=(0,VW.c)(18),{title:n,description:r,icon:i,children:a,role:o}=e,s;t[0]===i?s=t[1]:(s=i??(0,Q.jsx)(xK,{}),t[0]=i,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 shrink-0 text-muted-foreground [&>svg]:size-4`,children:s}),t[2]=s,t[3]=c);let l;t[4]===n?l=t[5]:(l=(0,Q.jsx)(`h2`,{className:`min-w-0 text-base font-semibold wrap-anywhere`,children:n}),t[4]=n,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,Q.jsx)(`div`,{className:`text-ui leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:r}),t[9]=r,t[10]=d);let f;t[11]===a?f=t[12]:(f=a&&(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:a}),t[11]=a,t[12]=f);let p;return t[13]!==o||t[14]!==u||t[15]!==d||t[16]!==f?(p=(0,Q.jsxs)(`section`,{"data-slot":`state-notice`,role:o,className:`flex w-full min-w-0 max-w-xl flex-col gap-3 p-6 text-left`,children:[u,d,f]}),t[13]=o,t[14]=u,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function Che(e){let t=(0,VW.c)(14),{label:n,caption:r}=e,i=r===void 0||r,a;t[0]!==i||t[1]!==n?(a=i&&(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Q.jsx)(U6,{"aria-hidden":`true`,className:`size-3.5`}),` `,n,`…`]}),t[0]=i,t[1]=n,t[2]=a):a=t[2];let o,s,c,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(b9,{className:`h-5 w-2/3`}),s=(0,Q.jsx)(b9,{className:`h-4 w-full`}),c=(0,Q.jsx)(b9,{className:`h-4 w-4/5`}),l=(0,Q.jsx)(b9,{className:`h-4 w-1/2`}),t[3]=o,t[4]=s,t[5]=c,t[6]=l):(o=t[3],s=t[4],c=t[5],l=t[6]);let u;t[7]!==i||t[8]!==n?(u=!i&&(0,Q.jsxs)(`span`,{className:`sr-only`,children:[n,`…`]}),t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;return t[10]!==n||t[11]!==a||t[12]!==u?(d=(0,Q.jsxs)(`div`,{role:`status`,"aria-label":n,className:`flex w-full min-w-0 flex-1 flex-col gap-3 bg-background p-6`,children:[a,o,s,c,l,u]}),t[10]=n,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function whe(e){let t=(0,VW.c)(10),{description:n,onRetry:r,onBack:i,title:a}=e,o=a===void 0?`Could not display`:a,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(pK,{}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,Q.jsx)(zG,{variant:`outline`,onClick:r,children:`Try again`}),t[1]=r,t[2]=c);let l;t[3]===i?l=t[4]:(l=i&&(0,Q.jsx)(zG,{variant:`ghost`,onClick:i,children:`Back to workspace`}),t[3]=i,t[4]=l);let u;return t[5]!==n||t[6]!==c||t[7]!==l||t[8]!==o?(u=(0,Q.jsxs)(x9,{role:`alert`,title:o,description:n,icon:s,children:[c,l]}),t[5]=n,t[6]=c,t[7]=l,t[8]=o,t[9]=u):u=t[9],u}function The(e){let t=(0,VW.c)(16),{name:n,status:r,onOpenRemotes:i}=e;if(r.kind===`online`)return null;let a=r.kind===`checking`||r.kind===`reconnecting`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(zK,{}),t[0]=o):o=t[0];let s=o;if(r.kind===`needs-pairing`){let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(DK,{}),t[1]=e):e=t[1],s=e}if(a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(U6,{}),t[2]=e):e=t[2],s=e}let c=s,l;t[3]!==n||t[4]!==r?(l=r.kind===`offline`?`${n} is offline`:`${n}: ${M2(r)}`,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===r?u=t[7]:(u=N2(r),t[6]=r,t[7]=u);let d;t[8]!==i||t[9]!==a?(d=!a&&(0,Q.jsx)(zG,{variant:`outline`,onClick:i,children:`Computer settings`}),t[8]=i,t[9]=a,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==d?(f=(0,Q.jsx)(x9,{role:`status`,icon:c,title:l,description:u,children:d}),t[11]=s,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function Ehe(e){let t=(0,VW.c)(14),{remote:n}=e,r,i,a,o;if(t[0]!==n){let e=y2(n);i=Y6,t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(X6,{variant:`label`,children:`Saved connections`}),t[5]=o):o=t[5],r=e8,a=e.map(Dhe),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[6]!==r||t[7]!==a?(s=(0,Q.jsx)(r,{children:a}),t[6]=r,t[7]=a,t[8]=s):s=t[8];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The addresses this app tries, in order, to reach that computer.`}),t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==s?(l=(0,Q.jsxs)(i,{children:[o,s,c]}),t[10]=i,t[11]=o,t[12]=s,t[13]=l):l=t[13],l}function Dhe(e){let{address:t}=e;return(0,Q.jsxs)(t8,{children:[(0,Q.jsxs)(r8,{children:[(0,Q.jsx)(i8,{children:S2(t)}),(0,Q.jsx)(a8,{className:`break-all`,children:t})]}),(0,Q.jsx)(o8,{children:(0,Q.jsxs)(Tq,{children:[(0,Q.jsx)(Eq,{render:(0,Q.jsx)(zG,{size:`icon-sm`,variant:`ghost`,"aria-label":`Copy ${t}`,onClick:()=>jq(t,`address`),children:(0,Q.jsx)(_K,{})})}),(0,Q.jsx)(Dq,{role:`tooltip`,className:`break-all`,children:`Copy ${t}`})]})})]},t)}function Ohe(e){let t=(0,VW.c)(2),{remote:n}=e,r=z6(n),i=r.kind===`online`?r.name:n.name,a;return t[0]===i?a=t[1]:(a=(0,Q.jsx)(H6,{text:i,className:`block min-w-0`}),t[0]=i,t[1]=a),a}function khe(e){let t=(0,VW.c)(13),{environmentId:n,onForgotten:r}=e,{remotes:i,status:a,error:o}=F6(),s;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>e.environmentId===n,t[3]=n,t[4]=e),s=i.find(e),t[0]=n,t[1]=i,t[2]=s}else s=t[2];let c=s;if(!c){let e=a===`ready`?`Computer unavailable`:void 0,n=a===`ready`?`This computer is no longer saved on this app. Return to Computers to add it again.`:o??`Reading saved remote computers…`,r;t[5]===n?r=t[6]:(r=(0,Q.jsx)(u8,{children:n}),t[5]=n,t[6]=r);let i;return t[7]!==e||t[8]!==r?(i=(0,Q.jsx)(c8,{"data-unavailable-page":e,children:r}),t[7]=e,t[8]=r,t[9]=i):i=t[9],i}let l;return t[10]!==r||t[11]!==c?(l=(0,Q.jsx)(Ahe,{remote:c,onForgotten:r}),t[10]=r,t[11]=c,t[12]=l):l=t[12],l}function Ahe(e){let t=(0,VW.c)(76),{remote:n,onForgotten:r}=e,i=z6(n),a=L6(n.environmentId),o=hhe(n,r),s=i.kind===`online`,c=s?i.name:n.name,l;t[0]===i?l=t[1]:(l=N2(i),t[0]=i,t[1]=l);let u=l,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(X6,{variant:`label`,children:`Overview`}),t[2]=d):d=t[2];let f;t[3]===c?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`min-w-0`,children:c}),t[3]=c,t[4]=f);let p;t[5]===i?p=t[6]:(p=e6(i),t[5]=i,t[6]=p);let m;t[7]===i?m=t[8]:(m=M2(i),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Q.jsx)(d8,{variant:p,children:m}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==f||t[13]!==h?(g=(0,Q.jsxs)(i8,{className:`min-w-0 flex-wrap`,children:[f,` `,h]}),t[12]=f,t[13]=h,t[14]=g):g=t[14];let _;t[15]===u?_=t[16]:(_=u&&(0,Q.jsx)(a8,{children:u}),t[15]=u,t[16]=_);let v;t[17]===s?v=t[18]:(v=!s&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Saved details · Stale. This computer has not been verified online.`}),t[17]=s,t[18]=v);let y;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(K5,{render:(0,Q.jsx)(zG,{variant:`ghost`,size:`sm`}),children:`Details`}),t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Address`}),t[20]=b):b=t[20];let x;t[21]===n.address?x=t[22]:(x=(0,Q.jsxs)(`div`,{children:[b,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.address})]}),t[21]=n.address,t[22]=x);let S;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Computer ID`}),t[23]=S):S=t[23];let C;t[24]===n.environmentId?C=t[25]:(C=(0,Q.jsxs)(`div`,{children:[S,(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.environmentId})]}),t[24]=n.environmentId,t[25]=C);let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Porcelain version`}),t[26]=w):w=t[26];let T=s?i.version??`Not reported`:`Unavailable while this computer is not online`,E;t[27]===T?E=t[28]:(E=(0,Q.jsxs)(`div`,{children:[w,(0,Q.jsx)(`dd`,{children:T})]}),t[27]=T,t[28]=E);let D;t[29]===n.deviceId?D=t[30]:(D=n.deviceId&&(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`This app’s device ID`}),(0,Q.jsx)(`dd`,{className:`break-all font-mono`,children:n.deviceId})]}),t[29]=n.deviceId,t[30]=D);let O;t[31]!==x||t[32]!==C||t[33]!==E||t[34]!==D?(O=(0,Q.jsxs)(G5,{children:[y,(0,Q.jsx)(q5,{children:(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[x,C,E,D]})})]}),t[31]=x,t[32]=C,t[33]=E,t[34]=D,t[35]=O):O=t[35];let k;t[36]!==O||t[37]!==g||t[38]!==_||t[39]!==v?(k=(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[g,_,v,O]})}),t[36]=O,t[37]=g,t[38]=_,t[39]=v,t[40]=k):k=t[40];let A;t[41]!==a||t[42]!==s?(A=s&&a&&(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsx)(r8,{children:(0,Q.jsx)(kpe,{connection:a.connection})})}),t[41]=a,t[42]=s,t[43]=A):A=t[43];let j;t[44]!==k||t[45]!==A?(j=(0,Q.jsxs)(Y6,{className:`lg:col-span-2`,children:[d,(0,Q.jsxs)(e8,{children:[k,A]})]}),t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]!==a||t[48]!==s?(M=s&&a&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(m9,{connection:a.connection}),(0,Q.jsx)(g9,{connection:a.connection})]}),t[47]=a,t[48]=s,t[49]=M):M=t[49];let N;t[50]===n?N=t[51]:(N=(0,Q.jsx)(Ehe,{remote:n}),t[50]=n,t[51]=N);let P;t[52]===s?P=t[53]:(P=!s&&(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[(0,Q.jsx)(i8,{children:`Pair again`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`On this computer, run porcelain pair. Return to Computers and add the new link to replace this app’s saved connection.`})]})}),t[52]=s,t[53]=P);let F;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(X6,{variant:`label`,children:`Danger zone`}),t[54]=F):F=t[54];let I;t[55]===c?I=t[56]:(I=(0,Q.jsxs)(i8,{children:[`Forget `,c]}),t[55]=c,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removes this computer from this app. Other devices keep their access.`}),t[57]=L):L=t[57];let R;t[58]===o?R=t[59]:(R=()=>void o.submit(),t[58]=o,t[59]=R);let ee=o.result.waiting?`Forgetting…`:`Forget on this app`,z;t[60]!==o.result.waiting||t[61]!==R||t[62]!==ee?(z=(0,Q.jsx)(zG,{variant:`destructive`,className:`w-fit`,disabled:o.result.waiting,onClick:R,children:ee}),t[60]=o.result.waiting,t[61]=R,t[62]=ee,t[63]=z):z=t[63];let te;t[64]===o.result?te=t[65]:(te=Nw(o.result)&&(0,Q.jsx)(c8,{variant:`destructive`,children:(0,Q.jsx)(u8,{children:I4(wu(o.result.cause))})}),t[64]=o.result,t[65]=te);let ne;t[66]!==I||t[67]!==z||t[68]!==te?(ne=(0,Q.jsxs)(Y6,{children:[F,(0,Q.jsx)(`div`,{className:`rounded-2xl border border-destructive/30`,children:(0,Q.jsx)(e8,{children:(0,Q.jsx)(t8,{variant:`outline`,children:(0,Q.jsxs)(r8,{children:[I,L,z,te]})})})})]}),t[66]=I,t[67]=z,t[68]=te,t[69]=ne):ne=t[69];let re;return t[70]!==j||t[71]!==M||t[72]!==N||t[73]!==P||t[74]!==ne?(re=(0,Q.jsxs)(`div`,{className:`settings-computer grid min-w-0 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,1fr)_--spacing(62)]`,children:[j,M,N,P,ne]}),t[70]=j,t[71]=M,t[72]=N,t[73]=P,t[74]=ne,t[75]=re):re=t[75],re}var jhe=Ck(e=>e.registry),S9=X(e=>Ck(t=>{let n=window.matchMedia(e),r=()=>t.setSelf(n.matches);return n.addEventListener(`change`,r),t.addFinalizer(()=>n.removeEventListener(`change`,r)),n.matches})),Mhe=Ck(()=>{let e=document.title,t=new Map;return n=>{let r=Symbol();return t.set(r,n),document.title=n,()=>{t.delete(r),document.title=[...t.values()].at(-1)??e}}}),Nhe=X(e=>Ck(t=>{t.addFinalizer(t(Mhe)(e))}));function C9(){let e=(0,VW.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=S9(`(max-width: 767px)`),e[0]=t):t=e[0],tI(t)}var w9=Z.createContext(void 0);function T9(e){let t=Z.useContext(w9);if(!e&&t===void 0)throw Error(wI(27));return t}var E9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=T9(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return mB(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:hR,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),D9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=T9(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=GB({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,dV(eV,e.nativeEvent))}return mB(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),O9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=sq(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),mB(`p`,e,{ref:t,props:[{id:c},o]})}),k9=Z.createContext(void 0);function Phe(){let e=Z.useContext(k9);if(e===void 0)throw Error(wI(26));return e}var Fhe=`--nested-dialogs`,Ihe=`data-nested-dialog-open`,Lhe={...mR,...tR,nestedDialogOpen(e){return e?{[Ihe]:``}:null}},A9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=T9(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Phe(),EB({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?CU(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=mB(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...SU,hidden:!m,onKeyDown(e){$8.has(e.key)&&e.stopPropagation()},style:{[Fhe]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Lhe});return(0,Q.jsx)(sH,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),j9=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=T9(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,Q.jsx)(k9.Provider,{value:n,children:(0,Q.jsxs)(_V,{ref:t,...r,children:[a&&o===!0&&(0,Q.jsx)(s5,{ref:i.context.internalBackdropRef,inert:xB(!s)}),e.children]})}):null});function Rhe({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Z.useState(0),[u,d]=Z.useState(0),f=c===0,p=mH(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=WL(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||UL(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return p5(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),xI(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),PU(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var M9={...UU,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},zhe=class extends KI{constructor(e,t,n){let r=new IU,i=N9(e,r,t,n);super(i,P9(r),M9)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled||(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(OU(this.state,e,t.trigger)))}};function Bhe(){let e=new IU;return new eq(Object.freeze(N9(void 0,e)),Object.freeze(P9(e)),M9)}function N9(e,t,n,r=!1){return{...LU(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function P9(e){return{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function F9(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=T9(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=wU((e,t)=>new zhe({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);FU(b,x),MU(b);let{forceUnmount:w}=NU(x,b);Z.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,dV(lV))}),[w,b]);let T=x||S;return(0,Q.jsxs)(w9.Provider,{value:b,children:[u&&(0,Q.jsx)(TU,{handle:u,store:b}),T&&(0,Q.jsx)(Rhe,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var I9=jI(function(e){return F9(`dialog`,e)}),L9=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=T9(),c=sq(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),mB(`h2`,e,{ref:t,props:[{id:c},o]})});function R9({...e}){return(0,Q.jsx)(I9,{"data-slot":`sheet`,...e})}function Vhe({...e}){return(0,Q.jsx)(j9,{"data-slot":`sheet-portal`,...e})}function Hhe({className:e,...t}){return(0,Q.jsx)(E9,{"data-slot":`sheet-overlay`,className:jG(`fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function z9({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,Q.jsxs)(Vhe,{children:[(0,Q.jsx)(Hhe,{}),(0,Q.jsxs)(A9,{"data-slot":`sheet-content`,"data-side":n,className:jG(`fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,e),...i,children:[t,r&&(0,Q.jsxs)(D9,{"data-slot":`sheet-close`,render:(0,Q.jsx)(zG,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,Q.jsx)(ZK,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function B9({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:jG(`flex flex-col gap-1.5 p-6`,e),...t})}function V9({className:e,...t}){return(0,Q.jsx)(L9,{"data-slot":`sheet-title`,className:jG(`font-heading text-sm font-medium text-foreground`,e),...t})}function H9({className:e,...t}){return(0,Q.jsx)(O9,{"data-slot":`sheet-description`,className:jG(`text-xs/relaxed text-muted-foreground`,e),...t})}var Uhe=`sidebar_state`,Whe=604800,Ghe=`16rem`,Khe=`18rem`,qhe=`3rem`,Jhe=`b`,U9=Z.createContext(null);function W9(){let e=Z.useContext(U9);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Yhe({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=C9(),[c,l]=Z.useState(!1),[u,d]=Z.useState(e),f=t??u,p=Z.useCallback(e=>{let t=typeof e==`function`?e(f):e;n?n(t):d(t),document.cookie=`${Uhe}=${t}; path=/; max-age=${Whe}`},[n,f]),m=Z.useCallback(()=>s?l(e=>!e):p(e=>!e),[s,p,l]);Z.useEffect(()=>{let e=e=>{e.key===Jhe&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m]);let h=f?`expanded`:`collapsed`,g=Z.useMemo(()=>({state:h,open:f,setOpen:p,isMobile:s,openMobile:c,setOpenMobile:l,toggleSidebar:m}),[h,f,p,s,c,l,m]);return(0,Q.jsx)(U9.Provider,{value:g,children:(0,Q.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{"--sidebar-width":Ghe,"--sidebar-width-icon":qhe,...i},className:jG(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function Xhe({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,dir:a,...o}){let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=W9();return n===`none`?(0,Q.jsx)(`div`,{"data-slot":`sidebar`,className:jG(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),...o,children:i}):s?(0,Q.jsx)(R9,{open:l,onOpenChange:u,...o,children:(0,Q.jsxs)(z9,{dir:a,"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden`,style:{"--sidebar-width":Khe},side:e,children:[(0,Q.jsxs)(B9,{className:`sr-only`,children:[(0,Q.jsx)(V9,{children:`Sidebar`}),(0,Q.jsx)(H9,{children:`Displays the mobile sidebar.`})]}),(0,Q.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})]})}):(0,Q.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,"data-slot":`sidebar`,children:[(0,Q.jsx)(`div`,{"data-slot":`sidebar-gap`,className:jG(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`)}),(0,Q.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":e,className:jG(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...o,children:(0,Q.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:i})})]})}function Zhe({className:e,onClick:t,...n}){let{toggleSidebar:r}=W9();return(0,Q.jsxs)(zG,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:jG(e),onClick:e=>{t?.(e),r()},...n,children:[(0,Q.jsx)(FK,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})}function Qhe({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:jG(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t})}function $he({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:jG(`relative flex w-full min-w-0 flex-col px-2 py-1`,e),...t})}function ege({className:e,render:t,...n}){return $6({defaultTagName:`button`,props:eB({className:jG(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,e)},n),render:t,state:{slot:`sidebar-group-action`,sidebar:`group-action`}})}function tge({className:e,...t}){return(0,Q.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:jG(`flex w-full min-w-0 flex-col gap-px`,e),...t})}function nge({className:e,...t}){return(0,Q.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:jG(`group/menu-item relative`,e),...t})}var G9=Z.createContext(void 0);function K9(e){let t=Z.useContext(G9);if(t===void 0&&!e)throw Error(wI(47));return t}var rge={...UU,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},ige=class extends KI{constructor(e,t,n){let r=new IU;super(age(e,r,t,n),oge(r),rge)}setOpen=(e,t)=>{let n=t.reason===XB,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=kU(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=OU(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),SI.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function age(e,t,n,r=!1){let i={...LU(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function oge(e){return{popupRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new EL,triggerElements:e}}var q9=jI(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=cge(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),FU(u,d),MU(u);let{forceUnmount:m}=NU(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),Z.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,dV(lV))}),[m,u]);let h=d||f;return(0,Q.jsxs)(G9.Provider,{value:u,children:[s&&(0,Q.jsx)(TU,{handle:s,store:u}),h&&(0,Q.jsx)(lge,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function sge(e){return K9(!0)?(0,Q.jsx)(q9,{props:e}):(0,Q.jsx)(QV,{children:(0,Q.jsx)(q9,{props:e})})}function cge(e,t){let n=wU((e,n)=>new ige(t,e,n));return Z.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function lge({store:e,modal:t}){let n=mH(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return PU(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var uge=MI(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=K9(!0),h=WU(s)??m;if(!h)throw Error(wI(74));let g=sq(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Z.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=jU(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`openChangeReason`),T=h.useState(`stickIfOpen`),E=h.useState(`openMethod`),D=h.useState(`focusManagerModal`),O=rW(v,{enabled:!a&&l&&(E!==`touch`||w!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:bW(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),k=cH(v,{stickIfOpen:T}),A=y5(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),j=h.useState(`triggerProps`,C),{getButtonProps:M,buttonRef:N}=GB({disabled:a,native:o}),P={open(e){return e&&w===`trigger-press`?pR.open(e):fR.open(e)}},{preFocusGuardRef:F,handlePreFocusGuardFocus:I,handleFocusTargetFocus:L}=E5(h,x),R=mB(`button`,e,{state:{disabled:a,open:y},ref:[N,t,S,x],props:[k.reference,O,j,A,{[OB]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,M],stateAttributesMapping:P}),ee=(0,Q.jsx)(Z.Fragment,{children:R},g);return C&&!D?(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(Vz,{ref:F,onFocus:I}),ee,(0,Q.jsx)(Vz,{ref:h.context.triggerFocusTargetRef,onFocus:L})]}):ee}),J9=Z.createContext(void 0);function dge(){let e=Z.useContext(J9);if(e===void 0)throw Error(wI(45));return e}var fge=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return K9().useState(`mounted`)||n?(0,Q.jsx)(J9.Provider,{value:n,children:(0,Q.jsx)(_V,{ref:t,...r})}):null}),Y9=Z.createContext(void 0);function pge(){let e=Z.useContext(Y9);if(!e)throw Error(wI(46));return e}var mge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=PB,..._}=e,v=K9(),y=dge(),b=XV(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`adaptiveOrigin`),M=Z.useRef(null),N=TB(O),P=IW({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j}),F=x.useState(`domReferenceElement`);xI(()=>{let e=F,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[F,N,v]);let I=E===!0&&w!==`trigger-hover`;m5(C&&I,D===`touch`,O,T);let L=v.useStateSetter(`positionerElement`),R=BW(e,{open:C,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:k},{styles:P.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,Q.jsxs)(Y9.Provider,{value:P,children:[S&&I&&(0,Q.jsx)(s5,{inert:xB(!C),cutout:T}),(0,Q.jsx)(ZV,{id:b,children:R})]})}),hge=Z.createContext(void 0);function gge(){let[e,t]=Z.useState(0),n=UI(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var _ge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=K9(),l=pge(),u=q8(!0)!=null,{context:d,hasClosePart:f}=gge(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);EB({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),tW(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?CU(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=mB(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...SU,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&$8.has(e.key)&&e.stopPropagation()}},zW(g),s],stateAttributesMapping:hR});return(0,Q.jsx)(sH,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,previousFocusableElement:$I(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,Q.jsx)(hge.Provider,{value:d,children:M})})}),vge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=sq(a.id);return o.useSyncedValueWithCleanup(`titleElementId`,s),mB(`h2`,e,{ref:t,props:[{id:s},a]})}),yge=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=K9(),s=sq(a.id);return o.useSyncedValueWithCleanup(`descriptionElementId`,s),mB(`p`,e,{ref:t,props:[{id:s},a]})});function X9({...e}){return(0,Q.jsx)(sge,{"data-slot":`popover`,...e})}function Z9({...e}){return(0,Q.jsx)(uge,{"data-slot":`popover-trigger`,...e})}function Q9({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,Q.jsx)(fge,{children:(0,Q.jsx)(mge,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,Q.jsx)(_ge,{"data-slot":`popover-content`,className:jG(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...a})})})}function bge({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`popover-header`,className:jG(`flex flex-col gap-1 text-xs`,e),...t})}function $9({className:e,...t}){return(0,Q.jsx)(vge,{"data-slot":`popover-title`,className:jG(`text-sm font-medium`,e),...t})}function xge({className:e,...t}){return(0,Q.jsx)(yge,{"data-slot":`popover-description`,className:jG(`text-muted-foreground`,e),...t})}function Sge(e){let t=(0,VW.c)(84),{fallbackFocus:n}=e,{rows:r,targets:i,count:a,batch:o,run:s,failures:c,checking:l,refresh:u,retry:d}=I5(),f=jF(),{setOpenMobile:p}=W9(),[m,h]=(0,Z.useState)(!1),g,_,v,y,b,x,S,C,w,T,E,D,O,k,A;if(t[0]!==o||t[1]!==l||t[2]!==c||t[3]!==n||t[4]!==m||t[5]!==u||t[6]!==d||t[7]!==r||t[8]!==i){S=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.filter(Ege),a=r.filter(t=>e.includes(t)||o.entries.some(e=>e.id===t.target.id&&e.kind===t.target.kind)),s;t[24]===o?s=t[25]:(s=bce(o),t[24]=o,t[25]=s);let f=s;v=f.label?`${f.label}…`:`Preparing updates…`;let p;t[26]!==o||t[27]!==i?(p=_ce(i,o),t[26]=o,t[27]=i,t[28]=p):p=t[28];let j=p,M=`Updates available`;if(!j&&o.entries.length===0&&(M=`No updates available`),c.length>0&&(M=`Could not check for updates`),!j&&!m){S=null;break bb0}_=X9,A=m,t[29]===u?b=t[30]:(b=e=>{h(e),e&&u()},t[29]=u,t[30]=b);let N=!j&&`invisible`,P;t[31]===N?P=t[32]:(P=jG(N),t[31]=N,t[32]=P);let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(d8,{render:(0,Q.jsx)(`button`,{type:`button`})}),t[33]=F):F=t[33];let I=o.running?`Updating…`:`Update`;t[34]!==P||t[35]!==I?(x=(0,Q.jsx)(`span`,{className:`inline-flex [--primary:var(--brand-soft)] [--primary-foreground:var(--brand)]`,children:(0,Q.jsx)(Z9,{className:P,render:F,children:I})}),t[34]=P,t[35]=I,t[36]=x):x=t[36],g=Q9,w=`top`,T=`end`,E=`max-h-(--available-height) w-88 max-w-[calc(100vw-1rem)] overflow-y-auto`,t[37]!==n||t[38]!==j?(D=j?!0:()=>n.element,t[37]=n,t[38]=j,t[39]=D):D=t[39],t[40]===M?O=t[41]:(O=(0,Q.jsx)($9,{children:M}),t[40]=M,t[41]=O),t[42]!==l||t[43]!==c||t[44]!==d?(k=c.length>0&&(0,Q.jsxs)(c8,{variant:`destructive`,children:[(0,Q.jsx)(l8,{children:`The update check failed`}),(0,Q.jsxs)(u8,{children:[c.map(Tge),(0,Q.jsx)(zG,{size:`sm`,variant:`outline`,disabled:l,onClick:d,children:`Try again`})]})]}),t[42]=l,t[43]=c,t[44]=d,t[45]=k):k=t[45],y=`flex max-h-[60svh] flex-col divide-y overflow-y-auto`,C=a.map(wge)}t[0]=o,t[1]=l,t[2]=c,t[3]=n,t[4]=m,t[5]=u,t[6]=d,t[7]=r,t[8]=i,t[9]=g,t[10]=_,t[11]=v,t[12]=y,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A}else g=t[9],_=t[10],v=t[11],y=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=t[23];if(S!==Symbol.for(`react.early_return_sentinel`))return S;let j;if(t[46]!==o.entries||t[47]!==r){let e;t[49]===r?e=t[50]:(e=e=>!r.some(t=>{let{target:n}=t;return n.id===e.id&&n.kind===e.kind}),t[49]=r,t[50]=e),j=o.entries.filter(e).map(Cge),t[46]=o.entries,t[47]=r,t[48]=j}else j=t[48];let M;t[51]!==y||t[52]!==j||t[53]!==C?(M=(0,Q.jsxs)(`div`,{className:y,children:[C,j]}),t[51]=y,t[52]=j,t[53]=C,t[54]=M):M=t[54];let N;t[55]!==f||t[56]!==p?(N=(0,Q.jsx)(zG,{size:`sm`,variant:`ghost`,onClick:()=>{h(!1),p(!1),f({to:`/settings/$section`,params:{section:`computers`}})},children:`Manage computers`}),t[55]=f,t[56]=p,t[57]=N):N=t[57];let P=o.running||a===0,F;t[58]!==s||t[59]!==i?(F=()=>s(i),t[58]=s,t[59]=i,t[60]=F):F=t[60];let I=o.running?v:`Update all (${a})`,L;t[61]!==P||t[62]!==F||t[63]!==I?(L=(0,Q.jsx)(zG,{size:`sm`,disabled:P,"aria-live":`polite`,onClick:F,children:I}),t[61]=P,t[62]=F,t[63]=I,t[64]=L):L=t[64];let R;t[65]!==N||t[66]!==L?(R=(0,Q.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t pt-3`,children:[N,L]}),t[65]=N,t[66]=L,t[67]=R):R=t[67];let ee;t[68]!==g||t[69]!==M||t[70]!==R||t[71]!==w||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==O||t[76]!==k?(ee=(0,Q.jsxs)(g,{side:w,align:T,className:E,finalFocus:D,children:[O,k,M,R]}),t[68]=g,t[69]=M,t[70]=R,t[71]=w,t[72]=T,t[73]=E,t[74]=D,t[75]=O,t[76]=k,t[77]=ee):ee=t[77];let z;return t[78]!==_||t[79]!==b||t[80]!==x||t[81]!==ee||t[82]!==A?(z=(0,Q.jsxs)(_,{open:A,onOpenChange:b,children:[x,ee]}),t[78]=_,t[79]=b,t[80]=x,t[81]=ee,t[82]=A,t[83]=z):z=t[83],z}function Cge(e){return(0,Q.jsxs)(`div`,{className:`py-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,Q.jsx)(`p`,{role:e.status===`failed`?`alert`:`status`,className:`text-xs text-muted-foreground`,children:Dge(e)})]},`${e.kind}:${e.id}`)}function wge(e){return(0,Q.jsx)(`div`,{className:`py-3`,children:(0,Q.jsx)(J5,{row:e,showName:!0})},`${e.target.kind}:${e.target.id}`)}function Tge(e){return(0,Q.jsxs)(`p`,{className:`wrap-anywhere`,children:[e.name,`: `,e.message]},e.id)}function Ege(e){let{target:t}=e;return G4(t)}function Dge(e){return e.status===`failed`?e.message:e.status===`updated`?`Updated to ${e.version}.`:e.status===`queued`?`Queued`:`Updating to ${e.version}…`}export{S7 as $,xB as $a,up as $c,D0 as $i,h6 as $n,TF as $o,H3 as $r,mO as $s,u8 as $t,E9 as A,RG as Aa,bC as Ac,zce as Ai,L6 as An,xI as Ao,e6 as Ar,moe as As,_fe as At,Che as B,cV as Ba,U as Bc,fce as Bi,Yue as Bn,oI as Bo,kle as Br,Ck as Bs,k8 as Bt,I9 as C,lK as Ca,pC as Cc,f3 as Ci,z6 as Cn,bL as Co,uue as Cr,voe as Cs,X8 as Ct,A9 as D,tK as Da,EC as Dc,c3 as Di,fde as Dn,KI as Do,sue as Dr,KP as Ds,Q8 as Dt,j9 as E,rK as Ea,Are as Ec,Lce as Ei,dde as En,YI as Eo,lue as Er,xoe as Es,$8 as Et,Ohe as F,vV as Fa,Sg as Fc,Dce as Fi,Zue as Fn,hI as Fo,Hle as Fr,X as Fs,L8 as Ft,F7 as G,WB as Ga,Bp as Gc,u4 as Gi,Vue as Gn,zF as Go,Ele as Gr,pk as Gs,w8 as Gt,bhe as H,JB as Ha,Um as Hc,A4 as Hi,y6 as Hn,tI as Ho,Ole as Hr,bk as Hs,D8 as Ht,khe as I,dV as Ia,mg as Ic,r3 as Ii,Que as In,cI as Io,X3 as Ir,Hk as Is,P8 as It,z7 as J,BB as Ja,Pm as Jc,a4 as Ji,Bue as Jn,Zoe as Jo,xle as Jr,PO as Js,x8 as Jt,R7 as K,VB as Ka,Op as Kc,Mse as Ki,Lue as Kn,LF as Ko,Tle as Kr,HO as Ks,C8 as Kt,The as L,iV as La,lm as Lc,Oce as Li,Xue as Ln,aI as Lo,Y3 as Lr,Rk as Ls,F8 as Lt,jhe as M,jG as Ma,Fy as Mc,i3 as Mi,cde as Mn,vI as Mo,Kle as Mr,UP as Ms,G8 as Mt,Nhe as N,SW as Na,py as Nc,a3 as Ni,$ue as Nn,gI as No,qle as Nr,CP as Ns,H8 as Nt,O9 as O,$G as Oa,DC as Oc,Ice as Oi,R6 as On,UI as Oo,$le as Or,boe as Os,mfe as Ot,S9 as P,xU as Pa,my as Pc,t3 as Pi,ede as Pn,_I as Po,Gle as Pr,Bk as Ps,I8 as Pt,C7 as Q,EB as Qa,Ep as Qc,M2 as Qi,Iue as Qn,EF as Qo,U3 as Qr,OO as Qs,c8 as Qt,whe as R,oV as Ra,Pp as Rc,kce as Ri,Gue as Rn,pI as Ro,Ple as Rr,Jk as Rs,A8 as Rt,L9 as S,_K as Sa,dC as Sc,Vce as Si,B6 as Sn,DL as So,due as Sr,qP as Ss,Y8 as St,Bhe as T,aK as Ta,FS as Tc,Bce as Ti,mde as Tn,vL as To,i6 as Tr,nF as Ts,J8 as Tt,uhe as U,YB as Ua,sp as Uc,D4 as Ui,Rue as Un,GF as Uo,Dle as Ur,iA as Us,E8 as Ut,b9 as V,sV as Va,Cp as Vc,I4 as Vi,Wue as Vn,fI as Vo,Nle as Vr,Zk as Vs,O8 as Vt,s9 as W,GB as Wa,H as Wc,w4 as Wi,zue as Wn,VF as Wo,Ale as Wr,Nk as Ws,T8 as Wt,L7 as X,jB as Xa,B as Xc,J2 as Xi,Nue as Xn,AF as Xo,Sle as Xr,IO as Xs,f8 as Xt,Cme as Y,IB as Ya,sm as Yc,o4 as Yi,Pue as Yn,jF as Yo,Cle as Yr,MO as Ys,b8 as Yt,I7 as Z,MB as Za,V as Zc,N2 as Zi,Fue as Zn,OF as Zo,W3 as Zr,RO as Zs,d8 as Zt,R9 as _,LK as _a,sC as _c,qce as _i,Yn as _l,q6 as _n,HL as _o,pue as _r,woe as _s,x5 as _t,bge as a,SJ as aa,Aw as ac,Qce as ai,td as al,e8 as an,Bz as ao,Mue as ar,Voe as as,N5 as at,B9 as b,kK as ba,q as bc,h3 as bi,qn as bl,U6 as bn,zL as bo,fue as br,eF as bs,i5 as bt,Xhe as c,jq as ca,jw as cc,Zce as ci,Iu as cl,$6 as cn,sz as co,Eue as cr,yF as cs,A5 as ct,ege as d,Dq as da,Bw as dc,Yce as di,dr as dl,wde as dn,DR as do,Cue as dr,Moe as ds,M5 as dt,LZ as ea,PD as ec,dle as ei,xm as el,l8 as en,mB as eo,f6 as er,Koe as es,g7 as et,tge as f,wq as fa,J as fc,x3 as fi,lee as fl,Cde as fn,CR as fo,bue as fr,joe as fs,epe as ft,W9 as g,VK as ga,FC as gc,_3 as gi,Jn as gl,J6 as gn,ZL as go,gue as gr,rF as gs,w5 as gt,Zhe as h,ZK as ha,oC as hc,v3 as hi,er as hl,xde as hn,QL as ho,hue as hr,iF as hs,T5 as ht,xge as i,EJ as ia,Ww as ic,cle as ii,cd as il,a8 as in,zz as io,d6 as ir,Roe as is,K5 as it,C9 as j,LG as ja,W as jc,Rce as ji,lde as jn,bI as jo,Q3 as jr,WP as js,K8 as jt,D9 as k,zG as ka,jC as kc,Fce as ki,I6 as kn,wI as ko,Qle as kr,YP as ks,gfe as kt,Qhe as l,kq as la,Tw as lc,S3 as li,Au as ll,Z6 as ln,oz as lo,u6 as lr,pF as ls,j5 as lt,Yhe as m,sq as ma,qC as mc,g3 as mi,rr as ml,Y6 as mn,tR as mo,xue as mr,Poe as ms,D5 as mt,X9 as n,OY as na,ND as nc,k3 as ni,Rd as nl,o8 as nn,Hz as no,p6 as nr,Hoe as ns,G5 as nt,$9 as o,xJ as oa,Nw as oc,$ce as oi,Ru as ol,n8 as on,lz as oo,Aue as or,zoe as os,O5 as ot,nge as p,Eq as pa,ZS as pc,Jce as pi,Zn as pl,X6 as pn,pR as po,Sue as pr,koe as ps,k5 as pt,Sme as q,HB as qa,Am as qc,s4 as qi,v6 as qn,sse as qo,wle as qr,NO as qs,S8 as qt,Q9 as r,wJ as ra,GD as rc,A3 as ri,wd as rl,r8 as rn,Vz as ro,jue as rr,Uoe as rs,q5 as rt,Z9 as s,Pq as sa,Ow as sc,ele as si,Lu as sl,i8 as sn,cz as so,Oue as sr,vF as ss,Zfe as st,Sge as t,gZ as ta,jD as tc,ule as ti,kd as tl,t8 as tn,eB as to,g6 as tr,CF as ts,Q5 as tt,$he as u,Tq as ua,Uw as uc,Xce as ui,wu as ul,Q6 as un,uz as uo,wue as ur,Aoe as us,Xfe as ut,z9 as v,NK as va,eC as vc,Gce as vi,ir as vl,bde as vn,UL as vo,o6 as vr,Doe as vs,h5 as vt,F9 as w,sK as wa,jre as wc,Hce as wi,gde as wn,yL as wo,cue as wr,GP as ws,Z8 as wt,V9 as x,xK as xa,qS as xc,p3 as xi,cr as xl,H6 as xn,EL as xo,_ue as xr,Eoe as xs,n5 as xt,H9 as y,jK as ya,K as yc,Uce as yi,Kn as yl,G6 as yn,WL as yo,yue as yr,Toe as ys,a5 as yt,x9 as z,lV as za,fm as zc,$4 as zi,Jue as zn,sI as zo,Fle as zr,aA as zs,j8 as zt};
|