@tscircuit/runframe 0.0.1421 → 0.0.1422

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.
@@ -236,7 +236,7 @@ Learn more: https://react.dev/warnings/version-mismatch`))})(),typeof Map=="func
236
236
  You might need to use a local HTTP server (instead of file://): https://react.dev/link/react-devtools-faq`:""),"font-weight:bold")}s1.createRoot=function(p,y){if(!h(p))throw Error("Target container is not a DOM element.");qB(p);var _=!1,K="",X=Yy,sA=cg,MA=aC,ZA=null;return y!=null&&(y.hydrate?console.warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof y=="object"&&y!==null&&y.$$typeof===Uc&&console.error(`You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:
237
237
 
238
238
  let root = createRoot(domContainer);
239
- root.render(<App />);`),y.unstable_strictMode===!0&&(_=!0),y.identifierPrefix!==void 0&&(K=y.identifierPrefix),y.onUncaughtError!==void 0&&(X=y.onUncaughtError),y.onCaughtError!==void 0&&(sA=y.onCaughtError),y.onRecoverableError!==void 0&&(MA=y.onRecoverableError),y.unstable_transitionCallbacks!==void 0&&(ZA=y.unstable_transitionCallbacks)),y=de(p,1,!1,null,null,_,K,X,sA,MA,ZA,null),p[Eg]=y.current,H0(p),new ZE(y)},s1.hydrateRoot=function(p,y,_){if(!h(p))throw Error("Target container is not a DOM element.");qB(p),y===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var K=!1,X="",sA=Yy,MA=cg,ZA=aC,Ee=null,ye=null;return _!=null&&(_.unstable_strictMode===!0&&(K=!0),_.identifierPrefix!==void 0&&(X=_.identifierPrefix),_.onUncaughtError!==void 0&&(sA=_.onUncaughtError),_.onCaughtError!==void 0&&(MA=_.onCaughtError),_.onRecoverableError!==void 0&&(ZA=_.onRecoverableError),_.unstable_transitionCallbacks!==void 0&&(Ee=_.unstable_transitionCallbacks),_.formState!==void 0&&(ye=_.formState)),y=de(p,1,!0,y,_??null,K,X,sA,MA,ZA,Ee,ye),y.context=ke(null),_=y.current,K=Rc(_),K=lA(K),X=NB(K),X.callback=null,Wa(_,X,K),_=K,y.current.lanes=_,qA(y,_),RI(y),p[Eg]=y.current,H0(p),new iQ(y)},s1.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),s1}var wmA;function Sde(){if(wmA)return YJ.exports;wmA=1;var t={env:{}};function A(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(t.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A)}catch(e){console.error(e)}}}return t.env.NODE_ENV==="production"?(A(),YJ.exports=wde()):YJ.exports=Dde(),YJ.exports}var bde=Sde(),qJ={exports:{}},T9,DmA;function xde(){if(DmA)return T9;DmA=1;var t=1e3,A=t*60,e=A*60,i=e*24,o=i*7,n=i*365.25;T9=function(I,c){c=c||{};var B=typeof I;if(B==="string"&&I.length>0)return s(I);if(B==="number"&&isFinite(I))return c.long?a(I):r(I);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(I))};function s(I){if(I=String(I),!(I.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(I);if(c){var B=parseFloat(c[1]),l=(c[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return B*n;case"weeks":case"week":case"w":return B*o;case"days":case"day":case"d":return B*i;case"hours":case"hour":case"hrs":case"hr":case"h":return B*e;case"minutes":case"minute":case"mins":case"min":case"m":return B*A;case"seconds":case"second":case"secs":case"sec":case"s":return B*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return B;default:return}}}}function r(I){var c=Math.abs(I);return c>=i?Math.round(I/i)+"d":c>=e?Math.round(I/e)+"h":c>=A?Math.round(I/A)+"m":c>=t?Math.round(I/t)+"s":I+"ms"}function a(I){var c=Math.abs(I);return c>=i?g(I,c,i,"day"):c>=e?g(I,c,e,"hour"):c>=A?g(I,c,A,"minute"):c>=t?g(I,c,t,"second"):I+" ms"}function g(I,c,B,l){var C=c>=B*1.5;return Math.round(I/B)+" "+l+(C?"s":"")}return T9}var q9,SmA;function kde(){if(SmA)return q9;SmA=1;function t(A){i.debug=i,i.default=i,i.coerce=g,i.disable=r,i.enable=n,i.enabled=a,i.humanize=xde(),i.destroy=I,Object.keys(A).forEach(c=>{i[c]=A[c]}),i.names=[],i.skips=[],i.formatters={};function e(c){let B=0;for(let l=0;l<c.length;l++)B=(B<<5)-B+c.charCodeAt(l),B|=0;return i.colors[Math.abs(B)%i.colors.length]}i.selectColor=e;function i(c){let B,l=null,C,Q;function E(...h){if(!E.enabled)return;const u=E,d=Number(new Date),f=d-(B||d);u.diff=f,u.prev=B,u.curr=d,B=d,h[0]=i.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let D=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(x,b)=>{if(x==="%%")return"%";D++;const F=i.formatters[b];if(typeof F=="function"){const k=h[D];x=F.call(u,k),h.splice(D,1),D--}return x}),i.formatArgs.call(u,h),(u.log||i.log).apply(u,h)}return E.namespace=c,E.useColors=i.useColors(),E.color=i.selectColor(c),E.extend=o,E.destroy=i.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(C!==i.namespaces&&(C=i.namespaces,Q=i.enabled(c)),Q),set:h=>{l=h}}),typeof i.init=="function"&&i.init(E),E}function o(c,B){const l=i(this.namespace+(typeof B>"u"?":":B)+c);return l.log=this.log,l}function n(c){i.save(c),i.namespaces=c,i.names=[],i.skips=[];const B=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const l of B)l[0]==="-"?i.skips.push(l.slice(1)):i.names.push(l)}function s(c,B){let l=0,C=0,Q=-1,E=0;for(;l<c.length;)if(C<B.length&&(B[C]===c[l]||B[C]==="*"))B[C]==="*"?(Q=C,E=l,C++):(l++,C++);else if(Q!==-1)C=Q+1,E++,l=E;else return!1;for(;C<B.length&&B[C]==="*";)C++;return C===B.length}function r(){const c=[...i.names,...i.skips.map(B=>"-"+B)].join(",");return i.enable(""),c}function a(c){for(const B of i.skips)if(s(c,B))return!1;for(const B of i.names)if(s(c,B))return!0;return!1}function g(c){return c instanceof Error?c.stack||c.message:c}function I(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.enable(i.load()),i}return q9=t,q9}var bmA;function Gde(){return bmA||(bmA=1,(function(t,A){var e={env:{},version:""};A.formatArgs=o,A.save=n,A.load=s,A.useColors=i,A.storage=r(),A.destroy=(()=>{let g=!1;return()=>{g||(g=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),A.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function i(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let g;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(g=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(g[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(g){if(g[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+g[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const I="color: "+this.color;g.splice(1,0,I,"color: inherit");let c=0,B=0;g[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(c++,l==="%c"&&(B=c))}),g.splice(B,0,I)}A.log=console.debug||console.log||(()=>{});function n(g){try{g?A.storage.setItem("debug",g):A.storage.removeItem("debug")}catch{}}function s(){let g;try{g=A.storage.getItem("debug")||A.storage.getItem("DEBUG")}catch{}return!g&&typeof e<"u"&&"env"in e&&(g=e.env.DEBUG),g}function r(){try{return localStorage}catch{}}t.exports=kde()(A);const{formatters:a}=t.exports;a.j=function(g){try{return JSON.stringify(g)}catch(I){return"[UnexpectedJSONParseError]: "+I.message}}})(qJ,qJ.exports)),qJ.exports}var Fde=Gde();const ca=Np(Fde);var z=qf();const eo=Np(z),r1=e1({__proto__:null,default:eo},[z]);var Ba;(function(t){t.assertEqual=o=>{};function A(o){}t.assertIs=A;function e(o){throw new Error}t.assertNever=e,t.arrayToEnum=o=>{const n={};for(const s of o)n[s]=s;return n},t.getValidEnumValues=o=>{const n=t.objectKeys(o).filter(r=>typeof o[o[r]]!="number"),s={};for(const r of n)s[r]=o[r];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(n){return o[n]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const n=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&n.push(s);return n},t.find=(o,n)=>{for(const s of o)if(n(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function i(o,n=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(n)}t.joinValues=i,t.jsonStringifyReplacer=(o,n)=>typeof n=="bigint"?n.toString():n})(Ba||(Ba={}));var xmA;(function(t){t.mergeShapes=(A,e)=>({...A,...e})})(xmA||(xmA={}));const Wi=Ba.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gb=t=>{switch(typeof t){case"undefined":return Wi.undefined;case"string":return Wi.string;case"number":return Number.isNaN(t)?Wi.nan:Wi.number;case"boolean":return Wi.boolean;case"function":return Wi.function;case"bigint":return Wi.bigint;case"symbol":return Wi.symbol;case"object":return Array.isArray(t)?Wi.array:t===null?Wi.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Wi.promise:typeof Map<"u"&&t instanceof Map?Wi.map:typeof Set<"u"&&t instanceof Set?Wi.set:typeof Date<"u"&&t instanceof Date?Wi.date:Wi.object;default:return Wi.unknown}},Wt=Ba.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 Ay extends Error{get errors(){return this.issues}constructor(A){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=A}format(A){const e=A||function(n){return n.message},i={_errors:[]},o=n=>{for(const s of n.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)i._errors.push(e(s));else{let r=i,a=0;for(;a<s.path.length;){const g=s.path[a];a===s.path.length-1?(r[g]=r[g]||{_errors:[]},r[g]._errors.push(e(s))):r[g]=r[g]||{_errors:[]},r=r[g],a++}}};return o(this),i}static assert(A){if(!(A instanceof Ay))throw new Error(`Not a ZodError: ${A}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ba.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(A=e=>e.message){const e={},i=[];for(const o of this.issues)if(o.path.length>0){const n=o.path[0];e[n]=e[n]||[],e[n].push(A(o))}else i.push(A(o));return{formErrors:i,fieldErrors:e}}get formErrors(){return this.flatten()}}Ay.create=t=>new Ay(t);const a1=(t,A)=>{let e;switch(t.code){case Wt.invalid_type:t.received===Wi.undefined?e="Required":e=`Expected ${t.expected}, received ${t.received}`;break;case Wt.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(t.expected,Ba.jsonStringifyReplacer)}`;break;case Wt.unrecognized_keys:e=`Unrecognized key(s) in object: ${Ba.joinValues(t.keys,", ")}`;break;case Wt.invalid_union:e="Invalid input";break;case Wt.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${Ba.joinValues(t.options)}`;break;case Wt.invalid_enum_value:e=`Invalid enum value. Expected ${Ba.joinValues(t.options)}, received '${t.received}'`;break;case Wt.invalid_arguments:e="Invalid function arguments";break;case Wt.invalid_return_type:e="Invalid function return type";break;case Wt.invalid_date:e="Invalid date";break;case Wt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(e=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?e=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?e=`Invalid input: must end with "${t.validation.endsWith}"`:Ba.assertNever(t.validation):t.validation!=="regex"?e=`Invalid ${t.validation}`:e="Invalid";break;case Wt.too_small:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:e="Invalid input";break;case Wt.too_big:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?e=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:e="Invalid input";break;case Wt.custom:e="Invalid input";break;case Wt.invalid_intersection_types:e="Intersection results could not be merged";break;case Wt.not_multiple_of:e=`Number must be a multiple of ${t.multipleOf}`;break;case Wt.not_finite:e="Number must be finite";break;default:e=A.defaultError,Ba.assertNever(t)}return{message:e}};let _de=a1;function P9(){return _de}const O9=t=>{const{data:A,path:e,errorMaps:i,issueData:o}=t,n=[...e,...o.path||[]],s={...o,path:n};if(o.message!==void 0)return{...o,path:n,message:o.message};let r="";const a=i.filter(g=>!!g).slice().reverse();for(const g of a)r=g(s,{data:A,defaultError:r}).message;return{...o,path:n,message:r}};function bi(t,A){const e=P9(),i=O9({issueData:A,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e,e===a1?void 0:a1].filter(o=>!!o)});t.common.issues.push(i)}class hd{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(A,e){const i=[];for(const o of e){if(o.status==="aborted")return hn;o.status==="dirty"&&A.dirty(),i.push(o.value)}return{status:A.value,value:i}}static async mergeObjectAsync(A,e){const i=[];for(const o of e){const n=await o.key,s=await o.value;i.push({key:n,value:s})}return hd.mergeObjectSync(A,i)}static mergeObjectSync(A,e){const i={};for(const o of e){const{key:n,value:s}=o;if(n.status==="aborted"||s.status==="aborted")return hn;n.status==="dirty"&&A.dirty(),s.status==="dirty"&&A.dirty(),n.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(i[n.value]=s.value)}return{status:A.value,value:i}}}const hn=Object.freeze({status:"aborted"}),g1=t=>({status:"dirty",value:t}),Mp=t=>({status:"valid",value:t}),kmA=t=>t.status==="aborted",GmA=t=>t.status==="dirty",h_=t=>t.status==="valid",PJ=t=>typeof Promise<"u"&&t instanceof Promise;var Do;(function(t){t.errToObj=A=>typeof A=="string"?{message:A}:A||{},t.toString=A=>typeof A=="string"?A:A?.message})(Do||(Do={}));class nw{constructor(A,e,i,o){this._cachedPath=[],this.parent=A,this.data=e,this._path=i,this._key=o}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 FmA=(t,A)=>{if(h_(A))return{success:!0,data:A.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const e=new Ay(t.common.issues);return this._error=e,this._error}}};function Ss(t){if(!t)return{};const{errorMap:A,invalid_type_error:e,required_error:i,description:o}=t;if(A&&(e||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return A?{errorMap:A,description:o}:{errorMap:(s,r)=>{const{message:a}=t;return s.code==="invalid_enum_value"?{message:a??r.defaultError}:typeof r.data>"u"?{message:a??i??r.defaultError}:s.code!=="invalid_type"?{message:r.defaultError}:{message:a??e??r.defaultError}},description:o}}class Br{get description(){return this._def.description}_getType(A){return gb(A.data)}_getOrReturnCtx(A,e){return e||{common:A.parent.common,data:A.data,parsedType:gb(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}_processInputParams(A){return{status:new hd,ctx:{common:A.parent.common,data:A.data,parsedType:gb(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}}_parseSync(A){const e=this._parse(A);if(PJ(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(A){const e=this._parse(A);return Promise.resolve(e)}parse(A,e){const i=this.safeParse(A,e);if(i.success)return i.data;throw i.error}safeParse(A,e){const i={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)},o=this._parseSync({data:A,path:i.path,parent:i});return FmA(i,o)}"~validate"(A){const e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)};if(!this["~standard"].async)try{const i=this._parseSync({data:A,path:[],parent:e});return h_(i)?{value:i.value}:{issues:e.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:A,path:[],parent:e}).then(i=>h_(i)?{value:i.value}:{issues:e.common.issues})}async parseAsync(A,e){const i=await this.safeParseAsync(A,e);if(i.success)return i.data;throw i.error}async safeParseAsync(A,e){const i={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)},o=this._parse({data:A,path:i.path,parent:i}),n=await(PJ(o)?o:Promise.resolve(o));return FmA(i,n)}refine(A,e){const i=o=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(o):e;return this._refinement((o,n)=>{const s=A(o),r=()=>n.addIssue({code:Wt.custom,...i(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(a=>a?!0:(r(),!1)):s?!0:(r(),!1)})}refinement(A,e){return this._refinement((i,o)=>A(i)?!0:(o.addIssue(typeof e=="function"?e(i,o):e),!1))}_refinement(A){return new Yk({schema:this,typeName:_n.ZodEffects,effect:{type:"refinement",refinement:A}})}superRefine(A){return this._refinement(A)}constructor(A){this.spa=this.safeParseAsync,this._def=A,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:e=>this["~validate"](e)}}optional(){return GD.create(this,this._def)}nullable(){return Jk.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sw.create(this)}promise(){return C1.create(this,this._def)}or(A){return ZJ.create([this,A],this._def)}and(A){return VJ.create(this,A,this._def)}transform(A){return new Yk({...Ss(this._def),schema:this,typeName:_n.ZodEffects,effect:{type:"transform",transform:A}})}default(A){const e=typeof A=="function"?A:()=>A;return new XJ({...Ss(this._def),innerType:this,defaultValue:e,typeName:_n.ZodDefault})}brand(){return new HmA({typeName:_n.ZodBranded,type:this,...Ss(this._def)})}catch(A){const e=typeof A=="function"?A:()=>A;return new $J({...Ss(this._def),innerType:this,catchValue:e,typeName:_n.ZodCatch})}describe(A){const e=this.constructor;return new e({...this._def,description:A})}pipe(A){return Aj.create(this,A)}readonly(){return AK.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rde=/^c[^\s-]{8,}$/i,Nde=/^[0-9a-z]+$/,Mde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vde=/^[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,Ude=/^[a-z0-9_-]{21}$/i,Lde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hde=/^[-+]?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)?)??$/,Yde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jde="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let W9;const Kde=/^(?:(?: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])$/,Tde=/^(?:(?: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])$/,qde=/^(([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]))$/,Pde=/^(([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])$/,Ode=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_mA="((\\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])))",Zde=new RegExp(`^${_mA}$`);function RmA(t){let A="[0-5]\\d";t.precision?A=`${A}\\.\\d{${t.precision}}`:t.precision==null&&(A=`${A}(\\.\\d+)?`);const e=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${A})${e}`}function Vde(t){return new RegExp(`^${RmA(t)}$`)}function jde(t){let A=`${_mA}T${RmA(t)}`;const e=[];return e.push(t.local?"Z?":"Z"),t.offset&&e.push("([+-]\\d{2}:?\\d{2})"),A=`${A}(${e.join("|")})`,new RegExp(`^${A}$`)}function zde(t,A){return!!((A==="v4"||!A)&&Kde.test(t)||(A==="v6"||!A)&&qde.test(t))}function Xde(t,A){if(!Lde.test(t))return!1;try{const[e]=t.split(".");if(!e)return!1;const i=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),o=JSON.parse(atob(i));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||A&&o.alg!==A)}catch{return!1}}function $de(t,A){return!!((A==="v4"||!A)&&Tde.test(t)||(A==="v6"||!A)&&Pde.test(t))}class bD extends Br{_parse(A){if(this._def.coerce&&(A.data=String(A.data)),this._getType(A)!==Wi.string){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.string,received:n.parsedType}),hn}const i=new hd;let o;for(const n of this._def.checks)if(n.kind==="min")A.data.length<n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="max")A.data.length>n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="length"){const s=A.data.length>n.value,r=A.data.length<n.value;(s||r)&&(o=this._getOrReturnCtx(A,o),s?bi(o,{code:Wt.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&bi(o,{code:Wt.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),i.dirty())}else if(n.kind==="email")Yde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"email",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="emoji")W9||(W9=new RegExp(Jde,"u")),W9.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"emoji",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="uuid")vde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"uuid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="nanoid")Ude.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"nanoid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid")Rde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cuid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid2")Nde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cuid2",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="ulid")Mde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"ulid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="url")try{new URL(A.data)}catch{o=this._getOrReturnCtx(A,o),bi(o,{validation:"url",code:Wt.invalid_string,message:n.message}),i.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"regex",code:Wt.invalid_string,message:n.message}),i.dirty())):n.kind==="trim"?A.data=A.data.trim():n.kind==="includes"?A.data.includes(n.value,n.position)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),i.dirty()):n.kind==="toLowerCase"?A.data=A.data.toLowerCase():n.kind==="toUpperCase"?A.data=A.data.toUpperCase():n.kind==="startsWith"?A.data.startsWith(n.value)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{startsWith:n.value},message:n.message}),i.dirty()):n.kind==="endsWith"?A.data.endsWith(n.value)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{endsWith:n.value},message:n.message}),i.dirty()):n.kind==="datetime"?jde(n).test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"datetime",message:n.message}),i.dirty()):n.kind==="date"?Zde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"date",message:n.message}),i.dirty()):n.kind==="time"?Vde(n).test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"time",message:n.message}),i.dirty()):n.kind==="duration"?Hde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"duration",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="ip"?zde(A.data,n.version)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"ip",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="jwt"?Xde(A.data,n.alg)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"jwt",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="cidr"?$de(A.data,n.version)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cidr",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="base64"?Ode.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"base64",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="base64url"?Wde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"base64url",code:Wt.invalid_string,message:n.message}),i.dirty()):Ba.assertNever(n);return{status:i.value,value:A.data}}_regex(A,e,i){return this.refinement(o=>A.test(o),{validation:e,code:Wt.invalid_string,...Do.errToObj(i)})}_addCheck(A){return new bD({...this._def,checks:[...this._def.checks,A]})}email(A){return this._addCheck({kind:"email",...Do.errToObj(A)})}url(A){return this._addCheck({kind:"url",...Do.errToObj(A)})}emoji(A){return this._addCheck({kind:"emoji",...Do.errToObj(A)})}uuid(A){return this._addCheck({kind:"uuid",...Do.errToObj(A)})}nanoid(A){return this._addCheck({kind:"nanoid",...Do.errToObj(A)})}cuid(A){return this._addCheck({kind:"cuid",...Do.errToObj(A)})}cuid2(A){return this._addCheck({kind:"cuid2",...Do.errToObj(A)})}ulid(A){return this._addCheck({kind:"ulid",...Do.errToObj(A)})}base64(A){return this._addCheck({kind:"base64",...Do.errToObj(A)})}base64url(A){return this._addCheck({kind:"base64url",...Do.errToObj(A)})}jwt(A){return this._addCheck({kind:"jwt",...Do.errToObj(A)})}ip(A){return this._addCheck({kind:"ip",...Do.errToObj(A)})}cidr(A){return this._addCheck({kind:"cidr",...Do.errToObj(A)})}datetime(A){return typeof A=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:A}):this._addCheck({kind:"datetime",precision:typeof A?.precision>"u"?null:A?.precision,offset:A?.offset??!1,local:A?.local??!1,...Do.errToObj(A?.message)})}date(A){return this._addCheck({kind:"date",message:A})}time(A){return typeof A=="string"?this._addCheck({kind:"time",precision:null,message:A}):this._addCheck({kind:"time",precision:typeof A?.precision>"u"?null:A?.precision,...Do.errToObj(A?.message)})}duration(A){return this._addCheck({kind:"duration",...Do.errToObj(A)})}regex(A,e){return this._addCheck({kind:"regex",regex:A,...Do.errToObj(e)})}includes(A,e){return this._addCheck({kind:"includes",value:A,position:e?.position,...Do.errToObj(e?.message)})}startsWith(A,e){return this._addCheck({kind:"startsWith",value:A,...Do.errToObj(e)})}endsWith(A,e){return this._addCheck({kind:"endsWith",value:A,...Do.errToObj(e)})}min(A,e){return this._addCheck({kind:"min",value:A,...Do.errToObj(e)})}max(A,e){return this._addCheck({kind:"max",value:A,...Do.errToObj(e)})}length(A,e){return this._addCheck({kind:"length",value:A,...Do.errToObj(e)})}nonempty(A){return this.min(1,Do.errToObj(A))}trim(){return new bD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bD({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(A=>A.kind==="datetime")}get isDate(){return!!this._def.checks.find(A=>A.kind==="date")}get isTime(){return!!this._def.checks.find(A=>A.kind==="time")}get isDuration(){return!!this._def.checks.find(A=>A.kind==="duration")}get isEmail(){return!!this._def.checks.find(A=>A.kind==="email")}get isURL(){return!!this._def.checks.find(A=>A.kind==="url")}get isEmoji(){return!!this._def.checks.find(A=>A.kind==="emoji")}get isUUID(){return!!this._def.checks.find(A=>A.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(A=>A.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(A=>A.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(A=>A.kind==="cuid2")}get isULID(){return!!this._def.checks.find(A=>A.kind==="ulid")}get isIP(){return!!this._def.checks.find(A=>A.kind==="ip")}get isCIDR(){return!!this._def.checks.find(A=>A.kind==="cidr")}get isBase64(){return!!this._def.checks.find(A=>A.kind==="base64")}get isBase64url(){return!!this._def.checks.find(A=>A.kind==="base64url")}get minLength(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxLength(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}}bD.create=t=>new bD({checks:[],typeName:_n.ZodString,coerce:t?.coerce??!1,...Ss(t)});function Ape(t,A){const e=(t.toString().split(".")[1]||"").length,i=(A.toString().split(".")[1]||"").length,o=e>i?e:i,n=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(A.toFixed(o).replace(".",""));return n%s/10**o}class u_ extends Br{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(A){if(this._def.coerce&&(A.data=Number(A.data)),this._getType(A)!==Wi.number){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.number,received:n.parsedType}),hn}let i;const o=new hd;for(const n of this._def.checks)n.kind==="int"?Ba.isInteger(A.data)||(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()):n.kind==="min"?(n.inclusive?A.data<n.value:A.data<=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()):n.kind==="max"?(n.inclusive?A.data>n.value:A.data>=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()):n.kind==="multipleOf"?Ape(A.data,n.value)!==0&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()):n.kind==="finite"?Number.isFinite(A.data)||(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_finite,message:n.message}),o.dirty()):Ba.assertNever(n);return{status:o.value,value:A.data}}gte(A,e){return this.setLimit("min",A,!0,Do.toString(e))}gt(A,e){return this.setLimit("min",A,!1,Do.toString(e))}lte(A,e){return this.setLimit("max",A,!0,Do.toString(e))}lt(A,e){return this.setLimit("max",A,!1,Do.toString(e))}setLimit(A,e,i,o){return new u_({...this._def,checks:[...this._def.checks,{kind:A,value:e,inclusive:i,message:Do.toString(o)}]})}_addCheck(A){return new u_({...this._def,checks:[...this._def.checks,A]})}int(A){return this._addCheck({kind:"int",message:Do.toString(A)})}positive(A){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Do.toString(A)})}negative(A){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Do.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Do.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Do.toString(A)})}multipleOf(A,e){return this._addCheck({kind:"multipleOf",value:A,message:Do.toString(e)})}finite(A){return this._addCheck({kind:"finite",message:Do.toString(A)})}safe(A){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Do.toString(A)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Do.toString(A)})}get minValue(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxValue(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}get isInt(){return!!this._def.checks.find(A=>A.kind==="int"||A.kind==="multipleOf"&&Ba.isInteger(A.value))}get isFinite(){let A=null,e=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(e===null||i.value>e)&&(e=i.value):i.kind==="max"&&(A===null||i.value<A)&&(A=i.value)}return Number.isFinite(e)&&Number.isFinite(A)}}u_.create=t=>new u_({checks:[],typeName:_n.ZodNumber,coerce:t?.coerce||!1,...Ss(t)});class I1 extends Br{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(A){if(this._def.coerce)try{A.data=BigInt(A.data)}catch{return this._getInvalidInput(A)}if(this._getType(A)!==Wi.bigint)return this._getInvalidInput(A);let i;const o=new hd;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?A.data<n.value:A.data<=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()):n.kind==="max"?(n.inclusive?A.data>n.value:A.data>=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()):n.kind==="multipleOf"?A.data%n.value!==BigInt(0)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()):Ba.assertNever(n);return{status:o.value,value:A.data}}_getInvalidInput(A){const e=this._getOrReturnCtx(A);return bi(e,{code:Wt.invalid_type,expected:Wi.bigint,received:e.parsedType}),hn}gte(A,e){return this.setLimit("min",A,!0,Do.toString(e))}gt(A,e){return this.setLimit("min",A,!1,Do.toString(e))}lte(A,e){return this.setLimit("max",A,!0,Do.toString(e))}lt(A,e){return this.setLimit("max",A,!1,Do.toString(e))}setLimit(A,e,i,o){return new I1({...this._def,checks:[...this._def.checks,{kind:A,value:e,inclusive:i,message:Do.toString(o)}]})}_addCheck(A){return new I1({...this._def,checks:[...this._def.checks,A]})}positive(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Do.toString(A)})}negative(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Do.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Do.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Do.toString(A)})}multipleOf(A,e){return this._addCheck({kind:"multipleOf",value:A,message:Do.toString(e)})}get minValue(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxValue(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}}I1.create=t=>new I1({checks:[],typeName:_n.ZodBigInt,coerce:t?.coerce??!1,...Ss(t)});class Z9 extends Br{_parse(A){if(this._def.coerce&&(A.data=!!A.data),this._getType(A)!==Wi.boolean){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.boolean,received:i.parsedType}),hn}return Mp(A.data)}}Z9.create=t=>new Z9({typeName:_n.ZodBoolean,coerce:t?.coerce||!1,...Ss(t)});class OJ extends Br{_parse(A){if(this._def.coerce&&(A.data=new Date(A.data)),this._getType(A)!==Wi.date){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.date,received:n.parsedType}),hn}if(Number.isNaN(A.data.getTime())){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_date}),hn}const i=new hd;let o;for(const n of this._def.checks)n.kind==="min"?A.data.getTime()<n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),i.dirty()):n.kind==="max"?A.data.getTime()>n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),i.dirty()):Ba.assertNever(n);return{status:i.value,value:new Date(A.data.getTime())}}_addCheck(A){return new OJ({...this._def,checks:[...this._def.checks,A]})}min(A,e){return this._addCheck({kind:"min",value:A.getTime(),message:Do.toString(e)})}max(A,e){return this._addCheck({kind:"max",value:A.getTime(),message:Do.toString(e)})}get minDate(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A!=null?new Date(A):null}get maxDate(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A!=null?new Date(A):null}}OJ.create=t=>new OJ({checks:[],coerce:t?.coerce||!1,typeName:_n.ZodDate,...Ss(t)});class NmA extends Br{_parse(A){if(this._getType(A)!==Wi.symbol){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.symbol,received:i.parsedType}),hn}return Mp(A.data)}}NmA.create=t=>new NmA({typeName:_n.ZodSymbol,...Ss(t)});class V9 extends Br{_parse(A){if(this._getType(A)!==Wi.undefined){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.undefined,received:i.parsedType}),hn}return Mp(A.data)}}V9.create=t=>new V9({typeName:_n.ZodUndefined,...Ss(t)});class WJ extends Br{_parse(A){if(this._getType(A)!==Wi.null){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.null,received:i.parsedType}),hn}return Mp(A.data)}}WJ.create=t=>new WJ({typeName:_n.ZodNull,...Ss(t)});class c1 extends Br{constructor(){super(...arguments),this._any=!0}_parse(A){return Mp(A.data)}}c1.create=t=>new c1({typeName:_n.ZodAny,...Ss(t)});class d_ extends Br{constructor(){super(...arguments),this._unknown=!0}_parse(A){return Mp(A.data)}}d_.create=t=>new d_({typeName:_n.ZodUnknown,...Ss(t)});class Ib extends Br{_parse(A){const e=this._getOrReturnCtx(A);return bi(e,{code:Wt.invalid_type,expected:Wi.never,received:e.parsedType}),hn}}Ib.create=t=>new Ib({typeName:_n.ZodNever,...Ss(t)});class MmA extends Br{_parse(A){if(this._getType(A)!==Wi.undefined){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.void,received:i.parsedType}),hn}return Mp(A.data)}}MmA.create=t=>new MmA({typeName:_n.ZodVoid,...Ss(t)});class sw extends Br{_parse(A){const{ctx:e,status:i}=this._processInputParams(A),o=this._def;if(e.parsedType!==Wi.array)return bi(e,{code:Wt.invalid_type,expected:Wi.array,received:e.parsedType}),hn;if(o.exactLength!==null){const s=e.data.length>o.exactLength.value,r=e.data.length<o.exactLength.value;(s||r)&&(bi(e,{code:s?Wt.too_big:Wt.too_small,minimum:r?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&e.data.length<o.minLength.value&&(bi(e,{code:Wt.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&e.data.length>o.maxLength.value&&(bi(e,{code:Wt.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),e.common.async)return Promise.all([...e.data].map((s,r)=>o.type._parseAsync(new nw(e,s,e.path,r)))).then(s=>hd.mergeArray(i,s));const n=[...e.data].map((s,r)=>o.type._parseSync(new nw(e,s,e.path,r)));return hd.mergeArray(i,n)}get element(){return this._def.type}min(A,e){return new sw({...this._def,minLength:{value:A,message:Do.toString(e)}})}max(A,e){return new sw({...this._def,maxLength:{value:A,message:Do.toString(e)}})}length(A,e){return new sw({...this._def,exactLength:{value:A,message:Do.toString(e)}})}nonempty(A){return this.min(1,A)}}sw.create=(t,A)=>new sw({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_n.ZodArray,...Ss(A)});function p_(t){if(t instanceof DC){const A={};for(const e in t.shape){const i=t.shape[e];A[e]=GD.create(p_(i))}return new DC({...t._def,shape:()=>A})}else return t instanceof sw?new sw({...t._def,type:p_(t.element)}):t instanceof GD?GD.create(p_(t.unwrap())):t instanceof Jk?Jk.create(p_(t.unwrap())):t instanceof kD?kD.create(t.items.map(A=>p_(A))):t}class DC extends Br{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const A=this._def.shape(),e=Ba.objectKeys(A);return this._cached={shape:A,keys:e},this._cached}_parse(A){if(this._getType(A)!==Wi.object){const g=this._getOrReturnCtx(A);return bi(g,{code:Wt.invalid_type,expected:Wi.object,received:g.parsedType}),hn}const{status:i,ctx:o}=this._processInputParams(A),{shape:n,keys:s}=this._getCached(),r=[];if(!(this._def.catchall instanceof Ib&&this._def.unknownKeys==="strip"))for(const g in o.data)s.includes(g)||r.push(g);const a=[];for(const g of s){const I=n[g],c=o.data[g];a.push({key:{status:"valid",value:g},value:I._parse(new nw(o,c,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof Ib){const g=this._def.unknownKeys;if(g==="passthrough")for(const I of r)a.push({key:{status:"valid",value:I},value:{status:"valid",value:o.data[I]}});else if(g==="strict")r.length>0&&(bi(o,{code:Wt.unrecognized_keys,keys:r}),i.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const I of r){const c=o.data[I];a.push({key:{status:"valid",value:I},value:g._parse(new nw(o,c,o.path,I)),alwaysSet:I in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const I of a){const c=await I.key,B=await I.value;g.push({key:c,value:B,alwaysSet:I.alwaysSet})}return g}).then(g=>hd.mergeObjectSync(i,g)):hd.mergeObjectSync(i,a)}get shape(){return this._def.shape()}strict(A){return Do.errToObj,new DC({...this._def,unknownKeys:"strict",...A!==void 0?{errorMap:(e,i)=>{const o=this._def.errorMap?.(e,i).message??i.defaultError;return e.code==="unrecognized_keys"?{message:Do.errToObj(A).message??o}:{message:o}}}:{}})}strip(){return new DC({...this._def,unknownKeys:"strip"})}passthrough(){return new DC({...this._def,unknownKeys:"passthrough"})}extend(A){return new DC({...this._def,shape:()=>({...this._def.shape(),...A})})}merge(A){return new DC({unknownKeys:A._def.unknownKeys,catchall:A._def.catchall,shape:()=>({...this._def.shape(),...A._def.shape()}),typeName:_n.ZodObject})}setKey(A,e){return this.augment({[A]:e})}catchall(A){return new DC({...this._def,catchall:A})}pick(A){const e={};for(const i of Ba.objectKeys(A))A[i]&&this.shape[i]&&(e[i]=this.shape[i]);return new DC({...this._def,shape:()=>e})}omit(A){const e={};for(const i of Ba.objectKeys(this.shape))A[i]||(e[i]=this.shape[i]);return new DC({...this._def,shape:()=>e})}deepPartial(){return p_(this)}partial(A){const e={};for(const i of Ba.objectKeys(this.shape)){const o=this.shape[i];A&&!A[i]?e[i]=o:e[i]=o.optional()}return new DC({...this._def,shape:()=>e})}required(A){const e={};for(const i of Ba.objectKeys(this.shape))if(A&&!A[i])e[i]=this.shape[i];else{let n=this.shape[i];for(;n instanceof GD;)n=n._def.innerType;e[i]=n}return new DC({...this._def,shape:()=>e})}keyof(){return UmA(Ba.objectKeys(this.shape))}}DC.create=(t,A)=>new DC({shape:()=>t,unknownKeys:"strip",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)}),DC.strictCreate=(t,A)=>new DC({shape:()=>t,unknownKeys:"strict",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)}),DC.lazycreate=(t,A)=>new DC({shape:t,unknownKeys:"strip",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)});class ZJ extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i=this._def.options;function o(n){for(const r of n)if(r.result.status==="valid")return r.result;for(const r of n)if(r.result.status==="dirty")return e.common.issues.push(...r.ctx.common.issues),r.result;const s=n.map(r=>new Ay(r.ctx.common.issues));return bi(e,{code:Wt.invalid_union,unionErrors:s}),hn}if(e.common.async)return Promise.all(i.map(async n=>{const s={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(o);{let n;const s=[];for(const a of i){const g={...e,common:{...e.common,issues:[]},parent:null},I=a._parseSync({data:e.data,path:e.path,parent:g});if(I.status==="valid")return I;I.status==="dirty"&&!n&&(n={result:I,ctx:g}),g.common.issues.length&&s.push(g.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;const r=s.map(a=>new Ay(a));return bi(e,{code:Wt.invalid_union,unionErrors:r}),hn}}get options(){return this._def.options}}ZJ.create=(t,A)=>new ZJ({options:t,typeName:_n.ZodUnion,...Ss(A)});const xD=t=>t instanceof X9?xD(t.schema):t instanceof Yk?xD(t.innerType()):t instanceof zJ?[t.value]:t instanceof Hk?t.options:t instanceof $9?Ba.objectValues(t.enum):t instanceof XJ?xD(t._def.innerType):t instanceof V9?[void 0]:t instanceof WJ?[null]:t instanceof GD?[void 0,...xD(t.unwrap())]:t instanceof Jk?[null,...xD(t.unwrap())]:t instanceof HmA||t instanceof AK?xD(t.unwrap()):t instanceof $J?xD(t._def.innerType):[];class j9 extends Br{_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.object)return bi(e,{code:Wt.invalid_type,expected:Wi.object,received:e.parsedType}),hn;const i=this.discriminator,o=e.data[i],n=this.optionsMap.get(o);return n?e.common.async?n._parseAsync({data:e.data,path:e.path,parent:e}):n._parseSync({data:e.data,path:e.path,parent:e}):(bi(e,{code:Wt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),hn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(A,e,i){const o=new Map;for(const n of e){const s=xD(n.shape[A]);if(!s.length)throw new Error(`A discriminator value for key \`${A}\` could not be extracted from all schema options`);for(const r of s){if(o.has(r))throw new Error(`Discriminator property ${String(A)} has duplicate value ${String(r)}`);o.set(r,n)}}return new j9({typeName:_n.ZodDiscriminatedUnion,discriminator:A,options:e,optionsMap:o,...Ss(i)})}}function z9(t,A){const e=gb(t),i=gb(A);if(t===A)return{valid:!0,data:t};if(e===Wi.object&&i===Wi.object){const o=Ba.objectKeys(A),n=Ba.objectKeys(t).filter(r=>o.indexOf(r)!==-1),s={...t,...A};for(const r of n){const a=z9(t[r],A[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}else if(e===Wi.array&&i===Wi.array){if(t.length!==A.length)return{valid:!1};const o=[];for(let n=0;n<t.length;n++){const s=t[n],r=A[n],a=z9(s,r);if(!a.valid)return{valid:!1};o.push(a.data)}return{valid:!0,data:o}}else return e===Wi.date&&i===Wi.date&&+t==+A?{valid:!0,data:t}:{valid:!1}}class VJ extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A),o=(n,s)=>{if(kmA(n)||kmA(s))return hn;const r=z9(n.value,s.value);return r.valid?((GmA(n)||GmA(s))&&e.dirty(),{status:e.value,value:r.data}):(bi(i,{code:Wt.invalid_intersection_types}),hn)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([n,s])=>o(n,s)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}VJ.create=(t,A,e)=>new VJ({left:t,right:A,typeName:_n.ZodIntersection,...Ss(e)});class kD extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.array)return bi(i,{code:Wt.invalid_type,expected:Wi.array,received:i.parsedType}),hn;if(i.data.length<this._def.items.length)return bi(i,{code:Wt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),hn;!this._def.rest&&i.data.length>this._def.items.length&&(bi(i,{code:Wt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());const n=[...i.data].map((s,r)=>{const a=this._def.items[r]||this._def.rest;return a?a._parse(new nw(i,s,i.path,r)):null}).filter(s=>!!s);return i.common.async?Promise.all(n).then(s=>hd.mergeArray(e,s)):hd.mergeArray(e,n)}get items(){return this._def.items}rest(A){return new kD({...this._def,rest:A})}}kD.create=(t,A)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kD({items:t,typeName:_n.ZodTuple,rest:null,...Ss(A)})};class jJ extends Br{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.object)return bi(i,{code:Wt.invalid_type,expected:Wi.object,received:i.parsedType}),hn;const o=[],n=this._def.keyType,s=this._def.valueType;for(const r in i.data)o.push({key:n._parse(new nw(i,r,i.path,r)),value:s._parse(new nw(i,i.data[r],i.path,r)),alwaysSet:r in i.data});return i.common.async?hd.mergeObjectAsync(e,o):hd.mergeObjectSync(e,o)}get element(){return this._def.valueType}static create(A,e,i){return e instanceof Br?new jJ({keyType:A,valueType:e,typeName:_n.ZodRecord,...Ss(i)}):new jJ({keyType:bD.create(),valueType:A,typeName:_n.ZodRecord,...Ss(e)})}}class vmA extends Br{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.map)return bi(i,{code:Wt.invalid_type,expected:Wi.map,received:i.parsedType}),hn;const o=this._def.keyType,n=this._def.valueType,s=[...i.data.entries()].map(([r,a],g)=>({key:o._parse(new nw(i,r,i.path,[g,"key"])),value:n._parse(new nw(i,a,i.path,[g,"value"]))}));if(i.common.async){const r=new Map;return Promise.resolve().then(async()=>{for(const a of s){const g=await a.key,I=await a.value;if(g.status==="aborted"||I.status==="aborted")return hn;(g.status==="dirty"||I.status==="dirty")&&e.dirty(),r.set(g.value,I.value)}return{status:e.value,value:r}})}else{const r=new Map;for(const a of s){const g=a.key,I=a.value;if(g.status==="aborted"||I.status==="aborted")return hn;(g.status==="dirty"||I.status==="dirty")&&e.dirty(),r.set(g.value,I.value)}return{status:e.value,value:r}}}}vmA.create=(t,A,e)=>new vmA({valueType:A,keyType:t,typeName:_n.ZodMap,...Ss(e)});class B1 extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.set)return bi(i,{code:Wt.invalid_type,expected:Wi.set,received:i.parsedType}),hn;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(bi(i,{code:Wt.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),e.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(bi(i,{code:Wt.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),e.dirty());const n=this._def.valueType;function s(a){const g=new Set;for(const I of a){if(I.status==="aborted")return hn;I.status==="dirty"&&e.dirty(),g.add(I.value)}return{status:e.value,value:g}}const r=[...i.data.values()].map((a,g)=>n._parse(new nw(i,a,i.path,g)));return i.common.async?Promise.all(r).then(a=>s(a)):s(r)}min(A,e){return new B1({...this._def,minSize:{value:A,message:Do.toString(e)}})}max(A,e){return new B1({...this._def,maxSize:{value:A,message:Do.toString(e)}})}size(A,e){return this.min(A,e).max(A,e)}nonempty(A){return this.min(1,A)}}B1.create=(t,A)=>new B1({valueType:t,minSize:null,maxSize:null,typeName:_n.ZodSet,...Ss(A)});class l1 extends Br{constructor(){super(...arguments),this.validate=this.implement}_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.function)return bi(e,{code:Wt.invalid_type,expected:Wi.function,received:e.parsedType}),hn;function i(r,a){return O9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,P9(),a1].filter(g=>!!g),issueData:{code:Wt.invalid_arguments,argumentsError:a}})}function o(r,a){return O9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,P9(),a1].filter(g=>!!g),issueData:{code:Wt.invalid_return_type,returnTypeError:a}})}const n={errorMap:e.common.contextualErrorMap},s=e.data;if(this._def.returns instanceof C1){const r=this;return Mp(async function(...a){const g=new Ay([]),I=await r._def.args.parseAsync(a,n).catch(l=>{throw g.addIssue(i(a,l)),g}),c=await Reflect.apply(s,this,I);return await r._def.returns._def.type.parseAsync(c,n).catch(l=>{throw g.addIssue(o(c,l)),g})})}else{const r=this;return Mp(function(...a){const g=r._def.args.safeParse(a,n);if(!g.success)throw new Ay([i(a,g.error)]);const I=Reflect.apply(s,this,g.data),c=r._def.returns.safeParse(I,n);if(!c.success)throw new Ay([o(I,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...A){return new l1({...this._def,args:kD.create(A).rest(d_.create())})}returns(A){return new l1({...this._def,returns:A})}implement(A){return this.parse(A)}strictImplement(A){return this.parse(A)}static create(A,e,i){return new l1({args:A||kD.create([]).rest(d_.create()),returns:e||d_.create(),typeName:_n.ZodFunction,...Ss(i)})}}class X9 extends Br{get schema(){return this._def.getter()}_parse(A){const{ctx:e}=this._processInputParams(A);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}X9.create=(t,A)=>new X9({getter:t,typeName:_n.ZodLazy,...Ss(A)});class zJ extends Br{_parse(A){if(A.data!==this._def.value){const e=this._getOrReturnCtx(A);return bi(e,{received:e.data,code:Wt.invalid_literal,expected:this._def.value}),hn}return{status:"valid",value:A.data}}get value(){return this._def.value}}zJ.create=(t,A)=>new zJ({value:t,typeName:_n.ZodLiteral,...Ss(A)});function UmA(t,A){return new Hk({values:t,typeName:_n.ZodEnum,...Ss(A)})}class Hk extends Br{_parse(A){if(typeof A.data!="string"){const e=this._getOrReturnCtx(A),i=this._def.values;return bi(e,{expected:Ba.joinValues(i),received:e.parsedType,code:Wt.invalid_type}),hn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(A.data)){const e=this._getOrReturnCtx(A),i=this._def.values;return bi(e,{received:e.data,code:Wt.invalid_enum_value,options:i}),hn}return Mp(A.data)}get options(){return this._def.values}get enum(){const A={};for(const e of this._def.values)A[e]=e;return A}get Values(){const A={};for(const e of this._def.values)A[e]=e;return A}get Enum(){const A={};for(const e of this._def.values)A[e]=e;return A}extract(A,e=this._def){return Hk.create(A,{...this._def,...e})}exclude(A,e=this._def){return Hk.create(this.options.filter(i=>!A.includes(i)),{...this._def,...e})}}Hk.create=UmA;class $9 extends Br{_parse(A){const e=Ba.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(A);if(i.parsedType!==Wi.string&&i.parsedType!==Wi.number){const o=Ba.objectValues(e);return bi(i,{expected:Ba.joinValues(o),received:i.parsedType,code:Wt.invalid_type}),hn}if(this._cache||(this._cache=new Set(Ba.getValidEnumValues(this._def.values))),!this._cache.has(A.data)){const o=Ba.objectValues(e);return bi(i,{received:i.data,code:Wt.invalid_enum_value,options:o}),hn}return Mp(A.data)}get enum(){return this._def.values}}$9.create=(t,A)=>new $9({values:t,typeName:_n.ZodNativeEnum,...Ss(A)});class C1 extends Br{unwrap(){return this._def.type}_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.promise&&e.common.async===!1)return bi(e,{code:Wt.invalid_type,expected:Wi.promise,received:e.parsedType}),hn;const i=e.parsedType===Wi.promise?e.data:Promise.resolve(e.data);return Mp(i.then(o=>this._def.type.parseAsync(o,{path:e.path,errorMap:e.common.contextualErrorMap})))}}C1.create=(t,A)=>new C1({type:t,typeName:_n.ZodPromise,...Ss(A)});class Yk extends Br{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_n.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(A){const{status:e,ctx:i}=this._processInputParams(A),o=this._def.effect||null,n={addIssue:s=>{bi(i,s),s.fatal?e.abort():e.dirty()},get path(){return i.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){const s=o.transform(i.data,n);if(i.common.async)return Promise.resolve(s).then(async r=>{if(e.value==="aborted")return hn;const a=await this._def.schema._parseAsync({data:r,path:i.path,parent:i});return a.status==="aborted"?hn:a.status==="dirty"||e.value==="dirty"?g1(a.value):a});{if(e.value==="aborted")return hn;const r=this._def.schema._parseSync({data:s,path:i.path,parent:i});return r.status==="aborted"?hn:r.status==="dirty"||e.value==="dirty"?g1(r.value):r}}if(o.type==="refinement"){const s=r=>{const a=o.refinement(r,n);if(i.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(i.common.async===!1){const r=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?hn:(r.status==="dirty"&&e.dirty(),s(r.value),{status:e.value,value:r.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(r=>r.status==="aborted"?hn:(r.status==="dirty"&&e.dirty(),s(r.value).then(()=>({status:e.value,value:r.value}))))}if(o.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!h_(s))return hn;const r=o.transform(s.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:r}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>h_(s)?Promise.resolve(o.transform(s.value,n)).then(r=>({status:e.value,value:r})):hn);Ba.assertNever(o)}}Yk.create=(t,A,e)=>new Yk({schema:t,typeName:_n.ZodEffects,effect:A,...Ss(e)}),Yk.createWithPreprocess=(t,A,e)=>new Yk({schema:A,effect:{type:"preprocess",transform:t},typeName:_n.ZodEffects,...Ss(e)});class GD extends Br{_parse(A){return this._getType(A)===Wi.undefined?Mp(void 0):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}GD.create=(t,A)=>new GD({innerType:t,typeName:_n.ZodOptional,...Ss(A)});class Jk extends Br{_parse(A){return this._getType(A)===Wi.null?Mp(null):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}Jk.create=(t,A)=>new Jk({innerType:t,typeName:_n.ZodNullable,...Ss(A)});class XJ extends Br{_parse(A){const{ctx:e}=this._processInputParams(A);let i=e.data;return e.parsedType===Wi.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}XJ.create=(t,A)=>new XJ({innerType:t,typeName:_n.ZodDefault,defaultValue:typeof A.default=="function"?A.default:()=>A.default,...Ss(A)});class $J extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i={...e,common:{...e.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return PJ(o)?o.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ay(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ay(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}$J.create=(t,A)=>new $J({innerType:t,typeName:_n.ZodCatch,catchValue:typeof A.catch=="function"?A.catch:()=>A.catch,...Ss(A)});class LmA extends Br{_parse(A){if(this._getType(A)!==Wi.nan){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.nan,received:i.parsedType}),hn}return{status:"valid",value:A.data}}}LmA.create=t=>new LmA({typeName:_n.ZodNaN,...Ss(t)});class HmA extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i=e.data;return this._def.type._parse({data:i,path:e.path,parent:e})}unwrap(){return this._def.type}}class Aj extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?hn:n.status==="dirty"?(e.dirty(),g1(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?hn:o.status==="dirty"?(e.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(A,e){return new Aj({in:A,out:e,typeName:_n.ZodPipeline})}}class AK extends Br{_parse(A){const e=this._def.innerType._parse(A),i=o=>(h_(o)&&(o.value=Object.freeze(o.value)),o);return PJ(e)?e.then(o=>i(o)):i(e)}unwrap(){return this._def.innerType}}AK.create=(t,A)=>new AK({innerType:t,typeName:_n.ZodReadonly,...Ss(A)});function YmA(t,A){const e=typeof t=="function"?t(A):typeof t=="string"?{message:t}:t;return typeof e=="string"?{message:e}:e}function sh(t,A={},e){return t?c1.create().superRefine((i,o)=>{const n=t(i);if(n instanceof Promise)return n.then(s=>{if(!s){const r=YmA(A,i),a=r.fatal??e??!0;o.addIssue({code:"custom",...r,fatal:a})}});if(!n){const s=YmA(A,i),r=s.fatal??e??!0;o.addIssue({code:"custom",...s,fatal:r})}}):c1.create()}var _n;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_n||(_n={}));const v=bD.create,vA=u_.create,te=Z9.create,JmA=WJ.create,Tg=c1.create,epe=d_.create;Ib.create;const fe=sw.create,xA=DC.create,Zt=ZJ.create,nE=j9.create;VJ.create,kD.create;const Aa=jJ.create,cb=l1.create,QA=zJ.create,Ze=Hk.create,Bb=C1.create;GD.create,Jk.create;var KmA={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},wa=t=>{let A=typeof t=="number"?"mm":t.replace(/^[^a-zA-Z]+/g,"").toLowerCase();A||(A="mm");const e=typeof t=="number"?t:Number.parseFloat(t.split(A)[0]);if(A in KmA)return e*KmA[A];throw new Error(`Unsupported unit: ${A}`)},Q1=wa,TmA={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{fs:1e-12,ps:1e-9,ns:1e-6,us:.001,µs:.001,ms:1,s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},ej=new Set;for(const[t,A]of Object.entries(TmA)){ej.add(t);for(const e of Object.keys(A.variants))ej.add(e)}function tpe(t){for(const[A,e]of Object.entries(TmA))if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};return{baseUnit:t,conversionFactor:1}}var qmA={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12};function Am(t){if(t==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t=="string"&&t.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t=="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t=="object"&&"x"in t&&"y"in t){const{parsedUnit:r,unitOfValue:a}=Am(t.x),g=Am(t.x),I=Am(t.y);return g.value===null||I.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:r,unitOfValue:a,value:{x:g.value,y:I.value}}}const e=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!e)throw new Error(`Could not determine unit: "${t}"`);const i=e.split("").reverse().join(""),o=t.slice(0,-i.length);if(i in qmA&&!ej.has(i)){const r=qmA[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(o)*r}}const{baseUnit:n,conversionFactor:s}=tpe(i);return{parsedUnit:i,unitOfValue:n,value:s*Number.parseFloat(o)}}var f_=v().or(vA()).transform(t=>Am(t).value),y_=v().or(vA()).transform(t=>Am(t).value).transform(t=>Number.parseFloat(t.toPrecision(12))),tj=v().or(vA()).transform(t=>Am(t).value),ey=v().or(vA()).transform(t=>Am(t).value),VA=v().or(vA()).transform(t=>Am(t).value),FD=v().or(vA()).transform(t=>Am(t).value),ce=VA,ipe=v().or(vA()).transform(t=>Am(t).value),E1=v().or(vA()).transform(t=>Am(t).value),ope=E1,Pf=E1,PmA=v().datetime(),CI=v().or(vA()).transform(t=>typeof t=="number"?t:t.endsWith("deg")?Number.parseFloat(t.split("deg")[0]):t.endsWith("rad")?Number.parseFloat(t.split("rad")[0])*180/Math.PI:Number.parseFloat(t)),OmA=vA().or(v().endsWith("mAh")).transform(t=>{if(typeof t=="string"){const A=t.replace("mAh",""),e=Number.parseFloat(A);if(Number.isNaN(e))throw new Error("Invalid capacity");return e}return t}).describe("Battery capacity in mAh"),Bo=xA({x:ce,y:ce}),npe=Bo,m_=xA({x:ce,y:ce,z:ce}),spe=m_,ij=xA({width:vA(),height:vA()}),rpe=t=>{const A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>A[Math.floor(Math.random()*A.length)]).join("")},Ai=t=>v().optional().default(()=>`${t}_${rpe(10)}`),Kk=Ze(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),eK=Ze(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),dB=xA({type:QA("source_component"),ftype:v().optional(),source_component_id:v(),name:v(),manufacturer_part_number:v().optional(),supplier_part_numbers:Aa(eK,fe(v())).optional(),display_value:v().optional(),are_pins_interchangeable:te().optional(),internally_connected_source_port_ids:fe(fe(v())).optional(),source_group_id:v().optional(),subcircuit_id:v().optional()}),oj=dB.extend({ftype:QA("simple_capacitor"),capacitance:y_,max_voltage_rating:ey.optional(),display_capacitance:v().optional(),max_decoupling_trace_length:ce.optional()}),nj=dB.extend({ftype:QA("simple_resistor"),resistance:f_,display_resistance:v().optional()}),tK=dB.extend({ftype:QA("simple_diode")}),WmA=dB.extend({ftype:QA("simple_fiducial")}),sj=tK.extend({ftype:QA("simple_led"),color:v().optional(),wavelength:v().optional()}),ZmA=dB.extend({ftype:QA("simple_ground")}),rj=dB.extend({ftype:QA("simple_chip")}),aj=dB.extend({ftype:QA("simple_power_source"),voltage:ey}),ape=dB.extend({ftype:QA("simple_fuse"),current_rating_amps:vA().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:vA().describe("Voltage rating in volts, e.g. ±5V would be 5")}),gj=dB.extend({ftype:QA("simple_battery"),capacity:OmA}),Ij=dB.extend({ftype:QA("simple_inductor"),inductance:tj,max_current_rating:vA().optional()}),cj=dB.extend({ftype:QA("simple_push_button")}),Bj=dB.extend({ftype:QA("simple_potentiometer"),max_resistance:f_}),VmA=dB.extend({ftype:QA("simple_crystal"),frequency:vA().describe("Frequency in Hz"),load_capacitance:vA().optional().describe("Load capacitance in pF")}),lj=dB.extend({ftype:QA("simple_pin_header"),pin_count:vA(),gender:Ze(["male","female"]).optional().default("male")}),Cj=dB.extend({ftype:QA("simple_pinout")}),Qj=dB.extend({ftype:QA("simple_resonator"),load_capacitance:y_,equivalent_series_resistance:f_.optional(),frequency:FD}),Ej=dB.extend({ftype:QA("simple_transistor"),transistor_type:Ze(["npn","pnp"])}),hj=dB.extend({ftype:QA("simple_test_point"),footprint_variant:Ze(["pad","through_hole"]).optional(),pad_shape:Ze(["rect","circle"]).optional(),pad_diameter:Zt([vA(),v()]).optional(),hole_diameter:Zt([vA(),v()]).optional(),width:Zt([vA(),v()]).optional(),height:Zt([vA(),v()]).optional()}),uj=dB.extend({ftype:QA("simple_mosfet"),channel_type:Ze(["n","p"]),mosfet_mode:Ze(["enhancement","depletion"])}),dj=dB.extend({ftype:QA("simple_switch")}),pj=xA({type:QA("source_project_metadata"),name:v().optional(),software_used_string:v().optional(),project_url:v().optional(),created_at:PmA.optional()}),jmA=xA({type:QA("source_missing_property_error"),source_missing_property_error_id:Ai("source_missing_property_error"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_missing_property_error").default("source_missing_property_error"),message:v()}).describe("The source code is missing a property"),zmA=xA({type:QA("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:Ai("source_failed_to_create_component_error"),error_type:QA("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:v().optional(),subcircuit_id:v().optional(),parent_source_component_id:v().optional(),message:v(),pcb_center:xA({x:vA().optional(),y:vA().optional()}).optional(),schematic_center:xA({x:vA().optional(),y:vA().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),fj=xA({type:QA("source_trace_not_connected_error"),source_trace_not_connected_error_id:Ai("source_trace_not_connected_error"),error_type:QA("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:v(),subcircuit_id:v().optional(),source_group_id:v().optional(),source_trace_id:v().optional(),connected_source_port_ids:fe(v()).optional(),selectors_not_found:fe(v()).optional()}).describe("Occurs when a source trace selector does not match any ports"),XmA=xA({type:QA("source_property_ignored_warning"),source_property_ignored_warning_id:Ai("source_property_ignored_warning"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_property_ignored_warning").default("source_property_ignored_warning"),message:v()}).describe("The source property was ignored"),yj=xA({type:QA("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:Ai("source_pin_missing_trace_warning"),warning_type:QA("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),$mA=dB.extend({ftype:QA("simple_voltage_probe")}),AwA=dB.extend({ftype:QA("interconnect")}),ewA=Zt([nj,oj,tK,WmA,sj,ZmA,rj,aj,gj,Ij,cj,Bj,VmA,lj,Cj,Qj,dj,Ej,hj,uj,ape,$mA,AwA,pj,jmA,zmA,fj,XmA,yj]),twA=xA({type:QA("source_port"),pin_number:vA().optional(),port_hints:fe(v()).optional(),name:v(),source_port_id:v(),source_component_id:v().optional(),source_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),must_be_connected:te().optional()}),iwA=xA({type:QA("source_component_internal_connection"),source_component_internal_connection_id:v(),source_component_id:v(),source_port_ids:fe(v()),subcircuit_id:v().optional()}),owA=xA({type:QA("source_trace"),source_trace_id:v(),connected_source_port_ids:fe(v()),connected_source_net_ids:fe(v()),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),max_length:vA().optional(),min_trace_thickness:vA().optional(),display_name:v().optional()}),nwA=xA({type:QA("source_group"),source_group_id:v(),subcircuit_id:v().optional(),parent_subcircuit_id:v().optional(),parent_source_group_id:v().optional(),is_subcircuit:te().optional(),show_as_schematic_box:te().optional(),name:v().optional(),was_automatically_named:te().optional()}),swA=xA({type:QA("source_net"),source_net_id:v(),name:v(),member_source_group_ids:fe(v()),is_power:te().optional(),is_ground:te().optional(),is_digital_signal:te().optional(),is_analog_signal:te().optional(),is_positive_voltage_source:te().optional(),trace_width:vA().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),rwA=xA({type:QA("source_board"),source_board_id:v(),source_group_id:v(),title:v().optional()}).describe("Defines a board in the source domain"),awA=xA({type:QA("source_pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional()}).describe("Defines a ground plane in the source domain"),h1=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],mj=Ze(h1),os=mj.or(xA({name:mj})).transform(t=>typeof t=="string"?t:t.name),em=Ze(["top","bottom"]),gwA=xA({type:QA("source_manually_placed_via"),source_manually_placed_via_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional()}).describe("Defines a via that is manually placed in the source domain"),IwA=xA({type:QA("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:Ai("source_pin_must_be_connected_error"),error_type:QA("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),wj=xA({type:QA("unknown_error_finding_part"),unknown_error_finding_part_id:Ai("unknown_error_finding_part"),error_type:QA("unknown_error_finding_part").default("unknown_error_finding_part"),message:v(),source_component_id:v().optional(),subcircuit_id:v().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),cwA=xA({type:QA("schematic_box"),schematic_component_id:v().optional(),width:ce,height:ce,is_dashed:te().default(!1),x:ce,y:ce,subcircuit_id:v().optional()}).describe("Draws a box on the schematic"),BwA=xA({type:QA("schematic_path"),schematic_component_id:v(),fill_color:Ze(["red","blue"]).optional(),is_filled:te().optional(),points:fe(Bo),subcircuit_id:v().optional()}),lwA=Aa(xA({left_margin:VA.optional(),right_margin:VA.optional(),top_margin:VA.optional(),bottom_margin:VA.optional()})),CwA=xA({left_size:vA(),right_size:vA(),top_size:vA().optional(),bottom_size:vA().optional()}),QwA=xA({left_side:xA({pins:fe(vA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:xA({pins:fe(vA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:xA({pins:fe(vA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:xA({pins:fe(vA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional()}),EwA=Zt([CwA,QwA]),hwA=xA({type:QA("schematic_component"),size:ij,center:Bo,source_component_id:v().optional(),schematic_component_id:v(),pin_spacing:VA.optional(),pin_styles:lwA.optional(),box_width:VA.optional(),symbol_name:v().optional(),port_arrangement:EwA.optional(),port_labels:Aa(v()).optional(),symbol_display_value:v().optional(),subcircuit_id:v().optional(),schematic_group_id:v().optional(),is_schematic_group:te().optional(),source_group_id:v().optional(),is_box_with_pins:te().optional().default(!0)}),uwA=xA({type:QA("schematic_line"),schematic_line_id:Ai("schematic_line"),schematic_component_id:v(),x1:ce,y1:ce,x2:ce,y2:ce,stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled line on the schematic"),dwA=xA({type:QA("schematic_rect"),schematic_rect_id:Ai("schematic_rect"),schematic_component_id:v(),center:Bo,width:ce,height:ce,rotation:CI.default(0),stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled rectangle on the schematic"),pwA=xA({type:QA("schematic_circle"),schematic_circle_id:Ai("schematic_circle"),schematic_component_id:v(),center:Bo,radius:ce,stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled circle on the schematic"),fwA=xA({type:QA("schematic_arc"),schematic_arc_id:Ai("schematic_arc"),schematic_component_id:v(),center:Bo,radius:ce,start_angle_degrees:CI,end_angle_degrees:CI,direction:Ze(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled arc on the schematic"),ywA=xA({type:QA("schematic_trace"),schematic_trace_id:v(),source_trace_id:v().optional(),junctions:fe(xA({x:vA(),y:vA()})),edges:fe(xA({from:xA({x:vA(),y:vA()}),to:xA({x:vA(),y:vA()}),is_crossing:te().optional(),from_schematic_port_id:v().optional(),to_schematic_port_id:v().optional()})),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),gpe=Ze(["center","left","right","top","bottom"]),mwA=xA({type:QA("schematic_text"),schematic_component_id:v().optional(),schematic_text_id:v(),text:v(),font_size:vA().default(.18),position:xA({x:ce,y:ce}),rotation:vA().default(0),anchor:Zt([gpe.describe("legacy"),Kk]).default("center"),color:v().default("#000000"),subcircuit_id:v().optional()}),wwA=xA({type:QA("schematic_port"),schematic_port_id:v(),source_port_id:v(),schematic_component_id:v().optional(),center:Bo,facing_direction:Ze(["up","down","left","right"]).optional(),distance_from_component_edge:vA().optional(),side_of_component:Ze(["top","bottom","left","right"]).optional(),true_ccw_index:vA().optional(),pin_number:vA().optional(),display_pin_label:v().optional(),subcircuit_id:v().optional(),is_connected:te().optional(),has_input_arrow:te().optional(),has_output_arrow:te().optional()}).describe("Defines a port on a schematic component"),DwA=xA({type:QA("schematic_net_label"),schematic_net_label_id:Ai("schematic_net_label"),schematic_trace_id:v().optional(),source_trace_id:v().optional(),source_net_id:v(),center:Bo,anchor_position:Bo.optional(),anchor_side:Ze(["top","bottom","left","right"]),text:v(),symbol_name:v().optional(),is_movable:te().optional(),subcircuit_id:v().optional()}),SwA=xA({type:QA("schematic_error"),schematic_error_id:v(),error_type:QA("schematic_port_not_found").default("schematic_port_not_found"),message:v(),subcircuit_id:v().optional()}).describe("Defines a schematic error on the schematic"),bwA=xA({type:QA("schematic_layout_error"),schematic_layout_error_id:Ai("schematic_layout_error"),error_type:QA("schematic_layout_error").default("schematic_layout_error"),message:v(),source_group_id:v(),schematic_group_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when schematic layout fails for a group"),iK=xA({type:QA("schematic_debug_object"),label:v().optional(),subcircuit_id:v().optional()}),xwA=iK.extend({shape:QA("rect"),center:Bo,size:ij}),kwA=iK.extend({shape:QA("line"),start:Bo,end:Bo}),GwA=iK.extend({shape:QA("point"),center:Bo}),FwA=nE("shape",[xwA,kwA,GwA]),_wA=xA({type:QA("schematic_voltage_probe"),schematic_voltage_probe_id:v(),source_component_id:v().optional(),name:v().optional(),position:Bo,schematic_trace_id:v(),voltage:ey.optional(),subcircuit_id:v().optional(),color:v().optional(),label_alignment:Kk.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Dj=xA({type:QA("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:Ai("schematic_manual_edit_conflict_warning"),warning_type:QA("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:v(),schematic_component_id:v(),schematic_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),RwA=xA({type:QA("schematic_group"),schematic_group_id:Ai("schematic_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA,height:VA,center:Bo,schematic_component_ids:fe(v()),show_as_schematic_box:te().optional(),name:v().optional(),description:v().optional()}).describe("Defines a group of components on the schematic"),NwA=xA({type:QA("schematic_table"),schematic_table_id:Ai("schematic_table"),anchor_position:Bo,column_widths:fe(ce),row_heights:fe(ce),cell_padding:ce.optional(),border_width:ce.optional(),subcircuit_id:v().optional(),schematic_component_id:v().optional(),anchor:Kk.optional()}).describe("Defines a table on the schematic"),MwA=xA({type:QA("schematic_table_cell"),schematic_table_cell_id:Ai("schematic_table_cell"),schematic_table_id:v(),start_row_index:vA(),end_row_index:vA(),start_column_index:vA(),end_column_index:vA(),text:v().optional(),center:Bo,width:ce,height:ce,horizontal_align:Ze(["left","center","right"]).optional(),vertical_align:Ze(["top","middle","bottom"]).optional(),font_size:ce.optional(),subcircuit_id:v().optional()}).describe("Defines a cell within a schematic_table"),vwA=xA({type:QA("schematic_sheet"),schematic_sheet_id:Ai("schematic_sheet"),name:v().optional(),subcircuit_id:v().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),UwA=xA({x:ce,y:ce,bulge:vA().optional()}),Sj=xA({vertices:fe(UwA)}),LwA=xA({outer_ring:Sj,inner_rings:fe(Sj).default([])}),HwA=xA({x:ce,y:ce,via:te().optional(),via_to_layer:os.optional()}),Ipe=fe(HwA),rw=xA({x:ce,y:ce,via:te().optional(),to_layer:os.optional(),trace_width:ce.optional()}),YwA=xA({type:QA("pcb_component"),pcb_component_id:Ai("pcb_component"),source_component_id:v(),center:Bo,layer:os,rotation:CI,display_offset_x:v().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:VA,height:VA,do_not_place:te().optional(),subcircuit_id:v().optional(),pcb_group_id:v().optional(),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),obstructs_within_bounds:te().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB"),JwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("circle"),hole_diameter:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),cpe=JwA.describe("Defines a circular hole on the PCB"),KwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rect"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Bpe=KwA.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),TwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:Ze(["circle","square"]),hole_diameter:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),lpe=TwA.describe("Defines a circular or square hole on the PCB"),qwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("oval"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Cpe=qwA.describe("Defines an oval hole on the PCB"),PwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("pill"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Qpe=PwA.describe("Defines a pill-shaped hole on the PCB"),OwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rotated_pill"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,ccw_rotation:CI,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Epe=OwA.describe("Defines a rotated pill-shaped hole on the PCB"),WwA=TwA.or(qwA).or(PwA).or(OwA).or(JwA).or(KwA),hpe=xA({type:QA("pcb_plated_hole"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_diameter:vA(),hole_diameter:vA(),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),upe=xA({type:QA("pcb_plated_hole"),shape:Ze(["oval","pill"]),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_width:vA(),outer_height:vA(),hole_width:vA(),hole_height:vA(),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,ccw_rotation:CI,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),dpe=xA({type:QA("pcb_plated_hole"),shape:QA("circular_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("circle"),pad_shape:QA("rect"),hole_diameter:vA(),rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ppe=xA({type:QA("pcb_plated_hole"),shape:QA("pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("pill"),pad_shape:QA("rect"),hole_width:vA(),hole_height:vA(),rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),fpe=xA({type:QA("pcb_plated_hole"),shape:QA("rotated_pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rotated_pill"),pad_shape:QA("rect"),hole_width:vA(),hole_height:vA(),hole_ccw_rotation:CI,rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),rect_ccw_rotation:CI,hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ype=xA({type:QA("pcb_plated_hole"),shape:QA("hole_with_polygon_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:Ze(["circle","oval","pill","rotated_pill"]),hole_diameter:vA().optional(),hole_width:vA().optional(),hole_height:vA().optional(),pad_outline:fe(xA({x:ce,y:ce})).min(3),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ZwA=Zt([hpe,upe,dpe,ppe,fpe,ype]),VwA=xA({type:QA("pcb_port"),pcb_port_id:Ai("pcb_port"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_port_id:v(),pcb_component_id:v().optional(),x:ce,y:ce,layers:fe(os),is_board_pinout:te().optional()}).describe("Defines a port on the PCB"),mpe=xA({type:QA("pcb_smtpad"),shape:QA("circle"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,radius:vA(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),wpe=xA({type:QA("pcb_smtpad"),shape:QA("rect"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),rect_border_radius:vA().optional(),corner_radius:vA().optional(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Dpe=xA({type:QA("pcb_smtpad"),shape:QA("rotated_rect"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),rect_border_radius:vA().optional(),corner_radius:vA().optional(),ccw_rotation:CI,layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),jwA=xA({type:QA("pcb_smtpad"),shape:QA("pill"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Spe=xA({type:QA("pcb_smtpad"),shape:QA("rotated_pill"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),ccw_rotation:CI,layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),bpe=xA({type:QA("pcb_smtpad"),shape:QA("polygon"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),points:fe(Bo),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),zwA=nE("shape",[mpe,wpe,Dpe,Spe,jwA,bpe]).describe("Defines an SMT pad on the PCB"),xpe=xA({type:QA("pcb_solder_paste"),shape:QA("circle"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,radius:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),kpe=xA({type:QA("pcb_solder_paste"),shape:QA("rect"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),Gpe=xA({type:QA("pcb_solder_paste"),shape:QA("pill"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),Fpe=xA({type:QA("pcb_solder_paste"),shape:QA("rotated_rect"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),ccw_rotation:ce,layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),_pe=xA({type:QA("pcb_solder_paste"),shape:QA("oval"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),XwA=Zt([xpe,kpe,Gpe,Fpe,_pe]).describe("Defines solderpaste on the PCB"),$wA=xA({type:QA("pcb_text"),pcb_text_id:Ai("pcb_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),text:v(),center:Bo,layer:os,width:VA,height:VA,lines:vA(),align:Ze(["bottom-left"])}).describe("Defines text on the PCB"),ADA=xA({route_type:QA("wire"),x:ce,y:ce,width:ce,start_pcb_port_id:v().optional(),end_pcb_port_id:v().optional(),layer:os}),eDA=xA({route_type:QA("via"),x:ce,y:ce,hole_diameter:ce.optional(),outer_diameter:ce.optional(),from_layer:v(),to_layer:v()}),bj=Zt([ADA,eDA]),tDA=xA({type:QA("pcb_trace"),source_trace_id:v().optional(),pcb_component_id:v().optional(),pcb_trace_id:Ai("pcb_trace"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),route_thickness_mode:Ze(["constant","interpolated"]).default("constant").optional(),route_order_index:vA().optional(),should_round_corners:te().optional(),trace_length:vA().optional(),highlight_color:v().optional(),route:fe(bj)}).describe("Defines a trace on the PCB"),iDA=xA({type:QA("pcb_trace_error"),pcb_trace_error_id:Ai("pcb_trace_error"),error_type:QA("pcb_trace_error").default("pcb_trace_error"),message:v(),center:Bo.optional(),pcb_trace_id:v(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB"),oDA=xA({type:QA("pcb_trace_missing_error"),pcb_trace_missing_error_id:Ai("pcb_trace_missing_error"),error_type:QA("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:v(),center:Bo.optional(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),nDA=xA({type:QA("pcb_port_not_matched_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:v(),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),sDA=xA({type:QA("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:Ai("pcb_port_not_connected_error"),error_type:QA("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:v(),pcb_port_ids:fe(v()),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),rDA=xA({type:QA("pcb_net"),pcb_net_id:Ai("pcb_net"),source_net_id:v().optional(),highlight_color:v().optional()}).describe("Defines a net on the PCB"),aDA=xA({type:QA("pcb_via"),pcb_via_id:Ai("pcb_via"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),x:ce,y:ce,outer_diameter:ce.default("0.6mm"),hole_diameter:ce.default("0.25mm"),from_layer:os.optional(),to_layer:os.optional(),layers:fe(os),pcb_trace_id:v().optional(),net_is_assignable:te().optional(),net_assigned:te().optional(),is_tented:te().optional()}).describe("Defines a via on the PCB"),gDA=xA({type:QA("pcb_board"),pcb_board_id:Ai("pcb_board"),pcb_panel_id:v().optional(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA.optional(),height:VA.optional(),center:Bo,thickness:VA.optional().default(1.4),num_layers:vA().optional().default(4),outline:fe(Bo).optional(),shape:Ze(["rect","polygon"]).optional(),material:Ze(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),IDA=xA({type:QA("pcb_panel"),pcb_panel_id:Ai("pcb_panel"),width:VA,height:VA,center:Bo,covered_with_solder_mask:te().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),cDA=xA({type:QA("pcb_placement_error"),pcb_placement_error_id:Ai("pcb_placement_error"),error_type:QA("pcb_placement_error").default("pcb_placement_error"),message:v(),subcircuit_id:v().optional()}).describe("Defines a placement error on the PCB"),BDA=xA({type:QA("pcb_trace_hint"),pcb_trace_hint_id:Ai("pcb_trace_hint"),pcb_port_id:v(),pcb_component_id:v(),route:fe(rw),subcircuit_id:v().optional()}).describe("A hint that can be used during generation of a PCB trace"),lDA=xA({type:QA("pcb_silkscreen_line"),pcb_silkscreen_line_id:Ai("pcb_silkscreen_line"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),stroke_width:ce.default("0.1mm"),x1:ce,y1:ce,x2:ce,y2:ce,layer:em}).describe("Defines a silkscreen line on the PCB"),CDA=xA({type:QA("pcb_silkscreen_path"),pcb_silkscreen_path_id:Ai("pcb_silkscreen_path"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,route:fe(Bo),stroke_width:VA}).describe("Defines a silkscreen path on the PCB"),QDA=xA({type:QA("pcb_silkscreen_text"),pcb_silkscreen_text_id:Ai("pcb_silkscreen_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:VA,top:VA,bottom:VA,right:VA}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:vA().optional(),layer:os,is_mirrored:te().default(!1).optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Kk.default("center")}).describe("Defines silkscreen text on the PCB"),EDA=xA({type:QA("pcb_copper_text"),pcb_copper_text_id:Ai("pcb_copper_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:VA,top:VA,bottom:VA,right:VA}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:vA().optional(),layer:os,is_mirrored:te().default(!1).optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Kk.default("center")}).describe("Defines copper text on the PCB"),hDA=xA({type:QA("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Ai("pcb_silkscreen_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:os,stroke_width:VA.default("1mm"),corner_radius:VA.optional(),is_filled:te().default(!0).optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional()}).describe("Defines a silkscreen rect on the PCB"),uDA=xA({type:QA("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Ai("pcb_silkscreen_circle"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius:VA,layer:em,stroke_width:VA.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),dDA=xA({type:QA("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Ai("pcb_silkscreen_oval"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius_x:ce,radius_y:ce,layer:em}).describe("Defines a silkscreen oval on the PCB"),pDA=xA({type:QA("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Ai("pcb_fabrication_note_text"),subcircuit_id:v().optional(),pcb_group_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),pcb_component_id:v(),text:v(),layer:em,anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),fDA=xA({type:QA("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Ai("pcb_fabrication_note_path"),pcb_component_id:v(),subcircuit_id:v().optional(),layer:os,route:fe(Bo),stroke_width:VA,color:v().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),yDA=xA({type:QA("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:Ai("pcb_fabrication_note_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:em,stroke_width:VA.default("0.1mm"),corner_radius:VA.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a fabrication note rectangle on the PCB"),mDA=xA({type:QA("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:Ai("pcb_fabrication_note_dimension"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,from:Bo,to:Bo,text:v().optional(),text_ccw_rotation:vA().optional(),offset:VA.optional(),offset_distance:VA.optional(),offset_direction:xA({x:vA(),y:vA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:VA.default("1mm"),color:v().optional(),arrow_size:VA.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),wDA=xA({type:QA("pcb_note_text"),pcb_note_text_id:Ai("pcb_note_text"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),text:v().optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a documentation note in text on the PCB"),DDA=xA({type:QA("pcb_note_rect"),pcb_note_rect_id:Ai("pcb_note_rect"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),center:Bo,width:VA,height:VA,stroke_width:VA.default("0.1mm"),corner_radius:VA.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a rectangular documentation note on the PCB"),SDA=xA({type:QA("pcb_note_path"),pcb_note_path_id:Ai("pcb_note_path"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),route:fe(Bo),stroke_width:VA.default("0.1mm"),color:v().optional()}).describe("Defines a polyline documentation note on the PCB"),bDA=xA({type:QA("pcb_note_line"),pcb_note_line_id:Ai("pcb_note_line"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),x1:ce,y1:ce,x2:ce,y2:ce,stroke_width:ce.default("0.1mm"),color:v().optional(),is_dashed:te().optional()}).describe("Defines a straight documentation note line on the PCB"),xDA=xA({type:QA("pcb_note_dimension"),pcb_note_dimension_id:Ai("pcb_note_dimension"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),from:Bo,to:Bo,text:v().optional(),text_ccw_rotation:vA().optional(),offset_distance:VA.optional(),offset_direction:xA({x:vA(),y:vA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:VA.default("1mm"),color:v().optional(),arrow_size:VA.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),kDA=xA({type:QA("pcb_footprint_overlap_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:v(),pcb_smtpad_ids:fe(v()).optional(),pcb_plated_hole_ids:fe(v()).optional(),pcb_hole_ids:fe(v()).optional(),pcb_keepout_ids:fe(v()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),GDA=xA({type:QA("pcb_keepout"),shape:QA("rect"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:ce,height:ce,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()}).or(xA({type:QA("pcb_keepout"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius:ce,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()})),oK=xA({type:QA("pcb_cutout"),pcb_cutout_id:Ai("pcb_cutout"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_board_id:v().optional(),pcb_panel_id:v().optional()}),FDA=oK.extend({shape:QA("rect"),center:Bo,width:VA,height:VA,rotation:CI.optional(),corner_radius:VA.optional()}),_DA=oK.extend({shape:QA("circle"),center:Bo,radius:VA}),RDA=oK.extend({shape:QA("polygon"),points:fe(Bo)}),NDA=oK.extend({shape:QA("path"),route:fe(Bo),slot_width:VA,slot_length:VA.optional(),space_between_slots:VA.optional(),slot_corner_radius:VA.optional()}),MDA=nE("shape",[FDA,_DA,RDA,NDA]).describe("Defines a cutout on the PCB, removing board material."),vDA=xA({type:QA("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Ai("pcb_missing_footprint_error"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:v(),message:v()}).describe("Defines a missing footprint error on the PCB"),u1=xA({type:QA("external_footprint_load_error"),external_footprint_load_error_id:Ai("external_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),error_type:QA("external_footprint_load_error").default("external_footprint_load_error"),message:v()}).describe("Defines an error when an external footprint fails to load"),xj=xA({type:QA("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:Ai("circuit_json_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:v(),circuit_json:fe(Tg()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),UDA=xA({type:QA("pcb_group"),pcb_group_id:Ai("pcb_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA.optional(),height:VA.optional(),center:Bo,display_offset_x:v().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:fe(Bo).optional(),anchor_position:Bo.optional(),anchor_alignment:Kk.default("center"),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),pcb_component_ids:fe(v()),child_layout_mode:Ze(["packed","none"]).optional(),name:v().optional(),description:v().optional(),layout_mode:v().optional(),autorouter_configuration:xA({trace_clearance:VA}).optional(),autorouter_used_string:v().optional()}).describe("Defines a group of components on the PCB"),LDA=xA({type:QA("pcb_autorouting_error"),pcb_error_id:Ai("pcb_autorouting_error"),error_type:QA("pcb_autorouting_error").default("pcb_autorouting_error"),message:v(),subcircuit_id:v().optional()}).describe("The autorouting has failed to route a portion of the board"),kj=xA({type:QA("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:Ai("pcb_manual_edit_conflict_warning"),warning_type:QA("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:v(),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),HDA=xA({type:QA("pcb_breakout_point"),pcb_breakout_point_id:Ai("pcb_breakout_point"),pcb_group_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional(),source_port_id:v().optional(),source_net_id:v().optional(),x:ce,y:ce}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),YDA=xA({type:QA("pcb_ground_plane"),pcb_ground_plane_id:Ai("pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_net_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional()}).describe("Defines a ground plane on the PCB"),JDA=xA({type:QA("pcb_ground_plane_region"),pcb_ground_plane_region_id:Ai("pcb_ground_plane_region"),pcb_ground_plane_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:os,points:fe(Bo)}).describe("Defines a polygon region of a ground plane"),KDA=xA({type:QA("pcb_thermal_spoke"),pcb_thermal_spoke_id:Ai("pcb_thermal_spoke"),pcb_ground_plane_id:v(),shape:v(),spoke_count:vA(),spoke_thickness:ce,spoke_inner_diameter:ce,spoke_outer_diameter:ce,pcb_plated_hole_id:v().optional(),subcircuit_id:v().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),Gj=xA({type:QA("pcb_copper_pour"),pcb_copper_pour_id:Ai("pcb_copper_pour"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:os,source_net_id:v().optional(),covered_with_solder_mask:te().optional().default(!0)}),TDA=Gj.extend({shape:QA("rect"),center:Bo,width:VA,height:VA,rotation:CI.optional()}),qDA=Gj.extend({shape:QA("brep"),brep_shape:LwA}),PDA=Gj.extend({shape:QA("polygon"),points:fe(Bo)}),ODA=nE("shape",[TDA,qDA,PDA]).describe("Defines a copper pour on the PCB."),WDA=xA({type:QA("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:Ai("pcb_component_outside_board_error"),error_type:QA("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:v(),pcb_component_id:v(),pcb_board_id:v(),component_center:Bo,component_bounds:xA({min_x:vA(),max_x:vA(),min_y:vA(),max_y:vA()}),subcircuit_id:v().optional(),source_component_id:v().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),nK=xA({type:QA("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:Ai("pcb_component_invalid_layer_error"),error_type:QA("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),message:v(),pcb_component_id:v().optional(),source_component_id:v(),layer:os,subcircuit_id:v().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),ZDA=xA({type:QA("pcb_via_clearance_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_via_clearance_error").default("pcb_via_clearance_error"),message:v(),pcb_via_ids:fe(v()).min(2),minimum_clearance:ce.optional(),actual_clearance:ce.optional(),pcb_center:xA({x:vA().optional(),y:vA().optional()}).optional(),subcircuit_id:v().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),VDA=xA({type:QA("pcb_courtyard_rect"),pcb_courtyard_rect_id:Ai("pcb_courtyard_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:em,color:v().optional()}).describe("Defines a courtyard rectangle on the PCB"),jDA=xA({type:QA("pcb_courtyard_outline"),pcb_courtyard_outline_id:Ai("pcb_courtyard_outline"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,outline:fe(Bo).min(2),stroke_width:VA.default("0.1mm"),is_closed:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a courtyard outline on the PCB"),zDA=xA({type:QA("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:Ai("pcb_courtyard_polygon"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,points:fe(Bo).min(3),color:v().optional()}).describe("Defines a courtyard polygon on the PCB"),XDA=xA({type:QA("cad_component"),cad_component_id:v(),pcb_component_id:v(),source_component_id:v(),position:m_,rotation:m_.optional(),size:m_.optional(),layer:os.optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),model_obj_url:v().optional(),model_stl_url:v().optional(),model_3mf_url:v().optional(),model_gltf_url:v().optional(),model_glb_url:v().optional(),model_step_url:v().optional(),model_wrl_url:v().optional(),model_unit_to_mm_scale_factor:vA().optional(),model_jscad:Tg().optional(),show_as_translucent_model:te().optional()}).describe("Defines a component on the PCB"),$DA=Ze(["sinewave","square","triangle","sawtooth"]),Rpe=Zt([v(),vA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(vA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),ASA=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:Ai("simulation_voltage_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),voltage:ey}).describe("Defines a DC voltage source for simulation"),eSA=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:Ai("simulation_voltage_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),voltage:ey.optional(),frequency:FD.optional(),peak_to_peak_voltage:ey.optional(),wave_shape:$DA.optional(),phase:CI.optional(),duty_cycle:Rpe.optional()}).describe("Defines an AC voltage source for simulation"),tSA=Zt([ASA,eSA]).describe("Defines a voltage source for simulation"),iSA=Zt([QA("spice_dc_sweep"),QA("spice_dc_operating_point"),QA("spice_transient_analysis"),QA("spice_ac_analysis")]),oSA=xA({type:QA("simulation_experiment"),simulation_experiment_id:Ai("simulation_experiment"),name:v(),experiment_type:iSA,time_per_step:E1.optional(),start_time_ms:Pf.optional(),end_time_ms:Pf.optional()}).describe("Defines a simulation experiment configuration"),nSA=xA({type:QA("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:Ai("simulation_transient_voltage_graph"),simulation_experiment_id:v(),timestamps_ms:fe(vA()).optional(),voltage_levels:fe(vA()),source_component_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),time_per_step:E1,start_time_ms:Pf,end_time_ms:Pf,name:v().optional(),color:v().optional()}).describe("Stores voltage measurements over time for a simulation"),sSA=xA({type:QA("simulation_switch"),simulation_switch_id:Ai("simulation_switch"),source_component_id:v().optional(),closes_at:Pf.optional(),opens_at:Pf.optional(),starts_closed:te().optional(),switching_frequency:FD.optional()}).describe("Defines a switch for simulation timing control"),rSA=xA({type:QA("simulation_voltage_probe"),simulation_voltage_probe_id:Ai("simulation_voltage_probe"),source_component_id:v().optional(),name:v().optional(),signal_input_source_port_id:v().optional(),signal_input_source_net_id:v().optional(),reference_input_source_port_id:v().optional(),reference_input_source_net_id:v().optional(),subcircuit_id:v().optional(),color:v().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,A)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){const i=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,o=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;i&&o?A.addIssue({code:Wt.custom,message:"Cannot mix port and net connections in a differential probe."}):i?(!t.signal_input_source_port_id||!t.reference_input_source_port_id)&&A.addIssue({code:Wt.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):o&&(!t.signal_input_source_net_id||!t.reference_input_source_net_id)&&A.addIssue({code:Wt.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!t.signal_input_source_port_id==!!t.signal_input_source_net_id&&A.addIssue({code:Wt.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),aSA=xA({type:QA("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:Ai("simulation_unknown_experiment_error"),error_type:QA("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),message:v(),simulation_experiment_id:v().optional(),subcircuit_id:v().optional()}).describe("An unknown error occurred during the simulation experiment."),gSA=Zt([owA,twA,iwA,ewA,swA,nwA,rj,oj,tK,sj,nj,aj,gj,Ij,lj,Cj,Qj,dj,Ej,hj,uj,Bj,cj,awA,gwA,rwA,pj,fj,yj,IwA,wj,YwA,WwA,vDA,u1,xj,kj,ZwA,GDA,VwA,rDA,$wA,tDA,aDA,zwA,XwA,gDA,IDA,UDA,BDA,lDA,CDA,QDA,EDA,hDA,uDA,dDA,iDA,oDA,cDA,nDA,sDA,ZDA,fDA,pDA,yDA,mDA,wDA,DDA,SDA,bDA,xDA,LDA,kDA,HDA,MDA,YDA,JDA,KDA,ODA,WDA,nK,VDA,jDA,zDA,cwA,mwA,uwA,dwA,pwA,fwA,hwA,wwA,ywA,BwA,SwA,bwA,DwA,FwA,_wA,Dj,RwA,vwA,NwA,MwA,XDA,tSA,oSA,nSA,sSA,rSA,aSA]),w_=gSA;const d1=Object.freeze(Object.defineProperty({__proto__:null,all_layers:h1,any_circuit_element:gSA,any_soup_element:w_,any_source_component:ewA,battery_capacity:OmA,brep_shape:LwA,cad_component:XDA,capacitance:y_,circuit_json_footprint_load_error:xj,current:ipe,distance:ce,duration_ms:E1,experiment_type:iSA,external_footprint_load_error:u1,frequency:FD,getZodPrefixedIdWithDefault:Ai,inductance:tj,layer_ref:os,layer_string:mj,length:VA,ms:Pf,ninePointAnchor:Kk,pcb_autorouting_error:LDA,pcb_board:gDA,pcb_breakout_point:HDA,pcb_component:YwA,pcb_component_invalid_layer_error:nK,pcb_component_outside_board_error:WDA,pcb_copper_pour:ODA,pcb_copper_pour_brep:qDA,pcb_copper_pour_polygon:PDA,pcb_copper_pour_rect:TDA,pcb_copper_text:EDA,pcb_courtyard_outline:jDA,pcb_courtyard_polygon:zDA,pcb_courtyard_rect:VDA,pcb_cutout:MDA,pcb_cutout_circle:_DA,pcb_cutout_path:NDA,pcb_cutout_polygon:RDA,pcb_cutout_rect:FDA,pcb_fabrication_note_dimension:mDA,pcb_fabrication_note_path:fDA,pcb_fabrication_note_rect:yDA,pcb_fabrication_note_text:pDA,pcb_footprint_overlap_error:kDA,pcb_ground_plane:YDA,pcb_ground_plane_region:JDA,pcb_group:UDA,pcb_hole:WwA,pcb_hole_circle_or_square_shape:lpe,pcb_hole_circle_shape:cpe,pcb_hole_oval_shape:Cpe,pcb_hole_pill_shape:Qpe,pcb_hole_rect_shape:Bpe,pcb_hole_rotated_pill_shape:Epe,pcb_keepout:GDA,pcb_manual_edit_conflict_warning:kj,pcb_missing_footprint_error:vDA,pcb_net:rDA,pcb_note_dimension:xDA,pcb_note_line:bDA,pcb_note_path:SDA,pcb_note_rect:DDA,pcb_note_text:wDA,pcb_panel:IDA,pcb_placement_error:cDA,pcb_plated_hole:ZwA,pcb_port:VwA,pcb_port_not_connected_error:sDA,pcb_port_not_matched_error:nDA,pcb_route_hint:HwA,pcb_route_hints:Ipe,pcb_silkscreen_circle:uDA,pcb_silkscreen_line:lDA,pcb_silkscreen_oval:dDA,pcb_silkscreen_path:CDA,pcb_silkscreen_rect:hDA,pcb_silkscreen_text:QDA,pcb_smtpad:zwA,pcb_smtpad_pill:jwA,pcb_solder_paste:XwA,pcb_text:$wA,pcb_thermal_spoke:KDA,pcb_trace:tDA,pcb_trace_error:iDA,pcb_trace_hint:BDA,pcb_trace_missing_error:oDA,pcb_trace_route_point:bj,pcb_trace_route_point_via:eDA,pcb_trace_route_point_wire:ADA,pcb_via:aDA,pcb_via_clearance_error:ZDA,point:Bo,point3:m_,point_with_bulge:UwA,port_arrangement:EwA,position:npe,position3:spe,resistance:f_,ring:Sj,rotation:CI,route_hint_point:rw,schematic_arc:fwA,schematic_box:cwA,schematic_circle:pwA,schematic_component:hwA,schematic_component_port_arrangement_by_sides:QwA,schematic_component_port_arrangement_by_size:CwA,schematic_debug_line:kwA,schematic_debug_object:FwA,schematic_debug_object_base:iK,schematic_debug_point:GwA,schematic_debug_rect:xwA,schematic_error:SwA,schematic_group:RwA,schematic_layout_error:bwA,schematic_line:uwA,schematic_manual_edit_conflict_warning:Dj,schematic_net_label:DwA,schematic_path:BwA,schematic_pin_styles:lwA,schematic_port:wwA,schematic_rect:dwA,schematic_sheet:vwA,schematic_table:NwA,schematic_table_cell:MwA,schematic_text:mwA,schematic_trace:ywA,schematic_voltage_probe:_wA,simulation_ac_voltage_source:eSA,simulation_dc_voltage_source:ASA,simulation_experiment:oSA,simulation_switch:sSA,simulation_transient_voltage_graph:nSA,simulation_unknown_experiment_error:aSA,simulation_voltage_probe:rSA,simulation_voltage_source:tSA,size:ij,source_board:rwA,source_component_base:dB,source_component_internal_connection:iwA,source_failed_to_create_component_error:zmA,source_group:nwA,source_interconnect:AwA,source_manually_placed_via:gwA,source_missing_property_error:jmA,source_net:swA,source_pcb_ground_plane:awA,source_pin_missing_trace_warning:yj,source_pin_must_be_connected_error:IwA,source_port:twA,source_project_metadata:pj,source_property_ignored_warning:XmA,source_simple_battery:gj,source_simple_capacitor:oj,source_simple_chip:rj,source_simple_crystal:VmA,source_simple_diode:tK,source_simple_fiducial:WmA,source_simple_ground:ZmA,source_simple_inductor:Ij,source_simple_led:sj,source_simple_mosfet:uj,source_simple_pin_header:lj,source_simple_pinout:Cj,source_simple_potentiometer:Bj,source_simple_power_source:aj,source_simple_push_button:cj,source_simple_resistor:nj,source_simple_resonator:Qj,source_simple_switch:dj,source_simple_test_point:hj,source_simple_transistor:Ej,source_simple_voltage_probe:$mA,source_trace:owA,source_trace_not_connected_error:fj,supplier_name:eK,time:ope,timestamp:PmA,unknown_error_finding_part:wj,visible_layer:em,voltage:ey,wave_shape:$DA},Symbol.toStringTag,{value:"Module"}));var Npe=Object.defineProperty,Mpe=(t,A)=>{for(var e in A)Npe(t,e,{get:A[e],enumerable:!0})},_D={};Mpe(_D,{axial:()=>Mfe,bga:()=>Wpe,breakoutheaders:()=>Pfe,cap:()=>Kpe,dfn:()=>Efe,diode:()=>Jpe,dip:()=>Lpe,electrolytic:()=>bme,hc49:()=>Wfe,jst:()=>zye,led:()=>Tpe,lqfp:()=>Tfe,m2host:()=>qme,melf:()=>sye,micromelf:()=>Iye,minimelf:()=>X0e,mlp:()=>efe,ms012:()=>mfe,ms013:()=>Dfe,msop:()=>rme,pad:()=>Zfe,pinrow:()=>dfe,platedhole:()=>Hme,potentiometer:()=>wme,pushbutton:()=>Ufe,qfn:()=>$pe,qfp:()=>Afe,quad:()=>p1,res:()=>qpe,sma:()=>Cye,smb:()=>yye,smbf:()=>kme,smc:()=>Sye,smf:()=>uye,smtpad:()=>Ume,sod110:()=>$ye,sod123:()=>Ffe,sod123f:()=>G0e,sod123fl:()=>N0e,sod123w:()=>I0e,sod128:()=>K0e,sod323:()=>C0e,sod323f:()=>S0e,sod323fl:()=>lme,sod323w:()=>gme,sod523:()=>A0e,sod723:()=>L0e,sod80:()=>s0e,sod882:()=>y0e,sod882d:()=>tye,sod923:()=>u0e,soic:()=>Vpe,solderjumper:()=>ume,son:()=>hme,sop8:()=>o0e,sot:()=>Jme,sot223:()=>Gye,sot23:()=>gfe,sot23w:()=>Hye,sot25:()=>lfe,sot323:()=>Rme,sot363:()=>rfe,sot457:()=>fme,sot563:()=>ffe,sot723:()=>bfe,sot89:()=>Z0e,ssop:()=>ife,stampboard:()=>Hfe,stampreceiver:()=>Kfe,to220:()=>j0e,to92:()=>Xfe,to92s:()=>Pye,tssop:()=>nfe,vssop:()=>ome});var lo=(t,A,e)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:e,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:t,y:A},anchor_alignment:"center"}),Rn=(t,A,e,i,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:A,y:e,hole_diameter:wa(i),outer_diameter:wa(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()]}),ISA=Array.from({length:9},(t,A)=>Math.cos(A/8*Math.PI-Math.PI)).map(t=>({x:t,y:-Math.sqrt(1-t**2)}));function lb(t){return typeof t=="string"?t.trim().toLowerCase().endsWith("mil")?parseFloat(t)*.0254:parseFloat(t):Number(t)}var sK=Zt([v(),vA()]).transform(t=>lb(t)),vpe=t=>xA({fn:v(),num_pins:vA().optional().default(6),wide:te().optional(),narrow:te().optional(),w:sK.optional(),p:sK.default(t.p??"2.54mm"),id:sK.optional(),od:sK.optional()}).transform(A=>(!A.id&&!A.od?Math.abs(A.p-1.27)<.01?(A.id=lb("0.55mm"),A.od=lb("0.95mm")):(A.id=lb("1.0mm"),A.od=lb("1.5mm")):A.id?A.od||(A.od=A.id*(1.5/1)):A.id=A.od*(1/1.5),A.w||(A.wide?A.w=lb("600mil"):A.narrow?A.w=lb("300mil"):A.w=lb(t.w??"300mil")),A)),Upe=vpe({}),cSA=(t,A,e,i)=>{const o=t/2,n=A<=o,s=o-1,r=i,a=r*s;return n?{x:-e/2,y:a/2-(A-1)*r}:{x:e/2,y:-a/2+(A-o-1)*r}},Lpe=t=>{const A=Upe.parse(t),e=[];for(let g=0;g<A.num_pins;g++){const{x:I,y:c}=cSA(A.num_pins,g+1,A.w,A.p??2.54);e.push(Rn(g+1,I,c,A.id??"0.8mm",A.od??"1mm"))}(A.num_pins/2-1)*A.p+A.od;const o=A.w-A.od-1,n=(A.num_pins/2-1)*A.p+A.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/2,y:-n/2},{x:-o/2,y:n/2},...ISA.map(({x:g,y:I})=>({x:g*o/6,y:I*o/6+n/2})),{x:o/2,y:n/2},{x:o/2,y:-n/2},{x:-o/2,y:-n/2}],type:"pcb_silkscreen_path",stroke_width:.1},r=[];for(let g=0;g<A.num_pins;g++){const I=g<A.num_pins/2,c=.6,{y:B}=cSA(A.num_pins,g+1,A.w,A.p??2.54),l=I?-A.w/2-A.od/2-c:A.w/2+A.od/2+c,C=B;r.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${g+1}`,layer:"top",pcb_component_id:`pin_${g+1}`,text:`{pin${g+1}}`,anchor_position:{x:l,y:C},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const a=lo(0,n/2+.5,.4);return{circuitJson:[...e,s,a,...r],parameters:A}},xi=(t,A,e,i,o)=>({type:"pcb_smtpad",x:A,y:e,width:i,height:o,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(n=>n.toString()):[t.toString()]}),BSA=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{imperial:"0504",metric:"1310",p_mm_min:1.1,pw_mm_min:.65,ph_mm_min:1.3,w_mm_min:.58,h_mm_min:.21},{imperial:"1812",metric:"4532",p_mm_min:4.275,pw_mm_min:1.125,ph_mm_min:3.4,w_mm_min:5.4,h_mm_min:3.4},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{imperial:"0402",metric:"1005",p_mm_min:1.02,pw_mm_min:.54,ph_mm_min:.64,w_mm_min:1.56,h_mm_min:.64},{imperial:"0603",metric:"1608",p_mm_min:1.65,pw_mm_min:.8,ph_mm_min:.95,w_mm_min:2.45,h_mm_min:.95},{imperial:"0805",metric:"2012",p_mm_min:1.825,pw_mm_min:1.025,ph_mm_min:1.4,w_mm_min:2.8499999999999996,h_mm_min:1.4},{imperial:"1206",metric:"3216",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:1.75,w_mm_min:4.05,h_mm_min:1.75},{imperial:"1210",metric:"3225",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:2.65,w_mm_min:4.05,h_mm_min:2.65},{imperial:"2010",metric:"5025",p_mm_min:4.625,pw_mm_min:1.225,ph_mm_min:2.65,w_mm_min:5.85,h_mm_min:2.65},{imperial:"2512",metric:"6332",p_mm_min:5.925,pw_mm_min:1.225,ph_mm_min:3.35,w_mm_min:7.15,h_mm_min:3.35}],Hpe=Object.fromEntries(BSA.map(t=>[t.metric,t])),Ype=Object.fromEntries(BSA.map(t=>[t.imperial,t]));xA({tht:te(),p:VA.optional(),pw:VA.optional(),ph:VA.optional(),metric:ce.optional(),imperial:ce.optional(),w:VA.optional(),h:VA.optional(),textbottom:te().optional()});var rK=t=>{let{tht:A,p:e,pw:i,ph:o,metric:n,imperial:s,w:r,h:a,textbottom:g}=t;if(typeof r=="string"&&(r=Q1(r)),typeof a=="string"&&(a=Q1(a)),typeof e=="string"&&(e=Q1(e)),typeof i=="string"&&(i=Q1(i)),typeof o=="string"&&(o=Q1(o)),a!==void 0&&r!==void 0&&a>r)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let I;if(n&&(I=Hpe[n]),s&&(I=Ype[s]),I&&(r=I.w_mm_min,a=I.h_mm_min,e=I.p_mm_min,i=I.pw_mm_min,o=I.ph_mm_min),e===void 0||i===void 0||o===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:e/2,y:o/2+.4},{x:-e/2-i/2-.2,y:o/2+.4},{x:-e/2-i/2-.2,y:-o/2-.4},{x:e/2,y:-o/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},B=g?-o/2-.9:o/2+.9,l=lo(0,B,.2);return A?[Rn(1,-e/2,0,i,i*1/.8),Rn(2,e/2,0,i,i*1/.8),c,l]:[xi(["1","left"],-e/2,0,i,o),xi(["2","right"],e/2,0,i,o),c,l]},Jpe=t=>({circuitJson:rK(t),parameters:t}),Kpe=t=>({circuitJson:rK(t),parameters:t}),Tpe=t=>({circuitJson:rK(t),parameters:t}),qpe=t=>({circuitJson:rK(t),parameters:t}),lSA=(t,{x:A,y:e,radius:i})=>({type:"pcb_smtpad",x:A,y:e,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(o=>o.toString()):[t.toString()]}),CSA="ABCDEFGHIJKLMNOPQRSTUVWXYZ",QSA=v().transform(t=>{const[A,e]=t.split(/[x ]/);return{x:parseFloat(A),y:parseFloat(e)}}).pipe(xA({x:vA(),y:vA()})),Ppe=v().or(fe(Tg())).transform(t=>Array.isArray(t)?t:(t.startsWith("(")&&t.endsWith(")")&&(t=t.slice(1,-1)),t.split(",").map(A=>{const e=Number(A);return isNaN(e)?A:e}))).pipe(fe(v().or(vA()))),Ope=xA({fn:v(),num_pins:vA().optional().default(64),grid:QSA.optional(),p:ce.default("0.8mm"),w:VA.optional(),h:VA.optional(),ball:VA.optional().describe("ball diameter"),pad:VA.optional().describe("pad width/height"),circularpads:te().optional().describe("use circular pads"),tlorigin:te().optional(),blorigin:te().optional(),trorigin:te().optional(),brorigin:te().optional(),missing:Ppe.default([])}).transform(t=>{let A="tl";if(t.blorigin&&(A="bl"),t.trorigin&&(A="tr"),t.brorigin&&(A="br"),!t.grid){const i=Math.ceil(Math.sqrt(t.num_pins));t.grid={x:i,y:i}}return t.missing&&(t.missing=t.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const o=i.match(/([A-Z]+)(\d+)/);if(!o)return i;const n=CSA.indexOf(o[1]),s=Number.parseInt(o[2])-1;return n*t.grid.x+s+1})),{...t,origin:A}}),Wpe=t=>{const A=Ope.parse(t);let{num_pins:e,grid:i,p:o,w:n,h:s,ball:r,pad:a,missing:g}=A;r??=.75/1.27*o,a??=r*.8;const I=[],c=(g??[]).filter(D=>typeof D=="number"),B=i.x*i.y-e;if(g.length===0&&B>0&&(Math.sqrt(B)%1===0?g.push("center"):B===1&&g.push("topleft")),g?.includes("center")){const D=Math.floor(Math.sqrt(B)),w=Math.floor((i.x-D)/2),x=Math.floor((i.y-D)/2);for(let b=x;b<x+D;b++)for(let F=w;F<w+D;F++)c.push(b*i.x+F+1)}g?.includes("topleft")&&c.push(1);const l=new Set(c);let C=0;for(let D=0;D<i.y;D++)for(let w=0;w<i.x;w++){const x=(w-(i.x-1)/2)*o,b=(D-(i.y-1)/2)*o;let F=w,k=D;switch(A.origin){case"bl":F=w,k=i.y-1-D;break;case"br":F=i.x-1-w,k=i.y-1-D;break;case"tr":F=i.x-1-w,k=D;break}let U=k*i.x+F+1;if(l.has(U)){C++;continue}U-=C;const M=[U,`${CSA[k]}${F+1}`];I.push(A.circularpads?lSA(M,{x,y:b,radius:a/2}):xi(M,x,b,a,a))}const Q=lo(0,i.y*o/2,.2),E=o/6;let h;const u=i.x*o/2,d=i.y*o/2;switch(A.origin){case"bl":h=[{x:-u,y:-d},{x:-u,y:-d-E},{x:-u-E,y:-d},{x:-u,y:-d}];break;case"br":h=[{x:u,y:-d},{x:u,y:-d-E},{x:u+E,y:-d},{x:u,y:-d}];break;case"tr":h=[{x:u,y:d},{x:u,y:d+E},{x:u+E,y:d},{x:u,y:d}];break;default:h=[{x:-u,y:d},{x:-u,y:d+E},{x:-u-E,y:d},{x:-u,y:d}];break}const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:h,stroke_width:.05};return{circuitJson:[...I,Q,f],parameters:A}},aK=(t,A,e,i,o)=>({type:"pcb_smtpad",x:A,y:e,width:i,height:o,radius:o/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(n=>n.toString()):[t.toString()]}),tm=t=>xA({fn:v(),num_pins:vA().optional().default(8),w:VA.default(VA.parse(t.w??"5.3mm")),p:VA.default(VA.parse(t.p??"1.27mm")),pw:VA.default(VA.parse(t.pw??"0.6mm")),pl:VA.default(VA.parse(t.pl??"1.0mm")),legsoutside:te().optional().default(t.legsoutside??!1),pillpads:te().optional().default(t.pillpads??!1)}).transform(A=>(!A.pw&&!A.pl?(A.pw=VA.parse("0.6mm"),A.pl=VA.parse("1.0mm")):A.pw?A.pl||(A.pl=A.pw*(1/.6)):A.pw=A.pl*(.6/1),A)),Zpe=tm({}),Fj=t=>{t.widthincludeslegs!==void 0&&(t.legsoutside=!t.widthincludeslegs);const{num_pins:A,pn:e,w:i,p:o,pl:n,legsoutside:s}=t,r=A/2,a=e<=r,g=r-1,I=o,c=I*g,B=s?n/2:-n/2;return a?{x:-i/2-B,y:c/2-(e-1)*I}:{x:i/2+B,y:-c/2+(e-r-1)*I}},Vpe=t=>{const A=Zpe.parse(t);return{circuitJson:RD(A),parameters:A}},RD=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Fj({num_pins:t.num_pins,pn:r+1,w:t.w,p:t.p,pl:t.pl,legsoutside:t.legsoutside});t.pillpads?A.push(aK(r+1,a,g,t.pl,t.pw)):A.push(xi(r+1,a,g,t.pl,t.pw))}const e=Math.min(1,t.p/2),i=t.w-(t.legsoutside?0:t.pl*2)-.2,o=(t.num_pins/2-1)*t.p+t.pw+e,n=lo(0,o/2+.4,o/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-o/2},{x:-i/2,y:o/2},...ISA.map(({x:r,y:a})=>({x:r*i/6,y:a*i/6+o/2})),{x:i/2,y:o/2},{x:i/2,y:-o/2},{x:-i/2,y:-o/2}]};return[...A,s,n]},ESA=Ze(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),jpe=({num_pins:t,cw:A,ccw:e,startingpin:i})=>{const o=[],n=t/4;let s=1;const r={};for(const a of i??[])r[a]=!0;!r.leftside&&!r.topside&&!r.rightside&&!r.bottomside&&(r.leftside=!0),!r.bottompin&&!r.leftpin&&!r.rightpin&&!r.toppin&&(r.leftside?r.toppin=!0:r.topside?r.rightpin=!0:r.rightside?r.bottompin=!0:r.bottomside&&(r.leftpin=!0)),r.leftside&&r.toppin?s=1:r.leftside&&r.bottompin?s=n:r.bottomside&&r.leftpin?s=n+1:r.bottomside&&r.rightpin?s=n*2:r.rightside&&r.bottompin?s=n*2+1:r.rightside&&r.toppin?s=n*3:r.topside&&r.rightpin?s=n*3+1:r.topside&&r.leftpin&&(s=n*4),o.push(-1);for(let a=0;a<t;a++)o[s]=a+1,e||!A?(s++,s>t&&(s=1)):(s--,s<1&&(s=t));return o},_j=xA({fn:v(),cc:te().default(!0).optional(),ccw:te().default(!0).optional(),startingpin:v().or(fe(ESA)).transform(t=>typeof t=="string"?t.slice(1,-1).split(","):t).pipe(fe(ESA)).optional(),num_pins:vA().optional().default(64),w:VA.optional(),h:VA.optional(),p:VA.default(VA.parse("0.5mm")),pw:VA.optional(),pl:VA.optional(),thermalpad:Zt([QA(!0),QSA]).optional(),legsoutside:te().default(!1)}),Rj=t=>{t.w&&!t.h?t.h=t.w:!t.w&&t.h&&(t.w=t.h);const A=t.num_pins/4;if(!t.p&&!t.pw&&!t.pl&&t.w){const e=A+4;t.p=t.w/e}return!t.p&&t.w&&t.h&&t.pw&&t.pl&&(t.p=(t.w-t.pl*2)/(A-1)),!t.w&&!t.h&&t.p&&(t.w=t.p*(A+4),t.h=t.w),t.p&&!t.pw&&!t.pl?(t.pw=t.p/2,t.pl=t.p/2):t.pw?t.pl||(t.pl=t.pw*(1/.6)):t.pw=t.pl*(.6/1),t},hSA=_j.transform(Rj),zpe=["left","bottom","right","top"],Xpe=t=>{const{pin_count:A,pn:e,w:i,h:o,p:n,pl:s,legsoutside:r}=t,a=A/4,g=zpe[Math.floor((e-1)/a)],I=(e-1)%a,c=n*(a-1),B=n*(a-1),l=r?s/2:-s/2;switch(g){case"left":return{x:-i/2-l,y:B/2-I*n,o:"vert"};case"bottom":return{x:-c/2+I*n,y:-o/2-l,o:"horz"};case"right":return{x:i/2+l,y:-B/2+I*n,o:"vert"};case"top":return{x:c/2-I*n,y:o/2+l,o:"horz"};default:throw new Error("Invalid pin number")}},p1=t=>{const A=hSA.parse(t),e=[],i=jpe(A),o=A.num_pins/4;for(let r=0;r<A.num_pins;r++){const{x:a,y:g,o:I}=Xpe({pin_count:A.num_pins,pn:r+1,w:A.w,h:A.h,p:A.p??.5,pl:A.pl,legsoutside:A.legsoutside});let c=A.pw,B=A.pl;I==="vert"&&([c,B]=[B,c]);const l=i[r+1];e.push(xi(l,a,g,c,B))}if(A.thermalpad)if(typeof A.thermalpad=="boolean"){const r=A.p*(o-1)+A.pw,a=A.p*(o-1)+A.pw;e.push(xi(["thermalpad"],0,0,r,a))}else e.push(xi(["thermalpad"],0,0,A.thermalpad.x,A.thermalpad.y));const n=[];for(const[r,a,g]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const I=A.w/2*a,c=A.h/2*g;let B="none",l=I,C=c;const Q=A.pw*2;i[1]===1&&r==="top-left"?B="in1":i[o*4]===1&&r==="top-left"||i[o*3+1]===1&&r==="top-right"?B="in2":i[o*3]===1&&r==="top-right"||i[o]===1&&r==="bottom-left"?B="in1":i[o+1]===1&&r==="bottom-left"?B="in2":i[o*2]===1&&r==="bottom-right"?B="in1":i[o*2+1]===1&&r==="bottom-right"&&(B="in2");const E=B==="in1"?1:-1;if(A.legsoutside){const h=B==="in1"?A.pl/2:A.pw/2,u=B==="in1"?A.pw/2:A.pl/2;l+=h*a*E,C-=u*g*E}(B==="none"||A.legsoutside)&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}`,route:[{x:I-Q*a,y:c},{x:I,y:c},{x:I,y:c-Q*g}],type:"pcb_silkscreen_path",stroke_width:.1}),(B==="in1"||B==="in2")&&!A.legsoutside&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_1`,route:[{x:I-Q*a,y:c},{x:I-Q*a/2,y:c}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_2`,route:[{x:I,y:c-Q*g/2},{x:I,y:c-Q*g}],type:"pcb_silkscreen_path",stroke_width:.1}),(B==="in1"||B==="in2")&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_3`,route:[{x:l-.2*-a,y:C+.2*E},{x:l,y:C},{x:l+.2*E*-a,y:C+.2},{x:l-.2*-a,y:C+.2*E}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=lo(0,A.h/2+(A.legsoutside?A.pl*1.2:.5),.3);return{circuitJson:[...e,...n,s],parameters:A}};_j.extend({}).transform(Rj);var $pe=t=>(t.legsoutside=!1,p1(t)),Afe=t=>{t.legsoutside=!0;const A=hSA.parse(t);if(!t.p)switch(t.num_pins){case 44:case 64:t.p=.8;break;case 52:t.w===14?t.p=1:t.p=.65;break;case 208:t.p=.5;break}if(!t.pl)switch(t.num_pins){case 44:case 52:case 64:t.pl=2.25;break;case 208:t.pl=1.65;break;default:t.pl=A.pl*4;break}if(!t.pw)switch(t.num_pins){case 44:case 64:t.pw=.5;break;case 52:t.w===14?t.pw=.45:t.pw=.55;break;case 208:t.pw=.3;break;default:t.pw=A.pw;break}return p1(t)};_j.extend({}).transform(Rj);var efe=t=>(t.legsoutside=!1,t.thermalpad===void 0&&(t.thermalpad=!0),p1(t)),tfe=tm({w:"3.9mm",p:"1.27mm"}),ife=t=>{const A=tfe.parse(t);return{circuitJson:RD(A),parameters:A}},ofe=tm({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),nfe=t=>{const A=ofe.parse(t);return{circuitJson:RD(A),parameters:A}},sfe=tm({}),rfe=t=>{const A=sfe.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:RD(A),parameters:A}},uSA=xA({fn:v(),num_pins:vA().default(3),w:v().default("1.92mm"),h:v().default("2.74mm"),pl:v().default("0.8mm"),pw:v().default("0.764mm"),p:v().default("0.95mm"),string:v().optional()}),afe=tm({p:"0.95mm",w:"1.6mm",legsoutside:!0}),gfe=t=>{const A=t.string?.match(/^sot23_(\d+)/),e=A?Number.parseInt(A[1],10):3;if(e===6||e===8){const o=afe.parse({...t,num_pins:e});return{circuitJson:RD(o),parameters:o}}const i=uSA.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:cfe(i),parameters:i};if(i.num_pins===5)return{circuitJson:pSA(i),parameters:i};throw new Error("Invalid number of pins")},Ife=t=>{const{pn:A}=t;return A===1?{x:-1.7,y:0}:A===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},cfe=t=>{const A=[];for(let i=0;i<t.num_pins;i++){const{x:o,y:n}=Ife({num_pins:t.num_pins,pn:i+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl)});A.push(xi(i+1,o,n,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h),.3);return[...A,e]},dSA=t=>{const{p:A,h:e,pn:i}=t;if(i===1)return{x:-e/2-.5,y:A};if(i===2)return{x:-e/2-.5,y:0};if(i===3)return{x:-e/2-.5,y:-A};if(i===4)return{x:e/2+.5,y:-A};if(i===5)return{x:e/2+.5,y:A};throw new Error("Invalid pin number")},pSA=t=>{const A=[];for(let c=1;c<=t.num_pins;c++){const{x:B,y:l}=dSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:c});A.push(xi(c,B,l,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=(t.num_pins+1)/2*Number.parseFloat(t.p),i=Number.parseFloat(t.h),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e/3,y:i/2+Number.parseFloat(t.p)/1.3},{x:e/3,y:i/2+Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e/3,y:-i/2-Number.parseFloat(t.p)/1.3},{x:e/3,y:-i/2-Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=lo(0,i+.3,.3),r=dSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:1});r.x=r.x-Number.parseFloat(t.pw)*1.5;const a=.7,g=.3,I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:r.x+a/2,y:r.y},{x:r.x-a/2,y:r.y+g/2},{x:r.x-a/2,y:r.y-g/2},{x:r.x+a/2,y:r.y}],stroke_width:.05};return[...A,s,o,n,I]},Bfe=uSA.extend({}),lfe=t=>{const A=Bfe.parse({...t,num_pins:5});return{circuitJson:pSA(A),parameters:A}},Cfe=[{name:"top-left",dx:-1,dy:1},{name:"top-right",dx:1,dy:1},{name:"bottom-left",dx:-1,dy:-1},{name:"bottom-right",dx:1,dy:-1}],Qfe=tm({}),Efe=t=>{const A=Qfe.parse(t),e=[];for(let c=0;c<A.num_pins;c++){const{x:B,y:l}=Fj({num_pins:A.num_pins,pn:c+1,w:A.w,p:A.p??1.27,pl:A.pl,widthincludeslegs:!0});e.push(xi(c+1,B,l,A.pl??"1mm",A.pw??"0.6mm"))}const i=Math.min(1,A.p/2),o=A.w+i,n=(A.num_pins/2-1)*A.p+A.pw+i,s=[];for(const c of Cfe){const{dx:B,dy:l}=c;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:B*o/2-B*A.p,y:l*n/2},{x:B*o/2,y:l*n/2},{x:B*o/2,y:l*n/2-l*A.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const r=A.p/4,a=-o/2-r/2,g=n/2-A.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:a,y:g},{x:a-r,y:g+r},{x:a-r,y:g-r},{x:a,y:g}],stroke_width:.1});const I=lo(0,n/2+.4,n/12);return{circuitJson:[...e,I,...s],parameters:A}},gK=(t,A,e,i,o,n)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:A,y:e,hole_diameter:wa(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:wa(o),rect_pad_height:wa(n),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()]}),Nj=({fs:t,pn:A,anchor_x:e,anchor_y:i,textalign:o="center",orthogonal:n=!1,verticallyinverted:s=!1,layer:r="top"})=>{let a=0;n&&s?a=270:s?a=180:n?a=90:a=0;let g="center";return o==="left"&&(s?g="center_right":g="center_left"),o==="right"&&(s?g="center_left":g="center_right"),r==="bottom"&&(g==="center_left"?g="center_right":g==="center_right"&&(g="center_left")),{type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:`{PIN${A}}`,layer:r,anchor_position:{x:e,y:i},anchor_alignment:g,ccw_rotation:a}};function hfe({pinlabeltextalignleft:t,pinlabeltextalignright:A,pinlabelorthogonal:e}){let i="top";return e?i="left":i="top",t&&(e?i="bottom":i="right"),A&&(e?i="top":i="left"),i}var ufe=xA({fn:v(),num_pins:vA().optional().default(6),rows:Zt([v(),vA()]).transform(t=>Number(t)).optional().default(1).describe("number of rows"),p:VA.default("0.1in").describe("pitch"),id:VA.default("1.0mm").describe("inner diameter"),od:VA.default("1.5mm").describe("outer diameter"),male:te().optional().describe("for male pin headers"),female:te().optional().describe("for female pin headers"),pinlabeltextalignleft:te().optional().default(!1),pinlabeltextaligncenter:te().optional().default(!1),pinlabeltextalignright:te().optional().default(!1),pinlabelverticallyinverted:te().optional().default(!1),pinlabelorthogonal:te().optional().default(!1),nosquareplating:te().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:te().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:te().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:te().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(t=>{const A=hfe(t);return{...t,pinlabelAnchorSide:A,male:t.male??!t.female,female:t.female??!1}}).superRefine((t,A)=>{t.male&&t.female&&A.addIssue({code:Wt.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),dfe=t=>{const A=ufe.parse(t),{p:e,id:i,od:o,rows:n,num_pins:s,pinlabelAnchorSide:r,pinlabelverticallyinverted:a,pinlabelorthogonal:g,pinlabeltextalignleft:I,pinlabeltextalignright:c,nopinlabels:B,doublesidedpinlabel:l,bottomsidepinlabel:C}=A;let Q="center";I?Q="left":c&&(Q="right");const E=[],h=Math.ceil(s/n),u=-e,d=({xoff:b,yoff:F,od:k,anchorSide:U})=>{let M=0,Y=0;const T=k*.75;switch(U){case"right":M=T;break;case"top":Y=T;break;case"bottom":Y=-T;break;case"left":M=-T;break}return{anchor_x:b+M,anchor_y:F+Y}},f=(b,F,k)=>{b===1&&!A.nosquareplating?E.push(gK(b,F,k,i,o,o)):E.push(Rn(b,F,k,i,o));const{anchor_x:U,anchor_y:M}=d({xoff:F,yoff:k,od:o,anchorSide:r});B||(C?E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"bottom"})):E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"top"})),l&&E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"bottom"})))},D=new Set,w=n>2&&h>2;if(n===1){const b=-((s-1)/2)*e;for(let F=0;F<s;F++){const k=F+1,U=b+F*e,M=`${U},0`;if(D.has(M))throw new Error(`Overlap at ${M}`);D.add(M),f(k,U,0)}}else if(w){const b=-((h-1)/2)*e;let F=1;for(let k=0;k<n&&F<=s;k++)for(let U=0;U<h&&F<=s;U++){const M=b+U*e,Y=k*u,T=`${M},${Y}`;if(D.has(T))throw new Error(`Overlap at ${T}`);D.add(T),f(F++,M,Y)}}else{const b=-((h-1)/2)*e;let F=1,k=0,U=n-1,M=0,Y=h-1;for(;F<=s&&k<=U&&M<=Y;){for(let T=k;T<=U&&F<=s;T++){const J=b+M*e,W=T*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}M++;for(let T=M;T<=Y&&F<=s;T++){const J=b+T*e,W=U*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}if(U--,M<=Y){for(let T=U;T>=k&&F<=s;T--){const J=b+Y*e,W=T*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}Y--}if(k<=U){for(let T=Y;T>=M&&F<=s;T--){const J=b+T*e,W=k*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}k++}}if(F-1<s)throw new Error(`Missing pins: assigned ${F-1}, expected ${s}`)}const x=lo(0,e,.5);return{circuitJson:[...E,x],parameters:A}},pfe=tm({}),ffe=t=>{const A=pfe.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:RD(A),parameters:A}},yfe=tm({p:"1.27mm",w:"3.9mm",legsoutside:!0}),mfe=t=>{const A=yfe.parse({...t,num_pins:8});return{circuitJson:RD(A),parameters:A}},wfe=tm({p:"1.27mm",w:"7.5mm",legsoutside:!0}),Dfe=t=>{const A=wfe.parse({...t,num_pins:16});return{circuitJson:RD(A),parameters:A}},Sfe=xA({fn:v(),num_pins:QA(3).default(3),w:v().default("1.2mm"),h:v().default("1.2mm"),pl:v().default("0.3mm"),pw:v().default("0.32mm")}),bfe=t=>{const A=Sfe.parse(t),e=kfe(A),i=lo(.4,VA.parse(A.h),.2);return{circuitJson:[...e,i],parameters:A}},xfe=t=>{const{pn:A}=t;return A===1?{x:0,y:0}:A===2?{x:1,y:-.4}:{x:1,y:.4}},kfe=t=>{const A=[];for(let e=0;e<3;e++){const{x:i,y:o}=xfe({num_pins:t.num_pins,pn:e+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl)});A.push(xi(e+1,i,o,Number.parseFloat(t.pl),e!==0?Number.parseFloat(t.pw):.42))}return A},Gfe=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("2.36mm"),h:v().default("1.22mm"),pl:v().default("0.9mm"),pw:v().default("0.9mm"),p:v().default("4.19mm")}),Ffe=t=>{const A=Gfe.parse(t),e=lo(0,VA.parse(A.h)/4+.4,.3);return{circuitJson:Rfe(A).concat(e),parameters:A}},_fe=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Rfe=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=_fe({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Nfe=xA({fn:v(),p:VA.optional().default("2.54mm"),id:VA.optional().default("0.7mm"),od:VA.optional().default("1mm")}),Mfe=t=>{const A=Nfe.parse(t),{p:e,id:i,od:o}=A,n=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-e/2+o+i/2,y:0},{x:e/2-o-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},r=lo(0,e/4,.5);return{circuitJson:[...n,s,r],parameters:A}},IK=(t,A={})=>({type:"pcb_silkscreen_path",layer:A.layer||"top",pcb_component_id:A.pcb_component_id||"",pcb_silkscreen_path_id:A.pcb_silkscreen_path_id||"",route:t,stroke_width:A.stroke_width||.1}),vfe=xA({fn:QA("pushbutton"),w:VA.default(4.5),h:VA.default(6.5),id:VA.default(1),od:VA.default(1.2)}),Ufe=t=>{const A=vfe.parse(t),e=A.w,i=A.h,o=A.id,n=[Rn(1,-e/2,i/2,o,o*1.5),Rn(2,-e/2,-i/2,o,o*1.5),Rn(3,e/2,-i/2,o,o*1.5),Rn(4,e/2,i/2,o,o*1.5)],s=[IK([{x:-e/2,y:-i/2},{x:-e/2,y:i/2}]),IK([{x:e/2,y:-i/2},{x:e/2,y:i/2}]),IK([{x:-e/2,y:0},{x:-e/5,y:0},{x:e/5*1/Math.sqrt(2),y:i/8}]),IK([{x:e/2,y:0},{x:e/5,y:0}])],r=lo(0,i/2+.4,.5);return{circuitJson:[...n,...s,r],parameters:A}},fSA=xA({fn:v(),w:VA.default("22.58mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(2),bottom:VA.optional().default(2),p:VA.default(VA.parse("2.54mm")),pw:VA.default(VA.parse("1.6mm")),pl:VA.default(VA.parse("2.4mm")),innerhole:te().default(!1),innerholeedgedistance:VA.default(VA.parse("1.61mm")),silkscreenlabels:te().default(!1),silkscreenlabelmargin:VA.default(VA.parse("0.1mm"))}),Lfe=t=>{const A=fSA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},cK=(t,A,e)=>{let i=[];return e==="right"&&(i=[{x:t+1/2,y:A},{x:t-1/2,y:A+.6/2},{x:t-1/2,y:A-.6/2},{x:t+1/2,y:A}]),e==="left"&&(i=[{x:t-1/2,y:A},{x:t+1/2,y:A+.6/2},{x:t+1/2,y:A-.6/2},{x:t-1/2,y:A}]),e==="top"&&(i=[{x:t,y:A+1/2},{x:t-.6/2,y:A-1/2},{x:t+.6/2,y:A-1/2},{x:t,y:A+1/2}]),e==="bottom"&&(i=[{x:t,y:A-1/2},{x:t-.6/2,y:A+1/2},{x:t+.6/2,y:A+1/2},{x:t,y:A-1/2}]),i},Hfe=t=>{const A=fSA.parse(t),e=A.h??Lfe(A),i=[],o=[],n=[];let s=[];const r=1,a=r,g=A.left+A.right+(A.bottom??0)+(A.top??0),c=`pin${g}`.length*.7/2;if(A.right){const Q=-((A.right-1)/2)*A.p;for(let E=0;E<A.right;E++){if(E===0&&!A.left&&!A.bottom&&!A.silkscreenlabels&&(s=cK(A.w/2-A.pl*1.4,Q+E*A.p,"right")),i.push(xi(E+1+A.left+(A.bottom??0),A.w/2-A.pl/2,Q+E*A.p,A.pl,A.pw)),A.silkscreenlabels){const h=E+1+A.left+(A.bottom??0),u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:A.w/2-A.pl-(c+A.silkscreenlabelmargin),y:Q+E*A.p},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}A.innerhole&&(o.push(Rn(E+1+A.left+(A.bottom??0)+g,A.w/2,Q+E*A.p,r,a)),o.push(Rn(E+1+A.left+(A.bottom??0)+g*2,A.w/2-A.innerholeedgedistance,Q+E*A.p,r,a)))}}if(A.left){const Q=(A.left-1)/2*A.p;for(let E=0;E<A.left;E++){if(E===0&&!A.silkscreenlabels&&(s=cK(-A.w/2+A.pl*1.4,Q-E*A.p,"left")),i.push(xi(E+1,-A.w/2+A.pl/2,Q-E*A.p,A.pl,A.pw)),A.silkscreenlabels){const h=E+1,u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-A.w/2+A.pl+(c+A.silkscreenlabelmargin),y:Q-E*A.p},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}A.innerhole&&(o.push(Rn(E+1+g,-A.w/2,Q-E*A.p,r,a)),o.push(Rn(E+1+g*2,-A.w/2+A.innerholeedgedistance,Q-E*A.p,r,a)))}}if(A.top){const Q=(A.top-1)/2*A.p;for(let E=0;E<A.top;E++){if(E===0&&!A.left&&!A.bottom&&!A.right&&!A.silkscreenlabels&&(s=cK(Q-E*A.p,e/2-A.pl*1.4,"top")),i.push(xi(E+1+A.left+A.right+(A.bottom??0),Q-E*A.p,e/2-A.pl/2,A.pw,A.pl)),A.silkscreenlabels){const h=E+1+A.left+A.right+(A.bottom??0),u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:Q-E*A.p,y:e/2-A.pl-(c+A.silkscreenlabelmargin)},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:270})}A.innerhole&&(o.push(Rn(E+1+A.left+A.right+(A.bottom??0)+g,Q-E*A.p,e/2,r,a)),o.push(Rn(E+1+A.left+A.right+(A.bottom??0)+g*2,Q-E*A.p,e/2-A.innerholeedgedistance,r,a)))}}if(A.bottom){const Q=-((A.bottom-1)/2)*A.p;for(let E=0;E<A.bottom;E++){if(E===0&&!A.left&&!A.silkscreenlabels&&(s=cK(Q+E*A.p,-e/2+A.pl*1.4,"bottom")),i.push(xi(E+1+A.left,Q+E*A.p,-e/2+A.pl/2,A.pw,A.pl)),A.silkscreenlabels){const h=E+1+A.left,u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:Q+E*A.p,y:-e/2+A.pl+(c+A.silkscreenlabelmargin)},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:90})}A.innerhole&&(o.push(Rn(E+1+A.left+g,Q+E*A.p,-e/2,r,a)),o.push(Rn(E+1+A.left+g*2,Q+E*A.p,-e/2+A.innerholeedgedistance,r,a)))}}const B={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:s,stroke_width:.1,layer:"top"},l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2,y:e/2},{x:A.w/2,y:e/2},{x:A.w/2,y:-e/2},{x:-A.w/2,y:-e/2},{x:-A.w/2,y:e/2}],stroke_width:.1,layer:"top"},C=lo(0,e/1.8,e/25);return{circuitJson:[...i,...o,...n,l,...A.silkscreenlabels?[]:[B],C],parameters:A}},ySA=xA({fn:v(),w:VA.default("22.58mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(2),bottom:VA.optional().default(2),p:VA.default(VA.parse("2.54mm")),pw:VA.default(VA.parse("1.6mm")),pl:VA.default(VA.parse("3.2mm")),innerhole:te().default(!1),innerholeedgedistance:VA.default(VA.parse("1.61mm"))}),Yfe=t=>{const A=ySA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},Jfe=(t,A,e,i=1,o=.6)=>{const n=i/2,s=o/2;return{left:[{x:t+n,y:A},{x:t-n,y:A+s},{x:t-n,y:A-s},{x:t+n,y:A}],right:[{x:t-n,y:A},{x:t+n,y:A+s},{x:t+n,y:A-s},{x:t-n,y:A}],top:[{x:t,y:A-n},{x:t-s,y:A+n},{x:t+s,y:A+n},{x:t,y:A-n}],bottom:[{x:t,y:A+n},{x:t-s,y:A-n},{x:t+s,y:A-n},{x:t,y:A+n}]}[e]},Kfe=t=>{const A=ySA.parse(t),e=A.h??Yfe(A),i=[],o=[],n=[],s=1,r=1.2,a=A.left+A.right+(A.bottom??0)+(A.top??0);let g=[],I=1;if(A.left){const C=(A.left-1)/2*A.p;for(let Q=0;Q<A.left;Q++)Q===0&&(g=Jfe(-A.w/2-A.pl/2,C-Q*A.p,"left")),i.push(xi(I,-A.w/2+A.pl/2,C-Q*A.p,A.pl,A.pw)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-A.w/2+A.pl/2-4.5,y:C-Q*A.p},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,-A.w/2+A.innerholeedgedistance,C-Q*A.p,s,r))}if(A.bottom){const C=(A.bottom-1)/2*A.p;for(let Q=A.bottom-1;Q>=0;Q--)i.push(xi(I,C-Q*A.p,-e/2+A.pl/2,A.pw,A.pl)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:C-Q*A.p,y:-e/2+A.pl/2-3.2},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,C-Q*A.p,-e/2+A.innerholeedgedistance,s,r))}if(A.right){const C=-((A.right-1)/2)*A.p;for(let Q=0;Q<A.right;Q++)i.push(xi(I,A.w/2-A.pl/2,C+Q*A.p,A.pl,A.pw)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:A.w/2-A.pl/2+3.7,y:C+Q*A.p},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,A.w/2-A.innerholeedgedistance,C+Q*A.p,s,r))}if(A.top){const C=-((A.top-1)/2)*A.p;for(let Q=A.top-1;Q>=0;Q--)i.push(xi(I,C+Q*A.p,e/2-A.pl/2,A.pw,A.pl)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:C+Q*A.p,y:e/2-A.pl/2+3.2},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,C+Q*A.p,e/2-A.innerholeedgedistance,s,r))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:g,stroke_width:.1},B={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2-A.pl/3,y:e/2+A.pl/3},{x:A.w/2+A.pl/3,y:e/2+A.pl/3},{x:A.w/2+A.pl/3,y:-e/2-A.pl/3},{x:-A.w/2-A.pl/3,y:-e/2-A.pl/3},{x:-A.w/2-A.pl/3,y:e/2+A.pl/3}],stroke_width:.1,layer:"top"},l=lo(0,e/1.8,e/25);return{circuitJson:[...n,...i,...o,B,c,l],parameters:A}},Tfe=t=>(t.legsoutside=!0,p1(t)),mSA=xA({fn:v(),w:VA.default("10mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(0),bottom:VA.optional().default(0),p:VA.default(VA.parse("2.54mm")),id:VA.optional().default(VA.parse("1mm")),od:VA.optional().default(VA.parse("1.5mm"))}),qfe=t=>{const A=mSA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},BK=(t,A,e,i=1,o=.6)=>{const n=i/2,s=o/2;return{left:[{x:t+n,y:A},{x:t-n,y:A+s},{x:t-n,y:A-s},{x:t+n,y:A}],right:[{x:t-n,y:A},{x:t+n,y:A+s},{x:t+n,y:A-s},{x:t-n,y:A}],top:[{x:t,y:A-n},{x:t-s,y:A+n},{x:t+s,y:A+n},{x:t,y:A-n}],bottom:[{x:t,y:A+n},{x:t-s,y:A-n},{x:t+s,y:A-n},{x:t,y:A+n}]}[e]},Pfe=t=>{const A=mSA.parse(t),e=A.h??qfe(A),i=[],o=A.id,n=A.od;let s=[];if(A.right){const I=-((A.right-1)/2)*A.p;for(let c=0;c<A.right;c++)c===0&&!A.left&&!A.bottom&&(s=BK(A.w/2+n*1.4,I+c*A.p,"right")),i.push(Rn(c+1+A.left+(A.bottom??0),A.w/2,I+c*A.p,o,n))}if(A.left){const I=-((A.left-1)/2)*A.p;for(let c=0;c<A.left;c++)c===A.left-1&&(s=BK(-A.w/2-n*1.4,I+c*A.p,"left")),i.push(Rn(c+1,-A.w/2,I+c*A.p,o,n))}if(A.top){const I=-((A.top-1)/2)*A.p;for(let c=0;c<A.top;c++)c===A.top-1&&!A.left&&!A.bottom&&!A.right&&(s=BK(I+c*A.p,e/2+n*1.4,"top")),i.push(Rn(c+1+A.right+(A.bottom??0)+A.left,I+c*A.p,e/2,o,n))}if(A.bottom){const I=-((A.bottom-1)/2)*A.p;for(let c=0;c<A.bottom;c++)c===0&&!A.left&&(s=BK(I+c*A.p,-e/2-n*1.4,"bottom")),i.push(Rn(c+1+A.left,I+c*A.p,-e/2,o,n))}const r={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2-n,y:e/2+n},{x:A.w/2+n,y:e/2+n},{x:A.w/2+n,y:-e/2-n},{x:-A.w/2-n,y:-e/2-n},{x:-A.w/2-n,y:e/2+n}],stroke_width:.1,layer:"top"},g=lo(0,e/1.7,e/25);return{circuitJson:[...i,a,g,r],parameters:A}},wSA=(t,A,e,i)=>Array.from({length:25},(o,n)=>{const s=n/24*Math.PI-Math.PI/2;return{x:t+(i==="right"?1:-1)*Math.cos(s)*e,y:A+Math.sin(s)*e}}),Ofe=xA({fn:v(),p:VA.optional().default("4.88mm"),id:VA.optional().default("0.6mm"),od:VA.optional().default("1.2mm"),w:VA.optional().default("5.6mm"),h:VA.optional().default("3.5mm")}),Wfe=t=>{const A=Ofe.parse(t),{p:e,id:i,od:o,w:n,h:s}=A,r=s/2,a=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],g=wSA(-n/2,0,r,"left"),I=wSA(n/2,0,r,"right"),c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...g,...g.slice(1).reverse(),{x:-n/2,y:-s/2},{x:n/2,y:-s/2},...I,{x:n/2,y:s/2},{x:-n/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},B=lo(0,e/4,.5);return{circuitJson:[...a,c,B],parameters:A}};xA({w:VA,h:VA});var Zfe=t=>{const{w:A,h:e}=t,i=wa(A),o=wa(e);return{circuitJson:[xi(1,0,0,i,o),lo(0,o/2+.5,.2)],parameters:t}},Vfe=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("1.27mm"),id:v().default("0.72mm"),od:v().default("0.95mm"),w:v().default("4.5mm"),h:v().default("4.5mm"),inline:te().default(!1),string:v().optional()}),jfe=(t,A,e)=>Array.from({length:25},(i,o)=>{const n=o/24*Math.PI;return{x:t+Math.cos(n)*e,y:A+Math.sin(n)*e}}),zfe=t=>{const{p:A,id:e,od:i,h:o}=t,n=Number.parseFloat(o)/2,s=Number.parseFloat(A);return[Rn(1,-s,n-s,e,i),Rn(2,s,n-s,e,i)]},Xfe=t=>{const A=t.string?.match(/^to92_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=Vfe.parse({...t,num_pins:e}),{p:o,id:n,od:s,w:r,h:a,inline:g}=i,I=Number.parseFloat(a)/2,c=Number.parseFloat(o);let B=[];if(i.num_pins===3)B=g?[Rn(1,-c,I-c,n,s),Rn(2,0,I-c,n,s),Rn(3,c,I-c,n,s)]:[Rn(1,0,I,n,s),Rn(2,-c,I-c,n,s),Rn(3,c,I-c,n,s)];else if(i.num_pins===2)B=zfe(i);else throw new Error("Invalid number of pins for TO-92");const l=Number.parseFloat(r)/2,C=jfe(0,I,l),Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...C,{x:-l,y:0},{x:l,y:0},C[0]],stroke_width:.1,pcb_silkscreen_path_id:""},E=lo(0,I+1,.5);return{circuitJson:[...B,Q,E],parameters:i}},$fe=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("2.15mm"),h:v().default("1.20mm"),pl:v().default("0.5mm"),pw:v().default("0.6mm"),p:v().default("1.4mm")}),A0e=t=>{const A=$fe.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:t0e(A).concat(i,e),parameters:A}},e0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},t0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=e0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},i0e=tm({}),o0e=t=>{const A=i0e.parse(t),e=[];for(let s=0;s<A.num_pins;s++){const{x:r,y:a}=Fj({num_pins:A.num_pins,pn:s+1,w:A.w,p:A.p??1.27,pl:A.pl,widthincludeslegs:!0});e.push(xi(s+1,r,a,A.pl??"1.5mm",A.pw??"0.6mm"))}const i=(A.num_pins/2-1)*A.p+A.pw,o=lo(0,i/2-.5,i/12),n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-A.w/3,y:i/2+.2},{x:A.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...e,o,n],parameters:A}},n0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("5.0mm"),h:v().default("2.30mm"),pl:v().default("1.25mm"),pw:v().default("2mm"),p:v().default("3.75mm")}),s0e=t=>{const A=n0e.parse(t),e=lo(0,VA.parse(A.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.5,y:VA.parse(A.h)/2+.5},{x:-VA.parse(A.w)/2-.5,y:VA.parse(A.h)/2+.5},{x:-VA.parse(A.w)/2-.5,y:-VA.parse(A.h)/2-.5},{x:VA.parse(A.p)/2+.5,y:-VA.parse(A.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:a0e(A).concat(i,e),parameters:A}},r0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},a0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=r0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},g0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),p:v().default("2.9mm")}),I0e=t=>{const A=g0e.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:B0e(A).concat(i,e),parameters:A}},c0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},B0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=c0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},l0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.30mm"),h:v().default("1.80mm"),pl:v().default("0.60mm"),pw:v().default("0.45mm"),p:v().default("2.1mm")}),C0e=t=>{const A=l0e.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:E0e(A).concat(i,e),parameters:A}},Q0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},E0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Q0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},h0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.4mm"),h:v().default("0.9mm"),pl:v().default("0.35mm"),pw:v().default("0.25mm"),p:v().default("1.2mm")}),u0e=t=>{const A=h0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.15,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.4,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.4,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2+.15,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:p0e(A).concat(i,e),parameters:A}},d0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},p0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=d0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},f0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.3mm"),h:v().default("0.9mm"),pl:v().default("0.4mm"),pw:v().default("0.7mm"),p:v().default("0.7mm")}),y0e=t=>{const A=f0e.parse(t),e=lo(0,VA.parse(A.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.2,y:VA.parse(A.h)/2+.2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2+.2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2-.2},{x:VA.parse(A.p)/2+.2,y:-VA.parse(A.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:w0e(A).concat(i,e),parameters:A}},m0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},w0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=m0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},D0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3,05mm"),h:v().default("1.65mm"),pl:v().default("0.6mm"),pw:v().default("0.6mm"),pad_spacing:v().default("2.2mm")}),S0e=t=>{const A=D0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:x0e(A).concat(i,e),parameters:A}},b0e=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},x0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=b0e({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},k0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),p:v().default("2.9mm")}),G0e=t=>{const A=k0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:_0e(A).concat(i,e),parameters:A}},F0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},_0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=F0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},R0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("0.91mm"),pw:v().default("1.22mm"),p:v().default("3.146mm")}),N0e=t=>{const A=R0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:v0e(A).concat(i,e),parameters:A}},M0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},v0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=M0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},U0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.80mm"),h:v().default("1.00mm"),pl:v().default("0.66mm"),pw:v().default("0.5mm"),p:v().default("0.8mm")}),L0e=t=>{const A=U0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Y0e(A).concat(i,e),parameters:A}},H0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Y0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=H0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},J0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("6.2mm"),h:v().default("3.4mm"),pl:v().default("1.4mm"),pw:v().default("2.1mm"),p:v().default("4.4mm")}),K0e=t=>{const A=J0e.parse(t),e=lo(0,VA.parse(A.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:q0e(A).concat(i,e),parameters:A}},T0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},q0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=T0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},P0e=xA({fn:v(),num_pins:Zt([QA(3),QA(5)]).default(3),w:v().default("4.80mm"),h:v().default("4.80mm"),pl:v().default("1.3mm"),pw:v().default("0.9mm"),p:v().default("1.5mm"),string:v().optional()}),O0e=t=>{const A=[],e=Number.parseFloat(t.p),i=Number.parseFloat(t.pw),o=Number.parseFloat(t.w),n=Number.parseFloat(t.pl);A.push(xi(1,-o/2,e,n,i),xi(2,-o/2+(1.5-1.3)/2,0,1.5,i),xi(3,-o/2,-e,n,i));const s=lo(0,0,.3),r=Number.parseFloat(t.w)/2-1,a=Number.parseFloat(t.h)/2,g={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r,y:a},{x:r,y:a},{x:r,y:a/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},I={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-r,y:-a},{x:r,y:-a},{x:r,y:-a/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,g,I,s]},W0e=t=>{const A=[];Number.parseFloat(t.p),Number.parseFloat(t.pw),Number.parseFloat(t.w),A.push(xi(1,-1.85,-1.5,1.5,.7),xi(2,-1.85,1.5,1.5,.7),xi(3,0,0,.8,2),xi(4,1.85,-1.5,1.5,.7),xi(5,1.85,1.5,1.5,.7));const e=lo(0,Number.parseFloat(t.h)/2+.5,.3),i=Number.parseFloat(t.w)/2-1,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i,y:o}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i,y:-o}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Z0e=t=>{const A=t.string?.match(/^sot89_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=P0e.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:O0e(i),parameters:i};if(i.num_pins===5)return{circuitJson:W0e(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},V0e=xA({fn:v(),p:VA.optional().default("5.0mm"),id:VA.optional().default("1.0mm"),od:VA.optional().default("1.9mm"),w:VA.optional().default("13mm"),h:VA.optional().default("7mm"),num_pins:vA().optional(),string:v().optional()}),j0e=t=>{const A=V0e.parse(t),{fn:e,id:i,od:o,w:n,h:s,string:r}=A,a=Number.parseInt(r?.split("_")[1]??"3"),g=-1,I=n/2,c=s/2,B=2.5,l=n*.4,C=Math.max(B,l/(a-1)),Q=Array.from({length:a},(D,w)=>{const x=a%2===0?(w-a/2+.5)*C:(w-Math.floor(a/2))*C;return Rn(w+1,x,g,i,o)}),E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I,y:-c},{x:I,y:-c},{x:I,y:c},{x:-I,y:c},{x:-I,y:-c}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-c+2*s/3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I,y:h},{x:I,y:h}],stroke_width:.1,pcb_silkscreen_path_id:""},d=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/6,y:h},{x:-n/6,y:c}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:n/6,y:h},{x:n/6,y:c}],stroke_width:.1,pcb_silkscreen_path_id:""}],f=lo(0,s/2+.6,.5);return{circuitJson:[...Q,E,u,...d,f],parameters:{...A,p:C}}},z0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("5.40mm"),h:v().default("2.30mm"),pl:v().default("1.30mm"),pw:v().default("1.70mm"),p:v().default("3.5mm")}),X0e=t=>{const A=z0e.parse(t),e=lo(0,VA.parse(A.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Aye(A).concat(i,e),parameters:A}},$0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Aye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=$0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},eye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.90mm"),h:v().default("1.33mm"),pl:v().default("0.5mm"),pw:v().default("0.7mm"),p:v().default("0.8mm")}),tye=t=>{const A=eye.parse(t),e=lo(0,VA.parse(A.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2+.1,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:oye(A).concat(i,e),parameters:A}},iye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},oye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=iye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},nye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.0mm"),h:v().default("3.35mm"),pl:v().default("1.50mm"),pw:v().default("2.70mm"),p:v().default("4.8mm")}),sye=t=>{const A=nye.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:aye(A).concat(i,e),parameters:A}},rye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},aye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=rye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},gye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.0mm"),h:v().default("1.80mm"),pl:v().default("0.80mm"),pw:v().default("1.20mm"),p:v().default("1.6mm")}),Iye=t=>{const A=gye.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bye(A).concat(i,e),parameters:A}},cye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Bye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=cye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},lye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.10mm"),h:v().default("3.40mm"),pl:v().default("2.45mm"),pw:v().default("1.80mm"),p:v().default("4.05mm")}),Cye=t=>{const A=lye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.5,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.5,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Eye(A).concat(i,e),parameters:A}},Qye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Eye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Qye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},hye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.80mm"),h:v().default("2.10mm"),pl:v().default("1.30mm"),pw:v().default("1.40mm"),p:v().default("2.9mm")}),uye=t=>{const A=hye.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:pye(A).concat(i,e),parameters:A}},dye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},pye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=dye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},fye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.30mm"),h:v().default("4.40mm"),pl:v().default("2.50mm"),pw:v().default("2.30mm"),p:v().default("4.30mm")}),yye=t=>{const A=fye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:wye(A).concat(i,e),parameters:A}},mye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},wye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=mye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Dye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("10.70mm"),h:v().default("6.60mm"),pl:v().default("3.30mm"),pw:v().default("2.50mm"),p:v().default("6.80mm")}),Sye=t=>{const A=Dye.parse(t),e=lo(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2-.8},{x:-VA.parse(A.w)/2-.8,y:VA.parse(A.h)/2-.8},{x:-VA.parse(A.w)/2-.8,y:-VA.parse(A.h)/2+.8},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:xye(A).concat(i,e),parameters:A}},bye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},xye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=bye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},kye=xA({fn:v(),num_pins:vA().default(4),w:v().default("8.50mm"),h:v().default("6.90mm"),pl:v().default("2mm"),pw:v().default("1.5mm"),p:v().default("2.30mm"),string:v().optional()}),Gye=t=>{const A=t.string?.match(/^sot223_(\d+)/),e=A?Number.parseInt(A[1],10):4;if(e===8){const o=Rye.parse({...t,num_pins:e});return{circuitJson:RD(o),parameters:o}}const i=kye.parse({...t,num_pins:e});if(i.num_pins===4)return{circuitJson:_ye(i),parameters:i};if(i.num_pins===5)return{circuitJson:Mye(i),parameters:i};if(i.num_pins===6)return{circuitJson:Uye(i),parameters:i};throw new Error("Invalid number of pins")},Fye=t=>{const{pn:A,w:e,p:i}=t;return A===1?{x:-e/2+1.1,y:i}:A===2?{x:-e/2+1.1,y:0}:A===3?{x:-e/2+1.1,y:-i}:{x:e/2-1.1,y:0}},_ye=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Fye({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)}),I=r===3?3.8:Number.parseFloat(t.pw);A.push(xi(r+1,a,g,Number.parseFloat(t.pl),I))}const e=lo(0,0,.3),i=Number.parseFloat(t.w)/2-2.4,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i,y:o},{x:i,y:o/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i,y:-o},{x:i,y:-o/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Rye=tm({p:"0.90mm",w:"2.8mm",legsoutside:!0}),Nye=t=>{const{p:A,pn:e,w:i}=t;if(e===1)return{x:-i/2+1.2,y:A/2+A};if(e===2)return{x:-i/2+1.2,y:A/2};if(e===3)return{x:-i/2+1.2,y:-A/2};if(e===4)return{x:-i/2+1.2,y:-A/2-A};if(e===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},Mye=t=>{const A=[];for(let r=1;r<=t.num_pins;r++){const{x:a,y:g}=Nye({h:Number.parseFloat(t.h),p:1.5,pn:r,w:Number.parseFloat(t.w)});let I=Number.parseFloat(t.pw),c=Number.parseFloat(t.pl);r===5?(I=3.4,c=1.8):(I=1,c=2.2),A.push(xi(r,a,g,c,I))}const e=Number.parseFloat(t.w)/2-2.4,i=Number.parseFloat(t.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e,y:i},{x:e,y:i},{x:e,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e,y:-i},{x:e,y:-i},{x:e,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=lo(0,0,.3);return[...A,o,n,s]},vye=t=>{const{p:A,pn:e,w:i}=t;if(e===1)return{x:-i/2+1.2,y:2*A};if(e===2)return{x:-i/2+1.2,y:A};if(e===3)return{x:-i/2+1.2,y:0};if(e===4)return{x:-i/2+1.2,y:-A};if(e===5)return{x:-i/2+1.2,y:-2*A};if(e===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},Uye=t=>{const A=[];for(let r=1;r<=t.num_pins;r++){const{x:a,y:g}=vye({h:Number.parseFloat(t.h),p:1.3,pn:r,w:8.7});let I=Number.parseFloat(t.pw),c=Number.parseFloat(t.pl);r===6?(I=3.4,c=2.15):(I=.6,c=2.2),A.push(xi(r,a,g,c,I))}const e=Number.parseFloat(t.w)/2-2.4,i=Number.parseFloat(t.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e,y:i},{x:e,y:i},{x:e,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e,y:-i},{x:e,y:-i},{x:e,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=lo(0,0,.3);return[...A,o,n,s]},Lye=xA({fn:v(),num_pins:vA().default(3),w:v().default("3.40mm"),h:v().default("3.30mm"),pl:v().default("1mm"),pw:v().default("0.7mm"),p:v().default("1.2mm"),string:v().optional()}),Hye=t=>{const A=t.string?.match(/^sot23w_(\d+)/),e=A?Number.parseInt(A[1],3):3,i=Lye.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:Jye(i),parameters:i};throw new Error("Invalid number of pins")},Yye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e,y:.95}:A===2?{x:-e,y:-.95}:{x:e,y:0}},Jye=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Yye({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)});A.push(xi(r+1,a,g,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h)/2+1,.3),i=Number.parseFloat(t.w)/2-1,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i+.3,y:o},{x:i+.3,y:o/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i+.3,y:-o},{x:i+.3,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Kye=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("1.27mm"),id:v().default("0.72mm"),od:v().default("0.95mm"),w:v().default("2.5mm"),h:v().default("4.2mm"),string:v().optional()}),Tye=t=>{const{p:A,id:e,od:i,w:o,h:n}=t,s=Number.parseFloat(n)/2,r=Number.parseFloat(A);return[Rn(1,-r,s-r,e,i),Rn(2,0,s-r,e,i),Rn(3,r,s-r,e,i)]},qye=t=>{const{p:A,id:e,od:i,h:o}=t,n=Number.parseFloat(o)/2,s=Number.parseFloat(A);return[Rn(1,-s,n-s,e,i),Rn(2,s,n-s,e,i)]},Pye=t=>{const A=t.string?.match(/^to92s_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=Kye.parse({...t,num_pins:e});let o=[];if(i.num_pins===3)o=Tye(i);else if(i.num_pins===2)o=qye(i);else throw new Error("Invalid number of pins for TO-92");const n=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),r={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n,y:n-s},{x:-1.9,y:0},{x:1.9,y:0},{x:n,y:n-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-n,y:n-s}],stroke_width:.1,pcb_silkscreen_path_id:""},a=lo(0,n+1,.5);return{circuitJson:[...o,r,a],parameters:i}},Oye=xA({fn:v(),p:VA.optional(),id:VA.optional(),pw:VA.optional(),pl:VA.optional(),w:VA.optional(),h:VA.optional(),sh:Zt([te(),v(),vA()]).optional().transform(t=>{if(typeof t=="string"){const A=Number(t);return Number.isNaN(A)?!0:A}return t}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:te().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:v().optional()}),Wye={ph:{p:VA.parse("2.2mm"),id:VA.parse("0.70mm"),pw:VA.parse("1.20mm"),pl:VA.parse("1.20mm"),w:VA.parse("6mm"),h:VA.parse("5mm")},sh:{p:VA.parse("1mm"),pw:VA.parse("0.6mm"),pl:VA.parse("1.55mm"),w:VA.parse("5.8mm"),h:VA.parse("7.8mm")}};function Zye(t){return t.sh?"sh":(t.ph,"ph")}function Vye(t,A,e,i,o,n){const s=[];if(t==="ph"){const r=e/2;s.push(gK(1,-r,2,i,o,n)),s.push(gK(2,r,2,i,o,n))}else{const r=-((A-1)/2)*e;for(let g=0;g<A;g++){const I=r+g*e;console.log("x si",I),s.push(xi(g+1,I,-1.325,o,n))}const a=(A-1)/2*e+1.3;console.log("offset",a),s.push(xi(A+1,-a,1.22,1.2,1.8)),s.push(xi(A+2,a,1.22,1.2,1.8))}return s}function jye(t,A,e){return t==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var zye=t=>{const A=Oye.parse(t),e=Zye(A),i=Wye[e],o=A.p??i.p,n=A.id??i.id,s=A.pw??i.pw,r=A.pl??i.pl,a=A.w??i.w,g=A.h??i.h;let I=e==="sh"?4:2;if(e==="sh"){const Q=(typeof t.string=="string"?t.string:"").match(/sh(\d+)/);if(Q&&Q[1]){const E=parseInt(Q[1],10);Number.isNaN(E)||(I=E)}else typeof A.sh=="number"&&(I=A.sh)}const c=Vye(e,I,o,n,s,r),B=jye(e),l=lo(0,g/2+1,.5);return{circuitJson:[...c,B,l],parameters:{...A,p:o,id:n,pw:s,pl:r,w:a,h:g,num_pins:I,sh:e==="sh",ph:e==="ph"}}},Xye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.30mm"),h:v().default("1.70mm"),pl:v().default("0.80mm"),pw:v().default("1mm"),p:v().default("1.90mm")}),$ye=t=>{const A=Xye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:eme(A).concat(i,e),parameters:A}},Ame=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},eme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Ame({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},tme=t=>{switch(t){case 8:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"};case 10:return{w:"3.10mm",h:"3.33mm",p:"0.5mm",pl:"1.45mm",pw:"0.3mm"};default:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"}}},ime=xA({fn:v(),num_pins:Zt([QA(8),QA(10)]).default(8),w:v().optional(),h:v().optional(),p:v().optional(),pl:v().optional(),pw:v().optional(),string:v().optional()}),ome=t=>{const A=ime.parse(t),e=tme(A.num_pins),i=VA.parse(A.w||e.w),o=VA.parse(A.h||e.h),n=VA.parse(A.p||e.p),s=VA.parse(A.pl||e.pl),r=VA.parse(A.pw||e.pw),a=[],g=A.num_pins/2;for(let u=0;u<A.num_pins;u++){const{x:d,y:f}=DSA(A.num_pins,u+1,i,n),D=u<g?u+1:A.num_pins-(u-g);a.push(xi(D,d,f,s,r))}const I=i,c=o,B={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I/2,y:c/2},{x:I/2,y:c/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I/2,y:-c/2},{x:I/2,y:-c/2}],stroke_width:.05,pcb_silkscreen_path_id:""},C=DSA(A.num_pins,1,I,n),Q={x:C.x-.8,y:C.y},E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:Q.x-.4,y:Q.y},{x:Q.x-.7,y:Q.y+.3},{x:Q.x-.7,y:Q.y-.3},{x:Q.x-.4,y:Q.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=lo(0,c/2+.5,.3);return{circuitJson:[...a,B,l,h,E],parameters:A}},DSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse(t===8?"1.8mm":"2.2mm"),y:r*i}},nme=t=>{switch(t){case 10:return{w:"3.10mm",h:"3.32mm",p:"0.5mm",pl:"1.63mm",pw:"0.33mm"};case 12:return{w:"3mm",h:"4mm",p:"0.65mm",pl:"0.88mm",pw:"0.4mm"};case 16:return{w:"3.10mm",h:"4mm",p:"0.5mm",pl:"0.88mm",pw:"0.3mm"};default:return{w:"3.10mm",h:"3.32mm",p:"0.65mm",pl:"1.63mm",pw:"0.4mm"}}},sme=xA({fn:v(),num_pins:Zt([QA(8),QA(10),QA(12),QA(16)]).default(8),w:v().optional(),h:v().optional(),p:v().optional(),pl:v().optional(),pw:v().optional(),string:v().optional()}),SSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse("2mm"),y:r*i}},rme=t=>{const A=sme.parse(t),e=nme(A.num_pins),i=VA.parse(A.w||e.w),o=VA.parse(A.h||e.h),n=VA.parse(A.p||e.p),s=VA.parse(A.pl||e.pl),r=VA.parse(A.pw||e.pw),a=[];for(let h=0;h<A.num_pins;h++){const{x:u,y:d}=SSA(A.num_pins,h+1,i,n);a.push(xi(h+1,u,d,s,r))}const g=i,I=o,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-g/2,y:I/2},{x:g/2,y:I/2}],stroke_width:.05,pcb_silkscreen_path_id:""},B={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-g/2,y:-I/2},{x:g/2,y:-I/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l=SSA(A.num_pins,1,g,n),C={x:l.x-.8,y:l.y},Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:C.x-.4,y:C.y},{x:C.x-.7,y:C.y+.3},{x:C.x-.7,y:C.y-.3},{x:C.x-.4,y:C.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},E=lo(0,I/2+.5,.3);return{circuitJson:[...a,c,B,E,Q],parameters:A}},ame=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.8mm"),h:v().default("1.65mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),pad_spacing:v().default("2.6mm")}),gme=t=>{const A=ame.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:cme(A).concat(i,e),parameters:A}},Ime=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},cme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Ime({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Bme=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.20mm"),h:v().default("1.65mm"),pl:v().default("0.8mm"),pw:v().default("0.9mm"),pad_spacing:v().default("2.1mm")}),lme=t=>{const A=Bme.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Qme(A).concat(i,e),parameters:A}},Cme=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Qme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Cme({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Eme=xA({fn:v(),num_pins:Zt([QA(6),QA(8)]).default(8),w:v().default("3mm"),h:v().default("3mm"),p:v().default("0.5mm"),pl:v().default("0.52mm"),pw:v().default("0.35mm"),epw:v().default("1.40mm"),eph:v().default("1.60mm"),string:v().optional(),ep:te().default(!1)}),hme=t=>{t.string&&t.string.includes("_ep")&&(t.ep=!0);const A=t.string?.match(/^son_(\d+)/),e=A?Number.parseInt(A[1],10):t.num_pins||8,i=Eme.parse({...t,num_pins:e}),o=VA.parse(i.w),n=VA.parse(i.h),s=VA.parse(i.p),r=VA.parse(i.pl),a=VA.parse(i.pw),g=VA.parse(i.epw),I=VA.parse(i.eph),c=[];for(let f=0;f<i.num_pins;f++){const{x:D,y:w}=bSA(i.num_pins,f+1,o,s);c.push(xi(f+1,D,w,r,a))}i.ep&&c.push(xi(i.num_pins+1,0,0,g,I));const B=o,l=n,C={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B/2,y:l/2},{x:B/2,y:l/2}],stroke_width:.05,pcb_silkscreen_path_id:""},Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B/2,y:-l/2},{x:B/2,y:-l/2}],stroke_width:.05,pcb_silkscreen_path_id:""},E=bSA(i.num_pins,1,B,s),h={x:E.x-.4,y:E.y},u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:h.x-.4,y:h.y},{x:h.x-.7,y:h.y+.3},{x:h.x-.7,y:h.y-.3},{x:h.x-.4,y:h.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},d=lo(0,l/2+.5,.3);return{circuitJson:[...c,C,Q,d,u],parameters:i}},bSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse("1.4mm"),y:r*i}},ume=t=>{const{num_pins:A,bridged:e,p:i=2.54,pw:o=1.5,ph:n=1.5}=t,s=VA.parse(i),r=VA.parse(o),a=VA.parse(n),g=Math.min(a/4,.5),I=[];for(let f=0;f<A;f++)I.push(xi(f+1,f*s,0,r,a));let c=[];if(e){const f=e.split("").map(Number);if(f.length>1)for(let D=0;D<f.length-1;D++){const w=f[D],x=f[D+1];if(typeof w=="number"&&typeof x=="number"&&!isNaN(w)&&!isNaN(x)){const b=(w-1)*s,F=(x-1)*s,k=Math.sign(F-b),U=b+k*(r/2),M=F-k*(r/2);c.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${w}}`,x:U,y:0,width:g,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${x}}`,x:M,y:0,width:g,layer:"top",route_type:"wire"}]})}}}const B=(A-1)*s+r+.7,l=a+1,C=(A-1)*s/2,Q=0,E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:C-B/2,y:Q-l/2},{x:C+B/2,y:Q-l/2},{x:C+B/2,y:Q+l/2},{x:C-B/2,y:Q+l/2},{x:C-B/2,y:Q-l/2}],stroke_width:.15},u=Q+l/2+.6,d=lo(C,u,.4);return{circuitJson:[...I,...c,E,d],parameters:t}},xSA={fn:QA("sot457"),num_pins:QA(6).default(6),pillh:v().default("0.45mm"),pillw:v().default("1.45mm"),pl:v(),pw:v(),p:v(),wave:te().optional(),reflow:te().optional()},dme=xA({...xSA,h:v().default("2.5mm"),w:v().default("2.7mm"),pl:v().default("0.8mm"),pw:v().default("0.55mm"),p:v().default("0.95mm")}),pme=xA({...xSA,h:v().default("3mm"),w:v().default("4mm"),pillr:v().default("0.225mm"),pl:v().default("1.45mm"),pw:v().default("1.5mm"),p:v().default("1.475mm")}).transform(t=>({...t,wave:t.wave??(t.reflow===void 0?!0:!t.reflow),reflow:t.reflow??(t.wave===void 0?!1:!t.wave)})),ND=t=>Number.parseFloat(t.replace("mm","")),kSA=({pitch:t,width:A,pinNumber:e})=>{const n={1:{x:-A/2-.1,y:t},2:{x:-A/2-.1,y:0},3:{x:-A/2-.1,y:-t},4:{x:A/2+.1,y:-t},5:{x:A/2+.1,y:0},6:{x:A/2+.1,y:t}}[e];if(!n)throw new Error(`Invalid pin number: ${e}`);return n},GSA=t=>{const A=[],e=ND(t.p),i=ND(t.pl),o=ND(t.pw),n=ND(t.w),s=ND(t.h);if(t.wave){const C={1:({padWidth:Q,padHeight:E})=>xi(1,-e,e,E,Q),2:({padWidth:Q,padHeight:E})=>xi(2,-e,-e,E,Q),3:({padWidth:Q,padHeight:E})=>aK(3,-e,0,ND(t.pillw),ND(t.pillh)),4:({padWidth:Q,padHeight:E})=>aK(4,e,0,ND(t.pillw),ND(t.pillh)),5:({padWidth:Q,padHeight:E})=>xi(5,e,e,E,Q),6:({padWidth:Q,padHeight:E})=>xi(6,e,-e,E,Q)};for(let Q=1;Q<=t.num_pins;Q++){const E=C[Q];E&&A.push(E({padWidth:i,padHeight:o}))}}else for(let C=1;C<=t.num_pins;C++){const{x:Q,y:E}=kSA({pitch:e,width:n,pinNumber:C});A.push(xi(C,Q,E,i,o))}const r={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-n/3,y:s/2+e/1.3},{x:n/3,y:s/2+e/1.3}],stroke_width:.05},a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-n/3,y:-s/2-e/1.3},{x:n/3,y:-s/2-e/1.3}],stroke_width:.05},g=lo(0,s+.5,.3),I=kSA({pitch:e,width:n,pinNumber:1}),c=t.wave?1:.5,B=t.wave?.7:.3;I.x-=t.wave?o:o*1.7;const l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:I.x+c/2,y:I.y},{x:I.x-c/2,y:I.y+B/2},{x:I.x-c/2,y:I.y-B/2},{x:I.x+c/2,y:I.y}],stroke_width:.05};return[g,r,a,l,...A]},fme=t=>{if(t.wave){const e=pme.parse({...t,fn:"sot457"});return{circuitJson:GSA(e),parameters:e}}const A=dme.parse(t);return{circuitJson:GSA(A),parameters:A}},yme=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("3.8mm"),id:v().default("1.25mm"),od:v().default("2.35mm"),ca:v().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:v().default("5.35mm"),h:v().default("4mm"),string:v().optional()}),mme=t=>{const{p:A,id:e,od:i,h:o,ca:n}=t,s=Number.parseFloat(o),r=Number.parseFloat(n);return[Rn(1,0,r/4+.3,e,i),Rn(2,s,0,e,i),Rn(3,0,-r/4-.3,e,i)]},wme=t=>{const A=t.string?.match(/^potentiometer_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=yme.parse({...t,num_pins:e});let o=[];i.num_pins===3&&(o=mme(i));const n=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),r=Number.parseFloat(i.od)/2+.35,a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:n-1.75},{x:0,y:n},{x:s,y:n},{x:s,y:r}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-r},{x:s,y:-n},{x:0,y:-n},{x:0,y:-n+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},I=Number.parseFloat(i.w)/2,c=lo(I,n+1,.5);return{circuitJson:[...o,a,g,c],parameters:i}},Dme=xA({fn:v(),p:VA.optional().default("7.5mm"),id:VA.optional().default("1mm"),od:VA.optional().default("2mm"),d:VA.optional().default("10.5mm")}),Sme=(t,A,e,i,o)=>{const n=[],s=[];for(let r=0;r<=50;r++){const a=r/50*Math.PI,g=t+Math.cos(a)*e,I=A+Math.sin(a)*e;g<t-i&&I>=A-o/2&&I<=A+o/2||n.push({x:g,y:I})}for(let r=0;r<=50;r++){const a=Math.PI+r/50*Math.PI,g=t+Math.cos(a)*e,I=A+Math.sin(a)*e;g<t-i&&I>=A-o/2&&I<=A+o/2||s.push({x:g,y:I})}return{topArc:n,bottomArc:s}},bme=t=>{const A=Dme.parse(t),{p:e,id:i,od:o,d:n}=A,s=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],{topArc:r,bottomArc:a}=Sme(0,0,n/2+.1,o/2,o),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:r,stroke_width:.1,pcb_silkscreen_path_id:""},I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:a,stroke_width:.1,pcb_silkscreen_path_id:""},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:n/2+.1},{x:0,y:-(n/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},B=-(n/2+.5),l=o/2+1.5,C=.5,Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:B-C,y:l},{x:B+C,y:l}],stroke_width:.1,pcb_silkscreen_path_id:""},E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:B,y:l-C},{x:B,y:l+C}],stroke_width:.1,pcb_silkscreen_path_id:""},h=lo(0,n/2+1,.5);return{circuitJson:[...s,g,I,c,Q,E,h],parameters:A}},xme=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("6.5mm"),h:v().default("3mm"),pl:v().default("1.75mm"),pw:v().default("2.40mm"),p:v().default("4.75mm")}),kme=t=>{const A=xme.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.3,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.3,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Fme(A).concat(i,e),parameters:A}},Gme=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Fme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Gme({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},_me=xA({fn:v(),num_pins:vA().default(3),w:v().default("2.45mm"),h:v().default("2.40mm"),pl:v().default("0.45mm"),pw:v().default("0.70mm"),p:v().default("1mm"),string:v().optional()}),Rme=t=>{const A=t.string?.match(/^sot323_(\d+)/),e=A?Number.parseInt(A[1],3):3,i=_me.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:Mme(i),parameters:i};throw new Error("Invalid number of pins")},Nme=t=>{const{pn:A,p:e}=t;return A===1?{x:-e,y:.65}:A===2?{x:-e,y:-.65}:{x:e,y:0}},Mme=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Nme({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)});A.push(xi(r+1,a,g,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h)/2+1,.3),i=Number.parseFloat(t.w)/2-Number.parseFloat(t.pl),o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o+.3},{x:i,y:o+.3},{x:i,y:o/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o-.3},{x:i,y:-o-.3},{x:i,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},vme=xA({fn:v(),circle:te().optional(),rect:te().optional(),square:te().optional(),pill:te().optional(),d:VA.optional(),pd:VA.optional(),diameter:VA.optional(),r:VA.optional(),pr:VA.optional(),radius:VA.optional(),w:VA.optional(),pw:VA.optional(),width:VA.optional(),h:VA.optional(),ph:VA.optional(),height:VA.optional(),s:VA.optional(),size:VA.optional(),string:v().optional()}).transform(t=>{let A="rect";t.circle&&(A="circle"),t.square&&(A="square"),t.rect&&(A="rect"),t.pill&&(A="pill");let e,i,o;return A==="circle"?t.r!==void 0?e=wa(t.r):t.pr!==void 0?e=wa(t.pr):t.radius!==void 0?e=wa(t.radius):t.d!==void 0?e=wa(t.d)/2:t.pd!==void 0?e=wa(t.pd)/2:t.diameter!==void 0?e=wa(t.diameter)/2:e=wa("1mm")/2:(t.w!==void 0?i=wa(t.w):t.pw!==void 0?i=wa(t.pw):t.width!==void 0?i=wa(t.width):t.s!==void 0?i=wa(t.s):t.size!==void 0?i=wa(t.size):i=wa("1mm"),t.h!==void 0?o=wa(t.h):t.ph!==void 0?o=wa(t.ph):t.height!==void 0?o=wa(t.height):A==="square"||A==="rect"?o=i:o=wa("1mm")),{fn:t.fn,shape:A,radius:e,width:i,height:o}}),Ume=t=>{const A=vme.parse(t),{shape:e,radius:i,width:o,height:n}=A;let s,r;return e==="circle"?(s=lSA(1,{x:0,y:0,radius:i}),r=i+.5):e==="pill"?(s=aK(1,0,0,o,n),r=Math.max(o,n)/2+.5):(s=xi(1,0,0,o,n),r=n/2+.5),{circuitJson:[s,lo(0,r,.2)],parameters:A}},Lme=xA({fn:v(),d:VA.optional(),hd:VA.optional(),r:VA.optional(),hr:VA.optional(),pd:VA.optional(),pr:VA.optional(),squarepad:te().optional().default(!1)}).transform(t=>{let A;t.d!==void 0?A=wa(t.d):t.hd!==void 0?A=wa(t.hd):t.r!==void 0?A=wa(t.r)*2:t.hr!==void 0?A=wa(t.hr)*2:A=wa("1mm");let e;return t.pd!==void 0?e=wa(t.pd):t.pr!==void 0?e=wa(t.pr)*2:e=A*(1.5/1),{fn:t.fn,d:A,pd:e,squarepad:t.squarepad??!1}}),Hme=t=>{const A=Lme.parse(t),{d:e,pd:i,squarepad:o}=A;return{circuitJson:[o?gK(1,0,0,e,i,i):Rn(1,0,0,e,i),lo(0,i/2+.5,.2)],parameters:A}},Yme=xA({fn:v(),num_pins:QA(6).default(6),h:v().default("1.6mm"),pl:v().default("1mm"),pw:v().default("0.7mm"),p:v().default("0.95mm")}),Jme=t=>{const A=Yme.parse(t);return{circuitJson:Kme(A),parameters:A}},FSA=t=>{const{p:A,h:e,pn:i}=t;if(i===1)return{x:-e/2-.5,y:A};if(i===2)return{x:-e/2-.5,y:0};if(i===3)return{x:-e/2-.5,y:-A};if(i===4)return{x:e/2+.5,y:-A};if(i===5)return{x:e/2+.5,y:0};if(i===6)return{x:e/2+.5,y:A};throw new Error("Invalid pin number")},Kme=t=>{const A=[];for(let c=1;c<=t.num_pins;c++){const{x:B,y:l}=FSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:c});A.push(xi(c,B,l,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=t.num_pins/2*Number.parseFloat(t.p),i=Number.parseFloat(t.h),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e/3,y:i/2+Number.parseFloat(t.p)/1.3},{x:e/3,y:i/2+Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e/3,y:-i/2-Number.parseFloat(t.p)/1.3},{x:e/3,y:-i/2-Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=lo(0,i+.3,.3),r=FSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:1});r.x=r.x-Number.parseFloat(t.pw)*1.5;const a=.7,g=.3,I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:r.x+a/2,y:r.y},{x:r.x-a/2,y:r.y+g/2},{x:r.x-a/2,y:r.y-g/2},{x:r.x+a/2,y:r.y}],stroke_width:.05};return[...A,s,o,n,I]},Tme=xA({fn:v()}),qme=t=>{const A=Tme.parse(t),e=[],i=.5-.15,o=1.5,s=.5/2,r=75,a=-37/2;for(let x=0;x<r;x++){const b=x+1;if(b>=24&&b<=31)continue;const F=a-x*s,k=b%2===0,U=o+(k?.25:0),Y=.5-U/2,T=xi(b,Y,F,U,i);T.layer=k?"bottom":"top",e.push(T)}const g=46*.0254,I=137*.0254,c=261*.0254,B={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-I/2+o/2,y:a-c},width:I,height:g},l={x:-.5,y:a},C={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:l.x-.4,y:l.y},{x:l.x-.7,y:l.y+.3},{x:l.x-.7,y:l.y-.3},{x:l.x-.4,y:l.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"};let Q=1/0,E=-1/0,h=1/0,u=-1/0;const d=(x,b,F=0,k=0)=>{Q=Math.min(Q,x-F/2),E=Math.max(E,x+F/2),h=Math.min(h,b-k/2),u=Math.max(u,b+k/2)};for(const x of e)d(x.x,x.y,x.width,x.height);d(B.center.x,B.center.y,B.width,B.height);for(const x of C.route)d(x.x,x.y);const f=(Q+E)/2,D=(h+u)/2,w=x=>{typeof x.x=="number"&&(x.x-=f),typeof x.y=="number"&&(x.y-=D),x.center&&(x.center.x-=f,x.center.y-=D),Array.isArray(x.route)&&(x.route=x.route.map(b=>({x:b.x-f,y:b.y-D})))};for(const x of e)w(x);return w(B),w(C),{circuitJson:[...e,B,C],parameters:A}};function Pme(t){return t!=null}var Ome=(t,A)=>{if(!A)return t;const e=t.filter(I=>I.type==="pcb_smtpad"||I.type==="pcb_plated_hole"||I.type==="pcb_thtpad");if(e.length===0)return t;let i=1/0,o=-1/0,n=1/0,s=-1/0;const r=(I,c,B=0,l=0)=>{const C=I-B/2,Q=I+B/2,E=c-l/2,h=c+l/2;i=Math.min(i,C),o=Math.max(o,Q),n=Math.min(n,E),s=Math.max(s,h)};for(const I of e)if(I.type==="pcb_smtpad"){const c=I.shape==="circle"?I.radius*2:I.width,B=I.shape==="circle"?I.radius*2:I.height;r(I.x,I.y,c,B)}else if(I.type==="pcb_plated_hole"){const c=I.outer_diameter??I.hole_diameter;r(I.x,I.y,c,c)}else if(I.type==="pcb_thtpad"){const c=I.diameter;r(I.x,I.y,c,c)}let a=0,g=0;switch(A){case"center":a=(i+o)/2,g=(n+s)/2;break;case"bottomleft":a=i,g=n;break;case"bottomcenter":case"centerbottom":a=(i+o)/2,g=n;break;case"topcenter":case"centertop":a=(i+o)/2,g=s;break;case"leftcenter":case"centerleft":a=i,g=(n+s)/2;break;case"rightcenter":case"centerright":a=o,g=(n+s)/2;break;case"pin1":const I=e.find(c=>c.port_hints?.[0]==="1")||e[0];a=I.x,g=I.y;break}if(a===0&&g===0)return t;for(const I of t){if(typeof I.x=="number"&&(I.x-=a),typeof I.y=="number"&&(I.y-=g),I.center&&typeof I.center.x=="number"&&(I.center.x-=a,I.center.y-=g),I.type==="pcb_silkscreen_path")for(const c of I.route)c.x-=a,c.y-=g;I.type==="pcb_silkscreen_text"&&I.anchor_position&&(I.anchor_position.x-=a,I.anchor_position.y-=g)}return t},Wme=t=>{let A=lK();const i=t.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(o=>{const n=o.match(/([a-z]+)([\(\d\.\+\?].*)?/);if(!n)return null;const[,s,r]=n;return!s||r?.includes("?")?null:{fn:s,v:r}}).filter(Pme);for(const{fn:o,v:n}of i)A=A[o](n);return A.setString(t),A},Zme=()=>Object.keys(_D),lK=()=>{const t=new Proxy({},{get:(A,e)=>{if(e==="soup"||e==="circuitJson"){if("fn"in A&&_D[A.fn])return()=>{const{circuitJson:i}=_D[A.fn](A);return Ome(i,A.origin)};if(!_D[A.fn])throw new Error(`Invalid footprint function, got "${A.fn}"${A.string?`, from string "${A.string}"`:""}`);return()=>{throw new Error(`No function found for footprinter, make sure to specify .dip, .lr, .p, etc. Got "${e}"`)}}if(e==="json"){if(!_D[A.fn])throw new Error(`Invalid footprint function, got "${A.fn}"${A.string?`, from string "${A.string}"`:""}`);return()=>_D[A.fn](A).parameters}return e==="getFootprintNames"?()=>Object.keys(_D):e==="params"?()=>A:e==="setString"?i=>(A.string=i,t):i=>(Object.keys(A).length===0?`${e}${i}`in _D?(A[`${e}${i}`]=!0,A.fn=`${e}${i}`):(A[e]=!0,A.fn=e,e==="res"||e==="cap"?i&&(typeof i=="string"&&i.includes("_metric")?A.metric=i.split("_metric")[0]:A.imperial=i):A.num_pins=Number.isNaN(Number.parseFloat(i))?void 0:Number.parseFloat(i)):!i&&["w","h","p"].includes(e)||(A[e]=i??!0),t)}});return t};lK.string=Wme,lK.getFootprintNames=Zme;var Mj=lK;function Ie(t,A){return Array.isArray(A)?[t.a*A[0]+t.c*A[1]+t.e,t.b*A[0]+t.d*A[1]+t.f]:{x:t.a*A.x+t.c*A.y+t.e,y:t.b*A.x+t.d*A.y+t.f}}function Vme(t,A){return A.map(e=>Ie(t,e))}function _SA(t){return{a:parseFloat(t.a),b:parseFloat(t.b),c:parseFloat(t.c),d:parseFloat(t.d),e:parseFloat(t.e),f:parseFloat(t.f)}}const jme=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function CK(t){const A=t.match(jme);if(A===null||A.length<7)throw new Error(`'${t}' is not a matrix`);return{a:parseFloat(A[1]),b:parseFloat(A[2]),c:parseFloat(A[3]),d:parseFloat(A[4]),e:parseFloat(A[5]),f:parseFloat(A[6])}}function ug(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function ty(t){const{a:A,b:e,c:i,d:o,e:n,f:s}=t,r=A*o-e*i;return{a:o/r,b:e/-r,c:i/-r,d:A/r,e:(o*n-i*s)/-r,f:(e*n-A*s)/r}}function f1(t){return typeof t>"u"}function D_(t){return typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t)}function zme(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Xme(t){return zme(t)&&"a"in t&&D_(t.a)&&"b"in t&&D_(t.b)&&"c"in t&&D_(t.c)&&"d"in t&&D_(t.d)&&"e"in t&&D_(t.e)&&"f"in t&&D_(t.f)}function Zi(t,A=0){return{a:1,c:0,e:t,b:0,d:1,f:A}}function S_(...t){t=Array.isArray(t[0])?t[0]:t;const A=(e,i)=>({a:e.a*i.a+e.c*i.b,c:e.a*i.c+e.c*i.d,e:e.a*i.e+e.c*i.f+e.e,b:e.b*i.a+e.d*i.b,d:e.b*i.c+e.d*i.d,f:e.b*i.e+e.d*i.f+e.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return A(t[0],t[1]);default:{const[e,i,...o]=t,n=A(e,i);return S_(n,...o)}}}function Ki(...t){return S_(...t)}const{cos:$me,sin:Awe,PI:ewe}=Math;function JI(t,A,e){const i=$me(t),o=Awe(t),n={a:i,c:-o,e:0,b:o,d:i,f:0};return f1(A)||f1(e)?n:S_([Zi(A,e),n,Zi(-A,-e)])}function y1(t,A=void 0,e=void 0){return JI(t*ewe/180,A,e)}function Da(t,A=void 0,e=void 0,i=void 0){f1(A)&&(A=t);const o={a:t,c:0,e:0,b:0,d:A,f:0};return f1(e)||f1(i)?o:S_([Zi(e,i),o,Zi(-e,-i)])}function RSA(t,A){return{a:1,c:t,e:0,b:A,d:1,f:0}}const{tan:NSA}=Math;function MSA(t,A){return{a:1,c:NSA(t),e:0,b:NSA(A),d:1,f:0}}function vj(t,A){return MSA(t*Math.PI/180,A*Math.PI/180)}function twe(t){return uu(t)}function vSA(t){return uu(t)}function uu(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function USA(t,A=1e10){return{a:Math.round(t.a*A)/A,b:Math.round(t.b*A)/A,c:Math.round(t.c*A)/A,d:Math.round(t.d*A)/A,e:Math.round(t.e*A)/A,f:Math.round(t.f*A)/A}}function LSA(t,A){const e=t[0].x!=null?t[0].x:t[0][0],i=t[0].y!=null?t[0].y:t[0][1],o=A[0].x!=null?A[0].x:A[0][0],n=A[0].y!=null?A[0].y:A[0][1],s=t[1].x!=null?t[1].x:t[1][0],r=t[1].y!=null?t[1].y:t[1][1],a=A[1].x!=null?A[1].x:A[1][0],g=A[1].y!=null?A[1].y:A[1][1],I=t[2].x!=null?t[2].x:t[2][0],c=t[2].y!=null?t[2].y:t[2][1],B=A[2].x!=null?A[2].x:A[2][0],l=A[2].y!=null?A[2].y:A[2][1],C={a:e-I,b:i-c,c:s-I,d:r-c,e:I,f:c},Q={a:o-B,b:n-l,c:a-B,d:g-l,e:B,f:l},E=ty(C),h=S_([Q,E]);return USA(h)}function iwe(t){return Array.isArray(t)?t.map(A):A(t);function A(e){switch(e.type){case"matrix":if("a"in e&&"b"in e&&"c"in e&&"d"in e&&"e"in e&&"f"in e)return _SA(e);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in e))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in e?Zi(e.tx,e.ty):Zi(e.tx);case"scale":if(!("sx"in e))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in e?Da(e.sx,e.sy):Da(e.sx);case"rotate":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in e&&"cy"in e?y1(e.angle,e.cx,e.cy):y1(e.angle);case"skewX":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return vj(e.angle,0);case"skewY":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return vj(0,e.angle);case"shear":if(!("shx"in e&&"shy"in e))throw new Error("MISSING_MANDATORY_PARAM");return RSA(e.shx,e.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function owe(t,A){function e(){this.constructor=t}e.prototype=A.prototype,t.prototype=new e}function b_(t,A,e,i){var o=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(o,b_.prototype),o.expected=A,o.found=e,o.location=i,o.name="SyntaxError",o}owe(b_,Error);function Uj(t,A,e){return e=e||" ",t.length>A?t:(A-=t.length,e+=e.repeat(A),t+e.slice(0,A))}b_.prototype.format=function(t){var A="Error: "+this.message;if(this.location){var e=null,i;for(i=0;i<t.length;i++)if(t[i].source===this.location.source){e=t[i].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,n=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(o):o,s=this.location.source+":"+n.line+":"+n.column;if(e){var r=this.location.end,a=Uj("",n.line.toString().length," "),g=e[o.line-1],I=o.line===r.line?r.column:g.length+1,c=I-o.column||1;A+=`
239
+ root.render(<App />);`),y.unstable_strictMode===!0&&(_=!0),y.identifierPrefix!==void 0&&(K=y.identifierPrefix),y.onUncaughtError!==void 0&&(X=y.onUncaughtError),y.onCaughtError!==void 0&&(sA=y.onCaughtError),y.onRecoverableError!==void 0&&(MA=y.onRecoverableError),y.unstable_transitionCallbacks!==void 0&&(ZA=y.unstable_transitionCallbacks)),y=de(p,1,!1,null,null,_,K,X,sA,MA,ZA,null),p[Eg]=y.current,H0(p),new ZE(y)},s1.hydrateRoot=function(p,y,_){if(!h(p))throw Error("Target container is not a DOM element.");qB(p),y===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var K=!1,X="",sA=Yy,MA=cg,ZA=aC,Ee=null,ye=null;return _!=null&&(_.unstable_strictMode===!0&&(K=!0),_.identifierPrefix!==void 0&&(X=_.identifierPrefix),_.onUncaughtError!==void 0&&(sA=_.onUncaughtError),_.onCaughtError!==void 0&&(MA=_.onCaughtError),_.onRecoverableError!==void 0&&(ZA=_.onRecoverableError),_.unstable_transitionCallbacks!==void 0&&(Ee=_.unstable_transitionCallbacks),_.formState!==void 0&&(ye=_.formState)),y=de(p,1,!0,y,_??null,K,X,sA,MA,ZA,Ee,ye),y.context=ke(null),_=y.current,K=Rc(_),K=lA(K),X=NB(K),X.callback=null,Wa(_,X,K),_=K,y.current.lanes=_,qA(y,_),RI(y),p[Eg]=y.current,H0(p),new iQ(y)},s1.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),s1}var wmA;function Sde(){if(wmA)return YJ.exports;wmA=1;var t={env:{}};function A(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(t.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A)}catch(e){console.error(e)}}}return t.env.NODE_ENV==="production"?(A(),YJ.exports=wde()):YJ.exports=Dde(),YJ.exports}var bde=Sde(),qJ={exports:{}},T9,DmA;function xde(){if(DmA)return T9;DmA=1;var t=1e3,A=t*60,e=A*60,i=e*24,o=i*7,n=i*365.25;T9=function(I,c){c=c||{};var B=typeof I;if(B==="string"&&I.length>0)return s(I);if(B==="number"&&isFinite(I))return c.long?a(I):r(I);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(I))};function s(I){if(I=String(I),!(I.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(I);if(c){var B=parseFloat(c[1]),l=(c[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return B*n;case"weeks":case"week":case"w":return B*o;case"days":case"day":case"d":return B*i;case"hours":case"hour":case"hrs":case"hr":case"h":return B*e;case"minutes":case"minute":case"mins":case"min":case"m":return B*A;case"seconds":case"second":case"secs":case"sec":case"s":return B*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return B;default:return}}}}function r(I){var c=Math.abs(I);return c>=i?Math.round(I/i)+"d":c>=e?Math.round(I/e)+"h":c>=A?Math.round(I/A)+"m":c>=t?Math.round(I/t)+"s":I+"ms"}function a(I){var c=Math.abs(I);return c>=i?g(I,c,i,"day"):c>=e?g(I,c,e,"hour"):c>=A?g(I,c,A,"minute"):c>=t?g(I,c,t,"second"):I+" ms"}function g(I,c,B,l){var C=c>=B*1.5;return Math.round(I/B)+" "+l+(C?"s":"")}return T9}var q9,SmA;function kde(){if(SmA)return q9;SmA=1;function t(A){i.debug=i,i.default=i,i.coerce=g,i.disable=r,i.enable=n,i.enabled=a,i.humanize=xde(),i.destroy=I,Object.keys(A).forEach(c=>{i[c]=A[c]}),i.names=[],i.skips=[],i.formatters={};function e(c){let B=0;for(let l=0;l<c.length;l++)B=(B<<5)-B+c.charCodeAt(l),B|=0;return i.colors[Math.abs(B)%i.colors.length]}i.selectColor=e;function i(c){let B,l=null,C,Q;function E(...h){if(!E.enabled)return;const u=E,d=Number(new Date),f=d-(B||d);u.diff=f,u.prev=B,u.curr=d,B=d,h[0]=i.coerce(h[0]),typeof h[0]!="string"&&h.unshift("%O");let D=0;h[0]=h[0].replace(/%([a-zA-Z%])/g,(x,b)=>{if(x==="%%")return"%";D++;const F=i.formatters[b];if(typeof F=="function"){const k=h[D];x=F.call(u,k),h.splice(D,1),D--}return x}),i.formatArgs.call(u,h),(u.log||i.log).apply(u,h)}return E.namespace=c,E.useColors=i.useColors(),E.color=i.selectColor(c),E.extend=o,E.destroy=i.destroy,Object.defineProperty(E,"enabled",{enumerable:!0,configurable:!1,get:()=>l!==null?l:(C!==i.namespaces&&(C=i.namespaces,Q=i.enabled(c)),Q),set:h=>{l=h}}),typeof i.init=="function"&&i.init(E),E}function o(c,B){const l=i(this.namespace+(typeof B>"u"?":":B)+c);return l.log=this.log,l}function n(c){i.save(c),i.namespaces=c,i.names=[],i.skips=[];const B=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const l of B)l[0]==="-"?i.skips.push(l.slice(1)):i.names.push(l)}function s(c,B){let l=0,C=0,Q=-1,E=0;for(;l<c.length;)if(C<B.length&&(B[C]===c[l]||B[C]==="*"))B[C]==="*"?(Q=C,E=l,C++):(l++,C++);else if(Q!==-1)C=Q+1,E++,l=E;else return!1;for(;C<B.length&&B[C]==="*";)C++;return C===B.length}function r(){const c=[...i.names,...i.skips.map(B=>"-"+B)].join(",");return i.enable(""),c}function a(c){for(const B of i.skips)if(s(c,B))return!1;for(const B of i.names)if(s(c,B))return!0;return!1}function g(c){return c instanceof Error?c.stack||c.message:c}function I(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return i.enable(i.load()),i}return q9=t,q9}var bmA;function Gde(){return bmA||(bmA=1,(function(t,A){var e={env:{},version:""};A.formatArgs=o,A.save=n,A.load=s,A.useColors=i,A.storage=r(),A.destroy=(()=>{let g=!1;return()=>{g||(g=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),A.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function i(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let g;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(g=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(g[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(g){if(g[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+g[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const I="color: "+this.color;g.splice(1,0,I,"color: inherit");let c=0,B=0;g[0].replace(/%[a-zA-Z%]/g,l=>{l!=="%%"&&(c++,l==="%c"&&(B=c))}),g.splice(B,0,I)}A.log=console.debug||console.log||(()=>{});function n(g){try{g?A.storage.setItem("debug",g):A.storage.removeItem("debug")}catch{}}function s(){let g;try{g=A.storage.getItem("debug")||A.storage.getItem("DEBUG")}catch{}return!g&&typeof e<"u"&&"env"in e&&(g=e.env.DEBUG),g}function r(){try{return localStorage}catch{}}t.exports=kde()(A);const{formatters:a}=t.exports;a.j=function(g){try{return JSON.stringify(g)}catch(I){return"[UnexpectedJSONParseError]: "+I.message}}})(qJ,qJ.exports)),qJ.exports}var Fde=Gde();const ca=Np(Fde);var z=qf();const eo=Np(z),r1=e1({__proto__:null,default:eo},[z]);var Ba;(function(t){t.assertEqual=o=>{};function A(o){}t.assertIs=A;function e(o){throw new Error}t.assertNever=e,t.arrayToEnum=o=>{const n={};for(const s of o)n[s]=s;return n},t.getValidEnumValues=o=>{const n=t.objectKeys(o).filter(r=>typeof o[o[r]]!="number"),s={};for(const r of n)s[r]=o[r];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(n){return o[n]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const n=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&n.push(s);return n},t.find=(o,n)=>{for(const s of o)if(n(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function i(o,n=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(n)}t.joinValues=i,t.jsonStringifyReplacer=(o,n)=>typeof n=="bigint"?n.toString():n})(Ba||(Ba={}));var xmA;(function(t){t.mergeShapes=(A,e)=>({...A,...e})})(xmA||(xmA={}));const Wi=Ba.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),gb=t=>{switch(typeof t){case"undefined":return Wi.undefined;case"string":return Wi.string;case"number":return Number.isNaN(t)?Wi.nan:Wi.number;case"boolean":return Wi.boolean;case"function":return Wi.function;case"bigint":return Wi.bigint;case"symbol":return Wi.symbol;case"object":return Array.isArray(t)?Wi.array:t===null?Wi.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Wi.promise:typeof Map<"u"&&t instanceof Map?Wi.map:typeof Set<"u"&&t instanceof Set?Wi.set:typeof Date<"u"&&t instanceof Date?Wi.date:Wi.object;default:return Wi.unknown}},Wt=Ba.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 Ay extends Error{get errors(){return this.issues}constructor(A){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=A}format(A){const e=A||function(n){return n.message},i={_errors:[]},o=n=>{for(const s of n.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)i._errors.push(e(s));else{let r=i,a=0;for(;a<s.path.length;){const g=s.path[a];a===s.path.length-1?(r[g]=r[g]||{_errors:[]},r[g]._errors.push(e(s))):r[g]=r[g]||{_errors:[]},r=r[g],a++}}};return o(this),i}static assert(A){if(!(A instanceof Ay))throw new Error(`Not a ZodError: ${A}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ba.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(A=e=>e.message){const e={},i=[];for(const o of this.issues)if(o.path.length>0){const n=o.path[0];e[n]=e[n]||[],e[n].push(A(o))}else i.push(A(o));return{formErrors:i,fieldErrors:e}}get formErrors(){return this.flatten()}}Ay.create=t=>new Ay(t);const a1=(t,A)=>{let e;switch(t.code){case Wt.invalid_type:t.received===Wi.undefined?e="Required":e=`Expected ${t.expected}, received ${t.received}`;break;case Wt.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(t.expected,Ba.jsonStringifyReplacer)}`;break;case Wt.unrecognized_keys:e=`Unrecognized key(s) in object: ${Ba.joinValues(t.keys,", ")}`;break;case Wt.invalid_union:e="Invalid input";break;case Wt.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${Ba.joinValues(t.options)}`;break;case Wt.invalid_enum_value:e=`Invalid enum value. Expected ${Ba.joinValues(t.options)}, received '${t.received}'`;break;case Wt.invalid_arguments:e="Invalid function arguments";break;case Wt.invalid_return_type:e="Invalid function return type";break;case Wt.invalid_date:e="Invalid date";break;case Wt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(e=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?e=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?e=`Invalid input: must end with "${t.validation.endsWith}"`:Ba.assertNever(t.validation):t.validation!=="regex"?e=`Invalid ${t.validation}`:e="Invalid";break;case Wt.too_small:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?e=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:e="Invalid input";break;case Wt.too_big:t.type==="array"?e=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?e=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?e=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?e=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?e=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:e="Invalid input";break;case Wt.custom:e="Invalid input";break;case Wt.invalid_intersection_types:e="Intersection results could not be merged";break;case Wt.not_multiple_of:e=`Number must be a multiple of ${t.multipleOf}`;break;case Wt.not_finite:e="Number must be finite";break;default:e=A.defaultError,Ba.assertNever(t)}return{message:e}};let _de=a1;function P9(){return _de}const O9=t=>{const{data:A,path:e,errorMaps:i,issueData:o}=t,n=[...e,...o.path||[]],s={...o,path:n};if(o.message!==void 0)return{...o,path:n,message:o.message};let r="";const a=i.filter(g=>!!g).slice().reverse();for(const g of a)r=g(s,{data:A,defaultError:r}).message;return{...o,path:n,message:r}};function bi(t,A){const e=P9(),i=O9({issueData:A,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,e,e===a1?void 0:a1].filter(o=>!!o)});t.common.issues.push(i)}class hd{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(A,e){const i=[];for(const o of e){if(o.status==="aborted")return hn;o.status==="dirty"&&A.dirty(),i.push(o.value)}return{status:A.value,value:i}}static async mergeObjectAsync(A,e){const i=[];for(const o of e){const n=await o.key,s=await o.value;i.push({key:n,value:s})}return hd.mergeObjectSync(A,i)}static mergeObjectSync(A,e){const i={};for(const o of e){const{key:n,value:s}=o;if(n.status==="aborted"||s.status==="aborted")return hn;n.status==="dirty"&&A.dirty(),s.status==="dirty"&&A.dirty(),n.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(i[n.value]=s.value)}return{status:A.value,value:i}}}const hn=Object.freeze({status:"aborted"}),g1=t=>({status:"dirty",value:t}),Mp=t=>({status:"valid",value:t}),kmA=t=>t.status==="aborted",GmA=t=>t.status==="dirty",h_=t=>t.status==="valid",PJ=t=>typeof Promise<"u"&&t instanceof Promise;var Do;(function(t){t.errToObj=A=>typeof A=="string"?{message:A}:A||{},t.toString=A=>typeof A=="string"?A:A?.message})(Do||(Do={}));class nw{constructor(A,e,i,o){this._cachedPath=[],this.parent=A,this.data=e,this._path=i,this._key=o}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 FmA=(t,A)=>{if(h_(A))return{success:!0,data:A.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const e=new Ay(t.common.issues);return this._error=e,this._error}}};function Ss(t){if(!t)return{};const{errorMap:A,invalid_type_error:e,required_error:i,description:o}=t;if(A&&(e||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return A?{errorMap:A,description:o}:{errorMap:(s,r)=>{const{message:a}=t;return s.code==="invalid_enum_value"?{message:a??r.defaultError}:typeof r.data>"u"?{message:a??i??r.defaultError}:s.code!=="invalid_type"?{message:r.defaultError}:{message:a??e??r.defaultError}},description:o}}class Br{get description(){return this._def.description}_getType(A){return gb(A.data)}_getOrReturnCtx(A,e){return e||{common:A.parent.common,data:A.data,parsedType:gb(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}_processInputParams(A){return{status:new hd,ctx:{common:A.parent.common,data:A.data,parsedType:gb(A.data),schemaErrorMap:this._def.errorMap,path:A.path,parent:A.parent}}}_parseSync(A){const e=this._parse(A);if(PJ(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(A){const e=this._parse(A);return Promise.resolve(e)}parse(A,e){const i=this.safeParse(A,e);if(i.success)return i.data;throw i.error}safeParse(A,e){const i={common:{issues:[],async:e?.async??!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)},o=this._parseSync({data:A,path:i.path,parent:i});return FmA(i,o)}"~validate"(A){const e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)};if(!this["~standard"].async)try{const i=this._parseSync({data:A,path:[],parent:e});return h_(i)?{value:i.value}:{issues:e.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:A,path:[],parent:e}).then(i=>h_(i)?{value:i.value}:{issues:e.common.issues})}async parseAsync(A,e){const i=await this.safeParseAsync(A,e);if(i.success)return i.data;throw i.error}async safeParseAsync(A,e){const i={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:A,parsedType:gb(A)},o=this._parse({data:A,path:i.path,parent:i}),n=await(PJ(o)?o:Promise.resolve(o));return FmA(i,n)}refine(A,e){const i=o=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(o):e;return this._refinement((o,n)=>{const s=A(o),r=()=>n.addIssue({code:Wt.custom,...i(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(a=>a?!0:(r(),!1)):s?!0:(r(),!1)})}refinement(A,e){return this._refinement((i,o)=>A(i)?!0:(o.addIssue(typeof e=="function"?e(i,o):e),!1))}_refinement(A){return new Yk({schema:this,typeName:_n.ZodEffects,effect:{type:"refinement",refinement:A}})}superRefine(A){return this._refinement(A)}constructor(A){this.spa=this.safeParseAsync,this._def=A,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:e=>this["~validate"](e)}}optional(){return GD.create(this,this._def)}nullable(){return Jk.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sw.create(this)}promise(){return C1.create(this,this._def)}or(A){return ZJ.create([this,A],this._def)}and(A){return VJ.create(this,A,this._def)}transform(A){return new Yk({...Ss(this._def),schema:this,typeName:_n.ZodEffects,effect:{type:"transform",transform:A}})}default(A){const e=typeof A=="function"?A:()=>A;return new XJ({...Ss(this._def),innerType:this,defaultValue:e,typeName:_n.ZodDefault})}brand(){return new HmA({typeName:_n.ZodBranded,type:this,...Ss(this._def)})}catch(A){const e=typeof A=="function"?A:()=>A;return new $J({...Ss(this._def),innerType:this,catchValue:e,typeName:_n.ZodCatch})}describe(A){const e=this.constructor;return new e({...this._def,description:A})}pipe(A){return Aj.create(this,A)}readonly(){return AK.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Rde=/^c[^\s-]{8,}$/i,Nde=/^[0-9a-z]+$/,Mde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vde=/^[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,Ude=/^[a-z0-9_-]{21}$/i,Lde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hde=/^[-+]?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)?)??$/,Yde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jde="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let W9;const Kde=/^(?:(?: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])$/,Tde=/^(?:(?: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])$/,qde=/^(([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]))$/,Pde=/^(([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])$/,Ode=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_mA="((\\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])))",Zde=new RegExp(`^${_mA}$`);function RmA(t){let A="[0-5]\\d";t.precision?A=`${A}\\.\\d{${t.precision}}`:t.precision==null&&(A=`${A}(\\.\\d+)?`);const e=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${A})${e}`}function Vde(t){return new RegExp(`^${RmA(t)}$`)}function jde(t){let A=`${_mA}T${RmA(t)}`;const e=[];return e.push(t.local?"Z?":"Z"),t.offset&&e.push("([+-]\\d{2}:?\\d{2})"),A=`${A}(${e.join("|")})`,new RegExp(`^${A}$`)}function zde(t,A){return!!((A==="v4"||!A)&&Kde.test(t)||(A==="v6"||!A)&&qde.test(t))}function Xde(t,A){if(!Lde.test(t))return!1;try{const[e]=t.split(".");if(!e)return!1;const i=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),o=JSON.parse(atob(i));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||A&&o.alg!==A)}catch{return!1}}function $de(t,A){return!!((A==="v4"||!A)&&Tde.test(t)||(A==="v6"||!A)&&Pde.test(t))}class bD extends Br{_parse(A){if(this._def.coerce&&(A.data=String(A.data)),this._getType(A)!==Wi.string){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.string,received:n.parsedType}),hn}const i=new hd;let o;for(const n of this._def.checks)if(n.kind==="min")A.data.length<n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="max")A.data.length>n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="length"){const s=A.data.length>n.value,r=A.data.length<n.value;(s||r)&&(o=this._getOrReturnCtx(A,o),s?bi(o,{code:Wt.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):r&&bi(o,{code:Wt.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),i.dirty())}else if(n.kind==="email")Yde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"email",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="emoji")W9||(W9=new RegExp(Jde,"u")),W9.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"emoji",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="uuid")vde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"uuid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="nanoid")Ude.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"nanoid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid")Rde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cuid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid2")Nde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cuid2",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="ulid")Mde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"ulid",code:Wt.invalid_string,message:n.message}),i.dirty());else if(n.kind==="url")try{new URL(A.data)}catch{o=this._getOrReturnCtx(A,o),bi(o,{validation:"url",code:Wt.invalid_string,message:n.message}),i.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"regex",code:Wt.invalid_string,message:n.message}),i.dirty())):n.kind==="trim"?A.data=A.data.trim():n.kind==="includes"?A.data.includes(n.value,n.position)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),i.dirty()):n.kind==="toLowerCase"?A.data=A.data.toLowerCase():n.kind==="toUpperCase"?A.data=A.data.toUpperCase():n.kind==="startsWith"?A.data.startsWith(n.value)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{startsWith:n.value},message:n.message}),i.dirty()):n.kind==="endsWith"?A.data.endsWith(n.value)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:{endsWith:n.value},message:n.message}),i.dirty()):n.kind==="datetime"?jde(n).test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"datetime",message:n.message}),i.dirty()):n.kind==="date"?Zde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"date",message:n.message}),i.dirty()):n.kind==="time"?Vde(n).test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.invalid_string,validation:"time",message:n.message}),i.dirty()):n.kind==="duration"?Hde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"duration",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="ip"?zde(A.data,n.version)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"ip",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="jwt"?Xde(A.data,n.alg)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"jwt",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="cidr"?$de(A.data,n.version)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"cidr",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="base64"?Ode.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"base64",code:Wt.invalid_string,message:n.message}),i.dirty()):n.kind==="base64url"?Wde.test(A.data)||(o=this._getOrReturnCtx(A,o),bi(o,{validation:"base64url",code:Wt.invalid_string,message:n.message}),i.dirty()):Ba.assertNever(n);return{status:i.value,value:A.data}}_regex(A,e,i){return this.refinement(o=>A.test(o),{validation:e,code:Wt.invalid_string,...Do.errToObj(i)})}_addCheck(A){return new bD({...this._def,checks:[...this._def.checks,A]})}email(A){return this._addCheck({kind:"email",...Do.errToObj(A)})}url(A){return this._addCheck({kind:"url",...Do.errToObj(A)})}emoji(A){return this._addCheck({kind:"emoji",...Do.errToObj(A)})}uuid(A){return this._addCheck({kind:"uuid",...Do.errToObj(A)})}nanoid(A){return this._addCheck({kind:"nanoid",...Do.errToObj(A)})}cuid(A){return this._addCheck({kind:"cuid",...Do.errToObj(A)})}cuid2(A){return this._addCheck({kind:"cuid2",...Do.errToObj(A)})}ulid(A){return this._addCheck({kind:"ulid",...Do.errToObj(A)})}base64(A){return this._addCheck({kind:"base64",...Do.errToObj(A)})}base64url(A){return this._addCheck({kind:"base64url",...Do.errToObj(A)})}jwt(A){return this._addCheck({kind:"jwt",...Do.errToObj(A)})}ip(A){return this._addCheck({kind:"ip",...Do.errToObj(A)})}cidr(A){return this._addCheck({kind:"cidr",...Do.errToObj(A)})}datetime(A){return typeof A=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:A}):this._addCheck({kind:"datetime",precision:typeof A?.precision>"u"?null:A?.precision,offset:A?.offset??!1,local:A?.local??!1,...Do.errToObj(A?.message)})}date(A){return this._addCheck({kind:"date",message:A})}time(A){return typeof A=="string"?this._addCheck({kind:"time",precision:null,message:A}):this._addCheck({kind:"time",precision:typeof A?.precision>"u"?null:A?.precision,...Do.errToObj(A?.message)})}duration(A){return this._addCheck({kind:"duration",...Do.errToObj(A)})}regex(A,e){return this._addCheck({kind:"regex",regex:A,...Do.errToObj(e)})}includes(A,e){return this._addCheck({kind:"includes",value:A,position:e?.position,...Do.errToObj(e?.message)})}startsWith(A,e){return this._addCheck({kind:"startsWith",value:A,...Do.errToObj(e)})}endsWith(A,e){return this._addCheck({kind:"endsWith",value:A,...Do.errToObj(e)})}min(A,e){return this._addCheck({kind:"min",value:A,...Do.errToObj(e)})}max(A,e){return this._addCheck({kind:"max",value:A,...Do.errToObj(e)})}length(A,e){return this._addCheck({kind:"length",value:A,...Do.errToObj(e)})}nonempty(A){return this.min(1,Do.errToObj(A))}trim(){return new bD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bD({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(A=>A.kind==="datetime")}get isDate(){return!!this._def.checks.find(A=>A.kind==="date")}get isTime(){return!!this._def.checks.find(A=>A.kind==="time")}get isDuration(){return!!this._def.checks.find(A=>A.kind==="duration")}get isEmail(){return!!this._def.checks.find(A=>A.kind==="email")}get isURL(){return!!this._def.checks.find(A=>A.kind==="url")}get isEmoji(){return!!this._def.checks.find(A=>A.kind==="emoji")}get isUUID(){return!!this._def.checks.find(A=>A.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(A=>A.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(A=>A.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(A=>A.kind==="cuid2")}get isULID(){return!!this._def.checks.find(A=>A.kind==="ulid")}get isIP(){return!!this._def.checks.find(A=>A.kind==="ip")}get isCIDR(){return!!this._def.checks.find(A=>A.kind==="cidr")}get isBase64(){return!!this._def.checks.find(A=>A.kind==="base64")}get isBase64url(){return!!this._def.checks.find(A=>A.kind==="base64url")}get minLength(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxLength(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}}bD.create=t=>new bD({checks:[],typeName:_n.ZodString,coerce:t?.coerce??!1,...Ss(t)});function Ape(t,A){const e=(t.toString().split(".")[1]||"").length,i=(A.toString().split(".")[1]||"").length,o=e>i?e:i,n=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(A.toFixed(o).replace(".",""));return n%s/10**o}class u_ extends Br{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(A){if(this._def.coerce&&(A.data=Number(A.data)),this._getType(A)!==Wi.number){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.number,received:n.parsedType}),hn}let i;const o=new hd;for(const n of this._def.checks)n.kind==="int"?Ba.isInteger(A.data)||(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()):n.kind==="min"?(n.inclusive?A.data<n.value:A.data<=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()):n.kind==="max"?(n.inclusive?A.data>n.value:A.data>=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()):n.kind==="multipleOf"?Ape(A.data,n.value)!==0&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()):n.kind==="finite"?Number.isFinite(A.data)||(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_finite,message:n.message}),o.dirty()):Ba.assertNever(n);return{status:o.value,value:A.data}}gte(A,e){return this.setLimit("min",A,!0,Do.toString(e))}gt(A,e){return this.setLimit("min",A,!1,Do.toString(e))}lte(A,e){return this.setLimit("max",A,!0,Do.toString(e))}lt(A,e){return this.setLimit("max",A,!1,Do.toString(e))}setLimit(A,e,i,o){return new u_({...this._def,checks:[...this._def.checks,{kind:A,value:e,inclusive:i,message:Do.toString(o)}]})}_addCheck(A){return new u_({...this._def,checks:[...this._def.checks,A]})}int(A){return this._addCheck({kind:"int",message:Do.toString(A)})}positive(A){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Do.toString(A)})}negative(A){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Do.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Do.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Do.toString(A)})}multipleOf(A,e){return this._addCheck({kind:"multipleOf",value:A,message:Do.toString(e)})}finite(A){return this._addCheck({kind:"finite",message:Do.toString(A)})}safe(A){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Do.toString(A)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Do.toString(A)})}get minValue(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxValue(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}get isInt(){return!!this._def.checks.find(A=>A.kind==="int"||A.kind==="multipleOf"&&Ba.isInteger(A.value))}get isFinite(){let A=null,e=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(e===null||i.value>e)&&(e=i.value):i.kind==="max"&&(A===null||i.value<A)&&(A=i.value)}return Number.isFinite(e)&&Number.isFinite(A)}}u_.create=t=>new u_({checks:[],typeName:_n.ZodNumber,coerce:t?.coerce||!1,...Ss(t)});class I1 extends Br{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(A){if(this._def.coerce)try{A.data=BigInt(A.data)}catch{return this._getInvalidInput(A)}if(this._getType(A)!==Wi.bigint)return this._getInvalidInput(A);let i;const o=new hd;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?A.data<n.value:A.data<=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()):n.kind==="max"?(n.inclusive?A.data>n.value:A.data>=n.value)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()):n.kind==="multipleOf"?A.data%n.value!==BigInt(0)&&(i=this._getOrReturnCtx(A,i),bi(i,{code:Wt.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()):Ba.assertNever(n);return{status:o.value,value:A.data}}_getInvalidInput(A){const e=this._getOrReturnCtx(A);return bi(e,{code:Wt.invalid_type,expected:Wi.bigint,received:e.parsedType}),hn}gte(A,e){return this.setLimit("min",A,!0,Do.toString(e))}gt(A,e){return this.setLimit("min",A,!1,Do.toString(e))}lte(A,e){return this.setLimit("max",A,!0,Do.toString(e))}lt(A,e){return this.setLimit("max",A,!1,Do.toString(e))}setLimit(A,e,i,o){return new I1({...this._def,checks:[...this._def.checks,{kind:A,value:e,inclusive:i,message:Do.toString(o)}]})}_addCheck(A){return new I1({...this._def,checks:[...this._def.checks,A]})}positive(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Do.toString(A)})}negative(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Do.toString(A)})}nonpositive(A){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Do.toString(A)})}nonnegative(A){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Do.toString(A)})}multipleOf(A,e){return this._addCheck({kind:"multipleOf",value:A,message:Do.toString(e)})}get minValue(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A}get maxValue(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A}}I1.create=t=>new I1({checks:[],typeName:_n.ZodBigInt,coerce:t?.coerce??!1,...Ss(t)});class Z9 extends Br{_parse(A){if(this._def.coerce&&(A.data=!!A.data),this._getType(A)!==Wi.boolean){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.boolean,received:i.parsedType}),hn}return Mp(A.data)}}Z9.create=t=>new Z9({typeName:_n.ZodBoolean,coerce:t?.coerce||!1,...Ss(t)});class OJ extends Br{_parse(A){if(this._def.coerce&&(A.data=new Date(A.data)),this._getType(A)!==Wi.date){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_type,expected:Wi.date,received:n.parsedType}),hn}if(Number.isNaN(A.data.getTime())){const n=this._getOrReturnCtx(A);return bi(n,{code:Wt.invalid_date}),hn}const i=new hd;let o;for(const n of this._def.checks)n.kind==="min"?A.data.getTime()<n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),i.dirty()):n.kind==="max"?A.data.getTime()>n.value&&(o=this._getOrReturnCtx(A,o),bi(o,{code:Wt.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),i.dirty()):Ba.assertNever(n);return{status:i.value,value:new Date(A.data.getTime())}}_addCheck(A){return new OJ({...this._def,checks:[...this._def.checks,A]})}min(A,e){return this._addCheck({kind:"min",value:A.getTime(),message:Do.toString(e)})}max(A,e){return this._addCheck({kind:"max",value:A.getTime(),message:Do.toString(e)})}get minDate(){let A=null;for(const e of this._def.checks)e.kind==="min"&&(A===null||e.value>A)&&(A=e.value);return A!=null?new Date(A):null}get maxDate(){let A=null;for(const e of this._def.checks)e.kind==="max"&&(A===null||e.value<A)&&(A=e.value);return A!=null?new Date(A):null}}OJ.create=t=>new OJ({checks:[],coerce:t?.coerce||!1,typeName:_n.ZodDate,...Ss(t)});class NmA extends Br{_parse(A){if(this._getType(A)!==Wi.symbol){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.symbol,received:i.parsedType}),hn}return Mp(A.data)}}NmA.create=t=>new NmA({typeName:_n.ZodSymbol,...Ss(t)});class V9 extends Br{_parse(A){if(this._getType(A)!==Wi.undefined){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.undefined,received:i.parsedType}),hn}return Mp(A.data)}}V9.create=t=>new V9({typeName:_n.ZodUndefined,...Ss(t)});class WJ extends Br{_parse(A){if(this._getType(A)!==Wi.null){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.null,received:i.parsedType}),hn}return Mp(A.data)}}WJ.create=t=>new WJ({typeName:_n.ZodNull,...Ss(t)});class c1 extends Br{constructor(){super(...arguments),this._any=!0}_parse(A){return Mp(A.data)}}c1.create=t=>new c1({typeName:_n.ZodAny,...Ss(t)});class d_ extends Br{constructor(){super(...arguments),this._unknown=!0}_parse(A){return Mp(A.data)}}d_.create=t=>new d_({typeName:_n.ZodUnknown,...Ss(t)});class Ib extends Br{_parse(A){const e=this._getOrReturnCtx(A);return bi(e,{code:Wt.invalid_type,expected:Wi.never,received:e.parsedType}),hn}}Ib.create=t=>new Ib({typeName:_n.ZodNever,...Ss(t)});class MmA extends Br{_parse(A){if(this._getType(A)!==Wi.undefined){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.void,received:i.parsedType}),hn}return Mp(A.data)}}MmA.create=t=>new MmA({typeName:_n.ZodVoid,...Ss(t)});class sw extends Br{_parse(A){const{ctx:e,status:i}=this._processInputParams(A),o=this._def;if(e.parsedType!==Wi.array)return bi(e,{code:Wt.invalid_type,expected:Wi.array,received:e.parsedType}),hn;if(o.exactLength!==null){const s=e.data.length>o.exactLength.value,r=e.data.length<o.exactLength.value;(s||r)&&(bi(e,{code:s?Wt.too_big:Wt.too_small,minimum:r?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),i.dirty())}if(o.minLength!==null&&e.data.length<o.minLength.value&&(bi(e,{code:Wt.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),i.dirty()),o.maxLength!==null&&e.data.length>o.maxLength.value&&(bi(e,{code:Wt.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),i.dirty()),e.common.async)return Promise.all([...e.data].map((s,r)=>o.type._parseAsync(new nw(e,s,e.path,r)))).then(s=>hd.mergeArray(i,s));const n=[...e.data].map((s,r)=>o.type._parseSync(new nw(e,s,e.path,r)));return hd.mergeArray(i,n)}get element(){return this._def.type}min(A,e){return new sw({...this._def,minLength:{value:A,message:Do.toString(e)}})}max(A,e){return new sw({...this._def,maxLength:{value:A,message:Do.toString(e)}})}length(A,e){return new sw({...this._def,exactLength:{value:A,message:Do.toString(e)}})}nonempty(A){return this.min(1,A)}}sw.create=(t,A)=>new sw({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_n.ZodArray,...Ss(A)});function p_(t){if(t instanceof DC){const A={};for(const e in t.shape){const i=t.shape[e];A[e]=GD.create(p_(i))}return new DC({...t._def,shape:()=>A})}else return t instanceof sw?new sw({...t._def,type:p_(t.element)}):t instanceof GD?GD.create(p_(t.unwrap())):t instanceof Jk?Jk.create(p_(t.unwrap())):t instanceof kD?kD.create(t.items.map(A=>p_(A))):t}class DC extends Br{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const A=this._def.shape(),e=Ba.objectKeys(A);return this._cached={shape:A,keys:e},this._cached}_parse(A){if(this._getType(A)!==Wi.object){const g=this._getOrReturnCtx(A);return bi(g,{code:Wt.invalid_type,expected:Wi.object,received:g.parsedType}),hn}const{status:i,ctx:o}=this._processInputParams(A),{shape:n,keys:s}=this._getCached(),r=[];if(!(this._def.catchall instanceof Ib&&this._def.unknownKeys==="strip"))for(const g in o.data)s.includes(g)||r.push(g);const a=[];for(const g of s){const I=n[g],c=o.data[g];a.push({key:{status:"valid",value:g},value:I._parse(new nw(o,c,o.path,g)),alwaysSet:g in o.data})}if(this._def.catchall instanceof Ib){const g=this._def.unknownKeys;if(g==="passthrough")for(const I of r)a.push({key:{status:"valid",value:I},value:{status:"valid",value:o.data[I]}});else if(g==="strict")r.length>0&&(bi(o,{code:Wt.unrecognized_keys,keys:r}),i.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const I of r){const c=o.data[I];a.push({key:{status:"valid",value:I},value:g._parse(new nw(o,c,o.path,I)),alwaysSet:I in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const g=[];for(const I of a){const c=await I.key,B=await I.value;g.push({key:c,value:B,alwaysSet:I.alwaysSet})}return g}).then(g=>hd.mergeObjectSync(i,g)):hd.mergeObjectSync(i,a)}get shape(){return this._def.shape()}strict(A){return Do.errToObj,new DC({...this._def,unknownKeys:"strict",...A!==void 0?{errorMap:(e,i)=>{const o=this._def.errorMap?.(e,i).message??i.defaultError;return e.code==="unrecognized_keys"?{message:Do.errToObj(A).message??o}:{message:o}}}:{}})}strip(){return new DC({...this._def,unknownKeys:"strip"})}passthrough(){return new DC({...this._def,unknownKeys:"passthrough"})}extend(A){return new DC({...this._def,shape:()=>({...this._def.shape(),...A})})}merge(A){return new DC({unknownKeys:A._def.unknownKeys,catchall:A._def.catchall,shape:()=>({...this._def.shape(),...A._def.shape()}),typeName:_n.ZodObject})}setKey(A,e){return this.augment({[A]:e})}catchall(A){return new DC({...this._def,catchall:A})}pick(A){const e={};for(const i of Ba.objectKeys(A))A[i]&&this.shape[i]&&(e[i]=this.shape[i]);return new DC({...this._def,shape:()=>e})}omit(A){const e={};for(const i of Ba.objectKeys(this.shape))A[i]||(e[i]=this.shape[i]);return new DC({...this._def,shape:()=>e})}deepPartial(){return p_(this)}partial(A){const e={};for(const i of Ba.objectKeys(this.shape)){const o=this.shape[i];A&&!A[i]?e[i]=o:e[i]=o.optional()}return new DC({...this._def,shape:()=>e})}required(A){const e={};for(const i of Ba.objectKeys(this.shape))if(A&&!A[i])e[i]=this.shape[i];else{let n=this.shape[i];for(;n instanceof GD;)n=n._def.innerType;e[i]=n}return new DC({...this._def,shape:()=>e})}keyof(){return UmA(Ba.objectKeys(this.shape))}}DC.create=(t,A)=>new DC({shape:()=>t,unknownKeys:"strip",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)}),DC.strictCreate=(t,A)=>new DC({shape:()=>t,unknownKeys:"strict",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)}),DC.lazycreate=(t,A)=>new DC({shape:t,unknownKeys:"strip",catchall:Ib.create(),typeName:_n.ZodObject,...Ss(A)});class ZJ extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i=this._def.options;function o(n){for(const r of n)if(r.result.status==="valid")return r.result;for(const r of n)if(r.result.status==="dirty")return e.common.issues.push(...r.ctx.common.issues),r.result;const s=n.map(r=>new Ay(r.ctx.common.issues));return bi(e,{code:Wt.invalid_union,unionErrors:s}),hn}if(e.common.async)return Promise.all(i.map(async n=>{const s={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:s}),ctx:s}})).then(o);{let n;const s=[];for(const a of i){const g={...e,common:{...e.common,issues:[]},parent:null},I=a._parseSync({data:e.data,path:e.path,parent:g});if(I.status==="valid")return I;I.status==="dirty"&&!n&&(n={result:I,ctx:g}),g.common.issues.length&&s.push(g.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;const r=s.map(a=>new Ay(a));return bi(e,{code:Wt.invalid_union,unionErrors:r}),hn}}get options(){return this._def.options}}ZJ.create=(t,A)=>new ZJ({options:t,typeName:_n.ZodUnion,...Ss(A)});const xD=t=>t instanceof X9?xD(t.schema):t instanceof Yk?xD(t.innerType()):t instanceof zJ?[t.value]:t instanceof Hk?t.options:t instanceof $9?Ba.objectValues(t.enum):t instanceof XJ?xD(t._def.innerType):t instanceof V9?[void 0]:t instanceof WJ?[null]:t instanceof GD?[void 0,...xD(t.unwrap())]:t instanceof Jk?[null,...xD(t.unwrap())]:t instanceof HmA||t instanceof AK?xD(t.unwrap()):t instanceof $J?xD(t._def.innerType):[];class j9 extends Br{_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.object)return bi(e,{code:Wt.invalid_type,expected:Wi.object,received:e.parsedType}),hn;const i=this.discriminator,o=e.data[i],n=this.optionsMap.get(o);return n?e.common.async?n._parseAsync({data:e.data,path:e.path,parent:e}):n._parseSync({data:e.data,path:e.path,parent:e}):(bi(e,{code:Wt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),hn)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(A,e,i){const o=new Map;for(const n of e){const s=xD(n.shape[A]);if(!s.length)throw new Error(`A discriminator value for key \`${A}\` could not be extracted from all schema options`);for(const r of s){if(o.has(r))throw new Error(`Discriminator property ${String(A)} has duplicate value ${String(r)}`);o.set(r,n)}}return new j9({typeName:_n.ZodDiscriminatedUnion,discriminator:A,options:e,optionsMap:o,...Ss(i)})}}function z9(t,A){const e=gb(t),i=gb(A);if(t===A)return{valid:!0,data:t};if(e===Wi.object&&i===Wi.object){const o=Ba.objectKeys(A),n=Ba.objectKeys(t).filter(r=>o.indexOf(r)!==-1),s={...t,...A};for(const r of n){const a=z9(t[r],A[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}else if(e===Wi.array&&i===Wi.array){if(t.length!==A.length)return{valid:!1};const o=[];for(let n=0;n<t.length;n++){const s=t[n],r=A[n],a=z9(s,r);if(!a.valid)return{valid:!1};o.push(a.data)}return{valid:!0,data:o}}else return e===Wi.date&&i===Wi.date&&+t==+A?{valid:!0,data:t}:{valid:!1}}class VJ extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A),o=(n,s)=>{if(kmA(n)||kmA(s))return hn;const r=z9(n.value,s.value);return r.valid?((GmA(n)||GmA(s))&&e.dirty(),{status:e.value,value:r.data}):(bi(i,{code:Wt.invalid_intersection_types}),hn)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([n,s])=>o(n,s)):o(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}VJ.create=(t,A,e)=>new VJ({left:t,right:A,typeName:_n.ZodIntersection,...Ss(e)});class kD extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.array)return bi(i,{code:Wt.invalid_type,expected:Wi.array,received:i.parsedType}),hn;if(i.data.length<this._def.items.length)return bi(i,{code:Wt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),hn;!this._def.rest&&i.data.length>this._def.items.length&&(bi(i,{code:Wt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());const n=[...i.data].map((s,r)=>{const a=this._def.items[r]||this._def.rest;return a?a._parse(new nw(i,s,i.path,r)):null}).filter(s=>!!s);return i.common.async?Promise.all(n).then(s=>hd.mergeArray(e,s)):hd.mergeArray(e,n)}get items(){return this._def.items}rest(A){return new kD({...this._def,rest:A})}}kD.create=(t,A)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new kD({items:t,typeName:_n.ZodTuple,rest:null,...Ss(A)})};class jJ extends Br{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.object)return bi(i,{code:Wt.invalid_type,expected:Wi.object,received:i.parsedType}),hn;const o=[],n=this._def.keyType,s=this._def.valueType;for(const r in i.data)o.push({key:n._parse(new nw(i,r,i.path,r)),value:s._parse(new nw(i,i.data[r],i.path,r)),alwaysSet:r in i.data});return i.common.async?hd.mergeObjectAsync(e,o):hd.mergeObjectSync(e,o)}get element(){return this._def.valueType}static create(A,e,i){return e instanceof Br?new jJ({keyType:A,valueType:e,typeName:_n.ZodRecord,...Ss(i)}):new jJ({keyType:bD.create(),valueType:A,typeName:_n.ZodRecord,...Ss(e)})}}class vmA extends Br{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.map)return bi(i,{code:Wt.invalid_type,expected:Wi.map,received:i.parsedType}),hn;const o=this._def.keyType,n=this._def.valueType,s=[...i.data.entries()].map(([r,a],g)=>({key:o._parse(new nw(i,r,i.path,[g,"key"])),value:n._parse(new nw(i,a,i.path,[g,"value"]))}));if(i.common.async){const r=new Map;return Promise.resolve().then(async()=>{for(const a of s){const g=await a.key,I=await a.value;if(g.status==="aborted"||I.status==="aborted")return hn;(g.status==="dirty"||I.status==="dirty")&&e.dirty(),r.set(g.value,I.value)}return{status:e.value,value:r}})}else{const r=new Map;for(const a of s){const g=a.key,I=a.value;if(g.status==="aborted"||I.status==="aborted")return hn;(g.status==="dirty"||I.status==="dirty")&&e.dirty(),r.set(g.value,I.value)}return{status:e.value,value:r}}}}vmA.create=(t,A,e)=>new vmA({valueType:A,keyType:t,typeName:_n.ZodMap,...Ss(e)});class B1 extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.parsedType!==Wi.set)return bi(i,{code:Wt.invalid_type,expected:Wi.set,received:i.parsedType}),hn;const o=this._def;o.minSize!==null&&i.data.size<o.minSize.value&&(bi(i,{code:Wt.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),e.dirty()),o.maxSize!==null&&i.data.size>o.maxSize.value&&(bi(i,{code:Wt.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),e.dirty());const n=this._def.valueType;function s(a){const g=new Set;for(const I of a){if(I.status==="aborted")return hn;I.status==="dirty"&&e.dirty(),g.add(I.value)}return{status:e.value,value:g}}const r=[...i.data.values()].map((a,g)=>n._parse(new nw(i,a,i.path,g)));return i.common.async?Promise.all(r).then(a=>s(a)):s(r)}min(A,e){return new B1({...this._def,minSize:{value:A,message:Do.toString(e)}})}max(A,e){return new B1({...this._def,maxSize:{value:A,message:Do.toString(e)}})}size(A,e){return this.min(A,e).max(A,e)}nonempty(A){return this.min(1,A)}}B1.create=(t,A)=>new B1({valueType:t,minSize:null,maxSize:null,typeName:_n.ZodSet,...Ss(A)});class l1 extends Br{constructor(){super(...arguments),this.validate=this.implement}_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.function)return bi(e,{code:Wt.invalid_type,expected:Wi.function,received:e.parsedType}),hn;function i(r,a){return O9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,P9(),a1].filter(g=>!!g),issueData:{code:Wt.invalid_arguments,argumentsError:a}})}function o(r,a){return O9({data:r,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,P9(),a1].filter(g=>!!g),issueData:{code:Wt.invalid_return_type,returnTypeError:a}})}const n={errorMap:e.common.contextualErrorMap},s=e.data;if(this._def.returns instanceof C1){const r=this;return Mp(async function(...a){const g=new Ay([]),I=await r._def.args.parseAsync(a,n).catch(l=>{throw g.addIssue(i(a,l)),g}),c=await Reflect.apply(s,this,I);return await r._def.returns._def.type.parseAsync(c,n).catch(l=>{throw g.addIssue(o(c,l)),g})})}else{const r=this;return Mp(function(...a){const g=r._def.args.safeParse(a,n);if(!g.success)throw new Ay([i(a,g.error)]);const I=Reflect.apply(s,this,g.data),c=r._def.returns.safeParse(I,n);if(!c.success)throw new Ay([o(I,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...A){return new l1({...this._def,args:kD.create(A).rest(d_.create())})}returns(A){return new l1({...this._def,returns:A})}implement(A){return this.parse(A)}strictImplement(A){return this.parse(A)}static create(A,e,i){return new l1({args:A||kD.create([]).rest(d_.create()),returns:e||d_.create(),typeName:_n.ZodFunction,...Ss(i)})}}class X9 extends Br{get schema(){return this._def.getter()}_parse(A){const{ctx:e}=this._processInputParams(A);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}X9.create=(t,A)=>new X9({getter:t,typeName:_n.ZodLazy,...Ss(A)});class zJ extends Br{_parse(A){if(A.data!==this._def.value){const e=this._getOrReturnCtx(A);return bi(e,{received:e.data,code:Wt.invalid_literal,expected:this._def.value}),hn}return{status:"valid",value:A.data}}get value(){return this._def.value}}zJ.create=(t,A)=>new zJ({value:t,typeName:_n.ZodLiteral,...Ss(A)});function UmA(t,A){return new Hk({values:t,typeName:_n.ZodEnum,...Ss(A)})}class Hk extends Br{_parse(A){if(typeof A.data!="string"){const e=this._getOrReturnCtx(A),i=this._def.values;return bi(e,{expected:Ba.joinValues(i),received:e.parsedType,code:Wt.invalid_type}),hn}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(A.data)){const e=this._getOrReturnCtx(A),i=this._def.values;return bi(e,{received:e.data,code:Wt.invalid_enum_value,options:i}),hn}return Mp(A.data)}get options(){return this._def.values}get enum(){const A={};for(const e of this._def.values)A[e]=e;return A}get Values(){const A={};for(const e of this._def.values)A[e]=e;return A}get Enum(){const A={};for(const e of this._def.values)A[e]=e;return A}extract(A,e=this._def){return Hk.create(A,{...this._def,...e})}exclude(A,e=this._def){return Hk.create(this.options.filter(i=>!A.includes(i)),{...this._def,...e})}}Hk.create=UmA;class $9 extends Br{_parse(A){const e=Ba.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(A);if(i.parsedType!==Wi.string&&i.parsedType!==Wi.number){const o=Ba.objectValues(e);return bi(i,{expected:Ba.joinValues(o),received:i.parsedType,code:Wt.invalid_type}),hn}if(this._cache||(this._cache=new Set(Ba.getValidEnumValues(this._def.values))),!this._cache.has(A.data)){const o=Ba.objectValues(e);return bi(i,{received:i.data,code:Wt.invalid_enum_value,options:o}),hn}return Mp(A.data)}get enum(){return this._def.values}}$9.create=(t,A)=>new $9({values:t,typeName:_n.ZodNativeEnum,...Ss(A)});class C1 extends Br{unwrap(){return this._def.type}_parse(A){const{ctx:e}=this._processInputParams(A);if(e.parsedType!==Wi.promise&&e.common.async===!1)return bi(e,{code:Wt.invalid_type,expected:Wi.promise,received:e.parsedType}),hn;const i=e.parsedType===Wi.promise?e.data:Promise.resolve(e.data);return Mp(i.then(o=>this._def.type.parseAsync(o,{path:e.path,errorMap:e.common.contextualErrorMap})))}}C1.create=(t,A)=>new C1({type:t,typeName:_n.ZodPromise,...Ss(A)});class Yk extends Br{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_n.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(A){const{status:e,ctx:i}=this._processInputParams(A),o=this._def.effect||null,n={addIssue:s=>{bi(i,s),s.fatal?e.abort():e.dirty()},get path(){return i.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){const s=o.transform(i.data,n);if(i.common.async)return Promise.resolve(s).then(async r=>{if(e.value==="aborted")return hn;const a=await this._def.schema._parseAsync({data:r,path:i.path,parent:i});return a.status==="aborted"?hn:a.status==="dirty"||e.value==="dirty"?g1(a.value):a});{if(e.value==="aborted")return hn;const r=this._def.schema._parseSync({data:s,path:i.path,parent:i});return r.status==="aborted"?hn:r.status==="dirty"||e.value==="dirty"?g1(r.value):r}}if(o.type==="refinement"){const s=r=>{const a=o.refinement(r,n);if(i.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(i.common.async===!1){const r=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?hn:(r.status==="dirty"&&e.dirty(),s(r.value),{status:e.value,value:r.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(r=>r.status==="aborted"?hn:(r.status==="dirty"&&e.dirty(),s(r.value).then(()=>({status:e.value,value:r.value}))))}if(o.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!h_(s))return hn;const r=o.transform(s.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:r}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>h_(s)?Promise.resolve(o.transform(s.value,n)).then(r=>({status:e.value,value:r})):hn);Ba.assertNever(o)}}Yk.create=(t,A,e)=>new Yk({schema:t,typeName:_n.ZodEffects,effect:A,...Ss(e)}),Yk.createWithPreprocess=(t,A,e)=>new Yk({schema:A,effect:{type:"preprocess",transform:t},typeName:_n.ZodEffects,...Ss(e)});class GD extends Br{_parse(A){return this._getType(A)===Wi.undefined?Mp(void 0):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}GD.create=(t,A)=>new GD({innerType:t,typeName:_n.ZodOptional,...Ss(A)});class Jk extends Br{_parse(A){return this._getType(A)===Wi.null?Mp(null):this._def.innerType._parse(A)}unwrap(){return this._def.innerType}}Jk.create=(t,A)=>new Jk({innerType:t,typeName:_n.ZodNullable,...Ss(A)});class XJ extends Br{_parse(A){const{ctx:e}=this._processInputParams(A);let i=e.data;return e.parsedType===Wi.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}XJ.create=(t,A)=>new XJ({innerType:t,typeName:_n.ZodDefault,defaultValue:typeof A.default=="function"?A.default:()=>A.default,...Ss(A)});class $J extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i={...e,common:{...e.common,issues:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return PJ(o)?o.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ay(i.common.issues)},input:i.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ay(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}$J.create=(t,A)=>new $J({innerType:t,typeName:_n.ZodCatch,catchValue:typeof A.catch=="function"?A.catch:()=>A.catch,...Ss(A)});class LmA extends Br{_parse(A){if(this._getType(A)!==Wi.nan){const i=this._getOrReturnCtx(A);return bi(i,{code:Wt.invalid_type,expected:Wi.nan,received:i.parsedType}),hn}return{status:"valid",value:A.data}}}LmA.create=t=>new LmA({typeName:_n.ZodNaN,...Ss(t)});class HmA extends Br{_parse(A){const{ctx:e}=this._processInputParams(A),i=e.data;return this._def.type._parse({data:i,path:e.path,parent:e})}unwrap(){return this._def.type}}class Aj extends Br{_parse(A){const{status:e,ctx:i}=this._processInputParams(A);if(i.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?hn:n.status==="dirty"?(e.dirty(),g1(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{const o=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?hn:o.status==="dirty"?(e.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:i.path,parent:i})}}static create(A,e){return new Aj({in:A,out:e,typeName:_n.ZodPipeline})}}class AK extends Br{_parse(A){const e=this._def.innerType._parse(A),i=o=>(h_(o)&&(o.value=Object.freeze(o.value)),o);return PJ(e)?e.then(o=>i(o)):i(e)}unwrap(){return this._def.innerType}}AK.create=(t,A)=>new AK({innerType:t,typeName:_n.ZodReadonly,...Ss(A)});function YmA(t,A){const e=typeof t=="function"?t(A):typeof t=="string"?{message:t}:t;return typeof e=="string"?{message:e}:e}function sh(t,A={},e){return t?c1.create().superRefine((i,o)=>{const n=t(i);if(n instanceof Promise)return n.then(s=>{if(!s){const r=YmA(A,i),a=r.fatal??e??!0;o.addIssue({code:"custom",...r,fatal:a})}});if(!n){const s=YmA(A,i),r=s.fatal??e??!0;o.addIssue({code:"custom",...s,fatal:r})}}):c1.create()}var _n;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_n||(_n={}));const v=bD.create,vA=u_.create,te=Z9.create,JmA=WJ.create,Tg=c1.create,epe=d_.create;Ib.create;const fe=sw.create,xA=DC.create,Zt=ZJ.create,nE=j9.create;VJ.create,kD.create;const Aa=jJ.create,cb=l1.create,QA=zJ.create,Ze=Hk.create,Bb=C1.create;GD.create,Jk.create;var KmA={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},wa=t=>{let A=typeof t=="number"?"mm":t.replace(/^[^a-zA-Z]+/g,"").toLowerCase();A||(A="mm");const e=typeof t=="number"?t:Number.parseFloat(t.split(A)[0]);if(A in KmA)return e*KmA[A];throw new Error(`Unsupported unit: ${A}`)},Q1=wa,TmA={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{fs:1e-12,ps:1e-9,ns:1e-6,us:.001,µs:.001,ms:1,s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},ej=new Set;for(const[t,A]of Object.entries(TmA)){ej.add(t);for(const e of Object.keys(A.variants))ej.add(e)}function tpe(t){for(const[A,e]of Object.entries(TmA))if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};return{baseUnit:t,conversionFactor:1}}var qmA={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12};function Am(t){if(t==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t=="string"&&t.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t=="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t=="object"&&"x"in t&&"y"in t){const{parsedUnit:r,unitOfValue:a}=Am(t.x),g=Am(t.x),I=Am(t.y);return g.value===null||I.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:r,unitOfValue:a,value:{x:g.value,y:I.value}}}const e=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!e)throw new Error(`Could not determine unit: "${t}"`);const i=e.split("").reverse().join(""),o=t.slice(0,-i.length);if(i in qmA&&!ej.has(i)){const r=qmA[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(o)*r}}const{baseUnit:n,conversionFactor:s}=tpe(i);return{parsedUnit:i,unitOfValue:n,value:s*Number.parseFloat(o)}}var f_=v().or(vA()).transform(t=>Am(t).value),y_=v().or(vA()).transform(t=>Am(t).value).transform(t=>Number.parseFloat(t.toPrecision(12))),tj=v().or(vA()).transform(t=>Am(t).value),ey=v().or(vA()).transform(t=>Am(t).value),VA=v().or(vA()).transform(t=>Am(t).value),FD=v().or(vA()).transform(t=>Am(t).value),ce=VA,ipe=v().or(vA()).transform(t=>Am(t).value),E1=v().or(vA()).transform(t=>Am(t).value),ope=E1,Pf=E1,PmA=v().datetime(),CI=v().or(vA()).transform(t=>typeof t=="number"?t:t.endsWith("deg")?Number.parseFloat(t.split("deg")[0]):t.endsWith("rad")?Number.parseFloat(t.split("rad")[0])*180/Math.PI:Number.parseFloat(t)),OmA=vA().or(v().endsWith("mAh")).transform(t=>{if(typeof t=="string"){const A=t.replace("mAh",""),e=Number.parseFloat(A);if(Number.isNaN(e))throw new Error("Invalid capacity");return e}return t}).describe("Battery capacity in mAh"),Bo=xA({x:ce,y:ce}),npe=Bo,m_=xA({x:ce,y:ce,z:ce}),spe=m_,ij=xA({width:vA(),height:vA()}),rpe=t=>{const A="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>A[Math.floor(Math.random()*A.length)]).join("")},Ai=t=>v().optional().default(()=>`${t}_${rpe(10)}`),Kk=Ze(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),eK=Ze(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),dB=xA({type:QA("source_component"),ftype:v().optional(),source_component_id:v(),name:v(),manufacturer_part_number:v().optional(),supplier_part_numbers:Aa(eK,fe(v())).optional(),display_value:v().optional(),are_pins_interchangeable:te().optional(),internally_connected_source_port_ids:fe(fe(v())).optional(),source_group_id:v().optional(),subcircuit_id:v().optional()}),oj=dB.extend({ftype:QA("simple_capacitor"),capacitance:y_,max_voltage_rating:ey.optional(),display_capacitance:v().optional(),max_decoupling_trace_length:ce.optional()}),nj=dB.extend({ftype:QA("simple_resistor"),resistance:f_,display_resistance:v().optional()}),tK=dB.extend({ftype:QA("simple_diode")}),WmA=dB.extend({ftype:QA("simple_fiducial")}),sj=tK.extend({ftype:QA("simple_led"),color:v().optional(),wavelength:v().optional()}),ZmA=dB.extend({ftype:QA("simple_ground")}),rj=dB.extend({ftype:QA("simple_chip")}),aj=dB.extend({ftype:QA("simple_power_source"),voltage:ey}),ape=dB.extend({ftype:QA("simple_fuse"),current_rating_amps:vA().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:vA().describe("Voltage rating in volts, e.g. ±5V would be 5")}),gj=dB.extend({ftype:QA("simple_battery"),capacity:OmA}),Ij=dB.extend({ftype:QA("simple_inductor"),inductance:tj,max_current_rating:vA().optional()}),cj=dB.extend({ftype:QA("simple_push_button")}),Bj=dB.extend({ftype:QA("simple_potentiometer"),max_resistance:f_}),VmA=dB.extend({ftype:QA("simple_crystal"),frequency:vA().describe("Frequency in Hz"),load_capacitance:vA().optional().describe("Load capacitance in pF")}),lj=dB.extend({ftype:QA("simple_pin_header"),pin_count:vA(),gender:Ze(["male","female"]).optional().default("male")}),Cj=dB.extend({ftype:QA("simple_pinout")}),Qj=dB.extend({ftype:QA("simple_resonator"),load_capacitance:y_,equivalent_series_resistance:f_.optional(),frequency:FD}),Ej=dB.extend({ftype:QA("simple_transistor"),transistor_type:Ze(["npn","pnp"])}),hj=dB.extend({ftype:QA("simple_test_point"),footprint_variant:Ze(["pad","through_hole"]).optional(),pad_shape:Ze(["rect","circle"]).optional(),pad_diameter:Zt([vA(),v()]).optional(),hole_diameter:Zt([vA(),v()]).optional(),width:Zt([vA(),v()]).optional(),height:Zt([vA(),v()]).optional()}),uj=dB.extend({ftype:QA("simple_mosfet"),channel_type:Ze(["n","p"]),mosfet_mode:Ze(["enhancement","depletion"])}),dj=dB.extend({ftype:QA("simple_switch")}),pj=xA({type:QA("source_project_metadata"),name:v().optional(),software_used_string:v().optional(),project_url:v().optional(),created_at:PmA.optional()}),jmA=xA({type:QA("source_missing_property_error"),source_missing_property_error_id:Ai("source_missing_property_error"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_missing_property_error").default("source_missing_property_error"),message:v()}).describe("The source code is missing a property"),zmA=xA({type:QA("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:Ai("source_failed_to_create_component_error"),error_type:QA("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:v().optional(),subcircuit_id:v().optional(),parent_source_component_id:v().optional(),message:v(),pcb_center:xA({x:vA().optional(),y:vA().optional()}).optional(),schematic_center:xA({x:vA().optional(),y:vA().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),fj=xA({type:QA("source_trace_not_connected_error"),source_trace_not_connected_error_id:Ai("source_trace_not_connected_error"),error_type:QA("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:v(),subcircuit_id:v().optional(),source_group_id:v().optional(),source_trace_id:v().optional(),connected_source_port_ids:fe(v()).optional(),selectors_not_found:fe(v()).optional()}).describe("Occurs when a source trace selector does not match any ports"),XmA=xA({type:QA("source_property_ignored_warning"),source_property_ignored_warning_id:Ai("source_property_ignored_warning"),source_component_id:v(),property_name:v(),subcircuit_id:v().optional(),error_type:QA("source_property_ignored_warning").default("source_property_ignored_warning"),message:v()}).describe("The source property was ignored"),yj=xA({type:QA("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:Ai("source_pin_missing_trace_warning"),warning_type:QA("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),$mA=dB.extend({ftype:QA("simple_voltage_probe")}),AwA=dB.extend({ftype:QA("interconnect")}),ewA=Zt([nj,oj,tK,WmA,sj,ZmA,rj,aj,gj,Ij,cj,Bj,VmA,lj,Cj,Qj,dj,Ej,hj,uj,ape,$mA,AwA,pj,jmA,zmA,fj,XmA,yj]),twA=xA({type:QA("source_port"),pin_number:vA().optional(),port_hints:fe(v()).optional(),name:v(),source_port_id:v(),source_component_id:v().optional(),source_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),must_be_connected:te().optional()}),iwA=xA({type:QA("source_component_internal_connection"),source_component_internal_connection_id:v(),source_component_id:v(),source_port_ids:fe(v()),subcircuit_id:v().optional()}),owA=xA({type:QA("source_trace"),source_trace_id:v(),connected_source_port_ids:fe(v()),connected_source_net_ids:fe(v()),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),max_length:vA().optional(),min_trace_thickness:vA().optional(),display_name:v().optional()}),nwA=xA({type:QA("source_group"),source_group_id:v(),subcircuit_id:v().optional(),parent_subcircuit_id:v().optional(),parent_source_group_id:v().optional(),is_subcircuit:te().optional(),show_as_schematic_box:te().optional(),name:v().optional(),was_automatically_named:te().optional()}),swA=xA({type:QA("source_net"),source_net_id:v(),name:v(),member_source_group_ids:fe(v()),is_power:te().optional(),is_ground:te().optional(),is_digital_signal:te().optional(),is_analog_signal:te().optional(),is_positive_voltage_source:te().optional(),trace_width:vA().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),rwA=xA({type:QA("source_board"),source_board_id:v(),source_group_id:v(),title:v().optional()}).describe("Defines a board in the source domain"),awA=xA({type:QA("source_pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional()}).describe("Defines a ground plane in the source domain"),h1=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],mj=Ze(h1),os=mj.or(xA({name:mj})).transform(t=>typeof t=="string"?t:t.name),em=Ze(["top","bottom"]),gwA=xA({type:QA("source_manually_placed_via"),source_manually_placed_via_id:v(),source_group_id:v(),source_net_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional()}).describe("Defines a via that is manually placed in the source domain"),IwA=xA({type:QA("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:Ai("source_pin_must_be_connected_error"),error_type:QA("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),message:v(),source_component_id:v(),source_port_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),wj=xA({type:QA("unknown_error_finding_part"),unknown_error_finding_part_id:Ai("unknown_error_finding_part"),error_type:QA("unknown_error_finding_part").default("unknown_error_finding_part"),message:v(),source_component_id:v().optional(),subcircuit_id:v().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),cwA=xA({type:QA("schematic_box"),schematic_component_id:v().optional(),width:ce,height:ce,is_dashed:te().default(!1),x:ce,y:ce,subcircuit_id:v().optional()}).describe("Draws a box on the schematic"),BwA=xA({type:QA("schematic_path"),schematic_component_id:v(),fill_color:Ze(["red","blue"]).optional(),is_filled:te().optional(),points:fe(Bo),subcircuit_id:v().optional()}),lwA=Aa(xA({left_margin:VA.optional(),right_margin:VA.optional(),top_margin:VA.optional(),bottom_margin:VA.optional()})),CwA=xA({left_size:vA(),right_size:vA(),top_size:vA().optional(),bottom_size:vA().optional()}),QwA=xA({left_side:xA({pins:fe(vA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:xA({pins:fe(vA()),direction:Ze(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:xA({pins:fe(vA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:xA({pins:fe(vA()),direction:Ze(["left-to-right","right-to-left"]).optional()}).optional()}),EwA=Zt([CwA,QwA]),hwA=xA({type:QA("schematic_component"),size:ij,center:Bo,source_component_id:v().optional(),schematic_component_id:v(),pin_spacing:VA.optional(),pin_styles:lwA.optional(),box_width:VA.optional(),symbol_name:v().optional(),port_arrangement:EwA.optional(),port_labels:Aa(v()).optional(),symbol_display_value:v().optional(),subcircuit_id:v().optional(),schematic_group_id:v().optional(),is_schematic_group:te().optional(),source_group_id:v().optional(),is_box_with_pins:te().optional().default(!0)}),uwA=xA({type:QA("schematic_line"),schematic_line_id:Ai("schematic_line"),schematic_component_id:v(),x1:ce,y1:ce,x2:ce,y2:ce,stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled line on the schematic"),dwA=xA({type:QA("schematic_rect"),schematic_rect_id:Ai("schematic_rect"),schematic_component_id:v(),center:Bo,width:ce,height:ce,rotation:CI.default(0),stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled rectangle on the schematic"),pwA=xA({type:QA("schematic_circle"),schematic_circle_id:Ai("schematic_circle"),schematic_component_id:v(),center:Bo,radius:ce,stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_filled:te().default(!1),fill_color:v().optional(),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled circle on the schematic"),fwA=xA({type:QA("schematic_arc"),schematic_arc_id:Ai("schematic_arc"),schematic_component_id:v(),center:Bo,radius:ce,start_angle_degrees:CI,end_angle_degrees:CI,direction:Ze(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:ce.nullable().optional(),color:v().default("#000000"),is_dashed:te().default(!1),subcircuit_id:v().optional()}).describe("Draws a styled arc on the schematic"),ywA=xA({type:QA("schematic_trace"),schematic_trace_id:v(),source_trace_id:v().optional(),junctions:fe(xA({x:vA(),y:vA()})),edges:fe(xA({from:xA({x:vA(),y:vA()}),to:xA({x:vA(),y:vA()}),is_crossing:te().optional(),from_schematic_port_id:v().optional(),to_schematic_port_id:v().optional()})),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional()}),gpe=Ze(["center","left","right","top","bottom"]),mwA=xA({type:QA("schematic_text"),schematic_component_id:v().optional(),schematic_text_id:v(),text:v(),font_size:vA().default(.18),position:xA({x:ce,y:ce}),rotation:vA().default(0),anchor:Zt([gpe.describe("legacy"),Kk]).default("center"),color:v().default("#000000"),subcircuit_id:v().optional()}),wwA=xA({type:QA("schematic_port"),schematic_port_id:v(),source_port_id:v(),schematic_component_id:v().optional(),center:Bo,facing_direction:Ze(["up","down","left","right"]).optional(),distance_from_component_edge:vA().optional(),side_of_component:Ze(["top","bottom","left","right"]).optional(),true_ccw_index:vA().optional(),pin_number:vA().optional(),display_pin_label:v().optional(),subcircuit_id:v().optional(),is_connected:te().optional(),has_input_arrow:te().optional(),has_output_arrow:te().optional()}).describe("Defines a port on a schematic component"),DwA=xA({type:QA("schematic_net_label"),schematic_net_label_id:Ai("schematic_net_label"),schematic_trace_id:v().optional(),source_trace_id:v().optional(),source_net_id:v(),center:Bo,anchor_position:Bo.optional(),anchor_side:Ze(["top","bottom","left","right"]),text:v(),symbol_name:v().optional(),is_movable:te().optional(),subcircuit_id:v().optional()}),SwA=xA({type:QA("schematic_error"),schematic_error_id:v(),error_type:QA("schematic_port_not_found").default("schematic_port_not_found"),message:v(),subcircuit_id:v().optional()}).describe("Defines a schematic error on the schematic"),bwA=xA({type:QA("schematic_layout_error"),schematic_layout_error_id:Ai("schematic_layout_error"),error_type:QA("schematic_layout_error").default("schematic_layout_error"),message:v(),source_group_id:v(),schematic_group_id:v(),subcircuit_id:v().optional()}).describe("Error emitted when schematic layout fails for a group"),iK=xA({type:QA("schematic_debug_object"),label:v().optional(),subcircuit_id:v().optional()}),xwA=iK.extend({shape:QA("rect"),center:Bo,size:ij}),kwA=iK.extend({shape:QA("line"),start:Bo,end:Bo}),GwA=iK.extend({shape:QA("point"),center:Bo}),FwA=nE("shape",[xwA,kwA,GwA]),_wA=xA({type:QA("schematic_voltage_probe"),schematic_voltage_probe_id:v(),source_component_id:v().optional(),name:v().optional(),position:Bo,schematic_trace_id:v(),voltage:ey.optional(),subcircuit_id:v().optional(),color:v().optional(),label_alignment:Kk.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),Dj=xA({type:QA("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:Ai("schematic_manual_edit_conflict_warning"),warning_type:QA("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:v(),schematic_component_id:v(),schematic_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),RwA=xA({type:QA("schematic_group"),schematic_group_id:Ai("schematic_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA,height:VA,center:Bo,schematic_component_ids:fe(v()),show_as_schematic_box:te().optional(),name:v().optional(),description:v().optional()}).describe("Defines a group of components on the schematic"),NwA=xA({type:QA("schematic_table"),schematic_table_id:Ai("schematic_table"),anchor_position:Bo,column_widths:fe(ce),row_heights:fe(ce),cell_padding:ce.optional(),border_width:ce.optional(),subcircuit_id:v().optional(),schematic_component_id:v().optional(),anchor:Kk.optional()}).describe("Defines a table on the schematic"),MwA=xA({type:QA("schematic_table_cell"),schematic_table_cell_id:Ai("schematic_table_cell"),schematic_table_id:v(),start_row_index:vA(),end_row_index:vA(),start_column_index:vA(),end_column_index:vA(),text:v().optional(),center:Bo,width:ce,height:ce,horizontal_align:Ze(["left","center","right"]).optional(),vertical_align:Ze(["top","middle","bottom"]).optional(),font_size:ce.optional(),subcircuit_id:v().optional()}).describe("Defines a cell within a schematic_table"),vwA=xA({type:QA("schematic_sheet"),schematic_sheet_id:Ai("schematic_sheet"),name:v().optional(),subcircuit_id:v().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),UwA=xA({x:ce,y:ce,bulge:vA().optional()}),Sj=xA({vertices:fe(UwA)}),LwA=xA({outer_ring:Sj,inner_rings:fe(Sj).default([])}),HwA=xA({x:ce,y:ce,via:te().optional(),via_to_layer:os.optional()}),Ipe=fe(HwA),rw=xA({x:ce,y:ce,via:te().optional(),to_layer:os.optional(),trace_width:ce.optional()}),YwA=xA({type:QA("pcb_component"),pcb_component_id:Ai("pcb_component"),source_component_id:v(),center:Bo,layer:os,rotation:CI,display_offset_x:v().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:VA,height:VA,do_not_place:te().optional(),subcircuit_id:v().optional(),pcb_group_id:v().optional(),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),obstructs_within_bounds:te().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB"),JwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("circle"),hole_diameter:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),cpe=JwA.describe("Defines a circular hole on the PCB"),KwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rect"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Bpe=KwA.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),TwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:Ze(["circle","square"]),hole_diameter:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),lpe=TwA.describe("Defines a circular or square hole on the PCB"),qwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("oval"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Cpe=qwA.describe("Defines an oval hole on the PCB"),PwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("pill"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Qpe=PwA.describe("Defines a pill-shaped hole on the PCB"),OwA=xA({type:QA("pcb_hole"),pcb_hole_id:Ai("pcb_hole"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_component_id:v().optional(),hole_shape:QA("rotated_pill"),hole_width:vA(),hole_height:vA(),x:ce,y:ce,ccw_rotation:CI,is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Epe=OwA.describe("Defines a rotated pill-shaped hole on the PCB"),WwA=TwA.or(qwA).or(PwA).or(OwA).or(JwA).or(KwA),hpe=xA({type:QA("pcb_plated_hole"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_diameter:vA(),hole_diameter:vA(),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),upe=xA({type:QA("pcb_plated_hole"),shape:Ze(["oval","pill"]),pcb_group_id:v().optional(),subcircuit_id:v().optional(),outer_width:vA(),outer_height:vA(),hole_width:vA(),hole_height:vA(),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,ccw_rotation:CI,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),dpe=xA({type:QA("pcb_plated_hole"),shape:QA("circular_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("circle"),pad_shape:QA("rect"),hole_diameter:vA(),rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ppe=xA({type:QA("pcb_plated_hole"),shape:QA("pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("pill"),pad_shape:QA("rect"),hole_width:vA(),hole_height:vA(),rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),fpe=xA({type:QA("pcb_plated_hole"),shape:QA("rotated_pill_hole_with_rect_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:QA("rotated_pill"),pad_shape:QA("rect"),hole_width:vA(),hole_height:vA(),hole_ccw_rotation:CI,rect_pad_width:vA(),rect_pad_height:vA(),rect_border_radius:vA().optional(),rect_ccw_rotation:CI,hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ype=xA({type:QA("pcb_plated_hole"),shape:QA("hole_with_polygon_pad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),hole_shape:Ze(["circle","oval","pill","rotated_pill"]),hole_diameter:vA().optional(),hole_width:vA().optional(),hole_height:vA().optional(),pad_outline:fe(xA({x:ce,y:ce})).min(3),hole_offset_x:ce.default(0),hole_offset_y:ce.default(0),is_covered_with_solder_mask:te().optional(),x:ce,y:ce,layers:fe(os),port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),pcb_plated_hole_id:Ai("pcb_plated_hole"),soldermask_margin:vA().optional()}),ZwA=Zt([hpe,upe,dpe,ppe,fpe,ype]),VwA=xA({type:QA("pcb_port"),pcb_port_id:Ai("pcb_port"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_port_id:v(),pcb_component_id:v().optional(),x:ce,y:ce,layers:fe(os),is_board_pinout:te().optional()}).describe("Defines a port on the PCB"),mpe=xA({type:QA("pcb_smtpad"),shape:QA("circle"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,radius:vA(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),wpe=xA({type:QA("pcb_smtpad"),shape:QA("rect"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),rect_border_radius:vA().optional(),corner_radius:vA().optional(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Dpe=xA({type:QA("pcb_smtpad"),shape:QA("rotated_rect"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),rect_border_radius:vA().optional(),corner_radius:vA().optional(),ccw_rotation:CI,layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),jwA=xA({type:QA("pcb_smtpad"),shape:QA("pill"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),Spe=xA({type:QA("pcb_smtpad"),shape:QA("rotated_pill"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),ccw_rotation:CI,layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),bpe=xA({type:QA("pcb_smtpad"),shape:QA("polygon"),pcb_smtpad_id:Ai("pcb_smtpad"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),points:fe(Bo),layer:os,port_hints:fe(v()).optional(),pcb_component_id:v().optional(),pcb_port_id:v().optional(),is_covered_with_solder_mask:te().optional(),soldermask_margin:vA().optional()}),zwA=nE("shape",[mpe,wpe,Dpe,Spe,jwA,bpe]).describe("Defines an SMT pad on the PCB"),xpe=xA({type:QA("pcb_solder_paste"),shape:QA("circle"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,radius:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),kpe=xA({type:QA("pcb_solder_paste"),shape:QA("rect"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),Gpe=xA({type:QA("pcb_solder_paste"),shape:QA("pill"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),radius:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),Fpe=xA({type:QA("pcb_solder_paste"),shape:QA("rotated_rect"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),ccw_rotation:ce,layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),_pe=xA({type:QA("pcb_solder_paste"),shape:QA("oval"),pcb_solder_paste_id:Ai("pcb_solder_paste"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),x:ce,y:ce,width:vA(),height:vA(),layer:os,pcb_component_id:v().optional(),pcb_smtpad_id:v().optional()}),XwA=Zt([xpe,kpe,Gpe,Fpe,_pe]).describe("Defines solderpaste on the PCB"),$wA=xA({type:QA("pcb_text"),pcb_text_id:Ai("pcb_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),text:v(),center:Bo,layer:os,width:VA,height:VA,lines:vA(),align:Ze(["bottom-left"])}).describe("Defines text on the PCB"),ADA=xA({route_type:QA("wire"),x:ce,y:ce,width:ce,start_pcb_port_id:v().optional(),end_pcb_port_id:v().optional(),layer:os}),eDA=xA({route_type:QA("via"),x:ce,y:ce,hole_diameter:ce.optional(),outer_diameter:ce.optional(),from_layer:v(),to_layer:v()}),bj=Zt([ADA,eDA]),tDA=xA({type:QA("pcb_trace"),source_trace_id:v().optional(),pcb_component_id:v().optional(),pcb_trace_id:Ai("pcb_trace"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),route_thickness_mode:Ze(["constant","interpolated"]).default("constant").optional(),route_order_index:vA().optional(),should_round_corners:te().optional(),trace_length:vA().optional(),highlight_color:v().optional(),route:fe(bj)}).describe("Defines a trace on the PCB"),iDA=xA({type:QA("pcb_trace_error"),pcb_trace_error_id:Ai("pcb_trace_error"),error_type:QA("pcb_trace_error").default("pcb_trace_error"),message:v(),center:Bo.optional(),pcb_trace_id:v(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB"),oDA=xA({type:QA("pcb_trace_missing_error"),pcb_trace_missing_error_id:Ai("pcb_trace_missing_error"),error_type:QA("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:v(),center:Bo.optional(),source_trace_id:v(),pcb_component_ids:fe(v()),pcb_port_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),nDA=xA({type:QA("pcb_port_not_matched_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:v(),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),sDA=xA({type:QA("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:Ai("pcb_port_not_connected_error"),error_type:QA("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:v(),pcb_port_ids:fe(v()),pcb_component_ids:fe(v()),subcircuit_id:v().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),rDA=xA({type:QA("pcb_net"),pcb_net_id:Ai("pcb_net"),source_net_id:v().optional(),highlight_color:v().optional()}).describe("Defines a net on the PCB"),aDA=xA({type:QA("pcb_via"),pcb_via_id:Ai("pcb_via"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),x:ce,y:ce,outer_diameter:ce.default("0.6mm"),hole_diameter:ce.default("0.25mm"),from_layer:os.optional(),to_layer:os.optional(),layers:fe(os),pcb_trace_id:v().optional(),net_is_assignable:te().optional(),net_assigned:te().optional(),is_tented:te().optional()}).describe("Defines a via on the PCB"),gDA=xA({type:QA("pcb_board"),pcb_board_id:Ai("pcb_board"),pcb_panel_id:v().optional(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA.optional(),height:VA.optional(),center:Bo,thickness:VA.optional().default(1.4),num_layers:vA().optional().default(4),outline:fe(Bo).optional(),shape:Ze(["rect","polygon"]).optional(),material:Ze(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),IDA=xA({type:QA("pcb_panel"),pcb_panel_id:Ai("pcb_panel"),width:VA,height:VA,center:Bo,covered_with_solder_mask:te().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),cDA=xA({type:QA("pcb_placement_error"),pcb_placement_error_id:Ai("pcb_placement_error"),error_type:QA("pcb_placement_error").default("pcb_placement_error"),message:v(),subcircuit_id:v().optional()}).describe("Defines a placement error on the PCB"),BDA=xA({type:QA("pcb_trace_hint"),pcb_trace_hint_id:Ai("pcb_trace_hint"),pcb_port_id:v(),pcb_component_id:v(),route:fe(rw),subcircuit_id:v().optional()}).describe("A hint that can be used during generation of a PCB trace"),lDA=xA({type:QA("pcb_silkscreen_line"),pcb_silkscreen_line_id:Ai("pcb_silkscreen_line"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),stroke_width:ce.default("0.1mm"),x1:ce,y1:ce,x2:ce,y2:ce,layer:em}).describe("Defines a silkscreen line on the PCB"),CDA=xA({type:QA("pcb_silkscreen_path"),pcb_silkscreen_path_id:Ai("pcb_silkscreen_path"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,route:fe(Bo),stroke_width:VA}).describe("Defines a silkscreen path on the PCB"),QDA=xA({type:QA("pcb_silkscreen_text"),pcb_silkscreen_text_id:Ai("pcb_silkscreen_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:VA,top:VA,bottom:VA,right:VA}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:vA().optional(),layer:os,is_mirrored:te().default(!1).optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Kk.default("center")}).describe("Defines silkscreen text on the PCB"),EDA=xA({type:QA("pcb_copper_text"),pcb_copper_text_id:Ai("pcb_copper_text"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("0.2mm"),pcb_component_id:v(),text:v(),is_knockout:te().default(!1).optional(),knockout_padding:xA({left:VA,top:VA,bottom:VA,right:VA}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:vA().optional(),layer:os,is_mirrored:te().default(!1).optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Kk.default("center")}).describe("Defines copper text on the PCB"),hDA=xA({type:QA("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Ai("pcb_silkscreen_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:os,stroke_width:VA.default("1mm"),corner_radius:VA.optional(),is_filled:te().default(!0).optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional()}).describe("Defines a silkscreen rect on the PCB"),uDA=xA({type:QA("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Ai("pcb_silkscreen_circle"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius:VA,layer:em,stroke_width:VA.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),dDA=xA({type:QA("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Ai("pcb_silkscreen_oval"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius_x:ce,radius_y:ce,layer:em}).describe("Defines a silkscreen oval on the PCB"),pDA=xA({type:QA("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Ai("pcb_fabrication_note_text"),subcircuit_id:v().optional(),pcb_group_id:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),pcb_component_id:v(),text:v(),layer:em,anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),fDA=xA({type:QA("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Ai("pcb_fabrication_note_path"),pcb_component_id:v(),subcircuit_id:v().optional(),layer:os,route:fe(Bo),stroke_width:VA,color:v().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),yDA=xA({type:QA("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:Ai("pcb_fabrication_note_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:em,stroke_width:VA.default("0.1mm"),corner_radius:VA.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a fabrication note rectangle on the PCB"),mDA=xA({type:QA("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:Ai("pcb_fabrication_note_dimension"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,from:Bo,to:Bo,text:v().optional(),text_ccw_rotation:vA().optional(),offset:VA.optional(),offset_distance:VA.optional(),offset_direction:xA({x:vA(),y:vA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:VA.default("1mm"),color:v().optional(),arrow_size:VA.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),wDA=xA({type:QA("pcb_note_text"),pcb_note_text_id:Ai("pcb_note_text"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),text:v().optional(),anchor_position:Bo.default({x:0,y:0}),anchor_alignment:Ze(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:v().optional()}).describe("Defines a documentation note in text on the PCB"),DDA=xA({type:QA("pcb_note_rect"),pcb_note_rect_id:Ai("pcb_note_rect"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),center:Bo,width:VA,height:VA,stroke_width:VA.default("0.1mm"),corner_radius:VA.optional(),is_filled:te().optional(),has_stroke:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a rectangular documentation note on the PCB"),SDA=xA({type:QA("pcb_note_path"),pcb_note_path_id:Ai("pcb_note_path"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),route:fe(Bo),stroke_width:VA.default("0.1mm"),color:v().optional()}).describe("Defines a polyline documentation note on the PCB"),bDA=xA({type:QA("pcb_note_line"),pcb_note_line_id:Ai("pcb_note_line"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),text:v().optional(),x1:ce,y1:ce,x2:ce,y2:ce,stroke_width:ce.default("0.1mm"),color:v().optional(),is_dashed:te().optional()}).describe("Defines a straight documentation note line on the PCB"),xDA=xA({type:QA("pcb_note_dimension"),pcb_note_dimension_id:Ai("pcb_note_dimension"),pcb_component_id:v().optional(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),name:v().optional(),from:Bo,to:Bo,text:v().optional(),text_ccw_rotation:vA().optional(),offset_distance:VA.optional(),offset_direction:xA({x:vA(),y:vA()}).optional(),font:QA("tscircuit2024").default("tscircuit2024"),font_size:VA.default("1mm"),color:v().optional(),arrow_size:VA.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),kDA=xA({type:QA("pcb_footprint_overlap_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:v(),pcb_smtpad_ids:fe(v()).optional(),pcb_plated_hole_ids:fe(v()).optional(),pcb_hole_ids:fe(v()).optional(),pcb_keepout_ids:fe(v()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),GDA=xA({type:QA("pcb_keepout"),shape:QA("rect"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:ce,height:ce,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()}).or(xA({type:QA("pcb_keepout"),shape:QA("circle"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,radius:ce,pcb_keepout_id:v(),layers:fe(v()),description:v().optional()})),oK=xA({type:QA("pcb_cutout"),pcb_cutout_id:Ai("pcb_cutout"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),pcb_board_id:v().optional(),pcb_panel_id:v().optional()}),FDA=oK.extend({shape:QA("rect"),center:Bo,width:VA,height:VA,rotation:CI.optional(),corner_radius:VA.optional()}),_DA=oK.extend({shape:QA("circle"),center:Bo,radius:VA}),RDA=oK.extend({shape:QA("polygon"),points:fe(Bo)}),NDA=oK.extend({shape:QA("path"),route:fe(Bo),slot_width:VA,slot_length:VA.optional(),space_between_slots:VA.optional(),slot_corner_radius:VA.optional()}),MDA=nE("shape",[FDA,_DA,RDA,NDA]).describe("Defines a cutout on the PCB, removing board material."),vDA=xA({type:QA("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Ai("pcb_missing_footprint_error"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:v(),message:v()}).describe("Defines a missing footprint error on the PCB"),u1=xA({type:QA("external_footprint_load_error"),external_footprint_load_error_id:Ai("external_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),error_type:QA("external_footprint_load_error").default("external_footprint_load_error"),message:v()}).describe("Defines an error when an external footprint fails to load"),xj=xA({type:QA("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:Ai("circuit_json_footprint_load_error"),pcb_component_id:v(),source_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),error_type:QA("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:v(),circuit_json:fe(Tg()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),UDA=xA({type:QA("pcb_group"),pcb_group_id:Ai("pcb_group"),source_group_id:v(),is_subcircuit:te().optional(),subcircuit_id:v().optional(),width:VA.optional(),height:VA.optional(),center:Bo,display_offset_x:v().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:v().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:fe(Bo).optional(),anchor_position:Bo.optional(),anchor_alignment:Kk.default("center"),position_mode:Ze(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:v().optional(),positioned_relative_to_pcb_board_id:v().optional(),pcb_component_ids:fe(v()),child_layout_mode:Ze(["packed","none"]).optional(),name:v().optional(),description:v().optional(),layout_mode:v().optional(),autorouter_configuration:xA({trace_clearance:VA}).optional(),autorouter_used_string:v().optional()}).describe("Defines a group of components on the PCB"),LDA=xA({type:QA("pcb_autorouting_error"),pcb_error_id:Ai("pcb_autorouting_error"),error_type:QA("pcb_autorouting_error").default("pcb_autorouting_error"),message:v(),subcircuit_id:v().optional()}).describe("The autorouting has failed to route a portion of the board"),kj=xA({type:QA("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:Ai("pcb_manual_edit_conflict_warning"),warning_type:QA("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:v(),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),source_component_id:v()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),HDA=xA({type:QA("pcb_breakout_point"),pcb_breakout_point_id:Ai("pcb_breakout_point"),pcb_group_id:v(),subcircuit_id:v().optional(),source_trace_id:v().optional(),source_port_id:v().optional(),source_net_id:v().optional(),x:ce,y:ce}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),YDA=xA({type:QA("pcb_ground_plane"),pcb_ground_plane_id:Ai("pcb_ground_plane"),source_pcb_ground_plane_id:v(),source_net_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional()}).describe("Defines a ground plane on the PCB"),JDA=xA({type:QA("pcb_ground_plane_region"),pcb_ground_plane_region_id:Ai("pcb_ground_plane_region"),pcb_ground_plane_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:os,points:fe(Bo)}).describe("Defines a polygon region of a ground plane"),KDA=xA({type:QA("pcb_thermal_spoke"),pcb_thermal_spoke_id:Ai("pcb_thermal_spoke"),pcb_ground_plane_id:v(),shape:v(),spoke_count:vA(),spoke_thickness:ce,spoke_inner_diameter:ce,spoke_outer_diameter:ce,pcb_plated_hole_id:v().optional(),subcircuit_id:v().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),Gj=xA({type:QA("pcb_copper_pour"),pcb_copper_pour_id:Ai("pcb_copper_pour"),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:os,source_net_id:v().optional(),covered_with_solder_mask:te().optional().default(!0)}),TDA=Gj.extend({shape:QA("rect"),center:Bo,width:VA,height:VA,rotation:CI.optional()}),qDA=Gj.extend({shape:QA("brep"),brep_shape:LwA}),PDA=Gj.extend({shape:QA("polygon"),points:fe(Bo)}),ODA=nE("shape",[TDA,qDA,PDA]).describe("Defines a copper pour on the PCB."),WDA=xA({type:QA("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:Ai("pcb_component_outside_board_error"),error_type:QA("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:v(),pcb_component_id:v(),pcb_board_id:v(),component_center:Bo,component_bounds:xA({min_x:vA(),max_x:vA(),min_y:vA(),max_y:vA()}),subcircuit_id:v().optional(),source_component_id:v().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),nK=xA({type:QA("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:Ai("pcb_component_invalid_layer_error"),error_type:QA("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),message:v(),pcb_component_id:v().optional(),source_component_id:v(),layer:os,subcircuit_id:v().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),ZDA=xA({type:QA("pcb_via_clearance_error"),pcb_error_id:Ai("pcb_error"),error_type:QA("pcb_via_clearance_error").default("pcb_via_clearance_error"),message:v(),pcb_via_ids:fe(v()).min(2),minimum_clearance:ce.optional(),actual_clearance:ce.optional(),pcb_center:xA({x:vA().optional(),y:vA().optional()}).optional(),subcircuit_id:v().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),VDA=xA({type:QA("pcb_courtyard_rect"),pcb_courtyard_rect_id:Ai("pcb_courtyard_rect"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),center:Bo,width:VA,height:VA,layer:em,color:v().optional()}).describe("Defines a courtyard rectangle on the PCB"),jDA=xA({type:QA("pcb_courtyard_outline"),pcb_courtyard_outline_id:Ai("pcb_courtyard_outline"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,outline:fe(Bo).min(2),stroke_width:VA.default("0.1mm"),is_closed:te().optional(),is_stroke_dashed:te().optional(),color:v().optional()}).describe("Defines a courtyard outline on the PCB"),zDA=xA({type:QA("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:Ai("pcb_courtyard_polygon"),pcb_component_id:v(),pcb_group_id:v().optional(),subcircuit_id:v().optional(),layer:em,points:fe(Bo).min(3),color:v().optional()}).describe("Defines a courtyard polygon on the PCB"),XDA=xA({type:QA("cad_component"),cad_component_id:v(),pcb_component_id:v(),source_component_id:v(),position:m_,rotation:m_.optional(),size:m_.optional(),layer:os.optional(),subcircuit_id:v().optional(),footprinter_string:v().optional(),model_obj_url:v().optional(),model_stl_url:v().optional(),model_3mf_url:v().optional(),model_gltf_url:v().optional(),model_glb_url:v().optional(),model_step_url:v().optional(),model_wrl_url:v().optional(),model_unit_to_mm_scale_factor:vA().optional(),model_jscad:Tg().optional(),show_as_translucent_model:te().optional()}).describe("Defines a component on the PCB"),$DA=Ze(["sinewave","square","triangle","sawtooth"]),Rpe=Zt([v(),vA()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(vA().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),ASA=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:Ai("simulation_voltage_source"),is_dc_source:QA(!0).optional().default(!0),positive_source_port_id:v().optional(),negative_source_port_id:v().optional(),positive_source_net_id:v().optional(),negative_source_net_id:v().optional(),voltage:ey}).describe("Defines a DC voltage source for simulation"),eSA=xA({type:QA("simulation_voltage_source"),simulation_voltage_source_id:Ai("simulation_voltage_source"),is_dc_source:QA(!1),terminal1_source_port_id:v().optional(),terminal2_source_port_id:v().optional(),terminal1_source_net_id:v().optional(),terminal2_source_net_id:v().optional(),voltage:ey.optional(),frequency:FD.optional(),peak_to_peak_voltage:ey.optional(),wave_shape:$DA.optional(),phase:CI.optional(),duty_cycle:Rpe.optional()}).describe("Defines an AC voltage source for simulation"),tSA=Zt([ASA,eSA]).describe("Defines a voltage source for simulation"),iSA=Zt([QA("spice_dc_sweep"),QA("spice_dc_operating_point"),QA("spice_transient_analysis"),QA("spice_ac_analysis")]),oSA=xA({type:QA("simulation_experiment"),simulation_experiment_id:Ai("simulation_experiment"),name:v(),experiment_type:iSA,time_per_step:E1.optional(),start_time_ms:Pf.optional(),end_time_ms:Pf.optional()}).describe("Defines a simulation experiment configuration"),nSA=xA({type:QA("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:Ai("simulation_transient_voltage_graph"),simulation_experiment_id:v(),timestamps_ms:fe(vA()).optional(),voltage_levels:fe(vA()),source_component_id:v().optional(),subcircuit_connectivity_map_key:v().optional(),time_per_step:E1,start_time_ms:Pf,end_time_ms:Pf,name:v().optional(),color:v().optional()}).describe("Stores voltage measurements over time for a simulation"),sSA=xA({type:QA("simulation_switch"),simulation_switch_id:Ai("simulation_switch"),source_component_id:v().optional(),closes_at:Pf.optional(),opens_at:Pf.optional(),starts_closed:te().optional(),switching_frequency:FD.optional()}).describe("Defines a switch for simulation timing control"),rSA=xA({type:QA("simulation_voltage_probe"),simulation_voltage_probe_id:Ai("simulation_voltage_probe"),source_component_id:v().optional(),name:v().optional(),signal_input_source_port_id:v().optional(),signal_input_source_net_id:v().optional(),reference_input_source_port_id:v().optional(),reference_input_source_net_id:v().optional(),subcircuit_id:v().optional(),color:v().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,A)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){const i=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,o=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;i&&o?A.addIssue({code:Wt.custom,message:"Cannot mix port and net connections in a differential probe."}):i?(!t.signal_input_source_port_id||!t.reference_input_source_port_id)&&A.addIssue({code:Wt.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):o&&(!t.signal_input_source_net_id||!t.reference_input_source_net_id)&&A.addIssue({code:Wt.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!t.signal_input_source_port_id==!!t.signal_input_source_net_id&&A.addIssue({code:Wt.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),aSA=xA({type:QA("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:Ai("simulation_unknown_experiment_error"),error_type:QA("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),message:v(),simulation_experiment_id:v().optional(),subcircuit_id:v().optional()}).describe("An unknown error occurred during the simulation experiment."),gSA=Zt([owA,twA,iwA,ewA,swA,nwA,rj,oj,tK,sj,nj,aj,gj,Ij,lj,Cj,Qj,dj,Ej,hj,uj,Bj,cj,awA,gwA,rwA,pj,fj,yj,IwA,wj,YwA,WwA,vDA,u1,xj,kj,ZwA,GDA,VwA,rDA,$wA,tDA,aDA,zwA,XwA,gDA,IDA,UDA,BDA,lDA,CDA,QDA,EDA,hDA,uDA,dDA,iDA,oDA,cDA,nDA,sDA,ZDA,fDA,pDA,yDA,mDA,wDA,DDA,SDA,bDA,xDA,LDA,kDA,HDA,MDA,YDA,JDA,KDA,ODA,WDA,nK,VDA,jDA,zDA,cwA,mwA,uwA,dwA,pwA,fwA,hwA,wwA,ywA,BwA,SwA,bwA,DwA,FwA,_wA,Dj,RwA,vwA,NwA,MwA,XDA,tSA,oSA,nSA,sSA,rSA,aSA]),w_=gSA;const d1=Object.freeze(Object.defineProperty({__proto__:null,all_layers:h1,any_circuit_element:gSA,any_soup_element:w_,any_source_component:ewA,battery_capacity:OmA,brep_shape:LwA,cad_component:XDA,capacitance:y_,circuit_json_footprint_load_error:xj,current:ipe,distance:ce,duration_ms:E1,experiment_type:iSA,external_footprint_load_error:u1,frequency:FD,getZodPrefixedIdWithDefault:Ai,inductance:tj,layer_ref:os,layer_string:mj,length:VA,ms:Pf,ninePointAnchor:Kk,pcb_autorouting_error:LDA,pcb_board:gDA,pcb_breakout_point:HDA,pcb_component:YwA,pcb_component_invalid_layer_error:nK,pcb_component_outside_board_error:WDA,pcb_copper_pour:ODA,pcb_copper_pour_brep:qDA,pcb_copper_pour_polygon:PDA,pcb_copper_pour_rect:TDA,pcb_copper_text:EDA,pcb_courtyard_outline:jDA,pcb_courtyard_polygon:zDA,pcb_courtyard_rect:VDA,pcb_cutout:MDA,pcb_cutout_circle:_DA,pcb_cutout_path:NDA,pcb_cutout_polygon:RDA,pcb_cutout_rect:FDA,pcb_fabrication_note_dimension:mDA,pcb_fabrication_note_path:fDA,pcb_fabrication_note_rect:yDA,pcb_fabrication_note_text:pDA,pcb_footprint_overlap_error:kDA,pcb_ground_plane:YDA,pcb_ground_plane_region:JDA,pcb_group:UDA,pcb_hole:WwA,pcb_hole_circle_or_square_shape:lpe,pcb_hole_circle_shape:cpe,pcb_hole_oval_shape:Cpe,pcb_hole_pill_shape:Qpe,pcb_hole_rect_shape:Bpe,pcb_hole_rotated_pill_shape:Epe,pcb_keepout:GDA,pcb_manual_edit_conflict_warning:kj,pcb_missing_footprint_error:vDA,pcb_net:rDA,pcb_note_dimension:xDA,pcb_note_line:bDA,pcb_note_path:SDA,pcb_note_rect:DDA,pcb_note_text:wDA,pcb_panel:IDA,pcb_placement_error:cDA,pcb_plated_hole:ZwA,pcb_port:VwA,pcb_port_not_connected_error:sDA,pcb_port_not_matched_error:nDA,pcb_route_hint:HwA,pcb_route_hints:Ipe,pcb_silkscreen_circle:uDA,pcb_silkscreen_line:lDA,pcb_silkscreen_oval:dDA,pcb_silkscreen_path:CDA,pcb_silkscreen_rect:hDA,pcb_silkscreen_text:QDA,pcb_smtpad:zwA,pcb_smtpad_pill:jwA,pcb_solder_paste:XwA,pcb_text:$wA,pcb_thermal_spoke:KDA,pcb_trace:tDA,pcb_trace_error:iDA,pcb_trace_hint:BDA,pcb_trace_missing_error:oDA,pcb_trace_route_point:bj,pcb_trace_route_point_via:eDA,pcb_trace_route_point_wire:ADA,pcb_via:aDA,pcb_via_clearance_error:ZDA,point:Bo,point3:m_,point_with_bulge:UwA,port_arrangement:EwA,position:npe,position3:spe,resistance:f_,ring:Sj,rotation:CI,route_hint_point:rw,schematic_arc:fwA,schematic_box:cwA,schematic_circle:pwA,schematic_component:hwA,schematic_component_port_arrangement_by_sides:QwA,schematic_component_port_arrangement_by_size:CwA,schematic_debug_line:kwA,schematic_debug_object:FwA,schematic_debug_object_base:iK,schematic_debug_point:GwA,schematic_debug_rect:xwA,schematic_error:SwA,schematic_group:RwA,schematic_layout_error:bwA,schematic_line:uwA,schematic_manual_edit_conflict_warning:Dj,schematic_net_label:DwA,schematic_path:BwA,schematic_pin_styles:lwA,schematic_port:wwA,schematic_rect:dwA,schematic_sheet:vwA,schematic_table:NwA,schematic_table_cell:MwA,schematic_text:mwA,schematic_trace:ywA,schematic_voltage_probe:_wA,simulation_ac_voltage_source:eSA,simulation_dc_voltage_source:ASA,simulation_experiment:oSA,simulation_switch:sSA,simulation_transient_voltage_graph:nSA,simulation_unknown_experiment_error:aSA,simulation_voltage_probe:rSA,simulation_voltage_source:tSA,size:ij,source_board:rwA,source_component_base:dB,source_component_internal_connection:iwA,source_failed_to_create_component_error:zmA,source_group:nwA,source_interconnect:AwA,source_manually_placed_via:gwA,source_missing_property_error:jmA,source_net:swA,source_pcb_ground_plane:awA,source_pin_missing_trace_warning:yj,source_pin_must_be_connected_error:IwA,source_port:twA,source_project_metadata:pj,source_property_ignored_warning:XmA,source_simple_battery:gj,source_simple_capacitor:oj,source_simple_chip:rj,source_simple_crystal:VmA,source_simple_diode:tK,source_simple_fiducial:WmA,source_simple_ground:ZmA,source_simple_inductor:Ij,source_simple_led:sj,source_simple_mosfet:uj,source_simple_pin_header:lj,source_simple_pinout:Cj,source_simple_potentiometer:Bj,source_simple_power_source:aj,source_simple_push_button:cj,source_simple_resistor:nj,source_simple_resonator:Qj,source_simple_switch:dj,source_simple_test_point:hj,source_simple_transistor:Ej,source_simple_voltage_probe:$mA,source_trace:owA,source_trace_not_connected_error:fj,supplier_name:eK,time:ope,timestamp:PmA,unknown_error_finding_part:wj,visible_layer:em,voltage:ey,wave_shape:$DA},Symbol.toStringTag,{value:"Module"}));var Npe=Object.defineProperty,Mpe=(t,A)=>{for(var e in A)Npe(t,e,{get:A[e],enumerable:!0})},_D={};Mpe(_D,{axial:()=>Mfe,bga:()=>Wpe,breakoutheaders:()=>Pfe,cap:()=>Kpe,dfn:()=>Efe,diode:()=>Jpe,dip:()=>Lpe,electrolytic:()=>bme,hc49:()=>Wfe,jst:()=>zye,led:()=>Tpe,lqfp:()=>Tfe,m2host:()=>qme,melf:()=>sye,micromelf:()=>Iye,minimelf:()=>X0e,mlp:()=>efe,ms012:()=>mfe,ms013:()=>Dfe,msop:()=>rme,pad:()=>Zfe,pinrow:()=>dfe,platedhole:()=>Hme,potentiometer:()=>wme,pushbutton:()=>Ufe,qfn:()=>$pe,qfp:()=>Afe,quad:()=>p1,res:()=>qpe,sma:()=>Cye,smb:()=>yye,smbf:()=>kme,smc:()=>Sye,smf:()=>uye,smtpad:()=>Ume,sod110:()=>$ye,sod123:()=>Ffe,sod123f:()=>G0e,sod123fl:()=>N0e,sod123w:()=>I0e,sod128:()=>K0e,sod323:()=>C0e,sod323f:()=>S0e,sod323fl:()=>lme,sod323w:()=>gme,sod523:()=>A0e,sod723:()=>L0e,sod80:()=>s0e,sod882:()=>y0e,sod882d:()=>tye,sod923:()=>u0e,soic:()=>Vpe,solderjumper:()=>ume,son:()=>hme,sop8:()=>o0e,sot:()=>Jme,sot223:()=>Gye,sot23:()=>gfe,sot23w:()=>Hye,sot25:()=>lfe,sot323:()=>Rme,sot363:()=>rfe,sot457:()=>fme,sot563:()=>ffe,sot723:()=>bfe,sot89:()=>Z0e,ssop:()=>ife,stampboard:()=>Hfe,stampreceiver:()=>Kfe,to220:()=>j0e,to92:()=>Xfe,to92s:()=>Pye,tssop:()=>nfe,vssop:()=>ome});var lo=(t,A,e)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:e,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:t,y:A},anchor_alignment:"center"}),Rn=(t,A,e,i,o)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:A,y:e,hole_diameter:wa(i),outer_diameter:wa(o),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()]}),ISA=Array.from({length:9},(t,A)=>Math.cos(A/8*Math.PI-Math.PI)).map(t=>({x:t,y:-Math.sqrt(1-t**2)}));function lb(t){return typeof t=="string"?t.trim().toLowerCase().endsWith("mil")?parseFloat(t)*.0254:parseFloat(t):Number(t)}var sK=Zt([v(),vA()]).transform(t=>lb(t)),vpe=t=>xA({fn:v(),num_pins:vA().optional().default(6),wide:te().optional(),narrow:te().optional(),w:sK.optional(),p:sK.default(t.p??"2.54mm"),id:sK.optional(),od:sK.optional()}).transform(A=>(!A.id&&!A.od?Math.abs(A.p-1.27)<.01?(A.id=lb("0.55mm"),A.od=lb("0.95mm")):(A.id=lb("1.0mm"),A.od=lb("1.5mm")):A.id?A.od||(A.od=A.id*(1.5/1)):A.id=A.od*(1/1.5),A.w||(A.wide?A.w=lb("600mil"):A.narrow?A.w=lb("300mil"):A.w=lb(t.w??"300mil")),A)),Upe=vpe({}),cSA=(t,A,e,i)=>{const o=t/2,n=A<=o,s=o-1,r=i,a=r*s;return n?{x:-e/2,y:a/2-(A-1)*r}:{x:e/2,y:-a/2+(A-o-1)*r}},Lpe=t=>{const A=Upe.parse(t),e=[];for(let g=0;g<A.num_pins;g++){const{x:I,y:c}=cSA(A.num_pins,g+1,A.w,A.p??2.54);e.push(Rn(g+1,I,c,A.id??"0.8mm",A.od??"1mm"))}(A.num_pins/2-1)*A.p+A.od;const o=A.w-A.od-1,n=(A.num_pins/2-1)*A.p+A.od+.4,s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-o/2,y:-n/2},{x:-o/2,y:n/2},...ISA.map(({x:g,y:I})=>({x:g*o/6,y:I*o/6+n/2})),{x:o/2,y:n/2},{x:o/2,y:-n/2},{x:-o/2,y:-n/2}],type:"pcb_silkscreen_path",stroke_width:.1},r=[];for(let g=0;g<A.num_pins;g++){const I=g<A.num_pins/2,c=.6,{y:B}=cSA(A.num_pins,g+1,A.w,A.p??2.54),l=I?-A.w/2-A.od/2-c:A.w/2+A.od/2+c,C=B;r.push({type:"pcb_fabrication_note_text",pcb_fabrication_note_text_id:`pin_${g+1}`,layer:"top",pcb_component_id:`pin_${g+1}`,text:`{pin${g+1}}`,anchor_position:{x:l,y:C},font_size:.3,font:"tscircuit2024",anchor_alignment:"top_left"})}const a=lo(0,n/2+.5,.4);return{circuitJson:[...e,s,a,...r],parameters:A}},xi=(t,A,e,i,o)=>({type:"pcb_smtpad",x:A,y:e,width:i,height:o,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(n=>n.toString()):[t.toString()]}),BSA=[{imperial:"01005",metric:"0402",p_mm_min:.5,pw_mm_min:.4,ph_mm_min:.3,w_mm_min:.58,h_mm_min:.21},{imperial:"0504",metric:"1310",p_mm_min:1.1,pw_mm_min:.65,ph_mm_min:1.3,w_mm_min:.58,h_mm_min:.21},{imperial:"1812",metric:"4532",p_mm_min:4.275,pw_mm_min:1.125,ph_mm_min:3.4,w_mm_min:5.4,h_mm_min:3.4},{imperial:"0201",metric:"0603",p_mm_min:.66,pw_mm_min:.46,ph_mm_min:.4,w_mm_min:.9,h_mm_min:.3},{imperial:"0402",metric:"1005",p_mm_min:1.02,pw_mm_min:.54,ph_mm_min:.64,w_mm_min:1.56,h_mm_min:.64},{imperial:"0603",metric:"1608",p_mm_min:1.65,pw_mm_min:.8,ph_mm_min:.95,w_mm_min:2.45,h_mm_min:.95},{imperial:"0805",metric:"2012",p_mm_min:1.825,pw_mm_min:1.025,ph_mm_min:1.4,w_mm_min:2.8499999999999996,h_mm_min:1.4},{imperial:"1206",metric:"3216",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:1.75,w_mm_min:4.05,h_mm_min:1.75},{imperial:"1210",metric:"3225",p_mm_min:2.925,pw_mm_min:1.125,ph_mm_min:2.65,w_mm_min:4.05,h_mm_min:2.65},{imperial:"2010",metric:"5025",p_mm_min:4.625,pw_mm_min:1.225,ph_mm_min:2.65,w_mm_min:5.85,h_mm_min:2.65},{imperial:"2512",metric:"6332",p_mm_min:5.925,pw_mm_min:1.225,ph_mm_min:3.35,w_mm_min:7.15,h_mm_min:3.35}],Hpe=Object.fromEntries(BSA.map(t=>[t.metric,t])),Ype=Object.fromEntries(BSA.map(t=>[t.imperial,t]));xA({tht:te(),p:VA.optional(),pw:VA.optional(),ph:VA.optional(),metric:ce.optional(),imperial:ce.optional(),w:VA.optional(),h:VA.optional(),textbottom:te().optional()});var rK=t=>{let{tht:A,p:e,pw:i,ph:o,metric:n,imperial:s,w:r,h:a,textbottom:g}=t;if(typeof r=="string"&&(r=Q1(r)),typeof a=="string"&&(a=Q1(a)),typeof e=="string"&&(e=Q1(e)),typeof i=="string"&&(i=Q1(i)),typeof o=="string"&&(o=Q1(o)),a!==void 0&&r!==void 0&&a>r)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let I;if(n&&(I=Hpe[n]),s&&(I=Ype[s]),I&&(r=I.w_mm_min,a=I.h_mm_min,e=I.p_mm_min,i=I.pw_mm_min,o=I.ph_mm_min),e===void 0||i===void 0||o===void 0)throw new Error("Could not determine required pad dimensions (p, pw, ph)");const c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:e/2,y:o/2+.4},{x:-e/2-i/2-.2,y:o/2+.4},{x:-e/2-i/2-.2,y:-o/2-.4},{x:e/2,y:-o/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},B=g?-o/2-.9:o/2+.9,l=lo(0,B,.2);return A?[Rn(1,-e/2,0,i,i*1/.8),Rn(2,e/2,0,i,i*1/.8),c,l]:[xi(["1","left"],-e/2,0,i,o),xi(["2","right"],e/2,0,i,o),c,l]},Jpe=t=>({circuitJson:rK(t),parameters:t}),Kpe=t=>({circuitJson:rK(t),parameters:t}),Tpe=t=>({circuitJson:rK(t),parameters:t}),qpe=t=>({circuitJson:rK(t),parameters:t}),lSA=(t,{x:A,y:e,radius:i})=>({type:"pcb_smtpad",x:A,y:e,radius:i,layer:"top",shape:"circle",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(o=>o.toString()):[t.toString()]}),CSA="ABCDEFGHIJKLMNOPQRSTUVWXYZ",QSA=v().transform(t=>{const[A,e]=t.split(/[x ]/);return{x:parseFloat(A),y:parseFloat(e)}}).pipe(xA({x:vA(),y:vA()})),Ppe=v().or(fe(Tg())).transform(t=>Array.isArray(t)?t:(t.startsWith("(")&&t.endsWith(")")&&(t=t.slice(1,-1)),t.split(",").map(A=>{const e=Number(A);return isNaN(e)?A:e}))).pipe(fe(v().or(vA()))),Ope=xA({fn:v(),num_pins:vA().optional().default(64),grid:QSA.optional(),p:ce.default("0.8mm"),w:VA.optional(),h:VA.optional(),ball:VA.optional().describe("ball diameter"),pad:VA.optional().describe("pad width/height"),circularpads:te().optional().describe("use circular pads"),tlorigin:te().optional(),blorigin:te().optional(),trorigin:te().optional(),brorigin:te().optional(),missing:Ppe.default([])}).transform(t=>{let A="tl";if(t.blorigin&&(A="bl"),t.trorigin&&(A="tr"),t.brorigin&&(A="br"),!t.grid){const i=Math.ceil(Math.sqrt(t.num_pins));t.grid={x:i,y:i}}return t.missing&&(t.missing=t.missing.map(i=>{if(typeof i=="number")return i;if(i==="center")return"center";if(i==="topleft")return"topleft";const o=i.match(/([A-Z]+)(\d+)/);if(!o)return i;const n=CSA.indexOf(o[1]),s=Number.parseInt(o[2])-1;return n*t.grid.x+s+1})),{...t,origin:A}}),Wpe=t=>{const A=Ope.parse(t);let{num_pins:e,grid:i,p:o,w:n,h:s,ball:r,pad:a,missing:g}=A;r??=.75/1.27*o,a??=r*.8;const I=[],c=(g??[]).filter(D=>typeof D=="number"),B=i.x*i.y-e;if(g.length===0&&B>0&&(Math.sqrt(B)%1===0?g.push("center"):B===1&&g.push("topleft")),g?.includes("center")){const D=Math.floor(Math.sqrt(B)),w=Math.floor((i.x-D)/2),x=Math.floor((i.y-D)/2);for(let b=x;b<x+D;b++)for(let F=w;F<w+D;F++)c.push(b*i.x+F+1)}g?.includes("topleft")&&c.push(1);const l=new Set(c);let C=0;for(let D=0;D<i.y;D++)for(let w=0;w<i.x;w++){const x=(w-(i.x-1)/2)*o,b=(D-(i.y-1)/2)*o;let F=w,k=D;switch(A.origin){case"bl":F=w,k=i.y-1-D;break;case"br":F=i.x-1-w,k=i.y-1-D;break;case"tr":F=i.x-1-w,k=D;break}let U=k*i.x+F+1;if(l.has(U)){C++;continue}U-=C;const M=[U,`${CSA[k]}${F+1}`];I.push(A.circularpads?lSA(M,{x,y:b,radius:a/2}):xi(M,x,b,a,a))}const Q=lo(0,i.y*o/2,.2),E=o/6;let h;const u=i.x*o/2,d=i.y*o/2;switch(A.origin){case"bl":h=[{x:-u,y:-d},{x:-u,y:-d-E},{x:-u-E,y:-d},{x:-u,y:-d}];break;case"br":h=[{x:u,y:-d},{x:u,y:-d-E},{x:u+E,y:-d},{x:u,y:-d}];break;case"tr":h=[{x:u,y:d},{x:u,y:d+E},{x:u+E,y:d},{x:u,y:d}];break;default:h=[{x:-u,y:d},{x:-u,y:d+E},{x:-u-E,y:d},{x:-u,y:d}];break}const f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_marker",route:h,stroke_width:.05};return{circuitJson:[...I,Q,f],parameters:A}},aK=(t,A,e,i,o)=>({type:"pcb_smtpad",x:A,y:e,width:i,height:o,radius:o/2,layer:"top",shape:"pill",pcb_smtpad_id:"",port_hints:Array.isArray(t)?t.map(n=>n.toString()):[t.toString()]}),tm=t=>xA({fn:v(),num_pins:vA().optional().default(8),w:VA.default(VA.parse(t.w??"5.3mm")),p:VA.default(VA.parse(t.p??"1.27mm")),pw:VA.default(VA.parse(t.pw??"0.6mm")),pl:VA.default(VA.parse(t.pl??"1.0mm")),legsoutside:te().optional().default(t.legsoutside??!1),pillpads:te().optional().default(t.pillpads??!1)}).transform(A=>(!A.pw&&!A.pl?(A.pw=VA.parse("0.6mm"),A.pl=VA.parse("1.0mm")):A.pw?A.pl||(A.pl=A.pw*(1/.6)):A.pw=A.pl*(.6/1),A)),Zpe=tm({}),Fj=t=>{t.widthincludeslegs!==void 0&&(t.legsoutside=!t.widthincludeslegs);const{num_pins:A,pn:e,w:i,p:o,pl:n,legsoutside:s}=t,r=A/2,a=e<=r,g=r-1,I=o,c=I*g,B=s?n/2:-n/2;return a?{x:-i/2-B,y:c/2-(e-1)*I}:{x:i/2+B,y:-c/2+(e-r-1)*I}},Vpe=t=>{const A=Zpe.parse(t);return{circuitJson:RD(A),parameters:A}},RD=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Fj({num_pins:t.num_pins,pn:r+1,w:t.w,p:t.p,pl:t.pl,legsoutside:t.legsoutside});t.pillpads?A.push(aK(r+1,a,g,t.pl,t.pw)):A.push(xi(r+1,a,g,t.pl,t.pw))}const e=Math.min(1,t.p/2),i=t.w-(t.legsoutside?0:t.pl*2)-.2,o=(t.num_pins/2-1)*t.p+t.pw+e,n=lo(0,o/2+.4,o/12),s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-i/2,y:-o/2},{x:-i/2,y:o/2},...ISA.map(({x:r,y:a})=>({x:r*i/6,y:a*i/6+o/2})),{x:i/2,y:o/2},{x:i/2,y:-o/2},{x:-i/2,y:-o/2}]};return[...A,s,n]},ESA=Ze(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),jpe=({num_pins:t,cw:A,ccw:e,startingpin:i})=>{const o=[],n=t/4;let s=1;const r={};for(const a of i??[])r[a]=!0;!r.leftside&&!r.topside&&!r.rightside&&!r.bottomside&&(r.leftside=!0),!r.bottompin&&!r.leftpin&&!r.rightpin&&!r.toppin&&(r.leftside?r.toppin=!0:r.topside?r.rightpin=!0:r.rightside?r.bottompin=!0:r.bottomside&&(r.leftpin=!0)),r.leftside&&r.toppin?s=1:r.leftside&&r.bottompin?s=n:r.bottomside&&r.leftpin?s=n+1:r.bottomside&&r.rightpin?s=n*2:r.rightside&&r.bottompin?s=n*2+1:r.rightside&&r.toppin?s=n*3:r.topside&&r.rightpin?s=n*3+1:r.topside&&r.leftpin&&(s=n*4),o.push(-1);for(let a=0;a<t;a++)o[s]=a+1,e||!A?(s++,s>t&&(s=1)):(s--,s<1&&(s=t));return o},_j=xA({fn:v(),cc:te().default(!0).optional(),ccw:te().default(!0).optional(),startingpin:v().or(fe(ESA)).transform(t=>typeof t=="string"?t.slice(1,-1).split(","):t).pipe(fe(ESA)).optional(),num_pins:vA().optional().default(64),w:VA.optional(),h:VA.optional(),p:VA.default(VA.parse("0.5mm")),pw:VA.optional(),pl:VA.optional(),thermalpad:Zt([QA(!0),QSA]).optional(),legsoutside:te().default(!1)}),Rj=t=>{t.w&&!t.h?t.h=t.w:!t.w&&t.h&&(t.w=t.h);const A=t.num_pins/4;if(!t.p&&!t.pw&&!t.pl&&t.w){const e=A+4;t.p=t.w/e}return!t.p&&t.w&&t.h&&t.pw&&t.pl&&(t.p=(t.w-t.pl*2)/(A-1)),!t.w&&!t.h&&t.p&&(t.w=t.p*(A+4),t.h=t.w),t.p&&!t.pw&&!t.pl?(t.pw=t.p/2,t.pl=t.p/2):t.pw?t.pl||(t.pl=t.pw*(1/.6)):t.pw=t.pl*(.6/1),t},hSA=_j.transform(Rj),zpe=["left","bottom","right","top"],Xpe=t=>{const{pin_count:A,pn:e,w:i,h:o,p:n,pl:s,legsoutside:r}=t,a=A/4,g=zpe[Math.floor((e-1)/a)],I=(e-1)%a,c=n*(a-1),B=n*(a-1),l=r?s/2:-s/2;switch(g){case"left":return{x:-i/2-l,y:B/2-I*n,o:"vert"};case"bottom":return{x:-c/2+I*n,y:-o/2-l,o:"horz"};case"right":return{x:i/2+l,y:-B/2+I*n,o:"vert"};case"top":return{x:c/2-I*n,y:o/2+l,o:"horz"};default:throw new Error("Invalid pin number")}},p1=t=>{const A=hSA.parse(t),e=[],i=jpe(A),o=A.num_pins/4;for(let r=0;r<A.num_pins;r++){const{x:a,y:g,o:I}=Xpe({pin_count:A.num_pins,pn:r+1,w:A.w,h:A.h,p:A.p??.5,pl:A.pl,legsoutside:A.legsoutside});let c=A.pw,B=A.pl;I==="vert"&&([c,B]=[B,c]);const l=i[r+1];e.push(xi(l,a,g,c,B))}if(A.thermalpad)if(typeof A.thermalpad=="boolean"){const r=A.p*(o-1)+A.pw,a=A.p*(o-1)+A.pw;e.push(xi(["thermalpad"],0,0,r,a))}else e.push(xi(["thermalpad"],0,0,A.thermalpad.x,A.thermalpad.y));const n=[];for(const[r,a,g]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const I=A.w/2*a,c=A.h/2*g;let B="none",l=I,C=c;const Q=A.pw*2;i[1]===1&&r==="top-left"?B="in1":i[o*4]===1&&r==="top-left"||i[o*3+1]===1&&r==="top-right"?B="in2":i[o*3]===1&&r==="top-right"||i[o]===1&&r==="bottom-left"?B="in1":i[o+1]===1&&r==="bottom-left"?B="in2":i[o*2]===1&&r==="bottom-right"?B="in1":i[o*2+1]===1&&r==="bottom-right"&&(B="in2");const E=B==="in1"?1:-1;if(A.legsoutside){const h=B==="in1"?A.pl/2:A.pw/2,u=B==="in1"?A.pw/2:A.pl/2;l+=h*a*E,C-=u*g*E}(B==="none"||A.legsoutside)&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}`,route:[{x:I-Q*a,y:c},{x:I,y:c},{x:I,y:c-Q*g}],type:"pcb_silkscreen_path",stroke_width:.1}),(B==="in1"||B==="in2")&&!A.legsoutside&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_1`,route:[{x:I-Q*a,y:c},{x:I-Q*a/2,y:c}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_2`,route:[{x:I,y:c-Q*g/2},{x:I,y:c-Q*g}],type:"pcb_silkscreen_path",stroke_width:.1}),(B==="in1"||B==="in2")&&n.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${r}_3`,route:[{x:l-.2*-a,y:C+.2*E},{x:l,y:C},{x:l+.2*E*-a,y:C+.2},{x:l-.2*-a,y:C+.2*E}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=lo(0,A.h/2+(A.legsoutside?A.pl*1.2:.5),.3);return{circuitJson:[...e,...n,s],parameters:A}};_j.extend({}).transform(Rj);var $pe=t=>(t.legsoutside=!1,p1(t)),Afe=t=>{t.legsoutside=!0;const A=hSA.parse(t);if(!t.p)switch(t.num_pins){case 44:case 64:t.p=.8;break;case 52:t.w===14?t.p=1:t.p=.65;break;case 208:t.p=.5;break}if(!t.pl)switch(t.num_pins){case 44:case 52:case 64:t.pl=2.25;break;case 208:t.pl=1.65;break;default:t.pl=A.pl*4;break}if(!t.pw)switch(t.num_pins){case 44:case 64:t.pw=.5;break;case 52:t.w===14?t.pw=.45:t.pw=.55;break;case 208:t.pw=.3;break;default:t.pw=A.pw;break}return p1(t)};_j.extend({}).transform(Rj);var efe=t=>(t.legsoutside=!1,t.thermalpad===void 0&&(t.thermalpad=!0),p1(t)),tfe=tm({w:"3.9mm",p:"1.27mm"}),ife=t=>{const A=tfe.parse(t);return{circuitJson:RD(A),parameters:A}},ofe=tm({w:"7.1mm",p:"0.65mm",pl:"1.35mm",pw:"0.40mm",legsoutside:!0}),nfe=t=>{const A=ofe.parse(t);return{circuitJson:RD(A),parameters:A}},sfe=tm({}),rfe=t=>{const A=sfe.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:RD(A),parameters:A}},uSA=xA({fn:v(),num_pins:vA().default(3),w:v().default("1.92mm"),h:v().default("2.74mm"),pl:v().default("0.8mm"),pw:v().default("0.764mm"),p:v().default("0.95mm"),string:v().optional()}),afe=tm({p:"0.95mm",w:"1.6mm",legsoutside:!0}),gfe=t=>{const A=t.string?.match(/^sot23_(\d+)/),e=A?Number.parseInt(A[1],10):3;if(e===6||e===8){const o=afe.parse({...t,num_pins:e});return{circuitJson:RD(o),parameters:o}}const i=uSA.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:cfe(i),parameters:i};if(i.num_pins===5)return{circuitJson:pSA(i),parameters:i};throw new Error("Invalid number of pins")},Ife=t=>{const{pn:A}=t;return A===1?{x:-1.7,y:0}:A===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},cfe=t=>{const A=[];for(let i=0;i<t.num_pins;i++){const{x:o,y:n}=Ife({num_pins:t.num_pins,pn:i+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl)});A.push(xi(i+1,o,n,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h),.3);return[...A,e]},dSA=t=>{const{p:A,h:e,pn:i}=t;if(i===1)return{x:-e/2-.5,y:A};if(i===2)return{x:-e/2-.5,y:0};if(i===3)return{x:-e/2-.5,y:-A};if(i===4)return{x:e/2+.5,y:-A};if(i===5)return{x:e/2+.5,y:A};throw new Error("Invalid pin number")},pSA=t=>{const A=[];for(let c=1;c<=t.num_pins;c++){const{x:B,y:l}=dSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:c});A.push(xi(c,B,l,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=(t.num_pins+1)/2*Number.parseFloat(t.p),i=Number.parseFloat(t.h),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e/3,y:i/2+Number.parseFloat(t.p)/1.3},{x:e/3,y:i/2+Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e/3,y:-i/2-Number.parseFloat(t.p)/1.3},{x:e/3,y:-i/2-Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=lo(0,i+.3,.3),r=dSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:1});r.x=r.x-Number.parseFloat(t.pw)*1.5;const a=.7,g=.3,I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:r.x+a/2,y:r.y},{x:r.x-a/2,y:r.y+g/2},{x:r.x-a/2,y:r.y-g/2},{x:r.x+a/2,y:r.y}],stroke_width:.05};return[...A,s,o,n,I]},Bfe=uSA.extend({}),lfe=t=>{const A=Bfe.parse({...t,num_pins:5});return{circuitJson:pSA(A),parameters:A}},Cfe=[{name:"top-left",dx:-1,dy:1},{name:"top-right",dx:1,dy:1},{name:"bottom-left",dx:-1,dy:-1},{name:"bottom-right",dx:1,dy:-1}],Qfe=tm({}),Efe=t=>{const A=Qfe.parse(t),e=[];for(let c=0;c<A.num_pins;c++){const{x:B,y:l}=Fj({num_pins:A.num_pins,pn:c+1,w:A.w,p:A.p??1.27,pl:A.pl,widthincludeslegs:!0});e.push(xi(c+1,B,l,A.pl??"1mm",A.pw??"0.6mm"))}const i=Math.min(1,A.p/2),o=A.w+i,n=(A.num_pins/2-1)*A.p+A.pw+i,s=[];for(const c of Cfe){const{dx:B,dy:l}=c;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:B*o/2-B*A.p,y:l*n/2},{x:B*o/2,y:l*n/2},{x:B*o/2,y:l*n/2-l*A.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const r=A.p/4,a=-o/2-r/2,g=n/2-A.p/2;s.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:a,y:g},{x:a-r,y:g+r},{x:a-r,y:g-r},{x:a,y:g}],stroke_width:.1});const I=lo(0,n/2+.4,n/12);return{circuitJson:[...e,I,...s],parameters:A}},gK=(t,A,e,i,o,n)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circular_hole_with_rect_pad",x:A,y:e,hole_diameter:wa(i),hole_shape:"circle",pad_shape:"rect",rect_pad_width:wa(o),rect_pad_height:wa(n),pcb_port_id:"",layers:["top","bottom"],port_hints:[t.toString()]}),Nj=({fs:t,pn:A,anchor_x:e,anchor_y:i,textalign:o="center",orthogonal:n=!1,verticallyinverted:s=!1,layer:r="top"})=>{let a=0;n&&s?a=270:s?a=180:n?a=90:a=0;let g="center";return o==="left"&&(s?g="center_right":g="center_left"),o==="right"&&(s?g="center_left":g="center_right"),r==="bottom"&&(g==="center_left"?g="center_right":g==="center_right"&&(g="center_left")),{type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:`{PIN${A}}`,layer:r,anchor_position:{x:e,y:i},anchor_alignment:g,ccw_rotation:a}};function hfe({pinlabeltextalignleft:t,pinlabeltextalignright:A,pinlabelorthogonal:e}){let i="top";return e?i="left":i="top",t&&(e?i="bottom":i="right"),A&&(e?i="top":i="left"),i}var ufe=xA({fn:v(),num_pins:vA().optional().default(6),rows:Zt([v(),vA()]).transform(t=>Number(t)).optional().default(1).describe("number of rows"),p:VA.default("0.1in").describe("pitch"),id:VA.default("1.0mm").describe("inner diameter"),od:VA.default("1.5mm").describe("outer diameter"),male:te().optional().describe("for male pin headers"),female:te().optional().describe("for female pin headers"),pinlabeltextalignleft:te().optional().default(!1),pinlabeltextaligncenter:te().optional().default(!1),pinlabeltextalignright:te().optional().default(!1),pinlabelverticallyinverted:te().optional().default(!1),pinlabelorthogonal:te().optional().default(!1),nosquareplating:te().optional().default(!1).describe("do not use rectangular pad for pin 1"),nopinlabels:te().optional().default(!1).describe("omit silkscreen pin labels"),doublesidedpinlabel:te().optional().default(!1).describe("add silkscreen pins in top and bottom layers"),bottomsidepinlabel:te().optional().default(!1).describe("place the silkscreen reference text on the bottom layer instead of top")}).transform(t=>{const A=hfe(t);return{...t,pinlabelAnchorSide:A,male:t.male??!t.female,female:t.female??!1}}).superRefine((t,A)=>{t.male&&t.female&&A.addIssue({code:Wt.custom,message:"'male' and 'female' cannot both be true; it should be male or female.",path:["male","female"]})}),dfe=t=>{const A=ufe.parse(t),{p:e,id:i,od:o,rows:n,num_pins:s,pinlabelAnchorSide:r,pinlabelverticallyinverted:a,pinlabelorthogonal:g,pinlabeltextalignleft:I,pinlabeltextalignright:c,nopinlabels:B,doublesidedpinlabel:l,bottomsidepinlabel:C}=A;let Q="center";I?Q="left":c&&(Q="right");const E=[],h=Math.ceil(s/n),u=-e,d=({xoff:b,yoff:F,od:k,anchorSide:U})=>{let M=0,Y=0;const T=k*.75;switch(U){case"right":M=T;break;case"top":Y=T;break;case"bottom":Y=-T;break;case"left":M=-T;break}return{anchor_x:b+M,anchor_y:F+Y}},f=(b,F,k)=>{b===1&&!A.nosquareplating?E.push(gK(b,F,k,i,o,o)):E.push(Rn(b,F,k,i,o));const{anchor_x:U,anchor_y:M}=d({xoff:F,yoff:k,od:o,anchorSide:r});B||(C?E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"bottom"})):E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"top"})),l&&E.push(Nj({fs:o/5,pn:b,anchor_x:U,anchor_y:M,textalign:Q,orthogonal:g,verticallyinverted:a,layer:"bottom"})))},D=new Set,w=n>2&&h>2;if(n===1){const b=-((s-1)/2)*e;for(let F=0;F<s;F++){const k=F+1,U=b+F*e,M=`${U},0`;if(D.has(M))throw new Error(`Overlap at ${M}`);D.add(M),f(k,U,0)}}else if(w){const b=-((h-1)/2)*e;let F=1;for(let k=0;k<n&&F<=s;k++)for(let U=0;U<h&&F<=s;U++){const M=b+U*e,Y=k*u,T=`${M},${Y}`;if(D.has(T))throw new Error(`Overlap at ${T}`);D.add(T),f(F++,M,Y)}}else{const b=-((h-1)/2)*e;let F=1,k=0,U=n-1,M=0,Y=h-1;for(;F<=s&&k<=U&&M<=Y;){for(let T=k;T<=U&&F<=s;T++){const J=b+M*e,W=T*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}M++;for(let T=M;T<=Y&&F<=s;T++){const J=b+T*e,W=U*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}if(U--,M<=Y){for(let T=U;T>=k&&F<=s;T--){const J=b+Y*e,W=T*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}Y--}if(k<=U){for(let T=Y;T>=M&&F<=s;T--){const J=b+T*e,W=k*u,Z=`${J},${W}`;if(D.has(Z))throw new Error(`Overlap at ${Z}`);D.add(Z),f(F++,J,W)}k++}}if(F-1<s)throw new Error(`Missing pins: assigned ${F-1}, expected ${s}`)}const x=lo(0,e,.5);return{circuitJson:[...E,x],parameters:A}},pfe=tm({}),ffe=t=>{const A=pfe.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:RD(A),parameters:A}},yfe=tm({p:"1.27mm",w:"3.9mm",legsoutside:!0}),mfe=t=>{const A=yfe.parse({...t,num_pins:8});return{circuitJson:RD(A),parameters:A}},wfe=tm({p:"1.27mm",w:"7.5mm",legsoutside:!0}),Dfe=t=>{const A=wfe.parse({...t,num_pins:16});return{circuitJson:RD(A),parameters:A}},Sfe=xA({fn:v(),num_pins:QA(3).default(3),w:v().default("1.2mm"),h:v().default("1.2mm"),pl:v().default("0.3mm"),pw:v().default("0.32mm")}),bfe=t=>{const A=Sfe.parse(t),e=kfe(A),i=lo(.4,VA.parse(A.h),.2);return{circuitJson:[...e,i],parameters:A}},xfe=t=>{const{pn:A}=t;return A===1?{x:0,y:0}:A===2?{x:1,y:-.4}:{x:1,y:.4}},kfe=t=>{const A=[];for(let e=0;e<3;e++){const{x:i,y:o}=xfe({num_pins:t.num_pins,pn:e+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl)});A.push(xi(e+1,i,o,Number.parseFloat(t.pl),e!==0?Number.parseFloat(t.pw):.42))}return A},Gfe=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("2.36mm"),h:v().default("1.22mm"),pl:v().default("0.9mm"),pw:v().default("0.9mm"),p:v().default("4.19mm")}),Ffe=t=>{const A=Gfe.parse(t),e=lo(0,VA.parse(A.h)/4+.4,.3);return{circuitJson:Rfe(A).concat(e),parameters:A}},_fe=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Rfe=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=_fe({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Nfe=xA({fn:v(),p:VA.optional().default("2.54mm"),id:VA.optional().default("0.7mm"),od:VA.optional().default("1mm")}),Mfe=t=>{const A=Nfe.parse(t),{p:e,id:i,od:o}=A,n=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-e/2+o+i/2,y:0},{x:e/2-o-i/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},r=lo(0,e/4,.5);return{circuitJson:[...n,s,r],parameters:A}},IK=(t,A={})=>({type:"pcb_silkscreen_path",layer:A.layer||"top",pcb_component_id:A.pcb_component_id||"",pcb_silkscreen_path_id:A.pcb_silkscreen_path_id||"",route:t,stroke_width:A.stroke_width||.1}),vfe=xA({fn:QA("pushbutton"),w:VA.default(4.5),h:VA.default(6.5),id:VA.default(1),od:VA.default(1.2)}),Ufe=t=>{const A=vfe.parse(t),e=A.w,i=A.h,o=A.id,n=[Rn(1,-e/2,i/2,o,o*1.5),Rn(2,-e/2,-i/2,o,o*1.5),Rn(3,e/2,-i/2,o,o*1.5),Rn(4,e/2,i/2,o,o*1.5)],s=[IK([{x:-e/2,y:-i/2},{x:-e/2,y:i/2}]),IK([{x:e/2,y:-i/2},{x:e/2,y:i/2}]),IK([{x:-e/2,y:0},{x:-e/5,y:0},{x:e/5*1/Math.sqrt(2),y:i/8}]),IK([{x:e/2,y:0},{x:e/5,y:0}])],r=lo(0,i/2+.4,.5);return{circuitJson:[...n,...s,r],parameters:A}},fSA=xA({fn:v(),w:VA.default("22.58mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(2),bottom:VA.optional().default(2),p:VA.default(VA.parse("2.54mm")),pw:VA.default(VA.parse("1.6mm")),pl:VA.default(VA.parse("2.4mm")),innerhole:te().default(!1),innerholeedgedistance:VA.default(VA.parse("1.61mm")),silkscreenlabels:te().default(!1),silkscreenlabelmargin:VA.default(VA.parse("0.1mm"))}),Lfe=t=>{const A=fSA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},cK=(t,A,e)=>{let i=[];return e==="right"&&(i=[{x:t+1/2,y:A},{x:t-1/2,y:A+.6/2},{x:t-1/2,y:A-.6/2},{x:t+1/2,y:A}]),e==="left"&&(i=[{x:t-1/2,y:A},{x:t+1/2,y:A+.6/2},{x:t+1/2,y:A-.6/2},{x:t-1/2,y:A}]),e==="top"&&(i=[{x:t,y:A+1/2},{x:t-.6/2,y:A-1/2},{x:t+.6/2,y:A-1/2},{x:t,y:A+1/2}]),e==="bottom"&&(i=[{x:t,y:A-1/2},{x:t-.6/2,y:A+1/2},{x:t+.6/2,y:A+1/2},{x:t,y:A-1/2}]),i},Hfe=t=>{const A=fSA.parse(t),e=A.h??Lfe(A),i=[],o=[],n=[];let s=[];const r=1,a=r,g=A.left+A.right+(A.bottom??0)+(A.top??0),c=`pin${g}`.length*.7/2;if(A.right){const Q=-((A.right-1)/2)*A.p;for(let E=0;E<A.right;E++){if(E===0&&!A.left&&!A.bottom&&!A.silkscreenlabels&&(s=cK(A.w/2-A.pl*1.4,Q+E*A.p,"right")),i.push(xi(E+1+A.left+(A.bottom??0),A.w/2-A.pl/2,Q+E*A.p,A.pl,A.pw)),A.silkscreenlabels){const h=E+1+A.left+(A.bottom??0),u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:A.w/2-A.pl-(c+A.silkscreenlabelmargin),y:Q+E*A.p},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}A.innerhole&&(o.push(Rn(E+1+A.left+(A.bottom??0)+g,A.w/2,Q+E*A.p,r,a)),o.push(Rn(E+1+A.left+(A.bottom??0)+g*2,A.w/2-A.innerholeedgedistance,Q+E*A.p,r,a)))}}if(A.left){const Q=(A.left-1)/2*A.p;for(let E=0;E<A.left;E++){if(E===0&&!A.silkscreenlabels&&(s=cK(-A.w/2+A.pl*1.4,Q-E*A.p,"left")),i.push(xi(E+1,-A.w/2+A.pl/2,Q-E*A.p,A.pl,A.pw)),A.silkscreenlabels){const h=E+1,u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-A.w/2+A.pl+(c+A.silkscreenlabelmargin),y:Q-E*A.p},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"})}A.innerhole&&(o.push(Rn(E+1+g,-A.w/2,Q-E*A.p,r,a)),o.push(Rn(E+1+g*2,-A.w/2+A.innerholeedgedistance,Q-E*A.p,r,a)))}}if(A.top){const Q=(A.top-1)/2*A.p;for(let E=0;E<A.top;E++){if(E===0&&!A.left&&!A.bottom&&!A.right&&!A.silkscreenlabels&&(s=cK(Q-E*A.p,e/2-A.pl*1.4,"top")),i.push(xi(E+1+A.left+A.right+(A.bottom??0),Q-E*A.p,e/2-A.pl/2,A.pw,A.pl)),A.silkscreenlabels){const h=E+1+A.left+A.right+(A.bottom??0),u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:Q-E*A.p,y:e/2-A.pl-(c+A.silkscreenlabelmargin)},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:270})}A.innerhole&&(o.push(Rn(E+1+A.left+A.right+(A.bottom??0)+g,Q-E*A.p,e/2,r,a)),o.push(Rn(E+1+A.left+A.right+(A.bottom??0)+g*2,Q-E*A.p,e/2-A.innerholeedgedistance,r,a)))}}if(A.bottom){const Q=-((A.bottom-1)/2)*A.p;for(let E=0;E<A.bottom;E++){if(E===0&&!A.left&&!A.silkscreenlabels&&(s=cK(Q+E*A.p,-e/2+A.pl*1.4,"bottom")),i.push(xi(E+1+A.left,Q+E*A.p,-e/2+A.pl/2,A.pw,A.pl)),A.silkscreenlabels){const h=E+1+A.left,u=`pin${h}`;n.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${h}`,pcb_component_id:"1",layer:"top",anchor_position:{x:Q+E*A.p,y:-e/2+A.pl+(c+A.silkscreenlabelmargin)},text:u,font_size:.7,font:"tscircuit2024",anchor_alignment:"center",ccw_rotation:90})}A.innerhole&&(o.push(Rn(E+1+A.left+g,Q+E*A.p,-e/2,r,a)),o.push(Rn(E+1+A.left+g*2,Q+E*A.p,-e/2+A.innerholeedgedistance,r,a)))}}const B={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:s,stroke_width:.1,layer:"top"},l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2,y:e/2},{x:A.w/2,y:e/2},{x:A.w/2,y:-e/2},{x:-A.w/2,y:-e/2},{x:-A.w/2,y:e/2}],stroke_width:.1,layer:"top"},C=lo(0,e/1.8,e/25);return{circuitJson:[...i,...o,...n,l,...A.silkscreenlabels?[]:[B],C],parameters:A}},ySA=xA({fn:v(),w:VA.default("22.58mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(2),bottom:VA.optional().default(2),p:VA.default(VA.parse("2.54mm")),pw:VA.default(VA.parse("1.6mm")),pl:VA.default(VA.parse("3.2mm")),innerhole:te().default(!1),innerholeedgedistance:VA.default(VA.parse("1.61mm"))}),Yfe=t=>{const A=ySA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},Jfe=(t,A,e,i=1,o=.6)=>{const n=i/2,s=o/2;return{left:[{x:t+n,y:A},{x:t-n,y:A+s},{x:t-n,y:A-s},{x:t+n,y:A}],right:[{x:t-n,y:A},{x:t+n,y:A+s},{x:t+n,y:A-s},{x:t-n,y:A}],top:[{x:t,y:A-n},{x:t-s,y:A+n},{x:t+s,y:A+n},{x:t,y:A-n}],bottom:[{x:t,y:A+n},{x:t-s,y:A-n},{x:t+s,y:A-n},{x:t,y:A+n}]}[e]},Kfe=t=>{const A=ySA.parse(t),e=A.h??Yfe(A),i=[],o=[],n=[],s=1,r=1.2,a=A.left+A.right+(A.bottom??0)+(A.top??0);let g=[],I=1;if(A.left){const C=(A.left-1)/2*A.p;for(let Q=0;Q<A.left;Q++)Q===0&&(g=Jfe(-A.w/2-A.pl/2,C-Q*A.p,"left")),i.push(xi(I,-A.w/2+A.pl/2,C-Q*A.p,A.pl,A.pw)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:-A.w/2+A.pl/2-4.5,y:C-Q*A.p},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,-A.w/2+A.innerholeedgedistance,C-Q*A.p,s,r))}if(A.bottom){const C=(A.bottom-1)/2*A.p;for(let Q=A.bottom-1;Q>=0;Q--)i.push(xi(I,C-Q*A.p,-e/2+A.pl/2,A.pw,A.pl)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:C-Q*A.p,y:-e/2+A.pl/2-3.2},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,C-Q*A.p,-e/2+A.innerholeedgedistance,s,r))}if(A.right){const C=-((A.right-1)/2)*A.p;for(let Q=0;Q<A.right;Q++)i.push(xi(I,A.w/2-A.pl/2,C+Q*A.p,A.pl,A.pw)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:A.w/2-A.pl/2+3.7,y:C+Q*A.p},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,A.w/2-A.innerholeedgedistance,C+Q*A.p,s,r))}if(A.top){const C=-((A.top-1)/2)*A.p;for(let Q=A.top-1;Q>=0;Q--)i.push(xi(I,C+Q*A.p,e/2-A.pl/2,A.pw,A.pl)),o.push({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:`pin_${I}`,pcb_component_id:"1",layer:"top",anchor_position:{x:C+Q*A.p,y:e/2-A.pl/2+3.2},text:`pin${I}`,font_size:.7,font:"tscircuit2024",anchor_alignment:"center"}),I++,A.innerhole&&n.push(Rn(I+a,C+Q*A.p,e/2-A.innerholeedgedistance,s,r))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:g,stroke_width:.1},B={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2-A.pl/3,y:e/2+A.pl/3},{x:A.w/2+A.pl/3,y:e/2+A.pl/3},{x:A.w/2+A.pl/3,y:-e/2-A.pl/3},{x:-A.w/2-A.pl/3,y:-e/2-A.pl/3},{x:-A.w/2-A.pl/3,y:e/2+A.pl/3}],stroke_width:.1,layer:"top"},l=lo(0,e/1.8,e/25);return{circuitJson:[...n,...i,...o,B,c,l],parameters:A}},Tfe=t=>(t.legsoutside=!0,p1(t)),mSA=xA({fn:v(),w:VA.default("10mm"),h:VA.optional(),left:VA.optional().default(20),right:VA.optional().default(20),top:VA.optional().default(0),bottom:VA.optional().default(0),p:VA.default(VA.parse("2.54mm")),id:VA.optional().default(VA.parse("1mm")),od:VA.optional().default(VA.parse("1.5mm"))}),qfe=t=>{const A=mSA.parse(t);return A.left&&A.right?Math.max(A.left,A.right)*A.p:A.left?A.left*A.p:A.right?A.right*A.p:51},BK=(t,A,e,i=1,o=.6)=>{const n=i/2,s=o/2;return{left:[{x:t+n,y:A},{x:t-n,y:A+s},{x:t-n,y:A-s},{x:t+n,y:A}],right:[{x:t-n,y:A},{x:t+n,y:A+s},{x:t+n,y:A-s},{x:t-n,y:A}],top:[{x:t,y:A-n},{x:t-s,y:A+n},{x:t+s,y:A+n},{x:t,y:A-n}],bottom:[{x:t,y:A+n},{x:t-s,y:A-n},{x:t+s,y:A-n},{x:t,y:A+n}]}[e]},Pfe=t=>{const A=mSA.parse(t),e=A.h??qfe(A),i=[],o=A.id,n=A.od;let s=[];if(A.right){const I=-((A.right-1)/2)*A.p;for(let c=0;c<A.right;c++)c===0&&!A.left&&!A.bottom&&(s=BK(A.w/2+n*1.4,I+c*A.p,"right")),i.push(Rn(c+1+A.left+(A.bottom??0),A.w/2,I+c*A.p,o,n))}if(A.left){const I=-((A.left-1)/2)*A.p;for(let c=0;c<A.left;c++)c===A.left-1&&(s=BK(-A.w/2-n*1.4,I+c*A.p,"left")),i.push(Rn(c+1,-A.w/2,I+c*A.p,o,n))}if(A.top){const I=-((A.top-1)/2)*A.p;for(let c=0;c<A.top;c++)c===A.top-1&&!A.left&&!A.bottom&&!A.right&&(s=BK(I+c*A.p,e/2+n*1.4,"top")),i.push(Rn(c+1+A.right+(A.bottom??0)+A.left,I+c*A.p,e/2,o,n))}if(A.bottom){const I=-((A.bottom-1)/2)*A.p;for(let c=0;c<A.bottom;c++)c===0&&!A.left&&(s=BK(I+c*A.p,-e/2-n*1.4,"bottom")),i.push(Rn(c+1+A.left,I+c*A.p,-e/2,o,n))}const r={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:s,stroke_width:.1},a={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-A.w/2-n,y:e/2+n},{x:A.w/2+n,y:e/2+n},{x:A.w/2+n,y:-e/2-n},{x:-A.w/2-n,y:-e/2-n},{x:-A.w/2-n,y:e/2+n}],stroke_width:.1,layer:"top"},g=lo(0,e/1.7,e/25);return{circuitJson:[...i,a,g,r],parameters:A}},wSA=(t,A,e,i)=>Array.from({length:25},(o,n)=>{const s=n/24*Math.PI-Math.PI/2;return{x:t+(i==="right"?1:-1)*Math.cos(s)*e,y:A+Math.sin(s)*e}}),Ofe=xA({fn:v(),p:VA.optional().default("4.88mm"),id:VA.optional().default("0.6mm"),od:VA.optional().default("1.2mm"),w:VA.optional().default("5.6mm"),h:VA.optional().default("3.5mm")}),Wfe=t=>{const A=Ofe.parse(t),{p:e,id:i,od:o,w:n,h:s}=A,r=s/2,a=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],g=wSA(-n/2,0,r,"left"),I=wSA(n/2,0,r,"right"),c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...g,...g.slice(1).reverse(),{x:-n/2,y:-s/2},{x:n/2,y:-s/2},...I,{x:n/2,y:s/2},{x:-n/2,y:s/2}],stroke_width:.1,pcb_silkscreen_path_id:""},B=lo(0,e/4,.5);return{circuitJson:[...a,c,B],parameters:A}};xA({w:VA,h:VA});var Zfe=t=>{const{w:A,h:e}=t,i=wa(A),o=wa(e);return{circuitJson:[xi(1,0,0,i,o),lo(0,o/2+.5,.2)],parameters:t}},Vfe=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("1.27mm"),id:v().default("0.72mm"),od:v().default("0.95mm"),w:v().default("4.5mm"),h:v().default("4.5mm"),inline:te().default(!1),string:v().optional()}),jfe=(t,A,e)=>Array.from({length:25},(i,o)=>{const n=o/24*Math.PI;return{x:t+Math.cos(n)*e,y:A+Math.sin(n)*e}}),zfe=t=>{const{p:A,id:e,od:i,h:o}=t,n=Number.parseFloat(o)/2,s=Number.parseFloat(A);return[Rn(1,-s,n-s,e,i),Rn(2,s,n-s,e,i)]},Xfe=t=>{const A=t.string?.match(/^to92_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=Vfe.parse({...t,num_pins:e}),{p:o,id:n,od:s,w:r,h:a,inline:g}=i,I=Number.parseFloat(a)/2,c=Number.parseFloat(o);let B=[];if(i.num_pins===3)B=g?[Rn(1,-c,I-c,n,s),Rn(2,0,I-c,n,s),Rn(3,c,I-c,n,s)]:[Rn(1,0,I,n,s),Rn(2,-c,I-c,n,s),Rn(3,c,I-c,n,s)];else if(i.num_pins===2)B=zfe(i);else throw new Error("Invalid number of pins for TO-92");const l=Number.parseFloat(r)/2,C=jfe(0,I,l),Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...C,{x:-l,y:0},{x:l,y:0},C[0]],stroke_width:.1,pcb_silkscreen_path_id:""},E=lo(0,I+1,.5);return{circuitJson:[...B,Q,E],parameters:i}},$fe=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("2.15mm"),h:v().default("1.20mm"),pl:v().default("0.5mm"),pw:v().default("0.6mm"),p:v().default("1.4mm")}),A0e=t=>{const A=$fe.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:t0e(A).concat(i,e),parameters:A}},e0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},t0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=e0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},i0e=tm({}),o0e=t=>{const A=i0e.parse(t),e=[];for(let s=0;s<A.num_pins;s++){const{x:r,y:a}=Fj({num_pins:A.num_pins,pn:s+1,w:A.w,p:A.p??1.27,pl:A.pl,widthincludeslegs:!0});e.push(xi(s+1,r,a,A.pl??"1.5mm",A.pw??"0.6mm"))}const i=(A.num_pins/2-1)*A.p+A.pw,o=lo(0,i/2-.5,i/12),n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-A.w/3,y:i/2+.2},{x:A.w/3,y:i/2+.2}],stroke_width:.1};return{circuitJson:[...e,o,n],parameters:A}},n0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("5.0mm"),h:v().default("2.30mm"),pl:v().default("1.25mm"),pw:v().default("2mm"),p:v().default("3.75mm")}),s0e=t=>{const A=n0e.parse(t),e=lo(0,VA.parse(A.h)/2+1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.5,y:VA.parse(A.h)/2+.5},{x:-VA.parse(A.w)/2-.5,y:VA.parse(A.h)/2+.5},{x:-VA.parse(A.w)/2-.5,y:-VA.parse(A.h)/2-.5},{x:VA.parse(A.p)/2+.5,y:-VA.parse(A.h)/2-.5}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:a0e(A).concat(i,e),parameters:A}},r0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},a0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=r0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},g0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),p:v().default("2.9mm")}),I0e=t=>{const A=g0e.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:B0e(A).concat(i,e),parameters:A}},c0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},B0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=c0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},l0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.30mm"),h:v().default("1.80mm"),pl:v().default("0.60mm"),pw:v().default("0.45mm"),p:v().default("2.1mm")}),C0e=t=>{const A=l0e.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:E0e(A).concat(i,e),parameters:A}},Q0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},E0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Q0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},h0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.4mm"),h:v().default("0.9mm"),pl:v().default("0.35mm"),pw:v().default("0.25mm"),p:v().default("1.2mm")}),u0e=t=>{const A=h0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.15,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.4,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.4,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2+.15,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:p0e(A).concat(i,e),parameters:A}},d0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},p0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=d0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},f0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.3mm"),h:v().default("0.9mm"),pl:v().default("0.4mm"),pw:v().default("0.7mm"),p:v().default("0.7mm")}),y0e=t=>{const A=f0e.parse(t),e=lo(0,VA.parse(A.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.2,y:VA.parse(A.h)/2+.2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2+.2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2-.2},{x:VA.parse(A.p)/2+.2,y:-VA.parse(A.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:w0e(A).concat(i,e),parameters:A}},m0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},w0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=m0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},D0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3,05mm"),h:v().default("1.65mm"),pl:v().default("0.6mm"),pw:v().default("0.6mm"),pad_spacing:v().default("2.2mm")}),S0e=t=>{const A=D0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:x0e(A).concat(i,e),parameters:A}},b0e=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},x0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=b0e({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},k0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),p:v().default("2.9mm")}),G0e=t=>{const A=k0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:_0e(A).concat(i,e),parameters:A}},F0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},_0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=F0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},R0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.4mm"),h:v().default("2.1mm"),pl:v().default("0.91mm"),pw:v().default("1.22mm"),p:v().default("3.146mm")}),N0e=t=>{const A=R0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:v0e(A).concat(i,e),parameters:A}},M0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},v0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=M0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},U0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.80mm"),h:v().default("1.00mm"),pl:v().default("0.66mm"),pw:v().default("0.5mm"),p:v().default("0.8mm")}),L0e=t=>{const A=U0e.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Y0e(A).concat(i,e),parameters:A}},H0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Y0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=H0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},J0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("6.2mm"),h:v().default("3.4mm"),pl:v().default("1.4mm"),pw:v().default("2.1mm"),p:v().default("4.4mm")}),K0e=t=>{const A=J0e.parse(t),e=lo(0,VA.parse(A.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:q0e(A).concat(i,e),parameters:A}},T0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},q0e=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=T0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},P0e=xA({fn:v(),num_pins:Zt([QA(3),QA(5)]).default(3),w:v().default("4.80mm"),h:v().default("4.80mm"),pl:v().default("1.3mm"),pw:v().default("0.9mm"),p:v().default("1.5mm"),string:v().optional()}),O0e=t=>{const A=[],e=Number.parseFloat(t.p),i=Number.parseFloat(t.pw),o=Number.parseFloat(t.w),n=Number.parseFloat(t.pl);A.push(xi(1,-o/2,e,n,i),xi(2,-o/2+(1.5-1.3)/2,0,1.5,i),xi(3,-o/2,-e,n,i));const s=lo(0,0,.3),r=Number.parseFloat(t.w)/2-1,a=Number.parseFloat(t.h)/2,g={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-r,y:a},{x:r,y:a},{x:r,y:a/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},I={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-r,y:-a},{x:r,y:-a},{x:r,y:-a/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,g,I,s]},W0e=t=>{const A=[];Number.parseFloat(t.p),Number.parseFloat(t.pw),Number.parseFloat(t.w),A.push(xi(1,-1.85,-1.5,1.5,.7),xi(2,-1.85,1.5,1.5,.7),xi(3,0,0,.8,2),xi(4,1.85,-1.5,1.5,.7),xi(5,1.85,1.5,1.5,.7));const e=lo(0,Number.parseFloat(t.h)/2+.5,.3),i=Number.parseFloat(t.w)/2-1,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i,y:o}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i,y:-o}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Z0e=t=>{const A=t.string?.match(/^sot89_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=P0e.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:O0e(i),parameters:i};if(i.num_pins===5)return{circuitJson:W0e(i),parameters:i};throw new Error("Invalid number of pins for SOT89")},V0e=xA({fn:v(),p:VA.optional().default("5.0mm"),id:VA.optional().default("1.0mm"),od:VA.optional().default("1.9mm"),w:VA.optional().default("13mm"),h:VA.optional().default("7mm"),num_pins:vA().optional(),string:v().optional()}),j0e=t=>{const A=V0e.parse(t),{fn:e,id:i,od:o,w:n,h:s,string:r}=A,a=Number.parseInt(r?.split("_")[1]??"3"),g=-1,I=n/2,c=s/2,B=2.5,l=n*.4,C=Math.max(B,l/(a-1)),Q=Array.from({length:a},(D,w)=>{const x=a%2===0?(w-a/2+.5)*C:(w-Math.floor(a/2))*C;return Rn(w+1,x,g,i,o)}),E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I,y:-c},{x:I,y:-c},{x:I,y:c},{x:-I,y:c},{x:-I,y:-c}],stroke_width:.1,pcb_silkscreen_path_id:""},h=-c+2*s/3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I,y:h},{x:I,y:h}],stroke_width:.1,pcb_silkscreen_path_id:""},d=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n/6,y:h},{x:-n/6,y:c}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:n/6,y:h},{x:n/6,y:c}],stroke_width:.1,pcb_silkscreen_path_id:""}],f=lo(0,s/2+.6,.5);return{circuitJson:[...Q,E,u,...d,f],parameters:{...A,p:C}}},z0e=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("5.40mm"),h:v().default("2.30mm"),pl:v().default("1.30mm"),pw:v().default("1.70mm"),p:v().default("3.5mm")}),X0e=t=>{const A=z0e.parse(t),e=lo(0,VA.parse(A.h)/2+.4,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Aye(A).concat(i,e),parameters:A}},$0e=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Aye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=$0e({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},eye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("1.90mm"),h:v().default("1.33mm"),pl:v().default("0.5mm"),pw:v().default("0.7mm"),p:v().default("0.8mm")}),tye=t=>{const A=eye.parse(t),e=lo(0,VA.parse(A.h)+.1,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2+.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2+.1,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:oye(A).concat(i,e),parameters:A}},iye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},oye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=iye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},nye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.0mm"),h:v().default("3.35mm"),pl:v().default("1.50mm"),pw:v().default("2.70mm"),p:v().default("4.8mm")}),sye=t=>{const A=nye.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:aye(A).concat(i,e),parameters:A}},rye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},aye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=rye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},gye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.0mm"),h:v().default("1.80mm"),pl:v().default("0.80mm"),pw:v().default("1.20mm"),p:v().default("1.6mm")}),Iye=t=>{const A=gye.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bye(A).concat(i,e),parameters:A}},cye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Bye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=cye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},lye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.10mm"),h:v().default("3.40mm"),pl:v().default("2.45mm"),pw:v().default("1.80mm"),p:v().default("4.05mm")}),Cye=t=>{const A=lye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.5,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.5,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Eye(A).concat(i,e),parameters:A}},Qye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Eye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Qye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},hye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("4.80mm"),h:v().default("2.10mm"),pl:v().default("1.30mm"),pw:v().default("1.40mm"),p:v().default("2.9mm")}),uye=t=>{const A=hye.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:pye(A).concat(i,e),parameters:A}},dye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},pye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=dye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},fye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("7.30mm"),h:v().default("4.40mm"),pl:v().default("2.50mm"),pw:v().default("2.30mm"),p:v().default("4.30mm")}),yye=t=>{const A=fye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.1,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:wye(A).concat(i,e),parameters:A}},mye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},wye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=mye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Dye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("10.70mm"),h:v().default("6.60mm"),pl:v().default("3.30mm"),pw:v().default("2.50mm"),p:v().default("6.80mm")}),Sye=t=>{const A=Dye.parse(t),e=lo(0,3,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2-.8},{x:-VA.parse(A.w)/2-.8,y:VA.parse(A.h)/2-.8},{x:-VA.parse(A.w)/2-.8,y:-VA.parse(A.h)/2+.8},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:xye(A).concat(i,e),parameters:A}},bye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},xye=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=bye({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},kye=xA({fn:v(),num_pins:vA().default(4),w:v().default("8.50mm"),h:v().default("6.90mm"),pl:v().default("2mm"),pw:v().default("1.5mm"),p:v().default("2.30mm"),string:v().optional()}),Gye=t=>{const A=t.string?.match(/^sot223_(\d+)/),e=A?Number.parseInt(A[1],10):4;if(e===8){const o=Rye.parse({...t,num_pins:e});return{circuitJson:RD(o),parameters:o}}const i=kye.parse({...t,num_pins:e});if(i.num_pins===4)return{circuitJson:_ye(i),parameters:i};if(i.num_pins===5)return{circuitJson:Mye(i),parameters:i};if(i.num_pins===6)return{circuitJson:Uye(i),parameters:i};throw new Error("Invalid number of pins")},Fye=t=>{const{pn:A,w:e,p:i}=t;return A===1?{x:-e/2+1.1,y:i}:A===2?{x:-e/2+1.1,y:0}:A===3?{x:-e/2+1.1,y:-i}:{x:e/2-1.1,y:0}},_ye=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Fye({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)}),I=r===3?3.8:Number.parseFloat(t.pw);A.push(xi(r+1,a,g,Number.parseFloat(t.pl),I))}const e=lo(0,0,.3),i=Number.parseFloat(t.w)/2-2.4,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i,y:o},{x:i,y:o/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i,y:-o},{x:i,y:-o/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Rye=tm({p:"0.90mm",w:"2.8mm",legsoutside:!0}),Nye=t=>{const{p:A,pn:e,w:i}=t;if(e===1)return{x:-i/2+1.2,y:A/2+A};if(e===2)return{x:-i/2+1.2,y:A/2};if(e===3)return{x:-i/2+1.2,y:-A/2};if(e===4)return{x:-i/2+1.2,y:-A/2-A};if(e===5)return{x:i/2-1,y:0};throw new Error("Invalid pin number")},Mye=t=>{const A=[];for(let r=1;r<=t.num_pins;r++){const{x:a,y:g}=Nye({h:Number.parseFloat(t.h),p:1.5,pn:r,w:Number.parseFloat(t.w)});let I=Number.parseFloat(t.pw),c=Number.parseFloat(t.pl);r===5?(I=3.4,c=1.8):(I=1,c=2.2),A.push(xi(r,a,g,c,I))}const e=Number.parseFloat(t.w)/2-2.4,i=Number.parseFloat(t.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e,y:i},{x:e,y:i},{x:e,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e,y:-i},{x:e,y:-i},{x:e,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=lo(0,0,.3);return[...A,o,n,s]},vye=t=>{const{p:A,pn:e,w:i}=t;if(e===1)return{x:-i/2+1.2,y:2*A};if(e===2)return{x:-i/2+1.2,y:A};if(e===3)return{x:-i/2+1.2,y:0};if(e===4)return{x:-i/2+1.2,y:-A};if(e===5)return{x:-i/2+1.2,y:-2*A};if(e===6)return{x:i/2-1.175,y:0};throw new Error("Invalid pin number")},Uye=t=>{const A=[];for(let r=1;r<=t.num_pins;r++){const{x:a,y:g}=vye({h:Number.parseFloat(t.h),p:1.3,pn:r,w:8.7});let I=Number.parseFloat(t.pw),c=Number.parseFloat(t.pl);r===6?(I=3.4,c=2.15):(I=.6,c=2.2),A.push(xi(r,a,g,c,I))}const e=Number.parseFloat(t.w)/2-2.4,i=Number.parseFloat(t.h)/2,o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e,y:i},{x:e,y:i},{x:e,y:i/2+.5}],type:"pcb_silkscreen_path",stroke_width:.1},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e,y:-i},{x:e,y:-i},{x:e,y:-i/2-.5}],type:"pcb_silkscreen_path",stroke_width:.1},s=lo(0,0,.3);return[...A,o,n,s]},Lye=xA({fn:v(),num_pins:vA().default(3),w:v().default("3.40mm"),h:v().default("3.30mm"),pl:v().default("1mm"),pw:v().default("0.7mm"),p:v().default("1.2mm"),string:v().optional()}),Hye=t=>{const A=t.string?.match(/^sot23w_(\d+)/),e=A?Number.parseInt(A[1],3):3,i=Lye.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:Jye(i),parameters:i};throw new Error("Invalid number of pins")},Yye=t=>{const{pn:A,p:e}=t;return A===1?{x:-e,y:.95}:A===2?{x:-e,y:-.95}:{x:e,y:0}},Jye=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Yye({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)});A.push(xi(r+1,a,g,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h)/2+1,.3),i=Number.parseFloat(t.w)/2-1,o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o},{x:i+.3,y:o},{x:i+.3,y:o/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o},{x:i+.3,y:-o},{x:i+.3,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},Kye=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("1.27mm"),id:v().default("0.72mm"),od:v().default("0.95mm"),w:v().default("2.5mm"),h:v().default("4.2mm"),string:v().optional()}),Tye=t=>{const{p:A,id:e,od:i,w:o,h:n}=t,s=Number.parseFloat(n)/2,r=Number.parseFloat(A);return[Rn(1,-r,s-r,e,i),Rn(2,0,s-r,e,i),Rn(3,r,s-r,e,i)]},qye=t=>{const{p:A,id:e,od:i,h:o}=t,n=Number.parseFloat(o)/2,s=Number.parseFloat(A);return[Rn(1,-s,n-s,e,i),Rn(2,s,n-s,e,i)]},Pye=t=>{const A=t.string?.match(/^to92s_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=Kye.parse({...t,num_pins:e});let o=[];if(i.num_pins===3)o=Tye(i);else if(i.num_pins===2)o=qye(i);else throw new Error("Invalid number of pins for TO-92");const n=Number.parseFloat(i.h)/2,s=Number.parseFloat(i.p),r={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-n,y:n-s},{x:-1.9,y:0},{x:1.9,y:0},{x:n,y:n-s},{x:1.5,y:Number.parseFloat(i.h)/2+.5},{x:-1.5,y:Number.parseFloat(i.h)/2+.5},{x:-n,y:n-s}],stroke_width:.1,pcb_silkscreen_path_id:""},a=lo(0,n+1,.5);return{circuitJson:[...o,r,a],parameters:i}},Oye=xA({fn:v(),p:VA.optional(),id:VA.optional(),pw:VA.optional(),pl:VA.optional(),w:VA.optional(),h:VA.optional(),sh:Zt([te(),v(),vA()]).optional().transform(t=>{if(typeof t=="string"){const A=Number(t);return Number.isNaN(A)?!0:A}return t}).describe('JST SH (Surface-mount) connector family. SH stands for "Super High-density".'),ph:te().optional().describe('JST PH (Through-hole) connector family. PH stands for "Pin Header".'),string:v().optional()}),Wye={ph:{p:VA.parse("2.2mm"),id:VA.parse("0.70mm"),pw:VA.parse("1.20mm"),pl:VA.parse("1.20mm"),w:VA.parse("6mm"),h:VA.parse("5mm")},sh:{p:VA.parse("1mm"),pw:VA.parse("0.6mm"),pl:VA.parse("1.55mm"),w:VA.parse("5.8mm"),h:VA.parse("7.8mm")}};function Zye(t){return t.sh?"sh":(t.ph,"ph")}function Vye(t,A,e,i,o,n){const s=[];if(t==="ph"){const r=e/2;s.push(gK(1,-r,2,i,o,n)),s.push(gK(2,r,2,i,o,n))}else{const r=-((A-1)/2)*e;for(let g=0;g<A;g++){const I=r+g*e;console.log("x si",I),s.push(xi(g+1,I,-1.325,o,n))}const a=(A-1)/2*e+1.3;console.log("offset",a),s.push(xi(A+1,-a,1.22,1.2,1.8)),s.push(xi(A+2,a,1.22,1.2,1.8))}return s}function jye(t,A,e){return t==="ph"?{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-3,y:3},{x:3,y:3},{x:3,y:-2},{x:-3,y:-2},{x:-3,y:3}],stroke_width:.1,pcb_silkscreen_path_id:""}:{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[],stroke_width:.1,pcb_silkscreen_path_id:""}}var zye=t=>{const A=Oye.parse(t),e=Zye(A),i=Wye[e],o=A.p??i.p,n=A.id??i.id,s=A.pw??i.pw,r=A.pl??i.pl,a=A.w??i.w,g=A.h??i.h;let I=e==="sh"?4:2;if(e==="sh"){const Q=(typeof t.string=="string"?t.string:"").match(/sh(\d+)/);if(Q&&Q[1]){const E=parseInt(Q[1],10);Number.isNaN(E)||(I=E)}else typeof A.sh=="number"&&(I=A.sh)}const c=Vye(e,I,o,n,s,r),B=jye(e),l=lo(0,g/2+1,.5);return{circuitJson:[...c,B,l],parameters:{...A,p:o,id:n,pw:s,pl:r,w:a,h:g,num_pins:I,sh:e==="sh",ph:e==="ph"}}},Xye=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.30mm"),h:v().default("1.70mm"),pl:v().default("0.80mm"),pw:v().default("1mm"),p:v().default("1.90mm")}),$ye=t=>{const A=Xye.parse(t),e=lo(0,VA.parse(A.h)/2+.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:eme(A).concat(i,e),parameters:A}},Ame=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},eme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Ame({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},tme=t=>{switch(t){case 8:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"};case 10:return{w:"3.10mm",h:"3.33mm",p:"0.5mm",pl:"1.45mm",pw:"0.3mm"};default:return{w:"3.06mm",h:"3.14mm",p:"0.65mm",pl:"1.6mm",pw:"0.5mm"}}},ime=xA({fn:v(),num_pins:Zt([QA(8),QA(10)]).default(8),w:v().optional(),h:v().optional(),p:v().optional(),pl:v().optional(),pw:v().optional(),string:v().optional()}),ome=t=>{const A=ime.parse(t),e=tme(A.num_pins),i=VA.parse(A.w||e.w),o=VA.parse(A.h||e.h),n=VA.parse(A.p||e.p),s=VA.parse(A.pl||e.pl),r=VA.parse(A.pw||e.pw),a=[],g=A.num_pins/2;for(let u=0;u<A.num_pins;u++){const{x:d,y:f}=DSA(A.num_pins,u+1,i,n),D=u<g?u+1:A.num_pins-(u-g);a.push(xi(D,d,f,s,r))}const I=i,c=o,B={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I/2,y:c/2},{x:I/2,y:c/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-I/2,y:-c/2},{x:I/2,y:-c/2}],stroke_width:.05,pcb_silkscreen_path_id:""},C=DSA(A.num_pins,1,I,n),Q={x:C.x-.8,y:C.y},E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:Q.x-.4,y:Q.y},{x:Q.x-.7,y:Q.y+.3},{x:Q.x-.7,y:Q.y-.3},{x:Q.x-.4,y:Q.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},h=lo(0,c/2+.5,.3);return{circuitJson:[...a,B,l,h,E],parameters:A}},DSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse(t===8?"1.8mm":"2.2mm"),y:r*i}},nme=t=>{switch(t){case 10:return{w:"3.10mm",h:"3.32mm",p:"0.5mm",pl:"1.63mm",pw:"0.33mm"};case 12:return{w:"3mm",h:"4mm",p:"0.65mm",pl:"0.88mm",pw:"0.4mm"};case 16:return{w:"3.10mm",h:"4mm",p:"0.5mm",pl:"0.88mm",pw:"0.3mm"};default:return{w:"3.10mm",h:"3.32mm",p:"0.65mm",pl:"1.63mm",pw:"0.4mm"}}},sme=xA({fn:v(),num_pins:Zt([QA(8),QA(10),QA(12),QA(16)]).default(8),w:v().optional(),h:v().optional(),p:v().optional(),pl:v().optional(),pw:v().optional(),string:v().optional()}),SSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse("2mm"),y:r*i}},rme=t=>{const A=sme.parse(t),e=nme(A.num_pins),i=VA.parse(A.w||e.w),o=VA.parse(A.h||e.h),n=VA.parse(A.p||e.p),s=VA.parse(A.pl||e.pl),r=VA.parse(A.pw||e.pw),a=[];for(let h=0;h<A.num_pins;h++){const{x:u,y:d}=SSA(A.num_pins,h+1,i,n);a.push(xi(h+1,u,d,s,r))}const g=i,I=o,c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-g/2,y:I/2},{x:g/2,y:I/2}],stroke_width:.05,pcb_silkscreen_path_id:""},B={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-g/2,y:-I/2},{x:g/2,y:-I/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l=SSA(A.num_pins,1,g,n),C={x:l.x-.8,y:l.y},Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:C.x-.4,y:C.y},{x:C.x-.7,y:C.y+.3},{x:C.x-.7,y:C.y-.3},{x:C.x-.4,y:C.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},E=lo(0,I/2+.5,.3);return{circuitJson:[...a,c,B,E,Q],parameters:A}},ame=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.8mm"),h:v().default("1.65mm"),pl:v().default("1.2mm"),pw:v().default("1.2mm"),pad_spacing:v().default("2.6mm")}),gme=t=>{const A=ame.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:cme(A).concat(i,e),parameters:A}},Ime=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},cme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Ime({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Bme=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("3.20mm"),h:v().default("1.65mm"),pl:v().default("0.8mm"),pw:v().default("0.9mm"),pad_spacing:v().default("2.1mm")}),lme=t=>{const A=Bme.parse(t),e=lo(0,VA.parse(A.h),.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.pad_spacing)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.2,y:-VA.parse(A.h)/2},{x:VA.parse(A.pad_spacing)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Qme(A).concat(i,e),parameters:A}},Cme=t=>{const{pn:A,pad_spacing:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Qme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Cme({pn:e,pad_spacing:Number.parseFloat(t.pad_spacing)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},Eme=xA({fn:v(),num_pins:Zt([QA(6),QA(8)]).default(8),w:v().default("3mm"),h:v().default("3mm"),p:v().default("0.5mm"),pl:v().default("0.52mm"),pw:v().default("0.35mm"),epw:v().default("1.40mm"),eph:v().default("1.60mm"),string:v().optional(),ep:te().default(!1)}),hme=t=>{t.string&&t.string.includes("_ep")&&(t.ep=!0);const A=t.string?.match(/^son_(\d+)/),e=A?Number.parseInt(A[1],10):t.num_pins||8,i=Eme.parse({...t,num_pins:e}),o=VA.parse(i.w),n=VA.parse(i.h),s=VA.parse(i.p),r=VA.parse(i.pl),a=VA.parse(i.pw),g=VA.parse(i.epw),I=VA.parse(i.eph),c=[];for(let f=0;f<i.num_pins;f++){const{x:D,y:w}=bSA(i.num_pins,f+1,o,s);c.push(xi(f+1,D,w,r,a))}i.ep&&c.push(xi(i.num_pins+1,0,0,g,I));const B=o,l=n,C={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B/2,y:l/2},{x:B/2,y:l/2}],stroke_width:.05,pcb_silkscreen_path_id:""},Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-B/2,y:-l/2},{x:B/2,y:-l/2}],stroke_width:.05,pcb_silkscreen_path_id:""},E=bSA(i.num_pins,1,B,s),h={x:E.x-.4,y:E.y},u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:h.x-.4,y:h.y},{x:h.x-.7,y:h.y+.3},{x:h.x-.7,y:h.y-.3},{x:h.x-.4,y:h.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"},d=lo(0,l/2+.5,.3);return{circuitJson:[...c,C,Q,d,u],parameters:i}},bSA=(t,A,e,i)=>{const o=t/2,n=(A-1)%o,s=A<=o?-1:1,r=(o-1)/2-n;return{x:s*VA.parse("1.4mm"),y:r*i}},ume=t=>{const{num_pins:A,bridged:e,p:i=2.54,pw:o=1.5,ph:n=1.5}=t,s=VA.parse(i),r=VA.parse(o),a=VA.parse(n),g=Math.min(a/4,.5),I=[];for(let f=0;f<A;f++)I.push(xi(f+1,f*s,0,r,a));let c=[];if(e){const f=e.split("").map(Number);if(f.length>1)for(let D=0;D<f.length-1;D++){const w=f[D],x=f[D+1];if(typeof w=="number"&&typeof x=="number"&&!isNaN(w)&&!isNaN(x)){const b=(w-1)*s,F=(x-1)*s,k=Math.sign(F-b),U=b+k*(r/2),M=F-k*(r/2);c.push({type:"pcb_trace",pcb_trace_id:"",route:[{start_pcb_port_id:`{PIN${w}}`,x:U,y:0,width:g,layer:"top",route_type:"wire"},{end_pcb_port_id:`{PIN${x}}`,x:M,y:0,width:g,layer:"top",route_type:"wire"}]})}}}const B=(A-1)*s+r+.7,l=a+1,C=(A-1)*s/2,Q=0,E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"outline",route:[{x:C-B/2,y:Q-l/2},{x:C+B/2,y:Q-l/2},{x:C+B/2,y:Q+l/2},{x:C-B/2,y:Q+l/2},{x:C-B/2,y:Q-l/2}],stroke_width:.15},u=Q+l/2+.6,d=lo(C,u,.4);return{circuitJson:[...I,...c,E,d],parameters:t}},xSA={fn:QA("sot457"),num_pins:QA(6).default(6),pillh:v().default("0.45mm"),pillw:v().default("1.45mm"),pl:v(),pw:v(),p:v(),wave:te().optional(),reflow:te().optional()},dme=xA({...xSA,h:v().default("2.5mm"),w:v().default("2.7mm"),pl:v().default("0.8mm"),pw:v().default("0.55mm"),p:v().default("0.95mm")}),pme=xA({...xSA,h:v().default("3mm"),w:v().default("4mm"),pillr:v().default("0.225mm"),pl:v().default("1.45mm"),pw:v().default("1.5mm"),p:v().default("1.475mm")}).transform(t=>({...t,wave:t.wave??(t.reflow===void 0?!0:!t.reflow),reflow:t.reflow??(t.wave===void 0?!1:!t.wave)})),ND=t=>Number.parseFloat(t.replace("mm","")),kSA=({pitch:t,width:A,pinNumber:e})=>{const n={1:{x:-A/2-.1,y:t},2:{x:-A/2-.1,y:0},3:{x:-A/2-.1,y:-t},4:{x:A/2+.1,y:-t},5:{x:A/2+.1,y:0},6:{x:A/2+.1,y:t}}[e];if(!n)throw new Error(`Invalid pin number: ${e}`);return n},GSA=t=>{const A=[],e=ND(t.p),i=ND(t.pl),o=ND(t.pw),n=ND(t.w),s=ND(t.h);if(t.wave){const C={1:({padWidth:Q,padHeight:E})=>xi(1,-e,e,E,Q),2:({padWidth:Q,padHeight:E})=>xi(2,-e,-e,E,Q),3:({padWidth:Q,padHeight:E})=>aK(3,-e,0,ND(t.pillw),ND(t.pillh)),4:({padWidth:Q,padHeight:E})=>aK(4,e,0,ND(t.pillw),ND(t.pillh)),5:({padWidth:Q,padHeight:E})=>xi(5,e,e,E,Q),6:({padWidth:Q,padHeight:E})=>xi(6,e,-e,E,Q)};for(let Q=1;Q<=t.num_pins;Q++){const E=C[Q];E&&A.push(E({padWidth:i,padHeight:o}))}}else for(let C=1;C<=t.num_pins;C++){const{x:Q,y:E}=kSA({pitch:e,width:n,pinNumber:C});A.push(xi(C,Q,E,i,o))}const r={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-n/3,y:s/2+e/1.3},{x:n/3,y:s/2+e/1.3}],stroke_width:.05},a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-n/3,y:-s/2-e/1.3},{x:n/3,y:-s/2-e/1.3}],stroke_width:.05},g=lo(0,s+.5,.3),I=kSA({pitch:e,width:n,pinNumber:1}),c=t.wave?1:.5,B=t.wave?.7:.3;I.x-=t.wave?o:o*1.7;const l={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:I.x+c/2,y:I.y},{x:I.x-c/2,y:I.y+B/2},{x:I.x-c/2,y:I.y-B/2},{x:I.x+c/2,y:I.y}],stroke_width:.05};return[g,r,a,l,...A]},fme=t=>{if(t.wave){const e=pme.parse({...t,fn:"sot457"});return{circuitJson:GSA(e),parameters:e}}const A=dme.parse(t);return{circuitJson:GSA(A),parameters:A}},yme=xA({fn:v(),num_pins:Zt([QA(3),QA(2)]).default(3),p:v().default("3.8mm"),id:v().default("1.25mm"),od:v().default("2.35mm"),ca:v().default("14mm").describe("Caliper axis (width or diameter of the potentiometer body or adjustment knob)"),w:v().default("5.35mm"),h:v().default("4mm"),string:v().optional()}),mme=t=>{const{p:A,id:e,od:i,h:o,ca:n}=t,s=Number.parseFloat(o),r=Number.parseFloat(n);return[Rn(1,0,r/4+.3,e,i),Rn(2,s,0,e,i),Rn(3,0,-r/4-.3,e,i)]},wme=t=>{const A=t.string?.match(/^potentiometer_(\d+)/),e=A?Number.parseInt(A[1],10):3,i=yme.parse({...t,num_pins:e});let o=[];i.num_pins===3&&(o=mme(i));const n=Number.parseFloat(i.ca)/2+.15,s=Number.parseFloat(i.w),r=Number.parseFloat(i.od)/2+.35,a={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:n-1.75},{x:0,y:n},{x:s,y:n},{x:s,y:r}],stroke_width:.1,pcb_silkscreen_path_id:""},g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:s,y:-r},{x:s,y:-n},{x:0,y:-n},{x:0,y:-n+1.75}],stroke_width:.1,pcb_silkscreen_path_id:""},I=Number.parseFloat(i.w)/2,c=lo(I,n+1,.5);return{circuitJson:[...o,a,g,c],parameters:i}},Dme=xA({fn:v(),p:VA.optional().default("7.5mm"),id:VA.optional().default("1mm"),od:VA.optional().default("2mm"),d:VA.optional().default("10.5mm")}),Sme=(t,A,e,i,o)=>{const n=[],s=[];for(let r=0;r<=50;r++){const a=r/50*Math.PI,g=t+Math.cos(a)*e,I=A+Math.sin(a)*e;g<t-i&&I>=A-o/2&&I<=A+o/2||n.push({x:g,y:I})}for(let r=0;r<=50;r++){const a=Math.PI+r/50*Math.PI,g=t+Math.cos(a)*e,I=A+Math.sin(a)*e;g<t-i&&I>=A-o/2&&I<=A+o/2||s.push({x:g,y:I})}return{topArc:n,bottomArc:s}},bme=t=>{const A=Dme.parse(t),{p:e,id:i,od:o,d:n}=A,s=[Rn(1,-e/2,0,i,o),Rn(2,e/2,0,i,o)],{topArc:r,bottomArc:a}=Sme(0,0,n/2+.1,o/2,o),g={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:r,stroke_width:.1,pcb_silkscreen_path_id:""},I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:a,stroke_width:.1,pcb_silkscreen_path_id:""},c={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:0,y:n/2+.1},{x:0,y:-(n/2+.1)}],stroke_width:.1,pcb_silkscreen_path_id:""},B=-(n/2+.5),l=o/2+1.5,C=.5,Q={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:B-C,y:l},{x:B+C,y:l}],stroke_width:.1,pcb_silkscreen_path_id:""},E={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:B,y:l-C},{x:B,y:l+C}],stroke_width:.1,pcb_silkscreen_path_id:""},h=lo(0,n/2+1,.5);return{circuitJson:[...s,g,I,c,Q,E,h],parameters:A}},xme=xA({fn:v(),num_pins:QA(2).default(2),w:v().default("6.5mm"),h:v().default("3mm"),pl:v().default("1.75mm"),pw:v().default("2.40mm"),p:v().default("4.75mm")}),kme=t=>{const A=xme.parse(t),e=lo(0,VA.parse(A.h)-.5,.3),i={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:VA.parse(A.p)/2,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.3,y:VA.parse(A.h)/2},{x:-VA.parse(A.w)/2-.3,y:-VA.parse(A.h)/2},{x:VA.parse(A.p)/2,y:-VA.parse(A.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Fme(A).concat(i,e),parameters:A}},Gme=t=>{const{pn:A,p:e}=t;return A===1?{x:-e/2,y:0}:{x:e/2,y:0}},Fme=t=>{const A=[];for(let e=1;e<=t.num_pins;e++){const{x:i,y:o}=Gme({pn:e,p:Number.parseFloat(t.p)});A.push(xi(e,i,o,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}return A},_me=xA({fn:v(),num_pins:vA().default(3),w:v().default("2.45mm"),h:v().default("2.40mm"),pl:v().default("0.45mm"),pw:v().default("0.70mm"),p:v().default("1mm"),string:v().optional()}),Rme=t=>{const A=t.string?.match(/^sot323_(\d+)/),e=A?Number.parseInt(A[1],3):3,i=_me.parse({...t,num_pins:e});if(i.num_pins===3)return{circuitJson:Mme(i),parameters:i};throw new Error("Invalid number of pins")},Nme=t=>{const{pn:A,p:e}=t;return A===1?{x:-e,y:.65}:A===2?{x:-e,y:-.65}:{x:e,y:0}},Mme=t=>{const A=[];for(let r=0;r<t.num_pins;r++){const{x:a,y:g}=Nme({num_pins:t.num_pins,pn:r+1,w:Number.parseFloat(t.w),h:Number.parseFloat(t.h),pl:Number.parseFloat(t.pl),p:Number.parseFloat(t.p)});A.push(xi(r+1,a,g,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=lo(0,Number.parseInt(t.h)/2+1,.3),i=Number.parseFloat(t.w)/2-Number.parseFloat(t.pl),o=Number.parseFloat(t.h)/2,n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-i,y:o+.3},{x:i,y:o+.3},{x:i,y:o/2}],type:"pcb_silkscreen_path",stroke_width:.1},s={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-i,y:-o-.3},{x:i,y:-o-.3},{x:i,y:-o/2}],type:"pcb_silkscreen_path",stroke_width:.1};return[...A,n,s,e]},vme=xA({fn:v(),circle:te().optional(),rect:te().optional(),square:te().optional(),pill:te().optional(),d:VA.optional(),pd:VA.optional(),diameter:VA.optional(),r:VA.optional(),pr:VA.optional(),radius:VA.optional(),w:VA.optional(),pw:VA.optional(),width:VA.optional(),h:VA.optional(),ph:VA.optional(),height:VA.optional(),s:VA.optional(),size:VA.optional(),string:v().optional()}).transform(t=>{let A="rect";t.circle&&(A="circle"),t.square&&(A="square"),t.rect&&(A="rect"),t.pill&&(A="pill");let e,i,o;return A==="circle"?t.r!==void 0?e=wa(t.r):t.pr!==void 0?e=wa(t.pr):t.radius!==void 0?e=wa(t.radius):t.d!==void 0?e=wa(t.d)/2:t.pd!==void 0?e=wa(t.pd)/2:t.diameter!==void 0?e=wa(t.diameter)/2:e=wa("1mm")/2:(t.w!==void 0?i=wa(t.w):t.pw!==void 0?i=wa(t.pw):t.width!==void 0?i=wa(t.width):t.s!==void 0?i=wa(t.s):t.size!==void 0?i=wa(t.size):i=wa("1mm"),t.h!==void 0?o=wa(t.h):t.ph!==void 0?o=wa(t.ph):t.height!==void 0?o=wa(t.height):A==="square"||A==="rect"?o=i:o=wa("1mm")),{fn:t.fn,shape:A,radius:e,width:i,height:o}}),Ume=t=>{const A=vme.parse(t),{shape:e,radius:i,width:o,height:n}=A;let s,r;return e==="circle"?(s=lSA(1,{x:0,y:0,radius:i}),r=i+.5):e==="pill"?(s=aK(1,0,0,o,n),r=Math.max(o,n)/2+.5):(s=xi(1,0,0,o,n),r=n/2+.5),{circuitJson:[s,lo(0,r,.2)],parameters:A}},Lme=xA({fn:v(),d:VA.optional(),hd:VA.optional(),r:VA.optional(),hr:VA.optional(),pd:VA.optional(),pr:VA.optional(),squarepad:te().optional().default(!1)}).transform(t=>{let A;t.d!==void 0?A=wa(t.d):t.hd!==void 0?A=wa(t.hd):t.r!==void 0?A=wa(t.r)*2:t.hr!==void 0?A=wa(t.hr)*2:A=wa("1mm");let e;return t.pd!==void 0?e=wa(t.pd):t.pr!==void 0?e=wa(t.pr)*2:e=A*(1.5/1),{fn:t.fn,d:A,pd:e,squarepad:t.squarepad??!1}}),Hme=t=>{const A=Lme.parse(t),{d:e,pd:i,squarepad:o}=A;return{circuitJson:[o?gK(1,0,0,e,i,i):Rn(1,0,0,e,i),lo(0,i/2+.5,.2)],parameters:A}},Yme=xA({fn:v(),num_pins:QA(6).default(6),h:v().default("1.6mm"),pl:v().default("1mm"),pw:v().default("0.7mm"),p:v().default("0.95mm")}),Jme=t=>{const A=Yme.parse(t);return{circuitJson:Kme(A),parameters:A}},FSA=t=>{const{p:A,h:e,pn:i}=t;if(i===1)return{x:-e/2-.5,y:A};if(i===2)return{x:-e/2-.5,y:0};if(i===3)return{x:-e/2-.5,y:-A};if(i===4)return{x:e/2+.5,y:-A};if(i===5)return{x:e/2+.5,y:0};if(i===6)return{x:e/2+.5,y:A};throw new Error("Invalid pin number")},Kme=t=>{const A=[];for(let c=1;c<=t.num_pins;c++){const{x:B,y:l}=FSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:c});A.push(xi(c,B,l,Number.parseFloat(t.pl),Number.parseFloat(t.pw)))}const e=t.num_pins/2*Number.parseFloat(t.p),i=Number.parseFloat(t.h),o={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-e/3,y:i/2+Number.parseFloat(t.p)/1.3},{x:e/3,y:i/2+Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},n={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-e/3,y:-i/2-Number.parseFloat(t.p)/1.3},{x:e/3,y:-i/2-Number.parseFloat(t.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},s=lo(0,i+.3,.3),r=FSA({h:Number.parseFloat(t.h),p:Number.parseFloat(t.p),pn:1});r.x=r.x-Number.parseFloat(t.pw)*1.5;const a=.7,g=.3,I={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:r.x+a/2,y:r.y},{x:r.x-a/2,y:r.y+g/2},{x:r.x-a/2,y:r.y-g/2},{x:r.x+a/2,y:r.y}],stroke_width:.05};return[...A,s,o,n,I]},Tme=xA({fn:v()}),qme=t=>{const A=Tme.parse(t),e=[],i=.5-.15,o=1.5,s=.5/2,r=75,a=-37/2;for(let x=0;x<r;x++){const b=x+1;if(b>=24&&b<=31)continue;const F=a-x*s,k=b%2===0,U=o+(k?.25:0),Y=.5-U/2,T=xi(b,Y,F,U,i);T.layer=k?"bottom":"top",e.push(T)}const g=46*.0254,I=137*.0254,c=261*.0254,B={type:"pcb_cutout",pcb_cutout_id:"",shape:"rect",center:{x:-I/2+o/2,y:a-c},width:I,height:g},l={x:-.5,y:a},C={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"pin_marker_1",route:[{x:l.x-.4,y:l.y},{x:l.x-.7,y:l.y+.3},{x:l.x-.7,y:l.y-.3},{x:l.x-.4,y:l.y}],stroke_width:.05,pcb_silkscreen_path_id:"pin_marker_1"};let Q=1/0,E=-1/0,h=1/0,u=-1/0;const d=(x,b,F=0,k=0)=>{Q=Math.min(Q,x-F/2),E=Math.max(E,x+F/2),h=Math.min(h,b-k/2),u=Math.max(u,b+k/2)};for(const x of e)d(x.x,x.y,x.width,x.height);d(B.center.x,B.center.y,B.width,B.height);for(const x of C.route)d(x.x,x.y);const f=(Q+E)/2,D=(h+u)/2,w=x=>{typeof x.x=="number"&&(x.x-=f),typeof x.y=="number"&&(x.y-=D),x.center&&(x.center.x-=f,x.center.y-=D),Array.isArray(x.route)&&(x.route=x.route.map(b=>({x:b.x-f,y:b.y-D})))};for(const x of e)w(x);return w(B),w(C),{circuitJson:[...e,B,C],parameters:A}};function Pme(t){return t!=null}var Ome=(t,A)=>{if(!A)return t;const e=t.filter(I=>I.type==="pcb_smtpad"||I.type==="pcb_plated_hole"||I.type==="pcb_thtpad");if(e.length===0)return t;let i=1/0,o=-1/0,n=1/0,s=-1/0;const r=(I,c,B=0,l=0)=>{const C=I-B/2,Q=I+B/2,E=c-l/2,h=c+l/2;i=Math.min(i,C),o=Math.max(o,Q),n=Math.min(n,E),s=Math.max(s,h)};for(const I of e)if(I.type==="pcb_smtpad"){const c=I.shape==="circle"?I.radius*2:I.width,B=I.shape==="circle"?I.radius*2:I.height;r(I.x,I.y,c,B)}else if(I.type==="pcb_plated_hole"){const c=I.outer_diameter??I.hole_diameter;r(I.x,I.y,c,c)}else if(I.type==="pcb_thtpad"){const c=I.diameter;r(I.x,I.y,c,c)}let a=0,g=0;switch(A){case"center":a=(i+o)/2,g=(n+s)/2;break;case"bottomleft":a=i,g=n;break;case"bottomcenter":case"centerbottom":a=(i+o)/2,g=n;break;case"topcenter":case"centertop":a=(i+o)/2,g=s;break;case"leftcenter":case"centerleft":a=i,g=(n+s)/2;break;case"rightcenter":case"centerright":a=o,g=(n+s)/2;break;case"pin1":const I=e.find(c=>c.port_hints?.[0]==="1")||e[0];a=I.x,g=I.y;break}if(a===0&&g===0)return t;for(const I of t){if(typeof I.x=="number"&&(I.x-=a),typeof I.y=="number"&&(I.y-=g),I.center&&typeof I.center.x=="number"&&(I.center.x-=a,I.center.y-=g),I.type==="pcb_silkscreen_path")for(const c of I.route)c.x-=a,c.y-=g;I.type==="pcb_silkscreen_text"&&I.anchor_position&&(I.anchor_position.x-=a,I.anchor_position.y-=g)}return t},Wme=t=>{let A=lK();const i=t.replace(/^((?:\d{4}|\d{5}))(?=$|_)/,"res$1").split(/_(?!metric)/).map(o=>{const n=o.match(/([a-z]+)([\(\d\.\+\?].*)?/);if(!n)return null;const[,s,r]=n;return!s||r?.includes("?")?null:{fn:s,v:r}}).filter(Pme);for(const{fn:o,v:n}of i)A=A[o](n);return A.setString(t),A},Zme=()=>Object.keys(_D),lK=()=>{const t=new Proxy({},{get:(A,e)=>{if(e==="soup"||e==="circuitJson"){if("fn"in A&&_D[A.fn])return()=>{const{circuitJson:i}=_D[A.fn](A);return Ome(i,A.origin)};if(!_D[A.fn])throw new Error(`Invalid footprint function, got "${A.fn}"${A.string?`, from string "${A.string}"`:""}`);return()=>{throw new Error(`No function found for footprinter, make sure to specify .dip, .lr, .p, etc. Got "${e}"`)}}if(e==="json"){if(!_D[A.fn])throw new Error(`Invalid footprint function, got "${A.fn}"${A.string?`, from string "${A.string}"`:""}`);return()=>_D[A.fn](A).parameters}return e==="getFootprintNames"?()=>Object.keys(_D):e==="params"?()=>A:e==="setString"?i=>(A.string=i,t):i=>(Object.keys(A).length===0?`${e}${i}`in _D?(A[`${e}${i}`]=!0,A.fn=`${e}${i}`):(A[e]=!0,A.fn=e,e==="res"||e==="cap"?i&&(typeof i=="string"&&i.includes("_metric")?A.metric=i.split("_metric")[0]:A.imperial=i):A.num_pins=Number.isNaN(Number.parseFloat(i))?void 0:Number.parseFloat(i)):!i&&["w","h","p"].includes(e)||(A[e]=i??!0),t)}});return t};lK.string=Wme,lK.getFootprintNames=Zme;var Mj=lK;function Ie(t,A){return Array.isArray(A)?[t.a*A[0]+t.c*A[1]+t.e,t.b*A[0]+t.d*A[1]+t.f]:{x:t.a*A.x+t.c*A.y+t.e,y:t.b*A.x+t.d*A.y+t.f}}function Vme(t,A){return A.map(e=>Ie(t,e))}function _SA(t){return{a:parseFloat(t.a),b:parseFloat(t.b),c:parseFloat(t.c),d:parseFloat(t.d),e:parseFloat(t.e),f:parseFloat(t.f)}}const jme=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function CK(t){const A=t.match(jme);if(A===null||A.length<7)throw new Error(`'${t}' is not a matrix`);return{a:parseFloat(A[1]),b:parseFloat(A[2]),c:parseFloat(A[3]),d:parseFloat(A[4]),e:parseFloat(A[5]),f:parseFloat(A[6])}}function ug(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function ty(t){const{a:A,b:e,c:i,d:o,e:n,f:s}=t,r=A*o-e*i;return{a:o/r,b:e/-r,c:i/-r,d:A/r,e:(o*n-i*s)/-r,f:(e*n-A*s)/r}}function f1(t){return typeof t>"u"}function D_(t){return typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t)}function zme(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Xme(t){return zme(t)&&"a"in t&&D_(t.a)&&"b"in t&&D_(t.b)&&"c"in t&&D_(t.c)&&"d"in t&&D_(t.d)&&"e"in t&&D_(t.e)&&"f"in t&&D_(t.f)}function Zi(t,A=0){return{a:1,c:0,e:t,b:0,d:1,f:A}}function S_(...t){t=Array.isArray(t[0])?t[0]:t;const A=(e,i)=>({a:e.a*i.a+e.c*i.b,c:e.a*i.c+e.c*i.d,e:e.a*i.e+e.c*i.f+e.e,b:e.b*i.a+e.d*i.b,d:e.b*i.c+e.d*i.d,f:e.b*i.e+e.d*i.f+e.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return A(t[0],t[1]);default:{const[e,i,...o]=t,n=A(e,i);return S_(n,...o)}}}function Ki(...t){return S_(...t)}const{cos:$me,sin:Awe,PI:ewe}=Math;function JI(t,A,e){const i=$me(t),o=Awe(t),n={a:i,c:-o,e:0,b:o,d:i,f:0};return f1(A)||f1(e)?n:S_([Zi(A,e),n,Zi(-A,-e)])}function y1(t,A=void 0,e=void 0){return JI(t*ewe/180,A,e)}function Da(t,A=void 0,e=void 0,i=void 0){f1(A)&&(A=t);const o={a:t,c:0,e:0,b:0,d:A,f:0};return f1(e)||f1(i)?o:S_([Zi(e,i),o,Zi(-e,-i)])}function RSA(t,A){return{a:1,c:t,e:0,b:A,d:1,f:0}}const{tan:NSA}=Math;function MSA(t,A){return{a:1,c:NSA(t),e:0,b:NSA(A),d:1,f:0}}function vj(t,A){return MSA(t*Math.PI/180,A*Math.PI/180)}function twe(t){return uu(t)}function vSA(t){return uu(t)}function uu(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function USA(t,A=1e10){return{a:Math.round(t.a*A)/A,b:Math.round(t.b*A)/A,c:Math.round(t.c*A)/A,d:Math.round(t.d*A)/A,e:Math.round(t.e*A)/A,f:Math.round(t.f*A)/A}}function LSA(t,A){const e=t[0].x!=null?t[0].x:t[0][0],i=t[0].y!=null?t[0].y:t[0][1],o=A[0].x!=null?A[0].x:A[0][0],n=A[0].y!=null?A[0].y:A[0][1],s=t[1].x!=null?t[1].x:t[1][0],r=t[1].y!=null?t[1].y:t[1][1],a=A[1].x!=null?A[1].x:A[1][0],g=A[1].y!=null?A[1].y:A[1][1],I=t[2].x!=null?t[2].x:t[2][0],c=t[2].y!=null?t[2].y:t[2][1],B=A[2].x!=null?A[2].x:A[2][0],l=A[2].y!=null?A[2].y:A[2][1],C={a:e-I,b:i-c,c:s-I,d:r-c,e:I,f:c},Q={a:o-B,b:n-l,c:a-B,d:g-l,e:B,f:l},E=ty(C),h=S_([Q,E]);return USA(h)}function iwe(t){return Array.isArray(t)?t.map(A):A(t);function A(e){switch(e.type){case"matrix":if("a"in e&&"b"in e&&"c"in e&&"d"in e&&"e"in e&&"f"in e)return _SA(e);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in e))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in e?Zi(e.tx,e.ty):Zi(e.tx);case"scale":if(!("sx"in e))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in e?Da(e.sx,e.sy):Da(e.sx);case"rotate":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in e&&"cy"in e?y1(e.angle,e.cx,e.cy):y1(e.angle);case"skewX":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return vj(e.angle,0);case"skewY":if(!("angle"in e))throw new Error("MISSING_MANDATORY_PARAM");return vj(0,e.angle);case"shear":if(!("shx"in e&&"shy"in e))throw new Error("MISSING_MANDATORY_PARAM");return RSA(e.shx,e.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function owe(t,A){function e(){this.constructor=t}e.prototype=A.prototype,t.prototype=new e}function b_(t,A,e,i){var o=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(o,b_.prototype),o.expected=A,o.found=e,o.location=i,o.name="SyntaxError",o}owe(b_,Error);function Uj(t,A,e){return e=e||" ",t.length>A?t:(A-=t.length,e+=e.repeat(A),t+e.slice(0,A))}b_.prototype.format=function(t){var A="Error: "+this.message;if(this.location){var e=null,i;for(i=0;i<t.length;i++)if(t[i].source===this.location.source){e=t[i].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,n=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(o):o,s=this.location.source+":"+n.line+":"+n.column;if(e){var r=this.location.end,a=Uj("",n.line.toString().length," "),g=e[o.line-1],I=o.line===r.line?r.column:g.length+1,c=I-o.column||1;A+=`
240
240
  --> `+s+`
241
241
  `+a+` |
242
242
  `+n.line+" | "+g+`
@@ -5602,7 +5602,7 @@ test("${g} should solve problem correctly", () => {
5602
5602
  // Add more specific assertions based on expected output
5603
5603
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5604
5604
  })
5605
- `,c=new Blob([I],{type:"text/plain"}),B=URL.createObjectURL(c),l=document.createElement("a");l.href=B,l.download=`${g}.test.ts`,l.click(),URL.revokeObjectURL(B)}catch(a){alert(`Error generating test.ts for ${t.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return O.jsxs("div",{className:`relative ${A}`,ref:o,children:[O.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!e),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),e&&O.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:n,children:"Download JSON"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},Moe=t=>t.activeSubSolver?[t,...Moe(t.activeSubSolver)]:[t],JJt=({solver:t})=>{const A=Moe(t);return O.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((e,i)=>O.jsxs("div",{className:"flex items-center",children:[i>0&&O.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),O.jsx(YJt,{solver:e})]},e.constructor.name))})},KJt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=z.useReducer(Q=>!Q,!1),r=z.useRef(void 0),a=()=>{!t.solved&&!t.failed&&(t.step(),A())},g=()=>{!t.solved&&!t.failed&&(i&&i(t),t.solve(),A(),o&&o(t))},I=()=>{n?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(t.solved||t.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),o&&t.solved&&o(t);return}t.step(),A()},e))},c=()=>{const Q=t;if(Q.getCurrentPhase&&!t.solved&&!t.failed){const E=Q.getCurrentPhase();for(;Q.getCurrentPhase()===E&&!t.solved&&!t.failed;)t.step();A()}},B=()=>{if(t.solved||t.failed||n)return;const Q=window.prompt("Step until which iteration?",`${t.iterations}`);if(Q===null)return;const E=Number(Q);if(!Number.isFinite(E)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<E&&!t.solved&&!t.failed;)t.step();A(),t.solved&&o&&o(t)};z.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),z.useEffect(()=>{(t.solved||t.failed)&&n&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[t.solved,t.failed,n]);const l=t.getCurrentPhase!==void 0,C=l?t.getCurrentPhase():null;return O.jsxs("div",{className:"space-y-2 p-2 border-b",children:[O.jsx("div",{className:"flex items-center",children:O.jsx(JJt,{solver:t})}),O.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[O.jsx("button",{onClick:a,disabled:t.solved||t.failed||n,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),O.jsx("button",{onClick:g,disabled:t.solved||t.failed||n,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),O.jsx("button",{onClick:I,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${n?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:n?"Stop":"Animate"}),O.jsx("button",{onClick:B,disabled:t.solved||t.failed||n,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),l&&O.jsx("button",{onClick:c,disabled:t.solved||t.failed||n,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),O.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),C&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",O.jsx("span",{className:"font-medium",children:C})]}),t.solved&&O.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&O.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&O.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},TJt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},qJt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=TJt(t,A),n=t[i],s=t.firstIterationOfPhase?.[i]??null,r=t.iterations;let a=0;if(o==="Completed"){const B=t.pipelineDef[A+1],l=B?t.firstIterationOfPhase?.[B.solverName]:void 0;l!==void 0&&s!==null?a=l-s:s!==null&&(a=r-s)}else o==="In Progress"&&s!==null&&(a=r-s);const g=t.timeSpentOnPhase?.[i]??0;let I=0;o==="Completed"?I=1:o==="In Progress"&&n&&(I=n.progress??0);const c=n?.stats??null;return{index:A,name:i,status:o,firstIteration:s,iterations:a,progress:I,timeSpent:g,stats:c&&Object.keys(c).length>0?c:null,solverInstance:n??null}},PJt=({status:t})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return O.jsx("span",{className:`font-medium ${A[t]}`,children:t})},OJt=({progress:t})=>{if(t===0)return null;const A=Math.round(t*100);return O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),O.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},WJt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),ZJt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=WJt(t);return O.jsxs("details",{className:"cursor-pointer",children:[O.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:e}),O.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,o])=>O.jsxs("div",{children:[i,": ",String(o)]},i))})]})},DhA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(DhA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=DhA(i));return A},VJt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=DhA(t.getConstructorParams()),i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),o=URL.createObjectURL(i),n=document.createElement("a");n.href=o,n.download=`${A}_input.json`,n.click(),URL.revokeObjectURL(o)}catch(e){alert(`Error downloading input for ${A}: ${e instanceof Error?e.message:String(e)}`)}},jJt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>qJt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):VJt(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return O.jsxs("div",{className:"border-t border-gray-200",children:[O.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:O.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),O.jsx("div",{className:"overflow-x-auto",children:O.jsxs("table",{className:"w-full text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),O.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",O.jsx("sub",{children:"0"})]}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),O.jsx("tbody",{children:i.map(r=>O.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[O.jsx("td",{className:"px-4 py-2",children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),O.jsx("button",{onClick:()=>o(r.name),disabled:r.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),O.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(PJt,{status:r.status})}),O.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(OJt,{progress:r.progress})}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),O.jsx("td",{className:"px-4 py-2 text-gray-500",children:O.jsx(ZJt,{stats:r.stats})}),O.jsx("td",{className:"px-4 py-2",children:r.solverInstance?O.jsxs("button",{onClick:()=>n(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),O.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},zJt=class extends eo.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function XJt({graphics:t}){const A=t.points??[],e=t.lines??[],i=t.rects??[],o=t.circles??[],n=t.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const I=(E,h)=>{typeof E=="number"&&(E<s&&(s=E),E>a&&(a=E)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const E of A)I(E.x,E.y);for(const E of e){const h=E.points??[];for(const u of h)I(u.x,u.y)}for(const E of i){const h=E.x??0,u=E.y??0,d=E.width??0,f=E.height??0;I(h,u),I(h+d,u+f)}for(const E of o){const h=E.x??0,u=E.y??0,d=E.radius??1;I(h-d,u-d),I(h+d,u+d)}for(const E of n)I(E.x,E.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const c=10,B=s-c,l=r-c,C=Math.max(1,a-s+2*c),Q=Math.max(1,g-r+2*c);return O.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${B} ${l} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((E,h)=>O.jsx("rect",{x:E.x??0,y:E.y??0,width:E.width??0,height:E.height??0,fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`rect-${h}`)),e.map((E,h)=>O.jsx("polyline",{fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1,points:(E.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),o.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.fillColor??"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`circle-${h}`)),A.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.color??"black"},`point-${h}`)),n.map((E,h)=>O.jsx("text",{x:E.x??0,y:E.y??0,fontSize:E.fontSize??10,fill:E.color??"black",children:E.text??""},`text-${h}`))]})}var $Jt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=z.useReducer(I=>I+1,0),s=z.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=z.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);z.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const I=document.createElement("script");I.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(I)}},[]);const a=t.pipelineDef!==void 0,g=I=>{const c=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&c.currentPipelineStepIndex<=c.pipelineDef.findIndex(B=>B.solverName===I);)t.step();n()}};return O.jsxs("div",{children:[O.jsx(KJt,{solver:t,triggerRender:n,animationSpeed:A,onSolverStarted:e,onSolverCompleted:i}),r?O.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):O.jsx(zJt,{fallback:O.jsx(XJt,{graphics:s}),children:O.jsx(HJt,{graphics:s})}),a&&O.jsx(jJt,{solver:t,onStepUntilPhase:g})]})};const AKt=()=>{z.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const e=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),e)return;const i=document.createElement("script");i.id=t,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},eKt=t=>t.toLowerCase().includes("pack")?pSt:t.toLowerCase().includes("rout")?wSt:iSt,tKt=({solverEvents:t=[]})=>{const[A,e]=z.useState(null);AKt();const i=z.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=z.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=z.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=GvA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(GvA).join(", ")}`,classFound:!1};try{const a=n.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[n]);return t.length===0?O.jsx("div",{className:"rf-p-4",children:O.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:O.jsxs("div",{className:"rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),O.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):O.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[O.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[O.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[o.length," ",o.length===1?"Solver":"Solvers"]}),o.map(r=>{const a=i.get(r),g=A===r;return O.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>e(r),children:(()=>{const I=eKt(a.solverName);return O.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[O.jsx(I,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),O.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[O.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),O.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),O.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:n?s.instance?O.jsx(Fm,{fallback:O.jsx("div",{className:"rf-p-4",children:O.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),O.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",n.solverName]})]})}),children:O.jsx($Jt,{solver:s.instance})}):O.jsxs("div",{className:"rf-p-4",children:[O.jsxs("div",{className:"rf-mb-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:n.solverName}),O.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",n.componentName]})]}),s.error&&O.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:O.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),O.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[O.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:O.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),O.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:O.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(n.solverParams,null,2)})})]})]}):O.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:O.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},voe=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{z.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{B3.captureException(i)}catch{}}},[t,A]),z.useEffect(()=>{if(e&&e.length>0)for(const i of e){const o=new Error(i.message||"Circuit JSON Error");i.stack&&(o.stack=i.stack);try{B3.captureException(o,{error_type:i.type})}catch{}}},[e])},Uoe="0.0.1420",iKt={version:Uoe},XW=qvA()(PvA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),oKt=t=>{const[A,e]=z.useState([]),[i,o]=z.useState(null),[n,s]=z.useState(""),[r,a]=KM("eval-version-selection",null),g=XW(l=>l.setLastRunEvalVersion),I=XW(l=>l.lastRunEvalVersion);return z.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(l=>l.json()).then(l=>{if(Array.isArray(l?.versions)){let C=[...l.versions];l.tags?.latest&&(o(l.tags.latest),C=C.filter(Q=>Q!==l.tags.latest)),e(C)}}).catch(()=>{})},[t]),z.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:z.useMemo(()=>A.filter(l=>l.includes(n)).slice(0,50),[A,n]),latestVersion:i,lastRunEvalVersion:I,search:n,setSearch:s,selectVersion:l=>{a(l),s("")}}},nKt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=z.useState(""),[s,r]=z.useState("");if(!i)return null;const a=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),g=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(a.length===1?n(a[0]):g&&n(s))};return O.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:O.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[O.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),O.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:c=>r(c.target.value),onKeyDown:I}),O.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(c=>O.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${o===c?"bg-blue-50":""}`,onClick:()=>n(c),children:c},c)),g&&O.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${o===s?"bg-blue-50":""}`,onClick:()=>n(s),children:['Create new "',s,'"']})]}),O.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>o&&A(o),disabled:!o,children:o===s?`Create "${o}"`:`Save to ${o}`})]})]})})},sKt=t=>{const A=z.useRef(null),e=Jc(i=>i.recentEvents);z.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};function rKt(t){const A=aKt(t),e=z.forwardRef((i,o)=>{const{children:n,...s}=i,r=z.Children.toArray(n),a=r.find(IKt);if(a){const g=a.props.children,I=r.map(c=>c===a?z.Children.count(g)>1?z.Children.only(null):z.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:z.isValidElement(g)?z.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function aKt(t){const A=z.forwardRef((e,i)=>{const{children:o,...n}=e;if(z.isValidElement(o)){const s=BKt(o),r=cKt(n,o.props);return o.type!==z.Fragment&&(r.ref=i?Kp(i,s):s),z.cloneElement(o,r)}return z.Children.count(o)>1?z.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var gKt=Symbol("radix.slottable");function IKt(t){return z.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gKt}function cKt(t,A){const e={...A};for(const i in A){const o=t[i],n=A[i];/^on[A-Z]/.test(i)?o&&n?e[i]=(...r)=>{const a=n(...r);return o(...r),a}:o&&(e[i]=o):i==="style"?e[i]={...o,...n}:i==="className"&&(e[i]=[o,n].filter(Boolean).join(" "))}return{...t,...e}}function BKt(t){let A=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning;return e?t.ref:(A=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var $W="Dialog",[Loe,Hoe]=dw($W),[lKt,Um]=Loe($W),Yoe=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=z.useRef(null),a=z.useRef(null),[g,I]=BG({prop:i,defaultProp:o??!1,onChange:n,caller:$W});return O.jsx(lKt,{scope:A,triggerRef:r,contentRef:a,contentId:yu(),titleId:yu(),descriptionId:yu(),open:g,onOpenChange:I,onOpenToggle:z.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};Yoe.displayName=$W;var Joe="DialogTrigger",Koe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(Joe,e),n=mB(A,o.triggerRef);return O.jsx(pg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xhA(o.open),...i,ref:n,onClick:Cn(t.onClick,o.onOpenToggle)})});Koe.displayName=Joe;var ShA="DialogPortal",[CKt,Toe]=Loe(ShA,{forceMount:void 0}),qoe=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Um(ShA,A);return O.jsx(CKt,{scope:A,forceMount:e,children:z.Children.map(i,s=>O.jsx(gy,{present:e||n.open,children:O.jsx(u8,{asChild:!0,container:o,children:s})}))})};qoe.displayName=ShA;var AZ="DialogOverlay",Poe=z.forwardRef((t,A)=>{const e=Toe(AZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Um(AZ,t.__scopeDialog);return n.modal?O.jsx(gy,{present:i||n.open,children:O.jsx(EKt,{...o,ref:A})}):null});Poe.displayName=AZ;var QKt=rKt("DialogOverlay.RemoveScroll"),EKt=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(AZ,e);return O.jsx(S8,{as:QKt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(pg.div,{"data-state":xhA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),fF="DialogContent",Ooe=z.forwardRef((t,A)=>{const e=Toe(fF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Um(fF,t.__scopeDialog);return O.jsx(gy,{present:i||n.open,children:n.modal?O.jsx(hKt,{...o,ref:A}):O.jsx(uKt,{...o,ref:A})})});Ooe.displayName=fF;var hKt=z.forwardRef((t,A)=>{const e=Um(fF,t.__scopeDialog),i=z.useRef(null),o=mB(A,e.contentRef,i);return z.useEffect(()=>{const n=i.current;if(n)return iQA(n)},[]),O.jsx(Woe,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Cn(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:Cn(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:Cn(t.onFocusOutside,n=>n.preventDefault())})}),uKt=z.forwardRef((t,A)=>{const e=Um(fF,t.__scopeDialog),i=z.useRef(!1),o=z.useRef(!1);return O.jsx(Woe,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{t.onCloseAutoFocus?.(n),n.defaultPrevented||(i.current||e.triggerRef.current?.focus(),n.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:n=>{t.onInteractOutside?.(n),n.defaultPrevented||(i.current=!0,n.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=n.target;e.triggerRef.current?.contains(s)&&n.preventDefault(),n.detail.originalEvent.type==="focusin"&&o.current&&n.preventDefault()}})}),Woe=z.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Um(fF,e),a=z.useRef(null),g=mB(A,a);return LCA(),O.jsxs(O.Fragment,{children:[O.jsx(s8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(n8,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":xhA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(pKt,{titleId:r.titleId}),O.jsx(yKt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),bhA="DialogTitle",Zoe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(bhA,e);return O.jsx(pg.h2,{id:o.titleId,...i,ref:A})});Zoe.displayName=bhA;var Voe="DialogDescription",joe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(Voe,e);return O.jsx(pg.p,{id:o.descriptionId,...i,ref:A})});joe.displayName=Voe;var zoe="DialogClose",Xoe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(zoe,e);return O.jsx(pg.button,{type:"button",...i,ref:A,onClick:Cn(t.onClick,()=>o.onOpenChange(!1))})});Xoe.displayName=zoe;function xhA(t){return t?"open":"closed"}var $oe="DialogTitleWarning",[dKt,Ane]=g5e($oe,{contentName:fF,titleName:bhA,docsSlug:"dialog"}),pKt=({titleId:t})=>{const A=Ane($oe),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5605
+ `,c=new Blob([I],{type:"text/plain"}),B=URL.createObjectURL(c),l=document.createElement("a");l.href=B,l.download=`${g}.test.ts`,l.click(),URL.revokeObjectURL(B)}catch(a){alert(`Error generating test.ts for ${t.constructor.name}: ${a instanceof Error?a.message:String(a)}`)}i(!1)};return O.jsxs("div",{className:`relative ${A}`,ref:o,children:[O.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>i(!e),title:`Download options for ${t.constructor.name}`,children:t.constructor.name}),e&&O.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:n,children:"Download JSON"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),O.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download test.ts"})]})]})},Moe=t=>t.activeSubSolver?[t,...Moe(t.activeSubSolver)]:[t],JJt=({solver:t})=>{const A=Moe(t);return O.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((e,i)=>O.jsxs("div",{className:"flex items-center",children:[i>0&&O.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),O.jsx(YJt,{solver:e})]},e.constructor.name))})},KJt=({solver:t,triggerRender:A,animationSpeed:e=25,onSolverStarted:i,onSolverCompleted:o})=>{const[n,s]=z.useReducer(Q=>!Q,!1),r=z.useRef(void 0),a=()=>{!t.solved&&!t.failed&&(t.step(),A())},g=()=>{!t.solved&&!t.failed&&(i&&i(t),t.solve(),A(),o&&o(t))},I=()=>{n?(r.current&&(clearInterval(r.current),r.current=void 0),s()):(s(),r.current=setInterval(()=>{if(t.solved||t.failed){r.current&&(clearInterval(r.current),r.current=void 0),s(),A(),o&&t.solved&&o(t);return}t.step(),A()},e))},c=()=>{const Q=t;if(Q.getCurrentPhase&&!t.solved&&!t.failed){const E=Q.getCurrentPhase();for(;Q.getCurrentPhase()===E&&!t.solved&&!t.failed;)t.step();A()}},B=()=>{if(t.solved||t.failed||n)return;const Q=window.prompt("Step until which iteration?",`${t.iterations}`);if(Q===null)return;const E=Number(Q);if(!Number.isFinite(E)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<E&&!t.solved&&!t.failed;)t.step();A(),t.solved&&o&&o(t)};z.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]),z.useEffect(()=>{(t.solved||t.failed)&&n&&(r.current&&(clearInterval(r.current),r.current=void 0),s())},[t.solved,t.failed,n]);const l=t.getCurrentPhase!==void 0,C=l?t.getCurrentPhase():null;return O.jsxs("div",{className:"space-y-2 p-2 border-b",children:[O.jsx("div",{className:"flex items-center",children:O.jsx(JJt,{solver:t})}),O.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[O.jsx("button",{onClick:a,disabled:t.solved||t.failed||n,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),O.jsx("button",{onClick:g,disabled:t.solved||t.failed||n,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),O.jsx("button",{onClick:I,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${n?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:n?"Stop":"Animate"}),O.jsx("button",{onClick:B,disabled:t.solved||t.failed||n,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),l&&O.jsx("button",{onClick:c,disabled:t.solved||t.failed||n,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Next Stage"}),O.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),C&&O.jsxs("div",{className:"text-sm text-gray-600",children:["Phase: ",O.jsx("span",{className:"font-medium",children:C})]}),t.solved&&O.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&O.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&O.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},TJt=(t,A,e)=>{const i=t.currentPipelineStepIndex;return A<i?"Completed":A===i&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},qJt=(t,A)=>{const i=t.pipelineDef[A].solverName,o=TJt(t,A),n=t[i],s=t.firstIterationOfPhase?.[i]??null,r=t.iterations;let a=0;if(o==="Completed"){const B=t.pipelineDef[A+1],l=B?t.firstIterationOfPhase?.[B.solverName]:void 0;l!==void 0&&s!==null?a=l-s:s!==null&&(a=r-s)}else o==="In Progress"&&s!==null&&(a=r-s);const g=t.timeSpentOnPhase?.[i]??0;let I=0;o==="Completed"?I=1:o==="In Progress"&&n&&(I=n.progress??0);const c=n?.stats??null;return{index:A,name:i,status:o,firstIteration:s,iterations:a,progress:I,timeSpent:g,stats:c&&Object.keys(c).length>0?c:null,solverInstance:n??null}},PJt=({status:t})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return O.jsx("span",{className:`font-medium ${A[t]}`,children:t})},OJt=({progress:t})=>{if(t===0)return null;const A=Math.round(t*100);return O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),O.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},WJt=t=>Object.entries(t).map(([A,e])=>`${A}: ${e}`).join(", "),ZJt=({stats:t})=>{if(!t||Object.keys(t).length===0)return O.jsx("span",{children:"-"});const A=Object.entries(t),e=WJt(t);return O.jsxs("details",{className:"cursor-pointer",children:[O.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:e}),O.jsx("div",{className:"mt-1 text-xs",children:A.map(([i,o])=>O.jsxs("div",{children:[i,": ",String(o)]},i))})]})},DhA=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(DhA);const A={};for(const[e,i]of Object.entries(t))e.startsWith("_")||(A[e]=DhA(i));return A},VJt=(t,A)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const e=DhA(t.getConstructorParams()),i=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),o=URL.createObjectURL(i),n=document.createElement("a");n.href=o,n.download=`${A}_input.json`,n.click(),URL.revokeObjectURL(o)}catch(e){alert(`Error downloading input for ${A}: ${e instanceof Error?e.message:String(e)}`)}},jJt=({solver:t,onStepUntilPhase:A,onDownloadInput:e})=>{const i=t.pipelineDef.map((r,a)=>qJt(t,a)),o=r=>{A?.(r)},n=r=>{r.solverInstance&&(e?e(r.solverInstance,r.name):VJt(r.solverInstance,r.name))},s=r=>`${(r/1e3).toFixed(2)}s`;return O.jsxs("div",{className:"border-t border-gray-200",children:[O.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:O.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Steps"})}),O.jsx("div",{className:"overflow-x-auto",children:O.jsxs("table",{className:"w-full text-sm",children:[O.jsx("thead",{children:O.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Step"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),O.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",O.jsx("sub",{children:"0"})]}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),O.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),O.jsx("tbody",{children:i.map(r=>O.jsxs("tr",{className:`border-b border-gray-100 ${r.status==="In Progress"?"bg-yellow-50":""}`,children:[O.jsx("td",{className:"px-4 py-2",children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"text-gray-400 w-6",children:String(r.index+1).padStart(2,"0")}),O.jsx("button",{onClick:()=>o(r.name),disabled:r.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${r.name} completes`,children:O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),O.jsx("span",{className:"font-medium text-gray-900",children:r.name})]})}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(PJt,{status:r.status})}),O.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:r.firstIteration!==null?r.firstIteration:""}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:r.iterations}),O.jsx("td",{className:"px-4 py-2",children:O.jsx(OJt,{progress:r.progress})}),O.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(r.timeSpent)}),O.jsx("td",{className:"px-4 py-2 text-gray-500",children:O.jsx(ZJt,{stats:r.stats})}),O.jsx("td",{className:"px-4 py-2",children:r.solverInstance?O.jsxs("button",{onClick:()=>n(r),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${r.name}`,children:[O.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:O.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),O.jsx("span",{children:"Input"})]}):null})]},r.name))})]})})]})},zJt=class extends eo.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}};function XJt({graphics:t}){const A=t.points??[],e=t.lines??[],i=t.rects??[],o=t.circles??[],n=t.texts??[];let s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,g=Number.NEGATIVE_INFINITY;const I=(E,h)=>{typeof E=="number"&&(E<s&&(s=E),E>a&&(a=E)),typeof h=="number"&&(h<r&&(r=h),h>g&&(g=h))};for(const E of A)I(E.x,E.y);for(const E of e){const h=E.points??[];for(const u of h)I(u.x,u.y)}for(const E of i){const h=E.x??0,u=E.y??0,d=E.width??0,f=E.height??0;I(h,u),I(h+d,u+f)}for(const E of o){const h=E.x??0,u=E.y??0,d=E.radius??1;I(h-d,u-d),I(h+d,u+d)}for(const E of n)I(E.x,E.y);(!isFinite(s)||!isFinite(r)||!isFinite(a)||!isFinite(g))&&(s=-20,r=-20,a=20,g=20);const c=10,B=s-c,l=r-c,C=Math.max(1,a-s+2*c),Q=Math.max(1,g-r+2*c);return O.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${B} ${l} ${C} ${Q}`,role:"img","aria-label":"Graphics fallback",children:[i.map((E,h)=>O.jsx("rect",{x:E.x??0,y:E.y??0,width:E.width??0,height:E.height??0,fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`rect-${h}`)),e.map((E,h)=>O.jsx("polyline",{fill:"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1,points:(E.points??[]).map(u=>`${u.x??0},${u.y??0}`).join(" ")},`line-${h}`)),o.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.fillColor??"none",stroke:E.strokeColor??"black",strokeWidth:E.strokeWidth??1},`circle-${h}`)),A.map((E,h)=>O.jsx("circle",{cx:E.x??0,cy:E.y??0,r:E.radius??1.5,fill:E.color??"black"},`point-${h}`)),n.map((E,h)=>O.jsx("text",{x:E.x??0,y:E.y??0,fontSize:E.fontSize??10,fill:E.color??"black",children:E.text??""},`text-${h}`))]})}var $Jt=({solver:t,animationSpeed:A=25,onSolverStarted:e,onSolverCompleted:i})=>{const[o,n]=z.useReducer(I=>I+1,0),s=z.useMemo(()=>{try{return t.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(I){return console.error("Visualization error:",I),{points:[],lines:[],rects:[],circles:[]}}},[t,o]),r=z.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);z.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const I=document.createElement("script");I.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(I)}},[]);const a=t.pipelineDef!==void 0,g=I=>{const c=t;if(!t.solved&&!t.failed){for(;!t.solved&&!t.failed&&c.currentPipelineStepIndex<=c.pipelineDef.findIndex(B=>B.solverName===I);)t.step();n()}};return O.jsxs("div",{children:[O.jsx(KJt,{solver:t,triggerRender:n,animationSpeed:A,onSolverStarted:e,onSolverCompleted:i}),r?O.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):O.jsx(zJt,{fallback:O.jsx(XJt,{graphics:s}),children:O.jsx(HJt,{graphics:s})}),a&&O.jsx(jJt,{solver:t,onStepUntilPhase:g})]})};const AKt=()=>{z.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const e=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),e)return;const i=document.createElement("script");i.id=t,i.src="https://cdn.tailwindcss.com",document.head.appendChild(i)},[])},eKt=t=>t.toLowerCase().includes("pack")?pSt:t.toLowerCase().includes("rout")?wSt:iSt,tKt=({solverEvents:t=[]})=>{const[A,e]=z.useState(null);AKt();const i=z.useMemo(()=>{const r=new Map;for(const a of t){const g=`${a.componentName}-${a.solverName}`;r.set(g,a)}return r},[t]),o=z.useMemo(()=>Array.from(i.keys()),[i]),n=A?i.get(A):null,s=z.useMemo(()=>{if(!n)return{instance:null,error:null,classFound:!1};const r=GvA[n.solverName];if(!r)return{instance:null,error:`Solver class "${n.solverName}" not found in SOLVERS registry. Available: ${Object.keys(GvA).join(", ")}`,classFound:!1};try{const a=n.solverParams,g=a?.input!==void 0?a.input:a;return{instance:new r(g),error:null,classFound:!0}}catch(a){const g=a instanceof Error?a.message:String(a);return console.error("Failed to reconstruct solver:",a),{instance:null,error:`Failed to instantiate solver: ${g}`,classFound:!0}}},[n]);return t.length===0?O.jsx("div",{className:"rf-p-4",children:O.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:O.jsxs("div",{className:"rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),O.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):O.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[O.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[O.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[o.length," ",o.length===1?"Solver":"Solvers"]}),o.map(r=>{const a=i.get(r),g=A===r;return O.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${g?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>e(r),children:(()=>{const I=eKt(a.solverName);return O.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[O.jsx(I,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),O.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[O.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:a.componentName}),O.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:a.solverName})]})]})})()},r)})]}),O.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:n?s.instance?O.jsx(Fm,{fallback:O.jsx("div",{className:"rf-p-4",children:O.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),O.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",n.solverName]})]})}),children:O.jsx($Jt,{solver:s.instance})}):O.jsxs("div",{className:"rf-p-4",children:[O.jsxs("div",{className:"rf-mb-4",children:[O.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:n.solverName}),O.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",n.componentName]})]}),s.error&&O.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:O.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),O.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[O.jsx("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50",children:O.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"})}),O.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:O.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(n.solverParams,null,2)})})]})]}):O.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:O.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},voe=({errorMessage:t,errorStack:A,circuitJsonErrors:e})=>{z.useEffect(()=>{if(t){const i=new Error(t);A&&(i.stack=A);try{B3.captureException(i)}catch{}}},[t,A]),z.useEffect(()=>{if(e&&e.length>0)for(const i of e){const o=new Error(i.message||"Circuit JSON Error");i.stack&&(o.stack=i.stack);try{B3.captureException(o,{error_type:i.type})}catch{}}},[e])},Uoe="0.0.1421",iKt={version:Uoe},XW=qvA()(PvA(t=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:A=>{t({lastRunEvalVersion:A})}}),{name:"runframe-runner-store"})),oKt=t=>{const[A,e]=z.useState([]),[i,o]=z.useState(null),[n,s]=z.useState(""),[r,a]=KM("eval-version-selection",null),g=XW(l=>l.setLastRunEvalVersion),I=XW(l=>l.lastRunEvalVersion);return z.useEffect(()=>{t&&fetch("https://data.jsdelivr.com/v1/package/npm/@tscircuit/eval").then(l=>l.json()).then(l=>{if(Array.isArray(l?.versions)){let C=[...l.versions];l.tags?.latest&&(o(l.tags.latest),C=C.filter(Q=>Q!==l.tags.latest)),e(C)}}).catch(()=>{})},[t]),z.useEffect(()=>{t&&(r?(window.TSCIRCUIT_LATEST_EVAL_VERSION=r,g(r)):i&&(window.TSCIRCUIT_LATEST_EVAL_VERSION=i,g(i)))},[t,r,i]),{versions:z.useMemo(()=>A.filter(l=>l.includes(n)).slice(0,50),[A,n]),latestVersion:i,lastRunEvalVersion:I,search:n,setSearch:s,selectVersion:l=>{a(l),s("")}}},nKt=({snippetNames:t,onSelect:A,onCancel:e,isOpen:i})=>{const[o,n]=z.useState(""),[s,r]=z.useState("");if(!i)return null;const a=t.filter(c=>c.toLowerCase().includes(s.toLowerCase())),g=s&&!t.includes(s),I=c=>{c.key==="Enter"&&(a.length===1?n(a[0]):g&&n(s))};return O.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-items-center rf-justify-center rf-z-[100]",children:O.jsxs("div",{className:"rf-bg-white rf-rounded-lg rf-p-6 rf-w-96",children:[O.jsx("h2",{className:"rf-text-lg rf-font-semibold rf-mb-4",children:"Select Snippet"}),O.jsx("input",{type:"text",className:"rf-w-full rf-px-4 rf-py-2 rf-border rf-rounded rf-mb-4",placeholder:"Search snippets or new snippet name...",value:s,onChange:c=>r(c.target.value),onKeyDown:I}),O.jsxs("div",{className:"rf-h-60 rf-overflow-y-auto",children:[a.map(c=>O.jsx("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 ${o===c?"bg-blue-50":""}`,onClick:()=>n(c),children:c},c)),g&&O.jsxs("button",{type:"button",className:`w-full text-left px-4 py-2 rounded hover:bg-gray-100 text-blue-500 ${o===s?"bg-blue-50":""}`,onClick:()=>n(s),children:['Create new "',s,'"']})]}),O.jsxs("div",{className:"rf-mt-4 rf-flex rf-justify-end rf-gap-2",children:[O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-text-gray-600 rf-hover:text-gray-800",onClick:e,children:"Cancel"}),O.jsx("button",{type:"button",className:"rf-px-4 rf-py-2 rf-bg-blue-500 rf-text-white rf-rounded rf-hover:bg-blue-600 rf-disabled:opacity-50",onClick:()=>o&&A(o),disabled:!o,children:o===s?`Create "${o}"`:`Save to ${o}`})]})]})})},sKt=t=>{const A=z.useRef(null),e=Jc(i=>i.recentEvents);z.useEffect(()=>{if(e.length===0)return;const i=e[0];i.event_id!==A.current&&(t(i),A.current=i.event_id)},[e,t])};function rKt(t){const A=aKt(t),e=z.forwardRef((i,o)=>{const{children:n,...s}=i,r=z.Children.toArray(n),a=r.find(IKt);if(a){const g=a.props.children,I=r.map(c=>c===a?z.Children.count(g)>1?z.Children.only(null):z.isValidElement(g)?g.props.children:null:c);return O.jsx(A,{...s,ref:o,children:z.isValidElement(g)?z.cloneElement(g,void 0,I):null})}return O.jsx(A,{...s,ref:o,children:n})});return e.displayName=`${t}.Slot`,e}function aKt(t){const A=z.forwardRef((e,i)=>{const{children:o,...n}=e;if(z.isValidElement(o)){const s=BKt(o),r=cKt(n,o.props);return o.type!==z.Fragment&&(r.ref=i?Kp(i,s):s),z.cloneElement(o,r)}return z.Children.count(o)>1?z.Children.only(null):null});return A.displayName=`${t}.SlotClone`,A}var gKt=Symbol("radix.slottable");function IKt(t){return z.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===gKt}function cKt(t,A){const e={...A};for(const i in A){const o=t[i],n=A[i];/^on[A-Z]/.test(i)?o&&n?e[i]=(...r)=>{const a=n(...r);return o(...r),a}:o&&(e[i]=o):i==="style"?e[i]={...o,...n}:i==="className"&&(e[i]=[o,n].filter(Boolean).join(" "))}return{...t,...e}}function BKt(t){let A=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning;return e?t.ref:(A=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=A&&"isReactWarning"in A&&A.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var $W="Dialog",[Loe,Hoe]=dw($W),[lKt,Um]=Loe($W),Yoe=t=>{const{__scopeDialog:A,children:e,open:i,defaultOpen:o,onOpenChange:n,modal:s=!0}=t,r=z.useRef(null),a=z.useRef(null),[g,I]=BG({prop:i,defaultProp:o??!1,onChange:n,caller:$W});return O.jsx(lKt,{scope:A,triggerRef:r,contentRef:a,contentId:yu(),titleId:yu(),descriptionId:yu(),open:g,onOpenChange:I,onOpenToggle:z.useCallback(()=>I(c=>!c),[I]),modal:s,children:e})};Yoe.displayName=$W;var Joe="DialogTrigger",Koe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(Joe,e),n=mB(A,o.triggerRef);return O.jsx(pg.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xhA(o.open),...i,ref:n,onClick:Cn(t.onClick,o.onOpenToggle)})});Koe.displayName=Joe;var ShA="DialogPortal",[CKt,Toe]=Loe(ShA,{forceMount:void 0}),qoe=t=>{const{__scopeDialog:A,forceMount:e,children:i,container:o}=t,n=Um(ShA,A);return O.jsx(CKt,{scope:A,forceMount:e,children:z.Children.map(i,s=>O.jsx(gy,{present:e||n.open,children:O.jsx(u8,{asChild:!0,container:o,children:s})}))})};qoe.displayName=ShA;var AZ="DialogOverlay",Poe=z.forwardRef((t,A)=>{const e=Toe(AZ,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Um(AZ,t.__scopeDialog);return n.modal?O.jsx(gy,{present:i||n.open,children:O.jsx(EKt,{...o,ref:A})}):null});Poe.displayName=AZ;var QKt=rKt("DialogOverlay.RemoveScroll"),EKt=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(AZ,e);return O.jsx(S8,{as:QKt,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(pg.div,{"data-state":xhA(o.open),...i,ref:A,style:{pointerEvents:"auto",...i.style}})})}),fF="DialogContent",Ooe=z.forwardRef((t,A)=>{const e=Toe(fF,t.__scopeDialog),{forceMount:i=e.forceMount,...o}=t,n=Um(fF,t.__scopeDialog);return O.jsx(gy,{present:i||n.open,children:n.modal?O.jsx(hKt,{...o,ref:A}):O.jsx(uKt,{...o,ref:A})})});Ooe.displayName=fF;var hKt=z.forwardRef((t,A)=>{const e=Um(fF,t.__scopeDialog),i=z.useRef(null),o=mB(A,e.contentRef,i);return z.useEffect(()=>{const n=i.current;if(n)return iQA(n)},[]),O.jsx(Woe,{...t,ref:o,trapFocus:e.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Cn(t.onCloseAutoFocus,n=>{n.preventDefault(),e.triggerRef.current?.focus()}),onPointerDownOutside:Cn(t.onPointerDownOutside,n=>{const s=n.detail.originalEvent,r=s.button===0&&s.ctrlKey===!0;(s.button===2||r)&&n.preventDefault()}),onFocusOutside:Cn(t.onFocusOutside,n=>n.preventDefault())})}),uKt=z.forwardRef((t,A)=>{const e=Um(fF,t.__scopeDialog),i=z.useRef(!1),o=z.useRef(!1);return O.jsx(Woe,{...t,ref:A,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:n=>{t.onCloseAutoFocus?.(n),n.defaultPrevented||(i.current||e.triggerRef.current?.focus(),n.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:n=>{t.onInteractOutside?.(n),n.defaultPrevented||(i.current=!0,n.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=n.target;e.triggerRef.current?.contains(s)&&n.preventDefault(),n.detail.originalEvent.type==="focusin"&&o.current&&n.preventDefault()}})}),Woe=z.forwardRef((t,A)=>{const{__scopeDialog:e,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:n,...s}=t,r=Um(fF,e),a=z.useRef(null),g=mB(A,a);return LCA(),O.jsxs(O.Fragment,{children:[O.jsx(s8,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:n,children:O.jsx(n8,{role:"dialog",id:r.contentId,"aria-describedby":r.descriptionId,"aria-labelledby":r.titleId,"data-state":xhA(r.open),...s,ref:g,onDismiss:()=>r.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(pKt,{titleId:r.titleId}),O.jsx(yKt,{contentRef:a,descriptionId:r.descriptionId})]})]})}),bhA="DialogTitle",Zoe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(bhA,e);return O.jsx(pg.h2,{id:o.titleId,...i,ref:A})});Zoe.displayName=bhA;var Voe="DialogDescription",joe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(Voe,e);return O.jsx(pg.p,{id:o.descriptionId,...i,ref:A})});joe.displayName=Voe;var zoe="DialogClose",Xoe=z.forwardRef((t,A)=>{const{__scopeDialog:e,...i}=t,o=Um(zoe,e);return O.jsx(pg.button,{type:"button",...i,ref:A,onClick:Cn(t.onClick,()=>o.onOpenChange(!1))})});Xoe.displayName=zoe;function xhA(t){return t?"open":"closed"}var $oe="DialogTitleWarning",[dKt,Ane]=g5e($oe,{contentName:fF,titleName:bhA,docsSlug:"dialog"}),pKt=({titleId:t})=>{const A=Ane($oe),e=`\`${A.contentName}\` requires a \`${A.titleName}\` for the component to be accessible for screen reader users.
5606
5606
 
5607
5607
  If you want to hide the \`${A.titleName}\`, you can wrap it with our VisuallyHidden component.
5608
5608