@skillpet/circuit 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -0
- package/README.md +24 -30
- package/dist/circuit.bundle.js +0 -1
- package/dist/circuit.bundle.min.js +0 -1
- package/dist/circuit.esm.js +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/container.d.ts +0 -1
- package/dist/drawing-gradient.d.ts +0 -1
- package/dist/drawing-stack.d.ts +0 -1
- package/dist/drawing-transition.d.ts +0 -1
- package/dist/drawing.d.ts +0 -1
- package/dist/element-label.d.ts +0 -1
- package/dist/element-style.d.ts +0 -1
- package/dist/element.d.ts +0 -1
- package/dist/element2term.d.ts +0 -1
- package/dist/elements/cables.d.ts +0 -1
- package/dist/elements/capacitor.d.ts +0 -1
- package/dist/elements/compound.d.ts +0 -1
- package/dist/elements/connectors.d.ts +0 -1
- package/dist/elements/crystal.d.ts +0 -1
- package/dist/elements/diode-more.d.ts +0 -1
- package/dist/elements/diode.d.ts +0 -1
- package/dist/elements/element-compound.d.ts +0 -1
- package/dist/elements/element-drawing.d.ts +0 -1
- package/dist/elements/ground.d.ts +0 -1
- package/dist/elements/ic.d.ts +0 -1
- package/dist/elements/image.d.ts +0 -1
- package/dist/elements/inductor.d.ts +0 -1
- package/dist/elements/line.d.ts +0 -1
- package/dist/elements/lines-arc-labels.d.ts +0 -1
- package/dist/elements/lines-elements.d.ts +0 -1
- package/dist/elements/misc-elements.d.ts +0 -1
- package/dist/elements/oneterm.d.ts +0 -1
- package/dist/elements/opamp.d.ts +0 -1
- package/dist/elements/outlets.d.ts +0 -1
- package/dist/elements/resistor-more.d.ts +0 -1
- package/dist/elements/resistor.d.ts +0 -1
- package/dist/elements/source-v.d.ts +0 -1
- package/dist/elements/sources.d.ts +0 -1
- package/dist/elements/switches.d.ts +0 -1
- package/dist/elements/transformer.d.ts +0 -1
- package/dist/elements/transistors.d.ts +0 -1
- package/dist/elements/tubes.d.ts +0 -1
- package/dist/elements/twoports.d.ts +0 -1
- package/dist/elements/twoterm-extras.d.ts +0 -1
- package/dist/elements/twoterm.d.ts +0 -1
- package/dist/geometry/point.d.ts +0 -1
- package/dist/geometry/roundcorners.d.ts +0 -1
- package/dist/geometry/transform.d.ts +0 -1
- package/dist/geometry/util.d.ts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/json/anchor-ref.d.ts +0 -1
- package/dist/json/mount.d.ts +0 -1
- package/dist/json/registry.d.ts +0 -1
- package/dist/json/render.d.ts +0 -1
- package/dist/json/theme.d.ts +0 -1
- package/dist/json/types.d.ts +0 -1
- package/dist/json/validate.d.ts +0 -1
- package/dist/label-hint.d.ts +0 -1
- package/dist/logic/and.d.ts +0 -1
- package/dist/logic/bitfield.d.ts +0 -1
- package/dist/logic/buffer.d.ts +0 -1
- package/dist/logic/extras.d.ts +0 -1
- package/dist/logic/kmap.d.ts +0 -1
- package/dist/logic/or.d.ts +0 -1
- package/dist/logic/timing.d.ts +0 -1
- package/dist/logic/tristate.d.ts +0 -1
- package/dist/math-render.d.ts +0 -1
- package/dist/package-api.d.ts +0 -1
- package/dist/params.d.ts +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1
- package/dist/segment.d.ts +0 -1
- package/dist/style.d.ts +0 -1
- package/dist/subsystems/dsp.d.ts +0 -1
- package/dist/subsystems/flow.d.ts +0 -1
- package/dist/subsystems/index.d.ts +0 -1
- package/dist/subsystems/parsing.d.ts +0 -1
- package/dist/subsystems/pictorial.d.ts +0 -1
- package/dist/svg/constants.d.ts +0 -1
- package/dist/svg/figure.d.ts +0 -1
- package/dist/svg/fmt.d.ts +0 -1
- package/dist/svg/svg-style.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/vue/index.d.ts +0 -1
- package/dist/vue/index.js +0 -1
- package/package.json +22 -9
- package/dist/circuit.bundle.js.map +0 -7
- package/dist/circuit.bundle.min.js.map +0 -7
- package/dist/circuit.esm.js.map +0 -7
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -23
- package/dist/config.js.map +0 -1
- package/dist/container.d.ts.map +0 -1
- package/dist/container.js +0 -101
- package/dist/container.js.map +0 -1
- package/dist/drawing-gradient.d.ts.map +0 -1
- package/dist/drawing-gradient.js +0 -39
- package/dist/drawing-gradient.js.map +0 -1
- package/dist/drawing-stack.d.ts.map +0 -1
- package/dist/drawing-stack.js +0 -32
- package/dist/drawing-stack.js.map +0 -1
- package/dist/drawing-transition.d.ts.map +0 -1
- package/dist/drawing-transition.js +0 -181
- package/dist/drawing-transition.js.map +0 -1
- package/dist/drawing.d.ts.map +0 -1
- package/dist/drawing.js +0 -337
- package/dist/drawing.js.map +0 -1
- package/dist/element-label.d.ts.map +0 -1
- package/dist/element-label.js +0 -377
- package/dist/element-label.js.map +0 -1
- package/dist/element-style.d.ts.map +0 -1
- package/dist/element-style.js +0 -51
- package/dist/element-style.js.map +0 -1
- package/dist/element.d.ts.map +0 -1
- package/dist/element.js +0 -514
- package/dist/element.js.map +0 -1
- package/dist/element2term.d.ts.map +0 -1
- package/dist/element2term.js +0 -245
- package/dist/element2term.js.map +0 -1
- package/dist/elements/cables.d.ts.map +0 -1
- package/dist/elements/cables.js +0 -100
- package/dist/elements/cables.js.map +0 -1
- package/dist/elements/capacitor.d.ts.map +0 -1
- package/dist/elements/capacitor.js +0 -93
- package/dist/elements/capacitor.js.map +0 -1
- package/dist/elements/compound.d.ts.map +0 -1
- package/dist/elements/compound.js +0 -266
- package/dist/elements/compound.js.map +0 -1
- package/dist/elements/connectors.d.ts.map +0 -1
- package/dist/elements/connectors.js +0 -578
- package/dist/elements/connectors.js.map +0 -1
- package/dist/elements/crystal.d.ts.map +0 -1
- package/dist/elements/crystal.js +0 -31
- package/dist/elements/crystal.js.map +0 -1
- package/dist/elements/diode-more.d.ts.map +0 -1
- package/dist/elements/diode-more.js +0 -233
- package/dist/elements/diode-more.js.map +0 -1
- package/dist/elements/diode.d.ts.map +0 -1
- package/dist/elements/diode.js +0 -58
- package/dist/elements/diode.js.map +0 -1
- package/dist/elements/element-compound.d.ts.map +0 -1
- package/dist/elements/element-compound.js +0 -68
- package/dist/elements/element-compound.js.map +0 -1
- package/dist/elements/element-drawing.d.ts.map +0 -1
- package/dist/elements/element-drawing.js +0 -16
- package/dist/elements/element-drawing.js.map +0 -1
- package/dist/elements/ground.d.ts.map +0 -1
- package/dist/elements/ground.js +0 -30
- package/dist/elements/ground.js.map +0 -1
- package/dist/elements/ic.d.ts.map +0 -1
- package/dist/elements/ic.js +0 -816
- package/dist/elements/ic.js.map +0 -1
- package/dist/elements/image.d.ts.map +0 -1
- package/dist/elements/image.js +0 -27
- package/dist/elements/image.js.map +0 -1
- package/dist/elements/inductor.d.ts.map +0 -1
- package/dist/elements/inductor.js +0 -111
- package/dist/elements/inductor.js.map +0 -1
- package/dist/elements/line.d.ts.map +0 -1
- package/dist/elements/line.js +0 -14
- package/dist/elements/line.js.map +0 -1
- package/dist/elements/lines-arc-labels.d.ts.map +0 -1
- package/dist/elements/lines-arc-labels.js +0 -822
- package/dist/elements/lines-arc-labels.js.map +0 -1
- package/dist/elements/lines-elements.d.ts.map +0 -1
- package/dist/elements/lines-elements.js +0 -271
- package/dist/elements/lines-elements.js.map +0 -1
- package/dist/elements/misc-elements.d.ts.map +0 -1
- package/dist/elements/misc-elements.js +0 -160
- package/dist/elements/misc-elements.js.map +0 -1
- package/dist/elements/oneterm.d.ts.map +0 -1
- package/dist/elements/oneterm.js +0 -163
- package/dist/elements/oneterm.js.map +0 -1
- package/dist/elements/opamp.d.ts.map +0 -1
- package/dist/elements/opamp.js +0 -72
- package/dist/elements/opamp.js.map +0 -1
- package/dist/elements/outlets.d.ts.map +0 -1
- package/dist/elements/outlets.js +0 -285
- package/dist/elements/outlets.js.map +0 -1
- package/dist/elements/resistor-more.d.ts.map +0 -1
- package/dist/elements/resistor-more.js +0 -171
- package/dist/elements/resistor-more.js.map +0 -1
- package/dist/elements/resistor.d.ts.map +0 -1
- package/dist/elements/resistor.js +0 -22
- package/dist/elements/resistor.js.map +0 -1
- package/dist/elements/source-v.d.ts.map +0 -1
- package/dist/elements/source-v.js +0 -3
- package/dist/elements/source-v.js.map +0 -1
- package/dist/elements/sources.d.ts.map +0 -1
- package/dist/elements/sources.js +0 -519
- package/dist/elements/sources.js.map +0 -1
- package/dist/elements/switches.d.ts.map +0 -1
- package/dist/elements/switches.js +0 -328
- package/dist/elements/switches.js.map +0 -1
- package/dist/elements/transformer.d.ts.map +0 -1
- package/dist/elements/transformer.js +0 -184
- package/dist/elements/transformer.js.map +0 -1
- package/dist/elements/transistors.d.ts.map +0 -1
- package/dist/elements/transistors.js +0 -1009
- package/dist/elements/transistors.js.map +0 -1
- package/dist/elements/tubes.d.ts.map +0 -1
- package/dist/elements/tubes.js +0 -386
- package/dist/elements/tubes.js.map +0 -1
- package/dist/elements/twoports.d.ts.map +0 -1
- package/dist/elements/twoports.js +0 -231
- package/dist/elements/twoports.js.map +0 -1
- package/dist/elements/twoterm-extras.d.ts.map +0 -1
- package/dist/elements/twoterm-extras.js +0 -243
- package/dist/elements/twoterm-extras.js.map +0 -1
- package/dist/elements/twoterm.d.ts.map +0 -1
- package/dist/elements/twoterm.js +0 -4
- package/dist/elements/twoterm.js.map +0 -1
- package/dist/geometry/point.d.ts.map +0 -1
- package/dist/geometry/point.js +0 -99
- package/dist/geometry/point.js.map +0 -1
- package/dist/geometry/roundcorners.d.ts.map +0 -1
- package/dist/geometry/roundcorners.js +0 -64
- package/dist/geometry/roundcorners.js.map +0 -1
- package/dist/geometry/transform.d.ts.map +0 -1
- package/dist/geometry/transform.js +0 -33
- package/dist/geometry/transform.js.map +0 -1
- package/dist/geometry/util.d.ts.map +0 -1
- package/dist/geometry/util.js +0 -36
- package/dist/geometry/util.js.map +0 -1
- package/dist/index.cjs.map +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -68
- package/dist/index.js.map +0 -1
- package/dist/json/anchor-ref.d.ts.map +0 -1
- package/dist/json/anchor-ref.js +0 -35
- package/dist/json/anchor-ref.js.map +0 -1
- package/dist/json/mount.d.ts.map +0 -1
- package/dist/json/mount.js +0 -369
- package/dist/json/mount.js.map +0 -1
- package/dist/json/registry.d.ts.map +0 -1
- package/dist/json/registry.js +0 -323
- package/dist/json/registry.js.map +0 -1
- package/dist/json/render.d.ts.map +0 -1
- package/dist/json/render.js +0 -113
- package/dist/json/render.js.map +0 -1
- package/dist/json/theme.d.ts.map +0 -1
- package/dist/json/theme.js +0 -57
- package/dist/json/theme.js.map +0 -1
- package/dist/json/types.d.ts.map +0 -1
- package/dist/json/types.js +0 -2
- package/dist/json/types.js.map +0 -1
- package/dist/json/validate.d.ts.map +0 -1
- package/dist/json/validate.js +0 -77
- package/dist/json/validate.js.map +0 -1
- package/dist/label-hint.d.ts.map +0 -1
- package/dist/label-hint.js +0 -2
- package/dist/label-hint.js.map +0 -1
- package/dist/logic/and.d.ts.map +0 -1
- package/dist/logic/and.js +0 -63
- package/dist/logic/and.js.map +0 -1
- package/dist/logic/bitfield.d.ts.map +0 -1
- package/dist/logic/bitfield.js +0 -271
- package/dist/logic/bitfield.js.map +0 -1
- package/dist/logic/buffer.d.ts.map +0 -1
- package/dist/logic/buffer.js +0 -46
- package/dist/logic/buffer.js.map +0 -1
- package/dist/logic/extras.d.ts.map +0 -1
- package/dist/logic/extras.js +0 -211
- package/dist/logic/extras.js.map +0 -1
- package/dist/logic/kmap.d.ts.map +0 -1
- package/dist/logic/kmap.js +0 -163
- package/dist/logic/kmap.js.map +0 -1
- package/dist/logic/or.d.ts.map +0 -1
- package/dist/logic/or.js +0 -117
- package/dist/logic/or.js.map +0 -1
- package/dist/logic/timing.d.ts.map +0 -1
- package/dist/logic/timing.js +0 -791
- package/dist/logic/timing.js.map +0 -1
- package/dist/logic/tristate.d.ts.map +0 -1
- package/dist/logic/tristate.js +0 -48
- package/dist/logic/tristate.js.map +0 -1
- package/dist/math-render.d.ts.map +0 -1
- package/dist/math-render.js +0 -53
- package/dist/math-render.js.map +0 -1
- package/dist/package-api.d.ts.map +0 -1
- package/dist/package-api.js +0 -75
- package/dist/package-api.js.map +0 -1
- package/dist/params.d.ts.map +0 -1
- package/dist/params.js +0 -35
- package/dist/params.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/schemdraw-ts.bundle.js +0 -30448
- package/dist/schemdraw-ts.bundle.js.map +0 -7
- package/dist/segment.d.ts.map +0 -1
- package/dist/segment.js +0 -844
- package/dist/segment.js.map +0 -1
- package/dist/style.d.ts.map +0 -1
- package/dist/style.js +0 -230
- package/dist/style.js.map +0 -1
- package/dist/subsystems/dsp.d.ts.map +0 -1
- package/dist/subsystems/dsp.js +0 -267
- package/dist/subsystems/dsp.js.map +0 -1
- package/dist/subsystems/flow.d.ts.map +0 -1
- package/dist/subsystems/flow.js +0 -315
- package/dist/subsystems/flow.js.map +0 -1
- package/dist/subsystems/index.d.ts.map +0 -1
- package/dist/subsystems/index.js +0 -22
- package/dist/subsystems/index.js.map +0 -1
- package/dist/subsystems/parsing.d.ts.map +0 -1
- package/dist/subsystems/parsing.js +0 -456
- package/dist/subsystems/parsing.js.map +0 -1
- package/dist/subsystems/pictorial.d.ts.map +0 -1
- package/dist/subsystems/pictorial.js +0 -469
- package/dist/subsystems/pictorial.js.map +0 -1
- package/dist/svg/constants.d.ts.map +0 -1
- package/dist/svg/constants.js +0 -5
- package/dist/svg/constants.js.map +0 -1
- package/dist/svg/figure.d.ts.map +0 -1
- package/dist/svg/figure.js +0 -634
- package/dist/svg/figure.js.map +0 -1
- package/dist/svg/fmt.d.ts.map +0 -1
- package/dist/svg/fmt.js +0 -7
- package/dist/svg/fmt.js.map +0 -1
- package/dist/svg/svg-style.d.ts.map +0 -1
- package/dist/svg/svg-style.js +0 -46
- package/dist/svg/svg-style.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -21
- package/dist/types.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -3
- package/dist/version.js.map +0 -1
- package/dist/vue/index.d.ts.map +0 -1
- package/dist/vue/index.js.map +0 -1
|
@@ -270,4 +270,3 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
270
270
|
`);this.segments.push(new W([Be,L-c],_e,{fontsize:i,align:["center","top"]}))}else{let Ae=ye.map(Ze=>Ze<0?Ze+(1<<ve):Ze).map(Ze=>Ze.toString(2).padStart(ve,"0"));for(let Ze=0;Ze<de;Ze++){let gn=de+B-Ze-1,Tt=Ae.map(Re=>Re[gn]).join(`
|
|
271
271
|
`);this.segments.push(new W([De-Z*M*Ze-Z*M/2,L-c],Tt,{fontsize:i,align:["center","top"]}))}}}te+=de,B||(Y+=1)}let ke=l?_:_+b;o?L-=ke:L+=ke}}};var r0=1,lt=.65,nn=.12;function c1(r){let e=r.replace(/\|\|/g,"\u01C1");for(;;){let s=e.replace(/([lcr])([lcr])/g,"$1.$2");if(s===e)break;e=s}!e.startsWith("|")&&!e.startsWith("\u01C1")&&(e="."+e),!e.endsWith("|")&&!e.endsWith("\u01C1")&&(e+=".");let t="",n="";for(let s=0;s<e.length;s++)s%2===0?t+=e[s]:n+=e[s];return{justs:n,bars:t}}var A0=class extends N{constructor(e){super(e);let t=e.table,n=e.fontsize??12,s=e.font??"sans",i=.03,o=.3,a=.4,l=t.trim().split(`
|
|
272
272
|
`),h="";for(let L of l)L.includes("---")?h+="|":L.includes("===")?h+="\u01C1":h+="l";let{justs:c,bars:m}=c1(h),f=L=>L.replace(/^\|?\s*|\s*\|?$/g,""),g=l.filter(L=>!L.includes("---")&&!L.includes("===")),b=f(g[0]).split("|").length,x=e.colfmt;(x==null||x==="")&&(x="c".repeat(b));let{justs:v,bars:S}=c1(x),k=v.length,M=c.length;if(f(g[0]).split("|").length!==k)throw new Error("Number of columns in table does not match colfmt string.");let _=new Array(k).fill(0),B=new Array(M).fill(0);for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let{width:j,height:re}=f0(I[X],n,s);_[X]=Math.max(_[X],j/72*2+a),B[L]=Math.max(B[L],re/72*2+o)}}let $=B.reduce((L,I)=>L+I,0),Y=_.reduce((L,I)=>L+I,0),Z=(L,I)=>L.slice(0,I).reduce((X,j)=>X+j,0);for(let L=0;L<S.length;L++){let I=Z(_,L);S[L]==="|"?this.segments.push(new p([[I,0],[I,-$]],{lw:1})):S[L]==="\u01C1"&&(this.segments.push(new p([[I-i,0],[I-i,-$]],{lw:1})),this.segments.push(new p([[I+i,0],[I+i,-$]],{lw:1})))}for(let L=0;L<m.length;L++){let I=-Z(B,L);m[L]==="|"?this.segments.push(new p([[0,I],[Y,I]],{lw:1})):m[L]==="\u01C1"&&(this.segments.push(new p([[0,I-i],[Y,I-i]],{lw:1})),this.segments.push(new p([[0,I+i],[Y,I+i]],{lw:1})))}for(let L=0;L<g.length;L++){let I=f(g[L]).split("|").map(X=>X.trim());for(let X=0;X<I.length;X++){let j=Z(_,X),re=-Z(B,L)-B[L],te={c:"center",l:"left",r:"right"}[v[X]]??"center";te==="center"?j+=_[X]/2:te==="right"?j+=_[X]-a/2:j+=a/2,this.segments.push(new W([j,re+o/3],I[X],{fontfamily:s,fontsize:n,align:[te,"bottom"]})),this.anchors[`cell${L}_${X}`]=[j,re+B[L]/2]}}}},_0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[-nn*2,0],H,[lt+nn*2,0]])),this.segments.push(new p([[0,r0/2],[lt,0],[0,-r0/2],[0,r0/2]])),this.segments.push(new D([lt+nn,0],nn)),this.segments.push(new D([lt+nn,0],nn)),this.segments.push(new D([-nn,0],nn)),this.anchors.out=[lt+nn*2,0],this.anchors.in1=[0,0]}},B0=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[lt,0]])),this.segments.push(new p([[0,0],[0,-r0/2],[lt,0],[0,r0/2],[0,0]])),this.segments.push(new p([[lt,0],[lt,-r0/2],[0,0],[lt,r0/2],[lt,0]])),this.segments.push(new D([lt/2,.28+.08],.08)),this.segments.push(new p([[lt/2,.28+.16],[lt/2,.7]])),this.segments.push(new p([[lt/2,-.28],[lt/2,-.7]])),this.anchors.out=[lt,0],this.anchors.in1=[0,0],this.anchors.c=[lt/2,-.7],this.anchors.cbar=[lt/2,.7]}},Ac=(r=0)=>new p([[r+.07,-.15],[r+.25,-.15],[r+.25,.15],H,[r+.33,.15],[r+.15,.15],[r+.15,-.15]],{lw:1}),C0=class extends Jt{constructor(e={}){super(e),this.segments.push(Ac())}},I0=class extends Kt{constructor(e={}){super(e),this.segments.push(Ac())}},n0=class extends Bt{constructor(e={}){super(e);let n=R(this.params,"leadin",.35)+lt/2;this.segments.push(Ac(n))}};function Hl(r){return new n0({...r,nand:!0})}var F=.25,Ye=.16666666666666666;var Br=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,.25],[t,-.25],H,[t,0]])),R(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},Bn=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{polar:!1});let t=.18;this.segments.push(new p([[0,0],H,[0,.25],[0,-.25],H,[t,0]])),this.segments.push(new xe([t*1.5,0],t*1.5,.25*2.5,{theta1:105,theta2:-105})),R(this.params,"polar",!1)&&this.segments.push(new W([-t*1.2,t],"+"))}},Cn=class extends Br{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=R(this.params,"arrowwidth",.16),i=R(this.params,"arrowlength",.2),o=R(this.params,"arrow_lw",void 0),a=R(this.params,"arrow_color",void 0);this.segments.push(new p([[-2*t,-n],[3*t,t*2]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},In=class extends Br{constructor(e={}){super(e),Object.assign(this.defaults,{trim_lw:void 0,trim_color:void 0});let t=.18,n=Ye,s=.25,i=[-1.8*n,-s],o=[1.8*n+t,s],a=o[0]-i[0],l=o[1]-i[1],h=.14,c=Math.atan2(l,a)+Math.PI/2,m=[o[0]+h*Math.cos(c),o[1]+h*Math.sin(c)],f=[o[0]+h*Math.cos(c-Math.PI),o[1]+h*Math.sin(c-Math.PI)],g=R(this.params,"trim_lw",void 0),b=R(this.params,"trim_color",void 0);this.segments.push(new p([i,o],{lw:g,color:b})),this.segments.push(new p([m,f],{lw:g,color:b}))}};var et=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1}))}},Ln=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25],[t-n,.25-n]])),this.segments.push(new p([[t,-.25],[t+n,-.25],[t+n,-.25+n]]))}},Dn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t+n,.25+n]])),this.segments.push(new p([[t,-.25],[t-n,-.25-n]]))}};var Nn=class extends et{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[t,.25],[t-n,.25]])),this.segments.push(new p([[t,-.25],[t-n,-.25]]))}},On=class extends se{constructor(e={}){super(e);let t=.25*1.4,n=.1;this.segments.push(new p([[0,0],H,[2*t,0]])),this.segments.push(new U([[0,.25],[t,0],[0,-.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,0],[t*2,.25],[t*2,-.25]],{closed:!0,fill:!1})),this.segments.push(new p([[t+n,.25],[t,.25],[t,-.25],[t-n,-.25]]))}},Fn=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],[t,0],[t,.25],[t,-.25],H,[t,0]])),this.segments.push(new p([[0,-.25],[0,.25],[t,0]]))}},$n=class extends se{constructor(e={}){super(e);let t=.13,n=.25*1.4;this.segments.push(new p([[0,0],H,[n,.25],[n,-.25],H,[n+t,.25],[n+t,-.25],H,[n+t,0]])),this.segments.push(new U([[0,.25],[n,0],[0,-.25]],{closed:!0,fill:!1}))}},jn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=R(this.params,"arrowwidth",.16),s=R(this.params,"arrowlength",.2),i=R(this.params,"arrow_color",void 0);this.segments.push(new p([[t,t*1.5],[t*2,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[t*.1,t*1.5],[t*1.1,t*3.25]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},qn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=R(this.params,"arrowwidth",.16),s=R(this.params,"arrowlength",.2),i=R(this.params,"arrow_color",void 0),o=R(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(x=>-x*(x-.7)*(x+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((x,v)=>{let S=A.fromXY([x,l[v]]).rotate(c,[0,0]);return[S.x,S.y]}),f=h.map((x,v)=>{let S=A.fromXY([x-.2,l[v]]).rotate(c,[0,0]);return[S.x,S.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[0],l[0]+.1]).rotate(c,[0,0]),b=A.fromXY([h[0]-.2,l[0]+.1]).rotate(c,[0,0]);this.segments.push(new p([[m[1][0],m[1][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[1][0],f[1][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Hn=class extends et{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=.25,n=R(this.params,"arrowwidth",.16),s=R(this.params,"arrowlength",.2),i=R(this.params,"arrow_color",void 0),o=R(this.params,"arrow_lw",void 0),a=ze(-1,1),l=a.map(v=>-v*(v-.7)*(v+.7)/2+t*2.5),h=ze(t*.75,t*1.25,a.length),c=20,m=h.map((v,S)=>{let k=A.fromXY([v,l[S]]).rotate(c,[0,0]);return[k.x,k.y]}),f=h.map((v,S)=>{let k=A.fromXY([v-.2,l[S]]).rotate(c,[0,0]);return[k.x,k.y]});this.segments.push(new p(m,{lw:o,color:i})),this.segments.push(new p(f,{lw:o,color:i}));let g=A.fromXY([h[h.length-1],l[l.length-1]-.1]).rotate(c,[0,0]),b=A.fromXY([h[h.length-1]-.2,l[l.length-1]-.1]).rotate(c,[0,0]),x=m.length;this.segments.push(new p([[m[x-2][0],m[x-2][1]],[g.x,g.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.segments.push(new p([[f[x-2][0],f[x-2][1]],[b.x,b.y]],{arrow:"->",arrowwidth:n,arrowlength:s,color:i})),this.elmParams.lblloc="bot"}},Yn=class extends et{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,0],[t+.3,-.3],[t+.3,-.5]])),this.anchors.gate=[t+.3,-.5]}},sn=class extends se{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[0,0],H,[t,.25*1.8],[t,-.25*1.8],H,[0,.25*1.8],[0,-.25*1.8],H,[t,0]])),this.segments.push(new U([[0,-.25-.25],[t,-.25],[0,-.25+.25]],{closed:!0,fill:!1})),this.segments.push(new U([[t,.25+.25],[0,.25],[t,.25-.25]],{closed:!0,fill:!1}))}},Xn=class extends sn{constructor(e={}){super(e);let t=.25*1.4;this.segments.push(new p([[t,.25],[t+.5,.5]])),this.anchors.gate=[t+.5,.5]}};var Gn=.25;function Wn(r=4,e=[0,0],t=.06,n=.19,s=!0,i=!1,o=!1){let a=Math.acos(t/n),l=ze(a,2*(r+1)*Math.PI-a,r*50),h=l.map(v=>t*v-n*Math.sin(v)),c=l.map(v=>t-n*Math.cos(v)),m=h[0];if(h=h.map(v=>v-m),s){let v=h[h.length-1]-h[0];v!==0&&(h=h.map(S=>S/v))}o&&(c=c.map(v=>-v));let g=Math.max(...c)-Math.min(...c);c=c.map(v=>v*g/.25);let b=h,x=c;return i&&(b=c,x=h),b.map((v,S)=>[v+e[0],x[S]+e[1]])}var Cr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{core:0});let t=R(this.params,"core",0),n=R(this.params,"core_ls",void 0),s=R(this.params,"core_lw",void 0),i=R(this.params,"core_color",void 0);this.segments.push(new p([[0,0],H,[1,0]]));for(let a=0;a<4;a++)this.segments.push(new xe([(a*2+1)*Gn/2,0],Gn,Gn,{theta1:0,theta2:180}));let o=.12;if(t>0)for(let a=0;a<t;a++){let l=Gn+o*a,h={};n!==void 0&&(h.ls=n),s!==void 0&&(h.lw=s),i!==void 0&&(h.color=i),this.segments.push(new p([[0,l],[1,l]],h))}this.anchors.NE=[1,Gn+o],this.anchors.NW=[0,Gn+o],this.anchors.SE=[1,-Gn],this.anchors.SW=[0,-Gn]}},Ir=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{loops:4,core:0});let t=R(this.params,"loops",4),n=R(this.params,"core",0),s=R(this.params,"core_ls",void 0),i=R(this.params,"core_lw",void 0),o=R(this.params,"core_color",void 0);this.segments.push(new p(Wn(t)));let a=.12,l=.5;if(n>0)for(let h=0;h<n;h++){let c=l+a*h,m={};s!==void 0&&(m.ls=s),i!==void 0&&(m.lw=i),o!==void 0&&(m.color=o),this.segments.push(new p([[0,c],[1,c]],m))}this.anchors.NE=[1,l+a],this.anchors.NW=[0,l+a],this.anchors.SE=[1,-l],this.anchors.SW=[0,-l]}};var Vn=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],H,[0,n],[0,-n],H,[t/2,n],[t/2,-n],[t*1.5,-n],[t*1.5,n],[t/2,n],H,[t*2,n],[t*2,-n],H,[t*2,0]]))}};var dt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[.5*t,n],[1.5*t,-n],[2.5*t,n],[3.5*t,-n],[4.5*t,n],[5.5*t,-n],[6*t,0]]))}};var mt=class extends se{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[0,n],[t*6,n],[t*6,-n],[0,-n],[0,0],H,[t*6,0]]))}},cr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=R(this.params,"arrowwidth",.16),i=R(this.params,"arrowlength",.2),o=R(this.params,"arrow_lw",void 0),a=R(this.params,"arrow_color",void 0);this.segments.push(new p([[1.5*t,-n*2],[4.5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Zt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=Ye,n=.25,s=R(this.params,"arrowwidth",.16),i=R(this.params,"arrowlength",.2),o=R(this.params,"arrow_lw",void 0),a=R(this.params,"arrow_color",void 0);this.segments.push(new p([[1*t,-n*2],[5*t,t*3.5]],{arrow:"->",arrowwidth:s,arrowlength:i,lw:o,color:a}))}},Un=class extends mt{constructor(e={}){super(e),this.segments.push(new p([[0,-.25-.2],[.2,-.25-.2],[1,.25+.2]]))}},ur=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=R(this.params,"arrowwidth",.16),n=R(this.params,"arrowlength",.2),s=R(this.params,"arrow_lw",void 0),i=R(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Qt=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.16,arrowlength:.2});let t=R(this.params,"arrowwidth",.16),n=R(this.params,"arrowlength",.2),s=R(this.params,"arrow_lw",void 0),i=R(this.params,"arrow_color",void 0);this.segments.push(new p([[.7,.75],[.4,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i})),this.segments.push(new p([[1,.75],[.7,.4]],{arrow:"->",arrowwidth:t,arrowlength:n,lw:s,color:i}))}},Jn=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25;this.segments.push(new p([[0,0],[-n*1.5,-n],[-n*1.5,-n*2]])),this.segments.push(new p([[t*6,0],[t*6+n*1.5,-n],[t*6+n*1.5,-n*2]])),this.anchors.v1=[-n*1.5,-n*2],this.anchors.v2=[t*6+n*1.5,-n*2]}},mr=class extends dt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=R(this.params,"tap_length",.72),s=R(this.params,"arrowwidth",.15),i=R(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},er=class extends mt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,tap_length:.72});let t=Ye,n=R(this.params,"tap_length",.72),s=R(this.params,"arrowwidth",.15),i=R(this.params,"arrowlength",.25);this.anchors.tap=[t*3,n],this.elmParams.lblloc="bot",this.segments.push(new p([[t*3,n],[t*3,t*1.5]],{arrow:"->",arrowwidth:s,arrowlength:i}))}},dr=class extends mt{constructor(e={}){super(e);let t=Ye;this.segments.push(new p([[0,0],[t*6,0]]))}},Lr=class extends mt{constructor(e={}){super(e);let t=Ye,n=.25,s=n*.66;this.segments.push(new p([[s,n],[s,-n]])),this.segments.push(new p([[6*t-s,n],[6*t-s,-n]]))}};var on={Resistor:dt,ResistorVar:cr,Potentiometer:mr,Photoresistor:ur,Fuse:dr},Yl={Resistor:mt,ResistorVar:Zt,Potentiometer:er,Photoresistor:Qt,Fuse:Lr},Kn=dt,Zn=cr,Qn=mr,es=ur,ts=dr;function Xl(r){r.Resistor!==void 0&&(Kn=r.Resistor),r.ResistorVar!==void 0&&(Zn=r.ResistorVar),r.Potentiometer!==void 0&&(Qn=r.Potentiometer),r.Photoresistor!==void 0&&(es=r.Photoresistor),r.Fuse!==void 0&&(ts=r.Fuse)}function Gl(){Kn=on.Resistor,Zn=on.ResistorVar,Qn=on.Potentiometer,es=on.Photoresistor,ts=on.Fuse}var rs=class extends se{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[0,0],[t,0],[t,-t*.75],[t*2,-t*.75],[t*2,t*.75],[t*3,t*.75],[t*3,-t*.75],[t*4,-t*.75],[t*4,0],[t*5,0]])),this.segments.push(new p([[0,t*1.25],[t*5,t*1.25],[t*5,t*-1.25],[0,t*-1.25],[0,t*1.25]])),this.segments.push(new U([[0,t*1.25],[0,-t*1.25],[t/2,-t*1.25],[t/2,t*1.25]],{closed:!0,fill:"black"}))}},ns=class extends se{constructor(e={}){super(e);let t=.2,n=.25;this.segments.push(new p([[0,0],[0,n],[t,n],[t,-n],[t*2,-n],[t*2,n],[t*3,n],[t*3,-n],[t*4,-n],[t*4,n],[t*5,n],[t*5,-n],[t*6,-n],[t*6,0],[t*7,0]]))}},ss=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{box:!1});let t=.25;R(this.params,"box",!1)?(this.segments.push(new p([[-t,0],H,[t,0]])),this.segments.push(new p([[-t,t],[t,-t],H,[t,t],[-t,-t]])),this.segments.push(new U([[-t,t],[-t,-t],[t,-t],[t,t]],{closed:!0,fill:!1}))):this.segments.push(new p([[0,0],H,[-t,t],[t,-t],H,[t,t],[-t,-t],H,[0,0]]))}},is=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=R(this.params,"dot_r",.12),n=50,s=ze(t*2,1+t,n),o=ze(0,2*Math.PI,n).map(l=>Math.sin(l)*.25),a=s.map((l,h)=>[l,o[h]]);this.segments.push(new p(a)),this.segments.push(new p([[0,0],H,[1+t*3,0]])),R(this.params,"dots",!0)&&(this.segments.push(new D([t,0],t,{zorder:4,fill:"bg"})),this.segments.push(new D([t*2+1,0],t,{zorder:4,fill:"bg"})))}},os=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{dots:!0,dot_r:.12});let t=e.dots,n=R(this.params,"dots",!0),s=t?25:10,i=t?155:170,o=R(this.params,"arc_lw",void 0),a=R(this.params,"arc_color",void 0);if(this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new xe([.5,0],1,.65,{theta1:s,theta2:i,lw:o,color:a})),n){let l=R(this.params,"dot_r",.12);this.segments.push(new D([l,0],l,{zorder:4})),this.segments.push(new D([1-l,0],l,{zorder:4}))}}},as=class extends se{constructor(e={}){super(e);let t=.25,n=.25,s=.25;this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,0],H,[n,0],[0,s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,s],H,[0,-s],H,[t,0]])),this.segments.push(new p([[0,0],[-n,-s],H,[0,-s],H,[t,0]]))}},ls=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{gap:.08,arrowwidth:.25,arrowlength:.25});let t=R(this.params,"gap",.08),n=R(this.params,"arrowwidth",.25),s=R(this.params,"arrowlength",.25);this.segments.push(new p([[0,0],H,[1,0]])),this.segments.push(new p([[0,0],[.5-t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s})),this.segments.push(new p([[1,0],[.5+t/2,0]],{arrow:"->",arrowwidth:n,arrowlength:s}))}},Dr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.5,0],1,.5,{theta1:0,theta2:360})),this.elmParams.theta=90}},Nr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.25,0],.25)),this.segments.push(new D([1-.25,0],.25)),this.elmParams.theta=90}},Or=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([1-.3,0],.3,{lw:1e-9,ls:"None"})),this.segments.push(new D([.3,0],.3,{fill:!1})),this.segments.push(new D([1-.3,0],.3,{fill:!1})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(.3**2-.2**2)]}},Fr=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new xe([.7,0],.6,.3,{theta1:0,theta2:360})),this.segments.push(new xe([.3,0],.6,.3,{theta1:0,theta2:360})),this.elmParams.theta=90,this.anchors.common=[.5,Math.sqrt(1-.2**2/.3**2)*.15]}};var wt=2.5,jt=wt*Math.sqrt(3)/2,L0=jt/8,D0=.2,hs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{sign:!0,leads:!1});let t=R(this.params,"leads",!1),n=R(this.params,"sign",!0),s=wt/4,i=t?s:0;this.segments.push(new p([[i,0],[i,wt/2],[i+jt,0],[i,-wt/2],[i,0],H,[i+jt,0]])),n&&(this.segments.push(new p([[i+L0-D0/2,wt/4],[i+L0+D0/2,wt/4]])),this.segments.push(new p([[i+L0-D0/2,-wt/4],[i+L0+D0/2,-wt/4]])),this.segments.push(new p([[i+L0,-wt/4-D0/2],[i+L0,-wt/4+D0/2]]))),t&&(this.segments.push(new p([[0,wt/4],[s,wt/4]])),this.segments.push(new p([[0,-wt/4],[s,-wt/4]])),this.segments.push(new p([[s+jt,0],[jt+2*s,0]])));let o=jt+2*i;this.anchors.out=[o,0],this.anchors.in1=[0,wt/4],this.anchors.in2=[0,-wt/4],this.anchors.center=[i+jt/2,0],this.anchors.vd=[i+jt/3,.84],this.anchors.vs=[i+jt/3,-.84],this.anchors.n1=[i+jt*2/3,-.42],this.anchors.n2=[i+jt*2/3,.42],this.anchors.n1a=[i+jt*.9,-.13],this.anchors.n2a=[i+jt*.9,.13],this.elmParams.drop=[o,0],Object.assign(this._labelhints,{in1:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},in2:{ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:9},out:{ofst:[0,.1],halign:"left",valign:"bottom",fontsize:9},vd:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},vs:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1:{ofst:[-.1,-.25],halign:"right",valign:"top",fontsize:9},n1a:{ofst:[-.1,-.3],halign:"right",valign:"top",fontsize:9},n2:{ofst:[-.1,.25],halign:"right",valign:"bottom",fontsize:9},n2a:{ofst:[-.1,.3],halign:"right",valign:"bottom",fontsize:9}})}};var C=Ye*.5;function m1(r,e,t,n,s){r.push(new p([[-3*C,-6.5*C],[-3*C,-7.5*C]])),r.push(new p([[-3*C,-9.5*C],[-3*C,-10.5*C]])),r.push(new p([[-3*C,-12.5*C],[-3*C,-13.5*C]])),r.push(new p([[0,-7*C],[0,0]])),r.push(new p([[-3*C,-7*C],[0,-7*C]])),r.push(new p([[0,-20*C],[0,-13*C]])),r.push(new p([[-3*C,-13*C],[0,-13*C]]));let i={};return e==="nmos"?(r.push(new p([[-10*C,-14*C],[-5*C,-14*C]])),r.push(new p([[-5*C,-14*C],[-5*C,-6*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-13*C]])),i.drain=[0,0],i.gate=[-10*C,-14*C],i.center=[0,-10*C],i.source=[0,-20*C]):(r.push(new p([[-10*C,-6*C],[-5*C,-6*C]])),r.push(new p([[-5*C,-6*C],[-5*C,-14*C]])),r.push(new p([[-3*C,-10*C],[0,-10*C]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[0,-10*C],[0,-7*C]])),i.source=[0,0],i.gate=[-10*C,-6*C],i.center=[0,-10*C],i.drain=[0,-20*C]),t&&(r.push(new p([[0,-7*C],[3*C,-7*C]])),r.push(new p([[3*C,-7*C],[3*C,-9*C]])),r.push(new p([[2*C,-9*C],[4*C,-9*C]])),r.push(new U([[3*C,-9*C],[2*C,-11*C],[4*C,-11*C]],{closed:!0,fill:!1})),r.push(new p([[3*C,-11*C],[3*C,-13*C]])),r.push(new p([[3*C,-13*C],[0,-13*C]]))),n&&r.push(new D([-1*C,-10*C],7*C,{lw:s})),i}var us=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=R(this.params,"diode",!1),n=R(this.params,"circle",!1),s=R(this.params,"circle_lw",void 0),i=m1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}},ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=R(this.params,"diode",!1),n=R(this.params,"circle",!1),s=R(this.params,"circle_lw",void 0),i=m1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[0,-20*C],this.elmParams.lblloc="rgt"}};function d1(r,e,t,n,s){r.push(new p([[0,0],[7*C,0],[7*C,-3*C],H,[13*C,-3*C],[13*C,0],[20*C,0]])),r.push(new p([[6.5*C,-3*C],[7.5*C,-3*C]])),r.push(new p([[9.5*C,-3*C],[10.5*C,-3*C]])),r.push(new p([[12.5*C,-3*C],[13.5*C,-3*C]]));let i={};return e==="nmos"?(r.push(new p([[14*C,-10*C],[14*C,-5*C]])),r.push(new p([[14*C,-5*C],[6*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"<-",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[13*C,0]])),i.drain=[0,0],i.gate=[14*C,-10*C],i.source=[20*C,0]):(r.push(new p([[6*C,-10*C],[6*C,-5*C]])),r.push(new p([[6*C,-5*C],[14*C,-5*C]])),r.push(new p([[10*C,-3*C],[10*C,0]],{arrow:"->",arrowwidth:2*C,arrowlength:2*C})),r.push(new p([[10*C,0],[7*C,0]])),i.source=[0,0],i.gate=[6*C,-10*C],i.drain=[20*C,0]),i.center=[10*C,0],t&&(r.push(new p([[7*C,0],[7*C,3*C]])),r.push(new p([[7*C,3*C],[9*C,3*C]])),r.push(new p([[9*C,2*C],[9*C,4*C]])),r.push(new U([[9*C,3*C],[11*C,2*C],[11*C,4*C]],{closed:!0,fill:!1})),r.push(new p([[11*C,3*C],[13*C,3*C]])),r.push(new p([[13*C,3*C],[13*C,0]]))),n&&r.push(new D([10*C,-1*C],7*C,{lw:s})),i}var ds=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=R(this.params,"diode",!1),n=R(this.params,"circle",!1),s=R(this.params,"circle_lw",void 0),i=d1(this.segments,"nmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},ps=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{diode:!1,circle:!1});let t=R(this.params,"diode",!1),n=R(this.params,"circle",!1),s=R(this.params,"circle_lw",void 0),i=d1(this.segments,"pmos",t,n,s);Object.assign(this.anchors,i),this.elmParams.drop=[20*C,0],this.elmParams.lblloc="bottom"}},q=Ye*4,i2=Ye*5,O=i2/2,tt=Ye,Xe=Ye*.7,fs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.anchors.source=[0,-2*O-q],this.anchors.drain=[0,0],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",R(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},gs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[q,-O],[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q+tt,-O],[q+tt,-O-q]])),this.segments.push(new p([[q+tt+Xe*2,-O-q/2],[q+tt+O+Xe,-O-q/2]])),this.segments.push(new D([q+tt+Xe,-O-q/2],Xe)),this.anchors.source=[0,0],this.anchors.drain=[0,-2*O-q],this.anchors.gate=[q+tt+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft",R(this.params,"bulk",!1)&&(this.segments.push(new p([[0,-O-q/2],[q,-O-q/2]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.anchors.bulk=[0,-O-q/2])}},bs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new p([[O+q/2,q+tt],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",R(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,R(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},ws=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,q],[O+q,q],[O+q,0],[2*O+q,0]])),this.segments.push(new p([[O,q+tt],[O+q,q+tt]])),this.segments.push(new D([O+q/2,q+tt+Xe],Xe)),this.segments.push(new p([[O+q/2,q+tt+Xe*2],[O+q/2,q+tt+Xe+O]])),this.anchors.isource=[2*O+q,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+q/2,q+tt+Xe+O],this.elmParams.lblloc="bottom",R(this.params,"bulk",!1)&&(this.segments.push(new p([[O+q/2,0],[O+q/2,q]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.anchors.bulk=[O+q/2,0])}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,R(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},Te=Ye*2.5,me=Te*2,ne=me*.5,Ve=Te*.2,yt=me*.1,Wl=yt*.75,cs=.25,N0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=R(this.params,"bulk",!1),n=R(this.params,"offset_gate",!0),i=R(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Te,-ne],[Te,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[Te,-ne-me],[0,-ne-me]],{arrow:"->",arrowwidth:cs,arrowlength:cs})),this.segments.push(new p([[Te+Ve,-ne-yt],[Te+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Te+Ve,-ne-me+yt],[Te+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Te+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Te+Ve,-ne-me/2],[Te+Ve+ne,-ne-me/2]])),this.anchors.gate=[Te+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Te,-ne-me/2]],{arrow:"->",arrowwidth:cs,arrowlength:cs})),this.anchors.bulk=[0,-ne-me/2])}},O0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=R(this.params,"bulk",!1),n=R(this.params,"offset_gate",!0),i=R(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Te,-ne],[Te,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new p([[0,-ne],[Te,-ne]],{arrow:"->",arrowwidth:cs,arrowlength:cs})),this.segments.push(new p([[Te+Ve,-ne-yt],[Te+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Te+Ve,-ne-yt],[Te+Ve+ne,-ne-yt]])),this.anchors.gate=[Te+Ve+ne,-ne-yt]):(this.segments.push(new p([[Te+Ve,-ne-me/2],[Te+Ve+ne,-ne-me/2]])),this.anchors.gate=[Te+Ve+ne,-ne-me/2]),this.anchors.source=[0,0],this.anchors.drain=[0,-2*ne-me],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[Te,-ne-me/2],[0,-ne-me/2]],{arrow:"->",arrowwidth:cs,arrowlength:cs})),this.anchors.bulk=[0,-ne-me/2])}},F0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{bulk:!1,offset_gate:!0,arrow:!0});let t=R(this.params,"bulk",!1),n=R(this.params,"offset_gate",!0),i=R(this.params,"arrow",!0)&&!t;this.segments.push(new p([[0,0],[0,-ne],[Te,-ne],[Te,-ne-me],[0,-ne-me],[0,-2*ne-me]])),i&&this.segments.push(new D([Wl*2,-ne-me],Wl,{fill:!0})),this.segments.push(new p([[Te+Ve,-ne-yt],[Te+Ve,-ne-me+yt]])),n?(this.segments.push(new p([[Te+Ve,-ne-me+yt],[Te+Ve+ne,-ne-me+yt]])),this.anchors.gate=[Te+Ve+ne,-ne-me+yt]):(this.segments.push(new p([[Te+Ve,-ne-me/2],[Te+Ve+ne,-ne-me/2]])),this.anchors.gate=[Te+Ve+ne,-ne-me/2]),this.anchors.source=[0,-2*ne-me],this.anchors.drain=[0,0],this.anchors.center=[0,-ne-me/2],this.elmParams.drop=[0,-2*ne-me],this.elmParams.lblloc="lft",t&&(this.segments.push(new p([[0,-ne-me/2],[Te,-ne-me/2]])),this.segments.push(new D([Te-Wl*2,-ne-me/2],Wl,{fill:!0})),this.anchors.bulk=[0,-ne-me/2])}},Ul=q*.2,ue=Ye*3,xs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[0,-O],[ue,-O],[ue,-O+Ul],[ue,-O-ue-Ul],[ue,-O-ue],[0,-O-ue],[0,-2*O-ue]])),this.segments.push(new p([[ue,-O-ue],[ue+O,-O-ue]])),this.elmParams.drop=[ue+O,-O-ue],this.anchors.source=[0,-2*O-ue],this.anchors.drain=[0,0],this.anchors.gate=[ue+O,-O-ue],this.anchors.center=[0,-O-ue/2],this.elmParams.lblloc="lft",R(this.params,"circle",!1)&&this.segments.push(new D([ue/2,-q],q*1.1,{lw:R(this.params,"circle_lw",void 0)}))}},$0=class extends xs{constructor(e={}){super(e),this.segments.push(new p([[ue+.1,-O-ue],[ue+.3,-O-ue]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},j0=class extends xs{constructor(e={}){super(e),this.segments.push(new p([[ue+.25,-O-ue],[ue,-O-ue]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},vs=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowlength:.25,arrowwidth:.2}),this.segments.push(new p([[0,0],[O,0],[O,ue],[O+ue,ue],[O+ue,0],[2*O+ue,0]])),this.segments.push(new p([[O-Ul,ue],[O+ue+Ul,ue]])),this.segments.push(new p([[O+ue,ue],[O+ue,ue+O]])),this.anchors.isource=[2*O+ue,0],this.anchors.idrain=[0,0],this.anchors.gate=[O+ue,ue+O],this.elmParams.lblloc="bottom",R(this.params,"circle",!1)&&this.segments.push(new D([O+ue/2,ue/2],q*1.1,{lw:R(this.params,"circle_lw",void 0)}))}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.source=this.anchors.end,this.anchors.drain=this.anchors.start,R(this.params,"reverse",!1)&&(this.anchors.source=this.anchors.start,this.anchors.drain=this.anchors.end)}},q0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue],[O+ue,ue+.3]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},H0=class extends vs{constructor(e={}){super(e),this.segments.push(new p([[O+ue,ue+.3],[O+ue,ue]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},ka=(q+2*Xe)/5,Y0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{split:!0,arrow:!0,arrowlength:.25,arrowwidth:.2});let t=R(this.params,"split",!0),n=this.params.arrow,s=R(this.params,"arrowwidth",.2),i=R(this.params,"arrowlength",.25);t?this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O+Xe-ka],H,[q,-O+Xe-2*ka],[q,-O+Xe-3*ka],H,[q,-O+Xe-4*ka],[q,-O+Xe-5*ka],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])):this.segments.push(new p([[0,0],[0,-O],[q,-O],H,[q,-O+Xe],[q,-O-q-Xe],H,[q,-O-q],[0,-O-q],[0,-2*O-q]])),this.segments.push(new p([[q,-O-q/2],[q+O+Xe,-O-q/2]])),n===">"?this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"->",arrowwidth:s,arrowlength:i})):n!==!1&&this.segments.push(new p([[0,-O-q],[q,-O-q]],{arrow:"<-",arrowwidth:s,arrowlength:i})),this.anchors.drain=[0,-2*O-q],this.anchors.source=[0,0],this.anchors.gate=[q+O+Xe,-O-q/2],this.anchors.center=[0,-O-q/2],this.elmParams.drop=[0,-2*O-q],this.elmParams.lblloc="lft"}},Ma=Ye*3.3,pe=Ma*2/3,ht=Ma*(4/3),tr=ht/4,It=pe+Ma*.7,qt=ht*.7,jr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[pe,0]])),this.segments.push(new p([[pe,ht/2],[pe,-ht/2]])),this.segments.push(new p([[pe,tr],[It,qt],[It,qt+tr]])),this.segments.push(new p([[pe,-tr],[It,-qt],[It,-qt-tr]])),R(this.params,"circle",!1)&&this.segments.push(new D([Ma,0],Ma,{lw:R(this.params,"circle_lw",void 0)})),this.elmParams.drop=[It,qt+tr],this.anchors.base=[0,0],this.anchors.collector=[It,qt+tr],this.anchors.emitter=[It,-qt-tr],this.anchors.center=[It,0]}},Ht=class extends jr{constructor(e={}){super(e),this.segments.push(new p([[pe,-tr],[It,-qt]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},rr=class extends jr{constructor(e={}){super(e),this.segments.push(new p([[It,qt],[pe,tr]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.anchors.base=[0,0],this.anchors.collector=[It,-qt-tr],this.anchors.emitter=[It,qt+tr]}},u1=.55,za=.2,Vl=.75,$r=.42,Ct=1.1,qr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{circle:!1,lblloc:"bottom",theta:90,arrowwidth:.2,arrowlength:.25}),this.segments.push(new p([[0,0],[Ct/2-za,$r],[Ct/2+za,$r],[Ct,0]])),this.segments.push(new p([[Ct/2-Vl/2,$r],[Ct/2+Vl/2,$r]])),this.segments.push(new p([[Ct/2,$r],[Ct/2,$r+Vl/2]])),R(this.params,"circle",!1)&&this.segments.push(new D([Ct/2,u1/2],u1,{lw:R(this.params,"circle_lw",void 0)})),this.anchors.base=[Ct/2,$r+Vl/2],this.anchors.icollector=[Ct,0],this.anchors.iemitter=[0,0]}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end,R(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start)}},ys=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[0,0],[Ct/2-za,$r]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},an=class extends qr{constructor(e={}){super(e),this.segments.push(new p([[Ct/2+za,$r],[Ct,0]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}));let t=this.anchors.icollector,n=this.anchors.iemitter;this.anchors.icollector=n,this.anchors.iemitter=t}placeAnchors(e,t){super.placeAnchors(e,t),this.anchors.emitter=this.anchors.end,this.anchors.collector=this.anchors.start,R(this.params,"reverse",!1)&&(this.anchors.emitter=this.anchors.start,this.anchors.collector=this.anchors.end)}},X0=class extends rr{constructor(e={}){super(e);let t=-.25;this.segments.push(new p([[pe,-tr-t],[It,-qt-t]])),this.anchors.C2=[It,-qt-t]}},xt=.1,G0=class extends Ht{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe+xt,ht/2+xt],[pe+xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe-xt,-ht/2-xt],[pe-xt,-ht/2]]))}},W0=class extends rr{constructor(e={}){super(e),this.segments.push(new p([[pe,ht/2],[pe,ht/2+xt],[pe-xt,ht/2+xt],[pe-xt,ht/2]])),this.segments.push(new p([[pe,-ht/2],[pe,-ht/2-xt],[pe+xt,-ht/2-xt],[pe+xt,-ht/2]]))}},V0=class extends Ht{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},U0=class extends rr{constructor(e={}){super(e),this.segments.shift();let t=.25;this.segments.push(new p([[-.1,pe],[pe*.75,.1]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)})),this.segments.push(new p([[-.1,pe-t],[pe*.75,.1-t]],{arrow:"->",arrowwidth:R(this.params,"arrowwidth",.2),arrowlength:R(this.params,"arrowlength",.25)}))}},vt=.15,J0=class extends Ht{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2],[pe-vt*2,-pe+vt/2]])),this.anchors.base=[pe-vt*2,-pe+vt/2]}},K0=class extends rr{constructor(e={}){super(e),this.segments.shift(),this.segments.push(new p([[pe-vt*2,pe-vt/2],[pe-vt,pe-vt/2],[pe-vt,-pe+vt/2]])),this.anchors.base=[pe-vt*2,pe-vt/2]}},Z0=class extends an{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[t+Ct/2-za,$r]])),this.anchors.C2=[t,0]}};function _c(r){let e=r[0].toUpperCase();return e==="L"||e==="R"||e==="T"||e==="B"?e:"L"}var Jl=class{constructor(e={}){z(this,"name");z(this,"pin");z(this,"side");z(this,"pos");z(this,"slot");z(this,"invert",!1);z(this,"invertradius",.15);z(this,"color");z(this,"rotation",0);z(this,"anchorname");z(this,"lblsize");z(this,"pinlblsize");z(this,"href");z(this,"decoration");this.side=e.side!==void 0?_c(String(e.side)):"L",e.name!==void 0&&(this.name=e.name),e.pin!==void 0&&(this.pin=e.pin),e.pos!==void 0&&(this.pos=e.pos),e.slot!==void 0&&(this.slot=e.slot),e.invert!==void 0&&(this.invert=e.invert),e.invertradius!==void 0&&(this.invertradius=e.invertradius),e.color!==void 0&&(this.color=e.color),e.rotation!==void 0&&(this.rotation=e.rotation),e.anchorname!==void 0&&(this.anchorname=e.anchorname),e.lblsize!==void 0&&(this.lblsize=e.lblsize),e.pinlblsize!==void 0&&(this.pinlblsize=e.pinlblsize),e.href!==void 0&&(this.href=e.href),e.decoration!==void 0&&(this.decoration=e.decoration)}};function o2(r,e){let t=Math.max(.15,r.length*e/72),n=e/72*1.2;return[t*2,n*2]}function p1(r){return{...r}}var nr=class extends N{constructor(t={}){let{size:n,pins:s,slant:i,label:o,...a}=t;super({...a,...o!==void 0?{label:o}:{}});z(this,"size");z(this,"slant");z(this,"pins");z(this,"usersides");z(this,"sides");z(this,"pincount",{L:0,R:0,T:0,B:0});z(this,"_sizeauto");z(this,"_icbox");z(this,"_dflt");if(Object.assign(this.defaults,{pinspacing:0,edgepadH:.5,edgepadW:.5,leadlen:.5,lsize:14,lofst:.15,plblofst:.075,plblsize:11}),this.slant=i??0,this.pins={L:[],R:[],T:[],B:[]},this.usersides={},this.sides={L:this.mkSide(),R:this.mkSide(),T:this.mkSide(),B:this.mkSide()},this._dflt=this.mkSide(),this.size=n??this.params.size,s)for(let l of s)this.pins[l.side].push({...l,side:l.side});this._setsize()}mkSide(){return{spacing:R(this.params,"pinspacing",0),pad:R(this.params,"edgepadH",.25),leadlen:R(this.params,"leadlen",.5),label_ofst:R(this.params,"lofst",.15),label_size:R(this.params,"lsize",14),pinlabel_ofst:R(this.params,"plblofst",.05),pinlabel_size:R(this.params,"plblsize",11)}}pin(t){let n=_c(t.side??"L"),s={side:n,name:t.name,pin:t.pin,pos:t.pos,slot:t.slot,invert:t.invert??!1,invertradius:t.invertradius??.15,color:t.color,rotation:t.rotation??0,anchorname:t.anchorname,lblsize:t.lblsize,pinlblsize:t.pinlblsize,href:t.href,decoration:t.decoration};return this.pins[n].push(s),this._setsize(),this}side(t,n=0,s=.5,i=.5,o=.15,a=14,l=.05,h=11){let c=_c(t);return this.usersides[c]={spacing:n,pad:s,leadlen:i,label_ofst:o,label_size:a,pinlabel_ofst:l,pinlabel_size:h},this._setsize(),this}get pinnames(){let t=[];for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.push(s.anchorname??s.name);return t}getAnchorNamesForGetattr(){let t=new Set(super.getAnchorNamesForGetattr());for(let n of["L","R","T","B"])for(let s of this.pins[n])s.name&&t.add(s.anchorname??s.name),s.pin&&t.add(`pin${s.pin}`);return[...t]}getPinAnchor(t){return this.resolveAnchor(t)}_countpins(){let t={L:0,R:0,T:0,B:0};for(let n of["L","R","T","B"]){let i=this.pins[n].map(o=>o.slot).filter(o=>o!=null).map(o=>Number(o.split("/")[1])).concat([0]);t[n]=Math.max(this.pins[n].length,Math.max(...i))}return t}_autosize(){let t={},n={};for(let a of["L","R","T","B"]){let l=p1(this.usersides[a]??this._dflt);l.spacing===0&&(l={...l,spacing:.6}),this.sides[a]=l;let h=Math.max(1,this.pincount[a]);t[a]=l.pad*2+l.spacing*(h-1);let c=0;for(let m of this.pins[a])if(m.name){let f=m.lblsize??R(this.params,"lsize",14);c=Math.max(c,o2(m.name,f)[0])}n[a]=c}let s=n.L+n.R+4*R(this.params,"lofst",.15),i=Math.max(t.L??0,t.R??0,2+R(this.params,"edgepadH",.5)),o=Math.max(t.T??0,t.B??0,2+R(this.params,"edgepadW",.5),s);this._sizeauto=[o,i];for(let a of["L","R"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(i-l.spacing*(h-1))/2}for(let a of["T","B"]){let l=this.sides[a],h=Math.max(1,this.pincount[a]);l.pad=(o-l.spacing*(h-1))/2}}_autopinlayout(){let t=this.size;for(let n of["L","R","T","B"]){let s=p1(this.usersides[n]??this._dflt);this.sides[n]=s;let i=["T","B"].includes(n)?t[0]:t[1],o=s.pad;s.spacing===0?this.pincount[n]>1?s.spacing=(i-2*o)/(this.pincount[n]-1):s.pad=i/2:s.pad=(i-s.spacing*(this.pincount[n]-1))/2}}_setsize(){this.pincount=this._countpins(),this.size===void 0?this._autosize():this._autopinlayout()}_drawBox(){let t,n;this.size?[t,n]=this.size:this._sizeauto?[t,n]=this._sizeauto:(t=2,n=3);let s=t*Math.tan(this.slant*Math.PI/180),i=0,o=n,a;return this.slant>0?(i=0-s,o=n+s,a=[new A(0,0),new A(t,i),new A(t,o),new A(0,n),new A(0,0)]):this.slant<0?(i=0+s,o=n-s,a=[new A(0,i),new A(t,0),new A(t,n),new A(0,o),new A(0,i)]):(i=0,o=n,a=[new A(0,0),new A(t,0),new A(t,n),new A(0,n),new A(0,0)]),this.segments.push(new p(a.map(l=>[l.x,l.y]),{})),{w:t,h:n,y1:i,y2:o}}_pinpos(t,n,s){let i=this.sides[t]??this._dflt,o=i.spacing>0?i.spacing:.6,a=s;n.slot&&(a=Number(n.slot.split("/")[0])-1);let l=i.pad+a*o;n.pos!==void 0&&n.pos!==null&&(l=i.pad+n.pos*(this.pincount[t]-1)*o);let h;return t==="L"?h=new A(0,l):t==="R"?h=new A(this._icbox.w,l):t==="T"?h=new A(l,this._icbox.h):h=new A(l,0),t==="T"&&this.slant>0?h=new A(h.x,h.y-h.x*Math.tan(-this.slant*Math.PI/180)):t==="T"&&this.slant<0?h=new A(h.x,h.y+(this._icbox.y2-this._icbox.h)-h.x*Math.tan(-this.slant*Math.PI/180)):t==="B"&&this.slant<0?h=new A(h.x,h.y-(this._icbox.y2-this._icbox.h)-h.x*Math.tan(this.slant*Math.PI/180)):t==="B"&&this.slant>0&&(h=new A(h.x,h.y-h.x*Math.tan(this.slant*Math.PI/180))),h}_drawClkpin(t,n,s){let i=this.sides[s]??this._dflt,o=.4*(i.label_size/16),a=.2*(i.label_size/16),l;if(s==="T"||s==="B"){let h=n.y!==0?Math.sign(n.y):1,c=Math.abs(o)*h;l=[new A(t.x-a,t.y),new A(t.x,t.y-c),new A(t.x+a,t.y)]}else{let h=n.x!==0?-Math.sign(n.x):1,c=Math.abs(o)*h;l=[new A(t.x,t.y+a),new A(t.x+c,t.y),new A(t.x,t.y-a)]}this.segments.push(new p(l.map(h=>[h.x,h.y])))}_drawPin(t,n,s){let i=this.sides[t]??this._dflt,o=this._pinpos(t,n,s),l={L:new A(-i.leadlen,0),R:new A(i.leadlen,0),T:new A(0,i.leadlen),B:new A(0,-i.leadlen)}[t],h=o.add(l);if(this.anchors[`in${t}${s+1}`]=[h.x,h.y],n.anchorname?this.anchors[n.anchorname]=[h.x,h.y]:n.name&&(n.name===">"&&(this.anchors.CLK=[h.x,h.y]),this.anchors[n.name]=[h.x,h.y]),n.pin&&(this.anchors[`pin${n.pin}`]=[h.x,h.y]),i.leadlen>0)if(n.invert){let c=n.invertradius??.15,f={L:new A(-c,0),R:new A(c,0),T:new A(0,c),B:new A(0,-c)}[t],g=o.add(f);this.segments.push(new D([g.x,g.y],c));let b=g.add(f.mul(2));this.segments.push(new p([[b.x,b.y],[h.x,h.y]],{}))}else this.segments.push(new p([[o.x,o.y],[h.x,h.y]],{}));if(n.pin){let c=(n.invert?n.invertradius??.15:0)*(n.invert?1:0),m=i.pinlabel_ofst,g={L:new A(-m-c*2,m),R:new A(m+c*2,m),T:new A(m,m+c*2),B:new A(m,-m-c*2)}[t],b=this.userParams.flip===!0,x=this.userParams.reverse===!0,v={L:"right",R:"left",T:"left",B:"left"},S={L:"bottom",R:"bottom",T:"bottom",B:"top"},k=v[t],M=S[t];b&&(t==="L"||t==="R")&&(g=g.flip()),b&&(t==="T"||t==="B")&&(M=t==="T"?"top":"bottom"),x&&(t==="L"||t==="R")&&(k=t==="L"?"left":"right"),x&&(t==="T"||t==="B")&&(g=g.mirrorx(0));let _=o.add(g);this.segments.push(new W([_.x,_.y],String(n.pin),{fontsize:n.pinlblsize??i.pinlabel_size,align:[k,M]}))}if(n.name===">"){this._drawClkpin(o,l,t);return}if(n.name&&n.name!==""){let c={L:new A(i.label_ofst,0),R:new A(-i.label_ofst,0),T:new A(0,-i.label_ofst),B:new A(0,i.label_ofst)},m=o.add(c[t]),f=this.userParams.flip===!0,g=this.userParams.reverse===!0,b={L:"left",R:"right",T:"center",B:"center"},x={L:"center",R:"center",T:"top",B:"bottom"},v=b[t],S=x[t];f&&(t==="T"||t==="B")&&(S=t==="T"?"bottom":"top"),g&&(t==="L"||t==="R")&&(v=t==="L"?"right":"left"),this.segments.push(new W([m.x,m.y],n.name,{fontsize:n.lblsize??i.label_size,color:n.color??void 0,align:[v,S],href:n.href??void 0,decoration:n.decoration??void 0,rotation:n.rotation??0}))}}_drawPins(){for(let t of["L","R","T","B"])this.pins[t].forEach((n,s)=>this._drawPin(t,n,s))}_place(t,n,s){return this.anchors={},this._setsize(),this._icbox=this._drawBox(),this._drawPins(),this.elmParams.lblloc="center",this.anchors.center=[this._icbox.w/2,this._icbox.h/2],this.elmParams.drop=[this._icbox.w,this._icbox.h/2],super._place(t,n,s)}},Q0=class extends nr{constructor(e={}){let{demux:t=!1,...n}=e,s=e.slant!==void 0?e.slant:25;super({...n,slant:t?s:-s})}},ei=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"D",side:"L",slot:"2/2"},{name:">",side:"L",slot:"1/2"},{name:"Q",side:"R",slot:"2/2"},{name:"Q",side:"R",slot:"1/2",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},ti=class extends nr{constructor(e={}){let{preclr:t=!1,preclrinvert:n=!0,...s}=e,i=[{name:"J",side:"L",slot:"3/3"},{name:">",side:"L",slot:"2/3"},{name:"K",side:"L",slot:"1/3"},{name:"Q",side:"R",slot:"3/3"},{name:"Q",side:"R",slot:"1/3",anchorname:"Qbar",decoration:"overline"}];t&&(i.push({name:"PRE",side:"T",invert:n}),i.push({name:"CLR",side:"B",invert:n})),super({...s,pins:i,size:s.size??[2,3]})}},ri=class extends nr{constructor(e={}){let t=[{name:"in",side:"L",slot:"3/3"},{name:"out",side:"R",slot:"3/3"},{name:"gnd",side:"B"}];super({...e,pins:t,size:e.size??[2,1.5]})}},ni=class extends nr{constructor(e={}){let t=[{name:"TRG",side:"L",pin:"2"},{name:"THR",side:"L",pin:"6"},{name:"DIS",side:"L",pin:"7"},{name:"CTL",side:"R",pin:"5"},{name:"OUT",side:"R",pin:"3"},{name:"RST",side:"T",pin:"4"},{name:"Vcc",side:"T",pin:"8"},{name:"GND",side:"B",pin:"1"}];super({...e,edgepadW:.5,edgepadH:1,pinspacing:1.5,leadlen:1,pins:t,label:"555"})}};function Bc(r){let e=r.bottom??0,t=r.left??0,n=r.seglen??1.5,s=r.segw??.3,i=r.spacing??.12,o=r.digit??8,a=r.segcolor??"red",l=r.tilt??10,h=r.labelsegments??!0,c=s/2,m=s/5,f=i/2,g=l*Math.PI/180,b=Math.sin(g),x=[f,f+c,n-f-c,n-f,n-f-c,f+c],v=[0,c,c,0,-c,-c],S=[...x],k=[...x],M=v.map(Re=>Re+n*2),_=v.map(Re=>Re+n),B=[0,c,c,0,-c,-c],$=[f,f+c,n-f-c,n-f,n-f-c,f+c],Y=[...B],Z=$.map(Re=>Re+n),L=B.map(Re=>Re+n),I=[...Z],X=[...L],j=[...$],re=[n/2+f,n*2+c+m],te=[n/2+f,n+c+m],ke=[n/2+f,c+m],he=[n+c+f,n*1.5],ve=[n+c+f,n*.5],de=[-c-f,n*.5],Fe=[-c-f,n*1.5],qe=Re=>[Re[0]+Re[1]*b,Re[1]],Ie=t;l!==0&&(S=S.map((Re,nt)=>Re+b*M[nt]),L=L.map((Re,nt)=>Re+b*I[nt]),X=X.map((Re,nt)=>Re+b*j[nt]),x=x.map((Re,nt)=>Re+b*v[nt]),B=B.map((Re,nt)=>Re+b*$[nt]),Y=Y.map((Re,nt)=>Re+b*Z[nt]),k=k.map((Re,nt)=>Re+b*_[nt]),re=qe(re),te=qe(te),ke=qe(ke),he=qe(he),ve=qe(ve),de=qe(de),Fe=qe(Fe),Ie-=b*n);let ge=Re=>Re.map(nt=>nt+Ie),Me=Re=>Re.map(nt=>nt+e);x=ge(x),v=Me(v),k=ge(k),_=Me(_),S=ge(S),M=Me(M),B=ge(B),$=Me($),Y=ge(Y),Z=Me(Z),L=ge(L),I=Me(I),X=ge(X),j=Me(j),re=[re[0]+Ie,re[1]+e],te=[te[0]+Ie,te[1]+e],ke=[ke[0]+Ie,ke[1]+e],he=[he[0]+Ie,he[1]+e],ve=[ve[0]+Ie,ve[1]+e],de=[de[0]+Ie,de[1]+e],Fe=[Fe[0]+Ie,Fe[1]+e];let be=String(o).toLowerCase(),Be=["2","3","5","6","7","8","9","0","a","c","e","f"].includes(be)?a:void 0,De=["1","2","3","4","7","8","9","0","a","d"].includes(be)?a:void 0,ye=["1","3","4","5","6","7","8","9","0","a","b","d"].includes(be)?a:void 0,_e=["2","3","5","6","8","9","0","b","c","d","e"].includes(be)?a:void 0,Ae=["2","6","8","0","a","b","c","d","e","f"].includes(be)?a:void 0,Ze=["4","5","6","8","9","0","a","b","c","e","f"].includes(be)?a:void 0,gn=["2","3","4","5","6","8","9","a","b","d","e","f"].includes(be)?a:void 0,ft=[],Tt=(Re,nt,hh)=>ft.push(new U(Re.map((ch,La)=>[ch,nt[La]]),{closed:!0,fill:hh??!1,color:"gray",lw:.5}));return Tt(S,M,Be),Tt(L,I,De),Tt(X,j,ye),Tt(x,v,_e),Tt(B,$,Ae),Tt(Y,Z,Ze),Tt(k,_,gn),h&&(ft.push(new W(re,"a",{align:["center","bottom"],fontsize:10})),ft.push(new W(te,"g",{align:["center","bottom"],fontsize:10})),ft.push(new W(ke,"d",{align:["center","bottom"],fontsize:10})),ft.push(new W(he,"b",{align:["left","center"],fontsize:10})),ft.push(new W(ve,"c",{align:["left","center"],fontsize:10})),ft.push(new W(de,"e",{align:["right","center"],fontsize:10})),ft.push(new W(Fe,"f",{align:["right","center"],fontsize:10}))),r.decimal&&ft.push(new D([Ie+n+s+.15/2,e],.15,{color:"gray",fill:a,lw:.5})),ft}var si=class extends nr{constructor(e={}){let t=R(e,"decimal",!1),n=t?"8":"7",s=t?5.9:5.3,o=e.size??[3,s],a=[{pin:"a",side:"L",slot:`${7+(t?1:0)}/${n}`,anchorname:"a"},{pin:"b",side:"L",slot:`${6+(t?1:0)}/${n}`,anchorname:"b"},{pin:"c",side:"L",slot:`${5+(t?1:0)}/${n}`,anchorname:"c"},{pin:"d",side:"L",slot:`${4+(t?1:0)}/${n}`,anchorname:"d"},{pin:"e",side:"L",slot:`${3+(t?1:0)}/${n}`,anchorname:"e"},{pin:"f",side:"L",slot:`${2+(t?1:0)}/${n}`,anchorname:"f"},{pin:"g",side:"L",slot:`${1+(t?1:0)}/${n}`,anchorname:"g"}];t&&a.push({pin:"dp",side:"L",slot:`1/${n}`,anchorname:"dp"}),R(e,"anode",!1)&&a.push({pin:"ca",side:"T",anchorname:"anode"}),R(e,"cathode",!1)&&a.push({pin:"cc",side:"B",anchorname:"cathode"}),super({...e,pins:a,size:o,pinspacing:.6});let l=.8,c=(s-1.5*2)/2;this.segments.push(...Bc({left:l,bottom:c,decimal:t,digit:R(e,"digit",8),segcolor:R(e,"segcolor","red"),tilt:R(e,"tilt",10),labelsegments:R(e,"labelsegments",!0)}))}},ii=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pins:8,notch:!0,width:3,pinw:.6,spacing:.5,number:!0,fontsize:12,pfontsize:10});let t=R(this.params,"width",3),n=R(this.params,"pinw",.6),s=R(this.params,"spacing",.5),i=R(this.params,"pins",8),o=R(this.params,"names",void 0);if(i%2===1)throw new Error("pins must be even");let a=i/2*n+s*(i/2+1);if(this.segments.push(new U([[0,0],[t,0],[t,a],[0,a]],{closed:!0})),R(this.params,"notch",!0)){let h=t/2,c=ze(-Math.PI,0,50),m=n/2,f=c.map(b=>h+m*Math.cos(b)),g=c.map(b=>a+m*Math.sin(b));this.segments.push(new p(f.map((b,x)=>[b,g[x]])))}let l=i/2;for(let h=0;h<l;h++){let c=s+s*h+h*n,m=s+s*h+(h+1)*n,f=(c+m)/2;this.segments.push(new U([[0,c],[0,m],[-n,m],[-n,c]],{closed:!0}));let g=l-h;this.anchors[`p${g}`]=[-n,f],this.anchors[`p${g}_in`]=[0,f],R(this.params,"number",!0)&&this.segments.push(new W([-n/2,f],String(g),{fontsize:R(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([.1,f],o[g-1],{align:["left","center"],fontsize:R(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[-n,f],this.anchors[`${o[g-1]}_in`]=[0,f]),this.segments.push(new U([[t,c],[t,m],[t+n,m],[t+n,c]],{closed:!0})),g=l+h+1,this.anchors[`p${g}`]=[t+n,f],this.anchors[`p${g}_in`]=[t,f],R(this.params,"number",!0)&&this.segments.push(new W([t+n/2,f],String(g),{fontsize:R(this.params,"pfontsize",10)})),o&&o[g-1]&&(this.segments.push(new W([t-.1,f],o[g-1],{align:["right","center"],fontsize:R(this.params,"fontsize",12)})),this.anchors[o[g-1]]=[t+n,f],this.anchors[`${o[g-1]}_in`]=[t,f])}}};var Kc={};Fa(Kc,{Adc:()=>Is,Amp:()=>cn,And:()=>Bt,Bjt:()=>jr,Bjt2:()=>qr,BjtNpn:()=>Ht,BjtNpn2:()=>ys,BjtPnp:()=>rr,BjtPnp2:()=>an,Breaker:()=>os,Buf:()=>Jt,CPE:()=>as,Capacitor:()=>Br,Capacitor2:()=>Bn,CapacitorTrim:()=>In,CapacitorVar:()=>Cn,Circle:()=>hi,Circulator:()=>Ns,Connect:()=>pr,Crystal:()=>Vn,CurrentMirror:()=>Or,Dac:()=>Ls,Data:()=>ks,Decision:()=>zs,Demod:()=>Ds,Diac:()=>sn,Diode:()=>et,DiodeShockley:()=>Fn,DiodeTVS:()=>On,DiodeTunnel:()=>Nn,DrawTree:()=>i0,DspBox:()=>sr,DspCircle:()=>Yt,DspSpeaker:()=>As,Ellipse:()=>Ms,Filter:()=>Cs,FlowBox:()=>hn,Fuse:()=>ts,FuseIEC:()=>Lr,FuseIEEE:()=>dr,FuseUS:()=>is,Inductor:()=>Cr,Inductor2:()=>Ir,Isolator:()=>Os,Josephson:()=>ss,LED:()=>jn,LED2:()=>qn,LogicTree:()=>gr,Memristor:()=>rs,Memristor2:()=>ns,Mixer:()=>Ts,NFet:()=>fs,NFet2:()=>bs,NMos:()=>us,NMos2:()=>ds,Norator:()=>Nr,Not:()=>Kt,Nullator:()=>Dr,Opamp:()=>hs,Or:()=>$t,Oscillator:()=>Bs,OscillatorBox:()=>_s,PFet:()=>gs,PFet2:()=>ws,PMos:()=>ms,PMos2:()=>ps,Photodiode:()=>Hn,Photoresistor:()=>es,PhotoresistorIEC:()=>Qt,PhotoresistorIEEE:()=>ur,Potentiometer:()=>Qn,PotentiometerIEC:()=>er,PotentiometerIEEE:()=>mr,Process:()=>ai,Resistor:()=>Kn,ResistorIEC:()=>mt,ResistorVar:()=>Zn,ResistorVarIEC:()=>Zt,ResistorVarIEEE:()=>cr,RoundBox:()=>Hr,RoundProcess:()=>oi,Rshunt:()=>Jn,SCR:()=>Yn,STYLE_IEC:()=>Yl,STYLE_IEEE:()=>on,Schottky:()=>Ln,SparkGap:()=>ls,Start:()=>li,State:()=>ci,StateEnd:()=>Es,Subroutine:()=>Ss,Sum:()=>Ps,SumSigma:()=>Rs,Terminal:()=>ln,Thermistor:()=>Un,Triac:()=>Xn,Tristate:()=>_n,VGA:()=>Fs,Varactor:()=>$n,VoltageMirror:()=>Fr,Zener:()=>Dn,buchheim:()=>Ra,cycloid:()=>Wn,logicparse:()=>Zl,nand:()=>Pn,nor:()=>Rn,pictorial:()=>Uc,resetElementStyleForTests:()=>Gl,setBoxAnchors16:()=>fr,setElementStyle:()=>Xl,xnor:()=>An,xor:()=>Tn});function fr(r,e,t){r.center=[e/2,0],r.N=[e/2,t/2],r.E=[e,0],r.S=[e/2,-t/2],r.W=[0,0],r.NW=[0,t/2],r.NE=[e,t/2],r.SW=[0,-t/2],r.SE=[e,-t/2],r.NNE=[3*e/4,t/2],r.NNW=[e/4,t/2],r.SSE=[3*e/4,-t/2],r.SSW=[e/4,-t/2],r.ENE=[e,t/3],r.ESE=[e,-t/3],r.WNW=[0,t/3],r.WSW=[0,-t/3]}function a2(r,e,t,n){let s=n-n*Math.sqrt(2)/2;fr(r,e,t),r.NW=[s,t/2-s],r.NE=[e-s,t/2-s],r.SW=[s,-t/2+s],r.SE=[e-s,-t/2+s],r.NNE=[n<e/4?3*e/4:e-n,t/2],r.NNW=[n<e/4?e/4:n,t/2],r.SSE=[n<e/4?3*e/4:e-n,-t/2],r.SSW=[n<e/4?e/4:n,-t/2],r.ENE=[e,n<t/4?t/4:t/2-n],r.ESE=[e,n<t/4?-t/4:-t/2+n],r.WNW=[0,n<t/4?t/4:t/2-n],r.WSW=[0,n<t/4?-t/4:-t/2+n]}function l2(r,e,t,n){fr(r,e,t);let s=n*Math.sqrt(2)/2;r.SE=[n+s,-s],r.SW=[n-s,-s],r.NE=[n+s,s],r.NW=[n-s,s];let i=n*Math.cos(22.5*Math.PI/180),o=n*Math.cos(67.5*Math.PI/180);r.NNE=[n+o,i],r.ENE=[n+i,o],r.ESE=[n+i,-o],r.SSE=[n+o,-i],r.NNW=[n-o,i],r.WNW=[n-i,o],r.WSW=[n-i,-o],r.SSW=[n-o,-i]}var Hr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,cornerradius:.3});let t=R(this.params,"w",3),n=R(this.params,"h",2),s=R(this.params,"cornerradius",.3);this.segments.push(new U([[0,n/2],[t,n/2],[t,-n/2],[0,-n/2]],{closed:!0,cornerradius:s,fill:"none"})),a2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},ln=class extends Hr{constructor(e={}){let t=e.h??1.25,n=e.w??3,s=e.anchor??"N";super({...e,w:n,h:t,cornerradius:t/2,anchor:s}),this.elmParams.drop=[n/2,-t/2],this.elmParams.droptheta=-90}},oi=Hr,hn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=R(this.params,"w",3),n=R(this.params,"h",2);this.segments.push(new p([[0,0],[0,n/2],[t,n/2],[t,-n/2],[0,-n/2],[0,0]])),fr(this.anchors,t,n),this.elmParams.drop=[t,0]}},ai=hn,li=ln,Ss=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,s:.3});let t=R(this.params,"s",.3),n=R(this.params,"w",3)+t*2,s=R(this.params,"h",2);this.segments.push(new p([[0,0],[0,s/2],[n,s/2],[n,-s/2],[0,-s/2],[0,0]])),this.segments.push(new p([[n-t,s/2],[n-t,-s/2]])),this.segments.push(new p([[t,s/2],[t,-s/2]])),fr(this.anchors,n,s),this.elmParams.drop=[n,0]}},ks=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0,slant:.5});let t=R(this.params,"w",3),n=R(this.params,"h",2),s=R(this.params,"slant",.5);this.segments.push(new U([[0,0],[s/2,n/2],[t+s/2,n/2],[t-s/2,-n/2],[-s/2,-n/2]],{closed:!0,fill:"none"})),fr(this.anchors,t,n),this.anchors.N=[t/2+s/2,n/2],this.anchors.S=[t/2-s/2,-n/2],this.anchors.NE=[t+s/2,n/2],this.anchors.SE=[t-s/2,-n/2],this.anchors.NW=[s/2,n/2],this.anchors.SW=[-s/2,-n/2],this.anchors.ENE=[t+s/4,n/4],this.anchors.WNW=[s/4,n/4],this.anchors.ESE=[t-s/4,-n/4],this.anchors.WSW=[-s/4,-n/4],this.anchors.NNE=[3*t/4+s/2,n/2],this.anchors.SSE=[3*t/4-s/2,-n/2],this.anchors.NNW=[t/4+s/2,n/2],this.anchors.SSW=[t/4-s/2,-n/2],this.elmParams.drop=[t,0]}},Ms=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:3,h:2,theta:0});let t=R(this.params,"w",3),n=R(this.params,"h",2),i=ze(0,Math.PI*2,50).map(c=>{let m=n/2*Math.sin(c);return[t/2*Math.cos(c)+t/2,m]});i[i.length-1]=[i[0][0],i[0][1]],this.segments.push(new p(i)),fr(this.anchors,t,n);let o=Math.sin(Math.PI/4),a=Math.cos(Math.PI/4),l=Math.sin(Math.PI/8),h=Math.cos(Math.PI/8);this.anchors.SE=[t/2+t/2*a,-n/2*o],this.anchors.SW=[t/2-t/2*a,-n/2*o],this.anchors.NW=[t/2-t/2*a,n/2*o],this.anchors.NE=[t/2+t/2*a,n/2*o],this.anchors.ENE=[t/2+t/2*h,n/2*l],this.anchors.WNW=[t/2-t/2*h,n/2*l],this.anchors.ESE=[t/2+t/2*h,-n/2*l],this.anchors.WSW=[t/2-t/2*h,-n/2*l],this.anchors.NNE=[t/2+t/2*l,n/2*h],this.anchors.NNW=[t/2-t/2*l,n/2*h],this.anchors.SSE=[t/2+t/2*l,-n/2*h],this.anchors.SSW=[t/2-t/2*l,-n/2*h],this.elmParams.drop=[t,0]}},zs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:4,h:2.25,theta:0,fontsize:14});let t=R(this.params,"w",4),n=R(this.params,"h",2.25),s=R(this.params,"fontsize",14),i=R(this.params,"font",void 0),o=.13,a=e.N,l=e.E,h=e.S,c=e.W;this.segments.push(new U([[0,0],[t/2,n/2],[t,0],[t/2,-n/2]],{closed:!0,fill:"none"})),a&&this.segments.push(new W([t/2+o,n/2+o],a,{align:["left","bottom"],fontsize:s,fontfamily:i})),h&&this.segments.push(new W([t/2+o,-n/2-o],h,{align:["left","top"],fontsize:s,fontfamily:i})),l&&this.segments.push(new W([t+o,o],l,{align:["left","bottom"],fontsize:s,fontfamily:i})),c&&this.segments.push(new W([-o,o],c,{align:["right","bottom"],fontsize:s,fontfamily:i})),fr(this.anchors,t,n),this.anchors.NE=[3*t/4,n/4],this.anchors.NW=[t/4,n/4],this.anchors.SE=[3*t/4,-n/4],this.anchors.SW=[t/4,-n/4],this.anchors.NNE=[5*t/8,3*n/8],this.anchors.NNW=[3*t/8,3*n/8],this.anchors.SSE=[5*t/8,-3*n/8],this.anchors.SSW=[3*t/8,-3*n/8],this.anchors.ENE=[7*t/8,n/8],this.anchors.ESE=[7*t/8,-n/8],this.anchors.WNW=[t/8,n/8],this.anchors.WSW=[t/8,-n/8],this.elmParams.drop=[t,0]}},pr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{w:1.5,h:1.5,r:.75});let t=R(this.params,"w",1.5),n=R(this.params,"h",1.5);if(e.r!==void 0){let i=e.r;t=i*2,n=i*2}let s=t/2;this.segments.push(new D([s,0],s)),l2(this.anchors,t,n,s),this.elmParams.drop=[t,0]}},hi=pr,ci=pr,Es=class extends pr{constructor(e={}){let t=e.dr??.15,n=e.w??1.5,s=e.h??1.5;if(e.r!==void 0){let h=e.r;n=h*2,s=h*2}let{r:i,...o}=e;super({...o,w:n,h:s});let l=R(this.params,"w",n)/2;this.segments.push(new D([l,0],l-t))}};var sr=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1,.5],[1,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.anchors.N=[.5,.5],this.anchors.S=[.5,-.5],this.anchors.E=[1,0],this.anchors.W=[0,0],this.elmParams.drop=[1,0]}},Yt=class extends N{constructor(e={}){super(e);let t=e.radius??.5,n=t*Math.SQRT2/2;this.segments.push(new D([t,0],t)),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[2*t,0],this.anchors.N=[t,t],this.anchors.S=[t,-t],this.anchors.E=[2*t,0],this.anchors.W=[0,0],this.anchors.NW=[t-n,n],this.anchors.NE=[t+n,n],this.anchors.SW=[t-n,-n],this.anchors.SE=[t+n,-n],this.anchors.center=[t,0]}},Ps=class extends Yt{constructor(e={}){super(e),this.segments.push(new p([[.5,.2],[.5,-.2]])),this.segments.push(new p([[.3,0],[.7,0]]))}},Rs=class extends Yt{constructor(e={}){super(e),this.segments.push(new W([.45,0],"\u03A3",{align:["center","center"]}))}},Ts=class extends Yt{constructor(e={}){super(e);let t=.5,n=t*Math.SQRT2/2;this.segments.push(new p([[t+n,n],[t-n,-n]],{lw:1})),this.segments.push(new p([[t+n,-n],[t-n,n]],{lw:1})),this.elmParams.lblloc="top",this.elmParams.lblofst=.2;let s=e.font,i=e.fontsize??10;e.N&&this.segments.push(new W([t,t/2+.01],e.N,{fontfamily:s,fontsize:i})),e.S&&this.segments.push(new W([t,-t/2-.065],e.S,{fontfamily:s,fontsize:i})),e.E&&this.segments.push(new W([t*1.5+.05,0],e.E,{fontfamily:s,fontsize:i})),e.W&&this.segments.push(new W([t/2-.05,0],e.W,{fontfamily:s,fontsize:i}))}},As=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.25],[.25,.25],[.25,-.25],[0,-.25],[0,0]])),this.segments.push(new p([[.25,.25],[.5,.5],[.5,-.5],[.25,-.25],[.25,.25]]))}},cn=class extends N{constructor(e={}){super(e);let t=1,n=.75;this.segments.push(new p([[0,0],[0,-t/2],[n,0],[0,t/2],[0,0]])),this.elmParams.drop=[n,0],this.anchors.input=[0,0],this.anchors.out=[n,0]}};function Cc(){return ze(-Math.PI,Math.PI,20).map(e=>[e/Math.PI*.3+.5,-Math.sin(e)/10])}var _s=class extends sr{constructor(e={}){super(e),this.segments.push(new p(Cc()))}},Bs=class extends Yt{constructor(e={}){super(e),this.segments.push(new p(Cc()))}},Cs=class extends sr{constructor(e={}){super(e);let t=Cc(),n=t.map(([o,a])=>[o,a+.25]),s=t.map(([o,a])=>[o,a-.25]);this.segments.push(new p(t)),this.segments.push(new p(n)),this.segments.push(new p(s));let i=e.response;if(i){let o=i.toLowerCase();(o==="bp"||o==="lp")&&this.segments.push(new p([[.45,.17],[.55,.33]])),(o==="bp"||o==="hp")&&this.segments.push(new p([[.45,-.33],[.55,-.17]])),(o==="lp"||o==="hp"||o==="notch")&&this.segments.push(new p([[.45,-.08],[.55,.08]]))}}},Is=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.22,.5],[1.4,.5],[1.4,-.5],[.22,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ls=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[0,.5],[1.18,.5],[1.4,0],[1.18,-.5],[0,-.5],[0,0]])),this.elmParams.lblloc="center",this.elmParams.lblofst=0,this.elmParams.drop=[1.4,0],this.anchors.input=[0,0],this.anchors.out=[1.4,0],this.anchors.E=[1.4,0],this.anchors.W=[0,0]}},Ds=class extends sr{constructor(e={}){super(e),this.segments.push(new p([[.15,0],[.3,0]])),this.segments.push(new p([[.3,.25],[.7,0],[.3,-.25],[.3,.25]])),this.segments.push(new p([[.7,.25],[.7,-.25]])),this.segments.push(new p([[.7,0],[.85,0]]))}},Ns=class extends Yt{constructor(e={}){super(e);let t=.5;this.segments.push(new xe([.5,0],.9*t,.9*t,{theta1:20,theta2:200,arrow:"cw"}))}},Os=class extends sr{constructor(e={}){super(e);let t=.25;this.segments.push(new p([[t,0],[1-t,0]],{arrow:"->"}))}},Fs=class extends cn{constructor(e={}){super(e);let t=e.tuneup??!0;this.segments.push(new p([[-.1,-.5],[.75,.5]],{arrow:"->"})),this.anchors.tune=[.325,t?.5:-.5]}};var Uc={};Fa(Uc,{Breadboard:()=>Wc,CapacitorCeramic:()=>Yc,CapacitorElectrolytic:()=>qc,CapacitorMylar:()=>Hc,DIP:()=>Gc,Diode:()=>Dc,ElementPictorial:()=>Pa,FritzingPart:()=>Vc,INCH:()=>Ce,LED:()=>js,LEDBlue:()=>$c,LEDGreen:()=>Fc,LEDOrange:()=>Nc,LEDWhite:()=>jc,LEDYellow:()=>Oc,MILLIMETER:()=>h2,PINSPACING:()=>ee,Resistor:()=>Lc,TO92:()=>Xc,fritzParts:()=>p2,parseSizeToUnits:()=>u2,resistorColors:()=>g1});var $s=class extends N{constructor(e,t,n,s={}){super(s);let{xy:i,imgfmt:o,zorder:a,...l}=s;this.segments.push(new _r(e,{xy:i??[0,0],width:t,height:n,zorder:a??1,imgfmt:o})),this.elmParams.theta=0;let h=t/2,c=n/2,m=(i?.[0]??0)+h,f=(i?.[1]??0)+c;this.anchors.center=[m,f],this.anchors.N=[m,f+c],this.anchors.S=[m,f-c],this.anchors.E=[m+h,f],this.anchors.W=[m-h,f]}};var Ce=3.5,h2=Ce/25.4,ee=.1*Ce,Ea="#333",f1="#777",Lt="#A0A0A0",c2=96;function u2(r){return m2(r)/c2*Ce}function m2(r){let e=r.match(/^([0-9.]+)\s*(px|pt|in|mm|cm|pc|em|ex|%)?$/i);if(!e)return 0;let t=parseFloat(e[1]);switch((e[2]??"px").toLowerCase()){case"px":return t;case"pt":return t*(96/72);case"in":return t*96;case"mm":return t*(96/25.4);case"cm":return t*(96/2.54);case"pc":return t*16;default:return t}}var Ic={0:"black",1:"brown",2:"red",3:"orange",4:"yellow",5:"green",6:"blue",7:"violet",8:"gray",9:"white",[-1]:"gold",[-2]:"silver",[-3]:"pink"},d2={1:"brown",2:"red","0.05":"orange","0.02":"yellow","0.5":"green","0.25":"blue","0.1":"violet","0.01":"gray",5:"gold",10:"silver"};function g1(r,e){let t=Math.floor(Math.log10(r))-1,n=r/10**t;n<10&&(t-=1,n=r/10**t);let s=Math.floor(n/10),i=Math.floor(n%10),o=e!==void 0?d2[String(e)]:void 0;return[Ic[s],Ic[i],Ic[t],o]}var Pa=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{leadcolor:Lt,lw:3})}},Lc=class extends Pa{constructor(e=1e3,t,n={}){super(n),Object.assign(this.defaults,{fill:"blanchedalmond"});let s=ee,i=ee/2,o=i*.9;this.segments.push(new p([[0,0],[NaN,NaN],[i*3+s,0]])),this.segments.push(new ut(["M",[0,0],"Q",[0,i],[i,i],"Q",[i*1.25,i],[i*1.5,o],"L",[i*1.5+s,o],"Q",[i*1.75+s,i],[i*2+s,i],"Q",[i*3+s,i],[i*3+s,0],"Q",[i*3+s,-i],[i*2+s,-i],"Q",[i*1.75+s,-i],[i*1.5+s,-o],"L",[i*1.5,-o],"Q",[i*1.25,-i],[i,-i],"Q",[0,-i],[0,0],"Z"],{color:"black",lw:1}));let a=.16,l=.32,h=.48,c=.68,m=.08,[f,g,b,x]=g1(e,t);this.segments.push(new U([[a,o],[a,-o],[a+m,-o],[a+m,o]],{fill:f,lw:.1,zorder:2})),this.segments.push(new U([[l,o],[l,-o],[l+m,-o],[l+m,o]],{fill:g,lw:.1,zorder:2})),this.segments.push(new U([[h,o],[h,-o],[h+m,-o],[h+m,o]],{fill:b,lw:.1,zorder:2})),x&&this.segments.push(new U([[c,o],[c,-o],[c+m,-o],[c+m,o]],{fill:x,lw:.1,zorder:2}))}},Dc=class extends Pa{constructor(e={}){super(e),Object.assign(this.defaults,{fill:Ea,stripe_color:"silver"});let t=ee/2,n=ee*2.5,s=n*.78,i=.08,o=this.params.stripe_color??"silver";Wr(o),this.segments.push(new p([[0,0],[NaN,NaN],[n,0]])),this.segments.push(new U([[0,t],[n,t],[n,-t],[0,-t]],{closed:!0,lw:1,color:"black",zorder:2})),this.segments.push(new U([[s,t],[s+i,t],[s+i,-t],[s,-t]],{closed:!0,lw:1,color:"none",fill:o,zorder:2}))}},js=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead_length:ee*5,fill:"#dd4433",theta:0});let t=.197*Ce,n=.338*Ce,s=this.params.lead_length??ee*5,i=ee*5;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s-i*.3],[ee*.6,s-i*.2],[ee*.6,s]],{color:Lt,lw:4}));let o=t*.8,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.2],[a+t,s],"L",[a+t,h-o],"C",[a+t,h],[a,h],[a,h-o],"Z"],{color:"none"}));let c=.039*Ce;this.segments.push(new ut(["M",[a,s+c/2],"Q",[l*.5,s-i*.16+c],[a+t*.7,s-i*.03],"L",[a+t,s+c/2]],{color:"#FFFFFF55",lw:2}));let m=a+.03*Ce;this.segments.push(new ut(["M",[m,s+c*2],"L",[m,h-o],"Q",[m,h-o+.04*Ce],[m+.04*Ce,h-o+.07*Ce]],{color:"#FFFFFF55",lw:3}))}},Nc=class extends js{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#efa207"})}},Oc=class extends js{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#f1de0f"})}},Fc=class extends js{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#4be317"})}},$c=class extends js{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#3892bc"})}},jc=class extends js{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e5e5e5"})}},qc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#303b91",lead_length:.2*Ce,cap_color:"#CCC",stripe_color:"#dff1f6",theta:0});let t=ee*1.7,n=.3*Ce,s=this.params.lead_length??.2*Ce;this.segments.push(new p([[0,0],[0,s]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,s]],{color:Lt,lw:4}));let i=ee*2,o=i*.3,a=ee/2-t/2,l=ee/2,h=s+n;this.segments.push(new ut(["M",[a,s],"Q",[l,s-i*.3],[a+t,s],"L",[a+t,h-o],"Q",[l,h],[a,h-o],"Z"],{color:"none"}));let c=this.params.cap_color??"#CCC";this.segments.push(new xe([l,h-o-.01*Ce],t-.03*Ce,o*.9,{theta1:0,theta2:360,fill:c,color:"none",lw:.5,zorder:2}));let m=.039*Ce/2;this.segments.push(new ut(["M",[a,s+m],"Q",[l,s-i*.1],[a+t,s+m]],{color:"#FFFFFF99",fill:"none",lw:1.5}));let f=this.params.stripe_color??"#dff1f6",g=a+.03*Ce;this.segments.push(new ut(["M",[g,s+m],"L",[g,h-o*2]],{color:f,fill:"none",lw:3}))}},Hc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#8c2510",lead_length:.4*Ce,theta:0});let t=ee*1.75,n=t*.75,s=ee/2,i=s-t/2,o=this.params.lead_length??.4*Ce;this.segments.push(new p([[0,0],[0,o]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,o]],{color:Lt,lw:4}));let a=.02*Ce;this.segments.push(new ut(["M",[i,o],"Q",[i-a,o+n/2],[i,o+n],"Q",[s,o+n+a],[i+t,o+n],"Q",[i+t+a,o+n/2],[i+t,o],"Q",[s,o+a/2],[i,o],"Z"],{color:"none"}));let l=o+n-.025*Ce;this.segments.push(new p([[-.01*Ce,l],[ee*.8,l]],{color:"#FFFFFF44",lw:3}))}},Yc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{fill:"#e2800b",radius:.1*Ce,lead_length:.4*Ce,theta:0});let t=this.params.radius??.1*Ce,n=this.params.lead_length??.4*Ce,s=[ee/2,n+t-.05*Ce];this.segments.push(new p([[0,0],[0,n]],{color:Lt,lw:4})),this.segments.push(new p([[ee,0],[ee,n]],{color:Lt,lw:4})),this.segments.push(new D(s,t,{color:"none",zorder:2})),this.segments.push(new xe(s,t*2*.7,t*2*.7,{theta1:100,theta2:200,color:"#FFFFFF44",zorder:2}))}},Xc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{theta:0});let t=.175*Ce,n=.17*Ce*.9,s=ee*1.2,i=ee*1.3,o=ee-t/2,a=ee;this.segments.push(new p([[0,0],[0,ee*.8],[ee/2,i]],{color:Lt,lw:4})),this.segments.push(new p([[a,0],[a,i]],{color:Lt,lw:4})),this.segments.push(new p([[ee*2,0],[ee*2,ee*.8],[3*ee/2,i]],{color:Lt,lw:4})),this.segments.push(new U([[o,i],[o+t,i],[o+t,i+n],[o,i+n]],{fill:Ea,lw:1,color:f1,zorder:2})),this.segments.push(new xe([a,i+n],t,s,{theta1:0,theta2:180,fill:Ea,lw:1,color:f1,zorder:2})),this.anchors.pin1=[0,0],this.anchors.pin2=[ee,0],this.anchors.pin3=[ee*2,0],this.anchors.case_center=[a,i+n/2],this.elmParams.lblloc="case_center",this.elmParams.lblalign=["center","center"]}},Gc=class extends N{constructor(e=8,t=!1,n={}){super(n),Object.assign(this.defaults,{theta:0});let s=e;s%2!==0&&(s+=1);let i=t?6*ee:3*ee,o=ee*.25,a=ee*.25,l=(s/2-1)*ee,h=i/2,c=ee*.75,m=a,f=i-a,g=5;for(let b=0;b<s/2;b++)this.segments.push(new p([[0,-b*ee],[m,-b*ee]],{color:Lt,lw:g,zorder:1})),this.segments.push(new p([[f,-b*ee],[f+a,-b*ee]],{color:Lt,lw:g,zorder:1})),this.anchors[`pin${b+1}`]=[0,-b*ee],this.anchors[`pin${s-b}`]=[f+a,-b*ee];this.segments.push(new U([[a,o],[f,o],[f,-o-l],[a,-o-l]],{fill:Ea,lw:1,color:"#444"})),this.segments.push(new xe([h,o],c,c,{theta1:180,theta2:0,lw:1,color:"#777",fill:"#555"})),this.elmParams.lblloc="center",this.elmParams.lblrotate=!0,this.elmParams.lblofst=0}},Wc=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{color:"#DDD",fill:"#F8F8F5",shadow_color:"#E5E5E5",text_color:"#666"});let t=.02,n=.1,s=this.params.shadow_color??"#E5E5E5",i=this.params.text_color??"#666";Wr(s),Wr(i);let o=(k,M)=>{this.segments.push(new U([[k-n,M+n],[k+n,M+n],[k+n,M-n]],{fill:!0,color:s,lw:2})),this.segments.push(new U([[k-t,M-t],[k-t,M+t],[k+t,M+t],[k+t,M-t]],{fill:!0,color:Ea,lw:2}))},a=30,l=5,h=.37*Ce,c=(h-ee)/2,m=2.1*Ce,f=3.3*Ce,g=1.5*c,b=-c,x=b+m;this.segments.push(new U([[b,g],[x,g],[x,g-f],[b,g-f]],{lw:2}));let v=0,S=0;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[v,S-M*ee],B=[v+ee,S-M*ee];o(..._),o(...B),this.anchors[`L1_${M}`]=_,this.anchors[`L2_${M}`]=B}v=x-c;for(let k=0;k<2;k++)for(let M=0;M<a;M++){if(M%6===0)continue;let _=[v,S-M*ee],B=[v-ee,S-M*ee];o(..._),o(...B),this.anchors[`R1_${M}`]=B,this.anchors[`R2_${M}`]=_}v=h;for(let k=0;k<l;k++){let M=String.fromCharCode(65+k);this.segments.push(new W([v+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[v+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<l;k++){let M=String.fromCharCode(70+k);this.segments.push(new W([v+ee*7+k*ee,S+ee],M,{fontsize:8,rotation:0,align:["center","center"],color:i,zorder:1}));for(let _=0;_<a;_++){let B=[v+ee*7+k*ee,S-_*ee];o(...B),this.anchors[`${M}${_+1}`]=B}}for(let k=0;k<a;k++)this.segments.push(new W([v-ee,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1})),this.segments.push(new W([v+ee*12,S-k*ee-.04],String(k+1),{fontsize:8,rotation:0,align:["center","bottom"],color:i,zorder:1}));this.segments.push(new p([[b+c*.4,g-ee*2],[b+c*.4,g-f+ee]],{color:"red",lw:.5})),this.segments.push(new p([[b+h-c*.4,g-ee*2],[b+h-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[x-c*.4,g-ee*2],[x-c*.4,g-f+ee]],{color:"blue",lw:.5})),this.segments.push(new p([[x-h+c*.4,g-ee*2],[x-h+c*.4,g-f+ee]],{color:"red",lw:.5}))}},Vc=class extends $s{constructor(t,n,s,i,o,a={}){super(t,n,s,{imgfmt:"svg",...a});z(this,"info");if(this.info=o,i)for(let[l,h]of Object.entries(i))this.anchors[l]=h}};function p2(r){throw new Error("fritzParts requires a .fzpz zip parser. Use a library like 'jszip' and pass the extracted SVG/anchors to FritzingPart directly.")}var Pe=class extends se{constructor(e={}){let{arrow:t,...n}=e;super(n),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25});let s=this.params.arrowwidth,i=this.params.arrowlength;this.segments.push(new p([[0,0]],{arrow:t,arrowwidth:s,arrowlength:i}))}};var b1=H,ui=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[1,1]})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.to!==void 0?A.fromXY(this.params.to):A.fromXY(e),o=this.params.delta,a=this.params.n??1,l=this.params.dy??.6,h=this.params.xstart,c=this.params.arrow,m,f;if(o!==void 0?[m,f]=o:(m=i.x!==void 0?i.x-s.x:this.params.to[0]-(this.params.at!==void 0?this.params.at[0]:e[0]),f=i.x!==void 0?i.y-s.y:this.params.to[1]-(this.params.at!==void 0?this.params.at[1]:e[1])),Math.abs(f)<.05)for(let g=0;g<a;g++){let b=-g*l;this.segments.push(new p([[0,b],[m,b]],{arrow:c}))}else{let g;h!==void 0?f>0?g=m*h:g=m*h-l-l*(a-1)*h:m>0?g=m/2-l*(a-1)/2:g=m/2+l*(a-1)/2;for(let b=0;b<a;b++){let x=-b*l,v;f>0?v=m>0?g+l*b:g-l*b:v=m>0?g+(a-b)*l:g-(a-b)*l,this.segments.push(new p([[0,x],[v,x],[v,x+f],[m,x+f]],{arrow:c}))}}return super._place(e,t,n)}},qs=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,to:[3,-2],theta:0,n:1})}toXY(e){return this.userParams.to=e,this}delta(e=0,t=0){return this.userParams.delta=[e,t],this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.at!==void 0?A.fromXY(this.params.at):A.fromXY(e),i=this.params.delta,o=this.params.to,a=this.params.n??1,l=this.params.dy??.6,h=this.params.arrow,c,m;i!==void 0?[c,m]=i:(c=o[0]-s.x,m=o[1]-s.y);let f=0;for(let g=0;g<a;g++){let b=-g*l;m>0?f=c<0?c-g*l:c+g*l:f=c>0?c+(a-g-1)*l:c-(a-g-1)*l,this.segments.push(new p([[0,b],[f,b],[f,m]],{arrow:h}))}return this.anchors.mid=[c/2,0],this.elmParams.lblloc="mid",this.elmParams.drop=[f,m],this.elmParams.droptheta=m>0?90:-90,super._place(e,t,n)}},mi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,style:"round",numbering:"lr",pinfontsizeleft:9,pinfontsizeright:9,edge:.3,pinfill:"bg",shownumber:!1,pinalignleft:"bottom",pinalignright:"bottom",pinrad:.1});let t=e.rows??4,n=e.cols??1,s=e.pinsleft??[],i=e.pinsright??[];this.elmParams.d="right";let o=this.params.pinspacing??.6,a=this.params.edge??.3,l=this.params.pinrad??.1,h=this.params.style??"round",c=this.params.numbering??"lr",m=this.params.shownumber??!1,f=this.params.pinfill??"bg",g=this.params.pinfontsizeleft??9,b=this.params.pinfontsizeright??9,x=this.params.pinalignleft??"bottom",v=(n-1)*o+a*2,S=(t-1)*o+a*2;this.segments.push(new U([[0,0],[0,S],[v,S],[v,0]]));for(let k=0;k<t;k++)for(let M=0;M<n;M++){let _=M*o+a,B=S-k*o-a,$=[_,B];h==="square"?this.segments.push(new U([[_-l,B-l],[_+l,B-l],[_+l,B+l],[_-l,B+l]],{fill:"bg",zorder:4})):h==="screw"?(this.segments.push(new D($,l*1.75,{fill:f,zorder:4})),this.segments.push(new p([[_+l,B+l],[_-l,B-l]],{zorder:5}))):this.segments.push(new D($,l,{fill:f,zorder:4}));let Y;if(c==="lr"||c===!0?Y=String(k*n+M+1):c==="ud"?Y=String(k+M*t+1):Y=M%2?String(t*M+(t-k)):String(k+1),this.anchors[`pin${Y}`]=$,m){let Z=[M%2?v+.05:-.05,B],L=M%2?"left":"right";this.segments.push(new W(Z,Y,{fontsize:g,align:[L,"bottom"]}))}if(s.length>0&&(n===1||!(M%2))){let Z=[-.05,B];this.segments.push(new W(Z,s[k]??"",{fontsize:g,align:["right",x]}))}if(i.length>0&&(n===1||M%2)){let Z=[v+.05,B];this.segments.push(new W(Z,i[k]??"",{fontsize:b,align:["left",x]}))}}}},di=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,pinrad:.1,theta:0});let t=this.params.pinrad??.1,n=this.params.pinspacing??.6,s=t*2.5;this.segments.push(new U([[-s,-s],[n+s,-s],[n+s,s],[-s,s]]))}},pi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{dy:.6,lwbus:4,l:3,slantx:.5}),this.elmParams.theta=0;let t=e.n??1,n=e.up??!0,s=this.params.l??3,i=this.params.dy??.6,o=this.params.lwbus??4,a=this.params.slantx??.5,l=n?a:-a;for(let h=0;h<t;h++){let c=-h*i;this.segments.push(new p([[0,c],[s-a,c],[s,c+l]])),this.anchors[`pin${h+1}`]=[0,c]}this.segments.push(new p([[s,a],[s,l-t*i]],{lw:o})),this.elmParams.drop=[s,a],this.anchors.start=[s,a],this.anchors.end=[s,l-t*i]}},fi=class extends Pe{constructor(e={}){super(e),Object.assign(this.defaults,{lw:4})}},s0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=4*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<4;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${9-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(9-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<5;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${5-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(5-c),{fontsize:9,align:["center","bottom"]}))}}},gi=class extends s0{},bi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",number:!1,pinrad:.1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=12*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<12;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${25-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(25-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<13;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${13-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(13-c),{fontsize:9,align:["center","bottom"]}))}}},wi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=7*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<7;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${15-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(15-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<8;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${8-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(8-c),{fontsize:9,align:["center","bottom"]}))}}},xi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t+n*2,l=18*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<18;c++){let m=[n,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${37-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(37-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<19;c++){let m=[n+t,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${19-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(19-c),{fontsize:9,align:["center","bottom"]}))}}},vi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pinspacing:.6,edge:.3,pinfill:"bg",pinrad:.1,number:!1,theta:0});let t=this.params.pinspacing??.6,n=this.params.edge??.3,s=this.params.pinfill??"bg",i=this.params.pinrad??.1,o=this.params.number??!1,a=t*2+n*2,l=16*t+n*2,h=l+.5;this.segments.push(new U([[0,0],[0,l],[a,h],[a,-.5]],{cornerradius:.25}));for(let c=0;c<17;c++){let m=[n,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${50-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(50-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<16;c++){let m=[n+t,l-(c+.5)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${33-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(33-c),{fontsize:9,align:["center","bottom"]}))}for(let c=0;c<17;c++){let m=[n+t*2,h-(c+.75)*t-n];this.segments.push(new D(m,i,{fill:s,zorder:4})),this.anchors[`pin${17-c}`]=m,o&&this.segments.push(new W([m[0],m[1]+i],String(17-c),{fontsize:9,align:["center","bottom"]}))}}},yi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.4,radiusinner:.12,fillinner:"bg"});let t=this.params.radius??.4,n=this.params.radiusinner??.12,s=this.params.fillinner??"bg";this.segments.push(new D([0,0],t)),this.segments.push(new D([0,0],n,{fill:s,zorder:4})),this.anchors.center=[0,0],this.anchors.N=[0,t],this.anchors.S=[0,-t],this.anchors.E=[t,0],this.anchors.W=[-t,0]}},Si=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{pluggap:.18});let t=this.params.pluggap??.18;this.segments.push(new p([[0,0],[1,0],b1,[1-.25,.25],[1,0],[1-.25,-.25]])),this.elmParams.drop=[1+t,0]}},ki=class extends N{constructor(e={}){super(e),this.segments.push(new p([[0,0],[-.25,.25],b1,[-.25,-.25],[0,0],[1,0]])),this.elmParams.drop=[1,0]}},Mi=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{r:.18,open:!0,fill:"bg",drop:[0,0],theta:0,zorder:4});let t=this.params.r??.18;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0];let n=this.params.open??!0;this.elmParams.fill=n?"bg":!0,this.segments.push(new D([0,0],t));let s=1,i=2;this.segments.push(new p([[-s*t,-i*t],[s*t,i*t]]))}};var gr=class{constructor(e,...t){z(this,"node");z(this,"children");this.node=e,this.children=t}[Symbol.iterator](){return this.children[Symbol.iterator]()}},i0=class r{constructor(e,t=null,n=0,s=1){z(this,"x",-1);z(this,"y");z(this,"node");z(this,"children");z(this,"parent");z(this,"thread",null);z(this,"mod",0);z(this,"ancestor",this);z(this,"change",0);z(this,"shift",0);z(this,"number");z(this,"_lmostSibling",null);this.y=n,this.node=e.node,this.parent=t,this.number=s,this.children=e.children.map((i,o)=>new r(i,this,n+1,o+1)),this.ancestor=this}left(){return this.thread??(this.children.length>0?this.children[0]:null)}right(){return this.thread??(this.children.length>0?this.children[this.children.length-1]:null)}lbrother(){let e=null;if(this.parent)for(let t of this.parent.children){if(t===this)return e;e=t}return e}get lmostSibling(){return!this._lmostSibling&&this.parent&&this!==this.parent.children[0]&&(this._lmostSibling=this.parent.children[0]),this._lmostSibling}};function v1(r,e){r.x+=e;for(let t of r.children)v1(t,e)}function f2(r){let e=0,t=0;for(let n=r.children.length-1;n>=0;n--){let s=r.children[n];s.x+=e,s.mod+=e,t+=s.change,e+=s.shift+t}}function g2(r,e,t){return e.parent&&e.parent.children.includes(r.ancestor)?r.ancestor:t}function b2(r,e,t){let n=e.number-r.number;e.change-=t/n,e.shift+=t,r.change+=t/n,e.x+=t,e.mod+=t}function w2(r,e,t){let n=r.lbrother();if(n!==null){let s=r,i=r,o=n,a=r.lmostSibling,l=r.mod,h=r.mod,c=o.mod,m=a.mod;for(;o.right()&&s.left();){o=o.right(),s=s.left(),a=a.left(),i=i.right(),i.ancestor=r;let f=o.x+c-(s.x+l)+t;f>0&&(b2(g2(o,r,e),r,f),l+=f,h+=f),c+=o.mod,l+=s.mod,m+=a.mod,h+=i.mod}o.right()&&!i.right()?(i.thread=o.right(),i.mod+=c-h):(s.left()&&!a.left()&&(a.thread=s.left(),a.mod+=l-m),e=r)}return e}function y1(r,e=1){if(r.children.length===0)r.lmostSibling?r.x=r.lbrother().x+e:r.x=0;else{let t=r.children[0];for(let i of r.children)y1(i),t=w2(i,t,e);f2(r);let n=(r.children[0].x+r.children[r.children.length-1].x)/2,s=r.lbrother();s?(r.x=s.x+e,r.mod=r.x-n):r.x=n}return r}function S1(r,e=0,t=0,n=null){r.x+=e,r.y=t,(n===null||r.x<n)&&(n=r.x);for(let s of r.children)n=S1(s,e+r.mod,t+1,n);return n}function Ra(r){let e=y1(new i0(r)),t=S1(e);return t<0&&v1(e,-t),e}var x2=new Set(["and","or","not","nand","nor","xor","xnor","true","false"]),k1=(o=>(o[o.IDENT=0]="IDENT",o[o.KEYWORD=1]="KEYWORD",o[o.LPAREN=2]="LPAREN",o[o.RPAREN=3]="RPAREN",o[o.SYMBOL=4]="SYMBOL",o[o.EOF=5]="EOF",o))(k1||{});function v2(r){let e=[],t=0;for(;t<r.length;){let n=r[t];if(/\s/.test(n)){t++;continue}if(n==="("){e.push({tt:2,val:"("}),t++;continue}if(n===")"){e.push({tt:3,val:")"}),t++;continue}if("&|+~\xAC\u2227\u2228\u2295\u22BB".includes(n)){e.push({tt:4,val:n}),t++;continue}if(/[$_a-zA-Z]/.test(n)){let s="";for(;t<r.length&&/[$_a-zA-Z0-9]/.test(r[t]);)s+=r[t],t++;x2.has(s)?e.push({tt:1,val:s}):e.push({tt:0,val:s});continue}throw new Error(`logicparse: unexpected character '${n}'`)}return e.push({tt:5,val:""}),e}var Jc=class{constructor(e){z(this,"tokens");z(this,"pos",0);this.tokens=e}peek(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}expect(e,t){let n=this.advance();if(n.tt!==e||t!==void 0&&n.val!==t)throw new Error(`logicparse: expected ${t??k1[e]}, got '${n.val}'`);return n}parse(){let e=this.xorExpr();if(this.peek().tt!==5)throw new Error(`logicparse: unexpected token '${this.peek().val}'`);return e}isNotOp(e){return e.tt===1&&e.val==="not"||e.tt===4&&(e.val==="~"||e.val==="\xAC")}isAndOp(e){return e.tt===1&&(e.val==="and"||e.val==="nand")||e.tt===4&&(e.val==="&"||e.val==="\u2227")}isOrOp(e){return e.tt===1&&(e.val==="or"||e.val==="nor")||e.tt===4&&(e.val==="|"||e.val==="\u2228"||e.val==="+")}isXorOp(e){return e.tt===1&&(e.val==="xor"||e.val==="xnor")||e.tt===4&&(e.val==="\u2295"||e.val==="\u22BB")}xorExpr(){let e=this.orExpr();for(;this.isXorOp(this.peek());){let t=this.advance(),n=this.orExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}orExpr(){let e=this.andExpr();for(;this.isOrOp(this.peek());){let t=this.advance(),n=this.andExpr();e={kind:"binary",op:t.val,left:e,right:n}}return e}andExpr(){let e=this.unary();for(;this.isAndOp(this.peek());){let t=this.advance(),n=this.unary();e={kind:"binary",op:t.val,left:e,right:n}}return e}unary(){return this.isNotOp(this.peek())?(this.advance(),{kind:"unary",operand:this.unary()}):this.atom()}atom(){let e=this.peek();if(e.tt===2){this.advance();let t=this.xorExpr();return this.expect(3,")"),t}if(e.tt===0||e.tt===1&&(e.val==="true"||e.val==="false"))return this.advance(),{kind:"ident",name:e.val};throw new Error(`logicparse: unexpected token '${e.val}'`)}};function Kl(r,e){return r.kind==="binary"&&r.op===e?[...Kl(r.left,e),...Kl(r.right,e)]:[r]}function w1(r){return{"&":"and","\u2227":"and","|":"or","\u2228":"or","+":"or","\u2295":"xor","\u22BB":"xor"}[r]??r}var y2={and:"nand",or:"nor",not:"buf",nand:"and",nor:"or",buf:"not",xor:"xnor",xnor:"xor"};function zi(r){if(r.kind==="ident")return new gr(r.name);if(r.kind==="unary"){if(r.operand.kind==="ident")return new gr("not",zi(r.operand));let n=r.operand;if(n.kind==="binary"){let s=w1(n.op),i=y2[s];if(i){let o=Kl(n,n.op);return new gr(i,...o.map(zi))}}return n.kind==="unary"?zi(n.operand):new gr("not",zi(n))}let e=w1(r.op),t=Kl(r,r.op);return new gr(e,...t.map(zi))}var M1={and:Bt,or:$t,not:Kt,buf:Jt};function S2(r,e){let t=M1[r];if(t)return new t(e);switch(r){case"nand":return Pn(e);case"nor":return Rn(e);case"xor":return Tn(e);case"xnor":return An(e);default:return new Bt(e)}}function x1(r){return r in M1||["nand","nor","xor","xnor"].includes(r)}function k2(r,e=.7,t=2,n){let s=new lr;s.unit=t;let i=Ra(r);function o(a,l=0,h){let c=a.node==="not"||a.node==="buf",m={d:"r",at:[a.y*-t,-a.x*e],anchor:"end",l:t,...c?{}:{inputs:a.children.length}},f=S2(a.node,m);h&&f.label(h,{loc:"end"});for(let g=0;g<a.children.length;g++){let b=a.children[g],x=c?"start":`in${g+1}`;x1(b.node)||f.label(b.node,{loc:x})}s.add(f);for(let g=0;g<a.children.length;g++){let b=a.children[g],x=c?"start":`in${g+1}`;if(x1(b.node)){let v=o(b,l+1);s.add(new qs({at:[f,x],to:v.anchors.end}))}}return f}return o(i,0,n),s}function Zl(r,e={}){let{gateW:t=2,gateH:n=.75,outlabel:s}=e,i=v2(r),o=new Jc(i).parse(),a=zi(o);return k2(a,n,t,s)}var Ql=.12,M2=.4,Ei=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?M2:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[.25,-n],H,[-.25*.7,-Ql-n],[.25*.7,-Ql-n],H,[-.25*.2,-Ql*2-n],[.25*.2,-Ql*2-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};function z1(r="svg"){if(r==="matplotlib")throw new Error("@skillpet/circuit: use('matplotlib') is not supported; only 'svg' is available.")}function E1(r=!0,e=!0){kt({dwgbbox:r,elmbbox:e})}function P1(r="default"){switch(r){case"default":kt({bgcolor:"white",color:"black"});break;case"dark":kt({color:"white",bgcolor:"black"});break;case"solarizedd":kt({bgcolor:"#002b36",color:"#657b83"});break;case"solarizedl":kt({bgcolor:"#eee8d5",color:"#073642"});break;case"onedork":kt({bgcolor:"#373e4b",color:"#899ab8"});break;case"oceans16":kt({bgcolor:"#384151",color:"#CDD2E9"});break;case"monokai":kt({bgcolor:"#232323",color:"#BBBBBB"});break;case"gruvboxl":kt({bgcolor:"#ebdbb2",color:"#3c3836"});break;case"gruvboxd":kt({bgcolor:"#1d2021",color:"#d5c4a1"});break;case"grade3":kt({bgcolor:"#ffffff",color:"#3f3d46"});break;case"chesterish":kt({bgcolor:"#323A48",color:"#92A2BD"});break;default:throw new Error(`Unknown theme ${r}`)}}var Ta=class{constructor(){z(this,"_text","text");z(this,"_svg2",!0);z(this,"precision",3);z(this,"useBatik",!1)}get text(){return this._text}set text(e){this._text=e}get svg2(){return this._svg2}set svg2(e){this._svg2=e}},R1=new Ta;var $e=.25*.75,pt=.25*1.5,St=.25*.75,rt=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[0,0],H,[1,0],[1,0]])),this.segments.push(new D([.5,0],.5))}},Pi=class extends rt{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},Ri=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Ti=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{sin_lw:void 0,sin_color:void 0});let t=ze(-.25,.25,25),s=t.map(i=>.2*Math.sin((i-.25)*Math.PI*2/.5)+.5).map((i,o)=>[i,t[o]]);this.segments.push(new p(s,{lw:this.params.sin_lw,color:this.params.sin_color}))}},Ai=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{pulse_lw:void 0,pulse_color:void 0});let t=.15,n=.4;this.segments.push(new p([[n,t*2],[n,t],[n+t,t],[n+t,-t],[n,-t],[n,-t*2]],{lw:this.params.pulse_lw,color:this.params.pulse_color}))}},_i=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{tri_lw:void 0,tri_color:void 0}),this.segments.push(new p([[.4,.25],[.7,0],[.4,-.25]],{lw:this.params.tri_lw,color:this.params.tri_color}))}},Bi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{ramp_lw:void 0,ramp_color:void 0}),this.segments.push(new p([[.4,.25],[.8,-.2],[.4,-.2]],{lw:this.params.ramp_lw,color:this.params.ramp_color}))}},Ci=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{square_lw:void 0,square_color:void 0}),this.segments.push(new p([[.5,.25],[.7,.25],[.7,0],[.3,0],[.3,-.25],[.5,-.25]],{lw:this.params.square_lw,color:this.params.square_color}))}},Hs=class extends se{constructor(e={}){super(e),this.elmParams.theta=90,this.segments.push(new p([[0,0],[.5,.5],[1,0],[.5,-.5],[0,0],H,[1,0]]))}},br=class extends Hs{constructor(e={}){super(e);let t=.2;this.segments.push(new p([[.25,-t/2],[.25,t/2]])),this.segments.push(new p([[.75-t/2,0],[.75+t/2,0]])),this.segments.push(new p([[.75,-t/2],[.75,t/2]]))}},wr=class extends Hs{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,0],[.75,0]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Ii=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]]))}},Li=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*3,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]]))}},Di=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[$e*9,0]])),this.segments.push(new p([[0,pt],[0,-pt]])),this.segments.push(new p([[$e,St],[$e,-St]])),this.segments.push(new p([[$e*2,pt],[$e*2,-pt]])),this.segments.push(new p([[$e*3,St],[$e*3,-St]])),this.segments.push(new p([[$e*4,pt],[$e*4,-pt]])),this.segments.push(new p([[$e*5,St],[$e*5,-St]])),this.segments.push(new p([[$e*6,pt],[$e*6,-pt]])),this.segments.push(new p([[$e*7,St],[$e*7,-St]])),this.segments.push(new p([[$e*8,pt],[$e*8,-pt]])),this.segments.push(new p([[$e*9,St],[$e*9,-St]])),this.anchors.tap=[$e*4,pt]}},Ni=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=.25*.5,n=t+.15,s=.4,i=this.params;this.segments.push(new p([[s,t],[s,-t]])),this.segments.push(new p([[s+.2,n],[s+.2,-n]])),this.segments.push(new p([[0,0],[s,0],H,[s+.2,0],[1,0]]));let o=i.arrowwidth,a=i.arrowlength;this.segments.push(new p([[1.1,.9],[.8,.6]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color})),this.segments.push(new p([[1.3,.7],[1,.4]],{arrow:"->",arrowwidth:o,arrowlength:a,lw:i.arrow_lw,color:i.arrow_color}))}},Oi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"V",{halign:"center",valign:"center"}))}},Fi=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"I",{halign:"center",valign:"center"}))}},$i=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"A",{halign:"center",valign:"center"}))}},ji=class extends rt{constructor(e={}){super(e),this.segments.push(new W([.5,0],"\u03A9",{halign:"center",valign:"center"}))}},qi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let t=this.params;this.segments.push(new p([[.25,.16],[.75,-.16]],{arrow:"->",arrowwidth:t.arrowwidth,arrowlength:t.arrowlength,lw:t.arrow_lw,color:t.arrow_color}))}},Hi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.25,n=.7,s=ze(1.4,3.6*Math.PI,80),i=s.map(c=>t*c-n*Math.sin(c)),o=s.map(c=>t-n*Math.cos(c));i=i.map(c=>c-i[0]);let a=i[i.length-1];i=i.map(c=>c/a);let l=o.map(c=>(c-o[0])*.25),h=i.map((c,m)=>[c,l[m]]);this.segments.push(new p(h,{lw:this.params.filament_lw,color:this.params.filament_color}))}},Yi=class extends rt{constructor(e={}){super(e),Object.assign(this.defaults,{filament_lw:void 0,filament_color:void 0});let t=.5,n=this.params;this.segments.push(new p([[t-t/2**.5,-t/2**.5],[t+t/2**.5,t/2**.5]],{lw:n.filament_lw,color:n.filament_color})),this.segments.push(new p([[t-t/2**.5,t/2**.5],[t+t/2**.5,-t/2**.5]],{lw:n.filament_lw,color:n.filament_color}))}},Xi=class extends rt{constructor(e={}){super(e);let t=.25,n=.4;this.segments.push(new p([[n,t],[n,-t]])),this.segments.push(new p([[n+.2,t],[n+.2,-t]])),this.segments.push(new p([[0,0],[n,0],H,[n+.2,0],[1,0]])),this.segments.push(new D([n-.15,.2],.05,{fill:!0}))}},un=class extends N{constructor(e={}){let{inputs:t,...n}=e,s=t!==!1;super(n),Object.assign(this.defaults,{width:1.5,corner:.2,input_ofst:[.4,.3],input_lw:1,input_rad:.1,input_fill:"none"});let i=this.params.width,o=this.params.corner,a=this.params.input_ofst,l=this.params.input_lw,h=this.params.input_rad;this.segments.push(new U([[0,0],[0,i],[i,i],[i,0]],{closed:!0,cornerradius:o})),s&&(this.segments.push(new D([a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4})),this.segments.push(new D([i-a[0],a[1]],h,{lw:l,fill:this.params.input_fill,zorder:4}))),this.anchors.N=[i/2,i],this.anchors.S=[i/2,0],this.anchors.E=[i,i/2],this.anchors.W=[0,i/2],this.anchors.NE=[i,i],this.anchors.SE=[i,0],this.anchors.NW=[0,i],this.anchors.SW=[0,0],this.anchors.in1=[a[0],a[1]],this.anchors.in2=[i-a[0],a[1]],this.anchors.name=[i/2,0],this.elmParams.drop=this.anchors.in2}},Gi=class extends un{constructor(e={}){super(e);let t=e.needle_percent??70;Object.assign(this.defaults,{needle_color:"black",needle_width:1.5,window_fill:"none"});let n=this.params.width,s=n/2,i=1.2,o=.86,a=.2;this.segments.push(new ut(["M",[s-n/3,i],"Q",[s,i+a],[s+n/3,i],"L",[s+n/4,o],"Q",[s,o+a*.7],[s-n/4,o],"Z"],{color:"black",fill:this.params.window_fill,lw:1}));let l=.94,h=1.2,c=(112-45*t/100)*Math.PI/180,m=[s+l*Math.cos(c),l*Math.sin(c)],f=[s+h*Math.cos(c),h*Math.sin(c)];this.segments.push(new p([m,f],{lw:this.params.needle_width,color:this.params.needle_color}))}},Wi=class extends un{constructor(e={}){super(e);let t=e.signal??"none";Object.assign(this.defaults,{screen_fill:"none",screen_lw:1,grid:!0,grid_color:"#666666",grid_lw:.3,signal_lw:2,signal_color:"#e0213b"});let n=this.params.width,s=4,i=n*.15,o=n*.85,a=o-i,l=a/(s+1),h=l*3,c=n*.9,m=c-h;if(this.segments.push(new U([[i,m],[i,c],[o,c],[o,m]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.params.grid){for(let f=0;f<s;f++){let g=i+(f+1)*l;this.segments.push(new p([[g,m],[g,c]],{lw:this.params.grid_lw,color:this.params.grid_color}))}for(let f=0;f<2;f++){let g=m+(f+1)*l;this.segments.push(new p([[i,g],[o,g]],{lw:this.params.grid_lw,color:this.params.grid_color}))}}if(t==="sine"){let f=ze(i,o,20),g=f.map(x=>m+h/2+Math.sin((x-i)/a*Math.PI*2)*(h/2)*.75),b=f.map((x,v)=>[x,g[v]]);this.segments.push(new p(b,{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="square"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,x=i+a*2/3-.1,v=i+a-.1;this.segments.push(new p([[i,f],[b,f],[b,g],[x,g],[x,f],[v,f],[v,g],[o,g]],{lw:this.params.signal_lw,color:this.params.signal_color}))}else if(t==="triangle"){let f=m+h/4,g=c-h/4,b=i+a/3-.1,x=i+a*2/3-.1,v=i+a-.1;this.segments.push(new p([[i,f],[b,g],[x,f],[v,g],[o,g-.1]],{lw:this.params.signal_lw,color:this.params.signal_color}))}}},Vi=class extends un{constructor(e={}){super(e),Object.assign(this.defaults,{screen_fill:"none",screen_lw:1});let t=this.params.width,n=t*.1,s=t*.9,i=t/3,o=t*.85,a=o-i;this.segments.push(new U([[n,a],[n,o],[s,o],[s,a]],{closed:!0,lw:this.params.screen_lw,fill:this.params.screen_fill})),this.anchors.display=[(n+s)/2,a]}};var eh=.4,Ui=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,theta:0,drop:[0,0]});let n=this.params.lead!==!1?eh:0;this.segments.push(new p([[0,0],[0,-n],[-.25,-n],[0,-n-.25],[.25,-n],[0,-n]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Ji=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let n=this.params.lead!==!1?eh:0,s=.25*.75,i=.25;this.segments.push(new p([[0,0],[0,-n],[-s,-n-i]])),this.segments.push(new p([[0,-n],[-s,-n],[-s*2,-n-i]])),this.segments.push(new p([[0,-n],[s,-n],[0,-n-i]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Ki=class extends N{constructor(e={}){super(e);let t=.6,n=.6,s=.38;this.segments.push(new p([[0,0],[0,t],[-s,t+n],[s,t+n],[0,t]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},Zi=class extends N{constructor(e={}){super(e);let t=.2,n=.5;this.segments.push(new p([[0,0],[0,t],[-n,n+t],[t/2,n*2+1.5*t],[n+t,n+t],[t,t],[t,0]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},Qi=class extends N{constructor(e={}){super(e);let t=.25,n=1,s=-n/2-t/2,i=s+t,o=n/2+t/2,a=o+t,l=t,h=t*2,c=n+h,m=c+t;this.segments.push(new p([[0,0],[0,l],[s,l],[s,c],[o,c],[o,h],[i,h],[i,m],[a,m],[a,l],[t,l],[t,0]])),this.elmParams.drop=[t,0],this.elmParams.theta=0,this.anchors.start=[0,0],this.anchors.end=[t,0]}},eo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0,lblloc:"bottom"});let t=.25*.75,s=this.params.lead!==!1?eh:0;this.segments.push(new p([[0,0],[0,-s]])),this.segments.push(new p([[0,-s],[-t,-s]])),this.segments.push(new p([[0,-s],[t,-s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},to=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lead:!0,drop:[0,0],theta:0});let t=.25*.75,s=this.params.lead!==!1?eh:0;this.segments.push(new p([[0,0],[0,s]])),this.segments.push(new p([[0,s],[-t,s]])),this.segments.push(new p([[0,s],[t,s]])),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},ro=class extends N{constructor(e={}){super(e);let t=.25*.75,n=.25*.75;this.segments.push(new p([[-t,-n],[t,n]])),this.segments.push(new p([[-t,n],[t,-n]])),this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.lblofst="bottom",this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}};var le=.12,Yr=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0,nc:s=!1}=e,i=this.params;n?(s?this.segments.push(new p([[0,0],H,[le*2,0],[.9,le+.05],H,[1,0]])):this.segments.push(new p([[0,0],H,[le*2,.1],[.8,.45],H,[1,0]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3}))):s?(this.segments.push(new p([[0,0],[1.15,.45],H,[1,0]])),this.segments.push(new p([[1,0],[1,.55]]))):this.segments.push(new p([[0,0],[.85,.45],H,[1,0]])),t==="open"?this.segments.push(new xe([.4,.1],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength})):t==="close"&&this.segments.push(new xe([.4,.25],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:i.arrow_lw,color:i.arrow_color,arrowwidth:i.arrowwidth,arrowlength:i.arrowlength}))}},no=class extends Yr{constructor(e={}){super(e),e.contacts!==!1?(this.segments.push(new D([1-le,.7],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,0],this.anchors.c=[1-le,.7]):(this.anchors.a=[0,0],this.anchors.b=[1,0],this.anchors.c=[1,.7])}},Ys=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{arrowwidth:.15,arrowlength:.25,arrow_lw:void 0,arrow_color:void 0});let{action:t,contacts:n=!0}=e,s=this.params;n?(this.segments.push(new p([[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]])),this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.anchors.a=[le,0],this.anchors.b=[1-le,.4],this.anchors.c=[1-le,-.4]):(this.segments.push(new p([[0,0],[.85,.25],H,[1,.4]])),this.anchors.a=[0,0],this.anchors.b=[1,.4],this.anchors.c=[1,-.4]),t==="open"?this.segments.push(new xe([.35,0],.5,.75,{theta1:-10,theta2:70,arrow:"ccw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})):t==="close"&&this.segments.push(new xe([.3,0],.5,.75,{theta1:-10,theta2:70,arrow:"cw",lw:s.arrow_lw,color:s.arrow_color,arrowwidth:s.arrowwidth,arrowlength:s.arrowlength})),this.elmParams.drop=[1,.4]}},so=class extends se{constructor(e={}){super(e);let{nc:t=!1,contacts:n=!0}=e,s,i;n?(s=[[0,0],H],i=[H,[1,0]]):(s=[[0,0],[le,0],H],i=[H,[1-le,0],[1,0]]);let o=t?-le-.05:.3,a=t?le+.15:.5,l=[[le,o],[1-le,o],H,[.5,o],[.5,a]],h=[...s,...l,...i];this.segments.push(new p(h)),n&&(this.segments.push(new D([le,0],le)),this.segments.push(new D([1-le,0],le)))}},Xs=class extends N{constructor(e={}){super(e);let t=-1,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.8,.45],H,[1,0]],o=[[le*2,t+.1],[.8,t+.45]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,0],this.anchors.p2=[le,t],this.anchors.t2=[1-le,t]):(i=[[0,0],[.8,.45],H,[1,0]],o=[[0,t],[.8,t+.45]],this.anchors.p1=[0,0],this.anchors.t1=[1,0],this.anchors.p2=[0,t],this.anchors.t2=[1,t]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},Gs=class extends N{constructor(e={}){super(e);let t=-1.4,{link:n=!0,contacts:s=!0}=e,i,o;s?(i=[[0,0],H,[le*2,.1],[.7,.25],H,[1,.4]],o=[[le*2,t+.1],[.7,t+.25]],this.anchors.p1=[le,0],this.anchors.t1=[1-le,.4],this.anchors.t2=[1-le,-.4],this.anchors.p2=[le,t],this.anchors.t3=[1-le,t+.4],this.anchors.t4=[1-le,t-.4]):(i=[[0,0],[.7,.25],H,[1,.4]],o=[[0,t],[.7,t+.25]],this.anchors.p1=[0,0],this.anchors.t1=[1,.4],this.anchors.t2=[1,-.4],this.anchors.p2=[0,t],this.anchors.t3=[1,t+.4],this.anchors.t4=[1,t-.4]),this.segments.push(new p(i)),this.segments.push(new p(o)),s&&(this.segments.push(new D([le,0],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([le,t],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t-.4],le,{fill:"bg",zorder:3})),this.segments.push(new D([1-le,t+.4],le,{fill:"bg",zorder:3}))),n&&this.segments.push(new p([[.5,t+.25],[.5,.2]],{ls:":"}))}},io=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],[.85,.15],H,[.8,0]]));let t=.3,n=ze(-Math.PI/2,Math.PI/2,32),s=n.map(m=>-t*Math.cos(m)),i=n.map(m=>t*Math.sin(m)),o=s.map(m=>1-m),a=[...i].reverse(),l=[...s,...o,s[0]],h=[...i,...a,i[0]],c=l.map((m,f)=>[m,h[f]]);this.segments.push(new p(c))}},oo=class extends N{constructor(e={}){super(e);let t=e.n??4,n=e.dtheta,s=e.radius??1,i=e.arrowlen??.75,o=e.arrowcontact??0;this.elmParams.fill="bg",this.elmParams.zorder=4,this.segments.push(new D([0,0],le)),this.anchors.P=[0,0],n===void 0&&(n=Math.min(35,360/(t+1)));let a=n*Math.PI/180,l=e.theta0;l===void 0?l=-a*(t-1)/2:l=l*Math.PI/180;for(let h=0;h<t;h++){let c=l+a*h,m=s*Math.cos(c),f=s*Math.sin(c);if(this.segments.push(new D([m,f],le)),this.anchors[`T${h+1}`]=[m,f],h===o){let g=i*Math.cos(c),b=i*Math.sin(c);this.segments.push(new p([[0,0],[g,b]],{arrow:"->",zorder:2}))}}}},ao=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{switchcolor:"#333333",swidth:.4,spacing:.2});let t=e.n??3,n=e.pattern,s=this.params.swidth,i=this.params.spacing,o=s*t+i*(t+1),a=s*2+i*2;this.segments.push(new U([[0,0],[o,0],[o,a],[0,a]]));for(let l=0;l<t;l++){let h=i*(l+1)+s*l,c=n?n[l]:!1,m=n?!n[l]:!1;this.segments.push(new U([[h,i+s],[h+s,i+s],[h+s,i+s*2],[h,i+s*2]],{fill:c?this.params.switchcolor:void 0})),this.segments.push(new U([[h,i],[h+s,i],[h+s,i+s],[h,i+s]],{fill:m?this.params.switchcolor:void 0})),this.anchors[`a${l+1}`]=[h+s/2,0],this.anchors[`b${l+1}`]=[h+s/2,a]}}};var lo=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new U([[.25,t/2],[.25,-t*1.5],[.25*2,-t*1.5],[.25*2,t/2]])),this.segments.push(new U([[.25*2,t/2],[.25*3.5,t*1.25],[.25*3.5,-t*2.25],[.25*2,-t*1.5]],{closed:!1})),this.anchors.in1=[0,0],this.anchors.in2=[0,-t],this.elmParams.drop=[0,-t]}},ho=class extends N{constructor(e={}){super(e);let t=.5;this.segments.push(new p([[0,0],[.25,0]])),this.segments.push(new p([[0,-t],[.25,-t]])),this.segments.push(new p([[-.25*2,.25],[-.25*2,-.25*3]])),this.segments.push(new xe([-.25*2,-.25],.25*4,.25*4,{theta1:270,theta2:90})),this.anchors.in1=[.25,0],this.anchors.in2=[.25,-t],this.elmParams.drop=[0,-t]}},co=class extends se{constructor(e={}){super(e);let t=.22;this.segments.push(new p([[-t,0],[-t,0],H,[1+t,0],[1+t,0]])),this.segments.push(new p([[0,-t],[-t,-t],[-t,t],[0,t]])),this.segments.push(new p([[1,-t],[1+t,-t],[1+t,t],[1,t]])),this.segments.push(new D([.5,0],.5))}},uo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!0});let{ring:t=!1,ringswitch:n=!1,dots:s=!0,switch:i=!1}=e,o=this.params.open?"bg":void 0,a=this.params.radius,l=2,h=.75,c=.55,m=.2,f=1,g=1,b=.1,x=.35,v=.4,S=.5;i&&(g+=.2),t&&n&&(x+=.2,b-=.2),t?(s&&this.segments.push(new D([0,-x],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,-x],[-l,-x],[-l,0],[-l,f],[-l-m,f],[-l-m,0],[-l,0]])),this.anchors.sleeve=[0,-x],s&&this.segments.push(new D([0,b],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,b],[-l*.75,b],[-l*h-2*a,b+2*a],[-l*h-a*4,b]])),this.anchors.ring=[0,b]):(s&&this.segments.push(new D([0,0],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,0],[-l,0],[-l,f],[-l+m,f],[-l+m,0]])),this.anchors.sleeve=[0,0]),s&&this.segments.push(new D([0,g],a,{fill:o,zorder:4})),this.segments.push(new p([[-a,g],[-l*.55,g],[-l*c-2*a,g-2*a],[-l*c-a*4,g]])),this.anchors.tip=[0,g],i&&(s&&this.segments.push(new D([0,g-v],a,{fill:o,zorder:4})),this.segments.push(new p([[0,g-v],[-S,g-v]])),this.segments.push(new p([[-S,g-v],[-S,g]],{arrow:"->"})),this.anchors.tipswitch=[0,g-v]),t&&n&&(s&&this.segments.push(new D([0,b+v],a,{fill:o,zorder:4})),this.segments.push(new p([[0,b+v],[-S,b+v]])),this.segments.push(new p([[-S,b+v],[-S,b]],{arrow:"->"})),this.anchors.ringswitch=[0,b+v])}};var mo=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radius:.3});let t=this.params.leadlen,n=this.params.length,s=this.params.radius;this.segments.push(new p([[0,0],[t,0],H,[n-t+s/2,0],[n,0]])),this.segments.push(new p([[t,s],[n-t,s]])),this.segments.push(new p([[t,-s],[n-t,-s]])),this.segments.push(new xe([t,0],s,s*2,{theta1:0,theta2:360})),this.segments.push(new xe([n-t,0],s,s*2,{theta1:270,theta2:90})),this.anchors.shieldstart=[t,-s],this.anchors.shieldstart_top=[t,s],this.anchors.shieldend=[n-t,-s],this.anchors.shieldend_top=[n-t,s],this.anchors.shieldcenter=[n/2,-s],this.anchors.shieldcenter_top=[n/2,s]}},po=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{length:3,leadlen:.6,radiusinner:.3,radiusouter:.6,shieldofststart:.3,shieldofstend:.3});let t=this.params.radiusinner,n=this.params.radiusouter,s=this.params.length,i=this.params.leadlen,o=this.params.shieldofstend,a=this.params.shieldofststart;if(n<t)throw new Error("Triax inner radius > outer radius");let l=n/2*Math.sqrt(1-t*t/(n*n)),h=180;a-l>-t/2&&(h=180-Math.atan2(t,l)*180/Math.PI),s-i-o+n<s?(this.segments.push(new p([[0,0],[i,0],H,[s-i+t/2,0],[s,0]])),this.segments.push(new p([[s-i-o+l,t],[s-i,t]])),this.segments.push(new p([[s-i-o+l,-t],[s-i,-t]])),this.segments.push(new xe([s-i,0],t,t*2,{theta1:270,theta2:90}))):this.segments.push(new p([[0,0],[i,0],H,[s-i-o+n/2,0]])),this.segments.push(new p([[i,t],[i+a+l,t]])),this.segments.push(new p([[i,-t],[i+a+l,-t]])),this.segments.push(new p([[i+a,n],[s-i-o,n]])),this.segments.push(new p([[i+a,-n],[s-i-o,-n]])),this.segments.push(new xe([i,0],t,t*2,{theta1:0,theta2:360})),this.segments.push(new xe([i+a,0],n,n*2,{theta1:-h,theta2:h})),this.segments.push(new xe([s-i-o,0],n,n*2,{theta1:270,theta2:90})),this.anchors.guardstart=[i,-t],this.anchors.guardstart_top=[i,t],this.anchors.guardend=[s-i,-t],this.anchors.guardend_top=[s-i,t],this.anchors.shieldstart=[i+a,-n],this.anchors.shieldstart_top=[i+a,n],this.anchors.shieldend=[s-i-o,-n],this.anchors.shieldend_top=[s-i-o,n],this.anchors.shieldcenter=[s/2,-n],this.anchors.shieldcenter_top=[s/2,n]}};var fo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{core:!0,loop:!1,corewidth:.75,phasegap:.4,arcwidth:.4});let t=e.t1??4,n=e.t2??4;typeof t=="number"&&(t=[t]),typeof n=="number"&&(n=[n]);let s=t,i=n,o=this.params.phasegap,a=this.params.loop,l=this.params.core,h=e.align??"center",c=this.params.corewidth;a&&(c+=.4),l&&(c+=.25);let m=0,f,g,b,x=(v,S)=>{if(h==="center"){let k=v/2-S/2;return[k,k+S]}else return h==="bottom"?[0,S]:[v-S,v]};if(a){let v=s.map(re=>Wn(re,[0,0],.06,.19,!1,!0,!1)),S=i.map(re=>Wn(re,[c,0],.06,.19,!1,!0,!0)),k=v.reduce((re,te)=>re+te[te.length-1][1],0)+o*(v.length-1),M=S.reduce((re,te)=>re+te[te.length-1][1],0)+o*(S.length-1);f=k,[g,b]=x(k,M);let _=.06,B=.19,$=Math.acos(_/B),Y=Math.PI*2*_,Z=Y-(_*$-B*Math.sin($)),I=(_-B)/2/.25,X=m,j=0;for(let re=0;re<v.length;re++){let te=v[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`p${re*2+1}`]=he[0],this.anchors[`p${re*2+2}`]=he[he.length-1],f=he[he.length-1][1];let ve=0;for(ve=0;ve<s[re];ve++)this.anchors[`tapP${j+ve+1}`]=[I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}X=g,j=0;for(let re=0;re<S.length;re++){let te=S[re],ke=te[te.length-1][1],he=te.map(de=>[de[0],de[1]+X]);this.segments.push(new p(he)),this.anchors[`s${re*2+1}`]=he[0],this.anchors[`s${re*2+2}`]=he[he.length-1],b=he[he.length-1][1];let ve=0;for(ve=0;ve<i[re];ve++)this.anchors[`tapS${j+ve+1}`]=[c-I,he[0][1]+ve*Y+Z];j+=ve,X+=ke+o}}else{let v=this.params.arcwidth,S=s.reduce((B,$)=>B+$,0)*v+o*(s.length-1),k=i.reduce((B,$)=>B+$,0)*v+o*(i.length-1);f=S,[g,b]=x(S,k);let M=m,_=0;for(let B=0;B<s.length;B++){let $=s[B];this.anchors[`p${B*2+2}`]=[0,M],this.anchors[`p${B*2+1}`]=[0,M+$*v];for(let Y=0;Y<$;Y++)this.segments.push(new xe([0,M+v/2],v,v,{theta1:270,theta2:90})),Y<$-1&&(this.anchors[`tapP${_+Y+1}`]=[0,M+v]),M+=v;_+=$-1,M+=o}M=g,_=0;for(let B=0;B<i.length;B++){let $=i[B];this.anchors[`s${B*2+2}`]=[c,M],this.anchors[`s${B*2+1}`]=[c,M+$*v];for(let Y=0;Y<$;Y++)this.segments.push(new xe([c,M+v/2],v,v,{theta1:90,theta2:270})),Y<$-1&&(this.anchors[`tapS${_+Y+1}`]=[c,M+v]),M+=v;_+=$-1,M+=o}}if(l){let v=Math.max(f,b),S=Math.min(m,g),k=c/2,M=c/10;this.segments.push(new p([[k-M,v],[k-M,S]])),this.segments.push(new p([[k+M,v],[k+M,S]]))}}tap(e,t,n="primary"){let s=n==="primary"?"P":"S",i;if(t===0?i=this.anchors[`${s.toLowerCase()}1`]:i=this.anchors[`tap${s}${t}`],i)this.anchors[e]=i;else throw new Error(`No tap at position ${t}`);return this}};function z2(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}var th=.25,mn=class extends Pe{constructor(e={}){let{double:t,...n}=e;super({...n,arrow:t?"<->":e.arrow??"->"}),this.anchors.center=[0,0]}},go=class extends se{constructor(e={}){super(e),this.segments.push(new p([[0,0],H,[-th/2,th],[th/2,-th],H,[0,0]]))}},Xt=class extends se{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblalign:["center","center"],lblofst:0}),this.segments.push(new p([[0,0],H,[1,0]],{visible:!1}))}},dn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let n=this.params.open===!0?"bg":!0;this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0],this.elmParams.drop=[0,0],this.elmParams.theta=0,this.elmParams.zorder=4,this.elmParams.fill=n,this.segments.push(new D([0,0],this.params.radius,{fill:n}))}},bo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{headwidth:.15,headlength:.25,lblofst:.25});let t=this.params.headwidth,n=this.params.headlength;this.segments.push(new p([[-n,0],[0,0]],{arrowwidth:t,arrowlength:n,arrow:"->"})),this.anchors.start=[0,0],this.anchors.center=[0,0],this.anchors.end=[0,0]}},wo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.075,open:!1});let t=this.params.radius,n=this.params.open?"bg":!0;this.elmParams.fill=n,this.segments.push(new D([.5,0],t)),this.segments.push(new D([1,0],t)),this.segments.push(new D([1.5,0],t)),this.elmParams.drop=[2,0]}},xr=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{zorder:0});let t=e.corner1??[0,0],n=e.corner2??[1,1],s=[t[0],n[1]],i=[n[0],t[1]];this.segments.push(new U([t,s,n,i],{closed:!0,zorder:0,fill:e.fill,lw:e.lw,ls:e.ls}))}},xo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{shape:"-",k:1,to:[3,-2],dotradius:.075})}to(e,t=0,n=0){let s=A.fromXY(z2(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}dot(e=!1){return this.userParams.dot=e?"open":!0,this}idot(e=!1){return this.userParams.idot=e?"open":!0,this}shape(e){return this.userParams.shape=e,this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a=this.params.arrow,l=this.params.shape,h=this.params.k??1,c,m;if(o!==void 0?(c=o[0],m=o[1]):(c=i[0]-s[0],m=i[1]-s[1]),this.segments=[],l==="-")this.segments.push(new p([[0,0],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2];else if(l==="-|")this.segments.push(new p([[0,0],[c,0],[c,m]],{arrow:a})),this.anchors.mid=[c,m/2],this.elmParams.droptheta=m>0?90:-90;else if(l==="|-")this.segments.push(new p([[0,0],[0,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m],this.elmParams.droptheta=c>0?0:180;else if(l==="z"||l==="Z"){let g=c>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[g,0],[c-g,m],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=c>0?0:180}else if(l==="N"){let g=m>0?Math.abs(h):-Math.abs(h);this.segments.push(new p([[0,0],[0,g],[c,m-g],[c,m]],{arrow:a})),this.anchors.mid=[c/2,m/2],this.elmParams.droptheta=m>0?90:-90}else if(l==="n")this.segments.push(new p([[0,0],[0,h],[c,h],[c,m]],{arrow:a})),this.anchors.mid=[c/2,h],this.elmParams.droptheta=m>h?90:-90;else if(l==="c")this.segments.push(new p([[0,0],[h,0],[h,m],[c,m]],{arrow:a})),this.anchors.mid=[h,m/2],this.elmParams.droptheta=c>h?0:180;else throw new Error(`Wire: undefined shape ${l}`);let f=R(this.params,"dotradius",.075);if(this.params.dot){let b=this.params.dot==="open"?"bg":!0;this.segments.push(new D([c,m],f,{fill:b,zorder:3}))}if(this.params.idot){let b=this.params.idot==="open"?"bg":!0;this.segments.push(new D([0,0],f,{fill:b,zorder:3}))}return this.elmParams.lblloc="mid",this.elmParams.drop=[c,m],this.anchors.start=[0,0],this.anchors.end=[c,m],this._positioned=!0,super._place(e,t,n)}},vo=class extends N{constructor(e={}){super(e),this.elmParams.lblloc="center",this.elmParams.lblofst=0;let t=e.label;t!==void 0&&t!==""&&this.label(t)}},yo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{width:1.5,height:.625,lblloc:"center",fontsize:12,lblofst:0});let t=e.width??1.5,n=(e.height??.625)/2;this.segments.push(new U([[0,0],[n,n],[t,n],[t,-n],[n,-n]],{closed:!0})),this.anchors.start=[0,0];let s=e.s;s&&this.segments.push(new W([t/2,0],s,{fontsize:12}))}};function Zc(r){return r instanceof A?[r.x,r.y]:[r[0],r[1]]}function T1(r,e,t=.01){return Math.abs(r-e)<=t}function A1(r){let e=r.absanchors.center;if(e!==void 0)return e;let t=r.getBBox(!1,!1),n=(t.xmin+t.xmax)/2,s=(t.ymin+t.ymax)/2;return r.transform.transform([n,s])}var So=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.5})}to(e,t=0,n=0){let s=A.fromXY(Zc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}arrow(e){return this.userParams.arrow=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??[s[0]+3,s[1]],o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.5,c=[a/2-l*h,l/2+a*h],m=[a/2-l*h/2,l/2+a*h/2],f=this.params.arrow;this.segments.push(new Ut([[0,0],c,[a,l]],{arrow:f})),this.anchors.ctrl=c,this.anchors.mid=m,this.anchors.start=[0,0],this.anchors.end=[a,l],this.elmParams.lblloc="mid",this.elmParams.drop=[a,l];let g="bottom",b="left",x=.1,v=0;return T1(m[1],c[1])?(g="center",x=0):m[1]>c[1]&&(g="top",x=-.1),T1(m[0],c[0])?b="center":m[0]>c[0]?(b="right",x=0,v=-.1):(v=.1,x=0),this.elmParams.lblofst=[v,x],this.elmParams.lblalign=[b,g],this._positioned=!0,super._place(e,t,n)}},pn=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{k:.75,th1:0,th2:180,to:[1,0],arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(Zc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}k(e){return this.userParams.k=e,this}th1(e){return this.userParams.th1=e,this}th2(e){return this.userParams.th2=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}setLabelAlign(e,t){this.elmParams.lblloc="center";let n="left",s="bottom";t>0&&(s="top",this.elmParams.lblofst=-.1),e<=0&&(n="right"),this.elmParams.lblalign=[n,s]}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.userParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.k??.75,c=(this.params.th1??0)*(Math.PI/180),m=(this.params.th2??180)*(Math.PI/180),f=[a*h*Math.cos(c),l*h*Math.sin(c)],g=[a+a*h*Math.cos(m),l+l*h*Math.sin(m)],b=this.params.arrow,x=this.params.arrowlength,v=this.params.arrowwidth;return this.segments.push(new Ut([[0,0],f,g,[a,l]],{arrow:b,arrowlength:x,arrowwidth:v})),this.anchors.center=[a/2,l/2],this.anchors.start=[0,0],this.anchors.end=[a,l],this.anchors.ctrl1=f,this.anchors.ctrl2=g,this.elmParams.drop=[a,l],this.setLabelAlign(a,l),this._positioned=!0,super._place(e,t,n)}},ko=class extends pn{constructor(e={}){super({...e,to:e.to??[1,1],th1:e.th1??75,th2:e.th2??180,arrow:e.arrow??"<-"})}setLabelAlign(e,t){this.elmParams.lblloc="end";let n=this.anchors.ctrl2,s=this.anchors.end,i;for(n[0]===s[0]&&n[1]===s[1]?i=t<0?-90:90:i=Math.atan2(s[1]-n[1],s[0]-n[0])*180/Math.PI;i<0;)i+=360;i<45||i>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[.1,0]):i>=45&&i<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):i>135&&i<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[-.1,0]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1])}},Mo=class extends pn{constructor(e={}){super({...e,th1:0,th2:180})}},zo=class extends pn{constructor(e={}){super({...e,th1:90,th2:-90})}},Eo=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{radius:.6,arrowlength:.25,arrowwidth:.2})}to(e,t=0,n=0){let s=A.fromXY(Zc(e));return this.userParams.to=[s.x+t,s.y+n],this}delta(e,t){return this.userParams.delta=[e,t],this}radius(e){return this.userParams.radius=e,this}arrow(e){return this.userParams.arrow=e,this}arrowlength(e){return this.userParams.arrowlength=e,this}arrowwidth(e){return this.userParams.arrowwidth=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position(),this.segments=[],this.elmParams.theta=0;let s=this.params.at??e,i=this.params.to??e,o=this.params.delta,a,l;o!==void 0?(a=o[0],l=o[1]):(a=i[0]-s[0],l=i[1]-s[1]);let h=this.params.radius??.6,c=a/2,m=l/2,f=Math.sqrt(a*a+l*l),g=h*h-f/2*(f/2);if(g<0)throw new Error(`ArcLoop: no solution for radius ${h}`);let b=Math.sqrt(g),x=[c+b*(-l/f),m+b*(a/f)],v=Math.sqrt(c*c+m*m),S=Math.atan2(m,c),k=Math.acos(v/h),M=S-k,_=S+k,B=ze(Math.PI+_,M,50),$=[],Y=[];for(let re of B)$.push(x[0]+h*Math.cos(re)),Y.push(x[1]+h*Math.sin(re));let Z=$.map((re,te)=>[re,Y[te]]),L=this.params.arrow,I=this.params.arrowlength,X=this.params.arrowwidth;this.segments.push(new p(Z,{arrow:L,arrowlength:I,arrowwidth:X}));let j=Math.floor($.length/2);return this.anchors.start=[0,0],this.anchors.end=[$[$.length-1],Y[Y.length-1]],this.anchors.mid=[$[j],Y[j]],this.anchors.BL=[Math.min(...$),Math.min(...Y)],this.anchors.BR=[Math.max(...$),Math.min(...Y)],this.anchors.TL=[Math.min(...$),Math.max(...Y)],this.anchors.TR=[Math.max(...$),Math.max(...Y)],this.elmParams.lblloc="mid",this.elmParams.drop=[i[0]-s[0],i[1]-s[1]],this.elmParams.lblofst=[0,.2],Y[j]<Y[0]&&(this.elmParams.lblofst=[0,-.25]),this._positioned=!0,super._place(e,t,n)}},o0=class extends N{constructor(t={}){super(t);z(this,"_side","top");Object.assign(this.defaults,{ofst:.15,length:2,top:!0,reverse:!1,headlength:.3,headwidth:.2,anchor:"center",drop:null}),this.anchors.center=[0,0]}at(t,n=0,s=0){return t instanceof N?(this.userParams.overElement=t,this):super.at(t,n,s)}over(t){return this.userParams.overElement=t,this}placeArrowSegment(t){let n=this.params.ofst??.15,s=this.params.length??2;this._side==="bottom"&&(n=-n);let i=[-s/2,n],o=[s/2,n],a=this.params.headwidth??.2,l=this.params.headlength??.3;this.segments.push(new p([i,o],{arrow:"->",arrowwidth:a,arrowlength:l}))}placeFromOverElement(t){let n=String(R(t.params,"ilabel","top")).toLowerCase();n==="bot"&&(n="bottom"),this.params.top!==!1||(n={top:"bottom",bottom:"top",left:"right",right:"left"}[n]??n);let i=this.userParams.reverse===!0;if(t.userParams.reverse===!0){let f={left:"right",right:"left"};f[n]!==void 0?n=f[n]:i=!i}t.userParams.flip===!0&&(n==="left"||n==="right")&&(i=!i),n==="left"&&(i=!i),this.userParams.reverse=i;let o=t.transform.theta,a=t.getBBox(!1,!1),l,h;n==="top"?(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top"):n==="bottom"?(l=new A((a.xmin+a.xmax)/2,a.ymin),h="bot"):n==="right"?(l=new A(a.xmax,(a.ymin+a.ymax)/2),h="bot",o-=90):n==="left"?(l=new A(a.xmin,(a.ymin+a.ymax)/2),h="top",o+=90):(l=new A((a.xmin+a.xmax)/2,a.ymax),h="top");let c=t.transform.transform(l.toTuple());this.userParams.at=[c.x,c.y],this.userParams.theta=o,this.elmParams.lblloc=h,this._side=n==="bottom"?"bottom":n==="top"?"top":n==="left"?"left":"right";let m=t.userParams.color;m!==void 0&&(this.userParams.color=m)}_place(t,n,s){this.dwgParams={...s};let i=this.params.overElement;i!==void 0&&this.placeFromOverElement(i),this.segments=[];let o=((this.params.theta??0)%360+360)%360,a=this.params.lblloc??"top",l=this._side;if(l==="right"&&(o<=90||o>270)){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}else if((l==="top"||l==="left"||l==="bottom")&&o>90&&o<=270){let h=this.elmParams.lblloc??"top";this.elmParams.lblloc=h==="bot"?"top":"bot",a=this.elmParams.lblloc}return this.placeArrowSegment(a),super._place(t,n,s)}},Po=class extends o0{constructor(e={}){super(e),Object.assign(this.defaults,{length:1.75,ofst:.075,bend:.6})}placeArrowSegment(e){let t=this.params.ofst??.075,n=this.params.bend??.6,s=this.params.length??1.75;this._side==="bottom"&&(t=-t,n=-n);let i=this.params.headwidth??.2,o=this.params.headlength??.3,a=this.params.reverse===!0?"<-":"->",l=[-s/2,t],h=[s/2,t],c=[0,n];this.segments.push(new Ut([l,c,h],{arrow:a,arrowlength:o,arrowwidth:i}))}},fn=class extends N{constructor(e="in",t=.8,n=!0,s={}){super(s),Object.assign(this.defaults,{headlength:.3,headwidth:.3}),this.elmParams.lblofst=0,this.elmParams.drop=null,this.elmParams.zorder=4;let i=t,o=this.params.headlength??.3;e==="in"&&(i+=this.params.headlength??.3,o=-o),n&&(i=-i,o=-o);let a=this.params.headwidth??.3,l=this.params.headlength??.3;this.segments.push(new p([[i,0],[i+o,0]],{arrow:"->",arrowwidth:a,arrowlength:l}))}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let i=A1(s);this.userParams.at=[i.x,i.y],this.userParams.theta=s.transform.theta;let o=s.userParams.color;o!==void 0&&(this.userParams.color=o)}return this._positioned=!0,super._place(e,t,n)}},Ro=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{ofst:.5,hofst:.4,length:1,lengthtip:.5,headlength:.25,headwidth:.15}),this.userParams.anchor="center",this.anchors.center=[0,0]}at(e,t=0,n=0){return e instanceof N?(this.userParams.overElement=e,this):super.at(e,t,n)}over(e){return this.userParams.overElement=e,this}_place(e,t,n){this.dwgParams={...n},this._positioned||this._position();let s=this.params.overElement;if(s!==void 0){let x=A1(s);this.userParams.at=[x.x,x.y];let v=s.transform.theta;(v%360+360)%360>90&&(v%360+360)%360<=270&&(v+=180),this.userParams.theta=v;let S=s.userParams.color;S!==void 0&&(this.userParams.color=S)}let i=this.params.hofst??.4,o=this.params.ofst??.5,a=this.params.lengthtip??.5,l=this.params.length??1,h=this.params.headwidth??.15,c=this.params.headlength??.25,m=[-i,o],f=[-i-a,o],g=[-i-a,o-l];this.anchors.head=m,this.anchors.tail=g,this.segments=[],this.segments.push(new p([g,f,m],{arrow:"->",arrowwidth:h,arrowlength:c})),this.elmParams.lblloc="tail";let b=this.params.theta??0;return this.params.flip===!0&&(b+=180),b-=90,b=(b%360+360)%360,b<45||b>315?(this.elmParams.lblalign=["left","center"],this.elmParams.lblofst=[0,-.1]):b>=45&&b<=135?(this.elmParams.lblalign=["center","bottom"],this.elmParams.lblofst=[0,.1]):b>135&&b<=225?(this.elmParams.lblalign=["right","center"],this.elmParams.lblofst=[0,.1]):(this.elmParams.lblalign=["center","top"],this.elmParams.lblofst=[0,-.1]),this._positioned=!0,super._place(e,t,n)}},a0=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{lblloc:"center",lblofst:0,theta:0});let t=e.direction??"cw",n=e.theta1??35,s=e.theta2??-35,i=e.width??1,o=e.height??1;this.segments.push(new xe([0,0],i,o,{theta1:n,theta2:s,arrow:t})),this.anchors.center=[0,0]}},rh=class extends a0{constructor(e){At(null);let{elm_list:t,pad:n=.2,...s}=e,i=t[0].getBBox(!0,!1),o=t[1].getBBox(!0,!1),a=t[2].getBBox(!0,!1),l=t[3].getBBox(!0,!1),h=i.ymin-n,c=a.ymax+n,m=l.xmax+n,f=o.xmin-n,g=[(m+f)/2,(h+c)/2],b=f-m,x=h-c;super({...s,width:b,height:x,at:g})}},nh=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let k of t){let M=k.getBBox(!0,n);i=Math.min(i,M.xmin),o=Math.max(o,M.xmax),a=Math.min(a,M.ymin),l=Math.max(l,M.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g,this.segments.push(new xe([0,0],m,f,{theta1:0,theta2:360}));let b=Math.sin(Math.PI/4),x=Math.cos(Math.PI/4),v=Math.sin(Math.PI/8),S=Math.cos(Math.PI/8);this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0],this.anchors.SE=[m/2*x,-f/2*b],this.anchors.SW=[-m/2*x,-f/2*b],this.anchors.NW=[-m/2*x,f/2*b],this.anchors.NE=[m/2*x,f/2*b],this.anchors.ENE=[m/2*S,f/2*v],this.anchors.WNW=[-m/2*S,f/2*v],this.anchors.ESE=[m/2*S,-f/2*v],this.anchors.WSW=[-m/2*S,-f/2*v],this.anchors.NNE=[m/2*v,f/2*S],this.anchors.NNW=[-m/2*v,f/2*S],this.anchors.SSE=[m/2*v,-f/2*S],this.anchors.SSW=[-m/2*v,-f/2*S]}},sh=class extends N{constructor(e){At(null);let{elm_list:t,includelabels:n=!0,...s}=e;super(s),Object.assign(this.defaults,{cornerradius:.3,padx:.2,pady:.2,theta:0});let i=1/0,o=-1/0,a=1/0,l=-1/0;for(let v of t){let S=v.getBBox(!0,n);i=Math.min(i,S.xmin),o=Math.max(o,S.xmax),a=Math.min(a,S.ymin),l=Math.max(l,S.ymax)}let h=this.params.padx??.2,c=this.params.pady??.2;i-=h,o+=h,a-=c,l+=c;let m=o-i,f=l-a,g=[(o+i)/2,(l+a)/2];this.userParams.at=g;let b=this.params.cornerradius??.3;this.segments.push(new U([[-m/2,f/2],[m/2,f/2],[m/2,-f/2],[-m/2,-f/2]],{closed:!0,cornerradius:b}));let x=b-b*Math.sqrt(2)/2;this.anchors.NE=[m/2-x,f/2-x],this.anchors.NW=[-m/2+x,f/2-x],this.anchors.SE=[m/2-x,-f/2+x],this.anchors.SW=[-m/2+x,-f/2+x],this.anchors.N=[0,f/2],this.anchors.S=[0,-f/2],this.anchors.E=[m/2,0],this.anchors.W=[-m/2,0]}};var ir=class extends N{constructor(t={}){super(t);z(this,"compoundDwgParams");z(this,"elements",[]);z(this,"_here",new A(0,0));z(this,"_theta",0);this.compoundDwgParams={unit:t.unit??3,font:t.font??null,fontsize:t.fontsize??14,lblofst:t.lblofst??.1,color:t.color??"black",lw:t.lw??2,ls:t.ls??"-",fill:t.fill??"none"};let n=aa(!0);try{this.setup(),this._initAnchors()}finally{aa(n)}}_initAnchors(){for(let[t,n]of Object.entries(this))if(n instanceof N&&t!=="elements")for(let s of Object.keys(n.anchors)){let i=n.absanchors[s];i&&(this.anchors[`${t}.${s}`]=[i.x,i.y])}}move(t,n){this._here=new A(this._here.x+t,this._here.y+n)}moveFrom(t,n=0,s=0,i){let o=t instanceof A?t.x:t[0],a=t instanceof A?t.y:t[1];this._here=new A(o+n,a+s),i!==void 0&&(this._theta=i)}contains(t){return this.elements.includes(t)}add(t){this.elements.push(t);let n=t._place(this._here.toTuple(),this._theta,this.compoundDwgParams);this._here=n.point,this._theta=n.theta;for(let s of t.segments){let i=s.xform(t.transform,t.params);this.segments.push(i)}return t}};function fe(r,e){let t=r.absanchors[e];return[t.x,t.y]}var To=class extends ir{constructor(e={}){super({...e,unit:1.5,_box:e.box!==!1,_boxfill:e.boxfill??"none",_boxpad:e.boxpad??.2,_base:e.base===!0})}setup(){let t=this.userParams._box!==!1,n=this.userParams._boxfill??"none",s=this.userParams._boxpad??.2,i=this.userParams._base===!0,o=this.add(new et({d:"d"})),a=new Ht({d:"r",at:[1,-1.5/2]});a.segments.splice(0,1);let l=this.add(a);this.add(new mn({d:"r",at:[.5,-1.5/2+.2],l:.6,arrowwidth:.15,arrowlength:.2})),this.add(new mn({d:"r",at:[.5,-1.5/2-.2],l:.6,arrowwidth:.15,arrowlength:.2}));let h=this.getBBox(!1);if(t&&this.add(new xr({d:"r",at:[0,0],corner1:[h.xmin-s,h.ymin-s],corner2:[h.xmax+s,h.ymax+s],fill:n,zorder:0})),i){let b=l.getBBox(!0),x=o.absanchors.center;this.add(new Pe({d:"l",at:[b.xmin,x.y],l:.15}));let v=this.add(new Pe({d:"d",toy:h.ymax+s}));this.anchors.base=fe(v,"end")}let c=this.add(new Pe({d:"r",at:fe(a,"collector"),l:s})),m=this.add(new Pe({d:"r",at:fe(a,"emitter"),l:s})),f=this.add(new Pe({d:"l",at:fe(o,"start"),tox:h.xmin-s})),g=this.add(new Pe({d:"l",at:fe(o,"end"),tox:h.xmin-s}));this.anchors.anode=fe(f,"end"),this.anchors.cathode=fe(g,"end"),this.anchors.emitter=fe(m,"end"),this.anchors.collector=fe(c,"end")}},Ao=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.fill??!1,t=this.userParams.labels,n=new et({fill:e}).theta(45),s=new et({fill:e}).theta(-45),i=new et({fill:e}).theta(-135).reverse(),o=new et({fill:e}).theta(135).reverse(),a=["top","top","bottom","bottom"];t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},_o=class extends ir{constructor(e={}){super(e)}setup(){let e=this.userParams.vout===!0,t=this.userParams.labels,n=new dt().theta(45),s=new dt().theta(-45),i=new dt().theta(-135),o=new dt().theta(135),a=["top","top","bottom","bottom"];if(t&&[n,s,i,o].forEach((l,h)=>{t[h]&&l.label(t[h],{loc:a[h]})}),this.add(n),this.add(s),this.add(i),this.add(o),e){let l=n.absanchors.start;this.add(new Pe({}).right().at([l.x,l.y]).length(1));let h=this.add(new dn({open:!0})),c=i.absanchors.start;this.add(new Pe({}).left().at([c.x,c.y]).length(1));let m=this.add(new dn({open:!0}));this.anchors.vo1=fe(h,"center"),this.anchors.vo2=fe(m,"center"),this._labelhints.vo1={ofst:[0,.1],halign:"center",valign:"bottom"},this._labelhints.vo2={ofst:[0,.1],halign:"center",valign:"bottom"}}this.anchors.W=fe(n,"start"),this.anchors.N=fe(s,"start"),this.anchors.E=fe(i,"start"),this.anchors.S=fe(o,"start"),this.elmParams.theta=0}},Bo=class extends ir{constructor(e={}){let t=e.unit??2;super({...e,unit:t})}setup(){let e=this.userParams.unit??2,t=this.userParams.cycl===!0,n=this.userParams.switch??"spst",s=this.userParams.core!==!1,i=this.userParams.box!==!1,o=this.userParams.boxfill??"none",a=this.userParams.boxpad??.25,l=this.userParams.swreverse===!0,h=this.userParams.swflip===!0,c=this.userParams.link!==!1,m=t?this.add(new Ir({d:"d"})):this.add(new Cr({d:"d"}));this.anchors.in1=fe(m,"start"),this.anchors.in2=fe(m,"end");let f=m.getBBox(!0).xmax,g=f+.6;s&&(this.add(new Pe({d:"d",at:[f+.15,-e/2],anchor:"center",l:1})),g+=.1);let b;if(n==="spst"){let x=new Yr({d:"d",reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),0],this.add(x),this.anchors.a=fe(x,"start"),this.anchors.b=fe(x,"end"),b=x}else if(n==="spdt"){let x=new Ys({d:"d",reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?-e:0,k=l?0:-e,M=this.add(new Pe({d:l?"d":"u",at:fe(x,"a"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"b"),toy:k})),B=this.add(new Pe({d:l?"u":"d",at:fe(x,"c"),toy:k}));this.anchors.a=fe(M,"end"),this.anchors.b=fe(_,"end"),this.anchors.c=fe(B,"end"),b=x}else if(n==="dpst"){let x=new Xs({d:"d",link:!1,reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(x,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"t2"),toy:S})),B=this.add(new Pe({d:l?"d":"u",at:fe(x,"p1"),toy:k})),$=this.add(new Pe({d:l?"d":"u",at:fe(x,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.p1=fe(B,"end"),this.anchors.p2=fe($,"end"),b=x}else if(n==="dpdt"){let x=new Gs({d:"d",link:!1,reverse:l,flip:h}),v=x.getBBox(!1);x.userParams.at=[g-(h?-v.ymax:v.ymin),-.5],this.add(x);let S=l?0:-e,k=l?-e:0,M=this.add(new Pe({d:l?"u":"d",at:fe(x,"t1"),toy:S})),_=this.add(new Pe({d:l?"u":"d",at:fe(x,"t2"),toy:S})),B=this.add(new Pe({d:l?"u":"d",at:fe(x,"t3"),toy:S})),$=this.add(new Pe({d:l?"u":"d",at:fe(x,"t4"),toy:S})),Y=this.add(new Pe({d:l?"d":"u",at:fe(x,"p1"),toy:k})),Z=this.add(new Pe({d:l?"d":"u",at:fe(x,"p2"),toy:k}));this.anchors.t1=fe(M,"end"),this.anchors.t2=fe(_,"end"),this.anchors.t3=fe(B,"end"),this.anchors.t4=fe($,"end"),this.anchors.p1=fe(Y,"end"),this.anchors.p2=fe(Z,"end"),b=x}else{let x=new Yr({d:"d"});x.userParams.at=[g,0],this.add(x),b=x}if(c){let x=b.getBBox(!1),v=h?x.ymax:x.ymin;this.add(new Pe({d:"r",at:[f+.2,-e/2],ls:":",tox:v}))}if(i){let x=this.getBBox(!1);this.add(new xr({d:"r",at:[0,0],corner1:[x.xmin-a,x.ymin+.2],corner2:[x.xmax+a,x.ymax-.2],fill:o,zorder:0}))}}};var _1=1,B1=.5;function Ws(r,e){let t=r.absanchors[e];return[t.x,t.y]}var vr=class extends ir{constructor(t={}){super({unit:t.unit??1.5,...t});z(this,"inputComponent");z(this,"outputComponent")}setup(){let t=this.userParams._inputFactory,n=this.userParams._outputFactory,s=this.userParams.boxpadx??.2,i=this.userParams.boxpady??.2,o=this.userParams.minw??.5,a=this.userParams.terminals??!0,l=this.userParams.width??2.15,h=this.userParams.box??!0,c=this.userParams.boxfill,m=this.userParams.boxlw,f=this.userParams.boxls,g=(t??(()=>new Xt))();g.down();let b=(n??(()=>new Xt))();b.down();let x=g.getBBox(!1,!1),v=b.getBBox(!1,!1),S=Math.max((x.ymax-x.ymin)/2,o/2),k=Math.max((v.ymax-v.ymin)/2,o/2);g.at([s+S,0]),b.at([l-s-k,0]),this.inputComponent=this.add(g),this.outputComponent=this.add(b);let M=this.getBBox(!1,!1);h&&this.add(new xr({theta:0,at:[0,0],corner1:[0,M.ymin-i],corner2:[l,M.ymax+i],fill:c??"none",lw:m,ls:f,zorder:0})),M=this.getBBox(!1,!1);let _=this.add(new Pe({at:Ws(this.outputComponent,"start")}).tox(M.xmax).right()),B=this.add(new Pe({at:Ws(this.outputComponent,"end")}).tox(M.xmax).right()),$=this.add(new Pe({at:Ws(this.inputComponent,"start")}).tox(M.xmin).left()),Y=this.add(new Pe({at:Ws(this.inputComponent,"end")}).tox(M.xmin).left());if(this.anchors.in_p=Ws($,"end"),this.anchors.in_n=Ws(Y,"end"),this.anchors.out_p=Ws(_,"end"),this.anchors.out_n=Ws(B,"end"),this.anchors.center=[(M.xmin+M.xmax)/2,(M.ymin+M.ymax)/2],this._labelhints.in_p={ofst:[0,.15],halign:"right"},this._labelhints.in_n={ofst:[0,.15],halign:"right"},this._labelhints.out_p={ofst:[0,.15],halign:"left"},this._labelhints.out_n={ofst:[0,.15],halign:"left"},a)for(let Z of["in_p","in_n","out_p","out_n"]){let L=Z.startsWith("in")?-B1:B1,I=this.anchors[Z],X=[I[0]+L,I[1]];this.anchors[Z]=X,this.segments.push(new p([I,X]))}}},Co=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>new Xt,boxpadx:e.boxpadx??0,minw:e.minw??0})}setup(){super.setup();let e=this.userParams.sign??!0,t=this.userParams.arrow??!0,n=this.userParams.reverse_output??!1;if(e){let s=this.inputComponent.absanchors.end,i=this.inputComponent.absanchors.start;this.segments.push(new W([s.x+.1,s.y+.1],"\u2212",{halign:"left",valign:"center",rotation:0})),this.segments.push(new W([i.x+.1,i.y-.1],"+",{halign:"left",valign:"center",rotation:0}));let o=this.outputComponent.absanchors.end,a=this.outputComponent.absanchors.start;n?(this.segments.push(new W([o.x-.1,o.y+.1],"+",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"\u2212",{halign:"right",valign:"center",rotation:0}))):(this.segments.push(new W([o.x-.1,o.y+.1],"\u2212",{halign:"right",valign:"center",rotation:0})),this.segments.push(new W([a.x-.1,a.y-.1],"+",{halign:"right",valign:"center",rotation:0})))}if(t){let s=this.anchors.center;this.segments.push(new p([[s[0]-_1/2,s[1]],[s[0]+_1/2,s[1]]],{arrow:"->",lw:2,arrowwidth:.3,arrowlength:.3}))}}},Io=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},Lo=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new br:new br({reverse:!0})})}setup(){super.setup();let e=new fn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},Do=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Pe,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=new fn("in",-.15,!0,{headlength:.3});e.at(this.inputComponent),this.add(e)}},No=class extends vr{constructor(e={}){let t=e.reverse_output??!1;super({...e,_inputFactory:()=>new Xt,_outputFactory:()=>t?new wr:new wr({reverse:!0})})}setup(){super.setup();let e=this.inputComponent.absanchors.end,t=this.inputComponent.absanchors.start;this.segments.push(new W([e.x,e.y+.05],"\u2212",{halign:"right",valign:"bottom",rotation:0})),this.segments.push(new W([t.x,t.y-.05],"+",{halign:"right",valign:"top",rotation:0}))}},Oo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Dr,_outputFactory:()=>new Nr,boxpadx:e.boxpadx??.3})}},Fo=class extends vr{constructor(e={}){super({...e,_inputFactory:()=>new Fr,_outputFactory:()=>new Or,boxpadx:e.boxpadx??.3})}};var Le=1.1,l0=class extends N{constructor(t={}){super(t);z(this,"_outletrad",1.5);let n=!!t.plug,s=this._outletrad,i=ze(Math.PI*3/4,Math.PI*5/4),o=i.map(_=>.15+s*Math.cos(_)),a=i.map(_=>s*Math.sin(_)),l=i.map(_=>-.15+-s*Math.cos(_)),h=i.map(_=>-s*Math.sin(_)),c=[...o,...l],m=[...a,...h],f=c.map((_,B)=>[_,m[B]]);this.segments.push(new U(f));let g=s/8,b=g*3,x=b*1.25,v=b/2,S=x/2,k=s/2.2,M=n?"black":"bg";this.segments.push(new U([[-k,S],[-k,S-x],[-k+g,S-x],[-k+g,S]],{fill:M,zorder:3})),this.segments.push(new U([[k,v],[k,v-b],[k-g,v-b],[k-g,v]],{fill:M,zorder:3})),this.anchors.hot=[k-g/2,0],this.anchors.neutral=[-k+g/2,0],this.elmParams.drop=[k-g/2,0]}},$o=class extends l0{constructor(e={}){super(e);let t=!!e.plug,n=this._outletrad,s=n/4,i=-n/2.5,o=[-s/2,-s/2,s/2,s/2],a=[i,i-s/2,i-s/2,i],l=ze(0,Math.PI);for(let b of l)o.push(s/2*Math.cos(b)),a.push(i+s/2*Math.sin(b));let h=t?"black":"bg",c=o.map((b,x)=>[b,a[x]]);this.segments.push(new U(c,{fill:h,zorder:3}));let m=s/2,f=this.segments[1];f.verts=f.verts.map(([b,x])=>[b,x+m]);let g=this.segments[2];g.verts=g.verts.map(([b,x])=>[b,x+m]),this.anchors.hot=[this.anchors.hot[0],this.anchors.hot[1]+m],this.anchors.neutral=[this.anchors.neutral[0],this.anchors.neutral[1]+m],this.anchors.ground=[0,i]}},h0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0]}},jo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=-Le/4,a=Le/2.5;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s*1.2,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[0,a]}},qo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2,o=0,a=Le/2;this.segments.push(new D([-i,o],s,{fill:n,zorder:3})),this.segments.push(new D([i,o],s,{fill:n,zorder:3})),this.segments.push(new D([0,a],s,{fill:n,zorder:3})),this.anchors.hot=[i,o],this.anchors.neutral=[-i,o],this.anchors.ground=[0,a],this.elmParams.drop=[-i,o]}},Ho=class extends h0{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le/8,i=Le/6,o=Le-.05,a=-Le+.05;this.segments.push(new p([[-s,o],[-s,o-i],[s,o-i],[s,o]],{fill:n,zorder:3})),this.segments.push(new p([[-s,a],[-s,a+i],[s,a+i],[s,a]],{fill:n,zorder:3}))}},Yo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/6,i=s*3,o=Le/5,a=Le*3/4,l=-Le/2.5,h=s;this.segments.push(new U([[-o/2,a],[-o/2,a-i],[o/2,a-i],[o/2,a]],{fill:n,zorder:3})),this.segments.push(new U([[-h,l],[-h,l-s],[-h-i,l-s],[-h-i,l]],{fill:n,zorder:3})),this.segments.push(new U([[h,l],[h,l-s],[h+i,l-s],[h+i,l]],{fill:n,zorder:3})),this.anchors.hot=[h+i/2,l-s/2],this.anchors.neutral=[-h-i/2,l-s/2],this.anchors.ground=[0,a-i/2],this.elmParams.drop=[h+i/2,l-s/2]}},c0=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=s*3,o=-s*2,a=[[-s/2,o],[-s/2,o-i],[s/2,o-i],[s/2,o]],l=a.map(c=>Gr(c,120).toTuple()),h=a.map(c=>Gr(c,-120).toTuple());this.segments.push(new U(a,{fill:n,zorder:3})),this.segments.push(new U(l,{fill:n,zorder:3})),this.segments.push(new U(h,{fill:n,zorder:3})),this.anchors.hot=l[1],this.anchors.neutral=h[2],this.anchors.ground=[0,o-i],this.elmParams.drop=l[1]}},Xo=class extends c0{constructor(e={}){super(e);let t=[.4,.3],n=[-.4,.3],s=this.segments[2];s.verts=s.verts.map(o=>Gr(o,90,t).toTuple());let i=this.segments[3];i.verts=i.verts.map(o=>Gr(o,-90,n).toTuple()),this.anchors.hot=Gr(this.anchors.hot,90,t).toTuple(),this.anchors.neutral=Gr(this.anchors.neutral,-90,n).toTuple()}},Go=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.5,i=s*2,o=i/5;this.segments.push(new U([[-i/2,0],[-i/2+o,s/2],[i/2-o,s/2],[i/2,0],[i/2-o,-s/2],[-i/2+o,-s/2]]));let a=Le/8;this.segments.push(new D([-i/4,0],a,{fill:n,zorder:3})),this.segments.push(new D([0,-a*2],a,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],a,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,-a*2],this.elmParams.drop=[i/4,0]}},Wo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg";this.segments.push(new D([0,0],Le));let s=Le/8,i=Le/2;this.segments.push(new D([-i,0],s,{fill:n,zorder:3})),this.segments.push(new D([i,0],s,{fill:n,zorder:3})),this.anchors.hot=[i,0],this.anchors.neutral=[-i,0],this.elmParams.drop=[i,0];let o=Le/4,a=-Le/2,l=[-o/2,-o/2,o/2,o/2],h=[a,a+o/2,a+o/2,a],c=ze(0,Math.PI);for(let f of c)l.push(o/2*Math.cos(f)),h.push(a-o/2*Math.sin(f));let m=l.map((f,g)=>[f,h[g]]);this.segments.push(new U(m,{fill:n,zorder:3})),this.anchors.ground=[0,a]}},Vo=class extends N{constructor(e={}){super(e);let n=!!e.plug?"black":"bg",s=Le*1.2,i=s*2.25;this.segments.push(new U([[-i/2,s/2],[i/2,s/2],[i/2,-s/2],[-i/2,-s/2]]));let o=Le/8;this.segments.push(new D([-i/4,0],o,{fill:n,zorder:3})),this.segments.push(new D([0,0],o,{fill:n,zorder:3})),this.segments.push(new D([i/4,0],o,{fill:n,zorder:3})),this.anchors.hot=[i/4,0],this.anchors.neutral=[-i/4,0],this.anchors.ground=[0,0],this.elmParams.drop=[i/4,0]}};var Vs=0,st=1.75,Aa=st/2,ih=20,Gt=st*.4,or=st/9,_a=st/6,Ba=class extends N{constructor(e={}){super(e),Object.assign(this.defaults,{tube_lw:2.5,anode_lw:2,cathode_lw:2,heat_lw:2,grid_lw:2,n_grid_dashes:3,dot_radius:.075,theta:0})}_drawEnvelope(e,t,n="none"){let s=-e,i=t/2,o=-i,a=i,l=[0,-e/2],h=Math.min(t/2,e/2);n==="left"?this.segments.push(new xe(l,t,e,{theta1:90-ih,theta2:270+ih,lw:this.params.tube_lw})):n==="right"?this.segments.push(new xe(l,t,e,{theta1:270-ih,theta2:90+ih,lw:this.params.tube_lw})):this.segments.push(new U([[o,Vs],[a,Vs],[a,s],[o,s]],{cornerradius:h,lw:this.params.tube_lw})),this.anchors.N=[0,0],this.anchors.S=[0,-e],this.anchors.E=[a,-e/2],this.anchors.W=[o,-e/2];let c=Aa/Math.sqrt(2);this.anchors.NE=[c,-Aa+c],this.anchors.NW=[-c,-Aa+c],this.anchors.SE=[c,-Aa-c],this.anchors.SW=[-c,-Aa-c],this._labelhints.NE={ofst:[.12,.12],halign:"left"},this._labelhints.NW={ofst:[-.12,.12],halign:"right"},this._labelhints.SE={ofst:[.12,-.12],halign:"left",valign:"top"},this._labelhints.SW={ofst:[-.12,-.12],halign:"right",valign:"top"}}_drawElements(e,t,n,s,i,o,a=""){let l=this.params.dot_radius,h=Vs-t/2+Math.max(0,s-1)*or/2,c=h-or*Math.max(0,s-1),m=e-Gt/2,f=e+Gt/2,g=h+or;o==="narrow"?this.segments.push(new p([[e-l,g],[e+l,g]],{lw:this.params.anode_lw})):o==="dot"?(g+=l*2,this.segments.push(new D([e,g-l],l,{lw:this.params.anode_lw}))):o!=="none"&&o!=null&&this.segments.push(new p([[m,g],[f,g]],{lw:this.params.anode_lw})),o!=="none"&&o!=null&&(this.segments.push(new p([[e,Vs],[e,g]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[e,Vs],this._labelhints[`anode${a}`]={ofst:[.1,.1],halign:"left",valign:"bottom",fontsize:11});let b=this.params.n_grid_dashes,x=Gt/(b+2),v=(Gt-x*(b-1))/b,S=[];for(let _=0;_<b;_++)S.push(m+_*(v+x));for(let _=0;_<s;_++){let B=h-or*_;for(let $=0;$<b;$++)this.segments.push(new p([[S[$],B],[S[$]+v,B]],{lw:this.params.grid_lw}));s===1?(this.anchors[`grid${a}`]=[m-x,B],this.anchors[`grid${a}_R`]=[f+x,B],this._labelhints[`grid${a}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11}):(this.anchors[`grid${a}_${_+1}`]=[m-x,B],this.anchors[`grid${a}_${_+1}R`]=[f+x,B],this._labelhints[`grid${a}_${_+1}`]={ofst:[-n/2-m+.1,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints[`grid${a}_${_+1}R`]={ofst:[n/2-f-.1,.1],halign:"left",valign:"bottom",fontsize:11})}let k=c-or,M=l*2;return i==="cold"?(this.segments.push(new p([[e,k-l*2],[e,-t]])),this.segments.push(new D([e,k-l],l)),this.anchors[`cathode${a}`]=[e,-t],this._labelhints[`cathode${a}`]={ofst:[.1,-.1],halign:"left",valign:"top",fontsize:11}):i!=="none"&&i!=null&&(this.segments.push(new p([[m,k-M],[m,k],[f,k],[f,k-M]],{lw:this.params.cathode_lw})),this.anchors[`cathode${a}`]=[m,k-M],this.anchors[`cathode${a}_R`]=[f,k-M],this._labelhints[`cathode${a}`]={ofst:[-.1,-t-k+M],halign:"right",valign:"top",fontsize:11},this._labelhints[`cathode${a}_R`]={ofst:[.1,-t-k+M],halign:"left",valign:"top",fontsize:11}),k}_drawHeat(e,t){let n=e-or*1.25,s=-Gt/3.5,i=Gt/3.5,o=Vs-t-or,a=n-Math.sqrt(2)*i;this.segments.push(new p([[s,o],[s,a],[0,n],[i,a],[i,o]],{lw:this.params.heat_lw})),this.anchors.heat1=[s,o],this.anchors.heat2=[i,o],this._labelhints.heat1={ofst:[-.1,0],halign:"right",valign:"bottom",fontsize:11},this._labelhints.heat2={ofst:[.1,0],halign:"left",valign:"bottom",fontsize:11}}},Xr=class extends Ba{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids:s=1,heater:i=!0,split:o="none",...a}=e;super(a);let l=Math.max(st,st+(s-4)*or);this._drawEnvelope(l,st,o);let h=this._drawElements(0,l,st,s,t,n);i&&this._drawHeat(h,l)}},Uo=class extends Ba{constructor(e={}){let{cathode:t="heated",anodetype:n="plate",grids_left:s=1,grids_right:i=1,heater:o=!0,...a}=e;super(a);let l=Math.max(s,i),h=Math.max(st,st+(l-4)*or),c=st*1.5,m=-c*.2,f=c*.2;this._drawEnvelope(h,c);let g=this._drawElements(m,h,c,s,t,n,"A"),b=this._drawElements(f,h,c,i,t,n,"B");o&&this._drawHeat(Math.min(g,b),h)}},Jo=class extends Ba{constructor(e={}){let{anodes:t=3,cathode:n="T",anodetype:s="narrow",grid:i=!1,...o}=e;super(o);let a=st,l=Math.max(st,(t-1)*_a+st);this._drawEnvelope(a,l),i&&this._drawNixieGrid(t,l),this._drawNixieAnodes(t,s),this._drawNixieCathode(t,n)}_drawNixieAnodes(e,t){let n=-st/4,i=-((e-1)*_a)/2,o=this.params.dot_radius;for(let a=0;a<e;a++){let l=i+a*_a;t==="dot"?this.segments.push(new D([l,n-o],o,{lw:this.params.anode_lw})):this.segments.push(new p([[l-o,n],[l+o,n]],{lw:this.params.anode_lw})),this.segments.push(new p([[l,Vs],[l,n]],{lw:this.params.anode_lw})),this.anchors[`anode${a}`]=[l,Vs],this._labelhints[`anode${a}`]={ofst:[-.1,.1],halign:"right",valign:"bottom",fontsize:11}}}_drawNixieGrid(e,t){let n=(e-1)*_a,s=-n/2,i=e+1,o=n/(i+2),a=(n-o*(i-1))/i,l=[];for(let c=0;c<i;c++)l.push(s+c*(a+o));let h=-st/2;for(let c=0;c<i;c++)this.segments.push(new p([[l[c],h],[l[c]+a,h]],{lw:this.params.grid_lw}));this.anchors.grid=[s-o,h],this.anchors.grid_R=[s+n+o,h],this._labelhints.grid={ofst:[-t/2-s,.1],halign:"right",valign:"bottom",fontsize:11},this._labelhints.grid_R={ofst:[t/2-n/2,.1],halign:"left",valign:"bottom",fontsize:11}}_drawNixieCathode(e,t){let n=this.params.dot_radius,s=-3*st/4,i=n,o=(e-1)*_a;t==="cold"?(this.segments.push(new p([[0,s-n*2],[0,-st]],{lw:this.params.cathode_lw})),this.segments.push(new D([0,s-n],n)),this.anchors.cathode=[0,-st]):t==="heated"?(this.segments.push(new p([[-Gt/2,s-i],[-Gt/2,s],[Gt/2,s],[Gt/2,s-i]],{lw:this.params.cathode_lw})),this.anchors.cathode=[-Gt/2,s-i],this.anchors.cathode_R=[Gt/2,s-i]):t!=="none"&&t!=null&&(this.segments.push(new p([[0,-st],[0,s],H,[-o/2,s],[o/2,s]],{lw:this.params.cathode_lw})),this.anchors.cathode=[0,-st])}},Ko=class extends Xr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:0,heater:t,split:n,...s})}},Zo=class extends Xr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:1,heater:t,split:n,...s}),this.anchors.control=this.anchors.grid,this.anchors.control_R=this.anchors.grid_R,this._labelhints.control=this._labelhints.grid,this._labelhints.control_R=this._labelhints.grid_R}},Qo=class extends Xr{constructor(e={}){let{heater:t=!1,split:n="none",...s}=e;super({cathode:"heated",grids:2,heater:t,split:n,...s}),this.anchors.screen=this.anchors.grid_1,this.anchors.screen_R=this.anchors.grid_1R,this.anchors.control=this.anchors.grid_2,this.anchors.control_R=this.anchors.grid_2R,this._labelhints.screen=this._labelhints.grid_1,this._labelhints.screen_R=this._labelhints.grid_1R,this._labelhints.control=this._labelhints.grid_2,this._labelhints.control_R=this._labelhints.grid_2R}},ea=class extends Xr{constructor(e={}){let{strap:t=!1,heater:n=!1,split:s="none",...i}=e;if(super({cathode:"heated",grids:3,heater:n,split:s,...i}),this.anchors.suppressor=this.anchors.grid_1,this.anchors.suppressor_R=this.anchors.grid_1R,this.anchors.screen=this.anchors.grid_2,this.anchors.screen_R=this.anchors.grid_2R,this.anchors.control=this.anchors.grid_3,this.anchors.control_R=this.anchors.grid_3R,this._labelhints.suppressor=this._labelhints.grid_1,this._labelhints.suppressor_R=this._labelhints.grid_1R,this._labelhints.screen=this._labelhints.grid_2,this._labelhints.screen_R=this._labelhints.grid_2R,this._labelhints.control=this._labelhints.grid_3,this._labelhints.control_R=this._labelhints.grid_3R,t){let o=this.params.dot_radius,a=this.anchors.cathode_R,l=[a[0],a[1]+o*2],h=this.anchors.suppressor_R,c=[Gt/2,h[1]],m=[l[0]+or*.75,l[1]+or/2],f=[m[0],c[1]-or/2];this.segments.push(new p([l,m,f,c],{lw:this.params.cathode_lw}))}}};var Us={ResistorIEEE:r=>new dt(r??{}),ResistorIEC:r=>new mt(r??{}),ResistorVarIEEE:r=>new cr(r??{}),ResistorVarIEC:r=>new Zt(r??{}),Thermistor:r=>new Un(r??{}),PhotoresistorIEEE:r=>new ur(r??{}),PhotoresistorIEC:r=>new Qt(r??{}),Rshunt:r=>new Jn(r??{}),PotentiometerIEEE:r=>new mr(r??{}),PotentiometerIEC:r=>new er(r??{}),FuseIEEE:r=>new dr(r??{}),FuseIEC:r=>new Lr(r??{}),Resistor:r=>new Kn(r??{}),ResistorVar:r=>new Zn(r??{}),Photoresistor:r=>new es(r??{}),Potentiometer:r=>new Qn(r??{}),Fuse:r=>new ts(r??{}),Memristor:r=>new rs(r??{}),Memristor2:r=>new ns(r??{}),Josephson:r=>new ss(r??{}),FuseUS:r=>new is(r??{}),Breaker:r=>new os(r??{}),CPE:r=>new as(r??{}),SparkGap:r=>new ls(r??{}),Nullator:r=>new Dr(r??{}),Norator:r=>new Nr(r??{}),CurrentMirror:r=>new Or(r??{}),VoltageMirror:r=>new Fr(r??{}),Capacitor:r=>new Br(r??{}),Capacitor2:r=>new Bn(r??{}),CapacitorVar:r=>new Cn(r??{}),CapacitorTrim:r=>new In(r??{}),Diode:r=>new et(r??{}),Schottky:r=>new Ln(r??{}),Zener:r=>new Dn(r??{}),DiodeTunnel:r=>new Nn(r??{}),DiodeTVS:r=>new On(r??{}),DiodeShockley:r=>new Fn(r??{}),Varactor:r=>new $n(r??{}),LED:r=>new jn(r??{}),LED2:r=>new qn(r??{}),Photodiode:r=>new Hn(r??{}),SCR:r=>new Yn(r??{}),Diac:r=>new sn(r??{}),Triac:r=>new Xn(r??{}),Inductor:r=>new Cr(r??{}),Inductor2:r=>new Ir(r??{}),Crystal:r=>new Vn(r??{}),Opamp:r=>new hs(r??{}),AnalogBiasedFet:r=>new F0(r??{}),AnalogNFet:r=>new N0(r??{}),AnalogPFet:r=>new O0(r??{}),Bjt:r=>new jr(r??{}),Bjt2:r=>new qr(r??{}),BjtNpn:r=>new Ht(r??{}),BjtNpn2:r=>new ys(r??{}),BjtPnp:r=>new rr(r??{}),BjtPnp2:r=>new an(r??{}),BjtPnp2c:r=>new X0(r??{}),BjtPnp2c2:r=>new Z0(r??{}),Hemt:r=>new Y0(r??{}),IgbtN:r=>new J0(r??{}),IgbtP:r=>new K0(r??{}),JFet:r=>new xs(r??{}),JFet2:r=>new vs(r??{}),JFetN:r=>new $0(r??{}),JFetN2:r=>new q0(r??{}),JFetP:r=>new j0(r??{}),JFetP2:r=>new H0(r??{}),NFet:r=>new fs(r??{}),NFet2:r=>new bs(r??{}),NMos:r=>new us(r??{}),NMos2:r=>new ds(r??{}),NpnPhoto:r=>new V0(r??{}),NpnSchottky:r=>new G0(r??{}),PFet:r=>new gs(r??{}),PFet2:r=>new ws(r??{}),PMos:r=>new ms(r??{}),PMos2:r=>new ps(r??{}),PnpPhoto:r=>new U0(r??{}),PnpSchottky:r=>new W0(r??{}),DFlipFlop:r=>new ei(r??{}),Ic:r=>new nr(r??{}),Ic555:r=>new ni(r??{}),IcDIP:r=>new ii(r??{}),JKFlipFlop:r=>new ti(r??{}),Multiplexer:r=>new Q0(r??{}),SevenSegment:r=>new si(r??{}),VoltageRegulator:r=>new ri(r??{}),Source:r=>new rt(r??{}),SourceV:r=>new Pi(r??{}),SourceI:r=>new Ri(r??{}),SourceSin:r=>new Ti(r??{}),SourcePulse:r=>new Ai(r??{}),SourceSquare:r=>new Ci(r??{}),SourceTriangle:r=>new _i(r??{}),SourceRamp:r=>new Bi(r??{}),SourceControlled:r=>new Hs(r??{}),SourceControlledV:r=>new br(r??{}),SourceControlledI:r=>new wr(r??{}),BatteryCell:r=>new Ii(r??{}),Battery:r=>new Li(r??{}),BatteryDouble:r=>new Di(r??{}),Solar:r=>new Ni(r??{}),MeterV:r=>new Oi(r??{}),MeterI:r=>new Fi(r??{}),MeterA:r=>new $i(r??{}),MeterOhm:r=>new ji(r??{}),MeterArrow:r=>new qi(r??{}),Lamp:r=>new Hi(r??{}),Lamp2:r=>new Yi(r??{}),Neon:r=>new Xi(r??{}),MeterBox:r=>new un(r??{}),MeterAnalog:r=>new Gi(r??{}),Oscilloscope:r=>new Wi(r??{}),MeterDigital:r=>new Vi(r??{}),GroundSignal:r=>new Ui(r??{}),GroundChassis:r=>new Ji(r??{}),Antenna:r=>new Ki(r??{}),AntennaLoop:r=>new Zi(r??{}),AntennaLoop2:r=>new Qi(r??{}),Vss:r=>new eo(r??{}),Vdd:r=>new to(r??{}),NoConnect:r=>new ro(r??{}),Switch:r=>new Yr(r??{}),SwitchSpdt:r=>new no(r??{}),SwitchSpdt2:r=>new Ys(r??{}),SwitchDpst:r=>new Xs(r??{}),SwitchDpdt:r=>new Gs(r??{}),Button:r=>new so(r??{}),SwitchReed:r=>new io(r??{}),SwitchRotary:r=>new oo(r??{}),SwitchDIP:r=>new ao(r??{}),Speaker:r=>new lo(r??{}),Mic:r=>new ho(r??{}),Motor:r=>new co(r??{}),AudioJack:r=>new uo(r??{}),Coax:r=>new mo(r??{}),Triax:r=>new po(r??{}),Transformer:r=>new fo(r??{}),Line:r=>new Pe(r??{}),Ground:r=>new Ei(r??{}),Arrow:r=>new mn(r??{}),DataBusLine:r=>new go(r??{}),Dot:r=>new dn(r??{}),DotDotDot:r=>new wo(r??{}),Gap:r=>new Xt(r??{}),Arrowhead:r=>new bo(r??{}),Label:r=>new vo(r??{}),Rect:r=>new xr(r??{}),Tag:r=>new yo(r??{}),Wire:r=>new xo(r??{}),Annotate:r=>new ko(r??{}),Arc2:r=>new So(r??{}),Arc3:r=>new pn(r??{}),ArcLoop:r=>new Eo(r??{}),ArcN:r=>new zo(r??{}),ArcZ:r=>new Mo(r??{}),CurrentLabel:r=>new o0(r??{}),CurrentLabelInline:r=>{let{direction:e,ofst:t,start:n,...s}=r??{};return new fn(e,t,n,s)},LoopArrow:r=>new a0(r??{}),VoltageLabelArc:r=>new Po(r??{}),ZLabel:r=>new Ro(r??{}),Optocoupler:r=>new To(r??{}),Rectifier:r=>new Ao(r??{}),Relay:r=>new Bo(r??{}),Wheatstone:r=>new _o(r??{}),TwoPort:r=>new Co(r??{}),VoltageTransactor:r=>new Io(r??{}),TransimpedanceTransactor:r=>new Lo(r??{}),CurrentTransactor:r=>new Do(r??{}),TransadmittanceTransactor:r=>new No(r??{}),Nullor:r=>new Oo(r??{}),VMCMPair:r=>new Fo(r??{}),OrthoLines:r=>new ui(r??{}),RightLines:r=>new qs(r??{}),Header:r=>new mi(r??{}),Jumper:r=>new di(r??{}),BusConnect:r=>new pi(r??{}),BusLine:r=>new fi(r??{}),DB25:r=>new bi(r??{}),DE9:r=>new s0(r??{}),DB9:r=>new gi(r??{}),DA15:r=>new wi(r??{}),DC37:r=>new xi(r??{}),DD50:r=>new vi(r??{}),CoaxConnect:r=>new yi(r??{}),Plug:r=>new Si(r??{}),Jack:r=>new ki(r??{}),ConnectorTerminal:r=>new Mi(r??{}),OutletA:r=>new l0(r??{}),OutletB:r=>new $o(r??{}),OutletC:r=>new h0(r??{}),OutletD:r=>new jo(r??{}),OutletE:r=>new qo(r??{}),OutletF:r=>new Ho(r??{}),OutletG:r=>new Yo(r??{}),OutletH:r=>new c0(r??{}),OutletI:r=>new Xo(r??{}),OutletJ:r=>new Go(r??{}),OutletK:r=>new Wo(r??{}),OutletL:r=>new Vo(r??{}),VacuumTube:r=>new Xr(r??{}),DualVacuumTube:r=>new Uo(r??{}),NixieTube:r=>new Jo(r??{}),TubeDiode:r=>new Ko(r??{}),Triode:r=>new Zo(r??{}),Tetrode:r=>new Qo(r??{}),Pentode:r=>new ea(r??{}),ElementImage:r=>{let{image:e,width:t,height:n,...s}=r??{};return new $s(e,t,n,s)},And:r=>new Bt(r??{}),Or:r=>new $t(r??{}),Buf:r=>new Jt(r??{}),Not:r=>new Kt(r??{}),Tristate:r=>new _n(r??{}),Kmap:r=>new R0(r??{}),BitField:r=>new t0(r??{}),NotNot:r=>new _0(r??{}),Schmitt:r=>new C0(r??{}),SchmittAnd:r=>new n0(r??{}),SchmittNand:r=>Hl(r),SchmittNot:r=>new I0(r??{}),Table:r=>new A0(r),Tgate:r=>new B0(r??{}),TimingDiagram:r=>new e0(r??{}),FlowBox:r=>new hn(r??{}),RoundBox:r=>new Hr(r??{}),Terminal:r=>new ln(r??{}),RoundProcess:r=>new oi(r??{}),Process:r=>new ai(r??{}),Start:r=>new li(r??{}),Subroutine:r=>new Ss(r??{}),Data:r=>new ks(r??{}),Ellipse:r=>new Ms(r??{}),Decision:r=>new zs(r??{}),Connect:r=>new pr(r??{}),Circle:r=>new hi(r??{}),State:r=>new ci(r??{}),StateEnd:r=>new Es(r??{}),DspBox:r=>new sr(r??{}),DspCircle:r=>new Yt(r??{}),Sum:r=>new Ps(r??{}),SumSigma:r=>new Rs(r??{}),Mixer:r=>new Ts(r??{}),DspSpeaker:r=>new As(r??{}),Amp:r=>new cn(r??{}),OscillatorBox:r=>new _s(r??{}),Oscillator:r=>new Bs(r??{}),Filter:r=>new Cs(r??{}),Adc:r=>new Is(r??{}),Dac:r=>new Ls(r??{}),Demod:r=>new Ds(r??{}),Circulator:r=>new Ns(r??{}),Isolator:r=>new Os(r??{}),VGA:r=>new Fs(r??{}),RBox:r=>new mt(r??{}),RBoxVar:r=>new Zt(r??{}),PotBox:r=>new er(r??{}),PhotoresistorBox:r=>new Qt(r??{}),Nand:r=>Pn(r),Nor:r=>Rn(r),Xor:r=>Tn(r),Xnor:r=>An(r)};function Qc(){return Object.keys(Us).sort()}var C1=Qc;function I1(r){let e=Us[r];if(!e)throw new Error(`Unknown element type "${r}". Use getAvailableTypes() to see all available types.`);let t=e();return new lr().add(t),Object.keys(t.absanchors).sort()}function eu(r,e){let t=r.indexOf(".");if(t<0)throw new Error(`Invalid anchor reference "${r}". Expected format "elementId.anchorName"`);let n=r.slice(0,t),s=r.slice(t+1),i=e.get(n);if(!i){let a=[...e.keys()].join(", ")||"(none)";throw new Error(`Element "${n}" not found. Available elements: ${a}`)}let o=i.absanchors[s];if(!o){let a=Object.keys(i.absanchors).join(", ")||"(none)";throw new Error(`Anchor "${s}" not found on element "${n}". Available anchors: ${a}`)}return o.toTuple()}function Ca(r,e){return Array.isArray(r)?r:eu(r,e)}function oh(r,e){return typeof r=="number"?r:eu(r,e)}function ah(r,e){return typeof r=="number"?r:eu(r,e)}var ta={light:{bg:"#ffffff",stroke:"#000000",fill:"none",text:"#000000",font:"sans-serif",lw:2},dark:{bg:"#1a1a2e",stroke:"#c8d6e5",fill:"none",text:"#dfe6e9",font:"sans-serif",lw:2},print:{bg:"#ffffff",stroke:"#333333",fill:"none",text:"#333333",font:"serif",lw:1.5}};function u0(r){if(r===void 0)return{...ta.light};if(typeof r=="string"){let e=ta[r];if(!e)throw new Error(`Unknown theme "${r}". Available: ${Object.keys(ta).join(", ")}`);return{...e}}return{...ta.light,...r}}var L1={bg:"bgcolor",stroke:"color",fill:"fill",font:"font",lw:"lw"};function D1(r,e){let t={};for(let n of Object.keys(L1)){let s=L1[n];s&&(t[s]=r[n])}return{...t,...e}}function lh(r,e){let t=typeof r=="string"?JSON.parse(r):r,n=e?.theme??t.theme,s=n!==void 0?D1(u0(n),t.drawing):{...t.drawing??{}},i=e?.colorTransition??t.drawing?.colorTransition??!1,o={...s,...e?.interactive?{interactive:!0}:{},...i?{colorTransition:!0}:{}},a=new lr(o),l=new Map;for(let h of t.elements){if(h==="push"){a.push();continue}if(h==="pop"){a.pop();continue}let c=Us[h.type];if(!c)throw new Error(`Unknown element type "${h.type}". Use getAvailableTypes() to see all available types.`);let m=c(h.params);if(h.d)switch(h.d){case"up":m.up();break;case"down":m.down();break;case"left":m.left();break;case"right":m.right();break}if(h.theta!==void 0&&m.theta(h.theta),h.at!==void 0&&m.at(Ca(h.at,l)),h.anchor&&m.anchor(h.anchor),h.flip&&m.flip(),h.reverse&&m.reverse(),h.scale!==void 0&&m.scale(h.scale),m instanceof se&&(h.to!==void 0&&m.to(Ca(h.to,l)),h.tox!==void 0&&m.tox(oh(h.tox,l)),h.toy!==void 0&&m.toy(ah(h.toy,l)),h.l!==void 0&&m.length(h.l),h.dot&&m.dot(h.dot==="open"),h.idot&&m.idot(h.idot==="open")),h.label)if(typeof h.label=="string")m.label(h.label);else{let{text:f,...g}=h.label;m.label(f,g)}if(h.labels)for(let f of h.labels){let{text:g,...b}=f;m.label(g,b)}h.color&&m.color(h.color),h.fill&&m.fill(h.fill),h.lw!==void 0&&m.linewidth(h.lw),h.ls&&m.linestyle(h.ls),a.add(m),h.id&&(l.set(h.id,m),e?.interactive&&a.setElementMeta(m,{id:h.id,type:h.type,tooltip:h.tooltip??`${h.id} \u2014 ${h.type}`}))}return a.toSvgString()}function N1(r){let e=[],t;if(typeof r=="string")try{t=JSON.parse(r)}catch(i){return{valid:!1,errors:[{path:"",message:`Invalid JSON: ${i.message}`}]}}else t=r;if(!t.elements||!Array.isArray(t.elements))return e.push({path:"elements",message:'"elements" must be an array'}),{valid:!1,errors:e};let n=new Set,s=0;for(let i=0;i<t.elements.length;i++){let o=t.elements[i],a=`elements[${i}]`;if(typeof o=="string"){o==="push"?s++:o==="pop"?(s--,s<0&&(e.push({path:a,message:'"pop" without matching "push"'}),s=0)):e.push({path:a,message:`Invalid control instruction "${o}". Expected "push" or "pop"`});continue}if(typeof o!="object"||o===null){e.push({path:a,message:'Element must be an object or "push"/"pop" string'});continue}let l=o;if(!l.type||typeof l.type!="string"){e.push({path:`${a}.type`,message:'"type" is required and must be a string'});continue}Us[l.type]||e.push({path:`${a}.type`,message:`Unknown element type "${l.type}"`}),l.d&&!["up","down","left","right"].includes(l.d)&&e.push({path:`${a}.d`,message:`Invalid direction "${l.d}". Expected "up", "down", "left", or "right"`});for(let h of["at","to","tox","toy"]){let c=l[h];if(typeof c=="string"&&c.includes(".")){let m=c.slice(0,c.indexOf("."));n.has(m)||e.push({path:`${a}.${h}`,message:`Element "${m}" referenced before definition`})}else typeof c=="string"&&!c.includes(".")&&e.push({path:`${a}.${h}`,message:`Invalid anchor reference "${c}". Expected format "elementId.anchorName"`})}l.id&&n.add(l.id)}return s>0&&e.push({path:"elements",message:`${s} unmatched "push" without "pop"`}),{valid:e.length===0,errors:e}}var ra="data-sd-original-style",tu="path,polyline,polygon,circle,ellipse,line";function E2(r){r.hasAttribute(ra)||r.setAttribute(ra,r.getAttribute("style")??"")}function O1(r){let e=r.getAttribute(ra);e!==null?(r.setAttribute("style",e),r.removeAttribute(ra)):r.style.removeProperty("stroke")}var Ia=class{constructor(e,t,n){z(this,"_container");z(this,"_json");z(this,"_opts");z(this,"_svg");z(this,"_elementMap",new Map);z(this,"_listeners",new Map);z(this,"_selectedId",null);z(this,"_theme");z(this,"_destroyed",!1);z(this,"_tooltipEl",null);z(this,"_boundClick");z(this,"_boundMouseover");z(this,"_boundMouseout");z(this,"_boundContextmenu");z(this,"_boundMousemove");this._container=e,this._json=t,this._opts={...n,interactive:!0},this._theme=u0(n.theme??this._json.theme),this._boundClick=this._onClick.bind(this),this._boundMouseover=this._onMouseover.bind(this),this._boundMouseout=this._onMouseout.bind(this),this._boundContextmenu=this._onContextmenu.bind(this),this._boundMousemove=this._onMousemove.bind(this),this._render(),this._bindEvents(),this._initTooltip()}_render(){let e=lh(this._json,this._opts);this._container.innerHTML=e;let t=this._container.querySelector("svg");if(!t)throw new Error("Failed to render SVG from circuit JSON.");this._svg=t,this._svg.querySelectorAll("g.sd-el > title").forEach(o=>o.remove()),this._elementMap.clear();let n=this._svg.querySelectorAll("g.sd-el[data-id]"),s=new Map;for(let o of this._json.elements)o!=="push"&&o!=="pop"&&o.id&&s.set(o.id,o);let i="http://www.w3.org/2000/svg";n.forEach(o=>{let a=o.getAttribute("data-id"),l=o.getAttribute("data-type")??"",h=o.getAttribute("data-tooltip")??void 0,c=o.getBBox(),m=document.createElementNS(i,"rect");m.setAttribute("x",String(c.x)),m.setAttribute("y",String(c.y)),m.setAttribute("width",String(c.width)),m.setAttribute("height",String(c.height)),m.setAttribute("fill","transparent"),m.setAttribute("stroke","none"),o.prepend(m);let f=s.get(a)??{type:l,id:a};this._elementMap.set(a,{info:{id:a,type:l,tooltip:h,bbox:{x:c.x,y:c.y,width:c.width,height:c.height},anchors:{},element:o,spec:f},spec:f})})}_initTooltip(){let e=document.createElement("div");e.style.cssText="position:fixed;z-index:99999;pointer-events:none;opacity:0;transition:opacity .12s ease;background:rgba(30,30,30,.92);color:#fff;font-size:12px;line-height:1.4;padding:5px 10px;border-radius:4px;max-width:260px;white-space:pre-wrap;box-shadow:0 2px 8px rgba(0,0,0,.25)",document.body.appendChild(e),this._tooltipEl=e}_showTooltip(e,t,n){let s=this._tooltipEl;if(!s)return;s.textContent=e,s.style.opacity="1";let i=10,o=window.innerWidth,a=window.innerHeight;s.style.left="0",s.style.top="0";let l=s.getBoundingClientRect(),h=t+i,c=n+i;h+l.width>o&&(h=t-l.width-i),c+l.height>a&&(c=n-l.height-i),s.style.left=`${h}px`,s.style.top=`${c}px`}_hideTooltip(){this._tooltipEl&&(this._tooltipEl.style.opacity="0")}_bindEvents(){this._svg.addEventListener("click",this._boundClick),this._svg.addEventListener("mouseover",this._boundMouseover),this._svg.addEventListener("mouseout",this._boundMouseout),this._svg.addEventListener("mousemove",this._boundMousemove),this._svg.addEventListener("contextmenu",this._boundContextmenu)}_unbindEvents(){this._svg.removeEventListener("click",this._boundClick),this._svg.removeEventListener("mouseover",this._boundMouseover),this._svg.removeEventListener("mouseout",this._boundMouseout),this._svg.removeEventListener("mousemove",this._boundMousemove),this._svg.removeEventListener("contextmenu",this._boundContextmenu)}_closestGroup(e){let t=e.target;return t?t.closest("g.sd-el[data-id]"):null}_svgPoint(e){let t=this._svg.getScreenCTM();if(t){let n=t.inverse();return{x:n.a*e.clientX+n.c*e.clientY+n.e,y:n.b*e.clientX+n.d*e.clientY+n.f,clientX:e.clientX,clientY:e.clientY}}return{x:e.offsetX,y:e.offsetY,clientX:e.clientX,clientY:e.clientY}}_getInfoForGroup(e){let t=e.getAttribute("data-id");if(t)return this._elementMap.get(t)?.info}_onClick(e){let t=this._closestGroup(e);if(t){let n=this._getInfoForGroup(t);if(n){this._emit("element:click",n,e);let s=this._selectedId;this._selectedId=n.id,s&&s!==n.id&&this._clearSelectedClass(s),t.classList.add("sd-selected"),this._emit("element:select",n,e)}}else this._selectedId&&(this._clearSelectedClass(this._selectedId),this._selectedId=null,this._emit("element:select",null,e)),this._emit("canvas:click",this._svgPoint(e),e)}_onMouseover(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:hover",s,e),s.tooltip&&this._showTooltip(s.tooltip,e.clientX,e.clientY))}_onMousemove(e){let t=this._closestGroup(e);if(t){let n=t.getAttribute("data-tooltip");n&&this._showTooltip(n,e.clientX,e.clientY)}else this._hideTooltip()}_onMouseout(e){let t=this._closestGroup(e);if(!t)return;let n=e.relatedTarget;if(n&&t.contains(n))return;let s=this._getInfoForGroup(t);s&&(this._emit("element:leave",s,e),this._hideTooltip())}_onContextmenu(e){this._emit("canvas:contextmenu",this._svgPoint(e),e)}_clearSelectedClass(e){let t=this._elementMap.get(e);t&&(t.info.element.classList.remove("sd-selected"),t.info.element.style.removeProperty("--sd-highlight"),t.info.element.querySelectorAll(tu).forEach(n=>{let s=n;s.hasAttribute(ra)&&O1(s)}))}_emit(e,...t){let n=this._listeners.get(e);if(n)for(let s of n)try{s(...t)}catch{}}on(e,t){return this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t),this}off(e,t){return t?this._listeners.get(e)?.delete(t):this._listeners.delete(e),this}highlight(e,t){let n=this._elementMap.get(e);n&&(n.info.element.classList.add("sd-selected"),t&&(n.info.element.style.setProperty("--sd-highlight",t),n.info.element.querySelectorAll(tu).forEach(s=>{let i=s;E2(i),i.style.setProperty("stroke",t)})))}clearHighlight(){this._svg.querySelectorAll("g.sd-selected").forEach(t=>{t.classList.remove("sd-selected"),t.style.removeProperty("--sd-highlight"),t.querySelectorAll(tu).forEach(n=>{let s=n;s.hasAttribute(ra)&&O1(s)})}),this._selectedId=null}setTheme(e){this._opts={...this._opts,theme:e},this._theme=u0(e),this.update(this._json)}update(e){let t=typeof e=="string"?JSON.parse(e):e;this._json=t,this._unbindEvents(),this._render(),this._bindEvents(),this._selectedId=null}destroy(){this._destroyed||(this._destroyed=!0,this._unbindEvents(),this._tooltipEl&&(this._tooltipEl.remove(),this._tooltipEl=null),this._container.innerHTML="",this._elementMap.clear(),this._listeners.clear())}get svgElement(){return this._svg}getElementInfo(e){return this._elementMap.get(e)?.info}getAllElements(){return[...this._elementMap.values()].map(e=>e.info)}getDrawingInfo(){let e=this._svg.getAttribute("viewBox")??"",t=this._svg.width.baseVal.value||parseFloat(this._svg.getAttribute("width")??"0"),n=this._svg.height.baseVal.value||parseFloat(this._svg.getAttribute("height")??"0");return{width:t,height:n,viewBox:e,theme:this._theme,elementCount:this._json.elements.filter(s=>s!=="push"&&s!=="pop").length,namedElementCount:this._elementMap.size}}};function F1(r,e,t){if(typeof document>"u")throw new Error("mountFromJson requires a browser environment with DOM access.");let n=typeof e=="string"?JSON.parse(e):e;return new Ia(r,n,t??{})}return Q1(P2);})();
|
|
273
|
-
//# sourceMappingURL=circuit.bundle.min.js.map
|
package/dist/circuit.esm.js
CHANGED
|
@@ -31066,4 +31066,3 @@ export {
|
|
|
31066
31066
|
xnor,
|
|
31067
31067
|
xor
|
|
31068
31068
|
};
|
|
31069
|
-
//# sourceMappingURL=circuit.esm.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export type SchemdrawStyle = {
|
|
|
23
23
|
export declare function config(partial: Partial<SchemdrawStyle>): void;
|
|
24
24
|
export declare function getGlobalStyle(): Readonly<SchemdrawStyle>;
|
|
25
25
|
export declare function resetConfigForTests(): void;
|
|
26
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/container.d.ts
CHANGED
|
@@ -29,4 +29,3 @@ export declare class Container extends Element {
|
|
|
29
29
|
}
|
|
30
30
|
/** Parent for {@link Container} — {@link Drawing} or nested {@link Container} (Python `Union[Drawing, Container]`). */
|
|
31
31
|
export type ContainerParent = Drawing | Container;
|
|
32
|
-
//# sourceMappingURL=container.d.ts.map
|
package/dist/drawing-stack.d.ts
CHANGED
|
@@ -13,4 +13,3 @@ export declare function swapPause(value: boolean): boolean;
|
|
|
13
13
|
export declare function pushDrawing(drawing: DrawingLike): void;
|
|
14
14
|
export declare function popDrawing(drawing: DrawingLike): void;
|
|
15
15
|
export declare function pushElement(element: Element | null): void;
|
|
16
|
-
//# sourceMappingURL=drawing-stack.d.ts.map
|
package/dist/drawing.d.ts
CHANGED
|
@@ -114,4 +114,3 @@ export declare class Drawing {
|
|
|
114
114
|
}
|
|
115
115
|
/** Run `fn` with drawing stack (implicit `add` for elements created inside). */
|
|
116
116
|
export declare function withDrawing(fn: (d: Drawing) => void, opts?: Partial<SchemdrawStyle>): Drawing;
|
|
117
|
-
//# sourceMappingURL=drawing.d.ts.map
|
package/dist/element-label.d.ts
CHANGED
|
@@ -51,4 +51,3 @@ export declare function placeElementLabels(el: Element, thetaDeg: number, specs:
|
|
|
51
51
|
/** Build `ElementLabelSpec[]` from constructor params (Python `toplabel` / `label` / …). */
|
|
52
52
|
export declare function buildLabelSpecsFromParams(params: Record<string, unknown>, _thetaDeg: number): ElementLabelSpec[];
|
|
53
53
|
export {};
|
|
54
|
-
//# sourceMappingURL=element-label.d.ts.map
|
package/dist/element-style.d.ts
CHANGED
|
@@ -31,4 +31,3 @@ export declare let Fuse: (typeof STYLE_IEEE)["Fuse"] | (typeof STYLE_IEC)["Fuse"
|
|
|
31
31
|
export declare function setElementStyle(style: Partial<Record<keyof typeof STYLE_IEEE, StyledElementCtor>>): void;
|
|
32
32
|
/** Restore IEEE defaults (for tests). */
|
|
33
33
|
export declare function resetElementStyleForTests(): void;
|
|
34
|
-
//# sourceMappingURL=element-style.d.ts.map
|
package/dist/element.d.ts
CHANGED
package/dist/element2term.d.ts
CHANGED
package/dist/elements/diode.d.ts
CHANGED