@tscircuit/runframe 0.0.258 → 0.0.259
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/standalone.min.js
CHANGED
|
@@ -242,7 +242,7 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
|
|
|
242
242
|
* @license
|
|
243
243
|
* Copyright 2019 Google LLC
|
|
244
244
|
* SPDX-License-Identifier: Apache-2.0
|
|
245
|
-
*/const Zae=Symbol("Comlink.proxy"),xke=Symbol("Comlink.endpoint"),Qae=Symbol("Comlink.releaseProxy"),OI=Symbol("Comlink.finalizer"),zR=Symbol("Comlink.thrown"),Kae=r=>typeof r=="object"&&r!==null||typeof r=="function",bke={canHandle:r=>Kae(r)&&r[Zae],serialize(r){const{port1:e,port2:t}=new MessageChannel;return eoe(r,e),[t,[t]]},deserialize(r){return r.start(),noe(r)}},Ske={canHandle:r=>Kae(r)&&zR in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},Jae=new Map([["proxy",bke],["throw",Ske]]);function Eke(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function eoe(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!Eke(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:o,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(fE);let c;try{const u=s.slice(0,-1).reduce((m,_)=>m[_],r),f=s.reduce((m,_)=>m[_],r);switch(o){case"GET":c=f;break;case"SET":u[s.slice(-1)[0]]=fE(i.data.value),c=!0;break;case"APPLY":c=f.apply(u,l);break;case"CONSTRUCT":{const m=new f(...l);c=ooe(m)}break;case"ENDPOINT":{const{port1:m,port2:_}=new MessageChannel;eoe(r,_),c=Rke(m,[m])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[zR]:0}}Promise.resolve(c).catch(u=>({value:u,[zR]:0})).then(u=>{const[f,m]=FR(u);e.postMessage(Object.assign(Object.assign({},f),{id:a}),m),o==="RELEASE"&&(e.removeEventListener("message",n),toe(e),OI in r&&typeof r[OI]=="function"&&r[OI]())}).catch(u=>{const[f,m]=FR({value:new TypeError("Unserializable return value"),[zR]:0});e.postMessage(Object.assign(Object.assign({},f),{id:a}),m)})}),e.start&&e.start()}function wke(r){return r.constructor.name==="MessagePort"}function toe(r){wke(r)&&r.close()}function noe(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const o=t.get(a.id);if(o)try{o(a)}finally{t.delete(a.id)}}),zI(r,t,[],e)}function UR(r){if(r)throw new Error("Proxy has been released and is not useable")}function roe(r){return Kw(r,new Map,{type:"RELEASE"}).then(()=>{toe(r)})}const IR=new WeakMap,kR="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(IR.get(r)||0)-1;IR.set(r,e),e===0&&roe(r)});function Tke(r,e){const t=(IR.get(e)||0)+1;IR.set(e,t),kR&&kR.register(r,e,r)}function Mke(r){kR&&kR.unregister(r)}function zI(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(o,s){if(UR(i),s===Qae)return()=>{Mke(a),roe(r),e.clear(),i=!0};if(s==="then"){if(t.length===0)return{then:()=>a};const l=Kw(r,e,{type:"GET",path:t.map(c=>c.toString())}).then(fE);return l.then.bind(l)}return zI(r,e,[...t,s])},set(o,s,l){UR(i);const[c,u]=FR(l);return Kw(r,e,{type:"SET",path:[...t,s].map(f=>f.toString()),value:c},u).then(fE)},apply(o,s,l){UR(i);const c=t[t.length-1];if(c===xke)return Kw(r,e,{type:"ENDPOINT"}).then(fE);if(c==="bind")return zI(r,e,t.slice(0,-1));const[u,f]=ioe(l);return Kw(r,e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:u},f).then(fE)},construct(o,s){UR(i);const[l,c]=ioe(s);return Kw(r,e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},c).then(fE)}});return Tke(a,r),a}function Cke(r){return Array.prototype.concat.apply([],r)}function ioe(r){const e=r.map(FR);return[e.map(t=>t[0]),Cke(e.map(t=>t[1]))]}const aoe=new WeakMap;function Rke(r,e){return aoe.set(r,e),r}function ooe(r){return Object.assign(r,{[Zae]:!0})}function FR(r){for(const[e,t]of Jae)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},aoe.get(r)||[]]}function fE(r){switch(r.type){case"HANDLER":return Jae.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Kw(r,e,t,n){return new Promise(i=>{const a=Ake();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function Ake(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Nke=async r=>{console.log("[Worker] Creating circuit web worker with config:",r);let e=r.webWorkerBlobUrl??r.webWorkerUrl;if(!e){const o=`https://cdn.jsdelivr.net/npm/@tscircuit/eval@${r.evalVersion??"latest"}/dist/webworker/index.js`,s=await fetch(o).then(l=>l.blob());e=URL.createObjectURL(s)}const t=new Worker(e,{type:"module"}),n=noe(t);r.snippetsApiBaseUrl&&await n.setSnippetsApiBaseUrl(r.snippetsApiBaseUrl);let i=!1;return{clearEventListeners:n.clearEventListeners.bind(n),execute:async(...o)=>{if(i)throw new Error("CircuitWebWorker was terminated, can't execute");return n.execute.bind(n)(...o)},executeWithFsMap:async(...o)=>{if(i)throw new Error("CircuitWebWorker was terminated, can't executeWithFsMap");return n.executeWithFsMap.bind(n)(...o)},renderUntilSettled:n.renderUntilSettled.bind(n),getCircuitJson:n.getCircuitJson.bind(n),on:(o,s)=>{const l=ooe(s);n.on(o,l)},kill:async()=>{n[Qae](),t.terminate(),i=!0}}};function Sp(r,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(r==null||r(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Pke(r,e){const t=ct.createContext(e),n=a=>{const{children:o,...s}=a,l=ct.useMemo(()=>s,Object.values(s));return et.jsx(t.Provider,{value:l,children:o})};n.displayName=r+"Provider";function i(a){const o=ct.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${r}\``)}return[n,i]}function yS(r,e=[]){let t=[];function n(a,o){const s=ct.createContext(o),l=t.length;t=[...t,o];const c=f=>{var T;const{scope:m,children:_,...x}=f,M=((T=m==null?void 0:m[r])==null?void 0:T[l])||s,w=ct.useMemo(()=>x,Object.values(x));return et.jsx(M.Provider,{value:w,children:_})};c.displayName=a+"Provider";function u(f,m){var M;const _=((M=m==null?void 0:m[r])==null?void 0:M[l])||s,x=ct.useContext(_);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[c,u]}const i=()=>{const a=t.map(o=>ct.createContext(o));return function(s){const l=(s==null?void 0:s[r])||a;return ct.useMemo(()=>({[`__scope${r}`]:{...s,[r]:l}}),[s,l])}};return i.scopeName=r,[n,Dke(i,...e)]}function Dke(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const n=r.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:c})=>{const f=l(a)[`__scope${c}`];return{...s,...f}},{});return ct.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function soe(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function BR(...r){return e=>{let t=!1;const n=r.map(i=>{const a=soe(i,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let i=0;i<n.length;i++){const a=n[i];typeof a=="function"?a():soe(r[i],null)}}}}function Q9(...r){return ct.useCallback(BR(...r),r)}var dE=ct.forwardRef((r,e)=>{const{children:t,...n}=r,i=ct.Children.toArray(t),a=i.find(Lke);if(a){const o=a.props.children,s=i.map(l=>l===a?ct.Children.count(o)>1?ct.Children.only(null):ct.isValidElement(o)?o.props.children:null:l);return et.jsx(UI,{...n,ref:e,children:ct.isValidElement(o)?ct.cloneElement(o,void 0,s):null})}return et.jsx(UI,{...n,ref:e,children:t})});dE.displayName="Slot";var UI=ct.forwardRef((r,e)=>{const{children:t,...n}=r;if(ct.isValidElement(t)){const i=zke(t),a=Oke(n,t.props);return t.type!==ct.Fragment&&(a.ref=e?BR(e,i):i),ct.cloneElement(t,a)}return ct.Children.count(t)>1?ct.Children.only(null):null});UI.displayName="SlotClone";var loe=({children:r})=>et.jsx(et.Fragment,{children:r});function Lke(r){return ct.isValidElement(r)&&r.type===loe}function Oke(r,e){const t={...e};for(const n in e){const i=r[n],a=e[n];/^on[A-Z]/.test(n)?i&&a?t[n]=(...s)=>{a(...s),i(...s)}:i&&(t[n]=i):n==="style"?t[n]={...i,...a}:n==="className"&&(t[n]=[i,a].filter(Boolean).join(" "))}return{...r,...t}}function zke(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}function coe(r){const e=r+"CollectionProvider",[t,n]=yS(e),[i,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:x,children:M}=_,w=wh.useRef(null),T=wh.useRef(new Map).current;return et.jsx(i,{scope:x,itemMap:T,collectionRef:w,children:M})};o.displayName=e;const s=r+"CollectionSlot",l=wh.forwardRef((_,x)=>{const{scope:M,children:w}=_,T=a(s,M),D=Q9(x,T.collectionRef);return et.jsx(dE,{ref:D,children:w})});l.displayName=s;const c=r+"CollectionItemSlot",u="data-radix-collection-item",f=wh.forwardRef((_,x)=>{const{scope:M,children:w,...T}=_,D=wh.useRef(null),O=Q9(x,D),B=a(c,M);return wh.useEffect(()=>(B.itemMap.set(D,{ref:D,...T}),()=>void B.itemMap.delete(D))),et.jsx(dE,{[u]:"",ref:O,children:w})});f.displayName=c;function m(_){const x=a(r+"CollectionConsumer",_);return wh.useCallback(()=>{const w=x.collectionRef.current;if(!w)return[];const T=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(x.itemMap.values()).sort((B,W)=>T.indexOf(B.ref.current)-T.indexOf(W.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},m,n]}var hE=globalThis!=null&&globalThis.document?ct.useLayoutEffect:()=>{},Uke=_ke.useId||(()=>{}),Ike=0;function gS(r){const[e,t]=ct.useState(Uke());return hE(()=>{t(n=>n??String(Ike++))},[r]),e?`radix-${e}`:""}var II=Xae();const kke=yx(II);var Fke=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ng=Fke.reduce((r,e)=>{const t=ct.forwardRef((n,i)=>{const{asChild:a,...o}=n,s=a?dE:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),et.jsx(s,{...o,ref:i})});return t.displayName=`Primitive.${e}`,{...r,[e]:t}},{});function uoe(r,e){r&&II.flushSync(()=>r.dispatchEvent(e))}function z3(r){const e=ct.useRef(r);return ct.useEffect(()=>{e.current=r}),ct.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}function Jw({prop:r,defaultProp:e,onChange:t=()=>{}}){const[n,i]=Bke({defaultProp:e,onChange:t}),a=r!==void 0,o=a?r:n,s=z3(t),l=ct.useCallback(c=>{if(a){const f=typeof c=="function"?c(r):c;f!==r&&s(f)}else i(c)},[a,r,i,s]);return[o,l]}function Bke({defaultProp:r,onChange:e}){const t=ct.useState(r),[n]=t,i=ct.useRef(n),a=z3(e);return ct.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),t}var Hke=ct.createContext(void 0);function kI(r){const e=ct.useContext(Hke);return r||e||"ltr"}var FI="rovingFocusGroup.onEntryFocus",jke={bubbles:!1,cancelable:!0},HR="RovingFocusGroup",[BI,foe,Vke]=coe(HR),[Gke,jR]=yS(HR,[Vke]),[qke,Yke]=Gke(HR),doe=ct.forwardRef((r,e)=>et.jsx(BI.Provider,{scope:r.__scopeRovingFocusGroup,children:et.jsx(BI.Slot,{scope:r.__scopeRovingFocusGroup,children:et.jsx(Xke,{...r,ref:e})})}));doe.displayName=HR;var Xke=ct.forwardRef((r,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=r,m=ct.useRef(null),_=Q9(e,m),x=kI(a),[M=null,w]=Jw({prop:o,defaultProp:s,onChange:l}),[T,D]=ct.useState(!1),O=z3(c),B=foe(t),W=ct.useRef(!1),[$,Z]=ct.useState(0);return ct.useEffect(()=>{const J=m.current;if(J)return J.addEventListener(FI,O),()=>J.removeEventListener(FI,O)},[O]),et.jsx(qke,{scope:t,orientation:n,dir:x,loop:i,currentTabStopId:M,onItemFocus:ct.useCallback(J=>w(J),[w]),onItemShiftTab:ct.useCallback(()=>D(!0),[]),onFocusableItemAdd:ct.useCallback(()=>Z(J=>J+1),[]),onFocusableItemRemove:ct.useCallback(()=>Z(J=>J-1),[]),children:et.jsx(Ng.div,{tabIndex:T||$===0?-1:0,"data-orientation":n,...f,ref:_,style:{outline:"none",...r.style},onMouseDown:Sp(r.onMouseDown,()=>{W.current=!0}),onFocus:Sp(r.onFocus,J=>{const ae=!W.current;if(J.target===J.currentTarget&&ae&&!T){const K=new CustomEvent(FI,jke);if(J.currentTarget.dispatchEvent(K),!K.defaultPrevented){const he=B().filter(we=>we.focusable),me=he.find(we=>we.active),be=he.find(we=>we.id===M),Le=[me,be,...he].filter(Boolean).map(we=>we.ref.current);moe(Le,u)}}W.current=!1}),onBlur:Sp(r.onBlur,()=>D(!1))})})}),hoe="RovingFocusGroupItem",poe=ct.forwardRef((r,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:i=!1,tabStopId:a,...o}=r,s=gS(),l=a||s,c=Yke(hoe,t),u=c.currentTabStopId===l,f=foe(t),{onFocusableItemAdd:m,onFocusableItemRemove:_}=c;return ct.useEffect(()=>{if(n)return m(),()=>_()},[n,m,_]),et.jsx(BI.ItemSlot,{scope:t,id:l,focusable:n,active:i,children:et.jsx(Ng.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:Sp(r.onMouseDown,x=>{n?c.onItemFocus(l):x.preventDefault()}),onFocus:Sp(r.onFocus,()=>c.onItemFocus(l)),onKeyDown:Sp(r.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){c.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const M=Zke(x,c.orientation,c.dir);if(M!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let T=f().filter(D=>D.focusable).map(D=>D.ref.current);if(M==="last")T.reverse();else if(M==="prev"||M==="next"){M==="prev"&&T.reverse();const D=T.indexOf(x.currentTarget);T=c.loop?Qke(T,D+1):T.slice(D+1)}setTimeout(()=>moe(T))}})})})});poe.displayName=hoe;var Wke={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $ke(r,e){return e!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function Zke(r,e,t){const n=$ke(r.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Wke[n]}function moe(r,e=!1){const t=document.activeElement;for(const n of r)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function Qke(r,e){return r.map((t,n)=>r[(e+n)%r.length])}var voe=doe,yoe=poe;function Kke(r,e){return ct.useReducer((t,n)=>e[t][n]??t,r)}var Lb=r=>{const{present:e,children:t}=r,n=Jke(e),i=typeof t=="function"?t({present:n.isPresent}):ct.Children.only(t),a=Q9(n.ref,eFe(i));return typeof t=="function"||n.isPresent?ct.cloneElement(i,{ref:a}):null};Lb.displayName="Presence";function Jke(r){const[e,t]=ct.useState(),n=ct.useRef({}),i=ct.useRef(r),a=ct.useRef("none"),o=r?"mounted":"unmounted",[s,l]=Kke(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ct.useEffect(()=>{const c=VR(n.current);a.current=s==="mounted"?c:"none"},[s]),hE(()=>{const c=n.current,u=i.current;if(u!==r){const m=a.current,_=VR(c);r?l("MOUNT"):_==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&m!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=r}},[r,l]),hE(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,f=_=>{const M=VR(n.current).includes(_.animationName);if(_.target===e&&M&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},m=_=>{_.target===e&&(a.current=VR(n.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:ct.useCallback(c=>{c&&(n.current=getComputedStyle(c)),t(c)},[])}}function VR(r){return(r==null?void 0:r.animationName)||"none"}function eFe(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var HI="Tabs",[tFe,aFt]=yS(HI,[jR]),goe=jR(),[nFe,jI]=tFe(HI),_oe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...c}=r,u=kI(s),[f,m]=Jw({prop:n,onChange:i,defaultProp:a});return et.jsx(nFe,{scope:t,baseId:gS(),value:f,onValueChange:m,orientation:o,dir:u,activationMode:l,children:et.jsx(Ng.div,{dir:u,"data-orientation":o,...c,ref:e})})});_oe.displayName=HI;var xoe="TabsList",boe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,loop:n=!0,...i}=r,a=jI(xoe,t),o=goe(t);return et.jsx(voe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:et.jsx(Ng.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});boe.displayName=xoe;var Soe="TabsTrigger",Eoe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,disabled:i=!1,...a}=r,o=jI(Soe,t),s=goe(t),l=Moe(o.baseId,n),c=Coe(o.baseId,n),u=n===o.value;return et.jsx(yoe,{asChild:!0,...s,focusable:!i,active:u,children:et.jsx(Ng.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:e,onMouseDown:Sp(r.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Sp(r.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Sp(r.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!i&&f&&o.onValueChange(n)})})})});Eoe.displayName=Soe;var woe="TabsContent",Toe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,forceMount:i,children:a,...o}=r,s=jI(woe,t),l=Moe(s.baseId,n),c=Coe(s.baseId,n),u=n===s.value,f=ct.useRef(u);return ct.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),et.jsx(Lb,{present:i||u,children:({present:m})=>et.jsx(Ng.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:c,tabIndex:0,...o,ref:e,style:{...r.style,animationDuration:f.current?"0s":void 0},children:m&&a})})});Toe.displayName=woe;function Moe(r,e){return`${r}-trigger-${e}`}function Coe(r,e){return`${r}-content-${e}`}var rFe=_oe,Roe=boe,Aoe=Eoe,Noe=Toe;function Poe(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=Poe(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function Ob(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=Poe(r))&&(n&&(n+=" "),n+=e);return n}const VI="-",iFe=r=>{const e=oFe(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{const s=o.split(VI);return s[0]===""&&s.length!==1&&s.shift(),Doe(s,e)||aFe(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},Doe=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],n=e.nextPart.get(t),i=n?Doe(r.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const a=r.join(VI);return(o=e.validators.find(({validator:s})=>s(a)))==null?void 0:o.classGroupId},Loe=/^\[(.+)\]$/,aFe=r=>{if(Loe.test(r)){const e=Loe.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},oFe=r=>{const{theme:e,prefix:t}=r,n={nextPart:new Map,validators:[]};return lFe(Object.entries(r.classGroups),t).forEach(([a,o])=>{GI(o,n,a,e)}),n},GI=(r,e,t,n)=>{r.forEach(i=>{if(typeof i=="string"){const a=i===""?e:Ooe(e,i);a.classGroupId=t;return}if(typeof i=="function"){if(sFe(i)){GI(i(n),e,t,n);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([a,o])=>{GI(o,Ooe(e,a),t,n)})})},Ooe=(r,e)=>{let t=r;return e.split(VI).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},sFe=r=>r.isThemeGetter,lFe=(r,e)=>e?r.map(([t,n])=>{const i=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,s])=>[e+o,s])):a);return[t,i]}):r,cFe=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const i=(a,o)=>{t.set(a,o),e++,e>r&&(e=0,n=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return i(a,o),o},set(a,o){t.has(a)?t.set(a,o):i(a,o)}}},zoe="!",uFe=r=>{const{separator:e,experimentalParseClassName:t}=r,n=e.length===1,i=e[0],a=e.length,o=s=>{const l=[];let c=0,u=0,f;for(let w=0;w<s.length;w++){let T=s[w];if(c===0){if(T===i&&(n||s.slice(w,w+a)===e)){l.push(s.slice(u,w)),u=w+a;continue}if(T==="/"){f=w;continue}}T==="["?c++:T==="]"&&c--}const m=l.length===0?s:s.substring(u),_=m.startsWith(zoe),x=_?m.substring(1):m,M=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:_,baseClassName:x,maybePostfixModifierPosition:M}};return t?s=>t({className:s,parseClassName:o}):o},fFe=r=>{if(r.length<=1)return r;const e=[];let t=[];return r.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},dFe=r=>({cache:cFe(r.cacheSize),parseClassName:uFe(r),...iFe(r)}),hFe=/\s+/,pFe=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i}=e,a=[],o=r.trim().split(hFe);let s="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:_}=t(c);let x=!!_,M=n(x?m.substring(0,_):m);if(!M){if(!x){s=c+(s.length>0?" "+s:s);continue}if(M=n(m),!M){s=c+(s.length>0?" "+s:s);continue}x=!1}const w=fFe(u).join(":"),T=f?w+zoe:w,D=T+M;if(a.includes(D))continue;a.push(D);const O=i(M,x);for(let B=0;B<O.length;++B){const W=O[B];a.push(T+W)}s=c+(s.length>0?" "+s:s)}return s};function mFe(){let r=0,e,t,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Uoe(e))&&(n&&(n+=" "),n+=t);return n}const Uoe=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=Uoe(r[n]))&&(t&&(t+=" "),t+=e);return t};function vFe(r,...e){let t,n,i,a=o;function o(l){const c=e.reduce((u,f)=>f(u),r());return t=dFe(c),n=t.cache.get,i=t.cache.set,a=s,s(l)}function s(l){const c=n(l);if(c)return c;const u=pFe(l,t);return i(l,u),u}return function(){return a(mFe.apply(null,arguments))}}const Wg=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},Ioe=/^\[(?:([a-z-]+):)?(.+)\]$/i,yFe=/^\d+\/\d+$/,gFe=new Set(["px","full","screen"]),_Fe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xFe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bFe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,SFe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EFe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_S=r=>eT(r)||gFe.has(r)||yFe.test(r),d4=r=>tT(r,"length",PFe),eT=r=>!!r&&!Number.isNaN(Number(r)),qI=r=>tT(r,"number",eT),x8=r=>!!r&&Number.isInteger(Number(r)),wFe=r=>r.endsWith("%")&&eT(r.slice(0,-1)),A0=r=>Ioe.test(r),h4=r=>_Fe.test(r),TFe=new Set(["length","size","percentage"]),MFe=r=>tT(r,TFe,koe),CFe=r=>tT(r,"position",koe),RFe=new Set(["image","url"]),AFe=r=>tT(r,RFe,LFe),NFe=r=>tT(r,"",DFe),b8=()=>!0,tT=(r,e,t)=>{const n=Ioe.exec(r);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},PFe=r=>xFe.test(r)&&!bFe.test(r),koe=()=>!1,DFe=r=>SFe.test(r),LFe=r=>EFe.test(r),OFe=vFe(()=>{const r=Wg("colors"),e=Wg("spacing"),t=Wg("blur"),n=Wg("brightness"),i=Wg("borderColor"),a=Wg("borderRadius"),o=Wg("borderSpacing"),s=Wg("borderWidth"),l=Wg("contrast"),c=Wg("grayscale"),u=Wg("hueRotate"),f=Wg("invert"),m=Wg("gap"),_=Wg("gradientColorStops"),x=Wg("gradientColorStopPositions"),M=Wg("inset"),w=Wg("margin"),T=Wg("opacity"),D=Wg("padding"),O=Wg("saturate"),B=Wg("scale"),W=Wg("sepia"),$=Wg("skew"),Z=Wg("space"),J=Wg("translate"),ae=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],he=()=>["auto",A0,e],me=()=>[A0,e],be=()=>["",_S,d4],Ae=()=>["auto",eT,A0],Le=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],we=()=>["solid","dashed","dotted","double","none"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Te=()=>["start","end","center","between","around","evenly","stretch"],Ve=()=>["","0",A0],Ue=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ie=()=>[eT,A0];return{cacheSize:500,separator:":",theme:{colors:[b8],spacing:[_S,d4],blur:["none","",h4,A0],brightness:Ie(),borderColor:[r],borderRadius:["none","","full",h4,A0],borderSpacing:me(),borderWidth:be(),contrast:Ie(),grayscale:Ve(),hueRotate:Ie(),invert:Ve(),gap:me(),gradientColorStops:[r],gradientColorStopPositions:[wFe,d4],inset:he(),margin:he(),opacity:Ie(),padding:me(),saturate:Ie(),scale:Ie(),sepia:Ve(),skew:Ie(),space:me(),translate:me()},classGroups:{aspect:[{aspect:["auto","square","video",A0]}],container:["container"],columns:[{columns:[h4]}],"break-after":[{"break-after":Ue()}],"break-before":[{"break-before":Ue()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Le(),A0]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:ae()}],"overscroll-x":[{"overscroll-x":ae()}],"overscroll-y":[{"overscroll-y":ae()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[M]}],"inset-x":[{"inset-x":[M]}],"inset-y":[{"inset-y":[M]}],start:[{start:[M]}],end:[{end:[M]}],top:[{top:[M]}],right:[{right:[M]}],bottom:[{bottom:[M]}],left:[{left:[M]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",x8,A0]}],basis:[{basis:he()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",A0]}],grow:[{grow:Ve()}],shrink:[{shrink:Ve()}],order:[{order:["first","last","none",x8,A0]}],"grid-cols":[{"grid-cols":[b8]}],"col-start-end":[{col:["auto",{span:["full",x8,A0]},A0]}],"col-start":[{"col-start":Ae()}],"col-end":[{"col-end":Ae()}],"grid-rows":[{"grid-rows":[b8]}],"row-start-end":[{row:["auto",{span:[x8,A0]},A0]}],"row-start":[{"row-start":Ae()}],"row-end":[{"row-end":Ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",A0]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",A0]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...Te()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Te(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Te(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[Z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",A0,e]}],"min-w":[{"min-w":[A0,e,"min","max","fit"]}],"max-w":[{"max-w":[A0,e,"none","full","min","max","fit","prose",{screen:[h4]},h4]}],h:[{h:[A0,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[A0,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[A0,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[A0,e,"auto","min","max","fit"]}],"font-size":[{text:["base",h4,d4]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qI]}],"font-family":[{font:[b8]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",A0]}],"line-clamp":[{"line-clamp":["none",eT,qI]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_S,A0]}],"list-image":[{"list-image":["none",A0]}],"list-style-type":[{list:["none","disc","decimal",A0]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[T]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_S,d4]}],"underline-offset":[{"underline-offset":["auto",_S,A0]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:me()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A0]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",A0]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[T]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Le(),CFe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",MFe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},AFe]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[T]}],"border-style":[{border:[...we(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[T]}],"divide-style":[{divide:we()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...we()]}],"outline-offset":[{"outline-offset":[_S,A0]}],"outline-w":[{outline:[_S,d4]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[T]}],"ring-offset-w":[{"ring-offset":[_S,d4]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",h4,NFe]}],"shadow-color":[{shadow:[b8]}],opacity:[{opacity:[T]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Oe()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",h4,A0]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[O]}],sepia:[{sepia:[W]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[T]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",A0]}],duration:[{duration:Ie()}],ease:[{ease:["linear","in","out","in-out",A0]}],delay:[{delay:Ie()}],animate:[{animate:["none","spin","ping","pulse","bounce",A0]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[B]}],"scale-x":[{"scale-x":[B]}],"scale-y":[{"scale-y":[B]}],rotate:[{rotate:[x8,A0]}],"translate-x":[{"translate-x":[J]}],"translate-y":[{"translate-y":[J]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",A0]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",A0]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":me()}],"scroll-mx":[{"scroll-mx":me()}],"scroll-my":[{"scroll-my":me()}],"scroll-ms":[{"scroll-ms":me()}],"scroll-me":[{"scroll-me":me()}],"scroll-mt":[{"scroll-mt":me()}],"scroll-mr":[{"scroll-mr":me()}],"scroll-mb":[{"scroll-mb":me()}],"scroll-ml":[{"scroll-ml":me()}],"scroll-p":[{"scroll-p":me()}],"scroll-px":[{"scroll-px":me()}],"scroll-py":[{"scroll-py":me()}],"scroll-ps":[{"scroll-ps":me()}],"scroll-pe":[{"scroll-pe":me()}],"scroll-pt":[{"scroll-pt":me()}],"scroll-pr":[{"scroll-pr":me()}],"scroll-pb":[{"scroll-pb":me()}],"scroll-pl":[{"scroll-pl":me()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",A0]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[_S,d4,qI]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function Jm(...r){return OFe(Ob(r))}const Foe=r=>r.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),zFe=rFe,Boe=ct.forwardRef(({className:r,...e},t)=>et.jsx(Roe,{ref:t,className:Jm("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",r),...e}));Boe.displayName=Roe.displayName;const nT=ct.forwardRef(({className:r,...e},t)=>et.jsx(Aoe,{ref:t,className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",r),...e}));nT.displayName=Aoe.displayName;const zb=ct.forwardRef(({className:r,...e},t)=>et.jsx(Noe,{ref:t,className:Jm("rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",r),...e}));zb.displayName=Noe.displayName;var wv;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{const a={};for(const o of i)a[o]=o;return a},r.getValidEnumValues=i=>{const a=r.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(const s of a)o[s]=i[s];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(a){return i[a]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},r.find=(i,a)=>{for(const o of i)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(wv||(wv={}));var YI;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(YI||(YI={}));const Cc=wv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xS=r=>{switch(typeof r){case"undefined":return Cc.undefined;case"string":return Cc.string;case"number":return isNaN(r)?Cc.nan:Cc.number;case"boolean":return Cc.boolean;case"function":return Cc.function;case"bigint":return Cc.bigint;case"symbol":return Cc.symbol;case"object":return Array.isArray(r)?Cc.array:r===null?Cc.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Cc.promise:typeof Map<"u"&&r instanceof Map?Cc.map:typeof Set<"u"&&r instanceof Set?Cc.set:typeof Date<"u"&&r instanceof Date?Cc.date:Cc.object;default:return Cc.unknown}},Ko=wv.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"]),UFe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let ab=class sIe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof sIe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ab.create=r=>new ab(r);const rT=(r,e)=>{let t;switch(r.code){case Ko.invalid_type:r.received===Cc.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case Ko.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,wv.jsonStringifyReplacer)}`;break;case Ko.unrecognized_keys:t=`Unrecognized key(s) in object: ${wv.joinValues(r.keys,", ")}`;break;case Ko.invalid_union:t="Invalid input";break;case Ko.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${wv.joinValues(r.options)}`;break;case Ko.invalid_enum_value:t=`Invalid enum value. Expected ${wv.joinValues(r.options)}, received '${r.received}'`;break;case Ko.invalid_arguments:t="Invalid function arguments";break;case Ko.invalid_return_type:t="Invalid function return type";break;case Ko.invalid_date:t="Invalid date";break;case Ko.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:wv.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case Ko.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case Ko.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case Ko.custom:t="Invalid input";break;case Ko.invalid_intersection_types:t="Intersection results could not be merged";break;case Ko.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case Ko.not_finite:t="Number must be finite";break;default:t=e.defaultError,wv.assertNever(r)}return{message:t}};let Hoe=rT;function IFe(r){Hoe=r}function GR(){return Hoe}const qR=r=>{const{data:e,path:t,errorMaps:n,issueData:i}=r,a=[...t,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},kFe=[];function Xl(r,e){const t=GR(),n=qR({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===rT?void 0:rT].filter(i=>!!i)});r.common.issues.push(n)}let V5=class lIe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return Th;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const a=await i.key,o=await i.value;n.push({key:a,value:o})}return lIe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Th;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}};const Th=Object.freeze({status:"aborted"}),iT=r=>({status:"dirty",value:r}),S5=r=>({status:"valid",value:r}),XI=r=>r.status==="aborted",WI=r=>r.status==="dirty",pE=r=>r.status==="valid",S8=r=>typeof Promise<"u"&&r instanceof Promise;function YR(r,e,t,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function joe(r,e,t,n,i){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var Qu;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Qu||(Qu={}));var E8,w8;let Ub=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Voe=(r,e)=>{if(pE(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ab(r.common.issues);return this._error=t,this._error}}};function u0(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{var l,c;const{message:u}=r;return o.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:(l=u??n)!==null&&l!==void 0?l:s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:s.defaultError}},description:i}}let k0=class{get description(){return this._def.description}_getType(e){return xS(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V5,ctx:{common:e.parent.common,data:e.data,parsedType:xS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S8(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)},a=this._parseSync({data:e,path:i.path,parent:i});return Voe(i,a)}"~validate"(e){var t,n;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:i});return pE(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>pE(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(S8(i)?i:Promise.resolve(i));return Voe(n,a)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{const o=e(i),s=()=>a.addIssue({code:Ko.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new ob({schema:this,typeName:fh.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return Ib.create(this,this._def)}nullable(){return m4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vE.create(this)}promise(){return lT.create(this,this._def)}or(e){return P8.create([this,e],this._def)}and(e){return D8.create(this,e,this._def)}transform(e){return new ob({...u0(this._def),schema:this,typeName:fh.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new I8({...u0(this._def),innerType:this,defaultValue:t,typeName:fh.ZodDefault})}brand(){return new QI({typeName:fh.ZodBranded,type:this,...u0(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new k8({...u0(this._def),innerType:this,catchValue:t,typeName:fh.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return KI.create(this,e)}readonly(){return F8.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const FFe=/^c[^\s-]{8,}$/i,BFe=/^[0-9a-z]+$/,HFe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jFe=/^[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,VFe=/^[a-z0-9_-]{21}$/i,GFe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qFe=/^[-+]?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)?)??$/,YFe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XFe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $I;const WFe=/^(?:(?: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])$/,$Fe=/^(?:(?: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])$/,ZFe=/^(([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]))$/,QFe=/^(([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])$/,KFe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JFe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Goe="((\\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])))",eBe=new RegExp(`^${Goe}$`);function qoe(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function tBe(r){return new RegExp(`^${qoe(r)}$`)}function Yoe(r){let e=`${Goe}T${qoe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function nBe(r,e){return!!((e==="v4"||!e)&&WFe.test(r)||(e==="v6"||!e)&&ZFe.test(r))}function rBe(r,e){if(!GFe.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function iBe(r,e){return!!((e==="v4"||!e)&&$Fe.test(r)||(e==="v6"||!e)&&QFe.test(r))}let aT=class AR extends k0{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cc.string){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.string,received:a.parsedType}),Th}const n=new V5;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?Xl(i,{code:Ko.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Xl(i,{code:Ko.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")YFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"email",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")$I||($I=new RegExp(XFe,"u")),$I.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"emoji",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")jFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"uuid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")VFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"nanoid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")FFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cuid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")BFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cuid2",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")HFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"ulid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Xl(i,{validation:"url",code:Ko.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"regex",code:Ko.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Yoe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?eBe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?tBe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?qFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"duration",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?nBe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"ip",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?rBe(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"jwt",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?iBe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cidr",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?KFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"base64",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?JFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"base64url",code:Ko.invalid_string,message:a.message}),n.dirty()):wv.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:Ko.invalid_string,...Qu.errToObj(n)})}_addCheck(e){return new AR({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Qu.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Qu.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Qu.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Qu.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Qu.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Qu.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Qu.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Qu.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Qu.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Qu.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Qu.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Qu.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Qu.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...Qu.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Qu.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Qu.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Qu.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Qu.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Qu.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Qu.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Qu.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Qu.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Qu.errToObj(t)})}nonempty(e){return this.min(1,Qu.errToObj(e))}trim(){return new AR({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new AR({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new AR({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};aT.create=r=>{var e;return new aT({checks:[],typeName:fh.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...u0(r)})};function aBe(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}let T8=class _ae extends k0{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Cc.number){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.number,received:a.parsedType}),Th}let n;const i=new V5;for(const a of this._def.checks)a.kind==="int"?wv.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?aBe(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_finite,message:a.message}),i.dirty()):wv.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Qu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Qu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Qu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Qu.toString(t))}setLimit(e,t,n,i){return new _ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Qu.toString(i)}]})}_addCheck(e){return new _ae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Qu.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Qu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Qu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Qu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Qu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Qu.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Qu.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Qu.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Qu.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&wv.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};T8.create=r=>new T8({checks:[],typeName:fh.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...u0(r)});let M8=class xae extends k0{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Cc.bigint)return this._getInvalidInput(e);let n;const i=new V5;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):wv.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Xl(t,{code:Ko.invalid_type,expected:Cc.bigint,received:t.parsedType}),Th}gte(e,t){return this.setLimit("min",e,!0,Qu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Qu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Qu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Qu.toString(t))}setLimit(e,t,n,i){return new xae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Qu.toString(i)}]})}_addCheck(e){return new xae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Qu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Qu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Qu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Qu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Qu.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};M8.create=r=>{var e;return new M8({checks:[],typeName:fh.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...u0(r)})};let C8=class extends k0{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cc.boolean){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.boolean,received:n.parsedType}),Th}return S5(e.data)}};C8.create=r=>new C8({typeName:fh.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...u0(r)});let R8=class cIe extends k0{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cc.date){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.date,received:a.parsedType}),Th}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_date}),Th}const n=new V5;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):wv.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new cIe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Qu.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Qu.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};R8.create=r=>new R8({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:fh.ZodDate,...u0(r)});let XR=class extends k0{_parse(e){if(this._getType(e)!==Cc.symbol){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.symbol,received:n.parsedType}),Th}return S5(e.data)}};XR.create=r=>new XR({typeName:fh.ZodSymbol,...u0(r)});let A8=class extends k0{_parse(e){if(this._getType(e)!==Cc.undefined){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.undefined,received:n.parsedType}),Th}return S5(e.data)}};A8.create=r=>new A8({typeName:fh.ZodUndefined,...u0(r)});let N8=class extends k0{_parse(e){if(this._getType(e)!==Cc.null){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.null,received:n.parsedType}),Th}return S5(e.data)}};N8.create=r=>new N8({typeName:fh.ZodNull,...u0(r)});let oT=class extends k0{constructor(){super(...arguments),this._any=!0}_parse(e){return S5(e.data)}};oT.create=r=>new oT({typeName:fh.ZodAny,...u0(r)});let mE=class extends k0{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S5(e.data)}};mE.create=r=>new mE({typeName:fh.ZodUnknown,...u0(r)});let bS=class extends k0{_parse(e){const t=this._getOrReturnCtx(e);return Xl(t,{code:Ko.invalid_type,expected:Cc.never,received:t.parsedType}),Th}};bS.create=r=>new bS({typeName:fh.ZodNever,...u0(r)});let WR=class extends k0{_parse(e){if(this._getType(e)!==Cc.undefined){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.void,received:n.parsedType}),Th}return S5(e.data)}};WR.create=r=>new WR({typeName:fh.ZodVoid,...u0(r)});let vE=class SI extends k0{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Cc.array)return Xl(t,{code:Ko.invalid_type,expected:Cc.array,received:t.parsedType}),Th;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;(o||s)&&(Xl(t,{code:o?Ko.too_big:Ko.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Xl(t,{code:Ko.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Xl(t,{code:Ko.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Ub(t,o,t.path,s)))).then(o=>V5.mergeArray(n,o));const a=[...t.data].map((o,s)=>i.type._parseSync(new Ub(t,o,t.path,s)));return V5.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new SI({...this._def,minLength:{value:e,message:Qu.toString(t)}})}max(e,t){return new SI({...this._def,maxLength:{value:e,message:Qu.toString(t)}})}length(e,t){return new SI({...this._def,exactLength:{value:e,message:Qu.toString(t)}})}nonempty(e){return this.min(1,e)}};vE.create=(r,e)=>new vE({type:r,minLength:null,maxLength:null,exactLength:null,typeName:fh.ZodArray,...u0(e)});function sT(r){if(r instanceof U3){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Ib.create(sT(n))}return new U3({...r._def,shape:()=>e})}else return r instanceof vE?new vE({...r._def,type:sT(r.element)}):r instanceof Ib?Ib.create(sT(r.unwrap())):r instanceof m4?m4.create(sT(r.unwrap())):r instanceof p4?p4.create(r.items.map(e=>sT(e))):r}let U3=class Pb extends k0{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=wv.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Cc.object){const c=this._getOrReturnCtx(e);return Xl(c,{code:Ko.invalid_type,expected:Cc.object,received:c.parsedType}),Th}const{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof bS&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const u=a[c],f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ub(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof bS){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")s.length>0&&(Xl(i,{code:Ko.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of s){const f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ub(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,m=await u.value;c.push({key:f,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>V5.mergeObjectSync(n,c)):V5.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Qu.errToObj,new Pb({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,a,o,s;const l=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(s=Qu.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Pb({...this._def,unknownKeys:"strip"})}passthrough(){return new Pb({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pb({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pb({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:fh.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Pb({...this._def,catchall:e})}pick(e){const t={};return wv.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Pb({...this._def,shape:()=>t})}omit(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Pb({...this._def,shape:()=>t})}deepPartial(){return sT(this)}partial(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new Pb({...this._def,shape:()=>t})}required(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ib;)a=a._def.innerType;t[n]=a}}),new Pb({...this._def,shape:()=>t})}keyof(){return Zoe(wv.objectKeys(this.shape))}};U3.create=(r,e)=>new U3({shape:()=>r,unknownKeys:"strip",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)}),U3.strictCreate=(r,e)=>new U3({shape:()=>r,unknownKeys:"strict",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)}),U3.lazycreate=(r,e)=>new U3({shape:r,unknownKeys:"strip",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)});let P8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(s=>new ab(s.ctx.common.issues));return Xl(t,{code:Ko.invalid_union,unionErrors:o}),Th}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(l=>new ab(l));return Xl(t,{code:Ko.invalid_union,unionErrors:s}),Th}}get options(){return this._def.options}};P8.create=(r,e)=>new P8({options:r,typeName:fh.ZodUnion,...u0(e)});const SS=r=>r instanceof L8?SS(r.schema):r instanceof ob?SS(r.innerType()):r instanceof O8?[r.value]:r instanceof z8?r.options:r instanceof U8?wv.objectValues(r.enum):r instanceof I8?SS(r._def.innerType):r instanceof A8?[void 0]:r instanceof N8?[null]:r instanceof Ib?[void 0,...SS(r.unwrap())]:r instanceof m4?[null,...SS(r.unwrap())]:r instanceof QI||r instanceof F8?SS(r.unwrap()):r instanceof k8?SS(r._def.innerType):[];let Xoe=class uIe extends k0{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.object)return Xl(t,{code:Ko.invalid_type,expected:Cc.object,received:t.parsedType}),Th;const n=this.discriminator,i=t.data[n],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Xl(t,{code:Ko.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Th)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const a of t){const o=SS(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new uIe({typeName:fh.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...u0(n)})}};function ZI(r,e){const t=xS(r),n=xS(e);if(r===e)return{valid:!0,data:r};if(t===Cc.object&&n===Cc.object){const i=wv.objectKeys(e),a=wv.objectKeys(r).filter(s=>i.indexOf(s)!==-1),o={...r,...e};for(const s of a){const l=ZI(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===Cc.array&&n===Cc.array){if(r.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<r.length;a++){const o=r[a],s=e[a],l=ZI(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Cc.date&&n===Cc.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let D8=class extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(XI(a)||XI(o))return Th;const s=ZI(a.value,o.value);return s.valid?((WI(a)||WI(o))&&t.dirty(),{status:t.value,value:s.data}):(Xl(n,{code:Ko.invalid_intersection_types}),Th)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};D8.create=(r,e,t)=>new D8({left:r,right:e,typeName:fh.ZodIntersection,...u0(t)});let p4=class fIe extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.array)return Xl(n,{code:Ko.invalid_type,expected:Cc.array,received:n.parsedType}),Th;if(n.data.length<this._def.items.length)return Xl(n,{code:Ko.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Th;!this._def.rest&&n.data.length>this._def.items.length&&(Xl(n,{code:Ko.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ub(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>V5.mergeArray(t,o)):V5.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new fIe({...this._def,rest:e})}};p4.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new p4({items:r,typeName:fh.ZodTuple,rest:null,...u0(e)})};let Woe=class bae extends k0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.object)return Xl(n,{code:Ko.invalid_type,expected:Cc.object,received:n.parsedType}),Th;const i=[],a=this._def.keyType,o=this._def.valueType;for(const s in n.data)i.push({key:a._parse(new Ub(n,s,n.path,s)),value:o._parse(new Ub(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?V5.mergeObjectAsync(t,i):V5.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof k0?new bae({keyType:e,valueType:t,typeName:fh.ZodRecord,...u0(n)}):new bae({keyType:aT.create(),valueType:e,typeName:fh.ZodRecord,...u0(t)})}},$R=class extends k0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.map)return Xl(n,{code:Ko.invalid_type,expected:Cc.map,received:n.parsedType}),Th;const i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:i._parse(new Ub(n,s,n.path,[c,"key"])),value:a._parse(new Ub(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Th;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Th;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};$R.create=(r,e,t)=>new $R({valueType:e,keyType:r,typeName:fh.ZodMap,...u0(t)});let ZR=class Sae extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.set)return Xl(n,{code:Ko.invalid_type,expected:Cc.set,received:n.parsedType}),Th;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Xl(n,{code:Ko.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Xl(n,{code:Ko.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const a=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Th;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>a._parse(new Ub(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Sae({...this._def,minSize:{value:e,message:Qu.toString(t)}})}max(e,t){return new Sae({...this._def,maxSize:{value:e,message:Qu.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ZR.create=(r,e)=>new ZR({valueType:r,minSize:null,maxSize:null,typeName:fh.ZodSet,...u0(e)});let $oe=class EI extends k0{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.function)return Xl(t,{code:Ko.invalid_type,expected:Cc.function,received:t.parsedType}),Th;function n(s,l){return qR({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,GR(),rT].filter(c=>!!c),issueData:{code:Ko.invalid_arguments,argumentsError:l}})}function i(s,l){return qR({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,GR(),rT].filter(c=>!!c),issueData:{code:Ko.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof lT){const s=this;return S5(async function(...l){const c=new ab([]),u=await s._def.args.parseAsync(l,a).catch(_=>{throw c.addIssue(n(l,_)),c}),f=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(f,a).catch(_=>{throw c.addIssue(i(f,_)),c})})}else{const s=this;return S5(function(...l){const c=s._def.args.safeParse(l,a);if(!c.success)throw new ab([n(l,c.error)]);const u=Reflect.apply(o,this,c.data),f=s._def.returns.safeParse(u,a);if(!f.success)throw new ab([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new EI({...this._def,args:p4.create(e).rest(mE.create())})}returns(e){return new EI({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new EI({args:e||p4.create([]).rest(mE.create()),returns:t||mE.create(),typeName:fh.ZodFunction,...u0(n)})}},L8=class extends k0{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};L8.create=(r,e)=>new L8({getter:r,typeName:fh.ZodLazy,...u0(e)});let O8=class extends k0{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Xl(t,{received:t.data,code:Ko.invalid_literal,expected:this._def.value}),Th}return{status:"valid",value:e.data}}get value(){return this._def.value}};O8.create=(r,e)=>new O8({value:r,typeName:fh.ZodLiteral,...u0(e)});function Zoe(r,e){return new z8({values:r,typeName:fh.ZodEnum,...u0(e)})}let z8=class Eae extends k0{constructor(){super(...arguments),E8.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return Xl(t,{expected:wv.joinValues(n),received:t.parsedType,code:Ko.invalid_type}),Th}if(YR(this,E8)||joe(this,E8,new Set(this._def.values)),!YR(this,E8).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Xl(t,{received:t.data,code:Ko.invalid_enum_value,options:n}),Th}return S5(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Eae.create(e,{...this._def,...t})}exclude(e,t=this._def){return Eae.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};E8=new WeakMap,z8.create=Zoe;let U8=class extends k0{constructor(){super(...arguments),w8.set(this,void 0)}_parse(e){const t=wv.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Cc.string&&n.parsedType!==Cc.number){const i=wv.objectValues(t);return Xl(n,{expected:wv.joinValues(i),received:n.parsedType,code:Ko.invalid_type}),Th}if(YR(this,w8)||joe(this,w8,new Set(wv.getValidEnumValues(this._def.values))),!YR(this,w8).has(e.data)){const i=wv.objectValues(t);return Xl(n,{received:n.data,code:Ko.invalid_enum_value,options:i}),Th}return S5(e.data)}get enum(){return this._def.values}};w8=new WeakMap,U8.create=(r,e)=>new U8({values:r,typeName:fh.ZodNativeEnum,...u0(e)});let lT=class extends k0{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.promise&&t.common.async===!1)return Xl(t,{code:Ko.invalid_type,expected:Cc.promise,received:t.parsedType}),Th;const n=t.parsedType===Cc.promise?t.data:Promise.resolve(t.data);return S5(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};lT.create=(r,e)=>new lT({type:r,typeName:fh.ZodPromise,...u0(e)});let ob=class extends k0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fh.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{Xl(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return Th;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Th:l.status==="dirty"||t.value==="dirty"?iT(l.value):l});{if(t.value==="aborted")return Th;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Th:s.status==="dirty"||t.value==="dirty"?iT(s.value):s}}if(i.type==="refinement"){const o=s=>{const l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Th:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Th:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pE(o))return o;const s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>pE(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:t.value,value:s})):o);wv.assertNever(i)}};ob.create=(r,e,t)=>new ob({schema:r,typeName:fh.ZodEffects,effect:e,...u0(t)}),ob.createWithPreprocess=(r,e,t)=>new ob({schema:e,effect:{type:"preprocess",transform:r},typeName:fh.ZodEffects,...u0(t)});let Ib=class extends k0{_parse(e){return this._getType(e)===Cc.undefined?S5(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ib.create=(r,e)=>new Ib({innerType:r,typeName:fh.ZodOptional,...u0(e)});let m4=class extends k0{_parse(e){return this._getType(e)===Cc.null?S5(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};m4.create=(r,e)=>new m4({innerType:r,typeName:fh.ZodNullable,...u0(e)});let I8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Cc.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};I8.create=(r,e)=>new I8({innerType:r,typeName:fh.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...u0(e)});let k8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return S8(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ab(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ab(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};k8.create=(r,e)=>new k8({innerType:r,typeName:fh.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...u0(e)});let QR=class extends k0{_parse(e){if(this._getType(e)!==Cc.nan){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.nan,received:n.parsedType}),Th}return{status:"valid",value:e.data}}};QR.create=r=>new QR({typeName:fh.ZodNaN,...u0(r)});const oBe=Symbol("zod_brand");let QI=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},KI=class dIe extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Th:a.status==="dirty"?(t.dirty(),iT(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Th:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new dIe({in:e,out:t,typeName:fh.ZodPipeline})}},F8=class extends k0{_parse(e){const t=this._def.innerType._parse(e),n=i=>(pE(i)&&(i.value=Object.freeze(i.value)),i);return S8(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};F8.create=(r,e)=>new F8({innerType:r,typeName:fh.ZodReadonly,...u0(e)});function Qoe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Koe(r,e={},t){return r?oT.create().superRefine((n,i)=>{var a,o;const s=r(n);if(s instanceof Promise)return s.then(l=>{var c,u;if(!l){const f=Qoe(e,n),m=(u=(c=f.fatal)!==null&&c!==void 0?c:t)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...f,fatal:m})}});if(!s){const l=Qoe(e,n),c=(o=(a=l.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0;i.addIssue({code:"custom",...l,fatal:c})}}):oT.create()}const sBe={object:U3.lazycreate};var fh;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(fh||(fh={}));const lBe=(r,e={message:`Input not instance of ${r.name}`})=>Koe(t=>t instanceof r,e),Joe=aT.create,ese=T8.create,cBe=QR.create,uBe=M8.create,tse=C8.create,fBe=R8.create,dBe=XR.create,hBe=A8.create,pBe=N8.create,mBe=oT.create,vBe=mE.create,yBe=bS.create,gBe=WR.create,_Be=vE.create,xBe=U3.create,bBe=U3.strictCreate,SBe=P8.create,EBe=Xoe.create,wBe=D8.create,TBe=p4.create,MBe=Woe.create,CBe=$R.create,RBe=ZR.create,ABe=$oe.create,NBe=L8.create,PBe=O8.create,DBe=z8.create,LBe=U8.create,OBe=lT.create,nse=ob.create,zBe=Ib.create,UBe=m4.create,IBe=ob.createWithPreprocess,kBe=KI.create;var le=Object.freeze({__proto__:null,defaultErrorMap:rT,setErrorMap:IFe,getErrorMap:GR,makeIssue:qR,EMPTY_PATH:kFe,addIssueToContext:Xl,ParseStatus:V5,INVALID:Th,DIRTY:iT,OK:S5,isAborted:XI,isDirty:WI,isValid:pE,isAsync:S8,get util(){return wv},get objectUtil(){return YI},ZodParsedType:Cc,getParsedType:xS,ZodType:k0,datetimeRegex:Yoe,ZodString:aT,ZodNumber:T8,ZodBigInt:M8,ZodBoolean:C8,ZodDate:R8,ZodSymbol:XR,ZodUndefined:A8,ZodNull:N8,ZodAny:oT,ZodUnknown:mE,ZodNever:bS,ZodVoid:WR,ZodArray:vE,ZodObject:U3,ZodUnion:P8,ZodDiscriminatedUnion:Xoe,ZodIntersection:D8,ZodTuple:p4,ZodRecord:Woe,ZodMap:$R,ZodSet:ZR,ZodFunction:$oe,ZodLazy:L8,ZodLiteral:O8,ZodEnum:z8,ZodNativeEnum:U8,ZodPromise:lT,ZodEffects:ob,ZodTransformer:ob,ZodOptional:Ib,ZodNullable:m4,ZodDefault:I8,ZodCatch:k8,ZodNaN:QR,BRAND:oBe,ZodBranded:QI,ZodPipeline:KI,ZodReadonly:F8,custom:Koe,Schema:k0,ZodSchema:k0,late:sBe,get ZodFirstPartyTypeKind(){return fh},coerce:{string:r=>aT.create({...r,coerce:!0}),number:r=>T8.create({...r,coerce:!0}),boolean:r=>C8.create({...r,coerce:!0}),bigint:r=>M8.create({...r,coerce:!0}),date:r=>R8.create({...r,coerce:!0})},any:mBe,array:_Be,bigint:uBe,boolean:tse,date:fBe,discriminatedUnion:EBe,effect:nse,enum:DBe,function:ABe,instanceof:lBe,intersection:wBe,lazy:NBe,literal:PBe,map:CBe,nan:cBe,nativeEnum:LBe,never:yBe,null:pBe,nullable:UBe,number:ese,object:xBe,oboolean:()=>tse().optional(),onumber:()=>ese().optional(),optional:zBe,ostring:()=>Joe().optional(),pipeline:kBe,preprocess:IBe,promise:OBe,record:MBe,set:RBe,strictObject:bBe,string:Joe,symbol:dBe,transformer:nse,tuple:TBe,undefined:hBe,union:SBe,unknown:vBe,void:gBe,NEVER:Th,ZodIssueCode:Ko,quotelessJson:UFe,ZodError:ab}),rse={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},B8=r=>{let e=typeof r=="number"?"mm":r.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof r=="number"?r:Number.parseFloat(r.split(e)[0]);if(e in rse)return t*rse[e];throw new Error(`Unsupported unit: ${e}`)},H8=B8;const FBe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let JI=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=FBe[t[r]&63];return e};var ise={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:{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}}},ek=new Set;for(const[r,e]of Object.entries(ise)){ek.add(r);for(const t of Object.keys(e.variants))ek.add(t)}function BBe(r){for(const[e,t]of Object.entries(ise))if(r in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[r]};return{baseUnit:r,conversionFactor:1}}var ase={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},sb=r=>{var s;if(typeof r>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof r=="string"&&r.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(r),parsedUnit:null,unitOfValue:null};if(typeof r=="number")return{value:r,parsedUnit:null,unitOfValue:null};if(typeof r=="object"&&"x"in r&&"y"in r){const{parsedUnit:l,unitOfValue:c}=sb(r.x);return{parsedUnit:l,unitOfValue:c,value:{x:sb(r.x).value,y:sb(r.y).value}}}const t=(s=r.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${r}"`);const n=t.split("").reverse().join(""),i=r.slice(0,-n.length);if(n in ase&&!ek.has(n)){const l=ase[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=BBe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(i)}},KR=le.string().or(le.number()).transform(r=>sb(r).value),tk=le.string().or(le.number()).transform(r=>sb(r).value).transform(r=>Number.parseFloat(r.toPrecision(12))),ose=le.string().or(le.number()).transform(r=>sb(r).value),JR=le.string().or(le.number()).transform(r=>sb(r).value),jn=le.string().or(le.number()).transform(r=>sb(r).value),sse=le.string().or(le.number()).transform(r=>sb(r).value),Wl=jn,HBe=le.string().or(le.number()).transform(r=>sb(r).value),jBe=le.string().or(le.number()).transform(r=>sb(r).value),nk=le.string().or(le.number()).transform(r=>typeof r=="number"?r:r.endsWith("deg")?Number.parseFloat(r.split("deg")[0]):r.endsWith("rad")?Number.parseFloat(r.split("rad")[0])*180/Math.PI:Number.parseFloat(r)),lse=le.number().or(le.string().endsWith("mAh")).transform(r=>{if(typeof r=="string"){const e=r.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return r}).describe("Battery capacity in mAh"),rg=le.object({x:Wl,y:Wl}),VBe=rg,j8=le.object({x:Wl,y:Wl,z:Wl}),GBe=j8,rk=le.object({width:le.number(),height:le.number()}),Tv=r=>le.string().optional().default(()=>`${r}_${JI(10)}`),cse=le.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),a2=le.object({type:le.literal("source_component"),ftype:le.string().optional(),source_component_id:le.string(),name:le.string(),manufacturer_part_number:le.string().optional(),supplier_part_numbers:le.record(cse,le.array(le.string())).optional(),display_value:le.string().optional()}),ik=a2.extend({ftype:le.literal("simple_capacitor"),capacitance:tk,max_voltage_rating:JR.optional(),display_capacitance:le.string().optional(),max_decoupling_trace_length:Wl.optional()}),ak=a2.extend({ftype:le.literal("simple_resistor"),resistance:KR,display_resistance:le.string().optional()}),eA=a2.extend({ftype:le.literal("simple_diode")}),use=a2.extend({ftype:le.literal("simple_ground")}),ok=a2.extend({ftype:le.literal("simple_bug")}).describe("@deprecated"),sk=a2.extend({ftype:le.literal("simple_chip")}),lk=eA.extend({ftype:le.literal("led")}),ck=a2.extend({ftype:le.literal("simple_power_source"),voltage:JR}),uk=a2.extend({ftype:le.literal("simple_battery"),capacity:lse}),fk=a2.extend({ftype:le.literal("simple_inductor"),inductance:ose}),dk=a2.extend({ftype:le.literal("simple_push_button")}),hk=a2.extend({ftype:le.literal("simple_potentiometer"),max_resistance:KR}),fse=a2.extend({ftype:le.literal("simple_crystal"),frequency:le.number().describe("Frequency in Hz"),load_capacitance:le.number().optional().describe("Load capacitance in pF")}),pk=a2.extend({ftype:le.literal("simple_pin_header"),pin_count:le.number(),gender:le.enum(["male","female"]).optional().default("male")}),mk=a2.extend({ftype:le.literal("simple_resonator"),load_capacitance:tk,equivalent_series_resistance:KR.optional(),frequency:sse}),vk=a2.extend({ftype:le.literal("simple_transistor"),transistor_type:le.enum(["npn","pnp"])}),yk=a2.extend({ftype:le.literal("simple_mosfet"),channel_type:le.enum(["n","p"]),mosfet_mode:le.enum(["enhancement","depletion"])}),gk=a2.extend({ftype:le.literal("simple_switch")}),dse=le.union([ak,ik,eA,use,sk,ok,lk,ck,uk,fk,dk,hk,fse,pk,mk,gk,vk,yk]),hse=le.object({type:le.literal("source_port"),pin_number:le.number().optional(),port_hints:le.array(le.string()).optional(),name:le.string(),source_port_id:le.string(),source_component_id:le.string(),subcircuit_id:le.string().optional()}),pse=le.object({type:le.literal("source_trace"),source_trace_id:le.string(),connected_source_port_ids:le.array(le.string()),connected_source_net_ids:le.array(le.string()),subcircuit_id:le.string().optional(),subcircuit_connectivity_map_key:le.string().optional(),max_length:le.number().optional(),display_name:le.string().optional()}),mse=le.object({type:le.literal("source_group"),source_group_id:le.string(),subcircuit_id:le.string().optional(),parent_subcircuit_id:le.string().optional(),is_subcircuit:le.boolean().optional(),name:le.string().optional()}),vse=le.object({type:le.literal("source_net"),source_net_id:le.string(),name:le.string(),member_source_group_ids:le.array(le.string()),is_power:le.boolean().optional(),is_ground:le.boolean().optional(),is_digital_signal:le.boolean().optional(),is_analog_signal:le.boolean().optional(),trace_width:le.number().optional(),subcircuit_id:le.string().optional()}),yse=le.object({type:le.literal("schematic_box"),schematic_component_id:le.string(),width:Wl,height:Wl,x:Wl,y:Wl}).describe("Draws a box on the schematic"),gse=le.object({type:le.literal("schematic_path"),schematic_component_id:le.string(),fill_color:le.enum(["red","blue"]).optional(),is_filled:le.boolean().optional(),points:le.array(rg)}),_se=le.record(le.object({left_margin:jn.optional(),right_margin:jn.optional(),top_margin:jn.optional(),bottom_margin:jn.optional()})),xse=le.object({left_size:le.number(),right_size:le.number(),top_size:le.number().optional(),bottom_size:le.number().optional()}),bse=le.object({left_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional()}),Sse=le.union([xse,bse]),Ese=le.object({type:le.literal("schematic_component"),size:rk,center:rg,source_component_id:le.string(),schematic_component_id:le.string(),pin_spacing:jn.optional(),pin_styles:_se.optional(),box_width:jn.optional(),symbol_name:le.string().optional(),port_arrangement:Sse.optional(),port_labels:le.record(le.string()).optional(),symbol_display_value:le.string().optional()}),wse=le.object({type:le.literal("schematic_line"),schematic_component_id:le.string(),x1:Wl,x2:Wl,y1:Wl,y2:Wl}),Tse=le.object({type:le.literal("schematic_trace"),schematic_trace_id:le.string(),source_trace_id:le.string(),junctions:le.array(le.object({x:le.number(),y:le.number()})),edges:le.array(le.object({from:le.object({x:le.number(),y:le.number()}),to:le.object({x:le.number(),y:le.number()}),is_crossing:le.boolean().optional(),from_schematic_port_id:le.string().optional(),to_schematic_port_id:le.string().optional()}))}),Mse=le.object({type:le.literal("schematic_text"),schematic_component_id:le.string(),schematic_text_id:le.string(),text:le.string(),position:le.object({x:Wl,y:Wl}),rotation:le.number().default(0),anchor:le.enum(["center","left","right","top","bottom"]).default("center"),color:le.string().default("#000000")}),Cse=le.object({type:le.literal("schematic_port"),schematic_port_id:le.string(),source_port_id:le.string(),schematic_component_id:le.string().optional(),center:rg,facing_direction:le.enum(["up","down","left","right"]).optional(),distance_from_component_edge:le.number().optional(),side_of_component:le.enum(["top","bottom","left","right"]).optional(),true_ccw_index:le.number().optional(),pin_number:le.number().optional(),display_pin_label:le.string().optional()}).describe("Defines a port on a schematic component"),Rse=le.object({type:le.literal("schematic_net_label"),source_net_id:le.string(),center:rg,anchor_position:rg.optional(),anchor_side:le.enum(["top","bottom","left","right"]),text:le.string(),symbol_name:le.string().optional()}),Ase=le.object({type:le.literal("schematic_error"),schematic_error_id:le.string(),error_type:le.literal("schematic_port_not_found"),message:le.string()}).describe("Defines a schematic error on the schematic"),tA=le.object({type:le.literal("schematic_debug_object"),label:le.string().optional()}),Nse=tA.extend({shape:le.literal("rect"),center:rg,size:rk}),Pse=tA.extend({shape:le.literal("line"),start:rg,end:rg}),Dse=tA.extend({shape:le.literal("point"),center:rg}),Lse=le.discriminatedUnion("shape",[Nse,Pse,Dse]),Ose=le.object({type:le.literal("schematic_voltage_probe"),schematic_voltage_probe_id:le.string(),position:rg,schematic_trace_id:le.string(),voltage:JR.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),zse=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],_k=le.enum(zse),u_=_k.or(le.object({name:_k})).transform(r=>typeof r=="string"?r:r.name),cT=le.enum(["top","bottom"]),Use=le.object({x:Wl,y:Wl,via:le.boolean().optional(),via_to_layer:u_.optional()}),qBe=le.array(Use),Ise=le.object({x:Wl,y:Wl,via:le.boolean().optional(),to_layer:u_.optional(),trace_width:Wl.optional()}),kse=le.object({type:le.literal("pcb_component"),pcb_component_id:Tv("pcb_component"),source_component_id:le.string(),center:rg,layer:u_,rotation:nk,width:jn,height:jn,subcircuit_id:le.string().optional()}).describe("Defines a component on the PCB"),Fse=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Tv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.enum(["circle","square"]),hole_diameter:le.number(),x:Wl,y:Wl}),YBe=Fse.describe("Defines a circular or square hole on the PCB"),Bse=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Tv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("oval"),hole_width:le.number(),hole_height:le.number(),x:Wl,y:Wl}),XBe=Bse.describe("Defines an oval hole on the PCB"),Hse=Fse.or(Bse),WBe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_diameter:le.number(),hole_diameter:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),$Be=le.object({type:le.literal("pcb_plated_hole"),shape:le.enum(["oval","pill"]),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_width:le.number(),outer_height:le.number(),hole_width:le.number(),hole_height:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),ZBe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circular_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("circle"),pad_shape:le.literal("rect"),hole_diameter:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),jse=le.union([WBe,$Be,ZBe]),Vse=le.object({type:le.literal("pcb_port"),pcb_port_id:Tv("pcb_port"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_port_id:le.string(),pcb_component_id:le.string(),x:Wl,y:Wl,layers:le.array(u_)}).describe("Defines a port on the PCB"),QBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("circle"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,radius:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),KBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rect"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),JBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rotated_rect"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),ccw_rotation:nk,layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),Gse=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("pill"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),radius:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),qse=le.union([QBe,KBe,JBe,Gse]).describe("Defines an SMT pad on the PCB"),eHe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("circle"),pcb_solder_paste_id:Tv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,radius:le.number(),layer:u_,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),tHe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("rect"),pcb_solder_paste_id:Tv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),layer:u_,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),Yse=le.union([eHe,tHe]).describe("Defines solderpaste on the PCB"),Xse=le.object({type:le.literal("pcb_text"),pcb_text_id:Tv("pcb_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),text:le.string(),center:rg,layer:u_,width:jn,height:jn,lines:le.number(),align:le.enum(["bottom-left"])}).describe("Defines text on the PCB"),Wse=le.object({route_type:le.literal("wire"),x:Wl,y:Wl,width:Wl,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:u_}),$se=le.object({route_type:le.literal("via"),x:Wl,y:Wl,from_layer:le.string(),to_layer:le.string()}),nHe=le.union([Wse,$se]),Zse=le.object({type:le.literal("pcb_trace"),source_trace_id:le.string().optional(),pcb_component_id:le.string().optional(),pcb_trace_id:Tv("pcb_trace"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),route_thickness_mode:le.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:le.number().optional(),should_round_corners:le.boolean().optional(),trace_length:le.number().optional(),route:le.array(le.union([le.object({route_type:le.literal("wire"),x:Wl,y:Wl,width:Wl,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:u_}),le.object({route_type:le.literal("via"),x:Wl,y:Wl,from_layer:le.string(),to_layer:le.string()})]))}).describe("Defines a trace on the PCB"),Qse=le.object({type:le.literal("pcb_trace_error"),pcb_trace_error_id:Tv("pcb_trace_error"),error_type:le.literal("pcb_trace_error"),message:le.string(),center:rg.optional(),pcb_trace_id:le.string(),source_trace_id:le.string(),pcb_component_ids:le.array(le.string()),pcb_port_ids:le.array(le.string())}).describe("Defines a trace error on the PCB"),Kse=le.object({type:le.literal("pcb_port_not_matched_error"),pcb_error_id:Tv("pcb_error"),message:le.string(),pcb_component_ids:le.array(le.string())}).describe("Defines a trace error on the PCB where a port is not matched"),Jse=le.object({type:le.literal("pcb_via"),pcb_via_id:Tv("pcb_via"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,outer_diameter:Wl.default("0.6mm"),hole_diameter:Wl.default("0.25mm"),from_layer:u_.optional(),to_layer:u_.optional(),layers:le.array(u_),pcb_trace_id:le.string().optional()}).describe("Defines a via on the PCB"),ele=le.object({type:le.literal("pcb_board"),pcb_board_id:Tv("pcb_board"),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:jn,height:jn,center:rg,thickness:jn.optional().default(1.4),num_layers:le.number().optional().default(4),outline:le.array(rg).optional()}).describe("Defines the board outline of the PCB"),tle=le.object({type:le.literal("pcb_placement_error"),pcb_placement_error_id:Tv("pcb_placement_error"),message:le.string()}).describe("Defines a placement error on the PCB"),nle=le.object({type:le.literal("pcb_trace_hint"),pcb_trace_hint_id:Tv("pcb_trace_hint"),pcb_port_id:le.string(),pcb_component_id:le.string(),route:le.array(Ise)}).describe("A hint that can be used during generation of a PCB trace"),rle=le.object({type:le.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:Tv("pcb_silkscreen_line"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),stroke_width:Wl.default("0.1mm"),x1:Wl,y1:Wl,x2:Wl,y2:Wl,layer:cT}).describe("Defines a silkscreen line on the PCB"),ile=le.object({type:le.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:Tv("pcb_silkscreen_path"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),layer:cT,route:le.array(rg),stroke_width:jn}).describe("Defines a silkscreen path on the PCB"),ale=le.object({type:le.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:Tv("pcb_silkscreen_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:Wl.default("0.2mm"),pcb_component_id:le.string(),text:le.string(),ccw_rotation:le.number().optional(),layer:u_,is_mirrored:le.boolean().default(!1).optional(),anchor_position:rg.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),ole=le.object({type:le.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Tv("pcb_silkscreen_rect"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,width:jn,height:jn,layer:u_,stroke_width:jn.default("1mm")}).describe("Defines a silkscreen rect on the PCB"),sle=le.object({type:le.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Tv("pcb_silkscreen_circle"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius:jn,layer:cT,stroke_width:jn.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),lle=le.object({type:le.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Tv("pcb_silkscreen_oval"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius_x:Wl,radius_y:Wl,layer:cT}).describe("Defines a silkscreen oval on the PCB"),cle=le.object({type:le.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Tv("pcb_fabrication_note_text"),subcircuit_id:le.string().optional(),pcb_group_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:Wl.default("1mm"),pcb_component_id:le.string(),text:le.string(),layer:cT,anchor_position:rg.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:le.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),ule=le.object({type:le.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Tv("pcb_fabrication_note_path"),pcb_component_id:le.string(),subcircuit_id:le.string().optional(),layer:u_,route:le.array(rg),stroke_width:jn,color:le.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),fle=le.object({type:le.literal("pcb_keepout"),shape:le.literal("rect"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,width:Wl,height:Wl,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()}).or(le.object({type:le.literal("pcb_keepout"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius:Wl,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()})),dle=le.object({type:le.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Tv("pcb_missing_footprint_error"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),error_type:le.literal("pcb_missing_footprint_error"),source_component_id:le.string(),message:le.string()}).describe("Defines a missing footprint error on the PCB"),hle=le.object({type:le.literal("pcb_manual_edit_conflict_error"),pcb_error_id:Tv("pcb_manual_edit_conflict_error"),message:le.string(),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_component_id:le.string()}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),ple=le.object({type:le.literal("pcb_group"),pcb_group_id:Tv("pcb_group"),source_group_id:le.string(),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:jn,height:jn,center:rg,pcb_component_ids:le.array(le.string()),name:le.string().optional(),description:le.string().optional()}).describe("Defines a group of components on the PCB"),mle=le.object({type:le.literal("pcb_autorouting_error"),pcb_error_id:Tv("pcb_autorouting_error"),message:le.string()}).describe("The autorouting has failed to route a portion of the board"),vle=le.object({type:le.literal("cad_component"),cad_component_id:le.string(),pcb_component_id:le.string(),source_component_id:le.string(),position:j8,rotation:j8.optional(),size:j8.optional(),layer:u_.optional(),footprinter_string:le.string().optional(),model_obj_url:le.string().optional(),model_stl_url:le.string().optional(),model_3mf_url:le.string().optional(),model_jscad:le.any().optional()}).describe("Defines a component on the PCB"),yle=le.union([pse,hse,dse,lk,vse,mse,ok,sk,ik,eA,ak,ck,uk,fk,pk,mk,gk,vk,yk,hk,dk,kse,Hse,dle,hle,jse,fle,Vse,Xse,Zse,Jse,qse,Yse,ele,ple,nle,rle,ile,ale,ole,sle,lle,Qse,tle,Kse,ule,cle,mle,yse,Mse,wse,Ese,Cse,Tse,gse,Ase,Rse,Lse,Ose,vle]),xk=yle;const gle=Object.freeze(Object.defineProperty({__proto__:null,all_layers:zse,any_circuit_element:yle,any_soup_element:xk,any_source_component:dse,battery_capacity:lse,cad_component:vle,capacitance:tk,current:HBe,distance:Wl,frequency:sse,getZodPrefixedIdWithDefault:Tv,inductance:ose,layer_ref:u_,layer_string:_k,length:jn,pcb_autorouting_error:mle,pcb_board:ele,pcb_component:kse,pcb_fabrication_note_path:ule,pcb_fabrication_note_text:cle,pcb_group:ple,pcb_hole:Hse,pcb_hole_circle_or_square_shape:YBe,pcb_hole_oval_shape:XBe,pcb_keepout:fle,pcb_manual_edit_conflict_error:hle,pcb_missing_footprint_error:dle,pcb_placement_error:tle,pcb_plated_hole:jse,pcb_port:Vse,pcb_port_not_matched_error:Kse,pcb_route_hint:Use,pcb_route_hints:qBe,pcb_silkscreen_circle:sle,pcb_silkscreen_line:rle,pcb_silkscreen_oval:lle,pcb_silkscreen_path:ile,pcb_silkscreen_rect:ole,pcb_silkscreen_text:ale,pcb_smtpad:qse,pcb_smtpad_pill:Gse,pcb_solder_paste:Yse,pcb_text:Xse,pcb_trace:Zse,pcb_trace_error:Qse,pcb_trace_hint:nle,pcb_trace_route_point:nHe,pcb_trace_route_point_via:$se,pcb_trace_route_point_wire:Wse,pcb_via:Jse,point:rg,point3:j8,port_arrangement:Sse,position:VBe,position3:GBe,resistance:KR,rotation:nk,route_hint_point:Ise,schematic_box:yse,schematic_component:Ese,schematic_component_port_arrangement_by_sides:bse,schematic_component_port_arrangement_by_size:xse,schematic_debug_line:Pse,schematic_debug_object:Lse,schematic_debug_object_base:tA,schematic_debug_point:Dse,schematic_debug_rect:Nse,schematic_error:Ase,schematic_line:wse,schematic_net_label:Rse,schematic_path:gse,schematic_pin_styles:_se,schematic_port:Cse,schematic_text:Mse,schematic_trace:Tse,schematic_voltage_probe:Ose,size:rk,source_component_base:a2,source_group:mse,source_led:lk,source_net:vse,source_port:hse,source_simple_battery:uk,source_simple_bug:ok,source_simple_capacitor:ik,source_simple_chip:sk,source_simple_crystal:fse,source_simple_diode:eA,source_simple_ground:use,source_simple_inductor:fk,source_simple_mosfet:yk,source_simple_pin_header:pk,source_simple_potentiometer:hk,source_simple_power_source:ck,source_simple_push_button:dk,source_simple_resistor:ak,source_simple_resonator:mk,source_simple_switch:gk,source_simple_transistor:vk,source_trace:pse,supplier_name:cse,time:jBe,visible_layer:cT,voltage:JR},Symbol.toStringTag,{value:"Module"}));var rHe=Object.defineProperty,iHe=(r,e)=>{for(var t in e)rHe(r,t,{get:e[t],enumerable:!0})},ES={};iHe(ES,{axial:()=>lje,bga:()=>bHe,breakoutheaders:()=>xje,cap:()=>vHe,dfn:()=>GHe,diode:()=>mHe,dip:()=>lHe,hc49:()=>Sje,led:()=>yHe,lqfp:()=>mje,melf:()=>SVe,micromelf:()=>MVe,minimelf:()=>pVe,mlp:()=>AHe,ms012:()=>ZHe,ms013:()=>KHe,pad:()=>Eje,pinrow:()=>YHe,pushbutton:()=>uje,qfn:()=>CHe,qfp:()=>RHe,quad:()=>V8,res:()=>gHe,sma:()=>NVe,smb:()=>kVe,smc:()=>qVe,smf:()=>OVe,sod123:()=>ije,sod123f:()=>eVe,sod123w:()=>Oje,sod128:()=>lVe,sod323:()=>kje,sod323f:()=>Zje,sod523:()=>Rje,sod723:()=>iVe,sod882:()=>Yje,sod882d:()=>gVe,sod923:()=>jje,soic:()=>EHe,sop8:()=>Dje,sot23:()=>FHe,sot235:()=>yje,sot236:()=>zHe,sot363:()=>IHe,sot563:()=>WHe,sot723:()=>eje,ssop:()=>PHe,stampboard:()=>dje,stampreceiver:()=>pje,to220:()=>dVe,to92:()=>Mje,tssop:()=>LHe,vssop8:()=>jVe});var K0=(r,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:r,y:e},anchor_alignment:"center"}),ev=(r,e,t,n,i)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:B8(n),outer_diameter:B8(i),pcb_port_id:"",layers:["top","bottom"],port_hints:[r.toString()]}),_le=Array.from({length:9},(r,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(r=>({x:r,y:-Math.sqrt(1-r**2)}));function v4(r){return typeof r=="string"?r.trim().toLowerCase().endsWith("mil")?Number.parseFloat(r)*.0254:Number.parseFloat(r):Number(r)}var nA=le.union([le.string(),le.number()]).transform(r=>v4(r)),aHe=r=>le.object({fn:le.string(),num_pins:le.number().optional().default(6),wide:le.boolean().optional(),narrow:le.boolean().optional(),w:nA.optional(),p:nA.default(r.p??"2.54mm"),id:nA.optional(),od:nA.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=v4("0.55mm"),e.od=v4("0.95mm")):(e.id=v4("1.0mm"),e.od=v4("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=v4("600mil"):e.narrow?e.w=v4("300mil"):e.w=v4(r.w??"300mil")),e)),oHe=aHe({}),sHe=(r,e,t,n)=>{const i=r/2,a=e<=i,o=i-1,s=n,l=s*o;return a?{x:-t/2-.4,y:l/2-(e-1)*s}:{x:t/2+.4,y:-l/2+(e-i-1)*s}},lHe=r=>{const e=oHe.parse(r),t=[];for(let l=0;l<e.num_pins;l++){const{x:c,y:u}=sHe(e.num_pins,l+1,e.w,e.p??2.54);t.push(ev(l+1,c,u,e.id??"0.8mm",e.od??"1mm"))}const n=e.w-e.od-.4,i=(e.num_pins/2-1)*e.p+e.od+.4,a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-n/2,y:-i/2},{x:-n/2,y:i/2},..._le.map(({x:l,y:c})=>({x:l*n/6,y:c*n/6+i/2})),{x:n/2,y:i/2},{x:n/2,y:-i/2},{x:-n/2,y:-i/2}],type:"pcb_silkscreen_path",stroke_width:.1},o=[];for(let l=0;l<e.num_pins;l++){const c=l<e.num_pins/2,u=c?-e.w/2-e.p/2-.2:e.p/2+e.w/2+.2,f=c?(-i+1.6)/2+l*e.p:(-i+1.6)/2+(l-e.num_pins/2)*e.p,m={type:"pcb_fabrication_note_text",layer:"top",pcb_component_id:`pin_${l+1}`,pcb_silkscreen_text_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:u,y:f},font_size:.3,font_color:"red",font:"tscircuit2024",anchor_alignment:"top-left"};o.push(m)}const s=K0(0,i/2+.5,.4);return{circuitJson:[...t,a,s,...o],parameters:e}},F0=(r,e,t,n,i)=>({type:"pcb_smtpad",x:e,y:t,width:n,height:i,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(r)?r.map(a=>a.toString()):[r.toString()]}),rA=(r,e={})=>({type:"pcb_silkscreen_path",layer:e.layer||"top",pcb_component_id:e.pcb_component_id||"",pcb_silkscreen_path_id:e.pcb_silkscreen_path_id||"",route:r,stroke_width:e.stroke_width||.1}),xle=[{imperial:"01005",metric:"0402",Z_mm_min:.58,G_mm_min:.18,X_mm_min:.21,C_mm_ref:.038},{imperial:"0201",metric:"0603",Z_mm_min:.9,G_mm_min:.3,X_mm_min:.3,C_mm_ref:.6},{imperial:"0402",metric:"1005",Z_mm_min:1.6,G_mm_min:.4,X_mm_min:.7,C_mm_ref:1},{imperial:"0603",metric:"1608",Z_mm_min:2.6,G_mm_min:.6,X_mm_min:1,C_mm_ref:1.7},{imperial:"0805",metric:"2012",Z_mm_min:3,G_mm_min:.6,X_mm_min:1.2,C_mm_ref:1.9},{imperial:"1206",metric:"3216",Z_mm_min:4.2,G_mm_min:1.2,X_mm_min:1.4,C_mm_ref:2.8},{imperial:"1210",metric:"3225",Z_mm_min:3.2,G_mm_min:1,X_mm_min:2.5,C_mm_ref:2},{imperial:"2010",metric:"5025",Z_mm_min:5,G_mm_min:1.2,X_mm_min:2.5,C_mm_ref:3.6},{imperial:"2512",metric:"6332",Z_mm_min:6.3,G_mm_min:1.2,X_mm_min:3.2,C_mm_ref:4.5}],cHe=xle.reduce((r,e)=>(r[e.metric]=e,r),{}),uHe=xle.reduce((r,e)=>(r[e.imperial]=e,r),{});le.object({tht:le.boolean(),p:jn,pw:jn.optional(),ph:jn.optional(),metric:Wl.optional(),imperial:Wl.optional(),w:jn.optional(),h:jn.optional()});var fHe=r=>.079*r**2+.94*r-.009,dHe=r=>1.09*r+.6,hHe=r=>.59*r-.31,pHe=r=>-.01*r**2+.94*r+.03,iA=r=>{let{tht:e,p:t,pw:n,ph:i,metric:a,imperial:o,w:s,h:l}=r;if(typeof s=="string"&&(s=H8(s)),typeof l=="string"&&(l=H8(l)),typeof t=="string"&&(t=H8(t)),typeof n=="string"&&(n=H8(n)),typeof i=="string"&&(i=H8(i)),l>s)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let c;if(a&&(c=cHe[a]),o&&(c=uHe[o]),!c&&s&&l&&!n&&!i&&(c={imperial:"custom",metric:"custom",Z_mm_min:dHe(s),G_mm_min:hHe(s),X_mm_min:fHe(l),C_mm_ref:pHe(s)}),c&&(s=c.Z_mm_min,l=c.X_mm_min,t=c.C_mm_ref,n=(c.Z_mm_min-c.G_mm_min)/2,i=(c.Z_mm_min-c.G_mm_min)/2),n===void 0)throw new Error("could not infer pad width");if(i===void 0)throw new Error("could not infer pad width");const u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:i/2+.4},{x:-t/2-n/2-.2,y:i/2+.4},{x:-t/2-n/2-.2,y:-i/2-.4},{x:t/2,y:-i/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},f=K0(0,i/2+.9,.2);return e?[ev(1,-t/2,0,n,n*1/.8),ev(2,t/2,0,n,n*1/.8),u,f]:[F0(["1","left"],-t/2,0,n,i),F0(["2","right"],t/2,0,n,i),u,f]},mHe=r=>({circuitJson:iA(r),parameters:r}),vHe=r=>({circuitJson:iA(r),parameters:r}),yHe=r=>({circuitJson:iA(r),parameters:r}),gHe=r=>({circuitJson:iA(r),parameters:r}),ble="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Sle=le.string().transform(r=>{const[e,t]=r.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(le.object({x:le.number(),y:le.number()})),_He=le.string().or(le.array(le.any())).transform(r=>Array.isArray(r)?r:(r.startsWith("(")&&r.endsWith(")")&&(r=r.slice(1,-1)),r.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(le.array(le.string().or(le.number()))),xHe=le.object({fn:le.string(),num_pins:le.number().optional().default(64),grid:Sle.optional(),p:Wl.default("0.8mm"),w:jn.optional(),h:jn.optional(),ball:jn.optional().describe("ball diameter"),pad:jn.optional().describe("pad width/height"),tlorigin:le.boolean().optional(),blorigin:le.boolean().optional(),trorigin:le.boolean().optional(),brorigin:le.boolean().optional(),missing:_He.default([])}).transform(r=>{let e="tl";if(r.blorigin&&(e="bl"),r.trorigin&&(e="tr"),r.brorigin&&(e="br"),!r.grid){const n=Math.ceil(Math.sqrt(r.num_pins));r.grid={x:n,y:n}}return r.missing&&(r.missing=r.missing.map(n=>{if(typeof n=="number")return n;if(n==="center")return"center";if(n==="topleft")return"topleft";const i=n.match(/([A-Z]+)(\d+)/);if(!i)return n;const a=ble.indexOf(i[1]),o=Number.parseInt(i[2])-1;return a*r.grid.x+o+1})),{...r,origin:e}}),bHe=r=>{const e=xHe.parse(r);let{num_pins:t,grid:n,p:i,w:a,h:o,ball:s,pad:l,missing:c}=e;s??(s=.75/1.27*i),l??(l=s*.8);const u=[],f=(c??[]).filter(w=>typeof w=="number"),m=n.x*n.y-t;if(c.length===0&&m>0&&(Math.sqrt(m)%1===0?c.push("center"):m===1&&c.push("topleft")),c!=null&&c.includes("center")){const w=Math.floor(Math.sqrt(m)),T=Math.floor((n.x-w)/2),D=Math.floor((n.y-w)/2);for(let O=D;O<D+w;O++)for(let B=T;B<T+w;B++)f.push(O*n.x+B+1)}c!=null&&c.includes("topleft")&&f.push(1);const _=new Set(f);let x=0;for(let w=0;w<n.y;w++)for(let T=0;T<n.x;T++){let D=w*n.x+T+1;if(_.has(D)){x++;continue}D-=x;const O=(T-(n.x-1)/2)*i,B=-(w-(n.y-1)/2)*i;u.push(F0([D,`${ble[w]}${T+1}`],O,B,l,l))}const M=K0(0,n.y*i/2,.2);return{circuitJson:[...u,M],parameters:e}},kb=r=>le.object({fn:le.string(),num_pins:le.number().optional().default(8),w:jn.default(jn.parse(r.w??"5.3mm")),p:jn.default(jn.parse(r.p??"1.27mm")),pw:jn.optional(),pl:jn.optional(),legsoutside:le.boolean().optional().default(r.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=jn.parse("0.6mm"),e.pl=jn.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),SHe=kb({}),bk=r=>{r.widthincludeslegs!==void 0&&(r.legsoutside=!r.widthincludeslegs);const{num_pins:e,pn:t,w:n,p:i,pl:a,legsoutside:o}=r,s=e/2,l=t<=s,c=s-1,u=i,f=u*c,m=o?a/2:-a/2;return l?{x:-n/2-m,y:f/2-(t-1)*u}:{x:n/2+m,y:-f/2+(t-s-1)*u}},EHe=r=>{const e=SHe.parse(r);return{circuitJson:y4(e),parameters:e}},y4=r=>{const e=[];for(let s=0;s<r.num_pins;s++){const{x:l,y:c}=bk({num_pins:r.num_pins,pn:s+1,w:r.w,p:r.p??1.27,pl:r.pl,legsoutside:r.legsoutside});e.push(F0(s+1,l,c,r.pl??"1mm",r.pw??"0.6mm"))}const t=Math.min(1,r.p/2),n=r.w-(r.legsoutside?0:r.pl*2)-.2,i=(r.num_pins/2-1)*r.p+r.pw+t,a=K0(0,i/2+.4,i/12),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-n/2,y:-i/2},{x:-n/2,y:i/2},..._le.map(({x:s,y:l})=>({x:s*n/6,y:l*n/6+i/2})),{x:n/2,y:i/2},{x:n/2,y:-i/2},{x:-n/2,y:-i/2}]};return[...e,o,a]},Ele=le.enum(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),wHe=({num_pins:r,cw:e,ccw:t,startingpin:n})=>{const i=[],a=r/4;let o=1;const s={};for(const l of n??[])s[l]=!0;!s.leftside&&!s.topside&&!s.rightside&&!s.bottomside&&(s.leftside=!0),!s.bottompin&&!s.leftpin&&!s.rightpin&&!s.toppin&&(s.leftside?s.toppin=!0:s.topside?s.rightpin=!0:s.rightside?s.bottompin=!0:s.bottomside&&(s.leftpin=!0)),s.leftside&&s.toppin?o=1:s.leftside&&s.bottompin?o=a:s.bottomside&&s.leftpin?o=a+1:s.bottomside&&s.rightpin?o=a*2:s.rightside&&s.bottompin?o=a*2+1:s.rightside&&s.toppin?o=a*3:s.topside&&s.rightpin?o=a*3+1:s.topside&&s.leftpin&&(o=a*4),i.push(-1);for(let l=0;l<r;l++)i[o]=l+1,t||!e?(o++,o>r&&(o=1)):(o--,o<1&&(o=r));return i},Sk=le.object({fn:le.string(),cc:le.boolean().default(!0).optional(),ccw:le.boolean().default(!0).optional(),startingpin:le.string().or(le.array(Ele)).transform(r=>typeof r=="string"?r.slice(1,-1).split(","):r).pipe(le.array(Ele)).optional(),num_pins:le.number().optional().default(64),w:jn.optional(),h:jn.optional(),p:jn.default(jn.parse("0.5mm")),pw:jn.optional(),pl:jn.optional(),thermalpad:le.union([le.literal(!0),Sle]).optional(),legsoutside:le.boolean().default(!1)}),Ek=r=>{r.w&&!r.h?r.h=r.w:!r.w&&r.h&&(r.w=r.h);const e=r.num_pins/4;if(!r.p&&!r.pw&&!r.pl&&r.w){const t=e+4;r.p=r.w/t}return!r.p&&r.w&&r.h&&r.pw&&r.pl&&(r.p=(r.w-r.pl*2)/(e-1)),!r.w&&!r.h&&r.p&&(r.w=r.p*(e+4),r.h=r.w),r.p&&!r.pw&&!r.pl?(r.pw=r.p/2,r.pl=r.p/2):r.pw?r.pl||(r.pl=r.pw*(1/.6)):r.pw=r.pl*(.6/1),r},wle=Sk.transform(Ek),THe=["left","bottom","right","top"],MHe=r=>{const{pin_count:e,pn:t,w:n,h:i,p:a,pl:o,legsoutside:s}=r,l=e/4,c=THe[Math.floor((t-1)/l)],u=(t-1)%l,f=a*(l-1),m=a*(l-1),_=s?o/2:-o/2;switch(c){case"left":return{x:-n/2-_,y:m/2-u*a,o:"vert"};case"bottom":return{x:-f/2+u*a,y:-i/2-_,o:"horz"};case"right":return{x:n/2+_,y:-m/2+u*a,o:"vert"};case"top":return{x:f/2-u*a,y:i/2+_,o:"horz"};default:throw new Error("Invalid pin number")}},V8=r=>{const e=wle.parse(r),t=[],n=wHe(e),i=e.num_pins/4;for(let s=0;s<e.num_pins;s++){const{x:l,y:c,o:u}=MHe({pin_count:e.num_pins,pn:s+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let f=e.pw,m=e.pl;u==="vert"&&([f,m]=[m,f]);const _=n[s+1];t.push(F0(_,l,c,f,m))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const s=e.p*(i-1)+e.pw,l=e.p*(i-1)+e.pw;t.push(F0(["thermalpad"],0,0,s,l))}else t.push(F0(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const a=[];for(const[s,l,c]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*l,f=e.h/2*c;let m="none",_=u,x=f;const M=e.pw*2;n[1]===1&&s==="top-left"?m="in1":n[i*4]===1&&s==="top-left"||n[i*3+1]===1&&s==="top-right"?m="in2":n[i*3]===1&&s==="top-right"||n[i]===1&&s==="bottom-left"?m="in1":n[i+1]===1&&s==="bottom-left"?m="in2":n[i*2]===1&&s==="bottom-right"?m="in1":n[i*2+1]===1&&s==="bottom-right"&&(m="in2");const w=m==="in1"?1:-1;if(e.legsoutside){const T=m==="in1"?e.pl/2:e.pw/2,D=m==="in1"?e.pw/2:e.pl/2;_+=T*l*w,x-=D*c*w}(m==="none"||e.legsoutside)&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}`,route:[{x:u-M*l,y:f},{x:u,y:f},{x:u,y:f-M*c}],type:"pcb_silkscreen_path",stroke_width:.1}),(m==="in1"||m==="in2")&&!e.legsoutside&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_1`,route:[{x:u-M*l,y:f},{x:u-M*l/2,y:f}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_2`,route:[{x:u,y:f-M*c/2},{x:u,y:f-M*c}],type:"pcb_silkscreen_path",stroke_width:.1}),(m==="in1"||m==="in2")&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_3`,route:[{x:_-.2*-l,y:x+.2*w},{x:_,y:x},{x:_+.2*w*-l,y:x+.2},{x:_-.2*-l,y:x+.2*w}],type:"pcb_silkscreen_path",stroke_width:.1})}const o=K0(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...a,o],parameters:e}};Sk.extend({}).transform(Ek);var CHe=r=>(r.legsoutside=!1,V8(r)),RHe=r=>{r.legsoutside=!0;const e=wle.parse(r);if(!r.p)switch(r.num_pins){case 44:case 64:r.p=.8;break;case 52:r.w===14?r.p=1:r.p=.65;break;case 208:r.p=.5;break}if(!r.pl)switch(r.num_pins){case 44:case 52:case 64:r.pl=2.25;break;case 208:r.pl=1.65;break;default:r.pl=e.pl*4;break}if(!r.pw)switch(r.num_pins){case 44:case 64:r.pw=.5;break;case 52:r.w===14?r.pw=.45:r.pw=.55;break;case 208:r.pw=.3;break;default:r.pw=e.pw;break}return V8(r)};Sk.extend({}).transform(Ek);var AHe=r=>(r.legsoutside=!1,r.thermalpad===void 0&&(r.thermalpad=!0),V8(r)),NHe=kb({w:"3.9mm",p:"1.27mm"}),PHe=r=>{const e=NHe.parse(r);return{circuitJson:y4(e),parameters:e}},DHe=kb({w:"6.1mm",p:"0.65mm",legsoutside:!0}),LHe=r=>{const e=DHe.parse(r);return{circuitJson:y4(e),parameters:e}},OHe=kb({p:"0.95mm",w:"1.6mm",legsoutside:!0}),zHe=r=>{const e=OHe.parse({...r,num_pins:6});return{circuitJson:y4(e),parameters:e}},UHe=kb({}),IHe=r=>{const e=UHe.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:y4(e),parameters:e}},kHe=le.object({fn:le.string(),num_pins:le.literal(3).default(3),w:le.string().default("1.92mm"),h:le.string().default("2.74mm"),pl:le.string().default("0.8mm"),pw:le.string().default("0.764mm")}),FHe=r=>{const e=kHe.parse(r);return{circuitJson:HHe(e),parameters:e}},BHe=r=>{const{pn:e}=r;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},HHe=r=>{const e=[];for(let n=0;n<r.num_pins;n++){const{x:i,y:a}=BHe({num_pins:r.num_pins,pn:n+1,w:Number.parseFloat(r.w),h:Number.parseFloat(r.h),pl:Number.parseFloat(r.pl)});e.push(F0(n+1,i,a,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}const t=K0(0,parseInt(r.h),.3);return[...e,t]},jHe=[{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}],VHe=kb({}),GHe=r=>{const e=VHe.parse(r),t=[];for(let f=0;f<e.num_pins;f++){const{x:m,y:_}=bk({num_pins:e.num_pins,pn:f+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(F0(f+1,m,_,e.pl??"1mm",e.pw??"0.6mm"))}const n=Math.min(1,e.p/2),i=e.w+n,a=(e.num_pins/2-1)*e.p+e.pw+n,o=[];for(const f of jHe){const{dx:m,dy:_}=f;o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:m*i/2-m*e.p,y:_*a/2},{x:m*i/2,y:_*a/2},{x:m*i/2,y:_*a/2-_*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=e.p/4,l=-i/2-s/2,c=a/2-e.p/2;o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:l,y:c},{x:l-s,y:c+s},{x:l-s,y:c-s},{x:l,y:c}],stroke_width:.1});const u=K0(0,a/2+.4,a/12);return{circuitJson:[...t,u,...o],parameters:e}},qHe=le.object({fn:le.string(),num_pins:le.number().optional().default(6),p:jn.default("0.1in").describe("pitch"),id:jn.default("1.0mm").describe("inner diameter"),od:jn.default("1.5mm").describe("outer diameter"),male:le.boolean().optional().describe("for male pin headers"),female:le.boolean().optional().describe("for female pin headers")}).transform(r=>({...r,male:r.male??!r.female,female:r.female??!1})).superRefine((r,e)=>{r.male&&r.female&&e.addIssue({code:le.ZodIssueCode.custom,message:"'male' and 'female' cannot both be true it should be male or female.",path:["male","female"]})}),YHe=r=>{const e=qHe.parse(r),{p:t,id:n,od:i}=e,a=[],s=-((e.num_pins-1)/2)*t;for(let c=0;c<e.num_pins;c++)a.push(ev(c+1,s+c*t,0,n,i));const l=K0(0,t/2,.5);return{circuitJson:[...a,l],parameters:e}},XHe=kb({}),WHe=r=>{const e=XHe.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:y4(e),parameters:e}},$He=kb({p:"1.27mm",w:"3.9mm",legsoutside:!0}),ZHe=r=>{const e=$He.parse({...r,num_pins:8});return{circuitJson:y4(e),parameters:e}},QHe=kb({p:"1.27mm",w:"7.5mm",legsoutside:!0}),KHe=r=>{const e=QHe.parse({...r,num_pins:16});return{circuitJson:y4(e),parameters:e}},JHe=le.object({fn:le.string(),num_pins:le.literal(3).default(3),w:le.string().default("1.2mm"),h:le.string().default("1.2mm"),pl:le.string().default("0.3mm"),pw:le.string().default("0.32mm")}),eje=r=>{const e=JHe.parse(r),t=nje(e),n=K0(.4,jn.parse(e.h),.2);return{circuitJson:[...t,n],parameters:e}},tje=r=>{const{pn:e}=r;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},nje=r=>{const e=[];for(let t=0;t<3;t++){const{x:n,y:i}=tje({num_pins:r.num_pins,pn:t+1,w:Number.parseFloat(r.w),h:Number.parseFloat(r.h),pl:Number.parseFloat(r.pl)});e.push(F0(t+1,n,i,Number.parseFloat(r.pl),t!==0?Number.parseFloat(r.pw):.42))}return e},rje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("2.36mm"),h:le.string().default("1.22mm"),pl:le.string().default("0.9mm"),pw:le.string().default("0.9mm"),p:le.string().default("4.19mm")}),ije=r=>{const e=rje.parse(r),t=K0(0,jn.parse(e.h)/4+.4,.3);return{circuitJson:oje(e).concat(t),parameters:e}},aje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},oje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=aje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},sje=le.object({fn:le.string(),p:jn.optional().default("2.54mm"),id:jn.optional().default("0.7mm"),od:jn.optional().default("1mm")}),lje=r=>{const e=sje.parse(r),{p:t,id:n,od:i}=e,a=[ev(1,-t/2,0,n,i),ev(2,t/2,0,n,i)],o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+i+n/2,y:0},{x:t/2-i-n/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},s=K0(0,t/4,.5);return{circuitJson:[...a,o,s],parameters:e}},cje=le.object({fn:le.literal("pushbutton"),w:jn.default(4.5),h:jn.default(6.5),id:jn.default(1),od:jn.default(1.2)}),uje=r=>{const e=cje.parse(r),t=e.w,n=e.h,i=e.id,a=[ev(1,-t/2,n/2,i,i*1.5),ev(2,-t/2,-n/2,i,i*1.5),ev(3,t/2,-n/2,i,i*1.5),ev(4,t/2,n/2,i,i*1.5)],o=[rA([{x:-t/2,y:-n/2},{x:-t/2,y:n/2}]),rA([{x:t/2,y:-n/2},{x:t/2,y:n/2}]),rA([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:n/8}]),rA([{x:t/2,y:0},{x:t/5,y:0}])],s=K0(0,n/2+.4,.5);return{circuitJson:[...a,...o,s],parameters:e}},Tle=le.object({fn:le.string(),w:jn.default("22.58mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(2),bottom:jn.optional().default(2),p:jn.default(jn.parse("2.54mm")),pw:jn.default(jn.parse("1.6mm")),pl:jn.default(jn.parse("2.4mm")),innerhole:le.boolean().default(!1),innerholeedgedistance:jn.default(jn.parse("1.61mm"))}),fje=r=>{const e=Tle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},aA=(r,e,t)=>{let n=[];return t==="right"&&(n=[{x:r+1/2,y:e},{x:r-1/2,y:e+.6/2},{x:r-1/2,y:e-.6/2},{x:r+1/2,y:e}]),t==="left"&&(n=[{x:r-1/2,y:e},{x:r+1/2,y:e+.6/2},{x:r+1/2,y:e-.6/2},{x:r-1/2,y:e}]),t==="top"&&(n=[{x:r,y:e+1/2},{x:r-.6/2,y:e-1/2},{x:r+.6/2,y:e-1/2},{x:r,y:e+1/2}]),t==="bottom"&&(n=[{x:r,y:e-1/2},{x:r-.6/2,y:e+1/2},{x:r+.6/2,y:e+1/2},{x:r,y:e-1/2}]),n},dje=r=>{const e=Tle.parse(r),t=e.h??fje(e),n=[],i=[];let a=[];const o=1,s=1.2,l=e.left+e.right+(e.bottom??0)+(e.top??0);if(e.right){const m=-((e.right-1)/2)*e.p;for(let _=0;_<e.right;_++)_===0&&!e.left&&!e.bottom&&(a=aA(e.w/2-e.pl*1.4,m+_*e.p,"right")),n.push(F0(_+1+e.left+(e.bottom??0),e.w/2-e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&(i.push(ev(_+1+e.left+(e.bottom??0)+l,e.w/2,m+_*e.p,o,s)),i.push(ev(_+1+e.left+(e.bottom??0)+l*2,e.w/2-e.innerholeedgedistance,m+_*e.p,o,s)))}if(e.left){const m=-((e.left-1)/2)*e.p;for(let _=0;_<e.left;_++)_===e.left-1&&(a=aA(-e.w/2+e.pl*1.4,m+_*e.p,"left")),n.push(F0(_+1,-e.w/2+e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&(i.push(ev(_+1+l,-e.w/2,m+_*e.p,o,s)),i.push(ev(_+1+l*2,-e.w/2+e.innerholeedgedistance,m+_*e.p,o,s)))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let _=0;_<e.top;_++)_===e.top-1&&!e.left&&!e.bottom&&!e.right&&(a=aA(m+_*e.p,t/2-e.pl*1.4,"top")),n.push(F0(_+1+e.left+e.right+(e.bottom??0),m+_*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&(i.push(ev(_+1+e.left+e.right+(e.bottom??0)+l,m+_*e.p,t/2,o,s)),i.push(ev(_+1+e.left+e.right+(e.bottom??0)+l*2,m+_*e.p,t/2-e.innerholeedgedistance,o,s)))}if(e.bottom){const m=-((e.bottom-1)/2)*e.p;for(let _=0;_<e.bottom;_++)_===0&&!e.left&&(a=aA(m+_*e.p,-t/2+e.pl*1.4,"bottom")),n.push(F0(_+1+e.left,m+_*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&(i.push(ev(_+1+e.left+l,m+_*e.p,-t/2,o,s)),i.push(ev(_+1+e.left+l*2,m+_*e.p,-t/2+e.innerholeedgedistance,o,s)))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:a,stroke_width:.1,layer:"top"},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},f=K0(0,t/1.8,t/25);return{circuitJson:[...n,...i,u,c,f],parameters:e}},Mle=le.object({fn:le.string(),w:jn.default("22.58mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(2),bottom:jn.optional().default(2),p:jn.default(jn.parse("2.54mm")),pw:jn.default(jn.parse("1.6mm")),pl:jn.default(jn.parse("3.2mm")),innerhole:le.boolean().default(!1),innerholeedgedistance:jn.default(jn.parse("1.61mm"))}),hje=r=>{const e=Mle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},oA=(r,e,t,n=1,i=.6)=>{const a=n/2,o=i/2;return{left:[{x:r+a,y:e},{x:r-a,y:e+o},{x:r-a,y:e-o},{x:r+a,y:e}],right:[{x:r-a,y:e},{x:r+a,y:e+o},{x:r+a,y:e-o},{x:r-a,y:e}],top:[{x:r,y:e-a},{x:r-o,y:e+a},{x:r+o,y:e+a},{x:r,y:e-a}],bottom:[{x:r,y:e+a},{x:r-o,y:e-a},{x:r+o,y:e-a},{x:r,y:e+a}]}[t]},pje=r=>{const e=Mle.parse(r),t=e.h??hje(e),n=[],i=[],a=1,o=1.2,s=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[];if(e.right){const m=-((e.right-1)/2)*e.p;for(let _=0;_<e.right;_++)_===0&&!e.left&&!e.bottom&&(l=oA(e.w/2+e.pl*1.4,m+_*e.p,"right")),n.push(F0(_+1+e.left+(e.bottom??0),e.w/2-e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&i.push(ev(_+1+e.left+(e.bottom??0)+s,e.w/2-e.innerholeedgedistance,m+_*e.p,a,o))}if(e.left){const m=-((e.left-1)/2)*e.p;for(let _=0;_<e.left;_++)_===e.left-1&&(l=oA(-e.w/2-e.pl/3,m+_*e.p,"left")),n.push(F0(_+1,-e.w/2+e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&i.push(ev(_+1+s,-e.w/2+e.innerholeedgedistance,m+_*e.p,a,o))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let _=0;_<e.top;_++)_===e.top-1&&!e.left&&!e.bottom&&!e.right&&(l=oA(m+_*e.p,t/2+e.pl*1.4,"top")),n.push(F0(_+1+e.right+(e.bottom??0)+e.left,m+_*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&i.push(ev(_+1+e.right+(e.bottom??0)+e.left+s,m+_*e.p,t/2-e.innerholeedgedistance,a,o))}if(e.bottom){const m=-((e.bottom-1)/2)*e.p;for(let _=0;_<e.bottom;_++)_===0&&!e.left&&(l=oA(m+_*e.p,-t/2-e.pl*1.4,"bottom")),n.push(F0(_+1+e.left,m+_*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&i.push(ev(_+1+e.left+s,m+_*e.p,-t/2+e.innerholeedgedistance,a,o))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=K0(0,t/1.8,t/25);return{circuitJson:[...i,...n,u,c,f],parameters:e}},mje=r=>(r.legsoutside=!0,V8(r)),vje=le.object({fn:le.string(),num_pins:le.literal(5).default(5),h:le.string().default("1.6mm"),pl:le.string().default("1mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.95mm")}),yje=r=>{const e=vje.parse(r);return{circuitJson:gje(e),parameters:e}},Cle=r=>{const{p:e,h:t,pn:n}=r;if(n===1)return{x:-t/2-.5,y:e};if(n===2)return{x:-t/2-.5,y:0};if(n===3)return{x:-t/2-.5,y:-e};if(n===4)return{x:t/2+.5,y:-e};if(n===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},gje=r=>{const e=[];for(let f=1;f<=r.num_pins;f++){const{x:m,y:_}=Cle({h:Number.parseFloat(r.h),p:Number.parseFloat(r.p),pn:f});e.push(F0(f,m,_,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}const t=(r.num_pins+1)/2*Number.parseFloat(r.p),n=Number.parseFloat(r.h),i={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:n/2+Number.parseFloat(r.p)/1.3},{x:t/3,y:n/2+Number.parseFloat(r.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-n/2-Number.parseFloat(r.p)/1.3},{x:t/3,y:-n/2-Number.parseFloat(r.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o=K0(0,n+.3,.3),s=Cle({h:Number.parseFloat(r.h),p:Number.parseFloat(r.p),pn:1});s.x=s.x-Number.parseFloat(r.pw)*1.5;const l=.7,c=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:s.x+l/2,y:s.y},{x:s.x-l/2,y:s.y+c/2},{x:s.x-l/2,y:s.y-c/2},{x:s.x+l/2,y:s.y}],stroke_width:.05};return[...e,o,i,a,u]},Rle=le.object({fn:le.string(),w:jn.default("10mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(0),bottom:jn.optional().default(0),p:jn.default(jn.parse("2.54mm")),id:jn.optional().default(jn.parse("1mm")),od:jn.optional().default(jn.parse("1.5mm"))}),_je=r=>{const e=Rle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},sA=(r,e,t,n=1,i=.6)=>{const a=n/2,o=i/2;return{left:[{x:r+a,y:e},{x:r-a,y:e+o},{x:r-a,y:e-o},{x:r+a,y:e}],right:[{x:r-a,y:e},{x:r+a,y:e+o},{x:r+a,y:e-o},{x:r-a,y:e}],top:[{x:r,y:e-a},{x:r-o,y:e+a},{x:r+o,y:e+a},{x:r,y:e-a}],bottom:[{x:r,y:e+a},{x:r-o,y:e-a},{x:r+o,y:e-a},{x:r,y:e+a}]}[t]},xje=r=>{const e=Rle.parse(r),t=e.h??_je(e),n=[],i=e.id,a=e.od;let o=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let f=0;f<e.right;f++)f===0&&!e.left&&!e.bottom&&(o=sA(e.w/2+a*1.4,u+f*e.p,"right")),n.push(ev(f+1+e.left+(e.bottom??0),e.w/2,u+f*e.p,i,a))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let f=0;f<e.left;f++)f===e.left-1&&(o=sA(-e.w/2-a*1.4,u+f*e.p,"left")),n.push(ev(f+1,-e.w/2,u+f*e.p,i,a))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let f=0;f<e.top;f++)f===e.top-1&&!e.left&&!e.bottom&&!e.right&&(o=sA(u+f*e.p,t/2+a*1.4,"top")),n.push(ev(f+1+e.right+(e.bottom??0)+e.left,u+f*e.p,t/2,i,a))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let f=0;f<e.bottom;f++)f===0&&!e.left&&(o=sA(u+f*e.p,-t/2-a*1.4,"bottom")),n.push(ev(f+1+e.left,u+f*e.p,-t/2,i,a))}const s={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:o,stroke_width:.1},l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-a,y:t/2+a},{x:e.w/2+a,y:t/2+a},{x:e.w/2+a,y:-t/2-a},{x:-e.w/2-a,y:-t/2-a},{x:-e.w/2-a,y:t/2+a}],stroke_width:.1,layer:"top"},c=K0(0,t/1.7,t/25);return{circuitJson:[...n,l,c,s],parameters:e}},Ale=(r,e,t,n)=>Array.from({length:25},(i,a)=>{const o=a/24*Math.PI-Math.PI/2;return{x:r+(n==="right"?1:-1)*Math.cos(o)*t,y:e+Math.sin(o)*t}}),bje=le.object({fn:le.string(),p:jn.optional().default("4.88mm"),id:jn.optional().default("0.6mm"),od:jn.optional().default("1.2mm"),w:jn.optional().default("5.6mm"),h:jn.optional().default("3.5mm")}),Sje=r=>{const e=bje.parse(r),{p:t,id:n,od:i,w:a,h:o}=e,s=o/2,l=[ev(1,-t/2,0,n,i),ev(2,t/2,0,n,i)],c=Ale(-a/2,0,s,"left"),u=Ale(a/2,0,s,"right"),f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...c,...c.slice(1).reverse(),{x:-a/2,y:-o/2},{x:a/2,y:-o/2},...u,{x:a/2,y:o/2},{x:-a/2,y:o/2}],stroke_width:.1,pcb_silkscreen_path_id:""},m=K0(0,t/4,.5);return{circuitJson:[...l,f,m],parameters:e}};le.object({w:jn,h:jn});var Eje=r=>{const{w:e,h:t}=r,n=B8(e),i=B8(t);return{circuitJson:[F0(1,0,0,n,i),K0(0,i/2+.5,.2)]}},wje=(r,e,t)=>Array.from({length:25},(n,i)=>{const a=i/24*Math.PI;return{x:r+Math.cos(a)*t,y:e+Math.sin(a)*t}}),Tje=le.object({fn:le.string(),p:jn.optional().default("1.27mm"),id:jn.optional().default("0.72mm"),od:jn.optional().default(".95mm"),w:jn.optional().default("4.5mm"),h:jn.optional().default("4.5mm"),inline:le.boolean().optional().default(!1)}),Mje=r=>{const e=Tje.parse(r),{p:t,id:n,od:i,w:a,h:o,inline:s}=e,l=a/2,c=o/2,u=s?[ev(1,-t,c-t,n,i),ev(2,0,c-t,n,i),ev(3,t,c-t,n,i)]:[ev(1,0,c,n,i),ev(2,-t,c-t,n,i),ev(3,t,c-t,n,i)],f=wje(0,o/2,l),m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...f,{x:-l,y:0},{x:l,y:0},f[0]],stroke_width:.1,pcb_silkscreen_path_id:""},_=K0(0,o/2+1,.5);return{circuitJson:[...u,m,_],parameters:e}},Cje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("2.15mm"),h:le.string().default("1.20mm"),pl:le.string().default("0.5mm"),pw:le.string().default("0.6mm"),p:le.string().default("1.4mm")}),Rje=r=>{const e=Cje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Nje(e).concat(n,t),parameters:e}},Aje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Nje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Aje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Pje=kb({}),Dje=r=>{const e=Pje.parse(r),t=[];for(let o=0;o<e.num_pins;o++){const{x:s,y:l}=bk({num_pins:e.num_pins,pn:o+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(F0(o+1,s,l,e.pl??"1.5mm",e.pw??"0.6mm"))}const n=(e.num_pins/2-1)*e.p+e.pw,i=K0(0,n/2-.5,n/12),a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:n/2+.2},{x:e.w/3,y:n/2+.2}],stroke_width:.1};return{circuitJson:[...t,i,a],parameters:e}},Lje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.4mm"),h:le.string().default("2.1mm"),pl:le.string().default("1.2mm"),pw:le.string().default("1.2mm"),p:le.string().default("2.9mm")}),Oje=r=>{const e=Lje.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Uje(e).concat(n,t),parameters:e}},zje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Uje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=zje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Ije=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3.30mm"),h:le.string().default("1.80mm"),pl:le.string().default("0.60mm"),pw:le.string().default("0.45mm"),p:le.string().default("2.1mm")}),kje=r=>{const e=Ije.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bje(e).concat(n,t),parameters:e}},Fje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Bje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Fje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Hje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.4mm"),h:le.string().default("0.9mm"),pl:le.string().default("0.35mm"),pw:le.string().default("0.25mm"),p:le.string().default("1.2mm")}),jje=r=>{const e=Hje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.15,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.4,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.4,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2+.15,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Gje(e).concat(n,t),parameters:e}},Vje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Gje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Vje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},qje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.3mm"),h:le.string().default("0.9mm"),pl:le.string().default("0.4mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.7mm")}),Yje=r=>{const e=qje.parse(r),t=K0(0,jn.parse(e.h)+.1,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.2,y:jn.parse(e.h)/2+.2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2+.2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2-.2},{x:jn.parse(e.p)/2+.2,y:-jn.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Wje(e).concat(n,t),parameters:e}},Xje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Wje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Xje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},$je=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3,05mm"),h:le.string().default("1.65mm"),pl:le.string().default("0.6mm"),pw:le.string().default("0.6mm"),pad_spacing:le.string().default("2.2mm")}),Zje=r=>{const e=$je.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.pad_spacing)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.pad_spacing)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Kje(e).concat(n,t),parameters:e}},Qje=r=>{const{pn:e,pad_spacing:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Kje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Qje({pn:t,pad_spacing:Number.parseFloat(r.pad_spacing)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Jje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.4mm"),h:le.string().default("2.1mm"),pl:le.string().default("1.2mm"),pw:le.string().default("1.2mm"),p:le.string().default("2.9mm")}),eVe=r=>{const e=Jje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:nVe(e).concat(n,t),parameters:e}},tVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},nVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=tVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},rVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.80mm"),h:le.string().default("1.00mm"),pl:le.string().default("0.66mm"),pw:le.string().default("0.5mm"),p:le.string().default("0.8mm")}),iVe=r=>{const e=rVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:oVe(e).concat(n,t),parameters:e}},aVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},oVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=aVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},sVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("6.2mm"),h:le.string().default("3.4mm"),pl:le.string().default("1.4mm"),pw:le.string().default("2.1mm"),p:le.string().default("4.4mm")}),lVe=r=>{const e=sVe.parse(r),t=K0(0,jn.parse(e.h)/2+.4,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:uVe(e).concat(n,t),parameters:e}},cVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},uVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=cVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},fVe=le.object({fn:le.string().default("to220_3").refine(r=>/^to220_\d+$/.test(r),{message:"Invalid format. Expected 'to220_N' where N is the number of pins."}),p:jn.optional().default("5.0mm"),id:jn.optional().default("1.0mm"),od:jn.optional().default("1.9mm"),w:jn.optional().default("13mm"),h:jn.optional().default("7mm")}).transform(r=>{const e=r.fn.match(/^to220_(\d+)$/),t=e?parseInt(e[1],10):3;return{...r,numPins:t,fn:"to220"}}),dVe=r=>{const e=fVe.parse(r),{fn:t,id:n,od:i,w:a,h:o,numPins:s}=e,l=-1,c=a/2,u=o/2,f=a*.6,_=Math.max(1.5,f/(s-1)),x=Array.from({length:s},(B,W)=>{const $=s%2===0?(W-s/2+.5)*_:(W-Math.floor(s/2))*_;return ev(W+1,$,l,n,i)}),M={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:-u},{x:c,y:-u},{x:c,y:u},{x:-c,y:u},{x:-c,y:-u}],stroke_width:.1,pcb_silkscreen_path_id:""},w=-u+2*o/3,T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:w},{x:c,y:w}],stroke_width:.1,pcb_silkscreen_path_id:""},D=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-a/6,y:w},{x:-a/6,y:u}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:a/6,y:w},{x:a/6,y:u}],stroke_width:.1,pcb_silkscreen_path_id:""}],O=K0(0,o/2+.6,.5);return{circuitJson:[...x,M,T,...D,O],parameters:{...e,p:_}}},hVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("5.40mm"),h:le.string().default("2.30mm"),pl:le.string().default("1.30mm"),pw:le.string().default("1.70mm"),p:le.string().default("3.5mm")}),pVe=r=>{const e=hVe.parse(r),t=K0(0,jn.parse(e.h)/2+.4,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vVe(e).concat(n,t),parameters:e}},mVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=mVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},yVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.90mm"),h:le.string().default("1.33mm"),pl:le.string().default("0.5mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.8mm")}),gVe=r=>{const e=yVe.parse(r),t=K0(0,jn.parse(e.h)+.1,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2+.1,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:xVe(e).concat(n,t),parameters:e}},_Ve=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},xVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=_Ve({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},bVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.0mm"),h:le.string().default("3.35mm"),pl:le.string().default("1.50mm"),pw:le.string().default("2.70mm"),p:le.string().default("4.8mm")}),SVe=r=>{const e=bVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:wVe(e).concat(n,t),parameters:e}},EVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},wVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=EVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},TVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3.0mm"),h:le.string().default("1.80mm"),pl:le.string().default("0.80mm"),pw:le.string().default("1.20mm"),p:le.string().default("1.6mm")}),MVe=r=>{const e=TVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:RVe(e).concat(n,t),parameters:e}},CVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},RVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=CVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},AVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.10mm"),h:le.string().default("3.40mm"),pl:le.string().default("2.45mm"),pw:le.string().default("1.80mm"),p:le.string().default("4.05mm")}),NVe=r=>{const e=AVe.parse(r),t=K0(0,jn.parse(e.h)/2+.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.5,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.5,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:DVe(e).concat(n,t),parameters:e}},PVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},DVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=PVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},LVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.80mm"),h:le.string().default("2.10mm"),pl:le.string().default("1.30mm"),pw:le.string().default("1.40mm"),p:le.string().default("2.9mm")}),OVe=r=>{const e=LVe.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:UVe(e).concat(n,t),parameters:e}},zVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},UVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=zVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},IVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.30mm"),h:le.string().default("4.40mm"),pl:le.string().default("2.50mm"),pw:le.string().default("2.30mm"),p:le.string().default("4.30mm")}),kVe=r=>{const e=IVe.parse(r),t=K0(0,jn.parse(e.h)/2+.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:BVe(e).concat(n,t),parameters:e}},FVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},BVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=FVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},HVe=le.object({fn:le.string(),num_pins:le.literal(8).default(8),w:le.string().default("3.06mm"),h:le.string().default("3.14mm"),p:le.string().default("0.65mm"),pl:le.string().default("1.6mm"),pw:le.string().default("0.5mm")}),jVe=r=>{const e=HVe.parse(r),t=jn.parse(e.p),n=K0(0,jn.parse(e.h)/2+.5,.3),i=jn.parse(e.w),a=jn.parse(e.h),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-i/2,y:a/2},{x:i/2,y:a/2}],stroke_width:.05,pcb_silkscreen_path_id:""},s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-i/2,y:-a/2},{x:i/2,y:-a/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l=Nle({pn:1,pad_spacing:t}),c={x:l.x-.8,y:l.y},u={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"};return{circuitJson:VVe(e,t).concat(o,s,n,u),parameters:e}},Nle=r=>{const{pn:e,pad_spacing:t}=r,n=e<=4?-1:1,i=1.5-(e-1)%4;return{x:n*jn.parse("1.8mm"),y:i*t}},VVe=(r,e)=>{const t=[];for(let n=1;n<=r.num_pins;n++){const{x:i,y:a}=Nle({pn:n,pad_spacing:e});t.push(F0(n,i,a,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return t},GVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("10.70mm"),h:le.string().default("6.60mm"),pl:le.string().default("3.30mm"),pw:le.string().default("2.50mm"),p:le.string().default("6.80mm")}),qVe=r=>{const e=GVe.parse(r),t=K0(0,3,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2-.8},{x:-jn.parse(e.w)/2-.8,y:jn.parse(e.h)/2-.8},{x:-jn.parse(e.w)/2-.8,y:-jn.parse(e.h)/2+.8},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:XVe(e).concat(n,t),parameters:e}},YVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},XVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=YVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e};function WVe(r){return r!==null}var $Ve=r=>{let e=lA();const n=((r.length===4||r.length===5)&&/^\d+$/.test(r)?`res${r}`:r).split("_").map(i=>{const a=i.match(/([a-z]+)([\(\d\.\+\?].*)?/),[o,s,l]=a??[];return l!=null&&l.includes("?")?null:{fn:a==null?void 0:a[1],v:a==null?void 0:a[2]}}).filter(WVe);for(const{fn:i,v:a}of n)e=e[i](a);return e.setString(r),e},ZVe=()=>Object.keys(ES),lA=()=>{const r=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&ES[e.fn])return()=>ES[e.fn](e).circuitJson;if(!ES[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>{throw new Error(`No function found for footprinter, make sure to specify .dip, .lr, .p, etc. Got "${t}"`)}}if(t==="json"){if(!ES[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>ES[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(ES):t==="params"?()=>e:t==="setString"?n=>(e.string=n,r):n=>(Object.keys(e).length===0?`${t}${n}`in ES?(e[`${t}${n}`]=!0,e.fn=`${t}${n}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?n&&(e.imperial=n):e.num_pins=Number.isNaN(Number.parseFloat(n))?void 0:Number.parseFloat(n)):!n&&["w","h","p"].includes(t)||(e[t]=n??!0),r)}});return r};lA.string=$Ve,lA.getFootprintNames=ZVe;var wk=lA,Ple={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:{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}}},Tk=new Set;for(const[r,e]of Object.entries(Ple)){Tk.add(r);for(const t of Object.keys(e.variants))Tk.add(t)}function QVe(r){for(const[e,t]of Object.entries(Ple))if(r in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[r]};return{baseUnit:r,conversionFactor:1}}var Dle={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},lb=r=>{var s;if(typeof r>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof r=="string"&&r.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(r),parsedUnit:null,unitOfValue:null};if(typeof r=="number")return{value:r,parsedUnit:null,unitOfValue:null};if(typeof r=="object"&&"x"in r&&"y"in r){const{parsedUnit:l,unitOfValue:c}=lb(r.x);return{parsedUnit:l,unitOfValue:c,value:{x:lb(r.x).value,y:lb(r.y).value}}}const t=(s=r.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${r}"`);const n=t.split("").reverse().join(""),i=r.slice(0,-n.length);if(n in Dle&&!Tk.has(n)){const l=Dle[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=QVe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(i)}},G8=le.string().or(le.number()).transform(r=>lb(r).value),q8=le.string().or(le.number()).transform(r=>lb(r).value).transform(r=>Number.parseFloat(r.toPrecision(12))),Lle=le.string().or(le.number()).transform(r=>lb(r).value),Y8=le.string().or(le.number()).transform(r=>lb(r).value),qv=le.string().or(le.number()).transform(r=>lb(r).value),Mk=le.string().or(le.number()).transform(r=>lb(r).value),_i=qv;le.string().or(le.number()).transform(r=>lb(r).value),le.string().or(le.number()).transform(r=>lb(r).value);var wS=le.string().or(le.number()).transform(r=>typeof r=="number"?r:r.endsWith("deg")?Number.parseFloat(r.split("deg")[0]):r.endsWith("rad")?Number.parseFloat(r.split("rad")[0])*180/Math.PI:Number.parseFloat(r)),KVe=le.number().or(le.string().endsWith("mAh")).transform(r=>{if(typeof r=="string"){const e=r.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return r}).describe("Battery capacity in mAh"),Iy=le.object({x:_i,y:_i}),cA=le.object({x:_i,y:_i,z:_i}),Ole=le.object({width:le.number(),height:le.number()}),Mv=r=>le.string().optional().default(()=>`${r}_${JI(10)}`),zle=le.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),C2=le.object({type:le.literal("source_component"),ftype:le.string().optional(),source_component_id:le.string(),name:le.string(),manufacturer_part_number:le.string().optional(),supplier_part_numbers:le.record(zle,le.array(le.string())).optional(),display_value:le.string().optional()}),Ule=C2.extend({ftype:le.literal("simple_capacitor"),capacitance:q8,max_voltage_rating:Y8.optional(),display_capacitance:le.string().optional(),max_decoupling_trace_length:_i.optional()}),Ile=C2.extend({ftype:le.literal("simple_resistor"),resistance:G8,display_resistance:le.string().optional()}),Ck=C2.extend({ftype:le.literal("simple_diode")}),JVe=C2.extend({ftype:le.literal("simple_ground")}),kle=C2.extend({ftype:le.literal("simple_bug")}).describe("@deprecated"),Fle=C2.extend({ftype:le.literal("simple_chip")}),Ble=Ck.extend({ftype:le.literal("led")}),Hle=C2.extend({ftype:le.literal("simple_power_source"),voltage:Y8}),jle=C2.extend({ftype:le.literal("simple_battery"),capacity:KVe}),Vle=C2.extend({ftype:le.literal("simple_inductor"),inductance:Lle}),Gle=C2.extend({ftype:le.literal("simple_push_button")}),qle=C2.extend({ftype:le.literal("simple_potentiometer"),max_resistance:G8}),eGe=C2.extend({ftype:le.literal("simple_crystal"),frequency:le.number().describe("Frequency in Hz"),load_capacitance:le.number().optional().describe("Load capacitance in pF")}),Yle=C2.extend({ftype:le.literal("simple_pin_header"),pin_count:le.number(),gender:le.enum(["male","female"]).optional().default("male")}),Xle=C2.extend({ftype:le.literal("simple_resonator"),load_capacitance:q8,equivalent_series_resistance:G8.optional(),frequency:Mk}),Wle=C2.extend({ftype:le.literal("simple_transistor"),transistor_type:le.enum(["npn","pnp"])}),$le=C2.extend({ftype:le.literal("simple_mosfet"),channel_type:le.enum(["n","p"]),mosfet_mode:le.enum(["enhancement","depletion"])}),Zle=C2.extend({ftype:le.literal("simple_switch")}),Qle=le.object({type:le.literal("source_project_metadata"),name:le.string().optional(),software_used_string:le.string().optional(),created_at:le.string().datetime().optional()}),tGe=le.union([Ile,Ule,Ck,JVe,Fle,kle,Ble,Hle,jle,Vle,Gle,qle,eGe,Yle,Xle,Zle,Wle,$le,Qle]),nGe=le.object({type:le.literal("source_port"),pin_number:le.number().optional(),port_hints:le.array(le.string()).optional(),name:le.string(),source_port_id:le.string(),source_component_id:le.string(),subcircuit_id:le.string().optional()}),rGe=le.object({type:le.literal("source_trace"),source_trace_id:le.string(),connected_source_port_ids:le.array(le.string()),connected_source_net_ids:le.array(le.string()),subcircuit_id:le.string().optional(),subcircuit_connectivity_map_key:le.string().optional(),max_length:le.number().optional(),min_trace_thickness:le.number().optional(),display_name:le.string().optional()}),iGe=le.object({type:le.literal("source_group"),source_group_id:le.string(),subcircuit_id:le.string().optional(),parent_subcircuit_id:le.string().optional(),is_subcircuit:le.boolean().optional(),name:le.string().optional()}),aGe=le.object({type:le.literal("source_net"),source_net_id:le.string(),name:le.string(),member_source_group_ids:le.array(le.string()),is_power:le.boolean().optional(),is_ground:le.boolean().optional(),is_digital_signal:le.boolean().optional(),is_analog_signal:le.boolean().optional(),trace_width:le.number().optional(),subcircuit_id:le.string().optional()}),oGe=le.object({type:le.literal("schematic_box"),schematic_component_id:le.string(),width:_i,height:_i,x:_i,y:_i}).describe("Draws a box on the schematic"),sGe=le.object({type:le.literal("schematic_path"),schematic_component_id:le.string(),fill_color:le.enum(["red","blue"]).optional(),is_filled:le.boolean().optional(),points:le.array(Iy)}),lGe=le.record(le.object({left_margin:qv.optional(),right_margin:qv.optional(),top_margin:qv.optional(),bottom_margin:qv.optional()})),cGe=le.object({left_size:le.number(),right_size:le.number(),top_size:le.number().optional(),bottom_size:le.number().optional()}),uGe=le.object({left_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional()}),fGe=le.union([cGe,uGe]),dGe=le.object({type:le.literal("schematic_component"),size:Ole,center:Iy,source_component_id:le.string(),schematic_component_id:le.string(),pin_spacing:qv.optional(),pin_styles:lGe.optional(),box_width:qv.optional(),symbol_name:le.string().optional(),port_arrangement:fGe.optional(),port_labels:le.record(le.string()).optional(),symbol_display_value:le.string().optional()}),hGe=le.object({type:le.literal("schematic_line"),schematic_component_id:le.string(),x1:_i,x2:_i,y1:_i,y2:_i}),pGe=le.object({type:le.literal("schematic_trace"),schematic_trace_id:le.string(),source_trace_id:le.string(),junctions:le.array(le.object({x:le.number(),y:le.number()})),edges:le.array(le.object({from:le.object({x:le.number(),y:le.number()}),to:le.object({x:le.number(),y:le.number()}),is_crossing:le.boolean().optional(),from_schematic_port_id:le.string().optional(),to_schematic_port_id:le.string().optional()}))}),mGe=le.object({type:le.literal("schematic_text"),schematic_component_id:le.string(),schematic_text_id:le.string(),text:le.string(),position:le.object({x:_i,y:_i}),rotation:le.number().default(0),anchor:le.enum(["center","left","right","top","bottom"]).default("center"),color:le.string().default("#000000")}),vGe=le.object({type:le.literal("schematic_port"),schematic_port_id:le.string(),source_port_id:le.string(),schematic_component_id:le.string().optional(),center:Iy,facing_direction:le.enum(["up","down","left","right"]).optional(),distance_from_component_edge:le.number().optional(),side_of_component:le.enum(["top","bottom","left","right"]).optional(),true_ccw_index:le.number().optional(),pin_number:le.number().optional(),display_pin_label:le.string().optional()}).describe("Defines a port on a schematic component"),yGe=le.object({type:le.literal("schematic_net_label"),source_net_id:le.string(),center:Iy,anchor_position:Iy.optional(),anchor_side:le.enum(["top","bottom","left","right"]),text:le.string(),symbol_name:le.string().optional()}),gGe=le.object({type:le.literal("schematic_error"),schematic_error_id:le.string(),error_type:le.literal("schematic_port_not_found"),message:le.string()}).describe("Defines a schematic error on the schematic"),Rk=le.object({type:le.literal("schematic_debug_object"),label:le.string().optional()}),_Ge=Rk.extend({shape:le.literal("rect"),center:Iy,size:Ole}),xGe=Rk.extend({shape:le.literal("line"),start:Iy,end:Iy}),bGe=Rk.extend({shape:le.literal("point"),center:Iy}),SGe=le.discriminatedUnion("shape",[_Ge,xGe,bGe]),EGe=le.object({type:le.literal("schematic_voltage_probe"),schematic_voltage_probe_id:le.string(),position:Iy,schematic_trace_id:le.string(),voltage:Y8.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),wGe=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],Kle=le.enum(wGe),j1=Kle.or(le.object({name:Kle})).transform(r=>typeof r=="string"?r:r.name),X8=le.enum(["top","bottom"]),TGe=le.object({x:_i,y:_i,via:le.boolean().optional(),via_to_layer:j1.optional()});le.array(TGe);var g4=le.object({x:_i,y:_i,via:le.boolean().optional(),to_layer:j1.optional(),trace_width:_i.optional()}),MGe=le.object({type:le.literal("pcb_component"),pcb_component_id:Mv("pcb_component"),source_component_id:le.string(),center:Iy,layer:j1,rotation:wS,width:qv,height:qv,subcircuit_id:le.string().optional()}).describe("Defines a component on the PCB"),Jle=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Mv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.enum(["circle","square"]),hole_diameter:le.number(),x:_i,y:_i});Jle.describe("Defines a circular or square hole on the PCB");var ece=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Mv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("oval"),hole_width:le.number(),hole_height:le.number(),x:_i,y:_i});ece.describe("Defines an oval hole on the PCB");var CGe=Jle.or(ece),RGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_diameter:le.number(),hole_diameter:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")}),AGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.enum(["oval","pill"]),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_width:le.number(),outer_height:le.number(),hole_width:le.number(),hole_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")}),NGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circular_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("circle"),pad_shape:le.literal("rect"),hole_diameter:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")});le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("pill_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("pill"),pad_shape:le.literal("rect"),hole_width:le.number(),hole_height:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")});var PGe=le.union([RGe,AGe,NGe]),DGe=le.object({type:le.literal("pcb_port"),pcb_port_id:Mv("pcb_port"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_port_id:le.string(),pcb_component_id:le.string(),x:_i,y:_i,layers:le.array(j1)}).describe("Defines a port on the PCB"),LGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("circle"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,radius:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),OGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rect"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),zGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rotated_rect"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),ccw_rotation:wS,layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),UGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("pill"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),radius:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),IGe=le.union([LGe,OGe,zGe,UGe]).describe("Defines an SMT pad on the PCB"),kGe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("circle"),pcb_solder_paste_id:Mv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,radius:le.number(),layer:j1,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),FGe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("rect"),pcb_solder_paste_id:Mv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),layer:j1,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),BGe=le.union([kGe,FGe]).describe("Defines solderpaste on the PCB"),HGe=le.object({type:le.literal("pcb_text"),pcb_text_id:Mv("pcb_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),text:le.string(),center:Iy,layer:j1,width:qv,height:qv,lines:le.number(),align:le.enum(["bottom-left"])}).describe("Defines text on the PCB"),jGe=le.object({route_type:le.literal("wire"),x:_i,y:_i,width:_i,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:j1}),VGe=le.object({route_type:le.literal("via"),x:_i,y:_i,from_layer:le.string(),to_layer:le.string()});le.union([jGe,VGe]);var GGe=le.object({type:le.literal("pcb_trace"),source_trace_id:le.string().optional(),pcb_component_id:le.string().optional(),pcb_trace_id:Mv("pcb_trace"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),route_thickness_mode:le.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:le.number().optional(),should_round_corners:le.boolean().optional(),trace_length:le.number().optional(),route:le.array(le.union([le.object({route_type:le.literal("wire"),x:_i,y:_i,width:_i,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:j1}),le.object({route_type:le.literal("via"),x:_i,y:_i,from_layer:le.string(),to_layer:le.string()})]))}).describe("Defines a trace on the PCB"),qGe=le.object({type:le.literal("pcb_trace_error"),pcb_trace_error_id:Mv("pcb_trace_error"),error_type:le.literal("pcb_trace_error"),message:le.string(),center:Iy.optional(),pcb_trace_id:le.string(),source_trace_id:le.string(),pcb_component_ids:le.array(le.string()),pcb_port_ids:le.array(le.string())}).describe("Defines a trace error on the PCB"),YGe=le.object({type:le.literal("pcb_port_not_matched_error"),pcb_error_id:Mv("pcb_error"),message:le.string(),pcb_component_ids:le.array(le.string())}).describe("Defines a trace error on the PCB where a port is not matched"),XGe=le.object({type:le.literal("pcb_via"),pcb_via_id:Mv("pcb_via"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,outer_diameter:_i.default("0.6mm"),hole_diameter:_i.default("0.25mm"),from_layer:j1.optional(),to_layer:j1.optional(),layers:le.array(j1),pcb_trace_id:le.string().optional()}).describe("Defines a via on the PCB"),WGe=le.object({type:le.literal("pcb_board"),pcb_board_id:Mv("pcb_board"),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:qv,height:qv,center:Iy,thickness:qv.optional().default(1.4),num_layers:le.number().optional().default(4),outline:le.array(Iy).optional()}).describe("Defines the board outline of the PCB"),$Ge=le.object({type:le.literal("pcb_placement_error"),pcb_placement_error_id:Mv("pcb_placement_error"),message:le.string()}).describe("Defines a placement error on the PCB"),ZGe=le.object({type:le.literal("pcb_trace_hint"),pcb_trace_hint_id:Mv("pcb_trace_hint"),pcb_port_id:le.string(),pcb_component_id:le.string(),route:le.array(g4)}).describe("A hint that can be used during generation of a PCB trace"),QGe=le.object({type:le.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:Mv("pcb_silkscreen_line"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),stroke_width:_i.default("0.1mm"),x1:_i,y1:_i,x2:_i,y2:_i,layer:X8}).describe("Defines a silkscreen line on the PCB"),KGe=le.object({type:le.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:Mv("pcb_silkscreen_path"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),layer:X8,route:le.array(Iy),stroke_width:qv}).describe("Defines a silkscreen path on the PCB"),JGe=le.object({type:le.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:Mv("pcb_silkscreen_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:_i.default("0.2mm"),pcb_component_id:le.string(),text:le.string(),ccw_rotation:le.number().optional(),layer:j1,is_mirrored:le.boolean().default(!1).optional(),anchor_position:Iy.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),eqe=le.object({type:le.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Mv("pcb_silkscreen_rect"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,width:qv,height:qv,layer:j1,stroke_width:qv.default("1mm")}).describe("Defines a silkscreen rect on the PCB"),tqe=le.object({type:le.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Mv("pcb_silkscreen_circle"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius:qv,layer:X8,stroke_width:qv.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),nqe=le.object({type:le.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Mv("pcb_silkscreen_oval"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius_x:_i,radius_y:_i,layer:X8}).describe("Defines a silkscreen oval on the PCB"),rqe=le.object({type:le.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Mv("pcb_fabrication_note_text"),subcircuit_id:le.string().optional(),pcb_group_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:_i.default("1mm"),pcb_component_id:le.string(),text:le.string(),layer:X8,anchor_position:Iy.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:le.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),iqe=le.object({type:le.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Mv("pcb_fabrication_note_path"),pcb_component_id:le.string(),subcircuit_id:le.string().optional(),layer:j1,route:le.array(Iy),stroke_width:qv,color:le.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),aqe=le.object({type:le.literal("pcb_keepout"),shape:le.literal("rect"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,width:_i,height:_i,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()}).or(le.object({type:le.literal("pcb_keepout"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius:_i,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()})),oqe=le.object({type:le.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Mv("pcb_missing_footprint_error"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),error_type:le.literal("pcb_missing_footprint_error"),source_component_id:le.string(),message:le.string()}).describe("Defines a missing footprint error on the PCB"),sqe=le.object({type:le.literal("pcb_manual_edit_conflict_error"),pcb_error_id:Mv("pcb_manual_edit_conflict_error"),message:le.string(),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_component_id:le.string()}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),lqe=le.object({type:le.literal("pcb_group"),pcb_group_id:Mv("pcb_group"),source_group_id:le.string(),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:qv,height:qv,center:Iy,pcb_component_ids:le.array(le.string()),name:le.string().optional(),description:le.string().optional()}).describe("Defines a group of components on the PCB"),cqe=le.object({type:le.literal("pcb_autorouting_error"),pcb_error_id:Mv("pcb_autorouting_error"),message:le.string()}).describe("The autorouting has failed to route a portion of the board"),uqe=le.object({type:le.literal("cad_component"),cad_component_id:le.string(),pcb_component_id:le.string(),source_component_id:le.string(),position:cA,rotation:cA.optional(),size:cA.optional(),layer:j1.optional(),footprinter_string:le.string().optional(),model_obj_url:le.string().optional(),model_stl_url:le.string().optional(),model_3mf_url:le.string().optional(),model_jscad:le.any().optional()}).describe("Defines a component on the PCB");le.union([rGe,nGe,tGe,Ble,aGe,iGe,kle,Fle,Ule,Ck,Ile,Hle,jle,Vle,Yle,Xle,Zle,Wle,$le,qle,Gle,Qle,MGe,CGe,oqe,sqe,PGe,aqe,DGe,HGe,GGe,XGe,IGe,BGe,WGe,lqe,ZGe,QGe,KGe,JGe,eqe,tqe,nqe,qGe,$Ge,YGe,iqe,rqe,cqe,oGe,mGe,hGe,dGe,vGe,pGe,sGe,gGe,yGe,SGe,EGe,uqe]);var uA={exports:{}},Ak,tce;function fqe(){if(tce)return Ak;tce=1;var r=1e3,e=r*60,t=e*60,n=t*24,i=n*7,a=n*365.25;Ak=function(u,f){f=f||{};var m=typeof u;if(m==="string"&&u.length>0)return o(u);if(m==="number"&&isFinite(u))return f.long?l(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(f){var m=parseFloat(f[1]),_=(f[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return m*a;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*t;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function s(u){var f=Math.abs(u);return f>=n?Math.round(u/n)+"d":f>=t?Math.round(u/t)+"h":f>=e?Math.round(u/e)+"m":f>=r?Math.round(u/r)+"s":u+"ms"}function l(u){var f=Math.abs(u);return f>=n?c(u,f,n,"day"):f>=t?c(u,f,t,"hour"):f>=e?c(u,f,e,"minute"):f>=r?c(u,f,r,"second"):u+" ms"}function c(u,f,m,_){var x=f>=m*1.5;return Math.round(u/m)+" "+_+(x?"s":"")}return Ak}var Nk,nce;function dqe(){if(nce)return Nk;nce=1;function r(e){n.debug=n,n.default=n,n.coerce=c,n.disable=s,n.enable=a,n.enabled=l,n.humanize=fqe(),n.destroy=u,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function t(f){let m=0;for(let _=0;_<f.length;_++)m=(m<<5)-m+f.charCodeAt(_),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=t;function n(f){let m,_=null,x,M;function w(...T){if(!w.enabled)return;const D=w,O=Number(new Date),B=O-(m||O);D.diff=B,D.prev=m,D.curr=O,m=O,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let W=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(Z,J)=>{if(Z==="%%")return"%";W++;const ae=n.formatters[J];if(typeof ae=="function"){const K=T[W];Z=ae.call(D,K),T.splice(W,1),W--}return Z}),n.formatArgs.call(D,T),(D.log||n.log).apply(D,T)}return w.namespace=f,w.useColors=n.useColors(),w.color=n.selectColor(f),w.extend=i,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(x!==n.namespaces&&(x=n.namespaces,M=n.enabled(f)),M),set:T=>{_=T}}),typeof n.init=="function"&&n.init(w),w}function i(f,m){const _=n(this.namespace+(typeof m>"u"?":":m)+f);return _.log=this.log,_}function a(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];const m=(typeof f=="string"?f:"").trim().replace(" ",",").split(",").filter(Boolean);for(const _ of m)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function o(f,m){let _=0,x=0,M=-1,w=0;for(;_<f.length;)if(x<m.length&&(m[x]===f[_]||m[x]==="*"))m[x]==="*"?(M=x,w=_,x++):(_++,x++);else if(M!==-1)x=M+1,w++,_=w;else return!1;for(;x<m.length&&m[x]==="*";)x++;return x===m.length}function s(){const f=[...n.names,...n.skips.map(m=>"-"+m)].join(",");return n.enable(""),f}function l(f){for(const m of n.skips)if(o(f,m))return!1;for(const m of n.names)if(o(f,m))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function u(){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 n.enable(n.load()),n}return Nk=r,Nk}var rce;function hqe(){return rce||(rce=1,function(r,e){e.formatArgs=n,e.save=i,e.load=a,e.useColors=t,e.storage=o(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!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`."))}})(),e.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 t(){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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;l.splice(1,0,c,"color: inherit");let u=0,f=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(u++,m==="%c"&&(f=u))}),l.splice(f,0,c)}e.log=console.debug||console.log||(()=>{});function i(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function a(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}r.exports=dqe()(e);const{formatters:s}=r.exports;s.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(uA,uA.exports)),uA.exports}var pqe=hqe();const T9=yx(pqe);var fA={exports:{}},Pk={exports:{}},dA={exports:{}},Dk={};/**
|
|
245
|
+
*/const Zae=Symbol("Comlink.proxy"),xke=Symbol("Comlink.endpoint"),Qae=Symbol("Comlink.releaseProxy"),OI=Symbol("Comlink.finalizer"),zR=Symbol("Comlink.thrown"),Kae=r=>typeof r=="object"&&r!==null||typeof r=="function",bke={canHandle:r=>Kae(r)&&r[Zae],serialize(r){const{port1:e,port2:t}=new MessageChannel;return eoe(r,e),[t,[t]]},deserialize(r){return r.start(),noe(r)}},Ske={canHandle:r=>Kae(r)&&zR in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},Jae=new Map([["proxy",bke],["throw",Ske]]);function Eke(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function eoe(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!Eke(t,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:o,path:s}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(fE);let c;try{const u=s.slice(0,-1).reduce((m,_)=>m[_],r),f=s.reduce((m,_)=>m[_],r);switch(o){case"GET":c=f;break;case"SET":u[s.slice(-1)[0]]=fE(i.data.value),c=!0;break;case"APPLY":c=f.apply(u,l);break;case"CONSTRUCT":{const m=new f(...l);c=ooe(m)}break;case"ENDPOINT":{const{port1:m,port2:_}=new MessageChannel;eoe(r,_),c=Rke(m,[m])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[zR]:0}}Promise.resolve(c).catch(u=>({value:u,[zR]:0})).then(u=>{const[f,m]=FR(u);e.postMessage(Object.assign(Object.assign({},f),{id:a}),m),o==="RELEASE"&&(e.removeEventListener("message",n),toe(e),OI in r&&typeof r[OI]=="function"&&r[OI]())}).catch(u=>{const[f,m]=FR({value:new TypeError("Unserializable return value"),[zR]:0});e.postMessage(Object.assign(Object.assign({},f),{id:a}),m)})}),e.start&&e.start()}function wke(r){return r.constructor.name==="MessagePort"}function toe(r){wke(r)&&r.close()}function noe(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const o=t.get(a.id);if(o)try{o(a)}finally{t.delete(a.id)}}),zI(r,t,[],e)}function UR(r){if(r)throw new Error("Proxy has been released and is not useable")}function roe(r){return Kw(r,new Map,{type:"RELEASE"}).then(()=>{toe(r)})}const IR=new WeakMap,kR="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(IR.get(r)||0)-1;IR.set(r,e),e===0&&roe(r)});function Tke(r,e){const t=(IR.get(e)||0)+1;IR.set(e,t),kR&&kR.register(r,e,r)}function Mke(r){kR&&kR.unregister(r)}function zI(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(o,s){if(UR(i),s===Qae)return()=>{Mke(a),roe(r),e.clear(),i=!0};if(s==="then"){if(t.length===0)return{then:()=>a};const l=Kw(r,e,{type:"GET",path:t.map(c=>c.toString())}).then(fE);return l.then.bind(l)}return zI(r,e,[...t,s])},set(o,s,l){UR(i);const[c,u]=FR(l);return Kw(r,e,{type:"SET",path:[...t,s].map(f=>f.toString()),value:c},u).then(fE)},apply(o,s,l){UR(i);const c=t[t.length-1];if(c===xke)return Kw(r,e,{type:"ENDPOINT"}).then(fE);if(c==="bind")return zI(r,e,t.slice(0,-1));const[u,f]=ioe(l);return Kw(r,e,{type:"APPLY",path:t.map(m=>m.toString()),argumentList:u},f).then(fE)},construct(o,s){UR(i);const[l,c]=ioe(s);return Kw(r,e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},c).then(fE)}});return Tke(a,r),a}function Cke(r){return Array.prototype.concat.apply([],r)}function ioe(r){const e=r.map(FR);return[e.map(t=>t[0]),Cke(e.map(t=>t[1]))]}const aoe=new WeakMap;function Rke(r,e){return aoe.set(r,e),r}function ooe(r){return Object.assign(r,{[Zae]:!0})}function FR(r){for(const[e,t]of Jae)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},aoe.get(r)||[]]}function fE(r){switch(r.type){case"HANDLER":return Jae.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Kw(r,e,t,n){return new Promise(i=>{const a=Ake();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function Ake(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Nke=async r=>{console.log("[Worker] Creating circuit web worker with config:",r);let e=r.webWorkerBlobUrl??r.webWorkerUrl;if(!e){const o=`https://cdn.jsdelivr.net/npm/@tscircuit/eval@${r.evalVersion??"latest"}/dist/webworker/entrypoint.js`,s=await fetch(o).then(l=>l.blob());e=URL.createObjectURL(s)}const t=new Worker(e,{type:"module"}),n=noe(t);r.snippetsApiBaseUrl&&await n.setSnippetsApiBaseUrl(r.snippetsApiBaseUrl);let i=!1;return{clearEventListeners:n.clearEventListeners.bind(n),execute:async(...o)=>{if(i)throw new Error("CircuitWebWorker was terminated, can't execute");return n.execute.bind(n)(...o)},executeWithFsMap:async(...o)=>{if(i)throw new Error("CircuitWebWorker was terminated, can't executeWithFsMap");return n.executeWithFsMap.bind(n)(...o)},renderUntilSettled:n.renderUntilSettled.bind(n),getCircuitJson:n.getCircuitJson.bind(n),on:(o,s)=>{const l=ooe(s);n.on(o,l)},kill:async()=>{n[Qae](),t.terminate(),i=!0}}};function Sp(r,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(r==null||r(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function Pke(r,e){const t=ct.createContext(e),n=a=>{const{children:o,...s}=a,l=ct.useMemo(()=>s,Object.values(s));return et.jsx(t.Provider,{value:l,children:o})};n.displayName=r+"Provider";function i(a){const o=ct.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${r}\``)}return[n,i]}function yS(r,e=[]){let t=[];function n(a,o){const s=ct.createContext(o),l=t.length;t=[...t,o];const c=f=>{var T;const{scope:m,children:_,...x}=f,M=((T=m==null?void 0:m[r])==null?void 0:T[l])||s,w=ct.useMemo(()=>x,Object.values(x));return et.jsx(M.Provider,{value:w,children:_})};c.displayName=a+"Provider";function u(f,m){var M;const _=((M=m==null?void 0:m[r])==null?void 0:M[l])||s,x=ct.useContext(_);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[c,u]}const i=()=>{const a=t.map(o=>ct.createContext(o));return function(s){const l=(s==null?void 0:s[r])||a;return ct.useMemo(()=>({[`__scope${r}`]:{...s,[r]:l}}),[s,l])}};return i.scopeName=r,[n,Dke(i,...e)]}function Dke(...r){const e=r[0];if(r.length===1)return e;const t=()=>{const n=r.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:c})=>{const f=l(a)[`__scope${c}`];return{...s,...f}},{});return ct.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function soe(r,e){if(typeof r=="function")return r(e);r!=null&&(r.current=e)}function BR(...r){return e=>{let t=!1;const n=r.map(i=>{const a=soe(i,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let i=0;i<n.length;i++){const a=n[i];typeof a=="function"?a():soe(r[i],null)}}}}function Q9(...r){return ct.useCallback(BR(...r),r)}var dE=ct.forwardRef((r,e)=>{const{children:t,...n}=r,i=ct.Children.toArray(t),a=i.find(Lke);if(a){const o=a.props.children,s=i.map(l=>l===a?ct.Children.count(o)>1?ct.Children.only(null):ct.isValidElement(o)?o.props.children:null:l);return et.jsx(UI,{...n,ref:e,children:ct.isValidElement(o)?ct.cloneElement(o,void 0,s):null})}return et.jsx(UI,{...n,ref:e,children:t})});dE.displayName="Slot";var UI=ct.forwardRef((r,e)=>{const{children:t,...n}=r;if(ct.isValidElement(t)){const i=zke(t),a=Oke(n,t.props);return t.type!==ct.Fragment&&(a.ref=e?BR(e,i):i),ct.cloneElement(t,a)}return ct.Children.count(t)>1?ct.Children.only(null):null});UI.displayName="SlotClone";var loe=({children:r})=>et.jsx(et.Fragment,{children:r});function Lke(r){return ct.isValidElement(r)&&r.type===loe}function Oke(r,e){const t={...e};for(const n in e){const i=r[n],a=e[n];/^on[A-Z]/.test(n)?i&&a?t[n]=(...s)=>{a(...s),i(...s)}:i&&(t[n]=i):n==="style"?t[n]={...i,...a}:n==="className"&&(t[n]=[i,a].filter(Boolean).join(" "))}return{...r,...t}}function zke(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}function coe(r){const e=r+"CollectionProvider",[t,n]=yS(e),[i,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:x,children:M}=_,w=wh.useRef(null),T=wh.useRef(new Map).current;return et.jsx(i,{scope:x,itemMap:T,collectionRef:w,children:M})};o.displayName=e;const s=r+"CollectionSlot",l=wh.forwardRef((_,x)=>{const{scope:M,children:w}=_,T=a(s,M),D=Q9(x,T.collectionRef);return et.jsx(dE,{ref:D,children:w})});l.displayName=s;const c=r+"CollectionItemSlot",u="data-radix-collection-item",f=wh.forwardRef((_,x)=>{const{scope:M,children:w,...T}=_,D=wh.useRef(null),O=Q9(x,D),B=a(c,M);return wh.useEffect(()=>(B.itemMap.set(D,{ref:D,...T}),()=>void B.itemMap.delete(D))),et.jsx(dE,{[u]:"",ref:O,children:w})});f.displayName=c;function m(_){const x=a(r+"CollectionConsumer",_);return wh.useCallback(()=>{const w=x.collectionRef.current;if(!w)return[];const T=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(x.itemMap.values()).sort((B,W)=>T.indexOf(B.ref.current)-T.indexOf(W.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},m,n]}var hE=globalThis!=null&&globalThis.document?ct.useLayoutEffect:()=>{},Uke=_ke.useId||(()=>{}),Ike=0;function gS(r){const[e,t]=ct.useState(Uke());return hE(()=>{t(n=>n??String(Ike++))},[r]),e?`radix-${e}`:""}var II=Xae();const kke=yx(II);var Fke=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ng=Fke.reduce((r,e)=>{const t=ct.forwardRef((n,i)=>{const{asChild:a,...o}=n,s=a?dE:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),et.jsx(s,{...o,ref:i})});return t.displayName=`Primitive.${e}`,{...r,[e]:t}},{});function uoe(r,e){r&&II.flushSync(()=>r.dispatchEvent(e))}function z3(r){const e=ct.useRef(r);return ct.useEffect(()=>{e.current=r}),ct.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}function Jw({prop:r,defaultProp:e,onChange:t=()=>{}}){const[n,i]=Bke({defaultProp:e,onChange:t}),a=r!==void 0,o=a?r:n,s=z3(t),l=ct.useCallback(c=>{if(a){const f=typeof c=="function"?c(r):c;f!==r&&s(f)}else i(c)},[a,r,i,s]);return[o,l]}function Bke({defaultProp:r,onChange:e}){const t=ct.useState(r),[n]=t,i=ct.useRef(n),a=z3(e);return ct.useEffect(()=>{i.current!==n&&(a(n),i.current=n)},[n,i,a]),t}var Hke=ct.createContext(void 0);function kI(r){const e=ct.useContext(Hke);return r||e||"ltr"}var FI="rovingFocusGroup.onEntryFocus",jke={bubbles:!1,cancelable:!0},HR="RovingFocusGroup",[BI,foe,Vke]=coe(HR),[Gke,jR]=yS(HR,[Vke]),[qke,Yke]=Gke(HR),doe=ct.forwardRef((r,e)=>et.jsx(BI.Provider,{scope:r.__scopeRovingFocusGroup,children:et.jsx(BI.Slot,{scope:r.__scopeRovingFocusGroup,children:et.jsx(Xke,{...r,ref:e})})}));doe.displayName=HR;var Xke=ct.forwardRef((r,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=r,m=ct.useRef(null),_=Q9(e,m),x=kI(a),[M=null,w]=Jw({prop:o,defaultProp:s,onChange:l}),[T,D]=ct.useState(!1),O=z3(c),B=foe(t),W=ct.useRef(!1),[$,Z]=ct.useState(0);return ct.useEffect(()=>{const J=m.current;if(J)return J.addEventListener(FI,O),()=>J.removeEventListener(FI,O)},[O]),et.jsx(qke,{scope:t,orientation:n,dir:x,loop:i,currentTabStopId:M,onItemFocus:ct.useCallback(J=>w(J),[w]),onItemShiftTab:ct.useCallback(()=>D(!0),[]),onFocusableItemAdd:ct.useCallback(()=>Z(J=>J+1),[]),onFocusableItemRemove:ct.useCallback(()=>Z(J=>J-1),[]),children:et.jsx(Ng.div,{tabIndex:T||$===0?-1:0,"data-orientation":n,...f,ref:_,style:{outline:"none",...r.style},onMouseDown:Sp(r.onMouseDown,()=>{W.current=!0}),onFocus:Sp(r.onFocus,J=>{const ae=!W.current;if(J.target===J.currentTarget&&ae&&!T){const K=new CustomEvent(FI,jke);if(J.currentTarget.dispatchEvent(K),!K.defaultPrevented){const he=B().filter(we=>we.focusable),me=he.find(we=>we.active),be=he.find(we=>we.id===M),Le=[me,be,...he].filter(Boolean).map(we=>we.ref.current);moe(Le,u)}}W.current=!1}),onBlur:Sp(r.onBlur,()=>D(!1))})})}),hoe="RovingFocusGroupItem",poe=ct.forwardRef((r,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:i=!1,tabStopId:a,...o}=r,s=gS(),l=a||s,c=Yke(hoe,t),u=c.currentTabStopId===l,f=foe(t),{onFocusableItemAdd:m,onFocusableItemRemove:_}=c;return ct.useEffect(()=>{if(n)return m(),()=>_()},[n,m,_]),et.jsx(BI.ItemSlot,{scope:t,id:l,focusable:n,active:i,children:et.jsx(Ng.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:Sp(r.onMouseDown,x=>{n?c.onItemFocus(l):x.preventDefault()}),onFocus:Sp(r.onFocus,()=>c.onItemFocus(l)),onKeyDown:Sp(r.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){c.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const M=Zke(x,c.orientation,c.dir);if(M!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let T=f().filter(D=>D.focusable).map(D=>D.ref.current);if(M==="last")T.reverse();else if(M==="prev"||M==="next"){M==="prev"&&T.reverse();const D=T.indexOf(x.currentTarget);T=c.loop?Qke(T,D+1):T.slice(D+1)}setTimeout(()=>moe(T))}})})})});poe.displayName=hoe;var Wke={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $ke(r,e){return e!=="rtl"?r:r==="ArrowLeft"?"ArrowRight":r==="ArrowRight"?"ArrowLeft":r}function Zke(r,e,t){const n=$ke(r.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Wke[n]}function moe(r,e=!1){const t=document.activeElement;for(const n of r)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function Qke(r,e){return r.map((t,n)=>r[(e+n)%r.length])}var voe=doe,yoe=poe;function Kke(r,e){return ct.useReducer((t,n)=>e[t][n]??t,r)}var Lb=r=>{const{present:e,children:t}=r,n=Jke(e),i=typeof t=="function"?t({present:n.isPresent}):ct.Children.only(t),a=Q9(n.ref,eFe(i));return typeof t=="function"||n.isPresent?ct.cloneElement(i,{ref:a}):null};Lb.displayName="Presence";function Jke(r){const[e,t]=ct.useState(),n=ct.useRef({}),i=ct.useRef(r),a=ct.useRef("none"),o=r?"mounted":"unmounted",[s,l]=Kke(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ct.useEffect(()=>{const c=VR(n.current);a.current=s==="mounted"?c:"none"},[s]),hE(()=>{const c=n.current,u=i.current;if(u!==r){const m=a.current,_=VR(c);r?l("MOUNT"):_==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&m!==_?"ANIMATION_OUT":"UNMOUNT"),i.current=r}},[r,l]),hE(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,f=_=>{const M=VR(n.current).includes(_.animationName);if(_.target===e&&M&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},m=_=>{_.target===e&&(a.current=VR(n.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:ct.useCallback(c=>{c&&(n.current=getComputedStyle(c)),t(c)},[])}}function VR(r){return(r==null?void 0:r.animationName)||"none"}function eFe(r){var n,i;let e=(n=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?r.ref:(e=(i=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?r.props.ref:r.props.ref||r.ref)}var HI="Tabs",[tFe,aFt]=yS(HI,[jR]),goe=jR(),[nFe,jI]=tFe(HI),_oe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...c}=r,u=kI(s),[f,m]=Jw({prop:n,onChange:i,defaultProp:a});return et.jsx(nFe,{scope:t,baseId:gS(),value:f,onValueChange:m,orientation:o,dir:u,activationMode:l,children:et.jsx(Ng.div,{dir:u,"data-orientation":o,...c,ref:e})})});_oe.displayName=HI;var xoe="TabsList",boe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,loop:n=!0,...i}=r,a=jI(xoe,t),o=goe(t);return et.jsx(voe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:et.jsx(Ng.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:e})})});boe.displayName=xoe;var Soe="TabsTrigger",Eoe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,disabled:i=!1,...a}=r,o=jI(Soe,t),s=goe(t),l=Moe(o.baseId,n),c=Coe(o.baseId,n),u=n===o.value;return et.jsx(yoe,{asChild:!0,...s,focusable:!i,active:u,children:et.jsx(Ng.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...a,ref:e,onMouseDown:Sp(r.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Sp(r.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Sp(r.onFocus,()=>{const f=o.activationMode!=="manual";!u&&!i&&f&&o.onValueChange(n)})})})});Eoe.displayName=Soe;var woe="TabsContent",Toe=ct.forwardRef((r,e)=>{const{__scopeTabs:t,value:n,forceMount:i,children:a,...o}=r,s=jI(woe,t),l=Moe(s.baseId,n),c=Coe(s.baseId,n),u=n===s.value,f=ct.useRef(u);return ct.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),et.jsx(Lb,{present:i||u,children:({present:m})=>et.jsx(Ng.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:c,tabIndex:0,...o,ref:e,style:{...r.style,animationDuration:f.current?"0s":void 0},children:m&&a})})});Toe.displayName=woe;function Moe(r,e){return`${r}-trigger-${e}`}function Coe(r,e){return`${r}-content-${e}`}var rFe=_oe,Roe=boe,Aoe=Eoe,Noe=Toe;function Poe(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r)){var i=r.length;for(e=0;e<i;e++)r[e]&&(t=Poe(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function Ob(){for(var r,e,t=0,n="",i=arguments.length;t<i;t++)(r=arguments[t])&&(e=Poe(r))&&(n&&(n+=" "),n+=e);return n}const VI="-",iFe=r=>{const e=oFe(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{const s=o.split(VI);return s[0]===""&&s.length!==1&&s.shift(),Doe(s,e)||aFe(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},Doe=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],n=e.nextPart.get(t),i=n?Doe(r.slice(1),n):void 0;if(i)return i;if(e.validators.length===0)return;const a=r.join(VI);return(o=e.validators.find(({validator:s})=>s(a)))==null?void 0:o.classGroupId},Loe=/^\[(.+)\]$/,aFe=r=>{if(Loe.test(r)){const e=Loe.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},oFe=r=>{const{theme:e,prefix:t}=r,n={nextPart:new Map,validators:[]};return lFe(Object.entries(r.classGroups),t).forEach(([a,o])=>{GI(o,n,a,e)}),n},GI=(r,e,t,n)=>{r.forEach(i=>{if(typeof i=="string"){const a=i===""?e:Ooe(e,i);a.classGroupId=t;return}if(typeof i=="function"){if(sFe(i)){GI(i(n),e,t,n);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([a,o])=>{GI(o,Ooe(e,a),t,n)})})},Ooe=(r,e)=>{let t=r;return e.split(VI).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},sFe=r=>r.isThemeGetter,lFe=(r,e)=>e?r.map(([t,n])=>{const i=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,s])=>[e+o,s])):a);return[t,i]}):r,cFe=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const i=(a,o)=>{t.set(a,o),e++,e>r&&(e=0,n=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return i(a,o),o},set(a,o){t.has(a)?t.set(a,o):i(a,o)}}},zoe="!",uFe=r=>{const{separator:e,experimentalParseClassName:t}=r,n=e.length===1,i=e[0],a=e.length,o=s=>{const l=[];let c=0,u=0,f;for(let w=0;w<s.length;w++){let T=s[w];if(c===0){if(T===i&&(n||s.slice(w,w+a)===e)){l.push(s.slice(u,w)),u=w+a;continue}if(T==="/"){f=w;continue}}T==="["?c++:T==="]"&&c--}const m=l.length===0?s:s.substring(u),_=m.startsWith(zoe),x=_?m.substring(1):m,M=f&&f>u?f-u:void 0;return{modifiers:l,hasImportantModifier:_,baseClassName:x,maybePostfixModifierPosition:M}};return t?s=>t({className:s,parseClassName:o}):o},fFe=r=>{if(r.length<=1)return r;const e=[];let t=[];return r.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},dFe=r=>({cache:cFe(r.cacheSize),parseClassName:uFe(r),...iFe(r)}),hFe=/\s+/,pFe=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:i}=e,a=[],o=r.trim().split(hFe);let s="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:_}=t(c);let x=!!_,M=n(x?m.substring(0,_):m);if(!M){if(!x){s=c+(s.length>0?" "+s:s);continue}if(M=n(m),!M){s=c+(s.length>0?" "+s:s);continue}x=!1}const w=fFe(u).join(":"),T=f?w+zoe:w,D=T+M;if(a.includes(D))continue;a.push(D);const O=i(M,x);for(let B=0;B<O.length;++B){const W=O[B];a.push(T+W)}s=c+(s.length>0?" "+s:s)}return s};function mFe(){let r=0,e,t,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Uoe(e))&&(n&&(n+=" "),n+=t);return n}const Uoe=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=Uoe(r[n]))&&(t&&(t+=" "),t+=e);return t};function vFe(r,...e){let t,n,i,a=o;function o(l){const c=e.reduce((u,f)=>f(u),r());return t=dFe(c),n=t.cache.get,i=t.cache.set,a=s,s(l)}function s(l){const c=n(l);if(c)return c;const u=pFe(l,t);return i(l,u),u}return function(){return a(mFe.apply(null,arguments))}}const Wg=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},Ioe=/^\[(?:([a-z-]+):)?(.+)\]$/i,yFe=/^\d+\/\d+$/,gFe=new Set(["px","full","screen"]),_Fe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xFe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,bFe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,SFe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EFe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_S=r=>eT(r)||gFe.has(r)||yFe.test(r),d4=r=>tT(r,"length",PFe),eT=r=>!!r&&!Number.isNaN(Number(r)),qI=r=>tT(r,"number",eT),x8=r=>!!r&&Number.isInteger(Number(r)),wFe=r=>r.endsWith("%")&&eT(r.slice(0,-1)),A0=r=>Ioe.test(r),h4=r=>_Fe.test(r),TFe=new Set(["length","size","percentage"]),MFe=r=>tT(r,TFe,koe),CFe=r=>tT(r,"position",koe),RFe=new Set(["image","url"]),AFe=r=>tT(r,RFe,LFe),NFe=r=>tT(r,"",DFe),b8=()=>!0,tT=(r,e,t)=>{const n=Ioe.exec(r);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},PFe=r=>xFe.test(r)&&!bFe.test(r),koe=()=>!1,DFe=r=>SFe.test(r),LFe=r=>EFe.test(r),OFe=vFe(()=>{const r=Wg("colors"),e=Wg("spacing"),t=Wg("blur"),n=Wg("brightness"),i=Wg("borderColor"),a=Wg("borderRadius"),o=Wg("borderSpacing"),s=Wg("borderWidth"),l=Wg("contrast"),c=Wg("grayscale"),u=Wg("hueRotate"),f=Wg("invert"),m=Wg("gap"),_=Wg("gradientColorStops"),x=Wg("gradientColorStopPositions"),M=Wg("inset"),w=Wg("margin"),T=Wg("opacity"),D=Wg("padding"),O=Wg("saturate"),B=Wg("scale"),W=Wg("sepia"),$=Wg("skew"),Z=Wg("space"),J=Wg("translate"),ae=()=>["auto","contain","none"],K=()=>["auto","hidden","clip","visible","scroll"],he=()=>["auto",A0,e],me=()=>[A0,e],be=()=>["",_S,d4],Ae=()=>["auto",eT,A0],Le=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],we=()=>["solid","dashed","dotted","double","none"],Oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Te=()=>["start","end","center","between","around","evenly","stretch"],Ve=()=>["","0",A0],Ue=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ie=()=>[eT,A0];return{cacheSize:500,separator:":",theme:{colors:[b8],spacing:[_S,d4],blur:["none","",h4,A0],brightness:Ie(),borderColor:[r],borderRadius:["none","","full",h4,A0],borderSpacing:me(),borderWidth:be(),contrast:Ie(),grayscale:Ve(),hueRotate:Ie(),invert:Ve(),gap:me(),gradientColorStops:[r],gradientColorStopPositions:[wFe,d4],inset:he(),margin:he(),opacity:Ie(),padding:me(),saturate:Ie(),scale:Ie(),sepia:Ve(),skew:Ie(),space:me(),translate:me()},classGroups:{aspect:[{aspect:["auto","square","video",A0]}],container:["container"],columns:[{columns:[h4]}],"break-after":[{"break-after":Ue()}],"break-before":[{"break-before":Ue()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Le(),A0]}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:ae()}],"overscroll-x":[{"overscroll-x":ae()}],"overscroll-y":[{"overscroll-y":ae()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[M]}],"inset-x":[{"inset-x":[M]}],"inset-y":[{"inset-y":[M]}],start:[{start:[M]}],end:[{end:[M]}],top:[{top:[M]}],right:[{right:[M]}],bottom:[{bottom:[M]}],left:[{left:[M]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",x8,A0]}],basis:[{basis:he()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",A0]}],grow:[{grow:Ve()}],shrink:[{shrink:Ve()}],order:[{order:["first","last","none",x8,A0]}],"grid-cols":[{"grid-cols":[b8]}],"col-start-end":[{col:["auto",{span:["full",x8,A0]},A0]}],"col-start":[{"col-start":Ae()}],"col-end":[{"col-end":Ae()}],"grid-rows":[{"grid-rows":[b8]}],"row-start-end":[{row:["auto",{span:[x8,A0]},A0]}],"row-start":[{"row-start":Ae()}],"row-end":[{"row-end":Ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",A0]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",A0]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...Te()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Te(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Te(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[Z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[Z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",A0,e]}],"min-w":[{"min-w":[A0,e,"min","max","fit"]}],"max-w":[{"max-w":[A0,e,"none","full","min","max","fit","prose",{screen:[h4]},h4]}],h:[{h:[A0,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[A0,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[A0,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[A0,e,"auto","min","max","fit"]}],"font-size":[{text:["base",h4,d4]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qI]}],"font-family":[{font:[b8]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",A0]}],"line-clamp":[{"line-clamp":["none",eT,qI]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_S,A0]}],"list-image":[{"list-image":["none",A0]}],"list-style-type":[{list:["none","disc","decimal",A0]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[T]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[T]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_S,d4]}],"underline-offset":[{"underline-offset":["auto",_S,A0]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:me()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",A0]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",A0]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[T]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Le(),CFe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",MFe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},AFe]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[_]}],"gradient-via":[{via:[_]}],"gradient-to":[{to:[_]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[T]}],"border-style":[{border:[...we(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[T]}],"divide-style":[{divide:we()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...we()]}],"outline-offset":[{"outline-offset":[_S,A0]}],"outline-w":[{outline:[_S,d4]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[T]}],"ring-offset-w":[{"ring-offset":[_S,d4]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",h4,NFe]}],"shadow-color":[{shadow:[b8]}],opacity:[{opacity:[T]}],"mix-blend":[{"mix-blend":[...Oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Oe()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",h4,A0]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[O]}],sepia:[{sepia:[W]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[T]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[W]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",A0]}],duration:[{duration:Ie()}],ease:[{ease:["linear","in","out","in-out",A0]}],delay:[{delay:Ie()}],animate:[{animate:["none","spin","ping","pulse","bounce",A0]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[B]}],"scale-x":[{"scale-x":[B]}],"scale-y":[{"scale-y":[B]}],rotate:[{rotate:[x8,A0]}],"translate-x":[{"translate-x":[J]}],"translate-y":[{"translate-y":[J]}],"skew-x":[{"skew-x":[$]}],"skew-y":[{"skew-y":[$]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",A0]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",A0]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":me()}],"scroll-mx":[{"scroll-mx":me()}],"scroll-my":[{"scroll-my":me()}],"scroll-ms":[{"scroll-ms":me()}],"scroll-me":[{"scroll-me":me()}],"scroll-mt":[{"scroll-mt":me()}],"scroll-mr":[{"scroll-mr":me()}],"scroll-mb":[{"scroll-mb":me()}],"scroll-ml":[{"scroll-ml":me()}],"scroll-p":[{"scroll-p":me()}],"scroll-px":[{"scroll-px":me()}],"scroll-py":[{"scroll-py":me()}],"scroll-ps":[{"scroll-ps":me()}],"scroll-pe":[{"scroll-pe":me()}],"scroll-pt":[{"scroll-pt":me()}],"scroll-pr":[{"scroll-pr":me()}],"scroll-pb":[{"scroll-pb":me()}],"scroll-pl":[{"scroll-pl":me()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",A0]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[_S,d4,qI]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function Jm(...r){return OFe(Ob(r))}const Foe=r=>r.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),zFe=rFe,Boe=ct.forwardRef(({className:r,...e},t)=>et.jsx(Roe,{ref:t,className:Jm("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",r),...e}));Boe.displayName=Roe.displayName;const nT=ct.forwardRef(({className:r,...e},t)=>et.jsx(Aoe,{ref:t,className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",r),...e}));nT.displayName=Aoe.displayName;const zb=ct.forwardRef(({className:r,...e},t)=>et.jsx(Noe,{ref:t,className:Jm("rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",r),...e}));zb.displayName=Noe.displayName;var wv;(function(r){r.assertEqual=i=>i;function e(i){}r.assertIs=e;function t(i){throw new Error}r.assertNever=t,r.arrayToEnum=i=>{const a={};for(const o of i)a[o]=o;return a},r.getValidEnumValues=i=>{const a=r.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(const s of a)o[s]=i[s];return r.objectValues(o)},r.objectValues=i=>r.objectKeys(i).map(function(a){return i[a]}),r.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},r.find=(i,a)=>{for(const o of i)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(wv||(wv={}));var YI;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(YI||(YI={}));const Cc=wv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xS=r=>{switch(typeof r){case"undefined":return Cc.undefined;case"string":return Cc.string;case"number":return isNaN(r)?Cc.nan:Cc.number;case"boolean":return Cc.boolean;case"function":return Cc.function;case"bigint":return Cc.bigint;case"symbol":return Cc.symbol;case"object":return Array.isArray(r)?Cc.array:r===null?Cc.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Cc.promise:typeof Map<"u"&&r instanceof Map?Cc.map:typeof Set<"u"&&r instanceof Set?Cc.set:typeof Date<"u"&&r instanceof Date?Cc.date:Cc.object;default:return Cc.unknown}},Ko=wv.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"]),UFe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let ab=class sIe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},i=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return i(this),n}static assert(e){if(!(e instanceof sIe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wv.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ab.create=r=>new ab(r);const rT=(r,e)=>{let t;switch(r.code){case Ko.invalid_type:r.received===Cc.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case Ko.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,wv.jsonStringifyReplacer)}`;break;case Ko.unrecognized_keys:t=`Unrecognized key(s) in object: ${wv.joinValues(r.keys,", ")}`;break;case Ko.invalid_union:t="Invalid input";break;case Ko.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${wv.joinValues(r.options)}`;break;case Ko.invalid_enum_value:t=`Invalid enum value. Expected ${wv.joinValues(r.options)}, received '${r.received}'`;break;case Ko.invalid_arguments:t="Invalid function arguments";break;case Ko.invalid_return_type:t="Invalid function return type";break;case Ko.invalid_date:t="Invalid date";break;case Ko.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:wv.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case Ko.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case Ko.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case Ko.custom:t="Invalid input";break;case Ko.invalid_intersection_types:t="Intersection results could not be merged";break;case Ko.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case Ko.not_finite:t="Number must be finite";break;default:t=e.defaultError,wv.assertNever(r)}return{message:t}};let Hoe=rT;function IFe(r){Hoe=r}function GR(){return Hoe}const qR=r=>{const{data:e,path:t,errorMaps:n,issueData:i}=r,a=[...t,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},kFe=[];function Xl(r,e){const t=GR(),n=qR({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===rT?void 0:rT].filter(i=>!!i)});r.common.issues.push(n)}let V5=class lIe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if(i.status==="aborted")return Th;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const a=await i.key,o=await i.value;n.push({key:a,value:o})}return lIe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Th;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}};const Th=Object.freeze({status:"aborted"}),iT=r=>({status:"dirty",value:r}),S5=r=>({status:"valid",value:r}),XI=r=>r.status==="aborted",WI=r=>r.status==="dirty",pE=r=>r.status==="valid",S8=r=>typeof Promise<"u"&&r instanceof Promise;function YR(r,e,t,n){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function joe(r,e,t,n,i){if(typeof e=="function"?r!==e||!0:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;var Qu;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Qu||(Qu={}));var E8,w8;let Ub=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const Voe=(r,e)=>{if(pE(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ab(r.common.issues);return this._error=t,this._error}}};function u0(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:i}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{var l,c;const{message:u}=r;return o.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:(l=u??n)!==null&&l!==void 0?l:s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:(c=u??t)!==null&&c!==void 0?c:s.defaultError}},description:i}}let k0=class{get description(){return this._def.description}_getType(e){return xS(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V5,ctx:{common:e.parent.common,data:e.data,parsedType:xS(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S8(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)},a=this._parseSync({data:e,path:i.path,parent:i});return Voe(i,a)}"~validate"(e){var t,n;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:i});return pE(a)?{value:a.value}:{issues:i.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(a=>pE(a)?{value:a.value}:{issues:i.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xS(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(S8(i)?i:Promise.resolve(i));return Voe(n,a)}refine(e,t){const n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,a)=>{const o=e(i),s=()=>a.addIssue({code:Ko.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new ob({schema:this,typeName:fh.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return Ib.create(this,this._def)}nullable(){return m4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return vE.create(this)}promise(){return lT.create(this,this._def)}or(e){return P8.create([this,e],this._def)}and(e){return D8.create(this,e,this._def)}transform(e){return new ob({...u0(this._def),schema:this,typeName:fh.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new I8({...u0(this._def),innerType:this,defaultValue:t,typeName:fh.ZodDefault})}brand(){return new QI({typeName:fh.ZodBranded,type:this,...u0(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new k8({...u0(this._def),innerType:this,catchValue:t,typeName:fh.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return KI.create(this,e)}readonly(){return F8.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const FFe=/^c[^\s-]{8,}$/i,BFe=/^[0-9a-z]+$/,HFe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jFe=/^[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,VFe=/^[a-z0-9_-]{21}$/i,GFe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,qFe=/^[-+]?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)?)??$/,YFe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,XFe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $I;const WFe=/^(?:(?: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])$/,$Fe=/^(?:(?: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])$/,ZFe=/^(([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]))$/,QFe=/^(([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])$/,KFe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,JFe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Goe="((\\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])))",eBe=new RegExp(`^${Goe}$`);function qoe(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function tBe(r){return new RegExp(`^${qoe(r)}$`)}function Yoe(r){let e=`${Goe}T${qoe(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function nBe(r,e){return!!((e==="v4"||!e)&&WFe.test(r)||(e==="v6"||!e)&&ZFe.test(r))}function rBe(r,e){if(!GFe.test(r))return!1;try{const[t]=r.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function iBe(r,e){return!!((e==="v4"||!e)&&$Fe.test(r)||(e==="v6"||!e)&&QFe.test(r))}let aT=class AR extends k0{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cc.string){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.string,received:a.parsedType}),Th}const n=new V5;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?Xl(i,{code:Ko.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Xl(i,{code:Ko.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")YFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"email",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")$I||($I=new RegExp(XFe,"u")),$I.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"emoji",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")jFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"uuid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")VFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"nanoid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")FFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cuid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")BFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cuid2",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")HFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"ulid",code:Ko.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Xl(i,{validation:"url",code:Ko.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"regex",code:Ko.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Yoe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?eBe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?tBe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?qFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"duration",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?nBe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"ip",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?rBe(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"jwt",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?iBe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"cidr",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?KFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"base64",code:Ko.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?JFe.test(e.data)||(i=this._getOrReturnCtx(e,i),Xl(i,{validation:"base64url",code:Ko.invalid_string,message:a.message}),n.dirty()):wv.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:Ko.invalid_string,...Qu.errToObj(n)})}_addCheck(e){return new AR({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Qu.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Qu.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Qu.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Qu.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Qu.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Qu.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Qu.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Qu.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Qu.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Qu.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Qu.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Qu.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Qu.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!1,...Qu.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Qu.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Qu.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Qu.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Qu.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Qu.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Qu.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Qu.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Qu.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Qu.errToObj(t)})}nonempty(e){return this.min(1,Qu.errToObj(e))}trim(){return new AR({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new AR({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new AR({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};aT.create=r=>{var e;return new aT({checks:[],typeName:fh.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...u0(r)})};function aBe(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,a=parseInt(r.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return a%o/Math.pow(10,i)}let T8=class _ae extends k0{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Cc.number){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.number,received:a.parsedType}),Th}let n;const i=new V5;for(const a of this._def.checks)a.kind==="int"?wv.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?aBe(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_finite,message:a.message}),i.dirty()):wv.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Qu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Qu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Qu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Qu.toString(t))}setLimit(e,t,n,i){return new _ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Qu.toString(i)}]})}_addCheck(e){return new _ae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Qu.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Qu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Qu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Qu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Qu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Qu.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Qu.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Qu.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Qu.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&wv.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};T8.create=r=>new T8({checks:[],typeName:fh.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...u0(r)});let M8=class xae extends k0{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Cc.bigint)return this._getInvalidInput(e);let n;const i=new V5;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Xl(n,{code:Ko.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):wv.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Xl(t,{code:Ko.invalid_type,expected:Cc.bigint,received:t.parsedType}),Th}gte(e,t){return this.setLimit("min",e,!0,Qu.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Qu.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Qu.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Qu.toString(t))}setLimit(e,t,n,i){return new xae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Qu.toString(i)}]})}_addCheck(e){return new xae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Qu.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Qu.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Qu.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Qu.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Qu.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};M8.create=r=>{var e;return new M8({checks:[],typeName:fh.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...u0(r)})};let C8=class extends k0{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cc.boolean){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.boolean,received:n.parsedType}),Th}return S5(e.data)}};C8.create=r=>new C8({typeName:fh.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...u0(r)});let R8=class cIe extends k0{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cc.date){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_type,expected:Cc.date,received:a.parsedType}),Th}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Xl(a,{code:Ko.invalid_date}),Th}const n=new V5;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),Xl(i,{code:Ko.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):wv.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new cIe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Qu.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Qu.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};R8.create=r=>new R8({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:fh.ZodDate,...u0(r)});let XR=class extends k0{_parse(e){if(this._getType(e)!==Cc.symbol){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.symbol,received:n.parsedType}),Th}return S5(e.data)}};XR.create=r=>new XR({typeName:fh.ZodSymbol,...u0(r)});let A8=class extends k0{_parse(e){if(this._getType(e)!==Cc.undefined){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.undefined,received:n.parsedType}),Th}return S5(e.data)}};A8.create=r=>new A8({typeName:fh.ZodUndefined,...u0(r)});let N8=class extends k0{_parse(e){if(this._getType(e)!==Cc.null){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.null,received:n.parsedType}),Th}return S5(e.data)}};N8.create=r=>new N8({typeName:fh.ZodNull,...u0(r)});let oT=class extends k0{constructor(){super(...arguments),this._any=!0}_parse(e){return S5(e.data)}};oT.create=r=>new oT({typeName:fh.ZodAny,...u0(r)});let mE=class extends k0{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S5(e.data)}};mE.create=r=>new mE({typeName:fh.ZodUnknown,...u0(r)});let bS=class extends k0{_parse(e){const t=this._getOrReturnCtx(e);return Xl(t,{code:Ko.invalid_type,expected:Cc.never,received:t.parsedType}),Th}};bS.create=r=>new bS({typeName:fh.ZodNever,...u0(r)});let WR=class extends k0{_parse(e){if(this._getType(e)!==Cc.undefined){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.void,received:n.parsedType}),Th}return S5(e.data)}};WR.create=r=>new WR({typeName:fh.ZodVoid,...u0(r)});let vE=class SI extends k0{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Cc.array)return Xl(t,{code:Ko.invalid_type,expected:Cc.array,received:t.parsedType}),Th;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;(o||s)&&(Xl(t,{code:o?Ko.too_big:Ko.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(Xl(t,{code:Ko.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(Xl(t,{code:Ko.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>i.type._parseAsync(new Ub(t,o,t.path,s)))).then(o=>V5.mergeArray(n,o));const a=[...t.data].map((o,s)=>i.type._parseSync(new Ub(t,o,t.path,s)));return V5.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new SI({...this._def,minLength:{value:e,message:Qu.toString(t)}})}max(e,t){return new SI({...this._def,maxLength:{value:e,message:Qu.toString(t)}})}length(e,t){return new SI({...this._def,exactLength:{value:e,message:Qu.toString(t)}})}nonempty(e){return this.min(1,e)}};vE.create=(r,e)=>new vE({type:r,minLength:null,maxLength:null,exactLength:null,typeName:fh.ZodArray,...u0(e)});function sT(r){if(r instanceof U3){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Ib.create(sT(n))}return new U3({...r._def,shape:()=>e})}else return r instanceof vE?new vE({...r._def,type:sT(r.element)}):r instanceof Ib?Ib.create(sT(r.unwrap())):r instanceof m4?m4.create(sT(r.unwrap())):r instanceof p4?p4.create(r.items.map(e=>sT(e))):r}let U3=class Pb extends k0{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=wv.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Cc.object){const c=this._getOrReturnCtx(e);return Xl(c,{code:Ko.invalid_type,expected:Cc.object,received:c.parsedType}),Th}const{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof bS&&this._def.unknownKeys==="strip"))for(const c in i.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const u=a[c],f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ub(i,f,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof bS){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")s.length>0&&(Xl(i,{code:Ko.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of s){const f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ub(i,f,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const f=await u.key,m=await u.value;c.push({key:f,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>V5.mergeObjectSync(n,c)):V5.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Qu.errToObj,new Pb({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,a,o,s;const l=(o=(a=(i=this._def).errorMap)===null||a===void 0?void 0:a.call(i,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(s=Qu.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Pb({...this._def,unknownKeys:"strip"})}passthrough(){return new Pb({...this._def,unknownKeys:"passthrough"})}extend(e){return new Pb({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Pb({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:fh.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Pb({...this._def,catchall:e})}pick(e){const t={};return wv.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Pb({...this._def,shape:()=>t})}omit(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Pb({...this._def,shape:()=>t})}deepPartial(){return sT(this)}partial(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new Pb({...this._def,shape:()=>t})}required(e){const t={};return wv.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ib;)a=a._def.innerType;t[n]=a}}),new Pb({...this._def,shape:()=>t})}keyof(){return Zoe(wv.objectKeys(this.shape))}};U3.create=(r,e)=>new U3({shape:()=>r,unknownKeys:"strip",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)}),U3.strictCreate=(r,e)=>new U3({shape:()=>r,unknownKeys:"strict",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)}),U3.lazycreate=(r,e)=>new U3({shape:r,unknownKeys:"strip",catchall:bS.create(),typeName:fh.ZodObject,...u0(e)});let P8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function i(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(s=>new ab(s.ctx.common.issues));return Xl(t,{code:Ko.invalid_union,unionErrors:o}),Th}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let a;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(l=>new ab(l));return Xl(t,{code:Ko.invalid_union,unionErrors:s}),Th}}get options(){return this._def.options}};P8.create=(r,e)=>new P8({options:r,typeName:fh.ZodUnion,...u0(e)});const SS=r=>r instanceof L8?SS(r.schema):r instanceof ob?SS(r.innerType()):r instanceof O8?[r.value]:r instanceof z8?r.options:r instanceof U8?wv.objectValues(r.enum):r instanceof I8?SS(r._def.innerType):r instanceof A8?[void 0]:r instanceof N8?[null]:r instanceof Ib?[void 0,...SS(r.unwrap())]:r instanceof m4?[null,...SS(r.unwrap())]:r instanceof QI||r instanceof F8?SS(r.unwrap()):r instanceof k8?SS(r._def.innerType):[];let Xoe=class uIe extends k0{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.object)return Xl(t,{code:Ko.invalid_type,expected:Cc.object,received:t.parsedType}),Th;const n=this.discriminator,i=t.data[n],a=this.optionsMap.get(i);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Xl(t,{code:Ko.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Th)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const a of t){const o=SS(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new uIe({typeName:fh.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...u0(n)})}};function ZI(r,e){const t=xS(r),n=xS(e);if(r===e)return{valid:!0,data:r};if(t===Cc.object&&n===Cc.object){const i=wv.objectKeys(e),a=wv.objectKeys(r).filter(s=>i.indexOf(s)!==-1),o={...r,...e};for(const s of a){const l=ZI(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===Cc.array&&n===Cc.array){if(r.length!==e.length)return{valid:!1};const i=[];for(let a=0;a<r.length;a++){const o=r[a],s=e[a],l=ZI(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Cc.date&&n===Cc.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let D8=class extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(XI(a)||XI(o))return Th;const s=ZI(a.value,o.value);return s.valid?((WI(a)||WI(o))&&t.dirty(),{status:t.value,value:s.data}):(Xl(n,{code:Ko.invalid_intersection_types}),Th)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};D8.create=(r,e,t)=>new D8({left:r,right:e,typeName:fh.ZodIntersection,...u0(t)});let p4=class fIe extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.array)return Xl(n,{code:Ko.invalid_type,expected:Cc.array,received:n.parsedType}),Th;if(n.data.length<this._def.items.length)return Xl(n,{code:Ko.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Th;!this._def.rest&&n.data.length>this._def.items.length&&(Xl(n,{code:Ko.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ub(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>V5.mergeArray(t,o)):V5.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new fIe({...this._def,rest:e})}};p4.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new p4({items:r,typeName:fh.ZodTuple,rest:null,...u0(e)})};let Woe=class bae extends k0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.object)return Xl(n,{code:Ko.invalid_type,expected:Cc.object,received:n.parsedType}),Th;const i=[],a=this._def.keyType,o=this._def.valueType;for(const s in n.data)i.push({key:a._parse(new Ub(n,s,n.path,s)),value:o._parse(new Ub(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?V5.mergeObjectAsync(t,i):V5.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof k0?new bae({keyType:e,valueType:t,typeName:fh.ZodRecord,...u0(n)}):new bae({keyType:aT.create(),valueType:e,typeName:fh.ZodRecord,...u0(t)})}},$R=class extends k0{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.map)return Xl(n,{code:Ko.invalid_type,expected:Cc.map,received:n.parsedType}),Th;const i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:i._parse(new Ub(n,s,n.path,[c,"key"])),value:a._parse(new Ub(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Th;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Th;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};$R.create=(r,e,t)=>new $R({valueType:e,keyType:r,typeName:fh.ZodMap,...u0(t)});let ZR=class Sae extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Cc.set)return Xl(n,{code:Ko.invalid_type,expected:Cc.set,received:n.parsedType}),Th;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Xl(n,{code:Ko.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Xl(n,{code:Ko.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const a=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Th;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>a._parse(new Ub(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Sae({...this._def,minSize:{value:e,message:Qu.toString(t)}})}max(e,t){return new Sae({...this._def,maxSize:{value:e,message:Qu.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ZR.create=(r,e)=>new ZR({valueType:r,minSize:null,maxSize:null,typeName:fh.ZodSet,...u0(e)});let $oe=class EI extends k0{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.function)return Xl(t,{code:Ko.invalid_type,expected:Cc.function,received:t.parsedType}),Th;function n(s,l){return qR({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,GR(),rT].filter(c=>!!c),issueData:{code:Ko.invalid_arguments,argumentsError:l}})}function i(s,l){return qR({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,GR(),rT].filter(c=>!!c),issueData:{code:Ko.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof lT){const s=this;return S5(async function(...l){const c=new ab([]),u=await s._def.args.parseAsync(l,a).catch(_=>{throw c.addIssue(n(l,_)),c}),f=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(f,a).catch(_=>{throw c.addIssue(i(f,_)),c})})}else{const s=this;return S5(function(...l){const c=s._def.args.safeParse(l,a);if(!c.success)throw new ab([n(l,c.error)]);const u=Reflect.apply(o,this,c.data),f=s._def.returns.safeParse(u,a);if(!f.success)throw new ab([i(u,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new EI({...this._def,args:p4.create(e).rest(mE.create())})}returns(e){return new EI({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new EI({args:e||p4.create([]).rest(mE.create()),returns:t||mE.create(),typeName:fh.ZodFunction,...u0(n)})}},L8=class extends k0{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};L8.create=(r,e)=>new L8({getter:r,typeName:fh.ZodLazy,...u0(e)});let O8=class extends k0{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Xl(t,{received:t.data,code:Ko.invalid_literal,expected:this._def.value}),Th}return{status:"valid",value:e.data}}get value(){return this._def.value}};O8.create=(r,e)=>new O8({value:r,typeName:fh.ZodLiteral,...u0(e)});function Zoe(r,e){return new z8({values:r,typeName:fh.ZodEnum,...u0(e)})}let z8=class Eae extends k0{constructor(){super(...arguments),E8.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return Xl(t,{expected:wv.joinValues(n),received:t.parsedType,code:Ko.invalid_type}),Th}if(YR(this,E8)||joe(this,E8,new Set(this._def.values)),!YR(this,E8).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Xl(t,{received:t.data,code:Ko.invalid_enum_value,options:n}),Th}return S5(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Eae.create(e,{...this._def,...t})}exclude(e,t=this._def){return Eae.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};E8=new WeakMap,z8.create=Zoe;let U8=class extends k0{constructor(){super(...arguments),w8.set(this,void 0)}_parse(e){const t=wv.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Cc.string&&n.parsedType!==Cc.number){const i=wv.objectValues(t);return Xl(n,{expected:wv.joinValues(i),received:n.parsedType,code:Ko.invalid_type}),Th}if(YR(this,w8)||joe(this,w8,new Set(wv.getValidEnumValues(this._def.values))),!YR(this,w8).has(e.data)){const i=wv.objectValues(t);return Xl(n,{received:n.data,code:Ko.invalid_enum_value,options:i}),Th}return S5(e.data)}get enum(){return this._def.values}};w8=new WeakMap,U8.create=(r,e)=>new U8({values:r,typeName:fh.ZodNativeEnum,...u0(e)});let lT=class extends k0{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Cc.promise&&t.common.async===!1)return Xl(t,{code:Ko.invalid_type,expected:Cc.promise,received:t.parsedType}),Th;const n=t.parsedType===Cc.promise?t.data:Promise.resolve(t.data);return S5(n.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}};lT.create=(r,e)=>new lT({type:r,typeName:fh.ZodPromise,...u0(e)});let ob=class extends k0{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===fh.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{Xl(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){const o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return Th;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Th:l.status==="dirty"||t.value==="dirty"?iT(l.value):l});{if(t.value==="aborted")return Th;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Th:s.status==="dirty"||t.value==="dirty"?iT(s.value):s}}if(i.type==="refinement"){const o=s=>{const l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Th:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Th:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pE(o))return o;const s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>pE(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:t.value,value:s})):o);wv.assertNever(i)}};ob.create=(r,e,t)=>new ob({schema:r,typeName:fh.ZodEffects,effect:e,...u0(t)}),ob.createWithPreprocess=(r,e,t)=>new ob({schema:e,effect:{type:"preprocess",transform:r},typeName:fh.ZodEffects,...u0(t)});let Ib=class extends k0{_parse(e){return this._getType(e)===Cc.undefined?S5(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ib.create=(r,e)=>new Ib({innerType:r,typeName:fh.ZodOptional,...u0(e)});let m4=class extends k0{_parse(e){return this._getType(e)===Cc.null?S5(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};m4.create=(r,e)=>new m4({innerType:r,typeName:fh.ZodNullable,...u0(e)});let I8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Cc.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};I8.create=(r,e)=>new I8({innerType:r,typeName:fh.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...u0(e)});let k8=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return S8(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ab(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ab(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};k8.create=(r,e)=>new k8({innerType:r,typeName:fh.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...u0(e)});let QR=class extends k0{_parse(e){if(this._getType(e)!==Cc.nan){const n=this._getOrReturnCtx(e);return Xl(n,{code:Ko.invalid_type,expected:Cc.nan,received:n.parsedType}),Th}return{status:"valid",value:e.data}}};QR.create=r=>new QR({typeName:fh.ZodNaN,...u0(r)});const oBe=Symbol("zod_brand");let QI=class extends k0{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},KI=class dIe extends k0{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Th:a.status==="dirty"?(t.dirty(),iT(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Th:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,t){return new dIe({in:e,out:t,typeName:fh.ZodPipeline})}},F8=class extends k0{_parse(e){const t=this._def.innerType._parse(e),n=i=>(pE(i)&&(i.value=Object.freeze(i.value)),i);return S8(t)?t.then(i=>n(i)):n(t)}unwrap(){return this._def.innerType}};F8.create=(r,e)=>new F8({innerType:r,typeName:fh.ZodReadonly,...u0(e)});function Qoe(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function Koe(r,e={},t){return r?oT.create().superRefine((n,i)=>{var a,o;const s=r(n);if(s instanceof Promise)return s.then(l=>{var c,u;if(!l){const f=Qoe(e,n),m=(u=(c=f.fatal)!==null&&c!==void 0?c:t)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...f,fatal:m})}});if(!s){const l=Qoe(e,n),c=(o=(a=l.fatal)!==null&&a!==void 0?a:t)!==null&&o!==void 0?o:!0;i.addIssue({code:"custom",...l,fatal:c})}}):oT.create()}const sBe={object:U3.lazycreate};var fh;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(fh||(fh={}));const lBe=(r,e={message:`Input not instance of ${r.name}`})=>Koe(t=>t instanceof r,e),Joe=aT.create,ese=T8.create,cBe=QR.create,uBe=M8.create,tse=C8.create,fBe=R8.create,dBe=XR.create,hBe=A8.create,pBe=N8.create,mBe=oT.create,vBe=mE.create,yBe=bS.create,gBe=WR.create,_Be=vE.create,xBe=U3.create,bBe=U3.strictCreate,SBe=P8.create,EBe=Xoe.create,wBe=D8.create,TBe=p4.create,MBe=Woe.create,CBe=$R.create,RBe=ZR.create,ABe=$oe.create,NBe=L8.create,PBe=O8.create,DBe=z8.create,LBe=U8.create,OBe=lT.create,nse=ob.create,zBe=Ib.create,UBe=m4.create,IBe=ob.createWithPreprocess,kBe=KI.create;var le=Object.freeze({__proto__:null,defaultErrorMap:rT,setErrorMap:IFe,getErrorMap:GR,makeIssue:qR,EMPTY_PATH:kFe,addIssueToContext:Xl,ParseStatus:V5,INVALID:Th,DIRTY:iT,OK:S5,isAborted:XI,isDirty:WI,isValid:pE,isAsync:S8,get util(){return wv},get objectUtil(){return YI},ZodParsedType:Cc,getParsedType:xS,ZodType:k0,datetimeRegex:Yoe,ZodString:aT,ZodNumber:T8,ZodBigInt:M8,ZodBoolean:C8,ZodDate:R8,ZodSymbol:XR,ZodUndefined:A8,ZodNull:N8,ZodAny:oT,ZodUnknown:mE,ZodNever:bS,ZodVoid:WR,ZodArray:vE,ZodObject:U3,ZodUnion:P8,ZodDiscriminatedUnion:Xoe,ZodIntersection:D8,ZodTuple:p4,ZodRecord:Woe,ZodMap:$R,ZodSet:ZR,ZodFunction:$oe,ZodLazy:L8,ZodLiteral:O8,ZodEnum:z8,ZodNativeEnum:U8,ZodPromise:lT,ZodEffects:ob,ZodTransformer:ob,ZodOptional:Ib,ZodNullable:m4,ZodDefault:I8,ZodCatch:k8,ZodNaN:QR,BRAND:oBe,ZodBranded:QI,ZodPipeline:KI,ZodReadonly:F8,custom:Koe,Schema:k0,ZodSchema:k0,late:sBe,get ZodFirstPartyTypeKind(){return fh},coerce:{string:r=>aT.create({...r,coerce:!0}),number:r=>T8.create({...r,coerce:!0}),boolean:r=>C8.create({...r,coerce:!0}),bigint:r=>M8.create({...r,coerce:!0}),date:r=>R8.create({...r,coerce:!0})},any:mBe,array:_Be,bigint:uBe,boolean:tse,date:fBe,discriminatedUnion:EBe,effect:nse,enum:DBe,function:ABe,instanceof:lBe,intersection:wBe,lazy:NBe,literal:PBe,map:CBe,nan:cBe,nativeEnum:LBe,never:yBe,null:pBe,nullable:UBe,number:ese,object:xBe,oboolean:()=>tse().optional(),onumber:()=>ese().optional(),optional:zBe,ostring:()=>Joe().optional(),pipeline:kBe,preprocess:IBe,promise:OBe,record:MBe,set:RBe,strictObject:bBe,string:Joe,symbol:dBe,transformer:nse,tuple:TBe,undefined:hBe,union:SBe,unknown:vBe,void:gBe,NEVER:Th,ZodIssueCode:Ko,quotelessJson:UFe,ZodError:ab}),rse={in:25.4,inch:25.4,mil:.0254,mm:1,m:1e3,cm:10,ft:304.8,feet:304.8},B8=r=>{let e=typeof r=="number"?"mm":r.replace(/^[^a-zA-Z]+/g,"").toLowerCase();e||(e="mm");const t=typeof r=="number"?r:Number.parseFloat(r.split(e)[0]);if(e in rse)return t*rse[e];throw new Error(`Unsupported unit: ${e}`)},H8=B8;const FBe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let JI=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=FBe[t[r]&63];return e};var ise={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:{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}}},ek=new Set;for(const[r,e]of Object.entries(ise)){ek.add(r);for(const t of Object.keys(e.variants))ek.add(t)}function BBe(r){for(const[e,t]of Object.entries(ise))if(r in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[r]};return{baseUnit:r,conversionFactor:1}}var ase={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},sb=r=>{var s;if(typeof r>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof r=="string"&&r.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(r),parsedUnit:null,unitOfValue:null};if(typeof r=="number")return{value:r,parsedUnit:null,unitOfValue:null};if(typeof r=="object"&&"x"in r&&"y"in r){const{parsedUnit:l,unitOfValue:c}=sb(r.x);return{parsedUnit:l,unitOfValue:c,value:{x:sb(r.x).value,y:sb(r.y).value}}}const t=(s=r.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${r}"`);const n=t.split("").reverse().join(""),i=r.slice(0,-n.length);if(n in ase&&!ek.has(n)){const l=ase[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=BBe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(i)}},KR=le.string().or(le.number()).transform(r=>sb(r).value),tk=le.string().or(le.number()).transform(r=>sb(r).value).transform(r=>Number.parseFloat(r.toPrecision(12))),ose=le.string().or(le.number()).transform(r=>sb(r).value),JR=le.string().or(le.number()).transform(r=>sb(r).value),jn=le.string().or(le.number()).transform(r=>sb(r).value),sse=le.string().or(le.number()).transform(r=>sb(r).value),Wl=jn,HBe=le.string().or(le.number()).transform(r=>sb(r).value),jBe=le.string().or(le.number()).transform(r=>sb(r).value),nk=le.string().or(le.number()).transform(r=>typeof r=="number"?r:r.endsWith("deg")?Number.parseFloat(r.split("deg")[0]):r.endsWith("rad")?Number.parseFloat(r.split("rad")[0])*180/Math.PI:Number.parseFloat(r)),lse=le.number().or(le.string().endsWith("mAh")).transform(r=>{if(typeof r=="string"){const e=r.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return r}).describe("Battery capacity in mAh"),rg=le.object({x:Wl,y:Wl}),VBe=rg,j8=le.object({x:Wl,y:Wl,z:Wl}),GBe=j8,rk=le.object({width:le.number(),height:le.number()}),Tv=r=>le.string().optional().default(()=>`${r}_${JI(10)}`),cse=le.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),a2=le.object({type:le.literal("source_component"),ftype:le.string().optional(),source_component_id:le.string(),name:le.string(),manufacturer_part_number:le.string().optional(),supplier_part_numbers:le.record(cse,le.array(le.string())).optional(),display_value:le.string().optional()}),ik=a2.extend({ftype:le.literal("simple_capacitor"),capacitance:tk,max_voltage_rating:JR.optional(),display_capacitance:le.string().optional(),max_decoupling_trace_length:Wl.optional()}),ak=a2.extend({ftype:le.literal("simple_resistor"),resistance:KR,display_resistance:le.string().optional()}),eA=a2.extend({ftype:le.literal("simple_diode")}),use=a2.extend({ftype:le.literal("simple_ground")}),ok=a2.extend({ftype:le.literal("simple_bug")}).describe("@deprecated"),sk=a2.extend({ftype:le.literal("simple_chip")}),lk=eA.extend({ftype:le.literal("led")}),ck=a2.extend({ftype:le.literal("simple_power_source"),voltage:JR}),uk=a2.extend({ftype:le.literal("simple_battery"),capacity:lse}),fk=a2.extend({ftype:le.literal("simple_inductor"),inductance:ose}),dk=a2.extend({ftype:le.literal("simple_push_button")}),hk=a2.extend({ftype:le.literal("simple_potentiometer"),max_resistance:KR}),fse=a2.extend({ftype:le.literal("simple_crystal"),frequency:le.number().describe("Frequency in Hz"),load_capacitance:le.number().optional().describe("Load capacitance in pF")}),pk=a2.extend({ftype:le.literal("simple_pin_header"),pin_count:le.number(),gender:le.enum(["male","female"]).optional().default("male")}),mk=a2.extend({ftype:le.literal("simple_resonator"),load_capacitance:tk,equivalent_series_resistance:KR.optional(),frequency:sse}),vk=a2.extend({ftype:le.literal("simple_transistor"),transistor_type:le.enum(["npn","pnp"])}),yk=a2.extend({ftype:le.literal("simple_mosfet"),channel_type:le.enum(["n","p"]),mosfet_mode:le.enum(["enhancement","depletion"])}),gk=a2.extend({ftype:le.literal("simple_switch")}),dse=le.union([ak,ik,eA,use,sk,ok,lk,ck,uk,fk,dk,hk,fse,pk,mk,gk,vk,yk]),hse=le.object({type:le.literal("source_port"),pin_number:le.number().optional(),port_hints:le.array(le.string()).optional(),name:le.string(),source_port_id:le.string(),source_component_id:le.string(),subcircuit_id:le.string().optional()}),pse=le.object({type:le.literal("source_trace"),source_trace_id:le.string(),connected_source_port_ids:le.array(le.string()),connected_source_net_ids:le.array(le.string()),subcircuit_id:le.string().optional(),subcircuit_connectivity_map_key:le.string().optional(),max_length:le.number().optional(),display_name:le.string().optional()}),mse=le.object({type:le.literal("source_group"),source_group_id:le.string(),subcircuit_id:le.string().optional(),parent_subcircuit_id:le.string().optional(),is_subcircuit:le.boolean().optional(),name:le.string().optional()}),vse=le.object({type:le.literal("source_net"),source_net_id:le.string(),name:le.string(),member_source_group_ids:le.array(le.string()),is_power:le.boolean().optional(),is_ground:le.boolean().optional(),is_digital_signal:le.boolean().optional(),is_analog_signal:le.boolean().optional(),trace_width:le.number().optional(),subcircuit_id:le.string().optional()}),yse=le.object({type:le.literal("schematic_box"),schematic_component_id:le.string(),width:Wl,height:Wl,x:Wl,y:Wl}).describe("Draws a box on the schematic"),gse=le.object({type:le.literal("schematic_path"),schematic_component_id:le.string(),fill_color:le.enum(["red","blue"]).optional(),is_filled:le.boolean().optional(),points:le.array(rg)}),_se=le.record(le.object({left_margin:jn.optional(),right_margin:jn.optional(),top_margin:jn.optional(),bottom_margin:jn.optional()})),xse=le.object({left_size:le.number(),right_size:le.number(),top_size:le.number().optional(),bottom_size:le.number().optional()}),bse=le.object({left_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional()}),Sse=le.union([xse,bse]),Ese=le.object({type:le.literal("schematic_component"),size:rk,center:rg,source_component_id:le.string(),schematic_component_id:le.string(),pin_spacing:jn.optional(),pin_styles:_se.optional(),box_width:jn.optional(),symbol_name:le.string().optional(),port_arrangement:Sse.optional(),port_labels:le.record(le.string()).optional(),symbol_display_value:le.string().optional()}),wse=le.object({type:le.literal("schematic_line"),schematic_component_id:le.string(),x1:Wl,x2:Wl,y1:Wl,y2:Wl}),Tse=le.object({type:le.literal("schematic_trace"),schematic_trace_id:le.string(),source_trace_id:le.string(),junctions:le.array(le.object({x:le.number(),y:le.number()})),edges:le.array(le.object({from:le.object({x:le.number(),y:le.number()}),to:le.object({x:le.number(),y:le.number()}),is_crossing:le.boolean().optional(),from_schematic_port_id:le.string().optional(),to_schematic_port_id:le.string().optional()}))}),Mse=le.object({type:le.literal("schematic_text"),schematic_component_id:le.string(),schematic_text_id:le.string(),text:le.string(),position:le.object({x:Wl,y:Wl}),rotation:le.number().default(0),anchor:le.enum(["center","left","right","top","bottom"]).default("center"),color:le.string().default("#000000")}),Cse=le.object({type:le.literal("schematic_port"),schematic_port_id:le.string(),source_port_id:le.string(),schematic_component_id:le.string().optional(),center:rg,facing_direction:le.enum(["up","down","left","right"]).optional(),distance_from_component_edge:le.number().optional(),side_of_component:le.enum(["top","bottom","left","right"]).optional(),true_ccw_index:le.number().optional(),pin_number:le.number().optional(),display_pin_label:le.string().optional()}).describe("Defines a port on a schematic component"),Rse=le.object({type:le.literal("schematic_net_label"),source_net_id:le.string(),center:rg,anchor_position:rg.optional(),anchor_side:le.enum(["top","bottom","left","right"]),text:le.string(),symbol_name:le.string().optional()}),Ase=le.object({type:le.literal("schematic_error"),schematic_error_id:le.string(),error_type:le.literal("schematic_port_not_found"),message:le.string()}).describe("Defines a schematic error on the schematic"),tA=le.object({type:le.literal("schematic_debug_object"),label:le.string().optional()}),Nse=tA.extend({shape:le.literal("rect"),center:rg,size:rk}),Pse=tA.extend({shape:le.literal("line"),start:rg,end:rg}),Dse=tA.extend({shape:le.literal("point"),center:rg}),Lse=le.discriminatedUnion("shape",[Nse,Pse,Dse]),Ose=le.object({type:le.literal("schematic_voltage_probe"),schematic_voltage_probe_id:le.string(),position:rg,schematic_trace_id:le.string(),voltage:JR.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),zse=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],_k=le.enum(zse),u_=_k.or(le.object({name:_k})).transform(r=>typeof r=="string"?r:r.name),cT=le.enum(["top","bottom"]),Use=le.object({x:Wl,y:Wl,via:le.boolean().optional(),via_to_layer:u_.optional()}),qBe=le.array(Use),Ise=le.object({x:Wl,y:Wl,via:le.boolean().optional(),to_layer:u_.optional(),trace_width:Wl.optional()}),kse=le.object({type:le.literal("pcb_component"),pcb_component_id:Tv("pcb_component"),source_component_id:le.string(),center:rg,layer:u_,rotation:nk,width:jn,height:jn,subcircuit_id:le.string().optional()}).describe("Defines a component on the PCB"),Fse=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Tv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.enum(["circle","square"]),hole_diameter:le.number(),x:Wl,y:Wl}),YBe=Fse.describe("Defines a circular or square hole on the PCB"),Bse=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Tv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("oval"),hole_width:le.number(),hole_height:le.number(),x:Wl,y:Wl}),XBe=Bse.describe("Defines an oval hole on the PCB"),Hse=Fse.or(Bse),WBe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_diameter:le.number(),hole_diameter:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),$Be=le.object({type:le.literal("pcb_plated_hole"),shape:le.enum(["oval","pill"]),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_width:le.number(),outer_height:le.number(),hole_width:le.number(),hole_height:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),ZBe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circular_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("circle"),pad_shape:le.literal("rect"),hole_diameter:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:Wl,y:Wl,layers:le.array(u_),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Tv("pcb_plated_hole")}),jse=le.union([WBe,$Be,ZBe]),Vse=le.object({type:le.literal("pcb_port"),pcb_port_id:Tv("pcb_port"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_port_id:le.string(),pcb_component_id:le.string(),x:Wl,y:Wl,layers:le.array(u_)}).describe("Defines a port on the PCB"),QBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("circle"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,radius:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),KBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rect"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),JBe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rotated_rect"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),ccw_rotation:nk,layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),Gse=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("pill"),pcb_smtpad_id:Tv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),radius:le.number(),layer:u_,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),qse=le.union([QBe,KBe,JBe,Gse]).describe("Defines an SMT pad on the PCB"),eHe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("circle"),pcb_solder_paste_id:Tv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,radius:le.number(),layer:u_,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),tHe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("rect"),pcb_solder_paste_id:Tv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,width:le.number(),height:le.number(),layer:u_,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),Yse=le.union([eHe,tHe]).describe("Defines solderpaste on the PCB"),Xse=le.object({type:le.literal("pcb_text"),pcb_text_id:Tv("pcb_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),text:le.string(),center:rg,layer:u_,width:jn,height:jn,lines:le.number(),align:le.enum(["bottom-left"])}).describe("Defines text on the PCB"),Wse=le.object({route_type:le.literal("wire"),x:Wl,y:Wl,width:Wl,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:u_}),$se=le.object({route_type:le.literal("via"),x:Wl,y:Wl,from_layer:le.string(),to_layer:le.string()}),nHe=le.union([Wse,$se]),Zse=le.object({type:le.literal("pcb_trace"),source_trace_id:le.string().optional(),pcb_component_id:le.string().optional(),pcb_trace_id:Tv("pcb_trace"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),route_thickness_mode:le.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:le.number().optional(),should_round_corners:le.boolean().optional(),trace_length:le.number().optional(),route:le.array(le.union([le.object({route_type:le.literal("wire"),x:Wl,y:Wl,width:Wl,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:u_}),le.object({route_type:le.literal("via"),x:Wl,y:Wl,from_layer:le.string(),to_layer:le.string()})]))}).describe("Defines a trace on the PCB"),Qse=le.object({type:le.literal("pcb_trace_error"),pcb_trace_error_id:Tv("pcb_trace_error"),error_type:le.literal("pcb_trace_error"),message:le.string(),center:rg.optional(),pcb_trace_id:le.string(),source_trace_id:le.string(),pcb_component_ids:le.array(le.string()),pcb_port_ids:le.array(le.string())}).describe("Defines a trace error on the PCB"),Kse=le.object({type:le.literal("pcb_port_not_matched_error"),pcb_error_id:Tv("pcb_error"),message:le.string(),pcb_component_ids:le.array(le.string())}).describe("Defines a trace error on the PCB where a port is not matched"),Jse=le.object({type:le.literal("pcb_via"),pcb_via_id:Tv("pcb_via"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:Wl,y:Wl,outer_diameter:Wl.default("0.6mm"),hole_diameter:Wl.default("0.25mm"),from_layer:u_.optional(),to_layer:u_.optional(),layers:le.array(u_),pcb_trace_id:le.string().optional()}).describe("Defines a via on the PCB"),ele=le.object({type:le.literal("pcb_board"),pcb_board_id:Tv("pcb_board"),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:jn,height:jn,center:rg,thickness:jn.optional().default(1.4),num_layers:le.number().optional().default(4),outline:le.array(rg).optional()}).describe("Defines the board outline of the PCB"),tle=le.object({type:le.literal("pcb_placement_error"),pcb_placement_error_id:Tv("pcb_placement_error"),message:le.string()}).describe("Defines a placement error on the PCB"),nle=le.object({type:le.literal("pcb_trace_hint"),pcb_trace_hint_id:Tv("pcb_trace_hint"),pcb_port_id:le.string(),pcb_component_id:le.string(),route:le.array(Ise)}).describe("A hint that can be used during generation of a PCB trace"),rle=le.object({type:le.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:Tv("pcb_silkscreen_line"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),stroke_width:Wl.default("0.1mm"),x1:Wl,y1:Wl,x2:Wl,y2:Wl,layer:cT}).describe("Defines a silkscreen line on the PCB"),ile=le.object({type:le.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:Tv("pcb_silkscreen_path"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),layer:cT,route:le.array(rg),stroke_width:jn}).describe("Defines a silkscreen path on the PCB"),ale=le.object({type:le.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:Tv("pcb_silkscreen_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:Wl.default("0.2mm"),pcb_component_id:le.string(),text:le.string(),ccw_rotation:le.number().optional(),layer:u_,is_mirrored:le.boolean().default(!1).optional(),anchor_position:rg.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),ole=le.object({type:le.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Tv("pcb_silkscreen_rect"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,width:jn,height:jn,layer:u_,stroke_width:jn.default("1mm")}).describe("Defines a silkscreen rect on the PCB"),sle=le.object({type:le.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Tv("pcb_silkscreen_circle"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius:jn,layer:cT,stroke_width:jn.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),lle=le.object({type:le.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Tv("pcb_silkscreen_oval"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius_x:Wl,radius_y:Wl,layer:cT}).describe("Defines a silkscreen oval on the PCB"),cle=le.object({type:le.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Tv("pcb_fabrication_note_text"),subcircuit_id:le.string().optional(),pcb_group_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:Wl.default("1mm"),pcb_component_id:le.string(),text:le.string(),layer:cT,anchor_position:rg.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:le.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),ule=le.object({type:le.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Tv("pcb_fabrication_note_path"),pcb_component_id:le.string(),subcircuit_id:le.string().optional(),layer:u_,route:le.array(rg),stroke_width:jn,color:le.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),fle=le.object({type:le.literal("pcb_keepout"),shape:le.literal("rect"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,width:Wl,height:Wl,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()}).or(le.object({type:le.literal("pcb_keepout"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:rg,radius:Wl,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()})),dle=le.object({type:le.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Tv("pcb_missing_footprint_error"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),error_type:le.literal("pcb_missing_footprint_error"),source_component_id:le.string(),message:le.string()}).describe("Defines a missing footprint error on the PCB"),hle=le.object({type:le.literal("pcb_manual_edit_conflict_error"),pcb_error_id:Tv("pcb_manual_edit_conflict_error"),message:le.string(),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_component_id:le.string()}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),ple=le.object({type:le.literal("pcb_group"),pcb_group_id:Tv("pcb_group"),source_group_id:le.string(),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:jn,height:jn,center:rg,pcb_component_ids:le.array(le.string()),name:le.string().optional(),description:le.string().optional()}).describe("Defines a group of components on the PCB"),mle=le.object({type:le.literal("pcb_autorouting_error"),pcb_error_id:Tv("pcb_autorouting_error"),message:le.string()}).describe("The autorouting has failed to route a portion of the board"),vle=le.object({type:le.literal("cad_component"),cad_component_id:le.string(),pcb_component_id:le.string(),source_component_id:le.string(),position:j8,rotation:j8.optional(),size:j8.optional(),layer:u_.optional(),footprinter_string:le.string().optional(),model_obj_url:le.string().optional(),model_stl_url:le.string().optional(),model_3mf_url:le.string().optional(),model_jscad:le.any().optional()}).describe("Defines a component on the PCB"),yle=le.union([pse,hse,dse,lk,vse,mse,ok,sk,ik,eA,ak,ck,uk,fk,pk,mk,gk,vk,yk,hk,dk,kse,Hse,dle,hle,jse,fle,Vse,Xse,Zse,Jse,qse,Yse,ele,ple,nle,rle,ile,ale,ole,sle,lle,Qse,tle,Kse,ule,cle,mle,yse,Mse,wse,Ese,Cse,Tse,gse,Ase,Rse,Lse,Ose,vle]),xk=yle;const gle=Object.freeze(Object.defineProperty({__proto__:null,all_layers:zse,any_circuit_element:yle,any_soup_element:xk,any_source_component:dse,battery_capacity:lse,cad_component:vle,capacitance:tk,current:HBe,distance:Wl,frequency:sse,getZodPrefixedIdWithDefault:Tv,inductance:ose,layer_ref:u_,layer_string:_k,length:jn,pcb_autorouting_error:mle,pcb_board:ele,pcb_component:kse,pcb_fabrication_note_path:ule,pcb_fabrication_note_text:cle,pcb_group:ple,pcb_hole:Hse,pcb_hole_circle_or_square_shape:YBe,pcb_hole_oval_shape:XBe,pcb_keepout:fle,pcb_manual_edit_conflict_error:hle,pcb_missing_footprint_error:dle,pcb_placement_error:tle,pcb_plated_hole:jse,pcb_port:Vse,pcb_port_not_matched_error:Kse,pcb_route_hint:Use,pcb_route_hints:qBe,pcb_silkscreen_circle:sle,pcb_silkscreen_line:rle,pcb_silkscreen_oval:lle,pcb_silkscreen_path:ile,pcb_silkscreen_rect:ole,pcb_silkscreen_text:ale,pcb_smtpad:qse,pcb_smtpad_pill:Gse,pcb_solder_paste:Yse,pcb_text:Xse,pcb_trace:Zse,pcb_trace_error:Qse,pcb_trace_hint:nle,pcb_trace_route_point:nHe,pcb_trace_route_point_via:$se,pcb_trace_route_point_wire:Wse,pcb_via:Jse,point:rg,point3:j8,port_arrangement:Sse,position:VBe,position3:GBe,resistance:KR,rotation:nk,route_hint_point:Ise,schematic_box:yse,schematic_component:Ese,schematic_component_port_arrangement_by_sides:bse,schematic_component_port_arrangement_by_size:xse,schematic_debug_line:Pse,schematic_debug_object:Lse,schematic_debug_object_base:tA,schematic_debug_point:Dse,schematic_debug_rect:Nse,schematic_error:Ase,schematic_line:wse,schematic_net_label:Rse,schematic_path:gse,schematic_pin_styles:_se,schematic_port:Cse,schematic_text:Mse,schematic_trace:Tse,schematic_voltage_probe:Ose,size:rk,source_component_base:a2,source_group:mse,source_led:lk,source_net:vse,source_port:hse,source_simple_battery:uk,source_simple_bug:ok,source_simple_capacitor:ik,source_simple_chip:sk,source_simple_crystal:fse,source_simple_diode:eA,source_simple_ground:use,source_simple_inductor:fk,source_simple_mosfet:yk,source_simple_pin_header:pk,source_simple_potentiometer:hk,source_simple_power_source:ck,source_simple_push_button:dk,source_simple_resistor:ak,source_simple_resonator:mk,source_simple_switch:gk,source_simple_transistor:vk,source_trace:pse,supplier_name:cse,time:jBe,visible_layer:cT,voltage:JR},Symbol.toStringTag,{value:"Module"}));var rHe=Object.defineProperty,iHe=(r,e)=>{for(var t in e)rHe(r,t,{get:e[t],enumerable:!0})},ES={};iHe(ES,{axial:()=>lje,bga:()=>bHe,breakoutheaders:()=>xje,cap:()=>vHe,dfn:()=>GHe,diode:()=>mHe,dip:()=>lHe,hc49:()=>Sje,led:()=>yHe,lqfp:()=>mje,melf:()=>SVe,micromelf:()=>MVe,minimelf:()=>pVe,mlp:()=>AHe,ms012:()=>ZHe,ms013:()=>KHe,pad:()=>Eje,pinrow:()=>YHe,pushbutton:()=>uje,qfn:()=>CHe,qfp:()=>RHe,quad:()=>V8,res:()=>gHe,sma:()=>NVe,smb:()=>kVe,smc:()=>qVe,smf:()=>OVe,sod123:()=>ije,sod123f:()=>eVe,sod123w:()=>Oje,sod128:()=>lVe,sod323:()=>kje,sod323f:()=>Zje,sod523:()=>Rje,sod723:()=>iVe,sod882:()=>Yje,sod882d:()=>gVe,sod923:()=>jje,soic:()=>EHe,sop8:()=>Dje,sot23:()=>FHe,sot235:()=>yje,sot236:()=>zHe,sot363:()=>IHe,sot563:()=>WHe,sot723:()=>eje,ssop:()=>PHe,stampboard:()=>dje,stampreceiver:()=>pje,to220:()=>dVe,to92:()=>Mje,tssop:()=>LHe,vssop8:()=>jVe});var K0=(r,e,t)=>({type:"pcb_silkscreen_text",pcb_silkscreen_text_id:"silkscreen_text_1",font:"tscircuit2024",font_size:t,pcb_component_id:"pcb_component_1",text:"{REF}",layer:"top",anchor_position:{x:r,y:e},anchor_alignment:"center"}),ev=(r,e,t,n,i)=>({pcb_plated_hole_id:"",type:"pcb_plated_hole",shape:"circle",x:e,y:t,hole_diameter:B8(n),outer_diameter:B8(i),pcb_port_id:"",layers:["top","bottom"],port_hints:[r.toString()]}),_le=Array.from({length:9},(r,e)=>Math.cos(e/8*Math.PI-Math.PI)).map(r=>({x:r,y:-Math.sqrt(1-r**2)}));function v4(r){return typeof r=="string"?r.trim().toLowerCase().endsWith("mil")?Number.parseFloat(r)*.0254:Number.parseFloat(r):Number(r)}var nA=le.union([le.string(),le.number()]).transform(r=>v4(r)),aHe=r=>le.object({fn:le.string(),num_pins:le.number().optional().default(6),wide:le.boolean().optional(),narrow:le.boolean().optional(),w:nA.optional(),p:nA.default(r.p??"2.54mm"),id:nA.optional(),od:nA.optional()}).transform(e=>(!e.id&&!e.od?Math.abs(e.p-1.27)<.01?(e.id=v4("0.55mm"),e.od=v4("0.95mm")):(e.id=v4("1.0mm"),e.od=v4("1.5mm")):e.id?e.od||(e.od=e.id*(1.5/1)):e.id=e.od*(1/1.5),e.w||(e.wide?e.w=v4("600mil"):e.narrow?e.w=v4("300mil"):e.w=v4(r.w??"300mil")),e)),oHe=aHe({}),sHe=(r,e,t,n)=>{const i=r/2,a=e<=i,o=i-1,s=n,l=s*o;return a?{x:-t/2-.4,y:l/2-(e-1)*s}:{x:t/2+.4,y:-l/2+(e-i-1)*s}},lHe=r=>{const e=oHe.parse(r),t=[];for(let l=0;l<e.num_pins;l++){const{x:c,y:u}=sHe(e.num_pins,l+1,e.w,e.p??2.54);t.push(ev(l+1,c,u,e.id??"0.8mm",e.od??"1mm"))}const n=e.w-e.od-.4,i=(e.num_pins/2-1)*e.p+e.od+.4,a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-n/2,y:-i/2},{x:-n/2,y:i/2},..._le.map(({x:l,y:c})=>({x:l*n/6,y:c*n/6+i/2})),{x:n/2,y:i/2},{x:n/2,y:-i/2},{x:-n/2,y:-i/2}],type:"pcb_silkscreen_path",stroke_width:.1},o=[];for(let l=0;l<e.num_pins;l++){const c=l<e.num_pins/2,u=c?-e.w/2-e.p/2-.2:e.p/2+e.w/2+.2,f=c?(-i+1.6)/2+l*e.p:(-i+1.6)/2+(l-e.num_pins/2)*e.p,m={type:"pcb_fabrication_note_text",layer:"top",pcb_component_id:`pin_${l+1}`,pcb_silkscreen_text_id:`pin_${l+1}`,text:`{pin${l+1}}`,anchor_position:{x:u,y:f},font_size:.3,font_color:"red",font:"tscircuit2024",anchor_alignment:"top-left"};o.push(m)}const s=K0(0,i/2+.5,.4);return{circuitJson:[...t,a,s,...o],parameters:e}},F0=(r,e,t,n,i)=>({type:"pcb_smtpad",x:e,y:t,width:n,height:i,layer:"top",shape:"rect",pcb_smtpad_id:"",port_hints:Array.isArray(r)?r.map(a=>a.toString()):[r.toString()]}),rA=(r,e={})=>({type:"pcb_silkscreen_path",layer:e.layer||"top",pcb_component_id:e.pcb_component_id||"",pcb_silkscreen_path_id:e.pcb_silkscreen_path_id||"",route:r,stroke_width:e.stroke_width||.1}),xle=[{imperial:"01005",metric:"0402",Z_mm_min:.58,G_mm_min:.18,X_mm_min:.21,C_mm_ref:.038},{imperial:"0201",metric:"0603",Z_mm_min:.9,G_mm_min:.3,X_mm_min:.3,C_mm_ref:.6},{imperial:"0402",metric:"1005",Z_mm_min:1.6,G_mm_min:.4,X_mm_min:.7,C_mm_ref:1},{imperial:"0603",metric:"1608",Z_mm_min:2.6,G_mm_min:.6,X_mm_min:1,C_mm_ref:1.7},{imperial:"0805",metric:"2012",Z_mm_min:3,G_mm_min:.6,X_mm_min:1.2,C_mm_ref:1.9},{imperial:"1206",metric:"3216",Z_mm_min:4.2,G_mm_min:1.2,X_mm_min:1.4,C_mm_ref:2.8},{imperial:"1210",metric:"3225",Z_mm_min:3.2,G_mm_min:1,X_mm_min:2.5,C_mm_ref:2},{imperial:"2010",metric:"5025",Z_mm_min:5,G_mm_min:1.2,X_mm_min:2.5,C_mm_ref:3.6},{imperial:"2512",metric:"6332",Z_mm_min:6.3,G_mm_min:1.2,X_mm_min:3.2,C_mm_ref:4.5}],cHe=xle.reduce((r,e)=>(r[e.metric]=e,r),{}),uHe=xle.reduce((r,e)=>(r[e.imperial]=e,r),{});le.object({tht:le.boolean(),p:jn,pw:jn.optional(),ph:jn.optional(),metric:Wl.optional(),imperial:Wl.optional(),w:jn.optional(),h:jn.optional()});var fHe=r=>.079*r**2+.94*r-.009,dHe=r=>1.09*r+.6,hHe=r=>.59*r-.31,pHe=r=>-.01*r**2+.94*r+.03,iA=r=>{let{tht:e,p:t,pw:n,ph:i,metric:a,imperial:o,w:s,h:l}=r;if(typeof s=="string"&&(s=H8(s)),typeof l=="string"&&(l=H8(l)),typeof t=="string"&&(t=H8(t)),typeof n=="string"&&(n=H8(n)),typeof i=="string"&&(i=H8(i)),l>s)throw new Error("height cannot be greater than width (rotated footprint not yet implemented)");let c;if(a&&(c=cHe[a]),o&&(c=uHe[o]),!c&&s&&l&&!n&&!i&&(c={imperial:"custom",metric:"custom",Z_mm_min:dHe(s),G_mm_min:hHe(s),X_mm_min:fHe(l),C_mm_ref:pHe(s)}),c&&(s=c.Z_mm_min,l=c.X_mm_min,t=c.C_mm_ref,n=(c.Z_mm_min-c.G_mm_min)/2,i=(c.Z_mm_min-c.G_mm_min)/2),n===void 0)throw new Error("could not infer pad width");if(i===void 0)throw new Error("could not infer pad width");const u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:t/2,y:i/2+.4},{x:-t/2-n/2-.2,y:i/2+.4},{x:-t/2-n/2-.2,y:-i/2-.4},{x:t/2,y:-i/2-.4}],stroke_width:.1,pcb_silkscreen_path_id:""},f=K0(0,i/2+.9,.2);return e?[ev(1,-t/2,0,n,n*1/.8),ev(2,t/2,0,n,n*1/.8),u,f]:[F0(["1","left"],-t/2,0,n,i),F0(["2","right"],t/2,0,n,i),u,f]},mHe=r=>({circuitJson:iA(r),parameters:r}),vHe=r=>({circuitJson:iA(r),parameters:r}),yHe=r=>({circuitJson:iA(r),parameters:r}),gHe=r=>({circuitJson:iA(r),parameters:r}),ble="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Sle=le.string().transform(r=>{const[e,t]=r.split(/[x ]/);return{x:parseFloat(e),y:parseFloat(t)}}).pipe(le.object({x:le.number(),y:le.number()})),_He=le.string().or(le.array(le.any())).transform(r=>Array.isArray(r)?r:(r.startsWith("(")&&r.endsWith(")")&&(r=r.slice(1,-1)),r.split(",").map(e=>{const t=Number(e);return isNaN(t)?e:t}))).pipe(le.array(le.string().or(le.number()))),xHe=le.object({fn:le.string(),num_pins:le.number().optional().default(64),grid:Sle.optional(),p:Wl.default("0.8mm"),w:jn.optional(),h:jn.optional(),ball:jn.optional().describe("ball diameter"),pad:jn.optional().describe("pad width/height"),tlorigin:le.boolean().optional(),blorigin:le.boolean().optional(),trorigin:le.boolean().optional(),brorigin:le.boolean().optional(),missing:_He.default([])}).transform(r=>{let e="tl";if(r.blorigin&&(e="bl"),r.trorigin&&(e="tr"),r.brorigin&&(e="br"),!r.grid){const n=Math.ceil(Math.sqrt(r.num_pins));r.grid={x:n,y:n}}return r.missing&&(r.missing=r.missing.map(n=>{if(typeof n=="number")return n;if(n==="center")return"center";if(n==="topleft")return"topleft";const i=n.match(/([A-Z]+)(\d+)/);if(!i)return n;const a=ble.indexOf(i[1]),o=Number.parseInt(i[2])-1;return a*r.grid.x+o+1})),{...r,origin:e}}),bHe=r=>{const e=xHe.parse(r);let{num_pins:t,grid:n,p:i,w:a,h:o,ball:s,pad:l,missing:c}=e;s??(s=.75/1.27*i),l??(l=s*.8);const u=[],f=(c??[]).filter(w=>typeof w=="number"),m=n.x*n.y-t;if(c.length===0&&m>0&&(Math.sqrt(m)%1===0?c.push("center"):m===1&&c.push("topleft")),c!=null&&c.includes("center")){const w=Math.floor(Math.sqrt(m)),T=Math.floor((n.x-w)/2),D=Math.floor((n.y-w)/2);for(let O=D;O<D+w;O++)for(let B=T;B<T+w;B++)f.push(O*n.x+B+1)}c!=null&&c.includes("topleft")&&f.push(1);const _=new Set(f);let x=0;for(let w=0;w<n.y;w++)for(let T=0;T<n.x;T++){let D=w*n.x+T+1;if(_.has(D)){x++;continue}D-=x;const O=(T-(n.x-1)/2)*i,B=-(w-(n.y-1)/2)*i;u.push(F0([D,`${ble[w]}${T+1}`],O,B,l,l))}const M=K0(0,n.y*i/2,.2);return{circuitJson:[...u,M],parameters:e}},kb=r=>le.object({fn:le.string(),num_pins:le.number().optional().default(8),w:jn.default(jn.parse(r.w??"5.3mm")),p:jn.default(jn.parse(r.p??"1.27mm")),pw:jn.optional(),pl:jn.optional(),legsoutside:le.boolean().optional().default(r.legsoutside??!1)}).transform(e=>(!e.pw&&!e.pl?(e.pw=jn.parse("0.6mm"),e.pl=jn.parse("1.0mm")):e.pw?e.pl||(e.pl=e.pw*(1/.6)):e.pw=e.pl*(.6/1),e)),SHe=kb({}),bk=r=>{r.widthincludeslegs!==void 0&&(r.legsoutside=!r.widthincludeslegs);const{num_pins:e,pn:t,w:n,p:i,pl:a,legsoutside:o}=r,s=e/2,l=t<=s,c=s-1,u=i,f=u*c,m=o?a/2:-a/2;return l?{x:-n/2-m,y:f/2-(t-1)*u}:{x:n/2+m,y:-f/2+(t-s-1)*u}},EHe=r=>{const e=SHe.parse(r);return{circuitJson:y4(e),parameters:e}},y4=r=>{const e=[];for(let s=0;s<r.num_pins;s++){const{x:l,y:c}=bk({num_pins:r.num_pins,pn:s+1,w:r.w,p:r.p??1.27,pl:r.pl,legsoutside:r.legsoutside});e.push(F0(s+1,l,c,r.pl??"1mm",r.pw??"0.6mm"))}const t=Math.min(1,r.p/2),n=r.w-(r.legsoutside?0:r.pl*2)-.2,i=(r.num_pins/2-1)*r.p+r.pw+t,a=K0(0,i/2+.4,i/12),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",stroke_width:.1,route:[{x:-n/2,y:-i/2},{x:-n/2,y:i/2},..._le.map(({x:s,y:l})=>({x:s*n/6,y:l*n/6+i/2})),{x:n/2,y:i/2},{x:n/2,y:-i/2},{x:-n/2,y:-i/2}]};return[...e,o,a]},Ele=le.enum(["leftside","topside","rightside","bottomside","toppin","bottompin","leftpin","rightpin"]),wHe=({num_pins:r,cw:e,ccw:t,startingpin:n})=>{const i=[],a=r/4;let o=1;const s={};for(const l of n??[])s[l]=!0;!s.leftside&&!s.topside&&!s.rightside&&!s.bottomside&&(s.leftside=!0),!s.bottompin&&!s.leftpin&&!s.rightpin&&!s.toppin&&(s.leftside?s.toppin=!0:s.topside?s.rightpin=!0:s.rightside?s.bottompin=!0:s.bottomside&&(s.leftpin=!0)),s.leftside&&s.toppin?o=1:s.leftside&&s.bottompin?o=a:s.bottomside&&s.leftpin?o=a+1:s.bottomside&&s.rightpin?o=a*2:s.rightside&&s.bottompin?o=a*2+1:s.rightside&&s.toppin?o=a*3:s.topside&&s.rightpin?o=a*3+1:s.topside&&s.leftpin&&(o=a*4),i.push(-1);for(let l=0;l<r;l++)i[o]=l+1,t||!e?(o++,o>r&&(o=1)):(o--,o<1&&(o=r));return i},Sk=le.object({fn:le.string(),cc:le.boolean().default(!0).optional(),ccw:le.boolean().default(!0).optional(),startingpin:le.string().or(le.array(Ele)).transform(r=>typeof r=="string"?r.slice(1,-1).split(","):r).pipe(le.array(Ele)).optional(),num_pins:le.number().optional().default(64),w:jn.optional(),h:jn.optional(),p:jn.default(jn.parse("0.5mm")),pw:jn.optional(),pl:jn.optional(),thermalpad:le.union([le.literal(!0),Sle]).optional(),legsoutside:le.boolean().default(!1)}),Ek=r=>{r.w&&!r.h?r.h=r.w:!r.w&&r.h&&(r.w=r.h);const e=r.num_pins/4;if(!r.p&&!r.pw&&!r.pl&&r.w){const t=e+4;r.p=r.w/t}return!r.p&&r.w&&r.h&&r.pw&&r.pl&&(r.p=(r.w-r.pl*2)/(e-1)),!r.w&&!r.h&&r.p&&(r.w=r.p*(e+4),r.h=r.w),r.p&&!r.pw&&!r.pl?(r.pw=r.p/2,r.pl=r.p/2):r.pw?r.pl||(r.pl=r.pw*(1/.6)):r.pw=r.pl*(.6/1),r},wle=Sk.transform(Ek),THe=["left","bottom","right","top"],MHe=r=>{const{pin_count:e,pn:t,w:n,h:i,p:a,pl:o,legsoutside:s}=r,l=e/4,c=THe[Math.floor((t-1)/l)],u=(t-1)%l,f=a*(l-1),m=a*(l-1),_=s?o/2:-o/2;switch(c){case"left":return{x:-n/2-_,y:m/2-u*a,o:"vert"};case"bottom":return{x:-f/2+u*a,y:-i/2-_,o:"horz"};case"right":return{x:n/2+_,y:-m/2+u*a,o:"vert"};case"top":return{x:f/2-u*a,y:i/2+_,o:"horz"};default:throw new Error("Invalid pin number")}},V8=r=>{const e=wle.parse(r),t=[],n=wHe(e),i=e.num_pins/4;for(let s=0;s<e.num_pins;s++){const{x:l,y:c,o:u}=MHe({pin_count:e.num_pins,pn:s+1,w:e.w,h:e.h,p:e.p??.5,pl:e.pl,legsoutside:e.legsoutside});let f=e.pw,m=e.pl;u==="vert"&&([f,m]=[m,f]);const _=n[s+1];t.push(F0(_,l,c,f,m))}if(e.thermalpad)if(typeof e.thermalpad=="boolean"){const s=e.p*(i-1)+e.pw,l=e.p*(i-1)+e.pw;t.push(F0(["thermalpad"],0,0,s,l))}else t.push(F0(["thermalpad"],0,0,e.thermalpad.x,e.thermalpad.y));const a=[];for(const[s,l,c]of[["top-left",-1,1],["bottom-left",-1,-1],["bottom-right",1,-1],["top-right",1,1]]){const u=e.w/2*l,f=e.h/2*c;let m="none",_=u,x=f;const M=e.pw*2;n[1]===1&&s==="top-left"?m="in1":n[i*4]===1&&s==="top-left"||n[i*3+1]===1&&s==="top-right"?m="in2":n[i*3]===1&&s==="top-right"||n[i]===1&&s==="bottom-left"?m="in1":n[i+1]===1&&s==="bottom-left"?m="in2":n[i*2]===1&&s==="bottom-right"?m="in1":n[i*2+1]===1&&s==="bottom-right"&&(m="in2");const w=m==="in1"?1:-1;if(e.legsoutside){const T=m==="in1"?e.pl/2:e.pw/2,D=m==="in1"?e.pw/2:e.pl/2;_+=T*l*w,x-=D*c*w}(m==="none"||e.legsoutside)&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}`,route:[{x:u-M*l,y:f},{x:u,y:f},{x:u,y:f-M*c}],type:"pcb_silkscreen_path",stroke_width:.1}),(m==="in1"||m==="in2")&&!e.legsoutside&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_1`,route:[{x:u-M*l,y:f},{x:u-M*l/2,y:f}],type:"pcb_silkscreen_path",stroke_width:0},{layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_2`,route:[{x:u,y:f-M*c/2},{x:u,y:f-M*c}],type:"pcb_silkscreen_path",stroke_width:.1}),(m==="in1"||m==="in2")&&a.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:`pcb_silkscreen_path_${s}_3`,route:[{x:_-.2*-l,y:x+.2*w},{x:_,y:x},{x:_+.2*w*-l,y:x+.2},{x:_-.2*-l,y:x+.2*w}],type:"pcb_silkscreen_path",stroke_width:.1})}const o=K0(0,e.h/2+(e.legsoutside?e.pl*1.2:.5),.3);return{circuitJson:[...t,...a,o],parameters:e}};Sk.extend({}).transform(Ek);var CHe=r=>(r.legsoutside=!1,V8(r)),RHe=r=>{r.legsoutside=!0;const e=wle.parse(r);if(!r.p)switch(r.num_pins){case 44:case 64:r.p=.8;break;case 52:r.w===14?r.p=1:r.p=.65;break;case 208:r.p=.5;break}if(!r.pl)switch(r.num_pins){case 44:case 52:case 64:r.pl=2.25;break;case 208:r.pl=1.65;break;default:r.pl=e.pl*4;break}if(!r.pw)switch(r.num_pins){case 44:case 64:r.pw=.5;break;case 52:r.w===14?r.pw=.45:r.pw=.55;break;case 208:r.pw=.3;break;default:r.pw=e.pw;break}return V8(r)};Sk.extend({}).transform(Ek);var AHe=r=>(r.legsoutside=!1,r.thermalpad===void 0&&(r.thermalpad=!0),V8(r)),NHe=kb({w:"3.9mm",p:"1.27mm"}),PHe=r=>{const e=NHe.parse(r);return{circuitJson:y4(e),parameters:e}},DHe=kb({w:"6.1mm",p:"0.65mm",legsoutside:!0}),LHe=r=>{const e=DHe.parse(r);return{circuitJson:y4(e),parameters:e}},OHe=kb({p:"0.95mm",w:"1.6mm",legsoutside:!0}),zHe=r=>{const e=OHe.parse({...r,num_pins:6});return{circuitJson:y4(e),parameters:e}},UHe=kb({}),IHe=r=>{const e=UHe.parse({fn:"sot363",num_pins:6,w:1.94,p:.65,pw:.3,pl:.7,legoutside:!0});return{circuitJson:y4(e),parameters:e}},kHe=le.object({fn:le.string(),num_pins:le.literal(3).default(3),w:le.string().default("1.92mm"),h:le.string().default("2.74mm"),pl:le.string().default("0.8mm"),pw:le.string().default("0.764mm")}),FHe=r=>{const e=kHe.parse(r);return{circuitJson:HHe(e),parameters:e}},BHe=r=>{const{pn:e}=r;return e===1?{x:-1.7,y:0}:e===2?{x:1.7,y:-.95}:{x:1.7,y:.95}},HHe=r=>{const e=[];for(let n=0;n<r.num_pins;n++){const{x:i,y:a}=BHe({num_pins:r.num_pins,pn:n+1,w:Number.parseFloat(r.w),h:Number.parseFloat(r.h),pl:Number.parseFloat(r.pl)});e.push(F0(n+1,i,a,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}const t=K0(0,parseInt(r.h),.3);return[...e,t]},jHe=[{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}],VHe=kb({}),GHe=r=>{const e=VHe.parse(r),t=[];for(let f=0;f<e.num_pins;f++){const{x:m,y:_}=bk({num_pins:e.num_pins,pn:f+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(F0(f+1,m,_,e.pl??"1mm",e.pw??"0.6mm"))}const n=Math.min(1,e.p/2),i=e.w+n,a=(e.num_pins/2-1)*e.p+e.pw+n,o=[];for(const f of jHe){const{dx:m,dy:_}=f;o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",route:[{x:m*i/2-m*e.p,y:_*a/2},{x:m*i/2,y:_*a/2},{x:m*i/2,y:_*a/2-_*e.p}],type:"pcb_silkscreen_path",stroke_width:.1})}const s=e.p/4,l=-i/2-s/2,c=a/2-e.p/2;o.push({layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:l,y:c},{x:l-s,y:c+s},{x:l-s,y:c-s},{x:l,y:c}],stroke_width:.1});const u=K0(0,a/2+.4,a/12);return{circuitJson:[...t,u,...o],parameters:e}},qHe=le.object({fn:le.string(),num_pins:le.number().optional().default(6),p:jn.default("0.1in").describe("pitch"),id:jn.default("1.0mm").describe("inner diameter"),od:jn.default("1.5mm").describe("outer diameter"),male:le.boolean().optional().describe("for male pin headers"),female:le.boolean().optional().describe("for female pin headers")}).transform(r=>({...r,male:r.male??!r.female,female:r.female??!1})).superRefine((r,e)=>{r.male&&r.female&&e.addIssue({code:le.ZodIssueCode.custom,message:"'male' and 'female' cannot both be true it should be male or female.",path:["male","female"]})}),YHe=r=>{const e=qHe.parse(r),{p:t,id:n,od:i}=e,a=[],s=-((e.num_pins-1)/2)*t;for(let c=0;c<e.num_pins;c++)a.push(ev(c+1,s+c*t,0,n,i));const l=K0(0,t/2,.5);return{circuitJson:[...a,l],parameters:e}},XHe=kb({}),WHe=r=>{const e=XHe.parse({fn:"sot563",num_pins:6,w:1.94,p:.5,pw:.3,pl:.67,legoutside:!0});return{circuitJson:y4(e),parameters:e}},$He=kb({p:"1.27mm",w:"3.9mm",legsoutside:!0}),ZHe=r=>{const e=$He.parse({...r,num_pins:8});return{circuitJson:y4(e),parameters:e}},QHe=kb({p:"1.27mm",w:"7.5mm",legsoutside:!0}),KHe=r=>{const e=QHe.parse({...r,num_pins:16});return{circuitJson:y4(e),parameters:e}},JHe=le.object({fn:le.string(),num_pins:le.literal(3).default(3),w:le.string().default("1.2mm"),h:le.string().default("1.2mm"),pl:le.string().default("0.3mm"),pw:le.string().default("0.32mm")}),eje=r=>{const e=JHe.parse(r),t=nje(e),n=K0(.4,jn.parse(e.h),.2);return{circuitJson:[...t,n],parameters:e}},tje=r=>{const{pn:e}=r;return e===1?{x:0,y:0}:e===2?{x:1,y:-.4}:{x:1,y:.4}},nje=r=>{const e=[];for(let t=0;t<3;t++){const{x:n,y:i}=tje({num_pins:r.num_pins,pn:t+1,w:Number.parseFloat(r.w),h:Number.parseFloat(r.h),pl:Number.parseFloat(r.pl)});e.push(F0(t+1,n,i,Number.parseFloat(r.pl),t!==0?Number.parseFloat(r.pw):.42))}return e},rje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("2.36mm"),h:le.string().default("1.22mm"),pl:le.string().default("0.9mm"),pw:le.string().default("0.9mm"),p:le.string().default("4.19mm")}),ije=r=>{const e=rje.parse(r),t=K0(0,jn.parse(e.h)/4+.4,.3);return{circuitJson:oje(e).concat(t),parameters:e}},aje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},oje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=aje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},sje=le.object({fn:le.string(),p:jn.optional().default("2.54mm"),id:jn.optional().default("0.7mm"),od:jn.optional().default("1mm")}),lje=r=>{const e=sje.parse(r),{p:t,id:n,od:i}=e,a=[ev(1,-t/2,0,n,i),ev(2,t/2,0,n,i)],o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-t/2+i+n/2,y:0},{x:t/2-i-n/2,y:0}],stroke_width:.1,pcb_silkscreen_path_id:""},s=K0(0,t/4,.5);return{circuitJson:[...a,o,s],parameters:e}},cje=le.object({fn:le.literal("pushbutton"),w:jn.default(4.5),h:jn.default(6.5),id:jn.default(1),od:jn.default(1.2)}),uje=r=>{const e=cje.parse(r),t=e.w,n=e.h,i=e.id,a=[ev(1,-t/2,n/2,i,i*1.5),ev(2,-t/2,-n/2,i,i*1.5),ev(3,t/2,-n/2,i,i*1.5),ev(4,t/2,n/2,i,i*1.5)],o=[rA([{x:-t/2,y:-n/2},{x:-t/2,y:n/2}]),rA([{x:t/2,y:-n/2},{x:t/2,y:n/2}]),rA([{x:-t/2,y:0},{x:-t/5,y:0},{x:t/5*1/Math.sqrt(2),y:n/8}]),rA([{x:t/2,y:0},{x:t/5,y:0}])],s=K0(0,n/2+.4,.5);return{circuitJson:[...a,...o,s],parameters:e}},Tle=le.object({fn:le.string(),w:jn.default("22.58mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(2),bottom:jn.optional().default(2),p:jn.default(jn.parse("2.54mm")),pw:jn.default(jn.parse("1.6mm")),pl:jn.default(jn.parse("2.4mm")),innerhole:le.boolean().default(!1),innerholeedgedistance:jn.default(jn.parse("1.61mm"))}),fje=r=>{const e=Tle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},aA=(r,e,t)=>{let n=[];return t==="right"&&(n=[{x:r+1/2,y:e},{x:r-1/2,y:e+.6/2},{x:r-1/2,y:e-.6/2},{x:r+1/2,y:e}]),t==="left"&&(n=[{x:r-1/2,y:e},{x:r+1/2,y:e+.6/2},{x:r+1/2,y:e-.6/2},{x:r-1/2,y:e}]),t==="top"&&(n=[{x:r,y:e+1/2},{x:r-.6/2,y:e-1/2},{x:r+.6/2,y:e-1/2},{x:r,y:e+1/2}]),t==="bottom"&&(n=[{x:r,y:e-1/2},{x:r-.6/2,y:e+1/2},{x:r+.6/2,y:e+1/2},{x:r,y:e-1/2}]),n},dje=r=>{const e=Tle.parse(r),t=e.h??fje(e),n=[],i=[];let a=[];const o=1,s=1.2,l=e.left+e.right+(e.bottom??0)+(e.top??0);if(e.right){const m=-((e.right-1)/2)*e.p;for(let _=0;_<e.right;_++)_===0&&!e.left&&!e.bottom&&(a=aA(e.w/2-e.pl*1.4,m+_*e.p,"right")),n.push(F0(_+1+e.left+(e.bottom??0),e.w/2-e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&(i.push(ev(_+1+e.left+(e.bottom??0)+l,e.w/2,m+_*e.p,o,s)),i.push(ev(_+1+e.left+(e.bottom??0)+l*2,e.w/2-e.innerholeedgedistance,m+_*e.p,o,s)))}if(e.left){const m=-((e.left-1)/2)*e.p;for(let _=0;_<e.left;_++)_===e.left-1&&(a=aA(-e.w/2+e.pl*1.4,m+_*e.p,"left")),n.push(F0(_+1,-e.w/2+e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&(i.push(ev(_+1+l,-e.w/2,m+_*e.p,o,s)),i.push(ev(_+1+l*2,-e.w/2+e.innerholeedgedistance,m+_*e.p,o,s)))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let _=0;_<e.top;_++)_===e.top-1&&!e.left&&!e.bottom&&!e.right&&(a=aA(m+_*e.p,t/2-e.pl*1.4,"top")),n.push(F0(_+1+e.left+e.right+(e.bottom??0),m+_*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&(i.push(ev(_+1+e.left+e.right+(e.bottom??0)+l,m+_*e.p,t/2,o,s)),i.push(ev(_+1+e.left+e.right+(e.bottom??0)+l*2,m+_*e.p,t/2-e.innerholeedgedistance,o,s)))}if(e.bottom){const m=-((e.bottom-1)/2)*e.p;for(let _=0;_<e.bottom;_++)_===0&&!e.left&&(a=aA(m+_*e.p,-t/2+e.pl*1.4,"bottom")),n.push(F0(_+1+e.left,m+_*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&(i.push(ev(_+1+e.left+l,m+_*e.p,-t/2,o,s)),i.push(ev(_+1+e.left+l*2,m+_*e.p,-t/2+e.innerholeedgedistance,o,s)))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_triangle_1",pcb_component_id:"2",route:a,stroke_width:.1,layer:"top"},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2,y:t/2},{x:e.w/2,y:t/2},{x:e.w/2,y:-t/2},{x:-e.w/2,y:-t/2},{x:-e.w/2,y:t/2}],stroke_width:.1,layer:"top"},f=K0(0,t/1.8,t/25);return{circuitJson:[...n,...i,u,c,f],parameters:e}},Mle=le.object({fn:le.string(),w:jn.default("22.58mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(2),bottom:jn.optional().default(2),p:jn.default(jn.parse("2.54mm")),pw:jn.default(jn.parse("1.6mm")),pl:jn.default(jn.parse("3.2mm")),innerhole:le.boolean().default(!1),innerholeedgedistance:jn.default(jn.parse("1.61mm"))}),hje=r=>{const e=Mle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},oA=(r,e,t,n=1,i=.6)=>{const a=n/2,o=i/2;return{left:[{x:r+a,y:e},{x:r-a,y:e+o},{x:r-a,y:e-o},{x:r+a,y:e}],right:[{x:r-a,y:e},{x:r+a,y:e+o},{x:r+a,y:e-o},{x:r-a,y:e}],top:[{x:r,y:e-a},{x:r-o,y:e+a},{x:r+o,y:e+a},{x:r,y:e-a}],bottom:[{x:r,y:e+a},{x:r-o,y:e-a},{x:r+o,y:e-a},{x:r,y:e+a}]}[t]},pje=r=>{const e=Mle.parse(r),t=e.h??hje(e),n=[],i=[],a=1,o=1.2,s=e.left+e.right+(e.bottom??0)+(e.top??0);let l=[];if(e.right){const m=-((e.right-1)/2)*e.p;for(let _=0;_<e.right;_++)_===0&&!e.left&&!e.bottom&&(l=oA(e.w/2+e.pl*1.4,m+_*e.p,"right")),n.push(F0(_+1+e.left+(e.bottom??0),e.w/2-e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&i.push(ev(_+1+e.left+(e.bottom??0)+s,e.w/2-e.innerholeedgedistance,m+_*e.p,a,o))}if(e.left){const m=-((e.left-1)/2)*e.p;for(let _=0;_<e.left;_++)_===e.left-1&&(l=oA(-e.w/2-e.pl/3,m+_*e.p,"left")),n.push(F0(_+1,-e.w/2+e.pl/2,m+_*e.p,e.pl,e.pw)),e.innerhole&&i.push(ev(_+1+s,-e.w/2+e.innerholeedgedistance,m+_*e.p,a,o))}if(e.top){const m=-((e.top-1)/2)*e.p;for(let _=0;_<e.top;_++)_===e.top-1&&!e.left&&!e.bottom&&!e.right&&(l=oA(m+_*e.p,t/2+e.pl*1.4,"top")),n.push(F0(_+1+e.right+(e.bottom??0)+e.left,m+_*e.p,t/2-e.pl/2,e.pw,e.pl)),e.innerhole&&i.push(ev(_+1+e.right+(e.bottom??0)+e.left+s,m+_*e.p,t/2-e.innerholeedgedistance,a,o))}if(e.bottom){const m=-((e.bottom-1)/2)*e.p;for(let _=0;_<e.bottom;_++)_===0&&!e.left&&(l=oA(m+_*e.p,-t/2-e.pl*1.4,"bottom")),n.push(F0(_+1+e.left,m+_*e.p,-t/2+e.pl/2,e.pw,e.pl)),e.innerhole&&i.push(ev(_+1+e.left+s,m+_*e.p,-t/2+e.innerholeedgedistance,a,o))}const c={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:l,stroke_width:.1},u={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:t/2+e.pl/3},{x:e.w/2+e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:-t/2-e.pl/3},{x:-e.w/2-e.pl/3,y:t/2+e.pl/3}],stroke_width:.1,layer:"top"},f=K0(0,t/1.8,t/25);return{circuitJson:[...i,...n,u,c,f],parameters:e}},mje=r=>(r.legsoutside=!0,V8(r)),vje=le.object({fn:le.string(),num_pins:le.literal(5).default(5),h:le.string().default("1.6mm"),pl:le.string().default("1mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.95mm")}),yje=r=>{const e=vje.parse(r);return{circuitJson:gje(e),parameters:e}},Cle=r=>{const{p:e,h:t,pn:n}=r;if(n===1)return{x:-t/2-.5,y:e};if(n===2)return{x:-t/2-.5,y:0};if(n===3)return{x:-t/2-.5,y:-e};if(n===4)return{x:t/2+.5,y:-e};if(n===5)return{x:t/2+.5,y:e};throw new Error("Invalid pin number")},gje=r=>{const e=[];for(let f=1;f<=r.num_pins;f++){const{x:m,y:_}=Cle({h:Number.parseFloat(r.h),p:Number.parseFloat(r.p),pn:f});e.push(F0(f,m,_,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}const t=(r.num_pins+1)/2*Number.parseFloat(r.p),n=Number.parseFloat(r.h),i={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_1",route:[{x:-t/3,y:n/2+Number.parseFloat(r.p)/1.3},{x:t/3,y:n/2+Number.parseFloat(r.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"silkscreen_path_2",route:[{x:-t/3,y:-n/2-Number.parseFloat(r.p)/1.3},{x:t/3,y:-n/2-Number.parseFloat(r.p)/1.3}],type:"pcb_silkscreen_path",stroke_width:.05},o=K0(0,n+.3,.3),s=Cle({h:Number.parseFloat(r.h),p:Number.parseFloat(r.p),pn:1});s.x=s.x-Number.parseFloat(r.pw)*1.5;const l=.7,c=.3,u={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"pin1_indicator",route:[{x:s.x+l/2,y:s.y},{x:s.x-l/2,y:s.y+c/2},{x:s.x-l/2,y:s.y-c/2},{x:s.x+l/2,y:s.y}],stroke_width:.05};return[...e,o,i,a,u]},Rle=le.object({fn:le.string(),w:jn.default("10mm"),h:jn.optional(),left:jn.optional().default(20),right:jn.optional().default(20),top:jn.optional().default(0),bottom:jn.optional().default(0),p:jn.default(jn.parse("2.54mm")),id:jn.optional().default(jn.parse("1mm")),od:jn.optional().default(jn.parse("1.5mm"))}),_je=r=>{const e=Rle.parse(r);return e.left&&e.right?Math.max(e.left,e.right)*e.p:e.left?e.left*e.p:e.right?e.right*e.p:51},sA=(r,e,t,n=1,i=.6)=>{const a=n/2,o=i/2;return{left:[{x:r+a,y:e},{x:r-a,y:e+o},{x:r-a,y:e-o},{x:r+a,y:e}],right:[{x:r-a,y:e},{x:r+a,y:e+o},{x:r+a,y:e-o},{x:r-a,y:e}],top:[{x:r,y:e-a},{x:r-o,y:e+a},{x:r+o,y:e+a},{x:r,y:e-a}],bottom:[{x:r,y:e+a},{x:r-o,y:e-a},{x:r+o,y:e-a},{x:r,y:e+a}]}[t]},xje=r=>{const e=Rle.parse(r),t=e.h??_je(e),n=[],i=e.id,a=e.od;let o=[];if(e.right){const u=-((e.right-1)/2)*e.p;for(let f=0;f<e.right;f++)f===0&&!e.left&&!e.bottom&&(o=sA(e.w/2+a*1.4,u+f*e.p,"right")),n.push(ev(f+1+e.left+(e.bottom??0),e.w/2,u+f*e.p,i,a))}if(e.left){const u=-((e.left-1)/2)*e.p;for(let f=0;f<e.left;f++)f===e.left-1&&(o=sA(-e.w/2-a*1.4,u+f*e.p,"left")),n.push(ev(f+1,-e.w/2,u+f*e.p,i,a))}if(e.top){const u=-((e.top-1)/2)*e.p;for(let f=0;f<e.top;f++)f===e.top-1&&!e.left&&!e.bottom&&!e.right&&(o=sA(u+f*e.p,t/2+a*1.4,"top")),n.push(ev(f+1+e.right+(e.bottom??0)+e.left,u+f*e.p,t/2,i,a))}if(e.bottom){const u=-((e.bottom-1)/2)*e.p;for(let f=0;f<e.bottom;f++)f===0&&!e.left&&(o=sA(u+f*e.p,-t/2-a*1.4,"bottom")),n.push(ev(f+1+e.left,u+f*e.p,-t/2,i,a))}const s={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"1",pcb_component_id:"1",layer:"top",route:o,stroke_width:.1},l={type:"pcb_silkscreen_path",pcb_silkscreen_path_id:"pcb_silkscreen_path_1",pcb_component_id:"1",route:[{x:-e.w/2-a,y:t/2+a},{x:e.w/2+a,y:t/2+a},{x:e.w/2+a,y:-t/2-a},{x:-e.w/2-a,y:-t/2-a},{x:-e.w/2-a,y:t/2+a}],stroke_width:.1,layer:"top"},c=K0(0,t/1.7,t/25);return{circuitJson:[...n,l,c,s],parameters:e}},Ale=(r,e,t,n)=>Array.from({length:25},(i,a)=>{const o=a/24*Math.PI-Math.PI/2;return{x:r+(n==="right"?1:-1)*Math.cos(o)*t,y:e+Math.sin(o)*t}}),bje=le.object({fn:le.string(),p:jn.optional().default("4.88mm"),id:jn.optional().default("0.6mm"),od:jn.optional().default("1.2mm"),w:jn.optional().default("5.6mm"),h:jn.optional().default("3.5mm")}),Sje=r=>{const e=bje.parse(r),{p:t,id:n,od:i,w:a,h:o}=e,s=o/2,l=[ev(1,-t/2,0,n,i),ev(2,t/2,0,n,i)],c=Ale(-a/2,0,s,"left"),u=Ale(a/2,0,s,"right"),f={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...c,...c.slice(1).reverse(),{x:-a/2,y:-o/2},{x:a/2,y:-o/2},...u,{x:a/2,y:o/2},{x:-a/2,y:o/2}],stroke_width:.1,pcb_silkscreen_path_id:""},m=K0(0,t/4,.5);return{circuitJson:[...l,f,m],parameters:e}};le.object({w:jn,h:jn});var Eje=r=>{const{w:e,h:t}=r,n=B8(e),i=B8(t);return{circuitJson:[F0(1,0,0,n,i),K0(0,i/2+.5,.2)]}},wje=(r,e,t)=>Array.from({length:25},(n,i)=>{const a=i/24*Math.PI;return{x:r+Math.cos(a)*t,y:e+Math.sin(a)*t}}),Tje=le.object({fn:le.string(),p:jn.optional().default("1.27mm"),id:jn.optional().default("0.72mm"),od:jn.optional().default(".95mm"),w:jn.optional().default("4.5mm"),h:jn.optional().default("4.5mm"),inline:le.boolean().optional().default(!1)}),Mje=r=>{const e=Tje.parse(r),{p:t,id:n,od:i,w:a,h:o,inline:s}=e,l=a/2,c=o/2,u=s?[ev(1,-t,c-t,n,i),ev(2,0,c-t,n,i),ev(3,t,c-t,n,i)]:[ev(1,0,c,n,i),ev(2,-t,c-t,n,i),ev(3,t,c-t,n,i)],f=wje(0,o/2,l),m={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[...f,{x:-l,y:0},{x:l,y:0},f[0]],stroke_width:.1,pcb_silkscreen_path_id:""},_=K0(0,o/2+1,.5);return{circuitJson:[...u,m,_],parameters:e}},Cje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("2.15mm"),h:le.string().default("1.20mm"),pl:le.string().default("0.5mm"),pw:le.string().default("0.6mm"),p:le.string().default("1.4mm")}),Rje=r=>{const e=Cje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Nje(e).concat(n,t),parameters:e}},Aje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Nje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Aje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Pje=kb({}),Dje=r=>{const e=Pje.parse(r),t=[];for(let o=0;o<e.num_pins;o++){const{x:s,y:l}=bk({num_pins:e.num_pins,pn:o+1,w:e.w,p:e.p??1.27,pl:e.pl,widthincludeslegs:!0});t.push(F0(o+1,s,l,e.pl??"1.5mm",e.pw??"0.6mm"))}const n=(e.num_pins/2-1)*e.p+e.pw,i=K0(0,n/2-.5,n/12),a={layer:"top",pcb_component_id:"",pcb_silkscreen_path_id:"",type:"pcb_silkscreen_path",route:[{x:-e.w/3,y:n/2+.2},{x:e.w/3,y:n/2+.2}],stroke_width:.1};return{circuitJson:[...t,i,a],parameters:e}},Lje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.4mm"),h:le.string().default("2.1mm"),pl:le.string().default("1.2mm"),pw:le.string().default("1.2mm"),p:le.string().default("2.9mm")}),Oje=r=>{const e=Lje.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Uje(e).concat(n,t),parameters:e}},zje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Uje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=zje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Ije=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3.30mm"),h:le.string().default("1.80mm"),pl:le.string().default("0.60mm"),pw:le.string().default("0.45mm"),p:le.string().default("2.1mm")}),kje=r=>{const e=Ije.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Bje(e).concat(n,t),parameters:e}},Fje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Bje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Fje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Hje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.4mm"),h:le.string().default("0.9mm"),pl:le.string().default("0.35mm"),pw:le.string().default("0.25mm"),p:le.string().default("1.2mm")}),jje=r=>{const e=Hje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.15,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.4,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.4,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2+.15,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Gje(e).concat(n,t),parameters:e}},Vje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Gje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Vje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},qje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.3mm"),h:le.string().default("0.9mm"),pl:le.string().default("0.4mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.7mm")}),Yje=r=>{const e=qje.parse(r),t=K0(0,jn.parse(e.h)+.1,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.2,y:jn.parse(e.h)/2+.2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2+.2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2-.2},{x:jn.parse(e.p)/2+.2,y:-jn.parse(e.h)/2-.2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Wje(e).concat(n,t),parameters:e}},Xje=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Wje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Xje({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},$je=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3,05mm"),h:le.string().default("1.65mm"),pl:le.string().default("0.6mm"),pw:le.string().default("0.6mm"),pad_spacing:le.string().default("2.2mm")}),Zje=r=>{const e=$je.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.pad_spacing)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.pad_spacing)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:Kje(e).concat(n,t),parameters:e}},Qje=r=>{const{pn:e,pad_spacing:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},Kje=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=Qje({pn:t,pad_spacing:Number.parseFloat(r.pad_spacing)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},Jje=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.4mm"),h:le.string().default("2.1mm"),pl:le.string().default("1.2mm"),pw:le.string().default("1.2mm"),p:le.string().default("2.9mm")}),eVe=r=>{const e=Jje.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:nVe(e).concat(n,t),parameters:e}},tVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},nVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=tVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},rVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.80mm"),h:le.string().default("1.00mm"),pl:le.string().default("0.66mm"),pw:le.string().default("0.5mm"),p:le.string().default("0.8mm")}),iVe=r=>{const e=rVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:oVe(e).concat(n,t),parameters:e}},aVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},oVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=aVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},sVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("6.2mm"),h:le.string().default("3.4mm"),pl:le.string().default("1.4mm"),pw:le.string().default("2.1mm"),p:le.string().default("4.4mm")}),lVe=r=>{const e=sVe.parse(r),t=K0(0,jn.parse(e.h)/2+.4,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:uVe(e).concat(n,t),parameters:e}},cVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},uVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=cVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},fVe=le.object({fn:le.string().default("to220_3").refine(r=>/^to220_\d+$/.test(r),{message:"Invalid format. Expected 'to220_N' where N is the number of pins."}),p:jn.optional().default("5.0mm"),id:jn.optional().default("1.0mm"),od:jn.optional().default("1.9mm"),w:jn.optional().default("13mm"),h:jn.optional().default("7mm")}).transform(r=>{const e=r.fn.match(/^to220_(\d+)$/),t=e?parseInt(e[1],10):3;return{...r,numPins:t,fn:"to220"}}),dVe=r=>{const e=fVe.parse(r),{fn:t,id:n,od:i,w:a,h:o,numPins:s}=e,l=-1,c=a/2,u=o/2,f=a*.6,_=Math.max(1.5,f/(s-1)),x=Array.from({length:s},(B,W)=>{const $=s%2===0?(W-s/2+.5)*_:(W-Math.floor(s/2))*_;return ev(W+1,$,l,n,i)}),M={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:-u},{x:c,y:-u},{x:c,y:u},{x:-c,y:u},{x:-c,y:-u}],stroke_width:.1,pcb_silkscreen_path_id:""},w=-u+2*o/3,T={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-c,y:w},{x:c,y:w}],stroke_width:.1,pcb_silkscreen_path_id:""},D=[{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-a/6,y:w},{x:-a/6,y:u}],stroke_width:.1,pcb_silkscreen_path_id:""},{type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:a/6,y:w},{x:a/6,y:u}],stroke_width:.1,pcb_silkscreen_path_id:""}],O=K0(0,o/2+.6,.5);return{circuitJson:[...x,M,T,...D,O],parameters:{...e,p:_}}},hVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("5.40mm"),h:le.string().default("2.30mm"),pl:le.string().default("1.30mm"),pw:le.string().default("1.70mm"),p:le.string().default("3.5mm")}),pVe=r=>{const e=hVe.parse(r),t=K0(0,jn.parse(e.h)/2+.4,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:vVe(e).concat(n,t),parameters:e}},mVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},vVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=mVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},yVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("1.90mm"),h:le.string().default("1.33mm"),pl:le.string().default("0.5mm"),pw:le.string().default("0.7mm"),p:le.string().default("0.8mm")}),gVe=r=>{const e=yVe.parse(r),t=K0(0,jn.parse(e.h)+.1,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2+.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2+.1,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:xVe(e).concat(n,t),parameters:e}},_Ve=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},xVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=_Ve({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},bVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.0mm"),h:le.string().default("3.35mm"),pl:le.string().default("1.50mm"),pw:le.string().default("2.70mm"),p:le.string().default("4.8mm")}),SVe=r=>{const e=bVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:wVe(e).concat(n,t),parameters:e}},EVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},wVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=EVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},TVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("3.0mm"),h:le.string().default("1.80mm"),pl:le.string().default("0.80mm"),pw:le.string().default("1.20mm"),p:le.string().default("1.6mm")}),MVe=r=>{const e=TVe.parse(r),t=K0(0,jn.parse(e.h),.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:RVe(e).concat(n,t),parameters:e}},CVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},RVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=CVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},AVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.10mm"),h:le.string().default("3.40mm"),pl:le.string().default("2.45mm"),pw:le.string().default("1.80mm"),p:le.string().default("4.05mm")}),NVe=r=>{const e=AVe.parse(r),t=K0(0,jn.parse(e.h)/2+.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.5,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.5,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:DVe(e).concat(n,t),parameters:e}},PVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},DVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=PVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},LVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("4.80mm"),h:le.string().default("2.10mm"),pl:le.string().default("1.30mm"),pw:le.string().default("1.40mm"),p:le.string().default("2.9mm")}),OVe=r=>{const e=LVe.parse(r),t=K0(0,jn.parse(e.h)-.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:UVe(e).concat(n,t),parameters:e}},zVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},UVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=zVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},IVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("7.30mm"),h:le.string().default("4.40mm"),pl:le.string().default("2.50mm"),pw:le.string().default("2.30mm"),p:le.string().default("4.30mm")}),kVe=r=>{const e=IVe.parse(r),t=K0(0,jn.parse(e.h)/2+.5,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:jn.parse(e.h)/2},{x:-jn.parse(e.w)/2-.1,y:-jn.parse(e.h)/2},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:BVe(e).concat(n,t),parameters:e}},FVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},BVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=FVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e},HVe=le.object({fn:le.string(),num_pins:le.literal(8).default(8),w:le.string().default("3.06mm"),h:le.string().default("3.14mm"),p:le.string().default("0.65mm"),pl:le.string().default("1.6mm"),pw:le.string().default("0.5mm")}),jVe=r=>{const e=HVe.parse(r),t=jn.parse(e.p),n=K0(0,jn.parse(e.h)/2+.5,.3),i=jn.parse(e.w),a=jn.parse(e.h),o={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-i/2,y:a/2},{x:i/2,y:a/2}],stroke_width:.05,pcb_silkscreen_path_id:""},s={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:-i/2,y:-a/2},{x:i/2,y:-a/2}],stroke_width:.05,pcb_silkscreen_path_id:""},l=Nle({pn:1,pad_spacing:t}),c={x:l.x-.8,y:l.y},u={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"};return{circuitJson:VVe(e,t).concat(o,s,n,u),parameters:e}},Nle=r=>{const{pn:e,pad_spacing:t}=r,n=e<=4?-1:1,i=1.5-(e-1)%4;return{x:n*jn.parse("1.8mm"),y:i*t}},VVe=(r,e)=>{const t=[];for(let n=1;n<=r.num_pins;n++){const{x:i,y:a}=Nle({pn:n,pad_spacing:e});t.push(F0(n,i,a,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return t},GVe=le.object({fn:le.string(),num_pins:le.literal(2).default(2),w:le.string().default("10.70mm"),h:le.string().default("6.60mm"),pl:le.string().default("3.30mm"),pw:le.string().default("2.50mm"),p:le.string().default("6.80mm")}),qVe=r=>{const e=GVe.parse(r),t=K0(0,3,.3),n={type:"pcb_silkscreen_path",layer:"top",pcb_component_id:"",route:[{x:jn.parse(e.p)/2,y:jn.parse(e.h)/2-.8},{x:-jn.parse(e.w)/2-.8,y:jn.parse(e.h)/2-.8},{x:-jn.parse(e.w)/2-.8,y:-jn.parse(e.h)/2+.8},{x:jn.parse(e.p)/2,y:-jn.parse(e.h)/2+.8}],stroke_width:.1,pcb_silkscreen_path_id:""};return{circuitJson:XVe(e).concat(n,t),parameters:e}},YVe=r=>{const{pn:e,p:t}=r;return e===1?{x:-t/2,y:0}:{x:t/2,y:0}},XVe=r=>{const e=[];for(let t=1;t<=r.num_pins;t++){const{x:n,y:i}=YVe({pn:t,p:Number.parseFloat(r.p)});e.push(F0(t,n,i,Number.parseFloat(r.pl),Number.parseFloat(r.pw)))}return e};function WVe(r){return r!==null}var $Ve=r=>{let e=lA();const n=((r.length===4||r.length===5)&&/^\d+$/.test(r)?`res${r}`:r).split("_").map(i=>{const a=i.match(/([a-z]+)([\(\d\.\+\?].*)?/),[o,s,l]=a??[];return l!=null&&l.includes("?")?null:{fn:a==null?void 0:a[1],v:a==null?void 0:a[2]}}).filter(WVe);for(const{fn:i,v:a}of n)e=e[i](a);return e.setString(r),e},ZVe=()=>Object.keys(ES),lA=()=>{const r=new Proxy({},{get:(e,t)=>{if(t==="soup"||t==="circuitJson"){if("fn"in e&&ES[e.fn])return()=>ES[e.fn](e).circuitJson;if(!ES[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>{throw new Error(`No function found for footprinter, make sure to specify .dip, .lr, .p, etc. Got "${t}"`)}}if(t==="json"){if(!ES[e.fn])throw new Error(`Invalid footprint function, got "${e.fn}"${e.string?`, from string "${e.string}"`:""}`);return()=>ES[e.fn](e).parameters}return t==="getFootprintNames"?()=>Object.keys(ES):t==="params"?()=>e:t==="setString"?n=>(e.string=n,r):n=>(Object.keys(e).length===0?`${t}${n}`in ES?(e[`${t}${n}`]=!0,e.fn=`${t}${n}`):(e[t]=!0,e.fn=t,t==="res"||t==="cap"?n&&(e.imperial=n):e.num_pins=Number.isNaN(Number.parseFloat(n))?void 0:Number.parseFloat(n)):!n&&["w","h","p"].includes(t)||(e[t]=n??!0),r)}});return r};lA.string=$Ve,lA.getFootprintNames=ZVe;var wk=lA,Ple={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:{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}}},Tk=new Set;for(const[r,e]of Object.entries(Ple)){Tk.add(r);for(const t of Object.keys(e.variants))Tk.add(t)}function QVe(r){for(const[e,t]of Object.entries(Ple))if(r in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[r]};return{baseUnit:r,conversionFactor:1}}var Dle={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},lb=r=>{var s;if(typeof r>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof r=="string"&&r.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(r),parsedUnit:null,unitOfValue:null};if(typeof r=="number")return{value:r,parsedUnit:null,unitOfValue:null};if(typeof r=="object"&&"x"in r&&"y"in r){const{parsedUnit:l,unitOfValue:c}=lb(r.x);return{parsedUnit:l,unitOfValue:c,value:{x:lb(r.x).value,y:lb(r.y).value}}}const t=(s=r.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${r}"`);const n=t.split("").reverse().join(""),i=r.slice(0,-n.length);if(n in Dle&&!Tk.has(n)){const l=Dle[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=QVe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(i)}},G8=le.string().or(le.number()).transform(r=>lb(r).value),q8=le.string().or(le.number()).transform(r=>lb(r).value).transform(r=>Number.parseFloat(r.toPrecision(12))),Lle=le.string().or(le.number()).transform(r=>lb(r).value),Y8=le.string().or(le.number()).transform(r=>lb(r).value),qv=le.string().or(le.number()).transform(r=>lb(r).value),Mk=le.string().or(le.number()).transform(r=>lb(r).value),_i=qv;le.string().or(le.number()).transform(r=>lb(r).value),le.string().or(le.number()).transform(r=>lb(r).value);var wS=le.string().or(le.number()).transform(r=>typeof r=="number"?r:r.endsWith("deg")?Number.parseFloat(r.split("deg")[0]):r.endsWith("rad")?Number.parseFloat(r.split("rad")[0])*180/Math.PI:Number.parseFloat(r)),KVe=le.number().or(le.string().endsWith("mAh")).transform(r=>{if(typeof r=="string"){const e=r.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return r}).describe("Battery capacity in mAh"),Iy=le.object({x:_i,y:_i}),cA=le.object({x:_i,y:_i,z:_i}),Ole=le.object({width:le.number(),height:le.number()}),Mv=r=>le.string().optional().default(()=>`${r}_${JI(10)}`),zle=le.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),C2=le.object({type:le.literal("source_component"),ftype:le.string().optional(),source_component_id:le.string(),name:le.string(),manufacturer_part_number:le.string().optional(),supplier_part_numbers:le.record(zle,le.array(le.string())).optional(),display_value:le.string().optional()}),Ule=C2.extend({ftype:le.literal("simple_capacitor"),capacitance:q8,max_voltage_rating:Y8.optional(),display_capacitance:le.string().optional(),max_decoupling_trace_length:_i.optional()}),Ile=C2.extend({ftype:le.literal("simple_resistor"),resistance:G8,display_resistance:le.string().optional()}),Ck=C2.extend({ftype:le.literal("simple_diode")}),JVe=C2.extend({ftype:le.literal("simple_ground")}),kle=C2.extend({ftype:le.literal("simple_bug")}).describe("@deprecated"),Fle=C2.extend({ftype:le.literal("simple_chip")}),Ble=Ck.extend({ftype:le.literal("led")}),Hle=C2.extend({ftype:le.literal("simple_power_source"),voltage:Y8}),jle=C2.extend({ftype:le.literal("simple_battery"),capacity:KVe}),Vle=C2.extend({ftype:le.literal("simple_inductor"),inductance:Lle}),Gle=C2.extend({ftype:le.literal("simple_push_button")}),qle=C2.extend({ftype:le.literal("simple_potentiometer"),max_resistance:G8}),eGe=C2.extend({ftype:le.literal("simple_crystal"),frequency:le.number().describe("Frequency in Hz"),load_capacitance:le.number().optional().describe("Load capacitance in pF")}),Yle=C2.extend({ftype:le.literal("simple_pin_header"),pin_count:le.number(),gender:le.enum(["male","female"]).optional().default("male")}),Xle=C2.extend({ftype:le.literal("simple_resonator"),load_capacitance:q8,equivalent_series_resistance:G8.optional(),frequency:Mk}),Wle=C2.extend({ftype:le.literal("simple_transistor"),transistor_type:le.enum(["npn","pnp"])}),$le=C2.extend({ftype:le.literal("simple_mosfet"),channel_type:le.enum(["n","p"]),mosfet_mode:le.enum(["enhancement","depletion"])}),Zle=C2.extend({ftype:le.literal("simple_switch")}),Qle=le.object({type:le.literal("source_project_metadata"),name:le.string().optional(),software_used_string:le.string().optional(),created_at:le.string().datetime().optional()}),tGe=le.union([Ile,Ule,Ck,JVe,Fle,kle,Ble,Hle,jle,Vle,Gle,qle,eGe,Yle,Xle,Zle,Wle,$le,Qle]),nGe=le.object({type:le.literal("source_port"),pin_number:le.number().optional(),port_hints:le.array(le.string()).optional(),name:le.string(),source_port_id:le.string(),source_component_id:le.string(),subcircuit_id:le.string().optional()}),rGe=le.object({type:le.literal("source_trace"),source_trace_id:le.string(),connected_source_port_ids:le.array(le.string()),connected_source_net_ids:le.array(le.string()),subcircuit_id:le.string().optional(),subcircuit_connectivity_map_key:le.string().optional(),max_length:le.number().optional(),min_trace_thickness:le.number().optional(),display_name:le.string().optional()}),iGe=le.object({type:le.literal("source_group"),source_group_id:le.string(),subcircuit_id:le.string().optional(),parent_subcircuit_id:le.string().optional(),is_subcircuit:le.boolean().optional(),name:le.string().optional()}),aGe=le.object({type:le.literal("source_net"),source_net_id:le.string(),name:le.string(),member_source_group_ids:le.array(le.string()),is_power:le.boolean().optional(),is_ground:le.boolean().optional(),is_digital_signal:le.boolean().optional(),is_analog_signal:le.boolean().optional(),trace_width:le.number().optional(),subcircuit_id:le.string().optional()}),oGe=le.object({type:le.literal("schematic_box"),schematic_component_id:le.string(),width:_i,height:_i,x:_i,y:_i}).describe("Draws a box on the schematic"),sGe=le.object({type:le.literal("schematic_path"),schematic_component_id:le.string(),fill_color:le.enum(["red","blue"]).optional(),is_filled:le.boolean().optional(),points:le.array(Iy)}),lGe=le.record(le.object({left_margin:qv.optional(),right_margin:qv.optional(),top_margin:qv.optional(),bottom_margin:qv.optional()})),cGe=le.object({left_size:le.number(),right_size:le.number(),top_size:le.number().optional(),bottom_size:le.number().optional()}),uGe=le.object({left_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:le.object({pins:le.array(le.number()),direction:le.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:le.object({pins:le.array(le.number()),direction:le.enum(["left-to-right","right-to-left"]).optional()}).optional()}),fGe=le.union([cGe,uGe]),dGe=le.object({type:le.literal("schematic_component"),size:Ole,center:Iy,source_component_id:le.string(),schematic_component_id:le.string(),pin_spacing:qv.optional(),pin_styles:lGe.optional(),box_width:qv.optional(),symbol_name:le.string().optional(),port_arrangement:fGe.optional(),port_labels:le.record(le.string()).optional(),symbol_display_value:le.string().optional()}),hGe=le.object({type:le.literal("schematic_line"),schematic_component_id:le.string(),x1:_i,x2:_i,y1:_i,y2:_i}),pGe=le.object({type:le.literal("schematic_trace"),schematic_trace_id:le.string(),source_trace_id:le.string(),junctions:le.array(le.object({x:le.number(),y:le.number()})),edges:le.array(le.object({from:le.object({x:le.number(),y:le.number()}),to:le.object({x:le.number(),y:le.number()}),is_crossing:le.boolean().optional(),from_schematic_port_id:le.string().optional(),to_schematic_port_id:le.string().optional()}))}),mGe=le.object({type:le.literal("schematic_text"),schematic_component_id:le.string(),schematic_text_id:le.string(),text:le.string(),position:le.object({x:_i,y:_i}),rotation:le.number().default(0),anchor:le.enum(["center","left","right","top","bottom"]).default("center"),color:le.string().default("#000000")}),vGe=le.object({type:le.literal("schematic_port"),schematic_port_id:le.string(),source_port_id:le.string(),schematic_component_id:le.string().optional(),center:Iy,facing_direction:le.enum(["up","down","left","right"]).optional(),distance_from_component_edge:le.number().optional(),side_of_component:le.enum(["top","bottom","left","right"]).optional(),true_ccw_index:le.number().optional(),pin_number:le.number().optional(),display_pin_label:le.string().optional()}).describe("Defines a port on a schematic component"),yGe=le.object({type:le.literal("schematic_net_label"),source_net_id:le.string(),center:Iy,anchor_position:Iy.optional(),anchor_side:le.enum(["top","bottom","left","right"]),text:le.string(),symbol_name:le.string().optional()}),gGe=le.object({type:le.literal("schematic_error"),schematic_error_id:le.string(),error_type:le.literal("schematic_port_not_found"),message:le.string()}).describe("Defines a schematic error on the schematic"),Rk=le.object({type:le.literal("schematic_debug_object"),label:le.string().optional()}),_Ge=Rk.extend({shape:le.literal("rect"),center:Iy,size:Ole}),xGe=Rk.extend({shape:le.literal("line"),start:Iy,end:Iy}),bGe=Rk.extend({shape:le.literal("point"),center:Iy}),SGe=le.discriminatedUnion("shape",[_Ge,xGe,bGe]),EGe=le.object({type:le.literal("schematic_voltage_probe"),schematic_voltage_probe_id:le.string(),position:Iy,schematic_trace_id:le.string(),voltage:Y8.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),wGe=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],Kle=le.enum(wGe),j1=Kle.or(le.object({name:Kle})).transform(r=>typeof r=="string"?r:r.name),X8=le.enum(["top","bottom"]),TGe=le.object({x:_i,y:_i,via:le.boolean().optional(),via_to_layer:j1.optional()});le.array(TGe);var g4=le.object({x:_i,y:_i,via:le.boolean().optional(),to_layer:j1.optional(),trace_width:_i.optional()}),MGe=le.object({type:le.literal("pcb_component"),pcb_component_id:Mv("pcb_component"),source_component_id:le.string(),center:Iy,layer:j1,rotation:wS,width:qv,height:qv,subcircuit_id:le.string().optional()}).describe("Defines a component on the PCB"),Jle=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Mv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.enum(["circle","square"]),hole_diameter:le.number(),x:_i,y:_i});Jle.describe("Defines a circular or square hole on the PCB");var ece=le.object({type:le.literal("pcb_hole"),pcb_hole_id:Mv("pcb_hole"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("oval"),hole_width:le.number(),hole_height:le.number(),x:_i,y:_i});ece.describe("Defines an oval hole on the PCB");var CGe=Jle.or(ece),RGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_diameter:le.number(),hole_diameter:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")}),AGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.enum(["oval","pill"]),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),outer_width:le.number(),outer_height:le.number(),hole_width:le.number(),hole_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")}),NGe=le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("circular_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("circle"),pad_shape:le.literal("rect"),hole_diameter:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")});le.object({type:le.literal("pcb_plated_hole"),shape:le.literal("pill_hole_with_rect_pad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),hole_shape:le.literal("pill"),pad_shape:le.literal("rect"),hole_width:le.number(),hole_height:le.number(),rect_pad_width:le.number(),rect_pad_height:le.number(),x:_i,y:_i,layers:le.array(j1),port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional(),pcb_plated_hole_id:Mv("pcb_plated_hole")});var PGe=le.union([RGe,AGe,NGe]),DGe=le.object({type:le.literal("pcb_port"),pcb_port_id:Mv("pcb_port"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_port_id:le.string(),pcb_component_id:le.string(),x:_i,y:_i,layers:le.array(j1)}).describe("Defines a port on the PCB"),LGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("circle"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,radius:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),OGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rect"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),zGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("rotated_rect"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),ccw_rotation:wS,layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),UGe=le.object({type:le.literal("pcb_smtpad"),shape:le.literal("pill"),pcb_smtpad_id:Mv("pcb_smtpad"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),radius:le.number(),layer:j1,port_hints:le.array(le.string()).optional(),pcb_component_id:le.string().optional(),pcb_port_id:le.string().optional()}),IGe=le.union([LGe,OGe,zGe,UGe]).describe("Defines an SMT pad on the PCB"),kGe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("circle"),pcb_solder_paste_id:Mv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,radius:le.number(),layer:j1,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),FGe=le.object({type:le.literal("pcb_solder_paste"),shape:le.literal("rect"),pcb_solder_paste_id:Mv("pcb_solder_paste"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,width:le.number(),height:le.number(),layer:j1,pcb_component_id:le.string().optional(),pcb_smtpad_id:le.string().optional()}),BGe=le.union([kGe,FGe]).describe("Defines solderpaste on the PCB"),HGe=le.object({type:le.literal("pcb_text"),pcb_text_id:Mv("pcb_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),text:le.string(),center:Iy,layer:j1,width:qv,height:qv,lines:le.number(),align:le.enum(["bottom-left"])}).describe("Defines text on the PCB"),jGe=le.object({route_type:le.literal("wire"),x:_i,y:_i,width:_i,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:j1}),VGe=le.object({route_type:le.literal("via"),x:_i,y:_i,from_layer:le.string(),to_layer:le.string()});le.union([jGe,VGe]);var GGe=le.object({type:le.literal("pcb_trace"),source_trace_id:le.string().optional(),pcb_component_id:le.string().optional(),pcb_trace_id:Mv("pcb_trace"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),route_thickness_mode:le.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:le.number().optional(),should_round_corners:le.boolean().optional(),trace_length:le.number().optional(),route:le.array(le.union([le.object({route_type:le.literal("wire"),x:_i,y:_i,width:_i,start_pcb_port_id:le.string().optional(),end_pcb_port_id:le.string().optional(),layer:j1}),le.object({route_type:le.literal("via"),x:_i,y:_i,from_layer:le.string(),to_layer:le.string()})]))}).describe("Defines a trace on the PCB"),qGe=le.object({type:le.literal("pcb_trace_error"),pcb_trace_error_id:Mv("pcb_trace_error"),error_type:le.literal("pcb_trace_error"),message:le.string(),center:Iy.optional(),pcb_trace_id:le.string(),source_trace_id:le.string(),pcb_component_ids:le.array(le.string()),pcb_port_ids:le.array(le.string())}).describe("Defines a trace error on the PCB"),YGe=le.object({type:le.literal("pcb_port_not_matched_error"),pcb_error_id:Mv("pcb_error"),message:le.string(),pcb_component_ids:le.array(le.string())}).describe("Defines a trace error on the PCB where a port is not matched"),XGe=le.object({type:le.literal("pcb_via"),pcb_via_id:Mv("pcb_via"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),x:_i,y:_i,outer_diameter:_i.default("0.6mm"),hole_diameter:_i.default("0.25mm"),from_layer:j1.optional(),to_layer:j1.optional(),layers:le.array(j1),pcb_trace_id:le.string().optional()}).describe("Defines a via on the PCB"),WGe=le.object({type:le.literal("pcb_board"),pcb_board_id:Mv("pcb_board"),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:qv,height:qv,center:Iy,thickness:qv.optional().default(1.4),num_layers:le.number().optional().default(4),outline:le.array(Iy).optional()}).describe("Defines the board outline of the PCB"),$Ge=le.object({type:le.literal("pcb_placement_error"),pcb_placement_error_id:Mv("pcb_placement_error"),message:le.string()}).describe("Defines a placement error on the PCB"),ZGe=le.object({type:le.literal("pcb_trace_hint"),pcb_trace_hint_id:Mv("pcb_trace_hint"),pcb_port_id:le.string(),pcb_component_id:le.string(),route:le.array(g4)}).describe("A hint that can be used during generation of a PCB trace"),QGe=le.object({type:le.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:Mv("pcb_silkscreen_line"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),stroke_width:_i.default("0.1mm"),x1:_i,y1:_i,x2:_i,y2:_i,layer:X8}).describe("Defines a silkscreen line on the PCB"),KGe=le.object({type:le.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:Mv("pcb_silkscreen_path"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),layer:X8,route:le.array(Iy),stroke_width:qv}).describe("Defines a silkscreen path on the PCB"),JGe=le.object({type:le.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:Mv("pcb_silkscreen_text"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:_i.default("0.2mm"),pcb_component_id:le.string(),text:le.string(),ccw_rotation:le.number().optional(),layer:j1,is_mirrored:le.boolean().default(!1).optional(),anchor_position:Iy.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),eqe=le.object({type:le.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:Mv("pcb_silkscreen_rect"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,width:qv,height:qv,layer:j1,stroke_width:qv.default("1mm")}).describe("Defines a silkscreen rect on the PCB"),tqe=le.object({type:le.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:Mv("pcb_silkscreen_circle"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius:qv,layer:X8,stroke_width:qv.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),nqe=le.object({type:le.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:Mv("pcb_silkscreen_oval"),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius_x:_i,radius_y:_i,layer:X8}).describe("Defines a silkscreen oval on the PCB"),rqe=le.object({type:le.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:Mv("pcb_fabrication_note_text"),subcircuit_id:le.string().optional(),pcb_group_id:le.string().optional(),font:le.literal("tscircuit2024").default("tscircuit2024"),font_size:_i.default("1mm"),pcb_component_id:le.string(),text:le.string(),layer:X8,anchor_position:Iy.default({x:0,y:0}),anchor_alignment:le.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:le.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),iqe=le.object({type:le.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:Mv("pcb_fabrication_note_path"),pcb_component_id:le.string(),subcircuit_id:le.string().optional(),layer:j1,route:le.array(Iy),stroke_width:qv,color:le.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),aqe=le.object({type:le.literal("pcb_keepout"),shape:le.literal("rect"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,width:_i,height:_i,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()}).or(le.object({type:le.literal("pcb_keepout"),shape:le.literal("circle"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),center:Iy,radius:_i,pcb_keepout_id:le.string(),layers:le.array(le.string()),description:le.string().optional()})),oqe=le.object({type:le.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:Mv("pcb_missing_footprint_error"),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),error_type:le.literal("pcb_missing_footprint_error"),source_component_id:le.string(),message:le.string()}).describe("Defines a missing footprint error on the PCB"),sqe=le.object({type:le.literal("pcb_manual_edit_conflict_error"),pcb_error_id:Mv("pcb_manual_edit_conflict_error"),message:le.string(),pcb_component_id:le.string(),pcb_group_id:le.string().optional(),subcircuit_id:le.string().optional(),source_component_id:le.string()}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),lqe=le.object({type:le.literal("pcb_group"),pcb_group_id:Mv("pcb_group"),source_group_id:le.string(),is_subcircuit:le.boolean().optional(),subcircuit_id:le.string().optional(),width:qv,height:qv,center:Iy,pcb_component_ids:le.array(le.string()),name:le.string().optional(),description:le.string().optional()}).describe("Defines a group of components on the PCB"),cqe=le.object({type:le.literal("pcb_autorouting_error"),pcb_error_id:Mv("pcb_autorouting_error"),message:le.string()}).describe("The autorouting has failed to route a portion of the board"),uqe=le.object({type:le.literal("cad_component"),cad_component_id:le.string(),pcb_component_id:le.string(),source_component_id:le.string(),position:cA,rotation:cA.optional(),size:cA.optional(),layer:j1.optional(),footprinter_string:le.string().optional(),model_obj_url:le.string().optional(),model_stl_url:le.string().optional(),model_3mf_url:le.string().optional(),model_jscad:le.any().optional()}).describe("Defines a component on the PCB");le.union([rGe,nGe,tGe,Ble,aGe,iGe,kle,Fle,Ule,Ck,Ile,Hle,jle,Vle,Yle,Xle,Zle,Wle,$le,qle,Gle,Qle,MGe,CGe,oqe,sqe,PGe,aqe,DGe,HGe,GGe,XGe,IGe,BGe,WGe,lqe,ZGe,QGe,KGe,JGe,eqe,tqe,nqe,qGe,$Ge,YGe,iqe,rqe,cqe,oGe,mGe,hGe,dGe,vGe,pGe,sGe,gGe,yGe,SGe,EGe,uqe]);var uA={exports:{}},Ak,tce;function fqe(){if(tce)return Ak;tce=1;var r=1e3,e=r*60,t=e*60,n=t*24,i=n*7,a=n*365.25;Ak=function(u,f){f=f||{};var m=typeof u;if(m==="string"&&u.length>0)return o(u);if(m==="number"&&isFinite(u))return f.long?l(u):s(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(f){var m=parseFloat(f[1]),_=(f[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return m*a;case"weeks":case"week":case"w":return m*i;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*t;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function s(u){var f=Math.abs(u);return f>=n?Math.round(u/n)+"d":f>=t?Math.round(u/t)+"h":f>=e?Math.round(u/e)+"m":f>=r?Math.round(u/r)+"s":u+"ms"}function l(u){var f=Math.abs(u);return f>=n?c(u,f,n,"day"):f>=t?c(u,f,t,"hour"):f>=e?c(u,f,e,"minute"):f>=r?c(u,f,r,"second"):u+" ms"}function c(u,f,m,_){var x=f>=m*1.5;return Math.round(u/m)+" "+_+(x?"s":"")}return Ak}var Nk,nce;function dqe(){if(nce)return Nk;nce=1;function r(e){n.debug=n,n.default=n,n.coerce=c,n.disable=s,n.enable=a,n.enabled=l,n.humanize=fqe(),n.destroy=u,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function t(f){let m=0;for(let _=0;_<f.length;_++)m=(m<<5)-m+f.charCodeAt(_),m|=0;return n.colors[Math.abs(m)%n.colors.length]}n.selectColor=t;function n(f){let m,_=null,x,M;function w(...T){if(!w.enabled)return;const D=w,O=Number(new Date),B=O-(m||O);D.diff=B,D.prev=m,D.curr=O,m=O,T[0]=n.coerce(T[0]),typeof T[0]!="string"&&T.unshift("%O");let W=0;T[0]=T[0].replace(/%([a-zA-Z%])/g,(Z,J)=>{if(Z==="%%")return"%";W++;const ae=n.formatters[J];if(typeof ae=="function"){const K=T[W];Z=ae.call(D,K),T.splice(W,1),W--}return Z}),n.formatArgs.call(D,T),(D.log||n.log).apply(D,T)}return w.namespace=f,w.useColors=n.useColors(),w.color=n.selectColor(f),w.extend=i,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(x!==n.namespaces&&(x=n.namespaces,M=n.enabled(f)),M),set:T=>{_=T}}),typeof n.init=="function"&&n.init(w),w}function i(f,m){const _=n(this.namespace+(typeof m>"u"?":":m)+f);return _.log=this.log,_}function a(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];const m=(typeof f=="string"?f:"").trim().replace(" ",",").split(",").filter(Boolean);for(const _ of m)_[0]==="-"?n.skips.push(_.slice(1)):n.names.push(_)}function o(f,m){let _=0,x=0,M=-1,w=0;for(;_<f.length;)if(x<m.length&&(m[x]===f[_]||m[x]==="*"))m[x]==="*"?(M=x,w=_,x++):(_++,x++);else if(M!==-1)x=M+1,w++,_=w;else return!1;for(;x<m.length&&m[x]==="*";)x++;return x===m.length}function s(){const f=[...n.names,...n.skips.map(m=>"-"+m)].join(",");return n.enable(""),f}function l(f){for(const m of n.skips)if(o(f,m))return!1;for(const m of n.names)if(o(f,m))return!0;return!1}function c(f){return f instanceof Error?f.stack||f.message:f}function u(){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 n.enable(n.load()),n}return Nk=r,Nk}var rce;function hqe(){return rce||(rce=1,function(r,e){e.formatArgs=n,e.save=i,e.load=a,e.useColors=t,e.storage=o(),e.destroy=(()=>{let l=!1;return()=>{l||(l=!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`."))}})(),e.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 t(){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 l;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&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+r.exports.humanize(this.diff),!this.useColors)return;const c="color: "+this.color;l.splice(1,0,c,"color: inherit");let u=0,f=0;l[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(u++,m==="%c"&&(f=u))}),l.splice(f,0,c)}e.log=console.debug||console.log||(()=>{});function i(l){try{l?e.storage.setItem("debug",l):e.storage.removeItem("debug")}catch{}}function a(){let l;try{l=e.storage.getItem("debug")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=process.env.DEBUG),l}function o(){try{return localStorage}catch{}}r.exports=dqe()(e);const{formatters:s}=r.exports;s.j=function(l){try{return JSON.stringify(l)}catch(c){return"[UnexpectedJSONParseError]: "+c.message}}}(uA,uA.exports)),uA.exports}var pqe=hqe();const T9=yx(pqe);var fA={exports:{}},Pk={exports:{}},dA={exports:{}},Dk={};/**
|
|
246
246
|
* @license React
|
|
247
247
|
* scheduler.production.js
|
|
248
248
|
*
|
|
@@ -13371,7 +13371,7 @@ ${n.slice(0,2e3)}
|
|
|
13371
13371
|
50% { opacity: 0.2; }
|
|
13372
13372
|
100% { opacity: 0.6; }
|
|
13373
13373
|
}
|
|
13374
|
-
`,i.appendChild(O)}})}};a();const o=new MutationObserver(a);return o.observe(i,{childList:!0,subtree:!1,characterData:!1}),()=>{o.disconnect()}},[r,t,e,n])},JOt=({circuitJson:r,containerStyle:e,editEvents:t=[],onEditEvent:n,defaultEditMode:i=!1,debugGrid:a=!1,editingEnabled:o=!1,debug:s=!1})=>{s&&XOt();const[l,c]=ct.useState(i),u=ct.useRef(null),{ref:f,cancelDrag:m,transform:_}=iPe({onSetTransform($){u.current&&(u.current.style.transform=yE($))}}),{containerWidth:x,containerHeight:M}=qOt(f),w=ct.useMemo(()=>!x||!M?"":fie(r,{width:x,height:M||720,grid:a?{cellSize:1,labelCells:!0}:void 0}),[r,x,M]),T=ct.useMemo(()=>{var Z;if(!w)return J_();const $=(Z=w.match(/data-real-to-screen-transform="([^"]+)"/))==null?void 0:Z[1];try{return kk($)}catch(J){return console.error(J),J_()}},[w]),{handleMouseDown:D,isDragging:O,activeEditEvent:B}=ZOt({onEditEvent:n,cancelDrag:m,realToSvgProjection:T,svgToScreenProjection:_,circuitJson:r,editEvents:t,enabled:l});QOt({svgDivRef:u,editEvents:t,realToSvgProjection:T,svgToScreenProjection:_,activeEditEvent:B}),KOt({svgDivRef:u,circuitJson:r,activeEditEvent:B,editEvents:t});const W=ct.useMemo(()=>et.jsx("div",{ref:u,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:w}}),[w]);return et.jsxs("div",{ref:f,style:{position:"relative",backgroundColor:"#F5F1ED",overflow:"hidden",cursor:O?"grabbing":"grab",minHeight:"300px",...e},onMouseDown:D,children:[o&&et.jsx(GOt,{active:l,onClick:()=>c(!l)}),W]})},ezt=r=>{const[e,t]=ct.useState(0),[n,i]=ct.useState(0);return ct.useEffect(()=>{if(!r.current)return;const a=()=>{var l;const s=(l=r.current)==null?void 0:l.getBoundingClientRect();t((s==null?void 0:s.width)||0),i((s==null?void 0:s.height)||0)};a();const o=new ResizeObserver(a);return o.observe(r.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),{containerWidth:e,containerHeight:n}};T9("assembly-viewer");var tzt=()=>{T9.enable("assembly-viewer*")},nzt=({circuitJson:r,containerStyle:e,debugGrid:t=!1,debug:n=!1})=>{n&&tzt();const i=ct.useRef(null),{ref:a}=iPe({onSetTransform(u){i.current&&(i.current.style.transform=yE(u))}}),{containerWidth:o,containerHeight:s}=ezt(a),l=ct.useMemo(()=>!o||!s?"":pOe(r,{width:o,height:s||720}),[r,o,s]);ct.useMemo(()=>{var f;if(!l)return J_();const u=(f=l.match(/data-real-to-screen-transform="([^"]+)"/))==null?void 0:f[1];try{return kk(u)}catch(m){return console.error(m),J_()}},[l]);const c=ct.useMemo(()=>et.jsx("div",{ref:i,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:l}}),[l]);return et.jsx("div",{ref:a,style:{position:"relative",backgroundColor:"#F5F1ED",overflow:"hidden",minHeight:"300px",...e},children:c})};const Bw=({onRunClicked:r})=>et.jsxs("div",{className:"rf-flex rf-items-center rf-gap-3 rf-bg-gray-100 rf-text-center rf-justify-center rf-py-10",children:["No circuit json loaded",r&&et.jsxs(e4,{className:"rf-bg-blue-600 rf-hover:bg-blue-500",onClick:r,children:["Run Code",et.jsx(jRe,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),QU=({text:r,onClick:e})=>et.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:e,children:r}),KU=r=>{var e;return et.jsxs("div",{className:"rf-leading-5",children:[et.jsx("div",{className:"rf-py-2 rf-font-bold",children:r.column.name}),et.jsx("div",{children:((e=r.field)==null?void 0:e.call(r))??et.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:t=>{var n;(n=r.onTextChange)==null||n.call(r,t.target.value)}})})]})},rzt=({open:r,children:e,title:t,onClose:n})=>r?et.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-justify-center rf-items-center rf-z-50",onClick:n,children:et.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:i=>{i.preventDefault(),i.stopPropagation()},children:[et.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:t}),et.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:n,children:"×"}),e]})}):null,izt=({elements:r})=>{const[e,t]=ct.useState({open:!1}),[n,i]=ct.useReducer((u,f)=>({...u,...f}),{}),a=[...new Set(r.map(u=>u.type))],o=r.map(u=>{const f=u[`${u.type}_id`],m=Object.fromEntries(Object.entries(u).filter(([x])=>!(x===`${u.type}_id`||!x.endsWith("_id")))),_=Object.fromEntries(Object.entries(u).filter(([x])=>!x.endsWith("_id")));return{primary_id:f,other_ids:m,..._,_og_elm:u}}),s=o.map(u=>{let f="";const m=_=>{const x=Object.keys(_.other_ids).find(T=>T.startsWith("source_"));if(!x)return`.${_.name}`;const M=x.slice(0,-3),w=o.find(T=>T.type===M&&T.primary_id===_.other_ids[x]);return w?"name"in w?`${m(w)} > .${_.name}`:`#${w.primary_id} > .${_.name}`:`??? > .${_.name}`};return"name"in u&&(f=m(u)),{...u,selector_path:f}}),l=[{key:"primary_id",name:"primary_id",renderCell:u=>et.jsxs("div",{className:"rf-flex rf-items-center",children:[et.jsx(QU,{text:u.primary_id,onClick:()=>i({focused_id:u.primary_id,id_search:void 0,selector_search:void 0})}),et.jsx("span",{className:"rf-flex-grow"}),et.jsx(QU,{text:"(JSON)",onClick:()=>t({open:!0,element:u._og_elm,title:u.primary_id})})]}),renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({id_search:f}),field:n.focused_id?()=>et.jsxs("div",{children:["Focus:"," ",et.jsx("span",{className:"rf-underline",children:n.focused_id}),et.jsx(QU,{text:"(unfocus)",onClick:()=>i({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:u=>et.jsx(KU,{column:u,field:()=>et.jsxs("select",{onChange:f=>i({component_type_filter:f.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[et.jsx("option",{value:"any",children:"any"},"any"),et.jsx("option",{value:"source",children:"source"},"source"),et.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),et.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),a.map(f=>et.jsx("option",{value:f,children:f},f))]})})},{key:"name",name:"name",renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({name_search:f})})},{key:"selector_path",name:"selector_path",renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({selector_search:f})})},{key:"other_ids",name:"other_ids",renderCell:u=>et.jsx("div",{className:"rf-space-x-2",children:Object.entries(u.other_ids).map(([f,m])=>et.jsx(QU,{text:m,onClick:()=>i({focused_id:m})},m))})}],c=s.filter(u=>{var f,m;return n.name_search?(m=(f=u.name)==null?void 0:f.toLowerCase())==null?void 0:m.includes(n.name_search.toLowerCase()):!0}).filter(u=>{var f;return!n.component_type_filter||n.component_type_filter==="any"?!0:n.component_type_filter==="source"?u.type.startsWith("source_"):n.component_type_filter==="source/pcb"?u.type.startsWith("source_")||u.type.startsWith("pcb_"):n.component_type_filter==="source/schematic"?u.type.startsWith("source_")||u.type.startsWith("schematic_"):(f=u.type)==null?void 0:f.includes(n.component_type_filter)}).filter(u=>n.selector_search?n.selector_search.split(" ").filter(m=>m.length>0).every(m=>{var _;return(_=u.selector_path)==null?void 0:_.includes(m)}):!0).filter(u=>{var f;return n.id_search?(f=u.primary_id)==null?void 0:f.includes(n.id_search):!0}).filter(u=>!!(!n.focused_id||u.primary_id===n.focused_id||Object.values(u.other_ids).includes(n.focused_id)));return et.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[et.jsx("div",{className:"rf-overflow-x-auto",children:et.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[et.jsx("thead",{children:et.jsx("tr",{children:l.map(u=>et.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:u.renderHeaderCell?u.renderHeaderCell(u):u.name},u.key))})}),et.jsx("tbody",{children:c.map((u,f)=>et.jsx("tr",{className:"rf-hover:bg-gray-100",children:l.map(m=>et.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:m.renderCell?m.renderCell(u):u[m.key]},m.key))},f))})]})}),et.jsx(rzt,{open:e.open,onClose:()=>t({open:!1}),title:e.open?e.title:"",children:et.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:et.jsx("pre",{className:"rf-whitespace-pre-wrap",children:e.open?JSON.stringify(e.element,null,2):""})})})]})},azt=(r,e)=>r==="jlcpcb"?et.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${e}`,children:e}):e,ozt=({circuitJson:r})=>{const e=r.filter(n=>n.type==="source_component"),t=new Set;for(const n of e)if(n.supplier_part_numbers)for(const i of Object.keys(n.supplier_part_numbers))t.add(i);return et.jsx("div",{className:"rf-overflow-x-auto",children:et.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[et.jsx("thead",{children:et.jsxs("tr",{className:"rf-border-b",children:[et.jsx("th",{className:"rf-p-2",children:"Name"}),Array.from(t).map(n=>et.jsx("th",{className:"rf-p-2 rf-capitalize",children:n},n))]})}),et.jsx("tbody",{children:e.map(n=>et.jsxs("tr",{className:"rf-border-b",children:[et.jsx("td",{className:"rf-p-2",children:n.name}),Array.from(t).map(i=>{var a,o;return et.jsx("td",{className:"rf-p-2",children:azt(i,((o=(a=n.supplier_part_numbers)==null?void 0:a[i])==null?void 0:o[0])||"")},i)})]},n.source_component_id))})]})})},szt=({containerClassName:r,...e})=>{const t=ct.useRef(null),[n,i]=ct.useState(620);return ct.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;i(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),et.jsx("div",{ref:t,className:r||"rf-w-full rf-h-full",children:et.jsx(N8t,{...e,height:n})})},lzt='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-4{margin-top:1rem}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-2{height:.5rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-60{height:15rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[620px\\]{height:620px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-max-h-\\[500px\\]{max-height:500px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-max-w-2xl{max-width:42rem}.rf-max-w-lg{max-width:32rem}.rf-max-w-xl{max-width:36rem}.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-place-items-center{place-items:center}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-blue-600\\/70{background-color:rgba(37,99,235,.7)}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-p-0{padding:0}.rf-p-0\\.5{padding:.125rem}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-pb-0{padding-bottom:0}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-tracking-widest{letter-spacing:.1em}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-bg-blue-600\\/60:disabled{background-color:rgba(37,99,235,.6)}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',czt=()=>{ct.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=lzt,document.head.appendChild(e)},[])},xOe=r=>`hsl(${p3.indexOf(r)*137.5%360}, 70%, 50%)`,uzt=({phaseTimings:r})=>{if(!r)return null;const e=Object.values(r).reduce((t,n)=>t+n,0);return et.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[et.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:p3.map(t=>{const n=r[t]||0,i=n/e*100;return et.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:xOe(t)},children:et.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),et.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},fzt=({renderLog:r})=>{const[e,t]=ct.useState("chronological");if(!r)return et.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((r==null?void 0:r.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>p3.indexOf(a[0])-p3.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const i=n.reduce((a,[o,s])=>a+s,0);return et.jsxs("div",{className:"rf-bg-white",children:[et.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[et.jsx("div",{children:"Render Logs"}),et.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[et.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),et.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[et.jsx("option",{value:"chronological",children:"Phase Order"}),et.jsx("option",{value:"longest",children:"Duration"})]})]})]}),et.jsx(uzt,{phaseTimings:r.phaseTimings}),et.jsxs("table",{className:"rf-w-full rf-text-xs",children:[et.jsx("thead",{children:et.jsxs("tr",{children:[et.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),et.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),et.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),et.jsx("tbody",{children:n.map(([a,o])=>et.jsxs("tr",{children:[et.jsx("td",{className:"rf-p-2",children:p3.indexOf(a)}),et.jsx("td",{className:"rf-p-2",children:a}),et.jsx("td",{className:"rf-p-2",children:et.jsx("div",{className:"rf-w-8",children:et.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:xOe(a),width:`${o/i*100}%`}})})}),et.jsx("td",{className:"rf-p-2",children:et.jsxs("div",{className:"rf-flex w-full",children:[et.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),et.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},dzt="0.0.257",hzt=["assembly","bom","circuit_json","errors","render_log"],pzt=({code:r,onRunClicked:e=void 0,errorMessage:t,circuitJsonKey:n="",circuitJson:i,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:f,renderLog:m,showImportAndFormatButtons:_=!0,className:x,headerClassName:M,leftHeaderContent:w,readOnly:T,isStreaming:D,autoroutingLog:O,onReportAutoroutingLog:B,isRunningCode:W,hasCodeChangedSinceLastRun:$,onEditEvent:Z,editEvents:J,defaultActiveTab:ae,autoRotate3dViewerDisabled:K,showSchematicDebugGrid:he=!1,showToggleFullScreen:me=!0,defaultToFullScreen:be=!1})=>{var Ue;czt();const[Ae,Le]=ct.useState(ae??"pcb"),[we,Oe]=ct.useState(be),Te=ct.useCallback(Ie=>{Le(Ie),f==null||f(Ie)},[f]),Ve=()=>{Oe(!we)};return ct.useEffect(()=>{t&&Te("errors")},[t]),ct.useEffect(()=>{(Ae==="code"||Ae==="errors")&&i&&!t&&Te(ae??"pcb")},[i]),et.jsx("div",{className:Jm("flex flex-col relative rf-overflow-x-hidden",x),children:et.jsx("div",{className:Jm("rf-md:sticky rf-md:top-2",we&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-bg-white"),children:et.jsxs(zFe,{value:Ae,onValueChange:Te,className:"rf-flex-grow rf-flex rf-flex-col",children:[et.jsxs("div",{className:Jm("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",M),children:[w,w&&et.jsx("div",{className:"rf-flex-grow"}),!w&&W&&et.jsx(Kte,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!w&&et.jsx("div",{className:"rf-flex-grow"}),m&&m.progress!==1&&et.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[m.lastRenderEvent&&et.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:(Ue=m.lastRenderEvent)==null?void 0:Ue.type.split("renderable:renderLifecycle:")[1].split(":")[0]}),et.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:et.jsx(Kte,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),et.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((m.progress??0)*100).toFixed(1),"%"]})]}),o&&et.jsxs(Boe,{children:[s&&et.jsx(nT,{value:"code",children:"Code"}),et.jsxs(nT,{value:"pcb",className:"rf-whitespace-nowrap",children:[i&&et.jsx("span",{className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),et.jsxs(nT,{value:"schematic",className:"rf-whitespace-nowrap",children:[i&&et.jsx("span",{className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),et.jsxs(nT,{value:"cad",children:[i&&et.jsx("span",{className:Jm("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ae)&&et.jsx(nT,{value:Ae,children:Foe(Ae)}),et.jsxs(qne,{children:[et.jsx(Yne,{asChild:!0,children:et.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[et.jsx(q8t,{className:"rf-w-4 rf-h-4"}),t&&et.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),et.jsxs(Xz,{className:"rf-*:text-xs",children:[hzt.map(Ie=>et.jsxs(nE,{onSelect:()=>Te(Ie),children:[Ae!==Ie&&et.jsx(HRe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ae===Ie&&et.jsx(Qte,{className:"rf-w-3 rf-h-3"}),et.jsx("div",{className:"rf-pr-2",children:Foe(Ie)}),Ie==="errors"&&t&&et.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:"1"})]},Ie)),et.jsx(nE,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:et.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",dzt.split(".").map((Ie,ze)=>ze===2?parseInt(Ie)+1:Ie).join(".")]})})]})]})]}),me&&et.jsx(e4,{onClick:Ve,variant:"ghost",children:we?et.jsx(X8t,{size:16}):et.jsx(Y8t,{size:16})})]}),s&&et.jsx(zb,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:et.jsx("div",{className:"rf-h-full",children:l})}),et.jsx(zb,{value:"pcb",children:et.jsx("div",{className:Jm("rf-overflow-hidden",we?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(szt,{disableAutoFocus:!0,focusOnHover:!1,circuitJson:i,debugGraphics:a,containerClassName:Jm("rf-h-full rf-w-full",we?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ie=>{Z&&Ie.forEach(ze=>Z(ze))}},n):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"assembly",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallback:et.jsx("div",{children:"Error loading Assembly"}),children:i?et.jsx(nzt,{circuitJson:i,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"schematic",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(JOt,{circuitJson:i,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ie=>Z==null?void 0:Z(Ie),editEvents:J,debugGrid:he}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"cad",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{FallbackComponent:P8t,children:i?et.jsx(vEt,{soup:i,autoRotateDisabled:K}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"bom",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(ozt,{circuitJson:i}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"circuit_json",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallback:et.jsx("div",{children:"Error loading JSON viewer"}),children:i?et.jsx(izt,{elements:i}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"errors",children:i||t?et.jsx(IRt,{code:r,errorMessage:t,autoroutingLog:O,onReportAutoroutingLog:B}):et.jsx(Bw,{onRunClicked:e})}),u&&et.jsx(zb,{value:"render_log",children:et.jsx(fzt,{renderLog:m})})]})})})},die={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},hie=new Map,JU=r=>{const e=hie.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},mzt=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const n=hie.get(t.name);if(n)return{type:"tracked",store:r,...n};const i={connection:e.connect(t),stores:{}};return hie.set(t.name,i),{type:"tracked",store:r,...i}},bOe=(r,e={})=>(t,n,i)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(die?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(die?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),r(t,n,i);const{connection:u,...f}=mzt(s,c,l);let m=!0;i.setState=(M,w,T)=>{const D=t(M,w);if(!m)return D;const O=T===void 0?{type:o||"anonymous"}:typeof T=="string"?{type:T}:T;return s===void 0?(u==null||u.send(O,n()),D):(u==null||u.send({...O,type:`${s}/${O.type}`},{...JU(l.name),[s]:i.getState()}),D)};const _=(...M)=>{const w=m;m=!1,t(...M),m=w},x=r(i.setState,n,i);if(f.type==="untracked"?u==null||u.init(x):(f.stores[f.store]=i,u==null||u.init(Object.fromEntries(Object.entries(f.stores).map(([M,w])=>[M,M===f.store?x:w.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let M=!1;const w=i.dispatch;i.dispatch=(...T)=>{(die?"production":void 0)!=="production"&&T[0].type==="__setState"&&!M&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),M=!0),w(...T)}}return u.subscribe(M=>{var w;switch(M.type){case"ACTION":if(typeof M.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return pie(M.payload,T=>{if(T.type==="__setState"){if(s===void 0){_(T.state);return}Object.keys(T.state).length!==1&&console.error(`
|
|
13374
|
+
`,i.appendChild(O)}})}};a();const o=new MutationObserver(a);return o.observe(i,{childList:!0,subtree:!1,characterData:!1}),()=>{o.disconnect()}},[r,t,e,n])},JOt=({circuitJson:r,containerStyle:e,editEvents:t=[],onEditEvent:n,defaultEditMode:i=!1,debugGrid:a=!1,editingEnabled:o=!1,debug:s=!1})=>{s&&XOt();const[l,c]=ct.useState(i),u=ct.useRef(null),{ref:f,cancelDrag:m,transform:_}=iPe({onSetTransform($){u.current&&(u.current.style.transform=yE($))}}),{containerWidth:x,containerHeight:M}=qOt(f),w=ct.useMemo(()=>!x||!M?"":fie(r,{width:x,height:M||720,grid:a?{cellSize:1,labelCells:!0}:void 0}),[r,x,M]),T=ct.useMemo(()=>{var Z;if(!w)return J_();const $=(Z=w.match(/data-real-to-screen-transform="([^"]+)"/))==null?void 0:Z[1];try{return kk($)}catch(J){return console.error(J),J_()}},[w]),{handleMouseDown:D,isDragging:O,activeEditEvent:B}=ZOt({onEditEvent:n,cancelDrag:m,realToSvgProjection:T,svgToScreenProjection:_,circuitJson:r,editEvents:t,enabled:l});QOt({svgDivRef:u,editEvents:t,realToSvgProjection:T,svgToScreenProjection:_,activeEditEvent:B}),KOt({svgDivRef:u,circuitJson:r,activeEditEvent:B,editEvents:t});const W=ct.useMemo(()=>et.jsx("div",{ref:u,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:w}}),[w]);return et.jsxs("div",{ref:f,style:{position:"relative",backgroundColor:"#F5F1ED",overflow:"hidden",cursor:O?"grabbing":"grab",minHeight:"300px",...e},onMouseDown:D,children:[o&&et.jsx(GOt,{active:l,onClick:()=>c(!l)}),W]})},ezt=r=>{const[e,t]=ct.useState(0),[n,i]=ct.useState(0);return ct.useEffect(()=>{if(!r.current)return;const a=()=>{var l;const s=(l=r.current)==null?void 0:l.getBoundingClientRect();t((s==null?void 0:s.width)||0),i((s==null?void 0:s.height)||0)};a();const o=new ResizeObserver(a);return o.observe(r.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),{containerWidth:e,containerHeight:n}};T9("assembly-viewer");var tzt=()=>{T9.enable("assembly-viewer*")},nzt=({circuitJson:r,containerStyle:e,debugGrid:t=!1,debug:n=!1})=>{n&&tzt();const i=ct.useRef(null),{ref:a}=iPe({onSetTransform(u){i.current&&(i.current.style.transform=yE(u))}}),{containerWidth:o,containerHeight:s}=ezt(a),l=ct.useMemo(()=>!o||!s?"":pOe(r,{width:o,height:s||720}),[r,o,s]);ct.useMemo(()=>{var f;if(!l)return J_();const u=(f=l.match(/data-real-to-screen-transform="([^"]+)"/))==null?void 0:f[1];try{return kk(u)}catch(m){return console.error(m),J_()}},[l]);const c=ct.useMemo(()=>et.jsx("div",{ref:i,style:{pointerEvents:"auto",transformOrigin:"0 0"},dangerouslySetInnerHTML:{__html:l}}),[l]);return et.jsx("div",{ref:a,style:{position:"relative",backgroundColor:"#F5F1ED",overflow:"hidden",minHeight:"300px",...e},children:c})};const Bw=({onRunClicked:r})=>et.jsxs("div",{className:"rf-flex rf-items-center rf-gap-3 rf-bg-gray-100 rf-text-center rf-justify-center rf-py-10",children:["No circuit json loaded",r&&et.jsxs(e4,{className:"rf-bg-blue-600 rf-hover:bg-blue-500",onClick:r,children:["Run Code",et.jsx(jRe,{className:"rf-w-3 rf-h-3 rf-ml-2"})]})]}),QU=({text:r,onClick:e})=>et.jsx("span",{className:"rf-cursor-pointer rf-underline rf-text-blue-600 rf-mx-2",onClick:e,children:r}),KU=r=>{var e;return et.jsxs("div",{className:"rf-leading-5",children:[et.jsx("div",{className:"rf-py-2 rf-font-bold",children:r.column.name}),et.jsx("div",{children:((e=r.field)==null?void 0:e.call(r))??et.jsx("input",{type:"text",className:"rf-border rf-rounded rf-p-1 rf-w-full",onChange:t=>{var n;(n=r.onTextChange)==null||n.call(r,t.target.value)}})})]})},rzt=({open:r,children:e,title:t,onClose:n})=>r?et.jsx("div",{className:"rf-fixed rf-inset-0 rf-bg-black rf-bg-opacity-50 rf-flex rf-justify-center rf-items-center rf-z-50",onClick:n,children:et.jsxs("div",{className:"rf-bg-white rf-p-5 rf-rounded-lg rf-relative rf-w-11/12 rf-max-w-2xl",onClick:i=>{i.preventDefault(),i.stopPropagation()},children:[et.jsx("h2",{className:"rf-mt-0 rf-text-md rf-pb-4",children:t}),et.jsx("button",{type:"button",className:"rf-absolute rf-top-2 rf-right-4 rf-text-2xl rf-font-bold",onClick:n,children:"×"}),e]})}):null,izt=({elements:r})=>{const[e,t]=ct.useState({open:!1}),[n,i]=ct.useReducer((u,f)=>({...u,...f}),{}),a=[...new Set(r.map(u=>u.type))],o=r.map(u=>{const f=u[`${u.type}_id`],m=Object.fromEntries(Object.entries(u).filter(([x])=>!(x===`${u.type}_id`||!x.endsWith("_id")))),_=Object.fromEntries(Object.entries(u).filter(([x])=>!x.endsWith("_id")));return{primary_id:f,other_ids:m,..._,_og_elm:u}}),s=o.map(u=>{let f="";const m=_=>{const x=Object.keys(_.other_ids).find(T=>T.startsWith("source_"));if(!x)return`.${_.name}`;const M=x.slice(0,-3),w=o.find(T=>T.type===M&&T.primary_id===_.other_ids[x]);return w?"name"in w?`${m(w)} > .${_.name}`:`#${w.primary_id} > .${_.name}`:`??? > .${_.name}`};return"name"in u&&(f=m(u)),{...u,selector_path:f}}),l=[{key:"primary_id",name:"primary_id",renderCell:u=>et.jsxs("div",{className:"rf-flex rf-items-center",children:[et.jsx(QU,{text:u.primary_id,onClick:()=>i({focused_id:u.primary_id,id_search:void 0,selector_search:void 0})}),et.jsx("span",{className:"rf-flex-grow"}),et.jsx(QU,{text:"(JSON)",onClick:()=>t({open:!0,element:u._og_elm,title:u.primary_id})})]}),renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({id_search:f}),field:n.focused_id?()=>et.jsxs("div",{children:["Focus:"," ",et.jsx("span",{className:"rf-underline",children:n.focused_id}),et.jsx(QU,{text:"(unfocus)",onClick:()=>i({focused_id:void 0})})]}):void 0})},{key:"type",name:"type",renderHeaderCell:u=>et.jsx(KU,{column:u,field:()=>et.jsxs("select",{onChange:f=>i({component_type_filter:f.target.value}),className:"rf-border rf-rounded rf-p-1 rf-w-full",children:[et.jsx("option",{value:"any",children:"any"},"any"),et.jsx("option",{value:"source",children:"source"},"source"),et.jsx("option",{value:"source/pcb",children:"source/pcb"},"source/pcb"),et.jsx("option",{value:"source/schematic",children:"source/schematic"},"source/schematic"),a.map(f=>et.jsx("option",{value:f,children:f},f))]})})},{key:"name",name:"name",renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({name_search:f})})},{key:"selector_path",name:"selector_path",renderHeaderCell:u=>et.jsx(KU,{column:u,onTextChange:f=>i({selector_search:f})})},{key:"other_ids",name:"other_ids",renderCell:u=>et.jsx("div",{className:"rf-space-x-2",children:Object.entries(u.other_ids).map(([f,m])=>et.jsx(QU,{text:m,onClick:()=>i({focused_id:m})},m))})}],c=s.filter(u=>{var f,m;return n.name_search?(m=(f=u.name)==null?void 0:f.toLowerCase())==null?void 0:m.includes(n.name_search.toLowerCase()):!0}).filter(u=>{var f;return!n.component_type_filter||n.component_type_filter==="any"?!0:n.component_type_filter==="source"?u.type.startsWith("source_"):n.component_type_filter==="source/pcb"?u.type.startsWith("source_")||u.type.startsWith("pcb_"):n.component_type_filter==="source/schematic"?u.type.startsWith("source_")||u.type.startsWith("schematic_"):(f=u.type)==null?void 0:f.includes(n.component_type_filter)}).filter(u=>n.selector_search?n.selector_search.split(" ").filter(m=>m.length>0).every(m=>{var _;return(_=u.selector_path)==null?void 0:_.includes(m)}):!0).filter(u=>{var f;return n.id_search?(f=u.primary_id)==null?void 0:f.includes(n.id_search):!0}).filter(u=>!!(!n.focused_id||u.primary_id===n.focused_id||Object.values(u.other_ids).includes(n.focused_id)));return et.jsxs("div",{className:"rf-font-mono rf-text-xs rf-bg-white",children:[et.jsx("div",{className:"rf-overflow-x-auto",children:et.jsxs("table",{className:"rf-table-auto rf-w-full rf-text-left",children:[et.jsx("thead",{children:et.jsx("tr",{children:l.map(u=>et.jsx("th",{className:"rf-px-4 rf-py-2 rf-border-b",children:u.renderHeaderCell?u.renderHeaderCell(u):u.name},u.key))})}),et.jsx("tbody",{children:c.map((u,f)=>et.jsx("tr",{className:"rf-hover:bg-gray-100",children:l.map(m=>et.jsx("td",{className:"rf-px-4 rf-py-2 rf-border-b",children:m.renderCell?m.renderCell(u):u[m.key]},m.key))},f))})]})}),et.jsx(rzt,{open:e.open,onClose:()=>t({open:!1}),title:e.open?e.title:"",children:et.jsx("div",{className:"rf-bg-gray-800 rf-p-3 rf-text-white rf-rounded",children:et.jsx("pre",{className:"rf-whitespace-pre-wrap",children:e.open?JSON.stringify(e.element,null,2):""})})})]})},azt=(r,e)=>r==="jlcpcb"?et.jsx("a",{className:"rf-underline rf-text-blue-500",target:"_blank",rel:"noreferrer",href:`https://jlcpcb.com/partdetail/${e}`,children:e}):e,ozt=({circuitJson:r})=>{const e=r.filter(n=>n.type==="source_component"),t=new Set;for(const n of e)if(n.supplier_part_numbers)for(const i of Object.keys(n.supplier_part_numbers))t.add(i);return et.jsx("div",{className:"rf-overflow-x-auto",children:et.jsxs("table",{className:"rf-w-full rf-text-left rf-text-sm",children:[et.jsx("thead",{children:et.jsxs("tr",{className:"rf-border-b",children:[et.jsx("th",{className:"rf-p-2",children:"Name"}),Array.from(t).map(n=>et.jsx("th",{className:"rf-p-2 rf-capitalize",children:n},n))]})}),et.jsx("tbody",{children:e.map(n=>et.jsxs("tr",{className:"rf-border-b",children:[et.jsx("td",{className:"rf-p-2",children:n.name}),Array.from(t).map(i=>{var a,o;return et.jsx("td",{className:"rf-p-2",children:azt(i,((o=(a=n.supplier_part_numbers)==null?void 0:a[i])==null?void 0:o[0])||"")},i)})]},n.source_component_id))})]})})},szt=({containerClassName:r,...e})=>{const t=ct.useRef(null),[n,i]=ct.useState(620);return ct.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;i(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),et.jsx("div",{ref:t,className:r||"rf-w-full rf-h-full",children:et.jsx(N8t,{...e,height:n})})},lzt='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-4{margin-top:1rem}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-2{height:.5rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-60{height:15rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[620px\\]{height:620px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-max-h-\\[500px\\]{max-height:500px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-max-w-2xl{max-width:42rem}.rf-max-w-lg{max-width:32rem}.rf-max-w-xl{max-width:36rem}.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-place-items-center{place-items:center}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-blue-600\\/70{background-color:rgba(37,99,235,.7)}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-p-0{padding:0}.rf-p-0\\.5{padding:.125rem}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-1\\.5{padding-left:.375rem;padding-right:.375rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-pb-0{padding-bottom:0}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-tracking-widest{letter-spacing:.1em}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-bg-blue-600\\/60:disabled{background-color:rgba(37,99,235,.6)}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',czt=()=>{ct.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=lzt,document.head.appendChild(e)},[])},xOe=r=>`hsl(${p3.indexOf(r)*137.5%360}, 70%, 50%)`,uzt=({phaseTimings:r})=>{if(!r)return null;const e=Object.values(r).reduce((t,n)=>t+n,0);return et.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[et.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:p3.map(t=>{const n=r[t]||0,i=n/e*100;return et.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:xOe(t)},children:et.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),et.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},fzt=({renderLog:r})=>{const[e,t]=ct.useState("chronological");if(!r)return et.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((r==null?void 0:r.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>p3.indexOf(a[0])-p3.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const i=n.reduce((a,[o,s])=>a+s,0);return et.jsxs("div",{className:"rf-bg-white",children:[et.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[et.jsx("div",{children:"Render Logs"}),et.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[et.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),et.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[et.jsx("option",{value:"chronological",children:"Phase Order"}),et.jsx("option",{value:"longest",children:"Duration"})]})]})]}),et.jsx(uzt,{phaseTimings:r.phaseTimings}),et.jsxs("table",{className:"rf-w-full rf-text-xs",children:[et.jsx("thead",{children:et.jsxs("tr",{children:[et.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),et.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),et.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),et.jsx("tbody",{children:n.map(([a,o])=>et.jsxs("tr",{children:[et.jsx("td",{className:"rf-p-2",children:p3.indexOf(a)}),et.jsx("td",{className:"rf-p-2",children:a}),et.jsx("td",{className:"rf-p-2",children:et.jsx("div",{className:"rf-w-8",children:et.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:xOe(a),width:`${o/i*100}%`}})})}),et.jsx("td",{className:"rf-p-2",children:et.jsxs("div",{className:"rf-flex w-full",children:[et.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),et.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},dzt="0.0.258",hzt=["assembly","bom","circuit_json","errors","render_log"],pzt=({code:r,onRunClicked:e=void 0,errorMessage:t,circuitJsonKey:n="",circuitJson:i,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:f,renderLog:m,showImportAndFormatButtons:_=!0,className:x,headerClassName:M,leftHeaderContent:w,readOnly:T,isStreaming:D,autoroutingLog:O,onReportAutoroutingLog:B,isRunningCode:W,hasCodeChangedSinceLastRun:$,onEditEvent:Z,editEvents:J,defaultActiveTab:ae,autoRotate3dViewerDisabled:K,showSchematicDebugGrid:he=!1,showToggleFullScreen:me=!0,defaultToFullScreen:be=!1})=>{var Ue;czt();const[Ae,Le]=ct.useState(ae??"pcb"),[we,Oe]=ct.useState(be),Te=ct.useCallback(Ie=>{Le(Ie),f==null||f(Ie)},[f]),Ve=()=>{Oe(!we)};return ct.useEffect(()=>{t&&Te("errors")},[t]),ct.useEffect(()=>{(Ae==="code"||Ae==="errors")&&i&&!t&&Te(ae??"pcb")},[i]),et.jsx("div",{className:Jm("flex flex-col relative rf-overflow-x-hidden",x),children:et.jsx("div",{className:Jm("rf-md:sticky rf-md:top-2",we&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-bg-white"),children:et.jsxs(zFe,{value:Ae,onValueChange:Te,className:"rf-flex-grow rf-flex rf-flex-col",children:[et.jsxs("div",{className:Jm("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",M),children:[w,w&&et.jsx("div",{className:"rf-flex-grow"}),!w&&W&&et.jsx(Kte,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!w&&et.jsx("div",{className:"rf-flex-grow"}),m&&m.progress!==1&&et.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[m.lastRenderEvent&&et.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:(Ue=m.lastRenderEvent)==null?void 0:Ue.type.split("renderable:renderLifecycle:")[1].split(":")[0]}),et.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:et.jsx(Kte,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),et.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((m.progress??0)*100).toFixed(1),"%"]})]}),o&&et.jsxs(Boe,{children:[s&&et.jsx(nT,{value:"code",children:"Code"}),et.jsxs(nT,{value:"pcb",className:"rf-whitespace-nowrap",children:[i&&et.jsx("span",{className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),et.jsxs(nT,{value:"schematic",className:"rf-whitespace-nowrap",children:[i&&et.jsx("span",{className:Jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),et.jsxs(nT,{value:"cad",children:[i&&et.jsx("span",{className:Jm("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",$?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ae)&&et.jsx(nT,{value:Ae,children:Foe(Ae)}),et.jsxs(qne,{children:[et.jsx(Yne,{asChild:!0,children:et.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[et.jsx(q8t,{className:"rf-w-4 rf-h-4"}),t&&et.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),et.jsxs(Xz,{className:"rf-*:text-xs",children:[hzt.map(Ie=>et.jsxs(nE,{onSelect:()=>Te(Ie),children:[Ae!==Ie&&et.jsx(HRe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ae===Ie&&et.jsx(Qte,{className:"rf-w-3 rf-h-3"}),et.jsx("div",{className:"rf-pr-2",children:Foe(Ie)}),Ie==="errors"&&t&&et.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:"1"})]},Ie)),et.jsx(nE,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:et.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",dzt.split(".").map((Ie,ze)=>ze===2?parseInt(Ie)+1:Ie).join(".")]})})]})]})]}),me&&et.jsx(e4,{onClick:Ve,variant:"ghost",children:we?et.jsx(X8t,{size:16}):et.jsx(Y8t,{size:16})})]}),s&&et.jsx(zb,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:et.jsx("div",{className:"rf-h-full",children:l})}),et.jsx(zb,{value:"pcb",children:et.jsx("div",{className:Jm("rf-overflow-hidden",we?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(szt,{disableAutoFocus:!0,focusOnHover:!1,circuitJson:i,debugGraphics:a,containerClassName:Jm("rf-h-full rf-w-full",we?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ie=>{Z&&Ie.forEach(ze=>Z(ze))}},n):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"assembly",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallback:et.jsx("div",{children:"Error loading Assembly"}),children:i?et.jsx(nzt,{circuitJson:i,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"schematic",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(JOt,{circuitJson:i,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ie=>Z==null?void 0:Z(Ie),editEvents:J,debugGrid:he}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"cad",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{FallbackComponent:P8t,children:i?et.jsx(vEt,{soup:i,autoRotateDisabled:K}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"bom",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallbackRender:({error:Ie})=>et.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:et.jsxs("div",{className:"rf-p-4",children:[et.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),et.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ie==null?void 0:Ie.message)||"An unknown error occurred"})]})}),children:i?et.jsx(ozt,{circuitJson:i}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"circuit_json",children:et.jsx("div",{className:Jm("rf-overflow-auto",we?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:et.jsx(GM,{fallback:et.jsx("div",{children:"Error loading JSON viewer"}),children:i?et.jsx(izt,{elements:i}):et.jsx(Bw,{onRunClicked:e})})})}),et.jsx(zb,{value:"errors",children:i||t?et.jsx(IRt,{code:r,errorMessage:t,autoroutingLog:O,onReportAutoroutingLog:B}):et.jsx(Bw,{onRunClicked:e})}),u&&et.jsx(zb,{value:"render_log",children:et.jsx(fzt,{renderLog:m})})]})})})},die={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},hie=new Map,JU=r=>{const e=hie.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},mzt=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const n=hie.get(t.name);if(n)return{type:"tracked",store:r,...n};const i={connection:e.connect(t),stores:{}};return hie.set(t.name,i),{type:"tracked",store:r,...i}},bOe=(r,e={})=>(t,n,i)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(die?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(die?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),r(t,n,i);const{connection:u,...f}=mzt(s,c,l);let m=!0;i.setState=(M,w,T)=>{const D=t(M,w);if(!m)return D;const O=T===void 0?{type:o||"anonymous"}:typeof T=="string"?{type:T}:T;return s===void 0?(u==null||u.send(O,n()),D):(u==null||u.send({...O,type:`${s}/${O.type}`},{...JU(l.name),[s]:i.getState()}),D)};const _=(...M)=>{const w=m;m=!1,t(...M),m=w},x=r(i.setState,n,i);if(f.type==="untracked"?u==null||u.init(x):(f.stores[f.store]=i,u==null||u.init(Object.fromEntries(Object.entries(f.stores).map(([M,w])=>[M,M===f.store?x:w.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let M=!1;const w=i.dispatch;i.dispatch=(...T)=>{(die?"production":void 0)!=="production"&&T[0].type==="__setState"&&!M&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),M=!0),w(...T)}}return u.subscribe(M=>{var w;switch(M.type){case"ACTION":if(typeof M.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return pie(M.payload,T=>{if(T.type==="__setState"){if(s===void 0){_(T.state);return}Object.keys(T.state).length!==1&&console.error(`
|
|
13375
13375
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
13376
13376
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
13377
13377
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|