@clawos-dev/clawd 0.2.483 → 0.2.485
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.
|
@@ -21357,6 +21357,16 @@ var DeployScanSchema = external_exports.object({
|
|
|
21357
21357
|
notes: external_exports.array(external_exports.string()).default([]),
|
|
21358
21358
|
/** 扫描时被告知的共享资产名单(判「扫描器后来长了新本事」用) */
|
|
21359
21359
|
scannedAssets: external_exports.array(external_exports.string()).default([]),
|
|
21360
|
+
/**
|
|
21361
|
+
* 这次扫描是**对哪个 commit 的断言**。`deploy:start` 在起扫描之前会先把 persona 目录
|
|
21362
|
+
* 提交并推上去,所以这个值一定是仓库里真实存在的一版。
|
|
21363
|
+
*
|
|
21364
|
+
* 有了它,「清单过没过时」才是个可判定的等式(`head === repo.head`),
|
|
21365
|
+
* 而不是从 `dirty` / `ahead` 里猜——那两个字段判不出「清单是好几版之前扫的」。
|
|
21366
|
+
*
|
|
21367
|
+
* 缺席 = 旧版 clawd 扫的记录。**一律当过时**:没有第三种情况,重扫一次就有了。
|
|
21368
|
+
*/
|
|
21369
|
+
head: external_exports.string().min(1).optional(),
|
|
21360
21370
|
startedAt: external_exports.number(),
|
|
21361
21371
|
finishedAt: external_exports.number().optional(),
|
|
21362
21372
|
error: external_exports.string().optional()
|
package/dist/cli.cjs
CHANGED
|
@@ -6022,6 +6022,11 @@ var init_environment_schemas = __esm({
|
|
|
6022
6022
|
});
|
|
6023
6023
|
|
|
6024
6024
|
// ../protocol/src/deploy-schemas.ts
|
|
6025
|
+
function isScanFresh(scan, repo2) {
|
|
6026
|
+
if (!scan || !repo2) return false;
|
|
6027
|
+
if (scan.status !== "done") return false;
|
|
6028
|
+
return scan.head === repo2.head && !repo2.dirty;
|
|
6029
|
+
}
|
|
6025
6030
|
function repoSlug(url) {
|
|
6026
6031
|
return url.trim().replace(/^git@[^:]+:/, "").replace(/^https?:\/\/[^/]+\//, "").replace(/\.git$/, "");
|
|
6027
6032
|
}
|
|
@@ -6044,6 +6049,16 @@ var init_deploy_schemas = __esm({
|
|
|
6044
6049
|
notes: external_exports.array(external_exports.string()).default([]),
|
|
6045
6050
|
/** 扫描时被告知的共享资产名单(判「扫描器后来长了新本事」用) */
|
|
6046
6051
|
scannedAssets: external_exports.array(external_exports.string()).default([]),
|
|
6052
|
+
/**
|
|
6053
|
+
* 这次扫描是**对哪个 commit 的断言**。`deploy:start` 在起扫描之前会先把 persona 目录
|
|
6054
|
+
* 提交并推上去,所以这个值一定是仓库里真实存在的一版。
|
|
6055
|
+
*
|
|
6056
|
+
* 有了它,「清单过没过时」才是个可判定的等式(`head === repo.head`),
|
|
6057
|
+
* 而不是从 `dirty` / `ahead` 里猜——那两个字段判不出「清单是好几版之前扫的」。
|
|
6058
|
+
*
|
|
6059
|
+
* 缺席 = 旧版 clawd 扫的记录。**一律当过时**:没有第三种情况,重扫一次就有了。
|
|
6060
|
+
*/
|
|
6061
|
+
head: external_exports.string().min(1).optional(),
|
|
6047
6062
|
startedAt: external_exports.number(),
|
|
6048
6063
|
finishedAt: external_exports.number().optional(),
|
|
6049
6064
|
error: external_exports.string().optional()
|
|
@@ -55153,6 +55168,16 @@ async function listSecrets(exec, dir) {
|
|
|
55153
55168
|
return { env: x.name, ...Number.isFinite(at2) ? { setAt: at2 } : {} };
|
|
55154
55169
|
});
|
|
55155
55170
|
}
|
|
55171
|
+
async function commitAndPush(exec, args) {
|
|
55172
|
+
await mustGit(exec, args.dir, ["add", "-A"], "\u6682\u5B58\u6587\u4EF6");
|
|
55173
|
+
const staged = await git(exec, args.dir, ["diff", "--cached", "--quiet"]);
|
|
55174
|
+
if (staged.code === 1) {
|
|
55175
|
+
const identity = await identityArgs(exec, args.dir);
|
|
55176
|
+
await mustGit(exec, args.dir, [...identity, "commit", "-m", args.message], "\u63D0\u4EA4");
|
|
55177
|
+
}
|
|
55178
|
+
await mustGit(exec, args.dir, ["push", "-u", "origin", "HEAD"], "\u63A8\u9001", { timeoutMs: 12e4 });
|
|
55179
|
+
return mustGit(exec, args.dir, ["rev-parse", "HEAD"], "\u8BFB\u63D0\u4EA4");
|
|
55180
|
+
}
|
|
55156
55181
|
async function release(exec, args) {
|
|
55157
55182
|
const info = await repoInfo(exec, args.dir);
|
|
55158
55183
|
if (!info) throw new RepoError("\u8FD8\u6CA1\u6709\u4ED3\u5E93\uFF0C\u5148\u70B9\u4E00\u6B21\u300C\u53D1\u5E03\u5230\u4E91\u4E0A\u300D\u5EFA\u4ED3");
|
|
@@ -55389,20 +55414,24 @@ function buildDeployHandlers(deps) {
|
|
|
55389
55414
|
}
|
|
55390
55415
|
secretsCache.delete(personaId2);
|
|
55391
55416
|
}
|
|
55392
|
-
|
|
55417
|
+
let head;
|
|
55418
|
+
try {
|
|
55419
|
+
head = await commitAndPush(deps.exec, { dir, message: `clawd: \u626B\u63CF\u524D\u843D\u5B58 ${new Date(deps.now()).toISOString()}` });
|
|
55420
|
+
} catch (err) {
|
|
55421
|
+
throw toClawdError(err);
|
|
55422
|
+
}
|
|
55423
|
+
runCache.delete(personaId2);
|
|
55393
55424
|
await writeDeployFile(dir, emptyDeployFile());
|
|
55394
55425
|
const startedAt = deps.now();
|
|
55395
|
-
|
|
55426
|
+
const base = { evidence: [], notes: [], scannedAssets: [], startedAt, head };
|
|
55427
|
+
await writeScan(dir, { status: "scanning", ...base });
|
|
55396
55428
|
const started = deps.startScan(personaId2);
|
|
55397
55429
|
if ("sessionId" in started) {
|
|
55398
|
-
await writeScan(dir, { status: "scanning", scanSessionId: started.sessionId,
|
|
55430
|
+
await writeScan(dir, { status: "scanning", scanSessionId: started.sessionId, ...base });
|
|
55399
55431
|
} else {
|
|
55400
55432
|
await writeScan(dir, {
|
|
55401
55433
|
status: "failed",
|
|
55402
|
-
|
|
55403
|
-
notes: [],
|
|
55404
|
-
scannedAssets: [],
|
|
55405
|
-
startedAt,
|
|
55434
|
+
...base,
|
|
55406
55435
|
finishedAt: deps.now(),
|
|
55407
55436
|
error: `\u8D77\u626B\u63CF\u4F1A\u8BDD\u5931\u8D25\uFF1A${started.error}`
|
|
55408
55437
|
});
|
|
@@ -55498,6 +55527,11 @@ function buildDeployHandlers(deps) {
|
|
|
55498
55527
|
const scan = await readScan(dir);
|
|
55499
55528
|
if (scan?.status === "scanning") throw invalid("\u626B\u63CF\u8FD8\u6CA1\u7ED3\u675F");
|
|
55500
55529
|
if (scan?.status !== "done") throw invalid(scan?.status === "failed" ? "\u4E0A\u6B21\u626B\u63CF\u5931\u8D25\u4E86\uFF0C\u5148\u91CD\u65B0\u626B\u63CF" : "\u8FD8\u6CA1\u626B\u63CF\u8FC7\uFF0C\u5148\u626B\u63CF");
|
|
55530
|
+
if (!isScanFresh(scan, repo2)) {
|
|
55531
|
+
throw invalid(
|
|
55532
|
+
repo2.dirty ? "persona \u76EE\u5F55\u6709\u6539\u52A8\u8FD8\u6CA1\u626B\u8FC7\uFF0C\u5148\u91CD\u65B0\u626B\u63CF\u4E00\u6B21\uFF08\u6E05\u5355\u8981\u8DDF\u7740\u6539\u52A8\u8D70\uFF09" : "\u6E05\u5355\u662F\u66F4\u65E9\u90A3\u4E00\u7248\u626B\u51FA\u6765\u7684\uFF0C\u5148\u91CD\u65B0\u626B\u63CF\u4E00\u6B21"
|
|
55533
|
+
);
|
|
55534
|
+
}
|
|
55501
55535
|
const blockers = [];
|
|
55502
55536
|
let present;
|
|
55503
55537
|
try {
|
|
@@ -55518,6 +55552,8 @@ function buildDeployHandlers(deps) {
|
|
|
55518
55552
|
try {
|
|
55519
55553
|
const result = await release(deps.exec, { dir, now: deps.now });
|
|
55520
55554
|
runCache.delete(personaId2);
|
|
55555
|
+
const scanned = await readScan(dir);
|
|
55556
|
+
if (scanned) await writeScan(dir, { ...scanned, head: result.sha });
|
|
55521
55557
|
return { response: { type: "deploy:release", ...result } };
|
|
55522
55558
|
} catch (err) {
|
|
55523
55559
|
throw toClawdError(err);
|
|
@@ -64551,7 +64587,7 @@ function computeMethodAccess(args) {
|
|
|
64551
64587
|
}
|
|
64552
64588
|
|
|
64553
64589
|
// src/version.ts
|
|
64554
|
-
var version = "0.2.
|
|
64590
|
+
var version = "0.2.485".length > 0 ? "0.2.485" : "dev";
|
|
64555
64591
|
|
|
64556
64592
|
// src/cli-probe/probe.ts
|
|
64557
64593
|
var fs70 = __toESM(require("fs"), 1);
|
|
@@ -21350,6 +21350,16 @@ var DeployScanSchema = external_exports.object({
|
|
|
21350
21350
|
notes: external_exports.array(external_exports.string()).default([]),
|
|
21351
21351
|
/** 扫描时被告知的共享资产名单(判「扫描器后来长了新本事」用) */
|
|
21352
21352
|
scannedAssets: external_exports.array(external_exports.string()).default([]),
|
|
21353
|
+
/**
|
|
21354
|
+
* 这次扫描是**对哪个 commit 的断言**。`deploy:start` 在起扫描之前会先把 persona 目录
|
|
21355
|
+
* 提交并推上去,所以这个值一定是仓库里真实存在的一版。
|
|
21356
|
+
*
|
|
21357
|
+
* 有了它,「清单过没过时」才是个可判定的等式(`head === repo.head`),
|
|
21358
|
+
* 而不是从 `dirty` / `ahead` 里猜——那两个字段判不出「清单是好几版之前扫的」。
|
|
21359
|
+
*
|
|
21360
|
+
* 缺席 = 旧版 clawd 扫的记录。**一律当过时**:没有第三种情况,重扫一次就有了。
|
|
21361
|
+
*/
|
|
21362
|
+
head: external_exports.string().min(1).optional(),
|
|
21353
21363
|
startedAt: external_exports.number(),
|
|
21354
21364
|
finishedAt: external_exports.number().optional(),
|
|
21355
21365
|
error: external_exports.string().optional()
|
|
@@ -92,7 +92,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
92
92
|
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
93
93
|
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
94
94
|
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
|
|
95
|
-
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var dw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const fO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},pO={motionBase:!0,motionUnit:!0},mO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},xT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=dw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=vT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=dw(l,["theme"]);let d=u;c&&(d=xT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function _T(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(mT),s=`${dO}-${t||""}`,o=n||pT,[a,l,c]=tD(o,[Xc,e],{salt:s,override:r,getComputedToken:xT,formatToken:vT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:fO,ignore:pO,preserve:mO}});return[o,c,t?l:"",a,i]}const gO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),vO=e=>({[`.${e}`]:Object.assign(Object.assign({},gO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),xO=(e,t)=>{const[n,r]=_T();return ID({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>vO(e))},_O=Object.assign({},al),{useId:hw}=_O,yO=()=>"",bO=typeof hw>"u"?yO:hw;function wO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},qh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:qh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=bO();return ON(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!IL(c,d,!0)}))}var SO=["children"],yT=g.createContext({});function kO(e){var t=e.children,n=Lv(e,SO);return g.createElement(yT.Provider,{value:n},t)}var CO=function(e){zN(n,e);var t=FN(n);function n(){return dl(this,n),t.apply(this,arguments)}return hl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function EO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=r0(function(){return i.current}),o=r0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var hs="none",ud="appear",dd="enter",hd="leave",fw="none",Dr="prepare",ba="start",wa="active",z_="end",bT="prepared";function pw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function NO(e,t){var n={animationend:pw("Animation","AnimationEnd"),transitionend:pw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var TO=NO(Qi(),typeof window<"u"?window:{}),wT={};if(Qi()){var IO=document.createElement("div");wT=IO.style}var fd={};function ST(e){if(fd[e])return fd[e];var t=TO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in wT)return fd[e]=t[s],fd[e]}return""}var kT=ST("animationend"),CT=ST("transitionend"),ET=!!(kT&&CT),mw=kT||"animationend",gw=CT||"transitionend";function vw(e,t){if(!e)return null;if(Tt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const PO=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(gw,e),i.removeEventListener(mw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(gw,e),i.addEventListener(mw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var NT=Qi()?g.useLayoutEffect:g.useEffect;const RO=function(){var e=g.useRef(null);function t(){Av.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Av(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var MO=[Dr,ba,wa,z_],AO=[Dr,bT],TT=!1,jO=!0;function IT(e){return e===wa||e===z_}const LO=function(e,t,n){var r=i0(fw),i=et(r,2),s=i[0],o=i[1],a=RO(),l=et(a,2),c=l[0],u=l[1];function d(){o(Dr,!0)}var f=t?AO:MO;return NT(function(){if(s!==fw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===TT?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function DO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,D=i0(),P=et(D,2),O=P[0],R=P[1],A=EO(hs),M=et(A,2),L=M[0],$=M[1],F=i0(null),B=et(F,2),z=B[0],E=B[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function ne(){return n()}var ie=g.useRef(!1);function K(){$(hs),E(null,!0)}var ge=r0(function(Ke){var lt=L();if(lt!==hs){var Dt=ne();if(!(Ke&&!Ke.deadline&&Ke.target!==Dt)){var Wt=ie.current,Tn;lt===ud&&Wt?Tn=C==null?void 0:C(Dt,Ke):lt===dd&&Wt?Tn=k==null?void 0:k(Dt,Ke):lt===hd&&Wt&&(Tn=N==null?void 0:N(Dt,Ke)),Wt&&Tn!==!1&&K()}}}),Pe=PO(ge),he=et(Pe,1),Ae=he[0],je=function(lt){switch(lt){case ud:return Se(Se(Se({},Dr,f),ba,v),wa,_);case dd:return Se(Se(Se({},Dr,p),ba,w),wa,y);case hd:return Se(Se(Se({},Dr,m),ba,x),wa,S);default:return{}}},Fe=g.useMemo(function(){return je(H)},[H]),xe=LO(H,!e,function(Ke){if(Ke===Dr){var lt=Fe[Dr];return lt?lt(ne()):TT}if(Xe in Fe){var Dt;E(((Dt=Fe[Xe])===null||Dt===void 0?void 0:Dt.call(Fe,ne(),null))||null)}return Xe===wa&&H!==hs&&(Ae(ne()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){ge({deadline:!0})},u))),Xe===bT&&K(),jO}),tt=et(xe,2),Rt=tt[0],Xe=tt[1],at=IT(Xe);ie.current=at;var xn=g.useRef(null);NT(function(){if(!(q.current&&xn.current===t)){R(t);var Ke=q.current;q.current=!0;var lt;!Ke&&t&&a&&(lt=ud),Ke&&t&&s&&(lt=dd),(Ke&&!t&&c||!Ke&&d&&!t&&c)&&(lt=hd);var Dt=je(lt);lt&&(e||Dt[Dr])?($(lt),Rt()):$(hs),xn.current=t}},[t]),g.useEffect(function(){(H===ud&&!a||H===dd&&!s||H===hd&&!c)&&$(hs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var ut=g.useRef(!1);g.useEffect(function(){O&&(ut.current=!0),O!==void 0&&H===hs&&((ut.current||O)&&(T==null||T(O)),ut.current=!0)},[O,H]);var Ct=z;return Fe[Dr]&&Xe===ba&&(Ct=He({transition:"none"},Ct)),[H,Xe,Ct,O??t]}function OO(e){var t=e;Tt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(yT),w=v.motion,x=n(i,w),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:hL(y.current)}catch{return null}}var C=DO(x,a,S,i),k=et(C,4),N=k[0],T=k[1],D=k[2],P=k[3],O=g.useRef(P);P&&(O.current=!0);var R=g.useCallback(function(B){_.current=B,gL(s,B)},[s]),A,M=He(He({},m),{},{visible:a});if(!d)A=null;else if(N===hs)P?A=d(He({},M),R):!c&&O.current&&p?A=d(He(He({},M),{},{className:p}),R):u||!c&&!p?A=d(He(He({},M),{},{style:{display:"none"}}),R):A=null;else{var L;T===Dr?L="prepare":IT(T)?L="active":T===ba&&(L="start");var $=vw(f,"".concat(N,"-").concat(L));A=d(He(He({},M),{},{className:eL(vw(f,N),Se(Se({},$,$&&L),f,typeof f=="string")),style:D}),R)}if(g.isValidElement(A)&&vL(A)){var F=xL(A);F||(A=g.cloneElement(A,{ref:R}))}return g.createElement(CO,{ref:y},A)});return r.displayName="CSSMotion",r}const BO=OO(ET);var s0="add",o0="keep",a0="remove",Rm="removed";function zO(e){var t;return e&&Tt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function l0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(zO)}function $O(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=l0(e),o=l0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:s0})})),r=d),n.push(He(He({},f),{},{status:o0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:a0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:s0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==a0}),n.forEach(function(u){u.key===c&&(u.status=o0)})}),n}var FO=["component","children","onVisibleChanged","onAllRemoved"],HO=["status"],UO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function WO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:BO,n=function(r){zN(s,r);var i=FN(s);function s(){var o;dl(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),Se(Rv(o),"state",{keyEntities:[]}),Se(Rv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Rm})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Rm}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return hl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=Lv(c,FO),m=u||g.Fragment,v={};return UO.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,y=Lv(w,HO),S=_===s0||_===o0;return g.createElement(t,Uh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(k){f==null||f(k,{key:y.key}),k||a.removeKey(y.key)}}),function(C,k){return d(He(He({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=l0(c),f=$O(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===Rm&&p.status===a0)})}}}]),s}(g.Component);return Se(n,"defaultProps",{component:"div"}),n}WO(ET);const xw=g.createContext(!0);function VO(e){const t=g.useContext(xw),{children:n}=e,[,r]=_T(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(xw.Provider,{value:i},g.createElement(kO,{motion:i},n)):n}const qO=()=>null;var KO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const GO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let PT;function YO(){return PT||t0}function XO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const QO=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(PT=t),r&&XO(r)&&sO(YO(),r)},ZO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:N,calendar:T,carousel:D,cascader:P,collapse:O,typography:R,checkbox:A,descriptions:M,divider:L,drawer:$,skeleton:F,steps:B,image:z,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:ge,menu:Pe,pagination:he,input:Ae,textArea:je,empty:Fe,badge:xe,radio:tt,rate:Rt,switch:Xe,transfer:at,avatar:xn,message:ut,tag:Ct,table:Ke,card:lt,tabs:Dt,timeline:Wt,timePicker:Tn,upload:U,notification:J,tree:ye,colorPicker:Ee,datePicker:Oe,rangePicker:Mt,flex:tn,wave:Vt,dropdown:dn,warning:oe,tour:_e,tooltip:it,popover:At,popconfirm:Rr,floatButton:ae,floatButtonGroup:Je,variant:hn,inputNumber:Xs,treeSelect:Nl}=e,Qs=g.useCallback((gt,Kt)=>{const{prefixCls:Qn}=e;if(Kt)return Kt;const X=Qn||x.getPrefixCls("");return gt?`${X}-${gt}`:X},[x.getPrefixCls,e.prefixCls]),is=_||x.iconPrefixCls||gT,Zs=n||x.csp;xO(is,Zs);const Go=wO(y,x.theme,{prefixCls:Qs("")}),Tl={csp:Zs,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Qs,iconPrefixCls:is,theme:Go,segmented:C,statistic:k,spin:N,calendar:T,carousel:D,cascader:P,collapse:O,typography:R,checkbox:A,descriptions:M,divider:L,drawer:$,skeleton:F,steps:B,image:z,input:Ae,textArea:je,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:ge,menu:Pe,pagination:he,empty:Fe,badge:xe,radio:tt,rate:Rt,switch:Xe,transfer:at,avatar:xn,message:ut,tag:Ct,table:Ke,card:lt,tabs:Dt,timeline:Wt,timePicker:Tn,upload:U,notification:J,tree:ye,colorPicker:Ee,datePicker:Oe,rangePicker:Mt,flex:tn,wave:Vt,dropdown:dn,warning:oe,tour:_e,tooltip:it,popover:At,popconfirm:Rr,floatButton:ae,floatButtonGroup:Je,variant:hn,inputNumber:Xs,treeSelect:Nl},ki=Object.assign({},x);Object.keys(Tl).forEach(gt=>{Tl[gt]!==void 0&&(ki[gt]=Tl[gt])}),GO.forEach(gt=>{const Kt=e[gt];Kt&&(ki[gt]=Kt)}),typeof r<"u"&&(ki.button=Object.assign({autoInsertSpace:r},ki.button));const qr=ON(()=>ki,ki,(gt,Kt)=>{const Qn=Object.keys(gt),X=Object.keys(Kt);return Qn.length!==X.length||Qn.some(be=>gt[be]!==Kt[be])}),{layer:Hu}=g.useContext(rp),Yo=g.useMemo(()=>({prefixCls:is,csp:Zs,layer:Hu?"antd":void 0}),[is,Zs,Hu]);let qt=g.createElement(g.Fragment,null,g.createElement(qO,{dropdownMatchSelectWidth:p}),t);const Uu=g.useMemo(()=>{var gt,Kt,Qn,X;return OD(((gt=op.Form)===null||gt===void 0?void 0:gt.defaultValidateMessages)||{},((Qn=(Kt=qr.locale)===null||Kt===void 0?void 0:Kt.Form)===null||Qn===void 0?void 0:Qn.defaultValidateMessages)||{},((X=qr.form)===null||X===void 0?void 0:X.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[qr,o==null?void 0:o.validateMessages]);Object.keys(Uu).length>0&&(qt=g.createElement(zD.Provider,{value:Uu},qt)),a&&(qt=g.createElement(HD,{locale:a,_ANT_MARK__:FD},qt)),qt=g.createElement(AD.Provider,{value:Yo},qt),l&&(qt=g.createElement(aO,{size:l},qt)),qt=g.createElement(VO,null,qt);const Il=g.useMemo(()=>{const gt=Go||{},{algorithm:Kt,token:Qn,components:X,cssVar:be}=gt,ke=KO(gt,["algorithm","token","components","cssVar"]),Qe=Kt&&(!Array.isArray(Kt)||Kt.length>0)?Ov(Kt):pT,hr={};Object.entries(X||{}).forEach(([_3,y3])=>{const Ci=Object.assign({},y3);"algorithm"in Ci&&(Ci.algorithm===!0?Ci.theme=Qe:(Array.isArray(Ci.algorithm)||typeof Ci.algorithm=="function")&&(Ci.theme=Ov(Ci.algorithm)),delete Ci.algorithm),hr[_3]=Ci});const Pl=Object.assign(Object.assign({},Xc),Qn);return Object.assign(Object.assign({},ke),{theme:Qe,token:Pl,components:hr,override:Object.assign({override:Pl},hr),cssVar:be})},[Go]);return y&&(qt=g.createElement(mT.Provider,{value:Il},qt)),qr.warning&&(qt=g.createElement(BD.Provider,{value:qr.warning},qt)),S!==void 0&&(qt=g.createElement(oO,{disabled:S},qt)),g.createElement(ap.Provider,{value:qr},qt)},pl=e=>{const t=g.useContext(ap),n=g.useContext(uT);return g.createElement(ZO,Object.assign({parentContext:t,legacyLocale:n},e))};pl.ConfigContext=ap;pl.SizeContext=Qc;pl.config=QO;pl.useConfig=lO;Object.defineProperty(pl,"SizeContext",{get:()=>Qc});const pr=(e,t)=>new wt(e).setA(t).toRgbString(),Zo=(e,t)=>new wt(e).lighten(t).toHexString(),JO=e=>{const t=qa(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},e6=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:pr(r,.85),colorTextSecondary:pr(r,.65),colorTextTertiary:pr(r,.45),colorTextQuaternary:pr(r,.25),colorFill:pr(r,.18),colorFillSecondary:pr(r,.12),colorFillTertiary:pr(r,.08),colorFillQuaternary:pr(r,.04),colorBgSolid:pr(r,.95),colorBgSolidHover:pr(r,1),colorBgSolidActive:pr(r,.9),colorBgElevated:Zo(n,12),colorBgContainer:Zo(n,8),colorBgLayout:Zo(n,0),colorBgSpotlight:Zo(n,26),colorBgBlur:pr(r,.04),colorBorder:Zo(n,26),colorBorderSecondary:Zo(n,19)}},t6=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=qa(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=fT(e,{generateColorPalettes:JO,generateNeutralColorPalettes:e6});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},_w={defaultSeed:qh.token,defaultAlgorithm:B_,darkAlgorithm:t6};function yw({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(pl,{theme:{algorithm:n.mode==="dark"?_w.darkAlgorithm:_w.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Ge;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Ge||(Ge={}));var bw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bw||(bw={}));const ue=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gs=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},G=Ge.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class qi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof qi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}qi.create=e=>new qi(e);const c0=(e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ge.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ge.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ge.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ge.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ge.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case G.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ge.assertNever(e)}return{message:n}};let n6=c0;function r6(){return n6}const i6=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=r6(),r=i6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===c0?void 0:c0].filter(i=>!!i)});e.common.issues.push(r)}class jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Te;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Te;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Te=Object.freeze({status:"aborted"}),nc=e=>({status:"dirty",value:e}),Ir=e=>({status:"valid",value:e}),ww=e=>e.status==="aborted",Sw=e=>e.status==="dirty",Ka=e=>e.status==="valid",Kh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class fi{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kw=(e,t)=>{if(Ka(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new qi(e.common.issues);return this._error=n,this._error}}};function De(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return gs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new jn,ctx:{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return kw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Ka(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Ka(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Kh(i)?i:Promise.resolve(i));return kw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:G.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new No({schema:this,typeName:Ie.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return zi.create(this,this._def)}nullable(){return To.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ci.create(this)}promise(){return Jh.create(this,this._def)}or(t){return Yh.create([this,t],this._def)}and(t){return Xh.create(this,t,this._def)}transform(t){return new No({...De(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ef({...De(this._def),innerType:this,defaultValue:n,typeName:Ie.ZodDefault})}brand(){return new jT({typeName:Ie.ZodBranded,type:this,...De(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new tf({...De(this._def),innerType:this,catchValue:n,typeName:Ie.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return nf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const s6=/^c[^\s-]{8,}$/i,o6=/^[0-9a-z]+$/,a6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,l6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,c6=/^[a-z0-9_-]{21}$/i,u6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,d6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,f6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mm;const p6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,m6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,g6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,v6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,x6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",y6=new RegExp(`^${RT}$`);function MT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function b6(e){return new RegExp(`^${MT(e)}$`)}function w6(e){let t=`${RT}T${MT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function S6(e,t){return!!((t==="v4"||!t)&&p6.test(e)||(t==="v6"||!t)&&g6.test(e))}function k6(e,t){if(!u6.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function C6(e,t){return!!((t==="v4"||!t)&&m6.test(e)||(t==="v6"||!t)&&v6.test(e))}class Li extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.string,received:s.parsedType}),Te}const r=new jn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")h6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Mm||(Mm=new RegExp(f6,"u")),Mm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")c6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")s6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")o6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?w6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?y6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?b6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?d6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?S6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?k6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?C6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?x6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?_6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:G.invalid_string,message:s.message}),r.dirty()):Ge.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:G.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Li({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Li({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Li.create=e=>new Li({checks:[],typeName:Ie.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...De(e)});function E6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ga extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.number,received:s.parsedType}),Te}let r;const i=new jn;for(const s of this._def.checks)s.kind==="int"?Ge.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?E6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_finite,message:s.message}),i.dirty()):Ge.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ga({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ga({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ge.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ga.create=e=>new Ga({checks:[],typeName:Ie.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...De(e)});class Zc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let r;const i=new jn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Ge.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:G.invalid_type,expected:ue.bigint,received:n.parsedType}),Te}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Zc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Zc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Zc.create=e=>new Zc({checks:[],typeName:Ie.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...De(e)});class u0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.boolean,received:r.parsedType}),Te}return Ir(t.data)}}u0.create=e=>new u0({typeName:Ie.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...De(e)});class Gh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.date,received:s.parsedType}),Te}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_date}),Te}const r=new jn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ge.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Gh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Gh.create=e=>new Gh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ie.ZodDate,...De(e)});class Cw extends Ve{_parse(t){if(this._getType(t)!==ue.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.symbol,received:r.parsedType}),Te}return Ir(t.data)}}Cw.create=e=>new Cw({typeName:Ie.ZodSymbol,...De(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.undefined,received:r.parsedType}),Te}return Ir(t.data)}}d0.create=e=>new d0({typeName:Ie.ZodUndefined,...De(e)});class h0 extends Ve{_parse(t){if(this._getType(t)!==ue.null){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.null,received:r.parsedType}),Te}return Ir(t.data)}}h0.create=e=>new h0({typeName:Ie.ZodNull,...De(e)});class Ew extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Ir(t.data)}}Ew.create=e=>new Ew({typeName:Ie.ZodAny,...De(e)});class f0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ir(t.data)}}f0.create=e=>new f0({typeName:Ie.ZodUnknown,...De(e)});class Bs extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:G.invalid_type,expected:ue.never,received:n.parsedType}),Te}}Bs.create=e=>new Bs({typeName:Ie.ZodNever,...De(e)});class Nw extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.void,received:r.parsedType}),Te}return Ir(t.data)}}Nw.create=e=>new Nw({typeName:Ie.ZodVoid,...De(e)});class ci extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ue.array)return se(n,{code:G.invalid_type,expected:ue.array,received:n.parsedType}),Te;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?G.too_big:G.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:G.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:G.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new fi(n,o,n.path,a)))).then(o=>jn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new fi(n,o,n.path,a)));return jn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ci({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new ci({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new ci({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}ci.create=(e,t)=>new ci({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...De(t)});function aa(e){if(e instanceof zt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=zi.create(aa(r))}return new zt({...e._def,shape:()=>t})}else return e instanceof ci?new ci({...e._def,type:aa(e.element)}):e instanceof zi?zi.create(aa(e.unwrap())):e instanceof To?To.create(aa(e.unwrap())):e instanceof Co?Co.create(e.items.map(t=>aa(t))):e}class zt extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ge.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){const c=this._getOrReturnCtx(t);return se(c,{code:G.invalid_type,expected:ue.object,received:c.parsedType}),Te}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Bs&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new fi(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Bs){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new fi(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>jn.mergeObjectSync(r,c)):jn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(t){return new zt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new zt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ie.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new zt({...this._def,catchall:t})}pick(t){const n={};for(const r of Ge.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Ge.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}deepPartial(){return aa(this)}partial(t){const n={};for(const r of Ge.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new zt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Ge.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof zi;)s=s._def.innerType;n[r]=s}return new zt({...this._def,shape:()=>n})}keyof(){return AT(Ge.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new qi(a.ctx.common.issues));return se(n,{code:G.invalid_union,unionErrors:o}),Te}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new qi(l));return se(n,{code:G.invalid_union,unionErrors:a}),Te}}get options(){return this._def.options}}Yh.create=(e,t)=>new Yh({options:e,typeName:Ie.ZodUnion,...De(t)});const Ii=e=>e instanceof m0?Ii(e.schema):e instanceof No?Ii(e.innerType()):e instanceof Zh?[e.value]:e instanceof Eo?e.options:e instanceof g0?Ge.objectValues(e.enum):e instanceof ef?Ii(e._def.innerType):e instanceof d0?[void 0]:e instanceof h0?[null]:e instanceof zi?[void 0,...Ii(e.unwrap())]:e instanceof To?[null,...Ii(e.unwrap())]:e instanceof jT||e instanceof nf?Ii(e.unwrap()):e instanceof tf?Ii(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return se(n,{code:G.invalid_type,expected:ue.object,received:n.parsedType}),Te;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ii(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ie.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...De(r)})}}function p0(e,t){const n=gs(e),r=gs(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){const i=Ge.objectKeys(t),s=Ge.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=p0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ue.array&&r===ue.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=p0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Xh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(ww(s)||ww(o))return Te;const a=p0(s.value,o.value);return a.valid?((Sw(s)||Sw(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:G.invalid_intersection_types}),Te)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Xh.create=(e,t,n)=>new Xh({left:e,right:t,typeName:Ie.ZodIntersection,...De(n)});class Co extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.array)return se(r,{code:G.invalid_type,expected:ue.array,received:r.parsedType}),Te;if(r.data.length<this._def.items.length)return se(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fi(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>jn.mergeArray(n,o)):jn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Co({...this._def,rest:t})}}Co.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Co({items:e,typeName:Ie.ZodTuple,rest:null,...De(t)})};class Qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:G.invalid_type,expected:ue.object,received:r.parsedType}),Te;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new fi(r,a,r.path,a)),value:o._parse(new fi(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?jn.mergeObjectAsync(n,i):jn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new Qh({keyType:t,valueType:n,typeName:Ie.ZodRecord,...De(r)}):new Qh({keyType:Li.create(),valueType:t,typeName:Ie.ZodRecord,...De(n)})}}class Tw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.map)return se(r,{code:G.invalid_type,expected:ue.map,received:r.parsedType}),Te;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new fi(r,a,r.path,[c,"key"])),value:s._parse(new fi(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Tw.create=(e,t,n)=>new Tw({valueType:t,keyType:e,typeName:Ie.ZodMap,...De(n)});class Jc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.set)return se(r,{code:G.invalid_type,expected:ue.set,received:r.parsedType}),Te;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:G.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:G.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Te;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new fi(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Jc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Jc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Jc.create=(e,t)=>new Jc({valueType:e,minSize:null,maxSize:null,typeName:Ie.ZodSet,...De(t)});class m0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}m0.create=(e,t)=>new m0({getter:e,typeName:Ie.ZodLazy,...De(t)});class Zh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zh.create=(e,t)=>new Zh({value:e,typeName:Ie.ZodLiteral,...De(t)});function AT(e,t){return new Eo({values:e,typeName:Ie.ZodEnum,...De(t)})}class Eo extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Ge.joinValues(r),received:n.parsedType,code:G.invalid_type}),Te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:G.invalid_enum_value,options:r}),Te}return Ir(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Eo.create(t,{...this._def,...n})}exclude(t,n=this._def){return Eo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Eo.create=AT;class g0 extends Ve{_parse(t){const n=Ge.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ue.string&&r.parsedType!==ue.number){const i=Ge.objectValues(n);return se(r,{expected:Ge.joinValues(i),received:r.parsedType,code:G.invalid_type}),Te}if(this._cache||(this._cache=new Set(Ge.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Ge.objectValues(n);return se(r,{received:r.data,code:G.invalid_enum_value,options:i}),Te}return Ir(t.data)}get enum(){return this._def.values}}g0.create=(e,t)=>new g0({values:e,typeName:Ie.ZodNativeEnum,...De(t)});class Jh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return se(n,{code:G.invalid_type,expected:ue.promise,received:n.parsedType}),Te;const r=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Ir(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Jh.create=(e,t)=>new Jh({type:e,typeName:Ie.ZodPromise,...De(t)});class No extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Te;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Te:l.status==="dirty"||n.value==="dirty"?nc(l.value):l});{if(n.value==="aborted")return Te;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Te:a.status==="dirty"||n.value==="dirty"?nc(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Te:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Te:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ka(o))return Te;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ka(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Te);Ge.assertNever(i)}}No.create=(e,t,n)=>new No({schema:e,typeName:Ie.ZodEffects,effect:t,...De(n)});No.createWithPreprocess=(e,t,n)=>new No({schema:t,effect:{type:"preprocess",transform:e},typeName:Ie.ZodEffects,...De(n)});class zi extends Ve{_parse(t){return this._getType(t)===ue.undefined?Ir(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zi.create=(e,t)=>new zi({innerType:e,typeName:Ie.ZodOptional,...De(t)});class To extends Ve{_parse(t){return this._getType(t)===ue.null?Ir(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}To.create=(e,t)=>new To({innerType:e,typeName:Ie.ZodNullable,...De(t)});class ef extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ef.create=(e,t)=>new ef({innerType:e,typeName:Ie.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...De(t)});class tf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}tf.create=(e,t)=>new tf({innerType:e,typeName:Ie.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...De(t)});class Iw extends Ve{_parse(t){if(this._getType(t)!==ue.nan){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.nan,received:r.parsedType}),Te}return{status:"valid",value:t.data}}}Iw.create=e=>new Iw({typeName:Ie.ZodNaN,...De(e)});class jT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Te:s.status==="dirty"?(n.dirty(),nc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Te:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ie.ZodPipeline})}}class nf extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Ka(i)&&(i.value=Object.freeze(i.value)),i);return Kh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}nf.create=(e,t)=>new nf({innerType:e,typeName:Ie.ZodReadonly,...De(t)});var Ie;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ie||(Ie={}));const b=Li.create,W=Ga.create,ve=u0.create,$i=f0.create;Bs.create;const ee=ci.create,I=zt.create;Yh.create;const xi=$_.create;Xh.create;Co.create;const _i=Qh.create,Y=Zh.create,Ce=Eo.create;Jh.create;zi.create;To.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const N6=["owner"],T6=["agent","owner","user-upload"],LT=I({id:b().min(1),relPath:b().min(1),from:Ce(T6),label:b().optional(),size:W().int().nonnegative(),mime:b().min(1),addedAt:W().int().nonnegative(),lastEditedAt:W().int().nonnegative().optional(),stale:ve().optional()});I({sessionId:b().min(1),relPath:b().min(1),ttlSeconds:W().int().positive().nullable().optional(),view:Ce(["raw","md-rendered"]).optional()});I({url:b().min(1),expiresAt:W().int().nonnegative().nullable()});I({sessionId:b().min(1),relPath:b().min(1),label:b().optional(),origin:Y("agent").optional()});I({entry:LT});I({sessionId:b().min(1),relPath:b().min(1)});I({removed:Y(!0)});I({sessionId:b().min(1)});I({entries:ee(LT)});I({attachmentId:b().min(1),url:b().min(1),relPath:b().min(1),sizeBytes:W().int().nonnegative(),mimeType:b().min(1)});const I6=xi("type",[I({type:Y("persona"),id:b().min(1)}).strict(),I({type:Y("chat"),id:b().min(1)}).strict(),I({type:Y("*")}).strict()]),P6=Ce(["read","send","admin"]),H_=I({resource:I6,actions:ee(P6).min(1)}).strict(),R6=I({id:b().min(1),secretHash:b().regex(/^[a-f0-9]{64}$/),displayName:b(),grants:ee(H_),issuedAt:W().int().nonnegative(),expiresAt:W().int().positive().optional(),maxUses:W().int().positive().optional(),usedCount:W().int().nonnegative(),peerOwnerId:b().min(1).optional(),firstUsedByPeerAt:W().int().positive().optional(),peerDisplayName:b().optional()}).strict(),M6=R6.omit({secretHash:!0});I({type:Y("whoami:ok"),owner:I({id:b(),kind:Ce(["owner","guest"]),displayName:b(),ownerId:b(),provider:b()}).strict(),capability:M6,grantedPersonas:ee(I({id:b().min(1),displayName:b()}).strict())}).strict();I({selfUrl:b().min(1)});I({type:Y("contact:handshake:ok"),owner:I({id:b(),ownerId:b(),provider:b(),displayName:b()}),grants:ee(H_)});const A6=I({name:b().min(1),from:b().optional(),version:b().optional(),min:b().optional()}),j6=I({name:b().min(1),env:ee(b().min(1)).min(1)}),L6=I({name:b().min(1)}),DT={clis:ee(A6),secrets:ee(j6),assets:ee(L6)};I(DT);const OT=I({version:Y(1),...DT}).strict(),D6=I({target:b().min(1),reason:b().min(1),file:b().min(1),quote:b().min(1)}),O6=I({version:Y(1),manifest:OT}).strict(),B6=Ce(["scanning","done","failed"]),z6=I({scanSessionId:b().optional(),status:B6,evidence:ee(D6).default([]),notes:ee(b()).default([]),scannedAssets:ee(b()).default([]),startedAt:W(),finishedAt:W().optional(),error:b().optional()}).strict(),$6=I({url:b().min(1),branch:b().min(1),head:b().min(1),dirty:ve(),ahead:W()}).strict(),F6=I({env:b().min(1),setAt:W().optional()}).strict(),H6=["pending","running","done","failed","waiting","skipped"],U6=Ce(H6),W6=["build","smoke","deploy"],V6=Ce(W6),q6=I({key:V6,status:U6,url:b().optional(),jobId:W().optional(),startedAt:W().optional(),completedAt:W().optional()}).strict(),K6=I({runId:W(),headSha:b().min(1),status:Ce(["queued","running","completed"]),htmlUrl:b().min(1),jobs:ee(q6)}).strict();I({personaId:b().min(1),repo:$6.optional(),file:O6.optional(),scan:z6.optional(),secrets:ee(F6).optional(),run:K6.optional(),fileError:b().optional()}).strict();I({sha:b().min(1),actionsUrl:b().min(1)}).strict();I({personaId:b().min(1)}).strict();I({personaId:b().min(1),patch:I({manifest:OT.optional()}).strict()}).strict();I({personaId:b().min(1),name:b().min(1),values:_i(b(),b())}).strict();I({personaId:b().min(1),jobId:W()}).strict();I({personaId:b().min(1),kind:Ce(["cli","secret","asset"]),item:_i(b(),$i()),evidence:I({reason:b().min(1),file:b().min(1),quote:b().min(1)})}).strict();I({personaId:b().min(1),notes:ee(b()).default([])}).strict();I({deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();I({type:Y("contact:setRemoteAccess:ok"),deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();I({type:Y("contact:remote-access-updated"),deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();const G6=I({deviceId:b().min(1),ownerId:b().min(1),provider:b().min(1),displayName:b(),remoteUrl:b().min(1),connectToken:b(),grants:ee(H_),addedAt:W().int().nonnegative(),pinnedAt:W().int().nullable().default(null),remoteAccessAllowed:ve().default(!1),note:b().default("")}).strict(),BT=G6;I({deviceId:b().min(1)}).strict();I({type:Y("contact:remove:ok"),deviceId:b().min(1)}).strict();I({type:Y("contact:list:ok"),contacts:ee(BT)}).strict();I({type:Y("contact:added"),contact:BT}).strict();I({type:Y("contact:removed"),deviceId:b().min(1)}).strict();I({deviceId:b().min(1),pinned:ve()}).strict();I({deviceId:b().min(1),note:b()}).strict();I({type:Y("contact:setNote:ok"),deviceId:b().min(1),note:b()}).strict();I({type:Y("contact:pin:ok"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();I({type:Y("contact:pinned"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();const Y6=I({deviceId:b().min(1),name:b().min(1),url:b().min(1)});I({type:Y("device:list:ok"),devices:ee(Y6)});I({deviceId:b().min(1),url:b().min(1).optional(),name:b().optional()});I({type:Y("device:connect:ok"),deviceId:b(),name:b(),url:b()});const zT=I({ownerId:b().min(1),provider:b().min(1),displayName:b().min(1),avatarUrl:b().optional(),unionId:b().optional()});I({type:Y("auth:login:start:ok"),authUrl:b().min(1),state:b().min(1)});I({type:Y("auth:getIdentity:ok"),identity:zT.nullable(),deviceId:b().min(1),ttcTokenExpiresAt:W().nullable().optional()});I({type:Y("auth:logout:ok")});const $T=b().nullable();I({type:Y("auth:apiKey:get:ok"),apiKey:b().nullable(),createdAt:b().nullable(),gatewayUrl:$T});I({type:Y("auth:apiKey:regenerate:ok"),apiKey:b().min(1),createdAt:b().min(1),gatewayUrl:$T});I({type:Y("auth:login:done"),identity:zT});I({type:Y("auth:login:failed"),reason:b()});const U_=xi("kind",[I({kind:Y("success"),text:b(),brief:b().optional(),filePaths:ee(b()).optional()}),I({kind:Y("failure"),reason:b(),brief:b().optional()})]);I({targetPersona:b().min(1).optional(),dispatchId:b().min(1).optional(),prompt:b(),brief:b().optional(),targetDeviceId:b().min(1).optional(),model:b().min(1).optional(),tool:b().min(1).optional(),sessionLabel:b().min(1).max(60).optional(),meta:_i($i()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});I({dispatchId:b().min(1),outcome:U_});const X6=["running","completed","failed"],W_=Ce(X6),Q6=I({dispatchId:b().min(1),sourceSessionId:b().min(1),sourcePersonaId:b().min(1).optional(),targetPersonaId:b().min(1),workerSessionId:b().min(1).optional(),taskText:b(),taskBrief:b().optional(),round:W().int().positive().optional(),status:W_,outcome:U_.optional(),meta:_i($i()).optional(),createdAt:b().min(1),completedAt:b().min(1).optional(),deliveredAt:b().min(1).optional()});I({sourceSessionId:b().min(1).optional()});I({records:ee(Q6)});I({dispatchId:b().min(1)});I({type:Y("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const Z6=/^[a-z0-9][a-z0-9-]*$/;Ce(["stopped","starting","running","crashed","invalid"]);const J6=new Set(["localhost","127.0.0.1"]);function eB(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&J6.has(t.hostname))}const pd=I({id:b().regex(Z6),name:b().min(1),version:b().min(1),apiVersion:Y("1"),runtime:I({startCommand:b().min(1)}).passthrough().optional(),entry:I({url:b().url().refine(eB,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:G.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:G.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),tB=xi("kind",[I({kind:Y("local"),port:W().int().min(1).max(65535)}),I({kind:Y("hosted"),url:b().url()})]);xi("state",[I({extId:b(),manifest:pd,state:Y("stopped")}),I({extId:b(),manifest:pd,state:Y("starting")}),I({extId:b(),manifest:pd,state:Y("running"),target:tB}),I({extId:b(),manifest:pd,state:Y("crashed")}),I({extId:b(),manifest:$i().nullable(),state:Y("invalid"),invalidReason:b().min(1)})]);I({snapshotHash:b().min(1),version:b().min(1),publishedAt:W()});const nB=xi("kind",[I({kind:Y("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1)})]);xi("kind",[I({kind:Y("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1),snapshotHash:b().min(1)})]);I({extId:b().min(1),name:b().min(1),version:b().min(1),contentHash:b().min(1),publishedAt:W()});const rB=xi("kind",[I({kind:Y("clean")}),I({kind:Y("ready-new-version"),fromVersion:b().min(1),toVersion:b().min(1)}),I({kind:Y("error-same-hash"),version:b().min(1)}),I({kind:Y("error-version-not-bumped"),localVersion:b().min(1),publishedVersion:b().min(1)}),I({kind:Y("error-version-regression"),localVersion:b().min(1),publishedVersion:b().min(1)})]);I({localManifest:I({name:b().min(1),version:b().min(1),contentHash:b().min(1)}),publishState:xi("kind",[I({kind:Y("unpublished")}),I({kind:Y("published"),version:b().min(1),contentHash:b().min(1),publishedAt:W()})]),check:rB});I({extId:b().min(1),newVersion:b().min(1).nullish()});I({extId:b().min(1)});I({extId:b().min(1),snapshotHash:b().min(1)});I({channelRef:nB,snapshotHash:b().min(1),zipBase64:b().min(1)});I({id:b().min(1),peerDeviceId:b().min(1),senderDeviceId:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),readBy:_i(b().min(1),W().int().positive()).default({}),origin:I({kind:Y("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1).optional(),id:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),origin:I({kind:Y("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1),sinceCreatedAt:W().int().nonnegative().optional()}).strict();I({peerDeviceId:b().min(1),upToCreatedAt:W().int().nonnegative()}).strict();I({peerDeviceId:b().min(1).optional(),text:b().min(1)});I({peerDeviceId:b().min(1).optional(),command:b().min(1),timeoutMs:W().int().positive().optional()}).strict();I({type:Y("peerExec:run:ok"),stdout:b(),stderr:b(),exitCode:W().int().nullable(),timedOut:ve(),stdoutTruncated:ve(),stderrTruncated:ve()}).strict();const FT=xi("kind",[I({kind:Y("at"),at:b().min(1)}),I({kind:Y("every"),everyMs:W().int().positive(),anchorMs:W().int().nonnegative().optional()}),I({kind:Y("cron"),expr:b().min(1),tz:b().min(1).optional()})]),bu=b().trim().min(1);I({personaId:bu,name:b().min(1),schedule:FT,prompt:b().min(1),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional()});I({personaId:bu,onlyMine:ve().optional()});I({personaId:bu,shiftId:b().min(1)});const iB=I({name:b().min(1).optional(),schedule:FT.optional(),prompt:b().min(1).optional(),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional(),enabled:ve().optional()});I({personaId:bu,shiftId:b().min(1),patch:iB});I({personaId:bu,shiftId:b().min(1),limit:W().int().positive().optional()});const HT="persona-master",V_=I({personaId:b().min(1),deviceId:b().min(1).optional()}),UT=I({id:b().min(1),name:b().min(1),memberPersonas:ee(V_),memberContactDeviceIds:ee(b().min(1)),createdAt:b().min(1),updatedAt:b().min(1)}),WT=b().trim().min(1);I({name:WT,memberPersonas:ee(V_).default([]),memberContactDeviceIds:ee(b().min(1)).default([])});I({channelId:b().min(1),name:WT.optional(),memberPersonas:ee(V_).optional(),memberContactDeviceIds:ee(b().min(1)).optional()});I({channelId:b().min(1)});I({channels:ee(UT)});I({channel:UT});I({ok:Y(!0),removedTopics:W().int().min(0)});const Ut=b().trim().min(1),q_=["master-confirmed","owner-needed"],K_=["open","resolved"],sB=q_[0];q_[1];K_[0];const oB=K_[1],aB=Ce(q_),lB=Ce(K_),cB=I({id:Ut.optional(),resolves:Ut.optional(),type:aB,status:lB,question:Ut,recommendation:Ut}).superRefine((e,t)=>{e.type===sB&&e.status!==oB&&t.addIssue({code:G.custom,path:["status"],message:"master-confirmed decisions must be resolved"})}),uB=["planning","running","done"],dB=Ce(uB),VT=I({at:b().min(1),actor:b().min(1),action:b().min(1),target:b().optional(),reason:b().min(1),artifacts:ee(Ut).optional(),decision:cB.optional()}),hB=I({rejectCount:W().int().min(0),accepted:ve().default(!1),ordinal:W().int().min(1).optional(),overrideCount:W().int().min(0).optional()}),G_=I({id:b().min(1),channelId:b().min(1),title:b(),masterSessionId:b().min(1),goal:b(),boundaries:b(),acceptanceCriteria:ee(b()),activity:ee(VT),lineMeta:_i(hB),nextLineOrdinal:W().int().min(1).optional(),state:dB,createdAt:b().min(1),updatedAt:b().min(1)}),fB=I({lineId:b().min(1),dispatchId:b().min(1),workerSessionId:b().optional(),assignee:b().min(1),focus:b(),status:W_,acceptance:ee(b()),rejectCount:W().int().min(0),accepted:ve(),ordinal:W().int().min(1).nullable()});I({channelId:b().min(1)});I({topicId:b().min(1).optional(),sessionId:b().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});I({channelId:b().min(1),title:Ut.optional()});I({topicId:b().min(1),title:Ut.optional(),goal:Ut,boundaries:b(),acceptanceCriteria:ee(Ut).min(1)});I({topicId:b().min(1),action:Ut,target:Ut.optional(),reason:Ut,artifacts:ee(Ut).optional(),decision:VT.shape.decision});I({topicId:b().min(1),lineId:Ut,reason:Ut});I({topicId:b().min(1),lineId:Ut,reason:Ut,artifacts:ee(Ut).optional(),watcherVerdict:Ce(["pass","fail"]),overrideReason:Ut.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});I({topicId:b().min(1),state:Ce(["done"])});I({topicId:b().min(1),title:Ut});I({topicId:b().min(1)});const pB=G_.extend({lineCount:W().int().min(0)});I({topics:ee(pB)});I({topic:G_,lines:ee(fB)});I({topicId:b().min(1),masterSessionId:b().min(1)});I({rejectCount:W().int().min(1),needsOwnerAttention:ve()});I({acceptedLines:W().int().min(1),totalLines:W().int().min(1),allAccepted:ve(),overrides:W().int().min(0),needsOwnerAttention:ve()});I({topic:G_});I({ok:Y(!0),removedMasterSessionId:b().min(1).nullable(),removedWorkerSessionIds:ee(b().min(1))});const mB=["ask","allow","deny"],qT=Ce(mB),gB=I({id:b().min(1),desc:b().min(1),action:qT});I({rules:ee(gB)});I({ruleId:b().min(1)});I({action:qT,desc:b(),source:b().min(1)});const vB=["created","review-requested"],KT=/^[A-Za-z0-9._-]+$/,ml=b().min(1).regex(KT),gl=b().min(1).regex(KT),wu=W().int().positive();I({role:Ce(vB)});I({owner:ml,repo:gl,number:wu});I({owner:ml,repo:gl,number:wu,expectedHeadSha:b().min(1)});I({owner:ml,repo:gl,number:wu,body:b().min(1)});I({owner:ml,repo:gl,number:wu,ready:ve()});I({owner:ml,repo:gl});I({owner:ml,repo:gl,number:wu,reviewers:ee(b().min(1)).min(1)});I({personaId:b().min(1)});I({personaId:b().min(1)});const xB=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],_B=Ce(xB);I({personaId:b().min(1),appId:b().min(1),appSecret:b().min(1),botName:b().min(1).optional()});const yB=I({chatId:b().min(1),chatName:b().optional(),lastActiveAt:W().int().optional()}),bB=I({state:Ce(["unbound","provisioning","bound","broken"]),appId:b().optional(),botName:b().optional(),brokenReason:b().optional(),qrUrl:b().optional(),errorReason:_B.optional(),groups:ee(yB),needsUpgrade:ve().optional(),upgradeQrUrl:b().optional()});bB.extend({personaId:b().min(1)});I({});I({onboardingCompletedAt:W()});I({});I({tools:ee(I({id:Ce(["claude","codex"]),available:ve(),version:b().optional(),path:b().optional()}))});I({});const wB=I({tool:Ce(["claude","codex"]),cwd:b(),toolSessionId:b(),label:b().optional(),createdAt:b(),updatedAt:b(),turns:W()});I({candidates:ee(wB)});I({});I({registered:ve()});const SB=I({personaId:b(),label:b(),model:b().optional(),effort:b().optional(),public:ve(),iconKey:b().optional(),tool:b().optional(),createdAt:W(),updatedAt:W()}).strict(),kB=I({name:b().min(1),description:b().optional()}),CB=I({id:b().min(1)}),GT=I({writableRoots:ee(b()).optional(),denyRead:ee(b()).optional(),network:ve().optional()}).strict(),EB=I({permissions:I({defaultMode:b().optional(),allow:ee(b()).optional(),deny:ee(b()).optional()}).optional(),sandbox:I({enabled:ve().optional(),autoAllowBashIfSandboxed:ve().optional(),allowUnsandboxedCommands:ve().optional(),excludedCommands:ee(b()).optional(),filesystem:I({denyRead:ee(b()).optional(),allowRead:ee(b()).optional(),denyWrite:ee(b()).optional(),allowWrite:ee(b()).optional()}).optional(),network:I({allowedDomains:ee(b()).optional(),allowLocalBinding:ve().optional()}).optional()}).optional()});SB.extend({personality:b().optional(),personalityLocal:b().optional(),personalityManaged:ve().optional(),skills:ee(kB).optional(),plugins:ee(CB).optional(),sandboxSettings:EB.nullable().optional(),codexSandbox:GT.nullable().optional()});I({slug:b().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:b().min(1),personality:b(),model:b().optional(),effort:b().optional(),tool:b().optional(),public:ve().optional(),iconKey:b().optional()}).strict();I({personaId:b().min(1)});I({personaId:b().min(1),patch:I({label:b().min(1).optional(),model:b().optional(),effort:b().optional(),tool:b().optional(),personality:b().optional(),personalityLocal:b().optional(),public:ve().optional(),iconKey:b().nullable().optional(),codexSandbox:GT.optional()}).strict()}).strict();const YT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],XT=["idle","running","running-idle","stopped","error","observing"],NB=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function lp(e){return e==="dispatch-task"||e==="dispatch-result"}const TB=["builtin","global","project","plugin"],IB=["builtin","global","project","policy","plugin"],QT=Ce(["owner","guest"]);I({id:b().min(1),kind:QT,displayName:b(),feishuUnionId:b().optional()}).strict();const PB=I({did:b().min(1),displayName:b(),feishuUnionId:b().optional(),principal:QT}).strict(),RB=Ce(XT),MB=I({inputTokens:W().int().nonnegative(),outputTokens:W().int().nonnegative(),cacheReadTokens:W().int().nonnegative().optional(),cacheCreateTokens:W().int().nonnegative().optional()}),ZT={gitBranch:b().optional(),resolvedModel:b().optional(),resolvedEffort:b().optional(),contextUsage:MB.optional(),contextWindowSize:W().int().positive().optional(),aiLabel:b().optional()},AB=I(ZT),JT=I({value:b(),label:b(),description:b().optional()}),jB=I({id:b().min(1),label:b().min(1),description:b().optional(),contextWindowSize:W().int().positive(),default:ve().optional(),efforts:ee(JT).optional(),defaultEffort:b().optional()}),LB=I({id:b().min(1),label:b().min(1),description:b().optional()}),DB=I({name:b().min(1),type:Ce(["string","select","toggle"]),label:b().min(1),description:b().optional(),options:ee(JT).optional(),default:$i().optional(),scope:Ce(["core","tool-specific"])});I({tool:b().min(1)});const OB=I({rewind:ve(),subagents:ve(),tui:ve(),observe:ve(),fileSharing:ve(),fork:ve()});I({tool:b().min(1),toolSessionIdLabel:b().optional(),models:ee(jB),permissionModes:ee(LB),configSchema:ee(DB),features:OB});const BB=I({tool:b().min(1),pattern:b().min(1),createdAt:b().min(1).optional()});I({sessionId:b().min(1),cwd:b().min(1),tool:Y("claude").or(b().min(1)).default("claude"),toolSessionId:b().optional(),label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),...ZT,aiLabelGeneratedAt:b().optional(),permissionRules:ee(BB).optional(),pinnedAt:W().int().nonnegative().nullable().optional(),archivedAt:W().int().nonnegative().nullable().optional(),pinSortOrder:W().int().nullable().optional(),unreadAt:b().min(1).nullable().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:ve().optional(),deployId:b().min(1).optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional(),appBuilderProject:b().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:b().min(1).optional(),creatorPrincipalId:b().min(1).optional(),creatorDisplayName:b().min(1).optional(),creatorFeishuUnionId:b().min(1).optional(),originOwnerPrincipalId:b().min(1).optional(),originOwnerPersonaId:b().min(1).optional(),dispatchedFromSessionId:b().min(1).optional(),shiftFiredFromSessionId:b().min(1).optional(),larkChatId:b().min(1).optional(),larkChatName:b().min(1).optional(),larkChatType:Ce(["p2p","group"]).optional(),createdAt:b().min(1),updatedAt:b().min(1)});const Fn={seq:W().int().nonnegative().optional(),ts:b().optional(),uuid:b().optional()},zB=Ce(NB),$B=I({readCount:W().int().nonnegative().optional(),searchCount:W().int().nonnegative().optional(),bashCount:W().int().nonnegative().optional(),editFileCount:W().int().nonnegative().optional(),linesAdded:W().int().nonnegative().optional(),linesRemoved:W().int().nonnegative().optional(),otherToolCount:W().int().nonnegative().optional()}),FB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),HB=I({agentId:b().optional(),agentType:b().optional(),status:b().optional(),prompt:b().optional(),filePath:b().optional(),structuredPatch:ee(FB).optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional(),toolStats:$B.optional()}).optional()}),UB=I({path:b(),content:b(),mtimeMs:W().optional()}),WB=I({label:b().min(1),description:b().optional()}),eI=I({question:b().min(1),multiSelect:ve(),options:ee(WB).min(1)}),VB=["completed","interrupted"];xi("kind",[I({...Fn,kind:Y("session_init"),toolSessionId:b().optional()}),I({...Fn,kind:Y("thinking"),text:b(),partialId:b().optional()}),I({...Fn,kind:Y("text"),text:b(),partialId:b().optional()}),I({...Fn,kind:Y("user_text"),text:b(),meta:zB.optional(),taskId:b().optional(),parentToolUseId:b().optional(),sender:PB.optional()}),I({...Fn,kind:Y("tool_call"),toolUseId:b(),tool:b(),toolKind:b().optional(),input:$i()}),I({...Fn,kind:Y("tool_result"),toolUseId:b(),output:$i().optional(),error:b().optional(),toolResultExtra:HB.optional(),sourceToolAssistantUUID:b().optional(),askQuestionAnswers:_i(b(),b()).optional()}),I({...Fn,kind:Y("attachment_memories"),memories:ee(UB)}),I({...Fn,kind:Y("permission_request"),requestId:b(),tool:b(),input:$i(),toolUseId:b().optional()}),I({...Fn,kind:Y("ask_user_question"),toolUseId:b(),questions:ee(eI)}),I({...Fn,kind:Y("turn_end"),durationMs:W().int().nonnegative().optional(),reason:Ce(VB).optional()}),I({...Fn,kind:Y("subagent_progress"),toolUseId:b(),agentId:b(),status:Ce(["started","running","completed","failed"]),description:b().optional(),lastToolName:b().optional(),prompt:b().optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional()}).optional()}),I({...Fn,kind:Y("error"),message:b()}),I({...Fn,kind:Y("meta_update"),patch:AB}),I({...Fn,kind:Y("meta-text"),text:b(),metaSource:Ce(["cc","owner"]).optional()})]);I({cwd:b().min(1).optional(),tool:b().optional(),label:b().optional(),aiLabel:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:ve().optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});I({path:b().min(1),name:b().min(1),createdAt:b().datetime(),pinnedAt:W().optional()});I({path:b().min(1),pinnedAt:W().nullable()});I({path:b().min(1)});I({path:b().min(1).optional(),name:b().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});I({cwd:b().min(1),tool:b().min(1),toolSessionId:b().min(1),label:b().optional(),aiLabel:b().optional(),iconKey:b().optional(),createdAt:b().datetime(),updatedAt:b().datetime(),ownerPersonaId:b().min(1).optional()});I({originOnly:ve().optional(),ownerPersonaId:b().min(1).optional(),limit:W().int().positive().optional(),offset:W().int().nonnegative().optional()});I({sessionId:b().min(1)});I({sessionId:b().min(1),patch:I({label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),cwd:b().optional(),iconKey:b().optional(),ephemeral:Y(!1).optional()})});I({id:b().min(1),text:b(),queuedAt:W(),senderDisplayName:b().optional()});I({sessionId:b().min(1),text:b(),queueWhileRunning:ve().optional()});I({sessionId:b().min(1),id:b().min(1).optional()});I({sessionId:b().min(1),userMessageId:b().min(1),dryRun:ve().optional()});I({canRewind:ve(),error:b().optional(),filesChanged:ee(b()).optional(),insertions:W().int().nonnegative().optional(),deletions:W().int().nonnegative().optional()});I({sessionId:b().min(1),userMessageId:b().min(1)});const qB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),KB=I({filePath:b().min(1),hunks:ee(qB),insertions:W().int().nonnegative(),deletions:W().int().nonnegative(),status:Ce(["modified","added","deleted"]).optional()});I({canRewind:ve(),error:b().optional(),files:ee(KB),totalInsertions:W().int().nonnegative(),totalDeletions:W().int().nonnegative()});I({userMessageIds:ee(b())});I({sessionId:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),messageUuid:b().min(1),targetCwd:b().min(1).optional()});I({forkedToolSessionId:b().min(1),forkedFilePath:b().min(1)});I({sessionId:b().min(1),toolSessionId:b().min(1),jsonlPath:b().optional()});I({sessionId:b().min(1),afterSeq:W().int().min(-1)});I({sessionId:b().min(1),permissionRequestId:b().min(1),allow:ve(),permanent:ve().optional(),pattern:b().optional()});I({projectPath:b().min(1)});I({sessionId:b().min(1),limit:W().int().positive().max(5e3).optional(),offset:W().int().nonnegative().optional(),slim:ve().optional()});I({cwd:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),subagentId:b().min(1)});I({cwd:b().min(1).optional(),path:b().optional(),showHidden:ve().optional()});I({cwd:b().min(1),path:b().min(1)});I({cwd:b().min(1),tool:b().optional()});I({name:b().min(1),source:Ce(TB),path:b().optional(),description:b().optional(),plugin:b().optional()});const GB=I({name:b().min(1),source:Ce(IB),path:b().optional(),description:b().optional(),whenToUse:b().optional(),plugin:b().optional()});I({cwd:b().min(1),tool:b().optional()});I({agents:ee(GB)});I({sessionId:b().optional()});I({sessionId:b().min(1).optional()});I({sessionId:b().min(1),pinned:ve()});I({sessionId:b().min(1),archived:ve()});I({query:b().min(1),sessionIds:ee(b().min(1)),limit:W().int().positive().max(50).optional()});const YB=I({sessionId:b().min(1),snippet:b()});I({type:Y("session:searchContent"),matches:ee(YB)});I({type:Y("peerSession:upsert:ok")});I({sessionId:b().min(1)});I({type:Y("peerSession:remove:ok")});I({orderedIds:ee(b().min(1)).min(1)});I({cwd:b().min(1)});I({isGitRoot:ve(),gitRoot:b().nullable()});I({cwd:b().min(1)});I({branch:b().nullable()});I({cwd:b().min(1)});I({branches:ee(b()),head:b().nullable()});const XB=I({cwd:b().min(1),updatedAt:b().min(1)});I({dirs:ee(XB)});I({type:Y("session:question"),sessionId:b().min(1),toolUseId:b().min(1),requestId:b().min(1),questions:ee(eI).min(1)});I({type:Y("session:question:cleared"),sessionId:b().min(1),toolUseId:b().min(1),answers:_i(b(),b()).optional()});I({sessionId:b().min(1),toolUseId:b().min(1),answers:_i(b(),b())});I({ok:Y(!0)});I({sessionId:b().min(1),toolUseId:b().min(1)});I({ok:Y(!0)});const tI=I({name:b().min(1),version:b().min(1),instanceId:b().min(1),deviceLabel:b().transform(e=>e.trim().slice(0,64)).optional()});I({type:Y("auth"),token:b().min(1),scheme:Y("bearer").optional(),clientInfo:tI.optional()});I({type:Y("auth:ok"),version:b().min(1).optional(),protocolVersion:W().int().nonnegative().optional()});const QB=I({clientId:b().min(1),connectedAt:W().int().nonnegative(),self:ve(),clientInfo:tI.optional()});I({type:Y("device:connections:ok"),connections:ee(QB)});I({type:Y("tunnel:ready"),url:b().min(1),subdomain:b().min(1)});I({type:Y("tunnel:exited"),code:W().int().nullable(),subdomain:b().nullable(),url:b().nullable()});I({type:Y("tunnel:unavailable"),reason:b().min(1),failedAt:b().min(1)});const ZB=I({sessionId:b().min(1),status:RB,freshSpawn:ve(),pendingPermissionRequestIds:ee(b().min(1)),pendingQuestionToolUseIds:ee(b().min(1))});I({type:Y("info"),version:b(),protocolVersion:W(),hostname:b(),os:b(),tools:ee(I({id:b(),available:ve()})),runningSessions:ee(ZB),tokenRole:Ce(N6).optional(),isLoopback:ve().optional(),httpBaseUrl:b().optional(),httpToken:b().optional(),daemonSource:Ce(["ota","packaged"]).optional(),globalCliVersion:b().nullable().optional()});const JB=6173,ez=6272,vl=/^[a-z][a-z0-9-]{0,39}$/,Su=I({name:b().regex(vl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:W().int().min(JB).max(ez),createdAt:b().datetime(),devCommand:b().min(1),prodUrl:b().url().optional(),readyPattern:b().optional(),publishJob:I({jobId:b().min(1),stage:Ce(["build","deploy","verify"]),startedAt:W().int().nonnegative()}).optional()}),tz=["install-pending","installing","starting-dev-server","running","stopped","failed"],nI=Ce(tz),Y_=Su.extend({isRunning:ve(),boundSessionId:b().nullable(),stage:nI.optional(),stageReason:b().optional(),publishJob:I({jobId:b().min(1),stage:Ce(["build","deploy","verify"]),startedAt:W().int().nonnegative(),status:Ce(["in-flight","interrupted"])}).optional()});I({}).strict();I({projects:ee(Y_)}).strict();I({sessionId:b().min(1)}).strict();I({project:Y_.nullable()}).strict();I({sessionId:b().min(1),name:b().min(1)}).strict();I({project:Su}).strict();I({name:b()}).strict();I({}).strict();I({name:b(),newPort:W().int()}).strict();I({project:Su}).strict();I({name:b().regex(vl),url:b().url()}).strict();I({project:Su}).strict();I({sessionId:b().min(1),force:ve().optional()}).strict();I({project:Su}).strict();const nz=["installing","failed"];I({sessionId:b().min(1),stage:Ce(nz),reason:b().optional()}).strict();I({ok:Y(!0)}).strict();I({sessionId:b().min(1)}).strict();I({ok:Y(!0)}).strict();I({type:Y("appBuilder:project-updated"),project:Y_,stage:nI,stageReason:b().optional()}).strict();I({name:b().regex(vl)});I({jobId:b().min(1),status:Ce(["started","already-publishing"])}).strict();I({name:b().regex(vl)});I({ok:Y(!0)}).strict();I({type:Y("appBuilder:publish-progress"),name:b().regex(vl),jobId:b().min(1),stage:Ce(["build","deploy","verify"]),status:Ce(["started","completed"])}).strict();I({type:Y("appBuilder:publish-failed"),name:b().regex(vl),jobId:b().min(1),stage:Ce(["build","deploy","verify","unknown"]),errorSummary:b()}).strict();I({});I({method:b().min(1).optional()});const rz=["allowed","conditional","denied"],iz=Ce(rz),sz=I({name:b().min(1),status:iz,description:b().min(1),args:ee(I({name:b(),required:ve()})).nullable(),argsSchema:_i($i()).optional(),reason:b().optional()});I({type:Y("meta:methods"),methods:ee(sz)});const Pw=1,oz=["daemon","main","renderer"],az=Ce(oz),lz=["debug","info","warn","error"],cz=Ce(lz);I({ts:W().int(),source:az,level:cz,msg:b(),ownerPrincipalId:b(),deviceId:b(),appVersion:b(),daemonVersion:b().optional(),os:b(),meta_json:b().optional(),sessionId:b().optional()});I({v:Y(1),visitorId:b().min(1),displayName:b(),provider:b(),iat:W(),exp:W()});const uz=I({visitorId:b(),displayName:b(),avatarUrl:b().optional(),provider:b(),firstSeen:W(),lastSeen:W()});I({visitors:ee(uz)});const dz=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,rI=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,hz="clawd-dispatch-task",fz="clawd-dispatch-result",Rw=120;function pz(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?hz:fz,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:mz(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function mz(e,t,n){var c;const r=wz(t),i=v0(bz(Am(n,"detail")??n)),s=(c=Am(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?v0(s):gz(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:yz(Am(n,"files"))}}function gz(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Rw?`${n.slice(0,Rw)}…`:n}const vz="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",xz=new RegExp(`<\\\\(\\\\*)(/?)(${vz})\\b`,"g");function _z(e){return v0(e)}function v0(e){return e.replace(xz,"<$1$2$3")}function Am(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function yz(e){return e?e.split(`
|
|
95
|
+
`,boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),r)}var dw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const fO={lineHeight:!0,lineHeightSM:!0,lineHeightLG:!0,lineHeightHeading1:!0,lineHeightHeading2:!0,lineHeightHeading3:!0,lineHeightHeading4:!0,lineHeightHeading5:!0,opacityLoading:!0,fontWeightStrong:!0,zIndexPopupBase:!0,zIndexBase:!0,opacityImage:!0},pO={motionBase:!0,motionUnit:!0},mO={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},xT=(e,t,n)=>{const r=n.getDerivativeToken(e),{override:i}=t,s=dw(t,["override"]);let o=Object.assign(Object.assign({},r),{override:i});return o=vT(o),s&&Object.entries(s).forEach(([a,l])=>{const{theme:c}=l,u=dw(l,["theme"]);let d=u;c&&(d=xT(Object.assign(Object.assign({},o),u),{override:u},c)),o[a]=d}),o};function _T(){const{token:e,hashed:t,theme:n,override:r,cssVar:i}=Ze.useContext(mT),s=`${dO}-${t||""}`,o=n||pT,[a,l,c]=tD(o,[Xc,e],{salt:s,override:r,getComputedToken:xT,formatToken:vT,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:fO,ignore:pO,preserve:mO}});return[o,c,t?l:"",a,i]}const gO=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),vO=e=>({[`.${e}`]:Object.assign(Object.assign({},gO()),{[`.${e} .${e}-icon`]:{display:"block"}})}),xO=(e,t)=>{const[n,r]=_T();return ID({token:r,hashId:"",path:["ant-design-icons",e],nonce:()=>t==null?void 0:t.nonce,layer:{name:"antd"}},()=>vO(e))},_O=Object.assign({},al),{useId:hw}=_O,yO=()=>"",bO=typeof hw>"u"?yO:hw;function wO(e,t,n){var r;const i=e||{},s=i.inherit===!1||!t?Object.assign(Object.assign({},qh),{hashed:(r=t==null?void 0:t.hashed)!==null&&r!==void 0?r:qh.hashed,cssVar:t==null?void 0:t.cssVar}):t,o=bO();return ON(()=>{var a,l;if(!e)return t;const c=Object.assign({},s.components);Object.keys(e.components||{}).forEach(f=>{c[f]=Object.assign(Object.assign({},c[f]),e.components[f])});const u=`css-var-${o.replace(/:/g,"")}`,d=((a=i.cssVar)!==null&&a!==void 0?a:s.cssVar)&&Object.assign(Object.assign(Object.assign({prefix:n==null?void 0:n.prefixCls},typeof s.cssVar=="object"?s.cssVar:{}),typeof i.cssVar=="object"?i.cssVar:{}),{key:typeof i.cssVar=="object"&&((l=i.cssVar)===null||l===void 0?void 0:l.key)||u});return Object.assign(Object.assign(Object.assign({},s),i),{token:Object.assign(Object.assign({},s.token),i.token),components:c,cssVar:d})},[i,s],(a,l)=>a.some((c,u)=>{const d=l[u];return!IL(c,d,!0)}))}var SO=["children"],yT=g.createContext({});function kO(e){var t=e.children,n=Lv(e,SO);return g.createElement(yT.Provider,{value:n},t)}var CO=function(e){zN(n,e);var t=FN(n);function n(){return dl(this,n),t.apply(this,arguments)}return hl(n,[{key:"render",value:function(){return this.props.children}}]),n}(g.Component);function EO(e){var t=g.useReducer(function(a){return a+1},0),n=et(t,2),r=n[1],i=g.useRef(e),s=r0(function(){return i.current}),o=r0(function(a){i.current=typeof a=="function"?a(i.current):a,r()});return[s,o]}var hs="none",ud="appear",dd="enter",hd="leave",fw="none",Dr="prepare",ba="start",wa="active",z_="end",bT="prepared";function pw(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit".concat(e)]="webkit".concat(t),n["Moz".concat(e)]="moz".concat(t),n["ms".concat(e)]="MS".concat(t),n["O".concat(e)]="o".concat(t.toLowerCase()),n}function NO(e,t){var n={animationend:pw("Animation","AnimationEnd"),transitionend:pw("Transition","TransitionEnd")};return e&&("AnimationEvent"in t||delete n.animationend.animation,"TransitionEvent"in t||delete n.transitionend.transition),n}var TO=NO(Qi(),typeof window<"u"?window:{}),wT={};if(Qi()){var IO=document.createElement("div");wT=IO.style}var fd={};function ST(e){if(fd[e])return fd[e];var t=TO[e];if(t)for(var n=Object.keys(t),r=n.length,i=0;i<r;i+=1){var s=n[i];if(Object.prototype.hasOwnProperty.call(t,s)&&s in wT)return fd[e]=t[s],fd[e]}return""}var kT=ST("animationend"),CT=ST("transitionend"),ET=!!(kT&&CT),mw=kT||"animationend",gw=CT||"transitionend";function vw(e,t){if(!e)return null;if(Tt(e)==="object"){var n=t.replace(/-\w/g,function(r){return r[1].toUpperCase()});return e[n]}return"".concat(e,"-").concat(t)}const PO=function(e){var t=g.useRef();function n(i){i&&(i.removeEventListener(gw,e),i.removeEventListener(mw,e))}function r(i){t.current&&t.current!==i&&n(t.current),i&&i!==t.current&&(i.addEventListener(gw,e),i.addEventListener(mw,e),t.current=i)}return g.useEffect(function(){return function(){n(t.current)}},[]),[r,n]};var NT=Qi()?g.useLayoutEffect:g.useEffect;const RO=function(){var e=g.useRef(null);function t(){Av.cancel(e.current)}function n(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;t();var s=Av(function(){i<=1?r({isCanceled:function(){return s!==e.current}}):n(r,i-1)});e.current=s}return g.useEffect(function(){return function(){t()}},[]),[n,t]};var MO=[Dr,ba,wa,z_],AO=[Dr,bT],TT=!1,jO=!0;function IT(e){return e===wa||e===z_}const LO=function(e,t,n){var r=i0(fw),i=et(r,2),s=i[0],o=i[1],a=RO(),l=et(a,2),c=l[0],u=l[1];function d(){o(Dr,!0)}var f=t?AO:MO;return NT(function(){if(s!==fw&&s!==z_){var p=f.indexOf(s),m=f[p+1],v=n(s);v===TT?o(m,!0):m&&c(function(w){function x(){w.isCanceled()||o(m,!0)}v===!0?x():Promise.resolve(v).then(x)})}},[e,s]),g.useEffect(function(){return function(){u()}},[]),[d,s]};function DO(e,t,n,r){var i=r.motionEnter,s=i===void 0?!0:i,o=r.motionAppear,a=o===void 0?!0:o,l=r.motionLeave,c=l===void 0?!0:l,u=r.motionDeadline,d=r.motionLeaveImmediately,f=r.onAppearPrepare,p=r.onEnterPrepare,m=r.onLeavePrepare,v=r.onAppearStart,w=r.onEnterStart,x=r.onLeaveStart,_=r.onAppearActive,y=r.onEnterActive,S=r.onLeaveActive,C=r.onAppearEnd,k=r.onEnterEnd,N=r.onLeaveEnd,T=r.onVisibleChanged,D=i0(),P=et(D,2),O=P[0],R=P[1],A=EO(hs),M=et(A,2),L=M[0],$=M[1],F=i0(null),B=et(F,2),z=B[0],E=B[1],H=L(),q=g.useRef(!1),j=g.useRef(null);function ne(){return n()}var ie=g.useRef(!1);function K(){$(hs),E(null,!0)}var ge=r0(function(Ke){var lt=L();if(lt!==hs){var Dt=ne();if(!(Ke&&!Ke.deadline&&Ke.target!==Dt)){var Wt=ie.current,Tn;lt===ud&&Wt?Tn=C==null?void 0:C(Dt,Ke):lt===dd&&Wt?Tn=k==null?void 0:k(Dt,Ke):lt===hd&&Wt&&(Tn=N==null?void 0:N(Dt,Ke)),Wt&&Tn!==!1&&K()}}}),Pe=PO(ge),he=et(Pe,1),Ae=he[0],je=function(lt){switch(lt){case ud:return Se(Se(Se({},Dr,f),ba,v),wa,_);case dd:return Se(Se(Se({},Dr,p),ba,w),wa,y);case hd:return Se(Se(Se({},Dr,m),ba,x),wa,S);default:return{}}},Fe=g.useMemo(function(){return je(H)},[H]),xe=LO(H,!e,function(Ke){if(Ke===Dr){var lt=Fe[Dr];return lt?lt(ne()):TT}if(Xe in Fe){var Dt;E(((Dt=Fe[Xe])===null||Dt===void 0?void 0:Dt.call(Fe,ne(),null))||null)}return Xe===wa&&H!==hs&&(Ae(ne()),u>0&&(clearTimeout(j.current),j.current=setTimeout(function(){ge({deadline:!0})},u))),Xe===bT&&K(),jO}),tt=et(xe,2),Rt=tt[0],Xe=tt[1],at=IT(Xe);ie.current=at;var xn=g.useRef(null);NT(function(){if(!(q.current&&xn.current===t)){R(t);var Ke=q.current;q.current=!0;var lt;!Ke&&t&&a&&(lt=ud),Ke&&t&&s&&(lt=dd),(Ke&&!t&&c||!Ke&&d&&!t&&c)&&(lt=hd);var Dt=je(lt);lt&&(e||Dt[Dr])?($(lt),Rt()):$(hs),xn.current=t}},[t]),g.useEffect(function(){(H===ud&&!a||H===dd&&!s||H===hd&&!c)&&$(hs)},[a,s,c]),g.useEffect(function(){return function(){q.current=!1,clearTimeout(j.current)}},[]);var ut=g.useRef(!1);g.useEffect(function(){O&&(ut.current=!0),O!==void 0&&H===hs&&((ut.current||O)&&(T==null||T(O)),ut.current=!0)},[O,H]);var Ct=z;return Fe[Dr]&&Xe===ba&&(Ct=He({transition:"none"},Ct)),[H,Xe,Ct,O??t]}function OO(e){var t=e;Tt(e)==="object"&&(t=e.transitionSupport);function n(i,s){return!!(i.motionName&&t&&s!==!1)}var r=g.forwardRef(function(i,s){var o=i.visible,a=o===void 0?!0:o,l=i.removeOnLeave,c=l===void 0?!0:l,u=i.forceRender,d=i.children,f=i.motionName,p=i.leavedClassName,m=i.eventProps,v=g.useContext(yT),w=v.motion,x=n(i,w),_=g.useRef(),y=g.useRef();function S(){try{return _.current instanceof HTMLElement?_.current:hL(y.current)}catch{return null}}var C=DO(x,a,S,i),k=et(C,4),N=k[0],T=k[1],D=k[2],P=k[3],O=g.useRef(P);P&&(O.current=!0);var R=g.useCallback(function(B){_.current=B,gL(s,B)},[s]),A,M=He(He({},m),{},{visible:a});if(!d)A=null;else if(N===hs)P?A=d(He({},M),R):!c&&O.current&&p?A=d(He(He({},M),{},{className:p}),R):u||!c&&!p?A=d(He(He({},M),{},{style:{display:"none"}}),R):A=null;else{var L;T===Dr?L="prepare":IT(T)?L="active":T===ba&&(L="start");var $=vw(f,"".concat(N,"-").concat(L));A=d(He(He({},M),{},{className:eL(vw(f,N),Se(Se({},$,$&&L),f,typeof f=="string")),style:D}),R)}if(g.isValidElement(A)&&vL(A)){var F=xL(A);F||(A=g.cloneElement(A,{ref:R}))}return g.createElement(CO,{ref:y},A)});return r.displayName="CSSMotion",r}const BO=OO(ET);var s0="add",o0="keep",a0="remove",Rm="removed";function zO(e){var t;return e&&Tt(e)==="object"&&"key"in e?t=e:t={key:e},He(He({},t),{},{key:String(t.key)})}function l0(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return e.map(zO)}function $O(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=[],r=0,i=t.length,s=l0(e),o=l0(t);s.forEach(function(c){for(var u=!1,d=r;d<i;d+=1){var f=o[d];if(f.key===c.key){r<d&&(n=n.concat(o.slice(r,d).map(function(p){return He(He({},p),{},{status:s0})})),r=d),n.push(He(He({},f),{},{status:o0})),r+=1,u=!0;break}}u||n.push(He(He({},c),{},{status:a0}))}),r<i&&(n=n.concat(o.slice(r).map(function(c){return He(He({},c),{},{status:s0})})));var a={};n.forEach(function(c){var u=c.key;a[u]=(a[u]||0)+1});var l=Object.keys(a).filter(function(c){return a[c]>1});return l.forEach(function(c){n=n.filter(function(u){var d=u.key,f=u.status;return d!==c||f!==a0}),n.forEach(function(u){u.key===c&&(u.status=o0)})}),n}var FO=["component","children","onVisibleChanged","onAllRemoved"],HO=["status"],UO=["eventProps","visible","children","motionName","motionAppear","motionEnter","motionLeave","motionLeaveImmediately","motionDeadline","removeOnLeave","leavedClassName","onAppearPrepare","onAppearStart","onAppearActive","onAppearEnd","onEnterStart","onEnterActive","onEnterEnd","onLeaveStart","onLeaveActive","onLeaveEnd"];function WO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:BO,n=function(r){zN(s,r);var i=FN(s);function s(){var o;dl(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=i.call.apply(i,[this].concat(l)),Se(Rv(o),"state",{keyEntities:[]}),Se(Rv(o),"removeKey",function(u){o.setState(function(d){var f=d.keyEntities.map(function(p){return p.key!==u?p:He(He({},p),{},{status:Rm})});return{keyEntities:f}},function(){var d=o.state.keyEntities,f=d.filter(function(p){var m=p.status;return m!==Rm}).length;f===0&&o.props.onAllRemoved&&o.props.onAllRemoved()})}),o}return hl(s,[{key:"render",value:function(){var a=this,l=this.state.keyEntities,c=this.props,u=c.component,d=c.children,f=c.onVisibleChanged;c.onAllRemoved;var p=Lv(c,FO),m=u||g.Fragment,v={};return UO.forEach(function(w){v[w]=p[w],delete p[w]}),delete p.keys,g.createElement(m,p,l.map(function(w,x){var _=w.status,y=Lv(w,HO),S=_===s0||_===o0;return g.createElement(t,Uh({},v,{key:y.key,visible:S,eventProps:y,onVisibleChanged:function(k){f==null||f(k,{key:y.key}),k||a.removeKey(y.key)}}),function(C,k){return d(He(He({},C),{},{index:x}),k)})}))}}],[{key:"getDerivedStateFromProps",value:function(a,l){var c=a.keys,u=l.keyEntities,d=l0(c),f=$O(u,d);return{keyEntities:f.filter(function(p){var m=u.find(function(v){var w=v.key;return p.key===w});return!(m&&m.status===Rm&&p.status===a0)})}}}]),s}(g.Component);return Se(n,"defaultProps",{component:"div"}),n}WO(ET);const xw=g.createContext(!0);function VO(e){const t=g.useContext(xw),{children:n}=e,[,r]=_T(),{motion:i}=r,s=g.useRef(!1);return s.current||(s.current=t!==i),s.current?g.createElement(xw.Provider,{value:i},g.createElement(kO,{motion:i},n)):n}const qO=()=>null;var KO=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const GO=["getTargetContainer","getPopupContainer","renderEmpty","input","pagination","form","select","button"];let PT;function YO(){return PT||t0}function XO(e){return Object.keys(e).some(t=>t.endsWith("Color"))}const QO=e=>{const{prefixCls:t,iconPrefixCls:n,theme:r,holderRender:i}=e;t!==void 0&&(PT=t),r&&XO(r)&&sO(YO(),r)},ZO=e=>{const{children:t,csp:n,autoInsertSpaceInButton:r,alert:i,anchor:s,form:o,locale:a,componentSize:l,direction:c,space:u,splitter:d,virtual:f,dropdownMatchSelectWidth:p,popupMatchSelectWidth:m,popupOverflow:v,legacyLocale:w,parentContext:x,iconPrefixCls:_,theme:y,componentDisabled:S,segmented:C,statistic:k,spin:N,calendar:T,carousel:D,cascader:P,collapse:O,typography:R,checkbox:A,descriptions:M,divider:L,drawer:$,skeleton:F,steps:B,image:z,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:ge,menu:Pe,pagination:he,input:Ae,textArea:je,empty:Fe,badge:xe,radio:tt,rate:Rt,switch:Xe,transfer:at,avatar:xn,message:ut,tag:Ct,table:Ke,card:lt,tabs:Dt,timeline:Wt,timePicker:Tn,upload:U,notification:J,tree:ye,colorPicker:Ee,datePicker:Oe,rangePicker:Mt,flex:tn,wave:Vt,dropdown:dn,warning:oe,tour:_e,tooltip:it,popover:At,popconfirm:Rr,floatButton:ae,floatButtonGroup:Je,variant:hn,inputNumber:Xs,treeSelect:Nl}=e,Qs=g.useCallback((gt,Kt)=>{const{prefixCls:Qn}=e;if(Kt)return Kt;const X=Qn||x.getPrefixCls("");return gt?`${X}-${gt}`:X},[x.getPrefixCls,e.prefixCls]),is=_||x.iconPrefixCls||gT,Zs=n||x.csp;xO(is,Zs);const Go=wO(y,x.theme,{prefixCls:Qs("")}),Tl={csp:Zs,autoInsertSpaceInButton:r,alert:i,anchor:s,locale:a||w,direction:c,space:u,splitter:d,virtual:f,popupMatchSelectWidth:m??p,popupOverflow:v,getPrefixCls:Qs,iconPrefixCls:is,theme:Go,segmented:C,statistic:k,spin:N,calendar:T,carousel:D,cascader:P,collapse:O,typography:R,checkbox:A,descriptions:M,divider:L,drawer:$,skeleton:F,steps:B,image:z,input:Ae,textArea:je,layout:E,list:H,mentions:q,modal:j,progress:ne,result:ie,slider:K,breadcrumb:ge,menu:Pe,pagination:he,empty:Fe,badge:xe,radio:tt,rate:Rt,switch:Xe,transfer:at,avatar:xn,message:ut,tag:Ct,table:Ke,card:lt,tabs:Dt,timeline:Wt,timePicker:Tn,upload:U,notification:J,tree:ye,colorPicker:Ee,datePicker:Oe,rangePicker:Mt,flex:tn,wave:Vt,dropdown:dn,warning:oe,tour:_e,tooltip:it,popover:At,popconfirm:Rr,floatButton:ae,floatButtonGroup:Je,variant:hn,inputNumber:Xs,treeSelect:Nl},ki=Object.assign({},x);Object.keys(Tl).forEach(gt=>{Tl[gt]!==void 0&&(ki[gt]=Tl[gt])}),GO.forEach(gt=>{const Kt=e[gt];Kt&&(ki[gt]=Kt)}),typeof r<"u"&&(ki.button=Object.assign({autoInsertSpace:r},ki.button));const qr=ON(()=>ki,ki,(gt,Kt)=>{const Qn=Object.keys(gt),X=Object.keys(Kt);return Qn.length!==X.length||Qn.some(be=>gt[be]!==Kt[be])}),{layer:Hu}=g.useContext(rp),Yo=g.useMemo(()=>({prefixCls:is,csp:Zs,layer:Hu?"antd":void 0}),[is,Zs,Hu]);let qt=g.createElement(g.Fragment,null,g.createElement(qO,{dropdownMatchSelectWidth:p}),t);const Uu=g.useMemo(()=>{var gt,Kt,Qn,X;return OD(((gt=op.Form)===null||gt===void 0?void 0:gt.defaultValidateMessages)||{},((Qn=(Kt=qr.locale)===null||Kt===void 0?void 0:Kt.Form)===null||Qn===void 0?void 0:Qn.defaultValidateMessages)||{},((X=qr.form)===null||X===void 0?void 0:X.validateMessages)||{},(o==null?void 0:o.validateMessages)||{})},[qr,o==null?void 0:o.validateMessages]);Object.keys(Uu).length>0&&(qt=g.createElement(zD.Provider,{value:Uu},qt)),a&&(qt=g.createElement(HD,{locale:a,_ANT_MARK__:FD},qt)),qt=g.createElement(AD.Provider,{value:Yo},qt),l&&(qt=g.createElement(aO,{size:l},qt)),qt=g.createElement(VO,null,qt);const Il=g.useMemo(()=>{const gt=Go||{},{algorithm:Kt,token:Qn,components:X,cssVar:be}=gt,ke=KO(gt,["algorithm","token","components","cssVar"]),Qe=Kt&&(!Array.isArray(Kt)||Kt.length>0)?Ov(Kt):pT,hr={};Object.entries(X||{}).forEach(([_3,y3])=>{const Ci=Object.assign({},y3);"algorithm"in Ci&&(Ci.algorithm===!0?Ci.theme=Qe:(Array.isArray(Ci.algorithm)||typeof Ci.algorithm=="function")&&(Ci.theme=Ov(Ci.algorithm)),delete Ci.algorithm),hr[_3]=Ci});const Pl=Object.assign(Object.assign({},Xc),Qn);return Object.assign(Object.assign({},ke),{theme:Qe,token:Pl,components:hr,override:Object.assign({override:Pl},hr),cssVar:be})},[Go]);return y&&(qt=g.createElement(mT.Provider,{value:Il},qt)),qr.warning&&(qt=g.createElement(BD.Provider,{value:qr.warning},qt)),S!==void 0&&(qt=g.createElement(oO,{disabled:S},qt)),g.createElement(ap.Provider,{value:qr},qt)},pl=e=>{const t=g.useContext(ap),n=g.useContext(uT);return g.createElement(ZO,Object.assign({parentContext:t,legacyLocale:n},e))};pl.ConfigContext=ap;pl.SizeContext=Qc;pl.config=QO;pl.useConfig=lO;Object.defineProperty(pl,"SizeContext",{get:()=>Qc});const pr=(e,t)=>new wt(e).setA(t).toRgbString(),Zo=(e,t)=>new wt(e).lighten(t).toHexString(),JO=e=>{const t=qa(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},e6=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:pr(r,.85),colorTextSecondary:pr(r,.65),colorTextTertiary:pr(r,.45),colorTextQuaternary:pr(r,.25),colorFill:pr(r,.18),colorFillSecondary:pr(r,.12),colorFillTertiary:pr(r,.08),colorFillQuaternary:pr(r,.04),colorBgSolid:pr(r,.95),colorBgSolidHover:pr(r,1),colorBgSolidActive:pr(r,.9),colorBgElevated:Zo(n,12),colorBgContainer:Zo(n,8),colorBgLayout:Zo(n,0),colorBgSpotlight:Zo(n,26),colorBgBlur:pr(r,.04),colorBorder:Zo(n,26),colorBorderSecondary:Zo(n,19)}},t6=(e,t)=>{const n=Object.keys(O_).map(s=>{const o=qa(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??B_(e),i=fT(e,{generateColorPalettes:JO,generateNeutralColorPalettes:e6});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},_w={defaultSeed:qh.token,defaultAlgorithm:B_,darkAlgorithm:t6};function yw({children:e}){const t=I_(),[n,r]=g.useState(t.theme);return g.useEffect(()=>t.onThemeChange(r),[t]),h.jsx(pl,{theme:{algorithm:n.mode==="dark"?_w.darkAlgorithm:_w.defaultAlgorithm,token:{colorPrimary:n.colorPrimary,colorBgContainer:n.colorBgContainer,colorText:n.colorText,colorBorder:n.colorBorder}},children:e})}var Ge;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Ge||(Ge={}));var bw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(bw||(bw={}));const ue=Ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gs=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}},G=Ge.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class qi extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return i(this),r}static assert(t){if(!(t instanceof qi))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const i of this.issues)if(i.path.length>0){const s=i.path[0];n[s]=n[s]||[],n[s].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}qi.create=e=>new qi(e);const c0=(e,t)=>{let n;switch(e.code){case G.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ge.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ge.joinValues(e.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ge.joinValues(e.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${Ge.joinValues(e.options)}, received '${e.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ge.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case G.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case G.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ge.assertNever(e)}return{message:n}};let n6=c0;function r6(){return n6}const i6=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...i,path:s,message:a}};function se(e,t){const n=r6(),r=i6({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===c0?void 0:c0].filter(i=>!!i)});e.common.issues.push(r)}class jn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Te;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return jn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return Te;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const Te=Object.freeze({status:"aborted"}),nc=e=>({status:"dirty",value:e}),Ir=e=>({status:"valid",value:e}),ww=e=>e.status==="aborted",Sw=e=>e.status==="dirty",Ka=e=>e.status==="valid",Kh=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(me||(me={}));class fi{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kw=(e,t)=>{if(Ka(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new qi(e.common.issues);return this._error=n,this._error}}};function De(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:i}}class Ve{get description(){return this._def.description}_getType(t){return gs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new jn,ctx:{common:t.parent.common,data:t.data,parsedType:gs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Kh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},i=this._parseSync({data:t,path:r.path,parent:r});return kw(r,i)}"~validate"(t){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)};if(!this["~standard"].async)try{const s=this._parseSync({data:t,path:[],parent:n});return Ka(s)?{value:s.value}:{issues:n.common.issues}}catch(s){(i=(r=s==null?void 0:s.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(s=>Ka(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:gs(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Kh(i)?i:Promise.resolve(i));return kw(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),a=()=>s.addIssue({code:G.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new No({schema:this,typeName:Ie.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return zi.create(this,this._def)}nullable(){return To.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ci.create(this)}promise(){return Jh.create(this,this._def)}or(t){return Yh.create([this,t],this._def)}and(t){return Xh.create(this,t,this._def)}transform(t){return new No({...De(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ef({...De(this._def),innerType:this,defaultValue:n,typeName:Ie.ZodDefault})}brand(){return new jT({typeName:Ie.ZodBranded,type:this,...De(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new tf({...De(this._def),innerType:this,catchValue:n,typeName:Ie.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return F_.create(this,t)}readonly(){return nf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const s6=/^c[^\s-]{8,}$/i,o6=/^[0-9a-z]+$/,a6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,l6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,c6=/^[a-z0-9_-]{21}$/i,u6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,d6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,f6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mm;const p6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,m6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,g6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,v6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,x6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,RT="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",y6=new RegExp(`^${RT}$`);function MT(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function b6(e){return new RegExp(`^${MT(e)}$`)}function w6(e){let t=`${RT}T${MT(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function S6(e,t){return!!((t==="v4"||!t)&&p6.test(e)||(t==="v6"||!t)&&g6.test(e))}function k6(e,t){if(!u6.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function C6(e,t){return!!((t==="v4"||!t)&&m6.test(e)||(t==="v6"||!t)&&v6.test(e))}class Li extends Ve{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.string,received:s.parsedType}),Te}const r=new jn;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")t.data.length>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(t,i),o?se(i,{code:G.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&se(i,{code:G.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")h6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"email",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Mm||(Mm=new RegExp(f6,"u")),Mm.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"emoji",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")l6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"uuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")c6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"nanoid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")s6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")o6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cuid2",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")a6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ulid",code:G.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),se(i,{validation:"url",code:G.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"regex",code:G.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?w6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?y6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?b6(s).test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{code:G.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?d6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"duration",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?S6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"ip",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?k6(t.data,s.alg)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"jwt",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?C6(t.data,s.version)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"cidr",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?x6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64",code:G.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?_6.test(t.data)||(i=this._getOrReturnCtx(t,i),se(i,{validation:"base64url",code:G.invalid_string,message:s.message}),r.dirty()):Ge.assertNever(s);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(i=>t.test(i),{validation:n,code:G.invalid_string,...me.errToObj(r)})}_addCheck(t){return new Li({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...me.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...me.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...me.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new Li({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Li({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Li.create=e=>new Li({checks:[],typeName:Ie.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...De(e)});function E6(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(e.toFixed(i).replace(".","")),o=Number.parseInt(t.toFixed(i).replace(".",""));return s%o/10**i}class Ga extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.number,received:s.parsedType}),Te}let r;const i=new jn;for(const s of this._def.checks)s.kind==="int"?Ge.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:G.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?E6(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_finite,message:s.message}),i.dirty()):Ge.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Ga({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Ga({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ge.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Ga.create=e=>new Ga({checks:[],typeName:Ie.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...De(e)});class Zc extends Ve{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let r;const i=new jn;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),se(r,{code:G.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Ge.assertNever(s);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return se(n,{code:G.invalid_type,expected:ue.bigint,received:n.parsedType}),Te}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,r,i){return new Zc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:me.toString(i)}]})}_addCheck(t){return new Zc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Zc.create=e=>new Zc({checks:[],typeName:Ie.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...De(e)});class u0 extends Ve{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.boolean,received:r.parsedType}),Te}return Ir(t.data)}}u0.create=e=>new u0({typeName:Ie.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...De(e)});class Gh extends Ve{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_type,expected:ue.date,received:s.parsedType}),Te}if(Number.isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return se(s,{code:G.invalid_date}),Te}const r=new jn;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(i=this._getOrReturnCtx(t,i),se(i,{code:G.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Ge.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Gh({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Gh.create=e=>new Gh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Ie.ZodDate,...De(e)});class Cw extends Ve{_parse(t){if(this._getType(t)!==ue.symbol){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.symbol,received:r.parsedType}),Te}return Ir(t.data)}}Cw.create=e=>new Cw({typeName:Ie.ZodSymbol,...De(e)});class d0 extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.undefined,received:r.parsedType}),Te}return Ir(t.data)}}d0.create=e=>new d0({typeName:Ie.ZodUndefined,...De(e)});class h0 extends Ve{_parse(t){if(this._getType(t)!==ue.null){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.null,received:r.parsedType}),Te}return Ir(t.data)}}h0.create=e=>new h0({typeName:Ie.ZodNull,...De(e)});class Ew extends Ve{constructor(){super(...arguments),this._any=!0}_parse(t){return Ir(t.data)}}Ew.create=e=>new Ew({typeName:Ie.ZodAny,...De(e)});class f0 extends Ve{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ir(t.data)}}f0.create=e=>new f0({typeName:Ie.ZodUnknown,...De(e)});class Bs extends Ve{_parse(t){const n=this._getOrReturnCtx(t);return se(n,{code:G.invalid_type,expected:ue.never,received:n.parsedType}),Te}}Bs.create=e=>new Bs({typeName:Ie.ZodNever,...De(e)});class Nw extends Ve{_parse(t){if(this._getType(t)!==ue.undefined){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.void,received:r.parsedType}),Te}return Ir(t.data)}}Nw.create=e=>new Nw({typeName:Ie.ZodVoid,...De(e)});class ci extends Ve{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==ue.array)return se(n,{code:G.invalid_type,expected:ue.array,received:n.parsedType}),Te;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(se(n,{code:o?G.too_big:G.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(se(n,{code:G.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(se(n,{code:G.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new fi(n,o,n.path,a)))).then(o=>jn.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new fi(n,o,n.path,a)));return jn.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new ci({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new ci({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new ci({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}}ci.create=(e,t)=>new ci({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...De(t)});function aa(e){if(e instanceof zt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=zi.create(aa(r))}return new zt({...e._def,shape:()=>t})}else return e instanceof ci?new ci({...e._def,type:aa(e.element)}):e instanceof zi?zi.create(aa(e.unwrap())):e instanceof To?To.create(aa(e.unwrap())):e instanceof Co?Co.create(e.items.map(t=>aa(t))):e}class zt extends Ve{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Ge.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){const c=this._getOrReturnCtx(t);return se(c,{code:G.invalid_type,expected:ue.object,received:c.parsedType}),Te}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Bs&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=s[c],d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new fi(i,d,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof Bs){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(se(i,{code:G.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new fi(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>jn.mergeObjectSync(r,c)):jn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,o;const i=((o=(s=this._def).errorMap)==null?void 0:o.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(t){return new zt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new zt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ie.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new zt({...this._def,catchall:t})}pick(t){const n={};for(const r of Ge.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Ge.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}deepPartial(){return aa(this)}partial(t){const n={};for(const r of Ge.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}return new zt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Ge.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof zi;)s=s._def.innerType;n[r]=s}return new zt({...this._def,shape:()=>n})}keyof(){return AT(Ge.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:Bs.create(),typeName:Ie.ZodObject,...De(t)});class Yh extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new qi(a.ctx.common.issues));return se(n,{code:G.invalid_union,unionErrors:o}),Te}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new qi(l));return se(n,{code:G.invalid_union,unionErrors:a}),Te}}get options(){return this._def.options}}Yh.create=(e,t)=>new Yh({options:e,typeName:Ie.ZodUnion,...De(t)});const Ii=e=>e instanceof m0?Ii(e.schema):e instanceof No?Ii(e.innerType()):e instanceof Zh?[e.value]:e instanceof Eo?e.options:e instanceof g0?Ge.objectValues(e.enum):e instanceof ef?Ii(e._def.innerType):e instanceof d0?[void 0]:e instanceof h0?[null]:e instanceof zi?[void 0,...Ii(e.unwrap())]:e instanceof To?[null,...Ii(e.unwrap())]:e instanceof jT||e instanceof nf?Ii(e.unwrap()):e instanceof tf?Ii(e._def.innerType):[];class $_ extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return se(n,{code:G.invalid_type,expected:ue.object,received:n.parsedType}),Te;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(se(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Ii(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,s)}}return new $_({typeName:Ie.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...De(r)})}}function p0(e,t){const n=gs(e),r=gs(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&r===ue.object){const i=Ge.objectKeys(t),s=Ge.objectKeys(e).filter(a=>i.indexOf(a)!==-1),o={...e,...t};for(const a of s){const l=p0(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===ue.array&&r===ue.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],l=p0(o,a);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return n===ue.date&&r===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Xh extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=(s,o)=>{if(ww(s)||ww(o))return Te;const a=p0(s.value,o.value);return a.valid?((Sw(s)||Sw(o))&&n.dirty(),{status:n.value,value:a.data}):(se(r,{code:G.invalid_intersection_types}),Te)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Xh.create=(e,t,n)=>new Xh({left:e,right:t,typeName:Ie.ZodIntersection,...De(n)});class Co extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.array)return se(r,{code:G.invalid_type,expected:ue.array,received:r.parsedType}),Te;if(r.data.length<this._def.items.length)return se(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Te;!this._def.rest&&r.data.length>this._def.items.length&&(se(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fi(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>jn.mergeArray(n,o)):jn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Co({...this._def,rest:t})}}Co.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Co({items:e,typeName:Ie.ZodTuple,rest:null,...De(t)})};class Qh extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.object)return se(r,{code:G.invalid_type,expected:ue.object,received:r.parsedType}),Te;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new fi(r,a,r.path,a)),value:o._parse(new fi(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?jn.mergeObjectAsync(n,i):jn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Ve?new Qh({keyType:t,valueType:n,typeName:Ie.ZodRecord,...De(r)}):new Qh({keyType:Li.create(),valueType:t,typeName:Ie.ZodRecord,...De(n)})}}class Tw extends Ve{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.map)return se(r,{code:G.invalid_type,expected:ue.map,received:r.parsedType}),Te;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:i._parse(new fi(r,a,r.path,[c,"key"])),value:s._parse(new fi(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Te;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}Tw.create=(e,t,n)=>new Tw({valueType:t,keyType:e,typeName:Ie.ZodMap,...De(n)});class Jc extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ue.set)return se(r,{code:G.invalid_type,expected:ue.set,received:r.parsedType}),Te;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(se(r,{code:G.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(se(r,{code:G.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Te;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>s._parse(new fi(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new Jc({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new Jc({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Jc.create=(e,t)=>new Jc({valueType:e,minSize:null,maxSize:null,typeName:Ie.ZodSet,...De(t)});class m0 extends Ve{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}m0.create=(e,t)=>new m0({getter:e,typeName:Ie.ZodLazy,...De(t)});class Zh extends Ve{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return se(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Te}return{status:"valid",value:t.data}}get value(){return this._def.value}}Zh.create=(e,t)=>new Zh({value:e,typeName:Ie.ZodLiteral,...De(t)});function AT(e,t){return new Eo({values:e,typeName:Ie.ZodEnum,...De(t)})}class Eo extends Ve{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{expected:Ge.joinValues(r),received:n.parsedType,code:G.invalid_type}),Te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return se(n,{received:n.data,code:G.invalid_enum_value,options:r}),Te}return Ir(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Eo.create(t,{...this._def,...n})}exclude(t,n=this._def){return Eo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Eo.create=AT;class g0 extends Ve{_parse(t){const n=Ge.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ue.string&&r.parsedType!==ue.number){const i=Ge.objectValues(n);return se(r,{expected:Ge.joinValues(i),received:r.parsedType,code:G.invalid_type}),Te}if(this._cache||(this._cache=new Set(Ge.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Ge.objectValues(n);return se(r,{received:r.data,code:G.invalid_enum_value,options:i}),Te}return Ir(t.data)}get enum(){return this._def.values}}g0.create=(e,t)=>new g0({values:e,typeName:Ie.ZodNativeEnum,...De(t)});class Jh extends Ve{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return se(n,{code:G.invalid_type,expected:ue.promise,received:n.parsedType}),Te;const r=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Ir(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Jh.create=(e,t)=>new Jh({type:e,typeName:Ie.ZodPromise,...De(t)});class No extends Ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{se(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Te;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Te:l.status==="dirty"||n.value==="dirty"?nc(l.value):l});{if(n.value==="aborted")return Te;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Te:a.status==="dirty"||n.value==="dirty"?nc(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Te:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Te:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ka(o))return Te;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ka(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):Te);Ge.assertNever(i)}}No.create=(e,t,n)=>new No({schema:e,typeName:Ie.ZodEffects,effect:t,...De(n)});No.createWithPreprocess=(e,t,n)=>new No({schema:t,effect:{type:"preprocess",transform:e},typeName:Ie.ZodEffects,...De(n)});class zi extends Ve{_parse(t){return this._getType(t)===ue.undefined?Ir(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}zi.create=(e,t)=>new zi({innerType:e,typeName:Ie.ZodOptional,...De(t)});class To extends Ve{_parse(t){return this._getType(t)===ue.null?Ir(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}To.create=(e,t)=>new To({innerType:e,typeName:Ie.ZodNullable,...De(t)});class ef extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ef.create=(e,t)=>new ef({innerType:e,typeName:Ie.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...De(t)});class tf extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new qi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}tf.create=(e,t)=>new tf({innerType:e,typeName:Ie.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...De(t)});class Iw extends Ve{_parse(t){if(this._getType(t)!==ue.nan){const r=this._getOrReturnCtx(t);return se(r,{code:G.invalid_type,expected:ue.nan,received:r.parsedType}),Te}return{status:"valid",value:t.data}}}Iw.create=e=>new Iw({typeName:Ie.ZodNaN,...De(e)});class jT extends Ve{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class F_ extends Ve{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Te:s.status==="dirty"?(n.dirty(),nc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Te:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new F_({in:t,out:n,typeName:Ie.ZodPipeline})}}class nf extends Ve{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Ka(i)&&(i.value=Object.freeze(i.value)),i);return Kh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}nf.create=(e,t)=>new nf({innerType:e,typeName:Ie.ZodReadonly,...De(t)});var Ie;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Ie||(Ie={}));const b=Li.create,W=Ga.create,ve=u0.create,$i=f0.create;Bs.create;const ee=ci.create,I=zt.create;Yh.create;const xi=$_.create;Xh.create;Co.create;const _i=Qh.create,Y=Zh.create,Ce=Eo.create;Jh.create;zi.create;To.create;new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");const N6=["owner"],T6=["agent","owner","user-upload"],LT=I({id:b().min(1),relPath:b().min(1),from:Ce(T6),label:b().optional(),size:W().int().nonnegative(),mime:b().min(1),addedAt:W().int().nonnegative(),lastEditedAt:W().int().nonnegative().optional(),stale:ve().optional()});I({sessionId:b().min(1),relPath:b().min(1),ttlSeconds:W().int().positive().nullable().optional(),view:Ce(["raw","md-rendered"]).optional()});I({url:b().min(1),expiresAt:W().int().nonnegative().nullable()});I({sessionId:b().min(1),relPath:b().min(1),label:b().optional(),origin:Y("agent").optional()});I({entry:LT});I({sessionId:b().min(1),relPath:b().min(1)});I({removed:Y(!0)});I({sessionId:b().min(1)});I({entries:ee(LT)});I({attachmentId:b().min(1),url:b().min(1),relPath:b().min(1),sizeBytes:W().int().nonnegative(),mimeType:b().min(1)});const I6=xi("type",[I({type:Y("persona"),id:b().min(1)}).strict(),I({type:Y("chat"),id:b().min(1)}).strict(),I({type:Y("*")}).strict()]),P6=Ce(["read","send","admin"]),H_=I({resource:I6,actions:ee(P6).min(1)}).strict(),R6=I({id:b().min(1),secretHash:b().regex(/^[a-f0-9]{64}$/),displayName:b(),grants:ee(H_),issuedAt:W().int().nonnegative(),expiresAt:W().int().positive().optional(),maxUses:W().int().positive().optional(),usedCount:W().int().nonnegative(),peerOwnerId:b().min(1).optional(),firstUsedByPeerAt:W().int().positive().optional(),peerDisplayName:b().optional()}).strict(),M6=R6.omit({secretHash:!0});I({type:Y("whoami:ok"),owner:I({id:b(),kind:Ce(["owner","guest"]),displayName:b(),ownerId:b(),provider:b()}).strict(),capability:M6,grantedPersonas:ee(I({id:b().min(1),displayName:b()}).strict())}).strict();I({selfUrl:b().min(1)});I({type:Y("contact:handshake:ok"),owner:I({id:b(),ownerId:b(),provider:b(),displayName:b()}),grants:ee(H_)});const A6=I({name:b().min(1),from:b().optional(),version:b().optional(),min:b().optional()}),j6=I({name:b().min(1),env:ee(b().min(1)).min(1)}),L6=I({name:b().min(1)}),DT={clis:ee(A6),secrets:ee(j6),assets:ee(L6)};I(DT);const OT=I({version:Y(1),...DT}).strict(),D6=I({target:b().min(1),reason:b().min(1),file:b().min(1),quote:b().min(1)}),O6=I({version:Y(1),manifest:OT}).strict(),B6=Ce(["scanning","done","failed"]),z6=I({scanSessionId:b().optional(),status:B6,evidence:ee(D6).default([]),notes:ee(b()).default([]),scannedAssets:ee(b()).default([]),head:b().min(1).optional(),startedAt:W(),finishedAt:W().optional(),error:b().optional()}).strict(),$6=I({url:b().min(1),branch:b().min(1),head:b().min(1),dirty:ve(),ahead:W()}).strict(),F6=I({env:b().min(1),setAt:W().optional()}).strict(),H6=["pending","running","done","failed","waiting","skipped"],U6=Ce(H6),W6=["build","smoke","deploy"],V6=Ce(W6),q6=I({key:V6,status:U6,url:b().optional(),jobId:W().optional(),startedAt:W().optional(),completedAt:W().optional()}).strict(),K6=I({runId:W(),headSha:b().min(1),status:Ce(["queued","running","completed"]),htmlUrl:b().min(1),jobs:ee(q6)}).strict();I({personaId:b().min(1),repo:$6.optional(),file:O6.optional(),scan:z6.optional(),secrets:ee(F6).optional(),run:K6.optional(),fileError:b().optional()}).strict();I({sha:b().min(1),actionsUrl:b().min(1)}).strict();I({personaId:b().min(1)}).strict();I({personaId:b().min(1),patch:I({manifest:OT.optional()}).strict()}).strict();I({personaId:b().min(1),name:b().min(1),values:_i(b(),b())}).strict();I({personaId:b().min(1),jobId:W()}).strict();I({personaId:b().min(1),kind:Ce(["cli","secret","asset"]),item:_i(b(),$i()),evidence:I({reason:b().min(1),file:b().min(1),quote:b().min(1)})}).strict();I({personaId:b().min(1),notes:ee(b()).default([])}).strict();I({deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();I({type:Y("contact:setRemoteAccess:ok"),deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();I({type:Y("contact:remote-access-updated"),deviceId:b().min(1),remoteAccessAllowed:ve()}).strict();const G6=I({deviceId:b().min(1),ownerId:b().min(1),provider:b().min(1),displayName:b(),remoteUrl:b().min(1),connectToken:b(),grants:ee(H_),addedAt:W().int().nonnegative(),pinnedAt:W().int().nullable().default(null),remoteAccessAllowed:ve().default(!1),note:b().default("")}).strict(),BT=G6;I({deviceId:b().min(1)}).strict();I({type:Y("contact:remove:ok"),deviceId:b().min(1)}).strict();I({type:Y("contact:list:ok"),contacts:ee(BT)}).strict();I({type:Y("contact:added"),contact:BT}).strict();I({type:Y("contact:removed"),deviceId:b().min(1)}).strict();I({deviceId:b().min(1),pinned:ve()}).strict();I({deviceId:b().min(1),note:b()}).strict();I({type:Y("contact:setNote:ok"),deviceId:b().min(1),note:b()}).strict();I({type:Y("contact:pin:ok"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();I({type:Y("contact:pinned"),deviceId:b().min(1),pinnedAt:W().int().nullable()}).strict();const Y6=I({deviceId:b().min(1),name:b().min(1),url:b().min(1)});I({type:Y("device:list:ok"),devices:ee(Y6)});I({deviceId:b().min(1),url:b().min(1).optional(),name:b().optional()});I({type:Y("device:connect:ok"),deviceId:b(),name:b(),url:b()});const zT=I({ownerId:b().min(1),provider:b().min(1),displayName:b().min(1),avatarUrl:b().optional(),unionId:b().optional()});I({type:Y("auth:login:start:ok"),authUrl:b().min(1),state:b().min(1)});I({type:Y("auth:getIdentity:ok"),identity:zT.nullable(),deviceId:b().min(1),ttcTokenExpiresAt:W().nullable().optional()});I({type:Y("auth:logout:ok")});const $T=b().nullable();I({type:Y("auth:apiKey:get:ok"),apiKey:b().nullable(),createdAt:b().nullable(),gatewayUrl:$T});I({type:Y("auth:apiKey:regenerate:ok"),apiKey:b().min(1),createdAt:b().min(1),gatewayUrl:$T});I({type:Y("auth:login:done"),identity:zT});I({type:Y("auth:login:failed"),reason:b()});const U_=xi("kind",[I({kind:Y("success"),text:b(),brief:b().optional(),filePaths:ee(b()).optional()}),I({kind:Y("failure"),reason:b(),brief:b().optional()})]);I({targetPersona:b().min(1).optional(),dispatchId:b().min(1).optional(),prompt:b(),brief:b().optional(),targetDeviceId:b().min(1).optional(),model:b().min(1).optional(),tool:b().min(1).optional(),sessionLabel:b().min(1).max(60).optional(),meta:_i($i()).optional()}).refine(e=>e.targetPersona!==void 0||e.dispatchId!==void 0,{message:"either targetPersona (new dispatch) or dispatchId (follow-up) is required"}).refine(e=>!(e.dispatchId!==void 0&&e.targetDeviceId!==void 0),{message:"cross-device dispatch cannot be continued (dispatchId + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.tool!==void 0&&e.targetDeviceId!==void 0),{message:"engine override is not supported for cross-device dispatch (tool + targetDeviceId are mutually exclusive)"}).refine(e=>!(e.dispatchId!==void 0&&(e.tool!==void 0||e.model!==void 0)),{message:"a follow-up dispatch cannot change engine or model (dispatchId excludes tool / model); start a new dispatch instead"});I({dispatchId:b().min(1),outcome:U_});const X6=["running","completed","failed"],W_=Ce(X6),Q6=I({dispatchId:b().min(1),sourceSessionId:b().min(1),sourcePersonaId:b().min(1).optional(),targetPersonaId:b().min(1),workerSessionId:b().min(1).optional(),taskText:b(),taskBrief:b().optional(),round:W().int().positive().optional(),status:W_,outcome:U_.optional(),meta:_i($i()).optional(),createdAt:b().min(1),completedAt:b().min(1).optional(),deliveredAt:b().min(1).optional()});I({sourceSessionId:b().min(1).optional()});I({records:ee(Q6)});I({dispatchId:b().min(1)});I({type:Y("personaDispatch:get:ok"),status:W_,outcome:U_.optional()});const Z6=/^[a-z0-9][a-z0-9-]*$/;Ce(["stopped","starting","running","crashed","invalid"]);const J6=new Set(["localhost","127.0.0.1"]);function eB(e){let t;try{t=new URL(e)}catch{return!1}return!!(t.protocol==="https:"||t.protocol==="http:"&&J6.has(t.hostname))}const pd=I({id:b().regex(Z6),name:b().min(1),version:b().min(1),apiVersion:Y("1"),runtime:I({startCommand:b().min(1)}).passthrough().optional(),entry:I({url:b().url().refine(eB,{message:"INVALID_URL_SCHEME: only https or http://localhost is allowed"})}).strict().optional()}).passthrough().superRefine((e,t)=>{var i;const n=!!e.runtime,r=!!((i=e.entry)!=null&&i.url);n&&r&&t.addIssue({code:G.custom,message:"INVALID_MANIFEST: entry.url and runtime cannot coexist"}),!n&&!r&&t.addIssue({code:G.custom,message:"INVALID_MANIFEST: must have either entry.url or runtime"})}),tB=xi("kind",[I({kind:Y("local"),port:W().int().min(1).max(65535)}),I({kind:Y("hosted"),url:b().url()})]);xi("state",[I({extId:b(),manifest:pd,state:Y("stopped")}),I({extId:b(),manifest:pd,state:Y("starting")}),I({extId:b(),manifest:pd,state:Y("running"),target:tB}),I({extId:b(),manifest:pd,state:Y("crashed")}),I({extId:b(),manifest:$i().nullable(),state:Y("invalid"),invalidReason:b().min(1)})]);I({snapshotHash:b().min(1),version:b().min(1),publishedAt:W()});const nB=xi("kind",[I({kind:Y("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1)})]);xi("kind",[I({kind:Y("p2p-tunnel"),ownerPrincipalId:b().min(1),extId:b().min(1),snapshotHash:b().min(1)})]);I({extId:b().min(1),name:b().min(1),version:b().min(1),contentHash:b().min(1),publishedAt:W()});const rB=xi("kind",[I({kind:Y("clean")}),I({kind:Y("ready-new-version"),fromVersion:b().min(1),toVersion:b().min(1)}),I({kind:Y("error-same-hash"),version:b().min(1)}),I({kind:Y("error-version-not-bumped"),localVersion:b().min(1),publishedVersion:b().min(1)}),I({kind:Y("error-version-regression"),localVersion:b().min(1),publishedVersion:b().min(1)})]);I({localManifest:I({name:b().min(1),version:b().min(1),contentHash:b().min(1)}),publishState:xi("kind",[I({kind:Y("unpublished")}),I({kind:Y("published"),version:b().min(1),contentHash:b().min(1),publishedAt:W()})]),check:rB});I({extId:b().min(1),newVersion:b().min(1).nullish()});I({extId:b().min(1)});I({extId:b().min(1),snapshotHash:b().min(1)});I({channelRef:nB,snapshotHash:b().min(1),zipBase64:b().min(1)});I({id:b().min(1),peerDeviceId:b().min(1),senderDeviceId:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),readBy:_i(b().min(1),W().int().positive()).default({}),origin:I({kind:Y("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1).optional(),id:b().min(1),text:b().min(1),createdAt:W().int().nonnegative(),origin:I({kind:Y("persona"),personaId:b().min(1)}).optional()}).strict();I({peerDeviceId:b().min(1),sinceCreatedAt:W().int().nonnegative().optional()}).strict();I({peerDeviceId:b().min(1),upToCreatedAt:W().int().nonnegative()}).strict();I({peerDeviceId:b().min(1).optional(),text:b().min(1)});I({peerDeviceId:b().min(1).optional(),command:b().min(1),timeoutMs:W().int().positive().optional()}).strict();I({type:Y("peerExec:run:ok"),stdout:b(),stderr:b(),exitCode:W().int().nullable(),timedOut:ve(),stdoutTruncated:ve(),stderrTruncated:ve()}).strict();const FT=xi("kind",[I({kind:Y("at"),at:b().min(1)}),I({kind:Y("every"),everyMs:W().int().positive(),anchorMs:W().int().nonnegative().optional()}),I({kind:Y("cron"),expr:b().min(1),tz:b().min(1).optional()})]),bu=b().trim().min(1);I({personaId:bu,name:b().min(1),schedule:FT,prompt:b().min(1),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional()});I({personaId:bu,onlyMine:ve().optional()});I({personaId:bu,shiftId:b().min(1)});const iB=I({name:b().min(1).optional(),schedule:FT.optional(),prompt:b().min(1).optional(),targetPersona:b().min(1).optional(),timeoutMs:W().int().positive().optional(),enabled:ve().optional()});I({personaId:bu,shiftId:b().min(1),patch:iB});I({personaId:bu,shiftId:b().min(1),limit:W().int().positive().optional()});const HT="persona-master",V_=I({personaId:b().min(1),deviceId:b().min(1).optional()}),UT=I({id:b().min(1),name:b().min(1),memberPersonas:ee(V_),memberContactDeviceIds:ee(b().min(1)),createdAt:b().min(1),updatedAt:b().min(1)}),WT=b().trim().min(1);I({name:WT,memberPersonas:ee(V_).default([]),memberContactDeviceIds:ee(b().min(1)).default([])});I({channelId:b().min(1),name:WT.optional(),memberPersonas:ee(V_).optional(),memberContactDeviceIds:ee(b().min(1)).optional()});I({channelId:b().min(1)});I({channels:ee(UT)});I({channel:UT});I({ok:Y(!0),removedTopics:W().int().min(0)});const Ut=b().trim().min(1),q_=["master-confirmed","owner-needed"],K_=["open","resolved"],sB=q_[0];q_[1];K_[0];const oB=K_[1],aB=Ce(q_),lB=Ce(K_),cB=I({id:Ut.optional(),resolves:Ut.optional(),type:aB,status:lB,question:Ut,recommendation:Ut}).superRefine((e,t)=>{e.type===sB&&e.status!==oB&&t.addIssue({code:G.custom,path:["status"],message:"master-confirmed decisions must be resolved"})}),uB=["planning","running","done"],dB=Ce(uB),VT=I({at:b().min(1),actor:b().min(1),action:b().min(1),target:b().optional(),reason:b().min(1),artifacts:ee(Ut).optional(),decision:cB.optional()}),hB=I({rejectCount:W().int().min(0),accepted:ve().default(!1),ordinal:W().int().min(1).optional(),overrideCount:W().int().min(0).optional()}),G_=I({id:b().min(1),channelId:b().min(1),title:b(),masterSessionId:b().min(1),goal:b(),boundaries:b(),acceptanceCriteria:ee(b()),activity:ee(VT),lineMeta:_i(hB),nextLineOrdinal:W().int().min(1).optional(),state:dB,createdAt:b().min(1),updatedAt:b().min(1)}),fB=I({lineId:b().min(1),dispatchId:b().min(1),workerSessionId:b().optional(),assignee:b().min(1),focus:b(),status:W_,acceptance:ee(b()),rejectCount:W().int().min(0),accepted:ve(),ordinal:W().int().min(1).nullable()});I({channelId:b().min(1)});I({topicId:b().min(1).optional(),sessionId:b().min(1).optional()}).refine(e=>e.topicId!==void 0||e.sessionId!==void 0,{message:"either topicId or sessionId is required"});I({channelId:b().min(1),title:Ut.optional()});I({topicId:b().min(1),title:Ut.optional(),goal:Ut,boundaries:b(),acceptanceCriteria:ee(Ut).min(1)});I({topicId:b().min(1),action:Ut,target:Ut.optional(),reason:Ut,artifacts:ee(Ut).optional(),decision:VT.shape.decision});I({topicId:b().min(1),lineId:Ut,reason:Ut});I({topicId:b().min(1),lineId:Ut,reason:Ut,artifacts:ee(Ut).optional(),watcherVerdict:Ce(["pass","fail"]),overrideReason:Ut.optional()}).refine(e=>e.watcherVerdict!=="fail"||!!e.overrideReason,{message:"watcherVerdict=fail 时必须给 overrideReason(推翻 watcher 的理由)",path:["overrideReason"]});I({topicId:b().min(1),state:Ce(["done"])});I({topicId:b().min(1),title:Ut});I({topicId:b().min(1)});const pB=G_.extend({lineCount:W().int().min(0)});I({topics:ee(pB)});I({topic:G_,lines:ee(fB)});I({topicId:b().min(1),masterSessionId:b().min(1)});I({rejectCount:W().int().min(1),needsOwnerAttention:ve()});I({acceptedLines:W().int().min(1),totalLines:W().int().min(1),allAccepted:ve(),overrides:W().int().min(0),needsOwnerAttention:ve()});I({topic:G_});I({ok:Y(!0),removedMasterSessionId:b().min(1).nullable(),removedWorkerSessionIds:ee(b().min(1))});const mB=["ask","allow","deny"],qT=Ce(mB),gB=I({id:b().min(1),desc:b().min(1),action:qT});I({rules:ee(gB)});I({ruleId:b().min(1)});I({action:qT,desc:b(),source:b().min(1)});const vB=["created","review-requested"],KT=/^[A-Za-z0-9._-]+$/,ml=b().min(1).regex(KT),gl=b().min(1).regex(KT),wu=W().int().positive();I({role:Ce(vB)});I({owner:ml,repo:gl,number:wu});I({owner:ml,repo:gl,number:wu,expectedHeadSha:b().min(1)});I({owner:ml,repo:gl,number:wu,body:b().min(1)});I({owner:ml,repo:gl,number:wu,ready:ve()});I({owner:ml,repo:gl});I({owner:ml,repo:gl,number:wu,reviewers:ee(b().min(1)).min(1)});I({personaId:b().min(1)});I({personaId:b().min(1)});const xB=["expired","cancelled","access_denied","lark_protocol_error","cloud_unreachable","internal_error"],_B=Ce(xB);I({personaId:b().min(1),appId:b().min(1),appSecret:b().min(1),botName:b().min(1).optional()});const yB=I({chatId:b().min(1),chatName:b().optional(),lastActiveAt:W().int().optional()}),bB=I({state:Ce(["unbound","provisioning","bound","broken"]),appId:b().optional(),botName:b().optional(),brokenReason:b().optional(),qrUrl:b().optional(),errorReason:_B.optional(),groups:ee(yB),needsUpgrade:ve().optional(),upgradeQrUrl:b().optional()});bB.extend({personaId:b().min(1)});I({});I({onboardingCompletedAt:W()});I({});I({tools:ee(I({id:Ce(["claude","codex"]),available:ve(),version:b().optional(),path:b().optional()}))});I({});const wB=I({tool:Ce(["claude","codex"]),cwd:b(),toolSessionId:b(),label:b().optional(),createdAt:b(),updatedAt:b(),turns:W()});I({candidates:ee(wB)});I({});I({registered:ve()});const SB=I({personaId:b(),label:b(),model:b().optional(),effort:b().optional(),public:ve(),iconKey:b().optional(),tool:b().optional(),createdAt:W(),updatedAt:W()}).strict(),kB=I({name:b().min(1),description:b().optional()}),CB=I({id:b().min(1)}),GT=I({writableRoots:ee(b()).optional(),denyRead:ee(b()).optional(),network:ve().optional()}).strict(),EB=I({permissions:I({defaultMode:b().optional(),allow:ee(b()).optional(),deny:ee(b()).optional()}).optional(),sandbox:I({enabled:ve().optional(),autoAllowBashIfSandboxed:ve().optional(),allowUnsandboxedCommands:ve().optional(),excludedCommands:ee(b()).optional(),filesystem:I({denyRead:ee(b()).optional(),allowRead:ee(b()).optional(),denyWrite:ee(b()).optional(),allowWrite:ee(b()).optional()}).optional(),network:I({allowedDomains:ee(b()).optional(),allowLocalBinding:ve().optional()}).optional()}).optional()});SB.extend({personality:b().optional(),personalityLocal:b().optional(),personalityManaged:ve().optional(),skills:ee(kB).optional(),plugins:ee(CB).optional(),sandboxSettings:EB.nullable().optional(),codexSandbox:GT.nullable().optional()});I({slug:b().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/).max(32),label:b().min(1),personality:b(),model:b().optional(),effort:b().optional(),tool:b().optional(),public:ve().optional(),iconKey:b().optional()}).strict();I({personaId:b().min(1)});I({personaId:b().min(1),patch:I({label:b().min(1).optional(),model:b().optional(),effort:b().optional(),tool:b().optional(),personality:b().optional(),personalityLocal:b().optional(),public:ve().optional(),iconKey:b().nullable().optional(),codexSandbox:GT.optional()}).strict()}).strict();const YT=["ready","session:info","session:status","session:event","session:deleted","session:rewound","session:cleared","session:queue","permission:request","session:question","session:question:cleared","pong","error","subscribed","unsubscribed","auth:ok","tunnel:ready","tunnel:exited","tunnel:unavailable","session:control","session:pty","contact:added","contact:pinned","contact:removed","contact:remote-access-updated","contact:note-updated","org-mesh:progress","channel:changed","inbox:event","friend:reverseTokenOffered","auth:login:done","auth:login:failed","appBuilder:project-updated","appBuilder:publish-progress","appBuilder:publish-failed","larkBot:state"],XT=["idle","running","running-idle","stopped","error","observing"],NB=["task-notification","slash-command","local-command","system-reminder","skill-hint","meta-text","attachment-skills","attachment-deferred-tools","dispatch-task","dispatch-result"];function lp(e){return e==="dispatch-task"||e==="dispatch-result"}const TB=["builtin","global","project","plugin"],IB=["builtin","global","project","policy","plugin"],QT=Ce(["owner","guest"]);I({id:b().min(1),kind:QT,displayName:b(),feishuUnionId:b().optional()}).strict();const PB=I({did:b().min(1),displayName:b(),feishuUnionId:b().optional(),principal:QT}).strict(),RB=Ce(XT),MB=I({inputTokens:W().int().nonnegative(),outputTokens:W().int().nonnegative(),cacheReadTokens:W().int().nonnegative().optional(),cacheCreateTokens:W().int().nonnegative().optional()}),ZT={gitBranch:b().optional(),resolvedModel:b().optional(),resolvedEffort:b().optional(),contextUsage:MB.optional(),contextWindowSize:W().int().positive().optional(),aiLabel:b().optional()},AB=I(ZT),JT=I({value:b(),label:b(),description:b().optional()}),jB=I({id:b().min(1),label:b().min(1),description:b().optional(),contextWindowSize:W().int().positive(),default:ve().optional(),efforts:ee(JT).optional(),defaultEffort:b().optional()}),LB=I({id:b().min(1),label:b().min(1),description:b().optional()}),DB=I({name:b().min(1),type:Ce(["string","select","toggle"]),label:b().min(1),description:b().optional(),options:ee(JT).optional(),default:$i().optional(),scope:Ce(["core","tool-specific"])});I({tool:b().min(1)});const OB=I({rewind:ve(),subagents:ve(),tui:ve(),observe:ve(),fileSharing:ve(),fork:ve()});I({tool:b().min(1),toolSessionIdLabel:b().optional(),models:ee(jB),permissionModes:ee(LB),configSchema:ee(DB),features:OB});const BB=I({tool:b().min(1),pattern:b().min(1),createdAt:b().min(1).optional()});I({sessionId:b().min(1),cwd:b().min(1),tool:Y("claude").or(b().min(1)).default("claude"),toolSessionId:b().optional(),label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),...ZT,aiLabelGeneratedAt:b().optional(),permissionRules:ee(BB).optional(),pinnedAt:W().int().nonnegative().nullable().optional(),archivedAt:W().int().nonnegative().nullable().optional(),pinSortOrder:W().int().nullable().optional(),unreadAt:b().min(1).nullable().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:ve().optional(),deployId:b().min(1).optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional(),appBuilderProject:b().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),chatId:b().min(1).optional(),creatorPrincipalId:b().min(1).optional(),creatorDisplayName:b().min(1).optional(),creatorFeishuUnionId:b().min(1).optional(),originOwnerPrincipalId:b().min(1).optional(),originOwnerPersonaId:b().min(1).optional(),dispatchedFromSessionId:b().min(1).optional(),shiftFiredFromSessionId:b().min(1).optional(),larkChatId:b().min(1).optional(),larkChatName:b().min(1).optional(),larkChatType:Ce(["p2p","group"]).optional(),createdAt:b().min(1),updatedAt:b().min(1)});const Fn={seq:W().int().nonnegative().optional(),ts:b().optional(),uuid:b().optional()},zB=Ce(NB),$B=I({readCount:W().int().nonnegative().optional(),searchCount:W().int().nonnegative().optional(),bashCount:W().int().nonnegative().optional(),editFileCount:W().int().nonnegative().optional(),linesAdded:W().int().nonnegative().optional(),linesRemoved:W().int().nonnegative().optional(),otherToolCount:W().int().nonnegative().optional()}),FB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),HB=I({agentId:b().optional(),agentType:b().optional(),status:b().optional(),prompt:b().optional(),filePath:b().optional(),structuredPatch:ee(FB).optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional(),toolStats:$B.optional()}).optional()}),UB=I({path:b(),content:b(),mtimeMs:W().optional()}),WB=I({label:b().min(1),description:b().optional()}),eI=I({question:b().min(1),multiSelect:ve(),options:ee(WB).min(1)}),VB=["completed","interrupted"];xi("kind",[I({...Fn,kind:Y("session_init"),toolSessionId:b().optional()}),I({...Fn,kind:Y("thinking"),text:b(),partialId:b().optional()}),I({...Fn,kind:Y("text"),text:b(),partialId:b().optional()}),I({...Fn,kind:Y("user_text"),text:b(),meta:zB.optional(),taskId:b().optional(),parentToolUseId:b().optional(),sender:PB.optional()}),I({...Fn,kind:Y("tool_call"),toolUseId:b(),tool:b(),toolKind:b().optional(),input:$i()}),I({...Fn,kind:Y("tool_result"),toolUseId:b(),output:$i().optional(),error:b().optional(),toolResultExtra:HB.optional(),sourceToolAssistantUUID:b().optional(),askQuestionAnswers:_i(b(),b()).optional()}),I({...Fn,kind:Y("attachment_memories"),memories:ee(UB)}),I({...Fn,kind:Y("permission_request"),requestId:b(),tool:b(),input:$i(),toolUseId:b().optional()}),I({...Fn,kind:Y("ask_user_question"),toolUseId:b(),questions:ee(eI)}),I({...Fn,kind:Y("turn_end"),durationMs:W().int().nonnegative().optional(),reason:Ce(VB).optional()}),I({...Fn,kind:Y("subagent_progress"),toolUseId:b(),agentId:b(),status:Ce(["started","running","completed","failed"]),description:b().optional(),lastToolName:b().optional(),prompt:b().optional(),stats:I({durationMs:W().int().nonnegative().optional(),tokens:W().int().nonnegative().optional(),toolUseCount:W().int().nonnegative().optional()}).optional()}),I({...Fn,kind:Y("error"),message:b()}),I({...Fn,kind:Y("meta_update"),patch:AB}),I({...Fn,kind:Y("meta-text"),text:b(),metaSource:Ce(["cc","owner"]).optional()})]);I({cwd:b().min(1).optional(),tool:b().optional(),label:b().optional(),aiLabel:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),iconKey:b().optional(),forkedFromSessionId:b().min(1).optional(),ephemeral:ve().optional(),ownerPersonaId:b().min(1).optional(),projectPath:b().min(1).optional()}).refine(e=>e.cwd!=null||e.ownerPersonaId!=null||e.projectPath!=null,{message:"cwd / ownerPersonaId / projectPath 至少传一个"});I({path:b().min(1),name:b().min(1),createdAt:b().datetime(),pinnedAt:W().optional()});I({path:b().min(1),pinnedAt:W().nullable()});I({path:b().min(1)});I({path:b().min(1).optional(),name:b().min(1).optional()}).refine(e=>e.path!=null||e.name!=null,{message:"path 与 name 至少给一个"});I({cwd:b().min(1),tool:b().min(1),toolSessionId:b().min(1),label:b().optional(),aiLabel:b().optional(),iconKey:b().optional(),createdAt:b().datetime(),updatedAt:b().datetime(),ownerPersonaId:b().min(1).optional()});I({originOnly:ve().optional(),ownerPersonaId:b().min(1).optional(),limit:W().int().positive().optional(),offset:W().int().nonnegative().optional()});I({sessionId:b().min(1)});I({sessionId:b().min(1),patch:I({label:b().optional(),model:b().optional(),permissionMode:b().optional(),effort:b().optional(),cwd:b().optional(),iconKey:b().optional(),ephemeral:Y(!1).optional()})});I({id:b().min(1),text:b(),queuedAt:W(),senderDisplayName:b().optional()});I({sessionId:b().min(1),text:b(),queueWhileRunning:ve().optional()});I({sessionId:b().min(1),id:b().min(1).optional()});I({sessionId:b().min(1),userMessageId:b().min(1),dryRun:ve().optional()});I({canRewind:ve(),error:b().optional(),filesChanged:ee(b()).optional(),insertions:W().int().nonnegative().optional(),deletions:W().int().nonnegative().optional()});I({sessionId:b().min(1),userMessageId:b().min(1)});const qB=I({oldStart:W().int().nonnegative(),oldLines:W().int().nonnegative(),newStart:W().int().nonnegative(),newLines:W().int().nonnegative(),lines:ee(b())}),KB=I({filePath:b().min(1),hunks:ee(qB),insertions:W().int().nonnegative(),deletions:W().int().nonnegative(),status:Ce(["modified","added","deleted"]).optional()});I({canRewind:ve(),error:b().optional(),files:ee(KB),totalInsertions:W().int().nonnegative(),totalDeletions:W().int().nonnegative()});I({userMessageIds:ee(b())});I({sessionId:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),messageUuid:b().min(1),targetCwd:b().min(1).optional()});I({forkedToolSessionId:b().min(1),forkedFilePath:b().min(1)});I({sessionId:b().min(1),toolSessionId:b().min(1),jsonlPath:b().optional()});I({sessionId:b().min(1),afterSeq:W().int().min(-1)});I({sessionId:b().min(1),permissionRequestId:b().min(1),allow:ve(),permanent:ve().optional(),pattern:b().optional()});I({projectPath:b().min(1)});I({sessionId:b().min(1),limit:W().int().positive().max(5e3).optional(),offset:W().int().nonnegative().optional(),slim:ve().optional()});I({cwd:b().min(1),toolSessionId:b().min(1)});I({cwd:b().min(1),toolSessionId:b().min(1),subagentId:b().min(1)});I({cwd:b().min(1).optional(),path:b().optional(),showHidden:ve().optional()});I({cwd:b().min(1),path:b().min(1)});I({cwd:b().min(1),tool:b().optional()});I({name:b().min(1),source:Ce(TB),path:b().optional(),description:b().optional(),plugin:b().optional()});const GB=I({name:b().min(1),source:Ce(IB),path:b().optional(),description:b().optional(),whenToUse:b().optional(),plugin:b().optional()});I({cwd:b().min(1),tool:b().optional()});I({agents:ee(GB)});I({sessionId:b().optional()});I({sessionId:b().min(1).optional()});I({sessionId:b().min(1),pinned:ve()});I({sessionId:b().min(1),archived:ve()});I({query:b().min(1),sessionIds:ee(b().min(1)),limit:W().int().positive().max(50).optional()});const YB=I({sessionId:b().min(1),snippet:b()});I({type:Y("session:searchContent"),matches:ee(YB)});I({type:Y("peerSession:upsert:ok")});I({sessionId:b().min(1)});I({type:Y("peerSession:remove:ok")});I({orderedIds:ee(b().min(1)).min(1)});I({cwd:b().min(1)});I({isGitRoot:ve(),gitRoot:b().nullable()});I({cwd:b().min(1)});I({branch:b().nullable()});I({cwd:b().min(1)});I({branches:ee(b()),head:b().nullable()});const XB=I({cwd:b().min(1),updatedAt:b().min(1)});I({dirs:ee(XB)});I({type:Y("session:question"),sessionId:b().min(1),toolUseId:b().min(1),requestId:b().min(1),questions:ee(eI).min(1)});I({type:Y("session:question:cleared"),sessionId:b().min(1),toolUseId:b().min(1),answers:_i(b(),b()).optional()});I({sessionId:b().min(1),toolUseId:b().min(1),answers:_i(b(),b())});I({ok:Y(!0)});I({sessionId:b().min(1),toolUseId:b().min(1)});I({ok:Y(!0)});const tI=I({name:b().min(1),version:b().min(1),instanceId:b().min(1),deviceLabel:b().transform(e=>e.trim().slice(0,64)).optional()});I({type:Y("auth"),token:b().min(1),scheme:Y("bearer").optional(),clientInfo:tI.optional()});I({type:Y("auth:ok"),version:b().min(1).optional(),protocolVersion:W().int().nonnegative().optional()});const QB=I({clientId:b().min(1),connectedAt:W().int().nonnegative(),self:ve(),clientInfo:tI.optional()});I({type:Y("device:connections:ok"),connections:ee(QB)});I({type:Y("tunnel:ready"),url:b().min(1),subdomain:b().min(1)});I({type:Y("tunnel:exited"),code:W().int().nullable(),subdomain:b().nullable(),url:b().nullable()});I({type:Y("tunnel:unavailable"),reason:b().min(1),failedAt:b().min(1)});const ZB=I({sessionId:b().min(1),status:RB,freshSpawn:ve(),pendingPermissionRequestIds:ee(b().min(1)),pendingQuestionToolUseIds:ee(b().min(1))});I({type:Y("info"),version:b(),protocolVersion:W(),hostname:b(),os:b(),tools:ee(I({id:b(),available:ve()})),runningSessions:ee(ZB),tokenRole:Ce(N6).optional(),isLoopback:ve().optional(),httpBaseUrl:b().optional(),httpToken:b().optional(),daemonSource:Ce(["ota","packaged"]).optional(),globalCliVersion:b().nullable().optional()});const JB=6173,ez=6272,vl=/^[a-z][a-z0-9-]{0,39}$/,Su=I({name:b().regex(vl,{message:"kebab-case, 小写字母开头,只允许小写字母 / 数字 / -,最长 40 字符"}),port:W().int().min(JB).max(ez),createdAt:b().datetime(),devCommand:b().min(1),prodUrl:b().url().optional(),readyPattern:b().optional(),publishJob:I({jobId:b().min(1),stage:Ce(["build","deploy","verify"]),startedAt:W().int().nonnegative()}).optional()}),tz=["install-pending","installing","starting-dev-server","running","stopped","failed"],nI=Ce(tz),Y_=Su.extend({isRunning:ve(),boundSessionId:b().nullable(),stage:nI.optional(),stageReason:b().optional(),publishJob:I({jobId:b().min(1),stage:Ce(["build","deploy","verify"]),startedAt:W().int().nonnegative(),status:Ce(["in-flight","interrupted"])}).optional()});I({}).strict();I({projects:ee(Y_)}).strict();I({sessionId:b().min(1)}).strict();I({project:Y_.nullable()}).strict();I({sessionId:b().min(1),name:b().min(1)}).strict();I({project:Su}).strict();I({name:b()}).strict();I({}).strict();I({name:b(),newPort:W().int()}).strict();I({project:Su}).strict();I({name:b().regex(vl),url:b().url()}).strict();I({project:Su}).strict();I({sessionId:b().min(1),force:ve().optional()}).strict();I({project:Su}).strict();const nz=["installing","failed"];I({sessionId:b().min(1),stage:Ce(nz),reason:b().optional()}).strict();I({ok:Y(!0)}).strict();I({sessionId:b().min(1)}).strict();I({ok:Y(!0)}).strict();I({type:Y("appBuilder:project-updated"),project:Y_,stage:nI,stageReason:b().optional()}).strict();I({name:b().regex(vl)});I({jobId:b().min(1),status:Ce(["started","already-publishing"])}).strict();I({name:b().regex(vl)});I({ok:Y(!0)}).strict();I({type:Y("appBuilder:publish-progress"),name:b().regex(vl),jobId:b().min(1),stage:Ce(["build","deploy","verify"]),status:Ce(["started","completed"])}).strict();I({type:Y("appBuilder:publish-failed"),name:b().regex(vl),jobId:b().min(1),stage:Ce(["build","deploy","verify","unknown"]),errorSummary:b()}).strict();I({});I({method:b().min(1).optional()});const rz=["allowed","conditional","denied"],iz=Ce(rz),sz=I({name:b().min(1),status:iz,description:b().min(1),args:ee(I({name:b(),required:ve()})).nullable(),argsSchema:_i($i()).optional(),reason:b().optional()});I({type:Y("meta:methods"),methods:ee(sz)});const Pw=1,oz=["daemon","main","renderer"],az=Ce(oz),lz=["debug","info","warn","error"],cz=Ce(lz);I({ts:W().int(),source:az,level:cz,msg:b(),ownerPrincipalId:b(),deviceId:b(),appVersion:b(),daemonVersion:b().optional(),os:b(),meta_json:b().optional(),sessionId:b().optional()});I({v:Y(1),visitorId:b().min(1),displayName:b(),provider:b(),iat:W(),exp:W()});const uz=I({visitorId:b(),displayName:b(),avatarUrl:b().optional(),provider:b(),firstSeen:W(),lastSeen:W()});I({visitors:ee(uz)});const dz=/<system-reminder>此消息来自飞书群成员 (.+?)<\/system-reminder>\s*$/,rI=/<system-reminder>此消息来自 (owner|guest):(.+?)<\/system-reminder>\s*$/,hz="clawd-dispatch-task",fz="clawd-dispatch-result",Rw=120;function pz(e){if(!e)return[];const t=[];for(const n of["task","result"]){const r=n==="task"?hz:fz,i=new RegExp(`<${r}\\b([^>]*)>([\\s\\S]*?)</${r}>`,"gi");for(let s=i.exec(e);s!==null;s=i.exec(e))t.push({at:s.index,block:mz(n,s[1]??"",s[2]??"")})}return t.sort((n,r)=>n.at-r.at).map(n=>n.block)}function mz(e,t,n){var c;const r=wz(t),i=v0(bz(Am(n,"detail")??n)),s=(c=Am(n,"brief"))==null?void 0:c.trim(),o=s&&s.length>0?v0(s):gz(i),a=r.round!==void 0?Number.parseInt(r.round,10):void 0,l=r.status;return{kind:e,dispatchId:r["dispatch-id"]??"",...r.from?{from:r.from}:{},...e==="task"&&a!==void 0&&Number.isFinite(a)?{round:a}:{},...e==="result"&&(l==="success"||l==="failure")?{status:l}:{},brief:o,briefIsDerived:!(s&&s.length>0),detail:i,filePaths:yz(Am(n,"files"))}}function gz(e){const t=e.split(/\n\s*\n/).map(r=>r.trim()).find(r=>r.length>0);if(!t)return"";const n=t.replace(/\s+/g," ");return n.length>Rw?`${n.slice(0,Rw)}…`:n}const vz="clawd-dispatch-task|clawd-dispatch-result|brief|detail|files",xz=new RegExp(`<\\\\(\\\\*)(/?)(${vz})\\b`,"g");function _z(e){return v0(e)}function v0(e){return e.replace(xz,"<$1$2$3")}function Am(e,t){const n=new RegExp(`<${t}>([\\s\\S]*?)</${t}>`,"i").exec(e);return n?n[1]??"":null}function yz(e){return e?e.split(`
|
|
96
96
|
`).map(t=>t.trim()).filter(t=>t.startsWith("- ")).map(t=>t.slice(2).trim()).filter(t=>t.length>0):[]}function bz(e){return e.replace(/^\n/,"").replace(/\n$/,"")}function wz(e){const t={},n=/([a-z-]+)="([^"]*)"/gi;for(let r=n.exec(e);r!==null;r=n.exec(e))t[r[1]]=Sz(r[2]??"");return t}function Sz(e){return e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}const kz=new Set(["localhost","127.0.0.1","0.0.0.0","::1"]);let Ei=null;function Cz(){if(Ei!==null)return Ei;if(typeof window>"u")return Ei=!1,!1;if(kz.has(window.location.hostname)||window.location.protocol==="file:")return Ei=!0,!0;if(new URLSearchParams(window.location.search).get("debug")==="1"){Ei=!0;try{sessionStorage.setItem("debug","1")}catch{}}else try{Ei=sessionStorage.getItem("debug")==="1"}catch{Ei=!1}return Ei}function Me(e,...t){Cz()&&console.log(`[${e}][${new Date().toISOString()}]`,...t)}function md(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const Ez=e=>{const t=[1e3,2e3,4e3,8e3,16e3,3e4];return t[Math.min(e,t.length-1)]},Nz=new Set(["auth:ok","pong","error"]),Mw=new Set(YT.filter(e=>!Nz.has(e)));let Tz=0;const Aw=()=>`r${++Tz}`;function Iz(e){let t=e.url,n=e.authToken,r=e.selfIdentity;const i=e.clientInfo,s=e.requestTimeoutMs??3e4,o=e.pingIntervalMs??3e4,a=e.watchdogMs??6e4,l=e.authTimeoutMs??1e4,c=e.backoffMs??Ez;let u=null,d=!1,f=0,p=null,m=null,v=null,w=null,x=!1,_="disconnected";const y=new Map,S=new Map;let C=null;const k=(z,E)=>{var H;z==="ready"&&(C=E),(H=S.get(z))==null||H.forEach(q=>{try{q(E)}catch{}})},N=z=>{_!==z&&(_=z,k("status",z))},T=(z,E)=>{const H=S.get(z)??new Set;if(H.add(E),S.set(z,H),z==="ready"&&C!==null)try{E(C)}catch{}return()=>H.delete(E)},D=()=>{m&&(clearInterval(m),m=null),v&&(clearTimeout(v),v=null),w&&(clearTimeout(w),w=null)},P=()=>{v&&clearTimeout(v),v=setTimeout(()=>{try{u==null||u.close(4e3,"pong watchdog")}catch{}},a)},O=()=>{m&&clearInterval(m),m=setInterval(()=>{(u==null?void 0:u.readyState)===1&&u.send(JSON.stringify({type:"ping",requestId:Aw()}))},o),P()},R=z=>{for(const[,E]of y)clearTimeout(E.timer),E.reject(new Error(z));y.clear()},A=[],M=()=>{if(A.length===0)return;const z=A.splice(0);for(const E of z)(u==null?void 0:u.readyState)===1&&!x?E.doSend():(clearTimeout(E.timer),E.reject(new Error("NOT_CONNECTED")))},L=z=>{if(A.length===0)return;const E=A.splice(0);for(const H of E)clearTimeout(H.timer),H.reject(new Error(z))},$=()=>{if(d)return;const z=c(f);if(z<0){L("connection closed: not reconnecting");return}k("daemon:reconnecting",{attempt:f+1,nextDelayMs:z,scheduledAt:Date.now()}),p&&clearTimeout(p),p=setTimeout(()=>{f+=1,B()},z)},F=z=>{P();const E=String(z.type??"");if(E==="auth:ok"){Me("daemon-client","auth:ok received → connected",{url:t}),w&&(clearTimeout(w),w=null),x=!1,f=0,N("connected"),k("daemon:connected",{url:t}),O(),M();return}if(E==="pong")return;if(E==="ready"){const q=Number(z.protocolVersion??-1);q!==Pw&&k("daemon:version-mismatch",{daemonProtocol:q,supportedProtocol:Pw}),k("ready",z);return}const H=z.requestId;if(typeof H=="string"&&y.has(H)){const q=y.get(H);if(y.delete(H),clearTimeout(q.timer),E==="error"){const j=String(z.code??"ERR"),ne=String(z.message??"unknown");q.reject(new Error(`${j}: ${ne}`))}else Mw.has(E)&&k(E,z),q.resolve(z);return}Mw.has(E)&&k(E,z)},B=()=>{p&&(clearTimeout(p),p=null),Me("daemon-client","connect →",{url:t,token:md(n),attempt:f}),N("connecting");let z;try{z=new WebSocket(t)}catch(E){N("disconnected"),k("daemon:disconnected",{reason:(E==null?void 0:E.message)??"ws constructor failed"}),$();return}u=z,x=!!n,z.onopen=()=>{if(z!==u){Me("daemon-client","onopen → stale (replaced before opened), ignore");return}if(n){Me("daemon-client","onopen → send auth frame",{token:md(n)});const E={type:"auth",token:n};r!=null&&r.principalId&&(E.selfPrincipalId=r.principalId),r!=null&&r.displayName&&(E.selfDisplayName=r.displayName),i&&(E.clientInfo=i),z.send(JSON.stringify(E)),w=setTimeout(()=>{try{z.close(4001,"auth handshake timeout")}catch{}},l)}else Me("daemon-client","onopen → no token, treat as connected (daemon authMode=none)"),f=0,N("connected"),k("daemon:connected",{url:t}),O(),M()},z.onclose=E=>{if(z!==u){Me("daemon-client","onclose → stale, ignore",{code:E.code,reason:E.reason});return}const H=E.reason||(E.code===1008?"auth failed":`close ${E.code}`);if(Me("daemon-client","onclose →",{code:E.code,reason:H,awaitingAuth:x,manualStop:d}),D(),R(`connection closed: ${H}`),u=null,E.code===4401?N("revoked"):N("disconnected"),k("daemon:disconnected",{reason:H}),E.code===1008||E.code===4401){L(`connection closed: ${H}`);return}d?L(`connection closed: ${H}`):$()},z.onerror=()=>{},z.onmessage=E=>{if(z!==u)return;let H;try{H=JSON.parse(String(E.data))}catch{return}F(H)}};return{start(){d=!1,f=0,B()},stop(){d=!0,p&&(clearTimeout(p),p=null),D();try{u==null||u.close(1e3,"shutdown")}catch{}u=null,R("shutdown"),L("shutdown"),N("disconnected")},switchProfile(z){Me("daemon-client","switchProfile →",{url:z.url,token:md(z.authToken)},"prev:",{url:t,token:md(n)}),t=z.url,n=z.authToken,z.selfIdentity!==void 0&&(r=z.selfIdentity),f=0,d=!0,p&&(clearTimeout(p),p=null),D(),R("switch profile"),L("switch profile");try{u==null||u.close(1e3,"switch profile")}catch{}u=null,d=!1,B()},request(z,E){return new Promise((H,q)=>{const j=Aw(),ne=setTimeout(()=>{y.delete(j);const K=A.findIndex(ge=>ge.timer===ne);K>=0&&A.splice(K,1),q(new Error(`request timeout: ${z}`))},s),ie=()=>{y.set(j,{resolve:K=>H(K),reject:q,timer:ne}),u.send(JSON.stringify({...E,type:z,requestId:j}))};(u==null?void 0:u.readyState)===1&&!x?ie():d||u==null&&p==null?(clearTimeout(ne),q(new Error("NOT_CONNECTED"))):A.push({doSend:ie,reject:q,timer:ne})})},on:T,get isOpen(){return(u==null?void 0:u.readyState)===1&&!x},get url(){return t},getStatus(){return _}}}function Pz(e){const t=e.trim(),n=t.indexOf("#");if(n<0)return{url:t};const r=t.slice(0,n),i=t.slice(n+1),o=new URLSearchParams(i).get("token")??void 0;return{url:r,token:o??void 0}}function Rz(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}function Mz(e){return e?{id:e.id,mode:e.mode,url:e.url,token:Rz(e.token),name:e.name}:null}function gd(e){return e?Array.isArray(e)?e.map(Mz):{_notArray:typeof e,_value:e}:null}function jw(e){return e==null?null:typeof e=="object"&&"value"in e?e.value:e}const Az="ws://127.0.0.1:18790",Lw="daemon:profiles",Dw="daemon:active-profile-id";function jz(){return Math.random().toString(36).slice(2,10)}function Lz(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.name=="string"&&(t.mode==="localhost"||t.mode==="remote")&&typeof t.url=="string"&&(t.token===void 0||typeof t.token=="string")}function iI(e){let t={profiles:[],activeId:null},n=!1,r=null;const i=new Set,s=()=>{for(const l of i)l(t)},o=async()=>{Me("profile-store","persist →",gd(t.profiles),"active:",t.activeId),await e.kv.set(Lw,t.profiles),await e.kv.set(Dw,t.activeId)},a=async()=>{if(!n){if(r){await r;return}r=(async()=>{var l;try{let c=null;try{const d=await e.kv.get(Lw);c=jw(d)}catch{c=null}let u=null;try{const d=await e.kv.get(Dw);u=jw(d)??null}catch{u=null}if(Me("profile-store","ensureLoaded read kv →","profiles:",gd(c),"activeId:",u),Array.isArray(c)&&c.length>0){const d=c.filter(Lz),f=u&&d.some(p=>p.id===u)?u:((l=d[0])==null?void 0:l.id)??null;t={profiles:d,activeId:f},n=!0,Me("profile-store","ensureLoaded → use kv profiles",gd(d),"active:",f);return}t={profiles:[{id:"default",name:"本机",mode:"localhost",url:Az}],activeId:"default"},Me("profile-store","ensureLoaded → fallback synthesized default (NO token)",gd(t.profiles)),n=!0,await o()}finally{r=null}})(),await r}};return{async load(){return await a(),s(),t},async snapshot(){return await a(),t},async upsert(l){var w;await a();let c=l.url,u=l.token;if(c&&c.includes("#")){const x=Pz(c);c=x.url,!u&&x.token&&(u=x.token)}const d=l.id?t.profiles.find(x=>x.id===l.id):void 0,f=u!=null&&u.trim()?u.trim():d==null?void 0:d.token;if(l.mode==="remote"&&!f)throw new Error("remote mode requires token");const p=l.id??jz(),m={id:p,name:((w=l.name)==null?void 0:w.trim())||(d==null?void 0:d.name)||(l.mode==="remote"?"远程":"本机"),mode:l.mode,url:c.trim(),token:f};return t={profiles:[...t.profiles.filter(x=>x.id!==p),m],activeId:p},await o(),s(),m},async delete(l){var d;await a();const c=t.profiles.filter(f=>f.id!==l);let u=t.activeId;u===l&&(u=((d=c[0])==null?void 0:d.id)??null),t={profiles:c,activeId:u},await o(),s()},async activate(l){await a(),t.profiles.some(c=>c.id===l)&&(t={...t,activeId:l},await o(),s())},subscribe(l){return i.add(l),()=>i.delete(l)},getActive(){return n?t.profiles.find(l=>l.id===t.activeId)??null:null}}}const Ow="clawd.client-instance-id";let Dz={name:"clawd-web",version:"unknown"};function Oz(){let e=null;try{e=localStorage.getItem(Ow),e||(e=crypto.randomUUID(),localStorage.setItem(Ow,e))}catch{e=e??crypto.randomUUID()}return{...Dz,instanceId:e}}function Bw(e){if(!e)return"<none>";let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return`<len:${e.length} hash:${(t>>>0).toString(16)}>`}const sI=g.createContext(null);function Bz({host:e,children:t}){const[n,r]=g.useState(null),i=g.useMemo(()=>async()=>{const s=iI(e),o=await s.load(),a=o.profiles.find(c=>c.id===o.activeId)??o.profiles[0];if(!a)throw new Error("DaemonProvider: profile store has no profiles after load");return Me("daemon-context","bootstrap → createDaemonClient",{id:a.id,url:a.url,token:Bw(a.token)}),{client:Iz({url:a.url,authToken:a.token,clientInfo:Oz()}),store:s}},[e]);return g.useEffect(()=>{let s=!0,o=null,a=null;return i().then(l=>{s&&(l.client.start(),o=l,r(l),a=l.store.subscribe(()=>{const c=l.store.getActive();if(!c){Me("daemon-context","subscribe → no active profile, skip switchProfile");return}Me("daemon-context","subscribe → switchProfile",{id:c.id,url:c.url,token:Bw(c.token)}),l.client.switchProfile({url:c.url,authToken:c.token})}))}),()=>{s=!1,a==null||a(),o==null||o.client.stop()}},[i]),n?h.jsx(sI.Provider,{value:n,children:t}):null}function yi(){const e=g.useContext(sI);if(!e)throw new Error("useDaemonClient must be used inside <DaemonProvider>");return e.client}function zz(){const e=yi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i.mode,o=s==="tui"?"tui":"sdk";Me("daemon-context","useDaemonMode ready.mode =",{rawMode:s,resolved:o}),n(o)}),[e]),t}function $z(){const e=yi(),[t,n]=g.useState(void 0);return g.useEffect(()=>e.on("ready",i=>{const s=i;s.version!==void 0&&n(s.principalKind==="guest"?"guest":"owner")}),[e]),t}const oI=g.createContext(null);function Fz({cache:e,children:t}){return g.createElement(oI.Provider,{value:e},t)}function $o(){const e=g.useContext(oI);if(!e)throw new Error("useCache must be used inside <CacheProvider>");return e}function pi(e){const t=$o(),n=g.useCallback(i=>t.observe(e,()=>i()),[t,e]),r=g.useCallback(()=>t.read(e),[t,e]);return g.useSyncExternalStore(n,r,r)}const aI={actionsLevel:"none",httpBaseUrl:null,httpToken:null},lI=g.createContext(aI);function cp(){return g.useContext(lI)}function Hz(e){return e!=null&&e.httpBaseUrl?{actionsLevel:e.tokenRole==="owner"?"owner":"none",httpBaseUrl:e.httpBaseUrl,httpToken:e.httpToken??null}:aI}function Uz(){const e=pi("daemon-info");return g.useMemo(()=>Hz(e),[e])}function Wz({children:e}){const t=Uz();return Ze.createElement(lI.Provider,{value:t},e)}function Vz(e,t,n){if(!e.httpBaseUrl)return null;const r=encodeURIComponent(n);return`${e.httpBaseUrl}/session/${encodeURIComponent(t.sessionId)}/files?path=${r}`}function qz(e){const t=new Map;return{observe(n,r){let i=t.get(n);i||(i={data:void 0,hasData:!1,listeners:new Set},t.set(n,i));const s=l=>r(l);i.listeners.add(s);const o=i.listeners.size===1;s(i.hasData?i.data:void 0),o&&e.onFirstObserver(n);let a=!1;return()=>{if(a)return;a=!0;const l=t.get(n);l&&(l.listeners.delete(s),l.listeners.size===0&&(t.delete(n),e.onLastObserver(n)))}},read(n){const r=t.get(n);return r!=null&&r.hasData?r.data:void 0},setData(n,r){const i=t.get(n);if(!i)return;const s=i.hasData?i.data:void 0,o=r(s);i.data=o,i.hasData=!0;for(const a of i.listeners)a(o)}}}function Kz(){const e=[],t=new Map,n=r=>{for(const i of e)if(i.pattern.test(r))return i.source;return null};return{register(r,i){e.push({pattern:r,source:i})},activate(r){if(t.has(r))return;const i=n(r);if(!i)throw new Error(`no source registered for key: ${r}`);t.set(r,i.start(r))},deactivate(r){const i=t.get(r);i&&(t.delete(r),i())}}}function Gz(e){return{request:(t,n)=>e.request(t,n),onFrame(t){const n=[];for(const r of YT)n.push(e.on(r,i=>t(r,i)));return()=>{for(const r of n)r()}},onConnect(t){return e.on("daemon:connected",()=>t())},get isConnected(){return e.isOpen}}}function cI(e){const t=(e??"claude")==="claude";return{rewind:t,subagents:t,tui:t,observe:t,fileSharing:t,fork:t}}const Yz=e=>({tool:e,models:[{id:"",label:"未指定",contextWindowSize:2e5,default:!0}],permissionModes:[{id:"",label:"未指定"}],configSchema:[],features:cI(e)});function Xz(e,t){return{start(n){const r=n.replace(/^capabilities\//,"");let i=!1;const s=async()=>{try{const a=await e.request("capabilities:get",{tool:r});if(i)return;t(n,()=>a)}catch{if(i)return;t(n,()=>Yz(r))}},o=e.onConnect(()=>{s()});return s(),()=>{i=!0,o()}}}}function Qz(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("session:list",void 0);if(r)return;t(n,()=>a.sessions??[])}catch{}},s=e.onFrame((a,l)=>{if(a==="session:info"){const c=l;if(c.chatId!==void 0)return;t(n,u=>[c,...(u??[]).filter(d=>d.sessionId!==c.sessionId)])}else if(a==="session:deleted"){const c=l;t(n,u=>(u??[]).filter(d=>d.sessionId!==c.sessionId))}}),o=e.onConnect(()=>{i()});return i(),()=>{r=!0,s(),o()}}}}const eu={sessionId:null,events:[],lastSeq:-1,pendingPermissions:[],status:"idle",pendingQuestions:{},queued:[]};function jm(e,t){const n=t;if(n.kind==="permission_request"&&typeof n.requestId=="string"){if(e.some(i=>i.requestId===n.requestId))return e;const r={requestId:n.requestId,tool:typeof n.tool=="string"?n.tool:"",input:n.input,...typeof n.toolUseId=="string"&&n.toolUseId?{toolUseId:n.toolUseId}:{}};return[...e,r]}if(n.kind==="tool_result"&&typeof n.toolUseId=="string"&&n.toolUseId){const r=e.findIndex(i=>i.toolUseId===n.toolUseId);if(r>=0)return e.filter((i,s)=>s!==r)}return e}function uI(e,t,n){const r=n===void 0?e.sessionId:n;switch(t.type){case"session:change":return{...eu,sessionId:t.sessionId};case"session:event":{if(!r||t.sessionId!==r)return e;const i=typeof t.event.seq=="number"?t.event.seq:-1,s=[...e.events,t.event],o=i>e.lastSeq?i:e.lastSeq,a=jm(e.pendingPermissions,t.event);return{...e,events:s,lastSeq:o,pendingPermissions:a}}case"session:status":return!r||t.sessionId!==r?e:{...e,status:t.status};case"session:queue":return!r||t.sessionId!==r?e:{...e,queued:t.items};case"session:events":{if(!r||t.sessionId!==r)return e;const i=t.events.map(o=>o.event),s=i.reduce((o,a)=>jm(o,a),[]);return{...e,sessionId:t.sessionId,events:i,lastSeq:t.latestSeq,pendingPermissions:s}}case"session:events:append":{if(!r||t.sessionId!==r)return e;const i=new Set;for(const c of e.events){const u=c.seq;typeof u=="number"&&i.add(u)}const s=[];for(const c of t.events)typeof c.seq=="number"&&(i.has(c.seq)||s.push(c.event));const o=t.latestSeq>e.lastSeq?t.latestSeq:e.lastSeq;if(s.length===0)return o===e.lastSeq?e:{...e,lastSeq:o};const a=[...e.events,...s].sort((c,u)=>{const d=c.seq??-1,f=u.seq??-1;return d-f}),l=s.reduce((c,u)=>jm(c,u),e.pendingPermissions);return{...e,events:a,lastSeq:o,pendingPermissions:l}}case"permission:request":{if(!r||t.sessionId!==r||e.pendingPermissions.some(s=>s.requestId===t.requestId))return e;const i={requestId:t.requestId,tool:t.tool,input:t.input,...t.toolUseId?{toolUseId:t.toolUseId}:{}};return{...e,pendingPermissions:[...e.pendingPermissions,i]}}case"permission:clear":{if(!r||r!==t.sessionId)return e;const i=t.requestId,s=e.pendingPermissions.findIndex(c=>c.requestId===i),o=s>=0?e.pendingPermissions.filter((c,u)=>u!==s):e.pendingPermissions;if(e.events.length===0)return o===e.pendingPermissions?e:{...e,pendingPermissions:o};const a=e.events.length-1,l=e.events[a];return l.kind==="permission_request"&&l.requestId===i?{...e,pendingPermissions:o,events:e.events.slice(0,a)}:o===e.pendingPermissions?e:{...e,pendingPermissions:o}}case"session:question":return!r||t.sessionId!==r?e:{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{toolUseId:t.toolUseId,requestId:t.requestId,questions:t.questions}}};case"session:question:clear":{if(!r||t.sessionId!==r||!(t.toolUseId in e.pendingQuestions))return e;const{[t.toolUseId]:i,...s}=e.pendingQuestions;return{...e,pendingQuestions:s}}case"session:question:submitted":{if(!r||t.sessionId!==r)return e;const i=e.pendingQuestions[t.toolUseId];return i?{...e,pendingQuestions:{...e.pendingQuestions,[t.toolUseId]:{...i,submittedAnswers:t.answers}}}:e}case"session:rewound":return!r||t.sessionId!==r?e:{...e,pendingPermissions:[],status:"idle"};case"ready":{if(!r)return e;const i=t.runningSessions.find(o=>o.sessionId===r);if(i!=null&&i.freshSpawn)return{...eu,sessionId:r};const s=(i==null?void 0:i.status)??"idle";return s===e.status?e:{...e,status:s}}case"daemon:disconnected":return{...e,pendingPermissions:[]};default:return e}}const Zz="session/";function Jz(e){return{sid:e.slice(Zz.length)}}const e$=new Set(XT);function dI(e){return e$.has(e)}function zw(e){return dI(e)?e:"idle"}function t$(e,t){return{start(n){const{sid:r}=Jz(n);let i=!1,s=-1;const o=f=>{t(n,p=>uI(p??eu,f,r))},a=async f=>{const p=f==="baseline"?-1:s;try{const m=await e.request("session:events",{sessionId:r,afterSeq:p});if(i)return;const v=m.events??[],w=m.latestSeq??-1;if(f==="baseline")o({type:"session:events",sessionId:r,events:v,latestSeq:w}),s=w;else{const x=m.bufferStartSeq??0,_=w<p||x>p+1;o({type:_?"session:events":"session:events:append",sessionId:r,events:v,latestSeq:w}),s=Math.max(s,w)}}catch{}},l=async()=>{try{const f=await e.request("info");if(i)return;o({type:"ready",runningSessions:(f.runningSessions??[]).map(p=>({sessionId:p.sessionId,freshSpawn:p.freshSpawn,status:zw(p.status)}))})}catch{}},c=async()=>{try{await e.request("session:subscribe",{sessionId:r})}catch{}i||(await a(s<0?"baseline":"delta"),!i&&await l())},u=e.onFrame((f,p)=>{if(!i)if(f==="session:event"){const m=p;if(m.sessionId!==r)return;const v=m.event.seq;Me("session-events","push session:event",{sid:r,kind:m.event.kind,seq:v,lastSeqBefore:s}),o({type:"session:event",sessionId:m.sessionId,event:m.event}),typeof v=="number"&&v>s&&(s=v)}else if(f==="session:status"){const m=p;if(m.sessionId!==r)return;if(!dI(m.status)){Me("session-events","push session:status drop",{sid:r,status:m.status});return}Me("session-events","push session:status",{sid:r,status:m.status}),o({type:"session:status",sessionId:m.sessionId,status:m.status})}else if(f==="session:cleared"){if(p.sessionId!==r)return;Me("session-events","push session:cleared",{sid:r}),o({type:"session:change",sessionId:r}),s=-1}else if(f==="session:queue"){const m=p;if(m.sessionId!==r)return;Me("session-events","push session:queue",{sid:r,count:m.items.length}),o({type:"session:queue",sessionId:m.sessionId,items:m.items})}else if(f==="permission:request"){const m=p;if(m.sessionId!==r)return;o({type:"permission:request",sessionId:m.sessionId,requestId:m.requestId,tool:m.tool,input:m.input,...typeof m.toolUseId=="string"&&m.toolUseId?{toolUseId:m.toolUseId}:{}})}else if(f==="session:question"){const m=p;if(m.sessionId!==r)return;o({type:"session:question",sessionId:m.sessionId,toolUseId:m.toolUseId,requestId:m.requestId,questions:m.questions})}else if(f==="session:question:cleared"){const m=p;if(m.sessionId!==r)return;m.answers&&Object.keys(m.answers).length>0?o({type:"session:question:submitted",sessionId:m.sessionId,toolUseId:m.toolUseId,answers:m.answers}):o({type:"session:question:clear",sessionId:m.sessionId,toolUseId:m.toolUseId})}else if(f==="session:rewound"){const m=p;if(m.sessionId!==r)return;o({type:"session:rewound",sessionId:m.sessionId,userMessageId:m.userMessageId})}else f==="ready"&&o({type:"ready",runningSessions:(p.runningSessions??[]).map(v=>({sessionId:v.sessionId,freshSpawn:v.freshSpawn,status:zw(v.status)}))})}),d=e.onConnect(()=>{c()});return e.isConnected&&c(),()=>{i=!0,u(),d(),e.request("session:unsubscribe",{sessionId:r}).catch(()=>{})}}}}const n$=new Set(["tunnel:ready","tunnel:exited","tunnel:unavailable"]);function r$(e,t){return{start(n){let r=!1;const i=async()=>{try{const a=await e.request("info",void 0);if(r)return;t(n,()=>a)}catch{}},s=e.onConnect(()=>{i()}),o=e.onFrame(a=>{n$.has(a)&&i()});return i(),()=>{r=!0,s(),o()}}}}function i$(){return{start(){return()=>{}}}}function s$(e,t){return{start(n){let r=!1;const i=async()=>{try{const o=await e.request("persona:list",{});if(r)return;t(n,()=>o.personas??[])}catch{}},s=e.onConnect(()=>{i()});return i(),()=>{r=!0,s()}}}}function o$(e){const t=Gz(e),n=Kz();let r=null;const i=(o,a)=>{r==null||r.setData(o,a)};n.register(/^capabilities\//,Xz(t,i)),n.register(/^sessions$/,Qz(t,i)),n.register(/^session\//,t$(t,i)),n.register(/^personas$/,s$(t,i)),n.register(/^persona-detail\//,i$()),n.register(/^daemon-info$/,r$(t,i));const s=qz({onFirstObserver:o=>{o&&n.activate(o)},onLastObserver:o=>{o&&n.deactivate(o)}});return r=s,{cache:s,channel:t}}class X_{constructor(t){this.client=t}info(){return this.client.request("info")}attachmentSignUrl(t){return this.client.request("attachment.signUrl",t)}attachmentGroupAdd(t,n,r){return this.client.request("attachment.groupAdd",{sessionId:t,relPath:n,...r?{label:r}:{}})}attachmentGroupRemove(t,n){return this.client.request("attachment.groupRemove",{sessionId:t,relPath:n})}attachmentGroupList(t){return this.client.request("attachment.groupList",{sessionId:t})}sessionCreate(t){return this.client.request("session:create",t)}projectList(){return this.client.request("project:list")}projectCreate(t){return this.client.request("project:create",{...t.path?{path:t.path}:{},...t.name?{name:t.name}:{}})}projectPatch(t){return this.client.request("project:patch",t)}projectReveal(t){return this.client.request("project:reveal",{path:t})}appBuilderListProjects(){return this.client.request("appBuilder:listProjects",{})}appBuilderGetProject(t){return this.client.request("appBuilder:getProject",{sessionId:t})}appBuilderUpdateProjectPort(t,n){return this.client.request("appBuilder:updateProjectPort",{name:t,newPort:n})}appBuilderStartDevServer(t,n){return this.client.request("appBuilder:startDevServer",{sessionId:t,...n!=null&&n.force?{force:!0}:{}})}appBuilderStopDevServer(t){return this.client.request("appBuilder:stopDevServer",{sessionId:t})}appBuilderPublish(t){return this.client.request("appBuilder:publish",{name:t})}appBuilderDismissPublishJob(t){return this.client.request("appBuilder:dismissPublishJob",{name:t})}sessionList(){return this.client.request("session:list")}sessionGet(t){return this.client.request("session:get",{sessionId:t})}sessionUpdate(t,n){return this.client.request("session:update",{sessionId:t,patch:n})}sessionDelete(t){return this.client.request("session:delete",{sessionId:t})}sessionSend(t,n,r){return this.client.request("session:send",{sessionId:t,text:n,...r!=null&&r.queueWhileRunning?{queueWhileRunning:!0}:{}})}sessionDequeue(t,n){return this.client.request("session:dequeue",{sessionId:t,...n?{id:n}:{}})}sessionStop(t){return this.client.request("session:stop",{sessionId:t})}sessionInterrupt(t){return this.client.request("session:interrupt",{sessionId:t})}sessionRewind(t){return this.client.request("session:rewind",t)}sessionRewindableMessageIds(t){return this.client.request("session:rewindable-message-ids",{sessionId:t})}sessionRewindDiff(t){return this.client.request("session:rewind-diff",t)}sessionNew(t){return this.client.request("session:new",{sessionId:t})}sessionFork(t){return this.client.request("session:fork",t)}sessionResume(t,n){return this.client.request("session:resume",{sessionId:t,toolSessionId:n})}sessionObserve(t){return this.client.request("session:observe",t)}sessionEvents(t,n){return this.client.request("session:events",{sessionId:t,afterSeq:n})}sessionSubscribe(t){return this.client.request("session:subscribe",{sessionId:t})}sessionUnsubscribe(t){return this.client.request("session:unsubscribe",{sessionId:t})}pinSession(t,n){return this.client.request("session:pin",{sessionId:t,pinned:n})}searchSessionContent(t){return this.client.request("session:searchContent",t)}archiveSession(t,n){return this.client.request("session:archive",{sessionId:t,archived:n})}markSessionRead(t){return this.client.request("session:markRead",{sessionId:t})}reorderPins(t){return this.client.request("session:reorderPins",{orderedIds:t})}peerSessionUpsert(t){return this.client.request("peerSession:upsert",t)}peerSessionRemove(t){return this.client.request("peerSession:remove",{sessionId:t})}permissionRespond(t){return this.client.request("permission:respond",t)}answerQuestion(t){return this.client.request("session:answerQuestion",t)}cancelQuestion(t){return this.client.request("session:cancelQuestion",t)}historyProjects(){return this.client.request("history:projects")}historyList(t){return this.client.request("history:list",{projectPath:t})}historyRead(t){return this.client.request("history:read",t)}historySubagents(t){return this.client.request("history:subagents",t)}historySubagentRead(t){return this.client.request("history:subagent-read",t)}listRecentDirs(){return this.client.request("history:recentDirs",{})}getGitRoot(t){return this.client.request("git:root",{cwd:t})}getGitBranch(t){return this.client.request("git:branch",{cwd:t})}listGitBranches(t){return this.client.request("git:branches",{cwd:t})}personaCreate(t){return this.client.request("persona:create",t)}personaList(){return this.client.request("persona:list",{})}personaGet(t){return this.client.request("persona:get",{personaId:t})}personaUpdate(t,n){return this.client.request("persona:update",{personaId:t,patch:n})}personaDelete(t){return this.client.request("persona:delete",{personaId:t})}larkBotBindManual(t,n,r){return this.client.request("larkBot:bindManual",{personaId:t,appId:n,appSecret:r})}larkBotUnbind(t){return this.client.request("larkBot:unbind",{personaId:t})}larkBotStatus(t){return this.client.request("larkBot:status",{personaId:t})}toolsProbe(){return this.client.request("tools:probe",{})}sessionExternalScan(){return this.client.request("session:externalScan",{})}sessionImportExternal(t){return this.client.request("session:importExternal",t)}onboardingComplete(){return this.client.request("onboarding:complete",{})}onboardingIosInterest(){return this.client.request("onboarding:iosInterest",{})}visitorList(){return this.client.request("visitor:list",{})}workspaceList(t={}){return this.client.request("workspace:list",t)}workspaceRead(t){return this.client.request("workspace:read",t)}skillsList(t,n){return this.client.request("skills:list",{cwd:t,...n?{tool:n}:{}})}agentsList(t,n){return this.client.request("agents:list",{cwd:t,...n?{tool:n}:{}})}capabilitiesGet(t="claude"){return this.client.request("capabilities:get",{tool:t})}shiftList(){return this.client.request("shift:list")}deployStart(t){return this.client.request("deploy:start",{personaId:t})}deployGet(t){return this.client.request("deploy:get",{personaId:t})}deployPatch(t,n){return this.client.request("deploy:patch",{personaId:t,patch:n})}deployPutSecret(t,n,r){return this.client.request("deploy:putSecret",{personaId:t,name:n,values:r})}deployRerunJob(t,n){return this.client.request("deploy:rerunJob",{personaId:t,jobId:n})}deployRelease(t){return this.client.request("deploy:release",{personaId:t})}channelList(){return this.client.request("channel:list")}channelCreate(t){return this.client.request("channel:create",t)}channelUpdate(t){return this.client.request("channel:update",t)}channelDelete(t){return this.client.request("channel:delete",t)}topicList(t){return this.client.request("topic:list",t)}topicGet(t){return this.client.request("topic:get",t)}topicCreate(t){return this.client.request("topic:create",t)}topicClose(t){return this.client.request("topic:close",t)}topicRename(t){return this.client.request("topic:rename",t)}topicDelete(t){return this.client.request("topic:delete",t)}githubStatus(){return this.client.request("github:status")}githubPrList(t){return this.client.request("github:prList",{role:t})}githubPrDetail(t){return this.client.request("github:prDetail",{...t})}githubPrMerge(t){return this.client.request("github:prMerge",{...t})}githubPrComment(t){return this.client.request("github:prComment",{...t})}githubPrSetReady(t){return this.client.request("github:prSetReady",{...t})}githubCollaborators(t){return this.client.request("github:collaborators",{...t})}githubPrRequestReviewers(t){return this.client.request("github:prRequestReviewers",{...t})}}function a$(e){const[t,n]=g.useState(e.isOpen?{kind:"connected",url:""}:{kind:"connecting"});return g.useEffect(()=>{const r=e.on("ready",l=>{const c=l;n(u=>({kind:"connected",url:u.kind==="connected"?u.url:"",mode:u.kind==="connected"?u.mode:void 0,daemonVersion:c.version,protocolVersion:c.protocolVersion,daemonSource:c.daemonSource,globalCliVersion:c.globalCliVersion,onboardingCompletedAt:c.onboardingCompletedAt}))}),i=e.on("daemon:connected",l=>{const c=l;n(u=>({kind:"connected",url:c.url,mode:c.mode,daemonVersion:u.kind==="connected"?u.daemonVersion:void 0,protocolVersion:u.kind==="connected"?u.protocolVersion:void 0,daemonSource:u.kind==="connected"?u.daemonSource:void 0,globalCliVersion:u.kind==="connected"?u.globalCliVersion:void 0,onboardingCompletedAt:u.kind==="connected"?u.onboardingCompletedAt:void 0}))}),s=e.on("daemon:disconnected",l=>{const c=(l==null?void 0:l.reason)??"";/auth failed|auth timeout|auth required|auth handshake timeout/i.test(c)?n({kind:"auth-failed",reason:c}):n({kind:"disconnected",reason:c})}),o=e.on("daemon:reconnecting",l=>{const c=l;n({kind:"reconnecting",attempt:c.attempt,nextDelayMs:c.nextDelayMs,scheduledAt:c.scheduledAt??Date.now()})}),a=e.on("daemon:version-mismatch",l=>{const c=l;n({kind:"version-mismatch",daemonProtocol:c.daemonProtocol,supportedProtocol:c.supportedProtocol})});return()=>{r(),i(),s(),o(),a()}},[e]),t}function l$(e){const t=$o(),n=pi(e.kind==="connected"?"sessions":""),r=g.useCallback(async()=>{t.setData("sessions",i=>i??[])},[t]);return{sessions:n??[],loading:!1,loaded:n!==void 0,error:null,refresh:r}}function xl(){const e=yi();return g.useMemo(()=>new X_(e),[e])}function hI(e){return{personaId:e.personaId,label:e.label,model:e.model,effort:e.effort,tool:e.tool,public:e.public,createdAt:e.createdAt,updatedAt:e.updatedAt}}function fI(){const e=$o(),t=xl(),n=pi("personas")??[],r=g.useMemo(()=>n.map(s=>hI(s)),[n]),i=g.useCallback(async()=>{const s=await t.personaList();e.setData("personas",()=>s.personas??[])},[t,e]);return{personas:r,raw:n,loaded:pi("personas")!==void 0,refresh:i}}function pI(e){const{raw:t}=fI(),n=$o(),r=xl(),i=e?t.find(a=>a.personaId===e)??null:null,s=i?hI(i):null,o=g.useCallback(async()=>{if(!e)return;const a=await r.personaList();n.setData("personas",()=>a.personas??[])},[e,r,n]);return{persona:s,raw:i,loaded:!!s,refresh:o}}function c$(e){const t=xl(),n=$o(),r=e?`persona-detail/${e}`:"",i=pi(r),s=g.useCallback(async()=>{const o={personality:"",personalityLocal:"",personalityManaged:!1,skills:[],plugins:[],sandboxSettings:null,codexSandbox:null};if(!e)return o;let a=null;try{a=await t.personaGet(e)}catch(c){Me("personas","personaGet failed → empty detail",{personaId:e,err:c}),a=null}const l=a?{personality:a.personality??"",personalityLocal:a.personalityLocal??"",personalityManaged:a.personalityManaged??!1,skills:a.skills??[],plugins:a.plugins??[],sandboxSettings:a.sandboxSettings??null,codexSandbox:a.codexSandbox??null}:o;return n.setData(r,()=>l),l},[t,n,e,r]);return g.useEffect(()=>{e&&s()},[e,s]),{personality:(i==null?void 0:i.personality)??"",personalityLocal:(i==null?void 0:i.personalityLocal)??"",personalityManaged:(i==null?void 0:i.personalityManaged)??!1,skills:(i==null?void 0:i.skills)??[],plugins:(i==null?void 0:i.plugins)??[],sandboxSettings:(i==null?void 0:i.sandboxSettings)??null,codexSandbox:(i==null?void 0:i.codexSandbox)??null,loaded:i!==void 0,refresh:s}}function mI(){const e=$o(),t=xl();return g.useCallback(async()=>{const n=await t.personaList();e.setData("personas",()=>n.personas??[])},[e,t])}function u$(){const e=xl(),t=mI();return g.useCallback(async(n,r)=>{const i=await e.personaUpdate(n,r);return await t(),i},[e,t])}function d$(){const e=xl(),t=mI();return g.useCallback(async n=>{await e.personaDelete(n),await t()},[e,t])}const $w="clawd:sidebar:tree-collapsed";function h$(e){return e&&typeof e=="object"&&"value"in e?e.value:e}function f$(e){const t=h$(e);if(!Array.isArray(t))return new Set;const n=new Set;for(const r of t)typeof r=="string"&&n.add(r);return n}function p$(){const e=I_(),[t,n]=g.useState(()=>new Set),r=g.useRef(t);r.current=t,g.useEffect(()=>{let l=!1;return(async()=>{try{const c=await e.kv.get($w);if(l)return;n(f$(c))}catch{}})(),()=>{l=!0}},[e]);const i=g.useCallback(l=>{e.kv.set($w,[...l]).catch(()=>{})},[e]),s=g.useCallback(l=>r.current.has(l),[]),o=g.useCallback(l=>{n(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),i(u),u})},[i]),a=g.useCallback(l=>{n(c=>{let u=!1;const d=new Set;for(const f of c)l.has(f)?d.add(f):u=!0;return u?(i(d),d):c})},[i]);return{isCollapsed:s,toggle:o,prune:a}}const Q_=g.createContext(null);function m$(){const e=g.useContext(Q_);if(!e)throw new Error("SessionTreeCollapsedContext.Provider missing — wrap SessionTreeNode tree with <SessionTreeCollapsedContext.Provider value={useSessionTreeCollapsed()}>");return e}/**
|
|
97
97
|
* @license lucide-react v0.577.0 - ISC
|
|
98
98
|
*
|
package/dist/share-ui/guest.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Clawd 分享</title>
|
|
7
|
-
<script type="module" crossorigin src="/share-ui/assets/guest-
|
|
7
|
+
<script type="module" crossorigin src="/share-ui/assets/guest-CfB9KMGo.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/share-ui/assets/guest-DfB6GnKj.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body style="margin: 0">
|