@tscircuit/runframe 0.0.192 → 0.0.193
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.
|
@@ -12840,7 +12840,7 @@ ${l.join(`
|
|
|
12840
12840
|
`)!==-1&&(r=r.replace(/\r\n/g,`
|
|
12841
12841
|
`)),r.indexOf(`\\
|
|
12842
12842
|
`)!==-1&&(r=r.replace(/\\\n/g,""));const t=r.split(`
|
|
12843
|
-
`);let n="",i="",a=0,o=[];const s=typeof"".trimLeft=="function";for(let u=0,h=t.length;u<h;u++)if(n=t[u],n=s?n.trimLeft():n.trim(),a=n.length,a!==0&&(i=n.charAt(0),i!=="#"))if(i==="v"){const g=n.split(/\s+/);switch(g[0]){case"v":e.vertices.push(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3])),g.length>=7?e.colors.push(parseFloat(g[4]),parseFloat(g[5]),parseFloat(g[6])):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3]));break;case"vt":e.uvs.push(parseFloat(g[1]),parseFloat(g[2]));break}}else if(i==="f"){const _=n.substr(1).trim().split(/\s+/),b=[];for(let C=0,A=_.length;C<A;C++){const L=_[C];if(L.length>0){const U=L.split("/");b.push(U)}}const T=b[0];for(let C=1,A=b.length-1;C<A;C++){const L=b[C],U=b[C+1];e.addFace(T[0],L[0],U[0],T[1],L[1],U[1],T[2],L[2],U[2])}}else if(i==="l"){const g=n.substring(1).trim().split(" ");let _=[];const b=[];if(n.indexOf("/")===-1)_=g;else for(let T=0,C=g.length;T<C;T++){const A=g[T].split("/");A[0]!==""&&_.push(A[0]),A[1]!==""&&b.push(A[1])}e.addLineGeometry(_,b)}else if(i==="p"){const _=n.substr(1).trim().split(" ");e.addPointGeometry(_)}else if((o=Ogt.exec(n))!==null){const g=(" "+o[0].substr(1).trim()).substr(1);e.startObject(g)}else if(zgt.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(Ugt.test(n))e.materialLibraries.push(n.substring(7).trim());else if(Fgt.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(i==="s"){if(o=n.split(" "),o.length>1){const _=o[1].trim().toLowerCase();e.object.smooth=_!=="0"&&_!=="off"}else e.object.smooth=!0;const g=e.object.currentMaterial();g&&(g.smooth=e.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}e.finalize();const l=new yE;if(l.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let u=0,h=e.objects.length;u<h;u++){const g=e.objects[u],_=g.geometry,b=g.materials,T=_.type==="Line",C=_.type==="Points";let A=!1;if(_.vertices.length===0)continue;const L=new O0;L.setAttribute("position",new bc(_.vertices,3)),_.normals.length>0&&L.setAttribute("normal",new bc(_.normals,3)),_.colors.length>0&&(A=!0,L.setAttribute("color",new bc(_.colors,3))),_.hasUVIndices===!0&&L.setAttribute("uv",new bc(_.uvs,2));const U=[];for(let Z=0,ee=b.length;Z<ee;Z++){const $=b[Z],oe=$.name+"_"+$.smooth+"_"+A;let ae=e.materials[oe];if(this.materials!==null){if(ae=this.materials.create($.name),T&&ae&&!(ae instanceof Ux)){const ce=new Ux;t5.prototype.copy.call(ce,ae),ce.color.copy(ae.color),ae=ce}else if(C&&ae&&!(ae instanceof EE)){const ce=new EE({size:10,sizeAttenuation:!1});t5.prototype.copy.call(ce,ae),ce.color.copy(ae.color),ce.map=ae.map,ae=ce}}ae===void 0&&(T?ae=new Ux:C?ae=new EE({size:1,sizeAttenuation:!1}):ae=new rN,ae.name=$.name,ae.flatShading=!$.smooth,ae.vertexColors=A,e.materials[oe]=ae),U.push(ae)}let j;if(U.length>1){for(let Z=0,ee=b.length;Z<ee;Z++){const $=b[Z];L.addGroup($.groupStart,$.groupCount,Z)}T?j=new A3(L,U):C?j=new hM(L,U):j=new Qg(L,U)}else T?j=new A3(L,U[0]):C?j=new hM(L,U[0]):j=new Qg(L,U[0]);j.name=g.name,l.add(j)}else if(e.vertices.length>0){const u=new EE({size:1,sizeAttenuation:!1}),h=new O0;h.setAttribute("position",new bc(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(h.setAttribute("color",new bc(e.colors,3)),u.vertexColors=!0);const g=new hM(h,u);l.add(g)}return l}};function Bgt({stlUrl:r,mtlUrl:e,color:t,opacity:n=1}){const i=u$(Pgt,r),a=Tt.useRef();return gt.jsxs("mesh",{ref:a,children:[gt.jsx("primitive",{object:i,attach:"geometry"}),gt.jsx("meshStandardMaterial",{color:t,transparent:n!==1,opacity:n})]})}var Hgt={name:"@tscircuit/3d-viewer",version:"0.0.
|
|
12843
|
+
`);let n="",i="",a=0,o=[];const s=typeof"".trimLeft=="function";for(let u=0,h=t.length;u<h;u++)if(n=t[u],n=s?n.trimLeft():n.trim(),a=n.length,a!==0&&(i=n.charAt(0),i!=="#"))if(i==="v"){const g=n.split(/\s+/);switch(g[0]){case"v":e.vertices.push(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3])),g.length>=7?e.colors.push(parseFloat(g[4]),parseFloat(g[5]),parseFloat(g[6])):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3]));break;case"vt":e.uvs.push(parseFloat(g[1]),parseFloat(g[2]));break}}else if(i==="f"){const _=n.substr(1).trim().split(/\s+/),b=[];for(let C=0,A=_.length;C<A;C++){const L=_[C];if(L.length>0){const U=L.split("/");b.push(U)}}const T=b[0];for(let C=1,A=b.length-1;C<A;C++){const L=b[C],U=b[C+1];e.addFace(T[0],L[0],U[0],T[1],L[1],U[1],T[2],L[2],U[2])}}else if(i==="l"){const g=n.substring(1).trim().split(" ");let _=[];const b=[];if(n.indexOf("/")===-1)_=g;else for(let T=0,C=g.length;T<C;T++){const A=g[T].split("/");A[0]!==""&&_.push(A[0]),A[1]!==""&&b.push(A[1])}e.addLineGeometry(_,b)}else if(i==="p"){const _=n.substr(1).trim().split(" ");e.addPointGeometry(_)}else if((o=Ogt.exec(n))!==null){const g=(" "+o[0].substr(1).trim()).substr(1);e.startObject(g)}else if(zgt.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(Ugt.test(n))e.materialLibraries.push(n.substring(7).trim());else if(Fgt.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(i==="s"){if(o=n.split(" "),o.length>1){const _=o[1].trim().toLowerCase();e.object.smooth=_!=="0"&&_!=="off"}else e.object.smooth=!0;const g=e.object.currentMaterial();g&&(g.smooth=e.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}e.finalize();const l=new yE;if(l.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let u=0,h=e.objects.length;u<h;u++){const g=e.objects[u],_=g.geometry,b=g.materials,T=_.type==="Line",C=_.type==="Points";let A=!1;if(_.vertices.length===0)continue;const L=new O0;L.setAttribute("position",new bc(_.vertices,3)),_.normals.length>0&&L.setAttribute("normal",new bc(_.normals,3)),_.colors.length>0&&(A=!0,L.setAttribute("color",new bc(_.colors,3))),_.hasUVIndices===!0&&L.setAttribute("uv",new bc(_.uvs,2));const U=[];for(let Z=0,ee=b.length;Z<ee;Z++){const $=b[Z],oe=$.name+"_"+$.smooth+"_"+A;let ae=e.materials[oe];if(this.materials!==null){if(ae=this.materials.create($.name),T&&ae&&!(ae instanceof Ux)){const ce=new Ux;t5.prototype.copy.call(ce,ae),ce.color.copy(ae.color),ae=ce}else if(C&&ae&&!(ae instanceof EE)){const ce=new EE({size:10,sizeAttenuation:!1});t5.prototype.copy.call(ce,ae),ce.color.copy(ae.color),ce.map=ae.map,ae=ce}}ae===void 0&&(T?ae=new Ux:C?ae=new EE({size:1,sizeAttenuation:!1}):ae=new rN,ae.name=$.name,ae.flatShading=!$.smooth,ae.vertexColors=A,e.materials[oe]=ae),U.push(ae)}let j;if(U.length>1){for(let Z=0,ee=b.length;Z<ee;Z++){const $=b[Z];L.addGroup($.groupStart,$.groupCount,Z)}T?j=new A3(L,U):C?j=new hM(L,U):j=new Qg(L,U)}else T?j=new A3(L,U[0]):C?j=new hM(L,U[0]):j=new Qg(L,U[0]);j.name=g.name,l.add(j)}else if(e.vertices.length>0){const u=new EE({size:1,sizeAttenuation:!1}),h=new O0;h.setAttribute("position",new bc(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(h.setAttribute("color",new bc(e.colors,3)),u.vertexColors=!0);const g=new hM(h,u);l.add(g)}return l}};function Bgt({stlUrl:r,mtlUrl:e,color:t,opacity:n=1}){const i=u$(Pgt,r),a=Tt.useRef();return gt.jsxs("mesh",{ref:a,children:[gt.jsx("primitive",{object:i,attach:"geometry"}),gt.jsx("meshStandardMaterial",{color:t,transparent:n!==1,opacity:n})]})}var Hgt={name:"@tscircuit/3d-viewer",version:"0.0.144",main:"./dist/index.js",module:"./dist/index.js",type:"module",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"}},files:["dist"],scripts:{start:"bun run storybook","dev:old":"bunx --bun vite",build:"tsup ./src/index.tsx --platform neutral --format esm --dts",prepublish:"npm run build",preview:"vite preview",storybook:"storybook dev -p 6006","build-storybook":"storybook build","vercel-build":"bun run build-storybook",format:"biome format . --write","format:check":"biome format .","test:node-bundle":"node ./scripts/load-bundle-in-node.js"},dependencies:{"@jscad/regl-renderer":"^2.6.12","@jscad/stl-serializer":"^2.1.20","@react-three/drei":"^9.121.4","@react-three/fiber":"^8.17.14","@tscircuit/core":"^0.0.320","@tscircuit/props":"^0.0.153","@tscircuit/soup-util":"^0.0.41","jscad-electronics":"^0.0.25","jscad-fiber":"^0.0.77","jscad-planner":"^0.0.12",react:"^18.3.1","react-dom":"^18.3.1","react-use-gesture":"^9.1.3"},peerDependencies:{three:"*"},devDependencies:{"@biomejs/biome":"^1.9.4","@chromatic-com/storybook":"^1.9.0","@jscad/modeling":"^2.12.5","@storybook/addon-essentials":"^8.5.2","@storybook/addon-interactions":"^8.5.2","@storybook/addon-links":"^8.5.2","@storybook/addon-onboarding":"^8.5.2","@storybook/blocks":"^8.5.2","@storybook/builder-vite":"^8.5.2","@storybook/react":"^8.5.2","@storybook/react-vite":"^8.5.2","@storybook/test":"^8.5.2","@types/jsdom":"^21.1.7","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@types/three":"^0.165.0","@vitejs/plugin-react":"^4.3.4","bun-match-svg":"^0.0.9","bun-types":"^1.2.1","circuit-json":"^0.0.116","circuit-to-svg":"^0.0.91",debug:"^4.4.0",jsdom:"^26.0.0",semver:"^7.7.0",storybook:"^8.5.2","strip-ansi":"^7.1.0",tsup:"^8.3.6",typescript:"^5.7.3",vite:"^5.4.14","vite-tsconfig-paths":"^4.3.2"}};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new q2(0,0,0));function Vgt(r,e){const t=new g5().setFromEuler(new q2(r.x,r.y,r.z)),n=new Dn(0,0,1);return n.applyQuaternion(t),n.multiplyScalar(e)}var jgt=({})=>{const r=Tt.useRef();return Tt.useRef({lastRotation:new q2}),LM((e,t)=>{if(!r.current)return;const n=window.TSCI_MAIN_CAMERA_ROTATION,i=Vgt(n,2);e.camera.position.copy(i),e.camera.lookAt(0,0,0)}),gt.jsxs("mesh",{ref:r,rotation:[Math.PI/2,0,0],children:[gt.jsx("boxGeometry",{args:[1,1,1]}),gt.jsx("meshStandardMaterial",{color:"white"}),gt.jsx(IE,{position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),gt.jsx(IE,{position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),gt.jsx(IE,{position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),gt.jsx(IE,{position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),gt.jsx(IE,{position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),gt.jsx(IE,{position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"}),gt.jsx("lineSegments",{args:[new MW(new cS(1,1,1))],material:new Ux({color:0,linewidth:2})})]})},Ggt=()=>(LM(({camera:r})=>{window.TSCI_MAIN_CAMERA_ROTATION=r.rotation}),gt.jsx(gt.Fragment,{})),qgt=Tt.forwardRef(({children:r,hoveredComponent:e,initialCameraPosition:t=[5,5,5],autoRotateDisabled:n},i)=>gt.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[gt.jsx("div",{style:{position:"absolute",top:0,left:0,width:120,height:120},children:gt.jsxs(lxe,{camera:{up:[0,0,1],position:[1,1,1]},style:{zIndex:10},children:[gt.jsx("ambientLight",{intensity:Math.PI/2}),gt.jsx(jgt,{})]})}),gt.jsxs(lxe,{scene:{up:[0,0,1]},camera:{up:[0,0,1],position:t},children:[gt.jsx(Ggt,{}),gt.jsx(flt,{autoRotate:!n,autoRotateSpeed:1}),gt.jsx("ambientLight",{intensity:Math.PI/2}),gt.jsx("pointLight",{position:[-10,-10,10],decay:0,intensity:Math.PI/4}),gt.jsx(hlt,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:1,sectionSize:10}),gt.jsx("object3D",{ref:i,children:r}),e&>.jsx(sst,{position:e.mousePosition,style:{fontFamily:"sans-serif",transform:"translate3d(50%, 50%, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:e.name})]}),gt.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",Hgt.version]})]})),Ygt=r=>gt.jsx("group",{...r}),Xgt=({children:r,isHovered:e,onHover:t,position:n})=>{const i=Tt.useRef(null),a=Tt.useCallback(s=>{s.stopPropagation();try{const l=s.point||(s.intersections&&s.intersections.length>0?s.intersections[0].point:null)||(n?new Dn(...n):null);l?(i.current=l,t({mousePosition:[l.x,l.y,l.z]})):t({})}catch(l){console.warn("Hover event error:",l),t({})}},[n]),o=Tt.useCallback(s=>{s.stopPropagation(),i.current=null,t(null)},[t]);return gt.jsx(Ygt,{onPointerEnter:a,onPointerMove:a,onPointerLeave:o,children:r})},LL=Xgt;typeof window<"u"&&!window.TSCIRCUIT_OBJ_LOADER_CACHE&&(window.TSCIRCUIT_OBJ_LOADER_CACHE=new Map);function Wgt(r){const[e,t]=Tt.useState(null);return Tt.useEffect(()=>{if(!r)return;const n=window.TSCIRCUIT_OBJ_LOADER_CACHE;let i=!1;async function a(){var s;try{const c=await(await fetch(r)).text(),u=(s=c.match(/newmtl[\s\S]*?endmtl/g))==null?void 0:s.join(`
|
|
12844
12844
|
`).replace(/d 0\./g,"d 1."),h=c.replace(/newmtl[\s\S]*?endmtl/g,""),g=new Ngt;g.setMaterialOptions({invertTrProperty:!0});const _=g.parse(u.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),b=new kgt;return b.setMaterials(_),b.parse(h)}catch(l){return l}}function o(){if(n.has(r)){const l=n.get(r);return l.result?Promise.resolve(l.result.clone()):l.promise.then(c=>c.clone())}const s=a().then(l=>(l instanceof Error||n.set(r,{...n.get(r),result:l}),l));return n.set(r,{promise:s,result:null}),s}return o().then(s=>{i||t(s)}).catch(s=>{console.error(s)}),()=>{i=!0}},[r]),e}function $gt({url:r,position:e,rotation:t,onHover:n,isHovered:i}){const a=Wgt(r);return a?a instanceof Error?gt.jsx(LL,{isHovered:i,onHover:n,children:gt.jsxs("mesh",{position:e,children:[gt.jsx("boxGeometry",{args:[.5,.5,.5]}),gt.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.5}),gt.jsx("meshBasicMaterial",{color:"red"})]})}):gt.jsx(LL,{isHovered:i,onHover:n,children:gt.jsx("primitive",{rotation:t,position:e,object:a})}):gt.jsx(LL,{isHovered:i,onHover:n,children:gt.jsxs("mesh",{position:e,children:[gt.jsx("boxGeometry",{args:[.5,.5,.5]}),gt.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.25})]})})}var Zgt=t2(e8e()),c8e=({jscadPlan:r,positionOffset:e,rotationOffset:t,onHover:n,isHovered:i})=>{const{threeGeom:a,material:o}=Tt.useMemo(()=>{const s=Zxe.executeJscadOperations(Zgt.default,r),l=fct(s),c=new nN({vertexColors:!0,side:u3});return{threeGeom:l,material:c}},[r]);return Tt.useMemo(()=>{if(i){const s=new yl(o.color.getHex());o.emissive.copy(s),o.emissive.setRGB(0,0,1),o.emissiveIntensity=.2}else o.emissiveIntensity=0},[i,o]),a?gt.jsx(LL,{isHovered:i,onHover:n,position:e,children:gt.jsx("mesh",{geometry:a,material:o,position:e,rotation:t})}):null},{createJSCADRoot:Qgt}=cct(Zxe.jscadPlanner),Kgt=({positionOffset:r,footprint:e,rotationOffset:t,onHover:n,isHovered:i})=>{const a=Tt.useMemo(()=>{if(!e)return null;const o=[];return Qgt(o).render(gt.jsx(Rpt,{footprint:e})),o},[e]);return a?gt.jsx(gt.Fragment,{children:a.map((o,s)=>gt.jsx(c8e,{positionOffset:r,rotationOffset:t,jscadPlan:o,onHover:n,isHovered:i},s))}):null},Jgt=(...r)=>r,e9t=({cad_component:r,onHover:e=()=>{},isHovered:t=!1})=>{const n=r.model_obj_url??r.model_stl_url,i=r.rotation?Jgt(r.rotation.x*Math.PI/180,r.rotation.y*Math.PI/180,r.rotation.z*Math.PI/180):void 0;if(n)return gt.jsx($gt,{url:n,position:r.position?[r.position.x,r.position.y,r.position.z]:void 0,rotation:i,onHover:e,isHovered:t},r.cad_component_id);if(r.model_jscad)return gt.jsx(c8e,{jscadPlan:r.model_jscad,rotationOffset:i,onHover:e,isHovered:t},r.cad_component_id);if(r.footprinter_string)return gt.jsx(Kgt,{positionOffset:r.position?[r.position.x,r.position.y,r.position.z]:void 0,rotationOffset:i,footprint:r.footprinter_string,onHover:e,isHovered:t})},t9t=class extends D0.Component{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}render(){return this.state.hasError&&this.state.error?this.props.fallback({error:this.state.error}):this.props.children}},n9t=({error:r,cad_component:e})=>{let t=[0,0,0];return e!=null&&e.position&&(t=[e.position.x,e.position.y,e.position.z],t=t.map(n=>Number.isNaN(n)?0:n)),gt.jsxs("group",{position:t,children:[gt.jsxs("mesh",{renderOrder:-99999,rotation:[Math.PI/4,Math.PI/4,0],ref:n=>{n&&(n.renderOrder=999999)},children:[gt.jsx("boxGeometry",{args:[.5,.5,.5]}),gt.jsx("meshStandardMaterial",{depthTest:!1,transparent:!0,color:"red",opacity:.5})]}),gt.jsxs(IE,{scale:[.1,.1,.1],color:"red",anchorX:"center",anchorY:"middle",depthOffset:-99999,children:[r.toString().slice(0,50),"..."]})]})},r9t=Tt.forwardRef(({soup:r,circuitJson:e,children:t,autoRotateDisabled:n},i)=>{e??(e=r);const[a,o]=Tt.useState(null);e??(e=_gt(t));const s=Tt.useMemo(()=>{if(!e)return[5,5,5];try{const g=Qy(e).pcb_board.list()[0];if(!g)return[5,5,5];const{width:_,height:b}=g,T=Math.max(_,b);return[T/2,T/2,T]}catch(g){return console.error(g),[5,5,5]}},[e]),l=Tt.useMemo(()=>!e||!e.some(g=>g.type==="pcb_board")?null:Cgt(e),[e]),{stls:c,loading:u}=Agt(l);if(!e)return null;const h=Qy(e).cad_component.list();return gt.jsxs(qgt,{ref:i,hoveredComponent:a,autoRotateDisabled:n,initialCameraPosition:s,children:[c.map(({stlUrl:g,color:_},b)=>gt.jsx(Bgt,{stlUrl:g,color:_,opacity:b===0?.95:1},g)),h.map(g=>gt.jsx(t9t,{fallback:({error:_})=>gt.jsx(n9t,{cad_component:g,error:_}),children:gt.jsx(e9t,{onHover:_=>{var T;if(_||o(null),!_.mousePosition)return;const b=(T=Qy(e).source_component.getUsing({source_component_id:g.source_component_id}))==null?void 0:T.name;o({cad_component_id:g.cad_component_id,name:b??"<unknown>",mousePosition:_.mousePosition})},cad_component:g,isHovered:(a==null?void 0:a.cad_component_id)===g.cad_component_id},g.cad_component_id)},g.cad_component_id))]})}),i9t=t2(ggt());t2(e8e()),(0,i9t.default)("tscircuit:3d-viewer:convert-circuit-json-to-3d-svg");const U7=r=>typeof r=="number"&&!isNaN(r),KE=r=>typeof r=="string",m3=r=>typeof r=="function",OL=r=>KE(r)||m3(r)?r:null,JQ=r=>Tt.isValidElement(r)||KE(r)||m3(r)||U7(r);function a9t(r,e,t){t===void 0&&(t=300);const{scrollHeight:n,style:i}=r;requestAnimationFrame(()=>{i.minHeight="initial",i.height=n+"px",i.transition=`all ${t}ms`,requestAnimationFrame(()=>{i.height="0",i.padding="0",i.margin="0",setTimeout(e,t)})})}function UL(r){let{enter:e,exit:t,appendPosition:n=!1,collapse:i=!0,collapseDuration:a=300}=r;return function(o){let{children:s,position:l,preventExitTransition:c,done:u,nodeRef:h,isIn:g,playToast:_}=o;const b=n?`${e}--${l}`:e,T=n?`${t}--${l}`:t,C=Tt.useRef(0);return Tt.useLayoutEffect(()=>{const A=h.current,L=b.split(" "),U=j=>{j.target===h.current&&(_(),A.removeEventListener("animationend",U),A.removeEventListener("animationcancel",U),C.current===0&&j.type!=="animationcancel"&&A.classList.remove(...L))};A.classList.add(...L),A.addEventListener("animationend",U),A.addEventListener("animationcancel",U)},[]),Tt.useEffect(()=>{const A=h.current,L=()=>{A.removeEventListener("animationend",L),i?a9t(A,u,a):u()};g||(c?L():(C.current=1,A.className+=` ${T}`,A.addEventListener("animationend",L)))},[g]),D0.createElement(D0.Fragment,null,s)}}function u8e(r,e){return r!=null?{content:r.content,containerId:r.props.containerId,id:r.props.toastId,theme:r.props.theme,type:r.props.type,data:r.props.data||{},isLoading:r.props.isLoading,icon:r.props.icon,status:e}:{}}const w2=new Map;let z7=[];const eK=new Set,o9t=r=>eK.forEach(e=>e(r)),f8e=()=>w2.size>0;function d8e(r,e){var t;if(e)return!((t=w2.get(e))==null||!t.isToastActive(r));let n=!1;return w2.forEach(i=>{i.isToastActive(r)&&(n=!0)}),n}function h8e(r,e){JQ(r)&&(f8e()||z7.push({content:r,options:e}),w2.forEach(t=>{t.buildToast(r,e)}))}function p8e(r,e){w2.forEach(t=>{e!=null&&e!=null&&e.containerId?(e==null?void 0:e.containerId)===t.id&&t.toggle(r,e==null?void 0:e.id):t.toggle(r,e==null?void 0:e.id)})}function s9t(r){const{subscribe:e,getSnapshot:t,setProps:n}=Tt.useRef(function(a){const o=a.containerId||1;return{subscribe(s){const l=function(u,h,g){let _=1,b=0,T=[],C=[],A=[],L=h;const U=new Map,j=new Set,Z=()=>{A=Array.from(U.values()),j.forEach(oe=>oe())},ee=oe=>{C=oe==null?[]:C.filter(ae=>ae!==oe),Z()},$=oe=>{const{toastId:ae,onOpen:ce,updateId:me,children:_e}=oe.props,Se=me==null;oe.staleId&&U.delete(oe.staleId),U.set(ae,oe),C=[...C,oe.props.toastId].filter(Ae=>Ae!==oe.staleId),Z(),g(u8e(oe,Se?"added":"updated")),Se&&m3(ce)&&ce(Tt.isValidElement(_e)&&_e.props)};return{id:u,props:L,observe:oe=>(j.add(oe),()=>j.delete(oe)),toggle:(oe,ae)=>{U.forEach(ce=>{ae!=null&&ae!==ce.props.toastId||m3(ce.toggle)&&ce.toggle(oe)})},removeToast:ee,toasts:U,clearQueue:()=>{b-=T.length,T=[]},buildToast:(oe,ae)=>{if((Fe=>{let{containerId:it,toastId:ct,updateId:ft}=Fe;const Nt=it?it!==u:u!==1,Rt=U.has(ct)&&ft==null;return Nt||Rt})(ae))return;const{toastId:ce,updateId:me,data:_e,staleId:Se,delay:Ae}=ae,ze=()=>{ee(ce)},Ne=me==null;Ne&&b++;const Oe={...L,style:L.toastStyle,key:_++,...Object.fromEntries(Object.entries(ae).filter(Fe=>{let[it,ct]=Fe;return ct!=null})),toastId:ce,updateId:me,data:_e,closeToast:ze,isIn:!1,className:OL(ae.className||L.toastClassName),bodyClassName:OL(ae.bodyClassName||L.bodyClassName),progressClassName:OL(ae.progressClassName||L.progressClassName),autoClose:!ae.isLoading&&(Le=ae.autoClose,Ie=L.autoClose,Le===!1||U7(Le)&&Le>0?Le:Ie),deleteToast(){const Fe=U.get(ce),{onClose:it,children:ct}=Fe.props;m3(it)&&it(Tt.isValidElement(ct)&&ct.props),g(u8e(Fe,"removed")),U.delete(ce),b--,b<0&&(b=0),T.length>0?$(T.shift()):Z()}};var Le,Ie;Oe.closeButton=L.closeButton,ae.closeButton===!1||JQ(ae.closeButton)?Oe.closeButton=ae.closeButton:ae.closeButton===!0&&(Oe.closeButton=!JQ(L.closeButton)||L.closeButton);let je=oe;Tt.isValidElement(oe)&&!KE(oe.type)?je=Tt.cloneElement(oe,{closeToast:ze,toastProps:Oe,data:_e}):m3(oe)&&(je=oe({closeToast:ze,toastProps:Oe,data:_e}));const Ue={content:je,props:Oe,staleId:Se};L.limit&&L.limit>0&&b>L.limit&&Ne?T.push(Ue):U7(Ae)?setTimeout(()=>{$(Ue)},Ae):$(Ue)},setProps(oe){L=oe},setToggle:(oe,ae)=>{U.get(oe).toggle=ae},isToastActive:oe=>C.some(ae=>ae===oe),getSnapshot:()=>A}}(o,a,o9t);w2.set(o,l);const c=l.observe(s);return z7.forEach(u=>h8e(u.content,u.options)),z7=[],()=>{c(),w2.delete(o)}},setProps(s){var l;(l=w2.get(o))==null||l.setProps(s)},getSnapshot(){var s;return(s=w2.get(o))==null?void 0:s.getSnapshot()}}}(r)).current;n(r);const i=Tt.useSyncExternalStore(e,t,t);return{getToastToRender:function(a){if(!i)return[];const o=new Map;return r.newestOnTop&&i.reverse(),i.forEach(s=>{const{position:l}=s.props;o.has(l)||o.set(l,[]),o.get(l).push(s)}),Array.from(o,s=>a(s[0],s[1]))},isToastActive:d8e,count:i==null?void 0:i.length}}function l9t(r){const[e,t]=Tt.useState(!1),[n,i]=Tt.useState(!1),a=Tt.useRef(null),o=Tt.useRef({start:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,didMove:!1}).current,{autoClose:s,pauseOnHover:l,closeToast:c,onClick:u,closeOnClick:h}=r;var g,_;function b(){t(!0)}function T(){t(!1)}function C(U){const j=a.current;o.canDrag&&j&&(o.didMove=!0,e&&T(),o.delta=r.draggableDirection==="x"?U.clientX-o.start:U.clientY-o.start,o.start!==U.clientX&&(o.canCloseOnClick=!1),j.style.transform=`translate3d(${r.draggableDirection==="x"?`${o.delta}px, var(--y)`:`0, calc(${o.delta}px + var(--y))`},0)`,j.style.opacity=""+(1-Math.abs(o.delta/o.removalDistance)))}function A(){document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",A);const U=a.current;if(o.canDrag&&o.didMove&&U){if(o.canDrag=!1,Math.abs(o.delta)>o.removalDistance)return i(!0),r.closeToast(),void r.collapseAll();U.style.transition="transform 0.2s, opacity 0.2s",U.style.removeProperty("transform"),U.style.removeProperty("opacity")}}(_=w2.get((g={id:r.toastId,containerId:r.containerId,fn:t}).containerId||1))==null||_.setToggle(g.id,g.fn),Tt.useEffect(()=>{if(r.pauseOnFocusLoss)return document.hasFocus()||T(),window.addEventListener("focus",b),window.addEventListener("blur",T),()=>{window.removeEventListener("focus",b),window.removeEventListener("blur",T)}},[r.pauseOnFocusLoss]);const L={onPointerDown:function(U){if(r.draggable===!0||r.draggable===U.pointerType){o.didMove=!1,document.addEventListener("pointermove",C),document.addEventListener("pointerup",A);const j=a.current;o.canCloseOnClick=!0,o.canDrag=!0,j.style.transition="none",r.draggableDirection==="x"?(o.start=U.clientX,o.removalDistance=j.offsetWidth*(r.draggablePercent/100)):(o.start=U.clientY,o.removalDistance=j.offsetHeight*(r.draggablePercent===80?1.5*r.draggablePercent:r.draggablePercent)/100)}},onPointerUp:function(U){const{top:j,bottom:Z,left:ee,right:$}=a.current.getBoundingClientRect();U.nativeEvent.type!=="touchend"&&r.pauseOnHover&&U.clientX>=ee&&U.clientX<=$&&U.clientY>=j&&U.clientY<=Z?T():b()}};return s&&l&&(L.onMouseEnter=T,r.stacked||(L.onMouseLeave=b)),h&&(L.onClick=U=>{u&&u(U),o.canCloseOnClick&&c()}),{playToast:b,pauseToast:T,isRunning:e,preventExitTransition:n,toastRef:a,eventHandlers:L}}function c9t(r){let{delay:e,isRunning:t,closeToast:n,type:i="default",hide:a,className:o,style:s,controlledProgress:l,progress:c,rtl:u,isIn:h,theme:g}=r;const _=a||l&&c===0,b={...s,animationDuration:`${e}ms`,animationPlayState:t?"running":"paused"};l&&(b.transform=`scaleX(${c})`);const T=xb("Toastify__progress-bar",l?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${g}`,`Toastify__progress-bar--${i}`,{"Toastify__progress-bar--rtl":u}),C=m3(o)?o({rtl:u,type:i,defaultClassName:T}):xb(T,o),A={[l&&c>=1?"onTransitionEnd":"onAnimationEnd"]:l&&c<1?null:()=>{h&&n()}};return D0.createElement("div",{className:"Toastify__progress-bar--wrp","data-hidden":_},D0.createElement("div",{className:`Toastify__progress-bar--bg Toastify__progress-bar-theme--${g} Toastify__progress-bar--${i}`}),D0.createElement("div",{role:"progressbar","aria-hidden":_?"true":"false","aria-label":"notification timer",className:C,style:b,...A}))}let u9t=1;const m8e=()=>""+u9t++;function f9t(r){return r&&(KE(r.toastId)||U7(r.toastId))?r.toastId:m8e()}function F7(r,e){return h8e(r,e),e.toastId}function zL(r,e){return{...e,type:e&&e.type||r,toastId:f9t(e)}}function FL(r){return(e,t)=>F7(e,zL(r,t))}function Dy(r,e){return F7(r,zL("default",e))}Dy.loading=(r,e)=>F7(r,zL("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e})),Dy.promise=function(r,e,t){let n,{pending:i,error:a,success:o}=e;i&&(n=KE(i)?Dy.loading(i,t):Dy.loading(i.render,{...t,...i}));const s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(u,h,g)=>{if(h==null)return void Dy.dismiss(n);const _={type:u,...s,...t,data:g},b=KE(h)?{render:h}:h;return n?Dy.update(n,{..._,...b}):Dy(b.render,{..._,...b}),g},c=m3(r)?r():r;return c.then(u=>l("success",o,u)).catch(u=>l("error",a,u)),c},Dy.success=FL("success"),Dy.info=FL("info"),Dy.error=FL("error"),Dy.warning=FL("warning"),Dy.warn=Dy.warning,Dy.dark=(r,e)=>F7(r,zL("default",{theme:"dark",...e})),Dy.dismiss=function(r){(function(e){var t;if(f8e()){if(e==null||KE(t=e)||U7(t))w2.forEach(n=>{n.removeToast(e)});else if(e&&("containerId"in e||"id"in e)){const n=w2.get(e.containerId);n?n.removeToast(e.id):w2.forEach(i=>{i.removeToast(e.id)})}}else z7=z7.filter(n=>e!=null&&n.options.toastId!==e)})(r)},Dy.clearWaitingQueue=function(r){r===void 0&&(r={}),w2.forEach(e=>{!e.props.limit||r.containerId&&e.id!==r.containerId||e.clearQueue()})},Dy.isActive=d8e,Dy.update=function(r,e){e===void 0&&(e={});const t=((n,i)=>{var a;let{containerId:o}=i;return(a=w2.get(o||1))==null?void 0:a.toasts.get(n)})(r,e);if(t){const{props:n,content:i}=t,a={delay:100,...n,...e,toastId:e.toastId||r,updateId:m8e()};a.toastId!==r&&(a.staleId=r);const o=a.render||i;delete a.render,F7(o,a)}},Dy.done=r=>{Dy.update(r,{progress:1})},Dy.onChange=function(r){return eK.add(r),()=>{eK.delete(r)}},Dy.play=r=>p8e(!0,r),Dy.pause=r=>p8e(!1,r);const d9t=typeof window<"u"?Tt.useLayoutEffect:Tt.useEffect,IL=r=>{let{theme:e,type:t,isLoading:n,...i}=r;return D0.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:e==="colored"?"currentColor":`var(--toastify-icon-color-${t})`,...i})},tK={info:function(r){return D0.createElement(IL,{...r},D0.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(r){return D0.createElement(IL,{...r},D0.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(r){return D0.createElement(IL,{...r},D0.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(r){return D0.createElement(IL,{...r},D0.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return D0.createElement("div",{className:"Toastify__spinner"})}},h9t=r=>{const{isRunning:e,preventExitTransition:t,toastRef:n,eventHandlers:i,playToast:a}=l9t(r),{closeButton:o,children:s,autoClose:l,onClick:c,type:u,hideProgressBar:h,closeToast:g,transition:_,position:b,className:T,style:C,bodyClassName:A,bodyStyle:L,progressClassName:U,progressStyle:j,updateId:Z,role:ee,progress:$,rtl:oe,toastId:ae,deleteToast:ce,isIn:me,isLoading:_e,closeOnClick:Se,theme:Ae}=r,ze=xb("Toastify__toast",`Toastify__toast-theme--${Ae}`,`Toastify__toast--${u}`,{"Toastify__toast--rtl":oe},{"Toastify__toast--close-on-click":Se}),Ne=m3(T)?T({rtl:oe,position:b,type:u,defaultClassName:ze}):xb(ze,T),Oe=function(Ue){let{theme:Fe,type:it,isLoading:ct,icon:ft}=Ue,Nt=null;const Rt={theme:Fe,type:it};return ft===!1||(m3(ft)?Nt=ft({...Rt,isLoading:ct}):Tt.isValidElement(ft)?Nt=Tt.cloneElement(ft,Rt):ct?Nt=tK.spinner():(Wt=>Wt in tK)(it)&&(Nt=tK[it](Rt))),Nt}(r),Le=!!$||!l,Ie={closeToast:g,type:u,theme:Ae};let je=null;return o===!1||(je=m3(o)?o(Ie):Tt.isValidElement(o)?Tt.cloneElement(o,Ie):function(Ue){let{closeToast:Fe,theme:it,ariaLabel:ct="close"}=Ue;return D0.createElement("button",{className:`Toastify__close-button Toastify__close-button--${it}`,type:"button",onClick:ft=>{ft.stopPropagation(),Fe(ft)},"aria-label":ct},D0.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},D0.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}(Ie)),D0.createElement(_,{isIn:me,done:ce,position:b,preventExitTransition:t,nodeRef:n,playToast:a},D0.createElement("div",{id:ae,onClick:c,"data-in":me,className:Ne,...i,style:C,ref:n},D0.createElement("div",{...me&&{role:ee},className:m3(A)?A({type:u}):xb("Toastify__toast-body",A),style:L},Oe!=null&&D0.createElement("div",{className:xb("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!_e})},Oe),D0.createElement("div",null,s)),je,D0.createElement(c9t,{...Z&&!Le?{key:`pb-${Z}`}:{},rtl:oe,theme:Ae,delay:l,isRunning:e,isIn:me,closeToast:g,hide:h,type:u,style:j,className:U,controlledProgress:Le,progress:$||0})))},kL=function(r,e){return e===void 0&&(e=!1),{enter:`Toastify--animate Toastify__${r}-enter`,exit:`Toastify--animate Toastify__${r}-exit`,appendPosition:e}},p9t=UL(kL("bounce",!0));UL(kL("slide",!0)),UL(kL("zoom")),UL(kL("flip"));const m9t={position:"top-right",transition:p9t,autoClose:5e3,closeButton:!0,pauseOnHover:!0,pauseOnFocusLoss:!0,draggable:"touch",draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};function v9t(r){let e={...m9t,...r};const t=r.stacked,[n,i]=Tt.useState(!0),a=Tt.useRef(null),{getToastToRender:o,isToastActive:s,count:l}=s9t(e),{className:c,style:u,rtl:h,containerId:g}=e;function _(T){const C=xb("Toastify__toast-container",`Toastify__toast-container--${T}`,{"Toastify__toast-container--rtl":h});return m3(c)?c({position:T,rtl:h,defaultClassName:C}):xb(C,OL(c))}function b(){t&&(i(!0),Dy.play())}return d9t(()=>{if(t){var T;const C=a.current.querySelectorAll('[data-in="true"]'),A=12,L=(T=e.position)==null?void 0:T.includes("top");let U=0,j=0;Array.from(C).reverse().forEach((Z,ee)=>{const $=Z;$.classList.add("Toastify__toast--stacked"),ee>0&&($.dataset.collapsed=`${n}`),$.dataset.pos||($.dataset.pos=L?"top":"bot");const oe=U*(n?.2:1)+(n?0:A*ee);$.style.setProperty("--y",`${L?oe:-1*oe}px`),$.style.setProperty("--g",`${A}`),$.style.setProperty("--s",""+(1-(n?j:0))),U+=$.offsetHeight,j+=.025})}},[n,l,t]),D0.createElement("div",{ref:a,className:"Toastify",id:g,onMouseEnter:()=>{t&&(i(!1),Dy.pause())},onMouseLeave:b},o((T,C)=>{const A=C.length?{...u}:{...u,pointerEvents:"none"};return D0.createElement("div",{className:_(T),style:A,key:`container-${T}`},C.map(L=>{let{content:U,props:j}=L;return D0.createElement(h9t,{...j,stacked:t,collapseAll:b,isIn:s(j.toastId,j.containerId),style:j.style,key:`toast-${j.key}`},U)}))}))}function y9t(){var r=':root{--toastify-color-light:#fff;--toastify-color-dark:#121212;--toastify-color-info:#3498db;--toastify-color-success:#07bc0c;--toastify-color-warning:#f1c40f;--toastify-color-error:#e74c3c;--toastify-color-transparent:hsla(0,0%,100%,.7);--toastify-icon-color-info:var(--toastify-color-info);--toastify-icon-color-success:var(--toastify-color-success);--toastify-icon-color-warning:var(--toastify-color-warning);--toastify-icon-color-error:var(--toastify-color-error);--toastify-toast-width:320px;--toastify-toast-offset:16px;--toastify-toast-top:max(var(--toastify-toast-offset),env(safe-area-inset-top));--toastify-toast-right:max(var(--toastify-toast-offset),env(safe-area-inset-right));--toastify-toast-left:max(var(--toastify-toast-offset),env(safe-area-inset-left));--toastify-toast-bottom:max(var(--toastify-toast-offset),env(safe-area-inset-bottom));--toastify-toast-background:#fff;--toastify-toast-min-height:64px;--toastify-toast-max-height:800px;--toastify-toast-bd-radius:6px;--toastify-font-family:sans-serif;--toastify-z-index:9999;--toastify-text-color-light:#757575;--toastify-text-color-dark:#fff;--toastify-text-color-info:#fff;--toastify-text-color-success:#fff;--toastify-text-color-warning:#fff;--toastify-text-color-error:#fff;--toastify-spinner-color:#616161;--toastify-spinner-color-empty-area:#e0e0e0;--toastify-color-progress-light:linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55);--toastify-color-progress-dark:#bb86fc;--toastify-color-progress-info:var(--toastify-color-info);--toastify-color-progress-success:var(--toastify-color-success);--toastify-color-progress-warning:var(--toastify-color-warning);--toastify-color-progress-error:var(--toastify-color-error);--toastify-color-progress-bgo:0.2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translateZ(var(--toastify-z-index));position:fixed;padding:4px;width:var(--toastify-toast-width);box-sizing:border-box;color:#fff}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translateX(-50%)}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right)}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translateX(-50%)}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right)}@media only screen and (max-width:480px){.Toastify__toast-container{width:100vw;padding:0;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-center,.Toastify__toast-container--top-left,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translateX(0)}.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translateX(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:auto}}.Toastify__toast{--y:0;position:relative;-ms-touch-action:none;touch-action:none;min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:8px;border-radius:var(--toastify-toast-bd-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);cursor:default;direction:ltr;z-index:0;overflow:hidden}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__close-button,.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-body{margin:auto 0;-ms-flex:1 1 auto;flex:1 1 auto;padding:6px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.Toastify__toast-body>div:last-child{word-break:break-word;-ms-flex:1;flex:1}.Toastify__toast-icon{-webkit-margin-end:10px;margin-inline-end:10px;width:20px;-ms-flex-negative:0;flex-shrink:0;display:-ms-flexbox;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}@media only screen and (max-width:480px){.Toastify__toast{margin-bottom:0;border-radius:0}}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--colored.Toastify__toast--default,.Toastify__toast-theme--light{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;-ms-flex-item-align:start;align-self:flex-start;z-index:1}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:focus,.Toastify__close-button:hover{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:var(--toastify-z-index);opacity:.7;transform-origin:left;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:auto;transform-origin:right;border-bottom-left-radius:0;border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp{position:absolute;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--bottom-left,.Toastify__bounce-enter--top-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--bottom-right,.Toastify__bounce-enter--top-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--bottom-left,.Toastify__bounce-exit--top-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--bottom-right,.Toastify__bounce-exit--top-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--bottom-left,.Toastify__slide-enter--top-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--bottom-right,.Toastify__slide-enter--top-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--bottom-left,.Toastify__slide-exit--top-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-right,.Toastify__slide-exit--top-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}',e=document.createElement("style");e.innerText=r,document.head.appendChild(e)}const v8e=p8(AIe);var nK,y8e;function g9t(){if(y8e)return nK;y8e=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,i=(C,A)=>{for(var L in A)r(C,L,{get:A[L],enumerable:!0})},a=(C,A,L,U)=>{if(A&&typeof A=="object"||typeof A=="function")for(let j of t(A))!n.call(C,j)&&j!==L&&r(C,j,{get:()=>A[j],enumerable:!(U=e(A,j))||U.enumerable});return C},o=C=>a(r({},"__esModule",{value:!0}),C),s={};i(s,{SuperGrid:()=>T,toMMSI:()=>b,toMeterSI:()=>_}),nK=o(s);var l=Mx(),c=v8e,u=one(),h=(C,A,L)=>{const U=[];if(A<C)for(let j=C;j>=A;j-=Math.abs(L))U.push(j);else for(let j=C;j<=A;j+=Math.abs(L))U.push(j);return U};function g(C,A){return{x:Math.round(A.x/C)*C,y:Math.round(A.y/C)*C}}function _(C,A=1){return C<0?"-"+_(-C):C<1e-6?"0m":C>1e3?Math.floor(C/1e3)+"km":C>1&&A>1?Math.round(C)+"m":C>1&&A<=1?C.toFixed(Math.ceil(-Math.log10(A)))+"m":C<1&&A>=1/1e3?Math.round(C*1e3)+"mm":C<1&&A<1/1e3?(C*1e3).toFixed(Math.ceil(-Math.log10(A*1e3)))+"mm":""}function b(C,A=1){return _(C/1e3,A/1e3)}var T=C=>{var A;const L=(0,l.useRef)(null),[U,j]=(0,l.useState)({x:0,y:0}),{majorColor:Z="rgba(0,0,0,0.2)",minorColor:ee="rgba(0,0,0,0.1)",textColor:$=(A=C.majorColor)!=null?A:"rgba(0,0,0,0.5)",width:oe,height:ae,screenSpaceCellSize:ce=200,stringifyCoord:me=(ze,Ne,Oe)=>`${_(ze,Oe)}, ${_(Ne,Oe)}`}=C,_e=Math.ceil(oe/ce)+2,Se=Math.ceil(ae/ce)+2;(0,l.useEffect)(()=>{if(!L.current)return;const ze=L.current.getContext("2d");if(!ze)return;const Ne=ce/10**Math.floor(Math.log10(C.transform.a)),Oe=C.transform.d<0?-1:1,Ie=ce/10**Math.log10(C.transform.a)/Ne;function je(Gn,Sn,hn){const _n=Gn;let Gt,sr,Jn;for(Gt=Sn.x;Gt<=hn.x;Gt+=_n)sr=(0,c.applyToPoint)(C.transform,{x:Gt,y:Sn.y}),Jn=(0,c.applyToPoint)(C.transform,{x:Gt,y:hn.y}),ze.beginPath(),ze.moveTo(sr.x,sr.y),ze.lineTo(Jn.x,Jn.y),ze.stroke();const an=h(Sn.y,hn.y,_n*Oe);for(const nr of an)sr=(0,c.applyToPoint)(C.transform,{x:Sn.x,y:nr}),Jn=(0,c.applyToPoint)(C.transform,{x:hn.x,y:nr}),ze.beginPath(),ze.moveTo(sr.x,sr.y),ze.lineTo(Jn.x,Jn.y),ze.stroke()}function Ue(Gn,Sn,hn){const _n=Gn;let Gt;for(Gt=Sn.x;Gt<=hn.x;Gt+=_n)for(const sr of h(Sn.y,hn.y,_n*Oe)){const Jn=(0,c.applyToPoint)(C.transform,{x:Gt,y:sr});ze.fillStyle=$,ze.font="12px sans-serif",ze.fillText(me(Gt,sr,Gn),Jn.x+2,Jn.y-2)}}ze.clearRect(0,0,oe,ae);const Fe=(0,c.applyToPoint)((0,c.inverse)(C.transform),{x:0,y:0}),it={x:Math.floor((Fe.x-Ne)/Ne)*Ne,y:Math.floor((Fe.y-Ne)/Ne+(Oe==-1?2:0))*Ne},ct={x:it.x+Ne*_e,y:it.y+Ne*Se*Oe},Nt=Ne*5,Rt={x:Math.floor((Fe.x-Nt)/Nt)*Nt,y:Math.floor((Fe.y-Nt)/Nt+(Oe==-1?2:0))*Nt},Wt={x:Rt.x+Nt*_e,y:Rt.y+Nt*Se*Oe};ze.globalAlpha=1,ze.strokeStyle=Z,je(Ne,it,ct),Ue(Nt,Rt,Wt),ze.globalAlpha=1-Ie,je(Nt/10,Rt,Wt),ze.globalAlpha=1-Ie,ze.strokeStyle=ee,je(Ne/10,it,ct),ze.globalAlpha=Math.max(((1-Ie)*10-5)/5,0),Ue(Nt/10,Rt,Wt),ze.globalAlpha=1;const en=(0,c.applyToPoint)(C.transform,U);ze.font="12px sans-serif",ze.fillStyle=$,ze.fillText(me(U.x,U.y,Ne),en.x+2,en.y-2),ze.strokeStyle=Z,ze.strokeRect(en.x-5,en.y-5,10,10)},[L,C.transform,U,oe,ae]);const Ae=ze=>{if(!L.current)return;const Ne=ce/10/10**Math.floor(Math.log10(C.transform.a)),Oe=L.current.getBoundingClientRect(),Le=(0,c.applyToPoint)((0,c.inverse)(C.transform),{x:ze.clientX-Oe.left,y:ze.clientY-Oe.top}),Ie=g(Ne,Le);j(Ie)};return(0,u.jsx)("canvas",{onMouseUp:ze=>{ze.button===1&&Ae(ze)},onDoubleClick:Ae,ref:L,width:C.width,height:C.height})};return nK}var rK=g9t();function _9t(r,e,t){const n=(t.x-e.x)**2+(t.y-e.y)**2;if(n===0)return g8e(r,e);let i=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/n;i=Math.max(0,Math.min(1,i));const a={x:e.x+i*(t.x-e.x),y:e.y+i*(t.y-e.y)};return g8e(r,a)}function g8e(r,e){const t=r.x-e.x,n=r.y-e.y;return Math.sqrt(t*t+n*n)}var x9t=!1;function b9t(r){if(r.sheet)return r.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===r)return document.styleSheets[e]}function S9t(r){var e=document.createElement("style");return e.setAttribute("data-emotion",r.key),r.nonce!==void 0&&e.setAttribute("nonce",r.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var E9t=function(){function r(t){var n=this;this._insertTag=function(i){var a;n.tags.length===0?n.insertionPoint?a=n.insertionPoint.nextSibling:n.prepend?a=n.container.firstChild:a=n.before:a=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,a),n.tags.push(i)},this.isSpeedy=t.speedy===void 0?!x9t:t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.prepend=t.prepend,this.insertionPoint=t.insertionPoint,this.before=null}var e=r.prototype;return e.hydrate=function(n){n.forEach(this._insertTag)},e.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(S9t(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=b9t(i);try{a.insertRule(n,a.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(n));this.ctr++},e.flush=function(){this.tags.forEach(function(n){var i;return(i=n.parentNode)==null?void 0:i.removeChild(n)}),this.tags=[],this.ctr=0},r}(),r2="-ms-",BL="-moz-",x1="-webkit-",_8e="comm",iK="rule",aK="decl",w9t="@import",x8e="@keyframes",T9t="@layer",M9t=Math.abs,HL=String.fromCharCode,C9t=Object.assign;function R9t(r,e){return C5(r,0)^45?(((e<<2^C5(r,0))<<2^C5(r,1))<<2^C5(r,2))<<2^C5(r,3):0}function b8e(r){return r.trim()}function A9t(r,e){return(r=e.exec(r))?r[0]:r}function b1(r,e,t){return r.replace(e,t)}function oK(r,e){return r.indexOf(e)}function C5(r,e){return r.charCodeAt(e)|0}function I7(r,e,t){return r.slice(e,t)}function Gb(r){return r.length}function sK(r){return r.length}function VL(r,e){return e.push(r),r}function D9t(r,e){return r.map(e).join("")}var jL=1,K6=1,S8e=0,K2=0,J_=0,J6="";function GL(r,e,t,n,i,a,o){return{value:r,root:e,parent:t,type:n,props:i,children:a,line:jL,column:K6,length:o,return:""}}function k7(r,e){return C9t(GL("",null,null,"",null,null,0),r,{length:-r.length},e)}function P9t(){return J_}function N9t(){return J_=K2>0?C5(J6,--K2):0,K6--,J_===10&&(K6=1,jL--),J_}function v3(){return J_=K2<S8e?C5(J6,K2++):0,K6++,J_===10&&(K6=1,jL++),J_}function qb(){return C5(J6,K2)}function qL(){return K2}function B7(r,e){return I7(J6,r,e)}function H7(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function E8e(r){return jL=K6=1,S8e=Gb(J6=r),K2=0,[]}function w8e(r){return J6="",r}function YL(r){return b8e(B7(K2-1,lK(r===91?r+2:r===40?r+1:r)))}function L9t(r){for(;(J_=qb())&&J_<33;)v3();return H7(r)>2||H7(J_)>3?"":" "}function O9t(r,e){for(;--e&&v3()&&!(J_<48||J_>102||J_>57&&J_<65||J_>70&&J_<97););return B7(r,qL()+(e<6&&qb()==32&&v3()==32))}function lK(r){for(;v3();)switch(J_){case r:return K2;case 34:case 39:r!==34&&r!==39&&lK(J_);break;case 40:r===41&&lK(r);break;case 92:v3();break}return K2}function U9t(r,e){for(;v3()&&r+J_!==57;)if(r+J_===84&&qb()===47)break;return"/*"+B7(e,K2-1)+"*"+HL(r===47?r:v3())}function z9t(r){for(;!H7(qb());)v3();return B7(r,K2)}function F9t(r){return w8e(XL("",null,null,null,[""],r=E8e(r),0,[0],r))}function XL(r,e,t,n,i,a,o,s,l){for(var c=0,u=0,h=o,g=0,_=0,b=0,T=1,C=1,A=1,L=0,U="",j=i,Z=a,ee=n,$=U;C;)switch(b=L,L=v3()){case 40:if(b!=108&&C5($,h-1)==58){oK($+=b1(YL(L),"&","&\f"),"&\f")!=-1&&(A=-1);break}case 34:case 39:case 91:$+=YL(L);break;case 9:case 10:case 13:case 32:$+=L9t(b);break;case 92:$+=O9t(qL()-1,7);continue;case 47:switch(qb()){case 42:case 47:VL(I9t(U9t(v3(),qL()),e,t),l);break;default:$+="/"}break;case 123*T:s[c++]=Gb($)*A;case 125*T:case 59:case 0:switch(L){case 0:case 125:C=0;case 59+u:A==-1&&($=b1($,/\f/g,"")),_>0&&Gb($)-h&&VL(_>32?M8e($+";",n,t,h-1):M8e(b1($," ","")+";",n,t,h-2),l);break;case 59:$+=";";default:if(VL(ee=T8e($,e,t,c,u,i,s,U,j=[],Z=[],h),a),L===123)if(u===0)XL($,e,ee,ee,j,a,h,s,Z);else switch(g===99&&C5($,3)===110?100:g){case 100:case 108:case 109:case 115:XL(r,ee,ee,n&&VL(T8e(r,ee,ee,0,0,i,s,U,i,j=[],h),Z),i,Z,h,s,n?j:Z);break;default:XL($,ee,ee,ee,[""],Z,0,s,Z)}}c=u=_=0,T=A=1,U=$="",h=o;break;case 58:h=1+Gb($),_=b;default:if(T<1){if(L==123)--T;else if(L==125&&T++==0&&N9t()==125)continue}switch($+=HL(L),L*T){case 38:A=u>0?1:($+="\f",-1);break;case 44:s[c++]=(Gb($)-1)*A,A=1;break;case 64:qb()===45&&($+=YL(v3())),g=qb(),u=h=Gb(U=$+=z9t(qL())),L++;break;case 45:b===45&&Gb($)==2&&(T=0)}}return a}function T8e(r,e,t,n,i,a,o,s,l,c,u){for(var h=i-1,g=i===0?a:[""],_=sK(g),b=0,T=0,C=0;b<n;++b)for(var A=0,L=I7(r,h+1,h=M9t(T=o[b])),U=r;A<_;++A)(U=b8e(T>0?g[A]+" "+L:b1(L,/&\f/g,g[A])))&&(l[C++]=U);return GL(r,e,t,i===0?iK:s,l,c,u)}function I9t(r,e,t){return GL(r,e,t,_8e,HL(P9t()),I7(r,2,-2),0)}function M8e(r,e,t,n){return GL(r,e,t,aK,I7(r,0,n),I7(r,n+1,-1),n)}function ew(r,e){for(var t="",n=sK(r),i=0;i<n;i++)t+=e(r[i],i,r,e)||"";return t}function k9t(r,e,t,n){switch(r.type){case T9t:if(r.children.length)break;case w9t:case aK:return r.return=r.return||r.value;case _8e:return"";case x8e:return r.return=r.value+"{"+ew(r.children,n)+"}";case iK:r.value=r.props.join(",")}return Gb(t=ew(r.children,n))?r.return=r.value+"{"+t+"}":""}function B9t(r){var e=sK(r);return function(t,n,i,a){for(var o="",s=0;s<e;s++)o+=r[s](t,n,i,a)||"";return o}}function H9t(r){return function(e){e.root||(e=e.return)&&r(e)}}function V9t(r){var e=Object.create(null);return function(t){return e[t]===void 0&&(e[t]=r(t)),e[t]}}var j9t=function(e,t,n){for(var i=0,a=0;i=a,a=qb(),i===38&&a===12&&(t[n]=1),!H7(a);)v3();return B7(e,K2)},G9t=function(e,t){var n=-1,i=44;do switch(H7(i)){case 0:i===38&&qb()===12&&(t[n]=1),e[n]+=j9t(K2-1,t,n);break;case 2:e[n]+=YL(i);break;case 4:if(i===44){e[++n]=qb()===58?"&\f":"",t[n]=e[n].length;break}default:e[n]+=HL(i)}while(i=v3());return e},q9t=function(e,t){return w8e(G9t(E8e(e),t))},C8e=new WeakMap,Y9t=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,n=e.parent,i=e.column===n.column&&e.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!C8e.get(n))&&!i){C8e.set(e,!0);for(var a=[],o=q9t(t,a),s=n.props,l=0,c=0;l<o.length;l++)for(var u=0;u<s.length;u++,c++)e.props[c]=a[l]?o[l].replace(/&\f/g,s[u]):s[u]+" "+o[l]}}},X9t=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function R8e(r,e){switch(R9t(r,e)){case 5103:return x1+"print-"+r+r;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return x1+r+r;case 5349:case 4246:case 4810:case 6968:case 2756:return x1+r+BL+r+r2+r+r;case 6828:case 4268:return x1+r+r2+r+r;case 6165:return x1+r+r2+"flex-"+r+r;case 5187:return x1+r+b1(r,/(\w+).+(:[^]+)/,x1+"box-$1$2"+r2+"flex-$1$2")+r;case 5443:return x1+r+r2+"flex-item-"+b1(r,/flex-|-self/,"")+r;case 4675:return x1+r+r2+"flex-line-pack"+b1(r,/align-content|flex-|-self/,"")+r;case 5548:return x1+r+r2+b1(r,"shrink","negative")+r;case 5292:return x1+r+r2+b1(r,"basis","preferred-size")+r;case 6060:return x1+"box-"+b1(r,"-grow","")+x1+r+r2+b1(r,"grow","positive")+r;case 4554:return x1+b1(r,/([^-])(transform)/g,"$1"+x1+"$2")+r;case 6187:return b1(b1(b1(r,/(zoom-|grab)/,x1+"$1"),/(image-set)/,x1+"$1"),r,"")+r;case 5495:case 3959:return b1(r,/(image-set\([^]*)/,x1+"$1$`$1");case 4968:return b1(b1(r,/(.+:)(flex-)?(.*)/,x1+"box-pack:$3"+r2+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+x1+r+r;case 4095:case 3583:case 4068:case 2532:return b1(r,/(.+)-inline(.+)/,x1+"$1$2")+r;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Gb(r)-1-e>6)switch(C5(r,e+1)){case 109:if(C5(r,e+4)!==45)break;case 102:return b1(r,/(.+:)(.+)-([^]+)/,"$1"+x1+"$2-$3$1"+BL+(C5(r,e+3)==108?"$3":"$2-$3"))+r;case 115:return~oK(r,"stretch")?R8e(b1(r,"stretch","fill-available"),e)+r:r}break;case 4949:if(C5(r,e+1)!==115)break;case 6444:switch(C5(r,Gb(r)-3-(~oK(r,"!important")&&10))){case 107:return b1(r,":",":"+x1)+r;case 101:return b1(r,/(.+:)([^;!]+)(;|!.+)?/,"$1"+x1+(C5(r,14)===45?"inline-":"")+"box$3$1"+x1+"$2$3$1"+r2+"$2box$3")+r}break;case 5936:switch(C5(r,e+11)){case 114:return x1+r+r2+b1(r,/[svh]\w+-[tblr]{2}/,"tb")+r;case 108:return x1+r+r2+b1(r,/[svh]\w+-[tblr]{2}/,"tb-rl")+r;case 45:return x1+r+r2+b1(r,/[svh]\w+-[tblr]{2}/,"lr")+r}return x1+r+r2+r+r}return r}var W9t=function(e,t,n,i){if(e.length>-1&&!e.return)switch(e.type){case aK:e.return=R8e(e.value,e.length);break;case x8e:return ew([k7(e,{value:b1(e.value,"@","@"+x1)})],i);case iK:if(e.length)return D9t(e.props,function(a){switch(A9t(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return ew([k7(e,{props:[b1(a,/:(read-\w+)/,":"+BL+"$1")]})],i);case"::placeholder":return ew([k7(e,{props:[b1(a,/:(plac\w+)/,":"+x1+"input-$1")]}),k7(e,{props:[b1(a,/:(plac\w+)/,":"+BL+"$1")]}),k7(e,{props:[b1(a,/:(plac\w+)/,r2+"input-$1")]})],i)}return""})}},$9t=[W9t],Z9t=function(e){var t=e.key;if(t==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(T){var C=T.getAttribute("data-emotion");C.indexOf(" ")!==-1&&(document.head.appendChild(T),T.setAttribute("data-s",""))})}var i=e.stylisPlugins||$9t,a={},o,s=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(T){for(var C=T.getAttribute("data-emotion").split(" "),A=1;A<C.length;A++)a[C[A]]=!0;s.push(T)});var l,c=[Y9t,X9t];{var u,h=[k9t,H9t(function(T){u.insert(T)})],g=B9t(c.concat(i,h)),_=function(C){return ew(F9t(C),g)};l=function(C,A,L,U){u=L,_(C?C+"{"+A.styles+"}":A.styles),U&&(b.inserted[A.name]=!0)}}var b={key:t,sheet:new E9t({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:l};return b.sheet.hydrate(s),b};function Q9t(r){for(var e=0,t,n=0,i=r.length;i>=4;++n,i-=4)t=r.charCodeAt(n)&255|(r.charCodeAt(++n)&255)<<8|(r.charCodeAt(++n)&255)<<16|(r.charCodeAt(++n)&255)<<24,t=(t&65535)*1540483477+((t>>>16)*59797<<16),t^=t>>>24,e=(t&65535)*1540483477+((t>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(r.charCodeAt(n+2)&255)<<16;case 2:e^=(r.charCodeAt(n+1)&255)<<8;case 1:e^=r.charCodeAt(n)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var K9t={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},J9t=!1,e_t=/[A-Z]|^ms/g,t_t=/_EMO_([^_]+?)_([^]*?)_EMO_/g,A8e=function(e){return e.charCodeAt(1)===45},D8e=function(e){return e!=null&&typeof e!="boolean"},cK=V9t(function(r){return A8e(r)?r:r.replace(e_t,"-$&").toLowerCase()}),P8e=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(t_t,function(n,i,a){return bS={name:i,styles:a,next:bS},i})}return K9t[e]!==1&&!A8e(e)&&typeof t=="number"&&t!==0?t+"px":t},n_t="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function WL(r,e,t){if(t==null)return"";var n=t;if(n.__emotion_styles!==void 0)return n;switch(typeof t){case"boolean":return"";case"object":{var i=t;if(i.anim===1)return bS={name:i.name,styles:i.styles,next:bS},i.name;var a=t;if(a.styles!==void 0){var o=a.next;if(o!==void 0)for(;o!==void 0;)bS={name:o.name,styles:o.styles,next:bS},o=o.next;var s=a.styles+";";return s}return r_t(r,e,t)}}var l=t;if(e==null)return l;var c=e[l];return c!==void 0?c:l}function r_t(r,e,t){var n="";if(Array.isArray(t))for(var i=0;i<t.length;i++)n+=WL(r,e,t[i])+";";else for(var a in t){var o=t[a];if(typeof o!="object"){var s=o;e!=null&&e[s]!==void 0?n+=a+"{"+e[s]+"}":D8e(s)&&(n+=cK(a)+":"+P8e(a,s)+";")}else{if(a==="NO_COMPONENT_SELECTOR"&&J9t)throw new Error(n_t);if(Array.isArray(o)&&typeof o[0]=="string"&&(e==null||e[o[0]]===void 0))for(var l=0;l<o.length;l++)D8e(o[l])&&(n+=cK(a)+":"+P8e(a,o[l])+";");else{var c=WL(r,e,o);switch(a){case"animation":case"animationName":{n+=cK(a)+":"+c+";";break}default:n+=a+"{"+c+"}"}}}}return n}var N8e=/label:\s*([^\s;{]+)\s*(;|$)/g,bS;function uK(r,e,t){if(r.length===1&&typeof r[0]=="object"&&r[0]!==null&&r[0].styles!==void 0)return r[0];var n=!0,i="";bS=void 0;var a=r[0];if(a==null||a.raw===void 0)n=!1,i+=WL(t,e,a);else{var o=a;i+=o[0]}for(var s=1;s<r.length;s++)if(i+=WL(t,e,r[s]),n){var l=a;i+=l[s]}N8e.lastIndex=0;for(var c="",u;(u=N8e.exec(i))!==null;)c+="-"+u[1];var h=Q9t(i)+c;return{name:h,styles:i,next:bS}}function L8e(r,e,t){var n="";return t.split(" ").forEach(function(i){r[i]!==void 0?e.push(r[i]+";"):i&&(n+=i+" ")}),n}var i_t=function(e,t,n){var i=e.key+"-"+t.name;e.registered[i]===void 0&&(e.registered[i]=t.styles)},a_t=function(e,t,n){i_t(e,t);var i=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var a=t;do e.insert(t===a?"."+i:"",a,e.sheet,!0),a=a.next;while(a!==void 0)}};function O8e(r,e){if(r.inserted[e.name]===void 0)return r.insert("",e,r.sheet,!0)}function U8e(r,e,t){var n=[],i=L8e(r,n,t);return n.length<2?t:i+e(n)}var o_t=function(e){var t=Z9t(e);t.sheet.speedy=function(s){this.isSpeedy=s},t.compat=!0;var n=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var h=uK(c,t.registered,void 0);return a_t(t,h),t.key+"-"+h.name},i=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var h=uK(c,t.registered),g="animation-"+h.name;return O8e(t,{name:h.name,styles:"@keyframes "+g+"{"+h.styles+"}"}),g},a=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];var h=uK(c,t.registered);O8e(t,h)},o=function(){for(var l=arguments.length,c=new Array(l),u=0;u<l;u++)c[u]=arguments[u];return U8e(t.registered,n,s_t(c))};return{css:n,cx:o,injectGlobal:a,keyframes:i,hydrate:function(l){l.forEach(function(c){t.inserted[c]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:L8e.bind(null,t.registered),merge:U8e.bind(null,t.registered,n)}},s_t=function r(e){for(var t="",n=0;n<e.length;n++){var i=e[n];if(i!=null){var a=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))a=r(i);else{a="";for(var o in i)i[o]&&o&&(a&&(a+=" "),a+=o)}break}default:a=i}a&&(t&&(t+=" "),t+=a)}}return t},l_t=o_t({key:"css"}),tw=l_t.css;function c_t(r){const e=new Map;let t=0;function n(i){for(const[,o]of e)if(o.has(i))return o;const a=new Set;return e.set(`connectivity_net${t++}`,a),a}for(const i of r){let a=null;for(const o of i){if(!a)a=n(o);else if(!a.has(o)){const s=n(o);if(s!==a){for(const l of s)a.add(l);e.delete(Array.from(e.entries()).find(([,l])=>l===s)[0])}}a.add(o)}}return Object.fromEntries(Array.from(e.entries()).map(([i,a])=>[i,Array.from(a)]))}var u_t=class{constructor(r){ni(this,"netMap");ni(this,"idToNetMap");this.netMap=r,this.idToNetMap={};for(const[e,t]of Object.entries(r))for(const n of t)this.idToNetMap[n]=e}addConnections(r){for(const e of r){const t=new Set;for(const i of e){const a=this.idToNetMap[i];a&&t.add(a)}let n;if(t.size===0)n=`connectivity_net${Object.keys(this.netMap).length}`,this.netMap[n]=[];else if(t.size===1)n=t.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;else{n=t.values().next().value??`connectivity_net${Object.keys(this.netMap).length}`;for(const i of t)if(i!==n){this.netMap[n].push(...this.netMap[i]),this.netMap[i]=this.netMap[n];for(const a of this.netMap[n])this.idToNetMap[a]=n}}for(const i of e)this.netMap[n].includes(i)||this.netMap[n].push(i),this.idToNetMap[i]=n}}getIdsConnectedToNet(r){return this.netMap[r]||[]}getNetConnectedToId(r){return this.idToNetMap[r]}areIdsConnected(r,e){const t=this.getNetConnectedToId(r),n=this.getNetConnectedToId(e);return t===n||n===r||n===r}areAllIdsConnected(r){const e=this.getNetConnectedToId(r[0]);for(const t of r){const n=this.getNetConnectedToId(t);if(n===void 0||n!==e)return!1}return!0}},z8e=r=>{const e=[];for(const n of r)if(n.type==="source_trace")e.push([n.source_trace_id,...n.connected_source_port_ids??[],...n.connected_source_net_ids??[]].filter(Boolean));else if(n.type==="pcb_port"){const{pcb_port_id:i,source_port_id:a}=n;a&&i&&e.push([a,i])}else if(n.type==="pcb_smtpad"){const{pcb_smtpad_id:i,pcb_port_id:a}=n;a&&i&&e.push([i,a])}else if(n.type==="pcb_plated_hole"){const{pcb_plated_hole_id:i,pcb_port_id:a}=n;a&&i&&e.push([i,a])}else if(n.type==="pcb_trace"){const{pcb_trace_id:i,source_trace_id:a}=n;a&&i&&e.push([i,a])}const t=c_t(e);return new u_t(t)},f_t=Object.defineProperty,d_t=(r,e)=>{for(var t in e)f_t(r,t,{get:e[t],enumerable:!0})},F8e={};d_t(F8e,{all_layers:()=>sO,any_circuit_element:()=>uwe,any_soup_element:()=>fwe,any_source_component:()=>l6e,battery_capacity:()=>i6e,cad_component:()=>cwe,capacitance:()=>_K,current:()=>wxt,distance:()=>pc,frequency:()=>r6e,getZodPrefixedIdWithDefault:()=>i1,inductance:()=>n6e,layer_ref:()=>k9,layer_string:()=>zK,length:()=>l_,pcb_board:()=>W6e,pcb_component:()=>L6e,pcb_fabrication_note_path:()=>iwe,pcb_fabrication_note_text:()=>rwe,pcb_group:()=>lwe,pcb_hole:()=>z6e,pcb_hole_circle_or_square_shape:()=>Axt,pcb_hole_oval_shape:()=>Dxt,pcb_keepout:()=>awe,pcb_manual_edit_conflict_error:()=>swe,pcb_missing_footprint_error:()=>owe,pcb_placement_error:()=>$6e,pcb_plated_hole:()=>F6e,pcb_port:()=>I6e,pcb_port_not_matched_error:()=>Y6e,pcb_route_hint:()=>P6e,pcb_route_hints:()=>Rxt,pcb_silkscreen_circle:()=>twe,pcb_silkscreen_line:()=>Q6e,pcb_silkscreen_oval:()=>nwe,pcb_silkscreen_path:()=>K6e,pcb_silkscreen_rect:()=>ewe,pcb_silkscreen_text:()=>J6e,pcb_smtpad:()=>k6e,pcb_solder_paste:()=>B6e,pcb_text:()=>H6e,pcb_trace:()=>G6e,pcb_trace_error:()=>q6e,pcb_trace_hint:()=>Z6e,pcb_trace_route_point:()=>kxt,pcb_trace_route_point_via:()=>j6e,pcb_trace_route_point_wire:()=>V6e,pcb_via:()=>X6e,point:()=>Jy,point3:()=>oC,port_arrangement:()=>g6e,position:()=>Mxt,position3:()=>Cxt,resistance:()=>rO,rotation:()=>iO,route_hint_point:()=>N6e,schematic_box:()=>h6e,schematic_component:()=>_6e,schematic_component_port_arrangement_by_sides:()=>y6e,schematic_component_port_arrangement_by_size:()=>v6e,schematic_debug_line:()=>C6e,schematic_debug_object:()=>A6e,schematic_debug_object_base:()=>oO,schematic_debug_point:()=>R6e,schematic_debug_rect:()=>M6e,schematic_error:()=>T6e,schematic_line:()=>x6e,schematic_net_label:()=>w6e,schematic_path:()=>p6e,schematic_pin_styles:()=>m6e,schematic_port:()=>E6e,schematic_text:()=>S6e,schematic_trace:()=>b6e,schematic_voltage_probe:()=>D6e,size:()=>bK,source_component_base:()=>R5,source_group:()=>f6e,source_led:()=>MK,source_net:()=>d6e,source_port:()=>c6e,source_simple_battery:()=>RK,source_simple_bug:()=>wK,source_simple_capacitor:()=>SK,source_simple_chip:()=>TK,source_simple_crystal:()=>s6e,source_simple_diode:()=>aO,source_simple_ground:()=>o6e,source_simple_inductor:()=>AK,source_simple_mosfet:()=>UK,source_simple_pin_header:()=>NK,source_simple_potentiometer:()=>PK,source_simple_power_source:()=>CK,source_simple_push_button:()=>DK,source_simple_resistor:()=>EK,source_simple_resonator:()=>LK,source_simple_transistor:()=>OK,source_trace:()=>u6e,supplier_name:()=>a6e,time:()=>Txt,visible_layer:()=>lw,voltage:()=>xK});var Sv;(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})(Sv||(Sv={}));var fK;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(fK||(fK={}));var Sc=Sv.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P4=r=>{switch(typeof r){case"undefined":return Sc.undefined;case"string":return Sc.string;case"number":return isNaN(r)?Sc.nan:Sc.number;case"boolean":return Sc.boolean;case"function":return Sc.function;case"bigint":return Sc.bigint;case"symbol":return Sc.symbol;case"object":return Array.isArray(r)?Sc.array:r===null?Sc.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?Sc.promise:typeof Map<"u"&&r instanceof Map?Sc.map:typeof Set<"u"&&r instanceof Set?Sc.set:typeof Date<"u"&&r instanceof Date?Sc.date:Sc.object;default:return Sc.unknown}},os=Sv.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"]),h_t=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),sb=class DPe 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 DPe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sv.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()}};sb.create=r=>new sb(r);var nw=(r,e)=>{let t;switch(r.code){case os.invalid_type:r.received===Sc.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case os.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Sv.jsonStringifyReplacer)}`;break;case os.unrecognized_keys:t=`Unrecognized key(s) in object: ${Sv.joinValues(r.keys,", ")}`;break;case os.invalid_union:t="Invalid input";break;case os.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Sv.joinValues(r.options)}`;break;case os.invalid_enum_value:t=`Invalid enum value. Expected ${Sv.joinValues(r.options)}, received '${r.received}'`;break;case os.invalid_arguments:t="Invalid function arguments";break;case os.invalid_return_type:t="Invalid function return type";break;case os.invalid_date:t="Invalid date";break;case os.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}"`:Sv.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case os.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 os.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 os.custom:t="Invalid input";break;case os.invalid_intersection_types:t="Intersection results could not be merged";break;case os.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case os.not_finite:t="Number must be finite";break;default:t=e.defaultError,Sv.assertNever(r)}return{message:t}},I8e=nw;function p_t(r){I8e=r}function $L(){return I8e}var ZL=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}},m_t=[];function Fl(r,e){const t=$L(),n=ZL({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===nw?void 0:nw].filter(i=>!!i)});r.common.issues.push(n)}var J2=class PPe{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 F0;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 PPe.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 F0;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}}},F0=Object.freeze({status:"aborted"}),rw=r=>({status:"dirty",value:r}),T2=r=>({status:"valid",value:r}),dK=r=>r.status==="aborted",hK=r=>r.status==="dirty",JE=r=>r.status==="valid",V7=r=>typeof Promise<"u"&&r instanceof Promise;function QL(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function k8e(r,e,t,n,i){if(typeof e=="function"?r!==e||!i:!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}var Ku;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ku||(Ku={}));var j7,G7,Yb=class{constructor(r,e,t,n){this._cachedPath=[],this.parent=r,this.data=e,this._path=t,this._key=n}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}},B8e=(r,e)=>{if(JE(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 sb(r.common.issues);return this._error=t,this._error}}};function xp(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}}var Bp=class{get description(){return this._def.description}_getType(r){return P4(r.data)}_getOrReturnCtx(r,e){return e||{common:r.parent.common,data:r.data,parsedType:P4(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new J2,ctx:{common:r.parent.common,data:r.data,parsedType:P4(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const e=this._parse(r);if(V7(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(r){const e=this._parse(r);return Promise.resolve(e)}parse(r,e){const t=this.safeParse(r,e);if(t.success)return t.data;throw t.error}safeParse(r,e){var t;const n={common:{issues:[],async:(t=e==null?void 0:e.async)!==null&&t!==void 0?t:!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:P4(r)},i=this._parseSync({data:r,path:n.path,parent:n});return B8e(n,i)}"~validate"(r){var e,t;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:P4(r)};if(!this["~standard"].async)try{const i=this._parseSync({data:r,path:[],parent:n});return JE(i)?{value:i.value}:{issues:n.common.issues}}catch(i){!((t=(e=i==null?void 0:i.message)===null||e===void 0?void 0:e.toLowerCase())===null||t===void 0)&&t.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:n}).then(i=>JE(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(r,e){const t=await this.safeParseAsync(r,e);if(t.success)return t.data;throw t.error}async safeParseAsync(r,e){const t={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:P4(r)},n=this._parse({data:r,path:t.path,parent:t}),i=await(V7(n)?n:Promise.resolve(n));return B8e(t,i)}refine(r,e){const t=n=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(n):e;return this._refinement((n,i)=>{const a=r(n),o=()=>i.addIssue({code:os.custom,...t(n)});return typeof Promise<"u"&&a instanceof Promise?a.then(s=>s?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(r,e){return this._refinement((t,n)=>r(t)?!0:(n.addIssue(typeof e=="function"?e(t,n):e),!1))}_refinement(r){return new lb({schema:this,typeName:x0.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Xb.create(this,this._def)}nullable(){return ES.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return t8.create(this)}promise(){return sw.create(this,this._def)}or(r){return Q7.create([this,r],this._def)}and(r){return K7.create(this,r,this._def)}transform(r){return new lb({...xp(this._def),schema:this,typeName:x0.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const e=typeof r=="function"?r:()=>r;return new rC({...xp(this._def),innerType:this,defaultValue:e,typeName:x0.ZodDefault})}brand(){return new vK({typeName:x0.ZodBranded,type:this,...xp(this._def)})}catch(r){const e=typeof r=="function"?r:()=>r;return new iC({...xp(this._def),innerType:this,catchValue:e,typeName:x0.ZodCatch})}describe(r){const e=this.constructor;return new e({...this._def,description:r})}pipe(r){return yK.create(this,r)}readonly(){return aC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},v_t=/^c[^\s-]{8,}$/i,y_t=/^[0-9a-z]+$/,g_t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,__t=/^[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,x_t=/^[a-z0-9_-]{21}$/i,b_t=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,S_t=/^[-+]?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)?)??$/,E_t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w_t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",pK,T_t=/^(?:(?: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])$/,M_t=/^(?:(?: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])$/,C_t=/^(([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]))$/,R_t=/^(([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])$/,A_t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,D_t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H8e="((\\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])))",P_t=new RegExp(`^${H8e}$`);function V8e(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 N_t(r){return new RegExp(`^${V8e(r)}$`)}function j8e(r){let e=`${H8e}T${V8e(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 L_t(r,e){return!!((e==="v4"||!e)&&T_t.test(r)||(e==="v6"||!e)&&C_t.test(r))}function O_t(r,e){if(!b_t.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 U_t(r,e){return!!((e==="v4"||!e)&&M_t.test(r)||(e==="v6"||!e)&&R_t.test(r))}var iw=class IC extends Bp{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Sc.string){const a=this._getOrReturnCtx(e);return Fl(a,{code:os.invalid_type,expected:Sc.string,received:a.parsedType}),F0}const n=new J2;let i;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.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),Fl(i,{code:os.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?Fl(i,{code:os.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Fl(i,{code:os.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")E_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"email",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")pK||(pK=new RegExp(w_t,"u")),pK.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"emoji",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")__t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"uuid",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")x_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"nanoid",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")v_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"cuid",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")y_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"cuid2",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")g_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"ulid",code:os.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Fl(i,{validation:"url",code:os.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),Fl(i,{validation:"regex",code:os.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),Fl(i,{code:os.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),Fl(i,{code:os.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?j8e(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?P_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?N_t(a).test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?S_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"duration",code:os.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?L_t(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"ip",code:os.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?O_t(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"jwt",code:os.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?U_t(e.data,a.version)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"cidr",code:os.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?A_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"base64",code:os.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?D_t.test(e.data)||(i=this._getOrReturnCtx(e,i),Fl(i,{validation:"base64url",code:os.invalid_string,message:a.message}),n.dirty()):Sv.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:os.invalid_string,...Ku.errToObj(n)})}_addCheck(e){return new IC({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ku.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ku.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ku.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ku.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ku.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ku.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ku.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ku.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ku.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ku.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ku.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ku.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ku.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,...Ku.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,...Ku.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ku.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ku.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Ku.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ku.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ku.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ku.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ku.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ku.errToObj(t)})}nonempty(e){return this.min(1,Ku.errToObj(e))}trim(){return new IC({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new IC({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new IC({...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}};iw.create=r=>{var e;return new iw({checks:[],typeName:x0.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...xp(r)})};function z_t(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)}var q7=class $te extends Bp{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)!==Sc.number){const a=this._getOrReturnCtx(e);return Fl(a,{code:os.invalid_type,expected:Sc.number,received:a.parsedType}),F0}let n;const i=new J2;for(const a of this._def.checks)a.kind==="int"?Sv.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Fl(n,{code:os.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),Fl(n,{code:os.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),Fl(n,{code:os.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?z_t(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Fl(n,{code:os.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Fl(n,{code:os.not_finite,message:a.message}),i.dirty()):Sv.assertNever(a);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ku.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ku.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ku.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ku.toString(t))}setLimit(e,t,n,i){return new $te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ku.toString(i)}]})}_addCheck(e){return new $te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ku.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ku.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ku.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ku.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ku.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ku.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ku.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ku.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ku.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"&&Sv.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)}};q7.create=r=>new q7({checks:[],typeName:x0.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...xp(r)});var Y7=class Zte extends Bp{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)!==Sc.bigint)return this._getInvalidInput(e);let n;const i=new J2;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),Fl(n,{code:os.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),Fl(n,{code:os.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),Fl(n,{code:os.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Sv.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Fl(t,{code:os.invalid_type,expected:Sc.bigint,received:t.parsedType}),F0}gte(e,t){return this.setLimit("min",e,!0,Ku.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ku.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ku.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ku.toString(t))}setLimit(e,t,n,i){return new Zte({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Ku.toString(i)}]})}_addCheck(e){return new Zte({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ku.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ku.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ku.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ku.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ku.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}};Y7.create=r=>{var e;return new Y7({checks:[],typeName:x0.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...xp(r)})};var X7=class extends Bp{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==Sc.boolean){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.boolean,received:t.parsedType}),F0}return T2(r.data)}};X7.create=r=>new X7({typeName:x0.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...xp(r)});var W7=class NPe extends Bp{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Sc.date){const a=this._getOrReturnCtx(e);return Fl(a,{code:os.invalid_type,expected:Sc.date,received:a.parsedType}),F0}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Fl(a,{code:os.invalid_date}),F0}const n=new J2;let i;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),Fl(i,{code:os.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),Fl(i,{code:os.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Sv.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new NPe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ku.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ku.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}};W7.create=r=>new W7({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:x0.ZodDate,...xp(r)});var KL=class extends Bp{_parse(r){if(this._getType(r)!==Sc.symbol){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.symbol,received:t.parsedType}),F0}return T2(r.data)}};KL.create=r=>new KL({typeName:x0.ZodSymbol,...xp(r)});var $7=class extends Bp{_parse(r){if(this._getType(r)!==Sc.undefined){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.undefined,received:t.parsedType}),F0}return T2(r.data)}};$7.create=r=>new $7({typeName:x0.ZodUndefined,...xp(r)});var Z7=class extends Bp{_parse(r){if(this._getType(r)!==Sc.null){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.null,received:t.parsedType}),F0}return T2(r.data)}};Z7.create=r=>new Z7({typeName:x0.ZodNull,...xp(r)});var aw=class extends Bp{constructor(){super(...arguments),this._any=!0}_parse(r){return T2(r.data)}};aw.create=r=>new aw({typeName:x0.ZodAny,...xp(r)});var e8=class extends Bp{constructor(){super(...arguments),this._unknown=!0}_parse(r){return T2(r.data)}};e8.create=r=>new e8({typeName:x0.ZodUnknown,...xp(r)});var N4=class extends Bp{_parse(r){const e=this._getOrReturnCtx(r);return Fl(e,{code:os.invalid_type,expected:Sc.never,received:e.parsedType}),F0}};N4.create=r=>new N4({typeName:x0.ZodNever,...xp(r)});var JL=class extends Bp{_parse(r){if(this._getType(r)!==Sc.undefined){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.void,received:t.parsedType}),F0}return T2(r.data)}};JL.create=r=>new JL({typeName:x0.ZodVoid,...xp(r)});var t8=class lz extends Bp{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==Sc.array)return Fl(t,{code:os.invalid_type,expected:Sc.array,received:t.parsedType}),F0;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,s=t.data.length<i.exactLength.value;(o||s)&&(Fl(t,{code:o?os.too_big:os.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&&(Fl(t,{code:os.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&&(Fl(t,{code:os.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 Yb(t,o,t.path,s)))).then(o=>J2.mergeArray(n,o));const a=[...t.data].map((o,s)=>i.type._parseSync(new Yb(t,o,t.path,s)));return J2.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new lz({...this._def,minLength:{value:e,message:Ku.toString(t)}})}max(e,t){return new lz({...this._def,maxLength:{value:e,message:Ku.toString(t)}})}length(e,t){return new lz({...this._def,exactLength:{value:e,message:Ku.toString(t)}})}nonempty(e){return this.min(1,e)}};t8.create=(r,e)=>new t8({type:r,minLength:null,maxLength:null,exactLength:null,typeName:x0.ZodArray,...xp(e)});function ow(r){if(r instanceof U3){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Xb.create(ow(n))}return new U3({...r._def,shape:()=>e})}else return r instanceof t8?new t8({...r._def,type:ow(r.element)}):r instanceof Xb?Xb.create(ow(r.unwrap())):r instanceof ES?ES.create(ow(r.unwrap())):r instanceof SS?SS.create(r.items.map(e=>ow(e))):r}var U3=class _b extends Bp{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=Sv.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Sc.object){const c=this._getOrReturnCtx(e);return Fl(c,{code:os.invalid_type,expected:Sc.object,received:c.parsedType}),F0}const{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof N4&&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],h=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Yb(i,h,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof N4){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&&(Fl(i,{code:os.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 h=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Yb(i,h,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const h=await u.key,g=await u.value;c.push({key:h,value:g,alwaysSet:u.alwaysSet})}return c}).then(c=>J2.mergeObjectSync(n,c)):J2.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return Ku.errToObj,new _b({...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=Ku.errToObj(e).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new _b({...this._def,unknownKeys:"strip"})}passthrough(){return new _b({...this._def,unknownKeys:"passthrough"})}extend(e){return new _b({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new _b({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x0.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new _b({...this._def,catchall:e})}pick(e){const t={};return Sv.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new _b({...this._def,shape:()=>t})}omit(e){const t={};return Sv.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new _b({...this._def,shape:()=>t})}deepPartial(){return ow(this)}partial(e){const t={};return Sv.objectKeys(this.shape).forEach(n=>{const i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new _b({...this._def,shape:()=>t})}required(e){const t={};return Sv.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Xb;)a=a._def.innerType;t[n]=a}}),new _b({...this._def,shape:()=>t})}keyof(){return X8e(Sv.objectKeys(this.shape))}};U3.create=(r,e)=>new U3({shape:()=>r,unknownKeys:"strip",catchall:N4.create(),typeName:x0.ZodObject,...xp(e)}),U3.strictCreate=(r,e)=>new U3({shape:()=>r,unknownKeys:"strict",catchall:N4.create(),typeName:x0.ZodObject,...xp(e)}),U3.lazycreate=(r,e)=>new U3({shape:r,unknownKeys:"strip",catchall:N4.create(),typeName:x0.ZodObject,...xp(e)});var Q7=class extends Bp{_parse(r){const{ctx:e}=this._processInputParams(r),t=this._def.options;function n(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;const a=i.map(o=>new sb(o.ctx.common.issues));return Fl(e,{code:os.invalid_union,unionErrors:a}),F0}if(e.common.async)return Promise.all(t.map(async i=>{const a={...e,common:{...e.common,issues:[]},parent:null};return{result:await i._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(n);{let i;const a=[];for(const s of t){const l={...e,common:{...e.common,issues:[]},parent:null},c=s._parseSync({data:e.data,path:e.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return e.common.issues.push(...i.ctx.common.issues),i.result;const o=a.map(s=>new sb(s));return Fl(e,{code:os.invalid_union,unionErrors:o}),F0}}get options(){return this._def.options}};Q7.create=(r,e)=>new Q7({options:r,typeName:x0.ZodUnion,...xp(e)});var L4=r=>r instanceof J7?L4(r.schema):r instanceof lb?L4(r.innerType()):r instanceof eC?[r.value]:r instanceof tC?r.options:r instanceof nC?Sv.objectValues(r.enum):r instanceof rC?L4(r._def.innerType):r instanceof $7?[void 0]:r instanceof Z7?[null]:r instanceof Xb?[void 0,...L4(r.unwrap())]:r instanceof ES?[null,...L4(r.unwrap())]:r instanceof vK||r instanceof aC?L4(r.unwrap()):r instanceof iC?L4(r._def.innerType):[],G8e=class LPe extends Bp{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Sc.object)return Fl(t,{code:os.invalid_type,expected:Sc.object,received:t.parsedType}),F0;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}):(Fl(t,{code:os.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),F0)}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=L4(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 LPe({typeName:x0.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...xp(n)})}};function mK(r,e){const t=P4(r),n=P4(e);if(r===e)return{valid:!0,data:r};if(t===Sc.object&&n===Sc.object){const i=Sv.objectKeys(e),a=Sv.objectKeys(r).filter(s=>i.indexOf(s)!==-1),o={...r,...e};for(const s of a){const l=mK(r[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===Sc.array&&n===Sc.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=mK(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return t===Sc.date&&n===Sc.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var K7=class extends Bp{_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=(i,a)=>{if(dK(i)||dK(a))return F0;const o=mK(i.value,a.value);return o.valid?((hK(i)||hK(a))&&e.dirty(),{status:e.value,value:o.data}):(Fl(t,{code:os.invalid_intersection_types}),F0)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([i,a])=>n(i,a)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}};K7.create=(r,e,t)=>new K7({left:r,right:e,typeName:x0.ZodIntersection,...xp(t)});var SS=class OPe extends Bp{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sc.array)return Fl(n,{code:os.invalid_type,expected:Sc.array,received:n.parsedType}),F0;if(n.data.length<this._def.items.length)return Fl(n,{code:os.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F0;!this._def.rest&&n.data.length>this._def.items.length&&(Fl(n,{code:os.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 Yb(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>J2.mergeArray(t,o)):J2.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new OPe({...this._def,rest:e})}};SS.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new SS({items:r,typeName:x0.ZodTuple,rest:null,...xp(e)})};var q8e=class Qte extends Bp{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!==Sc.object)return Fl(n,{code:os.invalid_type,expected:Sc.object,received:n.parsedType}),F0;const i=[],a=this._def.keyType,o=this._def.valueType;for(const s in n.data)i.push({key:a._parse(new Yb(n,s,n.path,s)),value:o._parse(new Yb(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?J2.mergeObjectAsync(t,i):J2.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Bp?new Qte({keyType:e,valueType:t,typeName:x0.ZodRecord,...xp(n)}):new Qte({keyType:iw.create(),valueType:e,typeName:x0.ZodRecord,...xp(t)})}},eO=class extends Bp{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:e,ctx:t}=this._processInputParams(r);if(t.parsedType!==Sc.map)return Fl(t,{code:os.invalid_type,expected:Sc.map,received:t.parsedType}),F0;const n=this._def.keyType,i=this._def.valueType,a=[...t.data.entries()].map(([o,s],l)=>({key:n._parse(new Yb(t,o,t.path,[l,"key"])),value:i._parse(new Yb(t,s,t.path,[l,"value"]))}));if(t.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const s of a){const l=await s.key,c=await s.value;if(l.status==="aborted"||c.status==="aborted")return F0;(l.status==="dirty"||c.status==="dirty")&&e.dirty(),o.set(l.value,c.value)}return{status:e.value,value:o}})}else{const o=new Map;for(const s of a){const l=s.key,c=s.value;if(l.status==="aborted"||c.status==="aborted")return F0;(l.status==="dirty"||c.status==="dirty")&&e.dirty(),o.set(l.value,c.value)}return{status:e.value,value:o}}}};eO.create=(r,e,t)=>new eO({valueType:e,keyType:r,typeName:x0.ZodMap,...xp(t)});var tO=class Kte extends Bp{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Sc.set)return Fl(n,{code:os.invalid_type,expected:Sc.set,received:n.parsedType}),F0;const i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Fl(n,{code:os.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&&(Fl(n,{code:os.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 F0;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 Yb(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Kte({...this._def,minSize:{value:e,message:Ku.toString(t)}})}max(e,t){return new Kte({...this._def,maxSize:{value:e,message:Ku.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};tO.create=(r,e)=>new tO({valueType:r,minSize:null,maxSize:null,typeName:x0.ZodSet,...xp(e)});var Y8e=class cz extends Bp{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Sc.function)return Fl(t,{code:os.invalid_type,expected:Sc.function,received:t.parsedType}),F0;function n(s,l){return ZL({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$L(),nw].filter(c=>!!c),issueData:{code:os.invalid_arguments,argumentsError:l}})}function i(s,l){return ZL({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,$L(),nw].filter(c=>!!c),issueData:{code:os.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof sw){const s=this;return T2(async function(...l){const c=new sb([]),u=await s._def.args.parseAsync(l,a).catch(_=>{throw c.addIssue(n(l,_)),c}),h=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(h,a).catch(_=>{throw c.addIssue(i(h,_)),c})})}else{const s=this;return T2(function(...l){const c=s._def.args.safeParse(l,a);if(!c.success)throw new sb([n(l,c.error)]);const u=Reflect.apply(o,this,c.data),h=s._def.returns.safeParse(u,a);if(!h.success)throw new sb([i(u,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new cz({...this._def,args:SS.create(e).rest(e8.create())})}returns(e){return new cz({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new cz({args:e||SS.create([]).rest(e8.create()),returns:t||e8.create(),typeName:x0.ZodFunction,...xp(n)})}},J7=class extends Bp{get schema(){return this._def.getter()}_parse(r){const{ctx:e}=this._processInputParams(r);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};J7.create=(r,e)=>new J7({getter:r,typeName:x0.ZodLazy,...xp(e)});var eC=class extends Bp{_parse(r){if(r.data!==this._def.value){const e=this._getOrReturnCtx(r);return Fl(e,{received:e.data,code:os.invalid_literal,expected:this._def.value}),F0}return{status:"valid",value:r.data}}get value(){return this._def.value}};eC.create=(r,e)=>new eC({value:r,typeName:x0.ZodLiteral,...xp(e)});function X8e(r,e){return new tC({values:r,typeName:x0.ZodEnum,...xp(e)})}var tC=class Jte extends Bp{constructor(){super(...arguments),j7.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return Fl(t,{expected:Sv.joinValues(n),received:t.parsedType,code:os.invalid_type}),F0}if(QL(this,j7)||k8e(this,j7,new Set(this._def.values)),!QL(this,j7).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Fl(t,{received:t.data,code:os.invalid_enum_value,options:n}),F0}return T2(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 Jte.create(e,{...this._def,...t})}exclude(e,t=this._def){return Jte.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};j7=new WeakMap,tC.create=X8e;var nC=class extends Bp{constructor(){super(...arguments),G7.set(this,void 0)}_parse(r){const e=Sv.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(r);if(t.parsedType!==Sc.string&&t.parsedType!==Sc.number){const n=Sv.objectValues(e);return Fl(t,{expected:Sv.joinValues(n),received:t.parsedType,code:os.invalid_type}),F0}if(QL(this,G7)||k8e(this,G7,new Set(Sv.getValidEnumValues(this._def.values))),!QL(this,G7).has(r.data)){const n=Sv.objectValues(e);return Fl(t,{received:t.data,code:os.invalid_enum_value,options:n}),F0}return T2(r.data)}get enum(){return this._def.values}};G7=new WeakMap,nC.create=(r,e)=>new nC({values:r,typeName:x0.ZodNativeEnum,...xp(e)});var sw=class extends Bp{unwrap(){return this._def.type}_parse(r){const{ctx:e}=this._processInputParams(r);if(e.parsedType!==Sc.promise&&e.common.async===!1)return Fl(e,{code:os.invalid_type,expected:Sc.promise,received:e.parsedType}),F0;const t=e.parsedType===Sc.promise?e.data:Promise.resolve(e.data);return T2(t.then(n=>this._def.type.parseAsync(n,{path:e.path,errorMap:e.common.contextualErrorMap})))}};sw.create=(r,e)=>new sw({type:r,typeName:x0.ZodPromise,...xp(e)});var lb=class extends Bp{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x0.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:e,ctx:t}=this._processInputParams(r),n=this._def.effect||null,i={addIssue:a=>{Fl(t,a),a.fatal?e.abort():e.dirty()},get path(){return t.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){const a=n.transform(t.data,i);if(t.common.async)return Promise.resolve(a).then(async o=>{if(e.value==="aborted")return F0;const s=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return s.status==="aborted"?F0:s.status==="dirty"||e.value==="dirty"?rw(s.value):s});{if(e.value==="aborted")return F0;const o=this._def.schema._parseSync({data:a,path:t.path,parent:t});return o.status==="aborted"?F0:o.status==="dirty"||e.value==="dirty"?rw(o.value):o}}if(n.type==="refinement"){const a=o=>{const s=n.refinement(o,i);if(t.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){const o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?F0:(o.status==="dirty"&&e.dirty(),a(o.value),{status:e.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?F0:(o.status==="dirty"&&e.dirty(),a(o.value).then(()=>({status:e.value,value:o.value}))))}if(n.type==="transform")if(t.common.async===!1){const a=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!JE(a))return a;const o=n.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(a=>JE(a)?Promise.resolve(n.transform(a.value,i)).then(o=>({status:e.value,value:o})):a);Sv.assertNever(n)}};lb.create=(r,e,t)=>new lb({schema:r,typeName:x0.ZodEffects,effect:e,...xp(t)}),lb.createWithPreprocess=(r,e,t)=>new lb({schema:e,effect:{type:"preprocess",transform:r},typeName:x0.ZodEffects,...xp(t)});var Xb=class extends Bp{_parse(r){return this._getType(r)===Sc.undefined?T2(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};Xb.create=(r,e)=>new Xb({innerType:r,typeName:x0.ZodOptional,...xp(e)});var ES=class extends Bp{_parse(r){return this._getType(r)===Sc.null?T2(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}};ES.create=(r,e)=>new ES({innerType:r,typeName:x0.ZodNullable,...xp(e)});var rC=class extends Bp{_parse(r){const{ctx:e}=this._processInputParams(r);let t=e.data;return e.parsedType===Sc.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};rC.create=(r,e)=>new rC({innerType:r,typeName:x0.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...xp(e)});var iC=class extends Bp{_parse(r){const{ctx:e}=this._processInputParams(r),t={...e,common:{...e.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return V7(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new sb(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new sb(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}};iC.create=(r,e)=>new iC({innerType:r,typeName:x0.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...xp(e)});var nO=class extends Bp{_parse(r){if(this._getType(r)!==Sc.nan){const t=this._getOrReturnCtx(r);return Fl(t,{code:os.invalid_type,expected:Sc.nan,received:t.parsedType}),F0}return{status:"valid",value:r.data}}};nO.create=r=>new nO({typeName:x0.ZodNaN,...xp(r)});var F_t=Symbol("zod_brand"),vK=class extends Bp{_parse(r){const{ctx:e}=this._processInputParams(r),t=e.data;return this._def.type._parse({data:t,path:e.path,parent:e})}unwrap(){return this._def.type}},yK=class UPe extends Bp{_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"?F0:a.status==="dirty"?(t.dirty(),rw(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"?F0: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 UPe({in:e,out:t,typeName:x0.ZodPipeline})}},aC=class extends Bp{_parse(r){const e=this._def.innerType._parse(r),t=n=>(JE(n)&&(n.value=Object.freeze(n.value)),n);return V7(e)?e.then(n=>t(n)):t(e)}unwrap(){return this._def.innerType}};aC.create=(r,e)=>new aC({innerType:r,typeName:x0.ZodReadonly,...xp(e)});function W8e(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function $8e(r,e={},t){return r?aw.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 h=W8e(e,n),g=(u=(c=h.fatal)!==null&&c!==void 0?c:t)!==null&&u!==void 0?u:!0;i.addIssue({code:"custom",...h,fatal:g})}});if(!s){const l=W8e(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})}}):aw.create()}var I_t={object:U3.lazycreate},x0;(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"})(x0||(x0={}));var k_t=(r,e={message:`Input not instance of ${r.name}`})=>$8e(t=>t instanceof r,e),Z8e=iw.create,Q8e=q7.create,B_t=nO.create,H_t=Y7.create,K8e=X7.create,V_t=W7.create,j_t=KL.create,G_t=$7.create,q_t=Z7.create,Y_t=aw.create,X_t=e8.create,W_t=N4.create,$_t=JL.create,Z_t=t8.create,Q_t=U3.create,K_t=U3.strictCreate,J_t=Q7.create,ext=G8e.create,txt=K7.create,nxt=SS.create,rxt=q8e.create,ixt=eO.create,axt=tO.create,oxt=Y8e.create,sxt=J7.create,lxt=eC.create,cxt=tC.create,uxt=nC.create,fxt=sw.create,J8e=lb.create,dxt=Xb.create,hxt=ES.create,pxt=lb.createWithPreprocess,mxt=yK.create,vxt=()=>Z8e().optional(),yxt=()=>Q8e().optional(),gxt=()=>K8e().optional(),_xt={string:r=>iw.create({...r,coerce:!0}),number:r=>q7.create({...r,coerce:!0}),boolean:r=>X7.create({...r,coerce:!0}),bigint:r=>Y7.create({...r,coerce:!0}),date:r=>W7.create({...r,coerce:!0})},xxt=F0,Ft=Object.freeze({__proto__:null,defaultErrorMap:nw,setErrorMap:p_t,getErrorMap:$L,makeIssue:ZL,EMPTY_PATH:m_t,addIssueToContext:Fl,ParseStatus:J2,INVALID:F0,DIRTY:rw,OK:T2,isAborted:dK,isDirty:hK,isValid:JE,isAsync:V7,get util(){return Sv},get objectUtil(){return fK},ZodParsedType:Sc,getParsedType:P4,ZodType:Bp,datetimeRegex:j8e,ZodString:iw,ZodNumber:q7,ZodBigInt:Y7,ZodBoolean:X7,ZodDate:W7,ZodSymbol:KL,ZodUndefined:$7,ZodNull:Z7,ZodAny:aw,ZodUnknown:e8,ZodNever:N4,ZodVoid:JL,ZodArray:t8,ZodObject:U3,ZodUnion:Q7,ZodDiscriminatedUnion:G8e,ZodIntersection:K7,ZodTuple:SS,ZodRecord:q8e,ZodMap:eO,ZodSet:tO,ZodFunction:Y8e,ZodLazy:J7,ZodLiteral:eC,ZodEnum:tC,ZodNativeEnum:nC,ZodPromise:sw,ZodEffects:lb,ZodTransformer:lb,ZodOptional:Xb,ZodNullable:ES,ZodDefault:rC,ZodCatch:iC,ZodNaN:nO,BRAND:F_t,ZodBranded:vK,ZodPipeline:yK,ZodReadonly:aC,custom:$8e,Schema:Bp,ZodSchema:Bp,late:I_t,get ZodFirstPartyTypeKind(){return x0},coerce:_xt,any:Y_t,array:Z_t,bigint:H_t,boolean:K8e,date:V_t,discriminatedUnion:ext,effect:J8e,enum:cxt,function:oxt,instanceof:k_t,intersection:txt,lazy:sxt,literal:lxt,map:ixt,nan:B_t,nativeEnum:uxt,never:W_t,null:q_t,nullable:hxt,number:Q8e,object:Q_t,oboolean:gxt,onumber:yxt,optional:dxt,ostring:vxt,pipeline:mxt,preprocess:pxt,promise:fxt,record:rxt,set:axt,strictObject:K_t,string:Z8e,symbol:j_t,transformer:J8e,tuple:nxt,undefined:G_t,union:J_t,unknown:X_t,void:$_t,NEVER:xxt,ZodIssueCode:os,quotelessJson:h_t,ZodError:sb}),bxt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Sxt=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r|=0));for(;r--;)e+=bxt[t[r]&63];return e},e6e={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,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}}},gK=new Set;for(const[r,e]of Object.entries(e6e)){gK.add(r);for(const t of Object.keys(e.variants))gK.add(t)}function Ext(r){for(const[e,t]of Object.entries(e6e))if(r in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[r]};return{baseUnit:r,conversionFactor:1}}var t6e={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},cb=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}=cb(r.x);return{parsedUnit:l,unitOfValue:c,value:{x:cb(r.x).value,y:cb(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 t6e&&!gK.has(n)){const l=t6e[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(i)*l}}const{baseUnit:a,conversionFactor:o}=Ext(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(i)}},rO=Ft.string().or(Ft.number()).transform(r=>cb(r).value),_K=Ft.string().or(Ft.number()).transform(r=>cb(r).value),n6e=Ft.string().or(Ft.number()).transform(r=>cb(r).value),xK=Ft.string().or(Ft.number()).transform(r=>cb(r).value),l_=Ft.string().or(Ft.number()).transform(r=>cb(r).value),r6e=Ft.string().or(Ft.number()).transform(r=>cb(r).value),pc=l_,wxt=Ft.string().or(Ft.number()).transform(r=>cb(r).value),Txt=Ft.string().or(Ft.number()).transform(r=>cb(r).value),iO=Ft.string().or(Ft.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)),i6e=Ft.number().or(Ft.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"),Jy=Ft.object({x:pc,y:pc}),Mxt=Jy,oC=Ft.object({x:pc,y:pc,z:pc}),Cxt=oC,bK=Ft.object({width:Ft.number(),height:Ft.number()}),i1=r=>Ft.string().optional().default(()=>`${r}_${Sxt(10)}`),a6e=Ft.enum(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),R5=Ft.object({type:Ft.literal("source_component"),ftype:Ft.string().optional(),source_component_id:Ft.string(),name:Ft.string(),manufacturer_part_number:Ft.string().optional(),supplier_part_numbers:Ft.record(a6e,Ft.array(Ft.string())).optional(),display_value:Ft.string().optional()}),SK=R5.extend({ftype:Ft.literal("simple_capacitor"),capacitance:_K,display_capacitance:Ft.string().optional(),max_decoupling_trace_length:pc.optional()}),EK=R5.extend({ftype:Ft.literal("simple_resistor"),resistance:rO,display_resistance:Ft.string().optional()}),aO=R5.extend({ftype:Ft.literal("simple_diode")}),o6e=R5.extend({ftype:Ft.literal("simple_ground")}),wK=R5.extend({ftype:Ft.literal("simple_bug")}).describe("@deprecated"),TK=R5.extend({ftype:Ft.literal("simple_chip")}),MK=aO.extend({ftype:Ft.literal("led")}),CK=R5.extend({ftype:Ft.literal("simple_power_source"),voltage:xK}),RK=R5.extend({ftype:Ft.literal("simple_battery"),capacity:i6e}),AK=R5.extend({ftype:Ft.literal("simple_inductor"),inductance:n6e}),DK=R5.extend({ftype:Ft.literal("simple_push_button")}),PK=R5.extend({ftype:Ft.literal("simple_potentiometer"),max_resistance:rO}),s6e=R5.extend({ftype:Ft.literal("simple_crystal"),frequency:Ft.number().describe("Frequency in Hz"),load_capacitance:Ft.number().optional().describe("Load capacitance in pF")}),NK=R5.extend({ftype:Ft.literal("simple_pin_header"),pin_count:Ft.number(),gender:Ft.enum(["male","female"]).optional().default("male")}),LK=R5.extend({ftype:Ft.literal("simple_resonator"),load_capacitance:_K,equivalent_series_resistance:rO.optional(),frequency:r6e}),OK=R5.extend({ftype:Ft.literal("simple_transistor"),transistor_type:Ft.enum(["npn","pnp"])}),UK=R5.extend({ftype:Ft.literal("simple_mosfet"),channel_type:Ft.enum(["n","p"]),mosfet_mode:Ft.enum(["enhancement","depletion"])}),l6e=Ft.union([EK,SK,aO,o6e,TK,wK,MK,CK,RK,AK,DK,PK,s6e,NK,LK,OK,UK]),c6e=Ft.object({type:Ft.literal("source_port"),pin_number:Ft.number().optional(),port_hints:Ft.array(Ft.string()).optional(),name:Ft.string(),source_port_id:Ft.string(),source_component_id:Ft.string()}),u6e=Ft.object({type:Ft.literal("source_trace"),source_trace_id:Ft.string(),connected_source_port_ids:Ft.array(Ft.string()),connected_source_net_ids:Ft.array(Ft.string()),subcircuit_connectivity_map_key:Ft.string().optional(),max_length:Ft.number().optional(),display_name:Ft.string().optional()}),f6e=Ft.object({type:Ft.literal("source_group"),source_group_id:Ft.string(),name:Ft.string().optional()}),d6e=Ft.object({type:Ft.literal("source_net"),source_net_id:Ft.string(),name:Ft.string(),member_source_group_ids:Ft.array(Ft.string()),is_power:Ft.boolean().optional(),is_ground:Ft.boolean().optional(),is_digital_signal:Ft.boolean().optional(),is_analog_signal:Ft.boolean().optional(),trace_width:Ft.number().optional()}),h6e=Ft.object({type:Ft.literal("schematic_box"),schematic_component_id:Ft.string(),width:pc,height:pc,x:pc,y:pc}).describe("Draws a box on the schematic"),p6e=Ft.object({type:Ft.literal("schematic_path"),schematic_component_id:Ft.string(),fill_color:Ft.enum(["red","blue"]).optional(),is_filled:Ft.boolean().optional(),points:Ft.array(Jy)}),m6e=Ft.record(Ft.object({left_margin:l_.optional(),right_margin:l_.optional(),top_margin:l_.optional(),bottom_margin:l_.optional()})),v6e=Ft.object({left_size:Ft.number(),right_size:Ft.number(),top_size:Ft.number().optional(),bottom_size:Ft.number().optional()}),y6e=Ft.object({left_side:Ft.object({pins:Ft.array(Ft.number()),direction:Ft.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Ft.object({pins:Ft.array(Ft.number()),direction:Ft.enum(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Ft.object({pins:Ft.array(Ft.number()),direction:Ft.enum(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Ft.object({pins:Ft.array(Ft.number()),direction:Ft.enum(["left-to-right","right-to-left"]).optional()}).optional()}),g6e=Ft.union([v6e,y6e]),_6e=Ft.object({type:Ft.literal("schematic_component"),rotation:iO.default(0),size:bK,center:Jy,source_component_id:Ft.string(),schematic_component_id:Ft.string(),pin_spacing:l_.optional(),pin_styles:m6e.optional(),box_width:l_.optional(),symbol_name:Ft.string().optional(),port_arrangement:g6e.optional(),port_labels:Ft.record(Ft.string()).optional(),symbol_display_value:Ft.string().optional()}),x6e=Ft.object({type:Ft.literal("schematic_line"),schematic_component_id:Ft.string(),x1:pc,x2:pc,y1:pc,y2:pc}),b6e=Ft.object({type:Ft.literal("schematic_trace"),schematic_trace_id:Ft.string(),source_trace_id:Ft.string(),junctions:Ft.array(Ft.object({x:Ft.number(),y:Ft.number()})),edges:Ft.array(Ft.object({from:Ft.object({x:Ft.number(),y:Ft.number()}),to:Ft.object({x:Ft.number(),y:Ft.number()}),is_crossing:Ft.boolean().optional(),from_schematic_port_id:Ft.string().optional(),to_schematic_port_id:Ft.string().optional()}))}),S6e=Ft.object({type:Ft.literal("schematic_text"),schematic_component_id:Ft.string(),schematic_text_id:Ft.string(),text:Ft.string(),position:Ft.object({x:pc,y:pc}),rotation:Ft.number().default(0),anchor:Ft.enum(["center","left","right","top","bottom"]).default("center"),color:Ft.string().default("#000000")}),E6e=Ft.object({type:Ft.literal("schematic_port"),schematic_port_id:Ft.string(),source_port_id:Ft.string(),schematic_component_id:Ft.string().optional(),center:Jy,facing_direction:Ft.enum(["up","down","left","right"]).optional(),distance_from_component_edge:Ft.number().optional(),side_of_component:Ft.enum(["top","bottom","left","right"]).optional(),true_ccw_index:Ft.number().optional(),pin_number:Ft.number().optional(),display_pin_label:Ft.string().optional()}).describe("Defines a port on a schematic component"),w6e=Ft.object({type:Ft.literal("schematic_net_label"),source_net_id:Ft.string(),center:Jy,anchor_position:Jy.optional(),anchor_side:Ft.enum(["top","bottom","left","right"]),text:Ft.string(),symbol_name:Ft.string().optional()}),T6e=Ft.object({type:Ft.literal("schematic_error"),schematic_error_id:Ft.string(),error_type:Ft.literal("schematic_port_not_found"),message:Ft.string()}).describe("Defines a schematic error on the schematic"),oO=Ft.object({type:Ft.literal("schematic_debug_object"),label:Ft.string().optional()}),M6e=oO.extend({shape:Ft.literal("rect"),center:Jy,size:bK}),C6e=oO.extend({shape:Ft.literal("line"),start:Jy,end:Jy}),R6e=oO.extend({shape:Ft.literal("point"),center:Jy}),A6e=Ft.discriminatedUnion("shape",[M6e,C6e,R6e]),D6e=Ft.object({type:Ft.literal("schematic_voltage_probe"),schematic_voltage_probe_id:Ft.string(),position:Jy,schematic_trace_id:Ft.string(),voltage:xK.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),sO=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],zK=Ft.enum(sO),k9=zK.or(Ft.object({name:zK})).transform(r=>typeof r=="string"?r:r.name),lw=Ft.enum(["top","bottom"]),P6e=Ft.object({x:pc,y:pc,via:Ft.boolean().optional(),via_to_layer:k9.optional()}),Rxt=Ft.array(P6e),N6e=Ft.object({x:pc,y:pc,via:Ft.boolean().optional(),to_layer:k9.optional(),trace_width:pc.optional()}),L6e=Ft.object({type:Ft.literal("pcb_component"),pcb_component_id:i1("pcb_component"),source_component_id:Ft.string(),center:Jy,layer:k9,rotation:iO,width:l_,height:l_}).describe("Defines a component on the PCB"),O6e=Ft.object({type:Ft.literal("pcb_hole"),pcb_hole_id:i1("pcb_hole"),hole_shape:Ft.enum(["circle","square"]),hole_diameter:Ft.number(),x:pc,y:pc}),Axt=O6e.describe("Defines a circular or square hole on the PCB"),U6e=Ft.object({type:Ft.literal("pcb_hole"),pcb_hole_id:i1("pcb_hole"),hole_shape:Ft.literal("oval"),hole_width:Ft.number(),hole_height:Ft.number(),x:pc,y:pc}),Dxt=U6e.describe("Defines an oval hole on the PCB"),z6e=O6e.or(U6e),Pxt=Ft.object({type:Ft.literal("pcb_plated_hole"),shape:Ft.literal("circle"),outer_diameter:Ft.number(),hole_diameter:Ft.number(),x:pc,y:pc,layers:Ft.array(k9),port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional(),pcb_plated_hole_id:i1("pcb_plated_hole")}),Nxt=Ft.object({type:Ft.literal("pcb_plated_hole"),shape:Ft.enum(["oval","pill"]),outer_width:Ft.number(),outer_height:Ft.number(),hole_width:Ft.number(),hole_height:Ft.number(),x:pc,y:pc,layers:Ft.array(k9),port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional(),pcb_plated_hole_id:i1("pcb_plated_hole")}),Lxt=Ft.object({type:Ft.literal("pcb_plated_hole"),shape:Ft.literal("circular_hole_with_rect_pad"),hole_shape:Ft.literal("circle"),pad_shape:Ft.literal("rect"),hole_diameter:Ft.number(),rect_pad_width:Ft.number(),rect_pad_height:Ft.number(),x:pc,y:pc,layers:Ft.array(k9),port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional(),pcb_plated_hole_id:i1("pcb_plated_hole")}),F6e=Ft.union([Pxt,Nxt,Lxt]),I6e=Ft.object({type:Ft.literal("pcb_port"),pcb_port_id:i1("pcb_port"),source_port_id:Ft.string(),pcb_component_id:Ft.string(),x:pc,y:pc,layers:Ft.array(k9)}).describe("Defines a port on the PCB"),Oxt=Ft.object({type:Ft.literal("pcb_smtpad"),shape:Ft.literal("circle"),pcb_smtpad_id:i1("pcb_smtpad"),x:pc,y:pc,radius:Ft.number(),layer:k9,port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional()}),Uxt=Ft.object({type:Ft.literal("pcb_smtpad"),shape:Ft.literal("rect"),pcb_smtpad_id:i1("pcb_smtpad"),x:pc,y:pc,width:Ft.number(),height:Ft.number(),layer:k9,port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional()}),zxt=Ft.object({type:Ft.literal("pcb_smtpad"),shape:Ft.literal("rotated_rect"),pcb_smtpad_id:i1("pcb_smtpad"),x:pc,y:pc,width:Ft.number(),height:Ft.number(),ccw_rotation:iO,layer:k9,port_hints:Ft.array(Ft.string()).optional(),pcb_component_id:Ft.string().optional(),pcb_port_id:Ft.string().optional()}),k6e=Ft.union([Oxt,Uxt,zxt]).describe("Defines an SMT pad on the PCB"),Fxt=Ft.object({type:Ft.literal("pcb_solder_paste"),shape:Ft.literal("circle"),pcb_solder_paste_id:i1("pcb_solder_paste"),x:pc,y:pc,radius:Ft.number(),layer:k9,pcb_component_id:Ft.string().optional(),pcb_smtpad_id:Ft.string().optional()}),Ixt=Ft.object({type:Ft.literal("pcb_solder_paste"),shape:Ft.literal("rect"),pcb_solder_paste_id:i1("pcb_solder_paste"),x:pc,y:pc,width:Ft.number(),height:Ft.number(),layer:k9,pcb_component_id:Ft.string().optional(),pcb_smtpad_id:Ft.string().optional()}),B6e=Ft.union([Fxt,Ixt]).describe("Defines solderpaste on the PCB"),H6e=Ft.object({type:Ft.literal("pcb_text"),pcb_text_id:i1("pcb_text"),text:Ft.string(),center:Jy,layer:k9,width:l_,height:l_,lines:Ft.number(),align:Ft.enum(["bottom-left"])}).describe("Defines text on the PCB"),V6e=Ft.object({route_type:Ft.literal("wire"),x:pc,y:pc,width:pc,start_pcb_port_id:Ft.string().optional(),end_pcb_port_id:Ft.string().optional(),layer:k9}),j6e=Ft.object({route_type:Ft.literal("via"),x:pc,y:pc,from_layer:Ft.string(),to_layer:Ft.string()}),kxt=Ft.union([V6e,j6e]),G6e=Ft.object({type:Ft.literal("pcb_trace"),source_trace_id:Ft.string().optional(),pcb_component_id:Ft.string().optional(),pcb_trace_id:i1("pcb_trace"),route_thickness_mode:Ft.enum(["constant","interpolated"]).default("constant").optional(),route_order_index:Ft.number().optional(),should_round_corners:Ft.boolean().optional(),trace_length:Ft.number().optional(),route:Ft.array(Ft.union([Ft.object({route_type:Ft.literal("wire"),x:pc,y:pc,width:pc,start_pcb_port_id:Ft.string().optional(),end_pcb_port_id:Ft.string().optional(),layer:k9}),Ft.object({route_type:Ft.literal("via"),x:pc,y:pc,from_layer:Ft.string(),to_layer:Ft.string()})]))}).describe("Defines a trace on the PCB"),q6e=Ft.object({type:Ft.literal("pcb_trace_error"),pcb_trace_error_id:i1("pcb_trace_error"),error_type:Ft.literal("pcb_trace_error"),message:Ft.string(),center:Jy.optional(),pcb_trace_id:Ft.string(),source_trace_id:Ft.string(),pcb_component_ids:Ft.array(Ft.string()),pcb_port_ids:Ft.array(Ft.string())}).describe("Defines a trace error on the PCB"),Y6e=Ft.object({type:Ft.literal("pcb_port_not_matched_error"),pcb_error_id:i1("pcb_error"),message:Ft.string(),pcb_component_ids:Ft.array(Ft.string())}).describe("Defines a trace error on the PCB where a port is not matched"),X6e=Ft.object({type:Ft.literal("pcb_via"),pcb_via_id:i1("pcb_via"),x:pc,y:pc,outer_diameter:pc.default("0.6mm"),hole_diameter:pc.default("0.25mm"),from_layer:k9.optional(),to_layer:k9.optional(),layers:Ft.array(k9),pcb_trace_id:Ft.string().optional()}).describe("Defines a via on the PCB"),W6e=Ft.object({type:Ft.literal("pcb_board"),pcb_board_id:i1("pcb_board"),width:l_,height:l_,center:Jy,thickness:l_.optional().default(1.4),num_layers:Ft.number().optional().default(4),outline:Ft.array(Jy).optional()}).describe("Defines the board outline of the PCB"),$6e=Ft.object({type:Ft.literal("pcb_placement_error"),pcb_placement_error_id:i1("pcb_placement_error"),message:Ft.string()}).describe("Defines a placement error on the PCB"),Z6e=Ft.object({type:Ft.literal("pcb_trace_hint"),pcb_trace_hint_id:i1("pcb_trace_hint"),pcb_port_id:Ft.string(),pcb_component_id:Ft.string(),route:Ft.array(N6e)}).describe("A hint that can be used during generation of a PCB trace"),Q6e=Ft.object({type:Ft.literal("pcb_silkscreen_line"),pcb_silkscreen_line_id:i1("pcb_silkscreen_line"),pcb_component_id:Ft.string(),stroke_width:pc.default("0.1mm"),x1:pc,y1:pc,x2:pc,y2:pc,layer:lw}).describe("Defines a silkscreen line on the PCB"),K6e=Ft.object({type:Ft.literal("pcb_silkscreen_path"),pcb_silkscreen_path_id:i1("pcb_silkscreen_path"),pcb_component_id:Ft.string(),layer:lw,route:Ft.array(Jy),stroke_width:l_}).describe("Defines a silkscreen path on the PCB"),J6e=Ft.object({type:Ft.literal("pcb_silkscreen_text"),pcb_silkscreen_text_id:i1("pcb_silkscreen_text"),font:Ft.literal("tscircuit2024").default("tscircuit2024"),font_size:pc.default("0.2mm"),pcb_component_id:Ft.string(),text:Ft.string(),ccw_rotation:Ft.number().optional(),layer:k9,is_mirrored:Ft.boolean().default(!1).optional(),anchor_position:Jy.default({x:0,y:0}),anchor_alignment:Ft.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center")}).describe("Defines silkscreen text on the PCB"),ewe=Ft.object({type:Ft.literal("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:i1("pcb_silkscreen_rect"),pcb_component_id:Ft.string(),center:Jy,width:l_,height:l_,layer:k9}).describe("Defines a silkscreen rect on the PCB"),twe=Ft.object({type:Ft.literal("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:i1("pcb_silkscreen_circle"),pcb_component_id:Ft.string(),center:Jy,radius:l_,layer:lw}).describe("Defines a silkscreen circle on the PCB"),nwe=Ft.object({type:Ft.literal("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:i1("pcb_silkscreen_oval"),pcb_component_id:Ft.string(),center:Jy,radius_x:pc,radius_y:pc,layer:lw}).describe("Defines a silkscreen oval on the PCB"),rwe=Ft.object({type:Ft.literal("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:i1("pcb_fabrication_note_text"),font:Ft.literal("tscircuit2024").default("tscircuit2024"),font_size:pc.default("1mm"),pcb_component_id:Ft.string(),text:Ft.string(),layer:lw,anchor_position:Jy.default({x:0,y:0}),anchor_alignment:Ft.enum(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:Ft.string().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),iwe=Ft.object({type:Ft.literal("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:i1("pcb_fabrication_note_path"),pcb_component_id:Ft.string(),layer:k9,route:Ft.array(Jy),stroke_width:l_,color:Ft.string().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),awe=Ft.object({type:Ft.literal("pcb_keepout"),shape:Ft.literal("rect"),center:Jy,width:pc,height:pc,pcb_keepout_id:Ft.string(),layers:Ft.array(Ft.string()),description:Ft.string().optional()}).or(Ft.object({type:Ft.literal("pcb_keepout"),shape:Ft.literal("circle"),center:Jy,radius:pc,pcb_keepout_id:Ft.string(),layers:Ft.array(Ft.string()),description:Ft.string().optional()})),owe=Ft.object({type:Ft.literal("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:i1("pcb_missing_footprint_error"),error_type:Ft.literal("pcb_missing_footprint_error"),source_component_id:Ft.string(),message:Ft.string()}).describe("Defines a missing footprint error on the PCB"),swe=Ft.object({type:Ft.literal("pcb_manual_edit_conflict_error"),pcb_error_id:i1("pcb_manual_edit_conflict_error"),message:Ft.string(),pcb_component_id:Ft.string(),source_component_id:Ft.string()}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),lwe=Ft.object({type:Ft.literal("pcb_group"),pcb_group_id:i1("pcb_group"),width:l_,height:l_,center:Jy,pcb_component_ids:Ft.array(Ft.string()),name:Ft.string().optional(),description:Ft.string().optional()}).describe("Defines a group of components on the PCB"),cwe=Ft.object({type:Ft.literal("cad_component"),cad_component_id:Ft.string(),pcb_component_id:Ft.string(),source_component_id:Ft.string(),position:oC,rotation:oC.optional(),size:oC.optional(),layer:k9.optional(),footprinter_string:Ft.string().optional(),model_obj_url:Ft.string().optional(),model_stl_url:Ft.string().optional(),model_3mf_url:Ft.string().optional(),model_jscad:Ft.any().optional()}).describe("Defines a component on the PCB"),uwe=Ft.union([u6e,c6e,l6e,MK,d6e,f6e,wK,TK,SK,aO,EK,CK,RK,AK,NK,LK,OK,UK,PK,DK,L6e,z6e,owe,swe,F6e,awe,I6e,H6e,G6e,X6e,k6e,B6e,W6e,lwe,Z6e,Q6e,K6e,J6e,ewe,twe,nwe,q6e,$6e,Y6e,iwe,rwe,h6e,S6e,x6e,_6e,E6e,b6e,p6e,T6e,w6e,A6e,D6e,cwe]),fwe=uwe,FK=(r,e={})=>{let t=r._internal_store;if(!t){t={counts:{}},r._internal_store=t;for(const i of r){const a=i.type,o=i[`${a}_id`];if(!o)continue;const s=Number.parseInt(o.split("_").pop());Number.isNaN(s)||(t.counts[a]=Math.max(t.counts[a]??0,s))}}return new Proxy({},{get:(i,a)=>a==="toArray"?()=>r:{get:o=>r.find(s=>s.type===a&&s[`${a}_id`]===o),getUsing:o=>{const s=Object.keys(o);if(s.length!==1)throw new Error("getUsing requires exactly one key, e.g. { pcb_component_id }");const l=s[0],c=l.replace("_id",""),u=r.find(h=>h.type===c&&h[l]===o[l]);return u?r.find(h=>h.type===a&&h[`${a}_id`]===u[`${a}_id`]):null},getWhere:o=>{const s=Object.keys(o);return r.find(l=>l.type===a&&s.every(c=>l[c]===o[c]))},list:o=>{const s=o?Object.keys(o):[];return r.filter(l=>l.type===a&&s.every(c=>l[c]===o[c]))},insert:o=>{var c;(c=t.counts)[a]??(c[a]=-1),t.counts[a]++;const s=t.counts[a],l={type:a,[`${a}_id`]:`${a}_${s}`,...o};return e.validateInserts&&(F8e[a]??fwe).parse(l),r.push(l),l},delete:o=>{const s=r.find(l=>l[`${a}_id`]===o);s&&r.splice(r.indexOf(s),1)},update:(o,s)=>{const l=r.find(c=>c.type===a&&c[`${a}_id`]===o);if(l)return Object.assign(l,s),l},select:o=>{if(a==="source_component")return r.find(s=>s.type==="source_component"&&s.name===o.replace(/\./g,""));if(a==="pcb_port"||a==="source_port"||a==="schematic_port"){const[s,l]=o.replace(/\./g,"").split(/[\s\>]+/),c=r.find(h=>h.type==="source_component"&&h.name===s);if(!c)return null;const u=r.find(h=>h.type==="source_port"&&h.source_component_id===c.source_component_id&&(h.name===l||(h.port_hints??[]).includes(l)));if(!u)return null;if(a==="source_port")return u;if(a==="pcb_port")return r.find(h=>h.type==="pcb_port"&&h.source_port_id===u.source_port_id);if(a==="schematic_port")return r.find(h=>h.type==="schematic_port"&&h.source_port_id===u.source_port_id)}}}})};FK.unparsed=FK;var wS=FK,Bxt=(r,e)=>{if(r.type==="pcb_plated_hole"||r.type==="pcb_hole"||r.type==="pcb_via"||r.type==="pcb_smtpad"||r.type==="pcb_port"){const{x:t,y:n}=ui(e,{x:r.x,y:r.y});r.x=t,r.y=n}else if(r.type==="pcb_keepout"||r.type==="pcb_board")r.center=ui(e,r.center);else if(r.type==="pcb_silkscreen_text"||r.type==="pcb_fabrication_note_text")r.anchor_position=ui(e,r.anchor_position);else if(r.type==="pcb_silkscreen_circle"||r.type==="pcb_silkscreen_rect"||r.type==="pcb_component")r.center=ui(e,r.center);else if(r.type==="pcb_silkscreen_path"||r.type==="pcb_trace"||r.type==="pcb_fabrication_note_path")r.route=r.route.map(t=>{const n=ui(e,t);return t.x=n.x,t.y=n.y,t});else if(r.type==="pcb_silkscreen_line"){const t={x:r.x1,y:r.y1},n={x:r.x2,y:r.y2},i=ui(e,t),a=ui(e,n);r.x1=i.x,r.y1=i.y,r.x2=a.x,r.y2=a.y}else if(r.type==="cad_component"){const t=ui(e,{x:r.position.x,y:r.position.y});r.position.x=t.x,r.position.y=t.y}return r};function Hxt(r){let e=0;if(r.length==0)return e;for(var t=0;t<r.length;t++){var n=r.charCodeAt(t);e=(e<<5)-e+n,e=e&e}return Math.abs(e)}var dwe=[["#69d2e7","#a7dbd8","#e0e4cc","#f38630","#fa6900"],["#fe4365","#fc9d9a","#f9cdad","#c8c8a9","#83af9b"],["#ecd078","#d95b43","#c02942","#542437","#53777a"],["#556270","#4ecdc4","#c7f464","#ff6b6b","#c44d58"],["#774f38","#e08e79","#f1d4af","#ece5ce","#c5e0dc"],["#e8ddcb","#cdb380","#036564","#033649","#031634"],["#490a3d","#bd1550","#e97f02","#f8ca00","#8a9b0f"],["#594f4f","#547980","#45ada8","#9de0ad","#e5fcc2"],["#00a0b0","#6a4a3c","#cc333f","#eb6841","#edc951"],["#e94e77","#d68189","#c6a49a","#c6e5d9","#f4ead5"],["#3fb8af","#7fc7af","#dad8a7","#ff9e9d","#ff3d7f"],["#d9ceb2","#948c75","#d5ded9","#7a6a53","#99b2b7"],["#ffffff","#cbe86b","#f2e9e1","#1c140d","#cbe86b"],["#efffcd","#dce9be","#555152","#2e2633","#99173c"],["#343838","#005f6b","#008c9e","#00b4cc","#00dffc"],["#413e4a","#73626e","#b38184","#f0b49e","#f7e4be"],["#ff4e50","#fc913a","#f9d423","#ede574","#e1f5c4"],["#99b898","#fecea8","#ff847c","#e84a5f","#2a363b"],["#655643","#80bca3","#f6f7bd","#e6ac27","#bf4d28"],["#00a8c6","#40c0cb","#f9f2e7","#aee239","#8fbe00"],["#351330","#424254","#64908a","#e8caa4","#cc2a41"],["#554236","#f77825","#d3ce3d","#f1efa5","#60b99a"],["#5d4157","#838689","#a8caba","#cad7b2","#ebe3aa"],["#8c2318","#5e8c6a","#88a65e","#bfb35a","#f2c45a"],["#fad089","#ff9c5b","#f5634a","#ed303c","#3b8183"],["#ff4242","#f4fad2","#d4ee5e","#e1edb9","#f0f2eb"],["#f8b195","#f67280","#c06c84","#6c5b7b","#355c7d"],["#d1e751","#ffffff","#000000","#4dbce9","#26ade4"],["#1b676b","#519548","#88c425","#bef202","#eafde6"],["#5e412f","#fcebb6","#78c0a8","#f07818","#f0a830"],["#bcbdac","#cfbe27","#f27435","#f02475","#3b2d38"],["#452632","#91204d","#e4844a","#e8bf56","#e2f7ce"],["#eee6ab","#c5bc8e","#696758","#45484b","#36393b"],["#f0d8a8","#3d1c00","#86b8b1","#f2d694","#fa2a00"],["#2a044a","#0b2e59","#0d6759","#7ab317","#a0c55f"],["#f04155","#ff823a","#f2f26f","#fff7bd","#95cfb7"],["#b9d7d9","#668284","#2a2829","#493736","#7b3b3b"],["#bbbb88","#ccc68d","#eedd99","#eec290","#eeaa88"],["#b3cc57","#ecf081","#ffbe40","#ef746f","#ab3e5b"],["#a3a948","#edb92e","#f85931","#ce1836","#009989"],["#300030","#480048","#601848","#c04848","#f07241"],["#67917a","#170409","#b8af03","#ccbf82","#e33258"],["#aab3ab","#c4cbb7","#ebefc9","#eee0b7","#e8caaf"],["#e8d5b7","#0e2430","#fc3a51","#f5b349","#e8d5b9"],["#ab526b","#bca297","#c5ceae","#f0e2a4","#f4ebc3"],["#607848","#789048","#c0d860","#f0f0d8","#604848"],["#b6d8c0","#c8d9bf","#dadabd","#ecdbbc","#fedcba"],["#a8e6ce","#dcedc2","#ffd3b5","#ffaaa6","#ff8c94"],["#3e4147","#fffedf","#dfba69","#5a2e2e","#2a2c31"],["#fc354c","#29221f","#13747d","#0abfbc","#fcf7c5"],["#cc0c39","#e6781e","#c8cf02","#f8fcc1","#1693a7"],["#1c2130","#028f76","#b3e099","#ffeaad","#d14334"],["#a7c5bd","#e5ddcb","#eb7b59","#cf4647","#524656"],["#dad6ca","#1bb0ce","#4f8699","#6a5e72","#563444"],["#5c323e","#a82743","#e15e32","#c0d23e","#e5f04c"],["#edebe6","#d6e1c7","#94c7b6","#403b33","#d3643b"],["#fdf1cc","#c6d6b8","#987f69","#e3ad40","#fcd036"],["#230f2b","#f21d41","#ebebbc","#bce3c5","#82b3ae"],["#b9d3b0","#81bda4","#b28774","#f88f79","#f6aa93"],["#3a111c","#574951","#83988e","#bcdea5","#e6f9bc"],["#5e3929","#cd8c52","#b7d1a3","#dee8be","#fcf7d3"],["#1c0113","#6b0103","#a30006","#c21a01","#f03c02"],["#000000","#9f111b","#b11623","#292c37","#cccccc"],["#382f32","#ffeaf2","#fcd9e5","#fbc5d8","#f1396d"],["#e3dfba","#c8d6bf","#93ccc6","#6cbdb5","#1a1f1e"],["#f6f6f6","#e8e8e8","#333333","#990100","#b90504"],["#1b325f","#9cc4e4","#e9f2f9","#3a89c9","#f26c4f"],["#a1dbb2","#fee5ad","#faca66","#f7a541","#f45d4c"],["#c1b398","#605951","#fbeec2","#61a6ab","#accec0"],["#5e9fa3","#dcd1b4","#fab87f","#f87e7b","#b05574"],["#951f2b","#f5f4d7","#e0dfb1","#a5a36c","#535233"],["#8dccad","#988864","#fea6a2","#f9d6ac","#ffe9af"],["#2d2d29","#215a6d","#3ca2a2","#92c7a3","#dfece6"],["#413d3d","#040004","#c8ff00","#fa023c","#4b000f"],["#eff3cd","#b2d5ba","#61ada0","#248f8d","#605063"],["#ffefd3","#fffee4","#d0ecea","#9fd6d2","#8b7a5e"],["#cfffdd","#b4dec1","#5c5863","#a85163","#ff1f4c"],["#9dc9ac","#fffec7","#f56218","#ff9d2e","#919167"],["#4e395d","#827085","#8ebe94","#ccfc8e","#dc5b3e"],["#a8a7a7","#cc527a","#e8175d","#474747","#363636"],["#f8edd1","#d88a8a","#474843","#9d9d93","#c5cfc6"],["#046d8b","#309292","#2fb8ac","#93a42a","#ecbe13"],["#f38a8a","#55443d","#a0cab5","#cde9ca","#f1edd0"],["#a70267","#f10c49","#fb6b41","#f6d86b","#339194"],["#ff003c","#ff8a00","#fabe28","#88c100","#00c176"],["#ffedbf","#f7803c","#f54828","#2e0d23","#f8e4c1"],["#4e4d4a","#353432","#94ba65","#2790b0","#2b4e72"],["#0ca5b0","#4e3f30","#fefeeb","#f8f4e4","#a5b3aa"],["#4d3b3b","#de6262","#ffb88c","#ffd0b3","#f5e0d3"],["#fffbb7","#a6f6af","#66b6ab","#5b7c8d","#4f2958"],["#edf6ee","#d1c089","#b3204d","#412e28","#151101"],["#9d7e79","#ccac95","#9a947c","#748b83","#5b756c"],["#fcfef5","#e9ffe1","#cdcfb7","#d6e6c3","#fafbe3"],["#9cddc8","#bfd8ad","#ddd9ab","#f7af63","#633d2e"],["#30261c","#403831","#36544f","#1f5f61","#0b8185"],["#aaff00","#ffaa00","#ff00aa","#aa00ff","#00aaff"],["#d1313d","#e5625c","#f9bf76","#8eb2c5","#615375"],["#ffe181","#eee9e5","#fad3b2","#ffba7f","#ff9c97"],["#73c8a9","#dee1b6","#e1b866","#bd5532","#373b44"],["#805841","#dcf7f3","#fffcdd","#ffd8d8","#f5a2a2"]],Vxt=r=>{var s,l,c;let{x:e,y:t,width:n,height:i}={...r,...r.size,...r.center,...r.position};r.x1!==void 0&&r.x2!==void 0&&r.y1!==void 0&&r.y2!==void 0&&(e=(r.x1+r.x2)/2,t=(r.y1+r.y2)/2,n=Math.abs(r.x1-r.x2),i=Math.abs(r.y1-r.y2));const a=r.text||r.name||((s=r.source)==null?void 0:s.text)||((l=r.source)==null?void 0:l.name)||"?",o=r;return e===void 0||t===void 0?null:(n===void 0&&"outer_diameter"in r&&(n=r.outer_diameter,i=r.outer_diameter),(n===void 0||i===void 0)&&(n=.1,i=.1),{x:e,y:t,width:n,height:i,title:a,content:o,bg_color:((c=dwe[Hxt(r.type||a)%dwe.length])==null?void 0:c[4])??"#f00"})},jxt=r=>!!r,Gxt=r=>{const e=r.filter(c=>c.type.startsWith("pcb_")).concat(r.filter(c=>c.type==="pcb_trace").flatMap(c=>c.route)).map(c=>Vxt(c)).filter(jxt);if(e.length===0)return{center:{x:0,y:0},width:0,height:0};let t=e[0].x-e[0].width/2,n=e[0].x+e[0].width/2,i=e[0].y-e[0].height/2,a=e[0].y+e[0].height/2;for(const c of e.slice(1))t=Math.min(t,c.x-c.width/2),n=Math.max(n,c.x+c.width/2),i=Math.min(i,c.y-c.height/2),a=Math.max(a,c.y+c.height/2);const o=n-t,s=a-i;return{center:{x:t+o/2,y:i+s/2},width:o,height:s}},qxt=(r={})=>mlt(e=>({selected_layer:"top",pcb_viewer_id:`pcb_viewer_${Math.random().toString().slice(2,10)}`,in_edit_mode:!1,in_move_footprint_mode:!1,in_draw_trace_mode:!1,is_moving_component:!1,is_drawing_trace:!1,is_mouse_over_container:!1,is_showing_multiple_traces_length:!1,is_showing_rats_nest:!1,...r,selectLayer:t=>e({selected_layer:t}),setEditMode:t=>e({in_edit_mode:t!=="off",in_move_footprint_mode:t==="move_footprint",in_draw_trace_mode:t==="draw_trace",is_moving_component:!1,is_drawing_trace:!1}),setIsShowingRatsNest:t=>e({is_showing_rats_nest:t}),setIsMovingComponent:t=>e({is_moving_component:t}),setIsDrawingTrace:t=>e({is_drawing_trace:t}),setIsMouseOverContainer:t=>e({is_mouse_over_container:t}),setIsShowingMultipleTracesLength:t=>e({is_showing_multiple_traces_length:t})})),i2=r=>{const e=Tt.useContext(hwe);return Clt(e,r)},hwe=Tt.createContext(null),Yxt=({children:r,initialState:e})=>{const t=Tt.useMemo(()=>qxt(e),[]);return gt.jsx(hwe.Provider,{value:t,children:r})},Xxt=(r,e)=>{if(r.find(n=>n.type==="pcb_trace_hint"&&n.pcb_trace_hint_id===e.pcb_trace_hint_id))r=r.map(n=>n.pcb_trace_hint_id===e.pcb_trace_hint_id?{...n,route:e.route}:n);else{const n=wS(r).pcb_port.get(e.pcb_port_id);r=r.filter(i=>!(i.type==="pcb_trace_hint"&&i.pcb_port_id===e.pcb_port_id)).concat([{type:"pcb_trace_hint",pcb_trace_hint_id:e.pcb_trace_hint_id,route:e.route,pcb_port_id:e.pcb_port_id,pcb_component_id:n==null?void 0:n.pcb_component_id}])}return r},Wxt=(r,e)=>{r=JSON.parse(JSON.stringify(r));for(const t of e)if(t.pcb_edit_event_type==="edit_component_location"){const n=rv(t.new_center.x-t.original_center.x,t.new_center.y-t.original_center.y);r=r.map(i=>i.pcb_component_id!==t.pcb_component_id?i:Bxt(i,n))}else t.pcb_edit_event_type==="edit_trace_hint"&&(r=Xxt(r,t));return r},$xt=()=>{const r=i2(t=>t.pcb_viewer_id),e=(t,n)=>Dy(t,{containerId:r,...n});return e.error=(t,n)=>Dy.error(t,{containerId:r,...n}),e.promise=Dy.promise,e},Zxt=()=>{Tt.useEffect(()=>{y9t()},[]);const r=i2(e=>e.pcb_viewer_id);return gt.jsx(v9t,{position:"top-center",containerId:r})},Qxt=function(){},pwe=typeof window<"u",Kxt=pwe?Tt.useLayoutEffect:Tt.useEffect,Jxt=Kxt,mwe={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function e5t(){var r=Tt.useState(null),e=r[0],t=r[1],n=Tt.useState(mwe),i=n[0],a=n[1],o=Tt.useMemo(function(){return new window.ResizeObserver(function(s){if(s[0]){var l=s[0].contentRect,c=l.x,u=l.y,h=l.width,g=l.height,_=l.top,b=l.left,T=l.bottom,C=l.right;a({x:c,y:u,width:h,height:g,top:_,left:b,bottom:T,right:C})}})},[]);return Jxt(function(){if(e)return o.observe(e),function(){o.disconnect()}},[e]),[t,i]}var t5t=pwe&&typeof window.ResizeObserver<"u"?e5t:function(){return[Qxt,mwe]},n5t=(r={})=>{const e=Tt.useRef(null),[t,n]=Tt.useState(0),i=r.canvasElm??e.current,[a,o]=Tt.useState(r.initialTransform??C_()),[s,l]=Tt.useState(0),[c,u]=Tt.useReducer(C=>C+1,0),h=Tt.useCallback(C=>{r.onSetTransform&&r.onSetTransform(C),r.transform||o(C)},[r.onSetTransform,o]),g=Tt.useCallback(C=>{h(C),u()},[h]),_=r.transform??a,b=Tt.useCallback(()=>{n(Date.now())},[]);Tt.useEffect(()=>{const C=r.canvasElm??e.current;if(C&&!i){l(s+1);return}if(!C){const me=setTimeout(()=>{l(s+1)},100);return()=>clearTimeout(me)}let A=r.transform??a,L={x:0,y:0},U={x:0,y:0},j=!1;const Z=me=>({x:me.pageX-C.getBoundingClientRect().left-window.scrollX,y:me.pageY-C.getBoundingClientRect().top-window.scrollY});function ee(me){r.enabled!==!1&&(r.shouldDrag&&!r.shouldDrag(me)||(L=Z(me),!(Date.now()-t<100)&&(j=!0,me.preventDefault())))}function $(me){if(!j||r.enabled===!1||r.shouldDrag&&!r.shouldDrag(me))return;U=Z(me);const _e=oh(rv(U.x-L.x,U.y-L.y),A);h(_e),A=_e,j=!1}function oe(me){Z(me),!(!j||r.enabled===!1)&&(r.shouldDrag&&!r.shouldDrag(me)||(U=Z(me),h(oh(rv(U.x-L.x,U.y-L.y),A))))}function ae(me){if(r.enabled===!1||r.shouldDrag&&!r.shouldDrag(me))return;const _e=Z(me),Se=oh(rv(_e.x,_e.y),_2(1-me.deltaY/1e3,1-me.deltaY/1e3),rv(-_e.x,-_e.y),A);h(Se),A=Se,me.preventDefault()}function ce(me){if(!j||r.shouldDrag&&!r.shouldDrag(me))return;if(C){const Se=C.getBoundingClientRect();if(me.clientX>=Se.left+10&&me.clientX<=Se.right-10&&me.clientY>=Se.top+10&&me.clientY<=Se.bottom-10)return}j=!1,U=Z(me);const _e=oh(rv(U.x-L.x,U.y-L.y),A);h(_e),A=_e}return C.addEventListener("mousedown",ee),C.addEventListener("mouseup",$),window.addEventListener("mousemove",oe),C.addEventListener("mouseout",ce),C.addEventListener("wheel",ae),()=>{C.removeEventListener("mousedown",ee),C.removeEventListener("mouseup",$),window.removeEventListener("mousemove",oe),C.removeEventListener("mouseout",ce),C.removeEventListener("wheel",ae)}},[i,s,c,t,r.enabled,r.shouldDrag]);const T=Tt.useCallback(C=>ui(_,C),[_]);return{ref:e,transform:_,applyTransformToPoint:T,setTransform:g,cancelDrag:b}},r5t=n5t,r5={"3d_viewer":{background_bottom:"rgb(102, 102, 128)",background_top:"rgb(204, 204, 230)",board:"rgb(51, 43, 23)",copper:"rgb(179, 156, 0)",silkscreen_bottom:"rgb(230, 230, 230)",silkscreen_top:"rgb(230, 230, 230)",soldermask:"rgb(20, 51, 36)",solderpaste:"rgb(128, 128, 128)"},board:{anchor:"rgb(255, 38, 226)",aux_items:"rgb(255, 255, 255)",b_adhes:"rgb(0, 0, 132)",b_crtyd:"rgb(255, 38, 226)",b_fab:"rgb(88, 93, 132)",b_mask:"rgba(2, 255, 238, 0.400)",b_paste:"rgb(0, 194, 194)",b_silks:"rgb(232, 178, 167)",background:"rgb(0, 16, 35)",cmts_user:"rgb(89, 148, 220)",copper:{b:"rgb(77, 127, 196)",f:"rgb(200, 52, 52)",in1:"rgb(127, 200, 127)",in10:"rgb(237, 124, 51)",in11:"rgb(91, 195, 235)",in12:"rgb(247, 111, 142)",in13:"rgb(167, 165, 198)",in14:"rgb(40, 204, 217)",in15:"rgb(232, 178, 167)",in16:"rgb(242, 237, 161)",in17:"rgb(237, 124, 51)",in18:"rgb(91, 195, 235)",in19:"rgb(247, 111, 142)",in2:"rgb(206, 125, 44)",in20:"rgb(167, 165, 198)",in21:"rgb(40, 204, 217)",in22:"rgb(232, 178, 167)",in23:"rgb(242, 237, 161)",in24:"rgb(237, 124, 51)",in25:"rgb(91, 195, 235)",in26:"rgb(247, 111, 142)",in27:"rgb(167, 165, 198)",in28:"rgb(40, 204, 217)",in29:"rgb(232, 178, 167)",in3:"rgb(79, 203, 203)",in30:"rgb(242, 237, 161)",in4:"rgb(219, 98, 139)",in5:"rgb(167, 165, 198)",in6:"rgb(40, 204, 217)",in7:"rgb(232, 178, 167)",in8:"rgb(242, 237, 161)",in9:"rgb(141, 203, 129)"},cursor:"rgb(255, 255, 255)",drc:"rgb(194, 194, 194)",drc_error:"rgba(215, 91, 107, 0.800)",drc_exclusion:"rgb(255, 255, 255)",drc_warning:"rgba(255, 208, 66, 0.902)",dwgs_user:"rgb(194, 194, 194)",eco1_user:"rgb(180, 219, 210)",eco2_user:"rgb(216, 200, 82)",edge_cuts:"rgb(208, 210, 205)",f_adhes:"rgb(132, 0, 132)",f_crtyd:"rgb(255, 0, 245)",f_fab:"rgb(175, 175, 175)",f_mask:"rgba(216, 100, 255, 0.400)",f_paste:"rgba(180, 160, 154, 0.902)",f_silks:"rgb(242, 237, 161)",footprint_text_back:"rgb(0, 0, 132)",footprint_text_front:"rgb(194, 194, 194)",footprint_text_invisible:"rgb(132, 132, 132)",grid:"rgb(132, 132, 132)",grid_axes:"rgb(194, 194, 194)",margin:"rgb(255, 38, 226)",microvia:"rgb(0, 132, 132)",no_connect:"rgb(0, 0, 132)",pad_back:"rgb(77, 127, 196)",pad_front:"rgb(200, 52, 52)",pad_plated_hole:"rgb(194, 194, 0)",pad_through_hole:"rgb(227, 183, 46)",plated_hole:"rgb(26, 196, 210)",ratsnest:"rgba(245, 255, 213, 0.702)",select_overlay:"rgb(4, 255, 67)",through_via:"rgb(236, 236, 236)",user_1:"rgb(194, 194, 194)",user_2:"rgb(89, 148, 220)",user_3:"rgb(180, 219, 210)",user_4:"rgb(216, 200, 82)",user_5:"rgb(194, 194, 194)",user_6:"rgb(89, 148, 220)",user_7:"rgb(180, 219, 210)",user_8:"rgb(216, 200, 82)",user_9:"rgb(232, 178, 167)",via_blind_buried:"rgb(187, 151, 38)",via_hole:"rgb(227, 183, 46)",via_micro:"rgb(0, 132, 132)",via_through:"rgb(236, 236, 236)",worksheet:"rgb(200, 114, 171)"},gerbview:{axes:"rgb(0, 0, 132)",background:"rgb(0, 0, 0)",dcodes:"rgb(255, 255, 255)",grid:"rgb(132, 132, 132)",layers:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)","rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)"],negative_objects:"rgb(132, 132, 132)",worksheet:"rgb(0, 0, 132)"},palette:["rgb(132, 0, 0)","rgb(194, 194, 0)","rgb(194, 0, 194)","rgb(194, 0, 0)","rgb(0, 132, 132)","rgb(0, 132, 0)","rgb(0, 0, 132)","rgb(132, 132, 132)","rgb(132, 0, 132)","rgb(194, 194, 194)","rgb(132, 0, 132)","rgb(132, 0, 0)","rgb(132, 132, 0)","rgb(194, 194, 194)","rgb(0, 0, 132)","rgb(0, 132, 0)"],schematic:{anchor:"rgb(0, 0, 255)",aux_items:"rgb(0, 0, 0)",background:"rgb(33, 33, 33)",brightened:"rgb(204, 204, 204)",bus:"rgb(0, 96, 192)",bus_junction:"rgb(0, 96, 192)",component_body:"rgb(44, 44, 44)",component_outline:"rgb(192, 0, 0)",cursor:"rgb(224, 224, 224)",erc_error:"rgba(192, 48, 48, 0.800)",erc_warning:"rgba(192, 140, 0, 0.800)",fields:"rgb(128, 0, 160)",grid:"rgb(60, 60, 60)",grid_axes:"rgb(60, 60, 60)",hidden:"rgb(194, 194, 194)",junction:"rgb(0, 160, 0)",label_global:"rgb(0, 160, 224)",label_hier:"rgb(160, 160, 0)",label_local:"rgb(192, 192, 192)",net_name:"rgb(224, 224, 224)",no_connect:"rgb(97, 43, 224)",note:"rgb(192, 192, 0)",override_item_colors:!1,pin:"rgb(192, 0, 0)",pin_name:"rgb(192, 192, 192)",pin_number:"rgb(192, 0, 0)",reference:"rgb(192, 192, 192)",shadow:"rgba(102, 179, 255, 0.800)",sheet:"rgb(128, 0, 160)",sheet_background:"rgba(255, 255, 255, 0.000)",sheet_fields:"rgb(160, 160, 0)",sheet_filename:"rgb(160, 160, 0)",sheet_label:"rgb(160, 160, 0)",sheet_name:"rgb(0, 160, 204)",value:"rgb(192, 192, 192)",wire:"rgb(0, 160, 0)",worksheet:"rgb(192, 0, 0)"}},Wb=(r,e=1)=>{if(Math.abs(r.a)!==Math.abs(r.d))throw new Error("Cannot scale non-uniformly");return e*Math.abs(r.a)},ub={elementOverlay:30,dimensionOverlay:30,editTraceHintOverlay:30,errorOverlay:30,ratsNestOverlay:20,toolbarOverlay:20,topLayer:10},cw={red:"red",black:"black",green:"green",board:"rgb(255, 255, 255)",other:"#eee",top:r5.board.copper.f,inner1:r5.board.copper.in1,inner2:r5.board.copper.in2,inner4:r5.board.copper.in4,inner5:r5.board.copper.in5,inner6:r5.board.copper.in6,inner7:r5.board.copper.in7,inner8:r5.board.copper.in8,bottom:r5.board.copper.b,drill:r5.board.anchor,keepout:r5.board.background,tkeepout:r5.board.b_crtyd,tplace:r5.board.b_silks,top_silkscreen:r5.board.f_silks,bottom_silkscreen:r5.board.b_silks,top_fabrication:r5.board.f_fab,bottom_fabrication:r5.board.b_fab,...r5.board},i5t=["top","inner1","inner2","inner3","inner4","inner5","inner6","bottom"],a5t=class{constructor(r){ni(this,"canvasLayerMap");ni(this,"ctxLayerMap");ni(this,"aperture");ni(this,"transform");ni(this,"foregroundLayer","top");ni(this,"lastPoint");this.canvasLayerMap=r,this.ctxLayerMap=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t.getContext("2d")])),this.transform=C_(),this.transform.d*=-1,this.transform=oh(this.transform,rv(0,-500)),this.lastPoint={x:0,y:0},this.equip({})}clear(){for(const r of Object.values(this.ctxLayerMap))r.clearRect(0,0,r.canvas.width,r.canvas.height)}equip(r){this.aperture={fontSize:0,shape:"circle",mode:"add",size:0,color:"red",layer:"top",opacity:this.foregroundLayer===r.color?1:.5,...r}}drawMeshPattern(r,e,t,n,i,a=45){const o=this.getLayerCtx(),[s,l]=ui(this.transform,[r,e]),[c,u]=ui(this.transform,[r+t,e+n]),h=Wb(this.transform,i);o.lineWidth=1,o.strokeStyle=this.aperture.color;const g=_=>{const b=Math.sin(_),T=Math.cos(_),C=Math.sqrt(Math.pow(c-s,2)+Math.pow(u-l,2));for(let A=-C;A<=C;A+=h)o.beginPath(),o.moveTo(s+A*T-C*b,l+A*b+C*T),o.lineTo(s+A*T+C*b,l+A*b-C*T),o.stroke()};g(a*Math.PI/180),g((a+90)*Math.PI/180)}rect(r,e,t,n,i){const[a,o]=ui(this.transform,[r-t/2,e-n/2]),[s,l]=ui(this.transform,[r+t/2,e+n/2]);this.applyAperture();const c=this.getLayerCtx();i?(c.save(),c.beginPath(),c.rect(a,o,s-a,l-o),c.clip(),this.drawMeshPattern(r-t/2,e-n/2,t,n,.15),c.restore(),c.strokeRect(a,o,s-a,l-o)):c.fillRect(a,o,s-a,l-o)}rotatedRect(r,e,t,n,i,a){const o=this.getLayerCtx();this.applyAperture();const[s,l]=ui(this.transform,[r-t/2,e-n/2]),[c,u]=ui(this.transform,[r+t/2,e+n/2]);o.save();const[h,g]=ui(this.transform,[r,e]);o.translate(h,g);const _=360-i;i&&o.rotate(_*Math.PI/180),o.translate(-h,-g),a?(o.beginPath(),o.rect(s,l,c-s,u-l),o.clip(),this.drawMeshPattern(r-t/2,e-n/2,t,n,.15),o.strokeRect(s,l,c-s,u-l)):o.fillRect(s,l,c-s,u-l),o.restore()}circle(r,e,t,n){const i=Wb(this.transform,t),[a,o]=ui(this.transform,[r,e]);this.applyAperture();const s=this.getLayerCtx();n?(s.save(),s.beginPath(),s.arc(a,o,i,0,2*Math.PI),s.clip(),this.drawMeshPattern(r-t,e-t,t*2,t*2,.15),s.restore(),s.beginPath(),s.arc(a,o,i,0,2*Math.PI),s.stroke()):(s.beginPath(),s.arc(a,o,i,0,2*Math.PI),s.fill())}oval(r,e,t,n){const i=Wb(this.transform,t),a=Wb(this.transform,n),[o,s]=ui(this.transform,[r,e]);this.applyAperture();const l=this.getLayerCtx();l.beginPath(),l.ellipse(o,s,i,a,0,0,2*Math.PI),l.fill(),l.closePath()}pill(r,e,t,n){const[i,a]=ui(this.transform,[r-t/2,e+n/2]),o=Wb(this.transform,t),s=Wb(this.transform,n),l=Math.min(o,s)/2;this.applyAperture();const c=this.getLayerCtx();c.beginPath(),c.arc(i+l,a+l,l,Math.PI,Math.PI*1.5),c.arc(i+o-l,a+l,l,Math.PI*1.5,0),c.arc(i+o-l,a+s-l,l,0,Math.PI*.5),c.arc(i+l,a+s-l,l,Math.PI*.5,Math.PI),c.fill(),c.closePath()}polygon(r){if(r.length<3)return;this.applyAperture();const e=this.getLayerCtx(),t=r.map(i=>ui(this.transform,[i.x,i.y]));e.beginPath(),e.moveTo(t[0][0],t[0][1]);for(let i=1;i<t.length;i++)e.lineTo(t[i][0],t[i][1]);e.closePath(),e.fill();const n=Wb(this.transform,this.aperture.size);e.lineWidth=n,e.stroke()}debugText(r,e,t){const[n,i]=ui(this.transform,[e,t]);this.applyAperture();const a=this.getLayerCtx();a.font="10px sans-serif",a.fillText(r,n,i)}getLayerCtx(){const r=this.ctxLayerMap[this.aperture.layer];if(!r)throw new Error(`No context for layer "${this.aperture.layer}"`);return r}orderAndFadeLayers(){const{canvasLayerMap:r,foregroundLayer:e}=this,t=new Set([e,"drill","other","board"]);["drill","board",e,...i5t.filter(i=>i!==e)].forEach((i,a)=>{const o=r[i];o&&(o.style.zIndex=`${ub.topLayer-a}`,o.style.opacity=t.has(i)?"1":"0.5")})}applyAperture(){const{transform:r,aperture:e}=this;let{size:t,mode:n,color:i,fontSize:a,layer:o}=e;o in this.ctxLayerMap||(this.aperture.layer="other");const s=this.getLayerCtx();if(!s)throw new Error(`No context for layer "${this.foregroundLayer}"`);if(i||(i="undefined"),s.lineWidth=Wb(r,t),s.lineCap="round",n==="add"){let l=(i==null?void 0:i[0])==="#"||i!=null&&i.startsWith("rgb")?i:cw[i==null?void 0:i.toLowerCase()]?cw[i==null?void 0:i.toLowerCase()]:null;l===null&&(console.warn(`Color mapping for "${i}" not found`),l="white"),s.fillStyle=l,s.strokeStyle=l}else s.globalCompositeOperation="destination-out",s.fillStyle="rgba(0,0,0,1)",s.strokeStyle="rgba(0,0,0,1)";s.font=`${Wb(Mb(r),a)}px sans-serif`}moveTo(r,e){this.lastPoint={x:r,y:e}}lineTo(r,e){const[t,n]=ui(this.transform,[r,e]),{size:i,shape:a,mode:o}=this.aperture,s=Wb(this.transform,i);let{lastPoint:l}=this;const c=ui(this.transform,l);this.applyAperture();const u=this.getLayerCtx();a==="square"&&u.fillRect(c.x-s/2,c.y-s/2,s,s),u.beginPath(),u.moveTo(c.x,c.y),u.lineTo(t,n),u.stroke(),u.closePath(),a==="square"&&u.fillRect(t-s/2,n-s/2,s,s),this.lastPoint={x:r,y:e}}};function o5t(r){const{lines:e,anchorPoint:t,ccwRotation:n}=r;if(!n)return e;const i=n*Math.PI/180,a=l3(i),o=oh(rv(t.x,t.y),a,rv(-t.x,-t.y));return ui(o,t),e.map(s=>({...s,x1:ui(o,{x:s.x1,y:s.y1}).x,y1:ui(o,{x:s.x1,y:s.y1}).y,x2:ui(o,{x:s.x2,y:s.y2}).x,y2:ui(o,{x:s.x2,y:s.y2}).y}))}var vwe={0:"M0.4544564813877358 0L0.2723441540828736 0.03592830447352719L0.1086847233315459 0.14528754990019965L0.020630545837255005 0.3040632652221331L0 0.5395277421960205L0.049259221760993496 0.7369487828466779L0.18080513776237842 0.9005494166306564L0.37036887043974215 0.9872116270037247L0.5864663759301132 1L0.8148695622827444 0.9332890276148733L0.9326583645506394 0.8113052246023419L1 0.4031281830668562L0.833288960385582 0.09886798567812842L0.6801767918233781 0.02483708485091681L0.4544564813877358 0",1:"M 0.198 0.272 L 0.537 0 L 0.54 1",2:"M0.069593147751606 0.19461498231706575L0.1039380353319058 0.1224291500164194L0.20543361884368308 0.05510832064153169L0.3717712794432549 0.009452970962689482L0.4785344452623127 0L0.663238590738758 0.008714098643339864L0.8017933618843684 0.04769189395915288L0.8775637379550322 0.10746757678258442L0.9047778372591005 0.17693069668193287L0.9029710920770878 0.2231347105796246L0.8704496788008566 0.30047744598157516L0.7292906538577354 0.4508486051631194L0.3737955032119913 0.7369006417749693L0 1L1 1",3:"M0.03917438899874637 0.19855364635107545L0.15510940508963084 0.06745632622133718L0.37598645522339846 0L0.8486391893813088 0.0652271323161611L0.9782182415054349 0.21747394183735683L0.9213133780517754 0.3547560290117714L0.6504271515903481 0.4543436297681271L0.22975249764129613 0.48476611625264143L0.7659038682744629 0.5411919558122493L0.9258712987734741 0.6203185665660985L1 0.7458360609169667L0.8938813281118737 0.9059190913045964L0.6166890258875837 1L0.261528440153542 0.9874861530507921L0 0.8837289530851273",4:"M0.7328897338403042 0L0 0.6684672518568535L1 0.6684672518568535M0.7243346007604563 0.4530722484807562L0.7243346007604563 1",5:"M 0 0 L 0 0.4973 L 0.4262 0.4319 L 0.7305 0.4565 L 0.8516 0.5009 L 0.9357 0.5639 L 1 0.7356 L 0.9696 0.8248 L 0.8898 0.895 L 0.733 0.9602 L 0.5518 0.9945 L 0.3814 1 L 0.2379 0.9821 L 0.1219 0.947 L 0 0.8748 M 0 0 L 1 0",6:"M0.6964601700926856 0L0.3639239026215478 0.0743562375769351L0.1415931962925719 0.21735490179786915L0.009977939399608712 0.46336322325406004L0.00029622007592593224 0.7083131475173043L0.09408885043224748 0.8746809149767036L0.3379247445101846 0.9876686500961888L0.7109203869569624 1L0.9260852957913362 0.9103558029693921L1 0.7716571969091733L0.9824294723385016 0.6390635485705886L0.7446504992867332 0.4733643097729175L0.31028858071607296 0.47578021640899115L0.1208702146816024 0.5481452483973847L0 0.6616669755788906",7:"M0 0L1 0L0.9246479649697582 0.030539772727272752L0.8850302419354837 0.05075757575757579L0.7922946068548385 0.11079545454545457L0.7419268208165322 0.15213068181818185L0.6907258064516127 0.20202020202020204L0.6400666267641127 0.26122159090909086L0.5913243447580644 0.33049242424242414L0.5458740234374998 0.4105902777777778L0.5050907258064514 0.5022727272727272L0.4703495148689514 0.6062973484848484L0.43257456133442534 0.787133049242424L0.41612903225806447 1",8:"M0.5143001078924863 0L0.16007477667923162 0.10731570786949331L0.14924628550868277 0.3146018498698755L0.2939585848842112 0.41617921794558677L0.8648302624811545 0.5385163833653317L1 0.7775820770511038L0.8180842915260376 0.9505845566922285L0.41968938540525413 1L0.08062381919779889 0.882831681184498L0 0.6936376947135333L0.17150171673893433 0.5188652309607817L0.6529263782780712 0.4242818653203618L0.8650205888491803 0.29644027376796367L0.8702067371119496 0.09910067291661573L0.5143001078924863 0",9:"M1 0.25379591792994305L0.9514789771111742 0.11679361536614272L0.8702482473521467 0.05711741614054847L0.7327445265851579 0.015213872471965633L0.525248180711544 0L0.3292056884418538 0.012928195113745608L0.15997632037247655 0.058762870026191856L0.05266940041228321 0.12882439350476L0 0.2562067822770946L0.11316462894512366 0.4121335905917837L0.2403060136479954 0.4603365890068938L0.4097241967586011 0.4745978388276783L0.8642414300184816 0.420815170259988L0.9732054796346318 0.34537434075898393L1 0.25379591792994305M0.9647426784191072 0.35488595400360495L0.4756895081034974 1",A:"M0 1L0.4808333333333333 0L1 1M0.24250000000000002 0.6099439775910365L0.7341666666666666 0.6099439775910365",B:"M0 1L0 0.0117369978777208L0.30665717153513444 0L0.5874522807082946 0.03451403469442413L0.7766202217193218 0.15033936404895643L0.7471969743588041 0.31967962568332936L0.5246013359741988 0.4102978954282461L0.04378745314885416 0.44918617613783574L0.5112949594180156 0.469692928091109L0.8540266515643348 0.5552749498651879L1 0.6868463175009967L0.9880091196159324 0.8570018204672155L0.922301719975498 0.9321708046604659L0.7584266951758925 0.9932594737131338L0 1",C:"M1 0.23038928858890784L0.9328355511865092 0.12426412616785204L0.8096380839483327 0.04912601676267708L0.5763225801788256 0L0.4039037709527492 0.015028068281399815L0.2519579390951737 0.06533979308999706L0.10359458463139784 0.18146243506591617L0 0.4862728453971315L0.08129580872733055 0.792689266886982L0.20257034847159672 0.9160822255736587L0.3286572892798542 0.9738230826074175L0.5742878414421707 1L0.7883510303801312 0.9665431511195721L0.946851033994232 0.8689071500976585L1 0.7311049027121912",D:"M0 1L0.015604366822624637 0.020770988281483303L0.22564758265176144 0L0.3865476147957666 0.0024153386496795644L0.6479126635475078 0.051745644338731314L0.841191887805517 0.15827717679529366L0.9517008345536152 0.30172260586872185L0.9957536578687336 0.4504541551987709L1 0.5624359222498485L0.9798483279164735 0.6584121775234548L0.9386273319285215 0.7395945263504481L0.806292129480815 0.8624239259880274L0.6296239151398265 0.9406169638094516L0.3397492767598845 0.9954164354263132L0 1",E:"M0 0L0 1M0 0L1 0M0 0.5L0.7 0.5M0 1L1 1",F:"M0 0L0 1M0.011363636363636364 0.006802721088435374L1 0.006802721088435374M0.011363636363636364 0.4965986394557823L0.8409090909090909 0.4965986394557823",G:"M0.902666857540557 0.03860785012651126L0.6504261864675637 0L0.3838947267237336 0.015442305268228053L0.21293332876776194 0.07706794377239819L0.07799659974941617 0.1994951236187481L0 0.46380381528937314L0.04159964421546915 0.7502491408002389L0.13176692977834842 0.8535497868383203L0.2709176262273927 0.936767572377719L0.4386472596876406 0.9891638569283179L0.6145513562841309 1L0.7782254421419019 0.9585373611026471L0.9092650433859927 0.8540372997461425L1 0.5556012645283437L0.5583959277303046 0.55491741080559",H:"M0 0L0 1M0 0.4788732394366197L0.989010989010989 0.4788732394366197M1 0L1 1",I:"M0.5 0L0.5 1",J:"M0.9976457238788704 0L1 0.7396412315872798L0.9773931362096968 0.8322033314977973L0.9345115952458736 0.882296255506608L0.8743862896259549 0.9221331222466961L0.8024024079884948 0.9526431718061675L0.6443996712151668 0.9893997797356828L0.5035848940343224 1L0.3127211130319937 0.9877004749449337L0.17201910858386513 0.9539509911894274L0.10357419806379677 0.9212555066079295L0.053656568662899015 0.8816079295154184L0.020759483663648916 0.8360407488986785L0.003376206348523566 0.7855864537444934L0 0.7312775330396476",K:"M0 0L0 1M0.8787878787878788 0.06666666666666667L0 0.6148148148148148M0.3333333333333333 0.45925925925925926L1 0.9777777777777777",L:"M0 0L0 1L1 1",M:"M0 1L0 0L0.5 0.6512L1 0L1 1",N:"M0 1L0 0L1 1L0.9803729146221786 0",O:"M0.4718499217948183 1L0.2896765846490613 0.9606979309189402L0.12315162147934663 0.8411184486080473L0 0.4352399966492615L0.11730398524516283 0.13145645436014852L0.2612197451988078 0.04493357858878059L0.5104071592772554 0L0.7450113425917159 0.05393013710105273L0.882367950645524 0.15242300282020502L1 0.5224527406249126L0.9414597290654386 0.7560662329321755L0.8371289514446183 0.8910800547287298L0.6518259868433511 0.9830452628933628L0.4718499217948183 1",P:"M0 1L0 0.018871774228013626L0.29609603495819875 0L0.5609840637427541 0.011794858892508529L0.7332142696692472 0.04353904702296349L0.8102258645858864 0.0691965055027166L0.9330504315465442 0.14445061754775845L0.9876391714147118 0.22527816445836535L1 0.3434414070631638L0.9510549958116356 0.41772808046663146L0.8746646891596713 0.45879131862541683L0.7528523813396283 0.49171525113425024L0.5766919939969619 0.5153253033973054L0.33725744877712827 0.5284469008187558L0.025622667325582785 0.529905468802775",Q:"M0.4618887943546369 0.9755918167206952L0.28356128136544534 0.9372490397450218L0.12055179272160406 0.8205882753548176L0 0.4246165790405623L0.1148276047430244 0.12824784112887844L0.25570518844754375 0.043836831567190586L0.49963205786237674 0L0.7292835601228574 0.0526138004304122L0.8637404608452104 0.14870263423138746L0.9788892040030622 0.5097006183769648L0.9215847647858059 0.7376120297474734L0.8194564929275405 0.869330409436378L0.6380654214095985 0.9590509139448092L0.4618887943546369 0.9755918167206952M0.5824181120212351 0.6861805006946525L1 1",R:"M0 0.9928375167236815L0 0.02590227442068435L0.3611517274211098 0L0.6146286724700761 0.008660554424468435L0.7675462459194776 0.035269459580494614L0.831839975516866 0.056961676692569484L0.8847592491838954 0.08519560521497332L0.9238557535364527 0.120683646438422L0.9583303225312839 0.21691797435320384L0.955092470586235 0.3022616904894429L0.9198097669001631 0.3640573439322699L0.8564862239866702 0.40639258627024005L0.7691258543593579 0.43335506909190874L0.601775027203482 0.4539166070813109L0.023939064200217658 0.46997623755243123M0.5038084874863982 0.5108023922274467L1 1",S:"M0.8886929689221953 0.15146982162688968L0.7276173683050475 0.013780286031594946L0.34582323121005076 0L0.1318235250900008 0.09920162734298861L0.0444543935052531 0.2811287071349243L0.08064065829108809 0.3709571405906485L0.21603115127470426 0.4485505768228281L0.7525409135992945 0.5111160926769565L0.9330263665417677 0.5850732219351329L1 0.7129938124702524L0.9117772389978691 0.9130572743138187L0.6423187128058188 1L0.29586019579751677 0.9935291584506244L0.10638454191462794 0.9229845198431584L0 0.7570771288048773",T:"M0 0L1 0M0.5148514851485149 0L0.5148514851485149 1",U:"M0 0L0.0023103778751369115 0.5467447428390111L0.01823032542100219 0.6954785891481812L0.05895528135268338 0.8056480226151669L0.13703402031421133 0.8894445726483398L0.23918400876232196 0.9448524533417946L0.3917887458926616 0.9848674531975652L0.584341627875137 1L0.7194816196604602 0.9848501456716763L0.8303268115073934 0.9449411544119768L0.8966613970084885 0.898186315516197L0.9251437568455642 0.867453197565408L0.9687114937020809 0.7890904895145239L0.9890470974808324 0.6852857184065537L1 0.0014769088758762145",V:"M0 0L0.5348837209302325 1L1 0",W:"M0 0L0.23300090661831369 0.9873417721518988L0.49954669084315495 0.30081906180193585L0.7851314596554849 1L1 0.0215934475055845",X:"M0 0L0.9893617021276596 1M1 0L0.010638297872340425 1",Y:"M0 0L0.4860515021459227 0.44712562100780695M1 0.0014194464158977947L0.48927038626609437 0.44996451383960256L0.5075107296137339 1",Z:"M0 0L1 0L0 1L1 1",".":"M 0.49 1 L 0.41 1","*":"M 0.5 0.25 L 0.8 0.25 M 0.5 0.25 L 0.5927 0.4402 M 0.5 0.25 L 0.2573 0.3676 M 0.5 0.25 L 0.2573 0.1324 M 0.5 0.25 L 0.599 0.055","(":"M0.75 0L0.25 0.5L0.25 0.5L0.75 1",")":"M0.25 0L0.75 0.5L0.75 0.5L0.25 1","-":"M0 0.5L1 0.5","+":"M 0 0.5 L 1 0.5 M 0.5 0.125 L 0.5 0.875","=":"M0 0.25L1 0.25M0 0.75L1 0.75",_:"M0 1 L1 1","[":"M0.75 0L0.25 0L0.25 1L0.75 1","]":"M0.25 0L0.75 0L0.75 1L0.25 1","<":"M0.75 0L0.25 0.5L0.25 0.5L0.75 1",">":"M0.25 0L0.75 0.5L0.75 0.5L0.25 1","'":"M 0.5 0 L 0.5 0.5",'"':"M 0.25 0 L 0.25 0.5 M 0.75 0 L 0.75 0.5"},IK={};for(const r in vwe){IK[r]=[];const e=vwe[r].split("M").slice(1).map(t=>t.split("L").map(n=>n.trim().split(" ").map(parseFloat)));for(const t of e)for(let n=0;n<t.length-1;n++)IK[r].push({x1:t[n][0],y1:1-t[n][1],x2:t[n+1][0],y2:1-t[n+1][1]})}var ywe=.6,gwe=.2,s5t=r=>r.text.length*r.size*ywe+(r.text.length-1)*r.size*gwe,l5t=r=>{const e=r.size/8,t=r.size*ywe,n=r.size*gwe,i=[];for(let a=0;a<r.text.length;a++){const o=r.text[a],s=IK[o.toUpperCase()];if(s)for(const{x1:l,y1:c,x2:u,y2:h}of s)i.push({pcb_drawing_type:"line",x1:r.x+(t+n)*a+t*l,y1:r.y+r.size*c,x2:r.x+(t+n)*a+t*u,y2:r.y+r.size*h,width:e,layer:r.layer,unit:r.unit})}return i};function n8(r){return r.is_mouse_over||r.is_in_highlighted_net?f5e(cw[r.layer]).lighten(.5).rgb().toString():cw[r.layer]}var _we=(r,e)=>{r.equip({size:e.zoomIndependent?e.width/r.transform.a:e.width,shape:e.squareCap?"square":"circle",color:n8(e),layer:e.layer}),r.moveTo(e.x1,e.y1),r.lineTo(e.x2,e.y2)},c5t=(r,e)=>{r.equip({fontSize:e.size,color:e.layer});let t={x:0,y:0};const n=s5t(e),i=e.size;e.align==="top_left"?t.y=-i:e.align==="bottom_right"?t.x=-n:e.align==="top_right"?(t.x=-n,t.y=-i):e.align==="center"&&(t.x=-n/2,t.y=-i/2),e.x??(e.x=0),e.y??(e.y=0);const a={x:e.x,y:e.y};let o=l5t({...e,x:e.x+t.x,y:e.y+t.y});if(e.ccw_rotation){const s={lines:o,anchorPoint:a,ccwRotation:e.ccw_rotation};o=o5t(s)}for(const s of o)_we(r,s)},u5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.rect(e.x,e.y,e.w,e.h,e.mesh_fill)},f5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.rotatedRect(e.x,e.y,e.w,e.h,e.ccw_rotation)},d5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.circle(e.x,e.y,e.r,e.mesh_fill)},h5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.oval(e.x,e.y,e.rX,e.rY)},p5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.pill(e.x,e.y,e.w,e.h)},m5t=(r,e)=>{r.equip({color:n8(e),layer:e.layer}),r.polygon(e.points)},v5t=(r,e)=>{var t;switch(e.pcb_drawing_type){case"line":return _we(r,e);case"text":return c5t(r,e);case"rect":return((t=e._element)==null?void 0:t.shape)==="rotated_rect"?f5t(r,{...e,ccw_rotation:e._element.ccw_rotation,mesh_fill:e.mesh_fill}):u5t(r,e);case"circle":return d5t(r,e);case"oval":return h5t(r,e);case"pill":return p5t(r,e);case"polygon":return m5t(r,e)}},y5t=(r,e)=>{e.sort((t,n)=>{const i=["bottom","top","drill"];return i.indexOf(t.layer)-i.indexOf(n.layer)}),e.forEach(t=>v5t(r,t))},g5t=({primitives:r,transform:e,grid:t,width:n=500,height:i=500})=>{const a=Tt.useRef(),o=i2(s=>s.selected_layer);return Tt.useEffect(()=>{if(!a.current||Object.keys(a.current).length===0)return;const s=new a5t(a.current);e&&(s.transform=e),s.clear(),s.foregroundLayer=o,y5t(s,r),s.orderAndFadeLayers()},[r,e,o]),gt.jsxs("div",{style:{backgroundColor:"black",width:n,height:i,position:"relative"},children:[gt.jsx(rK.SuperGrid,{textColor:"rgba(0,255,0,0.8)",majorColor:"rgba(0,255,0,0.4)",minorColor:"rgba(0,255,0,0.2)",screenSpaceCellSize:200,width:n,height:i,transform:e,stringifyCoord:(s,l,c)=>`${rK.toMMSI(s,c)}, ${rK.toMMSI(l,c)}`}),sO.map(s=>s.replace(/-/g,"")).concat(["drill","other"]).map((s,l)=>gt.jsx("canvas",{ref:c=>{a.current??(a.current={}),a.current[s]=c},style:{position:"absolute",left:0,top:0,pointerEvents:"none"},width:n,height:i},s))]})};function _5t(r,e){if(r.length<2)throw new Error("Stroke must have at least two points");const t=r.map(h=>Array.isArray(h)?{x:h[0],y:h[1]}:h),n=[],i=[];function a(h,g){const _=g.x-h.x,b=g.y-h.y,T=Math.sqrt(_*_+b*b);return{x:-b/T,y:_/T}}function o(h,g,_,b){const T=b/2,C={x:h.x+g.x*T*_,y:h.y+g.y*T*_};_>0?n.push(C):i.unshift(C)}const s=a(t[0],t[1]),l=t[0].trace_width??e;o(t[0],s,1,l),o(t[0],s,-1,l);for(let h=1;h<t.length-1;h++){const g=t[h-1],_=t[h],b=t[h+1],T=a(g,_),C=a(_,b),A=T.x+C.x,L=T.y+C.y,U=Math.sqrt(A*A+L*L),j=_.trace_width??e;if(U/2>2*(j/2))o(_,T,1,j),o(_,C,1,j),o(_,T,-1,j),o(_,C,-1,j);else{const ee=1/U;o(_,{x:A*ee,y:L*ee},1,j),o(_,{x:A*ee,y:L*ee},-1,j)}}const c=a(t[t.length-2],t[t.length-1]),u=t[t.length-1].trace_width??e;return o(t[t.length-1],c,1,u),o(t[t.length-1],c,-1,u),[...n,...i]}var L1=0,x5t=(r,e)=>{var o;const t="pcb_component_id"in r?e.find(s=>s.type==="pcb_component"&&s.pcb_component_id===r.pcb_component_id):void 0,n=t&&"source_component_id"in t?e.find(s=>s.type==="source_component"&&s.source_component_id===t.source_component_id):void 0,i="source_port_id"in r?r.source_port_id:"pcb_port_id"in r?(o=wS(e).pcb_port.get(r.pcb_port_id))==null?void 0:o.source_port_id:void 0,a=i?e.find(s=>s.type==="source_port"&&s.source_port_id===i):void 0;switch(r.type){case"pcb_board":{const{width:s,height:l,center:c,outline:u}=r;return u&&u.length>2?u.map((h,g,_)=>({_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:h.x,y1:h.y,x2:g===_.length-1?_[0].x:_[g+1].x,y2:g===_.length-1?_[0].y:_[g+1].y,width:1,zoomIndependent:!0,layer:"board",_element:r})):[{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:c.x-s/2,y1:c.y-l/2,x2:c.x+s/2,y2:c.y-l/2,width:1,zoomIndependent:!0,layer:"board",_element:r},{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:c.x-s/2,y1:c.y+l/2,x2:c.x+s/2,y2:c.y+l/2,width:1,zoomIndependent:!0,layer:"board",_element:r},{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:c.x-s/2,y1:c.y-l/2,x2:c.x-s/2,y2:c.y+l/2,width:1,zoomIndependent:!0,layer:"board",_element:r},{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:c.x+s/2,y1:c.y-l/2,x2:c.x+s/2,y2:c.y+l/2,width:1,zoomIndependent:!0,layer:"board",_element:r}]}case"pcb_smtpad":{if(r.shape==="rect"||r.shape==="rotated_rect"){const{shape:s,x:l,y:c,width:u,height:h,layer:g}=r;return[{_pcb_drawing_object_id:`rect_${L1++}`,pcb_drawing_type:"rect",x:l,y:c,w:u,h,layer:g||"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a}]}else if(r.shape==="circle"){const{x:s,y:l,radius:c,layer:u}=r;return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:c,layer:u||"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a}]}return[]}case"pcb_hole":{if(r.hole_shape==="circle"||!r.hole_shape){const{x:s,y:l,hole_diameter:c}=r;return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:c/2,layer:"drill",_element:r,_parent_pcb_component:t,_parent_source_component:n}]}return[]}case"pcb_plated_hole":if(r.shape==="circle"){const{x:s,y:l,hole_diameter:c,outer_diameter:u}=r;return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:u/2,layer:"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a},{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:c/2,layer:"drill",_element:r}]}else if(r.shape==="oval"){const{x:s,y:l,outer_height:c,outer_width:u,hole_height:h,hole_width:g}=r;return[{_pcb_drawing_object_id:`oval_${L1++}`,pcb_drawing_type:"oval",x:s,y:l,rX:u/2,rY:c/2,layer:"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a},{_pcb_drawing_object_id:`oval_${L1++}`,_element:r,pcb_drawing_type:"oval",x:s,y:l,rX:g/2,rY:h/2,layer:"drill"}]}else if(r.shape==="pill"){const{x:s,y:l,outer_height:c,outer_width:u,hole_height:h,hole_width:g}=r;return[{_pcb_drawing_object_id:`pill_${L1++}`,pcb_drawing_type:"pill",x:s,y:l,w:u,h:c,layer:"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a},{_pcb_drawing_object_id:`pill_${L1++}`,_element:r,pcb_drawing_type:"pill",x:s,y:l,w:g,h,layer:"drill"}]}else return[];case"pcb_keepout":if(r.shape==="circle"){const{center:s,radius:l}=r;return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s.x,y:s.y,r:l,layer:"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,mesh_fill:!0}]}else if(r.shape==="rect"){const{x:s,y:l,width:c,height:u}=r;return[{_pcb_drawing_object_id:`rect_${L1++}`,pcb_drawing_type:"rect",x:s,y:l,w:c,h:u,layer:"top",_element:r,_parent_pcb_component:t,_parent_source_component:n,mesh_fill:!0}]}case"pcb_trace":{const s=[];if(r.route_thickness_mode==="interpolated"){const u=r.route.map(g=>({x:g.x,y:g.y,trace_width:g.route_type==="wire"?g.width:.5})),h=_5t(u,.5);return s.push({_pcb_drawing_object_id:`polygon_${L1++}`,_element:r,pcb_drawing_type:"polygon",points:h,layer:r.route[0].layer}),r.route.forEach(g=>{g.route_type==="via"&&s.push({_pcb_drawing_object_id:`circle_${L1++}`,_element:r,pcb_drawing_type:"circle",x:g.x,y:g.y,radius:g.outer_diameter/2,fill:!0,layer:r.route.layer})}),s}let l=null,c=null;for(const u of r.route)u.route_type==="wire"&&(l!==null&&c!==null&&s.push({_pcb_drawing_object_id:`line_${L1++}`,_element:r,pcb_drawing_type:"line",x1:l,y1:c,x2:u.x,y2:u.y,width:u.width,squareCap:!1,layer:u.layer}),l=u.x,c=u.y);return s}case"pcb_via":{const{x:s,y:l,outer_diameter:c,hole_diameter:u,from_layer:h,to_layer:g}=r;return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:c/2,layer:h,_element:r,_parent_pcb_component:t,_parent_source_component:n},{_pcb_drawing_object_id:`circle_${L1++}`,_element:r,pcb_drawing_type:"circle",x:s,y:l,r:u/2,layer:"drill",_parent_pcb_component:t,_parent_source_component:n},{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:s,y:l,r:c/2,layer:g,_element:r,_parent_pcb_component:t,_parent_source_component:n}]}case"pcb_silkscreen_rect":return[{_pcb_drawing_object_id:`rect_${L1++}`,pcb_drawing_type:"rect",x:r.center.x,y:r.center.y,w:r.width,h:r.height,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen"}];case"pcb_silkscreen_circle":return[{_pcb_drawing_object_id:`circle_${L1++}`,pcb_drawing_type:"circle",x:r.center.x,y:r.center.y,r:r.radius,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen"}];case"pcb_silkscreen_oval":return[{_pcb_drawing_object_id:`oval_${L1++}`,pcb_drawing_type:"oval",x:r.center.x,y:r.center.y,rX:r.radius_x/2,rY:r.radius_y/2,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen"}];case"pcb_silkscreen_pill":return[{_pcb_drawing_object_id:`pill_${L1++}`,pcb_drawing_type:"pill",x:r.center.x,y:r.center.y,w:r.width,h:r.height,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen"}];case"pcb_silkscreen_line":return[{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,width:.1,squareCap:!1,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen"}];case"pcb_fabrication_note_path":case"pcb_silkscreen_path":{const{pcb_component_id:s,route:l,type:c}=r;let u;return c==="pcb_silkscreen_path"?u=r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen":c==="pcb_fabrication_note_path"&&(u="top_fabrication"),l.slice(0,-1).map((h,g)=>{const _=l[g+1];return{_pcb_drawing_object_id:`line_${L1++}`,pcb_drawing_type:"line",x1:h.x,y1:h.y,x2:_.x,y2:_.y,width:r.stroke_width??.1,squareCap:!1,layer:u,_element:r,_parent_pcb_component:t,_parent_source_component:n,_source_port:a}}).filter(Boolean)}case"pcb_silkscreen_text":return[{_pcb_drawing_object_id:`text_${L1++}`,pcb_drawing_type:"text",x:r.anchor_position.x,y:r.anchor_position.y,layer:r.layer==="bottom"?"bottom_silkscreen":"top_silkscreen",align:r.anchor_alignment??"center",text:r.text,size:r.font_size,ccw_rotation:r.ccw_rotation}];case"pcb_fabrication_note_text":return[{_pcb_drawing_object_id:`text_${L1++}`,pcb_drawing_type:"text",x:r.anchor_position.x,y:r.anchor_position.y,layer:r.layer==="bottom"?"bottom_fabrication":"top_fabrication",size:r.font_size,align:r.anchor_alignment??"center",text:r.text}]}return[]};function b5t({primitiveElement:r,elements:e}){let t=r.trace_length?`${r.trace_length.toFixed(3)}`:"";const n=wS(e).source_trace.get(r==null?void 0:r.source_trace_id);if(n!=null&&n.display_name&&(n!=null&&n.max_length?t+=` / ${n.max_length}mm `:t+=" mm ",t+=`(${n.display_name})`),!t)return null;const i=r.trace_length&&(n==null?void 0:n.max_length)&&r.trace_length>n.max_length;return{text:t,isOverLength:i}}function S5t(r){const{primitives:e,is_showing_multiple_traces_length:t,elements:n}=r,i=e.filter(l=>l._element.type==="pcb_trace"),a=n.filter(l=>l.type==="source_trace"),o=e.filter(l=>l._element.type!=="pcb_trace"),s=i.filter(l=>a.some(c=>l._element.type==="pcb_trace"&&l._element.source_trace_id===c.source_trace_id&&c.max_length!==void 0));if(!t)return[...o,...s];if(i.length>1){const l=i.reduce((c,u)=>{const h=c._element.trace_length;return u._element.trace_length<h?u:c},i[0]);return[...o,l]}return e}var E5t={position:"absolute",left:0,top:0,pointerEvents:"none",color:"red",fontFamily:"sans-serif",fontSize:12,textShadow:"0 0 2px black"},w5t=r=>{const{_element:e,_parent_pcb_component:t,_parent_source_component:n,_source_port:i}=r;switch(e.type){case"pcb_trace":return e.trace_length?`${e.trace_length.toFixed(3)}`:"";case"pcb_smtpad":case"pcb_plated_hole":{let a="";n&&"name"in n&&n.name&&(a+=`.${n.name} > `);const o=Array.from(new Set((e.port_hints??[]).concat((i==null?void 0:i.port_hints)??[]))).sort((s,l)=>l.localeCompare(s));return a+=o.map(s=>s.match(/^[0-9]+$/)?`port.${s}`:`.${s}`).join(", "),a}default:return""}},T5t={top:"red",bottom:"aqua"},M5t=({primitive:r,mousePos:e,elements:t})=>{var b;const[n,i]=Tt.useState(!1),a=r._element;Tt.useEffect(()=>{setTimeout(()=>{i(!0)},100)},[]);let[o,s,l,c]=[r.screen_x,r.screen_y,r.screen_w,r.screen_h];const u=r.same_space_index??0,h=26,g=T5t[(b=r==null?void 0:r._element)==null?void 0:b.layer]??"red";let _=0;if(a.type==="pcb_smtpad"&&(a==null?void 0:a.shape)==="rotated_rect"&&(_=a==null?void 0:a.ccw_rotation),a.type==="pcb_trace"){const C=b5t({primitiveElement:a,elements:t});if(!C)return null;const A=e.y-35;return gt.jsx("div",{style:{zIndex:ub.elementOverlay,position:"absolute",left:e.x,top:A,color:g,pointerEvents:"none",transform:"translateX(-50%)"},children:gt.jsx("div",{style:{backgroundColor:"#f2efcc",color:C.isOverLength?"red":"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",minWidth:"45px",textAlign:"center",whiteSpace:"nowrap"},children:C.text})})}return gt.jsx("div",{style:{zIndex:ub.elementOverlay,position:"absolute",left:o-l/2-8,top:s-c/2-8,width:l+16,height:c+16,color:g,transform:`rotate(${-_}deg)`,transformOrigin:"center center"},children:gt.jsx("div",{style:{width:n?`calc(100% + ${h*2*u}px)`:"100%",height:n?`calc(100% + ${h*2*u}px)`:"100%",marginLeft:n?`${-h*u}px`:0,marginTop:n?`${-h*u}px`:0,border:`1px solid ${g}`,opacity:n||u===0?1:0,transition:"width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"},children:gt.jsx("div",{style:{position:"absolute",bottom:c+20+h*u,marginRight:n?`${-h*u}px`:0,marginBottom:n?0:-h*u,transition:"margin-right 0.2s, margin-bottom 0.2s",backgroundColor:"#f2efcc",color:"black",textShadow:"none",WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",padding:"6px 6px",borderRadius:"6px",fontSize:"14px",transform:`rotate(${_}deg)`,minWidth:"45px",textAlign:"center"},children:w5t(r)})})})},C5t=({highlightedPrimitives:r,mousePos:e,elements:t})=>{const[n,i]=i2(s=>[s.is_moving_component,s.is_showing_multiple_traces_length]),a=r.some(s=>s._element.type==="pcb_smtpad")&&r.some(s=>s._element.type==="pcb_trace");let o=r;return a&&(o=o.filter(s=>s._element.type==="pcb_smtpad")),o=S5t({primitives:o,is_showing_multiple_traces_length:i,elements:t}),gt.jsx("div",{style:E5t,children:!n&&o.map((s,l)=>gt.jsx(M5t,{primitive:s,mousePos:e,elements:t},l))})};function R5t(r,e){return r.size!==e.size?!1:Array.from(r).every(t=>e.has(t))}var A5t=({elements:r,children:e,transform:t,primitives:n,onMouseHoverOverPrimitives:i})=>{const[a,o]=Tt.useState([]),[s,l]=Tt.useState({x:0,y:0}),c=Tt.useMemo(()=>{var h,g;const u=[];for(const _ of a){if(((h=_._element)==null?void 0:h.type)==="pcb_via"||((g=_._element)==null?void 0:g.type)==="pcb_component"||(_==null?void 0:_.layer)==="drill")continue;const b=ui(t,_),T="w"in _?_.w:"r"in _?_.r*2:0,C="h"in _?_.h:"r"in _?_.r*2:0,A={w:T*t.a,h:C*t.a},L=u.filter(U=>b.x===U.screen_x&&b.y===U.screen_y&&A.w===U.screen_w&&A.h===U.screen_h).length;u.push({..._,screen_x:b.x,screen_y:b.y,screen_w:A.w,screen_h:A.h,same_space_index:L})}return u},[a,t]);return gt.jsxs("div",{style:{position:"relative"},onMouseMove:u=>{var h;if(t){const g=u.currentTarget.getBoundingClientRect(),_=u.clientX-g.left,b=u.clientY-g.top;l({x:_,y:b});const T=ui(Mb(t),{x:_,y:b}),C=[];for(const A of n){if(!A._element)continue;if("x1"in A&&((h=A._element)==null?void 0:h.type)==="pcb_trace"){const j=_9t({x:T.x,y:T.y},{x:A.x1,y:A.y1},{x:A.x2,y:A.y2}),Z=A.width||.5,ee=Math.max(Z*25,2)/t.a;j<ee&&C.push(A);continue}if(!("x"in A&&"y"in A))continue;let L=0,U=0;if("w"in A&&"h"in A)L=A.w,U=A.h;else if("r"in A)L=A.r*2,U=A.r*2;else continue;Math.abs(A.x-T.x)<L/2&&Math.abs(A.y-T.y)<U/2&&C.push(A)}if(R5t(new Set(C.map(A=>A._pcb_drawing_object_id)),new Set(a.map(A=>A._pcb_drawing_object_id))))return;o(C),i(C)}},children:[e,gt.jsx(C5t,{elements:r,mousePos:s,highlightedPrimitives:c})]})},D5t=({children:r,transform:e,focusOnHover:t=!1})=>{e||(e=C_());const[n,i]=Tt.useState(!1),[a,o]=Tt.useState(!1),[s,l]=Tt.useState({x:0,y:0}),[c,u]=Tt.useState({x:0,y:0}),h=Tt.useRef({x:0,y:0}),g=Tt.useRef(null),_=g.current,b=_==null?void 0:_.getBoundingClientRect();Tt.useEffect(()=>{const L=g.current,U=ee=>{ee.key==="d"&&(l({x:h.current.x,y:h.current.y}),u({x:h.current.x,y:h.current.y}),i($=>!$),o(!0),ee.preventDefault()),ee.key==="Escape"&&(i(!1),o(!1))},j=()=>{L&&L.addEventListener("keydown",U)},Z=()=>{L&&L.removeEventListener("keydown",U)};return L&&(L.addEventListener("focus",j),L.addEventListener("blur",Z),L.addEventListener("mouseenter",j),L.addEventListener("mouseleave",Z)),()=>{L&&(L.removeEventListener("focus",j),L.removeEventListener("blur",Z),L.removeEventListener("mouseenter",j),L.removeEventListener("mouseleave",Z))}},[g]);const T=ui(e,s),C=ui(e,c),A={left:Math.min(T.x,C.x),right:Math.max(T.x,C.x),top:Math.min(T.y,C.y),bottom:Math.max(T.y,C.y),flipX:T.x>C.x,flipY:T.y>C.y,width:0,height:0};return A.width=A.right-A.left,A.height=A.bottom-A.top,gt.jsxs("div",{ref:g,tabIndex:0,style:{position:"relative"},onMouseEnter:()=>{t&&g.current&&g.current.focus()},onMouseLeave:()=>{g.current&&g.current.blur()},onMouseMove:L=>{const U=L.currentTarget.getBoundingClientRect(),j=L.clientX-U.left,Z=L.clientY-U.top,ee=ui(Mb(e),{x:j,y:Z});h.current.x=ee.x,h.current.y=ee.y,a&&u({x:ee.x,y:ee.y})},onMouseDown:()=>{a?o(!1):n&&i(!1)},children:[r,n&>.jsxs(gt.Fragment,{children:[gt.jsx("div",{style:{position:"absolute",left:A.left,width:A.width,textAlign:"center",top:T.y+2,color:"red",mixBlendMode:"difference",pointerEvents:"none",marginTop:A.flipY?0:-20,fontSize:12,fontFamily:"sans-serif",zIndex:ub.dimensionOverlay},children:Math.abs(s.x-c.x).toFixed(2)}),gt.jsx("div",{style:{position:"absolute",left:C.x,height:A.height,display:"flex",flexDirection:"column",justifyContent:"center",top:A.top,color:"red",pointerEvents:"none",mixBlendMode:"difference",fontSize:12,fontFamily:"sans-serif",zIndex:ub.dimensionOverlay},children:gt.jsx("div",{style:{marginLeft:A.flipX?"-100%":4,paddingRight:4},children:Math.abs(s.y-c.y).toFixed(2)})}),gt.jsxs("svg",{style:{position:"absolute",left:0,top:0,pointerEvents:"none",mixBlendMode:"difference",zIndex:ub.dimensionOverlay},width:b.width,height:b.height,children:[gt.jsx("defs",{children:gt.jsx("marker",{id:"head",orient:"auto",markerWidth:"3",markerHeight:"4",refX:"2",refY:"2",children:gt.jsx("path",{d:"M0,0 V4 L2,2 Z",fill:"red"})})}),gt.jsx("line",{x1:T.x,y1:T.y,x2:C.x,y2:C.y,markerEnd:"url(#head)",strokeWidth:1.5,fill:"none",stroke:"red"}),gt.jsx("line",{x1:T.x,y1:T.y,x2:C.x,y2:T.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"}),gt.jsx("line",{x1:C.x,y1:T.y,x2:C.x,y2:C.y,strokeWidth:1.5,fill:"none",strokeDasharray:"2,2",stroke:"red"})]}),gt.jsxs("div",{style:{right:0,bottom:0,position:"absolute",color:"red",fontFamily:"sans-serif",fontSize:12,margin:4},children:["(",s.x.toFixed(2),",",s.y.toFixed(2),")",gt.jsx("br",{}),"(",c.x.toFixed(2),",",c.y.toFixed(2),")",gt.jsx("br",{}),"dist:"," ",Math.sqrt((c.x-s.x)**2+(c.y-s.y)**2).toFixed(2)]})]})]})},P5t={name:"@tscircuit/pcb-viewer",version:"1.11.45",main:"dist/index.js",type:"module",repository:"tscircuit/pcb-viewer",license:"MIT",scripts:{start:"storybook dev -p 6006",build:"tsup ./src/index.tsx --platform browser --dts --sourcemap --format esm --outDir dist",yalc:"npm run build && yalc push",storybook:"storybook dev -p 6006","build-storybook":"storybook build",format:"biome format . --write","format:check":"biome format ."},files:["dist"],devDependencies:{"@biomejs/biome":"^1.9.4","@semantic-release/commit-analyzer":"^9.0.2","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^9.0.1","@semantic-release/release-notes-generator":"^10.0.3","@storybook/nextjs":"^8.0.6","@storybook/react":"^8.0.6","@swc/core":"^1.4.12","@tscircuit/core":"0.0.274","@tscircuit/eagle-xml-converter":"^1.0.0","@tscircuit/props":"^0.0.151","@tscircuit/soup-util":"^0.0.41","@types/color":"^3.0.6","@types/node":"18.7.23","@types/react":"^18.3.3","circuit-json":"^0.0.128",next:"^14.1.4","pixi.js":"^8.6.6",react:"^18.2.0","react-dom":"^18.2.0","react-use":"^17.4.0",storybook:"^8.0.6",tsup:"^8.0.2","type-fest":"^3.0.0",typescript:"^5.4.4","use-mouse-matrix-transform":"^1.3.0",zod:"^3.23.5"},peerDependencies:{react:"*","@tscircuit/core":"*"},dependencies:{"@emotion/css":"^11.11.2","circuit-json-to-connectivity-map":"^0.0.18","@tscircuit/math-utils":"^0.0.10","circuit-to-svg":"^0.0.36",color:"^4.2.3","react-supergrid":"^1.0.10","react-toastify":"^10.0.5","transformation-matrix":"^2.13.0",zustand:"^4.5.2"}},TS=(r,e)=>{const t=i2(n=>n.is_mouse_over_container);Tt.useEffect(()=>{if(!r||typeof e!="function")return;const n=i=>{const a=r.split("+"),o=a.includes("ctrl"),s=a.includes("shift"),l=a.includes("alt"),c=a.includes("meta"),u=a[a.length-1];t&&(!o||i.ctrlKey)&&(!s||i.shiftKey)&&(!l||i.altKey)&&(!c||i.metaKey)&&i.key.toLowerCase()===u.toLowerCase()&&(i.preventDefault(),e())};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[r,e])},N5t=({name:r,selected:e,onClick:t})=>gt.jsxs("div",{className:tw`
|
|
12845
12845
|
margin-top: 2px;
|
|
12846
12846
|
padding: 4px;
|