zen-code 4.10.1 → 4.10.2

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.
Files changed (83) hide show
  1. package/dist/app.js +157 -2615
  2. package/dist/chunk-0ddrb30y.js +1 -0
  3. package/dist/chunk-215an3fz.js +1 -0
  4. package/dist/chunk-40ht9pe1.js +91 -0
  5. package/dist/chunk-4wnmk2tj.js +7 -0
  6. package/dist/chunk-4z0w0ng1.js +2 -0
  7. package/dist/chunk-57bj89e2.js +1 -0
  8. package/dist/chunk-5a5mepqj.js +1 -0
  9. package/dist/chunk-5c3bpcpm.js +1 -0
  10. package/dist/chunk-7kw7ss8d.js +1 -0
  11. package/dist/chunk-86m0rmtc.js +1 -0
  12. package/dist/chunk-8f19qk9r.js +26 -0
  13. package/dist/chunk-8tbtavry.js +6 -0
  14. package/dist/chunk-9rayxazs.js +8 -0
  15. package/dist/chunk-a9gpb2tx.js +2 -0
  16. package/dist/chunk-a9tw6d68.js +1 -0
  17. package/dist/chunk-anbtppz1.js +294 -0
  18. package/dist/chunk-bca8tkkr.js +1 -0
  19. package/dist/chunk-bdqds8vh.js +1 -0
  20. package/dist/chunk-bzgznka5.js +3 -0
  21. package/dist/chunk-c7kd2qrp.js +278 -0
  22. package/dist/chunk-dvbb3dd1.js +233 -0
  23. package/dist/chunk-e8kxa5vj.js +140 -0
  24. package/dist/chunk-ehmmd8qc.js +1 -0
  25. package/dist/chunk-ejfa95sm.js +1 -0
  26. package/dist/chunk-f0m4532p.js +54 -0
  27. package/dist/chunk-f7cps5x1.js +1 -0
  28. package/dist/chunk-fbemqjck.js +2 -0
  29. package/dist/chunk-feeqtzv5.js +1 -0
  30. package/dist/chunk-fzh0v6r0.js +6 -0
  31. package/dist/chunk-g2zskge5.js +81 -0
  32. package/dist/chunk-g974hxbz.js +3 -0
  33. package/dist/chunk-g9911ymn.js +1 -0
  34. package/dist/chunk-gfhmzpy7.js +176 -0
  35. package/dist/chunk-gt8c6dne.js +3 -0
  36. package/dist/chunk-h8fdexm4.js +2 -0
  37. package/dist/chunk-hnnwbfqk.js +3 -0
  38. package/dist/chunk-hp2jzn9x.js +166 -0
  39. package/dist/chunk-hve2a279.js +2 -0
  40. package/dist/chunk-js4qp900.js +2 -0
  41. package/dist/chunk-k4q8j7pg.js +2 -0
  42. package/dist/chunk-m21hvv91.js +2 -0
  43. package/dist/chunk-mmx0k2yq.js +1 -0
  44. package/dist/chunk-mnnyjmgw.js +224 -0
  45. package/dist/chunk-mw7x6xqp.js +1 -0
  46. package/dist/chunk-n7s6my89.js +112 -0
  47. package/dist/chunk-n9rpnke9.js +4 -0
  48. package/dist/chunk-nk62q95g.js +93 -0
  49. package/dist/chunk-nmzx5nmt.js +1 -0
  50. package/dist/chunk-nqh1pptf.js +88 -0
  51. package/dist/chunk-nsw5168d.js +2 -0
  52. package/dist/chunk-pe8mzxwn.js +16 -0
  53. package/dist/chunk-pg1ppq4y.js +1 -0
  54. package/dist/chunk-pzb224c5.js +2 -0
  55. package/dist/chunk-q1cxrg0x.js +2 -0
  56. package/dist/chunk-qxebn3jw.js +18 -0
  57. package/dist/chunk-s1tbdcs8.js +4 -0
  58. package/dist/chunk-s5cqejr6.js +79 -0
  59. package/dist/chunk-spa69h7p.js +2 -0
  60. package/dist/chunk-spx7nn8t.js +6 -0
  61. package/dist/chunk-swc7se71.js +2 -0
  62. package/dist/chunk-swyc15ym.js +1 -0
  63. package/dist/chunk-t2s3s6af.js +1 -0
  64. package/dist/chunk-t6440ajd.js +5 -0
  65. package/dist/chunk-tjg2e8v3.js +41 -0
  66. package/dist/chunk-tjvhqr94.js +1 -0
  67. package/dist/chunk-vbb3m0vz.js +1 -0
  68. package/dist/chunk-vdmq9d9x.js +4 -0
  69. package/dist/chunk-vfxjbdz4.js +2 -0
  70. package/dist/chunk-vrnj0659.js +213 -0
  71. package/dist/chunk-wmyc17aa.js +23 -0
  72. package/dist/chunk-wt3p1w1g.js +1 -0
  73. package/dist/chunk-y5ry5c7v.js +1 -0
  74. package/dist/chunk-y8qhrx11.js +2 -0
  75. package/dist/chunk-yy8p9zph.js +2 -0
  76. package/dist/chunk-z61m3anh.js +1 -0
  77. package/dist/chunk-zg54h6gy.js +1 -0
  78. package/dist/chunk-zr90qp47.js +1 -0
  79. package/dist/chunk-zsa62xr0.js +2 -0
  80. package/dist/cli.js +1 -3116
  81. package/dist/nonInteractive.js +180 -1950
  82. package/dist/zen-keyboard.js +3 -358
  83. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import{Fl as L}from"./chunk-y8qhrx11.js";var N=L((O,D)=>{var I=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],M=function(x){var j,z=0,q=0,w=[],B=x.length;for(;z<B;z++)if(j=x.charCodeAt(z),j<128)w[q++]=j;else if(j<2048)w[q++]=j>>6|192,w[q++]=j&63|128;else if((j&64512)===55296&&z+1<x.length&&(x.charCodeAt(z+1)&64512)===56320)j=65536+((j&1023)<<10)+(x.charCodeAt(++z)&1023),w[q++]=j>>18|240,w[q++]=j>>12&63|128,w[q++]=j>>6&63|128,w[q++]=j&63|128;else w[q++]=j>>12|224,w[q++]=j>>6&63|128,w[q++]=j&63|128;return w},J=D.exports=function(x){var j,z=0,q=-1,w=0,B=0,G=typeof x==="string"?M(x):x,K=G.length;while(z<K){if(j=G[z++],q===-1){if(j===123)q=z}else if(j!==125)B=I[(j^B>>8)&255]^B<<8;else if(z-1!==q)return B&16383;w=I[(j^w>>8)&255]^w<<8}return w&16383};D.exports.generateMulti=function(x){var j=1,z=x.length,q=J(x[0]);while(j<z)if(J(x[j++])!==q)return-1;return q}});
2
+ export{N as c};
@@ -0,0 +1,6 @@
1
+ import{Ik as T}from"./chunk-e8kxa5vj.js";import{Dl as R}from"./chunk-y8qhrx11.js";var I=R(T(),1);import A from"fs/promises";import z from"path";import O from"os";class U{skillsDir;projectSkillsDir;constructor(){let b=O.homedir();this.skillsDir=z.join(b,".claude","skills"),this.projectSkillsDir=z.join(process.cwd(),".claude","skills")}async listSkills(){let b=new Map,g=await this.listSkillsInDir(this.skillsDir);for(let q of g)b.set(q.name,q);let x=await this.listSkillsInDir(this.projectSkillsDir);for(let q of x)b.set(q.name,q);return Array.from(b.values())}async listSkillsInDir(b){try{let g=await A.readdir(b,{withFileTypes:!0}),x=[];for(let q of g){let F=z.join(b,q.name),J=await A.lstat(F).catch(()=>null);if(!J)continue;let K=await A.stat(F).catch(()=>null);if(!K||!K.isDirectory())continue;if(J.isSymbolicLink()){let C=z.resolve(F),G=z.resolve(b),N=C.substring(G.length);if(!(C===G||N.startsWith("/")||N==="")){let Q=O.homedir();if(!C.startsWith(Q))continue}}let L=z.join(F,"SKILL.md");try{let C=await A.readFile(L,"utf-8"),G=this.parseFrontmatter(C);x.push({name:q.name,description:G.description||"",path:L})}catch{}}return x}catch{return[]}}async getSkill(b){let g=z.join(this.projectSkillsDir,b,"SKILL.md");try{let q=await A.readFile(g,"utf-8");return this.parseSkillContent(q)}catch{}let x=z.join(this.skillsDir,b,"SKILL.md");try{let q=await A.readFile(x,"utf-8");return this.parseSkillContent(q)}catch{return null}}async saveSkill(b,g){let x=z.join(this.skillsDir,b);await A.mkdir(x,{recursive:!0});let q=this.formatSkillContent(g);await A.writeFile(z.join(x,"SKILL.md"),q,"utf-8")}async deleteSkill(b){let g=z.join(this.skillsDir,b);await A.rm(g,{recursive:!0,force:!0})}async syncFromRemote(b){let g=await b.listRemoteSkills();for(let x of g){let q=await b.fetchSkill(x.name);if(q)await this.saveSkill(x.name,q)}}parseFrontmatter(b){let g=b.match(/^---\n(.+?)\n---/s);if(!g)return{};try{return I.default.parse(g[1])}catch{return{}}}parseSkillContent(b){let g=this.parseFrontmatter(b),x=b.replace(/^---\n.+?\n---\n*/s,"");return{frontmatter:g,markdown:x}}formatSkillContent(b){return`---
2
+ ${I.default.stringify(b.frontmatter).trim()}
3
+ ---
4
+
5
+ ${b.markdown}`}}
6
+ export{U as gf};
@@ -0,0 +1,2 @@
1
+ import{Jd as P,La as X,Nd as U,Ud as j,Vd as A,_ as T,lb as $}from"./chunk-n9rpnke9.js";import{Il as E}from"./chunk-y8qhrx11.js";var Z=class{constructor(z){this.createDriver=z}createDriver;createQueryCompiler(){return new U}createAdapter(){return new A}createIntrospector(z){return new j(z)}},F=class{promise;resolve;async lock(){while(this.promise)await this.promise;this.promise=new Promise((z)=>{this.resolve=z})}unlock(){let z=this.resolve;this.promise=void 0,this.resolve=void 0,z?.()}};async function V(z,H,J,O,K){await J.executeQuery(K(X.createWithChildren([X.createWithSql(`${z} `),T.create(O)]),H()))}var _=class{mutex=new F;conn;savepoint;releaseSavepoint;rollbackToSavepoint;init;constructor(z){this.init=()=>import("./chunk-mw7x6xqp.js").then(({createQueryId:H})=>{if(H)this.savepoint=V.bind(null,"savepoint",H),this.releaseSavepoint=V.bind(null,"release",H),this.rollbackToSavepoint=V.bind(null,"rollback to",H)}).then(z)}async acquireConnection(){return await this.mutex.lock(),this.conn}async beginTransaction(z){await z.executeQuery(P.raw("begin"))}async commitTransaction(z){await z.executeQuery(P.raw("commit"))}async rollbackTransaction(z){await z.executeQuery(P.raw("rollback"))}async releaseConnection(){this.mutex.unlock()}};function L(z){return async(H,J,O)=>{let K=await z.all(J,O);return H||K.length?{rows:K}:{rows:[],...await z.run("select 1")}}}function M(z){return z===void 0||z===null?void 0:BigInt(z)}var R=class extends _{db;constructor(z,H){super(async()=>{this.db=await z(),this.conn=new W(this.db),await H?.(this.conn)})}async destroy(){await this.db?.close()}},W=class{constructor(z){this.db=z}async*streamQuery({parameters:z,query:H,sql:J}){if(!this.db.iterator)throw Error("streamQuery() is not supported.");let O=this.db.iterator($.is(H),J,z);for await(let K of O)yield{rows:[K]}}async executeQuery({parameters:z,query:H,sql:J}){return await this.db.query($.is(H),J,z)}},b=class extends Z{constructor(z,H){super(()=>new R(z,H))}};
2
+ export{Z as d,L as e,M as f,b as g};
@@ -0,0 +1 @@
1
+ import{lf as c}from"./chunk-zsa62xr0.js";import"./chunk-n7s6my89.js";import"./chunk-yy8p9zph.js";import{bg as a,cg as b}from"./chunk-mnnyjmgw.js";import"./chunk-fzh0v6r0.js";import"./chunk-t6440ajd.js";import"./chunk-f0m4532p.js";import"./chunk-pe8mzxwn.js";import"./chunk-hp2jzn9x.js";import"./chunk-nk62q95g.js";import"./chunk-nmzx5nmt.js";import"./chunk-e8kxa5vj.js";import"./chunk-q1cxrg0x.js";import"./chunk-tjg2e8v3.js";import"./chunk-nsw5168d.js";import"./chunk-hve2a279.js";import"./chunk-y8qhrx11.js";export{a as getAgentListFromPackage,c as createSubAgentsMiddleware,b as SubAgentsMiddleware};
@@ -0,0 +1 @@
1
+ import{Re as a}from"./chunk-anbtppz1.js";import"./chunk-f0m4532p.js";import"./chunk-pe8mzxwn.js";import"./chunk-hp2jzn9x.js";import"./chunk-nk62q95g.js";import"./chunk-nmzx5nmt.js";import"./chunk-q1cxrg0x.js";import"./chunk-tjg2e8v3.js";import"./chunk-hve2a279.js";import"./chunk-y8qhrx11.js";export{a as WebMiddleware};
@@ -0,0 +1,5 @@
1
+ import{Gk as m}from"./chunk-nmzx5nmt.js";var B=Symbol("Let zodToJsonSchema decide on which parser to use");var M={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},U=(t)=>typeof t==="string"?{...M,name:t}:{...M,...t};var b=(t,n)=>{let r=0;for(;r<t.length&&r<n.length;r++)if(t[r]!==n[r])break;return[(t.length-r).toString(),...n.slice(r)].join("/")};function D(t){if(t.target!=="openAi")return{};let n=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?b(n,t.currentPath):n.join("/")}}function S(t,n,r,o){if(!o?.errorMessages)return;if(r)t.errorMessage={...t.errorMessage,[n]:r}}function e(t,n,r,o,p){t[n]=r,S(t,n,o,p)}function w(t,n){let r={type:"array"};if(t.type?._def&&t.type?._def?.typeName!==m.ZodAny)r.items=i(t.type._def,{...n,currentPath:[...n.currentPath,"items"]});if(t.minLength)e(r,"minItems",t.minLength.value,t.minLength.message,n);if(t.maxLength)e(r,"maxItems",t.maxLength.value,t.maxLength.message,n);if(t.exactLength)e(r,"minItems",t.exactLength.value,t.exactLength.message,n),e(r,"maxItems",t.exactLength.value,t.exactLength.message,n);return r}function E(t,n){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"min":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"minimum",o.value,o.message,n);else e(r,"exclusiveMinimum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMinimum=!0;e(r,"minimum",o.value,o.message,n)}break;case"max":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"maximum",o.value,o.message,n);else e(r,"exclusiveMaximum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMaximum=!0;e(r,"maximum",o.value,o.message,n)}break;case"multipleOf":e(r,"multipleOf",o.value,o.message,n);break}return r}function K(){return{type:"boolean"}}function N(t,n){return i(t.type._def,n)}var $=(t,n)=>{return i(t.innerType._def,n)};function O(t,n,r){let o=r??n.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((p,u)=>O(t,n,p))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return it(t,n)}}var it=(t,n)=>{let r={type:"integer",format:"unix-time"};if(n.target==="openApi3")return r;for(let o of t.checks)switch(o.kind){case"min":e(r,"minimum",o.value,o.message,n);break;case"max":e(r,"maximum",o.value,o.message,n);break}return r};function J(t,n){return{...i(t.innerType._def,n),default:t.defaultValue()}}function q(t,n){return n.effectStrategy==="input"?i(t.schema._def,n):D(n)}function Q(t){return{type:"string",enum:Array.from(t.values)}}var ut=(t)=>{if("type"in t&&t.type==="string")return!1;return"allOf"in t};function X(t,n){let r=[i(t.left._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),i(t.right._def,{...n,currentPath:[...n.currentPath,"allOf","1"]})].filter((u)=>!!u),o=n.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,p=[];return r.forEach((u)=>{if(ut(u)){if(p.push(...u.allOf),u.unevaluatedProperties===void 0)o=void 0}else{let l=u;if("additionalProperties"in u&&u.additionalProperties===!1){let{additionalProperties:y,...a}=u;l=a}else o=void 0;p.push(l)}}),p.length?{allOf:p,...o}:void 0}function Y(t,n){let r=typeof t.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(t.value)?"array":"object"};if(n.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[t.value]};return{type:r==="bigint"?"integer":r,const:t.value}}var I=void 0,Z={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(I===void 0)I=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return I},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function A(t,n){let r={type:"string"};if(t.checks)for(let o of t.checks)switch(o.kind){case"min":e(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,n);break;case"max":e(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,n);break;case"email":switch(n.emailStrategy){case"format:email":v(r,"email",o.message,n);break;case"format:idn-email":v(r,"idn-email",o.message,n);break;case"pattern:zod":g(r,Z.email,o.message,n);break}break;case"url":v(r,"uri",o.message,n);break;case"uuid":v(r,"uuid",o.message,n);break;case"regex":g(r,o.regex,o.message,n);break;case"cuid":g(r,Z.cuid,o.message,n);break;case"cuid2":g(r,Z.cuid2,o.message,n);break;case"startsWith":g(r,RegExp(`^${L(o.value,n)}`),o.message,n);break;case"endsWith":g(r,RegExp(`${L(o.value,n)}$`),o.message,n);break;case"datetime":v(r,"date-time",o.message,n);break;case"date":v(r,"date",o.message,n);break;case"time":v(r,"time",o.message,n);break;case"duration":v(r,"duration",o.message,n);break;case"length":e(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,n),e(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,n);break;case"includes":{g(r,RegExp(L(o.value,n)),o.message,n);break}case"ip":{if(o.version!=="v6")v(r,"ipv4",o.message,n);if(o.version!=="v4")v(r,"ipv6",o.message,n);break}case"base64url":g(r,Z.base64url,o.message,n);break;case"jwt":g(r,Z.jwt,o.message,n);break;case"cidr":{if(o.version!=="v6")g(r,Z.ipv4Cidr,o.message,n);if(o.version!=="v4")g(r,Z.ipv6Cidr,o.message,n);break}case"emoji":g(r,Z.emoji(),o.message,n);break;case"ulid":{g(r,Z.ulid,o.message,n);break}case"base64":{switch(n.base64Strategy){case"format:binary":{v(r,"binary",o.message,n);break}case"contentEncoding:base64":{e(r,"contentEncoding","base64",o.message,n);break}case"pattern:zod":{g(r,Z.base64,o.message,n);break}}break}case"nanoid":g(r,Z.nanoid,o.message,n);case"toLowerCase":case"toUpperCase":case"trim":break;default:((p)=>{})(o)}return r}function L(t,n){return n.patternStrategy==="escape"?at(t):t}var mt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function at(t){let n="";for(let r=0;r<t.length;r++){if(!mt.has(t[r]))n+="\\";n+=t[r]}return n}function v(t,n,r,o){if(t.format||t.anyOf?.some((p)=>p.format)){if(!t.anyOf)t.anyOf=[];if(t.format){if(t.anyOf.push({format:t.format,...t.errorMessage&&o.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage){if(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0)delete t.errorMessage}}t.anyOf.push({format:n,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else e(t,"format",n,r,o)}function g(t,n,r,o){if(t.pattern||t.allOf?.some((p)=>p.pattern)){if(!t.allOf)t.allOf=[];if(t.pattern){if(t.allOf.push({pattern:t.pattern,...t.errorMessage&&o.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage){if(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0)delete t.errorMessage}}t.allOf.push({pattern:H(n,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else e(t,"pattern",H(n,o),r,o)}function H(t,n){if(!n.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},o=r.i?t.source.toLowerCase():t.source,p="",u=!1,l=!1,y=!1;for(let a=0;a<o.length;a++){if(u){p+=o[a],u=!1;continue}if(r.i){if(l){if(o[a].match(/[a-z]/)){if(y)p+=o[a],p+=`${o[a-2]}-${o[a]}`.toUpperCase(),y=!1;else if(o[a+1]==="-"&&o[a+2]?.match(/[a-z]/))p+=o[a],y=!0;else p+=`${o[a]}${o[a].toUpperCase()}`;continue}}else if(o[a].match(/[a-z]/)){p+=`[${o[a]}${o[a].toUpperCase()}]`;continue}}if(r.m){if(o[a]==="^"){p+=`(^|(?<=[\r
2
+ ]))`;continue}else if(o[a]==="$"){p+=`($|(?=[\r
3
+ ]))`;continue}}if(r.s&&o[a]==="."){p+=l?`${o[a]}\r
4
+ `:`[${o[a]}\r
5
+ ]`;continue}if(p+=o[a],o[a]==="\\")u=!0;else if(l&&o[a]==="]")l=!1;else if(!l&&o[a]==="[")l=!0}try{new RegExp(p)}catch{return console.warn(`Could not convert regex pattern at ${n.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return p}function P(t,n){if(n.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(n.target==="openApi3"&&t.keyType?._def.typeName===m.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((o,p)=>({...o,[p]:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"properties",p]})??D(n)}),{}),additionalProperties:n.rejectedAdditionalProperties};let r={type:"object",additionalProperties:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"additionalProperties"]})??n.allowedAdditionalProperties};if(n.target==="openApi3")return r;if(t.keyType?._def.typeName===m.ZodString&&t.keyType._def.checks?.length){let{type:o,...p}=A(t.keyType._def,n);return{...r,propertyNames:p}}else if(t.keyType?._def.typeName===m.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};else if(t.keyType?._def.typeName===m.ZodBranded&&t.keyType._def.type._def.typeName===m.ZodString&&t.keyType._def.type._def.checks?.length){let{type:o,...p}=N(t.keyType._def,n);return{...r,propertyNames:p}}return r}function V(t,n){if(n.mapStrategy==="record")return P(t,n);let r=i(t.keyType._def,{...n,currentPath:[...n.currentPath,"items","items","0"]})||D(n),o=i(t.valueType._def,{...n,currentPath:[...n.currentPath,"items","items","1"]})||D(n);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function W(t){let n=t.values,o=Object.keys(t.values).filter((u)=>{return typeof n[n[u]]!=="number"}).map((u)=>n[u]),p=Array.from(new Set(o.map((u)=>typeof u)));return{type:p.length===1?p[0]==="string"?"string":"number":["string","number"],enum:o}}function z(t){return t.target==="openAi"?void 0:{not:D({...t,currentPath:[...t.currentPath,"not"]})}}function F(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var _={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function G(t,n){if(n.target==="openApi3")return d(t,n);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every((o)=>(o._def.typeName in _)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((p,u)=>{let l=_[u._def.typeName];return l&&!p.includes(l)?[...p,l]:p},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((p,u)=>{let l=typeof u._def.value;switch(l){case"string":case"number":case"boolean":return[...p,l];case"bigint":return[...p,"integer"];case"object":if(u._def.value===null)return[...p,"null"];case"symbol":case"undefined":case"function":default:return p}},[]);if(o.length===r.length){let p=o.filter((u,l,y)=>y.indexOf(u)===l);return{type:p.length>1?p:p[0],enum:r.reduce((u,l)=>{return u.includes(l._def.value)?u:[...u,l._def.value]},[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,p)=>[...o,...p._def.values.filter((u)=>!o.includes(u))],[])};return d(t,n)}var d=(t,n)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((o,p)=>i(o._def,{...n,currentPath:[...n.currentPath,"anyOf",`${p}`]})).filter((o)=>!!o&&(!n.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function j(t,n){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length)){if(n.target==="openApi3")return{type:_[t.innerType._def.typeName],nullable:!0};return{type:[_[t.innerType._def.typeName],"null"]}}if(n.target==="openApi3"){let o=i(t.innerType._def,{...n,currentPath:[...n.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=i(t.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function C(t,n){let r={type:"number"};if(!t.checks)return r;for(let o of t.checks)switch(o.kind){case"int":r.type="integer",S(r,"type",o.message,n);break;case"min":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"minimum",o.value,o.message,n);else e(r,"exclusiveMinimum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMinimum=!0;e(r,"minimum",o.value,o.message,n)}break;case"max":if(n.target==="jsonSchema7")if(o.inclusive)e(r,"maximum",o.value,o.message,n);else e(r,"exclusiveMaximum",o.value,o.message,n);else{if(!o.inclusive)r.exclusiveMaximum=!0;e(r,"maximum",o.value,o.message,n)}break;case"multipleOf":e(r,"multipleOf",o.value,o.message,n);break}return r}function R(t,n){let r=n.target==="openAi",o={type:"object",properties:{}},p=[],u=t.shape();for(let y in u){let a=u[y];if(a===void 0||a._def===void 0)continue;let x=lt(a);if(x&&r){if(a._def.typeName==="ZodOptional")a=a._def.innerType;if(!a.isNullable())a=a.nullable();x=!1}let T=i(a._def,{...n,currentPath:[...n.currentPath,"properties",y],propertyPath:[...n.currentPath,"properties",y]});if(T===void 0)continue;if(o.properties[y]=T,!x)p.push(y)}if(p.length)o.required=p;let l=et(t,n);if(l!==void 0)o.additionalProperties=l;return o}function et(t,n){if(t.catchall._def.typeName!=="ZodNever")return i(t.catchall._def,{...n,currentPath:[...n.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return n.allowedAdditionalProperties;case"strict":return n.rejectedAdditionalProperties;case"strip":return n.removeAdditionalStrategy==="strict"?n.allowedAdditionalProperties:n.rejectedAdditionalProperties}}function lt(t){try{return t.isOptional()}catch{return!0}}var k=(t,n)=>{if(n.currentPath.toString()===n.propertyPath?.toString())return i(t.innerType._def,n);let r=i(t.innerType._def,{...n,currentPath:[...n.currentPath,"anyOf","1"]});return r?{anyOf:[{not:D(n)},r]}:D(n)};var c=(t,n)=>{if(n.pipeStrategy==="input")return i(t.in._def,n);else if(n.pipeStrategy==="output")return i(t.out._def,n);let r=i(t.in._def,{...n,currentPath:[...n.currentPath,"allOf","0"]}),o=i(t.out._def,{...n,currentPath:[...n.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((p)=>p!==void 0)}};function h(t,n){return i(t.type._def,n)}function f(t,n){let o={type:"array",uniqueItems:!0,items:i(t.valueType._def,{...n,currentPath:[...n.currentPath,"items"]})};if(t.minSize)e(o,"minItems",t.minSize.value,t.minSize.message,n);if(t.maxSize)e(o,"maxItems",t.maxSize.value,t.maxSize.message,n);return o}function s(t,n){if(t.rest)return{type:"array",minItems:t.items.length,items:t.items.map((r,o)=>i(r._def,{...n,currentPath:[...n.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:i(t.rest._def,{...n,currentPath:[...n.currentPath,"additionalItems"]})};else return{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,o)=>i(r._def,{...n,currentPath:[...n.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function tt(t){return{not:D(t)}}function nt(t){return D(t)}var rt=(t,n)=>{return i(t.innerType._def,n)};var ot=(t,n,r)=>{switch(n){case m.ZodString:return A(t,r);case m.ZodNumber:return C(t,r);case m.ZodObject:return R(t,r);case m.ZodBigInt:return E(t,r);case m.ZodBoolean:return K();case m.ZodDate:return O(t,r);case m.ZodUndefined:return tt(r);case m.ZodNull:return F(r);case m.ZodArray:return w(t,r);case m.ZodUnion:case m.ZodDiscriminatedUnion:return G(t,r);case m.ZodIntersection:return X(t,r);case m.ZodTuple:return s(t,r);case m.ZodRecord:return P(t,r);case m.ZodLiteral:return Y(t,r);case m.ZodEnum:return Q(t);case m.ZodNativeEnum:return W(t);case m.ZodNullable:return j(t,r);case m.ZodOptional:return k(t,r);case m.ZodMap:return V(t,r);case m.ZodSet:return f(t,r);case m.ZodLazy:return()=>t.getter()._def;case m.ZodPromise:return h(t,r);case m.ZodNaN:case m.ZodNever:return z(r);case m.ZodEffects:return q(t,r);case m.ZodAny:return D(r);case m.ZodUnknown:return nt(r);case m.ZodDefault:return J(t,r);case m.ZodBranded:return N(t,r);case m.ZodReadonly:return rt(t,r);case m.ZodCatch:return $(t,r);case m.ZodPipeline:return c(t,r);case m.ZodFunction:case m.ZodVoid:case m.ZodSymbol:return;default:return((o)=>{return})(n)}};function i(t,n,r=!1){let o=n.seen.get(t);if(n.override){let y=n.override?.(t,n,o,r);if(y!==B)return y}if(o&&!r){let y=yt(o,n);if(y!==void 0)return y}let p={def:t,path:n.currentPath,jsonSchema:void 0};n.seen.set(t,p);let u=ot(t,t.typeName,n),l=typeof u==="function"?i(u(),n):u;if(l)Dt(t,n,l);if(n.postProcess){let y=n.postProcess(l,t,n);return p.jsonSchema=l,y}return p.jsonSchema=l,l}var yt=(t,n)=>{switch(n.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:b(n.currentPath,t.path)};case"none":case"seen":{if(t.path.length<n.currentPath.length&&t.path.every((r,o)=>n.currentPath[o]===r))return console.warn(`Recursive reference detected at ${n.currentPath.join("/")}! Defaulting to any`),D(n);return n.$refStrategy==="seen"?D(n):void 0}}},Dt=(t,n,r)=>{if(t.description){if(r.description=t.description,n.markdownDescription)r.markdownDescription=t.description}return r};var pt=(t)=>{let n=U(t),r=n.name!==void 0?[...n.basePath,n.definitionPath,n.name]:n.basePath;return{...n,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(n.definitions).map(([o,p])=>[p._def,{def:p._def,path:[...n.basePath,n.definitionPath,o],jsonSchema:void 0}]))}};var gt=(t,n)=>{let r=pt(n),o=typeof n==="object"&&n.definitions?Object.entries(n.definitions).reduce((a,[x,T])=>({...a,[x]:i(T._def,{...r,currentPath:[...r.basePath,r.definitionPath,x]},!0)??D(r)}),{}):void 0,p=typeof n==="string"?n:n?.nameStrategy==="title"?void 0:n?.name,u=i(t._def,p===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,p]},!1)??D(r),l=typeof n==="object"&&n.name!==void 0&&n.nameStrategy==="title"?n.name:void 0;if(l!==void 0)u.title=l;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let y=p===void 0?o?{...u,[r.definitionPath]:o}:u:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,p].join("/"),[r.definitionPath]:{...o,[p]:u}};if(r.target==="jsonSchema7")y.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")y.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in y)||("oneOf"in y)||("allOf"in y)||("type"in y)&&Array.isArray(y.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return y};export{gt as gg};