@tscircuit/runframe 0.0.712 → 0.0.714
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/preview.js
CHANGED
package/dist/runner.js
CHANGED
|
@@ -13238,7 +13238,7 @@ ${P.type}: ${se}
|
|
|
13238
13238
|
* Copyright (c) 2015 Jon Schlinkert, contributors.
|
|
13239
13239
|
* Licensed under the MIT license.
|
|
13240
13240
|
*/var Zue,nze;function TJt(){if(nze)return Zue;nze=1;var r=eze(),e=NJt();return Zue=function t(n,i){var a=r(n);if(a!=="object"&&a!=="array")throw new Error("expected an object");var o=[];a==="object"&&(n=e(n,i),o={});for(var s in n)if(n.hasOwnProperty(s)){var l=n[s];r(l)==="object"||r(l)==="array"?o[s]=t(l,i):o[s]=l}return o},Zue}TJt();var que={exports:{}},rze;function PJt(){return rze||(rze=1,function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(o,s,l){this.fn=o,this.context=s,this.once=l||!1}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var s=[],l,c;if(this._eventsCount===0)return s;for(c in l=this._events)e.call(l,c)&&s.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(l)):s},a.prototype.listeners=function(s,l){var c=t?t+s:s,u=this._events[c];if(l)return!!u;if(!u)return[];if(u.fn)return[u.fn];for(var A=0,d=u.length,h=new Array(d);A<d;A++)h[A]=u[A].fn;return h},a.prototype.emit=function(s,l,c,u,A,d){var h=t?t+s:s;if(!this._events[h])return!1;var m=this._events[h],C=arguments.length,E,_;if(m.fn){switch(m.once&&this.removeListener(s,m.fn,void 0,!0),C){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,l),!0;case 3:return m.fn.call(m.context,l,c),!0;case 4:return m.fn.call(m.context,l,c,u),!0;case 5:return m.fn.call(m.context,l,c,u,A),!0;case 6:return m.fn.call(m.context,l,c,u,A,d),!0}for(_=1,E=new Array(C-1);_<C;_++)E[_-1]=arguments[_];m.fn.apply(m.context,E)}else{var B=m.length,w;for(_=0;_<B;_++)switch(m[_].once&&this.removeListener(s,m[_].fn,void 0,!0),C){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,l);break;case 3:m[_].fn.call(m[_].context,l,c);break;case 4:m[_].fn.call(m[_].context,l,c,u);break;default:if(!E)for(w=1,E=new Array(C-1);w<C;w++)E[w-1]=arguments[w];m[_].fn.apply(m[_].context,E)}}return!0},a.prototype.on=function(s,l,c){var u=new i(l,c||this),A=t?t+s:s;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],u]:this._events[A].push(u):(this._events[A]=u,this._eventsCount++),this},a.prototype.once=function(s,l,c){var u=new i(l,c||this,!0),A=t?t+s:s;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],u]:this._events[A].push(u):(this._events[A]=u,this._eventsCount++),this},a.prototype.removeListener=function(s,l,c,u){var A=t?t+s:s;if(!this._events[A])return this;if(!l)return--this._eventsCount===0?this._events=new n:delete this._events[A],this;var d=this._events[A];if(d.fn)d.fn===l&&(!u||d.once)&&(!c||d.context===c)&&(--this._eventsCount===0?this._events=new n:delete this._events[A]);else{for(var h=0,m=[],C=d.length;h<C;h++)(d[h].fn!==l||u&&!d[h].once||c&&d[h].context!==c)&&m.push(d[h]);m.length?this._events[A]=m.length===1?m[0]:m:--this._eventsCount===0?this._events=new n:delete this._events[A]}return this},a.prototype.removeAllListeners=function(s){var l;return s?(l=t?t+s:s,this._events[l]&&(--this._eventsCount===0?this._events=new n:delete this._events[l])):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prototype.setMaxListeners=function(){return this},a.prefixed=t,a.EventEmitter=a,r.exports=a}(que)),que.exports}var Xue={exports:{}},ize;function kJt(){return ize||(ize=1,function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(o,s,l){this.fn=o,this.context=s,this.once=l||!1}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var s=[],l,c;if(this._eventsCount===0)return s;for(c in l=this._events)e.call(l,c)&&s.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(l)):s},a.prototype.listeners=function(s,l){var c=t?t+s:s,u=this._events[c];if(l)return!!u;if(!u)return[];if(u.fn)return[u.fn];for(var A=0,d=u.length,h=new Array(d);A<d;A++)h[A]=u[A].fn;return h},a.prototype.emit=function(s,l,c,u,A,d){var h=t?t+s:s;if(!this._events[h])return!1;var m=this._events[h],C=arguments.length,E,_;if(m.fn){switch(m.once&&this.removeListener(s,m.fn,void 0,!0),C){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,l),!0;case 3:return m.fn.call(m.context,l,c),!0;case 4:return m.fn.call(m.context,l,c,u),!0;case 5:return m.fn.call(m.context,l,c,u,A),!0;case 6:return m.fn.call(m.context,l,c,u,A,d),!0}for(_=1,E=new Array(C-1);_<C;_++)E[_-1]=arguments[_];m.fn.apply(m.context,E)}else{var B=m.length,w;for(_=0;_<B;_++)switch(m[_].once&&this.removeListener(s,m[_].fn,void 0,!0),C){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,l);break;case 3:m[_].fn.call(m[_].context,l,c);break;case 4:m[_].fn.call(m[_].context,l,c,u);break;default:if(!E)for(w=1,E=new Array(C-1);w<C;w++)E[w-1]=arguments[w];m[_].fn.apply(m[_].context,E)}}return!0},a.prototype.on=function(s,l,c){var u=new i(l,c||this),A=t?t+s:s;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],u]:this._events[A].push(u):(this._events[A]=u,this._eventsCount++),this},a.prototype.once=function(s,l,c){var u=new i(l,c||this,!0),A=t?t+s:s;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],u]:this._events[A].push(u):(this._events[A]=u,this._eventsCount++),this},a.prototype.removeListener=function(s,l,c,u){var A=t?t+s:s;if(!this._events[A])return this;if(!l)return--this._eventsCount===0?this._events=new n:delete this._events[A],this;var d=this._events[A];if(d.fn)d.fn===l&&(!u||d.once)&&(!c||d.context===c)&&(--this._eventsCount===0?this._events=new n:delete this._events[A]);else{for(var h=0,m=[],C=d.length;h<C;h++)(d[h].fn!==l||u&&!d[h].once||c&&d[h].context!==c)&&m.push(d[h]);m.length?this._events[A]=m.length===1?m[0]:m:--this._eventsCount===0?this._events=new n:delete this._events[A]}return this},a.prototype.removeAllListeners=function(s){var l;return s?(l=t?t+s:s,this._events[l]&&(--this._eventsCount===0?this._events=new n:delete this._events[l])):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prototype.setMaxListeners=function(){return this},a.prefixed=t,a.EventEmitter=a,r.exports=a}(Xue)),Xue.exports}var $ue,aze;function UJt(){if(aze)return $ue;aze=1;function r(c,u,A){return u in c?Object.defineProperty(c,u,{value:A,enumerable:!0,configurable:!0,writable:!0}):c[u]=A,c}var e=kJt(),t=function(){},n={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},i={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},a={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},o={" ":i.space," ":i.space,"\n":i.space,"\r":i.space,"<":i.lt,">":i.gt,'"':i.quote,"'":i.quote,"=":i.equal,"/":i.slash},s=function(u){return o[u]||i.char},l=function(u){var A,d,h,m,C,E,_,B,w,P;u=Object.assign({debug:!1},u);var O=new e,G=n.data,Y="",K="",Z="",V="",se="",ie="",de=function(fe,Ie){if(!(K[0]==="?"||K[0]==="!")){var ye={type:fe,value:Ie};u.debug&&console.log("emit:",ye),O.emit("data",ye)}};O.stateMachine=(P={},r(P,n.data,(A={},r(A,i.lt,function(){Y.trim()&&de(a.text,Y),K="",se=!1,G=n.tagBegin}),r(A,i.char,function(xe){Y+=xe}),A)),r(P,n.cdata,r({},i.char,function(xe){Y+=xe,Y.substr(-3)==="]]>"&&(de(a.text,Y.slice(0,-3)),Y="",G=n.data)})),r(P,n.tagBegin,(d={},r(d,i.space,t),r(d,i.char,function(xe){K=xe,G=n.tagName}),r(d,i.slash,function(){K="",se=!0}),d)),r(P,n.tagName,(h={},r(h,i.space,function(){se?G=n.tagEnd:(G=n.attributeNameStart,de(a.openTag,K))}),r(h,i.gt,function(){de(se?a.closeTag:a.openTag,K),Y="",G=n.data}),r(h,i.slash,function(){G=n.tagEnd,de(a.openTag,K)}),r(h,i.char,function(xe){K+=xe,K==="![CDATA["&&(G=n.cdata,Y="",K="")}),h)),r(P,n.tagEnd,(m={},r(m,i.gt,function(){de(a.closeTag,K),Y="",G=n.data}),r(m,i.char,t),m)),r(P,n.attributeNameStart,(C={},r(C,i.char,function(xe){Z=xe,G=n.attributeName}),r(C,i.gt,function(){Y="",G=n.data}),r(C,i.space,t),r(C,i.slash,function(){se=!0,G=n.tagEnd}),C)),r(P,n.attributeName,(E={},r(E,i.space,function(){G=n.attributeNameEnd}),r(E,i.equal,function(){de(a.attributeName,Z),G=n.attributeValueBegin}),r(E,i.gt,function(){V="",de(a.attributeName,Z),de(a.attributeValue,V),Y="",G=n.data}),r(E,i.slash,function(){se=!0,V="",de(a.attributeName,Z),de(a.attributeValue,V),G=n.tagEnd}),r(E,i.char,function(xe){Z+=xe}),E)),r(P,n.attributeNameEnd,(_={},r(_,i.space,t),r(_,i.equal,function(){de(a.attributeName,Z),G=n.attributeValueBegin}),r(_,i.gt,function(){V="",de(a.attributeName,Z),de(a.attributeValue,V),Y="",G=n.data}),r(_,i.char,function(xe){V="",de(a.attributeName,Z),de(a.attributeValue,V),Z=xe,G=n.attributeName}),_)),r(P,n.attributeValueBegin,(B={},r(B,i.space,t),r(B,i.quote,function(xe){ie=xe,V="",G=n.attributeValue}),r(B,i.gt,function(){V="",de(a.attributeValue,V),Y="",G=n.data}),r(B,i.char,function(xe){ie="",V=xe,G=n.attributeValue}),B)),r(P,n.attributeValue,(w={},r(w,i.space,function(xe){ie?V+=xe:(de(a.attributeValue,V),G=n.attributeNameStart)}),r(w,i.quote,function(xe){ie===xe?(de(a.attributeValue,V),G=n.attributeNameStart):V+=xe}),r(w,i.gt,function(xe){ie?V+=xe:(de(a.attributeValue,V),Y="",G=n.data)}),r(w,i.slash,function(xe){ie?V+=xe:(de(a.attributeValue,V),se=!0,G=n.tagEnd)}),r(w,i.char,function(xe){V+=xe}),w)),P);var Ce=function(fe){u.debug&&console.log(G,fe);var Ie=O.stateMachine[G],ye=Ie[s(fe)]||Ie[i.error]||Ie[i.char];ye(fe)};return O.write=function(xe){for(var fe=xe.length,Ie=0;Ie<fe;Ie++)Ce(xe[Ie])},O};return $ue={State:n,Action:i,Type:a,create:l},$ue}var eAe,oze;function FJt(){if(oze)return eAe;oze=1;var r=PJt(),e=UJt(),t=e.Type,n={element:"element",text:"text"},i=function(l){return Object.assign({name:"",type:n.element,value:"",parent:null,attributes:{},children:[]},l)},a=function(l){l=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},l);var c=void 0,u=void 0,A=void 0,d=void 0,h=new r,m=function(E){switch(E.type){case t.openTag:if(A===null)A=u,A.name=E.value;else{var _=i({name:E.value,parent:A});A.children.push(_),A=_}break;case t.closeTag:var B=A.parent;if(l.parentNodes||(A.parent=null),A.name!==E.value)break;l.stream&&B===u&&(u.children=[],A.parent=null),(!l.emitTopLevelOnly||B===u)&&(h.emit(l.tagPrefix+A.name,A),h.emit("tag",A.name,A)),A===u&&(c.removeAllListeners("data"),h.emit(l.doneEvent,A),u=null),A=B;break;case t.text:A&&A.children.push(i({type:n.text,value:E.value,parent:l.parentNodes?A:null}));break;case t.attributeName:d=E.value,A.attributes[d]="";break;case t.attributeValue:A.attributes[d]=E.value;break}};return h.reset=function(){c=e.create({debug:l.debug}),c.on("data",m),u=i(),A=null,d="",h.parse=c.write},h.reset(),h},o=function(l,c){c=Object.assign({},c,{stream:!1,tagPrefix:":"});var u=a(c),A=void 0;return u.on("done",function(d){A=d}),u.parse(l),A};return eAe={parseSync:o,create:a,NodeType:n},eAe}FJt();var LJt=function(e){if(e){var t=String(e);return/[&<>]/.test(t)?"<![CDATA[".concat(t.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):t}return""},GJt=function(e){return String(e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},Az=function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.transformAttr,i=n===void 0?function(h,m,C){return"".concat(h,'="').concat(C(m),'"')}:n,a=t.transformNode,o=a===void 0?function(h){return h}:a,s=t.selfClose,l=s===void 0?!0:s;if(Array.isArray(e))return e.map(function(h){return r(h,{transformAttr:i,selfClose:l,transformNode:o})}).join("");var c=o(e);if(c.type==="text")return LJt(c.value);var u="";for(var A in c.attributes){var d=i(A,c.attributes[A],GJt,c.name);u+=d?" ".concat(d):""}return c.children&&c.children.length>0||!l?"<".concat(c.name).concat(u,">").concat(r(c.children,{transformAttr:i,transformNode:o,selfClose:l}),"</").concat(c.name,">"):"<".concat(c.name).concat(u,"/>")};function OJt(r,e,t){var d;const{transform:n,shouldDrawErrors:i}=t;if(!i)return[];const{pcb_port_ids:a}=r,o=e.find(h=>h.type==="pcb_port"&&h.pcb_port_id===(a==null?void 0:a[0])),s=e.find(h=>h.type==="pcb_port"&&h.pcb_port_id===(a==null?void 0:a[1]));if(!o||!s){const h=(d=r.message)==null?void 0:d.match(/pcb_via\[#?(pcb_via_\d+)\]/),m=h==null?void 0:h[1],C=e.find(E=>E.type==="pcb_via"&&E.pcb_via_id===m);if(C&&C.type==="pcb_via")return zJt(r,C,t);if(r.center){const E=qr(n,{x:r.center.x,y:r.center.y});return[{name:"rect",type:"element",attributes:{x:(E.x-5).toString(),y:(E.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${E.x} ${E.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:E.x.toString(),y:(E.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:r.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}else return[]}const l=qr(n,{x:o.x,y:o.y}),c=qr(n,{x:s.x,y:s.y}),u={x:(l.x+c.x)/2,y:(l.y+c.y)/2};return isNaN(l.x)||isNaN(l.y)||isNaN(c.x)||isNaN(c.y)||isNaN(u.x)||isNaN(u.y)?[]:[{name:"line",type:"element",attributes:{x1:l.x.toString(),y1:l.y.toString(),x2:u.x.toString(),y2:u.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"line",type:"element",attributes:{x1:u.x.toString(),y1:u.y.toString(),x2:c.x.toString(),y2:c.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"rect",type:"element",attributes:{x:(u.x-5).toString(),y:(u.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${u.x} ${u.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:u.x.toString(),y:(u.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:r.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}function zJt(r,e,t){const{transform:n}=t;if(r.center&&e){const i=qr(n,{x:r.center.x,y:r.center.y}),a=qr(n,{x:e.x,y:e.y}),o=a.x-i.x,s=a.y-i.y,l=Math.sqrt(o*o+s*s),c=Math.atan2(s,o)*180/Math.PI,A=l+10*2,d=20,h=(i.x+a.x)/2,m=(i.y+a.y)/2;return[{name:"rect",type:"element",attributes:{x:(h-A/2).toString(),y:(m-d/2).toString(),width:A.toString(),height:d.toString(),fill:"none",stroke:"red","stroke-width":"1","stroke-dasharray":"3,2",transform:`rotate(${c} ${h} ${m})`},children:[],value:""},{name:"rect",type:"element",attributes:{x:(h-5).toString(),y:(m-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${h} ${m})`},children:[],value:""},{name:"text",type:"element",attributes:{x:h.toString(),y:(m-d/2-5).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:r.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}return[]}function HJt(r,e){const{transform:t,layer:n}=e;if(!r.route||!Array.isArray(r.route))return[];const i=r.route[0],a=r.route[r.route.length-1],o=i.x===a.x&&i.y===a.y,s=r.route.slice(0,o?-1:void 0).map((l,c)=>{const[u,A]=qr(t,[l.x,l.y]);return c===0?`M ${u} ${A}`:`L ${u} ${A}`}).join(" ")+(o?" Z":"");return[{name:"path",type:"element",attributes:{class:"pcb-fabrication-note-path",stroke:r.color||"rgba(255,255,255,0.5)",fill:"none",d:s,"stroke-width":(r.stroke_width*Math.abs(t.a)).toString(),"data-pcb-component-id":r.pcb_component_id,"data-pcb-fabrication-note-path-id":r.pcb_fabrication_note_path_id},value:"",children:[]}]}function YJt(r,e){const{transform:t,layer:n}=e,{anchor_position:i,anchor_alignment:a,text:o,font_size:s=1,layer:l="top",color:c}=r;if(n&&l!==n)return[];if(!i||typeof i.x!="number"||typeof i.y!="number")return console.error("Invalid anchor_position:",i),[];const[u,A]=qr(t,[i.x,i.y]),d=s*Math.abs(t.a),h=tA(df(u,A),SB(Math.PI/180));return[{name:"text",type:"element",attributes:{x:"0",y:"0","font-family":"Arial, sans-serif","font-size":d.toString(),"text-anchor":"middle","dominant-baseline":"central",transform:n2(h),class:"pcb-fabrication-note-text",fill:c||"rgba(255,255,255,0.5)"},children:[{type:"text",value:o,name:"",attributes:{},children:[]}],value:""}]}function VJt(r,e){const{transform:t,colorMap:n}=e,[i,a]=qr(t,[r.x,r.y]);if(r.shape==="pill"){const o=r.outer_width*Math.abs(t.a),s=r.outer_height*Math.abs(t.a),l=r.hole_width*Math.abs(t.a),c=r.hole_height*Math.abs(t.a),u=o/2,A=l/2,d=s-o;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,d:`M${i-u},${a-d/2} v${d} a${u},${u} 0 0 0 ${o},0 v-${d} a${u},${u} 0 0 0 -${o},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,d:`M${i-A},${a-(c-l)/2} v${c-l} a${A},${A} 0 0 0 ${l},0 v-${c-l} a${A},${A} 0 0 0 -${l},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circle"){const o=r.outer_diameter*Math.abs(t.a),s=r.outer_diameter*Math.abs(t.a),l=r.hole_diameter*Math.abs(t.a),c=r.hole_diameter*Math.abs(t.a),u=Math.min(o,s)/2,A=Math.min(l,c)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:i.toString(),cy:a.toString(),r:u.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:i.toString(),cy:a.toString(),r:A.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circular_hole_with_rect_pad"){const o=r.hole_diameter*Math.abs(t.a),s=r.rect_pad_width*Math.abs(t.a),l=r.rect_pad_height*Math.abs(t.a),c=o/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:n.copper.top,x:(i-s/2).toString(),y:(a-l/2).toString(),width:s.toString(),height:l.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:i.toString(),cy:a.toString(),r:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="pill_hole_with_rect_pad"){const o=r.rect_pad_width*Math.abs(t.a),s=r.rect_pad_height*Math.abs(t.a),l=r.hole_height*Math.abs(t.a),c=r.hole_width*Math.abs(t.a),u=Math.min(l,c)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:n.copper.top,x:(i-o/2).toString(),y:(a-s/2).toString(),width:o.toString(),height:s.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,x:(i-c/2).toString(),y:(a-l/2).toString(),width:c.toString(),height:l.toString(),rx:u.toString(),ry:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}function KJt(r,e){const{transform:t,layer:n,colorMap:i}=e;if(!r.route||!Array.isArray(r.route))return[];let a=r.route.map((u,A)=>{const[d,h]=qr(t,[u.x,u.y]);return A===0?`M ${d} ${h}`:`L ${d} ${h}`}).join(" ");const o=r.route[0],s=r.route[r.route.length-1];o&&s&&o.x===s.x&&o.y===s.y&&(a+=" Z");const l=r.layer||"top";if(n&&l!==n)return[];const c=l==="bottom"?i.silkscreen.bottom:i.silkscreen.top;return[{name:"path",type:"element",attributes:{class:`pcb-silkscreen pcb-silkscreen-${l}`,d:a,fill:"none",stroke:c,"stroke-width":(r.stroke_width*Math.abs(t.a)).toString(),"stroke-linecap":"round","stroke-linejoin":"round","data-pcb-component-id":r.pcb_component_id,"data-pcb-silkscreen-path-id":r.pcb_silkscreen_path_id},value:"",children:[]}]}function jJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{anchor_position:a,text:o,font_size:s=1,layer:l="top",ccw_rotation:c=0,anchor_alignment:u="center"}=r;if(n&&l!==n)return[];if(!a||typeof a.x!="number"||typeof a.y!="number")return console.error("Invalid anchor_position:",a),[];const[A,d]=qr(t,[a.x,a.y]),h=s*Math.abs(t.a);let m="middle",C="central",E=0,_=0;switch(u){case"top_left":m="start",C="text-before-edge";break;case"top_center":m="middle",C="text-before-edge";break;case"top_right":m="end",C="text-before-edge";break;case"center_left":m="start",C="central";break;case"center_right":m="end",C="central";break;case"bottom_left":m="start",C="text-after-edge";break;case"bottom_center":m="middle",C="text-after-edge";break;case"bottom_right":m="end",C="text-after-edge";break;case"center":default:m="middle",C="central";break}const B=tA(df(A,d),SB(c*Math.PI/180),...l==="bottom"?[PE(-1,1)]:[]),w=l==="bottom"?i.silkscreen.bottom:i.silkscreen.top,P=o.split(`
|
|
13241
|
-
`),O=P.length===1?[{type:"text",value:o,name:"",attributes:{},children:[]}]:P.map((Y,K)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...K>0?{dy:h.toString()}:{}},children:[{type:"text",value:Y,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:E.toString(),dy:_.toString(),fill:w,"font-family":"Arial, sans-serif","font-size":h.toString(),"text-anchor":m,"dominant-baseline":C,transform:n2(B),class:`pcb-silkscreen-text pcb-silkscreen-${l}`,"data-pcb-silkscreen-text-id":r.pcb_component_id,stroke:"none"},children:O,value:""}]}function JJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{center:a,width:o,height:s,layer:l="top",pcb_silkscreen_rect_id:c,stroke_width:u,is_filled:A,has_stroke:d,is_stroke_dashed:h}=r;if(n&&l!==n)return[];if(!a||typeof a.x!="number"||typeof a.y!="number"||typeof o!="number"||typeof s!="number")return console.error("Invalid rectangle data:",{center:a,width:o,height:s}),[];const[m,C]=qr(t,[a.x,a.y]),E=o*Math.abs(t.a),_=s*Math.abs(t.d),B=u*Math.abs(t.a),w=l==="bottom"?i.silkscreen.bottom:i.silkscreen.top,P={x:(m-E/2).toString(),y:(C-_/2).toString(),width:E.toString(),height:_.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${l}`,"data-pcb-silkscreen-rect-id":c};P.fill=A?w:"none";let O;if(d===void 0?O=B>0:O=d,O){if(P.stroke=w,P["stroke-width"]=B.toString(),h){const Y=.1*Math.abs(t.a),K=.05*Math.abs(t.a);P["stroke-dasharray"]=`${Y} ${K}`}}else P.stroke="none";return[{name:"rect",type:"element",attributes:P,value:"",children:[]}]}function WJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{center:a,radius:o,layer:s="top",pcb_silkscreen_circle_id:l,stroke_width:c=1}=r;if(n&&s!==n)return[];if(!a||typeof a.x!="number"||typeof a.y!="number"||typeof o!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:a,radius:o}),[];const[u,A]=qr(t,[a.x,a.y]),d=o*Math.abs(t.a),h=c*Math.abs(t.a),m=s==="bottom"?i.silkscreen.bottom:i.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:u.toString(),cy:A.toString(),r:d.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${s}`,stroke:m,"stroke-width":h.toString(),"data-pcb-silkscreen-circle-id":l},value:"",children:[]}]}function ZJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{x1:a,y1:o,x2:s,y2:l,stroke_width:c,layer:u="top",pcb_silkscreen_line_id:A}=r;if(n&&u!==n)return[];if(typeof a!="number"||typeof o!="number"||typeof s!="number"||typeof l!="number")return console.error("Invalid coordinates:",{x1:a,y1:o,x2:s,y2:l}),[];const[d,h]=qr(t,[a,o]),[m,C]=qr(t,[s,l]),E=c*Math.abs(t.a),_=u==="bottom"?i.silkscreen.bottom:i.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:d.toString(),y1:h.toString(),x2:m.toString(),y2:C.toString(),stroke:_,"stroke-width":E.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${u}`,"data-pcb-silkscreen-line-id":A},value:"",children:[]}]}function qJt(r){const e=[];for(let t=0;t<r.length-1;t++)e.push([r[t],r[t+1]]);return e}var sx={copper:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",debugComponent:{fill:null,stroke:null}};sx.drill,sx.silkscreen.top,sx.silkscreen.bottom,sx.copper.top,sx.copper.bottom;function U3(r,e=sx){return e.copper[r]??"white"}var XJt={bottom:"rgb(105, 105, 105)",top:"rgb(105, 105, 105)"};function dz(r){return XJt[r]??"rgb(105, 105, 105)"}function $Jt(r,e){const{transform:t,layer:n,colorMap:i}=e;if(!r.route||!Array.isArray(r.route)||r.route.length<2)return[];const a=qJt(r.route),o=[];for(const[s,l]of a){const c=qr(t,[s.x,s.y]),u=qr(t,[l.x,l.y]),A="layer"in s?s.layer:"layer"in l?l.layer:null;if(!A||n&&A!==n)continue;const d=i.soldermask[A]??U3(A,i),h="width"in s?s.width:"width"in l?l.width:null,m={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:d,fill:"none",d:`M ${c[0]} ${c[1]} L ${u[0]} ${u[1]}`,"stroke-width":h?(h*Math.abs(t.a)).toString():"0.3","stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-layer":A}};o.push(m)}return o.sort((s,l)=>{const c=s.attributes["data-layer"],u=l.attributes["data-layer"];return c==="bottom"&&u!=="bottom"?-1:c==="top"&&u!=="top"?1:0}),o}function eWt(r,e){const{transform:t,layer:n,colorMap:i}=e;if(n&&r.layer!==n)return[];if(r.shape==="rect"||r.shape==="rotated_rect"){const a=r.width*Math.abs(t.a),o=r.height*Math.abs(t.d),[s,l]=qr(t,[r.x,r.y]);return r.shape==="rotated_rect"&&r.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(-a/2).toString(),y:(-o/2).toString(),width:a.toString(),height:o.toString(),transform:`translate(${s} ${l}) rotate(${-r.ccw_rotation})`,"data-layer":r.layer}}]:[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(s-a/2).toString(),y:(l-o/2).toString(),width:a.toString(),height:o.toString(),"data-layer":r.layer}}]}if(r.shape==="pill"){const a=r.width*Math.abs(t.a),o=r.height*Math.abs(t.d),s=r.radius*Math.abs(t.a),[l,c]=qr(t,[r.x,r.y]);return[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(l-a/2).toString(),y:(c-o/2).toString(),width:a.toString(),height:o.toString(),rx:s.toString(),ry:s.toString(),"data-layer":r.layer}}]}if(r.shape==="circle"){const a=r.radius*Math.abs(t.a),[o,s]=qr(t,[r.x,r.y]);return[{name:"circle",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),cx:o.toString(),cy:s.toString(),r:a.toString(),"data-layer":r.layer}}]}if(r.shape==="polygon"){const a=(r.points??[]).map(o=>qr(t,[o.x,o.y]));return[{name:"polygon",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer),points:a.map(o=>o.join(",")).join(" "),"data-layer":r.layer}}]}return[]}function sze(r,e){const{transform:t,colorMap:n}=e,{width:i,height:a,center:o,outline:s}=r;let l;if(s&&Array.isArray(s)&&s.length>=3)l=s.map((c,u)=>{const[A,d]=qr(t,[c.x,c.y]);return u===0?`M ${A} ${d}`:`L ${A} ${d}`}).join(" ");else{const c=i/2,u=a/2,A=qr(t,[o.x-c,o.y-u]),d=qr(t,[o.x+c,o.y-u]),h=qr(t,[o.x+c,o.y+u]),m=qr(t,[o.x-c,o.y+u]);l=`M ${A[0]} ${A[1]} L ${d[0]} ${d[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`}return l+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:l,fill:"none",stroke:n.boardOutline,"stroke-width":(.1*Math.abs(t.a)).toString()}}]}function tWt(r,e){const{transform:t,colorMap:n}=e,[i,a]=qr(t,[r.x,r.y]),o=r.outer_diameter*Math.abs(t.a),s=r.outer_diameter*Math.abs(t.a),l=r.hole_diameter*Math.abs(t.a),c=r.hole_diameter*Math.abs(t.a),u=Math.min(o,s)/2,A=Math.min(l,c)/2;return{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:i.toString(),cy:a.toString(),r:u.toString()}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:i.toString(),cy:a.toString(),r:A.toString()}}]}}function nWt(r,e){const{transform:t,colorMap:n}=e,[i,a]=qr(t,[r.x,r.y]);if(r.hole_shape==="circle"||r.hole_shape==="square"){const o=r.hole_diameter*Math.abs(t.a),s=o/2;return r.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"pcb-hole",cx:i.toString(),cy:a.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"pcb-hole",x:(i-s).toString(),y:(a-s).toString(),width:o.toString(),height:o.toString(),fill:n.drill},children:[],value:""}]}if(r.hole_shape==="oval"){const o=r.hole_width*Math.abs(t.a),s=r.hole_height*Math.abs(t.a),l=o/2,c=s/2;return[{name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:i.toString(),cy:a.toString(),rx:l.toString(),ry:c.toString(),fill:n.drill},children:[],value:""}]}return[]}var rWt=(r,e)=>{const t=D_(e).pcb_smtpad.get(r);if(t&&"x"in t&&"y"in t)return{x:t.x,y:t.y};const n=D_(e).pcb_plated_hole.get(r);return n&&"x"in n&&"y"in n?{x:n.x,y:n.y}:null},iWt=(r,e,t,n)=>{const i=t.getIdsConnectedToNet(e);let a=null,o=1/0;for(const s of i){const l=rWt(s,n);if(l){const c=r.x-l.x,u=r.y-l.y,A=Math.sqrt(c*c+u*u);A>0&&A<o&&(o=A,a=l)}}return a};function aWt(r,e){const{transform:t}=e,n=vQ(r),i=r.filter(l=>l.type==="pcb_port"),a=r.filter(l=>l.type==="source_trace"),o=[];i.forEach((l,c)=>{const u=l.pcb_port_id;if(!u)return;const A=n.getNetConnectedToId(u);if(!A)return;let d=!1;const h=D_(r).source_port.getWhere({pcb_port_id:u});if(h&&h.source_port_id){const E=h.source_port_id;for(const _ of a)if(Array.isArray(_.connected_source_port_ids)&&_.connected_source_port_ids.includes(E)&&Array.isArray(_.connected_source_net_ids)&&_.connected_source_net_ids.length>0){d=!0;break}}const m={x:l.x,y:l.y},C=iWt(m,A,n,r);C&&o.push({key:`${u}-${c}`,startPoint:m,endPoint:C,isInNet:d})});const s=[];for(const l of o){const c=qr(t,[l.startPoint.x,l.startPoint.y]),u=qr(t,[l.endPoint.x,l.endPoint.y]),A={x1:c[0].toString(),y1:c[1].toString(),x2:u[0].toString(),y2:u[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6"};s.push({name:"line",type:"element",attributes:A,value:"",children:[]})}return s}function oWt(r,e){const{transform:t,colorMap:n}=e;if(r.shape==="rect"){const i=r,[a,o]=qr(t,[i.center.x,i.center.y]),s=i.width*Math.abs(t.a),l=i.height*Math.abs(t.d),c=-(i.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-cutout pcb-cutout-rect",x:(-s/2).toString(),y:(-l/2).toString(),width:s.toString(),height:l.toString(),fill:n.drill,transform:n2(tA(df(a,o),SB(c*Math.PI/180)))},children:[],value:""}]}if(r.shape==="circle"){const i=r,[a,o]=qr(t,[i.center.x,i.center.y]),s=i.radius*Math.abs(t.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:a.toString(),cy:o.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]}if(r.shape==="polygon"){const i=r;return!i.points||i.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:i.points.map(s=>qr(t,[s.x,s.y])).map(s=>`${s[0]},${s[1]}`).join(" "),fill:n.drill},children:[],value:""}]}return[]}function sWt(r,e){var d,h;const{transform:t}=e,{center:n,width:i,height:a,rotation:o=0}=r,[s,l]=qr(t,[n.x,n.y]),c=i*Math.abs(t.a),u=a*Math.abs(t.d),A=`translate(${s}, ${l}) rotate(${-o}) scale(1, -1)`;return!((d=e.colorMap.debugComponent)!=null&&d.fill)&&!((h=e.colorMap.debugComponent)!=null&&h.stroke)?[]:[{name:"g",type:"element",attributes:{transform:A},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-c/2).toString(),y:(-u/2).toString(),width:c.toString(),height:u.toString(),fill:e.colorMap.debugComponent.fill??"transparent",stroke:e.colorMap.debugComponent.stroke??"transparent"}}],value:""}]}function aP(r){const e=r.find(t=>t.type==="project_software_metadata"||t.type==="source_project_metadata");return e==null?void 0:e.software_used_string}var lWt={version:"0.0.171"},oP=lWt.version,lze=["pcb_trace_error","pcb_plated_hole","pcb_fabrication_note_text","pcb_fabrication_note_path","pcb_silkscreen_text","pcb_silkscreen_path","pcb_via","pcb_cutout","pcb_smtpad","pcb_trace","pcb_component","pcb_board"];function cze(r,e){var Ft,et,yt,_t,Ot,Xt,kt,Wn;const t=(e==null?void 0:e.drawPaddingOutsideBoard)??!0,n=e==null?void 0:e.layer,i=e==null?void 0:e.colorOverrides,a={copper:{top:((Ft=i==null?void 0:i.copper)==null?void 0:Ft.top)??sx.copper.top,bottom:((et=i==null?void 0:i.copper)==null?void 0:et.bottom)??sx.copper.bottom},drill:(i==null?void 0:i.drill)??sx.drill,silkscreen:{top:((yt=i==null?void 0:i.silkscreen)==null?void 0:yt.top)??sx.silkscreen.top,bottom:((_t=i==null?void 0:i.silkscreen)==null?void 0:_t.bottom)??sx.silkscreen.bottom},boardOutline:(i==null?void 0:i.boardOutline)??sx.boardOutline,soldermask:{top:((Ot=i==null?void 0:i.soldermask)==null?void 0:Ot.top)??sx.soldermask.top,bottom:((Xt=i==null?void 0:i.soldermask)==null?void 0:Xt.bottom)??sx.soldermask.bottom},debugComponent:{fill:((kt=i==null?void 0:i.debugComponent)==null?void 0:kt.fill)??sx.debugComponent.fill,stroke:((Wn=i==null?void 0:i.debugComponent)==null?void 0:Wn.stroke)??sx.debugComponent.stroke}};let o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,A=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const un of r)if(un.type==="pcb_board")un.outline&&Array.isArray(un.outline)&&un.outline.length>=3?(qe(un.outline),ft(un.outline)):"center"in un&&"width"in un&&"height"in un&&(Ne(un.center,un.width,un.height),nt(un.center,un.width,un.height));else if("x"in un&&"y"in un)Ne({x:un.x,y:un.y},0,0);else if(un.type==="pcb_smtpad"){const Zt=un;Zt.shape==="rect"||Zt.shape==="rotated_rect"||Zt.shape==="pill"?Ne({x:Zt.x,y:Zt.y},Zt.width,Zt.height):Zt.shape==="circle"?Ne({x:Zt.x,y:Zt.y},Zt.radius*2,Zt.radius*2):Zt.shape==="polygon"&&It(Zt.points)}else"route"in un?It(un.route):(un.type==="pcb_silkscreen_text"||un.type==="pcb_silkscreen_rect"||un.type==="pcb_silkscreen_circle"||un.type==="pcb_silkscreen_line")&&Ut(un);const m=t?1:0,C=t||!isFinite(u)?o:u,E=t||!isFinite(A)?s:A,_=t||!isFinite(d)?l:d,B=t||!isFinite(h)?c:h,w=_-C+2*m,P=B-E+2*m;let O=(e==null?void 0:e.width)??800,G=(e==null?void 0:e.height)??600;if(e!=null&&e.matchBoardAspectRatio){const un=d-u,Zt=h-A;if(un>0&&Zt>0){const tr=un/Zt;e!=null&&e.width&&!(e!=null&&e.height)?G=e.width/tr:e!=null&&e.height&&!(e!=null&&e.width)?O=e.height*tr:G=O/tr}}const Y=[];for(const un of r)"route"in un&&un.route!==void 0&&Y.push(un.route);const K=O/w,Z=G/P,V=Math.min(K,Z),se=(O-w*V)/2,ie=(G-P*V)/2,de=tA(df(se-C*V+m*V,G-ie+E*V-m*V),PE(V,-V)),Ce={transform:de,layer:n,shouldDrawErrors:e==null?void 0:e.shouldDrawErrors,drawPaddingOutsideBoard:t,colorMap:a};function xe(un){if(un.type==="pcb_smtpad")return un.layer==="top"||un.layer==="bottom"?un.layer:void 0;if(un.type==="pcb_trace")for(const Zt of un.route??[]){const tr="layer"in Zt&&Zt.layer||"from_layer"in Zt&&Zt.from_layer||"to_layer"in Zt&&Zt.to_layer||void 0;if(tr==="top"||tr==="bottom")return tr}}function fe(un){return un.type==="pcb_trace"||un.type==="pcb_smtpad"}let Ie=r.sort((un,Zt)=>{const tr=xe(un),Nr=xe(Zt);if(fe(un)&&fe(Zt)&&tr!==Nr){if(tr==="top")return 1;if(Nr==="top"||tr==="bottom")return-1;if(Nr==="bottom")return 1}return(lze.indexOf(Zt.type)??9999)-(lze.indexOf(un.type)??9999)}).flatMap(un=>cWt({elm:un,circuitJson:r,ctx:Ce}));for(const un of r)if("stroke_width"in un){String(V*un.stroke_width);break}if(e!=null&&e.shouldDrawRatsNest){const un=aWt(r,Ce);Ie=Ie.concat(un)}const ye=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]},{name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:(e==null?void 0:e.backgroundColor)??"#000",width:O.toString(),height:G.toString()},children:[]}];t&&ye.push(uWt(de,o,s,l,c)),ye.push(...Ie);const Me=aP(r),Qe=oP,Ue={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:O.toString(),height:G.toString(),...Me&&{"data-software-used-string":Me},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":Qe}},value:"",children:ye.filter(un=>un!==null)};try{return Az(Ue)}catch(un){throw console.error("Error stringifying SVG object:",un),un}function Ne(un,Zt,tr){const Nr=Zt/2,cr=tr/2;o=Math.min(o,un.x-Nr),s=Math.min(s,un.y-cr),l=Math.max(l,un.x+Nr),c=Math.max(c,un.y+cr)}function nt(un,Zt,tr){const Nr=Zt/2,cr=tr/2;u=Math.min(u,un.x-Nr),A=Math.min(A,un.y-cr),d=Math.max(d,un.x+Nr),h=Math.max(h,un.y+cr)}function qe(un){for(const Zt of un)o=Math.min(o,Zt.x),s=Math.min(s,Zt.y),l=Math.max(l,Zt.x),c=Math.max(c,Zt.y)}function ft(un){for(const Zt of un)u=Math.min(u,Zt.x),A=Math.min(A,Zt.y),d=Math.max(d,Zt.x),h=Math.max(h,Zt.y)}function It(un){for(const Zt of un)o=Math.min(o,Zt.x),s=Math.min(s,Zt.y),l=Math.max(l,Zt.x),c=Math.max(c,Zt.y)}function Ut(un){if(un.type==="pcb_silkscreen_text")Ne(un.anchor_position,0,0);else if(un.type==="pcb_silkscreen_path")It(un.route);else if(un.type==="pcb_silkscreen_rect")Ne(un.center,un.width,un.height);else if(un.type==="pcb_silkscreen_circle")Ne(un.center,un.radius*2,un.radius*2);else if(un.type==="pcb_silkscreen_line")Ne({x:un.x1,y:un.y1},0,0),Ne({x:un.x2,y:un.y2},0,0);else if(un.type==="pcb_cutout"){const Zt=un;Zt.shape==="rect"?Ne(Zt.center,Zt.width,Zt.height):Zt.shape==="circle"?Ne(Zt.center,Zt.radius*2,Zt.radius*2):Zt.shape==="polygon"&&It(Zt.points)}}}function cWt({elm:r,circuitJson:e,ctx:t}){switch(r.type){case"pcb_trace_error":return OJt(r,e,t).filter(Boolean);case"pcb_component":return sWt(r,t).filter(Boolean);case"pcb_trace":return $Jt(r,t);case"pcb_plated_hole":return VJt(r,t).filter(Boolean);case"pcb_hole":return nWt(r,t);case"pcb_smtpad":return eWt(r,t);case"pcb_silkscreen_text":return jJt(r,t);case"pcb_silkscreen_rect":return JJt(r,t);case"pcb_silkscreen_circle":return WJt(r,t);case"pcb_silkscreen_line":return ZJt(r,t);case"pcb_fabrication_note_path":return HJt(r,t);case"pcb_fabrication_note_text":return YJt(r,t);case"pcb_silkscreen_path":return KJt(r,t);case"pcb_board":return t.drawPaddingOutsideBoard?sze(r,t):[];case"pcb_via":return tWt(r,t);case"pcb_cutout":return oWt(r,t);default:return[]}}function uWt(r,e,t,n,i){const[a,o]=qr(r,[e,t]),[s,l]=qr(r,[n,i]),c=Math.abs(s-a),u=Math.abs(l-o),A=Math.min(a,s),d=Math.min(o,l);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:A.toString(),y:d.toString(),width:c.toString(),height:u.toString()}}}var AWt=cze,fz={fill:"none",stroke:"rgb(0,0,0)",strokeOpacity:"0.8",strokeWidthFactor:.2};function dWt(r,e,t={}){const{width:n,height:i,center:a,outline:o}=r;let s;if(o&&Array.isArray(o)&&o.length>=3)s=o.map((l,c)=>{const[u,A]=qr(e,[l.x,l.y]);return c===0?`M ${u} ${A}`:`L ${u} ${A}`}).join(" ");else{const l=n/2,c=i/2,u=qr(e,[a.x-l,a.y-c]),A=qr(e,[a.x+l,a.y-c]),d=qr(e,[a.x+l,a.y+c]),h=qr(e,[a.x-l,a.y+c]);s=`M ${u[0]} ${u[1]} L ${A[0]} ${A[1]} L ${d[0]} ${d[1]} L ${h[0]} ${h[1]}`}return s+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:s,fill:t.fill??fz.fill,stroke:t.stroke??fz.stroke,"stroke-opacity":t.strokeOpacity??fz.strokeOpacity,"stroke-width":((t.strokeWidthFactor??fz.strokeWidthFactor)*Math.abs(e.a)).toString()}}]}var fWt={pin_number:.15,negated_pin_number:.15*.8,reference_designator:.18,manufacturer_number:.18,net_label:.18,error:.05},F3=(r,e)=>e??fWt[r],QQ=(r,e,t)=>Math.abs(r.a)*F3(e,t);function hWt(r,e){const{elm:t,portPosition:n,name:i,arePinsInterchangeable:a}=r,{transform:o}=e,{center:s,width:l,height:c,rotation:u=0,layer:A="top"}=t;if(!s||typeof l!="number"||typeof c!="number")return null;const[d,h]=qr(o,[s.x,s.y]),[m,C]=qr(o,[n.x,n.y]),E=l*Math.abs(o.a),_=c*Math.abs(o.d),B=C>h,w=m<d,P=[pWt(E,_,u,A),gWt(E,_,i??"")];return a||P.push(mWt(E,_,u,A,B,w)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${d}, ${h}) scale(1, -1)`},children:P}}function pWt(r,e,t,n){const i=r/2,a=e/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:yWt(i,a,t),"stroke-width":.8.toFixed(2),transform:`rotate(${-t})`,"stroke-dasharray":n==="bottom"?"2,2":""},value:"",children:[]}}function gWt(r,e,t,n){const i=Math.min(r,e),l=Math.min(58,Math.max(3,i*.8)),c=e>r;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${l.toFixed(1)}px`,transform:c?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:t||"",name:"",attributes:{},children:[]}],value:""}}function mWt(r,e,t,n,i,a){const o=r/2,s=e/2,l=Math.min(o,s)*.5;let c;return i&&a?c=[[-o,-s],[-o+l,-s],[-o,-s+l]]:i&&!a?c=[[o,-s],[o-l,-s],[o,-s+l]]:!i&&a?c=[[-o,s],[-o+l,s],[-o,s-l]]:c=[[o,s],[o-l,s],[o,s-l]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:c.map(A=>A.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-t})`},value:"",children:[]}}function yWt(r,e,t){const n=(s,l,c)=>{const u=Math.PI/180*c,A=Math.cos(u),d=Math.sin(u);return[s*A-l*d,s*d+l*A]};return`${[[-r,-e],[r,-e],[r,e],[-r,e]].map(([s,l])=>n(s,l,t)).map(([s,l],c)=>c===0?`M${s},${l}`:`L${s},${l}`).join(" ")} Z`}var tAe="rgb(190, 190, 190)";function vWt(r,e){const{transform:t}=e,[n,i]=qr(t,[r.x,r.y]);if(r.hole_shape==="circle"||r.hole_shape==="square"){const a=r.hole_diameter*Math.abs(t.a),o=a/2;return r.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:i.toString(),r:o.toString(),fill:tAe},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(n-o).toString(),y:(i-o).toString(),width:a.toString(),height:a.toString(),fill:tAe},children:[],value:""}]}if(r.hole_shape==="oval"){const a=r.hole_width*Math.abs(t.a),o=r.hole_height*Math.abs(t.a),s=a/2,l=o/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:i.toString(),rx:s.toString(),ry:l.toString(),fill:tAe},children:[],value:""}]}return[]}var hz="rgb(210, 210, 210)",pz="rgb(190, 190, 190)";function IWt(r,e){const{transform:t}=e,[n,i]=qr(t,[r.x,r.y]);if(r.shape==="pill"){const a=r.outer_width*Math.abs(t.a),o=r.outer_height*Math.abs(t.a),s=r.hole_width*Math.abs(t.a),l=r.hole_height*Math.abs(t.a),c=a/2,u=o-a,A=s/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:hz,d:`M${n-c},${i-u/2} v${u} a${c},${c} 0 0 0 ${a},0 v-${u} a${c},${c} 0 0 0 -${a},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,d:`M${n-A},${i-(l-s)/2} v${l-s} a${A},${A} 0 0 0 ${s},0 v-${l-s} a${A},${A} 0 0 0 -${s},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circle"){const a=r.outer_diameter*Math.abs(t.a),o=r.outer_diameter*Math.abs(t.a),s=r.hole_diameter*Math.abs(t.a),l=r.hole_diameter*Math.abs(t.a),c=Math.min(a,o)/2,u=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:hz,cx:n.toString(),cy:i.toString(),r:c.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,cx:n.toString(),cy:i.toString(),r:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circular_hole_with_rect_pad"){const a=r.hole_diameter*Math.abs(t.a),o=r.rect_pad_width*Math.abs(t.a),s=r.rect_pad_height*Math.abs(t.a),l=a/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:hz,x:(n-o/2).toString(),y:(i-s/2).toString(),width:o.toString(),height:s.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,cx:n.toString(),cy:i.toString(),r:l.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="pill_hole_with_rect_pad"){const a=r.rect_pad_width*Math.abs(t.a),o=r.rect_pad_height*Math.abs(t.a),s=r.hole_height*Math.abs(t.a),l=r.hole_width*Math.abs(t.a),c=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:hz,x:(n-a/2).toString(),y:(i-o/2).toString(),width:a.toString(),height:o.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,x:(n-l/2).toString(),y:(i-s/2).toString(),width:l.toString(),height:s.toString(),rx:c.toString(),ry:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}var sP="rgb(210, 210, 210)";function CWt(r,e){const{transform:t}=e;if(r.shape==="rect"||r.shape==="rotated_rect"){const n=r.width*Math.abs(t.a),i=r.height*Math.abs(t.d),[a,o]=qr(t,[r.x,r.y]);return r.shape==="rotated_rect"&&r.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(-n/2).toString(),y:(-i/2).toString(),width:n.toString(),height:i.toString(),transform:`translate(${a} ${o}) rotate(${-r.ccw_rotation})`,"data-layer":r.layer},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(a-n/2).toString(),y:(o-i/2).toString(),width:n.toString(),height:i.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="pill"){const n=r.width*Math.abs(t.a),i=r.height*Math.abs(t.d),a=r.radius*Math.abs(t.a),[o,s]=qr(t,[r.x,r.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(o-n/2).toString(),y:(s-i/2).toString(),width:n.toString(),height:i.toString(),rx:a.toString(),ry:a.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="circle"){const n=r.radius*Math.abs(t.a),[i,a]=qr(t,[r.x,r.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:sP,cx:i.toString(),cy:a.toString(),r:n.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="polygon"){const n=(r.points??[]).map(i=>qr(t,[i.x,i.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:sP,points:n.map(i=>i.join(",")).join(" "),"data-layer":r.layer},value:"",children:[]}]}return[]}var uze=["pcb_component","pcb_smtpad","pcb_hole","pcb_plated_hole","pcb_board"];function Aze(r,e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(const G of r)if(G.type==="pcb_board"){const Y=G.center,K=G.width||0,Z=G.height||0;t=Math.min(t,Y.x-K/2),n=Math.min(n,Y.y-Z/2),i=Math.max(i,Y.x+K/2),a=Math.max(a,Y.y+Z/2)}const o=1,s=i-t+2*o,l=a-n+2*o,c=(e==null?void 0:e.width)??800,u=(e==null?void 0:e.height)??600,A=c/s,d=u/l,h=Math.min(A,d),m=(c-s*h)/2,C=(u-l*h)/2,E=tA(df(m-t*h+o*h,u-C+n*h-o*h),PE(h,-h)),_={transform:E},B=r.sort((G,Y)=>(uze.indexOf(Y.type)??9999)-(uze.indexOf(G.type)??9999)).flatMap(G=>EWt(G,_,r)),w=aP(r),P=oP,O={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:c.toString(),height:u.toString(),...w&&{"data-software-used-string":w},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":P}},value:"",children:[{name:"style",type:"element",children:[{type:"text",value:`
|
|
13241
|
+
`),O=P.length===1?[{type:"text",value:o,name:"",attributes:{},children:[]}]:P.map((Y,K)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...K>0?{dy:h.toString()}:{}},children:[{type:"text",value:Y,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:E.toString(),dy:_.toString(),fill:w,"font-family":"Arial, sans-serif","font-size":h.toString(),"text-anchor":m,"dominant-baseline":C,transform:n2(B),class:`pcb-silkscreen-text pcb-silkscreen-${l}`,"data-pcb-silkscreen-text-id":r.pcb_component_id,stroke:"none"},children:O,value:""}]}function JJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{center:a,width:o,height:s,layer:l="top",pcb_silkscreen_rect_id:c,stroke_width:u,is_filled:A,has_stroke:d,is_stroke_dashed:h}=r;if(n&&l!==n)return[];if(!a||typeof a.x!="number"||typeof a.y!="number"||typeof o!="number"||typeof s!="number")return console.error("Invalid rectangle data:",{center:a,width:o,height:s}),[];const[m,C]=qr(t,[a.x,a.y]),E=o*Math.abs(t.a),_=s*Math.abs(t.d),B=u*Math.abs(t.a),w=l==="bottom"?i.silkscreen.bottom:i.silkscreen.top,P={x:(m-E/2).toString(),y:(C-_/2).toString(),width:E.toString(),height:_.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${l}`,"data-pcb-silkscreen-rect-id":c};P.fill=A?w:"none";let O;if(d===void 0?O=B>0:O=d,O){if(P.stroke=w,P["stroke-width"]=B.toString(),h){const Y=.1*Math.abs(t.a),K=.05*Math.abs(t.a);P["stroke-dasharray"]=`${Y} ${K}`}}else P.stroke="none";return[{name:"rect",type:"element",attributes:P,value:"",children:[]}]}function WJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{center:a,radius:o,layer:s="top",pcb_silkscreen_circle_id:l,stroke_width:c=1}=r;if(n&&s!==n)return[];if(!a||typeof a.x!="number"||typeof a.y!="number"||typeof o!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:a,radius:o}),[];const[u,A]=qr(t,[a.x,a.y]),d=o*Math.abs(t.a),h=c*Math.abs(t.a),m=s==="bottom"?i.silkscreen.bottom:i.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:u.toString(),cy:A.toString(),r:d.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${s}`,stroke:m,"stroke-width":h.toString(),"data-pcb-silkscreen-circle-id":l},value:"",children:[]}]}function ZJt(r,e){const{transform:t,layer:n,colorMap:i}=e,{x1:a,y1:o,x2:s,y2:l,stroke_width:c,layer:u="top",pcb_silkscreen_line_id:A}=r;if(n&&u!==n)return[];if(typeof a!="number"||typeof o!="number"||typeof s!="number"||typeof l!="number")return console.error("Invalid coordinates:",{x1:a,y1:o,x2:s,y2:l}),[];const[d,h]=qr(t,[a,o]),[m,C]=qr(t,[s,l]),E=c*Math.abs(t.a),_=u==="bottom"?i.silkscreen.bottom:i.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:d.toString(),y1:h.toString(),x2:m.toString(),y2:C.toString(),stroke:_,"stroke-width":E.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${u}`,"data-pcb-silkscreen-line-id":A},value:"",children:[]}]}function qJt(r){const e=[];for(let t=0;t<r.length-1;t++)e.push([r[t],r[t+1]]);return e}var sx={copper:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",debugComponent:{fill:null,stroke:null}};sx.drill,sx.silkscreen.top,sx.silkscreen.bottom,sx.copper.top,sx.copper.bottom;function U3(r,e=sx){return e.copper[r]??"white"}var XJt={bottom:"rgb(105, 105, 105)",top:"rgb(105, 105, 105)"};function dz(r){return XJt[r]??"rgb(105, 105, 105)"}function $Jt(r,e){const{transform:t,layer:n,colorMap:i}=e;if(!r.route||!Array.isArray(r.route)||r.route.length<2)return[];const a=qJt(r.route),o=[];for(const[s,l]of a){const c=qr(t,[s.x,s.y]),u=qr(t,[l.x,l.y]),A="layer"in s?s.layer:"layer"in l?l.layer:null;if(!A||n&&A!==n)continue;const d=i.soldermask[A]??U3(A,i),h="width"in s?s.width:"width"in l?l.width:null,m={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:d,fill:"none",d:`M ${c[0]} ${c[1]} L ${u[0]} ${u[1]}`,"stroke-width":h?(h*Math.abs(t.a)).toString():"0.3","stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-layer":A}};o.push(m)}return o.sort((s,l)=>{const c=s.attributes["data-layer"],u=l.attributes["data-layer"];return c==="bottom"&&u!=="bottom"?-1:c==="top"&&u!=="top"?1:0}),o}function eWt(r,e){const{transform:t,layer:n,colorMap:i}=e;if(n&&r.layer!==n)return[];if(r.shape==="rect"||r.shape==="rotated_rect"){const a=r.width*Math.abs(t.a),o=r.height*Math.abs(t.d),[s,l]=qr(t,[r.x,r.y]);return r.shape==="rotated_rect"&&r.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(-a/2).toString(),y:(-o/2).toString(),width:a.toString(),height:o.toString(),transform:`translate(${s} ${l}) rotate(${-r.ccw_rotation})`,"data-layer":r.layer}}]:[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(s-a/2).toString(),y:(l-o/2).toString(),width:a.toString(),height:o.toString(),"data-layer":r.layer}}]}if(r.shape==="pill"){const a=r.width*Math.abs(t.a),o=r.height*Math.abs(t.d),s=r.radius*Math.abs(t.a),[l,c]=qr(t,[r.x,r.y]);return[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),x:(l-a/2).toString(),y:(c-o/2).toString(),width:a.toString(),height:o.toString(),rx:s.toString(),ry:s.toString(),"data-layer":r.layer}}]}if(r.shape==="circle"){const a=r.radius*Math.abs(t.a),[o,s]=qr(t,[r.x,r.y]);return[{name:"circle",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer,i),cx:o.toString(),cy:s.toString(),r:a.toString(),"data-layer":r.layer}}]}if(r.shape==="polygon"){const a=(r.points??[]).map(o=>qr(t,[o.x,o.y]));return[{name:"polygon",type:"element",attributes:{class:"pcb-pad",fill:U3(r.layer),points:a.map(o=>o.join(",")).join(" "),"data-layer":r.layer}}]}return[]}function sze(r,e){const{transform:t,colorMap:n}=e,{width:i,height:a,center:o,outline:s}=r;let l;if(s&&Array.isArray(s)&&s.length>=3)l=s.map((c,u)=>{const[A,d]=qr(t,[c.x,c.y]);return u===0?`M ${A} ${d}`:`L ${A} ${d}`}).join(" ");else{const c=i/2,u=a/2,A=qr(t,[o.x-c,o.y-u]),d=qr(t,[o.x+c,o.y-u]),h=qr(t,[o.x+c,o.y+u]),m=qr(t,[o.x-c,o.y+u]);l=`M ${A[0]} ${A[1]} L ${d[0]} ${d[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`}return l+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:l,fill:"none",stroke:n.boardOutline,"stroke-width":(.1*Math.abs(t.a)).toString()}}]}function tWt(r,e){const{transform:t,colorMap:n}=e,[i,a]=qr(t,[r.x,r.y]),o=r.outer_diameter*Math.abs(t.a),s=r.outer_diameter*Math.abs(t.a),l=r.hole_diameter*Math.abs(t.a),c=r.hole_diameter*Math.abs(t.a),u=Math.min(o,s)/2,A=Math.min(l,c)/2;return{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:i.toString(),cy:a.toString(),r:u.toString()}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:i.toString(),cy:a.toString(),r:A.toString()}}]}}function nWt(r,e){const{transform:t,colorMap:n}=e,[i,a]=qr(t,[r.x,r.y]);if(r.hole_shape==="circle"||r.hole_shape==="square"){const o=r.hole_diameter*Math.abs(t.a),s=o/2;return r.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"pcb-hole",cx:i.toString(),cy:a.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"pcb-hole",x:(i-s).toString(),y:(a-s).toString(),width:o.toString(),height:o.toString(),fill:n.drill},children:[],value:""}]}if(r.hole_shape==="oval"){const o=r.hole_width*Math.abs(t.a),s=r.hole_height*Math.abs(t.a),l=o/2,c=s/2;return[{name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:i.toString(),cy:a.toString(),rx:l.toString(),ry:c.toString(),fill:n.drill},children:[],value:""}]}return[]}var rWt=(r,e)=>{const t=D_(e).pcb_smtpad.get(r);if(t&&"x"in t&&"y"in t)return{x:t.x,y:t.y};const n=D_(e).pcb_plated_hole.get(r);return n&&"x"in n&&"y"in n?{x:n.x,y:n.y}:null},iWt=(r,e,t,n)=>{const i=t.getIdsConnectedToNet(e);let a=null,o=1/0;for(const s of i){const l=rWt(s,n);if(l){const c=r.x-l.x,u=r.y-l.y,A=Math.sqrt(c*c+u*u);A>0&&A<o&&(o=A,a=l)}}return a};function aWt(r,e){const{transform:t}=e,n=vQ(r),i=r.filter(l=>l.type==="pcb_port"),a=r.filter(l=>l.type==="source_trace"),o=[];i.forEach((l,c)=>{const u=l.pcb_port_id;if(!u)return;const A=n.getNetConnectedToId(u);if(!A)return;let d=!1;const h=D_(r).source_port.getWhere({pcb_port_id:u});if(h&&h.source_port_id){const E=h.source_port_id;for(const _ of a)if(Array.isArray(_.connected_source_port_ids)&&_.connected_source_port_ids.includes(E)&&Array.isArray(_.connected_source_net_ids)&&_.connected_source_net_ids.length>0){d=!0;break}}const m={x:l.x,y:l.y},C=iWt(m,A,n,r);C&&o.push({key:`${u}-${c}`,startPoint:m,endPoint:C,isInNet:d})});const s=[];for(const l of o){const c=qr(t,[l.startPoint.x,l.startPoint.y]),u=qr(t,[l.endPoint.x,l.endPoint.y]),A={x1:c[0].toString(),y1:c[1].toString(),x2:u[0].toString(),y2:u[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6"};s.push({name:"line",type:"element",attributes:A,value:"",children:[]})}return s}function oWt(r,e){const{transform:t,colorMap:n}=e;if(r.shape==="rect"){const i=r,[a,o]=qr(t,[i.center.x,i.center.y]),s=i.width*Math.abs(t.a),l=i.height*Math.abs(t.d),c=-(i.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-cutout pcb-cutout-rect",x:(-s/2).toString(),y:(-l/2).toString(),width:s.toString(),height:l.toString(),fill:n.drill,transform:n2(tA(df(a,o),SB(c*Math.PI/180)))},children:[],value:""}]}if(r.shape==="circle"){const i=r,[a,o]=qr(t,[i.center.x,i.center.y]),s=i.radius*Math.abs(t.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:a.toString(),cy:o.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]}if(r.shape==="polygon"){const i=r;return!i.points||i.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:i.points.map(s=>qr(t,[s.x,s.y])).map(s=>`${s[0]},${s[1]}`).join(" "),fill:n.drill},children:[],value:""}]}return[]}function sWt(r,e){var d,h;const{transform:t}=e,{center:n,width:i,height:a,rotation:o=0}=r,[s,l]=qr(t,[n.x,n.y]),c=i*Math.abs(t.a),u=a*Math.abs(t.d),A=`translate(${s}, ${l}) rotate(${-o}) scale(1, -1)`;return!((d=e.colorMap.debugComponent)!=null&&d.fill)&&!((h=e.colorMap.debugComponent)!=null&&h.stroke)?[]:[{name:"g",type:"element",attributes:{transform:A},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-c/2).toString(),y:(-u/2).toString(),width:c.toString(),height:u.toString(),fill:e.colorMap.debugComponent.fill??"transparent",stroke:e.colorMap.debugComponent.stroke??"transparent"}}],value:""}]}function aP(r){const e=r.find(t=>t.type==="project_software_metadata"||t.type==="source_project_metadata");return e==null?void 0:e.software_used_string}var lWt={version:"0.0.172"},oP=lWt.version,lze=["pcb_trace_error","pcb_plated_hole","pcb_fabrication_note_text","pcb_fabrication_note_path","pcb_silkscreen_text","pcb_silkscreen_path","pcb_via","pcb_cutout","pcb_smtpad","pcb_trace","pcb_component","pcb_board"];function cze(r,e){var Ft,et,yt,_t,Ot,Xt,kt,Wn;const t=(e==null?void 0:e.drawPaddingOutsideBoard)??!0,n=e==null?void 0:e.layer,i=e==null?void 0:e.colorOverrides,a={copper:{top:((Ft=i==null?void 0:i.copper)==null?void 0:Ft.top)??sx.copper.top,bottom:((et=i==null?void 0:i.copper)==null?void 0:et.bottom)??sx.copper.bottom},drill:(i==null?void 0:i.drill)??sx.drill,silkscreen:{top:((yt=i==null?void 0:i.silkscreen)==null?void 0:yt.top)??sx.silkscreen.top,bottom:((_t=i==null?void 0:i.silkscreen)==null?void 0:_t.bottom)??sx.silkscreen.bottom},boardOutline:(i==null?void 0:i.boardOutline)??sx.boardOutline,soldermask:{top:((Ot=i==null?void 0:i.soldermask)==null?void 0:Ot.top)??sx.soldermask.top,bottom:((Xt=i==null?void 0:i.soldermask)==null?void 0:Xt.bottom)??sx.soldermask.bottom},debugComponent:{fill:((kt=i==null?void 0:i.debugComponent)==null?void 0:kt.fill)??sx.debugComponent.fill,stroke:((Wn=i==null?void 0:i.debugComponent)==null?void 0:Wn.stroke)??sx.debugComponent.stroke}};let o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,A=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const un of r)if(un.type==="pcb_board")un.outline&&Array.isArray(un.outline)&&un.outline.length>=3?(qe(un.outline),ft(un.outline)):"center"in un&&"width"in un&&"height"in un&&(Ne(un.center,un.width,un.height),nt(un.center,un.width,un.height));else if("x"in un&&"y"in un)Ne({x:un.x,y:un.y},0,0);else if(un.type==="pcb_smtpad"){const Zt=un;Zt.shape==="rect"||Zt.shape==="rotated_rect"||Zt.shape==="pill"?Ne({x:Zt.x,y:Zt.y},Zt.width,Zt.height):Zt.shape==="circle"?Ne({x:Zt.x,y:Zt.y},Zt.radius*2,Zt.radius*2):Zt.shape==="polygon"&&It(Zt.points)}else"route"in un?It(un.route):(un.type==="pcb_silkscreen_text"||un.type==="pcb_silkscreen_rect"||un.type==="pcb_silkscreen_circle"||un.type==="pcb_silkscreen_line")&&Ut(un);const m=t?1:0,C=t||!isFinite(u)?o:u,E=t||!isFinite(A)?s:A,_=t||!isFinite(d)?l:d,B=t||!isFinite(h)?c:h,w=_-C+2*m,P=B-E+2*m;let O=(e==null?void 0:e.width)??800,G=(e==null?void 0:e.height)??600;if(e!=null&&e.matchBoardAspectRatio){const un=d-u,Zt=h-A;if(un>0&&Zt>0){const tr=un/Zt;e!=null&&e.width&&!(e!=null&&e.height)?G=e.width/tr:e!=null&&e.height&&!(e!=null&&e.width)?O=e.height*tr:G=O/tr}}const Y=[];for(const un of r)"route"in un&&un.route!==void 0&&Y.push(un.route);const K=O/w,Z=G/P,V=Math.min(K,Z),se=(O-w*V)/2,ie=(G-P*V)/2,de=tA(df(se-C*V+m*V,G-ie+E*V-m*V),PE(V,-V)),Ce={transform:de,layer:n,shouldDrawErrors:e==null?void 0:e.shouldDrawErrors,drawPaddingOutsideBoard:t,colorMap:a};function xe(un){if(un.type==="pcb_smtpad")return un.layer==="top"||un.layer==="bottom"?un.layer:void 0;if(un.type==="pcb_trace")for(const Zt of un.route??[]){const tr="layer"in Zt&&Zt.layer||"from_layer"in Zt&&Zt.from_layer||"to_layer"in Zt&&Zt.to_layer||void 0;if(tr==="top"||tr==="bottom")return tr}}function fe(un){return un.type==="pcb_trace"||un.type==="pcb_smtpad"}let Ie=r.sort((un,Zt)=>{const tr=xe(un),Nr=xe(Zt);if(fe(un)&&fe(Zt)&&tr!==Nr){if(tr==="top")return 1;if(Nr==="top"||tr==="bottom")return-1;if(Nr==="bottom")return 1}return(lze.indexOf(Zt.type)??9999)-(lze.indexOf(un.type)??9999)}).flatMap(un=>cWt({elm:un,circuitJson:r,ctx:Ce}));for(const un of r)if("stroke_width"in un){String(V*un.stroke_width);break}if(e!=null&&e.shouldDrawRatsNest){const un=aWt(r,Ce);Ie=Ie.concat(un)}const ye=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]},{name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:(e==null?void 0:e.backgroundColor)??"#000",width:O.toString(),height:G.toString()},children:[]}];t&&ye.push(uWt(de,o,s,l,c)),ye.push(...Ie);const Me=aP(r),Qe=oP,Ue={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:O.toString(),height:G.toString(),...Me&&{"data-software-used-string":Me},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":Qe}},value:"",children:ye.filter(un=>un!==null)};try{return Az(Ue)}catch(un){throw console.error("Error stringifying SVG object:",un),un}function Ne(un,Zt,tr){const Nr=Zt/2,cr=tr/2;o=Math.min(o,un.x-Nr),s=Math.min(s,un.y-cr),l=Math.max(l,un.x+Nr),c=Math.max(c,un.y+cr)}function nt(un,Zt,tr){const Nr=Zt/2,cr=tr/2;u=Math.min(u,un.x-Nr),A=Math.min(A,un.y-cr),d=Math.max(d,un.x+Nr),h=Math.max(h,un.y+cr)}function qe(un){for(const Zt of un)o=Math.min(o,Zt.x),s=Math.min(s,Zt.y),l=Math.max(l,Zt.x),c=Math.max(c,Zt.y)}function ft(un){for(const Zt of un)u=Math.min(u,Zt.x),A=Math.min(A,Zt.y),d=Math.max(d,Zt.x),h=Math.max(h,Zt.y)}function It(un){for(const Zt of un)o=Math.min(o,Zt.x),s=Math.min(s,Zt.y),l=Math.max(l,Zt.x),c=Math.max(c,Zt.y)}function Ut(un){if(un.type==="pcb_silkscreen_text")Ne(un.anchor_position,0,0);else if(un.type==="pcb_silkscreen_path")It(un.route);else if(un.type==="pcb_silkscreen_rect")Ne(un.center,un.width,un.height);else if(un.type==="pcb_silkscreen_circle")Ne(un.center,un.radius*2,un.radius*2);else if(un.type==="pcb_silkscreen_line")Ne({x:un.x1,y:un.y1},0,0),Ne({x:un.x2,y:un.y2},0,0);else if(un.type==="pcb_cutout"){const Zt=un;Zt.shape==="rect"?Ne(Zt.center,Zt.width,Zt.height):Zt.shape==="circle"?Ne(Zt.center,Zt.radius*2,Zt.radius*2):Zt.shape==="polygon"&&It(Zt.points)}}}function cWt({elm:r,circuitJson:e,ctx:t}){switch(r.type){case"pcb_trace_error":return OJt(r,e,t).filter(Boolean);case"pcb_component":return sWt(r,t).filter(Boolean);case"pcb_trace":return $Jt(r,t);case"pcb_plated_hole":return VJt(r,t).filter(Boolean);case"pcb_hole":return nWt(r,t);case"pcb_smtpad":return eWt(r,t);case"pcb_silkscreen_text":return jJt(r,t);case"pcb_silkscreen_rect":return JJt(r,t);case"pcb_silkscreen_circle":return WJt(r,t);case"pcb_silkscreen_line":return ZJt(r,t);case"pcb_fabrication_note_path":return HJt(r,t);case"pcb_fabrication_note_text":return YJt(r,t);case"pcb_silkscreen_path":return KJt(r,t);case"pcb_board":return t.drawPaddingOutsideBoard?sze(r,t):[];case"pcb_via":return tWt(r,t);case"pcb_cutout":return oWt(r,t);default:return[]}}function uWt(r,e,t,n,i){const[a,o]=qr(r,[e,t]),[s,l]=qr(r,[n,i]),c=Math.abs(s-a),u=Math.abs(l-o),A=Math.min(a,s),d=Math.min(o,l);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:A.toString(),y:d.toString(),width:c.toString(),height:u.toString()}}}var AWt=cze,fz={fill:"none",stroke:"rgb(0,0,0)",strokeOpacity:"0.8",strokeWidthFactor:.2};function dWt(r,e,t={}){const{width:n,height:i,center:a,outline:o}=r;let s;if(o&&Array.isArray(o)&&o.length>=3)s=o.map((l,c)=>{const[u,A]=qr(e,[l.x,l.y]);return c===0?`M ${u} ${A}`:`L ${u} ${A}`}).join(" ");else{const l=n/2,c=i/2,u=qr(e,[a.x-l,a.y-c]),A=qr(e,[a.x+l,a.y-c]),d=qr(e,[a.x+l,a.y+c]),h=qr(e,[a.x-l,a.y+c]);s=`M ${u[0]} ${u[1]} L ${A[0]} ${A[1]} L ${d[0]} ${d[1]} L ${h[0]} ${h[1]}`}return s+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:s,fill:t.fill??fz.fill,stroke:t.stroke??fz.stroke,"stroke-opacity":t.strokeOpacity??fz.strokeOpacity,"stroke-width":((t.strokeWidthFactor??fz.strokeWidthFactor)*Math.abs(e.a)).toString()}}]}var fWt={pin_number:.15,negated_pin_number:.15*.8,reference_designator:.18,manufacturer_number:.18,net_label:.18,error:.05},F3=(r,e)=>e??fWt[r],QQ=(r,e,t)=>Math.abs(r.a)*F3(e,t);function hWt(r,e){const{elm:t,portPosition:n,name:i,arePinsInterchangeable:a}=r,{transform:o}=e,{center:s,width:l,height:c,rotation:u=0,layer:A="top"}=t;if(!s||typeof l!="number"||typeof c!="number")return null;const[d,h]=qr(o,[s.x,s.y]),[m,C]=qr(o,[n.x,n.y]),E=l*Math.abs(o.a),_=c*Math.abs(o.d),B=C>h,w=m<d,P=[pWt(E,_,u,A),gWt(E,_,i??"")];return a||P.push(mWt(E,_,u,A,B,w)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${d}, ${h}) scale(1, -1)`},children:P}}function pWt(r,e,t,n){const i=r/2,a=e/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:yWt(i,a,t),"stroke-width":.8.toFixed(2),transform:`rotate(${-t})`,"stroke-dasharray":n==="bottom"?"2,2":""},value:"",children:[]}}function gWt(r,e,t,n){const i=Math.min(r,e),l=Math.min(58,Math.max(3,i*.8)),c=e>r;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${l.toFixed(1)}px`,transform:c?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:t||"",name:"",attributes:{},children:[]}],value:""}}function mWt(r,e,t,n,i,a){const o=r/2,s=e/2,l=Math.min(o,s)*.5;let c;return i&&a?c=[[-o,-s],[-o+l,-s],[-o,-s+l]]:i&&!a?c=[[o,-s],[o-l,-s],[o,-s+l]]:!i&&a?c=[[-o,s],[-o+l,s],[-o,s-l]]:c=[[o,s],[o-l,s],[o,s-l]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:c.map(A=>A.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-t})`},value:"",children:[]}}function yWt(r,e,t){const n=(s,l,c)=>{const u=Math.PI/180*c,A=Math.cos(u),d=Math.sin(u);return[s*A-l*d,s*d+l*A]};return`${[[-r,-e],[r,-e],[r,e],[-r,e]].map(([s,l])=>n(s,l,t)).map(([s,l],c)=>c===0?`M${s},${l}`:`L${s},${l}`).join(" ")} Z`}var tAe="rgb(190, 190, 190)";function vWt(r,e){const{transform:t}=e,[n,i]=qr(t,[r.x,r.y]);if(r.hole_shape==="circle"||r.hole_shape==="square"){const a=r.hole_diameter*Math.abs(t.a),o=a/2;return r.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:i.toString(),r:o.toString(),fill:tAe},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(n-o).toString(),y:(i-o).toString(),width:a.toString(),height:a.toString(),fill:tAe},children:[],value:""}]}if(r.hole_shape==="oval"){const a=r.hole_width*Math.abs(t.a),o=r.hole_height*Math.abs(t.a),s=a/2,l=o/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:i.toString(),rx:s.toString(),ry:l.toString(),fill:tAe},children:[],value:""}]}return[]}var hz="rgb(210, 210, 210)",pz="rgb(190, 190, 190)";function IWt(r,e){const{transform:t}=e,[n,i]=qr(t,[r.x,r.y]);if(r.shape==="pill"){const a=r.outer_width*Math.abs(t.a),o=r.outer_height*Math.abs(t.a),s=r.hole_width*Math.abs(t.a),l=r.hole_height*Math.abs(t.a),c=a/2,u=o-a,A=s/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:hz,d:`M${n-c},${i-u/2} v${u} a${c},${c} 0 0 0 ${a},0 v-${u} a${c},${c} 0 0 0 -${a},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,d:`M${n-A},${i-(l-s)/2} v${l-s} a${A},${A} 0 0 0 ${s},0 v-${l-s} a${A},${A} 0 0 0 -${s},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circle"){const a=r.outer_diameter*Math.abs(t.a),o=r.outer_diameter*Math.abs(t.a),s=r.hole_diameter*Math.abs(t.a),l=r.hole_diameter*Math.abs(t.a),c=Math.min(a,o)/2,u=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:hz,cx:n.toString(),cy:i.toString(),r:c.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,cx:n.toString(),cy:i.toString(),r:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="circular_hole_with_rect_pad"){const a=r.hole_diameter*Math.abs(t.a),o=r.rect_pad_width*Math.abs(t.a),s=r.rect_pad_height*Math.abs(t.a),l=a/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:hz,x:(n-o/2).toString(),y:(i-s/2).toString(),width:o.toString(),height:s.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,cx:n.toString(),cy:i.toString(),r:l.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(r.shape==="pill_hole_with_rect_pad"){const a=r.rect_pad_width*Math.abs(t.a),o=r.rect_pad_height*Math.abs(t.a),s=r.hole_height*Math.abs(t.a),l=r.hole_width*Math.abs(t.a),c=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:hz,x:(n-a/2).toString(),y:(i-o/2).toString(),width:a.toString(),height:o.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:pz,x:(n-l/2).toString(),y:(i-s/2).toString(),width:l.toString(),height:s.toString(),rx:c.toString(),ry:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}var sP="rgb(210, 210, 210)";function CWt(r,e){const{transform:t}=e;if(r.shape==="rect"||r.shape==="rotated_rect"){const n=r.width*Math.abs(t.a),i=r.height*Math.abs(t.d),[a,o]=qr(t,[r.x,r.y]);return r.shape==="rotated_rect"&&r.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(-n/2).toString(),y:(-i/2).toString(),width:n.toString(),height:i.toString(),transform:`translate(${a} ${o}) rotate(${-r.ccw_rotation})`,"data-layer":r.layer},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(a-n/2).toString(),y:(o-i/2).toString(),width:n.toString(),height:i.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="pill"){const n=r.width*Math.abs(t.a),i=r.height*Math.abs(t.d),a=r.radius*Math.abs(t.a),[o,s]=qr(t,[r.x,r.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:sP,x:(o-n/2).toString(),y:(s-i/2).toString(),width:n.toString(),height:i.toString(),rx:a.toString(),ry:a.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="circle"){const n=r.radius*Math.abs(t.a),[i,a]=qr(t,[r.x,r.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:sP,cx:i.toString(),cy:a.toString(),r:n.toString(),"data-layer":r.layer},value:"",children:[]}]}if(r.shape==="polygon"){const n=(r.points??[]).map(i=>qr(t,[i.x,i.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:sP,points:n.map(i=>i.join(",")).join(" "),"data-layer":r.layer},value:"",children:[]}]}return[]}var uze=["pcb_component","pcb_smtpad","pcb_hole","pcb_plated_hole","pcb_board"];function Aze(r,e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(const G of r)if(G.type==="pcb_board"){const Y=G.center,K=G.width||0,Z=G.height||0;t=Math.min(t,Y.x-K/2),n=Math.min(n,Y.y-Z/2),i=Math.max(i,Y.x+K/2),a=Math.max(a,Y.y+Z/2)}const o=1,s=i-t+2*o,l=a-n+2*o,c=(e==null?void 0:e.width)??800,u=(e==null?void 0:e.height)??600,A=c/s,d=u/l,h=Math.min(A,d),m=(c-s*h)/2,C=(u-l*h)/2,E=tA(df(m-t*h+o*h,u-C+n*h-o*h),PE(h,-h)),_={transform:E},B=r.sort((G,Y)=>(uze.indexOf(Y.type)??9999)-(uze.indexOf(G.type)??9999)).flatMap(G=>EWt(G,_,r)),w=aP(r),P=oP,O={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:c.toString(),height:u.toString(),...w&&{"data-software-used-string":w},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":P}},value:"",children:[{name:"style",type:"element",children:[{type:"text",value:`
|
|
13242
13242
|
.assembly-component {
|
|
13243
13243
|
fill: none;
|
|
13244
13244
|
stroke: #000;
|
|
@@ -13475,7 +13475,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return WAe}TXt();function LHe(r,e,t,n=
|
|
|
13475
13475
|
&:hover {
|
|
13476
13476
|
background-color: rgba(255, 255, 255, 0.1);
|
|
13477
13477
|
}
|
|
13478
|
-
`,onClick:n=>{n.stopPropagation(),t()},children:[ct.jsx("input",{type:"checkbox",checked:e}),ct.jsx("span",{style:{color:"#eee"},children:r})]}),snn=({children:r,elements:e})=>{const[t,n]=gE(K=>[K.is_mouse_over_container,K.setIsMouseOverContainer]),[i,a]=ht.useState(!1),[o,s]=ht.useState(!1),[l,c]=ht.useState(!1),[u,A]=gE(K=>[K.selected_layer,K.selectLayer]),[d,h,m,C,E,_]=gE(K=>[K.in_move_footprint_mode,K.in_draw_trace_mode,K.is_showing_rats_nest,K.is_showing_multiple_traces_length,K.is_showing_autorouting,K.is_showing_drc_errors]),B=gE(K=>K.setEditMode),w=gE(K=>K.setIsShowingRatsNest),P=gE(K=>K.setIsShowingMultipleTracesLength),O=gE(K=>K.setIsShowingAutorouting),G=gE(K=>K.setIsShowingDrcErrors);e9("1",()=>A("top")),e9("2",()=>A("bottom")),e9("3",()=>A("inner1")),e9("4",()=>A("inner2")),e9("5",()=>A("inner3")),e9("6",()=>A("inner4")),e9("7",()=>A("inner5")),e9("8",()=>A("inner6"));const Y=(e==null?void 0:e.filter(K=>K.type.includes("error")).length)??0;return ct.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:K=>{n(!1),s(!1)},children:[r,ct.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",ann.version]}),ct.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Hx.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[ct.jsxs(t5,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[ct.jsxs("div",{children:["layer:"," ",ct.jsx("span",{style:{marginLeft:2,fontWeight:500,color:e5[u]},children:u})]}),o&&ct.jsx("div",{style:{marginTop:4,minWidth:120},children:Mde.map(K=>K.replace(/-/g,"")).map(K=>ct.jsx(onn,{name:K,selected:K===u,onClick:()=>{A(K.replace(/-/,""))}},K))})]}),ct.jsxs(t5,{style:Y>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[ct.jsxs("div",{children:[Y," errors"]}),l&&ct.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(K=>K.type.includes("error")).map((K,Z)=>ct.jsxs(ht.Fragment,{children:[ct.jsx("div",{children:K.error_type}),ct.jsx("div",{children:K.message})]},Z))})]}),ct.jsx(t5,{style:{},onClick:()=>{B(h?"off":"draw_trace")},children:ct.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),ct.jsx(t5,{style:{},onClick:()=>{B(d?"off":"move_footprint")},children:ct.jsxs("div",{children:[d?"✖ ":"","Move Components"]})}),ct.jsx(t5,{style:{},onClick:()=>{w(!m)},children:ct.jsxs("div",{children:[m?"✖ ":"","Rats Nest"]})}),ct.jsx(t5,{onClick:()=>{a(!i)},children:ct.jsxs("div",{children:[ct.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",ct.jsx("span",{style:{fontSize:"8px",transform:i?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),i&&ct.jsxs("div",{style:{marginTop:4,minWidth:120},children:[ct.jsx(kde,{label:"Show All Trace Lengths",checked:C,onClick:()=>{P(!C)}}),ct.jsx(kde,{label:"Show Autorouting Animation",checked:E,onClick:()=>{O(!E)}}),ct.jsx(kde,{label:"Show DRC Errors",checked:_,onClick:()=>{G(!_)}})]})]})})]})]})},lnn=r=>{const{transform:e,elements:t}=r,[n,i]=ht.useMemo(()=>{const c=r.elements.flatMap(A=>vtn(A,r.elements)),u=vQ(r.elements);return[c,u]},[r.elements]),[a,o]=ht.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=ht.useMemo(()=>mtn({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=ht.useCallback(c=>{var d,h;const u=[];for(const m of c)if(m._element){const C=i.getNetConnectedToId("pcb_port_id"in m._element?(d=m._element)==null?void 0:d.pcb_port_id:"pcb_trace_id"in m._element?(h=m._element)==null?void 0:h.pcb_trace_id:"");u.push(...i.getIdsConnectedToNet(C))}const A=new Set(c.map(m=>m._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:A,primitiveIdsInMousedOverNet:u})},[i]);return ct.jsx(rnn,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:ct.jsx(Gtn,{disabled:!r.allowEditing,transform:e,soup:t,cancelPanDrag:r.cancelPanDrag,onCreateEditEvent:r.onCreateEditEvent,onModifyEditEvent:r.onModifyEditEvent,children:ct.jsx(Ytn,{disabled:!r.allowEditing,transform:e,soup:t,cancelPanDrag:r.cancelPanDrag,onCreateEditEvent:r.onCreateEditEvent,onModifyEditEvent:r.onModifyEditEvent,children:ct.jsx(Ftn,{transform:e,focusOnHover:r.focusOnHover,children:ct.jsx(snn,{elements:t,children:ct.jsx(jtn,{transform:e,elements:t,children:ct.jsx(inn,{transform:e,soup:t,children:ct.jsx(ktn,{transform:e,debugGraphics:r.debugGraphics,children:ct.jsx(Utn,{transform:e,elements:t,children:ct.jsx(Ptn,{transform:e,primitives:s,width:r.width,height:r.height,grid:r.grid})})})})})})})})})})},cnn=tA(df(400,300),PE(40,-40)),unn=({circuitJson:r,debugGraphics:e,height:t=600,initialState:n,allowEditing:i=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=ht.useState(!l),[A,d]=Tde(),[h,m]=ht.useState(cnn),{ref:C,setTransform:E,cancelDrag:_}=gtn({transform:h,onSetTransform:m,enabled:c});let[B,w]=ht.useState([]);B=a??B;const P=ht.useRef(!1),O=ht.useRef(null),G=`${(r==null?void 0:r.length)||0}_${(r==null?void 0:r.editCount)||0}`,Y=()=>{const ie=(d==null?void 0:d.width)>0?d:{width:500,height:500},{center:de,width:Ce,height:xe}=Z.some(ye=>ye.type.startsWith("pcb_"))?otn(Z.filter(ye=>ye.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},fe=Math.min((ie.width??0)/Ce,(ie.height??0)/xe,100)*.75,Ie=tA(df((ie.width??0)/2,(ie.height??0)/2),PE(fe,-fe,0,0),df(-de.x,-de.y));E(Ie)};ht.useEffect(()=>{d!=null&&d.width&&r&&r.length!==0&&(P.current||(Y(),P.current=!0))},[r,d]);const K=ht.useMemo(()=>(r==null?void 0:r.filter(ie=>ie.type.startsWith("pcb_")||ie.type.startsWith("source_")))??[],[G]),Z=ht.useMemo(()=>vqt({circuitJson:K,editEvents:B}),[K,B]),V=ie=>{w([...B,ie]),o==null||o([...B,ie])},se=ie=>{const de=B.map(Ce=>Ce.edit_event_id===ie.edit_event_id?{...Ce,...ie}:Ce);w(de),o==null||o(de)};return ct.jsxs("div",{ref:C,style:{position:"relative"},children:[ct.jsx("div",{ref:A,children:ct.jsxs(ltn,{initialState:n,children:[ct.jsx(lnn,{transform:h,height:t,width:d.width,allowEditing:i,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:V,onModifyEditEvent:se,grid:{spacing:1,view_window:{left:0,right:d.width||500,top:t,bottom:0}},elements:Z,debugGraphics:e},d.width),ct.jsx(utn,{})]})}),l&&!c&&ct.jsx("div",{onClick:()=>{u(!0),Y()},onTouchStart:ie=>{const de=ie.touches[0];O.current={x:de.clientX,y:de.clientY}},onTouchEnd:ie=>{const de=ie.changedTouches[0],Ce=O.current;if(!Ce)return;const xe=Math.abs(de.clientX-Ce.x),fe=Math.abs(de.clientY-Ce.y);xe<10&&fe<10&&(ie.preventDefault(),u(!0),Y()),O.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Hx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:ct.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const Ann=({containerClassName:r,...e})=>{const t=ht.useRef(null),[n,i]=ht.useState(620);return ht.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;i(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),ct.jsx("div",{ref:t,className:r||"rf-w-full rf-h-full",children:ct.jsx(unn,{...e,height:n})})},dnn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',fnn=()=>{ht.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=dnn,document.head.appendChild(e)},[])},hnn=r=>{ht.useEffect(()=>(r?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[r])},eKe=r=>`hsl(${zb.indexOf(r)*137.5%360}, 70%, 50%)`,pnn=({phaseTimings:r})=>{if(!r)return null;const e=Object.values(r).reduce((t,n)=>t+n,0);return ct.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ct.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:zb.map(t=>{const n=r[t]||0,i=n/e*100;return ct.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:eKe(t)},children:ct.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),ct.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},gnn=({renderLog:r})=>{const[e,t]=ht.useState("chronological");if(!r)return ct.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((r==null?void 0:r.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>zb.indexOf(a[0])-zb.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const i=n.reduce((a,[o,s])=>a+s,0);return ct.jsxs("div",{className:"rf-bg-white",children:[ct.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ct.jsx("div",{children:"Render Logs"}),ct.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ct.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ct.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ct.jsx("option",{value:"chronological",children:"Phase Order"}),ct.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ct.jsx(pnn,{phaseTimings:r.phaseTimings}),ct.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ct.jsx("thead",{children:ct.jsxs("tr",{children:[ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ct.jsx("tbody",{children:n.map(([a,o])=>ct.jsxs("tr",{children:[ct.jsx("td",{className:"rf-p-2",children:zb.indexOf(a)}),ct.jsx("td",{className:"rf-p-2",children:a}),ct.jsx("td",{className:"rf-p-2",children:ct.jsx("div",{className:"rf-w-8",children:ct.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:eKe(a),width:`${o/i*100}%`}})})}),ct.jsx("td",{className:"rf-p-2",children:ct.jsxs("div",{className:"rf-flex w-full",children:[ct.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ct.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},mnn=({errorMessage:r,errorStack:e,circuitJsonErrors:t})=>{ht.useEffect(()=>{if(r){const n=new Error(r);e&&(n.stack=e);try{t8.captureException(n)}catch{}}},[r,e]),ht.useEffect(()=>{if(t&&t.length>0)for(const n of t){const i=new Error(n.message||"Circuit JSON Error");n.stack&&(i.stack=n.stack);try{t8.captureException(i,{error_type:n.type})}catch{}}},[t])},ynn="0.0.711",Ude={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Fde=new Map,sH=r=>{const e=Fde.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},vnn=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const n=Fde.get(t.name);if(n)return{type:"tracked",store:r,...n};const i={connection:e.connect(t),stores:{}};return Fde.set(t.name,i),{type:"tracked",store:r,...i}},Inn=(r,e={})=>(t,n,i)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(Ude?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Ude?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),r(t,n,i);const{connection:u,...A}=vnn(s,c,l);let d=!0;i.setState=(C,E,_)=>{const B=t(C,E);if(!d)return B;const w=_===void 0?{type:o||"anonymous"}:typeof _=="string"?{type:_}:_;return s===void 0?(u==null||u.send(w,n()),B):(u==null||u.send({...w,type:`${s}/${w.type}`},{...sH(l.name),[s]:i.getState()}),B)};const h=(...C)=>{const E=d;d=!1,t(...C),d=E},m=r(i.setState,n,i);if(A.type==="untracked"?u==null||u.init(m):(A.stores[A.store]=i,u==null||u.init(Object.fromEntries(Object.entries(A.stores).map(([C,E])=>[C,C===A.store?m:E.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let C=!1;const E=i.dispatch;i.dispatch=(..._)=>{(Ude?"production":void 0)!=="production"&&_[0].type==="__setState"&&!C&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),C=!0),E(..._)}}return u.subscribe(C=>{var E;switch(C.type){case"ACTION":if(typeof C.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Lde(C.payload,_=>{if(_.type==="__setState"){if(s===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
13478
|
+
`,onClick:n=>{n.stopPropagation(),t()},children:[ct.jsx("input",{type:"checkbox",checked:e}),ct.jsx("span",{style:{color:"#eee"},children:r})]}),snn=({children:r,elements:e})=>{const[t,n]=gE(K=>[K.is_mouse_over_container,K.setIsMouseOverContainer]),[i,a]=ht.useState(!1),[o,s]=ht.useState(!1),[l,c]=ht.useState(!1),[u,A]=gE(K=>[K.selected_layer,K.selectLayer]),[d,h,m,C,E,_]=gE(K=>[K.in_move_footprint_mode,K.in_draw_trace_mode,K.is_showing_rats_nest,K.is_showing_multiple_traces_length,K.is_showing_autorouting,K.is_showing_drc_errors]),B=gE(K=>K.setEditMode),w=gE(K=>K.setIsShowingRatsNest),P=gE(K=>K.setIsShowingMultipleTracesLength),O=gE(K=>K.setIsShowingAutorouting),G=gE(K=>K.setIsShowingDrcErrors);e9("1",()=>A("top")),e9("2",()=>A("bottom")),e9("3",()=>A("inner1")),e9("4",()=>A("inner2")),e9("5",()=>A("inner3")),e9("6",()=>A("inner4")),e9("7",()=>A("inner5")),e9("8",()=>A("inner6"));const Y=(e==null?void 0:e.filter(K=>K.type.includes("error")).length)??0;return ct.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:K=>{n(!1),s(!1)},children:[r,ct.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",ann.version]}),ct.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Hx.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[ct.jsxs(t5,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[ct.jsxs("div",{children:["layer:"," ",ct.jsx("span",{style:{marginLeft:2,fontWeight:500,color:e5[u]},children:u})]}),o&&ct.jsx("div",{style:{marginTop:4,minWidth:120},children:Mde.map(K=>K.replace(/-/g,"")).map(K=>ct.jsx(onn,{name:K,selected:K===u,onClick:()=>{A(K.replace(/-/,""))}},K))})]}),ct.jsxs(t5,{style:Y>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[ct.jsxs("div",{children:[Y," errors"]}),l&&ct.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(K=>K.type.includes("error")).map((K,Z)=>ct.jsxs(ht.Fragment,{children:[ct.jsx("div",{children:K.error_type}),ct.jsx("div",{children:K.message})]},Z))})]}),ct.jsx(t5,{style:{},onClick:()=>{B(h?"off":"draw_trace")},children:ct.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),ct.jsx(t5,{style:{},onClick:()=>{B(d?"off":"move_footprint")},children:ct.jsxs("div",{children:[d?"✖ ":"","Move Components"]})}),ct.jsx(t5,{style:{},onClick:()=>{w(!m)},children:ct.jsxs("div",{children:[m?"✖ ":"","Rats Nest"]})}),ct.jsx(t5,{onClick:()=>{a(!i)},children:ct.jsxs("div",{children:[ct.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",ct.jsx("span",{style:{fontSize:"8px",transform:i?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),i&&ct.jsxs("div",{style:{marginTop:4,minWidth:120},children:[ct.jsx(kde,{label:"Show All Trace Lengths",checked:C,onClick:()=>{P(!C)}}),ct.jsx(kde,{label:"Show Autorouting Animation",checked:E,onClick:()=>{O(!E)}}),ct.jsx(kde,{label:"Show DRC Errors",checked:_,onClick:()=>{G(!_)}})]})]})})]})]})},lnn=r=>{const{transform:e,elements:t}=r,[n,i]=ht.useMemo(()=>{const c=r.elements.flatMap(A=>vtn(A,r.elements)),u=vQ(r.elements);return[c,u]},[r.elements]),[a,o]=ht.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=ht.useMemo(()=>mtn({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=ht.useCallback(c=>{var d,h;const u=[];for(const m of c)if(m._element){const C=i.getNetConnectedToId("pcb_port_id"in m._element?(d=m._element)==null?void 0:d.pcb_port_id:"pcb_trace_id"in m._element?(h=m._element)==null?void 0:h.pcb_trace_id:"");u.push(...i.getIdsConnectedToNet(C))}const A=new Set(c.map(m=>m._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:A,primitiveIdsInMousedOverNet:u})},[i]);return ct.jsx(rnn,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:ct.jsx(Gtn,{disabled:!r.allowEditing,transform:e,soup:t,cancelPanDrag:r.cancelPanDrag,onCreateEditEvent:r.onCreateEditEvent,onModifyEditEvent:r.onModifyEditEvent,children:ct.jsx(Ytn,{disabled:!r.allowEditing,transform:e,soup:t,cancelPanDrag:r.cancelPanDrag,onCreateEditEvent:r.onCreateEditEvent,onModifyEditEvent:r.onModifyEditEvent,children:ct.jsx(Ftn,{transform:e,focusOnHover:r.focusOnHover,children:ct.jsx(snn,{elements:t,children:ct.jsx(jtn,{transform:e,elements:t,children:ct.jsx(inn,{transform:e,soup:t,children:ct.jsx(ktn,{transform:e,debugGraphics:r.debugGraphics,children:ct.jsx(Utn,{transform:e,elements:t,children:ct.jsx(Ptn,{transform:e,primitives:s,width:r.width,height:r.height,grid:r.grid})})})})})})})})})})},cnn=tA(df(400,300),PE(40,-40)),unn=({circuitJson:r,debugGraphics:e,height:t=600,initialState:n,allowEditing:i=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=ht.useState(!l),[A,d]=Tde(),[h,m]=ht.useState(cnn),{ref:C,setTransform:E,cancelDrag:_}=gtn({transform:h,onSetTransform:m,enabled:c});let[B,w]=ht.useState([]);B=a??B;const P=ht.useRef(!1),O=ht.useRef(null),G=`${(r==null?void 0:r.length)||0}_${(r==null?void 0:r.editCount)||0}`,Y=()=>{const ie=(d==null?void 0:d.width)>0?d:{width:500,height:500},{center:de,width:Ce,height:xe}=Z.some(ye=>ye.type.startsWith("pcb_"))?otn(Z.filter(ye=>ye.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},fe=Math.min((ie.width??0)/Ce,(ie.height??0)/xe,100)*.75,Ie=tA(df((ie.width??0)/2,(ie.height??0)/2),PE(fe,-fe,0,0),df(-de.x,-de.y));E(Ie)};ht.useEffect(()=>{d!=null&&d.width&&r&&r.length!==0&&(P.current||(Y(),P.current=!0))},[r,d]);const K=ht.useMemo(()=>(r==null?void 0:r.filter(ie=>ie.type.startsWith("pcb_")||ie.type.startsWith("source_")))??[],[G]),Z=ht.useMemo(()=>vqt({circuitJson:K,editEvents:B}),[K,B]),V=ie=>{w([...B,ie]),o==null||o([...B,ie])},se=ie=>{const de=B.map(Ce=>Ce.edit_event_id===ie.edit_event_id?{...Ce,...ie}:Ce);w(de),o==null||o(de)};return ct.jsxs("div",{ref:C,style:{position:"relative"},children:[ct.jsx("div",{ref:A,children:ct.jsxs(ltn,{initialState:n,children:[ct.jsx(lnn,{transform:h,height:t,width:d.width,allowEditing:i,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:V,onModifyEditEvent:se,grid:{spacing:1,view_window:{left:0,right:d.width||500,top:t,bottom:0}},elements:Z,debugGraphics:e},d.width),ct.jsx(utn,{})]})}),l&&!c&&ct.jsx("div",{onClick:()=>{u(!0),Y()},onTouchStart:ie=>{const de=ie.touches[0];O.current={x:de.clientX,y:de.clientY}},onTouchEnd:ie=>{const de=ie.changedTouches[0],Ce=O.current;if(!Ce)return;const xe=Math.abs(de.clientX-Ce.x),fe=Math.abs(de.clientY-Ce.y);xe<10&&fe<10&&(ie.preventDefault(),u(!0),Y()),O.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Hx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:ct.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const Ann=({containerClassName:r,...e})=>{const t=ht.useRef(null),[n,i]=ht.useState(620);return ht.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;i(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),ct.jsx("div",{ref:t,className:r||"rf-w-full rf-h-full",children:ct.jsx(unn,{...e,height:n})})},dnn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',fnn=()=>{ht.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=dnn,document.head.appendChild(e)},[])},hnn=r=>{ht.useEffect(()=>(r?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[r])},eKe=r=>`hsl(${zb.indexOf(r)*137.5%360}, 70%, 50%)`,pnn=({phaseTimings:r})=>{if(!r)return null;const e=Object.values(r).reduce((t,n)=>t+n,0);return ct.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ct.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:zb.map(t=>{const n=r[t]||0,i=n/e*100;return ct.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${i}%`,backgroundColor:eKe(t)},children:ct.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),ct.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},gnn=({renderLog:r})=>{const[e,t]=ht.useState("chronological");if(!r)return ct.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((r==null?void 0:r.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>zb.indexOf(a[0])-zb.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const i=n.reduce((a,[o,s])=>a+s,0);return ct.jsxs("div",{className:"rf-bg-white",children:[ct.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ct.jsx("div",{children:"Render Logs"}),ct.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ct.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ct.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ct.jsx("option",{value:"chronological",children:"Phase Order"}),ct.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ct.jsx(pnn,{phaseTimings:r.phaseTimings}),ct.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ct.jsx("thead",{children:ct.jsxs("tr",{children:[ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ct.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ct.jsx("tbody",{children:n.map(([a,o])=>ct.jsxs("tr",{children:[ct.jsx("td",{className:"rf-p-2",children:zb.indexOf(a)}),ct.jsx("td",{className:"rf-p-2",children:a}),ct.jsx("td",{className:"rf-p-2",children:ct.jsx("div",{className:"rf-w-8",children:ct.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:eKe(a),width:`${o/i*100}%`}})})}),ct.jsx("td",{className:"rf-p-2",children:ct.jsxs("div",{className:"rf-flex w-full",children:[ct.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ct.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/i*100).toFixed(1),"%"]})]})})]},a))})]})]})},mnn=({errorMessage:r,errorStack:e,circuitJsonErrors:t})=>{ht.useEffect(()=>{if(r){const n=new Error(r);e&&(n.stack=e);try{t8.captureException(n)}catch{}}},[r,e]),ht.useEffect(()=>{if(t&&t.length>0)for(const n of t){const i=new Error(n.message||"Circuit JSON Error");n.stack&&(i.stack=n.stack);try{t8.captureException(i,{error_type:n.type})}catch{}}},[t])},ynn="0.0.713",Ude={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Fde=new Map,sH=r=>{const e=Fde.get(r);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},vnn=(r,e,t)=>{if(r===void 0)return{type:"untracked",connection:e.connect(t)};const n=Fde.get(t.name);if(n)return{type:"tracked",store:r,...n};const i={connection:e.connect(t),stores:{}};return Fde.set(t.name,i),{type:"tracked",store:r,...i}},Inn=(r,e={})=>(t,n,i)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(Ude?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Ude?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),r(t,n,i);const{connection:u,...A}=vnn(s,c,l);let d=!0;i.setState=(C,E,_)=>{const B=t(C,E);if(!d)return B;const w=_===void 0?{type:o||"anonymous"}:typeof _=="string"?{type:_}:_;return s===void 0?(u==null||u.send(w,n()),B):(u==null||u.send({...w,type:`${s}/${w.type}`},{...sH(l.name),[s]:i.getState()}),B)};const h=(...C)=>{const E=d;d=!1,t(...C),d=E},m=r(i.setState,n,i);if(A.type==="untracked"?u==null||u.init(m):(A.stores[A.store]=i,u==null||u.init(Object.fromEntries(Object.entries(A.stores).map(([C,E])=>[C,C===A.store?m:E.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let C=!1;const E=i.dispatch;i.dispatch=(..._)=>{(Ude?"production":void 0)!=="production"&&_[0].type==="__setState"&&!C&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),C=!0),E(..._)}}return u.subscribe(C=>{var E;switch(C.type){case"ACTION":if(typeof C.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return Lde(C.payload,_=>{if(_.type==="__setState"){if(s===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
13479
13479
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
13480
13480
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
13481
13481
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
package/dist/standalone.min.js
CHANGED
|
@@ -13267,7 +13267,7 @@ ${M.type}: ${ee}
|
|
|
13267
13267
|
* Copyright (c) 2015 Jon Schlinkert, contributors.
|
|
13268
13268
|
* Licensed under the MIT license.
|
|
13269
13269
|
*/var Xme,Lnt;function kvn(){if(Lnt)return Xme;Lnt=1;var i=Pnt(),e=Pvn();return Xme=function t(n,r){var o=i(n);if(o!=="object"&&o!=="array")throw new Error("expected an object");var a=[];o==="object"&&(n=e(n,r),a={});for(var s in n)if(n.hasOwnProperty(s)){var l=n[s];i(l)==="object"||i(l)==="array"?a[s]=t(l,r):a[s]=l}return a},Xme}kvn();var Zme={exports:{}},Fnt;function Lvn(){return Fnt||(Fnt=1,function(i){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(a,s,l){this.fn=a,this.context=s,this.once=l||!1}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var s=[],l,c;if(this._eventsCount===0)return s;for(c in l=this._events)e.call(l,c)&&s.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(l)):s},o.prototype.listeners=function(s,l){var c=t?t+s:s,u=this._events[c];if(l)return!!u;if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,h=new Array(f);d<f;d++)h[d]=u[d].fn;return h},o.prototype.emit=function(s,l,c,u,d,f){var h=t?t+s:s;if(!this._events[h])return!1;var g=this._events[h],y=arguments.length,v,_;if(g.fn){switch(g.once&&this.removeListener(s,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,l),!0;case 3:return g.fn.call(g.context,l,c),!0;case 4:return g.fn.call(g.context,l,c,u),!0;case 5:return g.fn.call(g.context,l,c,u,d),!0;case 6:return g.fn.call(g.context,l,c,u,d,f),!0}for(_=1,v=new Array(y-1);_<y;_++)v[_-1]=arguments[_];g.fn.apply(g.context,v)}else{var x=g.length,B;for(_=0;_<x;_++)switch(g[_].once&&this.removeListener(s,g[_].fn,void 0,!0),y){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,l);break;case 3:g[_].fn.call(g[_].context,l,c);break;case 4:g[_].fn.call(g[_].context,l,c,u);break;default:if(!v)for(B=1,v=new Array(y-1);B<y;B++)v[B-1]=arguments[B];g[_].fn.apply(g[_].context,v)}}return!0},o.prototype.on=function(s,l,c){var u=new r(l,c||this),d=t?t+s:s;return this._events[d]?this._events[d].fn?this._events[d]=[this._events[d],u]:this._events[d].push(u):(this._events[d]=u,this._eventsCount++),this},o.prototype.once=function(s,l,c){var u=new r(l,c||this,!0),d=t?t+s:s;return this._events[d]?this._events[d].fn?this._events[d]=[this._events[d],u]:this._events[d].push(u):(this._events[d]=u,this._eventsCount++),this},o.prototype.removeListener=function(s,l,c,u){var d=t?t+s:s;if(!this._events[d])return this;if(!l)return--this._eventsCount===0?this._events=new n:delete this._events[d],this;var f=this._events[d];if(f.fn)f.fn===l&&(!u||f.once)&&(!c||f.context===c)&&(--this._eventsCount===0?this._events=new n:delete this._events[d]);else{for(var h=0,g=[],y=f.length;h<y;h++)(f[h].fn!==l||u&&!f[h].once||c&&f[h].context!==c)&&g.push(f[h]);g.length?this._events[d]=g.length===1?g[0]:g:--this._eventsCount===0?this._events=new n:delete this._events[d]}return this},o.prototype.removeAllListeners=function(s){var l;return s?(l=t?t+s:s,this._events[l]&&(--this._eventsCount===0?this._events=new n:delete this._events[l])):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=t,o.EventEmitter=o,i.exports=o}(Zme)),Zme.exports}var $me={exports:{}},Unt;function Fvn(){return Unt||(Unt=1,function(i){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(a,s,l){this.fn=a,this.context=s,this.once=l||!1}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var s=[],l,c;if(this._eventsCount===0)return s;for(c in l=this._events)e.call(l,c)&&s.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(l)):s},o.prototype.listeners=function(s,l){var c=t?t+s:s,u=this._events[c];if(l)return!!u;if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,h=new Array(f);d<f;d++)h[d]=u[d].fn;return h},o.prototype.emit=function(s,l,c,u,d,f){var h=t?t+s:s;if(!this._events[h])return!1;var g=this._events[h],y=arguments.length,v,_;if(g.fn){switch(g.once&&this.removeListener(s,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,l),!0;case 3:return g.fn.call(g.context,l,c),!0;case 4:return g.fn.call(g.context,l,c,u),!0;case 5:return g.fn.call(g.context,l,c,u,d),!0;case 6:return g.fn.call(g.context,l,c,u,d,f),!0}for(_=1,v=new Array(y-1);_<y;_++)v[_-1]=arguments[_];g.fn.apply(g.context,v)}else{var x=g.length,B;for(_=0;_<x;_++)switch(g[_].once&&this.removeListener(s,g[_].fn,void 0,!0),y){case 1:g[_].fn.call(g[_].context);break;case 2:g[_].fn.call(g[_].context,l);break;case 3:g[_].fn.call(g[_].context,l,c);break;case 4:g[_].fn.call(g[_].context,l,c,u);break;default:if(!v)for(B=1,v=new Array(y-1);B<y;B++)v[B-1]=arguments[B];g[_].fn.apply(g[_].context,v)}}return!0},o.prototype.on=function(s,l,c){var u=new r(l,c||this),d=t?t+s:s;return this._events[d]?this._events[d].fn?this._events[d]=[this._events[d],u]:this._events[d].push(u):(this._events[d]=u,this._eventsCount++),this},o.prototype.once=function(s,l,c){var u=new r(l,c||this,!0),d=t?t+s:s;return this._events[d]?this._events[d].fn?this._events[d]=[this._events[d],u]:this._events[d].push(u):(this._events[d]=u,this._eventsCount++),this},o.prototype.removeListener=function(s,l,c,u){var d=t?t+s:s;if(!this._events[d])return this;if(!l)return--this._eventsCount===0?this._events=new n:delete this._events[d],this;var f=this._events[d];if(f.fn)f.fn===l&&(!u||f.once)&&(!c||f.context===c)&&(--this._eventsCount===0?this._events=new n:delete this._events[d]);else{for(var h=0,g=[],y=f.length;h<y;h++)(f[h].fn!==l||u&&!f[h].once||c&&f[h].context!==c)&&g.push(f[h]);g.length?this._events[d]=g.length===1?g[0]:g:--this._eventsCount===0?this._events=new n:delete this._events[d]}return this},o.prototype.removeAllListeners=function(s){var l;return s?(l=t?t+s:s,this._events[l]&&(--this._eventsCount===0?this._events=new n:delete this._events[l])):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=t,o.EventEmitter=o,i.exports=o}($me)),$me.exports}var eye,Gnt;function Uvn(){if(Gnt)return eye;Gnt=1;function i(c,u,d){return u in c?Object.defineProperty(c,u,{value:d,enumerable:!0,configurable:!0,writable:!0}):c[u]=d,c}var e=Fvn(),t=function(){},n={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},r={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},o={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},a={" ":r.space," ":r.space,"\n":r.space,"\r":r.space,"<":r.lt,">":r.gt,'"':r.quote,"'":r.quote,"=":r.equal,"/":r.slash},s=function(u){return a[u]||r.char},l=function(u){var d,f,h,g,y,v,_,x,B,M;u=Object.assign({debug:!1},u);var z=new e,U=n.data,H="",k="",j="",G="",ee="",K="",ie=function(le,ve){if(!(k[0]==="?"||k[0]==="!")){var me={type:le,value:ve};u.debug&&console.log("emit:",me),z.emit("data",me)}};z.stateMachine=(M={},i(M,n.data,(d={},i(d,r.lt,function(){H.trim()&&ie(o.text,H),k="",ee=!1,U=n.tagBegin}),i(d,r.char,function(ue){H+=ue}),d)),i(M,n.cdata,i({},r.char,function(ue){H+=ue,H.substr(-3)==="]]>"&&(ie(o.text,H.slice(0,-3)),H="",U=n.data)})),i(M,n.tagBegin,(f={},i(f,r.space,t),i(f,r.char,function(ue){k=ue,U=n.tagName}),i(f,r.slash,function(){k="",ee=!0}),f)),i(M,n.tagName,(h={},i(h,r.space,function(){ee?U=n.tagEnd:(U=n.attributeNameStart,ie(o.openTag,k))}),i(h,r.gt,function(){ie(ee?o.closeTag:o.openTag,k),H="",U=n.data}),i(h,r.slash,function(){U=n.tagEnd,ie(o.openTag,k)}),i(h,r.char,function(ue){k+=ue,k==="![CDATA["&&(U=n.cdata,H="",k="")}),h)),i(M,n.tagEnd,(g={},i(g,r.gt,function(){ie(o.closeTag,k),H="",U=n.data}),i(g,r.char,t),g)),i(M,n.attributeNameStart,(y={},i(y,r.char,function(ue){j=ue,U=n.attributeName}),i(y,r.gt,function(){H="",U=n.data}),i(y,r.space,t),i(y,r.slash,function(){ee=!0,U=n.tagEnd}),y)),i(M,n.attributeName,(v={},i(v,r.space,function(){U=n.attributeNameEnd}),i(v,r.equal,function(){ie(o.attributeName,j),U=n.attributeValueBegin}),i(v,r.gt,function(){G="",ie(o.attributeName,j),ie(o.attributeValue,G),H="",U=n.data}),i(v,r.slash,function(){ee=!0,G="",ie(o.attributeName,j),ie(o.attributeValue,G),U=n.tagEnd}),i(v,r.char,function(ue){j+=ue}),v)),i(M,n.attributeNameEnd,(_={},i(_,r.space,t),i(_,r.equal,function(){ie(o.attributeName,j),U=n.attributeValueBegin}),i(_,r.gt,function(){G="",ie(o.attributeName,j),ie(o.attributeValue,G),H="",U=n.data}),i(_,r.char,function(ue){G="",ie(o.attributeName,j),ie(o.attributeValue,G),j=ue,U=n.attributeName}),_)),i(M,n.attributeValueBegin,(x={},i(x,r.space,t),i(x,r.quote,function(ue){K=ue,G="",U=n.attributeValue}),i(x,r.gt,function(){G="",ie(o.attributeValue,G),H="",U=n.data}),i(x,r.char,function(ue){K="",G=ue,U=n.attributeValue}),x)),i(M,n.attributeValue,(B={},i(B,r.space,function(ue){K?G+=ue:(ie(o.attributeValue,G),U=n.attributeNameStart)}),i(B,r.quote,function(ue){K===ue?(ie(o.attributeValue,G),U=n.attributeNameStart):G+=ue}),i(B,r.gt,function(ue){K?G+=ue:(ie(o.attributeValue,G),H="",U=n.data)}),i(B,r.slash,function(ue){K?G+=ue:(ie(o.attributeValue,G),ee=!0,U=n.tagEnd)}),i(B,r.char,function(ue){G+=ue}),B)),M);var ce=function(le){u.debug&&console.log(U,le);var ve=z.stateMachine[U],me=ve[s(le)]||ve[r.error]||ve[r.char];me(le)};return z.write=function(ue){for(var le=ue.length,ve=0;ve<le;ve++)ce(ue[ve])},z};return eye={State:n,Action:r,Type:o,create:l},eye}var tye,Ont;function Gvn(){if(Ont)return tye;Ont=1;var i=Lvn(),e=Uvn(),t=e.Type,n={element:"element",text:"text"},r=function(l){return Object.assign({name:"",type:n.element,value:"",parent:null,attributes:{},children:[]},l)},o=function(l){l=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},l);var c=void 0,u=void 0,d=void 0,f=void 0,h=new i,g=function(v){switch(v.type){case t.openTag:if(d===null)d=u,d.name=v.value;else{var _=r({name:v.value,parent:d});d.children.push(_),d=_}break;case t.closeTag:var x=d.parent;if(l.parentNodes||(d.parent=null),d.name!==v.value)break;l.stream&&x===u&&(u.children=[],d.parent=null),(!l.emitTopLevelOnly||x===u)&&(h.emit(l.tagPrefix+d.name,d),h.emit("tag",d.name,d)),d===u&&(c.removeAllListeners("data"),h.emit(l.doneEvent,d),u=null),d=x;break;case t.text:d&&d.children.push(r({type:n.text,value:v.value,parent:l.parentNodes?d:null}));break;case t.attributeName:f=v.value,d.attributes[f]="";break;case t.attributeValue:d.attributes[f]=v.value;break}};return h.reset=function(){c=e.create({debug:l.debug}),c.on("data",g),u=r(),d=null,f="",h.parse=c.write},h.reset(),h},a=function(l,c){c=Object.assign({},c,{stream:!1,tagPrefix:":"});var u=o(c),d=void 0;return u.on("done",function(f){d=f}),u.parse(l),d};return tye={parseSync:a,create:o,NodeType:n},tye}Gvn();var Ovn=function(e){if(e){var t=String(e);return/[&<>]/.test(t)?"<![CDATA[".concat(t.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):t}return""},zvn=function(e){return String(e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},yj=function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.transformAttr,r=n===void 0?function(h,g,y){return"".concat(h,'="').concat(y(g),'"')}:n,o=t.transformNode,a=o===void 0?function(h){return h}:o,s=t.selfClose,l=s===void 0?!0:s;if(Array.isArray(e))return e.map(function(h){return i(h,{transformAttr:r,selfClose:l,transformNode:a})}).join("");var c=a(e);if(c.type==="text")return Ovn(c.value);var u="";for(var d in c.attributes){var f=r(d,c.attributes[d],zvn,c.name);u+=f?" ".concat(f):""}return c.children&&c.children.length>0||!l?"<".concat(c.name).concat(u,">").concat(i(c.children,{transformAttr:r,transformNode:a,selfClose:l}),"</").concat(c.name,">"):"<".concat(c.name).concat(u,"/>")};function Hvn(i,e,t){var f;const{transform:n,shouldDrawErrors:r}=t;if(!r)return[];const{pcb_port_ids:o}=i,a=e.find(h=>h.type==="pcb_port"&&h.pcb_port_id===(o==null?void 0:o[0])),s=e.find(h=>h.type==="pcb_port"&&h.pcb_port_id===(o==null?void 0:o[1]));if(!a||!s){const h=(f=i.message)==null?void 0:f.match(/pcb_via\[#?(pcb_via_\d+)\]/),g=h==null?void 0:h[1],y=e.find(v=>v.type==="pcb_via"&&v.pcb_via_id===g);if(y&&y.type==="pcb_via")return Yvn(i,y,t);if(i.center){const v=Mr(n,{x:i.center.x,y:i.center.y});return[{name:"rect",type:"element",attributes:{x:(v.x-5).toString(),y:(v.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${v.x} ${v.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:v.x.toString(),y:(v.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:i.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}else return[]}const l=Mr(n,{x:a.x,y:a.y}),c=Mr(n,{x:s.x,y:s.y}),u={x:(l.x+c.x)/2,y:(l.y+c.y)/2};return isNaN(l.x)||isNaN(l.y)||isNaN(c.x)||isNaN(c.y)||isNaN(u.x)||isNaN(u.y)?[]:[{name:"line",type:"element",attributes:{x1:l.x.toString(),y1:l.y.toString(),x2:u.x.toString(),y2:u.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"line",type:"element",attributes:{x1:u.x.toString(),y1:u.y.toString(),x2:c.x.toString(),y2:c.y.toString(),stroke:"red","stroke-width":"1.5","stroke-dasharray":"2,2"},children:[],value:""},{name:"rect",type:"element",attributes:{x:(u.x-5).toString(),y:(u.y-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${u.x} ${u.y})`},children:[],value:""},{name:"text",type:"element",attributes:{x:u.x.toString(),y:(u.y-15).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:i.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}function Yvn(i,e,t){const{transform:n}=t;if(i.center&&e){const r=Mr(n,{x:i.center.x,y:i.center.y}),o=Mr(n,{x:e.x,y:e.y}),a=o.x-r.x,s=o.y-r.y,l=Math.sqrt(a*a+s*s),c=Math.atan2(s,a)*180/Math.PI,d=l+10*2,f=20,h=(r.x+o.x)/2,g=(r.y+o.y)/2;return[{name:"rect",type:"element",attributes:{x:(h-d/2).toString(),y:(g-f/2).toString(),width:d.toString(),height:f.toString(),fill:"none",stroke:"red","stroke-width":"1","stroke-dasharray":"3,2",transform:`rotate(${c} ${h} ${g})`},children:[],value:""},{name:"rect",type:"element",attributes:{x:(h-5).toString(),y:(g-5).toString(),width:"10",height:"10",fill:"red",transform:`rotate(45 ${h} ${g})`},children:[],value:""},{name:"text",type:"element",attributes:{x:h.toString(),y:(g-f/2-5).toString(),fill:"red","font-family":"sans-serif","font-size":"12","text-anchor":"middle"},children:[{type:"text",value:i.message||"Pcb Trace Error",name:"",attributes:{},children:[]}],value:""}]}return[]}function Vvn(i,e){const{transform:t,layer:n}=e;if(!i.route||!Array.isArray(i.route))return[];const r=i.route[0],o=i.route[i.route.length-1],a=r.x===o.x&&r.y===o.y,s=i.route.slice(0,a?-1:void 0).map((l,c)=>{const[u,d]=Mr(t,[l.x,l.y]);return c===0?`M ${u} ${d}`:`L ${u} ${d}`}).join(" ")+(a?" Z":"");return[{name:"path",type:"element",attributes:{class:"pcb-fabrication-note-path",stroke:i.color||"rgba(255,255,255,0.5)",fill:"none",d:s,"stroke-width":(i.stroke_width*Math.abs(t.a)).toString(),"data-pcb-component-id":i.pcb_component_id,"data-pcb-fabrication-note-path-id":i.pcb_fabrication_note_path_id},value:"",children:[]}]}function jvn(i,e){const{transform:t,layer:n}=e,{anchor_position:r,anchor_alignment:o,text:a,font_size:s=1,layer:l="top",color:c}=i;if(n&&l!==n)return[];if(!r||typeof r.x!="number"||typeof r.y!="number")return console.error("Invalid anchor_position:",r),[];const[u,d]=Mr(t,[r.x,r.y]),f=s*Math.abs(t.a),h=sf(Sp(u,d),kb(Math.PI/180));return[{name:"text",type:"element",attributes:{x:"0",y:"0","font-family":"Arial, sans-serif","font-size":f.toString(),"text-anchor":"middle","dominant-baseline":"central",transform:Jw(h),class:"pcb-fabrication-note-text",fill:c||"rgba(255,255,255,0.5)"},children:[{type:"text",value:a,name:"",attributes:{},children:[]}],value:""}]}function Kvn(i,e){const{transform:t,colorMap:n}=e,[r,o]=Mr(t,[i.x,i.y]);if(i.shape==="pill"){const a=i.outer_width*Math.abs(t.a),s=i.outer_height*Math.abs(t.a),l=i.hole_width*Math.abs(t.a),c=i.hole_height*Math.abs(t.a),u=a/2,d=l/2,f=s-a;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,d:`M${r-u},${o-f/2} v${f} a${u},${u} 0 0 0 ${a},0 v-${f} a${u},${u} 0 0 0 -${a},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,d:`M${r-d},${o-(c-l)/2} v${c-l} a${d},${d} 0 0 0 ${l},0 v-${c-l} a${d},${d} 0 0 0 -${l},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circle"){const a=i.outer_diameter*Math.abs(t.a),s=i.outer_diameter*Math.abs(t.a),l=i.hole_diameter*Math.abs(t.a),c=i.hole_diameter*Math.abs(t.a),u=Math.min(a,s)/2,d=Math.min(l,c)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:r.toString(),cy:o.toString(),r:u.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:r.toString(),cy:o.toString(),r:d.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circular_hole_with_rect_pad"){const a=i.hole_diameter*Math.abs(t.a),s=i.rect_pad_width*Math.abs(t.a),l=i.rect_pad_height*Math.abs(t.a),c=a/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:n.copper.top,x:(r-s/2).toString(),y:(o-l/2).toString(),width:s.toString(),height:l.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:r.toString(),cy:o.toString(),r:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="pill_hole_with_rect_pad"){const a=i.rect_pad_width*Math.abs(t.a),s=i.rect_pad_height*Math.abs(t.a),l=i.hole_height*Math.abs(t.a),c=i.hole_width*Math.abs(t.a),u=Math.min(l,c)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"pcb-hole-outer-pad",fill:n.copper.top,x:(r-a/2).toString(),y:(o-s/2).toString(),width:a.toString(),height:s.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,x:(r-c/2).toString(),y:(o-l/2).toString(),width:c.toString(),height:l.toString(),rx:u.toString(),ry:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}function Jvn(i,e){const{transform:t,layer:n,colorMap:r}=e;if(!i.route||!Array.isArray(i.route))return[];let o=i.route.map((u,d)=>{const[f,h]=Mr(t,[u.x,u.y]);return d===0?`M ${f} ${h}`:`L ${f} ${h}`}).join(" ");const a=i.route[0],s=i.route[i.route.length-1];a&&s&&a.x===s.x&&a.y===s.y&&(o+=" Z");const l=i.layer||"top";if(n&&l!==n)return[];const c=l==="bottom"?r.silkscreen.bottom:r.silkscreen.top;return[{name:"path",type:"element",attributes:{class:`pcb-silkscreen pcb-silkscreen-${l}`,d:o,fill:"none",stroke:c,"stroke-width":(i.stroke_width*Math.abs(t.a)).toString(),"stroke-linecap":"round","stroke-linejoin":"round","data-pcb-component-id":i.pcb_component_id,"data-pcb-silkscreen-path-id":i.pcb_silkscreen_path_id},value:"",children:[]}]}function Wvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{anchor_position:o,text:a,font_size:s=1,layer:l="top",ccw_rotation:c=0,anchor_alignment:u="center"}=i;if(n&&l!==n)return[];if(!o||typeof o.x!="number"||typeof o.y!="number")return console.error("Invalid anchor_position:",o),[];const[d,f]=Mr(t,[o.x,o.y]),h=s*Math.abs(t.a);let g="middle",y="central",v=0,_=0;switch(u){case"top_left":g="start",y="text-before-edge";break;case"top_center":g="middle",y="text-before-edge";break;case"top_right":g="end",y="text-before-edge";break;case"center_left":g="start",y="central";break;case"center_right":g="end",y="central";break;case"bottom_left":g="start",y="text-after-edge";break;case"bottom_center":g="middle",y="text-after-edge";break;case"bottom_right":g="end",y="text-after-edge";break;case"center":default:g="middle",y="central";break}const x=sf(Sp(d,f),kb(c*Math.PI/180),...l==="bottom"?[mx(-1,1)]:[]),B=l==="bottom"?r.silkscreen.bottom:r.silkscreen.top,M=a.split(`
|
|
13270
|
-
`),z=M.length===1?[{type:"text",value:a,name:"",attributes:{},children:[]}]:M.map((H,k)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...k>0?{dy:h.toString()}:{}},children:[{type:"text",value:H,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:v.toString(),dy:_.toString(),fill:B,"font-family":"Arial, sans-serif","font-size":h.toString(),"text-anchor":g,"dominant-baseline":y,transform:Jw(x),class:`pcb-silkscreen-text pcb-silkscreen-${l}`,"data-pcb-silkscreen-text-id":i.pcb_component_id,stroke:"none"},children:z,value:""}]}function qvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{center:o,width:a,height:s,layer:l="top",pcb_silkscreen_rect_id:c,stroke_width:u,is_filled:d,has_stroke:f,is_stroke_dashed:h}=i;if(n&&l!==n)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof a!="number"||typeof s!="number")return console.error("Invalid rectangle data:",{center:o,width:a,height:s}),[];const[g,y]=Mr(t,[o.x,o.y]),v=a*Math.abs(t.a),_=s*Math.abs(t.d),x=u*Math.abs(t.a),B=l==="bottom"?r.silkscreen.bottom:r.silkscreen.top,M={x:(g-v/2).toString(),y:(y-_/2).toString(),width:v.toString(),height:_.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${l}`,"data-pcb-silkscreen-rect-id":c};M.fill=d?B:"none";let z;if(f===void 0?z=x>0:z=f,z){if(M.stroke=B,M["stroke-width"]=x.toString(),h){const H=.1*Math.abs(t.a),k=.05*Math.abs(t.a);M["stroke-dasharray"]=`${H} ${k}`}}else M.stroke="none";return[{name:"rect",type:"element",attributes:M,value:"",children:[]}]}function Xvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{center:o,radius:a,layer:s="top",pcb_silkscreen_circle_id:l,stroke_width:c=1}=i;if(n&&s!==n)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof a!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:o,radius:a}),[];const[u,d]=Mr(t,[o.x,o.y]),f=a*Math.abs(t.a),h=c*Math.abs(t.a),g=s==="bottom"?r.silkscreen.bottom:r.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:u.toString(),cy:d.toString(),r:f.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${s}`,stroke:g,"stroke-width":h.toString(),"data-pcb-silkscreen-circle-id":l},value:"",children:[]}]}function Zvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{x1:o,y1:a,x2:s,y2:l,stroke_width:c,layer:u="top",pcb_silkscreen_line_id:d}=i;if(n&&u!==n)return[];if(typeof o!="number"||typeof a!="number"||typeof s!="number"||typeof l!="number")return console.error("Invalid coordinates:",{x1:o,y1:a,x2:s,y2:l}),[];const[f,h]=Mr(t,[o,a]),[g,y]=Mr(t,[s,l]),v=c*Math.abs(t.a),_=u==="bottom"?r.silkscreen.bottom:r.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:f.toString(),y1:h.toString(),x2:g.toString(),y2:y.toString(),stroke:_,"stroke-width":v.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${u}`,"data-pcb-silkscreen-line-id":d},value:"",children:[]}]}function $vn(i){const e=[];for(let t=0;t<i.length-1;t++)e.push([i[t],i[t+1]]);return e}var IE={copper:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",debugComponent:{fill:null,stroke:null}};IE.drill,IE.silkscreen.top,IE.silkscreen.bottom,IE.copper.top,IE.copper.bottom;function yN(i,e=IE){return e.copper[i]??"white"}var e_n={bottom:"rgb(105, 105, 105)",top:"rgb(105, 105, 105)"};function vj(i){return e_n[i]??"rgb(105, 105, 105)"}function t_n(i,e){const{transform:t,layer:n,colorMap:r}=e;if(!i.route||!Array.isArray(i.route)||i.route.length<2)return[];const o=$vn(i.route),a=[];for(const[s,l]of o){const c=Mr(t,[s.x,s.y]),u=Mr(t,[l.x,l.y]),d="layer"in s?s.layer:"layer"in l?l.layer:null;if(!d||n&&d!==n)continue;const f=r.soldermask[d]??yN(d,r),h="width"in s?s.width:"width"in l?l.width:null,g={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:f,fill:"none",d:`M ${c[0]} ${c[1]} L ${u[0]} ${u[1]}`,"stroke-width":h?(h*Math.abs(t.a)).toString():"0.3","stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-layer":d}};a.push(g)}return a.sort((s,l)=>{const c=s.attributes["data-layer"],u=l.attributes["data-layer"];return c==="bottom"&&u!=="bottom"?-1:c==="top"&&u!=="top"?1:0}),a}function n_n(i,e){const{transform:t,layer:n,colorMap:r}=e;if(n&&i.layer!==n)return[];if(i.shape==="rect"||i.shape==="rotated_rect"){const o=i.width*Math.abs(t.a),a=i.height*Math.abs(t.d),[s,l]=Mr(t,[i.x,i.y]);return i.shape==="rotated_rect"&&i.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(-o/2).toString(),y:(-a/2).toString(),width:o.toString(),height:a.toString(),transform:`translate(${s} ${l}) rotate(${-i.ccw_rotation})`,"data-layer":i.layer}}]:[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(s-o/2).toString(),y:(l-a/2).toString(),width:o.toString(),height:a.toString(),"data-layer":i.layer}}]}if(i.shape==="pill"){const o=i.width*Math.abs(t.a),a=i.height*Math.abs(t.d),s=i.radius*Math.abs(t.a),[l,c]=Mr(t,[i.x,i.y]);return[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(l-o/2).toString(),y:(c-a/2).toString(),width:o.toString(),height:a.toString(),rx:s.toString(),ry:s.toString(),"data-layer":i.layer}}]}if(i.shape==="circle"){const o=i.radius*Math.abs(t.a),[a,s]=Mr(t,[i.x,i.y]);return[{name:"circle",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),cx:a.toString(),cy:s.toString(),r:o.toString(),"data-layer":i.layer}}]}if(i.shape==="polygon"){const o=(i.points??[]).map(a=>Mr(t,[a.x,a.y]));return[{name:"polygon",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer),points:o.map(a=>a.join(",")).join(" "),"data-layer":i.layer}}]}return[]}function znt(i,e){const{transform:t,colorMap:n}=e,{width:r,height:o,center:a,outline:s}=i;let l;if(s&&Array.isArray(s)&&s.length>=3)l=s.map((c,u)=>{const[d,f]=Mr(t,[c.x,c.y]);return u===0?`M ${d} ${f}`:`L ${d} ${f}`}).join(" ");else{const c=r/2,u=o/2,d=Mr(t,[a.x-c,a.y-u]),f=Mr(t,[a.x+c,a.y-u]),h=Mr(t,[a.x+c,a.y+u]),g=Mr(t,[a.x-c,a.y+u]);l=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${h[0]} ${h[1]} L ${g[0]} ${g[1]}`}return l+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:l,fill:"none",stroke:n.boardOutline,"stroke-width":(.1*Math.abs(t.a)).toString()}}]}function i_n(i,e){const{transform:t,colorMap:n}=e,[r,o]=Mr(t,[i.x,i.y]),a=i.outer_diameter*Math.abs(t.a),s=i.outer_diameter*Math.abs(t.a),l=i.hole_diameter*Math.abs(t.a),c=i.hole_diameter*Math.abs(t.a),u=Math.min(a,s)/2,d=Math.min(l,c)/2;return{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:r.toString(),cy:o.toString(),r:u.toString()}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:r.toString(),cy:o.toString(),r:d.toString()}}]}}function r_n(i,e){const{transform:t,colorMap:n}=e,[r,o]=Mr(t,[i.x,i.y]);if(i.hole_shape==="circle"||i.hole_shape==="square"){const a=i.hole_diameter*Math.abs(t.a),s=a/2;return i.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"pcb-hole",cx:r.toString(),cy:o.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"pcb-hole",x:(r-s).toString(),y:(o-s).toString(),width:a.toString(),height:a.toString(),fill:n.drill},children:[],value:""}]}if(i.hole_shape==="oval"){const a=i.hole_width*Math.abs(t.a),s=i.hole_height*Math.abs(t.a),l=a/2,c=s/2;return[{name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:r.toString(),cy:o.toString(),rx:l.toString(),ry:c.toString(),fill:n.drill},children:[],value:""}]}return[]}var o_n=(i,e)=>{const t=d9(e).pcb_smtpad.get(i);if(t&&"x"in t&&"y"in t)return{x:t.x,y:t.y};const n=d9(e).pcb_plated_hole.get(i);return n&&"x"in n&&"y"in n?{x:n.x,y:n.y}:null},a_n=(i,e,t,n)=>{const r=t.getIdsConnectedToNet(e);let o=null,a=1/0;for(const s of r){const l=o_n(s,n);if(l){const c=i.x-l.x,u=i.y-l.y,d=Math.sqrt(c*c+u*u);d>0&&d<a&&(a=d,o=l)}}return o};function s_n(i,e){const{transform:t}=e,n=x5(i),r=i.filter(l=>l.type==="pcb_port"),o=i.filter(l=>l.type==="source_trace"),a=[];r.forEach((l,c)=>{const u=l.pcb_port_id;if(!u)return;const d=n.getNetConnectedToId(u);if(!d)return;let f=!1;const h=d9(i).source_port.getWhere({pcb_port_id:u});if(h&&h.source_port_id){const v=h.source_port_id;for(const _ of o)if(Array.isArray(_.connected_source_port_ids)&&_.connected_source_port_ids.includes(v)&&Array.isArray(_.connected_source_net_ids)&&_.connected_source_net_ids.length>0){f=!0;break}}const g={x:l.x,y:l.y},y=a_n(g,d,n,i);y&&a.push({key:`${u}-${c}`,startPoint:g,endPoint:y,isInNet:f})});const s=[];for(const l of a){const c=Mr(t,[l.startPoint.x,l.startPoint.y]),u=Mr(t,[l.endPoint.x,l.endPoint.y]),d={x1:c[0].toString(),y1:c[1].toString(),x2:u[0].toString(),y2:u[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6"};s.push({name:"line",type:"element",attributes:d,value:"",children:[]})}return s}function l_n(i,e){const{transform:t,colorMap:n}=e;if(i.shape==="rect"){const r=i,[o,a]=Mr(t,[r.center.x,r.center.y]),s=r.width*Math.abs(t.a),l=r.height*Math.abs(t.d),c=-(r.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-cutout pcb-cutout-rect",x:(-s/2).toString(),y:(-l/2).toString(),width:s.toString(),height:l.toString(),fill:n.drill,transform:Jw(sf(Sp(o,a),kb(c*Math.PI/180)))},children:[],value:""}]}if(i.shape==="circle"){const r=i,[o,a]=Mr(t,[r.center.x,r.center.y]),s=r.radius*Math.abs(t.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:o.toString(),cy:a.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]}if(i.shape==="polygon"){const r=i;return!r.points||r.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:r.points.map(s=>Mr(t,[s.x,s.y])).map(s=>`${s[0]},${s[1]}`).join(" "),fill:n.drill},children:[],value:""}]}return[]}function c_n(i,e){var f,h;const{transform:t}=e,{center:n,width:r,height:o,rotation:a=0}=i,[s,l]=Mr(t,[n.x,n.y]),c=r*Math.abs(t.a),u=o*Math.abs(t.d),d=`translate(${s}, ${l}) rotate(${-a}) scale(1, -1)`;return!((f=e.colorMap.debugComponent)!=null&&f.fill)&&!((h=e.colorMap.debugComponent)!=null&&h.stroke)?[]:[{name:"g",type:"element",attributes:{transform:d},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-c/2).toString(),y:(-u/2).toString(),width:c.toString(),height:u.toString(),fill:e.colorMap.debugComponent.fill??"transparent",stroke:e.colorMap.debugComponent.stroke??"transparent"}}],value:""}]}function pP(i){const e=i.find(t=>t.type==="project_software_metadata"||t.type==="source_project_metadata");return e==null?void 0:e.software_used_string}var u_n={version:"0.0.171"},gP=u_n.version,Hnt=["pcb_trace_error","pcb_plated_hole","pcb_fabrication_note_text","pcb_fabrication_note_path","pcb_silkscreen_text","pcb_silkscreen_path","pcb_via","pcb_cutout","pcb_smtpad","pcb_trace","pcb_component","pcb_board"];function Ynt(i,e){var gt,Fe,Ke,tt,Ct,Rt,yt,et;const t=(e==null?void 0:e.drawPaddingOutsideBoard)??!0,n=e==null?void 0:e.layer,r=e==null?void 0:e.colorOverrides,o={copper:{top:((gt=r==null?void 0:r.copper)==null?void 0:gt.top)??IE.copper.top,bottom:((Fe=r==null?void 0:r.copper)==null?void 0:Fe.bottom)??IE.copper.bottom},drill:(r==null?void 0:r.drill)??IE.drill,silkscreen:{top:((Ke=r==null?void 0:r.silkscreen)==null?void 0:Ke.top)??IE.silkscreen.top,bottom:((tt=r==null?void 0:r.silkscreen)==null?void 0:tt.bottom)??IE.silkscreen.bottom},boardOutline:(r==null?void 0:r.boardOutline)??IE.boardOutline,soldermask:{top:((Ct=r==null?void 0:r.soldermask)==null?void 0:Ct.top)??IE.soldermask.top,bottom:((Rt=r==null?void 0:r.soldermask)==null?void 0:Rt.bottom)??IE.soldermask.bottom},debugComponent:{fill:((yt=r==null?void 0:r.debugComponent)==null?void 0:yt.fill)??IE.debugComponent.fill,stroke:((et=r==null?void 0:r.debugComponent)==null?void 0:et.stroke)??IE.debugComponent.stroke}};let a=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,d=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const Nt of i)if(Nt.type==="pcb_board")Nt.outline&&Array.isArray(Nt.outline)&&Nt.outline.length>=3?(Je(Nt.outline),ot(Nt.outline)):"center"in Nt&&"width"in Nt&&"height"in Nt&&(xe(Nt.center,Nt.width,Nt.height),Oe(Nt.center,Nt.width,Nt.height));else if("x"in Nt&&"y"in Nt)xe({x:Nt.x,y:Nt.y},0,0);else if(Nt.type==="pcb_smtpad"){const St=Nt;St.shape==="rect"||St.shape==="rotated_rect"||St.shape==="pill"?xe({x:St.x,y:St.y},St.width,St.height):St.shape==="circle"?xe({x:St.x,y:St.y},St.radius*2,St.radius*2):St.shape==="polygon"&&ct(St.points)}else"route"in Nt?ct(Nt.route):(Nt.type==="pcb_silkscreen_text"||Nt.type==="pcb_silkscreen_rect"||Nt.type==="pcb_silkscreen_circle"||Nt.type==="pcb_silkscreen_line")&&kt(Nt);const g=t?1:0,y=t||!isFinite(u)?a:u,v=t||!isFinite(d)?s:d,_=t||!isFinite(f)?l:f,x=t||!isFinite(h)?c:h,B=_-y+2*g,M=x-v+2*g;let z=(e==null?void 0:e.width)??800,U=(e==null?void 0:e.height)??600;if(e!=null&&e.matchBoardAspectRatio){const Nt=f-u,St=h-d;if(Nt>0&&St>0){const Qt=Nt/St;e!=null&&e.width&&!(e!=null&&e.height)?U=e.width/Qt:e!=null&&e.height&&!(e!=null&&e.width)?z=e.height*Qt:U=z/Qt}}const H=[];for(const Nt of i)"route"in Nt&&Nt.route!==void 0&&H.push(Nt.route);const k=z/B,j=U/M,G=Math.min(k,j),ee=(z-B*G)/2,K=(U-M*G)/2,ie=sf(Sp(ee-y*G+g*G,U-K+v*G-g*G),mx(G,-G)),ce={transform:ie,layer:n,shouldDrawErrors:e==null?void 0:e.shouldDrawErrors,drawPaddingOutsideBoard:t,colorMap:o};function ue(Nt){if(Nt.type==="pcb_smtpad")return Nt.layer==="top"||Nt.layer==="bottom"?Nt.layer:void 0;if(Nt.type==="pcb_trace")for(const St of Nt.route??[]){const Qt="layer"in St&&St.layer||"from_layer"in St&&St.from_layer||"to_layer"in St&&St.to_layer||void 0;if(Qt==="top"||Qt==="bottom")return Qt}}function le(Nt){return Nt.type==="pcb_trace"||Nt.type==="pcb_smtpad"}let ve=i.sort((Nt,St)=>{const Qt=ue(Nt),Ot=ue(St);if(le(Nt)&&le(St)&&Qt!==Ot){if(Qt==="top")return 1;if(Ot==="top"||Qt==="bottom")return-1;if(Ot==="bottom")return 1}return(Hnt.indexOf(St.type)??9999)-(Hnt.indexOf(Nt.type)??9999)}).flatMap(Nt=>d_n({elm:Nt,circuitJson:i,ctx:ce}));for(const Nt of i)if("stroke_width"in Nt){String(G*Nt.stroke_width);break}if(e!=null&&e.shouldDrawRatsNest){const Nt=s_n(i,ce);ve=ve.concat(Nt)}const me=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]},{name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:(e==null?void 0:e.backgroundColor)??"#000",width:z.toString(),height:U.toString()},children:[]}];t&&me.push(A_n(ie,a,s,l,c)),me.push(...ve);const Me=pP(i),Be=gP,Ne={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:z.toString(),height:U.toString(),...Me&&{"data-software-used-string":Me},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":Be}},value:"",children:me.filter(Nt=>Nt!==null)};try{return yj(Ne)}catch(Nt){throw console.error("Error stringifying SVG object:",Nt),Nt}function xe(Nt,St,Qt){const Ot=St/2,tn=Qt/2;a=Math.min(a,Nt.x-Ot),s=Math.min(s,Nt.y-tn),l=Math.max(l,Nt.x+Ot),c=Math.max(c,Nt.y+tn)}function Oe(Nt,St,Qt){const Ot=St/2,tn=Qt/2;u=Math.min(u,Nt.x-Ot),d=Math.min(d,Nt.y-tn),f=Math.max(f,Nt.x+Ot),h=Math.max(h,Nt.y+tn)}function Je(Nt){for(const St of Nt)a=Math.min(a,St.x),s=Math.min(s,St.y),l=Math.max(l,St.x),c=Math.max(c,St.y)}function ot(Nt){for(const St of Nt)u=Math.min(u,St.x),d=Math.min(d,St.y),f=Math.max(f,St.x),h=Math.max(h,St.y)}function ct(Nt){for(const St of Nt)a=Math.min(a,St.x),s=Math.min(s,St.y),l=Math.max(l,St.x),c=Math.max(c,St.y)}function kt(Nt){if(Nt.type==="pcb_silkscreen_text")xe(Nt.anchor_position,0,0);else if(Nt.type==="pcb_silkscreen_path")ct(Nt.route);else if(Nt.type==="pcb_silkscreen_rect")xe(Nt.center,Nt.width,Nt.height);else if(Nt.type==="pcb_silkscreen_circle")xe(Nt.center,Nt.radius*2,Nt.radius*2);else if(Nt.type==="pcb_silkscreen_line")xe({x:Nt.x1,y:Nt.y1},0,0),xe({x:Nt.x2,y:Nt.y2},0,0);else if(Nt.type==="pcb_cutout"){const St=Nt;St.shape==="rect"?xe(St.center,St.width,St.height):St.shape==="circle"?xe(St.center,St.radius*2,St.radius*2):St.shape==="polygon"&&ct(St.points)}}}function d_n({elm:i,circuitJson:e,ctx:t}){switch(i.type){case"pcb_trace_error":return Hvn(i,e,t).filter(Boolean);case"pcb_component":return c_n(i,t).filter(Boolean);case"pcb_trace":return t_n(i,t);case"pcb_plated_hole":return Kvn(i,t).filter(Boolean);case"pcb_hole":return r_n(i,t);case"pcb_smtpad":return n_n(i,t);case"pcb_silkscreen_text":return Wvn(i,t);case"pcb_silkscreen_rect":return qvn(i,t);case"pcb_silkscreen_circle":return Xvn(i,t);case"pcb_silkscreen_line":return Zvn(i,t);case"pcb_fabrication_note_path":return Vvn(i,t);case"pcb_fabrication_note_text":return jvn(i,t);case"pcb_silkscreen_path":return Jvn(i,t);case"pcb_board":return t.drawPaddingOutsideBoard?znt(i,t):[];case"pcb_via":return i_n(i,t);case"pcb_cutout":return l_n(i,t);default:return[]}}function A_n(i,e,t,n,r){const[o,a]=Mr(i,[e,t]),[s,l]=Mr(i,[n,r]),c=Math.abs(s-o),u=Math.abs(l-a),d=Math.min(o,s),f=Math.min(a,l);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:d.toString(),y:f.toString(),width:c.toString(),height:u.toString()}}}var f_n=Ynt,_j={fill:"none",stroke:"rgb(0,0,0)",strokeOpacity:"0.8",strokeWidthFactor:.2};function h_n(i,e,t={}){const{width:n,height:r,center:o,outline:a}=i;let s;if(a&&Array.isArray(a)&&a.length>=3)s=a.map((l,c)=>{const[u,d]=Mr(e,[l.x,l.y]);return c===0?`M ${u} ${d}`:`L ${u} ${d}`}).join(" ");else{const l=n/2,c=r/2,u=Mr(e,[o.x-l,o.y-c]),d=Mr(e,[o.x+l,o.y-c]),f=Mr(e,[o.x+l,o.y+c]),h=Mr(e,[o.x-l,o.y+c]);s=`M ${u[0]} ${u[1]} L ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${h[0]} ${h[1]}`}return s+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:s,fill:t.fill??_j.fill,stroke:t.stroke??_j.stroke,"stroke-opacity":t.strokeOpacity??_j.strokeOpacity,"stroke-width":((t.strokeWidthFactor??_j.strokeWidthFactor)*Math.abs(e.a)).toString()}}]}var p_n={pin_number:.15,negated_pin_number:.15*.8,reference_designator:.18,manufacturer_number:.18,net_label:.18,error:.05},vN=(i,e)=>e??p_n[i],dw=(i,e,t)=>Math.abs(i.a)*vN(e,t);function g_n(i,e){const{elm:t,portPosition:n,name:r,arePinsInterchangeable:o}=i,{transform:a}=e,{center:s,width:l,height:c,rotation:u=0,layer:d="top"}=t;if(!s||typeof l!="number"||typeof c!="number")return null;const[f,h]=Mr(a,[s.x,s.y]),[g,y]=Mr(a,[n.x,n.y]),v=l*Math.abs(a.a),_=c*Math.abs(a.d),x=y>h,B=g<f,M=[m_n(v,_,u,d),y_n(v,_,r??"")];return o||M.push(v_n(v,_,u,d,x,B)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${f}, ${h}) scale(1, -1)`},children:M}}function m_n(i,e,t,n){const r=i/2,o=e/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:__n(r,o,t),"stroke-width":.8.toFixed(2),transform:`rotate(${-t})`,"stroke-dasharray":n==="bottom"?"2,2":""},value:"",children:[]}}function y_n(i,e,t,n){const r=Math.min(i,e),l=Math.min(58,Math.max(3,r*.8)),c=e>i;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${l.toFixed(1)}px`,transform:c?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:t||"",name:"",attributes:{},children:[]}],value:""}}function v_n(i,e,t,n,r,o){const a=i/2,s=e/2,l=Math.min(a,s)*.5;let c;return r&&o?c=[[-a,-s],[-a+l,-s],[-a,-s+l]]:r&&!o?c=[[a,-s],[a-l,-s],[a,-s+l]]:!r&&o?c=[[-a,s],[-a+l,s],[-a,s-l]]:c=[[a,s],[a-l,s],[a,s-l]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:c.map(d=>d.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-t})`},value:"",children:[]}}function __n(i,e,t){const n=(s,l,c)=>{const u=Math.PI/180*c,d=Math.cos(u),f=Math.sin(u);return[s*d-l*f,s*f+l*d]};return`${[[-i,-e],[i,-e],[i,e],[-i,e]].map(([s,l])=>n(s,l,t)).map(([s,l],c)=>c===0?`M${s},${l}`:`L${s},${l}`).join(" ")} Z`}var nye="rgb(190, 190, 190)";function I_n(i,e){const{transform:t}=e,[n,r]=Mr(t,[i.x,i.y]);if(i.hole_shape==="circle"||i.hole_shape==="square"){const o=i.hole_diameter*Math.abs(t.a),a=o/2;return i.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:r.toString(),r:a.toString(),fill:nye},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(n-a).toString(),y:(r-a).toString(),width:o.toString(),height:o.toString(),fill:nye},children:[],value:""}]}if(i.hole_shape==="oval"){const o=i.hole_width*Math.abs(t.a),a=i.hole_height*Math.abs(t.a),s=o/2,l=a/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:r.toString(),rx:s.toString(),ry:l.toString(),fill:nye},children:[],value:""}]}return[]}var Ij="rgb(210, 210, 210)",Cj="rgb(190, 190, 190)";function C_n(i,e){const{transform:t}=e,[n,r]=Mr(t,[i.x,i.y]);if(i.shape==="pill"){const o=i.outer_width*Math.abs(t.a),a=i.outer_height*Math.abs(t.a),s=i.hole_width*Math.abs(t.a),l=i.hole_height*Math.abs(t.a),c=o/2,u=a-o,d=s/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:Ij,d:`M${n-c},${r-u/2} v${u} a${c},${c} 0 0 0 ${o},0 v-${u} a${c},${c} 0 0 0 -${o},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,d:`M${n-d},${r-(l-s)/2} v${l-s} a${d},${d} 0 0 0 ${s},0 v-${l-s} a${d},${d} 0 0 0 -${s},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circle"){const o=i.outer_diameter*Math.abs(t.a),a=i.outer_diameter*Math.abs(t.a),s=i.hole_diameter*Math.abs(t.a),l=i.hole_diameter*Math.abs(t.a),c=Math.min(o,a)/2,u=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:Ij,cx:n.toString(),cy:r.toString(),r:c.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,cx:n.toString(),cy:r.toString(),r:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circular_hole_with_rect_pad"){const o=i.hole_diameter*Math.abs(t.a),a=i.rect_pad_width*Math.abs(t.a),s=i.rect_pad_height*Math.abs(t.a),l=o/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:Ij,x:(n-a/2).toString(),y:(r-s/2).toString(),width:a.toString(),height:s.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,cx:n.toString(),cy:r.toString(),r:l.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="pill_hole_with_rect_pad"){const o=i.rect_pad_width*Math.abs(t.a),a=i.rect_pad_height*Math.abs(t.a),s=i.hole_height*Math.abs(t.a),l=i.hole_width*Math.abs(t.a),c=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:Ij,x:(n-o/2).toString(),y:(r-a/2).toString(),width:o.toString(),height:a.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,x:(n-l/2).toString(),y:(r-s/2).toString(),width:l.toString(),height:s.toString(),rx:c.toString(),ry:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}var mP="rgb(210, 210, 210)";function x_n(i,e){const{transform:t}=e;if(i.shape==="rect"||i.shape==="rotated_rect"){const n=i.width*Math.abs(t.a),r=i.height*Math.abs(t.d),[o,a]=Mr(t,[i.x,i.y]);return i.shape==="rotated_rect"&&i.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(-n/2).toString(),y:(-r/2).toString(),width:n.toString(),height:r.toString(),transform:`translate(${o} ${a}) rotate(${-i.ccw_rotation})`,"data-layer":i.layer},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(o-n/2).toString(),y:(a-r/2).toString(),width:n.toString(),height:r.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="pill"){const n=i.width*Math.abs(t.a),r=i.height*Math.abs(t.d),o=i.radius*Math.abs(t.a),[a,s]=Mr(t,[i.x,i.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(a-n/2).toString(),y:(s-r/2).toString(),width:n.toString(),height:r.toString(),rx:o.toString(),ry:o.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="circle"){const n=i.radius*Math.abs(t.a),[r,o]=Mr(t,[i.x,i.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:mP,cx:r.toString(),cy:o.toString(),r:n.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="polygon"){const n=(i.points??[]).map(r=>Mr(t,[r.x,r.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:mP,points:n.map(r=>r.join(",")).join(" "),"data-layer":i.layer},value:"",children:[]}]}return[]}var Vnt=["pcb_component","pcb_smtpad","pcb_hole","pcb_plated_hole","pcb_board"];function jnt(i,e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(const U of i)if(U.type==="pcb_board"){const H=U.center,k=U.width||0,j=U.height||0;t=Math.min(t,H.x-k/2),n=Math.min(n,H.y-j/2),r=Math.max(r,H.x+k/2),o=Math.max(o,H.y+j/2)}const a=1,s=r-t+2*a,l=o-n+2*a,c=(e==null?void 0:e.width)??800,u=(e==null?void 0:e.height)??600,d=c/s,f=u/l,h=Math.min(d,f),g=(c-s*h)/2,y=(u-l*h)/2,v=sf(Sp(g-t*h+a*h,u-y+n*h-a*h),mx(h,-h)),_={transform:v},x=i.sort((U,H)=>(Vnt.indexOf(H.type)??9999)-(Vnt.indexOf(U.type)??9999)).flatMap(U=>E_n(U,_,i)),B=pP(i),M=gP,z={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:c.toString(),height:u.toString(),...B&&{"data-software-used-string":B},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":M}},value:"",children:[{name:"style",type:"element",children:[{type:"text",value:`
|
|
13270
|
+
`),z=M.length===1?[{type:"text",value:a,name:"",attributes:{},children:[]}]:M.map((H,k)=>({type:"element",name:"tspan",value:"",attributes:{x:"0",...k>0?{dy:h.toString()}:{}},children:[{type:"text",value:H,name:"",attributes:{},children:[]}]}));return[{name:"text",type:"element",attributes:{x:"0",y:"0",dx:v.toString(),dy:_.toString(),fill:B,"font-family":"Arial, sans-serif","font-size":h.toString(),"text-anchor":g,"dominant-baseline":y,transform:Jw(x),class:`pcb-silkscreen-text pcb-silkscreen-${l}`,"data-pcb-silkscreen-text-id":i.pcb_component_id,stroke:"none"},children:z,value:""}]}function qvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{center:o,width:a,height:s,layer:l="top",pcb_silkscreen_rect_id:c,stroke_width:u,is_filled:d,has_stroke:f,is_stroke_dashed:h}=i;if(n&&l!==n)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof a!="number"||typeof s!="number")return console.error("Invalid rectangle data:",{center:o,width:a,height:s}),[];const[g,y]=Mr(t,[o.x,o.y]),v=a*Math.abs(t.a),_=s*Math.abs(t.d),x=u*Math.abs(t.a),B=l==="bottom"?r.silkscreen.bottom:r.silkscreen.top,M={x:(g-v/2).toString(),y:(y-_/2).toString(),width:v.toString(),height:_.toString(),class:`pcb-silkscreen-rect pcb-silkscreen-${l}`,"data-pcb-silkscreen-rect-id":c};M.fill=d?B:"none";let z;if(f===void 0?z=x>0:z=f,z){if(M.stroke=B,M["stroke-width"]=x.toString(),h){const H=.1*Math.abs(t.a),k=.05*Math.abs(t.a);M["stroke-dasharray"]=`${H} ${k}`}}else M.stroke="none";return[{name:"rect",type:"element",attributes:M,value:"",children:[]}]}function Xvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{center:o,radius:a,layer:s="top",pcb_silkscreen_circle_id:l,stroke_width:c=1}=i;if(n&&s!==n)return[];if(!o||typeof o.x!="number"||typeof o.y!="number"||typeof a!="number")return console.error("Invalid PCB Silkscreen Circle data:",{center:o,radius:a}),[];const[u,d]=Mr(t,[o.x,o.y]),f=a*Math.abs(t.a),h=c*Math.abs(t.a),g=s==="bottom"?r.silkscreen.bottom:r.silkscreen.top;return[{name:"circle",type:"element",attributes:{cx:u.toString(),cy:d.toString(),r:f.toString(),class:`pcb-silkscreen-circle pcb-silkscreen-${s}`,stroke:g,"stroke-width":h.toString(),"data-pcb-silkscreen-circle-id":l},value:"",children:[]}]}function Zvn(i,e){const{transform:t,layer:n,colorMap:r}=e,{x1:o,y1:a,x2:s,y2:l,stroke_width:c,layer:u="top",pcb_silkscreen_line_id:d}=i;if(n&&u!==n)return[];if(typeof o!="number"||typeof a!="number"||typeof s!="number"||typeof l!="number")return console.error("Invalid coordinates:",{x1:o,y1:a,x2:s,y2:l}),[];const[f,h]=Mr(t,[o,a]),[g,y]=Mr(t,[s,l]),v=c*Math.abs(t.a),_=u==="bottom"?r.silkscreen.bottom:r.silkscreen.top;return[{name:"line",type:"element",attributes:{x1:f.toString(),y1:h.toString(),x2:g.toString(),y2:y.toString(),stroke:_,"stroke-width":v.toString(),class:`pcb-silkscreen-line pcb-silkscreen-${u}`,"data-pcb-silkscreen-line-id":d},value:"",children:[]}]}function $vn(i){const e=[];for(let t=0;t<i.length-1;t++)e.push([i[t],i[t+1]]);return e}var IE={copper:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},soldermask:{top:"rgb(200, 52, 52)",bottom:"rgb(77, 127, 196)"},drill:"#FF26E2",silkscreen:{top:"#f2eda1",bottom:"#5da9e9"},boardOutline:"rgba(255, 255, 255, 0.5)",debugComponent:{fill:null,stroke:null}};IE.drill,IE.silkscreen.top,IE.silkscreen.bottom,IE.copper.top,IE.copper.bottom;function yN(i,e=IE){return e.copper[i]??"white"}var e_n={bottom:"rgb(105, 105, 105)",top:"rgb(105, 105, 105)"};function vj(i){return e_n[i]??"rgb(105, 105, 105)"}function t_n(i,e){const{transform:t,layer:n,colorMap:r}=e;if(!i.route||!Array.isArray(i.route)||i.route.length<2)return[];const o=$vn(i.route),a=[];for(const[s,l]of o){const c=Mr(t,[s.x,s.y]),u=Mr(t,[l.x,l.y]),d="layer"in s?s.layer:"layer"in l?l.layer:null;if(!d||n&&d!==n)continue;const f=r.soldermask[d]??yN(d,r),h="width"in s?s.width:"width"in l?l.width:null,g={name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-trace",stroke:f,fill:"none",d:`M ${c[0]} ${c[1]} L ${u[0]} ${u[1]}`,"stroke-width":h?(h*Math.abs(t.a)).toString():"0.3","stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"crispEdges","data-layer":d}};a.push(g)}return a.sort((s,l)=>{const c=s.attributes["data-layer"],u=l.attributes["data-layer"];return c==="bottom"&&u!=="bottom"?-1:c==="top"&&u!=="top"?1:0}),a}function n_n(i,e){const{transform:t,layer:n,colorMap:r}=e;if(n&&i.layer!==n)return[];if(i.shape==="rect"||i.shape==="rotated_rect"){const o=i.width*Math.abs(t.a),a=i.height*Math.abs(t.d),[s,l]=Mr(t,[i.x,i.y]);return i.shape==="rotated_rect"&&i.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(-o/2).toString(),y:(-a/2).toString(),width:o.toString(),height:a.toString(),transform:`translate(${s} ${l}) rotate(${-i.ccw_rotation})`,"data-layer":i.layer}}]:[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(s-o/2).toString(),y:(l-a/2).toString(),width:o.toString(),height:a.toString(),"data-layer":i.layer}}]}if(i.shape==="pill"){const o=i.width*Math.abs(t.a),a=i.height*Math.abs(t.d),s=i.radius*Math.abs(t.a),[l,c]=Mr(t,[i.x,i.y]);return[{name:"rect",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),x:(l-o/2).toString(),y:(c-a/2).toString(),width:o.toString(),height:a.toString(),rx:s.toString(),ry:s.toString(),"data-layer":i.layer}}]}if(i.shape==="circle"){const o=i.radius*Math.abs(t.a),[a,s]=Mr(t,[i.x,i.y]);return[{name:"circle",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer,r),cx:a.toString(),cy:s.toString(),r:o.toString(),"data-layer":i.layer}}]}if(i.shape==="polygon"){const o=(i.points??[]).map(a=>Mr(t,[a.x,a.y]));return[{name:"polygon",type:"element",attributes:{class:"pcb-pad",fill:yN(i.layer),points:o.map(a=>a.join(",")).join(" "),"data-layer":i.layer}}]}return[]}function znt(i,e){const{transform:t,colorMap:n}=e,{width:r,height:o,center:a,outline:s}=i;let l;if(s&&Array.isArray(s)&&s.length>=3)l=s.map((c,u)=>{const[d,f]=Mr(t,[c.x,c.y]);return u===0?`M ${d} ${f}`:`L ${d} ${f}`}).join(" ");else{const c=r/2,u=o/2,d=Mr(t,[a.x-c,a.y-u]),f=Mr(t,[a.x+c,a.y-u]),h=Mr(t,[a.x+c,a.y+u]),g=Mr(t,[a.x-c,a.y+u]);l=`M ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${h[0]} ${h[1]} L ${g[0]} ${g[1]}`}return l+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:l,fill:"none",stroke:n.boardOutline,"stroke-width":(.1*Math.abs(t.a)).toString()}}]}function i_n(i,e){const{transform:t,colorMap:n}=e,[r,o]=Mr(t,[i.x,i.y]),a=i.outer_diameter*Math.abs(t.a),s=i.outer_diameter*Math.abs(t.a),l=i.hole_diameter*Math.abs(t.a),c=i.hole_diameter*Math.abs(t.a),u=Math.min(a,s)/2,d=Math.min(l,c)/2;return{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"pcb-hole-outer",fill:n.copper.top,cx:r.toString(),cy:o.toString(),r:u.toString()}},{name:"circle",type:"element",attributes:{class:"pcb-hole-inner",fill:n.drill,cx:r.toString(),cy:o.toString(),r:d.toString()}}]}}function r_n(i,e){const{transform:t,colorMap:n}=e,[r,o]=Mr(t,[i.x,i.y]);if(i.hole_shape==="circle"||i.hole_shape==="square"){const a=i.hole_diameter*Math.abs(t.a),s=a/2;return i.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"pcb-hole",cx:r.toString(),cy:o.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"pcb-hole",x:(r-s).toString(),y:(o-s).toString(),width:a.toString(),height:a.toString(),fill:n.drill},children:[],value:""}]}if(i.hole_shape==="oval"){const a=i.hole_width*Math.abs(t.a),s=i.hole_height*Math.abs(t.a),l=a/2,c=s/2;return[{name:"ellipse",type:"element",attributes:{class:"pcb-hole",cx:r.toString(),cy:o.toString(),rx:l.toString(),ry:c.toString(),fill:n.drill},children:[],value:""}]}return[]}var o_n=(i,e)=>{const t=d9(e).pcb_smtpad.get(i);if(t&&"x"in t&&"y"in t)return{x:t.x,y:t.y};const n=d9(e).pcb_plated_hole.get(i);return n&&"x"in n&&"y"in n?{x:n.x,y:n.y}:null},a_n=(i,e,t,n)=>{const r=t.getIdsConnectedToNet(e);let o=null,a=1/0;for(const s of r){const l=o_n(s,n);if(l){const c=i.x-l.x,u=i.y-l.y,d=Math.sqrt(c*c+u*u);d>0&&d<a&&(a=d,o=l)}}return o};function s_n(i,e){const{transform:t}=e,n=x5(i),r=i.filter(l=>l.type==="pcb_port"),o=i.filter(l=>l.type==="source_trace"),a=[];r.forEach((l,c)=>{const u=l.pcb_port_id;if(!u)return;const d=n.getNetConnectedToId(u);if(!d)return;let f=!1;const h=d9(i).source_port.getWhere({pcb_port_id:u});if(h&&h.source_port_id){const v=h.source_port_id;for(const _ of o)if(Array.isArray(_.connected_source_port_ids)&&_.connected_source_port_ids.includes(v)&&Array.isArray(_.connected_source_net_ids)&&_.connected_source_net_ids.length>0){f=!0;break}}const g={x:l.x,y:l.y},y=a_n(g,d,n,i);y&&a.push({key:`${u}-${c}`,startPoint:g,endPoint:y,isInNet:f})});const s=[];for(const l of a){const c=Mr(t,[l.startPoint.x,l.startPoint.y]),u=Mr(t,[l.endPoint.x,l.endPoint.y]),d={x1:c[0].toString(),y1:c[1].toString(),x2:u[0].toString(),y2:u[1].toString(),stroke:"white","stroke-width":"1","stroke-dasharray":"6,6"};s.push({name:"line",type:"element",attributes:d,value:"",children:[]})}return s}function l_n(i,e){const{transform:t,colorMap:n}=e;if(i.shape==="rect"){const r=i,[o,a]=Mr(t,[r.center.x,r.center.y]),s=r.width*Math.abs(t.a),l=r.height*Math.abs(t.d),c=-(r.rotation??0);return[{name:"rect",type:"element",attributes:{class:"pcb-cutout pcb-cutout-rect",x:(-s/2).toString(),y:(-l/2).toString(),width:s.toString(),height:l.toString(),fill:n.drill,transform:Jw(sf(Sp(o,a),kb(c*Math.PI/180)))},children:[],value:""}]}if(i.shape==="circle"){const r=i,[o,a]=Mr(t,[r.center.x,r.center.y]),s=r.radius*Math.abs(t.a);return[{name:"circle",type:"element",attributes:{class:"pcb-cutout pcb-cutout-circle",cx:o.toString(),cy:a.toString(),r:s.toString(),fill:n.drill},children:[],value:""}]}if(i.shape==="polygon"){const r=i;return!r.points||r.points.length===0?[]:[{name:"polygon",type:"element",attributes:{class:"pcb-cutout pcb-cutout-polygon",points:r.points.map(s=>Mr(t,[s.x,s.y])).map(s=>`${s[0]},${s[1]}`).join(" "),fill:n.drill},children:[],value:""}]}return[]}function c_n(i,e){var f,h;const{transform:t}=e,{center:n,width:r,height:o,rotation:a=0}=i,[s,l]=Mr(t,[n.x,n.y]),c=r*Math.abs(t.a),u=o*Math.abs(t.d),d=`translate(${s}, ${l}) rotate(${-a}) scale(1, -1)`;return!((f=e.colorMap.debugComponent)!=null&&f.fill)&&!((h=e.colorMap.debugComponent)!=null&&h.stroke)?[]:[{name:"g",type:"element",attributes:{transform:d},children:[{name:"rect",type:"element",attributes:{class:"pcb-component",x:(-c/2).toString(),y:(-u/2).toString(),width:c.toString(),height:u.toString(),fill:e.colorMap.debugComponent.fill??"transparent",stroke:e.colorMap.debugComponent.stroke??"transparent"}}],value:""}]}function pP(i){const e=i.find(t=>t.type==="project_software_metadata"||t.type==="source_project_metadata");return e==null?void 0:e.software_used_string}var u_n={version:"0.0.172"},gP=u_n.version,Hnt=["pcb_trace_error","pcb_plated_hole","pcb_fabrication_note_text","pcb_fabrication_note_path","pcb_silkscreen_text","pcb_silkscreen_path","pcb_via","pcb_cutout","pcb_smtpad","pcb_trace","pcb_component","pcb_board"];function Ynt(i,e){var gt,Fe,Ke,tt,Ct,Rt,yt,et;const t=(e==null?void 0:e.drawPaddingOutsideBoard)??!0,n=e==null?void 0:e.layer,r=e==null?void 0:e.colorOverrides,o={copper:{top:((gt=r==null?void 0:r.copper)==null?void 0:gt.top)??IE.copper.top,bottom:((Fe=r==null?void 0:r.copper)==null?void 0:Fe.bottom)??IE.copper.bottom},drill:(r==null?void 0:r.drill)??IE.drill,silkscreen:{top:((Ke=r==null?void 0:r.silkscreen)==null?void 0:Ke.top)??IE.silkscreen.top,bottom:((tt=r==null?void 0:r.silkscreen)==null?void 0:tt.bottom)??IE.silkscreen.bottom},boardOutline:(r==null?void 0:r.boardOutline)??IE.boardOutline,soldermask:{top:((Ct=r==null?void 0:r.soldermask)==null?void 0:Ct.top)??IE.soldermask.top,bottom:((Rt=r==null?void 0:r.soldermask)==null?void 0:Rt.bottom)??IE.soldermask.bottom},debugComponent:{fill:((yt=r==null?void 0:r.debugComponent)==null?void 0:yt.fill)??IE.debugComponent.fill,stroke:((et=r==null?void 0:r.debugComponent)==null?void 0:et.stroke)??IE.debugComponent.stroke}};let a=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,d=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;for(const Nt of i)if(Nt.type==="pcb_board")Nt.outline&&Array.isArray(Nt.outline)&&Nt.outline.length>=3?(Je(Nt.outline),ot(Nt.outline)):"center"in Nt&&"width"in Nt&&"height"in Nt&&(xe(Nt.center,Nt.width,Nt.height),Oe(Nt.center,Nt.width,Nt.height));else if("x"in Nt&&"y"in Nt)xe({x:Nt.x,y:Nt.y},0,0);else if(Nt.type==="pcb_smtpad"){const St=Nt;St.shape==="rect"||St.shape==="rotated_rect"||St.shape==="pill"?xe({x:St.x,y:St.y},St.width,St.height):St.shape==="circle"?xe({x:St.x,y:St.y},St.radius*2,St.radius*2):St.shape==="polygon"&&ct(St.points)}else"route"in Nt?ct(Nt.route):(Nt.type==="pcb_silkscreen_text"||Nt.type==="pcb_silkscreen_rect"||Nt.type==="pcb_silkscreen_circle"||Nt.type==="pcb_silkscreen_line")&&kt(Nt);const g=t?1:0,y=t||!isFinite(u)?a:u,v=t||!isFinite(d)?s:d,_=t||!isFinite(f)?l:f,x=t||!isFinite(h)?c:h,B=_-y+2*g,M=x-v+2*g;let z=(e==null?void 0:e.width)??800,U=(e==null?void 0:e.height)??600;if(e!=null&&e.matchBoardAspectRatio){const Nt=f-u,St=h-d;if(Nt>0&&St>0){const Qt=Nt/St;e!=null&&e.width&&!(e!=null&&e.height)?U=e.width/Qt:e!=null&&e.height&&!(e!=null&&e.width)?z=e.height*Qt:U=z/Qt}}const H=[];for(const Nt of i)"route"in Nt&&Nt.route!==void 0&&H.push(Nt.route);const k=z/B,j=U/M,G=Math.min(k,j),ee=(z-B*G)/2,K=(U-M*G)/2,ie=sf(Sp(ee-y*G+g*G,U-K+v*G-g*G),mx(G,-G)),ce={transform:ie,layer:n,shouldDrawErrors:e==null?void 0:e.shouldDrawErrors,drawPaddingOutsideBoard:t,colorMap:o};function ue(Nt){if(Nt.type==="pcb_smtpad")return Nt.layer==="top"||Nt.layer==="bottom"?Nt.layer:void 0;if(Nt.type==="pcb_trace")for(const St of Nt.route??[]){const Qt="layer"in St&&St.layer||"from_layer"in St&&St.from_layer||"to_layer"in St&&St.to_layer||void 0;if(Qt==="top"||Qt==="bottom")return Qt}}function le(Nt){return Nt.type==="pcb_trace"||Nt.type==="pcb_smtpad"}let ve=i.sort((Nt,St)=>{const Qt=ue(Nt),Ot=ue(St);if(le(Nt)&&le(St)&&Qt!==Ot){if(Qt==="top")return 1;if(Ot==="top"||Qt==="bottom")return-1;if(Ot==="bottom")return 1}return(Hnt.indexOf(St.type)??9999)-(Hnt.indexOf(Nt.type)??9999)}).flatMap(Nt=>d_n({elm:Nt,circuitJson:i,ctx:ce}));for(const Nt of i)if("stroke_width"in Nt){String(G*Nt.stroke_width);break}if(e!=null&&e.shouldDrawRatsNest){const Nt=s_n(i,ce);ve=ve.concat(Nt)}const me=[{name:"style",type:"element",value:"",attributes:{},children:[{type:"text",value:"",name:"",attributes:{},children:[]}]},{name:"rect",type:"element",value:"",attributes:{class:"boundary",x:"0",y:"0",fill:(e==null?void 0:e.backgroundColor)??"#000",width:z.toString(),height:U.toString()},children:[]}];t&&me.push(A_n(ie,a,s,l,c)),me.push(...ve);const Me=pP(i),Be=gP,Ne={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:z.toString(),height:U.toString(),...Me&&{"data-software-used-string":Me},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":Be}},value:"",children:me.filter(Nt=>Nt!==null)};try{return yj(Ne)}catch(Nt){throw console.error("Error stringifying SVG object:",Nt),Nt}function xe(Nt,St,Qt){const Ot=St/2,tn=Qt/2;a=Math.min(a,Nt.x-Ot),s=Math.min(s,Nt.y-tn),l=Math.max(l,Nt.x+Ot),c=Math.max(c,Nt.y+tn)}function Oe(Nt,St,Qt){const Ot=St/2,tn=Qt/2;u=Math.min(u,Nt.x-Ot),d=Math.min(d,Nt.y-tn),f=Math.max(f,Nt.x+Ot),h=Math.max(h,Nt.y+tn)}function Je(Nt){for(const St of Nt)a=Math.min(a,St.x),s=Math.min(s,St.y),l=Math.max(l,St.x),c=Math.max(c,St.y)}function ot(Nt){for(const St of Nt)u=Math.min(u,St.x),d=Math.min(d,St.y),f=Math.max(f,St.x),h=Math.max(h,St.y)}function ct(Nt){for(const St of Nt)a=Math.min(a,St.x),s=Math.min(s,St.y),l=Math.max(l,St.x),c=Math.max(c,St.y)}function kt(Nt){if(Nt.type==="pcb_silkscreen_text")xe(Nt.anchor_position,0,0);else if(Nt.type==="pcb_silkscreen_path")ct(Nt.route);else if(Nt.type==="pcb_silkscreen_rect")xe(Nt.center,Nt.width,Nt.height);else if(Nt.type==="pcb_silkscreen_circle")xe(Nt.center,Nt.radius*2,Nt.radius*2);else if(Nt.type==="pcb_silkscreen_line")xe({x:Nt.x1,y:Nt.y1},0,0),xe({x:Nt.x2,y:Nt.y2},0,0);else if(Nt.type==="pcb_cutout"){const St=Nt;St.shape==="rect"?xe(St.center,St.width,St.height):St.shape==="circle"?xe(St.center,St.radius*2,St.radius*2):St.shape==="polygon"&&ct(St.points)}}}function d_n({elm:i,circuitJson:e,ctx:t}){switch(i.type){case"pcb_trace_error":return Hvn(i,e,t).filter(Boolean);case"pcb_component":return c_n(i,t).filter(Boolean);case"pcb_trace":return t_n(i,t);case"pcb_plated_hole":return Kvn(i,t).filter(Boolean);case"pcb_hole":return r_n(i,t);case"pcb_smtpad":return n_n(i,t);case"pcb_silkscreen_text":return Wvn(i,t);case"pcb_silkscreen_rect":return qvn(i,t);case"pcb_silkscreen_circle":return Xvn(i,t);case"pcb_silkscreen_line":return Zvn(i,t);case"pcb_fabrication_note_path":return Vvn(i,t);case"pcb_fabrication_note_text":return jvn(i,t);case"pcb_silkscreen_path":return Jvn(i,t);case"pcb_board":return t.drawPaddingOutsideBoard?znt(i,t):[];case"pcb_via":return i_n(i,t);case"pcb_cutout":return l_n(i,t);default:return[]}}function A_n(i,e,t,n,r){const[o,a]=Mr(i,[e,t]),[s,l]=Mr(i,[n,r]),c=Math.abs(s-o),u=Math.abs(l-a),d=Math.min(o,s),f=Math.min(a,l);return{name:"rect",type:"element",value:"",children:[],attributes:{class:"pcb-boundary",fill:"none",stroke:"#fff","stroke-width":"0.3",x:d.toString(),y:f.toString(),width:c.toString(),height:u.toString()}}}var f_n=Ynt,_j={fill:"none",stroke:"rgb(0,0,0)",strokeOpacity:"0.8",strokeWidthFactor:.2};function h_n(i,e,t={}){const{width:n,height:r,center:o,outline:a}=i;let s;if(a&&Array.isArray(a)&&a.length>=3)s=a.map((l,c)=>{const[u,d]=Mr(e,[l.x,l.y]);return c===0?`M ${u} ${d}`:`L ${u} ${d}`}).join(" ");else{const l=n/2,c=r/2,u=Mr(e,[o.x-l,o.y-c]),d=Mr(e,[o.x+l,o.y-c]),f=Mr(e,[o.x+l,o.y+c]),h=Mr(e,[o.x-l,o.y+c]);s=`M ${u[0]} ${u[1]} L ${d[0]} ${d[1]} L ${f[0]} ${f[1]} L ${h[0]} ${h[1]}`}return s+=" Z",[{name:"path",type:"element",value:"",children:[],attributes:{class:"pcb-board",d:s,fill:t.fill??_j.fill,stroke:t.stroke??_j.stroke,"stroke-opacity":t.strokeOpacity??_j.strokeOpacity,"stroke-width":((t.strokeWidthFactor??_j.strokeWidthFactor)*Math.abs(e.a)).toString()}}]}var p_n={pin_number:.15,negated_pin_number:.15*.8,reference_designator:.18,manufacturer_number:.18,net_label:.18,error:.05},vN=(i,e)=>e??p_n[i],dw=(i,e,t)=>Math.abs(i.a)*vN(e,t);function g_n(i,e){const{elm:t,portPosition:n,name:r,arePinsInterchangeable:o}=i,{transform:a}=e,{center:s,width:l,height:c,rotation:u=0,layer:d="top"}=t;if(!s||typeof l!="number"||typeof c!="number")return null;const[f,h]=Mr(a,[s.x,s.y]),[g,y]=Mr(a,[n.x,n.y]),v=l*Math.abs(a.a),_=c*Math.abs(a.d),x=y>h,B=g<f,M=[m_n(v,_,u,d),y_n(v,_,r??"")];return o||M.push(v_n(v,_,u,d,x,B)),{name:"g",type:"element",value:"",attributes:{transform:`translate(${f}, ${h}) scale(1, -1)`},children:M}}function m_n(i,e,t,n){const r=i/2,o=e/2;return{name:"path",type:"element",attributes:{class:"assembly-component",d:__n(r,o,t),"stroke-width":.8.toFixed(2),transform:`rotate(${-t})`,"stroke-dasharray":n==="bottom"?"2,2":""},value:"",children:[]}}function y_n(i,e,t,n){const r=Math.min(i,e),l=Math.min(58,Math.max(3,r*.8)),c=e>i;return{name:"text",type:"element",attributes:{x:"0",y:"0",class:"assembly-component-label","text-anchor":"middle",dy:".10em",style:"pointer-events: none","font-size":`${l.toFixed(1)}px`,transform:c?"rotate(90) scale(1, -1)":"scale(1, -1)"},children:[{type:"text",value:t||"",name:"",attributes:{},children:[]}],value:""}}function v_n(i,e,t,n,r,o){const a=i/2,s=e/2,l=Math.min(a,s)*.5;let c;return r&&o?c=[[-a,-s],[-a+l,-s],[-a,-s+l]]:r&&!o?c=[[a,-s],[a-l,-s],[a,-s+l]]:!r&&o?c=[[-a,s],[-a+l,s],[-a,s-l]]:c=[[a,s],[a-l,s],[a,s-l]],{name:"polygon",type:"element",attributes:{class:"assembly-pin1-indicator",points:c.map(d=>d.join(",")).join(" "),fill:"#333",stroke:"none",transform:`rotate(${-t})`},value:"",children:[]}}function __n(i,e,t){const n=(s,l,c)=>{const u=Math.PI/180*c,d=Math.cos(u),f=Math.sin(u);return[s*d-l*f,s*f+l*d]};return`${[[-i,-e],[i,-e],[i,e],[-i,e]].map(([s,l])=>n(s,l,t)).map(([s,l],c)=>c===0?`M${s},${l}`:`L${s},${l}`).join(" ")} Z`}var nye="rgb(190, 190, 190)";function I_n(i,e){const{transform:t}=e,[n,r]=Mr(t,[i.x,i.y]);if(i.hole_shape==="circle"||i.hole_shape==="square"){const o=i.hole_diameter*Math.abs(t.a),a=o/2;return i.hole_shape==="circle"?[{name:"circle",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:r.toString(),r:a.toString(),fill:nye},children:[],value:""}]:[{name:"rect",type:"element",attributes:{class:"assembly-hole",x:(n-a).toString(),y:(r-a).toString(),width:o.toString(),height:o.toString(),fill:nye},children:[],value:""}]}if(i.hole_shape==="oval"){const o=i.hole_width*Math.abs(t.a),a=i.hole_height*Math.abs(t.a),s=o/2,l=a/2;return[{name:"ellipse",type:"element",attributes:{class:"assembly-hole",cx:n.toString(),cy:r.toString(),rx:s.toString(),ry:l.toString(),fill:nye},children:[],value:""}]}return[]}var Ij="rgb(210, 210, 210)",Cj="rgb(190, 190, 190)";function C_n(i,e){const{transform:t}=e,[n,r]=Mr(t,[i.x,i.y]);if(i.shape==="pill"){const o=i.outer_width*Math.abs(t.a),a=i.outer_height*Math.abs(t.a),s=i.hole_width*Math.abs(t.a),l=i.hole_height*Math.abs(t.a),c=o/2,u=a-o,d=s/2;return[{name:"g",type:"element",children:[{name:"path",type:"element",attributes:{class:"assembly-hole-outer",fill:Ij,d:`M${n-c},${r-u/2} v${u} a${c},${c} 0 0 0 ${o},0 v-${u} a${c},${c} 0 0 0 -${o},0 z`},value:"",children:[]},{name:"path",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,d:`M${n-d},${r-(l-s)/2} v${l-s} a${d},${d} 0 0 0 ${s},0 v-${l-s} a${d},${d} 0 0 0 -${s},0 z`},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circle"){const o=i.outer_diameter*Math.abs(t.a),a=i.outer_diameter*Math.abs(t.a),s=i.hole_diameter*Math.abs(t.a),l=i.hole_diameter*Math.abs(t.a),c=Math.min(o,a)/2,u=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"circle",type:"element",attributes:{class:"assembly-hole-outer",fill:Ij,cx:n.toString(),cy:r.toString(),r:c.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,cx:n.toString(),cy:r.toString(),r:u.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="circular_hole_with_rect_pad"){const o=i.hole_diameter*Math.abs(t.a),a=i.rect_pad_width*Math.abs(t.a),s=i.rect_pad_height*Math.abs(t.a),l=o/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:Ij,x:(n-a/2).toString(),y:(r-s/2).toString(),width:a.toString(),height:s.toString()},value:"",children:[]},{name:"circle",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,cx:n.toString(),cy:r.toString(),r:l.toString()},value:"",children:[]}],value:"",attributes:{}}]}if(i.shape==="pill_hole_with_rect_pad"){const o=i.rect_pad_width*Math.abs(t.a),a=i.rect_pad_height*Math.abs(t.a),s=i.hole_height*Math.abs(t.a),l=i.hole_width*Math.abs(t.a),c=Math.min(s,l)/2;return[{name:"g",type:"element",children:[{name:"rect",type:"element",attributes:{class:"assembly-hole-outer-pad",fill:Ij,x:(n-o/2).toString(),y:(r-a/2).toString(),width:o.toString(),height:a.toString()},value:"",children:[]},{name:"rect",type:"element",attributes:{class:"assembly-hole-inner",fill:Cj,x:(n-l/2).toString(),y:(r-s/2).toString(),width:l.toString(),height:s.toString(),rx:c.toString(),ry:c.toString()},value:"",children:[]}],value:"",attributes:{}}]}return[]}var mP="rgb(210, 210, 210)";function x_n(i,e){const{transform:t}=e;if(i.shape==="rect"||i.shape==="rotated_rect"){const n=i.width*Math.abs(t.a),r=i.height*Math.abs(t.d),[o,a]=Mr(t,[i.x,i.y]);return i.shape==="rotated_rect"&&i.ccw_rotation?[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(-n/2).toString(),y:(-r/2).toString(),width:n.toString(),height:r.toString(),transform:`translate(${o} ${a}) rotate(${-i.ccw_rotation})`,"data-layer":i.layer},value:"",children:[]}]:[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(o-n/2).toString(),y:(a-r/2).toString(),width:n.toString(),height:r.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="pill"){const n=i.width*Math.abs(t.a),r=i.height*Math.abs(t.d),o=i.radius*Math.abs(t.a),[a,s]=Mr(t,[i.x,i.y]);return[{name:"rect",type:"element",attributes:{class:"assembly-pad",fill:mP,x:(a-n/2).toString(),y:(s-r/2).toString(),width:n.toString(),height:r.toString(),rx:o.toString(),ry:o.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="circle"){const n=i.radius*Math.abs(t.a),[r,o]=Mr(t,[i.x,i.y]);return[{name:"circle",type:"element",attributes:{class:"assembly-pad",fill:mP,cx:r.toString(),cy:o.toString(),r:n.toString(),"data-layer":i.layer},value:"",children:[]}]}if(i.shape==="polygon"){const n=(i.points??[]).map(r=>Mr(t,[r.x,r.y]));return[{name:"polygon",type:"element",attributes:{class:"assembly-pad",fill:mP,points:n.map(r=>r.join(",")).join(" "),"data-layer":i.layer},value:"",children:[]}]}return[]}var Vnt=["pcb_component","pcb_smtpad","pcb_hole","pcb_plated_hole","pcb_board"];function jnt(i,e){let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(const U of i)if(U.type==="pcb_board"){const H=U.center,k=U.width||0,j=U.height||0;t=Math.min(t,H.x-k/2),n=Math.min(n,H.y-j/2),r=Math.max(r,H.x+k/2),o=Math.max(o,H.y+j/2)}const a=1,s=r-t+2*a,l=o-n+2*a,c=(e==null?void 0:e.width)??800,u=(e==null?void 0:e.height)??600,d=c/s,f=u/l,h=Math.min(d,f),g=(c-s*h)/2,y=(u-l*h)/2,v=sf(Sp(g-t*h+a*h,u-y+n*h-a*h),mx(h,-h)),_={transform:v},x=i.sort((U,H)=>(Vnt.indexOf(H.type)??9999)-(Vnt.indexOf(U.type)??9999)).flatMap(U=>E_n(U,_,i)),B=pP(i),M=gP,z={name:"svg",type:"element",attributes:{xmlns:"http://www.w3.org/2000/svg",width:c.toString(),height:u.toString(),...B&&{"data-software-used-string":B},...(e==null?void 0:e.includeVersion)&&{"data-circuit-to-svg-version":M}},value:"",children:[{name:"style",type:"element",children:[{type:"text",value:`
|
|
13271
13271
|
.assembly-component {
|
|
13272
13272
|
fill: none;
|
|
13273
13273
|
stroke: #000;
|
|
@@ -13504,7 +13504,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return qye}kCn();function _rt(i,e,t,n=
|
|
|
13504
13504
|
&:hover {
|
|
13505
13505
|
background-color: rgba(255, 255, 255, 0.1);
|
|
13506
13506
|
}
|
|
13507
|
-
`,onClick:n=>{n.stopPropagation(),t()},children:[je.jsx("input",{type:"checkbox",checked:e}),je.jsx("span",{style:{color:"#eee"},children:i})]}),cbn=({children:i,elements:e})=>{const[t,n]=ix(k=>[k.is_mouse_over_container,k.setIsMouseOverContainer]),[r,o]=dt.useState(!1),[a,s]=dt.useState(!1),[l,c]=dt.useState(!1),[u,d]=ix(k=>[k.selected_layer,k.selectLayer]),[f,h,g,y,v,_]=ix(k=>[k.in_move_footprint_mode,k.in_draw_trace_mode,k.is_showing_rats_nest,k.is_showing_multiple_traces_length,k.is_showing_autorouting,k.is_showing_drc_errors]),x=ix(k=>k.setEditMode),B=ix(k=>k.setIsShowingRatsNest),M=ix(k=>k.setIsShowingMultipleTracesLength),z=ix(k=>k.setIsShowingAutorouting),U=ix(k=>k.setIsShowingDrcErrors);e4("1",()=>d("top")),e4("2",()=>d("bottom")),e4("3",()=>d("inner1")),e4("4",()=>d("inner2")),e4("5",()=>d("inner3")),e4("6",()=>d("inner4")),e4("7",()=>d("inner5")),e4("8",()=>d("inner6"));const H=(e==null?void 0:e.filter(k=>k.type.includes("error")).length)??0;return je.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:k=>{n(!1),s(!1)},children:[i,je.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",sbn.version]}),je.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:tb.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[je.jsxs(kN,{onClick:()=>{s(!a)},onMouseLeave:()=>{a&&s(!1)},children:[je.jsxs("div",{children:["layer:"," ",je.jsx("span",{style:{marginLeft:2,fontWeight:500,color:PN[u]},children:u})]}),a&&je.jsx("div",{style:{marginTop:4,minWidth:120},children:Rve.map(k=>k.replace(/-/g,"")).map(k=>je.jsx(lbn,{name:k,selected:k===u,onClick:()=>{d(k.replace(/-/,""))}},k))})]}),je.jsxs(kN,{style:H>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[je.jsxs("div",{children:[H," errors"]}),l&&je.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(k=>k.type.includes("error")).map((k,j)=>je.jsxs(dt.Fragment,{children:[je.jsx("div",{children:k.error_type}),je.jsx("div",{children:k.message})]},j))})]}),je.jsx(kN,{style:{},onClick:()=>{x(h?"off":"draw_trace")},children:je.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),je.jsx(kN,{style:{},onClick:()=>{x(f?"off":"move_footprint")},children:je.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),je.jsx(kN,{style:{},onClick:()=>{B(!g)},children:je.jsxs("div",{children:[g?"✖ ":"","Rats Nest"]})}),je.jsx(kN,{onClick:()=>{o(!r)},children:je.jsxs("div",{children:[je.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",je.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&je.jsxs("div",{style:{marginTop:4,minWidth:120},children:[je.jsx(Lve,{label:"Show All Trace Lengths",checked:y,onClick:()=>{M(!y)}}),je.jsx(Lve,{label:"Show Autorouting Animation",checked:v,onClick:()=>{z(!v)}}),je.jsx(Lve,{label:"Show DRC Errors",checked:_,onClick:()=>{U(!_)}})]})]})})]})]})},ubn=i=>{const{transform:e,elements:t}=i,[n,r]=dt.useMemo(()=>{const c=i.elements.flatMap(d=>IEn(d,i.elements)),u=x5(i.elements);return[c,u]},[i.elements]),[o,a]=dt.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=dt.useMemo(()=>vEn({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:o.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:o.primitiveIdsInMousedOverNet}),[n,o]),l=dt.useCallback(c=>{var f,h;const u=[];for(const g of c)if(g._element){const y=r.getNetConnectedToId("pcb_port_id"in g._element?(f=g._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in g._element?(h=g._element)==null?void 0:h.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(y))}const d=new Set(c.map(g=>g._pcb_drawing_object_id));a({drawingObjectIdsWithMouseOver:d,primitiveIdsInMousedOverNet:u})},[r]);return je.jsx(obn,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:je.jsx(zEn,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(jEn,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(GEn,{transform:e,focusOnHover:i.focusOnHover,children:je.jsx(cbn,{elements:t,children:je.jsx(WEn,{transform:e,elements:t,children:je.jsx(abn,{transform:e,soup:t,children:je.jsx(FEn,{transform:e,debugGraphics:i.debugGraphics,children:je.jsx(UEn,{transform:e,elements:t,children:je.jsx(LEn,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},dbn=sf(Sp(400,300),mx(40,-40)),Abn=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:o,onEditEventsChanged:a,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=dt.useState(!l),[d,f]=Pve(),[h,g]=dt.useState(dbn),{ref:y,setTransform:v,cancelDrag:_}=yEn({transform:h,onSetTransform:g,enabled:c});let[x,B]=dt.useState([]);x=o??x;const M=dt.useRef(!1),z=dt.useRef(null),U=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,H=()=>{const K=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ie,width:ce,height:ue}=j.some(me=>me.type.startsWith("pcb_"))?lEn(j.filter(me=>me.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},le=Math.min((K.width??0)/ce,(K.height??0)/ue,100)*.75,ve=sf(Sp((K.width??0)/2,(K.height??0)/2),mx(le,-le,0,0),Sp(-ie.x,-ie.y));v(ve)};dt.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(M.current||(H(),M.current=!0))},[i,f]);const k=dt.useMemo(()=>(i==null?void 0:i.filter(K=>K.type.startsWith("pcb_")||K.type.startsWith("source_")))??[],[U]),j=dt.useMemo(()=>IIn({circuitJson:k,editEvents:x}),[k,x]),G=K=>{B([...x,K]),a==null||a([...x,K])},ee=K=>{const ie=x.map(ce=>ce.edit_event_id===K.edit_event_id?{...ce,...K}:ce);B(ie),a==null||a(ie)};return je.jsxs("div",{ref:y,style:{position:"relative"},children:[je.jsx("div",{ref:d,children:je.jsxs(uEn,{initialState:n,children:[je.jsx(ubn,{transform:h,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:G,onModifyEditEvent:ee,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:j,debugGraphics:e},f.width),je.jsx(AEn,{})]})}),l&&!c&&je.jsx("div",{onClick:()=>{u(!0),H()},onTouchStart:K=>{const ie=K.touches[0];z.current={x:ie.clientX,y:ie.clientY}},onTouchEnd:K=>{const ie=K.changedTouches[0],ce=z.current;if(!ce)return;const ue=Math.abs(ie.clientX-ce.x),le=Math.abs(ie.clientY-ce.y);ue<10&&le<10&&(K.preventDefault(),u(!0),H()),z.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:tb.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:je.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const fbn=({containerClassName:i,...e})=>{const t=dt.useRef(null),[n,r]=dt.useState(620);return dt.useLayoutEffect(()=>{const o=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};o();const a=new ResizeObserver(o);return t.current&&a.observe(t.current),window.addEventListener("resize",o),()=>{a.disconnect(),window.removeEventListener("resize",o)}},[]),je.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:je.jsx(Abn,{...e,height:n})})},hbn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',pbn=()=>{dt.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=hbn,document.head.appendChild(e)},[])},gbn=i=>{dt.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},Pat=i=>`hsl(${Ob.indexOf(i)*137.5%360}, 70%, 50%)`,mbn=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return je.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[je.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Ob.map(t=>{const n=i[t]||0,r=n/e*100;return je.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:Pat(t)},children:je.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),je.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},ybn=({renderLog:i})=>{const[e,t]=dt.useState("chronological");if(!i)return je.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((o,a)=>Ob.indexOf(o[0])-Ob.indexOf(a[0])):n.sort((o,a)=>a[1]-o[1]);const r=n.reduce((o,[a,s])=>o+s,0);return je.jsxs("div",{className:"rf-bg-white",children:[je.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("div",{children:"Render Logs"}),je.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[je.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),je.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[je.jsx("option",{value:"chronological",children:"Phase Order"}),je.jsx("option",{value:"longest",children:"Duration"})]})]})]}),je.jsx(mbn,{phaseTimings:i.phaseTimings}),je.jsxs("table",{className:"rf-w-full rf-text-xs",children:[je.jsx("thead",{children:je.jsxs("tr",{children:[je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),je.jsx("tbody",{children:n.map(([o,a])=>je.jsxs("tr",{children:[je.jsx("td",{className:"rf-p-2",children:Ob.indexOf(o)}),je.jsx("td",{className:"rf-p-2",children:o}),je.jsx("td",{className:"rf-p-2",children:je.jsx("div",{className:"rf-w-8",children:je.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:Pat(o),width:`${a/r*100}%`}})})}),je.jsx("td",{className:"rf-p-2",children:je.jsxs("div",{className:"rf-flex w-full",children:[je.jsxs("span",{className:"rf-flex-grow",children:[a,"ms"]}),je.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(a/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},kat=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{dt.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{GO.captureException(n)}catch{}}},[i,e]),dt.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{GO.captureException(r,{error_type:n.type})}catch{}}},[t])},vbn="0.0.711",Fve=nDe()(iDe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),_bn=["assembly","bom","circuit_json","errors","render_log"],Ibn=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:o,showRightHeaderContent:a=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:d,renderLog:f,showImportAndFormatButtons:h=!0,className:g,headerClassName:y,leftHeaderContent:v,readOnly:_,isStreaming:x,autoroutingLog:B,onReportAutoroutingLog:M,isRunningCode:z,hasCodeChangedSinceLastRun:U,onEditEvent:H,editEvents:k,defaultActiveTab:j,defaultTab:G,availableTabs:ee,autoRotate3dViewerDisabled:K,showSchematicDebugGrid:ie=!1,showToggleFullScreen:ce=!0,defaultToFullScreen:ue=!1,activeEffectName:le})=>{var Fe;pbn();const ve=Fve(Ke=>Ke.lastRunEvalVersion),me=dt.useMemo(()=>r?r.filter(Ke=>Ke&&"error_type"in Ke||Ke.type.includes("error")):null,[r]),Me=dt.useMemo(()=>r?r.filter(Ke=>Ke&&"warning_type"in Ke||Ke.type.includes("warning")):null,[r]);kat({errorMessage:t,errorStack:n,circuitJsonErrors:me});const[Be,Ne]=dt.useState(j??G??(ee==null?void 0:ee[0])??"pcb"),[xe,Oe]=dt.useState(null),[Je,ot]=dt.useState(ue);gbn(Je);const ct=dt.useCallback(Ke=>{Ne(Ke),d==null||d(Ke)},[d]),kt=()=>{ot(!Je)};dt.useEffect(()=>{t&&(Be!=="errors"&&Oe(Be),ct("errors"))},[t]),dt.useEffect(()=>{(Be==="code"||Be==="errors")&&r&&!t&&ct(xe??j??G??(ee==null?void 0:ee[0])??"pcb")},[r]);const gt=dt.useCallback(Ke=>{window.TSCIRCUIT_3D_OBJECT_REF=Ke===null?void 0:Ke},[]);return je.jsx("div",{className:mg("flex flex-col relative rf-overflow-x-hidden rf-h-full",g),children:je.jsx("div",{className:mg("rf-md:sticky rf-md:top-2 rf-h-full",Je&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:je.jsxs(Wre,{value:Be,onValueChange:ct,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[je.jsxs("div",{className:mg("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",y),children:[v,v&&je.jsx("div",{className:"rf-flex-grow"}),!v&&z&&je.jsx(sQ,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!v&&je.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&!t&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[le?je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:le}):f.lastRenderEvent&&je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((Fe=f.lastRenderEvent)==null?void 0:Fe.phase)??""}),je.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:je.jsx(sQ,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),je.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),a&&je.jsxs(OO,{children:[s&&je.jsx(IB,{value:"code",children:"Code"}),!ee||ee.includes("pcb")?je.jsxs(IB,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&je.jsx("span",{className:mg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!ee||ee.includes("schematic")?je.jsxs(IB,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&je.jsx("span",{className:mg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!ee||ee.includes("cad")?je.jsxs(IB,{value:"cad",children:[r&&je.jsx("span",{className:mg("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Be)&&je.jsx(IB,{value:Be,children:Z8e(Be)}),je.jsxs(Yme,{children:[je.jsx(Vme,{asChild:!0,children:je.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[je.jsx(k0n,{className:"rf-w-4 rf-h-4"}),(me&&me.length>0||t)&&je.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),je.jsxs(mj,{className:"rf-*:text-xs",children:[_bn.filter(Ke=>!ee||ee.includes(Ke)).map(Ke=>je.jsxs(D2,{onSelect:()=>ct(Ke),children:[Be!==Ke&&je.jsx(het,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Be===Ke&&je.jsx(Xge,{className:"rf-w-3 rf-h-3"}),je.jsx("div",{className:"rf-pr-2",children:Z8e(Ke)}),Ke==="errors"&&(me&&me.length>0||t)&&je.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:me==null?void 0:me.length})]},Ke)),je.jsx(D2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",vbn.split(".").map((Ke,tt)=>tt===2?parseInt(Ke)+1:Ke).join(".")]})}),ve&&je.jsx(D2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ve]})})]})]})]}),ce&&je.jsx(N9,{onClick:kt,variant:"ghost",children:Je?je.jsx(G0n,{size:16}):je.jsx(F0n,{size:16})})]}),s&&je.jsx(X2,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:je.jsx("div",{className:"rf-h-full",children:l})}),(!ee||ee.includes("pcb"))&&je.jsx(X2,{value:"pcb",children:je.jsx("div",{className:mg("rf-overflow-hidden",Je?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(fbn,{focusOnHover:!1,circuitJson:r,debugGraphics:o,containerClassName:mg("rf-h-full rf-w-full",Je?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ke=>{H&&Ke.forEach(tt=>H(tt))}}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("assembly"))&&je.jsx(X2,{value:"assembly",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallback:je.jsx("div",{children:"Error loading Assembly"}),children:r?je.jsx(I1n,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("schematic"))&&je.jsx(X2,{value:"schematic",children:je.jsx("div",{className:mg("rf-overflow-auto rf-bg-white",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(y1n,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ke=>{H==null||H(Ke)},debugGrid:ie}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("cad"))&&je.jsx(X2,{value:"cad",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{FallbackComponent:E0n,children:r?je.jsx(C0n,{ref:gt,circuitJson:r,autoRotateDisabled:K}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("bom"))&&je.jsx(X2,{value:"bom",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(S1n,{circuitJson:r}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("circuit_json"))&&je.jsx(X2,{value:"circuit_json",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallback:je.jsx("div",{children:"Error loading JSON viewer"}),children:r?je.jsx(E1n,{elements:r}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("errors"))&&je.jsx(X2,{value:"errors",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:t||me&&me.length>0||r?je.jsx(Nvn,{code:i,circuitJsonErrors:me,circuitJsonWarnings:Me,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:ve,autoroutingLog:B,onReportAutoroutingLog:M}):je.jsx(AQ,{onRunClicked:e})})}),u&&(!ee||ee.includes("render_log"))&&je.jsx(X2,{value:"render_log",children:je.jsx(ybn,{renderLog:f})})]})})})};var hK="Dialog",[Lat,Fat]=M5(hK),[Cbn,GS]=Lat(hK),Uat=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:o,modal:a=!0}=i,s=dt.useRef(null),l=dt.useRef(null),[c,u]=DR({prop:n,defaultProp:r??!1,onChange:o,caller:hK});return je.jsx(Cbn,{scope:e,triggerRef:s,contentRef:l,contentId:Q5(),titleId:Q5(),descriptionId:Q5(),open:c,onOpenChange:u,onOpenToggle:dt.useCallback(()=>u(d=>!d),[u]),modal:a,children:t})};Uat.displayName=hK;var Gat="DialogTrigger",Oat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Gat,t),o=Q9(e,r.triggerRef);return je.jsx(RI.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ove(r.open),...n,ref:o,onClick:gg(i.onClick,r.onOpenToggle)})});Oat.displayName=Gat;var Uve="DialogPortal",[xbn,zat]=Lat(Uve,{forceMount:void 0}),Hat=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,o=GS(Uve,e);return je.jsx(xbn,{scope:e,forceMount:t,children:dt.Children.map(n,a=>je.jsx(hB,{present:t||o.open,children:je.jsx(wme,{asChild:!0,container:r,children:a})}))})};Hat.displayName=Uve;var pK="DialogOverlay",Yat=dt.forwardRef((i,e)=>{const t=zat(pK,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=GS(pK,i.__scopeDialog);return o.modal?je.jsx(hB,{present:n||o.open,children:je.jsx(bbn,{...r,ref:e})}):null});Yat.displayName=pK;var Ebn=RR("DialogOverlay.RemoveScroll"),bbn=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(pK,t);return je.jsx(Tme,{as:Ebn,allowPinchZoom:!0,shards:[r.contentRef],children:je.jsx(RI.div,{"data-state":Ove(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),CQ="DialogContent",Vat=dt.forwardRef((i,e)=>{const t=zat(CQ,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=GS(CQ,i.__scopeDialog);return je.jsx(hB,{present:n||o.open,children:o.modal?je.jsx(Sbn,{...r,ref:e}):je.jsx(Bbn,{...r,ref:e})})});Vat.displayName=CQ;var Sbn=dt.forwardRef((i,e)=>{const t=GS(CQ,i.__scopeDialog),n=dt.useRef(null),r=Q9(e,t.contentRef,n);return dt.useEffect(()=>{const o=n.current;if(o)return _tt(o)},[]),je.jsx(jat,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gg(i.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:gg(i.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:gg(i.onFocusOutside,o=>o.preventDefault())})}),Bbn=dt.forwardRef((i,e)=>{const t=GS(CQ,i.__scopeDialog),n=dt.useRef(!1),r=dt.useRef(!1);return je.jsx(jat,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=i.onCloseAutoFocus)==null||a.call(i,o),o.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:o=>{var l,c;(l=i.onInteractOutside)==null||l.call(i,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((c=t.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),jat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:o,...a}=i,s=GS(CQ,t),l=dt.useRef(null),c=Q9(e,l);return Pet(),je.jsxs(je.Fragment,{children:[je.jsx(fme,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:o,children:je.jsx(cme,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Ove(s.open),...a,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),je.jsxs(je.Fragment,{children:[je.jsx(Mbn,{titleId:s.titleId}),je.jsx(Rbn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),Gve="DialogTitle",Kat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Gve,t);return je.jsx(RI.h2,{id:r.titleId,...n,ref:e})});Kat.displayName=Gve;var Jat="DialogDescription",Wat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Jat,t);return je.jsx(RI.p,{id:r.descriptionId,...n,ref:e})});Wat.displayName=Jat;var qat="DialogClose",Xat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(qat,t);return je.jsx(RI.button,{type:"button",...n,ref:e,onClick:gg(i.onClick,()=>r.onOpenChange(!1))})});Xat.displayName=qat;function Ove(i){return i?"open":"closed"}var Zat="DialogTitleWarning",[wbn,$at]=Z7t(Zat,{contentName:CQ,titleName:Gve,docsSlug:"dialog"}),Mbn=({titleId:i})=>{const e=$at(Zat),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
13507
|
+
`,onClick:n=>{n.stopPropagation(),t()},children:[je.jsx("input",{type:"checkbox",checked:e}),je.jsx("span",{style:{color:"#eee"},children:i})]}),cbn=({children:i,elements:e})=>{const[t,n]=ix(k=>[k.is_mouse_over_container,k.setIsMouseOverContainer]),[r,o]=dt.useState(!1),[a,s]=dt.useState(!1),[l,c]=dt.useState(!1),[u,d]=ix(k=>[k.selected_layer,k.selectLayer]),[f,h,g,y,v,_]=ix(k=>[k.in_move_footprint_mode,k.in_draw_trace_mode,k.is_showing_rats_nest,k.is_showing_multiple_traces_length,k.is_showing_autorouting,k.is_showing_drc_errors]),x=ix(k=>k.setEditMode),B=ix(k=>k.setIsShowingRatsNest),M=ix(k=>k.setIsShowingMultipleTracesLength),z=ix(k=>k.setIsShowingAutorouting),U=ix(k=>k.setIsShowingDrcErrors);e4("1",()=>d("top")),e4("2",()=>d("bottom")),e4("3",()=>d("inner1")),e4("4",()=>d("inner2")),e4("5",()=>d("inner3")),e4("6",()=>d("inner4")),e4("7",()=>d("inner5")),e4("8",()=>d("inner6"));const H=(e==null?void 0:e.filter(k=>k.type.includes("error")).length)??0;return je.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:k=>{n(!1),s(!1)},children:[i,je.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",sbn.version]}),je.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:tb.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[je.jsxs(kN,{onClick:()=>{s(!a)},onMouseLeave:()=>{a&&s(!1)},children:[je.jsxs("div",{children:["layer:"," ",je.jsx("span",{style:{marginLeft:2,fontWeight:500,color:PN[u]},children:u})]}),a&&je.jsx("div",{style:{marginTop:4,minWidth:120},children:Rve.map(k=>k.replace(/-/g,"")).map(k=>je.jsx(lbn,{name:k,selected:k===u,onClick:()=>{d(k.replace(/-/,""))}},k))})]}),je.jsxs(kN,{style:H>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[je.jsxs("div",{children:[H," errors"]}),l&&je.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(k=>k.type.includes("error")).map((k,j)=>je.jsxs(dt.Fragment,{children:[je.jsx("div",{children:k.error_type}),je.jsx("div",{children:k.message})]},j))})]}),je.jsx(kN,{style:{},onClick:()=>{x(h?"off":"draw_trace")},children:je.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),je.jsx(kN,{style:{},onClick:()=>{x(f?"off":"move_footprint")},children:je.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),je.jsx(kN,{style:{},onClick:()=>{B(!g)},children:je.jsxs("div",{children:[g?"✖ ":"","Rats Nest"]})}),je.jsx(kN,{onClick:()=>{o(!r)},children:je.jsxs("div",{children:[je.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",je.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&je.jsxs("div",{style:{marginTop:4,minWidth:120},children:[je.jsx(Lve,{label:"Show All Trace Lengths",checked:y,onClick:()=>{M(!y)}}),je.jsx(Lve,{label:"Show Autorouting Animation",checked:v,onClick:()=>{z(!v)}}),je.jsx(Lve,{label:"Show DRC Errors",checked:_,onClick:()=>{U(!_)}})]})]})})]})]})},ubn=i=>{const{transform:e,elements:t}=i,[n,r]=dt.useMemo(()=>{const c=i.elements.flatMap(d=>IEn(d,i.elements)),u=x5(i.elements);return[c,u]},[i.elements]),[o,a]=dt.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=dt.useMemo(()=>vEn({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:o.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:o.primitiveIdsInMousedOverNet}),[n,o]),l=dt.useCallback(c=>{var f,h;const u=[];for(const g of c)if(g._element){const y=r.getNetConnectedToId("pcb_port_id"in g._element?(f=g._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in g._element?(h=g._element)==null?void 0:h.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(y))}const d=new Set(c.map(g=>g._pcb_drawing_object_id));a({drawingObjectIdsWithMouseOver:d,primitiveIdsInMousedOverNet:u})},[r]);return je.jsx(obn,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:je.jsx(zEn,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(jEn,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(GEn,{transform:e,focusOnHover:i.focusOnHover,children:je.jsx(cbn,{elements:t,children:je.jsx(WEn,{transform:e,elements:t,children:je.jsx(abn,{transform:e,soup:t,children:je.jsx(FEn,{transform:e,debugGraphics:i.debugGraphics,children:je.jsx(UEn,{transform:e,elements:t,children:je.jsx(LEn,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},dbn=sf(Sp(400,300),mx(40,-40)),Abn=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:o,onEditEventsChanged:a,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=dt.useState(!l),[d,f]=Pve(),[h,g]=dt.useState(dbn),{ref:y,setTransform:v,cancelDrag:_}=yEn({transform:h,onSetTransform:g,enabled:c});let[x,B]=dt.useState([]);x=o??x;const M=dt.useRef(!1),z=dt.useRef(null),U=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,H=()=>{const K=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ie,width:ce,height:ue}=j.some(me=>me.type.startsWith("pcb_"))?lEn(j.filter(me=>me.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},le=Math.min((K.width??0)/ce,(K.height??0)/ue,100)*.75,ve=sf(Sp((K.width??0)/2,(K.height??0)/2),mx(le,-le,0,0),Sp(-ie.x,-ie.y));v(ve)};dt.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(M.current||(H(),M.current=!0))},[i,f]);const k=dt.useMemo(()=>(i==null?void 0:i.filter(K=>K.type.startsWith("pcb_")||K.type.startsWith("source_")))??[],[U]),j=dt.useMemo(()=>IIn({circuitJson:k,editEvents:x}),[k,x]),G=K=>{B([...x,K]),a==null||a([...x,K])},ee=K=>{const ie=x.map(ce=>ce.edit_event_id===K.edit_event_id?{...ce,...K}:ce);B(ie),a==null||a(ie)};return je.jsxs("div",{ref:y,style:{position:"relative"},children:[je.jsx("div",{ref:d,children:je.jsxs(uEn,{initialState:n,children:[je.jsx(ubn,{transform:h,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:G,onModifyEditEvent:ee,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:j,debugGraphics:e},f.width),je.jsx(AEn,{})]})}),l&&!c&&je.jsx("div",{onClick:()=>{u(!0),H()},onTouchStart:K=>{const ie=K.touches[0];z.current={x:ie.clientX,y:ie.clientY}},onTouchEnd:K=>{const ie=K.changedTouches[0],ce=z.current;if(!ce)return;const ue=Math.abs(ie.clientX-ce.x),le=Math.abs(ie.clientY-ce.y);ue<10&&le<10&&(K.preventDefault(),u(!0),H()),z.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:tb.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:je.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const fbn=({containerClassName:i,...e})=>{const t=dt.useRef(null),[n,r]=dt.useState(620);return dt.useLayoutEffect(()=>{const o=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};o();const a=new ResizeObserver(o);return t.current&&a.observe(t.current),window.addEventListener("resize",o),()=>{a.disconnect(),window.removeEventListener("resize",o)}},[]),je.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:je.jsx(Abn,{...e,height:n})})},hbn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-4{margin-left:1rem;margin-right:1rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[300px\\]{min-height:300px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-items-stretch{align-items:stretch}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',pbn=()=>{dt.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=hbn,document.head.appendChild(e)},[])},gbn=i=>{dt.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},Pat=i=>`hsl(${Ob.indexOf(i)*137.5%360}, 70%, 50%)`,mbn=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return je.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[je.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Ob.map(t=>{const n=i[t]||0,r=n/e*100;return je.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:Pat(t)},children:je.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),je.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},ybn=({renderLog:i})=>{const[e,t]=dt.useState("chronological");if(!i)return je.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((o,a)=>Ob.indexOf(o[0])-Ob.indexOf(a[0])):n.sort((o,a)=>a[1]-o[1]);const r=n.reduce((o,[a,s])=>o+s,0);return je.jsxs("div",{className:"rf-bg-white",children:[je.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("div",{children:"Render Logs"}),je.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[je.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),je.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[je.jsx("option",{value:"chronological",children:"Phase Order"}),je.jsx("option",{value:"longest",children:"Duration"})]})]})]}),je.jsx(mbn,{phaseTimings:i.phaseTimings}),je.jsxs("table",{className:"rf-w-full rf-text-xs",children:[je.jsx("thead",{children:je.jsxs("tr",{children:[je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),je.jsx("tbody",{children:n.map(([o,a])=>je.jsxs("tr",{children:[je.jsx("td",{className:"rf-p-2",children:Ob.indexOf(o)}),je.jsx("td",{className:"rf-p-2",children:o}),je.jsx("td",{className:"rf-p-2",children:je.jsx("div",{className:"rf-w-8",children:je.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:Pat(o),width:`${a/r*100}%`}})})}),je.jsx("td",{className:"rf-p-2",children:je.jsxs("div",{className:"rf-flex w-full",children:[je.jsxs("span",{className:"rf-flex-grow",children:[a,"ms"]}),je.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(a/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},kat=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{dt.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{GO.captureException(n)}catch{}}},[i,e]),dt.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{GO.captureException(r,{error_type:n.type})}catch{}}},[t])},vbn="0.0.713",Fve=nDe()(iDe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),_bn=["assembly","bom","circuit_json","errors","render_log"],Ibn=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:o,showRightHeaderContent:a=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:d,renderLog:f,showImportAndFormatButtons:h=!0,className:g,headerClassName:y,leftHeaderContent:v,readOnly:_,isStreaming:x,autoroutingLog:B,onReportAutoroutingLog:M,isRunningCode:z,hasCodeChangedSinceLastRun:U,onEditEvent:H,editEvents:k,defaultActiveTab:j,defaultTab:G,availableTabs:ee,autoRotate3dViewerDisabled:K,showSchematicDebugGrid:ie=!1,showToggleFullScreen:ce=!0,defaultToFullScreen:ue=!1,activeEffectName:le})=>{var Fe;pbn();const ve=Fve(Ke=>Ke.lastRunEvalVersion),me=dt.useMemo(()=>r?r.filter(Ke=>Ke&&"error_type"in Ke||Ke.type.includes("error")):null,[r]),Me=dt.useMemo(()=>r?r.filter(Ke=>Ke&&"warning_type"in Ke||Ke.type.includes("warning")):null,[r]);kat({errorMessage:t,errorStack:n,circuitJsonErrors:me});const[Be,Ne]=dt.useState(j??G??(ee==null?void 0:ee[0])??"pcb"),[xe,Oe]=dt.useState(null),[Je,ot]=dt.useState(ue);gbn(Je);const ct=dt.useCallback(Ke=>{Ne(Ke),d==null||d(Ke)},[d]),kt=()=>{ot(!Je)};dt.useEffect(()=>{t&&(Be!=="errors"&&Oe(Be),ct("errors"))},[t]),dt.useEffect(()=>{(Be==="code"||Be==="errors")&&r&&!t&&ct(xe??j??G??(ee==null?void 0:ee[0])??"pcb")},[r]);const gt=dt.useCallback(Ke=>{window.TSCIRCUIT_3D_OBJECT_REF=Ke===null?void 0:Ke},[]);return je.jsx("div",{className:mg("flex flex-col relative rf-overflow-x-hidden rf-h-full",g),children:je.jsx("div",{className:mg("rf-md:sticky rf-md:top-2 rf-h-full",Je&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:je.jsxs(Wre,{value:Be,onValueChange:ct,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[je.jsxs("div",{className:mg("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",y),children:[v,v&&je.jsx("div",{className:"rf-flex-grow"}),!v&&z&&je.jsx(sQ,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!v&&je.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&!t&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[le?je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:le}):f.lastRenderEvent&&je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((Fe=f.lastRenderEvent)==null?void 0:Fe.phase)??""}),je.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:je.jsx(sQ,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),je.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),a&&je.jsxs(OO,{children:[s&&je.jsx(IB,{value:"code",children:"Code"}),!ee||ee.includes("pcb")?je.jsxs(IB,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&je.jsx("span",{className:mg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!ee||ee.includes("schematic")?je.jsxs(IB,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&je.jsx("span",{className:mg("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!ee||ee.includes("cad")?je.jsxs(IB,{value:"cad",children:[r&&je.jsx("span",{className:mg("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",U?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Be)&&je.jsx(IB,{value:Be,children:Z8e(Be)}),je.jsxs(Yme,{children:[je.jsx(Vme,{asChild:!0,children:je.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[je.jsx(k0n,{className:"rf-w-4 rf-h-4"}),(me&&me.length>0||t)&&je.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),je.jsxs(mj,{className:"rf-*:text-xs",children:[_bn.filter(Ke=>!ee||ee.includes(Ke)).map(Ke=>je.jsxs(D2,{onSelect:()=>ct(Ke),children:[Be!==Ke&&je.jsx(het,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Be===Ke&&je.jsx(Xge,{className:"rf-w-3 rf-h-3"}),je.jsx("div",{className:"rf-pr-2",children:Z8e(Ke)}),Ke==="errors"&&(me&&me.length>0||t)&&je.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:me==null?void 0:me.length})]},Ke)),je.jsx(D2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",vbn.split(".").map((Ke,tt)=>tt===2?parseInt(Ke)+1:Ke).join(".")]})}),ve&&je.jsx(D2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ve]})})]})]})]}),ce&&je.jsx(N9,{onClick:kt,variant:"ghost",children:Je?je.jsx(G0n,{size:16}):je.jsx(F0n,{size:16})})]}),s&&je.jsx(X2,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:je.jsx("div",{className:"rf-h-full",children:l})}),(!ee||ee.includes("pcb"))&&je.jsx(X2,{value:"pcb",children:je.jsx("div",{className:mg("rf-overflow-hidden",Je?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(fbn,{focusOnHover:!1,circuitJson:r,debugGraphics:o,containerClassName:mg("rf-h-full rf-w-full",Je?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ke=>{H&&Ke.forEach(tt=>H(tt))}}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("assembly"))&&je.jsx(X2,{value:"assembly",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallback:je.jsx("div",{children:"Error loading Assembly"}),children:r?je.jsx(I1n,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("schematic"))&&je.jsx(X2,{value:"schematic",children:je.jsx("div",{className:mg("rf-overflow-auto rf-bg-white",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(y1n,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ke=>{H==null||H(Ke)},debugGrid:ie}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("cad"))&&je.jsx(X2,{value:"cad",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{FallbackComponent:E0n,children:r?je.jsx(C0n,{ref:gt,circuitJson:r,autoRotateDisabled:K}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("bom"))&&je.jsx(X2,{value:"bom",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallbackRender:({error:Ke})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ke==null?void 0:Ke.message)||"An unknown error occurred"})]})}),children:r?je.jsx(S1n,{circuitJson:r}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("circuit_json"))&&je.jsx(X2,{value:"circuit_json",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(cN,{fallback:je.jsx("div",{children:"Error loading JSON viewer"}),children:r?je.jsx(E1n,{elements:r}):je.jsx(AQ,{onRunClicked:e})})})}),(!ee||ee.includes("errors"))&&je.jsx(X2,{value:"errors",children:je.jsx("div",{className:mg("rf-overflow-auto",Je?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:t||me&&me.length>0||r?je.jsx(Nvn,{code:i,circuitJsonErrors:me,circuitJsonWarnings:Me,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:ve,autoroutingLog:B,onReportAutoroutingLog:M}):je.jsx(AQ,{onRunClicked:e})})}),u&&(!ee||ee.includes("render_log"))&&je.jsx(X2,{value:"render_log",children:je.jsx(ybn,{renderLog:f})})]})})})};var hK="Dialog",[Lat,Fat]=M5(hK),[Cbn,GS]=Lat(hK),Uat=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:o,modal:a=!0}=i,s=dt.useRef(null),l=dt.useRef(null),[c,u]=DR({prop:n,defaultProp:r??!1,onChange:o,caller:hK});return je.jsx(Cbn,{scope:e,triggerRef:s,contentRef:l,contentId:Q5(),titleId:Q5(),descriptionId:Q5(),open:c,onOpenChange:u,onOpenToggle:dt.useCallback(()=>u(d=>!d),[u]),modal:a,children:t})};Uat.displayName=hK;var Gat="DialogTrigger",Oat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Gat,t),o=Q9(e,r.triggerRef);return je.jsx(RI.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ove(r.open),...n,ref:o,onClick:gg(i.onClick,r.onOpenToggle)})});Oat.displayName=Gat;var Uve="DialogPortal",[xbn,zat]=Lat(Uve,{forceMount:void 0}),Hat=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,o=GS(Uve,e);return je.jsx(xbn,{scope:e,forceMount:t,children:dt.Children.map(n,a=>je.jsx(hB,{present:t||o.open,children:je.jsx(wme,{asChild:!0,container:r,children:a})}))})};Hat.displayName=Uve;var pK="DialogOverlay",Yat=dt.forwardRef((i,e)=>{const t=zat(pK,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=GS(pK,i.__scopeDialog);return o.modal?je.jsx(hB,{present:n||o.open,children:je.jsx(bbn,{...r,ref:e})}):null});Yat.displayName=pK;var Ebn=RR("DialogOverlay.RemoveScroll"),bbn=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(pK,t);return je.jsx(Tme,{as:Ebn,allowPinchZoom:!0,shards:[r.contentRef],children:je.jsx(RI.div,{"data-state":Ove(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),CQ="DialogContent",Vat=dt.forwardRef((i,e)=>{const t=zat(CQ,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=GS(CQ,i.__scopeDialog);return je.jsx(hB,{present:n||o.open,children:o.modal?je.jsx(Sbn,{...r,ref:e}):je.jsx(Bbn,{...r,ref:e})})});Vat.displayName=CQ;var Sbn=dt.forwardRef((i,e)=>{const t=GS(CQ,i.__scopeDialog),n=dt.useRef(null),r=Q9(e,t.contentRef,n);return dt.useEffect(()=>{const o=n.current;if(o)return _tt(o)},[]),je.jsx(jat,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gg(i.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:gg(i.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:gg(i.onFocusOutside,o=>o.preventDefault())})}),Bbn=dt.forwardRef((i,e)=>{const t=GS(CQ,i.__scopeDialog),n=dt.useRef(!1),r=dt.useRef(!1);return je.jsx(jat,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=i.onCloseAutoFocus)==null||a.call(i,o),o.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:o=>{var l,c;(l=i.onInteractOutside)==null||l.call(i,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((c=t.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),jat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:o,...a}=i,s=GS(CQ,t),l=dt.useRef(null),c=Q9(e,l);return Pet(),je.jsxs(je.Fragment,{children:[je.jsx(fme,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:o,children:je.jsx(cme,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Ove(s.open),...a,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),je.jsxs(je.Fragment,{children:[je.jsx(Mbn,{titleId:s.titleId}),je.jsx(Rbn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),Gve="DialogTitle",Kat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Gve,t);return je.jsx(RI.h2,{id:r.titleId,...n,ref:e})});Kat.displayName=Gve;var Jat="DialogDescription",Wat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(Jat,t);return je.jsx(RI.p,{id:r.descriptionId,...n,ref:e})});Wat.displayName=Jat;var qat="DialogClose",Xat=dt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=GS(qat,t);return je.jsx(RI.button,{type:"button",...n,ref:e,onClick:gg(i.onClick,()=>r.onOpenChange(!1))})});Xat.displayName=qat;function Ove(i){return i?"open":"closed"}var Zat="DialogTitleWarning",[wbn,$at]=Z7t(Zat,{contentName:CQ,titleName:Gve,docsSlug:"dialog"}),Mbn=({titleId:i})=>{const e=$at(Zat),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
|
13508
13508
|
|
|
13509
13509
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
13510
13510
|
|
|
@@ -14591,4 +14591,4 @@ ${n.stack}`),t.complete=!0,"root"in this&&this.root&&this.root.emit("asyncEffect
|
|
|
14591
14591
|
* This source code is licensed under the MIT license found in the
|
|
14592
14592
|
* LICENSE file in the root directory of this source tree.
|
|
14593
14593
|
*)
|
|
14594
|
-
*/const GKn=async i=>{var o;const e=await UKn(i,{fetch:(a,s)=>{var l,c,u,d,f;return fetch(`${w5}/proxy`,{...s,headers:{...s==null?void 0:s.headers,"X-Target-Url":a.toString(),"X-Sender-Origin":((l=s==null?void 0:s.headers)==null?void 0:l.origin)??"","X-Sender-Host":((c=s==null?void 0:s.headers)==null?void 0:c.host)??"https://easyeda.com","X-Sender-Referer":((u=s==null?void 0:s.headers)==null?void 0:u.referer)??"","X-Sender-User-Agent":((d=s==null?void 0:s.headers)==null?void 0:d.userAgent)??"","X-Sender-Cookie":((f=s==null?void 0:s.headers)==null?void 0:f.cookie)??""}})}}),t=await kKn(e),n=(o=t.match(/export const (\w+) = .*/))==null?void 0:o[1];if(!n)throw console.error("COULD NOT DETERMINE FILE NAME OF CONVERTED COMPONENT:",t),new Error("Could not determine file name of converted component");const r=`imports/${n}.tsx`;return await Tst.post(`${w5}/files/upsert`,{json:{file_path:r,text_content:t}}),{filePath:r}},OKn=i=>{const e=Fve(me=>me.lastRunEvalVersion),[t,n]=dt.useState(null),[r,o]=dt.useState(!1),[a,s]=dt.useState(!0),[l,c]=dt.useState(!1),[u,d]=dt.useState(null),[f,h]=dt.useState(null),[g,y]=dt.useState(!1),[v,_]=dt.useState(null),[x,B]=dt.useState(null),[M,z]=dt.useState(!1),[U,H]=dt.useState(!1),k=wSn(),j=v2(me=>me.pushEvent),G=v2(me=>me.recentEvents),ee=dt.useMemo(()=>Date.now(),[]);VSn(me=>{if(!(new Date(me.created_at).valueOf()<ee+500)){if(me.event_type==="FILE_UPDATED"){o(!0);return}if(me.event_type==="SNIPPET_SAVED"){o(!1),s(!1),_("Snippet saved successfully."),z(!1);return}me.event_type==="REQUEST_EXPORT"&&(H(!0),_("Export processing..."),z(!1)),me.event_type==="EXPORT_CREATED"&&(_(`Export created: ${me.exportFilePath}`),z(!1),H(!1))}}),dt.useEffect(()=>{if(!l||u===null)return;const me=G.filter(Ne=>new Date(Ne.created_at).valueOf()>u),Me=me.find(Ne=>Ne.event_type==="FAILED_TO_SAVE_SNIPPET"),Be=me.find(Ne=>Ne.event_type==="SNIPPET_SAVED");Me&&(c(!1),d(null),B(Me.message??"Failed to save snippet. See console for error."),console.error(Me.message),z(!0),Me.error_code==="SNIPPET_UNSET"&&Me.available_snippet_names&&(h(Me.available_snippet_names),y(!0))),Be&&(c(!1),d(null),_("Snippet saved successfully."),z(!1))},[G,l]);const K=async()=>{c(!0),d(Date.now()),_(null),z(!1),await j({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:t})},ie=v2(me=>me.circuitJson),[ce,ue]=dt.useState(!1),[le,ve]=dt.useState(!1);return je.jsxs(je.Fragment,{children:[je.jsxs(Yme,{children:[je.jsx(Vme,{asChild:!0,children:je.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"File"})}),je.jsxs(mj,{children:[je.jsx(D2,{className:"rf-text-xs",onSelect:K,disabled:l,children:l?"Saving...":"Push"}),parseInt(window.location.port)>5e3&&je.jsx(D2,{className:"rf-text-xs",onSelect:()=>{k.open()},children:"Order"}),je.jsx(D2,{className:"rf-text-xs",onSelect:()=>ue(!0),disabled:l,children:"Import"}),je.jsx(D2,{className:"rf-text-xs",onSelect:()=>{if(!a_e()){$C.error("Requires tscircuit token");return}ve(!0)},children:"AI Review"}),je.jsxs(Rnt,{children:[je.jsx(jme,{className:"rf-text-xs",disabled:U,children:U?"Exporting...":"Export"}),je.jsx(Qnt,{children:je.jsx(Kme,{children:$5n.map((me,Me)=>je.jsx(D2,{onSelect:()=>{if(!ie){$C.error("No Circuit JSON to export");return}ewn({exportName:me.name,circuitJson:ie,projectName:t??"Untitled"})},disabled:U,children:je.jsx("span",{className:"rf-text-xs",children:me.name})},Me))})})]}),je.jsxs(Rnt,{children:[je.jsx(jme,{className:"rf-text-xs",children:"Advanced"}),je.jsx(Qnt,{children:je.jsxs(Kme,{children:[je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",children:je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[je.jsx(wlt,{id:"load-latest-eval",checked:i.shouldLoadLatestEval,onCheckedChange:me=>{i.onChangeShouldLoadLatestEval(me===!0)}}),je.jsx("label",{htmlFor:"load-latest-eval",className:"rf-text-xs rf-cursor-pointer",children:"Force Latest @tscircuit/eval"})]})}),e&&je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",children:je.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:je.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/eval@",e]})})}),je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",onClick:()=>{window.open("/api/admin","_blank")},children:je.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:je.jsx("span",{className:"rf-text-xs",children:"CLI Admin Panel"})})})]})})]})]}),je.jsx(rBn,{open:M,onOpenChange:z,children:je.jsxs(plt,{children:[je.jsxs(glt,{children:[je.jsx(ylt,{children:"Error Saving Snippet"}),je.jsx(vlt,{children:x})]}),je.jsx(mlt,{children:je.jsx(_lt,{onClick:()=>z(!1),children:"Dismiss"})})]})}),je.jsx(YSn,{snippetNames:f??[],onSelect:async me=>{c(!0),d(Date.now()),n(me),await j({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:me}),y(!1)},onCancel:()=>y(!1),isOpen:g})]}),je.jsx(gBn,{isOpen:ce,onClose:()=>ue(!1),onImport:async me=>{$C.promise(async()=>{if(me.source==="tscircuit.com")throw await j({event_type:"INSTALL_PACKAGE",full_package_name:`@tsci/${me.owner}.${me.name}`}),new Error("Not implemented");if(me.source==="jlcpcb"){const{filePath:Me}=await GKn(me.partNumber);return{filePath:Me}}},{loading:`Importing component: "${me.name}"`,error:Me=>(console.error("IMPORT ERROR",Me),`Error importing component: "${me.name}": ${Me.toString()}`),success:Me=>Me!=null&&Me.filePath?`Imported to "${Me.filePath}"`:"Import Successful"})}}),je.jsx(Uwn,{isOpen:le,onClose:()=>ve(!1),packageName:t}),je.jsx(tSn,{position:"top-center",reverseOrder:!1,containerStyle:{zIndex:1e5},toastOptions:{style:{zIndex:1e5}}}),je.jsx(k.OrderDialog,{isOpen:k.isOpen,onClose:k.close,stage:k.stage,setStage:k.setStage})]})},zKn=i=>{const[e,t]=HSn("load-latest-eval",!0);return je.jsx(Xgt,{debug:i.debug,forceLatestEvalVersion:e,defaultToFullScreen:!0,showToggleFullScreen:!1,leftHeaderContent:je.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between",children:[je.jsx(OKn,{shouldLoadLatestEval:e,onChangeShouldLoadLatestEval:n=>{t(n),globalThis.runFrameWorker=null}}),i.scenarioSelectorContent]})})},HKn=()=>{const i=v2(e=>e.fsMap);dt.useEffect(()=>{if(!document||!i)return;const e=Array.from(i.keys()),t=YKn(e),n=i.get("package.json");try{if(n){const r=JSON.parse(n);if(r!=null&&r.name){document.title=r.name;return}}}catch{}t&&(document.title=t)},[i])},qgt=cI("run-frame:RunFrameWithApi"),YKn=i=>i.find(e=>e.includes("entrypoint."))??i.find(e=>e.includes("index."))??i.find(e=>e.includes("main."))??i.find(e=>e.endsWith(".tsx")),VKn=i=>i.find(e=>e.includes("manual-edits."))??i.find(e=>e.includes("manual-edit."))??i.find(e=>e.endsWith(".json")),Xgt=i=>{const{apiBaseUrl:e,leftHeaderContent:t}=i;dt.useEffect(()=>{i.debug&&cI.enable("run-frame*")},[i.debug]);const{startPolling:n,stopPolling:r,loadInitialFiles:o}=v2(h=>({startPolling:h.startPolling,stopPolling:h.stopPolling,loadInitialFiles:h.loadInitialFiles})),a=v2(h=>h.fsMap),s=v2(h=>h.circuitJson),l=window==null?void 0:window.TSCIRCUIT_MAIN_COMPONENT_PATH;dt.useEffect(()=>{o()},[]),HKn();const{editEventsForRender:c,pushEditEvent:u,markRenderStarted:d,markRenderComplete:f}=X7t();return dt.useEffect(()=>{e&&(window.TSCIRCUIT_FILESERVER_API_BASE_URL=e)},[e]),dt.useEffect(()=>(n(),()=>r()),[n,r]),je.jsx(Wst,{fsMap:a,evalVersion:i.evalVersion,forceLatestEvalVersion:i.forceLatestEvalVersion,leftHeaderContent:t,defaultToFullScreen:i.defaultToFullScreen,showToggleFullScreen:i.showToggleFullScreen,mainComponentPath:l,onInitialRender:()=>{qgt("onInitialRender / markRenderStarted"),d()},onRenderFinished:()=>{qgt("onRenderFinished / markRenderComplete"),f()},editEvents:c,onEditEvent:h=>{u(h),fetch(`${w5}/events/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event_type:"USER_CREATED_MANUAL_EDIT",...h})});const g=VKn(Array.from(a.keys()))??"manual-edits.json",y=a.get(g),v=JSON.parse(y??"{}");GRe({circuitJson:s,editEvents:[h],manualEditsFile:v}),fetch(`${w5}/files/upsert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:g,text_content:JSON.stringify(v),initiator:"runframe"})})}})},jKn=()=>{const i=document.getElementById("root");if(i)return i;const e=document.createElement("div");return e.id="root",e.style.height="100vh",document.body.appendChild(e),e},KKn=()=>{const i=Array.from(document.querySelectorAll("script[type='tscircuit-tsx']")),e=new Map;return i.
|
|
14594
|
+
*/const GKn=async i=>{var o;const e=await UKn(i,{fetch:(a,s)=>{var l,c,u,d,f;return fetch(`${w5}/proxy`,{...s,headers:{...s==null?void 0:s.headers,"X-Target-Url":a.toString(),"X-Sender-Origin":((l=s==null?void 0:s.headers)==null?void 0:l.origin)??"","X-Sender-Host":((c=s==null?void 0:s.headers)==null?void 0:c.host)??"https://easyeda.com","X-Sender-Referer":((u=s==null?void 0:s.headers)==null?void 0:u.referer)??"","X-Sender-User-Agent":((d=s==null?void 0:s.headers)==null?void 0:d.userAgent)??"","X-Sender-Cookie":((f=s==null?void 0:s.headers)==null?void 0:f.cookie)??""}})}}),t=await kKn(e),n=(o=t.match(/export const (\w+) = .*/))==null?void 0:o[1];if(!n)throw console.error("COULD NOT DETERMINE FILE NAME OF CONVERTED COMPONENT:",t),new Error("Could not determine file name of converted component");const r=`imports/${n}.tsx`;return await Tst.post(`${w5}/files/upsert`,{json:{file_path:r,text_content:t}}),{filePath:r}},OKn=i=>{const e=Fve(me=>me.lastRunEvalVersion),[t,n]=dt.useState(null),[r,o]=dt.useState(!1),[a,s]=dt.useState(!0),[l,c]=dt.useState(!1),[u,d]=dt.useState(null),[f,h]=dt.useState(null),[g,y]=dt.useState(!1),[v,_]=dt.useState(null),[x,B]=dt.useState(null),[M,z]=dt.useState(!1),[U,H]=dt.useState(!1),k=wSn(),j=v2(me=>me.pushEvent),G=v2(me=>me.recentEvents),ee=dt.useMemo(()=>Date.now(),[]);VSn(me=>{if(!(new Date(me.created_at).valueOf()<ee+500)){if(me.event_type==="FILE_UPDATED"){o(!0);return}if(me.event_type==="SNIPPET_SAVED"){o(!1),s(!1),_("Snippet saved successfully."),z(!1);return}me.event_type==="REQUEST_EXPORT"&&(H(!0),_("Export processing..."),z(!1)),me.event_type==="EXPORT_CREATED"&&(_(`Export created: ${me.exportFilePath}`),z(!1),H(!1))}}),dt.useEffect(()=>{if(!l||u===null)return;const me=G.filter(Ne=>new Date(Ne.created_at).valueOf()>u),Me=me.find(Ne=>Ne.event_type==="FAILED_TO_SAVE_SNIPPET"),Be=me.find(Ne=>Ne.event_type==="SNIPPET_SAVED");Me&&(c(!1),d(null),B(Me.message??"Failed to save snippet. See console for error."),console.error(Me.message),z(!0),Me.error_code==="SNIPPET_UNSET"&&Me.available_snippet_names&&(h(Me.available_snippet_names),y(!0))),Be&&(c(!1),d(null),_("Snippet saved successfully."),z(!1))},[G,l]);const K=async()=>{c(!0),d(Date.now()),_(null),z(!1),await j({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:t})},ie=v2(me=>me.circuitJson),[ce,ue]=dt.useState(!1),[le,ve]=dt.useState(!1);return je.jsxs(je.Fragment,{children:[je.jsxs(Yme,{children:[je.jsx(Vme,{asChild:!0,children:je.jsx("div",{className:"rf-whitespace-nowrap rf-text-xs font-medium rf-p-2 rf-mx-1 rf-cursor-pointer rf-relative",children:"File"})}),je.jsxs(mj,{children:[je.jsx(D2,{className:"rf-text-xs",onSelect:K,disabled:l,children:l?"Saving...":"Push"}),parseInt(window.location.port)>5e3&&je.jsx(D2,{className:"rf-text-xs",onSelect:()=>{k.open()},children:"Order"}),je.jsx(D2,{className:"rf-text-xs",onSelect:()=>ue(!0),disabled:l,children:"Import"}),je.jsx(D2,{className:"rf-text-xs",onSelect:()=>{if(!a_e()){$C.error("Requires tscircuit token");return}ve(!0)},children:"AI Review"}),je.jsxs(Rnt,{children:[je.jsx(jme,{className:"rf-text-xs",disabled:U,children:U?"Exporting...":"Export"}),je.jsx(Qnt,{children:je.jsx(Kme,{children:$5n.map((me,Me)=>je.jsx(D2,{onSelect:()=>{if(!ie){$C.error("No Circuit JSON to export");return}ewn({exportName:me.name,circuitJson:ie,projectName:t??"Untitled"})},disabled:U,children:je.jsx("span",{className:"rf-text-xs",children:me.name})},Me))})})]}),je.jsxs(Rnt,{children:[je.jsx(jme,{className:"rf-text-xs",children:"Advanced"}),je.jsx(Qnt,{children:je.jsxs(Kme,{children:[je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",children:je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[je.jsx(wlt,{id:"load-latest-eval",checked:i.shouldLoadLatestEval,onCheckedChange:me=>{i.onChangeShouldLoadLatestEval(me===!0)}}),je.jsx("label",{htmlFor:"load-latest-eval",className:"rf-text-xs rf-cursor-pointer",children:"Force Latest @tscircuit/eval"})]})}),e&&je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",children:je.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:je.jsxs("span",{className:"rf-text-xs",children:["@tscircuit/eval@",e]})})}),je.jsx(D2,{className:"rf-flex rf-items-center rf-gap-2",onClick:()=>{window.open("/api/admin","_blank")},children:je.jsx("div",{className:"rf-flex rf-items-center rf-gap-2",children:je.jsx("span",{className:"rf-text-xs",children:"CLI Admin Panel"})})})]})})]})]}),je.jsx(rBn,{open:M,onOpenChange:z,children:je.jsxs(plt,{children:[je.jsxs(glt,{children:[je.jsx(ylt,{children:"Error Saving Snippet"}),je.jsx(vlt,{children:x})]}),je.jsx(mlt,{children:je.jsx(_lt,{onClick:()=>z(!1),children:"Dismiss"})})]})}),je.jsx(YSn,{snippetNames:f??[],onSelect:async me=>{c(!0),d(Date.now()),n(me),await j({event_type:"REQUEST_TO_SAVE_SNIPPET",snippet_name:me}),y(!1)},onCancel:()=>y(!1),isOpen:g})]}),je.jsx(gBn,{isOpen:ce,onClose:()=>ue(!1),onImport:async me=>{$C.promise(async()=>{if(me.source==="tscircuit.com")throw await j({event_type:"INSTALL_PACKAGE",full_package_name:`@tsci/${me.owner}.${me.name}`}),new Error("Not implemented");if(me.source==="jlcpcb"){const{filePath:Me}=await GKn(me.partNumber);return{filePath:Me}}},{loading:`Importing component: "${me.name}"`,error:Me=>(console.error("IMPORT ERROR",Me),`Error importing component: "${me.name}": ${Me.toString()}`),success:Me=>Me!=null&&Me.filePath?`Imported to "${Me.filePath}"`:"Import Successful"})}}),je.jsx(Uwn,{isOpen:le,onClose:()=>ve(!1),packageName:t}),je.jsx(tSn,{position:"top-center",reverseOrder:!1,containerStyle:{zIndex:1e5},toastOptions:{style:{zIndex:1e5}}}),je.jsx(k.OrderDialog,{isOpen:k.isOpen,onClose:k.close,stage:k.stage,setStage:k.setStage})]})},zKn=i=>{const[e,t]=HSn("load-latest-eval",!0);return je.jsx(Xgt,{debug:i.debug,forceLatestEvalVersion:e,defaultToFullScreen:!0,showToggleFullScreen:!1,leftHeaderContent:je.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between",children:[je.jsx(OKn,{shouldLoadLatestEval:e,onChangeShouldLoadLatestEval:n=>{t(n),globalThis.runFrameWorker=null}}),i.scenarioSelectorContent]})})},HKn=()=>{const i=v2(e=>e.fsMap);dt.useEffect(()=>{if(!document||!i)return;const e=Array.from(i.keys()),t=YKn(e),n=i.get("package.json");try{if(n){const r=JSON.parse(n);if(r!=null&&r.name){document.title=r.name;return}}}catch{}t&&(document.title=t)},[i])},qgt=cI("run-frame:RunFrameWithApi"),YKn=i=>i.find(e=>e.includes("entrypoint."))??i.find(e=>e.includes("index."))??i.find(e=>e.includes("main."))??i.find(e=>e.endsWith(".tsx")),VKn=i=>i.find(e=>e.includes("manual-edits."))??i.find(e=>e.includes("manual-edit."))??i.find(e=>e.endsWith(".json")),Xgt=i=>{const{apiBaseUrl:e,leftHeaderContent:t}=i;dt.useEffect(()=>{i.debug&&cI.enable("run-frame*")},[i.debug]);const{startPolling:n,stopPolling:r,loadInitialFiles:o}=v2(h=>({startPolling:h.startPolling,stopPolling:h.stopPolling,loadInitialFiles:h.loadInitialFiles})),a=v2(h=>h.fsMap),s=v2(h=>h.circuitJson),l=window==null?void 0:window.TSCIRCUIT_MAIN_COMPONENT_PATH;dt.useEffect(()=>{o()},[]),HKn();const{editEventsForRender:c,pushEditEvent:u,markRenderStarted:d,markRenderComplete:f}=X7t();return dt.useEffect(()=>{e&&(window.TSCIRCUIT_FILESERVER_API_BASE_URL=e)},[e]),dt.useEffect(()=>(n(),()=>r()),[n,r]),je.jsx(Wst,{fsMap:a,evalVersion:i.evalVersion,forceLatestEvalVersion:i.forceLatestEvalVersion,leftHeaderContent:t,defaultToFullScreen:i.defaultToFullScreen,showToggleFullScreen:i.showToggleFullScreen,mainComponentPath:l,onInitialRender:()=>{qgt("onInitialRender / markRenderStarted"),d()},onRenderFinished:()=>{qgt("onRenderFinished / markRenderComplete"),f()},editEvents:c,onEditEvent:h=>{u(h),fetch(`${w5}/events/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event_type:"USER_CREATED_MANUAL_EDIT",...h})});const g=VKn(Array.from(a.keys()))??"manual-edits.json",y=a.get(g),v=JSON.parse(y??"{}");GRe({circuitJson:s,editEvents:[h],manualEditsFile:v}),fetch(`${w5}/files/upsert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:g,text_content:JSON.stringify(v),initiator:"runframe"})})}})},jKn=()=>{const i=document.getElementById("root");if(i)return i;const e=document.createElement("div");return e.id="root",e.style.height="100vh",document.body.appendChild(e),e},KKn=async()=>{const i=Array.from(document.querySelectorAll("script[type='tscircuit-tsx']")),e=new Map;return await Promise.all(i.map(async(t,n)=>{const r=t.dataset.path||t.getAttribute("data-file-path")||`script${n?n+1:""}.tsx`;if(t.src){const a=await(await fetch(t.src)).text();e.set(r,a)}else e.set(r,t.textContent||"")})),{fsMap:e}},eEe=Ube.createRoot(jKn());(async()=>{if(window.TSCIRCUIT_USE_RUNFRAME_FOR_CLI)eEe.render(je.jsx(zKn,{}));else{const{fsMap:i}=await KKn();i.size>0?eEe.render(je.jsx(Wst,{fsMap:i})):eEe.render(je.jsx(Xgt,{}))}})();const JKn=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tscircuit/runframe",
|
|
3
3
|
"main": "dist/preview.js",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.714",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/preview.js",
|
|
8
8
|
"./preview": "./dist/preview.js",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@tscircuit/pcb-viewer": "^1.11.177",
|
|
78
78
|
"@tscircuit/props": "^0.0.262",
|
|
79
79
|
"@tscircuit/schematic-viewer": "2.0.24",
|
|
80
|
-
"circuit-to-svg": "^0.0.
|
|
80
|
+
"circuit-to-svg": "^0.0.173",
|
|
81
81
|
"jscad-fiber": "^0.0.80",
|
|
82
82
|
"lucide-react": "^0.488.0",
|
|
83
83
|
"react-query": "^3.39.3",
|